@did-space/core 1.0.62 → 1.0.63

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.
@@ -1,5 +1,4 @@
1
1
  export * from './configuration';
2
- export * from './constants';
3
2
  export * from './drivers';
4
3
  export * from './meta';
5
4
  export * from './model';
package/dist/cjs/index.js CHANGED
@@ -15,7 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./configuration"), exports);
18
- __exportStar(require("./constants"), exports);
19
18
  __exportStar(require("./drivers"), exports);
20
19
  __exportStar(require("./meta"), exports);
21
20
  __exportStar(require("./model"), exports);
@@ -1,19 +1,7 @@
1
1
  import type { Model } from 'sequelize';
2
2
  import { z } from 'zod';
3
+ import { AuditLogAction, AuditLogStatus } from '@did-space/constants';
3
4
  export type JsonData = Record<string, any>;
4
- export declare enum AuditLogStatus {
5
- DEFAULT = "default",
6
- SUCCEEDED = "succeeded",
7
- FAILED = "failed",
8
- PENDING = "pending"
9
- }
10
- export declare enum AuditLogAction {
11
- APP_DISCONNECTED = "app-disconnected",
12
- APP_RESTORE = "app-restore",
13
- APP_BACKUP = "app-backup",
14
- APP_CONNECTED = "app-connected",
15
- APP_OBJECTS_SYNC = "app-objects-sync"
16
- }
17
5
  export declare const AppConnectedSchema: z.ZodObject<{
18
6
  spaceDid: z.ZodString;
19
7
  appDid: z.ZodString;
@@ -1,22 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UpdateAuditLogSchema = exports.CreationAuditLogSchema = exports.AuditLogSchema = exports.AppObjectsSyncSchema = exports.AppRestoreSchema = exports.AppBackupSchema = exports.AppDisconnectedSchema = exports.AppConnectedSchema = exports.AuditLogAction = exports.AuditLogStatus = void 0;
3
+ exports.UpdateAuditLogSchema = exports.CreationAuditLogSchema = exports.AuditLogSchema = exports.AppObjectsSyncSchema = exports.AppRestoreSchema = exports.AppBackupSchema = exports.AppDisconnectedSchema = exports.AppConnectedSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- var AuditLogStatus;
6
- (function (AuditLogStatus) {
7
- AuditLogStatus["DEFAULT"] = "default";
8
- AuditLogStatus["SUCCEEDED"] = "succeeded";
9
- AuditLogStatus["FAILED"] = "failed";
10
- AuditLogStatus["PENDING"] = "pending";
11
- })(AuditLogStatus = exports.AuditLogStatus || (exports.AuditLogStatus = {}));
12
- var AuditLogAction;
13
- (function (AuditLogAction) {
14
- AuditLogAction["APP_DISCONNECTED"] = "app-disconnected";
15
- AuditLogAction["APP_RESTORE"] = "app-restore";
16
- AuditLogAction["APP_BACKUP"] = "app-backup";
17
- AuditLogAction["APP_CONNECTED"] = "app-connected";
18
- AuditLogAction["APP_OBJECTS_SYNC"] = "app-objects-sync";
19
- })(AuditLogAction = exports.AuditLogAction || (exports.AuditLogAction = {}));
5
+ const constants_1 = require("@did-space/constants");
20
6
  exports.AppConnectedSchema = zod_1.z.object({
21
7
  spaceDid: zod_1.z.string().min(1),
22
8
  appDid: zod_1.z.string().min(1),
@@ -74,13 +60,13 @@ exports.AppObjectsSyncSchema = zod_1.z.object({
74
60
  });
75
61
  exports.AuditLogSchema = zod_1.z.object({
76
62
  id: zod_1.z.string(),
77
- actionType: zod_1.z.nativeEnum(AuditLogAction),
63
+ actionType: zod_1.z.nativeEnum(constants_1.AuditLogAction),
78
64
  entityId: zod_1.z.string().min(1),
79
65
  entityName: zod_1.z.string().optional().default(''),
80
66
  userId: zod_1.z.string().min(1),
81
67
  username: zod_1.z.string().optional().default(''),
82
68
  data: zod_1.z.union([exports.AppConnectedSchema, exports.AppDisconnectedSchema, exports.AppBackupSchema, exports.AppRestoreSchema, exports.AppObjectsSyncSchema]),
83
- status: zod_1.z.nativeEnum(AuditLogStatus).optional().default(AuditLogStatus.SUCCEEDED),
69
+ status: zod_1.z.nativeEnum(constants_1.AuditLogStatus).optional().default(constants_1.AuditLogStatus.SUCCEEDED),
84
70
  reason: zod_1.z.string().optional().default(''),
85
71
  env: zod_1.z.record(zod_1.z.any()).optional().default({}),
86
72
  createdAt: zod_1.z
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GetHashOptionsSchema = exports.WriteOptionsSchema = exports.DeleteAsOwnerOptionsSchema = exports.ObjectSpaceOptionsSchema = exports.WriteAsOwnerOptionsSchema = exports.OwnerOperatorKeySchema = void 0;
4
4
  const validator_1 = require("@arcblock/validator");
5
- const constants_1 = require("../constants");
5
+ const constants_1 = require("@did-space/constants");
6
6
  exports.OwnerOperatorKeySchema = validator_1.Joi.string().regex(/^\//).required();
7
7
  const WriteAsOwnerOptionsByFolderSchema = {
8
8
  is: validator_1.Joi.string().regex(/\/$/),
@@ -22,11 +22,11 @@ const isUndefined_1 = __importDefault(require("lodash/isUndefined"));
22
22
  const omit_1 = __importDefault(require("lodash/omit"));
23
23
  const isNumber_1 = __importDefault(require("lodash/isNumber"));
24
24
  const events_1 = __importDefault(require("events"));
25
+ const constants_1 = require("@did-space/constants");
25
26
  const configuration_1 = require("../configuration");
26
27
  const model_1 = require("../model");
27
28
  const utils_1 = require("../utils");
28
29
  const schemas_1 = require("../schemas");
29
- const constants_1 = require("../constants");
30
30
  const global_space_1 = require("./global-space");
31
31
  const debug = (0, debug_1.default)('@did-space/core:ObjectSpace');
32
32
  class ObjectSpace extends events_1.default {
@@ -1,5 +1,4 @@
1
1
  export * from './configuration';
2
- export * from './constants';
3
2
  export * from './drivers';
4
3
  export * from './meta';
5
4
  export * from './model';
package/dist/es/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from './configuration';
2
- export * from './constants';
3
2
  export * from './drivers';
4
3
  export * from './meta';
5
4
  export * from './model';
@@ -1,19 +1,7 @@
1
1
  import type { Model } from 'sequelize';
2
2
  import { z } from 'zod';
3
+ import { AuditLogAction, AuditLogStatus } from '@did-space/constants';
3
4
  export type JsonData = Record<string, any>;
4
- export declare enum AuditLogStatus {
5
- DEFAULT = "default",
6
- SUCCEEDED = "succeeded",
7
- FAILED = "failed",
8
- PENDING = "pending"
9
- }
10
- export declare enum AuditLogAction {
11
- APP_DISCONNECTED = "app-disconnected",
12
- APP_RESTORE = "app-restore",
13
- APP_BACKUP = "app-backup",
14
- APP_CONNECTED = "app-connected",
15
- APP_OBJECTS_SYNC = "app-objects-sync"
16
- }
17
5
  export declare const AppConnectedSchema: z.ZodObject<{
18
6
  spaceDid: z.ZodString;
19
7
  appDid: z.ZodString;
@@ -1,19 +1,5 @@
1
1
  import { z } from 'zod';
2
- export var AuditLogStatus;
3
- (function (AuditLogStatus) {
4
- AuditLogStatus["DEFAULT"] = "default";
5
- AuditLogStatus["SUCCEEDED"] = "succeeded";
6
- AuditLogStatus["FAILED"] = "failed";
7
- AuditLogStatus["PENDING"] = "pending";
8
- })(AuditLogStatus || (AuditLogStatus = {}));
9
- export var AuditLogAction;
10
- (function (AuditLogAction) {
11
- AuditLogAction["APP_DISCONNECTED"] = "app-disconnected";
12
- AuditLogAction["APP_RESTORE"] = "app-restore";
13
- AuditLogAction["APP_BACKUP"] = "app-backup";
14
- AuditLogAction["APP_CONNECTED"] = "app-connected";
15
- AuditLogAction["APP_OBJECTS_SYNC"] = "app-objects-sync";
16
- })(AuditLogAction || (AuditLogAction = {}));
2
+ import { AuditLogAction, AuditLogStatus } from '@did-space/constants';
17
3
  export const AppConnectedSchema = z.object({
18
4
  spaceDid: z.string().min(1),
19
5
  appDid: z.string().min(1),
@@ -1,5 +1,5 @@
1
1
  import { Joi } from '@arcblock/validator';
2
- import { GLOBAL_SPACE_ROOT } from '../constants';
2
+ import { GLOBAL_SPACE_ROOT } from '@did-space/constants';
3
3
  export const OwnerOperatorKeySchema = Joi.string().regex(/^\//).required();
4
4
  const WriteAsOwnerOptionsByFolderSchema = {
5
5
  is: Joi.string().regex(/\/$/),
@@ -7,11 +7,11 @@ import isUndefined from 'lodash/isUndefined';
7
7
  import omit from 'lodash/omit';
8
8
  import isNumber from 'lodash/isNumber';
9
9
  import EventEmitter from 'events';
10
+ import { APPS } from '@did-space/constants';
10
11
  import { Scopes } from '../configuration';
11
12
  import { TreeModelType, } from '../model';
12
13
  import { getHash, getHashPath, getSize, isDirectory, logger, isStream, streamToString } from '../utils';
13
14
  import { DeleteAsOwnerOptionsSchema, OwnerOperatorKeySchema, ObjectSpaceOptionsSchema, WriteAsOwnerOptionsSchema, WriteOptionsSchema, } from '../schemas';
14
- import { APPS } from '../constants';
15
15
  import { GlobalSpace } from './global-space';
16
16
  const debug = Debug('@did-space/core:ObjectSpace');
17
17
  export class ObjectSpace extends EventEmitter {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@did-space/core",
3
- "version": "1.0.62",
3
+ "version": "1.0.63",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -20,9 +20,6 @@
20
20
  "configuration": [
21
21
  "./dist/cjs/configuration/index.d.ts"
22
22
  ],
23
- "constants": [
24
- "./dist/cjs/constants/index.d.ts"
25
- ],
26
23
  "drivers": [
27
24
  "./dist/cjs/drivers/index.d.ts"
28
25
  ],
@@ -61,10 +58,6 @@
61
58
  "import": "./dist/es/configuration/index.js",
62
59
  "require": "./dist/cjs/configuration/index.js"
63
60
  },
64
- "./constants": {
65
- "import": "./dist/es/constants/index.js",
66
- "require": "./dist/cjs/constants/index.js"
67
- },
68
61
  "./drivers": {
69
62
  "import": "./dist/es/drivers/index.js",
70
63
  "require": "./dist/cjs/drivers/index.js"
@@ -118,6 +111,7 @@
118
111
  "@arcblock/did": "^1.20.14",
119
112
  "@arcblock/ipfs-only-hash": "^0.0.2",
120
113
  "@arcblock/validator": "^1.20.14",
114
+ "@did-space/constants": "^1.0.63",
121
115
  "dayjs": "^1.11.13",
122
116
  "debug": "^4.4.1",
123
117
  "destroy": "^1.2.0",
@@ -148,5 +142,5 @@
148
142
  "vite": "^5.4.19",
149
143
  "vitest": "^3.2.3"
150
144
  },
151
- "gitHead": "197d0bc5e9c9268ffd8adeaa64d967109b2f43c7"
145
+ "gitHead": "7412e2fc8d017cf57628b68bcbfff9e84fc4611f"
152
146
  }
@@ -1,32 +0,0 @@
1
- export declare const APPS = "apps";
2
- export declare const DID_OBJECTS = ".did-objects";
3
- export declare const HEADERS: {
4
- X_HASH: string;
5
- X_SIGNATURE_VERSION: string;
6
- };
7
- export declare const APP: {
8
- FOLDER_PREFIX: string;
9
- COMPONENT: {
10
- FOLDER_PREFIX: string;
11
- };
12
- };
13
- export declare const SPACE_CONNECT_ERROR_CODE: {
14
- /** 网络错误 */
15
- NETWORK_ERROR: number;
16
- /** 未授权 */
17
- UNAUTHORIZED: number;
18
- /** 订阅过期 */
19
- EXPIRED: number;
20
- /** 订阅逾期 */
21
- PAST_DUE: number;
22
- /** 订阅状态异常 */
23
- INVALID: number;
24
- /** 用量不足 */
25
- UNIT_LIMIT: number;
26
- /** 跨域限制 */
27
- CORS_BLOCKED: number;
28
- /** Space 版本不兼容 */
29
- INCOMPATIBLE: number;
30
- };
31
- export declare const GLOBAL_SPACE_ROOT = "__GLOBAL__";
32
- export declare const STORAGE_BUILT_IN_OBJECTS: string[];
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.STORAGE_BUILT_IN_OBJECTS = exports.GLOBAL_SPACE_ROOT = exports.SPACE_CONNECT_ERROR_CODE = exports.APP = exports.HEADERS = exports.DID_OBJECTS = exports.APPS = void 0;
4
- exports.APPS = 'apps';
5
- exports.DID_OBJECTS = '.did-objects';
6
- exports.HEADERS = {
7
- X_HASH: 'x-hash',
8
- // 取值范围 undefined | "2"
9
- // (默认)取值为 undefined,表示 url 未使用任何编码方式。
10
- // 取值为 2,表示 url 使用了 base64url 编码的方式
11
- X_SIGNATURE_VERSION: 'x-signature-version',
12
- };
13
- exports.APP = {
14
- // @example: /${spaceDid}/apps/${appDid}
15
- FOLDER_PREFIX: 'apps',
16
- COMPONENT: {
17
- // @example: /${spaceDid}/apps/${appDid}/.components/${componentDid}
18
- FOLDER_PREFIX: '.components',
19
- },
20
- };
21
- exports.SPACE_CONNECT_ERROR_CODE = {
22
- /** 网络错误 */
23
- NETWORK_ERROR: 1001,
24
- /** 未授权 */
25
- UNAUTHORIZED: 1002,
26
- /** 订阅过期 */
27
- EXPIRED: 1003,
28
- /** 订阅逾期 */
29
- PAST_DUE: 1004,
30
- /** 订阅状态异常 */
31
- INVALID: 1005,
32
- /** 用量不足 */
33
- UNIT_LIMIT: 1006,
34
- /** 跨域限制 */
35
- CORS_BLOCKED: 1007,
36
- /** Space 版本不兼容 */
37
- INCOMPATIBLE: 1008,
38
- };
39
- exports.GLOBAL_SPACE_ROOT = '__GLOBAL__';
40
- exports.STORAGE_BUILT_IN_OBJECTS = ['/config.yml', '/apps/', '/.meta/'];
@@ -1,32 +0,0 @@
1
- export declare const APPS = "apps";
2
- export declare const DID_OBJECTS = ".did-objects";
3
- export declare const HEADERS: {
4
- X_HASH: string;
5
- X_SIGNATURE_VERSION: string;
6
- };
7
- export declare const APP: {
8
- FOLDER_PREFIX: string;
9
- COMPONENT: {
10
- FOLDER_PREFIX: string;
11
- };
12
- };
13
- export declare const SPACE_CONNECT_ERROR_CODE: {
14
- /** 网络错误 */
15
- NETWORK_ERROR: number;
16
- /** 未授权 */
17
- UNAUTHORIZED: number;
18
- /** 订阅过期 */
19
- EXPIRED: number;
20
- /** 订阅逾期 */
21
- PAST_DUE: number;
22
- /** 订阅状态异常 */
23
- INVALID: number;
24
- /** 用量不足 */
25
- UNIT_LIMIT: number;
26
- /** 跨域限制 */
27
- CORS_BLOCKED: number;
28
- /** Space 版本不兼容 */
29
- INCOMPATIBLE: number;
30
- };
31
- export declare const GLOBAL_SPACE_ROOT = "__GLOBAL__";
32
- export declare const STORAGE_BUILT_IN_OBJECTS: string[];
@@ -1,37 +0,0 @@
1
- export const APPS = 'apps';
2
- export const DID_OBJECTS = '.did-objects';
3
- export const HEADERS = {
4
- X_HASH: 'x-hash',
5
- // 取值范围 undefined | "2"
6
- // (默认)取值为 undefined,表示 url 未使用任何编码方式。
7
- // 取值为 2,表示 url 使用了 base64url 编码的方式
8
- X_SIGNATURE_VERSION: 'x-signature-version',
9
- };
10
- export const APP = {
11
- // @example: /${spaceDid}/apps/${appDid}
12
- FOLDER_PREFIX: 'apps',
13
- COMPONENT: {
14
- // @example: /${spaceDid}/apps/${appDid}/.components/${componentDid}
15
- FOLDER_PREFIX: '.components',
16
- },
17
- };
18
- export const SPACE_CONNECT_ERROR_CODE = {
19
- /** 网络错误 */
20
- NETWORK_ERROR: 1001,
21
- /** 未授权 */
22
- UNAUTHORIZED: 1002,
23
- /** 订阅过期 */
24
- EXPIRED: 1003,
25
- /** 订阅逾期 */
26
- PAST_DUE: 1004,
27
- /** 订阅状态异常 */
28
- INVALID: 1005,
29
- /** 用量不足 */
30
- UNIT_LIMIT: 1006,
31
- /** 跨域限制 */
32
- CORS_BLOCKED: 1007,
33
- /** Space 版本不兼容 */
34
- INCOMPATIBLE: 1008,
35
- };
36
- export const GLOBAL_SPACE_ROOT = '__GLOBAL__';
37
- export const STORAGE_BUILT_IN_OBJECTS = ['/config.yml', '/apps/', '/.meta/'];