@j0hanz/memdb 1.0.6 → 1.0.7
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.
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const DefaultOutputSchema: z.
|
|
3
|
-
ok: z.
|
|
4
|
-
result: z.ZodUnknown
|
|
5
|
-
|
|
6
|
-
ok: z.ZodLiteral<false>;
|
|
7
|
-
error: z.ZodObject<{
|
|
2
|
+
export declare const DefaultOutputSchema: z.ZodObject<{
|
|
3
|
+
ok: z.ZodBoolean;
|
|
4
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
5
|
+
error: z.ZodOptional<z.ZodObject<{
|
|
8
6
|
code: z.ZodString;
|
|
9
7
|
message: z.ZodString;
|
|
10
|
-
}, z.core.$strict
|
|
11
|
-
|
|
12
|
-
}, z.core.$strict>], "ok">;
|
|
8
|
+
}, z.core.$strict>>;
|
|
9
|
+
}, z.core.$strict>;
|
|
13
10
|
//# sourceMappingURL=outputs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputs.d.ts","sourceRoot":"","sources":["../../src/schemas/outputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,mBAAmB
|
|
1
|
+
{"version":3,"file":"outputs.d.ts","sourceRoot":"","sources":["../../src/schemas/outputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,eAAO,MAAM,mBAAmB;;;;;;;kBAqB/B,CAAC"}
|
package/dist/schemas/outputs.js
CHANGED
|
@@ -1,15 +1,30 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
const ErrorSchema = z.strictObject({
|
|
3
|
+
code: z.string(),
|
|
4
|
+
message: z.string(),
|
|
5
5
|
});
|
|
6
|
-
const
|
|
7
|
-
ok: z.
|
|
8
|
-
error: z.strictObject({ code: z.string(), message: z.string() }),
|
|
6
|
+
const DefaultOutputSchemaBase = z.strictObject({
|
|
7
|
+
ok: z.boolean(),
|
|
9
8
|
result: z.unknown().optional(),
|
|
9
|
+
error: ErrorSchema.optional(),
|
|
10
|
+
});
|
|
11
|
+
export const DefaultOutputSchema = DefaultOutputSchemaBase.superRefine((value, ctx) => {
|
|
12
|
+
if (value.ok) {
|
|
13
|
+
if (value.error !== undefined) {
|
|
14
|
+
ctx.addIssue({
|
|
15
|
+
code: 'custom',
|
|
16
|
+
message: 'error must be absent when ok is true',
|
|
17
|
+
path: ['error'],
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (value.error === undefined) {
|
|
23
|
+
ctx.addIssue({
|
|
24
|
+
code: 'custom',
|
|
25
|
+
message: 'error is required when ok is false',
|
|
26
|
+
path: ['error'],
|
|
27
|
+
});
|
|
28
|
+
}
|
|
10
29
|
});
|
|
11
|
-
export const DefaultOutputSchema = z.discriminatedUnion('ok', [
|
|
12
|
-
SuccessOutputSchema,
|
|
13
|
-
ErrorOutputSchema,
|
|
14
|
-
]);
|
|
15
30
|
//# sourceMappingURL=outputs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputs.js","sourceRoot":"","sources":["../../src/schemas/outputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,
|
|
1
|
+
{"version":3,"file":"outputs.js","sourceRoot":"","sources":["../../src/schemas/outputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,WAAW,GAAG,CAAC,CAAC,YAAY,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;CACpB,CAAC,CAAC;AAEH,MAAM,uBAAuB,GAAG,CAAC,CAAC,YAAY,CAAC;IAC7C,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE;IACf,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC9B,KAAK,EAAE,WAAW,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,uBAAuB,CAAC,WAAW,CACpE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACb,IAAI,KAAK,CAAC,EAAE,EAAE,CAAC;QACb,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YAC9B,GAAG,CAAC,QAAQ,CAAC;gBACX,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,sCAAsC;gBAC/C,IAAI,EAAE,CAAC,OAAO,CAAC;aAChB,CAAC,CAAC;QACL,CAAC;QACD,OAAO;IACT,CAAC;IAED,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAC9B,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,oCAAoC;YAC7C,IAAI,EAAE,CAAC,OAAO,CAAC;SAChB,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CACF,CAAC"}
|