@useparagon/cli 0.0.1-canary.38 → 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.
Files changed (179) hide show
  1. package/dist/apis/api.types.d.ts +8 -71
  2. package/dist/apis/auth.api.js +7 -5
  3. package/dist/apis/auth.api.js.map +1 -1
  4. package/dist/apis/base.api.d.ts +0 -3
  5. package/dist/apis/base.api.js +52 -51
  6. package/dist/apis/base.api.js.map +1 -1
  7. package/dist/apis/event.api.d.ts +2 -0
  8. package/dist/apis/event.api.js +10 -0
  9. package/dist/apis/event.api.js.map +1 -0
  10. package/dist/apis/index.d.ts +2 -0
  11. package/dist/apis/index.js +2 -0
  12. package/dist/apis/index.js.map +1 -1
  13. package/dist/apis/integration.api.d.ts +3 -3
  14. package/dist/apis/integration.api.js +10 -18
  15. package/dist/apis/integration.api.js.map +1 -1
  16. package/dist/apis/project.api.d.ts +1 -1
  17. package/dist/apis/project.api.js +17 -24
  18. package/dist/apis/project.api.js.map +1 -1
  19. package/dist/apis/workflow.api.d.ts +2 -0
  20. package/dist/apis/workflow.api.js +10 -0
  21. package/dist/apis/workflow.api.js.map +1 -0
  22. package/dist/codegen/codegen.types.d.ts +3 -9
  23. package/dist/codegen/codegen.utils.js +26 -31
  24. package/dist/codegen/codegen.utils.js.map +1 -1
  25. package/dist/codegen/codegens/condition.codegen.js +35 -38
  26. package/dist/codegen/codegens/condition.codegen.js.map +1 -1
  27. package/dist/codegen/codegens/event.codegen.js +3 -4
  28. package/dist/codegen/codegens/event.codegen.js.map +1 -1
  29. package/dist/codegen/codegens/integration.codegen.d.ts +3 -3
  30. package/dist/codegen/codegens/integration.codegen.js +32 -138
  31. package/dist/codegen/codegens/integration.codegen.js.map +1 -1
  32. package/dist/codegen/codegens/source.codegen.d.ts +1 -3
  33. package/dist/codegen/codegens/source.codegen.js +31 -120
  34. package/dist/codegen/codegens/source.codegen.js.map +1 -1
  35. package/dist/codegen/codegens/workflow.codegen.js +111 -228
  36. package/dist/codegen/codegens/workflow.codegen.js.map +1 -1
  37. package/dist/commands/auth/login/login.action.js +31 -28
  38. package/dist/commands/auth/login/login.action.js.map +1 -1
  39. package/dist/commands/auth/login/login.command.js +4 -5
  40. package/dist/commands/auth/login/login.command.js.map +1 -1
  41. package/dist/commands/auth/login/login.utils.js +19 -26
  42. package/dist/commands/auth/login/login.utils.js.map +1 -1
  43. package/dist/commands/auth/logout/logout.action.js +5 -3
  44. package/dist/commands/auth/logout/logout.action.js.map +1 -1
  45. package/dist/commands/auth/logout/logout.command.js +3 -3
  46. package/dist/commands/auth/logout/logout.command.js.map +1 -1
  47. package/dist/commands/auth/me/me.action.js +6 -10
  48. package/dist/commands/auth/me/me.action.js.map +1 -1
  49. package/dist/commands/auth/me/me.command.js +3 -3
  50. package/dist/commands/auth/me/me.command.js.map +1 -1
  51. package/dist/commands/build/build.action.js +27 -27
  52. package/dist/commands/build/build.action.js.map +1 -1
  53. package/dist/commands/build/build.command.js +5 -9
  54. package/dist/commands/build/build.command.js.map +1 -1
  55. package/dist/commands/build/build.types.d.ts +0 -1
  56. package/dist/commands/build/build.utils.d.ts +1 -1
  57. package/dist/commands/build/build.utils.js +9 -11
  58. package/dist/commands/build/build.utils.js.map +1 -1
  59. package/dist/commands/command.loader.js +8 -10
  60. package/dist/commands/command.loader.js.map +1 -1
  61. package/dist/commands/init/init.action.d.ts +1 -1
  62. package/dist/commands/init/init.action.js +68 -89
  63. package/dist/commands/init/init.action.js.map +1 -1
  64. package/dist/commands/init/init.command.js +8 -14
  65. package/dist/commands/init/init.command.js.map +1 -1
  66. package/dist/commands/init/init.constants.js +23 -0
  67. package/dist/commands/init/init.constants.js.map +1 -0
  68. package/dist/commands/init/init.types.d.ts +0 -1
  69. package/dist/commands/init/init.utils.d.ts +11 -0
  70. package/dist/commands/init/init.utils.js +50 -0
  71. package/dist/commands/init/init.utils.js.map +1 -0
  72. package/dist/commands/push/push.action.js +11 -9
  73. package/dist/commands/push/push.action.js.map +1 -1
  74. package/dist/commands/push/push.command.js +4 -4
  75. package/dist/commands/push/push.command.js.map +1 -1
  76. package/dist/compiler/compiler.types.d.ts +2 -3
  77. package/dist/compiler/compiler.utils.d.ts +1 -1
  78. package/dist/compiler/compiler.utils.js +4 -8
  79. package/dist/compiler/compiler.utils.js.map +1 -1
  80. package/dist/compiler/compilers/events.compiler.js +28 -24
  81. package/dist/compiler/compilers/events.compiler.js.map +1 -1
  82. package/dist/compiler/compilers/integrations.compiler.js +52 -148
  83. package/dist/compiler/compilers/integrations.compiler.js.map +1 -1
  84. package/dist/compiler/compilers/persona.compiler.js +11 -4
  85. package/dist/compiler/compilers/persona.compiler.js.map +1 -1
  86. package/dist/compiler/compilers/project.compiler.d.ts +0 -1
  87. package/dist/compiler/compilers/project.compiler.js +23 -49
  88. package/dist/compiler/compilers/project.compiler.js.map +1 -1
  89. package/dist/compiler/compilers/workflows.compiler.js +33 -46
  90. package/dist/compiler/compilers/workflows.compiler.js.map +1 -1
  91. package/dist/compiler/ts.compiler.d.ts +3 -1
  92. package/dist/compiler/ts.compiler.js +18 -18
  93. package/dist/compiler/ts.compiler.js.map +1 -1
  94. package/dist/config/config.constants.d.ts +0 -1
  95. package/dist/config/config.constants.js +1 -2
  96. package/dist/config/config.constants.js.map +1 -1
  97. package/dist/config/config.types.d.ts +0 -4
  98. package/dist/config/config.utils.d.ts +3 -4
  99. package/dist/config/config.utils.js +37 -65
  100. package/dist/config/config.utils.js.map +1 -1
  101. package/dist/helpers/constants.d.ts +0 -1
  102. package/dist/helpers/constants.js +1 -2
  103. package/dist/helpers/constants.js.map +1 -1
  104. package/dist/helpers/file.d.ts +1 -3
  105. package/dist/helpers/file.js +15 -44
  106. package/dist/helpers/file.js.map +1 -1
  107. package/dist/helpers/strings.d.ts +0 -1
  108. package/dist/helpers/strings.js +1 -34
  109. package/dist/helpers/strings.js.map +1 -1
  110. package/dist/index.js +0 -10
  111. package/dist/index.js.map +1 -1
  112. package/dist/logger/logger.js +1 -5
  113. package/dist/logger/logger.js.map +1 -1
  114. package/dist/templates/configurations/typescript/tsconfig.json +2 -3
  115. package/dist/templates/javascript/src/events/hello-world.js +13 -0
  116. package/dist/templates/javascript/src/integrations/slack/config.js +11 -0
  117. package/dist/templates/javascript/src/integrations/slack/workflows/example-workflow.js +30 -0
  118. package/dist/templates/typescript/src/events/hello-world.ts +21 -0
  119. package/dist/templates/typescript/src/integrations/slack/config.ts +18 -0
  120. package/dist/templates/typescript/src/integrations/slack/workflows/example-workflow.ts +30 -0
  121. package/dist/templates/typescript/tsconfig.json +31 -0
  122. package/package.json +16 -20
  123. package/dist/codegen/codegens/intent.codegen.d.ts +0 -5
  124. package/dist/codegen/codegens/intent.codegen.js +0 -187
  125. package/dist/codegen/codegens/intent.codegen.js.map +0 -1
  126. package/dist/commands/install/index.d.ts +0 -1
  127. package/dist/commands/install/index.js +0 -5
  128. package/dist/commands/install/index.js.map +0 -1
  129. package/dist/commands/install/install.action.d.ts +0 -5
  130. package/dist/commands/install/install.action.js +0 -15
  131. package/dist/commands/install/install.action.js.map +0 -1
  132. package/dist/commands/install/install.command.d.ts +0 -8
  133. package/dist/commands/install/install.command.js +0 -24
  134. package/dist/commands/install/install.command.js.map +0 -1
  135. package/dist/commands/install/install.constants.js +0 -68
  136. package/dist/commands/install/install.constants.js.map +0 -1
  137. package/dist/commands/install/install.types.d.ts +0 -7
  138. package/dist/commands/install/install.types.js +0 -3
  139. package/dist/commands/install/install.types.js.map +0 -1
  140. package/dist/commands/install/install.utils.d.ts +0 -8
  141. package/dist/commands/install/install.utils.js +0 -130
  142. package/dist/commands/install/install.utils.js.map +0 -1
  143. package/dist/commands/new/index.d.ts +0 -1
  144. package/dist/commands/new/index.js +0 -5
  145. package/dist/commands/new/index.js.map +0 -1
  146. package/dist/commands/new/integration/index.d.ts +0 -1
  147. package/dist/commands/new/integration/index.js +0 -5
  148. package/dist/commands/new/integration/index.js.map +0 -1
  149. package/dist/commands/new/integration/integration.action.d.ts +0 -5
  150. package/dist/commands/new/integration/integration.action.js +0 -52
  151. package/dist/commands/new/integration/integration.action.js.map +0 -1
  152. package/dist/commands/new/integration/integration.command.d.ts +0 -8
  153. package/dist/commands/new/integration/integration.command.js +0 -26
  154. package/dist/commands/new/integration/integration.command.js.map +0 -1
  155. package/dist/commands/new/integration/integration.types.d.ts +0 -1
  156. package/dist/commands/new/integration/integration.types.js +0 -3
  157. package/dist/commands/new/integration/integration.types.js.map +0 -1
  158. package/dist/commands/new/new.command.d.ts +0 -5
  159. package/dist/commands/new/new.command.js +0 -16
  160. package/dist/commands/new/new.command.js.map +0 -1
  161. package/dist/commands/new/new.utils.d.ts +0 -1
  162. package/dist/commands/new/new.utils.js +0 -18
  163. package/dist/commands/new/new.utils.js.map +0 -1
  164. package/dist/commands/new/workflow/index.d.ts +0 -1
  165. package/dist/commands/new/workflow/index.js +0 -5
  166. package/dist/commands/new/workflow/index.js.map +0 -1
  167. package/dist/commands/new/workflow/workflow.action.d.ts +0 -5
  168. package/dist/commands/new/workflow/workflow.action.js +0 -94
  169. package/dist/commands/new/workflow/workflow.action.js.map +0 -1
  170. package/dist/commands/new/workflow/workflow.command.d.ts +0 -8
  171. package/dist/commands/new/workflow/workflow.command.js +0 -25
  172. package/dist/commands/new/workflow/workflow.command.js.map +0 -1
  173. package/dist/commands/new/workflow/workflow.types.d.ts +0 -3
  174. package/dist/commands/new/workflow/workflow.types.js +0 -3
  175. package/dist/commands/new/workflow/workflow.types.js.map +0 -1
  176. package/dist/helpers/sets.d.ts +0 -1
  177. package/dist/helpers/sets.js +0 -10
  178. package/dist/helpers/sets.js.map +0 -1
  179. /package/dist/commands/{install/install.constants.d.ts → init/init.constants.d.ts} +0 -0
