@geekmidas/db 10.0.0-alpha.55 → 10.0.0-alpha.57
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/README.md +17 -0
- package/dist/introspect/DataBrowser.cjs +117 -0
- package/dist/introspect/DataBrowser.cjs.map +1 -0
- package/dist/introspect/DataBrowser.d.cts +51 -0
- package/dist/introspect/DataBrowser.d.cts.map +1 -0
- package/dist/introspect/DataBrowser.d.mts +51 -0
- package/dist/introspect/DataBrowser.d.mts.map +1 -0
- package/dist/introspect/DataBrowser.mjs +116 -0
- package/dist/introspect/DataBrowser.mjs.map +1 -0
- package/dist/introspect/errors.cjs +48 -0
- package/dist/introspect/errors.cjs.map +1 -0
- package/dist/introspect/errors.d.cts +27 -0
- package/dist/introspect/errors.d.cts.map +1 -0
- package/dist/introspect/errors.d.mts +27 -0
- package/dist/introspect/errors.d.mts.map +1 -0
- package/dist/introspect/errors.mjs +45 -0
- package/dist/introspect/errors.mjs.map +1 -0
- package/dist/introspect/filtering.cjs +101 -0
- package/dist/introspect/filtering.cjs.map +1 -0
- package/dist/introspect/filtering.d.cts +29 -0
- package/dist/introspect/filtering.d.cts.map +1 -0
- package/dist/introspect/filtering.d.mts +29 -0
- package/dist/introspect/filtering.d.mts.map +1 -0
- package/dist/introspect/filtering.mjs +98 -0
- package/dist/introspect/filtering.mjs.map +1 -0
- package/dist/introspect/handler.cjs +159 -0
- package/dist/introspect/handler.cjs.map +1 -0
- package/dist/introspect/handler.d.cts +43 -0
- package/dist/introspect/handler.d.cts.map +1 -0
- package/dist/introspect/handler.d.mts +43 -0
- package/dist/introspect/handler.d.mts.map +1 -0
- package/dist/introspect/handler.mjs +158 -0
- package/dist/introspect/handler.mjs.map +1 -0
- package/dist/introspect/index.cjs +22 -0
- package/dist/introspect/index.d.cts +8 -0
- package/dist/introspect/index.d.mts +8 -0
- package/dist/introspect/index.mjs +8 -0
- package/dist/introspect/introspection.cjs +149 -0
- package/dist/introspect/introspection.cjs.map +1 -0
- package/dist/introspect/introspection.d.cts +25 -0
- package/dist/introspect/introspection.d.cts.map +1 -0
- package/dist/introspect/introspection.d.mts +25 -0
- package/dist/introspect/introspection.d.mts.map +1 -0
- package/dist/introspect/introspection.mjs +146 -0
- package/dist/introspect/introspection.mjs.map +1 -0
- package/dist/introspect/types.cjs +24 -0
- package/dist/introspect/types.cjs.map +1 -0
- package/dist/introspect/types.d.cts +113 -0
- package/dist/introspect/types.d.cts.map +1 -0
- package/dist/introspect/types.d.mts +113 -0
- package/dist/introspect/types.d.mts.map +1 -0
- package/dist/introspect/types.mjs +23 -0
- package/dist/introspect/types.mjs.map +1 -0
- package/dist/kysely/pagination.cjs +1 -0
- package/dist/kysely/pagination.cjs.map +1 -1
- package/dist/kysely/pagination.d.cts +2 -2
- package/dist/kysely/pagination.d.cts.map +1 -1
- package/dist/kysely/pagination.d.mts +2 -2
- package/dist/kysely/pagination.d.mts.map +1 -1
- package/dist/kysely/pagination.mjs +2 -2
- package/dist/kysely/pagination.mjs.map +1 -1
- package/dist/objection/pagination.cjs +1 -0
- package/dist/objection/pagination.cjs.map +1 -1
- package/dist/objection/pagination.d.cts +2 -2
- package/dist/objection/pagination.d.cts.map +1 -1
- package/dist/objection/pagination.d.mts +2 -2
- package/dist/objection/pagination.d.mts.map +1 -1
- package/dist/objection/pagination.mjs +2 -2
- package/dist/objection/pagination.mjs.map +1 -1
- package/dist/pagination-CrU89125.d.cts +42 -0
- package/dist/pagination-CrU89125.d.cts.map +1 -0
- package/dist/pagination-CrU89125.d.mts +42 -0
- package/dist/pagination-CrU89125.d.mts.map +1 -0
- package/dist/pagination.cjs +17 -1
- package/dist/pagination.cjs.map +1 -1
- package/dist/pagination.d.cts +2 -30
- package/dist/pagination.d.mts +2 -30
- package/dist/pagination.mjs +17 -2
- package/dist/pagination.mjs.map +1 -1
- package/package.json +11 -1
- package/dist/pagination.d.cts.map +0 -1
- package/dist/pagination.d.mts.map +0 -1
package/dist/pagination.d.cts
CHANGED
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Sort direction for cursor-based pagination.
|
|
4
|
-
*/
|
|
5
|
-
export declare enum Direction {
|
|
6
|
-
Asc = "asc",
|
|
7
|
-
Desc = "desc"
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Result of a paginated query.
|
|
11
|
-
*/
|
|
12
|
-
export interface PaginationResult<TItem> {
|
|
13
|
-
items: TItem[];
|
|
14
|
-
pagination: {
|
|
15
|
-
total: number;
|
|
16
|
-
hasMore: boolean;
|
|
17
|
-
cursor?: string;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Encode a cursor value for safe URL transmission.
|
|
22
|
-
* Supports various types: string, number, Date, etc.
|
|
23
|
-
*/
|
|
24
|
-
export declare function encodeCursor(value: unknown): string;
|
|
25
|
-
/**
|
|
26
|
-
* Decode a cursor string back to its original value.
|
|
27
|
-
*/
|
|
28
|
-
export declare function decodeCursor(cursor: string): unknown;
|
|
29
|
-
//#endregion
|
|
30
|
-
//# sourceMappingURL=pagination.d.cts.map
|
|
1
|
+
import { a as encodeCursor, i as decodeCursor, n as InvalidCursor, r as PaginationResult, t as Direction } from "./pagination-CrU89125.cjs";
|
|
2
|
+
export { Direction, InvalidCursor, PaginationResult, decodeCursor, encodeCursor };
|
package/dist/pagination.d.mts
CHANGED
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* Sort direction for cursor-based pagination.
|
|
4
|
-
*/
|
|
5
|
-
export declare enum Direction {
|
|
6
|
-
Asc = "asc",
|
|
7
|
-
Desc = "desc"
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Result of a paginated query.
|
|
11
|
-
*/
|
|
12
|
-
export interface PaginationResult<TItem> {
|
|
13
|
-
items: TItem[];
|
|
14
|
-
pagination: {
|
|
15
|
-
total: number;
|
|
16
|
-
hasMore: boolean;
|
|
17
|
-
cursor?: string;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Encode a cursor value for safe URL transmission.
|
|
22
|
-
* Supports various types: string, number, Date, etc.
|
|
23
|
-
*/
|
|
24
|
-
export declare function encodeCursor(value: unknown): string;
|
|
25
|
-
/**
|
|
26
|
-
* Decode a cursor string back to its original value.
|
|
27
|
-
*/
|
|
28
|
-
export declare function decodeCursor(cursor: string): unknown;
|
|
29
|
-
//#endregion
|
|
30
|
-
//# sourceMappingURL=pagination.d.mts.map
|
|
1
|
+
import { a as encodeCursor, i as decodeCursor, n as InvalidCursor, r as PaginationResult, t as Direction } from "./pagination-CrU89125.mjs";
|
|
2
|
+
export { Direction, InvalidCursor, PaginationResult, decodeCursor, encodeCursor };
|
package/dist/pagination.mjs
CHANGED
|
@@ -28,10 +28,25 @@ function decodeCursor(cursor) {
|
|
|
28
28
|
if (payload.t === "date") return new Date(payload.v);
|
|
29
29
|
return payload.v;
|
|
30
30
|
} catch {
|
|
31
|
-
throw new
|
|
31
|
+
throw new InvalidCursor(cursor);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* A cursor that did not come from `encodeCursor`.
|
|
36
|
+
*
|
|
37
|
+
* Usually a cursor from a different page size or sort that was edited by hand,
|
|
38
|
+
* or truncated on its way through a URL. The fix is the same either way: start
|
|
39
|
+
* again from the first page.
|
|
40
|
+
*/
|
|
41
|
+
var InvalidCursor = class extends Error {
|
|
42
|
+
cursor;
|
|
43
|
+
constructor(cursor) {
|
|
44
|
+
super("This cursor was not produced by encodeCursor. Drop it and request the first page again.");
|
|
45
|
+
this.cursor = cursor;
|
|
46
|
+
this.name = "InvalidCursor";
|
|
47
|
+
}
|
|
48
|
+
};
|
|
34
49
|
//#endregion
|
|
35
|
-
export { Direction, decodeCursor, encodeCursor };
|
|
50
|
+
export { Direction, InvalidCursor, decodeCursor, encodeCursor };
|
|
36
51
|
|
|
37
52
|
//# sourceMappingURL=pagination.mjs.map
|
package/dist/pagination.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.mjs","names":[],"sources":["../src/pagination.ts"],"sourcesContent":["/**\n * Sort direction for cursor-based pagination.\n */\nexport enum Direction {\n\tAsc = 'asc',\n\tDesc = 'desc',\n}\n\n/**\n * Result of a paginated query.\n */\nexport interface PaginationResult<TItem> {\n\titems: TItem[];\n\tpagination: {\n\t\ttotal: number;\n\t\thasMore: boolean;\n\t\tcursor?: string;\n\t};\n}\n\n/**\n * Encode a cursor value for safe URL transmission.\n * Supports various types: string, number, Date, etc.\n */\nexport function encodeCursor(value: unknown): string {\n\tconst payload = {\n\t\tv: value instanceof Date ? value.toISOString() : value,\n\t\tt: value instanceof Date ? 'date' : typeof value,\n\t};\n\treturn Buffer.from(JSON.stringify(payload)).toString('base64url');\n}\n\n/**\n * Decode a cursor string back to its original value.\n */\nexport function decodeCursor(cursor: string): unknown {\n\ttry {\n\t\tconst json = Buffer.from(cursor, 'base64url').toString('utf-8');\n\t\tconst payload = JSON.parse(json);\n\n\t\tif (payload.t === 'date') {\n\t\t\treturn new Date(payload.v);\n\t\t}\n\n\t\treturn payload.v;\n\t} catch {\n\t\tthrow new Error('
|
|
1
|
+
{"version":3,"file":"pagination.mjs","names":[],"sources":["../src/pagination.ts"],"sourcesContent":["/**\n * Sort direction for cursor-based pagination.\n */\nexport enum Direction {\n\tAsc = 'asc',\n\tDesc = 'desc',\n}\n\n/**\n * Result of a paginated query.\n */\nexport interface PaginationResult<TItem> {\n\titems: TItem[];\n\tpagination: {\n\t\ttotal: number;\n\t\thasMore: boolean;\n\t\tcursor?: string;\n\t};\n}\n\n/**\n * Encode a cursor value for safe URL transmission.\n * Supports various types: string, number, Date, etc.\n */\nexport function encodeCursor(value: unknown): string {\n\tconst payload = {\n\t\tv: value instanceof Date ? value.toISOString() : value,\n\t\tt: value instanceof Date ? 'date' : typeof value,\n\t};\n\treturn Buffer.from(JSON.stringify(payload)).toString('base64url');\n}\n\n/**\n * Decode a cursor string back to its original value.\n */\nexport function decodeCursor(cursor: string): unknown {\n\ttry {\n\t\tconst json = Buffer.from(cursor, 'base64url').toString('utf-8');\n\t\tconst payload = JSON.parse(json);\n\n\t\tif (payload.t === 'date') {\n\t\t\treturn new Date(payload.v);\n\t\t}\n\n\t\treturn payload.v;\n\t} catch {\n\t\tthrow new InvalidCursor(cursor);\n\t}\n}\n\n/**\n * A cursor that did not come from `encodeCursor`.\n *\n * Usually a cursor from a different page size or sort that was edited by hand,\n * or truncated on its way through a URL. The fix is the same either way: start\n * again from the first page.\n */\nexport class InvalidCursor extends Error {\n\tconstructor(readonly cursor: string) {\n\t\tsuper(\n\t\t\t'This cursor was not produced by encodeCursor. Drop it and request the first page again.',\n\t\t);\n\t\tthis.name = 'InvalidCursor';\n\t}\n}\n"],"mappings":";;;;AAGA,IAAY,YAAL,yBAAA,WAAA;CACN,UAAA,SAAA;CACA,UAAA,UAAA;;AACD,EAAA,CAAA,CAAA;;;;;AAkBA,SAAgB,aAAa,OAAwB;CACpD,MAAM,UAAU;EACf,GAAG,iBAAiB,OAAO,MAAM,YAAY,IAAI;EACjD,GAAG,iBAAiB,OAAO,SAAS,OAAO;CAC5C;CACA,OAAO,OAAO,KAAK,KAAK,UAAU,OAAO,CAAC,CAAC,CAAC,SAAS,WAAW;AACjE;;;;AAKA,SAAgB,aAAa,QAAyB;CACrD,IAAI;EACH,MAAM,OAAO,OAAO,KAAK,QAAQ,WAAW,CAAC,CAAC,SAAS,OAAO;EAC9D,MAAM,UAAU,KAAK,MAAM,IAAI;EAE/B,IAAI,QAAQ,MAAM,QACjB,OAAO,IAAI,KAAK,QAAQ,CAAC;EAG1B,OAAO,QAAQ;CAChB,QAAQ;EACP,MAAM,IAAI,cAAc,MAAM;CAC/B;AACD;;;;;;;;AASA,IAAa,gBAAb,cAAmC,MAAM;CACnB;CAArB,YAAY,QAAyB;EACpC,MACC,yFACD;EAHoB,KAAA,SAAA;EAIpB,KAAK,OAAO;CACb;AACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geekmidas/db",
|
|
3
|
-
"version": "10.0.0-alpha.
|
|
3
|
+
"version": "10.0.0-alpha.57",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -83,6 +83,16 @@
|
|
|
83
83
|
"types": "./dist/errors.d.cts",
|
|
84
84
|
"default": "./dist/errors.cjs"
|
|
85
85
|
}
|
|
86
|
+
},
|
|
87
|
+
"./introspect": {
|
|
88
|
+
"import": {
|
|
89
|
+
"types": "./dist/introspect/index.d.mts",
|
|
90
|
+
"default": "./dist/introspect/index.mjs"
|
|
91
|
+
},
|
|
92
|
+
"require": {
|
|
93
|
+
"types": "./dist/introspect/index.d.cts",
|
|
94
|
+
"default": "./dist/introspect/index.cjs"
|
|
95
|
+
}
|
|
86
96
|
}
|
|
87
97
|
},
|
|
88
98
|
"files": [
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.cts","names":[],"sources":["../src/pagination.ts"],"mappings":";;;;oBAGY;EACX;EACA;;;;;iBAMgB,iBAAiB;EACjC,OAAO;EACP;IACC;IACA;IACA;;;;;;;wBAQc,aAAa;;;;wBAWb,aAAa"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pagination.d.mts","names":[],"sources":["../src/pagination.ts"],"mappings":";;;;oBAGY;EACX;EACA;;;;;iBAMgB,iBAAiB;EACjC,OAAO;EACP;IACC;IACA;IACA;;;;;;;wBAQc,aAAa;;;;wBAWb,aAAa"}
|