@heybox/hb-sdk-protocol 0.8.0-alpha.3 → 0.8.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/README.md +3 -6
- package/dist/index.cjs.js +320 -47
- package/dist/index.esm.js +317 -48
- package/package.json +4 -2
- package/src/capabilities.ts +157 -42
- package/src/index.ts +1 -0
- package/src/payloads.ts +0 -1
- package/src/permission-catalog.ts +168 -0
- package/src/permissions.ts +28 -10
- package/types/capabilities.d.ts +156 -42
- package/types/index.d.ts +1 -0
- package/types/payloads.d.ts +0 -1
- package/types/permission-catalog.d.ts +108 -0
- package/types/permissions.d.ts +4 -3
package/types/capabilities.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ClosePayload, CloseResult, CopyLinkPayload, CopyLinkResult, DirectoryCreatePayload, DirectoryCreateResult, DirectoryExistsPayload, DirectoryExistsResult, DirectoryListPayload, DirectoryListResult, DirectoryRemovePayload, DirectoryRemoveResult, DeleteCurrentUserLeaderboardEntryPayload, DeleteCurrentUserLeaderboardEntryResult, GetCurrentUserLeaderboardEntryPayload, GetCurrentUserLeaderboardEntryResult, GetLeaderboardInfoPayload, GetLeaderboardInfoResult, GetLeaderboardListPayload, GetLeaderboardListResult, GetStoragePayload, GetStorageResult, GetSteamGameListPayload, GetSteamGameListResult, GetUserInfoPayload, GetUserInfoResult, GetWindowInfoPayload, GetWindowInfoResult, HideLoadingPayload, HideLoadingResult, FileCreatePayload, FileCreateResult, FileExistsPayload, FileExistsResult, FileReadBytesPayload, FileReadBytesResult, FileReadTextPayload, FileReadTextResult, FileRemovePayload, FileRemoveResult, FileStatPayload, FileStatResult, FileWriteBytesPayload, FileWriteBytesResult, FileWriteTextPayload, FileWriteTextResult, LoginPayload, LoginResult, NetworkDownloadPayload, NetworkDownloadResult, NetworkRequestPayload, NetworkResponsePayload, OpenAppPagePayload, OpenAppPageResult, PickDirectoryPayload, PickDirectoryResult, PickFilesPayload, PickFilesResult, ReloadPayload, ReloadResult, ScreenshotPayload, ScreenshotResult, SaveFilePayload, SaveFileResult, SetClipboardPayload, SetClipboardResult, SetNavigationBarStylePayload, SetNavigationBarStyleResult, SetStoragePayload, ShowLoadingPayload, ShowLoadingResult, ShowShareMenuPayload, ShowShareMenuResult, ShowToastPayload, ShowToastResult, SubmitLeaderboardEntryPayload, SubmitLeaderboardEntryResult, VibratePayload, VibrateResult } from './payloads';
|
|
2
|
+
import type { MiniProgramPermissionRequirement } from './permission-catalog';
|
|
2
3
|
export declare const AUTH_LOGIN_METHOD: "auth.login";
|
|
3
4
|
export declare const USER_GET_INFO_METHOD: "user.getInfo";
|
|
4
5
|
export declare const USER_REVOKE_AUTHORIZATION_METHOD: "user.revokeAuthorization";
|
|
@@ -60,254 +61,367 @@ export interface MiniProgramCapabilityDefinition {
|
|
|
60
61
|
method: MiniProgramBridgeMethod;
|
|
61
62
|
module: MiniProgramCapabilityModule;
|
|
62
63
|
capability: MiniProgramBridgeMethod;
|
|
63
|
-
|
|
64
|
+
requirement: MiniProgramPermissionRequirement;
|
|
64
65
|
risk: MiniProgramCapabilityRisk;
|
|
65
66
|
}
|
|
66
67
|
export declare const MINI_PROGRAM_PROTOCOL_CAPABILITIES: readonly [{
|
|
67
68
|
readonly method: "auth.login";
|
|
68
69
|
readonly module: "auth";
|
|
69
70
|
readonly capability: "auth.login";
|
|
70
|
-
readonly
|
|
71
|
+
readonly requirement: {
|
|
72
|
+
readonly kind: "all";
|
|
73
|
+
readonly permissions: readonly ["userInfo"];
|
|
74
|
+
};
|
|
71
75
|
readonly risk: "medium";
|
|
72
76
|
}, {
|
|
73
77
|
readonly method: "user.getInfo";
|
|
74
78
|
readonly module: "user";
|
|
75
79
|
readonly capability: "user.getInfo";
|
|
76
|
-
readonly
|
|
80
|
+
readonly requirement: {
|
|
81
|
+
readonly kind: "all";
|
|
82
|
+
readonly permissions: readonly ["userInfo"];
|
|
83
|
+
};
|
|
77
84
|
readonly risk: "medium";
|
|
78
85
|
}, {
|
|
79
86
|
readonly method: "user.revokeAuthorization";
|
|
80
87
|
readonly module: "user";
|
|
81
88
|
readonly capability: "user.revokeAuthorization";
|
|
82
|
-
readonly
|
|
89
|
+
readonly requirement: {
|
|
90
|
+
readonly kind: "none";
|
|
91
|
+
};
|
|
83
92
|
readonly risk: "high";
|
|
84
93
|
}, {
|
|
85
94
|
readonly method: "user.getSteamGameList";
|
|
86
95
|
readonly module: "user";
|
|
87
96
|
readonly capability: "user.getSteamGameList";
|
|
88
|
-
readonly
|
|
97
|
+
readonly requirement: {
|
|
98
|
+
readonly kind: "all";
|
|
99
|
+
readonly permissions: readonly ["steamLibrary"];
|
|
100
|
+
};
|
|
89
101
|
readonly risk: "high";
|
|
90
102
|
}, {
|
|
91
103
|
readonly method: "share.copyLink";
|
|
92
104
|
readonly module: "share";
|
|
93
105
|
readonly capability: "share.copyLink";
|
|
94
|
-
readonly
|
|
106
|
+
readonly requirement: {
|
|
107
|
+
readonly kind: "all";
|
|
108
|
+
readonly permissions: readonly ["share"];
|
|
109
|
+
};
|
|
95
110
|
readonly risk: "medium";
|
|
96
111
|
}, {
|
|
97
112
|
readonly method: "share.showShareMenu";
|
|
98
113
|
readonly module: "share";
|
|
99
114
|
readonly capability: "share.showShareMenu";
|
|
100
|
-
readonly
|
|
115
|
+
readonly requirement: {
|
|
116
|
+
readonly kind: "all";
|
|
117
|
+
readonly permissions: readonly ["share"];
|
|
118
|
+
};
|
|
101
119
|
readonly risk: "low";
|
|
102
120
|
}, {
|
|
103
121
|
readonly method: "share.screenshot";
|
|
104
122
|
readonly module: "share";
|
|
105
123
|
readonly capability: "share.screenshot";
|
|
106
|
-
readonly
|
|
124
|
+
readonly requirement: {
|
|
125
|
+
readonly kind: "all";
|
|
126
|
+
readonly permissions: readonly ["share"];
|
|
127
|
+
};
|
|
107
128
|
readonly risk: "medium";
|
|
108
129
|
}, {
|
|
109
130
|
readonly method: "viewport.getWindowInfo";
|
|
110
131
|
readonly module: "viewport";
|
|
111
132
|
readonly capability: "viewport.getWindowInfo";
|
|
112
|
-
readonly
|
|
133
|
+
readonly requirement: {
|
|
134
|
+
readonly kind: "none";
|
|
135
|
+
};
|
|
113
136
|
readonly risk: "low";
|
|
114
137
|
}, {
|
|
115
138
|
readonly method: "viewport.setNavigationBarStyle";
|
|
116
139
|
readonly module: "viewport";
|
|
117
140
|
readonly capability: "viewport.setNavigationBarStyle";
|
|
118
|
-
readonly
|
|
141
|
+
readonly requirement: {
|
|
142
|
+
readonly kind: "none";
|
|
143
|
+
};
|
|
119
144
|
readonly risk: "low";
|
|
120
145
|
}, {
|
|
121
146
|
readonly method: "storage.getStorage";
|
|
122
147
|
readonly module: "storage";
|
|
123
148
|
readonly capability: "storage.getStorage";
|
|
124
|
-
readonly
|
|
149
|
+
readonly requirement: {
|
|
150
|
+
readonly kind: "all";
|
|
151
|
+
readonly permissions: readonly ["storage"];
|
|
152
|
+
};
|
|
125
153
|
readonly risk: "low";
|
|
126
154
|
}, {
|
|
127
155
|
readonly method: "storage.setStorage";
|
|
128
156
|
readonly module: "storage";
|
|
129
157
|
readonly capability: "storage.setStorage";
|
|
130
|
-
readonly
|
|
158
|
+
readonly requirement: {
|
|
159
|
+
readonly kind: "all";
|
|
160
|
+
readonly permissions: readonly ["storage"];
|
|
161
|
+
};
|
|
131
162
|
readonly risk: "medium";
|
|
132
163
|
}, {
|
|
133
164
|
readonly method: "network.request";
|
|
134
165
|
readonly module: "network";
|
|
135
166
|
readonly capability: "network.request";
|
|
136
|
-
readonly
|
|
167
|
+
readonly requirement: {
|
|
168
|
+
readonly kind: "all";
|
|
169
|
+
readonly permissions: readonly ["network"];
|
|
170
|
+
};
|
|
137
171
|
readonly risk: "high";
|
|
138
172
|
}, {
|
|
139
173
|
readonly method: "network.download";
|
|
140
174
|
readonly module: "network";
|
|
141
175
|
readonly capability: "network.download";
|
|
142
|
-
readonly
|
|
176
|
+
readonly requirement: {
|
|
177
|
+
readonly kind: "all";
|
|
178
|
+
readonly permissions: readonly ["network", "filesystem"];
|
|
179
|
+
};
|
|
143
180
|
readonly risk: "high";
|
|
144
181
|
}, {
|
|
145
182
|
readonly method: "files.pickFiles";
|
|
146
183
|
readonly module: "files";
|
|
147
184
|
readonly capability: "files.pickFiles";
|
|
148
|
-
readonly
|
|
185
|
+
readonly requirement: {
|
|
186
|
+
readonly kind: "all";
|
|
187
|
+
readonly permissions: readonly ["filesystem"];
|
|
188
|
+
};
|
|
149
189
|
readonly risk: "high";
|
|
150
190
|
}, {
|
|
151
191
|
readonly method: "files.pickDirectory";
|
|
152
192
|
readonly module: "files";
|
|
153
193
|
readonly capability: "files.pickDirectory";
|
|
154
|
-
readonly
|
|
194
|
+
readonly requirement: {
|
|
195
|
+
readonly kind: "all";
|
|
196
|
+
readonly permissions: readonly ["filesystem"];
|
|
197
|
+
};
|
|
155
198
|
readonly risk: "high";
|
|
156
199
|
}, {
|
|
157
200
|
readonly method: "files.saveFile";
|
|
158
201
|
readonly module: "files";
|
|
159
202
|
readonly capability: "files.saveFile";
|
|
160
|
-
readonly
|
|
203
|
+
readonly requirement: {
|
|
204
|
+
readonly kind: "all";
|
|
205
|
+
readonly permissions: readonly ["filesystem"];
|
|
206
|
+
};
|
|
161
207
|
readonly risk: "high";
|
|
162
208
|
}, {
|
|
163
209
|
readonly method: "file.create";
|
|
164
210
|
readonly module: "file";
|
|
165
211
|
readonly capability: "file.create";
|
|
166
|
-
readonly
|
|
212
|
+
readonly requirement: {
|
|
213
|
+
readonly kind: "all";
|
|
214
|
+
readonly permissions: readonly ["filesystem"];
|
|
215
|
+
};
|
|
167
216
|
readonly risk: "high";
|
|
168
217
|
}, {
|
|
169
218
|
readonly method: "file.remove";
|
|
170
219
|
readonly module: "file";
|
|
171
220
|
readonly capability: "file.remove";
|
|
172
|
-
readonly
|
|
221
|
+
readonly requirement: {
|
|
222
|
+
readonly kind: "all";
|
|
223
|
+
readonly permissions: readonly ["filesystem"];
|
|
224
|
+
};
|
|
173
225
|
readonly risk: "high";
|
|
174
226
|
}, {
|
|
175
227
|
readonly method: "file.exists";
|
|
176
228
|
readonly module: "file";
|
|
177
229
|
readonly capability: "file.exists";
|
|
178
|
-
readonly
|
|
230
|
+
readonly requirement: {
|
|
231
|
+
readonly kind: "all";
|
|
232
|
+
readonly permissions: readonly ["filesystem"];
|
|
233
|
+
};
|
|
179
234
|
readonly risk: "high";
|
|
180
235
|
}, {
|
|
181
236
|
readonly method: "file.readText";
|
|
182
237
|
readonly module: "file";
|
|
183
238
|
readonly capability: "file.readText";
|
|
184
|
-
readonly
|
|
239
|
+
readonly requirement: {
|
|
240
|
+
readonly kind: "all";
|
|
241
|
+
readonly permissions: readonly ["filesystem"];
|
|
242
|
+
};
|
|
185
243
|
readonly risk: "high";
|
|
186
244
|
}, {
|
|
187
245
|
readonly method: "file.writeText";
|
|
188
246
|
readonly module: "file";
|
|
189
247
|
readonly capability: "file.writeText";
|
|
190
|
-
readonly
|
|
248
|
+
readonly requirement: {
|
|
249
|
+
readonly kind: "all";
|
|
250
|
+
readonly permissions: readonly ["filesystem"];
|
|
251
|
+
};
|
|
191
252
|
readonly risk: "high";
|
|
192
253
|
}, {
|
|
193
254
|
readonly method: "file.readBytes";
|
|
194
255
|
readonly module: "file";
|
|
195
256
|
readonly capability: "file.readBytes";
|
|
196
|
-
readonly
|
|
257
|
+
readonly requirement: {
|
|
258
|
+
readonly kind: "all";
|
|
259
|
+
readonly permissions: readonly ["filesystem"];
|
|
260
|
+
};
|
|
197
261
|
readonly risk: "high";
|
|
198
262
|
}, {
|
|
199
263
|
readonly method: "file.writeBytes";
|
|
200
264
|
readonly module: "file";
|
|
201
265
|
readonly capability: "file.writeBytes";
|
|
202
|
-
readonly
|
|
266
|
+
readonly requirement: {
|
|
267
|
+
readonly kind: "all";
|
|
268
|
+
readonly permissions: readonly ["filesystem"];
|
|
269
|
+
};
|
|
203
270
|
readonly risk: "high";
|
|
204
271
|
}, {
|
|
205
272
|
readonly method: "file.stat";
|
|
206
273
|
readonly module: "file";
|
|
207
274
|
readonly capability: "file.stat";
|
|
208
|
-
readonly
|
|
275
|
+
readonly requirement: {
|
|
276
|
+
readonly kind: "all";
|
|
277
|
+
readonly permissions: readonly ["filesystem"];
|
|
278
|
+
};
|
|
209
279
|
readonly risk: "high";
|
|
210
280
|
}, {
|
|
211
281
|
readonly method: "directory.create";
|
|
212
282
|
readonly module: "directory";
|
|
213
283
|
readonly capability: "directory.create";
|
|
214
|
-
readonly
|
|
284
|
+
readonly requirement: {
|
|
285
|
+
readonly kind: "all";
|
|
286
|
+
readonly permissions: readonly ["filesystem"];
|
|
287
|
+
};
|
|
215
288
|
readonly risk: "high";
|
|
216
289
|
}, {
|
|
217
290
|
readonly method: "directory.remove";
|
|
218
291
|
readonly module: "directory";
|
|
219
292
|
readonly capability: "directory.remove";
|
|
220
|
-
readonly
|
|
293
|
+
readonly requirement: {
|
|
294
|
+
readonly kind: "all";
|
|
295
|
+
readonly permissions: readonly ["filesystem"];
|
|
296
|
+
};
|
|
221
297
|
readonly risk: "high";
|
|
222
298
|
}, {
|
|
223
299
|
readonly method: "directory.exists";
|
|
224
300
|
readonly module: "directory";
|
|
225
301
|
readonly capability: "directory.exists";
|
|
226
|
-
readonly
|
|
302
|
+
readonly requirement: {
|
|
303
|
+
readonly kind: "all";
|
|
304
|
+
readonly permissions: readonly ["filesystem"];
|
|
305
|
+
};
|
|
227
306
|
readonly risk: "high";
|
|
228
307
|
}, {
|
|
229
308
|
readonly method: "directory.list";
|
|
230
309
|
readonly module: "directory";
|
|
231
310
|
readonly capability: "directory.list";
|
|
232
|
-
readonly
|
|
311
|
+
readonly requirement: {
|
|
312
|
+
readonly kind: "all";
|
|
313
|
+
readonly permissions: readonly ["filesystem"];
|
|
314
|
+
};
|
|
233
315
|
readonly risk: "high";
|
|
234
316
|
}, {
|
|
235
317
|
readonly method: "ui.showToast";
|
|
236
318
|
readonly module: "ui";
|
|
237
319
|
readonly capability: "ui.showToast";
|
|
238
|
-
readonly
|
|
320
|
+
readonly requirement: {
|
|
321
|
+
readonly kind: "none";
|
|
322
|
+
};
|
|
239
323
|
readonly risk: "low";
|
|
240
324
|
}, {
|
|
241
325
|
readonly method: "ui.showLoading";
|
|
242
326
|
readonly module: "ui";
|
|
243
327
|
readonly capability: "ui.showLoading";
|
|
244
|
-
readonly
|
|
328
|
+
readonly requirement: {
|
|
329
|
+
readonly kind: "none";
|
|
330
|
+
};
|
|
245
331
|
readonly risk: "low";
|
|
246
332
|
}, {
|
|
247
333
|
readonly method: "ui.hideLoading";
|
|
248
334
|
readonly module: "ui";
|
|
249
335
|
readonly capability: "ui.hideLoading";
|
|
250
|
-
readonly
|
|
336
|
+
readonly requirement: {
|
|
337
|
+
readonly kind: "none";
|
|
338
|
+
};
|
|
251
339
|
readonly risk: "low";
|
|
252
340
|
}, {
|
|
253
341
|
readonly method: "device.vibrate";
|
|
254
342
|
readonly module: "device";
|
|
255
343
|
readonly capability: "device.vibrate";
|
|
256
|
-
readonly
|
|
344
|
+
readonly requirement: {
|
|
345
|
+
readonly kind: "none";
|
|
346
|
+
};
|
|
257
347
|
readonly risk: "low";
|
|
258
348
|
}, {
|
|
259
349
|
readonly method: "device.setClipboard";
|
|
260
350
|
readonly module: "device";
|
|
261
351
|
readonly capability: "device.setClipboard";
|
|
262
|
-
readonly
|
|
352
|
+
readonly requirement: {
|
|
353
|
+
readonly kind: "all";
|
|
354
|
+
readonly permissions: readonly ["clipboard"];
|
|
355
|
+
};
|
|
263
356
|
readonly risk: "medium";
|
|
264
357
|
}, {
|
|
265
358
|
readonly method: "navigation.close";
|
|
266
359
|
readonly module: "navigation";
|
|
267
360
|
readonly capability: "navigation.close";
|
|
268
|
-
readonly
|
|
361
|
+
readonly requirement: {
|
|
362
|
+
readonly kind: "none";
|
|
363
|
+
};
|
|
269
364
|
readonly risk: "medium";
|
|
270
365
|
}, {
|
|
271
366
|
readonly method: "navigation.reload";
|
|
272
367
|
readonly module: "navigation";
|
|
273
368
|
readonly capability: "navigation.reload";
|
|
274
|
-
readonly
|
|
369
|
+
readonly requirement: {
|
|
370
|
+
readonly kind: "none";
|
|
371
|
+
};
|
|
275
372
|
readonly risk: "medium";
|
|
276
373
|
}, {
|
|
277
374
|
readonly method: "navigation.openAppPage";
|
|
278
375
|
readonly module: "navigation";
|
|
279
376
|
readonly capability: "navigation.openAppPage";
|
|
280
|
-
readonly
|
|
377
|
+
readonly requirement: {
|
|
378
|
+
readonly kind: "none";
|
|
379
|
+
};
|
|
281
380
|
readonly risk: "medium";
|
|
282
381
|
}, {
|
|
283
382
|
readonly method: "cloud.leaderboard.submit";
|
|
284
383
|
readonly module: "cloud";
|
|
285
384
|
readonly capability: "cloud.leaderboard.submit";
|
|
286
|
-
readonly
|
|
385
|
+
readonly requirement: {
|
|
386
|
+
readonly kind: "all";
|
|
387
|
+
readonly permissions: readonly ["leaderboard"];
|
|
388
|
+
};
|
|
287
389
|
readonly risk: "medium";
|
|
288
390
|
}, {
|
|
289
391
|
readonly method: "cloud.leaderboard.getList";
|
|
290
392
|
readonly module: "cloud";
|
|
291
393
|
readonly capability: "cloud.leaderboard.getList";
|
|
292
|
-
readonly
|
|
394
|
+
readonly requirement: {
|
|
395
|
+
readonly kind: "all";
|
|
396
|
+
readonly permissions: readonly ["leaderboard"];
|
|
397
|
+
};
|
|
293
398
|
readonly risk: "low";
|
|
294
399
|
}, {
|
|
295
400
|
readonly method: "cloud.leaderboard.getCurrentUserEntry";
|
|
296
401
|
readonly module: "cloud";
|
|
297
402
|
readonly capability: "cloud.leaderboard.getCurrentUserEntry";
|
|
298
|
-
readonly
|
|
403
|
+
readonly requirement: {
|
|
404
|
+
readonly kind: "all";
|
|
405
|
+
readonly permissions: readonly ["leaderboard"];
|
|
406
|
+
};
|
|
299
407
|
readonly risk: "medium";
|
|
300
408
|
}, {
|
|
301
409
|
readonly method: "cloud.leaderboard.deleteCurrentUserEntry";
|
|
302
410
|
readonly module: "cloud";
|
|
303
411
|
readonly capability: "cloud.leaderboard.deleteCurrentUserEntry";
|
|
304
|
-
readonly
|
|
412
|
+
readonly requirement: {
|
|
413
|
+
readonly kind: "all";
|
|
414
|
+
readonly permissions: readonly ["leaderboard"];
|
|
415
|
+
};
|
|
305
416
|
readonly risk: "medium";
|
|
306
417
|
}, {
|
|
307
418
|
readonly method: "cloud.leaderboard.getInfo";
|
|
308
419
|
readonly module: "cloud";
|
|
309
420
|
readonly capability: "cloud.leaderboard.getInfo";
|
|
310
|
-
readonly
|
|
421
|
+
readonly requirement: {
|
|
422
|
+
readonly kind: "all";
|
|
423
|
+
readonly permissions: readonly ["leaderboard"];
|
|
424
|
+
};
|
|
311
425
|
readonly risk: "low";
|
|
312
426
|
}];
|
|
313
427
|
export interface MiniProgramCapabilityPayloadMap {
|
package/types/index.d.ts
CHANGED
package/types/payloads.d.ts
CHANGED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { MiniProgramBridgeMethod, MiniProgramCapabilityRisk } from './capabilities';
|
|
2
|
+
export declare const MINI_PROGRAM_PERMISSION_KEYS: readonly ["userInfo", "steamLibrary", "share", "storage", "filesystem", "clipboard", "leaderboard", "network"];
|
|
3
|
+
export type MiniProgramPermissionKey = (typeof MINI_PROGRAM_PERMISSION_KEYS)[number];
|
|
4
|
+
export type MiniProgramPermissionRequirement = {
|
|
5
|
+
readonly kind: 'none';
|
|
6
|
+
} | {
|
|
7
|
+
readonly kind: 'all';
|
|
8
|
+
readonly permissions: readonly MiniProgramPermissionKey[];
|
|
9
|
+
};
|
|
10
|
+
export type MiniProgramPermissionAccess = 'declaration' | 'platform-approval';
|
|
11
|
+
export interface MiniProgramPermissionConfigFieldDefinition {
|
|
12
|
+
readonly type: 'boolean';
|
|
13
|
+
readonly required: boolean;
|
|
14
|
+
readonly default: boolean;
|
|
15
|
+
readonly description: string;
|
|
16
|
+
}
|
|
17
|
+
export interface MiniProgramPermissionDefinition {
|
|
18
|
+
readonly key: MiniProgramPermissionKey;
|
|
19
|
+
readonly name: string;
|
|
20
|
+
readonly description: string;
|
|
21
|
+
readonly access: MiniProgramPermissionAccess;
|
|
22
|
+
readonly risk: MiniProgramCapabilityRisk;
|
|
23
|
+
readonly config: Readonly<Record<string, MiniProgramPermissionConfigFieldDefinition>>;
|
|
24
|
+
readonly methods: readonly MiniProgramBridgeMethod[];
|
|
25
|
+
readonly conditions: readonly string[];
|
|
26
|
+
}
|
|
27
|
+
export declare const MINI_PROGRAM_PERMISSION_CATALOG: readonly [{
|
|
28
|
+
readonly key: "userInfo";
|
|
29
|
+
readonly name: "用户信息";
|
|
30
|
+
readonly description: "登录小程序并读取当前用户的授权信息。";
|
|
31
|
+
readonly access: "declaration";
|
|
32
|
+
readonly risk: "medium";
|
|
33
|
+
readonly config: {};
|
|
34
|
+
readonly methods: readonly ["auth.login", "user.getInfo"];
|
|
35
|
+
readonly conditions: readonly ["继续执行黑盒登录、用户授权和可信手势规则。"];
|
|
36
|
+
}, {
|
|
37
|
+
readonly key: "steamLibrary";
|
|
38
|
+
readonly name: "Steam 游戏库";
|
|
39
|
+
readonly description: "读取当前用户授权的 Steam 游戏库。";
|
|
40
|
+
readonly access: "declaration";
|
|
41
|
+
readonly risk: "high";
|
|
42
|
+
readonly config: {};
|
|
43
|
+
readonly methods: readonly ["user.getSteamGameList"];
|
|
44
|
+
readonly conditions: readonly ["继续执行账号绑定和数据可用性规则。"];
|
|
45
|
+
}, {
|
|
46
|
+
readonly key: "share";
|
|
47
|
+
readonly name: "分享";
|
|
48
|
+
readonly description: "使用小程序分享、分享菜单和截图能力。";
|
|
49
|
+
readonly access: "declaration";
|
|
50
|
+
readonly risk: "medium";
|
|
51
|
+
readonly config: {};
|
|
52
|
+
readonly methods: readonly ["share.copyLink", "share.showShareMenu", "share.screenshot"];
|
|
53
|
+
readonly conditions: readonly ["继续执行分享参数校验和 Host 支持检查。"];
|
|
54
|
+
}, {
|
|
55
|
+
readonly key: "storage";
|
|
56
|
+
readonly name: "键值存储";
|
|
57
|
+
readonly description: "读写按小程序隔离的简单键值数据。";
|
|
58
|
+
readonly access: "declaration";
|
|
59
|
+
readonly risk: "medium";
|
|
60
|
+
readonly config: {};
|
|
61
|
+
readonly methods: readonly ["storage.getStorage", "storage.setStorage"];
|
|
62
|
+
readonly conditions: readonly ["仅用于简单键值存储,不包含文件系统。"];
|
|
63
|
+
}, {
|
|
64
|
+
readonly key: "filesystem";
|
|
65
|
+
readonly name: "文件系统";
|
|
66
|
+
readonly description: "访问小程序沙盒文件和用户选择的外部文件。";
|
|
67
|
+
readonly access: "declaration";
|
|
68
|
+
readonly risk: "high";
|
|
69
|
+
readonly config: {};
|
|
70
|
+
readonly methods: readonly ["network.download", "files.pickFiles", "files.pickDirectory", "files.saveFile", "file.create", "file.remove", "file.exists", "file.readText", "file.writeText", "file.readBytes", "file.writeBytes", "file.stat", "directory.create", "directory.remove", "directory.exists", "directory.list"];
|
|
71
|
+
readonly conditions: readonly ["外部文件继续要求有效的用户选择、会话句柄和匹配的读写模式。"];
|
|
72
|
+
}, {
|
|
73
|
+
readonly key: "clipboard";
|
|
74
|
+
readonly name: "剪贴板";
|
|
75
|
+
readonly description: "向系统剪贴板写入文本。";
|
|
76
|
+
readonly access: "declaration";
|
|
77
|
+
readonly risk: "medium";
|
|
78
|
+
readonly config: {};
|
|
79
|
+
readonly methods: readonly ["device.setClipboard"];
|
|
80
|
+
readonly conditions: readonly ["继续执行文本长度和 Host 支持限制。"];
|
|
81
|
+
}, {
|
|
82
|
+
readonly key: "leaderboard";
|
|
83
|
+
readonly name: "排行榜";
|
|
84
|
+
readonly description: "读写小程序云排行榜。";
|
|
85
|
+
readonly access: "declaration";
|
|
86
|
+
readonly risk: "medium";
|
|
87
|
+
readonly config: {};
|
|
88
|
+
readonly methods: readonly ["cloud.leaderboard.submit", "cloud.leaderboard.getList", "cloud.leaderboard.getCurrentUserEntry", "cloud.leaderboard.deleteCurrentUserEntry", "cloud.leaderboard.getInfo"];
|
|
89
|
+
readonly conditions: readonly ["排行榜必须已创建,用户和资源规则保持不变。"];
|
|
90
|
+
}, {
|
|
91
|
+
readonly key: "network";
|
|
92
|
+
readonly name: "网络";
|
|
93
|
+
readonly description: "通过 network 模块请求或下载外部资源。";
|
|
94
|
+
readonly access: "platform-approval";
|
|
95
|
+
readonly risk: "high";
|
|
96
|
+
readonly config: {
|
|
97
|
+
readonly useOfficialDomain: {
|
|
98
|
+
readonly type: "boolean";
|
|
99
|
+
readonly required: false;
|
|
100
|
+
readonly default: false;
|
|
101
|
+
readonly description: "是否申请访问小黑盒官方域名。";
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
readonly methods: readonly ["network.request", "network.download"];
|
|
105
|
+
readonly conditions: readonly ["声明后仍需平台批准,并继续执行网络安全策略。"];
|
|
106
|
+
}];
|
|
107
|
+
export declare const MINI_PROGRAM_NO_DECLARATION_METHODS: readonly ["user.revokeAuthorization", "ui.showToast", "ui.showLoading", "ui.hideLoading", "viewport.getWindowInfo", "viewport.setNavigationBarStyle", "device.vibrate", "navigation.close", "navigation.reload", "navigation.openAppPage"];
|
|
108
|
+
export declare function isMiniProgramPermissionKey(key: string): key is MiniProgramPermissionKey;
|
package/types/permissions.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { type MiniProgramPermissionKey } from './permission-catalog';
|
|
2
|
+
export declare function isManagedMiniProgramRuntimePermissionKey(key: string): key is MiniProgramPermissionKey;
|
|
2
3
|
export type MiniProgramRuntimePermissionStatus = 'enabled' | 'disabled';
|
|
3
4
|
export interface MiniProgramRuntimePermissionEntry {
|
|
4
|
-
key:
|
|
5
|
+
key: MiniProgramPermissionKey;
|
|
5
6
|
status: MiniProgramRuntimePermissionStatus;
|
|
6
7
|
config: Record<string, unknown>;
|
|
7
8
|
}
|
|
@@ -12,6 +13,6 @@ export interface MiniProgramRuntimePermissionsSnapshot {
|
|
|
12
13
|
}
|
|
13
14
|
export interface ParsedMiniProgramRuntimePermissions {
|
|
14
15
|
valid: boolean;
|
|
15
|
-
permissions: Record<
|
|
16
|
+
permissions: Partial<Record<MiniProgramPermissionKey, MiniProgramRuntimePermissionEntry>>;
|
|
16
17
|
}
|
|
17
18
|
export declare function parseMiniProgramRuntimePermissions(snapshot: unknown): ParsedMiniProgramRuntimePermissions;
|