@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.
Files changed (100) hide show
  1. package/dist/index.js +1 -0
  2. package/{eslint.config.js → eslint.config.mjs} +26 -42
  3. package/lint-staged.config.mjs +6 -0
  4. package/package.json +22 -22
  5. package/src/api-files/api.mts +4 -2
  6. package/src/api-files/index.ts +7 -0
  7. package/src/api-files/types.ts +11 -14
  8. package/src/component-configs.ts +5 -3
  9. package/src/constants.ts +1 -15
  10. package/src/data-types.ts +1 -15
  11. package/src/file-uploader.test.ts +69 -0
  12. package/src/file-uploader.ts +26 -12
  13. package/src/index.ts +1 -0
  14. package/src/login.ts +24 -8
  15. package/src/mask-unix-signals.ts +1 -1
  16. package/src/resource-configs.ts +68 -5
  17. package/src/token-manager.ts +26 -0
  18. package/src/types.ts +5 -4
  19. package/src/validation.ts +4 -4
  20. package/tsconfig.json +3 -2
  21. package/turbo.json +9 -0
  22. package/vitest.config.ts +7 -0
  23. package/.prettierrc +0 -18
  24. package/dist/api-files/api.d.mts +0 -7
  25. package/dist/api-files/api.d.mts.map +0 -1
  26. package/dist/api-files/api.mjs +0 -262
  27. package/dist/api-files/api.mjs.map +0 -1
  28. package/dist/api-files/constants.d.ts +0 -6
  29. package/dist/api-files/constants.d.ts.map +0 -1
  30. package/dist/api-files/constants.js +0 -9
  31. package/dist/api-files/constants.js.map +0 -1
  32. package/dist/api-files/index.d.ts +0 -7
  33. package/dist/api-files/index.d.ts.map +0 -1
  34. package/dist/api-files/index.js +0 -13
  35. package/dist/api-files/index.js.map +0 -1
  36. package/dist/api-files/types.d.ts +0 -117
  37. package/dist/api-files/types.d.ts.map +0 -1
  38. package/dist/api-files/types.js +0 -17
  39. package/dist/api-files/types.js.map +0 -1
  40. package/dist/component-configs.d.ts +0 -6
  41. package/dist/component-configs.d.ts.map +0 -1
  42. package/dist/component-configs.js +0 -178
  43. package/dist/component-configs.js.map +0 -1
  44. package/dist/constants.d.ts +0 -18
  45. package/dist/constants.d.ts.map +0 -1
  46. package/dist/constants.js +0 -50
  47. package/dist/constants.js.map +0 -1
  48. package/dist/data-types.d.ts +0 -10
  49. package/dist/data-types.d.ts.map +0 -1
  50. package/dist/data-types.js +0 -32
  51. package/dist/data-types.js.map +0 -1
  52. package/dist/events.d.ts +0 -13
  53. package/dist/events.d.ts.map +0 -1
  54. package/dist/events.js +0 -17
  55. package/dist/events.js.map +0 -1
  56. package/dist/file-uploader.d.ts +0 -3
  57. package/dist/file-uploader.d.ts.map +0 -1
  58. package/dist/file-uploader.js +0 -28
  59. package/dist/file-uploader.js.map +0 -1
  60. package/dist/generate-component-types.d.ts +0 -3
  61. package/dist/generate-component-types.d.ts.map +0 -1
  62. package/dist/generate-component-types.js +0 -45
  63. package/dist/generate-component-types.js.map +0 -1
  64. package/dist/identifiers.d.ts +0 -9
  65. package/dist/identifiers.d.ts.map +0 -1
  66. package/dist/identifiers.js +0 -68
  67. package/dist/identifiers.js.map +0 -1
  68. package/dist/index.d.ts +0 -16
  69. package/dist/index.d.ts.map +0 -1
  70. package/dist/index.js.map +0 -1
  71. package/dist/localGitRepoState.d.ts +0 -20
  72. package/dist/localGitRepoState.d.ts.map +0 -1
  73. package/dist/localGitRepoState.js +0 -3
  74. package/dist/localGitRepoState.js.map +0 -1
  75. package/dist/login.d.ts +0 -11
  76. package/dist/login.d.ts.map +0 -1
  77. package/dist/login.js +0 -93
  78. package/dist/login.js.map +0 -1
  79. package/dist/mask-unix-signals.d.ts +0 -27
  80. package/dist/mask-unix-signals.d.ts.map +0 -1
  81. package/dist/mask-unix-signals.js +0 -81
  82. package/dist/mask-unix-signals.js.map +0 -1
  83. package/dist/resource-configs.d.ts +0 -61
  84. package/dist/resource-configs.d.ts.map +0 -1
  85. package/dist/resource-configs.js +0 -217
  86. package/dist/resource-configs.js.map +0 -1
  87. package/dist/types.d.ts +0 -105
  88. package/dist/types.d.ts.map +0 -1
  89. package/dist/types.js +0 -3
  90. package/dist/types.js.map +0 -1
  91. package/dist/unreachable.d.ts +0 -2
  92. package/dist/unreachable.d.ts.map +0 -1
  93. package/dist/unreachable.js +0 -7
  94. package/dist/unreachable.js.map +0 -1
  95. package/dist/validation.d.ts +0 -5
  96. package/dist/validation.d.ts.map +0 -1
  97. package/dist/validation.js +0 -152
  98. package/dist/validation.js.map +0 -1
  99. package/tsconfig.tsbuildinfo +0 -1
  100. package/tsup.config.ts +0 -8
