@getpara/rest-sdk 3.21.0 → 3.23.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/dist/cjs/index.js +6 -2
- package/dist/cjs/permissions.js +10 -2
- package/dist/esm/index.js +6 -2
- package/dist/esm/permissions.js +10 -2
- package/dist/types/index.d.ts +15 -8
- package/dist/types/permissions.d.ts +6 -3
- package/dist/types/webhooks.d.ts +1 -1
- package/package.json +3 -3
package/dist/cjs/index.js
CHANGED
|
@@ -56,7 +56,8 @@ class ParaRestError extends Error {
|
|
|
56
56
|
code,
|
|
57
57
|
requestId,
|
|
58
58
|
body,
|
|
59
|
-
message
|
|
59
|
+
message,
|
|
60
|
+
affectedCaseIds
|
|
60
61
|
}) {
|
|
61
62
|
var _a;
|
|
62
63
|
super((_a = message != null ? message : code) != null ? _a : `Para REST request failed with status ${status}`);
|
|
@@ -65,6 +66,7 @@ class ParaRestError extends Error {
|
|
|
65
66
|
this.code = code;
|
|
66
67
|
this.requestId = requestId;
|
|
67
68
|
this.body = body;
|
|
69
|
+
this.affectedCaseIds = affectedCaseIds;
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
class ParaRestSerializationError extends Error {
|
|
@@ -273,12 +275,14 @@ class ParaRestClient extends import_permissions.RestPermissionsClient {
|
|
|
273
275
|
const parsed = yield parseBody(response);
|
|
274
276
|
if (!response.ok || expectedStatus != null && response.status !== expectedStatus) {
|
|
275
277
|
const responseBody = isRecord(parsed) ? parsed : {};
|
|
278
|
+
const affectedCaseIds = responseBody.affectedCaseIds;
|
|
276
279
|
throw new ParaRestError({
|
|
277
280
|
status: response.status,
|
|
278
281
|
code: stringField(responseBody.code),
|
|
279
282
|
requestId: (_a = response.headers.get("x-request-id")) != null ? _a : requestId,
|
|
280
283
|
body: parsed,
|
|
281
|
-
message: stringField(responseBody.message)
|
|
284
|
+
message: stringField(responseBody.message),
|
|
285
|
+
affectedCaseIds: Array.isArray(affectedCaseIds) && affectedCaseIds.every((caseId) => typeof caseId === "string") ? affectedCaseIds : void 0
|
|
282
286
|
});
|
|
283
287
|
}
|
|
284
288
|
return parsed;
|
package/dist/cjs/permissions.js
CHANGED
|
@@ -135,8 +135,13 @@ class RestPermissionsClient {
|
|
|
135
135
|
updateApprovalConfiguration(reference, body, options) {
|
|
136
136
|
return this.request("PUT", `${requirementPath(reference)}/configuration`, { body, options });
|
|
137
137
|
}
|
|
138
|
-
resetApprovalConfiguration(reference,
|
|
139
|
-
|
|
138
|
+
resetApprovalConfiguration(reference, reset, options) {
|
|
139
|
+
const { expectedRevision, force } = typeof reset === "number" ? { expectedRevision: reset, force: void 0 } : reset;
|
|
140
|
+
return this.updateApprovalConfiguration(
|
|
141
|
+
reference,
|
|
142
|
+
__spreadValues({ expectedRevision, values: {} }, force === void 0 ? {} : { force }),
|
|
143
|
+
options
|
|
144
|
+
);
|
|
140
145
|
}
|
|
141
146
|
listApprovalConfigurationHistory(reference, options) {
|
|
142
147
|
return this.request("GET", `${requirementPath(reference)}/configuration/history`, { options });
|
|
@@ -202,6 +207,9 @@ class RestPermissionsClient {
|
|
|
202
207
|
getPartnerApprovalCase(caseId, options) {
|
|
203
208
|
return this.request("GET", `${basePath}/approval-cases/${(0, import_validation.pathSegment)("caseId", caseId)}`, { options });
|
|
204
209
|
}
|
|
210
|
+
cancelPartnerApprovalCase(caseId, options) {
|
|
211
|
+
return this.request("POST", `${basePath}/approval-cases/${(0, import_validation.pathSegment)("caseId", caseId)}/cancel`, { options });
|
|
212
|
+
}
|
|
205
213
|
getPartnerPolicyUsage(policyId, context, options) {
|
|
206
214
|
const _a = context, { userId, walletId } = _a, query = __objRest(_a, ["userId", "walletId"]);
|
|
207
215
|
const subjectPath = userId ? `users/${(0, import_validation.pathSegment)("userId", userId)}` : `wallets/${(0, import_validation.pathSegment)("walletId", walletId)}`;
|
package/dist/esm/index.js
CHANGED
|
@@ -29,7 +29,8 @@ class ParaRestError extends Error {
|
|
|
29
29
|
code,
|
|
30
30
|
requestId,
|
|
31
31
|
body,
|
|
32
|
-
message
|
|
32
|
+
message,
|
|
33
|
+
affectedCaseIds
|
|
33
34
|
}) {
|
|
34
35
|
var _a;
|
|
35
36
|
super((_a = message != null ? message : code) != null ? _a : `Para REST request failed with status ${status}`);
|
|
@@ -38,6 +39,7 @@ class ParaRestError extends Error {
|
|
|
38
39
|
this.code = code;
|
|
39
40
|
this.requestId = requestId;
|
|
40
41
|
this.body = body;
|
|
42
|
+
this.affectedCaseIds = affectedCaseIds;
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
class ParaRestSerializationError extends Error {
|
|
@@ -246,12 +248,14 @@ class ParaRestClient extends RestPermissionsClient {
|
|
|
246
248
|
const parsed = yield parseBody(response);
|
|
247
249
|
if (!response.ok || expectedStatus != null && response.status !== expectedStatus) {
|
|
248
250
|
const responseBody = isRecord(parsed) ? parsed : {};
|
|
251
|
+
const affectedCaseIds = responseBody.affectedCaseIds;
|
|
249
252
|
throw new ParaRestError({
|
|
250
253
|
status: response.status,
|
|
251
254
|
code: stringField(responseBody.code),
|
|
252
255
|
requestId: (_a = response.headers.get("x-request-id")) != null ? _a : requestId,
|
|
253
256
|
body: parsed,
|
|
254
|
-
message: stringField(responseBody.message)
|
|
257
|
+
message: stringField(responseBody.message),
|
|
258
|
+
affectedCaseIds: Array.isArray(affectedCaseIds) && affectedCaseIds.every((caseId) => typeof caseId === "string") ? affectedCaseIds : void 0
|
|
255
259
|
});
|
|
256
260
|
}
|
|
257
261
|
return parsed;
|
package/dist/esm/permissions.js
CHANGED
|
@@ -115,8 +115,13 @@ class RestPermissionsClient {
|
|
|
115
115
|
updateApprovalConfiguration(reference, body, options) {
|
|
116
116
|
return this.request("PUT", `${requirementPath(reference)}/configuration`, { body, options });
|
|
117
117
|
}
|
|
118
|
-
resetApprovalConfiguration(reference,
|
|
119
|
-
|
|
118
|
+
resetApprovalConfiguration(reference, reset, options) {
|
|
119
|
+
const { expectedRevision, force } = typeof reset === "number" ? { expectedRevision: reset, force: void 0 } : reset;
|
|
120
|
+
return this.updateApprovalConfiguration(
|
|
121
|
+
reference,
|
|
122
|
+
__spreadValues({ expectedRevision, values: {} }, force === void 0 ? {} : { force }),
|
|
123
|
+
options
|
|
124
|
+
);
|
|
120
125
|
}
|
|
121
126
|
listApprovalConfigurationHistory(reference, options) {
|
|
122
127
|
return this.request("GET", `${requirementPath(reference)}/configuration/history`, { options });
|
|
@@ -182,6 +187,9 @@ class RestPermissionsClient {
|
|
|
182
187
|
getPartnerApprovalCase(caseId, options) {
|
|
183
188
|
return this.request("GET", `${basePath}/approval-cases/${pathSegment("caseId", caseId)}`, { options });
|
|
184
189
|
}
|
|
190
|
+
cancelPartnerApprovalCase(caseId, options) {
|
|
191
|
+
return this.request("POST", `${basePath}/approval-cases/${pathSegment("caseId", caseId)}/cancel`, { options });
|
|
192
|
+
}
|
|
185
193
|
getPartnerPolicyUsage(policyId, context, options) {
|
|
186
194
|
const _a = context, { userId, walletId } = _a, query = __objRest(_a, ["userId", "walletId"]);
|
|
187
195
|
const subjectPath = userId ? `users/${pathSegment("userId", userId)}` : `wallets/${pathSegment("walletId", walletId)}`;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OnrampCompletedPayload, TPregenIdentifierType, TWalletScheme, TWalletType } from '@getpara/shared';
|
|
1
|
+
import type { OnrampCompletedPayload, PermissionsV2SigningInitiatorRequest, TPregenIdentifierType, TWalletScheme, TWalletType } from '@getpara/shared';
|
|
2
2
|
import { RestPermissionsClient } from './permissions.js';
|
|
3
3
|
export * from './permissions.js';
|
|
4
4
|
export * from './webhooks.js';
|
|
@@ -69,7 +69,8 @@ export interface WalletBalanceResponse {
|
|
|
69
69
|
symbol: string;
|
|
70
70
|
rawBalance: string;
|
|
71
71
|
}
|
|
72
|
-
export
|
|
72
|
+
export type RestSigningInitiator = PermissionsV2SigningInitiatorRequest;
|
|
73
|
+
export interface SignRawRequest extends RestSigningInitiator {
|
|
73
74
|
data: string;
|
|
74
75
|
encoding?: 'hex';
|
|
75
76
|
walletType?: WalletType;
|
|
@@ -77,13 +78,13 @@ export interface SignRawRequest {
|
|
|
77
78
|
export interface SignRawResponse {
|
|
78
79
|
signature: string;
|
|
79
80
|
}
|
|
80
|
-
export interface SignMessageRequest {
|
|
81
|
+
export interface SignMessageRequest extends RestSigningInitiator {
|
|
81
82
|
message: string;
|
|
82
83
|
}
|
|
83
84
|
export interface SignMessageResponse {
|
|
84
85
|
signature: string;
|
|
85
86
|
}
|
|
86
|
-
export interface SignTransactionRequest {
|
|
87
|
+
export interface SignTransactionRequest extends RestSigningInitiator {
|
|
87
88
|
transaction: EvmSignTransactionRequest | string;
|
|
88
89
|
broadcast?: boolean;
|
|
89
90
|
network?: SolanaNetwork | SuiNetwork;
|
|
@@ -115,13 +116,13 @@ export interface TypedDataPayload {
|
|
|
115
116
|
primaryType: string;
|
|
116
117
|
message: Record<string, unknown>;
|
|
117
118
|
}
|
|
118
|
-
export interface SignTypedDataRequest {
|
|
119
|
+
export interface SignTypedDataRequest extends RestSigningInitiator {
|
|
119
120
|
typedData: TypedDataPayload;
|
|
120
121
|
}
|
|
121
122
|
export interface SignTypedDataResponse {
|
|
122
123
|
signature: string;
|
|
123
124
|
}
|
|
124
|
-
export interface SignAuthorizationRequest {
|
|
125
|
+
export interface SignAuthorizationRequest extends RestSigningInitiator {
|
|
125
126
|
authorization: SignAuthorizationPayload;
|
|
126
127
|
}
|
|
127
128
|
export type SignAuthorizationPayload = ({
|
|
@@ -143,7 +144,7 @@ export interface SignAuthorizationResponse {
|
|
|
143
144
|
yParity: 0 | 1;
|
|
144
145
|
signature: string;
|
|
145
146
|
}
|
|
146
|
-
export interface TransferRequest {
|
|
147
|
+
export interface TransferRequest extends RestSigningInitiator {
|
|
147
148
|
to: string;
|
|
148
149
|
value: string;
|
|
149
150
|
chainId?: string | number;
|
|
@@ -294,12 +295,18 @@ export declare class ParaRestError extends Error {
|
|
|
294
295
|
readonly code?: string;
|
|
295
296
|
readonly requestId?: string;
|
|
296
297
|
readonly body: unknown;
|
|
297
|
-
|
|
298
|
+
/**
|
|
299
|
+
* The open approval cases a change would invalidate, when the API rejects it with `APPROVAL_CASES_AFFECTED`.
|
|
300
|
+
* Retry the change with `force: true` to apply it anyway.
|
|
301
|
+
*/
|
|
302
|
+
readonly affectedCaseIds?: string[];
|
|
303
|
+
constructor({ status, code, requestId, body, message, affectedCaseIds, }: {
|
|
298
304
|
status: number;
|
|
299
305
|
code?: string;
|
|
300
306
|
requestId?: string;
|
|
301
307
|
body: unknown;
|
|
302
308
|
message?: string;
|
|
309
|
+
affectedCaseIds?: string[];
|
|
303
310
|
});
|
|
304
311
|
}
|
|
305
312
|
export declare class ParaRestSerializationError extends Error {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { PermissionsV2AuthoritySetHistory, PermissionsV2AuthoritySetView, PermissionsV2AuthoritySetWrite, PermissionsV2AuthorizationConfigurationHistory, PermissionsV2AuthorizationConfigurationView, PermissionsV2AuthorizationConfigurationWrite, PermissionsV2AuthorizationScopeBindingHistory, PermissionsV2AuthorizationScopeBindingView, PermissionsV2AuthorizationScopeBindingWrite, PermissionsV2AuthorizationScopeMembers, PermissionsV2ConditionalApprovalCaseView, PermissionsV2ConditionalApprovalPartnerCaseList, PermissionsV2ConditionalRequirementList, PermissionsV2ConditionalRequirementView, PermissionsV2DelegationConsentDiscoveryResponse, PermissionsV2DelegationConsentView, PermissionsV2EffectiveAuthorizationConfiguration, PermissionsV2PolicyListResponse, PermissionsV2PolicyResponse, PermissionsV2PolicyUsage, PermissionsV2PolicyVersionsResponse, PermissionsV2PolicyView, PermissionsV2UserParameterHistory, PermissionsV2UserParameterView } from '@getpara/shared';
|
|
1
|
+
import type { PermissionsV2AuthoritySetHistory, PermissionsV2AuthoritySetView, PermissionsV2AuthoritySetWrite, PermissionsV2AuthorizationConfigurationHistory, PermissionsV2AuthorizationConfigurationView, PermissionsV2AuthorizationConfigurationWrite, PermissionsV2AuthorizationScopeBindingHistory, PermissionsV2AuthorizationScopeBindingView, PermissionsV2AuthorizationScopeBindingWrite, PermissionsV2AuthorizationScopeMembers, PermissionsV2ConditionalApprovalCaseSummary, PermissionsV2ConditionalApprovalCaseView, PermissionsV2ConditionalApprovalPartnerCaseList, PermissionsV2ConditionalRequirementList, PermissionsV2ConditionalRequirementView, PermissionsV2DelegationConsentDiscoveryResponse, PermissionsV2DelegationConsentView, PermissionsV2EffectiveAuthorizationConfiguration, PermissionsV2PolicyListResponse, PermissionsV2PolicyResponse, PermissionsV2PolicyUsage, PermissionsV2PolicyVersionsResponse, PermissionsV2PolicyView, PermissionsV2UserParameterHistory, PermissionsV2UserParameterView } from '@getpara/shared';
|
|
2
2
|
import type { ParaRestCallOptions } from './index.js';
|
|
3
|
-
export type { PermissionsV2AuthoritySetHistory, PermissionsV2AuthoritySetWrite, PermissionsV2AuthorizationConfigurationHistory, PermissionsV2AuthorizationConfigurationWrite, PermissionsV2AuthorizationScopeBindingHistory, PermissionsV2AuthorizationScopeBindingWrite, PermissionsV2AuthorizationScopeMembers, PermissionsV2ConditionalApprovalPartnerCaseList, PermissionsV2ConditionalRequirementList, PermissionsV2ConditionalRequirementView, PermissionsV2EffectiveAuthorizationConfiguration, PermissionsV2PolicyListResponse, PermissionsV2PolicyResponse, PermissionsV2PolicyUsage, PermissionsV2PolicyUsageMeter, PermissionsV2PolicyVersionsResponse, PermissionsV2PolicyView, } from '@getpara/shared';
|
|
3
|
+
export type { PermissionsV2AuthoritySetHistory, PermissionsV2AuthoritySetWrite, PermissionsV2AuthorizationConfigurationHistory, PermissionsV2AuthorizationConfigurationWrite, PermissionsV2AuthorizationScopeBindingHistory, PermissionsV2AuthorizationScopeBindingWrite, PermissionsV2AuthorizationScopeMembers, PermissionsV2ConditionalApprovalCaseSummary, PermissionsV2ConditionalApprovalPartnerCaseList, PermissionsV2ConditionalRequirementList, PermissionsV2ConditionalRequirementView, PermissionsV2EffectiveAuthorizationConfiguration, PermissionsV2PolicyListResponse, PermissionsV2PolicyResponse, PermissionsV2PolicyUsage, PermissionsV2PolicyUsageMeter, PermissionsV2PolicyVersionsResponse, PermissionsV2PolicyView, } from '@getpara/shared';
|
|
4
4
|
type PermissionsRequestOptions = {
|
|
5
5
|
body?: unknown;
|
|
6
6
|
options?: ParaRestCallOptions;
|
|
@@ -13,6 +13,7 @@ export interface PermissionsV2ApprovalRequirementReference {
|
|
|
13
13
|
policyVersion: string;
|
|
14
14
|
requirementId: string;
|
|
15
15
|
}
|
|
16
|
+
export type PermissionsV2ApprovalConfigurationReset = Omit<PermissionsV2AuthorizationConfigurationWrite, 'values'>;
|
|
16
17
|
export interface PermissionsV2WalletContext {
|
|
17
18
|
walletId: string;
|
|
18
19
|
}
|
|
@@ -34,6 +35,7 @@ export interface PermissionsV2PartnerUsageContext extends PermissionsV2WalletCon
|
|
|
34
35
|
userId?: string;
|
|
35
36
|
chainId?: string;
|
|
36
37
|
tokenAddress?: string;
|
|
38
|
+
safeAddress?: string;
|
|
37
39
|
}
|
|
38
40
|
export interface PermissionsV2UserAdjustablePolicyListResponse {
|
|
39
41
|
policies: PermissionsV2UserParameterView[];
|
|
@@ -54,7 +56,7 @@ export declare abstract class RestPermissionsClient {
|
|
|
54
56
|
getApprovalConfiguration(reference: PermissionsV2ApprovalRequirementReference, options?: ParaRestCallOptions): Promise<PermissionsV2AuthorizationConfigurationView>;
|
|
55
57
|
getEffectiveApprovalConfiguration(reference: PermissionsV2ApprovalRequirementReference, options?: ParaRestCallOptions): Promise<PermissionsV2EffectiveAuthorizationConfiguration>;
|
|
56
58
|
updateApprovalConfiguration(reference: PermissionsV2ApprovalRequirementReference, body: PermissionsV2AuthorizationConfigurationWrite, options?: ParaRestCallOptions): Promise<PermissionsV2AuthorizationConfigurationView>;
|
|
57
|
-
resetApprovalConfiguration(reference: PermissionsV2ApprovalRequirementReference,
|
|
59
|
+
resetApprovalConfiguration(reference: PermissionsV2ApprovalRequirementReference, reset: number | PermissionsV2ApprovalConfigurationReset, options?: ParaRestCallOptions): Promise<PermissionsV2AuthorizationConfigurationView>;
|
|
58
60
|
listApprovalConfigurationHistory(reference: PermissionsV2ApprovalRequirementReference, options?: ParaRestCallOptions): Promise<PermissionsV2AuthorizationConfigurationHistory>;
|
|
59
61
|
getUserApprovalAssignments(authorizationScopeId: string, userId: string, options?: ParaRestCallOptions): Promise<PermissionsV2AuthoritySetView>;
|
|
60
62
|
listAuthorizationScopeMembers(authorizationScopeId: string, query?: PermissionsV2AuthorizationScopeMemberListOptions, options?: ParaRestCallOptions): Promise<PermissionsV2AuthorizationScopeMembers>;
|
|
@@ -65,5 +67,6 @@ export declare abstract class RestPermissionsClient {
|
|
|
65
67
|
listWalletAuthorizationScopeHistory(walletId: string, query?: PermissionsV2HistoryOptions, options?: ParaRestCallOptions): Promise<PermissionsV2AuthorizationScopeBindingHistory>;
|
|
66
68
|
listPartnerApprovalCases(query?: PermissionsV2CaseListOptions, options?: ParaRestCallOptions): Promise<PermissionsV2ConditionalApprovalPartnerCaseList>;
|
|
67
69
|
getPartnerApprovalCase(caseId: string, options?: ParaRestCallOptions): Promise<Omit<PermissionsV2ConditionalApprovalCaseView, 'decision'>>;
|
|
70
|
+
cancelPartnerApprovalCase(caseId: string, options?: ParaRestCallOptions): Promise<PermissionsV2ConditionalApprovalCaseSummary>;
|
|
68
71
|
getPartnerPolicyUsage(policyId: string, context: PermissionsV2PartnerUsageContext, options?: ParaRestCallOptions): Promise<PermissionsV2PolicyUsage>;
|
|
69
72
|
}
|
package/dist/types/webhooks.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { WebhookEventType } from '@getpara/shared';
|
|
2
|
-
export type { WebhookEvent, WebhookEventPayload, WebhookEventPayloadMap, UserCreatedPayload, WalletCreatedPayload, TransactionSignedPayload, SendBroadcastedPayload, SendConfirmedPayload, SendFailedPayload, RestTransactionConfirmedPayload, RestTransactionFailedPayload, WalletPregenClaimedPayload, UserExternalWalletVerifiedPayload, OnrampCompletedPayload, TestPingPayload, } from '@getpara/shared';
|
|
2
|
+
export type { WebhookEvent, WebhookEventPayload, WebhookEventPayloadMap, UserCreatedPayload, WalletCreatedPayload, TransactionSignedPayload, SendBroadcastedPayload, SendConfirmedPayload, SendFailedPayload, RestTransactionConfirmedPayload, RestTransactionFailedPayload, WalletPregenClaimedPayload, UserExternalWalletVerifiedPayload, OnrampCompletedPayload, UserTwoFactorResetPayload, FundsReceivedPayload, TestPingPayload, } from '@getpara/shared';
|
|
3
3
|
import type { WebhookEventPayloadMap } from '@getpara/shared';
|
|
4
4
|
/**
|
|
5
5
|
* A received webhook, as a discriminated union over the event type.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/rest-sdk",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.23.0",
|
|
4
4
|
"description": "Typed server-side SDK for Para REST wallet management and signing",
|
|
5
5
|
"author": "Para Team <hello@getpara.com> (https://getpara.com)",
|
|
6
6
|
"homepage": "https://docs.getpara.com/v3/rest/sdk",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"vitest": "^3.2.4"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@getpara/shared": "^1.
|
|
30
|
+
"@getpara/shared": "^1.37.0"
|
|
31
31
|
},
|
|
32
32
|
"exports": {
|
|
33
33
|
".": {
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
113
|
"typings": "dist/types/index.d.ts",
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "37cd5748560ed99b161d6b9e3c061173ca9c8bb3"
|
|
115
115
|
}
|