@blocklet/js-sdk 1.16.40-beta-20250305-115031-9569f29a → 1.16.40-beta-20250310-113951-17556f90
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/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.mjs +8 -3
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -54,9 +54,10 @@ declare class AuthService {
|
|
|
54
54
|
}): Promise<string>;
|
|
55
55
|
getProfile(): Promise<any>;
|
|
56
56
|
refreshProfile(): Promise<void>;
|
|
57
|
-
saveProfile({ locale, inviter }: {
|
|
57
|
+
saveProfile({ locale, inviter, metadata }: {
|
|
58
58
|
locale?: string;
|
|
59
59
|
inviter?: string;
|
|
60
|
+
metadata?: any;
|
|
60
61
|
}): Promise<any>;
|
|
61
62
|
updateDidSpace({ spaceGateway }: {
|
|
62
63
|
spaceGateway: SpaceGateway;
|
|
@@ -247,6 +248,7 @@ type ServerInfo = {
|
|
|
247
248
|
declare class FederatedService {
|
|
248
249
|
private api;
|
|
249
250
|
private blocklet;
|
|
251
|
+
private blockletDataCache;
|
|
250
252
|
constructor({ api, blocklet }: {
|
|
251
253
|
api: Axios;
|
|
252
254
|
blocklet?: BlockletService;
|
|
@@ -267,7 +269,7 @@ declare class FederatedService {
|
|
|
267
269
|
getFederatedApp(blocklet?: Blocklet): AppInfo | null;
|
|
268
270
|
getCurrentApp(blocklet?: Blocklet): AppInfo | ServerInfo;
|
|
269
271
|
getApps(blocklet?: Blocklet): any[];
|
|
270
|
-
getBlockletData(appUrl: string): Promise<any>;
|
|
272
|
+
getBlockletData(appUrl: string, force?: boolean): Promise<any>;
|
|
271
273
|
}
|
|
272
274
|
|
|
273
275
|
declare function getCSRFToken(): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -54,9 +54,10 @@ declare class AuthService {
|
|
|
54
54
|
}): Promise<string>;
|
|
55
55
|
getProfile(): Promise<any>;
|
|
56
56
|
refreshProfile(): Promise<void>;
|
|
57
|
-
saveProfile({ locale, inviter }: {
|
|
57
|
+
saveProfile({ locale, inviter, metadata }: {
|
|
58
58
|
locale?: string;
|
|
59
59
|
inviter?: string;
|
|
60
|
+
metadata?: any;
|
|
60
61
|
}): Promise<any>;
|
|
61
62
|
updateDidSpace({ spaceGateway }: {
|
|
62
63
|
spaceGateway: SpaceGateway;
|
|
@@ -247,6 +248,7 @@ type ServerInfo = {
|
|
|
247
248
|
declare class FederatedService {
|
|
248
249
|
private api;
|
|
249
250
|
private blocklet;
|
|
251
|
+
private blockletDataCache;
|
|
250
252
|
constructor({ api, blocklet }: {
|
|
251
253
|
api: Axios;
|
|
252
254
|
blocklet?: BlockletService;
|
|
@@ -267,7 +269,7 @@ declare class FederatedService {
|
|
|
267
269
|
getFederatedApp(blocklet?: Blocklet): AppInfo | null;
|
|
268
270
|
getCurrentApp(blocklet?: Blocklet): AppInfo | ServerInfo;
|
|
269
271
|
getApps(blocklet?: Blocklet): any[];
|
|
270
|
-
getBlockletData(appUrl: string): Promise<any>;
|
|
272
|
+
getBlockletData(appUrl: string, force?: boolean): Promise<any>;
|
|
271
273
|
}
|
|
272
274
|
|
|
273
275
|
declare function getCSRFToken(): string;
|
package/dist/index.mjs
CHANGED
|
@@ -65,8 +65,8 @@ class AuthService {
|
|
|
65
65
|
async refreshProfile() {
|
|
66
66
|
await this.api.put("/api/user/refreshProfile");
|
|
67
67
|
}
|
|
68
|
-
async saveProfile({ locale, inviter }) {
|
|
69
|
-
const { data } = await this.api.put("/api/user/profile", { locale, inviter });
|
|
68
|
+
async saveProfile({ locale, inviter, metadata }) {
|
|
69
|
+
const { data } = await this.api.put("/api/user/profile", { locale, inviter, metadata });
|
|
70
70
|
return data;
|
|
71
71
|
}
|
|
72
72
|
async updateDidSpace({ spaceGateway }) {
|
|
@@ -263,6 +263,7 @@ class FederatedService {
|
|
|
263
263
|
constructor({ api, blocklet }) {
|
|
264
264
|
__publicField$1(this, "api");
|
|
265
265
|
__publicField$1(this, "blocklet");
|
|
266
|
+
__publicField$1(this, "blockletDataCache", {});
|
|
266
267
|
this.api = api;
|
|
267
268
|
this.blocklet = blocklet || new BlockletService();
|
|
268
269
|
}
|
|
@@ -347,12 +348,16 @@ class FederatedService {
|
|
|
347
348
|
}
|
|
348
349
|
return appList.reverse();
|
|
349
350
|
}
|
|
350
|
-
async getBlockletData(appUrl) {
|
|
351
|
+
async getBlockletData(appUrl, force = false) {
|
|
352
|
+
if (!force && this.blockletDataCache[appUrl]) {
|
|
353
|
+
return this.blockletDataCache[appUrl];
|
|
354
|
+
}
|
|
351
355
|
try {
|
|
352
356
|
const url = new URL("__blocklet__.js", appUrl);
|
|
353
357
|
url.searchParams.set("type", "json");
|
|
354
358
|
const res = await fetch(url.href);
|
|
355
359
|
const jsonData = await res.json();
|
|
360
|
+
this.blockletDataCache[appUrl] = jsonData;
|
|
356
361
|
return jsonData;
|
|
357
362
|
} catch (err) {
|
|
358
363
|
console.error(`Failed to get blocklet data: ${appUrl}`, err);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/js-sdk",
|
|
3
|
-
"version": "1.16.40-beta-
|
|
3
|
+
"version": "1.16.40-beta-20250310-113951-17556f90",
|
|
4
4
|
"main": "dist/index.mjs",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"watch": "nodemon -w src -e ts -x 'npm run build'"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@abtnode/constant": "1.16.40-beta-
|
|
41
|
+
"@abtnode/constant": "1.16.40-beta-20250310-113951-17556f90",
|
|
42
42
|
"@arcblock/did": "1.19.15",
|
|
43
|
-
"@blocklet/meta": "1.16.40-beta-
|
|
43
|
+
"@blocklet/meta": "1.16.40-beta-20250310-113951-17556f90",
|
|
44
44
|
"@ocap/wallet": "1.19.15",
|
|
45
45
|
"axios": "^1.7.9",
|
|
46
46
|
"is-url": "^1.2.4",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"unbuild": "^2.0.0",
|
|
66
66
|
"vitest": "^2.0.5"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "172b2be783de6560a7858a7d55a37075e3a42f2d"
|
|
69
69
|
}
|