@muritavo/testing-toolkit 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/emulator.d.ts +1 -1
- package/dist/client/emulator.js +1 -1
- package/dist/native/blockchain.d.ts +1 -1
- package/dist/native/blockchain.js +1 -1
- package/dist/native/emulator.d.ts +2 -2
- package/dist/native/emulator.js +7 -6
- package/dist/native/emulator.js.map +1 -1
- package/dist/types/contract.d.ts +16 -16
- package/package.json +5 -5
package/dist/client/emulator.js
CHANGED
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -25,7 +25,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
25
25
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
26
|
function step(op) {
|
|
27
27
|
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
28
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
29
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
30
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
31
|
switch (op[0]) {
|
|
@@ -22,8 +22,8 @@ export declare function startEmulator(args: {
|
|
|
22
22
|
shouldSaveData: boolean;
|
|
23
23
|
only: ("functions" | "hosting" | "firestore" | "storage" | "auth")[] | string[];
|
|
24
24
|
}, isRetry?: boolean): Promise<null>;
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
type Admin = ReturnType<typeof _getAuthAdminInstance>;
|
|
26
|
+
type KeysWithValsOfType<T, V> = keyof {
|
|
27
27
|
[P in keyof T as T[P] extends V ? P : never]: P;
|
|
28
28
|
};
|
|
29
29
|
export declare function invokeAuthAdmin<F extends KeysWithValsOfType<Admin, (...params: any[]) => any>>({ projectId, port, functionName, params, }: {
|
package/dist/native/emulator.js
CHANGED
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -156,7 +156,7 @@ function startEmulator(args, isRetry) {
|
|
|
156
156
|
var unavailablePorts = args.ports.filter(function (p) {
|
|
157
157
|
return scriptOutput.includes(String(p));
|
|
158
158
|
});
|
|
159
|
-
var failedWithUnavailablePort = unavailablePorts.length;
|
|
159
|
+
var failedWithUnavailablePort = unavailablePorts.length && e !== 0;
|
|
160
160
|
if (failedWithUnavailablePort) {
|
|
161
161
|
log("Killing ports", unavailablePorts, "detected from text", scriptOutput);
|
|
162
162
|
Promise.all(unavailablePorts.map(function (p) { return (0, kill_port_1["default"])(p)["catch"](function () { }); })).then(function () {
|
|
@@ -167,7 +167,7 @@ function startEmulator(args, isRetry) {
|
|
|
167
167
|
});
|
|
168
168
|
}
|
|
169
169
|
else {
|
|
170
|
-
rej(new Error("Emulator closed with code ".concat(e, ". Check the
|
|
170
|
+
rej(new Error("Emulator closed with code ".concat(e, ". Check the firebase-debug.log for more details.\nCommand output was:\n").concat(scriptOutput)));
|
|
171
171
|
}
|
|
172
172
|
spawnResult = undefined;
|
|
173
173
|
});
|
|
@@ -211,11 +211,12 @@ function invokeAuthAdmin(_a) {
|
|
|
211
211
|
var app, func;
|
|
212
212
|
return __generator(this, function (_b) {
|
|
213
213
|
switch (_b.label) {
|
|
214
|
-
case 0:
|
|
215
|
-
|
|
214
|
+
case 0: return [4 /*yield*/, _getAuthAdminInstance(projectId, port)];
|
|
215
|
+
case 1:
|
|
216
|
+
app = _b.sent();
|
|
216
217
|
func = app[functionName];
|
|
217
218
|
return [4 /*yield*/, func.bind(app).apply(void 0, params)];
|
|
218
|
-
case
|
|
219
|
+
case 2:
|
|
219
220
|
_b.sent();
|
|
220
221
|
return [2 /*return*/, null];
|
|
221
222
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"emulator.js","sourceRoot":"","sources":["../../src/native/emulator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAmC;AACnC,+CAAoD;AACpD,wDAAiC;AACjC,mCAA4C;AAE5C,IAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,oCAAoC,CAAC,CAAC;AACnE,IAAI,WAKH,CAAC;AACF,SAAS,WAAW,CAAC,EAAQ;IAAR,mBAAA,EAAA,QAAQ;IAC3B,OAAO,IAAI,OAAO,CAAO,UAAC,CAAC;QACzB,UAAU,CAAC;YACT,CAAC,EAAE,CAAC;QACN,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,SAAsB,YAAY;;;YAChC,IAAI,CAAC,WAAW;gBAAE,sBAAO,OAAO,CAAC,OAAO,CAAC,I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CACJ;AApID,sCAoIC;AAOD,SAAsB,eAAe,CAEnC,EAUD;QATC,SAAS,eAAA,EACT,IAAI,UAAA,EACJ,YAAY,kBAAA,EACZ,MAAM,YAAA;;;;;wBAOM,qBAAM,qBAAqB,CAAC,SAAS,EAAE,IAAI,CAAC,EAAA;;oBAAlD,GAAG,GAAG,SAA4C;oBAClD,IAAI,GAAG,GAAG,CAAC,YAAY,CAAC,CAAC;oBAC/B,qBAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAS,eAAI,MAAM,GAAC;;oBAAxC,SAAwC,CAAC;oBACzC,sBAAO,IAAI,EAAC;;;;CACb;AAjBD,0CAiBC;AAED,IAAI,QAAQ,GAIR,EAAE,CAAC;AAEP,SAAe,qBAAqB,CAAC,SAAiB,EAAE,QAAgB;;;;YAC9D,aAAa,GAAK,OAAO,CAAC,oBAAoB,CAAC,cAAlC,CAAmC;YAChD,OAAO,GAAK,OAAO,CAAC,qBAAqB,CAAC,QAAnC,CAAoC;YACnD,OAAO,CAAC,GAAG,CAAC,2BAA2B,GAAG,UAAG,yBAAgB,cAAI,QAAQ,CAAE,CAAC;YAC5E,QAAQ,CAAC,SAAS,CAAC;gBACjB,QAAQ,CAAC,SAAS,CAAC,IAAI,aAAa,CAAC,EAAE,SAAS,WAAA,EAAE,EAAE,SAAS,CAAC,CAAC;YACjE,sBAAO,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,EAAC;;;CACrC"}
|
package/dist/types/contract.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Contract, ContractOptions, EventData, PastEventOptions } from "web3-eth-contract";
|
|
2
|
-
export
|
|
3
|
-
|
|
2
|
+
export type AllABIs = readonly any[];
|
|
3
|
+
type ExtractMethods<A extends AllABIs[number]> = A extends {
|
|
4
4
|
type: "function";
|
|
5
5
|
} ? A["name"] : never;
|
|
6
|
-
|
|
6
|
+
type ExtractEvents<A extends AllABIs[number]> = A extends {
|
|
7
7
|
type: "event";
|
|
8
8
|
} ? A["name"] : never;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
type TypeOrInternalType<T> = T['internalType'] extends unknown ? T['type'] : T['internalType'];
|
|
10
|
+
type MapTypeToJS<L, C> = L extends "tuple[]" ? TuplifyUnion<C[number], C[number]['name']>[] : L extends "address" | "uint256" | "uint128" | "uint8" | "string" | "bytes32" ? string : L extends "uint256[]" | "string[]" ? string[] : L extends "bool" ? boolean : L extends 'tuple' ? TuplifyUnion<C[number], C[number]['name']> : unknown;
|
|
11
|
+
type ExtractFromObj<R extends (AllABIs[number] & {
|
|
12
12
|
type: "function";
|
|
13
13
|
})> = {
|
|
14
14
|
[K in R["outputs"][number]["name"]]: MapTypeToJS<TypeOrInternalType<(R["outputs"][number] & {
|
|
@@ -17,7 +17,7 @@ declare type ExtractFromObj<R extends (AllABIs[number] & {
|
|
|
17
17
|
name: K;
|
|
18
18
|
})["components"]>;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type ExtractMethodDefinition<A extends AllABIs, N extends (AllABIs[number] & {
|
|
21
21
|
type: "function";
|
|
22
22
|
})["name"], R = A[number] & {
|
|
23
23
|
type: "function";
|
|
@@ -43,10 +43,10 @@ export declare type ExtractMethodDefinition<A extends AllABIs, N extends (AllABI
|
|
|
43
43
|
gasPrice?: string;
|
|
44
44
|
}) => Promise<void>;
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
export
|
|
46
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
47
|
+
type LastOf<T> = UnionToIntersection<T extends any ? () => T : never> extends () => infer R ? R : never;
|
|
48
|
+
type Push<T extends any[], V> = [...T, V];
|
|
49
|
+
export type TuplifyUnion<FUNCS, T, L = LastOf<T>, N = [T] extends [never] ? true : false> = true extends N ? [] : Push<TuplifyUnion<FUNCS, Exclude<T, L>>, MapTypeToJS<TypeOrInternalType<(FUNCS & {
|
|
50
50
|
name: L;
|
|
51
51
|
})>, (FUNCS & {
|
|
52
52
|
name: L;
|
|
@@ -62,18 +62,18 @@ export default class GenericContract<A extends AllABIs = AllABIs, E extends stri
|
|
|
62
62
|
getPastEvents(event: E, options: PastEventOptions): Promise<GenericEventData<A>[]>;
|
|
63
63
|
getPastEvents(event: E, callback: (error: Error, event: EventData) => void): Promise<GenericEventData<A>[]>;
|
|
64
64
|
}
|
|
65
|
-
export
|
|
66
|
-
|
|
65
|
+
export type GenericEventData<E extends AllABIs> = EventData & GenericEvent<E>;
|
|
66
|
+
type ABIEvent = AllABIs[number] & {
|
|
67
67
|
type: "event";
|
|
68
68
|
};
|
|
69
|
-
|
|
69
|
+
type GenericEvent<ABI extends AllABIs, E extends string = ExtractEvents<ABI[number]>> = {
|
|
70
70
|
event: E;
|
|
71
71
|
returnValues: ExtractReturnValues<ABIEvent & {
|
|
72
72
|
name: E;
|
|
73
73
|
}>;
|
|
74
74
|
};
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
type ExtractReturnValues<E extends ABIEvent> = ExtractInputType<E["inputs"][number]>;
|
|
76
|
+
type ExtractInputType<I extends ABIEvent["inputs"][number]> = {
|
|
77
77
|
[k in I["name"]]: MapTypeToJS<TypeOrInternalType<I>, I['components']>;
|
|
78
78
|
};
|
|
79
79
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muritavo/testing-toolkit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "A series of functions to help with testing",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"firebase": "^9.10.0",
|
|
25
25
|
"firebase-admin": "^11.5.0",
|
|
26
|
-
"text2png": "^2.3.0",
|
|
27
|
-
"web3": "^1.8.0",
|
|
28
26
|
"ganache": "^7.8.0",
|
|
29
|
-
"hardhat": "^2.14.1"
|
|
27
|
+
"hardhat": "^2.14.1",
|
|
28
|
+
"text2png": "^2.3.0",
|
|
29
|
+
"web3": "^1.8.0"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@firebase/rules-unit-testing": "^2.0.4",
|
|
@@ -34,6 +34,6 @@
|
|
|
34
34
|
"@types/node-fetch": "^2.6.2",
|
|
35
35
|
"kill-port": "^2.0.1",
|
|
36
36
|
"node-fetch": "^1",
|
|
37
|
-
"typescript": "^4.
|
|
37
|
+
"typescript": "^5.4.2"
|
|
38
38
|
}
|
|
39
39
|
}
|