@@ -1,117 +0,0 @@
1
- export type AdditionalStepFiles = {
2
- relativePath: string;
3
- contents: string;
4
- language: keyof Step;
5
- };
6
- export type ApiRepresentation = {
7
- extractLargeSourceFiles: boolean;
8
- minLinesForExtraction: number;
9
- };
10
- export interface ApiWrapper {
11
- apiPb: Api;
12
- name?: string;
13
- }
14
- /** A signature, as produced by the agent. */
15
- export interface Signature {
16
- /** The id of the key used to sign the data. */
17
- keyId: string;
18
- /** The actual signature, in base64. */
19
- data: string;
20
- }
21
- export type Api = {
22
- metadata: {
23
- id: string;
24
- name: string;
25
- organization: string;
26
- timestamps?: {
27
- created: string;
28
- updated: string;
29
- deactivated: boolean;
30
- };
31
- creator?: {
32
- id: string;
33
- name: string;
34
- };
35
- folder?: string;
36
- };
37
- blocks?: Block[];
38
- trigger: any;
39
- signature?: Signature;
40
- };
41
- export type Block = {
42
- name: string;
43
- step?: Step;
44
- loop?: Loop;
45
- tryCatch?: TryCatch;
46
- conditional?: Conditional;
47
- parallel?: Parallel;
48
- stream?: Stream;
49
- };
50
- export type Step = {
51
- integration: string;
52
- javascript?: LanguageContent;
53
- python?: LanguageContent;
54
- };
55
- export type Loop = {
56
- blocks: Block[];
57
- range: string;
58
- type: LoopType;
59
- variables?: Variables;
60
- };
61
- export declare enum LoopType {
62
- FOR = "TYPE_FOR",
63
- FOR_EACH = "TYPE_FOREACH",
64
- WHILE = "TYPE_WHILE",
65
- UNSPECIFIED = "TYPE_UNSPECIFIED"
66
- }
67
- export type TryCatch = {
68
- try?: Blocks;
69
- catch?: Blocks;
70
- finally?: Blocks;
71
- variables?: Variables;
72
- };
73
- export type Conditional = {
74
- if?: ConditionalBlockWithCondition;
75
- elseIf: ConditionalBlockWithCondition[];
76
- else?: Blocks;
77
- };
78
- export type Blocks = {
79
- blocks: Block[];
80
- };
81
- export type ConditionalBlockWithCondition = Blocks & {
82
- condition?: string;
83
- };
84
- export type Parallel = {
85
- static?: {
86
- paths: Record<string, Blocks>;
87
- };
88
- dynamic?: {
89
- blocks: Block[];
90
- variables?: Variables;
91
- paths?: string;
92
- };
93
- poolSize?: number;
94
- wait?: WAIT_TYPE;
95
- };
96
- export type Stream = {
97
- trigger?: StreamTrigger;
98
- process?: Blocks;
99
- variables?: Variables;
100
- };
101
- export type StreamTrigger = {
102
- name: string;
103
- step?: Step;
104
- };
105
- export declare enum WAIT_TYPE {
106
- ALL = "WAIT_ALL",
107
- ANY = "WAIT_NONE",
108
- UNSPECIFIED = "WAIT_UNSPECIFIED"
109
- }
110
- export type Variables = Record<string, string>;
111
- export type LanguageContent = {
112
- body: Body;
113
- };
114
- export type Body = string | {
115
- path: string;
116
- };
117
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api-files/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,uBAAuB,EAAE,OAAO,CAAC;IACjC,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,GAAG,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,6CAA6C;AAC7C,MAAM,WAAW,SAAS;IACxB,+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nB,GAAG,aAAa;IAChB,GAAG,cAAc;IACjB,WAAW,qBAAqB;CACjC;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/C,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.WAIT_TYPE = exports.LoopType = void 0;
4
- var LoopType;
5
- (function (LoopType) {
6
- LoopType["FOR"] = "TYPE_FOR";
7
- LoopType["FOR_EACH"] = "TYPE_FOREACH";
8
- LoopType["WHILE"] = "TYPE_WHILE";
9
- LoopType["UNSPECIFIED"] = "TYPE_UNSPECIFIED";
10
- })(LoopType || (exports.LoopType = LoopType = {}));
11
- var WAIT_TYPE;
12
- (function (WAIT_TYPE) {
13
- WAIT_TYPE["ALL"] = "WAIT_ALL";
14
- WAIT_TYPE["ANY"] = "WAIT_NONE";
15
- WAIT_TYPE["UNSPECIFIED"] = "WAIT_UNSPECIFIED";
16
- })(WAIT_TYPE || (exports.WAIT_TYPE = WAIT_TYPE = {}));
17
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/api-files/types.ts"],"names":[],"mappings":";;;AAqEA,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,4BAAgB,CAAA;IAChB,qCAAyB,CAAA;IACzB,gCAAoB,CAAA;IACpB,4CAAgC,CAAA;AAClC,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB;AA+CD,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,6BAAgB,CAAA;IAChB,8BAAiB,CAAA;IACjB,6CAAgC,CAAA;AAClC,CAAC,EAJW,SAAS,yBAAT,SAAS,QAIpB"}
@@ -1,6 +0,0 @@
1
- export declare function getComponentConfigs(generateTypesFiles: boolean): Promise<{
2
- configs: Record<string, any>;
3
- hasError: boolean;
4
- }>;
5
- export declare const getContentType: (filename: string) => string;
6
- //# sourceMappingURL=component-configs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component-configs.d.ts","sourceRoot":"","sources":["../src/component-configs.ts"],"names":[],"mappings":"AA+EA,wBAAsB,mBAAmB,CACvC,kBAAkB,EAAE,OAAO,GAC1B,OAAO,CAAC;IACT,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC,CAoED;AAED,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,KAAG,MAMjD,CAAC"}
@@ -1,178 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getContentType = void 0;
40
- exports.getComponentConfigs = getComponentConfigs;
41
- const node_child_process_1 = require("node:child_process");
42
- const node_os_1 = __importDefault(require("node:os"));
43
- const node_path_1 = __importDefault(require("node:path"));
44
- const util = __importStar(require("node:util"));
45
- const fs = __importStar(require("fs-extra"));
46
- const mimeTypes = __importStar(require("mime-types"));
47
- const constants_js_1 = require("./constants.js");
48
- const generate_component_types_js_1 = require("./generate-component-types.js");
49
- const validation_js_1 = require("./validation.js");
50
- const asyncExecFile = util.promisify(node_child_process_1.execFile);
51
- async function compileTypeScript(inputFilePath, outputDir) {
52
- try {
53
- const tscPath = require.resolve("typescript/bin/tsc");
54
- if (tscPath) {
55
- const result = await asyncExecFile("node", [
56
- tscPath,
57
- node_path_1.default.resolve(inputFilePath),
58
- "--outDir",
59
- outputDir,
60
- "--jsx",
61
- "react-jsx",
62
- "--target",
63
- "es2019",
64
- "--esModuleInterop",
65
- "true",
66
- "--moduleResolution",
67
- "node",
68
- "--module",
69
- "commonjs",
70
- "--strict",
71
- "true",
72
- "--skipLibCheck",
73
- "true",
74
- ]);
75
- if (result.stdout || result.stderr) {
76
- return {
77
- output: result.stdout || result.stderr,
78
- };
79
- }
80
- }
81
- }
82
- catch (error) {
83
- return {
84
- output: error.stdout || error.stderr,
85
- };
86
- }
87
- return {};
88
- }
89
- async function getFolderPaths() {
90
- try {
91
- const folderPaths = await fs.readdir(constants_js_1.CUSTOM_COMPONENTS_PATH, {
92
- withFileTypes: true,
93
- });
94
- // filter out any non-directory items
95
- const directories = folderPaths.filter((dirent) => dirent.isDirectory() ||
96
- (dirent.isSymbolicLink() &&
97
- fs
98
- .statSync(node_path_1.default.join(constants_js_1.CUSTOM_COMPONENTS_PATH, dirent.name))
99
- .isDirectory()));
100
- // map each directory to its path
101
- const folderPathsArray = directories.map((dirent) => node_path_1.default.join(constants_js_1.CUSTOM_COMPONENTS_PATH, dirent.name));
102
- return folderPathsArray;
103
- }
104
- catch {
105
- throw new Error("Could not access component directory, check your permissions");
106
- }
107
- }
108
- async function getComponentConfigs(generateTypesFiles) {
109
- const folderPaths = await getFolderPaths();
110
- let hasError = false;
111
- const promiseConfigFiles = folderPaths.map(async (ccpath) => {
112
- const absPath = node_path_1.default.resolve(ccpath);
113
- try {
114
- const config = await fs.readJSON(`${absPath}/config.json`);
115
- console.log(`Found component in ${absPath}`);
116
- return { ccpath, config };
117
- }
118
- catch {
119
- // Noop because there is a fallback
120
- }
121
- // This is a tad complex to explain this hack but here's the context:
122
- // We want to be able to hot reload the config.ts file, but we can't import it directly
123
- // because it is going to get cached in the module cache and we dont have access to it to clear it
124
- // so instead we copy the file to a new location with a random name and import that
125
- // this is technically a memory leak, but you shouldnt really have a hot module server running forever
126
- const rawPath = `${ccpath}/config.ts`;
127
- const fileName = node_path_1.default.resolve(rawPath);
128
- const outputDirectory = node_path_1.default.resolve(`${node_os_1.default.tmpdir()}/superblocks/${ccpath}/config.timestamp-${Date.now()}-${Math.random()
129
- .toString(16)
130
- .slice(2)}`);
131
- await fs.ensureDir(outputDirectory);
132
- const compilationResult = await compileTypeScript(fileName, outputDirectory);
133
- if (compilationResult.output) {
134
- hasError = true;
135
- if (compilationResult.output.includes(`Cannot find module`)) {
136
- throw new Error("Could not find a module in node_modules. You likely need to run 'npm install'");
137
- }
138
- throw new Error(compilationResult.output);
139
- }
140
- console.log(`Typescript compiled to ${ccpath}`);
141
- const config = (await import(outputDirectory + "/config.js")).default;
142
- const isValid = (0, validation_js_1.validateCustomComponents)(config);
143
- if (!isValid.valid) {
144
- // Not throwing because we don't need a stack trace here
145
- console.log(`Invalid config.ts file found`);
146
- console.log(isValid.message);
147
- hasError = true;
148
- }
149
- return { ccpath, config };
150
- });
151
- const configFiles = await Promise.all(promiseConfigFiles);
152
- if (generateTypesFiles) {
153
- for (const { config, ccpath } of configFiles) {
154
- const typesFileContents = (0, generate_component_types_js_1.generateComponentTypesFile)(config);
155
- await fs.writeFile(`${ccpath}/types.ts`, typesFileContents);
156
- console.log(`Generated ${ccpath}/types.ts`);
157
- }
158
- }
159
- const configs = configFiles
160
- .filter((component) => component.config !== null)
161
- .reduce((acc, { config }) => {
162
- acc[config.id] = config;
163
- return acc;
164
- }, {});
165
- return {
166
- configs,
167
- hasError,
168
- };
169
- }
170
- const getContentType = (filename) => {
171
- const mimeType = mimeTypes.lookup(filename);
172
- if (!mimeType) {
173
- return "";
174
- }
175
- return mimeType;
176
- };
177
- exports.getContentType = getContentType;
178
- //# sourceMappingURL=component-configs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"component-configs.js","sourceRoot":"","sources":["../src/component-configs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,kDAyEC;AAxJD,2DAA8C;AAC9C,sDAAyB;AACzB,0DAA6B;AAC7B,gDAAkC;AAClC,6CAA+B;AAC/B,sDAAwC;AACxC,iDAAwD;AACxD,+EAA2E;AAC3E,mDAA2D;AAE3D,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,6BAAQ,CAAC,CAAC;AAE/C,KAAK,UAAU,iBAAiB,CAC9B,aAAqB,EACrB,SAAiB;IAEjB,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACtD,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE;gBACzC,OAAO;gBACP,mBAAI,CAAC,OAAO,CAAC,aAAa,CAAC;gBAC3B,UAAU;gBACV,SAAS;gBACT,OAAO;gBACP,WAAW;gBACX,UAAU;gBACV,QAAQ;gBACR,mBAAmB;gBACnB,MAAM;gBACN,o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,EAAE;QAC/C,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC;QACxB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,OAAO;QACL,OAAO;QACP,QAAQ;KACT,CAAC;AACJ,CAAC;AAEM,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAU,EAAE;IACzD,MAAM,QAAQ,GAAG,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC5C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,QAAkB,CAAC;AAC5B,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB"}
@@ -1,18 +0,0 @@
1
- export declare const SUPERBLOCKS_HOME_FOLDER_NAME = ".superblocks";
2
- export declare const TOKEN_CONFIG_PATH = ".superblocks/auth.json";
3
- export declare const RESOURCE_CONFIG_PATH = ".superblocks/superblocks.json";
4
- export declare const ROOT_CONFIG_RELATIVE_PATH = "../..";
5
- export declare const CUSTOM_COMPONENTS_PATH = "components";
6
- export declare class FileAccessError extends Error {
7
- constructor(message: string);
8
- }
9
- export declare class NotFoundError extends Error {
10
- constructor(message: string);
11
- }
12
- export declare class BadRequestError extends Error {
13
- constructor(message: string);
14
- }
15
- export declare class ForbiddenError extends Error {
16
- constructor(message: string);
17
- }
18
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,iBAAiB,CAAC;AAC3D,eAAO,MAAM,iBAAiB,2BAA2B,CAAC;AAC1D,eAAO,MAAM,oBAAoB,kCAAkC,CAAC;AAepE,eAAO,MAAM,yBAAyB,UAAU,CAAC;AAEjD,eAAO,MAAM,sBAAsB,eAAe,CAAC;AAEnD,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,cAAe,SAAQ,KAAK;gBAC3B,OAAO,EAAE,MAAM;CAI5B"}
package/dist/constants.js DELETED
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ForbiddenError = exports.BadRequestError = exports.NotFoundError = exports.FileAccessError = exports.CUSTOM_COMPONENTS_PATH = exports.ROOT_CONFIG_RELATIVE_PATH = exports.RESOURCE_CONFIG_PATH = exports.TOKEN_CONFIG_PATH = exports.SUPERBLOCKS_HOME_FOLDER_NAME = void 0;
4
- exports.SUPERBLOCKS_HOME_FOLDER_NAME = ".superblocks";
5
- exports.TOKEN_CONFIG_PATH = ".superblocks/auth.json";
6
- exports.RESOURCE_CONFIG_PATH = ".superblocks/superblocks.json";
7
- /* It's a relative path from resource's directory to a project's root
8
- ├── apps
9
- │ ├── <app_name>
10
- │ │ ├── apis
11
- │ │ │ ├── <api_name1>
12
- ...
13
- │ │ │ ├── <api_nameN>
14
- │ │ ├── application.yaml
15
- │ │ └── page.yaml
16
- ├── backends
17
- │ └── <scheduled job|workflow_name>
18
- │ └── api.yaml
19
- */
20
- exports.ROOT_CONFIG_RELATIVE_PATH = "../..";
21
- exports.CUSTOM_COMPONENTS_PATH = "components";
22
- class FileAccessError extends Error {
23
- constructor(message) {
24
- super(message);
25
- this.name = "FileAccessError";
26
- }
27
- }
28
- exports.FileAccessError = FileAccessError;
29
- class NotFoundError extends Error {
30
- constructor(message) {
31
- super(message);
32
- this.name = "FileNotFoundError";
33
- }
34
- }
35
- exports.NotFoundError = NotFoundError;
36
- class BadRequestError extends Error {
37
- constructor(message) {
38
- super(message);
39
- this.name = "BadRequestError";
40
- }
41
- }
42
- exports.BadRequestError = BadRequestError;
43
- class ForbiddenError extends Error {
44
- constructor(message) {
45
- super(message);
46
- this.name = "ForbiddenError";
47
- }
48
- }
49
- exports.ForbiddenError = ForbiddenError;
50
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,4BAA4B,GAAG,cAAc,CAAC;AAC9C,QAAA,iBAAiB,GAAG,wBAAwB,CAAC;AAC7C,QAAA,oBAAoB,GAAG,+BAA+B,CAAC;AAEpE;;;;;;;;;;;;EAYE;AACW,QAAA,yBAAyB,GAAG,OAAO,CAAC;AAEpC,QAAA,sBAAsB,GAAG,YAAY,CAAC;AAEnD,MAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AALD,0CAKC;AAED,MAAa,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AALD,sCAKC;AAED,MAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AALD,0CAKC;AAED,MAAa,cAAe,SAAQ,KAAK;IACvC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IAC/B,CAAC;CACF;AALD,wCAKC"}
@@ -1,10 +0,0 @@
1
- export declare const supportedDataTypes: readonly ["string", "number", "boolean", "any"];
2
- export type DataType = (typeof supportedDataTypes)[number];
3
- interface TypeInfo {
4
- tsType: string;
5
- prompt: string;
6
- }
7
- export declare const dataTypeDefinions: Record<DataType, TypeInfo>;
8
- export declare function isValidDataType(input: string): input is DataType;
9
- export {};
10
- //# sourceMappingURL=data-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-types.d.ts","sourceRoot":"","sources":["../src/data-types.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,iDAKrB,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,UAAU,QAAQ;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAiBxD,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,QAAQ,CAKhE"}
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dataTypeDefinions = exports.supportedDataTypes = void 0;
4
- exports.isValidDataType = isValidDataType;
5
- exports.supportedDataTypes = [
6
- "string",
7
- "number",
8
- "boolean",
9
- "any",
10
- ];
11
- exports.dataTypeDefinions = {
12
- string: {
13
- tsType: "string",
14
- prompt: "string",
15
- },
16
- number: {
17
- tsType: "number",
18
- prompt: "number",
19
- },
20
- boolean: {
21
- tsType: "boolean",
22
- prompt: "boolean",
23
- },
24
- any: {
25
- tsType: "any",
26
- prompt: "any (raw js expression)",
27
- },
28
- };
29
- function isValidDataType(input) {
30
- return Object.prototype.hasOwnProperty.call(exports.dataTypeDefinions, input);
31
- }
32
- //# sourceMappingURL=data-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"data-types.js","sourceRoot":"","sources":["../src/data-types.ts"],"names":[],"mappings":";;;AAiCA,0CAKC;AAtCY,QAAA,kBAAkB,GAAG;IAChC,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,KAAK;CACG,CAAC;AASE,QAAA,iBAAiB,GAA+B;IAC3D,MAAM,EAAE;QACN,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,QAAQ;KACjB;IACD,MAAM,EAAE;QACN,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE,QAAQ;KACjB;IACD,OAAO,EAAE;QACP,MAAM,EAAE,SAAS;QACjB,MAAM,EAAE,SAAS;KAClB;IACD,GAAG,EAAE;QACH,MAAM,EAAE,KAAK;QACb,MAAM,EAAE,yBAAyB;KAClC;CACF,CAAC;AAEF,SAAgB,eAAe,CAAC,KAAa;IAC3C,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CACzC,yBAAiB,EACjB,KAAiB,CAClB,CAAC;AACJ,CAAC"}
package/dist/events.d.ts DELETED
@@ -1,13 +0,0 @@
1
- export declare enum ComponentEvent {
2
- CREATE = "create",
3
- INIT = "init",
4
- LOGIN = "login",
5
- MIGRATE = "migrate",
6
- PULL = "pull",
7
- COMMITS = "commits",
8
- PUSH = "push",
9
- REGISTER = "register",
10
- UPLOAD = "upload",
11
- DEPLOY = "deploy"
12
- }
13
- //# sourceMappingURL=events.d.ts.map
@@ -1 +0,0 @@
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 DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ComponentEvent = void 0;
4
- var ComponentEvent;
5
- (function (ComponentEvent) {
6
- ComponentEvent["CREATE"] = "create";
7
- ComponentEvent["INIT"] = "init";
8
- ComponentEvent["LOGIN"] = "login";
9
- ComponentEvent["MIGRATE"] = "migrate";
10
- ComponentEvent["PULL"] = "pull";
11
- ComponentEvent["COMMITS"] = "commits";
12
- ComponentEvent["PUSH"] = "push";
13
- ComponentEvent["REGISTER"] = "register";
14
- ComponentEvent["UPLOAD"] = "upload";
15
- ComponentEvent["DEPLOY"] = "deploy";
16
- })(ComponentEvent || (exports.ComponentEvent = ComponentEvent = {}));
17
- //# sourceMappingURL=events.js.map
@@ -1 +0,0 @@
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"}
@@ -1,3 +0,0 @@
1
- export declare const COMPONENT_EVENT_HEADER = "x-superblocks-component-event";
2
- export declare const getBucketeerUrlFromSuperblocksUrl: (superblocksBaseUrl: string) => string;
3
- //# sourceMappingURL=file-uploader.d.ts.map
@@ -1 +0,0 @@
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"}
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBucketeerUrlFromSuperblocksUrl = exports.COMPONENT_EVENT_HEADER = void 0;
4
- const lodash_1 = require("lodash");
5
- exports.COMPONENT_EVENT_HEADER = "x-superblocks-component-event";
6
- // retrieves bucketeer base URL given the superblocks server base URL
7
- const getBucketeerUrlFromSuperblocksUrl = (superblocksBaseUrl) => {
8
- // if superblocks base URL is an EE, return bucketeer's dev URL
9
- if (!(0, lodash_1.isEmpty)(superblocksBaseUrl.match(new RegExp("pr-.*.superblocks.dev")))) {
10
- return "https://bucketeer.dev.superblocks.com";
11
- }
12
- switch (superblocksBaseUrl) {
13
- case "https://eu.superblocks.com":
14
- return "https://bucketeer.eu.superblocks.com";
15
- case "https://staging.superblocks.com":
16
- return "https://bucketeer.staging.superblocks.com";
17
- case "https://app.superblocks.com":
18
- case "https://app.superblockshq.com":
19
- return "https://bucketeer.superblocks.com";
20
- case "https://dev.superblocks.com":
21
- return "https://bucketeer.dev.superblocks.com";
22
- case "http://localhost:3000":
23
- default:
24
- return "http://localhost:8030";
25
- }
26
- };
27
- exports.getBucketeerUrlFromSuperblocksUrl = getBucketeerUrlFromSuperblocksUrl;
28
- //# sourceMappingURL=file-uploader.js.map
@@ -1 +0,0 @@
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"}
@@ -1,3 +0,0 @@
1
- import type { ComponentConfig } from "./types.js";
2
- export declare function generateComponentTypesFile(config: ComponentConfig): string;
3
- //# sourceMappingURL=generate-component-types.d.ts.map
@@ -1 +0,0 @@
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,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateComponentTypesFile = generateComponentTypesFile;
4
- const data_types_js_1 = require("./data-types.js");
5
- const indent = (str, spaces) => {
6
- const spacesString = " ".repeat(spaces);
7
- return str
8
- .split("\n")
9
- .map((line) => `${spacesString}${line}`)
10
- .join("\n");
11
- };
12
- function renderInputTypeAsTS(name, type, trailingChars, indentSpaces) {
13
- let { tsType } = data_types_js_1.dataTypeDefinions[type];
14
- if (["number", "string"].includes(type)) {
15
- tsType += " | null";
16
- }
17
- return indent(`${name}: ${tsType}${trailingChars}`, indentSpaces);
18
- }
19
- function generateComponentTypesFile(config) {
20
- const properties = config.properties ?? [];
21
- const eventHandlers = config.events ?? [];
22
- return `// GENERATED CODE -- DO NOT EDIT!
23
- //
24
- // This file is automatically generated by the Superblocks CLI
25
- // Use the \`superblocks components watch\` command to regenerate this file from its source in config.ts
26
-
27
- // All properties of your component are defined here.
28
- // These are the properties which are surfaced in the Superblocks properties panel
29
- // and can be referenced throughout your Superblocks Application
30
- export type Props = {
31
- ${properties
32
- .map((v) => renderInputTypeAsTS(v.path, v.dataType, ";", 2) + "\n")
33
- .join("")}};
34
-
35
- export type EventTriggers = {
36
- // Call the subsequent function(s) to trigger event(s) in Superblocks from your component.
37
- // These events can be wired up to event handlers in your Superblocks App
38
- ${eventHandlers.length === 0
39
- ? " // Note: no event handlers defined\n"
40
- : eventHandlers
41
- .map((v) => indent(v.path, 2) + ": () => void;" + "\n")
42
- .join("")}};
43
- `;
44
- }
45
- //# sourceMappingURL=generate-component-types.js.map
@@ -1 +0,0 @@
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"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Suggest an identifier based on a label, e.g. `My Component` -> `myComponent`.
3
- * @param label The label to suggest an identifier for.
4
- * @param capitalizeFirst Whether to capitalize the first letter of the identifier.
5
- */
6
- export declare function suggestIdentifier(label: string, capitalizeFirst?: boolean): string;
7
- export declare function isValidIdentifier(str: string): boolean;
8
- export declare function isReservedPropertyName(str: string): boolean;
9
- //# sourceMappingURL=identifiers.d.ts.map
@@ -1 +0,0 @@
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"}