@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.
Files changed (47) hide show
  1. package/dist/api/builders/sqlBuilder.d.ts +3 -0
  2. package/dist/api/convertForRequestBody.d.ts +1 -1
  3. package/dist/api/executors/Executor.d.ts +16 -0
  4. package/dist/api/executors/HttpExecutor.d.ts +13 -0
  5. package/dist/api/executors/SqlExecutor.d.ts +19 -0
  6. package/dist/api/restRequest.d.ts +9 -166
  7. package/dist/api/types/dynamicFetching.d.ts +10 -0
  8. package/dist/api/types/modifyTypes.d.ts +9 -0
  9. package/dist/api/types/mysqlTypes.d.ts +4 -0
  10. package/dist/api/types/ormInterfaces.d.ts +219 -0
  11. package/dist/api/utils/apiHelpers.d.ts +9 -0
  12. package/dist/api/utils/cacheManager.d.ts +10 -0
  13. package/dist/api/utils/determineRuntimeJsType.d.ts +5 -0
  14. package/dist/api/utils/logger.d.ts +7 -0
  15. package/dist/api/utils/sortAndSerializeQueryObject.d.ts +1 -0
  16. package/dist/api/utils/testHelpers.d.ts +1 -0
  17. package/dist/api/utils/toastNotifier.d.ts +2 -0
  18. package/dist/index.cjs.js +665 -614
  19. package/dist/index.cjs.js.map +1 -1
  20. package/dist/index.d.ts +15 -2
  21. package/dist/index.esm.js +655 -618
  22. package/dist/index.esm.js.map +1 -1
  23. package/package.json +22 -6
  24. package/scripts/assets/handlebars/C6.ts.handlebars +13 -5
  25. package/scripts/assets/handlebars/Table.ts.handlebars +44 -12
  26. package/scripts/generateRestBindings.cjs +1 -1
  27. package/scripts/generateRestBindings.ts +1 -1
  28. package/src/api/builders/sqlBuilder.ts +173 -0
  29. package/src/api/convertForRequestBody.ts +2 -3
  30. package/src/api/executors/Executor.ts +28 -0
  31. package/src/api/executors/HttpExecutor.ts +794 -0
  32. package/src/api/executors/SqlExecutor.ts +104 -0
  33. package/src/api/restRequest.ts +50 -1287
  34. package/src/api/types/dynamicFetching.ts +10 -0
  35. package/src/api/types/modifyTypes.ts +25 -0
  36. package/src/api/types/mysqlTypes.ts +33 -0
  37. package/src/api/types/ormInterfaces.ts +310 -0
  38. package/src/api/utils/apiHelpers.ts +82 -0
  39. package/src/api/utils/cacheManager.ts +67 -0
  40. package/src/api/utils/determineRuntimeJsType.ts +46 -0
  41. package/src/api/utils/logger.ts +24 -0
  42. package/src/api/utils/sortAndSerializeQueryObject.ts +12 -0
  43. package/src/api/utils/testHelpers.ts +24 -0
  44. package/src/api/utils/toastNotifier.ts +11 -0
  45. package/src/index.ts +15 -2
  46. package/src/api/carbonSqlExecutor.ts +0 -279
  47. package/src/api/interfaces/ormInterfaces.ts +0 -87
@@ -1,6 +1,5 @@
1
1
  import {C6Constants} from "api/C6Constants";
2
- import {iC6RestfulModel} from "api/interfaces/ormInterfaces";
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
+ }