@aglyn/aglyn 1.0.0-beta.220 → 1.0.0-beta.222
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +15 -11
- package/src/lib/app-utils/agent-openapi.js +1 -1
- package/src/lib/app-utils/agent-openapi.js.map +1 -1
- package/src/lib/app-utils/analytics-events.d.ts +3 -2
- package/src/lib/app-utils/analytics-events.js +3 -2
- package/src/lib/app-utils/analytics-events.js.map +1 -1
- package/src/lib/app-utils/api-plugins.d.ts +30 -0
- package/src/lib/app-utils/api-plugins.js +24 -1
- package/src/lib/app-utils/api-plugins.js.map +1 -1
- package/src/lib/app-utils/author-html.d.ts +1 -1
- package/src/lib/app-utils/author-html.js.map +1 -1
- package/src/lib/app-utils/bandwidth-cap.d.ts +12 -1
- package/src/lib/app-utils/bandwidth-cap.js +17 -1
- package/src/lib/app-utils/bandwidth-cap.js.map +1 -1
- package/src/lib/app-utils/compose-reusable-components.d.ts +19 -0
- package/src/lib/app-utils/compose-reusable-components.js +116 -26
- package/src/lib/app-utils/compose-reusable-components.js.map +1 -1
- package/src/lib/app-utils/console-routes.d.ts +4 -0
- package/src/lib/app-utils/console-routes.js +3 -0
- package/src/lib/app-utils/console-routes.js.map +1 -1
- package/src/lib/app-utils/contacts.d.ts +71 -0
- package/src/lib/app-utils/contacts.js +55 -0
- package/src/lib/app-utils/contacts.js.map +1 -1
- package/src/lib/app-utils/contexts.d.ts +1 -0
- package/src/lib/app-utils/contexts.js +1 -0
- package/src/lib/app-utils/contexts.js.map +1 -1
- package/src/lib/app-utils/crm-email-templates.js +21 -4
- package/src/lib/app-utils/crm-email-templates.js.map +1 -1
- package/src/lib/app-utils/crm-kinds.d.ts +2 -0
- package/src/lib/app-utils/crm-kinds.js +1 -0
- package/src/lib/app-utils/crm-kinds.js.map +1 -1
- package/src/lib/app-utils/crm.d.ts +1199 -67
- package/src/lib/app-utils/crm.js +1951 -310
- package/src/lib/app-utils/crm.js.map +1 -1
- package/src/lib/app-utils/csv-import.d.ts +10 -38
- package/src/lib/app-utils/csv-import.js +17 -42
- package/src/lib/app-utils/csv-import.js.map +1 -1
- package/src/lib/app-utils/csv.d.ts +32 -11
- package/src/lib/app-utils/csv.js +43 -5
- package/src/lib/app-utils/csv.js.map +1 -1
- package/src/lib/app-utils/default-site.d.ts +116 -0
- package/src/lib/app-utils/default-site.js +1024 -0
- package/src/lib/app-utils/default-site.js.map +1 -0
- package/src/lib/app-utils/docs-help.generated.d.ts +23 -23
- package/src/lib/app-utils/docs-help.generated.js +47 -10
- package/src/lib/app-utils/docs-help.generated.js.map +1 -1
- package/src/lib/app-utils/docs-index.generated.js +746 -151
- package/src/lib/app-utils/docs-index.generated.js.map +1 -1
- package/src/lib/app-utils/draft-placeholders.d.ts +76 -0
- package/src/lib/app-utils/draft-placeholders.js +115 -0
- package/src/lib/app-utils/draft-placeholders.js.map +1 -0
- package/src/lib/app-utils/entity-picker-context.d.ts +19 -15
- package/src/lib/app-utils/entity-picker-context.js +4 -4
- package/src/lib/app-utils/entity-picker-context.js.map +1 -1
- package/src/lib/app-utils/expand-repeatables.d.ts +66 -10
- package/src/lib/app-utils/expand-repeatables.js +88 -14
- package/src/lib/app-utils/expand-repeatables.js.map +1 -1
- package/src/lib/app-utils/forms.d.ts +33 -22
- package/src/lib/app-utils/forms.js +47 -28
- package/src/lib/app-utils/forms.js.map +1 -1
- package/src/lib/app-utils/full-use-cost.d.ts +277 -0
- package/src/lib/app-utils/full-use-cost.js +421 -0
- package/src/lib/app-utils/full-use-cost.js.map +1 -0
- package/src/lib/app-utils/health-report.js +33 -0
- package/src/lib/app-utils/health-report.js.map +1 -1
- package/src/lib/app-utils/leaving-notice.d.ts +96 -0
- package/src/lib/app-utils/leaving-notice.js +157 -0
- package/src/lib/app-utils/leaving-notice.js.map +1 -0
- package/src/lib/app-utils/llms-txt.d.ts +20 -0
- package/src/lib/app-utils/llms-txt.js +7 -1
- package/src/lib/app-utils/llms-txt.js.map +1 -1
- package/src/lib/app-utils/media-asset-facts.d.ts +16 -1
- package/src/lib/app-utils/media-asset-facts.js +40 -13
- package/src/lib/app-utils/media-asset-facts.js.map +1 -1
- package/src/lib/app-utils/media-bandwidth.d.ts +52 -0
- package/src/lib/app-utils/media-bandwidth.js +94 -0
- package/src/lib/app-utils/media-bandwidth.js.map +1 -0
- package/src/lib/app-utils/media-ref.d.ts +241 -33
- package/src/lib/app-utils/media-ref.js +324 -43
- package/src/lib/app-utils/media-ref.js.map +1 -1
- package/src/lib/app-utils/media-src.d.ts +8 -8
- package/src/lib/app-utils/media-src.js +27 -11
- package/src/lib/app-utils/media-src.js.map +1 -1
- package/src/lib/app-utils/media-takedown-reach.d.ts +4 -1
- package/src/lib/app-utils/media-takedown-reach.js +6 -3
- package/src/lib/app-utils/media-takedown-reach.js.map +1 -1
- package/src/lib/app-utils/notifications.d.ts +1 -1
- package/src/lib/app-utils/notifications.js +2 -0
- package/src/lib/app-utils/notifications.js.map +1 -1
- package/src/lib/app-utils/operator-alerts.js +17 -0
- package/src/lib/app-utils/operator-alerts.js.map +1 -1
- package/src/lib/app-utils/organizations.d.ts +51 -2
- package/src/lib/app-utils/organizations.js +56 -3
- package/src/lib/app-utils/organizations.js.map +1 -1
- package/src/lib/app-utils/page-record-sources.d.ts +87 -0
- package/src/lib/app-utils/page-record-sources.js +53 -0
- package/src/lib/app-utils/page-record-sources.js.map +1 -0
- package/src/lib/app-utils/paid-media-source.d.ts +3 -7
- package/src/lib/app-utils/paid-media-source.js +5 -19
- package/src/lib/app-utils/paid-media-source.js.map +1 -1
- package/src/lib/app-utils/person-erasure.d.ts +5 -2
- package/src/lib/app-utils/person-erasure.js.map +1 -1
- package/src/lib/app-utils/picklists.d.ts +187 -0
- package/src/lib/app-utils/picklists.js +320 -0
- package/src/lib/app-utils/picklists.js.map +1 -0
- package/src/lib/app-utils/plan-entitlements.d.ts +220 -50
- package/src/lib/app-utils/plan-entitlements.js +309 -115
- package/src/lib/app-utils/plan-entitlements.js.map +1 -1
- package/src/lib/app-utils/realm-host-surface.generated.js +2 -0
- package/src/lib/app-utils/realm-host-surface.generated.js.map +1 -1
- package/src/lib/app-utils/release-flags.d.ts +1 -1
- package/src/lib/app-utils/release-flags.js +11 -0
- package/src/lib/app-utils/release-flags.js.map +1 -1
- package/src/lib/app-utils/rendered-widths.d.ts +121 -0
- package/src/lib/app-utils/rendered-widths.js +211 -0
- package/src/lib/app-utils/rendered-widths.js.map +1 -0
- package/src/lib/app-utils/repeat-sources.d.ts +2 -1
- package/src/lib/app-utils/repeat-sources.js.map +1 -1
- package/src/lib/app-utils/screen-link-context-value.d.ts +7 -0
- package/src/lib/app-utils/screen-link-context-value.js.map +1 -1
- package/src/lib/app-utils/screen-link-context.js +14 -2
- package/src/lib/app-utils/screen-link-context.js.map +1 -1
- package/src/lib/app-utils/screen-route.d.ts +157 -36
- package/src/lib/app-utils/screen-route.js +191 -41
- package/src/lib/app-utils/screen-route.js.map +1 -1
- package/src/lib/app-utils/seo-audit.d.ts +11 -1
- package/src/lib/app-utils/seo-audit.js +33 -13
- package/src/lib/app-utils/seo-audit.js.map +1 -1
- package/src/lib/app-utils/seo-keywords.d.ts +11 -0
- package/src/lib/app-utils/seo-keywords.js +19 -5
- package/src/lib/app-utils/seo-keywords.js.map +1 -1
- package/src/lib/app-utils/seo-page-facts.d.ts +47 -4
- package/src/lib/app-utils/seo-page-facts.js +136 -31
- package/src/lib/app-utils/seo-page-facts.js.map +1 -1
- package/src/lib/app-utils/seo-site-scan.d.ts +42 -4
- package/src/lib/app-utils/seo-site-scan.js +113 -12
- package/src/lib/app-utils/seo-site-scan.js.map +1 -1
- package/src/lib/app-utils/server.d.ts +5 -4
- package/src/lib/app-utils/server.js +14 -5
- package/src/lib/app-utils/server.js.map +1 -1
- package/src/lib/app-utils/site-icon-set.d.ts +195 -0
- package/src/lib/app-utils/site-icon-set.js +351 -0
- package/src/lib/app-utils/site-icon-set.js.map +1 -0
- package/src/lib/app-utils/site-interactions.d.ts +101 -4
- package/src/lib/app-utils/site-interactions.js +120 -4
- package/src/lib/app-utils/site-interactions.js.map +1 -1
- package/src/lib/app-utils/starter-template-nodes.d.ts +7 -0
- package/src/lib/app-utils/starter-template-nodes.js +3 -0
- package/src/lib/app-utils/starter-template-nodes.js.map +1 -1
- package/src/lib/app-utils/starter-templates.d.ts +5 -19
- package/src/lib/app-utils/starter-templates.js +5 -49
- package/src/lib/app-utils/starter-templates.js.map +1 -1
- package/src/lib/app-utils/transfer-launcher-context.d.ts +136 -0
- package/src/lib/app-utils/transfer-launcher-context.js +23 -0
- package/src/lib/app-utils/transfer-launcher-context.js.map +1 -0
- package/src/lib/app-utils/transfer-resume-import.d.ts +39 -0
- package/src/lib/app-utils/transfer-resume-import.js +128 -0
- package/src/lib/app-utils/transfer-resume-import.js.map +1 -0
- package/src/lib/app-utils/upgrade-proposal.d.ts +66 -0
- package/src/lib/app-utils/upgrade-proposal.js +95 -0
- package/src/lib/app-utils/upgrade-proposal.js.map +1 -0
- package/src/lib/app-utils/utc-month.d.ts +33 -0
- package/src/lib/app-utils/utc-month.js +35 -0
- package/src/lib/app-utils/utc-month.js.map +1 -0
- package/src/lib/app-utils/visitor-record-ceiling.d.ts +4 -4
- package/src/lib/app-utils/visitor-record-ceiling.js +4 -4
- package/src/lib/app-utils/visitor-record-ceiling.js.map +1 -1
- package/src/lib/app-utils/wire-nodes.d.ts +39 -19
- package/src/lib/app-utils/wire-nodes.js +120 -34
- package/src/lib/app-utils/wire-nodes.js.map +1 -1
- package/src/lib/data-transfer/access.d.ts +74 -0
- package/src/lib/data-transfer/access.js +93 -0
- package/src/lib/data-transfer/access.js.map +1 -0
- package/src/lib/data-transfer/derive.d.ts +246 -0
- package/src/lib/data-transfer/derive.js +1007 -0
- package/src/lib/data-transfer/derive.js.map +1 -0
- package/src/lib/data-transfer/export-file.d.ts +46 -0
- package/src/lib/data-transfer/export-file.js +146 -0
- package/src/lib/data-transfer/export-file.js.map +1 -0
- package/src/lib/data-transfer/field-catalog.d.ts +134 -0
- package/src/lib/data-transfer/field-catalog.js +278 -0
- package/src/lib/data-transfer/field-catalog.js.map +1 -0
- package/src/lib/data-transfer/header-match.d.ts +129 -0
- package/src/lib/data-transfer/header-match.js +367 -0
- package/src/lib/data-transfer/header-match.js.map +1 -0
- package/src/lib/data-transfer/index.d.ts +34 -0
- package/src/lib/data-transfer/index.js +40 -0
- package/src/lib/data-transfer/index.js.map +1 -0
- package/src/lib/data-transfer/job.d.ts +190 -0
- package/src/lib/data-transfer/job.js +229 -0
- package/src/lib/data-transfer/job.js.map +1 -0
- package/src/lib/data-transfer/lookup.d.ts +45 -0
- package/src/lib/data-transfer/lookup.js +71 -0
- package/src/lib/data-transfer/lookup.js.map +1 -0
- package/src/lib/data-transfer/match.d.ts +99 -0
- package/src/lib/data-transfer/match.js +244 -0
- package/src/lib/data-transfer/match.js.map +1 -0
- package/src/lib/data-transfer/package-plan.d.ts +205 -0
- package/src/lib/data-transfer/package-plan.js +475 -0
- package/src/lib/data-transfer/package-plan.js.map +1 -0
- package/src/lib/data-transfer/package.d.ts +181 -0
- package/src/lib/data-transfer/package.js +426 -0
- package/src/lib/data-transfer/package.js.map +1 -0
- package/src/lib/data-transfer/picklist-map.d.ts +139 -0
- package/src/lib/data-transfer/picklist-map.js +271 -0
- package/src/lib/data-transfer/picklist-map.js.map +1 -0
- package/src/lib/data-transfer/plan.d.ts +176 -0
- package/src/lib/data-transfer/plan.js +451 -0
- package/src/lib/data-transfer/plan.js.map +1 -0
- package/src/lib/data-transfer/policy.d.ts +170 -0
- package/src/lib/data-transfer/policy.js +378 -0
- package/src/lib/data-transfer/policy.js.map +1 -0
- package/src/lib/data-transfer/resource.d.ts +211 -0
- package/src/lib/data-transfer/resource.js +241 -0
- package/src/lib/data-transfer/resource.js.map +1 -0
- package/src/lib/data-transfer/review.d.ts +70 -0
- package/src/lib/data-transfer/review.js +233 -0
- package/src/lib/data-transfer/review.js.map +1 -0
- package/src/lib/data-transfer/similarity.d.ts +40 -0
- package/src/lib/data-transfer/similarity.js +106 -0
- package/src/lib/data-transfer/similarity.js.map +1 -0
- package/src/lib/data-transfer/site-package.d.ts +365 -0
- package/src/lib/data-transfer/site-package.js +1077 -0
- package/src/lib/data-transfer/site-package.js.map +1 -0
- package/src/lib/data-transfer/source.d.ts +74 -0
- package/src/lib/data-transfer/source.js +293 -0
- package/src/lib/data-transfer/source.js.map +1 -0
- package/src/lib/data-transfer/transfer-api.d.ts +898 -0
- package/src/lib/data-transfer/transfer-api.js +107 -0
- package/src/lib/data-transfer/transfer-api.js.map +1 -0
- package/src/lib/foundation/definitions/org-billing.types.d.ts +31 -0
- package/src/lib/foundation/definitions/org-billing.types.js.map +1 -1
- package/src/lib/foundation/definitions/organization.types.d.ts +42 -1
- package/src/lib/foundation/definitions/organization.types.js.map +1 -1
- package/src/lib/foundation/definitions/platform.types.d.ts +6 -4
- package/src/lib/foundation/definitions/platform.types.js.map +1 -1
- package/src/lib/foundation/index.d.ts +1 -1
- package/src/lib/foundation/index.js.map +1 -1
- package/src/lib/plugin-manager/feature-plugins.d.ts +91 -2
- package/src/lib/plugin-manager/feature-plugins.js +48 -3
- package/src/lib/plugin-manager/feature-plugins.js.map +1 -1
- package/src/lib/plugin-manager/first-party-plugins.generated.d.ts +56 -0
- package/src/lib/plugin-manager/first-party-plugins.generated.js +1132 -27
- package/src/lib/plugin-manager/first-party-plugins.generated.js.map +1 -1
- package/src/lib/plugin-manager/index.d.ts +0 -1
- package/src/lib/plugin-manager/index.js +0 -1
- package/src/lib/plugin-manager/index.js.map +1 -1
- package/src/lib/plugin-manager/interaction-recipes.d.ts +142 -0
- package/src/lib/plugin-manager/interaction-recipes.js +104 -0
- package/src/lib/plugin-manager/interaction-recipes.js.map +1 -0
- package/src/lib/plugin-manager/interaction-step-checks.d.ts +66 -0
- package/src/lib/plugin-manager/interaction-step-checks.js +86 -0
- package/src/lib/plugin-manager/interaction-step-checks.js.map +1 -0
- package/src/lib/plugin-manager/plugin-artifact-types.d.ts +235 -0
- package/src/lib/plugin-manager/plugin-artifact-types.js +99 -0
- package/src/lib/plugin-manager/plugin-artifact-types.js.map +1 -0
- package/src/lib/plugin-manager/plugin-contact-capture.d.ts +8 -0
- package/src/lib/plugin-manager/plugin-contact-capture.js.map +1 -1
- package/src/lib/plugin-manager/plugin-conversion-credit.d.ts +216 -0
- package/src/lib/plugin-manager/plugin-conversion-credit.js +91 -0
- package/src/lib/plugin-manager/plugin-conversion-credit.js.map +1 -0
- package/src/lib/plugin-manager/plugin-entity-pickers.d.ts +83 -0
- package/src/lib/plugin-manager/plugin-entity-pickers.js +87 -0
- package/src/lib/plugin-manager/plugin-entity-pickers.js.map +1 -0
- package/src/lib/plugin-manager/plugin-host-resources.d.ts +6 -0
- package/src/lib/plugin-manager/plugin-host-resources.js +6 -1
- package/src/lib/plugin-manager/plugin-host-resources.js.map +1 -1
- package/src/lib/plugin-manager/plugin-intake-gates.d.ts +75 -0
- package/src/lib/plugin-manager/plugin-intake-gates.js +49 -0
- package/src/lib/plugin-manager/plugin-intake-gates.js.map +1 -0
- package/src/lib/plugin-manager/plugin-jobs.d.ts +5 -5
- package/src/lib/plugin-manager/plugin-jobs.js +7 -7
- package/src/lib/plugin-manager/plugin-jobs.js.map +1 -1
- package/src/lib/plugin-manager/plugin-live-paths.d.ts +70 -0
- package/src/lib/plugin-manager/plugin-live-paths.js +66 -0
- package/src/lib/plugin-manager/plugin-live-paths.js.map +1 -0
- package/src/lib/plugin-manager/plugin-org-erasure.d.ts +3 -2
- package/src/lib/plugin-manager/plugin-org-erasure.js +30 -5
- package/src/lib/plugin-manager/plugin-org-erasure.js.map +1 -1
- package/src/lib/plugin-manager/plugin-person-erasure.d.ts +68 -9
- package/src/lib/plugin-manager/plugin-person-erasure.js +196 -51
- package/src/lib/plugin-manager/plugin-person-erasure.js.map +1 -1
- package/src/lib/plugin-manager/plugin-person-records.d.ts +275 -0
- package/src/lib/plugin-manager/plugin-person-records.js +107 -0
- package/src/lib/plugin-manager/plugin-person-records.js.map +1 -0
- package/src/lib/plugin-manager/plugin-record-counts.d.ts +76 -0
- package/src/lib/plugin-manager/plugin-record-counts.js +49 -0
- package/src/lib/plugin-manager/plugin-record-counts.js.map +1 -0
- package/src/lib/plugin-manager/plugin-record-email-state.d.ts +26 -0
- package/src/lib/plugin-manager/plugin-record-email-state.js +16 -0
- package/src/lib/plugin-manager/plugin-record-email-state.js.map +1 -1
- package/src/lib/plugin-manager/plugin-record-index.d.ts +10 -0
- package/src/lib/plugin-manager/plugin-record-index.js.map +1 -1
- package/src/lib/plugin-manager/plugin-record-lists.d.ts +86 -6
- package/src/lib/plugin-manager/plugin-record-lists.js +42 -5
- package/src/lib/plugin-manager/plugin-record-lists.js.map +1 -1
- package/src/lib/plugin-manager/plugin-record-origin.d.ts +79 -0
- package/src/lib/plugin-manager/plugin-record-origin.js +46 -0
- package/src/lib/plugin-manager/plugin-record-origin.js.map +1 -0
- package/src/lib/plugin-manager/plugin-record-pages.d.ts +37 -0
- package/src/lib/plugin-manager/plugin-record-pages.js +52 -0
- package/src/lib/plugin-manager/plugin-record-pages.js.map +1 -0
- package/src/lib/plugin-manager/plugin-record-timeline.d.ts +60 -0
- package/src/lib/plugin-manager/plugin-record-timeline.js +16 -0
- package/src/lib/plugin-manager/plugin-record-timeline.js.map +1 -1
- package/src/lib/plugin-manager/plugin-resource-drafts.d.ts +5 -5
- package/src/lib/plugin-manager/plugin-resource-drafts.js.map +1 -1
- package/src/lib/plugin-manager/plugin-revocations.d.ts +64 -0
- package/src/lib/plugin-manager/plugin-revocations.js +47 -0
- package/src/lib/plugin-manager/plugin-revocations.js.map +1 -0
- package/src/lib/plugin-manager/plugin-send-tallies.d.ts +69 -0
- package/src/lib/plugin-manager/plugin-send-tallies.js +45 -0
- package/src/lib/plugin-manager/plugin-send-tallies.js.map +1 -0
- package/src/lib/plugin-manager/plugin-server-steps.d.ts +170 -0
- package/src/lib/plugin-manager/plugin-server-steps.js +116 -0
- package/src/lib/plugin-manager/plugin-server-steps.js.map +1 -0
- package/src/lib/plugin-manager/plugin-site-bundle.d.ts +40 -0
- package/src/lib/plugin-manager/plugin-site-bundle.js +4 -0
- package/src/lib/plugin-manager/plugin-site-bundle.js.map +1 -1
- package/src/lib/plugin-manager/plugin-site-export.d.ts +57 -1
- package/src/lib/plugin-manager/plugin-site-export.js +23 -10
- package/src/lib/plugin-manager/plugin-site-export.js.map +1 -1
- package/src/lib/plugin-manager/plugin-sitemap-readers.d.ts +146 -0
- package/src/lib/plugin-manager/plugin-sitemap-readers.js +110 -0
- package/src/lib/plugin-manager/plugin-sitemap-readers.js.map +1 -0
- package/src/lib/plugin-manager/plugin-transfer-resources.d.ts +714 -0
- package/src/lib/plugin-manager/plugin-transfer-resources.js +443 -0
- package/src/lib/plugin-manager/plugin-transfer-resources.js.map +1 -0
- package/src/lib/plugin-manager/plugin-usage-axes.d.ts +54 -5
- package/src/lib/plugin-manager/plugin-usage-axes.js +11 -3
- package/src/lib/plugin-manager/plugin-usage-axes.js.map +1 -1
- package/src/lib/plugin-manager/plugin-user-erasure.js +9 -1
- package/src/lib/plugin-manager/plugin-user-erasure.js.map +1 -1
- package/src/lib/plugin-manager/plugin-visitor-doors.d.ts +104 -0
- package/src/lib/plugin-manager/plugin-visitor-doors.js +108 -0
- package/src/lib/plugin-manager/plugin-visitor-doors.js.map +1 -0
- package/src/lib/plugin-manager/realm-host-aglyn.generated.js +2 -0
- package/src/lib/plugin-manager/realm-host-aglyn.generated.js.map +1 -1
- package/src/lib/plugin-manager/repeat-rows.d.ts +5 -6
- package/src/lib/plugin-manager/repeat-rows.js.map +1 -1
- package/src/lib/app-utils/actions.d.ts +0 -310
- package/src/lib/app-utils/actions.js +0 -506
- package/src/lib/app-utils/actions.js.map +0 -1
- package/src/lib/app-utils/automation-placeholders.d.ts +0 -72
- package/src/lib/app-utils/automation-placeholders.js +0 -207
- package/src/lib/app-utils/automation-placeholders.js.map +0 -1
- package/src/lib/app-utils/dataset-models.d.ts +0 -339
- package/src/lib/app-utils/dataset-models.js +0 -722
- package/src/lib/app-utils/dataset-models.js.map +0 -1
- package/src/lib/app-utils/datasets.d.ts +0 -171
- package/src/lib/app-utils/datasets.js +0 -227
- package/src/lib/app-utils/datasets.js.map +0 -1
- package/src/lib/app-utils/form-abuse-ceiling.d.ts +0 -146
- package/src/lib/app-utils/form-abuse-ceiling.js +0 -158
- package/src/lib/app-utils/form-abuse-ceiling.js.map +0 -1
- package/src/lib/plugin-manager/order-fulfilment.d.ts +0 -142
- package/src/lib/plugin-manager/order-fulfilment.js +0 -104
- package/src/lib/plugin-manager/order-fulfilment.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/data-transfer/plan.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*==========================================\n * THE PLAN — what an import WILL do, row by row, before it does anything.\n *\n * Given the rows (mapped and derived), each row's match outcome, the\n * records those matched, and the policy, the plan says for every row:\n * create, update, unchanged, skip or fail — with the field-by-field diff\n * (before → after, and which policy decided it) and the warnings it\n * raised. Nothing is written; the dry run IS this function run on the\n * server over every row.\n *\n * ## Warnings are typed and must be acknowledged\n *\n * Every class of thing that could surprise a person — a guessed date\n * order, a picklist value nobody chose for, a non-blank value about to be\n * overwritten, a value about to be cleared — is a warning class with a\n * count and samples. The classes in {@link ACKNOWLEDGED_WARNING_CLASSES}\n * (and a derivation class holding a flagged guess) must each be\n * acknowledged before Apply is enabled; {@link missingAcknowledgements}\n * says which are outstanding.\n *=========================================*/\n\nimport type { FieldDerivation, FieldProblem } from './derive'\nimport type { RowMatchOutcome } from './match'\nimport {\n appendTransferList,\n applyFieldPolicy,\n compareTransferValues,\n isBlankTransferValue,\n resolveFieldPolicy,\n resolveRecordPolicy,\n transferValuesEqual,\n} from './policy'\nimport type {\n FieldPolicyOutcome,\n TransferFieldMode,\n TransferPolicy,\n TransferPolicySource,\n TransferValuesComparator,\n} from './policy'\nimport { isTransferFieldWritable } from './resource'\nimport type { TransferField } from './resource'\n\n/** What a row will do. */\nexport type TransferRowVerdict = 'create' | 'update' | 'unchanged' | 'skip' | 'fail'\n\nexport const TRANSFER_ROW_VERDICTS: readonly TransferRowVerdict[] = ['create', 'update', 'unchanged', 'skip', 'fail']\n\n/** Why a row is skipped or fails. */\nexport type TransferRowReason =\n | 'matchedSkipped'\n | 'newSkipped'\n | 'skippedByChoice'\n | 'ambiguousSkipped'\n | 'ambiguousUnresolved'\n | 'duplicateInFile'\n | 'missingRequired'\n | 'refusedValue'\n | 'matchedRecordMissing'\n | 'planLimit'\n | 'resourceRule'\n\n/** A class of thing the person is warned about. */\nexport type TransferWarningClass =\n | 'derivation'\n | 'ambiguousDate'\n | 'unmatchedPicklist'\n | 'newPicklistValue'\n | 'unresolvedLookup'\n | 'ambiguousMatch'\n | 'duplicateInFile'\n | 'lockedRule'\n | 'droppedCell'\n | 'overwriteNonBlank'\n | 'clearValue'\n | 'planLimit'\n /**\n * What the owning plugin's own checks found in the file — a column, an\n * address, a count — named in each sample's `detail`. Raised by a\n * resource's `plan`, never by the core.\n */\n | 'screening'\n /**\n * The owning plugin's finding about one row — a rule no field policy can\n * say — folded in by `withTransferResourceFindings`; it may refuse the row.\n */\n | 'resourceRule'\n\nexport const TRANSFER_WARNING_CLASSES: readonly TransferWarningClass[] = [\n 'derivation',\n 'ambiguousDate',\n 'unmatchedPicklist',\n 'newPicklistValue',\n 'unresolvedLookup',\n 'ambiguousMatch',\n 'duplicateInFile',\n 'lockedRule',\n 'droppedCell',\n 'overwriteNonBlank',\n 'clearValue',\n 'planLimit',\n 'screening',\n 'resourceRule',\n]\n\n/**\n * The classes that always need an acknowledgement. `derivation` needs one\n * only when it holds a flagged guess; every other class is a change to data\n * or a row held back, and the person says they have seen it.\n */\nexport const ACKNOWLEDGED_WARNING_CLASSES: readonly TransferWarningClass[] = TRANSFER_WARNING_CLASSES.filter(\n (entry) => entry !== 'derivation',\n)\n\n/**\n * Something an earlier step of the wizard decided about a row: a picklist\n * value that was added, left blank or refuses the row; a lookup that did\n * not resolve. `refuse` fails the row.\n */\nexport interface TransferRowNote {\n class: Extract<TransferWarningClass, 'unmatchedPicklist' | 'newPicklistValue' | 'unresolvedLookup'>\n fieldId: string\n value: string\n refuse?: boolean\n detail?: string\n}\n\n/** One row as the plan takes it. */\nexport interface TransferPlanRow {\n /** Its index in the file. */\n index: number\n /** Field id → value; `null` for a mapped blank cell; absent for unmapped. */\n values: Readonly<Record<string, unknown>>\n derivations?: readonly FieldDerivation[]\n problems?: readonly FieldProblem[]\n notes?: readonly TransferRowNote[]\n}\n\n/** One field a row changes. */\nexport interface TransferFieldChange {\n fieldId: string\n before: unknown\n after: unknown\n mode: TransferFieldMode\n source: TransferPolicySource\n rule: FieldPolicyOutcome['rule']\n}\n\n/** One row's verdict. */\nexport interface PlannedTransferRow {\n index: number\n verdict: TransferRowVerdict\n /** The record updated (or `null` for a create). */\n recordId: string | null\n reason?: TransferRowReason\n /** Required fields a create lacked. */\n missing?: string[]\n /** Fields that change, before → after; on a create, `before` is `null`. */\n diff: TransferFieldChange[]\n /** Values the file had that this row will not write because of a locked rule. */\n heldBack: string[]\n warnings: TransferWarningClass[]\n match: RowMatchOutcome\n}\n\n/** One example of a warning. */\nexport interface TransferWarningSample {\n /** The row's index in the file; {@link TRANSFER_FILE_SAMPLE_ROW} for something about the whole file. */\n row: number\n fieldId?: string\n value?: string\n detail?: string\n}\n\n/** The `row` of a warning sample about the whole file rather than one row (a column's name). */\nexport const TRANSFER_FILE_SAMPLE_ROW = -1\n\n/** One class of warning, counted. */\nexport interface TransferWarning {\n class: TransferWarningClass\n /** Occurrences (a row can raise a class for several fields). */\n count: number\n /** Distinct rows that raised it. */\n rows: number\n fieldIds: string[]\n samples: TransferWarningSample[]\n requiresAcknowledgement: boolean\n}\n\nexport type TransferPlanSummary = Record<TransferRowVerdict, number> & { total: number }\n\nexport interface TransferPlan {\n rows: PlannedTransferRow[]\n summary: TransferPlanSummary\n warnings: TransferWarning[]\n /** The classes that must be acknowledged before the plan may be applied. */\n acknowledgementsRequired: TransferWarningClass[]\n}\n\n/** Bounds the plan enforces as it goes, from the organization's plan. */\nexport interface TransferPlanLimits {\n /** The most records this import may create. */\n maxCreates?: number\n /** The most records this import may write (creates and updates). */\n maxWrites?: number\n}\n\nexport interface BuildTransferPlanInput {\n fields: readonly TransferField[]\n rows: readonly TransferPlanRow[]\n /** One per row, in the same order. */\n matches: readonly RowMatchOutcome[]\n /** Record id → its current values by field id. */\n existing: ReadonlyMap<string, Readonly<Record<string, unknown>>>\n policy: TransferPolicy\n limits?: TransferPlanLimits\n /** Samples kept per warning class; default 5. */\n sampleSize?: number\n /**\n * The resource's answer to whether a field's value changes (AGL-3548):\n * a value it folds on write (`Published`, `published`) is not a change.\n */\n valuesEqual?: TransferValuesComparator\n}\n\ninterface Tally {\n count: number\n rows: Set<number>\n fields: Set<string>\n samples: TransferWarningSample[]\n flagged: boolean\n}\n\nclass WarningTally {\n private readonly byClass = new Map<TransferWarningClass, Tally>()\n\n constructor(private readonly sampleSize: number) {}\n\n add(entry: TransferWarningClass, sample: TransferWarningSample, flagged = true): void {\n const tally: Tally = this.byClass.get(entry) ?? { count: 0, rows: new Set(), fields: new Set(), samples: [], flagged: false }\n tally.count += 1\n tally.rows.add(sample.row)\n if (sample.fieldId) tally.fields.add(sample.fieldId)\n if (tally.samples.length < this.sampleSize) tally.samples.push(sample)\n tally.flagged ||= flagged\n this.byClass.set(entry, tally)\n }\n\n list(): TransferWarning[] {\n return TRANSFER_WARNING_CLASSES.filter((entry) => this.byClass.has(entry)).map((entry) => {\n const tally = this.byClass.get(entry) as Tally\n return {\n class: entry,\n count: tally.count,\n rows: tally.rows.size,\n fieldIds: [...tally.fields],\n samples: tally.samples,\n requiresAcknowledgement: ACKNOWLEDGED_WARNING_CLASSES.includes(entry) || tally.flagged,\n }\n })\n }\n}\n\n/** Whether a field's new value carries what the file said (every item, for a list). */\nfunction reflects(after: unknown, incoming: unknown): boolean {\n if (Array.isArray(incoming)) return transferValuesEqual(appendTransferList(after, incoming), after)\n return transferValuesEqual(after, incoming)\n}\n\nfunction display(value: unknown): string {\n if (value === null || value === undefined) return ''\n return typeof value === 'string' ? value : JSON.stringify(value)\n}\n\n/** The plan for a file (see the block header). */\nexport function buildTransferPlan(input: BuildTransferPlanInput): TransferPlan {\n const byId = new Map(input.fields.map((field) => [field.id, field]))\n const tally = new WarningTally(input.sampleSize ?? 5)\n const limits = input.limits ?? {}\n let creates = 0\n let writes = 0\n\n const rows = input.rows.map((row, position): PlannedTransferRow => {\n const match = input.matches[position] ?? { kind: 'new' }\n const warnings = new Set<TransferWarningClass>()\n const warn = (entry: TransferWarningClass, sample: Omit<TransferWarningSample, 'row'>, flagged = true): void => {\n warnings.add(entry)\n tally.add(entry, { row: row.index, ...sample }, flagged)\n }\n const finish = (\n verdict: TransferRowVerdict,\n recordId: string | null,\n extra: Partial<PlannedTransferRow> = {},\n ): PlannedTransferRow => ({\n index: row.index,\n verdict,\n recordId,\n diff: [],\n heldBack: [],\n ...extra,\n warnings: [...warnings],\n match,\n })\n\n for (const entry of row.derivations ?? []) {\n warn(entry.kind === 'ambiguousDate' ? 'ambiguousDate' : 'derivation', {\n fieldId: entry.fieldId,\n value: entry.from,\n detail: `${entry.note} → ${entry.to}`,\n }, entry.flagged)\n }\n for (const problem of row.problems ?? []) {\n warn('droppedCell', { fieldId: problem.fieldId, value: problem.raw, detail: problem.message })\n }\n let refused = false\n for (const note of row.notes ?? []) {\n warn(note.class, { fieldId: note.fieldId, value: note.value, ...(note.detail ? { detail: note.detail } : {}) })\n if (note.refuse) refused = true\n }\n if (refused) return finish('fail', null, { reason: 'refusedValue' })\n\n const record = resolveRecordPolicy(input.policy, row.index)\n let target: { kind: 'create' } | { kind: 'update'; recordId: string } | { kind: 'skip'; reason: TransferRowReason }\n if (record.action === 'skip') {\n target = { kind: 'skip', reason: 'skippedByChoice' }\n } else if (record.action === 'create') {\n target = { kind: 'create' }\n } else if (record.recordId) {\n target = { kind: 'update', recordId: record.recordId }\n } else if (match.kind === 'duplicateInFile') {\n warn('duplicateInFile', { value: match.via.value, fieldId: match.via.fieldId, detail: `Same as row ${match.firstRow + 1}` })\n target = { kind: 'skip', reason: 'duplicateInFile' }\n } else if (match.kind === 'ambiguous') {\n warn('ambiguousMatch', {\n fieldId: match.via.fieldId,\n value: match.via.value,\n detail: `${match.recordIds.length} records match`,\n })\n target = { kind: 'skip', reason: record.onAmbiguous === 'skip' ? 'ambiguousSkipped' : 'ambiguousUnresolved' }\n } else if (match.kind === 'matched') {\n if (match.alsoMatched?.length) {\n warn('ambiguousMatch', {\n fieldId: match.via.fieldId,\n value: match.via.value,\n detail: `Another key points at ${match.alsoMatched.length} other record(s)`,\n })\n }\n if (record.onMatch === 'skip') target = { kind: 'skip', reason: 'matchedSkipped' }\n else if (record.onMatch === 'duplicate') target = { kind: 'create' }\n else target = { kind: 'update', recordId: match.recordId }\n } else {\n target = record.onNew === 'skip' ? { kind: 'skip', reason: 'newSkipped' } : { kind: 'create' }\n }\n if (target.kind === 'skip') return finish('skip', null, { reason: target.reason })\n\n const before = target.kind === 'update' ? input.existing.get(target.recordId) : {}\n if (!before) return finish('fail', target.kind === 'update' ? target.recordId : null, { reason: 'matchedRecordMissing' })\n\n const diff: TransferFieldChange[] = []\n const heldBack: string[] = []\n for (const [fieldId, incoming] of Object.entries(row.values)) {\n const field = byId.get(fieldId)\n if (!field || !isTransferFieldWritable(field)) continue\n const resolved = resolveFieldPolicy(input.policy, row.index, field)\n const current = target.kind === 'update' ? before[fieldId] : null\n const equal = (a: unknown, b: unknown) => compareTransferValues(field, a, b, input.valuesEqual)\n // A new record has nothing to keep, fill around or append to: the\n // file's value is written unless a locked rule refuses it.\n const outcome =\n target.kind === 'create'\n ? applyFieldPolicy({ mode: 'overwrite', blank: 'leave', refuseValues: resolved.refuseValues }, null, incoming, equal)\n : applyFieldPolicy(resolved, current, incoming, equal)\n if (\n resolved.locked &&\n (resolved.refuseValues || resolved.source === 'locked') &&\n !isBlankTransferValue(incoming) &&\n !reflects(outcome.after, incoming)\n ) {\n heldBack.push(fieldId)\n warn('lockedRule', { fieldId, value: display(incoming), detail: resolved.locked.reason })\n }\n if (!outcome.changed) continue\n if (target.kind === 'update') {\n if (outcome.rule === 'cleared') warn('clearValue', { fieldId, value: display(current) })\n else if (!isBlankTransferValue(current) && outcome.rule !== 'appended') {\n warn('overwriteNonBlank', { fieldId, value: display(current), detail: `→ ${display(outcome.after)}` })\n }\n }\n diff.push({\n fieldId,\n before: target.kind === 'update' ? (current ?? null) : null,\n after: outcome.after,\n mode: target.kind === 'create' ? 'overwrite' : resolved.mode,\n source: resolved.source,\n rule: outcome.rule,\n })\n }\n\n if (target.kind === 'create') {\n const missing = input.fields\n .filter((field) => field.required && isBlankTransferValue(diff.find((change) => change.fieldId === field.id)?.after))\n .map((field) => field.id)\n if (missing.length) return finish('fail', null, { reason: 'missingRequired', missing, heldBack })\n if ((limits.maxCreates !== undefined && creates >= limits.maxCreates) || (limits.maxWrites !== undefined && writes >= limits.maxWrites)) {\n warn('planLimit', { detail: 'Past what the plan allows' })\n return finish('fail', null, { reason: 'planLimit', heldBack })\n }\n creates += 1\n writes += 1\n return finish('create', null, { diff, heldBack })\n }\n if (!diff.length) return finish('unchanged', target.recordId, { heldBack })\n if (limits.maxWrites !== undefined && writes >= limits.maxWrites) {\n warn('planLimit', { detail: 'Past what the plan allows' })\n return finish('fail', target.recordId, { reason: 'planLimit', heldBack })\n }\n writes += 1\n return finish('update', target.recordId, { diff, heldBack })\n })\n\n const summary: TransferPlanSummary = { create: 0, update: 0, unchanged: 0, skip: 0, fail: 0, total: rows.length }\n for (const row of rows) summary[row.verdict] += 1\n const warnings = tally.list()\n return {\n rows,\n summary,\n warnings,\n acknowledgementsRequired: warnings.filter((entry) => entry.requiresAcknowledgement).map((entry) => entry.class),\n }\n}\n\n/** The classes still to acknowledge before the plan may be applied. */\nexport function missingAcknowledgements(\n plan: Pick<TransferPlan, 'acknowledgementsRequired'>,\n acknowledged: Iterable<TransferWarningClass>,\n): TransferWarningClass[] {\n const seen = new Set(acknowledged)\n return plan.acknowledgementsRequired.filter((entry) => !seen.has(entry))\n}\n\n/** Whether the plan may be applied: something to write and every required acknowledgement given. */\nexport function canApplyTransferPlan(\n plan: Pick<TransferPlan, 'acknowledgementsRequired' | 'summary'>,\n acknowledged: Iterable<TransferWarningClass>,\n): boolean {\n return plan.summary.create + plan.summary.update > 0 && missingAcknowledgements(plan, acknowledged).length === 0\n}\n\n/** The rows that will write, in file order — what the job engine applies. */\nexport function plannedWrites(plan: Pick<TransferPlan, 'rows'>): PlannedTransferRow[] {\n return plan.rows.filter((row) => row.verdict === 'create' || row.verdict === 'update')\n}\n\n/**\n * One thing the owning plugin found about a planned row that no field policy\n * can say — a redirect that loops, an off-site destination, a rule its own\n * write path refuses — raised from the resource's `plan` hook.\n */\nexport interface TransferResourceFinding {\n row: number\n /** What the person should know, in a sentence. */\n detail: string\n fieldId?: string\n value?: string\n /** Refuse the row (it fails as `resourceRule`) rather than only warn about it. */\n refuse?: boolean\n}\n\n/**\n * The plan with the plugin's findings folded in: each finding is a\n * `resourceRule` warning on its row (acknowledged before Apply, like every\n * class but a plain derivation), and a `refuse` finding fails a row that\n * would have written. The summary and the acknowledgements follow.\n */\nexport function withTransferResourceFindings(\n plan: TransferPlan,\n findings: readonly TransferResourceFinding[],\n sampleSize = 5,\n): TransferPlan {\n if (!findings.length) return plan\n const byIndex = new Map(plan.rows.map((row) => [row.index, row]))\n const touched = new Map<number, PlannedTransferRow>()\n const rowsRaised = new Set<number>()\n const fieldIds = new Set<string>()\n const samples: TransferWarningSample[] = []\n let count = 0\n for (const finding of findings) {\n const original = byIndex.get(finding.row)\n if (!original) continue\n const row = touched.get(finding.row) ?? { ...original, warnings: [...original.warnings] }\n if (!row.warnings.includes('resourceRule')) row.warnings.push('resourceRule')\n if (finding.refuse && row.verdict !== 'skip' && row.verdict !== 'fail') {\n row.verdict = 'fail'\n row.reason = 'resourceRule'\n row.diff = []\n }\n touched.set(finding.row, row)\n count += 1\n rowsRaised.add(finding.row)\n if (finding.fieldId) fieldIds.add(finding.fieldId)\n if (samples.length < sampleSize) {\n samples.push({\n row: finding.row,\n ...(finding.fieldId ? { fieldId: finding.fieldId } : {}),\n ...(finding.value !== undefined ? { value: finding.value } : {}),\n detail: finding.detail,\n })\n }\n }\n if (!count) return plan\n const rows = plan.rows.map((row) => touched.get(row.index) ?? row)\n const summary: TransferPlanSummary = { create: 0, update: 0, unchanged: 0, skip: 0, fail: 0, total: rows.length }\n for (const row of rows) summary[row.verdict] += 1\n const prior = plan.warnings.find((entry) => entry.class === 'resourceRule')\n const raised: TransferWarning = {\n class: 'resourceRule',\n count: (prior?.count ?? 0) + count,\n rows: (prior?.rows ?? 0) + rowsRaised.size,\n fieldIds: [...new Set([...(prior?.fieldIds ?? []), ...fieldIds])],\n samples: [...(prior?.samples ?? []), ...samples].slice(0, sampleSize),\n requiresAcknowledgement: true,\n }\n const warnings = TRANSFER_WARNING_CLASSES.flatMap((entry) =>\n entry === 'resourceRule' ? [raised] : plan.warnings.filter((warning) => warning.class === entry),\n )\n return {\n rows,\n summary,\n warnings,\n acknowledgementsRequired: warnings.filter((entry) => entry.requiresAcknowledgement).map((entry) => entry.class),\n }\n}\n"],"names":["appendTransferList","applyFieldPolicy","compareTransferValues","isBlankTransferValue","resolveFieldPolicy","resolveRecordPolicy","transferValuesEqual","isTransferFieldWritable","TRANSFER_ROW_VERDICTS","TRANSFER_WARNING_CLASSES","ACKNOWLEDGED_WARNING_CLASSES","filter","entry","TRANSFER_FILE_SAMPLE_ROW","WarningTally","add","sample","flagged","tally","byClass","get","count","rows","Set","fields","samples","row","fieldId","length","sampleSize","push","set","list","has","map","class","size","fieldIds","requiresAcknowledgement","includes","Map","reflects","after","incoming","Array","isArray","display","value","undefined","JSON","stringify","buildTransferPlan","input","byId","field","id","limits","creates","writes","position","match","matches","kind","warnings","warn","index","finish","verdict","recordId","extra","diff","heldBack","derivations","from","detail","note","to","problem","problems","raw","message","refused","notes","refuse","reason","record","policy","target","action","via","firstRow","recordIds","onAmbiguous","alsoMatched","onMatch","onNew","before","existing","Object","entries","values","resolved","current","equal","a","b","valuesEqual","outcome","mode","blank","refuseValues","locked","source","changed","rule","missing","required","find","change","maxCreates","maxWrites","summary","create","update","unchanged","skip","fail","total","acknowledgementsRequired","missingAcknowledgements","plan","acknowledged","seen","canApplyTransferPlan","plannedWrites","withTransferResourceFindings","findings","byIndex","touched","rowsRaised","finding","original","prior","raised","slice","flatMap","warning"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;2CAmB2C;AAI3C,SACEA,kBAAkB,EAClBC,gBAAgB,EAChBC,qBAAqB,EACrBC,oBAAoB,EACpBC,kBAAkB,EAClBC,mBAAmB,EACnBC,mBAAmB,QACd,cAAU;AAQjB,SAASC,uBAAuB,QAAQ,gBAAY;AAMpD,OAAO,MAAMC,wBAAuD;IAAC;IAAU;IAAU;IAAa;IAAQ;CAAO,CAAA;AA0CrH,OAAO,MAAMC,2BAA4D;IACvE;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAED;;;;CAIC,GACD,OAAO,MAAMC,+BAAgED,yBAAyBE,MAAM,CAC1G,CAACC,QAAUA,UAAU,cACtB;AA8DD,8FAA8F,GAC9F,OAAO,MAAMC,2BAA2B,CAAC,EAAC;AA0D1C,IAAA,AAAMC,eAAN,MAAMA;I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,MAAOxH,IAAI,oBAAI,KAAKqH,WAAWvG,IAAI;QAC1CC,UAAU;eAAI,IAAId,IAAI;4BAAKuH,yBAAAA,MAAOzG,QAAQ,oBAAI,EAAE;mBAAMA;aAAS;SAAE;QACjEZ,SAAS;wBAAKqH,yBAAAA,MAAOrH,OAAO,oBAAI,EAAE;eAAMA;SAAQ,CAACuH,KAAK,CAAC,GAAGnH;QAC1DS,yBAAyB;IAC3B;IACA,MAAMyB,WAAWtD,yBAAyBwI,OAAO,CAAC,CAACrI,QACjDA,UAAU,iBAAiB;YAACmI;SAAO,GAAGb,KAAKnE,QAAQ,CAACpD,MAAM,CAAC,CAACuI,UAAYA,QAAQ/G,KAAK,KAAKvB;IAE5F,OAAO;QACLU;QACAmG;QACA1D;QACAiE,0BAA0BjE,SAASpD,MAAM,CAAC,CAACC,QAAUA,MAAM0B,uBAAuB,EAAEJ,GAAG,CAAC,CAACtB,QAAUA,MAAMuB,KAAK;IAChH;AACF"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import type { TransferField } from './resource';
|
|
18
|
+
/** What happens to a row that matched an existing record. */
|
|
19
|
+
export type TransferOnMatch = 'update' | 'skip' | 'duplicate';
|
|
20
|
+
/** What happens to a row that matched nothing. */
|
|
21
|
+
export type TransferOnNew = 'create' | 'skip';
|
|
22
|
+
/** What happens to a row that matched several records. */
|
|
23
|
+
export type TransferOnAmbiguous = 'skip' | 'ask';
|
|
24
|
+
export interface TransferRecordPolicy {
|
|
25
|
+
onMatch: TransferOnMatch;
|
|
26
|
+
onNew: TransferOnNew;
|
|
27
|
+
onAmbiguous: TransferOnAmbiguous;
|
|
28
|
+
}
|
|
29
|
+
/** How an incoming value meets the existing one. */
|
|
30
|
+
export type TransferFieldMode = 'overwrite' | 'fillBlanks' | 'keepExisting' | 'append';
|
|
31
|
+
/** What a blank cell means for a field. */
|
|
32
|
+
export type TransferBlankMeans = 'leave' | 'clear';
|
|
33
|
+
export interface TransferFieldPolicy {
|
|
34
|
+
mode: TransferFieldMode;
|
|
35
|
+
blank: TransferBlankMeans;
|
|
36
|
+
}
|
|
37
|
+
/** A rule the owning plugin imposes on a field; shown locked, with its reason. */
|
|
38
|
+
export interface TransferLockedRule {
|
|
39
|
+
fieldId: string;
|
|
40
|
+
/** Why, in a sentence the person reads ("A stage never moves backward"). */
|
|
41
|
+
reason: string;
|
|
42
|
+
/** The policy forced on the field; parts left out stay the person's choice. */
|
|
43
|
+
forced?: Partial<TransferFieldPolicy>;
|
|
44
|
+
/** The file's values are never written to this field at all. */
|
|
45
|
+
refuseValues?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/** A person's choice for one row. */
|
|
48
|
+
export interface TransferRowOverride {
|
|
49
|
+
/** What to do with the row, whatever its match said. */
|
|
50
|
+
action?: 'create' | 'update' | 'skip';
|
|
51
|
+
/** The record to update — how an ambiguous row is resolved. */
|
|
52
|
+
recordId?: string;
|
|
53
|
+
/** Per-field choices for this row. */
|
|
54
|
+
fields?: Readonly<Record<string, Partial<TransferFieldPolicy>>>;
|
|
55
|
+
}
|
|
56
|
+
export interface TransferPolicy {
|
|
57
|
+
record: TransferRecordPolicy;
|
|
58
|
+
/** The default for every field. */
|
|
59
|
+
fieldDefault: TransferFieldPolicy;
|
|
60
|
+
/** Per-field choices. */
|
|
61
|
+
fields: Readonly<Record<string, Partial<TransferFieldPolicy>>>;
|
|
62
|
+
/** The owning plugin's locked rules. */
|
|
63
|
+
locked: readonly TransferLockedRule[];
|
|
64
|
+
/** Per-row choices, by row index. */
|
|
65
|
+
rows: Readonly<Record<number, TransferRowOverride>>;
|
|
66
|
+
}
|
|
67
|
+
/** Update what matches, create what does not, and ask about the rest. */
|
|
68
|
+
export declare const DEFAULT_TRANSFER_RECORD_POLICY: TransferRecordPolicy;
|
|
69
|
+
/**
|
|
70
|
+
* Fill blanks and leave on blank: the default never replaces or clears a
|
|
71
|
+
* value somebody already has. Anything stronger is a choice the person makes.
|
|
72
|
+
*/
|
|
73
|
+
export declare const DEFAULT_TRANSFER_FIELD_POLICY: TransferFieldPolicy;
|
|
74
|
+
/**
|
|
75
|
+
* Where a resource starts the person (see the block header): its record
|
|
76
|
+
* policy, its default for every field and its choices for single fields,
|
|
77
|
+
* each part optional. The person's choices are made on top of it.
|
|
78
|
+
*/
|
|
79
|
+
export interface TransferPolicyDefaults {
|
|
80
|
+
record?: Partial<TransferRecordPolicy>;
|
|
81
|
+
fieldDefault?: Partial<TransferFieldPolicy>;
|
|
82
|
+
fields?: Readonly<Record<string, Partial<TransferFieldPolicy>>>;
|
|
83
|
+
/** Why the resource starts here, in a sentence the Conflicts step shows. */
|
|
84
|
+
note?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* A resource's defaults as far as they hold for these fields: a choice for a
|
|
88
|
+
* field the catalog lacks, or one that can never be written, is dropped, as
|
|
89
|
+
* is `append` on a field that is not a list and any value that is not a
|
|
90
|
+
* choice — so a context whose catalog differs (one dataset's fields) never
|
|
91
|
+
* makes a dry run refuse the resource's own defaults.
|
|
92
|
+
*/
|
|
93
|
+
export declare function transferPolicyDefaultsFor(defaults: TransferPolicyDefaults | null | undefined, fields: readonly TransferField[]): TransferPolicyDefaults;
|
|
94
|
+
/**
|
|
95
|
+
* The person's choices on top of a resource's defaults: each part of the
|
|
96
|
+
* record policy and of the field default is the person's where they said
|
|
97
|
+
* one and the resource's where they did not. Field choices sent at all are
|
|
98
|
+
* the person's whole set — the wizard starts them from the resource's, so a
|
|
99
|
+
* choice the person took back stays taken back — and the resource's when
|
|
100
|
+
* none are sent. What neither says, {@link createTransferPolicy} fills from
|
|
101
|
+
* the core's defaults.
|
|
102
|
+
*/
|
|
103
|
+
export declare function withTransferPolicyDefaults(defaults: TransferPolicyDefaults | null | undefined, chosen?: Partial<TransferPolicy>): Partial<TransferPolicy>;
|
|
104
|
+
/**
|
|
105
|
+
* The policy a person starts from: the core's defaults with the resource's
|
|
106
|
+
* on top, and no row or field choice beyond the resource's own. The wizard
|
|
107
|
+
* opens on this.
|
|
108
|
+
*/
|
|
109
|
+
export declare function startingTransferPolicy(defaults: TransferPolicyDefaults | null | undefined): Pick<TransferPolicy, 'record' | 'fieldDefault' | 'fields' | 'rows'>;
|
|
110
|
+
/** A policy with every part present, defaults filling what `partial` leaves out. */
|
|
111
|
+
export declare function createTransferPolicy(partial?: Partial<TransferPolicy>): TransferPolicy;
|
|
112
|
+
/** Where a resolved field policy came from. */
|
|
113
|
+
export type TransferPolicySource = 'locked' | 'row' | 'field' | 'type' | 'default';
|
|
114
|
+
/** The policy that applies to one row's field, and why. */
|
|
115
|
+
export interface ResolvedFieldPolicy extends TransferFieldPolicy {
|
|
116
|
+
/** Where the MODE came from. */
|
|
117
|
+
source: TransferPolicySource;
|
|
118
|
+
/** The locked rule, when one applies to the field. */
|
|
119
|
+
locked?: TransferLockedRule;
|
|
120
|
+
/** The file's value is never written. */
|
|
121
|
+
refuseValues: boolean;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The policy for row `rowIndex`, field `field` (see the precedence in the
|
|
125
|
+
* block header). `append` on a field that is not a list is read as
|
|
126
|
+
* `overwrite` — appending to a single value is replacing it.
|
|
127
|
+
*/
|
|
128
|
+
export declare function resolveFieldPolicy(policy: TransferPolicy, rowIndex: number, field: TransferField): ResolvedFieldPolicy;
|
|
129
|
+
/** The record-level policy for one row, with the person's row choice folded in. */
|
|
130
|
+
export declare function resolveRecordPolicy(policy: TransferPolicy, rowIndex: number): TransferRecordPolicy & {
|
|
131
|
+
action?: TransferRowOverride['action'];
|
|
132
|
+
recordId?: string;
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* What is wrong with a policy against a field list, as sentences: a choice
|
|
136
|
+
* or rule for a field that does not exist, an append on a field that is not
|
|
137
|
+
* a list, and a person's choice that a locked rule overrides.
|
|
138
|
+
*/
|
|
139
|
+
export declare function transferPolicyProblems(policy: TransferPolicy, fields: readonly TransferField[]): string[];
|
|
140
|
+
/** Whether a value is blank: absent, empty text, an empty list or an empty object. */
|
|
141
|
+
export declare function isBlankTransferValue(value: unknown): boolean;
|
|
142
|
+
/** Two lists as one: the existing items, then the incoming ones it lacks (in any case). */
|
|
143
|
+
export declare function appendTransferList(existing: unknown, incoming: unknown): unknown[];
|
|
144
|
+
/** What a policy makes of one field. */
|
|
145
|
+
export interface FieldPolicyOutcome {
|
|
146
|
+
/** The value the record will hold. */
|
|
147
|
+
after: unknown;
|
|
148
|
+
/** Whether that differs from what it holds. */
|
|
149
|
+
changed: boolean;
|
|
150
|
+
/** Why it is what it is, for the diff table. */
|
|
151
|
+
rule: 'written' | 'filled' | 'kept' | 'appended' | 'cleared' | 'leftBlank' | 'refused';
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* A resource's answer to "are these the same value" for one field (see the
|
|
155
|
+
* block header) — `true` or `false`, or `undefined` to leave it to
|
|
156
|
+
* {@link transferValuesEqual}.
|
|
157
|
+
*/
|
|
158
|
+
export type TransferValuesComparator = (field: TransferField, a: unknown, b: unknown) => boolean | undefined;
|
|
159
|
+
/** Two values of `field` compared by the resource's comparator, then the core's. */
|
|
160
|
+
export declare function compareTransferValues(field: TransferField, a: unknown, b: unknown, comparator?: TransferValuesComparator): boolean;
|
|
161
|
+
/** Whether two field values are the same value; lists compare as sets, caseless. */
|
|
162
|
+
export declare function transferValuesEqual(a: unknown, b: unknown): boolean;
|
|
163
|
+
/**
|
|
164
|
+
* One incoming value against the record's value under a resolved policy.
|
|
165
|
+
* `incoming` absent means the column was not mapped: the field is not
|
|
166
|
+
* touched. Blank means the cell was mapped and empty. `equal` decides
|
|
167
|
+
* whether the value the record ends with differs from the one it holds —
|
|
168
|
+
* the resource's comparator, when it has one.
|
|
169
|
+
*/
|
|
170
|
+
export declare function applyFieldPolicy(resolved: Pick<ResolvedFieldPolicy, 'mode' | 'blank' | 'refuseValues'>, before: unknown, incoming: unknown, equal?: (a: unknown, b: unknown) => boolean): FieldPolicyOutcome;
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2026 Aglyn LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/ /*==========================================
|
|
18
|
+
* CONFLICT POLICY — what a row does to the record it matched, field by field.
|
|
19
|
+
*
|
|
20
|
+
* Record level, the person chooses what happens on a match (update it,
|
|
21
|
+
* skip the row, or create a duplicate anyway), on no match (create or
|
|
22
|
+
* skip) and on an ambiguous match (skip, or choose per row).
|
|
23
|
+
*
|
|
24
|
+
* Field level, the person chooses how an incoming value meets the one the
|
|
25
|
+
* record holds:
|
|
26
|
+
*
|
|
27
|
+
* - `overwrite` — the file's value replaces it;
|
|
28
|
+
* - `fillBlanks` — the file's value is written only where the record has none;
|
|
29
|
+
* - `keepExisting` — the field is never changed on an existing record;
|
|
30
|
+
* - `append` — list fields (tags, multi-select) gain the file's items;
|
|
31
|
+
*
|
|
32
|
+
* and, separately, what a BLANK cell means: `leave` the value alone, or
|
|
33
|
+
* `clear` it.
|
|
34
|
+
*
|
|
35
|
+
* ## Precedence
|
|
36
|
+
*
|
|
37
|
+
* For row R and field F, the first of these that speaks decides:
|
|
38
|
+
*
|
|
39
|
+
* 1. a locked rule the owning plugin declared for F (stage never moves
|
|
40
|
+
* backward, consent is never asserted from a file) — the person sees it,
|
|
41
|
+
* with its reason, and cannot change it;
|
|
42
|
+
* 2. the person's override for row R, field F;
|
|
43
|
+
* 3. the person's choice for field F;
|
|
44
|
+
* 4. the type default (lists append);
|
|
45
|
+
* 5. the person's default for every field.
|
|
46
|
+
*
|
|
47
|
+
* ## The resource sets where the person starts (AGL-3548)
|
|
48
|
+
*
|
|
49
|
+
* The core's starting point — fill blanks, leave on blank — never replaces
|
|
50
|
+
* a value somebody already has, which is right for a person's record and
|
|
51
|
+
* wrong for a record the file is the definition of: a redirect re-imported
|
|
52
|
+
* with a new destination is meant to point there. A resource declares its
|
|
53
|
+
* own starting point ({@link TransferPolicyDefaults}); the wizard opens the
|
|
54
|
+
* Conflicts step on it and the person may still change every part, and the
|
|
55
|
+
* dry run fills whatever a request leaves out from it
|
|
56
|
+
* ({@link withTransferPolicyDefaults}).
|
|
57
|
+
*
|
|
58
|
+
* ## The resource may say when two values are the same
|
|
59
|
+
*
|
|
60
|
+
* The core compares values as stored (lists as sets, caseless). A resource
|
|
61
|
+
* whose write folds a value — a status kept in lower case, a path kept
|
|
62
|
+
* without its trailing slash — passes a {@link TransferValuesComparator}, so
|
|
63
|
+
* `Published` against `published` is no conflict and no change, in the
|
|
64
|
+
* review and the dry run alike.
|
|
65
|
+
*=========================================*/ import { isTransferListType } from "./resource.js";
|
|
66
|
+
/** Update what matches, create what does not, and ask about the rest. */ export const DEFAULT_TRANSFER_RECORD_POLICY = {
|
|
67
|
+
onMatch: 'update',
|
|
68
|
+
onNew: 'create',
|
|
69
|
+
onAmbiguous: 'ask'
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Fill blanks and leave on blank: the default never replaces or clears a
|
|
73
|
+
* value somebody already has. Anything stronger is a choice the person makes.
|
|
74
|
+
*/ export const DEFAULT_TRANSFER_FIELD_POLICY = {
|
|
75
|
+
mode: 'fillBlanks',
|
|
76
|
+
blank: 'leave'
|
|
77
|
+
};
|
|
78
|
+
const RECORD_CHOICES = {
|
|
79
|
+
onMatch: [
|
|
80
|
+
'update',
|
|
81
|
+
'skip',
|
|
82
|
+
'duplicate'
|
|
83
|
+
],
|
|
84
|
+
onNew: [
|
|
85
|
+
'create',
|
|
86
|
+
'skip'
|
|
87
|
+
],
|
|
88
|
+
onAmbiguous: [
|
|
89
|
+
'skip',
|
|
90
|
+
'ask'
|
|
91
|
+
]
|
|
92
|
+
};
|
|
93
|
+
const FIELD_MODES = [
|
|
94
|
+
'overwrite',
|
|
95
|
+
'fillBlanks',
|
|
96
|
+
'keepExisting',
|
|
97
|
+
'append'
|
|
98
|
+
];
|
|
99
|
+
const BLANK_MEANS = [
|
|
100
|
+
'leave',
|
|
101
|
+
'clear'
|
|
102
|
+
];
|
|
103
|
+
function fieldChoice(raw, list) {
|
|
104
|
+
const choice = raw && typeof raw === 'object' ? raw : {};
|
|
105
|
+
const out = {};
|
|
106
|
+
const mode = choice['mode'];
|
|
107
|
+
if (FIELD_MODES.includes(mode) && (mode !== 'append' || list)) out.mode = mode;
|
|
108
|
+
const blank = choice['blank'];
|
|
109
|
+
if (BLANK_MEANS.includes(blank)) out.blank = blank;
|
|
110
|
+
return out;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* A resource's defaults as far as they hold for these fields: a choice for a
|
|
114
|
+
* field the catalog lacks, or one that can never be written, is dropped, as
|
|
115
|
+
* is `append` on a field that is not a list and any value that is not a
|
|
116
|
+
* choice — so a context whose catalog differs (one dataset's fields) never
|
|
117
|
+
* makes a dry run refuse the resource's own defaults.
|
|
118
|
+
*/ export function transferPolicyDefaultsFor(defaults, fields) {
|
|
119
|
+
var _defaults_fields;
|
|
120
|
+
if (!defaults) return {};
|
|
121
|
+
const out = {};
|
|
122
|
+
const record = {};
|
|
123
|
+
for (const [part, allowed] of Object.entries(RECORD_CHOICES)){
|
|
124
|
+
var _defaults_record;
|
|
125
|
+
const value = (_defaults_record = defaults.record) == null ? void 0 : _defaults_record[part];
|
|
126
|
+
if (typeof value === 'string' && allowed.includes(value)) record[part] = value;
|
|
127
|
+
}
|
|
128
|
+
if (Object.keys(record).length) out.record = record;
|
|
129
|
+
const fieldDefault = fieldChoice(defaults.fieldDefault, false);
|
|
130
|
+
if (Object.keys(fieldDefault).length) out.fieldDefault = fieldDefault;
|
|
131
|
+
const byId = new Map(fields.map((field)=>[
|
|
132
|
+
field.id,
|
|
133
|
+
field
|
|
134
|
+
]));
|
|
135
|
+
const chosen = {};
|
|
136
|
+
for (const [fieldId, raw] of Object.entries((_defaults_fields = defaults.fields) != null ? _defaults_fields : {})){
|
|
137
|
+
const field = byId.get(fieldId);
|
|
138
|
+
if (!field || field.readOnly || field.derived || field.system) continue;
|
|
139
|
+
const choice = fieldChoice(raw, isTransferListType(field.type));
|
|
140
|
+
if (Object.keys(choice).length) chosen[fieldId] = choice;
|
|
141
|
+
}
|
|
142
|
+
if (Object.keys(chosen).length) out.fields = chosen;
|
|
143
|
+
if (typeof defaults.note === 'string' && defaults.note.trim()) out.note = defaults.note.trim();
|
|
144
|
+
return out;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* The person's choices on top of a resource's defaults: each part of the
|
|
148
|
+
* record policy and of the field default is the person's where they said
|
|
149
|
+
* one and the resource's where they did not. Field choices sent at all are
|
|
150
|
+
* the person's whole set — the wizard starts them from the resource's, so a
|
|
151
|
+
* choice the person took back stays taken back — and the resource's when
|
|
152
|
+
* none are sent. What neither says, {@link createTransferPolicy} fills from
|
|
153
|
+
* the core's defaults.
|
|
154
|
+
*/ export function withTransferPolicyDefaults(defaults, chosen = {}) {
|
|
155
|
+
var _chosen_fields, _defaults_fields;
|
|
156
|
+
if (!defaults) return chosen;
|
|
157
|
+
return _extends({}, chosen, {
|
|
158
|
+
record: _extends({}, DEFAULT_TRANSFER_RECORD_POLICY, defaults.record, chosen.record),
|
|
159
|
+
fieldDefault: _extends({}, DEFAULT_TRANSFER_FIELD_POLICY, defaults.fieldDefault, chosen.fieldDefault),
|
|
160
|
+
fields: (_chosen_fields = chosen.fields) != null ? _chosen_fields : _extends({}, (_defaults_fields = defaults.fields) != null ? _defaults_fields : {})
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The policy a person starts from: the core's defaults with the resource's
|
|
165
|
+
* on top, and no row or field choice beyond the resource's own. The wizard
|
|
166
|
+
* opens on this.
|
|
167
|
+
*/ export function startingTransferPolicy(defaults) {
|
|
168
|
+
var _ref;
|
|
169
|
+
return {
|
|
170
|
+
record: _extends({}, DEFAULT_TRANSFER_RECORD_POLICY, defaults == null ? void 0 : defaults.record),
|
|
171
|
+
fieldDefault: _extends({}, DEFAULT_TRANSFER_FIELD_POLICY, defaults == null ? void 0 : defaults.fieldDefault),
|
|
172
|
+
fields: _extends({}, (_ref = defaults == null ? void 0 : defaults.fields) != null ? _ref : {}),
|
|
173
|
+
rows: {}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/** A policy with every part present, defaults filling what `partial` leaves out. */ export function createTransferPolicy(partial = {}) {
|
|
177
|
+
var _partial_fields, _partial_locked, _partial_rows;
|
|
178
|
+
return {
|
|
179
|
+
record: _extends({}, DEFAULT_TRANSFER_RECORD_POLICY, partial.record),
|
|
180
|
+
fieldDefault: _extends({}, DEFAULT_TRANSFER_FIELD_POLICY, partial.fieldDefault),
|
|
181
|
+
fields: (_partial_fields = partial.fields) != null ? _partial_fields : {},
|
|
182
|
+
locked: (_partial_locked = partial.locked) != null ? _partial_locked : [],
|
|
183
|
+
rows: (_partial_rows = partial.rows) != null ? _partial_rows : {}
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The policy for row `rowIndex`, field `field` (see the precedence in the
|
|
188
|
+
* block header). `append` on a field that is not a list is read as
|
|
189
|
+
* `overwrite` — appending to a single value is replacing it.
|
|
190
|
+
*/ export function resolveFieldPolicy(policy, rowIndex, field) {
|
|
191
|
+
var _ref, _ref1, _ref2;
|
|
192
|
+
var _policy_rows_rowIndex_fields, _policy_rows_rowIndex, _locked_forced, _locked_forced1;
|
|
193
|
+
const locked = policy.locked.find((rule)=>rule.fieldId === field.id);
|
|
194
|
+
const row = (_policy_rows_rowIndex = policy.rows[rowIndex]) == null ? void 0 : (_policy_rows_rowIndex_fields = _policy_rows_rowIndex.fields) == null ? void 0 : _policy_rows_rowIndex_fields[field.id];
|
|
195
|
+
const chosen = policy.fields[field.id];
|
|
196
|
+
const list = isTransferListType(field.type);
|
|
197
|
+
let mode;
|
|
198
|
+
let source;
|
|
199
|
+
if (locked == null ? void 0 : (_locked_forced = locked.forced) == null ? void 0 : _locked_forced.mode) {
|
|
200
|
+
mode = locked.forced.mode;
|
|
201
|
+
source = 'locked';
|
|
202
|
+
} else if (row == null ? void 0 : row.mode) {
|
|
203
|
+
mode = row.mode;
|
|
204
|
+
source = 'row';
|
|
205
|
+
} else if (chosen == null ? void 0 : chosen.mode) {
|
|
206
|
+
mode = chosen.mode;
|
|
207
|
+
source = 'field';
|
|
208
|
+
} else if (list) {
|
|
209
|
+
mode = 'append';
|
|
210
|
+
source = 'type';
|
|
211
|
+
} else {
|
|
212
|
+
mode = policy.fieldDefault.mode;
|
|
213
|
+
source = 'default';
|
|
214
|
+
}
|
|
215
|
+
if (mode === 'append' && !list) mode = 'overwrite';
|
|
216
|
+
const blank = (_ref = (_ref1 = (_ref2 = locked == null ? void 0 : (_locked_forced1 = locked.forced) == null ? void 0 : _locked_forced1.blank) != null ? _ref2 : row == null ? void 0 : row.blank) != null ? _ref1 : chosen == null ? void 0 : chosen.blank) != null ? _ref : policy.fieldDefault.blank;
|
|
217
|
+
return _extends({
|
|
218
|
+
mode,
|
|
219
|
+
blank,
|
|
220
|
+
source,
|
|
221
|
+
refuseValues: Boolean(locked == null ? void 0 : locked.refuseValues)
|
|
222
|
+
}, locked ? {
|
|
223
|
+
locked
|
|
224
|
+
} : {});
|
|
225
|
+
}
|
|
226
|
+
/** The record-level policy for one row, with the person's row choice folded in. */ export function resolveRecordPolicy(policy, rowIndex) {
|
|
227
|
+
const row = policy.rows[rowIndex];
|
|
228
|
+
return _extends({}, policy.record, (row == null ? void 0 : row.action) ? {
|
|
229
|
+
action: row.action
|
|
230
|
+
} : {}, (row == null ? void 0 : row.recordId) ? {
|
|
231
|
+
recordId: row.recordId
|
|
232
|
+
} : {});
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* What is wrong with a policy against a field list, as sentences: a choice
|
|
236
|
+
* or rule for a field that does not exist, an append on a field that is not
|
|
237
|
+
* a list, and a person's choice that a locked rule overrides.
|
|
238
|
+
*/ export function transferPolicyProblems(policy, fields) {
|
|
239
|
+
const byId = new Map(fields.map((field)=>[
|
|
240
|
+
field.id,
|
|
241
|
+
field
|
|
242
|
+
]));
|
|
243
|
+
const problems = [];
|
|
244
|
+
const check = (fieldId, setting, where)=>{
|
|
245
|
+
var _locked_forced;
|
|
246
|
+
const field = byId.get(fieldId);
|
|
247
|
+
if (!field) {
|
|
248
|
+
problems.push(`${where} names "${fieldId}", which is not a field.`);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
if (setting.mode === 'append' && !isTransferListType(field.type)) {
|
|
252
|
+
problems.push(`${where}: "${field.label}" is not a list, so it cannot be appended to.`);
|
|
253
|
+
}
|
|
254
|
+
const locked = policy.locked.find((rule)=>rule.fieldId === fieldId);
|
|
255
|
+
if ((locked == null ? void 0 : (_locked_forced = locked.forced) == null ? void 0 : _locked_forced.mode) && setting.mode && setting.mode !== locked.forced.mode) {
|
|
256
|
+
problems.push(`${where}: "${field.label}" is locked — ${locked.reason}`);
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
for (const [fieldId, setting] of Object.entries(policy.fields))check(fieldId, setting, 'A field choice');
|
|
260
|
+
for (const [row, override] of Object.entries(policy.rows)){
|
|
261
|
+
var _override_fields;
|
|
262
|
+
for (const [fieldId, setting] of Object.entries((_override_fields = override.fields) != null ? _override_fields : {})){
|
|
263
|
+
check(fieldId, setting, `Row ${Number(row) + 1}`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
for (const rule of policy.locked){
|
|
267
|
+
if (!byId.has(rule.fieldId)) problems.push(`A locked rule names "${rule.fieldId}", which is not a field.`);
|
|
268
|
+
}
|
|
269
|
+
return problems;
|
|
270
|
+
}
|
|
271
|
+
/** Whether a value is blank: absent, empty text, an empty list or an empty object. */ export function isBlankTransferValue(value) {
|
|
272
|
+
if (value === null || value === undefined) return true;
|
|
273
|
+
if (typeof value === 'string') return !value.trim();
|
|
274
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
275
|
+
if (typeof value === 'object' && !(value instanceof Date)) {
|
|
276
|
+
return Object.values(value).every(isBlankTransferValue);
|
|
277
|
+
}
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
function listKey(item) {
|
|
281
|
+
return typeof item === 'string' ? item.trim().toLowerCase() : JSON.stringify(item);
|
|
282
|
+
}
|
|
283
|
+
/** Two lists as one: the existing items, then the incoming ones it lacks (in any case). */ export function appendTransferList(existing, incoming) {
|
|
284
|
+
const before = Array.isArray(existing) ? existing : isBlankTransferValue(existing) ? [] : [
|
|
285
|
+
existing
|
|
286
|
+
];
|
|
287
|
+
const after = Array.isArray(incoming) ? incoming : isBlankTransferValue(incoming) ? [] : [
|
|
288
|
+
incoming
|
|
289
|
+
];
|
|
290
|
+
const seen = new Set(before.map(listKey));
|
|
291
|
+
const merged = [
|
|
292
|
+
...before
|
|
293
|
+
];
|
|
294
|
+
for (const item of after){
|
|
295
|
+
const key = listKey(item);
|
|
296
|
+
if (seen.has(key)) continue;
|
|
297
|
+
seen.add(key);
|
|
298
|
+
merged.push(item);
|
|
299
|
+
}
|
|
300
|
+
return merged;
|
|
301
|
+
}
|
|
302
|
+
/** Two values of `field` compared by the resource's comparator, then the core's. */ export function compareTransferValues(field, a, b, comparator) {
|
|
303
|
+
if (comparator) {
|
|
304
|
+
const said = comparator(field, a, b);
|
|
305
|
+
if (typeof said === 'boolean') return said;
|
|
306
|
+
}
|
|
307
|
+
return transferValuesEqual(a, b);
|
|
308
|
+
}
|
|
309
|
+
/** Whether two field values are the same value; lists compare as sets, caseless. */ export function transferValuesEqual(a, b) {
|
|
310
|
+
if (isBlankTransferValue(a) && isBlankTransferValue(b)) return true;
|
|
311
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
312
|
+
if (a.length !== b.length) return false;
|
|
313
|
+
const keys = new Set(a.map(listKey));
|
|
314
|
+
return b.every((item)=>keys.has(listKey(item)));
|
|
315
|
+
}
|
|
316
|
+
if (a instanceof Date || b instanceof Date) {
|
|
317
|
+
return new Date(a).getTime() === new Date(b).getTime();
|
|
318
|
+
}
|
|
319
|
+
if (a && b && typeof a === 'object' && typeof b === 'object') {
|
|
320
|
+
const left = a;
|
|
321
|
+
const right = b;
|
|
322
|
+
const keys = new Set([
|
|
323
|
+
...Object.keys(left),
|
|
324
|
+
...Object.keys(right)
|
|
325
|
+
]);
|
|
326
|
+
return [
|
|
327
|
+
...keys
|
|
328
|
+
].every((key)=>transferValuesEqual(left[key], right[key]));
|
|
329
|
+
}
|
|
330
|
+
return a === b;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* One incoming value against the record's value under a resolved policy.
|
|
334
|
+
* `incoming` absent means the column was not mapped: the field is not
|
|
335
|
+
* touched. Blank means the cell was mapped and empty. `equal` decides
|
|
336
|
+
* whether the value the record ends with differs from the one it holds —
|
|
337
|
+
* the resource's comparator, when it has one.
|
|
338
|
+
*/ export function applyFieldPolicy(resolved, before, incoming, equal = transferValuesEqual) {
|
|
339
|
+
const same = (after, rule)=>({
|
|
340
|
+
after,
|
|
341
|
+
changed: !equal(before, after),
|
|
342
|
+
rule
|
|
343
|
+
});
|
|
344
|
+
if (resolved.refuseValues) return {
|
|
345
|
+
after: before,
|
|
346
|
+
changed: false,
|
|
347
|
+
rule: 'refused'
|
|
348
|
+
};
|
|
349
|
+
if (resolved.mode === 'keepExisting') return {
|
|
350
|
+
after: before,
|
|
351
|
+
changed: false,
|
|
352
|
+
rule: 'kept'
|
|
353
|
+
};
|
|
354
|
+
if (isBlankTransferValue(incoming)) {
|
|
355
|
+
if (resolved.blank === 'clear' && (resolved.mode === 'overwrite' || resolved.mode === 'append')) {
|
|
356
|
+
return same(null, 'cleared');
|
|
357
|
+
}
|
|
358
|
+
return {
|
|
359
|
+
after: before,
|
|
360
|
+
changed: false,
|
|
361
|
+
rule: 'leftBlank'
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
switch(resolved.mode){
|
|
365
|
+
case 'overwrite':
|
|
366
|
+
return same(incoming, 'written');
|
|
367
|
+
case 'fillBlanks':
|
|
368
|
+
return isBlankTransferValue(before) ? same(incoming, 'filled') : {
|
|
369
|
+
after: before,
|
|
370
|
+
changed: false,
|
|
371
|
+
rule: 'kept'
|
|
372
|
+
};
|
|
373
|
+
case 'append':
|
|
374
|
+
return same(appendTransferList(before, incoming), 'appended');
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
//# sourceMappingURL=policy.js.map
|