@@ -1,51 +1,8 @@
1
- import { AuthenticationScheme, IStep } from '@useparagon/core';
1
+ import { IStep } from '@useparagon/core/';
2
2
  import { IEvent } from '@useparagon/core/event';
3
- import { InputSource, SerializedInput, SidebarInputType } from '@useparagon/core/inputs';
3
+ import { InputSource, SerializedInput } from '@useparagon/core/inputs';
4
4
  import { IPersona } from '@useparagon/core/persona';
5
- import { DataType, Operator, OrConditions, TokenizedSource } from '@useparagon/core/resolvers';
6
- import { ISecret } from '@useparagon/core/secret';
7
- import { RequestAuthorization } from '@useparagon/core/steps/library/request';
8
- export type InputKeyVisibilityConfig = {
9
- inputId: string;
10
- path?: string[];
11
- } | string;
12
- export type GraphiteEnumInput = {
13
- value: string;
14
- dependentInputs?: IntentInputKeyConfig[];
15
- } | string;
16
- export type IntentInputKeyConfig = {
17
- id: string;
18
- title: string;
19
- subtitle?: string;
20
- placeholder?: string;
21
- required?: boolean;
22
- dependentInputs?: IntentInputKeyConfig[];
23
- defaultValue?: unknown;
24
- } & ({
25
- type: SidebarInputType.TextArea | SidebarInputType.Switch | SidebarInputType.BooleanInput | SidebarInputType.Code | SidebarInputType.Text | SidebarInputType.ValueText | 'UNDEFINED';
26
- } | {
27
- type: SidebarInputType.Enum | SidebarInputType.EditableEnum;
28
- values: GraphiteEnumInput[];
29
- } | {
30
- type: SidebarInputType.Conditional;
31
- supportedOperators?: Operator[];
32
- disableOrCondition?: boolean;
33
- supportedKeys?: {
34
- inputId: string;
35
- visibleOnInputs?: Array<InputKeyVisibilityConfig | string>;
36
- }[];
37
- });
38
- export type IntegrationIntent = {
39
- name: string;
40
- title: string;
41
- inputs: IntentInputKeyConfig[];
42
- output: any[];
43
- };
44
- export type IntegrationDependencies = {
45
- inputs: InputSource[];
46
- intents: IntegrationIntent[];
47
- triggers: IntegrationIntent[];
48
- };
5
+ import { OrConditions } from '@useparagon/core/resolvers';
49
6
  export type IntegrationWorkflowMeta = {
50
7
  id: string;
51
8
  infoText?: string;
@@ -68,42 +25,23 @@ export type ModalConfig = {
68
25
  inputs?: SerializedInput[];
69
26
  };
70
27
  };
