@chill-sharp/ts-client 1.1.12

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.
@@ -0,0 +1,533 @@
1
+ export declare const API_BASE_PATH = "api/";
2
+ export type JsonPrimitive = string | number | boolean | null;
3
+ export type JsonValue = JsonPrimitive | JsonObject | JsonValue[];
4
+ export interface JsonObject {
5
+ [key: string]: JsonValue;
6
+ }
7
+ export interface GetTextRequest extends JsonObject {
8
+ labelGuid: string;
9
+ cultureName: string;
10
+ primaryCultureName: string;
11
+ primaryDefaultText: string;
12
+ secondaryCultureName: string;
13
+ secondaryDefaultText: string;
14
+ }
15
+ export interface GetTextResponse extends JsonObject {
16
+ labelGuid: string;
17
+ cultureName: string;
18
+ value: string;
19
+ }
20
+ export declare const ChillDtoPropertyType: {
21
+ readonly Unknown: 0;
22
+ readonly Guid: 1;
23
+ readonly Integer: 10;
24
+ readonly Decimal: 20;
25
+ readonly Date: 30;
26
+ readonly Time: 40;
27
+ readonly DateTime: 50;
28
+ readonly Duration: 60;
29
+ readonly Boolean: 70;
30
+ readonly String: 80;
31
+ readonly Text: 81;
32
+ readonly Json: 99;
33
+ readonly ChillEntity: 1000;
34
+ readonly ChillEntityCollection: 1010;
35
+ readonly ChillQuery: 1100;
36
+ };
37
+ export type ChillDtoPropertyType = (typeof ChillDtoPropertyType)[keyof typeof ChillDtoPropertyType];
38
+ export interface ChillDtoPropertySchema extends JsonObject {
39
+ name: string;
40
+ displayName: string;
41
+ propertyType: ChillDtoPropertyType;
42
+ simplePropertyType: string;
43
+ referenceChillType: string | null;
44
+ referenceChillTypeQuery: string | null;
45
+ mcpDescription: string;
46
+ isNullable: boolean | null;
47
+ isReadOnly: boolean | null;
48
+ minLength: number | null;
49
+ maxLength: number | null;
50
+ integerMinValue: number | null;
51
+ integerMaxValue: number | null;
52
+ decimalMinValue: number | null;
53
+ decimalMaxValue: number | null;
54
+ decimalPlaces: number | null;
55
+ precision: number | null;
56
+ scale: number | null;
57
+ dateFormat: string;
58
+ customFormat: string;
59
+ regexPattern: string;
60
+ enumValues: string[];
61
+ lookupQueryValues: string | null;
62
+ metadata: Record<string, string>;
63
+ }
64
+ export interface ChillDtoSchemaRelationLabel extends JsonObject {
65
+ labelGuid: string | null;
66
+ primaryDefaultText: string;
67
+ secondaryDefaultText: string;
68
+ }
69
+ export interface ChillDtoSchemaRelation extends JsonObject {
70
+ chillType: string;
71
+ chillQuery: string;
72
+ fixedValues: Record<string, string>;
73
+ fixedQueryValues: Record<string, string>;
74
+ relationLabel: ChillDtoSchemaRelationLabel;
75
+ }
76
+ export interface ChillDtoSchema extends JsonObject {
77
+ chillType: string;
78
+ chillViewCode: string;
79
+ displayName: string;
80
+ handleAttachments: boolean;
81
+ enableMCP: boolean;
82
+ mcpDescription: string;
83
+ metadata: Record<string, string>;
84
+ queryRelatedChillType: string | null;
85
+ properties: ChillDtoPropertySchema[];
86
+ relations: ChillDtoSchemaRelation[];
87
+ }
88
+ export interface ChillDtoSchemaListItem extends JsonObject {
89
+ name: string;
90
+ chillType: string;
91
+ type: string;
92
+ relatedChillType: string | null;
93
+ }
94
+ export interface ChillDtoEntityOptions extends JsonObject {
95
+ chillType: string;
96
+ checksumEnabled: boolean;
97
+ handleAttachments: boolean;
98
+ labelFormatString: string | null;
99
+ shortLabelFormatString: string | null;
100
+ fullTextContentFormatString: string | null;
101
+ enableMCP: boolean;
102
+ mcpDescription: string | null;
103
+ changeLogEnabled: boolean;
104
+ }
105
+ export interface ChillOrdering extends JsonObject {
106
+ propertyName: string;
107
+ direction: string;
108
+ }
109
+ export interface ChillPagination extends JsonObject {
110
+ pageSize: number;
111
+ pageNumber: number;
112
+ }
113
+ export interface ChillDtoProperty extends JsonObject {
114
+ name: string;
115
+ }
116
+ export interface ChillDtoEntity extends JsonObject {
117
+ guid: string;
118
+ position: number;
119
+ chillType: string;
120
+ label: string | null;
121
+ shortLabel: string | null;
122
+ properties: Record<string, JsonValue>;
123
+ }
124
+ export interface ChillDtoQuery extends JsonObject {
125
+ chillType: string;
126
+ properties: Record<string, JsonValue>;
127
+ resultProperties: ChillDtoProperty[] | null;
128
+ pagination: ChillPagination | null;
129
+ ordering: ChillOrdering | null;
130
+ lightweightRequired: boolean | null;
131
+ results: ChillDtoEntity[];
132
+ }
133
+ export interface ChillDtoMenuItem extends JsonObject {
134
+ guid: string;
135
+ positionNo: number;
136
+ title: string;
137
+ description: string | null;
138
+ parent: ChillDtoMenuItem | null;
139
+ componentName: string;
140
+ componentConfigurationJson: string | null;
141
+ menuHierarchy: string;
142
+ }
143
+ export interface ChillValidationError extends JsonObject {
144
+ fieldName: string | null;
145
+ message: string | null;
146
+ }
147
+ export interface AuthUserListItem extends JsonObject {
148
+ guid: string;
149
+ externalId: string;
150
+ userName: string;
151
+ displayName: string;
152
+ displayCultureName: string;
153
+ displayTimeZone: string;
154
+ displayDateFormat: string;
155
+ displayNumberFormat: string;
156
+ preferredTheme: string;
157
+ isActive: boolean;
158
+ canManagePermissions: boolean;
159
+ canManageSchema: boolean;
160
+ menuHierarchy: string;
161
+ }
162
+ export interface AuthRoleListItem extends JsonObject {
163
+ guid: string;
164
+ name: string;
165
+ description: string;
166
+ isActive: boolean;
167
+ menuHierarchy: string;
168
+ }
169
+ export interface AuthTokenResponse extends JsonObject {
170
+ accessToken: string;
171
+ accessTokenIssuedUtc: string;
172
+ accessTokenExpiresUtc: string;
173
+ refreshToken: string;
174
+ refreshTokenExpiresUtc: string;
175
+ userId: string;
176
+ userName: string;
177
+ }
178
+ /** Display preferences resolved for the current authenticated user. */
179
+ export interface ChillUserPreferences extends JsonObject {
180
+ displayCultureName: string;
181
+ displayTimeZone: string;
182
+ displayDateFormat: string;
183
+ displayNumberFormat: string;
184
+ preferredTheme: string;
185
+ }
186
+ export interface RegisterAuthIdentityRequest extends JsonObject {
187
+ userName: string;
188
+ email: string | null;
189
+ password: string;
190
+ displayName: string;
191
+ displayCultureName: string;
192
+ createChillAuthUser: boolean;
193
+ }
194
+ export interface LoginAuthIdentityRequest extends JsonObject {
195
+ userNameOrEmail: string;
196
+ password: string;
197
+ }
198
+ export interface RefreshAuthTokenRequest extends JsonObject {
199
+ refreshToken: string;
200
+ }
201
+ export interface ChangePasswordRequest extends JsonObject {
202
+ currentPassword: string;
203
+ newPassword: string;
204
+ }
205
+ export interface ChangePasswordResponse extends JsonObject {
206
+ succeeded: boolean;
207
+ }
208
+ export interface RequestPasswordResetRequest extends JsonObject {
209
+ userNameOrEmail: string;
210
+ }
211
+ export interface PasswordResetTokenResponse extends JsonObject {
212
+ isAccepted: boolean;
213
+ userId: string | null;
214
+ resetToken: string | null;
215
+ }
216
+ export interface ResetPasswordRequest extends JsonObject {
217
+ userId: string;
218
+ resetToken: string;
219
+ newPassword: string;
220
+ }
221
+ export interface ResetPasswordResponse extends JsonObject {
222
+ succeeded: boolean;
223
+ }
224
+ export declare const PermissionEffect: {
225
+ readonly Allow: 1;
226
+ readonly Deny: 2;
227
+ };
228
+ export type PermissionEffect = (typeof PermissionEffect)[keyof typeof PermissionEffect];
229
+ export declare const PermissionAction: {
230
+ readonly FullControl: 0;
231
+ readonly Query: 1;
232
+ readonly Create: 2;
233
+ readonly Update: 3;
234
+ readonly Delete: 4;
235
+ readonly See: 5;
236
+ readonly Modify: 6;
237
+ };
238
+ export type PermissionAction = (typeof PermissionAction)[keyof typeof PermissionAction];
239
+ export declare const PermissionScope: {
240
+ readonly Module: 1;
241
+ readonly Entity: 2;
242
+ readonly Property: 3;
243
+ };
244
+ export type PermissionScope = (typeof PermissionScope)[keyof typeof PermissionScope];
245
+ export interface AuthPermissionRule extends JsonObject {
246
+ guid: string;
247
+ userGuid: string | null;
248
+ roleGuid: string | null;
249
+ effect: PermissionEffect;
250
+ action: PermissionAction;
251
+ scope: PermissionScope;
252
+ module: string;
253
+ entityName: string | null;
254
+ propertyName: string | null;
255
+ appliesToAllProperties: boolean;
256
+ description: string;
257
+ createdUtc: string;
258
+ }
259
+ export interface AuthRolePermissions extends AuthRoleListItem {
260
+ permissions: AuthPermissionRule[];
261
+ }
262
+ export interface GetAuthPermissionsResponse extends JsonObject {
263
+ user: AuthUserListItem | null;
264
+ permissions: AuthPermissionRule[];
265
+ roles: AuthRolePermissions[];
266
+ }
267
+ export interface AuthUserDetailsResponse extends AuthUserListItem {
268
+ roles: AuthRoleListItem[];
269
+ permissions: AuthPermissionRule[];
270
+ }
271
+ export interface AuthRoleDetailsResponse extends AuthRoleListItem {
272
+ users: AuthUserListItem[];
273
+ permissions: AuthPermissionRule[];
274
+ }
275
+ export interface AuthPermissionRuleItem extends JsonObject {
276
+ guid: string | null;
277
+ effect: PermissionEffect;
278
+ action: PermissionAction;
279
+ scope: PermissionScope;
280
+ module: string;
281
+ entityName: string | null;
282
+ propertyName: string | null;
283
+ appliesToAllProperties: boolean;
284
+ description: string;
285
+ }
286
+ export interface SetAuthUserRequest extends JsonObject {
287
+ guid: string | null;
288
+ externalId: string;
289
+ userName: string;
290
+ displayName: string;
291
+ displayCultureName: string;
292
+ displayTimeZone: string;
293
+ displayDateFormat: string;
294
+ displayNumberFormat: string;
295
+ preferredTheme: string;
296
+ isActive: boolean;
297
+ canManagePermissions: boolean;
298
+ canManageSchema: boolean;
299
+ menuHierarchy: string;
300
+ roleGuids: string[];
301
+ permissions: AuthPermissionRuleItem[];
302
+ }
303
+ export interface CreateAuthUserRequest extends JsonObject {
304
+ externalId: string;
305
+ email: string;
306
+ userName: string;
307
+ displayName: string;
308
+ displayCultureName: string;
309
+ displayTimeZone: string;
310
+ displayDateFormat: string;
311
+ displayNumberFormat: string;
312
+ preferredTheme: string;
313
+ isActive: boolean;
314
+ canManagePermissions: boolean;
315
+ canManageSchema: boolean;
316
+ menuHierarchy: string;
317
+ }
318
+ export interface UpdateAuthUserRequest extends JsonObject {
319
+ externalId: string;
320
+ userName: string;
321
+ displayName: string;
322
+ displayCultureName: string;
323
+ displayTimeZone: string;
324
+ displayDateFormat: string;
325
+ displayNumberFormat: string;
326
+ preferredTheme: string;
327
+ isActive: boolean;
328
+ canManagePermissions: boolean;
329
+ canManageSchema: boolean;
330
+ menuHierarchy: string;
331
+ }
332
+ export interface SetAuthRoleRequest extends JsonObject {
333
+ guid: string | null;
334
+ name: string;
335
+ description: string;
336
+ isActive: boolean;
337
+ menuHierarchy: string;
338
+ userGuids: string[];
339
+ permissions: AuthPermissionRuleItem[];
340
+ }
341
+ export interface CreateAuthRoleRequest extends JsonObject {
342
+ name: string;
343
+ description: string;
344
+ isActive: boolean;
345
+ menuHierarchy: string;
346
+ }
347
+ export interface UpdateAuthRoleRequest extends CreateAuthRoleRequest {
348
+ }
349
+ export interface CreateAuthPermissionRuleRequest extends JsonObject {
350
+ userGuid: string | null;
351
+ roleGuid: string | null;
352
+ effect: PermissionEffect;
353
+ action: PermissionAction;
354
+ scope: PermissionScope;
355
+ module: string;
356
+ entityName: string | null;
357
+ propertyName: string | null;
358
+ appliesToAllProperties: boolean;
359
+ description: string;
360
+ }
361
+ export interface UpdateAuthPermissionRuleRequest extends CreateAuthPermissionRuleRequest {
362
+ }
363
+ export interface ChillSharpClientOptions {
364
+ accessToken?: string;
365
+ username?: string;
366
+ password?: string;
367
+ cultureName?: string;
368
+ apiBasePath?: string;
369
+ fetchImpl?: typeof fetch;
370
+ signalRWithCredentials?: boolean;
371
+ }
372
+ export interface ChillAttachmentUploadFile {
373
+ fileName: string;
374
+ content: Blob | ArrayBuffer | Uint8Array | string;
375
+ contentType?: string;
376
+ }
377
+ export interface ChillAttachmentUploadOptions {
378
+ title?: string | null;
379
+ description?: string | null;
380
+ isPublic?: boolean;
381
+ }
382
+ export type ChillEntityChangeAction = "CREATED" | "UPDATED" | "DELETED";
383
+ export interface ChillEntityChangeNotification extends JsonObject {
384
+ chillType: string;
385
+ guid: string;
386
+ action: ChillEntityChangeAction;
387
+ }
388
+ export type ChillEntityChangeCallback = (changes: ChillEntityChangeNotification[]) => void | Promise<void>;
389
+ export interface ChillEntityChangeSubscription {
390
+ chillType: string;
391
+ guid: string | null;
392
+ unsubscribe(): Promise<void>;
393
+ }
394
+ export declare class ChillSharpClient {
395
+ static readonly API_BASE_PATH = "api/";
396
+ private static readonly attachmentEntityChillType;
397
+ private static readonly attachmentQueryChillType;
398
+ private readonly baseUrl;
399
+ private readonly fetchImpl;
400
+ private cultureName;
401
+ private readonly signalRWithCredentials;
402
+ private username;
403
+ private password;
404
+ private refreshPromise;
405
+ private tokenState;
406
+ private notificationConnection;
407
+ private readonly entityChangeSubscriptions;
408
+ private readonly entityChangeRegistrationCounts;
409
+ private entityChangeSubscriptionSequence;
410
+ constructor(baseUrl: string, options?: ChillSharpClientOptions);
411
+ query(dtoQuery: JsonObject): Promise<JsonObject>;
412
+ lookup(dtoQuery: JsonObject): Promise<JsonObject>;
413
+ find(dtoEntity: JsonObject): Promise<JsonObject | null>;
414
+ create(dtoEntity: JsonObject): Promise<JsonObject>;
415
+ update(dtoEntity: JsonObject): Promise<JsonObject>;
416
+ delete(dtoEntity: JsonObject): Promise<void>;
417
+ autocomplete(dto: JsonObject): Promise<JsonObject>;
418
+ validate(dto: JsonObject): Promise<ChillValidationError[]>;
419
+ chunk(operations: JsonObject[]): Promise<JsonObject[]>;
420
+ uploadAttachment(targetEntity: JsonObject, file: ChillAttachmentUploadFile, options?: ChillAttachmentUploadOptions): Promise<JsonObject[]>;
421
+ uploadAttachments(targetEntity: JsonObject, files: ChillAttachmentUploadFile[], options?: ChillAttachmentUploadOptions): Promise<JsonObject[]>;
422
+ getAttachments(targetEntity: JsonObject): Promise<JsonObject[]>;
423
+ downloadAttachment(attachmentOrGuid: JsonObject | string): Promise<Blob>;
424
+ version(): string;
425
+ /** Updates the default culture used by calls that do not provide one explicitly. */
426
+ setCultureName(cultureName?: string | null): void;
427
+ test(): Promise<string>;
428
+ getSchema(chillType: string, chillViewCode: string, cultureName?: string, update?: boolean): Promise<ChillDtoSchema | null>;
429
+ getSchemaList(cultureName?: string): Promise<ChillDtoSchemaListItem[]>;
430
+ setSchema(schema: ChillDtoSchema): Promise<ChillDtoSchema | null>;
431
+ getEntityOptions(chillType: string): Promise<ChillDtoEntityOptions>;
432
+ setEntityOptions(entityOptions: ChillDtoEntityOptions): Promise<ChillDtoEntityOptions>;
433
+ getMenu(parentGuid?: string | null): Promise<ChillDtoMenuItem[]>;
434
+ setMenu(menuItem: ChillDtoMenuItem): Promise<ChillDtoMenuItem>;
435
+ deleteMenu(menuItemGuid: string): Promise<void>;
436
+ getText(request: GetTextRequest): Promise<GetTextResponse | null>;
437
+ getTexts(requests: GetTextRequest[]): Promise<Array<GetTextResponse | null>>;
438
+ setText(payload: JsonObject): Promise<GetTextResponse>;
439
+ subscribeToEntityChanges(chillType: string, callback: ChillEntityChangeCallback, guid?: string | null): Promise<ChillEntityChangeSubscription>;
440
+ disconnectEntityChanges(): Promise<void>;
441
+ registerAuthAccount(payload: RegisterAuthIdentityRequest): Promise<AuthTokenResponse>;
442
+ loginAuthAccount(payload: LoginAuthIdentityRequest): Promise<AuthTokenResponse>;
443
+ refreshAuthAccount(): Promise<AuthTokenResponse>;
444
+ logoutAuthAccount(): Promise<void>;
445
+ changeAuthPassword(payload: ChangePasswordRequest): Promise<ChangePasswordResponse>;
446
+ requestAuthPasswordReset(payload: RequestPasswordResetRequest): Promise<PasswordResetTokenResponse>;
447
+ resetAuthPassword(payload: ResetPasswordRequest): Promise<ResetPasswordResponse>;
448
+ getAuthPermissions(): Promise<GetAuthPermissionsResponse>;
449
+ getCurrentUserPreferences(): Promise<ChillUserPreferences>;
450
+ getAuthUserList(): Promise<AuthUserListItem[]>;
451
+ getAuthUser(userGuid: string): Promise<AuthUserDetailsResponse>;
452
+ setAuthUser(payload: SetAuthUserRequest): Promise<AuthUserDetailsResponse>;
453
+ getAuthRoleList(): Promise<AuthRoleListItem[]>;
454
+ getAuthModuleList(): Promise<string[]>;
455
+ getAuthEntityList(module?: string | null): Promise<string[]>;
456
+ getAuthQueryList(module?: string | null): Promise<string[]>;
457
+ getAuthModuleEntityList(module?: string | null): Promise<string[]>;
458
+ getAuthPropertyList(chillType: string): Promise<string[]>;
459
+ getAuthRole(roleGuid: string): Promise<AuthRoleDetailsResponse>;
460
+ setAuthRole(payload: SetAuthRoleRequest): Promise<AuthRoleDetailsResponse>;
461
+ getAuthUsers(): Promise<AuthUserListItem[]>;
462
+ createAuthUser(payload: CreateAuthUserRequest): Promise<AuthUserListItem>;
463
+ updateAuthUser(userGuid: string, payload: UpdateAuthUserRequest): Promise<AuthUserListItem | null>;
464
+ deleteAuthUser(userGuid: string): Promise<void>;
465
+ getAuthUserRoles(userGuid: string): Promise<AuthRoleListItem[]>;
466
+ assignAuthRole(userGuid: string, roleGuid: string): Promise<void>;
467
+ removeAuthRole(userGuid: string, roleGuid: string): Promise<void>;
468
+ getAuthRoles(): Promise<AuthRoleListItem[]>;
469
+ createAuthRole(payload: CreateAuthRoleRequest): Promise<AuthRoleListItem>;
470
+ updateAuthRole(roleGuid: string, payload: UpdateAuthRoleRequest): Promise<AuthRoleListItem | null>;
471
+ deleteAuthRole(roleGuid: string): Promise<void>;
472
+ getAuthPermissionRules(userGuid?: string | null, roleGuid?: string | null): Promise<AuthPermissionRule[]>;
473
+ getAuthPermissionRule(ruleGuid: string): Promise<AuthPermissionRule | null>;
474
+ createAuthPermissionRule(payload: CreateAuthPermissionRuleRequest): Promise<AuthPermissionRule>;
475
+ updateAuthPermissionRule(ruleGuid: string, payload: UpdateAuthPermissionRuleRequest): Promise<AuthPermissionRule | null>;
476
+ deleteAuthPermissionRule(ruleGuid: string): Promise<void>;
477
+ private prepareGetTextRequest;
478
+ private sendAuthJson;
479
+ private sendJson;
480
+ private sendText;
481
+ private sendBlob;
482
+ private sendRequest;
483
+ private getAuthTokenIfNecessary;
484
+ private getAuthTokenIfNecessaryCore;
485
+ private applyAuthToken;
486
+ private clearAuthToken;
487
+ private canUseAuthentication;
488
+ private hasUsableAccessToken;
489
+ private shouldRefreshAccessToken;
490
+ private tryRefreshAuthentication;
491
+ private createCurrentTokenResponse;
492
+ private buildChillUrl;
493
+ private buildNotifyUrl;
494
+ private buildApiUrl;
495
+ private buildAuthUrl;
496
+ private buildSchemaUrl;
497
+ private buildI18nUrl;
498
+ private buildAttachmentUrl;
499
+ private getAuthBaseUrl;
500
+ private getSchemaBaseUrl;
501
+ private getI18nBaseUrl;
502
+ private getAttachmentBaseUrl;
503
+ private getApiBaseUrl;
504
+ private normalizeBaseUrl;
505
+ private normalizeApiBasePath;
506
+ private isKnownChillSharpEndpointBase;
507
+ private endsWithPathSegment;
508
+ private normalizeRequiredValue;
509
+ private normalizeOptionalValue;
510
+ private normalizeQueryValue;
511
+ private readString;
512
+ private readDate;
513
+ private readValue;
514
+ private getAttachmentTargetInfo;
515
+ private getAttachmentGuid;
516
+ private toAttachmentBlob;
517
+ private isFormDataPayload;
518
+ private parseDate;
519
+ private formatDate;
520
+ private ensureNotificationConnection;
521
+ private unsubscribeFromEntityChanges;
522
+ private dispatchEntityChangeNotifications;
523
+ private normalizeEntityChangeNotifications;
524
+ private isEntityChangeAction;
525
+ private reregisterEntityChangeSubscriptions;
526
+ private buildEntityChangeRegistrationKey;
527
+ private getUsersAssignedToRole;
528
+ private syncUserRoles;
529
+ private syncUserPermissions;
530
+ private syncRoleUsers;
531
+ private syncRolePermissions;
532
+ private syncPermissionRules;
533
+ }