@routier/core 0.0.1-alpha.2 → 0.0.1

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 (36) hide show
  1. package/dist/assertions/index.d.ts +1 -1
  2. package/dist/assertions/index.js +7 -1
  3. package/dist/assertions/index.js.map +1 -1
  4. package/dist/codegen/handlers/SerializeHandlerBuilder.d.ts +2 -2
  5. package/dist/codegen/handlers/clone/CloneArrayHandler.d.ts +6 -0
  6. package/dist/codegen/handlers/deserialize/DeserializeDeserializerHandler.d.ts +6 -0
  7. package/dist/codegen/handlers/serialize/SerializeSerializerHandler.d.ts +6 -0
  8. package/dist/collections/ReadonlySchemaCollection.d.ts +17 -0
  9. package/dist/collections/SchemaCollection.d.ts +5 -3
  10. package/dist/collections/index.d.ts +1 -0
  11. package/dist/collections/index.js +67 -9
  12. package/dist/collections/index.js.map +1 -1
  13. package/dist/expressions/index.js +67 -23
  14. package/dist/expressions/index.js.map +1 -1
  15. package/dist/expressions/parser.d.ts +1 -1
  16. package/dist/index.js +598 -223
  17. package/dist/index.js.map +1 -1
  18. package/dist/plugins/index.js +58 -9
  19. package/dist/plugins/index.js.map +1 -1
  20. package/dist/plugins/translators/SqlTranslator.d.ts +2 -1
  21. package/dist/plugins/types.d.ts +2 -0
  22. package/dist/schema/communication/broadcast.d.ts +11 -0
  23. package/dist/schema/index.js +420 -182
  24. package/dist/schema/index.js.map +1 -1
  25. package/dist/schema/property/modifiers/SchemaSerialize.d.ts +1 -1
  26. package/dist/schema/testSchemas.test.d.ts +269 -0
  27. package/dist/schema/types.d.ts +7 -4
  28. package/dist/utilities/dbPluginEventUtils.d.ts +1 -1
  29. package/dist/utilities/functions.d.ts +1 -0
  30. package/dist/utilities/index.d.ts +1 -0
  31. package/dist/utilities/index.js +18 -1
  32. package/dist/utilities/index.js.map +1 -1
  33. package/dist/utilities/types.d.ts +3 -0
  34. package/package.json +3 -4
  35. package/readme.md +0 -6
  36. /package/dist/{pipeline/TrampolinePipeline.test.d.ts → schema/schemaGeneration.test.d.ts} +0 -0
@@ -5,5 +5,5 @@ export declare class SchemaSerialize<T extends any, TModifiers extends SchemaMod
5
5
  instance: T;
6
6
  private _schemaSerialize;
7
7
  constructor(serializer: PropertySerializer<T>, current: SchemaBase<T, TModifiers>);
8
- deserializer(deserializer: PropertyDeserializer<T>): SchemaDeserialize<T, "deserialize" | TModifiers>;
8
+ deserialize(deserializer: PropertyDeserializer<T>): SchemaDeserialize<T, "deserialize" | TModifiers>;
9
9
  }
