sprint-es 0.0.76 → 0.0.77
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.
|
@@ -9,8 +9,17 @@ function createSprintAuthorizationSchema(options) {
|
|
|
9
9
|
const sprintBuilder = {
|
|
10
10
|
authorization: createSprintAuthorizationSchema
|
|
11
11
|
};
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const sprintAuth = {
|
|
13
|
+
authorization: createSprintAuthorizationSchema
|
|
14
|
+
};
|
|
15
|
+
const proxyZ = new Proxy(zod.z, {
|
|
16
|
+
get(target, prop) {
|
|
17
|
+
if (prop === "sprint") {
|
|
18
|
+
return sprintAuth;
|
|
19
|
+
}
|
|
20
|
+
return target[prop];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
14
23
|
function parseSchema(schema, data) {
|
|
15
24
|
const result = schema.safeParse(data);
|
|
16
25
|
if (!result.success) {
|
|
@@ -86,9 +95,6 @@ function defineRouteSchema(schema) {
|
|
|
86
95
|
middleware.__sprintRouteSchema = schema;
|
|
87
96
|
return middleware;
|
|
88
97
|
}
|
|
89
|
-
Object.defineProperty(exports, "z", {
|
|
90
|
-
enumerable: true,
|
|
91
|
-
get: () => zod.z
|
|
92
|
-
});
|
|
93
98
|
exports.defineRouteSchema = defineRouteSchema;
|
|
94
|
-
exports.sprint =
|
|
99
|
+
exports.sprint = sprintBuilder;
|
|
100
|
+
exports.z = proxyZ;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { z as z2 } from "zod";
|
|
3
2
|
function createSprintAuthorizationSchema(options) {
|
|
4
3
|
const defaultSources = ["query:token", "headers:authorization"];
|
|
5
4
|
const sources = options?.sources ? Array.isArray(options.sources) ? options.sources : [options.sources] : defaultSources;
|
|
@@ -8,8 +7,17 @@ function createSprintAuthorizationSchema(options) {
|
|
|
8
7
|
const sprintBuilder = {
|
|
9
8
|
authorization: createSprintAuthorizationSchema
|
|
10
9
|
};
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
const sprintAuth = {
|
|
11
|
+
authorization: createSprintAuthorizationSchema
|
|
12
|
+
};
|
|
13
|
+
const proxyZ = new Proxy(z, {
|
|
14
|
+
get(target, prop) {
|
|
15
|
+
if (prop === "sprint") {
|
|
16
|
+
return sprintAuth;
|
|
17
|
+
}
|
|
18
|
+
return target[prop];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
13
21
|
function parseSchema(schema, data) {
|
|
14
22
|
const result = schema.safeParse(data);
|
|
15
23
|
if (!result.success) {
|
|
@@ -87,6 +95,6 @@ function defineRouteSchema(schema) {
|
|
|
87
95
|
}
|
|
88
96
|
export {
|
|
89
97
|
defineRouteSchema,
|
|
90
|
-
sprint,
|
|
91
|
-
|
|
98
|
+
sprintBuilder as sprint,
|
|
99
|
+
proxyZ as z
|
|
92
100
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { RequestHandler } from 'express';
|
|
2
2
|
import { z, ZodSchema as ZodSchemaType, ZodTypeDef } from 'zod';
|
|
3
|
-
export { z };
|
|
4
3
|
export type AuthorizationSource = `query:${string}` | `headers:${string}`;
|
|
5
4
|
export interface SprintAuthorizationOptions {
|
|
6
5
|
sources?: AuthorizationSource | AuthorizationSource[];
|
|
7
6
|
}
|
|
8
7
|
declare function createSprintAuthorizationSchema(options?: SprintAuthorizationOptions): ZodSchemaType<string, ZodTypeDef, string>;
|
|
9
|
-
|
|
8
|
+
declare const sprintBuilder: {
|
|
10
9
|
authorization: typeof createSprintAuthorizationSchema;
|
|
11
10
|
};
|
|
11
|
+
declare const proxyZ: typeof z;
|
|
12
|
+
export { proxyZ as z };
|
|
13
|
+
export { sprintBuilder as sprint };
|
|
12
14
|
export interface RouteSchemaOptions {
|
|
13
15
|
body?: ZodSchemaType<any, ZodTypeDef, any>;
|
|
14
16
|
queryParams?: ZodSchemaType<any, ZodTypeDef, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,SAAS,IAAI,aAAa,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAErF,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,SAAS,IAAI,aAAa,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAErF,MAAM,MAAM,mBAAmB,GAAG,SAAS,MAAM,EAAE,GAAG,WAAW,MAAM,EAAE,CAAC;AAE1E,MAAM,WAAW,0BAA0B;IACvC,OAAO,CAAC,EAAE,mBAAmB,GAAG,mBAAmB,EAAE,CAAC;CACzD;AAED,iBAAS,+BAA+B,CAAC,OAAO,CAAC,EAAE,0BAA0B,GAAG,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAKxH;AAED,QAAA,MAAM,aAAa;;CAElB,CAAC;AAMF,QAAA,MAAM,MAAM,UAOV,CAAC;AAEH,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,CAAC;AACvB,OAAO,EAAE,aAAa,IAAI,MAAM,EAAE,CAAC;AAEnC,MAAM,WAAW,kBAAkB;IAC/B,IAAI,CAAC,EAAE,aAAa,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;IAC3C,WAAW,CAAC,EAAE,aAAa,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;IAClD,MAAM,CAAC,EAAE,aAAa,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,aAAa,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;IAC9C,MAAM,CAAC,EAAE;QACL,aAAa,CAAC,EAAE,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;KAC7D,CAAC;CACL;AAqBD,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,kBAAkB,EAAE,MAAM,EAAE,CAAC,GAAG,cAAc,CAyEzF;AAED,YAAY,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC"}
|