esi-cap 1.7.39 → 1.7.41
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/index.js +1 -1
- package/dist/lib/_classes/index.js +1 -1
- package/dist/lib/_config/index.js +1 -1
- package/dist/lib/_interface/appender/index.js +1 -1
- package/dist/lib/_interface/file/index.js +1 -1
- package/dist/lib/_interface/formatter/index.js +1 -1
- package/dist/lib/_interface/index.js +1 -1
- package/dist/lib/_interface/layout/index.js +1 -1
- package/dist/lib/_interface/log/index.js +1 -1
- package/dist/lib/_interface/path/index.js +1 -1
- package/dist/lib/connect/index.js +1 -1
- package/dist/lib/impl/index.js +1 -1
- package/dist/lib/log/index.js +1 -1
- package/dist/lib/query/index.js +1 -1
- package/dist/lib/service/index.js +1 -1
- package/dist/lib/utils/index.js +1 -1
- package/package.json +1 -1
- package/types/lib/impl/index.d.ts +103 -2
- package/types/lib/impl/index.d.ts.map +1 -1
|
@@ -1,4 +1,59 @@
|
|
|
1
|
-
export type
|
|
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
|
+
/**
|
|
44
|
+
* Handles 'on' and 'before' event registrations.
|
|
45
|
+
* Supports both signatures: (event, entities, handler) AND (event, handler).
|
|
46
|
+
*/
|
|
47
|
+
export type CDSMethod = (event: string | string[], entitiesOrHandler: any | CDSHandler, handler?: CDSHandler) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Handles 'after' event registrations.
|
|
50
|
+
* Supports both signatures: (event, entities, handler) AND (event, handler).
|
|
51
|
+
*/
|
|
52
|
+
export type CDSAfterMethod = (event: string | string[], entitiesOrHandler: any | CDSAfterHandler, handler?: CDSAfterHandler) => void;
|
|
53
|
+
export type CDSHandler = (req: any, next: () => Promise<any>) => any | Promise<any>;
|
|
54
|
+
export type CDSAfterHandler = (results: any, req: any) => any | Promise<any>;
|
|
55
|
+
export type CDSServiceTx = CDSService;
|
|
56
|
+
export type ServiceEventInterceptor = (oService: CDSService) => Promise<void>;
|
|
2
57
|
export type Service = typeof import("../service").service;
|
|
3
58
|
export type ServiceEvents = Service["events"];
|
|
4
59
|
export type ServiceEventsKey = keyof ServiceEvents;
|
|
@@ -8,9 +63,55 @@ export type ServieEventsHandler = Partial<Record<ServiceEventsKey, ServiceEventI
|
|
|
8
63
|
* @class
|
|
9
64
|
* @public
|
|
10
65
|
*/
|
|
66
|
+
/**
|
|
67
|
+
* @typedef {Object} CDSService
|
|
68
|
+
* @property {Record<string, any>} entities - Collection of entities served by this service.
|
|
69
|
+
* @property {(query: any) => Promise<any>} run - Executes a given query against the service.
|
|
70
|
+
* @property {(req: any) => CDSServiceTx} tx - Starts a new transaction.
|
|
71
|
+
* @property {(req: any) => CDSServiceTx} transaction - Alias for the tx method.
|
|
72
|
+
* @property {CDSMethod} on - Registers a handler for specific events.
|
|
73
|
+
* @property {CDSMethod} before - Registers a handler to run before the standard logic.
|
|
74
|
+
* @property {CDSAfterMethod} after - Registers a handler to run after the standard logic.
|
|
75
|
+
* @property {(event: string, data?: any) => Promise<void>} emit - Synchronously or asynchronously triggers an event.
|
|
76
|
+
* @property {(action: string, params?: any) => Promise<any>} send - Sends a custom action or function call to the service.
|
|
77
|
+
* @property {(entity: string, where: any) => Promise<number>} delete - Deletes records matching the given criteria.
|
|
78
|
+
*/
|
|
79
|
+
/**
|
|
80
|
+
* Handles 'on' and 'before' event registrations.
|
|
81
|
+
* Supports both signatures: (event, entities, handler) AND (event, handler).
|
|
82
|
+
* @callback CDSMethod
|
|
83
|
+
* @param {string | string[]} event - The name of the event (e.g., 'READ', 'UPDATE').
|
|
84
|
+
* @param {any | CDSHandler} entitiesOrHandler - Either the target entity/entities or the handler function.
|
|
85
|
+
* @param {CDSHandler} [handler] - The handler function if an entity was provided as the second argument.
|
|
86
|
+
* @returns {void}
|
|
87
|
+
*/
|
|
88
|
+
/**
|
|
89
|
+
* Handles 'after' event registrations.
|
|
90
|
+
* Supports both signatures: (event, entities, handler) AND (event, handler).
|
|
91
|
+
* @callback CDSAfterMethod
|
|
92
|
+
* @param {string | string[]} event - The name of the event.
|
|
93
|
+
* @param {any | CDSAfterHandler} entitiesOrHandler - Either the target entity or the handler function.
|
|
94
|
+
* @param {CDSAfterHandler} [handler] - The handler function if an entity was provided.
|
|
95
|
+
* @returns {void}
|
|
96
|
+
*/
|
|
97
|
+
/**
|
|
98
|
+
* @callback CDSHandler
|
|
99
|
+
* @param {any} req - The incoming request object.
|
|
100
|
+
* @param {() => Promise<any>} next - The function to call the next handler in the chain.
|
|
101
|
+
* @returns {any | Promise<any>}
|
|
102
|
+
*/
|
|
103
|
+
/**
|
|
104
|
+
* @callback CDSAfterHandler
|
|
105
|
+
* @param {any} results - The results from the primary execution.
|
|
106
|
+
* @param {any} req - The incoming request object.
|
|
107
|
+
* @returns {any | Promise<any>}
|
|
108
|
+
*/
|
|
109
|
+
/**
|
|
110
|
+
* @typedef {CDSService} CDSServiceTx
|
|
111
|
+
*/
|
|
11
112
|
/**
|
|
12
113
|
* @callback ServiceEventInterceptor
|
|
13
|
-
* @param {
|
|
114
|
+
* @param {CDSService} oService - Service object for which request to be executed
|
|
14
115
|
* @returns {Promise<void>}
|
|
15
116
|
*/
|
|
16
117
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../.types/lib/impl/index.js"],"names":[],"mappings":"
|
|
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,CAAC,GAAG,EAAE,GAAG,KAAK,YAAY;;;;QAC1B,SAAS;;;;YACT,SAAS;;;;WACT,cAAc;;;;UACd,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC;;;;UAC5C,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC;;;;YAC9C,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,MAAM,CAAC;;;;;;gCAOlD,MAAM,GAAG,MAAM,EAAE,qBACjB,GAAG,GAAG,U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