@@ -0,0 +1,269 @@
1
+ export declare const optionalObjectSchemaFactory: () => import("./types").CompiledSchema<{
2
+ id: import(".").SchemaKey<string, "key">;
3
+ user: import(".").SchemaOptional<{
4
+ name: import(".").SchemaString<string, never>;
5
+ }, "optional">;
6
+ content: import(".").SchemaString<string, never>;
7
+ replies: import(".").SchemaDefault<number, never, "default">;
8
+ createdAt: import(".").SchemaDeserialize<Date, "default" | "deserialize">;
9
+ }>;
10
+ export declare const usersSchemaOneFactory: () => import("./types").CompiledSchema<{
11
+ documentType: import(".").SchemaTracked<string, "unmapped">;
12
+ } & {
13
+ id: import(".").SchemaDefault<string, {
14
+ uuid: () => string;
15
+ }, "default" | "key">;
16
+ firstName: import(".").SchemaString<string, never>;
17
+ lastName: import(".").SchemaString<string, never>;
18
+ age: import(".").SchemaNumber<number, never>;
19
+ createdDate: import(".").SchemaDefault<Date, never, "default">;
20
+ address: import(".").SchemaObject<{
21
+ street: import(".").SchemaString<string, never>;
22
+ city: import(".").SchemaString<string, never>;
23
+ state: import(".").SchemaString<string, never>;
24
+ zip: import(".").SchemaString<string, never>;
25
+ }, never>;
26
+ }>;
27
+ export declare const usersSchemaTwoFactory: () => import("./types").CompiledSchema<{
28
+ documentType: import(".").SchemaTracked<string, "unmapped">;
29
+ } & {
30
+ id: import(".").SchemaDefault<string, {
31
+ uuid: () => string;
32
+ }, "default" | "key">;
33
+ firstName: import(".").SchemaString<string, never>;
34
+ lastName: import(".").SchemaString<string, never>;
35
+ age: import(".").SchemaNumber<number, never>;
36
+ createdDate: import(".").SchemaDefault<Date, never, "default">;
37
+ address: import(".").SchemaObject<{
38
+ street: import(".").SchemaString<string, never>;
39
+ city: import(".").SchemaString<string, never>;
40
+ state: import(".").SchemaObject<{
41
+ id: import(".").SchemaString<string, never>;
42
+ name: import(".").SchemaString<string, never>;
43
+ abbreviation: import(".").SchemaString<string, never>;
44
+ }, never>;
45
+ zip: import(".").SchemaString<string, never>;
46
+ }, never>;
47
+ }>;
48
+ export declare const oneComputedPropertySchemaFactory: () => import("./types").CompiledSchema<{
49
+ documentType: import(".").SchemaTracked<string, "unmapped">;
50
+ } & {
51
+ id: import(".").SchemaIdentity<string, "identity" | "key">;
52
+ title: import(".").SchemaString<string, never>;
53
+ authorId: import(".").SchemaString<string, never>;
54
+ content: import(".").SchemaString<string, never>;
55
+ tags: import(".").SchemaArray<import(".").SchemaString<string, never>, never>;
56
+ isPublished: import(".").SchemaBoolean<boolean, never>;
57
+ publishedAt: import(".").SchemaDate<Date, never>;
58
+ }>;
59
+ export declare const oneDefaultFunctionSchemaFactory: () => import("./types").CompiledSchema<{
60
+ id: import(".").SchemaKey<string, "key">;
61
+ content: import(".").SchemaString<string, never>;
62
+ replies: import(".").SchemaDefault<number, never, "default">;
63
+ createdAt: import(".").SchemaDeserialize<Date, "default" | "deserialize">;
64
+ }>;
65
+ export declare const oneSerializeDeserializeSchemaFactory: () => import("./types").CompiledSchema<{
66
+ id: import(".").SchemaKey<string, "key">;
67
+ content: import(".").SchemaString<string, never>;
68
+ replies: import(".").SchemaDefault<number, never, "default">;
69
+ createdAt: import(".").SchemaDeserialize<Date, "deserialize">;
70
+ }>;
71
+ export declare const oneDefaultWithInjectionSchemaFactory: () => import("./types").CompiledSchema<{
72
+ _id: import(".").SchemaIdentity<string, "identity" | "key">;
73
+ _rev: import(".").SchemaIdentity<string, "identity" | "readonly">;
74
+ name: import(".").SchemaDefault<string, {
75
+ name: string;
76
+ }, "default">;
77
+ location: import(".").SchemaOptional<string, "optional">;
78
+ startTime: import(".").SchemaDate<Date, never>;
79
+ endTime: import(".").SchemaOptional<Date, "optional">;
80
+ description: import(".").SchemaOptional<string, "optional">;
81
+ isOnline: import(".").SchemaBoolean<boolean, never>;
82
+ }>;
83
+ export declare const computedAndFunctionPropertiesSchemaFactory: () => import("./types").CompiledSchema<{
84
+ hasCollectionName: import(".").SchemaTracked<boolean, "unmapped">;
85
+ wasRestocked: import("./table").SchemaFunction<boolean, {
86
+ isNullOrEmpty: (value: unknown) => boolean;
87
+ }, "unmapped">;
88
+ } & {
89
+ sku: import(".").SchemaIdentity<string, "identity" | "key">;
90
+ name: import(".").SchemaString<string, never>;
91
+ quantity: import(".").SchemaNumber<number, never>;
92
+ warehouseLocation: import(".").SchemaOptional<string, "optional">;
93
+ restockDate: import(".").SchemaOptional<Date, "optional">;
94
+ discontinued: import(".").SchemaBoolean<boolean, never>;
95
+ }>;
96
+ export declare const deeplyNestedSchemaFactory: () => import("./types").CompiledSchema<{
97
+ documentType: import(".").SchemaTracked<string, "unmapped">;
98
+ } & {
99
+ id: import(".").SchemaDefault<string, {
100
+ uuid: () => string;
101
+ }, "default" | "key">;
102
+ firstName: import(".").SchemaString<string, never>;
103
+ lastName: import(".").SchemaString<string, never>;
104
+ age: import(".").SchemaNumber<number, never>;
105
+ createdDate: import(".").SchemaDefault<Date, never, "default">;
106
+ address: import(".").SchemaObject<{
107
+ street: import(".").SchemaString<string, never>;
108
+ city: import(".").SchemaString<string, never>;
109
+ state: import(".").SchemaObject<{
110
+ id: import(".").SchemaString<string, never>;
111
+ name: import(".").SchemaString<string, never>;
112
+ abbreviation: import(".").SchemaString<string, never>;
113
+ }, never>;
114
+ zip: import(".").SchemaString<string, never>;
115
+ }, never>;
116
+ }>;
117
+ export declare const complexOneSchemaFactory: () => import("./types").CompiledSchema<{
118
+ documentType: import(".").SchemaTracked<string, "unmapped">;
119
+ } & {
120
+ id: import(".").SchemaDefault<string, {
121
+ uuid: () => string;
122
+ }, "default" | "key">;
123
+ firstName: import(".").SchemaString<string, never>;
124
+ lastName: import(".").SchemaString<string, never>;
125
+ age: import(".").SchemaNumber<number, never>;
126
+ createdDate: import(".").SchemaDefault<Date, never, "default">;
127
+ address: import(".").SchemaObject<{
128
+ street: import(".").SchemaString<string, never>;
129
+ city: import(".").SchemaString<string, never>;
130
+ state: import(".").SchemaString<string, never>;
131
+ zip: import(".").SchemaString<string, never>;
132
+ }, never>;
133
+ }>;
134
+ export declare const complexTwoSchemaFactory: () => import("./types").CompiledSchema<{
135
+ documentType: import(".").SchemaTracked<string, "unmapped">;
136
+ } & {
137
+ fullName: import("./table").SchemaComputed<string, never, "unmapped">;
138
+ age: import("./table").SchemaComputed<number, never, "unmapped">;
139
+ formattedAddress: import("./table").SchemaComputed<string, never, "unmapped">;
140
+ isActive: import("./table").SchemaComputed<boolean, never, "unmapped">;
141
+ getDisplayName: import("./table").SchemaFunction<(format: "short" | "full") => string, never, "unmapped">;
142
+ documentType: import(".").SchemaTracked<string, "unmapped">;
143
+ } & {
144
+ _id: import(".").SchemaIdentity<string, "identity" | "key">;
145
+ _rev: import(".").SchemaIdentity<string, "identity" | "readonly">;
146
+ firstName: import(".").SchemaString<string, never>;
147
+ lastName: import(".").SchemaString<string, never>;
148
+ email: import(".").SchemaString<string, never>;
149
+ dateOfBirth: import(".").SchemaDate<Date, never>;
150
+ address: import(".").SchemaObject<{
151
+ street: import(".").SchemaString<string, never>;
152
+ city: import(".").SchemaString<string, never>;
153
+ state: import(".").SchemaString<string, never>;
154
+ zipCode: import(".").SchemaString<string, never>;
155
+ country: import(".").SchemaString<string, never>;
156
+ }, never>;
157
+ preferences: import(".").SchemaObject<{
158
+ theme: import(".").SchemaString<"light" | "dark", never>;
159
+ notifications: import(".").SchemaBoolean<boolean, never>;
160
+ language: import(".").SchemaString<string, never>;
161
+ }, never>;
162
+ lastLoginAt: import(".").SchemaOptional<Date, "optional">;
163
+ createdAt: import(".").SchemaDefault<Date, never, "default">;
164
+ }>;
165
+ export declare const factories: ((() => import("./types").CompiledSchema<{
166
+ documentType: import(".").SchemaTracked<string, "unmapped">;
167
+ } & {
168
+ id: import(".").SchemaDefault<string, {
169
+ uuid: () => string;
170
+ }, "default" | "key">;
171
+ firstName: import(".").SchemaString<string, never>;
172
+ lastName: import(".").SchemaString<string, never>;
173
+ age: import(".").SchemaNumber<number, never>;
174
+ createdDate: import(".").SchemaDefault<Date, never, "default">;
175
+ address: import(".").SchemaObject<{
176
+ street: import(".").SchemaString<string, never>;
177
+ city: import(".").SchemaString<string, never>;
178
+ state: import(".").SchemaString<string, never>;
179
+ zip: import(".").SchemaString<string, never>;
180
+ }, never>;
181
+ }>) | (() => import("./types").CompiledSchema<{
182
+ documentType: import(".").SchemaTracked<string, "unmapped">;
183
+ } & {
184
+ id: import(".").SchemaIdentity<string, "identity" | "key">;
185
+ title: import(".").SchemaString<string, never>;
186
+ authorId: import(".").SchemaString<string, never>;
187
+ content: import(".").SchemaString<string, never>;
188
+ tags: import(".").SchemaArray<import(".").SchemaString<string, never>, never>;
189
+ isPublished: import(".").SchemaBoolean<boolean, never>;
190
+ publishedAt: import(".").SchemaDate<Date, never>;
191
+ }>) | (() => import("./types").CompiledSchema<{
192
+ id: import(".").SchemaKey<string, "key">;
193
+ content: import(".").SchemaString<string, never>;
194
+ replies: import(".").SchemaDefault<number, never, "default">;
195
+ createdAt: import(".").SchemaDeserialize<Date, "default" | "deserialize">;
196
+ }>) | (() => import("./types").CompiledSchema<{
197
+ _id: import(".").SchemaIdentity<string, "identity" | "key">;
198
+ _rev: import(".").SchemaIdentity<string, "identity" | "readonly">;
199
+ name: import(".").SchemaDefault<string, {
200
+ name: string;
201
+ }, "default">;
202
+ location: import(".").SchemaOptional<string, "optional">;
203
+ startTime: import(".").SchemaDate<Date, never>;
204
+ endTime: import(".").SchemaOptional<Date, "optional">;
205
+ description: import(".").SchemaOptional<string, "optional">;
206
+ isOnline: import(".").SchemaBoolean<boolean, never>;
207
+ }>) | (() => import("./types").CompiledSchema<{
208
+ hasCollectionName: import(".").SchemaTracked<boolean, "unmapped">;
209
+ wasRestocked: import("./table").SchemaFunction<boolean, {
210
+ isNullOrEmpty: (value: unknown) => boolean;
211
+ }, "unmapped">;
212
+ } & {
213
+ sku: import(".").SchemaIdentity<string, "identity" | "key">;
214
+ name: import(".").SchemaString<string, never>;
215
+ quantity: import(".").SchemaNumber<number, never>;
216
+ warehouseLocation: import(".").SchemaOptional<string, "optional">;
217
+ restockDate: import(".").SchemaOptional<Date, "optional">;
218
+ discontinued: import(".").SchemaBoolean<boolean, never>;
219
+ }>) | (() => import("./types").CompiledSchema<{
220
+ documentType: import(".").SchemaTracked<string, "unmapped">;
221
+ } & {
222
+ id: import(".").SchemaDefault<string, {
223
+ uuid: () => string;
224
+ }, "default" | "key">;
225
+ firstName: import(".").SchemaString<string, never>;
226
+ lastName: import(".").SchemaString<string, never>;
227
+ age: import(".").SchemaNumber<number, never>;
228
+ createdDate: import(".").SchemaDefault<Date, never, "default">;
229
+ address: import(".").SchemaObject<{
230
+ street: import(".").SchemaString<string, never>;
231
+ city: import(".").SchemaString<string, never>;
232
+ state: import(".").SchemaObject<{
233
+ id: import(".").SchemaString<string, never>;
234
+ name: import(".").SchemaString<string, never>;
235
+ abbreviation: import(".").SchemaString<string, never>;
236
+ }, never>;
237
+ zip: import(".").SchemaString<string, never>;
238
+ }, never>;
239
+ }>) | (() => import("./types").CompiledSchema<{
240
+ documentType: import(".").SchemaTracked<string, "unmapped">;
241
+ } & {
242
+ fullName: import("./table").SchemaComputed<string, never, "unmapped">;
243
+ age: import("./table").SchemaComputed<number, never, "unmapped">;
244
+ formattedAddress: import("./table").SchemaComputed<string, never, "unmapped">;
245
+ isActive: import("./table").SchemaComputed<boolean, never, "unmapped">;
246
+ getDisplayName: import("./table").SchemaFunction<(format: "short" | "full") => string, never, "unmapped">;
247
+ documentType: import(".").SchemaTracked<string, "unmapped">;
248
+ } & {
249
+ _id: import(".").SchemaIdentity<string, "identity" | "key">;
250
+ _rev: import(".").SchemaIdentity<string, "identity" | "readonly">;
251
+ firstName: import(".").SchemaString<string, never>;
252
+ lastName: import(".").SchemaString<string, never>;
253
+ email: import(".").SchemaString<string, never>;
254
+ dateOfBirth: import(".").SchemaDate<Date, never>;
255
+ address: import(".").SchemaObject<{
256
+ street: import(".").SchemaString<string, never>;
257
+ city: import(".").SchemaString<string, never>;
258
+ state: import(".").SchemaString<string, never>;
259
+ zipCode: import(".").SchemaString<string, never>;
260
+ country: import(".").SchemaString<string, never>;
261
+ }, never>;
262
+ preferences: import(".").SchemaObject<{
263
+ theme: import(".").SchemaString<"light" | "dark", never>;
264
+ notifications: import(".").SchemaBoolean<boolean, never>;
265
+ language: import(".").SchemaString<string, never>;
266
+ }, never>;
267
+ lastLoginAt: import(".").SchemaOptional<Date, "optional">;
268
+ createdAt: import(".").SchemaDefault<Date, never, "default">;
269
+ }>))[];
@@ -5,6 +5,7 @@ import { SchemaObject } from "./property/types/SchemaObject";
5
5
  import { PropertyInfo } from "./PropertyInfo";
