@cap-ts/esi 1.8.8
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/LICENSE +28 -0
- package/README.md +37 -0
- package/dist/index.js +1 -0
- package/dist/lib/_classes/index.js +1 -0
- package/dist/lib/_config/index.js +1 -0
- package/dist/lib/_interface/appender/index.js +1 -0
- package/dist/lib/_interface/file/index.js +1 -0
- package/dist/lib/_interface/formatter/index.js +1 -0
- package/dist/lib/_interface/index.js +1 -0
- package/dist/lib/_interface/layout/index.js +1 -0
- package/dist/lib/_interface/log/index.js +1 -0
- package/dist/lib/_interface/path/index.js +1 -0
- package/dist/lib/connect/index.js +1 -0
- package/dist/lib/impl/index.js +1 -0
- package/dist/lib/log/index.js +1 -0
- package/dist/lib/query/index.js +1 -0
- package/dist/lib/service/index.js +1 -0
- package/dist/lib/utils/index.js +1 -0
- package/package.json +69 -0
- package/types/index.d.ts +27 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.md +73 -0
- package/types/lib/connect/index.d.ts +23 -0
- package/types/lib/connect/index.d.ts.map +1 -0
- package/types/lib/impl/index.d.ts +339 -0
- package/types/lib/impl/index.d.ts.map +1 -0
- package/types/lib/log/index.d.ts +18 -0
- package/types/lib/log/index.d.ts.map +1 -0
- package/types/lib/query/index.d.ts +42 -0
- package/types/lib/query/index.d.ts.map +1 -0
- package/types/lib/service/index.d.ts +111 -0
- package/types/lib/service/index.d.ts.map +1 -0
- package/types/lib/utils/index.d.ts +457 -0
- package/types/lib/utils/index.d.ts.map +1 -0
- package/types/lib/utils/index.md +474 -0
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
export type CDSService = {
|
|
2
|
+
/**
|
|
3
|
+
* - Collection of entities served by this service.
|
|
4
|
+
*/
|
|
5
|
+
entities: Record<string, any>;
|
|
6
|
+
/**
|
|
7
|
+
* - Executes a given query against the service.
|
|
8
|
+
*/
|
|
9
|
+
run: (query: any) => Promise<any>;
|
|
10
|
+
/**
|
|
11
|
+
* - Starts a new transaction.
|
|
12
|
+
*/
|
|
13
|
+
tx: (req: any) => CDSServiceTx;
|
|
14
|
+
/**
|
|
15
|
+
* - Alias for the tx method.
|
|
16
|
+
*/
|
|
17
|
+
transaction: (req: any) => CDSServiceTx;
|
|
18
|
+
/**
|
|
19
|
+
* - Registers a handler for specific events.
|
|
20
|
+
*/
|
|
21
|
+
on: CDSMethod;
|
|
22
|
+
/**
|
|
23
|
+
* - Registers a handler to run before the standard logic.
|
|
24
|
+
*/
|
|
25
|
+
before: CDSMethod;
|
|
26
|
+
/**
|
|
27
|
+
* - Registers a handler to run after the standard logic.
|
|
28
|
+
*/
|
|
29
|
+
after: CDSAfterMethod;
|
|
30
|
+
/**
|
|
31
|
+
* - Synchronously or asynchronously triggers an event.
|
|
32
|
+
*/
|
|
33
|
+
emit: (event: string, data?: any) => Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* - Sends a custom action or function call to the service.
|
|
36
|
+
*/
|
|
37
|
+
send: (action: string, params?: any) => Promise<any>;
|
|
38
|
+
/**
|
|
39
|
+
* - Deletes records matching the given criteria.
|
|
40
|
+
*/
|
|
41
|
+
delete: (entity: string, where: any) => Promise<number>;
|
|
42
|
+
/**
|
|
43
|
+
* - Registers a handler for read operation.
|
|
44
|
+
*/
|
|
45
|
+
read: (entity: string) => SelectBuilder;
|
|
46
|
+
};
|
|
47
|
+
export type CDSRequest<T> = {
|
|
48
|
+
/**
|
|
49
|
+
* - The request payload.
|
|
50
|
+
*/
|
|
51
|
+
data: T & {
|
|
52
|
+
params?: any;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* - Map of request headers.
|
|
56
|
+
*/
|
|
57
|
+
headers: Record<string, string>;
|
|
58
|
+
/**
|
|
59
|
+
* - Positional parameters from the URL.
|
|
60
|
+
*/
|
|
61
|
+
params: any[];
|
|
62
|
+
/**
|
|
63
|
+
* - The authenticated user information.
|
|
64
|
+
*/
|
|
65
|
+
user: CDSUser;
|
|
66
|
+
/**
|
|
67
|
+
* - The CQN (OData-like) query structure.
|
|
68
|
+
*/
|
|
69
|
+
query: any;
|
|
70
|
+
/**
|
|
71
|
+
* - Information about the target entity.
|
|
72
|
+
*/
|
|
73
|
+
target: CDSTarget;
|
|
74
|
+
/**
|
|
75
|
+
* - The name of the event (e.g., 'READ', 'UPDATE').
|
|
76
|
+
*/
|
|
77
|
+
event: string;
|
|
78
|
+
/**
|
|
79
|
+
* - The underlying HTTP request (if applicable).
|
|
80
|
+
*/
|
|
81
|
+
http?: {
|
|
82
|
+
req: {
|
|
83
|
+
headers: Record<string, string>;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* - Rejects the request with a specific status and message.
|
|
88
|
+
*/
|
|
89
|
+
reject: CDSReject;
|
|
90
|
+
/**
|
|
91
|
+
* - Adds an error to the request without necessarily stopping execution.
|
|
92
|
+
*/
|
|
93
|
+
error: CDSError;
|
|
94
|
+
/**
|
|
95
|
+
* - Adds a warning message to the response.
|
|
96
|
+
*/
|
|
97
|
+
warn: (opts: {
|
|
98
|
+
message: string;
|
|
99
|
+
}) => void;
|
|
100
|
+
/**
|
|
101
|
+
* - Adds an informational message to the response.
|
|
102
|
+
*/
|
|
103
|
+
info: (msg: string) => void;
|
|
104
|
+
/**
|
|
105
|
+
* - Collection of errors collected during processing.
|
|
106
|
+
*/
|
|
107
|
+
errors?: any[];
|
|
108
|
+
/**
|
|
109
|
+
* - esi runtime extension: logic to run before the 'on' phase.
|
|
110
|
+
*/
|
|
111
|
+
PreOn?: any;
|
|
112
|
+
/**
|
|
113
|
+
* - esi runtime extension: logic to run after the 'on' phase.
|
|
114
|
+
*/
|
|
115
|
+
PostOn?: any;
|
|
116
|
+
/**
|
|
117
|
+
* - esi runtime extension: pre-mashup processing.
|
|
118
|
+
*/
|
|
119
|
+
PreMeshUp?: any;
|
|
120
|
+
};
|
|
121
|
+
export type CDSUser = {
|
|
122
|
+
/**
|
|
123
|
+
* - The user's unique identifier.
|
|
124
|
+
*/
|
|
125
|
+
id: string;
|
|
126
|
+
/**
|
|
127
|
+
* - Custom user attributes.
|
|
128
|
+
*/
|
|
129
|
+
attr: Record<string, any>;
|
|
130
|
+
/**
|
|
131
|
+
* - Checks if the user has a specific role.
|
|
132
|
+
*/
|
|
133
|
+
is: (role: string) => boolean;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* Fluent query builder returned by srv.read().
|
|
137
|
+
*/
|
|
138
|
+
export type SelectBuilder = {
|
|
139
|
+
/**
|
|
140
|
+
* - Adds WHERE clause using query-by-example object.
|
|
141
|
+
*/
|
|
142
|
+
where: (where: any) => SelectBuilder;
|
|
143
|
+
/**
|
|
144
|
+
* - Executes query and returns array of results.
|
|
145
|
+
*/
|
|
146
|
+
exec?: () => Promise<any[]>;
|
|
147
|
+
/**
|
|
148
|
+
* - Executes query expecting single result.
|
|
149
|
+
*/
|
|
150
|
+
one: () => Promise<any>;
|
|
151
|
+
};
|
|
152
|
+
export type CDSTarget = {
|
|
153
|
+
/**
|
|
154
|
+
* - The absolute name of the target entity.
|
|
155
|
+
*/
|
|
156
|
+
name: string;
|
|
157
|
+
/**
|
|
158
|
+
* - Any projection (select list) applied to the entity.
|
|
159
|
+
*/
|
|
160
|
+
projection?: any;
|
|
161
|
+
};
|
|
162
|
+
export type CDSReject = (opts?: {
|
|
163
|
+
status?: number;
|
|
164
|
+
message?: string;
|
|
165
|
+
}) => void;
|
|
166
|
+
export type CDSError = (opts: {
|
|
167
|
+
status?: number;
|
|
168
|
+
message?: string;
|
|
169
|
+
code?: string;
|
|
170
|
+
target?: string;
|
|
171
|
+
args?: any[];
|
|
172
|
+
}) => void;
|
|
173
|
+
/**
|
|
174
|
+
* Handles 'on' and 'before' event registrations.
|
|
175
|
+
* Supports both signatures: (event, entities, handler) AND (event, handler).
|
|
176
|
+
*/
|
|
177
|
+
export type CDSMethod = (event: string | string[], entitiesOrHandler: any | CDSHandler, handler?: CDSHandler) => void;
|
|
178
|
+
/**
|
|
179
|
+
* Handles 'after' event registrations.
|
|
180
|
+
* Supports both signatures: (event, entities, handler) AND (event, handler).
|
|
181
|
+
*/
|
|
182
|
+
export type CDSAfterMethod = (event: string | string[], entitiesOrHandler: any | CDSAfterHandler, handler?: CDSAfterHandler) => void;
|
|
183
|
+
export type CDSHandler = (req: CDSRequest, next: () => Promise<any>) => any | Promise<any>;
|
|
184
|
+
export type CDSAfterHandler = (results: any, req: CDSRequest) => any | Promise<any>;
|
|
185
|
+
export type CDSServiceTx = CDSService;
|
|
186
|
+
export type ServiceEventsServiceInterceptor = (oService: CDSService) => Promise<void>;
|
|
187
|
+
export type ServiceEventsRequestInterceptor = (oRequest: CDSRequest) => Promise<any[]>;
|
|
188
|
+
export type Service = typeof import("../service").service;
|
|
189
|
+
export type ServiceEvents = Service["events"];
|
|
190
|
+
export type ServiceEventsKey = keyof ServiceEvents;
|
|
191
|
+
export type ServieEventsServiceHandler = Partial<Record<ServiceEventsKey, ServiceEventsServiceInterceptor>>;
|
|
192
|
+
export type ServieEventsRequestHandler = Partial<Record<ServiceEventsKey, ServiceEventsRequestInterceptor>>;
|
|
193
|
+
/**
|
|
194
|
+
* impl module
|
|
195
|
+
* @class
|
|
196
|
+
* @public
|
|
197
|
+
*/
|
|
198
|
+
/**
|
|
199
|
+
* @typedef {Object} CDSService
|
|
200
|
+
* @property {Record<string, any>} entities - Collection of entities served by this service.
|
|
201
|
+
* @property {(query: any) => Promise<any>} run - Executes a given query against the service.
|
|
202
|
+
* @property {(req: any) => CDSServiceTx} tx - Starts a new transaction.
|
|
203
|
+
* @property {(req: any) => CDSServiceTx} transaction - Alias for the tx method.
|
|
204
|
+
* @property {CDSMethod} on - Registers a handler for specific events.
|
|
205
|
+
* @property {CDSMethod} before - Registers a handler to run before the standard logic.
|
|
206
|
+
* @property {CDSAfterMethod} after - Registers a handler to run after the standard logic.
|
|
207
|
+
* @property {(event: string, data?: any) => Promise<void>} emit - Synchronously or asynchronously triggers an event.
|
|
208
|
+
* @property {(action: string, params?: any) => Promise<any>} send - Sends a custom action or function call to the service.
|
|
209
|
+
* @property {(entity: string, where: any) => Promise<number>} delete - Deletes records matching the given criteria.
|
|
210
|
+
* @property {(entity: string) => SelectBuilder} read - Registers a handler for read operation.
|
|
211
|
+
*/
|
|
212
|
+
/**
|
|
213
|
+
* @template T
|
|
214
|
+
* @typedef {Object} CDSRequest
|
|
215
|
+
* @property {T & { params?: any }} data - The request payload.
|
|
216
|
+
* @property {Record<string, string>} headers - Map of request headers.
|
|
217
|
+
* @property {any[]} params - Positional parameters from the URL.
|
|
218
|
+
* @property {CDSUser} user - The authenticated user information.
|
|
219
|
+
* @property {any} query - The CQN (OData-like) query structure.
|
|
220
|
+
* @property {CDSTarget} target - Information about the target entity.
|
|
221
|
+
* @property {string} event - The name of the event (e.g., 'READ', 'UPDATE').
|
|
222
|
+
* @property {{ req: { headers: Record<string, string> } }} [http] - The underlying HTTP request (if applicable).
|
|
223
|
+
* @property {CDSReject} reject - Rejects the request with a specific status and message.
|
|
224
|
+
* @property {CDSError} error - Adds an error to the request without necessarily stopping execution.
|
|
225
|
+
* @property {(opts: { message: string }) => void} warn - Adds a warning message to the response.
|
|
226
|
+
* @property {(msg: string) => void} info - Adds an informational message to the response.
|
|
227
|
+
* @property {any[]} [errors] - Collection of errors collected during processing.
|
|
228
|
+
* @property {any} [PreOn] - esi runtime extension: logic to run before the 'on' phase.
|
|
229
|
+
* @property {any} [PostOn] - esi runtime extension: logic to run after the 'on' phase.
|
|
230
|
+
* @property {any} [PreMeshUp] - esi runtime extension: pre-mashup processing.
|
|
231
|
+
*/
|
|
232
|
+
/**
|
|
233
|
+
* @typedef {Object} CDSUser
|
|
234
|
+
* @property {string} id - The user's unique identifier.
|
|
235
|
+
* @property {Record<string, any>} attr - Custom user attributes.
|
|
236
|
+
* @property {(role: string) => boolean} is - Checks if the user has a specific role.
|
|
237
|
+
*/
|
|
238
|
+
/**
|
|
239
|
+
* Fluent query builder returned by srv.read().
|
|
240
|
+
* @typedef {Object} SelectBuilder
|
|
241
|
+
* @property {(where: any) => SelectBuilder} where - Adds WHERE clause using query-by-example object.
|
|
242
|
+
* @property {() => Promise<any[]>} [exec] - Executes query and returns array of results.
|
|
243
|
+
* @property {() => Promise<any>} one - Executes query expecting single result.
|
|
244
|
+
*/
|
|
245
|
+
/**
|
|
246
|
+
* @typedef {Object} CDSTarget
|
|
247
|
+
* @property {string} name - The absolute name of the target entity.
|
|
248
|
+
* @property {any} [projection] - Any projection (select list) applied to the entity.
|
|
249
|
+
*/
|
|
250
|
+
/**
|
|
251
|
+
* @callback CDSReject
|
|
252
|
+
* @param {{ status?: number; message?: string }} [opts]
|
|
253
|
+
* @returns {void}
|
|
254
|
+
*/
|
|
255
|
+
/**
|
|
256
|
+
* @callback CDSError
|
|
257
|
+
* @param {{ status?: number; message?: string; code?: string; target?: string; args?: any[] }} opts
|
|
258
|
+
* @returns {void}
|
|
259
|
+
*/
|
|
260
|
+
/**
|
|
261
|
+
* Handles 'on' and 'before' event registrations.
|
|
262
|
+
* Supports both signatures: (event, entities, handler) AND (event, handler).
|
|
263
|
+
* @callback CDSMethod
|
|
264
|
+
* @param {string | string[]} event - The name of the event (e.g., 'READ', 'UPDATE').
|
|
265
|
+
* @param {any | CDSHandler} entitiesOrHandler - Either the target entity/entities or the handler function.
|
|
266
|
+
* @param {CDSHandler} [handler] - The handler function if an entity was provided as the second argument.
|
|
267
|
+
* @returns {void}
|
|
268
|
+
*/
|
|
269
|
+
/**
|
|
270
|
+
* Handles 'after' event registrations.
|
|
271
|
+
* Supports both signatures: (event, entities, handler) AND (event, handler).
|
|
272
|
+
* @callback CDSAfterMethod
|
|
273
|
+
* @param {string | string[]} event - The name of the event.
|
|
274
|
+
* @param {any | CDSAfterHandler} entitiesOrHandler - Either the target entity or the handler function.
|
|
275
|
+
* @param {CDSAfterHandler} [handler] - The handler function if an entity was provided.
|
|
276
|
+
* @returns {void}
|
|
277
|
+
*/
|
|
278
|
+
/**
|
|
279
|
+
* @callback CDSHandler
|
|
280
|
+
* @param {CDSRequest} req - The incoming request object.
|
|
281
|
+
* @param {() => Promise<any>} next - The function to call the next handler in the chain.
|
|
282
|
+
* @returns {any | Promise<any>}
|
|
283
|
+
*/
|
|
284
|
+
/**
|
|
285
|
+
* @callback CDSAfterHandler
|
|
286
|
+
* @param {any} results - The results from the primary execution.
|
|
287
|
+
* @param {CDSRequest} req - The incoming request object.
|
|
288
|
+
* @returns {any | Promise<any>}
|
|
289
|
+
*/
|
|
290
|
+
/**
|
|
291
|
+
* @typedef {CDSService} CDSServiceTx
|
|
292
|
+
*/
|
|
293
|
+
/**
|
|
294
|
+
* @callback ServiceEventsServiceInterceptor
|
|
295
|
+
* @param {CDSService} oService - Service object for which request to be executed
|
|
296
|
+
* @returns {Promise<void>}
|
|
297
|
+
*/
|
|
298
|
+
/**
|
|
299
|
+
* @callback ServiceEventsRequestInterceptor
|
|
300
|
+
* @param {CDSRequest} oRequest - Request object
|
|
301
|
+
* @returns {Promise<any[]>}
|
|
302
|
+
*/
|
|
303
|
+
/**
|
|
304
|
+
* @typedef {typeof import('../service').service} Service
|
|
305
|
+
* @typedef {Service['events']} ServiceEvents
|
|
306
|
+
* @typedef {keyof ServiceEvents} ServiceEventsKey
|
|
307
|
+
* @typedef {Partial<Record<ServiceEventsKey, ServiceEventsServiceInterceptor>>} ServieEventsServiceHandler
|
|
308
|
+
* @typedef {Partial<Record<ServiceEventsKey, ServiceEventsRequestInterceptor>>} ServieEventsRequestHandler
|
|
309
|
+
*/
|
|
310
|
+
export class impl {
|
|
311
|
+
/**
|
|
312
|
+
* @param {object} oService - Service object for which request to be executed
|
|
313
|
+
* @param {ServieEventsServiceHandler|ServieEventsRequestHandler} oEvent
|
|
314
|
+
* @returns {Promise<void>}
|
|
315
|
+
*/
|
|
316
|
+
static DBService(oService: object, oEvent: ServieEventsServiceHandler | ServieEventsRequestHandler): Promise<void>;
|
|
317
|
+
/**
|
|
318
|
+
* @param {object} oService - Service object for which request to be executed
|
|
319
|
+
* @param {string} sServiceName - Service Name
|
|
320
|
+
* @param {ServieEventsServiceHandler|ServieEventsRequestHandler} oEvent
|
|
321
|
+
* @param {string|any[]} oLocalEntities
|
|
322
|
+
* @param {ServieEventsServiceHandler|ServieEventsRequestHandler} oRemoteEvent
|
|
323
|
+
* @param {string|any[]} [oRemoteEntities]
|
|
324
|
+
* @param {any[]} [oRemoteHandlers]
|
|
325
|
+
* @param {boolean} bRefreshUserContext
|
|
326
|
+
* @returns {Promise<void>}
|
|
327
|
+
*/
|
|
328
|
+
static LocalService(oService: object, sServiceName: string, oEvent?: ServieEventsServiceHandler | ServieEventsRequestHandler, oLocalEntities?: string | any[], oRemoteEvent?: ServieEventsServiceHandler | ServieEventsRequestHandler, oRemoteEntities?: string | any[], oRemoteHandlers?: any[], bRefreshUserContext?: boolean): Promise<void>;
|
|
329
|
+
/**
|
|
330
|
+
* @param {object} oService - Service object for which request to be executed
|
|
331
|
+
* @param {ServieEventsServiceHandler|ServieEventsRequestHandler} oEvent
|
|
332
|
+
* @param {string|any[]} oEntities
|
|
333
|
+
* @param {any[]} [oHandlers]
|
|
334
|
+
* @param {boolean} bRefreshUserContext
|
|
335
|
+
* @returns {Promise<void>}
|
|
336
|
+
*/
|
|
337
|
+
static RemoteService(oService: object, oEvent?: ServieEventsServiceHandler | ServieEventsRequestHandler, oEntities?: string | any[], oHandlers?: any[], bRefreshUserContext?: boolean): Promise<void>;
|
|
338
|
+
}
|
|
339
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../.types/lib/impl/index.js"],"names":[],"mappings":";;;;cAuBc,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;;;;SACnB,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC;;;;QAC5B,CAAC,GAAG,EAAE,GAAG,KAAK,YAAY;;;;iBAC1B,CA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;AAEH;IACI;;;;OAIG;IACH,2BAJW,MAAM,UACN,0BAA0B,GAAC,0BAA0B,GACnD,OAAO,CAAC,IAAI,CAAC,CAMzB;IAED;;;;;;;;;;OAUG;IACH,8BAVW,MAAM,gBACN,MAAM,WACN,0BAA0B,GAAC,0BAA0B,mBACrD,MAAM,GAAC,GAAG,EAAE,iBACZ,0BAA0B,GAAC,0BAA0B,oBACrD,MAAM,GAAC,GAAG,EAAE,oBACZ,GAAG,EAAE,wBACL,OAAO,GACL,OAAO,CAAC,IAAI,CAAC,CA0BzB;IAED;;;;;;;OAOG;IACH,+BAPW,MAAM,WACN,0BAA0B,GAAC,0BAA0B,cACrD,MAAM,GAAC,GAAG,EAAE,cACZ,GAAG,EAAE,wBACL,OAAO,GACL,OAAO,CAAC,IAAI,CAAC,CA8EzB;CACJ"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare namespace _exports {
|
|
2
|
+
export { Service, ServiceEvents, ServiceEventsValue };
|
|
3
|
+
}
|
|
4
|
+
declare namespace _exports {
|
|
5
|
+
function log(sServiceName?: string | undefined): {
|
|
6
|
+
trace: (oEvent: ServiceEventsValue, oRequest: object, ...oArgs: any[]) => void;
|
|
7
|
+
debug: (oEvent: ServiceEventsValue, oRequest: object, ...oArgs: any[]) => void;
|
|
8
|
+
info: (oEvent: ServiceEventsValue, oRequest: object, ...oArgs: any[]) => void;
|
|
9
|
+
warn: (oEvent: ServiceEventsValue, oRequest: object, ...oArgs: any[]) => void;
|
|
10
|
+
error: (oEvent: ServiceEventsValue, oRequest: object, ...oArgs: any[]) => void;
|
|
11
|
+
fatal: (oEvent: ServiceEventsValue, oRequest: object, ...oArgs: any[]) => void;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export = _exports;
|
|
15
|
+
type Service = typeof import("../service").service;
|
|
16
|
+
type ServiceEvents = Service["events"];
|
|
17
|
+
type ServiceEventsValue = ServiceEvents[keyof ServiceEvents];
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../.types/lib/log/index.js"],"names":[],"mappings":";;;;IAaS,4BAAY,MAAM,GAAC,SAAS;wBAEe,kBAAkB,YAAuB,MAAM;wBAA/C,kBAAkB,YAAuB,MAAM;uBAA/C,kBAAkB,YAAuB,MAAM;uBAA/C,kBAAkB,YAAuB,MAAM;wBAA/C,kBAAkB,YAAuB,MAAM;wBAA/C,kBAAkB,YAAuB,MAAM;MAsB9F;;;eA9BQ,cAAc,YAAY,EAAE,OAAO;qBACnC,OAAO,CAAC,QAAQ,CAAC;0BACjB,aAAa,CAAC,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* - Request Object
|
|
3
|
+
*/
|
|
4
|
+
export type Request = any;
|
|
5
|
+
export namespace query {
|
|
6
|
+
namespace DELETE {
|
|
7
|
+
function getKeyPropertyValueByName(oRequest: Request, sPropertyName: string): any;
|
|
8
|
+
}
|
|
9
|
+
namespace SELECT {
|
|
10
|
+
namespace columns {
|
|
11
|
+
function get(oColumns: any): any;
|
|
12
|
+
function parse(oQueryString: any, oKeyFields: any): {
|
|
13
|
+
ref: any[];
|
|
14
|
+
}[];
|
|
15
|
+
function split(sQueryString: any): string[];
|
|
16
|
+
namespace _expand {
|
|
17
|
+
export function parse_1(sExpand: any): {
|
|
18
|
+
ref: any[];
|
|
19
|
+
};
|
|
20
|
+
export { parse_1 as parse };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
namespace from {
|
|
24
|
+
function fromable(oFrom: any, iIndex?: number): {
|
|
25
|
+
clause: any;
|
|
26
|
+
from: any;
|
|
27
|
+
where: any;
|
|
28
|
+
serviceName: any;
|
|
29
|
+
entityName: any;
|
|
30
|
+
Association: /*elided*/ any;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
namespace where {
|
|
34
|
+
function _toANDArray(oWhereClause: any, bAlwwaysArray?: boolean): any[];
|
|
35
|
+
function toANDArray(oWhereClause: any, bAlwwaysArray?: boolean): any[];
|
|
36
|
+
function convert(oIDWhere: object, oIDColumns: object, fConvertLogic?: Function): any[];
|
|
37
|
+
function add(oRequest: Request, oWhereClause: any[]): void;
|
|
38
|
+
function apply(oData: any, oWhereClause: any): any;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../.types/lib/query/index.js"],"names":[],"mappings":";;;;;;QAWmC,6CAAY,OAAO,iBAAyB,MAAM,OAI5E;;;;YAIQ,iCAWJ;YACM;;gBA0BN;YACM,4CAuBN;;gBAEU;;kBAkCN;;;;;YAIK;;;;;;;cA2BT;;;YAGY,wEAkCZ;YACW,uEASX;YACQ,2BAAqB,MAAM,cAAyB,MAAM,mCAWlE;YACI,uBAAY,OAAO,gBAAyB,GAAG,EAAE,QASrD;YACM,mDA+CN"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* service module
|
|
3
|
+
* @class
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
6
|
+
export class service {
|
|
7
|
+
/** All Service Events
|
|
8
|
+
* @public
|
|
9
|
+
* @static
|
|
10
|
+
* @enum {string} */
|
|
11
|
+
public static events: Readonly<{
|
|
12
|
+
PreBefore: "PreBefore";
|
|
13
|
+
PostBefore: "PostBefore";
|
|
14
|
+
PreOn: "PreOn";
|
|
15
|
+
PreMeshUp: "PreMeshUp";
|
|
16
|
+
PostOn: "PostOn";
|
|
17
|
+
PreAfter: "PreAfter";
|
|
18
|
+
PostAfter: "PostAfter";
|
|
19
|
+
None: "";
|
|
20
|
+
}>;
|
|
21
|
+
/** This function enriches the user context with configured user function
|
|
22
|
+
* @param {object} oRequest - Request Object
|
|
23
|
+
*/
|
|
24
|
+
static enrichUserContext(oRequest: object): Promise<void>;
|
|
25
|
+
static sanitizeData(oData: any, oFieldsArray: any, includeID?: boolean): any;
|
|
26
|
+
static get(oRequest: any): any;
|
|
27
|
+
/**
|
|
28
|
+
* @param {object} oService - Service object for which request to be executed
|
|
29
|
+
* @param {object} oRequest - Request Object
|
|
30
|
+
* @returns {string[]}
|
|
31
|
+
*/
|
|
32
|
+
static getEntityColumns(oService: object, oRequest: object): string[];
|
|
33
|
+
/**
|
|
34
|
+
* @param {object} oService - Service object for which request to be executed
|
|
35
|
+
* @param {object} oRequest - Request Object
|
|
36
|
+
* @param {object} oQuery - Query to be send
|
|
37
|
+
*/
|
|
38
|
+
static sendQuery(oService: object, oRequest: object, oQuery?: object): Promise<any>;
|
|
39
|
+
/**
|
|
40
|
+
* @param {object} oService - Service object for which request to be executed
|
|
41
|
+
* @param {object} oRequest - Request Object
|
|
42
|
+
*/
|
|
43
|
+
static sendRequest(oService: object, oRequest: object): Promise<any>;
|
|
44
|
+
/**
|
|
45
|
+
* @param {object} oService - Service object for which request to be executed
|
|
46
|
+
* @param {object} oRequest - Request Object
|
|
47
|
+
*/
|
|
48
|
+
static executeRequest(oService: object, oRequest: object): Promise<any>;
|
|
49
|
+
/**
|
|
50
|
+
* @param {object} oRequest - Request Object
|
|
51
|
+
* @param {object} oJsonData - JSON Data
|
|
52
|
+
* @param {(error: Error) => Promise<void>} [onError] - Optional async error handler. Defaults to an empty async function.
|
|
53
|
+
*/
|
|
54
|
+
static executeIflow(oRequest: object, oJsonData: object, onError?: (error: Error) => Promise<void>): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* @param {object} oService - Service Object
|
|
57
|
+
* @param {object} oRequest - Request Object
|
|
58
|
+
*/
|
|
59
|
+
static handleReadByID(oService: object, oRequest: object, oID: any): Promise<any>;
|
|
60
|
+
/**
|
|
61
|
+
* @param {object} oService - Service Object
|
|
62
|
+
* @param {object} oRequest - Request Object
|
|
63
|
+
*/
|
|
64
|
+
static handleDeleteByID(oService: object, oRequest: object, oID: any): Promise<any>;
|
|
65
|
+
/**
|
|
66
|
+
* @param {object} oService - Service Object
|
|
67
|
+
* @param {object} oRequest - Request Object
|
|
68
|
+
* @param {function} fEventHandler - function to be called before Event for data handling
|
|
69
|
+
*/
|
|
70
|
+
static handleEvent(oService: object, oRequest: object, fEventHandler?: Function): Promise<any>;
|
|
71
|
+
/**
|
|
72
|
+
* @param {object} oService - Service Object
|
|
73
|
+
* @param {object} oRequest - Request Object
|
|
74
|
+
* @param {function} fPreInsert - function to be called before insert
|
|
75
|
+
*/
|
|
76
|
+
static handleCreate(oService: object, oRequest: object, fPreInsert?: Function): Promise<any>;
|
|
77
|
+
/**
|
|
78
|
+
* @param {object} oService - Service Object
|
|
79
|
+
* @param {object} oRequest - Request Object
|
|
80
|
+
* @param {function} fPreInsert - function to be called before insert
|
|
81
|
+
*/
|
|
82
|
+
static handleInsert(oService: object, oRequest: object, fPreInsert?: Function): Promise<any>;
|
|
83
|
+
/**
|
|
84
|
+
* @param {object} oService - Service Object
|
|
85
|
+
* @param {object} oRequest - Request Object
|
|
86
|
+
* @param {function} fPreUpdate - function to be called before Update
|
|
87
|
+
*/
|
|
88
|
+
static handleUpdate(oService: object, oRequest: object, fPreUpdate: Function, oWhere: any, isOldDataRequired?: boolean): Promise<any>;
|
|
89
|
+
/**
|
|
90
|
+
* @param {object} oData - Data Result
|
|
91
|
+
* @param {object} oRequest - Request Object
|
|
92
|
+
*/
|
|
93
|
+
static handleCount(oData: object, oRequest: object): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* @param {object} oService - Service Object
|
|
96
|
+
* @param {object} oRequest - Request Object
|
|
97
|
+
*/
|
|
98
|
+
static handlePostOn(oService: object, oRequest: object): Promise<any[]>;
|
|
99
|
+
/**
|
|
100
|
+
* @param {object} oService - Service Object
|
|
101
|
+
* @param {object} oRequest - Request Object
|
|
102
|
+
*/
|
|
103
|
+
static handleHandler(oService: object, oRequest: object): Promise<any>;
|
|
104
|
+
/**
|
|
105
|
+
* @param {object} oService - Service Object
|
|
106
|
+
* @param {object} oRequest - Request Object
|
|
107
|
+
* @param {function} fNextHandler - Alternate handler method
|
|
108
|
+
*/
|
|
109
|
+
static handleRead(oService: object, oRequest: object, fNextHandler: Function): Promise<any>;
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../.types/lib/service/index.js"],"names":[],"mappings":"AAsxBA;;;;GAIG;AACH;IAEI;;;wBAGoB;IACpB;;;;;;;;;OASG;IAEH;;OAEG;IACH,mCAFW,MAAM,iBAsBhB;IAED,6EAaC;IAED,+BAEC;IAED;;;;OAIG;IACH,kCAJW,MAAM,YACN,MAAM,GACJ,MAAM,EAAE,CAWpB;IAED;;;;OAIG;IACH,2BAJW,MAAM,YACN,MAAM,WACN,MAAM,gBAgBhB;IAED;;;OAGG;IACH,6BAHW,MAAM,YACN,MAAM,gBAYhB;IAED;;;OAGG;IACH,gCAHW,MAAM,YACN,MAAM,gBAchB;IAED;;;;OAIG;IACH,8BAJW,MAAM,aACN,MAAM,YACN,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,IAAI,CAAC,iBAqDzC;IAED;;;OAGG;IACH,gCAHW,MAAM,YACN,MAAM,0BAOhB;IAED;;;OAGG;IACH,kCAHW,MAAM,YACN,MAAM,0BAOhB;IAED;;;;OAIG;IACH,6BAJW,MAAM,YACN,MAAM,0CAiBhB;IAED;;;;OAIG;IACH,8BAJW,MAAM,YACN,MAAM,uCAQhB;IAED;;;;OAIG;IACH,8BAJW,MAAM,YACN,MAAM,uCAQhB;IAED;;;;OAIG;IACH,8BAJW,MAAM,YACN,MAAM,gFAgBhB;IAED;;;OAGG;IACH,0BAHW,MAAM,YACN,MAAM,iBAQhB;IAED;;;OAGG;IACH,8BAHW,MAAM,YACN,MAAM,kBAiChB;IAED;;;OAGG;IACH,+BAHW,MAAM,YACN,MAAM,gBAmChB;IAED;;;;OAIG;IACH,4BAJW,MAAM,YACN,MAAM,wCAQhB;CACJ"}
|