@rws-framework/db 2.4.6 → 3.0.0

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.
Files changed (123) hide show
  1. package/.bin/add-v.sh +9 -9
  2. package/.bin/emerge.sh +10 -10
  3. package/.eslintrc.json +53 -53
  4. package/README.md +404 -404
  5. package/dist/decorators/IdType.d.ts +8 -0
  6. package/dist/decorators/IdType.js +10 -0
  7. package/dist/decorators/InverseRelation.d.ts +2 -2
  8. package/dist/decorators/InverseRelation.js +5 -1
  9. package/dist/decorators/InverseTimeSeries.d.ts +0 -0
  10. package/dist/decorators/InverseTimeSeries.js +0 -0
  11. package/dist/decorators/RWSCollection.d.ts +7 -0
  12. package/dist/decorators/RWSCollection.js +6 -0
  13. package/dist/decorators/Relation.d.ts +8 -6
  14. package/dist/decorators/Relation.js +8 -1
  15. package/dist/decorators/TrackType.d.ts +2 -14
  16. package/dist/decorators/TrackType.js +7 -0
  17. package/dist/decorators/TypeFunctions.d.ts +44 -0
  18. package/dist/decorators/TypeFunctions.js +174 -0
  19. package/dist/decorators/index.d.ts +4 -2
  20. package/dist/decorators/index.js +3 -1
  21. package/dist/helper/DbHelper.d.ts +76 -5
  22. package/dist/helper/DbHelper.js +93 -154
  23. package/dist/helper/FieldsHelper.d.ts +0 -0
  24. package/dist/helper/FieldsHelper.js +0 -0
  25. package/dist/helper/db/index.d.ts +9 -0
  26. package/dist/helper/db/index.js +18 -0
  27. package/dist/helper/db/relation-manager.d.ts +45 -0
  28. package/dist/helper/db/relation-manager.js +105 -0
  29. package/dist/helper/db/schema-generator.d.ts +37 -0
  30. package/dist/helper/db/schema-generator.js +243 -0
  31. package/dist/helper/db/type-converter.d.ts +22 -0
  32. package/dist/helper/db/type-converter.js +106 -0
  33. package/dist/helper/db/utils.d.ts +24 -0
  34. package/dist/helper/db/utils.js +99 -0
  35. package/dist/index.d.ts +3 -3
  36. package/dist/index.js +2 -1
  37. package/dist/models/TimeSeriesModel.d.ts +7 -7
  38. package/dist/models/TimeSeriesModel.js +33 -33
  39. package/dist/models/_model.d.ts +2 -2
  40. package/dist/models/_model.js +0 -0
  41. package/dist/models/core/RWSModel.d.ts +4 -1
  42. package/dist/models/core/RWSModel.js +6 -4
  43. package/dist/models/core/TimeSeriesModel.d.ts +0 -0
  44. package/dist/models/core/TimeSeriesModel.js +0 -0
  45. package/dist/models/index.d.ts +2 -2
  46. package/dist/models/index.js +0 -0
  47. package/dist/models/interfaces/IDbOpts.d.ts +17 -0
  48. package/dist/models/interfaces/IDbOpts.js +2 -0
  49. package/dist/models/interfaces/IIdOpts.d.ts +0 -0
  50. package/dist/models/interfaces/IIdOpts.js +1 -0
  51. package/dist/models/interfaces/IIdTypeOpts.d.ts +3 -0
  52. package/dist/models/interfaces/IIdTypeOpts.js +2 -0
  53. package/dist/models/interfaces/IModel.d.ts +0 -0
  54. package/dist/models/interfaces/IModel.js +0 -0
  55. package/dist/models/interfaces/IRWSModelServices.d.ts +0 -0
  56. package/dist/models/interfaces/IRWSModelServices.js +0 -0
  57. package/dist/models/interfaces/ITrackerOpts.d.ts +12 -0
  58. package/dist/models/interfaces/ITrackerOpts.js +2 -0
  59. package/dist/models/interfaces/OpModelType.d.ts +3 -0
  60. package/dist/models/interfaces/OpModelType.js +0 -0
  61. package/dist/models/types/RelationTypes.d.ts +0 -0
  62. package/dist/models/types/RelationTypes.js +0 -0
  63. package/dist/models/utils/ModelUtils.d.ts +0 -0
  64. package/dist/models/utils/ModelUtils.js +0 -0
  65. package/dist/models/utils/PaginationUtils.d.ts +0 -0
  66. package/dist/models/utils/PaginationUtils.js +0 -0
  67. package/dist/models/utils/RelationUtils.d.ts +1 -1
  68. package/dist/models/utils/RelationUtils.js +2 -2
  69. package/dist/models/utils/TimeSeriesUtils.d.ts +0 -0
  70. package/dist/models/utils/TimeSeriesUtils.js +0 -0
  71. package/dist/services/DBService.d.ts +0 -0
  72. package/dist/services/DBService.js +0 -0
  73. package/dist/types/DbConfigHandler.d.ts +1 -1
  74. package/dist/types/DbConfigHandler.js +0 -0
  75. package/dist/types/FindParams.d.ts +0 -0
  76. package/dist/types/FindParams.js +0 -0
  77. package/dist/types/IRWSModel.d.ts +1 -1
  78. package/dist/types/IRWSModel.js +0 -0
  79. package/dist/types/ITimeSeries.d.ts +0 -0
  80. package/dist/types/ITimeSeries.js +0 -0
  81. package/exec/console.js +110 -110
  82. package/exec/db.rws.webpack.config.js +168 -168
  83. package/exec/src/cli.ts +73 -75
  84. package/exec/tsconfig.json +32 -32
  85. package/exec/webpackFilters.js +17 -17
  86. package/package.json +36 -36
  87. package/src/decorators/IdType.ts +17 -0
  88. package/src/decorators/InverseRelation.ts +41 -37
  89. package/src/decorators/InverseTimeSeries.ts +21 -21
  90. package/src/decorators/RWSCollection.ts +45 -27
  91. package/src/decorators/Relation.ts +61 -48
  92. package/src/decorators/TrackType.ts +65 -69
  93. package/src/decorators/index.ts +16 -8
  94. package/src/empty.js +0 -0
  95. package/src/helper/DbHelper.ts +133 -223
  96. package/src/helper/FieldsHelper.ts +34 -34
  97. package/src/helper/db/index.ts +10 -0
  98. package/src/helper/db/relation-manager.ts +119 -0
  99. package/src/helper/db/schema-generator.ts +302 -0
  100. package/src/helper/db/type-converter.ts +119 -0
  101. package/src/helper/db/utils.ts +120 -0
  102. package/src/index.ts +47 -38
  103. package/src/models/_model.ts +29 -29
  104. package/src/models/core/RWSModel.ts +523 -520
  105. package/src/models/core/TimeSeriesModel.ts +19 -19
  106. package/src/models/index.ts +20 -20
  107. package/src/models/interfaces/IDbOpts.ts +17 -0
  108. package/src/models/interfaces/IIdTypeOpts.ts +4 -0
  109. package/src/models/interfaces/IModel.ts +12 -12
  110. package/src/models/interfaces/IRWSModelServices.ts +7 -7
  111. package/src/models/interfaces/ITrackerOpts.ts +13 -0
  112. package/src/models/interfaces/OpModelType.ts +52 -49
  113. package/src/models/types/RelationTypes.ts +25 -25
  114. package/src/models/utils/ModelUtils.ts +65 -65
  115. package/src/models/utils/PaginationUtils.ts +42 -42
  116. package/src/models/utils/RelationUtils.ts +76 -76
  117. package/src/models/utils/TimeSeriesUtils.ts +38 -38
  118. package/src/services/DBService.ts +277 -277
  119. package/src/types/DbConfigHandler.ts +17 -17
  120. package/src/types/FindParams.ts +13 -13
  121. package/src/types/IRWSModel.ts +2 -2
  122. package/src/types/ITimeSeries.ts +5 -5
  123. package/tsconfig.json +22 -22
