@wix/agent-skills 1.36.0 → 1.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -3
- package/skills/wix-headless-kit/install/pins.json +1 -1
- package/skills/wix-manage/SKILL.md +3 -3
- package/skills/wix-manage/references/cms/cms-data-items-crud.md +78 -1
- package/skills/wix-manage/references/google-ads/create-performance-max-campaign.md +11 -11
- package/skills/wix-manage/references/marketing/create-and-publish-social-post.md +20 -51
- package/skills/wix-manage/references/marketing/generate-and-publish-marketing-plan.md +4 -4
- package/skills/wix-base44-connector/SKILL.md +0 -437
- package/skills/wix-base44-connector/references/CAPABILITY_MAP.md +0 -78
- package/skills/wix-base44-connector/scripts/utils.cjs +0 -466
- package/skills/wix-export/SKILL.md +0 -83
- package/skills/wix-harmony-editor/.publish-manifest.json +0 -8
- package/skills/wix-harmony-editor/COPY-SITE.md +0 -494
- package/skills/wix-harmony-editor/SKILL.md +0 -317
- package/skills/wix-harmony-editor/scripts/copy/build-description.mjs +0 -249
- package/skills/wix-harmony-editor/scripts/copy/check-description.mjs +0 -225
- package/skills/wix-harmony-editor/scripts/copy/check-mirror.mjs +0 -89
- package/skills/wix-harmony-editor/scripts/copy/compare-preview.mjs +0 -76
- package/skills/wix-harmony-editor/scripts/copy/deploy-description.mjs +0 -212
- package/skills/wix-harmony-editor/scripts/copy/desc-hash.mjs +0 -44
- package/skills/wix-harmony-editor/scripts/copy/editor-run.mjs +0 -45
- package/skills/wix-harmony-editor/scripts/copy/export-page.mjs +0 -53
- package/skills/wix-harmony-editor/scripts/copy/find-interactions.mjs +0 -76
- package/skills/wix-harmony-editor/scripts/copy/hide-scrollbars.mjs +0 -16
- package/skills/wix-harmony-editor/scripts/copy/import-media.mjs +0 -150
- package/skills/wix-harmony-editor/scripts/copy/link-url.mjs +0 -27
- package/skills/wix-harmony-editor/scripts/copy/lint-api.mjs +0 -56
- package/skills/wix-harmony-editor/scripts/copy/measure-source.mjs +0 -211
- package/skills/wix-harmony-editor/scripts/copy/merge-mirrors.mjs +0 -29
- package/skills/wix-harmony-editor/scripts/copy/mirror-site.mjs +0 -92
- package/skills/wix-harmony-editor/scripts/copy/mobile-stage.mjs +0 -56
- package/skills/wix-harmony-editor/scripts/copy/preview-widths.mjs +0 -73
- package/skills/wix-harmony-editor/scripts/copy/render-plate.mjs +0 -67
- package/skills/wix-harmony-editor/scripts/copy/serve-mirror.mjs +0 -102
- package/skills/wix-harmony-editor/scripts/copy/snapshot-capabilities.mjs +0 -40
- package/skills/wix-harmony-editor/scripts/copy/split-sections.mjs +0 -191
- package/skills/wix-harmony-editor/scripts/copy/upload-media-manager.mjs +0 -61
- package/skills/wix-harmony-editor/scripts/launch.sh +0 -359
- package/skills/wix-headless/SKILL.md +0 -151
- package/skills/wix-headless/references/AI_FEATURES.md +0 -178
- package/skills/wix-headless/references/CAPABILITIES.md +0 -117
- package/skills/wix-headless/references/CONTENT.md +0 -36
- package/skills/wix-headless/references/DESIGN.md +0 -55
- package/skills/wix-headless/references/DISCOVERY.md +0 -80
- package/skills/wix-headless/references/DOC_DISCOVERY.md +0 -43
- package/skills/wix-headless/references/FEEDBACK.md +0 -129
- package/skills/wix-headless/references/IMAGE_GENERATION.md +0 -80
- package/skills/wix-headless/references/SDK_HANDOFF.md +0 -108
- package/skills/wix-headless/references/SEED.md +0 -74
- package/skills/wix-headless/references/SETUP.md +0 -60
- package/skills/wix-headless/references/astro.md +0 -98
- package/skills/wix-headless/references/inline-recipes/experience-donations.md +0 -102
- package/skills/wix-headless/references/inline-recipes/experience-store.md +0 -49
- package/skills/wix-headless/references/inline-recipes/how-to-code-a-blog.md +0 -196
- package/skills/wix-headless/references/inline-recipes/how-to-code-a-store.md +0 -590
- package/skills/wix-headless/references/inline-recipes/how-to-code-bookings.md +0 -279
- package/skills/wix-headless/references/inline-recipes/how-to-code-cms.md +0 -163
- package/skills/wix-headless/references/inline-recipes/how-to-code-donations.md +0 -146
- package/skills/wix-headless/references/inline-recipes/how-to-code-events.md +0 -203
- package/skills/wix-headless/references/inline-recipes/how-to-code-forms.md +0 -696
- package/skills/wix-headless/references/inline-recipes/how-to-code-members-astro.md +0 -124
- package/skills/wix-headless/references/inline-recipes/how-to-code-members-custom-login.md +0 -160
- package/skills/wix-headless/references/inline-recipes/how-to-code-members-non-astro.md +0 -118
- package/skills/wix-headless/references/inline-recipes/how-to-code-portfolio.md +0 -132
- package/skills/wix-headless/references/inline-recipes/how-to-code-pricing-plans.md +0 -126
- package/skills/wix-headless/references/inline-recipes/how-to-code-rentals.md +0 -254
- package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-orders.md +0 -191
- package/skills/wix-headless/references/inline-recipes/how-to-code-restaurant-reservations.md +0 -213
- package/skills/wix-headless/references/inline-recipes/how-to-code-restaurants.md +0 -161
- package/skills/wix-headless/references/inline-recipes/setup-blog.md +0 -175
- package/skills/wix-headless/references/inline-recipes/setup-bookings.md +0 -232
- package/skills/wix-headless/references/inline-recipes/setup-cms.md +0 -200
- package/skills/wix-headless/references/inline-recipes/setup-donations.md +0 -15
- package/skills/wix-headless/references/inline-recipes/setup-events.md +0 -196
- package/skills/wix-headless/references/inline-recipes/setup-forms.md +0 -288
- package/skills/wix-headless/references/inline-recipes/setup-online-store.md +0 -214
- package/skills/wix-headless/references/inline-recipes/setup-portfolio.md +0 -155
- package/skills/wix-headless/references/inline-recipes/setup-pricing-plans.md +0 -229
- package/skills/wix-headless/references/inline-recipes/setup-rentals.md +0 -254
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-experiences.md +0 -73
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-orders.md +0 -197
- package/skills/wix-headless/references/inline-recipes/setup-restaurant-reservations.md +0 -136
- package/skills/wix-headless/references/inline-recipes/setup-restaurants.md +0 -152
- package/skills/wix-headless/references/managed/AUTHENTICATION.md +0 -71
- package/skills/wix-headless/references/managed/CONNECT.md +0 -74
- package/skills/wix-headless/references/managed/CREATE.md +0 -149
- package/skills/wix-headless/references/managed/DEPLOYMENT.md +0 -104
- package/skills/wix-headless/references/non-astro.md +0 -59
- package/skills/wix-headless/references/self-managed/AUTHENTICATION.md +0 -22
- package/skills/wix-headless/references/self-managed/DEPLOYMENT.md +0 -15
- package/skills/wix-headless/references/stripe/AUTHENTICATION.md +0 -55
- package/skills/wix-headless/references/stripe/DEPLOYMENT.md +0 -71
- package/skills/wix-headless/scripts/bootstrap.mjs +0 -156
- package/skills/wix-headless-replatform/.publish-manifest.json +0 -8
- package/skills/wix-headless-replatform/SKILL.md +0 -116
- package/skills/wix-headless-replatform/agents/openai.yaml +0 -6
- package/skills/wix-headless-replatform/references/control-and-visual-fidelity-contract.md +0 -43
- package/skills/wix-headless-replatform/references/extraction-schema.md +0 -187
- package/skills/wix-headless-replatform/references/interaction-runtime-contract.md +0 -137
- package/skills/wix-headless-replatform/references/layout-blueprint-contract.md +0 -41
- package/skills/wix-headless-replatform/references/output-contract.md +0 -93
- package/skills/wix-headless-replatform/references/post-build-gap-contract.md +0 -125
- package/skills/wix-headless-replatform/references/qa-checklist.md +0 -83
- package/skills/wix-headless-replatform/references/safety.md +0 -19
- package/skills/wix-headless-replatform/references/ui-normalization-contract.md +0 -70
- package/skills/wix-headless-replatform/references/workflow.md +0 -157
- package/skills/wix-headless-replatform/registry/README.md +0 -20
- package/skills/wix-headless-replatform/registry/approvals/button/shadcn-default-ac60ef5.json +0 -28
- package/skills/wix-headless-replatform/registry/items/button/shadcn-default-ac60ef5/button.tsx +0 -54
- package/skills/wix-headless-replatform/registry/items/button/shadcn-default-ac60ef5/capabilities.json +0 -60
- package/skills/wix-headless-replatform/registry/items/button/shadcn-default-ac60ef5/contract.md +0 -48
- package/skills/wix-headless-replatform/registry/licenses/shadcn-ui-ac60ef5-MIT.txt +0 -21
- package/skills/wix-headless-replatform/registry/registry.json +0 -36
- package/skills/wix-headless-replatform/resources/rp-facelift/SKILL.md +0 -32
- package/skills/wix-headless-replatform/resources/rp-project-context/SKILL.md +0 -62
- package/skills/wix-headless-replatform/resources/rp-qa-gap-loop/SKILL.md +0 -64
- package/skills/wix-headless-replatform/resources/rp-source-evidence/SKILL.md +0 -42
- package/skills/wix-headless-replatform/resources/rp-ui-implementation/SKILL.md +0 -73
- package/skills/wix-headless-replatform/schemas/build-plan.schema.json +0 -10
- package/skills/wix-headless-replatform/schemas/candidate.schema.json +0 -19
- package/skills/wix-headless-replatform/schemas/common.schema.json +0 -33
- package/skills/wix-headless-replatform/schemas/decision-patch.schema.json +0 -10
- package/skills/wix-headless-replatform/schemas/decision-request.schema.json +0 -10
- package/skills/wix-headless-replatform/schemas/extraction-gap.schema.json +0 -28
- package/skills/wix-headless-replatform/schemas/extraction-manifest.schema.json +0 -34
- package/skills/wix-headless-replatform/schemas/final-report.schema.json +0 -10
- package/skills/wix-headless-replatform/schemas/foundation.schema.json +0 -11
- package/skills/wix-headless-replatform/schemas/metadata.schema.json +0 -11
- package/skills/wix-headless-replatform/schemas/observation-packet.schema.json +0 -17
- package/skills/wix-headless-replatform/schemas/page-capture.schema.json +0 -11
- package/skills/wix-headless-replatform/schemas/page-resolution.schema.json +0 -33
- package/skills/wix-headless-replatform/schemas/shared-chrome.schema.json +0 -11
- package/skills/wix-headless-replatform/schemas/unit.schema.json +0 -40
- package/skills/wix-headless-replatform/scripts/assemble-extraction.mjs +0 -844
- package/skills/wix-headless-replatform/scripts/benchmark-extraction.mjs +0 -163
- package/skills/wix-headless-replatform/scripts/browser-extraction-preflight.mjs +0 -42
- package/skills/wix-headless-replatform/scripts/build-extracted-homepage.mjs +0 -228
- package/skills/wix-headless-replatform/scripts/clear-wix-starter.mjs +0 -87
- package/skills/wix-headless-replatform/scripts/create-wix-project.mjs +0 -505
- package/skills/wix-headless-replatform/scripts/discover-urls.mjs +0 -142
- package/skills/wix-headless-replatform/scripts/extract-assets.mjs +0 -140
- package/skills/wix-headless-replatform/scripts/extract-design-system.mjs +0 -637
- package/skills/wix-headless-replatform/scripts/extract-interactions.mjs +0 -1903
- package/skills/wix-headless-replatform/scripts/extract-page.mjs +0 -2461
- package/skills/wix-headless-replatform/scripts/extract-seo.mjs +0 -25
- package/skills/wix-headless-replatform/scripts/extract-tokens.mjs +0 -63
- package/skills/wix-headless-replatform/scripts/finalize-extraction-report.mjs +0 -126
- package/skills/wix-headless-replatform/scripts/finalize-gap-review.mjs +0 -180
- package/skills/wix-headless-replatform/scripts/finalize-gap-review.test.mjs +0 -98
- package/skills/wix-headless-replatform/scripts/finalize-migration-website.mjs +0 -103
- package/skills/wix-headless-replatform/scripts/generate-control-state-contract.mjs +0 -176
- package/skills/wix-headless-replatform/scripts/generate-design-md.mjs +0 -261
- package/skills/wix-headless-replatform/scripts/generate-extraction-validators.mjs +0 -25
- package/skills/wix-headless-replatform/scripts/generate-invoice-download-backend.mjs +0 -342
- package/skills/wix-headless-replatform/scripts/generate-layout-blueprint.mjs +0 -140
- package/skills/wix-headless-replatform/scripts/generate-repeater-cms.mjs +0 -22
- package/skills/wix-headless-replatform/scripts/generate-route-plan.mjs +0 -143
- package/skills/wix-headless-replatform/scripts/generate-scene-contract.mjs +0 -288
- package/skills/wix-headless-replatform/scripts/generate-ui-normalization.mjs +0 -266
- package/skills/wix-headless-replatform/scripts/generate-visual-assets.mjs +0 -111
- package/skills/wix-headless-replatform/scripts/lib/browser-tooling.mjs +0 -570
- package/skills/wix-headless-replatform/scripts/lib/common.mjs +0 -329
- package/skills/wix-headless-replatform/scripts/lib/component-capabilities.mjs +0 -121
- package/skills/wix-headless-replatform/scripts/lib/component-registry.mjs +0 -282
- package/skills/wix-headless-replatform/scripts/lib/content-boundary.mjs +0 -61
- package/skills/wix-headless-replatform/scripts/lib/extraction-contract.mjs +0 -374
- package/skills/wix-headless-replatform/scripts/lib/extraction-detectors.mjs +0 -243
- package/skills/wix-headless-replatform/scripts/lib/extraction-validators.generated.mjs +0 -1139
- package/skills/wix-headless-replatform/scripts/lib/font-contract.mjs +0 -326
- package/skills/wix-headless-replatform/scripts/lib/frontend-automation-state.mjs +0 -184
- package/skills/wix-headless-replatform/scripts/lib/gap-analysis.mjs +0 -396
- package/skills/wix-headless-replatform/scripts/lib/html-extract.mjs +0 -168
- package/skills/wix-headless-replatform/scripts/lib/interaction-bootstrap.mjs +0 -10
- package/skills/wix-headless-replatform/scripts/lib/interaction-runtime.mjs +0 -194
- package/skills/wix-headless-replatform/scripts/lib/interaction-timeline.mjs +0 -348
- package/skills/wix-headless-replatform/scripts/lib/layout-blueprint/classifiers.mjs +0 -141
- package/skills/wix-headless-replatform/scripts/lib/layout-blueprint/geometry.mjs +0 -43
- package/skills/wix-headless-replatform/scripts/lib/layout-blueprint/vocabulary.mjs +0 -18
- package/skills/wix-headless-replatform/scripts/lib/ui-normalization.css +0 -64
- package/skills/wix-headless-replatform/scripts/optimize-svg.mjs +0 -31
- package/skills/wix-headless-replatform/scripts/post-build-gap.mjs +0 -358
- package/skills/wix-headless-replatform/scripts/provision-repeater-cms.mjs +0 -25
- package/skills/wix-headless-replatform/scripts/record-gap-decision.mjs +0 -39
- package/skills/wix-headless-replatform/scripts/replay-extraction.mjs +0 -107
- package/skills/wix-headless-replatform/scripts/resolve-home-page.mjs +0 -96
- package/skills/wix-headless-replatform/scripts/site-clone.mjs +0 -658
- package/skills/wix-headless-replatform/scripts/validate-font-contract.mjs +0 -29
- package/skills/wix-headless-replatform/scripts/verify-interactions.mjs +0 -669
- package/skills/wix-headless-replatform/scripts/visual-qa.mjs +0 -370
- package/skills/wix-import/SKILL.md +0 -90
- package/skills/wix-replatform/.publish-manifest.json +0 -8
- package/skills/wix-replatform/CLI.md +0 -162
- package/skills/wix-replatform/README.md +0 -52
- package/skills/wix-replatform/SKILL.md +0 -238
- package/skills/wix-replatform/console/account.css +0 -1
- package/skills/wix-replatform/console/app.css +0 -1
- package/skills/wix-replatform/console/app.js +0 -117
- package/skills/wix-replatform/console/index.html +0 -4
- package/skills/wix-replatform/console/json.css +0 -11
- package/skills/wix-replatform/lib/agent-adapters/index.js +0 -71
- package/skills/wix-replatform/lib/app-page-routing.js +0 -75
- package/skills/wix-replatform/lib/artifact-freshness.js +0 -225
- package/skills/wix-replatform/lib/blocked-data-requests.js +0 -427
- package/skills/wix-replatform/lib/census-reconciliation.js +0 -426
- package/skills/wix-replatform/lib/completion-report.js +0 -1580
- package/skills/wix-replatform/lib/config-env.js +0 -133
- package/skills/wix-replatform/lib/confirmed-pictures.js +0 -212
- package/skills/wix-replatform/lib/dependency-readiness.js +0 -423
- package/skills/wix-replatform/lib/dependency-recovery.js +0 -21
- package/skills/wix-replatform/lib/destination-choice.js +0 -163
- package/skills/wix-replatform/lib/destination-handoff.js +0 -62
- package/skills/wix-replatform/lib/destination-http.js +0 -81
- package/skills/wix-replatform/lib/destination-route.js +0 -98
- package/skills/wix-replatform/lib/destination.js +0 -919
- package/skills/wix-replatform/lib/discovered-census.js +0 -231
- package/skills/wix-replatform/lib/discovered-set-status.js +0 -255
- package/skills/wix-replatform/lib/document-url-guard.js +0 -203
- package/skills/wix-replatform/lib/entity-qa-attestation.js +0 -339
- package/skills/wix-replatform/lib/entity-verification.js +0 -18
- package/skills/wix-replatform/lib/execution-capability.js +0 -120
- package/skills/wix-replatform/lib/execution-log.js +0 -170
- package/skills/wix-replatform/lib/execution-manifest.js +0 -203
- package/skills/wix-replatform/lib/execution-state.js +0 -195
- package/skills/wix-replatform/lib/expectations-ledger.js +0 -96
- package/skills/wix-replatform/lib/generated-plugin-handoff.js +0 -140
- package/skills/wix-replatform/lib/import-readiness-contract.js +0 -23
- package/skills/wix-replatform/lib/import-recovery.js +0 -1107
- package/skills/wix-replatform/lib/imported-redirect-targets.js +0 -608
- package/skills/wix-replatform/lib/internal-link-reconciliation.js +0 -166
- package/skills/wix-replatform/lib/link-audit.js +0 -173
- package/skills/wix-replatform/lib/link-census.js +0 -194
- package/skills/wix-replatform/lib/link-plan.js +0 -148
- package/skills/wix-replatform/lib/link-verification.js +0 -274
- package/skills/wix-replatform/lib/link-write-journal.js +0 -42
- package/skills/wix-replatform/lib/local-state.js +0 -1481
- package/skills/wix-replatform/lib/member-completion.js +0 -658
- package/skills/wix-replatform/lib/member-crosswalk.js +0 -69
- package/skills/wix-replatform/lib/member-outcome-registry.js +0 -265
- package/skills/wix-replatform/lib/migration-completion.js +0 -311
- package/skills/wix-replatform/lib/operator-identity.js +0 -47
- package/skills/wix-replatform/lib/orchestration-decisions.js +0 -248
- package/skills/wix-replatform/lib/orchestration-preflight.js +0 -525
- package/skills/wix-replatform/lib/orchestration-router.js +0 -698
- package/skills/wix-replatform/lib/orchestration-state.js +0 -631
- package/skills/wix-replatform/lib/order-reference-readiness.js +0 -30
- package/skills/wix-replatform/lib/payments-outcome-registry.js +0 -200
- package/skills/wix-replatform/lib/plugin-cms-fallback.js +0 -618
- package/skills/wix-replatform/lib/preservation-approval-stamp.js +0 -54
- package/skills/wix-replatform/lib/product-media-deferral.js +0 -96
- package/skills/wix-replatform/lib/progress-log.js +0 -240
- package/skills/wix-replatform/lib/progress-log.sh +0 -140
- package/skills/wix-replatform/lib/read-back-approval.js +0 -184
- package/skills/wix-replatform/lib/read-back-comparison.js +0 -136
- package/skills/wix-replatform/lib/read-back-contract.js +0 -243
- package/skills/wix-replatform/lib/read-back-extract.js +0 -118
- package/skills/wix-replatform/lib/read-back-gate.js +0 -734
- package/skills/wix-replatform/lib/read-back-reads.js +0 -94
- package/skills/wix-replatform/lib/read-back-state.js +0 -107
- package/skills/wix-replatform/lib/read-back-summary.js +0 -81
- package/skills/wix-replatform/lib/rerun-conflicts.js +0 -334
- package/skills/wix-replatform/lib/run-controller.js +0 -401
- package/skills/wix-replatform/lib/seo-outcome-registry.js +0 -45
- package/skills/wix-replatform/lib/setup-verification.js +0 -148
- package/skills/wix-replatform/lib/source-access.js +0 -231
- package/skills/wix-replatform/lib/source-coverage.js +0 -1130
- package/skills/wix-replatform/lib/source-secrets.js +0 -277
- package/skills/wix-replatform/lib/structured-link-patch.js +0 -59
- package/skills/wix-replatform/lib/task-state.js +0 -110
- package/skills/wix-replatform/lib/url-preservation-report.js +0 -319
- package/skills/wix-replatform/lib/url-preservation-state.js +0 -739
- package/skills/wix-replatform/lib/url-redirect-plan.js +0 -728
- package/skills/wix-replatform/lib/url-verification.js +0 -315
- package/skills/wix-replatform/lib/user-action-effects.js +0 -42
- package/skills/wix-replatform/lib/user-actions.js +0 -264
- package/skills/wix-replatform/lib/website-handoff.js +0 -1220
- package/skills/wix-replatform/lib/wix-client-callers.js +0 -54
- package/skills/wix-replatform/lib/wix-dashboard-url.js +0 -35
- package/skills/wix-replatform/lib/write-verification-state.js +0 -92
- package/skills/wix-replatform/lib/write-verification.js +0 -274
- package/skills/wix-replatform/resources/rp-destination/SKILL.md +0 -137
- package/skills/wix-replatform/resources/rp-discovery/SKILL.md +0 -357
- package/skills/wix-replatform/resources/rp-discovery/scripts/promote-source-coverage.js +0 -47
- package/skills/wix-replatform/resources/rp-execute-import/SKILL.md +0 -1369
- package/skills/wix-replatform/resources/rp-execute-import/scripts/shipping-estimate-audit.js +0 -70
- package/skills/wix-replatform/resources/rp-execute-setup/SKILL.md +0 -482
- package/skills/wix-replatform/resources/rp-execute-setup/scripts/execute-setup.js +0 -442
- package/skills/wix-replatform/resources/rp-execute-setup/scripts/mint-token.sh +0 -64
- package/skills/wix-replatform/resources/rp-execution-policy/SKILL.md +0 -112
- package/skills/wix-replatform/resources/rp-execution-policy/lib/coupon-currency-plan-report.js +0 -143
- package/skills/wix-replatform/resources/rp-execution-policy/lib/payments-report.js +0 -244
- package/skills/wix-replatform/resources/rp-import-codegen/SKILL.md +0 -3158
- package/skills/wix-replatform/resources/rp-mapper/SKILL.md +0 -947
- package/skills/wix-replatform/resources/rp-mapper/lib/mapping-resolve.js +0 -217
- package/skills/wix-replatform/resources/rp-mapper/lib/structure-bridge-planning.js +0 -303
- package/skills/wix-replatform/resources/rp-mapper/scripts/coverage-reconcile.js +0 -88
- package/skills/wix-replatform/resources/rp-mapper/scripts/resolve-mapping.js +0 -148
- package/skills/wix-replatform/resources/rp-mapper/wix-business-solutions-taxonomy.md +0 -378
- package/skills/wix-replatform/resources/rp-preflight/SKILL.md +0 -40
- package/skills/wix-replatform/resources/rp-project-intake/SKILL.md +0 -55
- package/skills/wix-replatform/resources/rp-quick-runtime/SKILL.md +0 -60
- package/skills/wix-replatform/resources/rp-quick-runtime/lib/import-progress.js +0 -89
- package/skills/wix-replatform/resources/rp-quick-runtime/lib/limit-recovery.js +0 -36
- package/skills/wix-replatform/resources/rp-quick-shopify/SKILL.md +0 -123
- package/skills/wix-replatform/resources/rp-quick-shopify/quick-mode.json +0 -124
- package/skills/wix-replatform/resources/rp-quick-shopify/scripts/quick-mode.js +0 -522
- package/skills/wix-replatform/resources/rp-quick-woocommerce/SKILL.md +0 -56
- package/skills/wix-replatform/resources/rp-quick-woocommerce/quick-mode.json +0 -91
- package/skills/wix-replatform/resources/rp-quick-woocommerce/scripts/quick-mode.js +0 -255
- package/skills/wix-replatform/resources/rp-setup-discovery/SKILL.md +0 -253
- package/skills/wix-replatform/resources/rp-setup-discovery/scripts/quick-setup-plan.js +0 -44
- package/skills/wix-replatform/resources/rp-source-csv/SKILL.md +0 -481
- package/skills/wix-replatform/resources/rp-source-csv/lib/canonical-record.js +0 -136
- package/skills/wix-replatform/resources/rp-source-csv/lib/csv-fileset.js +0 -0
- package/skills/wix-replatform/resources/rp-source-csv/lib/csv-fingerprint.js +0 -310
- package/skills/wix-replatform/resources/rp-source-csv/lib/csv-layout.js +0 -1081
- package/skills/wix-replatform/resources/rp-source-csv/lib/csv-parse.js +0 -618
- package/skills/wix-replatform/resources/rp-source-csv/scripts/csv-discovery.js +0 -969
- package/skills/wix-replatform/resources/rp-source-csv/source-schema.example.json +0 -196
- package/skills/wix-replatform/resources/rp-source-csv/vendors/bigcommerce.json +0 -66
- package/skills/wix-replatform/resources/rp-source-csv/vendors/magento.json +0 -60
- package/skills/wix-replatform/resources/rp-source-csv/vendors/shopify.json +0 -95
- package/skills/wix-replatform/resources/rp-source-csv/vendors/woocommerce.json +0 -82
- package/skills/wix-replatform/resources/rp-source-inputs/SKILL.md +0 -66
- package/skills/wix-replatform/resources/rp-source-sfcc/SKILL.md +0 -153
- package/skills/wix-replatform/resources/rp-source-shopify/SKILL.md +0 -394
- package/skills/wix-replatform/resources/rp-source-shopify/lib/discovery-reads.js +0 -200
- package/skills/wix-replatform/resources/rp-source-shopify/lib/import-findings.js +0 -34
- package/skills/wix-replatform/resources/rp-source-shopify/lib/shopify-bulk-sqlite-worker.js +0 -44
- package/skills/wix-replatform/resources/rp-source-shopify/lib/shopify-bulk.js +0 -1470
- package/skills/wix-replatform/resources/rp-source-shopify/lib/shopify-cli.js +0 -446
- package/skills/wix-replatform/resources/rp-source-shopify/lib/shopify-gift-cards.js +0 -474
- package/skills/wix-replatform/resources/rp-source-shopify/lib/shopify-protected-fields.js +0 -879
- package/skills/wix-replatform/resources/rp-source-shopify/lib/shopify-session.js +0 -426
- package/skills/wix-replatform/resources/rp-source-shopify/queries/articles.graphql +0 -24
- package/skills/wix-replatform/resources/rp-source-shopify/queries/blogs.graphql +0 -18
- package/skills/wix-replatform/resources/rp-source-shopify/queries/collections.graphql +0 -40
- package/skills/wix-replatform/resources/rp-source-shopify/queries/customers.graphql +0 -76
- package/skills/wix-replatform/resources/rp-source-shopify/queries/delivery-profiles.graphql +0 -51
- package/skills/wix-replatform/resources/rp-source-shopify/queries/discounts.graphql +0 -35
- package/skills/wix-replatform/resources/rp-source-shopify/queries/files.graphql +0 -20
- package/skills/wix-replatform/resources/rp-source-shopify/queries/gift-cards.graphql +0 -18
- package/skills/wix-replatform/resources/rp-source-shopify/queries/inventory.graphql +0 -31
- package/skills/wix-replatform/resources/rp-source-shopify/queries/locations.graphql +0 -21
- package/skills/wix-replatform/resources/rp-source-shopify/queries/menus.graphql +0 -21
- package/skills/wix-replatform/resources/rp-source-shopify/queries/metaobjects.graphql +0 -30
- package/skills/wix-replatform/resources/rp-source-shopify/queries/orders-core.graphql +0 -150
- package/skills/wix-replatform/resources/rp-source-shopify/queries/orders-fulfillments.graphql +0 -36
- package/skills/wix-replatform/resources/rp-source-shopify/queries/orders-refunds.graphql +0 -48
- package/skills/wix-replatform/resources/rp-source-shopify/queries/pages.graphql +0 -20
- package/skills/wix-replatform/resources/rp-source-shopify/queries/probe-customers-address.graphql +0 -8
- package/skills/wix-replatform/resources/rp-source-shopify/queries/probe-customers-email.graphql +0 -6
- package/skills/wix-replatform/resources/rp-source-shopify/queries/probe-customers-name.graphql +0 -8
- package/skills/wix-replatform/resources/rp-source-shopify/queries/probe-customers-phone.graphql +0 -8
- package/skills/wix-replatform/resources/rp-source-shopify/queries/probe-orders-address.graphql +0 -12
- package/skills/wix-replatform/resources/rp-source-shopify/queries/probe-orders-email.graphql +0 -6
- package/skills/wix-replatform/resources/rp-source-shopify/queries/probe-orders-name.graphql +0 -13
- package/skills/wix-replatform/resources/rp-source-shopify/queries/probe-orders-phone.graphql +0 -13
- package/skills/wix-replatform/resources/rp-source-shopify/queries/products.graphql +0 -73
- package/skills/wix-replatform/resources/rp-source-shopify/queries/url-redirects.graphql +0 -13
- package/skills/wix-replatform/resources/rp-source-shopify/scripts/shopify-discovery.js +0 -693
- package/skills/wix-replatform/resources/rp-source-shopify/scripts/shopify-extract.js +0 -283
- package/skills/wix-replatform/resources/rp-source-shopify/scripts/shopify-gift-card-remedy.js +0 -191
- package/skills/wix-replatform/resources/rp-source-shopify/scripts/shopify-session-check.js +0 -115
- package/skills/wix-replatform/resources/rp-source-shopify/source-schema.example.json +0 -201
- package/skills/wix-replatform/resources/rp-source-wordpress/PLUGIN-READ-PLANS.md +0 -146
- package/skills/wix-replatform/resources/rp-source-wordpress/SKILL.md +0 -970
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/blocked-data-handlers.js +0 -73
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/checkout-field-csv-parser.js +0 -115
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/checkout-field-csv-parser.test-fixture.js +0 -91
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/coupon-discovery.js +0 -440
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/currency-gate.js +0 -125
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/gateway-source-keys.js +0 -252
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/gateway-source-keys.json +0 -183
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/gateway-summary.mjs +0 -333
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/invoice-discovery.js +0 -426
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/plugin-disposition.js +0 -400
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/plugin-entity-read-plan.js +0 -633
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/plugin-knowledge.js +0 -1127
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/refund-corroboration.js +0 -194
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/refund-corroboration.json +0 -100
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/sampled-ids-batch.js +0 -157
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/secret-value-guard.js +0 -234
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/store-currency.js +0 -101
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/structure-bridge-reader.js +0 -755
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/wix-wp-plugin-v2-client.js +0 -1074
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/wix-wp-plugin-v2-client.test-fixture.js +0 -149
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/woo-inventory.js +0 -25
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-http.js +0 -444
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-image-url.js +0 -186
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-plugin-detect.js +0 -1422
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-redirect-sources.js +0 -343
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/wp-route-classifier.js +0 -680
- package/skills/wix-replatform/resources/rp-source-wordpress/lib/yoast-product-seo-evidence.js +0 -272
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/README.md +0 -373
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/advanced-custom-fields.json +0 -101
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/back-in-stock-notifier-for-woocommerce.json +0 -81
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/capabilities-pending-decision.json +0 -128
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/cms-fallback-eligible.json +0 -18
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/contact-form-7.json +0 -104
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/facebook-for-woocommerce.json +0 -44
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/fingerprint-aliases.json +0 -49
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/free-gifts-for-woocommerce.json +0 -94
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/index.json +0 -863
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/mailpoet.json +0 -52
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/membership-for-woocommerce.json +0 -161
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/mwb-bookings-for-woocommerce.json +0 -180
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/no-migration-needed.json +0 -286
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/pricing-deals-for-woocommerce.json +0 -79
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/product-extras-for-woocommerce.json +0 -120
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/pw-woocommerce-gift-cards.json +0 -128
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/requires-development.json +0 -88
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/seo-by-rank-math.json +0 -80
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/seriously-simple-podcasting.json +0 -46
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/strong-testimonials.json +0 -55
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/subscriptions-for-woocommerce.json +0 -99
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/tablepress.json +0 -55
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/the-events-calendar.json +0 -160
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/ti-woocommerce-wishlist.json +0 -81
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/woo-checkout-field-editor-pro.json +0 -60
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/woo-discount-rules.json +0 -74
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/woo-product-bundle.json +0 -75
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/woocommerce-gift-cards.json +0 -60
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/woocommerce-other-payment-gateway.json +0 -44
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/woocommerce-pdf-invoices-packing-slips.json +0 -57
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/woocommerce-product-addon.json +0 -141
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/woocommerce-progressive-discounts.json +0 -54
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/wordpress-seo.json +0 -158
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/wpc-composite-products.json +0 -97
- package/skills/wix-replatform/resources/rp-source-wordpress/plugins/wpforms-lite.json +0 -86
- package/skills/wix-replatform/resources/rp-source-wordpress/scripts/capture-store-settings.js +0 -90
- package/skills/wix-replatform/resources/rp-source-wordpress/scripts/plugin-knowledge-validate.js +0 -51
- package/skills/wix-replatform/resources/rp-source-wordpress/scripts/plugin-knowledge.js +0 -103
- package/skills/wix-replatform/resources/rp-source-wordpress/scripts/wp-discovery.js +0 -2409
- package/skills/wix-replatform/resources/rp-source-wordpress/scripts/wp-plugin-inventory.js +0 -273
- package/skills/wix-replatform/resources/rp-source-wordpress/secret-value-patterns.v1.json +0 -11
- package/skills/wix-replatform/resources/rp-source-wordpress/source-schema.example.json +0 -71
- package/skills/wix-replatform/resources/rp-source-wordpress/sub-parts.json +0 -13
- package/skills/wix-replatform/resources/rp-target-wix/SKILL.md +0 -1046
- package/skills/wix-replatform/resources/rp-target-wix/app-page-routing-capabilities.json +0 -36
- package/skills/wix-replatform/resources/rp-target-wix/domains/README.md +0 -57
- package/skills/wix-replatform/resources/rp-target-wix/domains/SERVICE-PLUGINS.md +0 -322
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/docs-survey.json +0 -70
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/domain.json +0 -29
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/category.json +0 -71
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/comment.json +0 -83
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/post.json +0 -95
- package/skills/wix-replatform/resources/rp-target-wix/domains/blog/entities/tag.json +0 -66
- package/skills/wix-replatform/resources/rp-target-wix/domains/bookings/docs-survey.json +0 -332
- package/skills/wix-replatform/resources/rp-target-wix/domains/bookings/domain.json +0 -75
- package/skills/wix-replatform/resources/rp-target-wix/domains/bookings/entities/booking.json +0 -181
- package/skills/wix-replatform/resources/rp-target-wix/domains/bookings/entities/service-add-on.json +0 -130
- package/skills/wix-replatform/resources/rp-target-wix/domains/bookings/entities/service.json +0 -180
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/docs-survey.json +0 -161
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/domain.json +0 -25
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/collection.json +0 -67
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/data-item.json +0 -75
- package/skills/wix-replatform/resources/rp-target-wix/domains/cms/entities/reference.json +0 -41
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/docs-survey.json +0 -204
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/domain.json +0 -27
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/contact.json +0 -275
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/email-subscription.json +0 -105
- package/skills/wix-replatform/resources/rp-target-wix/domains/crm/entities/label.json +0 -77
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/docs-survey.json +0 -297
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/domain.json +0 -44
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/delivery-profile.json +0 -171
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/discount-rule.json +0 -182
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-applied-discount.json +0 -129
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-invoice-document.json +0 -192
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-line-item-options.json +0 -123
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-line-item.json +0 -85
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-merchant-note.json +0 -112
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-payment.json +0 -191
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order-refund.json +0 -164
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/order.json +0 -462
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/pickup-location.json +0 -122
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/shipping-option.json +0 -98
- package/skills/wix-replatform/resources/rp-target-wix/domains/ecom/entities/wishlist-item.json +0 -86
- package/skills/wix-replatform/resources/rp-target-wix/domains/events/docs-survey.json +0 -128
- package/skills/wix-replatform/resources/rp-target-wix/domains/events/domain.json +0 -38
- package/skills/wix-replatform/resources/rp-target-wix/domains/events/entities/category.json +0 -73
- package/skills/wix-replatform/resources/rp-target-wix/domains/events/entities/event.json +0 -107
- package/skills/wix-replatform/resources/rp-target-wix/domains/events/entities/registration-form.json +0 -89
- package/skills/wix-replatform/resources/rp-target-wix/domains/events/entities/rsvp.json +0 -118
- package/skills/wix-replatform/resources/rp-target-wix/domains/events/entities/ticket-definition.json +0 -93
- package/skills/wix-replatform/resources/rp-target-wix/domains/forms/docs-survey.json +0 -86
- package/skills/wix-replatform/resources/rp-target-wix/domains/forms/domain.json +0 -56
- package/skills/wix-replatform/resources/rp-target-wix/domains/forms/entities/form-submission.json +0 -121
- package/skills/wix-replatform/resources/rp-target-wix/domains/forms/entities/form.json +0 -134
- package/skills/wix-replatform/resources/rp-target-wix/domains/gift-cards/docs-survey.json +0 -41
- package/skills/wix-replatform/resources/rp-target-wix/domains/gift-cards/domain.json +0 -50
- package/skills/wix-replatform/resources/rp-target-wix/domains/gift-cards/entities/gift-card-product.json +0 -87
- package/skills/wix-replatform/resources/rp-target-wix/domains/gift-cards/entities/gift-card.json +0 -130
- package/skills/wix-replatform/resources/rp-target-wix/domains/index.json +0 -1418
- package/skills/wix-replatform/resources/rp-target-wix/domains/media/docs-survey.json +0 -41
- package/skills/wix-replatform/resources/rp-target-wix/domains/media/domain.json +0 -24
- package/skills/wix-replatform/resources/rp-target-wix/domains/media/entities/media-file.json +0 -75
- package/skills/wix-replatform/resources/rp-target-wix/domains/media/entities/media-folder.json +0 -71
- package/skills/wix-replatform/resources/rp-target-wix/domains/members/docs-survey.json +0 -119
- package/skills/wix-replatform/resources/rp-target-wix/domains/members/domain.json +0 -23
- package/skills/wix-replatform/resources/rp-target-wix/domains/members/entities/badge.json +0 -71
- package/skills/wix-replatform/resources/rp-target-wix/domains/members/entities/custom-field.json +0 -82
- package/skills/wix-replatform/resources/rp-target-wix/domains/members/entities/member-about.json +0 -77
- package/skills/wix-replatform/resources/rp-target-wix/domains/members/entities/member.json +0 -205
- package/skills/wix-replatform/resources/rp-target-wix/domains/pricing-plans/docs-survey.json +0 -41
- package/skills/wix-replatform/resources/rp-target-wix/domains/pricing-plans/domain.json +0 -46
- package/skills/wix-replatform/resources/rp-target-wix/domains/pricing-plans/entities/plan-order.json +0 -137
- package/skills/wix-replatform/resources/rp-target-wix/domains/pricing-plans/entities/plan.json +0 -133
- package/skills/wix-replatform/resources/rp-target-wix/domains/sales-channels/docs-survey.json +0 -7
- package/skills/wix-replatform/resources/rp-target-wix/domains/sales-channels/domain.json +0 -36
- package/skills/wix-replatform/resources/rp-target-wix/domains/sales-channels/entities/amazon-shop-connect.json +0 -71
- package/skills/wix-replatform/resources/rp-target-wix/domains/sales-channels/entities/ebay-shop-connect.json +0 -67
- package/skills/wix-replatform/resources/rp-target-wix/domains/sales-channels/entities/google-youtube-connect.json +0 -72
- package/skills/wix-replatform/resources/rp-target-wix/domains/sales-channels/entities/meta-catalog-connect.json +0 -74
- package/skills/wix-replatform/resources/rp-target-wix/domains/sales-channels/entities/pinterest-catalog-connect.json +0 -69
- package/skills/wix-replatform/resources/rp-target-wix/domains/sales-channels/entities/tiktok-catalog-connect.json +0 -61
- package/skills/wix-replatform/resources/rp-target-wix/domains/schema.json +0 -111
- package/skills/wix-replatform/resources/rp-target-wix/domains/seo/docs-survey.json +0 -109
- package/skills/wix-replatform/resources/rp-target-wix/domains/seo/domain.json +0 -73
- package/skills/wix-replatform/resources/rp-target-wix/domains/seo/entities/item-seo-tags.json +0 -148
- package/skills/wix-replatform/resources/rp-target-wix/domains/seo/entities/seo-pattern.json +0 -91
- package/skills/wix-replatform/resources/rp-target-wix/domains/seo/entities/site-seo-tags.json +0 -79
- package/skills/wix-replatform/resources/rp-target-wix/domains/site/docs-survey.json +0 -32
- package/skills/wix-replatform/resources/rp-target-wix/domains/site/domain.json +0 -49
- package/skills/wix-replatform/resources/rp-target-wix/domains/site/entities/business-contact.json +0 -103
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/docs-survey.json +0 -203
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/domain.json +0 -42
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/back-in-stock-request.json +0 -119
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/brand.json +0 -111
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/category.json +0 -81
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/coupon.json +0 -241
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/inventory-item.json +0 -118
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/product-customization.json +0 -111
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/product-tag.json +0 -79
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/product.json +0 -221
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/promotion.json +0 -84
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/review.json +0 -178
- package/skills/wix-replatform/resources/rp-target-wix/domains/stores/entities/subscription-product.json +0 -87
- package/skills/wix-replatform/resources/rp-target-wix/domains/tax/docs-survey.json +0 -106
- package/skills/wix-replatform/resources/rp-target-wix/domains/tax/domain.json +0 -64
- package/skills/wix-replatform/resources/rp-target-wix/domains/tax/entities/manual-tax-mapping.json +0 -119
- package/skills/wix-replatform/resources/rp-target-wix/domains/tax/entities/tax-group.json +0 -94
- package/skills/wix-replatform/resources/rp-target-wix/domains/tax/entities/tax-region.json +0 -113
- package/skills/wix-replatform/resources/rp-target-wix/domains/tax/entities/tax-settings.json +0 -65
- package/skills/wix-replatform/resources/rp-target-wix/lib/audit-summary.js +0 -64
- package/skills/wix-replatform/resources/rp-target-wix/lib/blog-author-attribution.js +0 -165
- package/skills/wix-replatform/resources/rp-target-wix/lib/blog-post-build-client.js +0 -60
- package/skills/wix-replatform/resources/rp-target-wix/lib/blog-post-build-duplicates.js +0 -201
- package/skills/wix-replatform/resources/rp-target-wix/lib/blog-post-build-ledger.js +0 -306
- package/skills/wix-replatform/resources/rp-target-wix/lib/blog-post-build-report.js +0 -229
- package/skills/wix-replatform/resources/rp-target-wix/lib/blog-post-build-stage.js +0 -55
- package/skills/wix-replatform/resources/rp-target-wix/lib/blog-post-build.js +0 -715
- package/skills/wix-replatform/resources/rp-target-wix/lib/blog-post-media.js +0 -567
- package/skills/wix-replatform/resources/rp-target-wix/lib/bulk-results.js +0 -73
- package/skills/wix-replatform/resources/rp-target-wix/lib/contact-extended-fields.js +0 -194
- package/skills/wix-replatform/resources/rp-target-wix/lib/contact-import.js +0 -133
- package/skills/wix-replatform/resources/rp-target-wix/lib/contract-ledger.js +0 -150
- package/skills/wix-replatform/resources/rp-target-wix/lib/coupon-redemption-drift.js +0 -491
- package/skills/wix-replatform/resources/rp-target-wix/lib/customer-member.js +0 -104
- package/skills/wix-replatform/resources/rp-target-wix/lib/data-extension-schema.js +0 -673
- package/skills/wix-replatform/resources/rp-target-wix/lib/domain-knowledge.js +0 -835
- package/skills/wix-replatform/resources/rp-target-wix/lib/gift-card-balance-reconciliation.js +0 -119
- package/skills/wix-replatform/resources/rp-target-wix/lib/gift-card-build.js +0 -566
- package/skills/wix-replatform/resources/rp-target-wix/lib/gift-card-redemption-build.js +0 -249
- package/skills/wix-replatform/resources/rp-target-wix/lib/ndjson.js +0 -260
- package/skills/wix-replatform/resources/rp-target-wix/lib/order-applied-discount-build.js +0 -63
- package/skills/wix-replatform/resources/rp-target-wix/lib/order-buyer.js +0 -187
- package/skills/wix-replatform/resources/rp-target-wix/lib/order-channel-build.js +0 -64
- package/skills/wix-replatform/resources/rp-target-wix/lib/order-history.js +0 -1027
- package/skills/wix-replatform/resources/rp-target-wix/lib/order-invoice-contract.js +0 -90
- package/skills/wix-replatform/resources/rp-target-wix/lib/order-payment-mapping.js +0 -420
- package/skills/wix-replatform/resources/rp-target-wix/lib/pricing-plan-definition.js +0 -177
- package/skills/wix-replatform/resources/rp-target-wix/lib/product-import.js +0 -151
- package/skills/wix-replatform/resources/rp-target-wix/lib/product-seo.js +0 -723
- package/skills/wix-replatform/resources/rp-target-wix/lib/seo-redirects.js +0 -353
- package/skills/wix-replatform/resources/rp-target-wix/lib/shipping-build.js +0 -1437
- package/skills/wix-replatform/resources/rp-target-wix/lib/shipping-option-stage.js +0 -354
- package/skills/wix-replatform/resources/rp-target-wix/lib/store-config-build.js +0 -134
- package/skills/wix-replatform/resources/rp-target-wix/lib/stores-category-attach.js +0 -221
- package/skills/wix-replatform/resources/rp-target-wix/lib/stores-inventory.js +0 -248
- package/skills/wix-replatform/resources/rp-target-wix/lib/stores-verification.js +0 -321
- package/skills/wix-replatform/resources/rp-target-wix/lib/tax-build.js +0 -231
- package/skills/wix-replatform/resources/rp-target-wix/lib/url-mapper-transport.js +0 -28
- package/skills/wix-replatform/resources/rp-target-wix/lib/value-utils.js +0 -14
- package/skills/wix-replatform/resources/rp-target-wix/lib/variant-correlation.js +0 -34
- package/skills/wix-replatform/resources/rp-target-wix/lib/wix-build.js +0 -388
- package/skills/wix-replatform/resources/rp-target-wix/lib/wix-target-spec.js +0 -255
- package/skills/wix-replatform/resources/rp-target-wix/lib/wix-writers.js +0 -6041
- package/skills/wix-replatform/resources/rp-target-wix/lib/write-verification.js +0 -3
- package/skills/wix-replatform/resources/rp-target-wix/scripts/docs-survey-sync.js +0 -150
- package/skills/wix-replatform/resources/rp-target-wix/scripts/domain-knowledge-validate.js +0 -69
- package/skills/wix-replatform/resources/rp-target-wix/scripts/domain-knowledge.js +0 -100
- package/skills/wix-replatform/resources/rp-target-wix/scripts/verify-stores.js +0 -112
- package/skills/wix-replatform/resources/rp-telemetry/SKILL.md +0 -484
- package/skills/wix-replatform/resources/rp-telemetry/lib/bi-sink.js +0 -318
- package/skills/wix-replatform/resources/rp-telemetry/lib/telemetry-recorder.js +0 -2831
- package/skills/wix-replatform/resources/rp-telemetry/lib/transcript-digest.js +0 -318
- package/skills/wix-replatform/resources/rp-telemetry/scripts/meter-from-audit.js +0 -83
- package/skills/wix-replatform/resources/rp-telemetry/scripts/rp-telemetry.js +0 -243
- package/skills/wix-replatform/resources/rp-website-continuation/SKILL.md +0 -94
- package/skills/wix-replatform/scripts/artifact-freshness.js +0 -76
- package/skills/wix-replatform/scripts/census-reconciliation.js +0 -25
- package/skills/wix-replatform/scripts/cms-fallback.js +0 -89
- package/skills/wix-replatform/scripts/discovered-census.js +0 -26
- package/skills/wix-replatform/scripts/discovered-set-status.js +0 -33
- package/skills/wix-replatform/scripts/entity-qa-attestation.js +0 -130
- package/skills/wix-replatform/scripts/execution-health-check.js +0 -415
- package/skills/wix-replatform/scripts/execution-manifest-validate.js +0 -43
- package/skills/wix-replatform/scripts/execution-state-prepare.js +0 -128
- package/skills/wix-replatform/scripts/expectations-ledger.js +0 -44
- package/skills/wix-replatform/scripts/import-contract-verify.js +0 -183
- package/skills/wix-replatform/scripts/internal-link-audit.js +0 -90
- package/skills/wix-replatform/scripts/item-seo-tags-verify.js +0 -205
- package/skills/wix-replatform/scripts/migration-completion.js +0 -76
- package/skills/wix-replatform/scripts/orchestration-preflight.js +0 -67
- package/skills/wix-replatform/scripts/orchestration-route.js +0 -77
- package/skills/wix-replatform/scripts/orchestration-state.js +0 -381
- package/skills/wix-replatform/scripts/read-back-gate.js +0 -175
- package/skills/wix-replatform/scripts/replatform-console.js +0 -146
- package/skills/wix-replatform/scripts/replatform.js +0 -436
- package/skills/wix-replatform/scripts/source-secrets.js +0 -77
- package/skills/wix-replatform/scripts/url-redirects.js +0 -286
- package/skills/wix-replatform/scripts/user-action.js +0 -58
- package/skills/wix-replatform/scripts/website-handoff-generate.js +0 -64
- package/skills/wix-replatform/scripts/wix-dashboard-url.js +0 -54
- package/skills/wix-replatform/scripts/wix-destination.js +0 -143
- package/skills/wix-replatform/scripts/wix-headless-scaffold.js +0 -762
- package/skills/wix-vibe-headless/SKILL.md +0 -183
- package/skills/wix-vibe-headless/install/deploy.cjs +0 -221
- package/skills/wix-vibe-headless/install/pin-agents-md.cjs +0 -35
- package/skills/wix-vibe-headless/platforms/README.md +0 -26
- package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed-with-install.md +0 -127
- package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed.md +0 -121
- package/skills/wix-vibe-headless/platforms/base44-ecom-light.md +0 -87
- package/skills/wix-vibe-headless/platforms/base44.md +0 -148
- package/skills/wix-vibe-headless/platforms/generic.md +0 -132
- package/skills/wix-vibe-headless/references/_shared/nav/nav.tanstack.js +0 -30
- package/skills/wix-vibe-headless/references/_shared/routing.md +0 -86
- package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +0 -270
- package/skills/wix-vibe-headless/references/blog/app/components/PostCard.jsx +0 -43
- package/skills/wix-vibe-headless/references/blog/app/components/PostChips.jsx +0 -25
- package/skills/wix-vibe-headless/references/blog/app/components/PostGrid.jsx +0 -15
- package/skills/wix-vibe-headless/references/blog/app/context/TaxonomyContext.jsx +0 -35
- package/skills/wix-vibe-headless/references/blog/app/hooks/usePostDetail.js +0 -38
- package/skills/wix-vibe-headless/references/blog/app/pages/Blog.jsx +0 -40
- package/skills/wix-vibe-headless/references/blog/app/pages/CategoryPage.jsx +0 -54
- package/skills/wix-vibe-headless/references/blog/app/pages/PostDetail.jsx +0 -65
- package/skills/wix-vibe-headless/references/blog/app/pages/TagPage.jsx +0 -50
- package/skills/wix-vibe-headless/references/blog/app/rest/wix-blog.js +0 -217
- package/skills/wix-vibe-headless/references/blog/seed/SEED.md +0 -99
- package/skills/wix-vibe-headless/references/blog/seed/seed-blog.cjs +0 -269
- package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +0 -342
- package/skills/wix-vibe-headless/references/bookings/app/components/BookingForm.jsx +0 -65
- package/skills/wix-vibe-headless/references/bookings/app/components/RentalDurationPicker.jsx +0 -67
- package/skills/wix-vibe-headless/references/bookings/app/components/ServiceCard.jsx +0 -47
- package/skills/wix-vibe-headless/references/bookings/app/components/ServiceGrid.jsx +0 -13
- package/skills/wix-vibe-headless/references/bookings/app/components/SlotPicker.jsx +0 -126
- package/skills/wix-vibe-headless/references/bookings/app/hooks/useRentalDuration.js +0 -128
- package/skills/wix-vibe-headless/references/bookings/app/hooks/useServiceDetail.js +0 -110
- package/skills/wix-vibe-headless/references/bookings/app/hooks/useServices.js +0 -58
- package/skills/wix-vibe-headless/references/bookings/app/lib/serviceFacts.js +0 -95
- package/skills/wix-vibe-headless/references/bookings/app/pages/ServiceDetail.jsx +0 -94
- package/skills/wix-vibe-headless/references/bookings/app/pages/Services.jsx +0 -89
- package/skills/wix-vibe-headless/references/bookings/app/rest/wix-bookings-checkout.js +0 -148
- package/skills/wix-vibe-headless/references/bookings/app/rest/wix-bookings-rentals.js +0 -250
- package/skills/wix-vibe-headless/references/bookings/app/rest/wix-bookings-services.js +0 -300
- package/skills/wix-vibe-headless/references/bookings/seed/SEED.md +0 -154
- package/skills/wix-vibe-headless/references/bookings/seed/seed-bookings.cjs +0 -333
- package/skills/wix-vibe-headless/references/bookings/seed/seed-rentals.cjs +0 -267
- package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +0 -178
- package/skills/wix-vibe-headless/references/cms/app/collection.config.js +0 -31
- package/skills/wix-vibe-headless/references/cms/app/lib/wixImage.js +0 -18
- package/skills/wix-vibe-headless/references/cms/app/rest/wix-cms.js +0 -231
- package/skills/wix-vibe-headless/references/cms/seed/SEED.md +0 -145
- package/skills/wix-vibe-headless/references/donations/INSTRUCTIONS.md +0 -88
- package/skills/wix-vibe-headless/references/donations/app/rest/wix-donations.js +0 -112
- package/skills/wix-vibe-headless/references/donations/seed/SEED.md +0 -11
- package/skills/wix-vibe-headless/references/donations/tests/donations.test.mjs +0 -258
- package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +0 -267
- package/skills/wix-vibe-headless/references/events/app/components/CategoryFilter.jsx +0 -23
- package/skills/wix-vibe-headless/references/events/app/components/EventCard.jsx +0 -43
- package/skills/wix-vibe-headless/references/events/app/components/EventGrid.jsx +0 -13
- package/skills/wix-vibe-headless/references/events/app/components/EventRegistration.jsx +0 -29
- package/skills/wix-vibe-headless/references/events/app/components/RsvpForm.jsx +0 -57
- package/skills/wix-vibe-headless/references/events/app/components/TicketPicker.jsx +0 -78
- package/skills/wix-vibe-headless/references/events/app/hooks/useEventDetail.js +0 -27
- package/skills/wix-vibe-headless/references/events/app/hooks/useEventsList.js +0 -54
- package/skills/wix-vibe-headless/references/events/app/hooks/useRsvpForm.js +0 -40
- package/skills/wix-vibe-headless/references/events/app/hooks/useTicketing.js +0 -81
- package/skills/wix-vibe-headless/references/events/app/pages/EventDetail.jsx +0 -48
- package/skills/wix-vibe-headless/references/events/app/pages/Events.jsx +0 -36
- package/skills/wix-vibe-headless/references/events/app/rest/wix-events-browse.js +0 -136
- package/skills/wix-vibe-headless/references/events/app/rest/wix-events-registration.js +0 -187
- package/skills/wix-vibe-headless/references/events/seed/SEED.md +0 -103
- package/skills/wix-vibe-headless/references/events/seed/seed-events.cjs +0 -251
- package/skills/wix-vibe-headless/references/forms/INSTRUCTIONS.md +0 -487
- package/skills/wix-vibe-headless/references/forms/app/hooks/useWixForm.js +0 -425
- package/skills/wix-vibe-headless/references/forms/app/lib/wix-form-schema-utils.js +0 -187
- package/skills/wix-vibe-headless/references/forms/app/rest/wix-forms-submissions.js +0 -238
- package/skills/wix-vibe-headless/references/forms/app/rest/wix-forms.js +0 -108
- package/skills/wix-vibe-headless/references/forms/seed/SEED.md +0 -1836
- package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +0 -328
- package/skills/wix-vibe-headless/references/members/app/components/LoginForm.jsx +0 -101
- package/skills/wix-vibe-headless/references/members/app/components/MemberMenu.jsx +0 -33
- package/skills/wix-vibe-headless/references/members/app/components/RequireAuth.jsx +0 -21
- package/skills/wix-vibe-headless/references/members/app/components/SocialButtons.jsx +0 -29
- package/skills/wix-vibe-headless/references/members/app/context/MemberContext.jsx +0 -54
- package/skills/wix-vibe-headless/references/members/app/hooks/useLoginForm.js +0 -77
- package/skills/wix-vibe-headless/references/members/app/pages/Account.jsx +0 -36
- package/skills/wix-vibe-headless/references/members/app/pages/Callback.jsx +0 -32
- package/skills/wix-vibe-headless/references/members/app/pages/Login.jsx +0 -35
- package/skills/wix-vibe-headless/references/members/app/rest/wix-members-auth.js +0 -390
- package/skills/wix-vibe-headless/references/members/install/Register.jsx +0 -22
- package/skills/wix-vibe-headless/references/members/seed/SEED.md +0 -21
- package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +0 -270
- package/skills/wix-vibe-headless/references/portfolio/app/components/CollectionCard.jsx +0 -31
- package/skills/wix-vibe-headless/references/portfolio/app/components/CollectionGrid.jsx +0 -15
- package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectCard.jsx +0 -39
- package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectGrid.jsx +0 -15
- package/skills/wix-vibe-headless/references/portfolio/app/components/ProjectMedia.jsx +0 -29
- package/skills/wix-vibe-headless/references/portfolio/app/hooks/useCollectionProjects.js +0 -35
- package/skills/wix-vibe-headless/references/portfolio/app/hooks/usePortfolioGallery.js +0 -27
- package/skills/wix-vibe-headless/references/portfolio/app/hooks/useProjectDetail.js +0 -25
- package/skills/wix-vibe-headless/references/portfolio/app/pages/CollectionPage.jsx +0 -39
- package/skills/wix-vibe-headless/references/portfolio/app/pages/Portfolio.jsx +0 -27
- package/skills/wix-vibe-headless/references/portfolio/app/pages/ProjectDetail.jsx +0 -60
- package/skills/wix-vibe-headless/references/portfolio/app/rest/wix-portfolio.js +0 -223
- package/skills/wix-vibe-headless/references/portfolio/seed/SEED.md +0 -90
- package/skills/wix-vibe-headless/references/portfolio/seed/seed-portfolio.cjs +0 -236
- package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +0 -280
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/OrderCard.jsx +0 -35
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanCard.jsx +0 -48
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanGrid.jsx +0 -16
- package/skills/wix-vibe-headless/references/pricing-plans/app/components/PlanPrice.jsx +0 -35
- package/skills/wix-vibe-headless/references/pricing-plans/app/hooks/useMyPlans.js +0 -25
- package/skills/wix-vibe-headless/references/pricing-plans/app/hooks/usePlanDetail.js +0 -28
- package/skills/wix-vibe-headless/references/pricing-plans/app/hooks/usePlans.js +0 -30
- package/skills/wix-vibe-headless/references/pricing-plans/app/pages/MyPlans.jsx +0 -30
- package/skills/wix-vibe-headless/references/pricing-plans/app/pages/PlanDetail.jsx +0 -53
- package/skills/wix-vibe-headless/references/pricing-plans/app/pages/Plans.jsx +0 -28
- package/skills/wix-vibe-headless/references/pricing-plans/app/rest/wix-pricing-plans.js +0 -157
- package/skills/wix-vibe-headless/references/pricing-plans/seed/SEED.md +0 -82
- package/skills/wix-vibe-headless/references/pricing-plans/seed/seed-pricing-plans.cjs +0 -251
- package/skills/wix-vibe-headless/references/rentals/INSTRUCTIONS.md +0 -13
- package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +0 -290
- package/skills/wix-vibe-headless/references/restaurants/app/components/ItemDialog.jsx +0 -81
- package/skills/wix-vibe-headless/references/restaurants/app/components/MenuItemCard.jsx +0 -71
- package/skills/wix-vibe-headless/references/restaurants/app/components/MenuList.jsx +0 -43
- package/skills/wix-vibe-headless/references/restaurants/app/components/OrderCartButton.jsx +0 -21
- package/skills/wix-vibe-headless/references/restaurants/app/components/OrderCartDrawer.jsx +0 -72
- package/skills/wix-vibe-headless/references/restaurants/app/context/OrderCartContext.jsx +0 -66
- package/skills/wix-vibe-headless/references/restaurants/app/hooks/useItemOrder.js +0 -32
- package/skills/wix-vibe-headless/references/restaurants/app/hooks/useReservation.js +0 -73
- package/skills/wix-vibe-headless/references/restaurants/app/pages/Menu.jsx +0 -28
- package/skills/wix-vibe-headless/references/restaurants/app/pages/Reservations.jsx +0 -102
- package/skills/wix-vibe-headless/references/restaurants/app/rest/wix-restaurants-menu.js +0 -224
- package/skills/wix-vibe-headless/references/restaurants/app/rest/wix-restaurants-ordering.js +0 -218
- package/skills/wix-vibe-headless/references/restaurants/app/rest/wix-restaurants-reservations.js +0 -107
- package/skills/wix-vibe-headless/references/restaurants/seed/SEED.md +0 -176
- package/skills/wix-vibe-headless/references/restaurants/seed/seed-restaurants.cjs +0 -452
- package/skills/wix-vibe-headless/references/shared/app/components/WixManageBanner.jsx +0 -56
- package/skills/wix-vibe-headless/references/shared/app/lib/nav.js +0 -9
- package/skills/wix-vibe-headless/references/shared/app/rest/wix-client.js +0 -185
- package/skills/wix-vibe-headless/references/shared/app/rest/wix-config.js +0 -8
- package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +0 -471
- package/skills/wix-vibe-headless/references/storefront/app/components/CartButton.jsx +0 -20
- package/skills/wix-vibe-headless/references/storefront/app/components/CartDrawer.jsx +0 -167
- package/skills/wix-vibe-headless/references/storefront/app/context/CartContext.jsx +0 -83
- package/skills/wix-vibe-headless/references/storefront/app/hooks/useProductCard.js +0 -104
- package/skills/wix-vibe-headless/references/storefront/app/hooks/useProductDetail.js +0 -163
- package/skills/wix-vibe-headless/references/storefront/app/hooks/useShop.js +0 -83
- package/skills/wix-vibe-headless/references/storefront/app/hooks/useVariantOptions.js +0 -76
- package/skills/wix-vibe-headless/references/storefront/app/lib/storeImage.js +0 -64
- package/skills/wix-vibe-headless/references/storefront/app/rest/wix-store-cart.js +0 -176
- package/skills/wix-vibe-headless/references/storefront/app/rest/wix-store-catalog.js +0 -218
- package/skills/wix-vibe-headless/references/storefront/seed/SEED.md +0 -174
- package/skills/wix-vibe-headless/references/storefront/seed/seed-store.cjs +0 -546
|
@@ -1,1481 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('node:fs/promises');
|
|
4
|
-
const path = require('node:path');
|
|
5
|
-
|
|
6
|
-
const SCHEMA_VERSION = 1;
|
|
7
|
-
|
|
8
|
-
// `process.kill(pid, 0)` throwing does not by itself mean the
|
|
9
|
-
// process is dead -- Node surfaces the same exception for ESRCH (no such process) and EPERM (a
|
|
10
|
-
// real, live process this user cannot signal, e.g. owned by a different UID on a shared
|
|
11
|
-
// sandbox). Only ESRCH means dead; only Node's own `error.code` is needed to tell the two apart,
|
|
12
|
-
// no filesystem check required. Shared with `execution-health-check.js`, which had its own
|
|
13
|
-
// independent copy of this exact check before round 5 consolidated them.
|
|
14
|
-
function isProcessAlive(pid) {
|
|
15
|
-
try {
|
|
16
|
-
process.kill(pid, 0);
|
|
17
|
-
return true;
|
|
18
|
-
} catch (error) {
|
|
19
|
-
return error && error.code === 'EPERM';
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const CROSSWALK_STATUS = new Set(['imported']);
|
|
24
|
-
const ATTEMPT_STATUS = new Set([
|
|
25
|
-
'started',
|
|
26
|
-
'succeeded_unverified',
|
|
27
|
-
'imported',
|
|
28
|
-
'failed_retryable',
|
|
29
|
-
'failed_terminal',
|
|
30
|
-
'deferred',
|
|
31
|
-
'needs_verification',
|
|
32
|
-
'skipped_already_imported',
|
|
33
|
-
'skipped_safe_mode_blocked',
|
|
34
|
-
// A record excluded by an accepted
|
|
35
|
-
// out-of-scope rule (`entityCompleteness.skippedOutOfScope`) needs its own
|
|
36
|
-
// terminal attempt-journal status alongside the other `skipped_*` outcomes below, or the
|
|
37
|
-
// very first such row written to a project's real ledger makes `validateAttemptRow` throw
|
|
38
|
-
// and poisons every future read of that append-only journal (`loadAttemptJournal`,
|
|
39
|
-
// `readAttemptJournalSince`) for the rest of the project's life. Like its `skipped_*`
|
|
40
|
-
// siblings, it makes no journal-count claim and is intentionally not a branch in
|
|
41
|
-
// `coverageStatusCounts` (import-recovery.js) or `DEFERRED_ATTEMPT_STATUSES` below.
|
|
42
|
-
'skipped_out_of_scope',
|
|
43
|
-
// An in-scope record the runner skipped WITHOUT an accepted source-data rule.
|
|
44
|
-
// Deliberately not `deferred` (an accepted, reasoned deferral) and in none of the deferred,
|
|
45
|
-
// uncertain or failure-required sets: it was never sent, so recovery treats it as missing.
|
|
46
|
-
'skipped_unexpected',
|
|
47
|
-
]);
|
|
48
|
-
|
|
49
|
-
// An UNRESOLVED outcome is a write whose result we do not know: it may or may
|
|
50
|
-
// not have landed on the merchant's store. Its next action is to READ THE TARGET BACK, never to
|
|
51
|
-
// re-send, so it is deliberately a different class from `failed` (re-attempt) and from
|
|
52
|
-
// `deferred` (reconsider when the blocker clears). Folding it into `failed` is how a recovery
|
|
53
|
-
// pass creates a duplicate on a live store.
|
|
54
|
-
//
|
|
55
|
-
// This is NOT import-recovery's UNCERTAIN_ATTEMPT_STATUSES, which additionally covers the
|
|
56
|
-
// deferred pair for a different question ("could a prior write already exist?").
|
|
57
|
-
const UNRESOLVED_ATTEMPT_STATUSES = new Set(['started', 'succeeded_unverified']);
|
|
58
|
-
|
|
59
|
-
// These statuses must carry a structured `failure` block, because for each of
|
|
60
|
-
// them the identifying facts are the whole value of the row. `started` is excluded on purpose:
|
|
61
|
-
// a `started` row is written BEFORE the outcome is known, so it has no facts to carry yet. It
|
|
62
|
-
// becomes unresolved only by dangling — by never getting a terminal follow-on row — which is a
|
|
63
|
-
// property of the journal, not of the row, and is resolved in the projection below.
|
|
64
|
-
const FAILURE_REQUIRED_STATUSES = new Set(['failed_retryable', 'failed_terminal', 'succeeded_unverified']);
|
|
65
|
-
const FAILURE_OUTCOMES = new Set(['failed_terminal', 'failed_retryable', 'unresolved']);
|
|
66
|
-
const PRODUCT_MEDIA_FAILURE_REASONS = new Set([
|
|
67
|
-
'no-source-id',
|
|
68
|
-
'no-source-record',
|
|
69
|
-
'source-unreadable',
|
|
70
|
-
]);
|
|
71
|
-
|
|
72
|
-
// The outcome a given status must declare, so a row cannot say `failed_terminal` in one field
|
|
73
|
-
// and `unresolved` in the other.
|
|
74
|
-
const FAILURE_OUTCOME_FOR_STATUS = {
|
|
75
|
-
failed_retryable: 'failed_retryable',
|
|
76
|
-
failed_terminal: 'failed_terminal',
|
|
77
|
-
succeeded_unverified: 'unresolved',
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// The truncation rule made checkable. The defect this closes: a coupon failure
|
|
81
|
-
// kept the first 300 characters of the error message, and in every case the identifier of the
|
|
82
|
-
// thing that failed sat past the cut. A GUID is the identifier shape the target uses, it never
|
|
83
|
-
// occurs in ordinary prose, and so a GUID present in `failure.message` and nowhere else on the
|
|
84
|
-
// row is exactly the evidence-destroying pattern -- detectable with no heuristics.
|
|
85
|
-
const GUID_IN_TEXT = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi;
|
|
86
|
-
|
|
87
|
-
// a message naming exactly one GUID is not always
|
|
88
|
-
// naming THIS row's own target -- Wix's own validator errors routinely echo back a REFERENCED
|
|
89
|
-
// entity's id while explaining why some OTHER entity's reference to it failed, e.g.
|
|
90
|
-
// `scope.group={name:product,entityId:<PRODUCT-GUID>} entityId not found` on a failed
|
|
91
|
-
// coupon-create. That message names exactly one distinct GUID, but it is the product the coupon
|
|
92
|
-
// referenced, not the coupon itself -- and the single-GUID auto-extraction below would have
|
|
93
|
-
// misattributed that product's id to the coupon row as its own targetEntityId. `scope.group=`
|
|
94
|
-
// and `entityId ... not found` are the two markers Wix's own foreign-reference-lookup failures use
|
|
95
|
-
// to describe an id that belongs to some OTHER record; when either appears, the message is
|
|
96
|
-
// self-evidently talking about a reference, not self-identifying, so this is treated the same as
|
|
97
|
-
// the already-handled two-distinct-GUIDs case -- leave targetEntityId unguessed.
|
|
98
|
-
//
|
|
99
|
-
// BUG FIX: the second alternative used to require the literal, ADJACENT
|
|
100
|
-
// substring "entityId not found" -- but Wix's actual documented error text for this exact case
|
|
101
|
-
// (domains/stores/entities/coupon.json, wix-writers.js:4148) is `entityId '<id>' not found`, with
|
|
102
|
-
// the referenced GUID quoted in between "entityId" and "not found". That real shape matched
|
|
103
|
-
// neither alternative, so a coupon-create failure carrying Wix's own documented wording still hit
|
|
104
|
-
// the single-GUID auto-extraction path and misattributed the referenced product's GUID to the
|
|
105
|
-
// coupon row -- the identical misattribution bug this guard exists to close, just via a phrasing
|
|
106
|
-
// the marker didn't cover. Broadened to `entityId\b.*not found`, which still requires "entityId"
|
|
107
|
-
// to actually appear before "not found" (so an unrelated, later "not found" elsewhere in a long
|
|
108
|
-
// message can't match on its own): confirmed against every "entityId ... not found" error shape
|
|
109
|
-
// documented in this repo (coupon.json, wix-writers.js) that this is the only live use of the
|
|
110
|
-
// phrase, always in the same foreign-reference-scope context, so widening it introduces no
|
|
111
|
-
// self-referential false positive.
|
|
112
|
-
// `.*` cannot span a newline, but `wix.send()` embeds up to 400
|
|
113
|
-
// raw response characters into `error.message` (see below), which can be a pretty-printed,
|
|
114
|
-
// multi-line 400 body. `[\s\S]*` matches the same "entityId ... not found" shape across an
|
|
115
|
-
// embedded newline, where a bare `.` would silently fail to match and let the single-GUID
|
|
116
|
-
// auto-extraction below misattribute a referenced entity's GUID as this row's own targetEntityId.
|
|
117
|
-
// BUG FIX: `entityId\b` has no boundary BEFORE "entityId", so it also
|
|
118
|
-
// matched inside a compound identifier like "targetEntityId" (e.g. "field targetEntityId is
|
|
119
|
-
// required but was not found..."), a false positive about the row's OWN record, not a foreign
|
|
120
|
-
// reference -- suppressing legitimate GUID auto-extraction for that row. The negative lookbehind
|
|
121
|
-
// requires "entityId" not be preceded by a letter, so it only matches as its own token.
|
|
122
|
-
const FOREIGN_REFERENCE_MARKER = /scope\.group\s*=|(?<![a-zA-Z])entityId\b[\s\S]*not found/i;
|
|
123
|
-
|
|
124
|
-
function stateDir(projectDir) {
|
|
125
|
-
return path.join(projectDir, 'state');
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function crosswalkDir(projectDir) {
|
|
129
|
-
return path.join(stateDir(projectDir), 'crosswalk');
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function crosswalkPath(projectDir) {
|
|
133
|
-
return path.join(crosswalkDir(projectDir), 'crosswalk.ndjson');
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function crosswalkIndexDir(projectDir) {
|
|
137
|
-
return path.join(crosswalkDir(projectDir), 'indexes');
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function attemptsDir(projectDir) {
|
|
141
|
-
return path.join(stateDir(projectDir), 'attempts');
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function attemptJournalPath(projectDir) {
|
|
145
|
-
return path.join(attemptsDir(projectDir), 'write-attempts.ndjson');
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function wixRequestCapturesPath(projectDir) {
|
|
149
|
-
return path.join(attemptsDir(projectDir), 'wix-request-captures.ndjson');
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// A validation pass keeps its rows under a PARALLEL SUBTREE, not beside the real
|
|
153
|
-
// journal under a different filename. The dry-run crosswalk's sibling-filename convention is
|
|
154
|
-
// deliberately not followed here and is not changed by this: the property this buys is
|
|
155
|
-
// that a validation pass has no path to the real ledger at all, and a sibling filename leaves
|
|
156
|
-
// the real journal one string substitution away -- which is precisely how a record limit came
|
|
157
|
-
// to select a truncating open against the right path.
|
|
158
|
-
function sampleStateDir(projectDir) {
|
|
159
|
-
return path.join(projectDir, 'state', 'sample');
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function sampleAttemptJournalPath(projectDir) {
|
|
163
|
-
return path.join(sampleStateDir(projectDir), 'attempts', 'write-attempts.ndjson');
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// A derived re-read queue, rebuilt from the journal. It is a PROJECTION: deleting
|
|
167
|
-
// it loses nothing and it is never a source of truth.
|
|
168
|
-
function unresolvedWritesPath(projectDir) {
|
|
169
|
-
return path.join(projectDir, 'execution', 'unresolved-writes.ndjson');
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
function cmsMirrorDir(projectDir) {
|
|
173
|
-
return path.join(stateDir(projectDir), 'cms-mirror');
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function safeModeDir(projectDir) {
|
|
177
|
-
return path.join(stateDir(projectDir), 'safe-mode');
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function safeModeEmailReplacementsPath(projectDir) {
|
|
181
|
-
return path.join(safeModeDir(projectDir), 'email-replacements.ndjson');
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function safeModeBlockedRecordsPath(projectDir) {
|
|
185
|
-
return path.join(safeModeDir(projectDir), 'blocked-records.ndjson');
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
function dryRunCrosswalkPath(projectDir) {
|
|
189
|
-
return path.join(crosswalkDir(projectDir), 'dry-run-crosswalk.ndjson');
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
async function mkdirp(dirPath) {
|
|
193
|
-
await fs.mkdir(dirPath, { recursive: true });
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
async function pathExists(filePath) {
|
|
197
|
-
try {
|
|
198
|
-
await fs.access(filePath);
|
|
199
|
-
return true;
|
|
200
|
-
} catch (error) {
|
|
201
|
-
if (error && error.code === 'ENOENT') {
|
|
202
|
-
return false;
|
|
203
|
-
}
|
|
204
|
-
throw error;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
async function writeJsonAtomic(filePath, data) {
|
|
209
|
-
await mkdirp(path.dirname(filePath));
|
|
210
|
-
const tempPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
211
|
-
await fs.writeFile(tempPath, `${JSON.stringify(data, null, 2)}\n`, 'utf8');
|
|
212
|
-
await fs.rename(tempPath, filePath);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
async function writeTextAtomic(filePath, text) {
|
|
216
|
-
await mkdirp(path.dirname(filePath));
|
|
217
|
-
const tempPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
218
|
-
await fs.writeFile(tempPath, text, { encoding: 'utf8', mode: 0o600 });
|
|
219
|
-
await fs.rename(tempPath, filePath);
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
async function appendNdjson(filePath, row) {
|
|
223
|
-
await mkdirp(path.dirname(filePath));
|
|
224
|
-
await fs.appendFile(filePath, `${JSON.stringify(row)}\n`, 'utf8');
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
async function readNdjson(filePath) {
|
|
228
|
-
let raw;
|
|
229
|
-
try {
|
|
230
|
-
raw = await fs.readFile(filePath, 'utf8');
|
|
231
|
-
} catch (error) {
|
|
232
|
-
if (error && error.code === 'ENOENT') {
|
|
233
|
-
return [];
|
|
234
|
-
}
|
|
235
|
-
throw error;
|
|
236
|
-
}
|
|
237
|
-
const rows = [];
|
|
238
|
-
const lines = raw.split(/\r?\n/);
|
|
239
|
-
for (let index = 0; index < lines.length; index += 1) {
|
|
240
|
-
const line = lines[index].trim();
|
|
241
|
-
if (!line) {
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
try {
|
|
245
|
-
rows.push(JSON.parse(line));
|
|
246
|
-
} catch (error) {
|
|
247
|
-
throw new Error(`${filePath}:${index + 1} invalid NDJSON: ${error.message}`);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
return rows;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
function assertObject(row, label) {
|
|
254
|
-
if (!row || typeof row !== 'object' || Array.isArray(row)) {
|
|
255
|
-
throw new Error(`${label} must be an object`);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
function requireString(row, field, label, errors) {
|
|
260
|
-
if (!row[field] || typeof row[field] !== 'string') {
|
|
261
|
-
errors.push(`${label}.${field} must be a non-empty string`);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
const crosswalkListeners = new Map();
|
|
266
|
-
async function crosswalkFileStamp(file) { try { const stat = await fs.stat(file); return `${stat.ino}:${stat.size}:${stat.mtimeMs}:${stat.ctimeMs}`; } catch (error) { if (error.code === 'ENOENT') return 'missing'; throw error; } }
|
|
267
|
-
function onCrosswalkChange(projectDir, listener) {
|
|
268
|
-
const root = path.resolve(projectDir); if (!crosswalkListeners.has(root)) crosswalkListeners.set(root, new Set());
|
|
269
|
-
crosswalkListeners.get(root).add(listener); return () => crosswalkListeners.get(root)?.delete(listener);
|
|
270
|
-
}
|
|
271
|
-
async function notifyCrosswalkChange(projectDir, event) { for (const listener of crosswalkListeners.get(path.resolve(projectDir)) || []) listener(event); }
|
|
272
|
-
function stampSite(projectDir, row) {
|
|
273
|
-
const context = require('./execution-capability').projectContext(projectDir);
|
|
274
|
-
if (context && row.siteId && row.siteId !== context.siteId) throw new Error('SITE_EVIDENCE_MISMATCH');
|
|
275
|
-
return context ? { ...row, siteId: context.siteId } : row;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
function validateCrosswalkRow(row, { allowThrow = true, label = 'crosswalk row' } = {}) {
|
|
279
|
-
const errors = [];
|
|
280
|
-
try {
|
|
281
|
-
assertObject(row, label);
|
|
282
|
-
} catch (error) {
|
|
283
|
-
if (allowThrow) {
|
|
284
|
-
throw error;
|
|
285
|
-
}
|
|
286
|
-
return { ok: false, errors: [error.message] };
|
|
287
|
-
}
|
|
288
|
-
if (row.siteId !== undefined && (typeof row.siteId !== 'string' || !row.siteId)) errors.push(`${label}.siteId must be a nonempty string`);
|
|
289
|
-
if (row.schemaVersion !== SCHEMA_VERSION) {
|
|
290
|
-
errors.push(`${label}.schemaVersion must be ${SCHEMA_VERSION}`);
|
|
291
|
-
}
|
|
292
|
-
for (const field of [
|
|
293
|
-
'sourceSystem',
|
|
294
|
-
'sourceEntityType',
|
|
295
|
-
'sourceId',
|
|
296
|
-
'sourceStableKey',
|
|
297
|
-
'targetSystem',
|
|
298
|
-
'targetEntityType',
|
|
299
|
-
'targetId',
|
|
300
|
-
'status',
|
|
301
|
-
]) {
|
|
302
|
-
requireString(row, field, label, errors);
|
|
303
|
-
}
|
|
304
|
-
if (row.status && !CROSSWALK_STATUS.has(row.status)) {
|
|
305
|
-
errors.push(`${label}.status must be one of: ${Array.from(CROSSWALK_STATUS).join(', ')}`);
|
|
306
|
-
}
|
|
307
|
-
if (row.updatedAt !== undefined && Number.isNaN(Date.parse(row.updatedAt))) {
|
|
308
|
-
errors.push(`${label}.updatedAt must be an ISO timestamp when present`);
|
|
309
|
-
}
|
|
310
|
-
// The version pair recorded from a CONFIRMED write, so a rerun can tell a
|
|
311
|
-
// changed source record from an unchanged one. All four stay OPTIONAL, because rows written
|
|
312
|
-
// before this existed must still load -- but absence is never read as "unchanged" (see
|
|
313
|
-
// rerunDecision, which reports `unknown` rather than skipping).
|
|
314
|
-
if (row.sourceVersionField !== undefined
|
|
315
|
-
&& (typeof row.sourceVersionField !== 'string' || row.sourceVersionField === '')) {
|
|
316
|
-
errors.push(`${label}.sourceVersionField must be a non-empty string when present`);
|
|
317
|
-
}
|
|
318
|
-
if (row.sourceVersion !== undefined
|
|
319
|
-
&& !(typeof row.sourceVersion === 'string' || typeof row.sourceVersion === 'number')) {
|
|
320
|
-
errors.push(`${label}.sourceVersion must be a string or number when present`);
|
|
321
|
-
}
|
|
322
|
-
if (row.sourceVersion !== undefined && row.sourceVersionField === undefined) {
|
|
323
|
-
errors.push(`${label}.sourceVersion requires sourceVersionField — a version with no named field cannot be compared`);
|
|
324
|
-
}
|
|
325
|
-
if (row.targetRevision !== undefined
|
|
326
|
-
&& (typeof row.targetRevision !== 'string' || row.targetRevision === '')) {
|
|
327
|
-
errors.push(`${label}.targetRevision must be a non-empty opaque string when present`);
|
|
328
|
-
}
|
|
329
|
-
if (row.sourceHash !== undefined && (typeof row.sourceHash !== 'string' || row.sourceHash === '')) {
|
|
330
|
-
errors.push(`${label}.sourceHash must be a non-empty string when present`);
|
|
331
|
-
}
|
|
332
|
-
if (row.sourceHashDefinition !== undefined
|
|
333
|
-
&& (typeof row.sourceHashDefinition !== 'string' || row.sourceHashDefinition === '')) {
|
|
334
|
-
errors.push(`${label}.sourceHashDefinition must be a non-empty string when present`);
|
|
335
|
-
}
|
|
336
|
-
if (errors.length && allowThrow) {
|
|
337
|
-
throw new Error(errors.join('; '));
|
|
338
|
-
}
|
|
339
|
-
return { ok: errors.length === 0, errors };
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
// Decides what a rerun does with one source record, given its crosswalk
|
|
343
|
-
// baseline. Pure: no I/O, no writes, so the same inputs always give the same verdict.
|
|
344
|
-
//
|
|
345
|
-
// The load-bearing rule is the LAST one: a linked record with no usable comparison evidence is
|
|
346
|
-
// `unknown`, never `skip` and never a blind `update`. "We lost the baseline" and "the source did
|
|
347
|
-
// not change" are different facts, and conflating them either silently drops a real change or
|
|
348
|
-
// silently overwrites a merchant's Wix edit.
|
|
349
|
-
const RERUN_ACTIONS = new Set(['create', 'skip', 'update', 'unknown']);
|
|
350
|
-
|
|
351
|
-
function comparableVersion(value) {
|
|
352
|
-
if (value === undefined || value === null || value === '') {
|
|
353
|
-
return null;
|
|
354
|
-
}
|
|
355
|
-
// Version IDs are opaque: compare as strings, never numerically or by recency.
|
|
356
|
-
return String(value);
|
|
357
|
-
}
|
|
358
|
-
|
|
359
|
-
function rerunDecision({
|
|
360
|
-
crosswalkRow = null,
|
|
361
|
-
sourceVersion = undefined,
|
|
362
|
-
sourceVersionField = null,
|
|
363
|
-
sourceHash = undefined,
|
|
364
|
-
sourceHashDefinition = null,
|
|
365
|
-
} = {}) {
|
|
366
|
-
if (!crosswalkRow) {
|
|
367
|
-
return {
|
|
368
|
-
action: 'create',
|
|
369
|
-
reason: 'no_crosswalk_link',
|
|
370
|
-
targetId: null,
|
|
371
|
-
targetRevision: null,
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
const targetId = crosswalkRow.targetId || null;
|
|
375
|
-
const targetRevision = crosswalkRow.targetRevision || null;
|
|
376
|
-
const base = { targetId, targetRevision };
|
|
377
|
-
|
|
378
|
-
const baselineVersion = comparableVersion(crosswalkRow.sourceVersion);
|
|
379
|
-
const currentVersion = comparableVersion(sourceVersion);
|
|
380
|
-
const baselineField = crosswalkRow.sourceVersionField || null;
|
|
381
|
-
const baselineHash = comparableVersion(crosswalkRow.sourceHash);
|
|
382
|
-
const currentHash = comparableVersion(sourceHash);
|
|
383
|
-
|
|
384
|
-
// Changing the comparison field/hash definition invalidates that baseline until
|
|
385
|
-
// reconciled. A baseline captured from `date_modified_gmt` says nothing about a version now
|
|
386
|
-
// read from a different field.
|
|
387
|
-
if (baselineField && sourceVersionField && baselineField !== sourceVersionField) {
|
|
388
|
-
return { ...base, action: 'unknown', reason: 'version_field_changed' };
|
|
389
|
-
}
|
|
390
|
-
// The same rule applies to the hash: changing the comparison field/hash definition
|
|
391
|
-
// invalidates that baseline until reconciled. A hash computed over a different set of mapped
|
|
392
|
-
// fields is not comparable with the stored one -- without this, a redefinition falls through
|
|
393
|
-
// to `update` and quietly overwrites Wix on every rerun.
|
|
394
|
-
if (crosswalkRow.sourceHashDefinition && sourceHashDefinition
|
|
395
|
-
&& crosswalkRow.sourceHashDefinition !== sourceHashDefinition) {
|
|
396
|
-
return { ...base, action: 'unknown', reason: 'hash_definition_changed' };
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
const versionComparable = baselineVersion !== null && currentVersion !== null;
|
|
400
|
-
const hashComparable = baselineHash !== null && currentHash !== null;
|
|
401
|
-
|
|
402
|
-
// A hash difference catches a change the timestamp missed (coarse or unchanged mtime), so it
|
|
403
|
-
// is checked even when the versions match.
|
|
404
|
-
if (hashComparable && baselineHash !== currentHash) {
|
|
405
|
-
if (!targetRevision) {
|
|
406
|
-
return { ...base, action: 'unknown', reason: 'no_saved_revision_for_update' };
|
|
407
|
-
}
|
|
408
|
-
return { ...base, action: 'update', reason: 'source_hash_differs' };
|
|
409
|
-
}
|
|
410
|
-
if (versionComparable && baselineVersion !== currentVersion) {
|
|
411
|
-
// A linked row with no saved revision cannot be updated safely: the write would carry no
|
|
412
|
-
// revision and therefore no conflict protection, so a merchant edit would be overwritten
|
|
413
|
-
// silently. Legacy rows written before the version pair existed land here too.
|
|
414
|
-
if (!targetRevision) {
|
|
415
|
-
return { ...base, action: 'unknown', reason: 'no_saved_revision_for_update' };
|
|
416
|
-
}
|
|
417
|
-
return { ...base, action: 'update', reason: 'source_version_differs' };
|
|
418
|
-
}
|
|
419
|
-
if (versionComparable || hashComparable) {
|
|
420
|
-
// Equality WITH adequate evidence. Wix may have changed on its own; that is not a reason to
|
|
421
|
-
// write, and not a reason to refresh the saved revision either.
|
|
422
|
-
return { ...base, action: 'skip', reason: versionComparable ? 'source_version_equal' : 'source_hash_equal' };
|
|
423
|
-
}
|
|
424
|
-
return {
|
|
425
|
-
...base,
|
|
426
|
-
action: 'unknown',
|
|
427
|
-
reason: crosswalkRow.sourceVersion === undefined && crosswalkRow.sourceHash === undefined
|
|
428
|
-
? 'no_baseline_recorded'
|
|
429
|
-
: 'source_version_unavailable',
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
// The pair advances ONLY on a confirmed write. A failed, conflicted,
|
|
434
|
-
// dry-run or skipped write leaves the previous baseline exactly where it was, so the record
|
|
435
|
-
// stays eligible for recovery instead of being recorded as applied.
|
|
436
|
-
const CONFIRMED_WRITE_OUTCOMES = new Set(['created', 'updated']);
|
|
437
|
-
|
|
438
|
-
function nextCrosswalkBaseline({
|
|
439
|
-
existingRow = null,
|
|
440
|
-
outcome = null,
|
|
441
|
-
sourceVersion = undefined,
|
|
442
|
-
sourceVersionField = null,
|
|
443
|
-
sourceHash = undefined,
|
|
444
|
-
sourceHashDefinition = null,
|
|
445
|
-
targetRevision = undefined,
|
|
446
|
-
} = {}) {
|
|
447
|
-
if (!CONFIRMED_WRITE_OUTCOMES.has(outcome)) {
|
|
448
|
-
return { advanced: false, reason: `outcome_not_confirmed:${outcome === null ? 'none' : outcome}`, row: existingRow };
|
|
449
|
-
}
|
|
450
|
-
// Consistent with validateCrosswalkRow, which hard-rejects the same shape: a version with no
|
|
451
|
-
// named field cannot be compared later, so accepting it silently would write an unusable
|
|
452
|
-
// baseline that reads as "compared and equal" on the next rerun.
|
|
453
|
-
if (sourceVersion !== undefined && !sourceVersionField) {
|
|
454
|
-
throw new Error('nextCrosswalkBaseline: sourceVersion requires sourceVersionField — an unnamed version cannot be compared on a later rerun');
|
|
455
|
-
}
|
|
456
|
-
const next = { ...(existingRow || {}) };
|
|
457
|
-
if (sourceVersion !== undefined && sourceVersionField) {
|
|
458
|
-
next.sourceVersion = sourceVersion;
|
|
459
|
-
next.sourceVersionField = sourceVersionField;
|
|
460
|
-
}
|
|
461
|
-
if (sourceHash !== undefined) {
|
|
462
|
-
next.sourceHash = sourceHash;
|
|
463
|
-
}
|
|
464
|
-
if (sourceHashDefinition) {
|
|
465
|
-
next.sourceHashDefinition = sourceHashDefinition;
|
|
466
|
-
}
|
|
467
|
-
// Preserve its exact value; do not increment it locally. An absent revision in the
|
|
468
|
-
// response is not a reason to invent one, and not a reason to drop a known-good earlier one.
|
|
469
|
-
const haveRevision = targetRevision !== undefined && targetRevision !== null && targetRevision !== '';
|
|
470
|
-
if (haveRevision) {
|
|
471
|
-
next.targetRevision = String(targetRevision);
|
|
472
|
-
}
|
|
473
|
-
// If the response lacks a revision, reconcile a readback with the expected written
|
|
474
|
-
// values before establishing a baseline. Advancing the SOURCE version while keeping the OLD
|
|
475
|
-
// revision would pair a new source state with a revision that predates the write — the saved
|
|
476
|
-
// pair would no longer describe the same write, and the next change would send a stale
|
|
477
|
-
// revision and self-conflict. An update that returns no revision is therefore not a baseline;
|
|
478
|
-
// it needs reconciliation.
|
|
479
|
-
// This applies to a FIRST write too, not only to a re-write of an already-linked record. A
|
|
480
|
-
// create whose response carried no revision leaves the pair half-formed: the source version
|
|
481
|
-
// says "this state is applied" while there is no revision to protect the next update, so the
|
|
482
|
-
// next change would be written with no concurrency guard at all. Half a pair is not a
|
|
483
|
-
// baseline.
|
|
484
|
-
if (!haveRevision) {
|
|
485
|
-
return {
|
|
486
|
-
advanced: false,
|
|
487
|
-
reason: 'confirmed_write_without_returned_revision',
|
|
488
|
-
needsReconciliation: true,
|
|
489
|
-
row: existingRow,
|
|
490
|
-
};
|
|
491
|
-
}
|
|
492
|
-
return { advanced: true, reason: outcome, row: next };
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
// `runId` and `phase` join the required set. The
|
|
496
|
-
// asymmetry this closes: validateWixRequestCaptureRow and validateDryRunCrosswalkRow already
|
|
497
|
-
// require `runId`; the durable journal -- the one artifact a reader still has a year later --
|
|
498
|
-
// was the only one that did not. Without them, "how many records did this pass import" cannot
|
|
499
|
-
// be answered from the file at all, and every per-ROW count silently reads as a per-RECORD one.
|
|
500
|
-
//
|
|
501
|
-
// This array is the single source of truth for the documented required set: the codegen skill
|
|
502
|
-
// document is checked against it by tests/orchestration/runtime-contract-test.js, so a prose
|
|
503
|
-
// list cannot drift from the validator.
|
|
504
|
-
const ATTEMPT_REQUIRED_FIELDS = [
|
|
505
|
-
'attemptId',
|
|
506
|
-
'sourceStableKey',
|
|
507
|
-
'writeSpecId',
|
|
508
|
-
'operation',
|
|
509
|
-
'targetEntityType',
|
|
510
|
-
'status',
|
|
511
|
-
'runId',
|
|
512
|
-
'phase',
|
|
513
|
-
];
|
|
514
|
-
|
|
515
|
-
// A limited pass that writes for REAL is not a sample: its rows belong in the
|
|
516
|
-
// real journal, stamped like any other pass, and `selection` is what makes its scope legible.
|
|
517
|
-
function validateAttemptSelection(row, label, errors) {
|
|
518
|
-
if (row.selection === undefined) {
|
|
519
|
-
return;
|
|
520
|
-
}
|
|
521
|
-
const selection = row.selection;
|
|
522
|
-
if (!selection || typeof selection !== 'object' || Array.isArray(selection)) {
|
|
523
|
-
errors.push(`${label}.selection must be an object`);
|
|
524
|
-
return;
|
|
525
|
-
}
|
|
526
|
-
for (const field of ['offset', 'limit']) {
|
|
527
|
-
const value = selection[field];
|
|
528
|
-
if (value === undefined || value === null) {
|
|
529
|
-
continue;
|
|
530
|
-
}
|
|
531
|
-
if (!Number.isInteger(value) || value < 0) {
|
|
532
|
-
errors.push(`${label}.selection.${field} must be a non-negative integer or null`);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
if (selection.filters !== undefined && selection.filters !== null
|
|
536
|
-
&& (typeof selection.filters !== 'object' || Array.isArray(selection.filters))) {
|
|
537
|
-
errors.push(`${label}.selection.filters must be an object`);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
// `reconcile` is the structured evidence an unknown-outcome recovery needs: the
|
|
542
|
-
// region and the ids that existed before the POST, plus any candidate ids found afterwards. Ids
|
|
543
|
-
// live here as fields, never only inside `failure.message`.
|
|
544
|
-
function validateAttemptReconcile(row, label, errors) {
|
|
545
|
-
if (row.reconcile === undefined) {
|
|
546
|
-
return;
|
|
547
|
-
}
|
|
548
|
-
const reconcile = row.reconcile;
|
|
549
|
-
if (!reconcile || typeof reconcile !== 'object' || Array.isArray(reconcile)) {
|
|
550
|
-
errors.push(`${label}.reconcile must be an object`);
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
if (reconcile.deliveryRegionId !== undefined && (typeof reconcile.deliveryRegionId !== 'string' || !reconcile.deliveryRegionId)) {
|
|
554
|
-
errors.push(`${label}.reconcile.deliveryRegionId must be a non-empty string when present`);
|
|
555
|
-
}
|
|
556
|
-
for (const field of ['preWriteTargetIds', 'candidateTargetIds']) {
|
|
557
|
-
const value = reconcile[field];
|
|
558
|
-
if (value !== undefined && (!Array.isArray(value) || value.some((id) => typeof id !== 'string' || !id))) {
|
|
559
|
-
errors.push(`${label}.reconcile.${field} must be an array of non-empty strings when present`);
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
// A failure keeps its identifying facts as FIELDS; only the human sentence is
|
|
565
|
-
// ever shortened.
|
|
566
|
-
function validateAttemptFailure(row, label, errors) {
|
|
567
|
-
const required = FAILURE_REQUIRED_STATUSES.has(row.status);
|
|
568
|
-
if (row.failure === undefined || row.failure === null) {
|
|
569
|
-
if (required) {
|
|
570
|
-
errors.push(`${label}.failure is required when status is ${row.status} — a truncated sentence is not a record of what failed`);
|
|
571
|
-
}
|
|
572
|
-
return;
|
|
573
|
-
}
|
|
574
|
-
const failure = row.failure;
|
|
575
|
-
const failureLabel = `${label}.failure`;
|
|
576
|
-
if (typeof failure !== 'object' || Array.isArray(failure)) {
|
|
577
|
-
errors.push(`${failureLabel} must be an object`);
|
|
578
|
-
return;
|
|
579
|
-
}
|
|
580
|
-
for (const field of ['sourceId', 'operation']) {
|
|
581
|
-
requireString(failure, field, failureLabel, errors);
|
|
582
|
-
}
|
|
583
|
-
if (typeof failure.message !== 'string') {
|
|
584
|
-
errors.push(`${failureLabel}.message must be a string`);
|
|
585
|
-
}
|
|
586
|
-
if (!FAILURE_OUTCOMES.has(failure.outcome)) {
|
|
587
|
-
errors.push(`${failureLabel}.outcome must be one of: ${Array.from(FAILURE_OUTCOMES).join(', ')}`);
|
|
588
|
-
}
|
|
589
|
-
if (failure.reason !== undefined && !PRODUCT_MEDIA_FAILURE_REASONS.has(failure.reason)) {
|
|
590
|
-
errors.push(`${failureLabel}.reason must be one of: ${Array.from(PRODUCT_MEDIA_FAILURE_REASONS).join(', ')}`);
|
|
591
|
-
}
|
|
592
|
-
const expectedOutcome = FAILURE_OUTCOME_FOR_STATUS[row.status];
|
|
593
|
-
if (expectedOutcome && failure.outcome && failure.outcome !== expectedOutcome) {
|
|
594
|
-
errors.push(`${failureLabel}.outcome must be ${expectedOutcome} when status is ${row.status}`);
|
|
595
|
-
}
|
|
596
|
-
// Present-and-nullable: the KEY must exist, so "we looked and the request named none" is
|
|
597
|
-
// distinguishable from "nobody extracted it". targetEntityId is the field the run lost inside
|
|
598
|
-
// a 300-character slice, so its absence is an error rather than a default.
|
|
599
|
-
for (const field of ['targetEntityId', 'errorCode', 'scopeGroupName']) {
|
|
600
|
-
if (!(field in failure)) {
|
|
601
|
-
errors.push(`${failureLabel}.${field} must be present (string or null)`);
|
|
602
|
-
} else if (failure[field] !== null && typeof failure[field] !== 'string') {
|
|
603
|
-
errors.push(`${failureLabel}.${field} must be a string or null`);
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
if (!('httpStatus' in failure)) {
|
|
607
|
-
errors.push(`${failureLabel}.httpStatus must be present (integer or null)`);
|
|
608
|
-
} else if (failure.httpStatus !== null && !Number.isInteger(failure.httpStatus)) {
|
|
609
|
-
errors.push(`${failureLabel}.httpStatus must be an integer or null`);
|
|
610
|
-
}
|
|
611
|
-
assertNoIdentifierOnlyInMessage(row, failureLabel, errors);
|
|
612
|
-
}
|
|
613
|
-
|
|
614
|
-
// The truncation rule, stated as a rule because it IS the defect: no identifier may
|
|
615
|
-
// exist only inside `failure.message`. Implementations extract the identifying fields from the
|
|
616
|
-
// error BEFORE shortening the message, never after — so a GUID that the message carries and no
|
|
617
|
-
// structured field repeats means the extraction was skipped and the evidence is one truncation
|
|
618
|
-
// away from being gone.
|
|
619
|
-
//
|
|
620
|
-
// this rule is about `failure.message` specifically,
|
|
621
|
-
// not about every field on the row -- `failure.originalMessage` (see `tolerateIdentifierOnlyMessage`
|
|
622
|
-
// below) is a DELIBERATE exception, not a gap in this check. It preserves the raw pre-redaction
|
|
623
|
-
// text for a human/later diagnosis pass in the ambiguous/foreign-reference case where
|
|
624
|
-
// `targetEntityId` is intentionally left unguessed (a wrong guess there is worse than none) -- it
|
|
625
|
-
// is not itself a structured, machine-actionable identifier field, so an identifier that exists
|
|
626
|
-
// ONLY in `originalMessage` still counts as "only in message-shaped text" for this rule's
|
|
627
|
-
// purpose, same as `failure.message` itself, and must be excluded from "elsewhere" below.
|
|
628
|
-
// (`originalMessage` is always the pre-redaction copy of `message`, so leaving it in "elsewhere"
|
|
629
|
-
// would also let it trivially self-corroborate -- the same text checked against itself is not
|
|
630
|
-
// independent evidence in a different field.) `assertNoIdentifierOnlyInMessage` is intentionally
|
|
631
|
-
// never called against `originalMessage` itself: this rule fires on the CURRENT `message`, and a
|
|
632
|
-
// redacted `message` (replaced with `<redacted-id>`) no longer carries a raw GUID to flag --
|
|
633
|
-
// exactly the truncation rule being satisfied, not bypassed, since the identifier no longer sits
|
|
634
|
-
// only in message-shaped text once it has been removed from `message` and structured extraction
|
|
635
|
-
// was attempted (`targetEntityId`, when unambiguous) or deliberately declined with the reason
|
|
636
|
-
// recorded (the foreign-reference/ambiguous comment above).
|
|
637
|
-
function assertNoIdentifierOnlyInMessage(row, failureLabel, errors) {
|
|
638
|
-
const message = typeof row.failure.message === 'string' ? row.failure.message : '';
|
|
639
|
-
const found = message.match(GUID_IN_TEXT);
|
|
640
|
-
if (!found) {
|
|
641
|
-
return;
|
|
642
|
-
}
|
|
643
|
-
const elsewhere = JSON.stringify({ ...row, failure: { ...row.failure, message: '', originalMessage: '' } }).toLowerCase();
|
|
644
|
-
for (const guid of new Set(found.map((value) => value.toLowerCase()))) {
|
|
645
|
-
if (!elsewhere.includes(guid)) {
|
|
646
|
-
errors.push(`${failureLabel}.message carries identifier ${guid} that appears in no other field — extract identifying facts into fields before truncating the message`);
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
function validateAttemptRow(row, { allowThrow = true, label = 'attempt row' } = {}) {
|
|
652
|
-
const errors = [];
|
|
653
|
-
try {
|
|
654
|
-
assertObject(row, label);
|
|
655
|
-
} catch (error) {
|
|
656
|
-
if (allowThrow) {
|
|
657
|
-
throw error;
|
|
658
|
-
}
|
|
659
|
-
return { ok: false, errors: [error.message] };
|
|
660
|
-
}
|
|
661
|
-
if (row.siteId !== undefined && (typeof row.siteId !== 'string' || !row.siteId)) errors.push(`${label}.siteId must be a nonempty string`);
|
|
662
|
-
if (row.schemaVersion !== SCHEMA_VERSION) {
|
|
663
|
-
errors.push(`${label}.schemaVersion must be ${SCHEMA_VERSION}`);
|
|
664
|
-
}
|
|
665
|
-
for (const field of ATTEMPT_REQUIRED_FIELDS) {
|
|
666
|
-
requireString(row, field, label, errors);
|
|
667
|
-
}
|
|
668
|
-
if (row.status && !ATTEMPT_STATUS.has(row.status)) {
|
|
669
|
-
errors.push(`${label}.status must be one of: ${Array.from(ATTEMPT_STATUS).join(', ')}`);
|
|
670
|
-
}
|
|
671
|
-
if (row.deferral !== undefined && (row.status !== 'deferred' || !row.deferral || typeof row.deferral.reason !== 'string')) errors.push(`${label}.deferral invalid`);
|
|
672
|
-
validateAttemptSelection(row, label, errors);
|
|
673
|
-
validateAttemptFailure(row, label, errors);
|
|
674
|
-
validateAttemptReconcile(row, label, errors);
|
|
675
|
-
if (row.blockedDataSnapshot !== undefined) {
|
|
676
|
-
const snapshot = row.blockedDataSnapshot;
|
|
677
|
-
if (!snapshot || typeof snapshot !== 'object' || Array.isArray(snapshot)) {
|
|
678
|
-
errors.push(`${label}.blockedDataSnapshot must be an object`);
|
|
679
|
-
} else {
|
|
680
|
-
for (const field of ['sourceEntityRef', 'extractedAt', 'checksum']) requireString(snapshot, field, `${label}.blockedDataSnapshot`, errors);
|
|
681
|
-
if (!Number.isInteger(snapshot.snapshotVersion) || snapshot.snapshotVersion < 1) {
|
|
682
|
-
errors.push(`${label}.blockedDataSnapshot.snapshotVersion must be a positive integer`);
|
|
683
|
-
}
|
|
684
|
-
if (snapshot.extractedAt !== undefined && Number.isNaN(Date.parse(snapshot.extractedAt))) {
|
|
685
|
-
errors.push(`${label}.blockedDataSnapshot.extractedAt must be an ISO timestamp`);
|
|
686
|
-
}
|
|
687
|
-
if (snapshot.checksum !== undefined && !/^sha256:[a-f0-9]{64}$/.test(snapshot.checksum)) {
|
|
688
|
-
errors.push(`${label}.blockedDataSnapshot.checksum must be a sha256 digest`);
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
if (errors.length && allowThrow) {
|
|
693
|
-
throw new Error(errors.join('; '));
|
|
694
|
-
}
|
|
695
|
-
return { ok: errors.length === 0, errors };
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
// assertNoIdentifierOnlyInMessage above
|
|
699
|
-
// is deliberate and correct: an identifier that exists ONLY inside `failure.message` really is
|
|
700
|
-
// undocumented evidence on that row, and this function must never weaken that guard. But
|
|
701
|
-
// `wix.send()` (rp-target-wix/lib/wix-writers.js) embeds the full request URL and up to 400 raw
|
|
702
|
-
// response characters into `error.message`, so a genuine Wix API error can legitimately echo
|
|
703
|
-
// back some entity's GUID that the caller never thought to extract into a structured field --
|
|
704
|
-
// and a validator rejection at write time must never crash the whole import run over message
|
|
705
|
-
// phrasing. In the incident, a project's own catch-all recovery path then tried to log a SECOND
|
|
706
|
-
// attempt row built from the validation error's own message -- which still carried the same
|
|
707
|
-
// GUID -- and THAT rejection was uncaught, which is what actually took the run down.
|
|
708
|
-
//
|
|
709
|
-
// The fix, ported from that project's local `recordAttemptGuarded` wrapper into the one place
|
|
710
|
-
// every generated importer already goes through: on exactly this rejection, extract the GUID
|
|
711
|
-
// into a real structured field when that's unambiguous, and EITHER WAY keep the original message
|
|
712
|
-
// on the row (never just delete it) before retrying once. A row that is broken for any OTHER
|
|
713
|
-
// reason -- the GUID is embedded a second way with no single unambiguous target, or unrelated
|
|
714
|
-
// fields are missing/invalid -- still throws, from the retry's own validateAttemptRow call, so a
|
|
715
|
-
// genuinely different caller bug is never silently swallowed.
|
|
716
|
-
//
|
|
717
|
-
// Two failure modes this must not reintroduce, both found in review after the redact-only version
|
|
718
|
-
// shipped: (1) redacting `failure.message` in place and discarding the original text loses the
|
|
719
|
-
// only surviving evidence of what the identifier actually was, with nothing on the row saying a
|
|
720
|
-
// redaction even happened -- exactly the truncation-without-extraction defect
|
|
721
|
-
// assertNoIdentifierOnlyInMessage exists to catch, just moved one step later. (2) this must run on
|
|
722
|
-
// READ as well as write: a row already on disk before this function existed (or written by some
|
|
723
|
-
// other path) fails the same validator on every future `loadAttemptJournal` call, which
|
|
724
|
-
// `markAttempt` depends on to find the row it is patching -- one bad historical row would
|
|
725
|
-
// otherwise wedge every future read of an append-only journal that is never rewritten or trimmed.
|
|
726
|
-
function tolerateIdentifierOnlyMessage(row) {
|
|
727
|
-
const validation = validateAttemptRow(row, { allowThrow: false });
|
|
728
|
-
if (validation.ok) {
|
|
729
|
-
return { ok: true, row };
|
|
730
|
-
}
|
|
731
|
-
const carriesUnredactedIdentifier = row && row.failure && typeof row.failure.message === 'string'
|
|
732
|
-
&& validation.errors.some((error) => error.includes('appears in no other field'));
|
|
733
|
-
if (!carriesUnredactedIdentifier) {
|
|
734
|
-
return { ok: false, errors: validation.errors };
|
|
735
|
-
}
|
|
736
|
-
const originalMessage = row.failure.message;
|
|
737
|
-
const found = originalMessage.match(GUID_IN_TEXT) || [];
|
|
738
|
-
const distinctGuids = Array.from(new Set(found.map((value) => value.toLowerCase())));
|
|
739
|
-
const patchedFailure = { ...row.failure };
|
|
740
|
-
// Prefer real structured extraction over redact-and-hide: if targetEntityId is explicitly null
|
|
741
|
-
// (present, "we looked and there was none yet") and the message names exactly one candidate
|
|
742
|
-
// GUID, that GUID is almost certainly the record the message is about -- put it where
|
|
743
|
-
// assertNoIdentifierOnlyInMessage always wanted it. Two or more distinct GUIDs, an already-set
|
|
744
|
-
// targetEntityId naming something else, or the KEY BEING ABSENT ENTIRELY are all left alone:
|
|
745
|
-
// a missing key (as opposed to an explicit null) is its own caller bug -- "nobody populated
|
|
746
|
-
// this field at all" -- and synthesizing one from the message text would silently paper over
|
|
747
|
-
// that, not fix it; the row still throws below with the real "targetEntityId must be present"
|
|
748
|
-
// error in that case. A single GUID corroborated as a FOREIGN reference (see
|
|
749
|
-
// FOREIGN_REFERENCE_MARKER above) is left unguessed for the same reason two distinct GUIDs are:
|
|
750
|
-
// "unambiguous" here has to mean "unambiguously THIS row's own record", not merely "only one
|
|
751
|
-
// GUID appears in the text" -- a message can name exactly one GUID and still be talking about
|
|
752
|
-
// someone else's identity entirely.
|
|
753
|
-
if (
|
|
754
|
-
'targetEntityId' in patchedFailure && patchedFailure.targetEntityId === null
|
|
755
|
-
&& distinctGuids.length === 1 && !FOREIGN_REFERENCE_MARKER.test(originalMessage)
|
|
756
|
-
) {
|
|
757
|
-
patchedFailure.targetEntityId = found[0];
|
|
758
|
-
}
|
|
759
|
-
// Whichever way that went, never destroy the original text: keep it in its own field so a
|
|
760
|
-
// human or a later diagnosis pass can still see exactly what the source system said, and so
|
|
761
|
-
// `assertNoIdentifierOnlyInMessage`'s own "does this identifier appear anywhere else on the
|
|
762
|
-
// row" check (which this redaction must still satisfy) finds it there rather than nowhere.
|
|
763
|
-
patchedFailure.message = originalMessage.replace(GUID_IN_TEXT, '<redacted-id>');
|
|
764
|
-
patchedFailure.originalMessage = originalMessage;
|
|
765
|
-
const redactedRow = { ...row, failure: patchedFailure };
|
|
766
|
-
const revalidation = validateAttemptRow(redactedRow, { allowThrow: false });
|
|
767
|
-
if (!revalidation.ok) {
|
|
768
|
-
return { ok: false, errors: revalidation.errors };
|
|
769
|
-
}
|
|
770
|
-
return { ok: true, row: redactedRow };
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
function withIdentifierRedactionRetry(row) {
|
|
774
|
-
const result = tolerateIdentifierOnlyMessage(row);
|
|
775
|
-
if (!result.ok) {
|
|
776
|
-
throw new Error(result.errors.join('; '));
|
|
777
|
-
}
|
|
778
|
-
return result.row;
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
function validateSafeModeEmailReplacementRow(row, { allowThrow = true, label = 'safe-mode email replacement row' } = {}) {
|
|
782
|
-
const errors = [];
|
|
783
|
-
try {
|
|
784
|
-
assertObject(row, label);
|
|
785
|
-
} catch (error) {
|
|
786
|
-
if (allowThrow) {
|
|
787
|
-
throw error;
|
|
788
|
-
}
|
|
789
|
-
return { ok: false, errors: [error.message] };
|
|
790
|
-
}
|
|
791
|
-
if (row.siteId !== undefined && (typeof row.siteId !== 'string' || !row.siteId)) errors.push(`${label}.siteId must be a nonempty string`);
|
|
792
|
-
if (row.schemaVersion !== SCHEMA_VERSION) {
|
|
793
|
-
errors.push(`${label}.schemaVersion must be ${SCHEMA_VERSION}`);
|
|
794
|
-
}
|
|
795
|
-
for (const field of [
|
|
796
|
-
'runId',
|
|
797
|
-
'sourceSystem',
|
|
798
|
-
'sourceEntityType',
|
|
799
|
-
'sourceId',
|
|
800
|
-
'sourceStableKey',
|
|
801
|
-
'targetSystem',
|
|
802
|
-
'targetEntityType',
|
|
803
|
-
'targetId',
|
|
804
|
-
'sourceEmail',
|
|
805
|
-
'targetEmail',
|
|
806
|
-
'createdAt',
|
|
807
|
-
]) {
|
|
808
|
-
requireString(row, field, label, errors);
|
|
809
|
-
}
|
|
810
|
-
if (row.createdAt !== undefined && Number.isNaN(Date.parse(row.createdAt))) {
|
|
811
|
-
errors.push(`${label}.createdAt must be an ISO timestamp`);
|
|
812
|
-
}
|
|
813
|
-
if (errors.length && allowThrow) {
|
|
814
|
-
throw new Error(errors.join('; '));
|
|
815
|
-
}
|
|
816
|
-
return { ok: errors.length === 0, errors };
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
function validateSafeModeBlockedRecordRow(row, { allowThrow = true, label = 'safe-mode blocked record row' } = {}) {
|
|
820
|
-
const errors = [];
|
|
821
|
-
try {
|
|
822
|
-
assertObject(row, label);
|
|
823
|
-
} catch (error) {
|
|
824
|
-
if (allowThrow) {
|
|
825
|
-
throw error;
|
|
826
|
-
}
|
|
827
|
-
return { ok: false, errors: [error.message] };
|
|
828
|
-
}
|
|
829
|
-
if (row.siteId !== undefined && (typeof row.siteId !== 'string' || !row.siteId)) errors.push(`${label}.siteId must be a nonempty string`);
|
|
830
|
-
if (row.schemaVersion !== SCHEMA_VERSION) {
|
|
831
|
-
errors.push(`${label}.schemaVersion must be ${SCHEMA_VERSION}`);
|
|
832
|
-
}
|
|
833
|
-
for (const field of [
|
|
834
|
-
'runId',
|
|
835
|
-
'sourceSystem',
|
|
836
|
-
'sourceEntityType',
|
|
837
|
-
'sourceId',
|
|
838
|
-
'sourceStableKey',
|
|
839
|
-
'targetSystem',
|
|
840
|
-
'targetEntityType',
|
|
841
|
-
'reason',
|
|
842
|
-
'createdAt',
|
|
843
|
-
]) {
|
|
844
|
-
requireString(row, field, label, errors);
|
|
845
|
-
}
|
|
846
|
-
if (!Array.isArray(row.paths) || row.paths.some((item) => typeof item !== 'string' || !item)) {
|
|
847
|
-
errors.push(`${label}.paths must be an array of non-empty strings`);
|
|
848
|
-
}
|
|
849
|
-
if (row.reason && row.reason !== 'SAFE_MODE_SUSPICIOUS_EMAIL') {
|
|
850
|
-
errors.push(`${label}.reason must be SAFE_MODE_SUSPICIOUS_EMAIL`);
|
|
851
|
-
}
|
|
852
|
-
if (row.createdAt !== undefined && Number.isNaN(Date.parse(row.createdAt))) {
|
|
853
|
-
errors.push(`${label}.createdAt must be an ISO timestamp`);
|
|
854
|
-
}
|
|
855
|
-
if (errors.length && allowThrow) {
|
|
856
|
-
throw new Error(errors.join('; '));
|
|
857
|
-
}
|
|
858
|
-
return { ok: errors.length === 0, errors };
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
function validateWixRequestCaptureRow(row, { allowThrow = true, label = 'Wix request capture row' } = {}) {
|
|
862
|
-
const errors = [];
|
|
863
|
-
try {
|
|
864
|
-
assertObject(row, label);
|
|
865
|
-
} catch (error) {
|
|
866
|
-
if (allowThrow) {
|
|
867
|
-
throw error;
|
|
868
|
-
}
|
|
869
|
-
return { ok: false, errors: [error.message] };
|
|
870
|
-
}
|
|
871
|
-
if (row.siteId !== undefined && (typeof row.siteId !== 'string' || !row.siteId)) errors.push(`${label}.siteId must be a nonempty string`);
|
|
872
|
-
if (row.schemaVersion !== SCHEMA_VERSION) {
|
|
873
|
-
errors.push(`${label}.schemaVersion must be ${SCHEMA_VERSION}`);
|
|
874
|
-
}
|
|
875
|
-
for (const field of ['requestCaptureId', 'timestamp', 'runId', 'phase', 'method', 'endpoint', 'result']) {
|
|
876
|
-
requireString(row, field, label, errors);
|
|
877
|
-
}
|
|
878
|
-
if (row.phase && !['setup', 'import'].includes(row.phase)) {
|
|
879
|
-
errors.push(`${label}.phase must be setup or import`);
|
|
880
|
-
}
|
|
881
|
-
if (row.result && row.result !== 'dry_run_skipped_wix_call') {
|
|
882
|
-
errors.push(`${label}.result must be dry_run_skipped_wix_call`);
|
|
883
|
-
}
|
|
884
|
-
if (row.headers !== undefined && (!row.headers || typeof row.headers !== 'object' || Array.isArray(row.headers))) {
|
|
885
|
-
errors.push(`${label}.headers must be an object when present`);
|
|
886
|
-
}
|
|
887
|
-
if (row.headers && Object.prototype.hasOwnProperty.call(row.headers, 'Authorization')) {
|
|
888
|
-
errors.push(`${label}.headers must not include Authorization`);
|
|
889
|
-
}
|
|
890
|
-
if (Number.isNaN(Date.parse(row.timestamp))) {
|
|
891
|
-
errors.push(`${label}.timestamp must be an ISO timestamp`);
|
|
892
|
-
}
|
|
893
|
-
if (errors.length && allowThrow) {
|
|
894
|
-
throw new Error(errors.join('; '));
|
|
895
|
-
}
|
|
896
|
-
return { ok: errors.length === 0, errors };
|
|
897
|
-
}
|
|
898
|
-
|
|
899
|
-
function validateDryRunCrosswalkRow(row, { allowThrow = true, label = 'dry-run crosswalk row' } = {}) {
|
|
900
|
-
const errors = [];
|
|
901
|
-
try {
|
|
902
|
-
assertObject(row, label);
|
|
903
|
-
} catch (error) {
|
|
904
|
-
if (allowThrow) {
|
|
905
|
-
throw error;
|
|
906
|
-
}
|
|
907
|
-
return { ok: false, errors: [error.message] };
|
|
908
|
-
}
|
|
909
|
-
if (row.siteId !== undefined && (typeof row.siteId !== 'string' || !row.siteId)) errors.push(`${label}.siteId must be a nonempty string`);
|
|
910
|
-
if (row.schemaVersion !== SCHEMA_VERSION) {
|
|
911
|
-
errors.push(`${label}.schemaVersion must be ${SCHEMA_VERSION}`);
|
|
912
|
-
}
|
|
913
|
-
for (const field of [
|
|
914
|
-
'runId',
|
|
915
|
-
'sourceSystem',
|
|
916
|
-
'sourceEntityType',
|
|
917
|
-
'sourceId',
|
|
918
|
-
'sourceStableKey',
|
|
919
|
-
'targetSystem',
|
|
920
|
-
'targetEntityType',
|
|
921
|
-
'placeholderTargetId',
|
|
922
|
-
'operation',
|
|
923
|
-
'createdAt',
|
|
924
|
-
]) {
|
|
925
|
-
requireString(row, field, label, errors);
|
|
926
|
-
}
|
|
927
|
-
if (row.dryRun !== true) {
|
|
928
|
-
errors.push(`${label}.dryRun must be true`);
|
|
929
|
-
}
|
|
930
|
-
if (row.placeholder !== true) {
|
|
931
|
-
errors.push(`${label}.placeholder must be true`);
|
|
932
|
-
}
|
|
933
|
-
if (row.createdAt !== undefined && Number.isNaN(Date.parse(row.createdAt))) {
|
|
934
|
-
errors.push(`${label}.createdAt must be an ISO timestamp`);
|
|
935
|
-
}
|
|
936
|
-
if (errors.length && allowThrow) {
|
|
937
|
-
throw new Error(errors.join('; '));
|
|
938
|
-
}
|
|
939
|
-
return { ok: errors.length === 0, errors };
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
function indexCrosswalkRows(rows) {
|
|
943
|
-
const bySource = {};
|
|
944
|
-
const byTarget = {};
|
|
945
|
-
for (const row of rows) {
|
|
946
|
-
bySource[row.sourceStableKey] = row;
|
|
947
|
-
byTarget[row.targetId] = row;
|
|
948
|
-
}
|
|
949
|
-
return { bySource, byTarget };
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
async function loadCrosswalk(projectDir) {
|
|
953
|
-
const rows = await readNdjson(crosswalkPath(projectDir));
|
|
954
|
-
for (const row of rows) {
|
|
955
|
-
validateCrosswalkRow(row);
|
|
956
|
-
}
|
|
957
|
-
const { bySource, byTarget } = indexCrosswalkRows(rows);
|
|
958
|
-
return { rows, bySource, byTarget };
|
|
959
|
-
}
|
|
960
|
-
|
|
961
|
-
async function appendCrosswalkRow(projectDir, row) {
|
|
962
|
-
row = stampSite(projectDir, row);
|
|
963
|
-
validateCrosswalkRow(row);
|
|
964
|
-
const before = await crosswalkFileStamp(crosswalkPath(projectDir));
|
|
965
|
-
await appendNdjson(crosswalkPath(projectDir), row);
|
|
966
|
-
await notifyCrosswalkChange(projectDir, { updates: [row], remove: [], before, after: await crosswalkFileStamp(crosswalkPath(projectDir)), dryRun: false });
|
|
967
|
-
return row;
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
async function updateCrosswalkRows(projectDir, updates, { remove = [] } = {}) {
|
|
971
|
-
updates = updates.map(row => stampSite(projectDir, row));
|
|
972
|
-
// Load protected receipts once per batch, not once per crosswalk row.
|
|
973
|
-
const states = new Map();
|
|
974
|
-
const verifier = require('./write-verification');
|
|
975
|
-
for (const row of updates) {
|
|
976
|
-
validateCrosswalkRow(row);
|
|
977
|
-
if (!row.verification) continue;
|
|
978
|
-
let receipt = row.verification;
|
|
979
|
-
if (receipt.storage === 'write-verification') {
|
|
980
|
-
const ref = receipt;
|
|
981
|
-
if (!states.has(ref.siteId)) states.set(ref.siteId, await require('./write-verification-state').load(projectDir, ref.siteId));
|
|
982
|
-
const candidate = states.get(ref.siteId).rows[row.sourceStableKey];
|
|
983
|
-
if (candidate?.identityConflict) throw new Error('Revoked crosswalk verification');
|
|
984
|
-
receipt = [candidate?.receipt, candidate?.lastVerifiedReceipt].find(r => r && ref.receiptDigest === verifier.digest(r));
|
|
985
|
-
if (!receipt || ref.receiptDigest !== verifier.digest(receipt) || ref.sourceKey !== row.sourceStableKey || ref.targetId !== row.targetId || ref.siteId !== receipt?.siteId || ref.kind !== receipt?.kind) throw new Error('Invalid crosswalk verification reference');
|
|
986
|
-
}
|
|
987
|
-
if (!verifier.validReceipt(receipt, { sourceKey: row.sourceStableKey, targetId: row.targetId })) throw new Error('Invalid crosswalk verification');
|
|
988
|
-
}
|
|
989
|
-
const before = await crosswalkFileStamp(crosswalkPath(projectDir));
|
|
990
|
-
const current = await loadCrosswalk(projectDir);
|
|
991
|
-
for (const key of remove) delete current.bySource[key];
|
|
992
|
-
for (const row of updates) current.bySource[row.sourceStableKey] = row;
|
|
993
|
-
const rows = Object.values(current.bySource).sort((a, b) => a.sourceStableKey.localeCompare(b.sourceStableKey));
|
|
994
|
-
await writeTextAtomic(crosswalkPath(projectDir), rows.map(row => JSON.stringify(row)).join('\n') + (rows.length ? '\n' : ''));
|
|
995
|
-
await rebuildCrosswalkIndexes(projectDir);
|
|
996
|
-
await notifyCrosswalkChange(projectDir, { updates, remove, before, after: await crosswalkFileStamp(crosswalkPath(projectDir)), dryRun: false });
|
|
997
|
-
}
|
|
998
|
-
async function upsertCrosswalkRow(projectDir, row) {
|
|
999
|
-
await updateCrosswalkRows(projectDir, [row]);
|
|
1000
|
-
return row;
|
|
1001
|
-
}
|
|
1002
|
-
async function removeCrosswalkRow(projectDir, sourceStableKey) {
|
|
1003
|
-
await updateCrosswalkRows(projectDir, [], { remove: [sourceStableKey] });
|
|
1004
|
-
}
|
|
1005
|
-
|
|
1006
|
-
function foldAttempts(rows) {
|
|
1007
|
-
const byAttemptId = {};
|
|
1008
|
-
for (const row of rows) {
|
|
1009
|
-
byAttemptId[row.attemptId] = {
|
|
1010
|
-
...(byAttemptId[row.attemptId] || {}),
|
|
1011
|
-
...row,
|
|
1012
|
-
};
|
|
1013
|
-
}
|
|
1014
|
-
return byAttemptId;
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
// The ONLY discriminator between the real ledger and the sample one is whether
|
|
1018
|
-
// live writes occur — never whether a record limit is set. A caller passes `{ sample: true }`
|
|
1019
|
-
// for a pass that writes nothing to the merchant's store; everything else, including a limited
|
|
1020
|
-
// but real pass, lands in the real journal.
|
|
1021
|
-
function attemptJournalPathFor(projectDir, { sample = false } = {}) {
|
|
1022
|
-
return sample ? sampleAttemptJournalPath(projectDir) : attemptJournalPath(projectDir);
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
async function loadAttemptJournal(projectDir, options = {}) {
|
|
1026
|
-
const raw = await readNdjson(attemptJournalPathFor(projectDir, options));
|
|
1027
|
-
// Tolerate the identifier-only-in-message class on READ too, the same way `appendAttempt`/
|
|
1028
|
-
// `markAttempt` already tolerate it on write -- a row written before this validator existed
|
|
1029
|
-
// (or by any path other than those two) must not wedge every future read of a journal that is
|
|
1030
|
-
// never rewritten or trimmed. Any OTHER validation failure still throws, unchanged.
|
|
1031
|
-
const rows = raw.map((row) => {
|
|
1032
|
-
const result = tolerateIdentifierOnlyMessage(row);
|
|
1033
|
-
if (!result.ok) {
|
|
1034
|
-
throw new Error(result.errors.join('; '));
|
|
1035
|
-
}
|
|
1036
|
-
return result.row;
|
|
1037
|
-
});
|
|
1038
|
-
return { rows, byAttemptId: foldAttempts(rows) };
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
// Reads only the bytes appended since `offset`, validating each new row the same
|
|
1042
|
-
// way `loadAttemptJournal` does (including the identifier-only-message tolerance), so a per-flush
|
|
1043
|
-
// coverage check can stay cheap without re-parsing the whole journal every time. Scoped to the
|
|
1044
|
-
// LIVE journal only -- never the sample one; the coverage check this exists for never reads
|
|
1045
|
-
// the sample journal. Throws a typed error (`error.code`) the caller maps onto the coverage check's reasons:
|
|
1046
|
-
// `JOURNAL_MISSING` (ENOENT), `JOURNAL_READ_FAILED` (any other read failure), or `JOURNAL_INVALID`
|
|
1047
|
-
// (a complete line that is not JSON, or fails `validateAttemptRow`/its identifier-only tolerance).
|
|
1048
|
-
async function readAttemptJournalSince(projectDir, offset = 0) {
|
|
1049
|
-
const filePath = attemptJournalPath(projectDir);
|
|
1050
|
-
let stat;
|
|
1051
|
-
try {
|
|
1052
|
-
stat = await fs.stat(filePath);
|
|
1053
|
-
} catch (error) {
|
|
1054
|
-
if (error && error.code === 'ENOENT') {
|
|
1055
|
-
const err = new Error(`${filePath} does not exist`);
|
|
1056
|
-
err.code = 'JOURNAL_MISSING';
|
|
1057
|
-
throw err;
|
|
1058
|
-
}
|
|
1059
|
-
const err = new Error(error.message);
|
|
1060
|
-
err.code = 'JOURNAL_READ_FAILED';
|
|
1061
|
-
err.cause = error;
|
|
1062
|
-
throw err;
|
|
1063
|
-
}
|
|
1064
|
-
// A journal shorter than the cached offset was truncated or replaced underneath the cache: the
|
|
1065
|
-
// caller must drop whatever it folded so far and do one full read, never read a negative range.
|
|
1066
|
-
const truncated = stat.size < offset;
|
|
1067
|
-
const readFrom = truncated ? 0 : offset;
|
|
1068
|
-
const length = stat.size - readFrom;
|
|
1069
|
-
let text = '';
|
|
1070
|
-
if (length > 0) {
|
|
1071
|
-
let fh = null;
|
|
1072
|
-
try {
|
|
1073
|
-
fh = await fs.open(filePath, 'r');
|
|
1074
|
-
const buffer = Buffer.alloc(length);
|
|
1075
|
-
await fh.read(buffer, 0, length, readFrom);
|
|
1076
|
-
text = buffer.toString('utf8');
|
|
1077
|
-
} catch (error) {
|
|
1078
|
-
const err = new Error(error.message);
|
|
1079
|
-
err.code = 'JOURNAL_READ_FAILED';
|
|
1080
|
-
err.cause = error;
|
|
1081
|
-
throw err;
|
|
1082
|
-
} finally {
|
|
1083
|
-
if (fh) {
|
|
1084
|
-
await fh.close();
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
}
|
|
1088
|
-
// A partial trailing line -- the writer appended only part of the next row -- is left for the
|
|
1089
|
-
// next read and never parsed as if it were complete.
|
|
1090
|
-
const lastNewline = text.lastIndexOf('\n');
|
|
1091
|
-
const completeText = lastNewline === -1 ? '' : text.slice(0, lastNewline + 1);
|
|
1092
|
-
const nextOffset = readFrom + Buffer.byteLength(completeText, 'utf8');
|
|
1093
|
-
const rows = [];
|
|
1094
|
-
if (completeText) {
|
|
1095
|
-
for (const rawLine of completeText.split('\n')) {
|
|
1096
|
-
const line = rawLine.trim();
|
|
1097
|
-
if (!line) {
|
|
1098
|
-
continue;
|
|
1099
|
-
}
|
|
1100
|
-
let parsed;
|
|
1101
|
-
try {
|
|
1102
|
-
parsed = JSON.parse(line);
|
|
1103
|
-
} catch (error) {
|
|
1104
|
-
const err = new Error(`${filePath}: invalid NDJSON: ${error.message}`);
|
|
1105
|
-
err.code = 'JOURNAL_INVALID';
|
|
1106
|
-
err.line = line;
|
|
1107
|
-
throw err;
|
|
1108
|
-
}
|
|
1109
|
-
const result = tolerateIdentifierOnlyMessage(parsed);
|
|
1110
|
-
if (!result.ok) {
|
|
1111
|
-
const err = new Error(result.errors.join('; '));
|
|
1112
|
-
err.code = 'JOURNAL_INVALID';
|
|
1113
|
-
err.line = line;
|
|
1114
|
-
throw err;
|
|
1115
|
-
}
|
|
1116
|
-
rows.push(result.row);
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
return { rows, nextOffset, size: stat.size, truncated };
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
// Append only. `appendNdjson` (-> fs.appendFile) is the only writer, and there is no flag, env
|
|
1123
|
-
// var or mode that selects a truncating open against this path. Rotation and compaction are not
|
|
1124
|
-
// permitted: a journal is never rewritten, folded in place, or trimmed.
|
|
1125
|
-
async function appendAttempt(projectDir, row, options = {}) {
|
|
1126
|
-
row = stampSite(projectDir, row);
|
|
1127
|
-
const toWrite = withIdentifierRedactionRetry(row);
|
|
1128
|
-
await appendNdjson(attemptJournalPathFor(projectDir, options), toWrite);
|
|
1129
|
-
return toWrite;
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
// Latest row per source record, in file order. This is the fold that turns a
|
|
1133
|
-
// per-ROW file into per-RECORD counts; grouping the same rows by `runId` gives the per-PASS
|
|
1134
|
-
// counts instead. Both are derivable from the journal alone, which is the point.
|
|
1135
|
-
function foldAttemptsBySourceKey(rows) {
|
|
1136
|
-
const bySource = new Map();
|
|
1137
|
-
for (const row of rows) {
|
|
1138
|
-
if (row && row.sourceStableKey) {
|
|
1139
|
-
bySource.set(row.sourceStableKey, row);
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
return bySource;
|
|
1143
|
-
}
|
|
1144
|
-
|
|
1145
|
-
// Rebuild `execution/unresolved-writes.ndjson` from the journal. Deleting this
|
|
1146
|
-
// file loses nothing — it is a projection, never a source of truth — so it is rewritten whole
|
|
1147
|
-
// and deterministically, and rebuilding it reproduces it byte for byte.
|
|
1148
|
-
//
|
|
1149
|
-
// A `deferred` row is NOT unresolved. Its next action is "reconsider once the blocker clears",
|
|
1150
|
-
// not "read the target back", and a source-data-rule skip must never reach this queue.
|
|
1151
|
-
async function rebuildUnresolvedWrites(projectDir) {
|
|
1152
|
-
const { rows } = await loadAttemptJournal(projectDir);
|
|
1153
|
-
const latest = foldAttemptsBySourceKey(rows);
|
|
1154
|
-
const queue = [];
|
|
1155
|
-
for (const row of latest.values()) {
|
|
1156
|
-
if (!UNRESOLVED_ATTEMPT_STATUSES.has(row.status)) {
|
|
1157
|
-
continue;
|
|
1158
|
-
}
|
|
1159
|
-
queue.push({
|
|
1160
|
-
schemaVersion: SCHEMA_VERSION,
|
|
1161
|
-
sourceStableKey: row.sourceStableKey,
|
|
1162
|
-
attemptId: row.attemptId,
|
|
1163
|
-
runId: row.runId,
|
|
1164
|
-
phase: row.phase,
|
|
1165
|
-
operation: row.operation,
|
|
1166
|
-
targetEntityType: row.targetEntityType,
|
|
1167
|
-
status: row.status,
|
|
1168
|
-
nextAction: 'read_target_back',
|
|
1169
|
-
failure: row.failure === undefined ? null : row.failure,
|
|
1170
|
-
});
|
|
1171
|
-
}
|
|
1172
|
-
queue.sort((a, b) => a.sourceStableKey.localeCompare(b.sourceStableKey));
|
|
1173
|
-
const text = queue.map((row) => JSON.stringify(row)).join('\n') + (queue.length ? '\n' : '');
|
|
1174
|
-
await writeTextAtomic(unresolvedWritesPath(projectDir), text);
|
|
1175
|
-
return queue;
|
|
1176
|
-
}
|
|
1177
|
-
|
|
1178
|
-
async function loadUnresolvedWrites(projectDir) {
|
|
1179
|
-
return readNdjson(unresolvedWritesPath(projectDir));
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
async function appendSafeModeEmailReplacement(projectDir, row) {
|
|
1183
|
-
validateSafeModeEmailReplacementRow(row);
|
|
1184
|
-
await appendNdjson(safeModeEmailReplacementsPath(projectDir), row);
|
|
1185
|
-
return row;
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
async function appendSafeModeBlockedRecord(projectDir, row) {
|
|
1189
|
-
validateSafeModeBlockedRecordRow(row);
|
|
1190
|
-
await appendNdjson(safeModeBlockedRecordsPath(projectDir), row);
|
|
1191
|
-
return row;
|
|
1192
|
-
}
|
|
1193
|
-
|
|
1194
|
-
async function appendWixRequestCapture(projectDir, row) {
|
|
1195
|
-
validateWixRequestCaptureRow(row);
|
|
1196
|
-
await appendNdjson(wixRequestCapturesPath(projectDir), row);
|
|
1197
|
-
return row;
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
|
-
async function loadWixRequestCaptures(projectDir) {
|
|
1201
|
-
const rows = await readNdjson(wixRequestCapturesPath(projectDir));
|
|
1202
|
-
for (const row of rows) {
|
|
1203
|
-
validateWixRequestCaptureRow(row);
|
|
1204
|
-
}
|
|
1205
|
-
return rows;
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
async function appendDryRunCrosswalkRow(projectDir, row) {
|
|
1209
|
-
validateDryRunCrosswalkRow(row);
|
|
1210
|
-
await appendNdjson(dryRunCrosswalkPath(projectDir), row);
|
|
1211
|
-
return row;
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
async function loadDryRunCrosswalk(projectDir) {
|
|
1215
|
-
const rows = await readNdjson(dryRunCrosswalkPath(projectDir));
|
|
1216
|
-
for (const row of rows) {
|
|
1217
|
-
validateDryRunCrosswalkRow(row);
|
|
1218
|
-
}
|
|
1219
|
-
return rows;
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
function dryRunUpsertDecision({ localCrosswalkRow = null, requiresRevision = false, hasLocalRevision = false, supportsRevisionFreeRequestBuild = false } = {}) {
|
|
1223
|
-
if (localCrosswalkRow) {
|
|
1224
|
-
return {
|
|
1225
|
-
dryRun: true,
|
|
1226
|
-
decision: 'based_on_local_crosswalk',
|
|
1227
|
-
targetId: localCrosswalkRow.targetId,
|
|
1228
|
-
stateKnown: true,
|
|
1229
|
-
};
|
|
1230
|
-
}
|
|
1231
|
-
if (requiresRevision && !hasLocalRevision) {
|
|
1232
|
-
return {
|
|
1233
|
-
dryRun: true,
|
|
1234
|
-
decision: 'would_require_live_lookup',
|
|
1235
|
-
stateKnown: false,
|
|
1236
|
-
canBuildRequest: Boolean(supportsRevisionFreeRequestBuild),
|
|
1237
|
-
};
|
|
1238
|
-
}
|
|
1239
|
-
return {
|
|
1240
|
-
dryRun: true,
|
|
1241
|
-
decision: 'would_create_if_not_found',
|
|
1242
|
-
stateKnown: false,
|
|
1243
|
-
canBuildRequest: true,
|
|
1244
|
-
};
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
async function markAttempt(projectDir, attemptId, patch, options = {}) {
|
|
1248
|
-
if (!attemptId || typeof attemptId !== 'string') {
|
|
1249
|
-
throw new Error('attemptId must be a non-empty string');
|
|
1250
|
-
}
|
|
1251
|
-
assertObject(patch, 'attempt patch');
|
|
1252
|
-
const journal = await loadAttemptJournal(projectDir, options);
|
|
1253
|
-
const current = journal.byAttemptId[attemptId];
|
|
1254
|
-
if (!current) {
|
|
1255
|
-
throw new Error(`unknown attemptId: ${attemptId}`);
|
|
1256
|
-
}
|
|
1257
|
-
// The follow-on row carries the `runId` and `phase` of the run APPENDING it,
|
|
1258
|
-
// which may differ from the row it supersedes. That is the point — it is how a later pass's
|
|
1259
|
-
// confirmation of an earlier pass's write stays legible.
|
|
1260
|
-
const row = {
|
|
1261
|
-
...current,
|
|
1262
|
-
...patch,
|
|
1263
|
-
attemptId,
|
|
1264
|
-
};
|
|
1265
|
-
const toWrite = withIdentifierRedactionRetry(row);
|
|
1266
|
-
await appendNdjson(attemptJournalPathFor(projectDir, options), toWrite);
|
|
1267
|
-
return toWrite;
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
async function rebuildCrosswalkIndexes(projectDir) {
|
|
1271
|
-
const { bySource, byTarget } = await loadCrosswalk(projectDir);
|
|
1272
|
-
await writeJsonAtomic(path.join(crosswalkIndexDir(projectDir), 'by-source.json'), bySource);
|
|
1273
|
-
await writeJsonAtomic(path.join(crosswalkIndexDir(projectDir), 'by-target.json'), byTarget);
|
|
1274
|
-
return { bySource, byTarget };
|
|
1275
|
-
}
|
|
1276
|
-
|
|
1277
|
-
async function localCrosswalkStateExists(projectDir) {
|
|
1278
|
-
if (!(await pathExists(crosswalkPath(projectDir)))) {
|
|
1279
|
-
return false;
|
|
1280
|
-
}
|
|
1281
|
-
await loadCrosswalk(projectDir);
|
|
1282
|
-
return true;
|
|
1283
|
-
}
|
|
1284
|
-
|
|
1285
|
-
function newestRow(a, b) {
|
|
1286
|
-
const aTime = Date.parse(a.updatedAt);
|
|
1287
|
-
const bTime = Date.parse(b.updatedAt);
|
|
1288
|
-
if (Number.isNaN(aTime) || Number.isNaN(bTime) || aTime === bTime) {
|
|
1289
|
-
return null;
|
|
1290
|
-
}
|
|
1291
|
-
return bTime > aTime ? b : a;
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
async function seedCrosswalkFromCmsMirror(projectDir, rows) {
|
|
1295
|
-
if (!Array.isArray(rows)) {
|
|
1296
|
-
throw new Error('CMS mirror rows must be an array');
|
|
1297
|
-
}
|
|
1298
|
-
if (await localCrosswalkStateExists(projectDir)) {
|
|
1299
|
-
return { seeded: false, reason: 'local_crosswalk_exists', accepted: 0, rejected: 0, conflicts: 0 };
|
|
1300
|
-
}
|
|
1301
|
-
|
|
1302
|
-
const rejected = [];
|
|
1303
|
-
const conflicts = [];
|
|
1304
|
-
const bySource = {};
|
|
1305
|
-
|
|
1306
|
-
for (const row of rows) {
|
|
1307
|
-
const validation = validateCrosswalkRow(row, { allowThrow: false, label: 'CMS mirror row' });
|
|
1308
|
-
if (!validation.ok) {
|
|
1309
|
-
rejected.push({ row, errors: validation.errors });
|
|
1310
|
-
continue;
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
const current = bySource[row.sourceStableKey];
|
|
1314
|
-
if (!current) {
|
|
1315
|
-
bySource[row.sourceStableKey] = row;
|
|
1316
|
-
continue;
|
|
1317
|
-
}
|
|
1318
|
-
|
|
1319
|
-
const winner = newestRow(current, row);
|
|
1320
|
-
if (!winner) {
|
|
1321
|
-
if (current.targetId !== row.targetId) {
|
|
1322
|
-
conflicts.push(current, row);
|
|
1323
|
-
}
|
|
1324
|
-
continue;
|
|
1325
|
-
}
|
|
1326
|
-
bySource[row.sourceStableKey] = winner;
|
|
1327
|
-
}
|
|
1328
|
-
|
|
1329
|
-
await mkdirp(cmsMirrorDir(projectDir));
|
|
1330
|
-
await writeTextAtomic(
|
|
1331
|
-
path.join(cmsMirrorDir(projectDir), 'imported-from-cms.ndjson'),
|
|
1332
|
-
rows.map((row) => JSON.stringify(row)).join('\n') + (rows.length ? '\n' : ''),
|
|
1333
|
-
);
|
|
1334
|
-
if (rejected.length) {
|
|
1335
|
-
await writeTextAtomic(
|
|
1336
|
-
path.join(cmsMirrorDir(projectDir), 'rejected.ndjson'),
|
|
1337
|
-
rejected.map((item) => JSON.stringify(item)).join('\n') + '\n',
|
|
1338
|
-
);
|
|
1339
|
-
}
|
|
1340
|
-
if (conflicts.length) {
|
|
1341
|
-
await writeTextAtomic(
|
|
1342
|
-
path.join(cmsMirrorDir(projectDir), 'conflicts.ndjson'),
|
|
1343
|
-
conflicts.map((row) => JSON.stringify(row)).join('\n') + '\n',
|
|
1344
|
-
);
|
|
1345
|
-
throw new Error(`CMS mirror seed has ${conflicts.length} conflicting rows; see state/cms-mirror/conflicts.ndjson`);
|
|
1346
|
-
}
|
|
1347
|
-
|
|
1348
|
-
const acceptedRows = Object.values(bySource).sort((a, b) => a.sourceStableKey.localeCompare(b.sourceStableKey));
|
|
1349
|
-
const text = acceptedRows.map((row) => JSON.stringify(row)).join('\n');
|
|
1350
|
-
await writeTextAtomic(crosswalkPath(projectDir), text ? `${text}\n` : '');
|
|
1351
|
-
await rebuildCrosswalkIndexes(projectDir);
|
|
1352
|
-
return { seeded: true, accepted: acceptedRows.length, rejected: rejected.length, conflicts: 0 };
|
|
1353
|
-
}
|
|
1354
|
-
|
|
1355
|
-
// The READ side of the crosswalk, and the single place a ledger row becomes
|
|
1356
|
-
// CMS-mirror item input. It lives here, once, rather than being re-derived inside every
|
|
1357
|
-
// generated project, because that is the seam that makes the mirror's item shape enforceable
|
|
1358
|
-
// instead of advisory.
|
|
1359
|
-
//
|
|
1360
|
-
// It is NOT a pass-through, and handing a raw ledger row to `buildImportCrosswalkItem` is a bug,
|
|
1361
|
-
// not a shortcut: the ledger names the fields `sourceEntityType`/`targetEntityType`, while
|
|
1362
|
-
// `buildImportCrosswalkItem` requires `entityType`/`targetType` and throws
|
|
1363
|
-
// 'buildImportCrosswalkItem: entityType and sourceId are required' without the first of them.
|
|
1364
|
-
//
|
|
1365
|
-
// It deliberately composes NO id. The mirror item id is `buildImportCrosswalkItem`'s own
|
|
1366
|
-
// `sourceStableKey`, with no project or source-instance prefix -- see the KNOWN, UNRESOLVED
|
|
1367
|
-
// LIMITATION comment on `buildImportCrosswalkItem` in rp-target-wix/lib/wix-writers.js. That cross-project collision is left open on purpose; it needs an approved identity/schema
|
|
1368
|
-
// decision of its own, not a prefix invented inside a writer or a projection.
|
|
1369
|
-
//
|
|
1370
|
-
// Layering: this module must not require rp-target-wix, so it returns the INPUTS
|
|
1371
|
-
// `buildImportCrosswalkItem` takes, and the caller does the build.
|
|
1372
|
-
function crosswalkRowsToMirrorItemInputs(rows) {
|
|
1373
|
-
if (!Array.isArray(rows)) {
|
|
1374
|
-
throw new Error('crosswalkRowsToMirrorItemInputs: rows must be an array of crosswalk rows');
|
|
1375
|
-
}
|
|
1376
|
-
return rows.map((row, i) => {
|
|
1377
|
-
assertObject(row, `crosswalk row ${i}`);
|
|
1378
|
-
return {
|
|
1379
|
-
entityType: row.sourceEntityType,
|
|
1380
|
-
sourceId: row.sourceId,
|
|
1381
|
-
sourceStableKey: row.sourceStableKey,
|
|
1382
|
-
targetId: row.targetId,
|
|
1383
|
-
targetType: row.targetEntityType,
|
|
1384
|
-
updatedAt: row.updatedAt,
|
|
1385
|
-
};
|
|
1386
|
-
});
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
async function withStateLock(projectDir, fn, { script } = {}) {
|
|
1390
|
-
const lockPath = path.join(stateDir(projectDir), '.lock');
|
|
1391
|
-
await mkdirp(lockPath);
|
|
1392
|
-
const host = Buffer.from(require('node:os').hostname()).toString('base64url');
|
|
1393
|
-
// Unique claim files avoid deleting/replacing a directory another runner just acquired.
|
|
1394
|
-
// Publish the claim before scanning. Concurrent entrants see each other and at least
|
|
1395
|
-
// one backs off; a process that starts later always sees the active owner's claim.
|
|
1396
|
-
const claim = `${host}.${process.pid}.${require('node:crypto').randomUUID()}.owner`;
|
|
1397
|
-
const claimPath = path.join(lockPath, claim);
|
|
1398
|
-
// the claim used to carry only pid/host/acquiredAt, with no
|
|
1399
|
-
// record of WHICH script/writer acquired it. execution-health-check.js's hasLiveLocalProcess
|
|
1400
|
-
// trusted ANY live claim in the project as proof that the specific `--script` it was asked
|
|
1401
|
-
// about was alive -- a genuinely crashed run-import.js could be reported healthy merely because
|
|
1402
|
-
// an unrelated concurrent writer (e.g. run-extract.js) held its own live claim in the same
|
|
1403
|
-
// project. An explicit `script` identifies the claim; a caller that already knows its own
|
|
1404
|
-
// identity may pass it, and every current caller (product-import.js, contact-import.js) is
|
|
1405
|
-
// itself invoked from whichever file node is actually running as a script -- `process.argv[1]`
|
|
1406
|
-
// -- so that is the correct default with no call-site changes required.
|
|
1407
|
-
const scriptId = script || process.argv[1] || null;
|
|
1408
|
-
await fs.writeFile(claimPath, JSON.stringify({ pid: process.pid, host, acquiredAt: new Date().toISOString(), script: scriptId }), { flag: 'wx', mode: 0o600 });
|
|
1409
|
-
try {
|
|
1410
|
-
for (const entry of await fs.readdir(lockPath)) {
|
|
1411
|
-
if (entry === claim) continue;
|
|
1412
|
-
const match = /^([^.]+)\.(\d+)\.[a-f0-9-]+\.owner$/.exec(entry);
|
|
1413
|
-
if (!match || match[1] !== host) throw new Error(`state lock owner cannot be checked locally: ${path.join(lockPath, entry)}; confirm that importer is stopped before removing its claim`);
|
|
1414
|
-
// `kill(2)` errors are EINVAL/EPERM/ESRCH only -- never ENOENT -- so the shared
|
|
1415
|
-
// `isProcessAlive` correctly folds every other-than-EPERM error into "dead" here.
|
|
1416
|
-
if (!isProcessAlive(Number(match[2]))) { await fs.rm(path.join(lockPath, entry), { force: true }); continue; }
|
|
1417
|
-
throw new Error(`state lock already held by PID ${match[2]}: ${lockPath}`);
|
|
1418
|
-
}
|
|
1419
|
-
return await fn();
|
|
1420
|
-
} finally {
|
|
1421
|
-
await fs.rm(claimPath, { force: true });
|
|
1422
|
-
// Keep the empty container: its existence is not ownership. SIGKILL leaves only
|
|
1423
|
-
// this process's uniquely named claim, which the next local process can reclaim.
|
|
1424
|
-
}
|
|
1425
|
-
}
|
|
1426
|
-
|
|
1427
|
-
module.exports = {
|
|
1428
|
-
onCrosswalkChange,
|
|
1429
|
-
SCHEMA_VERSION,
|
|
1430
|
-
stateDir,
|
|
1431
|
-
crosswalkPath,
|
|
1432
|
-
attemptJournalPath,
|
|
1433
|
-
sampleStateDir,
|
|
1434
|
-
sampleAttemptJournalPath,
|
|
1435
|
-
unresolvedWritesPath,
|
|
1436
|
-
ATTEMPT_STATUS,
|
|
1437
|
-
ATTEMPT_REQUIRED_FIELDS,
|
|
1438
|
-
UNRESOLVED_ATTEMPT_STATUSES,
|
|
1439
|
-
FAILURE_REQUIRED_STATUSES,
|
|
1440
|
-
foldAttemptsBySourceKey,
|
|
1441
|
-
rebuildUnresolvedWrites,
|
|
1442
|
-
loadUnresolvedWrites,
|
|
1443
|
-
wixRequestCapturesPath,
|
|
1444
|
-
cmsMirrorDir,
|
|
1445
|
-
safeModeDir,
|
|
1446
|
-
safeModeEmailReplacementsPath,
|
|
1447
|
-
safeModeBlockedRecordsPath,
|
|
1448
|
-
dryRunCrosswalkPath,
|
|
1449
|
-
loadCrosswalk,
|
|
1450
|
-
appendCrosswalkRow,
|
|
1451
|
-
upsertCrosswalkRow,
|
|
1452
|
-
updateCrosswalkRows,
|
|
1453
|
-
removeCrosswalkRow,
|
|
1454
|
-
loadAttemptJournal,
|
|
1455
|
-
readAttemptJournalSince,
|
|
1456
|
-
appendAttempt,
|
|
1457
|
-
validateCrosswalkRow,
|
|
1458
|
-
validateAttemptRow,
|
|
1459
|
-
appendSafeModeEmailReplacement,
|
|
1460
|
-
appendSafeModeBlockedRecord,
|
|
1461
|
-
appendWixRequestCapture,
|
|
1462
|
-
loadWixRequestCaptures,
|
|
1463
|
-
appendDryRunCrosswalkRow,
|
|
1464
|
-
loadDryRunCrosswalk,
|
|
1465
|
-
dryRunUpsertDecision,
|
|
1466
|
-
RERUN_ACTIONS,
|
|
1467
|
-
rerunDecision,
|
|
1468
|
-
CONFIRMED_WRITE_OUTCOMES,
|
|
1469
|
-
nextCrosswalkBaseline,
|
|
1470
|
-
validateSafeModeEmailReplacementRow,
|
|
1471
|
-
validateSafeModeBlockedRecordRow,
|
|
1472
|
-
validateWixRequestCaptureRow,
|
|
1473
|
-
validateDryRunCrosswalkRow,
|
|
1474
|
-
markAttempt,
|
|
1475
|
-
rebuildCrosswalkIndexes,
|
|
1476
|
-
localCrosswalkStateExists,
|
|
1477
|
-
seedCrosswalkFromCmsMirror,
|
|
1478
|
-
crosswalkRowsToMirrorItemInputs,
|
|
1479
|
-
withStateLock,
|
|
1480
|
-
isProcessAlive,
|
|
1481
|
-
};
|