@digicatapult/sqnc-process-management 2.2.130 → 2.2.132

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 (57) hide show
  1. package/build/index.js +95 -0
  2. package/build/index.js.map +1 -0
  3. package/build/lib/process/__tests__/unit.test.js +191 -0
  4. package/build/lib/process/__tests__/unit.test.js.map +1 -0
  5. package/build/lib/process/api.js +206 -0
  6. package/build/lib/process/api.js.map +1 -0
  7. package/build/lib/process/constants.js +5 -0
  8. package/build/lib/process/constants.js.map +1 -0
  9. package/build/{src/lib → lib}/process/hex.js +4 -2
  10. package/build/lib/process/hex.js.map +1 -0
  11. package/build/lib/process/index.js +304 -0
  12. package/build/lib/process/index.js.map +1 -0
  13. package/build/{src/lib → lib}/types/error.js +9 -6
  14. package/build/lib/types/error.js.map +1 -0
  15. package/build/lib/types/polkadot.d.js +2 -0
  16. package/build/lib/types/polkadot.d.js.map +1 -0
  17. package/build/lib/types/process.d.js +2 -0
  18. package/build/lib/types/process.d.js.map +1 -0
  19. package/build/lib/types/validation.js +179 -0
  20. package/build/lib/types/validation.js.map +1 -0
  21. package/build/lib/utils/polkadot.js +26 -0
  22. package/build/lib/utils/polkadot.js.map +1 -0
  23. package/build/version.js +5 -0
  24. package/build/version.js.map +1 -0
  25. package/package.json +13 -11
  26. package/build/package.json +0 -65
  27. package/build/src/index.d.ts +0 -2
  28. package/build/src/index.js +0 -127
  29. package/build/src/lib/process/_tests_/unit.test.d.ts +0 -1
  30. package/build/src/lib/process/_tests_/unit.test.js +0 -112
  31. package/build/src/lib/process/api.d.ts +0 -10
  32. package/build/src/lib/process/api.js +0 -193
  33. package/build/src/lib/process/constants.d.ts +0 -3
  34. package/build/src/lib/process/constants.js +0 -3
  35. package/build/src/lib/process/hex.d.ts +0 -2
  36. package/build/src/lib/process/index.d.ts +0 -22
  37. package/build/src/lib/process/index.js +0 -311
  38. package/build/src/lib/types/error.d.ts +0 -14
  39. package/build/src/lib/types/validation.d.ts +0 -3592
  40. package/build/src/lib/types/validation.js +0 -128
  41. package/build/src/lib/utils/polkadot.d.ts +0 -6
  42. package/build/src/lib/utils/polkadot.js +0 -28
  43. package/build/src/version.d.ts +0 -2
  44. package/build/src/version.js +0 -3
  45. package/build/tests/fixtures/processes.d.ts +0 -281
  46. package/build/tests/fixtures/processes.js +0 -1066
  47. package/build/tests/fixtures/programs.d.ts +0 -14
  48. package/build/tests/fixtures/programs.js +0 -211
  49. package/build/tests/helpers/containers.d.ts +0 -7
  50. package/build/tests/helpers/containers.js +0 -40
  51. package/build/tests/helpers/substrateHelper.d.ts +0 -2
  52. package/build/tests/helpers/substrateHelper.js +0 -100
  53. package/build/tests/integration/command-functions.test.d.ts +0 -1
  54. package/build/tests/integration/command-functions.test.js +0 -414
  55. package/build/tests/integration/without-manual-seal.test.d.ts +0 -1
  56. package/build/tests/integration/without-manual-seal.test.js +0 -52
  57. package/build/tsconfig.tsbuildinfo +0 -1