6
6
  import { DeepPartial } from "../types";
7
7
  import { SchemaFunction } from "./table";
8
+ import { SchemaOptional } from "./property/modifiers";
8
9
  export type DefaultValue<T, I = never> = T | ((injected: I) => T);
9
10
  export type FunctionBody<TEntity, TResult> = (entity: TEntity, collectionName: string) => TResult;
10
11
  export type IdType = string | number;
@@ -77,7 +78,7 @@ export type SubscriptionChanges<T extends {}> = {
77
78
  */
78
79
  unknown: InferType<T>[];
79
80
  };
80
- export interface ICollectionSubscription<T extends {}> extends Disposable {
81
+ export interface ISchemaSubscription<T extends {}> extends Disposable {
81
82
  send(changes: SubscriptionChanges<T>): void;
82
83
  onMessage(callback: (changes: SubscriptionChanges<T>) => void): void;
83
84
  }
@@ -90,7 +91,7 @@ type Enrich<TEntity extends {}> = {
90
91
  */
91
92
  export type CompiledSchema<TEntity extends {}> = {
92
93
  deserializePartial: (item: Record<string, unknown>, properties: PropertyInfo<TEntity>[]) => DeepPartial<InferType<TEntity>>;
93
- createSubscription: (abortSignal?: AbortSignal) => ICollectionSubscription<TEntity>;
94
+ createSubscription: (abortSignal?: AbortSignal) => ISchemaSubscription<TEntity>;
94
95
  /** Returns the property info for a given id (full path) */
95
96
  getProperty: (id: string) => PropertyInfo<TEntity>;
96
97
  /** Returns the ID of the given entity. */
@@ -144,9 +145,11 @@ export type PropertySerializer<T extends any> = (value: T) => string | number;
144
145
  export type PropertyDeserializer<T extends any> = (value: string | number) => T;
145
146
  export type SchemaId = number;
146
147
  export type SchemaModifiers = "default" | "deserialize" | "identity" | "key" | "nullable" | "optional" | "readonly" | "serialize" | "unmapped" | "computed" | "distinct";
147
- type InferPrimitive<T> = T extends SchemaArray<infer Y, infer __> ? InferPrimitive<Y>[] : T extends SchemaObject<infer Obj, infer _> ? {
148
+ type InferPrimitive<T> = T extends SchemaOptional<infer C, infer __> ? C extends (string | number | Date) ? C : {
149
+ [K in keyof C]: InferPrimitive<C[K]>;
150
+ } : T extends SchemaArray<infer Y, infer __> ? InferPrimitive<Y>[] : T extends SchemaObject<infer Obj, infer _> ? {
148
151
  [K in keyof Obj]: InferPrimitive<Obj[K]>;
149
- } : T extends SchemaFunction<infer F, infer __> ? F : T extends SchemaBase<infer X, infer _> ? X : never;
152
+ } : T extends SchemaFunction<infer F, infer __> ? F : T extends SchemaBase<infer X, infer _> ? X extends Array<infer A> ? InferPrimitive<A>[] : X : never;
150
153
  export type InferType<T> = T extends CompiledSchema<infer R> ? InferCompiledSchema<R> : T extends {} ? InferCompiledSchema<T> : T;
151
154
  export type InferCreateType<T> = T extends CompiledSchema<infer R> ? InferCompiledCreateSchema<R> : T extends {} ? InferCompiledCreateSchema<T> : unknown;
152
155
  export type InferMappedType<T> = T extends SchemaBase<infer K, infer __> ? InferType<K> : InferCompiledSchema<T>;
@@ -1,4 +1,4 @@
1
- import { InferCreateType, InferType, SchemaId } from "src/schema";
1
+ import { InferCreateType, InferType, SchemaId } from "../schema";
2
2
  import { DbPluginBulkPersistEvent, EntityUpdateInfo } from "../plugins";
3
3
  type DbEvent = {
4
4
  type: "add";
@@ -0,0 +1 @@
1
+ export declare const noop: (...args: any[]) => void;
@@ -8,3 +8,4 @@ export * from './replication';
8
8
  export * from './types';
9
9
  export * from './queryOptionsCollection';
10
10
  export * from './dbPluginEventUtils';
11
+ export * from './functions';
@@ -266,6 +266,19 @@ const toEventArray = (event) => {
266
266
  };
267
267
 
268
268
 
269
+ }),
270
+ "./src/utilities/functions.ts":
271
+ /*!************************************!*\
272
+ !*** ./src/utilities/functions.ts ***!
273
+ \************************************/
274
+ (function (__unused_webpack_module, __webpack_exports__, __webpack_require__) {
275
+ __webpack_require__.r(__webpack_exports__);
276
+ __webpack_require__.d(__webpack_exports__, {
277
+ noop: () => (noop)
278
+ });
279
+ const noop = (...args) => { };
280
+
281
+
269
282
  }),
270
283
  "./src/utilities/objects.ts":
271
284
  /*!**********************************!*\
@@ -510,6 +523,7 @@ __webpack_require__.d(__webpack_exports__, {
510
523
  hash: () => (/* reexport safe */ _strings__WEBPACK_IMPORTED_MODULE_1__.hash),
511
524
  isDate: () => (/* reexport safe */ _dates__WEBPACK_IMPORTED_MODULE_2__.isDate),
512
525
  isNodeRuntime: () => (/* reexport safe */ _runtime__WEBPACK_IMPORTED_MODULE_4__.isNodeRuntime),
526
+ noop: () => (/* reexport safe */ _functions__WEBPACK_IMPORTED_MODULE_9__.noop),
513
527
  resolveBulkPersistChanges: () => (/* reexport safe */ _replication__WEBPACK_IMPORTED_MODULE_6__.resolveBulkPersistChanges),
514
528
  toEventArray: () => (/* reexport safe */ _dbPluginEventUtils__WEBPACK_IMPORTED_MODULE_8__.toEventArray),
515
529
  toMap: () => (/* reexport safe */ _arrays__WEBPACK_IMPORTED_MODULE_0__.toMap),
@@ -525,6 +539,8 @@ __webpack_require__.d(__webpack_exports__, {
525
539
  /* ESM import */var _replication__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./replication */ "./src/utilities/replication.ts");
526
540
  /* ESM import */var _queryOptionsCollection__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./queryOptionsCollection */ "./src/utilities/queryOptionsCollection.ts");
527
541
  /* ESM import */var _dbPluginEventUtils__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./dbPluginEventUtils */ "./src/utilities/dbPluginEventUtils.ts");
