js-bao 0.2.10 → 0.2.12

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 (67) hide show
  1. package/README.md +174 -0
  2. package/dist/BaseModel-5YQCROYE.js +17 -0
  3. package/dist/BaseModel-5YQCROYE.js.map +1 -0
  4. package/dist/BaseModel-FCNWDJBH.js +17 -0
  5. package/dist/BaseModel-FCNWDJBH.js.map +1 -0
  6. package/dist/BrowserDatabaseFactory-PXOTK2DQ.js +119 -0
  7. package/dist/BrowserDatabaseFactory-PXOTK2DQ.js.map +1 -0
  8. package/dist/BrowserDatabaseFactory-WD4VX2VZ.js +119 -0
  9. package/dist/BrowserDatabaseFactory-WD4VX2VZ.js.map +1 -0
  10. package/dist/IncludeResolver-RCKQGNPZ.js +385 -0
  11. package/dist/IncludeResolver-RCKQGNPZ.js.map +1 -0
  12. package/dist/IncludeResolver-WGSQDMS7.js +385 -0
  13. package/dist/IncludeResolver-WGSQDMS7.js.map +1 -0
  14. package/dist/NodeDatabaseFactory-J4Z36UF3.js +165 -0
  15. package/dist/NodeDatabaseFactory-J4Z36UF3.js.map +1 -0
  16. package/dist/NodeDatabaseFactory-QIEKAXBM.js +10 -0
  17. package/dist/NodeDatabaseFactory-QIEKAXBM.js.map +1 -0
  18. package/dist/NodeSqliteEngine-HJSAYE4E.js +383 -0
  19. package/dist/NodeSqliteEngine-HJSAYE4E.js.map +1 -0
  20. package/dist/NodeSqliteEngine-I5SLWLME.js +383 -0
  21. package/dist/NodeSqliteEngine-I5SLWLME.js.map +1 -0
  22. package/dist/browser.cjs +3779 -3370
  23. package/dist/browser.d.cts +18 -1
  24. package/dist/browser.d.ts +18 -1
  25. package/dist/browser.js +3750 -3341
  26. package/dist/chunk-3PZWHUZO.js +4153 -0
  27. package/dist/chunk-3PZWHUZO.js.map +1 -0
  28. package/dist/chunk-53MS4MN7.js +373 -0
  29. package/dist/chunk-53MS4MN7.js.map +1 -0
  30. package/dist/chunk-65G2P4GL.js +709 -0
  31. package/dist/chunk-65G2P4GL.js.map +1 -0
  32. package/dist/chunk-6UX3YSCW.js +4151 -0
  33. package/dist/chunk-6UX3YSCW.js.map +1 -0
  34. package/dist/chunk-DANSD6BE.js +709 -0
  35. package/dist/chunk-DANSD6BE.js.map +1 -0
  36. package/dist/chunk-DF3JEQXA.js +373 -0
  37. package/dist/chunk-DF3JEQXA.js.map +1 -0
  38. package/dist/chunk-GO3APTPX.js +61 -0
  39. package/dist/chunk-GO3APTPX.js.map +1 -0
  40. package/dist/chunk-ID4U6IQC.js +53 -0
  41. package/dist/chunk-ID4U6IQC.js.map +1 -0
  42. package/dist/chunk-RQVS3LVL.js +165 -0
  43. package/dist/chunk-RQVS3LVL.js.map +1 -0
  44. package/dist/client.cjs +837 -0
  45. package/dist/client.d.cts +1101 -0
  46. package/dist/client.d.ts +1101 -0
  47. package/dist/client.js +806 -0
  48. package/dist/cloudflare-do.cjs +3637 -0
  49. package/dist/cloudflare-do.d.cts +1366 -0
  50. package/dist/cloudflare-do.d.ts +1366 -0
  51. package/dist/cloudflare-do.js +3614 -0
  52. package/dist/cloudflare.cjs +1048 -0
  53. package/dist/cloudflare.d.cts +1381 -0
  54. package/dist/cloudflare.d.ts +1381 -0
  55. package/dist/cloudflare.js +1017 -0
  56. package/dist/codegen.cjs +259 -18
  57. package/dist/environment-TOTQICSE.js +17 -0
  58. package/dist/environment-TOTQICSE.js.map +1 -0
  59. package/dist/index.cjs +1906 -1493
  60. package/dist/index.d.cts +19 -2
  61. package/dist/index.d.ts +19 -2
  62. package/dist/index.js +1871 -1458
  63. package/dist/node.cjs +4779 -4366
  64. package/dist/node.d.cts +18 -1
  65. package/dist/node.d.ts +18 -1
  66. package/dist/node.js +4602 -4189
  67. package/package.json +41 -12
