@useparagon/cli 0.0.1-canary.4 → 0.0.1-canary.41

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 (192) hide show
  1. package/dist/apis/api.types.d.ts +71 -8
  2. package/dist/apis/auth.api.js +5 -7
  3. package/dist/apis/auth.api.js.map +1 -1
  4. package/dist/apis/base.api.d.ts +3 -0
  5. package/dist/apis/base.api.js +51 -52
  6. package/dist/apis/base.api.js.map +1 -1
  7. package/dist/apis/index.d.ts +0 -2
  8. package/dist/apis/index.js +0 -2
  9. package/dist/apis/index.js.map +1 -1
  10. package/dist/apis/integration.api.d.ts +3 -3
  11. package/dist/apis/integration.api.js +18 -10
  12. package/dist/apis/integration.api.js.map +1 -1
  13. package/dist/apis/project.api.d.ts +1 -1
  14. package/dist/apis/project.api.js +40 -17
  15. package/dist/apis/project.api.js.map +1 -1
  16. package/dist/codegen/codegen.types.d.ts +12 -4
  17. package/dist/codegen/codegen.utils.d.ts +2 -1
  18. package/dist/codegen/codegen.utils.js +63 -28
  19. package/dist/codegen/codegen.utils.js.map +1 -1
  20. package/dist/codegen/codegens/condition.codegen.js +38 -35
  21. package/dist/codegen/codegens/condition.codegen.js.map +1 -1
  22. package/dist/codegen/codegens/event.codegen.js +4 -3
  23. package/dist/codegen/codegens/event.codegen.js.map +1 -1
  24. package/dist/codegen/codegens/integration.codegen.d.ts +3 -3
  25. package/dist/codegen/codegens/integration.codegen.js +177 -31
  26. package/dist/codegen/codegens/integration.codegen.js.map +1 -1
  27. package/dist/codegen/codegens/intent.codegen.d.ts +6 -0
  28. package/dist/codegen/codegens/intent.codegen.js +192 -0
  29. package/dist/codegen/codegens/intent.codegen.js.map +1 -0
  30. package/dist/codegen/codegens/source.codegen.d.ts +3 -1
  31. package/dist/codegen/codegens/source.codegen.js +120 -31
  32. package/dist/codegen/codegens/source.codegen.js.map +1 -1
  33. package/dist/codegen/codegens/workflow.codegen.js +275 -111
  34. package/dist/codegen/codegens/workflow.codegen.js.map +1 -1
  35. package/dist/commands/auth/login/login.action.js +29 -31
  36. package/dist/commands/auth/login/login.action.js.map +1 -1
  37. package/dist/commands/auth/login/login.command.js +5 -4
  38. package/dist/commands/auth/login/login.command.js.map +1 -1
  39. package/dist/commands/auth/login/login.utils.js +26 -19
  40. package/dist/commands/auth/login/login.utils.js.map +1 -1
  41. package/dist/commands/auth/logout/logout.action.js +3 -5
  42. package/dist/commands/auth/logout/logout.action.js.map +1 -1
  43. package/dist/commands/auth/logout/logout.command.js +3 -3
  44. package/dist/commands/auth/logout/logout.command.js.map +1 -1
  45. package/dist/commands/auth/me/me.action.js +10 -6
  46. package/dist/commands/auth/me/me.action.js.map +1 -1
  47. package/dist/commands/auth/me/me.command.js +3 -3
  48. package/dist/commands/auth/me/me.command.js.map +1 -1
  49. package/dist/commands/build/build.action.js +27 -27
  50. package/dist/commands/build/build.action.js.map +1 -1
  51. package/dist/commands/build/build.command.js +9 -5
  52. package/dist/commands/build/build.command.js.map +1 -1
  53. package/dist/commands/build/build.types.d.ts +1 -0
  54. package/dist/commands/build/build.utils.d.ts +1 -1
  55. package/dist/commands/build/build.utils.js +11 -9
  56. package/dist/commands/build/build.utils.js.map +1 -1
  57. package/dist/commands/command.loader.js +12 -8
  58. package/dist/commands/command.loader.js.map +1 -1
  59. package/dist/commands/init/init.action.d.ts +1 -1
  60. package/dist/commands/init/init.action.js +93 -68
  61. package/dist/commands/init/init.action.js.map +1 -1
  62. package/dist/commands/init/init.command.js +14 -8
  63. package/dist/commands/init/init.command.js.map +1 -1
  64. package/dist/commands/init/init.types.d.ts +1 -0
  65. package/dist/commands/install/index.d.ts +1 -0
  66. package/dist/commands/install/index.js +5 -0
  67. package/dist/commands/install/index.js.map +1 -0
  68. package/dist/commands/install/install.action.d.ts +5 -0
  69. package/dist/commands/install/install.action.js +15 -0
  70. package/dist/commands/install/install.action.js.map +1 -0
  71. package/dist/commands/install/install.command.d.ts +8 -0
  72. package/dist/commands/install/install.command.js +24 -0
  73. package/dist/commands/install/install.command.js.map +1 -0
  74. package/dist/commands/install/install.constants.js +68 -0
  75. package/dist/commands/install/install.constants.js.map +1 -0
  76. package/dist/commands/install/install.types.d.ts +7 -0
  77. package/dist/commands/install/install.types.js +3 -0
  78. package/dist/commands/install/install.types.js.map +1 -0
  79. package/dist/commands/install/install.utils.d.ts +8 -0
  80. package/dist/commands/install/install.utils.js +193 -0
  81. package/dist/commands/install/install.utils.js.map +1 -0
  82. package/dist/commands/new/index.d.ts +1 -0
  83. package/dist/commands/new/index.js +5 -0
  84. package/dist/commands/new/index.js.map +1 -0
  85. package/dist/commands/new/integration/index.d.ts +1 -0
  86. package/dist/commands/new/integration/index.js +5 -0
  87. package/dist/commands/new/integration/index.js.map +1 -0
  88. package/dist/commands/new/integration/integration.action.d.ts +5 -0
  89. package/dist/commands/new/integration/integration.action.js +52 -0
  90. package/dist/commands/new/integration/integration.action.js.map +1 -0
  91. package/dist/commands/new/integration/integration.command.d.ts +8 -0
  92. package/dist/commands/new/integration/integration.command.js +26 -0
  93. package/dist/commands/new/integration/integration.command.js.map +1 -0
  94. package/dist/commands/new/integration/integration.types.d.ts +1 -0
  95. package/dist/commands/new/integration/integration.types.js +3 -0
  96. package/dist/commands/new/integration/integration.types.js.map +1 -0
  97. package/dist/commands/new/new.command.d.ts +5 -0
  98. package/dist/commands/new/new.command.js +16 -0
  99. package/dist/commands/new/new.command.js.map +1 -0
  100. package/dist/commands/new/new.utils.d.ts +1 -0
  101. package/dist/commands/new/new.utils.js +18 -0
  102. package/dist/commands/new/new.utils.js.map +1 -0
  103. package/dist/commands/new/workflow/index.d.ts +1 -0
  104. package/dist/commands/new/workflow/index.js +5 -0
  105. package/dist/commands/new/workflow/index.js.map +1 -0
  106. package/dist/commands/new/workflow/workflow.action.d.ts +5 -0
  107. package/dist/commands/new/workflow/workflow.action.js +94 -0
  108. package/dist/commands/new/workflow/workflow.action.js.map +1 -0
  109. package/dist/commands/new/workflow/workflow.command.d.ts +8 -0
  110. package/dist/commands/new/workflow/workflow.command.js +25 -0
  111. package/dist/commands/new/workflow/workflow.command.js.map +1 -0
  112. package/dist/commands/new/workflow/workflow.types.d.ts +3 -0
  113. package/dist/commands/new/workflow/workflow.types.js +3 -0
  114. package/dist/commands/new/workflow/workflow.types.js.map +1 -0
  115. package/dist/commands/pull/index.d.ts +1 -0
  116. package/dist/commands/pull/index.js +5 -0
  117. package/dist/commands/pull/index.js.map +1 -0
  118. package/dist/commands/pull/pull.action.d.ts +5 -0
  119. package/dist/commands/pull/pull.action.js +48 -0
  120. package/dist/commands/pull/pull.action.js.map +1 -0
  121. package/dist/commands/pull/pull.command.d.ts +8 -0
  122. package/dist/commands/pull/pull.command.js +26 -0
  123. package/dist/commands/pull/pull.command.js.map +1 -0
  124. package/dist/commands/pull/pull.types.d.ts +1 -0
  125. package/dist/commands/pull/pull.types.js +3 -0
  126. package/dist/commands/pull/pull.types.js.map +1 -0
  127. package/dist/commands/push/push.action.js +9 -11
  128. package/dist/commands/push/push.action.js.map +1 -1
  129. package/dist/commands/push/push.command.js +4 -4
  130. package/dist/commands/push/push.command.js.map +1 -1
  131. package/dist/compiler/compiler.types.d.ts +3 -2
  132. package/dist/compiler/compiler.utils.d.ts +1 -1
  133. package/dist/compiler/compiler.utils.js +8 -4
  134. package/dist/compiler/compiler.utils.js.map +1 -1
  135. package/dist/compiler/compilers/events.compiler.js +24 -28
  136. package/dist/compiler/compilers/events.compiler.js.map +1 -1
  137. package/dist/compiler/compilers/integrations.compiler.js +148 -52
  138. package/dist/compiler/compilers/integrations.compiler.js.map +1 -1
  139. package/dist/compiler/compilers/persona.compiler.js +4 -11
  140. package/dist/compiler/compilers/persona.compiler.js.map +1 -1
  141. package/dist/compiler/compilers/project.compiler.d.ts +1 -0
  142. package/dist/compiler/compilers/project.compiler.js +49 -23
  143. package/dist/compiler/compilers/project.compiler.js.map +1 -1
  144. package/dist/compiler/compilers/workflows.compiler.js +55 -32
  145. package/dist/compiler/compilers/workflows.compiler.js.map +1 -1
  146. package/dist/compiler/ts.compiler.d.ts +1 -3
  147. package/dist/compiler/ts.compiler.js +18 -18
  148. package/dist/compiler/ts.compiler.js.map +1 -1
  149. package/dist/config/config.constants.d.ts +1 -0
  150. package/dist/config/config.constants.js +2 -1
  151. package/dist/config/config.constants.js.map +1 -1
  152. package/dist/config/config.types.d.ts +4 -0
  153. package/dist/config/config.utils.d.ts +4 -3
  154. package/dist/config/config.utils.js +65 -37
  155. package/dist/config/config.utils.js.map +1 -1
  156. package/dist/helpers/constants.d.ts +1 -0
  157. package/dist/helpers/constants.js +2 -1
  158. package/dist/helpers/constants.js.map +1 -1
  159. package/dist/helpers/file.d.ts +3 -1
  160. package/dist/helpers/file.js +44 -15
  161. package/dist/helpers/file.js.map +1 -1
  162. package/dist/helpers/sets.d.ts +1 -0
  163. package/dist/helpers/sets.js +10 -0
  164. package/dist/helpers/sets.js.map +1 -0
  165. package/dist/helpers/strings.d.ts +1 -0
  166. package/dist/helpers/strings.js +34 -1
  167. package/dist/helpers/strings.js.map +1 -1
  168. package/dist/index.js +10 -0
  169. package/dist/index.js.map +1 -1
  170. package/dist/logger/logger.js +5 -1
  171. package/dist/logger/logger.js.map +1 -1
  172. package/dist/templates/configurations/typescript/tsconfig.json +3 -2
  173. package/package.json +20 -16
  174. package/dist/apis/event.api.d.ts +0 -2
  175. package/dist/apis/event.api.js +0 -10
  176. package/dist/apis/event.api.js.map +0 -1
  177. package/dist/apis/workflow.api.d.ts +0 -2
  178. package/dist/apis/workflow.api.js +0 -10
  179. package/dist/apis/workflow.api.js.map +0 -1
  180. package/dist/commands/init/init.constants.js +0 -23
  181. package/dist/commands/init/init.constants.js.map +0 -1
  182. package/dist/commands/init/init.utils.d.ts +0 -11
  183. package/dist/commands/init/init.utils.js +0 -50
  184. package/dist/commands/init/init.utils.js.map +0 -1
  185. package/dist/templates/javascript/src/events/hello-world.js +0 -13
  186. package/dist/templates/javascript/src/integrations/slack/config.js +0 -11
  187. package/dist/templates/javascript/src/integrations/slack/workflows/example-workflow.js +0 -30
  188. package/dist/templates/typescript/src/events/hello-world.ts +0 -21
  189. package/dist/templates/typescript/src/integrations/slack/config.ts +0 -18
  190. package/dist/templates/typescript/src/integrations/slack/workflows/example-workflow.ts +0 -30
  191. package/dist/templates/typescript/tsconfig.json +0 -31
  192. /package/dist/commands/{init/init.constants.d.ts → install/install.constants.d.ts} +0 -0