@@ -1,128 +0,0 @@
1
- import { z } from 'zod';
2
- import { Constants } from '../process/constants.js';
3
- const tokenMetadataKey = z.string();
4
- const tokenId = z.number();
5
- const file = z.string();
6
- const metadataValue = z.union([
7
- z.object({ File: file }),
8
- z.object({ Literal: z.string() }),
9
- z.object({ TokenId: tokenId }),
10
- z.object({ None: z.null() }),
11
- ]);
12
- const metadataValueType = z.enum(['File', 'Literal', 'TokenId', 'None']);
13
- const role = z.string();
14
- const binaryOperator = z.enum([
15
- 'Identity',
16
- 'TransferL',
17
- 'TransferR',
18
- 'NotL',
19
- 'NotR',
20
- 'And',
21
- 'Nand',
22
- 'Or',
23
- 'Nor',
24
- 'Xor',
25
- 'Xnor',
26
- 'ImplicationL',
27
- 'ImplicationR',
28
- 'InhibitionL',
29
- 'InhibitionR',
30
- ]);
31
- const senderHasInputRole = z.object({
32
- index: z.number(),
33
- role_key: role,
34
- });
35
- const senderHasOutputRole = z.object({
36
- index: z.number(),
37
- role_key: role,
38
- });
39
- const outputHasRole = z.object({
40
- index: z.number(),
41
- role_key: role,
42
- });
43
- const outputHasMetadata = z.object({
44
- index: z.number(),
45
- metadata_key: tokenMetadataKey,
46
- });
47
- const inputHasRole = z.object({
48
- index: z.number(),
49
- role_key: role,
50
- });
51
- const inputHasMetadata = z.object({
52
- index: z.number(),
53
- metadata_key: tokenMetadataKey,
54
- });
55
- const matchInputOutputRole = z.object({
56
- input_index: z.number(),
57
- input_role_key: role,
58
- output_index: z.number(),
59
- output_role_key: role,
60
- });
61
- const matchInputOutputMetadataValue = z.object({
62
- input_index: z.number(),
63
- input_metadata_key: tokenMetadataKey,
64
- output_index: z.number(),
65
- output_metadata_key: tokenMetadataKey,
66
- });
67
- const matchInputIdOutputMetadataValue = z.object({
68
- input_index: z.number(),
69
- output_index: z.number(),
70
- output_metadata_key: tokenMetadataKey,
71
- });
72
- const fixedNumberOfInputs = z.object({
73
- num_inputs: z.number(),
74
- });
75
- const fixedNumberOfOutputs = z.object({
76
- num_outputs: z.number(),
77
- });
78
- const fixedInputMetadataValue = z.object({
79
- index: z.number(),
80
- metadata_key: tokenMetadataKey,
81
- metadata_value: metadataValue,
82
- });
83
- const fixedOutputMetadataValue = z.object({
84
- index: z.number(),
85
- metadata_key: tokenMetadataKey,
86
- metadata_value: metadataValue,
87
- });
88
- const fixedInputMetadataValueType = z.object({
89
- index: z.number(),
90
- metadata_key: tokenMetadataKey,
91
- metadata_value_type: metadataValueType,
92
- });
93
- const fixedOutputMetadataValueType = z.object({
94
- index: z.number(),
95
- metadata_key: tokenMetadataKey,
96
- metadata_value_type: metadataValueType,
97
- });
98
- export const restrictionValidation = z.union([
99
- z.literal('None'),
100
- z.literal('Fail'),
101
- z.object({ SenderHasInputRole: senderHasInputRole }).strict(),
102
- z.object({ SenderHasOutputRole: senderHasOutputRole }).strict(),
103
- z.object({ OutputHasRole: outputHasRole }).strict(),
104
- z.object({ OutputHasMetadata: outputHasMetadata }).strict(),
105
- z.object({ InputHasRole: inputHasRole }).strict(),
106
- z.object({ InputHasMetadata: inputHasMetadata }).strict(),
107
- z.object({ MatchInputOutputRole: matchInputOutputRole }).strict(),
108
- z.object({ MatchInputOutputMetadataValue: matchInputOutputMetadataValue }).strict(),
109
- z.object({ MatchInputIdOutputMetadataValue: matchInputIdOutputMetadataValue }).strict(),
110
- z.object({ FixedNumberOfInputs: fixedNumberOfInputs }).strict(),
111
- z.object({ FixedNumberOfOutputs: fixedNumberOfOutputs }).strict(),
112
- z.object({ FixedInputMetadataValue: fixedInputMetadataValue }).strict(),
113
- z.object({ FixedOutputMetadataValue: fixedOutputMetadataValue }).strict(),
114
- z.object({ FixedInputMetadataValueType: fixedInputMetadataValueType }).strict(),
115
- z.object({ FixedOutputMetadataValueType: fixedOutputMetadataValueType }).strict(),
116
- ]);
117
- export const stepValidation = z.union([
118
- z.object({ Op: binaryOperator }),
119
- z.object({ Restriction: restrictionValidation }),
120
- ]);
121
- export const programValidation = z.array(stepValidation);
122
- export const processValidation = z.object({
123
- name: z.string().max(Constants.PROCESS_ID_LENGTH),
124
- version: z.number(),
125
- program: programValidation,
126
- });
127
- export const simpleProcesssValidation = z.array(z.object({ name: z.string() }).passthrough());
128
- export const processesValidation = z.array(processValidation);
@@ -1,6 +0,0 @@
1
- import { ApiPromise, Keyring } from '@polkadot/api';
2
- export declare const createNodeApi: (options: Polkadot.Options) => Promise<{
3
- api: ApiPromise;
4
- keyring: Keyring;
5
- [Symbol.asyncDispose]: () => Promise<void>;
6
- }>;
@@ -1,28 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { ApiPromise, WsProvider, Keyring } from '@polkadot/api';
11
- export const createNodeApi = (options) => __awaiter(void 0, void 0, void 0, function* () {
12
- const provider = new WsProvider(`ws://${options.API_HOST}:${options.API_PORT}`);
13
- const api = new ApiPromise({ provider });
14
- api.isReadyOrError.catch(() => { }); // prevent unhandled promise rejection errors
15
- yield api.isReady;
16
- api.on('error', (err) => {
17
- const msg = err.message || JSON.stringify(err);
18
- console.log(`Error from substrate node connection. Error was ${msg}`);
19
- return msg;
20
- });
21
- return {
22
- api,
23
- keyring: new Keyring({ type: 'sr25519' }),
24
- [Symbol.asyncDispose]: () => __awaiter(void 0, void 0, void 0, function* () {
25
- yield api.disconnect();
26
- }),
27
- };
28
- });
@@ -1,2 +0,0 @@
1
- declare const version: string;
2
- export default version;
@@ -1,3 +0,0 @@
1
- import packageJson from '../package.json' assert { type: 'json' };
2
- const { version } = packageJson;
3
- export default version;
@@ -1,281 +0,0 @@
1
- declare const _default: ({
2
- name: string;
3
- version: number;
4
- program: ({
5
- Restriction: {
6
- FixedNumberOfInputs: {
7
- num_inputs: number;
8
- };
9
- FixedNumberOfOutputs?: undefined;
10
- FixedOutputMetadataValue?: undefined;
11
- FixedOutputMetadataValueType?: undefined;
12
- OutputHasMetadata?: undefined;
13
- SenderHasOutputRole?: undefined;
14
- };
15
- Op?: undefined;
16
- } | {
17
- Restriction: {
18
- FixedNumberOfOutputs: {
19
- num_outputs: number;
20
- };
21
- FixedNumberOfInputs?: undefined;
22
- FixedOutputMetadataValue?: undefined;
23
- FixedOutputMetadataValueType?: undefined;
24
- OutputHasMetadata?: undefined;
25
- SenderHasOutputRole?: undefined;
26
- };
27
- Op?: undefined;
28
- } | {
29
- Op: string;
30
- Restriction?: undefined;
31
- } | {
32
- Restriction: {
33
- FixedOutputMetadataValue: {
34
- index: number;
35
- metadata_key: string;
36
- metadata_value: {
37
- Literal: string;
38
- };
39
- };
40
- FixedNumberOfInputs?: undefined;
41
- FixedNumberOfOutputs?: undefined;
42
- FixedOutputMetadataValueType?: undefined;
43
- OutputHasMetadata?: undefined;
44
- SenderHasOutputRole?: undefined;
45
- };
46
- Op?: undefined;
47
- } | {
48
- Restriction: {
49
- FixedOutputMetadataValueType: {
50
- index: number;
51
- metadata_key: string;
52
- metadata_value_type: string;
53
- };
54
- FixedNumberOfInputs?: undefined;
55
- FixedNumberOfOutputs?: undefined;
56
- FixedOutputMetadataValue?: undefined;
57
- OutputHasMetadata?: undefined;
58
- SenderHasOutputRole?: undefined;
59
- };
60
- Op?: undefined;
61
- } | {
62
- Restriction: {
63
- OutputHasMetadata: {
64
- index: number;
65
- metadata_key: string;
66
- };
67
- FixedNumberOfInputs?: undefined;
68
- FixedNumberOfOutputs?: undefined;
69
- FixedOutputMetadataValue?: undefined;
70
- FixedOutputMetadataValueType?: undefined;
71
- SenderHasOutputRole?: undefined;
72
- };
73
- Op?: undefined;
74
- } | {
75
- Restriction: string;
76
- Op?: undefined;
77
- } | {
78
- Restriction: {
79
- SenderHasOutputRole: {
80
- index: number;
81
- role_key: string;
82
- };
83
- FixedNumberOfInputs?: undefined;
84
- FixedNumberOfOutputs?: undefined;
85
- FixedOutputMetadataValue?: undefined;
86
- FixedOutputMetadataValueType?: undefined;
87
- OutputHasMetadata?: undefined;
88
- };
89
- Op?: undefined;
90
- })[];
91
- } | {
92
- name: string;
93
- version: number;
94
- program: ({
95
- Restriction: {
96
- FixedNumberOfInputs: {
97
- num_inputs: number;
98
- };
99
- FixedNumberOfOutputs?: undefined;
100
- FixedInputMetadataValue?: undefined;
101
- MatchInputOutputMetadataValue?: undefined;
102
- MatchInputOutputRole?: undefined;
103
- InputHasMetadata?: undefined;
104
- MatchInputIdOutputMetadataValue?: undefined;
105
- SenderHasOutputRole?: undefined;
106
- FixedOutputMetadataValue?: undefined;
107
- OutputHasMetadata?: undefined;
108
- };
109
- Op?: undefined;
110
- } | {
111
- Restriction: {
112
- FixedNumberOfOutputs: {
113
- num_outputs: number;
114
- };
115
- FixedNumberOfInputs?: undefined;
116
- FixedInputMetadataValue?: undefined;
117
- MatchInputOutputMetadataValue?: undefined;
118
- MatchInputOutputRole?: undefined;
119
- InputHasMetadata?: undefined;
120
- MatchInputIdOutputMetadataValue?: undefined;
121
- SenderHasOutputRole?: undefined;
122
- FixedOutputMetadataValue?: undefined;
123
- OutputHasMetadata?: undefined;
124
- };
125
- Op?: undefined;
126
- } | {
127
- Op: string;
128
- Restriction?: undefined;
129
- } | {
130
- Restriction: {
131
- FixedInputMetadataValue: {
132
- index: number;
133
- metadata_key: string;
134
- metadata_value: {
135
- Literal: string;
136
- };
137
- };
138
- FixedNumberOfInputs?: undefined;
139
- FixedNumberOfOutputs?: undefined;
140
- MatchInputOutputMetadataValue?: undefined;
141
- MatchInputOutputRole?: undefined;
142
- InputHasMetadata?: undefined;
143
- MatchInputIdOutputMetadataValue?: undefined;
144
- SenderHasOutputRole?: undefined;
145
- FixedOutputMetadataValue?: undefined;
146
- OutputHasMetadata?: undefined;
147
- };
148
- Op?: undefined;
149
- } | {
150
- Restriction: {
151
- MatchInputOutputMetadataValue: {
152
- input_index: number;
153
- input_metadata_key: string;
154
- output_index: number;
155
- output_metadata_key: string;
156
- };
157
- FixedNumberOfInputs?: undefined;
158
- FixedNumberOfOutputs?: undefined;
159
- FixedInputMetadataValue?: undefined;
160
- MatchInputOutputRole?: undefined;
161
- InputHasMetadata?: undefined;
162
- MatchInputIdOutputMetadataValue?: undefined;
163
- SenderHasOutputRole?: undefined;
164
- FixedOutputMetadataValue?: undefined;
165
- OutputHasMetadata?: undefined;
166
- };
167
- Op?: undefined;
168
- } | {
169
- Restriction: {
170
- MatchInputOutputRole: {
171
- input_index: number;
172
- input_role_key: string;
173
- output_index: number;
174
- output_role_key: string;
175
- };
176
- FixedNumberOfInputs?: undefined;
177
- FixedNumberOfOutputs?: undefined;
178
- FixedInputMetadataValue?: undefined;
179
- MatchInputOutputMetadataValue?: undefined;
180
- InputHasMetadata?: undefined;
181
- MatchInputIdOutputMetadataValue?: undefined;
182
- SenderHasOutputRole?: undefined;
183
- FixedOutputMetadataValue?: undefined;
184
- OutputHasMetadata?: undefined;
185
- };
186
- Op?: undefined;
187
- } | {
188
- Restriction: {
189
- InputHasMetadata: {
190
- index: number;
191
- metadata_key: string;
192
- };
193
- FixedNumberOfInputs?: undefined;
194
- FixedNumberOfOutputs?: undefined;
195
- FixedInputMetadataValue?: undefined;
196
- MatchInputOutputMetadataValue?: undefined;
197
- MatchInputOutputRole?: undefined;
198
- MatchInputIdOutputMetadataValue?: undefined;
199
- SenderHasOutputRole?: undefined;
200
- FixedOutputMetadataValue?: undefined;
201
- OutputHasMetadata?: undefined;
202
- };
203
- Op?: undefined;
204
- } | {
205
- Restriction: string;
206
- Op?: undefined;
207
- } | {
208
- Restriction: {
209
- MatchInputIdOutputMetadataValue: {
210
- input_index: number;
211
- output_index: number;
212
- output_metadata_key: string;
213
- };
214
- FixedNumberOfInputs?: undefined;
215
- FixedNumberOfOutputs?: undefined;
216
- FixedInputMetadataValue?: undefined;
217
- MatchInputOutputMetadataValue?: undefined;
218
- MatchInputOutputRole?: undefined;
219
- InputHasMetadata?: undefined;
220
- SenderHasOutputRole?: undefined;
221
- FixedOutputMetadataValue?: undefined;
222
- OutputHasMetadata?: undefined;
223
- };
224
- Op?: undefined;
225
- } | {
226
- Restriction: {
227
- SenderHasOutputRole: {
228
- index: number;
229
- role_key: string;
230
- };
231
- FixedNumberOfInputs?: undefined;
232
- FixedNumberOfOutputs?: undefined;
233
- FixedInputMetadataValue?: undefined;
234
- MatchInputOutputMetadataValue?: undefined;
235
- MatchInputOutputRole?: undefined;
236
- InputHasMetadata?: undefined;
237
- MatchInputIdOutputMetadataValue?: undefined;
238
- FixedOutputMetadataValue?: undefined;
239
- OutputHasMetadata?: undefined;
240
- };
241
- Op?: undefined;
242
- } | {
243
- Restriction: {
244
- FixedOutputMetadataValue: {
245
- index: number;
246
- metadata_key: string;
247
- metadata_value: {
248
- Literal: string;
249
- };
250
- };
251
- FixedNumberOfInputs?: undefined;
252
- FixedNumberOfOutputs?: undefined;
253
- FixedInputMetadataValue?: undefined;
254
- MatchInputOutputMetadataValue?: undefined;
255
- MatchInputOutputRole?: undefined;
256
- InputHasMetadata?: undefined;
257
- MatchInputIdOutputMetadataValue?: undefined;
258
- SenderHasOutputRole?: undefined;
259
- OutputHasMetadata?: undefined;
260
- };
261
- Op?: undefined;
262
- } | {
263
- Restriction: {
264
- OutputHasMetadata: {
265
- index: number;
266
- metadata_key: string;
267
- };
268
- FixedNumberOfInputs?: undefined;
269
- FixedNumberOfOutputs?: undefined;
270
- FixedInputMetadataValue?: undefined;
271
- MatchInputOutputMetadataValue?: undefined;
272
- MatchInputOutputRole?: undefined;
273
- InputHasMetadata?: undefined;
274
- MatchInputIdOutputMetadataValue?: undefined;
275
- SenderHasOutputRole?: undefined;
276
- FixedOutputMetadataValue?: undefined;
277
- };
278
- Op?: undefined;
279
- })[];
280
- })[];
281
- export default _default;