@@ -1,168 +1,168 @@
1
- const path = require('path');
2
- const chalk = require('chalk');
3
- const webpackFilters = require('./webpackFilters');
4
- const webpack = require('webpack');
5
- const { rwsPath } = require('@rws-framework/console');
6
- // Get CLI arguments
7
- const args = process.argv.slice(2);
8
- const fs = require('fs');
9
- const appRootPath = args[4] || process.cwd();
10
- const modelsDir = args[5] || '';
11
-
12
- const internalCwd = process.cwd()
13
- const rootPackageNodeModules = path.resolve(rwsPath.findRootWorkspacePath(), 'node_modules');
14
- const thisPackage = path.resolve(__dirname, '..');
15
- const WEBPACK_PLUGINS = [new webpack.optimize.ModuleConcatenationPlugin()];
16
-
17
- const modules_setup = [rootPackageNodeModules, appRootPath];
18
- const isDev = true;
19
-
20
- function prettyLog(data){
21
- for(const key of Object.keys(data)){
22
- const valObject = data[key];
23
-
24
- console.log(`${chalk.yellow('[Log]')} ${chalk.blue(key)}:`, valObject)
25
- }
26
- }
27
-
28
-
29
-
30
- const mainEntry = './' + path.relative(appRootPath, path.join(internalCwd, '/src/cli.ts'));
31
- const vPath = path.relative(__dirname, path.join(__dirname, '../build/vendors'));
32
-
33
- prettyLog({ buildPaths:{
34
- thisPackage,
35
- rootPackageNodeModules,
36
- appRootPath,
37
- internalCwd,
38
- vPath
39
- }});
40
-
41
- if(!fs.existsSync(path.join(appRootPath, modelsDir, 'index.ts'))){
42
- console.log(`${chalk.red('[RWS Structure Error] ')} ${chalk.blue(`
43
- No index.ts in "${path.join(appRootPath, modelsDir)}"\n
44
- RWS DB requires "index.ts" that has default export with array of your models:\n
45
-
46
- ${chalk.blue('import')} RWSModel${chalk.blue(',')} OpModelType ${chalk.blue('from')} ${chalk.green('./src/models/user.model.ts')}${chalk.blue(';')}
47
-
48
- RWSModel<ModelDataInterface> is instance type and
49
- OpModelType<ModelDataInterface> is type for static methods that navigate through db to populate instanced models.`)}\n
50
-
51
- Example: \n
52
-
53
- ${chalk.blue('import')} User ${chalk.blue('from')} ${chalk.green('\'./src/models/user.model.ts\'')}${chalk.blue(';')}
54
- ${chalk.blue('import')} ApiKey ${chalk.blue('from')} ${chalk.green('\'./src/models/apiKey.model.ts\'')}${chalk.blue(';')}
55
-
56
- ${chalk.blue('export')} default ${chalk.magenta('[')}
57
- User${chalk.blue(',')}
58
- ApiKey
59
- ${chalk.magenta(']')}${chalk.blue(';')}
60
- `);
61
-
62
- throw new Error("Build stopped.")
63
- }
64
-
65
- const cfgExport = {
66
- context: appRootPath,
67
- entry: mainEntry,
68
- mode: isDev ? 'development' : 'production',
69
- target: 'node',
70
- devtool: isDev ? 'source-map' : false,
71
- output: {
72
- path: path.resolve(internalCwd, 'build'), // Resolve output path relative to config directory
73
- filename: '[name].cli.rws.js',
74
- sourceMapFilename: '[file].map',
75
- chunkFilename: "[name].chunk.js",
76
- libraryTarget: 'commonjs2',
77
- clean: false
78
- },
79
- resolve: {
80
- extensions: ['.ts', '.js'],
81
- modules: modules_setup,
82
- alias: {
83
- '@V': vPath,
84
- 'src': path.resolve(appRootPath, 'src'), // Add explicit resolution for src directory
85
- },
86
- fallback: {
87
- "kerberos": false,
88
- "mongodb-client-encryption": false
89
- }
90
- },
91
- module: {
92
- rules: [
93
- {
94
- test: /\.(ts)$/,
95
- use: [
96
- {
97
- loader: 'ts-loader',
98
- options: {
99
- transpileOnly: true,
100
- configFile: path.resolve(__dirname, 'tsconfig.json'),
101
- compilerOptions: {
102
- outDir: path.resolve(internalCwd, 'build'),
103
- }
104
- }
105
- }
106
- ],
107
- include: [
108
- path.resolve(appRootPath),
109
- path.resolve(thisPackage),
110
- path.resolve(rootPackageNodeModules, '@rws-framework')
111
- ],
112
- exclude: [
113
- /node_modules\/(?!(@rws-framework)\/).*/,
114
- /\.d\.ts$/
115
- ]
116
- },
117
- {
118
- test: /\.node$/,
119
- use: 'node-loader',
120
- }
121
- ],
122
- },
123
- plugins: [
124
- ...WEBPACK_PLUGINS,
125
- new webpack.DefinePlugin({
126
- 'process.env.APP_ROOT': JSON.stringify(appRootPath),
127
- 'process.env.DB_CLI': JSON.stringify(1)
128
- }),
129
- new webpack.IgnorePlugin({
130
- resourceRegExp: /^kerberos$/,
131
- }),
132
- new webpack.NormalModuleReplacementPlugin(
133
- /.*\/build\/Debug\/kerberos\.node$/,
134
- '@rws-framework/db/src/empty.js'
135
- )
136
- ],
137
- ignoreWarnings: webpackFilters,
138
- optimization: {
139
- minimize: false
140
- },
141
- experiments: {
142
- topLevelAwait: true, // Enable top-level await if needed
143
- }
144
- // stats: 'verbose'
145
-
146
- };
147
-
148
- cfgExport.externals = {
149
- '@nestjs/common': 'commonjs @nestjs/common',
150
- '@nestjs/core': 'commonjs @nestjs/core',
151
- '@nestjs/config': 'commonjs @nestjs/config',
152
- '@anthropic-ai/sdk': 'commonjs @anthropic-ai/sdk',
153
- '@zip.js/zip.js': 'commonjs @zip.js/zip.js',
154
- 'mongodb-client-encryption': 'commonjs mongodb-client-encryption',
155
- 'uuid': 'commonjs uuid',
156
- 'source-map-support': 'commonjs source-map-support'
157
- };
158
-
159
- cfgExport.plugins.push(
160
- new webpack.BannerPlugin({
161
- banner: 'require("source-map-support").install();',
162
- raw: true
163
- })
164
- );
165
-
166
- // console.log('Final config', cfgExport);
167
-
168
- module.exports = cfgExport;
1
+ const path = require('path');
2
+ const chalk = require('chalk');
3
+ const webpackFilters = require('./webpackFilters');
4
+ const webpack = require('webpack');
5
+ const { rwsPath } = require('@rws-framework/console');
6
+ // Get CLI arguments
7
+ const args = process.argv.slice(2);
8
+ const fs = require('fs');
9
+ const appRootPath = args[4] || process.cwd();
10
+ const modelsDir = args[5] || '';
11
+
12
+ const internalCwd = process.cwd()
13
+ const rootPackageNodeModules = path.resolve(rwsPath.findRootWorkspacePath(), 'node_modules');
14
+ const thisPackage = path.resolve(__dirname, '..');
15
+ const WEBPACK_PLUGINS = [new webpack.optimize.ModuleConcatenationPlugin()];
16
+
17
+ const modules_setup = [rootPackageNodeModules, appRootPath];
18
+ const isDev = true;
19
+
20
+ function prettyLog(data){
21
+ for(const key of Object.keys(data)){
22
+ const valObject = data[key];
23
+
24
+ console.log(`${chalk.yellow('[Log]')} ${chalk.blue(key)}:`, valObject)
25
+ }
26
+ }
27
+
28
+
29
+
30
+ const mainEntry = './' + path.relative(appRootPath, path.join(internalCwd, '/src/cli.ts'));
31
+ const vPath = path.relative(__dirname, path.join(__dirname, '../build/vendors'));
32
+
33
+ prettyLog({ buildPaths:{
34
+ thisPackage,
35
+ rootPackageNodeModules,
36
+ appRootPath,
37
+ internalCwd,
38
+ vPath
39
+ }});
40
+
41
+ if(!fs.existsSync(path.join(appRootPath, modelsDir, 'index.ts'))){
42
+ console.log(`${chalk.red('[RWS Structure Error] ')} ${chalk.blue(`
43
+ No index.ts in "${path.join(appRootPath, modelsDir)}"\n
44
+ RWS DB requires "index.ts" that has default export with array of your models:\n
45
+
46
+ ${chalk.blue('import')} RWSModel${chalk.blue(',')} OpModelType ${chalk.blue('from')} ${chalk.green('./src/models/user.model.ts')}${chalk.blue(';')}
47
+
48
+ RWSModel<ModelDataInterface> is instance type and
49
+ OpModelType<ModelDataInterface> is type for static methods that navigate through db to populate instanced models.`)}\n
50
+
51
+ Example: \n
52
+
53
+ ${chalk.blue('import')} User ${chalk.blue('from')} ${chalk.green('\'./src/models/user.model.ts\'')}${chalk.blue(';')}
54
+ ${chalk.blue('import')} ApiKey ${chalk.blue('from')} ${chalk.green('\'./src/models/apiKey.model.ts\'')}${chalk.blue(';')}
55
+
56
+ ${chalk.blue('export')} default ${chalk.magenta('[')}
57
+ User${chalk.blue(',')}
58
+ ApiKey
59
+ ${chalk.magenta(']')}${chalk.blue(';')}
60
+ `);
61
+
62
+ throw new Error("Build stopped.")
63
+ }
64
+
65
+ const cfgExport = {
66
+ context: appRootPath,
67
+ entry: mainEntry,
68
+ mode: isDev ? 'development' : 'production',
69
+ target: 'node',
70
+ devtool: isDev ? 'source-map' : false,
71
+ output: {
72
+ path: path.resolve(internalCwd, 'build'), // Resolve output path relative to config directory
73
+ filename: '[name].cli.rws.js',
74
+ sourceMapFilename: '[file].map',
75
+ chunkFilename: "[name].chunk.js",
76
+ libraryTarget: 'commonjs2',
77
+ clean: false
78
+ },
79
+ resolve: {
80
+ extensions: ['.ts', '.js'],
81
+ modules: modules_setup,
82
+ alias: {
83
+ '@V': vPath,
84
+ 'src': path.resolve(appRootPath, 'src'), // Add explicit resolution for src directory
85
+ },
86
+ fallback: {
87
+ "kerberos": false,
88
+ "mongodb-client-encryption": false
89
+ }
90
+ },
91
+ module: {
92
+ rules: [
93
+ {
94
+ test: /\.(ts)$/,
95
+ use: [
96
+ {
97
+ loader: 'ts-loader',
98
+ options: {
99
+ transpileOnly: true,
100
+ configFile: path.resolve(__dirname, 'tsconfig.json'),
101
+ compilerOptions: {
102
+ outDir: path.resolve(internalCwd, 'build'),
103
+ }
104
+ }
105
+ }
106
+ ],
107
+ include: [
108
+ path.resolve(appRootPath),
109
+ path.resolve(thisPackage),
110
+ path.resolve(rootPackageNodeModules, '@rws-framework')
111
+ ],
112
+ exclude: [
113
+ /node_modules\/(?!(@rws-framework)\/).*/,
114
+ /\.d\.ts$/
115
+ ]
116
+ },
117
+ {
118
+ test: /\.node$/,
119
+ use: 'node-loader',
120
+ }
121
+ ],
122
+ },
123
+ plugins: [
124
+ ...WEBPACK_PLUGINS,
125
+ new webpack.DefinePlugin({
126
+ 'process.env.APP_ROOT': JSON.stringify(appRootPath),
127
+ 'process.env.DB_CLI': JSON.stringify(1)
128
+ }),
129
+ new webpack.IgnorePlugin({
130
+ resourceRegExp: /^kerberos$/,
131
+ }),
132
+ new webpack.NormalModuleReplacementPlugin(
133
+ /.*\/build\/Debug\/kerberos\.node$/,
134
+ '@rws-framework/db/src/empty.js'
135
+ )
136
+ ],
137
+ ignoreWarnings: webpackFilters,
138
+ optimization: {
139
+ minimize: false
140
+ },
141
+ experiments: {
142
+ topLevelAwait: true, // Enable top-level await if needed
143
+ }
144
+ // stats: 'verbose'
145
+
146
+ };
147
+
148
+ cfgExport.externals = {
149
+ '@nestjs/common': 'commonjs @nestjs/common',
150
+ '@nestjs/core': 'commonjs @nestjs/core',
151
+ '@nestjs/config': 'commonjs @nestjs/config',
152
+ '@anthropic-ai/sdk': 'commonjs @anthropic-ai/sdk',
153
+ '@zip.js/zip.js': 'commonjs @zip.js/zip.js',
154
+ 'mongodb-client-encryption': 'commonjs mongodb-client-encryption',
155
+ 'uuid': 'commonjs uuid',
156
+ 'source-map-support': 'commonjs source-map-support'
157
+ };
158
+
159
+ cfgExport.plugins.push(
160
+ new webpack.BannerPlugin({
161
+ banner: 'require("source-map-support").install();',
162
+ raw: true
163
+ })
164
+ );
165
+
166
+ // console.log('Final config', cfgExport);
167
+
168
+ module.exports = cfgExport;
package/exec/src/cli.ts CHANGED
@@ -1,75 +1,73 @@
1
- import 'reflect-metadata';
2
-
3
- const args: string[] = process.argv.slice(2).filter(cmd => cmd !== '--rebuild');
4
- import fs from 'fs';
5
- import path from 'path';
6
- import { DbHelper, DBService, OpModelType, RWSModel } from '../../src';
7
- import { IDbConfigHandler, IDbConfigParams } from '../../src/types/DbConfigHandler';
8
- import chalk from 'chalk';
9
-
10
- class Config implements IDbConfigHandler {
11
- private data: IDbConfigParams = {
12
- db_models: [],
13
- mongo_db: null,
14
- mongo_url: null
15
- };
16
-
17
- private modelsDir: string;
18
- private cliExecRoot: string;
19
- private static _instance: Config = null;
20
-
21
- private constructor(){}
22
-
23
- static async getInstance(): Promise<Config>
24
- {
25
- if(!this._instance){
26
- this._instance = new Config();
27
- }
28
-
29
- await this._instance.fill();
30
-
31
- return this._instance;
32
- }
33
-
34
-
35
- async fill(): Promise<void>
36
- {
37
- this.data.db_url = args[0];
38
- this.data.db_name = args[1];
39
- this.data.db_type = args[2];
40
-
41
-
42
- this.modelsDir = args[3];
43
- this.cliExecRoot = args[4];
44
-
45
- console.log({args})
46
-
47
- // this.data.db_models = (await import('@V/index')).default;
48
- }
49
-
50
- getModelsDir(): string
51
- {
52
- return this.modelsDir
53
- }
54
-
55
- getCliExecRoot(): string
56
- {
57
- return this.cliExecRoot
58
- }
59
-
60
- get<K extends keyof IDbConfigParams>(key: K): IDbConfigParams[K] {
61
- return this.data[key];
62
- }
63
- }
64
-
65
- async function main(): Promise<void>
66
- {
67
- console.log('INSTALL PRISMA');
68
- const cfg = await Config.getInstance();
69
- process.env.PRISMA_DB_URL = cfg.get('db_url');
70
- DbHelper.installPrisma(cfg, new DBService(cfg), false);
71
- }
72
-
73
- console.log(chalk.bgGreen('[RWS DB CLI] Starting systems...'));
74
-
75
- main();
1
+ import 'reflect-metadata';
2
+
3
+ const args: string[] = process.argv.slice(2).filter(cmd => cmd !== '--rebuild');
4
+
5
+ import { IDbConfigHandler, IDbConfigParams } from '../../src/types/DbConfigHandler';
6
+ import chalk from 'chalk';
7
+ import { DbHelper } from '../../src/helper/DbHelper';
8
+ import { DBService } from '../../src/services/DBService';
9
+
10
+ class Config implements IDbConfigHandler {
11
+ private data: IDbConfigParams = {
12
+ db_models: [],
13
+ db_name: null,
14
+ db_url: null
15
+ };
16
+
17
+ private modelsDir: string;
18
+ private cliExecRoot: string;
19
+ private static _instance: Config = null;
20
+
21
+ private constructor(){}
22
+
23
+ static async getInstance(): Promise<Config>
24
+ {
25
+ if(!this._instance){
26
+ this._instance = new Config();
27
+ }
28
+
29
+ await this._instance.fill();
30
+
31
+ return this._instance;
32
+ }
33
+
34
+
35
+ async fill(): Promise<void>
36
+ {
37
+ this.data.db_url = args[0];
38
+ this.data.db_name = args[1];
39
+ this.data.db_type = args[2] as IDbConfigParams['db_type'];
40
+
41
+
42
+ this.modelsDir = args[3];
43
+ this.cliExecRoot = args[4];
44
+
45
+ // this.data.db_models = (await import('@V/index')).default;
46
+ }
47
+
48
+ getModelsDir(): string
49
+ {
50
+ return this.modelsDir
51
+ }
52
+
53
+ getCliExecRoot(): string
54
+ {
55
+ return this.cliExecRoot
56
+ }
57
+
58
+ get<K extends keyof IDbConfigParams>(key: K): IDbConfigParams[K] {
59
+ return this.data[key];
60
+ }
61
+ }
62
+
63
+ async function main(): Promise<void>
64
+ {
65
+ console.log('INSTALL PRISMA');
66
+ const cfg = await Config.getInstance();
67
+ process.env.PRISMA_DB_URL = cfg.get('db_url');
68
+ DbHelper.installPrisma(cfg, new DBService(cfg), false);
69
+ }
70
+
71
+ console.log(chalk.bgGreen('[RWS DB CLI] Starting systems...'));
72
+
73
+ main();
@@ -1,32 +1,32 @@
1
- {
2
- "compilerOptions": {
3
- "baseUrl": "./",
4
- "experimentalDecorators": true,
5
- "emitDecoratorMetadata": true,
6
- "emitDeclarationOnly": false,
7
- "target": "ES2018",
8
- "module": "commonjs",
9
- "moduleResolution": "node",
10
- "strict": true,
11
- "skipLibCheck": true,
12
- "esModuleInterop": true,
13
- "resolveJsonModule": true,
14
- "strictNullChecks": false,
15
- "allowSyntheticDefaultImports": true,
16
- "sourceMap": true,
17
- "declaration": true,
18
- "outDir": "build/vendors",
19
- "preserveWatchOutput": true,
20
- "allowJs": true,
21
- "paths": {
22
- "@V/*": ["./build/vendors/*"]
23
- }
24
- },
25
- "include": [
26
- "src/cli.ts",
27
- "../src/*"
28
- ],
29
- "exclude": [
30
- "node_modules"
31
- ]
32
- }
1
+ {
2
+ "compilerOptions": {
3
+ "baseUrl": "./",
4
+ "experimentalDecorators": true,
5
+ "emitDecoratorMetadata": true,
6
+ "emitDeclarationOnly": false,
7
+ "target": "ES2018",
8
+ "module": "commonjs",
9
+ "moduleResolution": "node",
10
+ "strict": true,
11
+ "skipLibCheck": true,
12
+ "esModuleInterop": true,
13
+ "resolveJsonModule": true,
14
+ "strictNullChecks": false,
15
+ "allowSyntheticDefaultImports": true,
16
+ "sourceMap": true,
17
+ "declaration": true,
18
+ "outDir": "build/vendors",
19
+ "preserveWatchOutput": true,
20
+ "allowJs": true,
21
+ "paths": {
22
+ "@V/*": ["./build/vendors/*"]
23
+ }
24
+ },
25
+ "include": [
26
+ "src/cli.ts",
27
+ "../src/*"
28
+ ],
29
+ "exclude": [
30
+ "node_modules"
31
+ ]
32
+ }
@@ -1,18 +1,18 @@
1
- module.exports = [
2
- /aws-crt/,
3
- /express\/lib\/view/,
4
- /mongodb-client-encryption\/lib\/providers\/gcp/,
5
- /mongodb/,
6
- /nest-commander/,
7
- /snappy/,
8
- /mongodb-js\/zstd/,
9
- /puppeteer/,
10
- /kerberos/,
11
- /@zip\.js\/zip.js/,
12
- /Module not found: Error: Can't resolve 'fsevents' in/,
13
- /Critical dependency: the request of a dependency is an expression/,
14
- /Module not found: Error: Can't resolve 'aws4'/,
15
- /Critical dependency: require function is used in a way in which dependencies cannot be statically extracted/,
16
- /Can't resolve .* in '.*kerberos.*'/,
17
- /Can't resolve .* in '.*mongodb-client-encryption.*'/
1
+ module.exports = [
2
+ /aws-crt/,
3
+ /express\/lib\/view/,
4
+ /mongodb-client-encryption\/lib\/providers\/gcp/,
5
+ /mongodb/,
6
+ /nest-commander/,
7
+ /snappy/,
8
+ /mongodb-js\/zstd/,
9
+ /puppeteer/,
10
+ /kerberos/,
11
+ /@zip\.js\/zip.js/,
12
+ /Module not found: Error: Can't resolve 'fsevents' in/,
13
+ /Critical dependency: the request of a dependency is an expression/,
14
+ /Module not found: Error: Can't resolve 'aws4'/,
15
+ /Critical dependency: require function is used in a way in which dependencies cannot be statically extracted/,
16
+ /Can't resolve .* in '.*kerberos.*'/,
17
+ /Can't resolve .* in '.*mongodb-client-encryption.*'/
18
18
  ];
package/package.json CHANGED
@@ -1,36 +1,36 @@
1
- {
2
- "name": "@rws-framework/db",
3
- "private": false,
4
- "version": "2.4.6",
5
- "description": "",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "scripts": {},
9
- "author": "papablack",
10
- "license": "ISC",
11
- "bin": {
12
- "rws-db": "./exec/console.js"
13
- },
14
- "dependencies": {
15
- "@rws-framework/console": "*",
16
- "@prisma/client": "^5.1.1",
17
- "@mongodb-js/zstd": "^1.2.0",
18
- "mongodb": "^6.8.1",
19
- "mongodb-client-encryption": "^6.1.1",
20
- "xml2js": "^0.6.2",
21
- "crypto": "^1.0.1",
22
- "source-map-support": "^0.5.21",
23
- "tsconfig-paths": "^4.2.0",
24
- "tsconfig-paths-webpack-plugin": "^4.1.0"
25
- },
26
- "devDependencies": {
27
- "@types/xml2js": "^0.4.14",
28
- "typescript": "^5.7.2"
29
-
30
- },
31
- "repository": {
32
- "type": "git",
33
- "url": "https://github.com/rws-framework/db.git"
34
- },
35
- "_rws": true
36
- }
1
+ {
2
+ "name": "@rws-framework/db",
3
+ "private": false,
4
+ "version": "3.0.0",
5
+ "description": "",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {},
9
+ "author": "papablack",
10
+ "license": "ISC",
11
+ "bin": {
12
+ "rws-db": "./exec/console.js"
13
+ },
14
+ "dependencies": {
15
+ "@rws-framework/console": "*",
16
+ "@prisma/client": "^5.1.1",
17
+ "@mongodb-js/zstd": "^1.2.0",
18
+ "mongodb": "^6.8.1",
19
+ "mongodb-client-encryption": "^6.1.1",
20
+ "xml2js": "^0.6.2",
21
+ "crypto": "^1.0.1",
22
+ "source-map-support": "^0.5.21",
23
+ "tsconfig-paths": "^4.2.0",
24
+ "tsconfig-paths-webpack-plugin": "^4.1.0"
25
+ },
26
+ "devDependencies": {
27
+ "@types/xml2js": "^0.4.14",
28
+ "typescript": "^5.7.2"
29
+
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/rws-framework/db.git"
34
+ },
35
+ "_rws": true
36
+ }