@@ -1,8 +1,51 @@
1
- import { IStep } from '@useparagon/core/';
1
+ import { AuthenticationScheme, IStep } from '@useparagon/core';
2
2
  import { IEvent } from '@useparagon/core/event';
3
- import { InputSource, SerializedInput } from '@useparagon/core/inputs';
3
+ import { InputSource, SerializedInput, SidebarInputType } from '@useparagon/core/inputs';
4
4
  import { IPersona } from '@useparagon/core/persona';
5
- import { OrConditions } from '@useparagon/core/resolvers';
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
+ };
6
49
  export type IntegrationWorkflowMeta = {
7
50
  id: string;
8
51
  infoText?: string;
@@ -25,23 +68,42 @@ export type ModalConfig = {
25
68
  inputs?: SerializedInput[];
26
69
  };
27
70
  };
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
+ }
28
86
  export interface WorkflowBuild {
29
87
  id: string;
30
88
  name: string;
31
89
  steps: IStep[];
32
90
  }
33
91
  export interface IntegrationBuild {
92
+ id: string;
34
93
  config: {
35
94
  values: ModalConfig;
36
95
  };
37
- workflows: Record<string, WorkflowBuild>;
38
- inputs?: InputSource[];
96
+ workflows: Record<string, WorkflowBuild | undefined>;
97
+ dependencies?: IntegrationDependencies;
98
+ customIntegration?: ICustomIntegration;
39
99
  }