package/dist/index.d.cts CHANGED
@@ -139,6 +139,19 @@ type SortSpec = {
139
139
  type ProjectionSpec = {
140
140
  [field: string]: 1 | 0;
141
141
  };
142
+ interface IncludeSpec {
143
+ model: string;
144
+ type: "refersTo" | "hasMany" | "refersToMany";
145
+ sourceField?: string;
146
+ foreignKey?: string;
147
+ localField?: string;
148
+ as?: string;
149
+ projection?: ProjectionSpec;
150
+ limit?: number;
151
+ sort?: SortSpec;
152
+ filter?: DocumentFilter;
153
+ include?: IncludeSpec[];
154
+ }
142
155
  interface QueryOptions {
143
156
  sort?: SortSpec;
144
157
  projection?: ProjectionSpec;
@@ -146,6 +159,7 @@ interface QueryOptions {
146
159
  limit?: number;
147
160
  uniqueStartKey?: string;
148
161
  direction?: 1 | -1;
162
+ include?: IncludeSpec[];
149
163
  }
150
164
  interface PaginatedResult<T> {
151
165
  data: T[];
@@ -314,7 +328,10 @@ declare class DocumentQueryTranslator {
314
328
  /**
315
329
  * Translate document filter to SQL WHERE clause
316
330
  */
317
- private translateFilter;
331
+ translateFilter(filter: DocumentFilter): {
332
+ sql: string;
333
+ params: any[];
334
+ };
318
335
  /**
319
336
  * Translate logical operators ($and, $or)
320
337
  */
@@ -806,4 +823,4 @@ declare function dumpYDocToPlain(yDoc: Y.Doc, options?: DumpOptions): PlainYDoc;
806
823
  */
807
824
  declare function summarizePlainYDoc(dump: PlainYDoc): DumpSummary;
808
825
 
809
- export { BaseModel, type ConnectedDocument, type DatabaseConfig, DatabaseEngine, DocumentClosedError, type DocumentConnectionCallback, type DocumentConnectionEvent, type DocumentFilter, type DocumentManager, type DocumentPermissionHint, DocumentResolutionError, type DumpOptions, type DumpSummary, type DumpSummaryEntry, Field, type FieldOptions, type InferAttrs, type InitJsBaoOptions, type InitJsBaoResult, LogLevel, Logger, Model, type ModelConstructor, type ModelOptions, ModelRegistry, type PaginatedResult, type PaginationOptions, type PlainYDoc, type ProjectionSpec, type QueryOptions, type QueryResult, RecordNotFoundError, type SaveOptions, StringSet, UniqueConstraintViolationError, attachAndRegisterModel, attachSchemaToClass, autoRegisterModel, createModelClass, defineModelSchema, dumpYDocToPlain, generateULID, initJsBao, resetJsBao, summarizePlainYDoc };
826
+ export { BaseModel, type ConnectedDocument, type DatabaseConfig, DatabaseEngine, DocumentClosedError, type DocumentConnectionCallback, type DocumentConnectionEvent, type DocumentFilter, type DocumentManager, type DocumentPermissionHint, DocumentResolutionError, type DumpOptions, type DumpSummary, type DumpSummaryEntry, Field, type FieldOptions, type IncludeSpec, type InferAttrs, type InitJsBaoOptions, type InitJsBaoResult, LogLevel, Logger, Model, type ModelConstructor, type ModelOptions, ModelRegistry, type PaginatedResult, type PaginationOptions, type PlainYDoc, type ProjectionSpec, type QueryOptions, type QueryResult, RecordNotFoundError, type SaveOptions, StringSet, UniqueConstraintViolationError, attachAndRegisterModel, attachSchemaToClass, autoRegisterModel, createModelClass, defineModelSchema, dumpYDocToPlain, generateULID, initJsBao, resetJsBao, summarizePlainYDoc };
package/dist/index.d.ts CHANGED
@@ -139,6 +139,19 @@ type SortSpec = {
139
139
  type ProjectionSpec = {
140
140
  [field: string]: 1 | 0;
141
141
  };
142
+ interface IncludeSpec {
143
+ model: string;
144
+ type: "refersTo" | "hasMany" | "refersToMany";
145
+ sourceField?: string;
146
+ foreignKey?: string;
147
+ localField?: string;
148
+ as?: string;
149
+ projection?: ProjectionSpec;
150
+ limit?: number;
151
+ sort?: SortSpec;
152
+ filter?: DocumentFilter;
153
+ include?: IncludeSpec[];
154
+ }
142
155
  interface QueryOptions {
143
156
  sort?: SortSpec;
144
157
  projection?: ProjectionSpec;
@@ -146,6 +159,7 @@ interface QueryOptions {
146
159
  limit?: number;
147
160
  uniqueStartKey?: string;
148
161
  direction?: 1 | -1;
162
+ include?: IncludeSpec[];
149
163
  }
150
164
  interface PaginatedResult<T> {
151
165
  data: T[];
@@ -314,7 +328,10 @@ declare class DocumentQueryTranslator {
314
328
  /**
315
329
  * Translate document filter to SQL WHERE clause
316
330
  */
317
- private translateFilter;
331
+ translateFilter(filter: DocumentFilter): {
332
+ sql: string;
333
+ params: any[];
334
+ };
318
335
  /**
319
336
  * Translate logical operators ($and, $or)
320
337
  */
@@ -806,4 +823,4 @@ declare function dumpYDocToPlain(yDoc: Y.Doc, options?: DumpOptions): PlainYDoc;
806
823
  */
807
824
  declare function summarizePlainYDoc(dump: PlainYDoc): DumpSummary;
808
825
 
809
- export { BaseModel, type ConnectedDocument, type DatabaseConfig, DatabaseEngine, DocumentClosedError, type DocumentConnectionCallback, type DocumentConnectionEvent, type DocumentFilter, type DocumentManager, type DocumentPermissionHint, DocumentResolutionError, type DumpOptions, type DumpSummary, type DumpSummaryEntry, Field, type FieldOptions, type InferAttrs, type InitJsBaoOptions, type InitJsBaoResult, LogLevel, Logger, Model, type ModelConstructor, type ModelOptions, ModelRegistry, type PaginatedResult, type PaginationOptions, type PlainYDoc, type ProjectionSpec, type QueryOptions, type QueryResult, RecordNotFoundError, type SaveOptions, StringSet, UniqueConstraintViolationError, attachAndRegisterModel, attachSchemaToClass, autoRegisterModel, createModelClass, defineModelSchema, dumpYDocToPlain, generateULID, initJsBao, resetJsBao, summarizePlainYDoc };
826
+ export { BaseModel, type ConnectedDocument, type DatabaseConfig, DatabaseEngine, DocumentClosedError, type DocumentConnectionCallback, type DocumentConnectionEvent, type DocumentFilter, type DocumentManager, type DocumentPermissionHint, DocumentResolutionError, type DumpOptions, type DumpSummary, type DumpSummaryEntry, Field, type FieldOptions, type IncludeSpec, type InferAttrs, type InitJsBaoOptions, type InitJsBaoResult, LogLevel, Logger, Model, type ModelConstructor, type ModelOptions, ModelRegistry, type PaginatedResult, type PaginationOptions, type PlainYDoc, type ProjectionSpec, type QueryOptions, type QueryResult, RecordNotFoundError, type SaveOptions, StringSet, UniqueConstraintViolationError, attachAndRegisterModel, attachSchemaToClass, autoRegisterModel, createModelClass, defineModelSchema, dumpYDocToPlain, generateULID, initJsBao, resetJsBao, summarizePlainYDoc };