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) => {
|
57 | decoratorSupport_1.declareCommandHandler(obj, description, false, intent);
|
58 | };
|
59 | }
|
60 | exports.CommandHandler = CommandHandler;
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 | function ConfigurableCommandHandler(description, options) {
|
69 | const intent = options.intent ? string_1.toStringArray(options.intent) : [];
|
70 | const autoSubmit = options.autoSubmit ? options.autoSubmit : false;
|
71 | return (obj) => {
|
72 | decoratorSupport_1.declareCommandHandler(obj, description, autoSubmit, intent);
|
73 | };
|
74 | }
|
75 | exports.ConfigurableCommandHandler = ConfigurableCommandHandler;
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 | function Parameters() {
|
82 | return (obj) => {
|
83 | decoratorSupport_1.declareParameters(obj);
|
84 | };
|
85 | }
|
86 | exports.Parameters = Parameters;
|
87 | function EventHandler(description, subscription) {
|
88 | return (obj) => {
|
89 | decoratorSupport_1.declareEventHandler(obj, description, subscription);
|
90 | };
|
91 | }
|
92 | exports.EventHandler = EventHandler;
|
93 |
|
94 |
|
95 |
|
96 | function Tags(...tags) {
|
97 | return (target) => {
|
98 | decoratorSupport_1.declareTags(target, tags);
|
99 | };
|
100 | }
|
101 | exports.Tags = Tags;
|
102 | exports.MappedParameters = {
|
103 | GitHubOwner: "atomist://github/repository/owner",
|
104 | GitHubOwnerWithUser: "atomist://github/repository/owner?user=true",
|
105 | GitHubRepository: "atomist://github/repository",
|
106 | GitHubAllRepositories: "atomist://github/repository?all=true",
|
107 | GitHubRepositoryProvider: "atomist://github/repository/provider",
|
108 | GitHubWebHookUrl: "atomist://github_webhook_url",
|
109 | GitHubUrl: "atomist://github_url",
|
110 | GitHubApiUrl: "atomist://github_api_url",
|
111 | GitHubUserLogin: "atomist://github/username",
|
112 |
|
113 | GitHubDefaultRepositoryVisibility: "atomist://github/default_repo_visibility",
|
114 | SlackChannel: "atomist://slack/channel",
|
115 | SlackChannelName: "atomist://slack/channel_name",
|
116 | SlackTeam: "atomist://slack/team",
|
117 | SlackUser: "atomist://slack/user",
|
118 | SlackUserName: "atomist://slack/user_name",
|
119 | AtomistWebhookUrlBase: "atomist://base_webhook_url",
|
120 | };
|
121 | exports.Secrets = {
|
122 | OrgToken: "github://org_token",
|
123 | UserToken: "github://user_token",
|
124 | userToken: (scopeOrScopes) => {
|
125 | const scopes = string_1.toStringArray(scopeOrScopes);
|
126 | if (scopes && scopes.length > 0) {
|
127 | return `${exports.Secrets.UserToken}?scopes=${scopes.join(",")}`;
|
128 | }
|
129 | else {
|
130 | return exports.Secrets.UserToken;
|
131 | }
|
132 | },
|
133 | };
|
134 |
|
\ | No newline at end of file |