@metriport/shared 0.26.2 → 0.26.3
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/common/__tests__/normalize-oid.test.js +14 -0
- package/dist/common/__tests__/normalize-oid.test.js.map +1 -1
- package/dist/common/normalize-oid.d.ts +7 -0
- package/dist/common/normalize-oid.d.ts.map +1 -1
- package/dist/common/normalize-oid.js +60 -1
- package/dist/common/normalize-oid.js.map +1 -1
- package/dist/common/numbers.d.ts +13 -0
- package/dist/common/numbers.d.ts.map +1 -1
- package/dist/common/numbers.js +40 -1
- package/dist/common/numbers.js.map +1 -1
- package/dist/domain/__tests__/cursor-utils.test.d.ts +2 -0
- package/dist/domain/__tests__/cursor-utils.test.d.ts.map +1 -0
- package/dist/domain/__tests__/cursor-utils.test.js +216 -0
- package/dist/domain/__tests__/cursor-utils.test.js.map +1 -0
- package/dist/domain/__tests__/pagination-schema.test.d.ts +2 -0
- package/dist/domain/__tests__/pagination-schema.test.d.ts.map +1 -0
- package/dist/domain/__tests__/pagination-schema.test.js +165 -0
- package/dist/domain/__tests__/pagination-schema.test.js.map +1 -0
- package/dist/domain/cursor-utils.d.ts +20 -0
- package/dist/domain/cursor-utils.d.ts.map +1 -0
- package/dist/domain/cursor-utils.js +51 -0
- package/dist/domain/cursor-utils.js.map +1 -0
- package/dist/domain/pagination-v2.d.ts +230 -0
- package/dist/domain/pagination-v2.d.ts.map +1 -0
- package/dist/domain/pagination-v2.js +132 -0
- package/dist/domain/pagination-v2.js.map +1 -0
- package/dist/domain/pagination.d.ts +0 -2
- package/dist/domain/pagination.d.ts.map +1 -1
- package/dist/domain/pagination.js +3 -4
- package/dist/domain/pagination.js.map +1 -1
- package/dist/domain/tcm-encounter.d.ts +180 -9
- package/dist/domain/tcm-encounter.d.ts.map +1 -1
- package/dist/domain/tcm-encounter.js +13 -3
- package/dist/domain/tcm-encounter.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interface/external/ehr/athenahealth/cx-mapping.d.ts +54 -0
- package/dist/interface/external/ehr/athenahealth/cx-mapping.d.ts.map +1 -1
- package/dist/interface/external/ehr/athenahealth/jwt-token.d.ts +2 -2
- package/dist/interface/external/ehr/athenahealth/patient-mapping.d.ts +14 -0
- package/dist/interface/external/ehr/athenahealth/patient-mapping.d.ts.map +1 -0
- package/dist/interface/external/ehr/athenahealth/patient-mapping.js +11 -0
- package/dist/interface/external/ehr/athenahealth/patient-mapping.js.map +1 -0
- package/dist/interface/external/ehr/athenahealth/patient.d.ts +36 -2
- package/dist/interface/external/ehr/athenahealth/patient.d.ts.map +1 -1
- package/dist/interface/external/ehr/athenahealth/patient.js +5 -5
- package/dist/interface/external/ehr/athenahealth/patient.js.map +1 -1
- package/dist/interface/external/ehr/canvas/cx-mapping.d.ts +54 -0
- package/dist/interface/external/ehr/canvas/cx-mapping.d.ts.map +1 -1
- package/dist/interface/external/ehr/canvas/jwt-token.d.ts +6 -6
- package/dist/interface/external/ehr/eclinicalworks/jwt-token.d.ts +2 -2
- package/dist/interface/external/ehr/elation/cx-mapping.d.ts +54 -0
- package/dist/interface/external/ehr/elation/cx-mapping.d.ts.map +1 -1
- package/dist/interface/external/ehr/elation/jwt-token.d.ts +4 -4
- package/dist/interface/external/ehr/healthie/cx-mapping.d.ts +54 -0
- package/dist/interface/external/ehr/healthie/cx-mapping.d.ts.map +1 -1
- package/dist/interface/external/ehr/healthie/jwt-token.d.ts +2 -2
- package/dist/interface/external/ehr/healthie/lab.d.ts +32 -32
- package/dist/interface/external/ehr/shared.d.ts +100 -0
- package/dist/interface/external/ehr/shared.d.ts.map +1 -1
- package/dist/interface/external/ehr/shared.js +15 -1
- package/dist/interface/external/ehr/shared.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination-schema.test.js","sourceRoot":"","sources":["../../../src/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AE,aAAa;gBACrB,KAAK,EAAE,EAAE;aACV,CAAC;YAEF,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACnC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;gBACrB,IAAI,EAAE;oBACJ,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE;oBACjC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;oBAC9B,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;iBAC7B;gBACD,YAAY,EAAE;oBACZ,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE;oBAClC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE;oBAC7B,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE;iBAC5B;gBACD,MAAM,EAAE,UAAU;gBAClB,KAAK,EAAE,EAAE;aACV,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SortItem } from "./pagination-v2";
|
|
2
|
+
export type CursorPrimitive = string | number | boolean | Date | null | undefined;
|
|
3
|
+
export type CompositeCursor = Record<string, CursorPrimitive>;
|
|
4
|
+
/**
|
|
5
|
+
* Encodes a cursor object to a base64 string for use in pagination.
|
|
6
|
+
* The cursor is JSON-stringified then base64-encoded for safe URL transmission.
|
|
7
|
+
*/
|
|
8
|
+
export declare function encodeCursor(cursorData: Record<string, CursorPrimitive>): string;
|
|
9
|
+
/**
|
|
10
|
+
* Decodes a base64-encoded cursor string back to an object.
|
|
11
|
+
* Throws an error if the cursor is malformed or contains invalid JSON.
|
|
12
|
+
*/
|
|
13
|
+
export declare function decodeCursor(encodedCursor: string): Record<string, CursorPrimitive>;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a composite cursor from an item based on the specified sort fields.
|
|
16
|
+
* Only includes the fields that are part of the sort criteria.
|
|
17
|
+
* @throws Error if any field value is not a valid CursorPrimitive type
|
|
18
|
+
*/
|
|
19
|
+
export declare function createCompositeCursor<T extends Record<string, unknown>>(item: T, sortFields: SortItem[]): CompositeCursor;
|
|
20
|
+
//# sourceMappingURL=cursor-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-utils.d.ts","sourceRoot":"","sources":["../../src/domain/cursor-utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;AAClF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAgB9D;;;GAGG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG,MAAM,CAGhF;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAGnF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrE,IAAI,EAAE,CAAC,EACP,UAAU,EAAE,QAAQ,EAAE,GACrB,eAAe,CAYjB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCompositeCursor = exports.decodeCursor = exports.encodeCursor = void 0;
|
|
4
|
+
const metriport_error_1 = require("../error/metriport-error");
|
|
5
|
+
/**
|
|
6
|
+
* Type guard to check if a value is a valid CursorPrimitive type.
|
|
7
|
+
*/
|
|
8
|
+
function isCursorPrimitive(value) {
|
|
9
|
+
return (typeof value === "string" ||
|
|
10
|
+
typeof value === "number" ||
|
|
11
|
+
typeof value === "boolean" ||
|
|
12
|
+
value instanceof Date ||
|
|
13
|
+
value === null ||
|
|
14
|
+
value === undefined);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Encodes a cursor object to a base64 string for use in pagination.
|
|
18
|
+
* The cursor is JSON-stringified then base64-encoded for safe URL transmission.
|
|
19
|
+
*/
|
|
20
|
+
function encodeCursor(cursorData) {
|
|
21
|
+
const json = JSON.stringify(cursorData);
|
|
22
|
+
return Buffer.from(json, "utf8").toString("base64");
|
|
23
|
+
}
|
|
24
|
+
exports.encodeCursor = encodeCursor;
|
|
25
|
+
/**
|
|
26
|
+
* Decodes a base64-encoded cursor string back to an object.
|
|
27
|
+
* Throws an error if the cursor is malformed or contains invalid JSON.
|
|
28
|
+
*/
|
|
29
|
+
function decodeCursor(encodedCursor) {
|
|
30
|
+
const decoded = Buffer.from(encodedCursor, "base64").toString("utf8");
|
|
31
|
+
return JSON.parse(decoded);
|
|
32
|
+
}
|
|
33
|
+
exports.decodeCursor = decodeCursor;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a composite cursor from an item based on the specified sort fields.
|
|
36
|
+
* Only includes the fields that are part of the sort criteria.
|
|
37
|
+
* @throws Error if any field value is not a valid CursorPrimitive type
|
|
38
|
+
*/
|
|
39
|
+
function createCompositeCursor(item, sortFields) {
|
|
40
|
+
const cursor = {};
|
|
41
|
+
for (const { col } of sortFields) {
|
|
42
|
+
const value = item[col];
|
|
43
|
+
if (!isCursorPrimitive(value)) {
|
|
44
|
+
throw new metriport_error_1.MetriportError(`Invalid cursor value for column '${col}': expected CursorPrimitive (string | number | boolean | Date | null | undefined), got ${typeof value}`);
|
|
45
|
+
}
|
|
46
|
+
cursor[col] = value;
|
|
47
|
+
}
|
|
48
|
+
return cursor;
|
|
49
|
+
}
|
|
50
|
+
exports.createCompositeCursor = createCompositeCursor;
|
|
51
|
+
//# sourceMappingURL=cursor-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-utils.js","sourceRoot":"","sources":["../../src/domain/cursor-utils.ts"],"names":[],"mappings":";;;AAAA,8DAA0D;AAM1D;;GAEG;AACH,SAAS,iBAAiB,CAAC,KAAc;IACvC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,KAAK,YAAY,IAAI;QACrB,KAAK,KAAK,IAAI;QACd,KAAK,KAAK,SAAS,CACpB,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAC,UAA2C;IACtE,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACtD,CAAC;AAHD,oCAGC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAC,aAAqB;IAChD,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACtE,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC;AAHD,oCAGC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CACnC,IAAO,EACP,UAAsB;IAEtB,MAAM,MAAM,GAAoB,EAAE,CAAC;IACnC,KAAK,MAAM,EAAE,GAAG,EAAE,IAAI,UAAU,EAAE;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE;YAC7B,MAAM,IAAI,gCAAc,CACtB,oCAAoC,GAAG,0FAA0F,OAAO,KAAK,EAAE,CAChJ,CAAC;SACH;QACD,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;KACrB;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAfD,sDAeC"}
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const defaultItemsPerPage = 50;
|
|
3
|
+
export declare const maxItemsPerPage = 500;
|
|
4
|
+
declare const sortItemSchema: z.ZodEffects<z.ZodString, {
|
|
5
|
+
col: string;
|
|
6
|
+
order: "asc" | "desc";
|
|
7
|
+
}, string>;
|
|
8
|
+
export type SortItem = z.infer<typeof sortItemSchema>;
|
|
9
|
+
declare const compositeCursorSchema: z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>;
|
|
10
|
+
export type CompositeCursor = z.infer<typeof compositeCursorSchema>;
|
|
11
|
+
export declare function createQueryMetaSchemaV2(maxItems?: number): z.ZodEffects<z.ZodEffects<z.ZodIntersection<z.ZodUnion<[z.ZodObject<{
|
|
12
|
+
fromItem: z.ZodOptional<z.ZodEffects<z.ZodString, Record<string, string | null>, string>>;
|
|
13
|
+
toItem: z.ZodOptional<z.ZodNever>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
fromItem?: Record<string, string | null> | undefined;
|
|
16
|
+
toItem?: undefined;
|
|
17
|
+
}, {
|
|
18
|
+
fromItem?: string | undefined;
|
|
19
|
+
toItem?: undefined;
|
|
20
|
+
}>, z.ZodObject<{
|
|
21
|
+
fromItem: z.ZodOptional<z.ZodNever>;
|
|
22
|
+
toItem: z.ZodOptional<z.ZodEffects<z.ZodString, Record<string, string | null>, string>>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
fromItem?: undefined;
|
|
25
|
+
toItem?: Record<string, string | null> | undefined;
|
|
26
|
+
}, {
|
|
27
|
+
fromItem?: undefined;
|
|
28
|
+
toItem?: string | undefined;
|
|
29
|
+
}>]>, z.ZodObject<{
|
|
30
|
+
sort: z.ZodEffects<z.ZodOptional<z.ZodString>, {
|
|
31
|
+
col: string;
|
|
32
|
+
order: "asc" | "desc";
|
|
33
|
+
}[], string | undefined>;
|
|
34
|
+
count: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodNumber, number, unknown>, number, unknown>, number, unknown>>;
|
|
35
|
+
}, "strip", z.ZodTypeAny, {
|
|
36
|
+
sort: {
|
|
37
|
+
col: string;
|
|
38
|
+
order: "asc" | "desc";
|
|
39
|
+
}[];
|
|
40
|
+
count?: number | undefined;
|
|
41
|
+
}, {
|
|
42
|
+
sort?: string | undefined;
|
|
43
|
+
count?: unknown;
|
|
44
|
+
}>>, {
|
|
45
|
+
sort: {
|
|
46
|
+
col: string;
|
|
47
|
+
order: "asc" | "desc";
|
|
48
|
+
}[];
|
|
49
|
+
originalSort: {
|
|
50
|
+
col: string;
|
|
51
|
+
order: "asc" | "desc";
|
|
52
|
+
}[];
|
|
53
|
+
fromItem?: Record<string, string | null> | undefined;
|
|
54
|
+
toItem?: undefined;
|
|
55
|
+
count?: number | undefined;
|
|
56
|
+
} | {
|
|
57
|
+
sort: {
|
|
58
|
+
col: string;
|
|
59
|
+
order: "asc" | "desc";
|
|
60
|
+
}[];
|
|
61
|
+
originalSort: {
|
|
62
|
+
col: string;
|
|
63
|
+
order: "asc" | "desc";
|
|
64
|
+
}[];
|
|
65
|
+
fromItem?: undefined;
|
|
66
|
+
toItem?: Record<string, string | null> | undefined;
|
|
67
|
+
count?: number | undefined;
|
|
68
|
+
}, ({
|
|
69
|
+
fromItem?: string | undefined;
|
|
70
|
+
toItem?: undefined;
|
|
71
|
+
} | {
|
|
72
|
+
fromItem?: undefined;
|
|
73
|
+
toItem?: string | undefined;
|
|
74
|
+
}) & {
|
|
75
|
+
sort?: string | undefined;
|
|
76
|
+
count?: unknown;
|
|
77
|
+
}>, {
|
|
78
|
+
sort: {
|
|
79
|
+
col: string;
|
|
80
|
+
order: "asc" | "desc";
|
|
81
|
+
}[];
|
|
82
|
+
originalSort: {
|
|
83
|
+
col: string;
|
|
84
|
+
order: "asc" | "desc";
|
|
85
|
+
}[];
|
|
86
|
+
fromItem?: Record<string, string | null> | undefined;
|
|
87
|
+
toItem?: undefined;
|
|
88
|
+
count?: number | undefined;
|
|
89
|
+
} | {
|
|
90
|
+
sort: {
|
|
91
|
+
col: string;
|
|
92
|
+
order: "asc" | "desc";
|
|
93
|
+
}[];
|
|
94
|
+
originalSort: {
|
|
95
|
+
col: string;
|
|
96
|
+
order: "asc" | "desc";
|
|
97
|
+
}[];
|
|
98
|
+
fromItem?: undefined;
|
|
99
|
+
toItem?: Record<string, string | null> | undefined;
|
|
100
|
+
count?: number | undefined;
|
|
101
|
+
}, ({
|
|
102
|
+
fromItem?: string | undefined;
|
|
103
|
+
toItem?: undefined;
|
|
104
|
+
} | {
|
|
105
|
+
fromItem?: undefined;
|
|
106
|
+
toItem?: string | undefined;
|
|
107
|
+
}) & {
|
|
108
|
+
sort?: string | undefined;
|
|
109
|
+
count?: unknown;
|
|
110
|
+
}>;
|
|
111
|
+
declare const queryMetaSchemaV2: z.ZodEffects<z.ZodEffects<z.ZodIntersection<z.ZodUnion<[z.ZodObject<{
|
|
112
|
+
fromItem: z.ZodOptional<z.ZodEffects<z.ZodString, Record<string, string | null>, string>>;
|
|
113
|
+
toItem: z.ZodOptional<z.ZodNever>;
|
|
114
|
+
}, "strip", z.ZodTypeAny, {
|
|
115
|
+
fromItem?: Record<string, string | null> | undefined;
|
|
116
|
+
toItem?: undefined;
|
|
117
|
+
}, {
|
|
118
|
+
fromItem?: string | undefined;
|
|
119
|
+
toItem?: undefined;
|
|
120
|
+
}>, z.ZodObject<{
|
|
121
|
+
fromItem: z.ZodOptional<z.ZodNever>;
|
|
122
|
+
toItem: z.ZodOptional<z.ZodEffects<z.ZodString, Record<string, string | null>, string>>;
|
|
123
|
+
}, "strip", z.ZodTypeAny, {
|
|
124
|
+
fromItem?: undefined;
|
|
125
|
+
toItem?: Record<string, string | null> | undefined;
|
|
126
|
+
}, {
|
|
127
|
+
fromItem?: undefined;
|
|
128
|
+
toItem?: string | undefined;
|
|
129
|
+
}>]>, z.ZodObject<{
|
|
130
|
+
sort: z.ZodEffects<z.ZodOptional<z.ZodString>, {
|
|
131
|
+
col: string;
|
|
132
|
+
order: "asc" | "desc";
|
|
133
|
+
}[], string | undefined>;
|
|
134
|
+
count: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodNumber, number, unknown>, number, unknown>, number, unknown>>;
|
|
135
|
+
}, "strip", z.ZodTypeAny, {
|
|
136
|
+
sort: {
|
|
137
|
+
col: string;
|
|
138
|
+
order: "asc" | "desc";
|
|
139
|
+
}[];
|
|
140
|
+
count?: number | undefined;
|
|
141
|
+
}, {
|
|
142
|
+
sort?: string | undefined;
|
|
143
|
+
count?: unknown;
|
|
144
|
+
}>>, {
|
|
145
|
+
sort: {
|
|
146
|
+
col: string;
|
|
147
|
+
order: "asc" | "desc";
|
|
148
|
+
}[];
|
|
149
|
+
originalSort: {
|
|
150
|
+
col: string;
|
|
151
|
+
order: "asc" | "desc";
|
|
152
|
+
}[];
|
|
153
|
+
fromItem?: Record<string, string | null> | undefined;
|
|
154
|
+
toItem?: undefined;
|
|
155
|
+
count?: number | undefined;
|
|
156
|
+
} | {
|
|
157
|
+
sort: {
|
|
158
|
+
col: string;
|
|
159
|
+
order: "asc" | "desc";
|
|
160
|
+
}[];
|
|
161
|
+
originalSort: {
|
|
162
|
+
col: string;
|
|
163
|
+
order: "asc" | "desc";
|
|
164
|
+
}[];
|
|
165
|
+
fromItem?: undefined;
|
|
166
|
+
toItem?: Record<string, string | null> | undefined;
|
|
167
|
+
count?: number | undefined;
|
|
168
|
+
}, ({
|
|
169
|
+
fromItem?: string | undefined;
|
|
170
|
+
toItem?: undefined;
|
|
171
|
+
} | {
|
|
172
|
+
fromItem?: undefined;
|
|
173
|
+
toItem?: string | undefined;
|
|
174
|
+
}) & {
|
|
175
|
+
sort?: string | undefined;
|
|
176
|
+
count?: unknown;
|
|
177
|
+
}>, {
|
|
178
|
+
sort: {
|
|
179
|
+
col: string;
|
|
180
|
+
order: "asc" | "desc";
|
|
181
|
+
}[];
|
|
182
|
+
originalSort: {
|
|
183
|
+
col: string;
|
|
184
|
+
order: "asc" | "desc";
|
|
185
|
+
}[];
|
|
186
|
+
fromItem?: Record<string, string | null> | undefined;
|
|
187
|
+
toItem?: undefined;
|
|
188
|
+
count?: number | undefined;
|
|
189
|
+
} | {
|
|
190
|
+
sort: {
|
|
191
|
+
col: string;
|
|
192
|
+
order: "asc" | "desc";
|
|
193
|
+
}[];
|
|
194
|
+
originalSort: {
|
|
195
|
+
col: string;
|
|
196
|
+
order: "asc" | "desc";
|
|
197
|
+
}[];
|
|
198
|
+
fromItem?: undefined;
|
|
199
|
+
toItem?: Record<string, string | null> | undefined;
|
|
200
|
+
count?: number | undefined;
|
|
201
|
+
}, ({
|
|
202
|
+
fromItem?: string | undefined;
|
|
203
|
+
toItem?: undefined;
|
|
204
|
+
} | {
|
|
205
|
+
fromItem?: undefined;
|
|
206
|
+
toItem?: string | undefined;
|
|
207
|
+
}) & {
|
|
208
|
+
sort?: string | undefined;
|
|
209
|
+
count?: unknown;
|
|
210
|
+
}>;
|
|
211
|
+
export type HttpMetaV2 = z.infer<typeof queryMetaSchemaV2>;
|
|
212
|
+
export declare const paginationV2MetaSchema: z.ZodObject<{
|
|
213
|
+
itemsInTotal: z.ZodNumber;
|
|
214
|
+
itemsOnPage: z.ZodNumber;
|
|
215
|
+
nextPage: z.ZodOptional<z.ZodString>;
|
|
216
|
+
prevPage: z.ZodOptional<z.ZodString>;
|
|
217
|
+
}, "strip", z.ZodTypeAny, {
|
|
218
|
+
itemsInTotal: number;
|
|
219
|
+
itemsOnPage: number;
|
|
220
|
+
nextPage?: string | undefined;
|
|
221
|
+
prevPage?: string | undefined;
|
|
222
|
+
}, {
|
|
223
|
+
itemsInTotal: number;
|
|
224
|
+
itemsOnPage: number;
|
|
225
|
+
nextPage?: string | undefined;
|
|
226
|
+
prevPage?: string | undefined;
|
|
227
|
+
}>;
|
|
228
|
+
export type PaginationV2Meta = z.infer<typeof paginationV2MetaSchema>;
|
|
229
|
+
export {};
|
|
230
|
+
//# sourceMappingURL=pagination-v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination-v2.d.ts","sourceRoot":"","sources":["../../src/domain/pagination-v2.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,mBAAmB,KAAK,CAAC;AACtC,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,QAAA,MAAM,cAAc;;;UAmBlB,CAAC;AAEH,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAmBtD,QAAA,MAAM,qBAAqB,sDAA8C,CAAC;AAC1E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AA0BpE,wBAAgB,uBAAuB,CAAC,QAAQ,GAAE,MAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEzE;AAED,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA4B,CAAC;AACpD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE3D,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;EAKjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.paginationV2MetaSchema = exports.createQueryMetaSchemaV2 = exports.maxItemsPerPage = exports.defaultItemsPerPage = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const zod_2 = require("../common/zod");
|
|
6
|
+
const cursor_utils_1 = require("./cursor-utils");
|
|
7
|
+
exports.defaultItemsPerPage = 50;
|
|
8
|
+
exports.maxItemsPerPage = 500;
|
|
9
|
+
const sortItemSchema = zod_1.z.string().transform((val, ctx) => {
|
|
10
|
+
const [col, order] = val.split("=");
|
|
11
|
+
if (!col || !order) {
|
|
12
|
+
ctx.addIssue({
|
|
13
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
14
|
+
message: `Invalid sort format: ${val}. Expected: column=order`,
|
|
15
|
+
});
|
|
16
|
+
return zod_1.z.NEVER;
|
|
17
|
+
}
|
|
18
|
+
if (order !== "asc" && order !== "desc") {
|
|
19
|
+
ctx.addIssue({
|
|
20
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
21
|
+
message: `Invalid sort order: ${order}. Must be 'asc' or 'desc'`,
|
|
22
|
+
});
|
|
23
|
+
return zod_1.z.NEVER;
|
|
24
|
+
}
|
|
25
|
+
return { col, order: order };
|
|
26
|
+
});
|
|
27
|
+
function addIdSortIfNotExists(items) {
|
|
28
|
+
const hasIdSort = items.some(item => item.col === "id");
|
|
29
|
+
return hasIdSort ? items : [...items, { col: "id", order: "desc" }];
|
|
30
|
+
}
|
|
31
|
+
const sortStringSchema = zod_1.z
|
|
32
|
+
.string()
|
|
33
|
+
.optional()
|
|
34
|
+
.transform(val => {
|
|
35
|
+
if (!val) {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
const items = val.split(",").filter(item => item.trim());
|
|
39
|
+
return items.map(item => sortItemSchema.parse(item));
|
|
40
|
+
});
|
|
41
|
+
const compositeCursorSchema = zod_1.z.record(zod_1.z.string(), zod_1.z.string().nullable());
|
|
42
|
+
const cursorSchema = zod_1.z.string().transform((val, ctx) => {
|
|
43
|
+
let decoded;
|
|
44
|
+
try {
|
|
45
|
+
decoded = (0, cursor_utils_1.decodeCursor)(val);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
ctx.addIssue({
|
|
49
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
50
|
+
message: "Invalid cursor: unable to decode cursor",
|
|
51
|
+
});
|
|
52
|
+
return zod_1.z.NEVER;
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
decoded = (0, cursor_utils_1.decodeCursor)(val);
|
|
56
|
+
return compositeCursorSchema.parse(decoded);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
ctx.addIssue({
|
|
60
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
61
|
+
message: "Invalid cursor contents: " + JSON.stringify(decoded),
|
|
62
|
+
});
|
|
63
|
+
return zod_1.z.NEVER;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
function createQueryMetaSchemaV2(maxItems = exports.maxItemsPerPage) {
|
|
67
|
+
return zod_1.z
|
|
68
|
+
.intersection(zod_1.z.union([
|
|
69
|
+
zod_1.z.object({
|
|
70
|
+
fromItem: cursorSchema.optional(),
|
|
71
|
+
toItem: zod_1.z.never().optional(),
|
|
72
|
+
}),
|
|
73
|
+
zod_1.z.object({
|
|
74
|
+
fromItem: zod_1.z.never().optional(),
|
|
75
|
+
toItem: cursorSchema.optional(),
|
|
76
|
+
}),
|
|
77
|
+
], { errorMap: () => ({ message: "Either fromItem or toItem can be provided, but not both" }) }), zod_1.z.object({
|
|
78
|
+
sort: sortStringSchema,
|
|
79
|
+
count: zod_2.numericValueSchema
|
|
80
|
+
.refine(count => count >= 0, {
|
|
81
|
+
message: `Count has to be greater than or equal to 0`,
|
|
82
|
+
})
|
|
83
|
+
.refine(count => count <= maxItems, {
|
|
84
|
+
message: `Count has to be less than or equal to ${maxItems}`,
|
|
85
|
+
})
|
|
86
|
+
.optional(),
|
|
87
|
+
}))
|
|
88
|
+
.transform(data => {
|
|
89
|
+
// Store the original user-provided sort (without auto-added ID sort)
|
|
90
|
+
const originalSort = data.sort;
|
|
91
|
+
// Add ID sort if not already present for the final sort
|
|
92
|
+
const sortWithId = addIdSortIfNotExists(data.sort);
|
|
93
|
+
// Reorient ordering based on paginationV2 direction
|
|
94
|
+
const shouldReverseOrder = !!data.toItem;
|
|
95
|
+
const reorientedSort = sortWithId.map(({ col, order }) => ({
|
|
96
|
+
col,
|
|
97
|
+
order: shouldReverseOrder
|
|
98
|
+
? order === "asc"
|
|
99
|
+
? "desc"
|
|
100
|
+
: "asc"
|
|
101
|
+
: order,
|
|
102
|
+
}));
|
|
103
|
+
return {
|
|
104
|
+
...data,
|
|
105
|
+
sort: reorientedSort,
|
|
106
|
+
originalSort,
|
|
107
|
+
};
|
|
108
|
+
})
|
|
109
|
+
.refine(data => {
|
|
110
|
+
const cursor = data.fromItem ?? data.toItem;
|
|
111
|
+
const sort = data.sort;
|
|
112
|
+
if (sort && cursor) {
|
|
113
|
+
const sortColumnCount = sort.length;
|
|
114
|
+
const cursorKeyCount = Object.keys(cursor).length;
|
|
115
|
+
if (sortColumnCount !== cursorKeyCount) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return true;
|
|
120
|
+
}, {
|
|
121
|
+
message: "Number of sort columns should match the number of cursor keys",
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
exports.createQueryMetaSchemaV2 = createQueryMetaSchemaV2;
|
|
125
|
+
const queryMetaSchemaV2 = createQueryMetaSchemaV2();
|
|
126
|
+
exports.paginationV2MetaSchema = zod_1.z.object({
|
|
127
|
+
itemsInTotal: zod_1.z.number(),
|
|
128
|
+
itemsOnPage: zod_1.z.number(),
|
|
129
|
+
nextPage: zod_1.z.string().optional(),
|
|
130
|
+
prevPage: zod_1.z.string().optional(),
|
|
131
|
+
});
|
|
132
|
+
//# sourceMappingURL=pagination-v2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination-v2.js","sourceRoot":"","sources":["../../src/domain/pagination-v2.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,uCAAmD;AACnD,iDAA8C;AAEjC,QAAA,mBAAmB,GAAG,EAAE,CAAC;AACzB,QAAA,eAAe,GAAG,GAAG,CAAC;AAEnC,MAAM,cAAc,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACvD,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE;QAClB,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,OAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,wBAAwB,GAAG,0BAA0B;SAC/D,CAAC,CAAC;QACH,OAAO,OAAC,CAAC,KAAK,CAAC;KAChB;IAED,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,MAAM,EAAE;QACvC,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,OAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,uBAAuB,KAAK,2BAA2B;SACjE,CAAC,CAAC;QACH,OAAO,OAAC,CAAC,KAAK,CAAC;KAChB;IAED,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,KAAuB,EAAE,CAAC;AACjD,CAAC,CAAC,CAAC;AAIH,SAAS,oBAAoB,CAAC,KAAiB;IAC7C,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC;IACxD,OAAO,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GA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AAQ,EAAE;CAChC,CAAC,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
export declare const defaultItemsPerPage = 50;
|
|
3
|
-
export declare const maxItemsPerPage = 500;
|
|
4
2
|
export declare function createQueryMetaSchema(maxItems?: number): z.ZodIntersection<z.ZodUnion<[z.ZodObject<{
|
|
5
3
|
fromItem: z.ZodOptional<z.ZodString>;
|
|
6
4
|
toItem: z.ZodOptional<z.ZodNever>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/domain/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/domain/pagination.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,wBAAgB,qBAAqB,CAAC,QAAQ,GAAE,MAAwB;;;;;;;;;;;;;;;;;;;;;;;;IA0BvE;AAED,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;GAA0B,CAAC;AAChD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAEvD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;EAK/B,CAAC;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.paginationMetaSchema = exports.createQueryMetaSchema =
|
|
3
|
+
exports.paginationMetaSchema = exports.createQueryMetaSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const zod_2 = require("../common/zod");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
function createQueryMetaSchema(maxItems = exports.maxItemsPerPage) {
|
|
6
|
+
const pagination_v2_1 = require("./pagination-v2");
|
|
7
|
+
function createQueryMetaSchema(maxItems = pagination_v2_1.maxItemsPerPage) {
|
|
9
8
|
return zod_1.z.intersection(zod_1.z.union([
|
|
10
9
|
zod_1.z.object({
|
|
11
10
|
fromItem: zod_1.z.string().optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/domain/pagination.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,uCAAmD;
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/domain/pagination.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,uCAAmD;AACnD,mDAAkD;AAElD,SAAgB,qBAAqB,CAAC,WAAmB,+BAAe;IACtE,OAAO,OAAC,CAAC,YAAY,CACnB,OAAC,CAAC,KAAK,CACL;QACE,OAAC,CAAC,MAAM,CAAC;YACP,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAC/B,MAAM,EAAE,OAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;SAC7B,CAAC;QACF,OAAC,CAAC,MAAM,CAAC;YACP,QAAQ,EAAE,OAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE;YAC9B,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC9B,CAAC;KACH,EACD,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,yDAAyD,EAAE,CAAC,EAAE,CAC7F,EACD,OAAC,CAAC,MAAM,CAAC;QACP,KAAK,EAAE,wBAAkB;aACtB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,EAAE;YAC3B,OAAO,EAAE,4CAA4C;SACtD,CAAC;aACD,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,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