@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
|
@@ -4,167 +4,71 @@ exports.IntegrationsCompiler = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const glob_1 = require("glob");
|
|
6
6
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
const uuid_1 = require("uuid");
|
|
8
7
|
const inputs_1 = require("@useparagon/core/inputs");
|
|
9
|
-
const integration_1 = require("@useparagon/core/integration");
|
|
10
|
-
const resolvers_1 = require("@useparagon/core/resolvers");
|
|
11
|
-
const request_1 = require("@useparagon/core/steps/library/request");
|
|
12
8
|
const utils_1 = require("@useparagon/core/utils");
|
|
13
9
|
const compiler_utils_1 = require("../compiler.utils");
|
|
14
10
|
const workflows_compiler_1 = require("./workflows.compiler");
|
|
15
11
|
class IntegrationsCompiler {
|
|
16
|
-
workflowsCompiler;
|
|
17
12
|
constructor() {
|
|
18
13
|
this.workflowsCompiler = new workflows_compiler_1.WorkflowsCompiler();
|
|
19
14
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
};
|
|
43
|
-
switch (customIntegrationConfig.authenticationType) {
|
|
44
|
-
case integration_1.AuthenticationScheme.BASIC:
|
|
45
|
-
customIntegration = {
|
|
46
|
-
...customIntegration,
|
|
47
|
-
apiBaseUrl: (0, resolvers_1.resolveToTokenizedSource)(customIntegrationConfig.apiBaseUrl, resolvers_1.DataType.STRING),
|
|
48
|
-
testEndpointPath: (0, resolvers_1.resolveToTokenizedSource)(customIntegrationConfig.testEndpointPath, resolvers_1.DataType.STRING),
|
|
49
|
-
apiAuthorization: (() => {
|
|
50
|
-
let authorization;
|
|
51
|
-
const userDefinedAuthorization = customIntegrationConfig.authorization;
|
|
52
|
-
switch (userDefinedAuthorization?.type) {
|
|
53
|
-
case request_1.RequestAuthorizationType.BASIC:
|
|
54
|
-
authorization = {
|
|
55
|
-
type: request_1.RequestAuthorizationType.BASIC,
|
|
56
|
-
username: (0, resolvers_1.resolveToTokenizedSource)(userDefinedAuthorization.userName, resolvers_1.DataType.STRING),
|
|
57
|
-
password: (0, resolvers_1.resolveToTokenizedSource)(userDefinedAuthorization.password, resolvers_1.DataType.STRING),
|
|
58
|
-
};
|
|
59
|
-
break;
|
|
60
|
-
case request_1.RequestAuthorizationType.AUTH_HEADER:
|
|
61
|
-
authorization = {
|
|
62
|
-
type: request_1.RequestAuthorizationType.AUTH_HEADER,
|
|
63
|
-
headers: (0, resolvers_1.resolveParamsToSources)(userDefinedAuthorization.headers || {}, resolvers_1.DataType.STRING),
|
|
64
|
-
};
|
|
65
|
-
break;
|
|
66
|
-
case request_1.RequestAuthorizationType.BEARER_TOKEN:
|
|
67
|
-
authorization = {
|
|
68
|
-
type: request_1.RequestAuthorizationType.BEARER_TOKEN,
|
|
69
|
-
token: (0, resolvers_1.resolveToTokenizedSource)(userDefinedAuthorization.token, resolvers_1.DataType.STRING),
|
|
70
|
-
};
|
|
71
|
-
break;
|
|
72
|
-
case request_1.RequestAuthorizationType.CLIENT_CREDENTIAL:
|
|
73
|
-
authorization = {
|
|
74
|
-
type: request_1.RequestAuthorizationType.CLIENT_CREDENTIAL,
|
|
75
|
-
};
|
|
76
|
-
break;
|
|
77
|
-
case request_1.RequestAuthorizationType.QUERY_PARAMS:
|
|
78
|
-
authorization = {
|
|
79
|
-
type: request_1.RequestAuthorizationType.QUERY_PARAMS,
|
|
80
|
-
params: (0, resolvers_1.resolveParamsToSources)(userDefinedAuthorization.params || {}, resolvers_1.DataType.STRING),
|
|
81
|
-
};
|
|
82
|
-
break;
|
|
83
|
-
default:
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
return authorization;
|
|
87
|
-
})(),
|
|
88
|
-
};
|
|
89
|
-
break;
|
|
90
|
-
case integration_1.AuthenticationScheme.OAUTH:
|
|
91
|
-
customIntegration = {
|
|
92
|
-
...customIntegration,
|
|
93
|
-
authenticationType: integration_1.AuthenticationScheme.OAUTH,
|
|
94
|
-
oauthAuthorizationUrl: (0, resolvers_1.resolveToTokenizedSource)(customIntegrationConfig.authorizationUrl, resolvers_1.DataType.STRING),
|
|
95
|
-
oauthAccessTokenUrl: (0, resolvers_1.resolveToTokenizedSource)(customIntegrationConfig.accessTokenUrl, resolvers_1.DataType.STRING),
|
|
96
|
-
oauthScopes: customIntegration.oauthScopes || '',
|
|
97
|
-
oauthIncludeClientAuthorizationHeader: customIntegrationConfig.includeClientIdAndSecrets ?? true,
|
|
98
|
-
usePKCEInCodeExchange: customIntegrationConfig.usePKCEInCodeExchange ?? false,
|
|
99
|
-
};
|
|
100
|
-
break;
|
|
101
|
-
case integration_1.AuthenticationScheme.OAUTH_CLIENT_CREDENTIAL:
|
|
102
|
-
customIntegration = {
|
|
103
|
-
...customIntegration,
|
|
104
|
-
authenticationType: integration_1.AuthenticationScheme.OAUTH_CLIENT_CREDENTIAL,
|
|
105
|
-
oauthAccessTokenUrl: (0, resolvers_1.resolveToTokenizedSource)(customIntegrationConfig.accessTokenUrl, resolvers_1.DataType.STRING),
|
|
106
|
-
};
|
|
107
|
-
break;
|
|
108
|
-
default:
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
if (usersIntegrations.has(integrationName)) {
|
|
113
|
-
throw new Error(`Integration with name "${integrationName}" is already defined.`);
|
|
114
|
-
}
|
|
115
|
-
usersIntegrations.add(integrationName);
|
|
116
|
-
const integrationConfig = output.default;
|
|
117
|
-
const inputSources = previousIntegrationBuild?.dependencies?.inputs ?? [];
|
|
118
|
-
const previousConfig = previousIntegrationBuild?.config;
|
|
119
|
-
const serializedInputs = (0, inputs_1.convertUserDefinedInputsToSerializedInputs)(Object.values(userDefinedInputs), inputSources);
|
|
120
|
-
const modalConfig = {
|
|
121
|
-
values: {
|
|
122
|
-
paragonLink: integrationConfig['showWatermark'] || true,
|
|
123
|
-
description: integrationConfig.description,
|
|
124
|
-
overview: integrationConfig['overviewText'] || '',
|
|
125
|
-
accentColor: integrationConfig['accentColor'] ||
|
|
126
|
-
previousConfig?.values?.accentColor,
|
|
127
|
-
workflowMeta: {},
|
|
128
|
-
sharedMeta: {
|
|
129
|
-
inputs: serializedInputs,
|
|
15
|
+
compile(options) {
|
|
16
|
+
var _a;
|
|
17
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const { events, projectRoot, previousProjectBuild } = options;
|
|
19
|
+
const userIntegrationPaths = yield (0, glob_1.glob)(path_1.default.join(projectRoot, 'integrations/*/'));
|
|
20
|
+
const integrationOutputs = [];
|
|
21
|
+
for (const userIntegraitonPath of userIntegrationPaths) {
|
|
22
|
+
const integration = (0, compiler_utils_1.extractKeyFromPath)(userIntegraitonPath);
|
|
23
|
+
const userDefinedInputs = (0, compiler_utils_1.requireSafe)(path_1.default.join(userIntegraitonPath, 'inputs.js'));
|
|
24
|
+
const integrationConfig = (0, compiler_utils_1.requireSafe)(path_1.default.join(userIntegraitonPath, 'config.js'));
|
|
25
|
+
const previousIntegrationBuild = previousProjectBuild.integrations[integration];
|
|
26
|
+
const inputSources = (_a = previousIntegrationBuild === null || previousIntegrationBuild === void 0 ? void 0 : previousIntegrationBuild.inputs) !== null && _a !== void 0 ? _a : [];
|
|
27
|
+
const serializedInputs = (0, inputs_1.convertUserDefinedInputsToSerializedInputs)(userDefinedInputs, inputSources);
|
|
28
|
+
const modalConfig = {
|
|
29
|
+
values: {
|
|
30
|
+
paragonLink: integrationConfig.showWatermark || true,
|
|
31
|
+
description: integrationConfig.description,
|
|
32
|
+
overview: integrationConfig.overviewText,
|
|
33
|
+
workflowMeta: {},
|
|
34
|
+
sharedMeta: {
|
|
35
|
+
inputs: serializedInputs,
|
|
36
|
+
},
|
|
130
37
|
},
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
previousProjectBuild,
|
|
140
|
-
});
|
|
141
|
-
const workflowBuilds = [];
|
|
142
|
-
for (const compiledWorkflow of compiledWorkflows) {
|
|
143
|
-
workflowBuilds.push({
|
|
144
|
-
id: compiledWorkflow.id,
|
|
145
|
-
name: compiledWorkflow.name,
|
|
146
|
-
steps: compiledWorkflow.steps,
|
|
38
|
+
};
|
|
39
|
+
const compiledWorkflows = yield this.workflowsCompiler.compile({
|
|
40
|
+
projectRoot,
|
|
41
|
+
integration,
|
|
42
|
+
events,
|
|
43
|
+
sharedInputs: serializedInputs,
|
|
44
|
+
inputSources,
|
|
45
|
+
previousProjectBuild,
|
|
147
46
|
});
|
|
148
|
-
|
|
149
|
-
|
|
47
|
+
const workflowBuilds = [];
|
|
48
|
+
for (const compiledWorkflow of compiledWorkflows) {
|
|
49
|
+
workflowBuilds.push({
|
|
150
50
|
id: compiledWorkflow.id,
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
51
|
+
name: compiledWorkflow.name,
|
|
52
|
+
steps: compiledWorkflow.steps,
|
|
53
|
+
});
|
|
54
|
+
if (modalConfig.values.workflowMeta) {
|
|
55
|
+
modalConfig.values.workflowMeta[compiledWorkflow.id] = {
|
|
56
|
+
id: compiledWorkflow.id,
|
|
57
|
+
hidden: compiledWorkflow.hidden,
|
|
58
|
+
defaultEnabled: compiledWorkflow.defaultEnable,
|
|
59
|
+
inputs: compiledWorkflow.inputs,
|
|
60
|
+
infoText: compiledWorkflow.description,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
157
63
|
}
|
|
64
|
+
integrationOutputs.push({
|
|
65
|
+
name: integration,
|
|
66
|
+
workflows: (0, utils_1.indexBy)('id', workflowBuilds),
|
|
67
|
+
config: modalConfig,
|
|
68
|
+
});
|
|
158
69
|
}
|
|
159
|
-
integrationOutputs
|
|
160
|
-
|
|
161
|
-
name: integrationName,
|
|
162
|
-
workflows: (0, utils_1.indexBy)('id', workflowBuilds),
|
|
163
|
-
config: modalConfig,
|
|
164
|
-
customIntegration,
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
return integrationOutputs;
|
|
70
|
+
return integrationOutputs;
|
|
71
|
+
});
|
|
168
72
|
}
|
|
169
73
|
}
|
|
170
74
|
exports.IntegrationsCompiler = IntegrationsCompiler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrations.compiler.js","sourceRoot":"","sources":["../../../src/compiler/compilers/integrations.compiler.ts"],"names":[],"mappings":";;;;AAAA,+BAA4B;AAC5B,wDAAwB;
|
|
1
|
+
{"version":3,"file":"integrations.compiler.js","sourceRoot":"","sources":["../../../src/compiler/compilers/integrations.compiler.ts"],"names":[],"mappings":";;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
exports.PersonaCompiler = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const glob_1 = require("glob");
|
|
5
6
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
7
|
const compiler_utils_1 = require("../compiler.utils");
|
|
7
8
|
class PersonaCompiler {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
compile(options) {
|
|
10
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
+
const { projectRoot } = options;
|
|
12
|
+
const peraonaMeta = yield (0, glob_1.glob)(path_1.default.join(projectRoot, '**/persona.meta.js'));
|
|
13
|
+
if (!peraonaMeta.length) {
|
|
14
|
+
return { meta: {} };
|
|
15
|
+
}
|
|
16
|
+
const personaMeta = (0, compiler_utils_1.requireSafe)(peraonaMeta[0]);
|
|
17
|
+
return { meta: personaMeta };
|
|
18
|
+
});
|
|
12
19
|
}
|
|
13
20
|
}
|
|
14
21
|
exports.PersonaCompiler = PersonaCompiler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persona.compiler.js","sourceRoot":"","sources":["../../../src/compiler/compilers/persona.compiler.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AAKxB,sDAAgD;AAOhD,MAAa,eAAe;
|
|
1
|
+
{"version":3,"file":"persona.compiler.js","sourceRoot":"","sources":["../../../src/compiler/compilers/persona.compiler.ts"],"names":[],"mappings":";;;;AAAA,+BAA4B;AAC5B,wDAAwB;AAKxB,sDAAgD;AAOhD,MAAa,eAAe;IAQpB,OAAO,CAAC,OAA6B;;YACzC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;YAEhC,MAAM,WAAW,GAAa,MAAM,IAAA,WAAI,EACtC,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAC7C,CAAC;YAEF,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;gBACxB,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;YACtB,CAAC;YAED,MAAM,WAAW,GAAqB,IAAA,4BAAW,EAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;YAElE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;QAC/B,CAAC;KAAA;CACF;AAvBD,0CAuBC"}
|
|
@@ -2,7 +2,6 @@ import { ProjectBuild } from '../../apis';
|
|
|
2
2
|
import { ICompiler } from '../compiler.interface';
|
|
3
3
|
type ProjectCompilerInput = {
|
|
4
4
|
projectRoot: string;
|
|
5
|
-
projectBuildRoot: string;
|
|
6
5
|
projectId: string;
|
|
7
6
|
};
|
|
8
7
|
export declare class ProjectCompiler implements ICompiler<ProjectCompilerInput, ProjectBuild> {
|
|
@@ -1,67 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProjectCompiler = void 0;
|
|
4
|
-
const
|
|
5
|
-
const integration_1 = require("@useparagon/core/integration");
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
6
5
|
const utils_1 = require("@useparagon/core/utils");
|
|
7
6
|
const apis_1 = require("../../apis");
|
|
8
|
-
const new_utils_1 = require("../../commands/new/new.utils");
|
|
9
7
|
const events_compiler_1 = require("./events.compiler");
|
|
10
8
|
const integrations_compiler_1 = require("./integrations.compiler");
|
|
11
9
|
const persona_compiler_1 = require("./persona.compiler");
|
|
12
10
|
class ProjectCompiler {
|
|
13
|
-
eventsCompiler;
|
|
14
|
-
integrationsCompiler;
|
|
15
|
-
personaCompiler;
|
|
16
11
|
constructor() {
|
|
17
12
|
this.eventsCompiler = new events_compiler_1.EventsCompiler();
|
|
18
13
|
this.integrationsCompiler = new integrations_compiler_1.IntegrationsCompiler();
|
|
19
14
|
this.personaCompiler = new persona_compiler_1.PersonaCompiler();
|
|
20
15
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
const persona = await this.personaCompiler.compile({
|
|
47
|
-
projectRoot: projectBuildRoot,
|
|
16
|
+
compile(options) {
|
|
17
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const { projectRoot, projectId } = options;
|
|
19
|
+
const previousProjectBuild = yield (0, apis_1.getProjectBuild)(projectId);
|
|
20
|
+
const persona = yield this.personaCompiler.compile({
|
|
21
|
+
projectRoot,
|
|
22
|
+
});
|
|
23
|
+
const userEvents = yield this.eventsCompiler.compile({
|
|
24
|
+
projectRoot,
|
|
25
|
+
previousEvents: Object.values(previousProjectBuild.events),
|
|
26
|
+
});
|
|
27
|
+
const integrations = yield this.integrationsCompiler.compile({
|
|
28
|
+
projectRoot,
|
|
29
|
+
events: userEvents,
|
|
30
|
+
previousProjectBuild,
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
events: (0, utils_1.indexBy)('id', userEvents),
|
|
34
|
+
integrations: (0, utils_1.indexBy)('name', integrations),
|
|
35
|
+
projectId,
|
|
36
|
+
persona,
|
|
37
|
+
};
|
|
48
38
|
});
|
|
49
|
-
const userEvents = await this.eventsCompiler.compile({
|
|
50
|
-
projectRoot: projectBuildRoot,
|
|
51
|
-
previousEvents: Object.values(previousProjectBuild.events),
|
|
52
|
-
});
|
|
53
|
-
const integrations = await this.integrationsCompiler.compile({
|
|
54
|
-
projectRoot: projectBuildRoot,
|
|
55
|
-
events: userEvents,
|
|
56
|
-
previousProjectBuild,
|
|
57
|
-
});
|
|
58
|
-
return {
|
|
59
|
-
secrets: [],
|
|
60
|
-
events: (0, utils_1.indexBy)('id', userEvents),
|
|
61
|
-
integrations: (0, utils_1.indexBy)('name', integrations),
|
|
62
|
-
projectId,
|
|
63
|
-
persona,
|
|
64
|
-
};
|
|
65
39
|
}
|
|
66
40
|
}
|
|
67
41
|
exports.ProjectCompiler = ProjectCompiler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.compiler.js","sourceRoot":"","sources":["../../../src/compiler/compilers/project.compiler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project.compiler.js","sourceRoot":"","sources":["../../../src/compiler/compilers/project.compiler.ts"],"names":[],"mappings":";;;;AAEA,kDAAiD;AAEjD,qCAA2D;AAE3D,uDAAmD;AACnD,mEAGiC;AACjC,yDAAqD;AAUrD,MAAa,eAAe;IAO1B;QACE,IAAI,CAAC,cAAc,GAAG,IAAI,gCAAc,EAAE,CAAC;QAC3C,IAAI,CAAC,oBAAoB,GAAG,IAAI,4CAAoB,EAAE,CAAC;QACvD,IAAI,CAAC,eAAe,GAAG,IAAI,kCAAe,EAAE,CAAC;IAC/C,CAAC;IAOK,OAAO,CAAC,OAA6B;;YACzC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC;YAE3C,MAAM,oBAAoB,GAAiB,MAAM,IAAA,sBAAe,EAAC,SAAS,CAAC,CAAC;YAE5E,MAAM,OAAO,GAAa,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC;gBAC3D,WAAW;aACZ,CAAC,CAAC;YAEH,MAAM,UAAU,GAAa,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;gBAC7D,WAAW;gBACX,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,oBAAoB,CAAC,MAAM,CAAC;aAC3D,CAAC,CAAC;YAEH,MAAM,YAAY,GAChB,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC;gBACtC,WAAW;gBACX,MAAM,EAAE,UAAU;gBAClB,oBAAoB;aACrB,CAAC,CAAC;YAEL,OAAO;gBACL,MAAM,EAAE,IAAA,eAAO,EAAC,IAAI,EAAE,UAAU,CAAC;gBACjC,YAAY,EAAE,IAAA,eAAO,EAAC,MAAM,EAAE,YAAY,CAAC;gBAC3C,SAAS;gBACT,OAAO;aACR,CAAC;QACJ,CAAC;KAAA;CACF;AA9CD,0CA8CC"}
|
|
@@ -4,60 +4,47 @@ exports.WorkflowsCompiler = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const glob_1 = require("glob");
|
|
6
6
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
const core_1 = require("@useparagon/core");
|
|
8
7
|
const execution_1 = require("@useparagon/core/execution");
|
|
9
8
|
const inputs_1 = require("@useparagon/core/inputs");
|
|
10
|
-
const integration_1 = require("@useparagon/core/integration");
|
|
11
9
|
const stateMachine_1 = require("@useparagon/core/stateMachine");
|
|
12
10
|
const conditional_1 = require("@useparagon/core/steps/library/conditional");
|
|
13
|
-
const utils_1 = require("@useparagon/core/utils");
|
|
14
11
|
const compiler_utils_1 = require("../compiler.utils");
|
|
15
12
|
class WorkflowsCompiler {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
});
|
|
23
|
-
const workflowOutputs = [];
|
|
24
|
-
const previousIntegrationBuild = previousProjectBuild.integrations?.[integration];
|
|
25
|
-
const intents = (previousIntegrationBuild?.dependencies?.intents ?? []).map((intent) => intent.name);
|
|
26
|
-
const triggers = (previousIntegrationBuild?.dependencies?.triggers ?? []).map((intent) => intent.name);
|
|
27
|
-
for (const workflowPath of workflowPaths) {
|
|
28
|
-
const workflowAbsolutePath = path_1.default.join(currentIntegrationPath, workflowPath);
|
|
29
|
-
const Workflow = (0, compiler_utils_1.requireSafe)(workflowAbsolutePath);
|
|
30
|
-
const workflowInstance = new Workflow({
|
|
31
|
-
events,
|
|
32
|
-
sharedInputs,
|
|
33
|
-
inputSources,
|
|
34
|
-
secrets: previousProjectBuild.secrets,
|
|
35
|
-
integrationType: (0, integration_1.isCustomIntegration)(integration) ? 'custom' : integration
|
|
13
|
+
compile(options) {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const { integration, projectRoot, events, previousProjectBuild, sharedInputs, inputSources, } = options;
|
|
17
|
+
const workflowPaths = yield (0, glob_1.glob)(path_1.default.join(projectRoot, 'integrations', integration, `workflows/*.js`), {
|
|
18
|
+
nodir: true,
|
|
36
19
|
});
|
|
37
|
-
|
|
38
|
-
|
|
20
|
+
const workflowOutputs = [];
|
|
21
|
+
for (const workflowPath of workflowPaths) {
|
|
22
|
+
const Workflow = (0, compiler_utils_1.requireSafe)(workflowPath);
|
|
23
|
+
const workflowInstance = new Workflow({
|
|
24
|
+
events,
|
|
25
|
+
sharedInputs,
|
|
26
|
+
inputSources,
|
|
27
|
+
});
|
|
28
|
+
const previousWorkflowBuild = (_a = previousProjectBuild.integrations) === null || _a === void 0 ? void 0 : _a[integration].workflows[workflowInstance.id];
|
|
29
|
+
workflowInstance.setPreviousStateMachine((0, stateMachine_1.workflowStepsToStateMachine)((_b = previousWorkflowBuild.steps) !== null && _b !== void 0 ? _b : []));
|
|
30
|
+
const context = new execution_1.Context();
|
|
31
|
+
const stateMachine = yield workflowInstance.define({}, context, {});
|
|
32
|
+
const workflowPermissions = workflowInstance.definePermissions(context);
|
|
33
|
+
workflowOutputs.push({
|
|
34
|
+
id: workflowInstance.id,
|
|
35
|
+
steps: Object.values(stateMachine.stepMap),
|
|
36
|
+
name: (0, compiler_utils_1.extractKeyFromPath)(workflowPath),
|
|
37
|
+
description: workflowInstance.description,
|
|
38
|
+
permissions: workflowPermissions
|
|
39
|
+
? (0, conditional_1.parseConditionInput)(workflowPermissions)
|
|
40
|
+
: undefined,
|
|
41
|
+
inputs: (0, inputs_1.convertUserDefinedInputsToSerializedInputs)(Object.values(workflowInstance.inputs), []),
|
|
42
|
+
defaultEnable: workflowInstance.defaultEnabled,
|
|
43
|
+
hidden: workflowInstance.hidden,
|
|
44
|
+
});
|
|
39
45
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const integrationInstance = new integration_1.Integration(integration, intents, triggers);
|
|
43
|
-
const context = new execution_1.Context();
|
|
44
|
-
const connectUser = new core_1.ConnectUser();
|
|
45
|
-
const stateMachine = await workflowInstance.define(integrationInstance, context, connectUser);
|
|
46
|
-
const workflowPermissions = workflowInstance.definePermissions(connectUser);
|
|
47
|
-
workflowOutputs.push({
|
|
48
|
-
id: workflowInstance.id,
|
|
49
|
-
steps: Object.values(stateMachine.stepMap),
|
|
50
|
-
name: workflowInstance.name,
|
|
51
|
-
description: workflowInstance.description,
|
|
52
|
-
permissions: workflowPermissions
|
|
53
|
-
? (0, conditional_1.parseConditionInput)(workflowPermissions)
|
|
54
|
-
: undefined,
|
|
55
|
-
inputs: (0, inputs_1.convertUserDefinedInputsToSerializedInputs)(Object.values(workflowInstance.inputs), inputSources),
|
|
56
|
-
defaultEnable: workflowInstance.defaultEnabled,
|
|
57
|
-
hidden: workflowInstance.hidden,
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
return workflowOutputs;
|
|
46
|
+
return workflowOutputs;
|
|
47
|
+
});
|
|
61
48
|
}
|
|
62
49
|
}
|
|
63
50
|
exports.WorkflowsCompiler = WorkflowsCompiler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.compiler.js","sourceRoot":"","sources":["../../../src/compiler/compilers/workflows.compiler.ts"],"names":[],"mappings":";;;;AAAA,+BAA4B;AAC5B,wDAAwB;
|
|
1
|
+
{"version":3,"file":"workflows.compiler.js","sourceRoot":"","sources":["../../../src/compiler/compilers/workflows.compiler.ts"],"names":[],"mappings":";;;;AAAA,+BAA4B;AAC5B,wDAAwB;AASxB,0DAAqD;AACrD,oDAIiC;AAEjC,gEAA4E;AAC5E,4EAGoD;AAIpD,sDAAoE;AA0BpE,MAAa,iBAAiB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AAE,gBAAgB,CAAC,WAAW;oBACzC,WAAW,EAAE,mBAAmB;wBAC9B,CAAC,CAAE,IAAA,iCAAmB,EAAC,mBAAmB,CAAkB;wBAC5D,CAAC,CAAC,SAAS;oBACb,MAAM,EAAE,IAAA,mDAA0C,EAChD,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,EACtC,EAAE,CACH;oBACD,aAAa,EAAE,gBAAgB,CAAC,cAAc;oBAC9C,MAAM,EAAE,gBAAgB,CAAC,MAAM;iBAChC,CAAC,CAAC;YACL,CAAC;YAED,OAAO,eAAe,CAAC;;KACxB;CACF;AA1ED,8CA0EC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare class TsCompiler {
|
|
2
2
|
private tsBinary;
|
|
3
|
-
run(
|
|
3
|
+
run({ configPath }: {
|
|
4
|
+
configPath?: string;
|
|
5
|
+
}): void;
|
|
4
6
|
private getDefaultTsconfigPath;
|
|
5
7
|
private getTsBinary;
|
|
6
8
|
transpileToJSCode(code: string): string;
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TsCompiler = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
7
8
|
const logger_1 = tslib_1.__importDefault(require("../logger"));
|
|
8
9
|
class TsCompiler {
|
|
9
|
-
|
|
10
|
-
run(rootPath, skipTypeErrors = false) {
|
|
10
|
+
run({ configPath }) {
|
|
11
11
|
const tsBinary = this.getTsBinary();
|
|
12
|
-
const tsConfigPath = this.getDefaultTsconfigPath(
|
|
12
|
+
const tsConfigPath = configPath !== null && configPath !== void 0 ? configPath : this.getDefaultTsconfigPath();
|
|
13
13
|
const formatHost = {
|
|
14
14
|
getCanonicalFileName: (path) => path,
|
|
15
15
|
getCurrentDirectory: tsBinary.sys.getCurrentDirectory,
|
|
@@ -18,13 +18,10 @@ class TsCompiler {
|
|
|
18
18
|
const parsedCmd = tsBinary.getParsedCommandLineOfConfigFile(tsConfigPath, undefined, tsBinary.sys);
|
|
19
19
|
const { options, fileNames, projectReferences } = parsedCmd;
|
|
20
20
|
const createProgram = tsBinary.createIncrementalProgram || tsBinary.createProgram;
|
|
21
|
-
const program = createProgram.call(
|
|
21
|
+
const program = createProgram.call(ts, {
|
|
22
22
|
rootNames: fileNames,
|
|
23
23
|
projectReferences,
|
|
24
|
-
options
|
|
25
|
-
...options,
|
|
26
|
-
noEmitOnError: !skipTypeErrors,
|
|
27
|
-
},
|
|
24
|
+
options,
|
|
28
25
|
});
|
|
29
26
|
const emitResult = program.emit();
|
|
30
27
|
const diagnostics = tsBinary
|
|
@@ -33,13 +30,16 @@ class TsCompiler {
|
|
|
33
30
|
if (diagnostics.length > 0) {
|
|
34
31
|
console.error(tsBinary.formatDiagnosticsWithColorAndContext(diagnostics, formatHost));
|
|
35
32
|
console.info(`Found ${diagnostics.length} error(s).` + tsBinary.sys.newLine);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
}
|
|
34
|
+
if (diagnostics.length) {
|
|
35
|
+
process.exit(1);
|
|
39
36
|
}
|
|
40
37
|
}
|
|
41
|
-
getDefaultTsconfigPath(
|
|
42
|
-
|
|
38
|
+
getDefaultTsconfigPath() {
|
|
39
|
+
const tsConfigFileName = fs_extra_1.default.existsSync((0, path_1.join)(process.cwd(), 'tsconfig.build.json'))
|
|
40
|
+
? 'tsconfig.build.json'
|
|
41
|
+
: 'tsconfig.json';
|
|
42
|
+
return (0, path_1.join)(process.cwd(), tsConfigFileName);
|
|
43
43
|
}
|
|
44
44
|
getTsBinary() {
|
|
45
45
|
if (this.tsBinary) {
|
|
@@ -52,13 +52,13 @@ class TsCompiler {
|
|
|
52
52
|
this.tsBinary = require(tsBinaryPath);
|
|
53
53
|
return this.tsBinary;
|
|
54
54
|
}
|
|
55
|
-
catch {
|
|
55
|
+
catch (_a) {
|
|
56
56
|
logger_1.default.fatal('TypeScript could not be found! Please, install "typescript" package.');
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
59
|
transpileToJSCode(code) {
|
|
60
|
-
const result =
|
|
61
|
-
compilerOptions: { module:
|
|
60
|
+
const result = ts.transpileModule(code, {
|
|
61
|
+
compilerOptions: { module: ts.ModuleKind.ES2015 },
|
|
62
62
|
});
|
|
63
63
|
return result.outputText;
|
|
64
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ts.compiler.js","sourceRoot":"","sources":["../../src/compiler/ts.compiler.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"ts.compiler.js","sourceRoot":"","sources":["../../src/compiler/ts.compiler.ts"],"names":[],"mappings":";;;;AAAA,gEAA0B;AAC1B,+BAA4B;AAC5B,uDAAiC;AAEjC,+DAA+B;AAG/B,MAAa,UAAU;IAOd,GAAG,CAAC,EAAE,UAAU,EAA2B;QAChD,MAAM,QAAQ,GAAc,IAAI,CAAC,WAAW,EAAE,CAAC;QAE/C,MAAM,YAAY,GAAW,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAEzE,MAAM,UAAU,GAA6B;YAC3C,oBAAoB,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI;YAC5C,mBAAmB,EAAE,QAAQ,CAAC,GAAG,CAAC,mBAAmB;YACrD,UAAU,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO;SACvC,CAAC;QAEF,MAAM,SAAS,GACb,QAAQ,CAAC,gCAAgC,CACvC,YAAY,EACZ,SAAS,EACT,QAAQ,CAAC,GAAwC,CAClD,CAAC;QAEJ,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,GAAG,SAAU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BACjD,KAAK,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;aACvB,CAAC,CAAC;YACH,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAc,CAAC;YAEnD,OAAO,IAAI,CAAC,QAAS,CAAC;QACxB,CAAC;QAAC,WAAM,CAAC;YACP,gBAAM,CAAC,KAAK,CACV,sEAAsE,CACvE,CAAC;QACJ,CAAC;IACH,CAAC;IAOM,iBAAiB,CAAC,IAAY;QACnC,MAAM,MAAM,GAAG,EAAE,CAAC,eAAe,CAAC,IAAI,EAAE;YACtC,eAAe,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE;SAClD,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC,UAAU,CAAC;IAC3B,CAAC;CACF;AAvGD,gCAuGC;AAED,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;AAEpC,kBAAe,UAAU,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DEFAULT_PROFILE = exports.SYSTEM_CONFIG_DIR_PATH = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const node_os_1 = require("node:os");
|
|
6
6
|
const path = tslib_1.__importStar(require("node:path"));
|
|
7
7
|
exports.SYSTEM_CONFIG_DIR_PATH = path.resolve((0, node_os_1.homedir)(), '.paragon');
|
|
8
8
|
exports.DEFAULT_PROFILE = 'default';
|
|
9
|
-
exports.PROJECT_CONFIG_FILE_NAME = 'project.json';
|
|
10
9
|
//# sourceMappingURL=config.constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.constants.js","sourceRoot":"","sources":["../../src/config/config.constants.ts"],"names":[],"mappings":";;;;AAAA,qCAAkC;AAClC,wDAAkC;AAKrB,QAAA,sBAAsB,GAAW,IAAI,CAAC,OAAO,CACxD,IAAA,iBAAO,GAAE,EACT,UAAU,CACX,CAAC;AAKW,QAAA,eAAe,GAAW,SAAS,CAAC
|
|
1
|
+
{"version":3,"file":"config.constants.js","sourceRoot":"","sources":["../../src/config/config.constants.ts"],"names":[],"mappings":";;;;AAAA,qCAAkC;AAClC,wDAAkC;AAKrB,QAAA,sBAAsB,GAAW,IAAI,CAAC,OAAO,CACxD,IAAA,iBAAO,GAAE,EACT,UAAU,CACX,CAAC;AAKW,QAAA,eAAe,GAAW,SAAS,CAAC"}
|