@plugmatica/plugin-sdk 0.0.0-stage → 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.
@@ -0,0 +1,1465 @@
1
+ import { TranslationValues } from '@plugmatica/i18n';
2
+ export { declareMessages } from '@plugmatica/i18n';
3
+ import * as _plugmatica_core_sdk from '@plugmatica/core-sdk';
4
+ import { WorkflowValidationIssue, WorkflowGraphNode, WorkflowNodeAuthoringDescriptor, WorkflowNodeDescriptor, WorkflowGraph, ConnectionProfile, WorkflowNodeCatalogEntries } from '@plugmatica/core-sdk';
5
+ export { WorkflowNodeCatalogContribution, WorkflowNodeCatalogEntries } from '@plugmatica/core-sdk';
6
+ import * as React from 'react';
7
+ import { ReactNode, ComponentType } from 'react';
8
+ import { P as PluginRenderContext, a as PluginApiClient, b as PluginI18nApi, c as PluginSession, d as PluginGuestSessionApi, e as PluginNavigationApi, f as PluginWorkflowManagementApi, g as PluginWorkflowRealtimeApi, h as PluginManagedResourceApi, i as PluginExtensionsApi, j as PluginApiRequestOptions } from './types-83DpQEKd.js';
9
+ import { StructuredUiExtensionModule } from './advanced.js';
10
+ export { E as ExtensionRuntimeDiagnostic, k as ExtensionRuntimeErrorCode, F as FederatedPlugin, l as FieldValidationIssue, m as PluginApiResponseMeta, n as PluginIdentity, o as PluginNavigationOptions, p as PluginWorkflowListChange, q as PluginWorkflowListSubscription, r as PluginWorkflowRunChange, s as PluginWorkflowRunRealtimeStatus, t as PluginWorkflowRunSubscription } from './types-83DpQEKd.js';
11
+ export { DefinedExtensionComponent, EventHandlerDefinition, EventHandlerTarget, EventPayloadOf, ExtensionContributionDefinition, OperationHookDefinition, OperationHookTarget, OperationPayloadOf, OperationResultOf, PluginAction, PluginActionMap, ProviderDefinition, ProviderRequestOf, ProviderTarget, ProviderValueOf, RenderableUiExtensionDefinition, StructuredUiExtensionDefinition, UiContributionOf, UiExtensionDefinition, UiExtensionTarget, defineActions, defineEventHandler, defineExtension, defineOperationHook, defineProvider, defineRepeatedInstances, extensionTarget } from './advanced.js';
12
+ import '@plugmatica/ui-kit/host';
13
+
14
+ /**
15
+ * Validate an explicit, full-document external navigation destination.
16
+ * SPA navigation must continue to use PluginNavigationApi.navigate().
17
+ * Only secure browser destinations, never javascript:/data:/relative URLs,
18
+ * may cross this host-managed boundary.
19
+ */
20
+ declare function assertExternalNavigationUrl(destination: string): string;
21
+
22
+ /**
23
+ * Public type contract for plugin runtime.
24
+ */
25
+ type PluginRuntime = {
26
+ /**
27
+ * Scoped plugin render context.
28
+ */
29
+ context: PluginRenderContext;
30
+ /**
31
+ * Plugin-scoped API client.
32
+ */
33
+ api: PluginApiClient;
34
+ /**
35
+ * Plugin-scoped internationalization API.
36
+ */
37
+ i18n: PluginI18nApi;
38
+ /**
39
+ * Current runtime session.
40
+ */
41
+ session: PluginSession;
42
+ /**
43
+ * Guest-session lifecycle API when running in guest mode.
44
+ */
45
+ guest?: PluginGuestSessionApi;
46
+ /**
47
+ * Host navigation capability.
48
+ */
49
+ navigation: PluginNavigationApi;
50
+ /** Narrow host-mediated workflow management capability when granted by the host. */
51
+ workflows?: PluginWorkflowManagementApi;
52
+ /** Resource-scoped workflow realtime subscriptions, only when granted by the host. */
53
+ workflowRealtime?: PluginWorkflowRealtimeApi;
54
+ /** Host-mediated managed-resource capability when granted by the host. */
55
+ managedResources?: PluginManagedResourceApi;
56
+ /**
57
+ * Extension-runtime capability set.
58
+ */
59
+ extensions: PluginExtensionsApi;
60
+ };
61
+ /**
62
+ * Create the normalized runtime capabilities consumed by plugin hooks and providers.
63
+ *
64
+ * @param context Scoped runtime context for this callback/operation.
65
+ * @returns Normalized runtime used by `PluginRuntimeProvider` and SDK hooks.
66
+ */
67
+ declare function createPluginRuntime(context: PluginRenderContext): PluginRuntime;
68
+ /**
69
+ * Provide one normalized plugin runtime to SDK hooks and the UI extension runtime.
70
+ *
71
+ * @param props Component/provider properties.
72
+ * @returns React provider element that makes the supplied plugin runtime available to descendant SDK hooks.
73
+ */
74
+ declare function PluginRuntimeProvider({ value, children, }: {
75
+ value: PluginRuntime;
76
+ children: React.ReactNode;
77
+ }): React.JSX.Element;
78
+ /**
79
+ * Return the host-supplied render context for the current plugin.
80
+ *
81
+ * @returns Current plugin render context.
82
+ */
83
+ declare const usePluginContext: () => PluginRenderContext;
84
+ /**
85
+ * Return the plugin-scoped API client for the current plugin.
86
+ *
87
+ * @returns Current plugin-scoped API client.
88
+ *
89
+ * @example
90
+ * ```tsx
91
+ * const api = usePluginApi();
92
+ * const customer = await api.get<Customer>(`/customers/${customerPid}`);
93
+ * ```
94
+ */
95
+ declare const usePluginApi: () => PluginApiClient;
96
+ /**
97
+ * Return extension-runtime capabilities scoped to the current plugin.
98
+ *
99
+ * @returns Current plugin extension-runtime API.
100
+ */
101
+ declare const usePluginExtensions: () => PluginExtensionsApi;
102
+ /**
103
+ * Return the host navigation capability for the current plugin.
104
+ *
105
+ * @returns Current host navigation API.
106
+ *
107
+ * @example
108
+ * ```tsx
109
+ * const navigation = usePluginNavigation();
110
+ * await navigation.navigate(`/customers/${customerPid}`);
111
+ * ```
112
+ */
113
+ declare const usePluginNavigation: () => PluginNavigationApi;
114
+ /** Return workflow management when the host explicitly grants it to this plugin. */
115
+ declare const usePluginWorkflows: () => PluginWorkflowManagementApi;
116
+ /** Optional realtime feature. Missing means the existing REST path stays active. */
117
+ declare const usePluginWorkflowRealtime: () => PluginWorkflowRealtimeApi | undefined;
118
+ /** Return managed-resource administration when the host explicitly grants it to this plugin. */
119
+ declare const usePluginManagedResources: () => PluginManagedResourceApi;
120
+ /**
121
+ * Return the translation API scoped to the current plugin namespace.
122
+ * Shared platform vocabulary remains available through `$common` and `$terms`.
123
+ *
124
+ * @returns Scoped translation API for the current plugin.
125
+ *
126
+ * @example
127
+ * ```tsx
128
+ * const { t } = usePluginI18n();
129
+ * return <Button>{t("actions.save")}</Button>;
130
+ * ```
131
+ */
132
+ declare function usePluginI18n(): PluginI18nApi;
133
+ /**
134
+ * Props for {@link PluginMessage}.
135
+ *
136
+ * `id` uses the same plugin-local/shared translation-reference rules as
137
+ * {@link usePluginI18n}. Values are forwarded to ICU message formatting.
138
+ */
139
+ type PluginMessageProps = {
140
+ /** Static plugin-local or shared translation reference. */
141
+ id: string;
142
+ /** Optional ICU interpolation/pluralisation values. */
143
+ values?: TranslationValues;
144
+ };
145
+ /**
146
+ * Render one translated message at the point a static descriptor is rendered.
147
+ *
148
+ * This is intentionally a render-boundary component, not a second translation
149
+ * API. Normal components should continue to call {@link usePluginI18n}. Use
150
+ * `PluginMessage` when a module-level/static descriptor needs translated React
151
+ * content without moving that descriptor into a hook-owning component.
152
+ *
153
+ * The plugin build scanner recognises static `id` values here exactly like
154
+ * `t("...")`, so local and shared catalogue dependencies remain build-time
155
+ * discoverable.
156
+ *
157
+ * @example
158
+ * ```tsx
159
+ * const columns = [
160
+ * {
161
+ * accessorKey: "name",
162
+ * header: () => <PluginMessage id="customers.name" />,
163
+ * },
164
+ * ];
165
+ * ```
166
+ */
167
+ declare function PluginMessage({ id, values }: PluginMessageProps): React.JSX.Element;
168
+ /**
169
+ * Return the current plugin session.
170
+ *
171
+ * @returns Current runtime session.
172
+ */
173
+ declare const usePluginSession: () => _plugmatica_core_sdk.RuntimeSession;
174
+ /**
175
+ * Return guest-session lifecycle controls when the plugin is running in public or kiosk mode.
176
+ *
177
+ * @returns Guest-session API, or `undefined` for authenticated runtimes.
178
+ */
179
+ declare const usePluginGuestSession: () => PluginGuestSessionApi | undefined;
180
+
181
+ /**
182
+ * Field kinds supported by Plugmatica object-resource entity schemas.
183
+ */
184
+ type PluginEntityFieldKind = "id" | "string" | "integer" | "number" | "boolean" | "date" | "date_time" | "json" | "blob_ref" | "entity_ref";
185
+ /**
186
+ * Sensitivity levels attached to object-resource fields.
187
+ */
188
+ type PluginEntityFieldSensitivity = "normal" | "sensitive" | "secret";
189
+ /**
190
+ * One effective entity field after owner and augmentation schemas have been merged.
191
+ */
192
+ type EffectiveEntityField = {
193
+ /**
194
+ * Stable field/remote/contribution name.
195
+ */
196
+ name: string;
197
+ /**
198
+ * Plugin that owns the effective field definition.
199
+ */
200
+ ownerPlugin: string;
201
+ /**
202
+ * Whether the field originates from the base entity or an augmentation.
203
+ */
204
+ ownerKind: "entity" | "augmentation";
205
+ /**
206
+ * Entity or augmentation key that owns the field.
207
+ */
208
+ ownerKey: string;
209
+ /**
210
+ * Effective field descriptor and access metadata.
211
+ */
212
+ descriptor: {
213
+ name: string;
214
+ kind: PluginEntityFieldKind;
215
+ nullable: boolean;
216
+ id: boolean;
217
+ indexed: boolean;
218
+ /** Target entity metadata for entity_ref fields. */
219
+ entityRef?: {
220
+ plugin: string;
221
+ entity: string;
222
+ } | null;
223
+ access: {
224
+ sensitivity: PluginEntityFieldSensitivity;
225
+ readCapability?: string | null;
226
+ writeCapability?: string | null;
227
+ };
228
+ };
229
+ };
230
+ /**
231
+ * One augmentation included in an effective entity schema.
232
+ */
233
+ type EffectiveEntityAugmentation = {
234
+ /**
235
+ * Plugin identifier or plugin identity associated with this value.
236
+ */
237
+ plugin: string;
238
+ /**
239
+ * Stable entity augmentation or contribution key.
240
+ */
241
+ key: string;
242
+ /**
243
+ * Schema version associated with this entity value/definition.
244
+ */
245
+ schemaVersion: number;
246
+ /**
247
+ * Augmentation depth from the base entity.
248
+ */
249
+ depth: number;
250
+ /**
251
+ * Generated/normalized target identifying what this extension or augmentation applies to.
252
+ */
253
+ target: {
254
+ kind: "entity";
255
+ plugin: string;
256
+ entity: string;
257
+ } | {
258
+ kind: "augmentation";
259
+ plugin: string;
260
+ augmentation: string;
261
+ };
262
+ };
263
+ /**
264
+ * Effective object-resource schema returned by the runtime for an entity.
265
+ */
266
+ type EffectiveEntitySchema = {
267
+ /**
268
+ * Plugin identifier or plugin identity associated with this value.
269
+ */
270
+ plugin: string;
271
+ /**
272
+ * Entity resource name.
273
+ */
274
+ entity: string;
275
+ /**
276
+ * Schema version associated with this entity value/definition.
277
+ */
278
+ schemaVersion: number;
279
+ /**
280
+ * Revision fingerprint for the effective merged entity shape.
281
+ */
282
+ shapeRevision: string;
283
+ /**
284
+ * Fields included in the effective entity schema/export.
285
+ */
286
+ fields: EffectiveEntityField[];
287
+ /**
288
+ * Augmentations included in the effective entity schema.
289
+ */
290
+ augmentations: EffectiveEntityAugmentation[];
291
+ };
292
+ /**
293
+ * Entity value plus optimistic-concurrency and schema metadata.
294
+ */
295
+ type EntityEnvelope<T> = {
296
+ /**
297
+ * Entity or provider value represented by this result.
298
+ */
299
+ value: T;
300
+ /**
301
+ * Optimistic-concurrency revision of the entity.
302
+ */
303
+ revision: number;
304
+ /**
305
+ * Schema version associated with this entity value/definition.
306
+ */
307
+ schemaVersion: number;
308
+ };
309
+ /**
310
+ * Paginated entity-list response returned by object-resource APIs.
311
+ */
312
+ type EntityListResponse<T> = {
313
+ /**
314
+ * Items returned by this paginated/preview result.
315
+ */
316
+ items: EntityEnvelope<T>[];
317
+ /**
318
+ * Cursor for the next page, or `null` when there is no next page.
319
+ */
320
+ nextCursor: string | null;
321
+ };
322
+ /**
323
+ * Pagination options for listing object-resource entities.
324
+ */
325
+ type EntityListOptions = {
326
+ /**
327
+ * Maximum number of items/rows to return.
328
+ */
329
+ limit?: number;
330
+ /**
331
+ * Cursor identifying the next entity-list page.
332
+ */
333
+ cursor?: string | number | null;
334
+ };
335
+ /**
336
+ * Optimistic-concurrency update request for one entity.
337
+ */
338
+ type EntityUpdate<T> = {
339
+ /**
340
+ * Entity revision that must still be current for the write to succeed.
341
+ */
342
+ expectedRevision: number;
343
+ /**
344
+ * Partial entity fields to update.
345
+ */
346
+ patch: Partial<T>;
347
+ };
348
+ /**
349
+ * Filter expression applied by object-resource list/export operations.
350
+ */
351
+ type EntityFilterOperator = "eq" | "in" | "contains" | "startsWith" | "endsWith" | "gt" | "lt";
352
+ type EntityFilter = {
353
+ /**
354
+ * Entity field referenced by this filter/error.
355
+ */
356
+ field: string;
357
+ /**
358
+ * Indexed filter operator. Omitted values preserve equality semantics.
359
+ */
360
+ operator?: EntityFilterOperator;
361
+ /**
362
+ * Indexed filter value. `in` requires a non-empty array. Legacy equality
363
+ * arrays retain any-of semantics; separate filters are ANDed.
364
+ */
365
+ value: unknown;
366
+ };
367
+ /**
368
+ * Public bulk modes available to plugin/frontend code.
369
+ *
370
+ * `restore` is intentionally absent. Trusted restore is a host/platform-admin
371
+ * capability and must not be exposed through the plugin SDK.
372
+ */
373
+ type EntityBulkMode = "full" | "validated";
374
+ /**
375
+ * One create row submitted to the immediate bulk-write API.
376
+ */
377
+ type EntityBulkCreateRow<T> = {
378
+ /**
379
+ * Optional caller-supplied row identifier echoed in results/errors.
380
+ */
381
+ clientRowId?: string;
382
+ /**
383
+ * Entity or provider value represented by this result.
384
+ */
385
+ value: Partial<T>;
386
+ };
387
+ /**
388
+ * One update row submitted to the immediate bulk-write API.
389
+ */
390
+ type EntityBulkUpdateRow<T> = {
391
+ /**
392
+ * Optional caller-supplied row identifier echoed in results/errors.
393
+ */
394
+ clientRowId?: string;
395
+ /**
396
+ * Persistent entity identifier.
397
+ */
398
+ pid: string;
399
+ /**
400
+ * Entity revision that must still be current for the write to succeed.
401
+ */
402
+ expectedRevision: number;
403
+ /**
404
+ * Partial entity fields to update.
405
+ */
406
+ patch: Partial<T>;
407
+ };
408
+ /**
409
+ * Immediate bounded bulk-write request for create or update operations.
410
+ */
411
+ type EntityBulkWriteRequest<T> = {
412
+ mode: "validated";
413
+ writeMode: "create";
414
+ rows: EntityBulkCreateRow<T>[];
415
+ } | {
416
+ mode: "full";
417
+ writeMode: "create";
418
+ rows: EntityBulkCreateRow<T>[];
419
+ } | {
420
+ mode: "full";
421
+ writeMode: "update";
422
+ rows: EntityBulkUpdateRow<T>[];
423
+ };
424
+ /**
425
+ * Successful row result returned by an immediate bulk write.
426
+ */
427
+ type EntityBulkRowResult = {
428
+ /**
429
+ * Zero-based input row index.
430
+ */
431
+ index: number;
432
+ /**
433
+ * Optional caller-supplied row identifier echoed in results/errors.
434
+ */
435
+ clientRowId?: string | null;
436
+ /**
437
+ * Persistent entity identifier.
438
+ */
439
+ pid: string;
440
+ /**
441
+ * Optimistic-concurrency revision of the entity.
442
+ */
443
+ revision: number;
444
+ /**
445
+ * Schema version associated with this entity value/definition.
446
+ */
447
+ schemaVersion: number;
448
+ };
449
+ /**
450
+ * Validation or write error associated with one bulk/import row.
451
+ */
452
+ type EntityBulkRowError = {
453
+ /**
454
+ * Zero-based input row index.
455
+ */
456
+ index: number;
457
+ /**
458
+ * Optional caller-supplied row identifier echoed in results/errors.
459
+ */
460
+ clientRowId?: string | null;
461
+ /**
462
+ * Entity field referenced by this filter/error.
463
+ */
464
+ field?: string | null;
465
+ /**
466
+ * Stable machine-readable code.
467
+ */
468
+ code: string;
469
+ /**
470
+ * Human-readable diagnostic/error message.
471
+ */
472
+ message: string;
473
+ /**
474
+ * Optional structured diagnostic details.
475
+ */
476
+ details?: unknown;
477
+ };
478
+ /**
479
+ * Aggregate and per-row result returned by an immediate bulk write.
480
+ */
481
+ type EntityBulkWriteResponse = {
482
+ /**
483
+ * Selected execution/import/session mode.
484
+ */
485
+ mode: EntityBulkMode;
486
+ /**
487
+ * Whether rows create new entities or update existing entities.
488
+ */
489
+ writeMode: "create" | "update";
490
+ /**
491
+ * Number of rows received by the bulk operation.
492
+ */
493
+ received: number;
494
+ /**
495
+ * Number of rows written successfully.
496
+ */
497
+ succeeded: number;
498
+ /**
499
+ * Number of rows that failed validation or writing.
500
+ */
501
+ failed: number;
502
+ /**
503
+ * Rows included in the bulk request/result.
504
+ */
505
+ rows: EntityBulkRowResult[];
506
+ /**
507
+ * Validation/write errors associated with this result.
508
+ */
509
+ errors: EntityBulkRowError[];
510
+ };
511
+ /**
512
+ * File formats accepted by staged entity imports.
513
+ */
514
+ type EntityImportFormat = "csv" | "ndjson";
515
+ /**
516
+ * Lifecycle states reported for a staged entity import.
517
+ */
518
+ type EntityImportStatus = "created" | "uploading" | "uploaded" | "validating" | "ready" | "committing" | "completed" | "failed" | "cancelled";
519
+ /**
520
+ * CSV parsing options for a staged entity import.
521
+ */
522
+ type EntityImportCsvOptions = {
523
+ /**
524
+ * Has header associated with this entity import csv options.
525
+ */
526
+ hasHeader?: boolean;
527
+ /**
528
+ * CSV field delimiter.
529
+ */
530
+ delimiter?: string;
531
+ /**
532
+ * CSV quote character.
533
+ */
534
+ quote?: string;
535
+ /**
536
+ * Null values associated with this entity import csv options.
537
+ */
538
+ nullValues?: string[];
539
+ };
540
+ /**
541
+ * Request used to create a staged entity-import job.
542
+ */
543
+ type EntityImportCreateRequest = {
544
+ mode: "validated";
545
+ writeMode: "create";
546
+ format: EntityImportFormat;
547
+ fileName?: string;
548
+ fieldMap?: Record<string, string>;
549
+ csv?: EntityImportCsvOptions;
550
+ chunkRows?: number;
551
+ } | {
552
+ mode: "full";
553
+ writeMode: "create" | "update";
554
+ format: EntityImportFormat;
555
+ fileName?: string;
556
+ fieldMap?: Record<string, string>;
557
+ csv?: EntityImportCsvOptions;
558
+ chunkRows?: number;
559
+ };
560
+ /**
561
+ * Current state and counters for a staged entity-import job.
562
+ */
563
+ type EntityImportJob = {
564
+ /**
565
+ * Persistent entity identifier.
566
+ */
567
+ pid: string;
568
+ /**
569
+ * Plugin identifier or plugin identity associated with this value.
570
+ */
571
+ plugin: string;
572
+ /**
573
+ * Entity resource name.
574
+ */
575
+ entity: string;
576
+ /**
577
+ * Selected execution/import/session mode.
578
+ */
579
+ mode: EntityBulkMode;
580
+ /**
581
+ * Whether rows create new entities or update existing entities.
582
+ */
583
+ writeMode: "create" | "update";
584
+ /**
585
+ * Import/export file format.
586
+ */
587
+ format: EntityImportFormat;
588
+ /**
589
+ * Resolution/job/runtime status.
590
+ */
591
+ status: EntityImportStatus;
592
+ /**
593
+ * Suggested/source file name.
594
+ */
595
+ fileName: string | null;
596
+ /**
597
+ * Total size of the import source in bytes.
598
+ */
599
+ sourceBytes: number;
600
+ /**
601
+ * Number of source bytes uploaded so far.
602
+ */
603
+ uploadedBytes: number;
604
+ /**
605
+ * Total parsed/exportable row count when known.
606
+ */
607
+ totalRows: number;
608
+ /**
609
+ * Number of import rows processed so far.
610
+ */
611
+ processedRows: number;
612
+ /**
613
+ * Number of import rows that passed validation.
614
+ */
615
+ validRows: number;
616
+ /**
617
+ * Number of import rows that failed validation.
618
+ */
619
+ invalidRows: number;
620
+ /**
621
+ * Number of entities created by the import.
622
+ */
623
+ createdRows: number;
624
+ /**
625
+ * Number of entities updated by the import.
626
+ */
627
+ updatedRows: number;
628
+ /**
629
+ * Number of rows that failed during import.
630
+ */
631
+ failedRows: number;
632
+ /**
633
+ * Job-level failure message, or `null` when no job failure is recorded.
634
+ */
635
+ errorMessage: string | null;
636
+ /**
637
+ * ISO timestamp when the job was created.
638
+ */
639
+ createdAt: string;
640
+ /**
641
+ * ISO timestamp when the job was last updated.
642
+ */
643
+ updatedAt: string;
644
+ /**
645
+ * ISO timestamp when the job reached a terminal state, or `null` while active.
646
+ */
647
+ completedAt: string | null;
648
+ };
649
+ /**
650
+ * One parsed row returned by an import preview.
651
+ */
652
+ type EntityImportPreviewRow<T> = {
653
+ /**
654
+ * Source row number represented by this preview entry.
655
+ */
656
+ row: number;
657
+ /**
658
+ * Entity or provider value represented by this result.
659
+ */
660
+ value: Partial<T> | null;
661
+ /**
662
+ * Validation/write errors associated with this result.
663
+ */
664
+ errors: EntityBulkRowError[];
665
+ };
666
+ /**
667
+ * Paginated preview of parsed rows from a staged entity import.
668
+ */
669
+ type EntityImportPreview<T> = {
670
+ /**
671
+ * Items returned by this paginated/preview result.
672
+ */
673
+ items: EntityImportPreviewRow<T>[];
674
+ /**
675
+ * Offset for the next preview page, or `null` when complete.
676
+ */
677
+ nextOffset: number | null;
678
+ };
679
+ /**
680
+ * Byte-level progress reported while uploading an import source.
681
+ */
682
+ type EntityImportUploadProgress = {
683
+ /**
684
+ * Number of source bytes uploaded so far.
685
+ */
686
+ uploadedBytes: number;
687
+ /**
688
+ * Total upload size in bytes.
689
+ */
690
+ totalBytes: number;
691
+ /**
692
+ * Upload completion fraction from 0 to 1.
693
+ */
694
+ fraction: number;
695
+ };
696
+ /**
697
+ * Options controlling chunked upload of an import source.
698
+ */
699
+ type EntityImportUploadOptions = {
700
+ /**
701
+ * Maximum bytes sent in each browser upload request.
702
+ */
703
+ chunkBytes?: number;
704
+ /**
705
+ * Suggested/source file name.
706
+ */
707
+ fileName?: string;
708
+ /**
709
+ * Abort signal cancelled when the owning runtime scope becomes stale.
710
+ */
711
+ signal?: AbortSignal;
712
+ /**
713
+ * Callback invoked after each successfully uploaded chunk.
714
+ *
715
+ * @param progress Updated upload progress after one chunk completes.
716
+ */
717
+ onProgress?: (progress: EntityImportUploadProgress) => void;
718
+ };
719
+ /**
720
+ * Pagination options for an import preview.
721
+ */
722
+ type EntityImportPreviewOptions = {
723
+ /**
724
+ * Zero-based preview row offset.
725
+ */
726
+ offset?: number;
727
+ /**
728
+ * Maximum number of items/rows to return.
729
+ */
730
+ limit?: number;
731
+ };
732
+ /**
733
+ * File formats supported by staged entity exports.
734
+ */
735
+ type EntityExportFormat = "csv" | "ndjson";
736
+ /**
737
+ * Lifecycle states reported for a staged entity export.
738
+ */
739
+ type EntityExportStatus = "queued" | "exporting" | "completed" | "failed" | "cancelled";
740
+ /**
741
+ * Request used to create a staged entity-export job.
742
+ */
743
+ type EntityExportCreateRequest = {
744
+ /**
745
+ * Import/export file format.
746
+ */
747
+ format: EntityExportFormat;
748
+ /**
749
+ * Entity filters applied to the export.
750
+ */
751
+ filters?: EntityFilter[];
752
+ /**
753
+ * Fields included in the effective entity schema/export.
754
+ */
755
+ fields?: string[];
756
+ /**
757
+ * Whether Plugmatica metadata columns are included in the export.
758
+ */
759
+ includeMetadata?: boolean;
760
+ /**
761
+ * Suggested/source file name.
762
+ */
763
+ fileName?: string;
764
+ /**
765
+ * Rows processed per server-side chunk.
766
+ */
767
+ chunkRows?: number;
768
+ };
769
+ /**
770
+ * Current state and counters for a staged entity-export job.
771
+ */
772
+ type EntityExportJob = {
773
+ /**
774
+ * Persistent entity identifier.
775
+ */
776
+ pid: string;
777
+ /**
778
+ * Plugin identifier or plugin identity associated with this value.
779
+ */
780
+ plugin: string;
781
+ /**
782
+ * Entity resource name.
783
+ */
784
+ entity: string;
785
+ /**
786
+ * Import/export file format.
787
+ */
788
+ format: EntityExportFormat;
789
+ /**
790
+ * Resolution/job/runtime status.
791
+ */
792
+ status: EntityExportStatus;
793
+ /**
794
+ * Suggested/source file name.
795
+ */
796
+ fileName: string | null;
797
+ /**
798
+ * Total parsed/exportable row count when known.
799
+ */
800
+ totalRows: number | null;
801
+ /**
802
+ * Number of entity rows written to the export so far.
803
+ */
804
+ exportedRows: number;
805
+ /**
806
+ * Current size of the generated export in bytes.
807
+ */
808
+ outputBytes: number;
809
+ /**
810
+ * Job-level failure message, or `null` when no job failure is recorded.
811
+ */
812
+ errorMessage: string | null;
813
+ /**
814
+ * ISO timestamp when the job was created.
815
+ */
816
+ createdAt: string;
817
+ /**
818
+ * ISO timestamp when the job was last updated.
819
+ */
820
+ updatedAt: string;
821
+ /**
822
+ * ISO timestamp when the job reached a terminal state, or `null` while active.
823
+ */
824
+ completedAt: string | null;
825
+ };
826
+ /**
827
+ * Runtime-owned reference to another Plugmatica entity.
828
+ *
829
+ * Plugin code normally obtains these through an entity reference field rather
830
+ * than naming the target plugin/entity directly.
831
+ */
832
+ type EntityReference = {
833
+ plugin: string;
834
+ entity: string;
835
+ pid: string;
836
+ };
837
+ /** Human-readable projection returned for an EntityRef field. */
838
+ type EntityReferenceOption = {
839
+ reference: EntityReference;
840
+ label: string;
841
+ };
842
+ /** Search options for an EntityRef field declared by the current plugin. */
843
+ type EntityReferenceSearchOptions = {
844
+ text?: string;
845
+ limit?: number;
846
+ cursor?: string | null;
847
+ };
848
+ /** Batch response for resolving existing EntityRef PIDs. */
849
+ type EntityReferenceResolveResponse = {
850
+ items: EntityReferenceOption[];
851
+ };
852
+ /** One bounded search page for an EntityRef field. */
853
+ type EntityReferenceSearchResponse = {
854
+ items: EntityReferenceOption[];
855
+ nextCursor: string | null;
856
+ /** Runtime-derived primary display field, when one is available. */
857
+ displayField: string | null;
858
+ /** Runtime-derived indexed string fields used for generic reference search. */
859
+ searchFields: string[];
860
+ };
861
+ /**
862
+ * Read-only resolver for one EntityRef field owned by the current plugin.
863
+ *
864
+ * The browser supplies only the owning entity and field. The runtime resolves
865
+ * the target plugin/entity from the effective entity schema, preserving plugin
866
+ * isolation and avoiding direct knowledge of another plugin.
867
+ */
868
+ type OwnerEntityReferenceClient = {
869
+ search(options?: EntityReferenceSearchOptions, requestOptions?: PluginApiRequestOptions): Promise<EntityReferenceSearchResponse>;
870
+ resolve(pid: string, requestOptions?: PluginApiRequestOptions): Promise<EntityReferenceOption>;
871
+ resolveMany(pids: readonly string[], requestOptions?: PluginApiRequestOptions): Promise<EntityReferenceOption[]>;
872
+ };
873
+ /**
874
+ * Object-resource client for an entity owned by the current plugin.
875
+ */
876
+ type OwnerEntityClient<T extends Record<string, unknown>> = {
877
+ /**
878
+ * Follow one EntityRef field declared by this owned entity. The target is
879
+ * resolved by the runtime from entity metadata; callers do not name another
880
+ * plugin or target entity.
881
+ */
882
+ reference(field: string): OwnerEntityReferenceClient;
883
+ /**
884
+ * Load the effective merged schema for this entity.
885
+ *
886
+ * @param requestOptions Optional transport request settings.
887
+ * @returns Effective schema after owner/dependency contributions and runtime policy are applied.
888
+ */
889
+ schema(requestOptions?: PluginApiRequestOptions): Promise<EffectiveEntitySchema>;
890
+ /**
891
+ * List entities owned by the current plugin.
892
+ *
893
+ * @param options Entity pagination/filter options.
894
+ * @param requestOptions Optional transport request settings.
895
+ * @returns Page of entity envelopes plus pagination metadata.
896
+ */
897
+ list(options?: EntityListOptions, requestOptions?: PluginApiRequestOptions): Promise<EntityListResponse<T>>;
898
+ /**
899
+ * Load one owned entity by persistent identifier.
900
+ *
901
+ * @param pid Persistent entity identifier.
902
+ * @param requestOptions Optional transport request settings.
903
+ * @returns Entity envelope containing the value, persistent identifier and revision.
904
+ */
905
+ get(pid: string, requestOptions?: PluginApiRequestOptions): Promise<EntityEnvelope<T>>;
906
+ /**
907
+ * Create one entity value.
908
+ *
909
+ * @param value Input value to normalize/convert.
910
+ * @returns Created entity envelope including its assigned identifier and revision.
911
+ */
912
+ create(value: Partial<T>): Promise<EntityEnvelope<T>>;
913
+ /**
914
+ * Update one entity using optimistic concurrency.
915
+ *
916
+ * @param pid Persistent entity identifier.
917
+ * @param update Patch and expected revision for the entity update.
918
+ * @returns Updated entity envelope at the new revision.
919
+ */
920
+ update(pid: string, update: EntityUpdate<T>): Promise<EntityEnvelope<T>>;
921
+ /**
922
+ * Delete one entity using optimistic concurrency.
923
+ *
924
+ * @param pid Persistent entity identifier.
925
+ * @param expectedRevision Current entity revision required for optimistic concurrency.
926
+ * @returns Confirmation containing the deleted persistent identifier.
927
+ */
928
+ delete(pid: string, expectedRevision: number): Promise<{
929
+ deleted: true;
930
+ pid: string;
931
+ }>;
932
+ /** Immediate bounded bulk write. Large files should use staged imports. */
933
+ /**
934
+ * @param request Request payload/options for this operation.
935
+ * @returns Per-row bulk-write outcome and aggregate counts.
936
+ */
937
+ bulkWrite(request: EntityBulkWriteRequest<T>): Promise<EntityBulkWriteResponse>;
938
+ /**
939
+ * Create a staged import job.
940
+ *
941
+ * @param request Request payload/options for this operation.
942
+ * @returns Newly created staged import job.
943
+ */
944
+ createImport(request: EntityImportCreateRequest): Promise<EntityImportJob>;
945
+ /**
946
+ * Upload the source content for a staged import job.
947
+ *
948
+ * @param pid Persistent entity identifier.
949
+ * @param source Blob/File containing the staged import source.
950
+ * @param options Chunking, file-name, cancellation and progress settings.
951
+ * @returns Import job state after the source upload completes.
952
+ */
953
+ uploadImport(pid: string, source: Blob, options?: EntityImportUploadOptions): Promise<EntityImportJob>;
954
+ /**
955
+ * Load the current state of a staged import job.
956
+ *
957
+ * @param pid Persistent entity identifier.
958
+ * @returns Current staged import job state.
959
+ */
960
+ getImport(pid: string): Promise<EntityImportJob>;
961
+ /**
962
+ * Preview parsed/validated rows from a staged import.
963
+ *
964
+ * @param pid Persistent entity identifier.
965
+ * @param options Preview pagination settings.
966
+ * @returns Preview rows, validation information and preview pagination metadata.
967
+ */
968
+ previewImport(pid: string, options?: EntityImportPreviewOptions): Promise<EntityImportPreview<T>>;
969
+ /**
970
+ * Run server-side validation for a staged import.
971
+ *
972
+ * @param pid Persistent entity identifier.
973
+ * @returns Import job after server-side validation has run.
974
+ */
975
+ validateImport(pid: string): Promise<EntityImportJob>;
976
+ /**
977
+ * Commit a validated staged import.
978
+ *
979
+ * @param pid Persistent entity identifier.
980
+ * @returns Import job after the commit request has been accepted/applied.
981
+ */
982
+ commitImport(pid: string): Promise<EntityImportJob>;
983
+ /**
984
+ * Cancel a staged import that has not completed.
985
+ *
986
+ * @param pid Persistent entity identifier.
987
+ * @returns Import job after cancellation is requested.
988
+ */
989
+ cancelImport(pid: string): Promise<EntityImportJob>;
990
+ /**
991
+ * Download the row-error artifact for a staged import.
992
+ *
993
+ * @param pid Persistent entity identifier.
994
+ * @returns Blob containing the generated import row-error artifact.
995
+ */
996
+ downloadImportErrors(pid: string): Promise<Blob>;
997
+ /**
998
+ * Create a staged entity export job.
999
+ *
1000
+ * @param request Request payload/options for this operation.
1001
+ * @returns Newly created staged export job.
1002
+ */
1003
+ createExport(request: EntityExportCreateRequest): Promise<EntityExportJob>;
1004
+ /**
1005
+ * Load the current state of a staged export job.
1006
+ *
1007
+ * @param pid Persistent entity identifier.
1008
+ * @returns Current staged export job state.
1009
+ */
1010
+ getExport(pid: string): Promise<EntityExportJob>;
1011
+ /**
1012
+ * Cancel a staged export that has not completed.
1013
+ *
1014
+ * @param pid Persistent entity identifier.
1015
+ * @returns Export job after cancellation is requested.
1016
+ */
1017
+ cancelExport(pid: string): Promise<EntityExportJob>;
1018
+ /**
1019
+ * Download the completed export artifact.
1020
+ *
1021
+ * @param pid Persistent entity identifier.
1022
+ * @returns Blob containing the completed export artifact.
1023
+ */
1024
+ downloadExport(pid: string): Promise<Blob>;
1025
+ };
1026
+ /**
1027
+ * Read-only object-resource client for an entity exposed by a declared plugin dependency.
1028
+ */
1029
+ type DependencyEntityClient<T extends Record<string, unknown>> = {
1030
+ /**
1031
+ * Load the effective merged schema exposed by the dependency entity.
1032
+ *
1033
+ * @param requestOptions Optional transport request settings.
1034
+ * @returns Effective schema after owner/dependency contributions and runtime policy are applied.
1035
+ */
1036
+ schema(requestOptions?: PluginApiRequestOptions): Promise<EffectiveEntitySchema>;
1037
+ /**
1038
+ * List entities exposed by the declared dependency.
1039
+ *
1040
+ * @param options Entity pagination/filter options.
1041
+ * @param requestOptions Optional transport request settings.
1042
+ * @returns Page of entity envelopes plus pagination metadata.
1043
+ */
1044
+ list(options?: EntityListOptions, requestOptions?: PluginApiRequestOptions): Promise<EntityListResponse<T>>;
1045
+ /**
1046
+ * Load one dependency entity by persistent identifier.
1047
+ *
1048
+ * @param pid Persistent entity identifier.
1049
+ * @param requestOptions Optional transport request settings.
1050
+ * @returns Entity envelope containing the value, persistent identifier and revision.
1051
+ */
1052
+ get(pid: string, requestOptions?: PluginApiRequestOptions): Promise<EntityEnvelope<T>>;
1053
+ };
1054
+ /**
1055
+ * Create an object-resource client for an entity owned by the current plugin.
1056
+ *
1057
+ * @param api Plugin-scoped API client.
1058
+ * @param entity Entity resource name.
1059
+ * @returns Entity client scoped to the current plugin owner route.
1060
+ * @example
1061
+ * ```ts
1062
+ * const api = usePluginApi();
1063
+ * const customers = ownerEntity<Customer>(api, "customer");
1064
+ * const page = await customers.list({ limit: 50 });
1065
+ * ```
1066
+ */
1067
+ declare function ownerEntity<T extends Record<string, unknown>>(api: PluginApiClient, entity: string): OwnerEntityClient<T>;
1068
+ /**
1069
+ * Create a read-only object-resource client for an entity exposed by a declared plugin dependency.
1070
+ *
1071
+ * @param api Plugin-scoped API client.
1072
+ * @param plugin Dependency plugin identifier.
1073
+ * @param entity Entity resource name.
1074
+ * @returns Read-only entity client scoped to the declared dependency route.
1075
+ * @example
1076
+ * ```ts
1077
+ * const api = usePluginApi();
1078
+ * const customers = dependencyEntity<Customer>(
1079
+ * api,
1080
+ * "plugmatica.customer",
1081
+ * "customer",
1082
+ * );
1083
+ * const customer = await customers.get(customerPid);
1084
+ * ```
1085
+ */
1086
+ declare function dependencyEntity<T extends Record<string, unknown>>(api: PluginApiClient, plugin: string, entity: string): DependencyEntityClient<T>;
1087
+
1088
+ /**
1089
+ * Route-parameter object inferred from a Plugmatica route pattern.
1090
+ */
1091
+ type PluginRouteParams<TPattern extends string> = {
1092
+ [TName in RequiredRouteParamNames<TPattern>]: string;
1093
+ } & {
1094
+ [TName in OptionalRouteParamNames<TPattern>]?: string;
1095
+ };
1096
+ type RouteParamTokens<TPattern extends string> = TPattern extends `${string}:${infer Param}/${infer Rest}` ? Param | RouteParamTokens<`/${Rest}`> : TPattern extends `${string}:${infer Param}` ? Param : never;
1097
+ type RequiredRouteParamNames<TPattern extends string> = RouteParamTokens<TPattern> extends infer TParam extends string ? TParam extends `${string}?` ? never : CleanParam<TParam> : never;
1098
+ type OptionalRouteParamNames<TPattern extends string> = RouteParamTokens<TPattern> extends infer TParam extends string ? TParam extends `${infer Name}?` ? Name : never : never;
1099
+ type CleanParam<TParam extends string> = TParam extends `${infer Name}?` ? Name : TParam extends `${infer Name}*` ? Name : TParam;
1100
+ /**
1101
+ * Match a router-agnostic plugin route pattern against a path.
1102
+ *
1103
+ * Supported segments are static text, `:param`, optional trailing `:param?`
1104
+ * and trailing catch-all `:param*`. Query/hash are ignored and parameters are
1105
+ * decoded exactly once. Trailing slashes are normalised.
1106
+ *
1107
+ * @param pattern Plugmatica route pattern to match.
1108
+ * @param path Path to match; query and hash components are ignored.
1109
+ * @returns Decoded route parameters when the pattern matches; otherwise `null`.
1110
+ * @example
1111
+ * ```ts
1112
+ * const match = matchPluginRoute("/customers/:pid", "/customers/cus_123");
1113
+ * // { pid: "cus_123" }
1114
+ * ```
1115
+ */
1116
+ declare function matchPluginRoute<const TPattern extends string>(pattern: TPattern, path: string): PluginRouteParams<TPattern> | null;
1117
+ /** Current host route, with subscription when the host exposes navigation events. */
1118
+ /**
1119
+ * @returns Host-supplied path, including query and hash when provided.
1120
+ */
1121
+ declare function usePluginCurrentPath(): string;
1122
+ /**
1123
+ * Match a Plugmatica route pattern against the current host path.
1124
+ *
1125
+ * @param pattern Plugmatica route pattern to match.
1126
+ * @returns Decoded route parameters for the current path, or `null`.
1127
+ */
1128
+ declare function usePluginRouteMatch<const TPattern extends string>(pattern: TPattern): PluginRouteParams<TPattern> | null;
1129
+ /** Remove query/hash, ensure a leading slash and collapse a trailing slash. */
1130
+ /**
1131
+ * @param value Input value to normalize/convert.
1132
+ * @returns Normalized leading-slash path without query/hash/trailing slash noise.
1133
+ */
1134
+ declare function normalizePluginPath(value: string): string;
1135
+
1136
+ /** Public, serializable field/source projection supplied by the Workflow host. */
1137
+ type WorkflowFieldSchema = Readonly<{
1138
+ type?: string | readonly string[];
1139
+ title?: string;
1140
+ description?: string;
1141
+ default?: unknown;
1142
+ enum?: readonly unknown[];
1143
+ properties?: Record<string, WorkflowFieldSchema>;
1144
+ required?: readonly string[];
1145
+ [key: string]: unknown;
1146
+ }>;
1147
+ type WorkflowFieldSource = Readonly<{
1148
+ expression: string;
1149
+ nodeId: string;
1150
+ nodeLabel: string;
1151
+ fieldPath: string;
1152
+ fieldLabel: string;
1153
+ type?: string | readonly string[];
1154
+ description?: string;
1155
+ /** Public schema semantic, when the upstream output declares one. */
1156
+ semantic?: string;
1157
+ /** A semantic match to this target, computed by the host-owned facade. */
1158
+ recommended?: boolean;
1159
+ sourceKind: "trigger" | "step" | "variable" | "config" | "error";
1160
+ availability: "always" | "conditional";
1161
+ presence?: "required" | "optional";
1162
+ compatibility: "exact" | "numeric_widening" | "unknown" | "incompatible";
1163
+ }>;
1164
+ type WorkflowFieldValueMode = "unset" | "fixed" | "source" | "formula";
1165
+ /** Advisory state of an explicit source selection, never execution authorization. */
1166
+ type WorkflowFieldReferenceStatus = "available" | "conditional" | "optional" | "unverified";
1167
+ type WorkflowNodeFieldState = Readonly<{
1168
+ path: string;
1169
+ label: string;
1170
+ schema: WorkflowFieldSchema;
1171
+ required: boolean;
1172
+ channel: "input" | "config";
1173
+ supportsFixed: boolean;
1174
+ supportsExpression: boolean;
1175
+ mode: WorkflowFieldValueMode;
1176
+ /** Configured means a non-empty fixed value or a non-empty mapping, not successful validation. */
1177
+ configured: boolean;
1178
+ /** A direct upstream reference may become unverified after graph rewiring.
1179
+ * Free-form expressions are not treated as broken just because the host
1180
+ * cannot catalogue every expression they contain. */
1181
+ referenceStatus?: WorkflowFieldReferenceStatus;
1182
+ value?: unknown;
1183
+ expression: string;
1184
+ sources: readonly WorkflowFieldSource[];
1185
+ issues: readonly WorkflowValidationIssue[];
1186
+ }>;
1187
+ /** Host-localized labels: a third-party plugin needs no Workflows translation keys. */
1188
+ type WorkflowFieldLabels = Readonly<{
1189
+ choose: string;
1190
+ recommended: string;
1191
+ fixed: string;
1192
+ formula: string;
1193
+ clear: string;
1194
+ search: string;
1195
+ required: string;
1196
+ optional: string;
1197
+ conditional: string;
1198
+ unverified: string;
1199
+ empty: string;
1200
+ trueLabel: string;
1201
+ falseLabel: string;
1202
+ }>;
1203
+ interface WorkflowNodeFields {
1204
+ readonly nodeId: string;
1205
+ readonly readOnly: boolean;
1206
+ readonly labels: WorkflowFieldLabels;
1207
+ /** Only authorable leaf paths are exposed; resources and sensitive fields are never listed. */
1208
+ list(): readonly WorkflowNodeFieldState[];
1209
+ /** Returns undefined rather than exposing unknown, resource or sensitive paths. */
1210
+ get(path: string): WorkflowNodeFieldState | undefined;
1211
+ /** One host-owned graph patch; switches off an existing mapping. */
1212
+ setLiteral(path: string, value: unknown): void;
1213
+ /** One host-owned graph patch; switches off a configured literal. */
1214
+ setMapping(path: string, expression: string): void;
1215
+ /** Remove both representations in one patch. */
1216
+ clear(path: string): void;
1217
+ /** Associates host validation/focus navigation with a contributed field. */
1218
+ registerAnchor(path: string, element: HTMLDivElement | null): void;
1219
+ }
1220
+ declare const DEFAULT_WORKFLOW_FIELD_LABELS: WorkflowFieldLabels;
1221
+ type WorkflowNodeFieldHostOptions = Readonly<{
1222
+ node: WorkflowGraphNode;
1223
+ descriptor: WorkflowNodeAuthoringDescriptor;
1224
+ /** These MUST be effective, resource-pruned host projections, never plugin-supplied schemas. */
1225
+ inputSchema?: Record<string, unknown> | null;
1226
+ configSchema?: Record<string, unknown> | null;
1227
+ sources: readonly WorkflowFieldSource[];
1228
+ issues: readonly WorkflowValidationIssue[];
1229
+ readOnly: boolean;
1230
+ labels?: WorkflowFieldLabels;
1231
+ sourceCompatibility?: (targetType?: string | readonly string[], sourceType?: string | readonly string[]) => WorkflowFieldSource["compatibility"];
1232
+ /** Current active node supplied by the host; stale editor callbacks are ignored. */
1233
+ currentNode(): WorkflowGraphNode | null;
1234
+ /** False once the host switches nodes, versions, or unmounts the editor. */
1235
+ isActive(): boolean;
1236
+ onChange(patch: Partial<WorkflowGraphNode>): void;
1237
+ onRegisterAnchor?: (fieldPath: string, element: HTMLDivElement | null) => void;
1238
+ }>;
1239
+ /** A required empty string must not look configured just because it has a fixed mode. */
1240
+ declare function workflowFieldHasValue(value: unknown): boolean;
1241
+ /**
1242
+ * Constructs a typed, constrained editor facade. The host owns the callback and
1243
+ * projections. This helper never evaluates workflow expressions, creates secrets,
1244
+ * chooses Connections, or writes to the graph merely because it was rendered.
1245
+ */
1246
+ declare function createWorkflowNodeFields(options: WorkflowNodeFieldHostOptions): WorkflowNodeFields;
1247
+ /** Pure read helper for plugin React components (updates flow through host context renders). */
1248
+ declare function useWorkflowNodeField(fields: WorkflowNodeFields, path: string): Readonly<{
1249
+ path: string;
1250
+ label: string;
1251
+ schema: WorkflowFieldSchema;
1252
+ required: boolean;
1253
+ channel: "input" | "config";
1254
+ supportsFixed: boolean;
1255
+ supportsExpression: boolean;
1256
+ mode: WorkflowFieldValueMode;
1257
+ /** Configured means a non-empty fixed value or a non-empty mapping, not successful validation. */
1258
+ configured: boolean;
1259
+ /** A direct upstream reference may become unverified after graph rewiring.
1260
+ * Free-form expressions are not treated as broken just because the host
1261
+ * cannot catalogue every expression they contain. */
1262
+ referenceStatus?: WorkflowFieldReferenceStatus;
1263
+ value?: unknown;
1264
+ expression: string;
1265
+ sources: readonly WorkflowFieldSource[];
1266
+ issues: readonly WorkflowValidationIssue[];
1267
+ }> | undefined;
1268
+ /**
1269
+ * Read-only, privacy-limited canvas projection. It is intentionally not a field
1270
+ * controller: no values, expressions, Connection identifiers, or credentials
1271
+ * cross this surface. In particular, a mapped BlobRef is never disclosed.
1272
+ */
1273
+ type WorkflowNodePresentationField = Readonly<{
1274
+ path: string;
1275
+ required: boolean;
1276
+ mode: "unset" | "fixed" | "mapped";
1277
+ /** No literal, expression, or managed-resource value is disclosed by this status. */
1278
+ configured: boolean;
1279
+ }>;
1280
+ /**
1281
+ * Upstream reachability for privacy-safe canvas readiness. A node that is
1282
+ * present in the graph but no longer connected is not a usable data source.
1283
+ * This is advisory only; runtime validation still decides expression semantics.
1284
+ */
1285
+ declare function workflowUpstreamNodeIds(graph: Pick<WorkflowGraph, "edges" | "nodes">, nodeId: string): ReadonlySet<string>;
1286
+ declare function projectWorkflowNodePresentationFields(node: WorkflowGraphNode, descriptor: WorkflowNodeDescriptor,
1287
+ /** Optional graph-derived predecessor IDs. Never exposed in the projection. */
1288
+ upstreamNodeIds?: ReadonlySet<string>): readonly WorkflowNodePresentationField[];
1289
+
1290
+ /** Public capability, not an import from the Workflows plugin implementation. */
1291
+ declare const WORKFLOW_NODE_UI_CONTRACT: "plugmatica.workflow.node.host";
1292
+ declare const WORKFLOW_NODE_UI_SURFACE: "workflow.node";
1293
+ /**
1294
+ * Targets for optional Workflow authoring facets. The compiler discovers
1295
+ * both defineExtension() tokens and defineWorkflowNode() static declarations.
1296
+ */
1297
+ declare const workflowNodeUiTargets: {
1298
+ readonly catalog: {
1299
+ readonly __pmTarget: "ui";
1300
+ readonly contract: {
1301
+ readonly id: "plugmatica.workflow.node.host";
1302
+ readonly version: "^1.1.0";
1303
+ };
1304
+ } & {
1305
+ readonly resolution: "capability";
1306
+ readonly required: boolean;
1307
+ readonly plugin?: never;
1308
+ readonly pluginVersion?: never;
1309
+ } & {
1310
+ readonly surface: "custom";
1311
+ readonly key: "workflow.node";
1312
+ readonly point: "catalog";
1313
+ readonly ownerAnchors?: readonly string[];
1314
+ readonly ownerAnchorsComplete?: boolean;
1315
+ } & {
1316
+ readonly required: false;
1317
+ };
1318
+ readonly editor: {
1319
+ readonly __pmTarget: "ui";
1320
+ readonly contract: {
1321
+ readonly id: "plugmatica.workflow.node.host";
1322
+ readonly version: "^1.0.0";
1323
+ };
1324
+ } & {
1325
+ readonly resolution: "capability";
1326
+ readonly required: boolean;
1327
+ readonly plugin?: never;
1328
+ readonly pluginVersion?: never;
1329
+ } & {
1330
+ readonly surface: "custom";
1331
+ readonly key: "workflow.node";
1332
+ readonly point: "editor";
1333
+ readonly ownerAnchors?: readonly string[];
1334
+ readonly ownerAnchorsComplete?: boolean;
1335
+ } & {
1336
+ readonly required: false;
1337
+ };
1338
+ readonly presentation: {
1339
+ readonly __pmTarget: "ui";
1340
+ readonly contract: {
1341
+ readonly id: "plugmatica.workflow.node.host";
1342
+ readonly version: "^1.0.0";
1343
+ };
1344
+ } & {
1345
+ readonly resolution: "capability";
1346
+ readonly required: boolean;
1347
+ readonly plugin?: never;
1348
+ readonly pluginVersion?: never;
1349
+ } & {
1350
+ readonly surface: "custom";
1351
+ readonly key: "workflow.node";
1352
+ readonly point: "presentation";
1353
+ readonly ownerAnchors?: readonly string[];
1354
+ readonly ownerAnchorsComplete?: boolean;
1355
+ } & {
1356
+ readonly required: false;
1357
+ };
1358
+ };
1359
+ /** Host-mediated editor contract; all field writes pass through the Workflow host. */
1360
+ type WorkflowNodeEditorContext = Readonly<{
1361
+ node: WorkflowGraphNode;
1362
+ descriptor: WorkflowNodeAuthoringDescriptor;
1363
+ connections: readonly ConnectionProfile[];
1364
+ readOnly: boolean;
1365
+ /** @deprecated DX1 escape hatch; prefer fields for validated, atomic writes. */
1366
+ setConfig(config: Record<string, unknown>): void;
1367
+ fields: WorkflowNodeFields;
1368
+ /** Translation scoped to the contributing plugin, not the Workflow host. */
1369
+ translate?: (key: string) => string;
1370
+ }>;
1371
+ type WorkflowNodeEditorContribution = Readonly<{
1372
+ key: string;
1373
+ nodeType: string;
1374
+ order?: number;
1375
+ render(context: WorkflowNodeEditorContext): ReactNode;
1376
+ }>;
1377
+ type WorkflowNodePresentationContext = Readonly<{
1378
+ nodeId: string;
1379
+ nodeType: string;
1380
+ config: unknown;
1381
+ summary?: string;
1382
+ readOnly: boolean;
1383
+ /** Safe input readiness only: never contains values, formulas, BlobRefs or resource identities. */
1384
+ fields?: readonly WorkflowNodePresentationField[];
1385
+ /** Translation scoped to the contributing plugin, not the Workflow host. */
1386
+ translate?: (key: string) => string;
1387
+ }>;
1388
+ type WorkflowNodePresentationContribution = Readonly<{
1389
+ key: string;
1390
+ nodeType: string;
1391
+ order?: number;
1392
+ render(context: WorkflowNodePresentationContext): ReactNode;
1393
+ }>;
1394
+
1395
+ /**
1396
+ * Match a Workflow UI facet using the extension runtime's authoritative point.
1397
+ * The host sends node identity in the payload but the selected extension point
1398
+ * belongs to ExtensionRenderContext, not to the arbitrary payload object.
1399
+ *
1400
+ * Keep this independent of React so authoring contract checks can run without
1401
+ * a built shell or Module Federation remote.
1402
+ */
1403
+ type WorkflowNodeFacetPayload = Readonly<{
1404
+ nodeType?: string;
1405
+ nodeTypes?: readonly string[];
1406
+ }>;
1407
+
1408
+ /** One independently packaged, backend-owned Workflow action's optional UI facets. */
1409
+ type WorkflowNodeCatalogDefinition = Readonly<{
1410
+ titleKey: string;
1411
+ descriptionKey?: string;
1412
+ categoryKey?: string;
1413
+ icon?: string;
1414
+ keywords?: readonly string[];
1415
+ }>;
1416
+ /** Lazy components are split by Vite; palette catalog resolution never imports their chunks. */
1417
+ type WorkflowNodeComponentLoader<TProps> = () => Promise<{
1418
+ default: ComponentType<TProps>;
1419
+ }>;
1420
+ type WorkflowNodeDefinition = Readonly<{
1421
+ /** Must match an action in THIS plugin's compiled backend descriptor. */
1422
+ nodeType: `${string}:action:${string}`;
1423
+ /** Stable Module Federation expose for this file, e.g. ./nodes/DownloadFile. */
1424
+ module: `./${string}`;
1425
+ catalog?: WorkflowNodeCatalogDefinition;
1426
+ /** Inline component (eager) or loadEditor (code split); supply only one. */
1427
+ editor?: ComponentType<WorkflowNodeEditorContext>;
1428
+ loadEditor?: WorkflowNodeComponentLoader<WorkflowNodeEditorContext>;
1429
+ presentation?: ComponentType<WorkflowNodePresentationContext>;
1430
+ loadPresentation?: WorkflowNodeComponentLoader<WorkflowNodePresentationContext>;
1431
+ /** Explicit backend-owned editable leaf paths; checked during package assembly. */
1432
+ editableFields?: readonly string[];
1433
+ /** Optional assertion checked against the compiled backend action contract. */
1434
+ contractVersion?: number;
1435
+ order?: number;
1436
+ }>;
1437
+ type WorkflowPayload = WorkflowNodeFacetPayload;
1438
+ type WorkflowValue = WorkflowNodeCatalogEntries | WorkflowNodeEditorContribution | WorkflowNodePresentationContribution;
1439
+ /**
1440
+ * Define one Workflow action's optional frontend facets without a private
1441
+ * Workflows-plugin import, global registry or executable schema duplication.
1442
+ *
1443
+ * The SDK produces an ordinary structured extension module. plugin-build
1444
+ * expands the statically declared facets into catalog/editor/presentation
1445
+ * contributions sharing this module expose. The extension runtime supplies
1446
+ * `point` through the contribution context (not through the payload).
1447
+ *
1448
+ * A single author-owned file is enough. Prefer loadEditor/loadPresentation
1449
+ * when the palette should not load rich React controls.
1450
+ *
1451
+ * @example
1452
+ * ```tsx
1453
+ * export default defineWorkflowNode({
1454
+ * nodeType: "plugmatica.sftp:action:list-directory",
1455
+ * module: "./nodes/ListDirectory",
1456
+ * catalog: { titleKey: "workflow.list.title", icon: "FolderOpen" },
1457
+ * editableFields: ["path"],
1458
+ * loadEditor: () => import("./ListDirectoryEditor"),
1459
+ * });
1460
+ * ```
1461
+ */
1462
+ declare function defineWorkflowNode<const T extends WorkflowNodeDefinition>(definition: T): StructuredUiExtensionModule<WorkflowValue, WorkflowPayload>;
1463
+
1464
+ export { DEFAULT_WORKFLOW_FIELD_LABELS, PluginApiClient, PluginApiRequestOptions, PluginExtensionsApi, PluginGuestSessionApi, PluginI18nApi, PluginManagedResourceApi, PluginMessage, PluginNavigationApi, PluginRenderContext, PluginRuntimeProvider, PluginSession, PluginWorkflowManagementApi, PluginWorkflowRealtimeApi, WORKFLOW_NODE_UI_CONTRACT, WORKFLOW_NODE_UI_SURFACE, assertExternalNavigationUrl, createPluginRuntime, createWorkflowNodeFields, defineWorkflowNode, dependencyEntity, matchPluginRoute, normalizePluginPath, ownerEntity, projectWorkflowNodePresentationFields, usePluginApi, usePluginContext, usePluginCurrentPath, usePluginExtensions, usePluginGuestSession, usePluginI18n, usePluginManagedResources, usePluginNavigation, usePluginRouteMatch, usePluginSession, usePluginWorkflowRealtime, usePluginWorkflows, useWorkflowNodeField, workflowFieldHasValue, workflowNodeUiTargets, workflowUpstreamNodeIds };
1465
+ export type { DependencyEntityClient, EffectiveEntityAugmentation, EffectiveEntityField, EffectiveEntitySchema, EntityBulkCreateRow, EntityBulkMode, EntityBulkRowError, EntityBulkRowResult, EntityBulkUpdateRow, EntityBulkWriteRequest, EntityBulkWriteResponse, EntityEnvelope, EntityExportCreateRequest, EntityExportFormat, EntityExportJob, EntityExportStatus, EntityFilter, EntityFilterOperator, EntityImportCreateRequest, EntityImportCsvOptions, EntityImportFormat, EntityImportJob, EntityImportPreview, EntityImportPreviewOptions, EntityImportPreviewRow, EntityImportStatus, EntityImportUploadOptions, EntityImportUploadProgress, EntityListOptions, EntityListResponse, EntityReference, EntityReferenceOption, EntityReferenceResolveResponse, EntityReferenceSearchOptions, EntityReferenceSearchResponse, EntityUpdate, OwnerEntityClient, OwnerEntityReferenceClient, PluginEntityFieldKind, PluginEntityFieldSensitivity, PluginMessageProps, PluginRouteParams, PluginRuntime, WorkflowFieldLabels, WorkflowFieldReferenceStatus, WorkflowFieldSchema, WorkflowFieldSource, WorkflowFieldValueMode, WorkflowNodeCatalogDefinition, WorkflowNodeComponentLoader, WorkflowNodeDefinition, WorkflowNodeEditorContext, WorkflowNodeEditorContribution, WorkflowNodeFieldHostOptions, WorkflowNodeFieldState, WorkflowNodeFields, WorkflowNodePresentationContext, WorkflowNodePresentationContribution, WorkflowNodePresentationField };