@decaf-ts/for-fabric 0.1.2 → 0.1.4

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 (155) 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/client/FabricClientAdapter.cjs +94 -81
  6. package/lib/client/FabricClientAdapter.d.ts +24 -33
  7. package/lib/client/FabricClientAdapter.js.map +1 -1
  8. package/lib/client/FabricClientDispatch.cjs +14 -5
  9. package/lib/client/FabricClientDispatch.d.ts +7 -5
  10. package/lib/client/FabricClientDispatch.js.map +1 -1
  11. package/lib/client/FabricClientRepository.cjs +4 -137
  12. package/lib/client/FabricClientRepository.d.ts +6 -78
  13. package/lib/client/FabricClientRepository.js.map +1 -1
  14. package/lib/client/erc20/FabricERC20ClientRepository.cjs +17 -17
  15. package/lib/client/erc20/FabricERC20ClientRepository.d.ts +5 -5
  16. package/lib/client/erc20/FabricERC20ClientRepository.js.map +1 -1
  17. package/lib/client/logging.cjs +1 -3
  18. package/lib/client/logging.js.map +1 -1
  19. package/lib/client/services/FabricEnrollmentService.cjs +3 -3
  20. package/lib/client/services/FabricEnrollmentService.d.ts +2 -2
  21. package/lib/client/services/FabricEnrollmentService.js.map +1 -1
  22. package/lib/contracts/ContractAdapter.cjs +204 -115
  23. package/lib/contracts/ContractAdapter.d.ts +26 -34
  24. package/lib/contracts/ContractAdapter.js.map +1 -1
  25. package/lib/contracts/ContractContext.cjs +1 -9
  26. package/lib/contracts/ContractContext.d.ts +0 -6
  27. package/lib/contracts/ContractContext.js.map +1 -1
  28. package/lib/contracts/ContractPrivateDataAdapter.cjs +429 -288
  29. package/lib/contracts/ContractPrivateDataAdapter.d.ts +0 -76
  30. package/lib/contracts/ContractPrivateDataAdapter.js.map +1 -1
  31. package/lib/contracts/FabricConstruction.cjs +3 -3
  32. package/lib/contracts/FabricConstruction.d.ts +9 -8
  33. package/lib/contracts/FabricConstruction.js.map +1 -1
  34. package/lib/contracts/FabricContractRepository.cjs +7 -202
  35. package/lib/contracts/FabricContractRepository.d.ts +5 -68
  36. package/lib/contracts/FabricContractRepository.js.map +1 -1
  37. package/lib/contracts/FabricContractRepositoryObservableHandler.cjs +4 -1
  38. package/lib/contracts/FabricContractRepositoryObservableHandler.d.ts +4 -4
  39. package/lib/contracts/FabricContractRepositoryObservableHandler.js.map +1 -1
  40. package/lib/contracts/FabricContractSequence.cjs +39 -60
  41. package/lib/contracts/FabricContractSequence.d.ts +29 -41
  42. package/lib/contracts/FabricContractSequence.js.map +1 -1
  43. package/lib/contracts/FabricContractStatement.cjs +6 -6
  44. package/lib/contracts/FabricContractStatement.d.ts +4 -6
  45. package/lib/contracts/FabricContractStatement.js.map +1 -1
  46. package/lib/contracts/crud/crud-contract.cjs +74 -44
  47. package/lib/contracts/crud/crud-contract.d.ts +7 -11
  48. package/lib/contracts/crud/crud-contract.js.map +1 -1
  49. package/lib/contracts/crud/serialized-crud-contract.cjs +12 -21
  50. package/lib/contracts/crud/serialized-crud-contract.d.ts +3 -11
  51. package/lib/contracts/crud/serialized-crud-contract.js.map +1 -1
  52. package/lib/contracts/erc20/erc20contract.cjs +73 -67
  53. package/lib/contracts/erc20/erc20contract.d.ts +13 -12
  54. package/lib/contracts/erc20/erc20contract.js.map +1 -1
  55. package/lib/contracts/logging.cjs +3 -9
  56. package/lib/contracts/logging.d.ts +1 -2
  57. package/lib/contracts/logging.js.map +1 -1
  58. package/lib/contracts/private-data.cjs +202 -118
  59. package/lib/contracts/private-data.d.ts +0 -16
  60. package/lib/contracts/private-data.js.map +1 -1
  61. package/lib/contracts/types.d.ts +1 -1
  62. package/lib/esm/client/FabricClientAdapter.d.ts +24 -33
  63. package/lib/esm/client/FabricClientAdapter.js +90 -78
  64. package/lib/esm/client/FabricClientAdapter.js.map +1 -1
  65. package/lib/esm/client/FabricClientDispatch.d.ts +7 -5
  66. package/lib/esm/client/FabricClientDispatch.js +17 -8
  67. package/lib/esm/client/FabricClientDispatch.js.map +1 -1
  68. package/lib/esm/client/FabricClientRepository.d.ts +6 -78
  69. package/lib/esm/client/FabricClientRepository.js +4 -137
  70. package/lib/esm/client/FabricClientRepository.js.map +1 -1
  71. package/lib/esm/client/erc20/FabricERC20ClientRepository.d.ts +5 -5
  72. package/lib/esm/client/erc20/FabricERC20ClientRepository.js +17 -17
  73. package/lib/esm/client/erc20/FabricERC20ClientRepository.js.map +1 -1
  74. package/lib/esm/client/logging.js +1 -3
  75. package/lib/esm/client/logging.js.map +1 -1
  76. package/lib/esm/client/services/FabricEnrollmentService.d.ts +2 -2
  77. package/lib/esm/client/services/FabricEnrollmentService.js +3 -3
  78. package/lib/esm/client/services/FabricEnrollmentService.js.map +1 -1
  79. package/lib/esm/contracts/ContractAdapter.d.ts +26 -34
  80. package/lib/esm/contracts/ContractAdapter.js +205 -116
  81. package/lib/esm/contracts/ContractAdapter.js.map +1 -1
  82. package/lib/esm/contracts/ContractContext.d.ts +0 -6
  83. package/lib/esm/contracts/ContractContext.js +1 -9
  84. package/lib/esm/contracts/ContractContext.js.map +1 -1
  85. package/lib/esm/contracts/ContractPrivateDataAdapter.d.ts +0 -76
  86. package/lib/esm/contracts/ContractPrivateDataAdapter.js +430 -285
  87. package/lib/esm/contracts/ContractPrivateDataAdapter.js.map +1 -1
  88. package/lib/esm/contracts/FabricConstruction.d.ts +9 -8
  89. package/lib/esm/contracts/FabricConstruction.js +3 -3
  90. package/lib/esm/contracts/FabricConstruction.js.map +1 -1
  91. package/lib/esm/contracts/FabricContractRepository.d.ts +5 -68
  92. package/lib/esm/contracts/FabricContractRepository.js +7 -202
  93. package/lib/esm/contracts/FabricContractRepository.js.map +1 -1
  94. package/lib/esm/contracts/FabricContractRepositoryObservableHandler.d.ts +4 -4
  95. package/lib/esm/contracts/FabricContractRepositoryObservableHandler.js +5 -2
  96. package/lib/esm/contracts/FabricContractRepositoryObservableHandler.js.map +1 -1
  97. package/lib/esm/contracts/FabricContractSequence.d.ts +29 -41
  98. package/lib/esm/contracts/FabricContractSequence.js +40 -61
  99. package/lib/esm/contracts/FabricContractSequence.js.map +1 -1
  100. package/lib/esm/contracts/FabricContractStatement.d.ts +4 -6
  101. package/lib/esm/contracts/FabricContractStatement.js +7 -7
  102. package/lib/esm/contracts/FabricContractStatement.js.map +1 -1
  103. package/lib/esm/contracts/crud/crud-contract.d.ts +7 -11
  104. package/lib/esm/contracts/crud/crud-contract.js +75 -45
  105. package/lib/esm/contracts/crud/crud-contract.js.map +1 -1
  106. package/lib/esm/contracts/crud/serialized-crud-contract.d.ts +3 -11
  107. package/lib/esm/contracts/crud/serialized-crud-contract.js +12 -21
  108. package/lib/esm/contracts/crud/serialized-crud-contract.js.map +1 -1
  109. package/lib/esm/contracts/erc20/erc20contract.d.ts +13 -12
  110. package/lib/esm/contracts/erc20/erc20contract.js +73 -67
  111. package/lib/esm/contracts/erc20/erc20contract.js.map +1 -1
  112. package/lib/esm/contracts/logging.d.ts +1 -2
  113. package/lib/esm/contracts/logging.js +3 -9
  114. package/lib/esm/contracts/logging.js.map +1 -1
  115. package/lib/esm/contracts/private-data.d.ts +0 -16
  116. package/lib/esm/contracts/private-data.js +203 -111
  117. package/lib/esm/contracts/private-data.js.map +1 -1
  118. package/lib/esm/contracts/types.d.ts +1 -1
  119. package/lib/esm/shared/decorators.d.ts +14 -4
  120. package/lib/esm/shared/decorators.js +142 -42
  121. package/lib/esm/shared/decorators.js.map +1 -1
  122. package/lib/esm/shared/errors.js +2 -2
  123. package/lib/esm/shared/errors.js.map +1 -1
  124. package/lib/esm/shared/events.d.ts +1 -5
  125. package/lib/esm/shared/events.js.map +1 -1
  126. package/lib/esm/shared/model/Sequence.d.ts +14 -0
  127. package/lib/esm/shared/model/Sequence.js +33 -0
  128. package/lib/esm/shared/model/Sequence.js.map +1 -0
  129. package/lib/esm/shared/model/index.d.ts +2 -0
  130. package/lib/esm/shared/model/index.js +2 -0
  131. package/lib/esm/shared/model/index.js.map +1 -1
  132. package/lib/esm/version.d.ts +1 -1
  133. package/lib/esm/version.js +1 -1
  134. package/lib/shared/decorators.cjs +148 -41
  135. package/lib/shared/decorators.d.ts +14 -4
  136. package/lib/shared/decorators.js.map +1 -1
  137. package/lib/shared/errors.cjs +2 -2
  138. package/lib/shared/errors.js.map +1 -1
  139. package/lib/shared/events.d.ts +1 -5
  140. package/lib/shared/events.js.map +1 -1
  141. package/lib/shared/model/Sequence.cjs +36 -0
  142. package/lib/shared/model/Sequence.d.ts +14 -0
  143. package/lib/shared/model/Sequence.js.map +1 -0
  144. package/lib/shared/model/index.cjs +2 -0
  145. package/lib/shared/model/index.d.ts +2 -0
  146. package/lib/shared/model/index.js.map +1 -1
  147. package/lib/version.cjs +1 -1
  148. package/lib/version.d.ts +1 -1
  149. package/package.json +2 -3
  150. package/lib/client/services/LoggedService.cjs +0 -47
  151. package/lib/client/services/LoggedService.d.ts +0 -42
  152. package/lib/client/services/LoggedService.js.map +0 -1
  153. package/lib/esm/client/services/LoggedService.d.ts +0 -42
  154. package/lib/esm/client/services/LoggedService.js +0 -43
  155. package/lib/esm/client/services/LoggedService.js.map +0 -1
