@carbonorm/carbonnode 3.0.0 → 3.0.2
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/api/builders/sqlBuilder.d.ts +3 -0
- package/dist/api/convertForRequestBody.d.ts +1 -1
- package/dist/api/executors/Executor.d.ts +16 -0
- package/dist/api/executors/HttpExecutor.d.ts +13 -0
- package/dist/api/executors/SqlExecutor.d.ts +19 -0
- package/dist/api/restRequest.d.ts +9 -166
- package/dist/api/types/dynamicFetching.d.ts +10 -0
- package/dist/api/types/modifyTypes.d.ts +9 -0
- package/dist/api/types/mysqlTypes.d.ts +4 -0
- package/dist/api/types/ormInterfaces.d.ts +219 -0
- package/dist/api/utils/apiHelpers.d.ts +9 -0
- package/dist/api/utils/cacheManager.d.ts +10 -0
- package/dist/api/utils/determineRuntimeJsType.d.ts +5 -0
- package/dist/api/utils/logger.d.ts +7 -0
- package/dist/api/utils/sortAndSerializeQueryObject.d.ts +1 -0
- package/dist/api/utils/testHelpers.d.ts +1 -0
- package/dist/api/utils/toastNotifier.d.ts +2 -0
- package/dist/index.cjs.js +665 -614
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +15 -2
- package/dist/index.esm.js +655 -618
- package/dist/index.esm.js.map +1 -1
- package/package.json +22 -6
- package/scripts/assets/handlebars/C6.ts.handlebars +13 -5
- package/scripts/assets/handlebars/Table.ts.handlebars +44 -12
- package/scripts/generateRestBindings.cjs +1 -1
- package/scripts/generateRestBindings.ts +1 -1
- package/src/api/builders/sqlBuilder.ts +173 -0
- package/src/api/convertForRequestBody.ts +2 -3
- package/src/api/executors/Executor.ts +28 -0
- package/src/api/executors/HttpExecutor.ts +794 -0
- package/src/api/executors/SqlExecutor.ts +104 -0
- package/src/api/restRequest.ts +50 -1287
- package/src/api/types/dynamicFetching.ts +10 -0
- package/src/api/types/modifyTypes.ts +25 -0
- package/src/api/types/mysqlTypes.ts +33 -0
- package/src/api/types/ormInterfaces.ts +310 -0
- package/src/api/utils/apiHelpers.ts +82 -0
- package/src/api/utils/cacheManager.ts +67 -0
- package/src/api/utils/determineRuntimeJsType.ts +46 -0
- package/src/api/utils/logger.ts +24 -0
- package/src/api/utils/sortAndSerializeQueryObject.ts +12 -0
- package/src/api/utils/testHelpers.ts +24 -0
- package/src/api/utils/toastNotifier.ts +11 -0
- package/src/index.ts +15 -2
- package/src/api/carbonSqlExecutor.ts +0 -279
- package/src/api/interfaces/ormInterfaces.ts +0 -87
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {C6Constants} from "api/C6Constants";
|
|
2
|
-
import {iC6RestfulModel} from "
|
|
3
|
-
import {iC6Object} from "api/restRequest";
|
|
2
|
+
import {iC6Object, iC6RestfulModel} from "./types/ormInterfaces";
|
|
4
3
|
|
|
5
4
|
|
|
6
5
|
export default function <RestTableInterfaces extends { [key:string] : any }>(restfulObject: RestTableInterfaces, tableName: string | string[], C6: iC6Object, regexErrorHandler: (message:string) => void = alert) {
|
|
@@ -9,7 +8,7 @@ export default function <RestTableInterfaces extends { [key:string] : any }>(res
|
|
|
9
8
|
|
|
10
9
|
const tableNames = Array.isArray(tableName) ? tableName : [tableName];
|
|
11
10
|
|
|
12
|
-
let tableDefinitions : (iC6RestfulModel & any)[] = [];
|
|
11
|
+
let tableDefinitions : (iC6RestfulModel<any, any, any> & any)[] = [];
|
|
13
12
|
|
|
14
13
|
tableNames.forEach((tableName) => {
|
|
15
14
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {apiReturn, iAPI, iRest} from "@carbonorm/carbonnode";
|
|
2
|
+
import {Modify} from "../types/modifyTypes";
|
|
3
|
+
|
|
4
|
+
export abstract class Executor<
|
|
5
|
+
RestShortTableName extends string = any,
|
|
6
|
+
RestTableInterface extends { [key: string]: any } = any,
|
|
7
|
+
PrimaryKey extends Extract<keyof RestTableInterface, string> = Extract<keyof RestTableInterface, string>,
|
|
8
|
+
CustomAndRequiredFields extends { [key: string]: any } = any,
|
|
9
|
+
RequestTableOverrides extends { [key: string]: any; } = { [key in keyof RestTableInterface]: any },
|
|
10
|
+
ResponseDataType = any
|
|
11
|
+
> {
|
|
12
|
+
|
|
13
|
+
public constructor(
|
|
14
|
+
protected config: iRest<
|
|
15
|
+
RestShortTableName,
|
|
16
|
+
RestTableInterface,
|
|
17
|
+
PrimaryKey,
|
|
18
|
+
CustomAndRequiredFields,
|
|
19
|
+
RequestTableOverrides,
|
|
20
|
+
ResponseDataType
|
|
21
|
+
>,
|
|
22
|
+
protected request: iAPI<Modify<RestTableInterface, RequestTableOverrides>> & CustomAndRequiredFields = {} as iAPI<Modify<RestTableInterface, RequestTableOverrides>> & CustomAndRequiredFields
|
|
23
|
+
) {
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
abstract execute(): Promise<apiReturn<ResponseDataType>>
|
|
27
|
+
|
|
28
|
+
}
|