@carbonorm/carbonnode 3.11.0 → 4.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.
@@ -25,6 +25,11 @@ export declare abstract class ConditionBuilder<G extends OrmGenerics> extends Ag
25
25
  private normalizeFunctionField;
26
26
  private buildFunctionCall;
27
27
  private serializeOperand;
28
+ private isPlainArrayLiteral;
29
+ private isPlainObjectLiteral;
30
+ private resolveColumnDefinition;
31
+ private isJsonColumn;
32
+ protected serializeUpdateValue(value: any, params: any[] | Record<string, any>, contextColumn?: string): string;
28
33
  private ensurePlainObject;
29
34
  private resolveExistsInnerColumn;
30
35
  private normalizeExistsSpec;
@@ -4,6 +4,6 @@ export declare class PostQueryBuilder<G extends OrmGenerics> extends ConditionBu
4
4
  private trimTablePrefix;
5
5
  build(table: string): {
6
6
  sql: string;
7
- params: any[];
7
+ params: any[] | Record<string, any>;
8
8
  };
9
9
  }
@@ -4,9 +4,9 @@ type WithMethod<G extends Omit<OrmGenerics, "RequestMethod">, M extends iRestMet
4
4
  RequestMethod: M;
5
5
  };
6
6
  export declare function restOrm<G extends Omit<OrmGenerics, "RequestMethod">>(configFn: () => Omit<iRest<G['RestShortTableName'], G['RestTableInterface'], G['PrimaryKey']>, "requestMethod">): {
7
- Get: (request: import("./types/ormInterfaces").RequestQueryBody<WithMethod<G, "GET">["RequestMethod"], WithMethod<G, "GET">["RestTableInterface"], WithMethod<G, "GET">["CustomAndRequiredFields"], WithMethod<G, "GET">["RequestTableOverrides"]>) => Promise<import("./types/ormInterfaces").DetermineResponseDataType<WithMethod<G, "GET">["RequestMethod"], WithMethod<G, "GET">["RestTableInterface"]>>;
8
- Put: (request: import("./types/ormInterfaces").RequestQueryBody<WithMethod<G, "PUT">["RequestMethod"], WithMethod<G, "PUT">["RestTableInterface"], WithMethod<G, "PUT">["CustomAndRequiredFields"], WithMethod<G, "PUT">["RequestTableOverrides"]>) => Promise<import("./types/ormInterfaces").DetermineResponseDataType<WithMethod<G, "PUT">["RequestMethod"], WithMethod<G, "PUT">["RestTableInterface"]>>;
9
- Post: (request: import("./types/ormInterfaces").RequestQueryBody<WithMethod<G, "POST">["RequestMethod"], WithMethod<G, "POST">["RestTableInterface"], WithMethod<G, "POST">["CustomAndRequiredFields"], WithMethod<G, "POST">["RequestTableOverrides"]>) => Promise<import("./types/ormInterfaces").DetermineResponseDataType<WithMethod<G, "POST">["RequestMethod"], WithMethod<G, "POST">["RestTableInterface"]>>;
10
- Delete: (request: import("./types/ormInterfaces").RequestQueryBody<WithMethod<G, "DELETE">["RequestMethod"], WithMethod<G, "DELETE">["RestTableInterface"], WithMethod<G, "DELETE">["CustomAndRequiredFields"], WithMethod<G, "DELETE">["RequestTableOverrides"]>) => Promise<import("./types/ormInterfaces").DetermineResponseDataType<WithMethod<G, "DELETE">["RequestMethod"], WithMethod<G, "DELETE">["RestTableInterface"]>>;
7
+ Get: (request: import("./types/ormInterfaces").RequestQueryBody<WithMethod<G, "GET">["RequestMethod"], WithMethod<G, "GET">["RestTableInterface"], WithMethod<G, "GET">["CustomAndRequiredFields"], WithMethod<G, "GET">["RequestTableOverrides"]>) => Promise<import("./types/ormInterfaces").DetermineResponseDataType<WithMethod<G, "GET">["RequestMethod"], WithMethod<G, "GET">["RestTableInterface"], {}>>;
8
+ Put: (request: import("./types/ormInterfaces").RequestQueryBody<WithMethod<G, "PUT">["RequestMethod"], WithMethod<G, "PUT">["RestTableInterface"], WithMethod<G, "PUT">["CustomAndRequiredFields"], WithMethod<G, "PUT">["RequestTableOverrides"]>) => Promise<import("./types/ormInterfaces").DetermineResponseDataType<WithMethod<G, "PUT">["RequestMethod"], WithMethod<G, "PUT">["RestTableInterface"], {}>>;
9
+ Post: (request: import("./types/ormInterfaces").RequestQueryBody<WithMethod<G, "POST">["RequestMethod"], WithMethod<G, "POST">["RestTableInterface"], WithMethod<G, "POST">["CustomAndRequiredFields"], WithMethod<G, "POST">["RequestTableOverrides"]>) => Promise<import("./types/ormInterfaces").DetermineResponseDataType<WithMethod<G, "POST">["RequestMethod"], WithMethod<G, "POST">["RestTableInterface"], {}>>;
10
+ Delete: (request: import("./types/ormInterfaces").RequestQueryBody<WithMethod<G, "DELETE">["RequestMethod"], WithMethod<G, "DELETE">["RestTableInterface"], WithMethod<G, "DELETE">["CustomAndRequiredFields"], WithMethod<G, "DELETE">["RequestTableOverrides"]>) => Promise<import("./types/ormInterfaces").DetermineResponseDataType<WithMethod<G, "DELETE">["RequestMethod"], WithMethod<G, "DELETE">["RestTableInterface"], {}>>;
11
11
  };
12
12
  export {};
