@superblocksteam/util 1.99.99-next.3 → 2.0.0-SNAPSHOT.5a741e4af7fbfccb
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -0
- package/{eslint.config.js → eslint.config.mjs} +26 -42
- package/lint-staged.config.mjs +6 -0
- package/package.json +22 -22
- package/src/api-files/api.mts +4 -2
- package/src/api-files/index.ts +7 -0
- package/src/api-files/types.ts +11 -14
- package/src/component-configs.ts +5 -3
- package/src/constants.ts +1 -15
- package/src/data-types.ts +1 -15
- package/src/file-uploader.test.ts +69 -0
- package/src/file-uploader.ts +26 -12
- package/src/index.ts +1 -0
- package/src/login.ts +24 -8
- package/src/mask-unix-signals.ts +1 -1
- package/src/resource-configs.ts +68 -5
- package/src/token-manager.ts +26 -0
- package/src/types.ts +5 -4
- package/src/validation.ts +4 -4
- package/tsconfig.json +3 -2
- package/turbo.json +9 -0
- package/vitest.config.ts +7 -0
- package/.prettierrc +0 -18
- package/dist/api-files/api.d.mts +0 -7
- package/dist/api-files/api.d.mts.map +0 -1
- package/dist/api-files/api.mjs +0 -262
- package/dist/api-files/api.mjs.map +0 -1
- package/dist/api-files/constants.d.ts +0 -6
- package/dist/api-files/constants.d.ts.map +0 -1
- package/dist/api-files/constants.js +0 -9
- package/dist/api-files/constants.js.map +0 -1
- package/dist/api-files/index.d.ts +0 -7
- package/dist/api-files/index.d.ts.map +0 -1
- package/dist/api-files/index.js +0 -13
- package/dist/api-files/index.js.map +0 -1
- package/dist/api-files/types.d.ts +0 -117
- package/dist/api-files/types.d.ts.map +0 -1
- package/dist/api-files/types.js +0 -17
- package/dist/api-files/types.js.map +0 -1
- package/dist/component-configs.d.ts +0 -6
- package/dist/component-configs.d.ts.map +0 -1
- package/dist/component-configs.js +0 -178
- package/dist/component-configs.js.map +0 -1
- package/dist/constants.d.ts +0 -18
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -50
- package/dist/constants.js.map +0 -1
- package/dist/data-types.d.ts +0 -10
- package/dist/data-types.d.ts.map +0 -1
- package/dist/data-types.js +0 -32
- package/dist/data-types.js.map +0 -1
- package/dist/events.d.ts +0 -13
- package/dist/events.d.ts.map +0 -1
- package/dist/events.js +0 -17
- package/dist/events.js.map +0 -1
- package/dist/file-uploader.d.ts +0 -3
- package/dist/file-uploader.d.ts.map +0 -1
- package/dist/file-uploader.js +0 -28
- package/dist/file-uploader.js.map +0 -1
- package/dist/generate-component-types.d.ts +0 -3
- package/dist/generate-component-types.d.ts.map +0 -1
- package/dist/generate-component-types.js +0 -45
- package/dist/generate-component-types.js.map +0 -1
- package/dist/identifiers.d.ts +0 -9
- package/dist/identifiers.d.ts.map +0 -1
- package/dist/identifiers.js +0 -68
- package/dist/identifiers.js.map +0 -1
- package/dist/index.d.ts +0 -16
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/localGitRepoState.d.ts +0 -20
- package/dist/localGitRepoState.d.ts.map +0 -1
- package/dist/localGitRepoState.js +0 -3
- package/dist/localGitRepoState.js.map +0 -1
- package/dist/login.d.ts +0 -11
- package/dist/login.d.ts.map +0 -1
- package/dist/login.js +0 -93
- package/dist/login.js.map +0 -1
- package/dist/mask-unix-signals.d.ts +0 -27
- package/dist/mask-unix-signals.d.ts.map +0 -1
- package/dist/mask-unix-signals.js +0 -81
- package/dist/mask-unix-signals.js.map +0 -1
- package/dist/resource-configs.d.ts +0 -61
- package/dist/resource-configs.d.ts.map +0 -1
- package/dist/resource-configs.js +0 -217
- package/dist/resource-configs.js.map +0 -1
- package/dist/types.d.ts +0 -105
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
- package/dist/unreachable.d.ts +0 -2
- package/dist/unreachable.d.ts.map +0 -1
- package/dist/unreachable.js +0 -7
- package/dist/unreachable.js.map +0 -1
- package/dist/validation.d.ts +0 -5
- package/dist/validation.d.ts.map +0 -1
- package/dist/validation.js +0 -152
- package/dist/validation.js.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
- package/tsup.config.ts +0 -8
package/src/resource-configs.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import * as fs from "fs-extra";
|
|
3
|
-
import { RESOURCE_CONFIG_PATH } from "./constants.js";
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
import fs from "fs-extra";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
DEV_ENVIRONMENT_CONFIG_PATH,
|
|
7
|
+
RESOURCE_CONFIG_PATH,
|
|
8
|
+
} from "./constants.js";
|
|
9
|
+
|
|
10
|
+
type SuperblocksMetadata = {
|
|
6
11
|
cliVersion: string;
|
|
7
12
|
};
|
|
8
13
|
|
|
@@ -52,7 +57,7 @@ export type PageInfo = {
|
|
|
52
57
|
pageApis?: Record<string, ApiInfo>; // used for 0.2.0+ format
|
|
53
58
|
};
|
|
54
59
|
|
|
55
|
-
|
|
60
|
+
type SourceFilesContanier = {
|
|
56
61
|
sourceFiles?: string[];
|
|
57
62
|
};
|
|
58
63
|
|
|
@@ -76,6 +81,64 @@ export type SuperblocksConfig =
|
|
|
76
81
|
| SuperblocksApplicationV2Config
|
|
77
82
|
| SuperblocksBackendConfig;
|
|
78
83
|
|
|
84
|
+
type DevEnvironmentConfigType = "DEV_ENVIRONMENT";
|
|
85
|
+
|
|
86
|
+
export type SuperblocksDevEnvironmentConfig = {
|
|
87
|
+
configType: DevEnvironmentConfigType;
|
|
88
|
+
branch?: string;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get the Superblocks dev environment config file from the current directory (and optionally) hierarchy
|
|
93
|
+
* @param checkParentDir Whether to recursively check the parent directory for a Superblocks dev environment config file
|
|
94
|
+
* @param pathPrefix The path prefix to use for the search
|
|
95
|
+
* @returns The Superblocks dev environment config and the path to the config file
|
|
96
|
+
*/
|
|
97
|
+
export async function getSuperblocksDevEnvironmentConfigJson(
|
|
98
|
+
checkParentDir = false,
|
|
99
|
+
pathPrefix = "",
|
|
100
|
+
): Promise<[SuperblocksDevEnvironmentConfig, string]> {
|
|
101
|
+
const absolutePath = path.resolve(pathPrefix);
|
|
102
|
+
|
|
103
|
+
let hasReachedFilesystemRoot = false;
|
|
104
|
+
try {
|
|
105
|
+
hasReachedFilesystemRoot = path.parse(absolutePath).root == absolutePath;
|
|
106
|
+
} catch {
|
|
107
|
+
throw new Error("Could not parse path " + absolutePath);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (
|
|
111
|
+
(pathPrefix && !fs.existsSync(absolutePath)) ||
|
|
112
|
+
hasReachedFilesystemRoot
|
|
113
|
+
) {
|
|
114
|
+
throw new Error(
|
|
115
|
+
"No Superblocks config file found in current directory hierarchy " +
|
|
116
|
+
pathPrefix,
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const attemptedPath = path.join(absolutePath, DEV_ENVIRONMENT_CONFIG_PATH);
|
|
121
|
+
try {
|
|
122
|
+
const devEnvironmentConfig = await fs.readJSON(attemptedPath);
|
|
123
|
+
if (devEnvironmentConfig.configType !== "DEV_ENVIRONMENT") {
|
|
124
|
+
throw new Error("Not the dev environment Superblocks config file");
|
|
125
|
+
}
|
|
126
|
+
return [
|
|
127
|
+
devEnvironmentConfig as SuperblocksDevEnvironmentConfig,
|
|
128
|
+
attemptedPath,
|
|
129
|
+
];
|
|
130
|
+
} catch {
|
|
131
|
+
if (!checkParentDir) {
|
|
132
|
+
// no superblocks config file found
|
|
133
|
+
throw new Error(
|
|
134
|
+
"No Superblocks config file found in current directory " +
|
|
135
|
+
attemptedPath,
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
return getSuperblocksDevEnvironmentConfigJson(true, "../" + pathPrefix);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
79
142
|
/**
|
|
80
143
|
* Get the Superblocks config file from the current directory (and optionally) hierarchy
|
|
81
144
|
* @param checkParentDir Whether to recursively check the parent directory for a Superblocks config file
|
|
@@ -213,7 +276,7 @@ export async function getSuperblocksBackendConfigIfExists(
|
|
|
213
276
|
return superblocksConfig as SuperblocksBackendConfig;
|
|
214
277
|
}
|
|
215
278
|
|
|
216
|
-
|
|
279
|
+
async function getSuperblocksBackendConfigJson(): Promise<SuperblocksBackendConfig> {
|
|
217
280
|
let superblocksConfig;
|
|
218
281
|
try {
|
|
219
282
|
superblocksConfig = await fs.readJSON(RESOURCE_CONFIG_PATH);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { EventEmitter } from "node:events";
|
|
2
|
+
|
|
3
|
+
export interface TokenUpdateEvent {
|
|
4
|
+
token: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface ITokenManager extends EventEmitter {
|
|
8
|
+
updateToken(newToken: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the most recently set token, or `undefined` if `updateToken`
|
|
11
|
+
* has never been called. Consumers that need to seed themselves at
|
|
12
|
+
* construction time read this synchronously rather than waiting on the
|
|
13
|
+
* next `tokenUpdated` event — the event stream stays as the refresh
|
|
14
|
+
* channel and is not replayed for late subscribers.
|
|
15
|
+
*
|
|
16
|
+
* Closes the cold-start gap where a listener attached after a prior
|
|
17
|
+
* emission would observe nothing (Node `EventEmitter` has no replay).
|
|
18
|
+
*/
|
|
19
|
+
getCurrentToken(): string | undefined;
|
|
20
|
+
on(event: "tokenUpdated", listener: (event: TokenUpdateEvent) => void): this;
|
|
21
|
+
once(
|
|
22
|
+
event: "tokenUpdated",
|
|
23
|
+
listener: (event: TokenUpdateEvent) => void,
|
|
24
|
+
): this;
|
|
25
|
+
off(event: "tokenUpdated", listener: (event: TokenUpdateEvent) => void): this;
|
|
26
|
+
}
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { DataType } from "./data-types.js";
|
|
2
1
|
import type { UUID } from "node:crypto";
|
|
3
2
|
|
|
3
|
+
import type { DataType } from "./data-types.js";
|
|
4
|
+
|
|
4
5
|
interface PropertiesPanelDisplay<T extends DataType> {
|
|
5
6
|
/**
|
|
6
7
|
* Determines what form item type is shown in the Superblocks properties panel.
|
|
@@ -54,7 +55,7 @@ interface PropertiesPanelDisplay<T extends DataType> {
|
|
|
54
55
|
defaultOnAdd?: T;
|
|
55
56
|
}
|
|
56
57
|
|
|
57
|
-
|
|
58
|
+
interface PropertyForData<T extends DataType> {
|
|
58
59
|
path: string;
|
|
59
60
|
dataType: T;
|
|
60
61
|
|
|
@@ -73,8 +74,8 @@ export interface PropertyForData<T extends DataType> {
|
|
|
73
74
|
/**
|
|
74
75
|
* By default, all your properties are readable from anywhere in Superblocks using dot notation
|
|
75
76
|
* (e.g. `myComponent.myProperty`). If you want to hide a property from the outside world,
|
|
76
|
-
* set this to
|
|
77
|
-
* @default
|
|
77
|
+
* set this to true
|
|
78
|
+
* @default false
|
|
78
79
|
*/
|
|
79
80
|
isExternallyReadable?: boolean;
|
|
80
81
|
|
package/src/validation.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import Ajv from "ajv";
|
|
2
|
-
import betterAjvErrors from "better-ajv-errors";
|
|
3
|
-
import { isReservedPropertyName, isValidIdentifier } from "./identifiers.js";
|
|
4
2
|
import type { Schema } from "ajv";
|
|
5
3
|
import type { DataValidateFunction } from "ajv/dist/types";
|
|
4
|
+
import betterAjvErrors from "better-ajv-errors";
|
|
5
|
+
|
|
6
|
+
import { isReservedPropertyName, isValidIdentifier } from "./identifiers.js";
|
|
6
7
|
|
|
7
8
|
const ajv = new Ajv();
|
|
8
9
|
|
|
@@ -28,8 +29,7 @@ ajv.addKeyword({
|
|
|
28
29
|
validateFunc.errors = [
|
|
29
30
|
{
|
|
30
31
|
keyword: "format",
|
|
31
|
-
message:
|
|
32
|
-
"must not match a reserved property path (see https://docs.superblocks.com/applications/custom-components/faq#what-is-a-reserved-property)",
|
|
32
|
+
message: "must not match a reserved property path",
|
|
33
33
|
},
|
|
34
34
|
];
|
|
35
35
|
return false;
|
package/tsconfig.json
CHANGED
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
"rootDir": "src",
|
|
10
10
|
"strict": true,
|
|
11
11
|
"composite": true,
|
|
12
|
-
"target": "
|
|
13
|
-
"lib": ["
|
|
12
|
+
"target": "es2024",
|
|
13
|
+
"lib": ["es2024", "ESNext.Array", "ESNext.Collection", "ESNext.Promise"],
|
|
14
|
+
|
|
14
15
|
"sourceMap": true,
|
|
15
16
|
"declarationMap": true,
|
|
16
17
|
"esModuleInterop": true,
|
package/turbo.json
ADDED
package/vitest.config.ts
ADDED
package/.prettierrc
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"printWidth": 80,
|
|
3
|
-
"tabWidth": 2,
|
|
4
|
-
"useTabs": false,
|
|
5
|
-
"semi": true,
|
|
6
|
-
"singleQuote": false,
|
|
7
|
-
"trailingComma": "all",
|
|
8
|
-
"arrowParens": "always",
|
|
9
|
-
"plugins": ["prettier-plugin-pkg"],
|
|
10
|
-
"overrides": [
|
|
11
|
-
{
|
|
12
|
-
"files": ["*.ts", "*.tsx", "*.mts"],
|
|
13
|
-
"options": {
|
|
14
|
-
"parser": "typescript"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
]
|
|
18
|
-
}
|
package/dist/api-files/api.d.mts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { AdditionalStepFiles, Api, ApiRepresentation, ApiWrapper } from "./types.js";
|
|
2
|
-
export declare function writeApiFiles(api: ApiWrapper, apiNameSlug: string, directoryPath: string, nestedApiFiles: boolean, apiPromises: Array<Promise<void>>, additionalStepFiles: AdditionalStepFiles[], apiRepresentation?: ApiRepresentation, existingFilePaths?: Set<string>, stepPathMap?: Record<string, string>): Promise<void>;
|
|
3
|
-
export declare function readAppApiYamlFile(parentDirectory: string, apiName?: string): Promise<{
|
|
4
|
-
api: Api;
|
|
5
|
-
stepPathMap: Record<string, string>;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=api.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.mts","sourceRoot":"","sources":["../../src/api-files/api.mts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACV,mBAAmB,EACnB,GAAG,EACH,iBAAiB,EACjB,UAAU,EAIX,MAAM,YAAY,CAAC;AAoXpB,wBAAsB,aAAa,CACjC,GAAG,EAAE,UAAU,EACf,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,OAAO,EACvB,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,EACjC,mBAAmB,EAAE,mBAAmB,EAAE,EAC1C,iBAAiB,CAAC,EAAE,iBAAiB,EACrC,iBAAiB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAC/B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,iBAgErC;AAED,wBAAsB,kBAAkB,CACtC,eAAe,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC;IAAE,GAAG,EAAE,GAAG,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC,CAqC5D"}
|
package/dist/api-files/api.mjs
DELETED
|
@@ -1,262 +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
|
-
import { DEFAULT_LINES_FOR_LARGE_STEPS, LANGUAGE_STEP_EXTENSIONS, } from "./constants.js";
|
|
6
|
-
function slugifyName(originalName) {
|
|
7
|
-
return slugify(originalName, {
|
|
8
|
-
replacement: "_",
|
|
9
|
-
lower: true,
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
function findUnusedFilePath(filename, extension, existingFilePaths) {
|
|
13
|
-
let proposedFilename = `${filename}.${extension}`;
|
|
14
|
-
let i = 1;
|
|
15
|
-
while (existingFilePaths.has(proposedFilename)) {
|
|
16
|
-
proposedFilename = `${filename}_${i}.${extension}`;
|
|
17
|
-
i++;
|
|
18
|
-
}
|
|
19
|
-
existingFilePaths.add(proposedFilename);
|
|
20
|
-
return proposedFilename;
|
|
21
|
-
}
|
|
22
|
-
function extractAdditionalStepFiles(api, additionalStepFiles, stepPathMap, currentStepNames, apiRepresentation) {
|
|
23
|
-
if (!api.blocks || !apiRepresentation?.extractLargeSourceFiles) {
|
|
24
|
-
return api;
|
|
25
|
-
}
|
|
26
|
-
// TODO: lodash
|
|
27
|
-
const apiClone = cloneDeep(api);
|
|
28
|
-
const minLinesForExtraction = apiRepresentation?.minLinesForExtraction ?? DEFAULT_LINES_FOR_LARGE_STEPS;
|
|
29
|
-
const existingFilePaths = new Set();
|
|
30
|
-
extractAdditionalStepFilesFromBlocks(apiClone.blocks ?? [], additionalStepFiles, existingFilePaths, minLinesForExtraction, stepPathMap, currentStepNames);
|
|
31
|
-
return apiClone;
|
|
32
|
-
}
|
|
33
|
-
function extractAdditionalStepFilesFromStep(step, name, additionalStepFiles, existingFilePaths, minLinesForExtraction, stepPathMap, currentStepNames) {
|
|
34
|
-
// Handle language step files
|
|
35
|
-
if (step && "integration" in step) {
|
|
36
|
-
const integration = step.integration;
|
|
37
|
-
const extension = LANGUAGE_STEP_EXTENSIONS[integration];
|
|
38
|
-
if (extension) {
|
|
39
|
-
const languageContent = step[integration];
|
|
40
|
-
if (languageContent) {
|
|
41
|
-
const blockBody = languageContent.body;
|
|
42
|
-
if (blockBody && typeof blockBody === "string") {
|
|
43
|
-
const lines = blockBody?.split("\n");
|
|
44
|
-
const linesNum = lines?.length;
|
|
45
|
-
if (linesNum && linesNum > minLinesForExtraction) {
|
|
46
|
-
// Record the separate file is needed, with the language contents
|
|
47
|
-
let relativePath;
|
|
48
|
-
if (stepPathMap?.[name]) {
|
|
49
|
-
relativePath = stepPathMap[name].startsWith("./")
|
|
50
|
-
? stepPathMap[name].split("./")?.[1]
|
|
51
|
-
: stepPathMap[name];
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
relativePath = findUnusedFilePath(slugifyName(name), extension, existingFilePaths);
|
|
55
|
-
stepPathMap[name] = `./${relativePath}`;
|
|
56
|
-
}
|
|
57
|
-
additionalStepFiles.push({
|
|
58
|
-
relativePath: relativePath,
|
|
59
|
-
contents: blockBody,
|
|
60
|
-
language: integration,
|
|
61
|
-
});
|
|
62
|
-
currentStepNames.push(name);
|
|
63
|
-
// Replace the body with a reference to the separate file
|
|
64
|
-
languageContent.body = {
|
|
65
|
-
path: `./${relativePath}`,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function extractAdditionalStepFilesFromBlocks(blocks, additionalStepFiles, existingFilePaths, minLinesForExtraction, stepPathMap, currentStepNames) {
|
|
74
|
-
for (const block of blocks) {
|
|
75
|
-
// Handle language step files
|
|
76
|
-
if (block.step) {
|
|
77
|
-
extractAdditionalStepFilesFromStep(block.step, block.name, additionalStepFiles, existingFilePaths, minLinesForExtraction, stepPathMap, currentStepNames);
|
|
78
|
-
}
|
|
79
|
-
// Handle loops
|
|
80
|
-
extractAdditionalStepFilesFromBlocks(block.loop?.blocks ?? [], additionalStepFiles, existingFilePaths, minLinesForExtraction, stepPathMap, currentStepNames);
|
|
81
|
-
// Handle try/catch
|
|
82
|
-
if (block.tryCatch) {
|
|
83
|
-
extractAdditionalStepFilesFromBlocks(block.tryCatch.try?.blocks ?? [], additionalStepFiles, existingFilePaths, minLinesForExtraction, stepPathMap, currentStepNames);
|
|
84
|
-
extractAdditionalStepFilesFromBlocks(block.tryCatch.catch?.blocks ?? [], additionalStepFiles, existingFilePaths, minLinesForExtraction, stepPathMap, currentStepNames);
|
|
85
|
-
extractAdditionalStepFilesFromBlocks(block.tryCatch.finally?.blocks ?? [], additionalStepFiles, existingFilePaths, minLinesForExtraction, stepPathMap, currentStepNames);
|
|
86
|
-
}
|
|
87
|
-
// Handle conditional
|
|
88
|
-
if (block.conditional) {
|
|
89
|
-
extractAdditionalStepFilesFromBlocks(block.conditional.if?.blocks ?? [], additionalStepFiles, existingFilePaths, minLinesForExtraction, stepPathMap, currentStepNames);
|
|
90
|
-
for (const elseIfBlock of block.conditional.elseIf ?? []) {
|
|
91
|
-
extractAdditionalStepFilesFromBlocks(elseIfBlock.blocks, additionalStepFiles, existingFilePaths, minLinesForExtraction, stepPathMap, currentStepNames);
|
|
92
|
-
}
|
|
93
|
-
extractAdditionalStepFilesFromBlocks(block.conditional.else?.blocks ?? [], additionalStepFiles, existingFilePaths, minLinesForExtraction, stepPathMap, currentStepNames);
|
|
94
|
-
}
|
|
95
|
-
// Handle Parallel API
|
|
96
|
-
if (block.parallel) {
|
|
97
|
-
for (const path of Object.values(block.parallel?.static?.paths ?? {})) {
|
|
98
|
-
extractAdditionalStepFilesFromBlocks(path.blocks, additionalStepFiles, existingFilePaths, minLinesForExtraction, stepPathMap, currentStepNames);
|
|
99
|
-
}
|
|
100
|
-
extractAdditionalStepFilesFromBlocks(block.parallel?.dynamic?.blocks ?? [], additionalStepFiles, existingFilePaths, minLinesForExtraction, stepPathMap, currentStepNames);
|
|
101
|
-
}
|
|
102
|
-
// Handle stream
|
|
103
|
-
if (block.stream) {
|
|
104
|
-
const trigger = block.stream.trigger;
|
|
105
|
-
if (trigger && trigger.step) {
|
|
106
|
-
extractAdditionalStepFilesFromStep(trigger.step, trigger.name, additionalStepFiles, existingFilePaths, minLinesForExtraction, stepPathMap, currentStepNames);
|
|
107
|
-
}
|
|
108
|
-
extractAdditionalStepFilesFromBlocks(block.stream.process?.blocks ?? [], additionalStepFiles, existingFilePaths, minLinesForExtraction, stepPathMap, currentStepNames);
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
async function readYamlFile(path) {
|
|
113
|
-
return parse(await fs.readFile(path, "utf8"));
|
|
114
|
-
}
|
|
115
|
-
async function resolveLanguageSpecificStepContentFromBlocks(parentPath, blocks, stepPathMap) {
|
|
116
|
-
for (const block of blocks) {
|
|
117
|
-
// Handle language-specific step content
|
|
118
|
-
if (block.step) {
|
|
119
|
-
const step = block.step;
|
|
120
|
-
await resolveLanguageSpecificStepContentFromStep(parentPath, step, block.name, stepPathMap);
|
|
121
|
-
}
|
|
122
|
-
// Handle conditional blocks
|
|
123
|
-
if (block.conditional) {
|
|
124
|
-
await resolveLanguageSpecificStepContentFromBlocks(parentPath, block.conditional.if?.blocks ?? [], stepPathMap);
|
|
125
|
-
for (const elseIfBlock of block.conditional.elseIf) {
|
|
126
|
-
await resolveLanguageSpecificStepContentFromBlocks(parentPath, elseIfBlock.blocks, stepPathMap);
|
|
127
|
-
}
|
|
128
|
-
await resolveLanguageSpecificStepContentFromBlocks(parentPath, block.conditional.else?.blocks ?? [], stepPathMap);
|
|
129
|
-
}
|
|
130
|
-
// Handle loop blocks
|
|
131
|
-
await resolveLanguageSpecificStepContentFromBlocks(parentPath, block.loop?.blocks ?? [], stepPathMap);
|
|
132
|
-
// Handle try-catch blocks
|
|
133
|
-
if (block.tryCatch) {
|
|
134
|
-
await resolveLanguageSpecificStepContentFromBlocks(parentPath, block.tryCatch.try?.blocks ?? [], stepPathMap);
|
|
135
|
-
await resolveLanguageSpecificStepContentFromBlocks(parentPath, block.tryCatch.catch?.blocks ?? [], stepPathMap);
|
|
136
|
-
await resolveLanguageSpecificStepContentFromBlocks(parentPath, block.tryCatch.finally?.blocks ?? [], stepPathMap);
|
|
137
|
-
}
|
|
138
|
-
// Handle parallel blocks
|
|
139
|
-
if (block.parallel) {
|
|
140
|
-
for (const path of Object.values(block.parallel?.static?.paths ?? {})) {
|
|
141
|
-
await resolveLanguageSpecificStepContentFromBlocks(parentPath, path.blocks, stepPathMap);
|
|
142
|
-
}
|
|
143
|
-
await resolveLanguageSpecificStepContentFromBlocks(parentPath, block.parallel?.dynamic?.blocks ?? [], stepPathMap);
|
|
144
|
-
}
|
|
145
|
-
// Handle stream blocks
|
|
146
|
-
if (block.stream) {
|
|
147
|
-
await resolveLanguageSpecificStepContentFromBlocks(parentPath, block.stream.process?.blocks ?? [], stepPathMap);
|
|
148
|
-
await resolveLanguageSpecificStepContentFromStep(parentPath, block.stream.trigger?.step ?? {}, block.stream.trigger?.name, stepPathMap);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
async function resolveLanguageSpecificStepContentFromStep(parentPath, step, stepName, stepPathMap) {
|
|
153
|
-
// Handle language-specific step content
|
|
154
|
-
if (!step?.integration ||
|
|
155
|
-
!LANGUAGE_STEP_EXTENSIONS[step.integration]) {
|
|
156
|
-
return;
|
|
157
|
-
}
|
|
158
|
-
const languageContent = step[step.integration];
|
|
159
|
-
if (languageContent.body &&
|
|
160
|
-
typeof languageContent.body === "object" &&
|
|
161
|
-
"path" in languageContent.body) {
|
|
162
|
-
const languageFilePath = `${parentPath}/${languageContent.body.path}`;
|
|
163
|
-
if (await fs.pathExists(languageFilePath)) {
|
|
164
|
-
// Read the file content
|
|
165
|
-
const stepBodyContent = await fs.readFile(languageFilePath, "utf8");
|
|
166
|
-
if (stepBodyContent && languageContent) {
|
|
167
|
-
if (stepPathMap && stepName) {
|
|
168
|
-
stepPathMap[stepName] = languageContent.body.path;
|
|
169
|
-
}
|
|
170
|
-
languageContent.body = stepBodyContent;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
export async function writeApiFiles(api, apiNameSlug, directoryPath, nestedApiFiles, apiPromises, additionalStepFiles, apiRepresentation, existingFilePaths, stepPathMap) {
|
|
176
|
-
let pathForApiFile = directoryPath;
|
|
177
|
-
let yamlFileName = `${apiNameSlug}.yaml`;
|
|
178
|
-
const currentStepNames = [];
|
|
179
|
-
// Determine whether to extract into separate files the source code from the steps
|
|
180
|
-
const updatedApi = extractAdditionalStepFiles(api.apiPb, additionalStepFiles, stepPathMap ?? {}, currentStepNames, apiRepresentation);
|
|
181
|
-
// Stop tracking unused step paths from removed steps (e.g. when a step is renamed or removed)
|
|
182
|
-
if (stepPathMap) {
|
|
183
|
-
Object.keys(stepPathMap).forEach((stepName) => {
|
|
184
|
-
if (!currentStepNames.includes(stepName)) {
|
|
185
|
-
const stepFileName = stepPathMap[stepName].startsWith("./")
|
|
186
|
-
? stepPathMap[stepName].split("./")[1]
|
|
187
|
-
: stepPathMap[stepName];
|
|
188
|
-
fs.remove(`${pathForApiFile}/${stepFileName}`);
|
|
189
|
-
delete stepPathMap[stepName];
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
if (apiRepresentation?.extractLargeSourceFiles) {
|
|
194
|
-
if (nestedApiFiles) {
|
|
195
|
-
// This API has at least one large step code file, so we need a nested directory
|
|
196
|
-
pathForApiFile = `${pathForApiFile}/${apiNameSlug}`;
|
|
197
|
-
yamlFileName = "api.yaml";
|
|
198
|
-
}
|
|
199
|
-
// Make sure the directory exists
|
|
200
|
-
await fs.ensureDir(pathForApiFile);
|
|
201
|
-
// Write any additional step source code files to the disk
|
|
202
|
-
for (const stepFile of additionalStepFiles) {
|
|
203
|
-
const sourceFilePath = `${pathForApiFile}/${stepFile.relativePath}`;
|
|
204
|
-
const handleApi = async () => {
|
|
205
|
-
await fs.outputFile(sourceFilePath, stepFile.contents);
|
|
206
|
-
};
|
|
207
|
-
apiPromises.push(handleApi());
|
|
208
|
-
// Mark the existing source file as being reused
|
|
209
|
-
existingFilePaths?.delete(sourceFilePath);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
// No additional step files to write, so mark the API directory as existing so that it will be removed later.
|
|
214
|
-
// Do this even if the current representation does not extract large source files, in case they were previously
|
|
215
|
-
existingFilePaths?.add(`${directoryPath}/${apiNameSlug}`);
|
|
216
|
-
}
|
|
217
|
-
// Convert the updated API to YAML and write it to disk
|
|
218
|
-
const apiContent = ymlstringify(updatedApi, {
|
|
219
|
-
sortMapEntries: true,
|
|
220
|
-
blockQuote: "literal",
|
|
221
|
-
});
|
|
222
|
-
const yamlFilePath = `${pathForApiFile}/${yamlFileName}`;
|
|
223
|
-
const handleApi = async () => {
|
|
224
|
-
await fs.outputFile(yamlFilePath, apiContent);
|
|
225
|
-
};
|
|
226
|
-
apiPromises.push(handleApi());
|
|
227
|
-
// Mark the existing source file as being reused
|
|
228
|
-
existingFilePaths?.delete(yamlFilePath);
|
|
229
|
-
}
|
|
230
|
-
export async function readAppApiYamlFile(parentDirectory, apiName) {
|
|
231
|
-
// The API is either stored in its entirety in a single YAML file, or
|
|
232
|
-
// or in a subdirectory containing the YAML file and zero or more language-specific files.
|
|
233
|
-
const apiNameSlug = slugifyName(apiName ?? "api");
|
|
234
|
-
const singularApiYamlPath = `${parentDirectory}/${apiNameSlug}.yaml`;
|
|
235
|
-
const apiDirPath = `${parentDirectory}/${apiNameSlug}`;
|
|
236
|
-
const nestedApiYamlPath = `${apiDirPath}/api.yaml`;
|
|
237
|
-
// Read the YAML file
|
|
238
|
-
let yamlPath;
|
|
239
|
-
let yamlParentPath;
|
|
240
|
-
if (await fs.pathExists(singularApiYamlPath)) {
|
|
241
|
-
// The API YAML file is in the parent directory
|
|
242
|
-
yamlPath = singularApiYamlPath;
|
|
243
|
-
yamlParentPath = parentDirectory;
|
|
244
|
-
}
|
|
245
|
-
else if (await fs.pathExists(nestedApiYamlPath)) {
|
|
246
|
-
// The API YAML file is nested in an API-specific directory
|
|
247
|
-
yamlPath = nestedApiYamlPath;
|
|
248
|
-
yamlParentPath = apiDirPath;
|
|
249
|
-
}
|
|
250
|
-
else {
|
|
251
|
-
throw new Error(`API ${apiName ?? ""} not found at ${parentDirectory}`);
|
|
252
|
-
}
|
|
253
|
-
// That is nested in an API-specific directory
|
|
254
|
-
const apiDefn = (await readYamlFile(yamlPath));
|
|
255
|
-
// Map step name -> step path
|
|
256
|
-
const stepPathMap = {};
|
|
257
|
-
// The API YAML file may or may not have language-specific content in separate files.
|
|
258
|
-
// Replace any file references with the actual content
|
|
259
|
-
await resolveLanguageSpecificStepContentFromBlocks(yamlParentPath, apiDefn.blocks ?? [], stepPathMap);
|
|
260
|
-
return { api: apiDefn, stepPathMap };
|
|
261
|
-
}
|
|
262
|
-
//# sourceMappingURL=api.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.mjs","sourceRoot":"","sources":["../../src/api-files/api.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,SAAS,IAAI,YAAY,EAAE,MAAM,MAAM,CAAC;AACxD,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AAWxB,SAAS,WAAW,CAAC,YAAiB;IACpC,OAAQ,OAAe,CAAC,YAAY,EAAE;QACpC,WAAW,EAAE,GAAG;QAChB,KAAK,EAAE,IAAI;KACZ,CAAC,CAAC;AACL,CAAC;AAED,SAAS,kBAAkB,CACzB,QAAgB,EAChB,SAAiB,EACjB,iBAA8B;IAE9B,IAAI,gBAAgB,GAAG,GAAG,QAAQ,IAAI,SAAS,EAAE,CAAC;IAClD,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,iBAAiB,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC/C,gBAAgB,GAAG,GAAG,QAAQ,IAAI,CAAC,IAAI,SAAS,EAAE,CAAC;QACnD,CAAC,EAAE,CAAC;IACN,CAAC;IACD,iBAAiB,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IACxC,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,SAAS,0B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AAY,CAAC,QAAQ,CAAC,CAAQ,CAAC;IAEtD,6BAA6B;IAC7B,MAAM,WAAW,GAA2B,EAAE,CAAC;IAE/C,qFAAqF;IACrF,sDAAsD;IACtD,MAAM,4CAA4C,CAChD,cAAc,EACd,OAAO,CAAC,MAAM,IAAI,EAAE,EACpB,WAAW,CACZ,CAAC;IACF,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/api-files/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB;;;CAG3B,CAAC;AAEX,eAAO,MAAM,6BAA6B,IAAI,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_LINES_FOR_LARGE_STEPS = exports.LANGUAGE_STEP_EXTENSIONS = void 0;
|
|
4
|
-
exports.LANGUAGE_STEP_EXTENSIONS = {
|
|
5
|
-
javascript: "js",
|
|
6
|
-
python: "py",
|
|
7
|
-
};
|
|
8
|
-
exports.DEFAULT_LINES_FOR_LARGE_STEPS = 1;
|
|
9
|
-
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/api-files/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,wBAAwB,GAAG;IACtC,UAAU,EAAE,IAAI;IAChB,MAAM,EAAE,IAAI;CACJ,CAAC;AAEE,QAAA,6BAA6B,GAAG,CAAC,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type * as Api from "./api.mjs" with { "resolution-mode": "import" };
|
|
2
|
-
export declare function writeApiFiles(...args: Parameters<typeof Api.writeApiFiles>): Promise<void>;
|
|
3
|
-
export declare function readAppApiYamlFile(...args: Parameters<typeof Api.readAppApiYamlFile>): Promise<{
|
|
4
|
-
api: import("./types").Api;
|
|
5
|
-
stepPathMap: Record<string, string>;
|
|
6
|
-
}>;
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api-files/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,GAAG,MAAM,WAAW,CAAC,OAAO,iBAAiB,EAAE,QAAQ,EAAE,CAAC;AAE3E,wBAAsB,aAAa,CACjC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,GAAG,CAAC,aAAa,CAAC,iBAI9C;AAED,wBAAsB,kBAAkB,CACtC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,GAAG,CAAC,kBAAkB,CAAC;;;GAInD"}
|
package/dist/api-files/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.writeApiFiles = writeApiFiles;
|
|
4
|
-
exports.readAppApiYamlFile = readAppApiYamlFile;
|
|
5
|
-
async function writeApiFiles(...args) {
|
|
6
|
-
const esmFunction = await import("./api.mjs");
|
|
7
|
-
return esmFunction.writeApiFiles(...args);
|
|
8
|
-
}
|
|
9
|
-
async function readAppApiYamlFile(...args) {
|
|
10
|
-
const esmFunction = await import("./api.mjs");
|
|
11
|
-
return esmFunction.readAppApiYamlFile(...args);
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api-files/index.ts"],"names":[],"mappings":";;AAEA,sCAKC;AAED,gDAKC;AAZM,KAAK,UAAU,aAAa,CACjC,GAAG,IAA0C;IAE7C,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;IAC9C,OAAO,WAAW,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,CAAC;AAC5C,CAAC;AAEM,KAAK,UAAU,kBAAkB,CACtC,GAAG,IAA+C;IAElD,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;IAC9C,OAAO,WAAW,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC,CAAC;AACjD,CAAC"}
|