@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,42 @@
1
+ export type { ResourceListFilterableEntry, ResourceListSchema, } from "./resources/resource-list";
2
+ export { defineResourceInformationSchema, resourceInformationValue, } from "./resources/resource-information";
3
+ export type { NxResourceInformationFormProps, NxResourceInformationViewProps, ResourceFormLegalEntity, NxResourceFormLegalEntityFieldProps, ResourceInformationControlProjection, ResourceInformationControlSlot, ResourceInformationCustomProjection, ResourceInformationEditProjection, ResourceInformationEditRenderContext, ResourceInformationField, ResourceInformationFieldSpan, ResourceInformationMode, ResourceInformationReadOnlyProjection, ResourceInformationRequirement, ResourceInformationSchema, ResourceInformationSection, ResourceInformationTranslator, ResourceInformationValue, } from "./resources/resource-information";
4
+ export type { DatasetImportConfirmationSummary, ResourceImportPreview, ResourceImportPreviewRow, ResourceImportResponse, ResourceImportRun, ResourceImportRunStatus, ResourceImportSummary, ResourceTransferFormat, ResourceTransferMessage, ResourceTransferMeta, NxResourceImportDialogProps, NxResourceTransferActionsProps, NxDatasetImportWorkspaceProps, NxDatasetExportWorkspaceProps, } from "./resources/resource-transfer";
5
+ export type { NxCalendarActionBinding, NxCalendarActionCommand, NxCalendarActionResult, NxCalendarInteraction, NxCalendarOccurrence, NxCalendarProps, NxCalendarRange, NxCalendarSelection, NxCalendarTemporalRange, NxCalendarView, NxResourceSchedulerActionBinding, NxResourceSchedulerActionCommand, NxResourceSchedulerActionResult, NxResourceSchedulerInteraction, NxResourceSchedulerOccurrence, NxResourceSchedulerProps, NxResourceSchedulerResource, NxResourceSchedulerSelection, NxResourceSchedulerView, ResourceBoardCard, ResourceBoardLabels, ResourceBoardLane, ResourceBoardLoadState, ResourceBoardMoveCommand, ResourceBoardMutationResult, ResourceBoardProjection, ResourceBoardProps, ResourceBoardSummaryField, ResourceProjectionReference, ResourceScheduleActionBinding, ResourceScheduleActionCommand, ResourceScheduleDatePair, ResourceScheduleDateSemantics, ResourceScheduleDependency, ResourceScheduleDependencyType, ResourceScheduleInteraction, ResourceScheduleItem, ResourceScheduleItemType, ResourceScheduleLoadState, ResourceScheduleMutationResult, ResourceScheduleProjection, ResourceScheduleProps, ResourceScheduleTimeUnit, ResourceScheduleView, } from "./resources/resource-projections";
6
+ export type { ContextQueryResult, ContextResponse, LegalEntityContext, PermissionsQueryResult, PermissionsResponse, TenantContext, UserContext, WorkspaceContext, } from "./context";
7
+ export type { DataMigrationBackgroundOperation, DataMigrationBackgroundOperationClient, DataMigrationOperationAccepted, DataMigrationOperationWaitOptions, DataMigrationProviderRegistration, DataMigrationRegistrar, DataMigrationRegistry, DataMigrationRun, DataMigrationRunStatus, DataMigrationSessionCheckpointStore, DataMigrationStageCompletion, DataMigrationStageLoader, DataMigrationStageProps, DataMigrationStageRegistration, DataMigrationTargetRegistration, } from "./data-migration";
8
+ export { createDataMigrationSessionCheckpointStore, dataMigrationUploadAccept, dataMigrationRunPublicId, isDataMigrationOperationAccepted, } from "./data-migration";
9
+ export { projectSignatureCapabilityCatalog, signatureCapabilityIdentity, } from "./signature";
10
+ export type { SignatureDocumentDataBinding, SignatureDocumentDataCandidate, SignatureDocumentDataCardinality, SignatureDocumentDataClassification, SignatureDocumentDataCompatibleSourceBinding, SignatureDocumentDataContractDescriptor, SignatureDocumentDataFieldDescriptor, SignatureDocumentDataFieldMapping, SignatureDocumentDataFieldType, SignatureDocumentDataFixedSourceBinding, SignatureDocumentDataFormatter, SignatureDocumentDataLookupMode, SignatureDocumentDataResourceRef, SignatureDocumentDataSourceCatalog, SignatureDocumentDataSourceCatalogEntry, SignatureDocumentDataSourceDescriptor, SignatureDocumentDataSourceResolution, SignatureDocumentDataStatus, SignatureAuthenticationCapability, SignatureAuthenticationMethod, SignatureAuthenticationMethodSelectorProps, SignatureCapability, SignatureCapabilityCatalog, SignatureCapabilityKind, SignatureCapabilityStatus, SignatureCapabilityUnavailableReason, SignatureInvitationCapability, SignatureInvitationChannel, SignatureInvitationChannelSelectorProps, SignatureRequestPreparationDocument, SignatureRequestPreparationEditorPreparation, SignatureRequestPreparationEditorProps, SignatureRequestPreparationDataSourceCard, SignatureRequestPreparationEditPolicy, SignatureRequestPreparationExactPreviewPreparation, SignatureRequestPreparationExactPreviewProps, SignatureRequestPreparationInputDefinition, SignatureRequestPreparationInputKind, SignatureRequestPreparationInputValueAuthority, SignatureRequestPreparationPlacementEditorProps, SignatureRequestPreparationPlacementElement, SignatureRequestPreparationPlacementFormElement, SignatureRequestPreparationPlacementFormKind, SignatureRequestPreparationPlacementImageAsset, SignatureRequestPreparationPlacementImageElement, SignatureRequestPreparationPlacementParticipant, SignatureRequestPreparationPlacementStaticCheckboxElement, SignatureRequestPreparationPlacementDataSourceElement, SignatureRequestPreparationPlacementStaticTextElement, SignatureRequestPreparationRect, SignatureRequestPreparationRenderStatus, SignatureRequestPreparationStatus, SignatureRequestPreparationTextElement, SignatureRoutingCapability, SignatureRoutingMode, SignatureTemporalDisplayPart, SignatureSingleRequestDialogProps, SignatureSingleRequestParticipant, SignatureSingleRequestParticipantAssignmentSource, SignatureSingleRequestParticipantCandidate, SignatureSingleRequestParticipantSubmission, SignatureSingleRequestPreparationReference, SignatureSingleRequestSubmission, } from "./signature";
11
+ export { SIGNATURE_DOCUMENT_DATA_CLASSIFICATIONS, SIGNATURE_DOCUMENT_DATA_FIELD_TYPES, SIGNATURE_DOCUMENT_DATA_FORMATTERS, SIGNATURE_DOCUMENT_DATA_LOOKUP_MODES, SIGNATURE_DOCUMENT_DATA_STATUSES, } from "./signature";
12
+ export * from "./platform";
13
+ export { organizationTargetQueryParams, parseLegalEntityCreateTargetSearchParams, parseOrganizationTargetListSearchParams, readOrganizationListScope, writeOrganizationListScope, } from "./organization-target";
14
+ export type { NxOrganizationTargetSelectorProps, NxOperatingUnitSelectorProps, OrganizationTarget, OrganizationTargetLegalEntity, OrganizationListScope, OrganizationListScopeMode, OrganizationListScopeResult, OrganizationTargetSelectorOption, LegalEntityCreateTargetQuery, OrganizationTargetOperatingUnit, OrganizationTargetQuery, OrganizationTargetQueryResult, OrganizationTargetSetResponse, } from "./organization-target";
15
+ export { appTestI18n, appTestServer, configureNexiaAppFrontendTestHost, } from "./testing";
16
+ export type { NexiaAppFrontendTestHostBindings } from "./testing";
17
+ export { canForAnyPopulation, canForPopulation } from "./permissions";
18
+ export type { SubjectPopulation } from "./permissions";
19
+ export { formatNumber } from "./number";
20
+ export type { NumberLike } from "./number";
21
+ export { CompositionSpecValidationError, parseCompositionSpec, } from "./resource-composition";
22
+ export type { CompositionSpec, CompositionSpecV3, CompositionSpecV4 } from "./resource-composition";
23
+ export { RESOURCE_PICKER_STALE_TIME_MS, RESOURCE_REFERENCE_STATUSES, allowsManualReferenceFallback, isResourceReferenceBlocked, isResourceReferenceStatus, parseResourceReferenceOptionPage, resourcePickerRevalidation, resourceReferencePickerQueryKey, resourceReferencePickerQueryRoot, resourceReferenceOptionsRoute, savedResourceReferencePresentation, } from "./resource-reference";
24
+ export type { ResourceCreateDestination, ResourceCreateDestinationRegistration, ResourceCreateDestinationRegistry, } from "./resource-create-destination";
25
+ export type { ResourcePickerQueryState, ResourcePickerRefetchOptions, ResourcePickerRevalidation, ResourceReferenceAvailability, ResourceReferenceIdentity, ResourceReferenceOption, ResourceReferenceOptionPage, ResourceReferenceOptionPageMeta, ResourceReferenceOptionsResponse, ResourceReferencePickerQueryScope, ResourceReferenceSelectorContext, ResourceReferenceStatus, } from "./resource-reference";
26
+ export { APP_AVAILABILITY_STATES, isAppAvailabilityState, permitsManualFallback, } from "./app-availability";
27
+ /** @deprecated Use permitsManualFallback. */
28
+ export { allowsManualAppFallback } from "./app-availability";
29
+ export type { AppAvailabilityState } from "./app-availability";
30
+ export { HANDOFF_RESULT_STATES, isHandoffResultState, isRetryableFailure, } from "./handoff-result";
31
+ /** @deprecated Use isRetryableFailure. */
32
+ export { isRetryableHandoffFailure } from "./handoff-result";
33
+ export type { HandoffResultState } from "./handoff-result";
34
+ export type { ApprovalActor, ApprovalBodySnapshot, ApprovalBusinessFormController, ApprovalBusinessFormBinding, ApprovalBusinessFormDraftResult, ApprovalBusinessFormEntryMode, ApprovalBusinessFormRegistration, ApprovalBusinessFormRegistry, ApprovalBusinessFormSlotPropsV2, ApprovalBusinessFormSubmitError, ApprovalBusinessFormSubmitEnvelope, ApprovalBusinessFormSubmitResult, ApprovalBusinessFormSubject, ApprovalBusinessFormTemplate, ApprovalBusinessFormWidgetLoader, ApprovalCase, ApprovalCirculationRecipient, ApprovalDocument, ApprovalDocumentField, ApprovalDocumentSection, ApprovalDocumentView, ApprovalDrafterIdentity, ApprovalResourceSummary, ApprovalResourceSummaryField, ApprovalLineResolutionCategory, ApprovalLineResolutionError, ApprovalLineStages, ApprovalLineStep, ApprovalState, ApprovalStepKind, ApprovalStep, ApprovalSupplementalBodySnapshot, } from "./approval";
35
+ export { APPROVAL_STATES, APPROVAL_STEP_KINDS } from "./approval";
36
+ export type { BpmnEditorDocument, BpmnEditorElement, BpmnEditorNodeType, BpmnEditorProcess, DmnEditorDocument, DmnEditorHitPolicy, DmnEditorInputClause, DmnEditorOutputClause, DmnEditorRule, DmnEditorValueType, ProcessUserTaskFormController, ProcessUserTaskFormRegistrar, ProcessUserTaskFormRegistration, ProcessUserTaskFormRegistry, ProcessUserTaskFormSlotPropsV1, ProcessUserTaskFormWidgetLoader, ProcessUserTaskResourceRef, } from "./process";
37
+ export { DMN_EDITOR_HIT_POLICIES } from "./process";
38
+ export type { AppRouteFrameProps, AppRoutePrefetchContext, AppRoutePrefetcher, AutoRegisterPackageSurfacesOptions, PackageSurfaceLoader, PackageSurfaceOverride, PackageSurfaceOverrideRegistration, FormFieldErrors, InspectorActionProps, InspectorResourceActionsProps, ListLocateRecord, MessageApi, MutationFormError, NxCanonicalRoutePaneProps, NxActionKind, NxIconButtonProps, NxComboboxOption, NxComboboxProps, NxRefreshControlProps, NxColumnBrowserLabels, NxColumnBrowserProps, NxColumnNode, NxColumnPickerLabels, NxColumnPickerProps, NxDatePickerLabels, NxDatePickerProps, NxDateRangePickerProps, NxDateRangeValue, NxDropdownMenuItem, NxHelpTooltipProps, InsightFilterControls, InsightFilterState, InsightQueryLike, InsightRangePreset, UseInsightFilterStateOptions, NxOverviewBandCard, NxSelectOption, NxStatDelta, NxStatDeltaDirection, NxStatDeltaTone, NxTabNavItem, NxTabNavProps, NxTooltipAlign, NxTooltipProps, NxTooltipSide, OpenResourceWorkTab, OpenResourceWorkTabOptions, ResourceCreateCompletion, ResourceCreateCompletionInput, ResourceCreateContinuationTarget, ResourceCreateReceiverRegistration, ResourceInspectorAdapter, ResourceInspectorAdapterLoader, ResourceInspectorAdapterProps, ResourceInspectorAdapterRegistry, ResourceInspectorPanelProps, ResourceInspectorStack, ResourceInspectorStackHostProps, ResourceInspectorStackProviderProps, ResourceInspectorStateProps, ResourceLinkProps, ResourceListFilters, ResourceListFilterValue, ResourceListFooterConfig, ResourceListParams, ResourceListParamsControls, ResourceListRefreshConfig, ResourceListToolbarConfig, ResourceListToolbarMoreMenuProps, ResourceListToolbarViewOption, ResourcePrimaryCellProps, ResourceActionDescriptor, ResourceRef, ResourceRowActionsMenuProps, ResourceStatusBadgeProps, ResourceTableColumn, ResourceTableDensity, ResourceTableProps, ResourceTableStyle, ResourceTableSummaryRow, ResourceTableSort, TabContextActionContext, TabContextActionRegistration, TabContextActionResult, ResourceTextCellProps, ToastOptions, ToastSource, UseRegisterListLocateActionOptions, UseResourceListParamsOptions, WorkSectionProps, FavoriteTarget, WorkTabRef, WorkSurfaceAction, WorkSurfaceLabelInput, WorkSurfaceLabels, WorkSurfaceProps, } from "./shell";
39
+ export { FavoriteButton } from "./host";
40
+ export type { FavoriteButtonProps } from "./host";
41
+ export { createSpreadsheetWorkbook } from "./spreadsheet";
42
+ export type { SpreadsheetWorkbook, SpreadsheetWorksheet, SpreadsheetCell, NxSpreadsheetEditorProps } from "./spreadsheet";
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ export { defineResourceInformationSchema, resourceInformationValue, } from "./resources/resource-information.js";
2
+ export { createDataMigrationSessionCheckpointStore, dataMigrationUploadAccept, dataMigrationRunPublicId, isDataMigrationOperationAccepted, } from "./data-migration.js";
3
+ export { projectSignatureCapabilityCatalog, signatureCapabilityIdentity, } from "./signature.js";
4
+ export { SIGNATURE_DOCUMENT_DATA_CLASSIFICATIONS, SIGNATURE_DOCUMENT_DATA_FIELD_TYPES, SIGNATURE_DOCUMENT_DATA_FORMATTERS, SIGNATURE_DOCUMENT_DATA_LOOKUP_MODES, SIGNATURE_DOCUMENT_DATA_STATUSES, } from "./signature.js";
5
+ export * from "./platform.js";
6
+ export { organizationTargetQueryParams, parseLegalEntityCreateTargetSearchParams, parseOrganizationTargetListSearchParams, readOrganizationListScope, writeOrganizationListScope, } from "./organization-target.js";
7
+ export { appTestI18n, appTestServer, configureNexiaAppFrontendTestHost, } from "./testing.js";
8
+ export { canForAnyPopulation, canForPopulation } from "./permissions.js";
9
+ export { formatNumber } from "./number.js";
10
+ export { CompositionSpecValidationError, parseCompositionSpec, } from "./resource-composition.js";
11
+ export { RESOURCE_PICKER_STALE_TIME_MS, RESOURCE_REFERENCE_STATUSES, allowsManualReferenceFallback, isResourceReferenceBlocked, isResourceReferenceStatus, parseResourceReferenceOptionPage, resourcePickerRevalidation, resourceReferencePickerQueryKey, resourceReferencePickerQueryRoot, resourceReferenceOptionsRoute, savedResourceReferencePresentation, } from "./resource-reference.js";
12
+ export { APP_AVAILABILITY_STATES, isAppAvailabilityState, permitsManualFallback, } from "./app-availability.js";
13
+ /** @deprecated Use permitsManualFallback. */
14
+ export { allowsManualAppFallback } from "./app-availability.js";
15
+ export { HANDOFF_RESULT_STATES, isHandoffResultState, isRetryableFailure, } from "./handoff-result.js";
16
+ /** @deprecated Use isRetryableFailure. */
17
+ export { isRetryableHandoffFailure } from "./handoff-result.js";
18
+ export { APPROVAL_STATES, APPROVAL_STEP_KINDS } from "./approval.js";
19
+ export { DMN_EDITOR_HIT_POLICIES } from "./process.js";
20
+ export { FavoriteButton } from "./host.js";
21
+ export { createSpreadsheetWorkbook } from "./spreadsheet.js";
@@ -0,0 +1,2 @@
1
+ export type NumberLike = number | string | null | undefined;
2
+ export declare function formatNumber(value: NumberLike, locale: string, options?: Intl.NumberFormatOptions): string;
package/dist/number.js ADDED
@@ -0,0 +1,9 @@
1
+ export function formatNumber(value, locale, options) {
2
+ if (value == null || value === '') {
3
+ return '—';
4
+ }
5
+ const numeric = typeof value === 'string' ? Number(value) : value;
6
+ return Number.isFinite(numeric)
7
+ ? new Intl.NumberFormat(locale, options).format(numeric)
8
+ : '—';
9
+ }
@@ -0,0 +1,101 @@
1
+ import type { UseQueryResult } from '@tanstack/react-query';
2
+ import type { ReactNode } from 'react';
3
+ import type { NxComboboxProps } from './shell';
4
+ export interface OrganizationTargetQuery {
5
+ legalEntityPublicIds?: readonly string[];
6
+ operatingUnitPublicIds?: readonly string[];
7
+ }
8
+ /** The only page-owned organization list scopes supported by the platform. */
9
+ export type OrganizationListScopeMode = 'legal-entity-list' | 'legal-entity-operating-unit-list';
10
+ export interface OrganizationListScope {
11
+ query: OrganizationTargetQuery;
12
+ /** A malformed or unsupported explicit URL selection must not broaden a request. */
13
+ invalid: boolean;
14
+ }
15
+ export interface OrganizationTargetLegalEntity {
16
+ public_id: string;
17
+ code: string;
18
+ name: string;
19
+ }
20
+ export interface OrganizationTargetOperatingUnit {
21
+ public_id: string;
22
+ code: string;
23
+ name: string;
24
+ }
25
+ /** One exact host-authorized Legal Entity target, optionally paired to one Operating Unit. */
26
+ export interface OrganizationTarget {
27
+ legal_entity: OrganizationTargetLegalEntity;
28
+ operating_unit: OrganizationTargetOperatingUnit | null;
29
+ }
30
+ export interface OrganizationTargetSetResponse {
31
+ data: OrganizationTarget[];
32
+ }
33
+ export type OrganizationTargetQueryResult = UseQueryResult<OrganizationTargetSetResponse, Error>;
34
+ export interface LegalEntityCreateTargetQuery {
35
+ legalEntityPublicId?: string;
36
+ }
37
+ export interface OrganizationTargetSelectorOption {
38
+ value: string;
39
+ label: ReactNode;
40
+ meta?: ReactNode;
41
+ searchText?: string;
42
+ disabled?: boolean;
43
+ }
44
+ interface OrganizationTargetSelectorBaseProps {
45
+ disabled?: boolean;
46
+ size?: 'xs' | 'sm' | 'md';
47
+ testId?: string;
48
+ /** A non-ready scope is a status summary, never an implicit "all" selector. */
49
+ status?: 'loading' | 'invalid' | 'unavailable';
50
+ }
51
+ /** Host-localized organization target controls for the supported page-scope modes. */
52
+ export type NxOrganizationTargetSelectorProps = (OrganizationTargetSelectorBaseProps & {
53
+ mode: 'legal-entity-list';
54
+ options: readonly OrganizationTargetSelectorOption[];
55
+ value: readonly string[];
56
+ onChange: (legalEntityPublicIds: string[]) => void;
57
+ }) | (OrganizationTargetSelectorBaseProps & {
58
+ mode: 'legal-entity-single';
59
+ options: readonly OrganizationTargetSelectorOption[];
60
+ value: string | null;
61
+ onChange: (legalEntityPublicId: string) => void;
62
+ }) | (OrganizationTargetSelectorBaseProps & {
63
+ mode: 'legal-entity-operating-unit-list';
64
+ targets: readonly OrganizationTarget[];
65
+ value: OrganizationTargetQuery;
66
+ onChange: (query: OrganizationTargetQuery) => void;
67
+ });
68
+ /** Host-provided page state for a permission-authorized organization list. */
69
+ export interface OrganizationListScopeResult {
70
+ query: OrganizationTargetQuery;
71
+ targets: OrganizationTargetQueryResult;
72
+ selectorProps: NxOrganizationTargetSelectorProps;
73
+ isLoading: boolean;
74
+ isError: boolean;
75
+ /** URL syntax or a resolved explicit selection is invalid. */
76
+ invalid: boolean;
77
+ canRead: boolean;
78
+ valid: boolean;
79
+ setQuery: (query: OrganizationTargetQuery) => void;
80
+ /** Ready-only list request parameters; undefined means callers must not fetch. */
81
+ requestParams: URLSearchParams | undefined;
82
+ }
83
+ /** Serializes the only accepted direct-target wire shape: `*_public_ids[]=uuid`. */
84
+ export declare function organizationTargetQueryParams(query?: OrganizationTargetQuery): URLSearchParams;
85
+ /** Parses the only accepted page-owned list target URL keys. */
86
+ export declare function parseOrganizationTargetListSearchParams(params: URLSearchParams): OrganizationTargetQuery;
87
+ /** Strict URL reader for a route's declared list scope. */
88
+ export declare function readOrganizationListScope(params: URLSearchParams, mode?: OrganizationListScopeMode): OrganizationListScope;
89
+ /** Rewrites only page-owned organization scope keys, preserving every other URL filter. */
90
+ export declare function writeOrganizationListScope(current: URLSearchParams, query: OrganizationTargetQuery): URLSearchParams;
91
+ /** Parses the only accepted page-owned Legal Entity create target URL key. */
92
+ export declare function parseLegalEntityCreateTargetSearchParams(params: URLSearchParams): LegalEntityCreateTargetQuery;
93
+ /** Form input over App-provided authorized options; never changes page or Shell scope. */
94
+ export type NxOperatingUnitSelectorProps = Omit<Extract<NxComboboxProps<string>, {
95
+ multiple?: false;
96
+ }>, 'multiple' | 'fullWidth' | 'ariaLabel' | 'placeholder'> & {
97
+ ariaLabel?: string;
98
+ placeholder?: ReactNode;
99
+ fullWidth?: true;
100
+ };
101
+ export {};
@@ -0,0 +1,105 @@
1
+ /** Serializes the only accepted direct-target wire shape: `*_public_ids[]=uuid`. */
2
+ export function organizationTargetQueryParams(query = {}) {
3
+ const params = new URLSearchParams();
4
+ appendPublicIds(params, 'legal_entity_public_ids[]', query.legalEntityPublicIds);
5
+ appendPublicIds(params, 'operating_unit_public_ids[]', query.operatingUnitPublicIds);
6
+ return params;
7
+ }
8
+ /** Parses the only accepted page-owned list target URL keys. */
9
+ export function parseOrganizationTargetListSearchParams(params) {
10
+ assertNoUnsupportedOrganizationTargetKeys(params, "list");
11
+ const legalEntityPublicIds = parsePublicIds(params, "legal_entity_public_ids[]");
12
+ const operatingUnitPublicIds = parsePublicIds(params, "operating_unit_public_ids[]");
13
+ return {
14
+ ...(legalEntityPublicIds === undefined ? {} : { legalEntityPublicIds }),
15
+ ...(operatingUnitPublicIds === undefined ? {} : { operatingUnitPublicIds }),
16
+ };
17
+ }
18
+ /** Strict URL reader for a route's declared list scope. */
19
+ export function readOrganizationListScope(params, mode = 'legal-entity-list') {
20
+ try {
21
+ const query = parseOrganizationTargetListSearchParams(params);
22
+ if (mode === 'legal-entity-list' &&
23
+ query.operatingUnitPublicIds !== undefined) {
24
+ throw new Error('Operating Unit targets are not supported by this list.');
25
+ }
26
+ return { query, invalid: false };
27
+ }
28
+ catch {
29
+ return { query: {}, invalid: true };
30
+ }
31
+ }
32
+ /** Rewrites only page-owned organization scope keys, preserving every other URL filter. */
33
+ export function writeOrganizationListScope(current, query) {
34
+ const next = new URLSearchParams(current);
35
+ for (const key of ORGANIZATION_TARGET_KEYS)
36
+ next.delete(key);
37
+ for (const [key, value] of organizationTargetQueryParams(query))
38
+ next.append(key, value);
39
+ next.delete('page');
40
+ return next;
41
+ }
42
+ /** Parses the only accepted page-owned Legal Entity create target URL key. */
43
+ export function parseLegalEntityCreateTargetSearchParams(params) {
44
+ assertNoUnsupportedOrganizationTargetKeys(params, "create");
45
+ const values = params.getAll("legal_entity_public_id");
46
+ if (values.length === 0)
47
+ return {};
48
+ if (values.length !== 1)
49
+ throw new Error("legal_entity_public_id cannot be repeated.");
50
+ return { legalEntityPublicId: normalizePublicId(values[0], "legal_entity_public_id") };
51
+ }
52
+ function appendPublicIds(params, key, values) {
53
+ if (values === undefined)
54
+ return;
55
+ const ids = new Set();
56
+ for (const value of values) {
57
+ const id = normalizePublicId(value, key);
58
+ if (ids.has(id))
59
+ throw new Error(`${key} cannot contain duplicate UUIDs.`);
60
+ ids.add(id);
61
+ }
62
+ if (ids.size === 0) {
63
+ throw new Error(`${key} cannot be empty; omit it for all authorized targets.`);
64
+ }
65
+ for (const id of [...ids].sort()) {
66
+ params.append(key, id);
67
+ }
68
+ }
69
+ function parsePublicIds(params, key) {
70
+ const values = params.getAll(key);
71
+ if (values.length === 0)
72
+ return undefined;
73
+ const ids = values.map((value) => normalizePublicId(value, key));
74
+ if (new Set(ids).size !== ids.length)
75
+ throw new Error(`${key} cannot contain duplicate UUIDs.`);
76
+ return [...ids].sort();
77
+ }
78
+ function assertNoUnsupportedOrganizationTargetKeys(params, mode) {
79
+ const allowed = mode === "list"
80
+ ? new Set(["legal_entity_public_ids[]", "operating_unit_public_ids[]"])
81
+ : new Set(["legal_entity_public_id"]);
82
+ const organizationKeys = new Set(ORGANIZATION_TARGET_KEYS);
83
+ for (const key of params.keys()) {
84
+ if (organizationKeys.has(key) && !allowed.has(key)) {
85
+ throw new Error(`${key} is not valid for ${mode} organization targets.`);
86
+ }
87
+ }
88
+ }
89
+ function normalizePublicId(value, key) {
90
+ if (value.trim() !== value || !UUID_PATTERN.test(value)) {
91
+ throw new Error(`${key} must contain non-empty RFC UUIDs without surrounding whitespace.`);
92
+ }
93
+ return value.toLowerCase();
94
+ }
95
+ const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
96
+ const ORGANIZATION_TARGET_KEYS = [
97
+ 'legal_entity_public_id',
98
+ 'legal_entity_public_id[]',
99
+ 'legal_entity_public_ids',
100
+ 'legal_entity_public_ids[]',
101
+ 'operating_unit_public_id',
102
+ 'operating_unit_public_id[]',
103
+ 'operating_unit_public_ids',
104
+ 'operating_unit_public_ids[]',
105
+ ];
@@ -0,0 +1,3 @@
1
+ export type SubjectPopulation = 'all' | 'self' | 'direct_reports' | 'legal_entity' | 'operating_unit';
2
+ export declare function canForPopulation(populations: Record<string, SubjectPopulation[]>, permission: string, population: SubjectPopulation): boolean;
3
+ export declare function canForAnyPopulation(populations: Record<string, SubjectPopulation[]>, permission: string, required: SubjectPopulation[]): boolean;
@@ -0,0 +1,12 @@
1
+ function matchesPermission(pattern, target) {
2
+ return pattern === target
3
+ || pattern === '*'
4
+ || (pattern.endsWith('.*') && target.startsWith(pattern.slice(0, -1)));
5
+ }
6
+ export function canForPopulation(populations, permission, population) {
7
+ return Object.entries(populations).some(([pattern, allowed]) => matchesPermission(pattern, permission)
8
+ && (allowed.includes('all') || allowed.includes(population)));
9
+ }
10
+ export function canForAnyPopulation(populations, permission, required) {
11
+ return required.some((population) => canForPopulation(populations, permission, population));
12
+ }