1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const decoratorSupport_1 = require("./internal/metadata/decoratorSupport");
|
4 | const string_1 = require("./internal/util/string");
|
5 |
|
6 |
|
7 |
|
8 | function Parameter(details = {}) {
|
9 | return (target, propertyKey) => {
|
10 | decoratorSupport_1.declareParameter(target, propertyKey, details);
|
11 | };
|
12 | }
|
13 | exports.Parameter = Parameter;
|
14 |
|
15 |
|
16 |
|
17 | function MappedParameter(uri, required = true) {
|
18 | return (target, name) => {
|
19 | decoratorSupport_1.declareMappedParameter(target, name, uri, required);
|
20 | };
|
21 | }
|
22 | exports.MappedParameter = MappedParameter;
|
23 |
|
24 |
|
25 |
|
26 | function Secret(uri) {
|
27 | return (target, name) => {
|
28 | decoratorSupport_1.declareSecret(target, name, uri);
|
29 | };
|
30 | }
|
31 | exports.Secret = Secret;
|
32 |
|
33 |
|
34 |
|
35 | function Value(pathOrValue) {
|
36 | return (target, name) => {
|
37 | if (typeof pathOrValue === "string") {
|
38 | decoratorSupport_1.declareValue(target, name, {
|
39 | path: pathOrValue,
|
40 | });
|
41 | }
|
42 | else {
|
43 | decoratorSupport_1.declareValue(target, name, pathOrValue);
|
44 | }
|
45 | };
|
46 | }
|
47 | exports.Value = Value;
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 | function CommandHandler(description, ...intent) {
|
56 | return (obj) => { decoratorSupport_1.declareCommandHandler(obj, description, null, intent); };
|
57 | }
|
58 | exports.CommandHandler = CommandHandler;
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | function ConfigurableCommandHandler(description, options) {
|
67 | const intent = options.intent ? string_1.toStringArray(options.intent) : [];
|
68 | const autoSubmit = options.autoSubmit ? options.autoSubmit : false;
|
69 | return (obj) => { decoratorSupport_1.declareCommandHandler(obj, description, autoSubmit, intent); };
|
70 | }
|
71 | exports.ConfigurableCommandHandler = ConfigurableCommandHandler;
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 | function Parameters() {
|
78 | return (obj) => { decoratorSupport_1.declareParameters(obj); };
|
79 | }
|
80 | exports.Parameters = Parameters;
|
81 | function EventHandler(description, subscription) {
|
82 | return (obj) => {
|
83 | decoratorSupport_1.declareEventHandler(obj, description, subscription);
|
84 | };
|
85 | }
|
86 | exports.EventHandler = EventHandler;
|
87 |
|
88 |
|
89 |
|
90 | function Tags(...tags) {
|
91 | return (target) => {
|
92 | decoratorSupport_1.declareTags(target, tags);
|
93 | };
|
94 | }
|
95 | exports.Tags = Tags;
|
96 | class MappedParameters {
|
97 | }
|
98 | MappedParameters.GitHubOwner = "atomist://github/repository/owner";
|
99 | MappedParameters.GitHubOwnerWithUser = "atomist://github/repository/owner?user=true";
|
100 | MappedParameters.GitHubRepository = "atomist://github/repository";
|
101 | MappedParameters.GitHubAllRepositories = "atomist://github/repository?all=true";
|
102 | MappedParameters.GitHubRepositoryProvider = "atomist://github/repository/provider";
|
103 | MappedParameters.GitHubWebHookUrl = "atomist://github_webhook_url";
|
104 | MappedParameters.GitHubUrl = "atomist://github_url";
|
105 | MappedParameters.GitHubApiUrl = "atomist://github_api_url";
|
106 | MappedParameters.GitHubDefaultRepositoryVisibility = "atomist://github/default_repo_visibility";
|
107 | MappedParameters.GitHubUserLogin = "atomist://github/username";
|
108 | MappedParameters.SlackChannel = "atomist://slack/channel";
|
109 | MappedParameters.SlackChannelName = "atomist://slack/channel_name";
|
110 | MappedParameters.SlackTeam = "atomist://slack/team";
|
111 | MappedParameters.SlackUser = "atomist://slack/user";
|
112 | MappedParameters.SlackUserName = "atomist://slack/user_name";
|
113 | MappedParameters.AtomistWebhookUrlBase = "atomist://base_webhook_url";
|
114 | exports.MappedParameters = MappedParameters;
|
115 | class Secrets {
|
116 | static userToken(scopes) {
|
117 | scopes = string_1.toStringArray(scopes);
|
118 | if (scopes && scopes.length > 0) {
|
119 | return `${this.UserToken}?scopes=${scopes.join(",")}`;
|
120 | }
|
121 | else {
|
122 | return this.UserToken;
|
123 | }
|
124 | }
|
125 | }
|
126 | Secrets.OrgToken = "github://org_token";
|
127 | Secrets.UserToken = "github://user_token";
|
128 | exports.Secrets = Secrets;
|
129 |
|
\ | No newline at end of file |