@embeddable.com/sdk-utils 0.6.2 → 0.7.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.esm.js +29 -29
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +29 -29
- package/lib/index.js.map +1 -1
- package/package.json +2 -1
package/lib/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var promises = require('node:fs/promises');
|
|
4
4
|
var node_path = require('node:path');
|
|
5
5
|
var node_child_process = require('node:child_process');
|
|
6
|
+
var ora = require('ora');
|
|
6
7
|
var crypto = require('node:crypto');
|
|
7
8
|
|
|
8
9
|
function _interopNamespaceDefault(e) {
|
|
@@ -45,7 +46,6 @@ var findFiles = async (initialSrcDir, regex) => {
|
|
|
45
46
|
};
|
|
46
47
|
|
|
47
48
|
var runProcess = async ({ processFile, ctx, initMessage, successMessage, failMessage, }) => {
|
|
48
|
-
const ora = (await import('ora')).default;
|
|
49
49
|
const spinner = ora(initMessage).start();
|
|
50
50
|
try {
|
|
51
51
|
await promisifyForkedProcess(processFile, ctx);
|
|
@@ -596,12 +596,12 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
596
596
|
***************************************************************************** */
|
|
597
597
|
|
|
598
598
|
function __classPrivateFieldGet(receiver, state, kind, f) {
|
|
599
|
-
if (typeof state === "function" ? receiver !== state ||
|
|
599
|
+
if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
600
600
|
return state.get(receiver);
|
|
601
601
|
}
|
|
602
602
|
|
|
603
603
|
function __classPrivateFieldSet(receiver, state, value, kind, f) {
|
|
604
|
-
if (typeof state === "function" ? receiver !== state ||
|
|
604
|
+
if (typeof state === "function" ? receiver !== state || true : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
605
605
|
return (state.set(receiver, value)), value;
|
|
606
606
|
}
|
|
607
607
|
|
|
@@ -613,7 +613,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
613
613
|
var errorUtil;
|
|
614
614
|
(function (errorUtil) {
|
|
615
615
|
errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
616
|
-
errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message ===
|
|
616
|
+
errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === undefined ? undefined : message.message;
|
|
617
617
|
})(errorUtil || (errorUtil = {}));
|
|
618
618
|
|
|
619
619
|
var _ZodEnum_cache, _ZodNativeEnum_cache;
|
|
@@ -670,14 +670,14 @@ function processCreateParams(params) {
|
|
|
670
670
|
var _a, _b;
|
|
671
671
|
const { message } = params;
|
|
672
672
|
if (iss.code === "invalid_enum_value") {
|
|
673
|
-
return { message: message !== null && message !==
|
|
673
|
+
return { message: message !== null && message !== undefined ? message : ctx.defaultError };
|
|
674
674
|
}
|
|
675
675
|
if (typeof ctx.data === "undefined") {
|
|
676
|
-
return { message: (_a = message !== null && message !==
|
|
676
|
+
return { message: (_a = message !== null && message !== undefined ? message : required_error) !== null && _a !== undefined ? _a : ctx.defaultError };
|
|
677
677
|
}
|
|
678
678
|
if (iss.code !== "invalid_type")
|
|
679
679
|
return { message: ctx.defaultError };
|
|
680
|
-
return { message: (_b = message !== null && message !==
|
|
680
|
+
return { message: (_b = message !== null && message !== undefined ? message : invalid_type_error) !== null && _b !== undefined ? _b : ctx.defaultError };
|
|
681
681
|
};
|
|
682
682
|
return { errorMap: customMap, description };
|
|
683
683
|
}
|
|
@@ -762,10 +762,10 @@ class ZodType {
|
|
|
762
762
|
const ctx = {
|
|
763
763
|
common: {
|
|
764
764
|
issues: [],
|
|
765
|
-
async: (_a = params === null || params ===
|
|
766
|
-
contextualErrorMap: params === null || params ===
|
|
765
|
+
async: (_a = params === null || params === undefined ? undefined : params.async) !== null && _a !== undefined ? _a : false,
|
|
766
|
+
contextualErrorMap: params === null || params === undefined ? undefined : params.errorMap,
|
|
767
767
|
},
|
|
768
|
-
path: (params === null || params ===
|
|
768
|
+
path: (params === null || params === undefined ? undefined : params.path) || [],
|
|
769
769
|
schemaErrorMap: this._def.errorMap,
|
|
770
770
|
parent: null,
|
|
771
771
|
data,
|
|
@@ -784,10 +784,10 @@ class ZodType {
|
|
|
784
784
|
const ctx = {
|
|
785
785
|
common: {
|
|
786
786
|
issues: [],
|
|
787
|
-
contextualErrorMap: params === null || params ===
|
|
787
|
+
contextualErrorMap: params === null || params === undefined ? undefined : params.errorMap,
|
|
788
788
|
async: true,
|
|
789
789
|
},
|
|
790
|
-
path: (params === null || params ===
|
|
790
|
+
path: (params === null || params === undefined ? undefined : params.path) || [],
|
|
791
791
|
schemaErrorMap: this._def.errorMap,
|
|
792
792
|
parent: null,
|
|
793
793
|
data,
|
|
@@ -1359,10 +1359,10 @@ class ZodString extends ZodType {
|
|
|
1359
1359
|
}
|
|
1360
1360
|
return this._addCheck({
|
|
1361
1361
|
kind: "datetime",
|
|
1362
|
-
precision: typeof (options === null || options ===
|
|
1363
|
-
offset: (_a = options === null || options ===
|
|
1364
|
-
local: (_b = options === null || options ===
|
|
1365
|
-
...errorUtil.errToObj(options === null || options ===
|
|
1362
|
+
precision: typeof (options === null || options === undefined ? undefined : options.precision) === "undefined" ? null : options === null || options === undefined ? undefined : options.precision,
|
|
1363
|
+
offset: (_a = options === null || options === undefined ? undefined : options.offset) !== null && _a !== undefined ? _a : false,
|
|
1364
|
+
local: (_b = options === null || options === undefined ? undefined : options.local) !== null && _b !== undefined ? _b : false,
|
|
1365
|
+
...errorUtil.errToObj(options === null || options === undefined ? undefined : options.message),
|
|
1366
1366
|
});
|
|
1367
1367
|
}
|
|
1368
1368
|
date(message) {
|
|
@@ -1378,8 +1378,8 @@ class ZodString extends ZodType {
|
|
|
1378
1378
|
}
|
|
1379
1379
|
return this._addCheck({
|
|
1380
1380
|
kind: "time",
|
|
1381
|
-
precision: typeof (options === null || options ===
|
|
1382
|
-
...errorUtil.errToObj(options === null || options ===
|
|
1381
|
+
precision: typeof (options === null || options === undefined ? undefined : options.precision) === "undefined" ? null : options === null || options === undefined ? undefined : options.precision,
|
|
1382
|
+
...errorUtil.errToObj(options === null || options === undefined ? undefined : options.message),
|
|
1383
1383
|
});
|
|
1384
1384
|
}
|
|
1385
1385
|
duration(message) {
|
|
@@ -1396,8 +1396,8 @@ class ZodString extends ZodType {
|
|
|
1396
1396
|
return this._addCheck({
|
|
1397
1397
|
kind: "includes",
|
|
1398
1398
|
value: value,
|
|
1399
|
-
position: options === null || options ===
|
|
1400
|
-
...errorUtil.errToObj(options === null || options ===
|
|
1399
|
+
position: options === null || options === undefined ? undefined : options.position,
|
|
1400
|
+
...errorUtil.errToObj(options === null || options === undefined ? undefined : options.message),
|
|
1401
1401
|
});
|
|
1402
1402
|
}
|
|
1403
1403
|
startsWith(value, message) {
|
|
@@ -1528,7 +1528,7 @@ ZodString.create = (params) => {
|
|
|
1528
1528
|
return new ZodString({
|
|
1529
1529
|
checks: [],
|
|
1530
1530
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
1531
|
-
coerce: (_a = params === null || params ===
|
|
1531
|
+
coerce: (_a = params === null || params === undefined ? undefined : params.coerce) !== null && _a !== undefined ? _a : false,
|
|
1532
1532
|
...processCreateParams(params),
|
|
1533
1533
|
});
|
|
1534
1534
|
};
|
|
@@ -1782,7 +1782,7 @@ ZodNumber.create = (params) => {
|
|
|
1782
1782
|
return new ZodNumber({
|
|
1783
1783
|
checks: [],
|
|
1784
1784
|
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
|
1785
|
-
coerce: (params === null || params ===
|
|
1785
|
+
coerce: (params === null || params === undefined ? undefined : params.coerce) || false,
|
|
1786
1786
|
...processCreateParams(params),
|
|
1787
1787
|
});
|
|
1788
1788
|
};
|
|
@@ -1955,7 +1955,7 @@ ZodBigInt.create = (params) => {
|
|
|
1955
1955
|
return new ZodBigInt({
|
|
1956
1956
|
checks: [],
|
|
1957
1957
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
1958
|
-
coerce: (_a = params === null || params ===
|
|
1958
|
+
coerce: (_a = params === null || params === undefined ? undefined : params.coerce) !== null && _a !== undefined ? _a : false,
|
|
1959
1959
|
...processCreateParams(params),
|
|
1960
1960
|
});
|
|
1961
1961
|
};
|
|
@@ -1980,7 +1980,7 @@ class ZodBoolean extends ZodType {
|
|
|
1980
1980
|
ZodBoolean.create = (params) => {
|
|
1981
1981
|
return new ZodBoolean({
|
|
1982
1982
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
1983
|
-
coerce: (params === null || params ===
|
|
1983
|
+
coerce: (params === null || params === undefined ? undefined : params.coerce) || false,
|
|
1984
1984
|
...processCreateParams(params),
|
|
1985
1985
|
});
|
|
1986
1986
|
};
|
|
@@ -2090,7 +2090,7 @@ class ZodDate extends ZodType {
|
|
|
2090
2090
|
ZodDate.create = (params) => {
|
|
2091
2091
|
return new ZodDate({
|
|
2092
2092
|
checks: [],
|
|
2093
|
-
coerce: (params === null || params ===
|
|
2093
|
+
coerce: (params === null || params === undefined ? undefined : params.coerce) || false,
|
|
2094
2094
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
|
2095
2095
|
...processCreateParams(params),
|
|
2096
2096
|
});
|
|
@@ -2518,10 +2518,10 @@ class ZodObject extends ZodType {
|
|
|
2518
2518
|
? {
|
|
2519
2519
|
errorMap: (issue, ctx) => {
|
|
2520
2520
|
var _a, _b, _c, _d;
|
|
2521
|
-
const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b ===
|
|
2521
|
+
const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === undefined ? undefined : _b.call(_a, issue, ctx).message) !== null && _c !== undefined ? _c : ctx.defaultError;
|
|
2522
2522
|
if (issue.code === "unrecognized_keys")
|
|
2523
2523
|
return {
|
|
2524
|
-
message: (_d = errorUtil.errToObj(message).message) !== null && _d !==
|
|
2524
|
+
message: (_d = errorUtil.errToObj(message).message) !== null && _d !== undefined ? _d : defaultError,
|
|
2525
2525
|
};
|
|
2526
2526
|
return {
|
|
2527
2527
|
message: defaultError,
|
|
@@ -3531,7 +3531,7 @@ function createZodEnum(values, params) {
|
|
|
3531
3531
|
class ZodEnum extends ZodType {
|
|
3532
3532
|
constructor() {
|
|
3533
3533
|
super(...arguments);
|
|
3534
|
-
_ZodEnum_cache.set(this,
|
|
3534
|
+
_ZodEnum_cache.set(this, undefined);
|
|
3535
3535
|
}
|
|
3536
3536
|
_parse(input) {
|
|
3537
3537
|
if (typeof input.data !== "string") {
|
|
@@ -3601,7 +3601,7 @@ ZodEnum.create = createZodEnum;
|
|
|
3601
3601
|
class ZodNativeEnum extends ZodType {
|
|
3602
3602
|
constructor() {
|
|
3603
3603
|
super(...arguments);
|
|
3604
|
-
_ZodNativeEnum_cache.set(this,
|
|
3604
|
+
_ZodNativeEnum_cache.set(this, undefined);
|
|
3605
3605
|
}
|
|
3606
3606
|
_parse(input) {
|
|
3607
3607
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|