@useparagon/cli 0.0.1-canary.1 → 0.0.1-canary.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/dist/apis/api.types.d.ts +67 -0
  2. package/dist/apis/api.types.js +3 -0
  3. package/dist/apis/api.types.js.map +1 -0
  4. package/dist/apis/auth.api.d.ts +5 -0
  5. package/dist/apis/auth.api.js +16 -0
  6. package/dist/apis/auth.api.js.map +1 -0
  7. package/dist/apis/base.api.d.ts +7 -0
  8. package/dist/apis/base.api.js +91 -0
  9. package/dist/apis/base.api.js.map +1 -0
  10. package/dist/apis/event.api.d.ts +2 -0
  11. package/dist/apis/event.api.js +9 -0
  12. package/dist/apis/event.api.js.map +1 -0
  13. package/dist/apis/index.d.ts +6 -0
  14. package/dist/apis/index.js +10 -0
  15. package/dist/apis/index.js.map +1 -0
  16. package/dist/apis/integration.api.d.ts +3 -0
  17. package/dist/apis/integration.api.js +27 -0
  18. package/dist/apis/integration.api.js.map +1 -0
  19. package/dist/apis/project.api.d.ts +7 -0
  20. package/dist/apis/project.api.js +34 -0
  21. package/dist/apis/project.api.js.map +1 -0
  22. package/dist/apis/workflow.api.d.ts +2 -0
  23. package/dist/apis/workflow.api.js +9 -0
  24. package/dist/apis/workflow.api.js.map +1 -0
  25. package/dist/codegen/codegen.types.d.ts +14 -0
  26. package/dist/codegen/codegen.utils.d.ts +4 -4
  27. package/dist/codegen/codegen.utils.js +44 -37
  28. package/dist/codegen/codegen.utils.js.map +1 -1
  29. package/dist/codegen/codegens/condition.codegen.d.ts +2 -1
  30. package/dist/codegen/codegens/condition.codegen.js +96 -10
  31. package/dist/codegen/codegens/condition.codegen.js.map +1 -1
  32. package/dist/codegen/codegens/event.codegen.js +4 -11
  33. package/dist/codegen/codegens/event.codegen.js.map +1 -1
  34. package/dist/codegen/codegens/integration.codegen.d.ts +5 -2
  35. package/dist/codegen/codegens/integration.codegen.js +133 -4
  36. package/dist/codegen/codegens/integration.codegen.js.map +1 -1
  37. package/dist/codegen/codegens/persona.codegen.d.ts +2 -0
  38. package/dist/codegen/codegens/persona.codegen.js +12 -0
  39. package/dist/codegen/codegens/persona.codegen.js.map +1 -0
  40. package/dist/codegen/codegens/source.codegen.d.ts +6 -4
  41. package/dist/codegen/codegens/source.codegen.js +125 -25
  42. package/dist/codegen/codegens/source.codegen.js.map +1 -1
  43. package/dist/codegen/codegens/workflow.codegen.d.ts +2 -2
  44. package/dist/codegen/codegens/workflow.codegen.js +204 -110
  45. package/dist/codegen/codegens/workflow.codegen.js.map +1 -1
  46. package/dist/commands/{login/login.command.d.ts → auth/auth.command.d.ts} +1 -1
  47. package/dist/commands/auth/auth.command.js +18 -0
  48. package/dist/commands/auth/auth.command.js.map +1 -0
  49. package/dist/commands/auth/index.d.ts +1 -0
  50. package/dist/commands/auth/index.js +5 -0
  51. package/dist/commands/auth/index.js.map +1 -0
  52. package/dist/commands/auth/login/index.js.map +1 -0
  53. package/dist/commands/auth/login/login.action.d.ts +5 -0
  54. package/dist/commands/auth/login/login.action.js +42 -0
  55. package/dist/commands/auth/login/login.action.js.map +1 -0
  56. package/dist/commands/auth/login/login.command.d.ts +8 -0
  57. package/dist/commands/auth/login/login.command.js +25 -0
  58. package/dist/commands/auth/login/login.command.js.map +1 -0
  59. package/dist/commands/auth/login/login.types.d.ts +9 -0
  60. package/dist/commands/auth/login/login.types.js.map +1 -0
  61. package/dist/commands/auth/login/login.utils.d.ts +2 -0
  62. package/dist/commands/auth/login/login.utils.js +86 -0
  63. package/dist/commands/auth/login/login.utils.js.map +1 -0
  64. package/dist/commands/auth/logout/index.d.ts +1 -0
  65. package/dist/commands/auth/logout/index.js +5 -0
  66. package/dist/commands/auth/logout/index.js.map +1 -0
  67. package/dist/commands/auth/logout/logout.action.d.ts +5 -0
  68. package/dist/commands/auth/logout/logout.action.js +14 -0
  69. package/dist/commands/auth/logout/logout.action.js.map +1 -0
  70. package/dist/commands/auth/logout/logout.command.d.ts +8 -0
  71. package/dist/commands/auth/logout/logout.command.js +24 -0
  72. package/dist/commands/auth/logout/logout.command.js.map +1 -0
  73. package/dist/commands/auth/logout/logout.types.d.ts +1 -0
  74. package/dist/commands/auth/logout/logout.types.js +3 -0
  75. package/dist/commands/auth/logout/logout.types.js.map +1 -0
  76. package/dist/commands/auth/me/index.d.ts +1 -0
  77. package/dist/commands/auth/me/index.js +5 -0
  78. package/dist/commands/auth/me/index.js.map +1 -0
  79. package/dist/commands/auth/me/me.action.d.ts +5 -0
  80. package/dist/commands/auth/me/me.action.js +20 -0
  81. package/dist/commands/auth/me/me.action.js.map +1 -0
  82. package/dist/commands/auth/me/me.command.d.ts +8 -0
  83. package/dist/commands/auth/me/me.command.js +24 -0
  84. package/dist/commands/auth/me/me.command.js.map +1 -0
  85. package/dist/commands/auth/me/me.types.d.ts +1 -0
  86. package/dist/commands/auth/me/me.types.js +3 -0
  87. package/dist/commands/auth/me/me.types.js.map +1 -0
  88. package/dist/commands/build/build.action.d.ts +1 -1
  89. package/dist/commands/build/build.action.js +31 -33
  90. package/dist/commands/build/build.action.js.map +1 -1
  91. package/dist/commands/build/build.command.js +5 -6
  92. package/dist/commands/build/build.command.js.map +1 -1
  93. package/dist/commands/build/build.utils.js +5 -4
  94. package/dist/commands/build/build.utils.js.map +1 -1
  95. package/dist/commands/command.loader.js +11 -9
  96. package/dist/commands/command.loader.js.map +1 -1
  97. package/dist/commands/index.d.ts +1 -1
  98. package/dist/commands/index.js +1 -1
  99. package/dist/commands/index.js.map +1 -1
  100. package/dist/commands/init/init.action.d.ts +1 -1
  101. package/dist/commands/init/init.action.js +76 -68
  102. package/dist/commands/init/init.action.js.map +1 -1
  103. package/dist/commands/init/init.command.js +9 -4
  104. package/dist/commands/init/init.command.js.map +1 -1
  105. package/dist/commands/init/init.constants.js +7 -3
  106. package/dist/commands/init/init.constants.js.map +1 -1
  107. package/dist/commands/init/init.utils.d.ts +2 -2
  108. package/dist/commands/init/init.utils.js +10 -7
  109. package/dist/commands/init/init.utils.js.map +1 -1
  110. package/dist/commands/new/index.d.ts +1 -0
  111. package/dist/commands/new/index.js +5 -0
  112. package/dist/commands/new/index.js.map +1 -0
  113. package/dist/commands/new/integration/index.d.ts +1 -0
  114. package/dist/commands/new/integration/index.js +5 -0
  115. package/dist/commands/new/integration/index.js.map +1 -0
  116. package/dist/commands/new/integration/integration.action.d.ts +5 -0
  117. package/dist/commands/new/integration/integration.action.js +49 -0
  118. package/dist/commands/new/integration/integration.action.js.map +1 -0
  119. package/dist/commands/new/integration/integration.command.d.ts +8 -0
  120. package/dist/commands/new/integration/integration.command.js +26 -0
  121. package/dist/commands/new/integration/integration.command.js.map +1 -0
  122. package/dist/commands/new/integration/integration.types.d.ts +1 -0
  123. package/dist/commands/new/integration/integration.types.js +3 -0
  124. package/dist/commands/new/integration/integration.types.js.map +1 -0
  125. package/dist/commands/new/new.command.d.ts +5 -0
  126. package/dist/commands/new/new.command.js +16 -0
  127. package/dist/commands/new/new.command.js.map +1 -0
  128. package/dist/commands/new/new.utils.d.ts +1 -0
  129. package/dist/commands/new/new.utils.js +18 -0
  130. package/dist/commands/new/new.utils.js.map +1 -0
  131. package/dist/commands/new/workflow/index.d.ts +1 -0
  132. package/dist/commands/new/workflow/index.js +5 -0
  133. package/dist/commands/new/workflow/index.js.map +1 -0
  134. package/dist/commands/new/workflow/workflow.action.d.ts +5 -0
  135. package/dist/commands/new/workflow/workflow.action.js +90 -0
  136. package/dist/commands/new/workflow/workflow.action.js.map +1 -0
  137. package/dist/commands/new/workflow/workflow.command.d.ts +8 -0
  138. package/dist/commands/new/workflow/workflow.command.js +29 -0
  139. package/dist/commands/new/workflow/workflow.command.js.map +1 -0
  140. package/dist/commands/new/workflow/workflow.types.d.ts +3 -0
  141. package/dist/commands/new/workflow/workflow.types.js +3 -0
  142. package/dist/commands/new/workflow/workflow.types.js.map +1 -0
  143. package/dist/commands/push/index.d.ts +1 -0
  144. package/dist/commands/push/index.js +5 -0
  145. package/dist/commands/push/index.js.map +1 -0
  146. package/dist/commands/push/push.action.d.ts +5 -0
  147. package/dist/commands/push/push.action.js +22 -0
  148. package/dist/commands/push/push.action.js.map +1 -0
  149. package/dist/commands/push/push.command.d.ts +8 -0
  150. package/dist/commands/push/push.command.js +26 -0
  151. package/dist/commands/push/push.command.js.map +1 -0
  152. package/dist/commands/push/push.types.d.ts +1 -0
  153. package/dist/commands/push/push.types.js +3 -0
  154. package/dist/commands/push/push.types.js.map +1 -0
  155. package/dist/compiler/compiler.interface.d.ts +3 -0
  156. package/dist/compiler/compiler.interface.js.map +1 -0
  157. package/{src/codegen/codegen.types.ts → dist/compiler/compiler.types.d.ts} +5 -9
  158. package/dist/compiler/compiler.types.js.map +1 -0
  159. package/dist/{compilers → compiler}/compiler.utils.js +3 -4
  160. package/dist/compiler/compiler.utils.js.map +1 -0
  161. package/dist/compiler/compilers/events.compiler.d.ts +10 -0
  162. package/dist/compiler/compilers/events.compiler.js +46 -0
  163. package/dist/compiler/compilers/events.compiler.js.map +1 -0
  164. package/dist/compiler/compilers/integrations.compiler.d.ts +17 -0
  165. package/dist/compiler/compilers/integrations.compiler.js +76 -0
  166. package/dist/compiler/compilers/integrations.compiler.js.map +1 -0
  167. package/dist/compiler/compilers/persona.compiler.d.ts +9 -0
  168. package/dist/compiler/compilers/persona.compiler.js +20 -0
  169. package/dist/compiler/compilers/persona.compiler.js.map +1 -0
  170. package/dist/compiler/compilers/project.compiler.d.ts +14 -0
  171. package/dist/compiler/compilers/project.compiler.js +42 -0
  172. package/dist/compiler/compilers/project.compiler.js.map +1 -0
  173. package/dist/compiler/compilers/workflows.compiler.d.ts +24 -0
  174. package/dist/compiler/compilers/workflows.compiler.js +55 -0
  175. package/dist/compiler/compilers/workflows.compiler.js.map +1 -0
  176. package/dist/{compilers → compiler}/ts.compiler.js +5 -5
  177. package/dist/compiler/ts.compiler.js.map +1 -0
  178. package/dist/config/config.constants.d.ts +0 -2
  179. package/dist/config/config.constants.js +3 -6
  180. package/dist/config/config.constants.js.map +1 -1
  181. package/dist/config/config.types.d.ts +11 -13
  182. package/dist/config/config.types.js +3 -3
  183. package/dist/config/config.types.js.map +1 -1
  184. package/dist/config/config.utils.d.ts +9 -9
  185. package/dist/config/config.utils.js +87 -124
  186. package/dist/config/config.utils.js.map +1 -1
  187. package/dist/config/index.d.ts +1 -0
  188. package/dist/config/index.js +1 -0
  189. package/dist/config/index.js.map +1 -1
  190. package/dist/helpers/file.d.ts +1 -0
  191. package/dist/helpers/file.js +24 -0
  192. package/dist/helpers/file.js.map +1 -0
  193. package/dist/helpers/http.d.ts +1 -0
  194. package/dist/helpers/http.js +11 -0
  195. package/dist/helpers/http.js.map +1 -0
  196. package/dist/helpers/strings.d.ts +1 -0
  197. package/dist/helpers/strings.js +5 -1
  198. package/dist/helpers/strings.js.map +1 -1
  199. package/dist/index.js +0 -0
  200. package/dist/index.js.map +1 -1
  201. package/dist/logger/logger.js +39 -2
  202. package/dist/logger/logger.js.map +1 -1
  203. package/dist/logger/logger.type.d.ts +3 -1
  204. package/dist/templates/configurations/javascript/.prettierrc +4 -0
  205. package/dist/templates/configurations/typescript/.prettierrc +4 -0
  206. package/{templates → dist/templates/configurations}/typescript/tsconfig.json +4 -2
  207. package/dist/templates/typescript/src/events/hello-world.ts +2 -2
  208. package/dist/templates/typescript/src/integrations/slack/config.ts +6 -11
  209. package/dist/templates/typescript/src/integrations/slack/inputs.ts +23 -0
  210. package/dist/templates/typescript/src/integrations/slack/types.ts +57 -0
  211. package/dist/templates/typescript/src/integrations/slack/workflows/workflow1.ts +120 -0
  212. package/dist/templates/typescript/src/persona.meta.ts +1 -0
  213. package/package.json +26 -18
  214. package/dist/commands/login/index.js.map +0 -1
  215. package/dist/commands/login/login.command.js +0 -26
  216. package/dist/commands/login/login.command.js.map +0 -1
  217. package/dist/commands/login/login.types.d.ts +0 -3
  218. package/dist/commands/login/login.types.js.map +0 -1
  219. package/dist/commands/login/login.utils.d.ts +0 -2
  220. package/dist/commands/login/login.utils.js +0 -47
  221. package/dist/commands/login/login.utils.js.map +0 -1
  222. package/dist/compilers/compiler.interface.d.ts +0 -3
  223. package/dist/compilers/compiler.interface.js.map +0 -1
  224. package/dist/compilers/compiler.types.d.ts +0 -23
  225. package/dist/compilers/compiler.types.js.map +0 -1
  226. package/dist/compilers/compiler.utils.js.map +0 -1
  227. package/dist/compilers/event.compiler.d.ts +0 -7
  228. package/dist/compilers/event.compiler.js +0 -25
  229. package/dist/compilers/event.compiler.js.map +0 -1
  230. package/dist/compilers/integration.compiler.d.ts +0 -9
  231. package/dist/compilers/integration.compiler.js +0 -55
  232. package/dist/compilers/integration.compiler.js.map +0 -1
  233. package/dist/compilers/project.compiler.d.ts +0 -10
  234. package/dist/compilers/project.compiler.js +0 -50
  235. package/dist/compilers/project.compiler.js.map +0 -1
  236. package/dist/compilers/ts.compiler.js.map +0 -1
  237. package/dist/compilers/workflow.compiler.d.ts +0 -10
  238. package/dist/compilers/workflow.compiler.js +0 -36
  239. package/dist/compilers/workflow.compiler.js.map +0 -1
  240. package/dist/templates/typescript/src/integrations/slack/workflows/example-workflow.ts +0 -30
  241. package/paragon.json +0 -3
  242. package/sample/sample.js +0 -404
  243. package/src/codegen/codegen.utils.ts +0 -145
  244. package/src/codegen/codegens/condition.codegen.ts +0 -49
  245. package/src/codegen/codegens/event.codegen.ts +0 -39
  246. package/src/codegen/codegens/integration.codegen.ts +0 -23
  247. package/src/codegen/codegens/source.codegen.ts +0 -193
  248. package/src/codegen/codegens/workflow.codegen.ts +0 -495
  249. package/src/commands/build/build.action.ts +0 -73
  250. package/src/commands/build/build.command.ts +0 -61
  251. package/src/commands/build/build.types.ts +0 -7
  252. package/src/commands/build/build.utils.ts +0 -21
  253. package/src/commands/build/index.ts +0 -1
  254. package/src/commands/command.interface.ts +0 -22
  255. package/src/commands/command.loader.ts +0 -33
  256. package/src/commands/index.ts +0 -2
  257. package/src/commands/init/index.ts +0 -1
  258. package/src/commands/init/init.action.ts +0 -166
  259. package/src/commands/init/init.command.ts +0 -71
  260. package/src/commands/init/init.constants.ts +0 -29
  261. package/src/commands/init/init.types.ts +0 -8
  262. package/src/commands/init/init.utils.ts +0 -91
  263. package/src/commands/login/index.ts +0 -1
  264. package/src/commands/login/login.command.ts +0 -48
  265. package/src/commands/login/login.types.ts +0 -9
  266. package/src/commands/login/login.utils.ts +0 -68
  267. package/src/compilers/compiler.interface.ts +0 -9
  268. package/src/compilers/compiler.types.ts +0 -52
  269. package/src/compilers/compiler.utils.ts +0 -32
  270. package/src/compilers/event.compiler.ts +0 -33
  271. package/src/compilers/integration.compiler.ts +0 -84
  272. package/src/compilers/project.compiler.ts +0 -86
  273. package/src/compilers/ts.compiler.ts +0 -116
  274. package/src/compilers/workflow.compiler.ts +0 -69
  275. package/src/config/config.constants.ts +0 -27
  276. package/src/config/config.types.ts +0 -112
  277. package/src/config/config.utils.ts +0 -251
  278. package/src/config/index.ts +0 -2
  279. package/src/helpers/constants.ts +0 -9
  280. package/src/helpers/json.ts +0 -8
  281. package/src/helpers/spinners.ts +0 -3
  282. package/src/helpers/strings.ts +0 -9
  283. package/src/index.ts +0 -26
  284. package/src/logger/index.ts +0 -1
  285. package/src/logger/logger.ts +0 -97
  286. package/src/logger/logger.type.ts +0 -8
  287. package/templates/configurations/javascript/.prettierignore +0 -2
  288. package/templates/configurations/javascript/.prettierrc +0 -11
  289. package/templates/configurations/typescript/.prettierignore +0 -2
  290. package/templates/configurations/typescript/.prettierrc +0 -19
  291. package/templates/javascript/src/events/hello-world.js +0 -13
  292. package/templates/javascript/src/integrations/slack/config.js +0 -11
  293. package/templates/javascript/src/integrations/slack/workflows/example-workflow.js +0 -30
  294. package/templates/typescript/src/events/hello-world.ts +0 -21
  295. package/templates/typescript/src/integrations/slack/config.ts +0 -18
  296. package/templates/typescript/src/integrations/slack/workflows/example-workflow.ts +0 -30
  297. package/tsconfig.json +0 -13
  298. package/tsconfig.release.json +0 -13
  299. /package/dist/commands/{login → auth/login}/index.d.ts +0 -0
  300. /package/dist/commands/{login → auth/login}/index.js +0 -0
  301. /package/dist/commands/{login → auth/login}/login.types.js +0 -0
  302. /package/dist/{compilers → compiler}/compiler.interface.js +0 -0
  303. /package/dist/{compilers → compiler}/compiler.types.js +0 -0
  304. /package/dist/{compilers → compiler}/compiler.utils.d.ts +0 -0
  305. /package/dist/{compilers → compiler}/ts.compiler.d.ts +0 -0
