@nocobase/plugin-mock-collections 0.16.0-alpha.3 → 0.16.0-alpha.4
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.
package/dist/externalVersion.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@nocobase/client": "0.16.0-alpha.
|
|
3
|
-
"@nocobase/database": "0.16.0-alpha.
|
|
4
|
-
"@nocobase/plugin-collection-manager": "0.16.0-alpha.
|
|
5
|
-
"@nocobase/server": "0.16.0-alpha.
|
|
6
|
-
"@nocobase/utils": "0.16.0-alpha.
|
|
2
|
+
"@nocobase/client": "0.16.0-alpha.4",
|
|
3
|
+
"@nocobase/database": "0.16.0-alpha.4",
|
|
4
|
+
"@nocobase/plugin-collection-manager": "0.16.0-alpha.4",
|
|
5
|
+
"@nocobase/server": "0.16.0-alpha.4",
|
|
6
|
+
"@nocobase/utils": "0.16.0-alpha.4",
|
|
7
7
|
"lodash": "4.17.21"
|
|
8
8
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@faker-js/faker","version":"8.1.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"],"repository":{"type":"git","url":"https://github.com/faker-js/faker.git"},"funding":[{"type":"opencollective","url":"https://opencollective.com/fakerjs"}],"bugs":"https://github.com/faker-js/faker/issues","license":"MIT","main":"dist/cjs/index.js","module":"dist/esm/index.mjs","types":"index.d.ts","typesVersions":{">=4.0":{"*":["dist/types/*"]}},"exports":{".":{"types":"./dist/types/index.d.ts","require":"./dist/cjs/index.js","import":"./dist/esm/index.mjs"},"./locale/*":{"types":"./dist/types/locale/*.d.ts","require":"./dist/cjs/locale/*.js","import":"./dist/esm/locale/*.mjs"},"./package.json":"./package.json"},"files":["CHANGELOG.md","dist"],"scripts":{"clean":"rimraf coverage .eslintcache dist docs/.vitepress/dist locale pnpm-lock.yaml node_modules","build:clean":"rimraf dist","build:code":"tsx ./scripts/bundle.ts","build:types":"tsc --project tsconfig.build.json","build":"run-s build:clean build:code build:types","generate":"run-s generate:locales generate:api-docs","generate:api-docs":"tsx ./scripts/apidoc.ts","generate:locales":"tsx ./scripts/generateLocales.ts","docs:build":"run-s docs:prepare docs:build:run","docs:build:run":"vitepress build docs","docs:build:ci":"run-s build docs:build","docs:prepare":"run-s generate:api-docs","docs:dev":"run-s docs:prepare docs:dev:run","docs:dev:run":"vitepress dev docs","docs:serve":"vitepress serve docs --port 5173","docs:diff":"tsx ./scripts/diff.ts","format":"prettier --cache --write .","lint":"eslint --cache --cache-strategy content --report-unused-disable-directives .","ts-check":"tsc","test":"vitest","test:update-snapshots":"vitest run -u","coverage":"vitest run --coverage","cypress":"cypress","docs:test:e2e:ci":"run-s docs:build:ci docs:test:e2e:run","docs:test:e2e:run":"run-p --race docs:serve \"cypress run\"","docs:test:e2e:open":"run-p --race docs:serve \"cypress open\"","release":"standard-version","prepublishOnly":"pnpm run clean && pnpm install && pnpm run build","preflight":"pnpm install && run-s generate format lint build test:update-snapshots ts-check"},"devDependencies":{"@actions/github":"~5.1.1","@algolia/client-search":"~4.19.1","@types/markdown-it":"~13.0.1","@types/node":"~20.6.2","@types/sanitize-html":"~2.9.0","@types/semver":"~7.5.2","@types/validator":"~13.11.1","@typescript-eslint/eslint-plugin":"~6.7.0","@typescript-eslint/parser":"~6.7.0","@vitest/coverage-v8":"~0.34.4","@vitest/ui":"~0.34.4","@vueuse/core":"~10.4.1","conventional-changelog-cli":"~4.1.0","cypress":"~13.2.0","esbuild":"~0.19.3","eslint":"~8.49.0","eslint-config-prettier":"~9.0.0","eslint-define-config":"~1.23.0","eslint-gitignore":"~0.1.0","eslint-plugin-deprecation":"~2.0.0","eslint-plugin-jsdoc":"~46.8.1","eslint-plugin-prettier":"~5.0.0","eslint-plugin-vitest":"~0.3.1","glob":"~10.3.4","npm-run-all":"~4.1.5","prettier":"3.0.3","prettier-plugin-organize-imports":"~3.2.3","rimraf":"~5.0.1","sanitize-html":"~2.11.0","semver":"~7.5.4","standard-version":"~9.5.0","tsx":"~3.12.10","typedoc":"~0.24.8","typescript":"~4.9.5","validator":"~13.11.0","vite":"~4.4.9","vitepress":"1.0.0-beta.7","vitest":"~0.34.4","vue":"~3.3.4"},"packageManager":"pnpm@8.5.1","engines":{"node":"^14.17.0 || ^16.13.0 || >=18.0.0","npm":">=6.14.13"},"_lastModified":"2023-11-
|
|
1
|
+
{"name":"@faker-js/faker","version":"8.1.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"],"repository":{"type":"git","url":"https://github.com/faker-js/faker.git"},"funding":[{"type":"opencollective","url":"https://opencollective.com/fakerjs"}],"bugs":"https://github.com/faker-js/faker/issues","license":"MIT","main":"dist/cjs/index.js","module":"dist/esm/index.mjs","types":"index.d.ts","typesVersions":{">=4.0":{"*":["dist/types/*"]}},"exports":{".":{"types":"./dist/types/index.d.ts","require":"./dist/cjs/index.js","import":"./dist/esm/index.mjs"},"./locale/*":{"types":"./dist/types/locale/*.d.ts","require":"./dist/cjs/locale/*.js","import":"./dist/esm/locale/*.mjs"},"./package.json":"./package.json"},"files":["CHANGELOG.md","dist"],"scripts":{"clean":"rimraf coverage .eslintcache dist docs/.vitepress/dist locale pnpm-lock.yaml node_modules","build:clean":"rimraf dist","build:code":"tsx ./scripts/bundle.ts","build:types":"tsc --project tsconfig.build.json","build":"run-s build:clean build:code build:types","generate":"run-s generate:locales generate:api-docs","generate:api-docs":"tsx ./scripts/apidoc.ts","generate:locales":"tsx ./scripts/generateLocales.ts","docs:build":"run-s docs:prepare docs:build:run","docs:build:run":"vitepress build docs","docs:build:ci":"run-s build docs:build","docs:prepare":"run-s generate:api-docs","docs:dev":"run-s docs:prepare docs:dev:run","docs:dev:run":"vitepress dev docs","docs:serve":"vitepress serve docs --port 5173","docs:diff":"tsx ./scripts/diff.ts","format":"prettier --cache --write .","lint":"eslint --cache --cache-strategy content --report-unused-disable-directives .","ts-check":"tsc","test":"vitest","test:update-snapshots":"vitest run -u","coverage":"vitest run --coverage","cypress":"cypress","docs:test:e2e:ci":"run-s docs:build:ci docs:test:e2e:run","docs:test:e2e:run":"run-p --race docs:serve \"cypress run\"","docs:test:e2e:open":"run-p --race docs:serve \"cypress open\"","release":"standard-version","prepublishOnly":"pnpm run clean && pnpm install && pnpm run build","preflight":"pnpm install && run-s generate format lint build test:update-snapshots ts-check"},"devDependencies":{"@actions/github":"~5.1.1","@algolia/client-search":"~4.19.1","@types/markdown-it":"~13.0.1","@types/node":"~20.6.2","@types/sanitize-html":"~2.9.0","@types/semver":"~7.5.2","@types/validator":"~13.11.1","@typescript-eslint/eslint-plugin":"~6.7.0","@typescript-eslint/parser":"~6.7.0","@vitest/coverage-v8":"~0.34.4","@vitest/ui":"~0.34.4","@vueuse/core":"~10.4.1","conventional-changelog-cli":"~4.1.0","cypress":"~13.2.0","esbuild":"~0.19.3","eslint":"~8.49.0","eslint-config-prettier":"~9.0.0","eslint-define-config":"~1.23.0","eslint-gitignore":"~0.1.0","eslint-plugin-deprecation":"~2.0.0","eslint-plugin-jsdoc":"~46.8.1","eslint-plugin-prettier":"~5.0.0","eslint-plugin-vitest":"~0.3.1","glob":"~10.3.4","npm-run-all":"~4.1.5","prettier":"3.0.3","prettier-plugin-organize-imports":"~3.2.3","rimraf":"~5.0.1","sanitize-html":"~2.11.0","semver":"~7.5.4","standard-version":"~9.5.0","tsx":"~3.12.10","typedoc":"~0.24.8","typescript":"~4.9.5","validator":"~13.11.0","vite":"~4.4.9","vitepress":"1.0.0-beta.7","vitest":"~0.34.4","vue":"~3.3.4"},"packageManager":"pnpm@8.5.1","engines":{"node":"^14.17.0 || ^16.13.0 || >=18.0.0","npm":">=6.14.13"},"_lastModified":"2023-11-24T15:24:13.486Z"}
|
|
@@ -1,30 +1,40 @@
|
|
|
1
1
|
export declare const oho: {
|
|
2
2
|
options: (options: any) => any;
|
|
3
|
-
mock: (options: any, { mockCollectionData }: {
|
|
3
|
+
mock: (options: any, { mockCollectionData, maxDepth, depth }: {
|
|
4
4
|
mockCollectionData: any;
|
|
5
|
+
maxDepth: any;
|
|
6
|
+
depth: any;
|
|
5
7
|
}) => Promise<any>;
|
|
6
8
|
};
|
|
7
9
|
export declare const obo: {
|
|
8
10
|
options: (options: any) => any;
|
|
9
|
-
mock: (options: any, { mockCollectionData }: {
|
|
11
|
+
mock: (options: any, { mockCollectionData, depth, maxDepth }: {
|
|
10
12
|
mockCollectionData: any;
|
|
13
|
+
depth: any;
|
|
14
|
+
maxDepth: any;
|
|
11
15
|
}) => Promise<any>;
|
|
12
16
|
};
|
|
13
17
|
export declare const o2m: {
|
|
14
18
|
options: (options: any) => any;
|
|
15
|
-
mock: (options: any, { mockCollectionData }: {
|
|
19
|
+
mock: (options: any, { mockCollectionData, depth, maxDepth }: {
|
|
16
20
|
mockCollectionData: any;
|
|
21
|
+
depth: any;
|
|
22
|
+
maxDepth: any;
|
|
17
23
|
}) => Promise<any>;
|
|
18
24
|
};
|
|
19
25
|
export declare const m2o: {
|
|
20
26
|
options: (options: any) => any;
|
|
21
|
-
mock: (options: any, { mockCollectionData }: {
|
|
27
|
+
mock: (options: any, { mockCollectionData, depth, maxDepth }: {
|
|
22
28
|
mockCollectionData: any;
|
|
29
|
+
depth: any;
|
|
30
|
+
maxDepth: any;
|
|
23
31
|
}) => Promise<any>;
|
|
24
32
|
};
|
|
25
33
|
export declare const m2m: {
|
|
26
34
|
options: (options: any) => any;
|
|
27
|
-
mock: (options: any, { mockCollectionData }: {
|
|
35
|
+
mock: (options: any, { mockCollectionData, depth, maxDepth }: {
|
|
28
36
|
mockCollectionData: any;
|
|
37
|
+
depth: any;
|
|
38
|
+
maxDepth: any;
|
|
29
39
|
}) => Promise<any>;
|
|
30
40
|
};
|
|
@@ -127,8 +127,8 @@ const oho = {
|
|
|
127
127
|
];
|
|
128
128
|
return reverseFieldHandle(defaults, options);
|
|
129
129
|
},
|
|
130
|
-
mock: async (options, { mockCollectionData }) => {
|
|
131
|
-
return mockCollectionData(options.target, 1,
|
|
130
|
+
mock: async (options, { mockCollectionData, maxDepth, depth }) => {
|
|
131
|
+
return mockCollectionData(options.target, 1, depth + 1, maxDepth);
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
134
|
const obo = {
|
|
@@ -179,8 +179,8 @@ const obo = {
|
|
|
179
179
|
];
|
|
180
180
|
return reverseFieldHandle(defaults, options);
|
|
181
181
|
},
|
|
182
|
-
mock: async (options, { mockCollectionData }) => {
|
|
183
|
-
return mockCollectionData(options.target, 1,
|
|
182
|
+
mock: async (options, { mockCollectionData, depth, maxDepth }) => {
|
|
183
|
+
return mockCollectionData(options.target, 1, depth + 1, maxDepth);
|
|
184
184
|
}
|
|
185
185
|
};
|
|
186
186
|
const o2m = {
|
|
@@ -232,8 +232,8 @@ const o2m = {
|
|
|
232
232
|
];
|
|
233
233
|
return reverseFieldHandle(defaults, options);
|
|
234
234
|
},
|
|
235
|
-
mock: async (options, { mockCollectionData }) => {
|
|
236
|
-
return mockCollectionData(options.target, import_faker.faker.number.int({ min: 2, max: 5 }),
|
|
235
|
+
mock: async (options, { mockCollectionData, depth, maxDepth }) => {
|
|
236
|
+
return mockCollectionData(options.target, import_faker.faker.number.int({ min: 2, max: 5 }), depth + 1, maxDepth);
|
|
237
237
|
}
|
|
238
238
|
};
|
|
239
239
|
const m2o = {
|
|
@@ -286,8 +286,8 @@ const m2o = {
|
|
|
286
286
|
];
|
|
287
287
|
return reverseFieldHandle(defaults, options);
|
|
288
288
|
},
|
|
289
|
-
mock: async (options, { mockCollectionData }) => {
|
|
290
|
-
return mockCollectionData(options.target, 1,
|
|
289
|
+
mock: async (options, { mockCollectionData, depth, maxDepth }) => {
|
|
290
|
+
return mockCollectionData(options.target, 1, depth + 1, maxDepth);
|
|
291
291
|
}
|
|
292
292
|
};
|
|
293
293
|
const m2m = {
|
|
@@ -368,8 +368,8 @@ const m2m = {
|
|
|
368
368
|
};
|
|
369
369
|
return reverseFieldHandle(defaults, options);
|
|
370
370
|
},
|
|
371
|
-
mock: async (options, { mockCollectionData }) => {
|
|
372
|
-
return mockCollectionData(options.target, import_faker.faker.number.int({ min: 2, max: 5 }),
|
|
371
|
+
mock: async (options, { mockCollectionData, depth, maxDepth }) => {
|
|
372
|
+
return mockCollectionData(options.target, import_faker.faker.number.int({ min: 2, max: 5 }), depth + 1, maxDepth);
|
|
373
373
|
}
|
|
374
374
|
};
|
|
375
375
|
// Annotate the CommonJS export names for ESM import in node:
|
package/dist/server/index.js
CHANGED
|
@@ -215,7 +215,7 @@ class PluginMockCollectionsServer extends import_server.Plugin {
|
|
|
215
215
|
mock: async (ctx, next) => {
|
|
216
216
|
const { resourceName } = ctx.action;
|
|
217
217
|
const { values, count = 10 } = ctx.action.params;
|
|
218
|
-
const mockCollectionData = async (collectionName, count2 = 1,
|
|
218
|
+
const mockCollectionData = async (collectionName, count2 = 1, depth = 0, maxDepth = 2) => {
|
|
219
219
|
const collection = ctx.db.getCollection(collectionName);
|
|
220
220
|
const items = await Promise.all(
|
|
221
221
|
import_lodash.default.range(count2).map(async (i) => {
|
|
@@ -230,12 +230,12 @@ class PluginMockCollectionsServer extends import_server.Plugin {
|
|
|
230
230
|
if (!field.options.interface) {
|
|
231
231
|
continue;
|
|
232
232
|
}
|
|
233
|
-
if (
|
|
233
|
+
if (depth >= maxDepth && ["m2o", "m2m", "o2m", "obo", "oho"].includes(field.options.interface)) {
|
|
234
234
|
continue;
|
|
235
235
|
}
|
|
236
236
|
const fn = fieldInterfaces[field.options.interface];
|
|
237
237
|
if (fn == null ? void 0 : fn.mock) {
|
|
238
|
-
values2[field.name] = await fn.mock(field.options, { mockCollectionData });
|
|
238
|
+
values2[field.name] = await fn.mock(field.options, { mockCollectionData, maxDepth, depth });
|
|
239
239
|
}
|
|
240
240
|
}
|
|
241
241
|
return values2;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@nocobase/plugin-mock-collections",
|
|
3
3
|
"displayName": "mock-collections",
|
|
4
4
|
"description": "mock-collections",
|
|
5
|
-
"version": "0.16.0-alpha.
|
|
5
|
+
"version": "0.16.0-alpha.4",
|
|
6
6
|
"main": "./dist/server/index.js",
|
|
7
7
|
"license": "AGPL-3.0",
|
|
8
8
|
"peerDependencies": {
|
|
@@ -13,5 +13,5 @@
|
|
|
13
13
|
"@nocobase/test": "0.x",
|
|
14
14
|
"@nocobase/utils": "0.x"
|
|
15
15
|
},
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "98d65186a22281e59209d11a6756712a62667c07"
|
|
17
17
|
}
|