@nexia/sdk 0.5.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/dist/app-availability.d.ts +18 -0
- package/dist/app-availability.js +29 -0
- package/dist/approval.d.ts +180 -0
- package/dist/approval.js +9 -0
- package/dist/context.d.ts +49 -0
- package/dist/context.js +1 -0
- package/dist/data-migration.d.ts +123 -0
- package/dist/data-migration.js +70 -0
- package/dist/fixtures/approval-contract-negative.d.ts +1 -0
- package/dist/fixtures/approval-contract-negative.js +8 -0
- package/dist/handoff-result.d.ts +6 -0
- package/dist/handoff-result.js +17 -0
- package/dist/host.d.ts +602 -0
- package/dist/host.js +803 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +21 -0
- package/dist/number.d.ts +2 -0
- package/dist/number.js +9 -0
- package/dist/organization-target.d.ts +101 -0
- package/dist/organization-target.js +105 -0
- package/dist/permissions.d.ts +3 -0
- package/dist/permissions.js +12 -0
- package/dist/platform.d.ts +378 -0
- package/dist/platform.js +114 -0
- package/dist/process.d.ts +98 -0
- package/dist/process.js +10 -0
- package/dist/resource-composition.d.ts +104 -0
- package/dist/resource-composition.js +576 -0
- package/dist/resource-create-destination.d.ts +17 -0
- package/dist/resource-create-destination.js +1 -0
- package/dist/resource-reference.d.ts +122 -0
- package/dist/resource-reference.js +203 -0
- package/dist/resources/resource-information.d.ts +128 -0
- package/dist/resources/resource-information.js +12 -0
- package/dist/resources/resource-list.d.ts +23 -0
- package/dist/resources/resource-list.js +1 -0
- package/dist/resources/resource-projections.d.ts +311 -0
- package/dist/resources/resource-projections.js +1 -0
- package/dist/resources/resource-transfer.d.ts +208 -0
- package/dist/resources/resource-transfer.js +1 -0
- package/dist/shell.d.ts +1297 -0
- package/dist/shell.js +1 -0
- package/dist/signature.d.ts +489 -0
- package/dist/signature.js +171 -0
- package/dist/spreadsheet.d.ts +42 -0
- package/dist/spreadsheet.js +15 -0
- package/dist/testing.d.ts +16 -0
- package/dist/testing.js +17 -0
- package/package.json +53 -0
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import type { ComponentType, ReactElement, RefCallback } from 'react';
|
|
2
|
+
import type { UseMutationResult, UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import type { LegalEntityContext, TenantContext } from './context';
|
|
4
|
+
import type { ResourceListSchema } from './resources/resource-list';
|
|
5
|
+
export interface OperatingUnitListItem {
|
|
6
|
+
public_id: string;
|
|
7
|
+
code: string;
|
|
8
|
+
name: string;
|
|
9
|
+
unit_type: string;
|
|
10
|
+
is_primary?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface OperatingUnitContextResponse {
|
|
13
|
+
operating_units: OperatingUnitListItem[];
|
|
14
|
+
}
|
|
15
|
+
export type OperatingUnitQueryScope = 'memberships' | 'affiliated' | 'assignable';
|
|
16
|
+
export type OperatingUnitSelectionResult = UseQueryResult<OperatingUnitContextResponse, Error> & {
|
|
17
|
+
operatingUnits: OperatingUnitListItem[];
|
|
18
|
+
selectedPublicId: string | null;
|
|
19
|
+
select: (publicId: string) => void;
|
|
20
|
+
};
|
|
21
|
+
export type OperatingUnitQueryResult = UseQueryResult<OperatingUnitContextResponse, Error>;
|
|
22
|
+
export interface LegalEntityListItem {
|
|
23
|
+
public_id: string;
|
|
24
|
+
code: string;
|
|
25
|
+
name: string;
|
|
26
|
+
is_primary?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface LegalEntityContextResponse {
|
|
29
|
+
legal_entities: LegalEntityListItem[];
|
|
30
|
+
}
|
|
31
|
+
export type LegalEntityQueryResult = UseQueryResult<LegalEntityContextResponse, Error>;
|
|
32
|
+
/** Active tenant Legal Entities used only to set a tenant-owned record's domain applicability. */
|
|
33
|
+
export interface LegalEntityApplicabilityResponse {
|
|
34
|
+
data: LegalEntityListItem[];
|
|
35
|
+
}
|
|
36
|
+
export type LegalEntityApplicabilityQueryResult = UseQueryResult<LegalEntityApplicabilityResponse, Error>;
|
|
37
|
+
/** Core-owned Approval route-policy metadata exposed for App reference pickers. */
|
|
38
|
+
export interface ApprovalRoutePolicyListItem {
|
|
39
|
+
id: string;
|
|
40
|
+
key: string;
|
|
41
|
+
version: number;
|
|
42
|
+
name: string;
|
|
43
|
+
status: 'draft' | 'active' | 'deprecated' | 'retired';
|
|
44
|
+
scope: 'tenant' | 'legal_entity';
|
|
45
|
+
legal_entity_public_id: string | null;
|
|
46
|
+
}
|
|
47
|
+
export interface ApprovalRoutePolicyListResponse {
|
|
48
|
+
data: ApprovalRoutePolicyListItem[];
|
|
49
|
+
}
|
|
50
|
+
export type ApprovalRoutePoliciesQueryResult = UseQueryResult<ApprovalRoutePolicyListResponse, Error>;
|
|
51
|
+
/** Submitter-safe shared approval line from the record's Legal Entity. */
|
|
52
|
+
export interface ApprovalSharedLine {
|
|
53
|
+
key: string;
|
|
54
|
+
name: string;
|
|
55
|
+
line_hash?: string;
|
|
56
|
+
resolved: boolean;
|
|
57
|
+
unavailable?: boolean;
|
|
58
|
+
stages: Array<{
|
|
59
|
+
position: number;
|
|
60
|
+
steps: Array<{
|
|
61
|
+
kind: string;
|
|
62
|
+
is_final_authority?: boolean;
|
|
63
|
+
user: {
|
|
64
|
+
id: number;
|
|
65
|
+
name: string;
|
|
66
|
+
email: string;
|
|
67
|
+
} | null;
|
|
68
|
+
}>;
|
|
69
|
+
}>;
|
|
70
|
+
}
|
|
71
|
+
export interface ApprovalSharedLinesResponse {
|
|
72
|
+
data: ApprovalSharedLine[];
|
|
73
|
+
}
|
|
74
|
+
export type ApprovalSharedLinesQueryResult = UseQueryResult<ApprovalSharedLinesResponse, Error>;
|
|
75
|
+
/** Active or administratively visible participation in one Legal Entity. */
|
|
76
|
+
export interface LegalEntityMemberListItem {
|
|
77
|
+
id: number;
|
|
78
|
+
public_id: string;
|
|
79
|
+
name: string;
|
|
80
|
+
email: string;
|
|
81
|
+
status: string;
|
|
82
|
+
party_public_id: string | null;
|
|
83
|
+
party_display_label: string | null;
|
|
84
|
+
title: string | null;
|
|
85
|
+
membership_status: string;
|
|
86
|
+
is_active_member: boolean;
|
|
87
|
+
is_primary: boolean;
|
|
88
|
+
legal_entities: Array<{
|
|
89
|
+
public_id: string;
|
|
90
|
+
code: string;
|
|
91
|
+
name: string;
|
|
92
|
+
is_direct: boolean;
|
|
93
|
+
}>;
|
|
94
|
+
joined_at: string | null;
|
|
95
|
+
left_at: string | null;
|
|
96
|
+
}
|
|
97
|
+
export interface LegalEntityMembersResponse {
|
|
98
|
+
data: LegalEntityMemberListItem[];
|
|
99
|
+
legal_entity: {
|
|
100
|
+
public_id: string;
|
|
101
|
+
code: string;
|
|
102
|
+
name: string;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export interface LegalEntityMemberListParams {
|
|
106
|
+
search?: string;
|
|
107
|
+
sort?: string;
|
|
108
|
+
perPage?: number;
|
|
109
|
+
}
|
|
110
|
+
export type LegalEntityMemberQueryResult = UseQueryResult<LegalEntityMembersResponse, Error>;
|
|
111
|
+
export interface AttachmentUploader {
|
|
112
|
+
id: string | number;
|
|
113
|
+
public_id?: string | null;
|
|
114
|
+
name: string | null;
|
|
115
|
+
email: string | null;
|
|
116
|
+
display_label?: string;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Domain attachment UI vocabulary backed directly by one Media Library row.
|
|
120
|
+
* There is no Attachment model, endpoint, or second public identifier.
|
|
121
|
+
*/
|
|
122
|
+
export interface AttachmentItem {
|
|
123
|
+
id: number;
|
|
124
|
+
public_id: string;
|
|
125
|
+
original_name: string;
|
|
126
|
+
display_label?: string;
|
|
127
|
+
mime_type: string | null;
|
|
128
|
+
size_bytes: number;
|
|
129
|
+
scan_status?: string | null;
|
|
130
|
+
download_count: number;
|
|
131
|
+
last_downloaded_at: string | null;
|
|
132
|
+
download_url?: string;
|
|
133
|
+
created_at: string | null;
|
|
134
|
+
updated_at: string | null;
|
|
135
|
+
uploader?: AttachmentUploader | null;
|
|
136
|
+
}
|
|
137
|
+
/** Host-owned media returned after an App uploads a user-selected file. */
|
|
138
|
+
export interface MediaItem {
|
|
139
|
+
id: number;
|
|
140
|
+
public_id: string;
|
|
141
|
+
display_label?: string;
|
|
142
|
+
original_name: string;
|
|
143
|
+
mime_type: string | null;
|
|
144
|
+
size_bytes: number;
|
|
145
|
+
scan_status?: string | null;
|
|
146
|
+
download_count: number;
|
|
147
|
+
last_downloaded_at: string | null;
|
|
148
|
+
download_url?: string;
|
|
149
|
+
created_at: string | null;
|
|
150
|
+
updated_at: string | null;
|
|
151
|
+
}
|
|
152
|
+
export interface AttachmentsResponse {
|
|
153
|
+
data: AttachmentItem[];
|
|
154
|
+
meta: {
|
|
155
|
+
current_page: number;
|
|
156
|
+
last_page: number;
|
|
157
|
+
per_page: number;
|
|
158
|
+
total: number;
|
|
159
|
+
list_schema?: ResourceListSchema;
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
export interface AttachmentMutationResponse {
|
|
163
|
+
media: AttachmentItem;
|
|
164
|
+
}
|
|
165
|
+
export type AttachmentQueryResult = UseQueryResult<AttachmentsResponse, Error>;
|
|
166
|
+
/** A closed host upload purpose for an attachment owner. */
|
|
167
|
+
export interface AttachmentUploadOptions {
|
|
168
|
+
purpose?: 'media' | 'protected_attachment_pdf';
|
|
169
|
+
}
|
|
170
|
+
export type AttachmentUploadResult = UseMutationResult<AttachmentMutationResponse, Error, File>;
|
|
171
|
+
export type AttachmentDeleteResult = UseMutationResult<void, Error, string | number>;
|
|
172
|
+
export type MediaUploadResult = UseMutationResult<MediaItem, Error, File>;
|
|
173
|
+
/** A browser transfer is driven by a host-issued, transport-neutral upload intent. */
|
|
174
|
+
export interface UploadFileInput {
|
|
175
|
+
purpose: string;
|
|
176
|
+
file: File;
|
|
177
|
+
checksum?: string;
|
|
178
|
+
/**
|
|
179
|
+
* A closed upload-purpose target, validated and canonicalized by the
|
|
180
|
+
* host before bytes enter staging. App code never supplies a disk or path.
|
|
181
|
+
*/
|
|
182
|
+
target?: Record<string, string | number | boolean | null>;
|
|
183
|
+
onProgress?: (progress: UploadProgress) => void;
|
|
184
|
+
}
|
|
185
|
+
export interface UploadProgress {
|
|
186
|
+
loaded: number;
|
|
187
|
+
total: number;
|
|
188
|
+
percent: number | null;
|
|
189
|
+
}
|
|
190
|
+
export interface UploadIntent {
|
|
191
|
+
id: string;
|
|
192
|
+
purpose: string;
|
|
193
|
+
state: string;
|
|
194
|
+
transport?: 'direct' | 'proxy';
|
|
195
|
+
expires_at: string | null;
|
|
196
|
+
media?: unknown;
|
|
197
|
+
}
|
|
198
|
+
export interface UploadIntentResponse {
|
|
199
|
+
upload: UploadIntent;
|
|
200
|
+
}
|
|
201
|
+
export interface UploadTask {
|
|
202
|
+
result: Promise<UploadIntentResponse>;
|
|
203
|
+
cancel: () => void;
|
|
204
|
+
retry: () => UploadTask;
|
|
205
|
+
}
|
|
206
|
+
export interface WaitForUploadCompletionOptions {
|
|
207
|
+
/** Maximum number of authoritative status reads before timing out. */
|
|
208
|
+
attempts?: number;
|
|
209
|
+
/** Delay between status reads. */
|
|
210
|
+
intervalMs?: number;
|
|
211
|
+
}
|
|
212
|
+
export interface UploadFileClient {
|
|
213
|
+
uploadFile: (input: UploadFileInput) => UploadTask;
|
|
214
|
+
/** Waits for the host's asynchronous validation and materialization gates. */
|
|
215
|
+
waitForCompletion: (intentId: string, options?: WaitForUploadCompletionOptions) => Promise<UploadIntent>;
|
|
216
|
+
}
|
|
217
|
+
/** App-neutral metadata for a host-governed asset. Binary content stays in the host. */
|
|
218
|
+
export interface TrustedAssetListItem {
|
|
219
|
+
kind: string;
|
|
220
|
+
public_id: string;
|
|
221
|
+
version: number;
|
|
222
|
+
label: string;
|
|
223
|
+
status: string;
|
|
224
|
+
valid_from: string | null;
|
|
225
|
+
valid_until: string | null;
|
|
226
|
+
metadata: Record<string, string | number | boolean | null>;
|
|
227
|
+
}
|
|
228
|
+
export interface TrustedAssetsResponse {
|
|
229
|
+
data: TrustedAssetListItem[];
|
|
230
|
+
}
|
|
231
|
+
export interface TrustedAssetListParams {
|
|
232
|
+
bindingKey: string;
|
|
233
|
+
bindingVersion: string;
|
|
234
|
+
kind: string;
|
|
235
|
+
}
|
|
236
|
+
export type TrustedAssetsQueryResult = UseQueryResult<TrustedAssetsResponse, Error>;
|
|
237
|
+
export type PartyType = 'person' | 'organization';
|
|
238
|
+
export type PartyStatus = 'active' | 'archived' | 'inactive';
|
|
239
|
+
export interface PartyListItem {
|
|
240
|
+
id: number;
|
|
241
|
+
public_id: string;
|
|
242
|
+
display_label: string;
|
|
243
|
+
type: PartyType;
|
|
244
|
+
display_name: string;
|
|
245
|
+
legal_name: string | null;
|
|
246
|
+
business_number: string | null;
|
|
247
|
+
contact_email: string | null;
|
|
248
|
+
status: PartyStatus;
|
|
249
|
+
party_roles?: Array<{
|
|
250
|
+
id: number;
|
|
251
|
+
public_id: string;
|
|
252
|
+
role_code: string;
|
|
253
|
+
display_name: string | null;
|
|
254
|
+
owning_app: string | null;
|
|
255
|
+
granted_at: string | null;
|
|
256
|
+
}>;
|
|
257
|
+
}
|
|
258
|
+
export interface PartiesResponse {
|
|
259
|
+
parties: PartyListItem[];
|
|
260
|
+
meta?: {
|
|
261
|
+
current_page: number;
|
|
262
|
+
last_page: number;
|
|
263
|
+
per_page: number;
|
|
264
|
+
total: number;
|
|
265
|
+
list_schema?: ResourceListSchema;
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
export type PartyQueryResult = UseQueryResult<PartiesResponse, Error>;
|
|
269
|
+
export interface PartyListParams extends Record<string, unknown> {
|
|
270
|
+
search?: string;
|
|
271
|
+
filters?: Record<string, string | string[]>;
|
|
272
|
+
sort?: string;
|
|
273
|
+
page?: number;
|
|
274
|
+
perPage?: number;
|
|
275
|
+
}
|
|
276
|
+
export interface ProfileSlotPropsV1 {
|
|
277
|
+
slotApiVersion: 1;
|
|
278
|
+
tenant: Pick<TenantContext, 'id' | 'name'>;
|
|
279
|
+
legalEntity: Pick<LegalEntityContext, 'name' | 'code' | 'public_id'> | null;
|
|
280
|
+
visibility: 'owner';
|
|
281
|
+
descriptorKey: string;
|
|
282
|
+
appKey: string;
|
|
283
|
+
familyKey: string;
|
|
284
|
+
}
|
|
285
|
+
export interface SelfWorkContext {
|
|
286
|
+
ref: string;
|
|
287
|
+
label: string;
|
|
288
|
+
description: string | null;
|
|
289
|
+
status: string | null;
|
|
290
|
+
effectiveFrom: string | null;
|
|
291
|
+
effectiveUntil: string | null;
|
|
292
|
+
isPrimary: boolean;
|
|
293
|
+
}
|
|
294
|
+
export interface ProfileSlotPropsV2 {
|
|
295
|
+
slotApiVersion: 2;
|
|
296
|
+
tenant: Pick<TenantContext, 'id' | 'name'>;
|
|
297
|
+
legalEntity: Pick<LegalEntityContext, 'name' | 'code' | 'public_id'> | null;
|
|
298
|
+
visibility: 'owner';
|
|
299
|
+
descriptorKey: string;
|
|
300
|
+
appKey: string;
|
|
301
|
+
familyKey: string;
|
|
302
|
+
workContext: SelfWorkContext | null;
|
|
303
|
+
}
|
|
304
|
+
export interface OperatingUnitScopeReference {
|
|
305
|
+
public_id: string;
|
|
306
|
+
code: string;
|
|
307
|
+
label: string;
|
|
308
|
+
}
|
|
309
|
+
export interface OperatingUnitScopeResult {
|
|
310
|
+
units: OperatingUnitScopeReference[];
|
|
311
|
+
selected: OperatingUnitScopeReference | null;
|
|
312
|
+
selectedId: string | null;
|
|
313
|
+
select: (publicId: string) => void;
|
|
314
|
+
isLoading: boolean;
|
|
315
|
+
isError: boolean;
|
|
316
|
+
}
|
|
317
|
+
export interface OperatingUnitScopeFieldProps {
|
|
318
|
+
scope: OperatingUnitScopeResult;
|
|
319
|
+
}
|
|
320
|
+
export interface ComponentSpec {
|
|
321
|
+
component: string;
|
|
322
|
+
props: Record<string, unknown>;
|
|
323
|
+
children: ComponentSpec[];
|
|
324
|
+
events: Record<string, {
|
|
325
|
+
tool: string;
|
|
326
|
+
payload: Record<string, unknown>;
|
|
327
|
+
}>;
|
|
328
|
+
}
|
|
329
|
+
export type AgentScope = Record<string, unknown>;
|
|
330
|
+
export interface AgentComponentRendererProps {
|
|
331
|
+
spec: ComponentSpec;
|
|
332
|
+
scope: AgentScope;
|
|
333
|
+
preview?: boolean;
|
|
334
|
+
renderChild: (child: ComponentSpec, childScope: AgentScope) => ReactElement | null;
|
|
335
|
+
}
|
|
336
|
+
export type AgentComponentRenderer = ComponentType<AgentComponentRendererProps>;
|
|
337
|
+
export interface ToolDataEnvelope {
|
|
338
|
+
tool: string;
|
|
339
|
+
data: unknown;
|
|
340
|
+
fetched_at: string;
|
|
341
|
+
}
|
|
342
|
+
export interface NxBarChartSeries {
|
|
343
|
+
key: string;
|
|
344
|
+
label: string;
|
|
345
|
+
color: string;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Series count above which a line chart reads as noise. Fold the tail into
|
|
349
|
+
* an Other bucket rather than passing more.
|
|
350
|
+
*/
|
|
351
|
+
export declare const NX_LINE_CHART_MAX_SERIES = 6;
|
|
352
|
+
/** Segments beyond this are folded into one neutral "Other" slice. */
|
|
353
|
+
export declare const NX_DONUT_MAX_SEGMENTS = 5;
|
|
354
|
+
export interface NxDonutSegment {
|
|
355
|
+
key: string;
|
|
356
|
+
label: string;
|
|
357
|
+
value: number;
|
|
358
|
+
color: string;
|
|
359
|
+
}
|
|
360
|
+
export declare const queryKeys: {
|
|
361
|
+
profileSelfProjection: (tenantId: string, legalEntityPublicId: string | null, appKey: string, familyKey: string, workContextRef?: string | null) => readonly ["profile-self", string, string | null, "projection", string, string, string | null];
|
|
362
|
+
agentToolData: (tool: string | undefined, tenantId: string, legalEntityPublicId: string | null, argsKey: string) => readonly ["agent-tool-data", string | undefined, string, string | null, string];
|
|
363
|
+
};
|
|
364
|
+
export declare function withOperatingUnit(path: string, operatingUnitPublicId: string | null): string;
|
|
365
|
+
export declare function parseRefreshHint(hint: string | undefined): number;
|
|
366
|
+
export declare function resolveTokens(value: unknown, scope: AgentScope): unknown;
|
|
367
|
+
/** Transport-neutral subset exposed by errors returned through the host API client. */
|
|
368
|
+
export interface HttpError {
|
|
369
|
+
isAxiosError: true;
|
|
370
|
+
response?: {
|
|
371
|
+
status?: number;
|
|
372
|
+
data?: unknown;
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
export declare function isHttpError(error: unknown): error is HttpError;
|
|
376
|
+
export declare function isAuthorityRevocationError(error: unknown): boolean;
|
|
377
|
+
export declare function chartCategoricalColor(index: number): string;
|
|
378
|
+
export type DashboardWidgetAutoHeightRef = RefCallback<HTMLElement>;
|
package/dist/platform.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Series count above which a line chart reads as noise. Fold the tail into
|
|
3
|
+
* an Other bucket rather than passing more.
|
|
4
|
+
*/
|
|
5
|
+
export const NX_LINE_CHART_MAX_SERIES = 6;
|
|
6
|
+
/** Segments beyond this are folded into one neutral "Other" slice. */
|
|
7
|
+
export const NX_DONUT_MAX_SEGMENTS = 5;
|
|
8
|
+
export const queryKeys = {
|
|
9
|
+
profileSelfProjection: (tenantId, legalEntityPublicId, appKey, familyKey, workContextRef = null) => [
|
|
10
|
+
'profile-self',
|
|
11
|
+
tenantId,
|
|
12
|
+
legalEntityPublicId,
|
|
13
|
+
'projection',
|
|
14
|
+
appKey,
|
|
15
|
+
familyKey,
|
|
16
|
+
workContextRef,
|
|
17
|
+
],
|
|
18
|
+
agentToolData: (tool, tenantId, legalEntityPublicId, argsKey) => [
|
|
19
|
+
'agent-tool-data',
|
|
20
|
+
tool,
|
|
21
|
+
tenantId,
|
|
22
|
+
legalEntityPublicId,
|
|
23
|
+
argsKey,
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
export function withOperatingUnit(path, operatingUnitPublicId) {
|
|
27
|
+
if (!operatingUnitPublicId)
|
|
28
|
+
return path;
|
|
29
|
+
const separator = path.includes('?') ? '&' : '?';
|
|
30
|
+
return `${path}${separator}operating_unit=${encodeURIComponent(operatingUnitPublicId)}`;
|
|
31
|
+
}
|
|
32
|
+
const DEFAULT_REFRESH_MS = 60_000;
|
|
33
|
+
const MIN_REFRESH_MS = 5_000;
|
|
34
|
+
export function parseRefreshHint(hint) {
|
|
35
|
+
if (!hint)
|
|
36
|
+
return DEFAULT_REFRESH_MS;
|
|
37
|
+
const match = /^(\d+)\s*(ms|s|m)?$/.exec(hint.trim());
|
|
38
|
+
if (!match)
|
|
39
|
+
return DEFAULT_REFRESH_MS;
|
|
40
|
+
const value = Number(match[1]);
|
|
41
|
+
if (!Number.isFinite(value) || value <= 0)
|
|
42
|
+
return DEFAULT_REFRESH_MS;
|
|
43
|
+
const unit = match[2] ?? 's';
|
|
44
|
+
const milliseconds = unit === 'ms'
|
|
45
|
+
? value
|
|
46
|
+
: unit === 'm'
|
|
47
|
+
? value * 60_000
|
|
48
|
+
: value * 1_000;
|
|
49
|
+
return Math.max(MIN_REFRESH_MS, milliseconds);
|
|
50
|
+
}
|
|
51
|
+
export function resolveTokens(value, scope) {
|
|
52
|
+
if (typeof value === 'string') {
|
|
53
|
+
const pure = value.match(/^\$\{([^}]+)\}$/);
|
|
54
|
+
if (pure)
|
|
55
|
+
return resolveTokenPath(pure[1].trim(), scope) ?? '';
|
|
56
|
+
return value.replace(/\$\{([^}]+)\}/g, (_match, path) => {
|
|
57
|
+
const resolved = resolveTokenPath(path.trim(), scope);
|
|
58
|
+
return typeof resolved === 'string'
|
|
59
|
+
|| typeof resolved === 'number'
|
|
60
|
+
|| typeof resolved === 'boolean'
|
|
61
|
+
? String(resolved)
|
|
62
|
+
: '';
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if (Array.isArray(value)) {
|
|
66
|
+
return value.map((entry) => resolveTokens(entry, scope));
|
|
67
|
+
}
|
|
68
|
+
if (isPlainObject(value)) {
|
|
69
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [
|
|
70
|
+
key,
|
|
71
|
+
resolveTokens(entry, scope),
|
|
72
|
+
]));
|
|
73
|
+
}
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
76
|
+
function resolveTokenPath(path, scope) {
|
|
77
|
+
if (path === '')
|
|
78
|
+
return undefined;
|
|
79
|
+
return path.split('.').reduce((current, segment) => {
|
|
80
|
+
if (!isPlainObject(current))
|
|
81
|
+
return undefined;
|
|
82
|
+
return current[segment];
|
|
83
|
+
}, scope);
|
|
84
|
+
}
|
|
85
|
+
function isPlainObject(value) {
|
|
86
|
+
if (value === null || typeof value !== 'object')
|
|
87
|
+
return false;
|
|
88
|
+
const prototype = Object.getPrototypeOf(value);
|
|
89
|
+
return prototype === null || prototype === Object.prototype;
|
|
90
|
+
}
|
|
91
|
+
export function isHttpError(error) {
|
|
92
|
+
return error !== null
|
|
93
|
+
&& typeof error === 'object'
|
|
94
|
+
&& 'response' in error;
|
|
95
|
+
}
|
|
96
|
+
export function isAuthorityRevocationError(error) {
|
|
97
|
+
if (!isHttpError(error))
|
|
98
|
+
return false;
|
|
99
|
+
return [401, 403, 404].includes(error.response?.status ?? 0);
|
|
100
|
+
}
|
|
101
|
+
const CHART_CATEGORICAL_FALLBACK = [
|
|
102
|
+
'#3987e5',
|
|
103
|
+
'#199e70',
|
|
104
|
+
'#c98500',
|
|
105
|
+
'#008300',
|
|
106
|
+
'#9085e9',
|
|
107
|
+
'#e66767',
|
|
108
|
+
'#d55181',
|
|
109
|
+
'#d95926',
|
|
110
|
+
];
|
|
111
|
+
export function chartCategoricalColor(index) {
|
|
112
|
+
const slot = index % CHART_CATEGORICAL_FALLBACK.length;
|
|
113
|
+
return `var(--nx-chart-${slot + 1}, ${CHART_CATEGORICAL_FALLBACK[slot]})`;
|
|
114
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { ComponentType, LazyExoticComponent } from 'react';
|
|
2
|
+
export type BpmnEditorNodeType = 'startEvent' | 'endEvent' | 'userTask' | 'serviceTask' | 'sendTask' | 'receiveTask' | 'businessRuleTask' | 'exclusiveGateway' | 'parallelGateway' | 'inclusiveGateway' | 'intermediateTimerCatchEvent' | 'intermediateMessageCatchEvent' | 'boundaryTimerEvent' | 'boundaryErrorEvent' | 'subProcess' | 'callActivity' | 'sequenceFlow';
|
|
3
|
+
export interface BpmnEditorElement {
|
|
4
|
+
id: string;
|
|
5
|
+
type: BpmnEditorNodeType;
|
|
6
|
+
name?: string;
|
|
7
|
+
sourceRef?: string;
|
|
8
|
+
targetRef?: string;
|
|
9
|
+
extensionElements?: {
|
|
10
|
+
nexia?: Record<string, unknown>;
|
|
11
|
+
};
|
|
12
|
+
flowElements?: BpmnEditorElement[];
|
|
13
|
+
}
|
|
14
|
+
export interface BpmnEditorProcess {
|
|
15
|
+
id: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
isExecutable: boolean;
|
|
18
|
+
flowElements: BpmnEditorElement[];
|
|
19
|
+
}
|
|
20
|
+
export interface BpmnEditorDocument {
|
|
21
|
+
definitions: {
|
|
22
|
+
id?: string;
|
|
23
|
+
name?: string;
|
|
24
|
+
targetNamespace?: string;
|
|
25
|
+
processes: BpmnEditorProcess[];
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare const DMN_EDITOR_HIT_POLICIES: readonly ["UNIQUE", "FIRST", "ANY", "COLLECT", "COLLECT_SUM", "COLLECT_MIN", "COLLECT_MAX", "COLLECT_COUNT"];
|
|
29
|
+
export type DmnEditorHitPolicy = (typeof DMN_EDITOR_HIT_POLICIES)[number];
|
|
30
|
+
export type DmnEditorValueType = 'string' | 'number' | 'boolean' | 'date' | 'dateTime' | 'duration' | 'list' | 'context';
|
|
31
|
+
export interface DmnEditorInputClause {
|
|
32
|
+
id: string;
|
|
33
|
+
label?: string;
|
|
34
|
+
type?: DmnEditorValueType;
|
|
35
|
+
}
|
|
36
|
+
export interface DmnEditorOutputClause {
|
|
37
|
+
id: string;
|
|
38
|
+
label: string;
|
|
39
|
+
type: DmnEditorValueType;
|
|
40
|
+
purpose?: 'plain' | 'enum' | 'assignmentGroup';
|
|
41
|
+
}
|
|
42
|
+
export interface DmnEditorRule {
|
|
43
|
+
id: string;
|
|
44
|
+
when: Record<string, unknown>;
|
|
45
|
+
then: Record<string, unknown>;
|
|
46
|
+
}
|
|
47
|
+
export interface DmnEditorDocument {
|
|
48
|
+
inputs: DmnEditorInputClause[];
|
|
49
|
+
outputs: DmnEditorOutputClause[];
|
|
50
|
+
rules: DmnEditorRule[];
|
|
51
|
+
hitPolicy: DmnEditorHitPolicy;
|
|
52
|
+
}
|
|
53
|
+
/** Canonical resource anchor for the process instance hosting a UserTask. */
|
|
54
|
+
export interface ProcessUserTaskResourceRef {
|
|
55
|
+
app_key: string;
|
|
56
|
+
resource_key: string;
|
|
57
|
+
resource_id: string;
|
|
58
|
+
resource_version?: string | null;
|
|
59
|
+
}
|
|
60
|
+
export interface ProcessUserTaskFormController {
|
|
61
|
+
/** Current widget validity; widgets re-register when this value changes. */
|
|
62
|
+
readonly canSubmit: boolean;
|
|
63
|
+
/** Build the App-owned input that Core forwards to the server-side handler. */
|
|
64
|
+
buildInput: () => Record<string, unknown>;
|
|
65
|
+
}
|
|
66
|
+
/** Versioned props for the closed `process.user_task.form` host slot. */
|
|
67
|
+
export interface ProcessUserTaskFormSlotPropsV1 {
|
|
68
|
+
slotApiVersion: 1;
|
|
69
|
+
legalEntityPublicId: string;
|
|
70
|
+
task: {
|
|
71
|
+
id: number;
|
|
72
|
+
processInstancePublicId: string;
|
|
73
|
+
elementId: string;
|
|
74
|
+
taskKey: string;
|
|
75
|
+
stateVersion: number;
|
|
76
|
+
};
|
|
77
|
+
resourceRef: ProcessUserTaskResourceRef | null;
|
|
78
|
+
registerController: (controller: ProcessUserTaskFormController | null) => void;
|
|
79
|
+
}
|
|
80
|
+
export type ProcessUserTaskFormWidgetLoader = () => Promise<{
|
|
81
|
+
default: ComponentType<ProcessUserTaskFormSlotPropsV1>;
|
|
82
|
+
}>;
|
|
83
|
+
export interface ProcessUserTaskFormRegistration {
|
|
84
|
+
componentKey: string;
|
|
85
|
+
loader: ProcessUserTaskFormWidgetLoader;
|
|
86
|
+
}
|
|
87
|
+
/** App-facing registration capability. Inspection remains host/test-only. */
|
|
88
|
+
export interface ProcessUserTaskFormRegistrar {
|
|
89
|
+
register(registration: ProcessUserTaskFormRegistration): void;
|
|
90
|
+
}
|
|
91
|
+
export interface ProcessUserTaskFormRegistry {
|
|
92
|
+
register(registration: ProcessUserTaskFormRegistration): void;
|
|
93
|
+
get: (componentKey: string) => LazyExoticComponent<ComponentType<ProcessUserTaskFormSlotPropsV1>> | null;
|
|
94
|
+
keys: () => string[];
|
|
95
|
+
subscribe: (listener: () => void) => () => void;
|
|
96
|
+
snapshot: () => number;
|
|
97
|
+
resetForTests: () => void;
|
|
98
|
+
}
|