@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.
Files changed (49) hide show
  1. package/dist/app-availability.d.ts +18 -0
  2. package/dist/app-availability.js +29 -0
  3. package/dist/approval.d.ts +180 -0
  4. package/dist/approval.js +9 -0
  5. package/dist/context.d.ts +49 -0
  6. package/dist/context.js +1 -0
  7. package/dist/data-migration.d.ts +123 -0
  8. package/dist/data-migration.js +70 -0
  9. package/dist/fixtures/approval-contract-negative.d.ts +1 -0
  10. package/dist/fixtures/approval-contract-negative.js +8 -0
  11. package/dist/handoff-result.d.ts +6 -0
  12. package/dist/handoff-result.js +17 -0
  13. package/dist/host.d.ts +602 -0
  14. package/dist/host.js +803 -0
  15. package/dist/index.d.ts +42 -0
  16. package/dist/index.js +21 -0
  17. package/dist/number.d.ts +2 -0
  18. package/dist/number.js +9 -0
  19. package/dist/organization-target.d.ts +101 -0
  20. package/dist/organization-target.js +105 -0
  21. package/dist/permissions.d.ts +3 -0
  22. package/dist/permissions.js +12 -0
  23. package/dist/platform.d.ts +378 -0
  24. package/dist/platform.js +114 -0
  25. package/dist/process.d.ts +98 -0
  26. package/dist/process.js +10 -0
  27. package/dist/resource-composition.d.ts +104 -0
  28. package/dist/resource-composition.js +576 -0
  29. package/dist/resource-create-destination.d.ts +17 -0
  30. package/dist/resource-create-destination.js +1 -0
  31. package/dist/resource-reference.d.ts +122 -0
  32. package/dist/resource-reference.js +203 -0
  33. package/dist/resources/resource-information.d.ts +128 -0
  34. package/dist/resources/resource-information.js +12 -0
  35. package/dist/resources/resource-list.d.ts +23 -0
  36. package/dist/resources/resource-list.js +1 -0
  37. package/dist/resources/resource-projections.d.ts +311 -0
  38. package/dist/resources/resource-projections.js +1 -0
  39. package/dist/resources/resource-transfer.d.ts +208 -0
  40. package/dist/resources/resource-transfer.js +1 -0
  41. package/dist/shell.d.ts +1297 -0
  42. package/dist/shell.js +1 -0
  43. package/dist/signature.d.ts +489 -0
  44. package/dist/signature.js +171 -0
  45. package/dist/spreadsheet.d.ts +42 -0
  46. package/dist/spreadsheet.js +15 -0
  47. package/dist/testing.d.ts +16 -0
  48. package/dist/testing.js +17 -0
  49. package/package.json +53 -0
