@lossless.org/client 1.14.0 → 1.16.0
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_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/nosqldb/classes.collection.d.ts +4 -1
- package/dist_ts/nosqldb/classes.collection.js +7 -2
- package/dist_ts/nosqldb/classes.doc.d.ts +87 -31
- package/dist_ts/nosqldb/classes.doc.js +107 -36
- package/dist_ts/objectstorage/classes.bucket.d.ts +16 -0
- package/dist_ts/objectstorage/classes.bucket.js +77 -3
- package/dist_ts/objectstorage/classes.objectrangeerror.d.ts +5 -0
- package/dist_ts/objectstorage/classes.objectrangeerror.js +9 -0
- package/dist_ts/objectstorage/index.d.ts +1 -0
- package/dist_ts/objectstorage/index.js +2 -1
- package/dist_ts/objectstorage/interfaces.d.ts +33 -0
- package/dist_ts/objectstorage/internal.bucketrequests.d.ts +4 -0
- package/dist_ts/objectstorage/internal.bucketrequests.js +2 -2
- package/package.json +2 -2
- package/readme.md +8 -2
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/nosqldb/classes.collection.ts +13 -2
- package/ts/nosqldb/classes.doc.ts +258 -70
- package/ts/objectstorage/classes.bucket.ts +122 -2
- package/ts/objectstorage/classes.objectrangeerror.ts +11 -0
- package/ts/objectstorage/index.ts +1 -0
- package/ts/objectstorage/interfaces.ts +37 -0
- package/ts/objectstorage/internal.bucketrequests.ts +1 -1
|
@@ -62,6 +62,13 @@ export interface SvDbOptions {
|
|
|
62
62
|
* below this persisted field.
|
|
63
63
|
*/
|
|
64
64
|
atomicPaths?: readonly string[];
|
|
65
|
+
/**
|
|
66
|
+
* Explicit relative nested paths below this persisted field that hold
|
|
67
|
+
* arrays. Each one is a declared nested path exactly like an `atomicPaths`
|
|
68
|
+
* entry, and in addition the array operators `$push`, `$addToSet` and
|
|
69
|
+
* `$pull` and the grouped-totals `unwind` may target it.
|
|
70
|
+
*/
|
|
71
|
+
arrayPaths?: readonly string[];
|
|
65
72
|
/**
|
|
66
73
|
* Declares this persisted top-level field as numeric for strict atomic
|
|
67
74
|
* expression references.
|
|
@@ -261,16 +268,43 @@ export interface ISmartdataAtomicNumericExpression<T> {
|
|
|
261
268
|
TSmartdataAtomicNumericExpressionOperand<T>
|
|
262
269
|
];
|
|
263
270
|
}
|
|
264
|
-
|
|
271
|
+
/**
|
|
272
|
+
* A path grouped totals may group by or sum: a declared top-level field or a
|
|
273
|
+
* nested path declared through `@svDb({ atomicPaths })` or
|
|
274
|
+
* `@svDb({ arrayPaths })`.
|
|
275
|
+
*/
|
|
276
|
+
export type TSmartdataGroupedTotalsPath<T> = TSmartdataAtomicDocumentPath<T>;
|
|
277
|
+
/**
|
|
278
|
+
* A path grouped totals may unwind: a declared top-level array field or a
|
|
279
|
+
* nested path declared through `@svDb({ arrayPaths })`.
|
|
280
|
+
*/
|
|
281
|
+
export type TSmartdataGroupedTotalsUnwindPath<T> = TSmartdataAtomicArrayPath<T> | TSmartdataAtomicNestedDocumentPath<T>;
|
|
282
|
+
export interface ISmartdataGroupedTotalsOptions<T, TUnwind extends TSmartdataGroupedTotalsUnwindPath<T> = never> {
|
|
265
283
|
/**
|
|
266
|
-
* One or two declared
|
|
267
|
-
*
|
|
284
|
+
* One or two distinct declared paths whose value combinations form the
|
|
285
|
+
* groups: declared top-level fields or nested paths declared through
|
|
286
|
+
* `@svDb({ atomicPaths })` or `@svDb({ arrayPaths })`.
|
|
268
287
|
*/
|
|
269
|
-
groupBy: ReadonlyArray<
|
|
288
|
+
groupBy: ReadonlyArray<TSmartdataGroupedTotalsPath<T>>;
|
|
270
289
|
/**
|
|
271
|
-
*
|
|
290
|
+
* Aggregates per element of one array instead of per document: names a
|
|
291
|
+
* declared top-level array field or a nested path declared through
|
|
292
|
+
* `@svDb({ arrayPaths })`, which is itself a `groupBy` or `sums` path or
|
|
293
|
+
* holds the element fields that `groupBy` and `sums` paths name below it
|
|
294
|
+
* (`lines.accountNumber` below `unwind: 'lines'`). Element fields are
|
|
295
|
+
* declared nested paths like any other, through `@svDb({ atomicPaths })`
|
|
296
|
+
* on the array's field. Every element contributes on its own, so `count`
|
|
297
|
+
* counts elements and a document contributes its `sums` once per element;
|
|
298
|
+
* a document whose array is missing, null or empty contributes nothing.
|
|
299
|
+
* The `filter` still selects whole documents before the array is unwound,
|
|
300
|
+
* and no `groupBy` or `sums` path may contain the unwound array.
|
|
272
301
|
*/
|
|
273
|
-
|
|
302
|
+
unwind?: TUnwind;
|
|
303
|
+
/**
|
|
304
|
+
* Declared numeric top-level fields, or declared nested paths holding
|
|
305
|
+
* numbers, to sum per group.
|
|
306
|
+
*/
|
|
307
|
+
sums?: ReadonlyArray<TSmartdataNumericDocumentPath<T> | TSmartdataAtomicNestedDocumentPath<T>>;
|
|
274
308
|
filter?: MongoFilter<T>;
|
|
275
309
|
/**
|
|
276
310
|
* Required bound on the number of returned groups (1..10000). The group
|
|
@@ -290,32 +324,41 @@ export interface ISmartdataGroupedTotalsOptions<T> {
|
|
|
290
324
|
signal?: AbortSignal;
|
|
291
325
|
session?: TSmartdataOrdinarySession;
|
|
292
326
|
}
|
|
293
|
-
export interface ISmartdataGroupedTotalsRow<T> {
|
|
327
|
+
export interface ISmartdataGroupedTotalsRow<T, TUnwind extends TSmartdataGroupedTotalsUnwindPath<T> = never> {
|
|
294
328
|
/**
|
|
295
|
-
* The group's key values
|
|
296
|
-
* holding an explicit null merge into
|
|
329
|
+
* The group's key values, keyed by the `groupBy` paths as given. Documents
|
|
330
|
+
* missing a group path and documents holding an explicit null merge into
|
|
331
|
+
* one group reported as null. An unwound top-level array reports the
|
|
332
|
+
* element; nested paths report the stored value untyped.
|
|
297
333
|
*/
|
|
298
334
|
group: {
|
|
299
|
-
[TKey in TSmartdataDocumentPath<T>]?: T[TKey] | null;
|
|
300
|
-
}
|
|
335
|
+
[TKey in TSmartdataDocumentPath<T>]?: (TKey extends TUnwind ? TSmartdataAtomicArrayElement<T[TKey]> : T[TKey]) | null;
|
|
336
|
+
} & Partial<Record<TSmartdataAtomicNestedDocumentPath<T>, unknown>>;
|
|
301
337
|
count: number;
|
|
302
|
-
sums: Partial<Record<TSmartdataNumericDocumentPath<T>, number>>;
|
|
338
|
+
sums: Partial<Record<TSmartdataNumericDocumentPath<T> | TSmartdataAtomicNestedDocumentPath<T>, number>>;
|
|
303
339
|
}
|
|
304
|
-
export interface ISmartdataGroupedTotalsPage<T> {
|
|
305
|
-
rows: Array<ISmartdataGroupedTotalsRow<T>>;
|
|
340
|
+
export interface ISmartdataGroupedTotalsPage<T, TUnwind extends TSmartdataGroupedTotalsUnwindPath<T> = never> {
|
|
341
|
+
rows: Array<ISmartdataGroupedTotalsRow<T, TUnwind>>;
|
|
306
342
|
hasMore: boolean;
|
|
307
343
|
}
|
|
308
344
|
export type TSmartdataAtomicArrayPath<T> = {
|
|
309
345
|
[TKey in TSmartdataDocumentPath<T>]: NonNullable<T[TKey]> extends ReadonlyArray<unknown> ? TKey : never;
|
|
310
346
|
}[TSmartdataDocumentPath<T>];
|
|
311
347
|
type TSmartdataAtomicArrayElement<TValue> = NonNullable<TValue> extends ReadonlyArray<infer TElement> ? TElement : never;
|
|
348
|
+
/**
|
|
349
|
+
* Array operators take a declared top-level array field, typed by its element,
|
|
350
|
+
* or a nested path below a declared field. A nested path is accepted at run
|
|
351
|
+
* time only when the model declares it through `@svDb({ arrayPaths })`.
|
|
352
|
+
*/
|
|
312
353
|
type TSmartdataAtomicArrayOperation<T> = Partial<{
|
|
313
354
|
[TKey in TSmartdataAtomicArrayPath<T>]: TSmartdataAtomicArrayElement<T[TKey]>;
|
|
314
|
-
}
|
|
315
|
-
|
|
355
|
+
}> & Partial<Record<TSmartdataAtomicNestedDocumentPath<T>, unknown>>;
|
|
356
|
+
/** The scalar equality operands `$pull` accepts. */
|
|
357
|
+
type TSmartdataAtomicPullScalarValue = string | number | boolean | null | Date | plugins.mongodb.ObjectId | plugins.mongodb.Binary | plugins.mongodb.Decimal128 | plugins.mongodb.Long | plugins.mongodb.Int32 | plugins.mongodb.Double | plugins.mongodb.Timestamp;
|
|
358
|
+
type TSmartdataAtomicPullScalar<TValue> = Extract<TValue, TSmartdataAtomicPullScalarValue>;
|
|
316
359
|
type TSmartdataAtomicArrayPullOperation<T> = Partial<{
|
|
317
360
|
[TKey in TSmartdataAtomicArrayPath<T>]: TSmartdataAtomicPullScalar<TSmartdataAtomicArrayElement<T[TKey]>>;
|
|
318
|
-
}
|
|
361
|
+
}> & Partial<Record<TSmartdataAtomicNestedDocumentPath<T>, TSmartdataAtomicPullScalarValue>>;
|
|
319
362
|
export interface ISmartdataAtomicUpdate<T> {
|
|
320
363
|
$set?: TSmartdataAtomicSet<T>;
|
|
321
364
|
$unset?: Partial<Record<TSmartdataAtomicDocumentPath<T>, '' | true | 1>>;
|
|
@@ -334,19 +377,21 @@ export interface ISmartdataAtomicUpdate<T> {
|
|
|
334
377
|
$min?: TSmartdataAtomicMonotonic<T>;
|
|
335
378
|
$setOnInsert?: TSmartdataAtomicSet<T>;
|
|
336
379
|
/**
|
|
337
|
-
* Appends one element to a declared top-level array field
|
|
338
|
-
*
|
|
380
|
+
* Appends one element to a declared top-level array field or a nested
|
|
381
|
+
* path declared through `@svDb({ arrayPaths })`. Modifier documents
|
|
382
|
+
* ($each, $position, $slice, $sort) are rejected.
|
|
339
383
|
*/
|
|
340
384
|
$push?: TSmartdataAtomicArrayOperation<T>;
|
|
341
385
|
/**
|
|
342
|
-
* Adds one element to a declared top-level array field
|
|
343
|
-
* element is already present. Modifier
|
|
386
|
+
* Adds one element to a declared top-level array field or a declared
|
|
387
|
+
* nested array path unless an equal element is already present. Modifier
|
|
388
|
+
* documents are rejected.
|
|
344
389
|
*/
|
|
345
390
|
$addToSet?: TSmartdataAtomicArrayOperation<T>;
|
|
346
391
|
/**
|
|
347
392
|
* Removes every element equal to a scalar operand from a declared
|
|
348
|
-
* top-level array field
|
|
349
|
-
* regular expressions are rejected.
|
|
393
|
+
* top-level array field or a declared nested array path. Operator
|
|
394
|
+
* documents, plain objects, arrays, and regular expressions are rejected.
|
|
350
395
|
*/
|
|
351
396
|
$pull?: TSmartdataAtomicArrayPullOperation<T>;
|
|
352
397
|
}
|
|
@@ -565,7 +610,14 @@ export declare class SmartDataDbDoc<T extends TImplements, TImplements, TManager
|
|
|
565
610
|
* guarantee at most one matching document for an equality filter.
|
|
566
611
|
*/
|
|
567
612
|
private static getGloballyConstrainingKeySets;
|
|
613
|
+
/**
|
|
614
|
+
* Every nested path the model declares below a persisted field, through
|
|
615
|
+
* `@svDb({ atomicPaths })` or `@svDb({ arrayPaths })`.
|
|
616
|
+
*/
|
|
568
617
|
private static getDeclaredAtomicPaths;
|
|
618
|
+
/** The nested paths declared through `@svDb({ arrayPaths })` as holding arrays. */
|
|
619
|
+
private static getDeclaredArrayPaths;
|
|
620
|
+
private static readDeclaredNestedPaths;
|
|
569
621
|
private static getSerializedPersistedRoots;
|
|
570
622
|
private static getDeclaredQueryPaths;
|
|
571
623
|
private static assertHydratedProjection;
|
|
@@ -703,19 +755,23 @@ export declare class SmartDataDbDoc<T extends TImplements, TImplements, TManager
|
|
|
703
755
|
static atomicUpsertMany<T>(this: plugins.tsclass.typeFest.Class<T>, operationsArg: ReadonlyArray<ISmartdataAtomicUpsertManyOperation<T>>, opts?: ISmartdataAtomicUpsertManyOptions): Promise<ISmartdataAtomicUpsertManyResult>;
|
|
704
756
|
/**
|
|
705
757
|
* Computes bounded grouped counts and optional numeric sums server-side.
|
|
706
|
-
* Groups by one or two declared top-level fields
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
*
|
|
710
|
-
*
|
|
711
|
-
|
|
712
|
-
|
|
758
|
+
* Groups by one or two declared paths — top-level fields or nested paths
|
|
759
|
+
* declared through `@svDb({ atomicPaths })` or `@svDb({ arrayPaths })` —
|
|
760
|
+
* optionally per element of one declared array (`unwind`), whose element
|
|
761
|
+
* fields `groupBy` and `sums` may then name, always returns a `count` per
|
|
762
|
+
* group, and sums only declared numeric paths. The
|
|
763
|
+
* `$limit` follows the group stage without a sort, so when more groups
|
|
764
|
+
* exist than the limit the returned subset is arbitrary. Use
|
|
765
|
+
* `getGroupedTotalsPage()` when the caller must detect overflow. The
|
|
766
|
+
* aggregation cursor never leaves SmartData.
|
|
767
|
+
*/
|
|
768
|
+
static getGroupedTotals<T, TUnwind extends TSmartdataGroupedTotalsUnwindPath<T> = never>(this: plugins.tsclass.typeFest.Class<T>, optionsArg: ISmartdataGroupedTotalsOptions<T, TUnwind>): Promise<Array<ISmartdataGroupedTotalsRow<T, TUnwind>>>;
|
|
713
769
|
/**
|
|
714
770
|
* Computes the same bounded grouped totals as `getGroupedTotals()` and
|
|
715
771
|
* reports whether at least one additional group exists beyond the requested
|
|
716
772
|
* row limit.
|
|
717
773
|
*/
|
|
718
|
-
static getGroupedTotalsPage<T>(this: plugins.tsclass.typeFest.Class<T>, optionsArg: ISmartdataGroupedTotalsOptions<T>): Promise<ISmartdataGroupedTotalsPage<T>>;
|
|
774
|
+
static getGroupedTotalsPage<T, TUnwind extends TSmartdataGroupedTotalsUnwindPath<T> = never>(this: plugins.tsclass.typeFest.Class<T>, optionsArg: ISmartdataGroupedTotalsOptions<T, TUnwind>): Promise<ISmartdataGroupedTotalsPage<T, TUnwind>>;
|
|
719
775
|
/**
|
|
720
776
|
* gets all instances as array
|
|
721
777
|
* @param this
|