@useparagon/cli 0.0.1-canary.19 → 0.0.1-canary.2
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/codegen/codegen.types.d.ts +0 -17
- package/dist/codegen/codegen.utils.d.ts +4 -4
- package/dist/codegen/codegen.utils.js +38 -47
- package/dist/codegen/codegen.utils.js.map +1 -1
- package/dist/codegen/codegens/condition.codegen.d.ts +1 -2
- package/dist/codegen/codegens/condition.codegen.js +10 -99
- package/dist/codegen/codegens/condition.codegen.js.map +1 -1
- package/dist/codegen/codegens/event.codegen.js +12 -6
- package/dist/codegen/codegens/event.codegen.js.map +1 -1
- package/dist/codegen/codegens/integration.codegen.d.ts +2 -5
- package/dist/codegen/codegens/integration.codegen.js +4 -136
- package/dist/codegen/codegens/integration.codegen.js.map +1 -1
- package/dist/codegen/codegens/source.codegen.d.ts +4 -6
- package/dist/codegen/codegens/source.codegen.js +28 -181
- package/dist/codegen/codegens/source.codegen.js.map +1 -1
- package/dist/codegen/codegens/workflow.codegen.d.ts +2 -2
- package/dist/codegen/codegens/workflow.codegen.js +116 -229
- package/dist/codegen/codegens/workflow.codegen.js.map +1 -1
- package/dist/commands/build/build.action.d.ts +2 -2
- package/dist/commands/build/build.action.js +33 -30
- package/dist/commands/build/build.action.js.map +1 -1
- package/dist/commands/build/build.command.js +7 -9
- package/dist/commands/build/build.command.js.map +1 -1
- package/dist/commands/build/build.utils.d.ts +1 -1
- package/dist/commands/build/build.utils.js +9 -12
- package/dist/commands/build/build.utils.js.map +1 -1
- package/dist/commands/command.loader.js +9 -13
- package/dist/commands/command.loader.js.map +1 -1
- package/dist/commands/index.d.ts +1 -1
- package/dist/commands/index.js +1 -1
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init/init.action.d.ts +2 -2
- package/dist/commands/init/init.action.js +69 -84
- package/dist/commands/init/init.action.js.map +1 -1
- package/dist/commands/init/init.command.js +7 -13
- package/dist/commands/init/init.command.js.map +1 -1
- package/dist/commands/init/init.constants.js +21 -0
- package/dist/commands/init/init.constants.js.map +1 -0
- 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/login/index.js.map +1 -0
- package/dist/commands/{auth/auth.command.d.ts → login/login.command.d.ts} +1 -1
- package/dist/commands/login/login.command.js +26 -0
- package/dist/commands/login/login.command.js.map +1 -0
- package/dist/commands/login/login.types.d.ts +3 -0
- package/dist/commands/login/login.types.js.map +1 -0
- package/dist/commands/login/login.utils.d.ts +2 -0
- package/dist/commands/login/login.utils.js +47 -0
- package/dist/commands/login/login.utils.js.map +1 -0
- package/dist/compilers/compiler.interface.d.ts +3 -0
- package/dist/compilers/compiler.interface.js.map +1 -0
- package/dist/compilers/compiler.types.d.ts +23 -0
- package/dist/compilers/compiler.types.js.map +1 -0
- package/dist/{compiler → compilers}/compiler.utils.js +4 -3
- package/dist/compilers/compiler.utils.js.map +1 -0
- package/dist/compilers/event.compiler.d.ts +7 -0
- package/dist/compilers/event.compiler.js +25 -0
- package/dist/compilers/event.compiler.js.map +1 -0
- package/dist/compilers/integration.compiler.d.ts +9 -0
- package/dist/compilers/integration.compiler.js +55 -0
- package/dist/compilers/integration.compiler.js.map +1 -0
- package/dist/compilers/project.compiler.d.ts +10 -0
- package/dist/compilers/project.compiler.js +50 -0
- package/dist/compilers/project.compiler.js.map +1 -0
- package/dist/{compiler → compilers}/ts.compiler.d.ts +1 -1
- package/dist/{compiler → compilers}/ts.compiler.js +17 -11
- package/dist/compilers/ts.compiler.js.map +1 -0
- package/dist/compilers/workflow.compiler.d.ts +10 -0
- package/dist/compilers/workflow.compiler.js +36 -0
- package/dist/compilers/workflow.compiler.js.map +1 -0
- package/dist/config/config.constants.d.ts +2 -1
- package/dist/config/config.constants.js +6 -4
- package/dist/config/config.constants.js.map +1 -1
- package/dist/config/config.types.d.ts +13 -12
- package/dist/config/config.types.js +3 -3
- package/dist/config/config.types.js.map +1 -1
- package/dist/config/config.utils.d.ts +9 -10
- package/dist/config/config.utils.js +124 -93
- package/dist/config/config.utils.js.map +1 -1
- package/dist/config/index.d.ts +0 -1
- package/dist/config/index.js +0 -1
- package/dist/config/index.js.map +1 -1
- package/dist/{templates/configurations → configurations}/javascript/.prettierrc +0 -4
- package/dist/{templates/configurations → configurations}/typescript/.prettierrc +0 -4
- package/dist/helpers/strings.d.ts +0 -2
- package/dist/helpers/strings.js +1 -35
- 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 +3 -44
- package/dist/logger/logger.js.map +1 -1
- package/dist/logger/logger.type.d.ts +1 -3
- package/dist/{templates/typescript → typescript}/src/events/hello-world.ts +2 -2
- package/dist/typescript/src/integrations/slack/config.ts +18 -0
- package/dist/typescript/src/integrations/slack/workflows/example-workflow.ts +30 -0
- package/package.json +19 -25
- package/dist/apis/api.types.d.ts +0 -70
- package/dist/apis/api.types.js +0 -3
- package/dist/apis/api.types.js.map +0 -1
- package/dist/apis/auth.api.d.ts +0 -5
- package/dist/apis/auth.api.js +0 -14
- package/dist/apis/auth.api.js.map +0 -1
- package/dist/apis/base.api.d.ts +0 -10
- package/dist/apis/base.api.js +0 -90
- package/dist/apis/base.api.js.map +0 -1
- package/dist/apis/index.d.ts +0 -4
- package/dist/apis/index.js +0 -8
- package/dist/apis/index.js.map +0 -1
- package/dist/apis/integration.api.d.ts +0 -3
- package/dist/apis/integration.api.js +0 -25
- package/dist/apis/integration.api.js.map +0 -1
- package/dist/apis/project.api.d.ts +0 -7
- package/dist/apis/project.api.js +0 -41
- package/dist/apis/project.api.js.map +0 -1
- package/dist/codegen/codegens/persona.codegen.d.ts +0 -2
- package/dist/codegen/codegens/persona.codegen.js +0 -12
- package/dist/codegen/codegens/persona.codegen.js.map +0 -1
- package/dist/commands/auth/auth.command.js +0 -18
- package/dist/commands/auth/auth.command.js.map +0 -1
- package/dist/commands/auth/index.d.ts +0 -1
- package/dist/commands/auth/index.js +0 -5
- package/dist/commands/auth/index.js.map +0 -1
- package/dist/commands/auth/login/index.js.map +0 -1
- package/dist/commands/auth/login/login.action.d.ts +0 -5
- package/dist/commands/auth/login/login.action.js +0 -42
- package/dist/commands/auth/login/login.action.js.map +0 -1
- package/dist/commands/auth/login/login.command.d.ts +0 -8
- package/dist/commands/auth/login/login.command.js +0 -25
- package/dist/commands/auth/login/login.command.js.map +0 -1
- package/dist/commands/auth/login/login.types.d.ts +0 -9
- package/dist/commands/auth/login/login.types.js.map +0 -1
- package/dist/commands/auth/login/login.utils.d.ts +0 -2
- package/dist/commands/auth/login/login.utils.js +0 -88
- package/dist/commands/auth/login/login.utils.js.map +0 -1
- package/dist/commands/auth/logout/index.d.ts +0 -1
- package/dist/commands/auth/logout/index.js +0 -5
- package/dist/commands/auth/logout/index.js.map +0 -1
- package/dist/commands/auth/logout/logout.action.d.ts +0 -5
- package/dist/commands/auth/logout/logout.action.js +0 -14
- package/dist/commands/auth/logout/logout.action.js.map +0 -1
- package/dist/commands/auth/logout/logout.command.d.ts +0 -8
- package/dist/commands/auth/logout/logout.command.js +0 -24
- package/dist/commands/auth/logout/logout.command.js.map +0 -1
- package/dist/commands/auth/logout/logout.types.d.ts +0 -1
- package/dist/commands/auth/logout/logout.types.js +0 -3
- package/dist/commands/auth/logout/logout.types.js.map +0 -1
- package/dist/commands/auth/me/index.d.ts +0 -1
- package/dist/commands/auth/me/index.js +0 -5
- package/dist/commands/auth/me/index.js.map +0 -1
- package/dist/commands/auth/me/me.action.d.ts +0 -5
- package/dist/commands/auth/me/me.action.js +0 -26
- package/dist/commands/auth/me/me.action.js.map +0 -1
- package/dist/commands/auth/me/me.command.d.ts +0 -8
- package/dist/commands/auth/me/me.command.js +0 -24
- package/dist/commands/auth/me/me.command.js.map +0 -1
- package/dist/commands/auth/me/me.types.d.ts +0 -1
- package/dist/commands/auth/me/me.types.js +0 -3
- package/dist/commands/auth/me/me.types.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 -10
- 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 -28
- package/dist/commands/install/install.command.js.map +0 -1
- package/dist/commands/install/install.constants.js +0 -71
- 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 -7
- package/dist/commands/install/install.utils.js +0 -63
- 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 -50
- 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 -91
- 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 -29
- 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/commands/push/index.d.ts +0 -1
- package/dist/commands/push/index.js +0 -5
- package/dist/commands/push/index.js.map +0 -1
- package/dist/commands/push/push.action.d.ts +0 -5
- package/dist/commands/push/push.action.js +0 -22
- package/dist/commands/push/push.action.js.map +0 -1
- package/dist/commands/push/push.command.d.ts +0 -8
- package/dist/commands/push/push.command.js +0 -26
- package/dist/commands/push/push.command.js.map +0 -1
- package/dist/commands/push/push.types.d.ts +0 -1
- package/dist/commands/push/push.types.js +0 -3
- package/dist/commands/push/push.types.js.map +0 -1
- package/dist/compiler/compiler.interface.d.ts +0 -3
- package/dist/compiler/compiler.interface.js.map +0 -1
- package/dist/compiler/compiler.types.d.ts +0 -12
- package/dist/compiler/compiler.types.js.map +0 -1
- package/dist/compiler/compiler.utils.js.map +0 -1
- package/dist/compiler/compilers/events.compiler.d.ts +0 -10
- package/dist/compiler/compilers/events.compiler.js +0 -39
- package/dist/compiler/compilers/events.compiler.js.map +0 -1
- package/dist/compiler/compilers/integrations.compiler.d.ts +0 -17
- package/dist/compiler/compilers/integrations.compiler.js +0 -78
- package/dist/compiler/compilers/integrations.compiler.js.map +0 -1
- package/dist/compiler/compilers/persona.compiler.d.ts +0 -9
- package/dist/compiler/compilers/persona.compiler.js +0 -15
- package/dist/compiler/compilers/persona.compiler.js.map +0 -1
- package/dist/compiler/compilers/project.compiler.d.ts +0 -14
- package/dist/compiler/compilers/project.compiler.js +0 -43
- package/dist/compiler/compilers/project.compiler.js.map +0 -1
- package/dist/compiler/compilers/workflows.compiler.d.ts +0 -24
- package/dist/compiler/compilers/workflows.compiler.js +0 -63
- package/dist/compiler/compilers/workflows.compiler.js.map +0 -1
- package/dist/compiler/ts.compiler.js.map +0 -1
- package/dist/helpers/file.d.ts +0 -2
- package/dist/helpers/file.js +0 -36
- package/dist/helpers/file.js.map +0 -1
- package/dist/helpers/http.d.ts +0 -1
- package/dist/helpers/http.js +0 -11
- package/dist/helpers/http.js.map +0 -1
- package/dist/templates/configurations/typescript/tsconfig.json +0 -33
- package/dist/templates/typescript/src/integrations/slack/config.ts +0 -13
- package/dist/templates/typescript/src/integrations/slack/inputs.ts +0 -23
- package/dist/templates/typescript/src/integrations/slack/types.ts +0 -57
- package/dist/templates/typescript/src/integrations/slack/workflows/workflow1.ts +0 -120
- package/dist/templates/typescript/src/persona.meta.ts +0 -1
- /package/dist/commands/{install/install.constants.d.ts → init/init.constants.d.ts} +0 -0
- /package/dist/commands/{auth/login → login}/index.d.ts +0 -0
- /package/dist/commands/{auth/login → login}/index.js +0 -0
- /package/dist/commands/{auth/login → login}/login.types.js +0 -0
- /package/dist/{compiler → compilers}/compiler.interface.js +0 -0
- /package/dist/{compiler → compilers}/compiler.types.js +0 -0
- /package/dist/{compiler → compilers}/compiler.utils.d.ts +0 -0
- /package/dist/{templates/configurations → configurations}/javascript/.prettierignore +0 -0
- /package/dist/{templates/configurations → configurations}/typescript/.prettierignore +0 -0
- /package/dist/{templates/javascript → javascript}/src/events/hello-world.js +0 -0
- /package/dist/{templates/javascript → javascript}/src/integrations/slack/config.js +0 -0
- /package/dist/{templates/javascript → javascript}/src/integrations/slack/workflows/example-workflow.js +0 -0
- /package/dist/{templates/typescript → typescript}/tsconfig.json +0 -0
|
@@ -1,26 +1,9 @@
|
|
|
1
|
-
import { IStep } from '@useparagon/core';
|
|
2
1
|
import { IEvent } from '@useparagon/core/event';
|
|
3
|
-
import { InputSource, SerializedInput } from '@useparagon/core/inputs';
|
|
4
|
-
import { ISecret } from '@useparagon/core/secret';
|
|
5
|
-
import { IntegrationWorkflowMeta } from '../apis/api.types';
|
|
6
2
|
export type ProjectDependencies = {
|
|
7
3
|
events: Record<string, IEvent>;
|
|
8
|
-
secrets: ISecret[];
|
|
9
4
|
};
|
|
10
5
|
export type WorkflowDependencies = ProjectDependencies & {
|
|
11
6
|
integration: {
|
|
12
7
|
name: string;
|
|
13
8
|
};
|
|
14
|
-
workflowMeta: IntegrationWorkflowMeta;
|
|
15
|
-
sharedInputs: SerializedInput[];
|
|
16
|
-
inputSources: InputSource[];
|
|
17
|
-
};
|
|
18
|
-
export type StepDependencies = {
|
|
19
|
-
sharedInputs: SerializedInput[];
|
|
20
|
-
inputs: SerializedInput[];
|
|
21
|
-
inputSources: InputSource[];
|
|
22
|
-
stepIdToVariableMap: Record<string, string>;
|
|
23
|
-
events: Record<string, IEvent>;
|
|
24
|
-
stepIdToStepMap: Record<string, IStep>;
|
|
25
|
-
secrets: ISecret[];
|
|
26
9
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const generateIntegrationFiles: (integrationName: string, integrationOutput:
|
|
4
|
-
export declare const generateProjectFiles: (projectBuild:
|
|
1
|
+
import { BuildOutput, IntegrationOutput, ProjectDependencies } from '../compilers/compiler.types';
|
|
2
|
+
export declare const wrapMultilineString: (value: string) => string;
|
|
3
|
+
export declare const generateIntegrationFiles: (integrationName: string, integrationOutput: IntegrationOutput, projectDependencies: ProjectDependencies, projectRoot: string) => Promise<void>;
|
|
4
|
+
export declare const generateProjectFiles: (projectBuild: BuildOutput, projectRoot: string) => Promise<void>;
|
|
@@ -1,79 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateProjectFiles = exports.generateIntegrationFiles = void 0;
|
|
3
|
+
exports.generateProjectFiles = exports.generateIntegrationFiles = exports.wrapMultilineString = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const importSortOrderPlugin = tslib_1.__importStar(require("@trivago/prettier-plugin-sort-imports"));
|
|
5
6
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
7
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
const
|
|
8
|
-
const
|
|
8
|
+
const prettier_1 = tslib_1.__importDefault(require("prettier"));
|
|
9
|
+
const organiseImportPlugin = tslib_1.__importStar(require("prettier-plugin-organize-imports"));
|
|
9
10
|
const event_codegen_1 = require("./codegens/event.codegen");
|
|
10
11
|
const integration_codegen_1 = require("./codegens/integration.codegen");
|
|
11
|
-
const persona_codegen_1 = require("./codegens/persona.codegen");
|
|
12
12
|
const workflow_codegen_1 = require("./codegens/workflow.codegen");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
13
|
+
const writeSourceToFile = (filePath, fileName, sourceCode) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
const sanitizeFileName = fileName;
|
|
15
|
+
const formattedCode = prettier_1.default.format(sourceCode, {
|
|
16
|
+
parser: 'typescript',
|
|
17
|
+
semi: true,
|
|
18
|
+
trailingComma: 'all',
|
|
19
|
+
singleQuote: true,
|
|
20
|
+
plugins: [organiseImportPlugin, importSortOrderPlugin],
|
|
21
|
+
importOrder: ['^@useparagon/(.*)$', '^[./]'],
|
|
22
|
+
importOrderSeparation: true,
|
|
23
|
+
importOrderCaseInsensitive: true,
|
|
24
|
+
});
|
|
25
|
+
yield fs_extra_1.default.promises.writeFile(path_1.default.join(filePath, `${sanitizeFileName}.ts`), formattedCode);
|
|
26
|
+
});
|
|
27
|
+
const wrapMultilineString = (value) => {
|
|
28
|
+
return '`' + value + '`';
|
|
29
|
+
};
|
|
30
|
+
exports.wrapMultilineString = wrapMultilineString;
|
|
31
|
+
const generateIntegrationFiles = (integrationName, integrationOutput, projectDependencies, projectRoot) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
15
32
|
const integrationPath = path_1.default.join(projectRoot, 'integrations', integrationName);
|
|
16
|
-
|
|
33
|
+
yield fs_extra_1.default.promises.mkdir(integrationPath, {
|
|
17
34
|
recursive: true,
|
|
18
35
|
});
|
|
19
|
-
const sharedInputs = integrationOutput.config.values.sharedMeta?.inputs ?? [];
|
|
20
36
|
const configCode = (0, integration_codegen_1.integrationConfigToCode)(integrationOutput.config, integrationName);
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
if (integrationOutput.dependencies) {
|
|
24
|
-
const integrationTypesCode = (0, integration_codegen_1.typesForIntegration)(integrationName, integrationOutput.dependencies);
|
|
25
|
-
await (0, file_1.writeSourceToFile)(integrationPath, 'types', integrationTypesCode);
|
|
26
|
-
}
|
|
27
|
-
await Promise.all([
|
|
28
|
-
(0, file_1.writeSourceToFile)(integrationPath, 'config', configCode),
|
|
29
|
-
(0, file_1.writeSourceToFile)(integrationPath, 'inputs', inputsSouceCode),
|
|
30
|
-
]);
|
|
31
|
-
const workflowMetas = integrationOutput.config.values.workflowMeta ?? {};
|
|
32
|
-
const workflows = Object.values(integrationOutput.workflows);
|
|
37
|
+
yield writeSourceToFile(integrationPath, 'config', configCode);
|
|
38
|
+
const workflowOutputs = Object.values(integrationOutput.workflows);
|
|
33
39
|
const workflowPath = path_1.default.join(integrationPath, 'workflows');
|
|
34
|
-
if (
|
|
35
|
-
|
|
40
|
+
if (workflowOutputs.length) {
|
|
41
|
+
fs_extra_1.default.promises.mkdir(workflowPath, {
|
|
36
42
|
recursive: true,
|
|
37
43
|
});
|
|
38
44
|
}
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
secrets,
|
|
43
|
-
events,
|
|
44
|
-
integration: { name: integrationName },
|
|
45
|
-
sharedInputs,
|
|
46
|
-
inputSources,
|
|
47
|
-
workflowMeta: workflowMetas[workflow.id] || {
|
|
48
|
-
id: workflow.id,
|
|
49
|
-
inputs: [],
|
|
50
|
-
},
|
|
51
|
-
});
|
|
52
|
-
await (0, file_1.writeSourceToFile)(workflowPath, generateUniqueNames(workflow.name), workflowCode);
|
|
45
|
+
for (const workflowOutput of workflowOutputs) {
|
|
46
|
+
const workflowCode = (0, workflow_codegen_1.workflowToCode)(workflowOutput, Object.assign(Object.assign({}, projectDependencies), { integration: { name: integrationName } }));
|
|
47
|
+
yield writeSourceToFile(workflowPath, workflowOutput.name, workflowCode);
|
|
53
48
|
}
|
|
54
|
-
};
|
|
49
|
+
});
|
|
55
50
|
exports.generateIntegrationFiles = generateIntegrationFiles;
|
|
56
|
-
const generateProjectFiles =
|
|
51
|
+
const generateProjectFiles = (projectBuild, projectRoot) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
+
yield fs_extra_1.default.promises.mkdir(projectRoot, { recursive: true });
|
|
57
53
|
const events = Object.values(projectBuild.events);
|
|
58
54
|
const eventPath = path_1.default.join(projectRoot, 'events');
|
|
59
55
|
if (events.length) {
|
|
60
|
-
|
|
56
|
+
yield fs_extra_1.default.promises.mkdir(eventPath, {
|
|
61
57
|
recursive: true,
|
|
62
58
|
});
|
|
63
59
|
}
|
|
64
60
|
for (const event of events) {
|
|
65
61
|
const eventSourceCode = (0, event_codegen_1.eventToCode)(event);
|
|
66
|
-
|
|
62
|
+
yield writeSourceToFile(eventPath, event.name, eventSourceCode);
|
|
67
63
|
}
|
|
68
|
-
await (0, file_1.writeSourceToFile)(projectRoot, 'persona.meta', (0, persona_codegen_1.personaToCode)(projectBuild.persona));
|
|
69
64
|
const integrationOutputs = Object.entries(projectBuild.integrations);
|
|
70
65
|
for (const [integrationName, integrationOutput] of integrationOutputs) {
|
|
71
|
-
|
|
72
|
-
events: projectBuild.events,
|
|
73
|
-
projectId: projectBuild.projectId,
|
|
74
|
-
secrets: projectBuild.secrets,
|
|
75
|
-
}, projectRoot);
|
|
66
|
+
yield (0, exports.generateIntegrationFiles)(integrationName, integrationOutput, { events: projectBuild.events }, projectRoot);
|
|
76
67
|
}
|
|
77
|
-
};
|
|
68
|
+
});
|
|
78
69
|
exports.generateProjectFiles = generateProjectFiles;
|
|
79
70
|
//# 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":"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"}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { OperatorCondition } from '@useparagon/core/resolvers';
|
|
2
|
-
|
|
3
|
-
export declare const conditionToCode: (operatorCondition: OperatorCondition, dependencies: StepDependencies) => string;
|
|
2
|
+
export declare const conditionToCode: (operatorCondition: OperatorCondition, stepIdToVariableMap: Record<string, string>) => string;
|
|
@@ -3,110 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.conditionToCode = void 0;
|
|
4
4
|
const resolvers_1 = require("@useparagon/core/resolvers");
|
|
5
5
|
const source_codegen_1 = require("./source.codegen");
|
|
6
|
-
const conditionToCode = (operatorCondition,
|
|
6
|
+
const conditionToCode = (operatorCondition, stepIdToVariableMap) => {
|
|
7
7
|
let code = '';
|
|
8
8
|
const condition = operatorCondition.condition;
|
|
9
|
-
const getOperatorParams = (argumentNeeded = false) => {
|
|
10
|
-
let parameters = (0, source_codegen_1.convertSourceToCode)(condition.variable, dependencies);
|
|
11
|
-
if (argumentNeeded && 'argument' in condition) {
|
|
12
|
-
parameters = `${parameters},${(0, source_codegen_1.convertSourceToCode)(condition.argument, dependencies)}`;
|
|
13
|
-
}
|
|
14
|
-
return parameters;
|
|
15
|
-
};
|
|
16
9
|
switch (condition.operator) {
|
|
17
|
-
case resolvers_1.Operator.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
case resolvers_1.Operator.ArrayIsIn:
|
|
21
|
-
code = `Operators.ArrayIsIn(${getOperatorParams(true)})`;
|
|
22
|
-
break;
|
|
23
|
-
case resolvers_1.Operator.ArrayIsNotEmpty:
|
|
24
|
-
code = `Operators.ArrayIsNotEmpty(${getOperatorParams()})`;
|
|
25
|
-
break;
|
|
26
|
-
case resolvers_1.Operator.ArrayIsNotIn:
|
|
27
|
-
code = `Operators.ArrayIsNotIn(${getOperatorParams(true)})`;
|
|
28
|
-
break;
|
|
29
|
-
case resolvers_1.Operator.BooleanFalse:
|
|
30
|
-
code = `Operators.BooleanFalse(${getOperatorParams()})`;
|
|
31
|
-
break;
|
|
32
|
-
case resolvers_1.Operator.BooleanTrue:
|
|
33
|
-
code = `Operators.BooleanTrue(${getOperatorParams()})`;
|
|
34
|
-
break;
|
|
35
|
-
case resolvers_1.Operator.DateTimeAfter:
|
|
36
|
-
code = `Operators.DateTimeAfter(${getOperatorParams(true)})`;
|
|
37
|
-
break;
|
|
38
|
-
case resolvers_1.Operator.DateTimeBefore:
|
|
39
|
-
code = `Operators.DateTimeBefore(${getOperatorParams(true)})`;
|
|
40
|
-
break;
|
|
41
|
-
case resolvers_1.Operator.DateTimeEquals:
|
|
42
|
-
code = `Operators.DateTimeEquals(${getOperatorParams(true)})`;
|
|
43
|
-
break;
|
|
44
|
-
case resolvers_1.Operator.DoesNotExist:
|
|
45
|
-
code = `Operators.DoesNotExist(${getOperatorParams()})`;
|
|
46
|
-
break;
|
|
47
|
-
case resolvers_1.Operator.Exists:
|
|
48
|
-
code = `Operators.Exists(${getOperatorParams()})`;
|
|
49
|
-
break;
|
|
50
|
-
case resolvers_1.Operator.IsNotNull:
|
|
51
|
-
code = `Operators.IsNotNull(${getOperatorParams()})`;
|
|
52
|
-
break;
|
|
53
|
-
case resolvers_1.Operator.IsNull:
|
|
54
|
-
code = `Operators.IsNull(${getOperatorParams()})`;
|
|
55
|
-
break;
|
|
56
|
-
case resolvers_1.Operator.NumberDoesNotEqual:
|
|
57
|
-
code = `Operators.NumberDoesNotEqual(${getOperatorParams(true)})`;
|
|
58
|
-
break;
|
|
59
|
-
case resolvers_1.Operator.NumberEquals:
|
|
60
|
-
code = `Operators.NumberEquals(${getOperatorParams(true)})`;
|
|
61
|
-
break;
|
|
62
|
-
case resolvers_1.Operator.NumberGreaterThan:
|
|
63
|
-
code = `Operators.NumberGreaterThan(${getOperatorParams(true)})`;
|
|
10
|
+
case resolvers_1.Operator.BooleanTrue: {
|
|
11
|
+
const variable = (0, source_codegen_1.convertSourceToCode)(condition.variable, stepIdToVariableMap);
|
|
12
|
+
code = `Operators.BooleanTrue(${variable})`;
|
|
64
13
|
break;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
code = `Operators.
|
|
70
|
-
break;
|
|
71
|
-
case resolvers_1.Operator.NumberLessThanOrEqualTo:
|
|
72
|
-
code = `Operators.NumberLessThanOrEqualTo(${getOperatorParams(true)})`;
|
|
73
|
-
break;
|
|
74
|
-
case resolvers_1.Operator.StringContains:
|
|
75
|
-
code = `Operators.StringContains(${getOperatorParams(true)})`;
|
|
76
|
-
break;
|
|
77
|
-
case resolvers_1.Operator.StringDoesNotContain:
|
|
78
|
-
code = `Operators.StringDoesNotContain(${getOperatorParams(true)})`;
|
|
79
|
-
break;
|
|
80
|
-
case resolvers_1.Operator.StringDoesNotEndWith:
|
|
81
|
-
code = `Operators.StringDoesNotEndWith(${getOperatorParams(true)})`;
|
|
82
|
-
break;
|
|
83
|
-
case resolvers_1.Operator.StringDoesNotExactlyMatch:
|
|
84
|
-
code = `Operators.StringDoesNotExactlyMatch(${getOperatorParams(true)})`;
|
|
85
|
-
break;
|
|
86
|
-
case resolvers_1.Operator.StringDoesNotStartWith:
|
|
87
|
-
code = `Operators.StringDoesNotStartWith(${getOperatorParams(true)})`;
|
|
88
|
-
break;
|
|
89
|
-
case resolvers_1.Operator.StringEndsWith:
|
|
90
|
-
code = `Operators.StringEndsWith(${getOperatorParams(true)})`;
|
|
91
|
-
break;
|
|
92
|
-
case resolvers_1.Operator.StringExactlyMatches:
|
|
93
|
-
code = `Operators.StringExactlyMatches(${getOperatorParams(true)})`;
|
|
94
|
-
break;
|
|
95
|
-
case resolvers_1.Operator.StringGreaterThan:
|
|
96
|
-
code = `Operators.StringContains(${getOperatorParams(true)})`;
|
|
97
|
-
break;
|
|
98
|
-
case resolvers_1.Operator.StringIsIn:
|
|
99
|
-
code = `Operators.StringIsIn(${getOperatorParams(true)})`;
|
|
100
|
-
break;
|
|
101
|
-
case resolvers_1.Operator.StringIsNotIn:
|
|
102
|
-
code = `Operators.StringIsNotIn(${getOperatorParams(true)})`;
|
|
103
|
-
break;
|
|
104
|
-
case resolvers_1.Operator.StringLessThan:
|
|
105
|
-
code = `Operators.StringLessThan(${getOperatorParams(true)})`;
|
|
106
|
-
break;
|
|
107
|
-
case resolvers_1.Operator.StringStartsWith:
|
|
108
|
-
code = `Operators.StringStartsWith(${getOperatorParams(true)})`;
|
|
14
|
+
}
|
|
15
|
+
case resolvers_1.Operator.StringContains: {
|
|
16
|
+
const variable = (0, source_codegen_1.convertSourceToCode)(condition.variable, stepIdToVariableMap);
|
|
17
|
+
const argument = (0, source_codegen_1.convertSourceToCode)(condition.argument, stepIdToVariableMap);
|
|
18
|
+
code = `Operators.StringContains(${variable},${argument})`;
|
|
109
19
|
break;
|
|
20
|
+
}
|
|
110
21
|
default:
|
|
111
22
|
code = 'undefined';
|
|
112
23
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition.codegen.js","sourceRoot":"","sources":["../../../src/codegen/codegens/condition.codegen.ts"],"names":[],"mappings":";;;AAAA,0DAIoC;
|
|
1
|
+
{"version":3,"file":"condition.codegen.js","sourceRoot":"","sources":["../../../src/codegen/codegens/condition.codegen.ts"],"names":[],"mappings":";;;AAAA,0DAIoC;AAEpC,qDAAuD;AAOhD,MAAM,eAAe,GAAG,CAC7B,iBAAoC,EACpC,mBAA2C,EACnC,EAAE;IACV,IAAI,IAAI,GAAW,EAAE,CAAC;IAEtB,MAAM,SAAS,GAAc,iBAAiB,CAAC,SAAS,CAAC;IAEzD,QAAQ,SAAS,CAAC,QAAQ,EAAE;QAC1B,KAAK,oBAAQ,CAAC,WAAW,CAAC,CAAC;YACzB,MAAM,QAAQ,GAAW,IAAA,oCAAmB,EAC1C,SAAS,CAAC,QAAQ,EAClB,mBAAmB,CACpB,CAAC;YACF,IAAI,GAAG,yBAAyB,QAAQ,GAAG,CAAC;YAC5C,MAAM;SACP;QAED,KAAK,oBAAQ,CAAC,cAAc,CAAC,CAAC;YAC5B,MAAM,QAAQ,GAAW,IAAA,oCAAmB,EAC1C,SAAS,CAAC,QAAQ,EAClB,mBAAmB,CACpB,CAAC;YACF,MAAM,QAAQ,GAAW,IAAA,oCAAmB,EAC1C,SAAS,CAAC,QAAQ,EAClB,mBAAmB,CACpB,CAAC;YACF,IAAI,GAAG,4BAA4B,QAAQ,IAAI,QAAQ,GAAG,CAAC;YAC3D,MAAM;SACP;QACD;YACE,IAAI,GAAG,WAAW,CAAC;YACnB,MAAM;KACT;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAnCW,QAAA,eAAe,mBAmC1B"}
|
|
@@ -2,23 +2,29 @@
|
|
|
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
|
-
import {
|
|
7
|
+
import { IEvent } from '@useparagon/core/event';
|
|
9
8
|
|
|
10
|
-
export type EventSchema =
|
|
9
|
+
export type EventSchema = {
|
|
10
|
+
|
|
11
|
+
};
|
|
11
12
|
|
|
12
|
-
const event:
|
|
13
|
+
const event: IEvent<EventSchema> = {
|
|
14
|
+
/**
|
|
15
|
+
* This property is maintained by Paragon. Do not edit this property.
|
|
16
|
+
*/
|
|
17
|
+
id: '${event.id}',
|
|
18
|
+
|
|
13
19
|
/**
|
|
14
20
|
* name of event
|
|
15
21
|
*/
|
|
16
|
-
name : ${
|
|
22
|
+
name : '${event.name}',
|
|
17
23
|
|
|
18
24
|
/**
|
|
19
25
|
* schema of event payload
|
|
20
26
|
*/
|
|
21
|
-
schema
|
|
27
|
+
schema:${(0, json_1.stringifyObject)(event.schema)}
|
|
22
28
|
}
|
|
23
29
|
|
|
24
30
|
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;;;;;;;;;;;UAWnB,KAAK,CAAC,EAAE;;;;;aAKL,KAAK,CAAC,IAAI;;;;;YAKX,IAAA,sBAAe,EAAC,KAAK,CAAC,MAAM,CAAC;;;;EAIvC,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AA7BW,QAAA,WAAW,eA6BtB"}
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const integrationConfigToCode: (config: IntegrationBuild['config'], integrationName: string) => string;
|
|
4
|
-
export declare const integrationInputsToCode: (integrationName: string, inputs: SerializedInput[], inputSources: InputSource[]) => string;
|
|
5
|
-
export declare const typesForIntegration: (integration: string, dependencies: IntegrationDependencies) => string;
|
|
1
|
+
import { IntegrationOutput } from '../../compilers/compiler.types';
|
|
2
|
+
export declare const integrationConfigToCode: (config: IntegrationOutput['config'], integrationName: string) => string;
|
|
@@ -1,150 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const inputs_1 = require("@useparagon/core/inputs");
|
|
5
|
-
const utils_1 = require("@useparagon/core/utils");
|
|
3
|
+
exports.integrationConfigToCode = void 0;
|
|
6
4
|
const json_1 = require("../../helpers/json");
|
|
7
5
|
const integrationConfigToCode = (config, integrationName) => {
|
|
8
6
|
const sourceCode = `
|
|
9
|
-
import { IIntegrationConfig } from '@useparagon/core
|
|
10
|
-
|
|
7
|
+
import { IIntegrationConfig } from '@useparagon/core';
|
|
8
|
+
|
|
11
9
|
/**
|
|
12
10
|
* configuration for a ${integrationName}
|
|
13
11
|
*/
|
|
14
|
-
const config: IIntegrationConfig = ${(0, json_1.stringifyObject)({
|
|
15
|
-
description: config.values.description ||
|
|
16
|
-
`A description for the integration's purpose.`,
|
|
17
|
-
overviewText: config.values.overview ||
|
|
18
|
-
`A long-form description for the integration's purpose.`,
|
|
19
|
-
showWatermark: config.values.paragonLink || true,
|
|
20
|
-
})}
|
|
12
|
+
const config: IIntegrationConfig = ${(0, json_1.stringifyObject)(config || {})}
|
|
21
13
|
|
|
22
14
|
export default config;`;
|
|
23
15
|
return sourceCode;
|
|
24
16
|
};
|
|
25
17
|
exports.integrationConfigToCode = integrationConfigToCode;
|
|
26
|
-
const integrationInputsToCode = (integrationName, inputs, inputSources) => {
|
|
27
|
-
const sourceCode = `
|
|
28
|
-
${integrationName.startsWith('custom')
|
|
29
|
-
? "import { createInputs } from '@useparagon/core/inputs';"
|
|
30
|
-
: "import { createInputs } from './types';"}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* define inputs here which can be used across workflows
|
|
34
|
-
*/
|
|
35
|
-
const integrationInputs = createInputs(${(0, json_1.stringifyObject)((0, inputs_1.mapUserDefinedInputsWithTitle)((0, inputs_1.convertSerializedInputsToUserDefinedInputs)(inputs, inputSources)))});
|
|
36
|
-
|
|
37
|
-
export default integrationInputs;
|
|
38
|
-
`;
|
|
39
|
-
return sourceCode;
|
|
40
|
-
};
|
|
41
|
-
exports.integrationInputsToCode = integrationInputsToCode;
|
|
42
|
-
const typesForIntegration = (integration, dependencies) => {
|
|
43
|
-
const { inputs, intents, triggers } = dependencies;
|
|
44
|
-
const supportedInputTypes = inputs_1.BASIC_INPUT_NAMES.concat(inputs.map(inputs_1.getInputTypeForUI));
|
|
45
|
-
const integratonInterfaceName = (0, utils_1.toPascalCase)(`I ${integration}Integration`);
|
|
46
|
-
const sourceCode = `
|
|
47
|
-
/**
|
|
48
|
-
* ############### WARNING ######################
|
|
49
|
-
* ##### DO NOT DELETE/RENAME THIS FILE ########
|
|
50
|
-
* ##### DO NOT UPDATE THIS FILE CONTENT ########
|
|
51
|
-
* ############### WARNING ######################
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
import { IIntegration } from '@useparagon/core';
|
|
55
|
-
import { UserDefinedInput } from '@useparagon/core/inputs';
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* supported input names
|
|
59
|
-
*/
|
|
60
|
-
export type InputType = ${supportedInputTypes
|
|
61
|
-
.map((inputType) => [`'${inputType}'`])
|
|
62
|
-
.join(' | ')};
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* map b/w input type to result
|
|
66
|
-
*/
|
|
67
|
-
export type InputResultMap = {
|
|
68
|
-
'email' : string;
|
|
69
|
-
'url' : string;
|
|
70
|
-
'password' : string;
|
|
71
|
-
'boolean' : boolean;
|
|
72
|
-
'text' : string;
|
|
73
|
-
'number' : number;
|
|
74
|
-
${inputs
|
|
75
|
-
.map((source) => {
|
|
76
|
-
let result = 'string';
|
|
77
|
-
if (source.type === 'COMBO_INPUT_DATA_SOURCE') {
|
|
78
|
-
result = `
|
|
79
|
-
{
|
|
80
|
-
'${(0, inputs_1.getInputTypeForUI)(source.mainInputSource)}' : string;
|
|
81
|
-
'${(0, inputs_1.getInputTypeForUI)(source.dependentInputSource)}' : string;
|
|
82
|
-
}
|
|
83
|
-
`;
|
|
84
|
-
}
|
|
85
|
-
else if (source.type === 'FIELD_MAPPER_DATA_SOURCE') {
|
|
86
|
-
result = `
|
|
87
|
-
{
|
|
88
|
-
'${(0, inputs_1.getInputTypeForUI)(source.recordSource)}' : string;
|
|
89
|
-
'${(0, inputs_1.getInputTypeForUI)(source.fieldSource)}' : string;
|
|
90
|
-
}
|
|
91
|
-
`;
|
|
92
|
-
}
|
|
93
|
-
return [`'${(0, inputs_1.getInputTypeForUI)(source)}'`, result].join(' : ');
|
|
94
|
-
})
|
|
95
|
-
.join(';')}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* pass { variableName for input => Input }
|
|
100
|
-
* this should be used whenever we are creating inputs for integrations/workflows
|
|
101
|
-
* as it will infer proper types
|
|
102
|
-
*/
|
|
103
|
-
export const createInputs = <
|
|
104
|
-
T extends Record<string, UserDefinedInput<InputType>>,
|
|
105
|
-
>(
|
|
106
|
-
inputs: T,
|
|
107
|
-
) => inputs;
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* map bw intent to [input , output]
|
|
111
|
-
*/
|
|
112
|
-
export type IntentToInputOutput = {
|
|
113
|
-
|
|
114
|
-
${intents
|
|
115
|
-
.map((intent) => `
|
|
116
|
-
/**
|
|
117
|
-
* ${intent.title}
|
|
118
|
-
*/
|
|
119
|
-
${intent.name}:[any, any]
|
|
120
|
-
`)
|
|
121
|
-
.join(';')}
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* map bw trigger intent to [input , output]
|
|
127
|
-
*/
|
|
128
|
-
export type TriggerIntentToInputOutput = {
|
|
129
|
-
${triggers
|
|
130
|
-
.map((intent) => `
|
|
131
|
-
/**
|
|
132
|
-
* ${intent.title}
|
|
133
|
-
*/
|
|
134
|
-
${intent.name}:[any, any]
|
|
135
|
-
`)
|
|
136
|
-
.join(';')}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* integration type for ${integration}
|
|
141
|
-
*/
|
|
142
|
-
export type ${integratonInterfaceName} = IIntegration<
|
|
143
|
-
IntentToInputOutput,
|
|
144
|
-
TriggerIntentToInputOutput
|
|
145
|
-
>;
|
|
146
|
-
`;
|
|
147
|
-
return sourceCode;
|
|
148
|
-
};
|
|
149
|
-
exports.typesForIntegration = typesForIntegration;
|
|
150
18
|
//# sourceMappingURL=integration.codegen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.codegen.js","sourceRoot":"","sources":["../../../src/codegen/codegens/integration.codegen.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"integration.codegen.js","sourceRoot":"","sources":["../../../src/codegen/codegens/integration.codegen.ts"],"names":[],"mappings":";;;AACA,6CAAqD;AAM9C,MAAM,uBAAuB,GAAG,CACrC,MAAmC,EACnC,eAAuB,EACf,EAAE;IACV,MAAM,UAAU,GAAW;;;;6BAIA,eAAe;;yCAEH,IAAA,sBAAe,EAAC,MAAM,IAAI,EAAE,CAAC;;2BAE3C,CAAC;IAE1B,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAfW,QAAA,uBAAuB,2BAelC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { DataType,
|
|
2
|
-
import { StepDependencies } from '../codegen.types';
|
|
1
|
+
import { DataType, KeyedSource, Source, TokenizedSource } from '@useparagon/core/resolvers';
|
|
3
2
|
export declare const EMPTY_TOKENIZED_SOURCE: TokenizedSource<DataType.STRING>;
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const covertKeyedSourceParamsToCode: (parameters: KeyedSource<DataType>[], dependencies: StepDependencies) => string;
|
|
3
|
+
export declare const convertSourceToCode: (source: Source, stepIdToVariableMap: Record<string, string>, isTokenizedPart?: boolean) => string;
|
|
4
|
+
export declare const convertKeyedSourceToCode: (source: KeyedSource, stepIdToVariableMap: Record<string, string>) => [string, string];
|
|
5
|
+
export declare const covertKeyedSourceParamsToCode: (parameters: KeyedSource<DataType>[], stepIdToVariableMap: Record<string, string>) => string;
|