@companix/xeo-server 0.0.2 → 0.0.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/drivers/collection.driver.d.ts +2 -0
- package/dist/drivers/collection.driver.js +7 -0
- package/dist/drivers/collection.driver.js.map +1 -1
- package/dist/utils/flatten.d.ts +1 -0
- package/dist/utils/flatten.js +33 -0
- package/dist/utils/flatten.js.map +1 -0
- package/package.json +6 -2
- package/.eslintrc +0 -54
- package/jest.cases.config.cjs +0 -14
- package/lib/common/decorators.ts +0 -17
- package/lib/common/index.ts +0 -3
- package/lib/common/tokens.ts +0 -17
- package/lib/common/utils.ts +0 -29
- package/lib/constants.ts +0 -4
- package/lib/driver.module.ts +0 -37
- package/lib/drivers/collection.driver.ts +0 -157
- package/lib/drivers/table.driver.ts +0 -109
- package/lib/factories/definitions.factory.ts +0 -129
- package/lib/index.ts +0 -3
- package/lib/mongoose-options.interface.ts +0 -19
- package/lib/mongoose.module.ts +0 -95
- package/lib/storages/data-source.ts +0 -37
- package/tests/app/bootstrap.ts +0 -16
- package/tests/app/db.ts +0 -22
- package/tests/app/filters.ts +0 -25
- package/tests/app/helpers/is-one-of.ts +0 -58
- package/tests/app/main.ts +0 -3
- package/tests/app/module/app.controller.ts +0 -67
- package/tests/app/module/app.dto.ts +0 -394
- package/tests/app/module/app.module.ts +0 -12
- package/tests/app/module/app.service.ts +0 -76
- package/tests/app/root.module.ts +0 -12
- package/tests/globals.d.ts +0 -6
- package/tests/integrations/cases.test.ts +0 -154
- package/tests/integrations/custom.test.ts +0 -69
- package/tests/unit/definitions.test.ts +0 -31
- package/tsconfig.build.json +0 -9
- package/tsconfig.json +0 -17
- package/tsconfig.test-app.json +0 -10
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { CoreError, DataSource } from '@companix/xeo-scheme'
|
|
2
|
-
import { getDataSourceToken } from '../../lib'
|
|
3
|
-
|
|
4
|
-
import { bootstrap } from '../app/bootstrap'
|
|
5
|
-
import { MongoCollectionDriver } from '../../lib/drivers/collection.driver'
|
|
6
|
-
import { AppScheme, createMockKit, dataScheme } from '@companix/xeo-devkit'
|
|
7
|
-
|
|
8
|
-
const runScenario = async (dataSource: DataSource<AppScheme, MongoCollectionDriver<AppScheme>>) => {
|
|
9
|
-
// version: 11
|
|
10
|
-
// const kit = await createMockKit(dataSource)
|
|
11
|
-
// await kit.addDictionary({ dictionary: 'regions' })
|
|
12
|
-
// await kit.addOption({
|
|
13
|
-
// value: 'option-1',
|
|
14
|
-
// dictionary: 'regions' // BelongsTo
|
|
15
|
-
// })
|
|
16
|
-
// await kit.addRevisorWorker({ workerId: 2 })
|
|
17
|
-
// await dataSource.collections.worker.update(2, (w) => {
|
|
18
|
-
// if (w.type === 'revisor') {
|
|
19
|
-
// w.about.height = 10
|
|
20
|
-
// w.password = 'password'
|
|
21
|
-
// // w.job_type = 'self_employed'
|
|
22
|
-
// }
|
|
23
|
-
// })
|
|
24
|
-
// await kit.addDictionary({
|
|
25
|
-
// dictionary: 'value_type',
|
|
26
|
-
// name: 'ТМЦ'
|
|
27
|
-
// })
|
|
28
|
-
// await kit.addOption({
|
|
29
|
-
// dictionary: 'regions',
|
|
30
|
-
// value: 'moscow',
|
|
31
|
-
// title: 'Москва'
|
|
32
|
-
// })
|
|
33
|
-
// await kit.addOption({
|
|
34
|
-
// dictionary: 'regions',
|
|
35
|
-
// value: 'shanghai',
|
|
36
|
-
// title: 'Шанхай'
|
|
37
|
-
// })
|
|
38
|
-
// await dataSource.collections.options.remove('moscow')
|
|
39
|
-
// await kit.addRole({
|
|
40
|
-
// value: 'director',
|
|
41
|
-
// title: 'Директор'
|
|
42
|
-
// })
|
|
43
|
-
// await kit.addRevisorWorker({
|
|
44
|
-
// workerId: 3
|
|
45
|
-
// })
|
|
46
|
-
// await dataSource.collections.worker.remove(1)
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async function bootstrapTest() {
|
|
50
|
-
const app = await bootstrap()
|
|
51
|
-
const dataSource = app.get<DataSource<AppScheme, MongoCollectionDriver<AppScheme>>>(
|
|
52
|
-
getDataSourceToken(dataScheme)
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
try {
|
|
56
|
-
console.log('Run Scenario')
|
|
57
|
-
await runScenario(dataSource)
|
|
58
|
-
console.log('Scenario Done!')
|
|
59
|
-
} catch (error) {
|
|
60
|
-
if (error instanceof CoreError) {
|
|
61
|
-
console.error('CoreError:', error)
|
|
62
|
-
return
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
throw error
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
bootstrapTest()
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { dataScheme } from '@companix/xeo-devkit'
|
|
2
|
-
import { DefinitionsFactory } from '../../lib/factories/definitions.factory'
|
|
3
|
-
|
|
4
|
-
const factory = new DefinitionsFactory(dataScheme)
|
|
5
|
-
|
|
6
|
-
const schemas = {
|
|
7
|
-
worker: factory.createForCollection('worker'),
|
|
8
|
-
bankCard: factory.createForCollection('bankCard'),
|
|
9
|
-
bankDetail: factory.createForCollection('bankDetail'),
|
|
10
|
-
scan: factory.createForCollection('scan'),
|
|
11
|
-
dictionaries: factory.createForCollection('dictionaries'),
|
|
12
|
-
options: factory.createForCollection('options')
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const workerScheme = dataScheme.models[dataScheme.collections.worker.name].scheme
|
|
16
|
-
|
|
17
|
-
console.dir(schemas.worker, {
|
|
18
|
-
depth: null,
|
|
19
|
-
colors: true
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
if (workerScheme.type === 'discriminated') {
|
|
23
|
-
console.log('\ndiscriminated:\n')
|
|
24
|
-
|
|
25
|
-
for (const i of workerScheme.discriminators) {
|
|
26
|
-
console.dir(factory.createDefinitionScheme(i), {
|
|
27
|
-
depth: null,
|
|
28
|
-
colors: true
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
}
|
package/tsconfig.build.json
DELETED
package/tsconfig.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"module": "commonjs",
|
|
4
|
-
"declaration": true,
|
|
5
|
-
"noImplicitAny": false,
|
|
6
|
-
"removeComments": true,
|
|
7
|
-
"noLib": false,
|
|
8
|
-
"emitDecoratorMetadata": true,
|
|
9
|
-
"experimentalDecorators": true,
|
|
10
|
-
"target": "ES2021",
|
|
11
|
-
"sourceMap": true,
|
|
12
|
-
"esModuleInterop": true,
|
|
13
|
-
"skipLibCheck": true,
|
|
14
|
-
"strict": true,
|
|
15
|
-
"strictPropertyInitialization": false
|
|
16
|
-
}
|
|
17
|
-
}
|
package/tsconfig.test-app.json
DELETED