71
- export interface ICustomIntegration {
72
- id: string;
73
- name: string;
74
- authenticationType?: AuthenticationScheme;
75
- inputFields: SerializedInput[];
76
- oauthAuthorizationUrl?: TokenizedSource<DataType.STRING>;
77
- oauthAccessTokenUrl?: TokenizedSource<DataType.STRING>;
78
- oauthScopes?: string;
79
- oauthIncludeClientAuthorizationHeader?: boolean;
80
- usePKCEInCodeExchange?: boolean;
81
- apiBaseUrl?: TokenizedSource<DataType.STRING>;
82
- testEndpointPath?: TokenizedSource<DataType.STRING>;
83
- apiAuthorization?: RequestAuthorization;
84
- isPublished?: boolean;
85
- }
86
28
  export interface WorkflowBuild {
87
29
  id: string;
88
30
  name: string;
89
31
  steps: IStep[];
90
32
  }
91
33
  export interface IntegrationBuild {
92
- id: string;
93
34
  config: {
94
35
  values: ModalConfig;
95
36
  };
96
- workflows: Record<string, WorkflowBuild | undefined>;
97
- dependencies?: IntegrationDependencies;
98
- customIntegration?: ICustomIntegration;
37
+ workflows: Record<string, WorkflowBuild>;
38
+ inputs?: InputSource[];
99
39
  }