40
100
  export interface ProjectBuild {
41
101
  projectId: string;
102
+ projectName?: string;
42
103
  events: Record<string, IEvent>;
43
104
  persona: IPersona;
44
- integrations: Record<string, IntegrationBuild>;
105
+ integrations: Record<string, IntegrationBuild | undefined>;
106
+ secrets: ISecret[];
45
107
  }
46
108
  export type IUser = {
47
109
  firstName: string;
@@ -49,6 +111,7 @@ export type IUser = {
49
111
  lastName: string;
50
112
  email: string;
51
113
  };
52
- export type IntegrationDependencies = {
53
- inputSources: InputSource[];
114
+ export type IntegrationMetadata = {
115
+ name: string;
116
+ title: string;
54
117
  };
@@ -1,16 +1,14 @@
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"));
6
4
  const base_api_1 = require("./base.api");
7
- const getMe = (overrideConfig) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
5
+ const getMe = async (overrideConfig) => {
8
6
  try {
9
- return yield (0, base_api_1.get)('auth/me', overrideConfig);
7
+ return await (0, base_api_1.get)('graphite/auth/me', overrideConfig);
10
8
  }
11
- catch (err) {
12
- logger_1.default.fatal(`Error while getting user information : ${err}`);
9
+ catch (error) {
10
+ return (0, base_api_1.logApiError)('Failed to get user.', error);
13
11
  }
14
- });
12
+ };
15
13
  exports.getMe = getMe;
16
14
  //# sourceMappingURL=auth.api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth.api.js","sourceRoot":"","sources":["../../src/apis/auth.api.ts"],"names":[],"mappings":";;;;AAAA,+DAA+B;AAE/B,yCAAiC;AAO1B,MAAM,KAAK,GAAG,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
+ {"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,4 +1,7 @@
1
+ import { IProfile } from '../config';
2
+ export declare const getProfile: () => Promise<IProfile>;
1
3
  export declare const getToken: () => Promise<string>;
4
+ export declare const logApiError: (apiDescription: string, error: any) => never;
2
5
  export declare const get: (path: string, options?: {
3
6
  token: string;
4
7
  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.getToken = void 0;
3
+ exports.put = exports.post = exports.get = exports.logApiError = exports.getToken = exports.getProfile = 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,84 +8,83 @@ const config_1 = require("../config");
8
8
  const http_1 = require("../helpers/http");
9
9
  let _token;
10
10
  let _baseUrl;
11
- const getBaseUrl = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
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 () => {
12
22
  if (_baseUrl) {
13
23
  return _baseUrl;
14
24
  }
15
25
  try {
16
- const profileConfig = yield (0, config_1.getConfigForProfile)(config_1.SystemFile.PROFILES, config_1.DEFAULT_PROFILE);
26
+ const profileConfig = await (0, config_1.getConfigForProfile)(config_1.SystemFile.PROFILES, config_1.DEFAULT_PROFILE);
17
27
  if (!profileConfig.services[config_1.Service.ZEUS]) {
18
28
  logger_1.default.fatal('Api url is not present in config.');
19
29
  }
30
+ _currentProfile = profileConfig;
20
31
  _baseUrl = (0, http_1.sanitizeUrl)(profileConfig.services[config_1.Service.ZEUS]);
21
32
  return _baseUrl;
22
33
  }
23
- catch (_a) {
34
+ catch {
24
35
  logger_1.default.fatal('User not logged in.');
25
36
  }
26
- });
27
- const getToken = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
37
+ };
38
+ const getToken = async () => {
28
39
  if (_token) {
29
40
  return _token;
30
41
  }
31
42
  try {
32
- const credential = yield (0, config_1.getConfigForProfile)(config_1.SystemFile.CREDENTIALS, config_1.DEFAULT_PROFILE);
43
+ const credential = await (0, config_1.getConfigForProfile)(config_1.SystemFile.CREDENTIALS, config_1.DEFAULT_PROFILE);
33
44
  _token = credential.token;
34
45
  if (!_token) {
35
46
  logger_1.default.fatal('Token value not present in config.');
36
47
  }
37
48
  return _token;
38
49
  }
39
- catch (_b) {
50
+ catch {
40
51
  logger_1.default.fatal('User not logged in.');
41
52
  }
42
- });
53
+ };
43
54
  exports.getToken = getToken;
44
- const handleError = (error) => {
45
- throw new Error(error.message);
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;
46
70
  };
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
- });
62
71
  exports.get = get;
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
- });
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
+ };
76
80
  exports.post = post;
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
- });
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
+ };
90
89
  exports.put = put;
