@storm-software/untyped 0.0.1
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/LICENSE +201 -0
- package/README.md +275 -0
- package/bin/untyped.d.mts +1 -0
- package/bin/untyped.d.ts +1 -0
- package/bin/untyped.js +1343 -0
- package/bin/untyped.mjs +1322 -0
- package/dist/chunk-4E62JEHL.js +50 -0
- package/dist/chunk-64SOMW7A.js +38 -0
- package/dist/chunk-BBZKEOA5.js +34 -0
- package/dist/chunk-CSRZXE4P.mjs +69 -0
- package/dist/chunk-CVBHL6A3.mjs +387 -0
- package/dist/chunk-IZL7IEIU.mjs +50 -0
- package/dist/chunk-NWAI6PTH.mjs +38 -0
- package/dist/chunk-ODWHGK5N.js +73 -0
- package/dist/chunk-PSNCUPEF.js +387 -0
- package/dist/chunk-RAX4M7XF.mjs +34 -0
- package/dist/chunk-RXZL622N.js +69 -0
- package/dist/chunk-U4YLQDJK.js +1 -0
- package/dist/chunk-UU4FFJSX.mjs +73 -0
- package/dist/chunk-ZHPKHX4S.mjs +0 -0
- package/dist/generate.d.mts +10 -0
- package/dist/generate.d.ts +10 -0
- package/dist/generate.js +11 -0
- package/dist/generate.mjs +11 -0
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +28 -0
- package/dist/index.mjs +28 -0
- package/dist/types-DkqO6Ujr.d.mts +1185 -0
- package/dist/types-DkqO6Ujr.d.ts +1185 -0
- package/dist/utilities.d.mts +12 -0
- package/dist/utilities.d.ts +12 -0
- package/dist/utilities.js +6 -0
- package/dist/utilities.mjs +6 -0
- package/package.json +1 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkPSNCUPEFjs = require('./chunk-PSNCUPEF.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunk64SOMW7Ajs = require('./chunk-64SOMW7A.js');
|
|
9
|
+
|
|
10
|
+
// src/generators/dts.ts
|
|
11
|
+
var _promises = require('fs/promises');
|
|
12
|
+
var _untyped = require('untyped');
|
|
13
|
+
function generateDeclaration(schema) {
|
|
14
|
+
return `
|
|
15
|
+
// Generated by @storm-software/untyped
|
|
16
|
+
// Do not edit this file directly
|
|
17
|
+
|
|
18
|
+
${_untyped.generateTypes.call(void 0, schema, {
|
|
19
|
+
addExport: true,
|
|
20
|
+
partial: true,
|
|
21
|
+
interfaceName: `${_optionalChain([schema, 'access', _ => _.title, 'optionalAccess', _2 => _2.replaceAll, 'call', _3 => _3(" ", "")]) || "Type"}Schema`
|
|
22
|
+
})}
|
|
23
|
+
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
_chunk64SOMW7Ajs.__name.call(void 0, generateDeclaration, "generateDeclaration");
|
|
27
|
+
function generateDeclarationFile(schema, file, config) {
|
|
28
|
+
try {
|
|
29
|
+
const declarations = _chunk64SOMW7Ajs.getOutputFile.call(void 0, file, "d.ts");
|
|
30
|
+
_chunkPSNCUPEFjs.writeTrace.call(void 0, `Writing type declaration file ${declarations}`, config);
|
|
31
|
+
return _promises.writeFile.call(void 0, declarations, generateDeclaration(schema));
|
|
32
|
+
} catch (error) {
|
|
33
|
+
_chunkPSNCUPEFjs.writeError.call(void 0, `Error writing declaration file for ${file.name}
|
|
34
|
+
|
|
35
|
+
Error:
|
|
36
|
+
${_optionalChain([error, 'optionalAccess', _4 => _4.message]) ? error.message : JSON.stringify(error)}${_optionalChain([error, 'optionalAccess', _5 => _5.stack]) ? `
|
|
37
|
+
Stack Trace: ${error.stack}` : ""}
|
|
38
|
+
|
|
39
|
+
Parsed schema:
|
|
40
|
+
${JSON.stringify(schema)}
|
|
41
|
+
`, config);
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
_chunk64SOMW7Ajs.__name.call(void 0, generateDeclarationFile, "generateDeclarationFile");
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
exports.generateDeclaration = generateDeclaration; exports.generateDeclarationFile = generateDeclarationFile;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// ../config-tools/src/utilities/correct-paths.ts
|
|
5
|
+
var _devkit = require('@nx/devkit');
|
|
6
|
+
var correctPaths = /* @__PURE__ */ __name((path) => {
|
|
7
|
+
if (!path) {
|
|
8
|
+
return "";
|
|
9
|
+
}
|
|
10
|
+
if (!path.toUpperCase().startsWith("C:") && path.includes("\\")) {
|
|
11
|
+
path = `C:${path}`;
|
|
12
|
+
}
|
|
13
|
+
return path.replaceAll("\\", "/");
|
|
14
|
+
}, "correctPaths");
|
|
15
|
+
var joinPaths = /* @__PURE__ */ __name((...paths) => {
|
|
16
|
+
if (!paths || paths.length === 0) {
|
|
17
|
+
return "";
|
|
18
|
+
}
|
|
19
|
+
return correctPaths(_devkit.joinPathFragments.call(void 0, ...paths.map((path) => correctPaths(path))));
|
|
20
|
+
}, "joinPaths");
|
|
21
|
+
|
|
22
|
+
// src/utilities.ts
|
|
23
|
+
var getOutputFile = /* @__PURE__ */ __name((file, extension) => {
|
|
24
|
+
let fileName = file.name.slice(0, file.name.lastIndexOf(".")).replace(".schema", "").replace("schema", "");
|
|
25
|
+
if (!fileName) {
|
|
26
|
+
fileName = "schema";
|
|
27
|
+
}
|
|
28
|
+
if (extension === "json" && fileName !== "schema") {
|
|
29
|
+
fileName = `${fileName}.schema`;
|
|
30
|
+
}
|
|
31
|
+
return joinPaths(file.parentPath, `${fileName}.${extension}`);
|
|
32
|
+
}, "getOutputFile");
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
exports.__name = __name; exports.joinPaths = joinPaths; exports.getOutputFile = getOutputFile;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkPSNCUPEFjs = require('./chunk-PSNCUPEF.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunk64SOMW7Ajs = require('./chunk-64SOMW7A.js');
|
|
9
|
+
|
|
10
|
+
// src/generators/json-schema.ts
|
|
11
|
+
var _promises = require('fs/promises');
|
|
12
|
+
function generateJsonSchemaFile(schema, file, config) {
|
|
13
|
+
try {
|
|
14
|
+
const jsonSchema = _chunk64SOMW7Ajs.getOutputFile.call(void 0, file, "json");
|
|
15
|
+
_chunkPSNCUPEFjs.writeTrace.call(void 0, `Writing JSON schema file ${jsonSchema}`, config);
|
|
16
|
+
return _promises.writeFile.call(void 0, jsonSchema, JSON.stringify(schema, null, 2));
|
|
17
|
+
} catch (error) {
|
|
18
|
+
_chunkPSNCUPEFjs.writeError.call(void 0, `Error writing JSON schema file for ${file.name}
|
|
19
|
+
|
|
20
|
+
Error:
|
|
21
|
+
${_optionalChain([error, 'optionalAccess', _ => _.message]) ? error.message : JSON.stringify(error)}${_optionalChain([error, 'optionalAccess', _2 => _2.stack]) ? `
|
|
22
|
+
Stack Trace: ${error.stack}` : ""}
|
|
23
|
+
|
|
24
|
+
Parsed schema:
|
|
25
|
+
${JSON.stringify(schema)}
|
|
26
|
+
`, config);
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
_chunk64SOMW7Ajs.__name.call(void 0, generateJsonSchemaFile, "generateJsonSchemaFile");
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
exports.generateJsonSchemaFile = generateJsonSchemaFile;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
writeError,
|
|
3
|
+
writeTrace
|
|
4
|
+
} from "./chunk-CVBHL6A3.mjs";
|
|
5
|
+
import {
|
|
6
|
+
__name,
|
|
7
|
+
getOutputFile
|
|
8
|
+
} from "./chunk-NWAI6PTH.mjs";
|
|
9
|
+
|
|
10
|
+
// src/generators/markdown.ts
|
|
11
|
+
import { writeFile } from "node:fs/promises";
|
|
12
|
+
function generateMarkdown(schema) {
|
|
13
|
+
return `
|
|
14
|
+
<!-- Generated by @storm-software/untyped -->
|
|
15
|
+
<!-- Do not edit this file directly -->
|
|
16
|
+
|
|
17
|
+
${generateMarkdownLevel(schema, schema.title || "", "#").join("\n")}
|
|
18
|
+
|
|
19
|
+
`;
|
|
20
|
+
}
|
|
21
|
+
__name(generateMarkdown, "generateMarkdown");
|
|
22
|
+
function generateMarkdownLevel(schema, title, level) {
|
|
23
|
+
const lines = [];
|
|
24
|
+
lines.push(`${level} ${title}`);
|
|
25
|
+
if (schema.type === "object") {
|
|
26
|
+
for (const key in schema.properties) {
|
|
27
|
+
const val = schema.properties[key];
|
|
28
|
+
lines.push("", ...generateMarkdownLevel(val, `\`${key}\``, level + "#"));
|
|
29
|
+
}
|
|
30
|
+
return lines;
|
|
31
|
+
}
|
|
32
|
+
lines.push(`- **Type**: \`${schema.markdownType || schema.tsType || schema.type}\``);
|
|
33
|
+
if ("default" in schema) {
|
|
34
|
+
lines.push(`- **Default**: \`${JSON.stringify(schema.default)}\``);
|
|
35
|
+
}
|
|
36
|
+
lines.push("");
|
|
37
|
+
if (schema.title) {
|
|
38
|
+
lines.push("> " + schema.title, "");
|
|
39
|
+
}
|
|
40
|
+
if (schema.description) {
|
|
41
|
+
lines.push("", schema.description, "");
|
|
42
|
+
}
|
|
43
|
+
return lines;
|
|
44
|
+
}
|
|
45
|
+
__name(generateMarkdownLevel, "generateMarkdownLevel");
|
|
46
|
+
function generateMarkdownFile(schema, file, config) {
|
|
47
|
+
try {
|
|
48
|
+
const declarations = getOutputFile(file, "md");
|
|
49
|
+
writeTrace(`Writing type markdown file ${declarations}`, config);
|
|
50
|
+
return writeFile(declarations, generateMarkdown(schema));
|
|
51
|
+
} catch (error) {
|
|
52
|
+
writeError(`Error writing markdown file for ${file.name}
|
|
53
|
+
|
|
54
|
+
Error:
|
|
55
|
+
${error?.message ? error.message : JSON.stringify(error)}${error?.stack ? `
|
|
56
|
+
Stack Trace: ${error.stack}` : ""}
|
|
57
|
+
|
|
58
|
+
Parsed schema:
|
|
59
|
+
${JSON.stringify(schema)}
|
|
60
|
+
`, config);
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
__name(generateMarkdownFile, "generateMarkdownFile");
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
generateMarkdown,
|
|
68
|
+
generateMarkdownFile
|
|
69
|
+
};
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-NWAI6PTH.mjs";
|
|
4
|
+
|
|
5
|
+
// ../config-tools/src/types.ts
|
|
6
|
+
var LogLevel = {
|
|
7
|
+
SILENT: 0,
|
|
8
|
+
FATAL: 10,
|
|
9
|
+
ERROR: 20,
|
|
10
|
+
WARN: 30,
|
|
11
|
+
SUCCESS: 35,
|
|
12
|
+
INFO: 40,
|
|
13
|
+
DEBUG: 60,
|
|
14
|
+
TRACE: 70,
|
|
15
|
+
ALL: 100
|
|
16
|
+
};
|
|
17
|
+
var LogLevelLabel = {
|
|
18
|
+
SILENT: "silent",
|
|
19
|
+
FATAL: "fatal",
|
|
20
|
+
ERROR: "error",
|
|
21
|
+
WARN: "warn",
|
|
22
|
+
SUCCESS: "success",
|
|
23
|
+
INFO: "info",
|
|
24
|
+
DEBUG: "debug",
|
|
25
|
+
TRACE: "trace",
|
|
26
|
+
ALL: "all"
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// ../config-tools/src/logger/get-log-level.ts
|
|
30
|
+
var getLogLevel = /* @__PURE__ */ __name((label) => {
|
|
31
|
+
switch (label) {
|
|
32
|
+
case "all":
|
|
33
|
+
return LogLevel.ALL;
|
|
34
|
+
case "trace":
|
|
35
|
+
return LogLevel.TRACE;
|
|
36
|
+
case "debug":
|
|
37
|
+
return LogLevel.DEBUG;
|
|
38
|
+
case "info":
|
|
39
|
+
return LogLevel.INFO;
|
|
40
|
+
case "warn":
|
|
41
|
+
return LogLevel.WARN;
|
|
42
|
+
case "error":
|
|
43
|
+
return LogLevel.ERROR;
|
|
44
|
+
case "fatal":
|
|
45
|
+
return LogLevel.FATAL;
|
|
46
|
+
case "silent":
|
|
47
|
+
return LogLevel.SILENT;
|
|
48
|
+
default:
|
|
49
|
+
return LogLevel.INFO;
|
|
50
|
+
}
|
|
51
|
+
}, "getLogLevel");
|
|
52
|
+
var isVerbose = /* @__PURE__ */ __name((label = LogLevelLabel.SILENT) => {
|
|
53
|
+
const logLevel = typeof label === "string" ? getLogLevel(label) : label;
|
|
54
|
+
return logLevel >= LogLevel.DEBUG;
|
|
55
|
+
}, "isVerbose");
|
|
56
|
+
|
|
57
|
+
// ../config/src/constants.ts
|
|
58
|
+
var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
|
|
59
|
+
var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
|
|
60
|
+
var STORM_DEFAULT_LICENSING = "https://license.stormsoftware.com";
|
|
61
|
+
|
|
62
|
+
// ../config/src/schema.ts
|
|
63
|
+
import z from "zod";
|
|
64
|
+
var DarkColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d1e22").describe("The dark background color of the workspace");
|
|
65
|
+
var LightColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#f4f4f5").describe("The light background color of the workspace");
|
|
66
|
+
var BrandColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1fb2a6").describe("The primary brand specific color of the workspace");
|
|
67
|
+
var AlternateColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The alternate brand specific color of the workspace");
|
|
68
|
+
var AccentColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The secondary brand specific color of the workspace");
|
|
69
|
+
var LinkColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The color used to display hyperlink text");
|
|
70
|
+
var HelpColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#8256D0").describe("The second brand specific color of the workspace");
|
|
71
|
+
var SuccessColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#12B66A").describe("The success color of the workspace");
|
|
72
|
+
var InfoColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0070E0").describe("The informational color of the workspace");
|
|
73
|
+
var WarningColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace");
|
|
74
|
+
var DangerColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#D8314A").describe("The danger color of the workspace");
|
|
75
|
+
var FatalColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The fatal color of the workspace");
|
|
76
|
+
var PositiveColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#4ade80").describe("The positive number color of the workspace");
|
|
77
|
+
var NegativeColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#ef4444").describe("The negative number color of the workspace");
|
|
78
|
+
var DarkThemeColorConfigSchema = z.object({
|
|
79
|
+
foreground: LightColorSchema,
|
|
80
|
+
background: DarkColorSchema,
|
|
81
|
+
brand: BrandColorSchema,
|
|
82
|
+
alternate: AlternateColorSchema,
|
|
83
|
+
accent: AccentColorSchema,
|
|
84
|
+
link: LinkColorSchema,
|
|
85
|
+
help: HelpColorSchema,
|
|
86
|
+
success: SuccessColorSchema,
|
|
87
|
+
info: InfoColorSchema,
|
|
88
|
+
warning: WarningColorSchema,
|
|
89
|
+
danger: DangerColorSchema,
|
|
90
|
+
fatal: FatalColorSchema,
|
|
91
|
+
positive: PositiveColorSchema,
|
|
92
|
+
negative: NegativeColorSchema
|
|
93
|
+
});
|
|
94
|
+
var LightThemeColorConfigSchema = z.object({
|
|
95
|
+
foreground: DarkColorSchema,
|
|
96
|
+
background: LightColorSchema,
|
|
97
|
+
brand: BrandColorSchema,
|
|
98
|
+
alternate: AlternateColorSchema,
|
|
99
|
+
accent: AccentColorSchema,
|
|
100
|
+
link: LinkColorSchema,
|
|
101
|
+
help: HelpColorSchema,
|
|
102
|
+
success: SuccessColorSchema,
|
|
103
|
+
info: InfoColorSchema,
|
|
104
|
+
warning: WarningColorSchema,
|
|
105
|
+
danger: DangerColorSchema,
|
|
106
|
+
fatal: FatalColorSchema,
|
|
107
|
+
positive: PositiveColorSchema,
|
|
108
|
+
negative: NegativeColorSchema
|
|
109
|
+
});
|
|
110
|
+
var MultiThemeColorConfigSchema = z.object({
|
|
111
|
+
dark: DarkThemeColorConfigSchema,
|
|
112
|
+
light: LightThemeColorConfigSchema
|
|
113
|
+
});
|
|
114
|
+
var SingleThemeColorConfigSchema = z.object({
|
|
115
|
+
dark: DarkColorSchema,
|
|
116
|
+
light: LightColorSchema,
|
|
117
|
+
brand: BrandColorSchema,
|
|
118
|
+
alternate: AlternateColorSchema,
|
|
119
|
+
accent: AccentColorSchema,
|
|
120
|
+
link: LinkColorSchema,
|
|
121
|
+
help: HelpColorSchema,
|
|
122
|
+
success: SuccessColorSchema,
|
|
123
|
+
info: InfoColorSchema,
|
|
124
|
+
warning: WarningColorSchema,
|
|
125
|
+
danger: DangerColorSchema,
|
|
126
|
+
fatal: FatalColorSchema,
|
|
127
|
+
positive: PositiveColorSchema,
|
|
128
|
+
negative: NegativeColorSchema
|
|
129
|
+
});
|
|
130
|
+
var RegistryUrlConfigSchema = z.string().trim().toLowerCase().url().optional().describe("A remote registry URL used to publish distributable packages");
|
|
131
|
+
var RegistryConfigSchema = z.object({
|
|
132
|
+
github: RegistryUrlConfigSchema,
|
|
133
|
+
npm: RegistryUrlConfigSchema,
|
|
134
|
+
cargo: RegistryUrlConfigSchema,
|
|
135
|
+
cyclone: RegistryUrlConfigSchema,
|
|
136
|
+
container: RegistryUrlConfigSchema
|
|
137
|
+
}).default({}).describe("A list of remote registry URLs used by Storm Software");
|
|
138
|
+
var ColorConfigSchema = SingleThemeColorConfigSchema.or(MultiThemeColorConfigSchema).describe("Colors used for various workspace elements");
|
|
139
|
+
var ColorConfigMapSchema = z.union([
|
|
140
|
+
z.object({
|
|
141
|
+
"base": ColorConfigSchema
|
|
142
|
+
}),
|
|
143
|
+
z.record(z.string(), ColorConfigSchema)
|
|
144
|
+
]);
|
|
145
|
+
var WorkspaceBotConfigSchema = z.object({
|
|
146
|
+
name: z.string().trim().default("Stormie-Bot").describe("The workspace bot user's name (this is the bot that will be used to perform various tasks)"),
|
|
147
|
+
email: z.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
|
|
148
|
+
}).describe("The workspace's bot user's config used to automated various operations tasks");
|
|
149
|
+
var WorkspaceDirectoryConfigSchema = z.object({
|
|
150
|
+
cache: z.string().trim().optional().describe("The directory used to store the environment's cached file data"),
|
|
151
|
+
data: z.string().trim().optional().describe("The directory used to store the environment's data files"),
|
|
152
|
+
config: z.string().trim().optional().describe("The directory used to store the environment's configuration files"),
|
|
153
|
+
temp: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
|
|
154
|
+
log: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
|
|
155
|
+
build: z.string().trim().default("dist").describe("The directory used to store the workspace's distributable files after a build (relative to the workspace root)")
|
|
156
|
+
}).describe("Various directories used by the workspace to store data, cache, and configuration files");
|
|
157
|
+
var StormConfigSchema = z.object({
|
|
158
|
+
$schema: z.string().trim().default("https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm.schema.json").optional().nullish().describe("The URL to the JSON schema file that describes the Storm configuration file"),
|
|
159
|
+
extends: z.string().trim().optional().describe("The path to a base JSON file to use as a configuration preset file"),
|
|
160
|
+
name: z.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
|
|
161
|
+
namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
|
|
162
|
+
organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
|
|
163
|
+
repository: z.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
164
|
+
license: z.string().trim().default("Apache-2.0").describe("The license type of the package"),
|
|
165
|
+
homepage: z.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
|
|
166
|
+
docs: z.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
|
|
167
|
+
licensing: z.string().trim().url().default(STORM_DEFAULT_LICENSING).describe("The base licensing site for the workspace"),
|
|
168
|
+
branch: z.string().trim().default("main").describe("The branch of the workspace"),
|
|
169
|
+
preid: z.string().optional().describe("A tag specifying the version pre-release identifier"),
|
|
170
|
+
owner: z.string().trim().default("@storm-software/admin").describe("The owner of the package"),
|
|
171
|
+
bot: WorkspaceBotConfigSchema,
|
|
172
|
+
env: z.enum([
|
|
173
|
+
"development",
|
|
174
|
+
"staging",
|
|
175
|
+
"production"
|
|
176
|
+
]).default("production").describe("The current runtime environment name for the package"),
|
|
177
|
+
workspaceRoot: z.string().trim().default("").describe("The root directory of the workspace"),
|
|
178
|
+
externalPackagePatterns: z.array(z.string()).default([]).describe("The build will use these package patterns to determine if they should be external to the bundle"),
|
|
179
|
+
skipCache: z.boolean().default(false).describe("Should all known types of workspace caching be skipped?"),
|
|
180
|
+
directories: WorkspaceDirectoryConfigSchema,
|
|
181
|
+
packageManager: z.enum([
|
|
182
|
+
"npm",
|
|
183
|
+
"yarn",
|
|
184
|
+
"pnpm",
|
|
185
|
+
"bun"
|
|
186
|
+
]).default("npm").describe("The JavaScript/TypeScript package manager used by the repository"),
|
|
187
|
+
timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
|
|
188
|
+
locale: z.string().trim().default("en-US").describe("The default locale of the workspace"),
|
|
189
|
+
logLevel: z.enum([
|
|
190
|
+
"silent",
|
|
191
|
+
"fatal",
|
|
192
|
+
"error",
|
|
193
|
+
"warn",
|
|
194
|
+
"success",
|
|
195
|
+
"info",
|
|
196
|
+
"debug",
|
|
197
|
+
"trace",
|
|
198
|
+
"all"
|
|
199
|
+
]).default("info").describe("The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."),
|
|
200
|
+
registry: RegistryConfigSchema,
|
|
201
|
+
configFile: z.string().trim().nullable().default(null).describe("The filepath of the Storm config. When this field is null, no config file was found in the current workspace."),
|
|
202
|
+
colors: ColorConfigSchema.or(ColorConfigMapSchema).describe("Storm theme config values used for styling various package elements"),
|
|
203
|
+
extensions: z.record(z.any()).optional().default({}).describe("Configuration of each used extension")
|
|
204
|
+
}).describe("Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo.");
|
|
205
|
+
|
|
206
|
+
// ../config-tools/src/utilities/get-default-config.ts
|
|
207
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
208
|
+
import { join } from "node:path";
|
|
209
|
+
var DEFAULT_COLOR_CONFIG = {
|
|
210
|
+
"light": {
|
|
211
|
+
"background": "#fafafa",
|
|
212
|
+
"foreground": "#1d1e22",
|
|
213
|
+
"brand": "#1fb2a6",
|
|
214
|
+
"alternate": "#db2777",
|
|
215
|
+
"help": "#5C4EE5",
|
|
216
|
+
"success": "#087f5b",
|
|
217
|
+
"info": "#0550ae",
|
|
218
|
+
"warning": "#e3b341",
|
|
219
|
+
"danger": "#D8314A",
|
|
220
|
+
"positive": "#22c55e",
|
|
221
|
+
"negative": "#dc2626"
|
|
222
|
+
},
|
|
223
|
+
"dark": {
|
|
224
|
+
"background": "#1d1e22",
|
|
225
|
+
"foreground": "#cbd5e1",
|
|
226
|
+
"brand": "#2dd4bf",
|
|
227
|
+
"alternate": "#db2777",
|
|
228
|
+
"help": "#818cf8",
|
|
229
|
+
"success": "#10b981",
|
|
230
|
+
"info": "#58a6ff",
|
|
231
|
+
"warning": "#f3d371",
|
|
232
|
+
"danger": "#D8314A",
|
|
233
|
+
"positive": "#22c55e",
|
|
234
|
+
"negative": "#dc2626"
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
// ../config-tools/src/logger/chalk.ts
|
|
239
|
+
import chalk from "chalk";
|
|
240
|
+
var chalkDefault = {
|
|
241
|
+
hex: /* @__PURE__ */ __name((_) => (message) => message, "hex"),
|
|
242
|
+
bgHex: /* @__PURE__ */ __name((_) => ({
|
|
243
|
+
whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
|
|
244
|
+
}), "bgHex"),
|
|
245
|
+
whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright"),
|
|
246
|
+
gray: /* @__PURE__ */ __name((message) => message, "gray"),
|
|
247
|
+
bold: {
|
|
248
|
+
hex: /* @__PURE__ */ __name((_) => (message) => message, "hex"),
|
|
249
|
+
bgHex: /* @__PURE__ */ __name((_) => ({
|
|
250
|
+
whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
|
|
251
|
+
}), "bgHex"),
|
|
252
|
+
whiteBright: /* @__PURE__ */ __name((message) => message, "whiteBright")
|
|
253
|
+
},
|
|
254
|
+
dim: {
|
|
255
|
+
hex: /* @__PURE__ */ __name((_) => (message) => message, "hex"),
|
|
256
|
+
gray: /* @__PURE__ */ __name((message) => message, "gray")
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
var getChalk = /* @__PURE__ */ __name(() => {
|
|
260
|
+
let _chalk = chalk;
|
|
261
|
+
if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright) {
|
|
262
|
+
_chalk = chalkDefault;
|
|
263
|
+
}
|
|
264
|
+
return _chalk;
|
|
265
|
+
}, "getChalk");
|
|
266
|
+
|
|
267
|
+
// ../config-tools/src/logger/is-unicode-supported.ts
|
|
268
|
+
import process2 from "node:process";
|
|
269
|
+
function isUnicodeSupported() {
|
|
270
|
+
const { env } = process2;
|
|
271
|
+
const { TERM, TERM_PROGRAM } = env;
|
|
272
|
+
if (process2.platform !== "win32") {
|
|
273
|
+
return TERM !== "linux";
|
|
274
|
+
}
|
|
275
|
+
return Boolean(env.WT_SESSION) || // Windows Terminal
|
|
276
|
+
Boolean(env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
|
|
277
|
+
env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
|
|
278
|
+
TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
279
|
+
}
|
|
280
|
+
__name(isUnicodeSupported, "isUnicodeSupported");
|
|
281
|
+
|
|
282
|
+
// ../config-tools/src/logger/console-icons.ts
|
|
283
|
+
var useIcon = /* @__PURE__ */ __name((c, fallback) => isUnicodeSupported() ? c : fallback, "useIcon");
|
|
284
|
+
var CONSOLE_ICONS = {
|
|
285
|
+
[LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
|
|
286
|
+
[LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
|
|
287
|
+
[LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
|
|
288
|
+
[LogLevelLabel.INFO]: useIcon("\u2139", "i"),
|
|
289
|
+
[LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
|
|
290
|
+
[LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
|
|
291
|
+
[LogLevelLabel.TRACE]: useIcon("\u2709", "\u2192")
|
|
292
|
+
};
|
|
293
|
+
|
|
294
|
+
// ../config-tools/src/logger/format-timestamp.ts
|
|
295
|
+
var formatTimestamp = /* @__PURE__ */ __name((date = /* @__PURE__ */ new Date()) => {
|
|
296
|
+
return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
|
|
297
|
+
}, "formatTimestamp");
|
|
298
|
+
|
|
299
|
+
// ../config-tools/src/logger/console.ts
|
|
300
|
+
var getLogFn = /* @__PURE__ */ __name((logLevel = LogLevel.INFO, config = {}) => {
|
|
301
|
+
const _chalk = getChalk();
|
|
302
|
+
const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
|
|
303
|
+
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
|
|
304
|
+
if (typeof logLevel === "number" && (logLevel >= getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT) || typeof logLevel === "string" && getLogLevel(logLevel) >= getLogLevel(configLogLevel)) {
|
|
305
|
+
return (_) => {
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel || typeof logLevel === "string" && LogLevel.FATAL >= getLogLevel(logLevel)) {
|
|
309
|
+
return (message) => {
|
|
310
|
+
console.error(`
|
|
311
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.bold.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal]`)} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(formatLogMessage(message))}
|
|
312
|
+
`);
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel || typeof logLevel === "string" && LogLevel.ERROR >= getLogLevel(logLevel)) {
|
|
316
|
+
return (message) => {
|
|
317
|
+
console.error(`
|
|
318
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.bold.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error]`)} ${_chalk.hex(colors.danger ?? "#f85149")(formatLogMessage(message))}
|
|
319
|
+
`);
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
if (typeof logLevel === "number" && LogLevel.WARN >= logLevel || typeof logLevel === "string" && LogLevel.WARN >= getLogLevel(logLevel)) {
|
|
323
|
+
return (message) => {
|
|
324
|
+
console.warn(`
|
|
325
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.bold.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn]`)} ${_chalk.hex(colors.warning ?? "#e3b341")(formatLogMessage(message))}
|
|
326
|
+
`);
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel || typeof logLevel === "string" && LogLevel.SUCCESS >= getLogLevel(logLevel)) {
|
|
330
|
+
return (message) => {
|
|
331
|
+
console.info(`
|
|
332
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.bold.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success]`)} ${_chalk.hex(colors.success ?? "#56d364")(formatLogMessage(message))}
|
|
333
|
+
`);
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel || typeof logLevel === "string" && LogLevel.INFO >= getLogLevel(logLevel)) {
|
|
337
|
+
return (message) => {
|
|
338
|
+
console.info(`
|
|
339
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.bold.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info]`)} ${_chalk.hex(colors.info ?? "#58a6ff")(formatLogMessage(message))}
|
|
340
|
+
`);
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel || typeof logLevel === "string" && LogLevel.TRACE >= getLogLevel(logLevel)) {
|
|
344
|
+
return (message) => {
|
|
345
|
+
console.debug(`
|
|
346
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.bold.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Debug]`)} ${_chalk.hex(colors.brand ?? "#1fb2a6")(formatLogMessage(message))}
|
|
347
|
+
`);
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
return (message) => {
|
|
351
|
+
console.log(`
|
|
352
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.bold.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System]`)} ${_chalk.hex(colors.brand ?? "#1fb2a6")(formatLogMessage(message))}
|
|
353
|
+
`);
|
|
354
|
+
};
|
|
355
|
+
}, "getLogFn");
|
|
356
|
+
var writeError = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.ERROR, config)(message), "writeError");
|
|
357
|
+
var writeTrace = /* @__PURE__ */ __name((message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
|
|
358
|
+
var MAX_DEPTH = 4;
|
|
359
|
+
var formatLogMessage = /* @__PURE__ */ __name((message, options = {}, depth = 0) => {
|
|
360
|
+
if (depth > MAX_DEPTH) {
|
|
361
|
+
return "<max depth>";
|
|
362
|
+
}
|
|
363
|
+
const prefix = options.prefix ?? "-";
|
|
364
|
+
const skip = options.skip ?? [];
|
|
365
|
+
return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
|
|
366
|
+
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
|
|
367
|
+
prefix: `${prefix}-`,
|
|
368
|
+
skip
|
|
369
|
+
}, depth + 1)}`).join("\n")}` : typeof message === "object" ? `
|
|
370
|
+
${Object.keys(message).filter((key) => !skip.includes(key)).map((key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(message[key], {
|
|
371
|
+
prefix: `${prefix}-`,
|
|
372
|
+
skip
|
|
373
|
+
}, depth + 1) : message[key]}`).join("\n")}` : message;
|
|
374
|
+
}, "formatLogMessage");
|
|
375
|
+
var _isFunction = /* @__PURE__ */ __name((value) => {
|
|
376
|
+
try {
|
|
377
|
+
return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
|
|
378
|
+
} catch (e) {
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
}, "_isFunction");
|
|
382
|
+
|
|
383
|
+
export {
|
|
384
|
+
isVerbose,
|
|
385
|
+
writeError,
|
|
386
|
+
writeTrace
|
|
387
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
writeError,
|
|
3
|
+
writeTrace
|
|
4
|
+
} from "./chunk-CVBHL6A3.mjs";
|
|
5
|
+
import {
|
|
6
|
+
__name,
|
|
7
|
+
getOutputFile
|
|
8
|
+
} from "./chunk-NWAI6PTH.mjs";
|
|
9
|
+
|
|
10
|
+
// src/generators/dts.ts
|
|
11
|
+
import { writeFile } from "node:fs/promises";
|
|
12
|
+
import { generateTypes } from "untyped";
|
|
13
|
+
function generateDeclaration(schema) {
|
|
14
|
+
return `
|
|
15
|
+
// Generated by @storm-software/untyped
|
|
16
|
+
// Do not edit this file directly
|
|
17
|
+
|
|
18
|
+
${generateTypes(schema, {
|
|
19
|
+
addExport: true,
|
|
20
|
+
partial: true,
|
|
21
|
+
interfaceName: `${schema.title?.replaceAll(" ", "") || "Type"}Schema`
|
|
22
|
+
})}
|
|
23
|
+
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
__name(generateDeclaration, "generateDeclaration");
|
|
27
|
+
function generateDeclarationFile(schema, file, config) {
|
|
28
|
+
try {
|
|
29
|
+
const declarations = getOutputFile(file, "d.ts");
|
|
30
|
+
writeTrace(`Writing type declaration file ${declarations}`, config);
|
|
31
|
+
return writeFile(declarations, generateDeclaration(schema));
|
|
32
|
+
} catch (error) {
|
|
33
|
+
writeError(`Error writing declaration file for ${file.name}
|
|
34
|
+
|
|
35
|
+
Error:
|
|
36
|
+
${error?.message ? error.message : JSON.stringify(error)}${error?.stack ? `
|
|
37
|
+
Stack Trace: ${error.stack}` : ""}
|
|
38
|
+
|
|
39
|
+
Parsed schema:
|
|
40
|
+
${JSON.stringify(schema)}
|
|
41
|
+
`, config);
|
|
42
|
+
throw error;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
__name(generateDeclarationFile, "generateDeclarationFile");
|
|
46
|
+
|
|
47
|
+
export {
|
|
48
|
+
generateDeclaration,
|
|
49
|
+
generateDeclarationFile
|
|
50
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// ../config-tools/src/utilities/correct-paths.ts
|
|
5
|
+
import { joinPathFragments } from "@nx/devkit";
|
|
6
|
+
var correctPaths = /* @__PURE__ */ __name((path) => {
|
|
7
|
+
if (!path) {
|
|
8
|
+
return "";
|
|
9
|
+
}
|
|
10
|
+
if (!path.toUpperCase().startsWith("C:") && path.includes("\\")) {
|
|
11
|
+
path = `C:${path}`;
|
|
12
|
+
}
|
|
13
|
+
return path.replaceAll("\\", "/");
|
|
14
|
+
}, "correctPaths");
|
|
15
|
+
var joinPaths = /* @__PURE__ */ __name((...paths) => {
|
|
16
|
+
if (!paths || paths.length === 0) {
|
|
17
|
+
return "";
|
|
18
|
+
}
|
|
19
|
+
return correctPaths(joinPathFragments(...paths.map((path) => correctPaths(path))));
|
|
20
|
+
}, "joinPaths");
|
|
21
|
+
|
|
22
|
+
// src/utilities.ts
|
|
23
|
+
var getOutputFile = /* @__PURE__ */ __name((file, extension) => {
|
|
24
|
+
let fileName = file.name.slice(0, file.name.lastIndexOf(".")).replace(".schema", "").replace("schema", "");
|
|
25
|
+
if (!fileName) {
|
|
26
|
+
fileName = "schema";
|
|
27
|
+
}
|
|
28
|
+
if (extension === "json" && fileName !== "schema") {
|
|
29
|
+
fileName = `${fileName}.schema`;
|
|
30
|
+
}
|
|
31
|
+
return joinPaths(file.parentPath, `${fileName}.${extension}`);
|
|
32
|
+
}, "getOutputFile");
|
|
33
|
+
|
|
34
|
+
export {
|
|
35
|
+
__name,
|
|
36
|
+
joinPaths,
|
|
37
|
+
getOutputFile
|
|
38
|
+
};
|