100
40
  export interface ProjectBuild {
101
41
  projectId: string;
102
- projectName?: string;
103
42
  events: Record<string, IEvent>;
104
43
  persona: IPersona;
105
- integrations: Record<string, IntegrationBuild | undefined>;
106
- secrets: ISecret[];
44
+ integrations: Record<string, IntegrationBuild>;
107
45
  }
108
46
  export type IUser = {
109
47
  firstName: string;
@@ -111,7 +49,6 @@ export type IUser = {
111
49
  lastName: string;
112
50
  email: string;
113
51
  };
114
- export type IntegrationMetadata = {
115
- name: string;
116
- title: string;
52
+ export type IntegrationDependencies = {
53
+ inputSources: InputSource[];
117
54
  };
@@ -1,14 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getMe = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const logger_1 = tslib_1.__importDefault(require("../logger"));
4
6
  const base_api_1 = require("./base.api");
5
- const getMe = async (overrideConfig) => {
7
+ const getMe = (overrideConfig) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
6
8
  try {
7
- return await (0, base_api_1.get)('graphite/auth/me', overrideConfig);
9
+ return yield (0, base_api_1.get)('auth/me', overrideConfig);
8
10
  }
9
- catch (error) {
10
- return (0, base_api_1.logApiError)('Failed to get user.', error);
11
+ catch (err) {
12
+ logger_1.default.fatal(`Error while getting user information : ${err}`);
11
13
  }
12
- };
14
+ });
13
15
  exports.getMe = getMe;
14
16
  //# sourceMappingURL=auth.api.js.map
@@ -1 +1 @@
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"}
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,CAAO,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,CAAA,CAAC;AATW,QAAA,KAAK,SAShB"}
@@ -1,7 +1,4 @@
1
- import { IProfile } from '../config';
2
- export declare const getProfile: () => Promise<IProfile>;
3
1
  export declare const getToken: () => Promise<string>;
4
- export declare const logApiError: (apiDescription: string, error: any) => never;
5
2
  export declare const get: (path: string, options?: {
6
3
  token: string;
7
4
  baseUrl: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.put = exports.post = exports.get = exports.logApiError = exports.getToken = exports.getProfile = void 0;
3
+ exports.put = exports.post = exports.get = exports.getToken = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const axios_1 = tslib_1.__importDefault(require("axios"));
6
6
  const logger_1 = tslib_1.__importDefault(require("../logger"));
@@ -8,83 +8,84 @@ const config_1 = require("../config");
8
8
  const http_1 = require("../helpers/http");
9
9
  let _token;
10
10
  let _baseUrl;
11
- let _currentProfile;
12
- const getProfile = async () => {
13
- if (_currentProfile) {
14
- return _currentProfile;
15
- }
16
- const profileConfig = await (0, config_1.getConfigForProfile)(config_1.SystemFile.PROFILES, config_1.DEFAULT_PROFILE);
17
- _currentProfile = profileConfig;
18
- return _currentProfile;
19
- };
20
- exports.getProfile = getProfile;
21
- const getBaseUrl = async () => {
11
+ const getBaseUrl = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
22
12
  if (_baseUrl) {
23
13
  return _baseUrl;
24
14
  }
25
15
  try {
26
- const profileConfig = await (0, config_1.getConfigForProfile)(config_1.SystemFile.PROFILES, config_1.DEFAULT_PROFILE);
16
+ const profileConfig = yield (0, config_1.getConfigForProfile)(config_1.SystemFile.PROFILES, config_1.DEFAULT_PROFILE);
27
17
  if (!profileConfig.services[config_1.Service.ZEUS]) {
28
18
  logger_1.default.fatal('Api url is not present in config.');
29
19
  }
30
- _currentProfile = profileConfig;
31
20
  _baseUrl = (0, http_1.sanitizeUrl)(profileConfig.services[config_1.Service.ZEUS]);
32
21
  return _baseUrl;
33
22
  }
34
- catch {
23
+ catch (_a) {
35
24
  logger_1.default.fatal('User not logged in.');
36
25
  }
37
- };
38
- const getToken = async () => {
26
+ });
27
+ const getToken = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
39
28
  if (_token) {
40
29
  return _token;
41
30
  }
42
31
  try {
43
- const credential = await (0, config_1.getConfigForProfile)(config_1.SystemFile.CREDENTIALS, config_1.DEFAULT_PROFILE);
32
+ const credential = yield (0, config_1.getConfigForProfile)(config_1.SystemFile.CREDENTIALS, config_1.DEFAULT_PROFILE);
44
33
  _token = credential.token;
45
34
  if (!_token) {
46
35
  logger_1.default.fatal('Token value not present in config.');
47
36
  }
48
37
  return _token;
49
38
  }
50
- catch {
39
+ catch (_b) {
51
40
  logger_1.default.fatal('User not logged in.');
52
41
  }
53
- };
42
+ });
54
43
  exports.getToken = getToken;
55
- const logApiError = (apiDescription, error) => {
56
- const errorMessage = error['response']?.['data']?.['message'] || error.message;
57
- logger_1.default.fatal(`${apiDescription}
58
- - Details: ${errorMessage}`);
59
- };
60
- exports.logApiError = logApiError;
61
- const get = async (path, options) => {
62
- const apiBaseUrl = options ? options.baseUrl : await getBaseUrl();
63
- const token = options ? options.token : await (0, exports.getToken)();
64
- const response = await axios_1.default.get(`${apiBaseUrl}/${path}`, {
65
- headers: {
66
- Authorization: `Bearer ${token}`,
67
- },
68
- });
69
- return response.data;
44
+ const handleError = (error) => {
45
+ throw new Error(error.message);
70
46
  };
47
+ const get = (path, options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
48
+ const apiBaseUrl = options ? options.baseUrl : yield getBaseUrl();
49
+ const token = options ? options.token : yield (0, exports.getToken)();
50
+ try {
51
+ const response = yield 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
+ });
71
62
  exports.get = get;
72
- const post = async (path, data) => {
73
- const response = await axios_1.default.post(`${await getBaseUrl()}/${path}`, data, {
74
- headers: {
75
- Authorization: `Bearer ${await (0, exports.getToken)()}`,
76
- },
77
- });
78
- return response.data;
79
- };
63
+ const post = (path, data) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
64
+ try {
65
+ const response = yield axios_1.default.post(`${yield getBaseUrl()}/${path}`, data, {
66
+ headers: {
67
+ Authorization: `Bearer ${yield (0, exports.getToken)()}`,
68
+ },
69
+ });
70
+ return response.data;
71
+ }
72
+ catch (error) {
73
+ handleError(error);
74
+ }
75
+ });
80
76
  exports.post = post;
