@decaf-ts/for-fabric 0.1.16 → 0.1.18

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.
Files changed (146) hide show
  1. package/dist/for-fabric.cjs +1 -1
  2. package/dist/for-fabric.cjs.map +1 -1
  3. package/dist/for-fabric.js +1 -1
  4. package/dist/for-fabric.js.map +1 -1
  5. package/lib/bin/build-contracts2.cjs +73 -0
  6. package/lib/bin/build-contracts2.d.ts +1 -0
  7. package/lib/bin/build-contracts2.js.map +1 -0
  8. package/lib/bin/compile-indexes.cjs +30 -0
  9. package/lib/bin/compile-indexes.d.ts +1 -0
  10. package/lib/bin/compile-indexes.js.map +1 -0
  11. package/lib/cli-module.cjs +139 -0
  12. package/lib/cli-module.d.ts +2 -0
  13. package/lib/cli-module.js.map +1 -0
  14. package/lib/client/FabricClientAdapter.cjs +39 -40
  15. package/lib/client/FabricClientAdapter.d.ts +17 -13
  16. package/lib/client/FabricClientAdapter.js.map +1 -1
  17. package/lib/client/FabricClientPaginator.cjs +69 -0
  18. package/lib/client/FabricClientPaginator.d.ts +10 -0
  19. package/lib/client/FabricClientPaginator.js.map +1 -0
  20. package/lib/client/FabricClientRepository.cjs +36 -12
  21. package/lib/client/FabricClientRepository.d.ts +5 -1
  22. package/lib/client/FabricClientRepository.js.map +1 -1
  23. package/lib/client/FabricClientStatement.cjs +111 -0
  24. package/lib/client/FabricClientStatement.d.ts +10 -0
  25. package/lib/client/FabricClientStatement.js.map +1 -0
  26. package/lib/client/fabric-fs.d.ts +1 -1
  27. package/lib/client/indexes/generation.cjs +156 -0
  28. package/lib/client/indexes/generation.d.ts +16 -0
  29. package/lib/client/indexes/generation.js.map +1 -0
  30. package/lib/client/indexes/index.cjs +18 -0
  31. package/lib/client/indexes/index.d.ts +1 -0
  32. package/lib/client/indexes/index.js.map +1 -0
  33. package/lib/client/services/FabricEnrollmentService.d.ts +1 -1
  34. package/lib/client/types.cjs +3 -0
  35. package/lib/client/types.d.ts +7 -0
  36. package/lib/client/types.js.map +1 -0
  37. package/lib/contracts/ContractAdapter.cjs +54 -44
  38. package/lib/contracts/ContractAdapter.d.ts +20 -9
  39. package/lib/contracts/ContractAdapter.js.map +1 -1
  40. package/lib/contracts/ContractPrivateDataAdapter.cjs +0 -5
  41. package/lib/contracts/ContractPrivateDataAdapter.js.map +1 -1
  42. package/lib/contracts/FabricContractRepository.d.ts +2 -2
  43. package/lib/contracts/FabricContractRepository.js.map +1 -1
  44. package/lib/contracts/crud/crud-contract.cjs +30 -1
  45. package/lib/contracts/crud/crud-contract.d.ts +29 -14
  46. package/lib/contracts/crud/crud-contract.js.map +1 -1
  47. package/lib/contracts/crud/serialized-crud-contract.cjs +27 -15
  48. package/lib/contracts/crud/serialized-crud-contract.d.ts +9 -8
  49. package/lib/contracts/crud/serialized-crud-contract.js.map +1 -1
  50. package/lib/contracts/erc20/erc20contract.cjs +40 -34
  51. package/lib/contracts/erc20/erc20contract.d.ts +15 -15
  52. package/lib/contracts/erc20/erc20contract.js.map +1 -1
  53. package/lib/contracts/index.cjs +1 -2
  54. package/lib/contracts/index.d.ts +1 -2
  55. package/lib/contracts/index.js.map +1 -1
  56. package/lib/esm/bin/build-contracts2.d.ts +1 -0
  57. package/lib/esm/bin/build-contracts2.js +68 -0
  58. package/lib/esm/bin/build-contracts2.js.map +1 -0
  59. package/lib/esm/bin/compile-indexes.d.ts +1 -0
  60. package/lib/esm/bin/compile-indexes.js +25 -0
  61. package/lib/esm/bin/compile-indexes.js.map +1 -0
  62. package/lib/esm/cli-module.d.ts +2 -0
  63. package/lib/esm/cli-module.js +133 -0
  64. package/lib/esm/cli-module.js.map +1 -0
  65. package/lib/esm/client/FabricClientAdapter.d.ts +17 -13
  66. package/lib/esm/client/FabricClientAdapter.js +41 -42
  67. package/lib/esm/client/FabricClientAdapter.js.map +1 -1
  68. package/lib/esm/client/FabricClientPaginator.d.ts +10 -0
  69. package/lib/esm/client/FabricClientPaginator.js +65 -0
  70. package/lib/esm/client/FabricClientPaginator.js.map +1 -0
  71. package/lib/esm/client/FabricClientRepository.d.ts +5 -1
  72. package/lib/esm/client/FabricClientRepository.js +37 -13
  73. package/lib/esm/client/FabricClientRepository.js.map +1 -1
  74. package/lib/esm/client/FabricClientStatement.d.ts +10 -0
  75. package/lib/esm/client/FabricClientStatement.js +107 -0
  76. package/lib/esm/client/FabricClientStatement.js.map +1 -0
  77. package/lib/esm/client/fabric-fs.d.ts +1 -1
  78. package/lib/esm/client/indexes/generation.d.ts +16 -0
  79. package/lib/esm/client/indexes/generation.js +118 -0
  80. package/lib/esm/client/indexes/generation.js.map +1 -0
  81. package/lib/esm/client/indexes/index.d.ts +1 -0
  82. package/lib/esm/client/indexes/index.js +2 -0
  83. package/lib/esm/client/indexes/index.js.map +1 -0
  84. package/lib/esm/client/services/FabricEnrollmentService.d.ts +1 -1
  85. package/lib/esm/client/types.d.ts +7 -0
  86. package/lib/esm/client/types.js +2 -0
  87. package/lib/esm/client/types.js.map +1 -0
  88. package/lib/esm/contracts/ContractAdapter.d.ts +20 -9
  89. package/lib/esm/contracts/ContractAdapter.js +55 -45
  90. package/lib/esm/contracts/ContractAdapter.js.map +1 -1
  91. package/lib/esm/contracts/ContractPrivateDataAdapter.js +0 -5
  92. package/lib/esm/contracts/ContractPrivateDataAdapter.js.map +1 -1
  93. package/lib/esm/contracts/FabricContractRepository.d.ts +2 -2
  94. package/lib/esm/contracts/FabricContractRepository.js.map +1 -1
  95. package/lib/esm/contracts/crud/crud-contract.d.ts +29 -14
  96. package/lib/esm/contracts/crud/crud-contract.js +31 -2
  97. package/lib/esm/contracts/crud/crud-contract.js.map +1 -1
  98. package/lib/esm/contracts/crud/serialized-crud-contract.d.ts +9 -8
  99. package/lib/esm/contracts/crud/serialized-crud-contract.js +27 -15
  100. package/lib/esm/contracts/crud/serialized-crud-contract.js.map +1 -1
  101. package/lib/esm/contracts/erc20/erc20contract.d.ts +15 -15
  102. package/lib/esm/contracts/erc20/erc20contract.js +40 -34
  103. package/lib/esm/contracts/erc20/erc20contract.js.map +1 -1
  104. package/lib/esm/contracts/index.d.ts +1 -2
  105. package/lib/esm/contracts/index.js +1 -2
  106. package/lib/esm/contracts/index.js.map +1 -1
  107. package/lib/esm/shared/model/FabricBaseModel.d.ts +7 -0
  108. package/lib/esm/shared/model/FabricBaseModel.js +40 -0
  109. package/lib/esm/shared/model/FabricBaseModel.js.map +1 -0
  110. package/lib/esm/shared/model/FabricIdentifiedBaseModel.d.ts +7 -0
  111. package/lib/esm/shared/model/{Sequence.js → FabricIdentifiedBaseModel.js} +19 -18
  112. package/lib/esm/shared/model/FabricIdentifiedBaseModel.js.map +1 -0
  113. package/lib/esm/shared/model/Identity.js +2 -1
  114. package/lib/esm/shared/model/Identity.js.map +1 -1
  115. package/lib/esm/shared/model/index.d.ts +0 -1
  116. package/lib/esm/shared/model/index.js +0 -1
  117. package/lib/esm/shared/model/index.js.map +1 -1
  118. package/lib/esm/shared/utils.d.ts +1 -1
  119. package/lib/esm/version.d.ts +1 -1
  120. package/lib/esm/version.js +1 -1
  121. package/lib/shared/model/FabricBaseModel.cjs +43 -0
  122. package/lib/shared/model/FabricBaseModel.d.ts +7 -0
  123. package/lib/shared/model/FabricBaseModel.js.map +1 -0
  124. package/lib/shared/model/FabricIdentifiedBaseModel.cjs +37 -0
  125. package/lib/shared/model/FabricIdentifiedBaseModel.d.ts +7 -0
  126. package/lib/shared/model/FabricIdentifiedBaseModel.js.map +1 -0
  127. package/lib/shared/model/Identity.cjs +1 -0
  128. package/lib/shared/model/Identity.js.map +1 -1
  129. package/lib/shared/model/index.cjs +0 -1
  130. package/lib/shared/model/index.d.ts +0 -1
  131. package/lib/shared/model/index.js.map +1 -1
  132. package/lib/shared/utils.d.ts +1 -1
  133. package/lib/version.cjs +1 -1
  134. package/lib/version.d.ts +1 -1
  135. package/package.json +10 -6
  136. package/lib/contracts/FabricContractSequence.cjs +0 -119
  137. package/lib/contracts/FabricContractSequence.d.ts +0 -50
  138. package/lib/contracts/FabricContractSequence.js.map +0 -1
  139. package/lib/esm/contracts/FabricContractSequence.d.ts +0 -50
  140. package/lib/esm/contracts/FabricContractSequence.js +0 -115
  141. package/lib/esm/contracts/FabricContractSequence.js.map +0 -1
  142. package/lib/esm/shared/model/Sequence.d.ts +0 -14
  143. package/lib/esm/shared/model/Sequence.js.map +0 -1
  144. package/lib/shared/model/Sequence.cjs +0 -36
  145. package/lib/shared/model/Sequence.d.ts +0 -14
  146. package/lib/shared/model/Sequence.js.map +0 -1
