@superblocksteam/util 2.0.162 → 2.0.163-next.0

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 (109) hide show
  1. package/dist/api-files/api.d.mts +8 -0
  2. package/dist/api-files/api.d.mts.map +1 -0
  3. package/dist/api-files/api.mjs +262 -0
  4. package/dist/api-files/api.mjs.map +1 -0
  5. package/dist/api-files/constants.d.ts +6 -0
  6. package/dist/api-files/constants.d.ts.map +1 -0
  7. package/dist/api-files/constants.js +9 -0
  8. package/dist/api-files/constants.js.map +1 -0
  9. package/dist/api-files/index.d.ts +8 -0
  10. package/dist/api-files/index.d.ts.map +1 -0
  11. package/dist/api-files/index.js +18 -0
  12. package/dist/api-files/index.js.map +1 -0
  13. package/dist/api-files/types.d.ts +115 -0
  14. package/dist/api-files/types.d.ts.map +1 -0
  15. package/dist/api-files/types.js +14 -0
  16. package/dist/api-files/types.js.map +1 -0
  17. package/dist/component-configs.d.ts +6 -0
  18. package/dist/component-configs.d.ts.map +1 -0
  19. package/dist/component-configs.js +178 -0
  20. package/dist/component-configs.js.map +1 -0
  21. package/dist/constants.d.ts +18 -0
  22. package/dist/constants.d.ts.map +1 -0
  23. package/dist/constants.js +37 -0
  24. package/dist/constants.js.map +1 -0
  25. package/dist/data-types.d.ts +8 -0
  26. package/dist/data-types.d.ts.map +1 -0
  27. package/dist/data-types.js +22 -0
  28. package/dist/data-types.js.map +1 -0
  29. package/dist/events.d.ts +13 -0
  30. package/dist/events.d.ts.map +1 -0
  31. package/dist/events.js +17 -0
  32. package/dist/events.js.map +1 -0
  33. package/dist/file-uploader.d.ts +3 -0
  34. package/dist/file-uploader.d.ts.map +1 -0
  35. package/dist/file-uploader.js +41 -0
  36. package/dist/file-uploader.js.map +1 -0
  37. package/dist/file-uploader.test.d.ts +2 -0
  38. package/dist/file-uploader.test.d.ts.map +1 -0
  39. package/dist/file-uploader.test.js +43 -0
  40. package/dist/file-uploader.test.js.map +1 -0
  41. package/dist/generate-component-types.d.ts +3 -0
  42. package/dist/generate-component-types.d.ts.map +1 -0
  43. package/dist/generate-component-types.js +45 -0
  44. package/dist/generate-component-types.js.map +1 -0
  45. package/dist/identifiers.d.ts +9 -0
  46. package/dist/identifiers.d.ts.map +1 -0
  47. package/dist/identifiers.js +68 -0
  48. package/dist/identifiers.js.map +1 -0
  49. package/{src/index.ts → dist/index.d.ts} +1 -0
  50. package/dist/index.d.ts.map +1 -0
  51. package/dist/index.js.map +1 -0
  52. package/dist/localGitRepoState.d.ts +20 -0
  53. package/dist/localGitRepoState.d.ts.map +1 -0
  54. package/dist/localGitRepoState.js +3 -0
  55. package/dist/localGitRepoState.js.map +1 -0
  56. package/dist/login.d.ts +17 -0
  57. package/dist/login.d.ts.map +1 -0
  58. package/dist/login.js +74 -0
  59. package/dist/login.js.map +1 -0
  60. package/dist/mask-unix-signals.d.ts +28 -0
  61. package/dist/mask-unix-signals.d.ts.map +1 -0
  62. package/dist/mask-unix-signals.js +81 -0
  63. package/dist/mask-unix-signals.js.map +1 -0
  64. package/dist/resource-configs.d.ts +73 -0
  65. package/dist/resource-configs.d.ts.map +1 -0
  66. package/dist/resource-configs.js +224 -0
  67. package/dist/resource-configs.js.map +1 -0
  68. package/dist/token-manager.d.ts +22 -0
  69. package/dist/token-manager.d.ts.map +1 -0
  70. package/dist/token-manager.js +3 -0
  71. package/dist/token-manager.js.map +1 -0
  72. package/dist/types.d.ts +105 -0
  73. package/dist/types.d.ts.map +1 -0
  74. package/dist/types.js +3 -0
  75. package/dist/types.js.map +1 -0
  76. package/dist/unreachable.d.ts +2 -0
  77. package/dist/unreachable.d.ts.map +1 -0
  78. package/dist/unreachable.js +7 -0
  79. package/dist/unreachable.js.map +1 -0
  80. package/dist/validation.d.ts +5 -0
  81. package/dist/validation.d.ts.map +1 -0
  82. package/dist/validation.js +152 -0
  83. package/dist/validation.js.map +1 -0
  84. package/package.json +5 -2
  85. package/eslint.config.mjs +0 -67
  86. package/lint-staged.config.mjs +0 -6
  87. package/src/api-files/api.mts +0 -506
  88. package/src/api-files/constants.ts +0 -6
  89. package/src/api-files/index.ts +0 -22
  90. package/src/api-files/types.ts +0 -131
  91. package/src/component-configs.ts +0 -163
  92. package/src/constants.ts +0 -34
  93. package/src/data-types.ts +0 -25
  94. package/src/events.ts +0 -12
  95. package/src/file-uploader.test.ts +0 -69
  96. package/src/file-uploader.ts +0 -42
  97. package/src/generate-component-types.ts +0 -53
  98. package/src/identifiers.ts +0 -70
  99. package/src/localGitRepoState.ts +0 -20
  100. package/src/login.ts +0 -82
  101. package/src/mask-unix-signals.ts +0 -86
  102. package/src/resource-configs.ts +0 -356
  103. package/src/token-manager.ts +0 -26
  104. package/src/types.ts +0 -138
  105. package/src/unreachable.ts +0 -5
  106. package/src/validation.ts +0 -155
  107. package/tsconfig.json +0 -21
  108. package/turbo.json +0 -9
  109. package/vitest.config.ts +0 -7
