@embeddable.com/sdk-utils 0.6.2-next.0 → 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 CHANGED
@@ -1,6 +1,7 @@
1
1
  import { readdir, lstat } from 'node:fs/promises';
2
2
  import { join } from 'node:path';
3
3
  import { fork } from 'node:child_process';
4
+ import ora from 'ora';
4
5
  import * as crypto from 'node:crypto';
5
6
 
6
7
  var findFiles = async (initialSrcDir, regex) => {
@@ -24,7 +25,6 @@ var findFiles = async (initialSrcDir, regex) => {
24
25
  };
25
26
 
26
27
  var runProcess = async ({ processFile, ctx, initMessage, successMessage, failMessage, }) => {
27
- const ora = (await import('ora')).default;
28
28
  const spinner = ora(initMessage).start();
29
29
  try {
30
30
  await promisifyForkedProcess(processFile, ctx);
@@ -575,12 +575,12 @@ PERFORMANCE OF THIS SOFTWARE.
575
575
  ***************************************************************************** */
576
576
 
577
577
  function __classPrivateFieldGet(receiver, state, kind, f) {
578
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
578
+ 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");
579
579
  return state.get(receiver);
580
580
  }
581
581
 
582
582
  function __classPrivateFieldSet(receiver, state, value, kind, f) {
583
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
583
+ 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");
584
584
  return (state.set(receiver, value)), value;
585
585
  }
586
586
 
@@ -592,7 +592,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
592
592
  var errorUtil;
593
593
  (function (errorUtil) {
594
594
  errorUtil.errToObj = (message) => typeof message === "string" ? { message } : message || {};
595
- errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
595
+ errorUtil.toString = (message) => typeof message === "string" ? message : message === null || message === undefined ? undefined : message.message;
596
596
  })(errorUtil || (errorUtil = {}));
597
597
 
598
598
  var _ZodEnum_cache, _ZodNativeEnum_cache;
@@ -649,14 +649,14 @@ function processCreateParams(params) {
649
649
  var _a, _b;
650
650
  const { message } = params;
651
651
  if (iss.code === "invalid_enum_value") {
652
- return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
652
+ return { message: message !== null && message !== undefined ? message : ctx.defaultError };
653
653
  }
654
654
  if (typeof ctx.data === "undefined") {
655
- return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
655
+ return { message: (_a = message !== null && message !== undefined ? message : required_error) !== null && _a !== undefined ? _a : ctx.defaultError };
656
656
  }
657
657
  if (iss.code !== "invalid_type")
658
658
  return { message: ctx.defaultError };
659
- return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
659
+ return { message: (_b = message !== null && message !== undefined ? message : invalid_type_error) !== null && _b !== undefined ? _b : ctx.defaultError };
660
660
  };
661
661
  return { errorMap: customMap, description };
662
662
  }
@@ -741,10 +741,10 @@ class ZodType {
741
741
  const ctx = {
742
742
  common: {
743
743
  issues: [],
744
- async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
745
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
744
+ async: (_a = params === null || params === undefined ? undefined : params.async) !== null && _a !== undefined ? _a : false,
745
+ contextualErrorMap: params === null || params === undefined ? undefined : params.errorMap,
746
746
  },
747
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
747
+ path: (params === null || params === undefined ? undefined : params.path) || [],
748
748
  schemaErrorMap: this._def.errorMap,
749
749
  parent: null,
750
750
  data,
@@ -763,10 +763,10 @@ class ZodType {
763
763
  const ctx = {
764
764
  common: {
765
765
  issues: [],
766
- contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
766
+ contextualErrorMap: params === null || params === undefined ? undefined : params.errorMap,
767
767
  async: true,
768
768
  },
769
- path: (params === null || params === void 0 ? void 0 : params.path) || [],
769
+ path: (params === null || params === undefined ? undefined : params.path) || [],
770
770
  schemaErrorMap: this._def.errorMap,
771
771
  parent: null,
772
772
  data,
@@ -1338,10 +1338,10 @@ class ZodString extends ZodType {
1338
1338
  }
1339
1339
  return this._addCheck({
1340
1340
  kind: "datetime",
1341
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1342
- offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
1343
- local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
1344
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
1341
+ precision: typeof (options === null || options === undefined ? undefined : options.precision) === "undefined" ? null : options === null || options === undefined ? undefined : options.precision,
1342
+ offset: (_a = options === null || options === undefined ? undefined : options.offset) !== null && _a !== undefined ? _a : false,
1343
+ local: (_b = options === null || options === undefined ? undefined : options.local) !== null && _b !== undefined ? _b : false,
1344
+ ...errorUtil.errToObj(options === null || options === undefined ? undefined : options.message),
1345
1345
  });
1346
1346
  }
1347
1347
  date(message) {
@@ -1357,8 +1357,8 @@ class ZodString extends ZodType {
1357
1357
  }
1358
1358
  return this._addCheck({
1359
1359
  kind: "time",
1360
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1361
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
1360
+ precision: typeof (options === null || options === undefined ? undefined : options.precision) === "undefined" ? null : options === null || options === undefined ? undefined : options.precision,
1361
+ ...errorUtil.errToObj(options === null || options === undefined ? undefined : options.message),
1362
1362
  });
1363
1363
  }
1364
1364
  duration(message) {
@@ -1375,8 +1375,8 @@ class ZodString extends ZodType {
1375
1375
  return this._addCheck({
1376
1376
  kind: "includes",
1377
1377
  value: value,
1378
- position: options === null || options === void 0 ? void 0 : options.position,
1379
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),
1378
+ position: options === null || options === undefined ? undefined : options.position,
1379
+ ...errorUtil.errToObj(options === null || options === undefined ? undefined : options.message),
1380
1380
  });
1381
1381
  }
1382
1382
  startsWith(value, message) {
@@ -1507,7 +1507,7 @@ ZodString.create = (params) => {
1507
1507
  return new ZodString({
1508
1508
  checks: [],
1509
1509
  typeName: ZodFirstPartyTypeKind.ZodString,
1510
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1510
+ coerce: (_a = params === null || params === undefined ? undefined : params.coerce) !== null && _a !== undefined ? _a : false,
1511
1511
  ...processCreateParams(params),
1512
1512
  });
1513
1513
  };
@@ -1761,7 +1761,7 @@ ZodNumber.create = (params) => {
1761
1761
  return new ZodNumber({
1762
1762
  checks: [],
1763
1763
  typeName: ZodFirstPartyTypeKind.ZodNumber,
1764
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
1764
+ coerce: (params === null || params === undefined ? undefined : params.coerce) || false,
1765
1765
  ...processCreateParams(params),
1766
1766
  });
1767
1767
  };
@@ -1934,7 +1934,7 @@ ZodBigInt.create = (params) => {
1934
1934
  return new ZodBigInt({
1935
1935
  checks: [],
1936
1936
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
1937
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1937
+ coerce: (_a = params === null || params === undefined ? undefined : params.coerce) !== null && _a !== undefined ? _a : false,
1938
1938
  ...processCreateParams(params),
1939
1939
  });
1940
1940
  };
@@ -1959,7 +1959,7 @@ class ZodBoolean extends ZodType {
1959
1959
  ZodBoolean.create = (params) => {
1960
1960
  return new ZodBoolean({
1961
1961
  typeName: ZodFirstPartyTypeKind.ZodBoolean,
1962
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
1962
+ coerce: (params === null || params === undefined ? undefined : params.coerce) || false,
1963
1963
  ...processCreateParams(params),
1964
1964
  });
1965
1965
  };
@@ -2069,7 +2069,7 @@ class ZodDate extends ZodType {
2069
2069
  ZodDate.create = (params) => {
2070
2070
  return new ZodDate({
2071
2071
  checks: [],
2072
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2072
+ coerce: (params === null || params === undefined ? undefined : params.coerce) || false,
2073
2073
  typeName: ZodFirstPartyTypeKind.ZodDate,
2074
2074
  ...processCreateParams(params),
2075
2075
  });
@@ -2497,10 +2497,10 @@ class ZodObject extends ZodType {
2497
2497
  ? {
2498
2498
  errorMap: (issue, ctx) => {
2499
2499
  var _a, _b, _c, _d;
2500
- const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
2500
+ const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === undefined ? undefined : _b.call(_a, issue, ctx).message) !== null && _c !== undefined ? _c : ctx.defaultError;
2501
2501
  if (issue.code === "unrecognized_keys")
2502
2502
  return {
2503
- message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError,
2503
+ message: (_d = errorUtil.errToObj(message).message) !== null && _d !== undefined ? _d : defaultError,
2504
2504
  };
2505
2505
  return {
2506
2506
  message: defaultError,
@@ -3510,7 +3510,7 @@ function createZodEnum(values, params) {
3510
3510
  class ZodEnum extends ZodType {
3511
3511
  constructor() {
3512
3512
  super(...arguments);
3513
- _ZodEnum_cache.set(this, void 0);
3513
+ _ZodEnum_cache.set(this, undefined);
3514
3514
  }
3515
3515
  _parse(input) {
3516
3516
  if (typeof input.data !== "string") {
@@ -3580,7 +3580,7 @@ ZodEnum.create = createZodEnum;
3580
3580
  class ZodNativeEnum extends ZodType {
3581
3581
  constructor() {
3582
3582
  super(...arguments);
3583
- _ZodNativeEnum_cache.set(this, void 0);
3583
+ _ZodNativeEnum_cache.set(this, undefined);
3584
3584
  }
3585
3585
  _parse(input) {
3586
3586
  const nativeEnumValues = util.getValidEnumValues(this._def.values);