@mbc-cqrs-serverless/sequence 0.1.34-beta.0 → 0.1.36-beta.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/constants/sequence.constant.d.ts +9 -0
- package/dist/constants/sequence.constant.js +9 -0
- package/dist/constants/sequence.constant.js.map +1 -0
- package/dist/dto/gen-sequence.dto.d.ts +31 -4
- package/dist/dto/gen-sequence.dto.js +51 -15
- package/dist/dto/gen-sequence.dto.js.map +1 -1
- package/dist/entities/sequence.entity.d.ts +7 -0
- package/dist/entities/sequence.entity.js +10 -0
- package/dist/entities/sequence.entity.js.map +1 -0
- package/dist/interfaces/sequence-service.interface.d.ts +23 -2
- package/dist/sequence-master-factory.d.ts +8 -0
- package/dist/sequence-master-factory.js +45 -0
- package/dist/sequence-master-factory.js.map +1 -0
- package/dist/sequence.module.js +10 -1
- package/dist/sequence.module.js.map +1 -1
- package/dist/sequences.service.d.ts +44 -5
- package/dist/sequences.service.js +129 -59
- package/dist/sequences.service.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_VALUE_MASTER_DATA = exports.DEFAULT_MASTER_DATA = void 0;
|
|
4
|
+
exports.DEFAULT_MASTER_DATA = Symbol('DEFAULT_MASTER_DATA');
|
|
5
|
+
exports.DEFAULT_VALUE_MASTER_DATA = {
|
|
6
|
+
typeCode: 'sequence',
|
|
7
|
+
format: '%%no%%',
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=sequence.constant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequence.constant.js","sourceRoot":"","sources":["../../src/constants/sequence.constant.ts"],"names":[],"mappings":";;;AAOa,QAAA,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAA;AAEnD,QAAA,yBAAyB,GAAmB;IACvD,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;CACjB,CAAA"}
|
|
@@ -1,18 +1,45 @@
|
|
|
1
1
|
import { RotateByEnum } from '../enums/rotate-by.enum';
|
|
2
2
|
export declare class SequenceParamsDto {
|
|
3
3
|
code1: string;
|
|
4
|
-
code2
|
|
4
|
+
code2?: string;
|
|
5
5
|
code3?: string;
|
|
6
6
|
code4?: string;
|
|
7
7
|
code5?: string;
|
|
8
8
|
constructor(partial: Partial<SequenceParamsDto>);
|
|
9
9
|
}
|
|
10
10
|
export declare class GenSequenceDto {
|
|
11
|
+
/**
|
|
12
|
+
* Date for sequence generation (optional).
|
|
13
|
+
*/
|
|
11
14
|
date?: Date;
|
|
15
|
+
/**
|
|
16
|
+
* Rotation criteria for the sequence (e.g., yearly, fiscal-yearly).
|
|
17
|
+
*/
|
|
12
18
|
rotateBy?: RotateByEnum;
|
|
19
|
+
/**
|
|
20
|
+
* Tenant code for identifying the organization.
|
|
21
|
+
*/
|
|
13
22
|
tenantCode: string;
|
|
23
|
+
/**
|
|
24
|
+
* Type code for specific sequence classification.
|
|
25
|
+
*/
|
|
26
|
+
typeCode: string;
|
|
27
|
+
}
|
|
28
|
+
export declare class GenerateFormattedSequenceDto {
|
|
29
|
+
/**
|
|
30
|
+
* Date for sequence generation (optional).
|
|
31
|
+
*/
|
|
32
|
+
date?: Date;
|
|
33
|
+
/**
|
|
34
|
+
* Rotation criteria for the sequence (e.g., yearly, fiscal-yearly).
|
|
35
|
+
*/
|
|
36
|
+
rotateBy?: RotateByEnum;
|
|
37
|
+
/**
|
|
38
|
+
* Tenant code for identifying the organization.
|
|
39
|
+
*/
|
|
40
|
+
tenantCode: string;
|
|
41
|
+
/**
|
|
42
|
+
* Type code for specific sequence classification.
|
|
43
|
+
*/
|
|
14
44
|
params: SequenceParamsDto;
|
|
15
|
-
format?: string;
|
|
16
|
-
startMonth?: number;
|
|
17
|
-
registerDate?: Date;
|
|
18
45
|
}
|
|
@@ -9,8 +9,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.GenSequenceDto = exports.SequenceParamsDto = void 0;
|
|
12
|
+
exports.GenerateFormattedSequenceDto = exports.GenSequenceDto = exports.SequenceParamsDto = void 0;
|
|
13
13
|
const swagger_1 = require("@nestjs/swagger");
|
|
14
|
+
const class_transformer_1 = require("class-transformer");
|
|
14
15
|
const class_validator_1 = require("class-validator");
|
|
15
16
|
const rotate_by_enum_1 = require("../enums/rotate-by.enum");
|
|
16
17
|
class SequenceParamsDto {
|
|
@@ -25,6 +26,7 @@ __decorate([
|
|
|
25
26
|
], SequenceParamsDto.prototype, "code1", void 0);
|
|
26
27
|
__decorate([
|
|
27
28
|
(0, class_validator_1.IsString)(),
|
|
29
|
+
(0, class_validator_1.IsOptional)(),
|
|
28
30
|
__metadata("design:type", String)
|
|
29
31
|
], SequenceParamsDto.prototype, "code2", void 0);
|
|
30
32
|
__decorate([
|
|
@@ -46,9 +48,18 @@ class GenSequenceDto {
|
|
|
46
48
|
}
|
|
47
49
|
exports.GenSequenceDto = GenSequenceDto;
|
|
48
50
|
__decorate([
|
|
49
|
-
(0, class_validator_1.IsString)(),
|
|
50
51
|
(0, class_validator_1.IsOptional)(),
|
|
51
|
-
|
|
52
|
+
(0, class_transformer_1.Type)(() => Date),
|
|
53
|
+
(0, swagger_1.ApiProperty)({
|
|
54
|
+
type: Date,
|
|
55
|
+
required: false,
|
|
56
|
+
description: 'Date for sequence generation.',
|
|
57
|
+
}),
|
|
58
|
+
__metadata("design:type", Date
|
|
59
|
+
/**
|
|
60
|
+
* Rotation criteria for the sequence (e.g., yearly, fiscal-yearly).
|
|
61
|
+
*/
|
|
62
|
+
)
|
|
52
63
|
], GenSequenceDto.prototype, "date", void 0);
|
|
53
64
|
__decorate([
|
|
54
65
|
(0, swagger_1.ApiProperty)({ enum: rotate_by_enum_1.RotateByEnum, example: rotate_by_enum_1.RotateByEnum.FISCAL_YEARLY }),
|
|
@@ -58,25 +69,50 @@ __decorate([
|
|
|
58
69
|
], GenSequenceDto.prototype, "rotateBy", void 0);
|
|
59
70
|
__decorate([
|
|
60
71
|
(0, class_validator_1.IsString)(),
|
|
72
|
+
(0, swagger_1.ApiProperty)({ description: 'Code of the tenant (organization).' }),
|
|
61
73
|
__metadata("design:type", String)
|
|
62
74
|
], GenSequenceDto.prototype, "tenantCode", void 0);
|
|
63
|
-
__decorate([
|
|
64
|
-
(0, class_validator_1.IsObject)(),
|
|
65
|
-
__metadata("design:type", SequenceParamsDto)
|
|
66
|
-
], GenSequenceDto.prototype, "params", void 0);
|
|
67
75
|
__decorate([
|
|
68
76
|
(0, class_validator_1.IsString)(),
|
|
69
|
-
(0,
|
|
77
|
+
(0, swagger_1.ApiProperty)({
|
|
78
|
+
required: true,
|
|
79
|
+
description: 'Type code for specific classification.',
|
|
80
|
+
}),
|
|
70
81
|
__metadata("design:type", String)
|
|
71
|
-
], GenSequenceDto.prototype, "
|
|
82
|
+
], GenSequenceDto.prototype, "typeCode", void 0);
|
|
83
|
+
class GenerateFormattedSequenceDto {
|
|
84
|
+
}
|
|
85
|
+
exports.GenerateFormattedSequenceDto = GenerateFormattedSequenceDto;
|
|
72
86
|
__decorate([
|
|
73
|
-
(0, class_validator_1.IsNumber)(),
|
|
74
87
|
(0, class_validator_1.IsOptional)(),
|
|
75
|
-
|
|
76
|
-
|
|
88
|
+
(0, class_transformer_1.Type)(() => Date),
|
|
89
|
+
(0, swagger_1.ApiProperty)({
|
|
90
|
+
type: Date,
|
|
91
|
+
required: false,
|
|
92
|
+
description: 'Date for sequence generation.',
|
|
93
|
+
}),
|
|
94
|
+
__metadata("design:type", Date
|
|
95
|
+
/**
|
|
96
|
+
* Rotation criteria for the sequence (e.g., yearly, fiscal-yearly).
|
|
97
|
+
*/
|
|
98
|
+
)
|
|
99
|
+
], GenerateFormattedSequenceDto.prototype, "date", void 0);
|
|
77
100
|
__decorate([
|
|
78
|
-
(0,
|
|
101
|
+
(0, swagger_1.ApiProperty)({ enum: rotate_by_enum_1.RotateByEnum, example: rotate_by_enum_1.RotateByEnum.FISCAL_YEARLY }),
|
|
79
102
|
(0, class_validator_1.IsOptional)(),
|
|
80
|
-
|
|
81
|
-
|
|
103
|
+
(0, class_validator_1.IsEnum)(rotate_by_enum_1.RotateByEnum),
|
|
104
|
+
__metadata("design:type", String)
|
|
105
|
+
], GenerateFormattedSequenceDto.prototype, "rotateBy", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, class_validator_1.IsString)(),
|
|
108
|
+
__metadata("design:type", String)
|
|
109
|
+
], GenerateFormattedSequenceDto.prototype, "tenantCode", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, class_validator_1.IsObject)(),
|
|
112
|
+
(0, swagger_1.ApiProperty)({
|
|
113
|
+
type: SequenceParamsDto,
|
|
114
|
+
description: 'Parameters for generating the sequence. code1, code2,code3, code4, code5',
|
|
115
|
+
}),
|
|
116
|
+
__metadata("design:type", SequenceParamsDto)
|
|
117
|
+
], GenerateFormattedSequenceDto.prototype, "params", void 0);
|
|
82
118
|
//# sourceMappingURL=gen-sequence.dto.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gen-sequence.dto.js","sourceRoot":"","sources":["../../src/dto/gen-sequence.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA6C;AAC7C,
|
|
1
|
+
{"version":3,"file":"gen-sequence.dto.js","sourceRoot":"","sources":["../../src/dto/gen-sequence.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6CAA6C;AAC7C,yDAAwC;AACxC,qDAAwE;AAExE,4DAAsD;AAEtD,MAAa,iBAAiB;IAsB5B,YAAY,OAAmC;QAC7C,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CA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W,EAAE,+BAA+B;KAC7C,CAAC;8BACK,IAAI;IAEX;;OAEG;;0DAJQ;AAQX;IAHC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,6BAAY,EAAE,OAAO,EAAE,6BAAY,CAAC,aAAa,EAAE,CAAC;IACxE,IAAA,4BAAU,GAAE;IACZ,IAAA,wBAAM,EAAC,6BAAY,CAAC;;8DACE;AAMvB;IADC,IAAA,0BAAQ,GAAE;;gEACO;AAWlB;IANC,IAAA,0BAAQ,GAAE;IACV,IAAA,qBAAW,EAAC;QACX,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,0EAA0E;KAC7E,CAAC;8BACM,iBAAiB;4DAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SequenceEntity = void 0;
|
|
4
|
+
class SequenceEntity {
|
|
5
|
+
constructor(partial) {
|
|
6
|
+
Object.assign(this, partial);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.SequenceEntity = SequenceEntity;
|
|
10
|
+
//# sourceMappingURL=sequence.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequence.entity.js","sourceRoot":"","sources":["../../src/entities/sequence.entity.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAc;IAMzB,YAAY,OAAgC;QAC1C,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IAC9B,CAAC;CACF;AATD,wCASC"}
|
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
import { DataEntity, DetailKey, IInvoke } from '@mbc-cqrs-serverless/core';
|
|
2
|
-
import { GenSequenceDto } from '../dto/gen-sequence.dto';
|
|
2
|
+
import { GenerateFormattedSequenceDto, GenSequenceDto } from '../dto/gen-sequence.dto';
|
|
3
|
+
import { SequenceEntity } from '../entities/sequence.entity';
|
|
3
4
|
export interface ISequenceService {
|
|
5
|
+
/**
|
|
6
|
+
* Get the current sequence by a specific key.
|
|
7
|
+
* @param key - The key to identify the sequence details.
|
|
8
|
+
* @returns A promise that resolves to the current sequence's data entity.
|
|
9
|
+
*/
|
|
4
10
|
getCurrentSequence(key: DetailKey): Promise<DataEntity>;
|
|
5
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Generate a new sequence based on the provided parameters.
|
|
13
|
+
* @param dto - The data transfer object containing generation parameters.
|
|
14
|
+
* @param opts - Additional options including invocation context.
|
|
15
|
+
* @returns A promise that resolves to the newly generated sequence's data entity.
|
|
16
|
+
*/
|
|
17
|
+
genNewSequence(dto: GenSequenceDto, options: {
|
|
6
18
|
invokeContext: IInvoke;
|
|
7
19
|
}): Promise<DataEntity>;
|
|
20
|
+
/**
|
|
21
|
+
* Generate a new sequence with a specified format.
|
|
22
|
+
* @param dto - The data transfer object containing parameters for formatted sequence generation.
|
|
23
|
+
* @param opts - Additional options including invocation context.
|
|
24
|
+
* @returns A promise that resolves to the newly generated formatted sequence's data entity.
|
|
25
|
+
*/
|
|
26
|
+
generateSequenceItem(dto: GenerateFormattedSequenceDto, options: {
|
|
27
|
+
invokeContext: IInvoke;
|
|
28
|
+
}): Promise<SequenceEntity>;
|
|
8
29
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DetailKey, DynamoDbService, IMasterDataProvider } from '@mbc-cqrs-serverless/core';
|
|
2
|
+
export declare class SequenceMasterDataProvider implements IMasterDataProvider {
|
|
3
|
+
private readonly dynamoDbService;
|
|
4
|
+
private readonly defaultValue;
|
|
5
|
+
private tableName;
|
|
6
|
+
constructor(dynamoDbService: DynamoDbService, defaultValue: Record<string, any>);
|
|
7
|
+
getData(key: DetailKey): Promise<any>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.SequenceMasterDataProvider = void 0;
|
|
16
|
+
const core_1 = require("@mbc-cqrs-serverless/core");
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const sequence_constant_1 = require("./constants/sequence.constant");
|
|
19
|
+
(0, common_1.Injectable)();
|
|
20
|
+
let SequenceMasterDataProvider = class SequenceMasterDataProvider {
|
|
21
|
+
constructor(dynamoDbService, defaultValue) {
|
|
22
|
+
this.dynamoDbService = dynamoDbService;
|
|
23
|
+
this.defaultValue = defaultValue;
|
|
24
|
+
this.tableName = dynamoDbService.getTableName('master', 'data');
|
|
25
|
+
}
|
|
26
|
+
async getData(key) {
|
|
27
|
+
try {
|
|
28
|
+
const item = await this.dynamoDbService.getItem(this.tableName, key);
|
|
29
|
+
if (!item) {
|
|
30
|
+
return this.defaultValue;
|
|
31
|
+
}
|
|
32
|
+
return item;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return this.defaultValue;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
exports.SequenceMasterDataProvider = SequenceMasterDataProvider;
|
|
40
|
+
exports.SequenceMasterDataProvider = SequenceMasterDataProvider = __decorate([
|
|
41
|
+
__param(1, (0, common_1.Inject)(sequence_constant_1.DEFAULT_MASTER_DATA)),
|
|
42
|
+
__param(1, (0, common_1.Optional)()),
|
|
43
|
+
__metadata("design:paramtypes", [core_1.DynamoDbService, Object])
|
|
44
|
+
], SequenceMasterDataProvider);
|
|
45
|
+
//# sourceMappingURL=sequence-master-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequence-master-factory.js","sourceRoot":"","sources":["../src/sequence-master-factory.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAIkC;AAClC,2CAA6D;AAE7D,qEAAmE;AAEnE,IAAA,mBAAU,GAAE,CAAA;AACZ,IAAa,0BAA0B,GAAvC,MAAa,0BAA0B;IAErC,YACmB,eAAgC,EAGhC,YAAiC;QAHjC,oBAAe,GAAf,eAAe,CAAiB;QAGhC,iBAAY,GAAZ,YAAY,CAAqB;QAElD,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;IACjE,CAAC;IACD,KAAK,CAAC,OAAO,CAAC,GAAc;QAC1B,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;YACpE,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,OAAO,IAAI,CAAC,YAAY,CAAA;YAC1B,CAAC;YACD,OAAO,IAAI,CAAA;QACb,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,CAAC,YAAY,CAAA;QAC1B,CAAC;IACH,CAAC;CACF,CAAA;AArBY,gEAA0B;qCAA1B,0BAA0B;IAIlC,WAAA,IAAA,eAAM,EAAC,uCAAmB,CAAC,CAAA;IAC3B,WAAA,IAAA,iBAAQ,GAAE,CAAA;qCAFuB,sBAAe;GAHxC,0BAA0B,CAqBtC"}
|
package/dist/sequence.module.js
CHANGED
|
@@ -9,6 +9,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.SequencesModule = void 0;
|
|
10
10
|
const core_1 = require("@mbc-cqrs-serverless/core");
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
|
12
|
+
const sequence_constant_1 = require("./constants/sequence.constant");
|
|
13
|
+
const sequence_master_factory_1 = require("./sequence-master-factory");
|
|
12
14
|
const sequences_controller_1 = require("./sequences.controller");
|
|
13
15
|
const sequences_module_definition_1 = require("./sequences.module-definition");
|
|
14
16
|
const sequences_service_1 = require("./sequences.service");
|
|
@@ -30,7 +32,14 @@ exports.SequencesModule = SequencesModule;
|
|
|
30
32
|
exports.SequencesModule = SequencesModule = __decorate([
|
|
31
33
|
(0, common_1.Module)({
|
|
32
34
|
imports: [core_1.DataStoreModule],
|
|
33
|
-
providers: [
|
|
35
|
+
providers: [
|
|
36
|
+
sequences_service_1.SequencesService,
|
|
37
|
+
sequence_master_factory_1.SequenceMasterDataProvider,
|
|
38
|
+
{
|
|
39
|
+
provide: sequence_constant_1.DEFAULT_MASTER_DATA,
|
|
40
|
+
useValue: sequence_constant_1.DEFAULT_VALUE_MASTER_DATA,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
34
43
|
exports: [sequences_service_1.SequencesService],
|
|
35
44
|
})
|
|
36
45
|
], SequencesModule);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequence.module.js","sourceRoot":"","sources":["../src/sequence.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAA2D;AAC3D,2CAAsD;AAEtD,iEAA4D;AAC5D,+EAGsC;AACtC,2DAAsD;
|
|
1
|
+
{"version":3,"file":"sequence.module.js","sourceRoot":"","sources":["../src/sequence.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAA2D;AAC3D,2CAAsD;AAEtD,qEAGsC;AACtC,uEAAsE;AACtE,iEAA4D;AAC5D,+EAGsC;AACtC,2DAAsD;AAc/C,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,qDAAuB;IAC1D,MAAM,CAAC,QAAQ,CAAC,OAA4B;QAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAEtC,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;gBACxB,MAAM,CAAC,WAAW,GAAG,EAAE,CAAA;YACzB,CAAC;YACD,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,0CAAmB,CAAC,CAAA;QAC9C,CAAC;QAED,OAAO;YACL,GAAG,MAAM;SACV,CAAA;IACH,CAAC;CACF,CAAA;AAfY,0CAAe;0BAAf,eAAe;IAZ3B,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,sBAAe,CAAC;QAC1B,SAAS,EAAE;YACT,oCAAgB;YAChB,oDAA0B;YAC1B;gBACE,OAAO,EAAE,uCAAmB;gBAC5B,QAAQ,EAAE,6CAAyB;aACpC;SACF;QACD,OAAO,EAAE,CAAC,oCAAgB,CAAC;KAC5B,CAAC;GACW,eAAe,CAe3B"}
|
|
@@ -1,28 +1,67 @@
|
|
|
1
1
|
import { DataEntity, DetailKey, DynamoDbService, IInvoke } from '@mbc-cqrs-serverless/core';
|
|
2
|
-
import { GenSequenceDto, SequenceParamsDto } from './dto/gen-sequence.dto';
|
|
2
|
+
import { GenerateFormattedSequenceDto, GenSequenceDto, SequenceParamsDto } from './dto/gen-sequence.dto';
|
|
3
|
+
import { SequenceEntity } from './entities/sequence.entity';
|
|
3
4
|
import { RotateByEnum } from './enums/rotate-by.enum';
|
|
4
5
|
import { FiscalYearOptions } from './interfaces/fiscal-year.interface';
|
|
5
6
|
import { ISequenceService } from './interfaces/sequence-service.interface';
|
|
7
|
+
import { SequenceMasterDataProvider } from './sequence-master-factory';
|
|
6
8
|
export declare class SequencesService implements ISequenceService {
|
|
7
9
|
private readonly dynamoDbService;
|
|
10
|
+
private readonly masterDataProvider;
|
|
8
11
|
private readonly logger;
|
|
9
12
|
private readonly tableName;
|
|
10
|
-
constructor(dynamoDbService: DynamoDbService);
|
|
13
|
+
constructor(dynamoDbService: DynamoDbService, masterDataProvider: SequenceMasterDataProvider);
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated This method is deprecated at V0.2.
|
|
16
|
+
*/
|
|
11
17
|
getCurrentSequence(key: DetailKey): Promise<DataEntity>;
|
|
12
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated This method is deprecated at V0.2.
|
|
20
|
+
* Seq data structure
|
|
21
|
+
* - pk: SEQ#tenantCode
|
|
22
|
+
* - sk: typeCode#rotateValue ( e.x: `user#20230401` )
|
|
23
|
+
* - code: typeCode#rotateValue
|
|
24
|
+
* - name: rotateBy ( e.x: `daily` )
|
|
25
|
+
* - tenant_code: tenantCode
|
|
26
|
+
* - type: typeCode
|
|
27
|
+
* - seq: sequence value ( atomic counter )
|
|
28
|
+
*/
|
|
29
|
+
genNewSequence(dto: GenSequenceDto, options: {
|
|
13
30
|
invokeContext: IInvoke;
|
|
14
31
|
}): Promise<DataEntity>;
|
|
32
|
+
/**
|
|
33
|
+
* Seq data structure
|
|
34
|
+
* - pk: SEQ#tenantCode
|
|
35
|
+
* - sk: typeCode#code1#code2#code3#code4#code5rotateValue ( e.x: `user#20230401` )
|
|
36
|
+
* - code: typeCode#rotateValue
|
|
37
|
+
* - name: rotateBy ( e.x: `daily` )
|
|
38
|
+
* - tenant_code: tenantCode
|
|
39
|
+
* - type: typeCode
|
|
40
|
+
* - seq: sequence value ( atomic counter )
|
|
41
|
+
* - requestId: requestId
|
|
42
|
+
* - createdAt: createdAt
|
|
43
|
+
* - createdBy: createdBy
|
|
44
|
+
* - createdIp: createdIp
|
|
45
|
+
* - attributes: {
|
|
46
|
+
* formatted_no: formattedNo ( e.x: `2023-04-01-0001` )
|
|
47
|
+
* fiscal_year: fiscalYear
|
|
48
|
+
* issued_at: issuedAt
|
|
49
|
+
* }
|
|
50
|
+
*/
|
|
51
|
+
generateSequenceItem(dto: GenerateFormattedSequenceDto, options: {
|
|
52
|
+
invokeContext: IInvoke;
|
|
53
|
+
}): Promise<SequenceEntity>;
|
|
15
54
|
getRotateValue(rotateBy?: RotateByEnum, forDate?: Date): string;
|
|
16
55
|
isIncrementNo(rotateBy: RotateByEnum | undefined, nowFiscalYear: number, fiscalYear: number, issuedAt: Date): boolean;
|
|
17
56
|
getFiscalYear(options: FiscalYearOptions): number;
|
|
18
|
-
createFormatDict(
|
|
57
|
+
createFormatDict(fiscalYear: number, fixNo: number, now: Date, sequenceParams?: SequenceParamsDto): {
|
|
19
58
|
fiscal_year: number;
|
|
20
59
|
no: number;
|
|
21
60
|
month: number;
|
|
22
61
|
day: number;
|
|
23
62
|
date: Date;
|
|
24
63
|
code1: string;
|
|
25
|
-
code2
|
|
64
|
+
code2?: string;
|
|
26
65
|
code3?: string;
|
|
27
66
|
code4?: string;
|
|
28
67
|
code5?: string;
|
|
@@ -13,26 +13,100 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.SequencesService = void 0;
|
|
14
14
|
const core_1 = require("@mbc-cqrs-serverless/core");
|
|
15
15
|
const common_1 = require("@nestjs/common");
|
|
16
|
+
const sequence_entity_1 = require("./entities/sequence.entity");
|
|
16
17
|
const rotate_by_enum_1 = require("./enums/rotate-by.enum");
|
|
18
|
+
const sequence_master_factory_1 = require("./sequence-master-factory");
|
|
17
19
|
let SequencesService = SequencesService_1 = class SequencesService {
|
|
18
|
-
constructor(dynamoDbService) {
|
|
20
|
+
constructor(dynamoDbService, masterDataProvider) {
|
|
19
21
|
this.dynamoDbService = dynamoDbService;
|
|
22
|
+
this.masterDataProvider = masterDataProvider;
|
|
20
23
|
this.logger = new common_1.Logger(SequencesService_1.name);
|
|
21
24
|
this.tableName = dynamoDbService.getTableName('sequences');
|
|
22
25
|
this.logger.debug('tableName: ' + this.tableName);
|
|
23
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated This method is deprecated at V0.2.
|
|
29
|
+
*/
|
|
24
30
|
async getCurrentSequence(key) {
|
|
25
31
|
return await this.dynamoDbService.getItem(this.tableName, key);
|
|
26
32
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated This method is deprecated at V0.2.
|
|
35
|
+
* Seq data structure
|
|
36
|
+
* - pk: SEQ#tenantCode
|
|
37
|
+
* - sk: typeCode#rotateValue ( e.x: `user#20230401` )
|
|
38
|
+
* - code: typeCode#rotateValue
|
|
39
|
+
* - name: rotateBy ( e.x: `daily` )
|
|
40
|
+
* - tenant_code: tenantCode
|
|
41
|
+
* - type: typeCode
|
|
42
|
+
* - seq: sequence value ( atomic counter )
|
|
43
|
+
*/
|
|
44
|
+
async genNewSequence(dto, options) {
|
|
45
|
+
const rotateVal = this.getRotateValue(dto.rotateBy, dto.date);
|
|
46
|
+
const pk = `SEQ${core_1.KEY_SEPARATOR}${dto.tenantCode}`;
|
|
47
|
+
const sk = `${dto.typeCode}${core_1.KEY_SEPARATOR}${rotateVal}`;
|
|
48
|
+
const sourceIp = options.invokeContext?.event?.requestContext?.http?.sourceIp;
|
|
49
|
+
const userContext = (0, core_1.getUserContext)(options.invokeContext);
|
|
50
|
+
const userId = userContext.userId || 'system';
|
|
51
|
+
const now = new Date();
|
|
52
|
+
const item = await this.dynamoDbService.updateItem(this.tableName, { pk, sk }, {
|
|
53
|
+
set: {
|
|
54
|
+
code: sk,
|
|
55
|
+
name: dto.rotateBy || 'none',
|
|
56
|
+
tenantCode: dto.tenantCode,
|
|
57
|
+
type: dto.typeCode,
|
|
58
|
+
seq: { ifNotExists: 0, incrementBy: 1 },
|
|
59
|
+
requestId: options.invokeContext?.context?.awsRequestId,
|
|
60
|
+
createdAt: { ifNotExists: now },
|
|
61
|
+
createdBy: { ifNotExists: userId },
|
|
62
|
+
createdIp: { ifNotExists: sourceIp },
|
|
63
|
+
updatedAt: now,
|
|
64
|
+
updatedBy: userId,
|
|
65
|
+
updatedIp: sourceIp,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
return item;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Seq data structure
|
|
72
|
+
* - pk: SEQ#tenantCode
|
|
73
|
+
* - sk: typeCode#code1#code2#code3#code4#code5rotateValue ( e.x: `user#20230401` )
|
|
74
|
+
* - code: typeCode#rotateValue
|
|
75
|
+
* - name: rotateBy ( e.x: `daily` )
|
|
76
|
+
* - tenant_code: tenantCode
|
|
77
|
+
* - type: typeCode
|
|
78
|
+
* - seq: sequence value ( atomic counter )
|
|
79
|
+
* - requestId: requestId
|
|
80
|
+
* - createdAt: createdAt
|
|
81
|
+
* - createdBy: createdBy
|
|
82
|
+
* - createdIp: createdIp
|
|
83
|
+
* - attributes: {
|
|
84
|
+
* formatted_no: formattedNo ( e.x: `2023-04-01-0001` )
|
|
85
|
+
* fiscal_year: fiscalYear
|
|
86
|
+
* issued_at: issuedAt
|
|
87
|
+
* }
|
|
88
|
+
*/
|
|
89
|
+
async generateSequenceItem(dto, options) {
|
|
90
|
+
const { date, rotateBy, tenantCode, params } = dto;
|
|
91
|
+
const generalMasterPk = (0, core_1.masterPk)(tenantCode);
|
|
92
|
+
const generalMasterSk = `SEQ${core_1.KEY_SEPARATOR}${params?.code1}`;
|
|
93
|
+
this.logger.log('general master pk: ', generalMasterPk);
|
|
94
|
+
this.logger.log('general master sk: ', generalMasterSk);
|
|
95
|
+
const masterData = await this.masterDataProvider.getData({
|
|
96
|
+
pk: generalMasterPk,
|
|
97
|
+
sk: generalMasterSk,
|
|
98
|
+
});
|
|
99
|
+
// Get master data for the tenant
|
|
100
|
+
const { format, typeCode, registerDate, startMonth } = masterData;
|
|
101
|
+
const pk = (0, core_1.seqPk)(tenantCode);
|
|
102
|
+
// Construct the sort key for the sequence
|
|
30
103
|
let sk = [
|
|
31
|
-
|
|
32
|
-
params
|
|
33
|
-
params
|
|
34
|
-
params
|
|
35
|
-
params
|
|
104
|
+
typeCode,
|
|
105
|
+
params?.code1,
|
|
106
|
+
params?.code2,
|
|
107
|
+
params?.code3,
|
|
108
|
+
params?.code4,
|
|
109
|
+
params?.code5,
|
|
36
110
|
]
|
|
37
111
|
.filter(Boolean)
|
|
38
112
|
.join(core_1.KEY_SEPARATOR);
|
|
@@ -43,70 +117,42 @@ let SequencesService = SequencesService_1 = class SequencesService {
|
|
|
43
117
|
registerTime: registerDate,
|
|
44
118
|
startMonth,
|
|
45
119
|
});
|
|
46
|
-
const sourceIp =
|
|
47
|
-
const userContext = (0, core_1.getUserContext)(
|
|
120
|
+
const sourceIp = options.invokeContext?.event?.requestContext?.http?.sourceIp;
|
|
121
|
+
const userContext = (0, core_1.getUserContext)(options.invokeContext);
|
|
48
122
|
const userId = userContext.userId || 'system';
|
|
49
|
-
const
|
|
123
|
+
const rotateVal = this.getRotateValue(rotateBy, date);
|
|
124
|
+
sk = `${sk}${core_1.KEY_SEPARATOR}${rotateVal}`;
|
|
125
|
+
const item = await this.dynamoDbService.updateItem(this.tableName, { pk, sk }, {
|
|
50
126
|
set: {
|
|
51
127
|
code: sk,
|
|
52
|
-
name: rotateBy || 'none',
|
|
53
|
-
tenantCode,
|
|
54
|
-
type:
|
|
55
|
-
seq,
|
|
56
|
-
requestId:
|
|
128
|
+
name: dto.rotateBy || 'none',
|
|
129
|
+
tenantCode: dto.tenantCode,
|
|
130
|
+
type: typeCode,
|
|
131
|
+
seq: { ifNotExists: 0, incrementBy: 1 },
|
|
132
|
+
requestId: options.invokeContext?.context?.awsRequestId,
|
|
57
133
|
createdAt: { ifNotExists: now },
|
|
58
134
|
createdBy: { ifNotExists: userId },
|
|
59
135
|
createdIp: { ifNotExists: sourceIp },
|
|
60
|
-
attributes: {
|
|
61
|
-
formatted_no: formattedNo,
|
|
62
|
-
fiscal_year: nowFiscalYear,
|
|
63
|
-
issued_at: issuedAt,
|
|
64
|
-
},
|
|
65
136
|
updatedAt: now,
|
|
66
137
|
updatedBy: userId,
|
|
67
138
|
updatedIp: sourceIp,
|
|
68
139
|
},
|
|
69
140
|
});
|
|
70
|
-
const
|
|
71
|
-
pk,
|
|
72
|
-
sk,
|
|
73
|
-
});
|
|
74
|
-
let fixNo = 0;
|
|
75
|
-
let rotateSequenceData = null;
|
|
76
|
-
if (date) {
|
|
77
|
-
const rotateSortKeyVal = this.getRotateValue(rotateBy, date);
|
|
78
|
-
rotateSequenceData = await this.dynamoDbService.getItem(this.tableName, {
|
|
79
|
-
pk,
|
|
80
|
-
sk: `${sk}${core_1.KEY_SEPARATOR}${rotateSortKeyVal}`,
|
|
81
|
-
});
|
|
82
|
-
fixNo = rotateSequenceData ? rotateSequenceData.seq + 1 : 1;
|
|
83
|
-
}
|
|
84
|
-
else if (!date) {
|
|
85
|
-
if (sequenceData) {
|
|
86
|
-
fixNo = this.isIncrementNo(rotateBy, nowFiscalYear, sequenceData.attributes.fiscal_year, new Date(sequenceData.issuedAt))
|
|
87
|
-
? sequenceData.seq + 1
|
|
88
|
-
: 1;
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
fixNo = 1;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
const formatDict = this.createFormatDict(params, nowFiscalYear, fixNo, date || now);
|
|
141
|
+
const formatDict = this.createFormatDict(nowFiscalYear, item.seq, date || now, { ...params });
|
|
95
142
|
const formattedNo = this.createFormattedNo(format, formatDict);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
return await this.dynamoDbService.updateItem(this.tableName, { pk, sk }, buildUpdateData(fixNo, formattedNo, sk));
|
|
143
|
+
return new sequence_entity_1.SequenceEntity({
|
|
144
|
+
id: (0, core_1.generateId)(item.pk, item.sk),
|
|
145
|
+
no: item.seq,
|
|
146
|
+
formattedNo: formattedNo,
|
|
147
|
+
issuedAt: new Date(issuedAt),
|
|
148
|
+
});
|
|
104
149
|
}
|
|
105
150
|
getRotateValue(rotateBy, forDate) {
|
|
106
151
|
const date = forDate || new Date();
|
|
107
152
|
switch (rotateBy) {
|
|
108
153
|
case rotate_by_enum_1.RotateByEnum.FISCAL_YEARLY:
|
|
109
154
|
const year = date.getFullYear();
|
|
155
|
+
// new fiscal year from April
|
|
110
156
|
return date.getMonth() < 3 ? (year - 1).toString() : year.toString();
|
|
111
157
|
case rotate_by_enum_1.RotateByEnum.YEARLY:
|
|
112
158
|
return date.getFullYear().toString();
|
|
@@ -122,20 +168,30 @@ let SequencesService = SequencesService_1 = class SequencesService {
|
|
|
122
168
|
}
|
|
123
169
|
}
|
|
124
170
|
isIncrementNo(rotateBy, nowFiscalYear, fiscalYear, issuedAt) {
|
|
171
|
+
/**
|
|
172
|
+
* Determine whether to increment the number (no)
|
|
173
|
+
* based on rotateBy. If rotateBy matches the fiscal year, year, or month,
|
|
174
|
+
* depending on the value, it will return true for incrementing.
|
|
175
|
+
*/
|
|
176
|
+
// If rotateBy is not provided, increment
|
|
125
177
|
if (!rotateBy) {
|
|
126
178
|
return true;
|
|
127
179
|
}
|
|
180
|
+
// Reset the number if fiscal year changes
|
|
128
181
|
if (rotateBy === rotate_by_enum_1.RotateByEnum.FISCAL_YEARLY) {
|
|
129
182
|
if (nowFiscalYear === fiscalYear) {
|
|
130
183
|
return true;
|
|
131
184
|
}
|
|
132
185
|
}
|
|
133
|
-
|
|
186
|
+
// Use the current date in Japan time (JST)
|
|
187
|
+
const nowDate = new Date(); // Assuming the server time is in JST
|
|
188
|
+
// Reset the number if year changes
|
|
134
189
|
if (rotateBy === rotate_by_enum_1.RotateByEnum.YEARLY) {
|
|
135
190
|
if (nowDate.getFullYear() === issuedAt.getFullYear()) {
|
|
136
191
|
return true;
|
|
137
192
|
}
|
|
138
193
|
}
|
|
194
|
+
// Reset the number if month changes
|
|
139
195
|
if (rotateBy === rotate_by_enum_1.RotateByEnum.MONTHLY) {
|
|
140
196
|
if (nowDate.getFullYear() === issuedAt.getFullYear()) {
|
|
141
197
|
if (nowDate.getMonth() === issuedAt.getMonth()) {
|
|
@@ -146,17 +202,30 @@ let SequencesService = SequencesService_1 = class SequencesService {
|
|
|
146
202
|
return false;
|
|
147
203
|
}
|
|
148
204
|
getFiscalYear(options) {
|
|
205
|
+
/**
|
|
206
|
+
* Calculates the fiscal year based on the provided `now` and `registerTime`.
|
|
207
|
+
*
|
|
208
|
+
* - If `registerTime` is provided, the fiscal year will be calculated starting from
|
|
209
|
+
* the month of the registration date (`registerTime`).
|
|
210
|
+
* - If `registerTime` is not provided, the fiscal year will start from the `startMonth` (default is April).
|
|
211
|
+
*
|
|
212
|
+
* The fiscal year calculation considers the following:
|
|
213
|
+
* - The default start month is April (month 4).
|
|
214
|
+
* - The reference year for the fiscal year calculation is 1953.
|
|
215
|
+
*/
|
|
149
216
|
const { now, startMonth = 4, registerTime } = options;
|
|
150
217
|
const effectiveStartMonth = registerTime
|
|
151
218
|
? registerTime.getMonth() + 1
|
|
152
219
|
: startMonth ?? 4;
|
|
153
|
-
const referenceYear = registerTime ? registerTime.getFullYear() : 1953;
|
|
220
|
+
const referenceYear = registerTime ? registerTime.getFullYear() : 1953; // Reference year
|
|
221
|
+
// Determine the current fiscal year
|
|
154
222
|
const fiscalYear = now.getMonth() + 1 < effectiveStartMonth
|
|
155
223
|
? now.getFullYear() - 1
|
|
156
224
|
: now.getFullYear();
|
|
225
|
+
// Return the fiscal year number starting from `referenceYear`
|
|
157
226
|
return fiscalYear - referenceYear + 1;
|
|
158
227
|
}
|
|
159
|
-
createFormatDict(
|
|
228
|
+
createFormatDict(fiscalYear, fixNo, now, sequenceParams) {
|
|
160
229
|
return {
|
|
161
230
|
...sequenceParams,
|
|
162
231
|
fiscal_year: fiscalYear,
|
|
@@ -206,6 +275,7 @@ let SequencesService = SequencesService_1 = class SequencesService {
|
|
|
206
275
|
exports.SequencesService = SequencesService;
|
|
207
276
|
exports.SequencesService = SequencesService = SequencesService_1 = __decorate([
|
|
208
277
|
(0, common_1.Injectable)(),
|
|
209
|
-
__metadata("design:paramtypes", [core_1.DynamoDbService
|
|
278
|
+
__metadata("design:paramtypes", [core_1.DynamoDbService,
|
|
279
|
+
sequence_master_factory_1.SequenceMasterDataProvider])
|
|
210
280
|
], SequencesService);
|
|
211
281
|
//# sourceMappingURL=sequences.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequences.service.js","sourceRoot":"","sources":["../src/sequences.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"sequences.service.js","sourceRoot":"","sources":["../src/sequences.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,oDAWkC;AAClC,2CAAmD;AAOnD,gEAA2D;AAC3D,2DAAqD;AAGrD,uEAAsE;AAG/D,IAAM,gBAAgB,wBAAtB,MAAM,gBAAgB;IAI3B,YACmB,eAAgC,EAChC,kBAA8C;QAD9C,oBAAe,GAAf,eAAe,CAAiB;QAChC,uBAAkB,GAAlB,kBAAkB,CAA4B;QALhD,WAAM,GAAG,IAAI,eAAM,CAAC,kBAAgB,CAAC,IAAI,CAAC,CAAA;QAOzD,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC,YAAY,CAAC,WAAW,CAAC,CAAA;QAC1D,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,CAAA;IACnD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CAAC,GAAc;QACrC,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,CAAA;IAChE,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,cAAc,CAClB,GAAmB,EACnB,OAEC;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE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W,UAAU,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAA;oBAEhD,MAAM,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;oBAExD,MAAM,YAAY,GAAG,KAAK,CAAC,QAAQ,CACjC,WAAW,CAAC,aAAa,EACzB,WAAW,CAAC,YAAY,CACzB,CAAA;oBAED,MAAM,IAAI,YAAY,CAAA;gBACxB,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,IAAI,CAAA;gBAChB,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;oBACrB,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAA;gBACvC,CAAC;qBAAM,CAAC;oBACN,MAAM,IAAI,IAAI,CAAA;gBAChB,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;IAED,kBAAkB,CAAC,GAAW;QAC5B,MAAM,KAAK,GAAG,YAAY,CAAA;QAC1B,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QAE9B,OAAO;YACL,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC;YACtB,aAAa,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;SACtC,CAAA;IACH,CAAC;CACF,CAAA;AA9UY,4CAAgB;2BAAhB,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAMyB,sBAAe;QACZ,oDAA0B;GANtD,gBAAgB,CA8U5B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbc-cqrs-serverless/sequence",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.36-beta.0",
|
|
4
4
|
"description": "Generate increment sequence with time-rotation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mbc",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@mbc-cqrs-serverless/core": "^0.1.
|
|
44
|
+
"@mbc-cqrs-serverless/core": "^0.1.36-beta.0"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "bfc35ea9dbac2cf0bab7a7dc73761d4a2b8af362"
|
|
47
47
|
}
|