@superblocksteam/util 2.0.158 → 2.0.159-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 (86) hide show
  1. package/package.json +1 -1
  2. package/.turbo/turbo-build.log +0 -4
  3. package/dist/api-files/api.d.mts +0 -8
  4. package/dist/api-files/api.d.mts.map +0 -1
  5. package/dist/api-files/api.mjs +0 -262
  6. package/dist/api-files/api.mjs.map +0 -1
  7. package/dist/api-files/constants.d.ts +0 -6
  8. package/dist/api-files/constants.d.ts.map +0 -1
  9. package/dist/api-files/constants.js +0 -9
  10. package/dist/api-files/constants.js.map +0 -1
  11. package/dist/api-files/index.d.ts +0 -8
  12. package/dist/api-files/index.d.ts.map +0 -1
  13. package/dist/api-files/index.js +0 -18
  14. package/dist/api-files/index.js.map +0 -1
  15. package/dist/api-files/types.d.ts +0 -115
  16. package/dist/api-files/types.d.ts.map +0 -1
  17. package/dist/api-files/types.js +0 -14
  18. package/dist/api-files/types.js.map +0 -1
  19. package/dist/component-configs.d.ts +0 -6
  20. package/dist/component-configs.d.ts.map +0 -1
  21. package/dist/component-configs.js +0 -178
  22. package/dist/component-configs.js.map +0 -1
  23. package/dist/constants.d.ts +0 -18
  24. package/dist/constants.d.ts.map +0 -1
  25. package/dist/constants.js +0 -37
  26. package/dist/constants.js.map +0 -1
  27. package/dist/data-types.d.ts +0 -8
  28. package/dist/data-types.d.ts.map +0 -1
  29. package/dist/data-types.js +0 -22
  30. package/dist/data-types.js.map +0 -1
  31. package/dist/events.d.ts +0 -13
  32. package/dist/events.d.ts.map +0 -1
  33. package/dist/events.js +0 -17
  34. package/dist/events.js.map +0 -1
  35. package/dist/file-uploader.d.ts +0 -3
  36. package/dist/file-uploader.d.ts.map +0 -1
  37. package/dist/file-uploader.js +0 -41
  38. package/dist/file-uploader.js.map +0 -1
  39. package/dist/file-uploader.test.d.ts +0 -2
  40. package/dist/file-uploader.test.d.ts.map +0 -1
  41. package/dist/file-uploader.test.js +0 -43
  42. package/dist/file-uploader.test.js.map +0 -1
  43. package/dist/generate-component-types.d.ts +0 -3
  44. package/dist/generate-component-types.d.ts.map +0 -1
  45. package/dist/generate-component-types.js +0 -45
  46. package/dist/generate-component-types.js.map +0 -1
  47. package/dist/identifiers.d.ts +0 -9
  48. package/dist/identifiers.d.ts.map +0 -1
  49. package/dist/identifiers.js +0 -68
  50. package/dist/identifiers.js.map +0 -1
  51. package/dist/index.d.ts +0 -17
  52. package/dist/index.d.ts.map +0 -1
  53. package/dist/index.js.map +0 -1
  54. package/dist/localGitRepoState.d.ts +0 -20
  55. package/dist/localGitRepoState.d.ts.map +0 -1
  56. package/dist/localGitRepoState.js +0 -3
  57. package/dist/localGitRepoState.js.map +0 -1
  58. package/dist/login.d.ts +0 -17
  59. package/dist/login.d.ts.map +0 -1
  60. package/dist/login.js +0 -74
  61. package/dist/login.js.map +0 -1
  62. package/dist/mask-unix-signals.d.ts +0 -28
  63. package/dist/mask-unix-signals.d.ts.map +0 -1
  64. package/dist/mask-unix-signals.js +0 -81
  65. package/dist/mask-unix-signals.js.map +0 -1
  66. package/dist/resource-configs.d.ts +0 -73
  67. package/dist/resource-configs.d.ts.map +0 -1
  68. package/dist/resource-configs.js +0 -224
  69. package/dist/resource-configs.js.map +0 -1
  70. package/dist/token-manager.d.ts +0 -22
  71. package/dist/token-manager.d.ts.map +0 -1
  72. package/dist/token-manager.js +0 -3
  73. package/dist/token-manager.js.map +0 -1
  74. package/dist/types.d.ts +0 -105
  75. package/dist/types.d.ts.map +0 -1
  76. package/dist/types.js +0 -3
  77. package/dist/types.js.map +0 -1
  78. package/dist/unreachable.d.ts +0 -2
  79. package/dist/unreachable.d.ts.map +0 -1
  80. package/dist/unreachable.js +0 -7
  81. package/dist/unreachable.js.map +0 -1
  82. package/dist/validation.d.ts +0 -5
  83. package/dist/validation.d.ts.map +0 -1
  84. package/dist/validation.js +0 -152
  85. package/dist/validation.js.map +0 -1
  86. package/tsconfig.tsbuildinfo +0 -1
