@superblocksteam/cli 0.0.11

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 (42) hide show
  1. package/README.md +175 -0
  2. package/assets/custom-components/.eslintrc.js +26 -0
  3. package/assets/custom-components/package.json +26 -0
  4. package/assets/custom-components/tsconfig.json +13 -0
  5. package/bin/dev +8 -0
  6. package/bin/dev.cmd +3 -0
  7. package/bin/run +8 -0
  8. package/bin/run.cmd +3 -0
  9. package/dist/commands/components/create.d.ts +5 -0
  10. package/dist/commands/components/create.js +146 -0
  11. package/dist/commands/components/register.d.ts +6 -0
  12. package/dist/commands/components/register.js +38 -0
  13. package/dist/commands/components/upload.d.ts +6 -0
  14. package/dist/commands/components/upload.js +151 -0
  15. package/dist/commands/components/watch.d.ts +7 -0
  16. package/dist/commands/components/watch.js +101 -0
  17. package/dist/commands/init.d.ts +15 -0
  18. package/dist/commands/init.js +238 -0
  19. package/dist/commands/login.d.ts +9 -0
  20. package/dist/commands/login.js +66 -0
  21. package/dist/commands/pull.d.ts +14 -0
  22. package/dist/commands/pull.js +167 -0
  23. package/dist/common/authenticated-command.d.ts +14 -0
  24. package/dist/common/authenticated-command.js +58 -0
  25. package/dist/common/defaults/create-component-defaults.d.ts +9 -0
  26. package/dist/common/defaults/create-component-defaults.js +60 -0
  27. package/dist/common/types.d.ts +7 -0
  28. package/dist/common/types.js +2 -0
  29. package/dist/common/version-control.d.ts +21 -0
  30. package/dist/common/version-control.js +166 -0
  31. package/dist/exportedTypes.d.ts +20 -0
  32. package/dist/exportedTypes.js +2 -0
  33. package/dist/index.d.ts +2 -0
  34. package/dist/index.js +7 -0
  35. package/dist/util/identifiers.d.ts +7 -0
  36. package/dist/util/identifiers.js +37 -0
  37. package/dist/util/prompt.d.ts +7 -0
  38. package/dist/util/prompt.js +33 -0
  39. package/dist/util/types.d.ts +9 -0
  40. package/dist/util/types.js +26 -0
  41. package/oclif.manifest.json +151 -0
  42. package/package.json +97 -0
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthenticatedApplicationCommand = exports.AuthenticatedCommand = void 0;
4
+ const core_1 = require("@oclif/core");
5
+ const sdk_1 = require("@superblocksteam/sdk");
6
+ const util_1 = require("@superblocksteam/util");
7
+ class AuthenticatedCommand extends core_1.Command {
8
+ async init() {
9
+ await super.init();
10
+ try {
11
+ const { token, superblocksBaseUrl } = await (0, util_1.getLocalTokenWithUrl)();
12
+ this.sdk = new sdk_1.SuperblocksSdk(token, superblocksBaseUrl);
13
+ }
14
+ catch {
15
+ this.error("Please run 'superblocks login' first", { exit: 1 });
16
+ }
17
+ }
18
+ async getBaseUrl() {
19
+ var _a;
20
+ const authConfig = await (0, util_1.getLocalTokenWithUrlIfExists)();
21
+ return (_a = authConfig === null || authConfig === void 0 ? void 0 : authConfig.superblocksBaseUrl) !== null && _a !== void 0 ? _a : "";
22
+ }
23
+ getSdk() {
24
+ if (!this.sdk) {
25
+ throw new Error("SDK not initialized");
26
+ }
27
+ return this.sdk;
28
+ }
29
+ }
30
+ exports.AuthenticatedCommand = AuthenticatedCommand;
31
+ class AuthenticatedApplicationCommand extends AuthenticatedCommand {
32
+ constructor() {
33
+ super(...arguments);
34
+ this.applicationConfig = {
35
+ configType: "APPLICATION",
36
+ id: "",
37
+ defaultPageId: "",
38
+ apis: {},
39
+ };
40
+ }
41
+ async getEditModeUrl() {
42
+ const authConfig = await (0, util_1.getLocalTokenWithUrlIfExists)();
43
+ const baseUrl = authConfig === null || authConfig === void 0 ? void 0 : authConfig.superblocksBaseUrl;
44
+ return new URL(`/applications/${this.applicationConfig.id}/pages/${this.applicationConfig.defaultPageId}/edit`, baseUrl).toString();
45
+ }
46
+ async init() {
47
+ await super.init();
48
+ try {
49
+ this.applicationConfig = await (0, util_1.getSuperblocksApplicationConfigJson)();
50
+ }
51
+ catch (error) {
52
+ this.error(error.message, {
53
+ exit: 1,
54
+ });
55
+ }
56
+ }
57
+ }
58
+ exports.AuthenticatedApplicationCommand = AuthenticatedApplicationCommand;
@@ -0,0 +1,9 @@
1
+ import { StatefulProperty } from "../types";
2
+ export declare const getDefaultConfigTs: ({ id, name, displayName, statefulPropsRendered, eventHandlersRendered, }: {
3
+ id: string;
4
+ name: string;
5
+ displayName: string;
6
+ statefulPropsRendered: string;
7
+ eventHandlersRendered: string;
8
+ }) => string;
9
+ export declare const getDefaultComponentTsx: (statefulProps: StatefulProperty[], eventHandlers: string[]) => string;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDefaultComponentTsx = exports.getDefaultConfigTs = void 0;
4
+ const types_1 = require("../../util/types");
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
+ return indent(`${name}: ${types_1.inputTypeDefinions[type].tsType}${trailingChars}`, indentSpaces);
14
+ }
15
+ const getDefaultConfigTs = ({ id, name, displayName, statefulPropsRendered, eventHandlersRendered, }) => `import { type ComponentConfig } from "@superblocksteam/cli";
16
+
17
+ export default {
18
+ // DO NOT CHANGE THE ID ONCE THE COMPONENT HAS BEEN REGISTERED!
19
+ id: "${id}",
20
+ name: "${name}",
21
+ displayName: "${displayName}",
22
+ componentPath: "components/${name}/component.tsx",
23
+ statefulProperties: [${indent(statefulPropsRendered, 4).trim()}],
24
+ eventHandlers: [${indent(eventHandlersRendered, 4).trim()}],
25
+ } satisfies ComponentConfig;
26
+ `;
27
+ exports.getDefaultConfigTs = getDefaultConfigTs;
28
+ const getDefaultComponentTsx = (statefulProps, eventHandlers) => `import React from "react";
29
+
30
+ // All stateful properties of your component are defined here.
31
+ // These are the properties which are surfaced in the Superblocks properties panel
32
+ // and can be referenced throughout your Superblocks Application
33
+ interface StatefulProperties {
34
+ ${statefulProps
35
+ .map((v) => renderInputTypeAsTS(v.path, v.inputType, ";", 2) + "\n")
36
+ .join("")}}
37
+
38
+ interface Props extends StatefulProperties {
39
+ // Call updateStatefulProperties to update one (or more) of your component's stateful properties.
40
+ // This will cause the component to rerender, and will also notify any other components
41
+ // in your Application which depend on the updated properties, so they also rerender
42
+ updateStatefulProperties: (props: Partial<StatefulProperties>) => void;
43
+
44
+ // Call the subsequent function(s) to trigger event(s) in Superblocks from your component.
45
+ // These events can be wired up to event handlers in your Superblocks App
46
+ ${eventHandlers.length === 0
47
+ ? " // Note: no event handlers defined\n"
48
+ : eventHandlers.map((v) => indent(v, 2) + ": () => void;" + "\n").join("")}}
49
+
50
+ export default function Component({
51
+ updateStatefulProperties${statefulProps.length > 0
52
+ ? ",\n" + statefulProps.map((v) => indent(v.path, 2)).join(",\n")
53
+ : ""}${eventHandlers.length > 0
54
+ ? ",\n" + eventHandlers.map((v) => indent(v, 2)).join(",\n")
55
+ : ""}
56
+ }: Props) {
57
+ return <div>Hello World!</div>;
58
+ }
59
+ `;
60
+ exports.getDefaultComponentTsx = getDefaultComponentTsx;
@@ -0,0 +1,7 @@
1
+ import { type InputType } from "../util/types";
2
+ export interface StatefulProperty {
3
+ label: string;
4
+ path: string;
5
+ inputType: InputType;
6
+ placeholder?: string;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ import { ViewMode } from "@superblocksteam/sdk";
2
+ import { VersionedResourceConfig } from "@superblocksteam/util";
3
+ export type SuperblocksMetadata = {
4
+ cliVersion: string;
5
+ remote: string;
6
+ lastUpdated: number;
7
+ created: number;
8
+ };
9
+ export declare const LIVE_MODE = "live";
10
+ export declare const modeFlagValues: string[];
11
+ export declare function modeFlagToViewMode(modeFlag: ModeFlag): ViewMode;
12
+ export type ModeFlag = (typeof modeFlagValues)[number];
13
+ export declare const commonFlags: {
14
+ mode: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
15
+ };
16
+ export declare const SELECT_PROMPT_HELP = "Use \u2191/\u2193 arrow keys, Enter to confirm";
17
+ export declare const MULTI_SELECT_PROMPT_HELP = "Use \u2191/\u2193 arrow keys, Space to select, Enter to confirm";
18
+ export declare const atLeastOneSelection: (value: string[]) => string | true;
19
+ export declare function writeResourceToDisk(resourceType: string, resourceId: string, resource: any, now: number, rootPath: string, existingRelativeLocation?: string): Promise<VersionedResourceConfig>;
20
+ export declare function getMode(task: any, mode: ModeFlag): Promise<ViewMode>;
21
+ export declare function sortByKey(obj: unknown): unknown;
@@ -0,0 +1,166 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sortByKey = exports.getMode = exports.writeResourceToDisk = exports.atLeastOneSelection = exports.MULTI_SELECT_PROMPT_HELP = exports.SELECT_PROMPT_HELP = exports.commonFlags = exports.modeFlagToViewMode = exports.modeFlagValues = exports.LIVE_MODE = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const node_path_1 = tslib_1.__importDefault(require("node:path"));
6
+ const core_1 = require("@oclif/core");
7
+ const util_1 = require("@superblocksteam/util");
8
+ const colorette_1 = require("colorette");
9
+ const fs = tslib_1.__importStar(require("fs-extra"));
10
+ const lodash_1 = require("lodash");
11
+ const lodash_2 = tslib_1.__importDefault(require("lodash"));
12
+ const slugify_1 = tslib_1.__importDefault(require("slugify"));
13
+ const yaml_1 = require("yaml");
14
+ exports.LIVE_MODE = "live";
15
+ exports.modeFlagValues = [exports.LIVE_MODE, "latest", "deployed"];
16
+ function modeFlagToViewMode(modeFlag) {
17
+ switch (modeFlag) {
18
+ case exports.LIVE_MODE:
19
+ return "export-live";
20
+ case "latest":
21
+ return "export-latest";
22
+ case "deployed":
23
+ return "export-deployed";
24
+ default:
25
+ throw new Error(`Unsupported mode flag: ${modeFlag}`);
26
+ }
27
+ }
28
+ exports.modeFlagToViewMode = modeFlagToViewMode;
29
+ exports.commonFlags = {
30
+ mode: core_1.Flags.string({
31
+ char: "m",
32
+ description: "Pull mode",
33
+ options: exports.modeFlagValues,
34
+ }),
35
+ };
36
+ exports.SELECT_PROMPT_HELP = "Use ↑/↓ arrow keys, Enter to confirm";
37
+ exports.MULTI_SELECT_PROMPT_HELP = "Use ↑/↓ arrow keys, Space to select, Enter to confirm";
38
+ const atLeastOneSelection = (value) => {
39
+ if ((0, lodash_1.isEmpty)(value)) {
40
+ return `Please select at least one item ${(0, colorette_1.bold)("by pressing space")}`;
41
+ }
42
+ return true;
43
+ };
44
+ exports.atLeastOneSelection = atLeastOneSelection;
45
+ function slugifyName(originalName) {
46
+ return (0, slugify_1.default)(originalName, {
47
+ replacement: "_",
48
+ lower: true,
49
+ });
50
+ }
51
+ async function writeResourceToDisk(resourceType, resourceId, resource, now, rootPath, existingRelativeLocation) {
52
+ var _a;
53
+ switch (resourceType) {
54
+ case "APPLICATION": {
55
+ const parentDirName = "apps";
56
+ const newRelativeLocation = `${parentDirName}/${slugifyName(resource.application.name)}`;
57
+ const relativeLocation = existingRelativeLocation !== null && existingRelativeLocation !== void 0 ? existingRelativeLocation : newRelativeLocation;
58
+ const appDirName = node_path_1.default.resolve(rootPath, relativeLocation);
59
+ if (!(await fs.pathExists(appDirName))) {
60
+ await fs.mkdir(appDirName, { recursive: true });
61
+ }
62
+ const applicationContent = (0, yaml_1.stringify)(resource.application, {
63
+ sortMapEntries: true,
64
+ });
65
+ await fs.outputFile(`${appDirName}/application.yaml`, applicationContent);
66
+ if (resource.page) {
67
+ const pageContent = (0, yaml_1.stringify)(resource.page, {
68
+ sortMapEntries: true,
69
+ });
70
+ await fs.outputFile(`${appDirName}/page.yaml`, pageContent);
71
+ }
72
+ const apiPromises = [];
73
+ const apisDirName = `${appDirName}/apis`;
74
+ await fs.ensureDir(apisDirName);
75
+ const applicationConfig = {
76
+ configType: "APPLICATION",
77
+ apis: {},
78
+ defaultPageId: (_a = resource.page) === null || _a === void 0 ? void 0 : _a.id,
79
+ id: resource.application.id,
80
+ };
81
+ if (resource.apis) {
82
+ for (const api of resource.apis) {
83
+ const apiContent = (0, yaml_1.stringify)(api, {
84
+ sortMapEntries: true,
85
+ });
86
+ const handleApi = async () => {
87
+ await fs.outputFile(`${apisDirName}/${slugifyName(api.actions.name)}.yaml`, apiContent);
88
+ };
89
+ apiPromises.push(handleApi());
90
+ applicationConfig.apis[api.id] = api.actions.name;
91
+ }
92
+ await Promise.all(apiPromises);
93
+ }
94
+ await fs.ensureDir(`${appDirName}/${util_1.SUPERBLOCKS_HOME_FOLDER_NAME}`);
95
+ await fs.writeFile(`${appDirName}/${util_1.RESOURCE_CONFIG_PATH}`, JSON.stringify(sortByKey(applicationConfig), null, 2));
96
+ return {
97
+ location: relativeLocation,
98
+ lastUpdated: now,
99
+ resourceType: "APPLICATION",
100
+ };
101
+ }
102
+ case "BACKEND": {
103
+ const parentDirName = "backends";
104
+ const newRelativeLocation = `${parentDirName}/${slugifyName(resource.actions.name)}`;
105
+ const relativeLocation = existingRelativeLocation !== null && existingRelativeLocation !== void 0 ? existingRelativeLocation : newRelativeLocation;
106
+ const backendDirName = node_path_1.default.resolve(rootPath, relativeLocation);
107
+ if (!(await fs.pathExists(backendDirName))) {
108
+ await fs.mkdir(backendDirName, { recursive: true });
109
+ }
110
+ const backendContent = (0, yaml_1.stringify)(resource, {
111
+ sortMapEntries: true,
112
+ });
113
+ await fs.outputFile(`${backendDirName}/api.yaml`, backendContent);
114
+ const backendConfig = {
115
+ id: resourceId,
116
+ configType: "BACKEND",
117
+ };
118
+ await fs.ensureDir(`${backendDirName}/${util_1.SUPERBLOCKS_HOME_FOLDER_NAME}`);
119
+ await fs.writeFile(`${backendDirName}/${util_1.RESOURCE_CONFIG_PATH}`, JSON.stringify(sortByKey(backendConfig), null, 2));
120
+ return {
121
+ location: relativeLocation,
122
+ lastUpdated: now,
123
+ resourceType: "BACKEND",
124
+ };
125
+ }
126
+ default: {
127
+ throw new Error(`Unsupported resource type: ${resourceType}`);
128
+ }
129
+ }
130
+ }
131
+ exports.writeResourceToDisk = writeResourceToDisk;
132
+ async function getMode(task, mode) {
133
+ if (mode) {
134
+ return modeFlagToViewMode(mode);
135
+ }
136
+ const selectedMode = await task.prompt([
137
+ {
138
+ type: "Select",
139
+ name: "mode",
140
+ message: `Select fetch mode (${exports.SELECT_PROMPT_HELP})`,
141
+ choices: exports.modeFlagValues.map((mode) => ({
142
+ name: mode,
143
+ message: mode,
144
+ })),
145
+ initial: 0,
146
+ multiple: false,
147
+ },
148
+ ]);
149
+ return modeFlagToViewMode(selectedMode);
150
+ }
151
+ exports.getMode = getMode;
152
+ function sortByKey(obj) {
153
+ if (lodash_2.default.isArray(obj)) {
154
+ return obj.map((item) => sortByKey(item));
155
+ }
156
+ if (lodash_2.default.isObject(obj)) {
157
+ const sortedKeys = Object.keys(obj).sort();
158
+ const sortedObj = {};
159
+ for (const key of sortedKeys) {
160
+ sortedObj[key] = sortByKey(lodash_2.default.get(obj, key));
161
+ }
162
+ return sortedObj;
163
+ }
164
+ return obj;
165
+ }
166
+ exports.sortByKey = sortByKey;
@@ -0,0 +1,20 @@
1
+ /// <reference types="node" />
2
+ import { type UUID } from "crypto";
3
+ import { type StatefulProperty } from "./common/types";
4
+ export interface ComponentConfig {
5
+ id: UUID;
6
+ name: string;
7
+ displayName: string;
8
+ componentPath: string;
9
+ statefulProperties: StatefulProperty[];
10
+ /**
11
+ * Example: [{
12
+ * label: "On Click",
13
+ * path: "onClick",
14
+ * }]
15
+ */
16
+ eventHandlers: Array<{
17
+ label: string;
18
+ path: string;
19
+ }>;
20
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { run } from "@oclif/core";
2
+ export * from "./exportedTypes";
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.run = void 0;
4
+ const tslib_1 = require("tslib");
5
+ var core_1 = require("@oclif/core");
6
+ Object.defineProperty(exports, "run", { enumerable: true, get: function () { return core_1.run; } });
7
+ tslib_1.__exportStar(require("./exportedTypes"), exports);
@@ -0,0 +1,7 @@
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;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidIdentifier = exports.suggestIdentifier = void 0;
4
+ // convert a string to upper camel case, e.g. "123 & this is my component, foo-bar" -> "123ThisIsMyComponentFooBar"
5
+ function wordsToUpperCamelCase(str) {
6
+ return str
7
+ .split(/[^A-Za-z0-9_]+/)
8
+ .filter(Boolean)
9
+ .map((word) => word[0].toUpperCase() + word.slice(1))
10
+ .join("");
11
+ }
12
+ const digits = "Zero One Two Three Four Five Six Seven Eight Nine".split(" ");
13
+ // convert digits to words, e.g. "123" -> "OneTwoThree"
14
+ function digitsToWords(str) {
15
+ return str.replace(/\d/g, (char) => { var _a; return (_a = digits[parseInt(char, 10)]) !== null && _a !== void 0 ? _a : char; });
16
+ }
17
+ /**
18
+ * Suggest an identifier based on a label, e.g. `My Component` -> `myComponent`.
19
+ * @param label The label to suggest an identifier for.
20
+ * @param capitalizeFirst Whether to capitalize the first letter of the identifier.
21
+ */
22
+ function suggestIdentifier(label, capitalizeFirst = false) {
23
+ const upperCamelCase = wordsToUpperCamelCase(label)
24
+ // convert any digits at the start of the string to words as these are not valid in identifiers
25
+ .replace(/^\d+/, digitsToWords);
26
+ if (capitalizeFirst) {
27
+ return upperCamelCase;
28
+ }
29
+ else {
30
+ return upperCamelCase[0].toLowerCase() + upperCamelCase.slice(1);
31
+ }
32
+ }
33
+ exports.suggestIdentifier = suggestIdentifier;
34
+ function isValidIdentifier(str) {
35
+ return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(str);
36
+ }
37
+ exports.isValidIdentifier = isValidIdentifier;
@@ -0,0 +1,7 @@
1
+ import { IPromptOptions } from "@oclif/core/lib/cli-ux";
2
+ type ValidatorFn = (input: string) => string | boolean;
3
+ /**
4
+ * A wrapper around `oclif`'s `ux.prompt` function that allows for validation of user responses.
5
+ */
6
+ export declare function validatedPrompt(name: string, options: IPromptOptions | undefined, validator: ValidatorFn | RegExp): Promise<string>;
7
+ export {};
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validatedPrompt = void 0;
4
+ const core_1 = require("@oclif/core");
5
+ /**
6
+ * A wrapper around `oclif`'s `ux.prompt` function that allows for validation of user responses.
7
+ */
8
+ async function validatedPrompt(name, options, validator) {
9
+ let validatorFn;
10
+ if (validator === undefined) {
11
+ validatorFn = () => true;
12
+ }
13
+ else if (validator instanceof RegExp) {
14
+ validatorFn = (response) => validator.test(response);
15
+ }
16
+ else {
17
+ validatorFn = validator;
18
+ }
19
+ for (;;) {
20
+ const response = await core_1.ux.prompt(name, options);
21
+ const validationResult = validatorFn(response);
22
+ if (typeof validationResult === "string") {
23
+ core_1.ux.log(`Error: ${validationResult}`);
24
+ }
25
+ else if (validationResult === false) {
26
+ core_1.ux.log("Error: Invalid response");
27
+ }
28
+ else {
29
+ return response;
30
+ }
31
+ }
32
+ }
33
+ exports.validatedPrompt = validatedPrompt;
@@ -0,0 +1,9 @@
1
+ export declare const supportedInputTypes: readonly ["text", "number", "boolean", "js"];
2
+ export type InputType = (typeof supportedInputTypes)[number];
3
+ interface TypeInfo {
4
+ tsType: string;
5
+ prompt: string;
6
+ }
7
+ export declare const inputTypeDefinions: Record<InputType, TypeInfo>;
8
+ export declare function isValidInputType(input: string): input is InputType;
9
+ export {};
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isValidInputType = exports.inputTypeDefinions = exports.supportedInputTypes = void 0;
4
+ exports.supportedInputTypes = ["text", "number", "boolean", "js"];
5
+ exports.inputTypeDefinions = {
6
+ text: {
7
+ tsType: "string",
8
+ prompt: "text",
9
+ },
10
+ number: {
11
+ tsType: "number",
12
+ prompt: "number",
13
+ },
14
+ boolean: {
15
+ tsType: "boolean",
16
+ prompt: "boolean",
17
+ },
18
+ js: {
19
+ tsType: "any",
20
+ prompt: "any (raw js expression)",
21
+ },
22
+ };
23
+ function isValidInputType(input) {
24
+ return Object.prototype.hasOwnProperty.call(exports.inputTypeDefinions, input);
25
+ }
26
+ exports.isValidInputType = isValidInputType;
@@ -0,0 +1,151 @@
1
+ {
2
+ "version": "0.0.11",
3
+ "commands": {
4
+ "init": {
5
+ "id": "init",
6
+ "description": "Interactively configure the current directory as a Superblocks project or initialize new services in an already configured Superblocks project directory",
7
+ "strict": true,
8
+ "pluginName": "@superblocksteam/cli",
9
+ "pluginAlias": "@superblocksteam/cli",
10
+ "pluginType": "core",
11
+ "aliases": [],
12
+ "examples": [
13
+ "<%= config.bin %> <%= command.id %>",
14
+ "<%= config.bin %> <%= command.id %> https://app.superblocks.com/applications/11111111-1111-1111-1111-111111111111/pages/22222222-2222-2222-2222-222222222222"
15
+ ],
16
+ "flags": {
17
+ "mode": {
18
+ "name": "mode",
19
+ "type": "option",
20
+ "char": "m",
21
+ "description": "Pull mode",
22
+ "multiple": false,
23
+ "options": [
24
+ "live",
25
+ "latest",
26
+ "deployed"
27
+ ]
28
+ }
29
+ },
30
+ "args": {
31
+ "resourceUrl": {
32
+ "name": "resourceUrl",
33
+ "description": "Superblocks resource URL (i.e. https://app.superblocks.com/applications/<application_id>/pages/<page_id>)",
34
+ "required": false
35
+ }
36
+ }
37
+ },
38
+ "login": {
39
+ "id": "login",
40
+ "description": "Authenticates with Superblocks cloud",
41
+ "strict": true,
42
+ "pluginName": "@superblocksteam/cli",
43
+ "pluginAlias": "@superblocksteam/cli",
44
+ "pluginType": "core",
45
+ "aliases": [],
46
+ "flags": {
47
+ "token": {
48
+ "name": "token",
49
+ "type": "option",
50
+ "char": "t",
51
+ "description": "Superblocks user access token",
52
+ "multiple": false
53
+ },
54
+ "superblocksBaseUrl": {
55
+ "name": "superblocksBaseUrl",
56
+ "type": "option",
57
+ "char": "b",
58
+ "description": "Superblocks base URL",
59
+ "multiple": false
60
+ }
61
+ },
62
+ "args": {}
63
+ },
64
+ "pull": {
65
+ "id": "pull",
66
+ "description": "Download objects from Superblocks and save them locally",
67
+ "strict": true,
68
+ "pluginName": "@superblocksteam/cli",
69
+ "pluginAlias": "@superblocksteam/cli",
70
+ "pluginType": "core",
71
+ "aliases": [],
72
+ "examples": [
73
+ "<%= config.bin %> <%= command.id %>",
74
+ "<%= config.bin %> <%= command.id %> apps/my-app",
75
+ "<%= config.bin %> <%= command.id %> backends/my-workflow",
76
+ "<%= config.bin %> <%= command.id %> backends/my-scheduled-job"
77
+ ],
78
+ "flags": {
79
+ "mode": {
80
+ "name": "mode",
81
+ "type": "option",
82
+ "char": "m",
83
+ "description": "Pull mode",
84
+ "multiple": false,
85
+ "options": [
86
+ "live",
87
+ "latest",
88
+ "deployed"
89
+ ]
90
+ }
91
+ },
92
+ "args": {
93
+ "only": {
94
+ "name": "only",
95
+ "description": "Superblocks resource location to pull (i.e. apps/my-app or backends/my-workflow)",
96
+ "required": false
97
+ }
98
+ }
99
+ },
100
+ "components:create": {
101
+ "id": "components:create",
102
+ "description": "Creates a new Superblocks component in the current application folder",
103
+ "strict": true,
104
+ "pluginName": "@superblocksteam/cli",
105
+ "pluginAlias": "@superblocksteam/cli",
106
+ "pluginType": "core",
107
+ "aliases": [],
108
+ "flags": {},
109
+ "args": {}
110
+ },
111
+ "components:register": {
112
+ "id": "components:register",
113
+ "description": "Registers all local component config files",
114
+ "strict": true,
115
+ "pluginName": "@superblocksteam/cli",
116
+ "pluginAlias": "@superblocksteam/cli",
117
+ "pluginType": "core",
118
+ "aliases": [],
119
+ "examples": [
120
+ "superblocks components register"
121
+ ],
122
+ "flags": {},
123
+ "args": {}
124
+ },
125
+ "components:upload": {
126
+ "id": "components:upload",
127
+ "description": "Upload creates a production-ready bundle and saves the files for use outside of Local Development mode.",
128
+ "strict": true,
129
+ "pluginName": "@superblocksteam/cli",
130
+ "pluginAlias": "@superblocksteam/cli",
131
+ "pluginType": "core",
132
+ "aliases": [],
133
+ "examples": [
134
+ "<%= config.bin %> components upload"
135
+ ],
136
+ "flags": {},
137
+ "args": {}
138
+ },
139
+ "components:watch": {
140
+ "id": "components:watch",
141
+ "description": "watch for changes to your custom components",
142
+ "strict": true,
143
+ "pluginName": "@superblocksteam/cli",
144
+ "pluginAlias": "@superblocksteam/cli",
145
+ "pluginType": "core",
146
+ "aliases": [],
147
+ "flags": {},
148
+ "args": {}
149
+ }
150
+ }
151
+ }