@lssm/example.marketplace 0.0.0-canary-20251210171026 → 0.0.0-canary-20251212210835
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./marketplace.docblock.js";
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import{registerDocBlocks as e}from"@lssm/lib.contracts/docs";e([{id:`docs.examples.marketplace`,title:`Marketplace (2-sided)`,summary:`Two-sided marketplace with stores, products, orders, payouts, and reviews. Demonstrates multi-actor flows, payments, and attachments.`,kind:`reference`,visibility:`public`,route:`/docs/examples/marketplace`,tags:[`marketplace`,`orders`,`payouts`,`reviews`],body:`## Entities
|
|
2
|
+
|
|
3
|
+
- Store, Product, Order, OrderItem, Payout, Review.
|
|
4
|
+
- Uses Files module for product media and receipt attachments.
|
|
5
|
+
|
|
6
|
+
## Contracts
|
|
7
|
+
|
|
8
|
+
- \`marketplace.store.create\`, \`marketplace.product.add\`, \`marketplace.order.place\`, \`marketplace.payout.process\`, \`marketplace.review.submit\`.
|
|
9
|
+
- Policy guards via Identity/RBAC for provider vs client actions.
|
|
10
|
+
|
|
11
|
+
## Events
|
|
12
|
+
|
|
13
|
+
- order.created/completed/cancelled, payout.queued/completed, review.submitted.
|
|
14
|
+
- Hooked into Notifications and Audit Trail modules.
|
|
15
|
+
|
|
16
|
+
## UI / Presentations
|
|
17
|
+
|
|
18
|
+
- Dashboard, product catalog, order list/detail, store management.
|
|
19
|
+
- Templates registered under \`marketplace\` in Studio Template Registry.
|
|
20
|
+
|
|
21
|
+
## Notes
|
|
22
|
+
|
|
23
|
+
- Commission model encoded in spec; payouts scheduled via Jobs module.
|
|
24
|
+
- Feature flags can gate beta checkout or new reviews flow.
|
|
25
|
+
`},{id:`docs.examples.marketplace.goal`,title:`Marketplace — Goal`,summary:`Why this marketplace template exists and the outcomes it targets.`,kind:`goal`,visibility:`public`,route:`/docs/examples/marketplace/goal`,tags:[`marketplace`,`goal`],body:`## Why it matters
|
|
26
|
+
- Provides a regenerable 2-sided marketplace baseline without bespoke glue.
|
|
27
|
+
- Keeps payouts, catalog, orders, and reviews consistent across surfaces.
|
|
28
|
+
|
|
29
|
+
## Business/Product goal
|
|
30
|
+
- Safe provider/client flows with auditable payouts and moderation-ready reviews.
|
|
31
|
+
- Staged rollouts for payments/reviews via feature flags; explicit commission/tax fields.
|
|
32
|
+
|
|
33
|
+
## Success criteria
|
|
34
|
+
- Orders/payouts regenerate cleanly after spec changes.
|
|
35
|
+
- Events emit for lifecycle + audit; PII is scoped/redacted in presentations.`},{id:`docs.examples.marketplace.usage`,title:`Marketplace — Usage`,summary:`How to seed, extend, and safely regenerate the marketplace.`,kind:`usage`,visibility:`public`,route:`/docs/examples/marketplace/usage`,tags:[`marketplace`,`usage`],body:`## Setup
|
|
36
|
+
1) Seed sample stores/products/orders via template registry (or create via UI).
|
|
37
|
+
2) Configure Files storage for media/receipts; set policy.pii for sensitive fields.
|
|
38
|
+
|
|
39
|
+
## Extend & regenerate
|
|
40
|
+
1) Adjust schemas for commission/tax/payout states or review moderation in the spec.
|
|
41
|
+
2) Regenerate to sync UI, API, events, notifications.
|
|
42
|
+
3) Gate risky changes (new payment providers) behind Feature Flags.
|
|
43
|
+
|
|
44
|
+
## Guardrails
|
|
45
|
+
- Emit events for order/payout state changes; log via Audit Trail.
|
|
46
|
+
- Avoid hidden commission math—keep explicit fields.
|
|
47
|
+
- Redact buyer/provider PII in markdown/JSON presentations.`},{id:`docs.examples.marketplace.constraints`,title:`Marketplace — Constraints & Safety`,summary:`Internal guardrails for payouts, order states, and regeneration semantics.`,kind:`reference`,visibility:`internal`,route:`/docs/examples/marketplace/constraints`,tags:[`marketplace`,`constraints`,`internal`],body:`## Constraints
|
|
48
|
+
- Commission logic and order states must stay spec-defined; never adjust in code-only patches.
|
|
49
|
+
- Events to emit: order.created, order.completed, payout.queued, review.posted (minimum).
|
|
50
|
+
- Regeneration must not change payment semantics without explicit spec diff.
|
|
51
|
+
|
|
52
|
+
## Safety & PII
|
|
53
|
+
- Redact buyer/provider identifiers in markdown/JSON outputs; scope payouts per tenant/org.
|
|
54
|
+
- For MCP/web surfaces, avoid exposing raw payout calc inputs; use summaries.
|
|
55
|
+
|
|
56
|
+
## Testing/Verification
|
|
57
|
+
- Add fixtures covering order lifecycle and payout queueing.
|
|
58
|
+
- Run regeneration diff when changing commission/tax fields; verify presentations updated.
|
|
59
|
+
- Ensure Notifications/Audit wiring remains intact for order/payout/review events.`}]);
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{InventoryUpdatedEvent as e,MarketplaceEvents as t,OrderCompletedEvent as n,OrderCreatedEvent as r,OrderPaidEvent as i,OrderShippedEvent as a,OrderStatusUpdatedEvent as o,PayoutCreatedEvent as s,PayoutPaidEvent as c,ProductCreatedEvent as l,ProductPublishedEvent as u,ReviewCreatedEvent as d,ReviewRespondedEvent as f,StoreCreatedEvent as p,StoreStatusChangedEvent as m}from"./events.js";import{MarketplaceFeature as h}from"./feature.js";import{StoreCategoryEntity as g,StoreEntity as _,StoreStatusEnum as v,StoreTypeEnum as y}from"./entities/store.js";import{CategoryEntity as b,ProductEntity as x,ProductStatusEnum as S,ProductTypeEnum as C,ProductVariantEntity as w}from"./entities/product.js";import{OrderEntity as T,OrderItemEntity as E,OrderStatusEnum as D,PaymentStatusEnum as O,RefundEntity as k,RefundItemEntity as A}from"./entities/order.js";import{BankAccountEntity as j,PayoutEntity as M,PayoutItemEntity as N,PayoutScheduleEnum as P,PayoutSettingsEntity as F,PayoutStatusEnum as I}from"./entities/payout.js";import{ReviewEntity as L,ReviewReportEntity as R,ReviewResponseEntity as z,ReviewStatusEnum as B,ReviewTypeEnum as V,ReviewVoteEntity as H}from"./entities/review.js";import{marketplaceEntities as U,marketplaceSchemaContribution as W}from"./entities/index.js";import{CreateOrderContract as G,CreateOrderInputModel as K,CreateProductContract as q,CreateProductInputModel as J,CreateReviewContract as Y,CreateReviewInputModel as X,CreateStoreContract as Z,CreateStoreInputModel as Q,ListPayoutsContract as $,ListPayoutsInputModel as ee,ListPayoutsOutputModel as te,ListProductsContract as ne,ListProductsInputModel as re,ListProductsOutputModel as ie,ListReviewsContract as ae,ListReviewsInputModel as oe,ListReviewsOutputModel as se,OrderItemModel as ce,OrderModel as le,PayoutModel as ue,ProductModel as de,ReviewModel as fe,StoreModel as pe,UpdateOrderStatusContract as me,UpdateOrderStatusInputModel as he}from"./contracts/index.js";import{calculateCommission as ge,calculateRatingStats as _e,generateOrderNumber as ve,generatePayoutNumber as ye,handleCreateOrder as be,handleCreateProduct as xe,handleCreateReview as Se,handleCreateStore as Ce,mockMarketplaceStore as we}from"./handlers/index.js";import{CheckoutPresentation as Te,MarketplacePresentations as Ee,OrderDetailPresentation as De,OrderListPresentation as Oe,PayoutDetailPresentation as ke,PayoutListPresentation as Ae,ProductCatalogPresentation as je,ProductDetailPresentation as Me,ProductEditorPresentation as Ne,ReviewFormPresentation as Pe,ReviewListPresentation as Fe,SellerDashboardPresentation as Ie,StoreProfilePresentation as Le}from"./presentations/index.js";import{identityRbacSchemaContribution as Re}from"@lssm/lib.identity-rbac";import{auditTrailSchemaContribution as ze}from"@lssm/module.audit-trail";import{notificationsSchemaContribution as Be}from"@lssm/module.notifications";import{filesSchemaContribution as Ve}from"@lssm/lib.files";import{meteringSchemaContribution as He}from"@lssm/lib.metering";const Ue={modules:[Re,ze,Be,Ve,He,W],provider:`postgresql`,outputPath:`./prisma/schema/generated.prisma`};export{j as BankAccountEntity,b as CategoryEntity,Te as CheckoutPresentation,G as CreateOrderContract,K as CreateOrderInputModel,q as CreateProductContract,J as CreateProductInputModel,Y as CreateReviewContract,X as CreateReviewInputModel,Z as CreateStoreContract,Q as CreateStoreInputModel,e as InventoryUpdatedEvent,$ as ListPayoutsContract,ee as ListPayoutsInputModel,te as ListPayoutsOutputModel,ne as ListProductsContract,re as ListProductsInputModel,ie as ListProductsOutputModel,ae as ListReviewsContract,oe as ListReviewsInputModel,se as ListReviewsOutputModel,t as MarketplaceEvents,h as MarketplaceFeature,Ee as MarketplacePresentations,n as OrderCompletedEvent,r as OrderCreatedEvent,De as OrderDetailPresentation,T as OrderEntity,E as OrderItemEntity,ce as OrderItemModel,Oe as OrderListPresentation,le as OrderModel,i as OrderPaidEvent,a as OrderShippedEvent,D as OrderStatusEnum,o as OrderStatusUpdatedEvent,O as PaymentStatusEnum,s as PayoutCreatedEvent,ke as PayoutDetailPresentation,M as PayoutEntity,N as PayoutItemEntity,Ae as PayoutListPresentation,ue as PayoutModel,c as PayoutPaidEvent,P as PayoutScheduleEnum,F as PayoutSettingsEntity,I as PayoutStatusEnum,je as ProductCatalogPresentation,l as ProductCreatedEvent,Me as ProductDetailPresentation,Ne as ProductEditorPresentation,x as ProductEntity,de as ProductModel,u as ProductPublishedEvent,S as ProductStatusEnum,C as ProductTypeEnum,w as ProductVariantEntity,k as RefundEntity,A as RefundItemEntity,d as ReviewCreatedEvent,L as ReviewEntity,Pe as ReviewFormPresentation,Fe as ReviewListPresentation,fe as ReviewModel,R as ReviewReportEntity,f as ReviewRespondedEvent,z as ReviewResponseEntity,B as ReviewStatusEnum,V as ReviewTypeEnum,H as ReviewVoteEntity,Ie as SellerDashboardPresentation,g as StoreCategoryEntity,p as StoreCreatedEvent,_ as StoreEntity,pe as StoreModel,Le as StoreProfilePresentation,m as StoreStatusChangedEvent,v as StoreStatusEnum,y as StoreTypeEnum,me as UpdateOrderStatusContract,he as UpdateOrderStatusInputModel,ge as calculateCommission,_e as calculateRatingStats,ve as generateOrderNumber,ye as generatePayoutNumber,be as handleCreateOrder,xe as handleCreateProduct,Se as handleCreateReview,Ce as handleCreateStore,U as marketplaceEntities,W as marketplaceSchemaContribution,we as mockMarketplaceStore,Ue as schemaComposition};
|
|
1
|
+
import{InventoryUpdatedEvent as e,MarketplaceEvents as t,OrderCompletedEvent as n,OrderCreatedEvent as r,OrderPaidEvent as i,OrderShippedEvent as a,OrderStatusUpdatedEvent as o,PayoutCreatedEvent as s,PayoutPaidEvent as c,ProductCreatedEvent as l,ProductPublishedEvent as u,ReviewCreatedEvent as d,ReviewRespondedEvent as f,StoreCreatedEvent as p,StoreStatusChangedEvent as m}from"./events.js";import{MarketplaceFeature as h}from"./feature.js";import{StoreCategoryEntity as g,StoreEntity as _,StoreStatusEnum as v,StoreTypeEnum as y}from"./entities/store.js";import{CategoryEntity as b,ProductEntity as x,ProductStatusEnum as S,ProductTypeEnum as C,ProductVariantEntity as w}from"./entities/product.js";import{OrderEntity as T,OrderItemEntity as E,OrderStatusEnum as D,PaymentStatusEnum as O,RefundEntity as k,RefundItemEntity as A}from"./entities/order.js";import{BankAccountEntity as j,PayoutEntity as M,PayoutItemEntity as N,PayoutScheduleEnum as P,PayoutSettingsEntity as F,PayoutStatusEnum as I}from"./entities/payout.js";import{ReviewEntity as L,ReviewReportEntity as R,ReviewResponseEntity as z,ReviewStatusEnum as B,ReviewTypeEnum as V,ReviewVoteEntity as H}from"./entities/review.js";import{marketplaceEntities as U,marketplaceSchemaContribution as W}from"./entities/index.js";import{CreateOrderContract as G,CreateOrderInputModel as K,CreateProductContract as q,CreateProductInputModel as J,CreateReviewContract as Y,CreateReviewInputModel as X,CreateStoreContract as Z,CreateStoreInputModel as Q,ListPayoutsContract as $,ListPayoutsInputModel as ee,ListPayoutsOutputModel as te,ListProductsContract as ne,ListProductsInputModel as re,ListProductsOutputModel as ie,ListReviewsContract as ae,ListReviewsInputModel as oe,ListReviewsOutputModel as se,OrderItemModel as ce,OrderModel as le,PayoutModel as ue,ProductModel as de,ReviewModel as fe,StoreModel as pe,UpdateOrderStatusContract as me,UpdateOrderStatusInputModel as he}from"./contracts/index.js";import{calculateCommission as ge,calculateRatingStats as _e,generateOrderNumber as ve,generatePayoutNumber as ye,handleCreateOrder as be,handleCreateProduct as xe,handleCreateReview as Se,handleCreateStore as Ce,mockMarketplaceStore as we}from"./handlers/index.js";import{CheckoutPresentation as Te,MarketplacePresentations as Ee,OrderDetailPresentation as De,OrderListPresentation as Oe,PayoutDetailPresentation as ke,PayoutListPresentation as Ae,ProductCatalogPresentation as je,ProductDetailPresentation as Me,ProductEditorPresentation as Ne,ReviewFormPresentation as Pe,ReviewListPresentation as Fe,SellerDashboardPresentation as Ie,StoreProfilePresentation as Le}from"./presentations/index.js";import"./docs/index.js";import{identityRbacSchemaContribution as Re}from"@lssm/lib.identity-rbac";import{auditTrailSchemaContribution as ze}from"@lssm/module.audit-trail";import{notificationsSchemaContribution as Be}from"@lssm/module.notifications";import{filesSchemaContribution as Ve}from"@lssm/lib.files";import{meteringSchemaContribution as He}from"@lssm/lib.metering";const Ue={modules:[Re,ze,Be,Ve,He,W],provider:`postgresql`,outputPath:`./prisma/schema/generated.prisma`};export{j as BankAccountEntity,b as CategoryEntity,Te as CheckoutPresentation,G as CreateOrderContract,K as CreateOrderInputModel,q as CreateProductContract,J as CreateProductInputModel,Y as CreateReviewContract,X as CreateReviewInputModel,Z as CreateStoreContract,Q as CreateStoreInputModel,e as InventoryUpdatedEvent,$ as ListPayoutsContract,ee as ListPayoutsInputModel,te as ListPayoutsOutputModel,ne as ListProductsContract,re as ListProductsInputModel,ie as ListProductsOutputModel,ae as ListReviewsContract,oe as ListReviewsInputModel,se as ListReviewsOutputModel,t as MarketplaceEvents,h as MarketplaceFeature,Ee as MarketplacePresentations,n as OrderCompletedEvent,r as OrderCreatedEvent,De as OrderDetailPresentation,T as OrderEntity,E as OrderItemEntity,ce as OrderItemModel,Oe as OrderListPresentation,le as OrderModel,i as OrderPaidEvent,a as OrderShippedEvent,D as OrderStatusEnum,o as OrderStatusUpdatedEvent,O as PaymentStatusEnum,s as PayoutCreatedEvent,ke as PayoutDetailPresentation,M as PayoutEntity,N as PayoutItemEntity,Ae as PayoutListPresentation,ue as PayoutModel,c as PayoutPaidEvent,P as PayoutScheduleEnum,F as PayoutSettingsEntity,I as PayoutStatusEnum,je as ProductCatalogPresentation,l as ProductCreatedEvent,Me as ProductDetailPresentation,Ne as ProductEditorPresentation,x as ProductEntity,de as ProductModel,u as ProductPublishedEvent,S as ProductStatusEnum,C as ProductTypeEnum,w as ProductVariantEntity,k as RefundEntity,A as RefundItemEntity,d as ReviewCreatedEvent,L as ReviewEntity,Pe as ReviewFormPresentation,Fe as ReviewListPresentation,fe as ReviewModel,R as ReviewReportEntity,f as ReviewRespondedEvent,z as ReviewResponseEntity,B as ReviewStatusEnum,V as ReviewTypeEnum,H as ReviewVoteEntity,Ie as SellerDashboardPresentation,g as StoreCategoryEntity,p as StoreCreatedEvent,_ as StoreEntity,pe as StoreModel,Le as StoreProfilePresentation,m as StoreStatusChangedEvent,v as StoreStatusEnum,y as StoreTypeEnum,me as UpdateOrderStatusContract,he as UpdateOrderStatusInputModel,ge as calculateCommission,_e as calculateRatingStats,ve as generateOrderNumber,ye as generatePayoutNumber,be as handleCreateOrder,xe as handleCreateProduct,Se as handleCreateReview,Ce as handleCreateStore,U as marketplaceEntities,W as marketplaceSchemaContribution,we as mockMarketplaceStore,Ue as schemaComposition};
|