@tachybase/plugin-mock-collections 1.3.20 → 1.3.22

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,9 +1,7 @@
1
1
  module.exports = {
2
- "@tachybase/client": "1.3.20",
3
- "@tachybase/database": "1.3.20",
4
- "@tachybase/module-collection": "1.3.20",
5
- "@tachybase/server": "1.3.20",
6
- "@tachybase/utils": "1.3.20",
2
+ "@tachybase/client": "1.3.22",
3
+ "@tachybase/module-collection": "1.3.22",
4
+ "@tego/server": "1.3.39",
7
5
  "lodash": "4.17.21",
8
6
  "pg": "8.16.3"
9
7
  };
@@ -1 +1 @@
1
- {"name":"@faker-js/faker","version":"9.9.0","description":"Generate massive amounts of fake contextual data","keywords":["faker","faker.js","fakerjs","faker-js","fake data generator","fake data","fake-data","fake-generator","fake-data-generator","fake content generator","fake contextual data generator","fake contextual data"],"homepage":"https://fakerjs.dev","bugs":{"url":"https://github.com/faker-js/faker/issues"},"repository":{"type":"git","url":"git+https://github.com/faker-js/faker.git"},"funding":[{"type":"opencollective","url":"https://opencollective.com/fakerjs"}],"license":"MIT","sideEffects":false,"type":"module","exports":{".":{"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"},"default":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"./locale/*":{"require":{"types":"./dist/locale/*.d.cts","default":"./dist/locale/*.cjs"},"default":{"types":"./dist/locale/*.d.ts","default":"./dist/locale/*.js"}},"./package.json":"./package.json"},"main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","typesVersions":{">=5.0":{".":["./dist/index.d.ts"],"locale/*":["./dist/locale/*.d.ts"]}},"files":["CHANGELOG.md","dist"],"devDependencies":{"@eslint/compat":"1.3.1","@eslint/js":"9.30.0","@stylistic/eslint-plugin":"5.1.0","@types/node":"22.15.34","@types/sanitize-html":"2.16.0","@types/semver":"7.7.0","@types/validator":"13.15.2","@vitest/coverage-v8":"3.2.4","@vitest/eslint-plugin":"1.3.3","@vitest/ui":"3.2.4","@vueuse/core":"13.4.0","commit-and-tag-version":"12.5.1","cypress":"14.5.0","eslint":"9.30.0","eslint-config-prettier":"10.1.5","eslint-plugin-file-progress":"3.0.2","eslint-plugin-jsdoc":"51.3.1","eslint-plugin-prettier":"5.5.1","eslint-plugin-unicorn":"59.0.1","jiti":"2.4.2","npm-run-all2":"7.0.2","prettier":"3.6.2","prettier-plugin-organize-imports":"4.1.0","prettier-plugin-pkg":"0.21.1","sanitize-html":"2.17.0","semver":"7.7.2","ts-morph":"26.0.0","tsup":"8.5.0","tsx":"4.20.3","typescript":"5.8.3","typescript-eslint":"8.35.1","validator":"13.15.15","vitepress":"1.6.3","vitest":"3.2.4","vue":"3.5.17","vue-tsc":"2.2.10"},"engines":{"node":">=18.0.0","npm":">=9.0.0"},"scripts":{"clean":"git clean -fdx --exclude _local","build:clean":"git clean -fX dist","build:code":"tsup-node","build":"run-s build:clean build:code","generate":"run-s generate:locales generate:api-docs","generate:api-docs":"tsx ./scripts/apidocs.ts","generate:locales":"tsx ./scripts/generate-locales.ts","docs:build":"run-s generate:api-docs docs:build:embedded docs:build:run","docs:build:embedded":"tsup-node --entry.faker src/index.ts --format esm --outDir docs/public --no-dts --no-clean","docs:build:run":"vitepress build docs","docs:build:ci":"run-s build docs:build","docs:dev":"run-s generate:api-docs docs:build:embedded docs:dev:run","docs:dev:run":"vitepress dev docs","docs:serve":"vitepress serve docs --port 5173","docs:diff":"tsx ./scripts/diff.ts","docs:test:e2e:ci":"run-s docs:build:ci docs:test:e2e:install docs:test:e2e:run","docs:test:e2e:install":"cypress install","docs:test:e2e:run":"run-p --race docs:serve \"cypress run\"","docs:test:e2e:open":"run-p --race docs:serve \"cypress open\"","format":"prettier --cache --write .","lint":"eslint --cache --cache-strategy content .","ts-check":"tsc","test":"vitest","test:update-snapshots":"vitest run -u","coverage":"vitest run --coverage","integration-test":"vitest -c vitest.it-config.ts","cypress":"cypress","release":"commit-and-tag-version --commit-all","preflight":"pnpm install && run-s generate format lint build test:update-snapshots ts-check"},"_lastModified":"2025-07-24T06:28:30.797Z"}
1
+ {"name":"@faker-js/faker","version":"9.9.0","description":"Generate massive amounts of fake contextual data","keywords":["faker","faker.js","fakerjs","faker-js","fake data generator","fake data","fake-data","fake-generator","fake-data-generator","fake content generator","fake contextual data generator","fake contextual data"],"homepage":"https://fakerjs.dev","bugs":{"url":"https://github.com/faker-js/faker/issues"},"repository":{"type":"git","url":"git+https://github.com/faker-js/faker.git"},"funding":[{"type":"opencollective","url":"https://opencollective.com/fakerjs"}],"license":"MIT","sideEffects":false,"type":"module","exports":{".":{"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"},"default":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"./locale/*":{"require":{"types":"./dist/locale/*.d.cts","default":"./dist/locale/*.cjs"},"default":{"types":"./dist/locale/*.d.ts","default":"./dist/locale/*.js"}},"./package.json":"./package.json"},"main":"dist/index.cjs","module":"dist/index.js","types":"dist/index.d.ts","typesVersions":{">=5.0":{".":["./dist/index.d.ts"],"locale/*":["./dist/locale/*.d.ts"]}},"files":["CHANGELOG.md","dist"],"devDependencies":{"@eslint/compat":"1.3.1","@eslint/js":"9.30.0","@stylistic/eslint-plugin":"5.1.0","@types/node":"22.15.34","@types/sanitize-html":"2.16.0","@types/semver":"7.7.0","@types/validator":"13.15.2","@vitest/coverage-v8":"3.2.4","@vitest/eslint-plugin":"1.3.3","@vitest/ui":"3.2.4","@vueuse/core":"13.4.0","commit-and-tag-version":"12.5.1","cypress":"14.5.0","eslint":"9.30.0","eslint-config-prettier":"10.1.5","eslint-plugin-file-progress":"3.0.2","eslint-plugin-jsdoc":"51.3.1","eslint-plugin-prettier":"5.5.1","eslint-plugin-unicorn":"59.0.1","jiti":"2.4.2","npm-run-all2":"7.0.2","prettier":"3.6.2","prettier-plugin-organize-imports":"4.1.0","prettier-plugin-pkg":"0.21.1","sanitize-html":"2.17.0","semver":"7.7.2","ts-morph":"26.0.0","tsup":"8.5.0","tsx":"4.20.3","typescript":"5.8.3","typescript-eslint":"8.35.1","validator":"13.15.15","vitepress":"1.6.3","vitest":"3.2.4","vue":"3.5.17","vue-tsc":"2.2.10"},"engines":{"node":">=18.0.0","npm":">=9.0.0"},"scripts":{"clean":"git clean -fdx --exclude _local","build:clean":"git clean -fX dist","build:code":"tsup-node","build":"run-s build:clean build:code","generate":"run-s generate:locales generate:api-docs","generate:api-docs":"tsx ./scripts/apidocs.ts","generate:locales":"tsx ./scripts/generate-locales.ts","docs:build":"run-s generate:api-docs docs:build:embedded docs:build:run","docs:build:embedded":"tsup-node --entry.faker src/index.ts --format esm --outDir docs/public --no-dts --no-clean","docs:build:run":"vitepress build docs","docs:build:ci":"run-s build docs:build","docs:dev":"run-s generate:api-docs docs:build:embedded docs:dev:run","docs:dev:run":"vitepress dev docs","docs:serve":"vitepress serve docs --port 5173","docs:diff":"tsx ./scripts/diff.ts","docs:test:e2e:ci":"run-s docs:build:ci docs:test:e2e:install docs:test:e2e:run","docs:test:e2e:install":"cypress install","docs:test:e2e:run":"run-p --race docs:serve \"cypress run\"","docs:test:e2e:open":"run-p --race docs:serve \"cypress open\"","format":"prettier --cache --write .","lint":"eslint --cache --cache-strategy content .","ts-check":"tsc","test":"vitest","test:update-snapshots":"vitest run -u","coverage":"vitest run --coverage","integration-test":"vitest -c vitest.it-config.ts","cypress":"cypress","release":"commit-and-tag-version --commit-all","preflight":"pnpm install && run-s generate format lint build test:update-snapshots ts-check"},"_lastModified":"2025-07-29T06:20:01.626Z"}
@@ -24,15 +24,15 @@ __export(association_exports, {
24
24
  oho: () => oho
25
25
  });
