@useparagon/cli 1.0.14-canary.6 → 1.0.14
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/{types/integration.types.d.ts → api.types.d.ts} +74 -32
- package/dist/apis/{types/project.types.js → api.types.js} +1 -3
- package/dist/apis/api.types.js.map +1 -0
- package/dist/apis/auth.api.d.ts +1 -1
- package/dist/apis/auth.api.js.map +1 -1
- package/dist/apis/base.api.js +12 -34
- package/dist/apis/base.api.js.map +1 -1
- package/dist/apis/index.d.ts +1 -1
- package/dist/apis/index.js +1 -1
- package/dist/apis/index.js.map +1 -1
- package/dist/apis/integration.api.d.ts +1 -1
- package/dist/apis/integration.api.js +2 -5
- package/dist/apis/integration.api.js.map +1 -1
- package/dist/apis/project.api.d.ts +1 -1
- package/dist/apis/project.api.js +1 -2
- package/dist/apis/project.api.js.map +1 -1
- package/dist/codegen/codegen.types.d.ts +1 -5
- package/dist/codegen/codegen.utils.d.ts +1 -3
- package/dist/codegen/codegen.utils.js +9 -97
- package/dist/codegen/codegen.utils.js.map +1 -1
- package/dist/codegen/codegens/integration.codegen.d.ts +2 -5
- package/dist/codegen/codegens/integration.codegen.js +7 -40
- package/dist/codegen/codegens/integration.codegen.js.map +1 -1
- package/dist/codegen/codegens/intent.codegen.d.ts +1 -1
- package/dist/codegen/codegens/intent.codegen.js +0 -3
- package/dist/codegen/codegens/intent.codegen.js.map +1 -1
- package/dist/codegen/codegens/source.codegen.d.ts +1 -1
- package/dist/codegen/codegens/source.codegen.js +7 -30
- package/dist/codegen/codegens/source.codegen.js.map +1 -1
- package/dist/codegen/codegens/workflow.codegen.d.ts +1 -1
- package/dist/codegen/codegens/workflow.codegen.js +22 -43
- package/dist/codegen/codegens/workflow.codegen.js.map +1 -1
- package/dist/commands/auth/login/login.types.d.ts +1 -1
- package/dist/commands/build/build.types.d.ts +1 -1
- package/dist/commands/init/init.action.js +0 -1
- package/dist/commands/init/init.action.js.map +1 -1
- package/dist/commands/new/integration/integration.action.js +0 -2
- package/dist/commands/new/integration/integration.action.js.map +1 -1
- package/dist/commands/new/new.command.js +1 -3
- package/dist/commands/new/new.command.js.map +1 -1
- package/dist/commands/new/workflow/workflow.action.js +1 -3
- package/dist/commands/new/workflow/workflow.action.js.map +1 -1
- package/dist/commands/pull/pull.action.js +1 -10
- package/dist/commands/pull/pull.action.js.map +1 -1
- package/dist/compiler/compiler.types.d.ts +1 -5
- package/dist/compiler/compiler.types.js +1 -1
- package/dist/compiler/compiler.types.js.map +1 -1
- package/dist/compiler/compiler.utils.js +0 -24
- package/dist/compiler/compiler.utils.js.map +1 -1
- package/dist/compiler/compilers/changeLog.compiler.d.ts +1 -1
- package/dist/compiler/compilers/changeLog.compiler.js +4 -11
- package/dist/compiler/compilers/changeLog.compiler.js.map +1 -1
- package/dist/compiler/compilers/integrations.compiler.d.ts +1 -6
- package/dist/compiler/compilers/integrations.compiler.js +3 -60
- package/dist/compiler/compilers/integrations.compiler.js.map +1 -1
- package/dist/compiler/compilers/project.compiler.d.ts +0 -1
- package/dist/compiler/compilers/project.compiler.js +2 -16
- package/dist/compiler/compilers/project.compiler.js.map +1 -1
- package/dist/compiler/compilers/workflows.compiler.d.ts +1 -2
- package/dist/compiler/compilers/workflows.compiler.js +1 -2
- package/dist/compiler/compilers/workflows.compiler.js.map +1 -1
- package/package.json +2 -2
- package/dist/apis/types/customTrigger.types.d.ts +0 -57
- package/dist/apis/types/customTrigger.types.js +0 -3
- package/dist/apis/types/customTrigger.types.js.map +0 -1
- package/dist/apis/types/error.types.d.ts +0 -12
- package/dist/apis/types/error.types.js +0 -3
- package/dist/apis/types/error.types.js.map +0 -1
- package/dist/apis/types/index.d.ts +0 -6
- package/dist/apis/types/index.js +0 -10
- package/dist/apis/types/index.js.map +0 -1
- package/dist/apis/types/integration.types.js +0 -3
- package/dist/apis/types/integration.types.js.map +0 -1
- package/dist/apis/types/project.types.d.ts +0 -59
- package/dist/apis/types/project.types.js.map +0 -1
- package/dist/apis/types/resource.types.d.ts +0 -99
- package/dist/apis/types/resource.types.js +0 -41
- package/dist/apis/types/resource.types.js.map +0 -1
- package/dist/apis/types/user.types.d.ts +0 -6
- package/dist/apis/types/user.types.js +0 -3
- package/dist/apis/types/user.types.js.map +0 -1
- package/dist/apis/types/workflow.types.d.ts +0 -8
- package/dist/apis/types/workflow.types.js +0 -3
- package/dist/apis/types/workflow.types.js.map +0 -1
- package/dist/codegen/codegens/resource.codegen.d.ts +0 -3
- package/dist/codegen/codegens/resource.codegen.js +0 -109
- package/dist/codegen/codegens/resource.codegen.js.map +0 -1
- package/dist/codegen/codegens/trigger.codegen.d.ts +0 -3
- package/dist/codegen/codegens/trigger.codegen.js +0 -302
- package/dist/codegen/codegens/trigger.codegen.js.map +0 -1
- package/dist/commands/new/trigger/index.d.ts +0 -1
- package/dist/commands/new/trigger/index.js +0 -5
- package/dist/commands/new/trigger/index.js.map +0 -1
- package/dist/commands/new/trigger/trigger.action.d.ts +0 -5
- package/dist/commands/new/trigger/trigger.action.js +0 -117
- package/dist/commands/new/trigger/trigger.action.js.map +0 -1
- package/dist/commands/new/trigger/trigger.command.d.ts +0 -8
- package/dist/commands/new/trigger/trigger.command.js +0 -25
- package/dist/commands/new/trigger/trigger.command.js.map +0 -1
- package/dist/commands/new/trigger/trigger.types.d.ts +0 -3
- package/dist/commands/new/trigger/trigger.types.js +0 -3
- package/dist/commands/new/trigger/trigger.types.js.map +0 -1
- package/dist/compiler/compilers/resources.compiler.d.ts +0 -15
- package/dist/compiler/compilers/resources.compiler.js +0 -175
- package/dist/compiler/compilers/resources.compiler.js.map +0 -1
- package/dist/compiler/compilers/triggers.compiler.d.ts +0 -12
- package/dist/compiler/compilers/triggers.compiler.js +0 -175
- package/dist/compiler/compilers/triggers.compiler.js.map +0 -1
|
@@ -1,30 +1,11 @@
|
|
|
1
|
-
import { AuthenticationScheme } from '@useparagon/core';
|
|
1
|
+
import { AuthenticationScheme, IStep } from '@useparagon/core';
|
|
2
|
+
import { IEvent } from '@useparagon/core/event';
|
|
2
3
|
import { InputSource, SerializedInput, SidebarInputType } from '@useparagon/core/inputs';
|
|
3
|
-
import { ConnectPortalThemeValues
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
type EmptyStrategy = {
|
|
9
|
-
strategy?: undefined;
|
|
10
|
-
};
|
|
11
|
-
export type HTTPStrategyConfig = {
|
|
12
|
-
strategy: ConnectUserProfileConfigStrategy.HTTP;
|
|
13
|
-
userProfileRequestUrl: TokenizedSource<DataType.STRING>;
|
|
14
|
-
urlParameters: Array<KeyedSource<DataType.STRING>>;
|
|
15
|
-
headers: Array<KeyedSource<DataType.STRING>>;
|
|
16
|
-
rawBody: TokenizedSource<DataType.STRING>;
|
|
17
|
-
body: Array<KeyedSource<DataType.ANY>>;
|
|
18
|
-
requireSuccess: boolean;
|
|
19
|
-
requestMethod: HttpMethod;
|
|
20
|
-
requestBodyType: RequestBodyType;
|
|
21
|
-
};
|
|
22
|
-
export type JWTStrategyConfig = {
|
|
23
|
-
strategy: ConnectUserProfileConfigStrategy.JWT;
|
|
24
|
-
tokenPayload: TokenizedSource<DataType.STRING>;
|
|
25
|
-
requireSuccess: boolean;
|
|
26
|
-
};
|
|
27
|
-
export type UserProfileConfig = EmptyStrategy | HTTPStrategyConfig | JWTStrategyConfig;
|
|
4
|
+
import { ConnectPortalThemeValues } from '@useparagon/core/integration';
|
|
5
|
+
import { IPersona } from '@useparagon/core/persona';
|
|
6
|
+
import { DataType, Operator, OrConditions, TokenizedSource } from '@useparagon/core/resolvers';
|
|
7
|
+
import { ISecret, SecretDTO } from '@useparagon/core/secret';
|
|
8
|
+
import { RequestAuthorization } from '@useparagon/core/steps/library/request';
|
|
28
9
|
export type InputKeyVisibilityConfig = {
|
|
29
10
|
inputId: string;
|
|
30
11
|
path?: string[];
|
|
@@ -103,12 +84,14 @@ export interface ICustomIntegration {
|
|
|
103
84
|
testEndpointPath?: TokenizedSource<DataType.STRING>;
|
|
104
85
|
apiAuthorization?: RequestAuthorization;
|
|
105
86
|
isPublished?: boolean;
|
|
106
|
-
userProfileConfig?: UserProfileConfig;
|
|
107
87
|
}
|
|
108
|
-
export
|
|
88
|
+
export interface WorkflowBuild {
|
|
89
|
+
id: string;
|
|
109
90
|
name: string;
|
|
110
|
-
|
|
111
|
-
|
|
91
|
+
steps: IStep[];
|
|
92
|
+
isDraft?: boolean;
|
|
93
|
+
dateCreated?: string;
|
|
94
|
+
}
|
|
112
95
|
export interface IntegrationBuild {
|
|
113
96
|
id: string;
|
|
114
97
|
config: {
|
|
@@ -119,6 +102,65 @@ export interface IntegrationBuild {
|
|
|
119
102
|
active?: boolean;
|
|
120
103
|
dependencies?: IntegrationDependencies;
|
|
121
104
|
customIntegration?: ICustomIntegration;
|
|
122
|
-
customTriggers?: Record<string, ICustomTrigger>;
|
|
123
105
|
}
|
|
124
|
-
export {
|
|
106
|
+
export interface ProjectBuild {
|
|
107
|
+
projectId: string;
|
|
108
|
+
projectName?: string;
|
|
109
|
+
events: Record<string, IEvent>;
|
|
110
|
+
persona: IPersona;
|
|
111
|
+
integrations: Record<string, IntegrationBuild | undefined>;
|
|
112
|
+
secrets: (ISecret | SecretDTO)[];
|
|
113
|
+
}
|
|
114
|
+
export type EntityDiffBase = {
|
|
115
|
+
added: string[];
|
|
116
|
+
deleted: string[];
|
|
117
|
+
updated: string[];
|
|
118
|
+
};
|
|
119
|
+
export declare enum ProjectEntity {
|
|
120
|
+
AppEvent = "events",
|
|
121
|
+
CustomIntegration = "customIntegrations",
|
|
122
|
+
Integration = "integrations",
|
|
123
|
+
IntegrationConfig = "configs",
|
|
124
|
+
Workflow = "workflows",
|
|
125
|
+
Step = "steps",
|
|
126
|
+
Secret = "secret"
|
|
127
|
+
}
|
|
128
|
+
export type ProjectComparison = {
|
|
129
|
+
comparisonDiff: Partial<Record<ProjectEntity, EntityDiffBase>>;
|
|
130
|
+
defaultEnabledWorkflows: WorkflowDefaultEnableChangeLog[];
|
|
131
|
+
requiredSettings: IntegrationInputChangeLog[];
|
|
132
|
+
integrationsRequiredOauthConfig: string[];
|
|
133
|
+
disabledIntegrations: string[];
|
|
134
|
+
integrationNameMap: Record<string, string>;
|
|
135
|
+
};
|
|
136
|
+
export type AffectedPersona = {
|
|
137
|
+
personaId: string;
|
|
138
|
+
endUserId: string;
|
|
139
|
+
integrationId: string;
|
|
140
|
+
connectCredentialId: string;
|
|
141
|
+
name: string | undefined;
|
|
142
|
+
email: string | undefined;
|
|
143
|
+
};
|
|
144
|
+
export type IntegrationInputChangeLog = {
|
|
145
|
+
inputTitle: string;
|
|
146
|
+
integrationId: string;
|
|
147
|
+
integrationType: string;
|
|
148
|
+
affectedUsers: AffectedPersona[];
|
|
149
|
+
workflowId?: string;
|
|
150
|
+
};
|
|
151
|
+
export type WorkflowDefaultEnableChangeLog = {
|
|
152
|
+
integrationId: string;
|
|
153
|
+
integrationType: string;
|
|
154
|
+
affectedUsers: AffectedPersona[];
|
|
155
|
+
workflowId: string;
|
|
156
|
+
};
|
|
157
|
+
export type IUser = {
|
|
158
|
+
firstName: string;
|
|
159
|
+
middleName: string;
|
|
160
|
+
lastName: string;
|
|
161
|
+
email: string;
|
|
162
|
+
};
|
|
163
|
+
export type IntegrationMetadata = {
|
|
164
|
+
name: string;
|
|
165
|
+
title: string;
|
|
166
|
+
};
|
|
@@ -10,7 +10,5 @@ var ProjectEntity;
|
|
|
10
10
|
ProjectEntity["Workflow"] = "workflows";
|
|
11
11
|
ProjectEntity["Step"] = "steps";
|
|
12
12
|
ProjectEntity["Secret"] = "secret";
|
|
13
|
-
ProjectEntity["CustomTrigger"] = "customTriggers";
|
|
14
|
-
ProjectEntity["Resource"] = "resources";
|
|
15
13
|
})(ProjectEntity || (exports.ProjectEntity = ProjectEntity = {}));
|
|
16
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=api.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.types.js","sourceRoot":"","sources":["../../src/apis/api.types.ts"],"names":[],"mappings":";;;AA+ZA,IAAY,aAQX;AARD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,yDAAwC,CAAA;IACxC,6CAA4B,CAAA;IAC5B,8CAA6B,CAAA;IAC7B,uCAAsB,CAAA;IACtB,+BAAc,CAAA;IACd,kCAAiB,CAAA;AACnB,CAAC,EARW,aAAa,6BAAb,aAAa,QAQxB"}
|
package/dist/apis/auth.api.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.api.js","sourceRoot":"","sources":["../../src/apis/auth.api.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"auth.api.js","sourceRoot":"","sources":["../../src/apis/auth.api.ts"],"names":[],"mappings":";;;AACA,yCAA8C;AAOvC,MAAM,KAAK,GAAG,KAAK,EAAE,cAG3B,EAAkB,EAAE;IACnB,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,kBAAkB,EAAE,cAAc,CAAC,CAAC;IACvD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAA,sBAAW,EAAC,qBAAqB,EAAE,KAAK,CAAC,CAAC;IACnD,CAAC;AACH,CAAC,CAAC;AATW,QAAA,KAAK,SAShB"}
|
package/dist/apis/base.api.js
CHANGED
|
@@ -53,43 +53,21 @@ const getToken = async () => {
|
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
55
|
exports.getToken = getToken;
|
|
56
|
-
const flattenValidationError = (error) => {
|
|
57
|
-
if (Array.isArray(error)) {
|
|
58
|
-
return error
|
|
59
|
-
.flatMap((error) => {
|
|
60
|
-
return [error, flattenValidationError(error.children || [])].flatMap((error) => typeof error === 'string' ? error : flattenValidationError(error));
|
|
61
|
-
})
|
|
62
|
-
.filter((errorString) => errorString)
|
|
63
|
-
.join(', ');
|
|
64
|
-
}
|
|
65
|
-
return Object.values(error.constraints || {}).join(', ');
|
|
66
|
-
};
|
|
67
56
|
const logApiError = (apiDescription, error) => {
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
errorMessage = errorData.message;
|
|
78
|
-
errorCode = errorData.code;
|
|
79
|
-
}
|
|
80
|
-
else if (typeof error.message === 'string') {
|
|
81
|
-
errorMessage = error.message;
|
|
57
|
+
const errorMessage = error['response']?.['data']?.['message'] || error.message;
|
|
58
|
+
const errorCode = error['response']?.['data']?.['code'];
|
|
59
|
+
if (errorCode === '3007') {
|
|
60
|
+
const existingWorkflows = error['response']?.['data']?.['meta'] || [];
|
|
61
|
+
const workflowMessages = existingWorkflows
|
|
62
|
+
.map((workflow) => `- Workflow "${workflow.workflowName}" exists with the same ID in Project "${workflow.projectName}"`)
|
|
63
|
+
.join('\n');
|
|
64
|
+
logger_1.default.fatal(`${apiDescription}
|
|
65
|
+
${workflowMessages}`);
|
|
82
66
|
}
|
|
83
|
-
else
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
if (errorCode) {
|
|
87
|
-
logger_1.default.fatal(`${apiDescription}
|
|
88
|
-
- Details: ${errorMessage}
|
|
89
|
-
- ErrorCode: ${errorCode}`);
|
|
90
|
-
}
|
|
91
|
-
logger_1.default.fatal(`${apiDescription}
|
|
67
|
+
else {
|
|
68
|
+
logger_1.default.fatal(`${apiDescription}
|
|
92
69
|
- Details: ${errorMessage}`);
|
|
70
|
+
}
|
|
93
71
|
};
|
|
94
72
|
exports.logApiError = logApiError;
|
|
95
73
|
const get = async (path, options) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.api.js","sourceRoot":"","sources":["../../src/apis/base.api.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,+DAA+B;AAE/B,sCAOmB;AACnB,0CAA8C;
|
|
1
|
+
{"version":3,"file":"base.api.js","sourceRoot":"","sources":["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ACtE,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,MAAM,IAAA,gBAAQ,GAAE,EAAE;YAC3C,WAAW,EAAE,WAAW;SACzB;KACF,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC,CAAC;AATW,QAAA,GAAG,OASd"}
|
package/dist/apis/index.d.ts
CHANGED
package/dist/apis/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./api.types"), exports);
|
|
4
5
|
tslib_1.__exportStar(require("./auth.api"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./integration.api"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./project.api"), exports);
|
|
7
|
-
tslib_1.__exportStar(require("./types"), exports);
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
package/dist/apis/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":";;;AAAA,qDAA2B;AAC3B,4DAAkC;AAClC,wDAA8B
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,qDAA2B;AAC3B,4DAAkC;AAClC,wDAA8B"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { IntegrationDependencies, IntegrationMetadata } from './types';
|
|
1
|
+
import { IntegrationDependencies, IntegrationMetadata } from './api.types';
|
|
2
2
|
export declare const getIntegrationDependencies: (integrations: string[]) => Promise<Record<string, IntegrationDependencies>>;
|
|
3
3
|
export declare const getDefaultIntegrations: () => Promise<IntegrationMetadata[]>;
|
|
@@ -7,12 +7,9 @@ const getIntegrationDependencies = async (integrations) => {
|
|
|
7
7
|
const nativeIntegrations = integrations.filter((integration) => !(0, core_1.isCustomIntegration)(integration));
|
|
8
8
|
try {
|
|
9
9
|
const integrationTypes = await (0, base_api_1.post)('graphite/integrations', {
|
|
10
|
-
integrations: nativeIntegrations
|
|
10
|
+
integrations: nativeIntegrations
|
|
11
11
|
});
|
|
12
|
-
return Object.fromEntries(nativeIntegrations.map((integration, index) => [
|
|
13
|
-
integration,
|
|
14
|
-
integrationTypes[index],
|
|
15
|
-
]));
|
|
12
|
+
return Object.fromEntries(nativeIntegrations.map((integration, index) => ([integration, integrationTypes[index]])));
|
|
16
13
|
}
|
|
17
14
|
catch (error) {
|
|
18
15
|
return (0, base_api_1.logApiError)('Failed to get integration data.', error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.api.js","sourceRoot":"","sources":["../../src/apis/integration.api.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;
|
|
1
|
+
{"version":3,"file":"integration.api.js","sourceRoot":"","sources":["../../src/apis/integration.api.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;AAGvD,yCAAoD;AAM7C,MAAM,0BAA0B,GAAG,KAAK,EAC7C,YAAsB,EAC4B,EAAE;IACpD,MAAM,kBAAkB,GAAa,YAAY,CAAC,MAAM,CAAC,CAAC,WAAmB,EAAE,EAAE,CAAC,CAAC,IAAA,0BAAmB,EAAC,WAAW,CAAC,CAAC,CAAC;IACrH,IAAI,CAAC;QACH,MAAM,gBAAgB,GAA8B,MAAM,IAAA,eAAI,EAAC,uBAAuB,EAAE;YACtF,YAAY,EAAE,kBAAkB;SACjC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAA,sBAAW,EAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC,CAAC;AAZW,QAAA,0BAA0B,8BAYrC;AAMK,MAAM,sBAAsB,GAAG,KAAK,IAEzC,EAAE;IACF,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,uBAAuB,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAA,sBAAW,EAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;IACnE,CAAC;AACH,CAAC,CAAC;AARW,QAAA,sBAAsB,0BAQjC"}
|
package/dist/apis/project.api.js
CHANGED
|
@@ -39,7 +39,6 @@ const getProjectBuild = async (projectId) => {
|
|
|
39
39
|
events: {},
|
|
40
40
|
secrets: [],
|
|
41
41
|
persona: { meta: {} },
|
|
42
|
-
resources: {},
|
|
43
42
|
};
|
|
44
43
|
}
|
|
45
44
|
return (0, base_api_1.logApiError)('Failed to get project.', error);
|
|
@@ -51,7 +50,7 @@ const syncProject = async (build) => {
|
|
|
51
50
|
await (0, base_api_1.put)('graphite/projects', build);
|
|
52
51
|
}
|
|
53
52
|
catch (error) {
|
|
54
|
-
return (0, base_api_1.logApiError)('
|
|
53
|
+
return (0, base_api_1.logApiError)('Error occurred during push:', error);
|
|
55
54
|
}
|
|
56
55
|
};
|
|
57
56
|
exports.syncProject = syncProject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.api.js","sourceRoot":"","sources":["../../src/apis/project.api.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;
|
|
1
|
+
{"version":3,"file":"project.api.js","sourceRoot":"","sources":["../../src/apis/project.api.ts"],"names":[],"mappings":";;;AAAA,2CAAuD;AAOvD,yCAAyD;AACzD,uDAA+D;AAMxD,MAAM,cAAc,GAAG,KAAK,IAEjC,EAAE;IACF,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,mBAAmB,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,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,CAAC;IACtD,CAAC;AACH,CAAC,CAAC;AAzCW,QAAA,eAAe,mBAyC1B;AAMK,MAAM,WAAW,GAAG,KAAK,EAAE,KAAmB,EAAiB,EAAE;IACtE,IAAI,CAAC;QACH,MAAM,IAAA,cAAG,EAAC,mBAAmB,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAA,sBAAW,EAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB;AAEK,MAAM,yBAAyB,GAAG,KAAK,EAC5C,mBAAiC,EACL,EAAE;IAC9B,IAAI,CAAC;QACH,MAAM,UAAU,GAAsB,MAAM,IAAA,eAAI,EAC9C,qBAAqB,mBAAmB,CAAC,SAAS,aAAa,EAC/D,mBAAmB,CACpB,CAAC;QAEF,OAAO,UAAU,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAA,sBAAW,EAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;IACjE,CAAC;AACH,CAAC,CAAC;AAbW,QAAA,yBAAyB,6BAapC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IStep } from '@useparagon/core';
|
|
2
2
|
import { InputSource, SerializedInput } from '@useparagon/core/inputs';
|
|
3
3
|
import { ISecret, SecretDTO } from '@useparagon/core/secret';
|
|
4
|
-
import { IntegrationDependencies, IntegrationWorkflowMeta } from '../apis/types';
|
|
4
|
+
import { IntegrationDependencies, IntegrationWorkflowMeta } from '../apis/api.types';
|
|
5
5
|
export type ProjectDependencies = {
|
|
6
6
|
eventIdToNameMap: Record<string, string>;
|
|
7
7
|
secrets: (ISecret | SecretDTO)[];
|
|
@@ -14,8 +14,6 @@ export type WorkflowDependencies = ProjectDependencies & {
|
|
|
14
14
|
workflowMeta: IntegrationWorkflowMeta;
|
|
15
15
|
sharedInputs: SerializedInput[];
|
|
16
16
|
inputSources: InputSource[];
|
|
17
|
-
customTriggerIdToNameMap: Record<string, string>;
|
|
18
|
-
resourceIdToNameMap: Record<string, string>;
|
|
19
17
|
};
|
|
20
18
|
export type StepDependencies = {
|
|
21
19
|
integration: WorkflowDependencies['integration'];
|
|
@@ -28,6 +26,4 @@ export type StepDependencies = {
|
|
|
28
26
|
secrets: (ISecret | SecretDTO)[];
|
|
29
27
|
currentStepId?: string;
|
|
30
28
|
upstreamStepIds: Set<string>;
|
|
31
|
-
customTriggerIdToNameMap: Record<string, string>;
|
|
32
|
-
resourceIdToNameMap: Record<string, string>;
|
|
33
29
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { KeyedSource } from '@useparagon/core/resolvers';
|
|
2
|
-
import { IntegrationBuild, IntegrationIntent, IntentInputKeyConfig, ProjectBuild } from '../apis/types';
|
|
3
|
-
import { ResourceBuild } from '../apis/types/resource.types';
|
|
2
|
+
import { IntegrationBuild, IntegrationIntent, IntentInputKeyConfig, ProjectBuild } from '../apis/api.types';
|
|
4
3
|
import { ProjectDependencies } from '../compiler/compiler.types';
|
|
5
4
|
export declare const generateIntegrationFiles: (integrationName: string, integrationOutput: IntegrationBuild, projectDependencies: ProjectDependencies, projectRoot: string) => Promise<void>;
|
|
6
|
-
export declare const generateResourceFiles: (resource: ResourceBuild, projectDependencies: ProjectDependencies, projectRoot: string) => Promise<void>;
|
|
7
5
|
export declare const generateProjectFiles: (projectBuild: ProjectBuild, projectRoot: string) => Promise<void>;
|
|
8
6
|
export declare const getInputsForIntent: (intent: IntegrationIntent, actionParameters: KeyedSource[]) => IntentInputKeyConfig[];
|
|
@@ -1,61 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getInputsForIntent = exports.generateProjectFiles = exports.
|
|
3
|
+
exports.getInputsForIntent = exports.generateProjectFiles = exports.generateIntegrationFiles = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
6
6
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
const core_1 = require("@useparagon/core");
|
|
8
7
|
const inputs_1 = require("@useparagon/core/inputs");
|
|
9
8
|
const utils_1 = require("@useparagon/core/utils");
|
|
10
9
|
const file_1 = require("../helpers/file");
|
|
11
10
|
const event_codegen_1 = require("./codegens/event.codegen");
|
|
12
11
|
const integration_codegen_1 = require("./codegens/integration.codegen");
|
|
13
12
|
const persona_codegen_1 = require("./codegens/persona.codegen");
|
|
14
|
-
const resource_codegen_1 = require("./codegens/resource.codegen");
|
|
15
|
-
const trigger_codegen_1 = require("./codegens/trigger.codegen");
|
|
16
13
|
const workflow_codegen_1 = require("./codegens/workflow.codegen");
|
|
17
14
|
const generateIntegrationFiles = async (integrationName, integrationOutput, projectDependencies, projectRoot) => {
|
|
18
15
|
if (integrationName === 'undefined') {
|
|
19
16
|
integrationName = 'custom.';
|
|
20
17
|
}
|
|
21
|
-
const { eventIdToNameMap, secrets
|
|
18
|
+
const { eventIdToNameMap, secrets } = projectDependencies;
|
|
22
19
|
const integrationPath = path_1.default.join(projectRoot, 'integrations', integrationName);
|
|
23
20
|
await fs_extra_1.default.promises.mkdir(integrationPath, {
|
|
24
21
|
recursive: true,
|
|
25
22
|
});
|
|
26
23
|
const sharedInputs = integrationOutput.config.values.sharedMeta?.inputs ?? [];
|
|
27
|
-
const configCode = (0, integration_codegen_1.integrationToConfigCode)(integrationOutput, integrationName
|
|
24
|
+
const configCode = (0, integration_codegen_1.integrationToConfigCode)(integrationOutput, integrationName);
|
|
28
25
|
const inputSources = integrationOutput.dependencies?.inputs ?? [];
|
|
29
|
-
const
|
|
26
|
+
const inputsSouceCode = (0, integration_codegen_1.integrationInputsToCode)(integrationName, sharedInputs, inputSources);
|
|
30
27
|
await Promise.all([
|
|
31
28
|
(0, file_1.writeSourceToFile)(integrationPath, 'config', configCode),
|
|
32
|
-
(0, file_1.writeSourceToFile)(integrationPath, 'inputs',
|
|
29
|
+
(0, file_1.writeSourceToFile)(integrationPath, 'inputs', inputsSouceCode),
|
|
33
30
|
]);
|
|
34
|
-
const customTriggers = Object.values(integrationOutput.customTriggers || {});
|
|
35
|
-
const triggerPath = path_1.default.join(integrationPath, 'triggers');
|
|
36
|
-
if (customTriggers.length) {
|
|
37
|
-
await fs_extra_1.default.promises.mkdir(triggerPath, { recursive: true });
|
|
38
|
-
}
|
|
39
|
-
const customTriggerIdToNameMap = {};
|
|
40
|
-
const generateUniqueTriggerNames = (0, file_1.withUniqueFileNames)();
|
|
41
|
-
for (const trigger of customTriggers) {
|
|
42
|
-
const triggerCode = (0, trigger_codegen_1.triggerToCode)(trigger, {
|
|
43
|
-
stepIdToVariableMap: {},
|
|
44
|
-
eventIdToNameMap,
|
|
45
|
-
inputs: [],
|
|
46
|
-
sharedInputs,
|
|
47
|
-
inputSources,
|
|
48
|
-
stepIdToStepMap: {},
|
|
49
|
-
secrets,
|
|
50
|
-
upstreamStepIds: new Set(),
|
|
51
|
-
customTriggerIdToNameMap,
|
|
52
|
-
integration: { name: integrationName },
|
|
53
|
-
resourceIdToNameMap,
|
|
54
|
-
});
|
|
55
|
-
const triggerFileName = generateUniqueTriggerNames(trigger.name);
|
|
56
|
-
customTriggerIdToNameMap[trigger.id] = triggerFileName;
|
|
57
|
-
await (0, file_1.writeSourceToFile)(triggerPath, triggerFileName, triggerCode);
|
|
58
|
-
}
|
|
59
31
|
const workflowMetas = integrationOutput.config.values.workflowMeta ?? {};
|
|
60
32
|
const workflows = Object.values(integrationOutput.workflows);
|
|
61
33
|
const workflowPath = path_1.default.join(integrationPath, 'workflows');
|
|
@@ -64,7 +36,7 @@ const generateIntegrationFiles = async (integrationName, integrationOutput, proj
|
|
|
64
36
|
recursive: true,
|
|
65
37
|
});
|
|
66
38
|
}
|
|
67
|
-
const
|
|
39
|
+
const generateUniqueNames = (0, file_1.withUniqueFileNames)();
|
|
68
40
|
for (const workflow of workflows) {
|
|
69
41
|
const workflowCode = (0, workflow_codegen_1.workflowToCode)(workflow, {
|
|
70
42
|
secrets,
|
|
@@ -79,51 +51,12 @@ const generateIntegrationFiles = async (integrationName, integrationOutput, proj
|
|
|
79
51
|
id: workflow.id,
|
|
80
52
|
inputs: [],
|
|
81
53
|
},
|
|
82
|
-
customTriggerIdToNameMap: {
|
|
83
|
-
...resourceTriggerIdToNameMap,
|
|
84
|
-
...customTriggerIdToNameMap,
|
|
85
|
-
},
|
|
86
|
-
resourceIdToNameMap,
|
|
87
54
|
});
|
|
88
|
-
const workflowFileName =
|
|
55
|
+
const workflowFileName = generateUniqueNames(workflow.name);
|
|
89
56
|
await (0, file_1.writeSourceToFile)(workflowPath, `${workflow.isDraft ? '~' : ''}` + workflowFileName, workflowCode);
|
|
90
57
|
}
|
|
91
58
|
};
|
|
92
59
|
exports.generateIntegrationFiles = generateIntegrationFiles;
|
|
93
|
-
const generateResourceFiles = async (resource, projectDependencies, projectRoot) => {
|
|
94
|
-
const resourceName = (0, core_1.generateSlugForResource)(resource);
|
|
95
|
-
const { secrets, resourceTriggerIdToNameMap, resourceIdToNameMap } = projectDependencies;
|
|
96
|
-
const resourcePath = path_1.default.join(projectRoot, 'resources', resourceName);
|
|
97
|
-
await fs_extra_1.default.promises.mkdir(resourcePath, {
|
|
98
|
-
recursive: true,
|
|
99
|
-
});
|
|
100
|
-
const dependencies = {
|
|
101
|
-
stepIdToVariableMap: {},
|
|
102
|
-
eventIdToNameMap: {},
|
|
103
|
-
inputs: [],
|
|
104
|
-
sharedInputs: [],
|
|
105
|
-
inputSources: [],
|
|
106
|
-
stepIdToStepMap: {},
|
|
107
|
-
secrets,
|
|
108
|
-
upstreamStepIds: new Set(),
|
|
109
|
-
customTriggerIdToNameMap: {},
|
|
110
|
-
integration: { name: 'custom' },
|
|
111
|
-
resourceIdToNameMap,
|
|
112
|
-
};
|
|
113
|
-
const resourceConfigCode = (0, resource_codegen_1.resourceToCode)(resource, dependencies);
|
|
114
|
-
await (0, file_1.writeSourceToFile)(resourcePath, 'config', resourceConfigCode);
|
|
115
|
-
const resourceTriggers = Object.values(resource.customTriggers || {});
|
|
116
|
-
const triggerPath = path_1.default.join(resourcePath, 'triggers');
|
|
117
|
-
if (resourceTriggers.length) {
|
|
118
|
-
await fs_extra_1.default.promises.mkdir(triggerPath, { recursive: true });
|
|
119
|
-
}
|
|
120
|
-
for (const trigger of resourceTriggers) {
|
|
121
|
-
const triggerCode = (0, trigger_codegen_1.triggerToCode)(trigger, dependencies);
|
|
122
|
-
const triggerFileName = resourceTriggerIdToNameMap[trigger.id];
|
|
123
|
-
await (0, file_1.writeSourceToFile)(triggerPath, triggerFileName, triggerCode);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
exports.generateResourceFiles = generateResourceFiles;
|
|
127
60
|
const generateProjectFiles = async (projectBuild, projectRoot) => {
|
|
128
61
|
const events = Object.values(projectBuild.events);
|
|
129
62
|
const eventPath = path_1.default.join(projectRoot, 'events');
|
|
@@ -133,41 +66,20 @@ const generateProjectFiles = async (projectBuild, projectRoot) => {
|
|
|
133
66
|
});
|
|
134
67
|
}
|
|
135
68
|
const eventIdToNameMap = {};
|
|
136
|
-
const
|
|
69
|
+
const generateUniqueNames = (0, file_1.withUniqueFileNames)();
|
|
137
70
|
for (const event of events) {
|
|
138
|
-
const eventFileName =
|
|
71
|
+
const eventFileName = generateUniqueNames(event.name);
|
|
139
72
|
eventIdToNameMap[event.id] = eventFileName;
|
|
140
73
|
const eventSourceCode = (0, event_codegen_1.eventToCode)(event);
|
|
141
74
|
await (0, file_1.writeSourceToFile)(eventPath, eventFileName, eventSourceCode);
|
|
142
75
|
}
|
|
143
76
|
await (0, file_1.writeSourceToFile)(projectRoot, 'persona.meta', (0, persona_codegen_1.personaToCode)(projectBuild.persona));
|
|
144
|
-
const resourceTriggerIdToNameMap = {};
|
|
145
|
-
const resourceIdToNameMap = {};
|
|
146
|
-
const resources = Object.values(projectBuild.resources || {});
|
|
147
|
-
for (const resource of resources) {
|
|
148
|
-
const resourceCustomTriggers = Object.values(resource.customTriggers || {});
|
|
149
|
-
const generateUniqueTriggerFileNames = (0, file_1.withUniqueFileNames)();
|
|
150
|
-
for (const customTrigger of resourceCustomTriggers) {
|
|
151
|
-
const customTriggerFileName = generateUniqueTriggerFileNames(customTrigger.name);
|
|
152
|
-
resourceTriggerIdToNameMap[customTrigger.id] = customTriggerFileName;
|
|
153
|
-
}
|
|
154
|
-
resourceIdToNameMap[resource.id] = (0, core_1.generateSlugForResource)(resource);
|
|
155
|
-
await (0, exports.generateResourceFiles)(resource, {
|
|
156
|
-
eventIdToNameMap,
|
|
157
|
-
projectId: projectBuild.projectId,
|
|
158
|
-
secrets: projectBuild.secrets,
|
|
159
|
-
resourceTriggerIdToNameMap,
|
|
160
|
-
resourceIdToNameMap,
|
|
161
|
-
}, projectRoot);
|
|
162
|
-
}
|
|
163
77
|
const integrationOutputs = Object.entries(projectBuild.integrations);
|
|
164
78
|
for (const [integrationName, integrationOutput] of integrationOutputs) {
|
|
165
79
|
await (0, exports.generateIntegrationFiles)(integrationName, integrationOutput, {
|
|
166
80
|
eventIdToNameMap,
|
|
167
81
|
projectId: projectBuild.projectId,
|
|
168
82
|
secrets: projectBuild.secrets,
|
|
169
|
-
resourceTriggerIdToNameMap,
|
|
170
|
-
resourceIdToNameMap,
|
|
171
83
|
}, projectRoot);
|
|
172
84
|
}
|
|
173
85
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codegen.utils.js","sourceRoot":"","sources":["../../src/codegen/codegen.utils.ts"],"names":[],"mappings":";;;;AAAA,gEAA0B;AAC1B,wDAAwB;
|
|
1
|
+
{"version":3,"file":"codegen.utils.js","sourceRoot":"","sources":["../../src/codegen/codegen.utils.ts"],"names":[],"mappings":";;;;AAAA,gEAA0B;AAC1B,wDAAwB;AAGxB,oDAIiC;AAEjC,kDAAiD;AAWjD,0CAAyE;AACzE,4DAAuD;AACvD,wEAGw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AM,CAAC,IAAI,KAAK,OAAO;wBACjC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK;wBAC1B,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,KAAK,WAAW;4BACvC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK;iCACrB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;iCACxD,IAAI,CAAC,EAAE,CAAC;4BACb,CAAC,CAAC,SAAS,CAAC;oBAElB,IAAI,SAAS,CAAC,KAAK,KAAK,UAAU,EAAE,CAAC;wBACnC,QAAQ,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC;oBACzD,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IACF,OAAO,MAAM,CAAC,MAAM,CAAC,IAAA,eAAO,EAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC,CAAC;AA7EW,QAAA,kBAAkB,sBA6E7B"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { InputSource, SerializedInput } from '@useparagon/core/inputs';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { StepDependencies } from '../codegen.types';
|
|
5
|
-
export declare const profileConfigToCode: (profileConfig: UserProfileConfig, dependencies: StepDependencies) => string;
|
|
6
|
-
export declare const integrationToConfigCode: (integration: IntegrationBuild, integrationName: string, secrets: (ISecret | SecretDTO)[]) => string;
|
|
2
|
+
import { IntegrationBuild, IntegrationDependencies } from '../../apis/api.types';
|
|
3
|
+
export declare const integrationToConfigCode: (integration: IntegrationBuild, integrationName: string) => string;
|
|
7
4
|
export declare const integrationInputsToCode: (integrationName: string, inputs: SerializedInput[], inputSources: InputSource[]) => string;
|
|
8
5
|
export declare const typesForIntegration: (integration: string, dependencies: IntegrationDependencies) => string;
|