@did-space/template 0.2.24 → 0.2.25

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.
@@ -10,6 +10,8 @@ exports.AppBackupSchema = validator_1.Joi.object({
10
10
  type: validator_1.Joi.string().valid(core_1.APP_BACKUP_TYPE).default(core_1.APP_BACKUP_TYPE),
11
11
  userDid: validator_1.Joi.DID().required(),
12
12
  referrer: app_connected_1.AppUrlSchema,
13
+ appName: validator_1.Joi.string().optional().allow('').default(''),
14
+ appDescription: validator_1.Joi.string().optional().allow('').default(''),
13
15
  createAt: validator_1.Joi.string()
14
16
  .optional()
15
17
  .default(() => new Date().toISOString()),
@@ -10,6 +10,8 @@ exports.AppRestoreSchema = validator_1.Joi.object({
10
10
  type: validator_1.Joi.string().valid(core_1.APP_RESTORE_TYPE).default(core_1.APP_RESTORE_TYPE),
11
11
  userDid: validator_1.Joi.DID().required(),
12
12
  referrer: app_connected_1.AppUrlSchema,
13
+ appName: validator_1.Joi.string().optional().allow('').default(''),
14
+ appDescription: validator_1.Joi.string().optional().allow('').default(''),
13
15
  createAt: validator_1.Joi.string()
14
16
  .optional()
15
17
  .default(() => new Date().toISOString()),
@@ -1,4 +1,4 @@
1
- import { Space, App, AppBackup, AppRestore } from '@did-space/core';
1
+ import { Space, App, AppBackup, AppRestore, AppConnected } from '@did-space/core';
2
2
  export interface AppTemplateOptions {
3
3
  space: Space;
4
4
  appDid: string;
@@ -22,6 +22,7 @@ export declare class AppTemplate {
22
22
  get(): Promise<App | null>;
23
23
  set(app: App): Promise<App>;
24
24
  isConnected(url: string): Promise<boolean>;
25
+ addConnected(appConnected: AppConnected): Promise<AppConnected>;
25
26
  addAppBackup(appBackup: AppBackup): Promise<AppBackup>;
26
27
  updateAppBackupById(id: string, appBackup: Omit<AppBackup, 'id'>): Promise<AppBackup>;
27
28
  addAppRestore(appRestore: AppRestore): Promise<AppRestore>;
@@ -100,6 +100,17 @@ class AppTemplate {
100
100
  }
101
101
  });
102
102
  }
103
+ addConnected(appConnected) {
104
+ return __awaiter(this, void 0, void 0, function* () {
105
+ const app = yield this.get();
106
+ if (!app.connected) {
107
+ app.connected = [];
108
+ }
109
+ app.connected.push(Object.assign({}, appConnected));
110
+ const latestApp = yield this.set(app);
111
+ return (0, last_1.default)(latestApp.connected);
112
+ });
113
+ }
103
114
  addAppBackup(appBackup) {
104
115
  return __awaiter(this, void 0, void 0, function* () {
105
116
  const app = yield this.get();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@did-space/template",
3
- "version": "0.2.24",
3
+ "version": "0.2.25",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -36,7 +36,7 @@
36
36
  "@arcblock/jwt": "^1.18.57",
37
37
  "@arcblock/validator": "^1.18.57",
38
38
  "@blocklet/sdk": "1.8.68-beta-500af7e5",
39
- "@did-space/core": "0.2.24",
39
+ "@did-space/core": "0.2.25",
40
40
  "@ocap/mcrypto": "^1.18.57",
41
41
  "@ocap/util": "^1.18.57",
42
42
  "@ocap/wallet": "^1.18.57",
@@ -76,5 +76,5 @@
76
76
  "ts-jest": "^28.0.6",
77
77
  "typescript": "^4.9.5"
78
78
  },
79
- "gitHead": "80c476177dd3844f06795299e0f75ac0adaef569"
79
+ "gitHead": "87342094f778a848e460eee1e241a32aea485684"
80
80
  }