@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
|
@@ -1,146 +0,0 @@
|
|
|
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
|
-
/**
|
|
18
|
-
* The two audiences of a tripped form-submission abuse ceiling (AGL-1666).
|
|
19
|
-
*
|
|
20
|
-
* AGL-1655 made the ceiling refuse correctly and bill nothing, but it refused
|
|
21
|
-
* into silence: the visitor got the component's generic "something went
|
|
22
|
-
* wrong" and the site's owner got a Firestore document. This module holds the
|
|
23
|
-
* words both of them see, in one place, because the two are constrained in
|
|
24
|
-
* OPPOSITE directions and a single file is the only way to keep that visible:
|
|
25
|
-
*
|
|
26
|
-
* - The **visitor** is a stranger to the site. They must be told plainly
|
|
27
|
-
* that their message did not arrive, and must NOT be told why — that this
|
|
28
|
-
* site passed an abuse threshold is the owner's business, not a caller's.
|
|
29
|
-
* - The **owner** needs exactly the withheld half: the count, the ceiling,
|
|
30
|
-
* and when it lifts.
|
|
31
|
-
*/
|
|
32
|
-
/**
|
|
33
|
-
* Refusal code carried by the abuse-ceiling 429 (AGL-1655).
|
|
34
|
-
*
|
|
35
|
-
* The Free plan's monthly wall answers 429 too, so the STATUS identifies
|
|
36
|
-
* nothing — this code is the whole discriminator, and one means "the customer
|
|
37
|
-
* needs a bigger plan" while the other means "this site is being flooded".
|
|
38
|
-
* Shared rather than restated so the producer and the consumer cannot drift.
|
|
39
|
-
*/
|
|
40
|
-
export declare const FORM_ABUSE_CEILING_CODE = "form-abuse-ceiling";
|
|
41
|
-
/**
|
|
42
|
-
* The month key both the billable counter and the refusal counter are keyed
|
|
43
|
-
* by. UTC, matching the month boundary the ceiling resets on.
|
|
44
|
-
*/
|
|
45
|
-
export declare function submissionMonthKey(now?: Date): string;
|
|
46
|
-
/** What the visitor is shown when a site's form is not accepting. */
|
|
47
|
-
export interface FormUnavailableNotice {
|
|
48
|
-
/** The whole message. Fixed copy — never the server's terse `error`. */
|
|
49
|
-
message: string;
|
|
50
|
-
/**
|
|
51
|
-
* An alternative way to reach the site, when the site publishes one
|
|
52
|
-
* (`business.supportEmail`, the token whose own description is "where
|
|
53
|
-
* visitors should write for help"). Absent when it does not.
|
|
54
|
-
*/
|
|
55
|
-
contact?: string;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* The visitor's sentence.
|
|
59
|
-
*
|
|
60
|
-
* Three things it must not do, all of which the generic error branch did or
|
|
61
|
-
* a friendlier rewrite would:
|
|
62
|
-
*
|
|
63
|
-
* 1. **Not blame the visitor.** They filled in a form correctly. Nothing
|
|
64
|
-
* about their message, their address or their retry is the reason.
|
|
65
|
-
* 2. **Not explain.** "Unusual volume", "temporarily over its limit", even
|
|
66
|
-
* "this site is receiving too many messages" all tell a stranger
|
|
67
|
-
* something about the site owner's account that the owner never chose to
|
|
68
|
-
* publish. The refusal is the owner's problem to see, not the caller's.
|
|
69
|
-
* 3. **Not sound delivered.** "We'll get back to you", or anything ending
|
|
70
|
-
* in a thank-you, converts a lost lead into a person waiting for a reply
|
|
71
|
-
* that is never coming. So it says, in as many words, that the message
|
|
72
|
-
* was not sent.
|
|
73
|
-
*
|
|
74
|
-
* What is left is short on purpose. The one genuinely useful thing to add is
|
|
75
|
-
* a door that still opens, which is why `contact` rides along.
|
|
76
|
-
*/
|
|
77
|
-
export declare const FORM_UNAVAILABLE_MESSAGE: string;
|
|
78
|
-
/**
|
|
79
|
-
* Does this refused submit mean "this site's form is not accepting", rather
|
|
80
|
-
* than "something broke"?
|
|
81
|
-
*
|
|
82
|
-
* Takes the BODY only, deliberately. The obvious signature — `(status, body)`,
|
|
83
|
-
* matching `parseLockdownRefusal` — invites a caller to gate on the status
|
|
84
|
-
* first, and the status is precisely what does not distinguish this refusal
|
|
85
|
-
* from the Free plan's monthly wall. A caller holding only this function
|
|
86
|
-
* cannot make that mistake.
|
|
87
|
-
*
|
|
88
|
-
* Returns `null` for every other body, so a caller's existing generic error
|
|
89
|
-
* branch keeps handling real failures. Dressing a 500 as a deliberate pause
|
|
90
|
-
* would be the same class of lie in the other direction.
|
|
91
|
-
*/
|
|
92
|
-
export declare function parseFormUnavailableRefusal(body: unknown): FormUnavailableNotice | null;
|
|
93
|
-
/** What the site's owner is shown while their form is paused. */
|
|
94
|
-
export interface FormsPausedOwnerNotice {
|
|
95
|
-
title: string;
|
|
96
|
-
/** What happened, how many, and that none of it is billed. */
|
|
97
|
-
message: string;
|
|
98
|
-
/** When it lifts, as a local-reading sentence — never a raw month key. */
|
|
99
|
-
until: string;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* The moment the ceiling resets: 00:00 UTC on the first of next month, which
|
|
103
|
-
* is the same boundary AGL-1655's `Retry-After` points at and the same one
|
|
104
|
-
* the `YYYY-MM` counter key rolls over on.
|
|
105
|
-
*/
|
|
106
|
-
export declare function formCeilingResetAt(now?: Date): Date;
|
|
107
|
-
/**
|
|
108
|
-
* The honeypot's month, as the one sentence every surface renders (AGL-1831
|
|
109
|
-
* staff chip tooltip, AGL-1836 owner inbox notice).
|
|
110
|
-
*
|
|
111
|
-
* The framing is the point, and it is why the sentence lives here instead of
|
|
112
|
-
* in either component: the count reports the honeypot WORKING — caught and
|
|
113
|
-
* dropped, nothing stored, nothing billed — not something wrong. A surface
|
|
114
|
-
* that restated it could drift into alarm ("N spam attacks!") and train the
|
|
115
|
-
* owner to fear the number that should reassure them. It is also the
|
|
116
|
-
* AGL-1664 revisit input: spam creeping toward ~20% of a paying host's
|
|
117
|
-
* submissions is the trigger for reopening the App Check / CAPTCHA call.
|
|
118
|
-
*
|
|
119
|
-
* Returns `null` below one catch, same rule as `formSubmissionsPausedNotice`
|
|
120
|
-
* and for the same reason — the counter document persists from its first
|
|
121
|
-
* catch forever, and a reassuring zero trains the reader to ignore the row.
|
|
122
|
-
*/
|
|
123
|
-
export declare function formSpamCaughtNotice(input: {
|
|
124
|
-
spam: number;
|
|
125
|
-
}): string | null;
|
|
126
|
-
/**
|
|
127
|
-
* The owner's notice — the half deliberately withheld from the visitor.
|
|
128
|
-
*
|
|
129
|
-
* Shaped like `LockdownRefusalNotice` ({title, message, until}) so the
|
|
130
|
-
* console renders it with the same three lines `LockdownNotice` already
|
|
131
|
-
* establishes for "a thing is blocked, here is why and how it ends". The
|
|
132
|
-
* console surface for a blocked thing should not look different depending on
|
|
133
|
-
* which subsystem blocked it.
|
|
134
|
-
*
|
|
135
|
-
* Returns `null` below one refusal, so a quiet month renders nothing at all
|
|
136
|
-
* rather than a reassuring zero — the counter document exists from the first
|
|
137
|
-
* trip and never goes away, and "0 refused" on every subsequent month is
|
|
138
|
-
* noise that trains the owner to ignore the row that will one day be real.
|
|
139
|
-
*/
|
|
140
|
-
export declare function formSubmissionsPausedNotice(input: {
|
|
141
|
-
/** Refusals recorded for the month being displayed. */
|
|
142
|
-
refused: number;
|
|
143
|
-
/** The site's ceiling, from the counter document. Omitted if unknown. */
|
|
144
|
-
ceiling?: number;
|
|
145
|
-
now?: Date;
|
|
146
|
-
}): FormsPausedOwnerNotice | null;
|
|
@@ -1,158 +0,0 @@
|
|
|
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
|
-
* The two audiences of a tripped form-submission abuse ceiling (AGL-1666).
|
|
19
|
-
*
|
|
20
|
-
* AGL-1655 made the ceiling refuse correctly and bill nothing, but it refused
|
|
21
|
-
* into silence: the visitor got the component's generic "something went
|
|
22
|
-
* wrong" and the site's owner got a Firestore document. This module holds the
|
|
23
|
-
* words both of them see, in one place, because the two are constrained in
|
|
24
|
-
* OPPOSITE directions and a single file is the only way to keep that visible:
|
|
25
|
-
*
|
|
26
|
-
* - The **visitor** is a stranger to the site. They must be told plainly
|
|
27
|
-
* that their message did not arrive, and must NOT be told why — that this
|
|
28
|
-
* site passed an abuse threshold is the owner's business, not a caller's.
|
|
29
|
-
* - The **owner** needs exactly the withheld half: the count, the ceiling,
|
|
30
|
-
* and when it lifts.
|
|
31
|
-
*/ /**
|
|
32
|
-
* Refusal code carried by the abuse-ceiling 429 (AGL-1655).
|
|
33
|
-
*
|
|
34
|
-
* The Free plan's monthly wall answers 429 too, so the STATUS identifies
|
|
35
|
-
* nothing — this code is the whole discriminator, and one means "the customer
|
|
36
|
-
* needs a bigger plan" while the other means "this site is being flooded".
|
|
37
|
-
* Shared rather than restated so the producer and the consumer cannot drift.
|
|
38
|
-
*/ export const FORM_ABUSE_CEILING_CODE = 'form-abuse-ceiling';
|
|
39
|
-
/**
|
|
40
|
-
* The month key both the billable counter and the refusal counter are keyed
|
|
41
|
-
* by. UTC, matching the month boundary the ceiling resets on.
|
|
42
|
-
*/ export function submissionMonthKey(now = new Date()) {
|
|
43
|
-
return now.toISOString().slice(0, 7);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* The visitor's sentence.
|
|
47
|
-
*
|
|
48
|
-
* Three things it must not do, all of which the generic error branch did or
|
|
49
|
-
* a friendlier rewrite would:
|
|
50
|
-
*
|
|
51
|
-
* 1. **Not blame the visitor.** They filled in a form correctly. Nothing
|
|
52
|
-
* about their message, their address or their retry is the reason.
|
|
53
|
-
* 2. **Not explain.** "Unusual volume", "temporarily over its limit", even
|
|
54
|
-
* "this site is receiving too many messages" all tell a stranger
|
|
55
|
-
* something about the site owner's account that the owner never chose to
|
|
56
|
-
* publish. The refusal is the owner's problem to see, not the caller's.
|
|
57
|
-
* 3. **Not sound delivered.** "We'll get back to you", or anything ending
|
|
58
|
-
* in a thank-you, converts a lost lead into a person waiting for a reply
|
|
59
|
-
* that is never coming. So it says, in as many words, that the message
|
|
60
|
-
* was not sent.
|
|
61
|
-
*
|
|
62
|
-
* What is left is short on purpose. The one genuinely useful thing to add is
|
|
63
|
-
* a door that still opens, which is why `contact` rides along.
|
|
64
|
-
*/ export const FORM_UNAVAILABLE_MESSAGE = 'This form isn’t accepting messages right now, so your message was not ' + 'sent. Please try again later.';
|
|
65
|
-
/**
|
|
66
|
-
* A site's published support address is author-written, so it is validated
|
|
67
|
-
* before being rendered as a link rather than trusted. Conservative on
|
|
68
|
-
* purpose: a rejected address costs the visitor a convenience, an accepted
|
|
69
|
-
* junk one costs them a bounced email and the site a lead it never learns it
|
|
70
|
-
* lost. The `mailto:` scheme is written by the renderer, not taken from here,
|
|
71
|
-
* so this is a plausibility check and not the injection defence.
|
|
72
|
-
*/ const CONTACT_EMAIL_PATTERN = /^[^\s@<>"']+@[^\s@<>"'.]+(\.[^\s@<>"'.]+)+$/;
|
|
73
|
-
/**
|
|
74
|
-
* Does this refused submit mean "this site's form is not accepting", rather
|
|
75
|
-
* than "something broke"?
|
|
76
|
-
*
|
|
77
|
-
* Takes the BODY only, deliberately. The obvious signature — `(status, body)`,
|
|
78
|
-
* matching `parseLockdownRefusal` — invites a caller to gate on the status
|
|
79
|
-
* first, and the status is precisely what does not distinguish this refusal
|
|
80
|
-
* from the Free plan's monthly wall. A caller holding only this function
|
|
81
|
-
* cannot make that mistake.
|
|
82
|
-
*
|
|
83
|
-
* Returns `null` for every other body, so a caller's existing generic error
|
|
84
|
-
* branch keeps handling real failures. Dressing a 500 as a deliberate pause
|
|
85
|
-
* would be the same class of lie in the other direction.
|
|
86
|
-
*/ export function parseFormUnavailableRefusal(body) {
|
|
87
|
-
if (!body || typeof body !== 'object') return null;
|
|
88
|
-
const payload = body;
|
|
89
|
-
if (payload.code !== FORM_ABUSE_CEILING_CODE) return null;
|
|
90
|
-
const contact = typeof payload.contact === 'string' && payload.contact.trim() ? payload.contact.trim() : undefined;
|
|
91
|
-
return _extends({
|
|
92
|
-
message: FORM_UNAVAILABLE_MESSAGE
|
|
93
|
-
}, contact && CONTACT_EMAIL_PATTERN.test(contact) ? {
|
|
94
|
-
contact
|
|
95
|
-
} : {});
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* The moment the ceiling resets: 00:00 UTC on the first of next month, which
|
|
99
|
-
* is the same boundary AGL-1655's `Retry-After` points at and the same one
|
|
100
|
-
* the `YYYY-MM` counter key rolls over on.
|
|
101
|
-
*/ export function formCeilingResetAt(now = new Date()) {
|
|
102
|
-
return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth() + 1, 1));
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* The honeypot's month, as the one sentence every surface renders (AGL-1831
|
|
106
|
-
* staff chip tooltip, AGL-1836 owner inbox notice).
|
|
107
|
-
*
|
|
108
|
-
* The framing is the point, and it is why the sentence lives here instead of
|
|
109
|
-
* in either component: the count reports the honeypot WORKING — caught and
|
|
110
|
-
* dropped, nothing stored, nothing billed — not something wrong. A surface
|
|
111
|
-
* that restated it could drift into alarm ("N spam attacks!") and train the
|
|
112
|
-
* owner to fear the number that should reassure them. It is also the
|
|
113
|
-
* AGL-1664 revisit input: spam creeping toward ~20% of a paying host's
|
|
114
|
-
* submissions is the trigger for reopening the App Check / CAPTCHA call.
|
|
115
|
-
*
|
|
116
|
-
* Returns `null` below one catch, same rule as `formSubmissionsPausedNotice`
|
|
117
|
-
* and for the same reason — the counter document persists from its first
|
|
118
|
-
* catch forever, and a reassuring zero trains the reader to ignore the row.
|
|
119
|
-
*/ export function formSpamCaughtNotice(input) {
|
|
120
|
-
const spam = Math.floor(Number(input.spam) || 0);
|
|
121
|
-
if (spam < 1) return null;
|
|
122
|
-
return `${spam.toLocaleString()} bot submission${spam === 1 ? '' : 's'} ` + `${spam === 1 ? 'was' : 'were'} caught and dropped by the honeypot ` + `this month — nothing was stored or billed.`;
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* The owner's notice — the half deliberately withheld from the visitor.
|
|
126
|
-
*
|
|
127
|
-
* Shaped like `LockdownRefusalNotice` ({title, message, until}) so the
|
|
128
|
-
* console renders it with the same three lines `LockdownNotice` already
|
|
129
|
-
* establishes for "a thing is blocked, here is why and how it ends". The
|
|
130
|
-
* console surface for a blocked thing should not look different depending on
|
|
131
|
-
* which subsystem blocked it.
|
|
132
|
-
*
|
|
133
|
-
* Returns `null` below one refusal, so a quiet month renders nothing at all
|
|
134
|
-
* rather than a reassuring zero — the counter document exists from the first
|
|
135
|
-
* trip and never goes away, and "0 refused" on every subsequent month is
|
|
136
|
-
* noise that trains the owner to ignore the row that will one day be real.
|
|
137
|
-
*/ export function formSubmissionsPausedNotice(input) {
|
|
138
|
-
var _input_now;
|
|
139
|
-
const refused = Math.floor(Number(input.refused) || 0);
|
|
140
|
-
if (refused < 1) return null;
|
|
141
|
-
const now = (_input_now = input.now) != null ? _input_now : new Date();
|
|
142
|
-
const ceiling = typeof input.ceiling === 'number' && Number.isFinite(input.ceiling) ? Math.floor(input.ceiling) : undefined;
|
|
143
|
-
const reset = formCeilingResetAt(now).toLocaleDateString(undefined, {
|
|
144
|
-
year: 'numeric',
|
|
145
|
-
month: 'long',
|
|
146
|
-
day: 'numeric',
|
|
147
|
-
// The boundary is a UTC instant; rendering it in the reader's zone would
|
|
148
|
-
// move a 1 September reset to 31 August for most of the Americas.
|
|
149
|
-
timeZone: 'UTC'
|
|
150
|
-
});
|
|
151
|
-
return {
|
|
152
|
-
title: 'Form submissions are paused',
|
|
153
|
-
message: `${refused.toLocaleString()} submission${refused === 1 ? '' : 's'} ` + `to this site ${refused === 1 ? 'has' : 'have'} been refused this month` + (ceiling ? ` after it passed ${ceiling.toLocaleString()} submissions` : '') + '. Refused submissions are not stored and are not billed. This ' + 'usually means a bot is filling in one of your forms — if it is real ' + 'traffic, contact support and we will raise the limit.',
|
|
154
|
-
until: `Submissions start being accepted again on ${reset}.`
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
//# sourceMappingURL=form-abuse-ceiling.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/app-utils/form-abuse-ceiling.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 two audiences of a tripped form-submission abuse ceiling (AGL-1666).\n *\n * AGL-1655 made the ceiling refuse correctly and bill nothing, but it refused\n * into silence: the visitor got the component's generic \"something went\n * wrong\" and the site's owner got a Firestore document. This module holds the\n * words both of them see, in one place, because the two are constrained in\n * OPPOSITE directions and a single file is the only way to keep that visible:\n *\n * - The **visitor** is a stranger to the site. They must be told plainly\n * that their message did not arrive, and must NOT be told why — that this\n * site passed an abuse threshold is the owner's business, not a caller's.\n * - The **owner** needs exactly the withheld half: the count, the ceiling,\n * and when it lifts.\n */\n\n/**\n * Refusal code carried by the abuse-ceiling 429 (AGL-1655).\n *\n * The Free plan's monthly wall answers 429 too, so the STATUS identifies\n * nothing — this code is the whole discriminator, and one means \"the customer\n * needs a bigger plan\" while the other means \"this site is being flooded\".\n * Shared rather than restated so the producer and the consumer cannot drift.\n */\nexport const FORM_ABUSE_CEILING_CODE = 'form-abuse-ceiling'\n\n/**\n * The month key both the billable counter and the refusal counter are keyed\n * by. UTC, matching the month boundary the ceiling resets on.\n */\nexport function submissionMonthKey(now: Date = new Date()): string {\n return now.toISOString().slice(0, 7)\n}\n\n/** What the visitor is shown when a site's form is not accepting. */\nexport interface FormUnavailableNotice {\n /** The whole message. Fixed copy — never the server's terse `error`. */\n message: string\n /**\n * An alternative way to reach the site, when the site publishes one\n * (`business.supportEmail`, the token whose own description is \"where\n * visitors should write for help\"). Absent when it does not.\n */\n contact?: string\n}\n\n/**\n * The visitor's sentence.\n *\n * Three things it must not do, all of which the generic error branch did or\n * a friendlier rewrite would:\n *\n * 1. **Not blame the visitor.** They filled in a form correctly. Nothing\n * about their message, their address or their retry is the reason.\n * 2. **Not explain.** \"Unusual volume\", \"temporarily over its limit\", even\n * \"this site is receiving too many messages\" all tell a stranger\n * something about the site owner's account that the owner never chose to\n * publish. The refusal is the owner's problem to see, not the caller's.\n * 3. **Not sound delivered.** \"We'll get back to you\", or anything ending\n * in a thank-you, converts a lost lead into a person waiting for a reply\n * that is never coming. So it says, in as many words, that the message\n * was not sent.\n *\n * What is left is short on purpose. The one genuinely useful thing to add is\n * a door that still opens, which is why `contact` rides along.\n */\nexport const FORM_UNAVAILABLE_MESSAGE =\n 'This form isn’t accepting messages right now, so your message was not ' +\n 'sent. Please try again later.'\n\n/**\n * A site's published support address is author-written, so it is validated\n * before being rendered as a link rather than trusted. Conservative on\n * purpose: a rejected address costs the visitor a convenience, an accepted\n * junk one costs them a bounced email and the site a lead it never learns it\n * lost. The `mailto:` scheme is written by the renderer, not taken from here,\n * so this is a plausibility check and not the injection defence.\n */\nconst CONTACT_EMAIL_PATTERN = /^[^\\s@<>\"']+@[^\\s@<>\"'.]+(\\.[^\\s@<>\"'.]+)+$/\n\n/**\n * Does this refused submit mean \"this site's form is not accepting\", rather\n * than \"something broke\"?\n *\n * Takes the BODY only, deliberately. The obvious signature — `(status, body)`,\n * matching `parseLockdownRefusal` — invites a caller to gate on the status\n * first, and the status is precisely what does not distinguish this refusal\n * from the Free plan's monthly wall. A caller holding only this function\n * cannot make that mistake.\n *\n * Returns `null` for every other body, so a caller's existing generic error\n * branch keeps handling real failures. Dressing a 500 as a deliberate pause\n * would be the same class of lie in the other direction.\n */\nexport function parseFormUnavailableRefusal(\n body: unknown,\n): FormUnavailableNotice | null {\n if (!body || typeof body !== 'object') return null\n const payload = body as { code?: unknown; contact?: unknown }\n if (payload.code !== FORM_ABUSE_CEILING_CODE) return null\n const contact =\n typeof payload.contact === 'string' && payload.contact.trim()\n ? payload.contact.trim()\n : undefined\n return {\n message: FORM_UNAVAILABLE_MESSAGE,\n ...(contact && CONTACT_EMAIL_PATTERN.test(contact) ? { contact } : {}),\n }\n}\n\n/** What the site's owner is shown while their form is paused. */\nexport interface FormsPausedOwnerNotice {\n title: string\n /** What happened, how many, and that none of it is billed. */\n message: string\n /** When it lifts, as a local-reading sentence — never a raw month key. */\n until: string\n}\n\n/**\n * The moment the ceiling resets: 00:00 UTC on the first of next month, which\n * is the same boundary AGL-1655's `Retry-After` points at and the same one\n * the `YYYY-MM` counter key rolls over on.\n */\nexport function formCeilingResetAt(now: Date = new Date()): Date {\n return new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth() + 1, 1))\n}\n\n/**\n * The honeypot's month, as the one sentence every surface renders (AGL-1831\n * staff chip tooltip, AGL-1836 owner inbox notice).\n *\n * The framing is the point, and it is why the sentence lives here instead of\n * in either component: the count reports the honeypot WORKING — caught and\n * dropped, nothing stored, nothing billed — not something wrong. A surface\n * that restated it could drift into alarm (\"N spam attacks!\") and train the\n * owner to fear the number that should reassure them. It is also the\n * AGL-1664 revisit input: spam creeping toward ~20% of a paying host's\n * submissions is the trigger for reopening the App Check / CAPTCHA call.\n *\n * Returns `null` below one catch, same rule as `formSubmissionsPausedNotice`\n * and for the same reason — the counter document persists from its first\n * catch forever, and a reassuring zero trains the reader to ignore the row.\n */\nexport function formSpamCaughtNotice(input: { spam: number }): string | null {\n const spam = Math.floor(Number(input.spam) || 0)\n if (spam < 1) return null\n return (\n `${spam.toLocaleString()} bot submission${spam === 1 ? '' : 's'} ` +\n `${spam === 1 ? 'was' : 'were'} caught and dropped by the honeypot ` +\n `this month — nothing was stored or billed.`\n )\n}\n\n/**\n * The owner's notice — the half deliberately withheld from the visitor.\n *\n * Shaped like `LockdownRefusalNotice` ({title, message, until}) so the\n * console renders it with the same three lines `LockdownNotice` already\n * establishes for \"a thing is blocked, here is why and how it ends\". The\n * console surface for a blocked thing should not look different depending on\n * which subsystem blocked it.\n *\n * Returns `null` below one refusal, so a quiet month renders nothing at all\n * rather than a reassuring zero — the counter document exists from the first\n * trip and never goes away, and \"0 refused\" on every subsequent month is\n * noise that trains the owner to ignore the row that will one day be real.\n */\nexport function formSubmissionsPausedNotice(input: {\n /** Refusals recorded for the month being displayed. */\n refused: number\n /** The site's ceiling, from the counter document. Omitted if unknown. */\n ceiling?: number\n now?: Date\n}): FormsPausedOwnerNotice | null {\n const refused = Math.floor(Number(input.refused) || 0)\n if (refused < 1) return null\n const now = input.now ?? new Date()\n const ceiling =\n typeof input.ceiling === 'number' && Number.isFinite(input.ceiling)\n ? Math.floor(input.ceiling)\n : undefined\n const reset = formCeilingResetAt(now).toLocaleDateString(undefined, {\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n // The boundary is a UTC instant; rendering it in the reader's zone would\n // move a 1 September reset to 31 August for most of the Americas.\n timeZone: 'UTC',\n })\n return {\n title: 'Form submissions are paused',\n message:\n `${refused.toLocaleString()} submission${refused === 1 ? '' : 's'} ` +\n `to this site ${refused === 1 ? 'has' : 'have'} been refused this month` +\n (ceiling\n ? ` after it passed ${ceiling.toLocaleString()} submissions`\n : '') +\n '. Refused submissions are not stored and are not billed. This ' +\n 'usually means a bot is filling in one of your forms — if it is real ' +\n 'traffic, contact support and we will raise the limit.',\n until: `Submissions start being accepted again on ${reset}.`,\n }\n}\n"],"names":["FORM_ABUSE_CEILING_CODE","submissionMonthKey","now","Date","toISOString","slice","FORM_UNAVAILABLE_MESSAGE","CONTACT_EMAIL_PATTERN","parseFormUnavailableRefusal","body","payload","code","contact","trim","undefined","message","test","formCeilingResetAt","UTC","getUTCFullYear","getUTCMonth","formSpamCaughtNotice","input","spam","Math","floor","Number","toLocaleString","formSubmissionsPausedNotice","refused","ceiling","isFinite","reset","toLocaleDateString","year","month","day","timeZone","title","until"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;CAcC,GAED;;;;;;;CAOC,GACD,OAAO,MAAMA,0BAA0B,qBAAoB;AAE3D;;;CAGC,GACD,OAAO,SAASC,mBAAmBC,MAAY,IAAIC,MAAM;IACvD,OAAOD,IAAIE,WAAW,GAAGC,KAAK,CAAC,GAAG;AACpC;AAcA;;;;;;;;;;;;;;;;;;;CAmBC,GACD,OAAO,MAAMC,2BACX,2EACA,gCAA+B;AAEjC;;;;;;;CAOC,GACD,MAAMC,wBAAwB;AAE9B;;;;;;;;;;;;;CAaC,GACD,OAAO,SAASC,4BACdC,IAAa;IAEb,IAAI,CAACA,QAAQ,OAAOA,SAAS,UAAU,OAAO;IAC9C,MAAMC,UAAUD;IAChB,IAAIC,QAAQC,IAAI,KAAKX,yBAAyB,OAAO;IACrD,MAAMY,UACJ,OAAOF,QAAQE,OAAO,KAAK,YAAYF,QAAQE,OAAO,CAACC,IAAI,KACvDH,QAAQE,OAAO,CAACC,IAAI,KACpBC;IACN,OAAO;QACLC,SAAST;OACLM,WAAWL,sBAAsBS,IAAI,CAACJ,WAAW;QAAEA;IAAQ,IAAI,CAAC;AAExE;AAWA;;;;CAIC,GACD,OAAO,SAASK,mBAAmBf,MAAY,IAAIC,MAAM;IACvD,OAAO,IAAIA,KAAKA,KAAKe,GAAG,CAAChB,IAAIiB,cAAc,IAAIjB,IAAIkB,WAAW,KAAK,GAAG;AACxE;AAEA;;;;;;;;;;;;;;;CAeC,GACD,OAAO,SAASC,qBAAqBC,KAAuB;IAC1D,MAAMC,OAAOC,KAAKC,KAAK,CAACC,OAAOJ,MAAMC,IAAI,KAAK;IAC9C,IAAIA,OAAO,GAAG,OAAO;IACrB,OACE,GAAGA,KAAKI,cAAc,GAAG,eAAe,EAAEJ,SAAS,IAAI,KAAK,IAAI,CAAC,CAAC,GAClE,GAAGA,SAAS,IAAI,QAAQ,OAAO,oCAAoC,CAAC,GACpE,CAAC,0CAA0C,CAAC;AAEhD;AAEA;;;;;;;;;;;;;CAaC,GACD,OAAO,SAASK,4BAA4BN,KAM3C;QAGaA;IAFZ,MAAMO,UAAUL,KAAKC,KAAK,CAACC,OAAOJ,MAAMO,OAAO,KAAK;IACpD,IAAIA,UAAU,GAAG,OAAO;IACxB,MAAM3B,OAAMoB,aAAAA,MAAMpB,GAAG,YAAToB,aAAa,IAAInB;IAC7B,MAAM2B,UACJ,OAAOR,MAAMQ,OAAO,KAAK,YAAYJ,OAAOK,QAAQ,CAACT,MAAMQ,OAAO,IAC9DN,KAAKC,KAAK,CAACH,MAAMQ,OAAO,IACxBhB;IACN,MAAMkB,QAAQf,mBAAmBf,KAAK+B,kBAAkB,CAACnB,WAAW;QAClEoB,MAAM;QACNC,OAAO;QACPC,KAAK;QACL,yEAAyE;QACzE,kEAAkE;QAClEC,UAAU;IACZ;IACA,OAAO;QACLC,OAAO;QACPvB,SACE,GAAGc,QAAQF,cAAc,GAAG,WAAW,EAAEE,YAAY,IAAI,KAAK,IAAI,CAAC,CAAC,GACpE,CAAC,aAAa,EAAEA,YAAY,IAAI,QAAQ,OAAO,wBAAwB,CAAC,GACvEC,CAAAA,UACG,CAAC,iBAAiB,EAAEA,QAAQH,cAAc,GAAG,YAAY,CAAC,GAC1D,EAAC,IACL,mEACA,yEACA;QACFY,OAAO,CAAC,0CAA0C,EAAEP,MAAM,CAAC,CAAC;IAC9D;AACF"}
|
|
@@ -1,142 +0,0 @@
|
|
|
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
|
-
/**
|
|
18
|
-
* The order-fulfilment capability (AGL-2461) — how a HOST APP records a
|
|
19
|
-
* shipment without importing the plugin that owns order semantics.
|
|
20
|
-
*
|
|
21
|
-
* ## Why this registry exists at all
|
|
22
|
-
*
|
|
23
|
-
* `eslint.config.mjs`'s `scope:app` → `notDependOnLibsWithTags:['aglyn:addons']`
|
|
24
|
-
* rule means `apps/console` may not import `@aglyn/plugins-commerce`, so the
|
|
25
|
-
* customer REST API could not reach `ORDER_TRANSITIONS`, `canTransitionOrder`,
|
|
26
|
-
* `liftLegacyOrder` or `appendOrderEvent` — and therefore could not record a
|
|
27
|
-
* shipment at all. The rule is not a preference: the app must stay runnable
|
|
28
|
-
* with any plugin absent, which is the whole plugin platform (AGL-417/419).
|
|
29
|
-
*
|
|
30
|
-
* The tempting escape is a second copy of the transition table inside `/v1`.
|
|
31
|
-
* That is the wrong one, and much worse than the projection drift `orderView`
|
|
32
|
-
* already tolerates: two transition tables drifting means **the API writes an
|
|
33
|
-
* order status the console forbids** — `paid → delivered` skipping fulfilment,
|
|
34
|
-
* or a write onto a `refunded` order — which is precisely the class of bug
|
|
35
|
-
* AGL-1818/AGL-1819 were opened to close.
|
|
36
|
-
*
|
|
37
|
-
* So the edge runs the way every other app↔plugin edge on this platform runs:
|
|
38
|
-
* the plugin registers an implementation into a core registry from its
|
|
39
|
-
* `/server` entry, and the app looks it up. Same shape as
|
|
40
|
-
* `registerBillingWebhookHandler`, `registerSitePageResolver` and
|
|
41
|
-
* `registerPluginJob`. Nothing is imported statically in either direction, the
|
|
42
|
-
* app compiles and boots with commerce absent, and there is exactly ONE
|
|
43
|
-
* implementation of the transition rule — the plugin's.
|
|
44
|
-
*
|
|
45
|
-
* ## THE REGISTRY CARRIES NO AUTHORIZATION. READ THIS BEFORE CALLING.
|
|
46
|
-
*
|
|
47
|
-
* `recordShipment` is a PRE-AUTHORIZED domain operation. It answers "may this
|
|
48
|
-
* order move to this status" (the transition rule, re-asked inside the write)
|
|
49
|
-
* and nothing whatsoever about "may this caller touch this order". It does not
|
|
50
|
-
* know who is asking — deliberately, because its two callers authenticate
|
|
51
|
-
* completely differently: the console's `commerce/fulfill-order` route
|
|
52
|
-
* verifies a Firebase ID token and reads `memberRoles[uid]`, while a `/v1`
|
|
53
|
-
* API key is an ORG credential with no uid at all.
|
|
54
|
-
*
|
|
55
|
-
* Every caller MUST therefore have already established, in its own terms:
|
|
56
|
-
*
|
|
57
|
-
* 1. **who the caller is** (session, or key), and
|
|
58
|
-
* 2. **that the caller's org owns `hostId`** — the org-scoping check, without
|
|
59
|
-
* which this becomes a cross-tenant write primitive addressable by any
|
|
60
|
-
* authenticated caller who can guess a host id, and
|
|
61
|
-
* 3. **that the plugin owning this service is switched on for that site**
|
|
62
|
-
* (`isHostPluginEnabled`) — the registry is process-global and populated by
|
|
63
|
-
* `ensureAll`, so a registered service says nothing about one org's
|
|
64
|
-
* configuration.
|
|
65
|
-
*
|
|
66
|
-
* A single implementation is held, not a list: this is a capability with an
|
|
67
|
-
* owner, not a fan-out hook. Two plugins claiming order fulfilment is a
|
|
68
|
-
* misconfiguration, and last-registration-wins would resolve it silently, so
|
|
69
|
-
* {@link registerOrderFulfilmentService} refuses the second registration
|
|
70
|
-
* loudly instead.
|
|
71
|
-
*/
|
|
72
|
-
/**
|
|
73
|
-
* The two fulfilment-side transitions, and ONLY those.
|
|
74
|
-
*
|
|
75
|
-
* `cancelled` releases stock under its own transaction and `refunded` moves
|
|
76
|
-
* money under another, so neither belongs to a capability whose contract is
|
|
77
|
-
* "a forward status flip plus a timeline entry, no stock moved, no money
|
|
78
|
-
* moved". Widening this union is how a caller gets a door around the
|
|
79
|
-
* specifics those routes exist to enforce — the type is the door being shut.
|
|
80
|
-
*/
|
|
81
|
-
export type OrderFulfilmentTarget = 'fulfilled' | 'delivered';
|
|
82
|
-
export interface RecordShipmentRequest {
|
|
83
|
-
/** Site that owns the order. The CALLER has already proven ownership. */
|
|
84
|
-
hostId: string;
|
|
85
|
-
orderId: string;
|
|
86
|
-
to: OrderFulfilmentTarget;
|
|
87
|
-
/** Free text, e.g. `'UPS'`. Implementations bound the length. */
|
|
88
|
-
carrier?: string;
|
|
89
|
-
trackingNumber?: string;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* What happened, as a domain fact rather than an HTTP status — each caller
|
|
93
|
-
* maps it into its own error vocabulary (the console route into its JSON
|
|
94
|
-
* shape, `/v1` into the published error envelope), because those two
|
|
95
|
-
* vocabularies are contracts with different audiences and neither may leak
|
|
96
|
-
* into the other.
|
|
97
|
-
*
|
|
98
|
-
* `already` is a SUCCESS and is distinct from `recorded` on purpose: a retried
|
|
99
|
-
* request finds the order in the target status and returns without writing, so
|
|
100
|
-
* a lost response can never append a second copy of the same shipment. A
|
|
101
|
-
* caller that folded the two together would still be correct about the state
|
|
102
|
-
* and would lose the only signal that says "this was your retry".
|
|
103
|
-
*/
|
|
104
|
-
export type RecordShipmentOutcome = {
|
|
105
|
-
outcome: 'recorded';
|
|
106
|
-
} | {
|
|
107
|
-
outcome: 'already';
|
|
108
|
-
} | {
|
|
109
|
-
outcome: 'no_such_order';
|
|
110
|
-
}
|
|
111
|
-
/** The transition rule refused. `from` is the status that refused it. */
|
|
112
|
-
| {
|
|
113
|
-
outcome: 'blocked';
|
|
114
|
-
from: string;
|
|
115
|
-
};
|
|
116
|
-
export interface OrderFulfilmentService {
|
|
117
|
-
/**
|
|
118
|
-
* The plugin that owns this capability. Callers gate on THIS — never on a
|
|
119
|
-
* hard-coded `'commerce'` — which is what keeps the app free of any name
|
|
120
|
-
* from the addon layer.
|
|
121
|
-
*/
|
|
122
|
-
pluginId: string;
|
|
123
|
-
recordShipment(request: RecordShipmentRequest): Promise<RecordShipmentOutcome>;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Registers the platform's order-fulfilment implementation, from a plugin's
|
|
127
|
-
* `/server` entry. Idempotent for the SAME plugin (the loader guarantees one
|
|
128
|
-
* activation per plugin+surface, but a re-registration must not be an error in
|
|
129
|
-
* a process that loads a surface twice); a DIFFERENT plugin claiming the
|
|
130
|
-
* capability throws, because silently overwriting it would hand order writes
|
|
131
|
-
* to whichever module happened to load last.
|
|
132
|
-
*/
|
|
133
|
-
export declare function registerOrderFulfilmentService(next: OrderFulfilmentService): void;
|
|
134
|
-
/**
|
|
135
|
-
* The registered service, or `null` when no loaded plugin provides one — a
|
|
136
|
-
* deployment with commerce switched off, or a self-host build without it.
|
|
137
|
-
* `null` is an ordinary answer, never an error: callers turn it into "this
|
|
138
|
-
* endpoint does not exist here", which is the truth.
|
|
139
|
-
*/
|
|
140
|
-
export declare function getOrderFulfilmentService(): OrderFulfilmentService | null;
|
|
141
|
-
/** Test seam: forget the registration. */
|
|
142
|
-
export declare function resetOrderFulfilmentServiceForTests(): void;
|
|
@@ -1,104 +0,0 @@
|
|
|
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
|
-
* The order-fulfilment capability (AGL-2461) — how a HOST APP records a
|
|
18
|
-
* shipment without importing the plugin that owns order semantics.
|
|
19
|
-
*
|
|
20
|
-
* ## Why this registry exists at all
|
|
21
|
-
*
|
|
22
|
-
* `eslint.config.mjs`'s `scope:app` → `notDependOnLibsWithTags:['aglyn:addons']`
|
|
23
|
-
* rule means `apps/console` may not import `@aglyn/plugins-commerce`, so the
|
|
24
|
-
* customer REST API could not reach `ORDER_TRANSITIONS`, `canTransitionOrder`,
|
|
25
|
-
* `liftLegacyOrder` or `appendOrderEvent` — and therefore could not record a
|
|
26
|
-
* shipment at all. The rule is not a preference: the app must stay runnable
|
|
27
|
-
* with any plugin absent, which is the whole plugin platform (AGL-417/419).
|
|
28
|
-
*
|
|
29
|
-
* The tempting escape is a second copy of the transition table inside `/v1`.
|
|
30
|
-
* That is the wrong one, and much worse than the projection drift `orderView`
|
|
31
|
-
* already tolerates: two transition tables drifting means **the API writes an
|
|
32
|
-
* order status the console forbids** — `paid → delivered` skipping fulfilment,
|
|
33
|
-
* or a write onto a `refunded` order — which is precisely the class of bug
|
|
34
|
-
* AGL-1818/AGL-1819 were opened to close.
|
|
35
|
-
*
|
|
36
|
-
* So the edge runs the way every other app↔plugin edge on this platform runs:
|
|
37
|
-
* the plugin registers an implementation into a core registry from its
|
|
38
|
-
* `/server` entry, and the app looks it up. Same shape as
|
|
39
|
-
* `registerBillingWebhookHandler`, `registerSitePageResolver` and
|
|
40
|
-
* `registerPluginJob`. Nothing is imported statically in either direction, the
|
|
41
|
-
* app compiles and boots with commerce absent, and there is exactly ONE
|
|
42
|
-
* implementation of the transition rule — the plugin's.
|
|
43
|
-
*
|
|
44
|
-
* ## THE REGISTRY CARRIES NO AUTHORIZATION. READ THIS BEFORE CALLING.
|
|
45
|
-
*
|
|
46
|
-
* `recordShipment` is a PRE-AUTHORIZED domain operation. It answers "may this
|
|
47
|
-
* order move to this status" (the transition rule, re-asked inside the write)
|
|
48
|
-
* and nothing whatsoever about "may this caller touch this order". It does not
|
|
49
|
-
* know who is asking — deliberately, because its two callers authenticate
|
|
50
|
-
* completely differently: the console's `commerce/fulfill-order` route
|
|
51
|
-
* verifies a Firebase ID token and reads `memberRoles[uid]`, while a `/v1`
|
|
52
|
-
* API key is an ORG credential with no uid at all.
|
|
53
|
-
*
|
|
54
|
-
* Every caller MUST therefore have already established, in its own terms:
|
|
55
|
-
*
|
|
56
|
-
* 1. **who the caller is** (session, or key), and
|
|
57
|
-
* 2. **that the caller's org owns `hostId`** — the org-scoping check, without
|
|
58
|
-
* which this becomes a cross-tenant write primitive addressable by any
|
|
59
|
-
* authenticated caller who can guess a host id, and
|
|
60
|
-
* 3. **that the plugin owning this service is switched on for that site**
|
|
61
|
-
* (`isHostPluginEnabled`) — the registry is process-global and populated by
|
|
62
|
-
* `ensureAll`, so a registered service says nothing about one org's
|
|
63
|
-
* configuration.
|
|
64
|
-
*
|
|
65
|
-
* A single implementation is held, not a list: this is a capability with an
|
|
66
|
-
* owner, not a fan-out hook. Two plugins claiming order fulfilment is a
|
|
67
|
-
* misconfiguration, and last-registration-wins would resolve it silently, so
|
|
68
|
-
* {@link registerOrderFulfilmentService} refuses the second registration
|
|
69
|
-
* loudly instead.
|
|
70
|
-
*/ /**
|
|
71
|
-
* The two fulfilment-side transitions, and ONLY those.
|
|
72
|
-
*
|
|
73
|
-
* `cancelled` releases stock under its own transaction and `refunded` moves
|
|
74
|
-
* money under another, so neither belongs to a capability whose contract is
|
|
75
|
-
* "a forward status flip plus a timeline entry, no stock moved, no money
|
|
76
|
-
* moved". Widening this union is how a caller gets a door around the
|
|
77
|
-
* specifics those routes exist to enforce — the type is the door being shut.
|
|
78
|
-
*/ let service = null;
|
|
79
|
-
/**
|
|
80
|
-
* Registers the platform's order-fulfilment implementation, from a plugin's
|
|
81
|
-
* `/server` entry. Idempotent for the SAME plugin (the loader guarantees one
|
|
82
|
-
* activation per plugin+surface, but a re-registration must not be an error in
|
|
83
|
-
* a process that loads a surface twice); a DIFFERENT plugin claiming the
|
|
84
|
-
* capability throws, because silently overwriting it would hand order writes
|
|
85
|
-
* to whichever module happened to load last.
|
|
86
|
-
*/ export function registerOrderFulfilmentService(next) {
|
|
87
|
-
if (service && service.pluginId !== next.pluginId) {
|
|
88
|
-
throw new Error(`Order fulfilment is already provided by "${service.pluginId}"; ` + `"${next.pluginId}" cannot also claim it`);
|
|
89
|
-
}
|
|
90
|
-
service = next;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* The registered service, or `null` when no loaded plugin provides one — a
|
|
94
|
-
* deployment with commerce switched off, or a self-host build without it.
|
|
95
|
-
* `null` is an ordinary answer, never an error: callers turn it into "this
|
|
96
|
-
* endpoint does not exist here", which is the truth.
|
|
97
|
-
*/ export function getOrderFulfilmentService() {
|
|
98
|
-
return service;
|
|
99
|
-
}
|
|
100
|
-
/** Test seam: forget the registration. */ export function resetOrderFulfilmentServiceForTests() {
|
|
101
|
-
service = null;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
//# sourceMappingURL=order-fulfilment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/aglyn/src/lib/plugin-manager/order-fulfilment.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 order-fulfilment capability (AGL-2461) — how a HOST APP records a\n * shipment without importing the plugin that owns order semantics.\n *\n * ## Why this registry exists at all\n *\n * `eslint.config.mjs`'s `scope:app` → `notDependOnLibsWithTags:['aglyn:addons']`\n * rule means `apps/console` may not import `@aglyn/plugins-commerce`, so the\n * customer REST API could not reach `ORDER_TRANSITIONS`, `canTransitionOrder`,\n * `liftLegacyOrder` or `appendOrderEvent` — and therefore could not record a\n * shipment at all. The rule is not a preference: the app must stay runnable\n * with any plugin absent, which is the whole plugin platform (AGL-417/419).\n *\n * The tempting escape is a second copy of the transition table inside `/v1`.\n * That is the wrong one, and much worse than the projection drift `orderView`\n * already tolerates: two transition tables drifting means **the API writes an\n * order status the console forbids** — `paid → delivered` skipping fulfilment,\n * or a write onto a `refunded` order — which is precisely the class of bug\n * AGL-1818/AGL-1819 were opened to close.\n *\n * So the edge runs the way every other app↔plugin edge on this platform runs:\n * the plugin registers an implementation into a core registry from its\n * `/server` entry, and the app looks it up. Same shape as\n * `registerBillingWebhookHandler`, `registerSitePageResolver` and\n * `registerPluginJob`. Nothing is imported statically in either direction, the\n * app compiles and boots with commerce absent, and there is exactly ONE\n * implementation of the transition rule — the plugin's.\n *\n * ## THE REGISTRY CARRIES NO AUTHORIZATION. READ THIS BEFORE CALLING.\n *\n * `recordShipment` is a PRE-AUTHORIZED domain operation. It answers \"may this\n * order move to this status\" (the transition rule, re-asked inside the write)\n * and nothing whatsoever about \"may this caller touch this order\". It does not\n * know who is asking — deliberately, because its two callers authenticate\n * completely differently: the console's `commerce/fulfill-order` route\n * verifies a Firebase ID token and reads `memberRoles[uid]`, while a `/v1`\n * API key is an ORG credential with no uid at all.\n *\n * Every caller MUST therefore have already established, in its own terms:\n *\n * 1. **who the caller is** (session, or key), and\n * 2. **that the caller's org owns `hostId`** — the org-scoping check, without\n * which this becomes a cross-tenant write primitive addressable by any\n * authenticated caller who can guess a host id, and\n * 3. **that the plugin owning this service is switched on for that site**\n * (`isHostPluginEnabled`) — the registry is process-global and populated by\n * `ensureAll`, so a registered service says nothing about one org's\n * configuration.\n *\n * A single implementation is held, not a list: this is a capability with an\n * owner, not a fan-out hook. Two plugins claiming order fulfilment is a\n * misconfiguration, and last-registration-wins would resolve it silently, so\n * {@link registerOrderFulfilmentService} refuses the second registration\n * loudly instead.\n */\n\n/**\n * The two fulfilment-side transitions, and ONLY those.\n *\n * `cancelled` releases stock under its own transaction and `refunded` moves\n * money under another, so neither belongs to a capability whose contract is\n * \"a forward status flip plus a timeline entry, no stock moved, no money\n * moved\". Widening this union is how a caller gets a door around the\n * specifics those routes exist to enforce — the type is the door being shut.\n */\nexport type OrderFulfilmentTarget = 'fulfilled' | 'delivered'\n\nexport interface RecordShipmentRequest {\n /** Site that owns the order. The CALLER has already proven ownership. */\n hostId: string\n orderId: string\n to: OrderFulfilmentTarget\n /** Free text, e.g. `'UPS'`. Implementations bound the length. */\n carrier?: string\n trackingNumber?: string\n}\n\n/**\n * What happened, as a domain fact rather than an HTTP status — each caller\n * maps it into its own error vocabulary (the console route into its JSON\n * shape, `/v1` into the published error envelope), because those two\n * vocabularies are contracts with different audiences and neither may leak\n * into the other.\n *\n * `already` is a SUCCESS and is distinct from `recorded` on purpose: a retried\n * request finds the order in the target status and returns without writing, so\n * a lost response can never append a second copy of the same shipment. A\n * caller that folded the two together would still be correct about the state\n * and would lose the only signal that says \"this was your retry\".\n */\nexport type RecordShipmentOutcome =\n | { outcome: 'recorded' }\n | { outcome: 'already' }\n | { outcome: 'no_such_order' }\n /** The transition rule refused. `from` is the status that refused it. */\n | { outcome: 'blocked'; from: string }\n\nexport interface OrderFulfilmentService {\n /**\n * The plugin that owns this capability. Callers gate on THIS — never on a\n * hard-coded `'commerce'` — which is what keeps the app free of any name\n * from the addon layer.\n */\n pluginId: string\n recordShipment(request: RecordShipmentRequest): Promise<RecordShipmentOutcome>\n}\n\nlet service: OrderFulfilmentService | null = null\n\n/**\n * Registers the platform's order-fulfilment implementation, from a plugin's\n * `/server` entry. Idempotent for the SAME plugin (the loader guarantees one\n * activation per plugin+surface, but a re-registration must not be an error in\n * a process that loads a surface twice); a DIFFERENT plugin claiming the\n * capability throws, because silently overwriting it would hand order writes\n * to whichever module happened to load last.\n */\nexport function registerOrderFulfilmentService(\n next: OrderFulfilmentService,\n): void {\n if (service && service.pluginId !== next.pluginId) {\n throw new Error(\n `Order fulfilment is already provided by \"${service.pluginId}\"; ` +\n `\"${next.pluginId}\" cannot also claim it`,\n )\n }\n service = next\n}\n\n/**\n * The registered service, or `null` when no loaded plugin provides one — a\n * deployment with commerce switched off, or a self-host build without it.\n * `null` is an ordinary answer, never an error: callers turn it into \"this\n * endpoint does not exist here\", which is the truth.\n */\nexport function getOrderFulfilmentService(): OrderFulfilmentService | null {\n return service\n}\n\n/** Test seam: forget the registration. */\nexport function resetOrderFulfilmentServiceForTests(): void {\n service = null\n}\n"],"names":["service","registerOrderFulfilmentService","next","pluginId","Error","getOrderFulfilmentService","resetOrderFulfilmentServiceForTests"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDC,GAED;;;;;;;;CAQC,GA2CD,IAAIA,UAAyC;AAE7C;;;;;;;CAOC,GACD,OAAO,SAASC,+BACdC,IAA4B;IAE5B,IAAIF,WAAWA,QAAQG,QAAQ,KAAKD,KAAKC,QAAQ,EAAE;QACjD,MAAM,IAAIC,MACR,CAAC,yCAAyC,EAAEJ,QAAQG,QAAQ,CAAC,GAAG,CAAC,GAC/D,CAAC,CAAC,EAAED,KAAKC,QAAQ,CAAC,sBAAsB,CAAC;IAE/C;IACAH,UAAUE;AACZ;AAEA;;;;;CAKC,GACD,OAAO,SAASG;IACd,OAAOL;AACT;AAEA,wCAAwC,GACxC,OAAO,SAASM;IACdN,UAAU;AACZ"}
|