@useparagon/cli 0.0.1-canary.39 → 0.0.1-canary.4
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/api.types.d.ts +8 -71
- package/dist/apis/auth.api.js +7 -5
- package/dist/apis/auth.api.js.map +1 -1
- package/dist/apis/base.api.d.ts +0 -3
- package/dist/apis/base.api.js +52 -51
- package/dist/apis/base.api.js.map +1 -1
- package/dist/apis/event.api.d.ts +2 -0
- package/dist/apis/event.api.js +10 -0
- package/dist/apis/event.api.js.map +1 -0
- package/dist/apis/index.d.ts +2 -0
- package/dist/apis/index.js +2 -0
- package/dist/apis/index.js.map +1 -1
- package/dist/apis/integration.api.d.ts +3 -3
- package/dist/apis/integration.api.js +10 -18
- package/dist/apis/integration.api.js.map +1 -1
- package/dist/apis/project.api.d.ts +1 -1
- package/dist/apis/project.api.js +17 -40
- package/dist/apis/project.api.js.map +1 -1
- package/dist/apis/workflow.api.d.ts +2 -0
- package/dist/apis/workflow.api.js +10 -0
- package/dist/apis/workflow.api.js.map +1 -0
- package/dist/codegen/codegen.types.d.ts +4 -12
- package/dist/codegen/codegen.utils.d.ts +1 -2
- package/dist/codegen/codegen.utils.js +28 -63
- package/dist/codegen/codegen.utils.js.map +1 -1
- package/dist/codegen/codegens/condition.codegen.js +35 -38
- package/dist/codegen/codegens/condition.codegen.js.map +1 -1
- package/dist/codegen/codegens/event.codegen.js +3 -4
- package/dist/codegen/codegens/event.codegen.js.map +1 -1
- package/dist/codegen/codegens/integration.codegen.d.ts +3 -3
- package/dist/codegen/codegens/integration.codegen.js +32 -138
- package/dist/codegen/codegens/integration.codegen.js.map +1 -1
- package/dist/codegen/codegens/source.codegen.d.ts +1 -3
- package/dist/codegen/codegens/source.codegen.js +31 -120
- package/dist/codegen/codegens/source.codegen.js.map +1 -1
- package/dist/codegen/codegens/workflow.codegen.js +111 -253
- package/dist/codegen/codegens/workflow.codegen.js.map +1 -1
- package/dist/commands/auth/login/login.action.js +31 -28
- package/dist/commands/auth/login/login.action.js.map +1 -1
- package/dist/commands/auth/login/login.command.js +4 -5
- package/dist/commands/auth/login/login.command.js.map +1 -1
- package/dist/commands/auth/login/login.utils.js +19 -26
- package/dist/commands/auth/login/login.utils.js.map +1 -1
- package/dist/commands/auth/logout/logout.action.js +5 -3
- package/dist/commands/auth/logout/logout.action.js.map +1 -1
- package/dist/commands/auth/logout/logout.command.js +3 -3
- package/dist/commands/auth/logout/logout.command.js.map +1 -1
- package/dist/commands/auth/me/me.action.js +6 -10
- package/dist/commands/auth/me/me.action.js.map +1 -1
- package/dist/commands/auth/me/me.command.js +3 -3
- package/dist/commands/auth/me/me.command.js.map +1 -1
- package/dist/commands/build/build.action.js +27 -27
- package/dist/commands/build/build.action.js.map +1 -1
- package/dist/commands/build/build.command.js +5 -9
- package/dist/commands/build/build.command.js.map +1 -1
- package/dist/commands/build/build.types.d.ts +0 -1
- package/dist/commands/build/build.utils.d.ts +1 -1
- package/dist/commands/build/build.utils.js +9 -11
- package/dist/commands/build/build.utils.js.map +1 -1
- package/dist/commands/command.loader.js +8 -10
- package/dist/commands/command.loader.js.map +1 -1
- package/dist/commands/init/init.action.d.ts +1 -1
- package/dist/commands/init/init.action.js +68 -93
- package/dist/commands/init/init.action.js.map +1 -1
- package/dist/commands/init/init.command.js +8 -14
- package/dist/commands/init/init.command.js.map +1 -1
- package/dist/commands/init/init.constants.js +23 -0
- package/dist/commands/init/init.constants.js.map +1 -0
- package/dist/commands/init/init.types.d.ts +0 -1
- package/dist/commands/init/init.utils.d.ts +11 -0
- package/dist/commands/init/init.utils.js +50 -0
- package/dist/commands/init/init.utils.js.map +1 -0
- package/dist/commands/push/push.action.js +11 -9
- package/dist/commands/push/push.action.js.map +1 -1
- package/dist/commands/push/push.command.js +4 -4
- package/dist/commands/push/push.command.js.map +1 -1
- package/dist/compiler/compiler.types.d.ts +2 -3
- package/dist/compiler/compiler.utils.d.ts +1 -1
- package/dist/compiler/compiler.utils.js +4 -8
- package/dist/compiler/compiler.utils.js.map +1 -1
- package/dist/compiler/compilers/events.compiler.js +28 -24
- package/dist/compiler/compilers/events.compiler.js.map +1 -1
- package/dist/compiler/compilers/integrations.compiler.js +52 -148
- package/dist/compiler/compilers/integrations.compiler.js.map +1 -1
- package/dist/compiler/compilers/persona.compiler.js +11 -4
- package/dist/compiler/compilers/persona.compiler.js.map +1 -1
- package/dist/compiler/compilers/project.compiler.d.ts +0 -1
- package/dist/compiler/compilers/project.compiler.js +23 -49
- package/dist/compiler/compilers/project.compiler.js.map +1 -1
- package/dist/compiler/compilers/workflows.compiler.js +33 -46
- package/dist/compiler/compilers/workflows.compiler.js.map +1 -1
- package/dist/compiler/ts.compiler.d.ts +3 -1
- package/dist/compiler/ts.compiler.js +18 -18
- package/dist/compiler/ts.compiler.js.map +1 -1
- package/dist/config/config.constants.d.ts +0 -1
- package/dist/config/config.constants.js +1 -2
- package/dist/config/config.constants.js.map +1 -1
- package/dist/config/config.types.d.ts +0 -4
- package/dist/config/config.utils.d.ts +3 -4
- package/dist/config/config.utils.js +37 -65
- package/dist/config/config.utils.js.map +1 -1
- package/dist/helpers/constants.d.ts +0 -1
- package/dist/helpers/constants.js +1 -2
- package/dist/helpers/constants.js.map +1 -1
- package/dist/helpers/file.d.ts +1 -3
- package/dist/helpers/file.js +15 -44
- package/dist/helpers/file.js.map +1 -1
- package/dist/helpers/strings.d.ts +0 -1
- package/dist/helpers/strings.js +1 -34
- package/dist/helpers/strings.js.map +1 -1
- package/dist/index.js +0 -10
- package/dist/index.js.map +1 -1
- package/dist/logger/logger.js +1 -5
- package/dist/logger/logger.js.map +1 -1
- package/dist/templates/configurations/typescript/tsconfig.json +2 -3
- package/dist/templates/javascript/src/events/hello-world.js +13 -0
- package/dist/templates/javascript/src/integrations/slack/config.js +11 -0
- package/dist/templates/javascript/src/integrations/slack/workflows/example-workflow.js +30 -0
- package/dist/templates/typescript/src/events/hello-world.ts +21 -0
- package/dist/templates/typescript/src/integrations/slack/config.ts +18 -0
- package/dist/templates/typescript/src/integrations/slack/workflows/example-workflow.ts +30 -0
- package/dist/templates/typescript/tsconfig.json +31 -0
- package/package.json +16 -20
- package/dist/codegen/codegens/intent.codegen.d.ts +0 -5
- package/dist/codegen/codegens/intent.codegen.js +0 -179
- package/dist/codegen/codegens/intent.codegen.js.map +0 -1
- package/dist/commands/install/index.d.ts +0 -1
- package/dist/commands/install/index.js +0 -5
- package/dist/commands/install/index.js.map +0 -1
- package/dist/commands/install/install.action.d.ts +0 -5
- package/dist/commands/install/install.action.js +0 -15
- package/dist/commands/install/install.action.js.map +0 -1
- package/dist/commands/install/install.command.d.ts +0 -8
- package/dist/commands/install/install.command.js +0 -24
- package/dist/commands/install/install.command.js.map +0 -1
- package/dist/commands/install/install.constants.js +0 -68
- package/dist/commands/install/install.constants.js.map +0 -1
- package/dist/commands/install/install.types.d.ts +0 -7
- package/dist/commands/install/install.types.js +0 -3
- package/dist/commands/install/install.types.js.map +0 -1
- package/dist/commands/install/install.utils.d.ts +0 -8
- package/dist/commands/install/install.utils.js +0 -130
- package/dist/commands/install/install.utils.js.map +0 -1
- package/dist/commands/new/index.d.ts +0 -1
- package/dist/commands/new/index.js +0 -5
- package/dist/commands/new/index.js.map +0 -1
- package/dist/commands/new/integration/index.d.ts +0 -1
- package/dist/commands/new/integration/index.js +0 -5
- package/dist/commands/new/integration/index.js.map +0 -1
- package/dist/commands/new/integration/integration.action.d.ts +0 -5
- package/dist/commands/new/integration/integration.action.js +0 -52
- package/dist/commands/new/integration/integration.action.js.map +0 -1
- package/dist/commands/new/integration/integration.command.d.ts +0 -8
- package/dist/commands/new/integration/integration.command.js +0 -26
- package/dist/commands/new/integration/integration.command.js.map +0 -1
- package/dist/commands/new/integration/integration.types.d.ts +0 -1
- package/dist/commands/new/integration/integration.types.js +0 -3
- package/dist/commands/new/integration/integration.types.js.map +0 -1
- package/dist/commands/new/new.command.d.ts +0 -5
- package/dist/commands/new/new.command.js +0 -16
- package/dist/commands/new/new.command.js.map +0 -1
- package/dist/commands/new/new.utils.d.ts +0 -1
- package/dist/commands/new/new.utils.js +0 -18
- package/dist/commands/new/new.utils.js.map +0 -1
- package/dist/commands/new/workflow/index.d.ts +0 -1
- package/dist/commands/new/workflow/index.js +0 -5
- package/dist/commands/new/workflow/index.js.map +0 -1
- package/dist/commands/new/workflow/workflow.action.d.ts +0 -5
- package/dist/commands/new/workflow/workflow.action.js +0 -94
- package/dist/commands/new/workflow/workflow.action.js.map +0 -1
- package/dist/commands/new/workflow/workflow.command.d.ts +0 -8
- package/dist/commands/new/workflow/workflow.command.js +0 -25
- package/dist/commands/new/workflow/workflow.command.js.map +0 -1
- package/dist/commands/new/workflow/workflow.types.d.ts +0 -3
- package/dist/commands/new/workflow/workflow.types.js +0 -3
- package/dist/commands/new/workflow/workflow.types.js.map +0 -1
- package/dist/helpers/sets.d.ts +0 -1
- package/dist/helpers/sets.js +0 -10
- package/dist/helpers/sets.js.map +0 -1
- /package/dist/commands/{install/install.constants.d.ts → init/init.constants.d.ts} +0 -0
|
@@ -1,111 +1,76 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.generateProjectFiles = exports.generateIntegrationFiles = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
6
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
const inputs_1 = require("@useparagon/core/inputs");
|
|
8
|
-
const utils_1 = require("@useparagon/core/utils");
|
|
9
7
|
const file_1 = require("../helpers/file");
|
|
10
8
|
const event_codegen_1 = require("./codegens/event.codegen");
|
|
11
9
|
const integration_codegen_1 = require("./codegens/integration.codegen");
|
|
12
10
|
const persona_codegen_1 = require("./codegens/persona.codegen");
|
|
13
11
|
const workflow_codegen_1 = require("./codegens/workflow.codegen");
|
|
14
|
-
const generateIntegrationFiles =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
const { eventIdToNameMap, secrets } = projectDependencies;
|
|
12
|
+
const generateIntegrationFiles = (integrationName, integrationOutput, projectDependencies, projectRoot) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
var _a, _b, _c, _d;
|
|
14
|
+
const { events } = projectDependencies;
|
|
19
15
|
const integrationPath = path_1.default.join(projectRoot, 'integrations', integrationName);
|
|
20
|
-
|
|
16
|
+
yield fs_extra_1.default.promises.mkdir(integrationPath, {
|
|
21
17
|
recursive: true,
|
|
22
18
|
});
|
|
23
|
-
const sharedInputs = integrationOutput.config.values.sharedMeta
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
const sharedInputs = (_b = (_a = integrationOutput.config.values.sharedMeta) === null || _a === void 0 ? void 0 : _a.inputs) !== null && _b !== void 0 ? _b : [];
|
|
20
|
+
const integrationDependencies = {
|
|
21
|
+
inputSources: (_c = integrationOutput.inputs) !== null && _c !== void 0 ? _c : [],
|
|
22
|
+
};
|
|
23
|
+
const configCode = (0, integration_codegen_1.integrationConfigToCode)(integrationOutput.config, integrationName);
|
|
24
|
+
const inputsSouceCode = (0, integration_codegen_1.integrationInputsToCode)(sharedInputs, integrationDependencies.inputSources);
|
|
25
|
+
const integrationTypesCode = (0, integration_codegen_1.typesForIntegration)(integrationDependencies);
|
|
26
|
+
yield Promise.all([
|
|
28
27
|
(0, file_1.writeSourceToFile)(integrationPath, 'config', configCode),
|
|
29
28
|
(0, file_1.writeSourceToFile)(integrationPath, 'inputs', inputsSouceCode),
|
|
29
|
+
(0, file_1.writeSourceToFile)(integrationPath, 'types', integrationTypesCode),
|
|
30
30
|
]);
|
|
31
|
-
const workflowMetas = integrationOutput.config.values.workflowMeta
|
|
31
|
+
const workflowMetas = (_d = integrationOutput.config.values.workflowMeta) !== null && _d !== void 0 ? _d : {};
|
|
32
32
|
const workflows = Object.values(integrationOutput.workflows);
|
|
33
33
|
const workflowPath = path_1.default.join(integrationPath, 'workflows');
|
|
34
34
|
if (workflows.length) {
|
|
35
|
-
|
|
35
|
+
fs_extra_1.default.promises.mkdir(workflowPath, {
|
|
36
36
|
recursive: true,
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
const generateUniqueNames = (0, file_1.withUniqueFileNames)();
|
|
40
39
|
for (const workflow of workflows) {
|
|
41
40
|
const workflowCode = (0, workflow_codegen_1.workflowToCode)(workflow, {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
integration: {
|
|
45
|
-
name: integrationName,
|
|
46
|
-
dependencies: integrationOutput.dependencies,
|
|
47
|
-
},
|
|
41
|
+
events,
|
|
42
|
+
integration: { name: integrationName },
|
|
48
43
|
sharedInputs,
|
|
49
|
-
inputSources,
|
|
44
|
+
inputSources: integrationDependencies.inputSources,
|
|
50
45
|
workflowMeta: workflowMetas[workflow.id] || {
|
|
51
46
|
id: workflow.id,
|
|
52
47
|
inputs: [],
|
|
53
48
|
},
|
|
54
49
|
});
|
|
55
|
-
|
|
50
|
+
yield (0, file_1.writeSourceToFile)(workflowPath, workflow.name, workflowCode);
|
|
56
51
|
}
|
|
57
|
-
};
|
|
52
|
+
});
|
|
58
53
|
exports.generateIntegrationFiles = generateIntegrationFiles;
|
|
59
|
-
const generateProjectFiles =
|
|
54
|
+
const generateProjectFiles = (projectBuild, projectRoot) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
60
55
|
const events = Object.values(projectBuild.events);
|
|
61
56
|
const eventPath = path_1.default.join(projectRoot, 'events');
|
|
62
57
|
if (events.length) {
|
|
63
|
-
|
|
58
|
+
yield fs_extra_1.default.promises.mkdir(eventPath, {
|
|
64
59
|
recursive: true,
|
|
65
60
|
});
|
|
66
61
|
}
|
|
67
|
-
const eventIdToNameMap = {};
|
|
68
|
-
const generateUniqueNames = (0, file_1.withUniqueFileNames)();
|
|
69
62
|
for (const event of events) {
|
|
70
|
-
const eventFileName = generateUniqueNames(event.name);
|
|
71
|
-
eventIdToNameMap[event.id] = eventFileName;
|
|
72
63
|
const eventSourceCode = (0, event_codegen_1.eventToCode)(event);
|
|
73
|
-
|
|
64
|
+
yield (0, file_1.writeSourceToFile)(eventPath, event.name, eventSourceCode);
|
|
74
65
|
}
|
|
75
|
-
|
|
66
|
+
yield (0, file_1.writeSourceToFile)(projectRoot, 'persona.meta', (0, persona_codegen_1.personaToCode)(projectBuild.persona));
|
|
76
67
|
const integrationOutputs = Object.entries(projectBuild.integrations);
|
|
77
68
|
for (const [integrationName, integrationOutput] of integrationOutputs) {
|
|
78
|
-
|
|
79
|
-
|
|
69
|
+
yield (0, exports.generateIntegrationFiles)(integrationName, integrationOutput, {
|
|
70
|
+
events: projectBuild.events,
|
|
80
71
|
projectId: projectBuild.projectId,
|
|
81
|
-
secrets: projectBuild.secrets,
|
|
82
72
|
}, projectRoot);
|
|
83
73
|
}
|
|
84
|
-
};
|
|
74
|
+
});
|
|
85
75
|
exports.generateProjectFiles = generateProjectFiles;
|
|
86
|
-
const getInputsForIntent = (intent) => {
|
|
87
|
-
const getInputs = (inputs) => {
|
|
88
|
-
const response = [];
|
|
89
|
-
for (const input of inputs) {
|
|
90
|
-
response.push(input);
|
|
91
|
-
if (input.dependentInputs?.length) {
|
|
92
|
-
response.push(...getInputs(input.dependentInputs));
|
|
93
|
-
}
|
|
94
|
-
else if (input.type === inputs_1.SidebarInputType.Enum ||
|
|
95
|
-
input.type === inputs_1.SidebarInputType.EditableEnum) {
|
|
96
|
-
for (const enumValue of input.values) {
|
|
97
|
-
if (typeof enumValue === 'string') {
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
if (enumValue.dependentInputs?.length) {
|
|
101
|
-
response.push(...getInputs(enumValue.dependentInputs));
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return inputs;
|
|
107
|
-
};
|
|
108
|
-
return Object.values((0, utils_1.indexBy)('id', getInputs(intent.inputs)));
|
|
109
|
-
};
|
|
110
|
-
exports.getInputsForIntent = getInputsForIntent;
|
|
111
76
|
//# sourceMappingURL=codegen.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.utils.js","sourceRoot":"","sources":["../../src/codegen/codegen.utils.ts"],"names":[],"mappings":";;;;AAAA,gEAA0B;AAC1B,wDAAwB;
|
|
1
|
+
{"version":3,"file":"codegen.utils.js","sourceRoot":"","sources":["../../src/codegen/codegen.utils.ts"],"names":[],"mappings":";;;;AAAA,gEAA0B;AAC1B,wDAAwB;AAaxB,0CAAoD;AACpD,4DAAuD;AACvD,wEAIwC;AACxC,gEAA2D;AAC3D,kEAA6D;AAQtD,MAAM,wBAAwB,GAAG,CACtC,eAAuB,EACvB,iBAAmC,EACnC,mBAAwC,EACxC,WAAmB,EACnB,EAAE;;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,mBAAmB,CAAC;IACvC,MAAM,eAAe,GAAW,cAAI,CAAC,IAAI,CACvC,WAAW,EACX,cAAc,EACd,eAAe,CAChB,CAAC;IACF,MAAM,kBAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,eAAe,EAAE;QACvC,SAAS,EAAE,IAAI;KAChB,CAAC,CAAC;IAEH,MAAM,YAAY,GAChB,MAAA,MAAA,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,0CAAE,MAAM,mCAAI,EAAE,CAAC;IAE3D,MAAM,uBAAuB,GAA4B;QACvD,YAAY,EAAE,MAAA,iBAAiB,CAAC,MAAM,mCAAI,EAAE;KAC7C,CAAC;IAEF,MAAM,UAAU,GAAW,IAAA,6CAAuB,EAChD,iBAAiB,CAAC,MAAM,EACxB,eAAe,CAChB,CAAC;IACF,MAAM,eAAe,GAAW,IAAA,6CAAuB,EACrD,YAAY,EACZ,uBAAuB,CAAC,YAAY,CACrC,CAAC;IACF,MAAM,oBAAoB,GAAW,IAAA,yCAAmB,EACtD,uBAAuB,CACxB,CAAC;I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E;IACF,MAAM,MAAM,GAAa,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IAE5D,MAAM,SAAS,GAAW,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;IAE3D,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,MAAM,kBAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE;YACjC,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,eAAe,GAAW,IAAA,2BAAW,EAAC,KAAK,CAAC,CAAC;QACnD,MAAM,IAAA,wBAAiB,EAAC,SAAS,EAAE,KAAK,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IAClE,CAAC;IAGD,MAAM,IAAA,wBAAiB,EACrB,WAAW,EACX,cAAc,EACd,IAAA,+BAAa,EAAC,YAAY,CAAC,OAAO,CAAC,CACpC,CAAC;IAEF,MAAM,kBAAkB,GAAsC,MAAM,CAAC,OAAO,CAC1E,YAAY,CAAC,YAAY,CAC1B,CAAC;IAEF,KAAK,MAAM,CAAC,eAAe,EAAE,iBAAiB,CAAC,IAAI,kBAAkB,EAAE,CAAC;QACtE,MAAM,IAAA,gCAAwB,EAC5B,eAAe,EACf,iBAAiB,EACjB;YACE,MAAM,EAAE,YAAY,CAAC,MAAM;YAC3B,SAAS,EAAE,YAAY,CAAC,SAAS;SAClC,EACD,WAAW,CACZ,CAAC;IACJ,CAAC;AACH,CAAC,CAAA,CAAC;AAzCW,QAAA,oBAAoB,wBAyC/B"}
|
|
@@ -6,106 +6,103 @@ const source_codegen_1 = require("./source.codegen");
|
|
|
6
6
|
const conditionToCode = (operatorCondition, dependencies) => {
|
|
7
7
|
let code = '';
|
|
8
8
|
const condition = operatorCondition.condition;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
return parameters;
|
|
15
|
-
};
|
|
9
|
+
let parameters = (0, source_codegen_1.convertSourceToCode)(condition.variable, dependencies);
|
|
10
|
+
if ('argument' in condition) {
|
|
11
|
+
parameters = `${parameters},${(0, source_codegen_1.convertSourceToCode)(condition.argument, dependencies)}`;
|
|
12
|
+
}
|
|
16
13
|
switch (condition.operator) {
|
|
17
14
|
case resolvers_1.Operator.ArrayIsEmpty:
|
|
18
|
-
code = `Operators.ArrayIsEmpty(${
|
|
15
|
+
code = `Operators.ArrayIsEmpty(${parameters})`;
|
|
19
16
|
break;
|
|
20
17
|
case resolvers_1.Operator.ArrayIsIn:
|
|
21
|
-
code = `Operators.ArrayIsIn(${
|
|
18
|
+
code = `Operators.ArrayIsIn(${parameters})`;
|
|
22
19
|
break;
|
|
23
20
|
case resolvers_1.Operator.ArrayIsNotEmpty:
|
|
24
|
-
code = `Operators.ArrayIsNotEmpty(${
|
|
21
|
+
code = `Operators.ArrayIsNotEmpty(${parameters})`;
|
|
25
22
|
break;
|
|
26
23
|
case resolvers_1.Operator.ArrayIsNotIn:
|
|
27
|
-
code = `Operators.ArrayIsNotIn(${
|
|
24
|
+
code = `Operators.ArrayIsNotIn(${parameters})`;
|
|
28
25
|
break;
|
|
29
26
|
case resolvers_1.Operator.BooleanFalse:
|
|
30
|
-
code = `Operators.BooleanFalse(${
|
|
27
|
+
code = `Operators.BooleanFalse(${parameters})`;
|
|
31
28
|
break;
|
|
32
29
|
case resolvers_1.Operator.BooleanTrue:
|
|
33
|
-
code = `Operators.BooleanTrue(${
|
|
30
|
+
code = `Operators.BooleanTrue(${parameters})`;
|
|
34
31
|
break;
|
|
35
32
|
case resolvers_1.Operator.DateTimeAfter:
|
|
36
|
-
code = `Operators.DateTimeAfter(${
|
|
33
|
+
code = `Operators.DateTimeAfter(${parameters})`;
|
|
37
34
|
break;
|
|
38
35
|
case resolvers_1.Operator.DateTimeBefore:
|
|
39
|
-
code = `Operators.DateTimeBefore(${
|
|
36
|
+
code = `Operators.DateTimeBefore(${parameters})`;
|
|
40
37
|
break;
|
|
41
38
|
case resolvers_1.Operator.DateTimeEquals:
|
|
42
|
-
code = `Operators.DateTimeEquals(${
|
|
39
|
+
code = `Operators.DateTimeEquals(${parameters})`;
|
|
43
40
|
break;
|
|
44
41
|
case resolvers_1.Operator.DoesNotExist:
|
|
45
|
-
code = `Operators.DoesNotExist(${
|
|
42
|
+
code = `Operators.DoesNotExist(${parameters})`;
|
|
46
43
|
break;
|
|
47
44
|
case resolvers_1.Operator.Exists:
|
|
48
|
-
code = `Operators.Exists(${
|
|
45
|
+
code = `Operators.Exists(${parameters})`;
|
|
49
46
|
break;
|
|
50
47
|
case resolvers_1.Operator.IsNotNull:
|
|
51
|
-
code = `Operators.IsNotNull(${
|
|
48
|
+
code = `Operators.IsNotNull(${parameters})`;
|
|
52
49
|
break;
|
|
53
50
|
case resolvers_1.Operator.IsNull:
|
|
54
|
-
code = `Operators.IsNull(${
|
|
51
|
+
code = `Operators.IsNull(${parameters})`;
|
|
55
52
|
break;
|
|
56
53
|
case resolvers_1.Operator.NumberDoesNotEqual:
|
|
57
|
-
code = `Operators.NumberDoesNotEqual(${
|
|
54
|
+
code = `Operators.NumberDoesNotEqual(${parameters})`;
|
|
58
55
|
break;
|
|
59
56
|
case resolvers_1.Operator.NumberEquals:
|
|
60
|
-
code = `Operators.NumberEquals(${
|
|
57
|
+
code = `Operators.NumberEquals(${parameters})`;
|
|
61
58
|
break;
|
|
62
59
|
case resolvers_1.Operator.NumberGreaterThan:
|
|
63
|
-
code = `Operators.NumberGreaterThan(${
|
|
60
|
+
code = `Operators.NumberGreaterThan(${parameters})`;
|
|
64
61
|
break;
|
|
65
62
|
case resolvers_1.Operator.NumberGreaterThanOrEqualTo:
|
|
66
|
-
code = `Operators.NumberGreaterThanOrEqualTo(${
|
|
63
|
+
code = `Operators.NumberGreaterThanOrEqualTo(${parameters})`;
|
|
67
64
|
break;
|
|
68
65
|
case resolvers_1.Operator.NumberLessThan:
|
|
69
|
-
code = `Operators.NumberLessThan(${
|
|
66
|
+
code = `Operators.NumberLessThan(${parameters})`;
|
|
70
67
|
break;
|
|
71
68
|
case resolvers_1.Operator.NumberLessThanOrEqualTo:
|
|
72
|
-
code = `Operators.NumberLessThanOrEqualTo(${
|
|
69
|
+
code = `Operators.NumberLessThanOrEqualTo(${parameters})`;
|
|
73
70
|
break;
|
|
74
71
|
case resolvers_1.Operator.StringContains:
|
|
75
|
-
code = `Operators.StringContains(${
|
|
72
|
+
code = `Operators.StringContains(${parameters})`;
|
|
76
73
|
break;
|
|
77
74
|
case resolvers_1.Operator.StringDoesNotContain:
|
|
78
|
-
code = `Operators.StringDoesNotContain(${
|
|
75
|
+
code = `Operators.StringDoesNotContain(${parameters})`;
|
|
79
76
|
break;
|
|
80
77
|
case resolvers_1.Operator.StringDoesNotEndWith:
|
|
81
|
-
code = `Operators.StringDoesNotEndWith(${
|
|
78
|
+
code = `Operators.StringDoesNotEndWith(${parameters})`;
|
|
82
79
|
break;
|
|
83
80
|
case resolvers_1.Operator.StringDoesNotExactlyMatch:
|
|
84
|
-
code = `Operators.StringDoesNotExactlyMatch(${
|
|
81
|
+
code = `Operators.StringDoesNotExactlyMatch(${parameters})`;
|
|
85
82
|
break;
|
|
86
83
|
case resolvers_1.Operator.StringDoesNotStartWith:
|
|
87
|
-
code = `Operators.StringDoesNotStartWith(${
|
|
84
|
+
code = `Operators.StringDoesNotStartWith(${parameters})`;
|
|
88
85
|
break;
|
|
89
86
|
case resolvers_1.Operator.StringEndsWith:
|
|
90
|
-
code = `Operators.
|
|
87
|
+
code = `Operators.BooleanTrue(${parameters})`;
|
|
91
88
|
break;
|
|
92
89
|
case resolvers_1.Operator.StringExactlyMatches:
|
|
93
|
-
code = `Operators.
|
|
90
|
+
code = `Operators.BooleanTrue(${parameters})`;
|
|
94
91
|
break;
|
|
95
92
|
case resolvers_1.Operator.StringGreaterThan:
|
|
96
|
-
code = `Operators.StringContains(${
|
|
93
|
+
code = `Operators.StringContains(${parameters})`;
|
|
97
94
|
break;
|
|
98
95
|
case resolvers_1.Operator.StringIsIn:
|
|
99
|
-
code = `Operators.
|
|
96
|
+
code = `Operators.BooleanTrue(${parameters})`;
|
|
100
97
|
break;
|
|
101
98
|
case resolvers_1.Operator.StringIsNotIn:
|
|
102
|
-
code = `Operators.
|
|
99
|
+
code = `Operators.BooleanTrue(${parameters})`;
|
|
103
100
|
break;
|
|
104
101
|
case resolvers_1.Operator.StringLessThan:
|
|
105
|
-
code = `Operators.
|
|
102
|
+
code = `Operators.BooleanTrue(${parameters})`;
|
|
106
103
|
break;
|
|
107
104
|
case resolvers_1.Operator.StringStartsWith:
|
|
108
|
-
code = `Operators.
|
|
105
|
+
code = `Operators.BooleanTrue(${parameters})`;
|
|
109
106
|
break;
|
|
110
107
|
default:
|
|
111
108
|
code = 'undefined';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition.codegen.js","sourceRoot":"","sources":["../../../src/codegen/codegens/condition.codegen.ts"],"names":[],"mappings":";;;AAAA,0DAIoC;AAGpC,qDAAuD;AAOhD,MAAM,eAAe,GAAG,CAC7B,iBAAoC,EACpC,YAA8B,EACtB,EAAE;IACV,IAAI,IAAI,GAAW,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"condition.codegen.js","sourceRoot":"","sources":["../../../src/codegen/codegens/condition.codegen.ts"],"names":[],"mappings":";;;AAAA,0DAIoC;AAGpC,qDAAuD;AAOhD,MAAM,eAAe,GAAG,CAC7B,iBAAoC,EACpC,YAA8B,EACtB,EAAE;IACV,IAAI,IAAI,GAAW,EAAE,CAAC;IAEtB,MAAM,SAAS,GAAc,iBAAiB,CAAC,SAAS,CAAC;IACzD,IAAI,UAAU,GAAW,IAAA,oCAAmB,EAC1C,SAAS,CAAC,QAAQ,EAClB,YAAY,CACb,CAAC;IAEF,IAAI,UAAU,IAAI,SAAS,EAAE,CAAC;QAC5B,UAAU,GAAG,GAAG,UAAU,IAAI,IAAA,oCAA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,CAAC,iBAAiB;YAC7B,IAAI,GAAG,4BAA4B,UAAU,GAAG,CAAC;YACjD,MAAM;QAER,KAAK,oBAAQ,CAAC,UAAU;YACtB,IAAI,GAAG,yBAAyB,UAAU,GAAG,CAAC;YAC9C,MAAM;QAER,KAAK,oBAAQ,CAAC,aAAa;YACzB,IAAI,GAAG,yBAAyB,UAAU,GAAG,CAAC;YAC9C,MAAM;QAER,KAAK,oBAAQ,CAAC,cAAc;YAC1B,IAAI,GAAG,yBAAyB,UAAU,GAAG,CAAC;YAC9C,MAAM;QAER,KAAK,oBAAQ,CAAC,gBAAgB;YAC5B,IAAI,GAAG,yBAAyB,UAAU,GAAG,CAAC;YAC9C,MAAM;QAER;YACE,IAAI,GAAG,WAAW,CAAC;YACnB,MAAM;IACV,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AArJW,QAAA,eAAe,mBAqJ1B"}
|
|
@@ -2,23 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.eventToCode = void 0;
|
|
4
4
|
const json_1 = require("../../helpers/json");
|
|
5
|
-
const strings_1 = require("../../helpers/strings");
|
|
6
5
|
const eventToCode = (event) => {
|
|
7
6
|
const sourceCode = `
|
|
8
7
|
import { IEventInit } from '@useparagon/core/event';
|
|
9
8
|
|
|
10
|
-
export type EventSchema = ${(0, json_1.stringifyObject)(event.
|
|
9
|
+
export type EventSchema = ${(0, json_1.stringifyObject)(event.schema)};
|
|
11
10
|
|
|
12
11
|
const event: IEventInit<EventSchema> = {
|
|
13
12
|
/**
|
|
14
13
|
* name of event
|
|
15
14
|
*/
|
|
16
|
-
name : ${
|
|
15
|
+
name : '${event.name}',
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* schema of event payload
|
|
20
19
|
*/
|
|
21
|
-
schema
|
|
20
|
+
schema:${(0, json_1.stringifyObject)(event.schema)}
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
export default event;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.codegen.js","sourceRoot":"","sources":["../../../src/codegen/codegens/event.codegen.ts"],"names":[],"mappings":";;;AAEA,6CAAqD;
|
|
1
|
+
{"version":3,"file":"event.codegen.js","sourceRoot":"","sources":["../../../src/codegen/codegens/event.codegen.ts"],"names":[],"mappings":";;;AAEA,6CAAqD;AAO9C,MAAM,WAAW,GAAG,CAAC,KAAa,EAAU,EAAE;IACnD,MAAM,UAAU,GAAW;;;6BAGA,IAAA,sBAAe,EAAC,KAAK,CAAC,MAAM,CAAC;;;;;;aAM7C,KAAK,CAAC,IAAI;;;;;YAKX,IAAA,sBAAe,EAAC,KAAK,CAAC,MAAM,CAAC;;;;EAIvC,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAtBW,QAAA,WAAW,eAsBtB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InputSource, SerializedInput } from '@useparagon/core/inputs';
|
|
2
2
|
import { IntegrationBuild, IntegrationDependencies } from '../../apis/api.types';
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const integrationInputsToCode: (
|
|
5
|
-
export declare const typesForIntegration: (
|
|
3
|
+
export declare const integrationConfigToCode: (config: IntegrationBuild['config'], integrationName: string) => string;
|
|
4
|
+
export declare const integrationInputsToCode: (inputs: SerializedInput[], inputSources: InputSource[]) => string;
|
|
5
|
+
export declare const typesForIntegration: (integrationDependencies: IntegrationDependencies) => string;
|
|
@@ -1,133 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.typesForIntegration = exports.integrationInputsToCode = exports.
|
|
4
|
-
const core_1 = require("@useparagon/core");
|
|
3
|
+
exports.typesForIntegration = exports.integrationInputsToCode = exports.integrationConfigToCode = void 0;
|
|
5
4
|
const inputs_1 = require("@useparagon/core/inputs");
|
|
6
|
-
const integration_1 = require("@useparagon/core/integration");
|
|
7
|
-
const request_1 = require("@useparagon/core/steps/library/request");
|
|
8
|
-
const utils_1 = require("@useparagon/core/utils");
|
|
9
5
|
const json_1 = require("../../helpers/json");
|
|
10
|
-
const
|
|
11
|
-
const source_codegen_1 = require("./source.codegen");
|
|
12
|
-
const integrationToConfigCode = (integration, integrationName) => {
|
|
13
|
-
const customIntegration = integration.customIntegration;
|
|
14
|
-
const config = integration.config;
|
|
15
|
-
if (!customIntegration) {
|
|
16
|
-
const sourceCode = `
|
|
17
|
-
import { IIntegrationConfig } from '@useparagon/core/integration';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* configuration for a ${integrationName}
|
|
21
|
-
*/
|
|
22
|
-
const config: IIntegrationConfig = ${(0, json_1.stringifyObject)({
|
|
23
|
-
description: config.values.description ||
|
|
24
|
-
`A description for the integration's purpose.`,
|
|
25
|
-
overviewText: config.values.overview ||
|
|
26
|
-
`A long-form description for the integration's purpose.`,
|
|
27
|
-
showWatermark: config.values.paragonLink || true,
|
|
28
|
-
})}
|
|
29
|
-
|
|
30
|
-
export default config;`;
|
|
31
|
-
return sourceCode;
|
|
32
|
-
}
|
|
33
|
-
const dependencies = {
|
|
34
|
-
inputs: customIntegration.inputFields,
|
|
35
|
-
};
|
|
36
|
-
const authorizationConfigToCode = () => {
|
|
37
|
-
switch (customIntegration.apiAuthorization?.type) {
|
|
38
|
-
case request_1.RequestAuthorizationType.BASIC:
|
|
39
|
-
const userName = customIntegration.apiAuthorization.username || source_codegen_1.EMPTY_TOKENIZED_SOURCE;
|
|
40
|
-
const password = customIntegration.apiAuthorization.password || source_codegen_1.EMPTY_TOKENIZED_SOURCE;
|
|
41
|
-
return `authorization: {
|
|
42
|
-
type: '${request_1.RequestAuthorizationType.BASIC}',
|
|
43
|
-
userName: ${(0, source_codegen_1.convertSourceToCode)(userName, dependencies)},
|
|
44
|
-
password: ${(0, source_codegen_1.convertSourceToCode)(password, dependencies)},
|
|
45
|
-
}
|
|
46
|
-
`;
|
|
47
|
-
case request_1.RequestAuthorizationType.BEARER_TOKEN:
|
|
48
|
-
const token = customIntegration.apiAuthorization.token || source_codegen_1.EMPTY_TOKENIZED_SOURCE;
|
|
49
|
-
return `authorization: {
|
|
50
|
-
type: '${request_1.RequestAuthorizationType.BEARER_TOKEN}',
|
|
51
|
-
token: ${(0, source_codegen_1.convertSourceToCode)(token, dependencies)},
|
|
52
|
-
}
|
|
53
|
-
`;
|
|
54
|
-
case request_1.RequestAuthorizationType.QUERY_PARAMS:
|
|
55
|
-
const params = customIntegration.apiAuthorization.params || [];
|
|
56
|
-
return `authorization: {
|
|
57
|
-
type: '${request_1.RequestAuthorizationType.QUERY_PARAMS}',
|
|
58
|
-
params: ${(0, source_codegen_1.covertKeyedSourceParamsToCode)(params, dependencies)}
|
|
59
|
-
}
|
|
60
|
-
`;
|
|
61
|
-
case request_1.RequestAuthorizationType.AUTH_HEADER:
|
|
62
|
-
const headers = customIntegration.apiAuthorization.headers || [];
|
|
63
|
-
return `authorization: {
|
|
64
|
-
type: '${request_1.RequestAuthorizationType.AUTH_HEADER}',
|
|
65
|
-
headers: ${(0, source_codegen_1.covertKeyedSourceParamsToCode)(headers, dependencies)}
|
|
66
|
-
}
|
|
67
|
-
`;
|
|
68
|
-
case request_1.RequestAuthorizationType.CLIENT_CREDENTIAL:
|
|
69
|
-
return `authorization: {
|
|
70
|
-
type: '${request_1.RequestAuthorizationType.CLIENT_CREDENTIAL}',
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
default:
|
|
74
|
-
return '';
|
|
75
|
-
}
|
|
76
|
-
};
|
|
6
|
+
const integrationConfigToCode = (config, integrationName) => {
|
|
77
7
|
const sourceCode = `
|
|
78
|
-
import {
|
|
8
|
+
import { IIntegrationConfig } from '@useparagon/core/integration';
|
|
79
9
|
|
|
80
10
|
/**
|
|
81
|
-
*
|
|
11
|
+
* configuration for a ${integrationName}
|
|
82
12
|
*/
|
|
83
|
-
|
|
13
|
+
const config: IIntegrationConfig = ${(0, json_1.stringifyObject)({
|
|
14
|
+
description: config.values.description,
|
|
15
|
+
overviewText: config.values.overview,
|
|
16
|
+
showWatermark: config.values.paragonLink || true,
|
|
17
|
+
})}
|
|
84
18
|
|
|
85
|
-
/**
|
|
86
|
-
* custom integration config
|
|
87
|
-
*/
|
|
88
|
-
const config :ICustomIntegrationConfig ={
|
|
89
|
-
name: ${(0, strings_1.sanitizeString)(customIntegration.name)},
|
|
90
|
-
description: ${(0, strings_1.sanitizeString)(config.values.description || '')},
|
|
91
|
-
accentColor: ${(0, strings_1.sanitizeString)(config.values.accentColor || '')},
|
|
92
|
-
${(() => {
|
|
93
|
-
switch (customIntegration.authenticationType) {
|
|
94
|
-
case core_1.AuthenticationScheme.OAUTH_CLIENT_CREDENTIAL:
|
|
95
|
-
const oauthAccessTokenUrl = customIntegration.oauthAccessTokenUrl || source_codegen_1.EMPTY_TOKENIZED_SOURCE;
|
|
96
|
-
return `authenticationType: '${core_1.AuthenticationScheme.OAUTH_CLIENT_CREDENTIAL}',
|
|
97
|
-
accessTokenUrl:${(0, source_codegen_1.convertSourceToCode)(oauthAccessTokenUrl, dependencies)}
|
|
98
|
-
`;
|
|
99
|
-
case core_1.AuthenticationScheme.OAUTH:
|
|
100
|
-
const authorizationUrl = customIntegration.oauthAuthorizationUrl || source_codegen_1.EMPTY_TOKENIZED_SOURCE;
|
|
101
|
-
const accesstokenUrl = customIntegration.oauthAccessTokenUrl || source_codegen_1.EMPTY_TOKENIZED_SOURCE;
|
|
102
|
-
return `authenticationType: '${core_1.AuthenticationScheme.OAUTH}',
|
|
103
|
-
authorizationUrl: ${(0, source_codegen_1.convertSourceToCode)(authorizationUrl, dependencies)},
|
|
104
|
-
accessTokenUrl: ${(0, source_codegen_1.convertSourceToCode)(accesstokenUrl, dependencies)},
|
|
105
|
-
scopes: ${(0, strings_1.sanitizeString)(customIntegration.oauthScopes || '')},
|
|
106
|
-
includeClientIdAndSecrets: ${customIntegration.oauthIncludeClientAuthorizationHeader ?? true},
|
|
107
|
-
usePKCEInCodeExchange: ${customIntegration.usePKCEInCodeExchange ?? false}
|
|
108
|
-
`;
|
|
109
|
-
case core_1.AuthenticationScheme.BASIC:
|
|
110
|
-
const apiBaseUrl = customIntegration.apiBaseUrl || source_codegen_1.EMPTY_TOKENIZED_SOURCE;
|
|
111
|
-
const testEndpointPath = customIntegration.testEndpointPath || source_codegen_1.EMPTY_TOKENIZED_SOURCE;
|
|
112
|
-
return `authenticationType: '${core_1.AuthenticationScheme.BASIC}',
|
|
113
|
-
apiBaseUrl: ${(0, source_codegen_1.convertSourceToCode)(apiBaseUrl, dependencies)},
|
|
114
|
-
testEndpointPath: ${(0, source_codegen_1.convertSourceToCode)(testEndpointPath, dependencies)},
|
|
115
|
-
${authorizationConfigToCode()}
|
|
116
|
-
`;
|
|
117
|
-
default:
|
|
118
|
-
return '';
|
|
119
|
-
}
|
|
120
|
-
})()}};
|
|
121
19
|
export default config;`;
|
|
122
20
|
return sourceCode;
|
|
123
21
|
};
|
|
124
|
-
exports.
|
|
125
|
-
const integrationInputsToCode = (
|
|
22
|
+
exports.integrationConfigToCode = integrationConfigToCode;
|
|
23
|
+
const integrationInputsToCode = (inputs, inputSources) => {
|
|
126
24
|
const sourceCode = `
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
: `import { createInputs } from '@useparagon/types/${integrationName}';`}
|
|
130
|
-
|
|
25
|
+
import { createInputs } from './types';
|
|
26
|
+
|
|
131
27
|
/**
|
|
132
28
|
* define inputs here which can be used across workflows
|
|
133
29
|
*/
|
|
@@ -138,16 +34,18 @@ const integrationInputsToCode = (integrationName, inputs, inputSources) => {
|
|
|
138
34
|
return sourceCode;
|
|
139
35
|
};
|
|
140
36
|
exports.integrationInputsToCode = integrationInputsToCode;
|
|
141
|
-
const typesForIntegration = (
|
|
142
|
-
const {
|
|
143
|
-
const supportedInputTypes =
|
|
144
|
-
const integratonInterfaceName = (0, utils_1.toPascalCase)(`I ${integration}Integration`);
|
|
37
|
+
const typesForIntegration = (integrationDependencies) => {
|
|
38
|
+
const { inputSources } = integrationDependencies;
|
|
39
|
+
const supportedInputTypes = inputs_1.BASIC_INPUT_NAMES.concat(inputSources.map(inputs_1.getInputTypeForUI));
|
|
145
40
|
const sourceCode = `
|
|
146
|
-
|
|
147
|
-
|
|
41
|
+
/**
|
|
42
|
+
* ############### WARNING ######################
|
|
43
|
+
* ##### DO NOT DELETE/RENAME THIS FILE ########
|
|
44
|
+
* ##### DO NOT UPDATE THIS FILE CONTENT ########
|
|
45
|
+
* ############### WARNING ######################
|
|
46
|
+
*/
|
|
148
47
|
|
|
149
|
-
import {
|
|
150
|
-
import { IntentToInputOutput as TriggerIntentToInputOutput } from './triggers';
|
|
48
|
+
import { UserDefinedInput } from '@useparagon/core/inputs';
|
|
151
49
|
|
|
152
50
|
/**
|
|
153
51
|
* supported input names
|
|
@@ -165,8 +63,7 @@ const typesForIntegration = (integration, dependencies) => {
|
|
|
165
63
|
'password' : string;
|
|
166
64
|
'boolean' : boolean;
|
|
167
65
|
'text' : string;
|
|
168
|
-
|
|
169
|
-
${inputs
|
|
66
|
+
${inputSources
|
|
170
67
|
.map((source) => {
|
|
171
68
|
let result = 'string';
|
|
172
69
|
if (source.type === 'COMBO_INPUT_DATA_SOURCE') {
|
|
@@ -188,22 +85,19 @@ const typesForIntegration = (integration, dependencies) => {
|
|
|
188
85
|
return [`'${(0, inputs_1.getInputTypeForUI)(source)}'`, result].join(' : ');
|
|
189
86
|
})
|
|
190
87
|
.join(';')}
|
|
191
|
-
}
|
|
192
|
-
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
193
91
|
/**
|
|
194
92
|
* pass { variableName for input => Input }
|
|
195
93
|
* this should be used whenever we are creating inputs for integrations/workflows
|
|
196
94
|
* as it will infer proper types
|
|
197
95
|
*/
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
export type ${integratonInterfaceName} = IIntegration<
|
|
204
|
-
IntentToInputOutput,
|
|
205
|
-
TriggerIntentToInputOutput
|
|
206
|
-
>;
|
|
96
|
+
export const createInputs = <
|
|
97
|
+
T extends Record<string, UserDefinedInput<InputType>>,
|
|
98
|
+
>(
|
|
99
|
+
inputs: T,
|
|
100
|
+
) => inputs;
|
|
207
101
|
`;
|
|
208
102
|
return sourceCode;
|
|
209
103
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.codegen.js","sourceRoot":"","sources":["../../../src/codegen/codegens/integration.codegen.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"integration.codegen.js","sourceRoot":"","sources":["../../../src/codegen/codegens/integration.codegen.ts"],"names":[],"mappings":";;;AAAA,oDAOiC;AAMjC,6CAAqD;AAM9C,MAAM,uBAAuB,GAAG,CACrC,MAAkC,EAClC,eAAuB,EACf,EAAE;IACV,MAAM,UAAU,GAAW;;;;6BAIA,eAAe;;yCAEH,IAAA,sBAAe,EAAC;QACnD,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW;QACtC,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ;QACpC,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,IAAI,IAAI;KACjD,CAAC;;2BAEqB,CAAC;IAE1B,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAnBW,QAAA,uBAAuB,2BAmBlC;AAQK,MAAM,uBAAuB,GAAG,CACrC,MAAyB,EACzB,YAA2B,EAC3B,EAAE;IACF,MAAM,UAAU,GAAW;;;;;;6CAMgB,IAAA,sBAAe,EACtD,IAAA,sCAA6B,EAC3B,IAAA,mDAA0C,EAAC,MAAM,EAAE,YAAY,CAAC,CACjE,CACF;;;GAGF,CAAC;IAEF,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AApBW,QAAA,uBAAuB,2BAoBlC;AAKK,MAAM,mBAAmB,GAAG,CACjC,uBAAgD,EACxC,EAAE;IACV,MAAM,EAAE,YAAY,EAAE,GAAG,uBAAuB,CAAC;IAEjD,MAAM,mBAAmB,GAAa,0BAAiB,CAAC,MAAM,CAC5D,YAAY,CAAC,GAAG,CAAC,0BAAiB,CAAC,CACpC,CAAC;IAEF,MAAM,UAAU,GAAG;;;;;;;;;;;;;8BAaS,mBAAmB;SAC1C,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,IAAI,SAAS,GAAG,CAAC,CAAC;SACtC,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;QAWV,YAAY;SACX,GAAG,CAAC,CAAC,MAAmB,EAAE,EAAE;QAC3B,IAAI,MAAM,GAAG,QAAQ,CAAC;QACtB,IAAI,MAAM,CAAC,IAAI,KAAK,yBAAyB,EAAE,CAAC;YAC9C,MAAM,GAAG;;eAEN,IAAA,0BAAiB,EAAC,MAAM,CAAC,eAAe,CAAC;eACzC,IAAA,0BAAiB,EAAC,MAAM,CAAC,oBAAoB,CAAC;;WAElD,CAAC;QACF,CAAC;aAAM,IAAI,MAAM,CAAC,IAAI,KAAK,0BAA0B,EAAE,CAAC;YACtD,MAAM,GAAG;;eAEN,IAAA,0BAAiB,EAAC,MAAM,CAAC,YAAY,CAAC;eACtC,IAAA,0BAAiB,EAAC,MAAM,CAAC,WAAW,CAAC;;WAEzC,CAAC;QACF,CAAC;QACD,OAAO,CAAC,IAAI,IAAA,0BAAiB,EAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC;;;;;;;;;;;;;;GAcf,CAAC;IAEF,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAxEW,QAAA,mBAAmB,uBAwE9B"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { DataType, InputConnectCredentialSource, KeyedSource,
|
|
1
|
+
import { DataType, InputConnectCredentialSource, KeyedSource, Source, TokenizedSource } from '@useparagon/core/resolvers';
|
|
2
2
|
import { StepDependencies } from '../codegen.types';
|
|
3
3
|
export declare const EMPTY_TOKENIZED_SOURCE: TokenizedSource<DataType.STRING>;
|
|
4
|
-
export declare const EMPTY_OR_CONDITIONS: OrConditions;
|
|
5
|
-
export declare const sanitizeObjectKey: (key: string) => string;
|
|
6
4
|
export declare const convertInputSourceToCode: (source: InputConnectCredentialSource, dependencies: StepDependencies) => string;
|
|
7
5
|
export declare const convertSourceToCode: (source: Source, dependencies: StepDependencies, isTokenizedPart?: boolean) => string;
|
|
8
6
|
export declare const convertKeyedSourceToCode: (source: KeyedSource, dependencies: StepDependencies) => [string, string];
|