@@ -1,120 +1,204 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MISSING_PRIVATE_DATA_ERROR_MESSAGE = exports.MISSING_PRIVATE_DATA_REGEX = void 0;
4
- exports.processModel = processModel;
5
- exports.hasPrivateData = hasPrivateData;
6
- exports.getClassPrivateDataMetadata = getClassPrivateDataMetadata;
7
- exports.isModelPrivate = isModelPrivate;
8
- exports.modelToPrivate = modelToPrivate;
9
- const db_decorators_1 = require("@decaf-ts/db-decorators");
10
- const decorator_validation_1 = require("@decaf-ts/decorator-validation");
11
- const core_1 = require("@decaf-ts/core");
12
- const constants_1 = require("./../shared/constants.cjs");
13
- const decoration_1 = require("@decaf-ts/decoration");
14
- exports.MISSING_PRIVATE_DATA_REGEX = /private\s+data\s+matching\s+public\s+hash\s+version\s+is\s+not\s+available/i;
15
- exports.MISSING_PRIVATE_DATA_ERROR_MESSAGE = "private data matching public hash version is not available ...";
16
- function processModel(adapter, model) {
17
- const transient = decorator_validation_1.Model.segregate(model);
18
- const privateData = modelToPrivate(model);
19
- const transformModel = (model) => {
20
- return Object.entries(model).reduce((accum, [key, val]) => {
21
- if (typeof val === "undefined")
22
- return accum;
23
- const mappedProp = core_1.Repository.column(model, key);
24
- if (adapter.isReserved(mappedProp))
25
- throw new db_decorators_1.InternalError(`Property name ${mappedProp} is reserved`);
26
- accum[mappedProp] = val;
27
- return accum;
28
- }, {});
29
- };
30
- if (privateData.private) {
31
- const collections = Object.keys(privateData.private);
32
- for (const collection of collections) {
33
- privateData.private[collection] = transformModel(privateData.private[collection]);
34
- }
35
- }
36
- return {
37
- model: transient.model,
38
- transient: transient.transient,
39
- privateData: privateData.private,
40
- result: transformModel(transient.model),
41
- };
42
- }
43
- function hasPrivateData(model) {
44
- const metadata = getClassPrivateDataMetadata(model);
45
- if (!metadata)
46
- return false;
47
- return true;
48
- }
49
- function getClassPrivateDataMetadata(model) {
50
- return decoration_1.Metadata.get(model.constructor, constants_1.FabricModelKeys.PRIVATE);
51
- }
52
- function isModelPrivate(model) {
53
- const metadata = getClassPrivateDataMetadata(model);
54
- if (!metadata || metadata.isPrivate === undefined)
55
- return false;
56
- return metadata.isPrivate;
57
- }
58
- function modelToPrivate(model) {
59
- if (!hasPrivateData(model))
60
- return { model: model };
61
- const isPrivate = isModelPrivate(model);
62
- const modelCollections = getClassPrivateDataMetadata(model);
63
- let result = {
64
- model: model,
65
- private: undefined,
66
- };
67
- // TODO: the is private is not workign correctly. If no properties it doesn't create the private part.
68
- if (isPrivate) {
69
- const privatePart = modelCollections.collections;
70
- result = (decoration_1.Metadata.properties(model.constructor) || []).reduce((accum, k) => {
71
- const collections = modelCollections.collections;
72
- accum.private = accum.private || {};
73
- for (const collection of collections) {
74
- try {
75
- accum.private[collection] = accum.private[collection] || {};
76
- accum.private[collection][k] = model[k];
77
- }
78
- catch (e) {
79
- throw new db_decorators_1.SerializationError(`Failed to serialize private property ${k}: ${e}`);
80
- }
81
- }
82
- return accum;
83
- }, { model: {}, private: privatePart });
84
- }
85
- else {
86
- result = Object.entries(modelCollections).reduce((accum, [k, val]) => {
87
- const props = decoration_1.Metadata.properties(model.constructor);
88
- if (!props?.includes(k))
89
- return accum;
90
- const collections = val.collections;
91
- if (collections?.length) {
92
- accum.private = accum.private || {};
93
- for (const collection of collections) {
94
- try {
95
- accum.private[collection] = accum.private[collection] || {};
96
- accum.private[collection][k] = model[k];
97
- }
98
- catch (e) {
99
- throw new db_decorators_1.SerializationError(`Failed to serialize private property ${k}: ${e}`);
100
- }
101
- }
102
- }
103
- else {
104
- accum.model = accum.model || {};
105
- accum.model[k] = model[k];
106
- }
107
- return accum;
108
- }, {});
109
- }
110
- result.model = result.model || {};
111
- result.model = decorator_validation_1.Model.build(result.model, model.constructor.name);
112
- if (result.private) {
113
- const collections = Object.keys(result.private);
114
- for (const collection of collections) {
115
- result.private[collection] = decorator_validation_1.Model.build(result.private[collection], model.constructor.name);
116
- }
117
- }
118
- return result;
119
- }
2
+ // import { InternalError, SerializationError } from "@decaf-ts/db-decorators";
3
+ // import { Model } from "@decaf-ts/decorator-validation";
4
+ // import { FabricModelKeys } from "../shared/constants";
5
+ // import { Constructor, Metadata } from "@decaf-ts/decoration";
6
+ //
7
+ // export const MISSING_PRIVATE_DATA_REGEX =
8
+ // /private\s+data\s+matching\s+public\s+hash\s+version\s+is\s+not\s+available/i;
9
+ //
10
+ // export const MISSING_PRIVATE_DATA_ERROR_MESSAGE =
11
+ // "private data matching public hash version is not available ...";
12
+ //
13
+ // export function processModel<M extends Model>(adapter: any, model: M) {
14
+ // const transient = Model.segregate(model);
15
+ // const privateData = modelToPrivate(model);
16
+ //
17
+ // const transformModel = (model: any) => {
18
+ // return Object.entries(model).reduce(
19
+ // (accum: Record<string, any>, [key, val]) => {
20
+ // if (typeof val === "undefined") return accum;
21
+ // const mappedProp = Model.columnName(
22
+ // model.constructor as Constructor,
23
+ // key as any
24
+ // );
25
+ // if (adapter.isReserved(mappedProp))
26
+ // throw new InternalError(`Property name ${mappedProp} is reserved`);
27
+ // accum[mappedProp] = val;
28
+ // return accum;
29
+ // },
30
+ // {}
31
+ // );
32
+ // };
33
+ //
34
+ // if (privateData.private) {
35
+ // const collections = Object.keys(privateData.private);
36
+ //
37
+ // for (const collection of collections) {
38
+ // privateData.private![collection] = transformModel(
39
+ // privateData.private![collection]
40
+ // );
41
+ // }
42
+ // }
43
+ //
44
+ // return {
45
+ // model: transient.model,
46
+ // transient: transient.transient,
47
+ // privateData: privateData.private,
48
+ // result: transformModel(transient.model),
49
+ // };
50
+ // }
51
+ //
52
+ // export function hasPrivateData<M extends Model>(model: M) {
53
+ // return !!getClassPrivateDataMetadata(model);
54
+ // }
55
+ //
56
+ // export function getClassPrivateDataMetadata<M extends Model>(
57
+ // model: M
58
+ // ): Record<string, any> | undefined {
59
+ // const constr = model.constructor as Constructor;
60
+ // const rootMetadata = Metadata.get(constr) || {};
61
+ // if (rootMetadata && rootMetadata[FabricModelKeys.PRIVATE])
62
+ // return rootMetadata[FabricModelKeys.PRIVATE];
63
+ // if (
64
+ // rootMetadata &&
65
+ // rootMetadata[FabricModelKeys.FABRIC + FabricModelKeys.PRIVATE]
66
+ // )
67
+ // return rootMetadata[FabricModelKeys.FABRIC + FabricModelKeys.PRIVATE];
68
+ // const flattened = Object.keys(rootMetadata || {}).reduce(
69
+ // (accum: Record<string, any>, key) => {
70
+ // if (key.includes(FabricModelKeys.PRIVATE)) {
71
+ // const property = key.split(Metadata.splitter).pop();
72
+ // if (property) accum[property] = Metadata.get(constr, key);
73
+ // }
74
+ // return accum;
75
+ // },
76
+ // {} as Record<string, any>
77
+ // );
78
+ // if (Object.keys(flattened).length) return flattened;
79
+ // const classKey = Metadata.key(
80
+ // FabricModelKeys.FABRIC + FabricModelKeys.PRIVATE
81
+ // );
82
+ // const classMetadata =
83
+ // Metadata.get(constr, classKey) ??
84
+ // Metadata.get(constr, FabricModelKeys.PRIVATE);
85
+ // if (classMetadata) return classMetadata;
86
+ // const props = Metadata.properties(constr) || [];
87
+ // const metadata: Record<string, any> = {};
88
+ // for (const prop of props) {
89
+ // const keys = [
90
+ // Metadata.key(FabricModelKeys.PRIVATE, prop),
91
+ // Metadata.key(classKey, prop),
92
+ // ];
93
+ // const propMetadata = keys
94
+ // .map((key) => Metadata.get(constr, key))
95
+ // .find(Boolean);
96
+ // if (propMetadata) metadata[prop] = propMetadata;
97
+ // }
98
+ // return Object.keys(metadata).length ? metadata : undefined;
99
+ // }
100
+ //
101
+ // export function isModelPrivate<M extends Model>(model: M): boolean {
102
+ // const classMetadata = Metadata.get(
103
+ // model.constructor as Constructor,
104
+ // Metadata.key(FabricModelKeys.FABRIC + FabricModelKeys.PRIVATE)
105
+ // );
106
+ // return Boolean(classMetadata?.isPrivate);
107
+ // }
108
+ //
109
+ // export function modelToPrivate<M extends Model>(
110
+ // model: M
111
+ // ): { model: M; private?: Record<string, Record<string, any>> } {
112
+ // if (!hasPrivateData(model)) return { model: model };
113
+ //
114
+ // const isPrivate = isModelPrivate(model);
115
+ // const modelCollections: Record<string, any> =
116
+ // getClassPrivateDataMetadata(model);
117
+ //
118
+ // let result: { model: Record<string, any>; private?: Record<string, any> } = {
119
+ // model: model as Record<string, any>,
120
+ // private: undefined,
121
+ // };
122
+ //
123
+ // // TODO: the is private is not workign correctly. If no properties it doesn't create the private part.
124
+ // if (isPrivate) {
125
+ // const privatePart = modelCollections.collections;
126
+ // result = (
127
+ // Metadata.properties(model.constructor as Constructor) || []
128
+ // ).reduce(
129
+ // (
130
+ // accum: { model: Record<string, any>; private?: Record<string, any> },
131
+ // k
132
+ // ) => {
133
+ // const collections = modelCollections.collections;
134
+ // accum.private = accum.private || {};
135
+ //
136
+ // for (const collection of collections) {
137
+ // try {
138
+ // accum.private[collection] = accum.private[collection] || {};
139
+ // accum.private[collection][k] = model[k as keyof M];
140
+ // } catch (e: unknown) {
141
+ // throw new SerializationError(
142
+ // `Failed to serialize private property ${k}: ${e}`
143
+ // );
144
+ // }
145
+ // }
146
+ //
147
+ // return accum;
148
+ // },
149
+ // { model: {}, private: privatePart } as {
150
+ // model: Record<string, any>;
151
+ // private?: Record<string, any>;
152
+ // }
153
+ // );
154
+ // } else {
155
+ // result = Object.entries(modelCollections).reduce(
156
+ // (
157
+ // accum: { model: Record<string, any>; private?: Record<string, any> },
158
+ // [k, val]
159
+ // ) => {
160
+ // const props = Metadata.properties(model.constructor as Constructor);
161
+ // if (!props?.includes(k)) return accum;
162
+ //
163
+ // const collections = (val as Record<string, any>).collections;
164
+ //
165
+ // if (collections?.length) {
166
+ // accum.private = accum.private || {};
167
+ //
168
+ // for (const collection of collections) {
169
+ // try {
170
+ // accum.private[collection] = accum.private[collection] || {};
171
+ // accum.private[collection][k] = model[k as keyof M];
172
+ // } catch (e: unknown) {
173
+ // throw new SerializationError(
174
+ // `Failed to serialize private property ${k}: ${e}`
175
+ // );
176
+ // }
177
+ // }
178
+ // } else {
179
+ // accum.model = accum.model || {};
180
+ // accum.model[k] = (model as Record<string, any>)[k];
181
+ // }
182
+ // return accum;
183
+ // },
184
+ // {} as { model: Record<string, any>; private?: Record<string, any> }
185
+ // );
186
+ // }
187
+ //
188
+ // result.model = result.model || {};
189
+ //
190
+ // result.model = Model.build(result.model, model.constructor.name);
191
+ //
192
+ // if (result.private) {
193
+ // const collections = Object.keys(result.private);
194
+ //
195
+ // for (const collection of collections) {
196
+ // result.private![collection] = Model.build(
197
+ // result.private![collection],
198
+ // model.constructor.name
199
+ // );
200
+ // }
201
+ // }
202
+ // return result as { model: M; private?: Record<string, Record<string, any>> };
203
+ // }
120
204
  //# sourceMappingURL=private-data.js.map