91
90
  //# 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;AAMjC,MAAM,UAAU,GAAG,GAA0B,E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AAC,CAAC,MAAM,UAAU,EAAE,CAAC;IAC1E,MAAM,KAAK,GAAW,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,IAAA,gBAAQ,GAAE,CAAC;IACjE,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,GAAG,UAAU,IAAI,IAAI,EAAE,EAAE;QACxD,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,KAAK,EAAE;SACjC;KACF,CAAC,CAAC;IACH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC,CAAC;AAZW,QAAA,GAAG,OAYd;AAOK,MAAM,IAAI,GAAG,KAAK,EAAoB,IAAY,EAAE,IAAO,EAAE,EAAE;IACpE,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,IAAI,CAAC,GAAG,MAAM,UAAU,EAAE,IAAI,IAAI,EAAE,EAAE,IAAI,EAAE;QACvE,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,MAAM,IAAA,gBAAQ,GAAE,EAAE;SAC5C;KACF,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC,CAAC;AARW,QAAA,IAAI,QAQf;AAOK,MAAM,GAAG,GAAG,KAAK,EAAoB,IAAY,EAAE,IAAO,EAAE,EAAE;IACnE,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,GAAG,CAAC,GAAG,MAAM,UAAU,EAAE,IAAI,IAAI,EAAE,EAAE,IAAI,EAAE;QACtE,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,MAAM,IAAA,gBAAQ,GAAE,EAAE;SAC5C;KACF,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC,IAAI,CAAC;AACvB,CAAC,CAAC;AARW,QAAA,GAAG,OAQd"}
