@judo/actions 0.1.0
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 +277 -0
- package/README.md +257 -0
- package/dist/api/constants.d.ts +27 -0
- package/dist/api/constants.d.ts.map +1 -0
- package/dist/api/index.d.ts +9 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/judo-rest-api.d.ts +262 -0
- package/dist/api/judo-rest-api.d.ts.map +1 -0
- package/dist/api/model-converters.d.ts +29 -0
- package/dist/api/model-converters.d.ts.map +1 -0
- package/dist/api/path-builder.d.ts +50 -0
- package/dist/api/path-builder.d.ts.map +1 -0
- package/dist/api/transfer-deserializer.d.ts +46 -0
- package/dist/api/transfer-deserializer.d.ts.map +1 -0
- package/dist/api/transfer-serializer.d.ts +85 -0
- package/dist/api/transfer-serializer.d.ts.map +1 -0
- package/dist/api/types.d.ts +278 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/handlers/autocomplete/autocomplete-handlers.d.ts +20 -0
- package/dist/handlers/autocomplete/autocomplete-handlers.d.ts.map +1 -0
- package/dist/handlers/autocomplete/index.d.ts +2 -0
- package/dist/handlers/autocomplete/index.d.ts.map +1 -0
- package/dist/handlers/crud/crud-handlers.d.ts +76 -0
- package/dist/handlers/crud/crud-handlers.d.ts.map +1 -0
- package/dist/handlers/crud/index.d.ts +2 -0
- package/dist/handlers/crud/index.d.ts.map +1 -0
- package/dist/handlers/form/form-handlers.d.ts +28 -0
- package/dist/handlers/form/form-handlers.d.ts.map +1 -0
- package/dist/handlers/form/index.d.ts +2 -0
- package/dist/handlers/form/index.d.ts.map +1 -0
- package/dist/handlers/index.d.ts +10 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/navigation/index.d.ts +2 -0
- package/dist/handlers/navigation/index.d.ts.map +1 -0
- package/dist/handlers/navigation/navigation-handlers.d.ts +23 -0
- package/dist/handlers/navigation/navigation-handlers.d.ts.map +1 -0
- package/dist/handlers/operation/index.d.ts +2 -0
- package/dist/handlers/operation/index.d.ts.map +1 -0
- package/dist/handlers/operation/operation-handlers.d.ts +43 -0
- package/dist/handlers/operation/operation-handlers.d.ts.map +1 -0
- package/dist/handlers/other/index.d.ts +2 -0
- package/dist/handlers/other/index.d.ts.map +1 -0
- package/dist/handlers/other/other-handlers.d.ts +10 -0
- package/dist/handlers/other/other-handlers.d.ts.map +1 -0
- package/dist/handlers/relation/index.d.ts +2 -0
- package/dist/handlers/relation/index.d.ts.map +1 -0
- package/dist/handlers/relation/relation-handlers.d.ts +49 -0
- package/dist/handlers/relation/relation-handlers.d.ts.map +1 -0
- package/dist/handlers/selector/index.d.ts +2 -0
- package/dist/handlers/selector/index.d.ts.map +1 -0
- package/dist/handlers/selector/selector-handlers.d.ts +30 -0
- package/dist/handlers/selector/selector-handlers.d.ts.map +1 -0
- package/dist/handlers/table/index.d.ts +2 -0
- package/dist/handlers/table/index.d.ts.map +1 -0
- package/dist/handlers/table/table-handlers.d.ts +18 -0
- package/dist/handlers/table/table-handlers.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/use-action-dispatcher.d.ts +61 -0
- package/dist/hooks/use-action-dispatcher.d.ts.map +1 -0
- package/dist/hooks/use-action-handler.d.ts +29 -0
- package/dist/hooks/use-action-handler.d.ts.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1427 -0
- package/dist/index.js.map +1 -0
- package/dist/lifecycle/execute-with-lifecycle.d.ts +20 -0
- package/dist/lifecycle/execute-with-lifecycle.d.ts.map +1 -0
- package/dist/lifecycle/index.d.ts +2 -0
- package/dist/lifecycle/index.d.ts.map +1 -0
- package/dist/provider/api-context.d.ts +30 -0
- package/dist/provider/api-context.d.ts.map +1 -0
- package/dist/provider/index.d.ts +2 -0
- package/dist/provider/index.d.ts.map +1 -0
- package/dist/registry/action-handler-registry.d.ts +11 -0
- package/dist/registry/action-handler-registry.d.ts.map +1 -0
- package/dist/registry/index.d.ts +2 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/types-BsQmyhQI.js +14 -0
- package/dist/types-BsQmyhQI.js.map +1 -0
- package/dist/types-CbA9-fcJ.js +2 -0
- package/dist/types.d.ts +260 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { ClassType, RelationType } from '@judo/model-api';
|
|
2
|
+
import { Application } from '../types';
|
|
3
|
+
import { TransferData, TransferDeserializer, TransferSerializer, TransferStored, JudoRestResponse, QueryCustomizer } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for JUDO REST API client.
|
|
6
|
+
*/
|
|
7
|
+
export interface JudoRestApiConfig {
|
|
8
|
+
/** Base URL for the API (e.g., http://localhost:8080) */
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
/** The application context containing model name and actor info */
|
|
11
|
+
application: Application;
|
|
12
|
+
/** Request timeout in milliseconds */
|
|
13
|
+
timeout?: number;
|
|
14
|
+
/** Default headers to include in all requests */
|
|
15
|
+
defaultHeaders?: Record<string, string>;
|
|
16
|
+
/** Optional custom fetch implementation */
|
|
17
|
+
fetch?: typeof fetch;
|
|
18
|
+
/** Optional request interceptor */
|
|
19
|
+
onRequest?: (request: RequestInit) => RequestInit | Promise<RequestInit>;
|
|
20
|
+
/** Optional response interceptor */
|
|
21
|
+
onResponse?: (response: Response) => Response | Promise<Response>;
|
|
22
|
+
/** Optional error handler */
|
|
23
|
+
onError?: (error: Error) => void;
|
|
24
|
+
/** Optional transfer serializer for transforming transfers before sending */
|
|
25
|
+
transferSerializer?: TransferSerializer;
|
|
26
|
+
/** Optional transfer deserializer for transforming responses */
|
|
27
|
+
transferDeserializer?: TransferDeserializer;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Operation metadata for invoking operations.
|
|
31
|
+
*/
|
|
32
|
+
export interface OperationInfo {
|
|
33
|
+
/** Operation name */
|
|
34
|
+
name: string;
|
|
35
|
+
/** Whether the operation is static */
|
|
36
|
+
isStatic?: boolean;
|
|
37
|
+
/** Whether the operation is mapped */
|
|
38
|
+
isMapped?: boolean;
|
|
39
|
+
/** Whether the operation has input */
|
|
40
|
+
hasInput?: boolean;
|
|
41
|
+
/** Input class type (for templates) */
|
|
42
|
+
inputType?: ClassType;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* JUDO REST API client.
|
|
46
|
+
* Implements all REST operations according to the specification.
|
|
47
|
+
*/
|
|
48
|
+
export declare class JudoRestApi {
|
|
49
|
+
private readonly config;
|
|
50
|
+
private readonly fetchImpl;
|
|
51
|
+
private _defaultHeaders;
|
|
52
|
+
constructor(config: JudoRestApiConfig);
|
|
53
|
+
/**
|
|
54
|
+
* Update the default headers applied to every request.
|
|
55
|
+
* Use this to set or remove the Authorization header when the auth token changes.
|
|
56
|
+
*/
|
|
57
|
+
setDefaultHeaders(headers: Record<string, string>): void;
|
|
58
|
+
/**
|
|
59
|
+
* Gets the full URL for a path.
|
|
60
|
+
*/
|
|
61
|
+
private getUrl;
|
|
62
|
+
/**
|
|
63
|
+
* Serializes an transfer for sending in request body.
|
|
64
|
+
* Uses the configured transferSerializer if provided, otherwise returns the transfer as-is.
|
|
65
|
+
*/
|
|
66
|
+
private serializeTransfer;
|
|
67
|
+
/**
|
|
68
|
+
* Deserializes response data into an transfer.
|
|
69
|
+
* Uses the configured transferDeserializer if provided, otherwise returns the data as-is.
|
|
70
|
+
*/
|
|
71
|
+
private deserializeTransfer;
|
|
72
|
+
/**
|
|
73
|
+
* Deserializes an array of transfers from response data.
|
|
74
|
+
*/
|
|
75
|
+
private deserializeArray;
|
|
76
|
+
/**
|
|
77
|
+
* Makes a request with optional interceptors.
|
|
78
|
+
*/
|
|
79
|
+
private request;
|
|
80
|
+
/**
|
|
81
|
+
* Gets a template (default values) for creating a new transfer.
|
|
82
|
+
*
|
|
83
|
+
* GET /{classPath}/~template
|
|
84
|
+
*/
|
|
85
|
+
getTemplate(classType: ClassType): Promise<JudoRestResponse<TransferData>>;
|
|
86
|
+
/**
|
|
87
|
+
* Refreshes (retrieves) an transfer by its signed identifier.
|
|
88
|
+
*
|
|
89
|
+
* POST /{classPath}/~get
|
|
90
|
+
* Headers: X-Judo-SignedIdentifier
|
|
91
|
+
*/
|
|
92
|
+
refresh(classType: ClassType, target: TransferStored, queryCustomizer?: QueryCustomizer): Promise<JudoRestResponse<TransferStored>>;
|
|
93
|
+
/**
|
|
94
|
+
* Updates an existing transfer.
|
|
95
|
+
*
|
|
96
|
+
* POST /{classPath}/~update
|
|
97
|
+
* Headers: X-Judo-SignedIdentifier, X-Judo-Mask
|
|
98
|
+
*/
|
|
99
|
+
update(classType: ClassType, target: TransferStored, mask?: string): Promise<JudoRestResponse<TransferStored>>;
|
|
100
|
+
/**
|
|
101
|
+
* Validates an transfer update without persisting.
|
|
102
|
+
*
|
|
103
|
+
* POST /{classPath}/~validate
|
|
104
|
+
* Headers: X-Judo-SignedIdentifier
|
|
105
|
+
*/
|
|
106
|
+
validateUpdate(classType: ClassType, target: TransferStored): Promise<JudoRestResponse<TransferStored>>;
|
|
107
|
+
/**
|
|
108
|
+
* Deletes an existing transfer.
|
|
109
|
+
*
|
|
110
|
+
* POST /{classPath}/~delete
|
|
111
|
+
* Headers: X-Judo-SignedIdentifier
|
|
112
|
+
*/
|
|
113
|
+
delete(classType: ClassType, target: TransferStored): Promise<JudoRestResponse<void>>;
|
|
114
|
+
/**
|
|
115
|
+
* Lists transfers in a collection relation.
|
|
116
|
+
*
|
|
117
|
+
* POST /{ownerClassPath}/{relationName}/~list
|
|
118
|
+
* Headers: X-Judo-SignedIdentifier (if owner provided), X-Judo-CountRecords (if countRecords true)
|
|
119
|
+
*/
|
|
120
|
+
listRelation(relation: RelationType, owner?: TransferStored, queryCustomizer?: QueryCustomizer, countRecords?: boolean): Promise<JudoRestResponse<TransferStored[]>>;
|
|
121
|
+
/**
|
|
122
|
+
* Gets a single transfer from a non-collection relation.
|
|
123
|
+
*
|
|
124
|
+
* POST /{ownerClassPath}/{relationName}/~get
|
|
125
|
+
* Headers: X-Judo-SignedIdentifier
|
|
126
|
+
*/
|
|
127
|
+
getRelation(relation: RelationType, owner: TransferStored, queryCustomizer?: QueryCustomizer): Promise<JudoRestResponse<TransferStored | null>>;
|
|
128
|
+
/**
|
|
129
|
+
* Refreshes a non-collection access relation directly.
|
|
130
|
+
*
|
|
131
|
+
* POST /{ownerClassPath}/{relationName}/~get
|
|
132
|
+
* No owner header (access relation)
|
|
133
|
+
*/
|
|
134
|
+
refreshAccessRelation(relation: RelationType, queryCustomizer?: QueryCustomizer): Promise<JudoRestResponse<TransferStored>>;
|
|
135
|
+
/**
|
|
136
|
+
* Gets the available range of transfers for a relation.
|
|
137
|
+
*
|
|
138
|
+
* POST /{ownerClassPath}/{relationName}/~range
|
|
139
|
+
* Headers: X-Judo-Mark-Selected-Range-Items
|
|
140
|
+
*/
|
|
141
|
+
getRelationRange(relation: RelationType, owner?: TransferStored, queryCustomizer?: QueryCustomizer, countRecords?: boolean): Promise<JudoRestResponse<TransferStored[]>>;
|
|
142
|
+
/**
|
|
143
|
+
* Gets template for relation target.
|
|
144
|
+
*
|
|
145
|
+
* GET /{targetClassPath}/~template
|
|
146
|
+
*/
|
|
147
|
+
getRelationTemplate(relation: RelationType): Promise<JudoRestResponse<TransferData>>;
|
|
148
|
+
/**
|
|
149
|
+
* Creates a new transfer through a relation.
|
|
150
|
+
*
|
|
151
|
+
* Non-access: POST /{ownerClassPath}/~update/{relationName}/~create
|
|
152
|
+
* Access: POST /{ownerClassPath}/{relationName}/~create
|
|
153
|
+
*/
|
|
154
|
+
createRelation(relation: RelationType, owner: TransferStored | undefined, data: TransferData, mask?: string): Promise<JudoRestResponse<TransferStored>>;
|
|
155
|
+
/**
|
|
156
|
+
* Validates creation through a relation.
|
|
157
|
+
*
|
|
158
|
+
* Non-access: POST /{ownerClassPath}/~update/{relationName}/~validate
|
|
159
|
+
* Access: POST /{ownerClassPath}/{relationName}/~validate
|
|
160
|
+
*/
|
|
161
|
+
validateCreateRelation(relation: RelationType, owner: TransferStored | undefined, data: TransferData): Promise<JudoRestResponse<TransferData>>;
|
|
162
|
+
/**
|
|
163
|
+
* Sets a relation to point to specific transfer/transfers.
|
|
164
|
+
*
|
|
165
|
+
* POST /{ownerClassPath}/~update/{relationName}/~set
|
|
166
|
+
* Headers: X-Judo-SignedIdentifier (non-access only)
|
|
167
|
+
*/
|
|
168
|
+
setRelation(relation: RelationType, owner: TransferStored, selected: TransferStored | TransferStored[]): Promise<JudoRestResponse<void>>;
|
|
169
|
+
/**
|
|
170
|
+
* Clears a relation (sets to null/empty).
|
|
171
|
+
*
|
|
172
|
+
* POST /{ownerClassPath}/~update/{relationName}/~unset
|
|
173
|
+
* Headers: X-Judo-SignedIdentifier (non-access only)
|
|
174
|
+
*/
|
|
175
|
+
unsetRelation(relation: RelationType, owner: TransferStored): Promise<JudoRestResponse<void>>;
|
|
176
|
+
/**
|
|
177
|
+
* Adds transfers to a collection relation.
|
|
178
|
+
*
|
|
179
|
+
* POST /{ownerClassPath}/~update/{relationName}/~add
|
|
180
|
+
* Headers: X-Judo-SignedIdentifier (non-access only)
|
|
181
|
+
*/
|
|
182
|
+
addToRelation(relation: RelationType, owner: TransferStored, selected: TransferStored[]): Promise<JudoRestResponse<void>>;
|
|
183
|
+
/**
|
|
184
|
+
* Removes transfers from a collection relation.
|
|
185
|
+
*
|
|
186
|
+
* POST /{ownerClassPath}/~update/{relationName}/~remove
|
|
187
|
+
* Headers: X-Judo-SignedIdentifier (non-access only)
|
|
188
|
+
*/
|
|
189
|
+
removeFromRelation(relation: RelationType, owner: TransferStored, selected: TransferStored[]): Promise<JudoRestResponse<void>>;
|
|
190
|
+
/**
|
|
191
|
+
* Exports relation data as a file (CSV/Excel).
|
|
192
|
+
*
|
|
193
|
+
* POST /{ownerClassPath}/{relationName}/~export
|
|
194
|
+
* Headers: X-Judo-SignedIdentifier (if owner provided)
|
|
195
|
+
*/
|
|
196
|
+
exportRelation(relation: RelationType, owner?: TransferStored, queryCustomizer?: QueryCustomizer): Promise<JudoRestResponse<Blob>>;
|
|
197
|
+
/**
|
|
198
|
+
* Invokes an operation on an transfer.
|
|
199
|
+
*
|
|
200
|
+
* POST /{classPath}/{operationName}
|
|
201
|
+
* Headers: X-Judo-SignedIdentifier (if mapped/non-static)
|
|
202
|
+
*/
|
|
203
|
+
invokeOperation<TInput = unknown, TOutput = unknown>(classType: ClassType, operation: OperationInfo, owner?: TransferStored, input?: TInput): Promise<JudoRestResponse<TOutput | undefined>>;
|
|
204
|
+
/**
|
|
205
|
+
* Validates operation input without execution.
|
|
206
|
+
*
|
|
207
|
+
* POST /{classPath}/{operationName}/~validate
|
|
208
|
+
* Headers: X-Judo-SignedIdentifier (if mapped/non-static)
|
|
209
|
+
*/
|
|
210
|
+
validateOperationInput<TInput = unknown>(classType: ClassType, operation: OperationInfo, owner?: TransferStored, input?: TInput): Promise<JudoRestResponse<TInput>>;
|
|
211
|
+
/**
|
|
212
|
+
* Gets template for operation input.
|
|
213
|
+
*
|
|
214
|
+
* GET /{inputClassPath}/~template
|
|
215
|
+
*/
|
|
216
|
+
getOperationInputTemplate(operation: OperationInfo): Promise<JudoRestResponse<TransferData>>;
|
|
217
|
+
/**
|
|
218
|
+
* Gets range for operation input (selector operations).
|
|
219
|
+
*
|
|
220
|
+
* POST /{classPath}/{operationName}/~range
|
|
221
|
+
* Headers: X-Judo-Mark-Selected-Range-Items
|
|
222
|
+
*/
|
|
223
|
+
getOperationInputRange(classType: ClassType, operation: OperationInfo, owner?: TransferStored, queryCustomizer?: QueryCustomizer, countRecords?: boolean): Promise<JudoRestResponse<TransferStored[]>>;
|
|
224
|
+
/**
|
|
225
|
+
* Gets the current authenticated user's principal data.
|
|
226
|
+
*
|
|
227
|
+
* GET /{actorPath}/~principal
|
|
228
|
+
*/
|
|
229
|
+
getPrincipal(): Promise<JudoRestResponse<TransferStored>>;
|
|
230
|
+
/**
|
|
231
|
+
* Gets application metadata.
|
|
232
|
+
*
|
|
233
|
+
* GET /{actorPath}/~meta
|
|
234
|
+
*/
|
|
235
|
+
getMetadata(): Promise<JudoRestResponse<unknown>>;
|
|
236
|
+
/**
|
|
237
|
+
* Uploads a file to a binary attribute.
|
|
238
|
+
*
|
|
239
|
+
* 1. POST {attributePath}/~upload-token to get token
|
|
240
|
+
* 2. POST /upload with token and file
|
|
241
|
+
*/
|
|
242
|
+
uploadFile(attributePath: string, file: File): Promise<JudoRestResponse<unknown>>;
|
|
243
|
+
/**
|
|
244
|
+
* Downloads a file from a binary attribute.
|
|
245
|
+
*
|
|
246
|
+
* GET /download?disposition={disposition}
|
|
247
|
+
* Headers: X-Token
|
|
248
|
+
*/
|
|
249
|
+
downloadFile(downloadToken: string, disposition?: "inline" | "attachment"): Promise<JudoRestResponse<Blob>>;
|
|
250
|
+
/**
|
|
251
|
+
* Finds a specific transfer instance from an access relation by identifier.
|
|
252
|
+
*
|
|
253
|
+
* POST /{ownerClassPath}/{relationName}/~list
|
|
254
|
+
* Body: { _identifier, _mask?, _seek: { limit: 1 } }
|
|
255
|
+
*/
|
|
256
|
+
findInstance(relation: RelationType, identifier: string, mask?: string): Promise<JudoRestResponse<TransferStored | null>>;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Factory function to create a JUDO REST API client.
|
|
260
|
+
*/
|
|
261
|
+
export declare function createJudoRestApi(config: JudoRestApiConfig): JudoRestApi;
|
|
262
|
+
//# sourceMappingURL=judo-rest-api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"judo-rest-api.d.ts","sourceRoot":"","sources":["../../src/api/judo-rest-api.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,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B,KAAK,CAAC,EAAE,cAAc,EACtB,eAAe,CAAC,EAAE,eAAe,EACjC,YAAY,CAAC,EAAE,OAAO,GACpB,OAAO,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,CAAC;IA0B9C;;;;OAIG;IACG,YAAY,IAAI,OAAO,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAM/D;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAKvD;;;;;OAKG;IACG,UAAU,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;IA8BvF;;;;;OAKG;IACG,YAAY,CACjB,aAAa,EAAE,MAAM,EACrB,WAAW,GAAE,QAAQ,GAAG,YAA2B,GACjD,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAqBlC;;;;;OAKG;IACG,YAAY,CACjB,QAAQ,EAAE,YAAY,EACtB,UAAU,EAAE,MAAM,EAClB,IAAI,CAAC,EAAE,MAAM,GACX,OAAO,CAAC,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CAkBnD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,WAAW,CAExE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ClassType, OperationType, RelationType } from '@judo/model-api';
|
|
2
|
+
import { ClassTypeMetadata, OperationMetadata, RelationMetadata } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Converts a ClassType from the model to ClassTypeMetadata for REST API calls.
|
|
5
|
+
*/
|
|
6
|
+
export declare function toClassTypeMetadata(classType: ClassType): ClassTypeMetadata;
|
|
7
|
+
/**
|
|
8
|
+
* Converts a RelationType from the model to RelationMetadata for REST API calls.
|
|
9
|
+
*
|
|
10
|
+
* @param relation - The RelationType from the model
|
|
11
|
+
* @param owner - The owner ClassType. If not provided, uses `relation.eContainer`.
|
|
12
|
+
* For access relations, you must explicitly pass the actor ClassType.
|
|
13
|
+
* For transfer relations, eContainer provides the owner automatically.
|
|
14
|
+
* @throws Error if owner is not provided and eContainer is not a valid ClassType
|
|
15
|
+
*/
|
|
16
|
+
export declare function toRelationMetadata(relation: RelationType, owner?: ClassType): RelationMetadata;
|
|
17
|
+
/**
|
|
18
|
+
* Resolves the owner ClassType from a relation's eContainer.
|
|
19
|
+
* Useful for transfer relations where the owner is the parent ClassType in the EMF model.
|
|
20
|
+
*
|
|
21
|
+
* @throws Error if eContainer is not set or is not a ClassType
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveRelationOwner(relation: RelationType): ClassType;
|
|
24
|
+
/**
|
|
25
|
+
* Converts an OperationType from the model to OperationMetadata for REST API calls.
|
|
26
|
+
* Note: OperationTypeEnum values are STATIC (unbound) and MAPPED (bound).
|
|
27
|
+
*/
|
|
28
|
+
export declare function toOperationMetadata(operation: OperationType): OperationMetadata;
|
|
29
|
+
//# sourceMappingURL=model-converters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-converters.d.ts","sourceRoot":"","sources":["../../src/api/model-converters.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEtF;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,iBAAiB,CAO3E;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,SAAS,GAAG,gBAAgB,CAW9F;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAWtE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,aAAa,GAAG,iBAAiB,CAU/E"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ClassType, RelationType } from '@judo/model-api';
|
|
2
|
+
import { Application } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Builds a path for the actor with optional additional path segments.
|
|
5
|
+
*
|
|
6
|
+
* @param application - The application context
|
|
7
|
+
* @param path - Optional path to append after the actor path
|
|
8
|
+
* @returns The full path including model name and actor path
|
|
9
|
+
*/
|
|
10
|
+
export declare function getPathForActor(application: Application, path?: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Builds the REST path for a relation with a given suffix.
|
|
13
|
+
*
|
|
14
|
+
* @param relation - The relation type
|
|
15
|
+
* @param application - The application context
|
|
16
|
+
* @param suffix - The operation suffix (e.g., "/~list", "/~get", "/~range")
|
|
17
|
+
* @returns The full path for the relation endpoint
|
|
18
|
+
*/
|
|
19
|
+
export declare function getRelationPath(relation: RelationType, application: Application, suffix?: string): string;
|
|
20
|
+
/**
|
|
21
|
+
* Builds the REST path for a class type with a given suffix.
|
|
22
|
+
*
|
|
23
|
+
* @param classType - The class type
|
|
24
|
+
* @param application - The application context
|
|
25
|
+
* @param suffix - The operation suffix (e.g., "/~template", "/~get", "/~update")
|
|
26
|
+
* @returns The full path for the class endpoint
|
|
27
|
+
*/
|
|
28
|
+
export declare function getClassPath(classType: ClassType, application: Application, suffix?: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Builds the REST path for a mutation relation operation (create, set, unset, add, remove).
|
|
31
|
+
* These use the /~update/ prefix for non-access relations.
|
|
32
|
+
*
|
|
33
|
+
* @param relation - The relation type
|
|
34
|
+
* @param application - The application context
|
|
35
|
+
* @param suffix - The operation suffix (e.g., "/~create", "/~set")
|
|
36
|
+
* @param isAccess - Whether this is an access relation (skips /~update/ prefix)
|
|
37
|
+
* @returns The full path for the mutation endpoint
|
|
38
|
+
*/
|
|
39
|
+
export declare function getMutationRelationPath(relation: RelationType, application: Application, suffix: string, isAccess?: boolean): string;
|
|
40
|
+
/**
|
|
41
|
+
* Builds the REST path for an operation.
|
|
42
|
+
*
|
|
43
|
+
* @param classType - The class type containing the operation
|
|
44
|
+
* @param operationName - The operation name
|
|
45
|
+
* @param application - The application context
|
|
46
|
+
* @param suffix - Optional suffix (e.g., "/~validate", "/~range")
|
|
47
|
+
* @returns The full path for the operation endpoint
|
|
48
|
+
*/
|
|
49
|
+
export declare function getOperationPath(classType: ClassType, operationName: string, application: Application, suffix?: string): string;
|
|
50
|
+
//# sourceMappingURL=path-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-builder.d.ts","sourceRoot":"","sources":["../../src/api/path-builder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AA2D5C;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,SAAK,GAAG,MAAM,CAK3E;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAW,GAAG,MAAM,CAE3G;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAK,GAAG,MAAM,CAEhG;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACtC,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,EACd,QAAQ,UAAQ,GACd,MAAM,CAQR;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAC/B,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,WAAW,EACxB,MAAM,SAAK,GACT,MAAM,CAER"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TemporalFieldRegistry, TemporalFieldType, TransferDeserializer } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Parse a date-only string (`YYYY-MM-DD`) as a local-timezone `Date`.
|
|
4
|
+
*
|
|
5
|
+
* Avoids the timezone-shift problem of `new Date("YYYY-MM-DD")` which creates
|
|
6
|
+
* a UTC midnight `Date` — displaying as the previous day in negative-offset timezones.
|
|
7
|
+
*
|
|
8
|
+
* @param value - Date string in `YYYY-MM-DD` format
|
|
9
|
+
* @returns `Date` at local midnight, or invalid `Date` if parsing fails
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseLocalDate(value: string): Date;
|
|
12
|
+
/**
|
|
13
|
+
* Deserialize a temporal string value to its runtime representation.
|
|
14
|
+
*
|
|
15
|
+
* - `date` → local-midnight `Date` via {@link parseLocalDate}
|
|
16
|
+
* - `timestamp` → `Date` via `new Date(isoString)`
|
|
17
|
+
* - `time` → original string (pass-through)
|
|
18
|
+
*
|
|
19
|
+
* @param value - The string value from the API response
|
|
20
|
+
* @param fieldType - The temporal field type
|
|
21
|
+
* @returns `Date` for `date`/`timestamp`, original string for `time`
|
|
22
|
+
*/
|
|
23
|
+
export declare function deserializeTemporalValue(value: string, fieldType: TemporalFieldType): Date | string;
|
|
24
|
+
/**
|
|
25
|
+
* Create a model-aware transfer deserializer that converts temporal fields
|
|
26
|
+
* from ISO strings to native `Date` objects.
|
|
27
|
+
*
|
|
28
|
+
* Uses `__entityType` in the response payload to look up the transfer type
|
|
29
|
+
* in the provided registry and convert matching fields. Nested objects and
|
|
30
|
+
* arrays are processed recursively.
|
|
31
|
+
*
|
|
32
|
+
* @param registry - Mapping of entity type FQNs to temporal field declarations
|
|
33
|
+
* @returns `TransferDeserializer` that converts `date`/`timestamp` strings to `Date`
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* import { temporalFieldRegistry } from './generated/transfers/_registry';
|
|
38
|
+
*
|
|
39
|
+
* const api = createJudoRestApi({
|
|
40
|
+
* // ...
|
|
41
|
+
* transferDeserializer: createModelAwareDeserializer(temporalFieldRegistry),
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function createModelAwareDeserializer(registry: TemporalFieldRegistry): TransferDeserializer;
|
|
46
|
+
//# sourceMappingURL=transfer-deserializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer-deserializer.d.ts","sourceRoot":"","sources":["../../src/api/transfer-deserializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE9F;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAKlD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,GAAG,IAAI,GAAG,MAAM,CASnG;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,qBAAqB,GAAG,oBAAoB,CAmClG"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { TemporalFieldRegistry, TemporalFieldType, TransferData, TransferSerializer } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Properties provided by the backend that should not be sent in requests.
|
|
4
|
+
* These are read-only metadata assigned by the server.
|
|
5
|
+
*/
|
|
6
|
+
export declare const BACKEND_PROPERTIES: Set<string>;
|
|
7
|
+
/**
|
|
8
|
+
* Properties created by the frontend for local state management.
|
|
9
|
+
* These should never be serialized to the API.
|
|
10
|
+
*/
|
|
11
|
+
export declare const FRONTEND_PROPERTIES: Set<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Combined set of all internal properties that should not be serialized.
|
|
14
|
+
*/
|
|
15
|
+
export declare const INTERNAL_PROPERTIES: Set<string>;
|
|
16
|
+
/**
|
|
17
|
+
* Check if a property is internal and should be stripped from serialization.
|
|
18
|
+
* A property is internal if:
|
|
19
|
+
* 1. It's in the INTERNAL_PROPERTIES set, OR
|
|
20
|
+
* 2. It starts with `__` but is NOT `__signedIdentifier`
|
|
21
|
+
*
|
|
22
|
+
* @param key - Property name to check
|
|
23
|
+
* @returns true if the property should be stripped
|
|
24
|
+
*/
|
|
25
|
+
export declare function isInternalProperty(key: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Strip internal properties from an transfer.
|
|
28
|
+
* Creates a new object with only non-internal properties.
|
|
29
|
+
*
|
|
30
|
+
* @param transfer - Transfer to clean
|
|
31
|
+
* @returns New object without internal properties
|
|
32
|
+
*/
|
|
33
|
+
export declare function stripInternalProperties<T extends TransferData>(transfer: T): Partial<T>;
|
|
34
|
+
/**
|
|
35
|
+
* Default transfer serializer that strips internal properties.
|
|
36
|
+
* Use this when configuring JudoRestApi to ensure internal metadata
|
|
37
|
+
* is not sent to the server.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const api = new JudoRestApi({
|
|
42
|
+
* baseUrl: 'http://localhost:8080',
|
|
43
|
+
* basePath: '/api',
|
|
44
|
+
* modelName: 'myapp',
|
|
45
|
+
* actorPath: 'admin/Admin',
|
|
46
|
+
* transferSerializer: defaultTransferSerializer,
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export declare const defaultTransferSerializer: TransferSerializer;
|
|
51
|
+
/**
|
|
52
|
+
* Serialize a `Date` value to its wire format based on temporal field type.
|
|
53
|
+
*
|
|
54
|
+
* - `date` → `"YYYY-MM-DD"` using **local** date components (avoids timezone shift)
|
|
55
|
+
* - `timestamp` → full ISO 8601 UTC string via `Date.toISOString()`
|
|
56
|
+
* - `time` → `"HH:mm:ss"` using local time components
|
|
57
|
+
*
|
|
58
|
+
* @param date - The `Date` to serialize
|
|
59
|
+
* @param fieldType - The temporal field classification
|
|
60
|
+
* @returns Formatted string for the API wire format
|
|
61
|
+
*/
|
|
62
|
+
export declare function serializeTemporalValue(date: Date, fieldType: TemporalFieldType): string;
|
|
63
|
+
/**
|
|
64
|
+
* Create a model-aware transfer serializer that converts `Date` objects to
|
|
65
|
+
* the appropriate wire format **and** strips internal `__*` properties.
|
|
66
|
+
*
|
|
67
|
+
* Uses `__entityType` from the transfer (before stripping) to look up
|
|
68
|
+
* the field type in the registry and format `Date` values accordingly.
|
|
69
|
+
* Falls back to `Date.toISOString()` for `Date` values on unregistered fields.
|
|
70
|
+
*
|
|
71
|
+
* @param registry - Mapping of entity type FQNs to temporal field declarations
|
|
72
|
+
* @returns `TransferSerializer` that handles Date→string conversion and property stripping
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* import { temporalFieldRegistry } from './generated/transfers/_registry';
|
|
77
|
+
*
|
|
78
|
+
* const api = createJudoRestApi({
|
|
79
|
+
* // ...
|
|
80
|
+
* transferSerializer: createModelAwareSerializer(temporalFieldRegistry),
|
|
81
|
+
* });
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function createModelAwareSerializer(registry: TemporalFieldRegistry): TransferSerializer;
|
|
85
|
+
//# sourceMappingURL=transfer-serializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transfer-serializer.d.ts","sourceRoot":"","sources":["../../src/api/transfer-serializer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE1G;;;GAGG;AACH,eAAO,MAAM,kBAAkB,aAM7B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,aAAsD,CAAC;AAEvF;;GAEG;AACH,eAAO,MAAM,mBAAmB,aAAmE,CAAC;AAEpG;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAavD;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS,YAAY,EAAE,QAAQ,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAUvF;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,yBAAyB,EAAE,kBAgBvC,CAAC;AAMF;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,iBAAiB,GAAG,MAAM,CAiBvF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,qBAAqB,GAAG,kBAAkB,CA4B9F"}
|