@@ -1,16 +0,0 @@
1
- import { Model } from "@decaf-ts/decorator-validation";
2
- export declare const MISSING_PRIVATE_DATA_REGEX: RegExp;
3
- export declare const MISSING_PRIVATE_DATA_ERROR_MESSAGE = "private data matching public hash version is not available ...";
4
- export declare function processModel<M extends Model>(adapter: any, model: M): {
5
- model: M;
6
- transient: Record<keyof M, any> | undefined;
7
- privateData: Record<string, Record<string, any>> | undefined;
8
- result: Record<string, any>;
9
- };
10
- export declare function hasPrivateData<M extends Model>(model: M): boolean;
11
- export declare function getClassPrivateDataMetadata<M extends Model>(model: M): Record<string, any>;
12
- export declare function isModelPrivate<M extends Model>(model: M): boolean;
13
- export declare function modelToPrivate<M extends Model>(model: M): {
14
- model: M;
15
- private?: Record<string, Record<string, any>>;
16
- };
@@ -1 +1 @@
1
- {"version":3,"file":"private-data.js","sourceRoot":"","sources":["../../src/contracts/private-data.ts"],"names":[],"mappings":";;;AAYA,oCAkCC;AAED,wCAIC;AAED,kEAOC;AAED,wCAIC;AAED,wCA8FC;AAnKD,2DAA4E;AAC5E,yEAAuD;AACvD,yCAA4C;AAC5C,yDAAsD;AACtD,qDAA6D;AAEhD,QAAA,0BAA0B,GACrC,6EAA6E,CAAC;AAEnE,QAAA,kCAAkC,GAC7C,gEAAgE,CAAC;AAEnE,SAAgB,YAAY,CAAkB,OAAY,EAAE,KAAQ;IAClE,MAAM,SAAS,GAAG,4BAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,WAAW,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IAE1C,MAAM,cAAc,GAAG,CAAC,KAAU,EAAE,EAAE;QACpC,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CACjC,CAAC,KAA0B,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE;YACzC,IAAI,OAAO,GAAG,KAAK,WAAW;gBAAE,OAAO,KAAK,CAAC;YAC7C,MAAM,UAAU,GAAG,iBAAU,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YACjD,IAAI,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC;gBAChC,MAAM,IAA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AC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAEjE,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAEhD,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACrC,MAAM,CAAC,OAAQ,CAAC,UAAU,CAAC,GAAG,4BAAK,CAAC,KAAK,CACvC,MAAM,CAAC,OAAQ,CAAC,UAAU,CAAC,EAC3B,KAAK,CAAC,WAAW,CAAC,IAAI,CACvB,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,MAAqE,CAAC;AAC/E,CAAC"}
1
+ {"version":3,"file":"private-data.js","sourceRoot":"","sources":["../../src/contracts/private-data.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,0DAA0D;AAC1D,yDAAyD;AACzD,gEAAgE;AAChE,EAAE;AACF,4CAA4C;AAC5C,mFAAmF;AACnF,EAAE;AACF,oDAAoD;AACpD,sEAAsE;AACtE,EAAE;AACF,0EAA0E;AAC1E,8CAA8C;AAC9C,+CAA+C;AAC/C,EAAE;AACF,6CAA6C;AAC7C,2CAA2C;AAC3C,sDAAsD;AACtD,wDAAwD;AACxD,+CAA+C;AAC/C,8CAA8C;AAC9C,uBAAuB;AACvB,aAAa;AACb,8CAA8C;AAC9C,gFAAgF;AAChF,mCAAmC;AACnC,wBAAwB;AACxB,WAAW;AACX,WAAW;AACX,SAAS;AACT,OAAO;AACP,EAAE;AACF,+BAA+B;AAC/B,4DAA4D;AAC5D,EAAE;AACF,8CAA8C;AAC9C,2DAA2D;AAC3D,2CAA2C;AAC3C,WAAW;AACX,QAAQ;AACR,MAAM;AACN,EAAE;AACF,aAAa;AACb,8BAA8B;AAC9B,sCAAsC;AACtC,wCAAwC;AACxC,+CAA+C;AAC/C,OAAO;AACP,IAAI;AACJ,EAAE;AACF,8DAA8D;AAC9D,iDAAiD;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iB;AACjB,cAAc;AACd,YAAY;AACZ,EAAE;AACF,wBAAwB;AACxB,WAAW;AACX,iDAAiD;AACjD,sCAAsC;AACtC,yCAAyC;AACzC,UAAU;AACV,SAAS;AACT,aAAa;AACb,wDAAwD;AACxD,UAAU;AACV,gFAAgF;AAChF,mBAAmB;AACnB,eAAe;AACf,+EAA+E;AAC/E,iDAAiD;AACjD,EAAE;AACF,wEAAwE;AACxE,EAAE;AACF,qCAAqC;AACrC,iDAAiD;AACjD,EAAE;AACF,oDAAoD;AACpD,oBAAoB;AACpB,6EAA6E;AAC7E,oEAAoE;AACpE,qCAAqC;AACrC,8CAA8C;AAC9C,oEAAoE;AACpE,mBAAmB;AACnB,gBAAgB;AAChB,cAAc;AACd,mBAAmB;AACnB,6CAA6C;AAC7C,gEAAgE;AAChE,YAAY;AACZ,wBAAwB;AACxB,WAAW;AACX,4EAA4E;AAC5E,SAAS;AACT,MAAM;AACN,EAAE;AACF,uCAAuC;AACvC,EAAE;AACF,sEAAsE;AACtE,EAAE;AACF,0BAA0B;AAC1B,uDAAuD;AACvD,EAAE;AACF,8CAA8C;AAC9C,mDAAmD;AACnD,uCAAuC;AACvC,iCAAiC;AACjC,WAAW;AACX,QAAQ;AACR,MAAM;AACN,kFAAkF;AAClF,IAAI"}
@@ -18,7 +18,7 @@ export interface FabricContractFlags extends RepositoryFlags {
18
18
  /**
19
19
  * @description Client identity for the transaction submitter
20
20
  */
21
- clientIdentity: ClientIdentity;
21
+ identity: ClientIdentity;
22
22
  /**
23
23
  * @description Logger instance for the contract
24
24
  */
@@ -1,13 +1,16 @@
1
1
  import { CouchDBAdapter, type MangoQuery } from "@decaf-ts/for-couchdb";
2
2
  import { Client } from "@grpc/grpc-js";
3
3
  import { Model, type Serializer } from "@decaf-ts/decorator-validation";
4
- import { type Logger } from "@decaf-ts/logging";
5
4
  import { type FabricFlags, type PeerConfig } from "../shared/types";
6
5
  import { Gateway, Network, Contract as Contrakt } from "@hyperledger/fabric-gateway";
7
- import { BaseError, Context } from "@decaf-ts/db-decorators";
8
- import { Adapter, Repository } from "@decaf-ts/core";
6
+ import { BaseError, OperationKeys } from "@decaf-ts/db-decorators";
7
+ import { Context, type PrimaryKeyType } from "@decaf-ts/db-decorators";
8
+ import { Adapter, PreparedModel, Repository } from "@decaf-ts/core";
9
+ import type { ContextualArgs, MaybeContextualArg } from "@decaf-ts/core";
9
10
  import type { FabricClientDispatch } from "./FabricClientDispatch";
10
11
  import { type Constructor } from "@decaf-ts/decoration";
12
+ export declare class FabricClientContext extends Context<FabricFlags> {
13
+ }
11
14
  /**
12
15
  * @description Adapter for interacting with Hyperledger Fabric networks
13
16
  * @summary The FabricAdapter extends CouchDBAdapter to provide a seamless interface for interacting with Hyperledger Fabric networks.
@@ -59,22 +62,13 @@ import { type Constructor } from "@decaf-ts/decoration";
59
62
  * FabricAdapter->>FabricAdapter: serializer.deserialize(decodedResult)
60
63
  * FabricAdapter-->>Client: deserializedResult
61
64
  */
62
- export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Client, FabricFlags, Context<FabricFlags>> {
65
+ export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Client, FabricClientContext> {
63
66
  /**
64
67
  * @description Static text decoder for converting Uint8Array to string
65
68
  */
66
69
  private static decoder;
67
70
  private static serializer;
68
- /**
69
- * @description Static logger instance for the FabricAdapter class
70
- */
71
- private static log;
72
- /**
73
- * @description Gets the logger instance for this adapter
74
- * @summary Returns the static logger instance for the FabricAdapter class
75
- * @return {Logger} The logger instance
76
- */
77
- protected get log(): Logger;
71
+ protected static log: import("@decaf-ts/logging").Logger;
78
72
  protected readonly serializer: Serializer<any>;
79
73
  /**
80
74
  * @description Creates a new FabricAdapter instance
@@ -83,6 +77,7 @@ export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Clie
83
77
  * @param {string} [alias] - Optional alias for the adapter instance
84
78
  */
85
79
  constructor(config: PeerConfig, alias?: string);
80
+ context<M extends Model>(operation: OperationKeys.CREATE | OperationKeys.READ | OperationKeys.UPDATE | OperationKeys.DELETE | string, overrides: Partial<FabricFlags>, model: Constructor<M> | Constructor<M>[], ...args: any[]): Promise<FabricClientContext>;
86
81
  /**
87
82
  * @description Decodes a Uint8Array to a string
88
83
  * @summary Converts binary data received from Fabric to a string using UTF-8 encoding
@@ -90,7 +85,7 @@ export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Clie
90
85
  * @return {string} The decoded string
91
86
  */
92
87
  decode(data: Uint8Array): string;
93
- repository<M extends Model<true | false>>(): Constructor<Repository<M, MangoQuery, Adapter<PeerConfig, Client, MangoQuery, FabricFlags, Context<FabricFlags>>, FabricFlags, Context<FabricFlags>>>;
88
+ repository<R extends Repository<any, Adapter<PeerConfig, Client, MangoQuery, FabricClientContext>>>(): Constructor<R>;
94
89
  /**
95
90
  * @description Creates multiple records in a single transaction
96
91
  * @summary Submits a transaction to create multiple records in the Fabric ledger
@@ -100,7 +95,7 @@ export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Clie
100
95
  * @param {Record<string, any>} transient - Transient data for the transaction
101
96
  * @return {Promise<Array<Record<string, any>>>} Promise resolving to the created records
102
97
  */
103
- createAll(tableName: string, ids: string[] | number[], models: Record<string, any>[], transient: Record<string, any>): Promise<Record<string, any>[]>;
98
+ createAll<M extends Model>(clazz: Constructor<M>, ids: PrimaryKeyType[], models: Record<string, any>[], ...args: ContextualArgs<FabricClientContext>): Promise<Record<string, any>[]>;
104
99
  /**
105
100
  * @description Reads multiple records in a single transaction
106
101
  * @summary Submits a transaction to read multiple records from the Fabric ledger
@@ -108,7 +103,7 @@ export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Clie
108
103
  * @param {string[] | number[]} ids - Array of record identifiers to read
109
104
  * @return {Promise<Array<Record<string, any>>>} Promise resolving to the retrieved records
110
105
  */
111
- readAll(tableName: string, ids: string[] | number[]): Promise<Record<string, any>[]>;
106
+ readAll<M extends Model>(clazz: Constructor<M>, ids: PrimaryKeyType[], ...args: ContextualArgs<FabricClientContext>): Promise<Record<string, any>[]>;
112
107
  /**
113
108
  * @description Updates multiple records in a single transaction
114
109
  * @summary Submits a transaction to update multiple records in the Fabric ledger
@@ -118,7 +113,7 @@ export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Clie
118
113
  * @param {Record<string, any>} transient - Transient data for the transaction
119
114
  * @return {Promise<Array<Record<string, any>>>} Promise resolving to the updated records
120
115
  */
121
- updateAll(tableName: string, ids: string[] | number[], models: Record<string, any>[], transient: Record<string, any>): Promise<Record<string, any>[]>;
116
+ updateAll<M extends Model>(clazz: Constructor<M>, ids: PrimaryKeyType[], models: Record<string, any>[], ...args: ContextualArgs<FabricClientContext>): Promise<Record<string, any>[]>;
122
117
  /**
123
118
  * @description Deletes multiple records in a single transaction
124
119
  * @summary Submits a transaction to delete multiple records from the Fabric ledger
@@ -127,7 +122,7 @@ export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Clie
127
122
  * @param {Serializer<any>} serializer - Serializer for the model data
128
123
  * @return {Promise<Array<Record<string, any>>>} Promise resolving to the deleted records
129
124
  */
130
- deleteAll(tableName: string, ids: (string | number | bigint)[]): Promise<Record<string, any>[]>;
125
+ deleteAll<M extends Model>(clazz: Constructor<M>, ids: PrimaryKeyType[], ...args: ContextualArgs<FabricClientContext>): Promise<Record<string, any>[]>;
131
126
  /**
132
127
  * @description Prepares a model for persistence
133
128
  * @summary Converts a model instance into a format suitable for database storage,
@@ -137,11 +132,7 @@ export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Clie
137
132
  * @param pk - The primary key property name
138
133
  * @return The prepared data
139
134
  */
140
- prepare<M extends Model>(model: M, pk: keyof M): {
141
- record: Record<string, any>;
142
- id: string;
143
- transient?: Record<string, any>;
144
- };
135
+ prepare<M extends Model>(model: M, ...args: ContextualArgs<FabricClientContext>): PreparedModel;
145
136
  /**
146
137
  * @description Converts database data back into a model instance
147
138
  * @summary Reconstructs a model instance from database data, handling column mapping
@@ -154,7 +145,7 @@ export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Clie
154
145
  * @param [transient] - Transient properties to reattach
155
146
  * @return {M} The reconstructed model instance
156
147
  */
157
- revert<M extends Model>(obj: Record<string, any>, clazz: string | Constructor<M>, pk: keyof M, id: string | number | bigint, transient?: Record<string, any>): M;
148
+ revert<M extends Model>(obj: Record<string, any>, clazz: Constructor<M>, id: PrimaryKeyType, transient?: Record<string, any>, ...args: ContextualArgs<FabricClientContext>): M;
158
149
  /**
159
150
  * @description Creates an index for a model
160
151
  * @summary This method is not implemented for Fabric and will throw an error
@@ -172,7 +163,7 @@ export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Clie
172
163
  * @param {Record<string, any>} transient - Transient data for the transaction
173
164
  * @return {Promise<Record<string, any>>} Promise resolving to the created record
174
165
  */
175
- create(tableName: string, id: string | number, model: Record<string, any>, transient: Record<string, any>): Promise<Record<string, any>>;
166
+ create<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, model: Record<string, any>, ...args: ContextualArgs<FabricClientContext>): Promise<Record<string, any>>;
176
167
  /**
177
168
  * @description Reads a single record
178
169
  * @summary Evaluates a transaction to read a record from the Fabric ledger
@@ -180,8 +171,8 @@ export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Clie
180
171
  * @param {string | number} id - The record identifier
181
172
  * @return {Promise<Record<string, any>>} Promise resolving to the retrieved record
182
173
  */
183
- read(tableName: string, id: string | number): Promise<Record<string, any>>;
184
- updatePrefix(tableName: string, id: string | number, model: Record<string, any>): (string | number | Record<string, any>)[];
174
+ read<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, ...args: ContextualArgs<FabricClientContext>): Promise<Record<string, any>>;
175
+ updatePrefix<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, model: Record<string, any>, ...args: MaybeContextualArg<FabricClientContext>): any[];
185
176
  /**
186
177
  * @description Updates a single record
187
178
  * @summary Submits a transaction to update a record in the Fabric ledger
@@ -191,7 +182,7 @@ export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Clie
191
182
  * @param {Record<string, any>} transient - Transient data for the transaction
192
183
  * @return {Promise<Record<string, any>>} Promise resolving to the updated record
193
184
  */
194
- update(tableName: string, id: string | number, model: Record<string, any>, transient: Record<string, any>): Promise<Record<string, any>>;
185
+ update<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, model: Record<string, any>, ...args: ContextualArgs<FabricClientContext>): Promise<Record<string, any>>;
195
186
  /**
196
187
  * @description Deletes a single record
197
188
  * @summary Submits a transaction to delete a record from the Fabric ledger
@@ -199,7 +190,7 @@ export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Clie
199
190
  * @param {string | number} id - The record identifier to delete
200
191
  * @return {Promise<Record<string, any>>} Promise resolving to the deleted record
201
192
  */