26
26
  module.exports = __toCommonJS(association_exports);
27
- var import_utils = require("@tachybase/utils");
28
27
  var import_faker = require("@faker-js/faker");
28
+ var import_server = require("@tego/server");
29
29
  function reverseFieldHandle(defaults, { target, reverseField }) {
30
30
  if (!reverseField) {
31
31
  delete defaults.reverseField;
32
32
  } else {
33
33
  Object.assign(defaults.reverseField, reverseField);
34
34
  if (!defaults.reverseField.name) {
35
- defaults.reverseField.name = `f_${(0, import_utils.uid)()}`;
35
+ defaults.reverseField.name = `f_${(0, import_server.uid)()}`;
36
36
  }
37
37
  if (reverseField.title && defaults.reverseField.uiSchema) {
38
38
  defaults.reverseField.uiSchema["title"] = reverseField.title;
@@ -41,10 +41,10 @@ function reverseFieldHandle(defaults, { target, reverseField }) {
41
41
  defaults.reverseField.uiSchema["title"] = defaults.reverseField.name;
42
42
  }
43
43
  if (!defaults.key) {
44
- defaults.key = (0, import_utils.uid)();
44
+ defaults.key = (0, import_server.uid)();
45
45
  }
46
46
  if (!defaults.reverseField.key) {
47
- defaults.reverseField.key = (0, import_utils.uid)();
47
+ defaults.reverseField.key = (0, import_server.uid)();
48
48
  }
49
49
  defaults["reverseKey"] = defaults.reverseField.key;
50
50
  defaults.reverseField.reverseKey = defaults.key;
@@ -54,7 +54,7 @@ function reverseFieldHandle(defaults, { target, reverseField }) {
54
54
  }
55
55
  function generateForeignKeyField(options) {
56
56
  return options.type === "bigInt" ? {
57
- key: (0, import_utils.uid)(),
57
+ key: (0, import_server.uid)(),
58
58
  ...options,
59
59
  interface: "integer",
60
60
  isForeignKey: true,
@@ -66,7 +66,7 @@ function generateForeignKeyField(options) {
66
66
  "x-read-pretty": true
67
67
  }
68
68
  } : {
69
- key: (0, import_utils.uid)(),
69
+ key: (0, import_server.uid)(),
70
70
  ...options,
71
71
  interface: "input",
72
72
  isForeignKey: true,
@@ -81,7 +81,7 @@ function generateForeignKeyField(options) {
81
81
  }
82
82
  const oho = {
83
83
  options: (options) => {
84
- const { foreignKey = `f_${(0, import_utils.uid)()}`, targetKey = "id", sourceKey = "id", reverseField } = options;
84
+ const { foreignKey = `f_${(0, import_server.uid)()}`, targetKey = "id", sourceKey = "id", reverseField } = options;
85
85
  const defaults = {
86
86
  type: "hasOne",
87
87
  foreignKey,
@@ -133,8 +133,8 @@ const oho = {
133
133
  };
134
134
  const obo = {
135
135
  options: (options) => {
136
- const { foreignKey = `f_${(0, import_utils.uid)()}`, targetKey = "id", sourceKey = "id", reverseField } = options;
137
- const key = (0, import_utils.uid)();
136
+ const { foreignKey = `f_${(0, import_server.uid)()}`, targetKey = "id", sourceKey = "id", reverseField } = options;
137
+ const key = (0, import_server.uid)();
138
138
  const defaults = {
139
139
  type: "belongsTo",
140
140
  foreignKey,
@@ -185,7 +185,7 @@ const obo = {
185
185
  };
186
186
  const o2m = {
187
187
  options: (options) => {
188
- const { foreignKey = `f_${(0, import_utils.uid)()}`, targetKey = "id", sourceKey = "id", reverseField } = options;
188
+ const { foreignKey = `f_${(0, import_server.uid)()}`, targetKey = "id", sourceKey = "id", reverseField } = options;
189
189
  const defaults = {
190
190
  type: "hasMany",
191
191
  foreignKey,
@@ -238,7 +238,7 @@ const o2m = {
238
238
  };
239
239
  const m2o = {
240
240
  options: (options) => {
241
- const { foreignKey = `f_${(0, import_utils.uid)()}`, targetKey = "id", sourceKey = "id", reverseField } = options;
241
+ const { foreignKey = `f_${(0, import_server.uid)()}`, targetKey = "id", sourceKey = "id", reverseField } = options;
242
242
  const defaults = {
243
243
  type: "belongsTo",
244
244
  foreignKey,
@@ -293,9 +293,9 @@ const m2o = {
293
293
  const m2m = {
294
294
  options: (options) => {
295
295
  const {
296
- through = `t_${(0, import_utils.uid)()}`,
297
- foreignKey = `f_${(0, import_utils.uid)()}`,
298
- otherKey = `f_${(0, import_utils.uid)()}`,
296
+ through = `t_${(0, import_server.uid)()}`,
297
+ foreignKey = `f_${(0, import_server.uid)()}`,
298
+ otherKey = `f_${(0, import_server.uid)()}`,
299
299
  targetKey = "id",
300
300
  sourceKey = "id",
301
301
  reverseField
@@ -356,7 +356,7 @@ const m2m = {
356
356
  })
357
357
  ];
358
358
  defaults["throughCollection"] = {
359
- key: (0, import_utils.uid)(),
359
+ key: (0, import_server.uid)(),
360
360
  name: through,
361
361
  title: through,
362
362
  timestamps: true,
@@ -31,8 +31,8 @@ __export(attachment_exports, {
31
31
  mockAttachment: () => mockAttachment
32
32
  });
33
33
  module.exports = __toCommonJS(attachment_exports);
34
- var import_utils = require("@tachybase/utils");
35
34
  var import_faker = require("@faker-js/faker");
35
+ var import_server = require("@tego/server");
36
36
  var import_lodash = __toESM(require("lodash"));
37
37
  function mockAttachment() {
38
38
  return {
@@ -51,9 +51,9 @@ const attachment = {
51
51
  options: (options) => ({
52
52
  type: "belongsToMany",
53
53
  target: "attachments",
54
- through: options.through || `t_${(0, import_utils.uid)()}`,
55
- foreignKey: options.foreignKey || `f_${(0, import_utils.uid)()}`,
56
- otherKey: options.otherKey || `f_${(0, import_utils.uid)()}`,
54
+ through: options.through || `t_${(0, import_server.uid)()}`,
55
+ foreignKey: options.foreignKey || `f_${(0, import_server.uid)()}`,
56
+ otherKey: options.otherKey || `f_${(0, import_server.uid)()}`,
57
57
  targetKey: options.targetKey || "id",
58
58
  sourceKey: options.sourceKey || "id",
59
59
  // name,
@@ -20,7 +20,7 @@ __export(chinaRegion_exports, {
20
20
  chinaRegion: () => chinaRegion
21
21
  });
22
22
  module.exports = __toCommonJS(chinaRegion_exports);
23
- var import_utils = require("@tachybase/utils");
23
+ var import_server = require("@tego/server");
24
24
  const chinaRegion = {
25
25
  options: (options) => {
26
26
  var _a, _b, _c, _d;
@@ -29,9 +29,9 @@ const chinaRegion = {
29
29
  target: "chinaRegions",
30
30
  targetKey: "code",
31
31
  sortBy: "level",
32
- through: options.through || `t_${(0, import_utils.uid)()}`,
33
- foreignKey: options.foreignKey || `f_${(0, import_utils.uid)()}`,
34
- otherKey: options.otherKey || `f_${(0, import_utils.uid)()}`,
32
+ through: options.through || `t_${(0, import_server.uid)()}`,
33
+ foreignKey: options.foreignKey || `f_${(0, import_server.uid)()}`,
34
+ otherKey: options.otherKey || `f_${(0, import_server.uid)()}`,
35
35
  sourceKey: options.sourceKey || "id",
36
36
  // name,
37
37
  uiSchema: {
@@ -20,8 +20,8 @@ __export(email_exports, {
20
20
  email: () => email
21
21
  });
22
22
  module.exports = __toCommonJS(email_exports);
23
- var import_utils = require("@tachybase/utils");
24
23
  var import_faker = require("@faker-js/faker");
24
+ var import_server = require("@tego/server");
25
25
  const email = {
26
26
  options: () => ({
27
27
  type: "string",
@@ -33,7 +33,7 @@ const email = {
33
33
  "x-validator": "email"
34
34
  }
35
35
  }),
36
- mock: () => import_faker.faker.internet.email({ lastName: (0, import_utils.uid)() })
36
+ mock: () => import_faker.faker.internet.email({ lastName: (0, import_server.uid)() })
37
37
  };
38
38
  // Annotate the CommonJS export names for ESM import in node:
39
39
  0 && (module.exports = {
@@ -20,8 +20,8 @@ __export(time_exports, {
20
20
  time: () => time
21
21
  });
22
22
  module.exports = __toCommonJS(time_exports);
23
- var import_utils = require("@tachybase/utils");
24
23
  var import_faker = require("@faker-js/faker");
24
+ var import_server = require("@tego/server");
25
25
  const time = {
26
26
  options: () => ({
27
27
  type: "time",
@@ -34,7 +34,7 @@ const time = {
34
34
  }
35
35
  }
36
36
  }),
37
- mock: () => (0, import_utils.dayjs)(import_faker.faker.date.anytime()).format("HH:mm:ss")
37
+ mock: () => (0, import_server.dayjs)(import_faker.faker.date.anytime()).format("HH:mm:ss")
38
38
  };
39
39
  // Annotate the CommonJS export names for ESM import in node:
40
40
  0 && (module.exports = {
@@ -1,4 +1,4 @@
1
- import { InstallOptions, Plugin } from '@tachybase/server';
1
+ import { InstallOptions, Plugin } from '@tego/server';
2
2
  export declare class PluginMockCollectionsServer extends Plugin {
3
3
  load(): Promise<void>;
4
4
  install(options?: InstallOptions): Promise<void>;
@@ -31,10 +31,9 @@ __export(server_exports, {
31
31
  default: () => server_default
32
32
  });
33
33
  module.exports = __toCommonJS(server_exports);
34
- var import_fs = require("fs");
35
- var import_path = __toESM(require("path"));
36
- var import_server = require("@tachybase/server");
37
- var import_utils = require("@tachybase/utils");
34
+ var import_promises = __toESM(require("node:fs/promises"));
35
+ var import_node_path = __toESM(require("node:path"));
36
+ var import_server = require("@tego/server");
38
37
  var import_lodash = __toESM(require("lodash"));
39
38
  var import_pg = require("pg");
40
39
  var import_collection_templates = __toESM(require("./collection-templates"));
@@ -112,12 +111,12 @@ class PluginMockCollectionsServer extends import_server.Plugin {
112
111
  var _a;
113
112
  if (values.autoCreate || values.view) {
114
113
  if (!values.key) {
115
- values.key = (0, import_utils.uid)();
114
+ values.key = (0, import_server.uid)();
116
115
  }
117
116
  if (Array.isArray(values.fields)) {
118
117
  values.fields = values.fields.map((f) => {
119
118
  if (!f.key) {
120
- f.key = (0, import_utils.uid)();
119
+ f.key = (0, import_server.uid)();
121
120
  }
122
121
  return f;
123
122
  });
@@ -135,10 +134,10 @@ class PluginMockCollectionsServer extends import_server.Plugin {
135
134
  template: "general",
136
135
  view: false,
137
136
  sort: 1,
138
- name: `t_${(0, import_utils.uid)()}`,
137
+ name: `t_${(0, import_server.uid)()}`,
139
138
  ...values
140
139
  };
141
- defaults.key = (0, import_utils.uid)();
140
+ defaults.key = (0, import_server.uid)();
142
141
  if (!defaults.title) {
143
142
  defaults.title = defaults.name;
144
143
  }
@@ -197,14 +196,14 @@ class PluginMockCollectionsServer extends import_server.Plugin {
197
196
  const fn = fieldInterfaces[options.interface];
198
197
  if (fn) {
199
198
  const defaultValue = fn.options(options);
200
- options = (0, import_utils.merge)(defaultValue, options);
199
+ options = (0, import_server.merge)(defaultValue, options);
201
200
  }
202
201
  }
203
202
  if (!options.key) {
204
- options.key = (0, import_utils.uid)();
203
+ options.key = (0, import_server.uid)();
205
204
  }
206
205
  if (!options.name) {
207
- options.name = `f_${(0, import_utils.uid)()}`;
206
+ options.name = `f_${(0, import_server.uid)()}`;
208
207
  }
209
208
  if (options.title && options.uiSchema) {
210
209
  options.uiSchema.title = options.title;
@@ -341,8 +340,8 @@ class PluginMockCollectionsServer extends import_server.Plugin {
341
340
  port: parseInt(process.env.DB_PORT)
342
341
  });
343
342
  await client.connect();
344
- const sqlFile = import_path.default.resolve(__dirname, "./external.sql");
345
- const sql = await import_fs.promises.readFile(sqlFile, "utf8");
343
+ const sqlFile = import_node_path.default.resolve(__dirname, "./external.sql");
344
+ const sql = await import_promises.default.readFile(sqlFile, "utf8");
346
345
  await client.query(sql);
347
346
  await client.end();
348
347
  }
package/package.json CHANGED
@@ -1,26 +1,21 @@
1
1
  {
2
2
  "name": "@tachybase/plugin-mock-collections",
3
3
  "displayName": "mock-collections",
4
- "version": "1.3.20",
4
+ "version": "1.3.22",
5
5
  "description": "mock-collections",
6
6
  "license": "Apache-2.0",
7
7
  "main": "./dist/server/index.js",
8
8
  "dependencies": {},
9
9
  "devDependencies": {
10
10
  "@faker-js/faker": "9.9.0",
11
+ "@tachybase/test": "^1.3.39",
12
+ "@tego/client": "^1.3.39",
13
+ "@tego/server": "^1.3.39",
11
14
  "lodash": "4.17.21",
12
- "pg": "^8.16.3"
15
+ "pg": "^8.16.3",
16
+ "@tachybase/client": "1.3.22",
17
+ "@tachybase/module-error-handler": "1.3.22",
18
+ "@tachybase/module-collection": "1.3.22"
13
19
  },
14
- "peerDependencies": {
15
- "@tachybase/client": "1.3.20",
16
- "@tachybase/module-collection": "1.3.20",
17
- "@tachybase/database": "1.3.20",
18
- "@tachybase/module-error-handler": "1.3.20",
19
- "@tachybase/server": "1.3.20",
20
- "@tachybase/test": "1.3.20",
21
- "@tachybase/utils": "1.3.20"
22
- },
23
- "scripts": {
24
- "build": "tachybase-build --no-dts @tachybase/plugin-mock-collections"
25
- }
20
+ "scripts": {}
26
21
  }