@dfns/sdk 0.2.5 → 0.3.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/dfnsApiClient.d.ts +1 -6
- package/dfnsApiClient.js +0 -7
- package/dfnsDelegatedApiClient.d.ts +1 -6
- package/dfnsDelegatedApiClient.js +0 -7
- package/dfnsError.d.ts +5 -0
- package/dfnsError.js +15 -1
- package/generated/permissions/client.js +8 -8
- package/generated/permissions/delegatedClient.js +13 -13
- package/generated/permissions/types.d.ts +33 -120
- package/generated/policies/types.d.ts +322 -369
- package/generated/wallets/types.d.ts +100 -3
- package/package.json +1 -1
- package/utils/fetch.js +14 -2
- package/codegen/Permissions/DelegatedPermissionsClient.d.ts +0 -27
- package/codegen/Permissions/DelegatedPermissionsClient.js +0 -284
- package/codegen/Permissions/PermissionsClient.d.ts +0 -18
- package/codegen/Permissions/PermissionsClient.js +0 -156
- package/codegen/Permissions/index.d.ts +0 -3
- package/codegen/Permissions/index.js +0 -19
- package/codegen/Permissions/types.d.ts +0 -62
- package/codegen/Permissions/types.js +0 -2
|
@@ -85,7 +85,7 @@ export type BroadcastTransactionRequest = BroadcastTransactionParams & {
|
|
|
85
85
|
body: BroadcastTransactionBody;
|
|
86
86
|
};
|
|
87
87
|
export type CreateWalletBody = {
|
|
88
|
-
network: "ArbitrumOne" | "ArbitrumSepolia" | "AvalancheC" | "AvalancheCFuji" | "Base" | "BaseSepolia" | "Bitcoin" | "BitcoinTestnet3" | "Bsc" | "BscTestnet" | "Ethereum" | "EthereumGoerli" | "EthereumSepolia" | "FantomOpera" | "FantomTestnet" | "Optimism" | "OptimismSepolia" | "Polygon" | "PolygonMumbai" | "
|
|
88
|
+
network: "ArbitrumOne" | "ArbitrumSepolia" | "AvalancheC" | "AvalancheCFuji" | "Base" | "BaseSepolia" | "Bitcoin" | "BitcoinTestnet3" | "Bsc" | "BscTestnet" | "Ethereum" | "EthereumGoerli" | "EthereumSepolia" | "FantomOpera" | "FantomTestnet" | "Optimism" | "OptimismSepolia" | "Polygon" | "PolygonMumbai" | "Tron" | "TronNile" | "ArbitrumGoerli" | "BaseGoerli" | "OptimismGoerli" | "Solana" | "SolanaDevnet" | "Tezos" | "TezosGhostnet" | "XrpLedger" | "XrpLedgerTestnet" | "KeyEdDSA" | "KeyECDSA" | "KeyECDSAStark";
|
|
89
89
|
name?: string | undefined;
|
|
90
90
|
externalId?: string | undefined;
|
|
91
91
|
tags?: string[] | undefined;
|
|
@@ -467,6 +467,7 @@ export type GetWalletAssetsResponse = {
|
|
|
467
467
|
assets: {
|
|
468
468
|
kind: "Native" | "Erc20" | "Erc721" | "Trc10" | "Trc20" | "Trc721";
|
|
469
469
|
contract?: string | undefined;
|
|
470
|
+
tokenId?: string | undefined;
|
|
470
471
|
symbol?: string | undefined;
|
|
471
472
|
decimals: number;
|
|
472
473
|
verified?: boolean | undefined;
|
|
@@ -481,7 +482,7 @@ export type GetWalletHistoryQuery = {
|
|
|
481
482
|
limit?: string | undefined;
|
|
482
483
|
paginationToken?: string | undefined;
|
|
483
484
|
direction?: ("In" | "Out") | undefined;
|
|
484
|
-
kind?: ("NativeTransfer" | "Erc20Transfer" | "Erc721Transfer" | "UtxoTransfer") | undefined;
|
|
485
|
+
kind?: ("NativeTransfer" | "Erc20Transfer" | "Erc721Transfer" | "Trc10Transfer" | "Trc20Transfer" | "Trc721Transfer" | "UtxoTransfer") | undefined;
|
|
485
486
|
contract?: string | undefined;
|
|
486
487
|
};
|
|
487
488
|
export type GetWalletHistoryResponse = {
|
|
@@ -598,6 +599,102 @@ export type GetWalletHistoryResponse = {
|
|
|
598
599
|
symbol?: string | undefined;
|
|
599
600
|
/** @deprecated use metadata.asset.verified instead */
|
|
600
601
|
verified?: boolean | undefined;
|
|
602
|
+
} | {
|
|
603
|
+
walletId: string;
|
|
604
|
+
direction: "In" | "Out";
|
|
605
|
+
network: "ArbitrumOne" | "ArbitrumGoerli" | "ArbitrumSepolia" | "AvalancheC" | "AvalancheCFuji" | "Base" | "BaseGoerli" | "BaseSepolia" | "Bitcoin" | "BitcoinTestnet3" | "Bsc" | "BscTestnet" | "Ethereum" | "EthereumGoerli" | "EthereumSepolia" | "FantomOpera" | "FantomTestnet" | "Optimism" | "OptimismGoerli" | "OptimismSepolia" | "Polygon" | "PolygonMumbai" | "Solana" | "SolanaDevnet" | "Tezos" | "TezosGhostnet" | "Tron" | "TronNile" | "XrpLedger" | "XrpLedgerTestnet" | "KeyECDSA" | "KeyECDSAStark" | "KeyEdDSA";
|
|
606
|
+
blockNumber: number;
|
|
607
|
+
txHash: string;
|
|
608
|
+
index?: string | undefined;
|
|
609
|
+
timestamp: string;
|
|
610
|
+
metadata: {
|
|
611
|
+
asset: {
|
|
612
|
+
symbol?: string | undefined;
|
|
613
|
+
decimals?: number | undefined;
|
|
614
|
+
verified?: boolean | undefined;
|
|
615
|
+
quotes?: {
|
|
616
|
+
[x: string]: number;
|
|
617
|
+
} | undefined;
|
|
618
|
+
};
|
|
619
|
+
fee?: {
|
|
620
|
+
symbol?: string | undefined;
|
|
621
|
+
decimals?: number | undefined;
|
|
622
|
+
verified?: boolean | undefined;
|
|
623
|
+
quotes?: {
|
|
624
|
+
[x: string]: number;
|
|
625
|
+
} | undefined;
|
|
626
|
+
} | undefined;
|
|
627
|
+
};
|
|
628
|
+
kind: "Trc10Transfer";
|
|
629
|
+
tokenId: string;
|
|
630
|
+
from: string;
|
|
631
|
+
to: string;
|
|
632
|
+
value: string;
|
|
633
|
+
fee?: string | undefined;
|
|
634
|
+
} | {
|
|
635
|
+
walletId: string;
|
|
636
|
+
direction: "In" | "Out";
|
|
637
|
+
network: "ArbitrumOne" | "ArbitrumGoerli" | "ArbitrumSepolia" | "AvalancheC" | "AvalancheCFuji" | "Base" | "BaseGoerli" | "BaseSepolia" | "Bitcoin" | "BitcoinTestnet3" | "Bsc" | "BscTestnet" | "Ethereum" | "EthereumGoerli" | "EthereumSepolia" | "FantomOpera" | "FantomTestnet" | "Optimism" | "OptimismGoerli" | "OptimismSepolia" | "Polygon" | "PolygonMumbai" | "Solana" | "SolanaDevnet" | "Tezos" | "TezosGhostnet" | "Tron" | "TronNile" | "XrpLedger" | "XrpLedgerTestnet" | "KeyECDSA" | "KeyECDSAStark" | "KeyEdDSA";
|
|
638
|
+
blockNumber: number;
|
|
639
|
+
txHash: string;
|
|
640
|
+
index?: string | undefined;
|
|
641
|
+
timestamp: string;
|
|
642
|
+
metadata: {
|
|
643
|
+
asset: {
|
|
644
|
+
symbol?: string | undefined;
|
|
645
|
+
decimals?: number | undefined;
|
|
646
|
+
verified?: boolean | undefined;
|
|
647
|
+
quotes?: {
|
|
648
|
+
[x: string]: number;
|
|
649
|
+
} | undefined;
|
|
650
|
+
};
|
|
651
|
+
fee?: {
|
|
652
|
+
symbol?: string | undefined;
|
|
653
|
+
decimals?: number | undefined;
|
|
654
|
+
verified?: boolean | undefined;
|
|
655
|
+
quotes?: {
|
|
656
|
+
[x: string]: number;
|
|
657
|
+
} | undefined;
|
|
658
|
+
} | undefined;
|
|
659
|
+
};
|
|
660
|
+
kind: "Trc20Transfer";
|
|
661
|
+
contract: string;
|
|
662
|
+
from: string;
|
|
663
|
+
to: string;
|
|
664
|
+
value: string;
|
|
665
|
+
fee?: string | undefined;
|
|
666
|
+
} | {
|
|
667
|
+
walletId: string;
|
|
668
|
+
direction: "In" | "Out";
|
|
669
|
+
network: "ArbitrumOne" | "ArbitrumGoerli" | "ArbitrumSepolia" | "AvalancheC" | "AvalancheCFuji" | "Base" | "BaseGoerli" | "BaseSepolia" | "Bitcoin" | "BitcoinTestnet3" | "Bsc" | "BscTestnet" | "Ethereum" | "EthereumGoerli" | "EthereumSepolia" | "FantomOpera" | "FantomTestnet" | "Optimism" | "OptimismGoerli" | "OptimismSepolia" | "Polygon" | "PolygonMumbai" | "Solana" | "SolanaDevnet" | "Tezos" | "TezosGhostnet" | "Tron" | "TronNile" | "XrpLedger" | "XrpLedgerTestnet" | "KeyECDSA" | "KeyECDSAStark" | "KeyEdDSA";
|
|
670
|
+
blockNumber: number;
|
|
671
|
+
txHash: string;
|
|
672
|
+
index?: string | undefined;
|
|
673
|
+
timestamp: string;
|
|
674
|
+
metadata: {
|
|
675
|
+
asset: {
|
|
676
|
+
symbol?: string | undefined;
|
|
677
|
+
decimals?: number | undefined;
|
|
678
|
+
verified?: boolean | undefined;
|
|
679
|
+
quotes?: {
|
|
680
|
+
[x: string]: number;
|
|
681
|
+
} | undefined;
|
|
682
|
+
};
|
|
683
|
+
fee?: {
|
|
684
|
+
symbol?: string | undefined;
|
|
685
|
+
decimals?: number | undefined;
|
|
686
|
+
verified?: boolean | undefined;
|
|
687
|
+
quotes?: {
|
|
688
|
+
[x: string]: number;
|
|
689
|
+
} | undefined;
|
|
690
|
+
} | undefined;
|
|
691
|
+
};
|
|
692
|
+
kind: "Trc721Transfer";
|
|
693
|
+
contract: string;
|
|
694
|
+
from: string;
|
|
695
|
+
to: string;
|
|
696
|
+
tokenId: string;
|
|
697
|
+
fee?: string | undefined;
|
|
601
698
|
} | {
|
|
602
699
|
walletId: string;
|
|
603
700
|
direction: "In" | "Out";
|
|
@@ -652,7 +749,7 @@ export type GetWalletNftsResponse = {
|
|
|
652
749
|
};
|
|
653
750
|
export type GetWalletNftsRequest = GetWalletNftsParams;
|
|
654
751
|
export type ImportWalletBody = {
|
|
655
|
-
network: "ArbitrumOne" | "ArbitrumSepolia" | "AvalancheC" | "AvalancheCFuji" | "Base" | "BaseSepolia" | "Bitcoin" | "BitcoinTestnet3" | "Bsc" | "BscTestnet" | "Ethereum" | "EthereumGoerli" | "EthereumSepolia" | "FantomOpera" | "FantomTestnet" | "Optimism" | "OptimismSepolia" | "Polygon" | "PolygonMumbai" | "
|
|
752
|
+
network: "ArbitrumOne" | "ArbitrumSepolia" | "AvalancheC" | "AvalancheCFuji" | "Base" | "BaseSepolia" | "Bitcoin" | "BitcoinTestnet3" | "Bsc" | "BscTestnet" | "Ethereum" | "EthereumGoerli" | "EthereumSepolia" | "FantomOpera" | "FantomTestnet" | "Optimism" | "OptimismSepolia" | "Polygon" | "PolygonMumbai" | "Tron" | "TronNile" | "ArbitrumGoerli" | "BaseGoerli" | "OptimismGoerli" | "Solana" | "SolanaDevnet" | "Tezos" | "TezosGhostnet" | "XrpLedger" | "XrpLedgerTestnet" | "KeyEdDSA" | "KeyECDSA" | "KeyECDSAStark";
|
|
656
753
|
name?: string | undefined;
|
|
657
754
|
externalId?: string | undefined;
|
|
658
755
|
tags?: string[] | undefined;
|
package/package.json
CHANGED
package/utils/fetch.js
CHANGED
|
@@ -41,6 +41,18 @@ const errorHandler = (fetch) => {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
};
|
|
44
|
+
// raise a 202 response by policy execution as error
|
|
45
|
+
const catchPolicyPending = (fetch) => {
|
|
46
|
+
return async (resource, options) => {
|
|
47
|
+
const response = await fetch(resource, options);
|
|
48
|
+
if (response.status === dfnsError_1.PolicyPendingError.HTTP_ACCEPTED) {
|
|
49
|
+
throw new dfnsError_1.PolicyPendingError(await response.json());
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return response;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
};
|
|
44
56
|
const dfnsAuth = (fetch) => {
|
|
45
57
|
return async (resource, options) => {
|
|
46
58
|
const { appId, appSecret, authToken } = options.apiOptions;
|
|
@@ -90,5 +102,5 @@ const userAction = (fetch) => {
|
|
|
90
102
|
return fetch(resource, options);
|
|
91
103
|
};
|
|
92
104
|
};
|
|
93
|
-
exports.simpleFetch = fullUrl(jsonSerializer(dfnsAuth(errorHandler(cross_fetch_1.fetch))));
|
|
94
|
-
exports.userActionFetch = fullUrl(jsonSerializer(dfnsAuth(userAction(errorHandler(cross_fetch_1.fetch)))));
|
|
105
|
+
exports.simpleFetch = fullUrl(jsonSerializer(dfnsAuth(catchPolicyPending(errorHandler(cross_fetch_1.fetch)))));
|
|
106
|
+
exports.userActionFetch = fullUrl(jsonSerializer(dfnsAuth(userAction(catchPolicyPending(errorHandler(cross_fetch_1.fetch))))));
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { SignUserActionChallengeRequest, UserActionChallengeResponse } from '../../baseAuthApi';
|
|
2
|
-
import { DfnsDelegatedApiClientOptions } from '../../dfnsDelegatedApiClient';
|
|
3
|
-
import * as T from './types';
|
|
4
|
-
export declare class DelegatedPermissionsClient {
|
|
5
|
-
private apiOptions;
|
|
6
|
-
constructor(apiOptions: DfnsDelegatedApiClientOptions);
|
|
7
|
-
createPermissionInit(request: T.CreatePermissionRequest): Promise<UserActionChallengeResponse>;
|
|
8
|
-
createPermissionComplete(request: T.CreatePermissionRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.CreatePermissionResponse>;
|
|
9
|
-
updatePermissionInit(request: T.UpdatePermissionRequest): Promise<UserActionChallengeResponse>;
|
|
10
|
-
updatePermissionComplete(request: T.UpdatePermissionRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.UpdatePermissionResponse>;
|
|
11
|
-
archivePermissionInit(request: T.ArchivePermissionRequest): Promise<UserActionChallengeResponse>;
|
|
12
|
-
archivePermissionComplete(request: T.ArchivePermissionRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.ArchivePermissionResponse>;
|
|
13
|
-
getPermissionById(request: T.GetPermissionByIdRequest): Promise<T.GetPermissionByIdResponse>;
|
|
14
|
-
listPermissions(): Promise<T.ListPermissionsResponse>;
|
|
15
|
-
createPermissionPredicateInit(request: T.CreatePermissionPredicateRequest): Promise<UserActionChallengeResponse>;
|
|
16
|
-
createPermissionPredicateComplete(request: T.CreatePermissionPredicateRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.CreatePermissionPredicateResponse>;
|
|
17
|
-
updatePermissionPredicateInit(request: T.UpdatePermissionPredicateRequest): Promise<UserActionChallengeResponse>;
|
|
18
|
-
updatePermissionPredicateComplete(request: T.UpdatePermissionPredicateRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.UpdatePermissionPredicateResponse>;
|
|
19
|
-
archivePermissionPredicateInit(request: T.ArchivePermissionPredicateRequest): Promise<UserActionChallengeResponse>;
|
|
20
|
-
archivePermissionPredicateComplete(request: T.ArchivePermissionPredicateRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.ArchivePermissionPredicateResponse>;
|
|
21
|
-
listPermissionPredicates(request: T.ListPermissionPredicatesRequest): Promise<T.ListPermissionPredicatesResponse>;
|
|
22
|
-
createPermissionAssignmentInit(request: T.CreatePermissionAssignmentRequest): Promise<UserActionChallengeResponse>;
|
|
23
|
-
createPermissionAssignmentComplete(request: T.CreatePermissionAssignmentRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.CreatePermissionAssignmentResponse>;
|
|
24
|
-
revokePermissionAssignmentInit(request: T.RevokePermissionAssignmentRequest): Promise<UserActionChallengeResponse>;
|
|
25
|
-
revokePermissionAssignmentComplete(request: T.RevokePermissionAssignmentRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.RevokePermissionAssignmentResponse>;
|
|
26
|
-
listPermissionAssignments(request: T.ListPermissionAssignmentsRequest): Promise<T.ListPermissionAssignmentsResponse>;
|
|
27
|
-
}
|
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DelegatedPermissionsClient = void 0;
|
|
4
|
-
const baseAuthApi_1 = require("../../baseAuthApi");
|
|
5
|
-
const fetch_1 = require("../../utils/fetch");
|
|
6
|
-
const url_1 = require("../../utils/url");
|
|
7
|
-
class DelegatedPermissionsClient {
|
|
8
|
-
constructor(apiOptions) {
|
|
9
|
-
this.apiOptions = apiOptions;
|
|
10
|
-
}
|
|
11
|
-
async createPermissionInit(request) {
|
|
12
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions', {
|
|
13
|
-
path: {},
|
|
14
|
-
query: {},
|
|
15
|
-
});
|
|
16
|
-
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
17
|
-
userActionHttpMethod: 'POST',
|
|
18
|
-
userActionHttpPath: path,
|
|
19
|
-
userActionPayload: JSON.stringify(request.body),
|
|
20
|
-
userActionServerKind: 'Api',
|
|
21
|
-
}, this.apiOptions);
|
|
22
|
-
return challenge;
|
|
23
|
-
}
|
|
24
|
-
async createPermissionComplete(request, signedChallenge) {
|
|
25
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions', {
|
|
26
|
-
path: {},
|
|
27
|
-
query: {},
|
|
28
|
-
});
|
|
29
|
-
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
30
|
-
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
31
|
-
method: 'POST',
|
|
32
|
-
body: request.body,
|
|
33
|
-
headers: { 'x-dfns-useraction': userAction },
|
|
34
|
-
apiOptions: this.apiOptions,
|
|
35
|
-
});
|
|
36
|
-
return response.json();
|
|
37
|
-
}
|
|
38
|
-
async updatePermissionInit(request) {
|
|
39
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions/:permissionId', {
|
|
40
|
-
path: { permissionId: request.permissionId },
|
|
41
|
-
query: {},
|
|
42
|
-
});
|
|
43
|
-
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
44
|
-
userActionHttpMethod: 'PUT',
|
|
45
|
-
userActionHttpPath: path,
|
|
46
|
-
userActionPayload: JSON.stringify(request.body),
|
|
47
|
-
userActionServerKind: 'Api',
|
|
48
|
-
}, this.apiOptions);
|
|
49
|
-
return challenge;
|
|
50
|
-
}
|
|
51
|
-
async updatePermissionComplete(request, signedChallenge) {
|
|
52
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions/:permissionId', {
|
|
53
|
-
path: { permissionId: request.permissionId },
|
|
54
|
-
query: {},
|
|
55
|
-
});
|
|
56
|
-
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
57
|
-
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
58
|
-
method: 'PUT',
|
|
59
|
-
body: request.body,
|
|
60
|
-
headers: { 'x-dfns-useraction': userAction },
|
|
61
|
-
apiOptions: this.apiOptions,
|
|
62
|
-
});
|
|
63
|
-
return response.json();
|
|
64
|
-
}
|
|
65
|
-
async archivePermissionInit(request) {
|
|
66
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions/:permissionId/archive', {
|
|
67
|
-
path: { permissionId: request.permissionId },
|
|
68
|
-
query: {},
|
|
69
|
-
});
|
|
70
|
-
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
71
|
-
userActionHttpMethod: 'PUT',
|
|
72
|
-
userActionHttpPath: path,
|
|
73
|
-
userActionPayload: JSON.stringify(request.body),
|
|
74
|
-
userActionServerKind: 'Api',
|
|
75
|
-
}, this.apiOptions);
|
|
76
|
-
return challenge;
|
|
77
|
-
}
|
|
78
|
-
async archivePermissionComplete(request, signedChallenge) {
|
|
79
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions/:permissionId/archive', {
|
|
80
|
-
path: { permissionId: request.permissionId },
|
|
81
|
-
query: {},
|
|
82
|
-
});
|
|
83
|
-
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
84
|
-
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
85
|
-
method: 'PUT',
|
|
86
|
-
body: request.body,
|
|
87
|
-
headers: { 'x-dfns-useraction': userAction },
|
|
88
|
-
apiOptions: this.apiOptions,
|
|
89
|
-
});
|
|
90
|
-
return response.json();
|
|
91
|
-
}
|
|
92
|
-
async getPermissionById(request) {
|
|
93
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions/:permissionId', {
|
|
94
|
-
path: { permissionId: request.permissionId },
|
|
95
|
-
query: {},
|
|
96
|
-
});
|
|
97
|
-
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
98
|
-
method: 'GET',
|
|
99
|
-
apiOptions: this.apiOptions,
|
|
100
|
-
});
|
|
101
|
-
return response.json();
|
|
102
|
-
}
|
|
103
|
-
async listPermissions() {
|
|
104
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions', {
|
|
105
|
-
path: {},
|
|
106
|
-
query: {},
|
|
107
|
-
});
|
|
108
|
-
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
109
|
-
method: 'GET',
|
|
110
|
-
apiOptions: this.apiOptions,
|
|
111
|
-
});
|
|
112
|
-
return response.json();
|
|
113
|
-
}
|
|
114
|
-
async createPermissionPredicateInit(request) {
|
|
115
|
-
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates', {
|
|
116
|
-
path: { permissionId: request.permissionId },
|
|
117
|
-
query: {},
|
|
118
|
-
});
|
|
119
|
-
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
120
|
-
userActionHttpMethod: 'POST',
|
|
121
|
-
userActionHttpPath: path,
|
|
122
|
-
userActionPayload: JSON.stringify(request.body),
|
|
123
|
-
userActionServerKind: 'Api',
|
|
124
|
-
}, this.apiOptions);
|
|
125
|
-
return challenge;
|
|
126
|
-
}
|
|
127
|
-
async createPermissionPredicateComplete(request, signedChallenge) {
|
|
128
|
-
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates', {
|
|
129
|
-
path: { permissionId: request.permissionId },
|
|
130
|
-
query: {},
|
|
131
|
-
});
|
|
132
|
-
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
133
|
-
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
134
|
-
method: 'POST',
|
|
135
|
-
body: request.body,
|
|
136
|
-
headers: { 'x-dfns-useraction': userAction },
|
|
137
|
-
apiOptions: this.apiOptions,
|
|
138
|
-
});
|
|
139
|
-
return response.json();
|
|
140
|
-
}
|
|
141
|
-
async updatePermissionPredicateInit(request) {
|
|
142
|
-
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates/:predicateId', {
|
|
143
|
-
path: {
|
|
144
|
-
permissionId: request.permissionId,
|
|
145
|
-
predicateId: request.predicateId,
|
|
146
|
-
},
|
|
147
|
-
query: {},
|
|
148
|
-
});
|
|
149
|
-
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
150
|
-
userActionHttpMethod: 'PUT',
|
|
151
|
-
userActionHttpPath: path,
|
|
152
|
-
userActionPayload: JSON.stringify(request.body),
|
|
153
|
-
userActionServerKind: 'Api',
|
|
154
|
-
}, this.apiOptions);
|
|
155
|
-
return challenge;
|
|
156
|
-
}
|
|
157
|
-
async updatePermissionPredicateComplete(request, signedChallenge) {
|
|
158
|
-
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates/:predicateId', {
|
|
159
|
-
path: {
|
|
160
|
-
permissionId: request.permissionId,
|
|
161
|
-
predicateId: request.predicateId,
|
|
162
|
-
},
|
|
163
|
-
query: {},
|
|
164
|
-
});
|
|
165
|
-
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
166
|
-
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
167
|
-
method: 'PUT',
|
|
168
|
-
body: request.body,
|
|
169
|
-
headers: { 'x-dfns-useraction': userAction },
|
|
170
|
-
apiOptions: this.apiOptions,
|
|
171
|
-
});
|
|
172
|
-
return response.json();
|
|
173
|
-
}
|
|
174
|
-
async archivePermissionPredicateInit(request) {
|
|
175
|
-
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates/:predicateId/archive', {
|
|
176
|
-
path: {
|
|
177
|
-
permissionId: request.permissionId,
|
|
178
|
-
predicateId: request.predicateId,
|
|
179
|
-
},
|
|
180
|
-
query: {},
|
|
181
|
-
});
|
|
182
|
-
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
183
|
-
userActionHttpMethod: 'PUT',
|
|
184
|
-
userActionHttpPath: path,
|
|
185
|
-
userActionPayload: JSON.stringify(request.body),
|
|
186
|
-
userActionServerKind: 'Api',
|
|
187
|
-
}, this.apiOptions);
|
|
188
|
-
return challenge;
|
|
189
|
-
}
|
|
190
|
-
async archivePermissionPredicateComplete(request, signedChallenge) {
|
|
191
|
-
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates/:predicateId/archive', {
|
|
192
|
-
path: {
|
|
193
|
-
permissionId: request.permissionId,
|
|
194
|
-
predicateId: request.predicateId,
|
|
195
|
-
},
|
|
196
|
-
query: {},
|
|
197
|
-
});
|
|
198
|
-
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
199
|
-
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
200
|
-
method: 'PUT',
|
|
201
|
-
body: request.body,
|
|
202
|
-
headers: { 'x-dfns-useraction': userAction },
|
|
203
|
-
apiOptions: this.apiOptions,
|
|
204
|
-
});
|
|
205
|
-
return response.json();
|
|
206
|
-
}
|
|
207
|
-
async listPermissionPredicates(request) {
|
|
208
|
-
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates', {
|
|
209
|
-
path: { permissionId: request.permissionId },
|
|
210
|
-
query: {},
|
|
211
|
-
});
|
|
212
|
-
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
213
|
-
method: 'GET',
|
|
214
|
-
apiOptions: this.apiOptions,
|
|
215
|
-
});
|
|
216
|
-
return response.json();
|
|
217
|
-
}
|
|
218
|
-
async createPermissionAssignmentInit(request) {
|
|
219
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions/assignments', {
|
|
220
|
-
path: {},
|
|
221
|
-
query: {},
|
|
222
|
-
});
|
|
223
|
-
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
224
|
-
userActionHttpMethod: 'POST',
|
|
225
|
-
userActionHttpPath: path,
|
|
226
|
-
userActionPayload: JSON.stringify(request.body),
|
|
227
|
-
userActionServerKind: 'Api',
|
|
228
|
-
}, this.apiOptions);
|
|
229
|
-
return challenge;
|
|
230
|
-
}
|
|
231
|
-
async createPermissionAssignmentComplete(request, signedChallenge) {
|
|
232
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions/assignments', {
|
|
233
|
-
path: {},
|
|
234
|
-
query: {},
|
|
235
|
-
});
|
|
236
|
-
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
237
|
-
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
238
|
-
method: 'POST',
|
|
239
|
-
body: request.body,
|
|
240
|
-
headers: { 'x-dfns-useraction': userAction },
|
|
241
|
-
apiOptions: this.apiOptions,
|
|
242
|
-
});
|
|
243
|
-
return response.json();
|
|
244
|
-
}
|
|
245
|
-
async revokePermissionAssignmentInit(request) {
|
|
246
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions/assignments/:assignmentId', {
|
|
247
|
-
path: { assignmentId: request.assignmentId },
|
|
248
|
-
query: {},
|
|
249
|
-
});
|
|
250
|
-
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
251
|
-
userActionHttpMethod: 'DELETE',
|
|
252
|
-
userActionHttpPath: path,
|
|
253
|
-
userActionPayload: JSON.stringify({}),
|
|
254
|
-
userActionServerKind: 'Api',
|
|
255
|
-
}, this.apiOptions);
|
|
256
|
-
return challenge;
|
|
257
|
-
}
|
|
258
|
-
async revokePermissionAssignmentComplete(request, signedChallenge) {
|
|
259
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions/assignments/:assignmentId', {
|
|
260
|
-
path: { assignmentId: request.assignmentId },
|
|
261
|
-
query: {},
|
|
262
|
-
});
|
|
263
|
-
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
264
|
-
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
265
|
-
method: 'DELETE',
|
|
266
|
-
body: {},
|
|
267
|
-
headers: { 'x-dfns-useraction': userAction },
|
|
268
|
-
apiOptions: this.apiOptions,
|
|
269
|
-
});
|
|
270
|
-
return response.json();
|
|
271
|
-
}
|
|
272
|
-
async listPermissionAssignments(request) {
|
|
273
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions/assignments', {
|
|
274
|
-
path: {},
|
|
275
|
-
query: request.query ?? {},
|
|
276
|
-
});
|
|
277
|
-
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
278
|
-
method: 'GET',
|
|
279
|
-
apiOptions: this.apiOptions,
|
|
280
|
-
});
|
|
281
|
-
return response.json();
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
exports.DelegatedPermissionsClient = DelegatedPermissionsClient;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { DfnsApiClientOptions } from '../../dfnsApiClient';
|
|
2
|
-
import * as T from './types';
|
|
3
|
-
export declare class PermissionsClient {
|
|
4
|
-
private apiOptions;
|
|
5
|
-
constructor(apiOptions: DfnsApiClientOptions);
|
|
6
|
-
createPermission(request: T.CreatePermissionRequest): Promise<T.CreatePermissionResponse>;
|
|
7
|
-
updatePermission(request: T.UpdatePermissionRequest): Promise<T.UpdatePermissionResponse>;
|
|
8
|
-
archivePermission(request: T.ArchivePermissionRequest): Promise<T.ArchivePermissionResponse>;
|
|
9
|
-
getPermissionById(request: T.GetPermissionByIdRequest): Promise<T.GetPermissionByIdResponse>;
|
|
10
|
-
listPermissions(): Promise<T.ListPermissionsResponse>;
|
|
11
|
-
createPermissionPredicate(request: T.CreatePermissionPredicateRequest): Promise<T.CreatePermissionPredicateResponse>;
|
|
12
|
-
updatePermissionPredicate(request: T.UpdatePermissionPredicateRequest): Promise<T.UpdatePermissionPredicateResponse>;
|
|
13
|
-
archivePermissionPredicate(request: T.ArchivePermissionPredicateRequest): Promise<T.ArchivePermissionPredicateResponse>;
|
|
14
|
-
listPermissionPredicates(request: T.ListPermissionPredicatesRequest): Promise<T.ListPermissionPredicatesResponse>;
|
|
15
|
-
createPermissionAssignment(request: T.CreatePermissionAssignmentRequest): Promise<T.CreatePermissionAssignmentResponse>;
|
|
16
|
-
revokePermissionAssignment(request: T.RevokePermissionAssignmentRequest): Promise<T.RevokePermissionAssignmentResponse>;
|
|
17
|
-
listPermissionAssignments(request: T.ListPermissionAssignmentsRequest): Promise<T.ListPermissionAssignmentsResponse>;
|
|
18
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PermissionsClient = void 0;
|
|
4
|
-
const fetch_1 = require("../../utils/fetch");
|
|
5
|
-
const url_1 = require("../../utils/url");
|
|
6
|
-
class PermissionsClient {
|
|
7
|
-
constructor(apiOptions) {
|
|
8
|
-
this.apiOptions = apiOptions;
|
|
9
|
-
}
|
|
10
|
-
async createPermission(request) {
|
|
11
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions', {
|
|
12
|
-
path: {},
|
|
13
|
-
query: {},
|
|
14
|
-
});
|
|
15
|
-
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
16
|
-
method: 'POST',
|
|
17
|
-
body: request.body,
|
|
18
|
-
apiOptions: this.apiOptions,
|
|
19
|
-
});
|
|
20
|
-
return response.json();
|
|
21
|
-
}
|
|
22
|
-
async updatePermission(request) {
|
|
23
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions/:permissionId', {
|
|
24
|
-
path: { permissionId: request.permissionId },
|
|
25
|
-
query: {},
|
|
26
|
-
});
|
|
27
|
-
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
28
|
-
method: 'PUT',
|
|
29
|
-
body: request.body,
|
|
30
|
-
apiOptions: this.apiOptions,
|
|
31
|
-
});
|
|
32
|
-
return response.json();
|
|
33
|
-
}
|
|
34
|
-
async archivePermission(request) {
|
|
35
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions/:permissionId/archive', {
|
|
36
|
-
path: { permissionId: request.permissionId },
|
|
37
|
-
query: {},
|
|
38
|
-
});
|
|
39
|
-
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
40
|
-
method: 'PUT',
|
|
41
|
-
body: request.body,
|
|
42
|
-
apiOptions: this.apiOptions,
|
|
43
|
-
});
|
|
44
|
-
return response.json();
|
|
45
|
-
}
|
|
46
|
-
async getPermissionById(request) {
|
|
47
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions/:permissionId', {
|
|
48
|
-
path: { permissionId: request.permissionId },
|
|
49
|
-
query: {},
|
|
50
|
-
});
|
|
51
|
-
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
52
|
-
method: 'GET',
|
|
53
|
-
apiOptions: this.apiOptions,
|
|
54
|
-
});
|
|
55
|
-
return response.json();
|
|
56
|
-
}
|
|
57
|
-
async listPermissions() {
|
|
58
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions', {
|
|
59
|
-
path: {},
|
|
60
|
-
query: {},
|
|
61
|
-
});
|
|
62
|
-
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
63
|
-
method: 'GET',
|
|
64
|
-
apiOptions: this.apiOptions,
|
|
65
|
-
});
|
|
66
|
-
return response.json();
|
|
67
|
-
}
|
|
68
|
-
async createPermissionPredicate(request) {
|
|
69
|
-
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates', {
|
|
70
|
-
path: { permissionId: request.permissionId },
|
|
71
|
-
query: {},
|
|
72
|
-
});
|
|
73
|
-
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
74
|
-
method: 'POST',
|
|
75
|
-
body: request.body,
|
|
76
|
-
apiOptions: this.apiOptions,
|
|
77
|
-
});
|
|
78
|
-
return response.json();
|
|
79
|
-
}
|
|
80
|
-
async updatePermissionPredicate(request) {
|
|
81
|
-
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates/:predicateId', {
|
|
82
|
-
path: {
|
|
83
|
-
permissionId: request.permissionId,
|
|
84
|
-
predicateId: request.predicateId,
|
|
85
|
-
},
|
|
86
|
-
query: {},
|
|
87
|
-
});
|
|
88
|
-
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
89
|
-
method: 'PUT',
|
|
90
|
-
body: request.body,
|
|
91
|
-
apiOptions: this.apiOptions,
|
|
92
|
-
});
|
|
93
|
-
return response.json();
|
|
94
|
-
}
|
|
95
|
-
async archivePermissionPredicate(request) {
|
|
96
|
-
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates/:predicateId/archive', {
|
|
97
|
-
path: {
|
|
98
|
-
permissionId: request.permissionId,
|
|
99
|
-
predicateId: request.predicateId,
|
|
100
|
-
},
|
|
101
|
-
query: {},
|
|
102
|
-
});
|
|
103
|
-
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
104
|
-
method: 'PUT',
|
|
105
|
-
body: request.body,
|
|
106
|
-
apiOptions: this.apiOptions,
|
|
107
|
-
});
|
|
108
|
-
return response.json();
|
|
109
|
-
}
|
|
110
|
-
async listPermissionPredicates(request) {
|
|
111
|
-
const path = (0, url_1.buildPathAndQuery)('/dev-permissions/:permissionId/predicates', {
|
|
112
|
-
path: { permissionId: request.permissionId },
|
|
113
|
-
query: {},
|
|
114
|
-
});
|
|
115
|
-
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
116
|
-
method: 'GET',
|
|
117
|
-
apiOptions: this.apiOptions,
|
|
118
|
-
});
|
|
119
|
-
return response.json();
|
|
120
|
-
}
|
|
121
|
-
async createPermissionAssignment(request) {
|
|
122
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions/assignments', {
|
|
123
|
-
path: {},
|
|
124
|
-
query: {},
|
|
125
|
-
});
|
|
126
|
-
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
127
|
-
method: 'POST',
|
|
128
|
-
body: request.body,
|
|
129
|
-
apiOptions: this.apiOptions,
|
|
130
|
-
});
|
|
131
|
-
return response.json();
|
|
132
|
-
}
|
|
133
|
-
async revokePermissionAssignment(request) {
|
|
134
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions/assignments/:assignmentId', {
|
|
135
|
-
path: { assignmentId: request.assignmentId },
|
|
136
|
-
query: {},
|
|
137
|
-
});
|
|
138
|
-
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
139
|
-
method: 'DELETE',
|
|
140
|
-
apiOptions: this.apiOptions,
|
|
141
|
-
});
|
|
142
|
-
return response.json();
|
|
143
|
-
}
|
|
144
|
-
async listPermissionAssignments(request) {
|
|
145
|
-
const path = (0, url_1.buildPathAndQuery)('/permissions/assignments', {
|
|
146
|
-
path: {},
|
|
147
|
-
query: request.query ?? {},
|
|
148
|
-
});
|
|
149
|
-
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
150
|
-
method: 'GET',
|
|
151
|
-
apiOptions: this.apiOptions,
|
|
152
|
-
});
|
|
153
|
-
return response.json();
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
exports.PermissionsClient = PermissionsClient;
|