@prismatic-io/prism 3.3.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/run +9 -8
- package/lib/auth.js +183 -201
- package/lib/commands/alerts/events/list.js +27 -57
- package/lib/commands/alerts/groups/create.js +18 -49
- package/lib/commands/alerts/groups/delete.js +10 -41
- package/lib/commands/alerts/groups/list.js +15 -47
- package/lib/commands/alerts/monitors/clear.js +10 -41
- package/lib/commands/alerts/monitors/create.js +27 -58
- package/lib/commands/alerts/monitors/delete.js +10 -41
- package/lib/commands/alerts/monitors/list.js +16 -48
- package/lib/commands/alerts/triggers/list.js +15 -47
- package/lib/commands/alerts/webhooks/create.js +18 -49
- package/lib/commands/alerts/webhooks/delete.js +10 -41
- package/lib/commands/alerts/webhooks/list.js +25 -57
- package/lib/commands/authorization-methods/list.js +20 -51
- package/lib/commands/components/actions/list.js +29 -61
- package/lib/commands/components/delete.js +10 -41
- package/lib/commands/components/dev/run.js +89 -0
- package/lib/commands/components/dev/test.js +218 -0
- package/lib/commands/components/init/action.js +12 -0
- package/lib/commands/components/init/component.js +12 -0
- package/lib/commands/components/init/connection.js +12 -0
- package/lib/commands/components/init/index.js +142 -0
- package/lib/commands/components/init/trigger.js +12 -0
- package/lib/commands/components/list.js +31 -60
- package/lib/commands/components/publish.js +29 -279
- package/lib/commands/components/triggers/list.js +29 -61
- package/lib/commands/customers/create.js +14 -45
- package/lib/commands/customers/credentials/create.js +19 -50
- package/lib/commands/customers/credentials/delete.js +10 -41
- package/lib/commands/customers/credentials/list.js +30 -59
- package/lib/commands/customers/credentials/update.js +16 -47
- package/lib/commands/customers/delete.js +10 -41
- package/lib/commands/customers/list.js +16 -48
- package/lib/commands/customers/update.js +15 -46
- package/lib/commands/customers/users/create.js +18 -49
- package/lib/commands/customers/users/delete.js +10 -41
- package/lib/commands/customers/users/list.js +21 -51
- package/lib/commands/customers/users/roles.js +18 -48
- package/lib/commands/customers/users/update.js +19 -50
- package/lib/commands/executions/step-result/get.js +36 -66
- package/lib/commands/instances/config-vars/list.js +32 -62
- package/lib/commands/instances/create.js +20 -51
- package/lib/commands/instances/delete.js +10 -41
- package/lib/commands/instances/deploy.js +20 -44
- package/lib/commands/instances/disable.js +11 -42
- package/lib/commands/instances/enable.js +11 -42
- package/lib/commands/instances/flow-configs/list.js +25 -55
- package/lib/commands/instances/flow-configs/test.js +62 -97
- package/lib/commands/instances/list.js +31 -59
- package/lib/commands/instances/update.js +15 -46
- package/lib/commands/integrations/available.js +13 -44
- package/lib/commands/integrations/create.js +14 -45
- package/lib/commands/integrations/delete.js +10 -41
- package/lib/commands/integrations/export.js +11 -68
- package/lib/commands/integrations/flows/list.js +22 -52
- package/lib/commands/integrations/flows/test.js +62 -96
- package/lib/commands/integrations/fork.js +15 -46
- package/lib/commands/integrations/import.js +12 -63
- package/lib/commands/integrations/list.js +25 -54
- package/lib/commands/integrations/publish.js +13 -44
- package/lib/commands/integrations/update.js +18 -49
- package/lib/commands/integrations/versions/index.js +26 -58
- package/lib/commands/login.js +16 -32
- package/lib/commands/logout.js +10 -22
- package/lib/commands/logs/severities/list.js +15 -47
- package/lib/commands/me/index.js +15 -60
- package/lib/commands/me/token/revoke.js +12 -0
- package/lib/commands/me/token.js +10 -22
- package/lib/commands/organization/credentials/create.js +17 -48
- package/lib/commands/organization/credentials/delete.js +10 -41
- package/lib/commands/organization/credentials/list.js +22 -54
- package/lib/commands/organization/credentials/update.js +16 -47
- package/lib/commands/organization/update.js +12 -43
- package/lib/commands/organization/updateAvatarUrl.js +14 -45
- package/lib/commands/organization/users/create.js +16 -47
- package/lib/commands/organization/users/delete.js +10 -41
- package/lib/commands/organization/users/list.js +16 -48
- package/lib/commands/organization/users/roles.js +18 -48
- package/lib/commands/organization/users/update.js +19 -50
- package/lib/config.js +24 -30
- package/lib/errors.js +48 -27
- package/lib/fields.js +6 -4
- package/lib/fs.js +6 -14
- package/lib/generate/action.js +43 -100
- package/lib/generate/index.js +27 -23
- package/lib/generate/input.js +28 -43
- package/lib/generate/parse.js +18 -76
- package/lib/generate/sourceFile.js +15 -44
- package/lib/generate/util.js +4 -106
- package/lib/graphql.js +37 -65
- package/lib/index.js +3 -3
- package/lib/utils/component/publish.js +219 -0
- package/lib/utils/component/query.js +23 -0
- package/lib/utils/date.js +14 -0
- package/lib/utils/execution/logs.js +86 -0
- package/lib/utils/integration/definition.js +101 -0
- package/lib/utils/integration/export.js +36 -0
- package/lib/utils/integration/import.js +46 -0
- package/lib/utils/integration/invoke.js +64 -0
- package/lib/utils/integration/query.js +59 -0
- package/lib/utils/serialize.js +8 -0
- package/lib/utils/user/query.js +24 -0
- package/lib/yeoman.js +24 -0
- package/oclif.manifest.json +1 -1
- package/package.json +50 -58
- package/lib/auth.js.map +0 -1
- package/lib/commands/alerts/events/list.js.map +0 -1
- package/lib/commands/alerts/groups/create.js.map +0 -1
- package/lib/commands/alerts/groups/delete.js.map +0 -1
- package/lib/commands/alerts/groups/list.js.map +0 -1
- package/lib/commands/alerts/monitors/clear.js.map +0 -1
- package/lib/commands/alerts/monitors/create.js.map +0 -1
- package/lib/commands/alerts/monitors/delete.js.map +0 -1
- package/lib/commands/alerts/monitors/list.js.map +0 -1
- package/lib/commands/alerts/triggers/list.js.map +0 -1
- package/lib/commands/alerts/webhooks/create.js.map +0 -1
- package/lib/commands/alerts/webhooks/delete.js.map +0 -1
- package/lib/commands/alerts/webhooks/list.js.map +0 -1
- package/lib/commands/authorization-methods/list.js.map +0 -1
- package/lib/commands/components/actions/list.js.map +0 -1
- package/lib/commands/components/delete.js.map +0 -1
- package/lib/commands/components/init.js +0 -224
- package/lib/commands/components/init.js.map +0 -1
- package/lib/commands/components/list.js.map +0 -1
- package/lib/commands/components/publish.js.map +0 -1
- package/lib/commands/components/triggers/list.js.map +0 -1
- package/lib/commands/customers/create.js.map +0 -1
- package/lib/commands/customers/credentials/create.js.map +0 -1
- package/lib/commands/customers/credentials/delete.js.map +0 -1
- package/lib/commands/customers/credentials/list.js.map +0 -1
- package/lib/commands/customers/credentials/update.js.map +0 -1
- package/lib/commands/customers/delete.js.map +0 -1
- package/lib/commands/customers/list.js.map +0 -1
- package/lib/commands/customers/update.js.map +0 -1
- package/lib/commands/customers/users/create.js.map +0 -1
- package/lib/commands/customers/users/delete.js.map +0 -1
- package/lib/commands/customers/users/list.js.map +0 -1
- package/lib/commands/customers/users/roles.js.map +0 -1
- package/lib/commands/customers/users/update.js.map +0 -1
- package/lib/commands/executions/step-result/get.js.map +0 -1
- package/lib/commands/instances/config-vars/list.js.map +0 -1
- package/lib/commands/instances/create.js.map +0 -1
- package/lib/commands/instances/delete.js.map +0 -1
- package/lib/commands/instances/deploy.js.map +0 -1
- package/lib/commands/instances/disable.js.map +0 -1
- package/lib/commands/instances/enable.js.map +0 -1
- package/lib/commands/instances/flow-configs/list.js.map +0 -1
- package/lib/commands/instances/flow-configs/test.js.map +0 -1
- package/lib/commands/instances/list.js.map +0 -1
- package/lib/commands/instances/update.js.map +0 -1
- package/lib/commands/integrations/available.js.map +0 -1
- package/lib/commands/integrations/create.js.map +0 -1
- package/lib/commands/integrations/delete.js.map +0 -1
- package/lib/commands/integrations/export.js.map +0 -1
- package/lib/commands/integrations/flows/list.js.map +0 -1
- package/lib/commands/integrations/flows/test.js.map +0 -1
- package/lib/commands/integrations/fork.js.map +0 -1
- package/lib/commands/integrations/import.js.map +0 -1
- package/lib/commands/integrations/list.js.map +0 -1
- package/lib/commands/integrations/publish.js.map +0 -1
- package/lib/commands/integrations/update.js.map +0 -1
- package/lib/commands/integrations/versions/index.js.map +0 -1
- package/lib/commands/login.js.map +0 -1
- package/lib/commands/logout.js.map +0 -1
- package/lib/commands/logs/severities/list.js.map +0 -1
- package/lib/commands/me/index.js.map +0 -1
- package/lib/commands/me/token.js.map +0 -1
- package/lib/commands/organization/credentials/create.js.map +0 -1
- package/lib/commands/organization/credentials/delete.js.map +0 -1
- package/lib/commands/organization/credentials/list.js.map +0 -1
- package/lib/commands/organization/credentials/update.js.map +0 -1
- package/lib/commands/organization/update.js.map +0 -1
- package/lib/commands/organization/updateAvatarUrl.js.map +0 -1
- package/lib/commands/organization/users/create.js.map +0 -1
- package/lib/commands/organization/users/delete.js.map +0 -1
- package/lib/commands/organization/users/list.js.map +0 -1
- package/lib/commands/organization/users/roles.js.map +0 -1
- package/lib/commands/organization/users/update.js.map +0 -1
- package/lib/config.js.map +0 -1
- package/lib/errors.js.map +0 -1
- package/lib/fields.js.map +0 -1
- package/lib/fs.js.map +0 -1
- package/lib/generate/action.js.map +0 -1
- package/lib/generate/client.js +0 -98
- package/lib/generate/client.js.map +0 -1
- package/lib/generate/connection.js +0 -86
- package/lib/generate/connection.js.map +0 -1
- package/lib/generate/index.js.map +0 -1
- package/lib/generate/input.js.map +0 -1
- package/lib/generate/parse.js.map +0 -1
- package/lib/generate/sourceFile.js.map +0 -1
- package/lib/generate/util.js.map +0 -1
- package/lib/graphql.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/templates/component/assets/icon.png +0 -0
- package/templates/component/jest.config.js +0 -4
- package/templates/component/openapi/client.ts +0 -73
- package/templates/component/openapi/request.ts +0 -161
- package/templates/component/package.json +0 -24
- package/templates/component/src/actions.ts +0 -33
- package/templates/component/src/client.ts +0 -7
- package/templates/component/src/connections.ts +0 -25
- package/templates/component/src/index.test.ts +0 -32
- package/templates/component/src/index.ts +0 -17
- package/templates/component/src/triggers.ts +0 -18
- package/templates/component/tsconfig.json +0 -19
- package/templates/component/webpack.config.js +0 -44
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/* istanbul ignore file */
|
|
2
|
-
/* tslint:disable */
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import FormData from "form-data";
|
|
6
|
-
import { AxiosResponse } from "axios";
|
|
7
|
-
import { util } from "@prismatic-io/spectral";
|
|
8
|
-
import { types } from "util";
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
import type { ApiRequestOptions } from "./ApiRequestOptions";
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
import { EnhancedOpenAPI } from "./OpenAPI";
|
|
13
|
-
|
|
14
|
-
function isDefined<T>(
|
|
15
|
-
value: T | null | undefined
|
|
16
|
-
): value is Exclude<T, null | undefined> {
|
|
17
|
-
return value !== undefined && value !== null;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function isString(value: any): value is string {
|
|
21
|
-
return typeof value === "string";
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function isStringWithValue(value: any): value is string {
|
|
25
|
-
return isString(value) && value !== "";
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function isBinary(value: any): value is Buffer | ArrayBuffer | ArrayBufferView {
|
|
29
|
-
const isBuffer = Buffer.isBuffer(value);
|
|
30
|
-
const isArrayBuffer = types.isArrayBuffer(value);
|
|
31
|
-
const isArrayBufferView = types.isArrayBufferView(value);
|
|
32
|
-
return isBuffer || isArrayBuffer || isArrayBufferView;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function getUrl(options: ApiRequestOptions): string {
|
|
36
|
-
const path = options.path.replace(/[:]/g, "_");
|
|
37
|
-
const url = `${EnhancedOpenAPI.BASE}${path}`;
|
|
38
|
-
|
|
39
|
-
return url;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function getFormData(params: Record<string, any>): FormData {
|
|
43
|
-
const formData = new FormData();
|
|
44
|
-
Object.entries(params).forEach(([key, value]) => {
|
|
45
|
-
if (isDefined(value)) {
|
|
46
|
-
formData.append(key, value);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
return formData;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
53
|
-
|
|
54
|
-
async function resolve<T>(
|
|
55
|
-
options: ApiRequestOptions,
|
|
56
|
-
resolver?: T | Resolver<T>
|
|
57
|
-
): Promise<T | undefined> {
|
|
58
|
-
if (typeof resolver === "function") {
|
|
59
|
-
return (resolver as Resolver<T>)(options);
|
|
60
|
-
}
|
|
61
|
-
return resolver;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
async function getHeaders(options: ApiRequestOptions): Promise<any> {
|
|
65
|
-
const [token, username, password, defaultHeaders] = await Promise.all([
|
|
66
|
-
resolve(options, EnhancedOpenAPI.TOKEN),
|
|
67
|
-
resolve(options, EnhancedOpenAPI.USERNAME),
|
|
68
|
-
resolve(options, EnhancedOpenAPI.PASSWORD),
|
|
69
|
-
resolve(options, EnhancedOpenAPI.HEADERS),
|
|
70
|
-
]);
|
|
71
|
-
|
|
72
|
-
const headers = {
|
|
73
|
-
Accept: "application/json",
|
|
74
|
-
...defaultHeaders,
|
|
75
|
-
...options.headers,
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
if (EnhancedOpenAPI.timeout) {
|
|
79
|
-
headers["timeout"] = util.types.toInt(EnhancedOpenAPI.timeout);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (isStringWithValue(token)) {
|
|
83
|
-
headers["Authorization"] = `Bearer ${token}`;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (isStringWithValue(username) && isStringWithValue(password)) {
|
|
87
|
-
const credentials = Buffer.from(`${username}:${password}`).toString(
|
|
88
|
-
"base64"
|
|
89
|
-
);
|
|
90
|
-
headers["Authorization"] = `Basic ${credentials}`;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (options.body) {
|
|
94
|
-
if (isBinary(options.body)) {
|
|
95
|
-
headers["Content-Type"] = "application/octet-stream";
|
|
96
|
-
} else if (isString(options.body)) {
|
|
97
|
-
headers["Content-Type"], "text/plain";
|
|
98
|
-
} else {
|
|
99
|
-
headers["Content-Type"] = "application/json";
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
return headers;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function getRequestBody(options: ApiRequestOptions) {
|
|
107
|
-
if (options.formData) {
|
|
108
|
-
return getFormData(options.formData);
|
|
109
|
-
}
|
|
110
|
-
if (options.body) {
|
|
111
|
-
if (isString(options.body) || isBinary(options.body)) {
|
|
112
|
-
return options.body;
|
|
113
|
-
} else {
|
|
114
|
-
return JSON.stringify(options.body);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return undefined;
|
|
118
|
-
}
|
|
119
|
-
interface RequestProps {
|
|
120
|
-
options: ApiRequestOptions;
|
|
121
|
-
url: string;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
async function sendRequest({
|
|
125
|
-
options,
|
|
126
|
-
url,
|
|
127
|
-
}: RequestProps): Promise<Partial<AxiosResponse>> {
|
|
128
|
-
const result = await EnhancedOpenAPI.CLIENT.request({
|
|
129
|
-
url,
|
|
130
|
-
method: options.method,
|
|
131
|
-
headers: await getHeaders(options),
|
|
132
|
-
data: getRequestBody(options),
|
|
133
|
-
params: options.query ? { ...options.query } : undefined,
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
return result;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Request using Axios client
|
|
141
|
-
* @param options The request options from the the service
|
|
142
|
-
* @returns Partial<AxiosResponse> & {
|
|
143
|
-
body: AxiosResponse["data"];
|
|
144
|
-
}
|
|
145
|
-
*/
|
|
146
|
-
export async function request(
|
|
147
|
-
options: ApiRequestOptions
|
|
148
|
-
): Promise<
|
|
149
|
-
Partial<AxiosResponse> & {
|
|
150
|
-
body: AxiosResponse["data"];
|
|
151
|
-
}
|
|
152
|
-
> {
|
|
153
|
-
const url = getUrl(options);
|
|
154
|
-
|
|
155
|
-
const response = await sendRequest({
|
|
156
|
-
options,
|
|
157
|
-
url,
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
return { ...response, body: await response.data };
|
|
161
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "<<COMPONENT_NAME>>",
|
|
3
|
-
"version": "0.0.1",
|
|
4
|
-
"main": "index.js",
|
|
5
|
-
"private": true,
|
|
6
|
-
"scripts": {
|
|
7
|
-
"build": "webpack",
|
|
8
|
-
"publish": "npm run build && prism components:publish",
|
|
9
|
-
"test": "jest"
|
|
10
|
-
},
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"extraDeps": ""
|
|
13
|
-
},
|
|
14
|
-
"devDependencies": {
|
|
15
|
-
"@types/jest": "26.0.24",
|
|
16
|
-
"copy-webpack-plugin": "9.0.1",
|
|
17
|
-
"jest": "27.0.6",
|
|
18
|
-
"ts-jest": "27.0.3",
|
|
19
|
-
"ts-loader": "9.2.3",
|
|
20
|
-
"typescript": "4.3.5",
|
|
21
|
-
"webpack": "5.43.0",
|
|
22
|
-
"webpack-cli": "4.7.2"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { action, input } from "@prismatic-io/spectral";
|
|
2
|
-
import { createClient } from "./client";
|
|
3
|
-
|
|
4
|
-
const myConnectionField = input({
|
|
5
|
-
label: "Connection",
|
|
6
|
-
type: "connection",
|
|
7
|
-
required: true,
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
const myInputField = input({
|
|
11
|
-
label: "My Input",
|
|
12
|
-
type: "string",
|
|
13
|
-
required: true,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
export const myAction = action({
|
|
17
|
-
display: {
|
|
18
|
-
label: "My Action",
|
|
19
|
-
description: "This is my action",
|
|
20
|
-
},
|
|
21
|
-
perform: async (context, { connection, myInput }) => {
|
|
22
|
-
const client = createClient(connection);
|
|
23
|
-
return {
|
|
24
|
-
data: `Hello, ${myInput}`,
|
|
25
|
-
};
|
|
26
|
-
},
|
|
27
|
-
inputs: {
|
|
28
|
-
connection: myConnectionField,
|
|
29
|
-
myInput: myInputField,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
export default { myAction };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { connection } from "@prismatic-io/spectral";
|
|
2
|
-
|
|
3
|
-
export const myConnection = connection({
|
|
4
|
-
key: "myConnection",
|
|
5
|
-
label: "My Connection",
|
|
6
|
-
comments: "My Connection",
|
|
7
|
-
inputs: {
|
|
8
|
-
username: {
|
|
9
|
-
label: "Username",
|
|
10
|
-
placeholder: "Username",
|
|
11
|
-
type: "string",
|
|
12
|
-
required: true,
|
|
13
|
-
comments: "Username for my Connection",
|
|
14
|
-
},
|
|
15
|
-
password: {
|
|
16
|
-
label: "Password",
|
|
17
|
-
placeholder: "Password",
|
|
18
|
-
type: "password",
|
|
19
|
-
required: true,
|
|
20
|
-
comments: "Password for my Connection",
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export default [myConnection];
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { myAction } from "./actions";
|
|
2
|
-
import { myTrigger } from "./triggers";
|
|
3
|
-
import { myConnection } from "./connections";
|
|
4
|
-
import {
|
|
5
|
-
invoke,
|
|
6
|
-
invokeTrigger,
|
|
7
|
-
defaultTriggerPayload,
|
|
8
|
-
createConnection,
|
|
9
|
-
} from "@prismatic-io/spectral/dist/testing";
|
|
10
|
-
|
|
11
|
-
describe("test my action", () => {
|
|
12
|
-
test("verify the return value of my action", async () => {
|
|
13
|
-
const { result } = await invoke(myAction, {
|
|
14
|
-
connection: createConnection(myConnection, {
|
|
15
|
-
username: process.env.MY_APP_USERNAME, // A username saved as an environment variable
|
|
16
|
-
password: process.env.MY_APP_PASSWORD, // A password saved as an environment variable
|
|
17
|
-
}),
|
|
18
|
-
myInput: "some input",
|
|
19
|
-
});
|
|
20
|
-
expect(result.data).toBe("Hello, some input");
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
describe("test my trigger", () => {
|
|
25
|
-
test("verify the return value of my trigger", async () => {
|
|
26
|
-
const expectedPayload = defaultTriggerPayload();
|
|
27
|
-
const {
|
|
28
|
-
result: { payload },
|
|
29
|
-
} = await invokeTrigger(myTrigger, {}, defaultTriggerPayload());
|
|
30
|
-
expect(payload).toStrictEqual(expectedPayload);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { component } from "@prismatic-io/spectral";
|
|
2
|
-
import actions from "./actions";
|
|
3
|
-
import triggers from "./triggers";
|
|
4
|
-
import connections from "./connections";
|
|
5
|
-
|
|
6
|
-
export default component({
|
|
7
|
-
key: "<<COMPONENT_NAME>>",
|
|
8
|
-
public: false,
|
|
9
|
-
display: {
|
|
10
|
-
label: "<<COMPONENT_NAME>>",
|
|
11
|
-
description: "Prism-generated Component",
|
|
12
|
-
iconPath: "icon.png",
|
|
13
|
-
},
|
|
14
|
-
actions,
|
|
15
|
-
triggers,
|
|
16
|
-
connections,
|
|
17
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { trigger } from "@prismatic-io/spectral";
|
|
2
|
-
|
|
3
|
-
export const myTrigger = trigger({
|
|
4
|
-
display: {
|
|
5
|
-
label: "My Trigger",
|
|
6
|
-
description: "This is my trigger",
|
|
7
|
-
},
|
|
8
|
-
perform: async (context, payload, params) => {
|
|
9
|
-
return {
|
|
10
|
-
payload,
|
|
11
|
-
};
|
|
12
|
-
},
|
|
13
|
-
inputs: {},
|
|
14
|
-
synchronousResponseSupport: "valid",
|
|
15
|
-
scheduleSupport: "valid",
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
export default { myTrigger };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es6",
|
|
4
|
-
"lib": ["esnext"],
|
|
5
|
-
"allowJs": true,
|
|
6
|
-
"skipLibCheck": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"allowSyntheticDefaultImports": true,
|
|
9
|
-
"strict": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true,
|
|
11
|
-
"module": "esnext",
|
|
12
|
-
"moduleResolution": "node",
|
|
13
|
-
"resolveJsonModule": true,
|
|
14
|
-
"isolatedModules": false,
|
|
15
|
-
"strictNullChecks": false,
|
|
16
|
-
"noImplicitAny": false
|
|
17
|
-
},
|
|
18
|
-
"include": ["src"]
|
|
19
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const path = require("path");
|
|
2
|
-
const webpack = require("webpack");
|
|
3
|
-
const CopyPlugin = require("copy-webpack-plugin");
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
mode: "development",
|
|
7
|
-
target: "node",
|
|
8
|
-
plugins: [
|
|
9
|
-
new CopyPlugin({
|
|
10
|
-
patterns: [
|
|
11
|
-
{ from: "assets", to: path.resolve(__dirname, "dist") },
|
|
12
|
-
{
|
|
13
|
-
from: "*.wsdl",
|
|
14
|
-
to: path.resolve(__dirname, "dist"),
|
|
15
|
-
noErrorOnMissing: true,
|
|
16
|
-
},
|
|
17
|
-
],
|
|
18
|
-
}),
|
|
19
|
-
],
|
|
20
|
-
module: {
|
|
21
|
-
rules: [
|
|
22
|
-
{
|
|
23
|
-
sideEffects: false,
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
test: /\.ts/,
|
|
27
|
-
use: "ts-loader",
|
|
28
|
-
exclude: /node_modules/,
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
resolve: {
|
|
33
|
-
extensions: [".ts", ".js"],
|
|
34
|
-
},
|
|
35
|
-
optimization: {
|
|
36
|
-
usedExports: true,
|
|
37
|
-
},
|
|
38
|
-
entry: "./src/index.ts",
|
|
39
|
-
output: {
|
|
40
|
-
filename: "index.js",
|
|
41
|
-
path: path.resolve(__dirname, "dist"),
|
|
42
|
-
libraryTarget: "commonjs2",
|
|
43
|
-
},
|
|
44
|
-
};
|