@@ -1,6 +1,4 @@
1
1
  export * from './api.types';
2
2
  export * from './auth.api';
3
- export * from './event.api';
4
3
  export * from './integration.api';
5
4
  export * from './project.api';
6
- export * from './workflow.api';
@@ -3,8 +3,6 @@ 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);
7
6
  tslib_1.__exportStar(require("./integration.api"), exports);
8
7
  tslib_1.__exportStar(require("./project.api"), exports);
9
- tslib_1.__exportStar(require("./workflow.api"), exports);
10
8
  //# 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,sDAA4B;AAC5B,4DAAkC;AAClC,wDAA8B;AAC9B,yDAA+B"}
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 } from './api.types';
2
- export declare const getIntegrationDependencies: (projectId: string, integration: string) => Promise<IntegrationDependencies>;
3
- export declare const getDefaultIntegrations: (projectId: string) => Promise<string[]>;
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,20 +1,28 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getDefaultIntegrations = exports.getIntegrationDependencies = void 0;
4
- const tslib_1 = require("tslib");
5
- const logger_1 = tslib_1.__importDefault(require("../logger"));
4
+ const core_1 = require("@useparagon/core");
6
5
  const base_api_1 = require("./base.api");
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
- });
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
+ };
10
18
  exports.getIntegrationDependencies = getIntegrationDependencies;
