@superblocksteam/util 1.14.1 → 2.0.3-next.46
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/.prettierrc +1 -0
- package/dist/api-files/api.d.mts +7 -0
- package/dist/api-files/api.d.mts.map +1 -0
- package/dist/api-files/api.mjs +262 -0
- package/dist/api-files/api.mjs.map +1 -0
- package/dist/api-files/constants.d.ts +6 -0
- package/dist/api-files/constants.d.ts.map +1 -0
- package/dist/api-files/constants.js +9 -0
- package/dist/api-files/constants.js.map +1 -0
- package/dist/api-files/index.d.ts +7 -0
- package/dist/api-files/index.d.ts.map +1 -0
- package/dist/api-files/index.js +13 -0
- package/dist/api-files/index.js.map +1 -0
- package/dist/api-files/types.d.ts +117 -0
- package/dist/api-files/types.d.ts.map +1 -0
- package/dist/api-files/types.js +17 -0
- package/dist/api-files/types.js.map +1 -0
- package/dist/component-configs.d.ts +1 -0
- package/dist/component-configs.d.ts.map +1 -0
- package/dist/component-configs.js +10 -9
- package/dist/component-configs.js.map +1 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +1 -0
- package/dist/constants.js.map +1 -0
- package/dist/data-types.d.ts +1 -0
- package/dist/data-types.d.ts.map +1 -0
- package/dist/data-types.js +1 -0
- package/dist/data-types.js.map +1 -0
- package/dist/events.d.ts +1 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +1 -0
- package/dist/events.js.map +1 -0
- package/dist/file-uploader.d.ts +1 -0
- package/dist/file-uploader.d.ts.map +1 -0
- package/dist/file-uploader.js +1 -0
- package/dist/file-uploader.js.map +1 -0
- package/dist/generate-component-types.d.ts +2 -1
- package/dist/generate-component-types.d.ts.map +1 -0
- package/dist/generate-component-types.js +5 -5
- package/dist/generate-component-types.js.map +1 -0
- package/dist/identifiers.d.ts +1 -0
- package/dist/identifiers.d.ts.map +1 -0
- package/dist/identifiers.js +2 -1
- package/dist/identifiers.js.map +1 -0
- package/dist/index.d.ts +16 -11
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -11
- package/dist/index.js.map +1 -0
- package/dist/localGitRepoState.d.ts +2 -1
- package/dist/localGitRepoState.d.ts.map +1 -0
- package/dist/localGitRepoState.js +1 -0
- package/dist/localGitRepoState.js.map +1 -0
- package/dist/login.d.ts +1 -0
- package/dist/login.d.ts.map +1 -0
- package/dist/login.js +6 -5
- package/dist/login.js.map +1 -0
- package/dist/mask-unix-signals.d.ts +27 -0
- package/dist/mask-unix-signals.d.ts.map +1 -0
- package/dist/mask-unix-signals.js +81 -0
- package/dist/mask-unix-signals.js.map +1 -0
- package/dist/resource-configs.d.ts +9 -1
- package/dist/resource-configs.d.ts.map +1 -0
- package/dist/resource-configs.js +66 -11
- package/dist/resource-configs.js.map +1 -0
- package/dist/types.d.ts +8 -7
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/dist/unreachable.d.ts +2 -1
- package/dist/unreachable.d.ts.map +1 -0
- package/dist/unreachable.js +3 -2
- package/dist/unreachable.js.map +1 -0
- package/dist/validation.d.ts +1 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +4 -3
- package/dist/validation.js.map +1 -0
- package/eslint.config.js +11 -1
- package/package.json +18 -11
- package/src/api-files/api.mts +504 -0
- package/src/api-files/constants.ts +6 -0
- package/src/api-files/index.ts +15 -0
- package/src/api-files/types.ts +134 -0
- package/src/component-configs.ts +3 -3
- package/src/generate-component-types.ts +2 -2
- package/src/index.ts +15 -11
- package/src/localGitRepoState.ts +1 -1
- package/src/login.ts +1 -1
- package/src/mask-unix-signals.ts +86 -0
- package/src/resource-configs.ts +81 -1
- package/src/types.ts +8 -11
- package/src/unreachable.ts +4 -2
- package/src/validation.ts +4 -3
- package/tsconfig.json +9 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB"}
|
package/dist/events.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAWX;AAXD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,+BAAa,CAAA;IACb,iCAAe,CAAA;IACf,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,uCAAqB,CAAA;IACrB,mCAAiB,CAAA;IACjB,mCAAiB,CAAA;AACnB,CAAC,EAXW,cAAc,8BAAd,cAAc,QAWzB"}
|
package/dist/file-uploader.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-uploader.d.ts","sourceRoot":"","sources":["../src/file-uploader.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,sBAAsB,kCAAkC,CAAC;AAGtE,eAAO,MAAM,iCAAiC,GAC5C,oBAAoB,MAAM,KACzB,MAoBF,CAAC"}
|
package/dist/file-uploader.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-uploader.js","sourceRoot":"","sources":["../src/file-uploader.ts"],"names":[],"mappings":";;;AAAA,mCAAiC;AAEpB,QAAA,sBAAsB,GAAG,+BAA+B,CAAC;AAEtE,qEAAqE;AAC9D,MAAM,iCAAiC,GAAG,CAC/C,kBAA0B,EAClB,EAAE;IACV,+DAA+D;IAC/D,IAAI,CAAC,IAAA,gBAAO,EAAC,kBAAkB,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,CAAC;QAC5E,OAAO,uCAAuC,CAAC;IACjD,CAAC;IAED,QAAQ,kBAAkB,EAAE,CAAC;QAC3B,KAAK,4BAA4B;YAC/B,OAAO,sCAAsC,CAAC;QAChD,KAAK,iCAAiC;YACpC,OAAO,2CAA2C,CAAC;QACrD,KAAK,6BAA6B,CAAC;QACnC,KAAK,+BAA+B;YAClC,OAAO,mCAAmC,CAAC;QAC7C,KAAK,6BAA6B;YAChC,OAAO,uCAAuC,CAAC;QACjD,KAAK,uBAAuB,CAAC;QAC7B;YACE,OAAO,uBAAuB,CAAC;IACnC,CAAC;AACH,CAAC,CAAC;AAtBW,QAAA,iCAAiC,qCAsB5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-component-types.d.ts","sourceRoot":"","sources":["../src/generate-component-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAwBlD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,eAAe,UA2BjE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateComponentTypesFile = generateComponentTypesFile;
|
|
4
|
-
const
|
|
4
|
+
const data_types_js_1 = require("./data-types.js");
|
|
5
5
|
const indent = (str, spaces) => {
|
|
6
6
|
const spacesString = " ".repeat(spaces);
|
|
7
7
|
return str
|
|
@@ -10,16 +10,15 @@ const indent = (str, spaces) => {
|
|
|
10
10
|
.join("\n");
|
|
11
11
|
};
|
|
12
12
|
function renderInputTypeAsTS(name, type, trailingChars, indentSpaces) {
|
|
13
|
-
let { tsType } =
|
|
13
|
+
let { tsType } = data_types_js_1.dataTypeDefinions[type];
|
|
14
14
|
if (["number", "string"].includes(type)) {
|
|
15
15
|
tsType += " | null";
|
|
16
16
|
}
|
|
17
17
|
return indent(`${name}: ${tsType}${trailingChars}`, indentSpaces);
|
|
18
18
|
}
|
|
19
19
|
function generateComponentTypesFile(config) {
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
const eventHandlers = (_b = config.events) !== null && _b !== void 0 ? _b : [];
|
|
20
|
+
const properties = config.properties ?? [];
|
|
21
|
+
const eventHandlers = config.events ?? [];
|
|
23
22
|
return `// GENERATED CODE -- DO NOT EDIT!
|
|
24
23
|
//
|
|
25
24
|
// This file is automatically generated by the Superblocks CLI
|
|
@@ -43,3 +42,4 @@ ${eventHandlers.length === 0
|
|
|
43
42
|
.join("")}};
|
|
44
43
|
`;
|
|
45
44
|
}
|
|
45
|
+
//# sourceMappingURL=generate-component-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-component-types.js","sourceRoot":"","sources":["../src/generate-component-types.ts"],"names":[],"mappings":";;AAyBA,gEA2BC;AApDD,mDAAmE;AAGnE,MAAM,MAAM,GAAG,CAAC,GAAW,EAAE,MAAc,EAAE,EAAE;IAC7C,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAExC,OAAO,GAAG;SACP,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,YAAY,GAAG,IAAI,EAAE,CAAC;SACvC,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC,CAAC;AAEF,SAAS,mBAAmB,CAC1B,IAAY,EACZ,IAAc,EACd,aAAqB,EACrB,YAAoB;IAEpB,IAAI,EAAE,MAAM,EAAE,GAAG,iCAAiB,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,SAAS,CAAC;IACtB,CAAC;IACD,OAAO,MAAM,CAAC,GAAG,IAAI,KAAK,MAAM,GAAG,aAAa,EAAE,EAAE,YAAY,CAAC,CAAC;AACpE,CAAC;AAED,SAAgB,0BAA0B,CAAC,MAAuB;IAChE,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;IAC3C,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC;IAC1C,OAAO;;;;;;;;;EASP,UAAU;SACT,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;SAClE,IAAI,CAAC,EAAE,CAAC;;;;;EAMT,aAAa,CAAC,MAAM,KAAK,CAAC;QACxB,CAAC,CAAC,wCAAwC;QAC1C,CAAC,CAAC,aAAa;aACV,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,eAAe,GAAG,IAAI,CAAC;aAC3D,IAAI,CAAC,EAAE,CAChB;CACC,CAAC;AACF,CAAC"}
|
package/dist/identifiers.d.ts
CHANGED
|
@@ -6,3 +6,4 @@
|
|
|
6
6
|
export declare function suggestIdentifier(label: string, capitalizeFirst?: boolean): string;
|
|
7
7
|
export declare function isValidIdentifier(str: string): boolean;
|
|
8
8
|
export declare function isReservedPropertyName(str: string): boolean;
|
|
9
|
+
//# sourceMappingURL=identifiers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifiers.d.ts","sourceRoot":"","sources":["../src/identifiers.ts"],"names":[],"mappings":"AAgBA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,eAAe,UAAQ,UASvE;AAID,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,WAE5C;AA2BD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,WAMjD"}
|
package/dist/identifiers.js
CHANGED
|
@@ -14,7 +14,7 @@ function wordsToUpperCamelCase(str) {
|
|
|
14
14
|
const digits = "Zero One Two Three Four Five Six Seven Eight Nine".split(" ");
|
|
15
15
|
// convert digits to words, e.g. "123" -> "OneTwoThree"
|
|
16
16
|
function digitsToWords(str) {
|
|
17
|
-
return str.replace(/\d/g, (char) =>
|
|
17
|
+
return str.replace(/\d/g, (char) => digits[parseInt(char, 10)] ?? char);
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Suggest an identifier based on a label, e.g. `My Component` -> `myComponent`.
|
|
@@ -65,3 +65,4 @@ function isReservedPropertyName(str) {
|
|
|
65
65
|
// also treat any property name starting with "default_" as reserved since we use this prefix for default properties
|
|
66
66
|
str.startsWith("default_"));
|
|
67
67
|
}
|
|
68
|
+
//# sourceMappingURL=identifiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifiers.js","sourceRoot":"","sources":["../src/identifiers.ts"],"names":[],"mappings":";;AAqBA,8CASC;AAID,8CAEC;AA2BD,wDAMC;AArED,mHAAmH;AACnH,SAAS,qBAAqB,CAAC,GAAW;IACxC,OAAO,GAAG;SACP,KAAK,CAAC,gBAAgB,CAAC;SACvB,MAAM,CAAC,OAAO,CAAC;SACf,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACpD,IAAI,CAAC,EAAE,CAAC,CAAC;AACd,CAAC;AAED,MAAM,MAAM,GAAG,mDAAmD,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAE9E,uDAAuD;AACvD,SAAS,aAAa,CAAC,GAAW;IAChC,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC;AAC1E,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,KAAa,EAAE,eAAe,GAAG,KAAK;IACtE,MAAM,cAAc,GAAG,qBAAqB,CAAC,KAAK,CAAC;QACjD,+FAA+F;SAC9F,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAClC,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,cAAc,CAAC;IACxB,CAAC;SAAM,CAAC;QACN,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnE,CAAC;AACH,CAAC;AAED,MAAM,eAAe,GAAG,0BAA0B,CAAC;AAEnD,SAAgB,iBAAiB,CAAC,GAAW;IAC3C,OAAO,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAS;IAC5C,aAAa;IACb,cAAc;IACd,WAAW;IACX,wBAAwB;IACxB,wBAAwB;IACxB,aAAa;IACb,UAAU;IACV,QAAQ;IACR,WAAW;IACX,WAAW;IACX,YAAY;IACZ,UAAU;IACV,aAAa;IACb,aAAa;IACb,UAAU;IACV,KAAK;IACL,QAAQ;IACR,MAAM;IACN,UAAU;IACV,kBAAkB;IAClB,YAAY;IACZ,OAAO;CACR,CAAC,CAAC;AAEH,SAAgB,sBAAsB,CAAC,GAAW;IAChD,OAAO,CACL,qBAAqB,CAAC,GAAG,CAAC,GAAG,CAAC;QAC9B,oHAAoH;QACpH,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAC3B,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
export * from "./constants";
|
|
2
|
-
export * from "./component-configs";
|
|
3
|
-
export * from "./events";
|
|
4
|
-
export * from "./file-uploader";
|
|
5
|
-
export * from "./login";
|
|
6
|
-
export * from "./resource-configs";
|
|
7
|
-
export * from "./data-types";
|
|
8
|
-
export * from "./types";
|
|
9
|
-
export * from "./identifiers";
|
|
10
|
-
export * from "./localGitRepoState";
|
|
11
|
-
export * from "./unreachable";
|
|
1
|
+
export * from "./constants.js";
|
|
2
|
+
export * from "./component-configs.js";
|
|
3
|
+
export * from "./events.js";
|
|
4
|
+
export * from "./file-uploader.js";
|
|
5
|
+
export * from "./login.js";
|
|
6
|
+
export * from "./resource-configs.js";
|
|
7
|
+
export * from "./data-types.js";
|
|
8
|
+
export * from "./types.js";
|
|
9
|
+
export * from "./identifiers.js";
|
|
10
|
+
export * from "./localGitRepoState.js";
|
|
11
|
+
export * from "./unreachable.js";
|
|
12
|
+
export * from "./api-files/types.js";
|
|
13
|
+
export * from "./api-files/index.js";
|
|
14
|
+
export * from "./api-files/constants.js";
|
|
15
|
+
export * from "./mask-unix-signals.js";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,14 +14,19 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./constants"), exports);
|
|
18
|
-
__exportStar(require("./component-configs"), exports);
|
|
19
|
-
__exportStar(require("./events"), exports);
|
|
20
|
-
__exportStar(require("./file-uploader"), exports);
|
|
21
|
-
__exportStar(require("./login"), exports);
|
|
22
|
-
__exportStar(require("./resource-configs"), exports);
|
|
23
|
-
__exportStar(require("./data-types"), exports);
|
|
24
|
-
__exportStar(require("./types"), exports);
|
|
25
|
-
__exportStar(require("./identifiers"), exports);
|
|
26
|
-
__exportStar(require("./localGitRepoState"), exports);
|
|
27
|
-
__exportStar(require("./unreachable"), exports);
|
|
17
|
+
__exportStar(require("./constants.js"), exports);
|
|
18
|
+
__exportStar(require("./component-configs.js"), exports);
|
|
19
|
+
__exportStar(require("./events.js"), exports);
|
|
20
|
+
__exportStar(require("./file-uploader.js"), exports);
|
|
21
|
+
__exportStar(require("./login.js"), exports);
|
|
22
|
+
__exportStar(require("./resource-configs.js"), exports);
|
|
23
|
+
__exportStar(require("./data-types.js"), exports);
|
|
24
|
+
__exportStar(require("./types.js"), exports);
|
|
25
|
+
__exportStar(require("./identifiers.js"), exports);
|
|
26
|
+
__exportStar(require("./localGitRepoState.js"), exports);
|
|
27
|
+
__exportStar(require("./unreachable.js"), exports);
|
|
28
|
+
__exportStar(require("./api-files/types.js"), exports);
|
|
29
|
+
__exportStar(require("./api-files/index.js"), exports);
|
|
30
|
+
__exportStar(require("./api-files/constants.js"), exports);
|
|
31
|
+
__exportStar(require("./mask-unix-signals.js"), exports);
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,yDAAuC;AACvC,8CAA4B;AAC5B,qDAAmC;AACnC,6CAA2B;AAC3B,wDAAsC;AACtC,kDAAgC;AAChC,6CAA2B;AAC3B,mDAAiC;AACjC,yDAAuC;AACvC,mDAAiC;AACjC,uDAAqC;AACrC,uDAAqC;AACrC,2DAAyC;AACzC,yDAAuC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentEvent } from "./events";
|
|
1
|
+
import type { ComponentEvent } from "./events.js";
|
|
2
2
|
export type LocalGitRepoState = {
|
|
3
3
|
status: "NO_GIT";
|
|
4
4
|
} | {
|
|
@@ -17,3 +17,4 @@ export interface ValidateGitSetupRequestBody {
|
|
|
17
17
|
gitState: LocalGitRepoState;
|
|
18
18
|
event?: ComponentEvent;
|
|
19
19
|
}
|
|
20
|
+
//# sourceMappingURL=localGitRepoState.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localGitRepoState.d.ts","sourceRoot":"","sources":["../src/localGitRepoState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,MAAM,iBAAiB,GACzB;IAAE,MAAM,EAAE,QAAQ,CAAA;CAAE,GACpB;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,GACtB;IACE,MAAM,EAAE,aAAa,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE;QACT,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACxB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AAEN,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localGitRepoState.js","sourceRoot":"","sources":["../src/localGitRepoState.ts"],"names":[],"mappings":""}
|
package/dist/login.d.ts
CHANGED
|
@@ -8,3 +8,4 @@ export declare function saveApiToken(superblocksBaseUrl: string, token?: string)
|
|
|
8
8
|
export declare function getLocalTokenWithUrlIfExists(): Promise<TokenWithBaseUrl | BaseUrl | undefined>;
|
|
9
9
|
export declare function getLocalTokenWithUrl(): Promise<TokenWithBaseUrl | BaseUrl>;
|
|
10
10
|
export {};
|
|
11
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../src/login.ts"],"names":[],"mappings":"AAKA,KAAK,OAAO,GAAG;IACb,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,KAAK,gBAAgB,GAAG,OAAO,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAsB,YAAY,CAAC,kBAAkB,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,iBAkB5E;AAED,wBAAsB,4BAA4B,IAAI,OAAO,CAC3D,gBAAgB,GAAG,OAAO,GAAG,SAAS,CACvC,CAMA;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CACnD,gBAAgB,GAAG,OAAO,CAC3B,CAoBA"}
|
package/dist/login.js
CHANGED
|
@@ -39,7 +39,7 @@ exports.getLocalTokenWithUrl = getLocalTokenWithUrl;
|
|
|
39
39
|
const node_os_1 = require("node:os");
|
|
40
40
|
const node_path_1 = require("node:path");
|
|
41
41
|
const fs = __importStar(require("fs-extra"));
|
|
42
|
-
const
|
|
42
|
+
const constants_js_1 = require("./constants.js");
|
|
43
43
|
async function saveApiToken(superblocksBaseUrl, token) {
|
|
44
44
|
try {
|
|
45
45
|
await fs.ensureDir((0, node_path_1.join)((0, node_os_1.homedir)(), ".superblocks"));
|
|
@@ -48,17 +48,17 @@ async function saveApiToken(superblocksBaseUrl, token) {
|
|
|
48
48
|
superblocksBaseUrl,
|
|
49
49
|
token,
|
|
50
50
|
};
|
|
51
|
-
await fs.writeJSON((0, node_path_1.join)((0, node_os_1.homedir)(),
|
|
51
|
+
await fs.writeJSON((0, node_path_1.join)((0, node_os_1.homedir)(), constants_js_1.TOKEN_CONFIG_PATH), tokenConfig);
|
|
52
52
|
}
|
|
53
53
|
else {
|
|
54
54
|
const tokenConfig = {
|
|
55
55
|
superblocksBaseUrl,
|
|
56
56
|
};
|
|
57
|
-
await fs.writeJSON((0, node_path_1.join)((0, node_os_1.homedir)(),
|
|
57
|
+
await fs.writeJSON((0, node_path_1.join)((0, node_os_1.homedir)(), constants_js_1.TOKEN_CONFIG_PATH), tokenConfig);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
catch {
|
|
61
|
-
throw new
|
|
61
|
+
throw new constants_js_1.FileAccessError("Could not save token");
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
async function getLocalTokenWithUrlIfExists() {
|
|
@@ -71,7 +71,7 @@ async function getLocalTokenWithUrlIfExists() {
|
|
|
71
71
|
}
|
|
72
72
|
async function getLocalTokenWithUrl() {
|
|
73
73
|
try {
|
|
74
|
-
const tokenConfig = await fs.readJSON(process.env.SUPERBLOCKS_AUTH_FILE || (0, node_path_1.join)((0, node_os_1.homedir)(),
|
|
74
|
+
const tokenConfig = await fs.readJSON(process.env.SUPERBLOCKS_AUTH_FILE || (0, node_path_1.join)((0, node_os_1.homedir)(), constants_js_1.TOKEN_CONFIG_PATH));
|
|
75
75
|
if (tokenConfig.token) {
|
|
76
76
|
// user logged in
|
|
77
77
|
return {
|
|
@@ -90,3 +90,4 @@ async function getLocalTokenWithUrl() {
|
|
|
90
90
|
throw new Error("No local API key found");
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../src/login.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,oCAkBC;AAED,oEAQC;AAED,oDAsBC;AAjED,qCAAkC;AAClC,yCAAiC;AACjC,6CAA+B;AAC/B,iDAAoE;AAU7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M,CAAC;YACN,qCAAqC;YACrC,OAAO;gBACL,kBAAkB,EAAE,WAAW,CAAC,kBAAkB;aACnD,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type ActionResult<T> = {
|
|
2
|
+
success: true;
|
|
3
|
+
returnValue: T;
|
|
4
|
+
} | {
|
|
5
|
+
success: false;
|
|
6
|
+
error: unknown;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Runs an action with some unix signals being masked. This is useful for actions that should not be interrupted and need
|
|
10
|
+
* to be allowed to complete or perform some cleanup. If a signal is received, the action will be notified that it should
|
|
11
|
+
* abort via the `AbortSignal` that is passed to it. The action may or may not choose to abort immediately. The cleanup
|
|
12
|
+
* action is called after the main action and this happens unconditionally, i.e. regardless of whether a signal was received,
|
|
13
|
+
* the main action threw an error, or the main action returned a value. The cleanup action is passed the abort signal and the
|
|
14
|
+
* error (if any) that was thrown by the main action. If a signal was received, the process will exit after the cleanup
|
|
15
|
+
* action has completed. If the main action threw an error, that error will be thrown again. Otherwise, the main action's
|
|
16
|
+
* return value is returned. This function can be thought of as a (unix) signal aware version of `try { … } finally { … }`
|
|
17
|
+
* and `try { … } catch { … } catch { … }`.
|
|
18
|
+
*
|
|
19
|
+
* *Note*: This function registers listeners for some unix signals, so it affects the global behavior of the process. Be
|
|
20
|
+
* careful when using this function in a library.
|
|
21
|
+
*
|
|
22
|
+
* @param action - The main action to execute.
|
|
23
|
+
* @param cleanup - An optional cleanup action to execute when the process is aborted.
|
|
24
|
+
* @returns The result of the `action`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function maskUnixSignals<T>(action: (aborted: AbortSignal) => Promise<T>, cleanup?: (aborted: AbortSignal, actionResult: ActionResult<T>) => Promise<void>): Promise<T>;
|
|
27
|
+
//# sourceMappingURL=mask-unix-signals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mask-unix-signals.d.ts","sourceRoot":"","sources":["../src/mask-unix-signals.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,YAAY,CAAC,CAAC,IACtB;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,WAAW,EAAE,CAAC,CAAA;CAAE,GACjC;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC;AAEvC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,eAAe,CAAC,CAAC,EACrC,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,EAC5C,OAAO,CAAC,EAAE,CACR,OAAO,EAAE,WAAW,EACpB,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,KAC1B,OAAO,CAAC,IAAI,CAAC,GACjB,OAAO,CAAC,CAAC,CAAC,CAoDZ"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.maskUnixSignals = maskUnixSignals;
|
|
4
|
+
const unixSignalsToMask = ["SIGINT", "SIGTERM", "SIGHUP"];
|
|
5
|
+
// The exit code that is used when the process is aborted due to a unix signal
|
|
6
|
+
const exitCode = 254;
|
|
7
|
+
/**
|
|
8
|
+
* Runs an action with some unix signals being masked. This is useful for actions that should not be interrupted and need
|
|
9
|
+
* to be allowed to complete or perform some cleanup. If a signal is received, the action will be notified that it should
|
|
10
|
+
* abort via the `AbortSignal` that is passed to it. The action may or may not choose to abort immediately. The cleanup
|
|
11
|
+
* action is called after the main action and this happens unconditionally, i.e. regardless of whether a signal was received,
|
|
12
|
+
* the main action threw an error, or the main action returned a value. The cleanup action is passed the abort signal and the
|
|
13
|
+
* error (if any) that was thrown by the main action. If a signal was received, the process will exit after the cleanup
|
|
14
|
+
* action has completed. If the main action threw an error, that error will be thrown again. Otherwise, the main action's
|
|
15
|
+
* return value is returned. This function can be thought of as a (unix) signal aware version of `try { … } finally { … }`
|
|
16
|
+
* and `try { … } catch { … } catch { … }`.
|
|
17
|
+
*
|
|
18
|
+
* *Note*: This function registers listeners for some unix signals, so it affects the global behavior of the process. Be
|
|
19
|
+
* careful when using this function in a library.
|
|
20
|
+
*
|
|
21
|
+
* @param action - The main action to execute.
|
|
22
|
+
* @param cleanup - An optional cleanup action to execute when the process is aborted.
|
|
23
|
+
* @returns The result of the `action`.
|
|
24
|
+
*/
|
|
25
|
+
async function maskUnixSignals(action, cleanup) {
|
|
26
|
+
const abortController = new AbortController();
|
|
27
|
+
const abortSignal = abortController.signal;
|
|
28
|
+
const onUnixSignal = (unixSignal) => {
|
|
29
|
+
console.log(`${unixSignal} received, will abort after cleanup`);
|
|
30
|
+
if (unixSignal === "SIGINT") {
|
|
31
|
+
if (!abortSignal.aborted) {
|
|
32
|
+
console.log("Press Ctrl+C again to force abort");
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
console.log("Second SIGINT received, will abort immediately");
|
|
36
|
+
process.exit(exitCode);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// Pass the signal as the reason for aborting so that `action` and `cleanup` can know which signal was received
|
|
40
|
+
abortController.abort(unixSignal);
|
|
41
|
+
};
|
|
42
|
+
for (const signal of unixSignalsToMask) {
|
|
43
|
+
process.on(signal, onUnixSignal);
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
let result;
|
|
47
|
+
try {
|
|
48
|
+
const returnValue = await action(abortSignal);
|
|
49
|
+
result = { success: true, returnValue };
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
result = { success: false, error: err };
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
await cleanup?.(abortSignal, result);
|
|
56
|
+
}
|
|
57
|
+
finally {
|
|
58
|
+
// If the process received a (unix) signal, this takes precedence over any error that was thrown by `action` or
|
|
59
|
+
// `cleanup`. So we exit here. Otherwise, we let standard JS error handling take over, e.g. an exception
|
|
60
|
+
// thrown by `cleanup` shadows any exception that was thrown by `action`.
|
|
61
|
+
if (abortSignal.aborted) {
|
|
62
|
+
// The process received a (unix) signal, so we exit here.
|
|
63
|
+
process.exit(exitCode);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (!result.success) {
|
|
67
|
+
// `action` threw an error
|
|
68
|
+
throw result.error;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// `action` threw an error
|
|
72
|
+
return result.returnValue;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
for (const signal of unixSignalsToMask) {
|
|
77
|
+
process.off(signal, onUnixSignal);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=mask-unix-signals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mask-unix-signals.js","sourceRoot":"","sources":["../src/mask-unix-signals.ts"],"names":[],"mappings":";;AA2BA,0CA0DC;AArFD,MAAM,iBAAiB,GAAqB,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAE5E,8EAA8E;AAC9E,MAAM,QAAQ,GAAG,GAAG,CAAC;AAMrB;;;;;;;;;;;;;;;;;GAiBG;AACI,KAAK,UAAU,eAAe,CACnC,MAA4C,EAC5C,OAGkB;IAElB,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;IAC9C,MAAM,WAAW,GAAG,eAAe,CAAC,MAAM,CAAC;IAE3C,MAAM,YAAY,GAAG,CAAC,UAA0B,EAAE,EAAE;QAClD,OAAO,CAAC,GAAG,CAAC,GAAG,UAAU,qCAAqC,CAAC,CAAC;QAChE,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;YAC5B,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;gBACzB,OAAO,CAAC,GAAG,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C;YACvC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -2,6 +2,7 @@ export type SuperblocksMetadata = {
|
|
|
2
2
|
cliVersion: string;
|
|
3
3
|
};
|
|
4
4
|
export type SuperblocksResourceType = "APPLICATION" | "BACKEND";
|
|
5
|
+
export type SuperblocksConfigType = "APPLICATION" | "APPLICATION_V2" | "BACKEND";
|
|
5
6
|
export type VersionedResourceConfig = {
|
|
6
7
|
location: string;
|
|
7
8
|
resourceType: SuperblocksResourceType;
|
|
@@ -11,6 +12,7 @@ export type SuperblocksResourceConfigMetadata = {
|
|
|
11
12
|
};
|
|
12
13
|
export type SuperblocksResourceConfig = {
|
|
13
14
|
id: string;
|
|
15
|
+
configType: SuperblocksConfigType;
|
|
14
16
|
metadata?: SuperblocksResourceConfigMetadata;
|
|
15
17
|
};
|
|
16
18
|
export type SuperblocksBackendConfig = SuperblocksResourceConfig & SourceFilesContanier & {
|
|
@@ -35,12 +37,15 @@ export type SourceFilesContanier = {
|
|
|
35
37
|
export type ApiInfo = SourceFilesContanier & {
|
|
36
38
|
name: string;
|
|
37
39
|
};
|
|
40
|
+
export type SuperblocksApplicationV2Config = SuperblocksResourceConfig & {
|
|
41
|
+
configType: "APPLICATION_V2";
|
|
42
|
+
};
|
|
38
43
|
export type SuperblocksMonorepoConfig = {
|
|
39
44
|
configType: "ROOT";
|
|
40
45
|
resources: Record<string, VersionedResourceConfig>;
|
|
41
46
|
metadata: SuperblocksMetadata;
|
|
42
47
|
};
|
|
43
|
-
export type SuperblocksConfig = SuperblocksMonorepoConfig | SuperblocksApplicationConfig | SuperblocksBackendConfig;
|
|
48
|
+
export type SuperblocksConfig = SuperblocksMonorepoConfig | SuperblocksApplicationConfig | SuperblocksApplicationV2Config | SuperblocksBackendConfig;
|
|
44
49
|
/**
|
|
45
50
|
* Get the Superblocks config file from the current directory (and optionally) hierarchy
|
|
46
51
|
* @param checkParentDir Whether to recursively check the parent directory for a Superblocks config file
|
|
@@ -48,6 +53,9 @@ export type SuperblocksConfig = SuperblocksMonorepoConfig | SuperblocksApplicati
|
|
|
48
53
|
export declare function getSuperblocksMonorepoConfigJson(checkParentDir?: boolean, pathPrefix?: string): Promise<[SuperblocksMonorepoConfig, string]>;
|
|
49
54
|
export declare function getSuperblocksApplicationConfigJson(applicationPath?: string): Promise<SuperblocksApplicationConfig>;
|
|
50
55
|
export declare function getSuperblocksApplicationConfigIfExists(applicationPath: string): Promise<SuperblocksApplicationConfig | undefined>;
|
|
56
|
+
export declare function getSuperblocksApplicationV2ConfigJson(applicationPath?: string): Promise<SuperblocksApplicationV2Config>;
|
|
51
57
|
export declare function getSuperblocksBackendConfigIfExists(backendPath: string): Promise<SuperblocksBackendConfig | undefined>;
|
|
52
58
|
export declare function getSuperblocksBackendConfigJson(): Promise<SuperblocksBackendConfig>;
|
|
53
59
|
export declare function getSuperblocksResourceConfigIfExists(): Promise<SuperblocksResourceConfig | undefined>;
|
|
60
|
+
export declare function getResourceIdFromUrl(resourceUrl: any): [string, SuperblocksResourceType];
|
|
61
|
+
//# sourceMappingURL=resource-configs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-configs.d.ts","sourceRoot":"","sources":["../src/resource-configs.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF,MAAM,MAAM,uBAAuB,GAAG,aAAa,GAAG,SAAS,CAAC;AAGhE,MAAM,MAAM,qBAAqB,GAC7B,aAAa,GACb,gBAAgB,GAChB,SAAS,CAAC;AAEd,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,uBAAuB,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,iCAAiC,GAAG;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAA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BAAmB,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB,yBAAyB,GACzB,4BAA4B,GAC5B,8BAA8B,GAC9B,wBAAwB,CAAC;AAE7B;;;GAGG;AACH,wBAAsB,gCAAgC,CACpD,cAAc,UAAQ,EACtB,UAAU,SAAK,GACd,OAAO,CAAC,CAAC,yBAAyB,EAAE,MAAM,CAAC,CAAC,CAsC9C;AAED,wBAAsB,mCAAmC,CACvD,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,4BAA4B,CAAC,CAqBvC;AAED,wBAAsB,uCAAuC,CAC3D,eAAe,EAAE,MAAM,GACtB,OAAO,CAAC,4BAA4B,GAAG,SAAS,CAAC,CAgBnD;AAED,wBAAsB,qCAAqC,CACzD,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,8BAA8B,CAAC,CAqBzC;AAED,wBAAsB,mCAAmC,CACvD,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC,CAgB/C;AAED,wBAAsB,+BAA+B,IAAI,OAAO,CAAC,wBAAwB,CAAC,CAkBzF;AAED,wBAAsB,oCAAoC,IAAI,OAAO,CACnE,yBAAyB,GAAG,SAAS,CACtC,CAkBA;AAED,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,GAAG,GACf,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAiCnC"}
|
package/dist/resource-configs.js
CHANGED
|
@@ -39,12 +39,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.getSuperblocksMonorepoConfigJson = getSuperblocksMonorepoConfigJson;
|
|
40
40
|
exports.getSuperblocksApplicationConfigJson = getSuperblocksApplicationConfigJson;
|
|
41
41
|
exports.getSuperblocksApplicationConfigIfExists = getSuperblocksApplicationConfigIfExists;
|
|
42
|
+
exports.getSuperblocksApplicationV2ConfigJson = getSuperblocksApplicationV2ConfigJson;
|
|
42
43
|
exports.getSuperblocksBackendConfigIfExists = getSuperblocksBackendConfigIfExists;
|
|
43
44
|
exports.getSuperblocksBackendConfigJson = getSuperblocksBackendConfigJson;
|
|
44
45
|
exports.getSuperblocksResourceConfigIfExists = getSuperblocksResourceConfigIfExists;
|
|
46
|
+
exports.getResourceIdFromUrl = getResourceIdFromUrl;
|
|
45
47
|
const path_1 = __importDefault(require("path"));
|
|
46
48
|
const fs = __importStar(require("fs-extra"));
|
|
47
|
-
const
|
|
49
|
+
const constants_js_1 = require("./constants.js");
|
|
48
50
|
/**
|
|
49
51
|
* Get the Superblocks config file from the current directory (and optionally) hierarchy
|
|
50
52
|
* @param checkParentDir Whether to recursively check the parent directory for a Superblocks config file
|
|
@@ -64,7 +66,7 @@ async function getSuperblocksMonorepoConfigJson(checkParentDir = false, pathPref
|
|
|
64
66
|
throw new Error("No Superblocks config file found in current directory hierarchy " +
|
|
65
67
|
pathPrefix);
|
|
66
68
|
}
|
|
67
|
-
const attemptedPath = path_1.default.join(absolutePath,
|
|
69
|
+
const attemptedPath = path_1.default.join(absolutePath, constants_js_1.RESOURCE_CONFIG_PATH);
|
|
68
70
|
try {
|
|
69
71
|
superblocksConfig = await fs.readJSON(attemptedPath);
|
|
70
72
|
if (superblocksConfig.configType !== "ROOT") {
|
|
@@ -85,8 +87,8 @@ async function getSuperblocksApplicationConfigJson(applicationPath) {
|
|
|
85
87
|
let superblocksConfig;
|
|
86
88
|
try {
|
|
87
89
|
const configPath = applicationPath
|
|
88
|
-
? path_1.default.join(applicationPath,
|
|
89
|
-
:
|
|
90
|
+
? path_1.default.join(applicationPath, constants_js_1.RESOURCE_CONFIG_PATH)
|
|
91
|
+
: constants_js_1.RESOURCE_CONFIG_PATH;
|
|
90
92
|
superblocksConfig = await fs.readJSON(configPath);
|
|
91
93
|
}
|
|
92
94
|
catch {
|
|
@@ -102,30 +104,47 @@ async function getSuperblocksApplicationConfigIfExists(applicationPath) {
|
|
|
102
104
|
let superblocksConfig;
|
|
103
105
|
try {
|
|
104
106
|
const configPath = applicationPath
|
|
105
|
-
? path_1.default.join(applicationPath,
|
|
106
|
-
:
|
|
107
|
+
? path_1.default.join(applicationPath, constants_js_1.RESOURCE_CONFIG_PATH)
|
|
108
|
+
: constants_js_1.RESOURCE_CONFIG_PATH;
|
|
107
109
|
superblocksConfig = await fs.readJSON(configPath);
|
|
108
110
|
}
|
|
109
111
|
catch {
|
|
110
112
|
// no superblocks config file found
|
|
111
113
|
}
|
|
112
|
-
if (
|
|
114
|
+
if (superblocksConfig?.configType !== "APPLICATION") {
|
|
113
115
|
return undefined;
|
|
114
116
|
}
|
|
115
117
|
return superblocksConfig;
|
|
116
118
|
}
|
|
119
|
+
async function getSuperblocksApplicationV2ConfigJson(applicationPath) {
|
|
120
|
+
let superblocksConfig;
|
|
121
|
+
try {
|
|
122
|
+
const configPath = applicationPath
|
|
123
|
+
? path_1.default.join(applicationPath, constants_js_1.RESOURCE_CONFIG_PATH)
|
|
124
|
+
: constants_js_1.RESOURCE_CONFIG_PATH;
|
|
125
|
+
superblocksConfig = await fs.readJSON(configPath);
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
// no superblocks config file found
|
|
129
|
+
throw new Error("This command must be run within a Superblocks app directory.");
|
|
130
|
+
}
|
|
131
|
+
if (superblocksConfig.configType !== "APPLICATION_V2") {
|
|
132
|
+
throw new Error("Please execute this command within a Superblocks application directory.");
|
|
133
|
+
}
|
|
134
|
+
return superblocksConfig;
|
|
135
|
+
}
|
|
117
136
|
async function getSuperblocksBackendConfigIfExists(backendPath) {
|
|
118
137
|
let superblocksConfig;
|
|
119
138
|
try {
|
|
120
139
|
const configPath = backendPath
|
|
121
|
-
? path_1.default.join(backendPath,
|
|
122
|
-
:
|
|
140
|
+
? path_1.default.join(backendPath, constants_js_1.RESOURCE_CONFIG_PATH)
|
|
141
|
+
: constants_js_1.RESOURCE_CONFIG_PATH;
|
|
123
142
|
superblocksConfig = await fs.readJSON(configPath);
|
|
124
143
|
}
|
|
125
144
|
catch {
|
|
126
145
|
// no superblocks config file found
|
|
127
146
|
}
|
|
128
|
-
if (
|
|
147
|
+
if (superblocksConfig?.configType !== "BACKEND") {
|
|
129
148
|
return undefined;
|
|
130
149
|
}
|
|
131
150
|
return superblocksConfig;
|
|
@@ -133,7 +152,7 @@ async function getSuperblocksBackendConfigIfExists(backendPath) {
|
|
|
133
152
|
async function getSuperblocksBackendConfigJson() {
|
|
134
153
|
let superblocksConfig;
|
|
135
154
|
try {
|
|
136
|
-
superblocksConfig = await fs.readJSON(
|
|
155
|
+
superblocksConfig = await fs.readJSON(constants_js_1.RESOURCE_CONFIG_PATH);
|
|
137
156
|
}
|
|
138
157
|
catch {
|
|
139
158
|
// no superblocks config file found
|
|
@@ -152,6 +171,12 @@ async function getSuperblocksResourceConfigIfExists() {
|
|
|
152
171
|
catch {
|
|
153
172
|
// Noop
|
|
154
173
|
}
|
|
174
|
+
try {
|
|
175
|
+
config = await getSuperblocksApplicationV2ConfigJson();
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
// Noop
|
|
179
|
+
}
|
|
155
180
|
try {
|
|
156
181
|
config = await getSuperblocksBackendConfigJson();
|
|
157
182
|
}
|
|
@@ -160,3 +185,33 @@ async function getSuperblocksResourceConfigIfExists() {
|
|
|
160
185
|
}
|
|
161
186
|
return config;
|
|
162
187
|
}
|
|
188
|
+
function getResourceIdFromUrl(resourceUrl) {
|
|
189
|
+
const url = new URL(resourceUrl);
|
|
190
|
+
if (url.pathname.startsWith("/code-mode")) {
|
|
191
|
+
// find the first uuid in the url
|
|
192
|
+
const tokens = url.pathname.split("/");
|
|
193
|
+
const uuid = tokens.find((token) => token.match(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/));
|
|
194
|
+
if (!uuid) {
|
|
195
|
+
throw new Error(`Failed to parse resource URL: ${resourceUrl}`);
|
|
196
|
+
}
|
|
197
|
+
return [uuid, "APPLICATION"];
|
|
198
|
+
}
|
|
199
|
+
if (url.pathname.startsWith("/applications")) {
|
|
200
|
+
const tokens = url.pathname.split("/");
|
|
201
|
+
if (tokens.length < 2) {
|
|
202
|
+
throw new Error(`Failed to parse resource URL: ${resourceUrl}`);
|
|
203
|
+
}
|
|
204
|
+
if (tokens[2] === "edit") {
|
|
205
|
+
return [tokens[3], "APPLICATION"];
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
return [tokens[2], "APPLICATION"];
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
else if (url.pathname.startsWith("/workflows") ||
|
|
212
|
+
url.pathname.startsWith("/scheduled_jobs")) {
|
|
213
|
+
return [url.pathname.split("/")[2], "BACKEND"];
|
|
214
|
+
}
|
|
215
|
+
throw new Error(`Failed to parse resource URL: ${resourceUrl}`);
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=resource-configs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-configs.js","sourceRoot":"","sources":["../src/resource-configs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkFA,4EAyCC;AAED,kFAuBC;AAED,0FAkBC;AAED,sFAuBC;AAED,kFAkBC;AAED,0EAkBC;AAED,oFAoBC;AAED,oDAmCC;AApSD,gDAAwB;AACxB,6CAA+B;AAC/B,iDAAsD;AA4EtD;;;GAGG;AACI,KAAK,UAAU,gCAAgC,CACpD,cAAc,GAAG,KAAK,EACtB,UAAU,GAAG,EAAE;IAEf,MAAM,YAAY,GAAG,cAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAE9C,IAAI,wBAAwB,GAAG,KAAK,CAAC;IACrC,IAAI,CAAC;QACH,wBAAwB,GAAG,cAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,IAAI,IAAI,YAAY,CAAC;IAC3E,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,uBAAuB,GAAG,YA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C,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,iCAAiC,WAAW,EAAE,CAAC,CAAC;AAClE,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { DataType } from "./data-types.js";
|
|
2
|
+
import type { UUID } from "node:crypto";
|
|
3
3
|
interface PropertiesPanelDisplay<T extends DataType> {
|
|
4
4
|
/**
|
|
5
5
|
* Determines what form item type is shown in the Superblocks properties panel.
|
|
@@ -37,12 +37,12 @@ interface PropertiesPanelDisplay<T extends DataType> {
|
|
|
37
37
|
expectedType?: string;
|
|
38
38
|
/**
|
|
39
39
|
* The default value should match the dataType of the property.
|
|
40
|
-
*
|
|
41
|
-
* When dataType is "any", you must provide a string default value.
|
|
42
|
-
* Your string will be interpreted based on the controlType, so if you have controlType "js-expr",
|
|
43
|
-
* you should provide a string that is a valid javascript expression including quotations marks.
|
|
44
40
|
*/
|
|
45
|
-
defaultValue?: T
|
|
41
|
+
defaultValue?: T;
|
|
42
|
+
/**
|
|
43
|
+
* The default value to use when adding a property.
|
|
44
|
+
*/
|
|
45
|
+
defaultOnAdd?: T;
|
|
46
46
|
}
|
|
47
47
|
export interface PropertyForData<T extends DataType> {
|
|
48
48
|
path: string;
|
|
@@ -102,3 +102,4 @@ export interface ComponentConfig {
|
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
104
|
export {};
|
|
105
|
+
//# sourceMappingURL=types.d.ts.map
|