@@ -0,0 +1,311 @@
1
+ export interface ResourceProjectionReference {
2
+ app_key: string;
3
+ resource_key: string;
4
+ resource_id: string;
5
+ display: string;
6
+ route?: string | null;
7
+ }
8
+ export interface ResourceBoardCard {
9
+ resource: ResourceProjectionReference;
10
+ summary: ResourceBoardSummaryField[];
11
+ version: number;
12
+ allowed_actions: string[];
13
+ }
14
+ export interface ResourceBoardSummaryField {
15
+ key: string;
16
+ label: string;
17
+ value: string | number | boolean | null;
18
+ }
19
+ export interface ResourceBoardLane {
20
+ key: string;
21
+ label: string;
22
+ count: number;
23
+ accepted_actions: string[];
24
+ cards: ResourceBoardCard[];
25
+ }
26
+ export interface ResourceBoardProjection {
27
+ board_key: string;
28
+ version: number;
29
+ lanes: ResourceBoardLane[];
30
+ filters?: Record<string, unknown>;
31
+ }
32
+ export interface ResourceBoardMoveCommand {
33
+ resource: ResourceProjectionReference;
34
+ source_lane: string;
35
+ target_lane: string;
36
+ target_order: number;
37
+ action_key: string;
38
+ expected_version: number;
39
+ idempotency_key: string;
40
+ }
41
+ export type ResourceBoardMutationResult = {
42
+ accepted: true;
43
+ projection: ResourceBoardProjection;
44
+ version: number;
45
+ replayed?: boolean;
46
+ } | {
47
+ accepted: false;
48
+ reason: string;
49
+ };
50
+ export type ResourceBoardLoadState = 'loading' | 'ready' | 'error';
51
+ export interface ResourceBoardLabels {
52
+ board: string;
53
+ laneCount: (laneLabel: string, count: number) => string;
54
+ moveCard: (resourceDisplay: string) => string;
55
+ moveError: (reason: string) => string;
56
+ }
57
+ export interface ResourceBoardProps {
58
+ projection?: ResourceBoardProjection | null;
59
+ state: ResourceBoardLoadState;
60
+ labels: ResourceBoardLabels;
61
+ readOnly?: boolean;
62
+ partiallyAuthorized?: boolean;
63
+ onRetry?: () => void;
64
+ onMove?: (command: ResourceBoardMoveCommand) => Promise<ResourceBoardMutationResult>;
65
+ onOpenResource?: (resource: ResourceProjectionReference) => void;
66
+ }
67
+ export type NxCalendarInteraction = 'reschedule' | 'resize';
68
+ export interface NxCalendarActionBinding {
69
+ interaction: NxCalendarInteraction;
70
+ action_key: string;
71
+ }
72
+ interface NxCalendarOccurrenceBase {
73
+ source_key: string;
74
+ app_key: string;
75
+ occurrence_id: string;
76
+ source_revision: string;
77
+ resource: ResourceProjectionReference | null;
78
+ title: string;
79
+ status?: string | null;
80
+ category?: string | null;
81
+ color_token?: string | null;
82
+ recurrence_id?: string | null;
83
+ exception_id?: string | null;
84
+ allowed_actions: NxCalendarActionBinding[];
85
+ owner_route?: string | null;
86
+ redacted?: boolean;
87
+ }
88
+ export type NxCalendarTemporalRange = {
89
+ start: string;
90
+ end: string;
91
+ all_day: true;
92
+ timezone: string;
93
+ } | {
94
+ start: string;
95
+ end: string;
96
+ all_day: false;
97
+ timezone: string;
98
+ };
99
+ export type NxCalendarOccurrence = NxCalendarOccurrenceBase & NxCalendarTemporalRange;
100
+ /** User-selected empty calendar range, suitable for pre-filling a create form. */
101
+ export type NxCalendarSelection = NxCalendarTemporalRange;
102
+ export interface NxCalendarRange {
103
+ /** Floating calendar-local ISO date/time without a UTC or offset suffix. */
104
+ start: string;
105
+ /** Floating calendar-local ISO date/time without a UTC or offset suffix. */
106
+ end: string;
107
+ timezone: string;
108
+ }
109
+ interface NxCalendarActionCommandBase {
110
+ source_key: string;
111
+ resource: ResourceProjectionReference;
112
+ occurrence_id: string;
113
+ recurrence_id?: string | null;
114
+ exception_id?: string | null;
115
+ interaction: NxCalendarInteraction;
116
+ action_key: string;
117
+ expected_source_revision: string;
118
+ idempotency_key: string;
119
+ }
120
+ export type NxCalendarActionCommand = NxCalendarActionCommandBase & NxCalendarTemporalRange;
121
+ export type NxCalendarActionResult = {
122
+ accepted: true;
123
+ occurrence: NxCalendarOccurrence;
124
+ reason?: null;
125
+ } | {
126
+ accepted: false;
127
+ occurrence?: null;
128
+ reason: string;
129
+ };
130
+ export type NxCalendarView = 'dayGridMonth' | 'timeGridWeek' | 'timeGridDay' | 'listWeek';
131
+ export interface NxCalendarProps {
132
+ occurrences: NxCalendarOccurrence[];
133
+ timezone: string;
134
+ locale: string;
135
+ initialView?: NxCalendarView;
136
+ loading?: boolean;
137
+ error?: boolean;
138
+ readOnly?: boolean;
139
+ fill?: boolean;
140
+ /** Renders occurrences as simple text controls instead of filled event bands. */
141
+ eventAppearance?: 'default' | 'text';
142
+ /** Keeps the calendar grid visible without a separate empty-state notice. */
143
+ showEmptyState?: boolean;
144
+ loadingLabel: string;
145
+ emptyTitle: string;
146
+ emptyDescription: string;
147
+ errorTitle: string;
148
+ errorDescription: string;
149
+ readOnlyDescription: string;
150
+ retryLabel: string;
151
+ actionErrorMessage: (reason: string) => string;
152
+ keyboardInstructions: string;
153
+ onRangeChange?: (range: NxCalendarRange) => void;
154
+ onSelectRange?: (selection: NxCalendarSelection) => void;
155
+ onRetry?: () => void;
156
+ onOpenResource?: (occurrence: NxCalendarOccurrence) => void;
157
+ /** Opens an occurrence even when it does not represent a Resource. */
158
+ onOpenOccurrence?: (occurrence: NxCalendarOccurrence) => void;
159
+ onAction?: (command: NxCalendarActionCommand) => Promise<NxCalendarActionResult>;
160
+ createIdempotencyKey?: () => string;
161
+ 'data-testid'?: string;
162
+ }
163
+ export type NxResourceSchedulerInteraction = NxCalendarInteraction | 'reassign';
164
+ export interface NxResourceSchedulerActionBinding {
165
+ interaction: NxResourceSchedulerInteraction;
166
+ action_key: string;
167
+ }
168
+ export interface NxResourceSchedulerResource {
169
+ id: string;
170
+ label: string;
171
+ parent_id?: string | null;
172
+ color?: string | null;
173
+ metadata?: Record<string, unknown>;
174
+ }
175
+ export type NxResourceSchedulerOccurrence = Omit<NxCalendarOccurrence, 'allowed_actions'> & {
176
+ resource_ids: string[];
177
+ allowed_actions: NxResourceSchedulerActionBinding[];
178
+ };
179
+ /** Empty scheduler range selected by the user, including its resource lane. */
180
+ export type NxResourceSchedulerSelection = NxCalendarSelection & {
181
+ resource_ids: string[];
182
+ };
183
+ export type NxResourceSchedulerActionCommand = Omit<NxCalendarActionCommand, 'interaction' | 'action_key'> & {
184
+ interaction: NxResourceSchedulerInteraction;
185
+ action_key: string;
186
+ resource_ids: string[];
187
+ };
188
+ export type NxResourceSchedulerActionResult = {
189
+ accepted: true;
190
+ occurrence: NxResourceSchedulerOccurrence;
191
+ reason?: null;
192
+ } | {
193
+ accepted: false;
194
+ occurrence?: null;
195
+ reason: string;
196
+ };
197
+ export type NxResourceSchedulerView = 'resourceTimeGridDay' | 'resourceTimeGridWeek' | 'resourceTimelineDay' | 'resourceTimelineWeek' | 'resourceTimelineMonth';
198
+ export interface NxResourceSchedulerProps {
199
+ resources: NxResourceSchedulerResource[];
200
+ occurrences: NxResourceSchedulerOccurrence[];
201
+ timezone: string;
202
+ locale: string;
203
+ initialView?: NxResourceSchedulerView;
204
+ loading?: boolean;
205
+ error?: boolean;
206
+ readOnly?: boolean;
207
+ fill?: boolean;
208
+ loadingLabel: string;
209
+ emptyTitle: string;
210
+ emptyDescription: string;
211
+ errorTitle: string;
212
+ errorDescription: string;
213
+ readOnlyDescription: string;
214
+ retryLabel: string;
215
+ resourceAreaLabel: string;
216
+ actionErrorMessage: (reason: string) => string;
217
+ onRangeChange?: (range: NxCalendarRange) => void;
218
+ onSelectRange?: (selection: NxResourceSchedulerSelection) => void;
219
+ onRetry?: () => void;
220
+ onOpenResource?: (resource: NxResourceSchedulerResource) => void;
221
+ onOpenOccurrence?: (occurrence: NxResourceSchedulerOccurrence) => void;
222
+ onAction?: (command: NxResourceSchedulerActionCommand) => Promise<NxResourceSchedulerActionResult>;
223
+ createIdempotencyKey?: () => string;
224
+ 'data-testid'?: string;
225
+ }
226
+ export type ResourceScheduleView = 'gantt' | 'schedule-timeline';
227
+ export type ResourceScheduleLoadState = 'loading' | 'ready' | 'error';
228
+ export type ResourceScheduleDateSemantics = 'date_only' | 'timed';
229
+ export type ResourceScheduleItemType = 'task' | 'milestone';
230
+ export type ResourceScheduleDependencyType = 'finish_to_start' | 'start_to_start' | 'finish_to_finish' | 'start_to_finish';
231
+ export type ResourceScheduleInteraction = 'reschedule' | 'create_dependency' | 'delete_dependency';
232
+ export type ResourceScheduleTimeUnit = 'day' | 'minute';
233
+ export interface ResourceScheduleActionBinding {
234
+ interaction: ResourceScheduleInteraction;
235
+ action_key: string;
236
+ }
237
+ export interface ResourceScheduleDatePair {
238
+ start: string;
239
+ end: string;
240
+ }
241
+ export interface ResourceScheduleItem {
242
+ resource: ResourceProjectionReference;
243
+ type: ResourceScheduleItemType;
244
+ date_semantics: ResourceScheduleDateSemantics;
245
+ start: string;
246
+ end: string;
247
+ duration: number;
248
+ duration_unit: ResourceScheduleTimeUnit;
249
+ progress: number;
250
+ version: string;
251
+ allowed_actions: ResourceScheduleActionBinding[];
252
+ parent?: ResourceProjectionReference | null;
253
+ group?: ResourceProjectionReference | null;
254
+ baseline?: ResourceScheduleDatePair | null;
255
+ actual?: ResourceScheduleDatePair | null;
256
+ work_calendar_reference?: string | null;
257
+ owner_route?: string | null;
258
+ }
259
+ export interface ResourceScheduleDependency {
260
+ id: string;
261
+ source: ResourceProjectionReference;
262
+ target: ResourceProjectionReference;
263
+ type: ResourceScheduleDependencyType;
264
+ lag: number;
265
+ lag_unit: ResourceScheduleTimeUnit;
266
+ }
267
+ export interface ResourceScheduleProjection {
268
+ schedule_key: string;
269
+ revision: string;
270
+ items: ResourceScheduleItem[];
271
+ dependencies: ResourceScheduleDependency[];
272
+ }
273
+ interface ResourceScheduleActionCommandBase {
274
+ schedule_key: string;
275
+ resource: ResourceProjectionReference;
276
+ interaction: ResourceScheduleInteraction;
277
+ action_key: string;
278
+ expected_projection_revision: string;
279
+ expected_resource_version: string;
280
+ idempotency_key: string;
281
+ }
282
+ export type ResourceScheduleActionCommand = (ResourceScheduleActionCommandBase & {
283
+ interaction: 'reschedule';
284
+ start: string;
285
+ end: string;
286
+ date_semantics: ResourceScheduleDateSemantics;
287
+ }) | (ResourceScheduleActionCommandBase & {
288
+ interaction: 'create_dependency' | 'delete_dependency';
289
+ dependency: ResourceScheduleDependency;
290
+ });
291
+ export interface ResourceScheduleMutationResult {
292
+ accepted: boolean;
293
+ projection: ResourceScheduleProjection;
294
+ reason?: string | null;
295
+ replayed?: boolean;
296
+ }
297
+ export interface ResourceScheduleProps {
298
+ projection?: ResourceScheduleProjection | null;
299
+ state: ResourceScheduleLoadState;
300
+ view?: ResourceScheduleView;
301
+ fill?: boolean;
302
+ readOnly?: boolean;
303
+ partiallyAuthorized?: boolean;
304
+ onRetry?: () => void;
305
+ onAction?: (command: ResourceScheduleActionCommand) => Promise<ResourceScheduleMutationResult>;
306
+ /** Opens the caller-owned creation flow from the schedule's native add affordance. */
307
+ onCreateResource?: (parent?: ResourceProjectionReference) => void;
308
+ onOpenResource?: (resource: ResourceProjectionReference) => void;
309
+ createIdempotencyKey?: () => string;
310
+ }
311
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,208 @@
1
+ import type { ReactNode } from "react";
2
+ import type { ResourceCreateContinuationTarget } from "../shell";
3
+ /** Lifecycle states returned by resource import endpoints. */
4
+ export type ResourceImportRunStatus = "queued" | "processing" | "completed" | "completed_with_errors" | "failed";
5
+ export type ResourceTransferFormat = "csv" | "xlsx" | "txt" | "json" | string;
6
+ export interface ResourceTransferMessage {
7
+ key: string;
8
+ params?: Record<string, string | number>;
9
+ }
10
+ /** Transfer capabilities published as `meta.resource_transfer`. */
11
+ export interface ResourceTransferMeta {
12
+ resource_key: string;
13
+ schema: {
14
+ columns: Array<{
15
+ key: string;
16
+ label: string;
17
+ type: string;
18
+ required: boolean;
19
+ importable: boolean;
20
+ exportable: boolean;
21
+ unique_import_key: boolean;
22
+ export_sensitive?: boolean;
23
+ export_requires_purpose?: boolean;
24
+ export_requires_fresh_authentication?: boolean;
25
+ }>;
26
+ };
27
+ schema_hash: string;
28
+ formats: ResourceTransferFormat[];
29
+ export_formats?: ResourceTransferFormat[];
30
+ import_formats?: ResourceTransferFormat[];
31
+ row_limits: {
32
+ export: number;
33
+ import: number;
34
+ };
35
+ actions: {
36
+ export: string;
37
+ /** Queue-first export endpoint. Absent on older hosts. */
38
+ export_start?: string;
39
+ template: string;
40
+ preview: string;
41
+ import: string;
42
+ };
43
+ allowed: {
44
+ export: boolean;
45
+ import: boolean;
46
+ };
47
+ export_context?: {
48
+ title: string;
49
+ items: Array<{
50
+ label: string;
51
+ value: string | number;
52
+ value_label?: string;
53
+ }>;
54
+ };
55
+ }
56
+ export interface ResourceImportPreviewRow {
57
+ line: number;
58
+ values: Record<string, string | null>;
59
+ errors: ResourceTransferMessage[];
60
+ }
61
+ export interface ResourceImportPreview {
62
+ format: string;
63
+ total_rows: number;
64
+ file_headers: string[];
65
+ headers: {
66
+ unknown: string[];
67
+ missing: string[];
68
+ };
69
+ columns: Array<{
70
+ key: string;
71
+ label: string;
72
+ required: boolean;
73
+ unique_import_key: boolean;
74
+ }>;
75
+ preview_rows: ResourceImportPreviewRow[];
76
+ }
77
+ export interface ResourceImportSummary {
78
+ rows: number;
79
+ created: number;
80
+ skipped: number;
81
+ errors: number;
82
+ error_rows?: Array<{
83
+ row: number;
84
+ errors: ResourceTransferMessage[];
85
+ }>;
86
+ message?: ResourceTransferMessage;
87
+ }
88
+ export interface ResourceImportRun {
89
+ id: number;
90
+ resource_key: string;
91
+ direction: string;
92
+ format: string;
93
+ status: ResourceImportRunStatus;
94
+ status_url: string;
95
+ }
96
+ export interface ResourceImportResponse {
97
+ run: ResourceImportRun;
98
+ summary: ResourceImportSummary | null;
99
+ }
100
+ /**
101
+ * Host-owned import workflow that Apps may embed in a management workspace.
102
+ *
103
+ * Apps provide only the authorized endpoint descriptors and refresh callback;
104
+ * upload intents, parsing, preview, polling, and result chrome remain owned by
105
+ * Core. This is intentionally the same workflow used by generated Resource
106
+ * lists so an App must not rebuild spreadsheet handling locally.
107
+ */
108
+ export interface NxResourceImportDialogProps {
109
+ open: boolean;
110
+ onClose: () => void;
111
+ previewUrl: string;
112
+ importUrl: string;
113
+ templateUrl: string;
114
+ formats?: string[];
115
+ onImported: () => void | Promise<void>;
116
+ translationPrefix?: string;
117
+ testIdPrefix?: string;
118
+ }
119
+ /** Host-owned Resource Transfer actions for list and management surfaces. */
120
+ export interface NxResourceTransferActionsProps {
121
+ transferMeta: ResourceTransferMeta | null | undefined;
122
+ onImported: () => void | Promise<void>;
123
+ translationPrefix?: string;
124
+ testIdPrefix?: string;
125
+ }
126
+ export interface DatasetImportConfirmationSummary {
127
+ resourceKey: string;
128
+ totalRows: number;
129
+ willCreate: number;
130
+ willUpdate: number;
131
+ willReject: number;
132
+ }
133
+ /** Shared mapped-dataset import workspace for App management destinations. */
134
+ export interface NxDatasetImportWorkspaceProps {
135
+ sourceProfileKey?: string;
136
+ showSourceSelector?: boolean;
137
+ resourceKey: string;
138
+ /** App-owned reference review above the shared editable preview. */
139
+ renderReferenceReview?: (context: {
140
+ rows: Array<{
141
+ line: number;
142
+ values: Record<string, string | null>;
143
+ issues?: Array<{
144
+ kind: string;
145
+ field: string;
146
+ value: string;
147
+ reference_kind?: string;
148
+ reference_value?: string;
149
+ label_key?: string;
150
+ message_key?: string;
151
+ }>;
152
+ }>;
153
+ busy: boolean;
154
+ recheck: () => void;
155
+ /** Open an offered reference editor after preserving the import draft. */
156
+ createReference: (kind: string, seed: string) => void;
157
+ /** Apply edits to source rows and rerun the existing validation pipeline. */
158
+ applyChanges: (changes: Record<string, Record<string, string | null>>) => Promise<void>;
159
+ }) => ReactNode;
160
+ /** Allowed display values, keyed by import column. Domain lookup remains App-owned. */
161
+ cellOptions?: Record<string, string[]>;
162
+ inlineEditing?: boolean;
163
+ onCompleted?: (result: Record<string, unknown>) => void | Promise<void>;
164
+ /** Called when an ordinary Resource Transfer import has been accepted by the queue. */
165
+ onQueued?: (operation: {
166
+ ticket: string;
167
+ statusUrl: string;
168
+ }) => void | Promise<void>;
169
+ /** Hide the dataset name and generic import help when the containing page already supplies them. */
170
+ showHeader?: boolean;
171
+ /** Render template downloads in the standard overflow menu used by list toolbars. */
172
+ templateMenuVariant?: "button" | "overflow";
173
+ /** Return to the upload-only state after a completed ticket reports zero row errors. */
174
+ resetOnSuccessfulCompletion?: boolean;
175
+ /** App-owned copy shown on the primary button while the commit is running. */
176
+ processingLabel?: string;
177
+ /** App-owned title for domain-specific apply semantics; Core supplies only counts. */
178
+ confirmationTitle?: (summary: DatasetImportConfirmationSummary) => string;
179
+ testIdPrefix?: string;
180
+ /** App-owned canonical create actions for reference issues reported by its pipeline. */
181
+ referenceCreateActions?: Record<string, {
182
+ label: string;
183
+ onCreate: (seed: string) => void;
184
+ continuation: ResourceCreateContinuationTarget;
185
+ }>;
186
+ /** Keep stable App-owned decisions while a contextual reference create is completed and rechecked. */
187
+ preserveDecisionsOnReferenceRefresh?: boolean;
188
+ /** Drop submitted decisions that the refreshed App plan no longer offers. */
189
+ retainOnlyOfferedDecisions?: boolean;
190
+ }
191
+ /** Shared export workspace for an App-contributed dataset. */
192
+ export interface NxDatasetExportWorkspaceProps {
193
+ resourceKey: string;
194
+ legalEntityPublicId?: string | null;
195
+ operatingUnitPublicId?: string | null;
196
+ asOf?: string | null;
197
+ testIdPrefix?: string;
198
+ /** Render the export action as a standard overflow menu in compact action areas. */
199
+ triggerVariant?: "button" | "overflow";
200
+ /** App-owned actions appended to the same overflow menu as export. */
201
+ overflowItems?: Array<{
202
+ id: string;
203
+ label: string;
204
+ disabled?: boolean;
205
+ testId?: string;
206
+ onSelect: () => void;
207
+ }>;
208
+ }
@@ -0,0 +1 @@
1
+ export {};