@peerbit/indexer-interface 2.0.14 → 2.1.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.
package/dist/src/query.js CHANGED
@@ -1,11 +1,36 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
6
27
  };
7
- var __metadata = (this && this.__metadata) || function (k, v) {
8
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
9
34
  };
10
35
  import { deserialize, field, serialize, variant, vec } from "@dao-xyz/borsh";
11
36
  import { toBase64 } from "@peerbit/crypto";
@@ -49,41 +74,55 @@ export var SortDirection;
49
74
  SortDirection[SortDirection["ASC"] = 0] = "ASC";
50
75
  SortDirection[SortDirection["DESC"] = 1] = "DESC";
51
76
  })(SortDirection || (SortDirection = {}));
52
- let Sort = class Sort {
53
- key;
54
- direction;
55
- constructor(properties) {
56
- this.key = Array.isArray(properties.key)
57
- ? properties.key
58
- : [properties.key];
59
- if (properties.direction) {
60
- if (properties.direction === "asc") {
61
- this.direction = SortDirection.ASC;
62
- }
63
- else if (properties.direction === "desc") {
64
- this.direction = SortDirection.DESC;
77
+ let Sort = (() => {
78
+ let _classDecorators = [variant(0)];
79
+ let _classDescriptor;
80
+ let _classExtraInitializers = [];
81
+ let _classThis;
82
+ let _key_decorators;
83
+ let _key_initializers = [];
84
+ let _key_extraInitializers = [];
85
+ let _direction_decorators;
86
+ let _direction_initializers = [];
87
+ let _direction_extraInitializers = [];
88
+ var Sort = class {
89
+ static { _classThis = this; }
90
+ static {
91
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
92
+ _key_decorators = [field({ type: vec("string") })];
93
+ _direction_decorators = [field({ type: "u8" })];
94
+ __esDecorate(null, null, _key_decorators, { kind: "field", name: "key", static: false, private: false, access: { has: obj => "key" in obj, get: obj => obj.key, set: (obj, value) => { obj.key = value; } }, metadata: _metadata }, _key_initializers, _key_extraInitializers);
95
+ __esDecorate(null, null, _direction_decorators, { kind: "field", name: "direction", static: false, private: false, access: { has: obj => "direction" in obj, get: obj => obj.direction, set: (obj, value) => { obj.direction = value; } }, metadata: _metadata }, _direction_initializers, _direction_extraInitializers);
96
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
97
+ Sort = _classThis = _classDescriptor.value;
98
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
99
+ __runInitializers(_classThis, _classExtraInitializers);
100
+ }
101
+ key = __runInitializers(this, _key_initializers, void 0);
102
+ direction = (__runInitializers(this, _key_extraInitializers), __runInitializers(this, _direction_initializers, void 0));
103
+ constructor(properties) {
104
+ __runInitializers(this, _direction_extraInitializers);
105
+ this.key = Array.isArray(properties.key)
106
+ ? properties.key
107
+ : [properties.key];
108
+ if (properties.direction) {
109
+ if (properties.direction === "asc") {
110
+ this.direction = SortDirection.ASC;
111
+ }
112
+ else if (properties.direction === "desc") {
113
+ this.direction = SortDirection.DESC;
114
+ }
115
+ else {
116
+ this.direction = properties.direction;
117
+ }
65
118
  }
66
119
  else {
67
- this.direction = properties.direction;
120
+ this.direction = SortDirection.ASC;
68
121
  }
69
122
  }
70
- else {
71
- this.direction = SortDirection.ASC;
72
- }
73
- }
74
- };
75
- __decorate([
76
- field({ type: vec("string") }),
77
- __metadata("design:type", Array)
78
- ], Sort.prototype, "key", void 0);
79
- __decorate([
80
- field({ type: "u8" }),
81
- __metadata("design:type", Number)
82
- ], Sort.prototype, "direction", void 0);
83
- Sort = __decorate([
84
- variant(0),
85
- __metadata("design:paramtypes", [Object])
86
- ], Sort);
123
+ };
124
+ return Sort = _classThis;
125
+ })();
87
126
  export { Sort };
88
127
  export const toSort = (sort) => {
89
128
  if (!sort) {
@@ -102,118 +141,212 @@ export const toSort = (sort) => {
102
141
  }
103
142
  return [new Sort({ key: sort.key, direction: sort.direction })];
104
143
  };
105
- let LogicalQuery = class LogicalQuery extends Query {
106
- };
107
- LogicalQuery = __decorate([
108
- variant(1)
109
- ], LogicalQuery);
144
+ let LogicalQuery = (() => {
145
+ let _classDecorators = [variant(1)];
146
+ let _classDescriptor;
147
+ let _classExtraInitializers = [];
148
+ let _classThis;
149
+ let _classSuper = Query;
150
+ var LogicalQuery = class extends _classSuper {
151
+ static { _classThis = this; }
152
+ static {
153
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
154
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
155
+ LogicalQuery = _classThis = _classDescriptor.value;
156
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
157
+ __runInitializers(_classThis, _classExtraInitializers);
158
+ }
159
+ };
160
+ return LogicalQuery = _classThis;
161
+ })();
110
162
  export { LogicalQuery };
111
- let And = class And extends LogicalQuery {
112
- and;
113
- constructor(and) {
114
- super();
115
- this.and = and;
116
- if (this.and.length === 0) {
117
- throw new Error("And query must have at least one query");
163
+ let And = (() => {
164
+ let _classDecorators = [variant(0)];
165
+ let _classDescriptor;
166
+ let _classExtraInitializers = [];
167
+ let _classThis;
168
+ let _classSuper = LogicalQuery;
169
+ let _and_decorators;
170
+ let _and_initializers = [];
171
+ let _and_extraInitializers = [];
172
+ var And = class extends _classSuper {
173
+ static { _classThis = this; }
174
+ static {
175
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
176
+ _and_decorators = [field({ type: vec(Query) })];
177
+ __esDecorate(null, null, _and_decorators, { kind: "field", name: "and", static: false, private: false, access: { has: obj => "and" in obj, get: obj => obj.and, set: (obj, value) => { obj.and = value; } }, metadata: _metadata }, _and_initializers, _and_extraInitializers);
178
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
179
+ And = _classThis = _classDescriptor.value;
180
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
181
+ __runInitializers(_classThis, _classExtraInitializers);
118
182
  }
119
- }
120
- };
121
- __decorate([
122
- field({ type: vec(Query) }),
123
- __metadata("design:type", Array)
124
- ], And.prototype, "and", void 0);
125
- And = __decorate([
126
- variant(0),
127
- __metadata("design:paramtypes", [Array])
128
- ], And);
183
+ and = __runInitializers(this, _and_initializers, void 0);
184
+ constructor(and) {
185
+ super();
186
+ __runInitializers(this, _and_extraInitializers);
187
+ this.and = and;
188
+ if (this.and.length === 0) {
189
+ throw new Error("And query must have at least one query");
190
+ }
191
+ }
192
+ };
193
+ return And = _classThis;
194
+ })();
129
195
  export { And };
130
- let Or = class Or extends LogicalQuery {
131
- or;
132
- constructor(or) {
133
- super();
134
- this.or = or;
135
- if (this.or.length === 0) {
136
- throw new Error("Or query must have at least one query");
196
+ let Or = (() => {
197
+ let _classDecorators = [variant(1)];
198
+ let _classDescriptor;
199
+ let _classExtraInitializers = [];
200
+ let _classThis;
201
+ let _classSuper = LogicalQuery;
202
+ let _or_decorators;
203
+ let _or_initializers = [];
204
+ let _or_extraInitializers = [];
205
+ var Or = class extends _classSuper {
206
+ static { _classThis = this; }
207
+ static {
208
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
209
+ _or_decorators = [field({ type: vec(Query) })];
210
+ __esDecorate(null, null, _or_decorators, { kind: "field", name: "or", static: false, private: false, access: { has: obj => "or" in obj, get: obj => obj.or, set: (obj, value) => { obj.or = value; } }, metadata: _metadata }, _or_initializers, _or_extraInitializers);
211
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
212
+ Or = _classThis = _classDescriptor.value;
213
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
214
+ __runInitializers(_classThis, _classExtraInitializers);
137
215
  }
138
- }
139
- };
140
- __decorate([
141
- field({ type: vec(Query) }),
142
- __metadata("design:type", Array)
143
- ], Or.prototype, "or", void 0);
144
- Or = __decorate([
145
- variant(1),
146
- __metadata("design:paramtypes", [Array])
147
- ], Or);
216
+ or = __runInitializers(this, _or_initializers, void 0);
217
+ constructor(or) {
218
+ super();
219
+ __runInitializers(this, _or_extraInitializers);
220
+ this.or = or;
221
+ if (this.or.length === 0) {
222
+ throw new Error("Or query must have at least one query");
223
+ }
224
+ }
225
+ };
226
+ return Or = _classThis;
227
+ })();
148
228
  export { Or };
149
- let Not = class Not extends LogicalQuery {
150
- not;
151
- constructor(not) {
152
- super();
153
- this.not = not;
154
- }
155
- };
156
- __decorate([
157
- field({ type: Query }),
158
- __metadata("design:type", Query)
159
- ], Not.prototype, "not", void 0);
160
- Not = __decorate([
161
- variant(2),
162
- __metadata("design:paramtypes", [Query])
163
- ], Not);
229
+ let Not = (() => {
230
+ let _classDecorators = [variant(2)];
231
+ let _classDescriptor;
232
+ let _classExtraInitializers = [];
233
+ let _classThis;
234
+ let _classSuper = LogicalQuery;
235
+ let _not_decorators;
236
+ let _not_initializers = [];
237
+ let _not_extraInitializers = [];
238
+ var Not = class extends _classSuper {
239
+ static { _classThis = this; }
240
+ static {
241
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
242
+ _not_decorators = [field({ type: Query })];
243
+ __esDecorate(null, null, _not_decorators, { kind: "field", name: "not", static: false, private: false, access: { has: obj => "not" in obj, get: obj => obj.not, set: (obj, value) => { obj.not = value; } }, metadata: _metadata }, _not_initializers, _not_extraInitializers);
244
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
245
+ Not = _classThis = _classDescriptor.value;
246
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
247
+ __runInitializers(_classThis, _classExtraInitializers);
248
+ }
249
+ not = __runInitializers(this, _not_initializers, void 0);
250
+ constructor(not) {
251
+ super();
252
+ __runInitializers(this, _not_extraInitializers);
253
+ this.not = not;
254
+ }
255
+ };
256
+ return Not = _classThis;
257
+ })();
164
258
  export { Not };
165
- let StateQuery = class StateQuery extends Query {
166
- };
167
- StateQuery = __decorate([
168
- variant(2)
169
- ], StateQuery);
259
+ let StateQuery = (() => {
260
+ let _classDecorators = [variant(2)];
261
+ let _classDescriptor;
262
+ let _classExtraInitializers = [];
263
+ let _classThis;
264
+ let _classSuper = Query;
265
+ var StateQuery = class extends _classSuper {
266
+ static { _classThis = this; }
267
+ static {
268
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
269
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
270
+ StateQuery = _classThis = _classDescriptor.value;
271
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
272
+ __runInitializers(_classThis, _classExtraInitializers);
273
+ }
274
+ };
275
+ return StateQuery = _classThis;
276
+ })();
170
277
  export { StateQuery };
171
- let StateFieldQuery = class StateFieldQuery extends StateQuery {
172
- key;
173
- constructor(props) {
174
- super();
175
- this.key = Array.isArray(props.key) ? props.key : [props.key];
176
- }
177
- };
178
- __decorate([
179
- field({ type: vec("string") }),
180
- __metadata("design:type", Array)
181
- ], StateFieldQuery.prototype, "key", void 0);
182
- StateFieldQuery = __decorate([
183
- variant(1),
184
- __metadata("design:paramtypes", [Object])
185
- ], StateFieldQuery);
278
+ let StateFieldQuery = (() => {
279
+ let _classDecorators = [variant(1)];
280
+ let _classDescriptor;
281
+ let _classExtraInitializers = [];
282
+ let _classThis;
283
+ let _classSuper = StateQuery;
284
+ let _key_decorators;
285
+ let _key_initializers = [];
286
+ let _key_extraInitializers = [];
287
+ var StateFieldQuery = class extends _classSuper {
288
+ static { _classThis = this; }
289
+ static {
290
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
291
+ _key_decorators = [field({ type: vec("string") })];
292
+ __esDecorate(null, null, _key_decorators, { kind: "field", name: "key", static: false, private: false, access: { has: obj => "key" in obj, get: obj => obj.key, set: (obj, value) => { obj.key = value; } }, metadata: _metadata }, _key_initializers, _key_extraInitializers);
293
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
294
+ StateFieldQuery = _classThis = _classDescriptor.value;
295
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
296
+ __runInitializers(_classThis, _classExtraInitializers);
297
+ }
298
+ key = __runInitializers(this, _key_initializers, void 0);
299
+ constructor(props) {
300
+ super();
301
+ __runInitializers(this, _key_extraInitializers);
302
+ this.key = Array.isArray(props.key) ? props.key : [props.key];
303
+ }
304
+ };
305
+ return StateFieldQuery = _classThis;
306
+ })();
186
307
  export { StateFieldQuery };
187
- let ByteMatchQuery = class ByteMatchQuery extends StateFieldQuery {
188
- value;
189
- _reserved; // Replicate MemoryCompare query with this?
190
- constructor(props) {
191
- super(props);
192
- this.value = props.value;
193
- this._reserved = 0;
194
- }
195
- _valueString;
196
- /**
197
- * value `asString`
198
- */
199
- get valueString() {
200
- return this._valueString ?? (this._valueString = toBase64(this.value));
201
- }
202
- };
203
- __decorate([
204
- field({ type: Uint8Array }),
205
- __metadata("design:type", Uint8Array)
206
- ], ByteMatchQuery.prototype, "value", void 0);
207
- __decorate([
208
- field({ type: "u8" })
209
- // @ts-expect-error: unused
210
- ,
211
- __metadata("design:type", Number)
212
- ], ByteMatchQuery.prototype, "_reserved", void 0);
213
- ByteMatchQuery = __decorate([
214
- variant(1),
215
- __metadata("design:paramtypes", [Object])
216
- ], ByteMatchQuery);
308
+ let ByteMatchQuery = (() => {
309
+ let _classDecorators = [variant(1)];
310
+ let _classDescriptor;
311
+ let _classExtraInitializers = [];
312
+ let _classThis;
313
+ let _classSuper = StateFieldQuery;
314
+ let _value_decorators;
315
+ let _value_initializers = [];
316
+ let _value_extraInitializers = [];
317
+ let __reserved_decorators;
318
+ let __reserved_initializers = [];
319
+ let __reserved_extraInitializers = [];
320
+ var ByteMatchQuery = class extends _classSuper {
321
+ static { _classThis = this; }
322
+ static {
323
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
324
+ _value_decorators = [field({ type: Uint8Array })];
325
+ __reserved_decorators = [field({ type: "u8" })];
326
+ __esDecorate(null, null, _value_decorators, { kind: "field", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
327
+ __esDecorate(null, null, __reserved_decorators, { kind: "field", name: "_reserved", static: false, private: false, access: { has: obj => "_reserved" in obj, get: obj => obj._reserved, set: (obj, value) => { obj._reserved = value; } }, metadata: _metadata }, __reserved_initializers, __reserved_extraInitializers);
328
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
329
+ ByteMatchQuery = _classThis = _classDescriptor.value;
330
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
331
+ __runInitializers(_classThis, _classExtraInitializers);
332
+ }
333
+ value = __runInitializers(this, _value_initializers, void 0);
334
+ _reserved = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, __reserved_initializers, void 0)); // Replicate MemoryCompare query with this?
335
+ constructor(props) {
336
+ super(props);
337
+ this.value = props.value;
338
+ this._reserved = 0;
339
+ }
340
+ _valueString = __runInitializers(this, __reserved_extraInitializers);
341
+ /**
342
+ * value `asString`
343
+ */
344
+ get valueString() {
345
+ return this._valueString ?? (this._valueString = toBase64(this.value));
346
+ }
347
+ };
348
+ return ByteMatchQuery = _classThis;
349
+ })();
217
350
  export { ByteMatchQuery };
218
351
  export var StringMatchMethod;
219
352
  (function (StringMatchMethod) {
@@ -221,138 +354,212 @@ export var StringMatchMethod;
221
354
  StringMatchMethod[StringMatchMethod["prefix"] = 1] = "prefix";
222
355
  StringMatchMethod[StringMatchMethod["contains"] = 2] = "contains";
223
356
  })(StringMatchMethod || (StringMatchMethod = {}));
224
- let StringMatch = class StringMatch extends StateFieldQuery {
225
- value;
226
- method;
227
- caseInsensitive;
228
- constructor(props) {
229
- super(props);
230
- this.value = props.value;
231
- this.method = props.method ?? StringMatchMethod.exact;
232
- this.caseInsensitive = props.caseInsensitive ?? false;
233
- }
234
- };
235
- __decorate([
236
- field({ type: "string" }),
237
- __metadata("design:type", String)
238
- ], StringMatch.prototype, "value", void 0);
239
- __decorate([
240
- field({ type: "u8" }),
241
- __metadata("design:type", Number)
242
- ], StringMatch.prototype, "method", void 0);
243
- __decorate([
244
- field({ type: "bool" }),
245
- __metadata("design:type", Boolean)
246
- ], StringMatch.prototype, "caseInsensitive", void 0);
247
- StringMatch = __decorate([
248
- variant(2),
249
- __metadata("design:paramtypes", [Object])
250
- ], StringMatch);
251
- export { StringMatch };
252
- let IntegerCompare = class IntegerCompare extends StateFieldQuery {
253
- compare;
254
- value;
255
- constructor(props) {
256
- super(props);
257
- if (props.value instanceof IntegerValue) {
357
+ let StringMatch = (() => {
358
+ let _classDecorators = [variant(2)];
359
+ let _classDescriptor;
360
+ let _classExtraInitializers = [];
361
+ let _classThis;
362
+ let _classSuper = StateFieldQuery;
363
+ let _value_decorators;
364
+ let _value_initializers = [];
365
+ let _value_extraInitializers = [];
366
+ let _method_decorators;
367
+ let _method_initializers = [];
368
+ let _method_extraInitializers = [];
369
+ let _caseInsensitive_decorators;
370
+ let _caseInsensitive_initializers = [];
371
+ let _caseInsensitive_extraInitializers = [];
372
+ var StringMatch = class extends _classSuper {
373
+ static { _classThis = this; }
374
+ static {
375
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
376
+ _value_decorators = [field({ type: "string" })];
377
+ _method_decorators = [field({ type: "u8" })];
378
+ _caseInsensitive_decorators = [field({ type: "bool" })];
379
+ __esDecorate(null, null, _value_decorators, { kind: "field", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
380
+ __esDecorate(null, null, _method_decorators, { kind: "field", name: "method", static: false, private: false, access: { has: obj => "method" in obj, get: obj => obj.method, set: (obj, value) => { obj.method = value; } }, metadata: _metadata }, _method_initializers, _method_extraInitializers);
381
+ __esDecorate(null, null, _caseInsensitive_decorators, { kind: "field", name: "caseInsensitive", static: false, private: false, access: { has: obj => "caseInsensitive" in obj, get: obj => obj.caseInsensitive, set: (obj, value) => { obj.caseInsensitive = value; } }, metadata: _metadata }, _caseInsensitive_initializers, _caseInsensitive_extraInitializers);
382
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
383
+ StringMatch = _classThis = _classDescriptor.value;
384
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
385
+ __runInitializers(_classThis, _classExtraInitializers);
386
+ }
387
+ value = __runInitializers(this, _value_initializers, void 0);
388
+ method = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _method_initializers, void 0));
389
+ caseInsensitive = (__runInitializers(this, _method_extraInitializers), __runInitializers(this, _caseInsensitive_initializers, void 0));
390
+ constructor(props) {
391
+ super(props);
392
+ __runInitializers(this, _caseInsensitive_extraInitializers);
258
393
  this.value = props.value;
394
+ this.method = props.method ?? StringMatchMethod.exact;
395
+ this.caseInsensitive = props.caseInsensitive ?? false;
259
396
  }
260
- else {
261
- if (typeof props.value === "bigint") {
262
- this.value = new BigUnsignedIntegerValue(props.value);
263
- }
264
- else {
265
- this.value = new UnsignedIntegerValue(props.value);
266
- }
397
+ };
398
+ return StringMatch = _classThis;
399
+ })();
400
+ export { StringMatch };
401
+ let IntegerCompare = (() => {
402
+ let _classDecorators = [variant(3)];
403
+ let _classDescriptor;
404
+ let _classExtraInitializers = [];
405
+ let _classThis;
406
+ let _classSuper = StateFieldQuery;
407
+ let _compare_decorators;
408
+ let _compare_initializers = [];
409
+ let _compare_extraInitializers = [];
410
+ let _value_decorators;
411
+ let _value_initializers = [];
412
+ let _value_extraInitializers = [];
413
+ var IntegerCompare = class extends _classSuper {
414
+ static { _classThis = this; }
415
+ static {
416
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
417
+ _compare_decorators = [field({ type: "u8" })];
418
+ _value_decorators = [field({ type: IntegerValue })];
419
+ __esDecorate(null, null, _compare_decorators, { kind: "field", name: "compare", static: false, private: false, access: { has: obj => "compare" in obj, get: obj => obj.compare, set: (obj, value) => { obj.compare = value; } }, metadata: _metadata }, _compare_initializers, _compare_extraInitializers);
420
+ __esDecorate(null, null, _value_decorators, { kind: "field", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
421
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
422
+ IntegerCompare = _classThis = _classDescriptor.value;
423
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
424
+ __runInitializers(_classThis, _classExtraInitializers);
267
425
  }
268
- if (typeof props.compare === "string") {
269
- if (props.compare === "eq") {
270
- this.compare = Compare.Equal;
271
- }
272
- else if (props.compare === "gt") {
273
- this.compare = Compare.Greater;
274
- }
275
- else if (props.compare === "gte") {
276
- this.compare = Compare.GreaterOrEqual;
426
+ compare = __runInitializers(this, _compare_initializers, void 0);
427
+ value = (__runInitializers(this, _compare_extraInitializers), __runInitializers(this, _value_initializers, void 0));
428
+ constructor(props) {
429
+ super(props);
430
+ __runInitializers(this, _value_extraInitializers);
431
+ if (props.value instanceof IntegerValue) {
432
+ this.value = props.value;
277
433
  }
278
- else if (props.compare === "lt") {
279
- this.compare = Compare.Less;
434
+ else {
435
+ if (typeof props.value === "bigint") {
436
+ this.value = new BigUnsignedIntegerValue(props.value);
437
+ }
438
+ else {
439
+ this.value = new UnsignedIntegerValue(props.value);
440
+ }
280
441
  }
281
- else if (props.compare === "lte") {
282
- this.compare = Compare.LessOrEqual;
442
+ if (typeof props.compare === "string") {
443
+ if (props.compare === "eq") {
444
+ this.compare = Compare.Equal;
445
+ }
446
+ else if (props.compare === "gt") {
447
+ this.compare = Compare.Greater;
448
+ }
449
+ else if (props.compare === "gte") {
450
+ this.compare = Compare.GreaterOrEqual;
451
+ }
452
+ else if (props.compare === "lt") {
453
+ this.compare = Compare.Less;
454
+ }
455
+ else if (props.compare === "lte") {
456
+ this.compare = Compare.LessOrEqual;
457
+ }
458
+ else {
459
+ throw new Error("Invalid compare string");
460
+ }
283
461
  }
284
462
  else {
285
- throw new Error("Invalid compare string");
463
+ this.compare = props.compare;
286
464
  }
287
465
  }
288
- else {
289
- this.compare = props.compare;
290
- }
291
- }
292
- };
293
- __decorate([
294
- field({ type: "u8" }),
295
- __metadata("design:type", Number)
296
- ], IntegerCompare.prototype, "compare", void 0);
297
- __decorate([
298
- field({ type: IntegerValue }),
299
- __metadata("design:type", IntegerValue)
300
- ], IntegerCompare.prototype, "value", void 0);
301
- IntegerCompare = __decorate([
302
- variant(3),
303
- __metadata("design:paramtypes", [Object])
304
- ], IntegerCompare);
466
+ };
467
+ return IntegerCompare = _classThis;
468
+ })();
305
469
  export { IntegerCompare };
306
- let IsNull = class IsNull extends StateFieldQuery {
307
- };
308
- IsNull = __decorate([
309
- variant(4)
310
- ], IsNull);
470
+ let IsNull = (() => {
471
+ let _classDecorators = [variant(4)];
472
+ let _classDescriptor;
473
+ let _classExtraInitializers = [];
474
+ let _classThis;
475
+ let _classSuper = StateFieldQuery;
476
+ var IsNull = class extends _classSuper {
477
+ static { _classThis = this; }
478
+ static {
479
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
480
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
481
+ IsNull = _classThis = _classDescriptor.value;
482
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
483
+ __runInitializers(_classThis, _classExtraInitializers);
484
+ }
485
+ };
486
+ return IsNull = _classThis;
487
+ })();
311
488
  export { IsNull };
312
- let BoolQuery = class BoolQuery extends StateFieldQuery {
313
- value;
314
- constructor(props) {
315
- super(props);
316
- this.value = props.value;
317
- }
318
- };
319
- __decorate([
320
- field({ type: "bool" }),
321
- __metadata("design:type", Boolean)
322
- ], BoolQuery.prototype, "value", void 0);
323
- BoolQuery = __decorate([
324
- variant(5),
325
- __metadata("design:paramtypes", [Object])
326
- ], BoolQuery);
489
+ let BoolQuery = (() => {
490
+ let _classDecorators = [variant(5)];
491
+ let _classDescriptor;
492
+ let _classExtraInitializers = [];
493
+ let _classThis;
494
+ let _classSuper = StateFieldQuery;
495
+ let _value_decorators;
496
+ let _value_initializers = [];
497
+ let _value_extraInitializers = [];
498
+ var BoolQuery = class extends _classSuper {
499
+ static { _classThis = this; }
500
+ static {
501
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
502
+ _value_decorators = [field({ type: "bool" })];
503
+ __esDecorate(null, null, _value_decorators, { kind: "field", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
504
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
505
+ BoolQuery = _classThis = _classDescriptor.value;
506
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
507
+ __runInitializers(_classThis, _classExtraInitializers);
508
+ }
509
+ value = __runInitializers(this, _value_initializers, void 0);
510
+ constructor(props) {
511
+ super(props);
512
+ __runInitializers(this, _value_extraInitializers);
513
+ this.value = props.value;
514
+ }
515
+ };
516
+ return BoolQuery = _classThis;
517
+ })();
327
518
  export { BoolQuery };
328
519
  // @experimental not supported by all implementations
329
- let Nested = class Nested extends Query {
330
- id;
331
- path;
332
- query;
333
- constructor(props) {
334
- super();
335
- this.path = Array.isArray(props.path) ? props.path : [props.path];
336
- this.id = props.id ?? uuid();
337
- this.query = toQuery(props.query);
338
- }
339
- };
340
- __decorate([
341
- field({ type: "string" }),
342
- __metadata("design:type", String)
343
- ], Nested.prototype, "id", void 0);
344
- __decorate([
345
- field({ type: vec("string") }),
346
- __metadata("design:type", Array)
347
- ], Nested.prototype, "path", void 0);
348
- __decorate([
349
- field({ type: vec(Query) }),
350
- __metadata("design:type", Array)
351
- ], Nested.prototype, "query", void 0);
352
- Nested = __decorate([
353
- variant(2),
354
- __metadata("design:paramtypes", [Object])
355
- ], Nested);
520
+ let Nested = (() => {
521
+ let _classDecorators = [variant(2)];
522
+ let _classDescriptor;
523
+ let _classExtraInitializers = [];
524
+ let _classThis;
525
+ let _classSuper = Query;
526
+ let _id_decorators;
527
+ let _id_initializers = [];
528
+ let _id_extraInitializers = [];
529
+ let _path_decorators;
530
+ let _path_initializers = [];
531
+ let _path_extraInitializers = [];
532
+ let _query_decorators;
533
+ let _query_initializers = [];
534
+ let _query_extraInitializers = [];
535
+ var Nested = class extends _classSuper {
536
+ static { _classThis = this; }
537
+ static {
538
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
539
+ _id_decorators = [field({ type: "string" })];
540
+ _path_decorators = [field({ type: vec("string") })];
541
+ _query_decorators = [field({ type: vec(Query) })];
542
+ __esDecorate(null, null, _id_decorators, { kind: "field", name: "id", static: false, private: false, access: { has: obj => "id" in obj, get: obj => obj.id, set: (obj, value) => { obj.id = value; } }, metadata: _metadata }, _id_initializers, _id_extraInitializers);
543
+ __esDecorate(null, null, _path_decorators, { kind: "field", name: "path", static: false, private: false, access: { has: obj => "path" in obj, get: obj => obj.path, set: (obj, value) => { obj.path = value; } }, metadata: _metadata }, _path_initializers, _path_extraInitializers);
544
+ __esDecorate(null, null, _query_decorators, { kind: "field", name: "query", static: false, private: false, access: { has: obj => "query" in obj, get: obj => obj.query, set: (obj, value) => { obj.query = value; } }, metadata: _metadata }, _query_initializers, _query_extraInitializers);
545
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
546
+ Nested = _classThis = _classDescriptor.value;
547
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
548
+ __runInitializers(_classThis, _classExtraInitializers);
549
+ }
550
+ id = __runInitializers(this, _id_initializers, void 0);
551
+ path = (__runInitializers(this, _id_extraInitializers), __runInitializers(this, _path_initializers, void 0));
552
+ query = (__runInitializers(this, _path_extraInitializers), __runInitializers(this, _query_initializers, void 0));
553
+ constructor(props) {
554
+ super();
555
+ __runInitializers(this, _query_extraInitializers);
556
+ this.path = Array.isArray(props.path) ? props.path : [props.path];
557
+ this.id = props.id ?? uuid();
558
+ this.query = toQuery(props.query);
559
+ }
560
+ };
561
+ return Nested = _classThis;
562
+ })();
356
563
  export { Nested };
357
564
  export const toQuery = (query) => {
358
565
  if (!query) {