@@ -1,506 +0,0 @@
1
- import fs from "fs-extra";
2
- import { cloneDeep } from "lodash-es";
3
- import slugify from "slugify";
4
- import { parse, stringify as ymlstringify } from "yaml";
5
-
6
- import {
7
- DEFAULT_LINES_FOR_LARGE_STEPS,
8
- LANGUAGE_STEP_EXTENSIONS,
9
- } from "./constants.js";
10
- import type {
11
- AdditionalStepFiles,
12
- Api,
13
- ApiRepresentation,
14
- ApiWrapper,
15
- Block,
16
- LanguageContent,
17
- Step,
18
- } from "./types.js";
19
-
20
- function slugifyName(originalName: any): string {
21
- return (slugify as any)(originalName, {
22
- replacement: "_",
23
- lower: true,
24
- });
25
- }
26
-
27
- function findUnusedFilePath(
28
- filename: string,
29
- extension: string,
30
- existingFilePaths: Set<string>,
31
- ): string {
32
- let proposedFilename = `${filename}.${extension}`;
33
- let i = 1;
34
- while (existingFilePaths.has(proposedFilename)) {
35
- proposedFilename = `${filename}_${i}.${extension}`;
36
- i++;
37
- }
38
- existingFilePaths.add(proposedFilename);
39
- return proposedFilename;
40
- }
41
-
42
- function extractAdditionalStepFiles(
43
- api: Api,
44
- additionalStepFiles: AdditionalStepFiles[],
45
- stepPathMap: Record<string, string>,
46
- currentStepNames: string[],
47
- apiRepresentation?: ApiRepresentation,
48
- ): Api {
49
- if (!api.blocks || !apiRepresentation?.extractLargeSourceFiles) {
50
- return api;
51
- }
52
- // TODO: lodash
53
- const apiClone = cloneDeep(api);
54
- const minLinesForExtraction =
55
- apiRepresentation?.minLinesForExtraction ?? DEFAULT_LINES_FOR_LARGE_STEPS;
56
- const existingFilePaths = new Set<string>();
57
- extractAdditionalStepFilesFromBlocks(
58
- apiClone.blocks ?? [],
59
- additionalStepFiles,
60
- existingFilePaths,
61
- minLinesForExtraction,
62
- stepPathMap,
63
- currentStepNames,
64
- );
65
- return apiClone;
66
- }
67
-
68
- function extractAdditionalStepFilesFromStep(
69
- step: Step,
70
- name: string,
71
- additionalStepFiles: AdditionalStepFiles[],
72
- existingFilePaths: Set<string>,
73
- minLinesForExtraction: number,
74
- stepPathMap: Record<string, string>,
75
- currentStepNames: string[],
76
- ) {
77
- // Handle language step files
78
- if (step && "integration" in step) {
79
- const integration = step.integration as keyof Step;
80
- const extension =
81
- LANGUAGE_STEP_EXTENSIONS[
82
- integration as keyof typeof LANGUAGE_STEP_EXTENSIONS
83
- ];
84
- if (extension) {
85
- const languageContent = step[integration] as LanguageContent;
86
- if (languageContent) {
87
- const blockBody = languageContent.body;
88
- if (blockBody && typeof blockBody === "string") {
89
- const lines = blockBody?.split("\n");
90
- const linesNum = lines?.length;
91
- if (linesNum && linesNum > minLinesForExtraction) {
92
- // Record the separate file is needed, with the language contents
93
- let relativePath;
94
- if (stepPathMap?.[name]) {
95
- relativePath = stepPathMap[name].startsWith("./")
96
- ? stepPathMap[name].split("./")?.[1]
97
- : stepPathMap[name];
98
- } else {
99
- relativePath = findUnusedFilePath(
100
- slugifyName(name),
101
- extension,
102
- existingFilePaths,
103
- );
104
- stepPathMap[name] = `./${relativePath}`;
105
- }
106
- additionalStepFiles.push({
107
- relativePath: relativePath,
108
- contents: blockBody,
109
- language: integration,
110
- });
111
- currentStepNames.push(name);
112
- // Replace the body with a reference to the separate file
113
- languageContent.body = {
114
- path: `./${relativePath}`,
115
- };
116
- }
117
- }
118
- }
119
- }
120
- }
121
- }
122
-
123
- function extractAdditionalStepFilesFromBlocks(
124
- blocks: Block[],
125
- additionalStepFiles: AdditionalStepFiles[],
126
- existingFilePaths: Set<string>,
127
- minLinesForExtraction: number,
128
- stepPathMap: Record<string, string>,
129
- currentStepNames: string[],
130
- ) {
131
- for (const block of blocks) {
132
- // Handle language step files
133
- if (block.step) {
134
- extractAdditionalStepFilesFromStep(
135
- block.step,
136
- block.name,
137
- additionalStepFiles,
138
- existingFilePaths,
139
- minLinesForExtraction,
140
- stepPathMap,
141
- currentStepNames,
142
- );
143
- }
144
-
145
- // Handle loops
146
- extractAdditionalStepFilesFromBlocks(
147
- block.loop?.blocks ?? [],
148
- additionalStepFiles,
149
- existingFilePaths,
150
- minLinesForExtraction,
151
- stepPathMap,
152
- currentStepNames,
153
- );
154
- // Handle try/catch
155
- if (block.tryCatch) {
156
- extractAdditionalStepFilesFromBlocks(
157
- block.tryCatch.try?.blocks ?? [],
158
- additionalStepFiles,
159
- existingFilePaths,
160
- minLinesForExtraction,
161
- stepPathMap,
162
- currentStepNames,
163
- );
164
- extractAdditionalStepFilesFromBlocks(
165
- block.tryCatch.catch?.blocks ?? [],
166
- additionalStepFiles,
167
- existingFilePaths,
168
- minLinesForExtraction,
169
- stepPathMap,
170
- currentStepNames,
171
- );
172
- extractAdditionalStepFilesFromBlocks(
173
- block.tryCatch.finally?.blocks ?? [],
174
- additionalStepFiles,
175
- existingFilePaths,
176
- minLinesForExtraction,
177
- stepPathMap,
178
- currentStepNames,
179
- );
180
- }
181
- // Handle conditional
182
- if (block.conditional) {
183
- extractAdditionalStepFilesFromBlocks(
184
- block.conditional.if?.blocks ?? [],
185
- additionalStepFiles,
186
- existingFilePaths,
187
- minLinesForExtraction,
188
- stepPathMap,
189
- currentStepNames,
190
- );
191
- for (const elseIfBlock of block.conditional.elseIf ?? []) {
192
- extractAdditionalStepFilesFromBlocks(
193
- elseIfBlock.blocks,
194
- additionalStepFiles,
195
- existingFilePaths,
196
- minLinesForExtraction,
197
- stepPathMap,
198
- currentStepNames,
199
- );
200
- }
201
- extractAdditionalStepFilesFromBlocks(
202
- block.conditional.else?.blocks ?? [],
203
- additionalStepFiles,
204
- existingFilePaths,
205
- minLinesForExtraction,
206
- stepPathMap,
207
- currentStepNames,
208
- );
209
- }
210
- // Handle Parallel API
211
- if (block.parallel) {
212
- for (const path of Object.values(block.parallel?.static?.paths ?? {})) {
213
- extractAdditionalStepFilesFromBlocks(
214
- path.blocks,
215
- additionalStepFiles,
216
- existingFilePaths,
217
- minLinesForExtraction,
218
- stepPathMap,
219
- currentStepNames,
220
- );
221
- }
222
- extractAdditionalStepFilesFromBlocks(
223
- block.parallel?.dynamic?.blocks ?? [],
224
- additionalStepFiles,
225
- existingFilePaths,
226
- minLinesForExtraction,
227
- stepPathMap,
228
- currentStepNames,
229
- );
230
- }
231
- // Handle stream
232
- if (block.stream) {
233
- const trigger = block.stream.trigger;
234
- if (trigger && trigger.step) {
235
- extractAdditionalStepFilesFromStep(
236
- trigger.step,
237
- trigger.name,
238
- additionalStepFiles,
239
- existingFilePaths,
240
- minLinesForExtraction,
241
- stepPathMap,
242
- currentStepNames,
243
- );
244
- }
245
- extractAdditionalStepFilesFromBlocks(
246
- block.stream.process?.blocks ?? [],
247
- additionalStepFiles,
248
- existingFilePaths,
249
- minLinesForExtraction,
250
- stepPathMap,
251
- currentStepNames,
252
- );
253
- }
254
- }
255
- }
256
-
257
- async function readYamlFile(path: string): Promise<any> {
258
- return parse(await fs.readFile(path, "utf8"));
259
- }
260
-
261
- export async function resolveLanguageSpecificStepContentFromBlocks(
262
- parentPath: string,
263
- blocks: Block[],
264
- stepPathMap: Record<string, string>,
265
- ) {
266
- for (const block of blocks) {
267
- // Handle language-specific step content
268
- if (block.step) {
269
- const step = block.step;
270
- await resolveLanguageSpecificStepContentFromStep(
271
- parentPath,
272
- step,
273
- block.name,
274
- stepPathMap,
275
- );
276
- }
277
- // Handle conditional blocks
278
- if (block.conditional) {
279
- await resolveLanguageSpecificStepContentFromBlocks(
280
- parentPath,
281
- block.conditional.if?.blocks ?? [],
282
- stepPathMap,
283
- );
284
- for (const elseIfBlock of block.conditional.elseIf) {
285
- await resolveLanguageSpecificStepContentFromBlocks(
286
- parentPath,
287
- elseIfBlock.blocks,
288
- stepPathMap,
289
- );
290
- }
291
- await resolveLanguageSpecificStepContentFromBlocks(
292
- parentPath,
293
- block.conditional.else?.blocks ?? [],
294
- stepPathMap,
295
- );
296
- }
297
- // Handle loop blocks
298
- await resolveLanguageSpecificStepContentFromBlocks(
299
- parentPath,
300
- block.loop?.blocks ?? [],
301
- stepPathMap,
302
- );
303
- // Handle try-catch blocks
304
- if (block.tryCatch) {
305
- await resolveLanguageSpecificStepContentFromBlocks(
306
- parentPath,
307
- block.tryCatch.try?.blocks ?? [],
308
- stepPathMap,
309
- );
310
- await resolveLanguageSpecificStepContentFromBlocks(
311
- parentPath,
312
- block.tryCatch.catch?.blocks ?? [],
313
- stepPathMap,
314
- );
315
- await resolveLanguageSpecificStepContentFromBlocks(
316
- parentPath,
317
- block.tryCatch.finally?.blocks ?? [],
318
- stepPathMap,
319
- );
320
- }
321
- // Handle parallel blocks
322
- if (block.parallel) {
323
- for (const path of Object.values(block.parallel?.static?.paths ?? {})) {
324
- await resolveLanguageSpecificStepContentFromBlocks(
325
- parentPath,
326
- path.blocks,
327
- stepPathMap,
328
- );
329
- }
330
- await resolveLanguageSpecificStepContentFromBlocks(
331
- parentPath,
332
- block.parallel?.dynamic?.blocks ?? [],
333
- stepPathMap,
334
- );
335
- }
336
- // Handle stream blocks
337
- if (block.stream) {
338
- await resolveLanguageSpecificStepContentFromBlocks(
339
- parentPath,
340
- block.stream.process?.blocks ?? [],
341
- stepPathMap,
342
- );
343
- await resolveLanguageSpecificStepContentFromStep(
344
- parentPath,
345
- block.stream.trigger?.step ?? ({} as Step),
346
- block.stream.trigger?.name,
347
- stepPathMap,
348
- );
349
- }
350
- }
351
- }
352
-
353
- async function resolveLanguageSpecificStepContentFromStep(
354
- parentPath: string,
355
- step: Step,
356
- stepName?: string,
357
- stepPathMap?: Record<string, string>,
358
- ) {
359
- // Handle language-specific step content
360
- if (
361
- !step?.integration ||
362
- !LANGUAGE_STEP_EXTENSIONS[
363
- step.integration as keyof typeof LANGUAGE_STEP_EXTENSIONS
364
- ]
365
- ) {
366
- return;
367
- }
368
- const languageContent = step[
369
- step.integration as keyof Step
370
- ] as LanguageContent;
371
- if (
372
- languageContent.body &&
373
- typeof languageContent.body === "object" &&
374
- "path" in languageContent.body
375
- ) {
376
- const languageFilePath = `${parentPath}/${languageContent.body.path}`;
377
- if (await fs.pathExists(languageFilePath)) {
378
- // Read the file content
379
- const stepBodyContent = await fs.readFile(languageFilePath, "utf8");
380
- if (stepBodyContent && languageContent) {
381
- if (stepPathMap && stepName) {
382
- stepPathMap[stepName] = languageContent.body.path;
383
- }
384
- languageContent.body = stepBodyContent;
385
- }
386
- }
387
- }
388
- }
389
-
390
- export async function writeApiFiles(
391
- api: ApiWrapper,
392
- apiNameSlug: string,
393
- directoryPath: string,
394
- nestedApiFiles: boolean,
395
- apiPromises: Array<Promise<void>>,
396
- additionalStepFiles: AdditionalStepFiles[],
397
- apiRepresentation?: ApiRepresentation,
398
- existingFilePaths?: Set<string>,
399
- stepPathMap?: Record<string, string>,
400
- ) {
401
- let pathForApiFile = directoryPath;
402
- let yamlFileName = `${apiNameSlug}.yaml`;
403
-
404
- const currentStepNames: string[] = [];
405
- // Determine whether to extract into separate files the source code from the steps
406
- const updatedApi = extractAdditionalStepFiles(
407
- api.apiPb,
408
- additionalStepFiles,
409
- stepPathMap ?? {},
410
- currentStepNames,
411
- apiRepresentation,
412
- );
413
-
414
- // Stop tracking unused step paths from removed steps (e.g. when a step is renamed or removed)
415
- if (stepPathMap) {
416
- Object.keys(stepPathMap).forEach((stepName) => {
417
- if (!currentStepNames.includes(stepName)) {
418
- const stepFileName = stepPathMap[stepName].startsWith("./")
419
- ? stepPathMap[stepName].split("./")[1]
420
- : stepPathMap[stepName];
421
- fs.remove(`${pathForApiFile}/${stepFileName}`);
422
- delete stepPathMap[stepName];
423
- }
424
- });
425
- }
426
-
427
- if (apiRepresentation?.extractLargeSourceFiles) {
428
- if (nestedApiFiles) {
429
- // This API has at least one large step code file, so we need a nested directory
430
- pathForApiFile = `${pathForApiFile}/${apiNameSlug}`;
431
- yamlFileName = "api.yaml";
432
- }
433
- // Make sure the directory exists
434
- await fs.ensureDir(pathForApiFile);
435
- // Write any additional step source code files to the disk
436
- for (const stepFile of additionalStepFiles) {
437
- const sourceFilePath = `${pathForApiFile}/${stepFile.relativePath}`;
438
- const handleApi = async () => {
439
- await fs.outputFile(sourceFilePath, stepFile.contents);
440
- };
441
- apiPromises.push(handleApi());
442
- // Mark the existing source file as being reused
443
- existingFilePaths?.delete(sourceFilePath);
444
- }
445
- } else {
446
- // No additional step files to write, so mark the API directory as existing so that it will be removed later.
447
- // Do this even if the current representation does not extract large source files, in case they were previously
448
- existingFilePaths?.add(`${directoryPath}/${apiNameSlug}`);
449
- }
450
-
451
- // Convert the updated API to YAML and write it to disk
452
- const apiContent = ymlstringify(updatedApi, {
453
- sortMapEntries: true,
454
- blockQuote: "literal",
455
- });
456
- const yamlFilePath = `${pathForApiFile}/${yamlFileName}`;
457
- const handleApi = async () => {
458
- await fs.outputFile(yamlFilePath, apiContent);
459
- };
460
- apiPromises.push(handleApi());
461
- // Mark the existing source file as being reused
462
- existingFilePaths?.delete(yamlFilePath);
463
- }
464
-
465
- export async function readAppApiYamlFile(
466
- parentDirectory: string,
467
- apiName?: string,
468
- slugifyDirectoryName: boolean = true,
469
- ): Promise<{ api: Api; stepPathMap: Record<string, string> }> {
470
- // The API is either stored in its entirety in a single YAML file, or
471
- // or in a subdirectory containing the YAML file and zero or more language-specific files.
472
- const apiNameSlug = slugifyName(apiName ?? "api");
473
- const singularApiYamlPath = `${parentDirectory}/${apiNameSlug}.yaml`;
474
- const apiDirPath = `${parentDirectory}/${slugifyDirectoryName ? apiNameSlug : apiName}`;
475
- const nestedApiYamlPath = `${apiDirPath}/api.yaml`;
476
-
477
- // Read the YAML file
478
- let yamlPath: string;
479
- let yamlParentPath: string;
480
- if (await fs.pathExists(singularApiYamlPath)) {
481
- // The API YAML file is in the parent directory
482
- yamlPath = singularApiYamlPath;
483
- yamlParentPath = parentDirectory;
484
- } else if (await fs.pathExists(nestedApiYamlPath)) {
485
- // The API YAML file is nested in an API-specific directory
486
- yamlPath = nestedApiYamlPath;
487
- yamlParentPath = apiDirPath;
488
- } else {
489
- throw new Error(`API ${apiName ?? ""} not found at ${parentDirectory}`);
490
- }
491
-
492
- // That is nested in an API-specific directory
493
- const apiDefn = (await readYamlFile(yamlPath)) as Api;
494
-
495
- // Map step name -> step path
496
- const stepPathMap: Record<string, string> = {};
497
-
498
- // The API YAML file may or may not have language-specific content in separate files.
499
- // Replace any file references with the actual content
500
- await resolveLanguageSpecificStepContentFromBlocks(
501
- yamlParentPath,
502
- apiDefn.blocks ?? [],
503
- stepPathMap,
504
- );
505
- return { api: apiDefn, stepPathMap };
506
- }
@@ -1,6 +0,0 @@
1
- export const LANGUAGE_STEP_EXTENSIONS = {
2
- javascript: "js",
3
- python: "py",
4
- } as const;
5
-
6
- export const DEFAULT_LINES_FOR_LARGE_STEPS = 1;
@@ -1,22 +0,0 @@
1
- import type * as Api from "./api.mjs" with { "resolution-mode": "import" };
2
-
3
- export async function writeApiFiles(
4
- ...args: Parameters<typeof Api.writeApiFiles>
5
- ) {
6
- const esmFunction = await import("./api.mjs");
7
- return esmFunction.writeApiFiles(...args);
8
- }
9
-
10
- export async function readAppApiYamlFile(
11
- ...args: Parameters<typeof Api.readAppApiYamlFile>
12
- ) {
13
- const esmFunction = await import("./api.mjs");
14
- return esmFunction.readAppApiYamlFile(...args);
15
- }
16
-
17
- export async function resolveLanguageSpecificStepContentFromBlocks(
18
- ...args: Parameters<typeof Api.resolveLanguageSpecificStepContentFromBlocks>
19
- ) {
20
- const esmFunction = await import("./api.mjs");
21
- return esmFunction.resolveLanguageSpecificStepContentFromBlocks(...args);
22
- }
@@ -1,131 +0,0 @@
1
- export type AdditionalStepFiles = {
2
- relativePath: string;
3
- contents: string;
4
- language: keyof Step;
5
- };
6
-
7
- export type ApiRepresentation = {
8
- extractLargeSourceFiles: boolean;
9
- minLinesForExtraction: number;
10
- };
11
-
12
- export interface ApiWrapper {
13
- apiPb: Api;
14
- name?: string; //@deprecated this attribute is used for getting a name for backends(jobs and workflows) that were never migrated to the new API version.
15
- }
16
-
17
- /** A signature, as produced by the agent. */
18
- export interface Signature {
19
- /** The id of the key used to sign the data. */
20
- keyId: string;
21
- /** The actual signature, in base64. */
22
- data: string;
23
- }
24
-
25
- export type Api = {
26
- metadata: {
27
- id: string;
28
- name: string;
29
- organization: string;
30
- timestamps?: {
31
- created: string;
32
- updated: string;
33
- deactivated: boolean;
34
- };
35
- // These properties are merged in from the v3 api entity
36
- creator?: {
37
- id: string;
38
- name: string;
39
- };
40
- folder?: string;
41
- };
42
- blocks?: Block[];
43
- trigger: any;
44
- signature?: Signature;
45
- };
46
-
47
- export type Block = {
48
- name: string;
49
- step?: Step;
50
- loop?: Loop;
51
- tryCatch?: TryCatch;
52
- conditional?: Conditional;
53
- parallel?: Parallel;
54
- stream?: Stream;
55
- };
56
-
57
- export type Step = {
58
- integration: string;
59
- javascript?: LanguageContent;
60
- python?: LanguageContent;
61
- };
62
-
63
- type Loop = {
64
- blocks: Block[];
65
- range: string;
66
- type: LoopType;
67
- variables?: Variables;
68
- };
69
-
70
- export enum LoopType {
71
- FOR_EACH = "TYPE_FOREACH",
72
- }
73
-
74
- type TryCatch = {
75
- try?: Blocks;
76
- catch?: Blocks;
77
- finally?: Blocks;
78
- variables?: Variables;
79
- };
80
-
81
- type Conditional = {
82
- if?: ConditionalBlockWithCondition;
83
- elseIf: ConditionalBlockWithCondition[];
84
- else?: Blocks;
85
- };
86
-
87
- type Blocks = {
88
- blocks: Block[];
89
- };
90
-
91
- type ConditionalBlockWithCondition = Blocks & {
92
- condition?: string;
93
- };
94
-
95
- type Parallel = {
96
- static?: {
97
- paths: Record<string, Blocks>;
98
- };
99
- dynamic?: {
100
- blocks: Block[];
101
- variables?: Variables;
102
- paths?: string;
103
- };
104
- poolSize?: number;
105
- wait?: WAIT_TYPE;
106
- };
107
-
108
- type Stream = {
109
- trigger?: StreamTrigger;
110
- process?: Blocks;
111
- variables?: Variables;
112
- };
113
-
114
- type StreamTrigger = {
115
- name: string;
116
- step?: Step;
117
- };
118
-
119
- enum WAIT_TYPE {
120
- ALL = "WAIT_ALL",
121
- ANY = "WAIT_NONE",
122
- UNSPECIFIED = "WAIT_UNSPECIFIED",
123
- }
124
-
125
- type Variables = Record<string, string>;
126
-
127
- export type LanguageContent = {
128
- body: Body;
129
- };
130
-
131
- type Body = string | { path: string };