@schemavaults/app-definitions 0.6.16 → 0.6.18
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/dist/get-app-environment.cjs +392 -247
- package/dist/index.cjs +430 -285
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -85,10 +85,123 @@ __export(src_exports, {
|
|
|
85
85
|
});
|
|
86
86
|
module.exports = __toCommonJS(src_exports);
|
|
87
87
|
|
|
88
|
-
// ../../node_modules/.bun/zod@3.
|
|
88
|
+
// ../../node_modules/.bun/zod@3.25.8/node_modules/zod/dist/esm/v3/external.js
|
|
89
|
+
var external_exports = {};
|
|
90
|
+
__export(external_exports, {
|
|
91
|
+
BRAND: () => BRAND,
|
|
92
|
+
DIRTY: () => DIRTY,
|
|
93
|
+
EMPTY_PATH: () => EMPTY_PATH,
|
|
94
|
+
INVALID: () => INVALID,
|
|
95
|
+
NEVER: () => NEVER,
|
|
96
|
+
OK: () => OK,
|
|
97
|
+
ParseStatus: () => ParseStatus,
|
|
98
|
+
Schema: () => ZodType,
|
|
99
|
+
ZodAny: () => ZodAny,
|
|
100
|
+
ZodArray: () => ZodArray,
|
|
101
|
+
ZodBigInt: () => ZodBigInt,
|
|
102
|
+
ZodBoolean: () => ZodBoolean,
|
|
103
|
+
ZodBranded: () => ZodBranded,
|
|
104
|
+
ZodCatch: () => ZodCatch,
|
|
105
|
+
ZodDate: () => ZodDate,
|
|
106
|
+
ZodDefault: () => ZodDefault,
|
|
107
|
+
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
108
|
+
ZodEffects: () => ZodEffects,
|
|
109
|
+
ZodEnum: () => ZodEnum,
|
|
110
|
+
ZodError: () => ZodError,
|
|
111
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
112
|
+
ZodFunction: () => ZodFunction,
|
|
113
|
+
ZodIntersection: () => ZodIntersection,
|
|
114
|
+
ZodIssueCode: () => ZodIssueCode,
|
|
115
|
+
ZodLazy: () => ZodLazy,
|
|
116
|
+
ZodLiteral: () => ZodLiteral,
|
|
117
|
+
ZodMap: () => ZodMap,
|
|
118
|
+
ZodNaN: () => ZodNaN,
|
|
119
|
+
ZodNativeEnum: () => ZodNativeEnum,
|
|
120
|
+
ZodNever: () => ZodNever,
|
|
121
|
+
ZodNull: () => ZodNull,
|
|
122
|
+
ZodNullable: () => ZodNullable,
|
|
123
|
+
ZodNumber: () => ZodNumber,
|
|
124
|
+
ZodObject: () => ZodObject,
|
|
125
|
+
ZodOptional: () => ZodOptional,
|
|
126
|
+
ZodParsedType: () => ZodParsedType,
|
|
127
|
+
ZodPipeline: () => ZodPipeline,
|
|
128
|
+
ZodPromise: () => ZodPromise,
|
|
129
|
+
ZodReadonly: () => ZodReadonly,
|
|
130
|
+
ZodRecord: () => ZodRecord,
|
|
131
|
+
ZodSchema: () => ZodType,
|
|
132
|
+
ZodSet: () => ZodSet,
|
|
133
|
+
ZodString: () => ZodString,
|
|
134
|
+
ZodSymbol: () => ZodSymbol,
|
|
135
|
+
ZodTransformer: () => ZodEffects,
|
|
136
|
+
ZodTuple: () => ZodTuple,
|
|
137
|
+
ZodType: () => ZodType,
|
|
138
|
+
ZodUndefined: () => ZodUndefined,
|
|
139
|
+
ZodUnion: () => ZodUnion,
|
|
140
|
+
ZodUnknown: () => ZodUnknown,
|
|
141
|
+
ZodVoid: () => ZodVoid,
|
|
142
|
+
addIssueToContext: () => addIssueToContext,
|
|
143
|
+
any: () => anyType,
|
|
144
|
+
array: () => arrayType,
|
|
145
|
+
bigint: () => bigIntType,
|
|
146
|
+
boolean: () => booleanType,
|
|
147
|
+
coerce: () => coerce,
|
|
148
|
+
custom: () => custom,
|
|
149
|
+
date: () => dateType,
|
|
150
|
+
datetimeRegex: () => datetimeRegex,
|
|
151
|
+
defaultErrorMap: () => en_default,
|
|
152
|
+
discriminatedUnion: () => discriminatedUnionType,
|
|
153
|
+
effect: () => effectsType,
|
|
154
|
+
enum: () => enumType,
|
|
155
|
+
function: () => functionType,
|
|
156
|
+
getErrorMap: () => getErrorMap,
|
|
157
|
+
getParsedType: () => getParsedType,
|
|
158
|
+
instanceof: () => instanceOfType,
|
|
159
|
+
intersection: () => intersectionType,
|
|
160
|
+
isAborted: () => isAborted,
|
|
161
|
+
isAsync: () => isAsync,
|
|
162
|
+
isDirty: () => isDirty,
|
|
163
|
+
isValid: () => isValid,
|
|
164
|
+
late: () => late,
|
|
165
|
+
lazy: () => lazyType,
|
|
166
|
+
literal: () => literalType,
|
|
167
|
+
makeIssue: () => makeIssue,
|
|
168
|
+
map: () => mapType,
|
|
169
|
+
nan: () => nanType,
|
|
170
|
+
nativeEnum: () => nativeEnumType,
|
|
171
|
+
never: () => neverType,
|
|
172
|
+
null: () => nullType,
|
|
173
|
+
nullable: () => nullableType,
|
|
174
|
+
number: () => numberType,
|
|
175
|
+
object: () => objectType,
|
|
176
|
+
objectUtil: () => objectUtil,
|
|
177
|
+
oboolean: () => oboolean,
|
|
178
|
+
onumber: () => onumber,
|
|
179
|
+
optional: () => optionalType,
|
|
180
|
+
ostring: () => ostring,
|
|
181
|
+
pipeline: () => pipelineType,
|
|
182
|
+
preprocess: () => preprocessType,
|
|
183
|
+
promise: () => promiseType,
|
|
184
|
+
quotelessJson: () => quotelessJson,
|
|
185
|
+
record: () => recordType,
|
|
186
|
+
set: () => setType,
|
|
187
|
+
setErrorMap: () => setErrorMap,
|
|
188
|
+
strictObject: () => strictObjectType,
|
|
189
|
+
string: () => stringType,
|
|
190
|
+
symbol: () => symbolType,
|
|
191
|
+
transformer: () => effectsType,
|
|
192
|
+
tuple: () => tupleType,
|
|
193
|
+
undefined: () => undefinedType,
|
|
194
|
+
union: () => unionType,
|
|
195
|
+
unknown: () => unknownType,
|
|
196
|
+
util: () => util,
|
|
197
|
+
void: () => voidType
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// ../../node_modules/.bun/zod@3.25.8/node_modules/zod/dist/esm/v3/helpers/util.js
|
|
89
201
|
var util;
|
|
90
202
|
(function(util2) {
|
|
91
|
-
util2.assertEqual = (
|
|
203
|
+
util2.assertEqual = (_) => {
|
|
204
|
+
};
|
|
92
205
|
function assertIs(_arg) {
|
|
93
206
|
}
|
|
94
207
|
util2.assertIs = assertIs;
|
|
@@ -132,7 +245,7 @@ var util;
|
|
|
132
245
|
}
|
|
133
246
|
return void 0;
|
|
134
247
|
};
|
|
135
|
-
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
|
|
248
|
+
util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
|
|
136
249
|
function joinValues(array, separator = " | ") {
|
|
137
250
|
return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
|
|
138
251
|
}
|
|
@@ -184,7 +297,7 @@ var getParsedType = (data) => {
|
|
|
184
297
|
case "string":
|
|
185
298
|
return ZodParsedType.string;
|
|
186
299
|
case "number":
|
|
187
|
-
return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
300
|
+
return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
|
|
188
301
|
case "boolean":
|
|
189
302
|
return ZodParsedType.boolean;
|
|
190
303
|
case "function":
|
|
@@ -217,6 +330,8 @@ var getParsedType = (data) => {
|
|
|
217
330
|
return ZodParsedType.unknown;
|
|
218
331
|
}
|
|
219
332
|
};
|
|
333
|
+
|
|
334
|
+
// ../../node_modules/.bun/zod@3.25.8/node_modules/zod/dist/esm/v3/ZodError.js
|
|
220
335
|
var ZodIssueCode = util.arrayToEnum([
|
|
221
336
|
"invalid_type",
|
|
222
337
|
"invalid_literal",
|
|
@@ -240,6 +355,9 @@ var quotelessJson = (obj) => {
|
|
|
240
355
|
return json.replace(/"([^"]+)":/g, "$1:");
|
|
241
356
|
};
|
|
242
357
|
var ZodError = class _ZodError extends Error {
|
|
358
|
+
get errors() {
|
|
359
|
+
return this.issues;
|
|
360
|
+
}
|
|
243
361
|
constructor(issues) {
|
|
244
362
|
super();
|
|
245
363
|
this.issues = [];
|
|
@@ -258,9 +376,6 @@ var ZodError = class _ZodError extends Error {
|
|
|
258
376
|
this.name = "ZodError";
|
|
259
377
|
this.issues = issues;
|
|
260
378
|
}
|
|
261
|
-
get errors() {
|
|
262
|
-
return this.issues;
|
|
263
|
-
}
|
|
264
379
|
format(_mapper) {
|
|
265
380
|
const mapper = _mapper || function(issue) {
|
|
266
381
|
return issue.message;
|
|
@@ -332,6 +447,8 @@ ZodError.create = (issues) => {
|
|
|
332
447
|
const error = new ZodError(issues);
|
|
333
448
|
return error;
|
|
334
449
|
};
|
|
450
|
+
|
|
451
|
+
// ../../node_modules/.bun/zod@3.25.8/node_modules/zod/dist/esm/v3/locales/en.js
|
|
335
452
|
var errorMap = (issue, _ctx) => {
|
|
336
453
|
let message;
|
|
337
454
|
switch (issue.code) {
|
|
@@ -430,13 +547,18 @@ var errorMap = (issue, _ctx) => {
|
|
|
430
547
|
}
|
|
431
548
|
return { message };
|
|
432
549
|
};
|
|
433
|
-
var
|
|
550
|
+
var en_default = errorMap;
|
|
551
|
+
|
|
552
|
+
// ../../node_modules/.bun/zod@3.25.8/node_modules/zod/dist/esm/v3/errors.js
|
|
553
|
+
var overrideErrorMap = en_default;
|
|
434
554
|
function setErrorMap(map) {
|
|
435
555
|
overrideErrorMap = map;
|
|
436
556
|
}
|
|
437
557
|
function getErrorMap() {
|
|
438
558
|
return overrideErrorMap;
|
|
439
559
|
}
|
|
560
|
+
|
|
561
|
+
// ../../node_modules/.bun/zod@3.25.8/node_modules/zod/dist/esm/v3/helpers/parseUtil.js
|
|
440
562
|
var makeIssue = (params) => {
|
|
441
563
|
const { data, path, errorMaps, issueData } = params;
|
|
442
564
|
const fullPath = [...path, ...issueData.path || []];
|
|
@@ -471,9 +593,12 @@ function addIssueToContext(ctx, issueData) {
|
|
|
471
593
|
path: ctx.path,
|
|
472
594
|
errorMaps: [
|
|
473
595
|
ctx.common.contextualErrorMap,
|
|
596
|
+
// contextual error map is first priority
|
|
474
597
|
ctx.schemaErrorMap,
|
|
598
|
+
// then schema-bound map if available
|
|
475
599
|
overrideMap,
|
|
476
|
-
|
|
600
|
+
// then global override map
|
|
601
|
+
overrideMap === en_default ? void 0 : en_default
|
|
477
602
|
// then global default map
|
|
478
603
|
].filter((x) => !!x)
|
|
479
604
|
});
|
|
@@ -542,22 +667,26 @@ var isAborted = (x) => x.status === "aborted";
|
|
|
542
667
|
var isDirty = (x) => x.status === "dirty";
|
|
543
668
|
var isValid = (x) => x.status === "valid";
|
|
544
669
|
var isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
545
|
-
|
|
670
|
+
|
|
671
|
+
// ../../node_modules/.bun/zod@3.25.8/node_modules/zod/dist/esm/v3/helpers/errorUtil.js
|
|
672
|
+
var errorUtil;
|
|
673
|
+
(function(errorUtil2) {
|
|
674
|
+
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
675
|
+
errorUtil2.toString = (message) => typeof message === "string" ? message : message?.message;
|
|
676
|
+
})(errorUtil || (errorUtil = {}));
|
|
677
|
+
|
|
678
|
+
// ../../node_modules/.bun/zod@3.25.8/node_modules/zod/dist/esm/v3/types.js
|
|
679
|
+
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
546
680
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
547
681
|
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");
|
|
548
682
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
549
|
-
}
|
|
550
|
-
|
|
683
|
+
};
|
|
684
|
+
var __classPrivateFieldSet = function(receiver, state, value, kind, f) {
|
|
551
685
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
552
686
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
553
687
|
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");
|
|
554
688
|
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
555
|
-
}
|
|
556
|
-
var errorUtil;
|
|
557
|
-
(function(errorUtil2) {
|
|
558
|
-
errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
|
|
559
|
-
errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
|
|
560
|
-
})(errorUtil || (errorUtil = {}));
|
|
689
|
+
};
|
|
561
690
|
var _ZodEnum_cache;
|
|
562
691
|
var _ZodNativeEnum_cache;
|
|
563
692
|
var ParseInputLazyPath = class {
|
|
@@ -570,7 +699,7 @@ var ParseInputLazyPath = class {
|
|
|
570
699
|
}
|
|
571
700
|
get path() {
|
|
572
701
|
if (!this._cachedPath.length) {
|
|
573
|
-
if (this._key
|
|
702
|
+
if (Array.isArray(this._key)) {
|
|
574
703
|
this._cachedPath.push(...this._path, ...this._key);
|
|
575
704
|
} else {
|
|
576
705
|
this._cachedPath.push(...this._path, this._key);
|
|
@@ -608,49 +737,20 @@ function processCreateParams(params) {
|
|
|
608
737
|
if (errorMap2)
|
|
609
738
|
return { errorMap: errorMap2, description };
|
|
610
739
|
const customMap = (iss, ctx) => {
|
|
611
|
-
var _a, _b;
|
|
612
740
|
const { message } = params;
|
|
613
741
|
if (iss.code === "invalid_enum_value") {
|
|
614
|
-
return { message: message
|
|
742
|
+
return { message: message ?? ctx.defaultError };
|
|
615
743
|
}
|
|
616
744
|
if (typeof ctx.data === "undefined") {
|
|
617
|
-
return { message:
|
|
745
|
+
return { message: message ?? required_error ?? ctx.defaultError };
|
|
618
746
|
}
|
|
619
747
|
if (iss.code !== "invalid_type")
|
|
620
748
|
return { message: ctx.defaultError };
|
|
621
|
-
return { message:
|
|
749
|
+
return { message: message ?? invalid_type_error ?? ctx.defaultError };
|
|
622
750
|
};
|
|
623
751
|
return { errorMap: customMap, description };
|
|
624
752
|
}
|
|
625
753
|
var ZodType = class {
|
|
626
|
-
constructor(def) {
|
|
627
|
-
this.spa = this.safeParseAsync;
|
|
628
|
-
this._def = def;
|
|
629
|
-
this.parse = this.parse.bind(this);
|
|
630
|
-
this.safeParse = this.safeParse.bind(this);
|
|
631
|
-
this.parseAsync = this.parseAsync.bind(this);
|
|
632
|
-
this.safeParseAsync = this.safeParseAsync.bind(this);
|
|
633
|
-
this.spa = this.spa.bind(this);
|
|
634
|
-
this.refine = this.refine.bind(this);
|
|
635
|
-
this.refinement = this.refinement.bind(this);
|
|
636
|
-
this.superRefine = this.superRefine.bind(this);
|
|
637
|
-
this.optional = this.optional.bind(this);
|
|
638
|
-
this.nullable = this.nullable.bind(this);
|
|
639
|
-
this.nullish = this.nullish.bind(this);
|
|
640
|
-
this.array = this.array.bind(this);
|
|
641
|
-
this.promise = this.promise.bind(this);
|
|
642
|
-
this.or = this.or.bind(this);
|
|
643
|
-
this.and = this.and.bind(this);
|
|
644
|
-
this.transform = this.transform.bind(this);
|
|
645
|
-
this.brand = this.brand.bind(this);
|
|
646
|
-
this.default = this.default.bind(this);
|
|
647
|
-
this.catch = this.catch.bind(this);
|
|
648
|
-
this.describe = this.describe.bind(this);
|
|
649
|
-
this.pipe = this.pipe.bind(this);
|
|
650
|
-
this.readonly = this.readonly.bind(this);
|
|
651
|
-
this.isNullable = this.isNullable.bind(this);
|
|
652
|
-
this.isOptional = this.isOptional.bind(this);
|
|
653
|
-
}
|
|
654
754
|
get description() {
|
|
655
755
|
return this._def.description;
|
|
656
756
|
}
|
|
@@ -698,14 +798,13 @@ var ZodType = class {
|
|
|
698
798
|
throw result.error;
|
|
699
799
|
}
|
|
700
800
|
safeParse(data, params) {
|
|
701
|
-
var _a;
|
|
702
801
|
const ctx = {
|
|
703
802
|
common: {
|
|
704
803
|
issues: [],
|
|
705
|
-
async:
|
|
706
|
-
contextualErrorMap: params
|
|
804
|
+
async: params?.async ?? false,
|
|
805
|
+
contextualErrorMap: params?.errorMap
|
|
707
806
|
},
|
|
708
|
-
path:
|
|
807
|
+
path: params?.path || [],
|
|
709
808
|
schemaErrorMap: this._def.errorMap,
|
|
710
809
|
parent: null,
|
|
711
810
|
data,
|
|
@@ -714,6 +813,42 @@ var ZodType = class {
|
|
|
714
813
|
const result = this._parseSync({ data, path: ctx.path, parent: ctx });
|
|
715
814
|
return handleResult(ctx, result);
|
|
716
815
|
}
|
|
816
|
+
"~validate"(data) {
|
|
817
|
+
const ctx = {
|
|
818
|
+
common: {
|
|
819
|
+
issues: [],
|
|
820
|
+
async: !!this["~standard"].async
|
|
821
|
+
},
|
|
822
|
+
path: [],
|
|
823
|
+
schemaErrorMap: this._def.errorMap,
|
|
824
|
+
parent: null,
|
|
825
|
+
data,
|
|
826
|
+
parsedType: getParsedType(data)
|
|
827
|
+
};
|
|
828
|
+
if (!this["~standard"].async) {
|
|
829
|
+
try {
|
|
830
|
+
const result = this._parseSync({ data, path: [], parent: ctx });
|
|
831
|
+
return isValid(result) ? {
|
|
832
|
+
value: result.value
|
|
833
|
+
} : {
|
|
834
|
+
issues: ctx.common.issues
|
|
835
|
+
};
|
|
836
|
+
} catch (err) {
|
|
837
|
+
if (err?.message?.toLowerCase()?.includes("encountered")) {
|
|
838
|
+
this["~standard"].async = true;
|
|
839
|
+
}
|
|
840
|
+
ctx.common = {
|
|
841
|
+
issues: [],
|
|
842
|
+
async: true
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
return this._parseAsync({ data, path: [], parent: ctx }).then((result) => isValid(result) ? {
|
|
847
|
+
value: result.value
|
|
848
|
+
} : {
|
|
849
|
+
issues: ctx.common.issues
|
|
850
|
+
});
|
|
851
|
+
}
|
|
717
852
|
async parseAsync(data, params) {
|
|
718
853
|
const result = await this.safeParseAsync(data, params);
|
|
719
854
|
if (result.success)
|
|
@@ -724,10 +859,10 @@ var ZodType = class {
|
|
|
724
859
|
const ctx = {
|
|
725
860
|
common: {
|
|
726
861
|
issues: [],
|
|
727
|
-
contextualErrorMap: params
|
|
862
|
+
contextualErrorMap: params?.errorMap,
|
|
728
863
|
async: true
|
|
729
864
|
},
|
|
730
|
-
path:
|
|
865
|
+
path: params?.path || [],
|
|
731
866
|
schemaErrorMap: this._def.errorMap,
|
|
732
867
|
parent: null,
|
|
733
868
|
data,
|
|
@@ -791,6 +926,39 @@ var ZodType = class {
|
|
|
791
926
|
superRefine(refinement) {
|
|
792
927
|
return this._refinement(refinement);
|
|
793
928
|
}
|
|
929
|
+
constructor(def) {
|
|
930
|
+
this.spa = this.safeParseAsync;
|
|
931
|
+
this._def = def;
|
|
932
|
+
this.parse = this.parse.bind(this);
|
|
933
|
+
this.safeParse = this.safeParse.bind(this);
|
|
934
|
+
this.parseAsync = this.parseAsync.bind(this);
|
|
935
|
+
this.safeParseAsync = this.safeParseAsync.bind(this);
|
|
936
|
+
this.spa = this.spa.bind(this);
|
|
937
|
+
this.refine = this.refine.bind(this);
|
|
938
|
+
this.refinement = this.refinement.bind(this);
|
|
939
|
+
this.superRefine = this.superRefine.bind(this);
|
|
940
|
+
this.optional = this.optional.bind(this);
|
|
941
|
+
this.nullable = this.nullable.bind(this);
|
|
942
|
+
this.nullish = this.nullish.bind(this);
|
|
943
|
+
this.array = this.array.bind(this);
|
|
944
|
+
this.promise = this.promise.bind(this);
|
|
945
|
+
this.or = this.or.bind(this);
|
|
946
|
+
this.and = this.and.bind(this);
|
|
947
|
+
this.transform = this.transform.bind(this);
|
|
948
|
+
this.brand = this.brand.bind(this);
|
|
949
|
+
this.default = this.default.bind(this);
|
|
950
|
+
this.catch = this.catch.bind(this);
|
|
951
|
+
this.describe = this.describe.bind(this);
|
|
952
|
+
this.pipe = this.pipe.bind(this);
|
|
953
|
+
this.readonly = this.readonly.bind(this);
|
|
954
|
+
this.isNullable = this.isNullable.bind(this);
|
|
955
|
+
this.isOptional = this.isOptional.bind(this);
|
|
956
|
+
this["~standard"] = {
|
|
957
|
+
version: 1,
|
|
958
|
+
vendor: "zod",
|
|
959
|
+
validate: (data) => this["~validate"](data)
|
|
960
|
+
};
|
|
961
|
+
}
|
|
794
962
|
optional() {
|
|
795
963
|
return ZodOptional.create(this, this._def);
|
|
796
964
|
}
|
|
@@ -801,7 +969,7 @@ var ZodType = class {
|
|
|
801
969
|
return this.nullable().optional();
|
|
802
970
|
}
|
|
803
971
|
array() {
|
|
804
|
-
return ZodArray.create(this
|
|
972
|
+
return ZodArray.create(this);
|
|
805
973
|
}
|
|
806
974
|
promise() {
|
|
807
975
|
return ZodPromise.create(this, this._def);
|
|
@@ -867,26 +1035,31 @@ var ZodType = class {
|
|
|
867
1035
|
};
|
|
868
1036
|
var cuidRegex = /^c[^\s-]{8,}$/i;
|
|
869
1037
|
var cuid2Regex = /^[0-9a-z]+$/;
|
|
870
|
-
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}
|
|
1038
|
+
var ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
|
|
871
1039
|
var uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
|
|
872
1040
|
var nanoidRegex = /^[a-z0-9_-]{21}$/i;
|
|
1041
|
+
var jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
|
873
1042
|
var durationRegex = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
|
874
1043
|
var emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
875
1044
|
var _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
876
1045
|
var emojiRegex;
|
|
877
1046
|
var ipv4Regex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
878
|
-
var
|
|
1047
|
+
var ipv4CidrRegex = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
|
|
1048
|
+
var ipv6Regex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
|
1049
|
+
var ipv6CidrRegex = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
879
1050
|
var base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
1051
|
+
var base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
|
|
880
1052
|
var dateRegexSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
|
|
881
1053
|
var dateRegex = new RegExp(`^${dateRegexSource}$`);
|
|
882
1054
|
function timeRegexSource(args) {
|
|
883
|
-
let
|
|
1055
|
+
let secondsRegexSource = `[0-5]\\d`;
|
|
884
1056
|
if (args.precision) {
|
|
885
|
-
|
|
1057
|
+
secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
|
|
886
1058
|
} else if (args.precision == null) {
|
|
887
|
-
|
|
1059
|
+
secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
|
|
888
1060
|
}
|
|
889
|
-
|
|
1061
|
+
const secondsQuantifier = args.precision ? "+" : "?";
|
|
1062
|
+
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
|
890
1063
|
}
|
|
891
1064
|
function timeRegex(args) {
|
|
892
1065
|
return new RegExp(`^${timeRegexSource(args)}$`);
|
|
@@ -909,6 +1082,35 @@ function isValidIP(ip, version) {
|
|
|
909
1082
|
}
|
|
910
1083
|
return false;
|
|
911
1084
|
}
|
|
1085
|
+
function isValidJWT(jwt, alg) {
|
|
1086
|
+
if (!jwtRegex.test(jwt))
|
|
1087
|
+
return false;
|
|
1088
|
+
try {
|
|
1089
|
+
const [header] = jwt.split(".");
|
|
1090
|
+
const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
|
|
1091
|
+
const decoded = JSON.parse(atob(base64));
|
|
1092
|
+
if (typeof decoded !== "object" || decoded === null)
|
|
1093
|
+
return false;
|
|
1094
|
+
if ("typ" in decoded && decoded?.typ !== "JWT")
|
|
1095
|
+
return false;
|
|
1096
|
+
if (!decoded.alg)
|
|
1097
|
+
return false;
|
|
1098
|
+
if (alg && decoded.alg !== alg)
|
|
1099
|
+
return false;
|
|
1100
|
+
return true;
|
|
1101
|
+
} catch {
|
|
1102
|
+
return false;
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
function isValidCidr(ip, version) {
|
|
1106
|
+
if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) {
|
|
1107
|
+
return true;
|
|
1108
|
+
}
|
|
1109
|
+
if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) {
|
|
1110
|
+
return true;
|
|
1111
|
+
}
|
|
1112
|
+
return false;
|
|
1113
|
+
}
|
|
912
1114
|
var ZodString = class _ZodString extends ZodType {
|
|
913
1115
|
_parse(input) {
|
|
914
1116
|
if (this._def.coerce) {
|
|
@@ -1055,7 +1257,7 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
1055
1257
|
} else if (check.kind === "url") {
|
|
1056
1258
|
try {
|
|
1057
1259
|
new URL(input.data);
|
|
1058
|
-
} catch
|
|
1260
|
+
} catch {
|
|
1059
1261
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
1060
1262
|
addIssueToContext(ctx, {
|
|
1061
1263
|
validation: "url",
|
|
@@ -1165,6 +1367,26 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
1165
1367
|
});
|
|
1166
1368
|
status.dirty();
|
|
1167
1369
|
}
|
|
1370
|
+
} else if (check.kind === "jwt") {
|
|
1371
|
+
if (!isValidJWT(input.data, check.alg)) {
|
|
1372
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1373
|
+
addIssueToContext(ctx, {
|
|
1374
|
+
validation: "jwt",
|
|
1375
|
+
code: ZodIssueCode.invalid_string,
|
|
1376
|
+
message: check.message
|
|
1377
|
+
});
|
|
1378
|
+
status.dirty();
|
|
1379
|
+
}
|
|
1380
|
+
} else if (check.kind === "cidr") {
|
|
1381
|
+
if (!isValidCidr(input.data, check.version)) {
|
|
1382
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1383
|
+
addIssueToContext(ctx, {
|
|
1384
|
+
validation: "cidr",
|
|
1385
|
+
code: ZodIssueCode.invalid_string,
|
|
1386
|
+
message: check.message
|
|
1387
|
+
});
|
|
1388
|
+
status.dirty();
|
|
1389
|
+
}
|
|
1168
1390
|
} else if (check.kind === "base64") {
|
|
1169
1391
|
if (!base64Regex.test(input.data)) {
|
|
1170
1392
|
ctx = this._getOrReturnCtx(input, ctx);
|
|
@@ -1175,6 +1397,16 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
1175
1397
|
});
|
|
1176
1398
|
status.dirty();
|
|
1177
1399
|
}
|
|
1400
|
+
} else if (check.kind === "base64url") {
|
|
1401
|
+
if (!base64urlRegex.test(input.data)) {
|
|
1402
|
+
ctx = this._getOrReturnCtx(input, ctx);
|
|
1403
|
+
addIssueToContext(ctx, {
|
|
1404
|
+
validation: "base64url",
|
|
1405
|
+
code: ZodIssueCode.invalid_string,
|
|
1406
|
+
message: check.message
|
|
1407
|
+
});
|
|
1408
|
+
status.dirty();
|
|
1409
|
+
}
|
|
1178
1410
|
} else {
|
|
1179
1411
|
util.assertNever(check);
|
|
1180
1412
|
}
|
|
@@ -1221,11 +1453,22 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
1221
1453
|
base64(message) {
|
|
1222
1454
|
return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
|
|
1223
1455
|
}
|
|
1456
|
+
base64url(message) {
|
|
1457
|
+
return this._addCheck({
|
|
1458
|
+
kind: "base64url",
|
|
1459
|
+
...errorUtil.errToObj(message)
|
|
1460
|
+
});
|
|
1461
|
+
}
|
|
1462
|
+
jwt(options) {
|
|
1463
|
+
return this._addCheck({ kind: "jwt", ...errorUtil.errToObj(options) });
|
|
1464
|
+
}
|
|
1224
1465
|
ip(options) {
|
|
1225
1466
|
return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
|
|
1226
1467
|
}
|
|
1468
|
+
cidr(options) {
|
|
1469
|
+
return this._addCheck({ kind: "cidr", ...errorUtil.errToObj(options) });
|
|
1470
|
+
}
|
|
1227
1471
|
datetime(options) {
|
|
1228
|
-
var _a, _b;
|
|
1229
1472
|
if (typeof options === "string") {
|
|
1230
1473
|
return this._addCheck({
|
|
1231
1474
|
kind: "datetime",
|
|
@@ -1237,10 +1480,10 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
1237
1480
|
}
|
|
1238
1481
|
return this._addCheck({
|
|
1239
1482
|
kind: "datetime",
|
|
1240
|
-
precision: typeof
|
|
1241
|
-
offset:
|
|
1242
|
-
local:
|
|
1243
|
-
...errorUtil.errToObj(options
|
|
1483
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
1484
|
+
offset: options?.offset ?? false,
|
|
1485
|
+
local: options?.local ?? false,
|
|
1486
|
+
...errorUtil.errToObj(options?.message)
|
|
1244
1487
|
});
|
|
1245
1488
|
}
|
|
1246
1489
|
date(message) {
|
|
@@ -1256,8 +1499,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
1256
1499
|
}
|
|
1257
1500
|
return this._addCheck({
|
|
1258
1501
|
kind: "time",
|
|
1259
|
-
precision: typeof
|
|
1260
|
-
...errorUtil.errToObj(options
|
|
1502
|
+
precision: typeof options?.precision === "undefined" ? null : options?.precision,
|
|
1503
|
+
...errorUtil.errToObj(options?.message)
|
|
1261
1504
|
});
|
|
1262
1505
|
}
|
|
1263
1506
|
duration(message) {
|
|
@@ -1274,8 +1517,8 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
1274
1517
|
return this._addCheck({
|
|
1275
1518
|
kind: "includes",
|
|
1276
1519
|
value,
|
|
1277
|
-
position: options
|
|
1278
|
-
...errorUtil.errToObj(options
|
|
1520
|
+
position: options?.position,
|
|
1521
|
+
...errorUtil.errToObj(options?.message)
|
|
1279
1522
|
});
|
|
1280
1523
|
}
|
|
1281
1524
|
startsWith(value, message) {
|
|
@@ -1314,8 +1557,7 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
1314
1557
|
});
|
|
1315
1558
|
}
|
|
1316
1559
|
/**
|
|
1317
|
-
*
|
|
1318
|
-
* @see {@link ZodString.min}
|
|
1560
|
+
* Equivalent to `.min(1)`
|
|
1319
1561
|
*/
|
|
1320
1562
|
nonempty(message) {
|
|
1321
1563
|
return this.min(1, errorUtil.errToObj(message));
|
|
@@ -1377,9 +1619,15 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
1377
1619
|
get isIP() {
|
|
1378
1620
|
return !!this._def.checks.find((ch) => ch.kind === "ip");
|
|
1379
1621
|
}
|
|
1622
|
+
get isCIDR() {
|
|
1623
|
+
return !!this._def.checks.find((ch) => ch.kind === "cidr");
|
|
1624
|
+
}
|
|
1380
1625
|
get isBase64() {
|
|
1381
1626
|
return !!this._def.checks.find((ch) => ch.kind === "base64");
|
|
1382
1627
|
}
|
|
1628
|
+
get isBase64url() {
|
|
1629
|
+
return !!this._def.checks.find((ch) => ch.kind === "base64url");
|
|
1630
|
+
}
|
|
1383
1631
|
get minLength() {
|
|
1384
1632
|
let min = null;
|
|
1385
1633
|
for (const ch of this._def.checks) {
|
|
@@ -1402,11 +1650,10 @@ var ZodString = class _ZodString extends ZodType {
|
|
|
1402
1650
|
}
|
|
1403
1651
|
};
|
|
1404
1652
|
ZodString.create = (params) => {
|
|
1405
|
-
var _a;
|
|
1406
1653
|
return new ZodString({
|
|
1407
1654
|
checks: [],
|
|
1408
1655
|
typeName: ZodFirstPartyTypeKind.ZodString,
|
|
1409
|
-
coerce:
|
|
1656
|
+
coerce: params?.coerce ?? false,
|
|
1410
1657
|
...processCreateParams(params)
|
|
1411
1658
|
});
|
|
1412
1659
|
};
|
|
@@ -1414,9 +1661,9 @@ function floatSafeRemainder(val, step) {
|
|
|
1414
1661
|
const valDecCount = (val.toString().split(".")[1] || "").length;
|
|
1415
1662
|
const stepDecCount = (step.toString().split(".")[1] || "").length;
|
|
1416
1663
|
const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
|
|
1417
|
-
const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
|
|
1418
|
-
const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
|
|
1419
|
-
return valInt % stepInt /
|
|
1664
|
+
const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
|
|
1665
|
+
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
1666
|
+
return valInt % stepInt / 10 ** decCount;
|
|
1420
1667
|
}
|
|
1421
1668
|
var ZodNumber = class _ZodNumber extends ZodType {
|
|
1422
1669
|
constructor() {
|
|
@@ -1626,7 +1873,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
1626
1873
|
return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
|
|
1627
1874
|
}
|
|
1628
1875
|
get isFinite() {
|
|
1629
|
-
let max = null
|
|
1876
|
+
let max = null;
|
|
1877
|
+
let min = null;
|
|
1630
1878
|
for (const ch of this._def.checks) {
|
|
1631
1879
|
if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
|
|
1632
1880
|
return true;
|
|
@@ -1645,7 +1893,7 @@ ZodNumber.create = (params) => {
|
|
|
1645
1893
|
return new ZodNumber({
|
|
1646
1894
|
checks: [],
|
|
1647
1895
|
typeName: ZodFirstPartyTypeKind.ZodNumber,
|
|
1648
|
-
coerce:
|
|
1896
|
+
coerce: params?.coerce || false,
|
|
1649
1897
|
...processCreateParams(params)
|
|
1650
1898
|
});
|
|
1651
1899
|
};
|
|
@@ -1657,17 +1905,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
1657
1905
|
}
|
|
1658
1906
|
_parse(input) {
|
|
1659
1907
|
if (this._def.coerce) {
|
|
1660
|
-
|
|
1908
|
+
try {
|
|
1909
|
+
input.data = BigInt(input.data);
|
|
1910
|
+
} catch {
|
|
1911
|
+
return this._getInvalidInput(input);
|
|
1912
|
+
}
|
|
1661
1913
|
}
|
|
1662
1914
|
const parsedType = this._getType(input);
|
|
1663
1915
|
if (parsedType !== ZodParsedType.bigint) {
|
|
1664
|
-
|
|
1665
|
-
addIssueToContext(ctx2, {
|
|
1666
|
-
code: ZodIssueCode.invalid_type,
|
|
1667
|
-
expected: ZodParsedType.bigint,
|
|
1668
|
-
received: ctx2.parsedType
|
|
1669
|
-
});
|
|
1670
|
-
return INVALID;
|
|
1916
|
+
return this._getInvalidInput(input);
|
|
1671
1917
|
}
|
|
1672
1918
|
let ctx = void 0;
|
|
1673
1919
|
const status = new ParseStatus();
|
|
@@ -1714,6 +1960,15 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
1714
1960
|
}
|
|
1715
1961
|
return { status: status.value, value: input.data };
|
|
1716
1962
|
}
|
|
1963
|
+
_getInvalidInput(input) {
|
|
1964
|
+
const ctx = this._getOrReturnCtx(input);
|
|
1965
|
+
addIssueToContext(ctx, {
|
|
1966
|
+
code: ZodIssueCode.invalid_type,
|
|
1967
|
+
expected: ZodParsedType.bigint,
|
|
1968
|
+
received: ctx.parsedType
|
|
1969
|
+
});
|
|
1970
|
+
return INVALID;
|
|
1971
|
+
}
|
|
1717
1972
|
gte(value, message) {
|
|
1718
1973
|
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
1719
1974
|
}
|
|
@@ -1807,11 +2062,10 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
1807
2062
|
}
|
|
1808
2063
|
};
|
|
1809
2064
|
ZodBigInt.create = (params) => {
|
|
1810
|
-
var _a;
|
|
1811
2065
|
return new ZodBigInt({
|
|
1812
2066
|
checks: [],
|
|
1813
2067
|
typeName: ZodFirstPartyTypeKind.ZodBigInt,
|
|
1814
|
-
coerce:
|
|
2068
|
+
coerce: params?.coerce ?? false,
|
|
1815
2069
|
...processCreateParams(params)
|
|
1816
2070
|
});
|
|
1817
2071
|
};
|
|
@@ -1836,7 +2090,7 @@ var ZodBoolean = class extends ZodType {
|
|
|
1836
2090
|
ZodBoolean.create = (params) => {
|
|
1837
2091
|
return new ZodBoolean({
|
|
1838
2092
|
typeName: ZodFirstPartyTypeKind.ZodBoolean,
|
|
1839
|
-
coerce:
|
|
2093
|
+
coerce: params?.coerce || false,
|
|
1840
2094
|
...processCreateParams(params)
|
|
1841
2095
|
});
|
|
1842
2096
|
};
|
|
@@ -1855,7 +2109,7 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
|
1855
2109
|
});
|
|
1856
2110
|
return INVALID;
|
|
1857
2111
|
}
|
|
1858
|
-
if (isNaN(input.data.getTime())) {
|
|
2112
|
+
if (Number.isNaN(input.data.getTime())) {
|
|
1859
2113
|
const ctx2 = this._getOrReturnCtx(input);
|
|
1860
2114
|
addIssueToContext(ctx2, {
|
|
1861
2115
|
code: ZodIssueCode.invalid_date
|
|
@@ -1944,7 +2198,7 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
|
1944
2198
|
ZodDate.create = (params) => {
|
|
1945
2199
|
return new ZodDate({
|
|
1946
2200
|
checks: [],
|
|
1947
|
-
coerce:
|
|
2201
|
+
coerce: params?.coerce || false,
|
|
1948
2202
|
typeName: ZodFirstPartyTypeKind.ZodDate,
|
|
1949
2203
|
...processCreateParams(params)
|
|
1950
2204
|
});
|
|
@@ -2219,7 +2473,8 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
2219
2473
|
return this._cached;
|
|
2220
2474
|
const shape = this._def.shape();
|
|
2221
2475
|
const keys = util.objectKeys(shape);
|
|
2222
|
-
|
|
2476
|
+
this._cached = { shape, keys };
|
|
2477
|
+
return this._cached;
|
|
2223
2478
|
}
|
|
2224
2479
|
_parse(input) {
|
|
2225
2480
|
const parsedType = this._getType(input);
|
|
@@ -2269,8 +2524,8 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
2269
2524
|
});
|
|
2270
2525
|
status.dirty();
|
|
2271
2526
|
}
|
|
2272
|
-
} else if (unknownKeys === "strip")
|
|
2273
|
-
else {
|
|
2527
|
+
} else if (unknownKeys === "strip") {
|
|
2528
|
+
} else {
|
|
2274
2529
|
throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
|
|
2275
2530
|
}
|
|
2276
2531
|
} else {
|
|
@@ -2317,11 +2572,10 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
2317
2572
|
unknownKeys: "strict",
|
|
2318
2573
|
...message !== void 0 ? {
|
|
2319
2574
|
errorMap: (issue, ctx) => {
|
|
2320
|
-
|
|
2321
|
-
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;
|
|
2575
|
+
const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
|
|
2322
2576
|
if (issue.code === "unrecognized_keys")
|
|
2323
2577
|
return {
|
|
2324
|
-
message:
|
|
2578
|
+
message: errorUtil.errToObj(message).message ?? defaultError
|
|
2325
2579
|
};
|
|
2326
2580
|
return {
|
|
2327
2581
|
message: defaultError
|
|
@@ -2452,11 +2706,11 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
2452
2706
|
}
|
|
2453
2707
|
pick(mask) {
|
|
2454
2708
|
const shape = {};
|
|
2455
|
-
util.objectKeys(mask)
|
|
2709
|
+
for (const key of util.objectKeys(mask)) {
|
|
2456
2710
|
if (mask[key] && this.shape[key]) {
|
|
2457
2711
|
shape[key] = this.shape[key];
|
|
2458
2712
|
}
|
|
2459
|
-
}
|
|
2713
|
+
}
|
|
2460
2714
|
return new _ZodObject({
|
|
2461
2715
|
...this._def,
|
|
2462
2716
|
shape: () => shape
|
|
@@ -2464,11 +2718,11 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
2464
2718
|
}
|
|
2465
2719
|
omit(mask) {
|
|
2466
2720
|
const shape = {};
|
|
2467
|
-
util.objectKeys(this.shape)
|
|
2721
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
2468
2722
|
if (!mask[key]) {
|
|
2469
2723
|
shape[key] = this.shape[key];
|
|
2470
2724
|
}
|
|
2471
|
-
}
|
|
2725
|
+
}
|
|
2472
2726
|
return new _ZodObject({
|
|
2473
2727
|
...this._def,
|
|
2474
2728
|
shape: () => shape
|
|
@@ -2482,14 +2736,14 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
2482
2736
|
}
|
|
2483
2737
|
partial(mask) {
|
|
2484
2738
|
const newShape = {};
|
|
2485
|
-
util.objectKeys(this.shape)
|
|
2739
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
2486
2740
|
const fieldSchema = this.shape[key];
|
|
2487
2741
|
if (mask && !mask[key]) {
|
|
2488
2742
|
newShape[key] = fieldSchema;
|
|
2489
2743
|
} else {
|
|
2490
2744
|
newShape[key] = fieldSchema.optional();
|
|
2491
2745
|
}
|
|
2492
|
-
}
|
|
2746
|
+
}
|
|
2493
2747
|
return new _ZodObject({
|
|
2494
2748
|
...this._def,
|
|
2495
2749
|
shape: () => newShape
|
|
@@ -2497,7 +2751,7 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
2497
2751
|
}
|
|
2498
2752
|
required(mask) {
|
|
2499
2753
|
const newShape = {};
|
|
2500
|
-
util.objectKeys(this.shape)
|
|
2754
|
+
for (const key of util.objectKeys(this.shape)) {
|
|
2501
2755
|
if (mask && !mask[key]) {
|
|
2502
2756
|
newShape[key] = this.shape[key];
|
|
2503
2757
|
} else {
|
|
@@ -2508,7 +2762,7 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
2508
2762
|
}
|
|
2509
2763
|
newShape[key] = newField;
|
|
2510
2764
|
}
|
|
2511
|
-
}
|
|
2765
|
+
}
|
|
2512
2766
|
return new _ZodObject({
|
|
2513
2767
|
...this._def,
|
|
2514
2768
|
shape: () => newShape
|
|
@@ -3124,12 +3378,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
|
|
|
3124
3378
|
return makeIssue({
|
|
3125
3379
|
data: args,
|
|
3126
3380
|
path: ctx.path,
|
|
3127
|
-
errorMaps: [
|
|
3128
|
-
ctx.common.contextualErrorMap,
|
|
3129
|
-
ctx.schemaErrorMap,
|
|
3130
|
-
getErrorMap(),
|
|
3131
|
-
errorMap
|
|
3132
|
-
].filter((x) => !!x),
|
|
3381
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
|
3133
3382
|
issueData: {
|
|
3134
3383
|
code: ZodIssueCode.invalid_arguments,
|
|
3135
3384
|
argumentsError: error
|
|
@@ -3140,12 +3389,7 @@ var ZodFunction = class _ZodFunction extends ZodType {
|
|
|
3140
3389
|
return makeIssue({
|
|
3141
3390
|
data: returns,
|
|
3142
3391
|
path: ctx.path,
|
|
3143
|
-
errorMaps: [
|
|
3144
|
-
ctx.common.contextualErrorMap,
|
|
3145
|
-
ctx.schemaErrorMap,
|
|
3146
|
-
getErrorMap(),
|
|
3147
|
-
errorMap
|
|
3148
|
-
].filter((x) => !!x),
|
|
3392
|
+
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x) => !!x),
|
|
3149
3393
|
issueData: {
|
|
3150
3394
|
code: ZodIssueCode.invalid_return_type,
|
|
3151
3395
|
returnTypeError: error
|
|
@@ -3524,7 +3768,10 @@ var ZodEffects = class extends ZodType {
|
|
|
3524
3768
|
return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
|
|
3525
3769
|
if (!isValid(base))
|
|
3526
3770
|
return base;
|
|
3527
|
-
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
3771
|
+
return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
|
|
3772
|
+
status: status.value,
|
|
3773
|
+
value: result
|
|
3774
|
+
}));
|
|
3528
3775
|
});
|
|
3529
3776
|
}
|
|
3530
3777
|
}
|
|
@@ -3776,16 +4023,30 @@ ZodReadonly.create = (type, params) => {
|
|
|
3776
4023
|
...processCreateParams(params)
|
|
3777
4024
|
});
|
|
3778
4025
|
};
|
|
3779
|
-
function
|
|
4026
|
+
function cleanParams(params, data) {
|
|
4027
|
+
const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
|
|
4028
|
+
const p2 = typeof p === "string" ? { message: p } : p;
|
|
4029
|
+
return p2;
|
|
4030
|
+
}
|
|
4031
|
+
function custom(check, _params = {}, fatal) {
|
|
3780
4032
|
if (check)
|
|
3781
4033
|
return ZodAny.create().superRefine((data, ctx) => {
|
|
3782
|
-
|
|
3783
|
-
if (
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
4034
|
+
const r = check(data);
|
|
4035
|
+
if (r instanceof Promise) {
|
|
4036
|
+
return r.then((r2) => {
|
|
4037
|
+
if (!r2) {
|
|
4038
|
+
const params = cleanParams(_params, data);
|
|
4039
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
4040
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
4041
|
+
}
|
|
4042
|
+
});
|
|
3788
4043
|
}
|
|
4044
|
+
if (!r) {
|
|
4045
|
+
const params = cleanParams(_params, data);
|
|
4046
|
+
const _fatal = params.fatal ?? fatal ?? true;
|
|
4047
|
+
ctx.addIssue({ code: "custom", ...params, fatal: _fatal });
|
|
4048
|
+
}
|
|
4049
|
+
return;
|
|
3789
4050
|
});
|
|
3790
4051
|
return ZodAny.create();
|
|
3791
4052
|
}
|
|
@@ -3882,122 +4143,6 @@ var coerce = {
|
|
|
3882
4143
|
date: (arg) => ZodDate.create({ ...arg, coerce: true })
|
|
3883
4144
|
};
|
|
3884
4145
|
var NEVER = INVALID;
|
|
3885
|
-
var z = /* @__PURE__ */ Object.freeze({
|
|
3886
|
-
__proto__: null,
|
|
3887
|
-
defaultErrorMap: errorMap,
|
|
3888
|
-
setErrorMap,
|
|
3889
|
-
getErrorMap,
|
|
3890
|
-
makeIssue,
|
|
3891
|
-
EMPTY_PATH,
|
|
3892
|
-
addIssueToContext,
|
|
3893
|
-
ParseStatus,
|
|
3894
|
-
INVALID,
|
|
3895
|
-
DIRTY,
|
|
3896
|
-
OK,
|
|
3897
|
-
isAborted,
|
|
3898
|
-
isDirty,
|
|
3899
|
-
isValid,
|
|
3900
|
-
isAsync,
|
|
3901
|
-
get util() {
|
|
3902
|
-
return util;
|
|
3903
|
-
},
|
|
3904
|
-
get objectUtil() {
|
|
3905
|
-
return objectUtil;
|
|
3906
|
-
},
|
|
3907
|
-
ZodParsedType,
|
|
3908
|
-
getParsedType,
|
|
3909
|
-
ZodType,
|
|
3910
|
-
datetimeRegex,
|
|
3911
|
-
ZodString,
|
|
3912
|
-
ZodNumber,
|
|
3913
|
-
ZodBigInt,
|
|
3914
|
-
ZodBoolean,
|
|
3915
|
-
ZodDate,
|
|
3916
|
-
ZodSymbol,
|
|
3917
|
-
ZodUndefined,
|
|
3918
|
-
ZodNull,
|
|
3919
|
-
ZodAny,
|
|
3920
|
-
ZodUnknown,
|
|
3921
|
-
ZodNever,
|
|
3922
|
-
ZodVoid,
|
|
3923
|
-
ZodArray,
|
|
3924
|
-
ZodObject,
|
|
3925
|
-
ZodUnion,
|
|
3926
|
-
ZodDiscriminatedUnion,
|
|
3927
|
-
ZodIntersection,
|
|
3928
|
-
ZodTuple,
|
|
3929
|
-
ZodRecord,
|
|
3930
|
-
ZodMap,
|
|
3931
|
-
ZodSet,
|
|
3932
|
-
ZodFunction,
|
|
3933
|
-
ZodLazy,
|
|
3934
|
-
ZodLiteral,
|
|
3935
|
-
ZodEnum,
|
|
3936
|
-
ZodNativeEnum,
|
|
3937
|
-
ZodPromise,
|
|
3938
|
-
ZodEffects,
|
|
3939
|
-
ZodTransformer: ZodEffects,
|
|
3940
|
-
ZodOptional,
|
|
3941
|
-
ZodNullable,
|
|
3942
|
-
ZodDefault,
|
|
3943
|
-
ZodCatch,
|
|
3944
|
-
ZodNaN,
|
|
3945
|
-
BRAND,
|
|
3946
|
-
ZodBranded,
|
|
3947
|
-
ZodPipeline,
|
|
3948
|
-
ZodReadonly,
|
|
3949
|
-
custom,
|
|
3950
|
-
Schema: ZodType,
|
|
3951
|
-
ZodSchema: ZodType,
|
|
3952
|
-
late,
|
|
3953
|
-
get ZodFirstPartyTypeKind() {
|
|
3954
|
-
return ZodFirstPartyTypeKind;
|
|
3955
|
-
},
|
|
3956
|
-
coerce,
|
|
3957
|
-
any: anyType,
|
|
3958
|
-
array: arrayType,
|
|
3959
|
-
bigint: bigIntType,
|
|
3960
|
-
boolean: booleanType,
|
|
3961
|
-
date: dateType,
|
|
3962
|
-
discriminatedUnion: discriminatedUnionType,
|
|
3963
|
-
effect: effectsType,
|
|
3964
|
-
"enum": enumType,
|
|
3965
|
-
"function": functionType,
|
|
3966
|
-
"instanceof": instanceOfType,
|
|
3967
|
-
intersection: intersectionType,
|
|
3968
|
-
lazy: lazyType,
|
|
3969
|
-
literal: literalType,
|
|
3970
|
-
map: mapType,
|
|
3971
|
-
nan: nanType,
|
|
3972
|
-
nativeEnum: nativeEnumType,
|
|
3973
|
-
never: neverType,
|
|
3974
|
-
"null": nullType,
|
|
3975
|
-
nullable: nullableType,
|
|
3976
|
-
number: numberType,
|
|
3977
|
-
object: objectType,
|
|
3978
|
-
oboolean,
|
|
3979
|
-
onumber,
|
|
3980
|
-
optional: optionalType,
|
|
3981
|
-
ostring,
|
|
3982
|
-
pipeline: pipelineType,
|
|
3983
|
-
preprocess: preprocessType,
|
|
3984
|
-
promise: promiseType,
|
|
3985
|
-
record: recordType,
|
|
3986
|
-
set: setType,
|
|
3987
|
-
strictObject: strictObjectType,
|
|
3988
|
-
string: stringType,
|
|
3989
|
-
symbol: symbolType,
|
|
3990
|
-
transformer: effectsType,
|
|
3991
|
-
tuple: tupleType,
|
|
3992
|
-
"undefined": undefinedType,
|
|
3993
|
-
union: unionType,
|
|
3994
|
-
unknown: unknownType,
|
|
3995
|
-
"void": voidType,
|
|
3996
|
-
NEVER,
|
|
3997
|
-
ZodIssueCode,
|
|
3998
|
-
quotelessJson,
|
|
3999
|
-
ZodError
|
|
4000
|
-
});
|
|
4001
4146
|
|
|
4002
4147
|
// src/default-hardcoded-app-creation-time.ts
|
|
4003
4148
|
var defaultHardcodedAppCreationTime = new Date(
|
|
@@ -4057,7 +4202,7 @@ var HARDCODED_CORE_SCHEMAVAULTS_APPS_MAP = new Map(
|
|
|
4057
4202
|
var hardcoded_app_ids = HARDCODED_CORE_SCHEMAVAULTS_APPS.map(
|
|
4058
4203
|
(hardcoded_app) => hardcoded_app.app_id
|
|
4059
4204
|
);
|
|
4060
|
-
var hardcodedAppIdSchema =
|
|
4205
|
+
var hardcodedAppIdSchema = external_exports.string().refine((app_id) => {
|
|
4061
4206
|
return hardcoded_app_ids.includes(app_id);
|
|
4062
4207
|
}, "Invalid hardcoded app ID");
|
|
4063
4208
|
function isHardcodedAppId(app_id) {
|
|
@@ -4076,8 +4221,8 @@ function getHardcodedApp(app_id) {
|
|
|
4076
4221
|
}
|
|
4077
4222
|
|
|
4078
4223
|
// src/app-id.ts
|
|
4079
|
-
var appIdSchema =
|
|
4080
|
-
|
|
4224
|
+
var appIdSchema = external_exports.union([
|
|
4225
|
+
external_exports.string().uuid(),
|
|
4081
4226
|
// dynamically defined app
|
|
4082
4227
|
hardcodedAppIdSchema
|
|
4083
4228
|
]);
|
|
@@ -4089,22 +4234,22 @@ var schemaVaultsAppEnvironments = [
|
|
|
4089
4234
|
"test",
|
|
4090
4235
|
"production"
|
|
4091
4236
|
];
|
|
4092
|
-
var schemaVaultsAppEnvironmentSchema =
|
|
4237
|
+
var schemaVaultsAppEnvironmentSchema = external_exports.enum(
|
|
4093
4238
|
schemaVaultsAppEnvironments
|
|
4094
4239
|
);
|
|
4095
4240
|
|
|
4096
4241
|
// src/client-app-definition.ts
|
|
4097
|
-
var baseSchemaVaultsAppDefinitionSchema =
|
|
4098
|
-
app_id:
|
|
4099
|
-
app_name:
|
|
4100
|
-
app_description:
|
|
4101
|
-
created_at:
|
|
4102
|
-
public:
|
|
4242
|
+
var baseSchemaVaultsAppDefinitionSchema = external_exports.object({
|
|
4243
|
+
app_id: external_exports.string(),
|
|
4244
|
+
app_name: external_exports.string().max(64),
|
|
4245
|
+
app_description: external_exports.string().max(512),
|
|
4246
|
+
created_at: external_exports.number().nonnegative(),
|
|
4247
|
+
public: external_exports.boolean(),
|
|
4103
4248
|
// whether the app is publicly listed
|
|
4104
|
-
hardcoded:
|
|
4105
|
-
web:
|
|
4249
|
+
hardcoded: external_exports.boolean(),
|
|
4250
|
+
web: external_exports.boolean(),
|
|
4106
4251
|
// whether this app can be opened by url or requires native installation
|
|
4107
|
-
owner_organization_id:
|
|
4252
|
+
owner_organization_id: external_exports.string().nullable().optional()
|
|
4108
4253
|
}).required({
|
|
4109
4254
|
app_id: true,
|
|
4110
4255
|
app_name: true,
|
|
@@ -4117,13 +4262,13 @@ var schemaVaultsAppDefinitionSchema = baseSchemaVaultsAppDefinitionSchema.refine
|
|
|
4117
4262
|
(values) => appIdSchema.safeParse(values.app_id).success,
|
|
4118
4263
|
"Invalid client application ID"
|
|
4119
4264
|
);
|
|
4120
|
-
var schemaVaultsAppDomainRefSchema =
|
|
4121
|
-
app_domain_ref_id:
|
|
4265
|
+
var schemaVaultsAppDomainRefSchema = external_exports.object({
|
|
4266
|
+
app_domain_ref_id: external_exports.string().uuid(),
|
|
4122
4267
|
app_id: appIdSchema,
|
|
4123
|
-
domain:
|
|
4268
|
+
domain: external_exports.string().max(255),
|
|
4124
4269
|
environment: schemaVaultsAppEnvironmentSchema,
|
|
4125
|
-
created_at:
|
|
4126
|
-
hardcoded:
|
|
4270
|
+
created_at: external_exports.number().nonnegative(),
|
|
4271
|
+
hardcoded: external_exports.boolean()
|
|
4127
4272
|
}).required({
|
|
4128
4273
|
app_domain_ref_id: true,
|
|
4129
4274
|
app_id: true,
|
|
@@ -4144,7 +4289,7 @@ var list_apps_query_type = [
|
|
|
4144
4289
|
"org"
|
|
4145
4290
|
// apps owned by a specific organization
|
|
4146
4291
|
];
|
|
4147
|
-
var listAppsQueryTypeSchema =
|
|
4292
|
+
var listAppsQueryTypeSchema = external_exports.string().refine(
|
|
4148
4293
|
(val) => list_apps_query_type.includes(val),
|
|
4149
4294
|
`Invalid list apps query type. Should be one of: ${list_apps_query_type.map((val) => `"${val}"`).join(", ")}`
|
|
4150
4295
|
);
|
|
@@ -4193,7 +4338,7 @@ var HARDCODED_CORE_SCHEMAVAULTS_API_SERVERS_MAP = new Map(
|
|
|
4193
4338
|
var hardcoded_api_server_ids = HARDCODED_CORE_SCHEMAVAULTS_API_SERVERS.map(
|
|
4194
4339
|
(hardcoded_api_server_id) => hardcoded_api_server_id.api_server_id
|
|
4195
4340
|
);
|
|
4196
|
-
var hardcodedApiServerIdSchema =
|
|
4341
|
+
var hardcodedApiServerIdSchema = external_exports.string().refine((api_server_id) => {
|
|
4197
4342
|
return hardcoded_api_server_ids.includes(api_server_id);
|
|
4198
4343
|
}, "Invalid hardcoded API server ID");
|
|
4199
4344
|
function isHardcodedApiServerId(api_server_id) {
|
|
@@ -4216,22 +4361,22 @@ function getHardcodedApiServer(api_server_id) {
|
|
|
4216
4361
|
}
|
|
4217
4362
|
|
|
4218
4363
|
// src/api-server-id.ts
|
|
4219
|
-
var apiServerIdSchema =
|
|
4220
|
-
|
|
4364
|
+
var apiServerIdSchema = external_exports.union([
|
|
4365
|
+
external_exports.string().uuid(),
|
|
4221
4366
|
// dynamically defined api server
|
|
4222
4367
|
hardcodedApiServerIdSchema
|
|
4223
4368
|
]);
|
|
4224
4369
|
|
|
4225
4370
|
// src/api-server-definition.ts
|
|
4226
|
-
var baseSchemaVaultsApiServerDefinitionSchema =
|
|
4227
|
-
api_server_id:
|
|
4228
|
-
api_server_name:
|
|
4229
|
-
api_server_description:
|
|
4230
|
-
created_at:
|
|
4231
|
-
public:
|
|
4371
|
+
var baseSchemaVaultsApiServerDefinitionSchema = external_exports.object({
|
|
4372
|
+
api_server_id: external_exports.string(),
|
|
4373
|
+
api_server_name: external_exports.string().max(64),
|
|
4374
|
+
api_server_description: external_exports.string().max(512),
|
|
4375
|
+
created_at: external_exports.number().nonnegative(),
|
|
4376
|
+
public: external_exports.boolean(),
|
|
4232
4377
|
// whether the app is publicly listed
|
|
4233
|
-
hardcoded:
|
|
4234
|
-
owner_organization_id:
|
|
4378
|
+
hardcoded: external_exports.boolean(),
|
|
4379
|
+
owner_organization_id: external_exports.string().nullable().optional()
|
|
4235
4380
|
}).required({
|
|
4236
4381
|
api_server_id: true,
|
|
4237
4382
|
api_server_name: true,
|
|
@@ -4243,13 +4388,13 @@ var schemaVaultsApiServerDefinitionSchema = baseSchemaVaultsApiServerDefinitionS
|
|
|
4243
4388
|
(values) => apiServerIdSchema.safeParse(values.api_server_id).success,
|
|
4244
4389
|
"Invalid API server ID"
|
|
4245
4390
|
);
|
|
4246
|
-
var schemaVaultsApiServerDomainRefSchema =
|
|
4247
|
-
api_server_domain_ref_id:
|
|
4391
|
+
var schemaVaultsApiServerDomainRefSchema = external_exports.object({
|
|
4392
|
+
api_server_domain_ref_id: external_exports.string().uuid(),
|
|
4248
4393
|
api_server_id: apiServerIdSchema,
|
|
4249
|
-
domain:
|
|
4394
|
+
domain: external_exports.string().max(255),
|
|
4250
4395
|
environment: schemaVaultsAppEnvironmentSchema,
|
|
4251
|
-
created_at:
|
|
4252
|
-
hardcoded:
|
|
4396
|
+
created_at: external_exports.number().nonnegative(),
|
|
4397
|
+
hardcoded: external_exports.boolean()
|
|
4253
4398
|
}).required({
|
|
4254
4399
|
api_server_domain_ref_id: true,
|
|
4255
4400
|
api_server_id: true,
|
|
@@ -4265,17 +4410,17 @@ var list_api_servers_query_type = [
|
|
|
4265
4410
|
// admin-only
|
|
4266
4411
|
"org"
|
|
4267
4412
|
];
|
|
4268
|
-
var listApiServersQueryTypeSchema =
|
|
4413
|
+
var listApiServersQueryTypeSchema = external_exports.string().refine(
|
|
4269
4414
|
(val) => list_api_servers_query_type.includes(val),
|
|
4270
4415
|
`Invalid list API servers query type. Should be one of: ${list_api_servers_query_type.map((val) => `"${val}"`).join(", ")}`
|
|
4271
4416
|
);
|
|
4272
4417
|
|
|
4273
4418
|
// src/app_to_api_permission_def.ts
|
|
4274
|
-
var appToApiPermissionSchema =
|
|
4419
|
+
var appToApiPermissionSchema = external_exports.object({
|
|
4275
4420
|
client_app_id: appIdSchema,
|
|
4276
4421
|
api_server_id: apiServerIdSchema,
|
|
4277
|
-
created_at:
|
|
4278
|
-
created_by:
|
|
4422
|
+
created_at: external_exports.number().nonnegative(),
|
|
4423
|
+
created_by: external_exports.string().uuid().optional().nullable()
|
|
4279
4424
|
}).required({
|
|
4280
4425
|
client_app_id: true,
|
|
4281
4426
|
api_server_id: true,
|