@@ -87,34 +87,54 @@ export type RequestQueryBody<Method extends iRestMethods, T extends {
87
87
  export interface iCacheAPI<ResponseDataType = any> {
88
88
  requestArgumentsSerialized: string;
89
89
  request: AxiosPromise<ResponseDataType>;
90
- response?: AxiosResponse;
90
+ response?: AxiosResponse & {
91
+ __carbonTiming?: {
92
+ start: number;
93
+ end: number;
94
+ duration: number;
95
+ };
96
+ };
91
97
  final?: boolean;
92
98
  }
93
99
  export interface iChangeC6Data {
94
100
  rowCount: number;
95
101
  }
96
- export interface iDeleteC6RestResponse<RestData = any, RequestData = any> extends iChangeC6Data, iC6RestResponse<RestData> {
102
+ export type C6RestResponse<Method extends iRestMethods, RestData extends {
103
+ [key: string]: any;
104
+ }, Overrides = {}> = {
105
+ rest: Method extends 'GET' ? Modify<RestData, Overrides>[] : Modify<RestData, Overrides>;
106
+ session?: any;
107
+ sql?: any;
108
+ } & (Method extends 'GET' ? {
109
+ next?: () => Promise<DetermineResponseDataType<'GET', RestData, Overrides>>;
110
+ } : {});
111
+ export interface iC6RestResponse<RestData> {
112
+ rest: RestData;
113
+ session?: any;
114
+ sql?: any;
115
+ }
116
+ export interface iDeleteC6RestResponse<RestData extends {
117
+ [key: string]: any;
118
+ }, RequestData = any> extends iChangeC6Data, C6RestResponse<'DELETE', RestData> {
97
119
  deleted: boolean | number | string | RequestData;
98
120
  }
99
- export interface iPostC6RestResponse<RestData = any> extends iC6RestResponse<RestData> {
121
+ export interface iPostC6RestResponse<RestData extends {
122
+ [key: string]: any;
123
+ }> extends C6RestResponse<'POST', RestData> {
100
124
  created: boolean | number | string;
101
125
  }
102
- export interface iPutC6RestResponse<RestData = any, RequestData = any> extends iChangeC6Data, iC6RestResponse<RestData> {
126
+ export interface iPutC6RestResponse<RestData extends {
127
+ [key: string]: any;
128
+ }, RequestData = any> extends iChangeC6Data, C6RestResponse<'PUT', RestData> {
103
129
  updated: boolean | number | string | RequestData;
104
130
  }
105
- export interface iC6RestResponse<RestData> {
106
- rest: RestData;
107
- session?: any;
108
- sql?: any;
109
- }
110
131
  export interface iGetC6RestResponse<ResponseDataType extends {
111
132
  [key: string]: any;
112
- }, ResponseDataOverrides = {}> extends iC6RestResponse<Modify<ResponseDataType, ResponseDataOverrides>[]> {
113
- next?: () => Promise<DetermineResponseDataType<"GET", ResponseDataType, ResponseDataOverrides>>;
133
+ }, ResponseDataOverrides = {}> extends C6RestResponse<'GET', ResponseDataType, ResponseDataOverrides> {
114
134
  }
115
135
  export type DetermineResponseDataType<Method extends iRestMethods, RestTableInterface extends {
116
136
  [key: string]: any;
117
- }, ResponseDataOverrides = {}> = null | (Method extends 'POST' ? iPostC6RestResponse<RestTableInterface> : Method extends 'GET' ? iGetC6RestResponse<RestTableInterface, ResponseDataOverrides> : Method extends 'PUT' ? iPutC6RestResponse<RestTableInterface> : Method extends 'DELETE' ? iDeleteC6RestResponse<RestTableInterface> : never);
137
+ }, ResponseDataOverrides = {}> = (Method extends 'POST' ? iPostC6RestResponse<RestTableInterface> : Method extends 'GET' ? iGetC6RestResponse<RestTableInterface, ResponseDataOverrides> : Method extends 'PUT' ? iPutC6RestResponse<RestTableInterface> : Method extends 'DELETE' ? iDeleteC6RestResponse<RestTableInterface> : never);
118
138
  export interface iRest<RestShortTableName extends string = any, RestTableInterface extends Record<string, any> = any, PrimaryKey extends keyof RestTableInterface & string = keyof RestTableInterface & string> {
119
139
  C6: iC6Object;
120
140
  axios?: AxiosInstance;
@@ -1,10 +1,9 @@
1
1
  import { AxiosPromise } from "axios";
2
2
  import { iCacheAPI } from "../types/ormInterfaces";
3
- export declare let apiRequestCache: iCacheAPI[];
4
- export declare let userCustomClearCache: (() => void)[];
5
- interface iClearCache {
6
- ignoreWarning: boolean;
7
- }
8
- export declare function clearCache(props?: iClearCache): void;
9
- export declare function checkCache<ResponseDataType = any, RestShortTableNames = string>(cacheResult: iCacheAPI<ResponseDataType>, requestMethod: string, tableName: RestShortTableNames | RestShortTableNames[], request: any): false | AxiosPromise<ResponseDataType>;
10
- export {};
3
+ export declare const apiRequestCache: Map<string, iCacheAPI<any>>;
4
+ export declare const userCustomClearCache: (() => void)[];
5
+ export declare function clearCache(props?: {
6
+ ignoreWarning?: boolean;
7
+ }): void;
8
+ export declare function checkCache<ResponseDataType = any>(method: string, tableName: string | string[], requestData: any): AxiosPromise<ResponseDataType> | false;
9
+ export declare function setCache<ResponseDataType = any>(method: string, tableName: string | string[], requestData: any, cacheEntry: iCacheAPI<ResponseDataType>): void;