@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.
- package/build/index.js +95 -0
- package/build/index.js.map +1 -0
- package/build/lib/process/__tests__/unit.test.js +191 -0
- package/build/lib/process/__tests__/unit.test.js.map +1 -0
- package/build/lib/process/api.js +206 -0
- package/build/lib/process/api.js.map +1 -0
- package/build/lib/process/constants.js +5 -0
- package/build/lib/process/constants.js.map +1 -0
- package/build/{src/lib → lib}/process/hex.js +4 -2
- package/build/lib/process/hex.js.map +1 -0
- package/build/lib/process/index.js +304 -0
- package/build/lib/process/index.js.map +1 -0
- package/build/{src/lib → lib}/types/error.js +9 -6
- package/build/lib/types/error.js.map +1 -0
- package/build/lib/types/polkadot.d.js +2 -0
- package/build/lib/types/polkadot.d.js.map +1 -0
- package/build/lib/types/process.d.js +2 -0
- package/build/lib/types/process.d.js.map +1 -0
- package/build/lib/types/validation.js +179 -0
- package/build/lib/types/validation.js.map +1 -0
- package/build/lib/utils/polkadot.js +26 -0
- package/build/lib/utils/polkadot.js.map +1 -0
- package/build/version.js +5 -0
- package/build/version.js.map +1 -0
- package/package.json +13 -11
- package/build/package.json +0 -65
- package/build/src/index.d.ts +0 -2
- package/build/src/index.js +0 -127
- package/build/src/lib/process/_tests_/unit.test.d.ts +0 -1
- package/build/src/lib/process/_tests_/unit.test.js +0 -112
- package/build/src/lib/process/api.d.ts +0 -10
- package/build/src/lib/process/api.js +0 -193
- package/build/src/lib/process/constants.d.ts +0 -3
- package/build/src/lib/process/constants.js +0 -3
- package/build/src/lib/process/hex.d.ts +0 -2
- package/build/src/lib/process/index.d.ts +0 -22
- package/build/src/lib/process/index.js +0 -311
- package/build/src/lib/types/error.d.ts +0 -14
- package/build/src/lib/types/validation.d.ts +0 -3592
- package/build/src/lib/types/validation.js +0 -128
- package/build/src/lib/utils/polkadot.d.ts +0 -6
- package/build/src/lib/utils/polkadot.js +0 -28
- package/build/src/version.d.ts +0 -2
- package/build/src/version.js +0 -3
- package/build/tests/fixtures/processes.d.ts +0 -281
- package/build/tests/fixtures/processes.js +0 -1066
- package/build/tests/fixtures/programs.d.ts +0 -14
- package/build/tests/fixtures/programs.js +0 -211
- package/build/tests/helpers/containers.d.ts +0 -7
- package/build/tests/helpers/containers.js +0 -40
- package/build/tests/helpers/substrateHelper.d.ts +0 -2
- package/build/tests/helpers/substrateHelper.js +0 -100
- package/build/tests/integration/command-functions.test.d.ts +0 -1
- package/build/tests/integration/command-functions.test.js +0 -414
- package/build/tests/integration/without-manual-seal.test.d.ts +0 -1
- package/build/tests/integration/without-manual-seal.test.js +0 -52
- package/build/tsconfig.tsbuildinfo +0 -1
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const simple: Process.Program;
|
|
2
|
-
export declare const simple2: {
|
|
3
|
-
Restriction: {
|
|
4
|
-
SenderHasInputRole: {
|
|
5
|
-
index: number;
|
|
6
|
-
role_key: string;
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
}[];
|
|
10
|
-
export declare const invalidPOSIX: Process.Program;
|
|
11
|
-
export declare const validAllRestrictions: Process.Program;
|
|
12
|
-
export declare const invalidRestrictionKey: Process.Program;
|
|
13
|
-
export declare const invalidRestrictionValue: Process.Program;
|
|
14
|
-
export declare const multiple: (process1Name: string, process1BumpedV: number, process2Name: string, process2BumpedV: number) => string;
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
export const simple = [{ Restriction: 'None' }];
|
|
2
|
-
export const simple2 = [
|
|
3
|
-
{
|
|
4
|
-
Restriction: {
|
|
5
|
-
SenderHasInputRole: {
|
|
6
|
-
index: 0,
|
|
7
|
-
role_key: 'Supplier',
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
];
|
|
12
|
-
export const invalidPOSIX = [
|
|
13
|
-
{ Restriction: 'None' },
|
|
14
|
-
{
|
|
15
|
-
Restriction: {
|
|
16
|
-
SenderHasInputRole: {
|
|
17
|
-
index: 0,
|
|
18
|
-
role_key: 'Supplier',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
{ Op: 'Or' },
|
|
23
|
-
{
|
|
24
|
-
Restriction: {
|
|
25
|
-
SenderHasOutputRole: {
|
|
26
|
-
index: 0,
|
|
27
|
-
role_key: 'Supplier',
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
];
|
|
32
|
-
export const validAllRestrictions = [
|
|
33
|
-
{ Restriction: 'None' },
|
|
34
|
-
{
|
|
35
|
-
Restriction: {
|
|
36
|
-
SenderHasInputRole: {
|
|
37
|
-
index: 0,
|
|
38
|
-
role_key: 'Supplier',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
{ Op: 'Or' },
|
|
43
|
-
{
|
|
44
|
-
Restriction: {
|
|
45
|
-
SenderHasOutputRole: {
|
|
46
|
-
index: 0,
|
|
47
|
-
role_key: 'Supplier',
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
{ Op: 'And' },
|
|
52
|
-
{
|
|
53
|
-
Restriction: {
|
|
54
|
-
OutputHasRole: {
|
|
55
|
-
index: 0,
|
|
56
|
-
role_key: 'Supplier',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
{ Op: 'And' },
|
|
61
|
-
{
|
|
62
|
-
Restriction: {
|
|
63
|
-
OutputHasMetadata: {
|
|
64
|
-
index: 0,
|
|
65
|
-
metadata_key: 'SomeMetadataKey',
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
{ Op: 'And' },
|
|
70
|
-
{
|
|
71
|
-
Restriction: {
|
|
72
|
-
InputHasRole: {
|
|
73
|
-
index: 0,
|
|
74
|
-
role_key: 'Supplier',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
{ Op: 'And' },
|
|
79
|
-
{
|
|
80
|
-
Restriction: {
|
|
81
|
-
InputHasMetadata: {
|
|
82
|
-
index: 0,
|
|
83
|
-
metadata_key: 'SomeMetadataKey',
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
{ Op: 'And' },
|
|
88
|
-
{
|
|
89
|
-
Restriction: {
|
|
90
|
-
MatchInputOutputRole: {
|
|
91
|
-
input_index: 0,
|
|
92
|
-
input_role_key: 'Supplier',
|
|
93
|
-
output_index: 0,
|
|
94
|
-
output_role_key: 'Supplier',
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
{ Op: 'And' },
|
|
99
|
-
{
|
|
100
|
-
Restriction: {
|
|
101
|
-
MatchInputOutputMetadataValue: {
|
|
102
|
-
input_index: 0,
|
|
103
|
-
input_metadata_key: 'SomeMetadataKey',
|
|
104
|
-
output_index: 0,
|
|
105
|
-
output_metadata_key: 'SomeMetadataKey',
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
{ Op: 'And' },
|
|
110
|
-
{
|
|
111
|
-
Restriction: {
|
|
112
|
-
MatchInputIdOutputMetadataValue: {
|
|
113
|
-
input_index: 0,
|
|
114
|
-
output_index: 0,
|
|
115
|
-
output_metadata_key: 'SomeMetadataKey',
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
{ Op: 'And' },
|
|
120
|
-
{
|
|
121
|
-
Restriction: {
|
|
122
|
-
FixedNumberOfInputs: {
|
|
123
|
-
num_inputs: 0,
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
{ Op: 'And' },
|
|
128
|
-
{
|
|
129
|
-
Restriction: {
|
|
130
|
-
FixedNumberOfOutputs: {
|
|
131
|
-
num_outputs: 0,
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
},
|
|
135
|
-
{ Op: 'And' },
|
|
136
|
-
{
|
|
137
|
-
Restriction: {
|
|
138
|
-
FixedInputMetadataValue: {
|
|
139
|
-
index: 0,
|
|
140
|
-
metadata_key: 'SomeMetadataKey',
|
|
141
|
-
metadata_value: {
|
|
142
|
-
Literal: 'a',
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
{ Op: 'And' },
|
|
148
|
-
{
|
|
149
|
-
Restriction: {
|
|
150
|
-
FixedOutputMetadataValue: {
|
|
151
|
-
index: 0,
|
|
152
|
-
metadata_key: 'SomeMetadataKey',
|
|
153
|
-
metadata_value: {
|
|
154
|
-
Literal: 'a',
|
|
155
|
-
},
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
{ Op: 'And' },
|
|
160
|
-
{
|
|
161
|
-
Restriction: {
|
|
162
|
-
FixedOutputMetadataValueType: {
|
|
163
|
-
index: 0,
|
|
164
|
-
metadata_key: 'SomeMetadataKey',
|
|
165
|
-
metadata_value_type: 'Literal',
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
},
|
|
169
|
-
{ Op: 'And' },
|
|
170
|
-
];
|
|
171
|
-
export const invalidRestrictionKey = [{ Restriction: { NotARestriction: {} } }];
|
|
172
|
-
export const invalidRestrictionValue = [
|
|
173
|
-
{
|
|
174
|
-
Restriction: {
|
|
175
|
-
FixedInputMetadataValue: {
|
|
176
|
-
invalid: 0,
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
];
|
|
181
|
-
// WHY not to use simple/etc? why not name1 name2?
|
|
182
|
-
export const multiple = (process1Name, process1BumpedV, process2Name, process2BumpedV) => JSON.stringify([
|
|
183
|
-
{
|
|
184
|
-
name: process1Name,
|
|
185
|
-
version: process1BumpedV,
|
|
186
|
-
program: [
|
|
187
|
-
{
|
|
188
|
-
Restriction: {
|
|
189
|
-
SenderHasInputRole: {
|
|
190
|
-
index: 0,
|
|
191
|
-
role_key: 'Supplier',
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
name: process2Name,
|
|
199
|
-
version: process2BumpedV,
|
|
200
|
-
program: [
|
|
201
|
-
{
|
|
202
|
-
Restriction: {
|
|
203
|
-
SenderHasInputRole: {
|
|
204
|
-
index: 0,
|
|
205
|
-
role_key: 'Supplier',
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
],
|
|
210
|
-
},
|
|
211
|
-
]);
|
|
@@ -1,40 +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 { GenericContainer, Wait } from 'testcontainers';
|
|
11
|
-
import { resetLastSubmittedNonce } from '../../src/lib/process/api.js';
|
|
12
|
-
export const withSubstrateNode = (config, context) => {
|
|
13
|
-
before(function () {
|
|
14
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
-
this.timeout(60000);
|
|
16
|
-
resetLastSubmittedNonce();
|
|
17
|
-
context.nodeContainer = yield new GenericContainer('digicatapult/sqnc-node')
|
|
18
|
-
.withName('sqnc-node')
|
|
19
|
-
.withExposedPorts(30333, 9944, 9933)
|
|
20
|
-
.withCommand([
|
|
21
|
-
'--base-path',
|
|
22
|
-
'/data/',
|
|
23
|
-
'--dev',
|
|
24
|
-
'--unsafe-rpc-external',
|
|
25
|
-
'--rpc-cors',
|
|
26
|
-
'all',
|
|
27
|
-
...(config.manualSeal ? ['--manual-seal'] : []),
|
|
28
|
-
])
|
|
29
|
-
.withWaitStrategy(Wait.forHealthCheck())
|
|
30
|
-
.withReuse()
|
|
31
|
-
.start();
|
|
32
|
-
context.polkadotOptions.API_PORT = context.nodeContainer.getMappedPort(9944);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
after(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
-
var _a;
|
|
37
|
-
yield ((_a = context.nodeContainer) === null || _a === void 0 ? void 0 : _a.stop({ remove: true }));
|
|
38
|
-
resetLastSubmittedNonce();
|
|
39
|
-
}));
|
|
40
|
-
};
|
|
@@ -1,100 +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
|
-
var __addDisposableResource = (this && this.__addDisposableResource) || function (env, value, async) {
|
|
11
|
-
if (value !== null && value !== void 0) {
|
|
12
|
-
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
|
|
13
|
-
var dispose, inner;
|
|
14
|
-
if (async) {
|
|
15
|
-
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
|
|
16
|
-
dispose = value[Symbol.asyncDispose];
|
|
17
|
-
}
|
|
18
|
-
if (dispose === void 0) {
|
|
19
|
-
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
|
|
20
|
-
dispose = value[Symbol.dispose];
|
|
21
|
-
if (async) inner = dispose;
|
|
22
|
-
}
|
|
23
|
-
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
|
|
24
|
-
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
|
|
25
|
-
env.stack.push({ value: value, dispose: dispose, async: async });
|
|
26
|
-
}
|
|
27
|
-
else if (async) {
|
|
28
|
-
env.stack.push({ async: true });
|
|
29
|
-
}
|
|
30
|
-
return value;
|
|
31
|
-
};
|
|
32
|
-
var __disposeResources = (this && this.__disposeResources) || (function (SuppressedError) {
|
|
33
|
-
return function (env) {
|
|
34
|
-
function fail(e) {
|
|
35
|
-
env.error = env.hasError ? new SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
|
|
36
|
-
env.hasError = true;
|
|
37
|
-
}
|
|
38
|
-
var r, s = 0;
|
|
39
|
-
function next() {
|
|
40
|
-
while (r = env.stack.pop()) {
|
|
41
|
-
try {
|
|
42
|
-
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
|
|
43
|
-
if (r.dispose) {
|
|
44
|
-
var result = r.dispose.call(r.value);
|
|
45
|
-
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
|
|
46
|
-
}
|
|
47
|
-
else s |= 1;
|
|
48
|
-
}
|
|
49
|
-
catch (e) {
|
|
50
|
-
fail(e);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
|
|
54
|
-
if (env.hasError) throw env.error;
|
|
55
|
-
}
|
|
56
|
-
return next();
|
|
57
|
-
};
|
|
58
|
-
})(typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
59
|
-
var e = new Error(message);
|
|
60
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
61
|
-
});
|
|
62
|
-
import { createNodeApi } from '../../src/lib/utils/polkadot.js';
|
|
63
|
-
import { getVersion, getProcess } from '../../src/lib/process/api.js';
|
|
64
|
-
import { utf8ToHex } from '../../src/lib/process/hex.js';
|
|
65
|
-
export const getVersionHelper = (name, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
-
const env_1 = { stack: [], error: void 0, hasError: false };
|
|
67
|
-
try {
|
|
68
|
-
const polkadot = __addDisposableResource(env_1, yield createNodeApi(options), true);
|
|
69
|
-
const version = yield getVersion(polkadot, utf8ToHex(name));
|
|
70
|
-
yield polkadot.api.disconnect();
|
|
71
|
-
return version;
|
|
72
|
-
}
|
|
73
|
-
catch (e_1) {
|
|
74
|
-
env_1.error = e_1;
|
|
75
|
-
env_1.hasError = true;
|
|
76
|
-
}
|
|
77
|
-
finally {
|
|
78
|
-
const result_1 = __disposeResources(env_1);
|
|
79
|
-
if (result_1)
|
|
80
|
-
yield result_1;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
export const Helper = (processId, version, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
84
|
-
const env_2 = { stack: [], error: void 0, hasError: false };
|
|
85
|
-
try {
|
|
86
|
-
const polkadot = __addDisposableResource(env_2, yield createNodeApi(options), true);
|
|
87
|
-
const process = yield getProcess(polkadot, processId, version);
|
|
88
|
-
yield polkadot.api.disconnect();
|
|
89
|
-
return process;
|
|
90
|
-
}
|
|
91
|
-
catch (e_2) {
|
|
92
|
-
env_2.error = e_2;
|
|
93
|
-
env_2.hasError = true;
|
|
94
|
-
}
|
|
95
|
-
finally {
|
|
96
|
-
const result_2 = __disposeResources(env_2);
|
|
97
|
-
if (result_2)
|
|
98
|
-
yield result_2;
|
|
99
|
-
}
|
|
100
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|