@ecency/sdk 1.4.1 → 1.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/dist/browser/index.d.ts +146 -73
- package/dist/browser/index.js +624 -237
- package/dist/browser/index.js.map +1 -1
- package/dist/index.browser.mjs +41 -30
- package/dist/index.cjs +41 -30
- package/dist/index.d.ts +16 -7
- package/dist/index.mjs +41 -30
- package/dist/node/index.cjs +646 -236
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +624 -237
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.browser.mjs
CHANGED
|
@@ -193,8 +193,8 @@ var getBoundFetch2 = () => {
|
|
|
193
193
|
}
|
|
194
194
|
return globalThis.fetch;
|
|
195
195
|
};
|
|
196
|
-
function useBroadcastMutation(mutationKey = [], username, operations, onSuccess = () => {
|
|
197
|
-
}) {
|
|
196
|
+
function useBroadcastMutation(mutationKey = [], username, accessToken, operations, onSuccess = () => {
|
|
197
|
+
}, auth) {
|
|
198
198
|
return useMutation({
|
|
199
199
|
onSuccess,
|
|
200
200
|
mutationKey: [...mutationKey, username],
|
|
@@ -204,7 +204,7 @@ function useBroadcastMutation(mutationKey = [], username, operations, onSuccess
|
|
|
204
204
|
"[Core][Broadcast] Attempted to call broadcast API with anon user"
|
|
205
205
|
);
|
|
206
206
|
}
|
|
207
|
-
const postingKey =
|
|
207
|
+
const postingKey = auth?.postingKey;
|
|
208
208
|
if (postingKey) {
|
|
209
209
|
const privateKey = PrivateKey.fromString(postingKey);
|
|
210
210
|
return CONFIG.hiveClient.broadcast.sendOperations(
|
|
@@ -212,7 +212,7 @@ function useBroadcastMutation(mutationKey = [], username, operations, onSuccess
|
|
|
212
212
|
privateKey
|
|
213
213
|
);
|
|
214
214
|
}
|
|
215
|
-
const loginType =
|
|
215
|
+
const loginType = auth?.loginType;
|
|
216
216
|
if (loginType && loginType == "keychain") {
|
|
217
217
|
return keychain_exports.broadcast(
|
|
218
218
|
username,
|
|
@@ -220,13 +220,12 @@ function useBroadcastMutation(mutationKey = [], username, operations, onSuccess
|
|
|
220
220
|
"Posting"
|
|
221
221
|
).then((r) => r.result);
|
|
222
222
|
}
|
|
223
|
-
|
|
224
|
-
if (token) {
|
|
223
|
+
if (accessToken) {
|
|
225
224
|
const f = getBoundFetch2();
|
|
226
225
|
const res = await f("https://hivesigner.com/api/broadcast", {
|
|
227
226
|
method: "POST",
|
|
228
227
|
headers: {
|
|
229
|
-
Authorization:
|
|
228
|
+
Authorization: accessToken,
|
|
230
229
|
"Content-Type": "application/json",
|
|
231
230
|
Accept: "application/json"
|
|
232
231
|
},
|
|
@@ -248,7 +247,7 @@ function useBroadcastMutation(mutationKey = [], username, operations, onSuccess
|
|
|
248
247
|
}
|
|
249
248
|
});
|
|
250
249
|
}
|
|
251
|
-
async function broadcastJson(username, id, payload) {
|
|
250
|
+
async function broadcastJson(username, id, payload, accessToken, auth) {
|
|
252
251
|
if (!username) {
|
|
253
252
|
throw new Error(
|
|
254
253
|
"[Core][Broadcast] Attempted to call broadcast API with anon user"
|
|
@@ -260,7 +259,7 @@ async function broadcastJson(username, id, payload) {
|
|
|
260
259
|
required_posting_auths: [username],
|
|
261
260
|
json: JSON.stringify(payload)
|
|
262
261
|
};
|
|
263
|
-
const postingKey =
|
|
262
|
+
const postingKey = auth?.postingKey;
|
|
264
263
|
if (postingKey) {
|
|
265
264
|
const privateKey = PrivateKey.fromString(postingKey);
|
|
266
265
|
return CONFIG.hiveClient.broadcast.json(
|
|
@@ -268,14 +267,13 @@ async function broadcastJson(username, id, payload) {
|
|
|
268
267
|
privateKey
|
|
269
268
|
);
|
|
270
269
|
}
|
|
271
|
-
const loginType =
|
|
270
|
+
const loginType = auth?.loginType;
|
|
272
271
|
if (loginType && loginType == "keychain") {
|
|
273
272
|
return keychain_exports.broadcast(username, [["custom_json", jjson]], "Posting").then((r) => r.result);
|
|
274
273
|
}
|
|
275
|
-
|
|
276
|
-
if (token) {
|
|
274
|
+
if (accessToken) {
|
|
277
275
|
const response = await new hs.Client({
|
|
278
|
-
accessToken
|
|
276
|
+
accessToken
|
|
279
277
|
}).customJson([], [username], id, JSON.stringify(payload));
|
|
280
278
|
return response.result;
|
|
281
279
|
}
|
|
@@ -591,11 +589,14 @@ function getActiveAccountFavouritesQueryOptions(activeUsername) {
|
|
|
591
589
|
}
|
|
592
590
|
});
|
|
593
591
|
}
|
|
594
|
-
function getAccountRecoveriesQueryOptions(username) {
|
|
592
|
+
function getAccountRecoveriesQueryOptions(username, code) {
|
|
595
593
|
return queryOptions({
|
|
596
|
-
enabled: !!username,
|
|
594
|
+
enabled: !!username && !!code,
|
|
597
595
|
queryKey: ["accounts", "recoveries", username],
|
|
598
596
|
queryFn: async () => {
|
|
597
|
+
if (!username || !code) {
|
|
598
|
+
throw new Error("[SDK][Accounts] Missing username or access token");
|
|
599
|
+
}
|
|
599
600
|
const fetchApi = getBoundFetch();
|
|
600
601
|
const response = await fetchApi(
|
|
601
602
|
CONFIG.privateApiHost + "/private-api/recoveries",
|
|
@@ -604,7 +605,7 @@ function getAccountRecoveriesQueryOptions(username) {
|
|
|
604
605
|
headers: {
|
|
605
606
|
"Content-Type": "application/json"
|
|
606
607
|
},
|
|
607
|
-
body: JSON.stringify({ code
|
|
608
|
+
body: JSON.stringify({ code })
|
|
608
609
|
}
|
|
609
610
|
);
|
|
610
611
|
return response.json();
|
|
@@ -646,12 +647,13 @@ function getBuiltProfile({
|
|
|
646
647
|
metadata.tokens = sanitizeTokens(metadata.tokens);
|
|
647
648
|
return metadata;
|
|
648
649
|
}
|
|
649
|
-
function useAccountUpdate(username) {
|
|
650
|
+
function useAccountUpdate(username, accessToken, auth) {
|
|
650
651
|
const queryClient = useQueryClient();
|
|
651
652
|
const { data } = useQuery(getAccountFullQueryOptions(username));
|
|
652
653
|
return useBroadcastMutation(
|
|
653
654
|
["accounts", "update"],
|
|
654
655
|
username,
|
|
656
|
+
accessToken,
|
|
655
657
|
(payload) => {
|
|
656
658
|
if (!data) {
|
|
657
659
|
throw new Error("[SDK][Accounts] \u2013 cannot update not existing account");
|
|
@@ -680,7 +682,8 @@ function useAccountUpdate(username) {
|
|
|
680
682
|
obj.profile = getBuiltProfile({ ...variables, data: data2 });
|
|
681
683
|
return obj;
|
|
682
684
|
}
|
|
683
|
-
)
|
|
685
|
+
),
|
|
686
|
+
auth
|
|
684
687
|
);
|
|
685
688
|
}
|
|
686
689
|
function useAccountRelationsUpdate(reference, target, onSuccess, onError) {
|
|
@@ -1332,11 +1335,10 @@ var queries_exports = {};
|
|
|
1332
1335
|
__export(queries_exports, {
|
|
1333
1336
|
getDecodeMemoQueryOptions: () => getDecodeMemoQueryOptions
|
|
1334
1337
|
});
|
|
1335
|
-
function getDecodeMemoQueryOptions(username, memo) {
|
|
1338
|
+
function getDecodeMemoQueryOptions(username, memo, accessToken) {
|
|
1336
1339
|
return queryOptions({
|
|
1337
1340
|
queryKey: ["integrations", "hivesigner", "decode-memo", username],
|
|
1338
1341
|
queryFn: async () => {
|
|
1339
|
-
const accessToken = getAccessToken(username);
|
|
1340
1342
|
if (accessToken) {
|
|
1341
1343
|
const hsClient = new hs.Client({
|
|
1342
1344
|
accessToken
|
|
@@ -1353,12 +1355,12 @@ var HiveSignerIntegration = {
|
|
|
1353
1355
|
};
|
|
1354
1356
|
|
|
1355
1357
|
// src/modules/integrations/3speak/queries/get-account-token-query-options.ts
|
|
1356
|
-
function getAccountTokenQueryOptions(username) {
|
|
1358
|
+
function getAccountTokenQueryOptions(username, accessToken) {
|
|
1357
1359
|
return queryOptions({
|
|
1358
1360
|
queryKey: ["integrations", "3speak", "authenticate", username],
|
|
1359
|
-
enabled: !!username,
|
|
1361
|
+
enabled: !!username && !!accessToken,
|
|
1360
1362
|
queryFn: async () => {
|
|
1361
|
-
if (!username) {
|
|
1363
|
+
if (!username || !accessToken) {
|
|
1362
1364
|
throw new Error("[SDK][Integrations][3Speak] \u2013\xA0anon user");
|
|
1363
1365
|
}
|
|
1364
1366
|
const fetchApi = getBoundFetch();
|
|
@@ -1372,7 +1374,8 @@ function getAccountTokenQueryOptions(username) {
|
|
|
1372
1374
|
);
|
|
1373
1375
|
const memoQueryOptions = HiveSignerIntegration.queries.getDecodeMemoQueryOptions(
|
|
1374
1376
|
username,
|
|
1375
|
-
(await response.json()).memo
|
|
1377
|
+
(await response.json()).memo,
|
|
1378
|
+
accessToken
|
|
1376
1379
|
);
|
|
1377
1380
|
await getQueryClient().prefetchQuery(memoQueryOptions);
|
|
1378
1381
|
const { memoDecoded } = getQueryClient().getQueryData(
|
|
@@ -1382,17 +1385,25 @@ function getAccountTokenQueryOptions(username) {
|
|
|
1382
1385
|
}
|
|
1383
1386
|
});
|
|
1384
1387
|
}
|
|
1385
|
-
function getAccountVideosQueryOptions(username) {
|
|
1388
|
+
function getAccountVideosQueryOptions(username, accessToken) {
|
|
1386
1389
|
return queryOptions({
|
|
1387
1390
|
queryKey: ["integrations", "3speak", "videos", username],
|
|
1388
|
-
enabled: !!username,
|
|
1391
|
+
enabled: !!username && !!accessToken,
|
|
1389
1392
|
queryFn: async () => {
|
|
1390
|
-
|
|
1391
|
-
|
|
1393
|
+
if (!username || !accessToken) {
|
|
1394
|
+
throw new Error("[SDK][Integrations][3Speak] \u2013\xA0anon user");
|
|
1395
|
+
}
|
|
1396
|
+
const tokenQueryOptions = getAccountTokenQueryOptions(
|
|
1397
|
+
username,
|
|
1398
|
+
accessToken
|
|
1392
1399
|
);
|
|
1400
|
+
await getQueryClient().prefetchQuery(tokenQueryOptions);
|
|
1393
1401
|
const token = getQueryClient().getQueryData(
|
|
1394
|
-
|
|
1402
|
+
tokenQueryOptions.queryKey
|
|
1395
1403
|
);
|
|
1404
|
+
if (!token) {
|
|
1405
|
+
throw new Error("[SDK][Integrations][3Speak] \u2013 missing account token");
|
|
1406
|
+
}
|
|
1396
1407
|
const fetchApi = getBoundFetch();
|
|
1397
1408
|
const response = await fetchApi(
|
|
1398
1409
|
`https://studio.3speak.tv/mobile/api/my-videos`,
|
|
@@ -1649,4 +1660,4 @@ function getCommunityPermissions({
|
|
|
1649
1660
|
|
|
1650
1661
|
export { CONFIG, ConfigManager, mutations_exports as EcencyAnalytics, EcencyQueriesManager, HiveSignerIntegration, keychain_exports as Keychain, NaiMap, ROLES, Symbol2 as Symbol, ThreeSpeakIntegration, broadcastJson, checkUsernameWalletsPendingQueryOptions, decodeObj, dedupeAndSortKeyAuths, encodeObj, getAccessToken, getAccountFullQueryOptions, getAccountPendingRecoveryQueryOptions, getAccountRcQueryOptions, getAccountRecoveriesQueryOptions, getAccountSubscriptionsQueryOptions, getActiveAccountBookmarksQueryOptions, getActiveAccountFavouritesQueryOptions, getBoundFetch, getChainPropertiesQueryOptions, getCommunitiesQueryOptions, getCommunityContextQueryOptions, getCommunityPermissions, getCommunityType, getDynamicPropsQueryOptions, getFragmentsQueryOptions, getGameStatusCheckQueryOptions, getHivePoshLinksQueryOptions, getLoginType, getPostingKey, getPromotedPostsQuery, getQueryClient, getRcStatsQueryOptions, getRefreshToken, getRelationshipBetweenAccountsQueryOptions, getSearchAccountsByUsernameQueryOptions, getStatsQueryOptions, getTrendingTagsQueryOptions, getUser, makeQueryClient, parseAsset, roleMap, useAccountFavouriteAdd, useAccountFavouriteDelete, useAccountRelationsUpdate, useAccountRevokeKey, useAccountRevokePosting, useAccountUpdate, useAccountUpdateKeyAuths, useAccountUpdatePassword, useAccountUpdateRecovery, useAddFragment, useBookmarkAdd, useBookmarkDelete, useBroadcastMutation, useEditFragment, useGameClaim, useRemoveFragment, useSignOperationByHivesigner, useSignOperationByKey, useSignOperationByKeychain };
|
|
1651
1662
|
//# sourceMappingURL=index.browser.mjs.map
|
|
1652
|
-
//# sourceMappingURL=index.browser.mjs.map
|
|
1663
|
+
//# sourceMappingURL=index.browser.mjs.map
|
package/dist/index.cjs
CHANGED
|
@@ -214,8 +214,8 @@ var getBoundFetch2 = () => {
|
|
|
214
214
|
}
|
|
215
215
|
return globalThis.fetch;
|
|
216
216
|
};
|
|
217
|
-
function useBroadcastMutation(mutationKey = [], username, operations, onSuccess = () => {
|
|
218
|
-
}) {
|
|
217
|
+
function useBroadcastMutation(mutationKey = [], username, accessToken, operations, onSuccess = () => {
|
|
218
|
+
}, auth) {
|
|
219
219
|
return reactQuery.useMutation({
|
|
220
220
|
onSuccess,
|
|
221
221
|
mutationKey: [...mutationKey, username],
|
|
@@ -225,7 +225,7 @@ function useBroadcastMutation(mutationKey = [], username, operations, onSuccess
|
|
|
225
225
|
"[Core][Broadcast] Attempted to call broadcast API with anon user"
|
|
226
226
|
);
|
|
227
227
|
}
|
|
228
|
-
const postingKey =
|
|
228
|
+
const postingKey = auth?.postingKey;
|
|
229
229
|
if (postingKey) {
|
|
230
230
|
const privateKey = dhive.PrivateKey.fromString(postingKey);
|
|
231
231
|
return CONFIG.hiveClient.broadcast.sendOperations(
|
|
@@ -233,7 +233,7 @@ function useBroadcastMutation(mutationKey = [], username, operations, onSuccess
|
|
|
233
233
|
privateKey
|
|
234
234
|
);
|
|
235
235
|
}
|
|
236
|
-
const loginType =
|
|
236
|
+
const loginType = auth?.loginType;
|
|
237
237
|
if (loginType && loginType == "keychain") {
|
|
238
238
|
return keychain_exports.broadcast(
|
|
239
239
|
username,
|
|
@@ -241,13 +241,12 @@ function useBroadcastMutation(mutationKey = [], username, operations, onSuccess
|
|
|
241
241
|
"Posting"
|
|
242
242
|
).then((r) => r.result);
|
|
243
243
|
}
|
|
244
|
-
|
|
245
|
-
if (token) {
|
|
244
|
+
if (accessToken) {
|
|
246
245
|
const f = getBoundFetch2();
|
|
247
246
|
const res = await f("https://hivesigner.com/api/broadcast", {
|
|
248
247
|
method: "POST",
|
|
249
248
|
headers: {
|
|
250
|
-
Authorization:
|
|
249
|
+
Authorization: accessToken,
|
|
251
250
|
"Content-Type": "application/json",
|
|
252
251
|
Accept: "application/json"
|
|
253
252
|
},
|
|
@@ -269,7 +268,7 @@ function useBroadcastMutation(mutationKey = [], username, operations, onSuccess
|
|
|
269
268
|
}
|
|
270
269
|
});
|
|
271
270
|
}
|
|
272
|
-
async function broadcastJson(username, id, payload) {
|
|
271
|
+
async function broadcastJson(username, id, payload, accessToken, auth) {
|
|
273
272
|
if (!username) {
|
|
274
273
|
throw new Error(
|
|
275
274
|
"[Core][Broadcast] Attempted to call broadcast API with anon user"
|
|
@@ -281,7 +280,7 @@ async function broadcastJson(username, id, payload) {
|
|
|
281
280
|
required_posting_auths: [username],
|
|
282
281
|
json: JSON.stringify(payload)
|
|
283
282
|
};
|
|
284
|
-
const postingKey =
|
|
283
|
+
const postingKey = auth?.postingKey;
|
|
285
284
|
if (postingKey) {
|
|
286
285
|
const privateKey = dhive.PrivateKey.fromString(postingKey);
|
|
287
286
|
return CONFIG.hiveClient.broadcast.json(
|
|
@@ -289,14 +288,13 @@ async function broadcastJson(username, id, payload) {
|
|
|
289
288
|
privateKey
|
|
290
289
|
);
|
|
291
290
|
}
|
|
292
|
-
const loginType =
|
|
291
|
+
const loginType = auth?.loginType;
|
|
293
292
|
if (loginType && loginType == "keychain") {
|
|
294
293
|
return keychain_exports.broadcast(username, [["custom_json", jjson]], "Posting").then((r) => r.result);
|
|
295
294
|
}
|
|
296
|
-
|
|
297
|
-
if (token) {
|
|
295
|
+
if (accessToken) {
|
|
298
296
|
const response = await new hs__default.default.Client({
|
|
299
|
-
accessToken
|
|
297
|
+
accessToken
|
|
300
298
|
}).customJson([], [username], id, JSON.stringify(payload));
|
|
301
299
|
return response.result;
|
|
302
300
|
}
|
|
@@ -612,11 +610,14 @@ function getActiveAccountFavouritesQueryOptions(activeUsername) {
|
|
|
612
610
|
}
|
|
613
611
|
});
|
|
614
612
|
}
|
|
615
|
-
function getAccountRecoveriesQueryOptions(username) {
|
|
613
|
+
function getAccountRecoveriesQueryOptions(username, code) {
|
|
616
614
|
return reactQuery.queryOptions({
|
|
617
|
-
enabled: !!username,
|
|
615
|
+
enabled: !!username && !!code,
|
|
618
616
|
queryKey: ["accounts", "recoveries", username],
|
|
619
617
|
queryFn: async () => {
|
|
618
|
+
if (!username || !code) {
|
|
619
|
+
throw new Error("[SDK][Accounts] Missing username or access token");
|
|
620
|
+
}
|
|
620
621
|
const fetchApi = getBoundFetch();
|
|
621
622
|
const response = await fetchApi(
|
|
622
623
|
CONFIG.privateApiHost + "/private-api/recoveries",
|
|
@@ -625,7 +626,7 @@ function getAccountRecoveriesQueryOptions(username) {
|
|
|
625
626
|
headers: {
|
|
626
627
|
"Content-Type": "application/json"
|
|
627
628
|
},
|
|
628
|
-
body: JSON.stringify({ code
|
|
629
|
+
body: JSON.stringify({ code })
|
|
629
630
|
}
|
|
630
631
|
);
|
|
631
632
|
return response.json();
|
|
@@ -667,12 +668,13 @@ function getBuiltProfile({
|
|
|
667
668
|
metadata.tokens = sanitizeTokens(metadata.tokens);
|
|
668
669
|
return metadata;
|
|
669
670
|
}
|
|
670
|
-
function useAccountUpdate(username) {
|
|
671
|
+
function useAccountUpdate(username, accessToken, auth) {
|
|
671
672
|
const queryClient = reactQuery.useQueryClient();
|
|
672
673
|
const { data } = reactQuery.useQuery(getAccountFullQueryOptions(username));
|
|
673
674
|
return useBroadcastMutation(
|
|
674
675
|
["accounts", "update"],
|
|
675
676
|
username,
|
|
677
|
+
accessToken,
|
|
676
678
|
(payload) => {
|
|
677
679
|
if (!data) {
|
|
678
680
|
throw new Error("[SDK][Accounts] \u2013 cannot update not existing account");
|
|
@@ -701,7 +703,8 @@ function useAccountUpdate(username) {
|
|
|
701
703
|
obj.profile = getBuiltProfile({ ...variables, data: data2 });
|
|
702
704
|
return obj;
|
|
703
705
|
}
|
|
704
|
-
)
|
|
706
|
+
),
|
|
707
|
+
auth
|
|
705
708
|
);
|
|
706
709
|
}
|
|
707
710
|
function useAccountRelationsUpdate(reference, target, onSuccess, onError) {
|
|
@@ -1353,11 +1356,10 @@ var queries_exports = {};
|
|
|
1353
1356
|
__export(queries_exports, {
|
|
1354
1357
|
getDecodeMemoQueryOptions: () => getDecodeMemoQueryOptions
|
|
1355
1358
|
});
|
|
1356
|
-
function getDecodeMemoQueryOptions(username, memo) {
|
|
1359
|
+
function getDecodeMemoQueryOptions(username, memo, accessToken) {
|
|
1357
1360
|
return reactQuery.queryOptions({
|
|
1358
1361
|
queryKey: ["integrations", "hivesigner", "decode-memo", username],
|
|
1359
1362
|
queryFn: async () => {
|
|
1360
|
-
const accessToken = getAccessToken(username);
|
|
1361
1363
|
if (accessToken) {
|
|
1362
1364
|
const hsClient = new hs__default.default.Client({
|
|
1363
1365
|
accessToken
|
|
@@ -1374,12 +1376,12 @@ var HiveSignerIntegration = {
|
|
|
1374
1376
|
};
|
|
1375
1377
|
|
|
1376
1378
|
// src/modules/integrations/3speak/queries/get-account-token-query-options.ts
|
|
1377
|
-
function getAccountTokenQueryOptions(username) {
|
|
1379
|
+
function getAccountTokenQueryOptions(username, accessToken) {
|
|
1378
1380
|
return reactQuery.queryOptions({
|
|
1379
1381
|
queryKey: ["integrations", "3speak", "authenticate", username],
|
|
1380
|
-
enabled: !!username,
|
|
1382
|
+
enabled: !!username && !!accessToken,
|
|
1381
1383
|
queryFn: async () => {
|
|
1382
|
-
if (!username) {
|
|
1384
|
+
if (!username || !accessToken) {
|
|
1383
1385
|
throw new Error("[SDK][Integrations][3Speak] \u2013\xA0anon user");
|
|
1384
1386
|
}
|
|
1385
1387
|
const fetchApi = getBoundFetch();
|
|
@@ -1393,7 +1395,8 @@ function getAccountTokenQueryOptions(username) {
|
|
|
1393
1395
|
);
|
|
1394
1396
|
const memoQueryOptions = HiveSignerIntegration.queries.getDecodeMemoQueryOptions(
|
|
1395
1397
|
username,
|
|
1396
|
-
(await response.json()).memo
|
|
1398
|
+
(await response.json()).memo,
|
|
1399
|
+
accessToken
|
|
1397
1400
|
);
|
|
1398
1401
|
await getQueryClient().prefetchQuery(memoQueryOptions);
|
|
1399
1402
|
const { memoDecoded } = getQueryClient().getQueryData(
|
|
@@ -1403,17 +1406,25 @@ function getAccountTokenQueryOptions(username) {
|
|
|
1403
1406
|
}
|
|
1404
1407
|
});
|
|
1405
1408
|
}
|
|
1406
|
-
function getAccountVideosQueryOptions(username) {
|
|
1409
|
+
function getAccountVideosQueryOptions(username, accessToken) {
|
|
1407
1410
|
return reactQuery.queryOptions({
|
|
1408
1411
|
queryKey: ["integrations", "3speak", "videos", username],
|
|
1409
|
-
enabled: !!username,
|
|
1412
|
+
enabled: !!username && !!accessToken,
|
|
1410
1413
|
queryFn: async () => {
|
|
1411
|
-
|
|
1412
|
-
|
|
1414
|
+
if (!username || !accessToken) {
|
|
1415
|
+
throw new Error("[SDK][Integrations][3Speak] \u2013\xA0anon user");
|
|
1416
|
+
}
|
|
1417
|
+
const tokenQueryOptions = getAccountTokenQueryOptions(
|
|
1418
|
+
username,
|
|
1419
|
+
accessToken
|
|
1413
1420
|
);
|
|
1421
|
+
await getQueryClient().prefetchQuery(tokenQueryOptions);
|
|
1414
1422
|
const token = getQueryClient().getQueryData(
|
|
1415
|
-
|
|
1423
|
+
tokenQueryOptions.queryKey
|
|
1416
1424
|
);
|
|
1425
|
+
if (!token) {
|
|
1426
|
+
throw new Error("[SDK][Integrations][3Speak] \u2013 missing account token");
|
|
1427
|
+
}
|
|
1417
1428
|
const fetchApi = getBoundFetch();
|
|
1418
1429
|
const response = await fetchApi(
|
|
1419
1430
|
`https://studio.3speak.tv/mobile/api/my-videos`,
|
|
@@ -1733,4 +1744,4 @@ exports.useSignOperationByHivesigner = useSignOperationByHivesigner;
|
|
|
1733
1744
|
exports.useSignOperationByKey = useSignOperationByKey;
|
|
1734
1745
|
exports.useSignOperationByKeychain = useSignOperationByKeychain;
|
|
1735
1746
|
//# sourceMappingURL=index.cjs.map
|
|
1736
|
-
//# sourceMappingURL=index.cjs.map
|
|
1747
|
+
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.ts
CHANGED
|
@@ -119,7 +119,10 @@ interface Payload$4 {
|
|
|
119
119
|
profile: Partial<AccountProfile>;
|
|
120
120
|
tokens: AccountProfile["tokens"];
|
|
121
121
|
}
|
|
122
|
-
declare function useAccountUpdate(username: string
|
|
122
|
+
declare function useAccountUpdate(username: string, accessToken: string | undefined, auth?: {
|
|
123
|
+
postingKey?: string | null;
|
|
124
|
+
loginType?: string | null;
|
|
125
|
+
}): _tanstack_react_query.UseMutationResult<unknown, Error, Partial<Payload$4>, unknown>;
|
|
123
126
|
|
|
124
127
|
type Kind = "toggle-ignore" | "toggle-follow";
|
|
125
128
|
declare function useAccountRelationsUpdate(reference: string | undefined, target: string | undefined, onSuccess: (data: Partial<AccountRelationship> | undefined) => void, onError: (e: Error) => void): _tanstack_react_query.UseMutationResult<{
|
|
@@ -513,7 +516,7 @@ declare function getActiveAccountFavouritesQueryOptions(activeUsername: string |
|
|
|
513
516
|
};
|
|
514
517
|
};
|
|
515
518
|
|
|
516
|
-
declare function getAccountRecoveriesQueryOptions(username: string | undefined): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetRecoveriesEmailResponse[], Error, GetRecoveriesEmailResponse[], (string | undefined)[]>, "queryFn"> & {
|
|
519
|
+
declare function getAccountRecoveriesQueryOptions(username: string | undefined, code: string | undefined): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GetRecoveriesEmailResponse[], Error, GetRecoveriesEmailResponse[], (string | undefined)[]>, "queryFn"> & {
|
|
517
520
|
queryFn?: _tanstack_react_query.QueryFunction<GetRecoveriesEmailResponse[], (string | undefined)[], never> | undefined;
|
|
518
521
|
} & {
|
|
519
522
|
queryKey: (string | undefined)[] & {
|
|
@@ -570,9 +573,15 @@ declare function getChainPropertiesQueryOptions(): _tanstack_react_query.OmitKey
|
|
|
570
573
|
};
|
|
571
574
|
};
|
|
572
575
|
|
|
573
|
-
declare function useBroadcastMutation<T>(mutationKey: MutationKey | undefined, username: string | undefined, operations: (payload: T) => Operation[], onSuccess?: UseMutationOptions<unknown, Error, T>["onSuccess"]
|
|
576
|
+
declare function useBroadcastMutation<T>(mutationKey: MutationKey | undefined, username: string | undefined, accessToken: string | undefined, operations: (payload: T) => Operation[], onSuccess?: UseMutationOptions<unknown, Error, T>["onSuccess"], auth?: {
|
|
577
|
+
postingKey?: string | null;
|
|
578
|
+
loginType?: string | null;
|
|
579
|
+
}): _tanstack_react_query.UseMutationResult<unknown, Error, T, unknown>;
|
|
574
580
|
|
|
575
|
-
declare function broadcastJson<T>(username: string | undefined, id: string, payload: T
|
|
581
|
+
declare function broadcastJson<T>(username: string | undefined, id: string, payload: T, accessToken?: string, auth?: {
|
|
582
|
+
postingKey?: string | null;
|
|
583
|
+
loginType?: string | null;
|
|
584
|
+
}): Promise<any>;
|
|
576
585
|
|
|
577
586
|
interface StoringUser {
|
|
578
587
|
username: string;
|
|
@@ -791,7 +800,7 @@ interface ThreeSpeakVideo {
|
|
|
791
800
|
_id: string;
|
|
792
801
|
}
|
|
793
802
|
|
|
794
|
-
declare function getAccountTokenQueryOptions(username: string | undefined): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<any, Error, any, (string | undefined)[]>, "queryFn"> & {
|
|
803
|
+
declare function getAccountTokenQueryOptions(username: string | undefined, accessToken: string | undefined): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<any, Error, any, (string | undefined)[]>, "queryFn"> & {
|
|
795
804
|
queryFn?: _tanstack_react_query.QueryFunction<any, (string | undefined)[], never> | undefined;
|
|
796
805
|
} & {
|
|
797
806
|
queryKey: (string | undefined)[] & {
|
|
@@ -800,7 +809,7 @@ declare function getAccountTokenQueryOptions(username: string | undefined): _tan
|
|
|
800
809
|
};
|
|
801
810
|
};
|
|
802
811
|
|
|
803
|
-
declare function getAccountVideosQueryOptions(username: string | undefined): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ThreeSpeakVideo[], Error, ThreeSpeakVideo[], (string | undefined)[]>, "queryFn"> & {
|
|
812
|
+
declare function getAccountVideosQueryOptions(username: string | undefined, accessToken: string | undefined): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ThreeSpeakVideo[], Error, ThreeSpeakVideo[], (string | undefined)[]>, "queryFn"> & {
|
|
804
813
|
queryFn?: _tanstack_react_query.QueryFunction<ThreeSpeakVideo[], (string | undefined)[], never> | undefined;
|
|
805
814
|
} & {
|
|
806
815
|
queryKey: (string | undefined)[] & {
|
|
@@ -819,7 +828,7 @@ declare const ThreeSpeakIntegration: {
|
|
|
819
828
|
queries: typeof queries$1;
|
|
820
829
|
};
|
|
821
830
|
|
|
822
|
-
declare function getDecodeMemoQueryOptions(username: string, memo: string): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<any, Error, any, string[]>, "queryFn"> & {
|
|
831
|
+
declare function getDecodeMemoQueryOptions(username: string, memo: string, accessToken: string | undefined): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<any, Error, any, string[]>, "queryFn"> & {
|
|
823
832
|
queryFn?: _tanstack_react_query.QueryFunction<any, string[], never> | undefined;
|
|
824
833
|
} & {
|
|
825
834
|
queryKey: string[] & {
|