@clipboard-health/json-api-nestjs 0.11.7 → 0.11.8
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clipboard-health/json-api-nestjs",
|
|
3
3
|
"description": "TypeScript-friendly utilities for adhering to the JSON:API specification with NestJS.",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.8",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@clipboard-health/contract-core": "0.3.0",
|
|
7
7
|
"tslib": "2.8.0",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"zod": "3.23.8"
|
|
10
10
|
},
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@clipboard-health/testing-core": "0.7.
|
|
12
|
+
"@clipboard-health/testing-core": "0.7.8"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [],
|
|
15
15
|
"license": "MIT",
|
|
@@ -6,10 +6,11 @@ export interface FilterValue {
|
|
|
6
6
|
filters: FilterTuple;
|
|
7
7
|
schema: z.ZodTypeAny;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
export type
|
|
9
|
+
type InternalFilterMap<FieldT extends Field = Field> = Record<FieldT, FilterValue>;
|
|
10
|
+
export type FilterMap<FieldT extends Field = Field> = Partial<InternalFilterMap<FieldT>>;
|
|
11
|
+
export type FilterSchema<MapT extends InternalFilterMap> = {
|
|
11
12
|
[K in keyof MapT]: z.ZodOptional<z.ZodEffects<z.ZodOptional<z.ZodObject<{
|
|
12
|
-
[F in MapT[K]["filters"][number]]: z.ZodOptional<z.ZodEffects<z.ZodOptional<z.
|
|
13
|
+
[F in MapT[K]["filters"][number]]: z.ZodOptional<z.ZodEffects<z.ZodOptional<z.ZodArray<MapT[K]["schema"]>>>>;
|
|
13
14
|
}>>>>;
|
|
14
15
|
};
|
|
15
16
|
/**
|
|
@@ -21,6 +22,7 @@ export type FilterSchema<MapT extends FilterMap> = {
|
|
|
21
22
|
* @see {@link https://jsonapi.org/recommendations/#filtering JSON:API filtering}
|
|
22
23
|
* @see {@link https://discuss.jsonapi.org/t/share-propose-a-filtering-strategy/257 JSON:API filtering strategy}
|
|
23
24
|
*/
|
|
24
|
-
export declare function filterQuery<const MapT extends
|
|
25
|
+
export declare function filterQuery<const MapT extends InternalFilterMap>(parameters: Readonly<MapT>): {
|
|
25
26
|
filter: z.ZodOptional<z.ZodObject<FilterSchema<MapT>, "strict", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<FilterSchema<MapT>>, any> extends infer T ? { [k in keyof T]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<FilterSchema<MapT>>, any>[k]; } : never, z.baseObjectInputType<FilterSchema<MapT>> extends infer T_1 ? { [k_1 in keyof T_1]: z.baseObjectInputType<FilterSchema<MapT>>[k_1]; } : never>>;
|
|
26
27
|
};
|
|
28
|
+
export {};
|
|
@@ -29,9 +29,7 @@ function filterSchema(parameters) {
|
|
|
29
29
|
return zod_1.z
|
|
30
30
|
.object(Object.fromEntries(filters.map((filter) => [
|
|
31
31
|
filter,
|
|
32
|
-
zod_1.z
|
|
33
|
-
.preprocess(splitString_1.splitString, schema.array().min(1).max(10_000).readonly().optional())
|
|
34
|
-
.optional(),
|
|
32
|
+
zod_1.z.preprocess(splitString_1.splitString, schema.array().min(1).max(10_000).optional()).optional(),
|
|
35
33
|
])))
|
|
36
34
|
.strict()
|
|
37
35
|
.optional();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterQuery.js","sourceRoot":"","sources":["../../../../../../packages/json-api-nestjs/src/lib/query/filterQuery.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"filterQuery.js","sourceRoot":"","sources":["../../../../../../packages/json-api-nestjs/src/lib/query/filterQuery.ts"],"names":[],"mappings":";;AA0CA,kCAcC;AAxDD,6BAAwB;AAExB,iFAA8E;AAC9E,yDAAsD;AA8BtD;;;;;;;;GAQG;AACH,SAAgB,WAAW,CAAuC,UAA0B;IAC1F,OAAO;QACL,MAAM,EAAE,OAAC;aACN,MAAM,CACL,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAiC,EAAE,EAAE,CAAC;YACnF,OAAO;YACP,OAAC,CAAC,UAAU,CAAC,iDAAuB,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE;SACtE,CAAC,CACmB,CACxB;aACA,MAAM,EAAE;aACR,QAAQ,EAAE;KACd,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,UAAuB;IAC3C,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IAEvC,OAAO,OAAC;SACL,MAAM,CACL,MAAM,CAAC,WAAW,CAChB,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;QACtB,MAAM;QACN,OAAC,CAAC,UAAU,CAAC,yBAAW,EAAE,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE;KACnF,CAAC,CACH,CACF;SACA,MAAM,EAAE;SACR,QAAQ,EAAE,CAAC;AAChB,CAAC"}
|