81
- const put = async (path, data) => {
82
- const response = await axios_1.default.put(`${await getBaseUrl()}/${path}`, data, {
83
- headers: {
84
- Authorization: `Bearer ${await (0, exports.getToken)()}`,
85
- },
86
- });
87
- return response.data;
88
- };
77
+ const put = (path, data) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
78
+ try {
79
+ const response = yield axios_1.default.put(`${yield getBaseUrl()}/${path}`, data, {
80
+ headers: {
81
+ Authorization: `Bearer ${yield (0, exports.getToken)()}`,
82
+ },
83
+ });
84
+ return response.data;
85
+ }
86
+ catch (error) {
87
+ handleError(error);
88
+ }
89
+ });
89
90
  exports.put = put;
90
91
  //# sourceMappingURL=base.api.js.map
@@ -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;AAM9C,IAAI,MAA0B,CAAC;AAC/B,IAAI,QAA4B,CAAC;AACjC,IAAI,eAAqC,CAAC;AAMnC,MAAM,UAAU,GAAG,KAAK,IAAuB,EAAE;IACtD,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,eAAe,CAAC;IACzB,CAAC;IACD,MAAM,aAAa,GAAa,MAAM,IAAA,4BAAmB,EACvD,mBAAU,CAAC,QAAQ,EACnB,wBAAe,CAChB,CAAC;IAEF,eAAe,GAAG,aAAa,CAAC;IAChC,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAXW,QAAA,UAAU,cAWrB;AAMF,MAAM,UAAU,GAAG,KAAK,IAAqB,EAAE;IAC7C,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,aAAa,GAAa,MAAM,IAAA,4BAAmB,EACvD,mBAAU,CAAC,QAAQ,EACnB,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C,IAAI,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,WAAW,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;AACH,CAAC,CAAA,CAAC;AAZW,QAAA,IAAI,QAYf;AAOK,MAAM,GAAG,GAAG,CAAyB,IAAY,EAAE,IAAO,EAAE,EAAE;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,CAAA,CAAC;AAZW,QAAA,GAAG,OAYd"}
@@ -0,0 +1,2 @@
1
+ import { IEvent } from '@useparagon/core/event';
2
+ export declare const getEventsByProject: (projectId: string) => Promise<IEvent[]>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEventsByProject = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const base_api_1 = require("./base.api");
6
+ const getEventsByProject = (projectId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
7
+ return (0, base_api_1.get)(`projects/${projectId}/events`);
8
+ });
9
+ exports.getEventsByProject = getEventsByProject;
10
+ //# 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,CAChC,SAAiB,EACE,EAAE;IACrB,OAAO,IAAA,cAAG,EAAC,YAAY,SAAS,SAAS,CAAC,CAAC;AAC7C,CAAC,CAAA,CAAC;AAJW,QAAA,kBAAkB,sBAI7B"}
@@ -1,4 +1,6 @@
1
1
  export * from './api.types';
