@useparagon/cli 1.0.9 → 1.0.10-canary.1
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/dist/apis/auth.api.d.ts +1 -1
- package/dist/apis/auth.api.js.map +1 -1
- package/dist/apis/base.api.js +28 -1
- package/dist/apis/base.api.js.map +1 -1
- package/dist/apis/index.d.ts +1 -1
- package/dist/apis/index.js +1 -1
- package/dist/apis/index.js.map +1 -1
- package/dist/apis/integration.api.d.ts +1 -1
- package/dist/apis/integration.api.js +5 -2
- package/dist/apis/integration.api.js.map +1 -1
- package/dist/apis/project.api.d.ts +1 -1
- package/dist/apis/project.api.js.map +1 -1
- package/dist/apis/types/customTrigger.types.d.ts +56 -0
- package/dist/apis/types/customTrigger.types.js +3 -0
- package/dist/apis/types/customTrigger.types.js.map +1 -0
- package/dist/apis/types/error.types.d.ts +12 -0
- package/dist/apis/types/error.types.js +3 -0
- package/dist/apis/types/error.types.js.map +1 -0
- package/dist/apis/types/index.d.ts +5 -0
- package/dist/apis/types/index.js +9 -0
- package/dist/apis/types/index.js.map +1 -0
- package/dist/apis/{api.types.d.ts → types/integration.types.d.ts} +32 -74
- package/dist/apis/types/integration.types.js +3 -0
- package/dist/apis/types/integration.types.js.map +1 -0
- package/dist/apis/types/project.types.d.ts +55 -0
- package/dist/apis/{api.types.js → types/project.types.js} +1 -1
- package/dist/apis/types/project.types.js.map +1 -0
- package/dist/apis/types/user.types.d.ts +6 -0
- package/dist/apis/types/user.types.js +3 -0
- package/dist/apis/types/user.types.js.map +1 -0
- package/dist/apis/types/workflow.types.d.ts +8 -0
- package/dist/apis/types/workflow.types.js +3 -0
- package/dist/apis/types/workflow.types.js.map +1 -0
- package/dist/codegen/codegen.types.d.ts +3 -1
- package/dist/codegen/codegen.utils.d.ts +1 -1
- package/dist/codegen/codegen.utils.js +31 -5
- package/dist/codegen/codegen.utils.js.map +1 -1
- package/dist/codegen/codegens/integration.codegen.d.ts +3 -2
- package/dist/codegen/codegens/integration.codegen.js +43 -11
- package/dist/codegen/codegens/integration.codegen.js.map +1 -1
- package/dist/codegen/codegens/intent.codegen.d.ts +1 -1
- package/dist/codegen/codegens/intent.codegen.js +3 -0
- package/dist/codegen/codegens/intent.codegen.js.map +1 -1
- package/dist/codegen/codegens/source.codegen.d.ts +1 -1
- package/dist/codegen/codegens/source.codegen.js +30 -7
- package/dist/codegen/codegens/source.codegen.js.map +1 -1
- package/dist/codegen/codegens/trigger.codegen.d.ts +3 -0
- package/dist/codegen/codegens/trigger.codegen.js +302 -0
- package/dist/codegen/codegens/trigger.codegen.js.map +1 -0
- package/dist/codegen/codegens/workflow.codegen.d.ts +1 -1
- package/dist/codegen/codegens/workflow.codegen.js +40 -22
- package/dist/codegen/codegens/workflow.codegen.js.map +1 -1
- package/dist/commands/auth/login/login.types.d.ts +1 -1
- package/dist/commands/build/build.types.d.ts +1 -1
- package/dist/commands/init/init.action.js.map +1 -1
- package/dist/commands/new/new.command.js +3 -1
- package/dist/commands/new/new.command.js.map +1 -1
- package/dist/commands/new/trigger/index.d.ts +1 -0
- package/dist/commands/new/trigger/index.js +5 -0
- package/dist/commands/new/trigger/index.js.map +1 -0
- package/dist/commands/new/trigger/trigger.action.d.ts +5 -0
- package/dist/commands/new/trigger/trigger.action.js +116 -0
- package/dist/commands/new/trigger/trigger.action.js.map +1 -0
- package/dist/commands/new/trigger/trigger.command.d.ts +8 -0
- package/dist/commands/new/trigger/trigger.command.js +25 -0
- package/dist/commands/new/trigger/trigger.command.js.map +1 -0
- package/dist/commands/new/trigger/trigger.types.d.ts +3 -0
- package/dist/commands/new/trigger/trigger.types.js +3 -0
- package/dist/commands/new/trigger/trigger.types.js.map +1 -0
- package/dist/commands/new/workflow/workflow.action.js +2 -1
- package/dist/commands/new/workflow/workflow.action.js.map +1 -1
- package/dist/commands/pull/pull.action.js +10 -1
- package/dist/commands/pull/pull.action.js.map +1 -1
- package/dist/compiler/compiler.types.d.ts +1 -1
- package/dist/compiler/compiler.types.js +1 -1
- package/dist/compiler/compiler.types.js.map +1 -1
- package/dist/compiler/compilers/changeLog.compiler.d.ts +1 -1
- package/dist/compiler/compilers/changeLog.compiler.js +5 -4
- package/dist/compiler/compilers/changeLog.compiler.js.map +1 -1
- package/dist/compiler/compilers/integrations.compiler.d.ts +2 -1
- package/dist/compiler/compilers/integrations.compiler.js +57 -1
- package/dist/compiler/compilers/integrations.compiler.js.map +1 -1
- package/dist/compiler/compilers/triggers.compiler.d.ts +12 -0
- package/dist/compiler/compilers/triggers.compiler.js +175 -0
- package/dist/compiler/compilers/triggers.compiler.js.map +1 -0
- package/dist/compiler/compilers/workflows.compiler.d.ts +2 -1
- package/dist/compiler/compilers/workflows.compiler.js.map +1 -1
- package/dist/helpers/file.d.ts +1 -1
- package/dist/helpers/file.js +8 -8
- package/dist/helpers/file.js.map +1 -1
- package/package.json +2 -2
- package/dist/apis/api.types.js.map +0 -1
package/dist/apis/auth.api.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.api.js","sourceRoot":"","sources":["../../src/apis/auth.api.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"auth.api.js","sourceRoot":"","sources":["../../src/apis/auth.api.ts"],"names":[],"mappings":";;;AAAA,yCAA8C;AAQvC,MAAM,KAAK,GAAG,KAAK,EAAE,cAG3B,EAAkB,EAAE;IACnB,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;IACvD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAA,sBAAW,EAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;AACH,CAAC,CAAC;AATW,QAAA,KAAK,SAShB"}
|
package/dist/apis/base.api.js
CHANGED
|
@@ -6,6 +6,7 @@ const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
|
6
6
|
const logger_1 = tslib_1.__importDefault(require("../logger"));
|
|
7
7
|
const config_1 = require("../config");
|
|
8
8
|
const http_1 = require("../helpers/http");
|
|
9
|
+
const CLI_VERSION = require('../../package.json').version;
|
|
9
10
|
let _token;
|
|
10
11
|
let _baseUrl;
|
|
11
12
|
let _currentProfile;
|
|
@@ -52,8 +53,31 @@ const getToken = async () => {
|
|
|
52
53
|
}
|
|
53
54
|
};
|
|
54
55
|
exports.getToken = getToken;
|
|
56
|
+
const flattenValidationError = (error) => {
|
|
57
|
+
if (Array.isArray(error)) {
|
|
58
|
+
return error
|
|
59
|
+
.flatMap((error) => {
|
|
60
|
+
return [error, flattenValidationError(error.children || [])].flatMap((error) => typeof error === 'string' ? error : flattenValidationError(error));
|
|
61
|
+
})
|
|
62
|
+
.filter((errorString) => errorString)
|
|
63
|
+
.join(', ');
|
|
64
|
+
}
|
|
65
|
+
return Object.values(error.constraints || {}).join(', ');
|
|
66
|
+
};
|
|
55
67
|
const logApiError = (apiDescription, error) => {
|
|
56
|
-
|
|
68
|
+
let errorMessage = error.message;
|
|
69
|
+
const errorData = error['response']?.['data'];
|
|
70
|
+
if (typeof error.message === 'string') {
|
|
71
|
+
errorMessage = error.message;
|
|
72
|
+
}
|
|
73
|
+
else if (errorData &&
|
|
74
|
+
errorData.statusCode === 400 &&
|
|
75
|
+
Array.isArray(errorData.message)) {
|
|
76
|
+
errorMessage = flattenValidationError(error.message);
|
|
77
|
+
}
|
|
78
|
+
else if (error) {
|
|
79
|
+
errorMessage = JSON.stringify(error);
|
|
80
|
+
}
|
|
57
81
|
logger_1.default.fatal(`${apiDescription}
|
|
58
82
|
- Details: ${errorMessage}`);
|
|
59
83
|
};
|
|
@@ -64,6 +88,7 @@ const get = async (path, options) => {
|
|
|
64
88
|
const response = await axios_1.default.get(`${apiBaseUrl}/${path}`, {
|
|
65
89
|
headers: {
|
|
66
90
|
Authorization: `Bearer ${token}`,
|
|
91
|
+
'X-VERSION': CLI_VERSION,
|
|
67
92
|
},
|
|
68
93
|
});
|
|
69
94
|
return response.data;
|
|
@@ -73,6 +98,7 @@ const post = async (path, data) => {
|
|
|
73
98
|
const response = await axios_1.default.post(`${await getBaseUrl()}/${path}`, data, {
|
|
74
99
|
headers: {
|
|
75
100
|
Authorization: `Bearer ${await (0, exports.getToken)()}`,
|
|
101
|
+
'X-VERSION': CLI_VERSION,
|
|
76
102
|
},
|
|
77
103
|
});
|
|
78
104
|
return response.data;
|
|
@@ -82,6 +108,7 @@ const put = async (path, data) => {
|
|
|
82
108
|
const response = await axios_1.default.put(`${await getBaseUrl()}/${path}`, data, {
|
|
83
109
|
headers: {
|
|
84
110
|
Authorization: `Bearer ${await (0, exports.getToken)()}`,
|
|
111
|
+
'X-VERSION': CLI_VERSION,
|
|
85
112
|
},
|
|
86
113
|
});
|
|
87
114
|
return response.data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.api.js","sourceRoot":"","sources":["../../src/apis/base.api.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,+DAA+B;AAE/B,sCAOmB;AACnB,0CAA8C;
|
|
1
|
+
{"version":3,"file":"base.api.js","sourceRoot":"","sources":["../../src/apis/base.api.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,+DAA+B;AAE/B,sCAOmB;AACnB,0CAA8C;AAG9C,MAAM,WAAW,GAAW,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;AAMlE,IAAI,MAA0B,CAAC;AAC/B,IAAI,QAA4B,CAAC;AACjC,IAAI,eAAqC,CAAC;AAMnC,MAAM,UAAU,GAAG,KAAK,IAAuB,EAAE;IACtD,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,MAAM,aAAa,GAAa,MAAM,IAAA,4BAAmB,EACvD,mBAAU,CAAC,QAAQ,EACnB,wBAAe,CAChB,CAAC;IAEF,eAAe,GAAG,aAAa,CAAC;IAChC,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAXW,QAAA,U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EAAE;YACP,aAAa,EAAE,UAAU,MAAM,IAAA,gBAAQ,GAAE,EAAE;YAC3C,WAAW,EAAE,WAAW;SACzB;KACF,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC,CAAC;AATW,QAAA,GAAG,OASd"}
|
package/dist/apis/index.d.ts
CHANGED
package/dist/apis/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./api.types"), exports);
|
|
5
4
|
tslib_1.__exportStar(require("./auth.api"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("./integration.api"), exports);
|
|
7
6
|
tslib_1.__exportStar(require("./project.api"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./types"), exports);
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/dist/apis/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,4DAAkC;AAClC,wDAA8B;AAC9B,kDAAwB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IntegrationDependencies, IntegrationMetadata } from './
|
|
1
|
+
import { IntegrationDependencies, IntegrationMetadata } from './types';
|
|
2
2
|
export declare const getIntegrationDependencies: (integrations: string[]) => Promise<Record<string, IntegrationDependencies>>;
|
|
3
3
|
export declare const getDefaultIntegrations: () => Promise<IntegrationMetadata[]>;
|
|
@@ -7,9 +7,12 @@ const getIntegrationDependencies = async (integrations) => {
|
|
|
7
7
|
const nativeIntegrations = integrations.filter((integration) => !(0, core_1.isCustomIntegration)(integration));
|
|
8
8
|
try {
|
|
9
9
|
const integrationTypes = await (0, base_api_1.post)('graphite/integrations', {
|
|
10
|
-
integrations: nativeIntegrations
|
|
10
|
+
integrations: nativeIntegrations,
|
|
11
11
|
});
|
|
12
|
-
return Object.fromEntries(nativeIntegrations.map((integration, index) =>
|
|
12
|
+
return Object.fromEntries(nativeIntegrations.map((integration, index) => [
|
|
13
|
+
integration,
|
|
14
|
+
integrationTypes[index],
|
|
15
|
+
]));
|
|
13
16
|
}
|
|
14
17
|
catch (error) {
|
|
15
18
|
return (0, base_api_1.logApiError)('Failed to get integration data.', error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.api.js","sourceRoot":"","sources":["../../src/apis/integration.api.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;
|
|
1
|
+
{"version":3,"file":"integration.api.js","sourceRoot":"","sources":["../../src/apis/integration.api.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;AAEvD,yCAAoD;AAO7C,MAAM,0BAA0B,GAAG,KAAK,EAC7C,YAAsB,EAC4B,EAAE;IACpD,MAAM,kBAAkB,GAAa,YAAY,CAAC,MAAM,CACtD,CAAC,WAAmB,EAAE,EAAE,CAAC,CAAC,IAAA,0BAAmB,EAAC,WAAW,CAAC,CAC3D,CAAC;IACF,IAAI,CAAC;QACH,MAAM,gBAAgB,GAA8B,MAAM,IAAA,eAAI,EAC5D,uBAAuB,EACvB;YACE,YAAY,EAAE,kBAAkB;SACjC,CACF,CAAC;QACF,OAAO,MAAM,CAAC,WAAW,CACvB,kBAAkB,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,CAAC;YAC7C,WAAW;YACX,gBAAgB,CAAC,KAAK,CAAC;SACxB,CAAC,CACH,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAA,sBAAW,EAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC,CAAC;AAtBW,QAAA,0BAA0B,8BAsBrC;AAMK,MAAM,sBAAsB,GAAG,KAAK,IAEzC,EAAE;IACF,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,uBAAuB,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAA,sBAAW,EAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;IACnE,CAAC;AACH,CAAC,CAAC;AARW,QAAA,sBAAsB,0BAQjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.api.js","sourceRoot":"","sources":["../../src/apis/project.api.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;
|
|
1
|
+
{"version":3,"file":"project.api.js","sourceRoot":"","sources":["../../src/apis/project.api.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;AAEvD,yCAAyD;AACzD,uDAA+D;AAYxD,MAAM,cAAc,GAAG,KAAK,IAEjC,EAAE;IACF,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,mBAAmB,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAA,sBAAW,EAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;AACH,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB;AAOK,MAAM,eAAe,GAAG,KAAK,EAClC,SAAiB,EACM,EAAE;IACzB,IAAI,CAAC;QACH,MAAM,YAAY,GAAiB,MAAM,IAAA,cAAG,EAC1C,qBAAqB,SAAS,EAAE,CACjC,CAAC;QACF,MAAM,YAAY,GAAa,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QAEtE,MAAM,uBAAuB,GAC3B,MAAM,IAAA,4CAA0B,EAAC,YAAY,CAAC,CAAC;QAEjD,OAAO;YACL,GAAG,YAAY;YACf,YAAY,EAAE,MAAM,CAAC,WAAW,CAC9B,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAA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AU,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAA,sBAAW,EAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;IACjE,CAAC;AACH,CAAC,CAAC;AAbW,QAAA,yBAAyB,6BAapC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DataType, KeyedSource, TokenizedSource } from '@useparagon/core/resolvers';
|
|
2
|
+
import { HttpMethod, RequestBodyType } from '@useparagon/core/steps/library/request';
|
|
3
|
+
import { CustomTriggerPayloadValidationScheme, SetupResponseType, TriggerSubscription, WebhookTriggerLevel } from '@useparagon/core/triggers/customTrigger';
|
|
4
|
+
export type CustomTriggerSetupResponse = {
|
|
5
|
+
type: SetupResponseType.DEFAULT | SetupResponseType.ECHO_REQUEST_BODY;
|
|
6
|
+
} | {
|
|
7
|
+
type: SetupResponseType.CUSTOM_CODE;
|
|
8
|
+
code: string;
|
|
9
|
+
parameters: KeyedSource<DataType.STRING>[];
|
|
10
|
+
};
|
|
11
|
+
export type CustomTriggerPayloadValidationOption = {
|
|
12
|
+
scheme: CustomTriggerPayloadValidationScheme.NONE;
|
|
13
|
+
} | {
|
|
14
|
+
scheme: CustomTriggerPayloadValidationScheme.CUSTOM;
|
|
15
|
+
parameters: KeyedSource<DataType.STRING>[];
|
|
16
|
+
code: string;
|
|
17
|
+
} | {
|
|
18
|
+
scheme: CustomTriggerPayloadValidationScheme.SHA_1_BASE64_PAYLOAD_BODY | CustomTriggerPayloadValidationScheme.SHA_1_HEX_PAYLOAD_BODY | CustomTriggerPayloadValidationScheme.SHA_256_BASE64_PAYLOAD_BODY | CustomTriggerPayloadValidationScheme.SHA_256_HEX_PAYLOAD_BODY;
|
|
19
|
+
webhookSecret: TokenizedSource<DataType.STRING>;
|
|
20
|
+
webhookSignatureHeader: TokenizedSource<DataType.STRING>;
|
|
21
|
+
};
|
|
22
|
+
export type CustomTriggerSetupOption = {
|
|
23
|
+
url: TokenizedSource<DataType.STRING>;
|
|
24
|
+
httpMethod: HttpMethod;
|
|
25
|
+
params: KeyedSource<DataType.STRING>[];
|
|
26
|
+
headers: KeyedSource<DataType.STRING>[];
|
|
27
|
+
body: KeyedSource[];
|
|
28
|
+
bodyType?: RequestBodyType;
|
|
29
|
+
rawBody?: TokenizedSource<DataType.STRING>;
|
|
30
|
+
response?: CustomTriggerSetupResponse;
|
|
31
|
+
};
|
|
32
|
+
export type CustomTriggerTearDownOption = {
|
|
33
|
+
url: TokenizedSource<DataType.STRING>;
|
|
34
|
+
httpMethod: HttpMethod;
|
|
35
|
+
params: KeyedSource<DataType.STRING>[];
|
|
36
|
+
headers: KeyedSource<DataType.STRING>[];
|
|
37
|
+
body: KeyedSource[];
|
|
38
|
+
bodyType?: RequestBodyType;
|
|
39
|
+
rawBody?: TokenizedSource<DataType.STRING>;
|
|
40
|
+
};
|
|
41
|
+
export type CustomTriggerOptions = {
|
|
42
|
+
triggerSubscription: TriggerSubscription;
|
|
43
|
+
triggerLevel: WebhookTriggerLevel;
|
|
44
|
+
setup: CustomTriggerSetupOption;
|
|
45
|
+
tearDown: CustomTriggerTearDownOption;
|
|
46
|
+
providerId?: TokenizedSource<DataType.STRING>;
|
|
47
|
+
payloadValidationOptions?: CustomTriggerPayloadValidationOption;
|
|
48
|
+
profileConfigKey?: TokenizedSource<DataType.STRING>;
|
|
49
|
+
};
|
|
50
|
+
export interface ICustomTrigger {
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
options: CustomTriggerOptions;
|
|
55
|
+
isConfigured: boolean;
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customTrigger.types.js","sourceRoot":"","sources":["../../../src/apis/types/customTrigger.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.types.js","sourceRoot":"","sources":["../../../src/apis/types/error.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./customTrigger.types"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./integration.types"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./project.types"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./user.types"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./workflow.types"), exports);
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/apis/types/index.ts"],"names":[],"mappings":";;;AAAA,gEAAsC;AACtC,8DAAoC;AACpC,0DAAgC;AAChC,uDAA6B;AAC7B,2DAAiC"}
|
|
@@ -1,11 +1,30 @@
|
|
|
1
|
-
import { AuthenticationScheme
|
|
2
|
-
import { IEvent } from '@useparagon/core/event';
|
|
1
|
+
import { AuthenticationScheme } from '@useparagon/core';
|
|
3
2
|
import { InputSource, SerializedInput, SidebarInputType } from '@useparagon/core/inputs';
|
|
4
|
-
import { ConnectPortalThemeValues } from '@useparagon/core/integration';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { ConnectPortalThemeValues, ConnectUserProfileConfigStrategy } from '@useparagon/core/integration';
|
|
4
|
+
import { DataType, KeyedSource, Operator, OrConditions, TokenizedSource } from '@useparagon/core/resolvers';
|
|
5
|
+
import { HttpMethod, RequestAuthorization, RequestBodyType } from '@useparagon/core/steps/library/request';
|
|
6
|
+
import { ICustomTrigger } from './customTrigger.types';
|
|
7
|
+
import { WorkflowBuild } from './workflow.types';
|
|
8
|
+
type EmptyStrategy = {
|
|
9
|
+
strategy?: undefined;
|
|
10
|
+
};
|
|
11
|
+
export type HTTPStrategyConfig = {
|
|
12
|
+
strategy: ConnectUserProfileConfigStrategy.HTTP;
|
|
13
|
+
userProfileRequestUrl: TokenizedSource<DataType.STRING>;
|
|
14
|
+
urlParameters: Array<KeyedSource<DataType.STRING>>;
|
|
15
|
+
headers: Array<KeyedSource<DataType.STRING>>;
|
|
16
|
+
rawBody: TokenizedSource<DataType.STRING>;
|
|
17
|
+
body: Array<KeyedSource<DataType.ANY>>;
|
|
18
|
+
requireSuccess: boolean;
|
|
19
|
+
requestMethod: HttpMethod;
|
|
20
|
+
requestBodyType: RequestBodyType;
|
|
21
|
+
};
|
|
22
|
+
export type JWTStrategyConfig = {
|
|
23
|
+
strategy: ConnectUserProfileConfigStrategy.JWT;
|
|
24
|
+
tokenPayload: TokenizedSource<DataType.STRING>;
|
|
25
|
+
requireSuccess: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type UserProfileConfig = EmptyStrategy | HTTPStrategyConfig | JWTStrategyConfig;
|
|
9
28
|
export type InputKeyVisibilityConfig = {
|
|
10
29
|
inputId: string;
|
|
11
30
|
path?: string[];
|
|
@@ -84,14 +103,12 @@ export interface ICustomIntegration {
|
|
|
84
103
|
testEndpointPath?: TokenizedSource<DataType.STRING>;
|
|
85
104
|
apiAuthorization?: RequestAuthorization;
|
|
86
105
|
isPublished?: boolean;
|
|
106
|
+
userProfileConfig?: UserProfileConfig;
|
|
87
107
|
}
|
|
88
|
-
export
|
|
89
|
-
id: string;
|
|
108
|
+
export type IntegrationMetadata = {
|
|
90
109
|
name: string;
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
dateCreated?: string;
|
|
94
|
-
}
|
|
110
|
+
title: string;
|
|
111
|
+
};
|
|
95
112
|
export interface IntegrationBuild {
|
|
96
113
|
id: string;
|
|
97
114
|
config: {
|
|
@@ -102,65 +119,6 @@ export interface IntegrationBuild {
|
|
|
102
119
|
active?: boolean;
|
|
103
120
|
dependencies?: IntegrationDependencies;
|
|
104
121
|
customIntegration?: ICustomIntegration;
|
|
122
|
+
customTriggers?: Record<string, ICustomTrigger>;
|
|
105
123
|
}
|
|
106
|
-
export
|
|
107
|
-
projectId: string;
|
|
108
|
-
projectName?: string;
|
|
109
|
-
events: Record<string, IEvent>;
|
|
110
|
-
persona: IPersona;
|
|
111
|
-
integrations: Record<string, IntegrationBuild | undefined>;
|
|
112
|
-
secrets: (ISecret | SecretDTO)[];
|
|
113
|
-
}
|
|
114
|
-
export type EntityDiffBase = {
|
|
115
|
-
added: string[];
|
|
116
|
-
deleted: string[];
|
|
117
|
-
updated: string[];
|
|
118
|
-
};
|
|
119
|
-
export declare enum ProjectEntity {
|
|
120
|
-
AppEvent = "events",
|
|
121
|
-
CustomIntegration = "customIntegrations",
|
|
122
|
-
Integration = "integrations",
|
|
123
|
-
IntegrationConfig = "configs",
|
|
124
|
-
Workflow = "workflows",
|
|
125
|
-
Step = "steps",
|
|
126
|
-
Secret = "secret"
|
|
127
|
-
}
|
|
128
|
-
export type ProjectComparison = {
|
|
129
|
-
comparisonDiff: Partial<Record<ProjectEntity, EntityDiffBase>>;
|
|
130
|
-
defaultEnabledWorkflows: WorkflowDefaultEnableChangeLog[];
|
|
131
|
-
requiredSettings: IntegrationInputChangeLog[];
|
|
132
|
-
integrationsRequiredOauthConfig: string[];
|
|
133
|
-
disabledIntegrations: string[];
|
|
134
|
-
integrationNameMap: Record<string, string>;
|
|
135
|
-
};
|
|
136
|
-
export type AffectedPersona = {
|
|
137
|
-
personaId: string;
|
|
138
|
-
endUserId: string;
|
|
139
|
-
integrationId: string;
|
|
140
|
-
connectCredentialId: string;
|
|
141
|
-
name: string | undefined;
|
|
142
|
-
email: string | undefined;
|
|
143
|
-
};
|
|
144
|
-
export type IntegrationInputChangeLog = {
|
|
145
|
-
inputTitle: string;
|
|
146
|
-
integrationId: string;
|
|
147
|
-
integrationType: string;
|
|
148
|
-
affectedUsers: AffectedPersona[];
|
|
149
|
-
workflowId?: string;
|
|
150
|
-
};
|
|
151
|
-
export type WorkflowDefaultEnableChangeLog = {
|
|
152
|
-
integrationId: string;
|
|
153
|
-
integrationType: string;
|
|
154
|
-
affectedUsers: AffectedPersona[];
|
|
155
|
-
workflowId: string;
|
|
156
|
-
};
|
|
157
|
-
export type IUser = {
|
|
158
|
-
firstName: string;
|
|
159
|
-
middleName: string;
|
|
160
|
-
lastName: string;
|
|
161
|
-
email: string;
|
|
162
|
-
};
|
|
163
|
-
export type IntegrationMetadata = {
|
|
164
|
-
name: string;
|
|
165
|
-
title: string;
|
|
166
|
-
};
|
|
124
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.types.js","sourceRoot":"","sources":["../../../src/apis/types/integration.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { IEvent } from '@useparagon/core/event';
|
|
2
|
+
import { IPersona } from '@useparagon/core/persona';
|
|
3
|
+
import { ISecret, SecretDTO } from '@useparagon/core/secret';
|
|
4
|
+
import { IntegrationBuild } from './integration.types';
|
|
5
|
+
export interface ProjectBuild {
|
|
6
|
+
projectId: string;
|
|
7
|
+
projectName?: string;
|
|
8
|
+
events: Record<string, IEvent>;
|
|
9
|
+
persona: IPersona;
|
|
10
|
+
integrations: Record<string, IntegrationBuild | undefined>;
|
|
11
|
+
secrets: (ISecret | SecretDTO)[];
|
|
12
|
+
}
|
|
13
|
+
export type EntityDiffBase = {
|
|
14
|
+
added: string[];
|
|
15
|
+
deleted: string[];
|
|
16
|
+
updated: string[];
|
|
17
|
+
};
|
|
18
|
+
export declare enum ProjectEntity {
|
|
19
|
+
AppEvent = "events",
|
|
20
|
+
CustomIntegration = "customIntegrations",
|
|
21
|
+
Integration = "integrations",
|
|
22
|
+
IntegrationConfig = "configs",
|
|
23
|
+
Workflow = "workflows",
|
|
24
|
+
Step = "steps",
|
|
25
|
+
Secret = "secret"
|
|
26
|
+
}
|
|
27
|
+
export type ProjectComparison = {
|
|
28
|
+
comparisonDiff: Partial<Record<ProjectEntity, EntityDiffBase>>;
|
|
29
|
+
defaultEnabledWorkflows: WorkflowDefaultEnableChangeLog[];
|
|
30
|
+
requiredSettings: IntegrationInputChangeLog[];
|
|
31
|
+
integrationsRequiredOauthConfig: string[];
|
|
32
|
+
disabledIntegrations: string[];
|
|
33
|
+
integrationNameMap: Record<string, string>;
|
|
34
|
+
};
|
|
35
|
+
export type AffectedPersona = {
|
|
36
|
+
personaId: string;
|
|
37
|
+
endUserId: string;
|
|
38
|
+
integrationId: string;
|
|
39
|
+
connectCredentialId: string;
|
|
40
|
+
name: string | undefined;
|
|
41
|
+
email: string | undefined;
|
|
42
|
+
};
|
|
43
|
+
export type IntegrationInputChangeLog = {
|
|
44
|
+
inputTitle: string;
|
|
45
|
+
integrationId: string;
|
|
46
|
+
integrationType: string;
|
|
47
|
+
affectedUsers: AffectedPersona[];
|
|
48
|
+
workflowId?: string;
|
|
49
|
+
};
|
|
50
|
+
export type WorkflowDefaultEnableChangeLog = {
|
|
51
|
+
integrationId: string;
|
|
52
|
+
integrationType: string;
|
|
53
|
+
affectedUsers: AffectedPersona[];
|
|
54
|
+
workflowId: string;
|
|
55
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.types.js","sourceRoot":"","sources":["../../../src/apis/types/project.types.ts"],"names":[],"mappings":";;;AAqDA,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,yDAAwC,CAAA;IACxC,6CAA4B,CAAA;IAC5B,8CAA6B,CAAA;IAC7B,uCAAsB,CAAA;IACtB,+BAAc,CAAA;IACd,kCAAiB,CAAA;AACnB,CAAC,EARW,aAAa,6BAAb,aAAa,QAQxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"user.types.js","sourceRoot":"","sources":["../../../src/apis/types/user.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.types.js","sourceRoot":"","sources":["../../../src/apis/types/workflow.types.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IStep } from '@useparagon/core';
|
|
2
2
|
import { InputSource, SerializedInput } from '@useparagon/core/inputs';
|
|
3
3
|
import { ISecret, SecretDTO } from '@useparagon/core/secret';
|
|
4
|
-
import { IntegrationDependencies, IntegrationWorkflowMeta } from '../apis/
|
|
4
|
+
import { IntegrationDependencies, IntegrationWorkflowMeta } from '../apis/types';
|
|
5
5
|
export type ProjectDependencies = {
|
|
6
6
|
eventIdToNameMap: Record<string, string>;
|
|
7
7
|
secrets: (ISecret | SecretDTO)[];
|
|
@@ -14,6 +14,7 @@ export type WorkflowDependencies = ProjectDependencies & {
|
|
|
14
14
|
workflowMeta: IntegrationWorkflowMeta;
|
|
15
15
|
sharedInputs: SerializedInput[];
|
|
16
16
|
inputSources: InputSource[];
|
|
17
|
+
customTriggerIdToNameMap: Record<string, string>;
|
|
17
18
|
};
|
|
18
19
|
export type StepDependencies = {
|
|
19
20
|
integration: WorkflowDependencies['integration'];
|
|
@@ -26,4 +27,5 @@ export type StepDependencies = {
|
|
|
26
27
|
secrets: (ISecret | SecretDTO)[];
|
|
27
28
|
currentStepId?: string;
|
|
28
29
|
upstreamStepIds: Set<string>;
|
|
30
|
+
customTriggerIdToNameMap: Record<string, string>;
|
|
29
31
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { KeyedSource } from '@useparagon/core/resolvers';
|
|
2
|
-
import { IntegrationBuild, IntegrationIntent, IntentInputKeyConfig, ProjectBuild } from '../apis/
|
|
2
|
+
import { IntegrationBuild, IntegrationIntent, IntentInputKeyConfig, ProjectBuild } from '../apis/types';
|
|
3
3
|
import { ProjectDependencies } from '../compiler/compiler.types';
|
|
4
4
|
export declare const generateIntegrationFiles: (integrationName: string, integrationOutput: IntegrationBuild, projectDependencies: ProjectDependencies, projectRoot: string) => Promise<void>;
|
|
5
5
|
export declare const generateProjectFiles: (projectBuild: ProjectBuild, projectRoot: string) => Promise<void>;
|
|
@@ -10,6 +10,7 @@ const file_1 = require("../helpers/file");
|
|
|
10
10
|
const event_codegen_1 = require("./codegens/event.codegen");
|
|
11
11
|
const integration_codegen_1 = require("./codegens/integration.codegen");
|
|
12
12
|
const persona_codegen_1 = require("./codegens/persona.codegen");
|
|
13
|
+
const trigger_codegen_1 = require("./codegens/trigger.codegen");
|
|
13
14
|
const workflow_codegen_1 = require("./codegens/workflow.codegen");
|
|
14
15
|
const generateIntegrationFiles = async (integrationName, integrationOutput, projectDependencies, projectRoot) => {
|
|
15
16
|
if (integrationName === 'undefined') {
|
|
@@ -21,13 +22,37 @@ const generateIntegrationFiles = async (integrationName, integrationOutput, proj
|
|
|
21
22
|
recursive: true,
|
|
22
23
|
});
|
|
23
24
|
const sharedInputs = integrationOutput.config.values.sharedMeta?.inputs ?? [];
|
|
24
|
-
const configCode = (0, integration_codegen_1.integrationToConfigCode)(integrationOutput, integrationName);
|
|
25
|
+
const configCode = (0, integration_codegen_1.integrationToConfigCode)(integrationOutput, integrationName, secrets);
|
|
25
26
|
const inputSources = integrationOutput.dependencies?.inputs ?? [];
|
|
26
|
-
const
|
|
27
|
+
const inputsSourceCode = (0, integration_codegen_1.integrationInputsToCode)(integrationName, sharedInputs, inputSources);
|
|
27
28
|
await Promise.all([
|
|
28
29
|
(0, file_1.writeSourceToFile)(integrationPath, 'config', configCode),
|
|
29
|
-
(0, file_1.writeSourceToFile)(integrationPath, 'inputs',
|
|
30
|
+
(0, file_1.writeSourceToFile)(integrationPath, 'inputs', inputsSourceCode),
|
|
30
31
|
]);
|
|
32
|
+
const customTriggers = Object.values(integrationOutput.customTriggers || {});
|
|
33
|
+
const triggerPath = path_1.default.join(integrationPath, 'triggers');
|
|
34
|
+
if (customTriggers.length) {
|
|
35
|
+
await fs_extra_1.default.promises.mkdir(triggerPath, { recursive: true });
|
|
36
|
+
}
|
|
37
|
+
const customTriggerIdToNameMap = {};
|
|
38
|
+
const generateUniqueTriggerNames = (0, file_1.withUniqueFileNames)();
|
|
39
|
+
for (const trigger of customTriggers) {
|
|
40
|
+
const triggerCode = (0, trigger_codegen_1.triggerToCode)(trigger, {
|
|
41
|
+
stepIdToVariableMap: {},
|
|
42
|
+
eventIdToNameMap,
|
|
43
|
+
inputs: [],
|
|
44
|
+
sharedInputs,
|
|
45
|
+
inputSources,
|
|
46
|
+
stepIdToStepMap: {},
|
|
47
|
+
secrets,
|
|
48
|
+
upstreamStepIds: new Set(),
|
|
49
|
+
customTriggerIdToNameMap,
|
|
50
|
+
integration: { name: integrationName },
|
|
51
|
+
});
|
|
52
|
+
const triggerFileName = generateUniqueTriggerNames(trigger.name);
|
|
53
|
+
customTriggerIdToNameMap[trigger.id] = triggerFileName;
|
|
54
|
+
await (0, file_1.writeSourceToFile)(triggerPath, triggerFileName, triggerCode);
|
|
55
|
+
}
|
|
31
56
|
const workflowMetas = integrationOutput.config.values.workflowMeta ?? {};
|
|
32
57
|
const workflows = Object.values(integrationOutput.workflows);
|
|
33
58
|
const workflowPath = path_1.default.join(integrationPath, 'workflows');
|
|
@@ -36,7 +61,7 @@ const generateIntegrationFiles = async (integrationName, integrationOutput, proj
|
|
|
36
61
|
recursive: true,
|
|
37
62
|
});
|
|
38
63
|
}
|
|
39
|
-
const
|
|
64
|
+
const generateUniqueWorkflowNames = (0, file_1.withUniqueFileNames)();
|
|
40
65
|
for (const workflow of workflows) {
|
|
41
66
|
const workflowCode = (0, workflow_codegen_1.workflowToCode)(workflow, {
|
|
42
67
|
secrets,
|
|
@@ -51,8 +76,9 @@ const generateIntegrationFiles = async (integrationName, integrationOutput, proj
|
|
|
51
76
|
id: workflow.id,
|
|
52
77
|
inputs: [],
|
|
53
78
|
},
|
|
79
|
+
customTriggerIdToNameMap,
|
|
54
80
|
});
|
|
55
|
-
const workflowFileName =
|
|
81
|
+
const workflowFileName = generateUniqueWorkflowNames(workflow.name);
|
|
56
82
|
await (0, file_1.writeSourceToFile)(workflowPath, `${workflow.isDraft ? '~' : ''}` + workflowFileName, workflowCode);
|
|
57
83
|
}
|
|
58
84
|
};
|