@contractspec/example.marketplace 1.56.1 → 1.58.0
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/dist/browser/docs/index.js +103 -0
- package/dist/browser/docs/marketplace.docblock.js +103 -0
- package/dist/browser/entities/index.js +721 -0
- package/dist/browser/entities/order.js +167 -0
- package/dist/browser/entities/payout.js +142 -0
- package/dist/browser/entities/product.js +152 -0
- package/dist/browser/entities/review.js +129 -0
- package/dist/browser/entities/store.js +97 -0
- package/dist/browser/example.js +42 -0
- package/dist/browser/handlers/index.js +303 -0
- package/dist/browser/handlers/marketplace.handlers.js +303 -0
- package/dist/browser/index.js +2016 -0
- package/dist/browser/marketplace.capability.js +40 -0
- package/dist/browser/marketplace.feature.js +137 -0
- package/dist/browser/order/index.js +307 -0
- package/dist/browser/order/order.enum.js +17 -0
- package/dist/browser/order/order.event.js +131 -0
- package/dist/browser/order/order.operations.js +172 -0
- package/dist/browser/order/order.presentation.js +153 -0
- package/dist/browser/order/order.schema.js +79 -0
- package/dist/browser/payout/index.js +152 -0
- package/dist/browser/payout/payout.enum.js +12 -0
- package/dist/browser/payout/payout.event.js +55 -0
- package/dist/browser/payout/payout.operations.js +94 -0
- package/dist/browser/payout/payout.presentation.js +111 -0
- package/dist/browser/payout/payout.schema.js +61 -0
- package/dist/browser/product/index.js +249 -0
- package/dist/browser/product/product.enum.js +13 -0
- package/dist/browser/product/product.event.js +74 -0
- package/dist/browser/product/product.operations.js +171 -0
- package/dist/browser/product/product.presentation.js +158 -0
- package/dist/browser/product/product.schema.js +84 -0
- package/dist/browser/review/index.js +206 -0
- package/dist/browser/review/review.enum.js +11 -0
- package/dist/browser/review/review.event.js +50 -0
- package/dist/browser/review/review.operations.js +152 -0
- package/dist/browser/review/review.presentation.js +123 -0
- package/dist/browser/review/review.schema.js +74 -0
- package/dist/browser/seeders/index.js +12 -0
- package/dist/browser/store/index.js +142 -0
- package/dist/browser/store/store.enum.js +11 -0
- package/dist/browser/store/store.event.js +52 -0
- package/dist/browser/store/store.operations.js +88 -0
- package/dist/browser/store/store.presentation.js +94 -0
- package/dist/browser/store/store.schema.js +43 -0
- package/dist/browser/tests/operations.test-spec.js +139 -0
- package/dist/browser/ui/MarketplaceDashboard.js +418 -0
- package/dist/browser/ui/hooks/index.js +59 -0
- package/dist/browser/ui/hooks/useMarketplaceData.js +56 -0
- package/dist/browser/ui/index.js +668 -0
- package/dist/browser/ui/renderers/index.js +248 -0
- package/dist/browser/ui/renderers/marketplace.markdown.js +248 -0
- package/dist/docs/index.d.ts +2 -1
- package/dist/docs/index.d.ts.map +1 -0
- package/dist/docs/index.js +104 -1
- package/dist/docs/marketplace.docblock.d.ts +2 -1
- package/dist/docs/marketplace.docblock.d.ts.map +1 -0
- package/dist/docs/marketplace.docblock.js +46 -57
- package/dist/entities/index.d.ts +302 -307
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +719 -43
- package/dist/entities/order.d.ts +77 -82
- package/dist/entities/order.d.ts.map +1 -1
- package/dist/entities/order.js +162 -167
- package/dist/entities/payout.d.ts +64 -69
- package/dist/entities/payout.d.ts.map +1 -1
- package/dist/entities/payout.js +137 -156
- package/dist/entities/product.d.ts +69 -74
- package/dist/entities/product.d.ts.map +1 -1
- package/dist/entities/product.js +148 -156
- package/dist/entities/review.d.ts +55 -60
- package/dist/entities/review.d.ts.map +1 -1
- package/dist/entities/review.js +124 -146
- package/dist/entities/store.d.ts +40 -45
- package/dist/entities/store.d.ts.map +1 -1
- package/dist/entities/store.js +94 -106
- package/dist/example.d.ts +2 -6
- package/dist/example.d.ts.map +1 -1
- package/dist/example.js +40 -55
- package/dist/handlers/index.d.ts +2 -2
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +304 -3
- package/dist/handlers/marketplace.handlers.d.ts +138 -138
- package/dist/handlers/marketplace.handlers.d.ts.map +1 -1
- package/dist/handlers/marketplace.handlers.js +284 -309
- package/dist/index.d.ts +13 -31
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2017 -32
- package/dist/marketplace.capability.d.ts +3 -8
- package/dist/marketplace.capability.d.ts.map +1 -1
- package/dist/marketplace.capability.js +41 -34
- package/dist/marketplace.feature.d.ts +1 -7
- package/dist/marketplace.feature.d.ts.map +1 -1
- package/dist/marketplace.feature.js +136 -313
- package/dist/node/docs/index.js +103 -0
- package/dist/node/docs/marketplace.docblock.js +103 -0
- package/dist/node/entities/index.js +721 -0
- package/dist/node/entities/order.js +167 -0
- package/dist/node/entities/payout.js +142 -0
- package/dist/node/entities/product.js +152 -0
- package/dist/node/entities/review.js +129 -0
- package/dist/node/entities/store.js +97 -0
- package/dist/node/example.js +42 -0
- package/dist/node/handlers/index.js +303 -0
- package/dist/node/handlers/marketplace.handlers.js +303 -0
- package/dist/node/index.js +2016 -0
- package/dist/node/marketplace.capability.js +40 -0
- package/dist/node/marketplace.feature.js +137 -0
- package/dist/node/order/index.js +307 -0
- package/dist/node/order/order.enum.js +17 -0
- package/dist/node/order/order.event.js +131 -0
- package/dist/node/order/order.operations.js +172 -0
- package/dist/node/order/order.presentation.js +153 -0
- package/dist/node/order/order.schema.js +79 -0
- package/dist/node/payout/index.js +152 -0
- package/dist/node/payout/payout.enum.js +12 -0
- package/dist/node/payout/payout.event.js +55 -0
- package/dist/node/payout/payout.operations.js +94 -0
- package/dist/node/payout/payout.presentation.js +111 -0
- package/dist/node/payout/payout.schema.js +61 -0
- package/dist/node/product/index.js +249 -0
- package/dist/node/product/product.enum.js +13 -0
- package/dist/node/product/product.event.js +74 -0
- package/dist/node/product/product.operations.js +171 -0
- package/dist/node/product/product.presentation.js +158 -0
- package/dist/node/product/product.schema.js +84 -0
- package/dist/node/review/index.js +206 -0
- package/dist/node/review/review.enum.js +11 -0
- package/dist/node/review/review.event.js +50 -0
- package/dist/node/review/review.operations.js +152 -0
- package/dist/node/review/review.presentation.js +123 -0
- package/dist/node/review/review.schema.js +74 -0
- package/dist/node/seeders/index.js +12 -0
- package/dist/node/store/index.js +142 -0
- package/dist/node/store/store.enum.js +11 -0
- package/dist/node/store/store.event.js +52 -0
- package/dist/node/store/store.operations.js +88 -0
- package/dist/node/store/store.presentation.js +94 -0
- package/dist/node/store/store.schema.js +43 -0
- package/dist/node/tests/operations.test-spec.js +139 -0
- package/dist/node/ui/MarketplaceDashboard.js +418 -0
- package/dist/node/ui/hooks/index.js +59 -0
- package/dist/node/ui/hooks/useMarketplaceData.js +56 -0
- package/dist/node/ui/index.js +668 -0
- package/dist/node/ui/renderers/index.js +248 -0
- package/dist/node/ui/renderers/marketplace.markdown.js +248 -0
- package/dist/order/index.d.ts +8 -5
- package/dist/order/index.d.ts.map +1 -0
- package/dist/order/index.js +307 -5
- package/dist/order/order.enum.d.ts +1 -6
- package/dist/order/order.enum.d.ts.map +1 -1
- package/dist/order/order.enum.js +16 -20
- package/dist/order/order.event.d.ts +133 -139
- package/dist/order/order.event.d.ts.map +1 -1
- package/dist/order/order.event.js +121 -205
- package/dist/order/order.operations.d.ts +291 -297
- package/dist/order/order.operations.d.ts.map +1 -1
- package/dist/order/order.operations.js +169 -115
- package/dist/order/order.presentation.d.ts +3 -8
- package/dist/order/order.presentation.d.ts.map +1 -1
- package/dist/order/order.presentation.js +149 -81
- package/dist/order/order.schema.d.ts +143 -148
- package/dist/order/order.schema.d.ts.map +1 -1
- package/dist/order/order.schema.js +75 -150
- package/dist/payout/index.d.ts +8 -5
- package/dist/payout/index.d.ts.map +1 -0
- package/dist/payout/index.js +152 -5
- package/dist/payout/payout.enum.d.ts +1 -6
- package/dist/payout/payout.enum.d.ts.map +1 -1
- package/dist/payout/payout.enum.js +11 -15
- package/dist/payout/payout.event.d.ts +54 -60
- package/dist/payout/payout.event.d.ts.map +1 -1
- package/dist/payout/payout.event.js +51 -87
- package/dist/payout/payout.operations.d.ts +82 -88
- package/dist/payout/payout.operations.d.ts.map +1 -1
- package/dist/payout/payout.operations.js +92 -50
- package/dist/payout/payout.presentation.d.ts +2 -7
- package/dist/payout/payout.presentation.d.ts.map +1 -1
- package/dist/payout/payout.presentation.js +108 -56
- package/dist/payout/payout.schema.d.ts +139 -144
- package/dist/payout/payout.schema.d.ts.map +1 -1
- package/dist/payout/payout.schema.js +58 -112
- package/dist/product/index.d.ts +8 -5
- package/dist/product/index.d.ts.map +1 -0
- package/dist/product/index.js +249 -5
- package/dist/product/product.enum.d.ts +1 -6
- package/dist/product/product.enum.d.ts.map +1 -1
- package/dist/product/product.enum.js +12 -16
- package/dist/product/product.event.d.ts +63 -69
- package/dist/product/product.event.d.ts.map +1 -1
- package/dist/product/product.event.js +68 -113
- package/dist/product/product.operations.d.ts +225 -231
- package/dist/product/product.operations.d.ts.map +1 -1
- package/dist/product/product.operations.js +168 -104
- package/dist/product/product.presentation.d.ts +3 -8
- package/dist/product/product.presentation.d.ts.map +1 -1
- package/dist/product/product.presentation.js +154 -81
- package/dist/product/product.schema.d.ts +196 -201
- package/dist/product/product.schema.d.ts.map +1 -1
- package/dist/product/product.schema.js +80 -171
- package/dist/review/index.d.ts +8 -5
- package/dist/review/index.d.ts.map +1 -0
- package/dist/review/index.js +206 -5
- package/dist/review/review.enum.d.ts +1 -6
- package/dist/review/review.enum.d.ts.map +1 -1
- package/dist/review/review.enum.js +10 -14
- package/dist/review/review.event.d.ts +46 -52
- package/dist/review/review.event.d.ts.map +1 -1
- package/dist/review/review.event.js +46 -79
- package/dist/review/review.operations.d.ts +190 -196
- package/dist/review/review.operations.d.ts.map +1 -1
- package/dist/review/review.operations.js +149 -102
- package/dist/review/review.presentation.d.ts +2 -7
- package/dist/review/review.presentation.d.ts.map +1 -1
- package/dist/review/review.presentation.js +120 -56
- package/dist/review/review.schema.d.ts +164 -169
- package/dist/review/review.schema.d.ts.map +1 -1
- package/dist/review/review.schema.js +70 -151
- package/dist/seeders/index.d.ts +4 -8
- package/dist/seeders/index.d.ts.map +1 -1
- package/dist/seeders/index.js +11 -16
- package/dist/store/index.d.ts +8 -5
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +142 -5
- package/dist/store/store.enum.d.ts +1 -6
- package/dist/store/store.enum.d.ts.map +1 -1
- package/dist/store/store.enum.js +10 -14
- package/dist/store/store.event.d.ts +42 -48
- package/dist/store/store.event.d.ts.map +1 -1
- package/dist/store/store.event.js +48 -75
- package/dist/store/store.operations.d.ts +98 -104
- package/dist/store/store.operations.d.ts.map +1 -1
- package/dist/store/store.operations.js +86 -58
- package/dist/store/store.presentation.d.ts +2 -7
- package/dist/store/store.presentation.d.ts.map +1 -1
- package/dist/store/store.presentation.js +91 -56
- package/dist/store/store.schema.d.ts +70 -75
- package/dist/store/store.schema.d.ts.map +1 -1
- package/dist/store/store.schema.js +41 -90
- package/dist/tests/operations.test-spec.d.ts +5 -10
- package/dist/tests/operations.test-spec.d.ts.map +1 -1
- package/dist/tests/operations.test-spec.js +134 -146
- package/dist/ui/MarketplaceDashboard.d.ts +1 -6
- package/dist/ui/MarketplaceDashboard.d.ts.map +1 -1
- package/dist/ui/MarketplaceDashboard.js +413 -313
- package/dist/ui/hooks/index.d.ts +2 -2
- package/dist/ui/hooks/index.d.ts.map +1 -0
- package/dist/ui/hooks/index.js +59 -4
- package/dist/ui/hooks/useMarketplaceData.d.ts +16 -20
- package/dist/ui/hooks/useMarketplaceData.d.ts.map +1 -1
- package/dist/ui/hooks/useMarketplaceData.js +53 -60
- package/dist/ui/index.d.ts +7 -6
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +668 -5
- package/dist/ui/renderers/index.d.ts +2 -2
- package/dist/ui/renderers/index.d.ts.map +1 -0
- package/dist/ui/renderers/index.js +249 -3
- package/dist/ui/renderers/marketplace.markdown.d.ts +13 -15
- package/dist/ui/renderers/marketplace.markdown.d.ts.map +1 -1
- package/dist/ui/renderers/marketplace.markdown.js +241 -236
- package/package.json +529 -110
- package/dist/docs/marketplace.docblock.js.map +0 -1
- package/dist/entities/index.js.map +0 -1
- package/dist/entities/order.js.map +0 -1
- package/dist/entities/payout.js.map +0 -1
- package/dist/entities/product.js.map +0 -1
- package/dist/entities/review.js.map +0 -1
- package/dist/entities/store.js.map +0 -1
- package/dist/example.js.map +0 -1
- package/dist/handlers/marketplace.handlers.js.map +0 -1
- package/dist/marketplace.capability.js.map +0 -1
- package/dist/marketplace.feature.js.map +0 -1
- package/dist/order/order.enum.js.map +0 -1
- package/dist/order/order.event.js.map +0 -1
- package/dist/order/order.operations.js.map +0 -1
- package/dist/order/order.presentation.js.map +0 -1
- package/dist/order/order.schema.js.map +0 -1
- package/dist/payout/payout.enum.js.map +0 -1
- package/dist/payout/payout.event.js.map +0 -1
- package/dist/payout/payout.operations.js.map +0 -1
- package/dist/payout/payout.presentation.js.map +0 -1
- package/dist/payout/payout.schema.js.map +0 -1
- package/dist/product/product.enum.js.map +0 -1
- package/dist/product/product.event.js.map +0 -1
- package/dist/product/product.operations.js.map +0 -1
- package/dist/product/product.presentation.js.map +0 -1
- package/dist/product/product.schema.js.map +0 -1
- package/dist/review/review.enum.js.map +0 -1
- package/dist/review/review.event.js.map +0 -1
- package/dist/review/review.operations.js.map +0 -1
- package/dist/review/review.presentation.js.map +0 -1
- package/dist/review/review.schema.js.map +0 -1
- package/dist/seeders/index.js.map +0 -1
- package/dist/store/store.enum.js.map +0 -1
- package/dist/store/store.event.js.map +0 -1
- package/dist/store/store.operations.js.map +0 -1
- package/dist/store/store.presentation.js.map +0 -1
- package/dist/store/store.schema.js.map +0 -1
- package/dist/tests/operations.test-spec.js.map +0 -1
- package/dist/ui/MarketplaceDashboard.js.map +0 -1
- package/dist/ui/hooks/useMarketplaceData.js.map +0 -1
- package/dist/ui/renderers/marketplace.markdown.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"marketplace.docblock.js","names":[],"sources":["../../src/docs/marketplace.docblock.ts"],"sourcesContent":["import type { DocBlock } from '@contractspec/lib.contracts/docs';\nimport { registerDocBlocks } from '@contractspec/lib.contracts/docs';\n\nconst marketplaceDocBlocks: DocBlock[] = [\n {\n id: 'docs.examples.marketplace',\n title: 'Marketplace (2-sided)',\n summary:\n 'Two-sided marketplace with stores, products, orders, payouts, and reviews. Demonstrates multi-actor flows, payments, and attachments.',\n kind: 'reference',\n visibility: 'public',\n route: '/docs/examples/marketplace',\n tags: ['marketplace', 'orders', 'payouts', 'reviews'],\n body: `## Entities\n\n- Store, Product, Order, OrderItem, Payout, Review.\n- Uses Files module for product media and receipt attachments.\n\n## Contracts\n\n- \\`marketplace.store.create\\`, \\`marketplace.product.add\\`, \\`marketplace.order.place\\`, \\`marketplace.payout.process\\`, \\`marketplace.review.submit\\`.\n- Policy guards via Identity/RBAC for provider vs client actions.\n\n## Events\n\n- order.created/completed/cancelled, payout.queued/completed, review.submitted.\n- Hooked into Notifications and Audit Trail modules.\n\n## UI / Presentations\n\n- Dashboard, product catalog, order list/detail, store management.\n- Templates registered under \\`marketplace\\` in Studio Template Registry.\n\n## Notes\n\n- Commission model encoded in spec; payouts scheduled via Jobs module.\n- Feature flags can gate beta checkout or new reviews flow.\n`,\n },\n {\n id: 'docs.examples.marketplace.goal',\n title: 'Marketplace — Goal',\n summary:\n 'Why this marketplace template exists and the outcomes it targets.',\n kind: 'goal',\n visibility: 'public',\n route: '/docs/examples/marketplace/goal',\n tags: ['marketplace', 'goal'],\n body: `## Why it matters\n- Provides a regenerable 2-sided marketplace baseline without bespoke glue.\n- Keeps payouts, catalog, orders, and reviews consistent across surfaces.\n\n## Business/Product goal\n- Safe provider/client flows with auditable payouts and moderation-ready reviews.\n- Staged rollouts for payments/reviews via feature flags; explicit commission/tax fields.\n\n## Success criteria\n- Orders/payouts regenerate cleanly after spec changes.\n- Events emit for lifecycle + audit; PII is scoped/redacted in presentations.`,\n },\n {\n id: 'docs.examples.marketplace.usage',\n title: 'Marketplace — Usage',\n summary: 'How to seed, extend, and safely regenerate the marketplace.',\n kind: 'usage',\n visibility: 'public',\n route: '/docs/examples/marketplace/usage',\n tags: ['marketplace', 'usage'],\n body: `## Setup\n1) Seed sample stores/products/orders via template registry (or create via UI).\n2) Configure Files storage for media/receipts; set policy.pii for sensitive fields.\n\n## Extend & regenerate\n1) Adjust schemas for commission/tax/payout states or review moderation in the spec.\n2) Regenerate to sync UI, API, events, notifications.\n3) Gate risky changes (new payment providers) behind Feature Flags.\n\n## Guardrails\n- Emit events for order/payout state changes; log via Audit Trail.\n- Avoid hidden commission math—keep explicit fields.\n- Redact buyer/provider PII in markdown/JSON presentations.`,\n },\n {\n id: 'docs.examples.marketplace.constraints',\n title: 'Marketplace — Constraints & Safety',\n summary:\n 'Internal guardrails for payouts, order states, and regeneration semantics.',\n kind: 'reference',\n visibility: 'internal',\n route: '/docs/examples/marketplace/constraints',\n tags: ['marketplace', 'constraints', 'internal'],\n body: `## Constraints\n- Commission logic and order states must stay spec-defined; never adjust in code-only patches.\n- Events to emit: order.created, order.completed, payout.queued, review.posted (minimum).\n- Regeneration must not change payment semantics without explicit spec diff.\n\n## Safety & PII\n- Redact buyer/provider identifiers in markdown/JSON outputs; scope payouts per tenant/org.\n- For MCP/web surfaces, avoid exposing raw payout calc inputs; use summaries.\n\n## Testing/Verification\n- Add fixtures covering order lifecycle and payout queueing.\n- Run regeneration diff when changing commission/tax fields; verify presentations updated.\n- Ensure Notifications/Audit wiring remains intact for order/payout/review events.`,\n },\n];\n\nregisterDocBlocks(marketplaceDocBlocks);\n"],"mappings":";;;AA2GA,kBAxGyC;CACvC;EACE,IAAI;EACJ,OAAO;EACP,SACE;EACF,MAAM;EACN,YAAY;EACZ,OAAO;EACP,MAAM;GAAC;GAAe;GAAU;GAAW;GAAU;EACrD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;EAyBP;CACD;EACE,IAAI;EACJ,OAAO;EACP,SACE;EACF,MAAM;EACN,YAAY;EACZ,OAAO;EACP,MAAM,CAAC,eAAe,OAAO;EAC7B,MAAM;;;;;;;;;;;EAWP;CACD;EACE,IAAI;EACJ,OAAO;EACP,SAAS;EACT,MAAM;EACN,YAAY;EACZ,OAAO;EACP,MAAM,CAAC,eAAe,QAAQ;EAC9B,MAAM;;;;;;;;;;;;;EAaP;CACD;EACE,IAAI;EACJ,OAAO;EACP,SACE;EACF,MAAM;EACN,YAAY;EACZ,OAAO;EACP,MAAM;GAAC;GAAe;GAAe;GAAW;EAChD,MAAM;;;;;;;;;;;;;EAaP;CACF,CAEsC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/entities/index.ts"],"sourcesContent":["// Store entities\nexport {\n StoreStatusEnum,\n StoreTypeEnum,\n StoreEntity,\n StoreCategoryEntity,\n} from './store';\n\n// Product entities\nexport {\n ProductStatusEnum,\n ProductTypeEnum,\n ProductEntity,\n ProductVariantEntity,\n CategoryEntity,\n} from './product';\n\n// Order entities\nexport {\n OrderStatusEnum,\n PaymentStatusEnum,\n OrderEntity,\n OrderItemEntity,\n RefundEntity,\n RefundItemEntity,\n} from './order';\n\n// Payout entities\nexport {\n PayoutStatusEnum,\n PayoutScheduleEnum,\n PayoutEntity,\n PayoutItemEntity,\n BankAccountEntity,\n PayoutSettingsEntity,\n} from './payout';\n\n// Review entities\nexport {\n ReviewStatusEnum,\n ReviewTypeEnum,\n ReviewEntity,\n ReviewResponseEntity,\n ReviewVoteEntity,\n ReviewReportEntity,\n} from './review';\n\n// Schema contribution\nimport {\n StoreStatusEnum,\n StoreTypeEnum,\n StoreEntity,\n StoreCategoryEntity,\n} from './store';\nimport {\n ProductStatusEnum,\n ProductTypeEnum,\n ProductEntity,\n ProductVariantEntity,\n CategoryEntity,\n} from './product';\nimport {\n OrderStatusEnum,\n PaymentStatusEnum,\n OrderEntity,\n OrderItemEntity,\n RefundEntity,\n RefundItemEntity,\n} from './order';\nimport {\n PayoutStatusEnum,\n PayoutScheduleEnum,\n PayoutEntity,\n PayoutItemEntity,\n BankAccountEntity,\n PayoutSettingsEntity,\n} from './payout';\nimport {\n ReviewStatusEnum,\n ReviewTypeEnum,\n ReviewEntity,\n ReviewResponseEntity,\n ReviewVoteEntity,\n ReviewReportEntity,\n} from './review';\nimport type { ModuleSchemaContribution } from '@contractspec/lib.schema';\n\nexport const marketplaceEntities = [\n // Store\n StoreEntity,\n StoreCategoryEntity,\n\n // Product\n ProductEntity,\n ProductVariantEntity,\n CategoryEntity,\n\n // Order\n OrderEntity,\n OrderItemEntity,\n RefundEntity,\n RefundItemEntity,\n\n // Payout\n PayoutEntity,\n PayoutItemEntity,\n BankAccountEntity,\n PayoutSettingsEntity,\n\n // Review\n ReviewEntity,\n ReviewResponseEntity,\n ReviewVoteEntity,\n ReviewReportEntity,\n];\n\nexport const marketplaceSchemaContribution: ModuleSchemaContribution = {\n moduleId: '@contractspec/example.marketplace',\n entities: marketplaceEntities,\n enums: [\n StoreStatusEnum,\n StoreTypeEnum,\n ProductStatusEnum,\n ProductTypeEnum,\n OrderStatusEnum,\n PaymentStatusEnum,\n PayoutStatusEnum,\n PayoutScheduleEnum,\n ReviewStatusEnum,\n ReviewTypeEnum,\n ],\n};\n"],"mappings":";;;;;;;AAuFA,MAAa,sBAAsB;CAEjC;CACA;CAGA;CACA;CACA;CAGA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACD;AAED,MAAa,gCAA0D;CACrE,UAAU;CACV,UAAU;CACV,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"order.js","names":[],"sources":["../../src/entities/order.ts"],"sourcesContent":["import {\n defineEntity,\n defineEntityEnum,\n field,\n index,\n} from '@contractspec/lib.schema';\n\n/**\n * Order status enum.\n */\nexport const OrderStatusEnum = defineEntityEnum({\n name: 'OrderStatus',\n values: [\n 'PENDING', // Order created, awaiting payment\n 'PAID', // Payment received\n 'PROCESSING', // Being prepared by seller\n 'SHIPPED', // Shipped to buyer\n 'DELIVERED', // Delivered to buyer\n 'COMPLETED', // Order finalized\n 'CANCELLED', // Cancelled by buyer or seller\n 'REFUNDED', // Full refund issued\n 'PARTIALLY_REFUNDED', // Partial refund issued\n 'DISPUTED', // In dispute\n ] as const,\n schema: 'marketplace',\n description: 'Status of an order.',\n});\n\n/**\n * Payment status enum.\n */\nexport const PaymentStatusEnum = defineEntityEnum({\n name: 'PaymentStatus',\n values: [\n 'PENDING',\n 'AUTHORIZED',\n 'CAPTURED',\n 'FAILED',\n 'REFUNDED',\n 'VOIDED',\n ] as const,\n schema: 'marketplace',\n description: 'Status of payment.',\n});\n\n/**\n * Order entity - a purchase transaction.\n */\nexport const OrderEntity = defineEntity({\n name: 'Order',\n description: 'A purchase order on the marketplace.',\n schema: 'marketplace',\n map: 'order',\n fields: {\n id: field.id({ description: 'Unique order ID' }),\n\n // Reference\n orderNumber: field.string({ description: 'Human-readable order number' }),\n\n // Parties\n buyerId: field.foreignKey({ description: 'Buyer user ID' }),\n storeId: field.foreignKey({ description: 'Seller store ID' }),\n\n // Status\n status: field.enum('OrderStatus', { default: 'PENDING' }),\n paymentStatus: field.enum('PaymentStatus', { default: 'PENDING' }),\n\n // Totals\n subtotal: field.decimal({ description: 'Sum of item prices' }),\n shippingTotal: field.decimal({ default: 0 }),\n taxTotal: field.decimal({ default: 0 }),\n discountTotal: field.decimal({ default: 0 }),\n total: field.decimal({ description: 'Final total' }),\n currency: field.string({ default: '\"USD\"' }),\n\n // Commission\n platformFee: field.decimal({ description: 'Platform commission amount' }),\n sellerPayout: field.decimal({ description: 'Amount due to seller' }),\n\n // Shipping\n shippingAddress: field.json({ isOptional: true }),\n billingAddress: field.json({ isOptional: true }),\n shippingMethod: field.string({ isOptional: true }),\n trackingNumber: field.string({ isOptional: true }),\n trackingUrl: field.string({ isOptional: true }),\n\n // Payment\n paymentMethod: field.string({ isOptional: true }),\n paymentIntentId: field.string({ isOptional: true }),\n\n // Notes\n buyerNote: field.string({ isOptional: true }),\n sellerNote: field.string({ isOptional: true }),\n internalNote: field.string({ isOptional: true }),\n\n // Timestamps\n createdAt: field.createdAt(),\n updatedAt: field.updatedAt(),\n paidAt: field.dateTime({ isOptional: true }),\n shippedAt: field.dateTime({ isOptional: true }),\n deliveredAt: field.dateTime({ isOptional: true }),\n completedAt: field.dateTime({ isOptional: true }),\n cancelledAt: field.dateTime({ isOptional: true }),\n\n // Relations\n store: field.belongsTo('Store', ['storeId'], ['id']),\n items: field.hasMany('OrderItem'),\n refunds: field.hasMany('Refund'),\n },\n indexes: [\n index.unique(['orderNumber']),\n index.on(['buyerId', 'status']),\n index.on(['storeId', 'status']),\n index.on(['status', 'createdAt']),\n index.on(['paymentStatus']),\n index.on(['createdAt']),\n ],\n enums: [OrderStatusEnum, PaymentStatusEnum],\n});\n\n/**\n * Order item entity - individual items in an order.\n */\nexport const OrderItemEntity = defineEntity({\n name: 'OrderItem',\n description: 'An item within an order.',\n schema: 'marketplace',\n map: 'order_item',\n fields: {\n id: field.id(),\n orderId: field.foreignKey(),\n productId: field.foreignKey(),\n variantId: field.string({ isOptional: true }),\n\n // Snapshot at time of purchase\n productName: field.string(),\n variantName: field.string({ isOptional: true }),\n sku: field.string({ isOptional: true }),\n\n // Pricing\n unitPrice: field.decimal(),\n quantity: field.int(),\n subtotal: field.decimal(),\n\n // Fulfillment\n quantityFulfilled: field.int({ default: 0 }),\n quantityRefunded: field.int({ default: 0 }),\n\n // Timestamps\n createdAt: field.createdAt(),\n updatedAt: field.updatedAt(),\n\n // Relations\n order: field.belongsTo('Order', ['orderId'], ['id'], {\n onDelete: 'Cascade',\n }),\n product: field.belongsTo('Product', ['productId'], ['id']),\n },\n indexes: [index.on(['orderId']), index.on(['productId'])],\n});\n\n/**\n * Refund entity - refund records for orders.\n */\nexport const RefundEntity = defineEntity({\n name: 'Refund',\n description: 'A refund for an order.',\n schema: 'marketplace',\n map: 'refund',\n fields: {\n id: field.id(),\n orderId: field.foreignKey(),\n\n // Amount\n amount: field.decimal(),\n currency: field.string(),\n\n // Reason\n reason: field.string(),\n notes: field.string({ isOptional: true }),\n\n // Status\n status: field.string({ default: '\"PENDING\"' }),\n\n // Payment\n refundId: field.string({\n isOptional: true,\n description: 'Payment provider refund ID',\n }),\n\n // Actor\n issuedBy: field.foreignKey({ description: 'User who issued the refund' }),\n\n // Timestamps\n createdAt: field.createdAt(),\n processedAt: field.dateTime({ isOptional: true }),\n\n // Relations\n order: field.belongsTo('Order', ['orderId'], ['id']),\n items: field.hasMany('RefundItem'),\n },\n indexes: [index.on(['orderId']), index.on(['status'])],\n});\n\n/**\n * Refund item entity - items being refunded.\n */\nexport const RefundItemEntity = defineEntity({\n name: 'RefundItem',\n description: 'An item within a refund.',\n schema: 'marketplace',\n map: 'refund_item',\n fields: {\n id: field.id(),\n refundId: field.foreignKey(),\n orderItemId: field.foreignKey(),\n\n quantity: field.int(),\n amount: field.decimal(),\n\n createdAt: field.createdAt(),\n\n // Relations\n refund: field.belongsTo('Refund', ['refundId'], ['id'], {\n onDelete: 'Cascade',\n }),\n orderItem: field.belongsTo('OrderItem', ['orderItemId'], ['id']),\n },\n indexes: [index.on(['refundId']), index.on(['orderItemId'])],\n});\n"],"mappings":";;;;;;AAUA,MAAa,kBAAkB,iBAAiB;CAC9C,MAAM;CACN,QAAQ;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;CACD,QAAQ;CACR,aAAa;CACd,CAAC;;;;AAKF,MAAa,oBAAoB,iBAAiB;CAChD,MAAM;CACN,QAAQ;EACN;EACA;EACA;EACA;EACA;EACA;EACD;CACD,QAAQ;CACR,aAAa;CACd,CAAC;;;;AAKF,MAAa,cAAc,aAAa;CACtC,MAAM;CACN,aAAa;CACb,QAAQ;CACR,KAAK;CACL,QAAQ;EACN,IAAI,MAAM,GAAG,EAAE,aAAa,mBAAmB,CAAC;EAGhD,aAAa,MAAM,OAAO,EAAE,aAAa,+BAA+B,CAAC;EAGzE,SAAS,MAAM,WAAW,EAAE,aAAa,iBAAiB,CAAC;EAC3D,SAAS,MAAM,WAAW,EAAE,aAAa,mBAA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SAAS,CAAC,MAAM,GAAG,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,CAAC,cAAc,CAAC,CAAC;CAC7D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payout.js","names":[],"sources":["../../src/entities/payout.ts"],"sourcesContent":["import {\n defineEntity,\n defineEntityEnum,\n field,\n index,\n} from '@contractspec/lib.schema';\n\n/**\n * Payout status enum.\n */\nexport const PayoutStatusEnum = defineEntityEnum({\n name: 'PayoutStatus',\n values: ['PENDING', 'PROCESSING', 'PAID', 'FAILED', 'CANCELLED'] as const,\n schema: 'marketplace',\n description: 'Status of a payout.',\n});\n\n/**\n * Payout schedule enum.\n */\nexport const PayoutScheduleEnum = defineEntityEnum({\n name: 'PayoutSchedule',\n values: ['DAILY', 'WEEKLY', 'BIWEEKLY', 'MONTHLY', 'MANUAL'] as const,\n schema: 'marketplace',\n description: 'Payout schedule frequency.',\n});\n\n/**\n * Payout entity - payment to seller.\n */\nexport const PayoutEntity = defineEntity({\n name: 'Payout',\n description: 'A payout to a seller.',\n schema: 'marketplace',\n map: 'payout',\n fields: {\n id: field.id({ description: 'Unique payout ID' }),\n\n // Store\n storeId: field.foreignKey(),\n\n // Reference\n payoutNumber: field.string({ description: 'Human-readable payout number' }),\n\n // Status\n status: field.enum('PayoutStatus', { default: 'PENDING' }),\n\n // Amount\n grossAmount: field.decimal({ description: 'Total before fees' }),\n platformFees: field.decimal({ description: 'Platform fees deducted' }),\n otherDeductions: field.decimal({ default: 0 }),\n netAmount: field.decimal({ description: 'Final payout amount' }),\n currency: field.string({ default: '\"USD\"' }),\n\n // Period\n periodStart: field.dateTime({ description: 'Start of payout period' }),\n periodEnd: field.dateTime({ description: 'End of payout period' }),\n\n // Payment details\n paymentMethod: field.string({ isOptional: true }),\n paymentReference: field.string({ isOptional: true }),\n\n // Bank account (snapshot)\n bankAccountId: field.string({ isOptional: true }),\n bankAccountLast4: field.string({ isOptional: true }),\n\n // Notes\n notes: field.string({ isOptional: true }),\n failureReason: field.string({ isOptional: true }),\n\n // Stats\n orderCount: field.int({ default: 0 }),\n\n // Timestamps\n createdAt: field.createdAt(),\n updatedAt: field.updatedAt(),\n scheduledAt: field.dateTime({ isOptional: true }),\n processedAt: field.dateTime({ isOptional: true }),\n paidAt: field.dateTime({ isOptional: true }),\n\n // Relations\n store: field.belongsTo('Store', ['storeId'], ['id']),\n items: field.hasMany('PayoutItem'),\n },\n indexes: [\n index.unique(['payoutNumber']),\n index.on(['storeId', 'status']),\n index.on(['status', 'scheduledAt']),\n index.on(['periodStart', 'periodEnd']),\n ],\n enums: [PayoutStatusEnum],\n});\n\n/**\n * Payout item entity - orders included in a payout.\n */\nexport const PayoutItemEntity = defineEntity({\n name: 'PayoutItem',\n description: 'An order included in a payout.',\n schema: 'marketplace',\n map: 'payout_item',\n fields: {\n id: field.id(),\n payoutId: field.foreignKey(),\n orderId: field.foreignKey(),\n\n // Amounts\n orderTotal: field.decimal(),\n platformFee: field.decimal(),\n netAmount: field.decimal(),\n\n createdAt: field.createdAt(),\n\n // Relations\n payout: field.belongsTo('Payout', ['payoutId'], ['id'], {\n onDelete: 'Cascade',\n }),\n order: field.belongsTo('Order', ['orderId'], ['id']),\n },\n indexes: [index.on(['payoutId']), index.on(['orderId'])],\n});\n\n/**\n * Bank account entity - seller payment destinations.\n */\nexport const BankAccountEntity = defineEntity({\n name: 'BankAccount',\n description: 'A bank account for receiving payouts.',\n schema: 'marketplace',\n map: 'bank_account',\n fields: {\n id: field.id(),\n storeId: field.foreignKey(),\n\n // Account info\n accountHolderName: field.string(),\n accountType: field.string({ default: '\"CHECKING\"' }),\n bankName: field.string({ isOptional: true }),\n\n // Masked details\n last4: field.string({ description: 'Last 4 digits of account' }),\n routingLast4: field.string({ isOptional: true }),\n\n // Provider reference\n externalId: field.string({\n isOptional: true,\n description: 'External provider account ID',\n }),\n\n // Status\n isDefault: field.boolean({ default: false }),\n isVerified: field.boolean({ default: false }),\n\n // Timestamps\n createdAt: field.createdAt(),\n updatedAt: field.updatedAt(),\n verifiedAt: field.dateTime({ isOptional: true }),\n\n // Relations\n store: field.belongsTo('Store', ['storeId'], ['id']),\n },\n indexes: [index.on(['storeId', 'isDefault']), index.on(['externalId'])],\n});\n\n/**\n * Payout settings entity - store payout configuration.\n */\nexport const PayoutSettingsEntity = defineEntity({\n name: 'PayoutSettings',\n description: 'Payout configuration for a store.',\n schema: 'marketplace',\n map: 'payout_settings',\n fields: {\n id: field.id(),\n storeId: field.foreignKey(),\n\n // Schedule\n schedule: field.enum('PayoutSchedule', { default: 'WEEKLY' }),\n dayOfWeek: field.int({\n isOptional: true,\n description: 'Day for weekly/biweekly (0=Sunday)',\n }),\n dayOfMonth: field.int({\n isOptional: true,\n description: 'Day for monthly (1-28)',\n }),\n\n // Thresholds\n minimumPayout: field.decimal({\n default: 50,\n description: 'Minimum amount for payout',\n }),\n\n // Default account\n defaultBankAccountId: field.string({ isOptional: true }),\n\n // Timestamps\n createdAt: field.createdAt(),\n updatedAt: field.updatedAt(),\n\n // Relations\n store: field.belongsTo('Store', ['storeId'], ['id']),\n },\n indexes: [index.unique(['storeId'])],\n enums: [PayoutScheduleEnum],\n});\n"],"mappings":";;;;;;AAUA,MAAa,mBAAmB,iBAAiB;CAC/C,MAAM;CACN,QAAQ;EAAC;EAAW;EAAc;EAAQ;EAAU;EAAY;CAChE,QAAQ;CACR,aAAa;CACd,CAAC;;;;AAKF,MAAa,qBAAqB,iBAAiB;CACjD,MAAM;CACN,QAAQ;EAAC;EAAS;EAAU;EAAY;EAAW;EAAS;CAC5D,QAAQ;CACR,aAAa;CACd,CAAC;;;;AAKF,MAAa,eAAe,aAAa;CACvC,MAAM;CACN,aAAa;CACb,QAAQ;CACR,KAAK;CACL,QAAQ;EACN,IAAI,MAAM,GAAG,EAAE,aAAa,oBAAoB,CAAC;EAGjD,SAAS,MAAM,YAAY;EAG3B,cAAc,MAAM,OAAO,EAAE,aAAa,gCAAgC,CAAC;EAG3E,QAAQ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AE,CAAC,KAAK,CAAC;EACrD;CACD,SAAS,CAAC,MAAM,GAAG,CAAC,WAAW,YAAY,CAAC,EAAE,MAAM,GAAG,CAAC,aAAa,CAAC,CAAC;CACxE,CAAC;;;;AAKF,MAAa,uBAAuB,aAAa;CAC/C,MAAM;CACN,aAAa;CACb,QAAQ;CACR,KAAK;CACL,QAAQ;EACN,IAAI,MAAM,IAAI;EACd,SAAS,MAAM,YAAY;EAG3B,UAAU,MAAM,KAAK,kBAAkB,EAAE,SAAS,UAAU,CAAC;EAC7D,WAAW,MAAM,IAAI;GACnB,YAAY;GACZ,aAAa;GACd,CAAC;EACF,YAAY,MAAM,IAAI;GACpB,YAAY;GACZ,aAAa;GACd,CAAC;EAGF,eAAe,MAAM,QAAQ;GAC3B,SAAS;GACT,aAAa;GACd,CAAC;EAGF,sBAAsB,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAGxD,WAAW,MAAM,WAAW;EAC5B,WAAW,MAAM,WAAW;EAG5B,OAAO,MAAM,UAAU,SAAS,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC;EACrD;CACD,SAAS,CAAC,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;CACpC,OAAO,CAAC,mBAAmB;CAC5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"product.js","names":[],"sources":["../../src/entities/product.ts"],"sourcesContent":["import {\n defineEntity,\n defineEntityEnum,\n field,\n index,\n} from '@contractspec/lib.schema';\n\n/**\n * Product status enum.\n */\nexport const ProductStatusEnum = defineEntityEnum({\n name: 'ProductStatus',\n values: [\n 'DRAFT',\n 'PENDING_REVIEW',\n 'ACTIVE',\n 'OUT_OF_STOCK',\n 'DISCONTINUED',\n 'REJECTED',\n ] as const,\n schema: 'marketplace',\n description: 'Status of a product listing.',\n});\n\n/**\n * Product type enum.\n */\nexport const ProductTypeEnum = defineEntityEnum({\n name: 'ProductType',\n values: ['PHYSICAL', 'DIGITAL', 'SERVICE', 'SUBSCRIPTION'] as const,\n schema: 'marketplace',\n description: 'Type of product.',\n});\n\n/**\n * Product entity - an item for sale on the marketplace.\n */\nexport const ProductEntity = defineEntity({\n name: 'Product',\n description: 'A product listing on the marketplace.',\n schema: 'marketplace',\n map: 'product',\n fields: {\n id: field.id({ description: 'Unique product ID' }),\n\n // Store\n storeId: field.foreignKey(),\n\n // Identity\n name: field.string({ description: 'Product name' }),\n slug: field.string({ description: 'URL-friendly identifier' }),\n description: field.string({ isOptional: true }),\n shortDescription: field.string({ isOptional: true }),\n\n // Status\n status: field.enum('ProductStatus', { default: 'DRAFT' }),\n type: field.enum('ProductType', { default: 'PHYSICAL' }),\n\n // Pricing\n price: field.decimal({ description: 'Base price' }),\n compareAtPrice: field.decimal({\n isOptional: true,\n description: 'Original price for showing discounts',\n }),\n currency: field.string({ default: '\"USD\"' }),\n\n // Inventory\n sku: field.string({ isOptional: true }),\n barcode: field.string({ isOptional: true }),\n quantity: field.int({ default: 0 }),\n trackInventory: field.boolean({ default: true }),\n allowBackorder: field.boolean({ default: false }),\n lowStockThreshold: field.int({ default: 5 }),\n\n // Physical properties\n weight: field.decimal({ isOptional: true }),\n weightUnit: field.string({ default: '\"kg\"' }),\n\n // Categories\n categoryId: field.string({ isOptional: true }),\n tags: field.string({ isArray: true }),\n\n // Media (using file attachments)\n primaryImageId: field.string({ isOptional: true }),\n\n // SEO\n seoTitle: field.string({ isOptional: true }),\n seoDescription: field.string({ isOptional: true }),\n\n // Attributes\n attributes: field.json({\n isOptional: true,\n description: 'Custom product attributes',\n }),\n\n // Reviews\n reviewCount: field.int({ default: 0 }),\n averageRating: field.decimal({ default: 0 }),\n\n // Sales\n totalSold: field.int({ default: 0 }),\n\n // Timestamps\n createdAt: field.createdAt(),\n updatedAt: field.updatedAt(),\n publishedAt: field.dateTime({ isOptional: true }),\n\n // Relations\n store: field.belongsTo('Store', ['storeId'], ['id']),\n variants: field.hasMany('ProductVariant'),\n orderItems: field.hasMany('OrderItem'),\n reviews: field.hasMany('Review'),\n },\n indexes: [\n index.unique(['storeId', 'slug']),\n index.on(['storeId', 'status']),\n index.on(['status', 'publishedAt']),\n index.on(['categoryId', 'status']),\n index.on(['averageRating']),\n index.on(['totalSold']),\n index.on(['price']),\n ],\n enums: [ProductStatusEnum, ProductTypeEnum],\n});\n\n/**\n * Product variant entity - variations of a product (size, color, etc.).\n */\nexport const ProductVariantEntity = defineEntity({\n name: 'ProductVariant',\n description: 'A variant of a product with specific options.',\n schema: 'marketplace',\n map: 'product_variant',\n fields: {\n id: field.id(),\n productId: field.foreignKey(),\n\n // Identity\n name: field.string({ description: 'Variant name (e.g., \"Large / Blue\")' }),\n\n // Options\n options: field.json({\n description: 'Variant options (e.g., {size: \"L\", color: \"Blue\"})',\n }),\n\n // Pricing\n price: field.decimal({ description: 'Variant-specific price' }),\n compareAtPrice: field.decimal({ isOptional: true }),\n\n // Inventory\n sku: field.string({ isOptional: true }),\n barcode: field.string({ isOptional: true }),\n quantity: field.int({ default: 0 }),\n\n // Media\n imageId: field.string({ isOptional: true }),\n\n // Status\n isActive: field.boolean({ default: true }),\n\n // Position\n position: field.int({ default: 0 }),\n\n // Timestamps\n createdAt: field.createdAt(),\n updatedAt: field.updatedAt(),\n\n // Relations\n product: field.belongsTo('Product', ['productId'], ['id'], {\n onDelete: 'Cascade',\n }),\n },\n indexes: [\n index.on(['productId', 'sku']),\n index.on(['productId', 'position']),\n index.on(['barcode']),\n ],\n});\n\n/**\n * Category entity - product categorization.\n */\nexport const CategoryEntity = defineEntity({\n name: 'Category',\n description: 'Product category for organization.',\n schema: 'marketplace',\n map: 'category',\n fields: {\n id: field.id(),\n\n name: field.string(),\n slug: field.string(),\n description: field.string({ isOptional: true }),\n\n // Hierarchy\n parentId: field.string({ isOptional: true }),\n path: field.string({ description: 'Full path for hierarchical queries' }),\n level: field.int({ default: 0 }),\n\n // Display\n position: field.int({ default: 0 }),\n imageId: field.string({ isOptional: true }),\n\n // Status\n isActive: field.boolean({ default: true }),\n\n // Timestamps\n createdAt: field.createdAt(),\n updatedAt: field.updatedAt(),\n\n // Relations\n parent: field.belongsTo('Category', ['parentId'], ['id']),\n children: field.hasMany('Category'),\n },\n indexes: [\n index.unique(['slug']),\n index.on(['parentId', 'position']),\n index.on(['path']),\n index.on(['isActive']),\n ],\n});\n"],"mappings":";;;;;;AAUA,MAAa,oBAAoB,iBAAiB;CAChD,MAAM;CACN,QAAQ;EACN;EACA;EACA;EACA;EACA;EACA;EACD;CACD,QAAQ;CACR,aAAa;CACd,CAAC;;;;AAKF,MAAa,kBAAkB,iBAAiB;CAC9C,MAAM;CACN,QAAQ;EAAC;EAAY;EAAW;EAAW;EAAe;CAC1D,QAAQ;CACR,aAAa;CACd,CAAC;;;;AAKF,MAAa,gBAAgB,aAAa;CACxC,MAAM;CACN,aAAa;CACb,QAAQ;CACR,KAAK;CACL,QAAQ;EACN,IAAI,MAAM,GAAG,EAAE,aAAa,qBAAqB,CAAC;EAGlD,SAAS,MAAM,YAAY;EAG3B,MAAM,MAAM,OAAO,EAAE,aAAa,gBAAgB,CAAC;EACnD,MAAM,MAAM,OAAO,EAAE,aAAa,2BAA2B,CAAC;EAC9D,aAAa,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAC/C,kBAAkB,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAGpD,QAAQ,MAAM,KAAK,iBAAiB,EAAE,SAAS,SAAS,CAAC;EACzD,MAAM,MAAM,KAAK,eAAe,EAAE,SAAS,YAAY,CAAC;EAGxD,OAAO,MAAM,QAAQ,EAAE,aAAa,cAAc,CAAC;EACnD,gBAAgB,MAAM,QAAQ;GAC5B,YAAY;GACZ,aAAa;GACd,CAAC;EACF,UAAU,MAAM,OAAO,EAAE,SAAS,WAAS,CAAC;EAG5C,KAAK,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EACvC,SAAS,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAC3C,UAAU,MAAM,IAAI,EAAE,SAAS,GAAG,C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AM,CAAC;EAG/C,UAAU,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAC5C,MAAM,MAAM,OAAO,EAAE,aAAa,sCAAsC,CAAC;EACzE,OAAO,MAAM,IAAI,EAAE,SAAS,GAAG,CAAC;EAGhC,UAAU,MAAM,IAAI,EAAE,SAAS,GAAG,CAAC;EACnC,SAAS,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAG3C,UAAU,MAAM,QAAQ,EAAE,SAAS,MAAM,CAAC;EAG1C,WAAW,MAAM,WAAW;EAC5B,WAAW,MAAM,WAAW;EAG5B,QAAQ,MAAM,UAAU,YAAY,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC;EACzD,UAAU,MAAM,QAAQ,WAAW;EACpC;CACD,SAAS;EACP,MAAM,OAAO,CAAC,OAAO,CAAC;EACtB,MAAM,GAAG,CAAC,YAAY,WAAW,CAAC;EAClC,MAAM,GAAG,CAAC,OAAO,CAAC;EAClB,MAAM,GAAG,CAAC,WAAW,CAAC;EACvB;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"review.js","names":[],"sources":["../../src/entities/review.ts"],"sourcesContent":["import {\n defineEntity,\n defineEntityEnum,\n field,\n index,\n} from '@contractspec/lib.schema';\n\n/**\n * Review status enum.\n */\nexport const ReviewStatusEnum = defineEntityEnum({\n name: 'ReviewStatus',\n values: ['PENDING', 'APPROVED', 'REJECTED', 'FLAGGED'] as const,\n schema: 'marketplace',\n description: 'Status of a review.',\n});\n\n/**\n * Review type enum.\n */\nexport const ReviewTypeEnum = defineEntityEnum({\n name: 'ReviewType',\n values: ['PRODUCT', 'STORE', 'ORDER'] as const,\n schema: 'marketplace',\n description: 'Type of review.',\n});\n\n/**\n * Review entity - customer reviews and ratings.\n */\nexport const ReviewEntity = defineEntity({\n name: 'Review',\n description: 'A customer review on the marketplace.',\n schema: 'marketplace',\n map: 'review',\n fields: {\n id: field.id({ description: 'Unique review ID' }),\n\n // Type and target\n type: field.enum('ReviewType', { default: 'PRODUCT' }),\n productId: field.string({ isOptional: true }),\n storeId: field.string({ isOptional: true }),\n orderId: field.string({ isOptional: true }),\n orderItemId: field.string({ isOptional: true }),\n\n // Author\n authorId: field.foreignKey({ description: 'Reviewer user ID' }),\n\n // Content\n rating: field.int({ description: 'Rating 1-5' }),\n title: field.string({ isOptional: true }),\n content: field.string({ isOptional: true }),\n\n // Verification\n isVerifiedPurchase: field.boolean({ default: false }),\n\n // Status\n status: field.enum('ReviewStatus', { default: 'PENDING' }),\n\n // Media (using file attachments)\n hasMedia: field.boolean({ default: false }),\n\n // Helpfulness\n helpfulCount: field.int({ default: 0 }),\n notHelpfulCount: field.int({ default: 0 }),\n\n // Moderation\n moderatedBy: field.string({ isOptional: true }),\n moderatedAt: field.dateTime({ isOptional: true }),\n moderationNote: field.string({ isOptional: true }),\n\n // Response\n hasResponse: field.boolean({ default: false }),\n\n // Timestamps\n createdAt: field.createdAt(),\n updatedAt: field.updatedAt(),\n\n // Relations\n product: field.belongsTo('Product', ['productId'], ['id']),\n store: field.belongsTo('Store', ['storeId'], ['id']),\n responses: field.hasMany('ReviewResponse'),\n votes: field.hasMany('ReviewVote'),\n },\n indexes: [\n index.on(['productId', 'status', 'createdAt']),\n index.on(['storeId', 'status', 'createdAt']),\n index.on(['authorId']),\n index.on(['orderId']),\n index.on(['status']),\n index.on(['rating']),\n index.on(['isVerifiedPurchase', 'status']),\n ],\n enums: [ReviewStatusEnum, ReviewTypeEnum],\n});\n\n/**\n * Review response entity - seller responses to reviews.\n */\nexport const ReviewResponseEntity = defineEntity({\n name: 'ReviewResponse',\n description: 'A seller response to a review.',\n schema: 'marketplace',\n map: 'review_response',\n fields: {\n id: field.id(),\n reviewId: field.foreignKey(),\n\n // Author (usually store owner)\n authorId: field.foreignKey(),\n\n // Content\n content: field.string(),\n\n // Timestamps\n createdAt: field.createdAt(),\n updatedAt: field.updatedAt(),\n\n // Relations\n review: field.belongsTo('Review', ['reviewId'], ['id'], {\n onDelete: 'Cascade',\n }),\n },\n indexes: [index.on(['reviewId']), index.on(['authorId'])],\n});\n\n/**\n * Review vote entity - helpfulness votes.\n */\nexport const ReviewVoteEntity = defineEntity({\n name: 'ReviewVote',\n description: 'A helpfulness vote on a review.',\n schema: 'marketplace',\n map: 'review_vote',\n fields: {\n id: field.id(),\n reviewId: field.foreignKey(),\n userId: field.foreignKey(),\n\n isHelpful: field.boolean(),\n\n createdAt: field.createdAt(),\n\n // Relations\n review: field.belongsTo('Review', ['reviewId'], ['id'], {\n onDelete: 'Cascade',\n }),\n },\n indexes: [index.unique(['reviewId', 'userId']), index.on(['userId'])],\n});\n\n/**\n * Review report entity - flagged reviews.\n */\nexport const ReviewReportEntity = defineEntity({\n name: 'ReviewReport',\n description: 'A report/flag on a review.',\n schema: 'marketplace',\n map: 'review_report',\n fields: {\n id: field.id(),\n reviewId: field.foreignKey(),\n reporterId: field.foreignKey(),\n\n reason: field.string({ description: 'Report reason category' }),\n details: field.string({ isOptional: true }),\n\n // Status\n status: field.string({ default: '\"PENDING\"' }),\n resolvedBy: field.string({ isOptional: true }),\n resolvedAt: field.dateTime({ isOptional: true }),\n resolution: field.string({ isOptional: true }),\n\n createdAt: field.createdAt(),\n\n // Relations\n review: field.belongsTo('Review', ['reviewId'], ['id']),\n },\n indexes: [\n index.on(['reviewId']),\n index.on(['status']),\n index.on(['reporterId']),\n ],\n});\n"],"mappings":";;;;;;AAUA,MAAa,mBAAmB,iBAAiB;CAC/C,MAAM;CACN,QAAQ;EAAC;EAAW;EAAY;EAAY;EAAU;CACtD,QAAQ;CACR,aAAa;CACd,CAAC;;;;AAKF,MAAa,iBAAiB,iBAAiB;CAC7C,MAAM;CACN,QAAQ;EAAC;EAAW;EAAS;EAAQ;CACrC,QAAQ;CACR,aAAa;CACd,CAAC;;;;AAKF,MAAa,eAAe,aAAa;CACvC,MAAM;CACN,aAAa;CACb,QAAQ;CACR,KAAK;CACL,QAAQ;EACN,IAAI,MAAM,GAAG,EAA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AAK;CACL,QAAQ;EACN,IAAI,MAAM,IAAI;EACd,UAAU,MAAM,YAAY;EAC5B,YAAY,MAAM,YAAY;EAE9B,QAAQ,MAAM,OAAO,EAAE,aAAa,0BAA0B,CAAC;EAC/D,SAAS,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAG3C,QAAQ,MAAM,OAAO,EAAE,SAAS,eAAa,CAAC;EAC9C,YAAY,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAC9C,YAAY,MAAM,SAAS,EAAE,YAAY,MAAM,CAAC;EAChD,YAAY,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAE9C,WAAW,MAAM,WAAW;EAG5B,QAAQ,MAAM,UAAU,UAAU,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC;EACxD;CACD,SAAS;EACP,MAAM,GAAG,CAAC,WAAW,CAAC;EACtB,MAAM,GAAG,CAAC,SAAS,CAAC;EACpB,MAAM,GAAG,CAAC,aAAa,CAAC;EACzB;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","names":[],"sources":["../../src/entities/store.ts"],"sourcesContent":["import {\n defineEntity,\n defineEntityEnum,\n field,\n index,\n} from '@contractspec/lib.schema';\n\n/**\n * Store status enum.\n */\nexport const StoreStatusEnum = defineEntityEnum({\n name: 'StoreStatus',\n values: ['PENDING', 'ACTIVE', 'SUSPENDED', 'CLOSED'] as const,\n schema: 'marketplace',\n description: 'Status of a store.',\n});\n\n/**\n * Store type enum.\n */\nexport const StoreTypeEnum = defineEntityEnum({\n name: 'StoreType',\n values: ['INDIVIDUAL', 'BUSINESS', 'ENTERPRISE'] as const,\n schema: 'marketplace',\n description: 'Type of store account.',\n});\n\n/**\n * Store entity - a seller's storefront on the marketplace.\n */\nexport const StoreEntity = defineEntity({\n name: 'Store',\n description: 'A seller storefront on the marketplace.',\n schema: 'marketplace',\n map: 'store',\n fields: {\n id: field.id({ description: 'Unique store ID' }),\n\n // Identity\n name: field.string({ description: 'Store display name' }),\n slug: field.string({ description: 'URL-friendly identifier' }),\n description: field.string({ isOptional: true }),\n\n // Status\n status: field.enum('StoreStatus', { default: 'PENDING' }),\n type: field.enum('StoreType', { default: 'INDIVIDUAL' }),\n\n // Owner\n ownerId: field.foreignKey({ description: 'Store owner user ID' }),\n organizationId: field.foreignKey({ isOptional: true }),\n\n // Branding\n logoFileId: field.string({\n isOptional: true,\n description: 'Logo file reference',\n }),\n bannerFileId: field.string({\n isOptional: true,\n description: 'Banner file reference',\n }),\n\n // Contact\n email: field.string({ isOptional: true }),\n phone: field.string({ isOptional: true }),\n website: field.string({ isOptional: true }),\n\n // Location\n country: field.string({ isOptional: true }),\n currency: field.string({ default: '\"USD\"' }),\n timezone: field.string({ isOptional: true }),\n\n // Commission\n commissionRate: field.decimal({\n default: 0.1,\n description: 'Platform commission rate (e.g., 0.1 = 10%)',\n }),\n\n // Verification\n isVerified: field.boolean({ default: false }),\n verifiedAt: field.dateTime({ isOptional: true }),\n\n // Settings\n settings: field.json({ isOptional: true }),\n metadata: field.json({ isOptional: true }),\n\n // Metrics (denormalized for performance)\n totalProducts: field.int({ default: 0 }),\n totalOrders: field.int({ default: 0 }),\n totalRevenue: field.decimal({ default: 0 }),\n averageRating: field.decimal({ default: 0 }),\n\n // Timestamps\n createdAt: field.createdAt(),\n updatedAt: field.updatedAt(),\n\n // Relations\n products: field.hasMany('Product'),\n orders: field.hasMany('Order'),\n payouts: field.hasMany('Payout'),\n },\n indexes: [\n index.unique(['slug']),\n index.on(['ownerId']),\n index.on(['status']),\n index.on(['country', 'status']),\n index.on(['averageRating']),\n ],\n enums: [StoreStatusEnum, StoreTypeEnum],\n});\n\n/**\n * Store category entity - categorization for stores.\n */\nexport const StoreCategoryEntity = defineEntity({\n name: 'StoreCategory',\n description: 'Category assignment for stores.',\n schema: 'marketplace',\n map: 'store_category',\n fields: {\n id: field.id(),\n storeId: field.foreignKey(),\n categoryId: field.foreignKey(),\n isPrimary: field.boolean({ default: false }),\n createdAt: field.createdAt(),\n\n // Relations\n store: field.belongsTo('Store', ['storeId'], ['id'], {\n onDelete: 'Cascade',\n }),\n },\n indexes: [index.unique(['storeId', 'categoryId']), index.on(['categoryId'])],\n});\n"],"mappings":";;;;;;AAUA,MAAa,kBAAkB,iBAAiB;CAC9C,MAAM;CACN,QAAQ;EAAC;EAAW;EAAU;EAAa;EAAS;CACpD,QAAQ;CACR,aAAa;CACd,CAAC;;;;AAKF,MAAa,gBAAgB,iBAAiB;CAC5C,MAAM;CACN,QAAQ;EAAC;EAAc;EAAY;EAAa;CAChD,QAAQ;CACR,aAAa;CACd,CAAC;;;;AAKF,MAAa,cAAc,aAAa;CACtC,MAAM;CACN,aAAa;CACb,QAAQ;CACR,KAAK;CACL,QAAQ;EACN,IAAI,MAAM,GAAG,EAAE,aAAa,mBAAmB,CAAC;EAGhD,MAAM,MAAM,OAAO,EAAE,aAAa,sBAAsB,CAAC;EACzD,MAAM,MAAM,OAAO,EAAE,aAAa,2BAA2B,CAAC;EAC9D,aAAa,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAG/C,QAAQ,MAAM,KAAK,eAAe,EAAE,SAAS,WAAW,CAAC;EACzD,MAAM,MAAM,KAAK,aAAa,EAAE,SAAS,cAAc,CAAC;EAGxD,SAAS,MAAM,WAAW,EAAE,aAAa,uBAAuB,CAAC;EACjE,gBAAgB,MAAM,WAAW,EAAE,YAAY,MAAM,CAAC;EAGtD,YAAY,MAAM,OAAO;GACvB,YAAY;GACZ,aAAa;GACd,CAAC;EACF,cAAc,MAAM,OAAO;GACzB,YAAY;GACZ,aAAa;GACd,CAAC;EAGF,OAAO,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EACzC,OAAO,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EACzC,SAAS,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAG3C,SAAS,MAAM,OAAO,EAAE,YAAY,MAAM,CAAC;EAC3C,UAAU,MAAM,OAAO,EA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EAAE,EACnD,UAAU,WACX,CAAC;EACH;CACD,SAAS,CAAC,MAAM,OAAO,CAAC,WAAW,aAAa,CAAC,EAAE,MAAM,GAAG,CAAC,aAAa,CAAC,CAAC;CAC7E,CAAC"}
|
package/dist/example.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["import { defineExample } from '@contractspec/lib.contracts';\n\nconst example = defineExample({\n meta: {\n key: 'marketplace',\n version: '1.0.0',\n title: 'Marketplace (2-sided)',\n description:\n 'Two-sided marketplace with stores, products, orders, payouts, and reviews (multi-actor flows).',\n kind: 'template',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@platform.core'],\n tags: ['marketplace', 'orders', 'payouts', 'reviews'],\n },\n docs: {\n rootDocId: 'docs.examples.marketplace',\n goalDocId: 'docs.examples.marketplace.goal',\n usageDocId: 'docs.examples.marketplace.usage',\n constraintsDocId: 'docs.examples.marketplace.constraints',\n },\n entrypoints: {\n packageName: '@contractspec/example.marketplace',\n feature: './feature',\n contracts: './contracts',\n presentations: './presentations',\n handlers: './handlers',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: {\n enabled: true,\n modes: ['playground', 'specs', 'builder', 'markdown', 'evolution'],\n },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n});\n\nexport default example;\n"],"mappings":";;;AAEA,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAe;GAAU;GAAW;GAAU;EACtD;CACD,MAAM;EACJ,WAAW;EACX,WAAW;EACX,YAAY;EACZ,kBAAkB;EACnB;CACD,aAAa;EACX,aAAa;EACb,SAAS;EACT,WAAW;EACX,eAAe;EACf,UAAU;EACV,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GACP,SAAS;GACT,OAAO;IAAC;IAAc;IAAS;IAAW;IAAY;IAAY;GACnE;EACD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF,CAAC;AAEF,sBAAe"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"marketplace.handlers.js","names":[],"sources":["../../src/handlers/marketplace.handlers.ts"],"sourcesContent":["/**\n * Runtime-local Marketplace handlers\n *\n * Database-backed handlers for the marketplace template.\n */\nimport type { DatabasePort, DbRow } from '@contractspec/lib.runtime-sandbox';\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\nimport { web } from '@contractspec/lib.runtime-sandbox';\nconst { generateId } = web;\n\n// ============ Types ============\n\nexport interface Store {\n id: string;\n projectId: string;\n organizationId: string;\n name: string;\n description?: string;\n status: 'PENDING' | 'ACTIVE' | 'SUSPENDED';\n rating: number;\n reviewCount: number;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface Product {\n id: string;\n storeId: string;\n name: string;\n description?: string;\n price: number;\n currency: string;\n status: 'DRAFT' | 'ACTIVE' | 'OUT_OF_STOCK' | 'ARCHIVED';\n stock: number;\n category?: string;\n imageUrl?: string;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface Order {\n id: string;\n projectId: string;\n storeId: string;\n customerId: string;\n status:\n | 'PENDING'\n | 'CONFIRMED'\n | 'PROCESSING'\n | 'SHIPPED'\n | 'DELIVERED'\n | 'CANCELLED';\n total: number;\n currency: string;\n shippingAddress?: string;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface OrderItem {\n id: string;\n orderId: string;\n productId: string;\n quantity: number;\n price: number;\n createdAt: Date;\n}\n\nexport interface Payout {\n id: string;\n storeId: string;\n amount: number;\n currency: string;\n status: 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED';\n processedAt?: Date;\n createdAt: Date;\n}\n\nexport interface Review {\n id: string;\n productId: string;\n customerId: string;\n orderId?: string;\n rating: number;\n comment?: string;\n createdAt: Date;\n}\n\nexport interface CreateStoreInput {\n name: string;\n description?: string;\n}\n\nexport interface AddProductInput {\n storeId: string;\n name: string;\n description?: string;\n price: number;\n currency?: string;\n stock?: number;\n category?: string;\n imageUrl?: string;\n}\n\nexport interface PlaceOrderInput {\n storeId: string;\n items: { productId: string; quantity: number }[];\n shippingAddress?: string;\n}\n\nexport interface ListStoresInput {\n projectId: string;\n status?: 'PENDING' | 'ACTIVE' | 'SUSPENDED' | 'all';\n search?: string;\n limit?: number;\n offset?: number;\n}\n\nexport interface ListStoresOutput {\n stores: Store[];\n total: number;\n}\n\nexport interface ListProductsInput {\n storeId?: string;\n status?: 'DRAFT' | 'ACTIVE' | 'OUT_OF_STOCK' | 'ARCHIVED' | 'all';\n category?: string;\n search?: string;\n limit?: number;\n offset?: number;\n}\n\nexport interface ListProductsOutput {\n products: Product[];\n total: number;\n}\n\nexport interface ListOrdersInput {\n projectId: string;\n storeId?: string;\n customerId?: string;\n status?:\n | 'PENDING'\n | 'CONFIRMED'\n | 'PROCESSING'\n | 'SHIPPED'\n | 'DELIVERED'\n | 'CANCELLED'\n | 'all';\n limit?: number;\n offset?: number;\n}\n\nexport interface ListOrdersOutput {\n orders: Order[];\n total: number;\n totalRevenue: number;\n}\n\n// ============ Row Types ============\n\ninterface StoreRow {\n id: string;\n projectId: string;\n organizationId: string;\n name: string;\n description: string | null;\n status: string;\n rating: number;\n reviewCount: number;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface ProductRow {\n id: string;\n storeId: string;\n name: string;\n description: string | null;\n price: number;\n currency: string;\n status: string;\n stock: number;\n category: string | null;\n imageUrl: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface OrderRow {\n id: string;\n projectId: string;\n storeId: string;\n customerId: string;\n status: string;\n total: number;\n currency: string;\n shippingAddress: string | null;\n createdAt: string;\n updatedAt: string;\n}\n\ninterface OrderItemRow {\n id: string;\n orderId: string;\n productId: string;\n quantity: number;\n price: number;\n createdAt: string;\n}\n\ninterface PayoutRow {\n id: string;\n storeId: string;\n amount: number;\n currency: string;\n status: string;\n processedAt: string | null;\n createdAt: string;\n}\n\ninterface ReviewRow {\n id: string;\n productId: string;\n customerId: string;\n orderId: string | null;\n rating: number;\n comment: string | null;\n createdAt: string;\n}\n\nfunction rowToStore(row: StoreRow): Store {\n return {\n id: row.id,\n projectId: row.projectId,\n organizationId: row.organizationId,\n name: row.name,\n description: row.description ?? undefined,\n status: row.status as Store['status'],\n rating: row.rating,\n reviewCount: row.reviewCount,\n createdAt: new Date(row.createdAt),\n updatedAt: new Date(row.updatedAt),\n };\n}\n\nfunction rowToProduct(row: ProductRow): Product {\n return {\n id: row.id,\n storeId: row.storeId,\n name: row.name,\n description: row.description ?? undefined,\n price: row.price,\n currency: row.currency,\n status: row.status as Product['status'],\n stock: row.stock,\n category: row.category ?? undefined,\n imageUrl: row.imageUrl ?? undefined,\n createdAt: new Date(row.createdAt),\n updatedAt: new Date(row.updatedAt),\n };\n}\n\nfunction rowToOrder(row: OrderRow): Order {\n return {\n id: row.id,\n projectId: row.projectId,\n storeId: row.storeId,\n customerId: row.customerId,\n status: row.status as Order['status'],\n total: row.total,\n currency: row.currency,\n shippingAddress: row.shippingAddress ?? undefined,\n createdAt: new Date(row.createdAt),\n updatedAt: new Date(row.updatedAt),\n };\n}\n\nfunction rowToOrderItem(row: OrderItemRow): OrderItem {\n return {\n id: row.id,\n orderId: row.orderId,\n productId: row.productId,\n quantity: row.quantity,\n price: row.price,\n createdAt: new Date(row.createdAt),\n };\n}\n\nfunction rowToPayout(row: PayoutRow): Payout {\n return {\n id: row.id,\n storeId: row.storeId,\n amount: row.amount,\n currency: row.currency,\n status: row.status as Payout['status'],\n processedAt: row.processedAt ? new Date(row.processedAt) : undefined,\n createdAt: new Date(row.createdAt),\n };\n}\n\nfunction rowToReview(row: ReviewRow): Review {\n return {\n id: row.id,\n productId: row.productId,\n customerId: row.customerId,\n orderId: row.orderId ?? undefined,\n rating: row.rating,\n comment: row.comment ?? undefined,\n createdAt: new Date(row.createdAt),\n };\n}\n\n// ============ Handler Factory ============\n\nexport function createMarketplaceHandlers(db: DatabasePort) {\n /**\n * List stores\n */\n async function listStores(input: ListStoresInput): Promise<ListStoresOutput> {\n const { projectId, status, search, limit = 20, offset = 0 } = input;\n\n let whereClause = 'WHERE projectId = ?';\n const params: (string | number)[] = [projectId];\n\n if (status && status !== 'all') {\n whereClause += ' AND status = ?';\n params.push(status);\n }\n\n if (search) {\n whereClause += ' AND name LIKE ?';\n params.push(`%${search}%`);\n }\n\n const countResult = (\n await db.query(\n `SELECT COUNT(*) as count FROM marketplace_store ${whereClause}`,\n params\n )\n ).rows as DbRow[];\n const total = (countResult[0]?.count as number) ?? 0;\n\n const rows = (\n await db.query(\n `SELECT * FROM marketplace_store ${whereClause} ORDER BY rating DESC LIMIT ? OFFSET ?`,\n [...params, limit, offset]\n )\n ).rows as unknown as StoreRow[];\n\n return {\n stores: rows.map(rowToStore),\n total,\n };\n }\n\n /**\n * Create a store\n */\n async function createStore(\n input: CreateStoreInput,\n context: { projectId: string; organizationId: string }\n ): Promise<Store> {\n const id = generateId('store');\n const now = new Date().toISOString();\n\n await db.execute(\n `INSERT INTO marketplace_store (id, projectId, organizationId, name, description, status, rating, reviewCount, createdAt, updatedAt)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,\n [\n id,\n context.projectId,\n context.organizationId,\n input.name,\n input.description ?? null,\n 'PENDING',\n 0,\n 0,\n now,\n now,\n ]\n );\n\n const rows = (\n await db.query(`SELECT * FROM marketplace_store WHERE id = ?`, [id])\n ).rows as unknown as StoreRow[];\n\n return rowToStore(rows[0]!);\n }\n\n /**\n * List products\n */\n async function listProducts(\n input: ListProductsInput\n ): Promise<ListProductsOutput> {\n const { storeId, status, category, search, limit = 20, offset = 0 } = input;\n\n let whereClause = 'WHERE 1=1';\n const params: (string | number)[] = [];\n\n if (storeId) {\n whereClause += ' AND storeId = ?';\n params.push(storeId);\n }\n\n if (status && status !== 'all') {\n whereClause += ' AND status = ?';\n params.push(status);\n }\n\n if (category) {\n whereClause += ' AND category = ?';\n params.push(category);\n }\n\n if (search) {\n whereClause += ' AND name LIKE ?';\n params.push(`%${search}%`);\n }\n\n const countResult = (\n await db.query(\n `SELECT COUNT(*) as count FROM marketplace_product ${whereClause}`,\n params\n )\n ).rows as DbRow[];\n const total = (countResult[0]?.count as number) ?? 0;\n\n const rows = (\n await db.query(\n `SELECT * FROM marketplace_product ${whereClause} ORDER BY createdAt DESC LIMIT ? OFFSET ?`,\n [...params, limit, offset]\n )\n ).rows as unknown as ProductRow[];\n\n return {\n products: rows.map(rowToProduct),\n total,\n };\n }\n\n /**\n * Add a product\n */\n async function addProduct(input: AddProductInput): Promise<Product> {\n const id = generateId('prod');\n const now = new Date().toISOString();\n\n await db.execute(\n `INSERT INTO marketplace_product (id, storeId, name, description, price, currency, status, stock, category, imageUrl, createdAt, updatedAt)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,\n [\n id,\n input.storeId,\n input.name,\n input.description ?? null,\n input.price,\n input.currency ?? 'USD',\n 'DRAFT',\n input.stock ?? 0,\n input.category ?? null,\n input.imageUrl ?? null,\n now,\n now,\n ]\n );\n\n const rows = (\n await db.query(`SELECT * FROM marketplace_product WHERE id = ?`, [id])\n ).rows as unknown as ProductRow[];\n\n return rowToProduct(rows[0]!);\n }\n\n /**\n * List orders\n */\n async function listOrders(input: ListOrdersInput): Promise<ListOrdersOutput> {\n const {\n projectId,\n storeId,\n customerId,\n status,\n limit = 20,\n offset = 0,\n } = input;\n\n let whereClause = 'WHERE projectId = ?';\n const params: (string | number)[] = [projectId];\n\n if (storeId) {\n whereClause += ' AND storeId = ?';\n params.push(storeId);\n }\n\n if (customerId) {\n whereClause += ' AND customerId = ?';\n params.push(customerId);\n }\n\n if (status && status !== 'all') {\n whereClause += ' AND status = ?';\n params.push(status);\n }\n\n const countResult = (\n await db.query(\n `SELECT COUNT(*) as count FROM marketplace_order ${whereClause}`,\n params\n )\n ).rows as DbRow[];\n const total = (countResult[0]?.count as number) ?? 0;\n\n const revenueResult = (\n await db.query(\n `SELECT COALESCE(SUM(total), 0) as revenue FROM marketplace_order ${whereClause}`,\n params\n )\n ).rows as DbRow[];\n const totalRevenue = (revenueResult[0]?.revenue as number) ?? 0;\n\n const rows = (\n await db.query(\n `SELECT * FROM marketplace_order ${whereClause} ORDER BY createdAt DESC LIMIT ? OFFSET ?`,\n [...params, limit, offset]\n )\n ).rows as unknown as OrderRow[];\n\n return {\n orders: rows.map(rowToOrder),\n total,\n totalRevenue,\n };\n }\n\n /**\n * Place an order\n */\n async function placeOrder(\n input: PlaceOrderInput,\n context: { projectId: string; customerId: string }\n ): Promise<Order> {\n const orderId = generateId('order');\n const now = new Date().toISOString();\n\n // Calculate total\n let total = 0;\n const itemsToCreate: {\n productId: string;\n quantity: number;\n price: number;\n }[] = [];\n\n for (const item of input.items) {\n const products = (\n await db.query(`SELECT * FROM marketplace_product WHERE id = ?`, [\n item.productId,\n ])\n ).rows as unknown as ProductRow[];\n\n if (!products[0]) {\n throw new Error(`Product not found: ${item.productId}`);\n }\n\n const itemPrice = products[0].price * item.quantity;\n total += itemPrice;\n itemsToCreate.push({\n productId: item.productId,\n quantity: item.quantity,\n price: products[0].price,\n });\n }\n\n // Create order\n await db.execute(\n `INSERT INTO marketplace_order (id, projectId, storeId, customerId, status, total, currency, shippingAddress, createdAt, updatedAt)\n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,\n [\n orderId,\n context.projectId,\n input.storeId,\n context.customerId,\n 'PENDING',\n total,\n 'USD',\n input.shippingAddress ?? null,\n now,\n now,\n ]\n );\n\n // Create order items\n for (const item of itemsToCreate) {\n await db.execute(\n `INSERT INTO marketplace_order_item (id, orderId, productId, quantity, price, createdAt)\n VALUES (?, ?, ?, ?, ?, ?)`,\n [\n generateId('orditem'),\n orderId,\n item.productId,\n item.quantity,\n item.price,\n now,\n ]\n );\n }\n\n const rows = (\n await db.query(`SELECT * FROM marketplace_order WHERE id = ?`, [orderId])\n ).rows as unknown as OrderRow[];\n\n return rowToOrder(rows[0]!);\n }\n\n /**\n * Get order items\n */\n async function getOrderItems(orderId: string): Promise<OrderItem[]> {\n const rows = (\n await db.query(`SELECT * FROM marketplace_order_item WHERE orderId = ?`, [\n orderId,\n ])\n ).rows as unknown as OrderItemRow[];\n\n return rows.map(rowToOrderItem);\n }\n\n /**\n * Update order status\n */\n async function updateOrderStatus(\n orderId: string,\n status: Order['status']\n ): Promise<Order> {\n const now = new Date().toISOString();\n\n await db.execute(\n `UPDATE marketplace_order SET status = ?, updatedAt = ? WHERE id = ?`,\n [status, now, orderId]\n );\n\n const rows = (\n await db.query(`SELECT * FROM marketplace_order WHERE id = ?`, [orderId])\n ).rows as unknown as OrderRow[];\n\n return rowToOrder(rows[0]!);\n }\n\n /**\n * List payouts\n */\n async function listPayouts(storeId: string): Promise<Payout[]> {\n const rows = (\n await db.query(\n `SELECT * FROM marketplace_payout WHERE storeId = ? ORDER BY createdAt DESC`,\n [storeId]\n )\n ).rows as unknown as PayoutRow[];\n\n return rows.map(rowToPayout);\n }\n\n /**\n * List reviews for a product\n */\n async function listReviews(productId: string): Promise<Review[]> {\n const rows = (\n await db.query(\n `SELECT * FROM marketplace_review WHERE productId = ? ORDER BY createdAt DESC`,\n [productId]\n )\n ).rows as unknown as ReviewRow[];\n\n return rows.map(rowToReview);\n }\n\n /**\n * Submit a review\n */\n async function submitReview(input: {\n productId: string;\n customerId: string;\n orderId?: string;\n rating: number;\n comment?: string;\n }): Promise<Review> {\n const id = generateId('review');\n const now = new Date().toISOString();\n\n await db.execute(\n `INSERT INTO marketplace_review (id, productId, customerId, orderId, rating, comment, createdAt)\n VALUES (?, ?, ?, ?, ?, ?, ?)`,\n [\n id,\n input.productId,\n input.customerId,\n input.orderId ?? null,\n input.rating,\n input.comment ?? null,\n now,\n now,\n ]\n );\n\n const rows = (\n await db.query(`SELECT * FROM marketplace_review WHERE id = ?`, [id])\n ).rows as unknown as ReviewRow[];\n\n return rowToReview(rows[0]!);\n }\n\n return {\n listStores,\n createStore,\n listProducts,\n addProduct,\n listOrders,\n placeOrder,\n getOrderItems,\n updateOrderStatus,\n listPayouts,\n listReviews,\n submitReview,\n };\n}\n\nexport type MarketplaceHandlers = ReturnType<typeof createMarketplaceHandlers>;\n"],"mappings":";;;AAQA,MAAM,EAAE,eAAe;AA+NvB,SAAS,WAAW,KAAsB;AACxC,QAAO;EACL,IAAI,IAAI;EACR,WAAW,IAAI;EACf,gBAAgB,IAAI;EACpB,MAAM,IAAI;EACV,aAAa,IAAI,eAAe;EAChC,QAAQ,IAAI;EACZ,QAAQ,IAAI;EACZ,aAAa,IAAI;EACjB,WAAW,IAAI,KAAK,IAAI,UAAU;EAClC,WAAW,IAAI,KAAK,IAAI,UAAU;EACnC;;AAGH,SAAS,aAAa,KAA0B;AAC9C,QAAO;EACL,IAAI,IAAI;EACR,SAAS,IAAI;EACb,MAAM,IAAI;EACV,aAAa,IAAI,eAAe;EAChC,OAAO,IAAI;EACX,UAAU,IAAI;EACd,QAAQ,IAAI;EACZ,OAAO,IAAI;EACX,UAAU,IAAI,YAAY;EAC1B,UAAU,IAAI,YAAY;EAC1B,WAAW,IAAI,KAAK,IAAI,UAAU;EAClC,WAAW,IAAI,KAAK,IAAI,UAAU;EACnC;;AAGH,SAAS,WAAW,KAAsB;AACxC,QAAO;EACL,IAAI,IAAI;EACR,WAAW,IAAI;EACf,SAAS,IAAI;EACb,YAAY,IAAI;EAChB,QAAQ,IAAI;EACZ,OAAO,IAAI;EACX,UAAU,IAAI;EACd,iBAAiB,IAAI,mBAAmB;EACxC,WAAW,IAAI,KAAK,IAAI,UAAU;EAClC,WAAW,IAAI,KAAK,IAAI,UAAU;EACnC;;AAGH,SAAS,eAAe,KAA8B;AACpD,QAAO;EACL,IAAI,IAAI;EACR,SAAS,IAAI;EACb,WAAW,IAAI;EACf,UAA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F;EAGH,MAAM,QACJ,MAAM,GAAG,MAAM,gDAAgD,CAAC,QAAQ,CAAC,EACzE;AAEF,SAAO,WAAW,KAAK,GAAI;;;;;CAM7B,eAAe,cAAc,SAAuC;AAOlE,UALE,MAAM,GAAG,MAAM,0DAA0D,CACvE,QACD,CAAC,EACF,KAEU,IAAI,eAAe;;;;;CAMjC,eAAe,kBACb,SACA,QACgB;EAChB,MAAM,uBAAM,IAAI,MAAM,EAAC,aAAa;AAEpC,QAAM,GAAG,QACP,uEACA;GAAC;GAAQ;GAAK;GAAQ,CACvB;EAED,MAAM,QACJ,MAAM,GAAG,MAAM,gDAAgD,CAAC,QAAQ,CAAC,EACzE;AAEF,SAAO,WAAW,KAAK,GAAI;;;;;CAM7B,eAAe,YAAY,SAAoC;AAQ7D,UANE,MAAM,GAAG,MACP,8EACA,CAAC,QAAQ,CACV,EACD,KAEU,IAAI,YAAY;;;;;CAM9B,eAAe,YAAY,WAAsC;AAQ/D,UANE,MAAM,GAAG,MACP,gFACA,CAAC,UAAU,CACZ,EACD,KAEU,IAAI,YAAY;;;;;CAM9B,eAAe,aAAa,OAMR;EAClB,MAAM,KAAK,WAAW,SAAS;EAC/B,MAAM,uBAAM,IAAI,MAAM,EAAC,aAAa;AAEpC,QAAM,GAAG,QACP;sCAEA;GACE;GACA,MAAM;GACN,MAAM;GACN,MAAM,WAAW;GACjB,MAAM;GACN,MAAM,WAAW;GACjB;GACA;GACD,CACF;EAED,MAAM,QACJ,MAAM,GAAG,MAAM,iDAAiD,CAAC,GAAG,CAAC,EACrE;AAEF,SAAO,YAAY,KAAK,GAAI;;AAG9B,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"marketplace.capability.js","names":[],"sources":["../src/marketplace.capability.ts"],"sourcesContent":["import { defineCapability, StabilityEnum } from '@contractspec/lib.contracts';\n\nexport const MarketplaceCapability = defineCapability({\n meta: {\n key: 'marketplace',\n version: '1.0.0',\n kind: 'ui',\n stability: StabilityEnum.Experimental,\n description: 'Multi-vendor marketplace platform',\n owners: ['platform.marketplace'],\n tags: ['marketplace', 'ecommerce'],\n },\n});\n\nexport const EcommerceCapability = defineCapability({\n meta: {\n key: 'ecommerce',\n version: '1.0.0',\n kind: 'api',\n stability: StabilityEnum.Experimental,\n description: 'E-commerce operations and product catalog',\n owners: ['platform.marketplace'],\n tags: ['ecommerce', 'products'],\n },\n});\n\nexport const PaymentsCapability = defineCapability({\n meta: {\n key: 'payments',\n version: '1.0.0',\n kind: 'integration',\n stability: StabilityEnum.Experimental,\n description: 'Payment processing and payouts',\n owners: ['platform.finance'],\n tags: ['payments', 'finance'],\n },\n});\n"],"mappings":";;;AAEA,MAAa,wBAAwB,iBAAiB,EACpD,MAAM;CACJ,KAAK;CACL,SAAS;CACT,MAAM;CACN,WAAW,cAAc;CACzB,aAAa;CACb,QAAQ,CAAC,uBAAuB;CAChC,MAAM,CAAC,eAAe,YAAY;CACnC,EACF,CAAC;AAEF,MAAa,sBAAsB,iBAAiB,EAClD,MAAM;CACJ,KAAK;CACL,SAAS;CACT,MAAM;CACN,WAAW,cAAc;CACzB,aAAa;CACb,QAAQ,CAAC,uBAAuB;CAChC,MAAM,CAAC,aAAa,WAAW;CAChC,EACF,CAAC;AAEF,MAAa,qBAAqB,iBAAiB,EACjD,MAAM;CACJ,KAAK;CACL,SAAS;CACT,MAAM;CACN,WAAW,cAAc;CACzB,aAAa;CACb,QAAQ,CAAC,mBAAmB;CAC5B,MAAM,CAAC,YAAY,UAAU;CAC9B,EACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"marketplace.feature.js","names":[],"sources":["../src/marketplace.feature.ts"],"sourcesContent":["/**\n * Marketplace Feature Module Specification\n */\nimport { defineFeature } from '@contractspec/lib.contracts';\n\n/**\n * Marketplace feature module that bundles multi-vendor marketplace\n * capabilities including stores, products, orders, payouts, and reviews.\n */\nexport const MarketplaceFeature = defineFeature({\n meta: {\n key: 'marketplace',\n version: '1.0.0',\n title: 'Multi-Vendor Marketplace',\n description:\n 'Full-featured marketplace with stores, products, orders, payouts, and reviews',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'ecommerce', 'multi-vendor', 'payments'],\n stability: 'experimental',\n },\n\n operations: [\n // Store operations\n { key: 'marketplace.store.create', version: '1.0.0' },\n\n // Product operations\n { key: 'marketplace.product.create', version: '1.0.0' },\n { key: 'marketplace.product.list', version: '1.0.0' },\n\n // Order operations\n { key: 'marketplace.order.create', version: '1.0.0' },\n { key: 'marketplace.order.updateStatus', version: '1.0.0' },\n\n // Payout operations\n { key: 'marketplace.payout.list', version: '1.0.0' },\n\n // Review operations\n { key: 'marketplace.review.create', version: '1.0.0' },\n { key: 'marketplace.review.list', version: '1.0.0' },\n ],\n\n events: [\n // Store events\n { key: 'marketplace.store.created', version: '1.0.0' },\n { key: 'marketplace.store.statusChanged', version: '1.0.0' },\n\n // Product events\n { key: 'marketplace.product.created', version: '1.0.0' },\n { key: 'marketplace.product.published', version: '1.0.0' },\n { key: 'marketplace.inventory.updated', version: '1.0.0' },\n\n // Order events\n { key: 'marketplace.order.created', version: '1.0.0' },\n { key: 'marketplace.order.paid', version: '1.0.0' },\n { key: 'marketplace.order.statusUpdated', version: '1.0.0' },\n { key: 'marketplace.order.shipped', version: '1.0.0' },\n { key: 'marketplace.order.completed', version: '1.0.0' },\n\n // Payout events\n { key: 'marketplace.payout.created', version: '1.0.0' },\n { key: 'marketplace.payout.paid', version: '1.0.0' },\n\n // Review events\n { key: 'marketplace.review.created', version: '1.0.0' },\n { key: 'marketplace.review.responded', version: '1.0.0' },\n ],\n\n presentations: [\n // Store\n { key: 'marketplace.store.profile', version: '1.0.0' },\n { key: 'marketplace.seller.dashboard', version: '1.0.0' },\n\n // Product\n { key: 'marketplace.product.catalog', version: '1.0.0' },\n { key: 'marketplace.product.detail', version: '1.0.0' },\n { key: 'marketplace.product.editor', version: '1.0.0' },\n\n // Order\n { key: 'marketplace.order.list', version: '1.0.0' },\n { key: 'marketplace.order.detail', version: '1.0.0' },\n { key: 'marketplace.checkout', version: '1.0.0' },\n\n // Payout\n { key: 'marketplace.payout.viewList', version: '1.0.0' },\n { key: 'marketplace.payout.detail', version: '1.0.0' },\n\n // Review\n { key: 'marketplace.review.viewList', version: '1.0.0' },\n { key: 'marketplace.review.form', version: '1.0.0' },\n ],\n\n opToPresentation: [\n {\n op: { key: 'marketplace.product.list', version: '1.0.0' },\n pres: { key: 'marketplace.product.catalog', version: '1.0.0' },\n },\n {\n op: { key: 'marketplace.order.create', version: '1.0.0' },\n pres: { key: 'marketplace.checkout', version: '1.0.0' },\n },\n {\n op: { key: 'marketplace.payout.list', version: '1.0.0' },\n pres: { key: 'marketplace.payout.viewList', version: '1.0.0' },\n },\n {\n op: { key: 'marketplace.review.list', version: '1.0.0' },\n pres: { key: 'marketplace.review.viewList', version: '1.0.0' },\n },\n {\n op: { key: 'marketplace.review.create', version: '1.0.0' },\n pres: { key: 'marketplace.review.form', version: '1.0.0' },\n },\n ],\n\n presentationsTargets: [\n {\n key: 'marketplace.store.profile',\n version: '1.0.0',\n targets: ['react', 'markdown'],\n },\n {\n key: 'marketplace.seller.dashboard',\n version: '1.0.0',\n targets: ['react'],\n },\n {\n key: 'marketplace.product.catalog',\n version: '1.0.0',\n targets: ['react', 'markdown'],\n },\n {\n key: 'marketplace.product.detail',\n version: '1.0.0',\n targets: ['react', 'markdown'],\n },\n { key: 'marketplace.product.editor', version: '1.0.0', targets: ['react'] },\n {\n key: 'marketplace.order.list',\n version: '1.0.0',\n targets: ['react', 'markdown'],\n },\n {\n key: 'marketplace.order.detail',\n version: '1.0.0',\n targets: ['react', 'markdown'],\n },\n { key: 'marketplace.checkout', version: '1.0.0', targets: ['react'] },\n {\n key: 'marketplace.payout.viewList',\n version: '1.0.0',\n targets: ['react', 'markdown'],\n },\n {\n key: 'marketplace.review.viewList',\n version: '1.0.0',\n targets: ['react', 'markdown'],\n },\n ],\n\n capabilities: {\n requires: [\n { key: 'identity', version: '1.0.0' },\n { key: 'audit-trail', version: '1.0.0' },\n { key: 'notifications', version: '1.0.0' },\n { key: 'files', version: '1.0.0' },\n { key: 'metering', version: '1.0.0' },\n ],\n provides: [\n { key: 'marketplace', version: '1.0.0' },\n { key: 'ecommerce', version: '1.0.0' },\n { key: 'payments', version: '1.0.0' },\n ],\n },\n});\n"],"mappings":";;;;;;;;;;AASA,MAAa,qBAAqB,cAAc;CAC9C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAa;GAAgB;GAAW;EAC9D,WAAW;EACZ;CAED,YAAY;EAEV;GAAE,KAAK;GAA4B,SAAS;GAAS;EAGrD;GAAE,KAAK;GAA8B,SAAS;GAAS;EACvD;GAAE,KAAK;GAA4B,SAAS;GAAS;EAGrD;GAAE,KAAK;GAA4B,SAAS;GAAS;EACrD;GAAE,KAAK;GAAkC,SAAS;GAAS;EAG3D;GAAE,KAAK;GAA2B,SAAS;GAAS;EAGpD;GAAE,KAAK;GAA6B,SAAS;GAAS;EACtD;GAAE,KAAK;GAA2B,SAAS;GAAS;EACrD;CAED,QAAQ;EAEN;GAAE,KAAK;GAA6B,SAAS;GAAS;EACtD;GAAE,KAAK;GAAmC,SAAS;GAAS;EAG5D;GAAE,KAAK;GAA+B,SAAS;GAAS;EACxD;GAAE,KAAK;GAAiC,SAAS;GAAS;EAC1D;GAAE,KAAK;GAAiC,SAAS;GAAS;EAG1D;GAAE,KAAK;GAA6B,SAAS;GAAS;EACtD;GAAE,KAAK;GAA0B,SAAS;GAAS;EACnD;GAAE,KAAK;GAAmC,SAAS;GAAS;EAC5D;GAAE,KAAK;GAA6B,SAAS;GAAS;EACtD;GAAE,KAAK;GAA+B,SAAS;GAAS;EAGxD;GAAE,KAAK;GAA8B,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Q;GACnB;EACD;GACE,KAAK;GACL,SAAS;GACT,SAAS,CAAC,SAAS,WAAW;GAC/B;EACD;GACE,KAAK;GACL,SAAS;GACT,SAAS,CAAC,SAAS,WAAW;GAC/B;EACD;GAAE,KAAK;GAA8B,SAAS;GAAS,SAAS,CAAC,QAAQ;GAAE;EAC3E;GACE,KAAK;GACL,SAAS;GACT,SAAS,CAAC,SAAS,WAAW;GAC/B;EACD;GACE,KAAK;GACL,SAAS;GACT,SAAS,CAAC,SAAS,WAAW;GAC/B;EACD;GAAE,KAAK;GAAwB,SAAS;GAAS,SAAS,CAAC,QAAQ;GAAE;EACrE;GACE,KAAK;GACL,SAAS;GACT,SAAS,CAAC,SAAS,WAAW;GAC/B;EACD;GACE,KAAK;GACL,SAAS;GACT,SAAS,CAAC,SAAS,WAAW;GAC/B;EACF;CAED,cAAc;EACZ,UAAU;GACR;IAAE,KAAK;IAAY,SAAS;IAAS;GACrC;IAAE,KAAK;IAAe,SAAS;IAAS;GACxC;IAAE,KAAK;IAAiB,SAAS;IAAS;GAC1C;IAAE,KAAK;IAAS,SAAS;IAAS;GAClC;IAAE,KAAK;IAAY,SAAS;IAAS;GACtC;EACD,UAAU;GACR;IAAE,KAAK;IAAe,SAAS;IAAS;GACxC;IAAE,KAAK;IAAa,SAAS;IAAS;GACtC;IAAE,KAAK;IAAY,SAAS;IAAS;GACtC;EACF;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"order.enum.js","names":[],"sources":["../../src/order/order.enum.ts"],"sourcesContent":["import { defineEnum } from '@contractspec/lib.schema';\n\n/**\n * Order status enum.\n */\nexport const OrderStatusEnum = defineEnum('OrderStatus', [\n 'PENDING',\n 'PAID',\n 'PROCESSING',\n 'SHIPPED',\n 'DELIVERED',\n 'COMPLETED',\n 'CANCELLED',\n 'REFUNDED',\n 'PARTIALLY_REFUNDED',\n 'DISPUTED',\n]);\n"],"mappings":";;;;;;AAKA,MAAa,kBAAkB,WAAW,eAAe;CACvD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"order.event.js","names":[],"sources":["../../src/order/order.event.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineEvent } from '@contractspec/lib.contracts';\n\nconst OrderCreatedPayload = defineSchemaModel({\n name: 'OrderCreatedEventPayload',\n fields: {\n orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orderNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n buyerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n total: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n itemCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst OrderPaidPayload = defineSchemaModel({\n name: 'OrderPaidEventPayload',\n fields: {\n orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orderNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n total: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n paymentMethod: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst OrderStatusUpdatedPayload = defineSchemaModel({\n name: 'OrderStatusUpdatedEventPayload',\n fields: {\n orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orderNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n previousStatus: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n newStatus: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n updatedBy: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst OrderShippedPayload = defineSchemaModel({\n name: 'OrderShippedEventPayload',\n fields: {\n orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orderNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n trackingNumber: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n trackingUrl: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n carrier: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst OrderCompletedPayload = defineSchemaModel({\n name: 'OrderCompletedEventPayload',\n fields: {\n orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orderNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n buyerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n total: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n sellerPayout: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const OrderCreatedEvent = defineEvent({\n meta: {\n key: 'marketplace.order.created',\n version: '1.0.0',\n description: 'A new order has been created.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'order'],\n },\n payload: OrderCreatedPayload,\n});\n\nexport const OrderPaidEvent = defineEvent({\n meta: {\n key: 'marketplace.order.paid',\n version: '1.0.0',\n description: 'An order has been paid.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'order'],\n },\n payload: OrderPaidPayload,\n});\n\nexport const OrderStatusUpdatedEvent = defineEvent({\n meta: {\n key: 'marketplace.order.statusUpdated',\n version: '1.0.0',\n description: 'An order status has been updated.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'order'],\n },\n payload: OrderStatusUpdatedPayload,\n});\n\nexport const OrderShippedEvent = defineEvent({\n meta: {\n key: 'marketplace.order.shipped',\n version: '1.0.0',\n description: 'An order has been shipped.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'order'],\n },\n payload: OrderShippedPayload,\n});\n\nexport const OrderCompletedEvent = defineEvent({\n meta: {\n key: 'marketplace.order.completed',\n version: '1.0.0',\n description: 'An order has been completed.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'order'],\n },\n payload: OrderCompletedPayload,\n});\n"],"mappings":";;;;AAGA,MAAM,sBAAsB,kBAAkB;CAC5C,MAAM;CACN,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC1E,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,OAAO;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACnE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,WAAW;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACrE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAM,mBAAmB,kBAAkB;CACzC,MAAM;CACN,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC1E,OAAO;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACnE,eAAe;GACb,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF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MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAa,oBAAoB,YAAY;CAC3C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,QAAQ;EAC/B;CACD,SAAS;CACV,CAAC;AAEF,MAAa,iBAAiB,YAAY;CACxC,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,QAAQ;EAC/B;CACD,SAAS;CACV,CAAC;AAEF,MAAa,0BAA0B,YAAY;CACjD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,QAAQ;EAC/B;CACD,SAAS;CACV,CAAC;AAEF,MAAa,oBAAoB,YAAY;CAC3C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,QAAQ;EAC/B;CACD,SAAS;CACV,CAAC;AAEF,MAAa,sBAAsB,YAAY;CAC7C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,QAAQ;EAC/B;CACD,SAAS;CACV,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"order.operations.js","names":[],"sources":["../../src/order/order.operations.ts"],"sourcesContent":["import { defineCommand } from '@contractspec/lib.contracts/operations';\nimport {\n OrderModel,\n CreateOrderInputModel,\n UpdateOrderStatusInputModel,\n} from './order.schema';\n\nconst OWNERS = ['@example.marketplace'] as const;\n\n/**\n * Create a new order.\n */\nexport const CreateOrderContract = defineCommand({\n meta: {\n key: 'marketplace.order.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['marketplace', 'order', 'create'],\n description: 'Create a new order.',\n goal: 'Allow buyers to purchase products.',\n context: 'Checkout flow.',\n },\n io: { input: CreateOrderInputModel, output: OrderModel },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'marketplace.order.created',\n version: '1.0.0',\n when: 'Order is created',\n payload: OrderModel,\n },\n ],\n audit: ['marketplace.order.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-order-happy-path',\n given: ['User is authenticated'],\n when: ['User creates order with valid items'],\n then: ['Order is created', 'OrderCreated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'create-basic-order',\n input: {\n storeId: 'store-123',\n items: [{ productId: 'prod-456', quantity: 1, unitPrice: 100 }],\n },\n output: { id: 'order-789', status: 'pending', total: 100 },\n },\n ],\n },\n});\n\n/**\n * Update order status.\n */\nexport const UpdateOrderStatusContract = defineCommand({\n meta: {\n key: 'marketplace.order.updateStatus',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['marketplace', 'order', 'status'],\n description: 'Update order status.',\n goal: 'Track order fulfillment.',\n context: 'Order management.',\n },\n io: { input: UpdateOrderStatusInputModel, output: OrderModel },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'marketplace.order.statusUpdated',\n version: '1.0.0',\n when: 'Status changes',\n payload: OrderModel,\n },\n ],\n audit: ['marketplace.order.statusUpdated'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'update-status-happy-path',\n given: ['Order exists'],\n when: ['Seller updates order status'],\n then: ['Status is updated', 'OrderStatusUpdated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'mark-shipped',\n input: {\n orderId: 'order-789',\n status: 'shipped',\n trackingNumber: 'TRACK123',\n },\n output: { id: 'order-789', status: 'shipped' },\n },\n ],\n },\n});\n"],"mappings":";;;;AAOA,MAAM,SAAS,CAAC,uBAAuB;;;;AAKvC,MAAa,sBAAsB,cAAc;CAC/C,MAAM;EACJ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AAgB;IACjB;GACD,QAAQ;IAAE,IAAI;IAAa,QAAQ;IAAW;GAC/C,CACF;EACF;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"order.presentation.js","names":[],"sources":["../../src/order/order.presentation.ts"],"sourcesContent":["import { definePresentation, StabilityEnum } from '@contractspec/lib.contracts';\nimport { OrderModel } from './order.schema';\n\nexport const OrderListPresentation = definePresentation({\n meta: {\n key: 'marketplace.order.list',\n version: '1.0.0',\n title: 'Order List',\n description: 'List of orders with status and tracking',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'order', 'list'],\n stability: StabilityEnum.Experimental,\n goal: 'Provide a comprehensive view of all orders for the user.',\n context: 'Used in the buyer and seller dashboards to track order progress.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'OrderList',\n props: OrderModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['marketplace.orders.enabled'],\n },\n});\n\nexport const OrderDetailPresentation = definePresentation({\n meta: {\n key: 'marketplace.order.detail',\n version: '1.0.0',\n title: 'Order Details',\n description: 'Order detail with items and shipping info',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'order', 'detail'],\n stability: StabilityEnum.Experimental,\n goal: 'Display all details of a single order.',\n context:\n 'Accessed from the order list to see specific items, shipping, and payment details.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'OrderDetail',\n props: OrderModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['marketplace.orders.enabled'],\n },\n});\n\nexport const CheckoutPresentation = definePresentation({\n meta: {\n key: 'marketplace.checkout',\n version: '1.0.0',\n title: 'Checkout',\n description: 'Checkout flow with cart and payment',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'checkout', 'cart'],\n stability: StabilityEnum.Experimental,\n goal: 'Guide the user through the payment and order confirmation process.',\n context: 'The final stage of the purchasing journey.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'Checkout',\n props: OrderModel,\n },\n targets: ['react'],\n policy: {\n flags: ['marketplace.checkout.enabled'],\n },\n});\n"],"mappings":";;;;AAGA,MAAa,wBAAwB,mBAAmB;CACtD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAS;GAAO;EACtC,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,6BAA6B,EACtC;CACF,CAAC;AAEF,MAAa,0BAA0B,mBAAmB;CACxD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAS;GAAS;EACxC,WAAW,cAAc;EACzB,MAAM;EACN,SACE;EACH;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,6BAA6B,EACtC;CACF,CAAC;AAEF,MAAa,uBAAuB,mBAAmB;CACrD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAY;GAAO;EACzC,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,QAAQ;CAClB,QAAQ,EACN,OAAO,CAAC,+BAA+B,EACxC;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"order.schema.js","names":[],"sources":["../../src/order/order.schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { OrderStatusEnum } from './order.enum';\n\n/**\n * An order item.\n */\nexport const OrderItemModel = defineSchemaModel({\n name: 'OrderItemModel',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n productName: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n unitPrice: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n quantity: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n subtotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n },\n});\n\n/**\n * An order.\n */\nexport const OrderModel = defineSchemaModel({\n name: 'OrderModel',\n description: 'An order',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orderNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n buyerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: OrderStatusEnum, isOptional: false },\n subtotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n shippingTotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n taxTotal: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n total: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n items: { type: OrderItemModel, isArray: true, isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Input for creating an order.\n */\nexport const CreateOrderInputModel = defineSchemaModel({\n name: 'CreateOrderInput',\n fields: {\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n items: {\n type: ScalarTypeEnum.JSON(),\n isOptional: false,\n description: 'Array of {productId, variantId?, quantity}',\n },\n shippingAddress: { type: ScalarTypeEnum.JSON(), isOptional: true },\n billingAddress: { type: ScalarTypeEnum.JSON(), isOptional: true },\n buyerNote: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\n/**\n * Input for updating order status.\n */\nexport const UpdateOrderStatusInputModel = defineSchemaModel({\n name: 'UpdateOrderStatusInput',\n fields: {\n orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: OrderStatusEnum, isOptional: false },\n trackingNumber: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n trackingUrl: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n note: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n"],"mappings":";;;;;;;AAMA,MAAa,iBAAiB,kBAAkB;CAC9C,MAAM;CACN,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC1E,WAAW;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACvE,UAAU;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACpE,UAAU;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACvE;CACF,CAAC;;;;AAKF,MAAa,aAAa,kBAAkB;CAC1C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC1E,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM;GAAiB,YAAY;GAAO;EACpD,UAAU;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACtE,eAAe;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EAC3E,UAAU;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACtE,OAAO;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACnE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,OAAO;GAAE,MAAM;GAAgB,SAAS;GAAM,YAAY;GAAM;EAChE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;;;;AAKF,MAAa,wBAAwB,kBAAkB;CACrD,MAAM;CACN,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,OAAO;GACL,MAAM,eAAe,MAAM;GAC3B,YAAY;GACZ,aAAa;GACd;EACD,iBAAiB;GAAE,MAAM,eAAe,MAAM;GAAE,YAAY;GAAM;EAClE,gBAAgB;GAAE,MAAM,eAAe,MAAM;GAAE,YAAY;GAAM;EACjE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACxE;CACF,CAAC;;;;AAKF,MAAa,8BAA8B,kBAAkB;CAC3D,MAAM;CACN,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM;GAAiB,YAAY;GAAO;EACpD,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACzE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACnE;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payout.enum.js","names":[],"sources":["../../src/payout/payout.enum.ts"],"sourcesContent":["import { defineEnum } from '@contractspec/lib.schema';\n\n/**\n * Payout status enum.\n */\nexport const PayoutStatusEnum = defineEnum('PayoutStatus', [\n 'PENDING',\n 'PROCESSING',\n 'PAID',\n 'FAILED',\n 'CANCELLED',\n]);\n"],"mappings":";;;;;;AAKA,MAAa,mBAAmB,WAAW,gBAAgB;CACzD;CACA;CACA;CACA;CACA;CACD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payout.event.js","names":[],"sources":["../../src/payout/payout.event.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineEvent } from '@contractspec/lib.contracts';\n\nconst PayoutCreatedPayload = defineSchemaModel({\n name: 'PayoutCreatedEventPayload',\n fields: {\n payoutId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n payoutNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n netAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n orderCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst PayoutPaidPayload = defineSchemaModel({\n name: 'PayoutPaidEventPayload',\n fields: {\n payoutId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n payoutNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n netAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n paymentReference: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const PayoutCreatedEvent = defineEvent({\n meta: {\n key: 'marketplace.payout.created',\n version: '1.0.0',\n description: 'A payout has been created.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'payout'],\n },\n payload: PayoutCreatedPayload,\n});\n\nexport const PayoutPaidEvent = defineEvent({\n meta: {\n key: 'marketplace.payout.paid',\n version: '1.0.0',\n description: 'A payout has been sent.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'payout'],\n },\n payload: PayoutPaidPayload,\n});\n"],"mappings":";;;;AAGA,MAAM,uBAAuB,kBAAkB;CAC7C,MAAM;CACN,QAAQ;EACN,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,WAAW;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACvE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,YAAY;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACtE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAM,oBAAoB,kBAAkB;CAC1C,MAAM;CACN,QAAQ;EACN,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,WAAW;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACvE,kBAAkB;GAChB,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAa,qBAAqB,YAAY;CAC5C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,SAAS;EAChC;CACD,SAAS;CACV,CAAC;AAEF,MAAa,kBAAkB,YAAY;CACzC,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,SAAS;EAChC;CACD,SAAS;CACV,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payout.operations.js","names":[],"sources":["../../src/payout/payout.operations.ts"],"sourcesContent":["import { defineQuery } from '@contractspec/lib.contracts/operations';\nimport { ListPayoutsInputModel, ListPayoutsOutputModel } from './payout.schema';\n\nconst OWNERS = ['@example.marketplace'] as const;\n\n/**\n * List payouts for a store.\n */\nexport const ListPayoutsContract = defineQuery({\n meta: {\n key: 'marketplace.payout.list',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['marketplace', 'payout', 'list'],\n description: 'List payouts for a store.',\n goal: 'View payout history.',\n context: 'Seller dashboard.',\n },\n io: { input: ListPayoutsInputModel, output: ListPayoutsOutputModel },\n policy: { auth: 'user' },\n acceptance: {\n scenarios: [\n {\n key: 'list-payouts-happy-path',\n given: ['Store has payout history'],\n when: ['Seller lists payouts'],\n then: ['List of payouts is returned'],\n },\n ],\n examples: [\n {\n key: 'list-recent',\n input: { limit: 10, offset: 0 },\n output: { items: [], total: 5, hasMore: false },\n },\n ],\n },\n});\n"],"mappings":";;;;AAGA,MAAM,SAAS,CAAC,uBAAuB;;;;AAKvC,MAAa,sBAAsB,YAAY;CAC7C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAe;GAAU;GAAO;EACvC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAAuB,QAAQ;EAAwB;CACpE,QAAQ,EAAE,MAAM,QAAQ;CACxB,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,2BAA2B;GACnC,MAAM,CAAC,uBAAuB;GAC9B,MAAM,CAAC,8BAA8B;GACtC,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IAAE,OAAO;IAAI,QAAQ;IAAG;GAC/B,QAAQ;IAAE,OAAO,EAAE;IAAE,OAAO;IAAG,SAAS;IAAO;GAChD,CACF;EACF;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payout.presentation.js","names":[],"sources":["../../src/payout/payout.presentation.ts"],"sourcesContent":["import { definePresentation, StabilityEnum } from '@contractspec/lib.contracts';\nimport { PayoutModel } from './payout.schema';\n\nexport const PayoutListPresentation = definePresentation({\n meta: {\n key: 'marketplace.payout.viewList',\n version: '1.0.0',\n title: 'Payout List',\n description: 'List of payouts for sellers',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'payout', 'list'],\n stability: StabilityEnum.Experimental,\n goal: 'Show sellers their historical and pending payouts.',\n context: 'Financial dashboard for sellers.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'PayoutList',\n props: PayoutModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['marketplace.payouts.enabled'],\n },\n});\n\nexport const PayoutDetailPresentation = definePresentation({\n meta: {\n key: 'marketplace.payout.detail',\n version: '1.0.0',\n title: 'Payout Details',\n description: 'Payout detail with breakdown',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'payout', 'detail'],\n stability: StabilityEnum.Experimental,\n goal: 'Show the breakdown of a specific payout including fees and orders.',\n context: 'Accessed from the payout list.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'PayoutDetail',\n props: PayoutModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['marketplace.payouts.enabled'],\n },\n});\n"],"mappings":";;;;AAGA,MAAa,yBAAyB,mBAAmB;CACvD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAU;GAAO;EACvC,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,8BAA8B,EACvC;CACF,CAAC;AAEF,MAAa,2BAA2B,mBAAmB;CACzD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAU;GAAS;EACzC,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,8BAA8B,EACvC;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"payout.schema.js","names":[],"sources":["../../src/payout/payout.schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { PayoutStatusEnum } from './payout.enum';\n\n/**\n * A payout to seller.\n */\nexport const PayoutModel = defineSchemaModel({\n name: 'PayoutModel',\n description: 'A payout to seller',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n payoutNumber: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: PayoutStatusEnum, isOptional: false },\n grossAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n platformFees: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n netAmount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n periodStart: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n periodEnd: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n orderCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n paidAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n },\n});\n\n/**\n * Input for listing payouts.\n */\nexport const ListPayoutsInputModel = defineSchemaModel({\n name: 'ListPayoutsInput',\n fields: {\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n status: { type: PayoutStatusEnum, isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 20,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n});\n\n/**\n * Output for listing payouts.\n */\nexport const ListPayoutsOutputModel = defineSchemaModel({\n name: 'ListPayoutsOutput',\n fields: {\n payouts: { type: PayoutModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n totalPending: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n },\n});\n"],"mappings":";;;;;;;AAMA,MAAa,cAAc,kBAAkB;CAC3C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,cAAc;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EAC3E,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM;GAAkB,YAAY;GAAO;EACrD,aAAa;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACzE,cAAc;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EAC1E,WAAW;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACvE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,aAAa;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACnE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACjE,YAAY;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACtE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EACjE,QAAQ;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAM;EAC9D;CACF,CAAC;;;;AAKF,MAAa,wBAAwB,kBAAkB;CACrD,MAAM;CACN,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,QAAQ;GAAE,MAAM;GAAkB,YAAY;GAAM;EACpD,OAAO;GACL,MAAM,eAAe,cAAc;GACnC,YAAY;GACZ,cAAc;GACf;EACD,QAAQ;GACN,MAAM,eAAe,cAAc;GACnC,YAAY;GACZ,cAAc;GACf;EACF;CACF,CAAC;;;;AAKF,MAAa,yBAAyB,kBAAkB;CACtD,MAAM;CACN,QAAQ;EACN,SAAS;GAAE,MAAM;GAAa,SAAS;GAAM,YAAY;GAAO;EAChE,OAAO;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACjE,cAAc;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EAC3E;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"product.enum.js","names":[],"sources":["../../src/product/product.enum.ts"],"sourcesContent":["import { defineEnum } from '@contractspec/lib.schema';\n\n/**\n * Product status enum.\n */\nexport const ProductStatusEnum = defineEnum('ProductStatus', [\n 'DRAFT',\n 'PENDING_REVIEW',\n 'ACTIVE',\n 'OUT_OF_STOCK',\n 'DISCONTINUED',\n 'REJECTED',\n]);\n"],"mappings":";;;;;;AAKA,MAAa,oBAAoB,WAAW,iBAAiB;CAC3D;CACA;CACA;CACA;CACA;CACA;CACD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"product.event.js","names":[],"sources":["../../src/product/product.event.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineEvent } from '@contractspec/lib.contracts';\n\nconst ProductCreatedPayload = defineSchemaModel({\n name: 'ProductCreatedEventPayload',\n fields: {\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n price: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst ProductPublishedPayload = defineSchemaModel({\n name: 'ProductPublishedEventPayload',\n fields: {\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst InventoryUpdatedPayload = defineSchemaModel({\n name: 'InventoryUpdatedEventPayload',\n fields: {\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n variantId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n previousQuantity: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: false,\n },\n newQuantity: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const ProductCreatedEvent = defineEvent({\n meta: {\n key: 'marketplace.product.created',\n version: '1.0.0',\n description: 'A new product has been created.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'product'],\n },\n payload: ProductCreatedPayload,\n});\n\nexport const ProductPublishedEvent = defineEvent({\n meta: {\n key: 'marketplace.product.published',\n version: '1.0.0',\n description: 'A product has been published.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'product'],\n },\n payload: ProductPublishedPayload,\n});\n\nexport const InventoryUpdatedEvent = defineEvent({\n meta: {\n key: 'marketplace.inventory.updated',\n version: '1.0.0',\n description: 'Product inventory has been updated.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'product', 'inventory'],\n },\n payload: InventoryUpdatedPayload,\n});\n"],"mappings":";;;;AAGA,MAAM,wBAAwB,kBAAkB;CAC9C,MAAM;CACN,QAAQ;EACN,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,OAAO;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EACnE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAM,0BAA0B,kBAAkB;CAChD,MAAM;CACN,QAAQ;EACN,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAM,0BAA0B,kBAAkB;CAChD,MAAM;CACN,QAAQ;EACN,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACvE,kBAAkB;GAChB,MAAM,eAAe,cAAc;GACnC,YAAY;GACb;EACD,aAAa;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACvE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACrE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAa,sBAAsB,YAAY;CAC7C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,UAAU;EACjC;CACD,SAAS;CACV,CAAC;AAEF,MAAa,wBAAwB,YAAY;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,UAAU;EACjC;CACD,SAAS;CACV,CAAC;AAEF,MAAa,wBAAwB,YAAY;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAW;GAAY;EAC9C;CACD,SAAS;CACV,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"product.operations.js","names":[],"sources":["../../src/product/product.operations.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport {\n CreateProductInputModel,\n ListProductsInputModel,\n ListProductsOutputModel,\n ProductModel,\n} from './product.schema';\n\nconst OWNERS = ['@example.marketplace'] as const;\n\n/**\n * Create a new product listing.\n */\nexport const CreateProductContract = defineCommand({\n meta: {\n key: 'marketplace.product.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['marketplace', 'product', 'create'],\n description: 'Create a new product listing.',\n goal: 'Allow sellers to list products.',\n context: 'Product management.',\n },\n io: { input: CreateProductInputModel, output: ProductModel },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'marketplace.product.created',\n version: '1.0.0',\n when: 'Product is created',\n payload: ProductModel,\n },\n ],\n audit: ['marketplace.product.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-product-happy-path',\n given: ['User is a seller'],\n when: ['User creates a product listing'],\n then: ['Product is created', 'ProductCreated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'create-t-shirt',\n input: {\n title: 'Classic T-Shirt',\n price: 25,\n stock: 100,\n storeId: 'store-123',\n },\n output: {\n id: 'prod-456',\n title: 'Classic T-Shirt',\n status: 'published',\n },\n },\n ],\n },\n});\n\n/**\n * List products with filters.\n */\nexport const ListProductsContract = defineQuery({\n meta: {\n key: 'marketplace.product.list',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['marketplace', 'product', 'list'],\n description: 'List products with filters.',\n goal: 'Browse products on the marketplace.',\n context: 'Product catalog, search.',\n },\n io: { input: ListProductsInputModel, output: ListProductsOutputModel },\n policy: { auth: 'anonymous' },\n acceptance: {\n scenarios: [\n {\n key: 'list-products-happy-path',\n given: ['Products exist'],\n when: ['User searches for products'],\n then: ['List of products is returned'],\n },\n ],\n examples: [\n {\n key: 'search-t-shirts',\n input: { search: 't-shirt', limit: 20 },\n output: { items: [], total: 50, hasMore: true },\n },\n ],\n },\n});\n"],"mappings":";;;;AAWA,MAAM,SAAS,CAAC,uBAAuB;;;;AAKvC,MAAa,wBAAwB,cAAc;CACjD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAe;GAAW;GAAS;EAC1C,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAAyB,QAAQ;EAAc;CAC5D,QAAQ,EAAE,MAAM,QAAQ;CACxB,aAAa;EACX,OAAO,CACL;GACE,KAAK;GACL,SAAS;GACT,MAAM;GACN,SAAS;GACV,CACF;EACD,OAAO,CAAC,8BAA8B;EACvC;CACD,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,mBAAmB;GAC3B,MAAM,CAAC,iCAAiC;GACxC,MAAM,CAAC,sBAAsB,kCAAkC;GAChE,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IACL,OAAO;IACP,OAAO;IACP,OAAO;IACP,SAAS;IACV;GACD,QAAQ;IACN,IAAI;IACJ,OAAO;IACP,QAAQ;IACT;GACF,CACF;EACF;CACF,CAAC;;;;AAKF,MAAa,uBAAuB,YAAY;CAC9C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAe;GAAW;GAAO;EACxC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAAwB,QAAQ;EAAyB;CACtE,QAAQ,EAAE,MAAM,aAAa;CAC7B,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,iBAAiB;GACzB,MAAM,CAAC,6BAA6B;GACpC,MAAM,CAAC,+BAA+B;GACvC,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IAAE,QAAQ;IAAW,OAAO;IAAI;GACvC,QAAQ;IAAE,OAAO,EAAE;IAAE,OAAO;IAAI,SAAS;IAAM;GAChD,CACF;EACF;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"product.presentation.js","names":[],"sources":["../../src/product/product.presentation.ts"],"sourcesContent":["import { definePresentation, StabilityEnum } from '@contractspec/lib.contracts';\nimport { ProductModel } from './product.schema';\n\nexport const ProductCatalogPresentation = definePresentation({\n meta: {\n key: 'marketplace.product.catalog',\n version: '1.0.0',\n title: 'Product Catalog',\n description: 'Product catalog with search and filters',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'product', 'catalog'],\n stability: StabilityEnum.Experimental,\n goal: 'Enable users to browse and search for products.',\n context: 'The primary shopping interface.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ProductCatalog',\n props: ProductModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['marketplace.products.enabled'],\n },\n});\n\nexport const ProductDetailPresentation = definePresentation({\n meta: {\n key: 'marketplace.product.detail',\n version: '1.0.0',\n title: 'Product Details',\n description: 'Product detail page with images and reviews',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'product', 'detail'],\n stability: StabilityEnum.Experimental,\n goal: 'Provide comprehensive information about a specific product.',\n context: 'Product showcase including images, descriptions, and ratings.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ProductDetail',\n props: ProductModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['marketplace.products.enabled'],\n },\n});\n\nexport const ProductEditorPresentation = definePresentation({\n meta: {\n key: 'marketplace.product.editor',\n version: '1.0.0',\n title: 'Product Editor',\n description: 'Product editor for sellers',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'product', 'editor'],\n stability: StabilityEnum.Experimental,\n goal: 'Allow sellers to create and modify product listings.',\n context: 'Management tool for store owners.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ProductEditor',\n props: ProductModel,\n },\n targets: ['react'],\n policy: {\n flags: ['marketplace.seller.enabled'],\n },\n});\n"],"mappings":";;;;AAGA,MAAa,6BAA6B,mBAAmB;CAC3D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAW;GAAU;EAC3C,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,+BAA+B,EACxC;CACF,CAAC;AAEF,MAAa,4BAA4B,mBAAmB;CAC1D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAW;GAAS;EAC1C,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,+BAA+B,EACxC;CACF,CAAC;AAEF,MAAa,4BAA4B,mBAAmB;CAC1D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAW;GAAS;EAC1C,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,QAAQ;CAClB,QAAQ,EACN,OAAO,CAAC,6BAA6B,EACtC;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"product.schema.js","names":[],"sources":["../../src/product/product.schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { ProductStatusEnum } from './product.enum';\n\n/**\n * A product listing.\n */\nexport const ProductModel = defineSchemaModel({\n name: 'ProductModel',\n description: 'A product listing',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n status: { type: ProductStatusEnum, isOptional: false },\n price: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n quantity: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n categoryId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n primaryImageId: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n averageRating: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n totalSold: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Input for creating a product.\n */\nexport const CreateProductInputModel = defineSchemaModel({\n name: 'CreateProductInput',\n fields: {\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n slug: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n price: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n quantity: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n categoryId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n sku: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\n/**\n * Input for listing products.\n */\nexport const ListProductsInputModel = defineSchemaModel({\n name: 'ListProductsInput',\n fields: {\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n categoryId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n status: { type: ProductStatusEnum, isOptional: true },\n search: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n minPrice: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n maxPrice: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 20,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n});\n\n/**\n * Output for listing products.\n */\nexport const ListProductsOutputModel = defineSchemaModel({\n name: 'ListProductsOutput',\n fields: {\n products: { type: ProductModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n },\n});\n"],"mappings":";;;;;;;AAMA,MAAa,eAAe,kBAAkB;CAC5C,MAAM;CACN,aAAa;CACb,QA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AY;GAAM;EACnE,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACxE,KAAK;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EAClE;CACF,CAAC;;;;AAKF,MAAa,yBAAyB,kBAAkB;CACtD,MAAM;CACN,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACrE,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACxE,QAAQ;GAAE,MAAM;GAAmB,YAAY;GAAM;EACrD,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACpE,UAAU;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAM;EACrE,UAAU;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAM;EACrE,OAAO;GACL,MAAM,eAAe,cAAc;GACnC,YAAY;GACZ,cAAc;GACf;EACD,QAAQ;GACN,MAAM,eAAe,cAAc;GACnC,YAAY;GACZ,cAAc;GACf;EACF;CACF,CAAC;;;;AAKF,MAAa,0BAA0B,kBAAkB;CACvD,MAAM;CACN,QAAQ;EACN,UAAU;GAAE,MAAM;GAAc,SAAS;GAAM,YAAY;GAAO;EAClE,OAAO;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EAClE;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"review.enum.js","names":[],"sources":["../../src/review/review.enum.ts"],"sourcesContent":["import { defineEnum } from '@contractspec/lib.schema';\n\n/**\n * Review status enum.\n */\nexport const ReviewStatusEnum = defineEnum('ReviewStatus', [\n 'PENDING',\n 'APPROVED',\n 'REJECTED',\n 'FLAGGED',\n]);\n"],"mappings":";;;;;;AAKA,MAAa,mBAAmB,WAAW,gBAAgB;CACzD;CACA;CACA;CACA;CACD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"review.event.js","names":[],"sources":["../../src/review/review.event.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineEvent } from '@contractspec/lib.contracts';\n\nconst ReviewCreatedPayload = defineSchemaModel({\n name: 'ReviewCreatedEventPayload',\n fields: {\n reviewId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n authorId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n rating: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n isVerifiedPurchase: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst ReviewRespondedPayload = defineSchemaModel({\n name: 'ReviewRespondedEventPayload',\n fields: {\n reviewId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n responseId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n authorId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const ReviewCreatedEvent = defineEvent({\n meta: {\n key: 'marketplace.review.created',\n version: '1.0.0',\n description: 'A review has been created.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'review'],\n },\n payload: ReviewCreatedPayload,\n});\n\nexport const ReviewRespondedEvent = defineEvent({\n meta: {\n key: 'marketplace.review.responded',\n version: '1.0.0',\n description: 'A seller has responded to a review.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'review'],\n },\n payload: ReviewRespondedPayload,\n});\n"],"mappings":";;;;AAGA,MAAM,uBAAuB,kBAAkB;CAC7C,MAAM;CACN,QAAQ;EACN,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACvE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACrE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,QAAQ;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EAClE,oBAAoB;GAAE,MAAM,eAAe,SAAS;GAAE,YAAY;GAAO;EACzE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAM,yBAAyB,kBAAkB;CAC/C,MAAM;CACN,QAAQ;EACN,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACzE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAa,qBAAqB,YAAY;CAC5C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,SAAS;EAChC;CACD,SAAS;CACV,CAAC;AAEF,MAAa,uBAAuB,YAAY;CAC9C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,SAAS;EAChC;CACD,SAAS;CACV,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"review.operations.js","names":[],"sources":["../../src/review/review.operations.ts"],"sourcesContent":["import {\n defineCommand,\n defineQuery,\n} from '@contractspec/lib.contracts/operations';\nimport {\n CreateReviewInputModel,\n ListReviewsInputModel,\n ListReviewsOutputModel,\n ReviewModel,\n} from './review.schema';\n\nconst OWNERS = ['@example.marketplace'] as const;\n\n/**\n * Create a product/store review.\n */\nexport const CreateReviewContract = defineCommand({\n meta: {\n key: 'marketplace.review.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['marketplace', 'review', 'create'],\n description: 'Create a product/store review.',\n goal: 'Allow buyers to leave feedback.',\n context: 'Post-purchase.',\n },\n io: { input: CreateReviewInputModel, output: ReviewModel },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'marketplace.review.created',\n version: '1.0.0',\n when: 'Review is created',\n payload: ReviewModel,\n },\n ],\n audit: ['marketplace.review.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-review-happy-path',\n given: ['User purchased product'],\n when: ['User leaves a review'],\n then: ['Review is created', 'ReviewCreated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'create-5-star',\n input: { productId: 'prod-456', rating: 5, comment: 'Great product!' },\n output: { id: 'rev-789', status: 'published' },\n },\n ],\n },\n});\n\n/**\n * List reviews with filters.\n */\nexport const ListReviewsContract = defineQuery({\n meta: {\n key: 'marketplace.review.list',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['marketplace', 'review', 'list'],\n description: 'List reviews with filters.',\n goal: 'Display product/store reviews.',\n context: 'Product page, store page.',\n },\n io: { input: ListReviewsInputModel, output: ListReviewsOutputModel },\n policy: { auth: 'anonymous' },\n acceptance: {\n scenarios: [\n {\n key: 'list-reviews-happy-path',\n given: ['Product has reviews'],\n when: ['User views reviews'],\n then: ['List of reviews is returned'],\n },\n ],\n examples: [\n {\n key: 'list-product-reviews',\n input: { productId: 'prod-456', limit: 10 },\n output: { items: [], total: 10, hasMore: false },\n },\n ],\n },\n});\n"],"mappings":";;;;AAWA,MAAM,SAAS,CAAC,uBAAuB;;;;AAKvC,MAAa,uBAAuB,cAAc;CAChD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAe;GAAU;GAAS;EACzC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAAwB,QAAQ;EAAa;CAC1D,QAAQ,EAAE,MAAM,QAAQ;CACxB,aAAa;EACX,OAAO,CACL;GACE,KAAK;GACL,SAAS;GACT,MAAM;GACN,SAAS;GACV,CACF;EACD,OAAO,CAAC,6BAA6B;EACtC;CACD,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,yBAAyB;GACjC,MAAM,CAAC,uBAAuB;GAC9B,MAAM,CAAC,qBAAqB,iCAAiC;GAC9D,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IAAE,WAAW;IAAY,QAAQ;IAAG,SAAS;IAAkB;GACtE,QAAQ;IAAE,IAAI;IAAW,QAAQ;IAAa;GAC/C,CACF;EACF;CACF,CAAC;;;;AAKF,MAAa,sBAAsB,YAAY;CAC7C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAe;GAAU;GAAO;EACvC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAAuB,QAAQ;EAAwB;CACpE,QAAQ,EAAE,MAAM,aAAa;CAC7B,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,sBAAsB;GAC9B,MAAM,CAAC,qBAAqB;GAC5B,MAAM,CAAC,8BAA8B;GACtC,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IAAE,WAAW;IAAY,OAAO;IAAI;GAC3C,QAAQ;IAAE,OAAO,EAAE;IAAE,OAAO;IAAI,SAAS;IAAO;GACjD,CACF;EACF;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"review.presentation.js","names":[],"sources":["../../src/review/review.presentation.ts"],"sourcesContent":["import { definePresentation, StabilityEnum } from '@contractspec/lib.contracts';\nimport { ReviewModel } from './review.schema';\n\nexport const ReviewListPresentation = definePresentation({\n meta: {\n key: 'marketplace.review.viewList',\n version: '1.0.0',\n title: 'Review List',\n description: 'List of product reviews',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'review', 'list'],\n stability: StabilityEnum.Experimental,\n goal: 'Show users reviews and ratings for a product.',\n context: 'Displayed on the product detail page.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ReviewList',\n props: ReviewModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['marketplace.reviews.enabled'],\n },\n});\n\nexport const ReviewFormPresentation = definePresentation({\n meta: {\n key: 'marketplace.review.form',\n version: '1.0.0',\n title: 'Review Form',\n description: 'Form for submitting product reviews',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'review', 'form'],\n stability: StabilityEnum.Experimental,\n goal: 'Enable users to submit their feedback and rating for a purchase.',\n context: 'Used in the user order history or product page.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'ReviewForm',\n props: ReviewModel,\n },\n targets: ['react'],\n policy: {\n flags: ['marketplace.reviews.enabled'],\n },\n});\n"],"mappings":";;;;AAGA,MAAa,yBAAyB,mBAAmB;CACvD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAU;GAAO;EACvC,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,8BAA8B,EACvC;CACF,CAAC;AAEF,MAAa,yBAAyB,mBAAmB;CACvD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAU;GAAO;EACvC,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,QAAQ;CAClB,QAAQ,EACN,OAAO,CAAC,8BAA8B,EACvC;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"review.schema.js","names":[],"sources":["../../src/review/review.schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { ReviewStatusEnum } from './review.enum';\n\n/**\n * A customer review.\n */\nexport const ReviewModel = defineSchemaModel({\n name: 'ReviewModel',\n description: 'A customer review',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n authorId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n rating: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n title: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n content: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n status: { type: ReviewStatusEnum, isOptional: false },\n isVerifiedPurchase: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n helpfulCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n hasResponse: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Input for creating a review.\n */\nexport const CreateReviewInputModel = defineSchemaModel({\n name: 'CreateReviewInput',\n fields: {\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n orderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n rating: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n title: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n content: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n\n/**\n * Input for listing reviews.\n */\nexport const ListReviewsInputModel = defineSchemaModel({\n name: 'ListReviewsInput',\n fields: {\n productId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n status: { type: ReviewStatusEnum, isOptional: true },\n minRating: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },\n limit: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 20,\n },\n offset: {\n type: ScalarTypeEnum.Int_unsecure(),\n isOptional: true,\n defaultValue: 0,\n },\n },\n});\n\n/**\n * Output for listing reviews.\n */\nexport const ListReviewsOutputModel = defineSchemaModel({\n name: 'ListReviewsOutput',\n fields: {\n reviews: { type: ReviewModel, isArray: true, isOptional: false },\n total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n averageRating: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n ratingDistribution: { type: ScalarTypeEnum.JSON(), isOptional: false },\n },\n});\n"],"mappings":";;;;;;;AAMA,MAAa,cAAc,kBAAkB;CAC3C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACvE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACrE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACvE,QAAQ;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EAClE,OAAO;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACnE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACrE,QAAQ;GAAE,MAAM;GAAkB,YAAY;GAAO;EACrD,oBAAoB;GAAE,MAAM,eAAe,SAAS;GAAE,YAAY;GAAO;EACzE,cAAc;GAAE,MAAM,eAAe,cAAc;GAAE,Y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O;EACvE;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/seeders/index.ts"],"sourcesContent":["import type { DatabasePort } from '@contractspec/lib.runtime-sandbox';\n\nexport async function seedMarketplace(params: {\n projectId: string;\n db: DatabasePort;\n}) {\n const { projectId, db } = params;\n\n const existing = await db.query(\n `SELECT COUNT(*) as count FROM marketplace_store WHERE \"projectId\" = $1`,\n [projectId]\n );\n if ((existing.rows[0]?.count as number) > 0) return;\n\n await db.execute(\n `INSERT INTO marketplace_store (id, \"projectId\", \"organizationId\", name, description, status)\n VALUES ($1, $2, $3, $4, $5, $6)`,\n ['store_1', projectId, 'org_demo', 'Demo Store', 'A demo store', 'ACTIVE']\n );\n}\n"],"mappings":";AAEA,eAAsB,gBAAgB,QAGnC;CACD,MAAM,EAAE,WAAW,OAAO;AAM1B,MAJiB,MAAM,GAAG,MACxB,0EACA,CAAC,UAAU,CACZ,EACa,KAAK,IAAI,QAAmB,EAAG;AAE7C,OAAM,GAAG,QACP;uCAEA;EAAC;EAAW;EAAW;EAAY;EAAc;EAAgB;EAAS,CAC3E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.enum.js","names":[],"sources":["../../src/store/store.enum.ts"],"sourcesContent":["import { defineEnum } from '@contractspec/lib.schema';\n\n/**\n * Store status enum.\n */\nexport const StoreStatusEnum = defineEnum('StoreStatus', [\n 'PENDING',\n 'ACTIVE',\n 'SUSPENDED',\n 'CLOSED',\n]);\n"],"mappings":";;;;;;AAKA,MAAa,kBAAkB,WAAW,eAAe;CACvD;CACA;CACA;CACA;CACD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.event.js","names":[],"sources":["../../src/store/store.event.ts"],"sourcesContent":["import { ScalarTypeEnum, defineSchemaModel } from '@contractspec/lib.schema';\nimport { defineEvent } from '@contractspec/lib.contracts';\n\nconst StoreCreatedPayload = defineSchemaModel({\n name: 'StoreCreatedEventPayload',\n fields: {\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nconst StoreStatusChangedPayload = defineSchemaModel({\n name: 'StoreStatusChangedEventPayload',\n fields: {\n storeId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n previousStatus: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: false,\n },\n newStatus: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n reason: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n timestamp: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const StoreCreatedEvent = defineEvent({\n meta: {\n key: 'marketplace.store.created',\n version: '1.0.0',\n description: 'A new seller store has been created.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'store'],\n },\n payload: StoreCreatedPayload,\n});\n\nexport const StoreStatusChangedEvent = defineEvent({\n meta: {\n key: 'marketplace.store.statusChanged',\n version: '1.0.0',\n description: 'A store status has changed.',\n stability: 'experimental',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'store'],\n },\n payload: StoreStatusChangedPayload,\n});\n"],"mappings":";;;;AAGA,MAAM,sBAAsB,kBAAkB;CAC5C,MAAM;CACN,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAM,4BAA4B,kBAAkB;CAClD,MAAM;CACN,QAAQ;EACN,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,gBAAgB;GACd,MAAM,eAAe,iBAAiB;GACtC,YAAY;GACb;EACD,WAAW;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACxE,QAAQ;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACpE,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;AAEF,MAAa,oBAAoB,YAAY;CAC3C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,QAAQ;EAC/B;CACD,SAAS;CACV,CAAC;AAEF,MAAa,0BAA0B,YAAY;CACjD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,aAAa;EACb,WAAW;EACX,QAAQ,CAAC,oBAAoB;EAC7B,MAAM,CAAC,eAAe,QAAQ;EAC/B;CACD,SAAS;CACV,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.operations.js","names":[],"sources":["../../src/store/store.operations.ts"],"sourcesContent":["import { defineCommand } from '@contractspec/lib.contracts/operations';\nimport { StoreModel, CreateStoreInputModel } from './store.schema';\n\nconst OWNERS = ['@example.marketplace'] as const;\n\n/**\n * Create a new seller store.\n */\nexport const CreateStoreContract = defineCommand({\n meta: {\n key: 'marketplace.store.create',\n version: '1.0.0',\n stability: 'stable',\n owners: [...OWNERS],\n tags: ['marketplace', 'store', 'create'],\n description: 'Create a new seller store.',\n goal: 'Allow users to become sellers on the marketplace.',\n context: 'Seller onboarding.',\n },\n io: { input: CreateStoreInputModel, output: StoreModel },\n policy: { auth: 'user' },\n sideEffects: {\n emits: [\n {\n key: 'marketplace.store.created',\n version: '1.0.0',\n when: 'Store is created',\n payload: StoreModel,\n },\n ],\n audit: ['marketplace.store.created'],\n },\n acceptance: {\n scenarios: [\n {\n key: 'create-store-happy-path',\n given: ['User is authenticated'],\n when: ['User creates a new store'],\n then: ['Store is created', 'StoreCreated event is emitted'],\n },\n ],\n examples: [\n {\n key: 'create-fashion-store',\n input: { name: 'Fashion Boutique', category: 'clothing' },\n output: { id: 'store-123', status: 'active' },\n },\n ],\n },\n});\n"],"mappings":";;;;AAGA,MAAM,SAAS,CAAC,uBAAuB;;;;AAKvC,MAAa,sBAAsB,cAAc;CAC/C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,GAAG,OAAO;EACnB,MAAM;GAAC;GAAe;GAAS;GAAS;EACxC,aAAa;EACb,MAAM;EACN,SAAS;EACV;CACD,IAAI;EAAE,OAAO;EAAuB,QAAQ;EAAY;CACxD,QAAQ,EAAE,MAAM,QAAQ;CACxB,aAAa;EACX,OAAO,CACL;GACE,KAAK;GACL,SAAS;GACT,MAAM;GACN,SAAS;GACV,CACF;EACD,OAAO,CAAC,4BAA4B;EACrC;CACD,YAAY;EACV,WAAW,CACT;GACE,KAAK;GACL,OAAO,CAAC,wBAAwB;GAChC,MAAM,CAAC,2BAA2B;GAClC,MAAM,CAAC,oBAAoB,gCAAgC;GAC5D,CACF;EACD,UAAU,CACR;GACE,KAAK;GACL,OAAO;IAAE,MAAM;IAAoB,UAAU;IAAY;GACzD,QAAQ;IAAE,IAAI;IAAa,QAAQ;IAAU;GAC9C,CACF;EACF;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.presentation.js","names":[],"sources":["../../src/store/store.presentation.ts"],"sourcesContent":["import { definePresentation, StabilityEnum } from '@contractspec/lib.contracts';\nimport { StoreModel } from './store.schema';\n\nexport const StoreProfilePresentation = definePresentation({\n meta: {\n key: 'marketplace.store.profile',\n version: '1.0.0',\n title: 'Store Profile',\n description: 'Public store profile page',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'store', 'profile'],\n stability: StabilityEnum.Experimental,\n goal: 'Showcase a seller store with its products and reputation.',\n context: 'The public landing page for a marketplace seller.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'StoreProfile',\n props: StoreModel,\n },\n targets: ['react', 'markdown'],\n policy: {\n flags: ['marketplace.stores.enabled'],\n },\n});\n\nexport const SellerDashboardPresentation = definePresentation({\n meta: {\n key: 'marketplace.seller.dashboard',\n version: '1.0.0',\n title: 'Seller Dashboard',\n description: 'Seller dashboard with sales and analytics',\n domain: 'marketplace',\n owners: ['@marketplace-team'],\n tags: ['marketplace', 'seller', 'dashboard'],\n stability: StabilityEnum.Experimental,\n goal: 'Provide sellers with an overview of their business performance.',\n context: 'The primary workspace for store owners.',\n },\n source: {\n type: 'component',\n framework: 'react',\n componentKey: 'SellerDashboard',\n props: StoreModel,\n },\n targets: ['react'],\n policy: {\n flags: ['marketplace.seller.enabled'],\n },\n});\n"],"mappings":";;;;AAGA,MAAa,2BAA2B,mBAAmB;CACzD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAS;GAAU;EACzC,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,SAAS,WAAW;CAC9B,QAAQ,EACN,OAAO,CAAC,6BAA6B,EACtC;CACF,CAAC;AAEF,MAAa,8BAA8B,mBAAmB;CAC5D,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aAAa;EACb,QAAQ;EACR,QAAQ,CAAC,oBAAoB;EAC7B,MAAM;GAAC;GAAe;GAAU;GAAY;EAC5C,WAAW,cAAc;EACzB,MAAM;EACN,SAAS;EACV;CACD,QAAQ;EACN,MAAM;EACN,WAAW;EACX,cAAc;EACd,OAAO;EACR;CACD,SAAS,CAAC,QAAQ;CAClB,QAAQ,EACN,OAAO,CAAC,6BAA6B,EACtC;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.schema.js","names":[],"sources":["../../src/store/store.schema.ts"],"sourcesContent":["import { defineSchemaModel, ScalarTypeEnum } from '@contractspec/lib.schema';\nimport { StoreStatusEnum } from './store.enum';\n\n/**\n * A seller store.\n */\nexport const StoreModel = defineSchemaModel({\n name: 'StoreModel',\n description: 'A seller store',\n fields: {\n id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n status: { type: StoreStatusEnum, isOptional: false },\n ownerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },\n logoFileId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n isVerified: { type: ScalarTypeEnum.Boolean(), isOptional: false },\n totalProducts: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },\n averageRating: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\n/**\n * Input for creating a store.\n */\nexport const CreateStoreInputModel = defineSchemaModel({\n name: 'CreateStoreInput',\n fields: {\n name: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n slug: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n email: { type: ScalarTypeEnum.EmailAddress(), isOptional: true },\n country: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n currency: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n },\n});\n"],"mappings":";;;;;;;AAMA,MAAa,aAAa,kBAAkB;CAC1C,MAAM;CACN,aAAa;CACb,QAAQ;EACN,IAAI;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACjE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,MAAM;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACnE,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACzE,QAAQ;GAAE,MAAM;GAAiB,YAAY;GAAO;EACpD,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAO;EACtE,YAAY;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACxE,YAAY;GAAE,MAAM,eAAe,SAAS;GAAE,YAAY;GAAO;EACjE,eAAe;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAO;EACzE,eAAe;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EAC3E,WAAW;GAAE,MAAM,eAAe,UAAU;GAAE,YAAY;GAAO;EAClE;CACF,CAAC;;;;AAKF,MAAa,wBAAwB,kBAAkB;CACrD,MAAM;CACN,QAAQ;EACN,MAAM;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EAClE,MAAM;GAAE,MAAM,eAAe,gBAAgB;GAAE,YAAY;GAAO;EAClE,aAAa;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACzE,OAAO;GAAE,MAAM,eAAe,cAAc;GAAE,YAAY;GAAM;EAChE,SAAS;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACrE,UAAU;GAAE,MAAM,eAAe,iBAAiB;GAAE,YAAY;GAAM;EACvE;CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations.test-spec.js","names":[],"sources":["../../src/tests/operations.test-spec.ts"],"sourcesContent":["import { defineTestSpec } from '@contractspec/lib.contracts';\n\nexport const ProductListTest = defineTestSpec({\n meta: {\n key: 'marketplace.product.list.test',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@example.marketplace'],\n description: 'Test for listing products',\n tags: ['test'],\n },\n target: {\n type: 'operation',\n operation: { key: 'marketplace.product.list', version: '1.0.0' },\n },\n scenarios: [\n {\n key: 'success',\n when: { operation: { key: 'marketplace.product.list' } },\n then: [{ type: 'expectOutput', match: {} }],\n },\n {\n key: 'error',\n when: { operation: { key: 'marketplace.product.list' } },\n then: [{ type: 'expectError' }],\n },\n ],\n});\n\nexport const OrderCreateTest = defineTestSpec({\n meta: {\n key: 'marketplace.order.create.test',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@example.marketplace'],\n description: 'Test for creating order',\n tags: ['test'],\n },\n target: {\n type: 'operation',\n operation: { key: 'marketplace.order.create', version: '1.0.0' },\n },\n scenarios: [\n {\n key: 'success',\n when: { operation: { key: 'marketplace.order.create' } },\n then: [{ type: 'expectOutput', match: {} }],\n },\n {\n key: 'error',\n when: { operation: { key: 'marketplace.order.create' } },\n then: [{ type: 'expectError' }],\n },\n ],\n});\n\nexport const PayoutListTest = defineTestSpec({\n meta: {\n key: 'marketplace.payout.list.test',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@example.marketplace'],\n description: 'Test for listing payouts',\n tags: ['test'],\n },\n target: {\n type: 'operation',\n operation: { key: 'marketplace.payout.list', version: '1.0.0' },\n },\n scenarios: [\n {\n key: 'success',\n when: { operation: { key: 'marketplace.payout.list' } },\n then: [{ type: 'expectOutput', match: {} }],\n },\n {\n key: 'error',\n when: { operation: { key: 'marketplace.payout.list' } },\n then: [{ type: 'expectError' }],\n },\n ],\n});\n\nexport const ReviewListTest = defineTestSpec({\n meta: {\n key: 'marketplace.review.list.test',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@example.marketplace'],\n description: 'Test for listing reviews',\n tags: ['test'],\n },\n target: {\n type: 'operation',\n operation: { key: 'marketplace.review.list', version: '1.0.0' },\n },\n scenarios: [\n {\n key: 'success',\n when: { operation: { key: 'marketplace.review.list' } },\n then: [{ type: 'expectOutput', match: {} }],\n },\n {\n key: 'error',\n when: { operation: { key: 'marketplace.review.list' } },\n then: [{ type: 'expectError' }],\n },\n ],\n});\n\nexport const ReviewCreateTest = defineTestSpec({\n meta: {\n key: 'marketplace.review.create.test',\n version: '1.0.0',\n stability: 'experimental',\n owners: ['@example.marketplace'],\n description: 'Test for creating review',\n tags: ['test'],\n },\n target: {\n type: 'operation',\n operation: { key: 'marketplace.review.create', version: '1.0.0' },\n },\n scenarios: [\n {\n key: 'success',\n when: { operation: { key: 'marketplace.review.create' } },\n then: [{ type: 'expectOutput', match: {} }],\n },\n {\n key: 'error',\n when: { operation: { key: 'marketplace.review.create' } },\n then: [{ type: 'expectError' }],\n },\n ],\n});\n"],"mappings":";;;AAEA,MAAa,kBAAkB,eAAe;CAC5C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,uBAAuB;EAChC,aAAa;EACb,MAAM,CAAC,OAAO;EACf;CACD,QAAQ;EACN,MAAM;EACN,WAAW;GAAE,KAAK;GAA4B,SAAS;GAAS;EACjE;CACD,WAAW,CACT;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,4BAA4B,EAAE;EACxD,MAAM,CAAC;GAAE,MAAM;GAAgB,OAAO,EAAE;GAAE,CAAC;EAC5C,EACD;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,4BAA4B,EAAE;EACxD,MAAM,CAAC,EAAE,MAAM,eAAe,CAAC;EAChC,CACF;CACF,CAAC;AAEF,MAAa,kBAAkB,eAAe;CAC5C,MAAM;EACJ,KAAK;EACL,SAAS;EACT,WAAW;EACX,QAAQ,CAAC,uBAAuB;EAChC,aAAa;EACb,MAAM,CAAC,OAAO;EACf;CACD,QAAQ;EACN,MAAM;EACN,WAAW;GAAE,KAAK;GAA4B,SAAS;GAAS;EACjE;CACD,WAAW,CACT;EACE,KAAK;EACL,MAAM,EAAE,WAAW,EAAE,KAAK,4BAA4B,EAAE;EACxD,MAAM,CAAC;GAAE,MAAM;GAAgB,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