2
2
  export * from './auth.api';
3
+ export * from './event.api';
3
4
  export * from './integration.api';
4
5
  export * from './project.api';
6
+ export * from './workflow.api';
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./api.types"), exports);
5
5
  tslib_1.__exportStar(require("./auth.api"), exports);
6
+ tslib_1.__exportStar(require("./event.api"), exports);
6
7
  tslib_1.__exportStar(require("./integration.api"), exports);
7
8
  tslib_1.__exportStar(require("./project.api"), exports);
9
+ tslib_1.__exportStar(require("./workflow.api"), exports);
8
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,qDAA2B;AAC3B,4DAAkC;AAClC,wDAA8B"}
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"}
@@ -1,3 +1,3 @@
1
- import { IntegrationDependencies, IntegrationMetadata } from './api.types';
2
- export declare const getIntegrationDependencies: (integrations: string[]) => Promise<Record<string, IntegrationDependencies>>;
3
- export declare const getDefaultIntegrations: () => Promise<IntegrationMetadata[]>;
1
+ import { IntegrationDependencies } from './api.types';
2
+ export declare const getIntegrationDependencies: (projectId: string, integration: string) => Promise<IntegrationDependencies>;
3
+ export declare const getDefaultIntegrations: (projectId: string) => Promise<string[]>;
@@ -1,28 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getDefaultIntegrations = exports.getIntegrationDependencies = void 0;
4
- const core_1 = require("@useparagon/core");
4
+ const tslib_1 = require("tslib");
5
+ const logger_1 = tslib_1.__importDefault(require("../logger"));
5
6
  const base_api_1 = require("./base.api");
6
- const getIntegrationDependencies = async (integrations) => {
7
- const nativeIntegrations = integrations.filter((integration) => !(0, core_1.isCustomIntegration)(integration));
8
- try {
9
- const integrationTypes = await (0, base_api_1.post)('graphite/integrations', {
10
- integrations: nativeIntegrations
11
- });
12
- return Object.fromEntries(nativeIntegrations.map((integration, index) => ([integration, integrationTypes[index]])));
13
- }
14
- catch (error) {
15
- return (0, base_api_1.logApiError)('Failed to get integration data.', error);
16
- }
17
- };
7
+ const getIntegrationDependencies = (projectId, integration) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
8
+ return (0, base_api_1.get)(`projects/${projectId}/integrations/${integration}/dependencies`);
9
+ });
18
10
  exports.getIntegrationDependencies = getIntegrationDependencies;
19
- const getDefaultIntegrations = async () => {
11
+ const getDefaultIntegrations = (projectId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
20
12
  try {
21
- return await (0, base_api_1.get)('graphite/integrations');
13
+ return yield (0, base_api_1.get)(`projects/${projectId}/integrations`);
22
14
  }
23
- catch (error) {
24
- return (0, base_api_1.logApiError)('Failed to list native integrations.', error);
15
+ catch (err) {
16
+ logger_1.default.fatal(`Could not get integrations list : ${err}`);
25
17
  }
26
- };
18
+ });
27
19
  exports.getDefaultIntegrations = getDefaultIntegrations;
28
20
  //# sourceMappingURL=integration.api.js.map
@@ -1 +1 @@
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,gBAA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AAqC,GAAG,EAAE,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC,CAAA,CAAC;AARW,QAAA,sBAAsB,0BAQjC"}
@@ -4,4 +4,4 @@ export declare const getProjectList: () => Promise<{
4
4
  id: string;
5
5
  }[]>;
6
6
  export declare const getProjectBuild: (projectId: string) => Promise<ProjectBuild>;
7
- export declare const syncProject: (build: ProjectBuild) => Promise<void>;
7
+ export declare const syncProject: (projectId: string, build: ProjectBuild) => Promise<void>;
@@ -1,41 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.syncProject = exports.getProjectBuild = exports.getProjectList = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const logger_1 = tslib_1.__importDefault(require("../logger"));
4
6
  const base_api_1 = require("./base.api");
5
- const getProjectList = async () => {
7
+ const getProjectList = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
6
8
  try {
7
- return await (0, base_api_1.get)('graphite/projects');
9
+ return yield (0, base_api_1.get)('graphite/projects');
8
10
  }
9
- catch (error) {
10
- return (0, base_api_1.logApiError)('Failed to list projects.', error);
11
+ catch (err) {
12
+ logger_1.default.fatal(`Error while getting projects list : ${err}`);
11
13
  }
12
- };
14
+ });
13
15
  exports.getProjectList = getProjectList;
14
- const getProjectBuild = async (projectId) => {
16
+ const getProjectBuild = (projectId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
15
17
  try {
16
- return await (0, base_api_1.get)(`graphite/projects/${projectId}`);
18
+ return yield (0, base_api_1.get)(`graphite/projects/${projectId}`);
17
19
  }
18
- catch (error) {
19
- if (error && error['response']?.['data']?.['status'] === 404) {
20
- return {
21
- projectId,
22
- integrations: {},
23
- events: {},
24
- secrets: [],
25
- persona: { meta: {} },
26
- };
27
- }
28
- return (0, base_api_1.logApiError)('Failed to get project.', error);
20
+ catch (err) {
21
+ logger_1.default.fatal(`Error while getting project : ${err}`);
29
22
  }
30
- };
23
+ });
31
24
  exports.getProjectBuild = getProjectBuild;