542
+ /* ESM import */var _functions__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./functions */ "./src/utilities/functions.ts");
543
+
528
544
 
529
545
 
530
546
 
@@ -544,11 +560,12 @@ var __webpack_exports__combineQueryOptionsCollections = __webpack_exports__.comb
544
560
  var __webpack_exports__hash = __webpack_exports__.hash;
545
561
  var __webpack_exports__isDate = __webpack_exports__.isDate;
546
562
  var __webpack_exports__isNodeRuntime = __webpack_exports__.isNodeRuntime;
563
+ var __webpack_exports__noop = __webpack_exports__.noop;
547
564
  var __webpack_exports__resolveBulkPersistChanges = __webpack_exports__.resolveBulkPersistChanges;
548
565
  var __webpack_exports__toEventArray = __webpack_exports__.toEventArray;
549
566
  var __webpack_exports__toMap = __webpack_exports__.toMap;
550
567
  var __webpack_exports__uuid = __webpack_exports__.uuid;
551
568
  var __webpack_exports__uuidv4 = __webpack_exports__.uuidv4;
552
- export { __webpack_exports__cast as cast, __webpack_exports__clone as clone, __webpack_exports__combineQueryOptionsCollections as combineQueryOptionsCollections, __webpack_exports__hash as hash, __webpack_exports__isDate as isDate, __webpack_exports__isNodeRuntime as isNodeRuntime, __webpack_exports__resolveBulkPersistChanges as resolveBulkPersistChanges, __webpack_exports__toEventArray as toEventArray, __webpack_exports__toMap as toMap, __webpack_exports__uuid as uuid, __webpack_exports__uuidv4 as uuidv4 };
569
+ export { __webpack_exports__cast as cast, __webpack_exports__clone as clone, __webpack_exports__combineQueryOptionsCollections as combineQueryOptionsCollections, __webpack_exports__hash as hash, __webpack_exports__isDate as isDate, __webpack_exports__isNodeRuntime as isNodeRuntime, __webpack_exports__noop as noop, __webpack_exports__resolveBulkPersistChanges as resolveBulkPersistChanges, __webpack_exports__toEventArray as toEventArray, __webpack_exports__toMap as toMap, __webpack_exports__uuid as uuid, __webpack_exports__uuidv4 as uuidv4 };
553
570
 
