@api3/commons 0.4.0 → 0.5.0
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/README.md +2 -0
- package/dist/blockchain-utilities/derivation.d.ts +78 -0
- package/dist/blockchain-utilities/derivation.d.ts.map +1 -0
- package/dist/blockchain-utilities/derivation.js +97 -0
- package/dist/blockchain-utilities/derivation.js.map +1 -0
- package/dist/blockchain-utilities/schema.d.ts +12 -0
- package/dist/blockchain-utilities/schema.d.ts.map +1 -0
- package/dist/blockchain-utilities/schema.js +13 -0
- package/dist/blockchain-utilities/schema.js.map +1 -0
- package/dist/logger/index.d.ts +1 -1
- package/dist/logger/index.d.ts.map +1 -1
- package/dist/logger/index.js.map +1 -1
- package/dist/processing/processing.d.ts +70 -18
- package/dist/processing/processing.d.ts.map +1 -1
- package/dist/processing/processing.js +145 -37
- package/dist/processing/processing.js.map +1 -1
- package/dist/processing/schema.d.ts +25 -2
- package/dist/processing/schema.d.ts.map +1 -1
- package/dist/processing/schema.js +10 -9
- package/dist/processing/schema.js.map +1 -1
- package/dist/processing/unsafe-evaluate.d.ts +1 -0
- package/dist/processing/unsafe-evaluate.d.ts.map +1 -1
- package/dist/processing/unsafe-evaluate.js +31 -1
- package/dist/processing/unsafe-evaluate.js.map +1 -1
- package/package.json +5 -3
- package/src/blockchain-utilities/README.md +5 -0
- package/src/blockchain-utilities/derivation.test.ts +147 -0
- package/src/blockchain-utilities/derivation.ts +116 -0
- package/src/blockchain-utilities/schema.test.ts +23 -0
- package/src/blockchain-utilities/schema.ts +14 -0
- package/src/logger/index.test.ts +16 -0
- package/src/logger/index.ts +8 -5
- package/src/processing/README.md +89 -14
- package/src/processing/processing.test.ts +429 -111
- package/src/processing/processing.ts +196 -47
- package/src/processing/schema.ts +21 -8
- package/src/processing/unsafe-evaluate.test.ts +220 -1
- package/src/processing/unsafe-evaluate.ts +39 -0
package/README.md
CHANGED
|
@@ -49,6 +49,8 @@ To release a new version follow these steps:
|
|
|
49
49
|
commit it.
|
|
50
50
|
3. `pnpm publish --access public` - Publish the new version to NPM.
|
|
51
51
|
4. `git push --follow-tags` - Push the tagged commit upstream.
|
|
52
|
+
5. Create a new [release on GitHub](https://github.com/api3dao/commons/releases). Use the "Generate release notes"
|
|
53
|
+
feature to generate the release notes from the PR titles.
|
|
52
54
|
|
|
53
55
|
## Development notes
|
|
54
56
|
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ethers } from 'ethers';
|
|
2
|
+
export declare const PROTOCOL_IDS: {
|
|
3
|
+
RRP: string;
|
|
4
|
+
PSP: string;
|
|
5
|
+
RELAYED_RRP: string;
|
|
6
|
+
RELAYED_PSP: string;
|
|
7
|
+
AIRSEEKER: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* An interface that reflects the structure of a Template
|
|
11
|
+
*/
|
|
12
|
+
export interface Template {
|
|
13
|
+
airnode: string;
|
|
14
|
+
encodedParameters: string;
|
|
15
|
+
endpointId: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Derives a template ID from the input parameters
|
|
19
|
+
*
|
|
20
|
+
* @param airnode an Airnode address
|
|
21
|
+
* @param encodedParameters encoded parameters, see the airnode/abi package's encode function
|
|
22
|
+
* @param endpointId An endpointID (see deriveEndpointId)
|
|
23
|
+
*/
|
|
24
|
+
export declare const deriveTemplateId: ({ airnode, encodedParameters, endpointId }: Template) => string;
|
|
25
|
+
/**
|
|
26
|
+
* Derives an endpoint ID
|
|
27
|
+
*
|
|
28
|
+
* @param oisTitle the OIS title
|
|
29
|
+
* @param endpointName the endpoint name
|
|
30
|
+
*/
|
|
31
|
+
export declare const deriveEndpointId: (oisTitle: string, endpointName: string) => string;
|
|
32
|
+
/**
|
|
33
|
+
* Derives an airnode address's xpub, required for allowing signed data consumers to verify authenticity
|
|
34
|
+
*
|
|
35
|
+
* @param airnodeMnemonic the airnode's mnemonic
|
|
36
|
+
*/
|
|
37
|
+
export declare const deriveAirnodeXpub: (airnodeMnemonic: string) => string;
|
|
38
|
+
/**
|
|
39
|
+
* Derives a wallet path from a sponsor address, used for calculating a sponsor wallet.
|
|
40
|
+
*
|
|
41
|
+
* @param sponsorAddress an EVM-compatible address
|
|
42
|
+
* @param protocolId an API application protocol ID
|
|
43
|
+
*/
|
|
44
|
+
export declare function deriveWalletPathFromSponsorAddress(sponsorAddress: string, protocolId: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Encodes/formats a string as a hex-encoded bytes32 string.
|
|
47
|
+
*
|
|
48
|
+
* @param input the input string
|
|
49
|
+
*/
|
|
50
|
+
export declare const toBytes32String: (input: string) => string;
|
|
51
|
+
/**
|
|
52
|
+
* Decodes a hex-encoded bytes32 string to a normal string.
|
|
53
|
+
*
|
|
54
|
+
* @param input the input hex string
|
|
55
|
+
*/
|
|
56
|
+
export declare const fromBytes32String: (input: string) => string;
|
|
57
|
+
/**
|
|
58
|
+
* Derives a sponsor wallet, given a mnemonic and dapiName.
|
|
59
|
+
*
|
|
60
|
+
* @param sponsorWalletMnemonic the sponsor wallet mnemonic
|
|
61
|
+
* @param dapiName the dapi name
|
|
62
|
+
*/
|
|
63
|
+
export declare const deriveSponsorWallet: (sponsorWalletMnemonic: string, dapiName: string) => ethers.Wallet;
|
|
64
|
+
/**
|
|
65
|
+
* Derives the ID of a single beacon
|
|
66
|
+
*
|
|
67
|
+
* @param airnodeAddress the airnode address of the provider that supplies the data used to update this beacon
|
|
68
|
+
* @param templateId the templateId of the template used to generate the data used to update this beacon
|
|
69
|
+
*/
|
|
70
|
+
export declare const deriveBeaconId: (airnodeAddress: string, templateId: string) => string;
|
|
71
|
+
/**
|
|
72
|
+
* Derives the ID of a set of beacons.
|
|
73
|
+
* By convention beacon IDs are sorted alphabetically - the ordering impacts the resulting hash.
|
|
74
|
+
*
|
|
75
|
+
* @param beaconIds an ordered array of beacon ids
|
|
76
|
+
*/
|
|
77
|
+
export declare const deriveBeaconSetId: (beaconIds: string[]) => string;
|
|
78
|
+
//# sourceMappingURL=derivation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivation.d.ts","sourceRoot":"","sources":["../../src/blockchain-utilities/derivation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,eAAO,MAAM,YAAY;;;;;;CAMxB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,+CAAgD,QAAQ,WACsB,CAAC;AAE5G;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,aAAc,MAAM,gBAAgB,MAAM,WACsC,CAAC;AAE9G;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,oBAAqB,MAAM,WAC0C,CAAC;AAEpG;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,UAU5F;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,UAAW,MAAM,WAA4C,CAAC;AAE1F;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,UAAW,MAAM,WAA2C,CAAC;AAE3F;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,0BAA2B,MAAM,YAAY,MAAM,kBAWlF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,mBAAoB,MAAM,cAAc,MAAM,WACa,CAAC;AAEvF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,cAAe,MAAM,EAAE,WACoC,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deriveBeaconSetId = exports.deriveBeaconId = exports.deriveSponsorWallet = exports.fromBytes32String = exports.toBytes32String = exports.deriveWalletPathFromSponsorAddress = exports.deriveAirnodeXpub = exports.deriveEndpointId = exports.deriveTemplateId = exports.PROTOCOL_IDS = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const schema_1 = require("./schema");
|
|
6
|
+
exports.PROTOCOL_IDS = {
|
|
7
|
+
RRP: '1',
|
|
8
|
+
PSP: '2',
|
|
9
|
+
RELAYED_RRP: '3',
|
|
10
|
+
RELAYED_PSP: '4',
|
|
11
|
+
AIRSEEKER: '5',
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Derives a template ID from the input parameters
|
|
15
|
+
*
|
|
16
|
+
* @param airnode an Airnode address
|
|
17
|
+
* @param encodedParameters encoded parameters, see the airnode/abi package's encode function
|
|
18
|
+
* @param endpointId An endpointID (see deriveEndpointId)
|
|
19
|
+
*/
|
|
20
|
+
const deriveTemplateId = ({ airnode, encodedParameters, endpointId }) => ethers_1.ethers.utils.solidityKeccak256(['address', 'bytes32', 'bytes'], [airnode, endpointId, encodedParameters]);
|
|
21
|
+
exports.deriveTemplateId = deriveTemplateId;
|
|
22
|
+
/**
|
|
23
|
+
* Derives an endpoint ID
|
|
24
|
+
*
|
|
25
|
+
* @param oisTitle the OIS title
|
|
26
|
+
* @param endpointName the endpoint name
|
|
27
|
+
*/
|
|
28
|
+
const deriveEndpointId = (oisTitle, endpointName) => ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.defaultAbiCoder.encode(['string', 'string'], [oisTitle, endpointName]));
|
|
29
|
+
exports.deriveEndpointId = deriveEndpointId;
|
|
30
|
+
/**
|
|
31
|
+
* Derives an airnode address's xpub, required for allowing signed data consumers to verify authenticity
|
|
32
|
+
*
|
|
33
|
+
* @param airnodeMnemonic the airnode's mnemonic
|
|
34
|
+
*/
|
|
35
|
+
const deriveAirnodeXpub = (airnodeMnemonic) => ethers_1.ethers.utils.HDNode.fromMnemonic(airnodeMnemonic).derivePath("m/44'/60'/0'").neuter().extendedKey;
|
|
36
|
+
exports.deriveAirnodeXpub = deriveAirnodeXpub;
|
|
37
|
+
/**
|
|
38
|
+
* Derives a wallet path from a sponsor address, used for calculating a sponsor wallet.
|
|
39
|
+
*
|
|
40
|
+
* @param sponsorAddress an EVM-compatible address
|
|
41
|
+
* @param protocolId an API application protocol ID
|
|
42
|
+
*/
|
|
43
|
+
function deriveWalletPathFromSponsorAddress(sponsorAddress, protocolId) {
|
|
44
|
+
schema_1.addressSchema.parse(sponsorAddress);
|
|
45
|
+
const sponsorAddressBN = ethers_1.ethers.BigNumber.from(sponsorAddress);
|
|
46
|
+
const paths = [];
|
|
47
|
+
for (let i = 0; i < 6; i++) {
|
|
48
|
+
const shiftedSponsorAddressBN = sponsorAddressBN.shr(31 * i);
|
|
49
|
+
paths.push(shiftedSponsorAddressBN.mask(31).toString());
|
|
50
|
+
}
|
|
51
|
+
return `${protocolId}/${paths.join('/')}`;
|
|
52
|
+
}
|
|
53
|
+
exports.deriveWalletPathFromSponsorAddress = deriveWalletPathFromSponsorAddress;
|
|
54
|
+
/**
|
|
55
|
+
* Encodes/formats a string as a hex-encoded bytes32 string.
|
|
56
|
+
*
|
|
57
|
+
* @param input the input string
|
|
58
|
+
*/
|
|
59
|
+
const toBytes32String = (input) => ethers_1.ethers.utils.formatBytes32String(input);
|
|
60
|
+
exports.toBytes32String = toBytes32String;
|
|
61
|
+
/**
|
|
62
|
+
* Decodes a hex-encoded bytes32 string to a normal string.
|
|
63
|
+
*
|
|
64
|
+
* @param input the input hex string
|
|
65
|
+
*/
|
|
66
|
+
const fromBytes32String = (input) => ethers_1.ethers.utils.parseBytes32String(input);
|
|
67
|
+
exports.fromBytes32String = fromBytes32String;
|
|
68
|
+
/**
|
|
69
|
+
* Derives a sponsor wallet, given a mnemonic and dapiName.
|
|
70
|
+
*
|
|
71
|
+
* @param sponsorWalletMnemonic the sponsor wallet mnemonic
|
|
72
|
+
* @param dapiName the dapi name
|
|
73
|
+
*/
|
|
74
|
+
const deriveSponsorWallet = (sponsorWalletMnemonic, dapiName) => {
|
|
75
|
+
// Take first 20 bytes of dapiName as sponsor address together with the "0x" prefix.
|
|
76
|
+
const sponsorAddress = ethers_1.ethers.utils.getAddress(dapiName.slice(0, 42));
|
|
77
|
+
const sponsorWallet = ethers_1.ethers.Wallet.fromMnemonic(sponsorWalletMnemonic, `m/44'/60'/0'/${(deriveWalletPathFromSponsorAddress(sponsorAddress, exports.PROTOCOL_IDS.AIRSEEKER), exports.PROTOCOL_IDS.AIRSEEKER)}`);
|
|
78
|
+
return sponsorWallet;
|
|
79
|
+
};
|
|
80
|
+
exports.deriveSponsorWallet = deriveSponsorWallet;
|
|
81
|
+
/**
|
|
82
|
+
* Derives the ID of a single beacon
|
|
83
|
+
*
|
|
84
|
+
* @param airnodeAddress the airnode address of the provider that supplies the data used to update this beacon
|
|
85
|
+
* @param templateId the templateId of the template used to generate the data used to update this beacon
|
|
86
|
+
*/
|
|
87
|
+
const deriveBeaconId = (airnodeAddress, templateId) => ethers_1.ethers.utils.solidityKeccak256(['address', 'bytes32'], [airnodeAddress, templateId]);
|
|
88
|
+
exports.deriveBeaconId = deriveBeaconId;
|
|
89
|
+
/**
|
|
90
|
+
* Derives the ID of a set of beacons.
|
|
91
|
+
* By convention beacon IDs are sorted alphabetically - the ordering impacts the resulting hash.
|
|
92
|
+
*
|
|
93
|
+
* @param beaconIds an ordered array of beacon ids
|
|
94
|
+
*/
|
|
95
|
+
const deriveBeaconSetId = (beaconIds) => ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.defaultAbiCoder.encode(['bytes32[]'], [beaconIds]));
|
|
96
|
+
exports.deriveBeaconSetId = deriveBeaconSetId;
|
|
97
|
+
//# sourceMappingURL=derivation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivation.js","sourceRoot":"","sources":["../../src/blockchain-utilities/derivation.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAEhC,qCAAyC;AAE5B,QAAA,YAAY,GAAG;IAC1B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AAE,SAAS,CAAC,EAAE,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;AAD1E,QAAA,cAAc,kBAC4D;AAEvF;;;;;GAKG;AACI,MAAM,iBAAiB,GAAG,CAAC,SAAmB,EAAE,EAAE,CACvD,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,eAAM,CAAC,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAD7E,QAAA,iBAAiB,qBAC4D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* A Zod validation schema that represents an EVM-compatible address.
|
|
4
|
+
*/
|
|
5
|
+
export declare const addressSchema: z.ZodString;
|
|
6
|
+
/**
|
|
7
|
+
* A Zod validation schema that represents an EVM-compatible hash, which includes beacon IDs and template IDs.
|
|
8
|
+
*/
|
|
9
|
+
export declare const idSchema: z.ZodString;
|
|
10
|
+
export type Address = z.infer<typeof addressSchema>;
|
|
11
|
+
export type Id = z.infer<typeof idSchema>;
|
|
12
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/blockchain-utilities/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,aAAa,aAAwE,CAAC;AAEnG;;GAEG;AACH,eAAO,MAAM,QAAQ,aAAqE,CAAC;AAE3F,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AACpD,MAAM,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.idSchema = exports.addressSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* A Zod validation schema that represents an EVM-compatible address.
|
|
7
|
+
*/
|
|
8
|
+
exports.addressSchema = zod_1.z.string().regex(/^0x[\dA-Fa-f]{40}$/, 'Must be a valid EVM address');
|
|
9
|
+
/**
|
|
10
|
+
* A Zod validation schema that represents an EVM-compatible hash, which includes beacon IDs and template IDs.
|
|
11
|
+
*/
|
|
12
|
+
exports.idSchema = zod_1.z.string().regex(/^0x[\dA-Fa-f]{64}$/, 'Must be a valid EVM hash');
|
|
13
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/blockchain-utilities/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB;;GAEG;AACU,QAAA,aAAa,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,oBAAoB,EAAE,6BAA6B,CAAC,CAAC;AAEnG;;GAEG;AACU,QAAA,QAAQ,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,oBAAoB,EAAE,0BAA0B,CAAC,CAAC"}
|
package/dist/logger/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface Logger {
|
|
|
16
16
|
debug: (message: string, context?: LogContext) => void;
|
|
17
17
|
info: (message: string, context?: LogContext) => void;
|
|
18
18
|
warn: (message: string, context?: LogContext) => void;
|
|
19
|
-
error: ((message: string, context?: LogContext) => void)
|
|
19
|
+
error: ((message: string, context?: LogContext) => void) & ((message: string, error: Error, context?: LogContext) => void);
|
|
20
20
|
child: (options: {
|
|
21
21
|
name: string;
|
|
22
22
|
}) => Logger;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MA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AAiB,EAAE,EAAE;IAChD,iDAAiD;IACjD,OAAO,IAAA,eAAO,EAAC,IAAA,wBAAgB,EAAC,IAAA,yBAAiB,EAAC,MAAM,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC,CAAC;AAHW,QAAA,YAAY,gBAGvB"}
|
|
@@ -1,39 +1,91 @@
|
|
|
1
1
|
import { type Endpoint } from '@api3/ois';
|
|
2
2
|
import { type GoAsyncOptions } from '@api3/promise-utils';
|
|
3
|
-
import { type
|
|
3
|
+
import { type EndpointParameters, type PreProcessingV2Response, type PostProcessingV2Response, type ProcessingSpecificationV2, type ProcessingSpecifications } from './schema';
|
|
4
4
|
export declare const DEFAULT_PROCESSING_TIMEOUT_MS = 10000;
|
|
5
5
|
/**
|
|
6
|
-
* Removes reserved parameters from the parameters
|
|
7
|
-
* @param parameters The
|
|
8
|
-
* @returns The parameters
|
|
6
|
+
* Removes reserved parameters from the endpoint parameters.
|
|
7
|
+
* @param parameters The endpoint parameters from which reserved parameters will be removed.
|
|
8
|
+
* @returns The endpoint parameters without reserved parameters.
|
|
9
9
|
*/
|
|
10
|
-
export declare const removeReservedParameters: (parameters:
|
|
10
|
+
export declare const removeReservedParameters: (parameters: EndpointParameters) => EndpointParameters;
|
|
11
11
|
/**
|
|
12
|
-
* Re-inserts reserved parameters from the initial parameters
|
|
13
|
-
* @param initialParameters The initial
|
|
14
|
-
* @param modifiedParameters The modified
|
|
15
|
-
* @returns The modified parameters
|
|
12
|
+
* Re-inserts reserved parameters from the initial endpoint parameters into the modified endpoint parameters.
|
|
13
|
+
* @param initialParameters The initial endpoint parameters that might contain reserved parameters.
|
|
14
|
+
* @param modifiedParameters The modified endpoint parameters to which reserved parameters will be added.
|
|
15
|
+
* @returns The modified endpoint parameters with re-inserted reserved parameters.
|
|
16
16
|
*/
|
|
17
|
-
export declare const addReservedParameters: (initialParameters:
|
|
17
|
+
export declare const addReservedParameters: (initialParameters: EndpointParameters, modifiedParameters: EndpointParameters) => EndpointParameters;
|
|
18
18
|
/**
|
|
19
|
-
* Pre-processes
|
|
19
|
+
* Pre-processes endpoint parameters based on the provided endpoint's processing specifications.
|
|
20
|
+
*
|
|
21
|
+
* @param preProcessingSpecifications The v1 pre-processing specifications.
|
|
22
|
+
* @param endpointParameters The parameters to be pre-processed.
|
|
23
|
+
* @param processingOptions Options to control the async processing behavior like retries and timeouts.
|
|
24
|
+
*
|
|
25
|
+
* @returns A promise that resolves to the pre-processed parameters.
|
|
26
|
+
*/
|
|
27
|
+
export declare const preProcessEndpointParametersV1: (preProcessingSpecifications: ProcessingSpecifications | undefined, endpointParameters: EndpointParameters, processingOptions?: GoAsyncOptions) => Promise<EndpointParameters>;
|
|
28
|
+
/**
|
|
29
|
+
* Post-processes the response based on the provided endpoint's processing specifications. The response is usually the
|
|
30
|
+
* API call response, but this logic depends on how the processing is used by the target service. For example, Airnode
|
|
31
|
+
* allows skipping API calls in which case the response is the result of pre-processing.
|
|
32
|
+
*
|
|
33
|
+
* @param response The response to be post-processed.
|
|
34
|
+
* @param postProcessingSpecifications The v1 post-processing specifications.
|
|
35
|
+
* @param endpointParameters The endpoint parameters.
|
|
36
|
+
* @param processingOptions Options to control the async processing behavior like retries and timeouts.
|
|
37
|
+
*
|
|
38
|
+
* @returns A promise that resolves to the post-processed response.
|
|
39
|
+
*/
|
|
40
|
+
export declare const postProcessResponseV1: (response: unknown, postProcessingSpecifications: ProcessingSpecifications | undefined, endpointParameters: EndpointParameters, processingOptions?: GoAsyncOptions) => Promise<unknown>;
|
|
41
|
+
/**
|
|
42
|
+
* Pre-processes endpoint parameters based on the provided endpoint's processing specifications.
|
|
43
|
+
*
|
|
44
|
+
* @param preProcessingSpecificationV2 The v2 pre-processing specification.
|
|
45
|
+
* @param endpointParameters The parameters to be pre-processed.
|
|
46
|
+
* @param processingOptions Options to control the async processing behavior like retries and timeouts.
|
|
47
|
+
*
|
|
48
|
+
* @returns A promise that resolves to the pre-processed parameters.
|
|
49
|
+
*/
|
|
50
|
+
export declare const preProcessEndpointParametersV2: (preProcessingSpecificationV2: ProcessingSpecificationV2 | undefined, endpointParameters: EndpointParameters, processingOptions?: GoAsyncOptions) => Promise<PreProcessingV2Response>;
|
|
51
|
+
/**
|
|
52
|
+
* Post-processes the response based on the provided endpoint's processing specifications. The response is usually the
|
|
53
|
+
* API call response, but this logic depends on how the processing is used by the target service. For example, Airnode
|
|
54
|
+
* allows skipping API calls in which case the response is the result of pre-processing.
|
|
55
|
+
*
|
|
56
|
+
* @param response The response to be post-processed.
|
|
57
|
+
* @param postProcessingSpecificationV2 The v2 post-processing specification.
|
|
58
|
+
* @param endpointParameters The endpoint parameters.
|
|
59
|
+
* @param processingOptions Options to control the async processing behavior like retries and timeouts.
|
|
60
|
+
*
|
|
61
|
+
* @returns A promise that resolves to the post-processed response.
|
|
62
|
+
*/
|
|
63
|
+
export declare const postProcessResponseV2: (response: unknown, postProcessingSpecificationV2: ProcessingSpecificationV2 | undefined, endpointParameters: EndpointParameters, processingOptions?: GoAsyncOptions) => Promise<PostProcessingV2Response>;
|
|
64
|
+
/**
|
|
65
|
+
* Pre-processes endpoint parameters based on the provided endpoint's processing specifications. Internally it
|
|
66
|
+
* determines what processing implementation should be used.
|
|
20
67
|
*
|
|
21
68
|
* @param endpoint The endpoint containing processing specifications.
|
|
22
|
-
* @param
|
|
69
|
+
* @param endpointParameters The parameters to be pre-processed.
|
|
23
70
|
* @param processingOptions Options to control the async processing behavior like retries and timeouts.
|
|
24
71
|
*
|
|
25
72
|
* @returns A promise that resolves to the pre-processed parameters.
|
|
26
73
|
*/
|
|
27
|
-
export declare const
|
|
74
|
+
export declare const preProcessEndpointParameters: (endpoint: Endpoint, endpointParameters: EndpointParameters, processingOptions?: GoAsyncOptions) => Promise<PreProcessingV2Response>;
|
|
28
75
|
/**
|
|
29
|
-
* Post-processes the
|
|
76
|
+
* Post-processes the response based on the provided endpoint's processing specifications. The response is usually the
|
|
77
|
+
* API call response, but this logic depends on how the processing is used by the target service. For example, Airnode
|
|
78
|
+
* allows skipping API calls in which case the response is the result of pre-processing.
|
|
79
|
+
*
|
|
80
|
+
* This function determines what processing version should be used and provides a common interface. This is useful for
|
|
81
|
+
* services that want to use processing and don't care which processing version is used.
|
|
30
82
|
*
|
|
31
|
-
* @param
|
|
83
|
+
* @param response The response to be post-processed.
|
|
32
84
|
* @param endpoint The endpoint containing processing specifications.
|
|
33
|
-
* @param
|
|
85
|
+
* @param endpointParameters The endpoint parameters.
|
|
34
86
|
* @param processingOptions Options to control the async processing behavior like retries and timeouts.
|
|
35
87
|
*
|
|
36
|
-
* @returns A promise that resolves to the post-processed
|
|
88
|
+
* @returns A promise that resolves to the post-processed response.
|
|
37
89
|
*/
|
|
38
|
-
export declare const
|
|
90
|
+
export declare const postProcessResponse: (response: unknown, endpoint: Endpoint, endpointParameters: EndpointParameters, processingOptions?: GoAsyncOptions) => Promise<PostProcessingV2Response>;
|
|
39
91
|
//# sourceMappingURL=processing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processing.d.ts","sourceRoot":"","sources":["../../src/processing/processing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAuB,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,KAAK,cAAc,EAAM,MAAM,qBAAqB,CAAC;AAE9D,OAAO,
|
|
1
|
+
{"version":3,"file":"processing.d.ts","sourceRoot":"","sources":["../../src/processing/processing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAuB,MAAM,WAAW,CAAC;AAC/D,OAAO,EAAE,KAAK,cAAc,EAAM,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EACL,KAAK,kBAAkB,EAIvB,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC9B,MAAM,UAAU,CAAC;AAGlB,eAAO,MAAM,6BAA6B,QAAS,CAAC;AAIpD;;;;GAIG;AACH,eAAO,MAAM,wB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