202
- delete(tableName: string, id: string | number): Promise<Record<string, any>>;
193
+ delete<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, ...args: ContextualArgs<FabricClientContext>): Promise<Record<string, any>>;
203
194
  /**
204
195
  * @description Executes a raw query against the Fabric ledger
205
196
  * @summary Evaluates a transaction to perform a query using Mango Query syntax
@@ -225,7 +216,7 @@ export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Clie
225
216
  * FabricAdapter->>FabricAdapter: Process result based on type
226
217
  * FabricAdapter-->>Client: processed result
227
218
  */
228
- raw<V>(rawInput: MangoQuery, process: boolean, tableName?: string): Promise<V>;
219
+ raw<V>(rawInput: MangoQuery, ...args: ContextualArgs<FabricClientContext>): Promise<V>;
229
220
  /**
230
221
  * @description Gets or creates a gRPC client for the Fabric peer
231
222
  * @summary Returns a cached client or creates a new one if none exists
@@ -281,7 +272,7 @@ export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Clie
281
272
  * @param {string} [reason] - Optional reason for the error
282
273
  * @return {BaseError} The parsed error
283
274
  */
284
- parseError(err: Error | string, reason?: string): BaseError;
275
+ parseError<E extends BaseError>(err: Error | string, reason?: string): E;
285
276
  /**
286
277
  * @description Submits a transaction to the Fabric network
287
278
  * @summary Executes a transaction that modifies the ledger state
@@ -381,5 +372,5 @@ export declare class FabricClientAdapter extends CouchDBAdapter<PeerConfig, Clie
381
372
  * @param {string} [reason] - Optional reason for the error
382
373
  * @return {BaseError} The parsed error
383
374
  */
384
- protected static parseError(err: Error | string, reason?: string): BaseError;
375
+ protected static parseError<E extends BaseError>(err: Error | string, reason?: string): E;
385
376
  }