@did-space/core 1.0.9 → 1.0.11

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.
@@ -32,6 +32,7 @@ const debug = (0, debug_1.default)('@did-space/core:ObjectSpace');
32
32
  class ObjectSpace extends events_1.default {
33
33
  constructor(options) {
34
34
  super();
35
+ this.configPath = '/config.yml';
35
36
  const { error } = schemas_1.ObjectSpaceOptionsSchema.validate(options, {
36
37
  allowUnknown: true,
37
38
  stripUnknown: true,
@@ -600,8 +601,10 @@ class ObjectSpace extends events_1.default {
600
601
  key,
601
602
  };
602
603
  debug('existsAsOwner.before', JSON.stringify({ where }));
603
- const exists = Boolean(yield this.options.treeRepository.count({
604
+ const exists = Boolean(yield this.options.treeRepository.findOne({
604
605
  where,
606
+ raw: true,
607
+ attributes: ['id'],
605
608
  }));
606
609
  debug('existsAsOwner.after', JSON.stringify({ exists }));
607
610
  return exists;
@@ -650,7 +653,7 @@ class ObjectSpace extends events_1.default {
650
653
  debug('createConfig.$data', data);
651
654
  debug('createConfig.$hash', hash);
652
655
  debug('createConfig.$size', size);
653
- yield this.writeAsOwner('/config.yml', data, {
656
+ yield this.writeAsOwner(this.configPath, data, {
654
657
  hash,
655
658
  size,
656
659
  useGlobal: true,
@@ -658,53 +661,72 @@ class ObjectSpace extends events_1.default {
658
661
  });
659
662
  }
660
663
  destroyConfig() {
661
- return this.deleteAsOwner('/config.yml');
664
+ return this.deleteAsOwner(this.configPath);
662
665
  }
663
- set(key, value) {
666
+ set(key, value, { isFromStorage = false } = { isFromStorage: false }) {
664
667
  return __awaiter(this, void 0, void 0, function* () {
665
- debug('set.before', JSON.stringify({ key, value }));
666
- const configData = yield this.readAsOwner('/config.yml');
667
- const data = js_yaml_1.default.load(yield (0, utils_1.streamToString)(configData));
668
- data[key] = value;
669
- yield this.createConfig(data);
668
+ debug('set.before', JSON.stringify({ key, value, isFromStorage }));
669
+ let data;
670
+ if (isFromStorage) {
671
+ const configData = yield this.readAsOwner(this.configPath);
672
+ data = js_yaml_1.default.load(yield (0, utils_1.streamToString)(configData));
673
+ data[key] = value;
674
+ yield this.writeAsOwner(this.configPath, js_yaml_1.default.dump(data));
675
+ }
676
+ else {
677
+ yield this.options.spaceRepository.update({
678
+ [key]: value,
679
+ }, {
680
+ where: {
681
+ did: this.options.spaceDid,
682
+ },
683
+ });
684
+ }
670
685
  });
671
686
  }
672
- get(key, defaultValue = {}) {
687
+ get(key, defaultValue = {}, { isFromStorage } = { isFromStorage: false }) {
673
688
  var _a;
674
689
  return __awaiter(this, void 0, void 0, function* () {
675
690
  debug('get.before', JSON.stringify({ key }));
676
- const configData = yield this.readAsOwner('/config.yml');
677
- const data = js_yaml_1.default.load(yield (0, utils_1.streamToString)(configData));
691
+ let data;
692
+ if (isFromStorage) {
693
+ const configData = yield this.readAsOwner(this.configPath);
694
+ data = js_yaml_1.default.load(yield (0, utils_1.streamToString)(configData));
695
+ }
696
+ else {
697
+ data = yield this.options.spaceRepository.findOne({
698
+ where: {
699
+ did: this.options.spaceDid,
700
+ },
701
+ });
702
+ }
678
703
  return (_a = data[key]) !== null && _a !== void 0 ? _a : defaultValue;
679
704
  });
680
705
  }
681
- getPermission({ fromAppDid, toAppDid }) {
706
+ getPermission({ fromAppDid, toAppDid, isFromStorage = false }) {
682
707
  var _a;
683
708
  return __awaiter(this, void 0, void 0, function* () {
684
- const permissions = yield this.get('permissions');
709
+ const permissions = yield this.get('permissions', {}, { isFromStorage });
685
710
  return ((_a = permissions === null || permissions === void 0 ? void 0 : permissions[fromAppDid]) === null || _a === void 0 ? void 0 : _a[toAppDid]) || 0;
686
711
  });
687
712
  }
688
713
  /**
689
714
  *
690
715
  * @see https://blog.csdn.net/a1173537204/article/details/89765932
691
- * @private
692
- * @param {PermissionOptions} { fromAppDid, toAppDid }
693
- * @param {number} permission
694
- * @param {boolean} status
695
- * @return {*} {Promise<void>}
696
- * @memberof S3SpaceConfig
697
716
  */
698
- setPermission({ fromAppDid, toAppDid }, permission, status) {
717
+ setPermission({ fromAppDid, toAppDid, isFromStorage = false }, permission, status) {
699
718
  var _a, _b;
700
719
  return __awaiter(this, void 0, void 0, function* () {
701
- const permissions = yield this.get('permissions', {});
720
+ const permissions = yield this.get('permissions', {}, { isFromStorage });
702
721
  // 我想知道原来的权限是啥样的?
703
722
  const oldPermission = ((_a = permissions === null || permissions === void 0 ? void 0 : permissions[fromAppDid]) === null || _a === void 0 ? void 0 : _a[toAppDid]) || 0;
704
723
  permissions[fromAppDid] = Object.assign((_b = permissions === null || permissions === void 0 ? void 0 : permissions[fromAppDid]) !== null && _b !== void 0 ? _b : {}, Object.assign(Object.assign({}, permissions === null || permissions === void 0 ? void 0 : permissions[fromAppDid]), {
705
724
  // eslint-disable-next-line no-bitwise
706
725
  [toAppDid]: status ? oldPermission | permission : oldPermission & ~permission }));
707
- yield this.set('permissions', permissions);
726
+ yield Promise.all([
727
+ this.set('permissions', permissions),
728
+ this.set('permissions', permissions, { isFromStorage: true }),
729
+ ]);
708
730
  });
709
731
  }
710
732
  /**
@@ -17,6 +17,7 @@ const path_1 = require("path");
17
17
  const ipfs_only_hash_1 = require("@arcblock/ipfs-only-hash");
18
18
  const multiformats_1 = require("multiformats");
19
19
  const hasha_1 = __importDefault(require("hasha"));
20
+ const destroy_1 = __importDefault(require("destroy"));
20
21
  const common_1 = require("./common");
21
22
  /**
22
23
  *
@@ -52,16 +53,25 @@ exports.getHashByAlgorithm = getHashByAlgorithm;
52
53
  // eslint-disable-next-line require-await
53
54
  function getHash(data = '', algorithm = 'ipfs') {
54
55
  return __awaiter(this, void 0, void 0, function* () {
55
- if (!['ipfs', 'sha256'].includes(algorithm)) {
56
- throw new Error(`#getHash() Invalid algorithm type: ${algorithm}`);
56
+ try {
57
+ if (!['ipfs', 'sha256'].includes(algorithm)) {
58
+ throw new Error(`#getHash() Invalid algorithm type: ${algorithm}`);
59
+ }
60
+ if (!(0, common_1.isValidData)(data)) {
61
+ throw new Error(`#getHash() Invalid data type: ${data}`);
62
+ }
63
+ if (algorithm === 'ipfs') {
64
+ return yield getHashByIpfs(data);
65
+ }
66
+ return yield getHashByAlgorithm(data, algorithm);
57
67
  }
58
- if (!(0, common_1.isValidData)(data)) {
59
- throw new Error(`#getHash() Invalid data type: ${data}`);
68
+ catch (error) {
69
+ console.error(error);
70
+ throw error;
60
71
  }
61
- if (algorithm === 'ipfs') {
62
- return getHashByIpfs(data);
72
+ finally {
73
+ (0, destroy_1.default)(data);
63
74
  }
64
- return getHashByAlgorithm(data, algorithm);
65
75
  });
66
76
  }
67
77
  exports.getHash = getHash;
@@ -25,6 +25,8 @@ export declare const SPACE_CONNECT_ERROR_CODE: {
25
25
  UNIT_LIMIT: number;
26
26
  /** 跨域限制 */
27
27
  CORS_BLOCKED: number;
28
+ /** Space 版本不兼容 */
29
+ INCOMPATIBLE: number;
28
30
  };
29
31
  export declare const GLOBAL_SPACE_ROOT = "__GLOBAL__";
30
32
  export declare const STORAGE_BUILT_IN_OBJECTS: string[];
@@ -30,6 +30,8 @@ export const SPACE_CONNECT_ERROR_CODE = {
30
30
  UNIT_LIMIT: 1006,
31
31
  /** 跨域限制 */
32
32
  CORS_BLOCKED: 1007,
33
+ /** Space 版本不兼容 */
34
+ INCOMPATIBLE: 1008,
33
35
  };
34
36
  export const GLOBAL_SPACE_ROOT = '__GLOBAL__';
35
37
  export const STORAGE_BUILT_IN_OBJECTS = ['/config.yml', '/apps/', '/.meta/'];
@@ -11,7 +11,8 @@ export declare enum AuditLogAction {
11
11
  APP_DISCONNECTED = "app-disconnected",
12
12
  APP_RESTORE = "app-restore",
13
13
  APP_BACKUP = "app-backup",
14
- APP_CONNECTED = "app-connected"
14
+ APP_CONNECTED = "app-connected",
15
+ APP_OBJECTS_SYNC = "app-objects-sync"
15
16
  }
16
17
  export declare const AppConnectedSchema: z.ZodObject<{
17
18
  spaceDid: z.ZodString;
@@ -92,6 +93,50 @@ export declare const AppRestoreSchema: z.ZodObject<{
92
93
  referrer: string;
93
94
  serverDid: string;
94
95
  }>;
96
+ export declare const AppObjectsSyncSchema: z.ZodObject<{
97
+ /** 应用名称 */
98
+ appName: z.ZodString;
99
+ /** 应用描述 */
100
+ appDescription: z.ZodString;
101
+ /** 原路径 */
102
+ source: z.ZodString;
103
+ /** 目标路径 */
104
+ target: z.ZodString;
105
+ /** 总对象数 */
106
+ totalCount: z.ZodNumber;
107
+ /** 失败对象数 */
108
+ errorCount: z.ZodNumber;
109
+ /** 成功对象数 */
110
+ successCount: z.ZodNumber;
111
+ /** 总文件大小 */
112
+ size: z.ZodNumber;
113
+ /** 同步耗时(ms) */
114
+ duration: z.ZodNumber;
115
+ /** 元数据 */
116
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
117
+ }, "strip", z.ZodTypeAny, {
118
+ target: string;
119
+ size: number;
120
+ appName: string;
121
+ appDescription: string;
122
+ source: string;
123
+ totalCount: number;
124
+ errorCount: number;
125
+ successCount: number;
126
+ duration: number;
127
+ metadata?: Record<string, any> | undefined;
128
+ }, {
129
+ target: string;
130
+ size: number;
131
+ appName: string;
132
+ appDescription: string;
133
+ source: string;
134
+ totalCount: number;
135
+ errorCount: number;
136
+ successCount: number;
137
+ duration: number;
138
+ metadata?: Record<string, any> | undefined;
139
+ }>;
95
140
  export declare const AuditLogSchema: z.ZodObject<{
96
141
  id: z.ZodString;
97
142
  actionType: z.ZodNativeEnum<typeof AuditLogAction>;
@@ -174,6 +219,49 @@ export declare const AuditLogSchema: z.ZodObject<{
174
219
  appDescription: string;
175
220
  referrer: string;
176
221
  serverDid: string;
222
+ }>, z.ZodObject<{
223
+ /** 应用名称 */
224
+ appName: z.ZodString;
225
+ /** 应用描述 */
226
+ appDescription: z.ZodString;
227
+ /** 原路径 */
228
+ source: z.ZodString;
229
+ /** 目标路径 */
230
+ target: z.ZodString;
231
+ /** 总对象数 */
232
+ totalCount: z.ZodNumber;
233
+ /** 失败对象数 */
234
+ errorCount: z.ZodNumber;
235
+ /** 成功对象数 */
236
+ successCount: z.ZodNumber;
237
+ /** 总文件大小 */
238
+ size: z.ZodNumber;
239
+ /** 同步耗时(ms) */
240
+ duration: z.ZodNumber;
241
+ /** 元数据 */
242
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
243
+ }, "strip", z.ZodTypeAny, {
244
+ target: string;
245
+ size: number;
246
+ appName: string;
247
+ appDescription: string;
248
+ source: string;
249
+ totalCount: number;
250
+ errorCount: number;
251
+ successCount: number;
252
+ duration: number;
253
+ metadata?: Record<string, any> | undefined;
254
+ }, {
255
+ target: string;
256
+ size: number;
257
+ appName: string;
258
+ appDescription: string;
259
+ source: string;
260
+ totalCount: number;
261
+ errorCount: number;
262
+ successCount: number;
263
+ duration: number;
264
+ metadata?: Record<string, any> | undefined;
177
265
  }>]>;
178
266
  status: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof AuditLogStatus>>>;
179
267
  reason: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -213,6 +301,17 @@ export declare const AuditLogSchema: z.ZodObject<{
213
301
  appDescription: string;
214
302
  referrer: string;
215
303
  serverDid: string;
304
+ } | {
305
+ target: string;
306
+ size: number;
307
+ appName: string;
308
+ appDescription: string;
309
+ source: string;
310
+ totalCount: number;
311
+ errorCount: number;
312
+ successCount: number;
313
+ duration: number;
314
+ metadata?: Record<string, any> | undefined;
216
315
  };
217
316
  reason: string;
218
317
  env: Record<string, any>;
@@ -244,6 +343,17 @@ export declare const AuditLogSchema: z.ZodObject<{
244
343
  appDescription: string;
245
344
  referrer: string;
246
345
  serverDid: string;
346
+ } | {
347
+ target: string;
348
+ size: number;
349
+ appName: string;
350
+ appDescription: string;
351
+ source: string;
352
+ totalCount: number;
353
+ errorCount: number;
354
+ successCount: number;
355
+ duration: number;
356
+ metadata?: Record<string, any> | undefined;
247
357
  };
248
358
  status?: AuditLogStatus | undefined;
249
359
  createdAt?: string | undefined;
@@ -335,6 +445,49 @@ export declare const CreationAuditLogSchema: z.ZodObject<z.objectUtil.extendShap
335
445
  appDescription: string;
336
446
  referrer: string;
337
447
  serverDid: string;
448
+ }>, z.ZodObject<{
449
+ /** 应用名称 */
450
+ appName: z.ZodString;
451
+ /** 应用描述 */
452
+ appDescription: z.ZodString;
453
+ /** 原路径 */
454
+ source: z.ZodString;
455
+ /** 目标路径 */
456
+ target: z.ZodString;
457
+ /** 总对象数 */
458
+ totalCount: z.ZodNumber;
459
+ /** 失败对象数 */
460
+ errorCount: z.ZodNumber;
461
+ /** 成功对象数 */
462
+ successCount: z.ZodNumber;
463
+ /** 总文件大小 */
464
+ size: z.ZodNumber;
465
+ /** 同步耗时(ms) */
466
+ duration: z.ZodNumber;
467
+ /** 元数据 */
468
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
469
+ }, "strip", z.ZodTypeAny, {
470
+ target: string;
471
+ size: number;
472
+ appName: string;
473
+ appDescription: string;
474
+ source: string;
475
+ totalCount: number;
476
+ errorCount: number;
477
+ successCount: number;
478
+ duration: number;
479
+ metadata?: Record<string, any> | undefined;
480
+ }, {
481
+ target: string;
482
+ size: number;
483
+ appName: string;
484
+ appDescription: string;
485
+ source: string;
486
+ totalCount: number;
487
+ errorCount: number;
488
+ successCount: number;
489
+ duration: number;
490
+ metadata?: Record<string, any> | undefined;
338
491
  }>]>;
339
492
  status: z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof AuditLogStatus>>>;
340
493
  reason: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -375,6 +528,17 @@ export declare const CreationAuditLogSchema: z.ZodObject<z.objectUtil.extendShap
375
528
  appDescription: string;
376
529
  referrer: string;
377
530
  serverDid: string;
531
+ } | {
532
+ target: string;
533
+ size: number;
534
+ appName: string;
535
+ appDescription: string;
536
+ source: string;
537
+ totalCount: number;
538
+ errorCount: number;
539
+ successCount: number;
540
+ duration: number;
541
+ metadata?: Record<string, any> | undefined;
378
542
  };
379
543
  reason: string;
380
544
  env: Record<string, any>;
@@ -406,6 +570,17 @@ export declare const CreationAuditLogSchema: z.ZodObject<z.objectUtil.extendShap
406
570
  appDescription: string;
407
571
  referrer: string;
408
572
  serverDid: string;
573
+ } | {
574
+ target: string;
575
+ size: number;
576
+ appName: string;
577
+ appDescription: string;
578
+ source: string;
579
+ totalCount: number;
580
+ errorCount: number;
581
+ successCount: number;
582
+ duration: number;
583
+ metadata?: Record<string, any> | undefined;
409
584
  };
410
585
  status?: AuditLogStatus | undefined;
411
586
  createdAt?: string | undefined;
@@ -416,15 +591,228 @@ export declare const CreationAuditLogSchema: z.ZodObject<z.objectUtil.extendShap
416
591
  reason?: string | undefined;
417
592
  env?: Record<string, any> | undefined;
418
593
  }>;
594
+ export declare const UpdateAuditLogSchema: z.ZodObject<{
595
+ status: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodNativeEnum<typeof AuditLogStatus>>>>;
596
+ createdAt: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
597
+ id: z.ZodString;
598
+ updatedAt: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
599
+ actionType: z.ZodOptional<z.ZodNativeEnum<typeof AuditLogAction>>;
600
+ entityId: z.ZodOptional<z.ZodString>;
601
+ entityName: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
602
+ userId: z.ZodOptional<z.ZodString>;
603
+ username: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
604
+ data: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
605
+ spaceDid: z.ZodOptional<z.ZodString>;
606
+ appDid: z.ZodOptional<z.ZodString>;
607
+ appName: z.ZodOptional<z.ZodString>;
608
+ appDescription: z.ZodOptional<z.ZodString>;
609
+ scopes: z.ZodOptional<z.ZodString>;
610
+ appUrl: z.ZodOptional<z.ZodString>;
611
+ referrer: z.ZodOptional<z.ZodString>;
612
+ }, "strip", z.ZodTypeAny, {
613
+ appDid?: string | undefined;
614
+ appName?: string | undefined;
615
+ appDescription?: string | undefined;
616
+ spaceDid?: string | undefined;
617
+ scopes?: string | undefined;
618
+ appUrl?: string | undefined;
619
+ referrer?: string | undefined;
620
+ }, {
621
+ appDid?: string | undefined;
622
+ appName?: string | undefined;
623
+ appDescription?: string | undefined;
624
+ spaceDid?: string | undefined;
625
+ scopes?: string | undefined;
626
+ appUrl?: string | undefined;
627
+ referrer?: string | undefined;
628
+ }>, z.ZodObject<{
629
+ spaceDid: z.ZodOptional<z.ZodString>;
630
+ appDid: z.ZodOptional<z.ZodString>;
631
+ appName: z.ZodOptional<z.ZodString>;
632
+ }, "strip", z.ZodTypeAny, {
633
+ appDid?: string | undefined;
634
+ appName?: string | undefined;
635
+ spaceDid?: string | undefined;
636
+ }, {
637
+ appDid?: string | undefined;
638
+ appName?: string | undefined;
639
+ spaceDid?: string | undefined;
640
+ }>, z.ZodObject<{
641
+ serverDid: z.ZodOptional<z.ZodString>;
642
+ signerDid: z.ZodOptional<z.ZodString>;
643
+ appName: z.ZodOptional<z.ZodString>;
644
+ appDescription: z.ZodOptional<z.ZodString>;
645
+ referrer: z.ZodOptional<z.ZodString>;
646
+ }, "strip", z.ZodTypeAny, {
647
+ appName?: string | undefined;
648
+ appDescription?: string | undefined;
649
+ referrer?: string | undefined;
650
+ serverDid?: string | undefined;
651
+ signerDid?: string | undefined;
652
+ }, {
653
+ appName?: string | undefined;
654
+ appDescription?: string | undefined;
655
+ referrer?: string | undefined;
656
+ serverDid?: string | undefined;
657
+ signerDid?: string | undefined;
658
+ }>, z.ZodObject<{
659
+ serverDid: z.ZodOptional<z.ZodString>;
660
+ appName: z.ZodOptional<z.ZodString>;
661
+ appDescription: z.ZodOptional<z.ZodString>;
662
+ referrer: z.ZodOptional<z.ZodString>;
663
+ }, "strip", z.ZodTypeAny, {
664
+ appName?: string | undefined;
665
+ appDescription?: string | undefined;
666
+ referrer?: string | undefined;
667
+ serverDid?: string | undefined;
668
+ }, {
669
+ appName?: string | undefined;
670
+ appDescription?: string | undefined;
671
+ referrer?: string | undefined;
672
+ serverDid?: string | undefined;
673
+ }>, z.ZodObject<{
674
+ appName: z.ZodOptional<z.ZodString>;
675
+ appDescription: z.ZodOptional<z.ZodString>;
676
+ source: z.ZodOptional<z.ZodString>;
677
+ target: z.ZodOptional<z.ZodString>;
678
+ totalCount: z.ZodOptional<z.ZodNumber>;
679
+ errorCount: z.ZodOptional<z.ZodNumber>;
680
+ successCount: z.ZodOptional<z.ZodNumber>;
681
+ size: z.ZodOptional<z.ZodNumber>;
682
+ duration: z.ZodOptional<z.ZodNumber>;
683
+ metadata: z.ZodOptional<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>;
684
+ }, "strip", z.ZodTypeAny, {
685
+ target?: string | undefined;
686
+ size?: number | undefined;
687
+ metadata?: Record<string, any> | undefined;
688
+ appName?: string | undefined;
689
+ appDescription?: string | undefined;
690
+ source?: string | undefined;
691
+ totalCount?: number | undefined;
692
+ errorCount?: number | undefined;
693
+ successCount?: number | undefined;
694
+ duration?: number | undefined;
695
+ }, {
696
+ target?: string | undefined;
697
+ size?: number | undefined;
698
+ metadata?: Record<string, any> | undefined;
699
+ appName?: string | undefined;
700
+ appDescription?: string | undefined;
701
+ source?: string | undefined;
702
+ totalCount?: number | undefined;
703
+ errorCount?: number | undefined;
704
+ successCount?: number | undefined;
705
+ duration?: number | undefined;
706
+ }>]>>;
707
+ reason: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodString>>>;
708
+ env: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>>>;
709
+ }, "strip", z.ZodTypeAny, {
710
+ id: string;
711
+ status?: AuditLogStatus | undefined;
712
+ createdAt?: string | undefined;
713
+ updatedAt?: string | undefined;
714
+ actionType?: AuditLogAction | undefined;
715
+ entityId?: string | undefined;
716
+ entityName?: string | undefined;
717
+ userId?: string | undefined;
718
+ username?: string | undefined;
719
+ data?: {
720
+ appDid?: string | undefined;
721
+ appName?: string | undefined;
722
+ appDescription?: string | undefined;
723
+ spaceDid?: string | undefined;
724
+ scopes?: string | undefined;
725
+ appUrl?: string | undefined;
726
+ referrer?: string | undefined;
727
+ } | {
728
+ appDid?: string | undefined;
729
+ appName?: string | undefined;
730
+ spaceDid?: string | undefined;
731
+ } | {
732
+ appName?: string | undefined;
733
+ appDescription?: string | undefined;
734
+ referrer?: string | undefined;
735
+ serverDid?: string | undefined;
736
+ signerDid?: string | undefined;
737
+ } | {
738
+ appName?: string | undefined;
739
+ appDescription?: string | undefined;
740
+ referrer?: string | undefined;
741
+ serverDid?: string | undefined;
742
+ } | {
743
+ target?: string | undefined;
744
+ size?: number | undefined;
745
+ metadata?: Record<string, any> | undefined;
746
+ appName?: string | undefined;
747
+ appDescription?: string | undefined;
748
+ source?: string | undefined;
749
+ totalCount?: number | undefined;
750
+ errorCount?: number | undefined;
751
+ successCount?: number | undefined;
752
+ duration?: number | undefined;
753
+ } | undefined;
754
+ reason?: string | undefined;
755
+ env?: Record<string, any> | undefined;
756
+ }, {
757
+ id: string;
758
+ status?: AuditLogStatus | undefined;
759
+ createdAt?: string | undefined;
760
+ updatedAt?: string | undefined;
761
+ actionType?: AuditLogAction | undefined;
762
+ entityId?: string | undefined;
763
+ entityName?: string | undefined;
764
+ userId?: string | undefined;
765
+ username?: string | undefined;
766
+ data?: {
767
+ appDid?: string | undefined;
768
+ appName?: string | undefined;
769
+ appDescription?: string | undefined;
770
+ spaceDid?: string | undefined;
771
+ scopes?: string | undefined;
772
+ appUrl?: string | undefined;
773
+ referrer?: string | undefined;
774
+ } | {
775
+ appDid?: string | undefined;
776
+ appName?: string | undefined;
777
+ spaceDid?: string | undefined;
778
+ } | {
779
+ appName?: string | undefined;
780
+ appDescription?: string | undefined;
781
+ referrer?: string | undefined;
782
+ serverDid?: string | undefined;
783
+ signerDid?: string | undefined;
784
+ } | {
785
+ appName?: string | undefined;
786
+ appDescription?: string | undefined;
787
+ referrer?: string | undefined;
788
+ serverDid?: string | undefined;
789
+ } | {
790
+ target?: string | undefined;
791
+ size?: number | undefined;
792
+ metadata?: Record<string, any> | undefined;
793
+ appName?: string | undefined;
794
+ appDescription?: string | undefined;
795
+ source?: string | undefined;
796
+ totalCount?: number | undefined;
797
+ errorCount?: number | undefined;
798
+ successCount?: number | undefined;
799
+ duration?: number | undefined;
800
+ } | undefined;
801
+ reason?: string | undefined;
802
+ env?: Record<string, any> | undefined;
803
+ }>;
804
+ export type UpdateAuditLog = z.infer<typeof UpdateAuditLogSchema>;
419
805
  export type AppConnected = z.infer<typeof AppConnectedSchema>;
420
806
  export type AppDisconnected = z.infer<typeof AppDisconnectedSchema>;
421
807
  export type AppBackup = z.infer<typeof AppBackupSchema>;
422
808
  export type AppRestore = z.infer<typeof AppRestoreSchema>;
809
+ export type AppObjectsSync = z.infer<typeof AppObjectsSyncSchema>;
423
810
  export type AuditLogDataTypeMapping = {
424
811
  [AuditLogAction.APP_CONNECTED]: AppConnected;
425
812
  [AuditLogAction.APP_DISCONNECTED]: AppDisconnected;
426
813
  [AuditLogAction.APP_BACKUP]: AppBackup;
427
814
  [AuditLogAction.APP_RESTORE]: AppRestore;
815
+ [AuditLogAction.APP_OBJECTS_SYNC]: AppObjectsSync;
428
816
  };
429
817
  export interface AuditLogModel<T extends keyof AuditLogDataTypeMapping = AuditLogAction> {
430
818
  /**