@getpara/user-management-client 2.0.0-alpha.25 → 2.0.0-alpha.26
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/client.js +18 -4
- package/dist/cjs/utils.js +12 -0
- package/dist/esm/client.js +19 -5
- package/dist/esm/utils.js +11 -0
- package/dist/types/client.d.ts +2 -1
- package/dist/types/types/auth.d.ts +6 -5
- package/dist/types/utils.d.ts +2 -1
- package/package.json +2 -2
package/dist/cjs/client.js
CHANGED
|
@@ -155,9 +155,19 @@ class Client {
|
|
|
155
155
|
const res = yield this.baseRequest.post(`/users/${userId}/verify`, body);
|
|
156
156
|
return res.data;
|
|
157
157
|
});
|
|
158
|
-
this.getLinkedAccounts = (_0) => __async(this, [_0], function* ({
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
this.getLinkedAccounts = (_0) => __async(this, [_0], function* ({
|
|
159
|
+
userId,
|
|
160
|
+
withMetadata = false
|
|
161
|
+
}) {
|
|
162
|
+
const res = yield this.baseRequest.get(
|
|
163
|
+
`/users/${userId}/linked-accounts`,
|
|
164
|
+
...withMetadata ? [
|
|
165
|
+
{
|
|
166
|
+
params: { withMetadata }
|
|
167
|
+
}
|
|
168
|
+
] : []
|
|
169
|
+
);
|
|
170
|
+
return { accounts: (0, import_utils.fromLinkedAccounts)(res.data.accounts) };
|
|
161
171
|
});
|
|
162
172
|
this.linkAccount = (_a) => __async(this, null, function* () {
|
|
163
173
|
var _b = _a, { userId } = _b, opts = __objRest(_b, ["userId"]);
|
|
@@ -176,7 +186,11 @@ class Client {
|
|
|
176
186
|
`/users/${userId}/linked-accounts/${linkedAccountId}/verify`,
|
|
177
187
|
opts
|
|
178
188
|
);
|
|
179
|
-
|
|
189
|
+
if ("isConflict" in res.data) {
|
|
190
|
+
return res.data;
|
|
191
|
+
}
|
|
192
|
+
const { accounts } = res.data;
|
|
193
|
+
return { accounts: (0, import_utils.fromLinkedAccounts)(accounts) };
|
|
180
194
|
});
|
|
181
195
|
this.unlinkAccount = (_0) => __async(this, [_0], function* ({ linkedAccountId, userId }) {
|
|
182
196
|
const res = yield this.baseRequest.delete(`/users/${userId}/linked-accounts/${linkedAccountId}`);
|
package/dist/cjs/utils.js
CHANGED
|
@@ -47,6 +47,7 @@ __export(utils_exports, {
|
|
|
47
47
|
extractAuthInfo: () => extractAuthInfo,
|
|
48
48
|
extractWalletRef: () => extractWalletRef,
|
|
49
49
|
fromAccountMetadata: () => fromAccountMetadata,
|
|
50
|
+
fromLinkedAccounts: () => fromLinkedAccounts,
|
|
50
51
|
isCustomId: () => isCustomId,
|
|
51
52
|
isDiscord: () => isDiscord,
|
|
52
53
|
isEmail: () => isEmail,
|
|
@@ -244,11 +245,22 @@ function fromAccountMetadata(obj) {
|
|
|
244
245
|
{}
|
|
245
246
|
);
|
|
246
247
|
}
|
|
248
|
+
function fromLinkedAccounts({ primary, linked }) {
|
|
249
|
+
return {
|
|
250
|
+
primary: primary.map((account) => __spreadProps(__spreadValues({}, account), {
|
|
251
|
+
date: new Date(account.date)
|
|
252
|
+
})),
|
|
253
|
+
linked: linked.map((account) => __spreadProps(__spreadValues({}, account), {
|
|
254
|
+
date: new Date(account.date)
|
|
255
|
+
}))
|
|
256
|
+
};
|
|
257
|
+
}
|
|
247
258
|
// Annotate the CommonJS export names for ESM import in node:
|
|
248
259
|
0 && (module.exports = {
|
|
249
260
|
extractAuthInfo,
|
|
250
261
|
extractWalletRef,
|
|
251
262
|
fromAccountMetadata,
|
|
263
|
+
fromLinkedAccounts,
|
|
252
264
|
isCustomId,
|
|
253
265
|
isDiscord,
|
|
254
266
|
isEmail,
|
package/dist/esm/client.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
__spreadValues
|
|
6
6
|
} from "./chunk-BBZEL7EG.js";
|
|
7
7
|
import axios from "axios";
|
|
8
|
-
import { extractWalletRef, fromAccountMetadata } from "./utils.js";
|
|
8
|
+
import { extractWalletRef, fromAccountMetadata, fromLinkedAccounts } from "./utils.js";
|
|
9
9
|
import { SESSION_COOKIE_HEADER_NAME, VERSION_HEADER_NAME, PARTNER_ID_HEADER_NAME, API_KEY_HEADER_NAME } from "./consts.js";
|
|
10
10
|
import { ParaApiError } from "./error.js";
|
|
11
11
|
const handleResponseSuccess = (response) => {
|
|
@@ -78,9 +78,19 @@ class Client {
|
|
|
78
78
|
const res = yield this.baseRequest.post(`/users/${userId}/verify`, body);
|
|
79
79
|
return res.data;
|
|
80
80
|
});
|
|
81
|
-
this.getLinkedAccounts = (_0) => __async(this, [_0], function* ({
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
this.getLinkedAccounts = (_0) => __async(this, [_0], function* ({
|
|
82
|
+
userId,
|
|
83
|
+
withMetadata = false
|
|
84
|
+
}) {
|
|
85
|
+
const res = yield this.baseRequest.get(
|
|
86
|
+
`/users/${userId}/linked-accounts`,
|
|
87
|
+
...withMetadata ? [
|
|
88
|
+
{
|
|
89
|
+
params: { withMetadata }
|
|
90
|
+
}
|
|
91
|
+
] : []
|
|
92
|
+
);
|
|
93
|
+
return { accounts: fromLinkedAccounts(res.data.accounts) };
|
|
84
94
|
});
|
|
85
95
|
this.linkAccount = (_a) => __async(this, null, function* () {
|
|
86
96
|
var _b = _a, { userId } = _b, opts = __objRest(_b, ["userId"]);
|
|
@@ -99,7 +109,11 @@ class Client {
|
|
|
99
109
|
`/users/${userId}/linked-accounts/${linkedAccountId}/verify`,
|
|
100
110
|
opts
|
|
101
111
|
);
|
|
102
|
-
|
|
112
|
+
if ("isConflict" in res.data) {
|
|
113
|
+
return res.data;
|
|
114
|
+
}
|
|
115
|
+
const { accounts } = res.data;
|
|
116
|
+
return { accounts: fromLinkedAccounts(accounts) };
|
|
103
117
|
});
|
|
104
118
|
this.unlinkAccount = (_0) => __async(this, [_0], function* ({ linkedAccountId, userId }) {
|
|
105
119
|
const res = yield this.baseRequest.delete(`/users/${userId}/linked-accounts/${linkedAccountId}`);
|
package/dist/esm/utils.js
CHANGED
|
@@ -179,10 +179,21 @@ function fromAccountMetadata(obj) {
|
|
|
179
179
|
{}
|
|
180
180
|
);
|
|
181
181
|
}
|
|
182
|
+
function fromLinkedAccounts({ primary, linked }) {
|
|
183
|
+
return {
|
|
184
|
+
primary: primary.map((account) => __spreadProps(__spreadValues({}, account), {
|
|
185
|
+
date: new Date(account.date)
|
|
186
|
+
})),
|
|
187
|
+
linked: linked.map((account) => __spreadProps(__spreadValues({}, account), {
|
|
188
|
+
date: new Date(account.date)
|
|
189
|
+
}))
|
|
190
|
+
};
|
|
191
|
+
}
|
|
182
192
|
export {
|
|
183
193
|
extractAuthInfo,
|
|
184
194
|
extractWalletRef,
|
|
185
195
|
fromAccountMetadata,
|
|
196
|
+
fromLinkedAccounts,
|
|
186
197
|
isCustomId,
|
|
187
198
|
isDiscord,
|
|
188
199
|
isEmail,
|
package/dist/types/client.d.ts
CHANGED
|
@@ -155,8 +155,9 @@ declare class Client {
|
|
|
155
155
|
shouldTrackUser?: boolean;
|
|
156
156
|
}) => Promise<LoginExternalWalletResponse>;
|
|
157
157
|
verifyNewAccount: (userId: string, body: verifyBody) => Promise<ServerAuthStateSignup>;
|
|
158
|
-
getLinkedAccounts: ({ userId }: {
|
|
158
|
+
getLinkedAccounts: ({ userId, withMetadata, }: {
|
|
159
159
|
userId: string;
|
|
160
|
+
withMetadata?: boolean;
|
|
160
161
|
}) => Promise<{
|
|
161
162
|
accounts: LinkedAccounts;
|
|
162
163
|
}>;
|
|
@@ -237,17 +237,18 @@ export type IssueJwtResponse = {
|
|
|
237
237
|
*/
|
|
238
238
|
keyId: string;
|
|
239
239
|
};
|
|
240
|
-
export type LinkedAccount = {
|
|
240
|
+
export type LinkedAccount<D extends Date | string = Date> = {
|
|
241
241
|
id?: string;
|
|
242
|
+
date: D;
|
|
242
243
|
type: TLinkedAccountType;
|
|
243
244
|
identifier: string;
|
|
244
245
|
displayName: string;
|
|
245
246
|
externalWallet?: ExternalWalletInfo;
|
|
247
|
+
metadata?: unknown;
|
|
246
248
|
};
|
|
247
|
-
export type LinkedAccounts = {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
linked: LinkedAccount[];
|
|
249
|
+
export type LinkedAccounts<D extends Date | string = Date> = {
|
|
250
|
+
primary: LinkedAccount<D>[];
|
|
251
|
+
linked: LinkedAccount<D>[];
|
|
251
252
|
};
|
|
252
253
|
export type LinkAccountParams = {
|
|
253
254
|
type: TLinkedAccountType;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Auth, AuthInfo, AuthParams, PrimaryAuth, PrimaryAuthInfo, VerifiedAuth, WalletParams, WalletRef } from './types/index.js';
|
|
2
|
-
import { AccountMetadata, AccountMetadataKey, PregenAuth, PregenAuthInfo, PregenOrGuestAuth } from './types/auth.js';
|
|
2
|
+
import { AccountMetadata, AccountMetadataKey, LinkedAccounts, PregenAuth, PregenAuthInfo, PregenOrGuestAuth } from './types/auth.js';
|
|
3
3
|
import { PregenIds, TPregenIdentifierType } from './types/wallet.js';
|
|
4
4
|
export declare function isWalletId(params: WalletParams): params is {
|
|
5
5
|
walletId: string;
|
|
@@ -55,4 +55,5 @@ export declare function fromAccountMetadata(obj: Partial<Record<AccountMetadataK
|
|
|
55
55
|
date: string;
|
|
56
56
|
metadata: object;
|
|
57
57
|
}>> | undefined): AccountMetadata;
|
|
58
|
+
export declare function fromLinkedAccounts({ primary, linked }: LinkedAccounts<string>): LinkedAccounts<Date>;
|
|
58
59
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpara/user-management-client",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.26",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"require": "./dist/cjs/index.js"
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "c97be88dd7414041f25d6f4b9758ea26dcfb2694"
|
|
36
36
|
}
|