32
- const syncProject = async (build) => {
25
+ const syncProject = (projectId, build) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
33
26
  try {
34
- await (0, base_api_1.put)('graphite/projects', build);
27
+ yield (0, base_api_1.put)(`graphite/projects/${projectId}`, build);
35
28
  }
36
- catch (error) {
37
- return (0, base_api_1.logApiError)('Failed to push changes to cloud.', error);
29
+ catch (err) {
30
+ logger_1.default.fatal(`Error while syncing project : ${err}`);
38
31
  }
39
- };
32
+ });
40
33
  exports.syncProject = syncProject;
41
34
  //# sourceMappingURL=project.api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"project.api.js","sourceRoot":"","sources":["../../src/apis/project.api.ts"],"names":[],"mappings":";;;AACA,yCAAmD;AAM5C,MAAM,cAAc,GAAG,KAAK,IAEjC,EAAE;IACF,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,mBAAmB,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,IAAA,sBAAW,EAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;IACxD,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,KAAK,EAAE,CAAC;QAEf,IAAI,KAAK,IAAI,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,GAAG,EAAE,CAAC;YAC7D,OAAO;gBACL,SAAS;gBACT,YAAY,EAAE,EAAE;gBAChB,MAAM,EAAE,EAAE;gBACV,OAAO,EAAE,EAAE;gBACX,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;aACtB,CAAC;QACJ,CAAC;QACD,OAAO,IAAA,sBAAW,EAAC,wB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IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAM,CAAC,KAAK,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC;AACH,CAAC,CAAA,CAAC;AATW,QAAA,WAAW,eAStB"}
@@ -0,0 +1,2 @@
1
+ import { IStep } from '@useparagon/core';
2
+ export declare const getWorkflowSteps: (projectId: string, workflowId: string) => Promise<IStep[]>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getWorkflowSteps = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const base_api_1 = require("./base.api");
6
+ const getWorkflowSteps = (projectId, workflowId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
7
+ return (0, base_api_1.get)(`projects/${projectId}/workflows/${workflowId}/steps`);
8
+ });
9
+ exports.getWorkflowSteps = getWorkflowSteps;
10
+ //# 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,CAC9B,SAAiB,EACjB,UAAkB,EACA,EAAE;IACpB,OAAO,IAAA,cAAG,EAAC,YAAY,SAAS,cAAc,UAAU,QAAQ,CAAC,CAAC;AACpE,CAAC,CAAA,CAAC;AALW,QAAA,gBAAgB,oBAK3B"}
@@ -1,10 +1,8 @@
1
- import { IStep } from '@useparagon/core';
1
+ import { IEvent } from '@useparagon/core/event';
2
2
  import { InputSource, SerializedInput } from '@useparagon/core/inputs';
3
- import { ISecret } from '@useparagon/core/secret';
4
3
  import { IntegrationWorkflowMeta } from '../apis/api.types';
5
4
  export type ProjectDependencies = {
6
- eventIdToNameMap: Record<string, string>;
7
- secrets: ISecret[];
5
+ events: Record<string, IEvent>;
8
6
  };
