create-freeholder 0.0.0-bootstrap.0 → 0.2.0-beta.2
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/README.md +30 -2
- package/dist/index.d.ts +72 -0
- package/dist/index.js +672 -0
- package/dist/template/.changeset/README.md +8 -0
- package/dist/template/.changeset/access-from-grants.md +14 -0
- package/dist/template/.changeset/accounting-exports.md +32 -0
- package/dist/template/.changeset/ad-creatives.md +33 -0
- package/dist/template/.changeset/ad-inventory.md +19 -0
- package/dist/template/.changeset/ad-measurement.md +10 -0
- package/dist/template/.changeset/ad-third-party.md +9 -0
- package/dist/template/.changeset/admin-ads.md +9 -0
- package/dist/template/.changeset/admin-documents.md +7 -0
- package/dist/template/.changeset/admin-loyalty.md +9 -0
- package/dist/template/.changeset/admin-referrals.md +9 -0
- package/dist/template/.changeset/admin-shell.md +16 -0
- package/dist/template/.changeset/adversarial-cms-boundaries.md +8 -0
- package/dist/template/.changeset/adversarial-customer-invariants.md +7 -0
- package/dist/template/.changeset/adversarial-customer-privacy.md +13 -0
- package/dist/template/.changeset/adversarial-platform-safety.md +15 -0
- package/dist/template/.changeset/agent-approval-inbox.md +5 -0
- package/dist/template/.changeset/agent-autonomy-writes.md +5 -0
- package/dist/template/.changeset/agent-budgets.md +5 -0
- package/dist/template/.changeset/agent-catalogue.md +22 -0
- package/dist/template/.changeset/agent-f04.md +6 -0
- package/dist/template/.changeset/agent-injection-hardening.md +5 -0
- package/dist/template/.changeset/agent-pause-kill-switch.md +5 -0
- package/dist/template/.changeset/agent-playbooks.md +5 -0
- package/dist/template/.changeset/agent-run-live.md +5 -0
- package/dist/template/.changeset/agent-work-board.md +5 -0
- package/dist/template/.changeset/agents-inbound.md +31 -0
- package/dist/template/.changeset/agents-model.md +27 -0
- package/dist/template/.changeset/alt-text-suggestions.md +8 -0
- package/dist/template/.changeset/analytics-governance.md +7 -0
- package/dist/template/.changeset/analytics-proxy-origin.md +8 -0
- package/dist/template/.changeset/analytics.md +10 -0
- package/dist/template/.changeset/apache-license.md +15 -0
- package/dist/template/.changeset/api-keys.md +19 -0
- package/dist/template/.changeset/arabic-rtl-catalog.md +23 -0
- package/dist/template/.changeset/assistant-grounding.md +10 -0
- package/dist/template/.changeset/assistant-guardrails.md +11 -0
- package/dist/template/.changeset/attested-facts-and-corrections.md +11 -0
- package/dist/template/.changeset/audit-search-and-proof.md +34 -0
- package/dist/template/.changeset/autofill-safety.md +22 -0
- package/dist/template/.changeset/automation-guardrails.md +9 -0
- package/dist/template/.changeset/automation-runtime.md +9 -0
- package/dist/template/.changeset/automations-builder.md +9 -0
- package/dist/template/.changeset/availability-resolver.md +29 -0
- package/dist/template/.changeset/availability.md +23 -0
- package/dist/template/.changeset/booking-audiences.md +24 -0
- package/dist/template/.changeset/booking-race-message.md +15 -0
- package/dist/template/.changeset/bookings.md +28 -0
- package/dist/template/.changeset/boot-in-request-graph.md +7 -0
- package/dist/template/.changeset/bot-detection.md +9 -0
- package/dist/template/.changeset/briefing-delivery.md +21 -0
- package/dist/template/.changeset/briefing-sections.md +22 -0
- package/dist/template/.changeset/browser-journeys.md +8 -0
- package/dist/template/.changeset/builder-code-lane.md +25 -0
- package/dist/template/.changeset/business-presets.md +8 -0
- package/dist/template/.changeset/business-settings-and-csrf.md +17 -0
- package/dist/template/.changeset/c11-08-restore-drill.md +20 -0
- package/dist/template/.changeset/c11-12-f04-axe.md +8 -0
- package/dist/template/.changeset/c11-14-retention.md +8 -0
- package/dist/template/.changeset/c11-14-search.md +11 -0
- package/dist/template/.changeset/c11-journeys.md +7 -0
- package/dist/template/.changeset/c11-ops.md +8 -0
- package/dist/template/.changeset/c11-quality.md +8 -0
- package/dist/template/.changeset/c1111-reference-acceptance.md +8 -0
- package/dist/template/.changeset/c1111-reference-target-closure.md +8 -0
- package/dist/template/.changeset/c224-inline-canvas.md +13 -0
- package/dist/template/.changeset/c224-merchandising-blocks.md +19 -0
- package/dist/template/.changeset/c225-canvas-caret-swap.md +5 -0
- package/dist/template/.changeset/c225-canvas-drag-drop.md +5 -0
- package/dist/template/.changeset/c225-canvas-media-tools.md +5 -0
- package/dist/template/.changeset/c225-store-sections.md +5 -0
- package/dist/template/.changeset/c313-live-paradise-acceptance.md +8 -0
- package/dist/template/.changeset/c324-storefront-parity.md +5 -0
- package/dist/template/.changeset/c6-11-events-evidence.md +14 -0
- package/dist/template/.changeset/caddy-domain-env.md +7 -0
- package/dist/template/.changeset/calculators-and-coverage.md +13 -0
- package/dist/template/.changeset/calculators-localized-evidence.md +11 -0
- package/dist/template/.changeset/calendar-oauth.md +5 -0
- package/dist/template/.changeset/calendars.md +26 -0
- package/dist/template/.changeset/campaign-broadcasts.md +34 -0
- package/dist/template/.changeset/canonical-two-factor-envelope.md +7 -0
- package/dist/template/.changeset/capture-chunk-integrity.md +5 -0
- package/dist/template/.changeset/cart-capability-authorization.md +10 -0
- package/dist/template/.changeset/cart-contact-authority.md +5 -0
- package/dist/template/.changeset/catalog-checkout-milestones.md +8 -0
- package/dist/template/.changeset/catalog-quality-rtl.md +12 -0
- package/dist/template/.changeset/change-password.md +8 -0
- package/dist/template/.changeset/ci-minio-quay.md +6 -0
- package/dist/template/.changeset/client-documents.md +11 -0
- package/dist/template/.changeset/client-galleries.md +7 -0
- package/dist/template/.changeset/client-gallery-delivery-audit.md +9 -0
- package/dist/template/.changeset/client-readiness-security.md +7 -0
- package/dist/template/.changeset/close-world-class-storefront.md +27 -0
- package/dist/template/.changeset/cms-a11y-hints.md +5 -0
- package/dist/template/.changeset/cms-author-history.md +8 -0
- package/dist/template/.changeset/cms-blocks.md +8 -0
- package/dist/template/.changeset/cms-cache-budgets.md +5 -0
- package/dist/template/.changeset/cms-chrome-sections.md +8 -0
- package/dist/template/.changeset/cms-collab-presence-comments.md +7 -0
- package/dist/template/.changeset/cms-content-lifecycle.md +9 -0
- package/dist/template/.changeset/cms-design-tokens.md +5 -0
- package/dist/template/.changeset/cms-editor.md +8 -0
- package/dist/template/.changeset/cms-email-editor.md +5 -0
- package/dist/template/.changeset/cms-entity-layouts.md +5 -0
- package/dist/template/.changeset/cms-experiment-reporting.md +5 -0
- package/dist/template/.changeset/cms-experiments.md +5 -0
- package/dist/template/.changeset/cms-locale-workflow.md +5 -0
- package/dist/template/.changeset/cms-plugin-proof.md +5 -0
- package/dist/template/.changeset/cms-rich-editor-foundations.md +8 -0
- package/dist/template/.changeset/cms-section-instances.md +5 -0
- package/dist/template/.changeset/cms-surface-blocks.md +9 -0
- package/dist/template/.changeset/cms-templates.md +5 -0
- package/dist/template/.changeset/collections-taxonomy.md +5 -0
- package/dist/template/.changeset/commerce-advanced-money.md +16 -0
- package/dist/template/.changeset/commerce-carts-orders.md +9 -0
- package/dist/template/.changeset/commerce-catalog-merchandising.md +5 -0
- package/dist/template/.changeset/commerce-edge-contracts.md +5 -0
- package/dist/template/.changeset/commerce-fulfillment.md +9 -0
- package/dist/template/.changeset/commerce-inventory-ledger.md +9 -0
- package/dist/template/.changeset/commerce-invoice-admin.md +5 -0
- package/dist/template/.changeset/commerce-money-foundation.md +5 -0
- package/dist/template/.changeset/commerce-payment-providers.md +8 -0
- package/dist/template/.changeset/commerce-pos.md +8 -0
- package/dist/template/.changeset/commerce-procurement.md +9 -0
- package/dist/template/.changeset/commerce-product-lifecycle.md +16 -0
- package/dist/template/.changeset/commerce-promotions.md +8 -0
- package/dist/template/.changeset/commerce-provider-parity.md +10 -0
- package/dist/template/.changeset/commerce-relations-breaks.md +5 -0
- package/dist/template/.changeset/commerce-service-offerings.md +11 -0
- package/dist/template/.changeset/commerce-shipping-rates.md +9 -0
- package/dist/template/.changeset/commerce-tax-templates.md +5 -0
- package/dist/template/.changeset/commerce-variant-matrices.md +5 -0
- package/dist/template/.changeset/community-rooms.md +7 -0
- package/dist/template/.changeset/complete-demo-scenarios.md +10 -0
- package/dist/template/.changeset/completion-honesty.md +10 -0
- package/dist/template/.changeset/config.json +11 -0
- package/dist/template/.changeset/connection-grants.md +5 -0
- package/dist/template/.changeset/consent-gated-media.md +13 -0
- package/dist/template/.changeset/consent-is-evidence.md +13 -0
- package/dist/template/.changeset/contact-data-depth.md +16 -0
- package/dist/template/.changeset/contact-duplicate-review.md +17 -0
- package/dist/template/.changeset/contact-import.md +26 -0
- package/dist/template/.changeset/contact-merge-ui.md +8 -0
- package/dist/template/.changeset/contact-privacy-rights.md +18 -0
- package/dist/template/.changeset/contacts-admin.md +15 -0
- package/dist/template/.changeset/contacts-create-human-only.md +5 -0
- package/dist/template/.changeset/content-security-policy.md +8 -0
- package/dist/template/.changeset/contract-templates.md +22 -0
- package/dist/template/.changeset/contribute-channel.md +5 -0
- package/dist/template/.changeset/contribute-status-replies.md +5 -0
- package/dist/template/.changeset/conversations.md +20 -0
- package/dist/template/.changeset/core-jobs.md +9 -0
- package/dist/template/.changeset/core-runs.md +7 -0
- package/dist/template/.changeset/core-seo.md +10 -0
- package/dist/template/.changeset/create-freeholder-setup.md +8 -0
- package/dist/template/.changeset/credential-encryption.md +26 -0
- package/dist/template/.changeset/custom-field-options-default.md +8 -0
- package/dist/template/.changeset/customer-booking-screens.md +9 -0
- package/dist/template/.changeset/customer-dependency-security.md +5 -0
- package/dist/template/.changeset/customer-gallery-foundation.md +8 -0
- package/dist/template/.changeset/customer-invoice-payments.md +5 -0
- package/dist/template/.changeset/customer-magic-links.md +12 -0
- package/dist/template/.changeset/customer-mobile-contracts.md +6 -0
- package/dist/template/.changeset/customer-reply-and-account.md +7 -0
- package/dist/template/.changeset/customer-self-service.md +12 -0
- package/dist/template/.changeset/customization-seams.md +7 -0
- package/dist/template/.changeset/daily-briefing.md +27 -0
- package/dist/template/.changeset/daily-private-rooms.md +8 -0
- package/dist/template/.changeset/daily-update-check.md +6 -0
- package/dist/template/.changeset/danger-token-integrity.md +5 -0
- package/dist/template/.changeset/demo-same-droplet.md +12 -0
- package/dist/template/.changeset/dependency-security-policy.md +7 -0
- package/dist/template/.changeset/deploy-script-stdin.md +5 -0
- package/dist/template/.changeset/design-system-and-setup.md +17 -0
- package/dist/template/.changeset/deterministic-demo-scenarios.md +5 -0
- package/dist/template/.changeset/digitalocean-droplet-recipe.md +15 -0
- package/dist/template/.changeset/doc-claim-mapping.md +5 -0
- package/dist/template/.changeset/docs-availability.md +7 -0
- package/dist/template/.changeset/doctor.md +9 -0
- package/dist/template/.changeset/done.md +8 -0
- package/dist/template/.changeset/droplet-backup-cron-env.md +10 -0
- package/dist/template/.changeset/dunning.md +10 -0
- package/dist/template/.changeset/durable-provider-work.md +10 -0
- package/dist/template/.changeset/editor-preview-local-draft.md +5 -0
- package/dist/template/.changeset/editor-publish-autosave-race.md +5 -0
- package/dist/template/.changeset/embeds-with-backlinks.md +7 -0
- package/dist/template/.changeset/enforced-service-area-coverage.md +5 -0
- package/dist/template/.changeset/events-newsletters-seo.md +5 -0
- package/dist/template/.changeset/executable-tier-one-portability.md +5 -0
- package/dist/template/.changeset/expo-customer-app.md +10 -0
- package/dist/template/.changeset/external-calendar-sync.md +20 -0
- package/dist/template/.changeset/f-matrix-2026-09-16.md +17 -0
- package/dist/template/.changeset/f-matrix.md +9 -0
- package/dist/template/.changeset/f04-journey-screens.md +11 -0
- package/dist/template/.changeset/faceted-browse-storefront-search.md +5 -0
- package/dist/template/.changeset/first-party-plugin-surfaces.md +8 -0
- package/dist/template/.changeset/fork-lane.md +11 -0
- package/dist/template/.changeset/form-builder.md +26 -0
- package/dist/template/.changeset/forms-get-public-projection.md +13 -0
- package/dist/template/.changeset/forms-module.md +10 -0
- package/dist/template/.changeset/freeholder-app-init.md +10 -0
- package/dist/template/.changeset/front-site-assistant.md +29 -0
- package/dist/template/.changeset/gallery-approval-rounds.md +8 -0
- package/dist/template/.changeset/gallery-archive-delivery.md +13 -0
- package/dist/template/.changeset/gallery-download-policy.md +8 -0
- package/dist/template/.changeset/gallery-partner-share.md +8 -0
- package/dist/template/.changeset/gallery-proofing.md +9 -0
- package/dist/template/.changeset/gallery-sales.md +11 -0
- package/dist/template/.changeset/gate-hardening.md +5 -0
- package/dist/template/.changeset/generate-alt-text-without-open-transactions.md +9 -0
- package/dist/template/.changeset/graceful-job-shutdown.md +8 -0
- package/dist/template/.changeset/help-centre.md +16 -0
- package/dist/template/.changeset/honest-error-states.md +5 -0
- package/dist/template/.changeset/host-executor-drills.md +5 -0
- package/dist/template/.changeset/host-image-identity.md +5 -0
- package/dist/template/.changeset/host-updater-migration-lane.md +5 -0
- package/dist/template/.changeset/http-api.md +23 -0
- package/dist/template/.changeset/http-edge-auth-routes.md +14 -0
- package/dist/template/.changeset/ics-and-calendar-writeback.md +19 -0
- package/dist/template/.changeset/ics-feed-500.md +7 -0
- package/dist/template/.changeset/import-replace-rollback.md +5 -0
- package/dist/template/.changeset/inbox.md +24 -0
- package/dist/template/.changeset/intake-waivers-and-reminders.md +26 -0
- package/dist/template/.changeset/internal-service-boundary.md +9 -0
- package/dist/template/.changeset/job-operations.md +14 -0
- package/dist/template/.changeset/job-runtime-health.md +9 -0
- package/dist/template/.changeset/leftover-f04.md +8 -0
- package/dist/template/.changeset/light-and-dark.md +12 -0
- package/dist/template/.changeset/living-contract.md +5 -0
- package/dist/template/.changeset/locale-driven-customer-surfaces.md +14 -0
- package/dist/template/.changeset/locale-routing.md +10 -0
- package/dist/template/.changeset/locations-and-nap.md +29 -0
- package/dist/template/.changeset/loyalty-points.md +17 -0
- package/dist/template/.changeset/loyalty-tiers-rewards.md +20 -0
- package/dist/template/.changeset/mail-adapter-completion.md +20 -0
- package/dist/template/.changeset/mail-and-reset.md +10 -0
- package/dist/template/.changeset/mail-contacts.md +28 -0
- package/dist/template/.changeset/mail-delivery-boundary.md +10 -0
- package/dist/template/.changeset/managed-agent-loop.md +5 -0
- package/dist/template/.changeset/marketplace-channel-sync.md +7 -0
- package/dist/template/.changeset/mcp-server.md +20 -0
- package/dist/template/.changeset/media-and-canvas.md +8 -0
- package/dist/template/.changeset/media-capture-review.md +8 -0
- package/dist/template/.changeset/media-capture-sessions.md +5 -0
- package/dist/template/.changeset/media-delete-and-inline-editing.md +7 -0
- package/dist/template/.changeset/media-lifecycle.md +9 -0
- package/dist/template/.changeset/media-phone-ingest.md +8 -0
- package/dist/template/.changeset/memberships.md +37 -0
- package/dist/template/.changeset/message-templates.md +9 -0
- package/dist/template/.changeset/mobile-app-package.md +10 -0
- package/dist/template/.changeset/mobile-capture-batches.md +9 -0
- package/dist/template/.changeset/mobile-dependency-security.md +5 -0
- package/dist/template/.changeset/mobile-screens.md +10 -0
- package/dist/template/.changeset/mobile-store-ci.md +11 -0
- package/dist/template/.changeset/mobile-v2-deferral.md +12 -0
- package/dist/template/.changeset/n1-schema.md +6 -0
- package/dist/template/.changeset/named-roles-grants.md +10 -0
- package/dist/template/.changeset/native-customer-invoices.md +9 -0
- package/dist/template/.changeset/native-gallery-proofing.md +6 -0
- package/dist/template/.changeset/next-critical-advisories.md +6 -0
- package/dist/template/.changeset/no-double-booking.md +13 -0
- package/dist/template/.changeset/no-live-phone-example.md +5 -0
- package/dist/template/.changeset/note-task-recovery.md +9 -0
- package/dist/template/.changeset/notes.md +22 -0
- package/dist/template/.changeset/notification-fanout-inbox.md +17 -0
- package/dist/template/.changeset/on-danger-token.md +9 -0
- package/dist/template/.changeset/one-answer-to-who.md +24 -0
- package/dist/template/.changeset/open-source-demo-only.md +7 -0
- package/dist/template/.changeset/order-read-authorization.md +10 -0
- package/dist/template/.changeset/outbox-dead-letters.md +13 -0
- package/dist/template/.changeset/owner-agent-launch.md +4 -0
- package/dist/template/.changeset/owner-authored-assessments.md +15 -0
- package/dist/template/.changeset/owner-companion.md +10 -0
- package/dist/template/.changeset/owner-content-builder.md +21 -0
- package/dist/template/.changeset/owner-facing-helper.md +5 -0
- package/dist/template/.changeset/owner-storage-recording-import.md +8 -0
- package/dist/template/.changeset/ownership-recovery.md +5 -0
- package/dist/template/.changeset/ownership.md +8 -0
- package/dist/template/.changeset/package-artifact-integrity.md +9 -0
- package/dist/template/.changeset/paradise-comms-adapter.md +5 -0
- package/dist/template/.changeset/patch-uuid-buffer-advisory.md +7 -0
- package/dist/template/.changeset/paywalls.md +10 -0
- package/dist/template/.changeset/perf-harness-windows.md +11 -0
- package/dist/template/.changeset/perf-measurement-families.md +8 -0
- package/dist/template/.changeset/phase-0-foundations.md +7 -0
- package/dist/template/.changeset/pipelines.md +21 -0
- package/dist/template/.changeset/plan-evidence-gate.md +7 -0
- package/dist/template/.changeset/plan-proof-clause.md +9 -0
- package/dist/template/.changeset/plan-provider-pivot-2026-09-27.md +20 -0
- package/dist/template/.changeset/plan-world-class-commerce-editor-2026-09-29.md +21 -0
- package/dist/template/.changeset/playbook-schedules.md +21 -0
- package/dist/template/.changeset/playground-hardening.md +5 -0
- package/dist/template/.changeset/plugin-contract.md +5 -0
- package/dist/template/.changeset/popups.md +37 -0
- package/dist/template/.changeset/portable-plugins.md +5 -0
- package/dist/template/.changeset/portal-rooms.md +16 -0
- package/dist/template/.changeset/portal-shell.md +11 -0
- package/dist/template/.changeset/print-on-demand-fulfillment.md +7 -0
- package/dist/template/.changeset/printify-live-fulfillment.md +11 -0
- package/dist/template/.changeset/private-location-access.md +10 -0
- package/dist/template/.changeset/private-mobile-cache.md +6 -0
- package/dist/template/.changeset/private-note-access.md +8 -0
- package/dist/template/.changeset/privileged-two-factor.md +11 -0
- package/dist/template/.changeset/product-completion-plan.md +10 -0
- package/dist/template/.changeset/product-gift-share.md +7 -0
- package/dist/template/.changeset/project-case-studies.md +7 -0
- package/dist/template/.changeset/projects.md +24 -0
- package/dist/template/.changeset/provider-recording-erasure.md +8 -0
- package/dist/template/.changeset/provider-workflows-without-open-transactions.md +15 -0
- package/dist/template/.changeset/public-beta-2.md +4 -0
- package/dist/template/.changeset/public-beta-preparation.md +4 -0
- package/dist/template/.changeset/public-cart-checkout-confirmation.md +5 -0
- package/dist/template/.changeset/public-entity-drafts.md +6 -0
- package/dist/template/.changeset/public-gates.md +9 -0
- package/dist/template/.changeset/public-playground-host-updates.md +10 -0
- package/dist/template/.changeset/public-project-portfolios.md +7 -0
- package/dist/template/.changeset/publish-image.md +7 -0
- package/dist/template/.changeset/purge-without-open-transactions.md +9 -0
- package/dist/template/.changeset/push-notifications.md +11 -0
- package/dist/template/.changeset/queue-performance-clock.md +8 -0
- package/dist/template/.changeset/quote-conversion.md +22 -0
- package/dist/template/.changeset/quote-partner-share.md +7 -0
- package/dist/template/.changeset/quotes.md +22 -0
- package/dist/template/.changeset/real-browser-accessibility.md +7 -0
- package/dist/template/.changeset/recipe-bootstrap-fixes.md +9 -0
- package/dist/template/.changeset/recipe-update-backup-gate.md +5 -0
- package/dist/template/.changeset/recipient-messaging-policy.md +8 -0
- package/dist/template/.changeset/record-search-orders-subscriptions-gifts.md +8 -0
- package/dist/template/.changeset/record-studio-permissions.md +7 -0
- package/dist/template/.changeset/record-trash-every-row.md +9 -0
- package/dist/template/.changeset/recurring-invoices.md +24 -0
- package/dist/template/.changeset/referral-attribution.md +20 -0
- package/dist/template/.changeset/referral-commissions.md +11 -0
- package/dist/template/.changeset/register-stored-original-without-open-transactions.md +7 -0
- package/dist/template/.changeset/release-channels.md +7 -0
- package/dist/template/.changeset/remove-forced-builder-credit.md +5 -0
- package/dist/template/.changeset/rentals.md +22 -0
- package/dist/template/.changeset/reports-you-will-read.md +31 -0
- package/dist/template/.changeset/rescan-without-open-transactions.md +9 -0
- package/dist/template/.changeset/retire-stale-handoffs.md +7 -0
- package/dist/template/.changeset/reviews.md +11 -0
- package/dist/template/.changeset/rich-link-url-allowlist.md +5 -0
- package/dist/template/.changeset/role-guidance.md +5 -0
- package/dist/template/.changeset/rule-strong-token.md +13 -0
- package/dist/template/.changeset/saved-views.md +19 -0
- package/dist/template/.changeset/schema-baseline.md +12 -0
- package/dist/template/.changeset/scoring.md +23 -0
- package/dist/template/.changeset/security-parsing-and-recovery.md +8 -0
- package/dist/template/.changeset/seed-demo.md +8 -0
- package/dist/template/.changeset/seeded-development-home.md +5 -0
- package/dist/template/.changeset/segments.md +21 -0
- package/dist/template/.changeset/self-building-scope.md +12 -0
- package/dist/template/.changeset/seo-riba-surface.md +11 -0
- package/dist/template/.changeset/service-output-schemas.md +5 -0
- package/dist/template/.changeset/session-device-management.md +11 -0
- package/dist/template/.changeset/sharing-in-the-dna.md +32 -0
- package/dist/template/.changeset/ship-replit-storage-sdk.md +5 -0
- package/dist/template/.changeset/shopify-live-channel.md +12 -0
- package/dist/template/.changeset/shopify-refund-reconciliation.md +8 -0
- package/dist/template/.changeset/signed-candidate-history.md +4 -0
- package/dist/template/.changeset/signed-release-feed.md +6 -0
- package/dist/template/.changeset/signup-contact-import.md +5 -0
- package/dist/template/.changeset/site-live-chat.md +5 -0
- package/dist/template/.changeset/sms-consent-boundary.md +8 -0
- package/dist/template/.changeset/sms-registration.md +25 -0
- package/dist/template/.changeset/sms-templates-keywords-mms.md +5 -0
- package/dist/template/.changeset/sms.md +27 -0
- package/dist/template/.changeset/social-composer.md +9 -0
- package/dist/template/.changeset/social-connections.md +10 -0
- package/dist/template/.changeset/social-gbp.md +7 -0
- package/dist/template/.changeset/social-ingest.md +8 -0
- package/dist/template/.changeset/social-onboarding.md +8 -0
- package/dist/template/.changeset/source-first-start.md +5 -0
- package/dist/template/.changeset/source-map-security-floor.md +4 -0
- package/dist/template/.changeset/source-provenance.md +16 -0
- package/dist/template/.changeset/spine-and-service-registry.md +21 -0
- package/dist/template/.changeset/stable-release-publication.md +10 -0
- package/dist/template/.changeset/staff-invitations.md +13 -0
- package/dist/template/.changeset/standalone-artifact-boundary.md +5 -0
- package/dist/template/.changeset/standing-debts-1.md +10 -0
- package/dist/template/.changeset/storage-adapters.md +12 -0
- package/dist/template/.changeset/subscription-billing.md +12 -0
- package/dist/template/.changeset/supplier-agreement-search.md +8 -0
- package/dist/template/.changeset/supply-chain-release-gate.md +11 -0
- package/dist/template/.changeset/tasks.md +20 -0
- package/dist/template/.changeset/tax-adapter-seam.md +5 -0
- package/dist/template/.changeset/third-party-batch-2.md +28 -0
- package/dist/template/.changeset/third-party-findings-batch-1.md +27 -0
- package/dist/template/.changeset/tidy-sites-drop.md +9 -0
- package/dist/template/.changeset/time-entries.md +24 -0
- package/dist/template/.changeset/transaction-composition-integrity.md +22 -0
- package/dist/template/.changeset/transactional-jobs.md +15 -0
- package/dist/template/.changeset/translation-admin.md +26 -0
- package/dist/template/.changeset/translation-draft-honesty.md +5 -0
- package/dist/template/.changeset/typed-sdk.md +7 -0
- package/dist/template/.changeset/unified-calendar.md +23 -0
- package/dist/template/.changeset/update-admin.md +12 -0
- package/dist/template/.changeset/update-apply.md +6 -0
- package/dist/template/.changeset/update-cli.md +10 -0
- package/dist/template/.changeset/update-escalation.md +11 -0
- package/dist/template/.changeset/update-policy.md +6 -0
- package/dist/template/.changeset/update-preflight.md +6 -0
- package/dist/template/.changeset/update-status.md +10 -0
- package/dist/template/.changeset/update-targets.md +10 -0
- package/dist/template/.changeset/upgrade-gates.md +9 -0
- package/dist/template/.changeset/uploads-without-open-transactions.md +9 -0
- package/dist/template/.changeset/versioned-release.md +10 -0
- package/dist/template/.changeset/visit-to-paid-funnel.md +27 -0
- package/dist/template/.changeset/visual-drag.md +6 -0
- package/dist/template/.changeset/voice-video-rooms.md +8 -0
- package/dist/template/.changeset/voicevideo-credential-expiry.md +8 -0
- package/dist/template/.changeset/waitlists-groups-and-policy.md +27 -0
- package/dist/template/.changeset/watermark-backfill-without-open-transactions.md +9 -0
- package/dist/template/.changeset/watermarked-proof-renditions.md +8 -0
- package/dist/template/.changeset/webauthn-14.md +7 -0
- package/dist/template/.changeset/webhook-pinned-transport.md +5 -0
- package/dist/template/.changeset/webhooks.md +22 -0
- package/dist/template/.changeset/wevibesites-colophon.md +7 -0
- package/dist/template/.changeset/workflow-record-search.md +8 -0
- package/dist/template/.changeset/workforce-adapter-family.md +5 -0
- package/dist/template/.changeset/www-canonical-redirect.md +7 -0
- package/dist/template/.dockerignore +16 -0
- package/dist/template/.env.example +215 -0
- package/dist/template/.github/PULL_REQUEST_TEMPLATE.md +19 -0
- package/dist/template/.github/actions/setup-project/action.yml +15 -0
- package/dist/template/.github/dependabot.yml +27 -0
- package/dist/template/.github/workflows/ci.yml +501 -0
- package/dist/template/.github/workflows/eas.yml +51 -0
- package/dist/template/.github/workflows/mirror-ci-images.yml +62 -0
- package/dist/template/.github/workflows/publish-image.yml +214 -0
- package/dist/template/.github/workflows/publish-packages.yml +75 -0
- package/dist/template/.github/workflows/security-scheduled.yml +47 -0
- package/dist/template/.node-version +1 -0
- package/dist/template/.railway/railway.ts +43 -0
- package/dist/template/.replit +15 -0
- package/dist/template/AGENTS.md +34 -0
- package/dist/template/CLAUDE.md +62 -0
- package/dist/template/CODE_OF_CONDUCT.md +134 -0
- package/dist/template/CONTRIBUTING.md +100 -0
- package/dist/template/DCO.md +42 -0
- package/dist/template/Dockerfile +48 -0
- package/dist/template/LICENSE +202 -0
- package/dist/template/LICENSING.md +61 -0
- package/dist/template/MASTER.md +10261 -0
- package/dist/template/README.md +122 -0
- package/dist/template/SECURITY.md +152 -0
- package/dist/template/app/(admin)/action-helpers.ts +21 -0
- package/dist/template/app/(admin)/actions.ts +1529 -0
- package/dist/template/app/(admin)/admin/AdminGuidanceHelp.tsx +38 -0
- package/dist/template/app/(admin)/admin/AdminNav.tsx +303 -0
- package/dist/template/app/(admin)/admin/BlockEditor.tsx +2993 -0
- package/dist/template/app/(admin)/admin/ConversationsPanel.tsx +124 -0
- package/dist/template/app/(admin)/admin/NotesPanel.tsx +161 -0
- package/dist/template/app/(admin)/admin/PreviewCanvas.tsx +583 -0
- package/dist/template/app/(admin)/admin/RichField.tsx +107 -0
- package/dist/template/app/(admin)/admin/ScorePanel.tsx +117 -0
- package/dist/template/app/(admin)/admin/SignOutButton.tsx +19 -0
- package/dist/template/app/(admin)/admin/ViewBar.tsx +162 -0
- package/dist/template/app/(admin)/admin/access/page.tsx +214 -0
- package/dist/template/app/(admin)/admin/ads/page.tsx +827 -0
- package/dist/template/app/(admin)/admin/agreements/[id]/page.tsx +148 -0
- package/dist/template/app/(admin)/admin/agreements/page.tsx +288 -0
- package/dist/template/app/(admin)/admin/appointments/[id]/page.tsx +522 -0
- package/dist/template/app/(admin)/admin/appointments/page.tsx +215 -0
- package/dist/template/app/(admin)/admin/assessments/BandEditor.tsx +295 -0
- package/dist/template/app/(admin)/admin/assessments/EscalationEditor.tsx +229 -0
- package/dist/template/app/(admin)/admin/assessments/PublishControls.tsx +76 -0
- package/dist/template/app/(admin)/admin/assessments/QuestionBuilder.tsx +489 -0
- package/dist/template/app/(admin)/admin/assessments/[id]/edit/page.tsx +64 -0
- package/dist/template/app/(admin)/admin/assessments/[id]/page.tsx +166 -0
- package/dist/template/app/(admin)/admin/assessments/labels.ts +106 -0
- package/dist/template/app/(admin)/admin/assessments/new/page.tsx +42 -0
- package/dist/template/app/(admin)/admin/assessments/page.tsx +95 -0
- package/dist/template/app/(admin)/admin/assistant/page.tsx +741 -0
- package/dist/template/app/(admin)/admin/automations/[id]/page.tsx +595 -0
- package/dist/template/app/(admin)/admin/automations/page.tsx +153 -0
- package/dist/template/app/(admin)/admin/blog/actions.ts +21 -0
- package/dist/template/app/(admin)/admin/blog/page.tsx +13 -0
- package/dist/template/app/(admin)/admin/briefing/page.tsx +179 -0
- package/dist/template/app/(admin)/admin/builder/page.tsx +205 -0
- package/dist/template/app/(admin)/admin/builder/proposals/[id]/page.tsx +88 -0
- package/dist/template/app/(admin)/admin/calculators/CalculatorBuilder.tsx +573 -0
- package/dist/template/app/(admin)/admin/calculators/CalculatorPublish.tsx +65 -0
- package/dist/template/app/(admin)/admin/calculators/[id]/page.tsx +75 -0
- package/dist/template/app/(admin)/admin/calculators/labels.ts +51 -0
- package/dist/template/app/(admin)/admin/calculators/new/page.tsx +35 -0
- package/dist/template/app/(admin)/admin/calculators/page.tsx +87 -0
- package/dist/template/app/(admin)/admin/calendar/page.tsx +326 -0
- package/dist/template/app/(admin)/admin/calendars/[id]/page.tsx +255 -0
- package/dist/template/app/(admin)/admin/calendars/audiences/page.tsx +256 -0
- package/dist/template/app/(admin)/admin/calendars/page.tsx +261 -0
- package/dist/template/app/(admin)/admin/calendars/waitlist/page.tsx +236 -0
- package/dist/template/app/(admin)/admin/carts/[id]/page.tsx +219 -0
- package/dist/template/app/(admin)/admin/carts/page.tsx +107 -0
- package/dist/template/app/(admin)/admin/collections/[id]/page.tsx +259 -0
- package/dist/template/app/(admin)/admin/collections/page.tsx +134 -0
- package/dist/template/app/(admin)/admin/community/page.tsx +293 -0
- package/dist/template/app/(admin)/admin/connect/ConnectForm.tsx +52 -0
- package/dist/template/app/(admin)/admin/connect/actions.ts +29 -0
- package/dist/template/app/(admin)/admin/connect/page.tsx +17 -0
- package/dist/template/app/(admin)/admin/contacts/ContactForm.tsx +287 -0
- package/dist/template/app/(admin)/admin/contacts/CustomFieldInputs.tsx +101 -0
- package/dist/template/app/(admin)/admin/contacts/[id]/MergePanel.tsx +113 -0
- package/dist/template/app/(admin)/admin/contacts/[id]/RelationshipPanel.tsx +234 -0
- package/dist/template/app/(admin)/admin/contacts/[id]/page.tsx +388 -0
- package/dist/template/app/(admin)/admin/contacts/contactLabels.ts +112 -0
- package/dist/template/app/(admin)/admin/contacts/duplicates/DuplicateReview.tsx +335 -0
- package/dist/template/app/(admin)/admin/contacts/duplicates/page.tsx +196 -0
- package/dist/template/app/(admin)/admin/contacts/fields/CustomFieldManager.tsx +199 -0
- package/dist/template/app/(admin)/admin/contacts/fields/page.tsx +58 -0
- package/dist/template/app/(admin)/admin/contacts/new/page.tsx +51 -0
- package/dist/template/app/(admin)/admin/contacts/organizations/OrganizationForm.tsx +144 -0
- package/dist/template/app/(admin)/admin/contacts/organizations/[id]/page.tsx +80 -0
- package/dist/template/app/(admin)/admin/contacts/organizations/labels.ts +26 -0
- package/dist/template/app/(admin)/admin/contacts/organizations/new/page.tsx +35 -0
- package/dist/template/app/(admin)/admin/contacts/organizations/page.tsx +140 -0
- package/dist/template/app/(admin)/admin/contacts/page.tsx +341 -0
- package/dist/template/app/(admin)/admin/contacts/privacy/PrivacyActionForm.tsx +59 -0
- package/dist/template/app/(admin)/admin/contacts/privacy/[id]/page.tsx +188 -0
- package/dist/template/app/(admin)/admin/contacts/privacy/page.tsx +241 -0
- package/dist/template/app/(admin)/admin/contribute/ContributeForms.tsx +190 -0
- package/dist/template/app/(admin)/admin/contribute/[id]/page.tsx +111 -0
- package/dist/template/app/(admin)/admin/contribute/page.tsx +114 -0
- package/dist/template/app/(admin)/admin/demos/page.tsx +174 -0
- package/dist/template/app/(admin)/admin/describeAction.ts +38 -0
- package/dist/template/app/(admin)/admin/design/DesignForm.tsx +206 -0
- package/dist/template/app/(admin)/admin/design/page.tsx +79 -0
- package/dist/template/app/(admin)/admin/documents/[id]/page.tsx +331 -0
- package/dist/template/app/(admin)/admin/documents/page.tsx +127 -0
- package/dist/template/app/(admin)/admin/editorLabels.ts +288 -0
- package/dist/template/app/(admin)/admin/events/[id]/page.tsx +192 -0
- package/dist/template/app/(admin)/admin/events/page.tsx +75 -0
- package/dist/template/app/(admin)/admin/experiments/page.tsx +71 -0
- package/dist/template/app/(admin)/admin/facts/FactForms.tsx +223 -0
- package/dist/template/app/(admin)/admin/facts/[key]/page.tsx +145 -0
- package/dist/template/app/(admin)/admin/facts/labels.ts +32 -0
- package/dist/template/app/(admin)/admin/facts/page.tsx +97 -0
- package/dist/template/app/(admin)/admin/forms/FieldBuilder.tsx +410 -0
- package/dist/template/app/(admin)/admin/forms/[id]/edit/page.tsx +87 -0
- package/dist/template/app/(admin)/admin/forms/[id]/page.tsx +198 -0
- package/dist/template/app/(admin)/admin/forms/builderLabels.ts +55 -0
- package/dist/template/app/(admin)/admin/forms/new/page.tsx +47 -0
- package/dist/template/app/(admin)/admin/forms/page.tsx +104 -0
- package/dist/template/app/(admin)/admin/fulfillment/page.tsx +87 -0
- package/dist/template/app/(admin)/admin/galleries/[id]/page.tsx +457 -0
- package/dist/template/app/(admin)/admin/galleries/page.tsx +132 -0
- package/dist/template/app/(admin)/admin/gifts/page.tsx +152 -0
- package/dist/template/app/(admin)/admin/guard.ts +59 -0
- package/dist/template/app/(admin)/admin/guidance/page.tsx +58 -0
- package/dist/template/app/(admin)/admin/health/page.tsx +141 -0
- package/dist/template/app/(admin)/admin/hire/page.tsx +228 -0
- package/dist/template/app/(admin)/admin/imports/ImportForms.tsx +167 -0
- package/dist/template/app/(admin)/admin/imports/[id]/page.tsx +65 -0
- package/dist/template/app/(admin)/admin/imports/contacts/[id]/page.tsx +273 -0
- package/dist/template/app/(admin)/admin/imports/contacts/page.tsx +212 -0
- package/dist/template/app/(admin)/admin/imports/page.tsx +68 -0
- package/dist/template/app/(admin)/admin/inbox/[id]/page.tsx +232 -0
- package/dist/template/app/(admin)/admin/inbox/page.tsx +306 -0
- package/dist/template/app/(admin)/admin/inventory/page.tsx +273 -0
- package/dist/template/app/(admin)/admin/invitations/InvitationManager.tsx +369 -0
- package/dist/template/app/(admin)/admin/invitations/page.tsx +102 -0
- package/dist/template/app/(admin)/admin/invoices/[id]/page.tsx +474 -0
- package/dist/template/app/(admin)/admin/invoices/format.ts +43 -0
- package/dist/template/app/(admin)/admin/invoices/new/page.tsx +206 -0
- package/dist/template/app/(admin)/admin/invoices/page.tsx +136 -0
- package/dist/template/app/(admin)/admin/invoices/recurring/page.tsx +227 -0
- package/dist/template/app/(admin)/admin/invoices/tax/page.tsx +378 -0
- package/dist/template/app/(admin)/admin/jobs/JobActionForm.tsx +54 -0
- package/dist/template/app/(admin)/admin/jobs/[name]/[id]/page.tsx +183 -0
- package/dist/template/app/(admin)/admin/jobs/outbox/[id]/page.tsx +130 -0
- package/dist/template/app/(admin)/admin/jobs/outbox/page.tsx +145 -0
- package/dist/template/app/(admin)/admin/jobs/page.tsx +221 -0
- package/dist/template/app/(admin)/admin/layout.tsx +194 -0
- package/dist/template/app/(admin)/admin/locations/DeleteButton.tsx +47 -0
- package/dist/template/app/(admin)/admin/locations/HoursForm.tsx +122 -0
- package/dist/template/app/(admin)/admin/locations/LocationForm.tsx +249 -0
- package/dist/template/app/(admin)/admin/locations/PrimaryButton.tsx +30 -0
- package/dist/template/app/(admin)/admin/locations/ServiceAreaForm.tsx +223 -0
- package/dist/template/app/(admin)/admin/locations/[id]/page.tsx +142 -0
- package/dist/template/app/(admin)/admin/locations/labels.ts +112 -0
- package/dist/template/app/(admin)/admin/locations/page.tsx +121 -0
- package/dist/template/app/(admin)/admin/loyalty/page.tsx +496 -0
- package/dist/template/app/(admin)/admin/marketplace/page.tsx +158 -0
- package/dist/template/app/(admin)/admin/media/AltTextForm.tsx +160 -0
- package/dist/template/app/(admin)/admin/media/DeleteAssetButton.tsx +74 -0
- package/dist/template/app/(admin)/admin/media/FocalPointForm.tsx +64 -0
- package/dist/template/app/(admin)/admin/media/RecordStudio.tsx +326 -0
- package/dist/template/app/(admin)/admin/media/TrashActions.tsx +100 -0
- package/dist/template/app/(admin)/admin/media/UploadForm.tsx +164 -0
- package/dist/template/app/(admin)/admin/media/page.tsx +415 -0
- package/dist/template/app/(admin)/admin/media/record/page.tsx +145 -0
- package/dist/template/app/(admin)/admin/media/upload-client.ts +313 -0
- package/dist/template/app/(admin)/admin/messaging/page.tsx +426 -0
- package/dist/template/app/(admin)/admin/newsletters/[id]/page.tsx +149 -0
- package/dist/template/app/(admin)/admin/newsletters/broadcasts/[id]/page.tsx +250 -0
- package/dist/template/app/(admin)/admin/newsletters/broadcasts/page.tsx +192 -0
- package/dist/template/app/(admin)/admin/newsletters/page.tsx +78 -0
- package/dist/template/app/(admin)/admin/newsletters/templates/page.tsx +254 -0
- package/dist/template/app/(admin)/admin/notifications/NotificationControls.tsx +197 -0
- package/dist/template/app/(admin)/admin/notifications/page.tsx +334 -0
- package/dist/template/app/(admin)/admin/orders/[id]/page.tsx +318 -0
- package/dist/template/app/(admin)/admin/orders/page.tsx +64 -0
- package/dist/template/app/(admin)/admin/page.tsx +159 -0
- package/dist/template/app/(admin)/admin/pages/SeedSiteButton.tsx +20 -0
- package/dist/template/app/(admin)/admin/pages/[id]/CopyPreviewLink.tsx +45 -0
- package/dist/template/app/(admin)/admin/pages/[id]/PageComments.tsx +242 -0
- package/dist/template/app/(admin)/admin/pages/[id]/PageEditor.tsx +105 -0
- package/dist/template/app/(admin)/admin/pages/[id]/PageLifecycle.tsx +210 -0
- package/dist/template/app/(admin)/admin/pages/[id]/PagePresence.tsx +63 -0
- package/dist/template/app/(admin)/admin/pages/[id]/PublishToggle.tsx +27 -0
- package/dist/template/app/(admin)/admin/pages/[id]/RevisionList.tsx +115 -0
- package/dist/template/app/(admin)/admin/pages/[id]/page.tsx +337 -0
- package/dist/template/app/(admin)/admin/pages/new/NewPageForm.tsx +65 -0
- package/dist/template/app/(admin)/admin/pages/new/page.tsx +45 -0
- package/dist/template/app/(admin)/admin/pages/page.tsx +171 -0
- package/dist/template/app/(admin)/admin/payments/page.tsx +203 -0
- package/dist/template/app/(admin)/admin/paywalls/page.tsx +199 -0
- package/dist/template/app/(admin)/admin/pipeline/page.tsx +313 -0
- package/dist/template/app/(admin)/admin/plugins/PluginForms.tsx +158 -0
- package/dist/template/app/(admin)/admin/plugins/page.tsx +150 -0
- package/dist/template/app/(admin)/admin/popups/[id]/PopupEditor.tsx +39 -0
- package/dist/template/app/(admin)/admin/popups/[id]/page.tsx +430 -0
- package/dist/template/app/(admin)/admin/popups/page.tsx +230 -0
- package/dist/template/app/(admin)/admin/pos/page.tsx +153 -0
- package/dist/template/app/(admin)/admin/price-lists/page.tsx +150 -0
- package/dist/template/app/(admin)/admin/print-on-demand/page.tsx +144 -0
- package/dist/template/app/(admin)/admin/procurement/page.tsx +208 -0
- package/dist/template/app/(admin)/admin/products/[id]/ProductEditor.tsx +61 -0
- package/dist/template/app/(admin)/admin/products/[id]/page.tsx +807 -0
- package/dist/template/app/(admin)/admin/products/new/page.tsx +55 -0
- package/dist/template/app/(admin)/admin/products/page.tsx +108 -0
- package/dist/template/app/(admin)/admin/projects/[id]/ProjectEditor.tsx +41 -0
- package/dist/template/app/(admin)/admin/projects/[id]/page.tsx +785 -0
- package/dist/template/app/(admin)/admin/projects/collections/[id]/page.tsx +166 -0
- package/dist/template/app/(admin)/admin/projects/collections/page.tsx +101 -0
- package/dist/template/app/(admin)/admin/projects/page.tsx +156 -0
- package/dist/template/app/(admin)/admin/promotions/page.tsx +206 -0
- package/dist/template/app/(admin)/admin/quotes/[id]/ConvertQuoteForm.tsx +34 -0
- package/dist/template/app/(admin)/admin/quotes/[id]/page.tsx +265 -0
- package/dist/template/app/(admin)/admin/quotes/page.tsx +193 -0
- package/dist/template/app/(admin)/admin/redirects/page.tsx +114 -0
- package/dist/template/app/(admin)/admin/referrals/page.tsx +464 -0
- package/dist/template/app/(admin)/admin/referrals/payouts/[id]/csv/route.ts +42 -0
- package/dist/template/app/(admin)/admin/reports/exports/[runId]/download/route.ts +41 -0
- package/dist/template/app/(admin)/admin/reports/exports/page.tsx +524 -0
- package/dist/template/app/(admin)/admin/reports/page.tsx +423 -0
- package/dist/template/app/(admin)/admin/retention/page.tsx +148 -0
- package/dist/template/app/(admin)/admin/returns/page.tsx +141 -0
- package/dist/template/app/(admin)/admin/reviews/page.tsx +250 -0
- package/dist/template/app/(admin)/admin/roles/RoleManager.tsx +381 -0
- package/dist/template/app/(admin)/admin/roles/page.tsx +78 -0
- package/dist/template/app/(admin)/admin/scoring/page.tsx +236 -0
- package/dist/template/app/(admin)/admin/search/page.tsx +137 -0
- package/dist/template/app/(admin)/admin/sections/[key]/SectionEditor.tsx +35 -0
- package/dist/template/app/(admin)/admin/sections/[key]/page.tsx +72 -0
- package/dist/template/app/(admin)/admin/sections/page.tsx +129 -0
- package/dist/template/app/(admin)/admin/segments/page.tsx +272 -0
- package/dist/template/app/(admin)/admin/settings/ApiKeysCard.tsx +268 -0
- package/dist/template/app/(admin)/admin/settings/MailSettingsCard.tsx +796 -0
- package/dist/template/app/(admin)/admin/settings/PasswordForm.tsx +86 -0
- package/dist/template/app/(admin)/admin/settings/SettingsForm.tsx +206 -0
- package/dist/template/app/(admin)/admin/settings/WebhooksCard.tsx +292 -0
- package/dist/template/app/(admin)/admin/settings/page.tsx +483 -0
- package/dist/template/app/(admin)/admin/sharing/page.tsx +426 -0
- package/dist/template/app/(admin)/admin/shipping/page.tsx +144 -0
- package/dist/template/app/(admin)/admin/social/page.tsx +544 -0
- package/dist/template/app/(admin)/admin/subscriptions/[id]/page.tsx +41 -0
- package/dist/template/app/(admin)/admin/subscriptions/page.tsx +491 -0
- package/dist/template/app/(admin)/admin/tasks/page.tsx +312 -0
- package/dist/template/app/(admin)/admin/templates/[key]/CreateFromTemplateForm.tsx +47 -0
- package/dist/template/app/(admin)/admin/templates/[key]/EmailInboxPreview.tsx +65 -0
- package/dist/template/app/(admin)/admin/templates/[key]/TemplateEditor.tsx +37 -0
- package/dist/template/app/(admin)/admin/templates/[key]/page.tsx +128 -0
- package/dist/template/app/(admin)/admin/templates/page.tsx +63 -0
- package/dist/template/app/(admin)/admin/time/page.tsx +328 -0
- package/dist/template/app/(admin)/admin/traffic/funnel/page.tsx +184 -0
- package/dist/template/app/(admin)/admin/traffic/page.tsx +409 -0
- package/dist/template/app/(admin)/admin/translations/TranslationEditor.tsx +166 -0
- package/dist/template/app/(admin)/admin/translations/[locale]/[id]/page.tsx +151 -0
- package/dist/template/app/(admin)/admin/translations/page.tsx +189 -0
- package/dist/template/app/(admin)/admin/trash/page.tsx +108 -0
- package/dist/template/app/(admin)/admin/updates/UpdateActionForm.tsx +72 -0
- package/dist/template/app/(admin)/admin/updates/page.tsx +520 -0
- package/dist/template/app/(admin)/admin/voice-video/GuestInvite.tsx +39 -0
- package/dist/template/app/(admin)/admin/voice-video/HostJoin.tsx +26 -0
- package/dist/template/app/(admin)/admin/voice-video/VerifyConnection.tsx +28 -0
- package/dist/template/app/(admin)/admin/voice-video/page.tsx +372 -0
- package/dist/template/app/(admin)/admin/work/LiveRun.tsx +112 -0
- package/dist/template/app/(admin)/admin/work/WorkForms.tsx +310 -0
- package/dist/template/app/(admin)/admin/work/[id]/page.tsx +248 -0
- package/dist/template/app/(admin)/admin/work/approvals/page.tsx +151 -0
- package/dist/template/app/(admin)/admin/work/page.tsx +349 -0
- package/dist/template/app/(admin)/admin/work/playbooks/PlaybookForms.tsx +139 -0
- package/dist/template/app/(admin)/admin/work/playbooks/page.tsx +285 -0
- package/dist/template/app/(admin)/admin/work/spend/page.tsx +126 -0
- package/dist/template/app/(admin)/ads-actions.ts +355 -0
- package/dist/template/app/(admin)/advanced-money-actions.ts +163 -0
- package/dist/template/app/(admin)/analytics-actions.ts +70 -0
- package/dist/template/app/(admin)/approval-actions.ts +57 -0
- package/dist/template/app/(admin)/assessments-actions.ts +224 -0
- package/dist/template/app/(admin)/assistant-actions.ts +184 -0
- package/dist/template/app/(admin)/audience-actions.ts +139 -0
- package/dist/template/app/(admin)/automation-actions.ts +347 -0
- package/dist/template/app/(admin)/availability-actions.ts +99 -0
- package/dist/template/app/(admin)/booking-actions.ts +295 -0
- package/dist/template/app/(admin)/briefing-actions.ts +46 -0
- package/dist/template/app/(admin)/broadcast-actions.ts +155 -0
- package/dist/template/app/(admin)/builder-actions.ts +92 -0
- package/dist/template/app/(admin)/calculators-actions.ts +127 -0
- package/dist/template/app/(admin)/calendar-actions.ts +96 -0
- package/dist/template/app/(admin)/capture-actions.ts +191 -0
- package/dist/template/app/(admin)/catalog-actions.ts +1054 -0
- package/dist/template/app/(admin)/cms-actions.ts +637 -0
- package/dist/template/app/(admin)/connection-actions.ts +72 -0
- package/dist/template/app/(admin)/contact-import-actions.ts +158 -0
- package/dist/template/app/(admin)/contract-actions.ts +138 -0
- package/dist/template/app/(admin)/contribute-actions.ts +145 -0
- package/dist/template/app/(admin)/demo-actions.ts +49 -0
- package/dist/template/app/(admin)/design-actions.ts +71 -0
- package/dist/template/app/(admin)/document-actions.ts +153 -0
- package/dist/template/app/(admin)/entitlement-actions.ts +92 -0
- package/dist/template/app/(admin)/event-actions.ts +109 -0
- package/dist/template/app/(admin)/export-actions.ts +122 -0
- package/dist/template/app/(admin)/facts-actions.ts +135 -0
- package/dist/template/app/(admin)/first-party-plugin-actions.ts +475 -0
- package/dist/template/app/(admin)/forgot/ForgotForm.tsx +54 -0
- package/dist/template/app/(admin)/forgot/page.tsx +78 -0
- package/dist/template/app/(admin)/forms-actions.ts +108 -0
- package/dist/template/app/(admin)/gallery-actions.ts +227 -0
- package/dist/template/app/(admin)/guidance-actions.ts +55 -0
- package/dist/template/app/(admin)/import-actions.ts +142 -0
- package/dist/template/app/(admin)/inbox-actions.ts +146 -0
- package/dist/template/app/(admin)/invitation-actions.ts +139 -0
- package/dist/template/app/(admin)/invite/AcceptInvitationForm.tsx +71 -0
- package/dist/template/app/(admin)/invite/page.tsx +110 -0
- package/dist/template/app/(admin)/invoice-actions.ts +357 -0
- package/dist/template/app/(admin)/login/PasskeySignIn.tsx +32 -0
- package/dist/template/app/(admin)/login/SignInForm.tsx +61 -0
- package/dist/template/app/(admin)/login/page.tsx +96 -0
- package/dist/template/app/(admin)/login/verify/VerifyLogin.tsx +80 -0
- package/dist/template/app/(admin)/login/verify/page.tsx +46 -0
- package/dist/template/app/(admin)/loyalty-actions.ts +208 -0
- package/dist/template/app/(admin)/media-actions.ts +203 -0
- package/dist/template/app/(admin)/messaging-actions.ts +173 -0
- package/dist/template/app/(admin)/newsletter-actions.ts +98 -0
- package/dist/template/app/(admin)/note-actions.ts +114 -0
- package/dist/template/app/(admin)/notification-actions.ts +113 -0
- package/dist/template/app/(admin)/payment-actions.ts +118 -0
- package/dist/template/app/(admin)/paywall-actions.ts +77 -0
- package/dist/template/app/(admin)/pipeline-actions.ts +123 -0
- package/dist/template/app/(admin)/playbook-actions.ts +202 -0
- package/dist/template/app/(admin)/plugin-actions.ts +112 -0
- package/dist/template/app/(admin)/popup-actions.ts +169 -0
- package/dist/template/app/(admin)/project-actions.ts +476 -0
- package/dist/template/app/(admin)/quote-actions.ts +148 -0
- package/dist/template/app/(admin)/read-helpers.ts +21 -0
- package/dist/template/app/(admin)/recurring-actions.ts +116 -0
- package/dist/template/app/(admin)/referral-actions.ts +187 -0
- package/dist/template/app/(admin)/rental-actions.ts +75 -0
- package/dist/template/app/(admin)/report-actions.ts +63 -0
- package/dist/template/app/(admin)/reset/ResetForm.tsx +68 -0
- package/dist/template/app/(admin)/reset/page.tsx +74 -0
- package/dist/template/app/(admin)/reset-actions.ts +59 -0
- package/dist/template/app/(admin)/retention-actions.ts +64 -0
- package/dist/template/app/(admin)/review-actions.ts +83 -0
- package/dist/template/app/(admin)/scoring-actions.ts +109 -0
- package/dist/template/app/(admin)/security/SecurityControls.tsx +240 -0
- package/dist/template/app/(admin)/security/labels.ts +24 -0
- package/dist/template/app/(admin)/security/page.tsx +51 -0
- package/dist/template/app/(admin)/security/verify/StepUpForm.tsx +69 -0
- package/dist/template/app/(admin)/security/verify/page.tsx +44 -0
- package/dist/template/app/(admin)/security-actions.ts +285 -0
- package/dist/template/app/(admin)/segment-actions.ts +144 -0
- package/dist/template/app/(admin)/seo-actions.ts +61 -0
- package/dist/template/app/(admin)/settings-module-actions.ts +37 -0
- package/dist/template/app/(admin)/share-actions.ts +116 -0
- package/dist/template/app/(admin)/social-actions.ts +211 -0
- package/dist/template/app/(admin)/subscription-actions.ts +154 -0
- package/dist/template/app/(admin)/task-actions.ts +118 -0
- package/dist/template/app/(admin)/template-actions.ts +92 -0
- package/dist/template/app/(admin)/time-actions.ts +175 -0
- package/dist/template/app/(admin)/translation-actions.ts +107 -0
- package/dist/template/app/(admin)/trash-actions.ts +89 -0
- package/dist/template/app/(admin)/view-actions.ts +111 -0
- package/dist/template/app/(admin)/work-actions.ts +274 -0
- package/dist/template/app/(preview)/canvas-bridge.ts +885 -0
- package/dist/template/app/(preview)/layout.tsx +193 -0
- package/dist/template/app/(preview)/preview/page/[id]/page.tsx +63 -0
- package/dist/template/app/(preview)/preview/popup/[id]/page.tsx +59 -0
- package/dist/template/app/(preview)/preview/product/[id]/page.tsx +41 -0
- package/dist/template/app/(preview)/preview/project/[id]/page.tsx +41 -0
- package/dist/template/app/(preview)/preview/section/[key]/page.tsx +63 -0
- package/dist/template/app/(preview)/preview/share/[token]/page.tsx +48 -0
- package/dist/template/app/(preview)/preview/template/[key]/page.tsx +57 -0
- package/dist/template/app/(public)/AnalyticsConsentControl.tsx +92 -0
- package/dist/template/app/(public)/AnalyticsRuntime.tsx +85 -0
- package/dist/template/app/(public)/NativeShare.tsx +48 -0
- package/dist/template/app/(public)/ShareBar.tsx +101 -0
- package/dist/template/app/(public)/[[...slug]]/alternates.ts +59 -0
- package/dist/template/app/(public)/[[...slug]]/page.tsx +541 -0
- package/dist/template/app/(public)/[[...slug]]/pageview.ts +88 -0
- package/dist/template/app/(public)/assessment-actions.ts +86 -0
- package/dist/template/app/(public)/book/actions.ts +38 -0
- package/dist/template/app/(public)/book/page.tsx +64 -0
- package/dist/template/app/(public)/browse/FacetPanel.tsx +285 -0
- package/dist/template/app/(public)/browse/SearchBox.tsx +42 -0
- package/dist/template/app/(public)/browse/SortLinks.tsx +58 -0
- package/dist/template/app/(public)/browse-params.ts +336 -0
- package/dist/template/app/(public)/buy/AddToCart.tsx +123 -0
- package/dist/template/app/(public)/buy/buy-actions.ts +96 -0
- package/dist/template/app/(public)/c/[slug]/CollectionGrid.tsx +130 -0
- package/dist/template/app/(public)/c/[slug]/page.tsx +344 -0
- package/dist/template/app/(public)/cart/cart-actions.ts +103 -0
- package/dist/template/app/(public)/cart/page.tsx +235 -0
- package/dist/template/app/(public)/checkout/DeliveryMethods.tsx +109 -0
- package/dist/template/app/(public)/checkout/checkout-actions.ts +183 -0
- package/dist/template/app/(public)/checkout/page.tsx +363 -0
- package/dist/template/app/(public)/community/[slug]/page.tsx +261 -0
- package/dist/template/app/(public)/community-actions.ts +108 -0
- package/dist/template/app/(public)/contribute/page.tsx +153 -0
- package/dist/template/app/(public)/contribute-actions.ts +48 -0
- package/dist/template/app/(public)/form-actions.ts +69 -0
- package/dist/template/app/(public)/gift-actions.ts +33 -0
- package/dist/template/app/(public)/gifts/[slug]/page.tsx +102 -0
- package/dist/template/app/(public)/inbound-actions.ts +114 -0
- package/dist/template/app/(public)/layout.tsx +225 -0
- package/dist/template/app/(public)/memberships/actions.ts +23 -0
- package/dist/template/app/(public)/memberships/page.tsx +27 -0
- package/dist/template/app/(public)/newsletter-actions.ts +32 -0
- package/dist/template/app/(public)/orders/confirm/page.tsx +173 -0
- package/dist/template/app/(public)/search/page.tsx +233 -0
- package/dist/template/app/(public)/share-actions.ts +70 -0
- package/dist/template/app/(public)/shopper-cart.ts +98 -0
- package/dist/template/app/.well-known/freeholder/route.ts +94 -0
- package/dist/template/app/README.md +30 -0
- package/dist/template/app/ads.txt/route.ts +18 -0
- package/dist/template/app/api/ads/third-party-consent/route.ts +64 -0
- package/dist/template/app/api/ads/view/route.ts +58 -0
- package/dist/template/app/api/analytics/consent/route.ts +168 -0
- package/dist/template/app/api/analytics/export/route.ts +36 -0
- package/dist/template/app/api/analytics/vitals/route.ts +62 -0
- package/dist/template/app/api/auth/login/route.ts +31 -0
- package/dist/template/app/api/auth/login/verify/route.ts +66 -0
- package/dist/template/app/api/auth/logout/route.ts +18 -0
- package/dist/template/app/api/auth/session/route.ts +57 -0
- package/dist/template/app/api/chat/assistant/route.ts +51 -0
- package/dist/template/app/api/chat/route.ts +82 -0
- package/dist/template/app/api/cms/defaults/route.ts +20 -0
- package/dist/template/app/api/connections/calendar/[provider]/callback/route.ts +117 -0
- package/dist/template/app/api/connections/mail-read/[provider]/callback/route.ts +114 -0
- package/dist/template/app/api/connections/signup-contacts/[provider]/callback/route.ts +58 -0
- package/dist/template/app/api/doctor/route.ts +34 -0
- package/dist/template/app/api/health/live/route.ts +11 -0
- package/dist/template/app/api/health/route.ts +56 -0
- package/dist/template/app/api/mail/oauth/[provider]/callback/route.ts +80 -0
- package/dist/template/app/api/mail/webhooks/postmark/route.ts +7 -0
- package/dist/template/app/api/mail/webhooks/resend/route.ts +7 -0
- package/dist/template/app/api/mail/webhooks/ses/route.ts +7 -0
- package/dist/template/app/api/mcp/route.ts +42 -0
- package/dist/template/app/api/media/route.ts +58 -0
- package/dist/template/app/api/media/uploads/abort/route.ts +6 -0
- package/dist/template/app/api/media/uploads/complete/route.ts +6 -0
- package/dist/template/app/api/media/uploads/parts/route.ts +6 -0
- package/dist/template/app/api/media/uploads/route.ts +7 -0
- package/dist/template/app/api/openapi.json/route.ts +38 -0
- package/dist/template/app/api/payments/webhooks/flutterwave/route.ts +6 -0
- package/dist/template/app/api/payments/webhooks/mollie/route.ts +6 -0
- package/dist/template/app/api/payments/webhooks/paypal/route.ts +6 -0
- package/dist/template/app/api/payments/webhooks/paystack/route.ts +6 -0
- package/dist/template/app/api/payments/webhooks/razorpay/route.ts +6 -0
- package/dist/template/app/api/payments/webhooks/square/route.ts +6 -0
- package/dist/template/app/api/payments/webhooks/stripe/route.ts +6 -0
- package/dist/template/app/api/plugins/voice-video/webhooks/paradise/route.ts +45 -0
- package/dist/template/app/api/popups/route.ts +141 -0
- package/dist/template/app/api/security/csp-report/route.ts +50 -0
- package/dist/template/app/api/setup/owner/route.ts +19 -0
- package/dist/template/app/api/sms/webhooks/twilio/route.ts +6 -0
- package/dist/template/app/api/social/[provider]/callback/route.ts +70 -0
- package/dist/template/app/api/v1/[service]/route.ts +22 -0
- package/dist/template/app/app-ads.txt/route.ts +18 -0
- package/dist/template/app/capture/[token]/page.tsx +71 -0
- package/dist/template/app/embed/booking/page.tsx +7 -0
- package/dist/template/app/embed/gallery/[slug]/page.tsx +52 -0
- package/dist/template/app/embed/layout.tsx +13 -0
- package/dist/template/app/embed/newsletter/[id]/page.tsx +65 -0
- package/dist/template/app/embed/newsletter/actions.ts +25 -0
- package/dist/template/app/embed/reviews/page.tsx +51 -0
- package/dist/template/app/feeds/[kind]/route.ts +39 -0
- package/dist/template/app/g/[slug]/archive/route.ts +41 -0
- package/dist/template/app/g/[slug]/download/[itemId]/route.ts +39 -0
- package/dist/template/app/g/[slug]/page.tsx +331 -0
- package/dist/template/app/g/[slug]/view/[itemId]/route.ts +51 -0
- package/dist/template/app/g/actions.ts +211 -0
- package/dist/template/app/gift/[token]/page.tsx +61 -0
- package/dist/template/app/globals.css +148 -0
- package/dist/template/app/go/ad/route.ts +113 -0
- package/dist/template/app/i18n.ts +73 -0
- package/dist/template/app/ics/bookings/[token]/route.ts +42 -0
- package/dist/template/app/ics/calendars/[token]/route.ts +44 -0
- package/dist/template/app/ics/events/[slug]/route.ts +23 -0
- package/dist/template/app/indexnow-key/route.ts +25 -0
- package/dist/template/app/layout.tsx +66 -0
- package/dist/template/app/llms-full.txt/route.ts +14 -0
- package/dist/template/app/llms.txt/route.ts +102 -0
- package/dist/template/app/manifest.ts +69 -0
- package/dist/template/app/media/[...key]/route.ts +48 -0
- package/dist/template/app/media/download/[id]/route.ts +48 -0
- package/dist/template/app/newsletters/confirm/route.ts +26 -0
- package/dist/template/app/not-found.tsx +29 -0
- package/dist/template/app/og/[[...slug]]/route.tsx +54 -0
- package/dist/template/app/og/og-template.tsx +81 -0
- package/dist/template/app/playground/actions.ts +18 -0
- package/dist/template/app/playground/page.tsx +29 -0
- package/dist/template/app/portal/(account)/[section]/page.tsx +113 -0
- package/dist/template/app/portal/(account)/layout.tsx +108 -0
- package/dist/template/app/portal/(account)/messages/[id]/page.tsx +120 -0
- package/dist/template/app/portal/(account)/page.tsx +112 -0
- package/dist/template/app/portal/(account)/profile/page.tsx +139 -0
- package/dist/template/app/portal/(account)/records/[section]/[id]/actions.ts +25 -0
- package/dist/template/app/portal/(account)/records/[section]/[id]/page.tsx +24 -0
- package/dist/template/app/portal/(account)/subscriptions/[id]/page.tsx +169 -0
- package/dist/template/app/portal/PortalLocaleChooser.tsx +69 -0
- package/dist/template/app/portal/actions.ts +323 -0
- package/dist/template/app/portal/agreements/[token]/page.tsx +151 -0
- package/dist/template/app/portal/agreements/actions.ts +81 -0
- package/dist/template/app/portal/appointments/[token]/intake/page.tsx +98 -0
- package/dist/template/app/portal/appointments/[token]/page.tsx +210 -0
- package/dist/template/app/portal/appointments/actions.ts +131 -0
- package/dist/template/app/portal/appointments/moved/page.tsx +30 -0
- package/dist/template/app/portal/contact-import/DeviceContactPicker.tsx +119 -0
- package/dist/template/app/portal/contact-import/[id]/page.tsx +170 -0
- package/dist/template/app/portal/contact-import/actions.ts +193 -0
- package/dist/template/app/portal/contact-import/page.tsx +298 -0
- package/dist/template/app/portal/files/[id]/route.ts +50 -0
- package/dist/template/app/portal/invoices/InvoiceView.tsx +64 -0
- package/dist/template/app/portal/invoices/PaymentButton.tsx +10 -0
- package/dist/template/app/portal/invoices/[id]/page.tsx +37 -0
- package/dist/template/app/portal/invoices/actions.ts +52 -0
- package/dist/template/app/portal/invoices/confirmation/[token]/page.tsx +41 -0
- package/dist/template/app/portal/invoices/loading.tsx +7 -0
- package/dist/template/app/portal/login/MagicLinkForm.tsx +30 -0
- package/dist/template/app/portal/login/page.tsx +76 -0
- package/dist/template/app/portal/magic/confirm/ConfirmMagicLink.tsx +24 -0
- package/dist/template/app/portal/magic/confirm/page.tsx +46 -0
- package/dist/template/app/portal/magic/route.ts +36 -0
- package/dist/template/app/portal/message-actions.ts +51 -0
- package/dist/template/app/portal/privacy/PortalPrivacyCentre.tsx +209 -0
- package/dist/template/app/portal/privacy/page.tsx +147 -0
- package/dist/template/app/portal/quotes/[token]/page.tsx +324 -0
- package/dist/template/app/portal/quotes/accepted/page.tsx +30 -0
- package/dist/template/app/portal/quotes/actions.ts +145 -0
- package/dist/template/app/portal/quotes/partner/[token]/page.tsx +128 -0
- package/dist/template/app/portal/registry/actions.ts +34 -0
- package/dist/template/app/portal/registry/page.tsx +81 -0
- package/dist/template/app/portal/subscription-actions.ts +69 -0
- package/dist/template/app/privacy/artifacts/[id]/route.ts +38 -0
- package/dist/template/app/registry/[token]/page.tsx +67 -0
- package/dist/template/app/report-exports/[token]/route.ts +45 -0
- package/dist/template/app/robots.txt/route.ts +18 -0
- package/dist/template/app/s/[ref]/route.ts +41 -0
- package/dist/template/app/setup/OwnerForm.tsx +87 -0
- package/dist/template/app/setup/Steps.tsx +55 -0
- package/dist/template/app/setup/access.ts +15 -0
- package/dist/template/app/setup/actions.ts +203 -0
- package/dist/template/app/setup/business/BusinessForm.tsx +170 -0
- package/dist/template/app/setup/business/page.tsx +41 -0
- package/dist/template/app/setup/businessLabels.ts +113 -0
- package/dist/template/app/setup/done/DoneForm.tsx +33 -0
- package/dist/template/app/setup/done/MailReadiness.tsx +137 -0
- package/dist/template/app/setup/done/page.tsx +90 -0
- package/dist/template/app/setup/layout.tsx +48 -0
- package/dist/template/app/setup/location/LocationStepForm.tsx +110 -0
- package/dist/template/app/setup/location/page.tsx +61 -0
- package/dist/template/app/setup/page.tsx +50 -0
- package/dist/template/app/setup/security/page.tsx +29 -0
- package/dist/template/app/share/route.ts +60 -0
- package/dist/template/app/sitemap.xml/route.ts +31 -0
- package/dist/template/app/sitemaps/[locale]/route.ts +56 -0
- package/dist/template/app/source/route.ts +67 -0
- package/dist/template/app/theme.ts +54 -0
- package/dist/template/app/themeLabels.ts +26 -0
- package/dist/template/app/unsubscribe/route.ts +49 -0
- package/dist/template/db/README.md +21 -0
- package/dist/template/db/migrations/0000_reviewed-baseline.sql +7342 -0
- package/dist/template/db/migrations/0001_community_rooms.sql +46 -0
- package/dist/template/db/migrations/0002_voice_video_rooms.sql +41 -0
- package/dist/template/db/migrations/0003_print_on_demand_fulfillment.sql +21 -0
- package/dist/template/db/migrations/0004_marketplace_channel_sync.sql +23 -0
- package/dist/template/db/migrations/0005_retention_policies.sql +14 -0
- package/dist/template/db/migrations/0006_contact_pagination.sql +5 -0
- package/dist/template/db/migrations/0007_marketplace_sync_lease.sql +6 -0
- package/dist/template/db/migrations/0008_printify_live_fulfillment.sql +21 -0
- package/dist/template/db/migrations/0009_daily_voice_video.sql +14 -0
- package/dist/template/db/migrations/0010_note_task_trash.sql +10 -0
- package/dist/template/db/migrations/0011_record_trash.sql +22 -0
- package/dist/template/db/migrations/0012_owner_storage_refunds.sql +41 -0
- package/dist/template/db/migrations/0013_assessments.sql +119 -0
- package/dist/template/db/migrations/0014_attestations.sql +67 -0
- package/dist/template/db/migrations/0015_media_consents.sql +108 -0
- package/dist/template/db/migrations/0016_calculators.sql +31 -0
- package/dist/template/db/migrations/0017_postal_service_areas.sql +22 -0
- package/dist/template/db/migrations/0018_area_delivery_windows.sql +17 -0
- package/dist/template/db/migrations/0019_paradise_voice_video.sql +15 -0
- package/dist/template/db/migrations/0020_collections.sql +54 -0
- package/dist/template/db/migrations/0021_order_payment_milestones.sql +21 -0
- package/dist/template/db/migrations/0022_customer_surfaces.sql +31 -0
- package/dist/template/db/migrations/0023_gallery_private_delivery.sql +13 -0
- package/dist/template/db/migrations/0024_broadcast_unsubscribe.sql +11 -0
- package/dist/template/db/migrations/meta/0000_snapshot.json +53876 -0
- package/dist/template/db/migrations/meta/_journal.json +181 -0
- package/dist/template/deploy/README.md +130 -0
- package/dist/template/deploy/accessibility-testing.md +77 -0
- package/dist/template/deploy/agent-launch.md +129 -0
- package/dist/template/deploy/alt-text-suggestions.md +75 -0
- package/dist/template/deploy/analytics-governance.md +81 -0
- package/dist/template/deploy/app-store-privacy.md +82 -0
- package/dist/template/deploy/background-jobs.md +229 -0
- package/dist/template/deploy/browser-journeys.md +78 -0
- package/dist/template/deploy/c11-08-restore-drill-2026-09-28.log +41 -0
- package/dist/template/deploy/c11-08-restore-summary.md +113 -0
- package/dist/template/deploy/c224-editor-ux-audit-2026-09-29.md +120 -0
- package/dist/template/deploy/c313-live-acceptance-2026-09-28.log +219 -0
- package/dist/template/deploy/c313-live-acceptance-2026-09-28.md +83 -0
- package/dist/template/deploy/c324-storefront-parity-2026-09-29.md +168 -0
- package/dist/template/deploy/catalog-cart-access.md +35 -0
- package/dist/template/deploy/catalog-checkout-milestones.md +56 -0
- package/dist/template/deploy/ci-release-gate.md +83 -0
- package/dist/template/deploy/client-readiness.md +49 -0
- package/dist/template/deploy/commerce-catalog.md +119 -0
- package/dist/template/deploy/commerce-money.md +191 -0
- package/dist/template/deploy/commerce-payments.md +226 -0
- package/dist/template/deploy/content-security-policy.md +84 -0
- package/dist/template/deploy/contribute.md +37 -0
- package/dist/template/deploy/customer-locales.md +82 -0
- package/dist/template/deploy/customer-surfaces-2026-10-07.md +90 -0
- package/dist/template/deploy/customization-seams.md +18 -0
- package/dist/template/deploy/demo-scenarios.md +96 -0
- package/dist/template/deploy/digitalocean-app/.env.example +15 -0
- package/dist/template/deploy/digitalocean-app/README.md +26 -0
- package/dist/template/deploy/digitalocean-app/infra/app.yaml +75 -0
- package/dist/template/deploy/digitalocean-app/migrate.md +10 -0
- package/dist/template/deploy/digitalocean-app/recipe.yaml +40 -0
- package/dist/template/deploy/digitalocean-app/verify.md +10 -0
- package/dist/template/deploy/digitalocean-droplet/.env.example +21 -0
- package/dist/template/deploy/digitalocean-droplet/README.md +145 -0
- package/dist/template/deploy/digitalocean-droplet/deploy.md +89 -0
- package/dist/template/deploy/digitalocean-droplet/infra/Caddyfile +12 -0
- package/dist/template/deploy/digitalocean-droplet/infra/backup.sh +52 -0
- package/dist/template/deploy/digitalocean-droplet/infra/cloud-init.yml +46 -0
- package/dist/template/deploy/digitalocean-droplet/infra/compose.yml +65 -0
- package/dist/template/deploy/digitalocean-droplet/migrate.md +9 -0
- package/dist/template/deploy/digitalocean-droplet/recipe.yaml +47 -0
- package/dist/template/deploy/digitalocean-droplet/verify.md +117 -0
- package/dist/template/deploy/doc-claim-mapping.md +261 -0
- package/dist/template/deploy/docker-selfhost/.env.example +15 -0
- package/dist/template/deploy/docker-selfhost/README.md +28 -0
- package/dist/template/deploy/docker-selfhost/docker-updater/Caddyfile +9 -0
- package/dist/template/deploy/docker-selfhost/docker-updater/README.md +121 -0
- package/dist/template/deploy/docker-selfhost/docker-updater/compose.yml +64 -0
- package/dist/template/deploy/docker-selfhost/docker-updater/config.example.json +10 -0
- package/dist/template/deploy/docker-selfhost/docker-updater/freeholder-update-check.service +11 -0
- package/dist/template/deploy/docker-selfhost/docker-updater/freeholder-update-check.timer +10 -0
- package/dist/template/deploy/docker-selfhost/docker-updater/freeholder-updater.service +20 -0
- package/dist/template/deploy/docker-selfhost/infra/compose.yml +41 -0
- package/dist/template/deploy/docker-selfhost/migrate.md +9 -0
- package/dist/template/deploy/docker-selfhost/playground/README.md +76 -0
- package/dist/template/deploy/docker-selfhost/playground/compose.proxy-overlay.yml +14 -0
- package/dist/template/deploy/docker-selfhost/playground/compose.yml +59 -0
- package/dist/template/deploy/docker-selfhost/playground/demo.freeholder.ai.caddy +10 -0
- package/dist/template/deploy/docker-selfhost/playground/freeholder-playground-reset.service +10 -0
- package/dist/template/deploy/docker-selfhost/playground/freeholder-playground-reset.timer +10 -0
- package/dist/template/deploy/docker-selfhost/playground/reset.sh +17 -0
- package/dist/template/deploy/docker-selfhost/recipe.yaml +42 -0
- package/dist/template/deploy/docker-selfhost/verify.md +9 -0
- package/dist/template/deploy/edge-adapters.md +58 -0
- package/dist/template/deploy/event-outbox.md +80 -0
- package/dist/template/deploy/f-criteria-matrix.md +4649 -0
- package/dist/template/deploy/first-party-plugins.md +219 -0
- package/dist/template/deploy/fork-lane.md +93 -0
- package/dist/template/deploy/host-updater.example.json +23 -0
- package/dist/template/deploy/host-updater.md +107 -0
- package/dist/template/deploy/mail-delivery.md +205 -0
- package/dist/template/deploy/media-lifecycle.md +129 -0
- package/dist/template/deploy/migration-runbook.md +117 -0
- package/dist/template/deploy/n1-schema.md +34 -0
- package/dist/template/deploy/notification-fanout.md +92 -0
- package/dist/template/deploy/ownership-recovery.md +193 -0
- package/dist/template/deploy/perf-reference-run-2026-09-27.log +432 -0
- package/dist/template/deploy/performance-measurements.md +234 -0
- package/dist/template/deploy/play-data-safety.md +73 -0
- package/dist/template/deploy/privacy-rights.md +148 -0
- package/dist/template/deploy/provider-recording-erasure.md +102 -0
- package/dist/template/deploy/push-notifications.md +92 -0
- package/dist/template/deploy/railway/.env.example +15 -0
- package/dist/template/deploy/railway/README.md +24 -0
- package/dist/template/deploy/railway/migrate.md +10 -0
- package/dist/template/deploy/railway/recipe.yaml +35 -0
- package/dist/template/deploy/railway/verify.md +9 -0
- package/dist/template/deploy/recipe-verification.md +23 -0
- package/dist/template/deploy/record-trash.md +115 -0
- package/dist/template/deploy/release-channels.md +27 -0
- package/dist/template/deploy/release-feed.md +53 -0
- package/dist/template/deploy/release-notes-2026-09-14.md +86 -0
- package/dist/template/deploy/release-notes-2026-09-15.md +52 -0
- package/dist/template/deploy/release-notes-2026-09-16.md +114 -0
- package/dist/template/deploy/release-notes-2026-09-26.md +209 -0
- package/dist/template/deploy/release-notes-2026-09-27.md +47 -0
- package/dist/template/deploy/release-notes-2026-09-28.md +142 -0
- package/dist/template/deploy/release-notes-2026-09-29.md +138 -0
- package/dist/template/deploy/release-notes-2026-09-30.md +50 -0
- package/dist/template/deploy/release-notes-2026-10-01.md +112 -0
- package/dist/template/deploy/release-readiness.md +46 -0
- package/dist/template/deploy/render/.env.example +15 -0
- package/dist/template/deploy/render/README.md +22 -0
- package/dist/template/deploy/render/migrate.md +10 -0
- package/dist/template/deploy/render/recipe.yaml +40 -0
- package/dist/template/deploy/render/verify.md +9 -0
- package/dist/template/deploy/replit/.env.example +10 -0
- package/dist/template/deploy/replit/README.md +29 -0
- package/dist/template/deploy/replit/migrate.md +10 -0
- package/dist/template/deploy/replit/recipe.yaml +40 -0
- package/dist/template/deploy/replit/verify.md +10 -0
- package/dist/template/deploy/role-guidance.md +77 -0
- package/dist/template/deploy/spec-reconciliation.md +188 -0
- package/dist/template/deploy/stable-acceptance-2026-10-05.md +168 -0
- package/dist/template/deploy/update-admin.md +83 -0
- package/dist/template/deploy/update-apply.md +48 -0
- package/dist/template/deploy/update-checks.md +27 -0
- package/dist/template/deploy/update-escalation.md +71 -0
- package/dist/template/deploy/update-policy.md +20 -0
- package/dist/template/deploy/update-preflight.md +19 -0
- package/dist/template/deploy/update-status.md +78 -0
- package/dist/template/deploy/update-targets.md +90 -0
- package/dist/template/deploy/webhook-delivery.md +36 -0
- package/dist/template/drizzle.config.ts +24 -0
- package/dist/template/eslint.config.mjs +241 -0
- package/dist/template/freeholder.config.ts +11 -0
- package/dist/template/gitignore.template +48 -0
- package/dist/template/instrumentation.node.ts +113 -0
- package/dist/template/instrumentation.ts +23 -0
- package/dist/template/locales/README.md +68 -0
- package/dist/template/locales/ar.json +7090 -0
- package/dist/template/locales/en.json +7090 -0
- package/dist/template/locales/es.json +7090 -0
- package/dist/template/locales/fr.json +7090 -0
- package/dist/template/next.config.ts +166 -0
- package/dist/template/package.json +98 -0
- package/dist/template/packages/README.md +31 -0
- package/dist/template/packages/cli/LICENSE +202 -0
- package/dist/template/packages/cli/README.md +63 -0
- package/dist/template/packages/cli/package.json +29 -0
- package/dist/template/packages/cli/src/index.ts +355 -0
- package/dist/template/packages/cli/tsconfig.json +15 -0
- package/dist/template/packages/create-freeholder/LICENSE +202 -0
- package/dist/template/packages/create-freeholder/README.md +31 -0
- package/dist/template/packages/create-freeholder/package.json +29 -0
- package/dist/template/packages/create-freeholder/scripts/build.mjs +151 -0
- package/dist/template/packages/create-freeholder/src/index.ts +789 -0
- package/dist/template/packages/create-freeholder/tsconfig.json +15 -0
- package/dist/template/packages/freeholder-app/LICENSE +202 -0
- package/dist/template/packages/freeholder-app/README.md +72 -0
- package/dist/template/packages/freeholder-app/package.json +29 -0
- package/dist/template/packages/freeholder-app/src/assets.ts +320 -0
- package/dist/template/packages/freeholder-app/src/branding.ts +134 -0
- package/dist/template/packages/freeholder-app/src/config.ts +163 -0
- package/dist/template/packages/freeholder-app/src/index.ts +158 -0
- package/dist/template/packages/freeholder-app/src/init.ts +230 -0
- package/dist/template/packages/freeholder-app/src/png.ts +214 -0
- package/dist/template/packages/freeholder-app/tsconfig.json +15 -0
- package/dist/template/packages/mobile-app/LICENSE +202 -0
- package/dist/template/packages/mobile-app/README.md +137 -0
- package/dist/template/packages/mobile-app/package.json +34 -0
- package/dist/template/packages/mobile-app/src/branding.ts +91 -0
- package/dist/template/packages/mobile-app/src/cached-discovery.ts +36 -0
- package/dist/template/packages/mobile-app/src/capture-batches.ts +558 -0
- package/dist/template/packages/mobile-app/src/capture.ts +262 -0
- package/dist/template/packages/mobile-app/src/deep-links.ts +246 -0
- package/dist/template/packages/mobile-app/src/discovery.ts +195 -0
- package/dist/template/packages/mobile-app/src/format.ts +10 -0
- package/dist/template/packages/mobile-app/src/index.ts +122 -0
- package/dist/template/packages/mobile-app/src/messages.generated.ts +677 -0
- package/dist/template/packages/mobile-app/src/offline.ts +183 -0
- package/dist/template/packages/mobile-app/src/private-cache.ts +113 -0
- package/dist/template/packages/mobile-app/src/screens.ts +411 -0
- package/dist/template/packages/mobile-app/src/session.ts +317 -0
- package/dist/template/packages/mobile-app/src/strings.ts +11 -0
- package/dist/template/packages/mobile-app/src/transport.ts +50 -0
- package/dist/template/packages/mobile-app/tsconfig.json +15 -0
- package/dist/template/packages/plugin-kit/LICENSE +202 -0
- package/dist/template/packages/plugin-kit/README.md +11 -0
- package/dist/template/packages/plugin-kit/package.json +37 -0
- package/dist/template/packages/plugin-kit/src/contract.ts +169 -0
- package/dist/template/packages/plugin-kit/src/harness.ts +40 -0
- package/dist/template/packages/plugin-kit/src/importer.ts +37 -0
- package/dist/template/packages/plugin-kit/src/index.ts +41 -0
- package/dist/template/packages/plugin-kit/src/scaffold.ts +54 -0
- package/dist/template/packages/plugin-kit/src/semver.ts +78 -0
- package/dist/template/packages/plugin-kit/tsconfig.json +15 -0
- package/dist/template/packages/sdk/LICENSE +202 -0
- package/dist/template/packages/sdk/README.md +38 -0
- package/dist/template/packages/sdk/package.json +37 -0
- package/dist/template/packages/sdk/src/generated.ts +8557 -0
- package/dist/template/packages/sdk/src/index.ts +178 -0
- package/dist/template/packages/sdk/src/version.ts +4 -0
- package/dist/template/packages/sdk/test/generated.test.mjs +20 -0
- package/dist/template/packages/sdk/tsconfig.json +15 -0
- package/dist/template/packages/templates/LICENSE +202 -0
- package/dist/template/packages/templates/README.md +17 -0
- package/dist/template/packages/templates/package.json +37 -0
- package/dist/template/packages/templates/src/presets.ts +377 -0
- package/dist/template/packages/templates/tsconfig.json +14 -0
- package/dist/template/playwright.a11y.config.ts +109 -0
- package/dist/template/plugins/community/manifest.ts +19 -0
- package/dist/template/plugins/community/plugin.json +10 -0
- package/dist/template/plugins/community/schema.ts +116 -0
- package/dist/template/plugins/community/service.ts +996 -0
- package/dist/template/plugins/community/tables.ts +9 -0
- package/dist/template/plugins/gift-registry/manifest.ts +16 -0
- package/dist/template/plugins/gift-registry/plugin.json +10 -0
- package/dist/template/plugins/gift-registry/schema.ts +44 -0
- package/dist/template/plugins/gift-registry/service.ts +347 -0
- package/dist/template/plugins/gift-registry/tables.ts +3 -0
- package/dist/template/plugins/marketplace/adapter.ts +159 -0
- package/dist/template/plugins/marketplace/jobs.ts +37 -0
- package/dist/template/plugins/marketplace/manifest.ts +20 -0
- package/dist/template/plugins/marketplace/plugin.json +10 -0
- package/dist/template/plugins/marketplace/schema.ts +75 -0
- package/dist/template/plugins/marketplace/service.ts +642 -0
- package/dist/template/plugins/marketplace/shopify.ts +174 -0
- package/dist/template/plugins/marketplace/tables.ts +3 -0
- package/dist/template/plugins/print-on-demand/adapter.ts +86 -0
- package/dist/template/plugins/print-on-demand/jobs.ts +29 -0
- package/dist/template/plugins/print-on-demand/manifest.ts +21 -0
- package/dist/template/plugins/print-on-demand/plugin.json +10 -0
- package/dist/template/plugins/print-on-demand/printify.ts +139 -0
- package/dist/template/plugins/print-on-demand/schema.ts +54 -0
- package/dist/template/plugins/print-on-demand/service.ts +531 -0
- package/dist/template/plugins/print-on-demand/tables.ts +3 -0
- package/dist/template/plugins/social-fixture/adapter.ts +35 -0
- package/dist/template/plugins/social-fixture/manifest.ts +18 -0
- package/dist/template/plugins/social-fixture/plugin.json +10 -0
- package/dist/template/plugins/social-fixture/service.ts +9 -0
- package/dist/template/plugins/voice-video/adapter.ts +183 -0
- package/dist/template/plugins/voice-video/daily.ts +262 -0
- package/dist/template/plugins/voice-video/erasure.ts +93 -0
- package/dist/template/plugins/voice-video/jobs.ts +79 -0
- package/dist/template/plugins/voice-video/manifest.ts +34 -0
- package/dist/template/plugins/voice-video/paradise-provider.ts +157 -0
- package/dist/template/plugins/voice-video/paradise.ts +325 -0
- package/dist/template/plugins/voice-video/plugin.json +10 -0
- package/dist/template/plugins/voice-video/schema.ts +105 -0
- package/dist/template/plugins/voice-video/service.ts +1019 -0
- package/dist/template/plugins/voice-video/settings.ts +128 -0
- package/dist/template/plugins/voice-video/tables.ts +3 -0
- package/dist/template/plugins/voice-video/webhook.ts +134 -0
- package/dist/template/pnpm-lock.yaml +5386 -0
- package/dist/template/pnpm-workspace.yaml +81 -0
- package/dist/template/postcss.config.mjs +7 -0
- package/dist/template/proxy.ts +284 -0
- package/dist/template/public/fonts/OFL-JetBrains-Mono.txt +93 -0
- package/dist/template/public/fonts/OFL-Schibsted-Grotesk.txt +93 -0
- package/dist/template/public/fonts/jetbrains-mono-latin-ext.woff2 +0 -0
- package/dist/template/public/fonts/jetbrains-mono-latin.woff2 +0 -0
- package/dist/template/public/fonts/schibsted-grotesk-latin-ext.woff2 +0 -0
- package/dist/template/public/fonts/schibsted-grotesk-latin.woff2 +0 -0
- package/dist/template/render.yaml +46 -0
- package/dist/template/replit.nix +9 -0
- package/dist/template/scripts/README.md +69 -0
- package/dist/template/scripts/a11y-smoke.d.mts +24 -0
- package/dist/template/scripts/a11y-smoke.mjs +163 -0
- package/dist/template/scripts/changelog-gate.mjs +63 -0
- package/dist/template/scripts/contract-evidence.d.mts +8 -0
- package/dist/template/scripts/contract-evidence.mjs +18 -0
- package/dist/template/scripts/dependency-audit.d.mts +18 -0
- package/dist/template/scripts/dependency-audit.mjs +315 -0
- package/dist/template/scripts/deploy-droplet-remote.sh +138 -0
- package/dist/template/scripts/deploy-droplet.d.mts +59 -0
- package/dist/template/scripts/deploy-droplet.mjs +322 -0
- package/dist/template/scripts/docker-updater.py +524 -0
- package/dist/template/scripts/doctor.d.mts +3 -0
- package/dist/template/scripts/doctor.mjs +199 -0
- package/dist/template/scripts/f-matrix.d.mts +53 -0
- package/dist/template/scripts/f-matrix.mjs +298 -0
- package/dist/template/scripts/fast-gates.mjs +128 -0
- package/dist/template/scripts/generate-changelog.d.mts +16 -0
- package/dist/template/scripts/generate-changelog.mjs +95 -0
- package/dist/template/scripts/generate-mobile-messages.mjs +12 -0
- package/dist/template/scripts/generate-sdk.mjs +54 -0
- package/dist/template/scripts/host-updater.py +365 -0
- package/dist/template/scripts/launch-prepare.d.mts +14 -0
- package/dist/template/scripts/launch-prepare.mjs +93 -0
- package/dist/template/scripts/license-headers.mjs +169 -0
- package/dist/template/scripts/media-transfer.d.mts +19 -0
- package/dist/template/scripts/media-transfer.mjs +144 -0
- package/dist/template/scripts/mobile-store-gate.d.mts +72 -0
- package/dist/template/scripts/mobile-store-gate.mjs +569 -0
- package/dist/template/scripts/owner-password.mjs +107 -0
- package/dist/template/scripts/ownership-drill.d.mts +20 -0
- package/dist/template/scripts/ownership-drill.mjs +237 -0
- package/dist/template/scripts/ownership-export.mjs +46 -0
- package/dist/template/scripts/package-artifact-gate.mjs +291 -0
- package/dist/template/scripts/performance-budgets.d.mts +53 -0
- package/dist/template/scripts/performance-budgets.mjs +311 -0
- package/dist/template/scripts/plan-gate.d.mts +38 -0
- package/dist/template/scripts/plan-gate.mjs +515 -0
- package/dist/template/scripts/playground-gate.sh +47 -0
- package/dist/template/scripts/prepare-do-app-spec.d.mts +6 -0
- package/dist/template/scripts/prepare-do-app-spec.mjs +70 -0
- package/dist/template/scripts/public-gates.sh +186 -0
- package/dist/template/scripts/recipe-matrix.sh +141 -0
- package/dist/template/scripts/recipe-update-actions.mjs +157 -0
- package/dist/template/scripts/release-feed.d.mts +49 -0
- package/dist/template/scripts/release-feed.mjs +215 -0
- package/dist/template/scripts/release-history.d.mts +3 -0
- package/dist/template/scripts/release-history.mjs +27 -0
- package/dist/template/scripts/release-packages.d.mts +13 -0
- package/dist/template/scripts/release-packages.mjs +153 -0
- package/dist/template/scripts/release-publication.d.mts +7 -0
- package/dist/template/scripts/release-publication.mjs +58 -0
- package/dist/template/scripts/resolve-append-conflicts.mjs +132 -0
- package/dist/template/scripts/runtime-balanced-sequencer.ts +178 -0
- package/dist/template/scripts/schema-baseline-identity.d.mts +35 -0
- package/dist/template/scripts/schema-baseline-identity.mjs +373 -0
- package/dist/template/scripts/schema-compat-gate.d.mts +44 -0
- package/dist/template/scripts/schema-compat-gate.mjs +264 -0
- package/dist/template/scripts/seo-gate.d.mts +31 -0
- package/dist/template/scripts/seo-gate.mjs +326 -0
- package/dist/template/scripts/standalone-artifact-gate.mjs +163 -0
- package/dist/template/scripts/start-browser-server.mjs +29 -0
- package/dist/template/scripts/start-replit.mjs +16 -0
- package/dist/template/scripts/start.mjs +7 -0
- package/dist/template/scripts/upgrade-gate.sh +134 -0
- package/dist/template/scripts/verify-dependency-attestation.d.mts +13 -0
- package/dist/template/scripts/verify-dependency-attestation.mjs +93 -0
- package/dist/template/scripts/workflow-integrity-gate.d.mts +6 -0
- package/dist/template/scripts/workflow-integrity-gate.mjs +190 -0
- package/dist/template/security/adversarial-audit-2026-10-08.md +111 -0
- package/dist/template/security/client-readiness-audit-2026-09-21.md +273 -0
- package/dist/template/security/dependency-audit-exceptions.json +3 -0
- package/dist/template/security/independent-review-packet.md +369 -0
- package/dist/template/security/project-audit-2026-09-13.md +127 -0
- package/dist/template/seed/README.md +86 -0
- package/dist/template/seed/demo/content.ts +812 -0
- package/dist/template/src/README.md +19 -0
- package/dist/template/src/adapters/agent/index.ts +35 -0
- package/dist/template/src/adapters/agent/pm-brain.ts +125 -0
- package/dist/template/src/adapters/agent/types.ts +39 -0
- package/dist/template/src/adapters/agent/workforce-anthropic.ts +191 -0
- package/dist/template/src/adapters/agent/workforce-openai.ts +182 -0
- package/dist/template/src/adapters/agent/workforce-types.ts +80 -0
- package/dist/template/src/adapters/agent/workforce.ts +93 -0
- package/dist/template/src/adapters/ai/anthropic.ts +176 -0
- package/dist/template/src/adapters/ai/index.ts +41 -0
- package/dist/template/src/adapters/ai/none.ts +14 -0
- package/dist/template/src/adapters/ai/openai.ts +132 -0
- package/dist/template/src/adapters/ai/types.ts +28 -0
- package/dist/template/src/adapters/alt-text/index.ts +77 -0
- package/dist/template/src/adapters/alt-text/openai.ts +143 -0
- package/dist/template/src/adapters/alt-text/types.ts +30 -0
- package/dist/template/src/adapters/calendar/index.ts +12 -0
- package/dist/template/src/adapters/calendar/none.ts +18 -0
- package/dist/template/src/adapters/calendar/types.ts +43 -0
- package/dist/template/src/adapters/carrier/index.ts +12 -0
- package/dist/template/src/adapters/carrier/none.ts +18 -0
- package/dist/template/src/adapters/carrier/types.ts +60 -0
- package/dist/template/src/adapters/git/github.ts +82 -0
- package/dist/template/src/adapters/mail/console.ts +46 -0
- package/dist/template/src/adapters/mail/gmail.ts +44 -0
- package/dist/template/src/adapters/mail/http.ts +88 -0
- package/dist/template/src/adapters/mail/index.ts +255 -0
- package/dist/template/src/adapters/mail/mime.ts +57 -0
- package/dist/template/src/adapters/mail/none.ts +18 -0
- package/dist/template/src/adapters/mail/outlook.ts +71 -0
- package/dist/template/src/adapters/mail/postmark.ts +105 -0
- package/dist/template/src/adapters/mail/resend.ts +86 -0
- package/dist/template/src/adapters/mail/ses.ts +114 -0
- package/dist/template/src/adapters/mail/smtp.ts +85 -0
- package/dist/template/src/adapters/mail/types.ts +79 -0
- package/dist/template/src/adapters/malware/clamav.ts +90 -0
- package/dist/template/src/adapters/malware/index.ts +43 -0
- package/dist/template/src/adapters/malware/none.ts +16 -0
- package/dist/template/src/adapters/malware/types.ts +28 -0
- package/dist/template/src/adapters/notifications/index.ts +27 -0
- package/dist/template/src/adapters/notifications/none.ts +27 -0
- package/dist/template/src/adapters/notifications/types.ts +36 -0
- package/dist/template/src/adapters/payments/currency.ts +50 -0
- package/dist/template/src/adapters/payments/flutterwave.ts +239 -0
- package/dist/template/src/adapters/payments/http.ts +82 -0
- package/dist/template/src/adapters/payments/index.ts +42 -0
- package/dist/template/src/adapters/payments/manual.ts +59 -0
- package/dist/template/src/adapters/payments/mollie.ts +239 -0
- package/dist/template/src/adapters/payments/none.ts +38 -0
- package/dist/template/src/adapters/payments/paypal.ts +518 -0
- package/dist/template/src/adapters/payments/paystack.ts +206 -0
- package/dist/template/src/adapters/payments/provider-helpers.ts +122 -0
- package/dist/template/src/adapters/payments/providers.ts +31 -0
- package/dist/template/src/adapters/payments/razorpay.ts +246 -0
- package/dist/template/src/adapters/payments/square.ts +251 -0
- package/dist/template/src/adapters/payments/stripe.ts +462 -0
- package/dist/template/src/adapters/payments/types.ts +244 -0
- package/dist/template/src/adapters/point-of-sale/index.ts +21 -0
- package/dist/template/src/adapters/point-of-sale/manual.ts +35 -0
- package/dist/template/src/adapters/point-of-sale/none.ts +18 -0
- package/dist/template/src/adapters/point-of-sale/stripe.ts +112 -0
- package/dist/template/src/adapters/point-of-sale/types.ts +43 -0
- package/dist/template/src/adapters/registry.ts +46 -0
- package/dist/template/src/adapters/sms/index.ts +30 -0
- package/dist/template/src/adapters/sms/none.ts +24 -0
- package/dist/template/src/adapters/sms/twilio.ts +410 -0
- package/dist/template/src/adapters/sms/types.ts +140 -0
- package/dist/template/src/adapters/social/factory.ts +370 -0
- package/dist/template/src/adapters/social/http.ts +109 -0
- package/dist/template/src/adapters/social/index.ts +15 -0
- package/dist/template/src/adapters/social/media.ts +53 -0
- package/dist/template/src/adapters/social/networks.ts +174 -0
- package/dist/template/src/adapters/social/none.ts +37 -0
- package/dist/template/src/adapters/social/types.ts +130 -0
- package/dist/template/src/adapters/storage/index.ts +82 -0
- package/dist/template/src/adapters/storage/local.ts +164 -0
- package/dist/template/src/adapters/storage/replit.ts +114 -0
- package/dist/template/src/adapters/storage/s3.ts +298 -0
- package/dist/template/src/adapters/storage/types.ts +138 -0
- package/dist/template/src/adapters/tax/index.ts +10 -0
- package/dist/template/src/adapters/tax/none.ts +14 -0
- package/dist/template/src/adapters/tax/types.ts +60 -0
- package/dist/template/src/adapters/types.ts +60 -0
- package/dist/template/src/core/agents/budget-alerts.ts +73 -0
- package/dist/template/src/core/agents/budget.ts +162 -0
- package/dist/template/src/core/agents/cron.ts +77 -0
- package/dist/template/src/core/agents/envelope.ts +68 -0
- package/dist/template/src/core/agents/execution.ts +639 -0
- package/dist/template/src/core/agents/managed.ts +586 -0
- package/dist/template/src/core/agents/playbook-events.ts +77 -0
- package/dist/template/src/core/agents/playbook-params.ts +121 -0
- package/dist/template/src/core/agents/playbook-schedule.ts +305 -0
- package/dist/template/src/core/agents/playbooks.ts +579 -0
- package/dist/template/src/core/agents/previews.ts +86 -0
- package/dist/template/src/core/agents/pricing.ts +111 -0
- package/dist/template/src/core/agents/schema.ts +329 -0
- package/dist/template/src/core/agents/service.ts +1382 -0
- package/dist/template/src/core/agents/writes.ts +407 -0
- package/dist/template/src/core/api/dispatch.ts +131 -0
- package/dist/template/src/core/api/openapi.ts +246 -0
- package/dist/template/src/core/apikeys/profiles.ts +24 -0
- package/dist/template/src/core/apikeys/schema.ts +87 -0
- package/dist/template/src/core/apikeys/service.ts +245 -0
- package/dist/template/src/core/apikeys/tokens.ts +130 -0
- package/dist/template/src/core/attestations/schema.ts +118 -0
- package/dist/template/src/core/attestations/service.ts +354 -0
- package/dist/template/src/core/auth/bootstrap.ts +22 -0
- package/dist/template/src/core/auth/magic-links/service.ts +272 -0
- package/dist/template/src/core/auth/passwords.ts +52 -0
- package/dist/template/src/core/auth/reset.ts +238 -0
- package/dist/template/src/core/auth/schema.ts +318 -0
- package/dist/template/src/core/auth/service.ts +345 -0
- package/dist/template/src/core/auth/session-management/service.ts +314 -0
- package/dist/template/src/core/auth/sessions.ts +280 -0
- package/dist/template/src/core/auth/two-factor-crypto.ts +172 -0
- package/dist/template/src/core/auth/two-factor.ts +863 -0
- package/dist/template/src/core/automations/core-verbs.ts +86 -0
- package/dist/template/src/core/automations/verbs.ts +121 -0
- package/dist/template/src/core/boot.ts +231 -0
- package/dist/template/src/core/briefing/contributors.ts +288 -0
- package/dist/template/src/core/briefing/playbook-section.ts +136 -0
- package/dist/template/src/core/briefing/registry.ts +155 -0
- package/dist/template/src/core/briefing/schema.ts +124 -0
- package/dist/template/src/core/briefing/service.ts +425 -0
- package/dist/template/src/core/briefing/update.ts +24 -0
- package/dist/template/src/core/catalogue/schema.ts +136 -0
- package/dist/template/src/core/catalogue/service.ts +724 -0
- package/dist/template/src/core/config.test.ts +62 -0
- package/dist/template/src/core/config.ts +69 -0
- package/dist/template/src/core/connections/busy.ts +190 -0
- package/dist/template/src/core/connections/calendar-oauth.ts +323 -0
- package/dist/template/src/core/connections/calendar-providers.ts +352 -0
- package/dist/template/src/core/connections/calendar-sync.ts +558 -0
- package/dist/template/src/core/connections/calendar-write.ts +194 -0
- package/dist/template/src/core/connections/crypto.ts +200 -0
- package/dist/template/src/core/connections/grants.ts +322 -0
- package/dist/template/src/core/connections/mail-import.ts +380 -0
- package/dist/template/src/core/connections/mail-providers.ts +184 -0
- package/dist/template/src/core/connections/mail-read-oauth.ts +296 -0
- package/dist/template/src/core/connections/oauth-core.ts +472 -0
- package/dist/template/src/core/connections/schema.ts +250 -0
- package/dist/template/src/core/connections/service.ts +606 -0
- package/dist/template/src/core/contacts/custom-fields.ts +287 -0
- package/dist/template/src/core/contacts/duplicates.ts +359 -0
- package/dist/template/src/core/contacts/funnel.ts +30 -0
- package/dist/template/src/core/contacts/lifecycle.ts +91 -0
- package/dist/template/src/core/contacts/organizations.ts +214 -0
- package/dist/template/src/core/contacts/relationships.ts +477 -0
- package/dist/template/src/core/contacts/schema.ts +300 -0
- package/dist/template/src/core/contacts/service.ts +1401 -0
- package/dist/template/src/core/contract/json-schema.ts +39 -0
- package/dist/template/src/core/contract/projections.ts +58 -0
- package/dist/template/src/core/contract/sdk.ts +287 -0
- package/dist/template/src/core/contract.ts +20 -0
- package/dist/template/src/core/contribute/deliver.ts +274 -0
- package/dist/template/src/core/contribute/schema.ts +163 -0
- package/dist/template/src/core/contribute/service.ts +1072 -0
- package/dist/template/src/core/dates/cadence.ts +73 -0
- package/dist/template/src/core/db/columns.ts +32 -0
- package/dist/template/src/core/db/errors.ts +66 -0
- package/dist/template/src/core/db/index.ts +90 -0
- package/dist/template/src/core/demo/fixtures.ts +441 -0
- package/dist/template/src/core/demo/handler.ts +89 -0
- package/dist/template/src/core/demo/playground-policy.ts +73 -0
- package/dist/template/src/core/demo/playground.ts +55 -0
- package/dist/template/src/core/demo/schema.ts +135 -0
- package/dist/template/src/core/demo/service.ts +673 -0
- package/dist/template/src/core/design/read.ts +9 -0
- package/dist/template/src/core/design/schema.ts +33 -0
- package/dist/template/src/core/design/service.ts +280 -0
- package/dist/template/src/core/design/theme.ts +45 -0
- package/dist/template/src/core/design/tokens.ts +355 -0
- package/dist/template/src/core/discovery.ts +116 -0
- package/dist/template/src/core/doctor/index.ts +1169 -0
- package/dist/template/src/core/doctor/service.ts +44 -0
- package/dist/template/src/core/entitlements/access.ts +478 -0
- package/dist/template/src/core/entitlements/schema.ts +163 -0
- package/dist/template/src/core/entitlements/service.ts +590 -0
- package/dist/template/src/core/env.test.ts +148 -0
- package/dist/template/src/core/env.ts +442 -0
- package/dist/template/src/core/events/catalogue.ts +61 -0
- package/dist/template/src/core/events/index.ts +138 -0
- package/dist/template/src/core/events/outbox-service.ts +198 -0
- package/dist/template/src/core/events/outbox.ts +474 -0
- package/dist/template/src/core/events/schema.ts +152 -0
- package/dist/template/src/core/events/service.ts +37 -0
- package/dist/template/src/core/funnel/stages.ts +106 -0
- package/dist/template/src/core/guidance/definitions.ts +276 -0
- package/dist/template/src/core/guidance/schema.ts +107 -0
- package/dist/template/src/core/guidance/service.ts +530 -0
- package/dist/template/src/core/http/actor.ts +115 -0
- package/dist/template/src/core/http/body.ts +96 -0
- package/dist/template/src/core/http/cookies.ts +88 -0
- package/dist/template/src/core/http/csp.ts +118 -0
- package/dist/template/src/core/http/csrf.ts +89 -0
- package/dist/template/src/core/http/headers.ts +33 -0
- package/dist/template/src/core/http/inline-json.ts +20 -0
- package/dist/template/src/core/http/pinned-download.ts +118 -0
- package/dist/template/src/core/http/request-metadata.ts +48 -0
- package/dist/template/src/core/http/respond.ts +82 -0
- package/dist/template/src/core/http/route.ts +83 -0
- package/dist/template/src/core/i18n/customer.ts +187 -0
- package/dist/template/src/core/i18n/index.ts +286 -0
- package/dist/template/src/core/i18n/schema.ts +59 -0
- package/dist/template/src/core/i18n/service.ts +339 -0
- package/dist/template/src/core/i18n/zoned.ts +96 -0
- package/dist/template/src/core/ics.ts +260 -0
- package/dist/template/src/core/import/contacts-schema.ts +237 -0
- package/dist/template/src/core/import/contacts-service.ts +923 -0
- package/dist/template/src/core/import/contract.ts +135 -0
- package/dist/template/src/core/import/csv.ts +190 -0
- package/dist/template/src/core/import/parsers.ts +217 -0
- package/dist/template/src/core/import/service.ts +606 -0
- package/dist/template/src/core/import/signup-contact-providers.ts +219 -0
- package/dist/template/src/core/import/signup-contact-service.ts +1077 -0
- package/dist/template/src/core/import/vcard.ts +77 -0
- package/dist/template/src/core/invitations/service.ts +656 -0
- package/dist/template/src/core/jobs/core-jobs.ts +1000 -0
- package/dist/template/src/core/jobs/health.ts +264 -0
- package/dist/template/src/core/jobs/index.ts +926 -0
- package/dist/template/src/core/jobs/schema.ts +111 -0
- package/dist/template/src/core/jobs/service.ts +269 -0
- package/dist/template/src/core/locations/coverage.ts +152 -0
- package/dist/template/src/core/locations/jsonld.ts +155 -0
- package/dist/template/src/core/locations/nap.ts +159 -0
- package/dist/template/src/core/locations/read.ts +15 -0
- package/dist/template/src/core/locations/schema.ts +257 -0
- package/dist/template/src/core/locations/service.ts +667 -0
- package/dist/template/src/core/mail/link-confirmation.ts +31 -0
- package/dist/template/src/core/mail/oauth.ts +351 -0
- package/dist/template/src/core/mail/outbox-crypto.ts +73 -0
- package/dist/template/src/core/mail/route.ts +27 -0
- package/dist/template/src/core/mail/schema.ts +359 -0
- package/dist/template/src/core/mail/service.ts +1407 -0
- package/dist/template/src/core/mail/webhooks.ts +735 -0
- package/dist/template/src/core/manifest.ts +173 -0
- package/dist/template/src/core/media/capture.ts +1191 -0
- package/dist/template/src/core/media/framing.ts +265 -0
- package/dist/template/src/core/media/schema.ts +388 -0
- package/dist/template/src/core/media/service.ts +3321 -0
- package/dist/template/src/core/media/validation.ts +264 -0
- package/dist/template/src/core/media/variants.ts +213 -0
- package/dist/template/src/core/media/watermark.ts +158 -0
- package/dist/template/src/core/messaging/chat-cookie.ts +30 -0
- package/dist/template/src/core/messaging/chat.ts +424 -0
- package/dist/template/src/core/messaging/consent.ts +390 -0
- package/dist/template/src/core/messaging/inbox.ts +602 -0
- package/dist/template/src/core/messaging/keywords.ts +540 -0
- package/dist/template/src/core/messaging/numbers-schema.ts +126 -0
- package/dist/template/src/core/messaging/policy-schema.ts +84 -0
- package/dist/template/src/core/messaging/policy.ts +575 -0
- package/dist/template/src/core/messaging/portal.ts +30 -0
- package/dist/template/src/core/messaging/purpose.ts +12 -0
- package/dist/template/src/core/messaging/registration.ts +235 -0
- package/dist/template/src/core/messaging/schema.ts +433 -0
- package/dist/template/src/core/messaging/service.ts +805 -0
- package/dist/template/src/core/messaging/sms.ts +1052 -0
- package/dist/template/src/core/messaging/webhook-route.ts +118 -0
- package/dist/template/src/core/migrate.ts +57 -0
- package/dist/template/src/core/module.ts +105 -0
- package/dist/template/src/core/notes/schema.ts +140 -0
- package/dist/template/src/core/notes/service.ts +513 -0
- package/dist/template/src/core/notifications/devices.ts +149 -0
- package/dist/template/src/core/notifications/schema.ts +389 -0
- package/dist/template/src/core/notifications/service.ts +1863 -0
- package/dist/template/src/core/onboarding/contract.ts +130 -0
- package/dist/template/src/core/onboarding/index.ts +213 -0
- package/dist/template/src/core/onboarding/registry.ts +295 -0
- package/dist/template/src/core/paywalls/evaluate.ts +266 -0
- package/dist/template/src/core/paywalls/schema.ts +105 -0
- package/dist/template/src/core/paywalls/service.ts +223 -0
- package/dist/template/src/core/platform.ts +19 -0
- package/dist/template/src/core/plugin.ts +68 -0
- package/dist/template/src/core/plugins/integrity.ts +51 -0
- package/dist/template/src/core/plugins/isolate.ts +49 -0
- package/dist/template/src/core/plugins/registry.ts +70 -0
- package/dist/template/src/core/plugins/schema.ts +96 -0
- package/dist/template/src/core/plugins/service.ts +472 -0
- package/dist/template/src/core/plugins/spine.ts +172 -0
- package/dist/template/src/core/portability/archive.ts +77 -0
- package/dist/template/src/core/portability/ownership-export.d.mts +56 -0
- package/dist/template/src/core/portability/ownership-export.mjs +548 -0
- package/dist/template/src/core/portability/service.ts +119 -0
- package/dist/template/src/core/portal/record-service.ts +38 -0
- package/dist/template/src/core/portal/return-path.ts +9 -0
- package/dist/template/src/core/portal/sections.ts +101 -0
- package/dist/template/src/core/portal/service.ts +202 -0
- package/dist/template/src/core/portal/sign-in.ts +30 -0
- package/dist/template/src/core/privacy/media-consent.ts +328 -0
- package/dist/template/src/core/privacy/publish-veto.ts +59 -0
- package/dist/template/src/core/privacy/schema.ts +320 -0
- package/dist/template/src/core/privacy/service.ts +1935 -0
- package/dist/template/src/core/provenance/service.ts +174 -0
- package/dist/template/src/core/recipes.ts +15 -0
- package/dist/template/src/core/reporting/csv.ts +102 -0
- package/dist/template/src/core/reporting/dimensions.ts +114 -0
- package/dist/template/src/core/retention/apply.ts +47 -0
- package/dist/template/src/core/retention/holds.ts +45 -0
- package/dist/template/src/core/retention/registry.ts +190 -0
- package/dist/template/src/core/retention/schema.ts +34 -0
- package/dist/template/src/core/retention/service.ts +109 -0
- package/dist/template/src/core/retention/sources.ts +42 -0
- package/dist/template/src/core/rewards/issue.ts +100 -0
- package/dist/template/src/core/roles/defaults.ts +161 -0
- package/dist/template/src/core/roles/service.ts +375 -0
- package/dist/template/src/core/runs/schema.ts +290 -0
- package/dist/template/src/core/runs/spine.ts +72 -0
- package/dist/template/src/core/runtime/shutdown.ts +55 -0
- package/dist/template/src/core/runtime.ts +45 -0
- package/dist/template/src/core/scheduling/audience-schema.ts +179 -0
- package/dist/template/src/core/scheduling/audiences.ts +504 -0
- package/dist/template/src/core/scheduling/availability-service.ts +354 -0
- package/dist/template/src/core/scheduling/availability.ts +213 -0
- package/dist/template/src/core/scheduling/bookings.ts +1252 -0
- package/dist/template/src/core/scheduling/funnel.ts +30 -0
- package/dist/template/src/core/scheduling/ics-service.ts +355 -0
- package/dist/template/src/core/scheduling/policy.ts +253 -0
- package/dist/template/src/core/scheduling/portal.ts +50 -0
- package/dist/template/src/core/scheduling/reminders.ts +352 -0
- package/dist/template/src/core/scheduling/requirements.ts +307 -0
- package/dist/template/src/core/scheduling/resolver-service.ts +206 -0
- package/dist/template/src/core/scheduling/resolver.ts +564 -0
- package/dist/template/src/core/scheduling/schema.ts +618 -0
- package/dist/template/src/core/scheduling/service.ts +474 -0
- package/dist/template/src/core/scheduling/waitlist.ts +678 -0
- package/dist/template/src/core/scheduling/writeback.ts +213 -0
- package/dist/template/src/core/scoring/schema.ts +147 -0
- package/dist/template/src/core/scoring/service.ts +602 -0
- package/dist/template/src/core/search/registry.ts +155 -0
- package/dist/template/src/core/search/service.ts +81 -0
- package/dist/template/src/core/search/sources.ts +195 -0
- package/dist/template/src/core/security/csp-reports.ts +256 -0
- package/dist/template/src/core/security/rate-limit.ts +117 -0
- package/dist/template/src/core/security/schema.ts +60 -0
- package/dist/template/src/core/segments/fields.ts +376 -0
- package/dist/template/src/core/segments/schema.ts +112 -0
- package/dist/template/src/core/segments/service.ts +731 -0
- package/dist/template/src/core/seo/classify.ts +56 -0
- package/dist/template/src/core/seo/entities.ts +61 -0
- package/dist/template/src/core/seo/feeds.ts +77 -0
- package/dist/template/src/core/seo/indexnow.ts +110 -0
- package/dist/template/src/core/seo/jsonld.ts +307 -0
- package/dist/template/src/core/seo/meta.ts +84 -0
- package/dist/template/src/core/seo/origin.ts +55 -0
- package/dist/template/src/core/seo/schema.ts +41 -0
- package/dist/template/src/core/seo/service.ts +171 -0
- package/dist/template/src/core/seo/sitemap.ts +185 -0
- package/dist/template/src/core/service.ts +747 -0
- package/dist/template/src/core/services.ts +242 -0
- package/dist/template/src/core/settings/defaults.ts +129 -0
- package/dist/template/src/core/settings/read.ts +24 -0
- package/dist/template/src/core/settings/schema.ts +81 -0
- package/dist/template/src/core/settings/service.ts +407 -0
- package/dist/template/src/core/settings/setup.ts +41 -0
- package/dist/template/src/core/spine/facts.ts +141 -0
- package/dist/template/src/core/subjects.ts +95 -0
- package/dist/template/src/core/tables.ts +180 -0
- package/dist/template/src/core/tasks/schema.ts +174 -0
- package/dist/template/src/core/tasks/service.ts +634 -0
- package/dist/template/src/core/trash.ts +278 -0
- package/dist/template/src/core/update/apply.ts +58 -0
- package/dist/template/src/core/update/catalog.ts +222 -0
- package/dist/template/src/core/update/channels.ts +39 -0
- package/dist/template/src/core/update/check.ts +107 -0
- package/dist/template/src/core/update/escalate-job.ts +111 -0
- package/dist/template/src/core/update/escalation.ts +131 -0
- package/dist/template/src/core/update/feed.ts +80 -0
- package/dist/template/src/core/update/fork-delivery.ts +102 -0
- package/dist/template/src/core/update/fork-merge.ts +195 -0
- package/dist/template/src/core/update/fork.ts +217 -0
- package/dist/template/src/core/update/host.ts +59 -0
- package/dist/template/src/core/update/integrity.ts +118 -0
- package/dist/template/src/core/update/keys.ts +29 -0
- package/dist/template/src/core/update/policy.ts +111 -0
- package/dist/template/src/core/update/preflight.ts +258 -0
- package/dist/template/src/core/update/release-declaration.json +19 -0
- package/dist/template/src/core/update/release-validation.d.mts +5 -0
- package/dist/template/src/core/update/release-validation.mjs +29 -0
- package/dist/template/src/core/update/release-version.d.mts +4 -0
- package/dist/template/src/core/update/release-version.mjs +36 -0
- package/dist/template/src/core/update/release.ts +97 -0
- package/dist/template/src/core/update/schema.ts +172 -0
- package/dist/template/src/core/update/seams.ts +70 -0
- package/dist/template/src/core/update/service.ts +1075 -0
- package/dist/template/src/core/update/targets.ts +425 -0
- package/dist/template/src/core/update/this-release.ts +12 -0
- package/dist/template/src/core/update/trusted-release-keys.json +7 -0
- package/dist/template/src/core/views/entities.ts +48 -0
- package/dist/template/src/core/views/registry.ts +121 -0
- package/dist/template/src/core/views/schema.ts +82 -0
- package/dist/template/src/core/views/service.ts +388 -0
- package/dist/template/src/core/webhooks/address.ts +57 -0
- package/dist/template/src/core/webhooks/deliver.ts +255 -0
- package/dist/template/src/core/webhooks/schema.ts +128 -0
- package/dist/template/src/core/webhooks/service.ts +532 -0
- package/dist/template/src/core/webhooks/sign.ts +169 -0
- package/dist/template/src/core/webhooks/transport.ts +180 -0
- package/dist/template/src/mcp/server.ts +372 -0
- package/dist/template/src/mcp/tools.ts +182 -0
- package/dist/template/src/modules/ads/AdBeacon.tsx +76 -0
- package/dist/template/src/modules/ads/ThirdPartyConsent.tsx +45 -0
- package/dist/template/src/modules/ads/ads-txt.ts +60 -0
- package/dist/template/src/modules/ads/blocks.tsx +246 -0
- package/dist/template/src/modules/ads/clicks.ts +162 -0
- package/dist/template/src/modules/ads/jobs.ts +17 -0
- package/dist/template/src/modules/ads/manifest.ts +48 -0
- package/dist/template/src/modules/ads/pacing.ts +47 -0
- package/dist/template/src/modules/ads/schema.ts +360 -0
- package/dist/template/src/modules/ads/select.ts +235 -0
- package/dist/template/src/modules/ads/service.ts +2082 -0
- package/dist/template/src/modules/ads/stats.ts +209 -0
- package/dist/template/src/modules/ads/tables.ts +13 -0
- package/dist/template/src/modules/ads/tags.ts +98 -0
- package/dist/template/src/modules/ads/targeting.ts +0 -0
- package/dist/template/src/modules/ads/viewability.ts +39 -0
- package/dist/template/src/modules/analytics/classify.ts +128 -0
- package/dist/template/src/modules/analytics/experiments.ts +197 -0
- package/dist/template/src/modules/analytics/funnel-service.ts +201 -0
- package/dist/template/src/modules/analytics/funnel.ts +40 -0
- package/dist/template/src/modules/analytics/manifest.ts +37 -0
- package/dist/template/src/modules/analytics/read.ts +17 -0
- package/dist/template/src/modules/analytics/schema.ts +142 -0
- package/dist/template/src/modules/analytics/service.ts +1380 -0
- package/dist/template/src/modules/analytics/settings.ts +44 -0
- package/dist/template/src/modules/analytics/tables.ts +4 -0
- package/dist/template/src/modules/analytics/visitor.ts +91 -0
- package/dist/template/src/modules/assessments/block.tsx +200 -0
- package/dist/template/src/modules/assessments/blocks.ts +11 -0
- package/dist/template/src/modules/assessments/manifest.ts +27 -0
- package/dist/template/src/modules/assessments/onboarding.ts +45 -0
- package/dist/template/src/modules/assessments/questions.ts +134 -0
- package/dist/template/src/modules/assessments/schema.ts +201 -0
- package/dist/template/src/modules/assessments/scoring.ts +99 -0
- package/dist/template/src/modules/assessments/service.ts +1225 -0
- package/dist/template/src/modules/assessments/tables.ts +9 -0
- package/dist/template/src/modules/assistant/actions.ts +191 -0
- package/dist/template/src/modules/assistant/contract.ts +48 -0
- package/dist/template/src/modules/assistant/corpus.ts +137 -0
- package/dist/template/src/modules/assistant/embed.ts +40 -0
- package/dist/template/src/modules/assistant/guardrails.ts +220 -0
- package/dist/template/src/modules/assistant/jobs.ts +17 -0
- package/dist/template/src/modules/assistant/limits.ts +219 -0
- package/dist/template/src/modules/assistant/manifest.ts +43 -0
- package/dist/template/src/modules/assistant/prompt.ts +168 -0
- package/dist/template/src/modules/assistant/provider.ts +100 -0
- package/dist/template/src/modules/assistant/retrieve.ts +67 -0
- package/dist/template/src/modules/assistant/schema.ts +336 -0
- package/dist/template/src/modules/assistant/service.ts +1276 -0
- package/dist/template/src/modules/assistant/tables.ts +11 -0
- package/dist/template/src/modules/assistant/text.ts +42 -0
- package/dist/template/src/modules/automations/engine.ts +350 -0
- package/dist/template/src/modules/automations/graph.ts +325 -0
- package/dist/template/src/modules/automations/guardrail-service.ts +68 -0
- package/dist/template/src/modules/automations/guardrails.ts +211 -0
- package/dist/template/src/modules/automations/manifest.ts +37 -0
- package/dist/template/src/modules/automations/runtime.ts +771 -0
- package/dist/template/src/modules/automations/schema.ts +192 -0
- package/dist/template/src/modules/automations/service.ts +584 -0
- package/dist/template/src/modules/automations/tables.ts +8 -0
- package/dist/template/src/modules/builder/code-delivery.ts +131 -0
- package/dist/template/src/modules/builder/code-gates.ts +374 -0
- package/dist/template/src/modules/builder/code-service.ts +508 -0
- package/dist/template/src/modules/builder/manifest.ts +14 -0
- package/dist/template/src/modules/builder/schema.ts +135 -0
- package/dist/template/src/modules/builder/service.ts +758 -0
- package/dist/template/src/modules/builder/tables.ts +3 -0
- package/dist/template/src/modules/calculators/formula.ts +197 -0
- package/dist/template/src/modules/calculators/manifest.ts +19 -0
- package/dist/template/src/modules/calculators/schema.ts +65 -0
- package/dist/template/src/modules/calculators/service.ts +455 -0
- package/dist/template/src/modules/calculators/tables.ts +4 -0
- package/dist/template/src/modules/catalog/browse.ts +835 -0
- package/dist/template/src/modules/catalog/cart-access.ts +37 -0
- package/dist/template/src/modules/catalog/cart.ts +1066 -0
- package/dist/template/src/modules/catalog/checkout-policy.ts +80 -0
- package/dist/template/src/modules/catalog/collections.ts +856 -0
- package/dist/template/src/modules/catalog/contract.ts +180 -0
- package/dist/template/src/modules/catalog/cookies.ts +14 -0
- package/dist/template/src/modules/catalog/demo.ts +108 -0
- package/dist/template/src/modules/catalog/fulfillment.ts +978 -0
- package/dist/template/src/modules/catalog/funnel.ts +46 -0
- package/dist/template/src/modules/catalog/inventory.ts +900 -0
- package/dist/template/src/modules/catalog/jobs.ts +74 -0
- package/dist/template/src/modules/catalog/manifest.ts +76 -0
- package/dist/template/src/modules/catalog/merchandising.ts +529 -0
- package/dist/template/src/modules/catalog/offerings.ts +735 -0
- package/dist/template/src/modules/catalog/onboarding.ts +33 -0
- package/dist/template/src/modules/catalog/orders.ts +698 -0
- package/dist/template/src/modules/catalog/portal.ts +36 -0
- package/dist/template/src/modules/catalog/price-breaks.ts +144 -0
- package/dist/template/src/modules/catalog/pricing.ts +590 -0
- package/dist/template/src/modules/catalog/procurement.ts +689 -0
- package/dist/template/src/modules/catalog/promo-quote.ts +53 -0
- package/dist/template/src/modules/catalog/promotions.ts +784 -0
- package/dist/template/src/modules/catalog/public-booking.ts +132 -0
- package/dist/template/src/modules/catalog/public-pages.ts +173 -0
- package/dist/template/src/modules/catalog/relations.ts +430 -0
- package/dist/template/src/modules/catalog/reporting.ts +66 -0
- package/dist/template/src/modules/catalog/reward-issuer.ts +73 -0
- package/dist/template/src/modules/catalog/schema.ts +1672 -0
- package/dist/template/src/modules/catalog/segment-fields.ts +52 -0
- package/dist/template/src/modules/catalog/service.ts +1055 -0
- package/dist/template/src/modules/catalog/shipping-quote.ts +205 -0
- package/dist/template/src/modules/catalog/shipping.ts +324 -0
- package/dist/template/src/modules/catalog/storefront.ts +524 -0
- package/dist/template/src/modules/catalog/tables.ts +57 -0
- package/dist/template/src/modules/catalog/tokens.ts +26 -0
- package/dist/template/src/modules/catalog/variants.ts +581 -0
- package/dist/template/src/modules/cms/a11y-hints.ts +258 -0
- package/dist/template/src/modules/cms/blocks/SiteChatClient.tsx +233 -0
- package/dist/template/src/modules/cms/blocks/edit.ts +295 -0
- package/dist/template/src/modules/cms/blocks/fields.ts +208 -0
- package/dist/template/src/modules/cms/blocks/help.tsx +241 -0
- package/dist/template/src/modules/cms/blocks/html.ts +84 -0
- package/dist/template/src/modules/cms/blocks/library.tsx +1226 -0
- package/dist/template/src/modules/cms/blocks/merchandising.tsx +721 -0
- package/dist/template/src/modules/cms/blocks/move.ts +115 -0
- package/dist/template/src/modules/cms/blocks/registry.ts +296 -0
- package/dist/template/src/modules/cms/blocks/rich-render.tsx +44 -0
- package/dist/template/src/modules/cms/blocks/rich.ts +312 -0
- package/dist/template/src/modules/cms/blocks/social.ts +38 -0
- package/dist/template/src/modules/cms/blocks/store-sections.tsx +465 -0
- package/dist/template/src/modules/cms/blocks/surfaces.tsx +1031 -0
- package/dist/template/src/modules/cms/blocks/types.ts +241 -0
- package/dist/template/src/modules/cms/blog.tsx +51 -0
- package/dist/template/src/modules/cms/budgets.ts +52 -0
- package/dist/template/src/modules/cms/cache.ts +49 -0
- package/dist/template/src/modules/cms/chrome-nav.ts +53 -0
- package/dist/template/src/modules/cms/collaboration.ts +433 -0
- package/dist/template/src/modules/cms/defaults.ts +110 -0
- package/dist/template/src/modules/cms/email-render.ts +161 -0
- package/dist/template/src/modules/cms/email-service.ts +112 -0
- package/dist/template/src/modules/cms/experiments.ts +108 -0
- package/dist/template/src/modules/cms/help-service.ts +417 -0
- package/dist/template/src/modules/cms/history.ts +106 -0
- package/dist/template/src/modules/cms/inbound.ts +106 -0
- package/dist/template/src/modules/cms/jobs.ts +28 -0
- package/dist/template/src/modules/cms/layout-service.ts +327 -0
- package/dist/template/src/modules/cms/lifecycle.ts +780 -0
- package/dist/template/src/modules/cms/locations.ts +288 -0
- package/dist/template/src/modules/cms/manifest.ts +76 -0
- package/dist/template/src/modules/cms/onboarding.ts +53 -0
- package/dist/template/src/modules/cms/read.ts +27 -0
- package/dist/template/src/modules/cms/render.tsx +135 -0
- package/dist/template/src/modules/cms/schema.ts +387 -0
- package/dist/template/src/modules/cms/section-instances.ts +96 -0
- package/dist/template/src/modules/cms/section-service.ts +263 -0
- package/dist/template/src/modules/cms/service.ts +1815 -0
- package/dist/template/src/modules/cms/sms-template-service.ts +273 -0
- package/dist/template/src/modules/cms/tables.ts +14 -0
- package/dist/template/src/modules/cms/template-service.ts +374 -0
- package/dist/template/src/modules/cms/templates.ts +320 -0
- package/dist/template/src/modules/cms/translate.ts +212 -0
- package/dist/template/src/modules/cms/translation-workflow.ts +235 -0
- package/dist/template/src/modules/contracts/manifest.ts +27 -0
- package/dist/template/src/modules/contracts/portal.ts +27 -0
- package/dist/template/src/modules/contracts/schema.ts +174 -0
- package/dist/template/src/modules/contracts/service.ts +608 -0
- package/dist/template/src/modules/contracts/tables.ts +3 -0
- package/dist/template/src/modules/contracts/template-service.ts +458 -0
- package/dist/template/src/modules/contracts/templates.ts +83 -0
- package/dist/template/src/modules/crm/manifest.ts +30 -0
- package/dist/template/src/modules/crm/schema.ts +209 -0
- package/dist/template/src/modules/crm/service.ts +918 -0
- package/dist/template/src/modules/crm/tables.ts +3 -0
- package/dist/template/src/modules/documents/manifest.ts +29 -0
- package/dist/template/src/modules/documents/portal.ts +41 -0
- package/dist/template/src/modules/documents/schema.ts +243 -0
- package/dist/template/src/modules/documents/service.ts +879 -0
- package/dist/template/src/modules/documents/tables.ts +9 -0
- package/dist/template/src/modules/documents/tokens.ts +33 -0
- package/dist/template/src/modules/events/blocks.tsx +82 -0
- package/dist/template/src/modules/events/ics.ts +47 -0
- package/dist/template/src/modules/events/manifest.ts +26 -0
- package/dist/template/src/modules/events/onboarding.ts +47 -0
- package/dist/template/src/modules/events/public-pages.ts +140 -0
- package/dist/template/src/modules/events/schema.ts +149 -0
- package/dist/template/src/modules/events/service.ts +907 -0
- package/dist/template/src/modules/events/tables.ts +3 -0
- package/dist/template/src/modules/forms/antispam.ts +163 -0
- package/dist/template/src/modules/forms/block.tsx +275 -0
- package/dist/template/src/modules/forms/blocks.ts +11 -0
- package/dist/template/src/modules/forms/briefing.ts +92 -0
- package/dist/template/src/modules/forms/fieldKey.ts +43 -0
- package/dist/template/src/modules/forms/fields.ts +165 -0
- package/dist/template/src/modules/forms/manifest.ts +46 -0
- package/dist/template/src/modules/forms/onboarding.ts +53 -0
- package/dist/template/src/modules/forms/schema.ts +97 -0
- package/dist/template/src/modules/forms/service.ts +905 -0
- package/dist/template/src/modules/forms/tables.ts +4 -0
- package/dist/template/src/modules/galleries/archive.ts +181 -0
- package/dist/template/src/modules/galleries/cookies.ts +24 -0
- package/dist/template/src/modules/galleries/demo.ts +105 -0
- package/dist/template/src/modules/galleries/jobs.ts +49 -0
- package/dist/template/src/modules/galleries/manifest.ts +33 -0
- package/dist/template/src/modules/galleries/onboarding.ts +33 -0
- package/dist/template/src/modules/galleries/schema.ts +442 -0
- package/dist/template/src/modules/galleries/service.ts +2970 -0
- package/dist/template/src/modules/galleries/tables.ts +13 -0
- package/dist/template/src/modules/galleries/tokens.ts +30 -0
- package/dist/template/src/modules/index.ts +96 -0
- package/dist/template/src/modules/invoicing/advanced-money-service.ts +1071 -0
- package/dist/template/src/modules/invoicing/briefing.ts +73 -0
- package/dist/template/src/modules/invoicing/checkout-requirements.ts +19 -0
- package/dist/template/src/modules/invoicing/contract.ts +541 -0
- package/dist/template/src/modules/invoicing/customer-service.ts +336 -0
- package/dist/template/src/modules/invoicing/customer-tokens.ts +43 -0
- package/dist/template/src/modules/invoicing/demo.ts +114 -0
- package/dist/template/src/modules/invoicing/funnel.ts +67 -0
- package/dist/template/src/modules/invoicing/invoice-service.ts +1467 -0
- package/dist/template/src/modules/invoicing/manifest.ts +58 -0
- package/dist/template/src/modules/invoicing/money.ts +88 -0
- package/dist/template/src/modules/invoicing/onboarding.ts +33 -0
- package/dist/template/src/modules/invoicing/payment-plan-ledger.ts +115 -0
- package/dist/template/src/modules/invoicing/payment-provider-service.ts +873 -0
- package/dist/template/src/modules/invoicing/payment-webhook-route.ts +53 -0
- package/dist/template/src/modules/invoicing/portal.ts +29 -0
- package/dist/template/src/modules/invoicing/pos-service.ts +275 -0
- package/dist/template/src/modules/invoicing/recurring-schema.ts +125 -0
- package/dist/template/src/modules/invoicing/recurring-service.ts +608 -0
- package/dist/template/src/modules/invoicing/reporting.ts +39 -0
- package/dist/template/src/modules/invoicing/schema.ts +862 -0
- package/dist/template/src/modules/invoicing/service.ts +37 -0
- package/dist/template/src/modules/invoicing/tables.ts +33 -0
- package/dist/template/src/modules/invoicing/tax-engine.ts +214 -0
- package/dist/template/src/modules/invoicing/tax-service.ts +716 -0
- package/dist/template/src/modules/invoicing/tax-templates.ts +316 -0
- package/dist/template/src/modules/local-plugins.ts +15 -0
- package/dist/template/src/modules/loyalty/jobs.ts +224 -0
- package/dist/template/src/modules/loyalty/manifest.ts +58 -0
- package/dist/template/src/modules/loyalty/rewards-service.ts +607 -0
- package/dist/template/src/modules/loyalty/schema.ts +333 -0
- package/dist/template/src/modules/loyalty/service.ts +922 -0
- package/dist/template/src/modules/loyalty/spine.ts +97 -0
- package/dist/template/src/modules/loyalty/tables.ts +12 -0
- package/dist/template/src/modules/newsletters/blocks.tsx +128 -0
- package/dist/template/src/modules/newsletters/broadcast-schema.ts +166 -0
- package/dist/template/src/modules/newsletters/broadcast-service.ts +806 -0
- package/dist/template/src/modules/newsletters/jobs.ts +29 -0
- package/dist/template/src/modules/newsletters/manifest.ts +39 -0
- package/dist/template/src/modules/newsletters/public-pages.ts +128 -0
- package/dist/template/src/modules/newsletters/schema.ts +134 -0
- package/dist/template/src/modules/newsletters/service.ts +708 -0
- package/dist/template/src/modules/newsletters/tables.ts +9 -0
- package/dist/template/src/modules/newsletters/template-schema.ts +92 -0
- package/dist/template/src/modules/newsletters/template-service.ts +368 -0
- package/dist/template/src/modules/popups/PopupSurface.tsx +401 -0
- package/dist/template/src/modules/popups/http.ts +26 -0
- package/dist/template/src/modules/popups/manifest.ts +42 -0
- package/dist/template/src/modules/popups/mount.tsx +89 -0
- package/dist/template/src/modules/popups/schema.ts +252 -0
- package/dist/template/src/modules/popups/service.ts +948 -0
- package/dist/template/src/modules/popups/tables.ts +4 -0
- package/dist/template/src/modules/popups/tally.ts +194 -0
- package/dist/template/src/modules/popups/targeting.ts +206 -0
- package/dist/template/src/modules/projects/blocks.tsx +444 -0
- package/dist/template/src/modules/projects/consent-gate.ts +104 -0
- package/dist/template/src/modules/projects/jobs.ts +24 -0
- package/dist/template/src/modules/projects/manifest.ts +33 -0
- package/dist/template/src/modules/projects/portal.ts +32 -0
- package/dist/template/src/modules/projects/portfolio-service.ts +712 -0
- package/dist/template/src/modules/projects/publishing-service.ts +782 -0
- package/dist/template/src/modules/projects/schema.ts +437 -0
- package/dist/template/src/modules/projects/service.ts +1055 -0
- package/dist/template/src/modules/projects/tables.ts +12 -0
- package/dist/template/src/modules/projects/time-schema.ts +166 -0
- package/dist/template/src/modules/projects/time-service.ts +631 -0
- package/dist/template/src/modules/proof/blocks.tsx +34 -0
- package/dist/template/src/modules/proof/manifest.ts +24 -0
- package/dist/template/src/modules/proof/schema.ts +21 -0
- package/dist/template/src/modules/proof/seed.ts +11 -0
- package/dist/template/src/modules/proof/service.ts +74 -0
- package/dist/template/src/modules/proof/tables.ts +3 -0
- package/dist/template/src/modules/quotes/conversion.ts +425 -0
- package/dist/template/src/modules/quotes/cookies.ts +9 -0
- package/dist/template/src/modules/quotes/demo.ts +99 -0
- package/dist/template/src/modules/quotes/funnel.ts +44 -0
- package/dist/template/src/modules/quotes/manifest.ts +34 -0
- package/dist/template/src/modules/quotes/onboarding.ts +33 -0
- package/dist/template/src/modules/quotes/portal.ts +46 -0
- package/dist/template/src/modules/quotes/schema.ts +250 -0
- package/dist/template/src/modules/quotes/service.ts +1554 -0
- package/dist/template/src/modules/quotes/tables.ts +9 -0
- package/dist/template/src/modules/quotes/tokens.ts +28 -0
- package/dist/template/src/modules/quotes/view-entity.ts +20 -0
- package/dist/template/src/modules/referrals/attribution-service.ts +134 -0
- package/dist/template/src/modules/referrals/attribution.ts +99 -0
- package/dist/template/src/modules/referrals/commission-service.ts +1114 -0
- package/dist/template/src/modules/referrals/commission.ts +150 -0
- package/dist/template/src/modules/referrals/jobs.ts +32 -0
- package/dist/template/src/modules/referrals/manifest.ts +53 -0
- package/dist/template/src/modules/referrals/portal.ts +37 -0
- package/dist/template/src/modules/referrals/schema.ts +421 -0
- package/dist/template/src/modules/referrals/service.ts +619 -0
- package/dist/template/src/modules/referrals/spine.ts +92 -0
- package/dist/template/src/modules/referrals/tables.ts +13 -0
- package/dist/template/src/modules/referrals/tokens.ts +28 -0
- package/dist/template/src/modules/rentals/manifest.ts +26 -0
- package/dist/template/src/modules/rentals/portal.ts +34 -0
- package/dist/template/src/modules/rentals/pricing.ts +150 -0
- package/dist/template/src/modules/rentals/schema.ts +210 -0
- package/dist/template/src/modules/rentals/service.ts +759 -0
- package/dist/template/src/modules/rentals/tables.ts +3 -0
- package/dist/template/src/modules/reporting/demo.ts +88 -0
- package/dist/template/src/modules/reporting/export-schema.ts +319 -0
- package/dist/template/src/modules/reporting/export-service.ts +1224 -0
- package/dist/template/src/modules/reporting/export-shapes.ts +429 -0
- package/dist/template/src/modules/reporting/export-tokens.ts +23 -0
- package/dist/template/src/modules/reporting/jobs.ts +117 -0
- package/dist/template/src/modules/reporting/manifest.ts +34 -0
- package/dist/template/src/modules/reporting/onboarding.ts +33 -0
- package/dist/template/src/modules/reporting/schema.ts +48 -0
- package/dist/template/src/modules/reporting/service.ts +540 -0
- package/dist/template/src/modules/reporting/tables.ts +4 -0
- package/dist/template/src/modules/reviews/blocks.tsx +97 -0
- package/dist/template/src/modules/reviews/manifest.ts +26 -0
- package/dist/template/src/modules/reviews/schema.ts +182 -0
- package/dist/template/src/modules/reviews/service.ts +663 -0
- package/dist/template/src/modules/reviews/tables.ts +3 -0
- package/dist/template/src/modules/reviews/tokens.ts +22 -0
- package/dist/template/src/modules/seed/boot.ts +94 -0
- package/dist/template/src/modules/seed/manifest.ts +24 -0
- package/dist/template/src/modules/seed/onboarding.ts +276 -0
- package/dist/template/src/modules/seed/preset-install.ts +181 -0
- package/dist/template/src/modules/seed/service.ts +260 -0
- package/dist/template/src/modules/share/embeds.ts +54 -0
- package/dist/template/src/modules/share/intents.ts +126 -0
- package/dist/template/src/modules/share/links.ts +164 -0
- package/dist/template/src/modules/share/manifest.ts +34 -0
- package/dist/template/src/modules/share/schema.ts +130 -0
- package/dist/template/src/modules/share/service.ts +697 -0
- package/dist/template/src/modules/share/tables.ts +4 -0
- package/dist/template/src/modules/social/capabilities.ts +71 -0
- package/dist/template/src/modules/social/compose.ts +825 -0
- package/dist/template/src/modules/social/contract.ts +59 -0
- package/dist/template/src/modules/social/gbp.ts +570 -0
- package/dist/template/src/modules/social/ingest.ts +727 -0
- package/dist/template/src/modules/social/jobs.ts +125 -0
- package/dist/template/src/modules/social/manifest.ts +34 -0
- package/dist/template/src/modules/social/oauth.ts +300 -0
- package/dist/template/src/modules/social/onboarding.ts +45 -0
- package/dist/template/src/modules/social/policy.ts +48 -0
- package/dist/template/src/modules/social/render.ts +135 -0
- package/dist/template/src/modules/social/schema.ts +322 -0
- package/dist/template/src/modules/social/service.ts +660 -0
- package/dist/template/src/modules/social/tables.ts +13 -0
- package/dist/template/src/modules/subscriptions/billing.ts +1042 -0
- package/dist/template/src/modules/subscriptions/jobs.ts +52 -0
- package/dist/template/src/modules/subscriptions/manifest.ts +34 -0
- package/dist/template/src/modules/subscriptions/portal.ts +34 -0
- package/dist/template/src/modules/subscriptions/public-signup.ts +124 -0
- package/dist/template/src/modules/subscriptions/schema.ts +294 -0
- package/dist/template/src/modules/subscriptions/service.ts +1659 -0
- package/dist/template/src/modules/subscriptions/tables.ts +3 -0
- package/dist/template/src/ui/GuidancePanel.tsx +200 -0
- package/dist/template/src/ui/ShareCopyButton.tsx +28 -0
- package/dist/template/src/ui/SkipLink.tsx +21 -0
- package/dist/template/src/ui/ThemeToggle.tsx +79 -0
- package/dist/template/src/ui/primitives.tsx +269 -0
- package/dist/template/tests/README.md +5 -0
- package/dist/template/tests/adapters/social-conformance.test.ts +71 -0
- package/dist/template/tests/browser/accessibility.spec.ts +793 -0
- package/dist/template/tests/browser/agent-launch.spec.ts +110 -0
- package/dist/template/tests/browser/assessments.spec.ts +188 -0
- package/dist/template/tests/browser/c11-01-visitor-to-paid.spec.ts +281 -0
- package/dist/template/tests/browser/c11-04-capture.spec.ts +80 -0
- package/dist/template/tests/browser/calculators.spec.ts +196 -0
- package/dist/template/tests/browser/cart-access.spec.ts +42 -0
- package/dist/template/tests/browser/customer-surfaces.spec.ts +115 -0
- package/dist/template/tests/browser/database.ts +60 -0
- package/dist/template/tests/browser/demo-scenarios.spec.ts +117 -0
- package/dist/template/tests/browser/editor-drag-drop.spec.ts +259 -0
- package/dist/template/tests/browser/editor-inline-editing.spec.ts +186 -0
- package/dist/template/tests/browser/editor-media-tools.spec.ts +231 -0
- package/dist/template/tests/browser/editor-store-sections.spec.ts +391 -0
- package/dist/template/tests/browser/events.spec.ts +195 -0
- package/dist/template/tests/browser/facts.spec.ts +140 -0
- package/dist/template/tests/browser/first-party-plugins.spec.ts +161 -0
- package/dist/template/tests/browser/guidance.spec.ts +148 -0
- package/dist/template/tests/browser/journeys.spec.ts +662 -0
- package/dist/template/tests/browser/location-access.spec.ts +59 -0
- package/dist/template/tests/browser/media-consent.spec.ts +93 -0
- package/dist/template/tests/browser/owner-session.ts +53 -0
- package/dist/template/tests/browser/playground.spec.ts +151 -0
- package/dist/template/tests/browser/provider-erasure.spec.ts +50 -0
- package/dist/template/tests/browser/record-search.spec.ts +107 -0
- package/dist/template/tests/browser/record-trash.spec.ts +127 -0
- package/dist/template/tests/browser/storefront-checkout.spec.ts +272 -0
- package/dist/template/tests/browser/storefront-merch-blocks.spec.ts +319 -0
- package/dist/template/tests/browser/workflow-search.spec.ts +53 -0
- package/dist/template/tests/core/a11y-smoke.test.ts +92 -0
- package/dist/template/tests/core/admin-journey-screens.test.ts +143 -0
- package/dist/template/tests/core/advanced-money.test.ts +232 -0
- package/dist/template/tests/core/adversarial-gallery-privacy.test.ts +185 -0
- package/dist/template/tests/core/adversarial-portal-privacy.test.ts +93 -0
- package/dist/template/tests/core/agent-launch.test.ts +74 -0
- package/dist/template/tests/core/agents-approvals.test.ts +168 -0
- package/dist/template/tests/core/agents-autonomy.test.ts +364 -0
- package/dist/template/tests/core/agents-board.test.ts +111 -0
- package/dist/template/tests/core/agents-budgets.test.ts +329 -0
- package/dist/template/tests/core/agents-inbound.test.ts +535 -0
- package/dist/template/tests/core/agents-injection.test.ts +351 -0
- package/dist/template/tests/core/agents-managed-loop.test.ts +261 -0
- package/dist/template/tests/core/agents-pause.test.ts +183 -0
- package/dist/template/tests/core/agents-playbooks.test.ts +285 -0
- package/dist/template/tests/core/agents-run.test.ts +119 -0
- package/dist/template/tests/core/agents-schedule.test.ts +231 -0
- package/dist/template/tests/core/agents-workforce-adapter.test.ts +359 -0
- package/dist/template/tests/core/agents.test.ts +436 -0
- package/dist/template/tests/core/alt-text-adapter.test.ts +97 -0
- package/dist/template/tests/core/analytics-consent.test.ts +272 -0
- package/dist/template/tests/core/analytics-experiments.test.ts +63 -0
- package/dist/template/tests/core/analytics-governance-migration.test.ts +28 -0
- package/dist/template/tests/core/analytics.test.ts +660 -0
- package/dist/template/tests/core/api.test.ts +338 -0
- package/dist/template/tests/core/apikeys.test.ts +366 -0
- package/dist/template/tests/core/attestations.test.ts +311 -0
- package/dist/template/tests/core/audit-labels.test.ts +37 -0
- package/dist/template/tests/core/autofill-safety.test.ts +279 -0
- package/dist/template/tests/core/availability.test.ts +389 -0
- package/dist/template/tests/core/booking-audiences.test.ts +334 -0
- package/dist/template/tests/core/booking-concurrency.test.ts +288 -0
- package/dist/template/tests/core/bookings.test.ts +343 -0
- package/dist/template/tests/core/boot.test.ts +195 -0
- package/dist/template/tests/core/bootstrap-security.test.ts +38 -0
- package/dist/template/tests/core/briefing-contributors.test.ts +200 -0
- package/dist/template/tests/core/briefing-playbooks.test.ts +171 -0
- package/dist/template/tests/core/briefing.test.ts +298 -0
- package/dist/template/tests/core/browse-storefront.test.ts +561 -0
- package/dist/template/tests/core/builder-authority.test.ts +205 -0
- package/dist/template/tests/core/builder-code-lane.test.ts +213 -0
- package/dist/template/tests/core/builder-content-lane.test.ts +249 -0
- package/dist/template/tests/core/c11-02-catalog-journey.test.ts +227 -0
- package/dist/template/tests/core/c11-03-booking-journey.test.ts +422 -0
- package/dist/template/tests/core/c11-04-gallery-social-journey.test.ts +310 -0
- package/dist/template/tests/core/c11-05-subscription-journey.test.ts +193 -0
- package/dist/template/tests/core/c11-06-agent-journey.test.ts +208 -0
- package/dist/template/tests/core/c11-07-mail-calendar-journey.test.ts +179 -0
- package/dist/template/tests/core/c11-08-install-update-journey.test.ts +166 -0
- package/dist/template/tests/core/c11-13-failure-drills.test.ts +446 -0
- package/dist/template/tests/core/c11-14-retention.test.ts +320 -0
- package/dist/template/tests/core/c11-14-search.test.ts +527 -0
- package/dist/template/tests/core/calendar-busy.test.ts +198 -0
- package/dist/template/tests/core/calendar-oauth-callback.test.ts +154 -0
- package/dist/template/tests/core/calendar-oauth.test.ts +312 -0
- package/dist/template/tests/core/calendar-sync.test.ts +363 -0
- package/dist/template/tests/core/calendars.test.ts +267 -0
- package/dist/template/tests/core/cart-access.test.ts +107 -0
- package/dist/template/tests/core/cart-storefront.test.ts +507 -0
- package/dist/template/tests/core/catalog-browse.test.ts +587 -0
- package/dist/template/tests/core/catalog-carts.test.ts +150 -0
- package/dist/template/tests/core/catalog-collections.test.ts +454 -0
- package/dist/template/tests/core/catalog-fulfillment.test.ts +191 -0
- package/dist/template/tests/core/catalog-inventory.test.ts +198 -0
- package/dist/template/tests/core/catalog-merchandising.test.ts +107 -0
- package/dist/template/tests/core/catalog-offerings.test.ts +213 -0
- package/dist/template/tests/core/catalog-orders.test.ts +279 -0
- package/dist/template/tests/core/catalog-pricing.test.ts +85 -0
- package/dist/template/tests/core/catalog-procurement.test.ts +154 -0
- package/dist/template/tests/core/catalog-promotions.test.ts +109 -0
- package/dist/template/tests/core/catalog-public-pages.test.ts +73 -0
- package/dist/template/tests/core/catalog-relations.test.ts +79 -0
- package/dist/template/tests/core/catalog-variants.test.ts +113 -0
- package/dist/template/tests/core/catalog.test.ts +233 -0
- package/dist/template/tests/core/catalogue.test.ts +300 -0
- package/dist/template/tests/core/change-password.test.ts +164 -0
- package/dist/template/tests/core/changelog-output.test.ts +33 -0
- package/dist/template/tests/core/checkout-policy.test.ts +34 -0
- package/dist/template/tests/core/client-galleries.test.ts +609 -0
- package/dist/template/tests/core/client-readiness-security.test.ts +136 -0
- package/dist/template/tests/core/cms-a11y.test.ts +157 -0
- package/dist/template/tests/core/cms-blocks.test.ts +283 -0
- package/dist/template/tests/core/cms-cache.test.ts +121 -0
- package/dist/template/tests/core/cms-chrome.test.ts +114 -0
- package/dist/template/tests/core/cms-collaboration.test.ts +196 -0
- package/dist/template/tests/core/cms-drafts.test.ts +78 -0
- package/dist/template/tests/core/cms-email.test.ts +71 -0
- package/dist/template/tests/core/cms-experiments.test.ts +109 -0
- package/dist/template/tests/core/cms-fields.test.ts +137 -0
- package/dist/template/tests/core/cms-history.test.ts +34 -0
- package/dist/template/tests/core/cms-layouts.test.ts +110 -0
- package/dist/template/tests/core/cms-lifecycle.test.ts +267 -0
- package/dist/template/tests/core/cms-move.test.ts +101 -0
- package/dist/template/tests/core/cms-plugin-proof.test.ts +56 -0
- package/dist/template/tests/core/cms-public-boundary.test.ts +85 -0
- package/dist/template/tests/core/cms-rich.test.ts +144 -0
- package/dist/template/tests/core/cms-sections.test.ts +139 -0
- package/dist/template/tests/core/cms-service.test.ts +358 -0
- package/dist/template/tests/core/cms-surfaces.test.ts +117 -0
- package/dist/template/tests/core/cms-templates.test.ts +115 -0
- package/dist/template/tests/core/cms-translation-workflow.test.ts +88 -0
- package/dist/template/tests/core/collections-storefront.test.ts +328 -0
- package/dist/template/tests/core/colour-literals.test.ts +73 -0
- package/dist/template/tests/core/community-rooms.test.ts +324 -0
- package/dist/template/tests/core/connection-grants.test.ts +209 -0
- package/dist/template/tests/core/connections.test.ts +435 -0
- package/dist/template/tests/core/consent-publish-surfaces.test.ts +577 -0
- package/dist/template/tests/core/contact-data-depth.test.ts +426 -0
- package/dist/template/tests/core/contact-duplicate-review.test.ts +357 -0
- package/dist/template/tests/core/contact-import.test.ts +404 -0
- package/dist/template/tests/core/contact-privacy-rights.test.ts +636 -0
- package/dist/template/tests/core/contacts-read.test.ts +165 -0
- package/dist/template/tests/core/contract-evidence.test.ts +43 -0
- package/dist/template/tests/core/contract-projections.test.ts +47 -0
- package/dist/template/tests/core/contract-templates.test.ts +270 -0
- package/dist/template/tests/core/contribute.test.ts +497 -0
- package/dist/template/tests/core/conversations.test.ts +381 -0
- package/dist/template/tests/core/coverage-enforcement.test.ts +296 -0
- package/dist/template/tests/core/coverage.test.ts +308 -0
- package/dist/template/tests/core/create-freeholder.test.ts +307 -0
- package/dist/template/tests/core/csp-migration.test.ts +30 -0
- package/dist/template/tests/core/csp-reports.test.ts +150 -0
- package/dist/template/tests/core/csp.test.ts +194 -0
- package/dist/template/tests/core/csrf.test.ts +139 -0
- package/dist/template/tests/core/customer-galleries.test.ts +137 -0
- package/dist/template/tests/core/customer-invoices.test.ts +235 -0
- package/dist/template/tests/core/customer-locale-migration.test.ts +40 -0
- package/dist/template/tests/core/customer-locale-ui.test.ts +39 -0
- package/dist/template/tests/core/customer-locale.test.ts +85 -0
- package/dist/template/tests/core/customer-magic-links.test.ts +281 -0
- package/dist/template/tests/core/customer-reply.test.ts +155 -0
- package/dist/template/tests/core/customer-return-path.test.ts +11 -0
- package/dist/template/tests/core/daily-adapter.test.ts +185 -0
- package/dist/template/tests/core/daily-flow.test.ts +94 -0
- package/dist/template/tests/core/daily-import.test.ts +206 -0
- package/dist/template/tests/core/dashboard.test.ts +147 -0
- package/dist/template/tests/core/db-errors.test.ts +52 -0
- package/dist/template/tests/core/deferred-erasure.test.ts +124 -0
- package/dist/template/tests/core/demo-migration.test.ts +39 -0
- package/dist/template/tests/core/demo-paths.test.ts +49 -0
- package/dist/template/tests/core/demo-scenarios.test.ts +200 -0
- package/dist/template/tests/core/dependency-attestation.test.ts +84 -0
- package/dist/template/tests/core/dependency-audit.test.ts +124 -0
- package/dist/template/tests/core/deploy-droplet.test.ts +323 -0
- package/dist/template/tests/core/deploy-recipe.test.ts +134 -0
- package/dist/template/tests/core/design-tokens.test.ts +113 -0
- package/dist/template/tests/core/doc-claim-mapping.test.ts +167 -0
- package/dist/template/tests/core/docs-availability.test.ts +94 -0
- package/dist/template/tests/core/doctor-script.test.ts +16 -0
- package/dist/template/tests/core/doctor.test.ts +220 -0
- package/dist/template/tests/core/edge-adapters.test.ts +220 -0
- package/dist/template/tests/core/editor-canvas-drag.test.ts +348 -0
- package/dist/template/tests/core/editor-inline-edit.test.ts +416 -0
- package/dist/template/tests/core/editor-media-tools.test.ts +450 -0
- package/dist/template/tests/core/editor-preview-bridge.test.ts +428 -0
- package/dist/template/tests/core/editor-preview-draft.test.ts +226 -0
- package/dist/template/tests/core/editor-reorder.test.ts +339 -0
- package/dist/template/tests/core/editor-store-sections.test.ts +476 -0
- package/dist/template/tests/core/embeds.test.ts +60 -0
- package/dist/template/tests/core/entitlements.test.ts +312 -0
- package/dist/template/tests/core/events.test.ts +113 -0
- package/dist/template/tests/core/f-matrix.test.ts +206 -0
- package/dist/template/tests/core/f04-remaining-screens.test.ts +258 -0
- package/dist/template/tests/core/first-party-plugins.test.ts +783 -0
- package/dist/template/tests/core/forms.test.ts +446 -0
- package/dist/template/tests/core/freeholder-app-init.test.ts +504 -0
- package/dist/template/tests/core/gallery-archive.test.ts +265 -0
- package/dist/template/tests/core/gallery-delivery-routes.test.ts +72 -0
- package/dist/template/tests/core/gallery-partner-share.test.ts +320 -0
- package/dist/template/tests/core/gallery-proofing.test.ts +311 -0
- package/dist/template/tests/core/gallery-rounds.test.ts +291 -0
- package/dist/template/tests/core/gallery-sales.test.ts +309 -0
- package/dist/template/tests/core/guidance-definitions.test.ts +135 -0
- package/dist/template/tests/core/guidance-ui.test.ts +92 -0
- package/dist/template/tests/core/guidance.test.ts +309 -0
- package/dist/template/tests/core/host-update-socket.test.ts +121 -0
- package/dist/template/tests/core/host-updater-recipe.test.ts +68 -0
- package/dist/template/tests/core/http-auth.test.ts +286 -0
- package/dist/template/tests/core/http-body-boundary.test.ts +69 -0
- package/dist/template/tests/core/http.test.ts +284 -0
- package/dist/template/tests/core/i18n-gate.test.ts +440 -0
- package/dist/template/tests/core/i18n.test.ts +190 -0
- package/dist/template/tests/core/ics-and-writeback.test.ts +446 -0
- package/dist/template/tests/core/importers.test.ts +102 -0
- package/dist/template/tests/core/inbox.test.ts +304 -0
- package/dist/template/tests/core/inline-script-safety.test.ts +41 -0
- package/dist/template/tests/core/instrumentation-boundary.test.ts +16 -0
- package/dist/template/tests/core/intake-waivers-reminders.test.ts +533 -0
- package/dist/template/tests/core/internal-services.test.ts +298 -0
- package/dist/template/tests/core/invitations.test.ts +341 -0
- package/dist/template/tests/core/invoice-admin.test.ts +41 -0
- package/dist/template/tests/core/invoicing-pos.test.ts +107 -0
- package/dist/template/tests/core/invoicing.test.ts +776 -0
- package/dist/template/tests/core/job-runtime-health.test.ts +123 -0
- package/dist/template/tests/core/locale-quality.test.ts +107 -0
- package/dist/template/tests/core/locale-routing.test.ts +321 -0
- package/dist/template/tests/core/locations.test.ts +599 -0
- package/dist/template/tests/core/long-running-service-boundary.test.ts +216 -0
- package/dist/template/tests/core/mail-adapters.test.ts +423 -0
- package/dist/template/tests/core/mail-import.test.ts +325 -0
- package/dist/template/tests/core/mail-migration.test.ts +163 -0
- package/dist/template/tests/core/mail-oauth-callback.test.ts +159 -0
- package/dist/template/tests/core/mail-oauth.test.ts +447 -0
- package/dist/template/tests/core/mail-outbox-crypto.test.ts +88 -0
- package/dist/template/tests/core/mail-read-oauth-callback.test.ts +111 -0
- package/dist/template/tests/core/mail-service.test.ts +644 -0
- package/dist/template/tests/core/mail-ui.test.ts +206 -0
- package/dist/template/tests/core/mail-webhooks.test.ts +454 -0
- package/dist/template/tests/core/malware.test.ts +85 -0
- package/dist/template/tests/core/marketplace-claims.test.ts +68 -0
- package/dist/template/tests/core/mcp-input-schema.test.ts +18 -0
- package/dist/template/tests/core/mcp.test.ts +459 -0
- package/dist/template/tests/core/media-capture.test.ts +345 -0
- package/dist/template/tests/core/media-consent.test.ts +357 -0
- package/dist/template/tests/core/media-framing.test.ts +210 -0
- package/dist/template/tests/core/media-transfer.test.ts +48 -0
- package/dist/template/tests/core/media-watermark.test.ts +308 -0
- package/dist/template/tests/core/media.test.ts +1446 -0
- package/dist/template/tests/core/merch-blocks.test.ts +465 -0
- package/dist/template/tests/core/merge-completeness.test.ts +228 -0
- package/dist/template/tests/core/migrate.test.ts +75 -0
- package/dist/template/tests/core/migration-journal.test.ts +59 -0
- package/dist/template/tests/core/mobile-app-shell.test.ts +238 -0
- package/dist/template/tests/core/mobile-app.test.ts +728 -0
- package/dist/template/tests/core/mobile-capture-batches.test.ts +223 -0
- package/dist/template/tests/core/mobile-private-cache.test.ts +339 -0
- package/dist/template/tests/core/mobile-screens.test.ts +362 -0
- package/dist/template/tests/core/mobile-store-gate.test.ts +310 -0
- package/dist/template/tests/core/module.test.ts +60 -0
- package/dist/template/tests/core/money-arithmetic.test.ts +279 -0
- package/dist/template/tests/core/newsletters.test.ts +178 -0
- package/dist/template/tests/core/notes.test.ts +338 -0
- package/dist/template/tests/core/notification-migration.test.ts +174 -0
- package/dist/template/tests/core/notification-ui.test.ts +97 -0
- package/dist/template/tests/core/notifications.test.ts +510 -0
- package/dist/template/tests/core/onboarding-contract.test.ts +133 -0
- package/dist/template/tests/core/outbound-boundaries.test.ts +29 -0
- package/dist/template/tests/core/outbox.test.ts +407 -0
- package/dist/template/tests/core/owner-password-script.test.ts +106 -0
- package/dist/template/tests/core/ownership-export.test.ts +273 -0
- package/dist/template/tests/core/page-editor-publish.test.ts +94 -0
- package/dist/template/tests/core/paradise-adapter.test.ts +177 -0
- package/dist/template/tests/core/paradise-flow.test.ts +350 -0
- package/dist/template/tests/core/paradise-webhook.test.ts +148 -0
- package/dist/template/tests/core/password-reset.test.ts +289 -0
- package/dist/template/tests/core/passwords.test.ts +57 -0
- package/dist/template/tests/core/payment-adapters.test.ts +604 -0
- package/dist/template/tests/core/payment-provider-service.test.ts +226 -0
- package/dist/template/tests/core/paywalls.test.ts +358 -0
- package/dist/template/tests/core/performance-budgets.test.ts +332 -0
- package/dist/template/tests/core/performance-measurement-families.test.ts +296 -0
- package/dist/template/tests/core/pipelines.test.ts +382 -0
- package/dist/template/tests/core/plan-gate.test.ts +251 -0
- package/dist/template/tests/core/playground.test.ts +412 -0
- package/dist/template/tests/core/plugin-claims.test.ts +41 -0
- package/dist/template/tests/core/plugin-contract.test.ts +149 -0
- package/dist/template/tests/core/plugin-provider-boundary.test.ts +35 -0
- package/dist/template/tests/core/plugin-scaffold.test.ts +27 -0
- package/dist/template/tests/core/plugins-lifecycle.test.ts +196 -0
- package/dist/template/tests/core/portability.test.ts +58 -0
- package/dist/template/tests/core/portal-rooms.test.ts +280 -0
- package/dist/template/tests/core/portal-shell.test.ts +116 -0
- package/dist/template/tests/core/pos-adapters.test.ts +78 -0
- package/dist/template/tests/core/price-breaks.test.ts +63 -0
- package/dist/template/tests/core/printify-adapter.test.ts +85 -0
- package/dist/template/tests/core/printify-fulfillment.test.ts +149 -0
- package/dist/template/tests/core/product-gift-share.test.ts +116 -0
- package/dist/template/tests/core/project-case-studies.test.ts +277 -0
- package/dist/template/tests/core/project-portfolios.test.ts +197 -0
- package/dist/template/tests/core/projects.test.ts +292 -0
- package/dist/template/tests/core/promo-quote.test.ts +51 -0
- package/dist/template/tests/core/proxy-locale.test.ts +55 -0
- package/dist/template/tests/core/public-entity-drafts.test.ts +166 -0
- package/dist/template/tests/core/push-devices.test.ts +147 -0
- package/dist/template/tests/core/quote-conversion.test.ts +291 -0
- package/dist/template/tests/core/quote-partner-share.test.ts +192 -0
- package/dist/template/tests/core/quotes.test.ts +357 -0
- package/dist/template/tests/core/rate-limit.test.ts +216 -0
- package/dist/template/tests/core/recipes.test.ts +212 -0
- package/dist/template/tests/core/record-participation.test.ts +121 -0
- package/dist/template/tests/core/record-trash-families.test.ts +321 -0
- package/dist/template/tests/core/record-trash.test.ts +154 -0
- package/dist/template/tests/core/recurring-invoices.test.ts +284 -0
- package/dist/template/tests/core/registry-completeness.test.ts +143 -0
- package/dist/template/tests/core/release-history.test.ts +47 -0
- package/dist/template/tests/core/release-packages.test.ts +35 -0
- package/dist/template/tests/core/release-publication.test.ts +69 -0
- package/dist/template/tests/core/rentals.test.ts +408 -0
- package/dist/template/tests/core/resolver.test.ts +481 -0
- package/dist/template/tests/core/reviews.test.ts +229 -0
- package/dist/template/tests/core/roles.test.ts +199 -0
- package/dist/template/tests/core/route-boot.test.ts +64 -0
- package/dist/template/tests/core/runtime-balanced-sequencer.test.ts +117 -0
- package/dist/template/tests/core/runtime-shutdown.test.ts +58 -0
- package/dist/template/tests/core/runtime-version-integrity.test.ts +43 -0
- package/dist/template/tests/core/saved-views.test.ts +271 -0
- package/dist/template/tests/core/schema-baseline-identity.test.ts +70 -0
- package/dist/template/tests/core/schema-compat-gate.test.ts +172 -0
- package/dist/template/tests/core/scoring.test.ts +364 -0
- package/dist/template/tests/core/sdk-generation.test.ts +55 -0
- package/dist/template/tests/core/sdk-schema.test.ts +106 -0
- package/dist/template/tests/core/sdk.test.ts +181 -0
- package/dist/template/tests/core/security-headers.test.ts +41 -0
- package/dist/template/tests/core/seed-demo.test.ts +355 -0
- package/dist/template/tests/core/segments.test.ts +528 -0
- package/dist/template/tests/core/seo-gate.test.ts +193 -0
- package/dist/template/tests/core/seo-public-entities.test.ts +105 -0
- package/dist/template/tests/core/seo-surface.test.ts +279 -0
- package/dist/template/tests/core/seo.test.ts +277 -0
- package/dist/template/tests/core/service-composition.test.ts +248 -0
- package/dist/template/tests/core/service-output.test.ts +48 -0
- package/dist/template/tests/core/service.test.ts +394 -0
- package/dist/template/tests/core/session-management.test.ts +223 -0
- package/dist/template/tests/core/settings.test.ts +421 -0
- package/dist/template/tests/core/shipping-quote.test.ts +105 -0
- package/dist/template/tests/core/shopify-adapter.test.ts +121 -0
- package/dist/template/tests/core/shopify-refunds.test.ts +177 -0
- package/dist/template/tests/core/shopify-sync.test.ts +62 -0
- package/dist/template/tests/core/signup-contact-import.test.ts +383 -0
- package/dist/template/tests/core/site-chat.test.ts +250 -0
- package/dist/template/tests/core/sms-consent.test.ts +295 -0
- package/dist/template/tests/core/sms-keywords.test.ts +139 -0
- package/dist/template/tests/core/sms-policy.test.ts +348 -0
- package/dist/template/tests/core/sms-registration.test.ts +304 -0
- package/dist/template/tests/core/sms-templates.test.ts +61 -0
- package/dist/template/tests/core/sms.test.ts +563 -0
- package/dist/template/tests/core/social-http.test.ts +91 -0
- package/dist/template/tests/core/spec-reconciliation.test.ts +62 -0
- package/dist/template/tests/core/spine.test.ts +682 -0
- package/dist/template/tests/core/standalone-artifact.test.ts +40 -0
- package/dist/template/tests/core/storage.test.ts +360 -0
- package/dist/template/tests/core/store-sections.test.ts +466 -0
- package/dist/template/tests/core/storefront-commerce.test.ts +431 -0
- package/dist/template/tests/core/tasks.test.ts +356 -0
- package/dist/template/tests/core/tax-templates.test.ts +129 -0
- package/dist/template/tests/core/templates.test.ts +148 -0
- package/dist/template/tests/core/theme.test.ts +64 -0
- package/dist/template/tests/core/time-entries.test.ts +343 -0
- package/dist/template/tests/core/tokens.test.ts +167 -0
- package/dist/template/tests/core/transactional-jobs.test.ts +590 -0
- package/dist/template/tests/core/two-factor.test.ts +297 -0
- package/dist/template/tests/core/update-admin.test.ts +103 -0
- package/dist/template/tests/core/update-apply.test.ts +34 -0
- package/dist/template/tests/core/update-catalog.test.ts +172 -0
- package/dist/template/tests/core/update-check.test.ts +114 -0
- package/dist/template/tests/core/update-cli.test.ts +119 -0
- package/dist/template/tests/core/update-escalation.test.ts +178 -0
- package/dist/template/tests/core/update-feed.test.ts +104 -0
- package/dist/template/tests/core/update-fork.test.ts +244 -0
- package/dist/template/tests/core/update-policy.test.ts +73 -0
- package/dist/template/tests/core/update-preflight.test.ts +59 -0
- package/dist/template/tests/core/update-release.test.ts +127 -0
- package/dist/template/tests/core/update-seams.test.ts +94 -0
- package/dist/template/tests/core/update-targets.test.ts +325 -0
- package/dist/template/tests/core/upgrade-gate.test.ts +36 -0
- package/dist/template/tests/core/waitlists-and-policy.test.ts +544 -0
- package/dist/template/tests/core/webhooks.test.ts +742 -0
- package/dist/template/tests/core/workflow-integrity.test.ts +142 -0
- package/dist/template/tests/core/zoned.test.ts +84 -0
- package/dist/template/tests/fixtures/c1019-chain.catalog +6597 -0
- package/dist/template/tests/fixtures/locales.ts +55 -0
- package/dist/template/tests/fixtures/sample-plugin/README.md +3 -0
- package/dist/template/tests/fixtures/sample-plugin/plugin.json +10 -0
- package/dist/template/tests/helpers/booking-time.ts +11 -0
- package/dist/template/tests/helpers/database-lock.ts +18 -0
- package/dist/template/tests/helpers/mail.ts +17 -0
- package/dist/template/tests/helpers/performance-boot.ts +194 -0
- package/dist/template/tests/helpers/performance-browser.ts +684 -0
- package/dist/template/tests/helpers/performance-migration.ts +165 -0
- package/dist/template/tests/helpers/performance.ts +203 -0
- package/dist/template/tests/helpers/queue-performance.ts +62 -0
- package/dist/template/tests/helpers/spine.ts +93 -0
- package/dist/template/tests/host/test_docker_updater.py +630 -0
- package/dist/template/tests/host/test_host_updater.py +430 -0
- package/dist/template/tests/modules/ads-measurement.test.ts +360 -0
- package/dist/template/tests/modules/ads-serving.test.ts +694 -0
- package/dist/template/tests/modules/ads-third-party.test.ts +353 -0
- package/dist/template/tests/modules/ads.test.ts +377 -0
- package/dist/template/tests/modules/adversarial-customer-privacy.test.ts +88 -0
- package/dist/template/tests/modules/assessments.test.ts +581 -0
- package/dist/template/tests/modules/assistant-grounding.test.ts +182 -0
- package/dist/template/tests/modules/assistant-guardrails.test.ts +341 -0
- package/dist/template/tests/modules/assistant.test.ts +665 -0
- package/dist/template/tests/modules/automations-guardrails.test.ts +319 -0
- package/dist/template/tests/modules/automations-runtime.test.ts +467 -0
- package/dist/template/tests/modules/automations.test.ts +426 -0
- package/dist/template/tests/modules/broadcasts.test.ts +769 -0
- package/dist/template/tests/modules/calculators.test.ts +407 -0
- package/dist/template/tests/modules/customer-surfaces.test.ts +223 -0
- package/dist/template/tests/modules/documents.test.ts +401 -0
- package/dist/template/tests/modules/form-fields.test.ts +73 -0
- package/dist/template/tests/modules/funnel.test.ts +208 -0
- package/dist/template/tests/modules/help-centre.test.ts +285 -0
- package/dist/template/tests/modules/location-pages.test.ts +232 -0
- package/dist/template/tests/modules/loyalty-rewards.test.ts +490 -0
- package/dist/template/tests/modules/loyalty.test.ts +484 -0
- package/dist/template/tests/modules/one-audience.test.ts +263 -0
- package/dist/template/tests/modules/popups.test.ts +769 -0
- package/dist/template/tests/modules/referrals-commission.test.ts +740 -0
- package/dist/template/tests/modules/referrals.test.ts +349 -0
- package/dist/template/tests/modules/reporting-exports.test.ts +1082 -0
- package/dist/template/tests/modules/reporting.test.ts +384 -0
- package/dist/template/tests/modules/share.test.ts +431 -0
- package/dist/template/tests/modules/social-composer.test.ts +251 -0
- package/dist/template/tests/modules/social-gbp.test.ts +281 -0
- package/dist/template/tests/modules/social-ingest.test.ts +295 -0
- package/dist/template/tests/modules/social-onboarding.test.ts +109 -0
- package/dist/template/tests/modules/social.test.ts +289 -0
- package/dist/template/tests/modules/subscription-billing.test.ts +483 -0
- package/dist/template/tests/modules/subscriptions.test.ts +582 -0
- package/dist/template/tests/modules/templates.test.ts +358 -0
- package/dist/template/tests/modules/translate.test.ts +128 -0
- package/dist/template/tests/setup/migrate.ts +20 -0
- package/dist/template/tsconfig.json +54 -0
- package/dist/template/vitest.config.ts +91 -0
- package/dist/template-manifest.json +12746 -0
- package/package.json +22 -7
|
@@ -0,0 +1,2970 @@
|
|
|
1
|
+
// Copyright (C) 2026 Tony Aly
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
// Private client galleries (MASTER.md §4.5, C8.03).
|
|
4
|
+
//
|
|
5
|
+
// Three access modes, one contact. PIN, magic-link and login all open the
|
|
6
|
+
// same gallery for the same person; a guest is also a Contact, resolved
|
|
7
|
+
// through the spine. Per-asset flags are a ceiling: a guest overlay cannot
|
|
8
|
+
// grant more than the item allows.
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
11
|
+
import { and, asc, desc, eq, exists, gt, inArray, isNull, lt, or, sql } from "drizzle-orm";
|
|
12
|
+
import { contactForActor } from "@/core/portal/service";
|
|
13
|
+
import { registerPortalSection } from "@/core/portal/sections";
|
|
14
|
+
import { listed, okResult, row, timestamp, uuid } from "@/core/contract";
|
|
15
|
+
import { hashPassword, verifyPassword } from "@/core/auth/passwords";
|
|
16
|
+
import { users } from "@/core/auth/schema";
|
|
17
|
+
import { contacts } from "@/core/contacts/schema";
|
|
18
|
+
import { registerContactReference, resolveContact } from "@/core/contacts/service";
|
|
19
|
+
import { registerContactPrivacySource } from "@/core/privacy/service";
|
|
20
|
+
import {
|
|
21
|
+
clipSnippet,
|
|
22
|
+
matchesIlike,
|
|
23
|
+
registerSearchSource,
|
|
24
|
+
} from "@/core/search/registry";
|
|
25
|
+
import { sendMail } from "@/core/mail/service";
|
|
26
|
+
import { businessProfile } from "@/core/settings/schema";
|
|
27
|
+
import { env } from "@/core/env";
|
|
28
|
+
import { assets } from "@/core/media/schema";
|
|
29
|
+
import {
|
|
30
|
+
isRasterImage,
|
|
31
|
+
pickRendition,
|
|
32
|
+
publicRenditions,
|
|
33
|
+
watermarkedRenditions,
|
|
34
|
+
type VariantSet,
|
|
35
|
+
} from "@/core/media/variants";
|
|
36
|
+
import { isUniqueViolation } from "@/core/db";
|
|
37
|
+
import {
|
|
38
|
+
defineService,
|
|
39
|
+
ServiceError,
|
|
40
|
+
type Actor,
|
|
41
|
+
type ServiceContext,
|
|
42
|
+
type Tx,
|
|
43
|
+
} from "@/core/service";
|
|
44
|
+
import demoServices from "./demo";
|
|
45
|
+
import {
|
|
46
|
+
GALLERY_ACCESS_ACTIONS,
|
|
47
|
+
GALLERY_ACCESS_MODES,
|
|
48
|
+
GALLERY_DOWNLOAD_POLICIES,
|
|
49
|
+
GALLERY_GUEST_ROLES,
|
|
50
|
+
GALLERY_ARCHIVE_STATES,
|
|
51
|
+
GALLERY_ROUND_STATES,
|
|
52
|
+
GALLERY_SELECTION_KINDS,
|
|
53
|
+
galleries,
|
|
54
|
+
galleryAccessLogs,
|
|
55
|
+
galleryGuests,
|
|
56
|
+
galleryItems,
|
|
57
|
+
galleryArchives,
|
|
58
|
+
galleryPriceSheetItems,
|
|
59
|
+
galleryRounds,
|
|
60
|
+
gallerySelections,
|
|
61
|
+
gallerySessions,
|
|
62
|
+
} from "./schema";
|
|
63
|
+
import { hashGalleryToken, newGalleryToken } from "./tokens";
|
|
64
|
+
import { buildZip, uniqueNames, zipCeilingExceeded } from "./archive";
|
|
65
|
+
import { storage } from "@/adapters/storage";
|
|
66
|
+
import { getService } from "@/core/service";
|
|
67
|
+
import { consentBlockedAssetIds } from "@/modules/projects/consent-gate";
|
|
68
|
+
|
|
69
|
+
const id = z.string().uuid();
|
|
70
|
+
const slug = z
|
|
71
|
+
.string()
|
|
72
|
+
.trim()
|
|
73
|
+
.toLowerCase()
|
|
74
|
+
.regex(/^[a-z0-9]+(-[a-z0-9]+)*$/, "Use lower-case words separated by hyphens.")
|
|
75
|
+
.max(120);
|
|
76
|
+
const pinSecret = z.string().regex(/^\d{4,8}$/, "A PIN is four to eight digits.");
|
|
77
|
+
const passwordSecret = z.string().min(8).max(200);
|
|
78
|
+
const SESSION_MS = 7 * 24 * 60 * 60 * 1000;
|
|
79
|
+
|
|
80
|
+
function requirePerson(actor: Actor): void {
|
|
81
|
+
if (actor.kind !== "user" && actor.kind !== "system") {
|
|
82
|
+
throw new ServiceError("permission", "Sign in to manage galleries.");
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Tests and API keys can be user-shaped without a users row. */
|
|
87
|
+
async function actingUserId(ctx: ServiceContext): Promise<string | null> {
|
|
88
|
+
if (ctx.actor.kind !== "user") return null;
|
|
89
|
+
const [user] = await ctx.tx
|
|
90
|
+
.select({ id: users.id })
|
|
91
|
+
.from(users)
|
|
92
|
+
.where(eq(users.id, ctx.actor.userId))
|
|
93
|
+
.limit(1);
|
|
94
|
+
return user?.id ?? null;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function slugify(title: string): string {
|
|
98
|
+
return (
|
|
99
|
+
title
|
|
100
|
+
.toLowerCase()
|
|
101
|
+
.normalize("NFKD")
|
|
102
|
+
.replace(/[\u0300-\u036f]/g, "")
|
|
103
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
104
|
+
.replace(/^-+|-+$/g, "")
|
|
105
|
+
.slice(0, 100) || "gallery"
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function now(): Date {
|
|
110
|
+
return new Date();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Send the link, and report whether it went. A suppressed address or an
|
|
115
|
+
* unconfigured mailbox is news for the owner, not a reason to refuse to
|
|
116
|
+
* create the guest: the admin screen shows the link so it can be handed over
|
|
117
|
+
* some other way.
|
|
118
|
+
*/
|
|
119
|
+
async function sendGuestInvite(
|
|
120
|
+
tx: Tx,
|
|
121
|
+
input: {
|
|
122
|
+
to: string;
|
|
123
|
+
site: string;
|
|
124
|
+
title: string;
|
|
125
|
+
link: string;
|
|
126
|
+
expiresAt: Date | null;
|
|
127
|
+
idempotencyKey: string;
|
|
128
|
+
},
|
|
129
|
+
): Promise<boolean> {
|
|
130
|
+
try {
|
|
131
|
+
const sent = await sendMail(
|
|
132
|
+
tx,
|
|
133
|
+
{
|
|
134
|
+
to: input.to,
|
|
135
|
+
subject: `${input.title} — your private gallery`,
|
|
136
|
+
text: [
|
|
137
|
+
`${input.site} has shared the gallery "${input.title}" with you.`,
|
|
138
|
+
"",
|
|
139
|
+
"Open it here:",
|
|
140
|
+
input.link,
|
|
141
|
+
"",
|
|
142
|
+
input.expiresAt
|
|
143
|
+
? `This private link stops working ${input.expiresAt.toISOString()}.`
|
|
144
|
+
: "This link is private to you. Please do not forward it.",
|
|
145
|
+
].join("\n"),
|
|
146
|
+
},
|
|
147
|
+
{ requestedBy: "system", idempotencyKey: input.idempotencyKey },
|
|
148
|
+
);
|
|
149
|
+
return sent.delivers;
|
|
150
|
+
} catch {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The address a guest is actually sent. `/g/{slug}` renders the lock screen
|
|
157
|
+
* with a redeem button rather than opening on GET: a link that mutates when
|
|
158
|
+
* a mail scanner follows it is a link that is spent before it arrives.
|
|
159
|
+
*/
|
|
160
|
+
function guestLink(slug: string, token: string): string {
|
|
161
|
+
return `${env().APP_URL.replace(/\/+$/, "")}/g/${slug}?token=${encodeURIComponent(token)}`;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function isExpired(at: Date | null | undefined): boolean {
|
|
165
|
+
return Boolean(at && at.getTime() <= Date.now());
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function sessionExpiry(galleryExpiresAt: Date | null): Date {
|
|
169
|
+
const cap = new Date(Date.now() + SESSION_MS);
|
|
170
|
+
if (!galleryExpiresAt) return cap;
|
|
171
|
+
return galleryExpiresAt.getTime() < cap.getTime() ? galleryExpiresAt : cap;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const galleryRow = row({
|
|
175
|
+
id: uuid,
|
|
176
|
+
contactId: uuid.nullable(),
|
|
177
|
+
title: z.string(),
|
|
178
|
+
slug: z.string(),
|
|
179
|
+
kind: z.literal("client_delivery"),
|
|
180
|
+
coverAssetId: uuid.nullable(),
|
|
181
|
+
access: z.enum(GALLERY_ACCESS_MODES),
|
|
182
|
+
secretSet: z.boolean(),
|
|
183
|
+
expiresAt: timestamp.nullable(),
|
|
184
|
+
downloadPolicy: z.enum(GALLERY_DOWNLOAD_POLICIES),
|
|
185
|
+
downloadLimit: z.number().int().nullable(),
|
|
186
|
+
watermark: z.boolean(),
|
|
187
|
+
clientCanInvitePartner: z.boolean(),
|
|
188
|
+
createdAt: timestamp,
|
|
189
|
+
updatedAt: timestamp,
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
const itemRow = row({
|
|
193
|
+
id: uuid,
|
|
194
|
+
galleryId: uuid,
|
|
195
|
+
assetId: uuid,
|
|
196
|
+
position: z.number().int(),
|
|
197
|
+
canView: z.boolean(),
|
|
198
|
+
canDownload: z.boolean(),
|
|
199
|
+
filename: z.string().optional(),
|
|
200
|
+
altText: z.string().nullable().optional(),
|
|
201
|
+
mime: z.string().optional(),
|
|
202
|
+
status: z.string().optional(),
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
const liveItemRow = itemRow.extend({
|
|
206
|
+
viewUrl: z.string(),
|
|
207
|
+
downloadUrl: z.string().nullable(),
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
const guestRow = row({
|
|
211
|
+
id: uuid,
|
|
212
|
+
galleryId: uuid,
|
|
213
|
+
contactId: uuid,
|
|
214
|
+
contactName: z.string().optional(),
|
|
215
|
+
contactEmail: z.string().nullable().optional(),
|
|
216
|
+
role: z.enum(GALLERY_GUEST_ROLES),
|
|
217
|
+
canView: z.boolean(),
|
|
218
|
+
canDownload: z.boolean(),
|
|
219
|
+
expiresAt: timestamp.nullable(),
|
|
220
|
+
revokedAt: timestamp.nullable(),
|
|
221
|
+
invitedByContactId: uuid.nullable().optional(),
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
const selectionRow = row({
|
|
225
|
+
id: uuid,
|
|
226
|
+
galleryId: uuid,
|
|
227
|
+
contactId: uuid.nullable(),
|
|
228
|
+
assetId: uuid,
|
|
229
|
+
kind: z.enum(GALLERY_SELECTION_KINDS),
|
|
230
|
+
comment: z.string().nullable(),
|
|
231
|
+
createdAt: timestamp,
|
|
232
|
+
updatedAt: timestamp,
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
const snapshotEntry = z.object({
|
|
236
|
+
assetId: uuid,
|
|
237
|
+
kind: z.enum(GALLERY_SELECTION_KINDS),
|
|
238
|
+
comment: z.string().nullable(),
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
const roundRow = row({
|
|
242
|
+
id: uuid,
|
|
243
|
+
galleryId: uuid,
|
|
244
|
+
sequence: z.number().int(),
|
|
245
|
+
state: z.enum(GALLERY_ROUND_STATES),
|
|
246
|
+
submittedByContactId: uuid.nullable(),
|
|
247
|
+
note: z.string().nullable(),
|
|
248
|
+
snapshot: z.array(snapshotEntry),
|
|
249
|
+
submittedAt: timestamp.nullable(),
|
|
250
|
+
decidedAt: timestamp.nullable(),
|
|
251
|
+
createdAt: timestamp,
|
|
252
|
+
updatedAt: timestamp,
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
const archiveRow = row({
|
|
256
|
+
id: uuid,
|
|
257
|
+
galleryId: uuid,
|
|
258
|
+
state: z.enum(GALLERY_ARCHIVE_STATES),
|
|
259
|
+
bytes: z.number().int().nullable(),
|
|
260
|
+
fileCount: z.number().int().nullable(),
|
|
261
|
+
error: z.string().nullable(),
|
|
262
|
+
builtAt: timestamp.nullable(),
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
/** The stored object is never named to the client; the route serves it. */
|
|
266
|
+
function publicArchive(archive: typeof galleryArchives.$inferSelect) {
|
|
267
|
+
const { storageKey: _storageKey, deliveryHash: _deliveryHash, createdAt: _c, updatedAt: _u, ...rest } = archive;
|
|
268
|
+
return rest;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const priceSheetRow = row({
|
|
272
|
+
id: uuid,
|
|
273
|
+
galleryId: uuid,
|
|
274
|
+
variantId: uuid,
|
|
275
|
+
position: z.number().int(),
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
const logRow = row({
|
|
279
|
+
id: uuid,
|
|
280
|
+
galleryId: uuid,
|
|
281
|
+
contactId: uuid.nullable(),
|
|
282
|
+
action: z.enum(GALLERY_ACCESS_ACTIONS),
|
|
283
|
+
assetId: uuid.nullable(),
|
|
284
|
+
at: timestamp,
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
function publicGallery(
|
|
288
|
+
gallery: typeof galleries.$inferSelect,
|
|
289
|
+
): z.infer<typeof galleryRow> {
|
|
290
|
+
const { secretHash, ...rest } = gallery;
|
|
291
|
+
return {
|
|
292
|
+
...rest,
|
|
293
|
+
kind: "client_delivery",
|
|
294
|
+
secretSet: Boolean(secretHash),
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
async function loadGallery(ctx: ServiceContext, galleryId: string, lock = false) {
|
|
299
|
+
const lookup = ctx.tx.select().from(galleries).where(eq(galleries.id, galleryId)).limit(1);
|
|
300
|
+
const [gallery] = lock ? await lookup.for("update") : await lookup;
|
|
301
|
+
if (!gallery) throw new ServiceError("not_found", "That gallery is not here.");
|
|
302
|
+
return gallery;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function assertLive(gallery: { expiresAt: Date | null }): void {
|
|
306
|
+
if (isExpired(gallery.expiresAt)) {
|
|
307
|
+
throw new ServiceError("permission", "This gallery is no longer available.");
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
async function logAccess(
|
|
312
|
+
ctx: ServiceContext,
|
|
313
|
+
input: {
|
|
314
|
+
galleryId: string;
|
|
315
|
+
contactId: string | null;
|
|
316
|
+
action: (typeof GALLERY_ACCESS_ACTIONS)[number];
|
|
317
|
+
assetId?: string | null;
|
|
318
|
+
},
|
|
319
|
+
): Promise<void> {
|
|
320
|
+
await ctx.tx.insert(galleryAccessLogs).values({
|
|
321
|
+
galleryId: input.galleryId,
|
|
322
|
+
contactId: input.contactId,
|
|
323
|
+
action: input.action,
|
|
324
|
+
assetId: input.assetId ?? null,
|
|
325
|
+
});
|
|
326
|
+
if (input.contactId) {
|
|
327
|
+
await ctx.emitTimeline({
|
|
328
|
+
contactId: input.contactId,
|
|
329
|
+
eventType:
|
|
330
|
+
input.action === "denied"
|
|
331
|
+
? "gallery.denied"
|
|
332
|
+
: input.action === "download"
|
|
333
|
+
? "gallery.downloaded"
|
|
334
|
+
: "gallery.viewed",
|
|
335
|
+
subjectType: "gallery",
|
|
336
|
+
subjectId: input.galleryId,
|
|
337
|
+
payload: input.assetId ? { assetId: input.assetId } : {},
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
async function hashSecret(
|
|
343
|
+
access: (typeof GALLERY_ACCESS_MODES)[number],
|
|
344
|
+
secret: string | null | undefined,
|
|
345
|
+
): Promise<string | null> {
|
|
346
|
+
if (access === "login") {
|
|
347
|
+
if (secret) {
|
|
348
|
+
throw new ServiceError("validation", "A login gallery does not take a shared secret.");
|
|
349
|
+
}
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
if (!secret) {
|
|
353
|
+
throw new ServiceError("validation", "Set a PIN or password before this gallery can open.");
|
|
354
|
+
}
|
|
355
|
+
if (access === "pin") {
|
|
356
|
+
pinSecret.parse(secret);
|
|
357
|
+
} else {
|
|
358
|
+
passwordSecret.parse(secret);
|
|
359
|
+
}
|
|
360
|
+
return hashPassword(secret);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* A gallery is looked at on a screen. 1600px is the widest rendition either
|
|
365
|
+
* ladder builds, so asking for it means "the best rendition there is".
|
|
366
|
+
*/
|
|
367
|
+
const SERVE_WIDTH = 1600;
|
|
368
|
+
|
|
369
|
+
interface Delivery {
|
|
370
|
+
storageKey: string;
|
|
371
|
+
filename: string;
|
|
372
|
+
mime: string;
|
|
373
|
+
bytes: number;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/** A rendition is a different format; the name a client saves must say so. */
|
|
377
|
+
function renditionName(filename: string, format: string): string {
|
|
378
|
+
return `${filename.replace(/\.[^.]+$/, "") || "file"}.${format}`;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Which stored object a gallery hands over for one asset, or null when the
|
|
383
|
+
* policy cannot be honoured.
|
|
384
|
+
*
|
|
385
|
+
* Null is the important case. A watermarked gallery whose asset has no marked
|
|
386
|
+
* rendition must refuse rather than fall back to the master: falling back is
|
|
387
|
+
* indistinguishable, from the client's side, from the owner never having asked
|
|
388
|
+
* for a watermark, and it is the exact file the mark exists to withhold. The
|
|
389
|
+
* same applies to `web_res` on a raster image with no renditions.
|
|
390
|
+
*/
|
|
391
|
+
function deliverableFor(
|
|
392
|
+
asset: typeof assets.$inferSelect,
|
|
393
|
+
gallery: {
|
|
394
|
+
watermark: boolean;
|
|
395
|
+
downloadPolicy: (typeof GALLERY_DOWNLOAD_POLICIES)[number];
|
|
396
|
+
},
|
|
397
|
+
purpose: "view" | "download",
|
|
398
|
+
): Delivery | null {
|
|
399
|
+
const variants = (asset.variants ?? {}) as VariantSet;
|
|
400
|
+
const master: Delivery = {
|
|
401
|
+
storageKey: asset.storageKey,
|
|
402
|
+
filename: asset.filename,
|
|
403
|
+
mime: asset.mime,
|
|
404
|
+
bytes: asset.bytes,
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
if (gallery.watermark) {
|
|
408
|
+
// Watermark outranks resolution. An owner who asks for both a mark and
|
|
409
|
+
// full-resolution files is asking for two incompatible things, and the
|
|
410
|
+
// safe reading of that is the marked file.
|
|
411
|
+
const marked = pickRendition(watermarkedRenditions(variants), SERVE_WIDTH);
|
|
412
|
+
if (!marked) return null;
|
|
413
|
+
return {
|
|
414
|
+
storageKey: marked.key,
|
|
415
|
+
filename: renditionName(asset.filename, "webp"),
|
|
416
|
+
mime: "image/webp",
|
|
417
|
+
bytes: marked.bytes,
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
const web = pickRendition(
|
|
422
|
+
publicRenditions(variants).flatMap(([, renditions]) => renditions),
|
|
423
|
+
SERVE_WIDTH,
|
|
424
|
+
);
|
|
425
|
+
|
|
426
|
+
if (purpose === "view") {
|
|
427
|
+
// Viewing always prefers a rendition when one exists — it is smaller and
|
|
428
|
+
// the client is looking at it on a screen — and the master is a correct
|
|
429
|
+
// fallback because an unwatermarked gallery is not withholding anything.
|
|
430
|
+
if (!web) return master;
|
|
431
|
+
return {
|
|
432
|
+
storageKey: web.key,
|
|
433
|
+
filename: renditionName(asset.filename, "webp"),
|
|
434
|
+
mime: "image/webp",
|
|
435
|
+
bytes: web.bytes,
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
if (gallery.downloadPolicy === "web_res") {
|
|
440
|
+
if (web) {
|
|
441
|
+
return {
|
|
442
|
+
storageKey: web.key,
|
|
443
|
+
filename: renditionName(asset.filename, "webp"),
|
|
444
|
+
mime: "image/webp",
|
|
445
|
+
bytes: web.bytes,
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
// There is no web resolution of a PDF or a video, so the master is what
|
|
449
|
+
// "web-sized" means for them. A raster image with no renditions is a
|
|
450
|
+
// different story: the master is the full-resolution file the owner
|
|
451
|
+
// declined to hand over.
|
|
452
|
+
return isRasterImage(asset.mime) ? null : master;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
return master;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/** Bind a bundle to the files and policy that are currently deliverable. */
|
|
459
|
+
async function archiveContents(ctx: ServiceContext, gallery: typeof galleries.$inferSelect) {
|
|
460
|
+
const rows = await ctx.tx.select({ item: galleryItems, asset: assets })
|
|
461
|
+
.from(galleryItems).innerJoin(assets, eq(assets.id, galleryItems.assetId))
|
|
462
|
+
.where(eq(galleryItems.galleryId, gallery.id)).orderBy(asc(galleryItems.position), asc(galleryItems.id));
|
|
463
|
+
const blocked = await consentBlockedAssetIds(ctx.tx, rows.map(({ asset }) => asset.id));
|
|
464
|
+
const deliverable = rows
|
|
465
|
+
.filter(({ item, asset }) => gallery.downloadPolicy !== "none" && asset.status === "ready" &&
|
|
466
|
+
item.canView && item.canDownload && !blocked.has(asset.id))
|
|
467
|
+
.map((row) => ({ row, delivery: deliverableFor(row.asset, gallery, "download") }))
|
|
468
|
+
.filter((entry): entry is typeof entry & { delivery: Delivery } => entry.delivery !== null);
|
|
469
|
+
const deliveryHash = createHash("sha256").update(JSON.stringify({
|
|
470
|
+
policy: [gallery.downloadPolicy, gallery.downloadLimit, gallery.watermark],
|
|
471
|
+
// Include excluded/removed items and asset state too: a restriction must
|
|
472
|
+
// invalidate a ZIP containing bytes that are no longer in the live list.
|
|
473
|
+
items: rows.map(({ item, asset }) => [item.id, item.assetId, item.position,
|
|
474
|
+
item.canView, item.canDownload, asset.status, asset.updatedAt, asset.storageKey,
|
|
475
|
+
asset.filename, asset.mime, asset.bytes, asset.checksumSha256, asset.variants]),
|
|
476
|
+
blocked: [...blocked].sort(),
|
|
477
|
+
})).digest("hex");
|
|
478
|
+
return { deliverable, deliveryHash };
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/** Called only with the gallery row locked, across every download session. */
|
|
482
|
+
async function hasDownloadAllowance(ctx: ServiceContext, gallery: typeof galleries.$inferSelect, count: number) {
|
|
483
|
+
if (gallery.downloadPolicy !== "limit_n") return true;
|
|
484
|
+
const [taken] = await ctx.tx.select({ count: sql<number>`count(*)::int` })
|
|
485
|
+
.from(galleryAccessLogs).where(and(eq(galleryAccessLogs.galleryId, gallery.id),
|
|
486
|
+
eq(galleryAccessLogs.action, "download")));
|
|
487
|
+
return (taken?.count ?? 0) + count <= (gallery.downloadLimit ?? 0);
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
function itemAllowed(
|
|
491
|
+
item: { canView: boolean; canDownload: boolean },
|
|
492
|
+
guest: { canView: boolean; canDownload: boolean } | null,
|
|
493
|
+
kind: "view" | "download",
|
|
494
|
+
): boolean {
|
|
495
|
+
const itemOk = kind === "view" ? item.canView : item.canDownload;
|
|
496
|
+
if (!itemOk) return false;
|
|
497
|
+
if (!guest) return true;
|
|
498
|
+
return kind === "view" ? guest.canView : guest.canDownload;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
async function liveItems(
|
|
502
|
+
ctx: ServiceContext,
|
|
503
|
+
gallery: {
|
|
504
|
+
id: string;
|
|
505
|
+
slug: string;
|
|
506
|
+
downloadPolicy: (typeof GALLERY_DOWNLOAD_POLICIES)[number];
|
|
507
|
+
watermark: boolean;
|
|
508
|
+
},
|
|
509
|
+
guest: { canView: boolean; canDownload: boolean } | null,
|
|
510
|
+
) {
|
|
511
|
+
const rows = await ctx.tx
|
|
512
|
+
.select({
|
|
513
|
+
item: galleryItems,
|
|
514
|
+
asset: assets,
|
|
515
|
+
})
|
|
516
|
+
.from(galleryItems)
|
|
517
|
+
.innerJoin(assets, eq(assets.id, galleryItems.assetId))
|
|
518
|
+
.where(eq(galleryItems.galleryId, gallery.id))
|
|
519
|
+
.orderBy(asc(galleryItems.position));
|
|
520
|
+
return rows
|
|
521
|
+
.filter((row) => row.asset.status === "ready" && itemAllowed(row.item, guest, "view"))
|
|
522
|
+
.map((row) => {
|
|
523
|
+
const canDownload = gallery.downloadPolicy !== "none" &&
|
|
524
|
+
itemAllowed(row.item, guest, "download") &&
|
|
525
|
+
deliverableFor(row.asset, gallery, "download") !== null;
|
|
526
|
+
const path = `/g/${encodeURIComponent(gallery.slug)}`;
|
|
527
|
+
return {
|
|
528
|
+
id: row.item.id,
|
|
529
|
+
galleryId: row.item.galleryId,
|
|
530
|
+
assetId: row.item.assetId,
|
|
531
|
+
position: row.item.position,
|
|
532
|
+
canView: true,
|
|
533
|
+
canDownload,
|
|
534
|
+
viewUrl: `${path}/view/${row.item.id}`,
|
|
535
|
+
downloadUrl: canDownload ? `${path}/download/${row.item.id}` : null,
|
|
536
|
+
filename: row.asset.filename,
|
|
537
|
+
altText: row.asset.altText,
|
|
538
|
+
mime: row.asset.mime,
|
|
539
|
+
status: row.asset.status,
|
|
540
|
+
};
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* What this person has already said about this gallery.
|
|
546
|
+
*
|
|
547
|
+
* Scoped to the session's contact rather than the gallery: a partner guest
|
|
548
|
+
* proofing alongside the client sees their own marks, not the client's, so
|
|
549
|
+
* neither is nudged by the other's opinion before giving one.
|
|
550
|
+
*/
|
|
551
|
+
async function selectionsFor(
|
|
552
|
+
ctx: ServiceContext,
|
|
553
|
+
galleryId: string,
|
|
554
|
+
contactId: string | null,
|
|
555
|
+
) {
|
|
556
|
+
if (!contactId) return [];
|
|
557
|
+
return ctx.tx
|
|
558
|
+
.select()
|
|
559
|
+
.from(gallerySelections)
|
|
560
|
+
.where(
|
|
561
|
+
and(
|
|
562
|
+
eq(gallerySelections.galleryId, galleryId),
|
|
563
|
+
eq(gallerySelections.contactId, contactId),
|
|
564
|
+
),
|
|
565
|
+
)
|
|
566
|
+
.orderBy(asc(gallerySelections.createdAt));
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* The round in play, or null when nothing has been submitted yet.
|
|
571
|
+
*
|
|
572
|
+
* Read-only on purpose. Every path that shows a client their gallery is a
|
|
573
|
+
* query, and a query that inserts a row is a read with a side effect —
|
|
574
|
+
* here it would have meant an anonymous page load creating records.
|
|
575
|
+
*/
|
|
576
|
+
async function currentRound(ctx: ServiceContext, galleryId: string) {
|
|
577
|
+
const [existing] = await ctx.tx
|
|
578
|
+
.select()
|
|
579
|
+
.from(galleryRounds)
|
|
580
|
+
.where(eq(galleryRounds.galleryId, galleryId))
|
|
581
|
+
.orderBy(desc(galleryRounds.sequence))
|
|
582
|
+
.limit(1);
|
|
583
|
+
return existing ?? null;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* A round's `snapshot` column is jsonb, which drizzle types as unknown.
|
|
588
|
+
* Parsing it here means every caller gets the shape the output schema
|
|
589
|
+
* already promises, instead of each surface casting for itself.
|
|
590
|
+
*/
|
|
591
|
+
function shapeRound<T extends { snapshot: unknown }>(round: T) {
|
|
592
|
+
return { ...round, snapshot: z.array(snapshotEntry).parse(round.snapshot) };
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
|
+
* The last round the owner decided.
|
|
597
|
+
*
|
|
598
|
+
* Reopening opens a *new* round, so the note explaining why lives on the
|
|
599
|
+
* previous one. Without this the client would be told to look again and
|
|
600
|
+
* never told what at.
|
|
601
|
+
*/
|
|
602
|
+
async function lastDecidedRound(ctx: ServiceContext, galleryId: string) {
|
|
603
|
+
const [decided] = await ctx.tx
|
|
604
|
+
.select()
|
|
605
|
+
.from(galleryRounds)
|
|
606
|
+
.where(
|
|
607
|
+
and(
|
|
608
|
+
eq(galleryRounds.galleryId, galleryId),
|
|
609
|
+
inArray(galleryRounds.state, ["approved", "reopened"]),
|
|
610
|
+
),
|
|
611
|
+
)
|
|
612
|
+
.orderBy(desc(galleryRounds.sequence))
|
|
613
|
+
.limit(1);
|
|
614
|
+
return decided ?? null;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* The round in play, opened if the gallery has none. Mutations only.
|
|
619
|
+
*
|
|
620
|
+
* Created on first submit rather than at gallery creation: a gallery
|
|
621
|
+
* delivered without ever being proofed should not carry an empty round
|
|
622
|
+
* forever, and the first submit is the first moment a round means anything.
|
|
623
|
+
*/
|
|
624
|
+
async function openRound(ctx: ServiceContext, galleryId: string) {
|
|
625
|
+
const existing = await currentRound(ctx, galleryId);
|
|
626
|
+
if (existing) return existing;
|
|
627
|
+
const [created] = await ctx.tx
|
|
628
|
+
.insert(galleryRounds)
|
|
629
|
+
.values({ galleryId, sequence: 1, state: "open" })
|
|
630
|
+
.returning();
|
|
631
|
+
return created!;
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
async function issueSession(
|
|
635
|
+
ctx: ServiceContext,
|
|
636
|
+
gallery: typeof galleries.$inferSelect,
|
|
637
|
+
contactId: string | null,
|
|
638
|
+
guestId: string | null,
|
|
639
|
+
) {
|
|
640
|
+
assertLive(gallery);
|
|
641
|
+
const token = newGalleryToken();
|
|
642
|
+
await ctx.tx.insert(gallerySessions).values({
|
|
643
|
+
galleryId: gallery.id,
|
|
644
|
+
tokenHash: hashGalleryToken("session", token),
|
|
645
|
+
contactId,
|
|
646
|
+
guestId,
|
|
647
|
+
expiresAt: sessionExpiry(gallery.expiresAt),
|
|
648
|
+
});
|
|
649
|
+
return token;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
async function loadSession(ctx: ServiceContext, token: string, lockGallery = false) {
|
|
653
|
+
let [session] = await ctx.tx
|
|
654
|
+
.select()
|
|
655
|
+
.from(gallerySessions)
|
|
656
|
+
.where(eq(gallerySessions.tokenHash, hashGalleryToken("session", token)))
|
|
657
|
+
.limit(1);
|
|
658
|
+
if (!session || isExpired(session.expiresAt)) {
|
|
659
|
+
throw new ServiceError("permission", "That did not work. Nothing has changed.");
|
|
660
|
+
}
|
|
661
|
+
const gallery = await loadGallery(ctx, session.galleryId, lockGallery);
|
|
662
|
+
if (lockGallery) {
|
|
663
|
+
// Secret rotation may have invalidated the session while this request
|
|
664
|
+
// waited for the shared gallery allowance/policy lock.
|
|
665
|
+
[session] = await ctx.tx.select().from(gallerySessions)
|
|
666
|
+
.where(eq(gallerySessions.id, session.id)).limit(1);
|
|
667
|
+
if (!session || isExpired(session.expiresAt)) {
|
|
668
|
+
throw new ServiceError("permission", "That did not work. Nothing has changed.");
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
assertLive(gallery);
|
|
672
|
+
const guest = session.guestId
|
|
673
|
+
? (
|
|
674
|
+
await ctx.tx
|
|
675
|
+
.select()
|
|
676
|
+
.from(galleryGuests)
|
|
677
|
+
.where(eq(galleryGuests.id, session.guestId))
|
|
678
|
+
.limit(1)
|
|
679
|
+
)[0] ?? null
|
|
680
|
+
: null;
|
|
681
|
+
if (guest && (guest.revokedAt || isExpired(guest.expiresAt))) {
|
|
682
|
+
throw new ServiceError("permission", "That did not work. Nothing has changed.");
|
|
683
|
+
}
|
|
684
|
+
return { session, gallery, guest };
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* The named client, or a client-role guest. A partner is the invitee, never
|
|
689
|
+
* the inviter — otherwise one share becomes unbounded.
|
|
690
|
+
*/
|
|
691
|
+
function isClientSpeaker(
|
|
692
|
+
gallery: { contactId: string | null },
|
|
693
|
+
contactId: string | null,
|
|
694
|
+
guest: { role: (typeof GALLERY_GUEST_ROLES)[number] } | null | undefined,
|
|
695
|
+
): boolean {
|
|
696
|
+
if (!contactId) return false;
|
|
697
|
+
if (guest?.role === "partner") return false;
|
|
698
|
+
return contactId === gallery.contactId || guest?.role === "client";
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
async function partnersInvitedBy(
|
|
702
|
+
ctx: ServiceContext,
|
|
703
|
+
galleryId: string,
|
|
704
|
+
contactId: string,
|
|
705
|
+
) {
|
|
706
|
+
const rows = await ctx.tx
|
|
707
|
+
.select({
|
|
708
|
+
guest: galleryGuests,
|
|
709
|
+
name: contacts.name,
|
|
710
|
+
email: contacts.email,
|
|
711
|
+
})
|
|
712
|
+
.from(galleryGuests)
|
|
713
|
+
.innerJoin(contacts, eq(contacts.id, galleryGuests.contactId))
|
|
714
|
+
.where(
|
|
715
|
+
and(
|
|
716
|
+
eq(galleryGuests.galleryId, galleryId),
|
|
717
|
+
eq(galleryGuests.invitedByContactId, contactId),
|
|
718
|
+
eq(galleryGuests.role, "partner"),
|
|
719
|
+
isNull(galleryGuests.revokedAt),
|
|
720
|
+
),
|
|
721
|
+
)
|
|
722
|
+
.orderBy(desc(galleryGuests.createdAt));
|
|
723
|
+
return rows.map((row) => ({
|
|
724
|
+
...row.guest,
|
|
725
|
+
contactName: row.name,
|
|
726
|
+
contactEmail: row.email,
|
|
727
|
+
}));
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
async function openedSessionPayload(
|
|
731
|
+
ctx: ServiceContext,
|
|
732
|
+
gallery: typeof galleries.$inferSelect,
|
|
733
|
+
sessionToken: string,
|
|
734
|
+
contactId: string | null,
|
|
735
|
+
guest: typeof galleryGuests.$inferSelect | null,
|
|
736
|
+
) {
|
|
737
|
+
const speakerIsClient = isClientSpeaker(gallery, contactId, guest);
|
|
738
|
+
const items = await liveItems(ctx, gallery, guest);
|
|
739
|
+
// A gallery is a publish surface like any other (C8.16): media whose
|
|
740
|
+
// project consent no longer stands does not render here, whoever the
|
|
741
|
+
// session belongs to. Withdrawal lands on this surface with no separate
|
|
742
|
+
// step, because the filter reads the consent ledger, not a copied flag.
|
|
743
|
+
const blocked = await consentBlockedAssetIds(
|
|
744
|
+
ctx.tx,
|
|
745
|
+
items.map((item) => item.assetId),
|
|
746
|
+
);
|
|
747
|
+
const visibleItems = items.filter((item) => !blocked.has(item.assetId));
|
|
748
|
+
return {
|
|
749
|
+
ok: true as const,
|
|
750
|
+
sessionToken,
|
|
751
|
+
gallery: publicGallery(gallery),
|
|
752
|
+
items: visibleItems,
|
|
753
|
+
archiveUrl: visibleItems.some(item => item.canDownload)
|
|
754
|
+
? `/g/${encodeURIComponent(gallery.slug)}/archive` : null,
|
|
755
|
+
selections: await selectionsFor(ctx, gallery.id, contactId),
|
|
756
|
+
round: await currentRound(ctx, gallery.id),
|
|
757
|
+
lastDecided: await lastDecidedRound(ctx, gallery.id),
|
|
758
|
+
canInvitePartner: Boolean(gallery.clientCanInvitePartner && speakerIsClient),
|
|
759
|
+
invitedPartners:
|
|
760
|
+
speakerIsClient && contactId
|
|
761
|
+
? await partnersInvitedBy(ctx, gallery.id, contactId)
|
|
762
|
+
: [],
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
async function contactForUser(tx: Tx, userId: string): Promise<string | null> {
|
|
767
|
+
const [contact] = await tx
|
|
768
|
+
.select({ id: contacts.id })
|
|
769
|
+
.from(contacts)
|
|
770
|
+
.where(eq(contacts.userId, userId))
|
|
771
|
+
.limit(1);
|
|
772
|
+
return contact?.id ?? null;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
export const createGallery = defineService({
|
|
776
|
+
name: "galleries.create",
|
|
777
|
+
summary: "Start a private client gallery.",
|
|
778
|
+
kind: "mutation",
|
|
779
|
+
permission: "scoped",
|
|
780
|
+
writeClass: "write",
|
|
781
|
+
input: z.object({
|
|
782
|
+
contactId: id,
|
|
783
|
+
title: z.string().trim().min(1).max(160),
|
|
784
|
+
slug: slug.optional(),
|
|
785
|
+
access: z.enum(GALLERY_ACCESS_MODES),
|
|
786
|
+
secret: z.string().min(1).max(200).optional(),
|
|
787
|
+
expiresAt: z.iso.datetime().nullish(),
|
|
788
|
+
downloadPolicy: z.enum(GALLERY_DOWNLOAD_POLICIES).default("none"),
|
|
789
|
+
downloadLimit: z.number().int().positive().optional(),
|
|
790
|
+
watermark: z.boolean().default(false),
|
|
791
|
+
clientCanInvitePartner: z.boolean().default(false),
|
|
792
|
+
}),
|
|
793
|
+
output: galleryRow,
|
|
794
|
+
handler: async (input, ctx) => {
|
|
795
|
+
requirePerson(ctx.actor);
|
|
796
|
+
const [contact] = await ctx.tx
|
|
797
|
+
.select({ id: contacts.id })
|
|
798
|
+
.from(contacts)
|
|
799
|
+
.where(eq(contacts.id, input.contactId))
|
|
800
|
+
.limit(1);
|
|
801
|
+
if (!contact) throw new ServiceError("not_found", "No such contact.");
|
|
802
|
+
const secretHash = await hashSecret(input.access, input.secret);
|
|
803
|
+
const downloadPolicy = input.downloadPolicy;
|
|
804
|
+
const downloadLimit = downloadPolicy === "limit_n" ? (input.downloadLimit ?? null) : null;
|
|
805
|
+
if (downloadPolicy === "limit_n" && !downloadLimit) {
|
|
806
|
+
throw new ServiceError("validation", "A limited gallery needs a download count.");
|
|
807
|
+
}
|
|
808
|
+
const candidate = input.slug ?? slugify(input.title);
|
|
809
|
+
try {
|
|
810
|
+
const [created] = await ctx.tx
|
|
811
|
+
.insert(galleries)
|
|
812
|
+
.values({
|
|
813
|
+
contactId: input.contactId,
|
|
814
|
+
title: input.title,
|
|
815
|
+
slug: candidate,
|
|
816
|
+
kind: "client_delivery",
|
|
817
|
+
access: input.access,
|
|
818
|
+
secretHash,
|
|
819
|
+
expiresAt: input.expiresAt ? new Date(input.expiresAt) : null,
|
|
820
|
+
downloadPolicy,
|
|
821
|
+
downloadLimit,
|
|
822
|
+
watermark: input.watermark,
|
|
823
|
+
clientCanInvitePartner: input.clientCanInvitePartner,
|
|
824
|
+
createdByUserId: await actingUserId(ctx),
|
|
825
|
+
})
|
|
826
|
+
.returning();
|
|
827
|
+
ctx.setSubject("gallery", created!.id);
|
|
828
|
+
await ctx.emitTimeline({
|
|
829
|
+
contactId: input.contactId,
|
|
830
|
+
eventType: "gallery.created",
|
|
831
|
+
subjectType: "gallery",
|
|
832
|
+
subjectId: created!.id,
|
|
833
|
+
});
|
|
834
|
+
ctx.queueEvent("gallery.created", { id: created!.id, contactId: input.contactId });
|
|
835
|
+
return publicGallery(created!);
|
|
836
|
+
} catch (error) {
|
|
837
|
+
if (isUniqueViolation(error)) {
|
|
838
|
+
throw new ServiceError("conflict", "That address is already in use.");
|
|
839
|
+
}
|
|
840
|
+
throw error;
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
});
|
|
844
|
+
|
|
845
|
+
export const updateGallery = defineService({
|
|
846
|
+
name: "galleries.update",
|
|
847
|
+
summary: "Change a gallery's access, expiry or download rules.",
|
|
848
|
+
kind: "mutation",
|
|
849
|
+
permission: "scoped",
|
|
850
|
+
writeClass: "write",
|
|
851
|
+
input: z.object({
|
|
852
|
+
id,
|
|
853
|
+
title: z.string().trim().min(1).max(160).optional(),
|
|
854
|
+
access: z.enum(GALLERY_ACCESS_MODES).optional(),
|
|
855
|
+
secret: z.string().min(1).max(200).nullish(),
|
|
856
|
+
expiresAt: z.iso.datetime().nullish(),
|
|
857
|
+
downloadPolicy: z.enum(GALLERY_DOWNLOAD_POLICIES).optional(),
|
|
858
|
+
downloadLimit: z.number().int().positive().nullish(),
|
|
859
|
+
watermark: z.boolean().optional(),
|
|
860
|
+
clientCanInvitePartner: z.boolean().optional(),
|
|
861
|
+
coverAssetId: id.nullish(),
|
|
862
|
+
}),
|
|
863
|
+
output: galleryRow,
|
|
864
|
+
handler: async (input, ctx) => {
|
|
865
|
+
requirePerson(ctx.actor);
|
|
866
|
+
const gallery = await loadGallery(ctx, input.id);
|
|
867
|
+
const access = input.access ?? gallery.access;
|
|
868
|
+
let secretHash = gallery.secretHash;
|
|
869
|
+
if (access === "login") {
|
|
870
|
+
secretHash = null;
|
|
871
|
+
} else if (input.secret) {
|
|
872
|
+
secretHash = await hashSecret(access, input.secret);
|
|
873
|
+
} else if (access !== gallery.access || !gallery.secretHash) {
|
|
874
|
+
throw new ServiceError("validation", "Set a PIN or password before this gallery can open.");
|
|
875
|
+
}
|
|
876
|
+
const downloadPolicy = input.downloadPolicy ?? gallery.downloadPolicy;
|
|
877
|
+
const downloadLimit =
|
|
878
|
+
downloadPolicy === "limit_n"
|
|
879
|
+
? (input.downloadLimit ?? gallery.downloadLimit)
|
|
880
|
+
: null;
|
|
881
|
+
if (downloadPolicy === "limit_n" && !downloadLimit) {
|
|
882
|
+
throw new ServiceError("validation", "A limited gallery needs a download count.");
|
|
883
|
+
}
|
|
884
|
+
const [updated] = await ctx.tx
|
|
885
|
+
.update(galleries)
|
|
886
|
+
.set({
|
|
887
|
+
title: input.title ?? gallery.title,
|
|
888
|
+
access,
|
|
889
|
+
secretHash,
|
|
890
|
+
expiresAt:
|
|
891
|
+
input.expiresAt === undefined
|
|
892
|
+
? gallery.expiresAt
|
|
893
|
+
: input.expiresAt
|
|
894
|
+
? new Date(input.expiresAt)
|
|
895
|
+
: null,
|
|
896
|
+
downloadPolicy,
|
|
897
|
+
downloadLimit,
|
|
898
|
+
watermark: input.watermark ?? gallery.watermark,
|
|
899
|
+
clientCanInvitePartner:
|
|
900
|
+
input.clientCanInvitePartner ?? gallery.clientCanInvitePartner,
|
|
901
|
+
coverAssetId:
|
|
902
|
+
input.coverAssetId === undefined ? gallery.coverAssetId : input.coverAssetId,
|
|
903
|
+
})
|
|
904
|
+
.where(eq(galleries.id, gallery.id))
|
|
905
|
+
.returning();
|
|
906
|
+
if (access !== gallery.access || secretHash !== gallery.secretHash) {
|
|
907
|
+
// A changed door closes the ones already open: a session issued under
|
|
908
|
+
// the old PIN is exactly what rotating the PIN is meant to end.
|
|
909
|
+
await ctx.tx.delete(gallerySessions).where(eq(gallerySessions.galleryId, gallery.id));
|
|
910
|
+
}
|
|
911
|
+
ctx.setSubject("gallery", gallery.id);
|
|
912
|
+
return publicGallery(updated!);
|
|
913
|
+
},
|
|
914
|
+
});
|
|
915
|
+
|
|
916
|
+
export const listGalleries = defineService({
|
|
917
|
+
name: "galleries.list",
|
|
918
|
+
summary: "The private galleries this business is delivering.",
|
|
919
|
+
kind: "query",
|
|
920
|
+
permission: "scoped",
|
|
921
|
+
input: z.object({ limit: z.number().int().min(1).max(200).default(100) }),
|
|
922
|
+
output: listed(galleryRow),
|
|
923
|
+
handler: async (input, ctx) => {
|
|
924
|
+
const rows = await ctx.tx
|
|
925
|
+
.select()
|
|
926
|
+
.from(galleries)
|
|
927
|
+
.where(eq(galleries.kind, "client_delivery"))
|
|
928
|
+
.orderBy(desc(galleries.updatedAt))
|
|
929
|
+
.limit(input.limit);
|
|
930
|
+
return rows.map(publicGallery);
|
|
931
|
+
},
|
|
932
|
+
});
|
|
933
|
+
|
|
934
|
+
/** C10.29: a customer sees only galleries their own login can open. */
|
|
935
|
+
export const myGalleries = defineService({
|
|
936
|
+
name: "galleries.myGalleries",
|
|
937
|
+
summary: "Your own unexpired client galleries and active guest invitations.",
|
|
938
|
+
kind: "query",
|
|
939
|
+
permission: "authenticated",
|
|
940
|
+
input: z.object({ limit: z.number().int().min(1).max(200).default(100) }).strict(),
|
|
941
|
+
output: listed(row({ id: uuid, title: z.string(), slug: z.string(), expiresAt: timestamp.nullable(), updatedAt: timestamp })),
|
|
942
|
+
handler: async (input, ctx) => {
|
|
943
|
+
const contact = await contactForActor(ctx);
|
|
944
|
+
const now = new Date();
|
|
945
|
+
const invited = ctx.tx.select({ id: galleryGuests.id }).from(galleryGuests).where(and(
|
|
946
|
+
eq(galleryGuests.galleryId, galleries.id),
|
|
947
|
+
eq(galleryGuests.contactId, contact.id),
|
|
948
|
+
isNull(galleryGuests.revokedAt),
|
|
949
|
+
or(isNull(galleryGuests.expiresAt), gt(galleryGuests.expiresAt, now)),
|
|
950
|
+
));
|
|
951
|
+
return ctx.tx.select({ id: galleries.id, title: galleries.title, slug: galleries.slug,
|
|
952
|
+
expiresAt: galleries.expiresAt, updatedAt: galleries.updatedAt }).from(galleries).where(and(
|
|
953
|
+
eq(galleries.kind, "client_delivery"),
|
|
954
|
+
or(isNull(galleries.expiresAt), gt(galleries.expiresAt, now)),
|
|
955
|
+
or(eq(galleries.contactId, contact.id), exists(invited)),
|
|
956
|
+
)).orderBy(desc(galleries.updatedAt), desc(galleries.id)).limit(input.limit);
|
|
957
|
+
},
|
|
958
|
+
});
|
|
959
|
+
|
|
960
|
+
registerPortalSection({
|
|
961
|
+
key: "galleries",
|
|
962
|
+
order: 65,
|
|
963
|
+
load: async (ctx, _contactId, limit) => {
|
|
964
|
+
const rows = await ctx.call(myGalleries, { limit });
|
|
965
|
+
return rows.map((gallery) => ({ id: gallery.id, title: gallery.title, status: null,
|
|
966
|
+
at: gallery.updatedAt, href: `/g/${encodeURIComponent(gallery.slug)}` }));
|
|
967
|
+
},
|
|
968
|
+
});
|
|
969
|
+
|
|
970
|
+
export const getGallery = defineService({
|
|
971
|
+
name: "galleries.get",
|
|
972
|
+
summary: "One gallery, with its items, for the owner.",
|
|
973
|
+
kind: "query",
|
|
974
|
+
permission: "scoped",
|
|
975
|
+
input: z.object({ id }),
|
|
976
|
+
output: galleryRow.extend({ items: listed(itemRow) }),
|
|
977
|
+
handler: async (input, ctx) => {
|
|
978
|
+
const gallery = await loadGallery(ctx, input.id);
|
|
979
|
+
const items = await liveItems(ctx, gallery, null);
|
|
980
|
+
return { ...publicGallery(gallery), items };
|
|
981
|
+
},
|
|
982
|
+
});
|
|
983
|
+
|
|
984
|
+
export const addGalleryItem = defineService({
|
|
985
|
+
name: "galleries.addItem",
|
|
986
|
+
summary: "Put a ready asset in a client gallery.",
|
|
987
|
+
kind: "mutation",
|
|
988
|
+
permission: "scoped",
|
|
989
|
+
writeClass: "write",
|
|
990
|
+
input: z.object({
|
|
991
|
+
galleryId: id,
|
|
992
|
+
assetId: id,
|
|
993
|
+
canView: z.boolean().default(true),
|
|
994
|
+
canDownload: z.boolean().default(true),
|
|
995
|
+
}),
|
|
996
|
+
output: itemRow,
|
|
997
|
+
handler: async (input, ctx) => {
|
|
998
|
+
requirePerson(ctx.actor);
|
|
999
|
+
await loadGallery(ctx, input.galleryId);
|
|
1000
|
+
const [asset] = await ctx.tx
|
|
1001
|
+
.select({ id: assets.id, status: assets.status, filename: assets.filename })
|
|
1002
|
+
.from(assets)
|
|
1003
|
+
.where(eq(assets.id, input.assetId))
|
|
1004
|
+
.limit(1);
|
|
1005
|
+
if (!asset) throw new ServiceError("not_found", "That file is not in the library.");
|
|
1006
|
+
if (asset.status !== "ready") {
|
|
1007
|
+
throw new ServiceError("validation", "Only a ready file can go in a client gallery.");
|
|
1008
|
+
}
|
|
1009
|
+
// Privacy is durable: removing a gallery or disabling this module must
|
|
1010
|
+
// never turn a previously private client file into a public library URL.
|
|
1011
|
+
await ctx.tx.update(assets).set({ isPrivate: true }).where(eq(assets.id, asset.id));
|
|
1012
|
+
const [last] = await ctx.tx
|
|
1013
|
+
.select({ position: galleryItems.position })
|
|
1014
|
+
.from(galleryItems)
|
|
1015
|
+
.where(eq(galleryItems.galleryId, input.galleryId))
|
|
1016
|
+
.orderBy(desc(galleryItems.position))
|
|
1017
|
+
.limit(1);
|
|
1018
|
+
try {
|
|
1019
|
+
const [created] = await ctx.tx
|
|
1020
|
+
.insert(galleryItems)
|
|
1021
|
+
.values({
|
|
1022
|
+
galleryId: input.galleryId,
|
|
1023
|
+
assetId: input.assetId,
|
|
1024
|
+
position: (last?.position ?? -1) + 1,
|
|
1025
|
+
canView: input.canView,
|
|
1026
|
+
canDownload: input.canDownload,
|
|
1027
|
+
})
|
|
1028
|
+
.returning();
|
|
1029
|
+
ctx.setSubject("gallery", input.galleryId);
|
|
1030
|
+
return created!;
|
|
1031
|
+
} catch (error) {
|
|
1032
|
+
if (isUniqueViolation(error)) {
|
|
1033
|
+
throw new ServiceError("conflict", "That file is already in this gallery.");
|
|
1034
|
+
}
|
|
1035
|
+
throw error;
|
|
1036
|
+
}
|
|
1037
|
+
},
|
|
1038
|
+
});
|
|
1039
|
+
|
|
1040
|
+
export const updateGalleryItem = defineService({
|
|
1041
|
+
name: "galleries.updateItem",
|
|
1042
|
+
summary: "Change what a guest may do with one file.",
|
|
1043
|
+
kind: "mutation",
|
|
1044
|
+
permission: "scoped",
|
|
1045
|
+
writeClass: "write",
|
|
1046
|
+
input: z.object({
|
|
1047
|
+
id,
|
|
1048
|
+
canView: z.boolean().optional(),
|
|
1049
|
+
canDownload: z.boolean().optional(),
|
|
1050
|
+
}),
|
|
1051
|
+
output: itemRow,
|
|
1052
|
+
handler: async (input, ctx) => {
|
|
1053
|
+
requirePerson(ctx.actor);
|
|
1054
|
+
const [item] = await ctx.tx.select().from(galleryItems).where(eq(galleryItems.id, input.id)).limit(1);
|
|
1055
|
+
if (!item) throw new ServiceError("not_found", "That file is not in this gallery.");
|
|
1056
|
+
const [updated] = await ctx.tx
|
|
1057
|
+
.update(galleryItems)
|
|
1058
|
+
.set({
|
|
1059
|
+
canView: input.canView ?? item.canView,
|
|
1060
|
+
canDownload: input.canDownload ?? item.canDownload,
|
|
1061
|
+
})
|
|
1062
|
+
.where(eq(galleryItems.id, item.id))
|
|
1063
|
+
.returning();
|
|
1064
|
+
ctx.setSubject("gallery", item.galleryId);
|
|
1065
|
+
return updated!;
|
|
1066
|
+
},
|
|
1067
|
+
});
|
|
1068
|
+
|
|
1069
|
+
export const removeGalleryItem = defineService({
|
|
1070
|
+
name: "galleries.removeItem",
|
|
1071
|
+
summary: "Take a file out of a gallery.",
|
|
1072
|
+
kind: "mutation",
|
|
1073
|
+
permission: "scoped",
|
|
1074
|
+
writeClass: "write",
|
|
1075
|
+
input: z.object({ id }),
|
|
1076
|
+
output: okResult,
|
|
1077
|
+
handler: async (input, ctx) => {
|
|
1078
|
+
requirePerson(ctx.actor);
|
|
1079
|
+
const [removed] = await ctx.tx
|
|
1080
|
+
.delete(galleryItems)
|
|
1081
|
+
.where(eq(galleryItems.id, input.id))
|
|
1082
|
+
.returning({ id: galleryItems.id, galleryId: galleryItems.galleryId });
|
|
1083
|
+
if (!removed) throw new ServiceError("not_found", "That file is not in this gallery.");
|
|
1084
|
+
ctx.setSubject("gallery", removed.galleryId);
|
|
1085
|
+
return { ok: true as const };
|
|
1086
|
+
},
|
|
1087
|
+
});
|
|
1088
|
+
|
|
1089
|
+
export const inviteGalleryGuest = defineService({
|
|
1090
|
+
name: "galleries.inviteGuest",
|
|
1091
|
+
summary: "Give a person scoped access to a gallery.",
|
|
1092
|
+
kind: "mutation",
|
|
1093
|
+
permission: "scoped",
|
|
1094
|
+
writeClass: "write",
|
|
1095
|
+
input: z.object({
|
|
1096
|
+
galleryId: id,
|
|
1097
|
+
email: z.string().trim().email().toLowerCase(),
|
|
1098
|
+
name: z.string().trim().min(1).max(200).optional(),
|
|
1099
|
+
role: z.enum(GALLERY_GUEST_ROLES).default("partner"),
|
|
1100
|
+
canView: z.boolean().default(true),
|
|
1101
|
+
canDownload: z.boolean().default(false),
|
|
1102
|
+
expiresAt: z.iso.datetime().nullish(),
|
|
1103
|
+
}),
|
|
1104
|
+
output: guestRow.extend({
|
|
1105
|
+
token: z.string(),
|
|
1106
|
+
link: z.string(),
|
|
1107
|
+
delivers: z.boolean(),
|
|
1108
|
+
}),
|
|
1109
|
+
handler: async (input, ctx) => {
|
|
1110
|
+
requirePerson(ctx.actor);
|
|
1111
|
+
const gallery = await loadGallery(ctx, input.galleryId);
|
|
1112
|
+
const resolved = await ctx.call(resolveContact, {
|
|
1113
|
+
email: input.email,
|
|
1114
|
+
name: input.name,
|
|
1115
|
+
source: "gallery-guest",
|
|
1116
|
+
});
|
|
1117
|
+
const token = newGalleryToken();
|
|
1118
|
+
const tokenHash = hashGalleryToken("guest", token);
|
|
1119
|
+
const existing = await ctx.tx
|
|
1120
|
+
.select()
|
|
1121
|
+
.from(galleryGuests)
|
|
1122
|
+
.where(
|
|
1123
|
+
and(
|
|
1124
|
+
eq(galleryGuests.galleryId, gallery.id),
|
|
1125
|
+
eq(galleryGuests.contactId, resolved.contact.id),
|
|
1126
|
+
),
|
|
1127
|
+
)
|
|
1128
|
+
.limit(1);
|
|
1129
|
+
let guest: typeof galleryGuests.$inferSelect;
|
|
1130
|
+
if (existing[0]) {
|
|
1131
|
+
const [updated] = await ctx.tx
|
|
1132
|
+
.update(galleryGuests)
|
|
1133
|
+
.set({
|
|
1134
|
+
role: input.role,
|
|
1135
|
+
tokenHash,
|
|
1136
|
+
canView: input.canView,
|
|
1137
|
+
canDownload: input.canDownload,
|
|
1138
|
+
expiresAt: input.expiresAt ? new Date(input.expiresAt) : gallery.expiresAt,
|
|
1139
|
+
revokedAt: null,
|
|
1140
|
+
invitedByUserId: await actingUserId(ctx),
|
|
1141
|
+
invitedByContactId: null,
|
|
1142
|
+
})
|
|
1143
|
+
.where(eq(galleryGuests.id, existing[0].id))
|
|
1144
|
+
.returning();
|
|
1145
|
+
guest = updated!;
|
|
1146
|
+
} else {
|
|
1147
|
+
const [created] = await ctx.tx
|
|
1148
|
+
.insert(galleryGuests)
|
|
1149
|
+
.values({
|
|
1150
|
+
galleryId: gallery.id,
|
|
1151
|
+
contactId: resolved.contact.id,
|
|
1152
|
+
role: input.role,
|
|
1153
|
+
tokenHash,
|
|
1154
|
+
canView: input.canView,
|
|
1155
|
+
canDownload: input.canDownload,
|
|
1156
|
+
expiresAt: input.expiresAt ? new Date(input.expiresAt) : gallery.expiresAt,
|
|
1157
|
+
invitedByUserId: await actingUserId(ctx),
|
|
1158
|
+
invitedByContactId: null,
|
|
1159
|
+
})
|
|
1160
|
+
.returning();
|
|
1161
|
+
guest = created!;
|
|
1162
|
+
}
|
|
1163
|
+
const link = guestLink(gallery.slug, token);
|
|
1164
|
+
const [business] = await ctx.tx
|
|
1165
|
+
.select({ name: businessProfile.name })
|
|
1166
|
+
.from(businessProfile)
|
|
1167
|
+
.limit(1);
|
|
1168
|
+
const site = business?.name ?? "this Freeholder site";
|
|
1169
|
+
const sent = await sendGuestInvite(ctx.tx, {
|
|
1170
|
+
to: resolved.contact.email ?? input.email,
|
|
1171
|
+
site,
|
|
1172
|
+
title: gallery.title,
|
|
1173
|
+
link,
|
|
1174
|
+
expiresAt: guest.expiresAt,
|
|
1175
|
+
idempotencyKey: `gallery-guest:${guest.id}:${tokenHash.slice(0, 32)}`,
|
|
1176
|
+
});
|
|
1177
|
+
ctx.setSubject("gallery", gallery.id);
|
|
1178
|
+
await ctx.emitTimeline({
|
|
1179
|
+
contactId: resolved.contact.id,
|
|
1180
|
+
eventType: "gallery.guestInvited",
|
|
1181
|
+
subjectType: "gallery",
|
|
1182
|
+
subjectId: gallery.id,
|
|
1183
|
+
payload: { role: guest.role },
|
|
1184
|
+
});
|
|
1185
|
+
ctx.queueEvent("gallery.guestInvited", {
|
|
1186
|
+
id: guest.id,
|
|
1187
|
+
galleryId: gallery.id,
|
|
1188
|
+
contactId: resolved.contact.id,
|
|
1189
|
+
});
|
|
1190
|
+
return {
|
|
1191
|
+
...guest,
|
|
1192
|
+
contactName: resolved.contact.name,
|
|
1193
|
+
contactEmail: resolved.contact.email,
|
|
1194
|
+
token,
|
|
1195
|
+
link,
|
|
1196
|
+
delivers: sent,
|
|
1197
|
+
};
|
|
1198
|
+
},
|
|
1199
|
+
});
|
|
1200
|
+
|
|
1201
|
+
export const revokeGalleryGuest = defineService({
|
|
1202
|
+
name: "galleries.revokeGuest",
|
|
1203
|
+
summary: "Take a guest's access away.",
|
|
1204
|
+
kind: "mutation",
|
|
1205
|
+
permission: "scoped",
|
|
1206
|
+
writeClass: "write",
|
|
1207
|
+
input: z.object({ id }),
|
|
1208
|
+
output: okResult,
|
|
1209
|
+
handler: async (input, ctx) => {
|
|
1210
|
+
requirePerson(ctx.actor);
|
|
1211
|
+
const [guest] = await ctx.tx
|
|
1212
|
+
.update(galleryGuests)
|
|
1213
|
+
.set({ revokedAt: now(), tokenHash: null })
|
|
1214
|
+
.where(eq(galleryGuests.id, input.id))
|
|
1215
|
+
.returning();
|
|
1216
|
+
if (!guest) throw new ServiceError("not_found", "That guest is not here.");
|
|
1217
|
+
await ctx.tx.delete(gallerySessions).where(eq(gallerySessions.guestId, guest.id));
|
|
1218
|
+
ctx.setSubject("gallery", guest.galleryId);
|
|
1219
|
+
await ctx.emitTimeline({
|
|
1220
|
+
contactId: guest.contactId,
|
|
1221
|
+
eventType: "gallery.guestRevoked",
|
|
1222
|
+
subjectType: "gallery",
|
|
1223
|
+
subjectId: guest.galleryId,
|
|
1224
|
+
});
|
|
1225
|
+
ctx.queueEvent("gallery.guestRevoked", { id: guest.id, galleryId: guest.galleryId });
|
|
1226
|
+
return { ok: true as const };
|
|
1227
|
+
},
|
|
1228
|
+
});
|
|
1229
|
+
|
|
1230
|
+
export const inviteGalleryPartner = defineService({
|
|
1231
|
+
name: "galleries.invitePartner",
|
|
1232
|
+
summary: "The client shares this gallery with a partner, when the owner has allowed it.",
|
|
1233
|
+
kind: "mutation",
|
|
1234
|
+
permission: "public",
|
|
1235
|
+
writeClass: "write",
|
|
1236
|
+
input: z.object({
|
|
1237
|
+
sessionToken: z.string().min(20).max(200),
|
|
1238
|
+
email: z.string().trim().email().toLowerCase(),
|
|
1239
|
+
name: z.string().trim().min(1).max(200).optional(),
|
|
1240
|
+
}),
|
|
1241
|
+
rateLimit: {
|
|
1242
|
+
limit: 8,
|
|
1243
|
+
windowSeconds: 15 * 60,
|
|
1244
|
+
subject: (input) => `gallery-partner:${hashGalleryToken("session", input.sessionToken)}`,
|
|
1245
|
+
message: "Too many invites. Wait a few minutes and try again.",
|
|
1246
|
+
},
|
|
1247
|
+
output: guestRow.extend({
|
|
1248
|
+
token: z.string(),
|
|
1249
|
+
link: z.string(),
|
|
1250
|
+
delivers: z.boolean(),
|
|
1251
|
+
}),
|
|
1252
|
+
handler: async (input, ctx) => {
|
|
1253
|
+
const { session, gallery, guest: speaker } = await loadSession(ctx, input.sessionToken);
|
|
1254
|
+
if (
|
|
1255
|
+
!gallery.clientCanInvitePartner ||
|
|
1256
|
+
!session.contactId ||
|
|
1257
|
+
!isClientSpeaker(gallery, session.contactId, speaker)
|
|
1258
|
+
) {
|
|
1259
|
+
throw new ServiceError("permission", "This gallery cannot be shared that way.");
|
|
1260
|
+
}
|
|
1261
|
+
const resolved = await ctx.callAsSystem(resolveContact, {
|
|
1262
|
+
email: input.email,
|
|
1263
|
+
name: input.name,
|
|
1264
|
+
source: "gallery-guest",
|
|
1265
|
+
});
|
|
1266
|
+
if (
|
|
1267
|
+
resolved.contact.id === session.contactId ||
|
|
1268
|
+
resolved.contact.id === gallery.contactId
|
|
1269
|
+
) {
|
|
1270
|
+
throw new ServiceError("validation", "Invite someone else. This gallery is already yours.");
|
|
1271
|
+
}
|
|
1272
|
+
const token = newGalleryToken();
|
|
1273
|
+
const tokenHash = hashGalleryToken("guest", token);
|
|
1274
|
+
const existing = await ctx.tx
|
|
1275
|
+
.select()
|
|
1276
|
+
.from(galleryGuests)
|
|
1277
|
+
.where(
|
|
1278
|
+
and(
|
|
1279
|
+
eq(galleryGuests.galleryId, gallery.id),
|
|
1280
|
+
eq(galleryGuests.contactId, resolved.contact.id),
|
|
1281
|
+
),
|
|
1282
|
+
)
|
|
1283
|
+
.limit(1);
|
|
1284
|
+
let guest: typeof galleryGuests.$inferSelect;
|
|
1285
|
+
if (existing[0]) {
|
|
1286
|
+
if (
|
|
1287
|
+
existing[0].role !== "partner" ||
|
|
1288
|
+
existing[0].invitedByContactId !== session.contactId
|
|
1289
|
+
) {
|
|
1290
|
+
throw new ServiceError("conflict", "That person already has access to this gallery.");
|
|
1291
|
+
}
|
|
1292
|
+
const [updated] = await ctx.tx
|
|
1293
|
+
.update(galleryGuests)
|
|
1294
|
+
.set({
|
|
1295
|
+
tokenHash,
|
|
1296
|
+
canView: true,
|
|
1297
|
+
canDownload: false,
|
|
1298
|
+
expiresAt: gallery.expiresAt,
|
|
1299
|
+
revokedAt: null,
|
|
1300
|
+
invitedByUserId: null,
|
|
1301
|
+
invitedByContactId: session.contactId,
|
|
1302
|
+
})
|
|
1303
|
+
.where(eq(galleryGuests.id, existing[0].id))
|
|
1304
|
+
.returning();
|
|
1305
|
+
guest = updated!;
|
|
1306
|
+
} else {
|
|
1307
|
+
const [created] = await ctx.tx
|
|
1308
|
+
.insert(galleryGuests)
|
|
1309
|
+
.values({
|
|
1310
|
+
galleryId: gallery.id,
|
|
1311
|
+
contactId: resolved.contact.id,
|
|
1312
|
+
role: "partner",
|
|
1313
|
+
tokenHash,
|
|
1314
|
+
canView: true,
|
|
1315
|
+
canDownload: false,
|
|
1316
|
+
expiresAt: gallery.expiresAt,
|
|
1317
|
+
invitedByUserId: null,
|
|
1318
|
+
invitedByContactId: session.contactId,
|
|
1319
|
+
})
|
|
1320
|
+
.returning();
|
|
1321
|
+
guest = created!;
|
|
1322
|
+
}
|
|
1323
|
+
const link = guestLink(gallery.slug, token);
|
|
1324
|
+
const [business] = await ctx.tx
|
|
1325
|
+
.select({ name: businessProfile.name })
|
|
1326
|
+
.from(businessProfile)
|
|
1327
|
+
.limit(1);
|
|
1328
|
+
const site = business?.name ?? "this Freeholder site";
|
|
1329
|
+
const sent = await sendGuestInvite(ctx.tx, {
|
|
1330
|
+
to: resolved.contact.email ?? input.email,
|
|
1331
|
+
site,
|
|
1332
|
+
title: gallery.title,
|
|
1333
|
+
link,
|
|
1334
|
+
expiresAt: guest.expiresAt,
|
|
1335
|
+
idempotencyKey: `gallery-guest:${guest.id}:${tokenHash.slice(0, 32)}`,
|
|
1336
|
+
});
|
|
1337
|
+
ctx.setSubject("gallery", gallery.id);
|
|
1338
|
+
await ctx.emitTimeline({
|
|
1339
|
+
contactId: resolved.contact.id,
|
|
1340
|
+
eventType: "gallery.guestInvited",
|
|
1341
|
+
subjectType: "gallery",
|
|
1342
|
+
subjectId: gallery.id,
|
|
1343
|
+
payload: { role: guest.role, invitedBy: "client" },
|
|
1344
|
+
});
|
|
1345
|
+
ctx.queueEvent("gallery.guestInvited", {
|
|
1346
|
+
id: guest.id,
|
|
1347
|
+
galleryId: gallery.id,
|
|
1348
|
+
contactId: resolved.contact.id,
|
|
1349
|
+
});
|
|
1350
|
+
return {
|
|
1351
|
+
...guest,
|
|
1352
|
+
contactName: resolved.contact.name,
|
|
1353
|
+
contactEmail: resolved.contact.email,
|
|
1354
|
+
token,
|
|
1355
|
+
link,
|
|
1356
|
+
delivers: sent,
|
|
1357
|
+
};
|
|
1358
|
+
},
|
|
1359
|
+
});
|
|
1360
|
+
|
|
1361
|
+
export const revokeGalleryPartner = defineService({
|
|
1362
|
+
name: "galleries.revokePartner",
|
|
1363
|
+
summary: "The client takes back a partner invitation they issued.",
|
|
1364
|
+
kind: "mutation",
|
|
1365
|
+
permission: "public",
|
|
1366
|
+
writeClass: "write",
|
|
1367
|
+
input: z.object({
|
|
1368
|
+
sessionToken: z.string().min(20).max(200),
|
|
1369
|
+
id,
|
|
1370
|
+
}),
|
|
1371
|
+
output: okResult,
|
|
1372
|
+
handler: async (input, ctx) => {
|
|
1373
|
+
const { session, gallery, guest: speaker } = await loadSession(ctx, input.sessionToken);
|
|
1374
|
+
if (!session.contactId || !isClientSpeaker(gallery, session.contactId, speaker)) {
|
|
1375
|
+
throw new ServiceError("permission", "This gallery cannot be shared that way.");
|
|
1376
|
+
}
|
|
1377
|
+
const [guest] = await ctx.tx
|
|
1378
|
+
.update(galleryGuests)
|
|
1379
|
+
.set({ revokedAt: now(), tokenHash: null })
|
|
1380
|
+
.where(
|
|
1381
|
+
and(
|
|
1382
|
+
eq(galleryGuests.id, input.id),
|
|
1383
|
+
eq(galleryGuests.galleryId, gallery.id),
|
|
1384
|
+
eq(galleryGuests.invitedByContactId, session.contactId),
|
|
1385
|
+
eq(galleryGuests.role, "partner"),
|
|
1386
|
+
isNull(galleryGuests.revokedAt),
|
|
1387
|
+
),
|
|
1388
|
+
)
|
|
1389
|
+
.returning();
|
|
1390
|
+
if (!guest) throw new ServiceError("not_found", "That guest is not here.");
|
|
1391
|
+
await ctx.tx.delete(gallerySessions).where(eq(gallerySessions.guestId, guest.id));
|
|
1392
|
+
ctx.setSubject("gallery", guest.galleryId);
|
|
1393
|
+
await ctx.emitTimeline({
|
|
1394
|
+
contactId: guest.contactId,
|
|
1395
|
+
eventType: "gallery.guestRevoked",
|
|
1396
|
+
subjectType: "gallery",
|
|
1397
|
+
subjectId: guest.galleryId,
|
|
1398
|
+
payload: { invitedBy: "client" },
|
|
1399
|
+
});
|
|
1400
|
+
ctx.queueEvent("gallery.guestRevoked", { id: guest.id, galleryId: guest.galleryId });
|
|
1401
|
+
return { ok: true as const };
|
|
1402
|
+
},
|
|
1403
|
+
});
|
|
1404
|
+
|
|
1405
|
+
export const listGalleryGuests = defineService({
|
|
1406
|
+
name: "galleries.listGuests",
|
|
1407
|
+
summary: "Who has been given access to a gallery.",
|
|
1408
|
+
kind: "query",
|
|
1409
|
+
permission: "scoped",
|
|
1410
|
+
input: z.object({ galleryId: id }),
|
|
1411
|
+
output: listed(guestRow),
|
|
1412
|
+
handler: async (input, ctx) => {
|
|
1413
|
+
await loadGallery(ctx, input.galleryId);
|
|
1414
|
+
const rows = await ctx.tx
|
|
1415
|
+
.select({
|
|
1416
|
+
guest: galleryGuests,
|
|
1417
|
+
name: contacts.name,
|
|
1418
|
+
email: contacts.email,
|
|
1419
|
+
})
|
|
1420
|
+
.from(galleryGuests)
|
|
1421
|
+
.innerJoin(contacts, eq(contacts.id, galleryGuests.contactId))
|
|
1422
|
+
.where(eq(galleryGuests.galleryId, input.galleryId))
|
|
1423
|
+
.orderBy(desc(galleryGuests.createdAt));
|
|
1424
|
+
return rows.map((row) => ({
|
|
1425
|
+
...row.guest,
|
|
1426
|
+
contactName: row.name,
|
|
1427
|
+
contactEmail: row.email,
|
|
1428
|
+
}));
|
|
1429
|
+
},
|
|
1430
|
+
});
|
|
1431
|
+
|
|
1432
|
+
export const listGalleryAccess = defineService({
|
|
1433
|
+
name: "galleries.listAccess",
|
|
1434
|
+
summary: "The access audit for one gallery.",
|
|
1435
|
+
kind: "query",
|
|
1436
|
+
permission: "scoped",
|
|
1437
|
+
input: z.object({ galleryId: id, limit: z.number().int().min(1).max(200).default(100) }),
|
|
1438
|
+
output: listed(logRow),
|
|
1439
|
+
handler: async (input, ctx) => {
|
|
1440
|
+
await loadGallery(ctx, input.galleryId);
|
|
1441
|
+
return ctx.tx
|
|
1442
|
+
.select()
|
|
1443
|
+
.from(galleryAccessLogs)
|
|
1444
|
+
.where(eq(galleryAccessLogs.galleryId, input.galleryId))
|
|
1445
|
+
.orderBy(desc(galleryAccessLogs.at))
|
|
1446
|
+
.limit(input.limit);
|
|
1447
|
+
},
|
|
1448
|
+
});
|
|
1449
|
+
|
|
1450
|
+
const unlocked = z.object({
|
|
1451
|
+
ok: z.literal(true),
|
|
1452
|
+
sessionToken: z.string(),
|
|
1453
|
+
gallery: galleryRow.pick({
|
|
1454
|
+
id: true,
|
|
1455
|
+
title: true,
|
|
1456
|
+
slug: true,
|
|
1457
|
+
access: true,
|
|
1458
|
+
downloadPolicy: true,
|
|
1459
|
+
watermark: true,
|
|
1460
|
+
expiresAt: true,
|
|
1461
|
+
}),
|
|
1462
|
+
items: listed(liveItemRow),
|
|
1463
|
+
/** Controlled byte routes accept the session token as a Bearer credential. */
|
|
1464
|
+
archiveUrl: z.string().nullable(),
|
|
1465
|
+
/** This person's own marks, so the surface can render what they chose. */
|
|
1466
|
+
selections: listed(selectionRow),
|
|
1467
|
+
/** Where the approval conversation stands, which the client must see. */
|
|
1468
|
+
round: roundRow.nullable(),
|
|
1469
|
+
/** The last decided round, which carries the owner's note. */
|
|
1470
|
+
lastDecided: roundRow.nullable(),
|
|
1471
|
+
/**
|
|
1472
|
+
* The named client (or a client-role guest) may invite a partner only
|
|
1473
|
+
* when the owner has opted this gallery in. Partners never can.
|
|
1474
|
+
*/
|
|
1475
|
+
canInvitePartner: z.boolean(),
|
|
1476
|
+
/** Partners this session's contact invited and has not revoked. */
|
|
1477
|
+
invitedPartners: listed(guestRow),
|
|
1478
|
+
});
|
|
1479
|
+
const unlockResult = z.union([unlocked, z.object({ ok: z.literal(false) })]);
|
|
1480
|
+
|
|
1481
|
+
async function denyUnlock(
|
|
1482
|
+
ctx: ServiceContext,
|
|
1483
|
+
galleryId: string,
|
|
1484
|
+
contactId: string | null,
|
|
1485
|
+
): Promise<{ ok: false }> {
|
|
1486
|
+
// Recorded as the successful outcome of this call so the audit survives
|
|
1487
|
+
// commit. Throwing would roll the denial back, which is how a guessed PIN
|
|
1488
|
+
// would leave no trace.
|
|
1489
|
+
await logAccess(ctx, { galleryId, contactId, action: "denied" });
|
|
1490
|
+
return { ok: false };
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
export const unlockGallery = defineService({
|
|
1494
|
+
name: "galleries.unlock",
|
|
1495
|
+
summary: "Open a gallery with its PIN or password.",
|
|
1496
|
+
kind: "mutation",
|
|
1497
|
+
permission: "public",
|
|
1498
|
+
writeClass: "write",
|
|
1499
|
+
input: z.object({
|
|
1500
|
+
slug,
|
|
1501
|
+
secret: z.string().min(1).max(200),
|
|
1502
|
+
}),
|
|
1503
|
+
rateLimit: {
|
|
1504
|
+
limit: 8,
|
|
1505
|
+
windowSeconds: 15 * 60,
|
|
1506
|
+
subject: (input) => `gallery-unlock:${input.slug}`,
|
|
1507
|
+
message: "Too many tries. Wait a few minutes and try again.",
|
|
1508
|
+
},
|
|
1509
|
+
output: unlockResult,
|
|
1510
|
+
handler: async (input, ctx) => {
|
|
1511
|
+
const [gallery] = await ctx.tx
|
|
1512
|
+
.select()
|
|
1513
|
+
.from(galleries)
|
|
1514
|
+
.where(and(eq(galleries.slug, input.slug), eq(galleries.kind, "client_delivery")))
|
|
1515
|
+
.limit(1);
|
|
1516
|
+
if (!gallery) throw new ServiceError("not_found", "That gallery is not here.");
|
|
1517
|
+
if (isExpired(gallery.expiresAt)) {
|
|
1518
|
+
await logAccess(ctx, { galleryId: gallery.id, contactId: null, action: "denied" });
|
|
1519
|
+
throw new ServiceError("permission", "This gallery is no longer available.");
|
|
1520
|
+
}
|
|
1521
|
+
if (gallery.access === "login" || !gallery.secretHash) {
|
|
1522
|
+
return denyUnlock(ctx, gallery.id, null);
|
|
1523
|
+
}
|
|
1524
|
+
const ok = await verifyPassword(input.secret, gallery.secretHash);
|
|
1525
|
+
// The audit records that the gallery refused someone. It does not record
|
|
1526
|
+
// that the client was refused: a wrong PIN is anonymous by definition.
|
|
1527
|
+
if (!ok) return denyUnlock(ctx, gallery.id, null);
|
|
1528
|
+
const token = await issueSession(ctx, gallery, gallery.contactId, null);
|
|
1529
|
+
await logAccess(ctx, { galleryId: gallery.id, contactId: gallery.contactId, action: "view" });
|
|
1530
|
+
ctx.setSubject("gallery", gallery.id);
|
|
1531
|
+
ctx.queueEvent("gallery.accessed", { id: gallery.id, via: gallery.access });
|
|
1532
|
+
return openedSessionPayload(ctx, gallery, token, gallery.contactId, null);
|
|
1533
|
+
},
|
|
1534
|
+
});
|
|
1535
|
+
|
|
1536
|
+
export const redeemGalleryGuest = defineService({
|
|
1537
|
+
name: "galleries.redeemGuest",
|
|
1538
|
+
summary: "Open a gallery from a magic-link token.",
|
|
1539
|
+
kind: "mutation",
|
|
1540
|
+
permission: "public",
|
|
1541
|
+
writeClass: "write",
|
|
1542
|
+
input: z.object({ token: z.string().min(20).max(200) }),
|
|
1543
|
+
rateLimit: {
|
|
1544
|
+
limit: 20,
|
|
1545
|
+
windowSeconds: 15 * 60,
|
|
1546
|
+
subject: (input) => `gallery-guest:${hashGalleryToken("guest", input.token)}`,
|
|
1547
|
+
message: "Too many tries. Wait a few minutes and try again.",
|
|
1548
|
+
},
|
|
1549
|
+
output: unlockResult,
|
|
1550
|
+
handler: async (input, ctx) => {
|
|
1551
|
+
const [guest] = await ctx.tx
|
|
1552
|
+
.select()
|
|
1553
|
+
.from(galleryGuests)
|
|
1554
|
+
.where(eq(galleryGuests.tokenHash, hashGalleryToken("guest", input.token)))
|
|
1555
|
+
.limit(1);
|
|
1556
|
+
if (!guest || guest.revokedAt || isExpired(guest.expiresAt)) {
|
|
1557
|
+
throw new ServiceError("permission", "That did not work. Nothing has changed.");
|
|
1558
|
+
}
|
|
1559
|
+
const gallery = await loadGallery(ctx, guest.galleryId);
|
|
1560
|
+
if (isExpired(gallery.expiresAt)) {
|
|
1561
|
+
await logAccess(ctx, { galleryId: gallery.id, contactId: guest.contactId, action: "denied" });
|
|
1562
|
+
throw new ServiceError("permission", "This gallery is no longer available.");
|
|
1563
|
+
}
|
|
1564
|
+
const token = await issueSession(ctx, gallery, guest.contactId, guest.id);
|
|
1565
|
+
await logAccess(ctx, { galleryId: gallery.id, contactId: guest.contactId, action: "view" });
|
|
1566
|
+
ctx.setSubject("gallery", gallery.id);
|
|
1567
|
+
ctx.queueEvent("gallery.accessed", { id: gallery.id, via: "magic-link" });
|
|
1568
|
+
return openedSessionPayload(ctx, gallery, token, guest.contactId, guest);
|
|
1569
|
+
},
|
|
1570
|
+
});
|
|
1571
|
+
|
|
1572
|
+
export const openGalleryWithLogin = defineService({
|
|
1573
|
+
name: "galleries.openWithLogin",
|
|
1574
|
+
summary: "Open a gallery as the signed-in client or guest.",
|
|
1575
|
+
kind: "mutation",
|
|
1576
|
+
permission: "authenticated",
|
|
1577
|
+
writeClass: "write",
|
|
1578
|
+
input: z.object({ slug }),
|
|
1579
|
+
output: unlockResult,
|
|
1580
|
+
handler: async (input, ctx) => {
|
|
1581
|
+
if (ctx.actor.kind !== "user") {
|
|
1582
|
+
throw new ServiceError("permission", "Sign in to open this gallery.");
|
|
1583
|
+
}
|
|
1584
|
+
const [gallery] = await ctx.tx
|
|
1585
|
+
.select()
|
|
1586
|
+
.from(galleries)
|
|
1587
|
+
.where(and(eq(galleries.slug, input.slug), eq(galleries.kind, "client_delivery")))
|
|
1588
|
+
.limit(1);
|
|
1589
|
+
if (!gallery) throw new ServiceError("not_found", "That gallery is not here.");
|
|
1590
|
+
if (isExpired(gallery.expiresAt)) {
|
|
1591
|
+
await logAccess(ctx, { galleryId: gallery.id, contactId: null, action: "denied" });
|
|
1592
|
+
throw new ServiceError("permission", "This gallery is no longer available.");
|
|
1593
|
+
}
|
|
1594
|
+
const contactId = await contactForUser(ctx.tx, ctx.actor.userId);
|
|
1595
|
+
if (!contactId) return denyUnlock(ctx, gallery.id, null);
|
|
1596
|
+
const isClient = contactId === gallery.contactId;
|
|
1597
|
+
const [guest] = isClient
|
|
1598
|
+
? []
|
|
1599
|
+
: await ctx.tx
|
|
1600
|
+
.select()
|
|
1601
|
+
.from(galleryGuests)
|
|
1602
|
+
.where(
|
|
1603
|
+
and(
|
|
1604
|
+
eq(galleryGuests.galleryId, gallery.id),
|
|
1605
|
+
eq(galleryGuests.contactId, contactId),
|
|
1606
|
+
isNull(galleryGuests.revokedAt),
|
|
1607
|
+
or(isNull(galleryGuests.expiresAt), gt(galleryGuests.expiresAt, new Date())),
|
|
1608
|
+
),
|
|
1609
|
+
)
|
|
1610
|
+
.limit(1);
|
|
1611
|
+
if (!isClient && (!guest || isExpired(guest.expiresAt))) {
|
|
1612
|
+
return denyUnlock(ctx, gallery.id, contactId);
|
|
1613
|
+
}
|
|
1614
|
+
const token = await issueSession(ctx, gallery, contactId, guest?.id ?? null);
|
|
1615
|
+
await logAccess(ctx, { galleryId: gallery.id, contactId, action: "view" });
|
|
1616
|
+
ctx.setSubject("gallery", gallery.id);
|
|
1617
|
+
ctx.queueEvent("gallery.accessed", { id: gallery.id, via: "login" });
|
|
1618
|
+
return openedSessionPayload(ctx, gallery, token, contactId, guest ?? null);
|
|
1619
|
+
},
|
|
1620
|
+
});
|
|
1621
|
+
|
|
1622
|
+
export const viewGallerySession = defineService({
|
|
1623
|
+
name: "galleries.viewSession",
|
|
1624
|
+
summary: "Read a gallery through a live session token.",
|
|
1625
|
+
kind: "query",
|
|
1626
|
+
permission: "public",
|
|
1627
|
+
input: z.object({ sessionToken: z.string().min(20).max(200) }),
|
|
1628
|
+
output: unlocked,
|
|
1629
|
+
handler: async (input, ctx) => {
|
|
1630
|
+
const { session, gallery, guest } = await loadSession(ctx, input.sessionToken);
|
|
1631
|
+
return openedSessionPayload(
|
|
1632
|
+
ctx,
|
|
1633
|
+
gallery,
|
|
1634
|
+
input.sessionToken,
|
|
1635
|
+
session.contactId,
|
|
1636
|
+
guest ?? null,
|
|
1637
|
+
);
|
|
1638
|
+
},
|
|
1639
|
+
});
|
|
1640
|
+
|
|
1641
|
+
export const downloadGalleryItem = defineService({
|
|
1642
|
+
name: "galleries.downloadItem",
|
|
1643
|
+
summary: "Download one gallery file the session is allowed to take.",
|
|
1644
|
+
kind: "mutation",
|
|
1645
|
+
permission: "public",
|
|
1646
|
+
external: false,
|
|
1647
|
+
writeClass: "write",
|
|
1648
|
+
input: z.object({
|
|
1649
|
+
sessionToken: z.string().min(20).max(200),
|
|
1650
|
+
itemId: id,
|
|
1651
|
+
slug: slug.optional(),
|
|
1652
|
+
}),
|
|
1653
|
+
output: row({
|
|
1654
|
+
assetId: uuid,
|
|
1655
|
+
storageKey: z.string(),
|
|
1656
|
+
filename: z.string(),
|
|
1657
|
+
mime: z.string(),
|
|
1658
|
+
bytes: z.number(),
|
|
1659
|
+
}),
|
|
1660
|
+
handler: async (input, ctx) => {
|
|
1661
|
+
const { session, gallery, guest } = await loadSession(ctx, input.sessionToken, true);
|
|
1662
|
+
if (input.slug !== undefined && gallery.slug !== input.slug) {
|
|
1663
|
+
throw new ServiceError("not_found", "That file is not in this gallery.");
|
|
1664
|
+
}
|
|
1665
|
+
const [row] = await ctx.tx
|
|
1666
|
+
.select({ item: galleryItems, asset: assets })
|
|
1667
|
+
.from(galleryItems)
|
|
1668
|
+
.innerJoin(assets, eq(assets.id, galleryItems.assetId))
|
|
1669
|
+
.where(and(eq(galleryItems.id, input.itemId), eq(galleryItems.galleryId, gallery.id)))
|
|
1670
|
+
.limit(1);
|
|
1671
|
+
if (!row || row.asset.status !== "ready") {
|
|
1672
|
+
throw new ServiceError("not_found", "That file is not in this gallery.");
|
|
1673
|
+
}
|
|
1674
|
+
// C8.16: never hand out bytes the list would no longer show. Denied goes
|
|
1675
|
+
// in the access log like any other refused download, so the owner can see
|
|
1676
|
+
// the withdrawal being honoured.
|
|
1677
|
+
if ((await consentBlockedAssetIds(ctx.tx, [row.asset.id])).has(row.asset.id)) {
|
|
1678
|
+
await logAccess(ctx, {
|
|
1679
|
+
galleryId: gallery.id,
|
|
1680
|
+
contactId: session.contactId,
|
|
1681
|
+
action: "denied",
|
|
1682
|
+
assetId: row.asset.id,
|
|
1683
|
+
});
|
|
1684
|
+
throw new ServiceError("not_found", "That file is not in this gallery.");
|
|
1685
|
+
}
|
|
1686
|
+
const delivery =
|
|
1687
|
+
gallery.downloadPolicy === "none" || !itemAllowed(row.item, guest, "download")
|
|
1688
|
+
? null
|
|
1689
|
+
: deliverableFor(row.asset, gallery, "download");
|
|
1690
|
+
if (!delivery) {
|
|
1691
|
+
await logAccess(ctx, {
|
|
1692
|
+
galleryId: gallery.id,
|
|
1693
|
+
contactId: session.contactId,
|
|
1694
|
+
action: "denied",
|
|
1695
|
+
assetId: row.asset.id,
|
|
1696
|
+
});
|
|
1697
|
+
throw new ServiceError("permission", "That file cannot be downloaded.");
|
|
1698
|
+
}
|
|
1699
|
+
if (gallery.downloadPolicy === "limit_n") {
|
|
1700
|
+
if (!await hasDownloadAllowance(ctx, gallery, 1)) {
|
|
1701
|
+
await logAccess(ctx, {
|
|
1702
|
+
galleryId: gallery.id,
|
|
1703
|
+
contactId: session.contactId,
|
|
1704
|
+
action: "denied",
|
|
1705
|
+
assetId: row.asset.id,
|
|
1706
|
+
});
|
|
1707
|
+
throw new ServiceError("permission", "This gallery's download limit has been reached.");
|
|
1708
|
+
}
|
|
1709
|
+
// The limit is the gallery's; this column only records what this
|
|
1710
|
+
// session took, which is what the owner sees per visit.
|
|
1711
|
+
await ctx.tx
|
|
1712
|
+
.update(gallerySessions)
|
|
1713
|
+
.set({ downloadsUsed: session.downloadsUsed + 1 })
|
|
1714
|
+
.where(eq(gallerySessions.id, session.id));
|
|
1715
|
+
}
|
|
1716
|
+
await logAccess(ctx, {
|
|
1717
|
+
galleryId: gallery.id,
|
|
1718
|
+
contactId: session.contactId,
|
|
1719
|
+
action: "download",
|
|
1720
|
+
assetId: row.asset.id,
|
|
1721
|
+
});
|
|
1722
|
+
ctx.setSubject("gallery", gallery.id);
|
|
1723
|
+
return { assetId: row.asset.id, ...delivery };
|
|
1724
|
+
},
|
|
1725
|
+
});
|
|
1726
|
+
|
|
1727
|
+
export const viewGalleryItem = defineService({
|
|
1728
|
+
name: "galleries.viewItem",
|
|
1729
|
+
summary: "Authorize one gallery image for a live session.",
|
|
1730
|
+
kind: "query",
|
|
1731
|
+
permission: "public",
|
|
1732
|
+
external: false,
|
|
1733
|
+
input: z.object({
|
|
1734
|
+
sessionToken: z.string().min(20).max(200),
|
|
1735
|
+
itemId: id,
|
|
1736
|
+
slug: slug.optional(),
|
|
1737
|
+
}),
|
|
1738
|
+
output: row({
|
|
1739
|
+
assetId: uuid,
|
|
1740
|
+
storageKey: z.string(),
|
|
1741
|
+
filename: z.string(),
|
|
1742
|
+
mime: z.string(),
|
|
1743
|
+
bytes: z.number().int(),
|
|
1744
|
+
}).nullable(),
|
|
1745
|
+
handler: async (input, ctx) => {
|
|
1746
|
+
const { gallery, guest } = await loadSession(ctx, input.sessionToken);
|
|
1747
|
+
if (input.slug !== undefined && gallery.slug !== input.slug) return null;
|
|
1748
|
+
const [found] = await ctx.tx
|
|
1749
|
+
.select({ item: galleryItems, asset: assets })
|
|
1750
|
+
.from(galleryItems)
|
|
1751
|
+
.innerJoin(assets, eq(assets.id, galleryItems.assetId))
|
|
1752
|
+
.where(and(eq(galleryItems.id, input.itemId), eq(galleryItems.galleryId, gallery.id)))
|
|
1753
|
+
.limit(1);
|
|
1754
|
+
if (!found || found.asset.status !== "ready") return null;
|
|
1755
|
+
if (!itemAllowed(found.item, guest, "view")) return null;
|
|
1756
|
+
// C8.16: a blocked asset is not in this gallery for rendering purposes,
|
|
1757
|
+
// however the session got here. The list above already hid it; this is
|
|
1758
|
+
// the same rule for a direct item id.
|
|
1759
|
+
if (
|
|
1760
|
+
(await consentBlockedAssetIds(ctx.tx, [found.asset.id])).has(found.asset.id)
|
|
1761
|
+
) {
|
|
1762
|
+
return null;
|
|
1763
|
+
}
|
|
1764
|
+
// Null when a watermarked gallery has nothing marked to show: the page
|
|
1765
|
+
// renders a gap rather than the unmarked original.
|
|
1766
|
+
const delivery = deliverableFor(found.asset, gallery, "view");
|
|
1767
|
+
if (!delivery) return null;
|
|
1768
|
+
return { assetId: found.asset.id, ...delivery };
|
|
1769
|
+
},
|
|
1770
|
+
});
|
|
1771
|
+
|
|
1772
|
+
/**
|
|
1773
|
+
* Say something about one photograph (C8.05).
|
|
1774
|
+
*
|
|
1775
|
+
* The session carries who is speaking, so proofing needs no second login and
|
|
1776
|
+
* a magic-link guest can proof from a phone without an account. A person with
|
|
1777
|
+
* no contact behind their session cannot proof: an opinion nobody owns is not
|
|
1778
|
+
* one the owner can act on, and the spine is how it gets owned.
|
|
1779
|
+
*
|
|
1780
|
+
* Changing your mind updates the row rather than adding one, so the owner
|
|
1781
|
+
* never has to reconcile two answers from the same person about one frame.
|
|
1782
|
+
*/
|
|
1783
|
+
export const setGallerySelection = defineService({
|
|
1784
|
+
name: "galleries.setSelection",
|
|
1785
|
+
summary: "Mark a gallery photograph as a favourite, a select or a reject.",
|
|
1786
|
+
kind: "mutation",
|
|
1787
|
+
permission: "public",
|
|
1788
|
+
writeClass: "write",
|
|
1789
|
+
input: z.object({
|
|
1790
|
+
sessionToken: z.string().min(20).max(200),
|
|
1791
|
+
itemId: id,
|
|
1792
|
+
kind: z.enum(GALLERY_SELECTION_KINDS),
|
|
1793
|
+
comment: z.string().trim().max(2000).nullish(),
|
|
1794
|
+
}),
|
|
1795
|
+
output: selectionRow,
|
|
1796
|
+
handler: async (input, ctx) => {
|
|
1797
|
+
const { session, gallery, guest } = await loadSession(ctx, input.sessionToken);
|
|
1798
|
+
if (!session.contactId) {
|
|
1799
|
+
throw new ServiceError("permission", "This gallery cannot record a choice for you.");
|
|
1800
|
+
}
|
|
1801
|
+
const [found] = await ctx.tx
|
|
1802
|
+
.select({ item: galleryItems, asset: assets })
|
|
1803
|
+
.from(galleryItems)
|
|
1804
|
+
.innerJoin(assets, eq(assets.id, galleryItems.assetId))
|
|
1805
|
+
.where(and(eq(galleryItems.id, input.itemId), eq(galleryItems.galleryId, gallery.id)))
|
|
1806
|
+
.limit(1);
|
|
1807
|
+
if (!found || found.asset.status !== "ready") {
|
|
1808
|
+
throw new ServiceError("not_found", "That file is not in this gallery.");
|
|
1809
|
+
}
|
|
1810
|
+
// Proofing follows the view ceiling: a frame the guest cannot see is not
|
|
1811
|
+
// one they can have an opinion about.
|
|
1812
|
+
if (!itemAllowed(found.item, guest, "view")) {
|
|
1813
|
+
throw new ServiceError("permission", "That file is not in this gallery.");
|
|
1814
|
+
}
|
|
1815
|
+
const comment = input.comment?.length ? input.comment : null;
|
|
1816
|
+
const [saved] = await ctx.tx
|
|
1817
|
+
.insert(gallerySelections)
|
|
1818
|
+
.values({
|
|
1819
|
+
galleryId: gallery.id,
|
|
1820
|
+
contactId: session.contactId,
|
|
1821
|
+
assetId: found.asset.id,
|
|
1822
|
+
kind: input.kind,
|
|
1823
|
+
comment,
|
|
1824
|
+
})
|
|
1825
|
+
.onConflictDoUpdate({
|
|
1826
|
+
target: [
|
|
1827
|
+
gallerySelections.galleryId,
|
|
1828
|
+
gallerySelections.contactId,
|
|
1829
|
+
gallerySelections.assetId,
|
|
1830
|
+
],
|
|
1831
|
+
set: { kind: input.kind, comment, updatedAt: new Date() },
|
|
1832
|
+
})
|
|
1833
|
+
.returning();
|
|
1834
|
+
ctx.setSubject("gallery", gallery.id);
|
|
1835
|
+
await ctx.emitTimeline({
|
|
1836
|
+
contactId: session.contactId,
|
|
1837
|
+
eventType: "gallery.selected",
|
|
1838
|
+
subjectType: "gallery",
|
|
1839
|
+
subjectId: gallery.id,
|
|
1840
|
+
payload: { assetId: found.asset.id, kind: input.kind },
|
|
1841
|
+
});
|
|
1842
|
+
ctx.queueEvent("gallery.selected", {
|
|
1843
|
+
id: gallery.id,
|
|
1844
|
+
assetId: found.asset.id,
|
|
1845
|
+
kind: input.kind,
|
|
1846
|
+
});
|
|
1847
|
+
return saved!;
|
|
1848
|
+
},
|
|
1849
|
+
});
|
|
1850
|
+
|
|
1851
|
+
/** Take a mark back. Undoing is not a fourth opinion. */
|
|
1852
|
+
export const clearGallerySelection = defineService({
|
|
1853
|
+
name: "galleries.clearSelection",
|
|
1854
|
+
summary: "Remove this person's mark from a gallery photograph.",
|
|
1855
|
+
kind: "mutation",
|
|
1856
|
+
permission: "public",
|
|
1857
|
+
writeClass: "write",
|
|
1858
|
+
input: z.object({
|
|
1859
|
+
sessionToken: z.string().min(20).max(200),
|
|
1860
|
+
itemId: id,
|
|
1861
|
+
}),
|
|
1862
|
+
output: okResult,
|
|
1863
|
+
handler: async (input, ctx) => {
|
|
1864
|
+
const { session, gallery } = await loadSession(ctx, input.sessionToken);
|
|
1865
|
+
if (!session.contactId) return { ok: true as const };
|
|
1866
|
+
const [found] = await ctx.tx
|
|
1867
|
+
.select({ assetId: galleryItems.assetId })
|
|
1868
|
+
.from(galleryItems)
|
|
1869
|
+
.where(and(eq(galleryItems.id, input.itemId), eq(galleryItems.galleryId, gallery.id)))
|
|
1870
|
+
.limit(1);
|
|
1871
|
+
if (!found) return { ok: true as const };
|
|
1872
|
+
await ctx.tx
|
|
1873
|
+
.delete(gallerySelections)
|
|
1874
|
+
.where(
|
|
1875
|
+
and(
|
|
1876
|
+
eq(gallerySelections.galleryId, gallery.id),
|
|
1877
|
+
eq(gallerySelections.contactId, session.contactId),
|
|
1878
|
+
eq(gallerySelections.assetId, found.assetId),
|
|
1879
|
+
),
|
|
1880
|
+
);
|
|
1881
|
+
ctx.setSubject("gallery", gallery.id);
|
|
1882
|
+
return { ok: true as const };
|
|
1883
|
+
},
|
|
1884
|
+
});
|
|
1885
|
+
|
|
1886
|
+
/**
|
|
1887
|
+
* Everything everyone has said about this gallery, for the owner.
|
|
1888
|
+
*
|
|
1889
|
+
* Unlike the client's own view this is not scoped to one person: deciding what
|
|
1890
|
+
* to deliver means seeing that the client chose a frame their partner
|
|
1891
|
+
* rejected.
|
|
1892
|
+
*/
|
|
1893
|
+
export const listGallerySelections = defineService({
|
|
1894
|
+
name: "galleries.listSelections",
|
|
1895
|
+
summary: "What the client and guests chose in one gallery.",
|
|
1896
|
+
kind: "query",
|
|
1897
|
+
permission: "scoped",
|
|
1898
|
+
input: z.object({ galleryId: id }),
|
|
1899
|
+
output: listed(
|
|
1900
|
+
selectionRow.extend({
|
|
1901
|
+
contactName: z.string().nullable().optional(),
|
|
1902
|
+
filename: z.string().nullable().optional(),
|
|
1903
|
+
}),
|
|
1904
|
+
),
|
|
1905
|
+
handler: async (input, ctx) => {
|
|
1906
|
+
await loadGallery(ctx, input.galleryId);
|
|
1907
|
+
const rows = await ctx.tx
|
|
1908
|
+
.select({
|
|
1909
|
+
selection: gallerySelections,
|
|
1910
|
+
contactName: contacts.name,
|
|
1911
|
+
filename: assets.filename,
|
|
1912
|
+
})
|
|
1913
|
+
.from(gallerySelections)
|
|
1914
|
+
.leftJoin(contacts, eq(contacts.id, gallerySelections.contactId))
|
|
1915
|
+
.leftJoin(assets, eq(assets.id, gallerySelections.assetId))
|
|
1916
|
+
.where(eq(gallerySelections.galleryId, input.galleryId))
|
|
1917
|
+
.orderBy(desc(gallerySelections.updatedAt));
|
|
1918
|
+
return rows.map((row) => ({
|
|
1919
|
+
...row.selection,
|
|
1920
|
+
contactName: row.contactName,
|
|
1921
|
+
filename: row.filename,
|
|
1922
|
+
}));
|
|
1923
|
+
},
|
|
1924
|
+
});
|
|
1925
|
+
|
|
1926
|
+
/**
|
|
1927
|
+
* The client says "these are my choices" (C8.06).
|
|
1928
|
+
*
|
|
1929
|
+
* Freezes the selection set into the round, because selections stay editable
|
|
1930
|
+
* afterwards and a round that read them live would rewrite its own history
|
|
1931
|
+
* the next time the client changed their mind.
|
|
1932
|
+
*/
|
|
1933
|
+
export const submitGalleryRound = defineService({
|
|
1934
|
+
name: "galleries.submitRound",
|
|
1935
|
+
summary: "Submit this round's choices for the owner to decide.",
|
|
1936
|
+
kind: "mutation",
|
|
1937
|
+
permission: "public",
|
|
1938
|
+
writeClass: "write",
|
|
1939
|
+
input: z.object({ sessionToken: z.string().min(20).max(200) }),
|
|
1940
|
+
output: roundRow,
|
|
1941
|
+
handler: async (input, ctx) => {
|
|
1942
|
+
const { session, gallery } = await loadSession(ctx, input.sessionToken);
|
|
1943
|
+
if (!session.contactId) {
|
|
1944
|
+
throw new ServiceError("permission", "This gallery cannot record a choice for you.");
|
|
1945
|
+
}
|
|
1946
|
+
const round = await openRound(ctx, gallery.id);
|
|
1947
|
+
if (round.state !== "open") {
|
|
1948
|
+
throw new ServiceError(
|
|
1949
|
+
"conflict",
|
|
1950
|
+
"This round has already been sent. Wait for a reply before sending again.",
|
|
1951
|
+
);
|
|
1952
|
+
}
|
|
1953
|
+
const chosen = await ctx.tx
|
|
1954
|
+
.select()
|
|
1955
|
+
.from(gallerySelections)
|
|
1956
|
+
.where(eq(gallerySelections.galleryId, gallery.id))
|
|
1957
|
+
.orderBy(asc(gallerySelections.createdAt));
|
|
1958
|
+
if (chosen.length === 0) {
|
|
1959
|
+
throw new ServiceError(
|
|
1960
|
+
"validation",
|
|
1961
|
+
"Mark at least one photograph before sending your choices.",
|
|
1962
|
+
);
|
|
1963
|
+
}
|
|
1964
|
+
const [saved] = await ctx.tx
|
|
1965
|
+
.update(galleryRounds)
|
|
1966
|
+
.set({
|
|
1967
|
+
state: "submitted",
|
|
1968
|
+
submittedByContactId: session.contactId,
|
|
1969
|
+
submittedAt: new Date(),
|
|
1970
|
+
// Everyone's marks, not just this person's: the owner decides on the
|
|
1971
|
+
// whole set, and a partner's reject is part of what they are judging.
|
|
1972
|
+
snapshot: chosen.map((selection) => ({
|
|
1973
|
+
assetId: selection.assetId,
|
|
1974
|
+
kind: selection.kind,
|
|
1975
|
+
comment: selection.comment,
|
|
1976
|
+
})),
|
|
1977
|
+
updatedAt: new Date(),
|
|
1978
|
+
})
|
|
1979
|
+
.where(eq(galleryRounds.id, round.id))
|
|
1980
|
+
.returning();
|
|
1981
|
+
ctx.setSubject("gallery", gallery.id);
|
|
1982
|
+
await ctx.emitTimeline({
|
|
1983
|
+
contactId: session.contactId,
|
|
1984
|
+
eventType: "gallery.roundSubmitted",
|
|
1985
|
+
subjectType: "gallery",
|
|
1986
|
+
subjectId: gallery.id,
|
|
1987
|
+
payload: { sequence: round.sequence, chosen: chosen.length },
|
|
1988
|
+
});
|
|
1989
|
+
// Selection submitted: the owner is the one waiting on this. Only the
|
|
1990
|
+
// person who set the gallery up is named on it, so a gallery seeded
|
|
1991
|
+
// without a user simply has nobody to tell.
|
|
1992
|
+
if (gallery.createdByUserId) {
|
|
1993
|
+
await ctx.callAsSystem(getService("notifications.create"), {
|
|
1994
|
+
recipient: { kind: "user", id: gallery.createdByUserId },
|
|
1995
|
+
topic: "gallery.selection-submitted",
|
|
1996
|
+
title: "A client sent their gallery choices",
|
|
1997
|
+
body: `${gallery.title}: round ${round.sequence}, ${chosen.length} chosen.`,
|
|
1998
|
+
href: `/admin/galleries/${gallery.id}`,
|
|
1999
|
+
idempotencyKey: `gallery-submitted:${round.id}`,
|
|
2000
|
+
});
|
|
2001
|
+
}
|
|
2002
|
+
ctx.queueEvent("gallery.roundSubmitted", {
|
|
2003
|
+
id: gallery.id,
|
|
2004
|
+
roundId: round.id,
|
|
2005
|
+
sequence: round.sequence,
|
|
2006
|
+
});
|
|
2007
|
+
return saved!;
|
|
2008
|
+
},
|
|
2009
|
+
});
|
|
2010
|
+
|
|
2011
|
+
/** The owner finalizes. Approving ends the round and the conversation. */
|
|
2012
|
+
export const approveGalleryRound = defineService({
|
|
2013
|
+
name: "galleries.approveRound",
|
|
2014
|
+
summary: "Approve the round the client submitted.",
|
|
2015
|
+
kind: "mutation",
|
|
2016
|
+
permission: "scoped",
|
|
2017
|
+
writeClass: "write",
|
|
2018
|
+
input: z.object({ galleryId: id, note: z.string().trim().max(2000).nullish() }),
|
|
2019
|
+
output: roundRow,
|
|
2020
|
+
handler: async (input, ctx) => {
|
|
2021
|
+
requirePerson(ctx.actor);
|
|
2022
|
+
const gallery = await loadGallery(ctx, input.galleryId);
|
|
2023
|
+
const round = await currentRound(ctx, gallery.id);
|
|
2024
|
+
if (round?.state !== "submitted") {
|
|
2025
|
+
throw new ServiceError(
|
|
2026
|
+
"conflict",
|
|
2027
|
+
"There is nothing submitted to approve.",
|
|
2028
|
+
);
|
|
2029
|
+
}
|
|
2030
|
+
const [saved] = await ctx.tx
|
|
2031
|
+
.update(galleryRounds)
|
|
2032
|
+
.set({
|
|
2033
|
+
state: "approved",
|
|
2034
|
+
note: input.note?.length ? input.note : null,
|
|
2035
|
+
decidedAt: new Date(),
|
|
2036
|
+
updatedAt: new Date(),
|
|
2037
|
+
})
|
|
2038
|
+
.where(eq(galleryRounds.id, round.id))
|
|
2039
|
+
.returning();
|
|
2040
|
+
ctx.setSubject("gallery", gallery.id);
|
|
2041
|
+
if (gallery.contactId) {
|
|
2042
|
+
await ctx.emitTimeline({
|
|
2043
|
+
contactId: gallery.contactId,
|
|
2044
|
+
eventType: "gallery.roundApproved",
|
|
2045
|
+
subjectType: "gallery",
|
|
2046
|
+
subjectId: gallery.id,
|
|
2047
|
+
payload: { sequence: round.sequence },
|
|
2048
|
+
});
|
|
2049
|
+
}
|
|
2050
|
+
// Round approved: the client has been waiting to hear.
|
|
2051
|
+
if (gallery.contactId) {
|
|
2052
|
+
await ctx.callAsSystem(getService("notifications.create"), {
|
|
2053
|
+
recipient: { kind: "contact", id: gallery.contactId },
|
|
2054
|
+
topic: "gallery.round-approved",
|
|
2055
|
+
title: "Your gallery choices were approved",
|
|
2056
|
+
body: `${gallery.title}: round ${round.sequence} is agreed.`,
|
|
2057
|
+
idempotencyKey: `gallery-approved:${round.id}`,
|
|
2058
|
+
});
|
|
2059
|
+
}
|
|
2060
|
+
ctx.queueEvent("gallery.roundApproved", {
|
|
2061
|
+
id: gallery.id,
|
|
2062
|
+
roundId: round.id,
|
|
2063
|
+
sequence: round.sequence,
|
|
2064
|
+
});
|
|
2065
|
+
return saved!;
|
|
2066
|
+
},
|
|
2067
|
+
});
|
|
2068
|
+
|
|
2069
|
+
/**
|
|
2070
|
+
* The owner sends it back, and the next round opens.
|
|
2071
|
+
*
|
|
2072
|
+
* The reopened round keeps its snapshot, its note and its decision time. A
|
|
2073
|
+
* status field flipped back to `open` would lose exactly the thing an
|
|
2074
|
+
* approval round exists to record: what was asked for, and what was said
|
|
2075
|
+
* about it.
|
|
2076
|
+
*/
|
|
2077
|
+
export const reopenGalleryRound = defineService({
|
|
2078
|
+
name: "galleries.reopenRound",
|
|
2079
|
+
summary: "Send the round back to the client and open the next one.",
|
|
2080
|
+
kind: "mutation",
|
|
2081
|
+
permission: "scoped",
|
|
2082
|
+
writeClass: "write",
|
|
2083
|
+
input: z.object({ galleryId: id, note: z.string().trim().max(2000).nullish() }),
|
|
2084
|
+
output: roundRow,
|
|
2085
|
+
handler: async (input, ctx) => {
|
|
2086
|
+
requirePerson(ctx.actor);
|
|
2087
|
+
const gallery = await loadGallery(ctx, input.galleryId);
|
|
2088
|
+
const round = await currentRound(ctx, gallery.id);
|
|
2089
|
+
if (round?.state !== "submitted") {
|
|
2090
|
+
throw new ServiceError(
|
|
2091
|
+
"conflict",
|
|
2092
|
+
"There is nothing submitted to send back.",
|
|
2093
|
+
);
|
|
2094
|
+
}
|
|
2095
|
+
await ctx.tx
|
|
2096
|
+
.update(galleryRounds)
|
|
2097
|
+
.set({
|
|
2098
|
+
state: "reopened",
|
|
2099
|
+
note: input.note?.length ? input.note : null,
|
|
2100
|
+
decidedAt: new Date(),
|
|
2101
|
+
updatedAt: new Date(),
|
|
2102
|
+
})
|
|
2103
|
+
.where(eq(galleryRounds.id, round.id));
|
|
2104
|
+
const [next] = await ctx.tx
|
|
2105
|
+
.insert(galleryRounds)
|
|
2106
|
+
.values({ galleryId: gallery.id, sequence: round.sequence + 1, state: "open" })
|
|
2107
|
+
.returning();
|
|
2108
|
+
ctx.setSubject("gallery", gallery.id);
|
|
2109
|
+
if (gallery.contactId) {
|
|
2110
|
+
await ctx.emitTimeline({
|
|
2111
|
+
contactId: gallery.contactId,
|
|
2112
|
+
eventType: "gallery.roundReopened",
|
|
2113
|
+
subjectType: "gallery",
|
|
2114
|
+
subjectId: gallery.id,
|
|
2115
|
+
payload: { sequence: next!.sequence },
|
|
2116
|
+
});
|
|
2117
|
+
}
|
|
2118
|
+
ctx.queueEvent("gallery.roundReopened", {
|
|
2119
|
+
id: gallery.id,
|
|
2120
|
+
roundId: next!.id,
|
|
2121
|
+
sequence: next!.sequence,
|
|
2122
|
+
});
|
|
2123
|
+
return next!;
|
|
2124
|
+
},
|
|
2125
|
+
});
|
|
2126
|
+
|
|
2127
|
+
/** Every round this gallery has been through, newest first. */
|
|
2128
|
+
export const listGalleryRounds = defineService({
|
|
2129
|
+
name: "galleries.listRounds",
|
|
2130
|
+
summary: "The approval history of one gallery.",
|
|
2131
|
+
kind: "query",
|
|
2132
|
+
permission: "scoped",
|
|
2133
|
+
input: z.object({ galleryId: id }),
|
|
2134
|
+
output: listed(roundRow),
|
|
2135
|
+
handler: async (input, ctx) => {
|
|
2136
|
+
await loadGallery(ctx, input.galleryId);
|
|
2137
|
+
return ctx.tx
|
|
2138
|
+
.select()
|
|
2139
|
+
.from(galleryRounds)
|
|
2140
|
+
.where(eq(galleryRounds.galleryId, input.galleryId))
|
|
2141
|
+
.orderBy(desc(galleryRounds.sequence))
|
|
2142
|
+
.then((rows) => rows.map(shapeRound));
|
|
2143
|
+
},
|
|
2144
|
+
});
|
|
2145
|
+
|
|
2146
|
+
/**
|
|
2147
|
+
* Ask for the gallery as one download (C8.07).
|
|
2148
|
+
*
|
|
2149
|
+
* Marks it building and returns; a job does the work. A wedding gallery is
|
|
2150
|
+
* gigabytes, and the client asking must not be holding a connection open
|
|
2151
|
+
* while it is assembled.
|
|
2152
|
+
*/
|
|
2153
|
+
export const requestGalleryArchive = defineService({
|
|
2154
|
+
name: "galleries.requestArchive",
|
|
2155
|
+
summary: "Ask for this gallery as a single download.",
|
|
2156
|
+
kind: "mutation",
|
|
2157
|
+
permission: "public",
|
|
2158
|
+
writeClass: "write",
|
|
2159
|
+
input: z.object({ sessionToken: z.string().min(20).max(200) }),
|
|
2160
|
+
output: archiveRow,
|
|
2161
|
+
handler: async (input, ctx) => {
|
|
2162
|
+
const { gallery, guest } = await loadSession(ctx, input.sessionToken);
|
|
2163
|
+
if (gallery.downloadPolicy === "none" || (guest && (!guest.canView || !guest.canDownload))) {
|
|
2164
|
+
throw new ServiceError("permission", "This gallery is view-only.");
|
|
2165
|
+
}
|
|
2166
|
+
const [existing] = await ctx.tx
|
|
2167
|
+
.select()
|
|
2168
|
+
.from(galleryArchives)
|
|
2169
|
+
.where(eq(galleryArchives.galleryId, gallery.id))
|
|
2170
|
+
.limit(1);
|
|
2171
|
+
// Asking twice while one is building is the same request, not a queue.
|
|
2172
|
+
if (existing?.state === "building") return publicArchive(existing);
|
|
2173
|
+
const [queued] = await ctx.tx
|
|
2174
|
+
.insert(galleryArchives)
|
|
2175
|
+
.values({ galleryId: gallery.id, state: "building" })
|
|
2176
|
+
.onConflictDoUpdate({
|
|
2177
|
+
target: galleryArchives.galleryId,
|
|
2178
|
+
set: {
|
|
2179
|
+
state: "building",
|
|
2180
|
+
storageKey: null,
|
|
2181
|
+
bytes: null,
|
|
2182
|
+
fileCount: null,
|
|
2183
|
+
error: null,
|
|
2184
|
+
builtAt: null,
|
|
2185
|
+
deliveryHash: null,
|
|
2186
|
+
updatedAt: new Date(),
|
|
2187
|
+
},
|
|
2188
|
+
})
|
|
2189
|
+
.returning();
|
|
2190
|
+
ctx.setSubject("gallery", gallery.id);
|
|
2191
|
+
ctx.queueEvent("gallery.archiveRequested", { id: gallery.id });
|
|
2192
|
+
return publicArchive(queued!);
|
|
2193
|
+
},
|
|
2194
|
+
});
|
|
2195
|
+
|
|
2196
|
+
/**
|
|
2197
|
+
* Package one gallery. System-only: it reads every deliverable file.
|
|
2198
|
+
*
|
|
2199
|
+
* Contents follow the same policy the single-file download follows, through
|
|
2200
|
+
* `deliverableFor` — a watermarked gallery packages marked renditions, and a
|
|
2201
|
+
* `web_res` gallery packages renditions rather than masters. An archive that
|
|
2202
|
+
* ignored the policy would be the hole every per-file check exists to close.
|
|
2203
|
+
*/
|
|
2204
|
+
export const buildGalleryArchive = defineService({
|
|
2205
|
+
name: "galleries.buildArchive",
|
|
2206
|
+
summary: "Package a gallery's deliverable files into one download.",
|
|
2207
|
+
kind: "mutation",
|
|
2208
|
+
permission: "system",
|
|
2209
|
+
writeClass: "write",
|
|
2210
|
+
input: z.object({ galleryId: id }),
|
|
2211
|
+
output: archiveRow,
|
|
2212
|
+
handler: async (input, ctx) => {
|
|
2213
|
+
if (ctx.actor.kind !== "system") {
|
|
2214
|
+
throw new ServiceError("permission", "Only trusted platform work packages a gallery.");
|
|
2215
|
+
}
|
|
2216
|
+
const gallery = await loadGallery(ctx, input.galleryId);
|
|
2217
|
+
const { deliverable, deliveryHash } = await archiveContents(ctx, gallery);
|
|
2218
|
+
|
|
2219
|
+
const fail = async (message: string) => {
|
|
2220
|
+
const [failed] = await ctx.tx
|
|
2221
|
+
.update(galleryArchives)
|
|
2222
|
+
.set({ state: "failed", error: message, storageKey: null, updatedAt: new Date() })
|
|
2223
|
+
.where(eq(galleryArchives.galleryId, gallery.id))
|
|
2224
|
+
.returning();
|
|
2225
|
+
return publicArchive(failed!);
|
|
2226
|
+
};
|
|
2227
|
+
|
|
2228
|
+
if (deliverable.length === 0) {
|
|
2229
|
+
return fail("There is nothing in this gallery that can be downloaded.");
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2232
|
+
const names = uniqueNames(deliverable.map((entry) => entry.delivery.filename));
|
|
2233
|
+
const store = storage();
|
|
2234
|
+
const entries = [];
|
|
2235
|
+
for (const [index, entry] of deliverable.entries()) {
|
|
2236
|
+
const body = await store.get(entry.delivery.storageKey);
|
|
2237
|
+
// A missing object is the owner's problem to see, not something to
|
|
2238
|
+
// paper over by delivering an archive quietly short of files.
|
|
2239
|
+
if (!body) return fail(`A file in this gallery is missing: ${entry.delivery.filename}`);
|
|
2240
|
+
entries.push({
|
|
2241
|
+
name: names[index]!,
|
|
2242
|
+
body,
|
|
2243
|
+
modifiedAt: entry.row.asset.createdAt,
|
|
2244
|
+
});
|
|
2245
|
+
}
|
|
2246
|
+
|
|
2247
|
+
if (zipCeilingExceeded(entries)) {
|
|
2248
|
+
return fail(
|
|
2249
|
+
"This gallery is too large for a single download. Deliver it in parts.",
|
|
2250
|
+
);
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
const zip = buildZip(entries);
|
|
2254
|
+
const key = `${gallery.slug}-${zip.sha256.slice(0, 12)}.zip`;
|
|
2255
|
+
await store.put(key, zip.body, "application/zip");
|
|
2256
|
+
const [ready] = await ctx.tx
|
|
2257
|
+
.update(galleryArchives)
|
|
2258
|
+
.set({
|
|
2259
|
+
state: "ready",
|
|
2260
|
+
storageKey: key,
|
|
2261
|
+
bytes: zip.bytes,
|
|
2262
|
+
fileCount: zip.entries,
|
|
2263
|
+
deliveryHash,
|
|
2264
|
+
error: null,
|
|
2265
|
+
builtAt: new Date(),
|
|
2266
|
+
updatedAt: new Date(),
|
|
2267
|
+
})
|
|
2268
|
+
.where(eq(galleryArchives.galleryId, gallery.id))
|
|
2269
|
+
.returning();
|
|
2270
|
+
|
|
2271
|
+
// Gallery ready: the client asked for this, so they hear about it.
|
|
2272
|
+
if (gallery.contactId) {
|
|
2273
|
+
await ctx.callAsSystem(getService("notifications.create"), {
|
|
2274
|
+
recipient: { kind: "contact", id: gallery.contactId },
|
|
2275
|
+
topic: "gallery.ready",
|
|
2276
|
+
title: "Your gallery is ready to download",
|
|
2277
|
+
body: `${gallery.title} is packaged and waiting.`,
|
|
2278
|
+
idempotencyKey: `gallery-ready:${gallery.id}:${zip.sha256.slice(0, 16)}`,
|
|
2279
|
+
});
|
|
2280
|
+
}
|
|
2281
|
+
ctx.setSubject("gallery", gallery.id);
|
|
2282
|
+
ctx.queueEvent("gallery.ready", { id: gallery.id, bytes: zip.bytes });
|
|
2283
|
+
return publicArchive(ready!);
|
|
2284
|
+
},
|
|
2285
|
+
});
|
|
2286
|
+
|
|
2287
|
+
/** Where the packaging has got to, for the client's own gallery. */
|
|
2288
|
+
export const galleryArchiveState = defineService({
|
|
2289
|
+
name: "galleries.archiveState",
|
|
2290
|
+
summary: "Whether this gallery has been packaged yet.",
|
|
2291
|
+
kind: "query",
|
|
2292
|
+
permission: "public",
|
|
2293
|
+
input: z.object({ sessionToken: z.string().min(20).max(200) }),
|
|
2294
|
+
output: archiveRow.nullable(),
|
|
2295
|
+
handler: async (input, ctx) => {
|
|
2296
|
+
const { gallery, guest } = await loadSession(ctx, input.sessionToken);
|
|
2297
|
+
if (gallery.downloadPolicy === "none" || (guest && (!guest.canView || !guest.canDownload))) return null;
|
|
2298
|
+
const [archive] = await ctx.tx
|
|
2299
|
+
.select()
|
|
2300
|
+
.from(galleryArchives)
|
|
2301
|
+
.where(eq(galleryArchives.galleryId, gallery.id))
|
|
2302
|
+
.limit(1);
|
|
2303
|
+
if (!archive) return null;
|
|
2304
|
+
if (archive.state === "ready" && (!archive.deliveryHash ||
|
|
2305
|
+
archive.deliveryHash !== (await archiveContents(ctx, gallery)).deliveryHash)) {
|
|
2306
|
+
// Keep the old bundle offline and let the existing translated failed /
|
|
2307
|
+
// request-again surface offer recovery, rather than a ready 404 link.
|
|
2308
|
+
return { ...publicArchive(archive), state: "failed" as const, error: "The gallery changed. Request a new archive." };
|
|
2309
|
+
}
|
|
2310
|
+
return publicArchive(archive);
|
|
2311
|
+
},
|
|
2312
|
+
});
|
|
2313
|
+
|
|
2314
|
+
/** The bytes, through the session, exactly as a single file is served. */
|
|
2315
|
+
export const downloadGalleryArchive = defineService({
|
|
2316
|
+
name: "galleries.downloadArchive",
|
|
2317
|
+
summary: "Download the packaged gallery.",
|
|
2318
|
+
kind: "mutation",
|
|
2319
|
+
writeClass: "write",
|
|
2320
|
+
permission: "public",
|
|
2321
|
+
external: false,
|
|
2322
|
+
input: z.object({ sessionToken: z.string().min(20).max(200), slug: slug.optional() }),
|
|
2323
|
+
output: row({ storageKey: z.string(), filename: z.string(), bytes: z.number().int() }).nullable(),
|
|
2324
|
+
handler: async (input, ctx) => {
|
|
2325
|
+
const { session, gallery, guest } = await loadSession(ctx, input.sessionToken, true);
|
|
2326
|
+
if (input.slug !== undefined && gallery.slug !== input.slug) return null;
|
|
2327
|
+
if (gallery.downloadPolicy === "none" || (guest && (!guest.canView || !guest.canDownload))) return null;
|
|
2328
|
+
const [archive] = await ctx.tx
|
|
2329
|
+
.select()
|
|
2330
|
+
.from(galleryArchives)
|
|
2331
|
+
.where(eq(galleryArchives.galleryId, gallery.id))
|
|
2332
|
+
.limit(1);
|
|
2333
|
+
if (archive?.state !== "ready" || !archive.storageKey || !archive.deliveryHash) return null;
|
|
2334
|
+
const current = await archiveContents(ctx, gallery);
|
|
2335
|
+
if (archive.deliveryHash !== current.deliveryHash || current.deliverable.length === 0) return null;
|
|
2336
|
+
if (!await hasDownloadAllowance(ctx, gallery, current.deliverable.length)) return null;
|
|
2337
|
+
// A ZIP consumes one allowance per contained file, under the same lock
|
|
2338
|
+
// and log as individual downloads. Reopening a session cannot reset it.
|
|
2339
|
+
for (const { row } of current.deliverable) {
|
|
2340
|
+
await logAccess(ctx, { galleryId: gallery.id, contactId: session.contactId,
|
|
2341
|
+
action: "download", assetId: row.asset.id });
|
|
2342
|
+
}
|
|
2343
|
+
if (gallery.downloadPolicy === "limit_n") {
|
|
2344
|
+
await ctx.tx.update(gallerySessions).set({ downloadsUsed: session.downloadsUsed + current.deliverable.length })
|
|
2345
|
+
.where(eq(gallerySessions.id, session.id));
|
|
2346
|
+
}
|
|
2347
|
+
return {
|
|
2348
|
+
storageKey: archive.storageKey,
|
|
2349
|
+
filename: `${gallery.slug}.zip`,
|
|
2350
|
+
bytes: archive.bytes ?? 0,
|
|
2351
|
+
};
|
|
2352
|
+
},
|
|
2353
|
+
});
|
|
2354
|
+
|
|
2355
|
+
/**
|
|
2356
|
+
* Offer a product on this gallery (§4.5, C8.08).
|
|
2357
|
+
*
|
|
2358
|
+
* A link and nothing more. The variant owns price, stock and tax; recording
|
|
2359
|
+
* a second opinion here is how two answers to one question get shipped.
|
|
2360
|
+
*/
|
|
2361
|
+
export const addGalleryPriceSheetItem = defineService({
|
|
2362
|
+
name: "galleries.addPriceSheetItem",
|
|
2363
|
+
summary: "Offer a product variant for sale from this gallery.",
|
|
2364
|
+
kind: "mutation",
|
|
2365
|
+
permission: "scoped",
|
|
2366
|
+
writeClass: "write",
|
|
2367
|
+
input: z.object({
|
|
2368
|
+
galleryId: id,
|
|
2369
|
+
variantId: id,
|
|
2370
|
+
position: z.number().int().min(0).max(10_000).default(0),
|
|
2371
|
+
}),
|
|
2372
|
+
output: priceSheetRow,
|
|
2373
|
+
handler: async (input, ctx) => {
|
|
2374
|
+
requirePerson(ctx.actor);
|
|
2375
|
+
const gallery = await loadGallery(ctx, input.galleryId);
|
|
2376
|
+
const [saved] = await ctx.tx
|
|
2377
|
+
.insert(galleryPriceSheetItems)
|
|
2378
|
+
.values({
|
|
2379
|
+
galleryId: gallery.id,
|
|
2380
|
+
variantId: input.variantId,
|
|
2381
|
+
position: input.position,
|
|
2382
|
+
})
|
|
2383
|
+
.onConflictDoUpdate({
|
|
2384
|
+
target: [galleryPriceSheetItems.galleryId, galleryPriceSheetItems.variantId],
|
|
2385
|
+
set: { position: input.position, updatedAt: new Date() },
|
|
2386
|
+
})
|
|
2387
|
+
.returning();
|
|
2388
|
+
ctx.setSubject("gallery", gallery.id);
|
|
2389
|
+
return saved!;
|
|
2390
|
+
},
|
|
2391
|
+
});
|
|
2392
|
+
|
|
2393
|
+
/** Stop offering a product from this gallery. */
|
|
2394
|
+
export const removeGalleryPriceSheetItem = defineService({
|
|
2395
|
+
name: "galleries.removePriceSheetItem",
|
|
2396
|
+
summary: "Stop offering a product variant from this gallery.",
|
|
2397
|
+
kind: "mutation",
|
|
2398
|
+
permission: "scoped",
|
|
2399
|
+
writeClass: "write",
|
|
2400
|
+
input: z.object({ id }),
|
|
2401
|
+
output: okResult,
|
|
2402
|
+
handler: async (input, ctx) => {
|
|
2403
|
+
requirePerson(ctx.actor);
|
|
2404
|
+
const [removed] = await ctx.tx
|
|
2405
|
+
.delete(galleryPriceSheetItems)
|
|
2406
|
+
.where(eq(galleryPriceSheetItems.id, input.id))
|
|
2407
|
+
.returning();
|
|
2408
|
+
if (removed) ctx.setSubject("gallery", removed.galleryId);
|
|
2409
|
+
return { ok: true as const };
|
|
2410
|
+
},
|
|
2411
|
+
});
|
|
2412
|
+
|
|
2413
|
+
/** What this gallery offers, for the owner and for the client's session. */
|
|
2414
|
+
export const listGalleryPriceSheet = defineService({
|
|
2415
|
+
name: "galleries.listPriceSheet",
|
|
2416
|
+
summary: "The products this gallery sells.",
|
|
2417
|
+
kind: "query",
|
|
2418
|
+
permission: "scoped",
|
|
2419
|
+
input: z.object({ galleryId: id }),
|
|
2420
|
+
output: listed(priceSheetRow),
|
|
2421
|
+
handler: async (input, ctx) => {
|
|
2422
|
+
await loadGallery(ctx, input.galleryId);
|
|
2423
|
+
return ctx.tx
|
|
2424
|
+
.select()
|
|
2425
|
+
.from(galleryPriceSheetItems)
|
|
2426
|
+
.where(eq(galleryPriceSheetItems.galleryId, input.galleryId))
|
|
2427
|
+
.orderBy(asc(galleryPriceSheetItems.position));
|
|
2428
|
+
},
|
|
2429
|
+
});
|
|
2430
|
+
|
|
2431
|
+
/**
|
|
2432
|
+
* Buy a print of one photograph (§4.5, C8.08).
|
|
2433
|
+
*
|
|
2434
|
+
* Goes through `catalog.addCartItem` rather than beside it. §4.5 forbids a
|
|
2435
|
+
* parallel commerce path, and this is what honouring that looks like: the
|
|
2436
|
+
* gallery decides *what may be bought and of which frame*, and commerce
|
|
2437
|
+
* decides price, stock, tax and the order — each answering only the question
|
|
2438
|
+
* it owns.
|
|
2439
|
+
*
|
|
2440
|
+
* `ctx.call` keeps it in one transaction, so a cart line and the audit entry
|
|
2441
|
+
* describing it cannot half-commit.
|
|
2442
|
+
*/
|
|
2443
|
+
export const addGalleryItemToCart = defineService({
|
|
2444
|
+
name: "galleries.addToCart",
|
|
2445
|
+
summary: "Add a print of one gallery photograph to a cart.",
|
|
2446
|
+
kind: "mutation",
|
|
2447
|
+
permission: "public",
|
|
2448
|
+
writeClass: "write",
|
|
2449
|
+
input: z.object({
|
|
2450
|
+
sessionToken: z.string().min(20).max(200),
|
|
2451
|
+
itemId: id,
|
|
2452
|
+
variantId: id,
|
|
2453
|
+
cartId: id,
|
|
2454
|
+
cartToken: z.string().uuid().optional(),
|
|
2455
|
+
quantity: z.number().int().min(1).max(1_000).default(1),
|
|
2456
|
+
}),
|
|
2457
|
+
output: okResult,
|
|
2458
|
+
handler: async (input, ctx) => {
|
|
2459
|
+
const { session, gallery, guest } = await loadSession(ctx, input.sessionToken);
|
|
2460
|
+
const [found] = await ctx.tx
|
|
2461
|
+
.select({ item: galleryItems, asset: assets })
|
|
2462
|
+
.from(galleryItems)
|
|
2463
|
+
.innerJoin(assets, eq(assets.id, galleryItems.assetId))
|
|
2464
|
+
.where(and(eq(galleryItems.id, input.itemId), eq(galleryItems.galleryId, gallery.id)))
|
|
2465
|
+
.limit(1);
|
|
2466
|
+
if (!found || found.asset.status !== "ready") {
|
|
2467
|
+
throw new ServiceError("not_found", "That file is not in this gallery.");
|
|
2468
|
+
}
|
|
2469
|
+
// Buying follows the view ceiling. A frame this person cannot see is not
|
|
2470
|
+
// one they can order a print of.
|
|
2471
|
+
if (!itemAllowed(found.item, guest, "view")) {
|
|
2472
|
+
throw new ServiceError("permission", "That file is not in this gallery.");
|
|
2473
|
+
}
|
|
2474
|
+
// Only what the owner put on the sheet. Without this the variant id is
|
|
2475
|
+
// an open door onto the whole catalogue from a PIN-gated page.
|
|
2476
|
+
const [offered] = await ctx.tx
|
|
2477
|
+
.select({ id: galleryPriceSheetItems.id })
|
|
2478
|
+
.from(galleryPriceSheetItems)
|
|
2479
|
+
.where(
|
|
2480
|
+
and(
|
|
2481
|
+
eq(galleryPriceSheetItems.galleryId, gallery.id),
|
|
2482
|
+
eq(galleryPriceSheetItems.variantId, input.variantId),
|
|
2483
|
+
),
|
|
2484
|
+
)
|
|
2485
|
+
.limit(1);
|
|
2486
|
+
if (!offered) {
|
|
2487
|
+
throw new ServiceError("permission", "That is not for sale from this gallery.");
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
await ctx.call(getService("catalog.addCartItem"), {
|
|
2491
|
+
cartId: input.cartId,
|
|
2492
|
+
cartToken: input.cartToken,
|
|
2493
|
+
variantId: input.variantId,
|
|
2494
|
+
quantity: input.quantity,
|
|
2495
|
+
galleryId: gallery.id,
|
|
2496
|
+
assetId: found.asset.id,
|
|
2497
|
+
});
|
|
2498
|
+
|
|
2499
|
+
ctx.setSubject("gallery", gallery.id);
|
|
2500
|
+
if (session.contactId) {
|
|
2501
|
+
await ctx.emitTimeline({
|
|
2502
|
+
contactId: session.contactId,
|
|
2503
|
+
eventType: "gallery.ordered",
|
|
2504
|
+
subjectType: "gallery",
|
|
2505
|
+
subjectId: gallery.id,
|
|
2506
|
+
payload: { assetId: found.asset.id, variantId: input.variantId },
|
|
2507
|
+
});
|
|
2508
|
+
}
|
|
2509
|
+
ctx.queueEvent("gallery.ordered", {
|
|
2510
|
+
id: gallery.id,
|
|
2511
|
+
assetId: found.asset.id,
|
|
2512
|
+
variantId: input.variantId,
|
|
2513
|
+
});
|
|
2514
|
+
return { ok: true as const };
|
|
2515
|
+
},
|
|
2516
|
+
});
|
|
2517
|
+
|
|
2518
|
+
export const galleryBySlug = defineService({
|
|
2519
|
+
name: "galleries.publicBySlug",
|
|
2520
|
+
summary: "The lock screen facts for a gallery, never its files.",
|
|
2521
|
+
kind: "query",
|
|
2522
|
+
permission: "public",
|
|
2523
|
+
input: z.object({ slug }),
|
|
2524
|
+
output: row({
|
|
2525
|
+
title: z.string(),
|
|
2526
|
+
slug: z.string(),
|
|
2527
|
+
access: z.enum(GALLERY_ACCESS_MODES),
|
|
2528
|
+
expired: z.boolean(),
|
|
2529
|
+
}).nullable(),
|
|
2530
|
+
handler: async (input, ctx) => {
|
|
2531
|
+
const [gallery] = await ctx.tx
|
|
2532
|
+
.select({
|
|
2533
|
+
title: galleries.title,
|
|
2534
|
+
slug: galleries.slug,
|
|
2535
|
+
access: galleries.access,
|
|
2536
|
+
expiresAt: galleries.expiresAt,
|
|
2537
|
+
kind: galleries.kind,
|
|
2538
|
+
})
|
|
2539
|
+
.from(galleries)
|
|
2540
|
+
.where(and(eq(galleries.slug, input.slug), eq(galleries.kind, "client_delivery")))
|
|
2541
|
+
.limit(1);
|
|
2542
|
+
if (!gallery) return null;
|
|
2543
|
+
return {
|
|
2544
|
+
title: gallery.title,
|
|
2545
|
+
slug: gallery.slug,
|
|
2546
|
+
access: gallery.access,
|
|
2547
|
+
expired: isExpired(gallery.expiresAt),
|
|
2548
|
+
};
|
|
2549
|
+
},
|
|
2550
|
+
});
|
|
2551
|
+
|
|
2552
|
+
export const expireGallerySessions = defineService({
|
|
2553
|
+
name: "galleries.expireSessions",
|
|
2554
|
+
summary: "Delete gallery sessions that have expired.",
|
|
2555
|
+
kind: "mutation",
|
|
2556
|
+
permission: "system",
|
|
2557
|
+
writeClass: "write",
|
|
2558
|
+
input: z.object({}),
|
|
2559
|
+
output: row({ deleted: z.number().int() }),
|
|
2560
|
+
handler: async (_input, ctx) => {
|
|
2561
|
+
const deleted = await ctx.tx
|
|
2562
|
+
.delete(gallerySessions)
|
|
2563
|
+
.where(lt(gallerySessions.expiresAt, sql`now()`))
|
|
2564
|
+
.returning({ id: gallerySessions.id });
|
|
2565
|
+
return { deleted: deleted.length };
|
|
2566
|
+
},
|
|
2567
|
+
});
|
|
2568
|
+
|
|
2569
|
+
registerContactReference({
|
|
2570
|
+
table: "galleries",
|
|
2571
|
+
repoint: (tx, duplicateId, survivingId) =>
|
|
2572
|
+
tx.update(galleries).set({ contactId: survivingId }).where(eq(galleries.contactId, duplicateId)),
|
|
2573
|
+
captureForUndo: async (tx, duplicateId, survivingId) => ({
|
|
2574
|
+
state: await tx
|
|
2575
|
+
.select({ id: galleries.id, contactId: galleries.contactId })
|
|
2576
|
+
.from(galleries)
|
|
2577
|
+
.where(inArray(galleries.contactId, [duplicateId, survivingId])),
|
|
2578
|
+
undoable: true,
|
|
2579
|
+
}),
|
|
2580
|
+
restoreAfterUndo: async (tx, beforeState, _afterState, duplicateId) => {
|
|
2581
|
+
const moved = z
|
|
2582
|
+
.array(z.object({ id: z.string().uuid(), contactId: z.string().uuid() }))
|
|
2583
|
+
.parse(beforeState)
|
|
2584
|
+
.filter((gallery) => gallery.contactId === duplicateId);
|
|
2585
|
+
if (moved.length) {
|
|
2586
|
+
await tx
|
|
2587
|
+
.update(galleries)
|
|
2588
|
+
.set({ contactId: duplicateId })
|
|
2589
|
+
.where(inArray(galleries.id, moved.map((gallery) => gallery.id)));
|
|
2590
|
+
}
|
|
2591
|
+
},
|
|
2592
|
+
});
|
|
2593
|
+
|
|
2594
|
+
registerContactReference({
|
|
2595
|
+
table: "gallery_guests",
|
|
2596
|
+
// A guest row is unique per gallery+person. If the survivor is already a
|
|
2597
|
+
// guest on the same gallery, the duplicate's row is dropped rather than
|
|
2598
|
+
// violating the unique index — two invitations to the same person are one.
|
|
2599
|
+
repoint: async (tx, duplicateId, survivingId) => {
|
|
2600
|
+
const duplicateGuests = await tx
|
|
2601
|
+
.select()
|
|
2602
|
+
.from(galleryGuests)
|
|
2603
|
+
.where(eq(galleryGuests.contactId, duplicateId));
|
|
2604
|
+
for (const guest of duplicateGuests) {
|
|
2605
|
+
const [survivor] = await tx
|
|
2606
|
+
.select({ id: galleryGuests.id })
|
|
2607
|
+
.from(galleryGuests)
|
|
2608
|
+
.where(
|
|
2609
|
+
and(eq(galleryGuests.galleryId, guest.galleryId), eq(galleryGuests.contactId, survivingId)),
|
|
2610
|
+
)
|
|
2611
|
+
.limit(1);
|
|
2612
|
+
if (survivor) {
|
|
2613
|
+
await tx.delete(gallerySessions).where(eq(gallerySessions.guestId, guest.id));
|
|
2614
|
+
await tx.delete(galleryGuests).where(eq(galleryGuests.id, guest.id));
|
|
2615
|
+
} else {
|
|
2616
|
+
await tx
|
|
2617
|
+
.update(galleryGuests)
|
|
2618
|
+
.set({ contactId: survivingId })
|
|
2619
|
+
.where(eq(galleryGuests.id, guest.id));
|
|
2620
|
+
}
|
|
2621
|
+
}
|
|
2622
|
+
await tx
|
|
2623
|
+
.update(galleryGuests)
|
|
2624
|
+
.set({ invitedByContactId: survivingId })
|
|
2625
|
+
.where(eq(galleryGuests.invitedByContactId, duplicateId));
|
|
2626
|
+
},
|
|
2627
|
+
captureForUndo: async (tx, duplicateId, survivingId) => ({
|
|
2628
|
+
state: await tx
|
|
2629
|
+
.select({
|
|
2630
|
+
id: galleryGuests.id,
|
|
2631
|
+
contactId: galleryGuests.contactId,
|
|
2632
|
+
invitedByContactId: galleryGuests.invitedByContactId,
|
|
2633
|
+
})
|
|
2634
|
+
.from(galleryGuests)
|
|
2635
|
+
.where(
|
|
2636
|
+
or(
|
|
2637
|
+
inArray(galleryGuests.contactId, [duplicateId, survivingId]),
|
|
2638
|
+
inArray(galleryGuests.invitedByContactId, [duplicateId, survivingId]),
|
|
2639
|
+
),
|
|
2640
|
+
),
|
|
2641
|
+
undoable: true,
|
|
2642
|
+
}),
|
|
2643
|
+
restoreAfterUndo: async (tx, beforeState, _afterState, duplicateId) => {
|
|
2644
|
+
const rows = z
|
|
2645
|
+
.array(
|
|
2646
|
+
z.object({
|
|
2647
|
+
id: z.string().uuid(),
|
|
2648
|
+
contactId: z.string().uuid(),
|
|
2649
|
+
invitedByContactId: z.string().uuid().nullable(),
|
|
2650
|
+
}),
|
|
2651
|
+
)
|
|
2652
|
+
.parse(beforeState);
|
|
2653
|
+
const moved = rows.filter((guest) => guest.contactId === duplicateId);
|
|
2654
|
+
if (moved.length) {
|
|
2655
|
+
await tx
|
|
2656
|
+
.update(galleryGuests)
|
|
2657
|
+
.set({ contactId: duplicateId })
|
|
2658
|
+
.where(inArray(galleryGuests.id, moved.map((guest) => guest.id)));
|
|
2659
|
+
}
|
|
2660
|
+
const invited = rows.filter((guest) => guest.invitedByContactId === duplicateId);
|
|
2661
|
+
if (invited.length) {
|
|
2662
|
+
await tx
|
|
2663
|
+
.update(galleryGuests)
|
|
2664
|
+
.set({ invitedByContactId: duplicateId })
|
|
2665
|
+
.where(inArray(galleryGuests.id, invited.map((guest) => guest.id)));
|
|
2666
|
+
}
|
|
2667
|
+
},
|
|
2668
|
+
});
|
|
2669
|
+
|
|
2670
|
+
registerContactReference({
|
|
2671
|
+
table: "gallery_access_logs",
|
|
2672
|
+
repoint: (tx, duplicateId, survivingId) =>
|
|
2673
|
+
tx
|
|
2674
|
+
.update(galleryAccessLogs)
|
|
2675
|
+
.set({ contactId: survivingId })
|
|
2676
|
+
.where(eq(galleryAccessLogs.contactId, duplicateId)),
|
|
2677
|
+
captureForUndo: async (tx, duplicateId, survivingId) => ({
|
|
2678
|
+
state: await tx
|
|
2679
|
+
.select({ id: galleryAccessLogs.id, contactId: galleryAccessLogs.contactId })
|
|
2680
|
+
.from(galleryAccessLogs)
|
|
2681
|
+
.where(inArray(galleryAccessLogs.contactId, [duplicateId, survivingId])),
|
|
2682
|
+
undoable: true,
|
|
2683
|
+
}),
|
|
2684
|
+
restoreAfterUndo: async (tx, beforeState, _afterState, duplicateId) => {
|
|
2685
|
+
const moved = z
|
|
2686
|
+
.array(z.object({ id: z.string().uuid(), contactId: z.string().uuid().nullable() }))
|
|
2687
|
+
.parse(beforeState)
|
|
2688
|
+
.filter((entry) => entry.contactId === duplicateId);
|
|
2689
|
+
if (moved.length) {
|
|
2690
|
+
await tx
|
|
2691
|
+
.update(galleryAccessLogs)
|
|
2692
|
+
.set({ contactId: duplicateId })
|
|
2693
|
+
.where(inArray(galleryAccessLogs.id, moved.map((entry) => entry.id)));
|
|
2694
|
+
}
|
|
2695
|
+
},
|
|
2696
|
+
});
|
|
2697
|
+
|
|
2698
|
+
registerContactReference({
|
|
2699
|
+
table: "gallery_selections",
|
|
2700
|
+
// One opinion per person per photograph is a unique index, and merging two
|
|
2701
|
+
// people who both marked the same frame would violate it. The survivor's
|
|
2702
|
+
// own mark wins: it is the more recent statement of the same person's
|
|
2703
|
+
// view, and inventing a merge of "favorite" and "reject" would be putting
|
|
2704
|
+
// words in their mouth.
|
|
2705
|
+
repoint: async (tx, duplicateId, survivingId) => {
|
|
2706
|
+
const duplicates = await tx
|
|
2707
|
+
.select()
|
|
2708
|
+
.from(gallerySelections)
|
|
2709
|
+
.where(eq(gallerySelections.contactId, duplicateId));
|
|
2710
|
+
for (const selection of duplicates) {
|
|
2711
|
+
const [survivor] = await tx
|
|
2712
|
+
.select({ id: gallerySelections.id })
|
|
2713
|
+
.from(gallerySelections)
|
|
2714
|
+
.where(
|
|
2715
|
+
and(
|
|
2716
|
+
eq(gallerySelections.galleryId, selection.galleryId),
|
|
2717
|
+
eq(gallerySelections.contactId, survivingId),
|
|
2718
|
+
eq(gallerySelections.assetId, selection.assetId),
|
|
2719
|
+
),
|
|
2720
|
+
)
|
|
2721
|
+
.limit(1);
|
|
2722
|
+
if (survivor) {
|
|
2723
|
+
await tx.delete(gallerySelections).where(eq(gallerySelections.id, selection.id));
|
|
2724
|
+
} else {
|
|
2725
|
+
await tx
|
|
2726
|
+
.update(gallerySelections)
|
|
2727
|
+
.set({ contactId: survivingId })
|
|
2728
|
+
.where(eq(gallerySelections.id, selection.id));
|
|
2729
|
+
}
|
|
2730
|
+
}
|
|
2731
|
+
},
|
|
2732
|
+
captureForUndo: async (tx, duplicateId, survivingId) => ({
|
|
2733
|
+
state: await tx
|
|
2734
|
+
.select({
|
|
2735
|
+
id: gallerySelections.id,
|
|
2736
|
+
galleryId: gallerySelections.galleryId,
|
|
2737
|
+
contactId: gallerySelections.contactId,
|
|
2738
|
+
assetId: gallerySelections.assetId,
|
|
2739
|
+
kind: gallerySelections.kind,
|
|
2740
|
+
comment: gallerySelections.comment,
|
|
2741
|
+
})
|
|
2742
|
+
.from(gallerySelections)
|
|
2743
|
+
.where(inArray(gallerySelections.contactId, [duplicateId, survivingId])),
|
|
2744
|
+
undoable: true,
|
|
2745
|
+
}),
|
|
2746
|
+
restoreAfterUndo: async (tx, beforeState, _afterState, duplicateId) => {
|
|
2747
|
+
const rows = z
|
|
2748
|
+
.array(
|
|
2749
|
+
z.object({
|
|
2750
|
+
id: z.string().uuid(),
|
|
2751
|
+
galleryId: z.string().uuid(),
|
|
2752
|
+
contactId: z.string().uuid(),
|
|
2753
|
+
assetId: z.string().uuid(),
|
|
2754
|
+
kind: z.enum(GALLERY_SELECTION_KINDS),
|
|
2755
|
+
comment: z.string().nullable(),
|
|
2756
|
+
}),
|
|
2757
|
+
)
|
|
2758
|
+
.parse(beforeState)
|
|
2759
|
+
.filter((selection) => selection.contactId === duplicateId);
|
|
2760
|
+
for (const selection of rows) {
|
|
2761
|
+
// Re-inserted rather than repointed: a colliding row was deleted by the
|
|
2762
|
+
// merge, so there may be nothing left to move back.
|
|
2763
|
+
await tx
|
|
2764
|
+
.insert(gallerySelections)
|
|
2765
|
+
.values(selection)
|
|
2766
|
+
.onConflictDoNothing();
|
|
2767
|
+
}
|
|
2768
|
+
},
|
|
2769
|
+
});
|
|
2770
|
+
|
|
2771
|
+
registerContactReference({
|
|
2772
|
+
table: "gallery_rounds",
|
|
2773
|
+
// Who submitted a round is a plain attribution with no uniqueness to
|
|
2774
|
+
// violate, so this repoints rather than reconciling. The snapshot alongside
|
|
2775
|
+
// it holds no contact id precisely so there is nothing here that a merge
|
|
2776
|
+
// could silently miss.
|
|
2777
|
+
repoint: (tx, duplicateId, survivingId) =>
|
|
2778
|
+
tx
|
|
2779
|
+
.update(galleryRounds)
|
|
2780
|
+
.set({ submittedByContactId: survivingId })
|
|
2781
|
+
.where(eq(galleryRounds.submittedByContactId, duplicateId)),
|
|
2782
|
+
captureForUndo: async (tx, duplicateId, survivingId) => ({
|
|
2783
|
+
state: await tx
|
|
2784
|
+
.select({
|
|
2785
|
+
id: galleryRounds.id,
|
|
2786
|
+
submittedByContactId: galleryRounds.submittedByContactId,
|
|
2787
|
+
})
|
|
2788
|
+
.from(galleryRounds)
|
|
2789
|
+
.where(
|
|
2790
|
+
inArray(galleryRounds.submittedByContactId, [duplicateId, survivingId]),
|
|
2791
|
+
),
|
|
2792
|
+
undoable: true,
|
|
2793
|
+
}),
|
|
2794
|
+
restoreAfterUndo: async (tx, beforeState, _afterState, duplicateId) => {
|
|
2795
|
+
const moved = z
|
|
2796
|
+
.array(
|
|
2797
|
+
z.object({
|
|
2798
|
+
id: z.string().uuid(),
|
|
2799
|
+
submittedByContactId: z.string().uuid(),
|
|
2800
|
+
}),
|
|
2801
|
+
)
|
|
2802
|
+
.parse(beforeState)
|
|
2803
|
+
.filter((round) => round.submittedByContactId === duplicateId);
|
|
2804
|
+
if (moved.length) {
|
|
2805
|
+
await tx
|
|
2806
|
+
.update(galleryRounds)
|
|
2807
|
+
.set({ submittedByContactId: duplicateId })
|
|
2808
|
+
.where(inArray(galleryRounds.id, moved.map((round) => round.id)));
|
|
2809
|
+
}
|
|
2810
|
+
},
|
|
2811
|
+
});
|
|
2812
|
+
|
|
2813
|
+
registerContactReference({
|
|
2814
|
+
table: "gallery_sessions",
|
|
2815
|
+
// A bearer for the duplicate identity must not silently become a credential
|
|
2816
|
+
// for the survivor. Invalidate it by deletion, same as customer magic links.
|
|
2817
|
+
repoint: (tx, duplicateId) =>
|
|
2818
|
+
tx.delete(gallerySessions).where(eq(gallerySessions.contactId, duplicateId)),
|
|
2819
|
+
captureForUndo: async (tx, duplicateId) => {
|
|
2820
|
+
const rows = await tx
|
|
2821
|
+
.select({ id: gallerySessions.id })
|
|
2822
|
+
.from(gallerySessions)
|
|
2823
|
+
.where(eq(gallerySessions.contactId, duplicateId));
|
|
2824
|
+
return {
|
|
2825
|
+
state: rows,
|
|
2826
|
+
undoable: rows.length === 0,
|
|
2827
|
+
blocker:
|
|
2828
|
+
rows.length > 0
|
|
2829
|
+
? "A gallery session was invalidated for security and cannot be restored."
|
|
2830
|
+
: undefined,
|
|
2831
|
+
};
|
|
2832
|
+
},
|
|
2833
|
+
restoreAfterUndo: async () => undefined,
|
|
2834
|
+
});
|
|
2835
|
+
|
|
2836
|
+
registerContactPrivacySource({
|
|
2837
|
+
scope: "contact.galleries",
|
|
2838
|
+
tables: [
|
|
2839
|
+
"galleries",
|
|
2840
|
+
"gallery_guests",
|
|
2841
|
+
"gallery_access_logs",
|
|
2842
|
+
"gallery_sessions",
|
|
2843
|
+
"gallery_selections",
|
|
2844
|
+
"gallery_rounds",
|
|
2845
|
+
],
|
|
2846
|
+
exportData: async (tx, contactId) => {
|
|
2847
|
+
const owned = await tx.select().from(galleries).where(eq(galleries.contactId, contactId));
|
|
2848
|
+
const guests = await tx.select().from(galleryGuests).where(eq(galleryGuests.contactId, contactId));
|
|
2849
|
+
const invited = await tx
|
|
2850
|
+
.select()
|
|
2851
|
+
.from(galleryGuests)
|
|
2852
|
+
.where(eq(galleryGuests.invitedByContactId, contactId));
|
|
2853
|
+
const logs = await tx
|
|
2854
|
+
.select()
|
|
2855
|
+
.from(galleryAccessLogs)
|
|
2856
|
+
.where(eq(galleryAccessLogs.contactId, contactId));
|
|
2857
|
+
const selections = await tx
|
|
2858
|
+
.select()
|
|
2859
|
+
.from(gallerySelections)
|
|
2860
|
+
.where(eq(gallerySelections.contactId, contactId));
|
|
2861
|
+
const rounds = await tx
|
|
2862
|
+
.select()
|
|
2863
|
+
.from(galleryRounds)
|
|
2864
|
+
.where(eq(galleryRounds.submittedByContactId, contactId));
|
|
2865
|
+
return { galleries: owned, guests, invited, logs, selections, rounds };
|
|
2866
|
+
},
|
|
2867
|
+
erase: async (tx, contactId) => {
|
|
2868
|
+
// The gallery is the business's delivery record. The person goes; the
|
|
2869
|
+
// work stays. What is stripped is the link and every credential issued
|
|
2870
|
+
// to them.
|
|
2871
|
+
const owned = await tx
|
|
2872
|
+
.update(galleries)
|
|
2873
|
+
.set({ contactId: null })
|
|
2874
|
+
.where(eq(galleries.contactId, contactId))
|
|
2875
|
+
.returning({ id: galleries.id });
|
|
2876
|
+
await tx.delete(gallerySessions).where(eq(gallerySessions.contactId, contactId));
|
|
2877
|
+
await tx.delete(galleryGuests).where(eq(galleryGuests.contactId, contactId));
|
|
2878
|
+
await tx
|
|
2879
|
+
.update(galleryGuests)
|
|
2880
|
+
.set({ invitedByContactId: null })
|
|
2881
|
+
.where(eq(galleryGuests.invitedByContactId, contactId));
|
|
2882
|
+
await tx
|
|
2883
|
+
.update(galleryAccessLogs)
|
|
2884
|
+
.set({ contactId: null })
|
|
2885
|
+
.where(eq(galleryAccessLogs.contactId, contactId));
|
|
2886
|
+
// The choice stays, the chooser goes: the owner still knows which frames
|
|
2887
|
+
// were selected for delivery, and no longer knows whose taste that was.
|
|
2888
|
+
await tx
|
|
2889
|
+
.update(gallerySelections)
|
|
2890
|
+
.set({ contactId: null })
|
|
2891
|
+
.where(eq(gallerySelections.contactId, contactId));
|
|
2892
|
+
// The round stays and its snapshot with it: what was agreed is the
|
|
2893
|
+
// owner's record of the job. Only the name on the submission goes.
|
|
2894
|
+
await tx
|
|
2895
|
+
.update(galleryRounds)
|
|
2896
|
+
.set({ submittedByContactId: null })
|
|
2897
|
+
.where(eq(galleryRounds.submittedByContactId, contactId));
|
|
2898
|
+
return { affected: owned.length };
|
|
2899
|
+
},
|
|
2900
|
+
});
|
|
2901
|
+
|
|
2902
|
+
registerSearchSource({
|
|
2903
|
+
kind: "gallery",
|
|
2904
|
+
readService: "galleries.list",
|
|
2905
|
+
module: "galleries",
|
|
2906
|
+
tables: ["galleries"],
|
|
2907
|
+
search: async ({ tx, pattern, limit }) => {
|
|
2908
|
+
const rows = await tx
|
|
2909
|
+
.select({
|
|
2910
|
+
id: galleries.id,
|
|
2911
|
+
title: galleries.title,
|
|
2912
|
+
slug: galleries.slug,
|
|
2913
|
+
contactId: galleries.contactId,
|
|
2914
|
+
})
|
|
2915
|
+
.from(galleries)
|
|
2916
|
+
.where(or(matchesIlike(galleries.title, pattern), matchesIlike(galleries.slug, pattern)))
|
|
2917
|
+
.orderBy(desc(galleries.updatedAt))
|
|
2918
|
+
.limit(limit);
|
|
2919
|
+
return rows.map((row) => ({
|
|
2920
|
+
kind: "gallery",
|
|
2921
|
+
id: row.id,
|
|
2922
|
+
title: row.title,
|
|
2923
|
+
href: `/admin/galleries/${row.id}`,
|
|
2924
|
+
snippet: clipSnippet(row.slug),
|
|
2925
|
+
contactId: row.contactId,
|
|
2926
|
+
module: "galleries",
|
|
2927
|
+
}));
|
|
2928
|
+
},
|
|
2929
|
+
});
|
|
2930
|
+
|
|
2931
|
+
export default [
|
|
2932
|
+
...demoServices,
|
|
2933
|
+
createGallery,
|
|
2934
|
+
updateGallery,
|
|
2935
|
+
listGalleries,
|
|
2936
|
+
getGallery,
|
|
2937
|
+
addGalleryItem,
|
|
2938
|
+
updateGalleryItem,
|
|
2939
|
+
removeGalleryItem,
|
|
2940
|
+
inviteGalleryGuest,
|
|
2941
|
+
inviteGalleryPartner,
|
|
2942
|
+
revokeGalleryGuest,
|
|
2943
|
+
revokeGalleryPartner,
|
|
2944
|
+
listGalleryGuests,
|
|
2945
|
+
listGalleryAccess,
|
|
2946
|
+
unlockGallery,
|
|
2947
|
+
redeemGalleryGuest,
|
|
2948
|
+
openGalleryWithLogin,
|
|
2949
|
+
myGalleries,
|
|
2950
|
+
viewGallerySession,
|
|
2951
|
+
viewGalleryItem,
|
|
2952
|
+
setGallerySelection,
|
|
2953
|
+
clearGallerySelection,
|
|
2954
|
+
listGallerySelections,
|
|
2955
|
+
submitGalleryRound,
|
|
2956
|
+
approveGalleryRound,
|
|
2957
|
+
reopenGalleryRound,
|
|
2958
|
+
listGalleryRounds,
|
|
2959
|
+
requestGalleryArchive,
|
|
2960
|
+
buildGalleryArchive,
|
|
2961
|
+
galleryArchiveState,
|
|
2962
|
+
downloadGalleryArchive,
|
|
2963
|
+
addGalleryPriceSheetItem,
|
|
2964
|
+
removeGalleryPriceSheetItem,
|
|
2965
|
+
listGalleryPriceSheet,
|
|
2966
|
+
addGalleryItemToCart,
|
|
2967
|
+
downloadGalleryItem,
|
|
2968
|
+
galleryBySlug,
|
|
2969
|
+
expireGallerySessions,
|
|
2970
|
+
];
|