11
- const getDefaultIntegrations = (projectId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
19
+ const getDefaultIntegrations = async () => {
12
20
  try {
13
- return yield (0, base_api_1.get)(`projects/${projectId}/integrations`);
21
+ return await (0, base_api_1.get)('graphite/integrations');
14
22
  }
15
- catch (err) {
16
- logger_1.default.fatal(`Could not get integrations list : ${err}`);
23
+ catch (error) {
24
+ return (0, base_api_1.logApiError)('Failed to list native integrations.', error);
17
25
  }
18
- });
26
+ };
19
27
  exports.getDefaultIntegrations = getDefaultIntegrations;
20
28
  //# sourceMappingURL=integration.api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"integration.api.js","sourceRoot":"","sources":["../../src/apis/integration.api.ts"],"names":[],"mappings":";;;;AAAA,+DAA+B;AAE/B,yCAAiC;AAM1B,MAAM,0BAA0B,GAAG,CACxC,SAAiB,EACjB,WAAmB,EACe,EAAE;IACpC,OAAO,IAAA,cAAG,EAAC,YAAY,SAAS,iBAAiB,WAAW,eAAe,CAAC,CAAC;AAC/E,CAAC,CAAA,CAAC;AALW,QAAA,0BAA0B,8BAKrC;AAOK,MAAM,sBAAsB,GAAG,CACpC,SAAiB,EACE,EAAE;IACrB,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,YAAY,SAAS,eAAe,CAAC,CAAC;IACzD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAM,CAAC,KAAK,CAAC,qCAAqC,GAAG,EAAE,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC,CAAA,CAAC;AARW,QAAA,sBAAsB,0BAQjC"}
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"}
@@ -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: (projectId: string, build: ProjectBuild) => Promise<void>;
7
+ export declare const syncProject: (build: ProjectBuild) => Promise<void>;
@@ -1,34 +1,57 @@
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
+ const core_1 = require("@useparagon/core");
6
5
  const base_api_1 = require("./base.api");
7
- const getProjectList = () => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
6
+ const integration_api_1 = require("./integration.api");
7
+ const getProjectList = async () => {
8
8
  try {
9
- return yield (0, base_api_1.get)('graphite/projects');
9
+ return await (0, base_api_1.get)('graphite/projects');
10
10
  }
11
- catch (err) {
12
- logger_1.default.fatal(`Error while getting projects list : ${err}`);
11
+ catch (error) {
12
+ return (0, base_api_1.logApiError)('Failed to list projects.', error);
13
13
  }
14
- });
14
+ };
15
15
  exports.getProjectList = getProjectList;
16
- const getProjectBuild = (projectId) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
16
+ const getProjectBuild = async (projectId) => {
17
17
  try {
18
- return yield (0, base_api_1.get)(`graphite/projects/${projectId}`);
18
+ const projectBuild = await (0, base_api_1.get)(`graphite/projects/${projectId}`);
19
+ const integrations = Object.keys(projectBuild.integrations);
20
+ const integrationDependencies = await (0, integration_api_1.getIntegrationDependencies)(integrations);
21
+ return {
22
+ ...projectBuild,
23
+ integrations: Object.fromEntries(Object.entries(projectBuild.integrations).map(([integration, build]) => [
24
+ integration,
25
+ (0, core_1.isCustomIntegration)(integration) || !build
26
+ ? build
27
+ : {
28
+ ...build,
29
+ dependencies: integrationDependencies[integration],
30
+ },
31
+ ])),
32
+ };
19
33
  }
20
- catch (err) {
21
- logger_1.default.fatal(`Error while getting project : ${err}`);
34
+ catch (error) {
35
+ if (error && error['response']?.['data']?.['status'] === 404) {
36
+ return {
37
+ projectId,
38
+ integrations: {},
39
+ events: {},
40
+ secrets: [],
41
+ persona: { meta: {} },
42
+ };
43
+ }
44
+ return (0, base_api_1.logApiError)('Failed to get project.', error);
22
45
  }
23
- });
46
+ };
24
47
  exports.getProjectBuild = getProjectBuild;
