sonamu 0.0.1
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/.pnp.cjs +15552 -0
- package/.pnp.loader.mjs +285 -0
- package/.vscode/extensions.json +6 -0
- package/.vscode/settings.json +9 -0
- package/.yarnrc.yml +5 -0
- package/dist/bin/cli.d.ts +2 -0
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +123 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/index.js +34 -0
- package/package.json +60 -0
- package/src/api/caster.ts +72 -0
- package/src/api/code-converters.ts +552 -0
- package/src/api/context.ts +20 -0
- package/src/api/decorators.ts +63 -0
- package/src/api/index.ts +5 -0
- package/src/api/init.ts +128 -0
- package/src/bin/cli.ts +115 -0
- package/src/database/base-model.ts +287 -0
- package/src/database/db.ts +95 -0
- package/src/database/knex-plugins/knex-on-duplicate-update.ts +41 -0
- package/src/database/upsert-builder.ts +231 -0
- package/src/exceptions/error-handler.ts +29 -0
- package/src/exceptions/so-exceptions.ts +91 -0
- package/src/index.ts +17 -0
- package/src/shared/web.shared.ts.txt +119 -0
- package/src/smd/migrator.ts +1462 -0
- package/src/smd/smd-manager.ts +141 -0
- package/src/smd/smd-utils.ts +266 -0
- package/src/smd/smd.ts +533 -0
- package/src/syncer/index.ts +1 -0
- package/src/syncer/syncer.ts +1283 -0
- package/src/templates/base-template.ts +19 -0
- package/src/templates/generated.template.ts +247 -0
- package/src/templates/generated_http.template.ts +114 -0
- package/src/templates/index.ts +1 -0
- package/src/templates/init_enums.template.ts +71 -0
- package/src/templates/init_generated.template.ts +44 -0
- package/src/templates/init_types.template.ts +38 -0
- package/src/templates/model.template.ts +168 -0
- package/src/templates/model_test.template.ts +39 -0
- package/src/templates/service.template.ts +263 -0
- package/src/templates/smd.template.ts +49 -0
- package/src/templates/view_enums_buttonset.template.ts +34 -0
- package/src/templates/view_enums_dropdown.template.ts +67 -0
- package/src/templates/view_enums_select.template.ts +60 -0
- package/src/templates/view_form.template.ts +397 -0
- package/src/templates/view_id_all_select.template.ts +34 -0
- package/src/templates/view_id_async_select.template.ts +113 -0
- package/src/templates/view_list.template.ts +652 -0
- package/src/templates/view_list_columns.template.ts +59 -0
- package/src/templates/view_search_input.template.ts +67 -0
- package/src/testing/fixture-manager.ts +271 -0
- package/src/types/types.ts +668 -0
- package/src/typings/knex.d.ts +24 -0
- package/src/utils/controller.ts +21 -0
- package/src/utils/lodash-able.ts +11 -0
- package/src/utils/model.ts +33 -0
- package/src/utils/utils.ts +28 -0
- package/tsconfig.json +47 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
|
|
3
|
+
export type ListResult<T> = {
|
|
4
|
+
rows: T[];
|
|
5
|
+
total?: number;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type ArrayOr<T> = T | T[];
|
|
9
|
+
|
|
10
|
+
export function asArray<T>(param: T | T[]): T[] {
|
|
11
|
+
if (Array.isArray(param)) {
|
|
12
|
+
return param;
|
|
13
|
+
} else {
|
|
14
|
+
return [param as T] as T[];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function objToMap<T>(obj: { [k: string]: T }) {
|
|
19
|
+
const keys = Object.keys(obj);
|
|
20
|
+
if (keys.every((key) => parseInt(key).toString() === key)) {
|
|
21
|
+
return new Map<number, T>(keys.map((key) => [parseInt(key), obj[key]]));
|
|
22
|
+
} else {
|
|
23
|
+
return new Map<string, T>(Object.entries(obj));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export class BaseListParams {
|
|
28
|
+
id?: number | number[];
|
|
29
|
+
num?: number;
|
|
30
|
+
page?: number;
|
|
31
|
+
keyword?: string;
|
|
32
|
+
withoutCount?: boolean;
|
|
33
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import glob from "glob";
|
|
3
|
+
|
|
4
|
+
export function globAsync(pathPattern: string): Promise<string[]> {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
glob(path.resolve(pathPattern), (err, files) => {
|
|
7
|
+
if (err) {
|
|
8
|
+
reject(err);
|
|
9
|
+
} else {
|
|
10
|
+
resolve(files);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export async function importMultiple(
|
|
16
|
+
filePaths: string[]
|
|
17
|
+
): Promise<{ filePath: string; imported: any }[]> {
|
|
18
|
+
return Promise.all(
|
|
19
|
+
filePaths.map(async (filePath) => {
|
|
20
|
+
const importPath = "./" + path.relative(__dirname, filePath);
|
|
21
|
+
const imported = await import(importPath);
|
|
22
|
+
return {
|
|
23
|
+
filePath,
|
|
24
|
+
imported,
|
|
25
|
+
};
|
|
26
|
+
})
|
|
27
|
+
);
|
|
28
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
/* Basic Options */
|
|
4
|
+
"target": "es6",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"lib": ["esnext", "dom"],
|
|
9
|
+
"declaration": true,
|
|
10
|
+
"declarationMap": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
|
|
13
|
+
/* Strict Type-Checking Options */
|
|
14
|
+
"strict": true,
|
|
15
|
+
"noImplicitAny": true,
|
|
16
|
+
"strictNullChecks": true,
|
|
17
|
+
"strictFunctionTypes": true,
|
|
18
|
+
"strictBindCallApply": true,
|
|
19
|
+
"strictPropertyInitialization": true,
|
|
20
|
+
"noImplicitThis": true,
|
|
21
|
+
"alwaysStrict": true,
|
|
22
|
+
|
|
23
|
+
/* Additional Checks */
|
|
24
|
+
"noUnusedLocals": true,
|
|
25
|
+
"noUnusedParameters": true,
|
|
26
|
+
"noImplicitReturns": true,
|
|
27
|
+
"noFallthroughCasesInSwitch": true,
|
|
28
|
+
|
|
29
|
+
/* Experimental Options */
|
|
30
|
+
"experimentalDecorators": true,
|
|
31
|
+
"emitDecoratorMetadata": true,
|
|
32
|
+
|
|
33
|
+
/* Advanced Options */
|
|
34
|
+
"forceConsistentCasingInFileNames": true,
|
|
35
|
+
"noErrorTruncation": true
|
|
36
|
+
},
|
|
37
|
+
"exclude": [
|
|
38
|
+
"node_modules",
|
|
39
|
+
"dist",
|
|
40
|
+
"src/**/*.test.ts",
|
|
41
|
+
"src/**/*.test-hold.ts",
|
|
42
|
+
"src/**/*.ignore.ts",
|
|
43
|
+
"wasted_src/**",
|
|
44
|
+
"_templates/**",
|
|
45
|
+
"**/__mocks__/**"
|
|
46
|
+
]
|
|
47
|
+
}
|