554
571
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utilities/index.js","sources":["webpack://@routier/core/./src/expressions/utils.ts","webpack://@routier/core/./src/plugins/query/QueryOptionsCollection.ts","webpack://@routier/core/./src/utilities/arrays.ts","webpack://@routier/core/./src/utilities/dates.ts","webpack://@routier/core/./src/utilities/dbPluginEventUtils.ts","webpack://@routier/core/./src/utilities/objects.ts","webpack://@routier/core/./src/utilities/queryOptionsCollection.ts","webpack://@routier/core/./src/utilities/replication.ts","webpack://@routier/core/./src/utilities/runtime.ts","webpack://@routier/core/./src/utilities/strings.ts","webpack://@routier/core/./src/utilities/uuid.ts","webpack://@routier/core/webpack/runtime/define_property_getters","webpack://@routier/core/webpack/runtime/has_own_property","webpack://@routier/core/webpack/runtime/make_namespace_object","webpack://@routier/core/./src/utilities/index.ts"],"sourcesContent":["import { PropertyInfo } from \"../schema\";\nimport { Expression, PropertyExpression } from \"./types\";\n\n/**\n * Extracts all properties referenced in an expression\n * @param expression The expression to analyze\n * @returns Array of PropertyInfo objects referenced in the expression\n */\nexport function getProperties(expression: Expression): PropertyInfo<any>[] {\n const properties: PropertyInfo<any>[] = [];\n\n function traverse(expr: Expression) {\n // If this is a property expression, add it to our collection\n if (expr.type === \"property\") {\n properties.push((expr as PropertyExpression).property);\n }\n\n // Traverse left and right expressions if they exist\n if (expr.left) {\n traverse(expr.left);\n }\n if (expr.right) {\n traverse(expr.right);\n }\n }\n\n traverse(expression);\n return properties;\n}\n\nexport function isPropertyExpression(expression: Expression): expression is PropertyExpression {\n return expression.type === \"property\";\n}\n\nexport function forEach(expression: Expression, callback: (expression: Expression) => boolean) {\n function traverse(expr: Expression): boolean {\n // Call the callback for this expression\n // If callback returns false, stop traversing\n if (!callback(expr)) {\n return false;\n }\n\n // Traverse left and right expressions if they exist\n if (expr.left) {\n if (!traverse(expr.left)) {\n return false;\n }\n }\n if (expr.right) {\n if (!traverse(expr.right)) {\n return false;\n }\n }\n\n return true;\n }\n\n traverse(expression);\n}","import { forEach, isPropertyExpression } from \"../../expressions/utils\";\nimport { QueryOption, QueryOptionName, QueryOptionExecutionTarget, QueryOptionValueMap } from \"./types\";\n\nexport type QueryCollectionItem<T, K extends QueryOptionName> = { index: number, option: QueryOption<T, K> };\n\nexport class QueryOptionsCollection<T> {\n\n private options: Map<QueryOptionName, QueryCollectionItem<any, any>[]> = new Map<QueryOptionName, QueryCollectionItem<any, any>[]>();\n private nextExecutionTarget: QueryOptionExecutionTarget = \"database\";\n private nextIndex: number = 0;\n private enumeratedItems: QueryCollectionItem<any, any>[] = [];\n\n get items() {\n return this.options;\n }\n\n get isEmpty() {\n return this.items.size === 0;\n }\n\n static EMPTY<R>() {\n return new QueryOptionsCollection<R>();\n }\n\n static isEmpty<T>(options: QueryOptionsCollection<T>) {\n return options.isEmpty;\n }\n\n add<K extends QueryOptionName>(name: K, value: QueryOption<T, K>[\"value\"]) {\n\n if (name === \"map\") {\n const mapValue = value as QueryOptionValueMap<T>[\"map\"];\n\n // Evaluate the map value to see if we are renaming properties, \n // if we are we need to perform everything after in memory\n if (mapValue.fields.some(x => x.isRename === true) || mapValue.fields.some(x => x.property?.isUnmapped === true)) {\n // Cut over to memory execution since we are renaming a property with .map\n // We do not want to figure out how the new name flows through the entire query\n this.nextExecutionTarget = \"memory\";\n }\n }\n\n if (name === \"filter\") {\n // Need to check for unmapped properties\n const filterValue = value as QueryOptionValueMap<T>[\"filter\"];\n\n if (filterValue.expression.type === \"not-parsable\") {\n this.nextExecutionTarget = \"memory\";\n } else {\n forEach(filterValue.expression, (expression) => {\n\n if (isPropertyExpression(expression) && expression.property.isUnmapped) {\n // Cut over to memory execution, unmapped properties are not in the database and\n // cannot be queried\n this.nextExecutionTarget = \"memory\";\n return false;\n }\n\n return true;\n });\n }\n }\n\n const item: QueryCollectionItem<T, K> = {\n index: this.nextIndex,\n option: {\n name,\n target: this.nextExecutionTarget,\n value\n }\n }\n\n this.nextIndex++;\n\n const found = this.options.get(name);\n\n this.options.set(name, [...found ?? [], item]);\n }\n\n split(): { memory: QueryOptionsCollection<T>, database: QueryOptionsCollection<T> } {\n this.resolveEnumeration();\n\n const sortedItems = this.enumeratedItems.toSorted((a, b) => a.index - b.index);\n const memoryQueryOptionsCollection = new QueryOptionsCollection<T>();\n const databaseQueryOptionsCollection = new QueryOptionsCollection<T>();\n\n for (let i = 0, length = sortedItems.length; i < length; i++) {\n const sortedItem = sortedItems[i];\n\n if (sortedItem.option.target === \"database\") {\n databaseQueryOptionsCollection.add(sortedItem.option.name, sortedItem.option.value);\n continue;\n }\n\n memoryQueryOptionsCollection.add(sortedItem.option.name, sortedItem.option.value);\n }\n\n return {\n memory: memoryQueryOptionsCollection,\n database: databaseQueryOptionsCollection\n }\n }\n\n has<K extends QueryOptionName>(name: K): boolean {\n return this.options.has(name);\n }\n\n get<K extends QueryOptionName>(name: K): QueryCollectionItem<T, K>[] {\n return this.options.get(name) ?? [] as QueryCollectionItem<T, K>[];\n }\n\n getLast<K extends QueryOptionName>(name: K): QueryOption<T, K> | null {\n this.resolveEnumeration();\n\n for (let i = this.enumeratedItems.length - 1; i >= 0; i--) {\n const item = this.enumeratedItems[i];\n\n if (item.option.name === name) {\n return item.option;\n }\n }\n\n return null\n }\n\n getValues<K extends QueryOptionName>(name: K): QueryCollectionItem<T, K>[\"option\"][\"value\"][] | undefined {\n\n const found = this.options.get(name);\n\n if (found == null) {\n return [];\n }\n\n return found.map(w => w.option.value) as QueryCollectionItem<T, K>[\"option\"][\"value\"][];\n }\n\n private getEnumeration() {\n return [...this.options.values()].flat().toSorted((a, b) => a.index - b.index);\n }\n\n private resolveEnumeration() {\n if (this.enumeratedItems.length != this.nextIndex) {\n this.enumeratedItems = this.getEnumeration();\n }\n }\n\n forEach(iterator: (item: QueryCollectionItem<T, any>[\"option\"]) => void) {\n this.resolveEnumeration();\n\n for (let i = 0, length = this.enumeratedItems.length; i < length; i++) {\n iterator(this.enumeratedItems[i].option);\n }\n }\n}","export const toMap = <T extends {}>(data: T[], keySelector: (item: T) => T[keyof T] | string) => {\n\n const result = new Map<T[keyof T] | string, T>();\n\n for (let i = 0; i < data.length; i++) {\n const item = data[i];\n const key = keySelector(item);\n result.set(key, item);\n }\n\n return result;\n}\n","export const isDate = (data: unknown): data is Date => {\n if (data == null) {\n return false;\n }\n\n if (typeof data !== \"object\") {\n return false;\n }\n\n return data instanceof Date;\n}","import { InferCreateType, InferType, SchemaId } from \"src/schema\";\nimport { DbPluginBulkPersistEvent, EntityUpdateInfo } from \"../plugins\";\n\ntype DbEvent = {\n type: \"add\",\n data: InferCreateType<unknown>;\n} | {\n type: \"update\",\n data: EntityUpdateInfo<unknown>;\n} | {\n type: \"remove\",\n data: InferType<unknown>;\n}\n\nexport const toEventArray = (event: DbPluginBulkPersistEvent): [SchemaId, DbEvent][] => {\n\n const result: [SchemaId, DbEvent][] = [];\n for (const [schemaId, changes] of event.operation) {\n\n if (changes.hasItems === false) {\n continue;\n }\n\n if (changes.adds.length > 0) {\n result.push(...changes.adds.map(add => {\n return [schemaId as SchemaId, { data: { ...add }, type: \"add\" }] as [SchemaId, DbEvent];\n }));\n }\n\n if (changes.updates.length > 0) {\n result.push(...changes.updates.map(update => {\n return [schemaId as SchemaId, { data: { ...update }, type: \"update\" }] as [SchemaId, DbEvent];\n }));\n }\n\n if (changes.removes.length > 0) {\n result.push(...changes.removes.map(remove => {\n return [schemaId as SchemaId, { data: { ...remove }, type: \"remove\" }] as [SchemaId, DbEvent];\n }));\n }\n }\n\n return result\n}","export const cast = <TIn, TOut>(item: TIn) => {\n return item as unknown as TOut;\n}\n\nexport function clone<T extends {}>(data: T): T {\n return JSON.parse(JSON.stringify(data)) as T;\n}","import { QueryOptionsCollection } from \"../plugins/query\";\n\nexport const combineQueryOptionsCollections = <T>(...collections: QueryOptionsCollection<T>[]) => {\n const result = new QueryOptionsCollection<T>();\n\n for (let i = 0, length = collections.length; i < length; i++) {\n const collection = collections[i];\n\n // Add scoped items first\n collection.forEach(item => {\n result.add(item.name, item.value);\n });\n }\n\n return result;\n}","import { BulkPersistResult, BulkPersistChanges } from \"../collections\";\nimport { DbPluginBulkPersistEvent } from \"../plugins\";\n\nexport const resolveBulkPersistChanges = (event: DbPluginBulkPersistEvent, result: BulkPersistResult, bulkPersistChanges: BulkPersistChanges) => {\n // make sure we swap the adds here, that way we can make sure other persist events\n // don't take their additions and try to change subsequent calls\n for (const [schemaId, changes] of event.operation) {\n\n const schemmaBulkPersistResult = result.get(schemaId);\n const schemaBulkPersistChanges = bulkPersistChanges.resolve(schemaId);\n\n // Set the original removes\n schemaBulkPersistChanges.removes = changes.removes;\n\n // Set the original updates\n schemaBulkPersistChanges.updates = changes.updates;\n\n // Take the adds from the result and set them to be persisted\n // in the replicated plugins because the id's are set in the \n // memory data store\n schemaBulkPersistChanges.adds = schemmaBulkPersistResult.adds;\n }\n}","export const isNodeRuntime = () => typeof process !== 'undefined' &&\n process.versions != null &&\n process.versions.node != null;","export const hash = (value: string, seed: number = 0) => {\n // From Stack Overflow\n // https://stackoverflow.com/a/52171480/3329760\n let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;\n\n for (let i = 0, ch: number; i < value.length; i++) {\n ch = value.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);\n h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);\n h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\n}","export const uuid = (length: number = 16): string => {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n const charLength = chars.length;\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.random() * charLength | 0];\n }\n return result;\n}\n\nconst HEX_CHARS = '0123456789abcdef';\nconst UUID_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';\n\nconst hasCrypto =\n typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';\n\nexport const uuidv4 = (): string => {\n let randomBytes: Uint8Array | null = null;\n if (hasCrypto) {\n randomBytes = crypto.getRandomValues(new Uint8Array(16));\n }\n\n let byteIndex = 0;\n let uuid = '';\n\n for (let i = 0; i < UUID_TEMPLATE.length; i++) {\n const c = UUID_TEMPLATE[i];\n if (c === '-') {\n uuid += '-';\n continue;\n }\n\n let r: number;\n if (hasCrypto && randomBytes) {\n // Each byte gives two hex digits (nibbles)\n r =\n (i % 2 === 0\n ? randomBytes[byteIndex] >> 4\n : randomBytes[byteIndex++] & 0x0f);\n } else {\n r = Math.floor(Math.random() * 16);\n }\n\n if (c === 'x') {\n uuid += HEX_CHARS[r];\n } else if (c === 'y') {\n // Variant bits: 8, 9, A, or B\n uuid += HEX_CHARS[(r & 0x3) | 0x8];\n } else if (c === '4') {\n uuid += '4';\n }\n }\n\n return uuid;\n};\n","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export * from './arrays';\nexport * from './strings';\nexport * from './dates';\nexport * from './objects';\nexport * from './runtime';\nexport * from './uuid';\nexport * from './replication';\nexport * from './types';\nexport * from './queryOptionsCollection';\nexport * from './dbPluginEventUtils';"],"names":[],"mappings":";;;;;;;;;;;;AAGA;;;;GAIG;AACI,SAAS,aAAa,CAAC,UAAsB;IAChD,MAAM,UAAU,GAAwB,EAAE,CAAC;IAE3C,SAAS,QAAQ,CAAC,IAAgB;QAC9B,6DAA6D;QAC7D,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC3B,UAAU,CAAC,IAAI,CAAE,IAA2B,CAAC,QAAQ,CAAC,CAAC;QAC3D,CAAC;QAED,oDAAoD;QACpD,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;IAED,QAAQ,CAAC,UAAU,CAAC,CAAC;IACrB,OAAO,UAAU,CAAC;AACtB,CAAC;AAEM,SAAS,oBAAoB,CAAC,UAAsB;IACvD,OAAO,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC;AAC1C,CAAC;AAEM,SAAS,OAAO,CAAC,UAAsB,EAAE,QAA6C;IACzF,SAAS,QAAQ,CAAC,IAAgB;QAC9B,wCAAwC;QACxC,6CAA6C;QAC7C,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAClB,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,oDAAoD;QACpD,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;gBACvB,OAAO,KAAK,CAAC;YACjB,CAAC;QACL,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBACxB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AC;YACnB,IAAI,IAAI,GAAG,CAAC;QAChB,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACvDF;AACA;AACA;AACA,kDAAkD,wCAAwC;AAC1F;AACA;AACA;;;;ACNA;;;;ACAA;AACA;AACA;AACA,uDAAuD,iBAAiB;AACxE;AACA,gDAAgD,aAAa;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACNyB;AACC;AACF;AACE;AACA;AACH;AACO;AACN;AACiB;AACJ"}
1
+ {"version":3,"file":"utilities/index.js","sources":["webpack://@routier/core/./src/expressions/utils.ts","webpack://@routier/core/./src/plugins/query/QueryOptionsCollection.ts","webpack://@routier/core/./src/utilities/arrays.ts","webpack://@routier/core/./src/utilities/dates.ts","webpack://@routier/core/./src/utilities/dbPluginEventUtils.ts","webpack://@routier/core/./src/utilities/functions.ts","webpack://@routier/core/./src/utilities/objects.ts","webpack://@routier/core/./src/utilities/queryOptionsCollection.ts","webpack://@routier/core/./src/utilities/replication.ts","webpack://@routier/core/./src/utilities/runtime.ts","webpack://@routier/core/./src/utilities/strings.ts","webpack://@routier/core/./src/utilities/uuid.ts","webpack://@routier/core/webpack/runtime/define_property_getters","webpack://@routier/core/webpack/runtime/has_own_property","webpack://@routier/core/webpack/runtime/make_namespace_object","webpack://@routier/core/./src/utilities/index.ts"],"sourcesContent":["import { PropertyInfo } from \"../schema\";\nimport { Expression, PropertyExpression } from \"./types\";\n\n/**\n * Extracts all properties referenced in an expression\n * @param expression The expression to analyze\n * @returns Array of PropertyInfo objects referenced in the expression\n */\nexport function getProperties(expression: Expression): PropertyInfo<any>[] {\n const properties: PropertyInfo<any>[] = [];\n\n function traverse(expr: Expression) {\n // If this is a property expression, add it to our collection\n if (expr.type === \"property\") {\n properties.push((expr as PropertyExpression).property);\n }\n\n // Traverse left and right expressions if they exist\n if (expr.left) {\n traverse(expr.left);\n }\n if (expr.right) {\n traverse(expr.right);\n }\n }\n\n traverse(expression);\n return properties;\n}\n\nexport function isPropertyExpression(expression: Expression): expression is PropertyExpression {\n return expression.type === \"property\";\n}\n\nexport function forEach(expression: Expression, callback: (expression: Expression) => boolean) {\n function traverse(expr: Expression): boolean {\n // Call the callback for this expression\n // If callback returns false, stop traversing\n if (!callback(expr)) {\n return false;\n }\n\n // Traverse left and right expressions if they exist\n if (expr.left) {\n if (!traverse(expr.left)) {\n return false;\n }\n }\n if (expr.right) {\n if (!traverse(expr.right)) {\n return false;\n }\n }\n\n return true;\n }\n\n traverse(expression);\n}","import { forEach, isPropertyExpression } from \"../../expressions/utils\";\nimport { QueryOption, QueryOptionName, QueryOptionExecutionTarget, QueryOptionValueMap } from \"./types\";\n\nexport type QueryCollectionItem<T, K extends QueryOptionName> = { index: number, option: QueryOption<T, K> };\n\nexport class QueryOptionsCollection<T> {\n\n private options: Map<QueryOptionName, QueryCollectionItem<any, any>[]> = new Map<QueryOptionName, QueryCollectionItem<any, any>[]>();\n private nextExecutionTarget: QueryOptionExecutionTarget = \"database\";\n private nextIndex: number = 0;\n private enumeratedItems: QueryCollectionItem<any, any>[] = [];\n\n get items() {\n return this.options;\n }\n\n get isEmpty() {\n return this.items.size === 0;\n }\n\n static EMPTY<R>() {\n return new QueryOptionsCollection<R>();\n }\n\n static isEmpty<T>(options: QueryOptionsCollection<T>) {\n return options.isEmpty;\n }\n\n add<K extends QueryOptionName>(name: K, value: QueryOption<T, K>[\"value\"]) {\n\n if (name === \"map\") {\n const mapValue = value as QueryOptionValueMap<T>[\"map\"];\n\n // Evaluate the map value to see if we are renaming properties, \n // if we are we need to perform everything after in memory\n if (mapValue.fields.some(x => x.isRename === true) || mapValue.fields.some(x => x.property?.isUnmapped === true)) {\n // Cut over to memory execution since we are renaming a property with .map\n // We do not want to figure out how the new name flows through the entire query\n this.nextExecutionTarget = \"memory\";\n }\n }\n\n if (name === \"filter\") {\n // Need to check for unmapped properties\n const filterValue = value as QueryOptionValueMap<T>[\"filter\"];\n\n if (filterValue.expression.type === \"not-parsable\") {\n this.nextExecutionTarget = \"memory\";\n } else {\n forEach(filterValue.expression, (expression) => {\n\n if (isPropertyExpression(expression) && expression.property.isUnmapped) {\n // Cut over to memory execution, unmapped properties are not in the database and\n // cannot be queried\n this.nextExecutionTarget = \"memory\";\n return false;\n }\n\n return true;\n });\n }\n }\n\n const item: QueryCollectionItem<T, K> = {\n index: this.nextIndex,\n option: {\n name,\n target: this.nextExecutionTarget,\n value\n }\n }\n\n this.nextIndex++;\n\n const found = this.options.get(name);\n\n this.options.set(name, [...found ?? [], item]);\n }\n\n split(): { memory: QueryOptionsCollection<T>, database: QueryOptionsCollection<T> } {\n this.resolveEnumeration();\n\n const sortedItems = this.enumeratedItems.toSorted((a, b) => a.index - b.index);\n const memoryQueryOptionsCollection = new QueryOptionsCollection<T>();\n const databaseQueryOptionsCollection = new QueryOptionsCollection<T>();\n\n for (let i = 0, length = sortedItems.length; i < length; i++) {\n const sortedItem = sortedItems[i];\n\n if (sortedItem.option.target === \"database\") {\n databaseQueryOptionsCollection.add(sortedItem.option.name, sortedItem.option.value);\n continue;\n }\n\n memoryQueryOptionsCollection.add(sortedItem.option.name, sortedItem.option.value);\n }\n\n return {\n memory: memoryQueryOptionsCollection,\n database: databaseQueryOptionsCollection\n }\n }\n\n has<K extends QueryOptionName>(name: K): boolean {\n return this.options.has(name);\n }\n\n get<K extends QueryOptionName>(name: K): QueryCollectionItem<T, K>[] {\n return this.options.get(name) ?? [] as QueryCollectionItem<T, K>[];\n }\n\n getLast<K extends QueryOptionName>(name: K): QueryOption<T, K> | null {\n this.resolveEnumeration();\n\n for (let i = this.enumeratedItems.length - 1; i >= 0; i--) {\n const item = this.enumeratedItems[i];\n\n if (item.option.name === name) {\n return item.option;\n }\n }\n\n return null\n }\n\n getValues<K extends QueryOptionName>(name: K): QueryCollectionItem<T, K>[\"option\"][\"value\"][] | undefined {\n\n const found = this.options.get(name);\n\n if (found == null) {\n return [];\n }\n\n return found.map(w => w.option.value) as QueryCollectionItem<T, K>[\"option\"][\"value\"][];\n }\n\n private getEnumeration() {\n return [...this.options.values()].flat().toSorted((a, b) => a.index - b.index);\n }\n\n private resolveEnumeration() {\n if (this.enumeratedItems.length != this.nextIndex) {\n this.enumeratedItems = this.getEnumeration();\n }\n }\n\n forEach(iterator: (item: QueryCollectionItem<T, any>[\"option\"]) => void) {\n this.resolveEnumeration();\n\n for (let i = 0, length = this.enumeratedItems.length; i < length; i++) {\n iterator(this.enumeratedItems[i].option);\n }\n }\n}","export const toMap = <T extends {}>(data: T[], keySelector: (item: T) => T[keyof T] | string) => {\n\n const result = new Map<T[keyof T] | string, T>();\n\n for (let i = 0; i < data.length; i++) {\n const item = data[i];\n const key = keySelector(item);\n result.set(key, item);\n }\n\n return result;\n}\n","export const isDate = (data: unknown): data is Date => {\n if (data == null) {\n return false;\n }\n\n if (typeof data !== \"object\") {\n return false;\n }\n\n return data instanceof Date;\n}","import { InferCreateType, InferType, SchemaId } from \"../schema\";\nimport { DbPluginBulkPersistEvent, EntityUpdateInfo } from \"../plugins\";\n\ntype DbEvent = {\n type: \"add\",\n data: InferCreateType<unknown>;\n} | {\n type: \"update\",\n data: EntityUpdateInfo<unknown>;\n} | {\n type: \"remove\",\n data: InferType<unknown>;\n}\n\nexport const toEventArray = (event: DbPluginBulkPersistEvent): [SchemaId, DbEvent][] => {\n\n const result: [SchemaId, DbEvent][] = [];\n for (const [schemaId, changes] of event.operation) {\n\n if (changes.hasItems === false) {\n continue;\n }\n\n if (changes.adds.length > 0) {\n result.push(...changes.adds.map(add => {\n return [schemaId as SchemaId, { data: { ...add }, type: \"add\" }] as [SchemaId, DbEvent];\n }));\n }\n\n if (changes.updates.length > 0) {\n result.push(...changes.updates.map(update => {\n return [schemaId as SchemaId, { data: { ...update }, type: \"update\" }] as [SchemaId, DbEvent];\n }));\n }\n\n if (changes.removes.length > 0) {\n result.push(...changes.removes.map(remove => {\n return [schemaId as SchemaId, { data: { ...remove }, type: \"remove\" }] as [SchemaId, DbEvent];\n }));\n }\n }\n\n return result\n}","export const noop = (...args: any[]) => { };","export const cast = <TIn, TOut>(item: TIn) => {\n return item as unknown as TOut;\n}\n\nexport function clone<T extends {}>(data: T): T {\n return JSON.parse(JSON.stringify(data)) as T;\n}","import { QueryOptionsCollection } from \"../plugins/query\";\n\nexport const combineQueryOptionsCollections = <T>(...collections: QueryOptionsCollection<T>[]) => {\n const result = new QueryOptionsCollection<T>();\n\n for (let i = 0, length = collections.length; i < length; i++) {\n const collection = collections[i];\n\n // Add scoped items first\n collection.forEach(item => {\n result.add(item.name, item.value);\n });\n }\n\n return result;\n}","import { BulkPersistResult, BulkPersistChanges } from \"../collections\";\nimport { DbPluginBulkPersistEvent } from \"../plugins\";\n\nexport const resolveBulkPersistChanges = (event: DbPluginBulkPersistEvent, result: BulkPersistResult, bulkPersistChanges: BulkPersistChanges) => {\n // make sure we swap the adds here, that way we can make sure other persist events\n // don't take their additions and try to change subsequent calls\n for (const [schemaId, changes] of event.operation) {\n\n const schemmaBulkPersistResult = result.get(schemaId);\n const schemaBulkPersistChanges = bulkPersistChanges.resolve(schemaId);\n\n // Set the original removes\n schemaBulkPersistChanges.removes = changes.removes;\n\n // Set the original updates\n schemaBulkPersistChanges.updates = changes.updates;\n\n // Take the adds from the result and set them to be persisted\n // in the replicated plugins because the id's are set in the \n // memory data store\n schemaBulkPersistChanges.adds = schemmaBulkPersistResult.adds;\n }\n}","export const isNodeRuntime = () => typeof process !== 'undefined' &&\n process.versions != null &&\n process.versions.node != null;","export const hash = (value: string, seed: number = 0) => {\n // From Stack Overflow\n // https://stackoverflow.com/a/52171480/3329760\n let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;\n\n for (let i = 0, ch: number; i < value.length; i++) {\n ch = value.charCodeAt(i);\n h1 = Math.imul(h1 ^ ch, 2654435761);\n h2 = Math.imul(h2 ^ ch, 1597334677);\n }\n\n h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);\n h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);\n h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);\n h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);\n\n return 4294967296 * (2097151 & h2) + (h1 >>> 0);\n}","export const uuid = (length: number = 16): string => {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';\n const charLength = chars.length;\n let result = '';\n\n for (let i = 0; i < length; i++) {\n result += chars[Math.random() * charLength | 0];\n }\n return result;\n}\n\nconst HEX_CHARS = '0123456789abcdef';\nconst UUID_TEMPLATE = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';\n\nconst hasCrypto =\n typeof crypto !== 'undefined' && typeof crypto.getRandomValues === 'function';\n\nexport const uuidv4 = (): string => {\n let randomBytes: Uint8Array | null = null;\n if (hasCrypto) {\n randomBytes = crypto.getRandomValues(new Uint8Array(16));\n }\n\n let byteIndex = 0;\n let uuid = '';\n\n for (let i = 0; i < UUID_TEMPLATE.length; i++) {\n const c = UUID_TEMPLATE[i];\n if (c === '-') {\n uuid += '-';\n continue;\n }\n\n let r: number;\n if (hasCrypto && randomBytes) {\n // Each byte gives two hex digits (nibbles)\n r =\n (i % 2 === 0\n ? randomBytes[byteIndex] >> 4\n : randomBytes[byteIndex++] & 0x0f);\n } else {\n r = Math.floor(Math.random() * 16);\n }\n\n if (c === 'x') {\n uuid += HEX_CHARS[r];\n } else if (c === 'y') {\n // Variant bits: 8, 9, A, or B\n uuid += HEX_CHARS[(r & 0x3) | 0x8];\n } else if (c === '4') {\n uuid += '4';\n }\n }\n\n return uuid;\n};\n","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export * from './arrays';\nexport * from './strings';\nexport * from './dates';\nexport * from './objects';\nexport * from './runtime';\nexport * from './uuid';\nexport * from './replication';\nexport * from './types';\nexport * from './queryOptionsCollection';\nexport * from './dbPluginEventUtils';\nexport * from './functions';"],"names":[],"mappings":";;;;;;;;;;;;AAGA;;;;GAIG;AACI,SAAS,aAAa,CAAC,UAAsB;IAChD,MAAM,UAAU,GAAwB,EAAE,CAAC;IAE3C,SAAS,QAAQ,CAAC,IAAgB;QAC9B,6DAA6D;QAC7D,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC3B,UAAU,CAAC,IAAI,CAAE,IAA2B,CAAC,QAAQ,CAAC,CAAC;QAC3D,CAAC;QAED,oDAAoD;QACpD,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACZ,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;IAED,QAAQ,CAAC,UAAU,CAAC,CAAC;IACrB,OAAO,UAAU,CAAC;AACtB,CAAC;AAEM,SAAS,oBAAoB,CAAC,UAAsB;IACvD,OAAO,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC;AAC1C,CAAC;AAEM,SAAS,OAAO,CAAC,UAAsB,EAAE,QAA6C;IACzF,SAAS,QAAQ,CAAC,IAAgB;QAC9B,wCAAwC;QACxC,6CAA6C;QAC7C,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAClB,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,oDAAoD;QACpD,IAAI,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AC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QACvC,CAAC;QAED,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACZ,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;aAAM,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACnB,8BAA8B;YAC9B,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;QACvC,CAAC;aAAM,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACnB,IAAI,IAAI,GAAG,CAAC;QAChB,CAAC;IACL,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACvDF;AACA;AACA;AACA,kDAAkD,wCAAwC;AAC1F;AACA;AACA;;;;ACNA;;;;ACAA;AACA;AACA;AACA,uDAAuD,iBAAiB;AACxE;AACA,gDAAgD,aAAa;AAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACNyB;AACC;AACF;AACE;AACA;AACH;AACO;AACN;AACiB;AACJ;AACT"}
@@ -1 +1,4 @@
1
1
  export type UnknownRecord = Record<string, unknown>;
