@superblocksteam/cli 0.0.14 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/assets/custom-components/.eslintrc.js +1 -0
- package/assets/custom-components/package.json +1 -1
- package/dist/commands/components/create.js +2 -6
- package/dist/commands/components/register.js +1 -28
- package/dist/commands/components/upload.js +5 -17
- package/dist/commands/components/watch.js +1 -20
- package/dist/commands/init.js +39 -10
- package/dist/common/authenticated-command.d.ts +1 -0
- package/dist/common/authenticated-command.js +34 -0
- package/dist/common/defaults/create-component-defaults.js +1 -24
- package/dist/common/types.d.ts +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +4 -3
- package/dist/util/types.d.ts +0 -9
- package/dist/util/types.js +0 -26
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ $ npm install -g @superblocksteam/cli
|
|
|
12
12
|
$ superblocks COMMAND
|
|
13
13
|
running command...
|
|
14
14
|
$ superblocks (--version)
|
|
15
|
-
@superblocksteam/cli/0.0.
|
|
15
|
+
@superblocksteam/cli/0.0.16 linux-x64 node-v18.17.0
|
|
16
16
|
$ superblocks --help [COMMAND]
|
|
17
17
|
USAGE
|
|
18
18
|
$ superblocks COMMAND
|
|
@@ -15,7 +15,6 @@ const lodash_1 = require("lodash");
|
|
|
15
15
|
const authenticated_command_1 = require("../../common/authenticated-command");
|
|
16
16
|
const create_component_defaults_1 = require("../../common/defaults/create-component-defaults");
|
|
17
17
|
const identifiers_1 = require("../../util/identifiers");
|
|
18
|
-
const types_1 = require("../../util/types");
|
|
19
18
|
// eslint-disable-next-line unicorn/prefer-module
|
|
20
19
|
const rootDirectory = node_path_1.default.resolve(__dirname, "../../../");
|
|
21
20
|
const DEFAULT_PACKAGE_JSON_TEMPLATE_PATH = node_path_1.default.resolve(rootDirectory, "assets/custom-components");
|
|
@@ -76,7 +75,7 @@ class CreateComponent extends authenticated_command_1.AuthenticatedApplicationCo
|
|
|
76
75
|
type: "select",
|
|
77
76
|
name: "type",
|
|
78
77
|
message: `What input type should ${statefulPropName} be?`,
|
|
79
|
-
choices: Object.entries(
|
|
78
|
+
choices: Object.entries(util_1.inputTypeDefinions).map(([k, v]) => ({
|
|
80
79
|
name: k,
|
|
81
80
|
message: v.prompt,
|
|
82
81
|
value: k,
|
|
@@ -196,10 +195,7 @@ class CreateComponent extends authenticated_command_1.AuthenticatedApplicationCo
|
|
|
196
195
|
}
|
|
197
196
|
core_1.ux.action.stop();
|
|
198
197
|
}
|
|
199
|
-
|
|
200
|
-
const components = await (0, util_1.getComponentConfigs)();
|
|
201
|
-
await this.getSdk().registerComponents(this.applicationConfig.id, components);
|
|
202
|
-
core_1.ux.action.stop();
|
|
198
|
+
this.registerComponents();
|
|
203
199
|
}
|
|
204
200
|
}
|
|
205
201
|
CreateComponent.description = "Creates a new Superblocks component in the current application folder";
|
|
@@ -1,36 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const core_1 = require("@oclif/core");
|
|
5
|
-
const util_1 = require("@superblocksteam/util");
|
|
6
|
-
const fs = tslib_1.__importStar(require("fs-extra"));
|
|
7
3
|
const authenticated_command_1 = require("../../common/authenticated-command");
|
|
8
4
|
class Register extends authenticated_command_1.AuthenticatedApplicationCommand {
|
|
9
5
|
async run() {
|
|
10
|
-
|
|
11
|
-
const exists = await fs.pathExists(util_1.CUSTOM_COMPONENTS_PATH);
|
|
12
|
-
if (!exists) {
|
|
13
|
-
core_1.ux.action.stop();
|
|
14
|
-
this.error("No components folder found in current directory, please run 'superblocks components create' first", {
|
|
15
|
-
exit: 1,
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
const configs = await (0, util_1.getComponentConfigs)();
|
|
19
|
-
if (configs.length === 0) {
|
|
20
|
-
core_1.ux.action.stop();
|
|
21
|
-
this.log("No components found in current components directory, please run 'superblocks components create' first");
|
|
22
|
-
}
|
|
23
|
-
core_1.ux.action.stop();
|
|
24
|
-
this.log(JSON.stringify(configs, null, 2));
|
|
25
|
-
try {
|
|
26
|
-
core_1.ux.action.start("Registering components...");
|
|
27
|
-
await this.getSdk().registerComponents(this.applicationConfig.id, configs);
|
|
28
|
-
core_1.ux.action.stop();
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
core_1.ux.action.stop();
|
|
32
|
-
this.error("Failed to register components", { exit: 1 });
|
|
33
|
-
}
|
|
6
|
+
await this.registerComponents();
|
|
34
7
|
}
|
|
35
8
|
}
|
|
36
9
|
Register.description = "Registers all local component config files";
|
|
@@ -4,6 +4,7 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const node_http_1 = tslib_1.__importDefault(require("node:http"));
|
|
5
5
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
6
|
const core_1 = require("@oclif/core");
|
|
7
|
+
const css_plugin_1 = require("@superblocksteam/css-plugin");
|
|
7
8
|
const react_shim_1 = require("@superblocksteam/react-shim");
|
|
8
9
|
const util_1 = require("@superblocksteam/util");
|
|
9
10
|
const plugin_react_1 = tslib_1.__importDefault(require("@vitejs/plugin-react"));
|
|
@@ -21,22 +22,9 @@ class Upload extends authenticated_command_1.AuthenticatedApplicationCommand {
|
|
|
21
22
|
exit: 1,
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
|
-
const configs = await
|
|
25
|
-
if (configs
|
|
26
|
-
|
|
27
|
-
this.log("No components found in current components directory, please run 'superblocks components create' first");
|
|
28
|
-
}
|
|
29
|
-
core_1.ux.action.stop();
|
|
30
|
-
try {
|
|
31
|
-
core_1.ux.action.start("Registering components...");
|
|
32
|
-
await this.getSdk().registerComponents(this.applicationConfig.id, configs);
|
|
33
|
-
core_1.ux.action.stop();
|
|
34
|
-
}
|
|
35
|
-
catch (e) {
|
|
36
|
-
core_1.ux.action.stop();
|
|
37
|
-
this.log(e.message);
|
|
38
|
-
this.error("Failed to register components", { exit: 1 });
|
|
39
|
-
}
|
|
25
|
+
const configs = await this.registerComponents();
|
|
26
|
+
if (!configs)
|
|
27
|
+
return;
|
|
40
28
|
// Map component name to component path- each name is a separate entry point
|
|
41
29
|
const entryFiles = Object.fromEntries(Object.values(configs).map((config) => [
|
|
42
30
|
config.name,
|
|
@@ -63,7 +51,7 @@ class Upload extends authenticated_command_1.AuthenticatedApplicationCommand {
|
|
|
63
51
|
write: true,
|
|
64
52
|
},
|
|
65
53
|
customLogger: viteLogger,
|
|
66
|
-
plugins: [(0, plugin_react_1.default)(), (0, react_shim_1.injectReactVersionsPlugin)()],
|
|
54
|
+
plugins: [(0, plugin_react_1.default)(), (0, react_shim_1.injectReactVersionsPlugin)(), (0, css_plugin_1.productionCssPlugin)()],
|
|
67
55
|
});
|
|
68
56
|
})();
|
|
69
57
|
core_1.ux.action.stop();
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.healthEndpointMiddleware = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const core_1 = require("@oclif/core");
|
|
6
5
|
const react_shim_1 = require("@superblocksteam/react-shim");
|
|
7
|
-
const util_1 = require("@superblocksteam/util");
|
|
8
6
|
const vite_custom_component_reload_plugin_1 = require("@superblocksteam/vite-custom-component-reload-plugin");
|
|
9
7
|
const plugin_react_1 = tslib_1.__importDefault(require("@vitejs/plugin-react"));
|
|
10
8
|
const colorette_1 = require("colorette");
|
|
@@ -31,10 +29,7 @@ function healthEndpointMiddleware() {
|
|
|
31
29
|
exports.healthEndpointMiddleware = healthEndpointMiddleware;
|
|
32
30
|
class Watch extends authenticated_command_1.AuthenticatedApplicationCommand {
|
|
33
31
|
async run() {
|
|
34
|
-
|
|
35
|
-
const components = await (0, util_1.getComponentConfigs)();
|
|
36
|
-
await this.getSdk().registerComponents(this.applicationConfig.id, components);
|
|
37
|
-
core_1.ux.action.stop();
|
|
32
|
+
await this.registerComponents();
|
|
38
33
|
this.log((0, colorette_1.yellow)("Remember to refresh your application to see any newly registered components."));
|
|
39
34
|
this.log();
|
|
40
35
|
this.log((0, colorette_1.green)(`Visit ${await this.getBaseUrl()} and access your application in edit mode to see your components! 🐨`));
|
|
@@ -58,20 +53,6 @@ class Watch extends authenticated_command_1.AuthenticatedApplicationCommand {
|
|
|
58
53
|
await (async () => {
|
|
59
54
|
const server = await (0, vite_1.createServer)({
|
|
60
55
|
configFile: false,
|
|
61
|
-
build: {
|
|
62
|
-
rollupOptions: {
|
|
63
|
-
input: [
|
|
64
|
-
// eslint-disable-next-line no-warning-comments
|
|
65
|
-
/* TODO */
|
|
66
|
-
],
|
|
67
|
-
preserveEntrySignatures: "strict",
|
|
68
|
-
output: {
|
|
69
|
-
entryFileNames: "[name].js",
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
copyPublicDir: true,
|
|
73
|
-
write: true,
|
|
74
|
-
},
|
|
75
56
|
base: `http://localhost:${port}`,
|
|
76
57
|
server: {
|
|
77
58
|
port,
|
package/dist/commands/init.js
CHANGED
|
@@ -40,10 +40,8 @@ class Initialize extends authenticated_command_1.AuthenticatedCommand {
|
|
|
40
40
|
task: (ctx, task) => task.newListr([
|
|
41
41
|
{
|
|
42
42
|
title: "Fetching applications...",
|
|
43
|
+
enabled: () => !args.resourceUrl,
|
|
43
44
|
task: async (ctx, task) => {
|
|
44
|
-
if (args.resourceUrl) {
|
|
45
|
-
task.skip("Skipping fetching applications");
|
|
46
|
-
}
|
|
47
45
|
// applications choices
|
|
48
46
|
const applications = await this.getSdk().fetchApplications();
|
|
49
47
|
for (const app of applications) {
|
|
@@ -58,6 +56,28 @@ class Initialize extends authenticated_command_1.AuthenticatedCommand {
|
|
|
58
56
|
task.title += `: completed`;
|
|
59
57
|
},
|
|
60
58
|
},
|
|
59
|
+
{
|
|
60
|
+
title: "Fetching resource by resourceUrl...",
|
|
61
|
+
enabled: () => args.resourceUrl,
|
|
62
|
+
task: async (ctx, task) => {
|
|
63
|
+
const [resourceId, resourceType] = getResourceIdFromUrl(args.resourceUrl);
|
|
64
|
+
if (resourceType === "APPLICATION") {
|
|
65
|
+
const application = await this.getSdk().fetchApplication(resourceId);
|
|
66
|
+
ctx.fetchedResources[application.application.id] = {
|
|
67
|
+
resourceType,
|
|
68
|
+
name: application.application.name,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
else if (resourceType === "BACKEND") {
|
|
72
|
+
const api = await this.getSdk().fetchApi(resourceId);
|
|
73
|
+
ctx.fetchedResources[api.id] = {
|
|
74
|
+
resourceType,
|
|
75
|
+
name: api.actions.name,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
task.title += `: completed`;
|
|
79
|
+
},
|
|
80
|
+
},
|
|
61
81
|
]),
|
|
62
82
|
},
|
|
63
83
|
{
|
|
@@ -76,6 +96,9 @@ class Initialize extends authenticated_command_1.AuthenticatedCommand {
|
|
|
76
96
|
const now = new Date().toISOString();
|
|
77
97
|
for (const resourceId of ctx.resourceIdsToInitialize) {
|
|
78
98
|
const resource = ctx.fetchedResources[resourceId];
|
|
99
|
+
if (!resource) {
|
|
100
|
+
this.error(`Resource with id ${resourceId} does not exist in fetched resources`);
|
|
101
|
+
}
|
|
79
102
|
switch (resource.resourceType) {
|
|
80
103
|
case "APPLICATION": {
|
|
81
104
|
subtasks.push({
|
|
@@ -152,13 +175,8 @@ class Initialize extends authenticated_command_1.AuthenticatedCommand {
|
|
|
152
175
|
var _a, _b;
|
|
153
176
|
if (args.resourceUrl) {
|
|
154
177
|
try {
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
resourceUrl.pathname.startsWith("/workflows") ||
|
|
158
|
-
resourceUrl.pathname.startsWith("/scheduled-jobs")) {
|
|
159
|
-
return [resourceUrl.pathname.split("/")[2]];
|
|
160
|
-
}
|
|
161
|
-
throw new Error(`Failed to parse resource URL: ${args.resourceUrl}`);
|
|
178
|
+
const [resourceId] = getResourceIdFromUrl(args.resourceUrl);
|
|
179
|
+
return [resourceId];
|
|
162
180
|
}
|
|
163
181
|
catch {
|
|
164
182
|
throw new Error(`Invalid resource URL: ${args.resourceUrl}`);
|
|
@@ -245,3 +263,14 @@ Initialize.args = {
|
|
|
245
263
|
}),
|
|
246
264
|
};
|
|
247
265
|
exports.default = Initialize;
|
|
266
|
+
function getResourceIdFromUrl(resourceUrl) {
|
|
267
|
+
const url = new URL(resourceUrl);
|
|
268
|
+
if (url.pathname.startsWith("/applications")) {
|
|
269
|
+
return [url.pathname.split("/")[2], "APPLICATION"];
|
|
270
|
+
}
|
|
271
|
+
else if (url.pathname.startsWith("/workflows") ||
|
|
272
|
+
url.pathname.startsWith("/scheduled-jobs")) {
|
|
273
|
+
return [url.pathname.split("/")[2], "BACKEND"];
|
|
274
|
+
}
|
|
275
|
+
throw new Error(`Failed to parse resource URL: ${resourceUrl}`);
|
|
276
|
+
}
|
|
@@ -11,4 +11,5 @@ export declare abstract class AuthenticatedApplicationCommand extends Authentica
|
|
|
11
11
|
applicationConfig: SuperblocksApplicationConfig;
|
|
12
12
|
protected getEditModeUrl(): Promise<string>;
|
|
13
13
|
protected init(): Promise<void>;
|
|
14
|
+
protected registerComponents(): Promise<Record<string, any> | undefined>;
|
|
14
15
|
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AuthenticatedApplicationCommand = exports.AuthenticatedCommand = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const core_1 = require("@oclif/core");
|
|
5
6
|
const sdk_1 = require("@superblocksteam/sdk");
|
|
6
7
|
const util_1 = require("@superblocksteam/util");
|
|
8
|
+
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
7
9
|
class AuthenticatedCommand extends core_1.Command {
|
|
8
10
|
async init() {
|
|
9
11
|
await super.init();
|
|
@@ -54,5 +56,37 @@ class AuthenticatedApplicationCommand extends AuthenticatedCommand {
|
|
|
54
56
|
});
|
|
55
57
|
}
|
|
56
58
|
}
|
|
59
|
+
async registerComponents() {
|
|
60
|
+
core_1.ux.action.start("Scanning for Superblocks components...");
|
|
61
|
+
const exists = await fs_extra_1.default.pathExists(util_1.CUSTOM_COMPONENTS_PATH);
|
|
62
|
+
if (!exists) {
|
|
63
|
+
core_1.ux.action.stop();
|
|
64
|
+
this.error("No components folder found in current directory, please run 'superblocks components create' first", {
|
|
65
|
+
exit: 1,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const { configs, hasError } = await (0, util_1.getComponentConfigs)(true);
|
|
69
|
+
if (hasError) {
|
|
70
|
+
core_1.ux.action.stop();
|
|
71
|
+
this.error("Failed to register components", { exit: 1 });
|
|
72
|
+
// Stop immediately
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (configs.length === 0) {
|
|
76
|
+
core_1.ux.action.stop();
|
|
77
|
+
this.log("No components found in current components directory, please run 'superblocks components create' first");
|
|
78
|
+
}
|
|
79
|
+
core_1.ux.action.stop();
|
|
80
|
+
try {
|
|
81
|
+
core_1.ux.action.start("Registering components...");
|
|
82
|
+
await this.getSdk().registerComponents(this.applicationConfig.id, configs);
|
|
83
|
+
core_1.ux.action.stop();
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
core_1.ux.action.stop();
|
|
87
|
+
this.error("Failed to register components", { exit: 1 });
|
|
88
|
+
}
|
|
89
|
+
return configs;
|
|
90
|
+
}
|
|
57
91
|
}
|
|
58
92
|
exports.AuthenticatedApplicationCommand = AuthenticatedApplicationCommand;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDefaultComponentTsx = exports.getDefaultConfigTs = void 0;
|
|
4
|
-
const types_1 = require("../../util/types");
|
|
5
4
|
const indent = (str, spaces) => {
|
|
6
5
|
const spacesString = " ".repeat(spaces);
|
|
7
6
|
return str
|
|
@@ -9,9 +8,6 @@ const indent = (str, spaces) => {
|
|
|
9
8
|
.map((line) => `${spacesString}${line}`)
|
|
10
9
|
.join("\n");
|
|
11
10
|
};
|
|
12
|
-
function renderInputTypeAsTS(name, type, trailingChars, indentSpaces) {
|
|
13
|
-
return indent(`${name}: ${types_1.inputTypeDefinions[type].tsType}${trailingChars}`, indentSpaces);
|
|
14
|
-
}
|
|
15
11
|
const getDefaultConfigTs = ({ id, name, displayName, statefulPropsRendered, eventHandlersRendered, }) => `import { type ComponentConfig } from "@superblocksteam/cli";
|
|
16
12
|
|
|
17
13
|
export default {
|
|
@@ -26,26 +22,7 @@ export default {
|
|
|
26
22
|
`;
|
|
27
23
|
exports.getDefaultConfigTs = getDefaultConfigTs;
|
|
28
24
|
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("")}}
|
|
25
|
+
import { Props } from "./types";
|
|
49
26
|
|
|
50
27
|
export default function Component({
|
|
51
28
|
updateStatefulProperties${statefulProps.length > 0
|
package/dist/common/types.d.ts
CHANGED
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superblocksteam/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "Official Superblocks CLI",
|
|
5
5
|
"bin": {
|
|
6
6
|
"superblocks": "bin/run"
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
"@oclif/core": "^2",
|
|
19
19
|
"@oclif/plugin-help": "^5",
|
|
20
20
|
"@oclif/plugin-plugins": "^2.4.4",
|
|
21
|
-
"@superblocksteam/
|
|
21
|
+
"@superblocksteam/css-plugin": "*",
|
|
22
22
|
"@superblocksteam/react-shim": "*",
|
|
23
|
+
"@superblocksteam/sdk": "*",
|
|
23
24
|
"@superblocksteam/util": "*",
|
|
24
25
|
"@superblocksteam/vite-custom-component-reload-plugin": "*",
|
|
25
26
|
"@vitejs/plugin-react": "^4.0.0",
|
|
@@ -30,7 +31,7 @@
|
|
|
30
31
|
"lodash": "^4.17.21",
|
|
31
32
|
"serve-handler": "^6.1.5",
|
|
32
33
|
"slugify": "^1.6.6",
|
|
33
|
-
"vite": "^4.
|
|
34
|
+
"vite": "^4.4.8",
|
|
34
35
|
"vite-plugin-inspect": "^0.7.28",
|
|
35
36
|
"yaml": "2.3.1"
|
|
36
37
|
},
|
package/dist/util/types.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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 {};
|
package/dist/util/types.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
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;
|