@@ -0,0 +1,43 @@
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.FabricBaseModel = void 0;
13
+ const decorator_validation_1 = require("@decaf-ts/decorator-validation");
14
+ const core_1 = require("@decaf-ts/core");
15
+ const db_decorators_1 = require("@decaf-ts/db-decorators");
16
+ const decoration_1 = require("@decaf-ts/decoration");
17
+ const constants_1 = require("./../constants.cjs");
18
+ let FabricBaseModel = class FabricBaseModel extends decorator_validation_1.Model {
19
+ constructor(arg) {
20
+ super(arg);
21
+ }
22
+ };
23
+ exports.FabricBaseModel = FabricBaseModel;
24
+ __decorate([
25
+ (0, decoration_1.description)("Stores the original timestamp of creation"),
26
+ (0, core_1.createdAt)(),
27
+ __metadata("design:type", Date)
28
+ ], FabricBaseModel.prototype, "createdAt", void 0);
29
+ __decorate([
30
+ (0, decoration_1.description)("Stores the timestamp of the last update"),
31
+ (0, core_1.updatedAt)(),
32
+ __metadata("design:type", Date)
33
+ ], FabricBaseModel.prototype, "updatedAt", void 0);
34
+ __decorate([
35
+ (0, decoration_1.description)("Stores the version of the model"),
36
+ (0, db_decorators_1.version)(),
37
+ __metadata("design:type", Number)
38
+ ], FabricBaseModel.prototype, "version", void 0);
39
+ exports.FabricBaseModel = FabricBaseModel = __decorate([
40
+ (0, decoration_1.uses)(constants_1.FabricFlavour),
41
+ __metadata("design:paramtypes", [Object])
42
+ ], FabricBaseModel);
43
+ //# sourceMappingURL=FabricBaseModel.js.map
@@ -0,0 +1,7 @@
1
+ import { Model, type ModelArg } from "@decaf-ts/decorator-validation";
2
+ export declare class FabricBaseModel extends Model {
3
+ createdAt: Date;
4
+ updatedAt: Date;
5
+ version: number;
6
+ constructor(arg?: ModelArg<FabricBaseModel>);
7
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FabricBaseModel.js","sourceRoot":"","sources":["../../../src/shared/model/FabricBaseModel.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yEAAsE;AACtE,yCAAsD;AACtD,2DAAkD;AAClD,qDAAyD;AACzD,kDAA6C;AAGtC,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,4BAAK;IAaxC,YAAY,GAA+B;QACzC,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF,CAAA;AAhBY,0CAAe;AAG1B;IAFC,IAAA,wBAAW,EAAC,2CAA2C,CAAC;IACxD,IAAA,gBAAS,GAAE;8BACA,IAAI;kDAAC;AAIjB;IAFC,IAAA,wBAAW,EAAC,yCAAyC,CAAC;IACtD,IAAA,gBAAS,GAAE;8BACA,IAAI;kDAAC;AAIjB;IAFC,IAAA,wBAAW,EAAC,iCAAiC,CAAC;IAC9C,IAAA,uBAAO,GAAE;;gDACO;0BAXN,eAAe;IAD3B,IAAA,iBAAI,EAAC,yBAAa,CAAC;;GACP,eAAe,CAgB3B"}
@@ -0,0 +1,37 @@
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.FabricIdentifiedBaseModel = void 0;
13
+ const core_1 = require("@decaf-ts/core");
14
+ const decoration_1 = require("@decaf-ts/decoration");
15
+ const constants_1 = require("./../constants.cjs");
16
+ const FabricBaseModel_1 = require("./FabricBaseModel.cjs");
17
+ let FabricIdentifiedBaseModel = class FabricIdentifiedBaseModel extends FabricBaseModel_1.FabricBaseModel {
18
+ constructor(arg) {
19
+ super(arg);
20
+ }
21
+ };
22
+ exports.FabricIdentifiedBaseModel = FabricIdentifiedBaseModel;
23
+ __decorate([
24
+ (0, decoration_1.description)("Stores the creator"),
25
+ (0, core_1.createdBy)(),
26
+ __metadata("design:type", String)
27
+ ], FabricIdentifiedBaseModel.prototype, "createdBy", void 0);
28
+ __decorate([
29
+ (0, decoration_1.description)("Stores the user that last updated the model"),
30
+ (0, core_1.updatedBy)(),
31
+ __metadata("design:type", String)
32
+ ], FabricIdentifiedBaseModel.prototype, "updatedBy", void 0);
33
+ exports.FabricIdentifiedBaseModel = FabricIdentifiedBaseModel = __decorate([
34
+ (0, decoration_1.uses)(constants_1.FabricFlavour),
35
+ __metadata("design:paramtypes", [Object])
36
+ ], FabricIdentifiedBaseModel);
37
+ //# sourceMappingURL=FabricIdentifiedBaseModel.js.map
@@ -0,0 +1,7 @@
1
+ import { type ModelArg } from "@decaf-ts/decorator-validation";
2
+ import { FabricBaseModel } from "./FabricBaseModel";
3
+ export declare abstract class FabricIdentifiedBaseModel extends FabricBaseModel {
4
+ createdBy: string;
5
+ updatedBy: string;
6
+ protected constructor(arg?: ModelArg<FabricIdentifiedBaseModel>);
7
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FabricIdentifiedBaseModel.js","sourceRoot":"","sources":["../../../src/shared/model/FabricIdentifiedBaseModel.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yCAAsD;AACtD,qDAAyD;AACzD,kDAA6C;AAC7C,2DAAoD;AAG7C,IAAe,yBAAyB,GAAxC,MAAe,yBAA0B,SAAQ,iCAAe;IASrE,YAAsB,GAAyC;QAC7D,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF,CAAA;AAZqB,8DAAyB;AAG7C;IAFC,IAAA,wBAAW,EAAC,oBAAoB,CAAC;IACjC,IAAA,gBAAS,GAAE;;4DACO;AAInB;IAFC,IAAA,wBAAW,EAAC,6CAA6C,CAAC;IAC1D,IAAA,gBAAS,GAAE;;4DACO;oCAPC,yBAAyB;IAD9C,IAAA,iBAAI,EAAC,yBAAa,CAAC;;GACE,yBAAyB,CAY9C"}
@@ -68,6 +68,7 @@ __decorate([
68
68
  ], Identity.prototype, "credentials", void 0);
69
69
  __decorate([
70
70
  (0, decorator_validation_1.required)(),
71
+ (0, core_1.index)(),
71
72
  __metadata("design:type", String)
72
73
  ], Identity.prototype, "mspId", void 0);
73
74
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"Identity.js","sourceRoot":"","sources":["../../../src/shared/model/Identity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAkE;AAClE,yEAAgF;AAChF,mEAA4D;AAC5D,kDAA4C;AAE5C;;;;;;;;;;;;;;GAcG;AAEI,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AE;;oCACmB;AAUxB;IAJC,IAAA,eAAQ,EAAC,yCAAmB,EAAE;QAC7B,MAAM,EAAE,cAAO,CAAC,OAAO;QACvB,MAAM,EAAE,cAAO,CAAC,OAAO;KACxB,CAAC;8BACY,yCAAmB;6CAAa;AAQ9C;IAFC,IAAA,+BAAQ,GAAE;IACV,IAAA,YAAK,GAAE;;uCACmB;AAO3B;IADC,IAAA,+BAAQ,GAAE;;sCAC6B;mBA/B7B,QAAQ;IADpB,IAAA,4BAAK,GAAE;;GACK,QAAQ,CAoCpB"}
@@ -16,5 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Identity.cjs"), exports);
18
18
  __exportStar(require("./IdentityCredentials.cjs"), exports);
19
- __exportStar(require("./Sequence.cjs"), exports);
20
19
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,2 @@
1
1
  export * from "./Identity";
2
2
  export * from "./IdentityCredentials";
3
- export * from "./Sequence";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/model/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA2B;AAC3B,4DAAsC;AACtC,iDAA2B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/model/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA2B;AAC3B,4DAAsC"}
@@ -43,7 +43,7 @@ export declare class CoreUtils {
43
43
  * @param {string|Buffer} contentOrPath - Path to a file on disk or an already-loaded Buffer
44
44
  * @return {Promise<string|Uint8Array|Buffer>} The file content as a Buffer/string depending on reader
45
45
  */
46
- static readFile(contentOrPath: string | Buffer): Promise<Buffer<ArrayBufferLike>>;
46
+ static readFile(contentOrPath: string | Buffer): Promise<NonSharedBuffer>;
47
47
  /**
48
48
  * @description Create a Fabric CA User object with enrollment
49
49
  * @summary Constructs a fabric-common User, sets a crypto suite, imports the provided private key, and sets enrollment with certificate and MSP ID.
package/lib/version.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PACKAGE_NAME = exports.VERSION = void 0;
4
4
  const decoration_1 = require("@decaf-ts/decoration");
5
- exports.VERSION = "0.1.15";
5
+ exports.VERSION = "0.1.17";
6
6
  exports.PACKAGE_NAME = "@decaf-ts/for-fabric";
7
7
  decoration_1.Metadata.registerLibrary(exports.PACKAGE_NAME, exports.VERSION);
8
8
  //# sourceMappingURL=version.js.map
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.15";
1
+ export declare const VERSION = "0.1.17";
2
2
  export declare const PACKAGE_NAME = "@decaf-ts/for-fabric";
package/package.json CHANGED
@@ -1,24 +1,28 @@
1
1
  {
2
2
  "name": "@decaf-ts/for-fabric",
3
- "version": "0.1.16",
3
+ "version": "0.1.18",
4
4
  "description": "Abstracts fabric logic",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
8
8
  "require": "./lib/index.cjs",
9
- "import": "./lib/esm/index.js"
9
+ "import": "./lib/esm/index.js",
10
+ "types": "./lib/index.d.ts"
10
11
  },
11
12
  "./client": {
12
13
  "require": "./lib/client/index.cjs",
13
- "import": "./lib/esm/client/index.js"
14
+ "import": "./lib/esm/client/index.js",
15
+ "types": "./lib/client/index.d.ts"
14
16
  },
15
17
  "./contracts": {
16
18
  "require": "./lib/contracts/index.cjs",
17
- "import": "./lib/esm/contracts/index.js"
19
+ "import": "./lib/esm/contracts/index.js",
20
+ "types": "./lib/contracts/index.d.ts"
18
21
  },
19
22
  "./shared": {
20
23
  "require": "./lib/shared/index.cjs",
21
- "import": "./lib/esm/shared/index.js"
24
+ "import": "./lib/esm/shared/index.js",
25
+ "types": "./lib/shared/index.d.ts"
22
26
  }
23
27
  },
24
28
  "types": "lib/index.d.ts",
@@ -66,7 +70,7 @@
66
70
  "uml": "cd workdocs/uml && for FILE in ./*.puml; do docker run --rm -v $(pwd):/work -w /work miy4/plantuml -DPLANTUML_LIMIT_SIZE=8192 -tpng $FILE; done && cd ../.. && cp -fr workdocs/uml/*.png workdocs/resources/",
67
71
  "docs": "npx rimraf ./docs && mkdir docs && npx build-scripts --docs",
68
72
  "infrastructure:up": "docker compose -f ./docker/infrastructure/docker-compose.yaml up -d",
69
- "infrastructure:down": "docker compose -f ./docker/infrastructure/docker-compose.yaml down --rmi local -v",
73
+ "infrastructure:down": "docker compose -f ./docker/infrastructure/docker-compose.yaml down --rmi local -v && rm -f ./tests/integration/chaincodeTrackers/*.count",
70
74
  "infrastructure-hsm:up": "docker compose -f ./docker/infrastructure/docker-compose-hsm.yaml up -d",
71
75
  "infrastructure-hsm:down": "docker compose -f ./docker/infrastructure/docker-compose-hsm.yaml down --rmi local -v",
72
76
  "publish-docs": "docker run -it --rm --user $(id -u):$(id -g) -v \"$(pwd)/workdocs/confluence:/content\" -e ATLASSIAN_API_TOKEN=$(cat .confluence-token) ghcr.io/markdown-confluence/publish:latest",
@@ -1,119 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FabricContractSequence = void 0;
4
- const db_decorators_1 = require("@decaf-ts/db-decorators");
5
- const core_1 = require("@decaf-ts/core");
6
- const core_2 = require("@decaf-ts/core");
7
- const Sequence_1 = require("./../shared/model/Sequence.cjs");
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 FabricContractSequence extends core_2.Sequence {
18
- constructor(options, adapter) {
19
- super(options, adapter);
20
- this.repo = core_1.Repository.forModel(Sequence_1.SequenceModel, 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, Sequence_1.SequenceModel, 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 Sequence_1.SequenceModel({ 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 Sequence_1.SequenceModel({ 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, Sequence_1.SequenceModel, 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, Sequence_1.SequenceModel, 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.FabricContractSequence = FabricContractSequence;
119
- //# sourceMappingURL=FabricContractSequence.js.map
@@ -1,50 +0,0 @@
1
- import { SequenceOptions } from "@decaf-ts/core";
2
- import type { Adapter, MaybeContextualArg } from "@decaf-ts/core";
3
- import type { MangoQuery } from "@decaf-ts/for-couchdb";
4
- import { Sequence } from "@decaf-ts/core";
5
- import { SequenceModel } from "../shared/model/Sequence";
6
- import { FabricContractRepository } from "./FabricContractRepository";
7
- import { FabricContractContext } from "./ContractContext";
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
- export declare class FabricContractSequence extends Sequence {
18
- protected repo: FabricContractRepository<SequenceModel>;
19
- constructor(options: SequenceOptions, adapter: Adapter<any, any, MangoQuery, FabricContractContext>);
20
- /**
21
- * @summary Retrieves the current value for the sequence
22
- * @protected
23
- */
24
- current(...args: MaybeContextualArg<any>): Promise<string | number | bigint>;
25
- /**
26
- * @summary increments the sequence
27
- * @description Sequence specific implementation
28
- *
29
- * @param {string | number | bigint} current
30
- * @param count
31
- * @protected
32
- */
33
- private increment;
34
- /**
35
- * @description Gets the next value in the sequence
36
- * @summary Retrieves the current value of the sequence and increments it by the
37
- * configured increment amount. This is the main method used to get a new sequential value.
38
- * @return A promise that resolves to the next value in the sequence
39
- */
40
- next(...argz: MaybeContextualArg<any>): Promise<number | string | bigint>;
41
- /**
42
- * @description Generates a range of sequential values
43
- * @summary Retrieves a specified number of sequential values from the sequence.
44
- * This is useful when you need to allocate multiple IDs at once.
45
- * The method increments the sequence by the total amount needed and returns all values in the range.
46
- * @param {number} count - The number of sequential values to generate
47
- * @return A promise that resolves to an array of sequential values
48
- */
49
- range(count: number, ...argz: MaybeContextualArg<any>): Promise<(number | string | bigint)[]>;
50
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"FabricContractSequence.js","sourceRoot":"","sources":["../../src/contracts/FabricContractSequence.ts"],"names":[],"mappings":";;;AAAA,2DAKiC;AACjC,yCAA6D;AAG7D,yCAA0C;AAC1C,6DAAyD;AAGzD;;;;;;;;GAQG;AACH,MAAa,sBAAuB,SAAQ,eAAQ;IAGlD,YACE,OAAwB,EACxB,OAA6D;QAE7D,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,iBAAU,CAAC,QAAQ,CAAC,wBAAa,EAAE,OAAO,CAAC,KAAK,CAAQ,CAAC;IACvE,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO,CACX,GAAG,IAA6B;QAEhC,MAAM,WAAW,GAAG,MAAM,uBAAO,CAAC,IAAI,CACpC,6BAAa,CAAC,IAAI,EAClB,wBAAa,EACb,IAAI,EACJ,IAAI,CAAC,OAAO,CACb,CAAC;QACF,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC;Q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6B;QAEhC,MAAM,WAAW,GAAG,MAAM,uBAAO,CAAC,IAAI,CACpC,6BAAa,CAAC,MAAM,EACpB,wBAAa,EACb,IAAI,EACJ,IAAI,CAAC,OAAO,CACb,CAAC;QACF,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC;QACtC,MAAM,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAW,CAAC;QACxD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAC5B,IAAI,CAAC,OAAO,CAAC,WAAqB,CACzB,CAAC;QACZ,MAAM,IAAI,GAA6B,MAAM,IAAI,CAAC,SAAS,CACzD,OAAO,EACN,IAAI,CAAC,KAAK,CAAC,KAAK,CAAY,GAAG,WAAW,EAC3C,OAAO,CACR,CAAC;QACF,MAAM,KAAK,GAAiC,EAAE,CAAC;QAC/C,KAAK,IAAI,CAAC,GAAW,CAAC,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,WAAW,GAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAY,CAAC,CAAC;QAChE,CAAC;QACD,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,KAAK,QAAQ;YACpE,MAAM,IAAI,6BAAa,CAAC,yBAAyB,CAAC,CAAC;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAxJD,wDAwJC"}
@@ -1,50 +0,0 @@
1
- import { SequenceOptions } from "@decaf-ts/core";
2
- import type { Adapter, MaybeContextualArg } from "@decaf-ts/core";
3
- import type { MangoQuery } from "@decaf-ts/for-couchdb";
4
- import { Sequence } from "@decaf-ts/core";
5
- import { SequenceModel } from "../shared/model/Sequence";
6
- import { FabricContractRepository } from "./FabricContractRepository";
7
- import { FabricContractContext } from "./ContractContext";
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
- export declare class FabricContractSequence extends Sequence {
18
- protected repo: FabricContractRepository<SequenceModel>;
19
- constructor(options: SequenceOptions, adapter: Adapter<any, any, MangoQuery, FabricContractContext>);
20
- /**
21
- * @summary Retrieves the current value for the sequence
22
- * @protected
23
- */
24
- current(...args: MaybeContextualArg<any>): Promise<string | number | bigint>;
25
- /**
26
- * @summary increments the sequence
27
- * @description Sequence specific implementation
28
- *
29
- * @param {string | number | bigint} current
30
- * @param count
31
- * @protected
32
- */
33
- private increment;
34
- /**
35
- * @description Gets the next value in the sequence
36
- * @summary Retrieves the current value of the sequence and increments it by the
37
- * configured increment amount. This is the main method used to get a new sequential value.
38
- * @return A promise that resolves to the next value in the sequence
39
- */
40
- next(...argz: MaybeContextualArg<any>): Promise<number | string | bigint>;
41
- /**
42
- * @description Generates a range of sequential values
43
- * @summary Retrieves a specified number of sequential values from the sequence.
44
- * This is useful when you need to allocate multiple IDs at once.
45
- * The method increments the sequence by the total amount needed and returns all values in the range.
46
- * @param {number} count - The number of sequential values to generate
47
- * @return A promise that resolves to an array of sequential values
48
- */
49
- range(count: number, ...argz: MaybeContextualArg<any>): Promise<(number | string | bigint)[]>;
50
- }
@@ -1,115 +0,0 @@
1
- import { Context, InternalError, NotFoundError, OperationKeys, } from "@decaf-ts/db-decorators";
2
- import { Repository } from "@decaf-ts/core";
3
- import { Sequence } from "@decaf-ts/core";
4
- import { SequenceModel } from "./../shared/model/Sequence.js";
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 FabricContractSequence extends Sequence {
15
- constructor(options, adapter) {
16
- super(options, adapter);
17
- this.repo = Repository.forModel(SequenceModel, 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, SequenceModel, 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 SequenceModel({ id: name, current: next }), ctx);
72
- }
73
- catch (e) {
74
- if (!(e instanceof NotFoundError))
75
- throw e;
76
- seq = await this.repo.create(new SequenceModel({ 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, SequenceModel, 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, SequenceModel, 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=FabricContractSequence.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FabricContractSequence.js","sourceRoot":"","sources":["../../../src/contracts/FabricContractSequence.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,aAAa,EACb,aAAa,EACb,aAAa,GACd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,UAAU,EAAmB,MAAM,gBAAgB,CAAC;AAG7D,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,sCAAiC;AAGzD;;;;;;;;GAQG;AACH,MAAM,OAAO,sBAAuB,SAAQ,QAAQ;IAGlD,YACE,OAAwB,EACxB,OAA6D;QAE7D,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC,KAAK,CAAQ,CAAC;IACvE,CAA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ts/core";
2
- import type { ModelArg } from "@decaf-ts/decorator-validation";
3
- export declare class SequenceModel extends BaseModel {
4
- /**
5
- * @description Primary key identifier for the sequence
6
- */
7
- id: string;
8
- /**
9
- * @description Current value of the sequence
10
- * Used to generate the next sequential value
11
- */
12
- current: string | number;
13
- constructor(seq?: ModelArg<SequenceModel>);
14
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"Sequence.js","sourceRoot":"","sources":["../../../../src/shared/model/Sequence.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAI7C,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,SAAS;IAe1C,YAAY,GAA6B;QACvC,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF,CAAA;AAbC;IADC,EAAE,EAAE;;yCACO;AAQZ;IAFC,QAAQ,EAAE;IACV,KAAK,EAAE;;8CACkB;AAbf,aAAa;IAFzB,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC;IAC3B,KAAK,EAAE;;GACK,aAAa,CAkBzB"}
@@ -1,36 +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.SequenceModel = void 0;
13
- const core_1 = require("@decaf-ts/core");
14
- const decorator_validation_1 = require("@decaf-ts/decorator-validation");
15
- const for_couchdb_1 = require("@decaf-ts/for-couchdb");
16
- let SequenceModel = class SequenceModel extends core_1.BaseModel {
17
- constructor(seq) {
18
- super(seq);
19
- }
20
- };
21
- exports.SequenceModel = SequenceModel;
22
- __decorate([
23
- (0, core_1.pk)(),
24
- __metadata("design:type", String)
25
- ], SequenceModel.prototype, "id", void 0);
26
- __decorate([
27
- (0, decorator_validation_1.required)(),
28
- (0, core_1.index)(),
29
- __metadata("design:type", Object)
30
- ], SequenceModel.prototype, "current", void 0);
31
- exports.SequenceModel = SequenceModel = __decorate([
32
- (0, core_1.table)(for_couchdb_1.CouchDBKeys.SEQUENCE),
33
- (0, decorator_validation_1.model)(),
34
- __metadata("design:paramtypes", [Object])
35
- ], SequenceModel);
36
- //# sourceMappingURL=Sequence.js.map
@@ -1,14 +0,0 @@
1
- import { BaseModel } from "@decaf-ts/core";
2
- import type { ModelArg } from "@decaf-ts/decorator-validation";
3
- export declare class SequenceModel extends BaseModel {
4
- /**
5
- * @description Primary key identifier for the sequence
6
- */
7
- id: string;
8
- /**
9
- * @description Current value of the sequence
10
- * Used to generate the next sequential value
11
- */
12
- current: string | number;
13
- constructor(seq?: ModelArg<SequenceModel>);
14
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"Sequence.js","sourceRoot":"","sources":["../../../src/shared/model/Sequence.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAA6D;AAC7D,yEAAiE;AAEjE,uDAAoD;AAI7C,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,gBAAS;IAe1C,YAAY,GAA6B;QACvC,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF,CAAA;AAlBY,sCAAa;AAKxB;IADC,IAAA,SAAE,GAAE;;yCACO;AAQZ;IAFC,IAAA,+BAAQ,GAAE;IACV,IAAA,YAAK,GAAE;;8CACkB;wBAbf,aAAa;IAFzB,IAAA,YAAK,EAAC,yBAAW,CAAC,QAAQ,CAAC;IAC3B,IAAA,4BAAK,GAAE;;GACK,aAAa,CAkBzB"}