9
7
  export type WorkflowDependencies = ProjectDependencies & {
10
8
  integration: {
@@ -19,9 +17,5 @@ export type StepDependencies = {
19
17
  inputs: SerializedInput[];
20
18
  inputSources: InputSource[];
21
19
  stepIdToVariableMap: Record<string, string>;
22
- eventIdToNameMap: Record<string, string>;
23
- stepIdToStepMap: Record<string, IStep>;
24
- secrets: ISecret[];
25
- currentStepId?: string;
26
- upstreamStepIds: Set<string>;
20
+ events: Record<string, IEvent>;
27
21
  };
@@ -9,73 +9,68 @@ const event_codegen_1 = require("./codegens/event.codegen");
9
9
  const integration_codegen_1 = require("./codegens/integration.codegen");
10
10
  const persona_codegen_1 = require("./codegens/persona.codegen");
11
11
  const workflow_codegen_1 = require("./codegens/workflow.codegen");
12
- const generateIntegrationFiles = async (integrationName, integrationOutput, projectDependencies, projectRoot) => {
13
- if (integrationName === 'undefined') {
14
- integrationName = 'custom.';
15
- }
16
- const { eventIdToNameMap, secrets } = projectDependencies;
12
+ const generateIntegrationFiles = (integrationName, integrationOutput, projectDependencies, projectRoot) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
13
+ var _a, _b, _c, _d;
14
+ const { events } = projectDependencies;
17
15
  const integrationPath = path_1.default.join(projectRoot, 'integrations', integrationName);
18
- await fs_extra_1.default.promises.mkdir(integrationPath, {
16
+ yield fs_extra_1.default.promises.mkdir(integrationPath, {
19
17
  recursive: true,
20
18
  });
21
- const sharedInputs = integrationOutput.config.values.sharedMeta?.inputs ?? [];
22
- const configCode = (0, integration_codegen_1.integrationToConfigCode)(integrationOutput, integrationName);
23
- const inputSources = integrationOutput.dependencies?.inputs ?? [];
24
- const inputsSouceCode = (0, integration_codegen_1.integrationInputsToCode)(integrationName, sharedInputs, inputSources);
25
- await Promise.all([
19
+ const sharedInputs = (_b = (_a = integrationOutput.config.values.sharedMeta) === null || _a === void 0 ? void 0 : _a.inputs) !== null && _b !== void 0 ? _b : [];
20
+ const integrationDependencies = {
21
+ inputSources: (_c = integrationOutput.inputs) !== null && _c !== void 0 ? _c : [],
22
+ };
23
+ const configCode = (0, integration_codegen_1.integrationConfigToCode)(integrationOutput.config, integrationName);
24
+ const inputsSouceCode = (0, integration_codegen_1.integrationInputsToCode)(sharedInputs, integrationDependencies.inputSources);
25
+ const integrationTypesCode = (0, integration_codegen_1.typesForIntegration)(integrationDependencies);
26
+ yield Promise.all([
26
27
  (0, file_1.writeSourceToFile)(integrationPath, 'config', configCode),
27
28
  (0, file_1.writeSourceToFile)(integrationPath, 'inputs', inputsSouceCode),
29
+ (0, file_1.writeSourceToFile)(integrationPath, 'types', integrationTypesCode),
28
30
  ]);
29
- const workflowMetas = integrationOutput.config.values.workflowMeta ?? {};
31
+ const workflowMetas = (_d = integrationOutput.config.values.workflowMeta) !== null && _d !== void 0 ? _d : {};
30
32
  const workflows = Object.values(integrationOutput.workflows);
31
33
  const workflowPath = path_1.default.join(integrationPath, 'workflows');
32
34
  if (workflows.length) {
33
- await fs_extra_1.default.promises.mkdir(workflowPath, {
35
+ fs_extra_1.default.promises.mkdir(workflowPath, {
34
36
  recursive: true,
35
37
  });
36
38
  }
37
- const generateUniqueNames = (0, file_1.withUniqueFileNames)();
38
39
  for (const workflow of workflows) {
39
40
  const workflowCode = (0, workflow_codegen_1.workflowToCode)(workflow, {
40
- secrets,
41
- eventIdToNameMap,
41
+ events,
42
42
  integration: { name: integrationName },
43
43
  sharedInputs,
44
- inputSources,
44
+ inputSources: integrationDependencies.inputSources,
45
45
  workflowMeta: workflowMetas[workflow.id] || {
46
46
  id: workflow.id,
47
47
  inputs: [],
48
48
  },
49
49
  });
50
- await (0, file_1.writeSourceToFile)(workflowPath, generateUniqueNames(workflow.name), workflowCode);
50
+ yield (0, file_1.writeSourceToFile)(workflowPath, workflow.name, workflowCode);
51
51
  }
52
- };
52
+ });
53
53
  exports.generateIntegrationFiles = generateIntegrationFiles;
54
- const generateProjectFiles = async (projectBuild, projectRoot) => {
54
+ const generateProjectFiles = (projectBuild, projectRoot) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
55
55
  const events = Object.values(projectBuild.events);
56
56
  const eventPath = path_1.default.join(projectRoot, 'events');
57
57
  if (events.length) {
58
- await fs_extra_1.default.promises.mkdir(eventPath, {
58
+ yield fs_extra_1.default.promises.mkdir(eventPath, {
59
59
  recursive: true,
60
60
  });
61
61
  }
62
- const eventIdToNameMap = {};
63
- const generateUniqueNames = (0, file_1.withUniqueFileNames)();
64
62
  for (const event of events) {
65
- const eventFileName = generateUniqueNames(event.name);
66
- eventIdToNameMap[event.id] = eventFileName;
67
63
  const eventSourceCode = (0, event_codegen_1.eventToCode)(event);
68
- await (0, file_1.writeSourceToFile)(eventPath, eventFileName, eventSourceCode);
64
+ yield (0, file_1.writeSourceToFile)(eventPath, event.name, eventSourceCode);
69
65
  }
70
- await (0, file_1.writeSourceToFile)(projectRoot, 'persona.meta', (0, persona_codegen_1.personaToCode)(projectBuild.persona));
66
+ yield (0, file_1.writeSourceToFile)(projectRoot, 'persona.meta', (0, persona_codegen_1.personaToCode)(projectBuild.persona));
71
67
  const integrationOutputs = Object.entries(projectBuild.integrations);
72
68
  for (const [integrationName, integrationOutput] of integrationOutputs) {
73
- await (0, exports.generateIntegrationFiles)(integrationName, integrationOutput, {
74
- eventIdToNameMap,
69
+ yield (0, exports.generateIntegrationFiles)(integrationName, integrationOutput, {
70
+ events: projectBuild.events,
75
71
  projectId: projectBuild.projectId,
76
- secrets: projectBuild.secrets,
77
72
  }, projectRoot);
78
73
  }
79
- };
74
+ });
80
75
  exports.generateProjectFiles = generateProjectFiles;
81
76
  //# sourceMappingURL=codegen.utils.js.map