@nocobase/database 2.1.0-beta.46 → 2.1.0-beta.47

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.
@@ -30,10 +30,23 @@ export type DumpRules = BuiltInGroup | ({
30
30
  group: BuiltInGroup | string;
31
31
  } & BaseDumpRules);
32
32
  export type MigrationRule = 'overwrite' | 'skip' | 'upsert' | 'schema-only' | 'insert-ignore' | (string & {}) | null;
33
+ /**
34
+ * `dataCategory = system` marks data that is foundational to system operation and should be treated as core runtime data.
35
+ * `dataCategory = business` marks data owned by plugin features and used as part of the plugin's business domain.
36
+ * `dataCategory = runtime` excludes the collection's data from backup snapshots.
37
+ */
38
+ export type DataCategory = 'system' | 'business' | 'runtime';
39
+ export type DataCategories = DataCategory | DataCategory[];
40
+ export declare const TAG: {
41
+ basic: string;
42
+ business: string;
43
+ ignoredBackup: string;
44
+ };
33
45
  export interface CollectionOptions extends Omit<ModelOptions, 'name' | 'hooks'> {
34
46
  name: string;
35
47
  title?: string;
36
48
  namespace?: string;
49
+ dataCategory?: DataCategories;
37
50
  migrationRules?: MigrationRule[];
38
51
  dumpRules?: DumpRules;
39
52
  tableName?: string;
@@ -81,6 +94,7 @@ export declare class Collection<TModelAttributes extends {} = any, TCreationAttr
81
94
  model: ModelStatic<Model>;
82
95
  repository: Repository<TModelAttributes, TCreationAttributes>;
83
96
  constructor(options: CollectionOptions, context: CollectionContext);
97
+ get dataCategory(): DataCategories;
84
98
  get underscored(): boolean;
85
99
  get filterTargetKey(): string | string[];
86
100
  get name(): string;
package/lib/collection.js CHANGED
@@ -45,7 +45,8 @@ var __decorateClass = (decorators, target, key, kind) => {
45
45
  };
46
46
  var collection_exports = {};
47
47
  __export(collection_exports, {
48
- Collection: () => Collection
48
+ Collection: () => Collection,
49
+ TAG: () => TAG
49
50
  });
50
51
  module.exports = __toCommonJS(collection_exports);
51
52
  var import_deepmerge = __toESM(require("deepmerge"));
@@ -89,6 +90,11 @@ function EnsureAtomicity(target, propertyKey, descriptor) {
89
90
  return descriptor;
90
91
  }
91
92
  __name(EnsureAtomicity, "EnsureAtomicity");
93
+ const TAG = {
94
+ basic: "basic",
95
+ business: "business",
96
+ ignoredBackup: "ignored:backup"
97
+ };
92
98
  const _Collection = class _Collection extends import_events.EventEmitter {
93
99
  options;
94
100
  context;
@@ -112,6 +118,9 @@ const _Collection = class _Collection extends import_events.EventEmitter {
112
118
  this.setRepository(options.repository);
113
119
  this.setSortable(options.sortable);
114
120
  }
121
+ get dataCategory() {
122
+ return this.options.dataCategory;
123
+ }
115
124
  get underscored() {
116
125
  return this.options.underscored;
117
126
  }
@@ -817,5 +826,6 @@ __decorateClass([
817
826
  let Collection = _Collection;
818
827
  // Annotate the CommonJS export names for ESM import in node:
819
828
  0 && (module.exports = {
820
- Collection
829
+ Collection,
830
+ TAG
821
831
  });
package/lib/database.js CHANGED
@@ -224,6 +224,7 @@ const _Database = class _Database extends import_events.EventEmitter {
224
224
  });
225
225
  this.collection({
226
226
  name: "migrations",
227
+ dataCategory: "system",
227
228
  autoGenId: false,
228
229
  timestamps: false,
229
230
  dumpRules: "required",
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/database",
3
- "version": "2.1.0-beta.46",
3
+ "version": "2.1.0-beta.47",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
7
  "license": "Apache-2.0",
8
8
  "dependencies": {
9
- "@nocobase/logger": "2.1.0-beta.46",
10
- "@nocobase/utils": "2.1.0-beta.46",
9
+ "@nocobase/logger": "2.1.0-beta.47",
10
+ "@nocobase/utils": "2.1.0-beta.47",
11
11
  "async-mutex": "^0.3.2",
12
12
  "chalk": "^4.1.1",
13
13
  "cron-parser": "4.4.0",
@@ -38,5 +38,5 @@
38
38
  "url": "git+https://github.com/nocobase/nocobase.git",
39
39
  "directory": "packages/database"
40
40
  },
41
- "gitHead": "91fd3ab238a5ff58735bbfca04a8cb05d233b0af"
41
+ "gitHead": "bf8fc3790e3494c901b4d22861c5471a0d27c464"
42
42
  }