25
- const syncProject = (projectId, build) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
48
+ const syncProject = async (build) => {
26
49
  try {
27
- yield (0, base_api_1.put)(`graphite/projects/${projectId}`, build);
50
+ await (0, base_api_1.put)('graphite/projects', build);
28
51
  }
29
- catch (err) {
30
- logger_1.default.fatal(`Error while syncing project : ${err}`);
52
+ catch (error) {
53
+ return (0, base_api_1.logApiError)('Failed to push changes to cloud.', error);
31
54
  }
32
- });
55
+ };
33
56
  exports.syncProject = syncProject;
34
57
  //# sourceMappingURL=project.api.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"project.api.js","sourceRoot":"","sources":["../../src/apis/project.api.ts"],"names":[],"mappings":";;;;AAAA,+DAA+B;AAE/B,yCAAsC;AAM/B,MAAM,cAAc,GAAG,GAE5B,EAAE;IACF,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,mBAAmB,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAM,CAAC,KAAK,CAAC,uCAAuC,GAAG,EAAE,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC,CAAA,CAAC;AARW,QAAA,cAAc,kBAQzB;AAOK,MAAM,eAAe,GAAG,CAC7B,SAAiB,EACM,EAAE;IACzB,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,qBAAqB,SAAS,EAAE,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAM,CAAC,KAAK,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC;AACH,CAAC,CAAA,CAAC;AARW,QAAA,eAAe,mBAQ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X,IAAA,0BAAmB,EAAC,WAAW,CAAC,IAAI,CAAC,KAAK;oBACxC,CAAC,CAAC,KAAK;oBACP,CAAC,CAAC;wBACE,GAAG,KAAK;wBACR,YAAY,EAAE,uBAAuB,CAAC,WAAW,CAAC;qBACnD;aACN,CACF,CACF;SACF,CAAC;IACJ,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,wBAAwB,EAAE,KAAK,CAAC,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,kCAAkC,EAAE,KAAK,CAAC,CAAC;IAChE,CAAC;AACH,CAAC,CAAC;AANW,QAAA,WAAW,eAMtB"}
@@ -1,21 +1,29 @@
1
- import { IEvent } from '@useparagon/core/event';
1
+ import { IStep } from '@useparagon/core';
2
2
  import { InputSource, SerializedInput } from '@useparagon/core/inputs';
3
- import { IntegrationWorkflowMeta } from '../apis/api.types';
3
+ import { ISecret } from '@useparagon/core/secret';
4
+ import { IntegrationDependencies, IntegrationWorkflowMeta } from '../apis/api.types';
4
5
  export type ProjectDependencies = {
5
- events: Record<string, IEvent>;
6
+ eventIdToNameMap: Record<string, string>;
7
+ secrets: ISecret[];
6
8
  };
7
9
  export type WorkflowDependencies = ProjectDependencies & {
8
10
  integration: {
9
11
  name: string;
12
+ dependencies?: IntegrationDependencies;
10
13
  };
11
14
  workflowMeta: IntegrationWorkflowMeta;
12
15
  sharedInputs: SerializedInput[];
13
16
  inputSources: InputSource[];
14
17
  };
15
18
  export type StepDependencies = {
19
+ integration: WorkflowDependencies['integration'];
16
20
  sharedInputs: SerializedInput[];
17
21
  inputs: SerializedInput[];
18
22
  inputSources: InputSource[];
19
23
  stepIdToVariableMap: Record<string, string>;
20
- events: Record<string, IEvent>;
24
+ eventIdToNameMap: Record<string, string>;
25
+ stepIdToStepMap: Record<string, IStep>;
26
+ secrets: ISecret[];
27
+ currentStepId?: string;
28
+ upstreamStepIds: Set<string>;
21
29
  };
@@ -1,4 +1,5 @@
1
- import { IntegrationBuild, ProjectBuild } from '../apis/api.types';
1
+ import { IntegrationBuild, IntegrationIntent, IntentInputKeyConfig, ProjectBuild } from '../apis/api.types';
2
2
  import { ProjectDependencies } from '../compiler/compiler.types';
3
3
  export declare const generateIntegrationFiles: (integrationName: string, integrationOutput: IntegrationBuild, projectDependencies: ProjectDependencies, projectRoot: string) => Promise<void>;
4
4
  export declare const generateProjectFiles: (projectBuild: ProjectBuild, projectRoot: string) => Promise<void>;
5
+ export declare const getInputsForIntent: (intent: IntegrationIntent) => IntentInputKeyConfig[];