@@ -0,0 +1,67 @@
1
+ import { IStep } from '@useparagon/core/';
2
+ import { IEvent } from '@useparagon/core/event';
3
+ import { InputSource, SerializedInput } from '@useparagon/core/inputs';
4
+ import { IPersona } from '@useparagon/core/persona';
5
+ import { OrConditions } from '@useparagon/core/resolvers';
6
+ export type Integrationntent = {
7
+ name: string;
8
+ title: string;
9
+ inputs: any[];
10
+ output: any[];
11
+ };
12
+ export type IntegrationDependencies = {
13
+ inputs: InputSource[];
14
+ intents: Integrationntent[];
15
+ triggers: Integrationntent[];
16
+ };
17
+ export type IntegrationWorkflowMeta = {
18
+ id: string;
19
+ infoText?: string;
20
+ defaultEnabled?: boolean;
21
+ hidden?: boolean;
22
+ order?: number;
23
+ inputs: SerializedInput[];
24
+ permissions?: OrConditions;
25
+ };
26
+ export type WorkflowMeta = {
27
+ [id: string]: IntegrationWorkflowMeta;
28
+ };
29
+ export type ModalConfig = {
30
+ accentColor?: string;
31
+ paragonLink?: boolean;
32
+ description?: string;
33
+ overview?: string;
34
+ workflowMeta?: WorkflowMeta;
35
+ sharedMeta?: {
36
+ inputs?: SerializedInput[];
37
+ };
38
+ };
39
+ export interface WorkflowBuild {
40
+ id: string;
41
+ name: string;
42
+ steps: IStep[];
43
+ }
44
+ export interface IntegrationBuild {
45
+ id: string;
46
+ config: {
47
+ values: ModalConfig;
48
+ };
49
+ workflows: Record<string, WorkflowBuild | undefined>;
50
+ dependencies?: IntegrationDependencies;
51
+ }
52
+ export interface ProjectBuild {
53
+ projectId: string;
54
+ events: Record<string, IEvent>;
55
+ persona: IPersona;
56
+ integrations: Record<string, IntegrationBuild | undefined>;
57
+ }
58
+ export type IUser = {
59
+ firstName: string;
60
+ middleName: string;
61
+ lastName: string;
62
+ email: string;
63
+ };
64
+ export type IntegrationMetadata = {
65
+ name: string;
66
+ title: string;
67
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=api.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.types.js","sourceRoot":"","sources":["../../src/apis/api.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ import { IUser } from './api.types';
2
+ export declare const getMe: (overrideConfig?: {
3
+ baseUrl: string;
4
+ token: string;
5
+ }) => Promise<IUser>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMe = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const logger_1 = tslib_1.__importDefault(require("../logger"));
6
+ const base_api_1 = require("./base.api");
7
+ const getMe = async (overrideConfig) => {
8
+ try {
9
+ return await (0, base_api_1.get)('auth/me', overrideConfig);
10
+ }
11
+ catch (err) {
12
+ logger_1.default.fatal(`Error while getting user information : ${err}`);
13
+ }
14
+ };
15
+ exports.getMe = getMe;
16
+ //# sourceMappingURL=auth.api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.api.js","sourceRoot":"","sources":["../../src/apis/auth.api.ts"],"names":[],"mappings":";;;;AAAA,+DAA+B;AAE/B,yCAAiC;AAO1B,MAAM,KAAK,GAAG,KAAK,EAAE,cAG3B,EAAkB,EAAE;IACnB,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAC9C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAM,CAAC,KAAK,CAAC,0CAA0C,GAAG,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC,CAAC;AATW,QAAA,KAAK,SAShB"}
@@ -0,0 +1,7 @@
1
+ export declare const getToken: () => Promise<string>;
2
+ export declare const get: (path: string, options?: {
3
+ token: string;
4
+ baseUrl: string;
5
+ }) => Promise<any>;
6
+ export declare const post: <D extends object>(path: string, data: D) => Promise<any>;
7
+ export declare const put: <D extends object>(path: string, data: D) => Promise<any>;
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.put = exports.post = exports.get = exports.getToken = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const axios_1 = tslib_1.__importDefault(require("axios"));
6
+ const logger_1 = tslib_1.__importDefault(require("../logger"));
7
+ const config_1 = require("../config");
8
+ const http_1 = require("../helpers/http");
9
+ let _token;
10
+ let _baseUrl;
11
+ const getBaseUrl = async () => {
12
+ if (_baseUrl) {
13
+ return _baseUrl;
14
+ }
15
+ try {
16
+ const profileConfig = await (0, config_1.getConfigForProfile)(config_1.SystemFile.PROFILES, config_1.DEFAULT_PROFILE);
17
+ if (!profileConfig.services[config_1.Service.ZEUS]) {
18
+ logger_1.default.fatal('Api url is not present in config.');
19
+ }
20
+ _baseUrl = (0, http_1.sanitizeUrl)(profileConfig.services[config_1.Service.ZEUS]);
21
+ return _baseUrl;
22
+ }
23
+ catch {
24
+ logger_1.default.fatal('User not logged in.');
25
+ }
26
+ };
27
+ const getToken = async () => {
28
+ if (_token) {
29
+ return _token;
30
+ }
31
+ try {
32
+ const credential = await (0, config_1.getConfigForProfile)(config_1.SystemFile.CREDENTIALS, config_1.DEFAULT_PROFILE);
33
+ _token = credential.token;
34
+ if (!_token) {
35
+ logger_1.default.fatal('Token value not present in config.');
36
+ }
37
+ return _token;
38
+ }
39
+ catch {
40
+ logger_1.default.fatal('User not logged in.');
41
+ }
42
+ };
43
+ exports.getToken = getToken;
44
+ const handleError = (error) => {
45
+ throw new Error(error.message);
46
+ };
47
+ const get = async (path, options) => {
48
+ const apiBaseUrl = options ? options.baseUrl : await getBaseUrl();
49
+ const token = options ? options.token : await (0, exports.getToken)();
50
+ try {
51
+ const response = await axios_1.default.get(`${apiBaseUrl}/${path}`, {
52
+ headers: {
53
+ Authorization: `Bearer ${token}`,
54
+ },
55
+ });
56
+ return response.data;
57
+ }
58
+ catch (error) {
59
+ handleError(error);
60
+ }
61
+ };
62
+ exports.get = get;
63
+ const post = async (path, data) => {
64
+ try {
65
+ const response = await axios_1.default.post(`${await getBaseUrl()}/${path}`, data, {
66
+ headers: {
67
+ Authorization: `Bearer ${await (0, exports.getToken)()}`,
68
+ },
69
+ });
70
+ return response.data;
71
+ }
72
+ catch (error) {
73
+ handleError(error);
74
+ }
75
+ };
76
+ exports.post = post;
77
+ const put = async (path, data) => {
78
+ try {
79
+ const response = await axios_1.default.put(`${await getBaseUrl()}/${path}`, data, {
80
+ headers: {
81
+ Authorization: `Bearer ${await (0, exports.getToken)()}`,
82
+ },
83
+ });
84
+ return response.data;
85
+ }
86
+ catch (error) {
87
+ handleError(error);
88
+ }
89
+ };
90
+ exports.put = put;
91
+ //# sourceMappingURL=base.api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.api.js","sourceRoot":"","sources":["../../src/apis/base.api.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAE1B,+DAA+B;AAE/B,sCAOmB;AACnB,0CAA8C;AAM9C,IAAI,MAA0B,CAAC;AAC/B,IAAI,QAA4B,CAAC;AAMjC,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,wBAAe,CAChB,CAAC;QAEF,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,gBAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1C,gBAAM,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACpD,CAAC;QAED,QAAQ,GAAG,IAAA,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1
+ import { IEvent } from '@useparagon/core/event';
2
+ export declare const getEventsByProject: (projectId: string) => Promise<IEvent[]>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getEventsByProject = void 0;
4
+ const base_api_1 = require("./base.api");
5
+ const getEventsByProject = async (projectId) => {
6
+ return (0, base_api_1.get)(`projects/${projectId}/events`);
7
+ };
8
+ exports.getEventsByProject = getEventsByProject;
9
+ //# sourceMappingURL=event.api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event.api.js","sourceRoot":"","sources":["../../src/apis/event.api.ts"],"names":[],"mappings":";;;AAEA,yCAAiC;AAO1B,MAAM,kBAAkB,GAAG,KAAK,EACrC,SAAiB,EACE,EAAE;IACrB,OAAO,IAAA,cAAG,EAAC,YAAY,SAAS,SAAS,CAAC,CAAC;AAC7C,CAAC,CAAC;AAJW,QAAA,kBAAkB,sBAI7B"}
@@ -0,0 +1,6 @@
1
+ export * from './api.types';
2
+ export * from './auth.api';
3
+ export * from './event.api';
4
+ export * from './integration.api';
5
+ export * from './project.api';
6
+ export * from './workflow.api';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./api.types"), exports);
5
+ tslib_1.__exportStar(require("./auth.api"), exports);
6
+ tslib_1.__exportStar(require("./event.api"), exports);
7
+ tslib_1.__exportStar(require("./integration.api"), exports);
8
+ tslib_1.__exportStar(require("./project.api"), exports);
9
+ tslib_1.__exportStar(require("./workflow.api"), exports);
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/apis/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,qDAA2B;AAC3B,sDAA4B;AAC5B,4DAAkC;AAClC,wDAA8B;AAC9B,yDAA+B"}
@@ -0,0 +1,3 @@
1
+ import { IntegrationDependencies, IntegrationMetadata } from './api.types';
2
+ export declare const getIntegrationDependencies: (projectId: string, integrations: string[]) => Promise<IntegrationDependencies[]>;
3
+ export declare const getDefaultIntegrations: (projectId: string) => Promise<IntegrationMetadata[]>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultIntegrations = exports.getIntegrationDependencies = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const logger_1 = tslib_1.__importDefault(require("../logger"));
6
+ const base_api_1 = require("./base.api");
7
+ const getIntegrationDependencies = async (projectId, integrations) => {
8
+ try {
9
+ return (0, base_api_1.post)(`graphite/projects/${projectId}/integrations`, {
10
+ integrations,
11
+ });
12
+ }
13
+ catch (err) {
14
+ logger_1.default.fatal(`Could not get integration types from cloud : ${err}`);
15
+ }
16
+ };
17
+ exports.getIntegrationDependencies = getIntegrationDependencies;
18
+ const getDefaultIntegrations = async (projectId) => {
19
+ try {
20
+ return await (0, base_api_1.get)(`graphite/projects/${projectId}/integrations`);
21
+ }
22
+ catch (err) {
23
+ logger_1.default.fatal(`Could not get integrations list : ${err}`);
24
+ }
25
+ };
26
+ exports.getDefaultIntegrations = getDefaultIntegrations;
27
+ //# sourceMappingURL=integration.api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integration.api.js","sourceRoot":"","sources":["../../src/apis/integration.api.ts"],"names":[],"mappings":";;;;AAAA,+DAA+B;AAE/B,yCAAuC;AAMhC,MAAM,0BAA0B,GAAG,KAAK,EAC7C,SAAiB,EACjB,YAAsB,EACc,EAAE;IACtC,IAAI,CAAC;QACH,OAAO,IAAA,eAAI,EAAC,qBAAqB,SAAS,eAAe,EAAE;YACzD,YAAY;SACb,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAM,CAAC,KAAK,CAAC,gDAAgD,GAAG,EAAE,CAAC,CAAC;IACtE,CAAC;AACH,CAAC,CAAC;AAXW,QAAA,0BAA0B,8BAWrC;AAOK,MAAM,sBAAsB,GAAG,KAAK,EACzC,SAAiB,EACe,EAAE;IAClC,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,qBAAqB,SAAS,eAAe,CAAC,CAAC;IAClE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAM,CAAC,KAAK,CAAC,qCAAqC,GAAG,EAAE,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC,CAAC;AARW,QAAA,sBAAsB,0BAQjC"}
@@ -0,0 +1,7 @@
1
+ import { ProjectBuild } from './api.types';
2
+ export declare const getProjectList: () => Promise<{
3
+ title: string;
4
+ id: string;
5
+ }[]>;
6
+ export declare const getProjectBuild: (projectId: string) => Promise<ProjectBuild>;
7
+ export declare const syncProject: (projectId: string, build: ProjectBuild) => Promise<void>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.syncProject = exports.getProjectBuild = exports.getProjectList = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const logger_1 = tslib_1.__importDefault(require("../logger"));
6
+ const base_api_1 = require("./base.api");
7
+ const getProjectList = async () => {
8
+ try {
9
+ return await (0, base_api_1.get)('graphite/projects');
10
+ }
11
+ catch (err) {
12
+ logger_1.default.fatal(`Error while getting projects list : ${err}`);
13
+ }
14
+ };
15
+ exports.getProjectList = getProjectList;
16
+ const getProjectBuild = async (projectId) => {
17
+ try {
18
+ return await (0, base_api_1.get)(`graphite/projects/${projectId}`);
19
+ }
20
+ catch (err) {
21
+ logger_1.default.fatal(`Error while getting project : ${err}`);
22
+ }
23
+ };
24
+ exports.getProjectBuild = getProjectBuild;
25
+ const syncProject = async (projectId, build) => {
26
+ try {
27
+ await (0, base_api_1.put)(`graphite/projects/${projectId}`, build);
28
+ }
29
+ catch (err) {
30
+ logger_1.default.fatal(`Error while syncing project : ${err}`);
31
+ }
32
+ };
33
+ exports.syncProject = syncProject;
34
+ //# sourceMappingURL=project.api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.api.js","sourceRoot":"","sources":["../../src/apis/project.api.ts"],"names":[],"mappings":";;;;AAAA,+DAA+B;AAE/B,yCAAsC;AAM/B,MAAM,cAAc,GAAG,KAAK,IAEjC,EAAE;IACF,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,mBAAmB,CAAC,CAAC;IACxC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAM,CAAC,KAAK,CAAC,uCAAuC,GAAG,EAAE,CAAC,CAAC;IAC7D,CAAC;AACH,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB;AAOK,MAAM,eAAe,GAAG,KAAK,EAClC,SAAiB,EACM,EAAE;IACzB,IAAI,CAAC;QACH,OAAO,MAAM,IAAA,cAAG,EAAC,qBAAqB,SAAS,EAAE,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAM,CAAC,KAAK,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC;AACH,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B;AAMK,MAAM,WAAW,GAAG,KAAK,EAC9B,SAAiB,EACjB,KAAmB,EACJ,EAAE;IACjB,IAAI,CAAC;QACH,MAAM,IAAA,cAAG,EAAC,qBAAqB,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,gBAAM,CAAC,KAAK,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC;AACH,CAAC,CAAC;AATW,QAAA,WAAW,eAStB"}
@@ -0,0 +1,2 @@
1
+ import { IStep } from '@useparagon/core';
2
+ export declare const getWorkflowSteps: (projectId: string, workflowId: string) => Promise<IStep[]>;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getWorkflowSteps = void 0;
4
+ const base_api_1 = require("./base.api");
5
+ const getWorkflowSteps = async (projectId, workflowId) => {
6
+ return (0, base_api_1.get)(`projects/${projectId}/workflows/${workflowId}/steps`);
7
+ };
8
+ exports.getWorkflowSteps = getWorkflowSteps;
9
+ //# sourceMappingURL=workflow.api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.api.js","sourceRoot":"","sources":["../../src/apis/workflow.api.ts"],"names":[],"mappings":";;;AAEA,yCAAiC;AAQ1B,MAAM,gBAAgB,GAAG,KAAK,EACnC,SAAiB,EACjB,UAAkB,EACA,EAAE;IACpB,OAAO,IAAA,cAAG,EAAC,YAAY,SAAS,cAAc,UAAU,QAAQ,CAAC,CAAC;AACpE,CAAC,CAAC;AALW,QAAA,gBAAgB,oBAK3B"}
@@ -1,4 +1,7 @@
1
+ import { IStep } from '@useparagon/core';
1
2
  import { IEvent } from '@useparagon/core/event';
3
+ import { InputSource, SerializedInput } from '@useparagon/core/inputs';
4
+ import { IntegrationWorkflowMeta } from '../apis/api.types';
2
5
  export type ProjectDependencies = {
3
6
  events: Record<string, IEvent>;
4
7
  };
@@ -6,4 +9,15 @@ export type WorkflowDependencies = ProjectDependencies & {
6
9
  integration: {
7
10
  name: string;
8
11
  };
12
+ workflowMeta: IntegrationWorkflowMeta;
13
+ sharedInputs: SerializedInput[];
14
+ inputSources: InputSource[];
15
+ };
16
+ export type StepDependencies = {
17
+ sharedInputs: SerializedInput[];
18
+ inputs: SerializedInput[];
19
+ inputSources: InputSource[];
20
+ stepIdToVariableMap: Record<string, string>;
21
+ events: Record<string, IEvent>;
22
+ stepIdToStepMap: Record<string, IStep>;
9
23
  };
@@ -1,4 +1,4 @@
1
- import { BuildOutput, IntegrationOutput, ProjectDependencies } from '../compilers/compiler.types';
2
- export declare const wrapMultilineString: (value: string) => string;
3
- export declare const generateIntegrationFiles: (integrationName: string, integrationOutput: IntegrationOutput, projectDependencies: ProjectDependencies, projectRoot: string) => Promise<void>;
4
- export declare const generateProjectFiles: (projectBuild: BuildOutput, projectRoot: string) => Promise<void>;
1
+ import { IntegrationBuild, ProjectBuild } from '../apis/api.types';
2
+ import { ProjectDependencies } from '../compiler/compiler.types';
3
+ export declare const generateIntegrationFiles: (integrationName: string, integrationOutput: IntegrationBuild, projectDependencies: ProjectDependencies, projectRoot: string) => Promise<void>;
4
+ export declare const generateProjectFiles: (projectBuild: ProjectBuild, projectRoot: string) => Promise<void>;
@@ -1,70 +1,77 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateProjectFiles = exports.generateIntegrationFiles = exports.wrapMultilineString = void 0;
3
+ exports.generateProjectFiles = exports.generateIntegrationFiles = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const importSortOrderPlugin = tslib_1.__importStar(require("@trivago/prettier-plugin-sort-imports"));
6
5
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
7
6
  const path_1 = tslib_1.__importDefault(require("path"));
8
- const prettier_1 = tslib_1.__importDefault(require("prettier"));
9
- const organiseImportPlugin = tslib_1.__importStar(require("prettier-plugin-organize-imports"));
7
+ const utils_1 = require("@useparagon/core/utils");
8
+ const file_1 = require("../helpers/file");
10
9
  const event_codegen_1 = require("./codegens/event.codegen");
11
10
  const integration_codegen_1 = require("./codegens/integration.codegen");
11
+ const persona_codegen_1 = require("./codegens/persona.codegen");
12
12
  const workflow_codegen_1 = require("./codegens/workflow.codegen");
13
- const writeSourceToFile = (filePath, fileName, sourceCode) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
14
- const sanitizeFileName = fileName;
15
- const formattedCode = prettier_1.default.format(sourceCode, {
16
- parser: 'typescript',
17
- semi: true,
18
- trailingComma: 'all',
19
- singleQuote: true,
20
- plugins: [organiseImportPlugin, importSortOrderPlugin],
21
- importOrder: ['^@useparagon/(.*)$', '^[./]'],
22
- importOrderSeparation: true,
23
- importOrderCaseInsensitive: true,
24
- });
25
- yield fs_extra_1.default.promises.writeFile(path_1.default.join(filePath, `${sanitizeFileName}.ts`), formattedCode);
26
- });
27
- const wrapMultilineString = (value) => {
28
- return '`' + value + '`';
29
- };
30
- exports.wrapMultilineString = wrapMultilineString;
31
- const generateIntegrationFiles = (integrationName, integrationOutput, projectDependencies, projectRoot) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
13
+ const generateIntegrationFiles = async (integrationName, integrationOutput, projectDependencies, projectRoot) => {
14
+ const { events } = projectDependencies;
32
15
  const integrationPath = path_1.default.join(projectRoot, 'integrations', integrationName);
33
- yield fs_extra_1.default.promises.mkdir(integrationPath, {
16
+ await fs_extra_1.default.promises.mkdir(integrationPath, {
34
17
  recursive: true,
35
18
  });
19
+ const sharedInputs = integrationOutput.config.values.sharedMeta?.inputs ?? [];
36
20
  const configCode = (0, integration_codegen_1.integrationConfigToCode)(integrationOutput.config, integrationName);
37
- yield writeSourceToFile(integrationPath, 'config', configCode);
38
- const workflowOutputs = Object.values(integrationOutput.workflows);
21
+ const inputSources = integrationOutput.dependencies?.inputs ?? [];
22
+ const inputsSouceCode = (0, integration_codegen_1.integrationInputsToCode)(sharedInputs, inputSources);
23
+ if (integrationOutput.dependencies) {
24
+ const integrationTypesCode = (0, integration_codegen_1.typesForIntegration)(integrationName, integrationOutput.dependencies);
25
+ await (0, file_1.writeSourceToFile)(integrationPath, 'types', integrationTypesCode);
26
+ }
27
+ await Promise.all([
28
+ (0, file_1.writeSourceToFile)(integrationPath, 'config', configCode),
29
+ (0, file_1.writeSourceToFile)(integrationPath, 'inputs', inputsSouceCode),
30
+ ]);
31
+ const workflowMetas = integrationOutput.config.values.workflowMeta ?? {};
32
+ const workflows = Object.values(integrationOutput.workflows);
39
33
  const workflowPath = path_1.default.join(integrationPath, 'workflows');
40
- if (workflowOutputs.length) {
34
+ if (workflows.length) {
41
35
  fs_extra_1.default.promises.mkdir(workflowPath, {
42
36
  recursive: true,
43
37
  });
44
38
  }
45
- for (const workflowOutput of workflowOutputs) {
46
- const workflowCode = (0, workflow_codegen_1.workflowToCode)(workflowOutput, Object.assign(Object.assign({}, projectDependencies), { integration: { name: integrationName } }));
47
- yield writeSourceToFile(workflowPath, workflowOutput.name, workflowCode);
39
+ const generateUniqueNames = (0, utils_1.withUniqueFileNames)();
40
+ for (const workflow of workflows) {
41
+ const workflowCode = (0, workflow_codegen_1.workflowToCode)(workflow, {
42
+ events,
43
+ integration: { name: integrationName },
44
+ sharedInputs,
45
+ inputSources,
46
+ workflowMeta: workflowMetas[workflow.id] || {
47
+ id: workflow.id,
48
+ inputs: [],
49
+ },
50
+ });
51
+ await (0, file_1.writeSourceToFile)(workflowPath, generateUniqueNames(workflow.name), workflowCode);
48
52
  }
49
- });
53
+ };
50
54
  exports.generateIntegrationFiles = generateIntegrationFiles;
51
- const generateProjectFiles = (projectBuild, projectRoot) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
52
- yield fs_extra_1.default.promises.mkdir(projectRoot, { recursive: true });
55
+ const generateProjectFiles = async (projectBuild, projectRoot) => {
53
56
  const events = Object.values(projectBuild.events);
54
57
  const eventPath = path_1.default.join(projectRoot, 'events');
55
58
  if (events.length) {
56
- yield fs_extra_1.default.promises.mkdir(eventPath, {
59
+ await fs_extra_1.default.promises.mkdir(eventPath, {
57
60
  recursive: true,
58
61
  });
59
62
  }
60
63
  for (const event of events) {
61
64
  const eventSourceCode = (0, event_codegen_1.eventToCode)(event);
62
- yield writeSourceToFile(eventPath, event.name, eventSourceCode);
65
+ await (0, file_1.writeSourceToFile)(eventPath, (0, utils_1.toCamelCase)(event.name), eventSourceCode);
63
66
  }
67
+ await (0, file_1.writeSourceToFile)(projectRoot, 'persona.meta', (0, persona_codegen_1.personaToCode)(projectBuild.persona));
64
68
  const integrationOutputs = Object.entries(projectBuild.integrations);
65
69
  for (const [integrationName, integrationOutput] of integrationOutputs) {
66
- yield (0, exports.generateIntegrationFiles)(integrationName, integrationOutput, { events: projectBuild.events }, projectRoot);
70
+ await (0, exports.generateIntegrationFiles)(integrationName, integrationOutput, {
71
+ events: projectBuild.events,
72
+ projectId: projectBuild.projectId,
73
+ }, projectRoot);
67
74
  }
68
- });
75
+ };
69
76
  exports.generateProjectFiles = generateProjectFiles;
70
77
  //# sourceMappingURL=codegen.utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"codegen.utils.js","sourceRoot":"","sources":["../../src/codegen/codegen.utils.ts"],"names":[],"mappings":";;;;AAAA,qGAA+E;AAC/E,gEAA0B;AAC1B,wDAAwB;AACxB,gEAAgC;AAChC,+FAAyE;AAUzE,4DAAuD;AACvD,wEAAyE;AACzE,kEAA6D;AAQ7D,MAAM,iBAAiB,GAAG,CACxB,QAAgB,EAChB,QAAgB,EAChB,UAAkB,EACH,EAAE;IACjB,MAAM,gBAAgB,GAAW,QAAQ,CAAC;IAE1C,MAAM,aAAa,GAAW,kBAAQ,CAAC,MAAM,CAAC,UAAU,EAAE;QACxD,MAAM,EAAE,YAAY;QACpB,IAAI,EAAE,IAAI;QACV,aAAa,EAAE,KAAK;QACpB,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,CAAC,oBAAoB,EAAE,qBAAqB,CAAC;QAEtD,WAAW,EAAE,CAAC,oBAAoB,EAAE,OAAO,CAAC;QAC5C,qBAAqB,EAAE,IAAI;QAC3B,0BAA0B,EAAE,IAAI;KACjC,CAAC,CAAC;IAEH,MAAM,kBAAE,CAAC,QAAQ,CAAC,SAAS,CACzB,cAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,gBAAgB,KAAK,CAAC,EAC7C,aAAa,CACd,CAAC;AACJ,CAAC,CAAA,CAAC;AAOK,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAU,EAAE;IAC3D,OAAO,GAAG,GAAG,KAAK,GAAG,GAAG,CAAC;AAC3B,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B;AAQK,MAAM,wBAAwB,GAAG,CACtC,eAAuB,EACvB,iBAAoC,EACpC,mBAAwC,EACxC,WAAmB,EACnB,EAAE;IACF,MAAM,eAAe,GAAW,cAAI,CAAC,IAAI,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AAsC,MAAM,CAAC,OAAO,CAC1E,YAAY,CAAC,YAAY,CACW,CAAC;IAEvC,KAAK,MAAM,CAAC,eAAe,EAAE,iBAAiB,CAAC,IAAI,kBAAkB,EAAE,CAAC;QACtE,MAAM,IAAA,gCAAwB,EAC5B,eAAe,EACf,iBAAiB,EACjB;YACE,MAAM,EAAE,YAAY,CAAC,MAAM;YAC3B,SAAS,EAAE,YAAY,CAAC,SAAS;SAClC,EACD,WAAW,CACZ,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AA7CW,QAAA,oBAAoB,wBA6C/B"}
@@ -1,2 +1,3 @@
1
1
  import { OperatorCondition } from '@useparagon/core/resolvers';
2
- export declare const conditionToCode: (operatorCondition: OperatorCondition, stepIdToVariableMap: Record<string, string>) => string;
2
+ import { StepDependencies } from '../codegen.types';
3
+ export declare const conditionToCode: (operatorCondition: OperatorCondition, dependencies: StepDependencies) => string;