shelving 1.47.0 → 1.47.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/db/Operation.d.ts +1 -3
- package/db/Operation.js +4 -7
- package/package.json +1 -1
package/db/Operation.d.ts
CHANGED
|
@@ -8,10 +8,8 @@ export declare abstract class Operation {
|
|
|
8
8
|
}
|
|
9
9
|
/** Represent a list of write operations on a database run in series. */
|
|
10
10
|
export declare class Operations extends Operation {
|
|
11
|
-
/** Return a new write operations list with a set of write operations. */
|
|
12
|
-
static with(...operations: Nullish<Operation>[]): Operations;
|
|
13
11
|
readonly operations: ImmutableArray<Operation>;
|
|
14
|
-
constructor(operations:
|
|
12
|
+
constructor(...operations: Nullish<Operation>[]);
|
|
15
13
|
run(db: Database): Promise<Operations>;
|
|
16
14
|
/** Return a new write operations list with an additional write operation added. */
|
|
17
15
|
with(...operations: Nullish<Operation>[]): {
|
package/db/Operation.js
CHANGED
|
@@ -4,23 +4,20 @@ export class Operation {
|
|
|
4
4
|
}
|
|
5
5
|
/** Represent a list of write operations on a database run in series. */
|
|
6
6
|
export class Operations extends Operation {
|
|
7
|
-
constructor(operations) {
|
|
7
|
+
constructor(...operations) {
|
|
8
8
|
super();
|
|
9
9
|
this.operations = operations.filter(notNullish);
|
|
10
10
|
}
|
|
11
|
-
/** Return a new write operations list with a set of write operations. */
|
|
12
|
-
static with(...operations) {
|
|
13
|
-
return new Operations(operations);
|
|
14
|
-
}
|
|
15
11
|
async run(db) {
|
|
16
|
-
|
|
12
|
+
const ops = await callAsyncSeries(_run, this.operations, db);
|
|
13
|
+
return new Operations(...ops);
|
|
17
14
|
}
|
|
18
15
|
/** Return a new write operations list with an additional write operation added. */
|
|
19
16
|
with(...operations) {
|
|
20
17
|
return { __proto__: Object.getPrototypeOf(this), ...this, operations: [...this.operations, operations] };
|
|
21
18
|
}
|
|
22
19
|
}
|
|
23
|
-
const
|
|
20
|
+
const _run = (operation, db) => operation.run(db);
|
|
24
21
|
/** Represent a add operation made to a collection in a database. */
|
|
25
22
|
export class AddOperation extends Operation {
|
|
26
23
|
constructor(collection, data) {
|