@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,99 @@
|
|
|
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
|
+
/** How a key's values are made comparable. */
|
|
18
|
+
export type MatchNormalizer = 'exact' | 'trim' | 'caseless' | 'email' | 'domain' | 'name' | 'slug' | 'phone' | 'externalId' | 'aglynId' | 'instant';
|
|
19
|
+
/** One part of a compound match key: another field, and how its values compare. */
|
|
20
|
+
export interface MatchKeyPart {
|
|
21
|
+
fieldId: string;
|
|
22
|
+
normalizer: MatchNormalizer;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* One match key: a field, and how its values compare. With `with`, a
|
|
26
|
+
* compound key: a row carries it only when every part has a value, and a row
|
|
27
|
+
* and a record share it only when every part agrees — an event's title AND
|
|
28
|
+
* its start, so a weekly class is not one event. A compound key is named by
|
|
29
|
+
* its first field everywhere a key is named.
|
|
30
|
+
*/
|
|
31
|
+
export interface MatchKeySpec {
|
|
32
|
+
fieldId: string;
|
|
33
|
+
normalizer: MatchNormalizer;
|
|
34
|
+
with?: readonly MatchKeyPart[];
|
|
35
|
+
}
|
|
36
|
+
/** What joins the parts of a compound key's value: shown, and never inside a normalized part. */
|
|
37
|
+
export declare const MATCH_KEY_PART_SEPARATOR = " \u241F ";
|
|
38
|
+
/**
|
|
39
|
+
* The domain of a web address or email address: lowercased, `www.` and
|
|
40
|
+
* a trailing dot dropped, port and path ignored. `null` when there is none.
|
|
41
|
+
*/
|
|
42
|
+
export declare function domainOf(value: unknown): string | null;
|
|
43
|
+
/** A name folded: accents, case, punctuation and spacing do not make a new name. */
|
|
44
|
+
export declare function foldName(value: unknown): string;
|
|
45
|
+
/** A slug folded: lowercase words joined by `-`. */
|
|
46
|
+
export declare function foldSlug(value: unknown): string;
|
|
47
|
+
/** A value under a normalizer, or `null` when it has no key (blank, unreadable). */
|
|
48
|
+
export declare function normalizeMatchValue(normalizer: MatchNormalizer, value: unknown): string | null;
|
|
49
|
+
/**
|
|
50
|
+
* A row's (or a record's) value under a key — every part normalized and
|
|
51
|
+
* joined for a compound key — or `null` when any part has none.
|
|
52
|
+
*/
|
|
53
|
+
export declare function matchKeyValue(key: MatchKeySpec, values: Readonly<Record<string, unknown>>): string | null;
|
|
54
|
+
/** The key under which a lookup answer is filed. */
|
|
55
|
+
export declare function matchLookupKey(fieldId: string, normalized: string): string;
|
|
56
|
+
/** Field + normalized value → ids of the existing records holding it. */
|
|
57
|
+
export type MatchLookup = ReadonlyMap<string, readonly string[]>;
|
|
58
|
+
/** What the caller must look up: per key, the distinct normalized values the rows carry. */
|
|
59
|
+
export interface MatchLookupRequest extends MatchKeySpec {
|
|
60
|
+
values: string[];
|
|
61
|
+
}
|
|
62
|
+
/** The values each key must be looked up for, distinct, in first-seen order. */
|
|
63
|
+
export declare function matchLookupRequests(rows: readonly Readonly<Record<string, unknown>>[], keys: readonly MatchKeySpec[]): MatchLookupRequest[];
|
|
64
|
+
/** Builds a {@link MatchLookup} from records: each record's values under every key. */
|
|
65
|
+
export declare function buildMatchLookup(records: Iterable<{
|
|
66
|
+
id: string;
|
|
67
|
+
values: Readonly<Record<string, unknown>>;
|
|
68
|
+
}>, keys: readonly MatchKeySpec[]): Map<string, string[]>;
|
|
69
|
+
/** Which key found a row's record, and by what value. */
|
|
70
|
+
export interface MatchedVia {
|
|
71
|
+
fieldId: string;
|
|
72
|
+
value: string;
|
|
73
|
+
}
|
|
74
|
+
/** What a row is about. */
|
|
75
|
+
export type RowMatchOutcome = {
|
|
76
|
+
kind: 'new';
|
|
77
|
+
} | {
|
|
78
|
+
kind: 'matched';
|
|
79
|
+
recordId: string;
|
|
80
|
+
via: MatchedVia;
|
|
81
|
+
/** Other records a lower-priority key pointed at — worth a warning. */
|
|
82
|
+
alsoMatched?: string[];
|
|
83
|
+
} | {
|
|
84
|
+
kind: 'ambiguous';
|
|
85
|
+
recordIds: string[];
|
|
86
|
+
via: MatchedVia;
|
|
87
|
+
} | {
|
|
88
|
+
kind: 'duplicateInFile';
|
|
89
|
+
firstRow: number;
|
|
90
|
+
via: MatchedVia;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* One outcome per row (see the block header). A row is a duplicate when ANY
|
|
94
|
+
* key value it carries was carried by an earlier row; otherwise the keys
|
|
95
|
+
* are tried in order and the first that finds a record decides.
|
|
96
|
+
*/
|
|
97
|
+
export declare function matchRows(rows: readonly Readonly<Record<string, unknown>>[], keys: readonly MatchKeySpec[], lookup: MatchLookup): RowMatchOutcome[];
|
|
98
|
+
/** How many rows had each outcome. */
|
|
99
|
+
export declare function summarizeMatches(outcomes: readonly RowMatchOutcome[]): Record<RowMatchOutcome['kind'], number>;
|
|
@@ -0,0 +1,244 @@
|
|
|
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
|
+
* RECORD MATCHING — which existing record each row of a file is about.
|
|
19
|
+
*
|
|
20
|
+
* The person picks match keys in priority order (the Aglyn id, an external
|
|
21
|
+
* id, an email, a domain, a name…). Each key is a field and a normalizer,
|
|
22
|
+
* so `Jane@Example.com ` and `jane@example.com` are one key and
|
|
23
|
+
* `https://www.example.com/about` and `bob@example.com` share a domain.
|
|
24
|
+
*
|
|
25
|
+
* Matching is pure: the caller asks storage for the records holding the
|
|
26
|
+
* requested key values ({@link matchLookupRequests}), hands the answer back
|
|
27
|
+
* as a {@link MatchLookup}, and gets one outcome per row:
|
|
28
|
+
*
|
|
29
|
+
* - `new` — no key found a record;
|
|
30
|
+
* - `matched` — the first key that found anything found exactly one;
|
|
31
|
+
* - `ambiguous` — it found several, and the person must choose;
|
|
32
|
+
* - `duplicateInFile` — an earlier row carries the same key value, so
|
|
33
|
+
* both rows are about one record and the later one is held back.
|
|
34
|
+
*=========================================*/ import { normalizePhone } from "../foundation/definitions/contact.types.js";
|
|
35
|
+
import { foldText } from "./similarity.js";
|
|
36
|
+
/** What joins the parts of a compound key's value: shown, and never inside a normalized part. */ export const MATCH_KEY_PART_SEPARATOR = ' \u241f ';
|
|
37
|
+
/**
|
|
38
|
+
* The domain of a web address or email address: lowercased, `www.` and
|
|
39
|
+
* a trailing dot dropped, port and path ignored. `null` when there is none.
|
|
40
|
+
*/ export function domainOf(value) {
|
|
41
|
+
var _text_split_;
|
|
42
|
+
let text = String(value != null ? value : '').trim().toLowerCase();
|
|
43
|
+
if (!text) return null;
|
|
44
|
+
const at = text.lastIndexOf('@');
|
|
45
|
+
if (at >= 0 && !text.includes('://')) text = text.slice(at + 1);
|
|
46
|
+
text = text.replace(/^[a-z][a-z0-9+.-]*:\/\//, '').replace(/^[^@/]*@/, '');
|
|
47
|
+
text = ((_text_split_ = text.split(/[/?#]/)[0]) != null ? _text_split_ : '').replace(/:\d+$/, '').replace(/\.$/, '').replace(/^www\./, '');
|
|
48
|
+
return /^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9-]{2,}$/.test(text) ? text : null;
|
|
49
|
+
}
|
|
50
|
+
/** A name folded: accents, case, punctuation and spacing do not make a new name. */ export function foldName(value) {
|
|
51
|
+
return foldText(value).replace(/&/g, ' and ').replace(/[^a-z0-9]+/g, ' ').trim();
|
|
52
|
+
}
|
|
53
|
+
/** A slug folded: lowercase words joined by `-`. */ export function foldSlug(value) {
|
|
54
|
+
return foldText(value).replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
|
|
55
|
+
}
|
|
56
|
+
/** A value under a normalizer, or `null` when it has no key (blank, unreadable). */ export function normalizeMatchValue(normalizer, value) {
|
|
57
|
+
if (value === null || value === undefined) return null;
|
|
58
|
+
const text = String(value);
|
|
59
|
+
let key;
|
|
60
|
+
switch(normalizer){
|
|
61
|
+
case 'exact':
|
|
62
|
+
key = text;
|
|
63
|
+
break;
|
|
64
|
+
case 'trim':
|
|
65
|
+
case 'externalId':
|
|
66
|
+
case 'aglynId':
|
|
67
|
+
key = text.trim();
|
|
68
|
+
break;
|
|
69
|
+
case 'caseless':
|
|
70
|
+
key = text.trim().toLowerCase();
|
|
71
|
+
break;
|
|
72
|
+
case 'email':
|
|
73
|
+
{
|
|
74
|
+
const lower = text.trim().toLowerCase();
|
|
75
|
+
key = /^[^\s@]+@[^\s@]+$/.test(lower) ? lower : null;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
case 'domain':
|
|
79
|
+
key = domainOf(text);
|
|
80
|
+
break;
|
|
81
|
+
case 'name':
|
|
82
|
+
key = foldName(text);
|
|
83
|
+
break;
|
|
84
|
+
case 'slug':
|
|
85
|
+
key = foldSlug(text);
|
|
86
|
+
break;
|
|
87
|
+
case 'phone':
|
|
88
|
+
key = normalizePhone(text);
|
|
89
|
+
break;
|
|
90
|
+
case 'instant':
|
|
91
|
+
key = instantOf(value);
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
return key ? key.replaceAll(MATCH_KEY_PART_SEPARATOR, ' ') : null;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* A moment to the minute, in UTC (`2026-10-05T14:30Z`), from epoch
|
|
98
|
+
* milliseconds, a `Date`, or any text `Date` reads; `null` when it is none.
|
|
99
|
+
* The file's ISO text and the record's stored milliseconds meet here.
|
|
100
|
+
*/ function instantOf(value) {
|
|
101
|
+
const ms = typeof value === 'number' ? value : value instanceof Date ? value.getTime() : /^\d{11,}$/.test(String(value).trim()) ? Number(String(value).trim()) : Date.parse(String(value).trim());
|
|
102
|
+
if (!Number.isFinite(ms)) return null;
|
|
103
|
+
return `${new Date(ms).toISOString().slice(0, 16)}Z`;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* A row's (or a record's) value under a key — every part normalized and
|
|
107
|
+
* joined for a compound key — or `null` when any part has none.
|
|
108
|
+
*/ export function matchKeyValue(key, values) {
|
|
109
|
+
var _key_with;
|
|
110
|
+
const first = normalizeMatchValue(key.normalizer, values[key.fieldId]);
|
|
111
|
+
if (!first || !((_key_with = key.with) == null ? void 0 : _key_with.length)) return first;
|
|
112
|
+
const parts = [
|
|
113
|
+
first
|
|
114
|
+
];
|
|
115
|
+
for (const part of key.with){
|
|
116
|
+
const value = normalizeMatchValue(part.normalizer, values[part.fieldId]);
|
|
117
|
+
if (!value) return null;
|
|
118
|
+
parts.push(value);
|
|
119
|
+
}
|
|
120
|
+
return parts.join(MATCH_KEY_PART_SEPARATOR);
|
|
121
|
+
}
|
|
122
|
+
/** The key under which a lookup answer is filed. */ export function matchLookupKey(fieldId, normalized) {
|
|
123
|
+
return `${fieldId}\u0000${normalized}`;
|
|
124
|
+
}
|
|
125
|
+
/** The values each key must be looked up for, distinct, in first-seen order. */ export function matchLookupRequests(rows, keys) {
|
|
126
|
+
return keys.map((key)=>{
|
|
127
|
+
const values = new Set();
|
|
128
|
+
for (const row of rows){
|
|
129
|
+
const normalized = matchKeyValue(key, row);
|
|
130
|
+
if (normalized) values.add(normalized);
|
|
131
|
+
}
|
|
132
|
+
return _extends({}, key, {
|
|
133
|
+
values: [
|
|
134
|
+
...values
|
|
135
|
+
]
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
/** Builds a {@link MatchLookup} from records: each record's values under every key. */ export function buildMatchLookup(records, keys) {
|
|
140
|
+
const lookup = new Map();
|
|
141
|
+
for (const record of records){
|
|
142
|
+
for (const key of keys){
|
|
143
|
+
const raw = key.normalizer === 'aglynId' && record.values[key.fieldId] === undefined ? record.id : record.values[key.fieldId];
|
|
144
|
+
const values = Array.isArray(raw) ? raw : [
|
|
145
|
+
raw
|
|
146
|
+
];
|
|
147
|
+
for (const value of values){
|
|
148
|
+
var _lookup_get;
|
|
149
|
+
const normalized = matchKeyValue(key, _extends({}, record.values, {
|
|
150
|
+
[key.fieldId]: value
|
|
151
|
+
}));
|
|
152
|
+
if (!normalized) continue;
|
|
153
|
+
const at = matchLookupKey(key.fieldId, normalized);
|
|
154
|
+
const ids = (_lookup_get = lookup.get(at)) != null ? _lookup_get : [];
|
|
155
|
+
if (!ids.includes(record.id)) ids.push(record.id);
|
|
156
|
+
lookup.set(at, ids);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return lookup;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* One outcome per row (see the block header). A row is a duplicate when ANY
|
|
164
|
+
* key value it carries was carried by an earlier row; otherwise the keys
|
|
165
|
+
* are tried in order and the first that finds a record decides.
|
|
166
|
+
*/ export function matchRows(rows, keys, lookup) {
|
|
167
|
+
const firstRowOf = new Map();
|
|
168
|
+
return rows.map((row, index)=>{
|
|
169
|
+
const carried = keys.map((key)=>({
|
|
170
|
+
key,
|
|
171
|
+
value: matchKeyValue(key, row)
|
|
172
|
+
})).filter((entry)=>Boolean(entry.value));
|
|
173
|
+
const duplicateOf = carried.map((entry)=>({
|
|
174
|
+
entry,
|
|
175
|
+
first: firstRowOf.get(matchLookupKey(entry.key.fieldId, entry.value))
|
|
176
|
+
})).find((found)=>found.first !== undefined);
|
|
177
|
+
for (const entry of carried){
|
|
178
|
+
const at = matchLookupKey(entry.key.fieldId, entry.value);
|
|
179
|
+
if (!firstRowOf.has(at)) firstRowOf.set(at, index);
|
|
180
|
+
}
|
|
181
|
+
if (duplicateOf) {
|
|
182
|
+
return {
|
|
183
|
+
kind: 'duplicateInFile',
|
|
184
|
+
firstRow: duplicateOf.first,
|
|
185
|
+
via: {
|
|
186
|
+
fieldId: duplicateOf.entry.key.fieldId,
|
|
187
|
+
value: duplicateOf.entry.value
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
for(let at = 0; at < carried.length; at += 1){
|
|
192
|
+
var _lookup_get;
|
|
193
|
+
const { key, value } = carried[at];
|
|
194
|
+
const ids = (_lookup_get = lookup.get(matchLookupKey(key.fieldId, value))) != null ? _lookup_get : [];
|
|
195
|
+
if (!ids.length) continue;
|
|
196
|
+
const via = {
|
|
197
|
+
fieldId: key.fieldId,
|
|
198
|
+
value
|
|
199
|
+
};
|
|
200
|
+
if (ids.length > 1) return {
|
|
201
|
+
kind: 'ambiguous',
|
|
202
|
+
recordIds: [
|
|
203
|
+
...ids
|
|
204
|
+
],
|
|
205
|
+
via
|
|
206
|
+
};
|
|
207
|
+
const recordId = ids[0];
|
|
208
|
+
const others = new Set();
|
|
209
|
+
for (const later of carried.slice(at + 1)){
|
|
210
|
+
var _lookup_get1;
|
|
211
|
+
for (const id of (_lookup_get1 = lookup.get(matchLookupKey(later.key.fieldId, later.value))) != null ? _lookup_get1 : []){
|
|
212
|
+
if (id !== recordId) others.add(id);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return others.size ? {
|
|
216
|
+
kind: 'matched',
|
|
217
|
+
recordId,
|
|
218
|
+
via,
|
|
219
|
+
alsoMatched: [
|
|
220
|
+
...others
|
|
221
|
+
]
|
|
222
|
+
} : {
|
|
223
|
+
kind: 'matched',
|
|
224
|
+
recordId,
|
|
225
|
+
via
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
kind: 'new'
|
|
230
|
+
};
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
/** How many rows had each outcome. */ export function summarizeMatches(outcomes) {
|
|
234
|
+
const summary = {
|
|
235
|
+
new: 0,
|
|
236
|
+
matched: 0,
|
|
237
|
+
ambiguous: 0,
|
|
238
|
+
duplicateInFile: 0
|
|
239
|
+
};
|
|
240
|
+
for (const outcome of outcomes)summary[outcome.kind] += 1;
|
|
241
|
+
return summary;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
//# sourceMappingURL=match.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/data-transfer/match.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 * RECORD MATCHING — which existing record each row of a file is about.\n *\n * The person picks match keys in priority order (the Aglyn id, an external\n * id, an email, a domain, a name…). Each key is a field and a normalizer,\n * so `Jane@Example.com ` and `jane@example.com` are one key and\n * `https://www.example.com/about` and `bob@example.com` share a domain.\n *\n * Matching is pure: the caller asks storage for the records holding the\n * requested key values ({@link matchLookupRequests}), hands the answer back\n * as a {@link MatchLookup}, and gets one outcome per row:\n *\n * - `new` — no key found a record;\n * - `matched` — the first key that found anything found exactly one;\n * - `ambiguous` — it found several, and the person must choose;\n * - `duplicateInFile` — an earlier row carries the same key value, so\n * both rows are about one record and the later one is held back.\n *=========================================*/\n\nimport { normalizePhone } from '../foundation/definitions/contact.types'\nimport { foldText } from './similarity'\n\n/** How a key's values are made comparable. */\nexport type MatchNormalizer =\n | 'exact'\n | 'trim'\n | 'caseless'\n | 'email'\n | 'domain'\n | 'name'\n | 'slug'\n | 'phone'\n | 'externalId'\n | 'aglynId'\n | 'instant'\n\n/** One part of a compound match key: another field, and how its values compare. */\nexport interface MatchKeyPart {\n fieldId: string\n normalizer: MatchNormalizer\n}\n\n/**\n * One match key: a field, and how its values compare. With `with`, a\n * compound key: a row carries it only when every part has a value, and a row\n * and a record share it only when every part agrees — an event's title AND\n * its start, so a weekly class is not one event. A compound key is named by\n * its first field everywhere a key is named.\n */\nexport interface MatchKeySpec {\n fieldId: string\n normalizer: MatchNormalizer\n with?: readonly MatchKeyPart[]\n}\n\n/** What joins the parts of a compound key's value: shown, and never inside a normalized part. */\nexport const MATCH_KEY_PART_SEPARATOR = ' \\u241f '\n\n/**\n * The domain of a web address or email address: lowercased, `www.` and\n * a trailing dot dropped, port and path ignored. `null` when there is none.\n */\nexport function domainOf(value: unknown): string | null {\n let text = String(value ?? '').trim().toLowerCase()\n if (!text) return null\n const at = text.lastIndexOf('@')\n if (at >= 0 && !text.includes('://')) text = text.slice(at + 1)\n text = text.replace(/^[a-z][a-z0-9+.-]*:\\/\\//, '').replace(/^[^@/]*@/, '')\n text = (text.split(/[/?#]/)[0] ?? '').replace(/:\\d+$/, '').replace(/\\.$/, '').replace(/^www\\./, '')\n return /^(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9-]{2,}$/.test(text) ? text : null\n}\n\n/** A name folded: accents, case, punctuation and spacing do not make a new name. */\nexport function foldName(value: unknown): string {\n return foldText(value)\n .replace(/&/g, ' and ')\n .replace(/[^a-z0-9]+/g, ' ')\n .trim()\n}\n\n/** A slug folded: lowercase words joined by `-`. */\nexport function foldSlug(value: unknown): string {\n return foldText(value)\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^-+|-+$/g, '')\n}\n\n/** A value under a normalizer, or `null` when it has no key (blank, unreadable). */\nexport function normalizeMatchValue(normalizer: MatchNormalizer, value: unknown): string | null {\n if (value === null || value === undefined) return null\n const text = String(value)\n let key: string | null\n switch (normalizer) {\n case 'exact':\n key = text\n break\n case 'trim':\n case 'externalId':\n case 'aglynId':\n key = text.trim()\n break\n case 'caseless':\n key = text.trim().toLowerCase()\n break\n case 'email': {\n const lower = text.trim().toLowerCase()\n key = /^[^\\s@]+@[^\\s@]+$/.test(lower) ? lower : null\n break\n }\n case 'domain':\n key = domainOf(text)\n break\n case 'name':\n key = foldName(text)\n break\n case 'slug':\n key = foldSlug(text)\n break\n case 'phone':\n key = normalizePhone(text)\n break\n case 'instant':\n key = instantOf(value)\n break\n }\n return key ? key.replaceAll(MATCH_KEY_PART_SEPARATOR, ' ') : null\n}\n\n/**\n * A moment to the minute, in UTC (`2026-10-05T14:30Z`), from epoch\n * milliseconds, a `Date`, or any text `Date` reads; `null` when it is none.\n * The file's ISO text and the record's stored milliseconds meet here.\n */\nfunction instantOf(value: unknown): string | null {\n const ms =\n typeof value === 'number'\n ? value\n : value instanceof Date\n ? value.getTime()\n : /^\\d{11,}$/.test(String(value).trim())\n ? Number(String(value).trim())\n : Date.parse(String(value).trim())\n if (!Number.isFinite(ms)) return null\n return `${new Date(ms).toISOString().slice(0, 16)}Z`\n}\n\n/**\n * A row's (or a record's) value under a key — every part normalized and\n * joined for a compound key — or `null` when any part has none.\n */\nexport function matchKeyValue(key: MatchKeySpec, values: Readonly<Record<string, unknown>>): string | null {\n const first = normalizeMatchValue(key.normalizer, values[key.fieldId])\n if (!first || !key.with?.length) return first\n const parts = [first]\n for (const part of key.with) {\n const value = normalizeMatchValue(part.normalizer, values[part.fieldId])\n if (!value) return null\n parts.push(value)\n }\n return parts.join(MATCH_KEY_PART_SEPARATOR)\n}\n\n/** The key under which a lookup answer is filed. */\nexport function matchLookupKey(fieldId: string, normalized: string): string {\n return `${fieldId}\\u0000${normalized}`\n}\n\n/** Field + normalized value → ids of the existing records holding it. */\nexport type MatchLookup = ReadonlyMap<string, readonly string[]>\n\n/** What the caller must look up: per key, the distinct normalized values the rows carry. */\nexport interface MatchLookupRequest extends MatchKeySpec {\n values: string[]\n}\n\n/** The values each key must be looked up for, distinct, in first-seen order. */\nexport function matchLookupRequests(\n rows: readonly Readonly<Record<string, unknown>>[],\n keys: readonly MatchKeySpec[],\n): MatchLookupRequest[] {\n return keys.map((key) => {\n const values = new Set<string>()\n for (const row of rows) {\n const normalized = matchKeyValue(key, row)\n if (normalized) values.add(normalized)\n }\n return { ...key, values: [...values] }\n })\n}\n\n/** Builds a {@link MatchLookup} from records: each record's values under every key. */\nexport function buildMatchLookup(\n records: Iterable<{ id: string; values: Readonly<Record<string, unknown>> }>,\n keys: readonly MatchKeySpec[],\n): Map<string, string[]> {\n const lookup = new Map<string, string[]>()\n for (const record of records) {\n for (const key of keys) {\n const raw = key.normalizer === 'aglynId' && record.values[key.fieldId] === undefined ? record.id : record.values[key.fieldId]\n const values = Array.isArray(raw) ? raw : [raw]\n for (const value of values) {\n const normalized = matchKeyValue(key, { ...record.values, [key.fieldId]: value })\n if (!normalized) continue\n const at = matchLookupKey(key.fieldId, normalized)\n const ids = lookup.get(at) ?? []\n if (!ids.includes(record.id)) ids.push(record.id)\n lookup.set(at, ids)\n }\n }\n }\n return lookup\n}\n\n/** Which key found a row's record, and by what value. */\nexport interface MatchedVia {\n fieldId: string\n value: string\n}\n\n/** What a row is about. */\nexport type RowMatchOutcome =\n | { kind: 'new' }\n | {\n kind: 'matched'\n recordId: string\n via: MatchedVia\n /** Other records a lower-priority key pointed at — worth a warning. */\n alsoMatched?: string[]\n }\n | { kind: 'ambiguous'; recordIds: string[]; via: MatchedVia }\n | { kind: 'duplicateInFile'; firstRow: number; via: MatchedVia }\n\n/**\n * One outcome per row (see the block header). A row is a duplicate when ANY\n * key value it carries was carried by an earlier row; otherwise the keys\n * are tried in order and the first that finds a record decides.\n */\nexport function matchRows(\n rows: readonly Readonly<Record<string, unknown>>[],\n keys: readonly MatchKeySpec[],\n lookup: MatchLookup,\n): RowMatchOutcome[] {\n const firstRowOf = new Map<string, number>()\n return rows.map((row, index) => {\n const carried = keys\n .map((key) => ({ key, value: matchKeyValue(key, row) }))\n .filter((entry): entry is { key: MatchKeySpec; value: string } => Boolean(entry.value))\n\n const duplicateOf = carried\n .map((entry) => ({ entry, first: firstRowOf.get(matchLookupKey(entry.key.fieldId, entry.value)) }))\n .find((found) => found.first !== undefined)\n for (const entry of carried) {\n const at = matchLookupKey(entry.key.fieldId, entry.value)\n if (!firstRowOf.has(at)) firstRowOf.set(at, index)\n }\n if (duplicateOf) {\n return {\n kind: 'duplicateInFile',\n firstRow: duplicateOf.first as number,\n via: { fieldId: duplicateOf.entry.key.fieldId, value: duplicateOf.entry.value },\n }\n }\n\n for (let at = 0; at < carried.length; at += 1) {\n const { key, value } = carried[at] as { key: MatchKeySpec; value: string }\n const ids = lookup.get(matchLookupKey(key.fieldId, value)) ?? []\n if (!ids.length) continue\n const via = { fieldId: key.fieldId, value }\n if (ids.length > 1) return { kind: 'ambiguous', recordIds: [...ids], via }\n const recordId = ids[0] as string\n const others = new Set<string>()\n for (const later of carried.slice(at + 1)) {\n for (const id of lookup.get(matchLookupKey(later.key.fieldId, later.value)) ?? []) {\n if (id !== recordId) others.add(id)\n }\n }\n return others.size\n ? { kind: 'matched', recordId, via, alsoMatched: [...others] }\n : { kind: 'matched', recordId, via }\n }\n return { kind: 'new' }\n })\n}\n\n/** How many rows had each outcome. */\nexport function summarizeMatches(outcomes: readonly RowMatchOutcome[]): Record<RowMatchOutcome['kind'], number> {\n const summary = { new: 0, matched: 0, ambiguous: 0, duplicateInFile: 0 }\n for (const outcome of outcomes) summary[outcome.kind] += 1\n return summary\n}\n"],"names":["normalizePhone","foldText","MATCH_KEY_PART_SEPARATOR","domainOf","value","text","String","trim","toLowerCase","at","lastIndexOf","includes","slice","replace","split","test","foldName","foldSlug","normalizeMatchValue","normalizer","undefined","key","lower","instantOf","replaceAll","ms","Date","getTime","Number","parse","isFinite","toISOString","matchKeyValue","values","first","fieldId","with","length","parts","part","push","join","matchLookupKey","normalized","matchLookupRequests","rows","keys","map","Set","row","add","buildMatchLookup","records","lookup","Map","record","raw","id","Array","isArray","ids","get","set","matchRows","firstRowOf","index","carried","filter","entry","Boolean","duplicateOf","find","found","has","kind","firstRow","via","recordIds","recordId","others","later","size","alsoMatched","summarizeMatches","outcomes","summary","new","matched","ambiguous","duplicateInFile","outcome"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;2CAiB2C,GAE3C,SAASA,cAAc,QAAQ,6CAAyC;AACxE,SAASC,QAAQ,QAAQ,kBAAc;AAmCvC,+FAA+F,GAC/F,OAAO,MAAMC,2BAA2B,WAAU;AAElD;;;CAGC,GACD,OAAO,SAASC,SAASC,KAAc;QAM7BC;IALR,IAAIA,OAAOC,OAAOF,gBAAAA,QAAS,IAAIG,IAAI,GAAGC,WAAW;IACjD,IAAI,CAACH,MAAM,OAAO;IAClB,MAAMI,KAAKJ,KAAKK,WAAW,CA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MAAM;gBAAaG,WAAW;uBAAIjB;iBAAI;gBAAEgB;YAAI;YACzE,MAAME,WAAWlB,GAAG,CAAC,EAAE;YACvB,MAAMmB,SAAS,IAAI/B;YACnB,KAAK,MAAMgC,SAASd,QAAQtD,KAAK,CAACH,KAAK,GAAI;oBACxB4C;gBAAjB,KAAK,MAAMI,OAAMJ,eAAAA,OAAOQ,GAAG,CAACnB,eAAesC,MAAM3D,GAAG,CAACc,OAAO,EAAE6C,MAAM5E,KAAK,cAAxDiD,eAA8D,EAAE,CAAE;oBACjF,IAAII,OAAOqB,UAAUC,OAAO7B,GAAG,CAACO;gBAClC;YACF;YACA,OAAOsB,OAAOE,IAAI,GACd;gBAAEP,MAAM;gBAAWI;gBAAUF;gBAAKM,aAAa;uBAAIH;iBAAO;YAAC,IAC3D;gBAAEL,MAAM;gBAAWI;gBAAUF;YAAI;QACvC;QACA,OAAO;YAAEF,MAAM;QAAM;IACvB;AACF;AAEA,oCAAoC,GACpC,OAAO,SAASS,iBAAiBC,QAAoC;IACnE,MAAMC,UAAU;QAAEC,KAAK;QAAGC,SAAS;QAAGC,WAAW;QAAGC,iBAAiB;IAAE;IACvE,KAAK,MAAMC,WAAWN,SAAUC,OAAO,CAACK,QAAQhB,IAAI,CAAC,IAAI;IACzD,OAAOW;AACT"}
|
|
@@ -0,0 +1,205 @@
|
|
|
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 ExistingPackageItem, type PackageItemComparison, type PackageItemDecision, type PackageItemStatus, type PackageManifest } from './package';
|
|
18
|
+
/** The kind a reference to one of the workspace's sites carries. Answered by the engine, not a plugin. */
|
|
19
|
+
export declare const TRANSFER_SITE_KIND = "site";
|
|
20
|
+
/** The resource a workspace package's job is filed under: one package import runs at a time. */
|
|
21
|
+
export declare const TRANSFER_PACKAGE_RESOURCE = "package";
|
|
22
|
+
/** The most items one workspace package may carry. */
|
|
23
|
+
export declare const TRANSFER_PACKAGE_MAX_ITEMS = 1000;
|
|
24
|
+
/** The most bytes one workspace package file may carry. */
|
|
25
|
+
export declare const TRANSFER_PACKAGE_MAX_BYTES = 3000000;
|
|
26
|
+
/** What importing one item comes to. */
|
|
27
|
+
export type TransferPackageVerdict = 'create' | 'replace' | 'keepBoth' | 'skip' | 'fail';
|
|
28
|
+
export declare const TRANSFER_PACKAGE_VERDICTS: readonly TransferPackageVerdict[];
|
|
29
|
+
/** What to do about a reference the package cannot satisfy. */
|
|
30
|
+
export type TransferPackageDependencyChoice =
|
|
31
|
+
/** Import the package's own copy of an item the person had skipped. */
|
|
32
|
+
{
|
|
33
|
+
action: 'import';
|
|
34
|
+
}
|
|
35
|
+
/** Point the reference at something the workspace already has. */
|
|
36
|
+
| {
|
|
37
|
+
action: 'mapTo';
|
|
38
|
+
id: string;
|
|
39
|
+
}
|
|
40
|
+
/** Leave the reference out of every item that names it. */
|
|
41
|
+
| {
|
|
42
|
+
action: 'dropReference';
|
|
43
|
+
}
|
|
44
|
+
/** Skip every item that needs it. */
|
|
45
|
+
| {
|
|
46
|
+
action: 'skipItem';
|
|
47
|
+
};
|
|
48
|
+
export type TransferPackageDependencyAction = TransferPackageDependencyChoice['action'];
|
|
49
|
+
/** One thing a reference may be mapped to. */
|
|
50
|
+
export interface TransferReferenceTarget {
|
|
51
|
+
id: string;
|
|
52
|
+
name?: string;
|
|
53
|
+
}
|
|
54
|
+
/** What the workspace holds of a kind no package resource owns (its sites, its mailboxes, its lists). */
|
|
55
|
+
export interface TransferReferenceKind {
|
|
56
|
+
kind: string;
|
|
57
|
+
/** What one of them is called ("Mailbox"). */
|
|
58
|
+
label: string;
|
|
59
|
+
targets: TransferReferenceTarget[];
|
|
60
|
+
}
|
|
61
|
+
/** The warnings an import must have acknowledged before it writes. */
|
|
62
|
+
export type TransferPackageWarningClass = 'replace' | 'dropReference' | 'failed';
|
|
63
|
+
export declare const TRANSFER_PACKAGE_WARNING_CLASSES: readonly TransferPackageWarningClass[];
|
|
64
|
+
/** Why an item is skipped or fails. */
|
|
65
|
+
export type TransferPackageItemReason =
|
|
66
|
+
/** No enabled plugin owns its kind. */
|
|
67
|
+
'unknownKind'
|
|
68
|
+
/** The person chose to skip it. */
|
|
69
|
+
| 'chosen'
|
|
70
|
+
/** It is identical to the workspace's item. */
|
|
71
|
+
| 'identical'
|
|
72
|
+
/** A reference it needs was answered with "skip every item that needs it". */
|
|
73
|
+
| 'missingDependency'
|
|
74
|
+
/** The owning plugin's own checks refuse it (`problems`). */
|
|
75
|
+
| 'problems';
|
|
76
|
+
/** One item's line in the plan. */
|
|
77
|
+
export interface TransferPackagePlanItem {
|
|
78
|
+
/** Its index in the manifest — the row the ledger and the results name. */
|
|
79
|
+
row: number;
|
|
80
|
+
/** `<kind>/<id>`, as the file names it. */
|
|
81
|
+
key: string;
|
|
82
|
+
kind: string;
|
|
83
|
+
id: string;
|
|
84
|
+
name?: string;
|
|
85
|
+
slug?: string;
|
|
86
|
+
status: PackageItemStatus;
|
|
87
|
+
comparison: PackageItemComparison;
|
|
88
|
+
matchedBy?: 'id' | 'slug' | 'name';
|
|
89
|
+
existing?: {
|
|
90
|
+
id: string;
|
|
91
|
+
name?: string;
|
|
92
|
+
slug?: string;
|
|
93
|
+
};
|
|
94
|
+
/** What will be done with it. */
|
|
95
|
+
decision: PackageItemDecision;
|
|
96
|
+
/** The decisions it may take. */
|
|
97
|
+
decisions: PackageItemDecision[];
|
|
98
|
+
/** It differs from the workspace's item and the person has not chosen yet. */
|
|
99
|
+
needsChoice: boolean;
|
|
100
|
+
verdict: TransferPackageVerdict;
|
|
101
|
+
/** The id it is written under, for a write. */
|
|
102
|
+
targetId?: string;
|
|
103
|
+
/** A kept-both copy's new name and slug. */
|
|
104
|
+
rename?: {
|
|
105
|
+
name?: string;
|
|
106
|
+
slug?: string;
|
|
107
|
+
};
|
|
108
|
+
reason?: TransferPackageItemReason;
|
|
109
|
+
/** The owning plugin's objections, each a sentence; any one fails the item. */
|
|
110
|
+
problems: string[];
|
|
111
|
+
}
|
|
112
|
+
/** A reference no item in the package or the workspace satisfies, and what the person chose for it. */
|
|
113
|
+
export interface TransferPackageReference {
|
|
114
|
+
/** `<kind>/<id>`. */
|
|
115
|
+
key: string;
|
|
116
|
+
kind: string;
|
|
117
|
+
id: string;
|
|
118
|
+
/** What one of the kind is called. */
|
|
119
|
+
label: string;
|
|
120
|
+
/** A name for it, when the package carries it. */
|
|
121
|
+
name?: string;
|
|
122
|
+
/** The items that name it, by key. */
|
|
123
|
+
neededBy: string[];
|
|
124
|
+
/** The package carries it, and the person chose not to import it. */
|
|
125
|
+
inPackage: boolean;
|
|
126
|
+
choice: TransferPackageDependencyChoice | null;
|
|
127
|
+
/** What may be chosen for it. */
|
|
128
|
+
choices: TransferPackageDependencyAction[];
|
|
129
|
+
/** What it may be mapped to. */
|
|
130
|
+
targets: TransferReferenceTarget[];
|
|
131
|
+
}
|
|
132
|
+
export type TransferPackageSummary = Record<TransferPackageVerdict, number> & {
|
|
133
|
+
total: number;
|
|
134
|
+
};
|
|
135
|
+
/** What importing a package would do. */
|
|
136
|
+
export interface TransferPackagePlan {
|
|
137
|
+
items: TransferPackagePlanItem[];
|
|
138
|
+
/** References needing (or holding) a choice. */
|
|
139
|
+
references: TransferPackageReference[];
|
|
140
|
+
/** Kinds in the file no enabled plugin owns; their items are skipped. */
|
|
141
|
+
unknownKinds: string[];
|
|
142
|
+
/** The keys of the items that write, dependencies first. */
|
|
143
|
+
order: string[];
|
|
144
|
+
/** Item key → the id it has after the import; `''` for a dropped reference. */
|
|
145
|
+
idMap: Record<string, string>;
|
|
146
|
+
summary: TransferPackageSummary;
|
|
147
|
+
/** What still blocks Apply, each a sentence. */
|
|
148
|
+
blocking: string[];
|
|
149
|
+
acknowledgementsRequired: TransferPackageWarningClass[];
|
|
150
|
+
}
|
|
151
|
+
export interface PlanTransferPackageInput {
|
|
152
|
+
manifest: Pick<PackageManifest, 'items'>;
|
|
153
|
+
/** The kinds a package resource owns here — every other kind is unknown. */
|
|
154
|
+
ownedKinds: ReadonlySet<string>;
|
|
155
|
+
/** What the workspace holds of every owned kind the package carries or names. */
|
|
156
|
+
existing: readonly ExistingPackageItem[];
|
|
157
|
+
/** What the workspace holds of the other kinds the items name. */
|
|
158
|
+
references?: readonly TransferReferenceKind[];
|
|
159
|
+
/** What a package kind is called, for a reference to one. */
|
|
160
|
+
kindLabels?: Readonly<Record<string, string>>;
|
|
161
|
+
/** The person's decision per item key. */
|
|
162
|
+
decisions?: Readonly<Record<string, PackageItemDecision>>;
|
|
163
|
+
/** The person's choice per reference key. */
|
|
164
|
+
dependencyChoices?: Readonly<Record<string, TransferPackageDependencyChoice>>;
|
|
165
|
+
/** The objections each item's plugin raised, by item key. */
|
|
166
|
+
problems?: Readonly<Record<string, readonly string[]>>;
|
|
167
|
+
/** A fresh id for a kept-both copy. Called once per such item, in manifest order. */
|
|
168
|
+
newId: () => string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* The name a kept-both copy takes: `<name> (copy)`, then `(copy 2)`,
|
|
172
|
+
* `(copy 3)`… until none of `taken` (compared caselessly).
|
|
173
|
+
*/
|
|
174
|
+
export declare function keepBothName(name: string, taken: Iterable<string>): string;
|
|
175
|
+
/**
|
|
176
|
+
* What a resource holds now, as matching reads it: each item's content
|
|
177
|
+
* hashed with `contentHash`. A resource's `items` hook answers with this
|
|
178
|
+
* over the same content `readItems` exports, so an item exported and
|
|
179
|
+
* imported unchanged compares `identical`.
|
|
180
|
+
*/
|
|
181
|
+
export declare function existingPackageItemsOf<T>(kind: string, contents: ReadonlyArray<{
|
|
182
|
+
id: string;
|
|
183
|
+
name?: string;
|
|
184
|
+
slug?: string;
|
|
185
|
+
content: T;
|
|
186
|
+
}>): Promise<ExistingPackageItem[]>;
|
|
187
|
+
/**
|
|
188
|
+
* The plan (see the block header). Deterministic for the same input,
|
|
189
|
+
* `newId` aside: decisions the person did not make are proposed, a
|
|
190
|
+
* decision an item may not take falls back to the proposal, and a
|
|
191
|
+
* reference choice that names nothing the workspace holds is no choice.
|
|
192
|
+
*/
|
|
193
|
+
export declare function planTransferPackage(input: PlanTransferPackageInput): TransferPackagePlan;
|
|
194
|
+
/** The warning classes a plan still needs acknowledged. */
|
|
195
|
+
export declare function missingPackageAcknowledgements(plan: Pick<TransferPackagePlan, 'acknowledgementsRequired'>, acknowledged: readonly string[]): TransferPackageWarningClass[];
|
|
196
|
+
/** Whether a plan may be applied: nothing blocks, every warning is acknowledged, and something writes. */
|
|
197
|
+
export declare function canApplyTransferPackage(plan: Pick<TransferPackagePlan, 'acknowledgementsRequired' | 'blocking' | 'summary'>, acknowledged: readonly string[]): boolean;
|
|
198
|
+
/** The id map as `remapIds` takes it. */
|
|
199
|
+
export declare function packageIdMap(idMap: Readonly<Record<string, string>>): ReadonlyMap<string, string>;
|
|
200
|
+
/**
|
|
201
|
+
* A reference rewritten through an id map: the id it now has, `null` when
|
|
202
|
+
* the person dropped it, or itself when nothing maps it (a reference the
|
|
203
|
+
* workspace already satisfies). The helper every `remapIds` uses.
|
|
204
|
+
*/
|
|
205
|
+
export declare function remapPackageReference(idMap: ReadonlyMap<string, string>, kind: string, id: string | null | undefined): string | null;
|