@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.
Files changed (82) hide show
  1. package/README.md +17 -0
  2. package/dist/introspect/DataBrowser.cjs +117 -0
  3. package/dist/introspect/DataBrowser.cjs.map +1 -0
  4. package/dist/introspect/DataBrowser.d.cts +51 -0
  5. package/dist/introspect/DataBrowser.d.cts.map +1 -0
  6. package/dist/introspect/DataBrowser.d.mts +51 -0
  7. package/dist/introspect/DataBrowser.d.mts.map +1 -0
  8. package/dist/introspect/DataBrowser.mjs +116 -0
  9. package/dist/introspect/DataBrowser.mjs.map +1 -0
  10. package/dist/introspect/errors.cjs +48 -0
  11. package/dist/introspect/errors.cjs.map +1 -0
  12. package/dist/introspect/errors.d.cts +27 -0
  13. package/dist/introspect/errors.d.cts.map +1 -0
  14. package/dist/introspect/errors.d.mts +27 -0
  15. package/dist/introspect/errors.d.mts.map +1 -0
  16. package/dist/introspect/errors.mjs +45 -0
  17. package/dist/introspect/errors.mjs.map +1 -0
  18. package/dist/introspect/filtering.cjs +101 -0
  19. package/dist/introspect/filtering.cjs.map +1 -0
  20. package/dist/introspect/filtering.d.cts +29 -0
  21. package/dist/introspect/filtering.d.cts.map +1 -0
  22. package/dist/introspect/filtering.d.mts +29 -0
  23. package/dist/introspect/filtering.d.mts.map +1 -0
  24. package/dist/introspect/filtering.mjs +98 -0
  25. package/dist/introspect/filtering.mjs.map +1 -0
  26. package/dist/introspect/handler.cjs +159 -0
  27. package/dist/introspect/handler.cjs.map +1 -0
  28. package/dist/introspect/handler.d.cts +43 -0
  29. package/dist/introspect/handler.d.cts.map +1 -0
  30. package/dist/introspect/handler.d.mts +43 -0
  31. package/dist/introspect/handler.d.mts.map +1 -0
  32. package/dist/introspect/handler.mjs +158 -0
  33. package/dist/introspect/handler.mjs.map +1 -0
  34. package/dist/introspect/index.cjs +22 -0
  35. package/dist/introspect/index.d.cts +8 -0
  36. package/dist/introspect/index.d.mts +8 -0
  37. package/dist/introspect/index.mjs +8 -0
  38. package/dist/introspect/introspection.cjs +149 -0
  39. package/dist/introspect/introspection.cjs.map +1 -0
  40. package/dist/introspect/introspection.d.cts +25 -0
  41. package/dist/introspect/introspection.d.cts.map +1 -0
  42. package/dist/introspect/introspection.d.mts +25 -0
  43. package/dist/introspect/introspection.d.mts.map +1 -0
  44. package/dist/introspect/introspection.mjs +146 -0
  45. package/dist/introspect/introspection.mjs.map +1 -0
  46. package/dist/introspect/types.cjs +24 -0
  47. package/dist/introspect/types.cjs.map +1 -0
  48. package/dist/introspect/types.d.cts +113 -0
  49. package/dist/introspect/types.d.cts.map +1 -0
  50. package/dist/introspect/types.d.mts +113 -0
  51. package/dist/introspect/types.d.mts.map +1 -0
  52. package/dist/introspect/types.mjs +23 -0
  53. package/dist/introspect/types.mjs.map +1 -0
  54. package/dist/kysely/pagination.cjs +1 -0
  55. package/dist/kysely/pagination.cjs.map +1 -1
  56. package/dist/kysely/pagination.d.cts +2 -2
  57. package/dist/kysely/pagination.d.cts.map +1 -1
  58. package/dist/kysely/pagination.d.mts +2 -2
  59. package/dist/kysely/pagination.d.mts.map +1 -1
  60. package/dist/kysely/pagination.mjs +2 -2
  61. package/dist/kysely/pagination.mjs.map +1 -1
  62. package/dist/objection/pagination.cjs +1 -0
  63. package/dist/objection/pagination.cjs.map +1 -1
  64. package/dist/objection/pagination.d.cts +2 -2
  65. package/dist/objection/pagination.d.cts.map +1 -1
  66. package/dist/objection/pagination.d.mts +2 -2
  67. package/dist/objection/pagination.d.mts.map +1 -1
  68. package/dist/objection/pagination.mjs +2 -2
  69. package/dist/objection/pagination.mjs.map +1 -1
  70. package/dist/pagination-CrU89125.d.cts +42 -0
  71. package/dist/pagination-CrU89125.d.cts.map +1 -0
  72. package/dist/pagination-CrU89125.d.mts +42 -0
  73. package/dist/pagination-CrU89125.d.mts.map +1 -0
  74. package/dist/pagination.cjs +17 -1
  75. package/dist/pagination.cjs.map +1 -1
  76. package/dist/pagination.d.cts +2 -30
  77. package/dist/pagination.d.mts +2 -30
  78. package/dist/pagination.mjs +17 -2
  79. package/dist/pagination.mjs.map +1 -1
  80. package/package.json +11 -1
  81. package/dist/pagination.d.cts.map +0 -1
  82. package/dist/pagination.d.mts.map +0 -1
@@ -1,30 +1,2 @@
1
- //#region src/pagination.d.ts
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 };
@@ -1,30 +1,2 @@
1
- //#region src/pagination.d.ts
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 };
@@ -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 Error("Invalid cursor format");
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
@@ -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('Invalid cursor format');\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,MAAM,uBAAuB;CACxC;AACD"}
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.55",
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"}