@useparagon/cli 0.0.1-canary.1 → 0.0.1-canary.11
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 +67 -0
- package/dist/apis/api.types.js +3 -0
- package/dist/apis/api.types.js.map +1 -0
- package/dist/apis/auth.api.d.ts +5 -0
- package/dist/apis/auth.api.js +16 -0
- package/dist/apis/auth.api.js.map +1 -0
- package/dist/apis/base.api.d.ts +7 -0
- package/dist/apis/base.api.js +91 -0
- package/dist/apis/base.api.js.map +1 -0
- package/dist/apis/event.api.d.ts +2 -0
- package/dist/apis/event.api.js +9 -0
- package/dist/apis/event.api.js.map +1 -0
- package/dist/apis/index.d.ts +6 -0
- package/dist/apis/index.js +10 -0
- package/dist/apis/index.js.map +1 -0
- package/dist/apis/integration.api.d.ts +3 -0
- package/dist/apis/integration.api.js +27 -0
- package/dist/apis/integration.api.js.map +1 -0
- package/dist/apis/project.api.d.ts +7 -0
- package/dist/apis/project.api.js +34 -0
- package/dist/apis/project.api.js.map +1 -0
- package/dist/apis/workflow.api.d.ts +2 -0
- package/dist/apis/workflow.api.js +9 -0
- package/dist/apis/workflow.api.js.map +1 -0
- package/dist/codegen/codegen.types.d.ts +14 -0
- package/dist/codegen/codegen.utils.d.ts +4 -4
- package/dist/codegen/codegen.utils.js +44 -37
- package/dist/codegen/codegen.utils.js.map +1 -1
- package/dist/codegen/codegens/condition.codegen.d.ts +2 -1
- package/dist/codegen/codegens/condition.codegen.js +96 -10
- package/dist/codegen/codegens/condition.codegen.js.map +1 -1
- package/dist/codegen/codegens/event.codegen.js +4 -11
- package/dist/codegen/codegens/event.codegen.js.map +1 -1
- package/dist/codegen/codegens/integration.codegen.d.ts +5 -2
- package/dist/codegen/codegens/integration.codegen.js +133 -4
- package/dist/codegen/codegens/integration.codegen.js.map +1 -1
- package/dist/codegen/codegens/persona.codegen.d.ts +2 -0
- package/dist/codegen/codegens/persona.codegen.js +12 -0
- package/dist/codegen/codegens/persona.codegen.js.map +1 -0
- package/dist/codegen/codegens/source.codegen.d.ts +6 -4
- package/dist/codegen/codegens/source.codegen.js +125 -25
- 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 +204 -110
- package/dist/codegen/codegens/workflow.codegen.js.map +1 -1
- package/dist/commands/{login/login.command.d.ts → auth/auth.command.d.ts} +1 -1
- package/dist/commands/auth/auth.command.js +18 -0
- package/dist/commands/auth/auth.command.js.map +1 -0
- package/dist/commands/auth/index.d.ts +1 -0
- package/dist/commands/auth/index.js +5 -0
- package/dist/commands/auth/index.js.map +1 -0
- package/dist/commands/auth/login/index.js.map +1 -0
- package/dist/commands/auth/login/login.action.d.ts +5 -0
- package/dist/commands/auth/login/login.action.js +42 -0
- package/dist/commands/auth/login/login.action.js.map +1 -0
- package/dist/commands/auth/login/login.command.d.ts +8 -0
- package/dist/commands/auth/login/login.command.js +25 -0
- package/dist/commands/auth/login/login.command.js.map +1 -0
- package/dist/commands/auth/login/login.types.d.ts +9 -0
- package/dist/commands/auth/login/login.types.js.map +1 -0
- package/dist/commands/auth/login/login.utils.d.ts +2 -0
- package/dist/commands/auth/login/login.utils.js +86 -0
- package/dist/commands/auth/login/login.utils.js.map +1 -0
- package/dist/commands/auth/logout/index.d.ts +1 -0
- package/dist/commands/auth/logout/index.js +5 -0
- package/dist/commands/auth/logout/index.js.map +1 -0
- package/dist/commands/auth/logout/logout.action.d.ts +5 -0
- package/dist/commands/auth/logout/logout.action.js +14 -0
- package/dist/commands/auth/logout/logout.action.js.map +1 -0
- package/dist/commands/auth/logout/logout.command.d.ts +8 -0
- package/dist/commands/auth/logout/logout.command.js +24 -0
- package/dist/commands/auth/logout/logout.command.js.map +1 -0
- package/dist/commands/auth/logout/logout.types.d.ts +1 -0
- package/dist/commands/auth/logout/logout.types.js +3 -0
- package/dist/commands/auth/logout/logout.types.js.map +1 -0
- package/dist/commands/auth/me/index.d.ts +1 -0
- package/dist/commands/auth/me/index.js +5 -0
- package/dist/commands/auth/me/index.js.map +1 -0
- package/dist/commands/auth/me/me.action.d.ts +5 -0
- package/dist/commands/auth/me/me.action.js +20 -0
- package/dist/commands/auth/me/me.action.js.map +1 -0
- package/dist/commands/auth/me/me.command.d.ts +8 -0
- package/dist/commands/auth/me/me.command.js +24 -0
- package/dist/commands/auth/me/me.command.js.map +1 -0
- package/dist/commands/auth/me/me.types.d.ts +1 -0
- package/dist/commands/auth/me/me.types.js +3 -0
- package/dist/commands/auth/me/me.types.js.map +1 -0
- package/dist/commands/build/build.action.d.ts +1 -1
- package/dist/commands/build/build.action.js +31 -33
- package/dist/commands/build/build.action.js.map +1 -1
- package/dist/commands/build/build.command.js +5 -6
- package/dist/commands/build/build.command.js.map +1 -1
- package/dist/commands/build/build.utils.js +5 -4
- package/dist/commands/build/build.utils.js.map +1 -1
- package/dist/commands/command.loader.js +11 -9
- 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 +1 -1
- package/dist/commands/init/init.action.js +76 -68
- package/dist/commands/init/init.action.js.map +1 -1
- package/dist/commands/init/init.command.js +9 -4
- package/dist/commands/init/init.command.js.map +1 -1
- package/dist/commands/init/init.constants.js +7 -3
- package/dist/commands/init/init.constants.js.map +1 -1
- package/dist/commands/init/init.utils.d.ts +2 -2
- package/dist/commands/init/init.utils.js +10 -7
- package/dist/commands/init/init.utils.js.map +1 -1
- package/dist/commands/new/index.d.ts +1 -0
- package/dist/commands/new/index.js +5 -0
- package/dist/commands/new/index.js.map +1 -0
- package/dist/commands/new/integration/index.d.ts +1 -0
- package/dist/commands/new/integration/index.js +5 -0
- package/dist/commands/new/integration/index.js.map +1 -0
- package/dist/commands/new/integration/integration.action.d.ts +5 -0
- package/dist/commands/new/integration/integration.action.js +49 -0
- package/dist/commands/new/integration/integration.action.js.map +1 -0
- package/dist/commands/new/integration/integration.command.d.ts +8 -0
- package/dist/commands/new/integration/integration.command.js +26 -0
- package/dist/commands/new/integration/integration.command.js.map +1 -0
- package/dist/commands/new/integration/integration.types.d.ts +1 -0
- package/dist/commands/new/integration/integration.types.js +3 -0
- package/dist/commands/new/integration/integration.types.js.map +1 -0
- package/dist/commands/new/new.command.d.ts +5 -0
- package/dist/commands/new/new.command.js +16 -0
- package/dist/commands/new/new.command.js.map +1 -0
- package/dist/commands/new/new.utils.d.ts +1 -0
- package/dist/commands/new/new.utils.js +18 -0
- package/dist/commands/new/new.utils.js.map +1 -0
- package/dist/commands/new/workflow/index.d.ts +1 -0
- package/dist/commands/new/workflow/index.js +5 -0
- package/dist/commands/new/workflow/index.js.map +1 -0
- package/dist/commands/new/workflow/workflow.action.d.ts +5 -0
- package/dist/commands/new/workflow/workflow.action.js +90 -0
- package/dist/commands/new/workflow/workflow.action.js.map +1 -0
- package/dist/commands/new/workflow/workflow.command.d.ts +8 -0
- package/dist/commands/new/workflow/workflow.command.js +29 -0
- package/dist/commands/new/workflow/workflow.command.js.map +1 -0
- package/dist/commands/new/workflow/workflow.types.d.ts +3 -0
- package/dist/commands/new/workflow/workflow.types.js +3 -0
- package/dist/commands/new/workflow/workflow.types.js.map +1 -0
- package/dist/commands/push/index.d.ts +1 -0
- package/dist/commands/push/index.js +5 -0
- package/dist/commands/push/index.js.map +1 -0
- package/dist/commands/push/push.action.d.ts +5 -0
- package/dist/commands/push/push.action.js +22 -0
- package/dist/commands/push/push.action.js.map +1 -0
- package/dist/commands/push/push.command.d.ts +8 -0
- package/dist/commands/push/push.command.js +26 -0
- package/dist/commands/push/push.command.js.map +1 -0
- package/dist/commands/push/push.types.d.ts +1 -0
- package/dist/commands/push/push.types.js +3 -0
- package/dist/commands/push/push.types.js.map +1 -0
- package/dist/compiler/compiler.interface.d.ts +3 -0
- package/dist/compiler/compiler.interface.js.map +1 -0
- package/{src/codegen/codegen.types.ts → dist/compiler/compiler.types.d.ts} +5 -9
- package/dist/compiler/compiler.types.js.map +1 -0
- package/dist/{compilers → compiler}/compiler.utils.js +3 -4
- package/dist/compiler/compiler.utils.js.map +1 -0
- package/dist/compiler/compilers/events.compiler.d.ts +10 -0
- package/dist/compiler/compilers/events.compiler.js +46 -0
- package/dist/compiler/compilers/events.compiler.js.map +1 -0
- package/dist/compiler/compilers/integrations.compiler.d.ts +17 -0
- package/dist/compiler/compilers/integrations.compiler.js +76 -0
- package/dist/compiler/compilers/integrations.compiler.js.map +1 -0
- package/dist/compiler/compilers/persona.compiler.d.ts +9 -0
- package/dist/compiler/compilers/persona.compiler.js +20 -0
- package/dist/compiler/compilers/persona.compiler.js.map +1 -0
- package/dist/compiler/compilers/project.compiler.d.ts +14 -0
- package/dist/compiler/compilers/project.compiler.js +42 -0
- package/dist/compiler/compilers/project.compiler.js.map +1 -0
- package/dist/compiler/compilers/workflows.compiler.d.ts +24 -0
- package/dist/compiler/compilers/workflows.compiler.js +55 -0
- package/dist/compiler/compilers/workflows.compiler.js.map +1 -0
- package/dist/{compilers → compiler}/ts.compiler.js +5 -5
- package/dist/compiler/ts.compiler.js.map +1 -0
- package/dist/config/config.constants.d.ts +0 -2
- package/dist/config/config.constants.js +3 -6
- package/dist/config/config.constants.js.map +1 -1
- package/dist/config/config.types.d.ts +11 -13
- 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 -9
- package/dist/config/config.utils.js +87 -124
- package/dist/config/config.utils.js.map +1 -1
- package/dist/config/index.d.ts +1 -0
- package/dist/config/index.js +1 -0
- package/dist/config/index.js.map +1 -1
- package/dist/helpers/file.d.ts +1 -0
- package/dist/helpers/file.js +24 -0
- package/dist/helpers/file.js.map +1 -0
- package/dist/helpers/http.d.ts +1 -0
- package/dist/helpers/http.js +11 -0
- package/dist/helpers/http.js.map +1 -0
- package/dist/helpers/strings.d.ts +1 -0
- package/dist/helpers/strings.js +5 -1
- package/dist/helpers/strings.js.map +1 -1
- package/dist/index.js +0 -0
- package/dist/index.js.map +1 -1
- package/dist/logger/logger.js +39 -2
- package/dist/logger/logger.js.map +1 -1
- package/dist/logger/logger.type.d.ts +3 -1
- package/dist/templates/configurations/javascript/.prettierrc +4 -0
- package/dist/templates/configurations/typescript/.prettierrc +4 -0
- package/{templates → dist/templates/configurations}/typescript/tsconfig.json +4 -2
- package/dist/templates/typescript/src/events/hello-world.ts +2 -2
- package/dist/templates/typescript/src/integrations/slack/config.ts +6 -11
- package/dist/templates/typescript/src/integrations/slack/inputs.ts +23 -0
- package/dist/templates/typescript/src/integrations/slack/types.ts +57 -0
- package/dist/templates/typescript/src/integrations/slack/workflows/workflow1.ts +120 -0
- package/dist/templates/typescript/src/persona.meta.ts +1 -0
- package/package.json +26 -18
- package/dist/commands/login/index.js.map +0 -1
- package/dist/commands/login/login.command.js +0 -26
- package/dist/commands/login/login.command.js.map +0 -1
- package/dist/commands/login/login.types.d.ts +0 -3
- package/dist/commands/login/login.types.js.map +0 -1
- package/dist/commands/login/login.utils.d.ts +0 -2
- package/dist/commands/login/login.utils.js +0 -47
- package/dist/commands/login/login.utils.js.map +0 -1
- package/dist/compilers/compiler.interface.d.ts +0 -3
- package/dist/compilers/compiler.interface.js.map +0 -1
- package/dist/compilers/compiler.types.d.ts +0 -23
- package/dist/compilers/compiler.types.js.map +0 -1
- package/dist/compilers/compiler.utils.js.map +0 -1
- package/dist/compilers/event.compiler.d.ts +0 -7
- package/dist/compilers/event.compiler.js +0 -25
- package/dist/compilers/event.compiler.js.map +0 -1
- package/dist/compilers/integration.compiler.d.ts +0 -9
- package/dist/compilers/integration.compiler.js +0 -55
- package/dist/compilers/integration.compiler.js.map +0 -1
- package/dist/compilers/project.compiler.d.ts +0 -10
- package/dist/compilers/project.compiler.js +0 -50
- package/dist/compilers/project.compiler.js.map +0 -1
- package/dist/compilers/ts.compiler.js.map +0 -1
- package/dist/compilers/workflow.compiler.d.ts +0 -10
- package/dist/compilers/workflow.compiler.js +0 -36
- package/dist/compilers/workflow.compiler.js.map +0 -1
- package/dist/templates/typescript/src/integrations/slack/workflows/example-workflow.ts +0 -30
- package/paragon.json +0 -3
- package/sample/sample.js +0 -404
- package/src/codegen/codegen.utils.ts +0 -145
- package/src/codegen/codegens/condition.codegen.ts +0 -49
- package/src/codegen/codegens/event.codegen.ts +0 -39
- package/src/codegen/codegens/integration.codegen.ts +0 -23
- package/src/codegen/codegens/source.codegen.ts +0 -193
- package/src/codegen/codegens/workflow.codegen.ts +0 -495
- package/src/commands/build/build.action.ts +0 -73
- package/src/commands/build/build.command.ts +0 -61
- package/src/commands/build/build.types.ts +0 -7
- package/src/commands/build/build.utils.ts +0 -21
- package/src/commands/build/index.ts +0 -1
- package/src/commands/command.interface.ts +0 -22
- package/src/commands/command.loader.ts +0 -33
- package/src/commands/index.ts +0 -2
- package/src/commands/init/index.ts +0 -1
- package/src/commands/init/init.action.ts +0 -166
- package/src/commands/init/init.command.ts +0 -71
- package/src/commands/init/init.constants.ts +0 -29
- package/src/commands/init/init.types.ts +0 -8
- package/src/commands/init/init.utils.ts +0 -91
- package/src/commands/login/index.ts +0 -1
- package/src/commands/login/login.command.ts +0 -48
- package/src/commands/login/login.types.ts +0 -9
- package/src/commands/login/login.utils.ts +0 -68
- package/src/compilers/compiler.interface.ts +0 -9
- package/src/compilers/compiler.types.ts +0 -52
- package/src/compilers/compiler.utils.ts +0 -32
- package/src/compilers/event.compiler.ts +0 -33
- package/src/compilers/integration.compiler.ts +0 -84
- package/src/compilers/project.compiler.ts +0 -86
- package/src/compilers/ts.compiler.ts +0 -116
- package/src/compilers/workflow.compiler.ts +0 -69
- package/src/config/config.constants.ts +0 -27
- package/src/config/config.types.ts +0 -112
- package/src/config/config.utils.ts +0 -251
- package/src/config/index.ts +0 -2
- package/src/helpers/constants.ts +0 -9
- package/src/helpers/json.ts +0 -8
- package/src/helpers/spinners.ts +0 -3
- package/src/helpers/strings.ts +0 -9
- package/src/index.ts +0 -26
- package/src/logger/index.ts +0 -1
- package/src/logger/logger.ts +0 -97
- package/src/logger/logger.type.ts +0 -8
- package/templates/configurations/javascript/.prettierignore +0 -2
- package/templates/configurations/javascript/.prettierrc +0 -11
- package/templates/configurations/typescript/.prettierignore +0 -2
- package/templates/configurations/typescript/.prettierrc +0 -19
- package/templates/javascript/src/events/hello-world.js +0 -13
- package/templates/javascript/src/integrations/slack/config.js +0 -11
- package/templates/javascript/src/integrations/slack/workflows/example-workflow.js +0 -30
- package/templates/typescript/src/events/hello-world.ts +0 -21
- package/templates/typescript/src/integrations/slack/config.ts +0 -18
- package/templates/typescript/src/integrations/slack/workflows/example-workflow.ts +0 -30
- package/tsconfig.json +0 -13
- package/tsconfig.release.json +0 -13
- /package/dist/commands/{login → auth/login}/index.d.ts +0 -0
- /package/dist/commands/{login → auth/login}/index.js +0 -0
- /package/dist/commands/{login → auth/login}/login.types.js +0 -0
- /package/dist/{compilers → compiler}/compiler.interface.js +0 -0
- /package/dist/{compilers → compiler}/compiler.types.js +0 -0
- /package/dist/{compilers → compiler}/compiler.utils.d.ts +0 -0
- /package/dist/{compilers → compiler}/ts.compiler.d.ts +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { IStep } from '@useparagon/core/';
|
|
2
|
+
import { IEvent } from '@useparagon/core/event';
|
|
3
|
+
import { InputSource, SerializedInput } from '@useparagon/core/inputs';
|
|
4
|
+
import { IPersona } from '@useparagon/core/persona';
|
|
5
|
+
import { OrConditions } from '@useparagon/core/resolvers';
|
|
6
|
+
export type Integrationntent = {
|
|
7
|
+
name: string;
|
|
8
|
+
title: string;
|
|
9
|
+
inputs: any[];
|
|
10
|
+
output: any[];
|
|
11
|
+
};
|
|
12
|
+
export type IntegrationDependencies = {
|
|
13
|
+
inputs: InputSource[];
|
|
14
|
+
intents: Integrationntent[];
|
|
15
|
+
triggers: Integrationntent[];
|
|
16
|
+
};
|
|
17
|
+
export type IntegrationWorkflowMeta = {
|
|
18
|
+
id: string;
|
|
19
|
+
infoText?: string;
|
|
20
|
+
defaultEnabled?: boolean;
|
|
21
|
+
hidden?: boolean;
|
|
22
|
+
order?: number;
|
|
23
|
+
inputs: SerializedInput[];
|
|
24
|
+
permissions?: OrConditions;
|
|
25
|
+
};
|
|
26
|
+
export type WorkflowMeta = {
|
|
27
|
+
[id: string]: IntegrationWorkflowMeta;
|
|
28
|
+
};
|
|
29
|
+
export type ModalConfig = {
|
|
30
|
+
accentColor?: string;
|
|
31
|
+
paragonLink?: boolean;
|
|
32
|
+
description?: string;
|
|
33
|
+
overview?: string;
|
|
34
|
+
workflowMeta?: WorkflowMeta;
|
|
35
|
+
sharedMeta?: {
|
|
36
|
+
inputs?: SerializedInput[];
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export interface WorkflowBuild {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
steps: IStep[];
|
|
43
|
+
}
|
|
44
|
+
export interface IntegrationBuild {
|
|
45
|
+
id: string;
|
|
46
|
+
config: {
|
|
47
|
+
values: ModalConfig;
|
|
48
|
+
};
|
|
49
|
+
workflows: Record<string, WorkflowBuild | undefined>;
|
|
50
|
+
dependencies?: IntegrationDependencies;
|
|
51
|
+
}
|
|
52
|
+
export interface ProjectBuild {
|
|
53
|
+
projectId: string;
|
|
54
|
+
events: Record<string, IEvent>;
|
|
55
|
+
persona: IPersona;
|
|
56
|
+
integrations: Record<string, IntegrationBuild | undefined>;
|
|
57
|
+
}
|
|
58
|
+
export type IUser = {
|
|
59
|
+
firstName: string;
|
|
60
|
+
middleName: string;
|
|
61
|
+
lastName: string;
|
|
62
|
+
email: string;
|
|
63
|
+
};
|
|
64
|
+
export type IntegrationMetadata = {
|
|
65
|
+
name: string;
|
|
66
|
+
title: string;
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.types.js","sourceRoot":"","sources":["../../src/apis/api.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMe = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const logger_1 = tslib_1.__importDefault(require("../logger"));
|
|
6
|
+
const base_api_1 = require("./base.api");
|
|
7
|
+
const getMe = async (overrideConfig) => {
|
|
8
|
+
try {
|
|
9
|
+
return await (0, base_api_1.get)('auth/me', overrideConfig);
|
|
10
|
+
}
|
|
11
|
+
catch (err) {
|
|
12
|
+
logger_1.default.fatal(`Error while getting user information : ${err}`);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.getMe = getMe;
|
|
16
|
+
//# sourceMappingURL=auth.api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.api.js","sourceRoot":"","sources":["../../src/apis/auth.api.ts"],"names":[],"mappings":";;;;AAAA,+DAA+B;AAE/B,yCAAiC;AAO1B,MAAM,KAAK,GAAG,KAAK,EAAE,cAG3B,EAAkB,EAAE;IACnB,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAM,CAAC,KAAK,CAAC,0CAA0C,GAAG,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC,CAAC;AATW,QAAA,KAAK,SAShB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const getToken: () => Promise<string>;
|
|
2
|
+
export declare const get: (path: string, options?: {
|
|
3
|
+
token: string;
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
}) => Promise<any>;
|
|
6
|
+
export declare const post: <D extends object>(path: string, data: D) => Promise<any>;
|
|
7
|
+
export declare const put: <D extends object>(path: string, data: D) => Promise<any>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.put = exports.post = exports.get = exports.getToken = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const axios_1 = tslib_1.__importDefault(require("axios"));
|
|
6
|
+
const logger_1 = tslib_1.__importDefault(require("../logger"));
|
|
7
|
+
const config_1 = require("../config");
|
|
8
|
+
const http_1 = require("../helpers/http");
|
|
9
|
+
let _token;
|
|
10
|
+
let _baseUrl;
|
|
11
|
+
const getBaseUrl = async () => {
|
|
12
|
+
if (_baseUrl) {
|
|
13
|
+
return _baseUrl;
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
const profileConfig = await (0, config_1.getConfigForProfile)(config_1.SystemFile.PROFILES, config_1.DEFAULT_PROFILE);
|
|
17
|
+
if (!profileConfig.services[config_1.Service.ZEUS]) {
|
|
18
|
+
logger_1.default.fatal('Api url is not present in config.');
|
|
19
|
+
}
|
|
20
|
+
_baseUrl = (0, http_1.sanitizeUrl)(profileConfig.services[config_1.Service.ZEUS]);
|
|
21
|
+
return _baseUrl;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
logger_1.default.fatal('User not logged in.');
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const getToken = async () => {
|
|
28
|
+
if (_token) {
|
|
29
|
+
return _token;
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const credential = await (0, config_1.getConfigForProfile)(config_1.SystemFile.CREDENTIALS, config_1.DEFAULT_PROFILE);
|
|
33
|
+
_token = credential.token;
|
|
34
|
+
if (!_token) {
|
|
35
|
+
logger_1.default.fatal('Token value not present in config.');
|
|
36
|
+
}
|
|
37
|
+
return _token;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
logger_1.default.fatal('User not logged in.');
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
exports.getToken = getToken;
|
|
44
|
+
const handleError = (error) => {
|
|
45
|
+
throw new Error(error.message);
|
|
46
|
+
};
|
|
47
|
+
const get = async (path, options) => {
|
|
48
|
+
const apiBaseUrl = options ? options.baseUrl : await getBaseUrl();
|
|
49
|
+
const token = options ? options.token : await (0, exports.getToken)();
|
|
50
|
+
try {
|
|
51
|
+
const response = await axios_1.default.get(`${apiBaseUrl}/${path}`, {
|
|
52
|
+
headers: {
|
|
53
|
+
Authorization: `Bearer ${token}`,
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
return response.data;
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
handleError(error);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
exports.get = get;
|
|
63
|
+
const post = async (path, data) => {
|
|
64
|
+
try {
|
|
65
|
+
const response = await axios_1.default.post(`${await getBaseUrl()}/${path}`, data, {
|
|
66
|
+
headers: {
|
|
67
|
+
Authorization: `Bearer ${await (0, exports.getToken)()}`,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
return response.data;
|
|
71
|
+
}
|
|
72
|
+
catch (error) {
|
|
73
|
+
handleError(error);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
exports.post = post;
|
|
77
|
+
const put = async (path, data) => {
|
|
78
|
+
try {
|
|
79
|
+
const response = await axios_1.default.put(`${await getBaseUrl()}/${path}`, data, {
|
|
80
|
+
headers: {
|
|
81
|
+
Authorization: `Bearer ${await (0, exports.getToken)()}`,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
return response.data;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
handleError(error);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
exports.put = put;
|
|
91
|
+
//# sourceMappingURL=base.api.js.map
|
|
@@ -0,0 +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;AAM9C,IAAI,MAA0B,CAAC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E;IACnE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,GAAG,MAAM,UAAU,EAAE,IAAI,IAAI,EAAE,EAAE,IAAI,EAAE;YACtE,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,MAAM,IAAA,gBAAQ,GAAE,EAAE;aAC5C;SACF,CAAC,CAAC;QAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,WAAW,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;AACH,CAAC,CAAC;AAZW,QAAA,GAAG,OAYd"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEventsByProject = void 0;
|
|
4
|
+
const base_api_1 = require("./base.api");
|
|
5
|
+
const getEventsByProject = async (projectId) => {
|
|
6
|
+
return (0, base_api_1.get)(`projects/${projectId}/events`);
|
|
7
|
+
};
|
|
8
|
+
exports.getEventsByProject = getEventsByProject;
|
|
9
|
+
//# sourceMappingURL=event.api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.api.js","sourceRoot":"","sources":["../../src/apis/event.api.ts"],"names":[],"mappings":";;;AAEA,yCAAiC;AAO1B,MAAM,kBAAkB,GAAG,KAAK,EACrC,SAAiB,EACE,EAAE;IACrB,OAAO,IAAA,cAAG,EAAC,YAAY,SAAS,SAAS,CAAC,CAAC;AAC7C,CAAC,CAAC;AAJW,QAAA,kBAAkB,sBAI7B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./api.types"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./auth.api"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./event.api"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./integration.api"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./project.api"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./workflow.api"), exports);
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,qDAA2B;AAC3B,sDAA4B;AAC5B,4DAAkC;AAClC,wDAA8B;AAC9B,yDAA+B"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { IntegrationDependencies, IntegrationMetadata } from './api.types';
|
|
2
|
+
export declare const getIntegrationDependencies: (projectId: string, integrations: string[]) => Promise<IntegrationDependencies[]>;
|
|
3
|
+
export declare const getDefaultIntegrations: (projectId: string) => Promise<IntegrationMetadata[]>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDefaultIntegrations = exports.getIntegrationDependencies = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const logger_1 = tslib_1.__importDefault(require("../logger"));
|
|
6
|
+
const base_api_1 = require("./base.api");
|
|
7
|
+
const getIntegrationDependencies = async (projectId, integrations) => {
|
|
8
|
+
try {
|
|
9
|
+
return (0, base_api_1.post)(`graphite/projects/${projectId}/integrations`, {
|
|
10
|
+
integrations,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
catch (err) {
|
|
14
|
+
logger_1.default.fatal(`Could not get integration types from cloud : ${err}`);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
exports.getIntegrationDependencies = getIntegrationDependencies;
|
|
18
|
+
const getDefaultIntegrations = async (projectId) => {
|
|
19
|
+
try {
|
|
20
|
+
return await (0, base_api_1.get)(`graphite/projects/${projectId}/integrations`);
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
logger_1.default.fatal(`Could not get integrations list : ${err}`);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.getDefaultIntegrations = getDefaultIntegrations;
|
|
27
|
+
//# sourceMappingURL=integration.api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.api.js","sourceRoot":"","sources":["../../src/apis/integration.api.ts"],"names":[],"mappings":";;;;AAAA,+DAA+B;AAE/B,yCAAuC;AAMhC,MAAM,0BAA0B,GAAG,KAAK,EAC7C,SAAiB,EACjB,YAAsB,EACc,EAAE;IACtC,IAAI,CAAC;QACH,OAAO,IAAA,eAAI,EAAC,qBAAqB,SAAS,eAAe,EAAE;YACzD,YAAY;SACb,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAM,CAAC,KAAK,CAAC,gDAAgD,GAAG,EAAE,CAAC,CAAC;IACtE,CAAC;AACH,CAAC,CAAC;AAXW,QAAA,0BAA0B,8BAWrC;AAOK,MAAM,sBAAsB,GAAG,KAAK,EACzC,SAAiB,EACe,EAAE;IAClC,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,qBAAqB,SAAS,eAAe,CAAC,CAAC;IAClE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAM,CAAC,KAAK,CAAC,qCAAqC,GAAG,EAAE,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC,CAAC;AARW,QAAA,sBAAsB,0BAQjC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ProjectBuild } from './api.types';
|
|
2
|
+
export declare const getProjectList: () => Promise<{
|
|
3
|
+
title: string;
|
|
4
|
+
id: string;
|
|
5
|
+
}[]>;
|
|
6
|
+
export declare const getProjectBuild: (projectId: string) => Promise<ProjectBuild>;
|
|
7
|
+
export declare const syncProject: (projectId: string, build: ProjectBuild) => Promise<void>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.syncProject = exports.getProjectBuild = exports.getProjectList = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const logger_1 = tslib_1.__importDefault(require("../logger"));
|
|
6
|
+
const base_api_1 = require("./base.api");
|
|
7
|
+
const getProjectList = async () => {
|
|
8
|
+
try {
|
|
9
|
+
return await (0, base_api_1.get)('graphite/projects');
|
|
10
|
+
}
|
|
11
|
+
catch (err) {
|
|
12
|
+
logger_1.default.fatal(`Error while getting projects list : ${err}`);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.getProjectList = getProjectList;
|
|
16
|
+
const getProjectBuild = async (projectId) => {
|
|
17
|
+
try {
|
|
18
|
+
return await (0, base_api_1.get)(`graphite/projects/${projectId}`);
|
|
19
|
+
}
|
|
20
|
+
catch (err) {
|
|
21
|
+
logger_1.default.fatal(`Error while getting project : ${err}`);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.getProjectBuild = getProjectBuild;
|
|
25
|
+
const syncProject = async (projectId, build) => {
|
|
26
|
+
try {
|
|
27
|
+
await (0, base_api_1.put)(`graphite/projects/${projectId}`, build);
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
logger_1.default.fatal(`Error while syncing project : ${err}`);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.syncProject = syncProject;
|
|
34
|
+
//# sourceMappingURL=project.api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.api.js","sourceRoot":"","sources":["../../src/apis/project.api.ts"],"names":[],"mappings":";;;;AAAA,+DAA+B;AAE/B,yCAAsC;AAM/B,MAAM,cAAc,GAAG,KAAK,IAEjC,EAAE;IACF,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,mBAAmB,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAM,CAAC,KAAK,CAAC,uCAAuC,GAAG,EAAE,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB;AAOK,MAAM,eAAe,GAAG,KAAK,EAClC,SAAiB,EACM,EAAE;IACzB,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,qBAAqB,SAAS,EAAE,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAM,CAAC,KAAK,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC;AACH,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B;AAMK,MAAM,WAAW,GAAG,KAAK,EAC9B,SAAiB,EACjB,KAAmB,EACJ,EAAE;IACjB,IAAI,CAAC;QACH,MAAM,IAAA,cAAG,EAAC,qBAAqB,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAM,CAAC,KAAK,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC;AACH,CAAC,CAAC;AATW,QAAA,WAAW,eAStB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWorkflowSteps = void 0;
|
|
4
|
+
const base_api_1 = require("./base.api");
|
|
5
|
+
const getWorkflowSteps = async (projectId, workflowId) => {
|
|
6
|
+
return (0, base_api_1.get)(`projects/${projectId}/workflows/${workflowId}/steps`);
|
|
7
|
+
};
|
|
8
|
+
exports.getWorkflowSteps = getWorkflowSteps;
|
|
9
|
+
//# sourceMappingURL=workflow.api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.api.js","sourceRoot":"","sources":["../../src/apis/workflow.api.ts"],"names":[],"mappings":";;;AAEA,yCAAiC;AAQ1B,MAAM,gBAAgB,GAAG,KAAK,EACnC,SAAiB,EACjB,UAAkB,EACA,EAAE;IACpB,OAAO,IAAA,cAAG,EAAC,YAAY,SAAS,cAAc,UAAU,QAAQ,CAAC,CAAC;AACpE,CAAC,CAAC;AALW,QAAA,gBAAgB,oBAK3B"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { IStep } from '@useparagon/core';
|
|
1
2
|
import { IEvent } from '@useparagon/core/event';
|
|
3
|
+
import { InputSource, SerializedInput } from '@useparagon/core/inputs';
|
|
4
|
+
import { IntegrationWorkflowMeta } from '../apis/api.types';
|
|
2
5
|
export type ProjectDependencies = {
|
|
3
6
|
events: Record<string, IEvent>;
|
|
4
7
|
};
|
|
@@ -6,4 +9,15 @@ export type WorkflowDependencies = ProjectDependencies & {
|
|
|
6
9
|
integration: {
|
|
7
10
|
name: string;
|
|
8
11
|
};
|
|
12
|
+
workflowMeta: IntegrationWorkflowMeta;
|
|
13
|
+
sharedInputs: SerializedInput[];
|
|
14
|
+
inputSources: InputSource[];
|
|
15
|
+
};
|
|
16
|
+
export type StepDependencies = {
|
|
17
|
+
sharedInputs: SerializedInput[];
|
|
18
|
+
inputs: SerializedInput[];
|
|
19
|
+
inputSources: InputSource[];
|
|
20
|
+
stepIdToVariableMap: Record<string, string>;
|
|
21
|
+
events: Record<string, IEvent>;
|
|
22
|
+
stepIdToStepMap: Record<string, IStep>;
|
|
9
23
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export declare const generateIntegrationFiles: (integrationName: string, integrationOutput:
|
|
4
|
-
export declare const generateProjectFiles: (projectBuild:
|
|
1
|
+
import { IntegrationBuild, ProjectBuild } from '../apis/api.types';
|
|
2
|
+
import { ProjectDependencies } from '../compiler/compiler.types';
|
|
3
|
+
export declare const generateIntegrationFiles: (integrationName: string, integrationOutput: IntegrationBuild, projectDependencies: ProjectDependencies, projectRoot: string) => Promise<void>;
|
|
4
|
+
export declare const generateProjectFiles: (projectBuild: ProjectBuild, projectRoot: string) => Promise<void>;
|
|
@@ -1,70 +1,77 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateProjectFiles = exports.generateIntegrationFiles =
|
|
3
|
+
exports.generateProjectFiles = exports.generateIntegrationFiles = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const importSortOrderPlugin = tslib_1.__importStar(require("@trivago/prettier-plugin-sort-imports"));
|
|
6
5
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
7
6
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
|
-
const
|
|
9
|
-
const
|
|
7
|
+
const utils_1 = require("@useparagon/core/utils");
|
|
8
|
+
const file_1 = require("../helpers/file");
|
|
10
9
|
const event_codegen_1 = require("./codegens/event.codegen");
|
|
11
10
|
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
|
|
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* () {
|
|
13
|
+
const generateIntegrationFiles = async (integrationName, integrationOutput, projectDependencies, projectRoot) => {
|
|
14
|
+
const { events } = projectDependencies;
|
|
32
15
|
const integrationPath = path_1.default.join(projectRoot, 'integrations', integrationName);
|
|
33
|
-
|
|
16
|
+
await fs_extra_1.default.promises.mkdir(integrationPath, {
|
|
34
17
|
recursive: true,
|
|
35
18
|
});
|
|
19
|
+
const sharedInputs = integrationOutput.config.values.sharedMeta?.inputs ?? [];
|
|
36
20
|
const configCode = (0, integration_codegen_1.integrationConfigToCode)(integrationOutput.config, integrationName);
|
|
37
|
-
|
|
38
|
-
const
|
|
21
|
+
const inputSources = integrationOutput.dependencies?.inputs ?? [];
|
|
22
|
+
const inputsSouceCode = (0, integration_codegen_1.integrationInputsToCode)(sharedInputs, inputSources);
|
|
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);
|
|
39
33
|
const workflowPath = path_1.default.join(integrationPath, 'workflows');
|
|
40
|
-
if (
|
|
34
|
+
if (workflows.length) {
|
|
41
35
|
fs_extra_1.default.promises.mkdir(workflowPath, {
|
|
42
36
|
recursive: true,
|
|
43
37
|
});
|
|
44
38
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
const generateUniqueNames = (0, utils_1.withUniqueFileNames)();
|
|
40
|
+
for (const workflow of workflows) {
|
|
41
|
+
const workflowCode = (0, workflow_codegen_1.workflowToCode)(workflow, {
|
|
42
|
+
events,
|
|
43
|
+
integration: { name: integrationName },
|
|
44
|
+
sharedInputs,
|
|
45
|
+
inputSources,
|
|
46
|
+
workflowMeta: workflowMetas[workflow.id] || {
|
|
47
|
+
id: workflow.id,
|
|
48
|
+
inputs: [],
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
await (0, file_1.writeSourceToFile)(workflowPath, generateUniqueNames(workflow.name), workflowCode);
|
|
48
52
|
}
|
|
49
|
-
}
|
|
53
|
+
};
|
|
50
54
|
exports.generateIntegrationFiles = generateIntegrationFiles;
|
|
51
|
-
const generateProjectFiles = (projectBuild, projectRoot) =>
|
|
52
|
-
yield fs_extra_1.default.promises.mkdir(projectRoot, { recursive: true });
|
|
55
|
+
const generateProjectFiles = async (projectBuild, projectRoot) => {
|
|
53
56
|
const events = Object.values(projectBuild.events);
|
|
54
57
|
const eventPath = path_1.default.join(projectRoot, 'events');
|
|
55
58
|
if (events.length) {
|
|
56
|
-
|
|
59
|
+
await fs_extra_1.default.promises.mkdir(eventPath, {
|
|
57
60
|
recursive: true,
|
|
58
61
|
});
|
|
59
62
|
}
|
|
60
63
|
for (const event of events) {
|
|
61
64
|
const eventSourceCode = (0, event_codegen_1.eventToCode)(event);
|
|
62
|
-
|
|
65
|
+
await (0, file_1.writeSourceToFile)(eventPath, (0, utils_1.toCamelCase)(event.name), eventSourceCode);
|
|
63
66
|
}
|
|
67
|
+
await (0, file_1.writeSourceToFile)(projectRoot, 'persona.meta', (0, persona_codegen_1.personaToCode)(projectBuild.persona));
|
|
64
68
|
const integrationOutputs = Object.entries(projectBuild.integrations);
|
|
65
69
|
for (const [integrationName, integrationOutput] of integrationOutputs) {
|
|
66
|
-
|
|
70
|
+
await (0, exports.generateIntegrationFiles)(integrationName, integrationOutput, {
|
|
71
|
+
events: projectBuild.events,
|
|
72
|
+
projectId: projectBuild.projectId,
|
|
73
|
+
}, projectRoot);
|
|
67
74
|
}
|
|
68
|
-
}
|
|
75
|
+
};
|
|
69
76
|
exports.generateProjectFiles = generateProjectFiles;
|
|
70
77
|
//# sourceMappingURL=codegen.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.utils.js","sourceRoot":"","sources":["../../src/codegen/codegen.utils.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"codegen.utils.js","sourceRoot":"","sources":["../../src/codegen/codegen.utils.ts"],"names":[],"mappings":";;;;AAAA,gEAA0B;AAC1B,wDAAwB;AAIxB,kDAA0E;AAS1E,0CAAoD;AACpD,4DAAuD;AACvD,wEAIwC;AACxC,gEAA2D;AAC3D,kEAA6D;AAQtD,MAAM,wBAAwB,GAAG,KAAK,EAC3C,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,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,IAAI,EAAE,CAAC;IAE3D,MAAM,UAAU,GAAW,IAAA,6CAAuB,EAChD,iBAAiB,CAAC,MAAM,EACxB,eAAe,CAChB,CAAC;IAEF,MAAM,YAAY,GAChB,iBAAiB,CAAC,YAAY,EAAE,MAAM,IAAI,EAAE,CAAC;IAE/C,MAAM,eAAe,GAAW,IAAA,6CAAuB,EACrD,YAAY,EACZ,YAAY,CACb,CAAC;IAEF,IAAI,iBAAiB,CAAC,YAAY,EAAE,CAAC;QACnC,MAAM,oBAAo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from '@useparagon/core/resolvers';
|
|
2
|
-
|
|
2
|
+
import { StepDependencies } from '../codegen.types';
|
|
3
|
+
export declare const conditionToCode: (operatorCondition: OperatorCondition, dependencies: StepDependencies) => string;
|