2
+ export type Tagged<T, Tag extends string> = T & {
3
+ readonly __tag: Tag;
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routier/core",
3
- "version": "0.0.1-alpha.2",
3
+ "version": "0.0.1",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "source": "./src/index.ts",
@@ -68,7 +68,7 @@
68
68
  "build:bundle": "rspack build",
69
69
  "build": "npm run build:bundle && npm run build:types",
70
70
  "tsc": "tsc",
71
- "test": "vitest run"
71
+ "test": "jest"
72
72
  },
73
73
  "sideEffects": false,
74
74
  "author": "James DeMeuse <james.demeuse@gmail.com>",
@@ -90,7 +90,6 @@
90
90
  "@rspack/cli": "^1.1.8",
91
91
  "@rspack/core": "^1.1.8",
92
92
  "ts-loader": "^9.5.2",
93
- "typescript": "^5.7.2",
94
- "vitest": "^3.2.4"
93
+ "typescript": "^5.7.2"
95
94
  }
96
95
  }
package/readme.md CHANGED
@@ -80,12 +80,6 @@ Choosing storage for local-first apps is hard—and the landscape moves fast. Ro
80
80
  - **SQLite**: Node.js SQLite integration
81
81
  - **File System**: Node.js file-based storage
82
82
 
83
- ## Examples
84
-
85
- - **[Basic Examples](examples/)** - Vite, Rspack, Node.js setups
86
- - **[Performance Benchmarks](docs/demos/performance-benchmarks/)** - Speed comparisons
87
- - **[Real-world Apps](docs/examples/real-world/)** - Complete applications
88
-
89
83
  ## Contributing
90
84
 
91
85
  Issues and PRs welcome! Please see our [Contributing Guide](docs/CONTRIBUTING.md) or open an issue to discuss changes.