@decaf-ts/for-couchdb 0.4.4 → 0.4.6
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/README.md +5 -0
- package/dist/for-couchdb.cjs +1 -1
- package/dist/for-couchdb.cjs.map +1 -1
- package/dist/for-couchdb.js +1 -1
- package/dist/for-couchdb.js.map +1 -1
- package/lib/adapter.cjs +3 -19
- package/lib/adapter.d.ts +1 -8
- package/lib/adapter.js.map +1 -1
- package/lib/esm/adapter.d.ts +1 -8
- package/lib/esm/adapter.js +4 -20
- package/lib/esm/adapter.js.map +1 -1
- package/lib/esm/index.d.ts +1 -3
- package/lib/esm/index.js +1 -3
- package/lib/esm/index.js.map +1 -1
- package/lib/index.cjs +1 -3
- package/lib/index.d.ts +1 -3
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/lib/esm/model/CouchDBSequence.d.ts +0 -26
- package/lib/esm/model/CouchDBSequence.js +0 -44
- package/lib/esm/model/CouchDBSequence.js.map +0 -1
- package/lib/esm/model/index.d.ts +0 -1
- package/lib/esm/model/index.js +0 -2
- package/lib/esm/model/index.js.map +0 -1
- package/lib/esm/sequences/Sequence.d.ts +0 -48
- package/lib/esm/sequences/Sequence.js +0 -115
- package/lib/esm/sequences/Sequence.js.map +0 -1
- package/lib/esm/sequences/index.d.ts +0 -1
- package/lib/esm/sequences/index.js +0 -2
- package/lib/esm/sequences/index.js.map +0 -1
- package/lib/model/CouchDBSequence.cjs +0 -47
- package/lib/model/CouchDBSequence.d.ts +0 -26
- package/lib/model/CouchDBSequence.js.map +0 -1
- package/lib/model/index.cjs +0 -18
- package/lib/model/index.d.ts +0 -1
- package/lib/model/index.js.map +0 -1
- package/lib/sequences/Sequence.cjs +0 -119
- package/lib/sequences/Sequence.d.ts +0 -48
- package/lib/sequences/Sequence.js.map +0 -1
- package/lib/sequences/index.cjs +0 -18
- package/lib/sequences/index.d.ts +0 -1
- package/lib/sequences/index.js.map +0 -1
package/lib/esm/adapter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/adapter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../../src/adapter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,uBAAoB;AAC9D,OAAO,EACL,SAAS,EACT,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,GACb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,oBAAiB;AAEtC,OAAO,EAAE,gBAAgB,EAAE,yBAAgB;AAG3C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,wBAAqB;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,OAAgB,cAIpB,SAAQ,OAAkC;IAC1C,YAAsB,KAAW,EAAE,OAAe,EAAE,KAAc;QAChE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAC7B,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACvE,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;YACpB,YAAY,CAAC,IAAI,EAAE,CAAC,EAAG,IAAY,CAAC,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IAEH,SAAS;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,WAAW,CAAkB,KAAQ,EAAE,QAAa;QACzD,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,eAAe,CAAC,QAAQ,EAAE;YACrD,UAAU,EAAE,KAAK;YACjB,YAAY,EAAE,IAAI;YAClB,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAkB,KAAQ;QAC1C,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAChD,KAAK,EACL,eAAe,CAAC,QAAQ,CACzB,CAAC;QACF,OAAO,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACnD,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,cAAc,CAAkB,KAAQ;QAC7C,MAAM,UAAU,GAAG,MAAM,CAAC,wBAAwB,CAChD,KAAK,EACL,eAAe,CAAC,QAAQ,CACzB,CAAC;QACF,IAAI,UAAU;YAAE,OAAQ,KAAa,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAClE,CAAC;CACF;AAvbC;IADC,KAAK,EAAE;;;oCACsB,gBAAgB;+CAM7C;AAmDS;IADT,KAAK,EAAE;;;;oDAQP;AAUS;IADT,KAAK,EAAE;;;;4DAUP;AAWS;IADT,KAAK,EAAE;;;;kDAcP;AA4BS;IADT,KAAK,EAAE;;;;qDAmBP;AA2BD;IADC,KAAK,EAAE;;;;kDAoBP;AA4BS;IADT,KAAK,EAAE;;;;qDAyBP"}
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export * from "./indexes";
|
|
2
|
-
export * from "./model";
|
|
3
|
-
export * from "./sequences";
|
|
4
2
|
export * from "./repository";
|
|
5
3
|
export * from "./adapter";
|
|
6
4
|
export * from "./constants";
|
|
@@ -18,7 +16,7 @@ export * from "./query";
|
|
|
18
16
|
* @summary The version string of the for-couchdb package
|
|
19
17
|
* @const VERSION
|
|
20
18
|
*/
|
|
21
|
-
export declare const VERSION = "0.4.
|
|
19
|
+
export declare const VERSION = "0.4.5";
|
|
22
20
|
/**
|
|
23
21
|
* @description Stores the current package name
|
|
24
22
|
* @summary The version string of the for-couchdb package
|
package/lib/esm/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Metadata } from "@decaf-ts/decoration";
|
|
2
2
|
export * from "./indexes/index.js";
|
|
3
|
-
export * from "./model/index.js";
|
|
4
|
-
export * from "./sequences/index.js";
|
|
5
3
|
export * from "./repository.js";
|
|
6
4
|
export * from "./adapter.js";
|
|
7
5
|
export * from "./constants.js";
|
|
@@ -19,7 +17,7 @@ export * from "./query/index.js";
|
|
|
19
17
|
* @summary The version string of the for-couchdb package
|
|
20
18
|
* @const VERSION
|
|
21
19
|
*/
|
|
22
|
-
export const VERSION = "0.4.
|
|
20
|
+
export const VERSION = "0.4.5";
|
|
23
21
|
/**
|
|
24
22
|
* @description Stores the current package name
|
|
25
23
|
* @summary The version string of the for-couchdb package
|
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,mCAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,mCAA0B;AAC1B,gCAA6B;AAC7B,6BAA0B;AAC1B,+BAA4B;AAC5B,4BAAyB;AACzB,2BAAwB;AACxB,2BAAwB;AACxB,iCAAwB;AAExB;;;;GAIG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC;AAErC;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC;AAE1C,QAAQ,CAAC,eAAe,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC"}
|
package/lib/index.cjs
CHANGED
|
@@ -17,8 +17,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.PACKAGE_NAME = exports.VERSION = void 0;
|
|
18
18
|
const decoration_1 = require("@decaf-ts/decoration");
|
|
19
19
|
__exportStar(require("./indexes/index.cjs"), exports);
|
|
20
|
-
__exportStar(require("./model/index.cjs"), exports);
|
|
21
|
-
__exportStar(require("./sequences/index.cjs"), exports);
|
|
22
20
|
__exportStar(require("./repository.cjs"), exports);
|
|
23
21
|
__exportStar(require("./adapter.cjs"), exports);
|
|
24
22
|
__exportStar(require("./constants.cjs"), exports);
|
|
@@ -36,7 +34,7 @@ __exportStar(require("./query/index.cjs"), exports);
|
|
|
36
34
|
* @summary The version string of the for-couchdb package
|
|
37
35
|
* @const VERSION
|
|
38
36
|
*/
|
|
39
|
-
exports.VERSION = "0.4.
|
|
37
|
+
exports.VERSION = "0.4.5";
|
|
40
38
|
/**
|
|
41
39
|
* @description Stores the current package name
|
|
42
40
|
* @summary The version string of the for-couchdb package
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export * from "./indexes";
|
|
2
|
-
export * from "./model";
|
|
3
|
-
export * from "./sequences";
|
|
4
2
|
export * from "./repository";
|
|
5
3
|
export * from "./adapter";
|
|
6
4
|
export * from "./constants";
|
|
@@ -18,7 +16,7 @@ export * from "./query";
|
|
|
18
16
|
* @summary The version string of the for-couchdb package
|
|
19
17
|
* @const VERSION
|
|
20
18
|
*/
|
|
21
|
-
export declare const VERSION = "0.4.
|
|
19
|
+
export declare const VERSION = "0.4.5";
|
|
22
20
|
/**
|
|
23
21
|
* @description Stores the current package name
|
|
24
22
|
* @summary The version string of the for-couchdb package
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAAgD;AAEhD,sDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qDAAgD;AAEhD,sDAA0B;AAC1B,mDAA6B;AAC7B,gDAA0B;AAC1B,kDAA4B;AAC5B,+CAAyB;AACzB,8CAAwB;AACxB,8CAAwB;AACxB,oDAAwB;AAExB;;;;GAIG;AAEH;;;;GAIG;AACU,QAAA,OAAO,GAAG,aAAa,CAAC;AAErC;;;;GAIG;AACU,QAAA,YAAY,GAAG,aAAa,CAAC;AAE1C,qBAAQ,CAAC,eAAe,CAAC,oBAAY,EAAE,eAAO,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ModelArg } from "@decaf-ts/decorator-validation";
|
|
2
|
-
import { BaseModel } from "@decaf-ts/core";
|
|
3
|
-
/**
|
|
4
|
-
* @description Model for CouchDB sequence records
|
|
5
|
-
* @summary Represents a sequence in CouchDB used for generating sequential IDs
|
|
6
|
-
* @param {ModelArg<Sequence>} [seq] - Optional initialization data for the sequence
|
|
7
|
-
* @class
|
|
8
|
-
* @example
|
|
9
|
-
* // Example of creating and using a Sequence
|
|
10
|
-
* const sequence = new Sequence({ id: 'user-seq', current: 1 });
|
|
11
|
-
* // Increment the sequence
|
|
12
|
-
* sequence.current = Number(sequence.current) + 1;
|
|
13
|
-
*/
|
|
14
|
-
export declare class Sequence extends BaseModel {
|
|
15
|
-
/**
|
|
16
|
-
* @description The unique identifier for the sequence
|
|
17
|
-
* @summary Primary key for the sequence record
|
|
18
|
-
*/
|
|
19
|
-
id: string;
|
|
20
|
-
/**
|
|
21
|
-
* @description The current value of the sequence
|
|
22
|
-
* @summary Current sequence value that can be incremented
|
|
23
|
-
*/
|
|
24
|
-
current: string | number;
|
|
25
|
-
constructor(seq?: ModelArg<Sequence>);
|
|
26
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
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;
|
|
6
|
-
};
|
|
7
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
-
};
|
|
10
|
-
import { model, required } from "@decaf-ts/decorator-validation";
|
|
11
|
-
import { BaseModel, pk, index, table } from "@decaf-ts/core";
|
|
12
|
-
import { CouchDBKeys } from "./../constants.js";
|
|
13
|
-
/**
|
|
14
|
-
* @description Model for CouchDB sequence records
|
|
15
|
-
* @summary Represents a sequence in CouchDB used for generating sequential IDs
|
|
16
|
-
* @param {ModelArg<Sequence>} [seq] - Optional initialization data for the sequence
|
|
17
|
-
* @class
|
|
18
|
-
* @example
|
|
19
|
-
* // Example of creating and using a Sequence
|
|
20
|
-
* const sequence = new Sequence({ id: 'user-seq', current: 1 });
|
|
21
|
-
* // Increment the sequence
|
|
22
|
-
* sequence.current = Number(sequence.current) + 1;
|
|
23
|
-
*/
|
|
24
|
-
let Sequence = class Sequence extends BaseModel {
|
|
25
|
-
constructor(seq) {
|
|
26
|
-
super(seq);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
__decorate([
|
|
30
|
-
pk(),
|
|
31
|
-
__metadata("design:type", String)
|
|
32
|
-
], Sequence.prototype, "id", void 0);
|
|
33
|
-
__decorate([
|
|
34
|
-
required(),
|
|
35
|
-
index(),
|
|
36
|
-
__metadata("design:type", Object)
|
|
37
|
-
], Sequence.prototype, "current", void 0);
|
|
38
|
-
Sequence = __decorate([
|
|
39
|
-
table(CouchDBKeys.SEQUENCE),
|
|
40
|
-
model(),
|
|
41
|
-
__metadata("design:paramtypes", [Object])
|
|
42
|
-
], Sequence);
|
|
43
|
-
export { Sequence };
|
|
44
|
-
//# sourceMappingURL=CouchDBSequence.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CouchDBSequence.js","sourceRoot":"","sources":["../../../src/model/CouchDBSequence.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,0BAAqB;AAE3C;;;;;;;;;;GAUG;AAGI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,SAAS;IAgBrC,YAAY,GAAwB;QAClC,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF,CAAA;AAbC;IADC,EAAE,EAAE;;oCACO;AAQZ;IAFC,QAAQ,EAAE;IACV,KAAK,EAAE;;yCACkB;AAdf,QAAQ;IAFpB,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC;IAC3B,KAAK,EAAE;;GACK,QAAQ,CAmBpB"}
|
package/lib/esm/model/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./CouchDBSequence";
|
package/lib/esm/model/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/model/index.ts"],"names":[],"mappings":"AAAA,qCAAkC"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Sequence as Seq } from "../model/CouchDBSequence";
|
|
2
|
-
import { Adapter, MaybeContextualArg, SequenceOptions } from "@decaf-ts/core";
|
|
3
|
-
import { Sequence } from "@decaf-ts/core";
|
|
4
|
-
import { MangoQuery } from "../types";
|
|
5
|
-
import { CouchDBRepository } from "../repository";
|
|
6
|
-
/**
|
|
7
|
-
* @summary Abstract implementation of a Sequence
|
|
8
|
-
* @description provides the basic functionality for {@link Sequence}s
|
|
9
|
-
*
|
|
10
|
-
* @param {SequenceOptions} options
|
|
11
|
-
*
|
|
12
|
-
* @class CouchDBSequence
|
|
13
|
-
* @implements Sequence
|
|
14
|
-
*/
|
|
15
|
-
export declare class CouchDBSequence extends Sequence {
|
|
16
|
-
protected repo: CouchDBRepository<Seq, any>;
|
|
17
|
-
constructor(options: SequenceOptions, adapter: Adapter<any, any, MangoQuery, any>);
|
|
18
|
-
/**
|
|
19
|
-
* @summary Retrieves the current value for the sequence
|
|
20
|
-
* @protected
|
|
21
|
-
*/
|
|
22
|
-
current(...args: MaybeContextualArg<any>): Promise<string | number | bigint>;
|
|
23
|
-
/**
|
|
24
|
-
* @summary increments the sequence
|
|
25
|
-
* @description Sequence specific implementation
|
|
26
|
-
*
|
|
27
|
-
* @param {string | number | bigint} current
|
|
28
|
-
* @param count
|
|
29
|
-
* @protected
|
|
30
|
-
*/
|
|
31
|
-
private increment;
|
|
32
|
-
/**
|
|
33
|
-
* @description Gets the next value in the sequence
|
|
34
|
-
* @summary Retrieves the current value of the sequence and increments it by the
|
|
35
|
-
* configured increment amount. This is the main method used to get a new sequential value.
|
|
36
|
-
* @return A promise that resolves to the next value in the sequence
|
|
37
|
-
*/
|
|
38
|
-
next(...argz: MaybeContextualArg<any>): Promise<number | string | bigint>;
|
|
39
|
-
/**
|
|
40
|
-
* @description Generates a range of sequential values
|
|
41
|
-
* @summary Retrieves a specified number of sequential values from the sequence.
|
|
42
|
-
* This is useful when you need to allocate multiple IDs at once.
|
|
43
|
-
* The method increments the sequence by the total amount needed and returns all values in the range.
|
|
44
|
-
* @param {number} count - The number of sequential values to generate
|
|
45
|
-
* @return A promise that resolves to an array of sequential values
|
|
46
|
-
*/
|
|
47
|
-
range(count: number, ...argz: MaybeContextualArg<any>): Promise<(number | string | bigint)[]>;
|
|
48
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { Sequence as Seq } from "./../model/CouchDBSequence.js";
|
|
2
|
-
import { Context, InternalError, NotFoundError, OperationKeys, } from "@decaf-ts/db-decorators";
|
|
3
|
-
import { Repository, } from "@decaf-ts/core";
|
|
4
|
-
import { Sequence } from "@decaf-ts/core";
|
|
5
|
-
/**
|
|
6
|
-
* @summary Abstract implementation of a Sequence
|
|
7
|
-
* @description provides the basic functionality for {@link Sequence}s
|
|
8
|
-
*
|
|
9
|
-
* @param {SequenceOptions} options
|
|
10
|
-
*
|
|
11
|
-
* @class CouchDBSequence
|
|
12
|
-
* @implements Sequence
|
|
13
|
-
*/
|
|
14
|
-
export class CouchDBSequence extends Sequence {
|
|
15
|
-
constructor(options, adapter) {
|
|
16
|
-
super(options, adapter);
|
|
17
|
-
this.repo = Repository.forModel(Seq, adapter.alias);
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* @summary Retrieves the current value for the sequence
|
|
21
|
-
* @protected
|
|
22
|
-
*/
|
|
23
|
-
async current(...args) {
|
|
24
|
-
const contextArgs = await Context.args(OperationKeys.READ, Seq, args, this.adapter);
|
|
25
|
-
const ctx = contextArgs.context;
|
|
26
|
-
const { name, startWith } = this.options;
|
|
27
|
-
try {
|
|
28
|
-
const sequence = await this.repo.read(name, ctx);
|
|
29
|
-
return this.parse(sequence.current);
|
|
30
|
-
}
|
|
31
|
-
catch (e) {
|
|
32
|
-
if (e instanceof NotFoundError) {
|
|
33
|
-
if (typeof startWith === "undefined")
|
|
34
|
-
throw new InternalError("Starting value is not defined for a non existing sequence");
|
|
35
|
-
try {
|
|
36
|
-
return this.parse(startWith);
|
|
37
|
-
}
|
|
38
|
-
catch (e) {
|
|
39
|
-
throw new InternalError(`Failed to parse initial value for sequence ${startWith}: ${e}`);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
throw new InternalError(`Failed to retrieve current value for sequence ${name}: ${e}`);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* @summary increments the sequence
|
|
47
|
-
* @description Sequence specific implementation
|
|
48
|
-
*
|
|
49
|
-
* @param {string | number | bigint} current
|
|
50
|
-
* @param count
|
|
51
|
-
* @protected
|
|
52
|
-
*/
|
|
53
|
-
async increment(current, count, ctx) {
|
|
54
|
-
const { type, incrementBy, name } = this.options;
|
|
55
|
-
let next;
|
|
56
|
-
const toIncrementBy = count || incrementBy;
|
|
57
|
-
if (toIncrementBy % incrementBy !== 0)
|
|
58
|
-
throw new InternalError(`Value to increment does not consider the incrementBy setting: ${incrementBy}`);
|
|
59
|
-
switch (type) {
|
|
60
|
-
case "Number":
|
|
61
|
-
next = this.parse(current) + toIncrementBy;
|
|
62
|
-
break;
|
|
63
|
-
case "BigInt":
|
|
64
|
-
next = this.parse(current) + BigInt(toIncrementBy);
|
|
65
|
-
break;
|
|
66
|
-
default:
|
|
67
|
-
throw new InternalError("Should never happen");
|
|
68
|
-
}
|
|
69
|
-
let seq;
|
|
70
|
-
try {
|
|
71
|
-
seq = await this.repo.update(new Seq({ id: name, current: next }), ctx);
|
|
72
|
-
}
|
|
73
|
-
catch (e) {
|
|
74
|
-
if (!(e instanceof NotFoundError))
|
|
75
|
-
throw e;
|
|
76
|
-
seq = await this.repo.create(new Seq({ id: name, current: next }), ctx);
|
|
77
|
-
}
|
|
78
|
-
return seq.current;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* @description Gets the next value in the sequence
|
|
82
|
-
* @summary Retrieves the current value of the sequence and increments it by the
|
|
83
|
-
* configured increment amount. This is the main method used to get a new sequential value.
|
|
84
|
-
* @return A promise that resolves to the next value in the sequence
|
|
85
|
-
*/
|
|
86
|
-
async next(...argz) {
|
|
87
|
-
const contextArgs = await Context.args(OperationKeys.UPDATE, Seq, argz, this.adapter);
|
|
88
|
-
const { context, args } = contextArgs;
|
|
89
|
-
const current = await this.current(...args);
|
|
90
|
-
return this.increment(current, undefined, context);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* @description Generates a range of sequential values
|
|
94
|
-
* @summary Retrieves a specified number of sequential values from the sequence.
|
|
95
|
-
* This is useful when you need to allocate multiple IDs at once.
|
|
96
|
-
* The method increments the sequence by the total amount needed and returns all values in the range.
|
|
97
|
-
* @param {number} count - The number of sequential values to generate
|
|
98
|
-
* @return A promise that resolves to an array of sequential values
|
|
99
|
-
*/
|
|
100
|
-
async range(count, ...argz) {
|
|
101
|
-
const contextArgs = await Context.args(OperationKeys.UPDATE, Seq, argz, this.adapter);
|
|
102
|
-
const { context, args } = contextArgs;
|
|
103
|
-
const current = (await this.current(...args));
|
|
104
|
-
const incrementBy = this.parse(this.options.incrementBy);
|
|
105
|
-
const next = await this.increment(current, this.parse(count) * incrementBy, context);
|
|
106
|
-
const range = [];
|
|
107
|
-
for (let i = 1; i <= count; i++) {
|
|
108
|
-
range.push(current + incrementBy * this.parse(i));
|
|
109
|
-
}
|
|
110
|
-
if (range[range.length - 1] !== next && this.options.type !== "String")
|
|
111
|
-
throw new InternalError("Miscalculation of range");
|
|
112
|
-
return range;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
//# sourceMappingURL=Sequence.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Sequence.js","sourceRoot":"","sources":["../../../src/sequences/Sequence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,GAAG,EAAE,sCAAiC;AAC3D,OAAO,EACL,OAAO,EACP,aAAa,EACb,aAAa,EACb,aAAa,GACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,UAAU,GAEX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C;;;;;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,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ;YACpE,MAAM,IAAI,aAAa,CAAC,yBAAyB,CAAC,CAAC;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Sequence";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sequences/index.ts"],"names":[],"mappings":"AAAA,8BAA2B"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
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;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Sequence = void 0;
|
|
13
|
-
const decorator_validation_1 = require("@decaf-ts/decorator-validation");
|
|
14
|
-
const core_1 = require("@decaf-ts/core");
|
|
15
|
-
const constants_1 = require("./../constants.cjs");
|
|
16
|
-
/**
|
|
17
|
-
* @description Model for CouchDB sequence records
|
|
18
|
-
* @summary Represents a sequence in CouchDB used for generating sequential IDs
|
|
19
|
-
* @param {ModelArg<Sequence>} [seq] - Optional initialization data for the sequence
|
|
20
|
-
* @class
|
|
21
|
-
* @example
|
|
22
|
-
* // Example of creating and using a Sequence
|
|
23
|
-
* const sequence = new Sequence({ id: 'user-seq', current: 1 });
|
|
24
|
-
* // Increment the sequence
|
|
25
|
-
* sequence.current = Number(sequence.current) + 1;
|
|
26
|
-
*/
|
|
27
|
-
let Sequence = class Sequence extends core_1.BaseModel {
|
|
28
|
-
constructor(seq) {
|
|
29
|
-
super(seq);
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
exports.Sequence = Sequence;
|
|
33
|
-
__decorate([
|
|
34
|
-
(0, core_1.pk)(),
|
|
35
|
-
__metadata("design:type", String)
|
|
36
|
-
], Sequence.prototype, "id", void 0);
|
|
37
|
-
__decorate([
|
|
38
|
-
(0, decorator_validation_1.required)(),
|
|
39
|
-
(0, core_1.index)(),
|
|
40
|
-
__metadata("design:type", Object)
|
|
41
|
-
], Sequence.prototype, "current", void 0);
|
|
42
|
-
exports.Sequence = Sequence = __decorate([
|
|
43
|
-
(0, core_1.table)(constants_1.CouchDBKeys.SEQUENCE),
|
|
44
|
-
(0, decorator_validation_1.model)(),
|
|
45
|
-
__metadata("design:paramtypes", [Object])
|
|
46
|
-
], Sequence);
|
|
47
|
-
//# sourceMappingURL=CouchDBSequence.js.map
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { ModelArg } from "@decaf-ts/decorator-validation";
|
|
2
|
-
import { BaseModel } from "@decaf-ts/core";
|
|
3
|
-
/**
|
|
4
|
-
* @description Model for CouchDB sequence records
|
|
5
|
-
* @summary Represents a sequence in CouchDB used for generating sequential IDs
|
|
6
|
-
* @param {ModelArg<Sequence>} [seq] - Optional initialization data for the sequence
|
|
7
|
-
* @class
|
|
8
|
-
* @example
|
|
9
|
-
* // Example of creating and using a Sequence
|
|
10
|
-
* const sequence = new Sequence({ id: 'user-seq', current: 1 });
|
|
11
|
-
* // Increment the sequence
|
|
12
|
-
* sequence.current = Number(sequence.current) + 1;
|
|
13
|
-
*/
|
|
14
|
-
export declare class Sequence extends BaseModel {
|
|
15
|
-
/**
|
|
16
|
-
* @description The unique identifier for the sequence
|
|
17
|
-
* @summary Primary key for the sequence record
|
|
18
|
-
*/
|
|
19
|
-
id: string;
|
|
20
|
-
/**
|
|
21
|
-
* @description The current value of the sequence
|
|
22
|
-
* @summary Current sequence value that can be incremented
|
|
23
|
-
*/
|
|
24
|
-
current: string | number;
|
|
25
|
-
constructor(seq?: ModelArg<Sequence>);
|
|
26
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CouchDBSequence.js","sourceRoot":"","sources":["../../src/model/CouchDBSequence.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yEAAiE;AACjE,yCAA6D;AAC7D,kDAA2C;AAE3C;;;;;;;;;;GAUG;AAGI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,gBAAS;IAgBrC,YAAY,GAAwB;QAClC,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF,CAAA;AAnBY,4BAAQ;AAMnB;IADC,IAAA,SAAE,GAAE;;oCACO;AAQZ;IAFC,IAAA,+BAAQ,GAAE;IACV,IAAA,YAAK,GAAE;;yCACkB;mBAdf,QAAQ;IAFpB,IAAA,YAAK,EAAC,uBAAW,CAAC,QAAQ,CAAC;IAC3B,IAAA,4BAAK,GAAE;;GACK,QAAQ,CAmBpB"}
|
package/lib/model/index.cjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./CouchDBSequence.cjs"), exports);
|
|
18
|
-
//# sourceMappingURL=index.js.map
|
package/lib/model/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./CouchDBSequence";
|
package/lib/model/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAkC"}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CouchDBSequence = void 0;
|
|
4
|
-
const CouchDBSequence_1 = require("./../model/CouchDBSequence.cjs");
|
|
5
|
-
const db_decorators_1 = require("@decaf-ts/db-decorators");
|
|
6
|
-
const core_1 = require("@decaf-ts/core");
|
|
7
|
-
const core_2 = require("@decaf-ts/core");
|
|
8
|
-
/**
|
|
9
|
-
* @summary Abstract implementation of a Sequence
|
|
10
|
-
* @description provides the basic functionality for {@link Sequence}s
|
|
11
|
-
*
|
|
12
|
-
* @param {SequenceOptions} options
|
|
13
|
-
*
|
|
14
|
-
* @class CouchDBSequence
|
|
15
|
-
* @implements Sequence
|
|
16
|
-
*/
|
|
17
|
-
class CouchDBSequence extends core_2.Sequence {
|
|
18
|
-
constructor(options, adapter) {
|
|
19
|
-
super(options, adapter);
|
|
20
|
-
this.repo = core_1.Repository.forModel(CouchDBSequence_1.Sequence, adapter.alias);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @summary Retrieves the current value for the sequence
|
|
24
|
-
* @protected
|
|
25
|
-
*/
|
|
26
|
-
async current(...args) {
|
|
27
|
-
const contextArgs = await db_decorators_1.Context.args(db_decorators_1.OperationKeys.READ, CouchDBSequence_1.Sequence, args, this.adapter);
|
|
28
|
-
const ctx = contextArgs.context;
|
|
29
|
-
const { name, startWith } = this.options;
|
|
30
|
-
try {
|
|
31
|
-
const sequence = await this.repo.read(name, ctx);
|
|
32
|
-
return this.parse(sequence.current);
|
|
33
|
-
}
|
|
34
|
-
catch (e) {
|
|
35
|
-
if (e instanceof db_decorators_1.NotFoundError) {
|
|
36
|
-
if (typeof startWith === "undefined")
|
|
37
|
-
throw new db_decorators_1.InternalError("Starting value is not defined for a non existing sequence");
|
|
38
|
-
try {
|
|
39
|
-
return this.parse(startWith);
|
|
40
|
-
}
|
|
41
|
-
catch (e) {
|
|
42
|
-
throw new db_decorators_1.InternalError(`Failed to parse initial value for sequence ${startWith}: ${e}`);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
throw new db_decorators_1.InternalError(`Failed to retrieve current value for sequence ${name}: ${e}`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* @summary increments the sequence
|
|
50
|
-
* @description Sequence specific implementation
|
|
51
|
-
*
|
|
52
|
-
* @param {string | number | bigint} current
|
|
53
|
-
* @param count
|
|
54
|
-
* @protected
|
|
55
|
-
*/
|
|
56
|
-
async increment(current, count, ctx) {
|
|
57
|
-
const { type, incrementBy, name } = this.options;
|
|
58
|
-
let next;
|
|
59
|
-
const toIncrementBy = count || incrementBy;
|
|
60
|
-
if (toIncrementBy % incrementBy !== 0)
|
|
61
|
-
throw new db_decorators_1.InternalError(`Value to increment does not consider the incrementBy setting: ${incrementBy}`);
|
|
62
|
-
switch (type) {
|
|
63
|
-
case "Number":
|
|
64
|
-
next = this.parse(current) + toIncrementBy;
|
|
65
|
-
break;
|
|
66
|
-
case "BigInt":
|
|
67
|
-
next = this.parse(current) + BigInt(toIncrementBy);
|
|
68
|
-
break;
|
|
69
|
-
default:
|
|
70
|
-
throw new db_decorators_1.InternalError("Should never happen");
|
|
71
|
-
}
|
|
72
|
-
let seq;
|
|
73
|
-
try {
|
|
74
|
-
seq = await this.repo.update(new CouchDBSequence_1.Sequence({ id: name, current: next }), ctx);
|
|
75
|
-
}
|
|
76
|
-
catch (e) {
|
|
77
|
-
if (!(e instanceof db_decorators_1.NotFoundError))
|
|
78
|
-
throw e;
|
|
79
|
-
seq = await this.repo.create(new CouchDBSequence_1.Sequence({ id: name, current: next }), ctx);
|
|
80
|
-
}
|
|
81
|
-
return seq.current;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* @description Gets the next value in the sequence
|
|
85
|
-
* @summary Retrieves the current value of the sequence and increments it by the
|
|
86
|
-
* configured increment amount. This is the main method used to get a new sequential value.
|
|
87
|
-
* @return A promise that resolves to the next value in the sequence
|
|
88
|
-
*/
|
|
89
|
-
async next(...argz) {
|
|
90
|
-
const contextArgs = await db_decorators_1.Context.args(db_decorators_1.OperationKeys.UPDATE, CouchDBSequence_1.Sequence, argz, this.adapter);
|
|
91
|
-
const { context, args } = contextArgs;
|
|
92
|
-
const current = await this.current(...args);
|
|
93
|
-
return this.increment(current, undefined, context);
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* @description Generates a range of sequential values
|
|
97
|
-
* @summary Retrieves a specified number of sequential values from the sequence.
|
|
98
|
-
* This is useful when you need to allocate multiple IDs at once.
|
|
99
|
-
* The method increments the sequence by the total amount needed and returns all values in the range.
|
|
100
|
-
* @param {number} count - The number of sequential values to generate
|
|
101
|
-
* @return A promise that resolves to an array of sequential values
|
|
102
|
-
*/
|
|
103
|
-
async range(count, ...argz) {
|
|
104
|
-
const contextArgs = await db_decorators_1.Context.args(db_decorators_1.OperationKeys.UPDATE, CouchDBSequence_1.Sequence, argz, this.adapter);
|
|
105
|
-
const { context, args } = contextArgs;
|
|
106
|
-
const current = (await this.current(...args));
|
|
107
|
-
const incrementBy = this.parse(this.options.incrementBy);
|
|
108
|
-
const next = await this.increment(current, this.parse(count) * incrementBy, context);
|
|
109
|
-
const range = [];
|
|
110
|
-
for (let i = 1; i <= count; i++) {
|
|
111
|
-
range.push(current + incrementBy * this.parse(i));
|
|
112
|
-
}
|
|
113
|
-
if (range[range.length - 1] !== next && this.options.type !== "String")
|
|
114
|
-
throw new db_decorators_1.InternalError("Miscalculation of range");
|
|
115
|
-
return range;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
exports.CouchDBSequence = CouchDBSequence;
|
|
119
|
-
//# sourceMappingURL=Sequence.js.map
|