@@ -1,20 +0,0 @@
1
- import type { ComponentEvent } from "./events.js";
2
- export type LocalGitRepoState = {
3
- status: "NO_GIT";
4
- } | {
5
- status: "DETACHED";
6
- } | {
7
- status: "IN_A_BRANCH";
8
- localBranchName: string;
9
- upstream?: {
10
- remoteName: string;
11
- url: string;
12
- pushUrl?: string | null;
13
- branchName: string;
14
- };
15
- };
16
- export interface ValidateGitSetupRequestBody {
17
- gitState: LocalGitRepoState;
18
- event?: ComponentEvent;
19
- }
20
- //# sourceMappingURL=localGitRepoState.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=localGitRepoState.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"localGitRepoState.js","sourceRoot":"","sources":["../src/localGitRepoState.ts"],"names":[],"mappings":""}
package/dist/login.d.ts DELETED
@@ -1,17 +0,0 @@
1
- type BaseUrl = {
2
- superblocksBaseUrl: string;
3
- };
4
- type TokenWithBaseUrl = BaseUrl & {
5
- token: string;
6
- };
7
- /**
8
- * Returns the resolved auth file path, honoring the SUPERBLOCKS_AUTH_FILE
9
- * environment variable. Both reads and writes MUST use this so the CLI
10
- * never writes to one file and reads from another.
11
- */
12
- export declare function resolveAuthFilePath(): string;
13
- export declare function saveApiToken(superblocksBaseUrl: string, token?: string): Promise<void>;
14
- export declare function getLocalTokenWithUrlIfExists(): Promise<TokenWithBaseUrl | BaseUrl | undefined>;
15
- export declare function getLocalTokenWithUrl(): Promise<TokenWithBaseUrl | BaseUrl>;
16
- export {};
17
- //# sourceMappingURL=login.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../src/login.ts"],"names":[],"mappings":"AAOA,KAAK,OAAO,GAAG;IACb,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,KAAK,gBAAgB,GAAG,OAAO,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAI5C;AAED,wBAAsB,YAAY,CAAC,kBAAkB,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,iBAmB5E;AAED,wBAAsB,4BAA4B,IAAI,OAAO,CAC3D,gBAAgB,GAAG,OAAO,GAAG,SAAS,CACvC,CAMA;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CACnD,gBAAgB,GAAG,OAAO,CAC3B,CAsBA"}
package/dist/login.js DELETED
@@ -1,74 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.resolveAuthFilePath = resolveAuthFilePath;
7
- exports.saveApiToken = saveApiToken;
8
- exports.getLocalTokenWithUrlIfExists = getLocalTokenWithUrlIfExists;
9
- exports.getLocalTokenWithUrl = getLocalTokenWithUrl;
10
- const node_os_1 = require("node:os");
11
- const node_path_1 = require("node:path");
12
- const fs_extra_1 = __importDefault(require("fs-extra"));
13
- const constants_js_1 = require("./constants.js");
14
- /**
15
- * Returns the resolved auth file path, honoring the SUPERBLOCKS_AUTH_FILE
16
- * environment variable. Both reads and writes MUST use this so the CLI
17
- * never writes to one file and reads from another.
18
- */
19
- function resolveAuthFilePath() {
20
- return (process.env.SUPERBLOCKS_AUTH_FILE || (0, node_path_1.join)((0, node_os_1.homedir)(), constants_js_1.TOKEN_CONFIG_PATH));
21
- }
22
- async function saveApiToken(superblocksBaseUrl, token) {
23
- try {
24
- const authFile = resolveAuthFilePath();
25
- await fs_extra_1.default.ensureDir((0, node_path_1.dirname)(authFile));
26
- if (token) {
27
- const tokenConfig = {
28
- superblocksBaseUrl,
29
- token,
30
- };
31
- await fs_extra_1.default.writeJSON(authFile, tokenConfig);
32
- }
33
- else {
34
- const tokenConfig = {
35
- superblocksBaseUrl,
36
- };
37
- await fs_extra_1.default.writeJSON(authFile, tokenConfig);
38
- }
39
- }
40
- catch {
41
- throw new constants_js_1.FileAccessError("Could not save token");
42
- }
43
- }
44
- async function getLocalTokenWithUrlIfExists() {
45
- try {
46
- return await getLocalTokenWithUrl();
47
- }
48
- catch {
49
- return undefined;
50
- }
51
- }
52
- async function getLocalTokenWithUrl() {
53
- try {
54
- const tokenConfig = await fs_extra_1.default.readJSON(resolveAuthFilePath());
55
- const superblocksBaseUrl = process.env.SUPERBLOCKS_BASE_URL || tokenConfig.superblocksBaseUrl;
56
- if (tokenConfig.token) {
57
- // user logged in
58
- return {
59
- token: tokenConfig.token,
60
- superblocksBaseUrl,
61
- };
62
- }
63
- else {
64
- // user not logged in, but set domain
65
- return {
66
- superblocksBaseUrl,
67
- };
68
- }
69
- }
70
- catch {
71
- throw new Error("No local API key found");
72
- }
73
- }
74
- //# sourceMappingURL=login.js.map
package/dist/login.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"login.js","sourceRoot":"","sources":["../src/login.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AkB,GACtB,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,WAAW,CAAC,kBAAkB,CAAC;QACrE,IAAI,WAAW,CAAC,KAAK,EAAE,CAAC;YACtB,iBAAiB;YACjB,OAAO;gBACL,KAAK,EAAE,WAAW,CAAC,KAAK;gBACxB,kBAAkB;aACnB,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,qCAAqC;YACrC,OAAO;gBACL,kBAAkB;aACnB,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC"}
@@ -1,28 +0,0 @@
1
- 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
- export {};
28
- //# sourceMappingURL=mask-unix-signals.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mask-unix-signals.d.ts","sourceRoot":"","sources":["../src/mask-unix-signals.ts"],"names":[],"mappings":"AAKA,KAAK,YAAY,CAAC,CAAC,IACf;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"}
@@ -1,81 +0,0 @@
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
@@ -1 +0,0 @@
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,C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AM,CAAC,CAAC;QACvC,CAAC;gBAAS,CAAC;YACT,+GAA+G;YAC/G,wGAAwG;YACxG,yEAAyE;YACzE,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;gBACxB,yDAAyD;gBACzD,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,0BAA0B;YAC1B,MAAM,MAAM,CAAC,KAAK,CAAC;QACrB,CAAC;aAAM,CAAC;YACN,0BAA0B;YAC1B,OAAO,MAAM,CAAC,WAAW,CAAC;QAC5B,CAAC;IACH,CAAC;YAAS,CAAC;QACT,KAAK,MAAM,MAAM,IAAI,iBAAiB,EAAE,CAAC;YACvC,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,73 +0,0 @@
1
- type SuperblocksMetadata = {
2
- cliVersion: string;
3
- };
4
- export type SuperblocksResourceType = "APPLICATION" | "BACKEND";
5
- export type SuperblocksConfigType = "APPLICATION" | "APPLICATION_V2" | "BACKEND";
6
- export type VersionedResourceConfig = {
7
- location: string;
8
- resourceType: SuperblocksResourceType;
9
- };
10
- export type SuperblocksResourceConfigMetadata = {
11
- fileVersion?: string;
12
- };
13
- export type SuperblocksResourceConfig = {
14
- id: string;
15
- configType: SuperblocksConfigType;
16
- metadata?: SuperblocksResourceConfigMetadata;
17
- };
18
- export type SuperblocksBackendConfig = SuperblocksResourceConfig & SourceFilesContanier & {
19
- configType: "BACKEND";
20
- };
21
- export type SuperblocksApplicationConfig = SuperblocksResourceConfig & {
22
- configType: "APPLICATION";
23
- defaultPageId?: string;
24
- apis?: Record<string, string>;
25
- appApis?: Record<string, ApiInfo>;
26
- pages?: Record<string, PageInfo>;
27
- };
28
- export type PageInfo = {
29
- id: string;
30
- name: string;
31
- apis?: Record<string, string>;
32
- pageApis?: Record<string, ApiInfo>;
33
- };
34
- type SourceFilesContanier = {
35
- sourceFiles?: string[];
36
- };
37
- export type ApiInfo = SourceFilesContanier & {
38
- name: string;
39
- };
40
- export type SuperblocksApplicationV2Config = SuperblocksResourceConfig & {
41
- configType: "APPLICATION_V2";
42
- };
43
- export type SuperblocksMonorepoConfig = {
44
- configType: "ROOT";
45
- resources: Record<string, VersionedResourceConfig>;
46
- metadata: SuperblocksMetadata;
47
- };
48
- export type SuperblocksConfig = SuperblocksMonorepoConfig | SuperblocksApplicationConfig | SuperblocksApplicationV2Config | SuperblocksBackendConfig;
49
- type DevEnvironmentConfigType = "DEV_ENVIRONMENT";
50
- export type SuperblocksDevEnvironmentConfig = {
51
- configType: DevEnvironmentConfigType;
52
- branch?: string;
53
- };
54
- /**
55
- * Get the Superblocks dev environment config file from the current directory (and optionally) hierarchy
56
- * @param checkParentDir Whether to recursively check the parent directory for a Superblocks dev environment config file
57
- * @param pathPrefix The path prefix to use for the search
58
- * @returns The Superblocks dev environment config and the path to the config file
59
- */
60
- export declare function getSuperblocksDevEnvironmentConfigJson(checkParentDir?: boolean, pathPrefix?: string): Promise<[SuperblocksDevEnvironmentConfig, string]>;
61
- /**
62
- * Get the Superblocks config file from the current directory (and optionally) hierarchy
63
- * @param checkParentDir Whether to recursively check the parent directory for a Superblocks config file
64
- */
65
- export declare function getSuperblocksMonorepoConfigJson(checkParentDir?: boolean, pathPrefix?: string): Promise<[SuperblocksMonorepoConfig, string]>;
66
- export declare function getSuperblocksApplicationConfigJson(applicationPath?: string): Promise<SuperblocksApplicationConfig>;
67
- export declare function getSuperblocksApplicationConfigIfExists(applicationPath: string): Promise<SuperblocksApplicationConfig | undefined>;
68
- export declare function getSuperblocksApplicationV2ConfigJson(applicationPath?: string): Promise<SuperblocksApplicationV2Config>;
69
- export declare function getSuperblocksBackendConfigIfExists(backendPath: string): Promise<SuperblocksBackendConfig | undefined>;
70
- export declare function getSuperblocksResourceConfigIfExists(): Promise<SuperblocksResourceConfig | undefined>;
71
- export declare function getResourceIdFromUrl(resourceUrl: any): [string, SuperblocksResourceType];
72
- export {};
73
- //# sourceMappingURL=resource-configs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resource-configs.d.ts","sourceRoot":"","sources":["../src/resource-configs.ts"],"names":[],"mappings":"AASA,KAAK,mBAAmB,GAAG;IACzB,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,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,qBAAqB,CAAC;IAClC,QAAQ,CAAC,EAAE,iCAAiC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,yBAAyB,GAC9D,oBAAoB,GAAG;IACrB,UAAU,EAAE,SAAS,CAAC;CACvB,CAAC;AAEJ,MAAM,MAAM,4BAA4B,GAAG,yBAAyB,GAAG;IACrE,UAAU,EAAE,aAAa,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,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,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;AAsBD,wBAAsB,oCAAoC,IAAI,OAAO,CACnE,yBAAyB,GAAG,SAAS,CACtC,CAkBA;AAED,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,GAAG,GACf,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAiCnC"}
@@ -1,224 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getSuperblocksDevEnvironmentConfigJson = getSuperblocksDevEnvironmentConfigJson;
7
- exports.getSuperblocksMonorepoConfigJson = getSuperblocksMonorepoConfigJson;
8
- exports.getSuperblocksApplicationConfigJson = getSuperblocksApplicationConfigJson;
9
- exports.getSuperblocksApplicationConfigIfExists = getSuperblocksApplicationConfigIfExists;
10
- exports.getSuperblocksApplicationV2ConfigJson = getSuperblocksApplicationV2ConfigJson;
11
- exports.getSuperblocksBackendConfigIfExists = getSuperblocksBackendConfigIfExists;
12
- exports.getSuperblocksResourceConfigIfExists = getSuperblocksResourceConfigIfExists;
13
- exports.getResourceIdFromUrl = getResourceIdFromUrl;
14
- const path_1 = __importDefault(require("path"));
15
- const fs_extra_1 = __importDefault(require("fs-extra"));
16
- const constants_js_1 = require("./constants.js");
17
- /**
18
- * Get the Superblocks dev environment config file from the current directory (and optionally) hierarchy
19
- * @param checkParentDir Whether to recursively check the parent directory for a Superblocks dev environment config file
20
- * @param pathPrefix The path prefix to use for the search
21
- * @returns The Superblocks dev environment config and the path to the config file
22
- */
23
- async function getSuperblocksDevEnvironmentConfigJson(checkParentDir = false, pathPrefix = "") {
24
- const absolutePath = path_1.default.resolve(pathPrefix);
25
- let hasReachedFilesystemRoot = false;
26
- try {
27
- hasReachedFilesystemRoot = path_1.default.parse(absolutePath).root == absolutePath;
28
- }
29
- catch {
30
- throw new Error("Could not parse path " + absolutePath);
31
- }
32
- if ((pathPrefix && !fs_extra_1.default.existsSync(absolutePath)) ||
33
- hasReachedFilesystemRoot) {
34
- throw new Error("No Superblocks config file found in current directory hierarchy " +
35
- pathPrefix);
36
- }
37
- const attemptedPath = path_1.default.join(absolutePath, constants_js_1.DEV_ENVIRONMENT_CONFIG_PATH);
38
- try {
39
- const devEnvironmentConfig = await fs_extra_1.default.readJSON(attemptedPath);
40
- if (devEnvironmentConfig.configType !== "DEV_ENVIRONMENT") {
41
- throw new Error("Not the dev environment Superblocks config file");
42
- }
43
- return [
44
- devEnvironmentConfig,
45
- attemptedPath,
46
- ];
47
- }
48
- catch {
49
- if (!checkParentDir) {
50
- // no superblocks config file found
51
- throw new Error("No Superblocks config file found in current directory " +
52
- attemptedPath);
53
- }
54
- return getSuperblocksDevEnvironmentConfigJson(true, "../" + pathPrefix);
55
- }
56
- }
57
- /**
58
- * Get the Superblocks config file from the current directory (and optionally) hierarchy
59
- * @param checkParentDir Whether to recursively check the parent directory for a Superblocks config file
60
- */
61
- async function getSuperblocksMonorepoConfigJson(checkParentDir = false, pathPrefix = "") {
62
- const absolutePath = path_1.default.resolve(pathPrefix);
63
- let hasReachedFilesystemRoot = false;
64
- try {
65
- hasReachedFilesystemRoot = path_1.default.parse(absolutePath).root == absolutePath;
66
- }
67
- catch {
68
- throw new Error("Could not parse path " + absolutePath);
69
- }
70
- let superblocksConfig;
71
- if ((pathPrefix && !fs_extra_1.default.existsSync(absolutePath)) ||
72
- hasReachedFilesystemRoot) {
73
- throw new Error("No Superblocks config file found in current directory hierarchy " +
74
- pathPrefix);
75
- }
76
- const attemptedPath = path_1.default.join(absolutePath, constants_js_1.RESOURCE_CONFIG_PATH);
77
- try {
78
- superblocksConfig = await fs_extra_1.default.readJSON(attemptedPath);
79
- if (superblocksConfig.configType !== "ROOT") {
80
- throw new Error("Not the root Superblocks config file");
81
- }
82
- return [superblocksConfig, attemptedPath];
83
- }
84
- catch {
85
- if (!checkParentDir) {
86
- // no superblocks config file found
87
- throw new Error("No Superblocks config file found in current directory " +
88
- attemptedPath);
89
- }
90
- return getSuperblocksMonorepoConfigJson(true, "../" + pathPrefix);
91
- }
92
- }
93
- async function getSuperblocksApplicationConfigJson(applicationPath) {
94
- let superblocksConfig;
95
- try {
96
- const configPath = applicationPath
97
- ? path_1.default.join(applicationPath, constants_js_1.RESOURCE_CONFIG_PATH)
98
- : constants_js_1.RESOURCE_CONFIG_PATH;
99
- superblocksConfig = await fs_extra_1.default.readJSON(configPath);
100
- }
101
- catch {
102
- // no superblocks config file found
103
- throw new Error("This command must be run within a Superblocks app directory.");
104
- }
105
- if (superblocksConfig.configType !== "APPLICATION") {
106
- throw new Error("Please execute this command within a Superblocks application directory.");
107
- }
108
- return superblocksConfig;
109
- }
110
- async function getSuperblocksApplicationConfigIfExists(applicationPath) {
111
- let superblocksConfig;
112
- try {
113
- const configPath = applicationPath
114
- ? path_1.default.join(applicationPath, constants_js_1.RESOURCE_CONFIG_PATH)
115
- : constants_js_1.RESOURCE_CONFIG_PATH;
116
- superblocksConfig = await fs_extra_1.default.readJSON(configPath);
117
- }
118
- catch {
119
- // no superblocks config file found
120
- }
121
- if (superblocksConfig?.configType !== "APPLICATION") {
122
- return undefined;
123
- }
124
- return superblocksConfig;
125
- }
126
- async function getSuperblocksApplicationV2ConfigJson(applicationPath) {
127
- let superblocksConfig;
128
- try {
129
- const configPath = applicationPath
130
- ? path_1.default.join(applicationPath, constants_js_1.RESOURCE_CONFIG_PATH)
131
- : constants_js_1.RESOURCE_CONFIG_PATH;
132
- superblocksConfig = await fs_extra_1.default.readJSON(configPath);
133
- }
134
- catch {
135
- // no superblocks config file found
136
- throw new Error("This command must be run within a Superblocks app directory.");
137
- }
138
- if (superblocksConfig.configType !== "APPLICATION_V2") {
139
- throw new Error("Please execute this command within a Superblocks application directory.");
140
- }
141
- return superblocksConfig;
142
- }
143
- async function getSuperblocksBackendConfigIfExists(backendPath) {
144
- let superblocksConfig;
145
- try {
146
- const configPath = backendPath
147
- ? path_1.default.join(backendPath, constants_js_1.RESOURCE_CONFIG_PATH)
148
- : constants_js_1.RESOURCE_CONFIG_PATH;
149
- superblocksConfig = await fs_extra_1.default.readJSON(configPath);
150
- }
151
- catch {
152
- // no superblocks config file found
153
- }
154
- if (superblocksConfig?.configType !== "BACKEND") {
155
- return undefined;
156
- }
157
- return superblocksConfig;
158
- }
159
- async function getSuperblocksBackendConfigJson() {
160
- let superblocksConfig;
161
- try {
162
- superblocksConfig = await fs_extra_1.default.readJSON(constants_js_1.RESOURCE_CONFIG_PATH);
163
- }
164
- catch {
165
- // no superblocks config file found
166
- throw new Error("This command must be run within a Superblocks backend resource (workflow/job) directory.");
167
- }
168
- if (superblocksConfig.configType !== "BACKEND") {
169
- throw new Error("Please execute this command within a Superblocks backend resource (workflow/job) directory.");
170
- }
171
- return superblocksConfig;
172
- }
173
- async function getSuperblocksResourceConfigIfExists() {
174
- let config;
175
- try {
176
- config = await getSuperblocksApplicationConfigJson();
177
- }
178
- catch {
179
- // Noop
180
- }
181
- try {
182
- config = await getSuperblocksApplicationV2ConfigJson();
183
- }
184
- catch {
185
- // Noop
186
- }
187
- try {
188
- config = await getSuperblocksBackendConfigJson();
189
- }
190
- catch {
191
- // Noop
192
- }
193
- return config;
194
- }
195
- function getResourceIdFromUrl(resourceUrl) {
196
- const url = new URL(resourceUrl);
197
- if (url.pathname.startsWith("/code-mode")) {
198
- // find the first uuid in the url
199
- const tokens = url.pathname.split("/");
200
- 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}$/));
201
- if (!uuid) {
202
- throw new Error(`Failed to parse resource URL: ${resourceUrl}`);
203
- }
204
- return [uuid, "APPLICATION"];
205
- }
206
- if (url.pathname.startsWith("/applications")) {
207
- const tokens = url.pathname.split("/");
208
- if (tokens.length < 2) {
209
- throw new Error(`Failed to parse resource URL: ${resourceUrl}`);
210
- }
211
- if (tokens[2] === "edit") {
212
- return [tokens[3], "APPLICATION"];
213
- }
214
- else {
215
- return [tokens[2], "APPLICATION"];
216
- }
217
- }
218
- else if (url.pathname.startsWith("/workflows") ||
219
- url.pathname.startsWith("/scheduled_jobs")) {
220
- return [url.pathname.split("/")[2], "BACKEND"];
221
- }
222
- throw new Error(`Failed to parse resource URL: ${resourceUrl}`);
223
- }
224
- //# sourceMappingURL=resource-configs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resource-configs.js","sourceRoot":"","sources":["../src/resource-configs.ts"],"names":[],"mappings":";;;;;AAgGA,wFA2CC;AAMD,4EAyCC;AAED,kFAuBC;AAED,0FAkBC;AAED,sFAuBC;AAED,kFAkBC;AAsBD,oFAoBC;AAED,oDAmCC;AAnWD,gDAAwB;AAExB,wDAA0B;AAE1B,iDAGwB;AAmFxB;;;;;GAKG;AACI,KAAK,UAAU,sCAAsC,CAC1D,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,YAAY,CAAC,CAAC;IAC1D,CAAC;IAED,IACE,CAAC,UAAU,IAAI,CAAC,kBAAE,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QAC5C,wBAAwB,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
- import type { EventEmitter } from "node:events";
2
- export interface TokenUpdateEvent {
3
- token: string;
4
- }
5
- export interface ITokenManager extends EventEmitter {
6
- updateToken(newToken: string): void;
7
- /**
8
- * Returns the most recently set token, or `undefined` if `updateToken`
9
- * has never been called. Consumers that need to seed themselves at
10
- * construction time read this synchronously rather than waiting on the
11
- * next `tokenUpdated` event — the event stream stays as the refresh
12
- * channel and is not replayed for late subscribers.
13
- *
14
- * Closes the cold-start gap where a listener attached after a prior
15
- * emission would observe nothing (Node `EventEmitter` has no replay).
16
- */
17
- getCurrentToken(): string | undefined;
18
- on(event: "tokenUpdated", listener: (event: TokenUpdateEvent) => void): this;
19
- once(event: "tokenUpdated", listener: (event: TokenUpdateEvent) => void): this;
20
- off(event: "tokenUpdated", listener: (event: TokenUpdateEvent) => void): this;
21
- }
22
- //# sourceMappingURL=token-manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"token-manager.d.ts","sourceRoot":"","sources":["../src/token-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC;;;;;;;;;OASG;IACH,eAAe,IAAI,MAAM,GAAG,SAAS,CAAC;IACtC,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,IAAI,CAAC;IAC7E,IAAI,CACF,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAC1C,IAAI,CAAC;IACR,GAAG,CAAC,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,IAAI,CAAC;CAC/E"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=token-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"token-manager.js","sourceRoot":"","sources":["../src/token-manager.ts"],"names":[],"mappings":""}