@contractspec/example.marketplace 0.0.0-canary-20260113170453

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.
Files changed (188) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +141 -0
  3. package/dist/docs/index.d.ts +1 -0
  4. package/dist/docs/index.js +1 -0
  5. package/dist/docs/marketplace.docblock.d.ts +1 -0
  6. package/dist/docs/marketplace.docblock.js +115 -0
  7. package/dist/docs/marketplace.docblock.js.map +1 -0
  8. package/dist/entities/index.d.ts +309 -0
  9. package/dist/entities/index.d.ts.map +1 -0
  10. package/dist/entities/index.js +46 -0
  11. package/dist/entities/index.js.map +1 -0
  12. package/dist/entities/order.d.ts +105 -0
  13. package/dist/entities/order.d.ts.map +1 -0
  14. package/dist/entities/order.js +173 -0
  15. package/dist/entities/order.js.map +1 -0
  16. package/dist/entities/payout.d.ts +92 -0
  17. package/dist/entities/payout.d.ts.map +1 -0
  18. package/dist/entities/payout.js +162 -0
  19. package/dist/entities/payout.js.map +1 -0
  20. package/dist/entities/product.d.ts +93 -0
  21. package/dist/entities/product.d.ts.map +1 -0
  22. package/dist/entities/product.js +161 -0
  23. package/dist/entities/product.js.map +1 -0
  24. package/dist/entities/review.d.ts +83 -0
  25. package/dist/entities/review.d.ts.map +1 -0
  26. package/dist/entities/review.js +152 -0
  27. package/dist/entities/review.js.map +1 -0
  28. package/dist/entities/store.d.ts +60 -0
  29. package/dist/entities/store.d.ts.map +1 -0
  30. package/dist/entities/store.js +110 -0
  31. package/dist/entities/store.js.map +1 -0
  32. package/dist/example.d.ts +7 -0
  33. package/dist/example.d.ts.map +1 -0
  34. package/dist/example.js +58 -0
  35. package/dist/example.js.map +1 -0
  36. package/dist/handlers/index.d.ts +2 -0
  37. package/dist/handlers/index.js +3 -0
  38. package/dist/handlers/marketplace.handlers.d.ts +155 -0
  39. package/dist/handlers/marketplace.handlers.d.ts.map +1 -0
  40. package/dist/handlers/marketplace.handlers.js +329 -0
  41. package/dist/handlers/marketplace.handlers.js.map +1 -0
  42. package/dist/index.d.ts +31 -0
  43. package/dist/index.js +32 -0
  44. package/dist/marketplace.capability.d.ts +9 -0
  45. package/dist/marketplace.capability.d.ts.map +1 -0
  46. package/dist/marketplace.capability.js +34 -0
  47. package/dist/marketplace.capability.js.map +1 -0
  48. package/dist/marketplace.feature.d.ts +12 -0
  49. package/dist/marketplace.feature.d.ts.map +1 -0
  50. package/dist/marketplace.feature.js +315 -0
  51. package/dist/marketplace.feature.js.map +1 -0
  52. package/dist/order/index.d.ts +5 -0
  53. package/dist/order/index.js +6 -0
  54. package/dist/order/order.enum.d.ts +10 -0
  55. package/dist/order/order.enum.d.ts.map +1 -0
  56. package/dist/order/order.enum.js +22 -0
  57. package/dist/order/order.enum.js.map +1 -0
  58. package/dist/order/order.event.d.ts +145 -0
  59. package/dist/order/order.event.d.ts.map +1 -0
  60. package/dist/order/order.event.js +216 -0
  61. package/dist/order/order.event.js.map +1 -0
  62. package/dist/order/order.operations.d.ts +368 -0
  63. package/dist/order/order.operations.d.ts.map +1 -0
  64. package/dist/order/order.operations.js +119 -0
  65. package/dist/order/order.operations.js.map +1 -0
  66. package/dist/order/order.presentation.d.ts +9 -0
  67. package/dist/order/order.presentation.d.ts.map +1 -0
  68. package/dist/order/order.presentation.js +86 -0
  69. package/dist/order/order.presentation.js.map +1 -0
  70. package/dist/order/order.schema.d.ts +165 -0
  71. package/dist/order/order.schema.d.ts.map +1 -0
  72. package/dist/order/order.schema.js +155 -0
  73. package/dist/order/order.schema.js.map +1 -0
  74. package/dist/payout/index.d.ts +5 -0
  75. package/dist/payout/index.js +6 -0
  76. package/dist/payout/payout.enum.d.ts +10 -0
  77. package/dist/payout/payout.enum.d.ts.map +1 -0
  78. package/dist/payout/payout.enum.js +17 -0
  79. package/dist/payout/payout.enum.js.map +1 -0
  80. package/dist/payout/payout.event.d.ts +63 -0
  81. package/dist/payout/payout.event.d.ts.map +1 -0
  82. package/dist/payout/payout.event.js +92 -0
  83. package/dist/payout/payout.event.js.map +1 -0
  84. package/dist/payout/payout.operations.d.ts +97 -0
  85. package/dist/payout/payout.operations.d.ts.map +1 -0
  86. package/dist/payout/payout.operations.js +53 -0
  87. package/dist/payout/payout.operations.js.map +1 -0
  88. package/dist/payout/payout.presentation.d.ts +8 -0
  89. package/dist/payout/payout.presentation.d.ts.map +1 -0
  90. package/dist/payout/payout.presentation.js +60 -0
  91. package/dist/payout/payout.presentation.js.map +1 -0
  92. package/dist/payout/payout.schema.d.ts +157 -0
  93. package/dist/payout/payout.schema.d.ts.map +1 -0
  94. package/dist/payout/payout.schema.js +116 -0
  95. package/dist/payout/payout.schema.js.map +1 -0
  96. package/dist/product/index.d.ts +5 -0
  97. package/dist/product/index.js +6 -0
  98. package/dist/product/product.enum.d.ts +10 -0
  99. package/dist/product/product.enum.d.ts.map +1 -0
  100. package/dist/product/product.enum.js +18 -0
  101. package/dist/product/product.enum.js.map +1 -0
  102. package/dist/product/product.event.d.ts +73 -0
  103. package/dist/product/product.event.d.ts.map +1 -0
  104. package/dist/product/product.event.js +120 -0
  105. package/dist/product/product.event.js.map +1 -0
  106. package/dist/product/product.operations.d.ts +273 -0
  107. package/dist/product/product.operations.d.ts.map +1 -0
  108. package/dist/product/product.operations.js +108 -0
  109. package/dist/product/product.operations.js.map +1 -0
  110. package/dist/product/product.presentation.d.ts +9 -0
  111. package/dist/product/product.presentation.d.ts.map +1 -0
  112. package/dist/product/product.presentation.js +86 -0
  113. package/dist/product/product.presentation.js.map +1 -0
  114. package/dist/product/product.schema.d.ts +218 -0
  115. package/dist/product/product.schema.d.ts.map +1 -0
  116. package/dist/product/product.schema.js +176 -0
  117. package/dist/product/product.schema.js.map +1 -0
  118. package/dist/review/index.d.ts +5 -0
  119. package/dist/review/index.js +6 -0
  120. package/dist/review/review.enum.d.ts +10 -0
  121. package/dist/review/review.enum.d.ts.map +1 -0
  122. package/dist/review/review.enum.js +16 -0
  123. package/dist/review/review.enum.js.map +1 -0
  124. package/dist/review/review.event.d.ts +55 -0
  125. package/dist/review/review.event.d.ts.map +1 -0
  126. package/dist/review/review.event.js +84 -0
  127. package/dist/review/review.event.js.map +1 -0
  128. package/dist/review/review.operations.d.ts +237 -0
  129. package/dist/review/review.operations.d.ts.map +1 -0
  130. package/dist/review/review.operations.js +106 -0
  131. package/dist/review/review.operations.js.map +1 -0
  132. package/dist/review/review.presentation.d.ts +8 -0
  133. package/dist/review/review.presentation.d.ts.map +1 -0
  134. package/dist/review/review.presentation.js +60 -0
  135. package/dist/review/review.presentation.js.map +1 -0
  136. package/dist/review/review.schema.d.ts +190 -0
  137. package/dist/review/review.schema.d.ts.map +1 -0
  138. package/dist/review/review.schema.js +156 -0
  139. package/dist/review/review.schema.js.map +1 -0
  140. package/dist/seeders/index.d.ts +10 -0
  141. package/dist/seeders/index.d.ts.map +1 -0
  142. package/dist/seeders/index.js +18 -0
  143. package/dist/seeders/index.js.map +1 -0
  144. package/dist/store/index.d.ts +5 -0
  145. package/dist/store/index.js +6 -0
  146. package/dist/store/store.enum.d.ts +10 -0
  147. package/dist/store/store.enum.d.ts.map +1 -0
  148. package/dist/store/store.enum.js +16 -0
  149. package/dist/store/store.enum.js.map +1 -0
  150. package/dist/store/store.event.d.ts +51 -0
  151. package/dist/store/store.event.d.ts.map +1 -0
  152. package/dist/store/store.event.js +80 -0
  153. package/dist/store/store.event.js.map +1 -0
  154. package/dist/store/store.operations.d.ts +131 -0
  155. package/dist/store/store.operations.d.ts.map +1 -0
  156. package/dist/store/store.operations.js +61 -0
  157. package/dist/store/store.operations.js.map +1 -0
  158. package/dist/store/store.presentation.d.ts +8 -0
  159. package/dist/store/store.presentation.d.ts.map +1 -0
  160. package/dist/store/store.presentation.js +60 -0
  161. package/dist/store/store.presentation.js.map +1 -0
  162. package/dist/store/store.schema.d.ts +84 -0
  163. package/dist/store/store.schema.d.ts.map +1 -0
  164. package/dist/store/store.schema.js +93 -0
  165. package/dist/store/store.schema.js.map +1 -0
  166. package/dist/tests/operations.test-spec.d.ts +11 -0
  167. package/dist/tests/operations.test-spec.d.ts.map +1 -0
  168. package/dist/tests/operations.test-spec.js +152 -0
  169. package/dist/tests/operations.test-spec.js.map +1 -0
  170. package/dist/ui/MarketplaceDashboard.d.ts +7 -0
  171. package/dist/ui/MarketplaceDashboard.d.ts.map +1 -0
  172. package/dist/ui/MarketplaceDashboard.js +319 -0
  173. package/dist/ui/MarketplaceDashboard.js.map +1 -0
  174. package/dist/ui/hooks/index.d.ts +2 -0
  175. package/dist/ui/hooks/index.js +5 -0
  176. package/dist/ui/hooks/useMarketplaceData.d.ts +23 -0
  177. package/dist/ui/hooks/useMarketplaceData.d.ts.map +1 -0
  178. package/dist/ui/hooks/useMarketplaceData.js +64 -0
  179. package/dist/ui/hooks/useMarketplaceData.js.map +1 -0
  180. package/dist/ui/index.d.ts +6 -0
  181. package/dist/ui/index.js +6 -0
  182. package/dist/ui/renderers/index.d.ts +2 -0
  183. package/dist/ui/renderers/index.js +3 -0
  184. package/dist/ui/renderers/marketplace.markdown.d.ts +28 -0
  185. package/dist/ui/renderers/marketplace.markdown.d.ts.map +1 -0
  186. package/dist/ui/renderers/marketplace.markdown.js +244 -0
  187. package/dist/ui/renderers/marketplace.markdown.js.map +1 -0
  188. package/package.json +149 -0
@@ -0,0 +1,110 @@
1
+ import { defineEntity, defineEntityEnum, field, index } from "@contractspec/lib.schema";
2
+
3
+ //#region src/entities/store.ts
4
+ /**
5
+ * Store status enum.
6
+ */
7
+ const StoreStatusEnum = defineEntityEnum({
8
+ name: "StoreStatus",
9
+ values: [
10
+ "PENDING",
11
+ "ACTIVE",
12
+ "SUSPENDED",
13
+ "CLOSED"
14
+ ],
15
+ schema: "marketplace",
16
+ description: "Status of a store."
17
+ });
18
+ /**
19
+ * Store type enum.
20
+ */
21
+ const StoreTypeEnum = defineEntityEnum({
22
+ name: "StoreType",
23
+ values: [
24
+ "INDIVIDUAL",
25
+ "BUSINESS",
26
+ "ENTERPRISE"
27
+ ],
28
+ schema: "marketplace",
29
+ description: "Type of store account."
30
+ });
31
+ /**
32
+ * Store entity - a seller's storefront on the marketplace.
33
+ */
34
+ const StoreEntity = defineEntity({
35
+ name: "Store",
36
+ description: "A seller storefront on the marketplace.",
37
+ schema: "marketplace",
38
+ map: "store",
39
+ fields: {
40
+ id: field.id({ description: "Unique store ID" }),
41
+ name: field.string({ description: "Store display name" }),
42
+ slug: field.string({ description: "URL-friendly identifier" }),
43
+ description: field.string({ isOptional: true }),
44
+ status: field.enum("StoreStatus", { default: "PENDING" }),
45
+ type: field.enum("StoreType", { default: "INDIVIDUAL" }),
46
+ ownerId: field.foreignKey({ description: "Store owner user ID" }),
47
+ organizationId: field.foreignKey({ isOptional: true }),
48
+ logoFileId: field.string({
49
+ isOptional: true,
50
+ description: "Logo file reference"
51
+ }),
52
+ bannerFileId: field.string({
53
+ isOptional: true,
54
+ description: "Banner file reference"
55
+ }),
56
+ email: field.string({ isOptional: true }),
57
+ phone: field.string({ isOptional: true }),
58
+ website: field.string({ isOptional: true }),
59
+ country: field.string({ isOptional: true }),
60
+ currency: field.string({ default: "\"USD\"" }),
61
+ timezone: field.string({ isOptional: true }),
62
+ commissionRate: field.decimal({
63
+ default: .1,
64
+ description: "Platform commission rate (e.g., 0.1 = 10%)"
65
+ }),
66
+ isVerified: field.boolean({ default: false }),
67
+ verifiedAt: field.dateTime({ isOptional: true }),
68
+ settings: field.json({ isOptional: true }),
69
+ metadata: field.json({ isOptional: true }),
70
+ totalProducts: field.int({ default: 0 }),
71
+ totalOrders: field.int({ default: 0 }),
72
+ totalRevenue: field.decimal({ default: 0 }),
73
+ averageRating: field.decimal({ default: 0 }),
74
+ createdAt: field.createdAt(),
75
+ updatedAt: field.updatedAt(),
76
+ products: field.hasMany("Product"),
77
+ orders: field.hasMany("Order"),
78
+ payouts: field.hasMany("Payout")
79
+ },
80
+ indexes: [
81
+ index.unique(["slug"]),
82
+ index.on(["ownerId"]),
83
+ index.on(["status"]),
84
+ index.on(["country", "status"]),
85
+ index.on(["averageRating"])
86
+ ],
87
+ enums: [StoreStatusEnum, StoreTypeEnum]
88
+ });
89
+ /**
90
+ * Store category entity - categorization for stores.
91
+ */
92
+ const StoreCategoryEntity = defineEntity({
93
+ name: "StoreCategory",
94
+ description: "Category assignment for stores.",
95
+ schema: "marketplace",
96
+ map: "store_category",
97
+ fields: {
98
+ id: field.id(),
99
+ storeId: field.foreignKey(),
100
+ categoryId: field.foreignKey(),
101
+ isPrimary: field.boolean({ default: false }),
102
+ createdAt: field.createdAt(),
103
+ store: field.belongsTo("Store", ["storeId"], ["id"], { onDelete: "Cascade" })
104
+ },
105
+ indexes: [index.unique(["storeId", "categoryId"]), index.on(["categoryId"])]
106
+ });
107
+
108
+ //#endregion
109
+ export { StoreCategoryEntity, StoreEntity, StoreStatusEnum, StoreTypeEnum };
110
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
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: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GAAG,CAAC,aAAa,CAAC,CAAC;CAC7E,CAAC"}
@@ -0,0 +1,7 @@
1
+ import * as _contractspec_lib_contracts0 from "@contractspec/lib.contracts";
2
+
3
+ //#region src/example.d.ts
4
+ declare const example: _contractspec_lib_contracts0.ExampleSpec;
5
+ //#endregion
6
+ export { example as default };
7
+ //# sourceMappingURL=example.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"example.d.ts","names":[],"sources":["../src/example.ts"],"sourcesContent":[],"mappings":";;;cAEM,SAoCJ,4BAAA,CApCW"}
@@ -0,0 +1,58 @@
1
+ import { defineExample } from "@contractspec/lib.contracts";
2
+
3
+ //#region src/example.ts
4
+ const example = defineExample({
5
+ meta: {
6
+ key: "marketplace",
7
+ version: "1.0.0",
8
+ title: "Marketplace (2-sided)",
9
+ description: "Two-sided marketplace with stores, products, orders, payouts, and reviews (multi-actor flows).",
10
+ kind: "template",
11
+ visibility: "public",
12
+ stability: "experimental",
13
+ owners: ["@platform.core"],
14
+ tags: [
15
+ "marketplace",
16
+ "orders",
17
+ "payouts",
18
+ "reviews"
19
+ ]
20
+ },
21
+ docs: {
22
+ rootDocId: "docs.examples.marketplace",
23
+ goalDocId: "docs.examples.marketplace.goal",
24
+ usageDocId: "docs.examples.marketplace.usage",
25
+ constraintsDocId: "docs.examples.marketplace.constraints"
26
+ },
27
+ entrypoints: {
28
+ packageName: "@contractspec/example.marketplace",
29
+ feature: "./feature",
30
+ contracts: "./contracts",
31
+ presentations: "./presentations",
32
+ handlers: "./handlers",
33
+ docs: "./docs"
34
+ },
35
+ surfaces: {
36
+ templates: true,
37
+ sandbox: {
38
+ enabled: true,
39
+ modes: [
40
+ "playground",
41
+ "specs",
42
+ "builder",
43
+ "markdown",
44
+ "evolution"
45
+ ]
46
+ },
47
+ studio: {
48
+ enabled: true,
49
+ installable: true
50
+ },
51
+ mcp: { enabled: true }
52
+ }
53
+ });
54
+ var example_default = example;
55
+
56
+ //#endregion
57
+ export { example_default as default };
58
+ //# sourceMappingURL=example.js.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,2 @@
1
+ import { AddProductInput, CreateStoreInput, ListOrdersInput, ListOrdersOutput, ListProductsInput, ListProductsOutput, ListStoresInput, ListStoresOutput, MarketplaceHandlers, Order, OrderItem, Payout, PlaceOrderInput, Product, Review, Store, createMarketplaceHandlers } from "./marketplace.handlers.js";
2
+ export { AddProductInput, CreateStoreInput, ListOrdersInput, ListOrdersOutput, ListProductsInput, ListProductsOutput, ListStoresInput, ListStoresOutput, MarketplaceHandlers, Order, OrderItem, Payout, PlaceOrderInput, Product, Review, Store, createMarketplaceHandlers };
@@ -0,0 +1,3 @@
1
+ import { createMarketplaceHandlers } from "./marketplace.handlers.js";
2
+
3
+ export { createMarketplaceHandlers };
@@ -0,0 +1,155 @@
1
+ import { DatabasePort } from "@contractspec/lib.runtime-sandbox";
2
+
3
+ //#region src/handlers/marketplace.handlers.d.ts
4
+
5
+ interface Store {
6
+ id: string;
7
+ projectId: string;
8
+ organizationId: string;
9
+ name: string;
10
+ description?: string;
11
+ status: 'PENDING' | 'ACTIVE' | 'SUSPENDED';
12
+ rating: number;
13
+ reviewCount: number;
14
+ createdAt: Date;
15
+ updatedAt: Date;
16
+ }
17
+ interface Product {
18
+ id: string;
19
+ storeId: string;
20
+ name: string;
21
+ description?: string;
22
+ price: number;
23
+ currency: string;
24
+ status: 'DRAFT' | 'ACTIVE' | 'OUT_OF_STOCK' | 'ARCHIVED';
25
+ stock: number;
26
+ category?: string;
27
+ imageUrl?: string;
28
+ createdAt: Date;
29
+ updatedAt: Date;
30
+ }
31
+ interface Order {
32
+ id: string;
33
+ projectId: string;
34
+ storeId: string;
35
+ customerId: string;
36
+ status: 'PENDING' | 'CONFIRMED' | 'PROCESSING' | 'SHIPPED' | 'DELIVERED' | 'CANCELLED';
37
+ total: number;
38
+ currency: string;
39
+ shippingAddress?: string;
40
+ createdAt: Date;
41
+ updatedAt: Date;
42
+ }
43
+ interface OrderItem {
44
+ id: string;
45
+ orderId: string;
46
+ productId: string;
47
+ quantity: number;
48
+ price: number;
49
+ createdAt: Date;
50
+ }
51
+ interface Payout {
52
+ id: string;
53
+ storeId: string;
54
+ amount: number;
55
+ currency: string;
56
+ status: 'PENDING' | 'PROCESSING' | 'COMPLETED' | 'FAILED';
57
+ processedAt?: Date;
58
+ createdAt: Date;
59
+ }
60
+ interface Review {
61
+ id: string;
62
+ productId: string;
63
+ customerId: string;
64
+ orderId?: string;
65
+ rating: number;
66
+ comment?: string;
67
+ createdAt: Date;
68
+ }
69
+ interface CreateStoreInput {
70
+ name: string;
71
+ description?: string;
72
+ }
73
+ interface AddProductInput {
74
+ storeId: string;
75
+ name: string;
76
+ description?: string;
77
+ price: number;
78
+ currency?: string;
79
+ stock?: number;
80
+ category?: string;
81
+ imageUrl?: string;
82
+ }
83
+ interface PlaceOrderInput {
84
+ storeId: string;
85
+ items: {
86
+ productId: string;
87
+ quantity: number;
88
+ }[];
89
+ shippingAddress?: string;
90
+ }
91
+ interface ListStoresInput {
92
+ projectId: string;
93
+ status?: 'PENDING' | 'ACTIVE' | 'SUSPENDED' | 'all';
94
+ search?: string;
95
+ limit?: number;
96
+ offset?: number;
97
+ }
98
+ interface ListStoresOutput {
99
+ stores: Store[];
100
+ total: number;
101
+ }
102
+ interface ListProductsInput {
103
+ storeId?: string;
104
+ status?: 'DRAFT' | 'ACTIVE' | 'OUT_OF_STOCK' | 'ARCHIVED' | 'all';
105
+ category?: string;
106
+ search?: string;
107
+ limit?: number;
108
+ offset?: number;
109
+ }
110
+ interface ListProductsOutput {
111
+ products: Product[];
112
+ total: number;
113
+ }
114
+ interface ListOrdersInput {
115
+ projectId: string;
116
+ storeId?: string;
117
+ customerId?: string;
118
+ status?: 'PENDING' | 'CONFIRMED' | 'PROCESSING' | 'SHIPPED' | 'DELIVERED' | 'CANCELLED' | 'all';
119
+ limit?: number;
120
+ offset?: number;
121
+ }
122
+ interface ListOrdersOutput {
123
+ orders: Order[];
124
+ total: number;
125
+ totalRevenue: number;
126
+ }
127
+ declare function createMarketplaceHandlers(db: DatabasePort): {
128
+ listStores: (input: ListStoresInput) => Promise<ListStoresOutput>;
129
+ createStore: (input: CreateStoreInput, context: {
130
+ projectId: string;
131
+ organizationId: string;
132
+ }) => Promise<Store>;
133
+ listProducts: (input: ListProductsInput) => Promise<ListProductsOutput>;
134
+ addProduct: (input: AddProductInput) => Promise<Product>;
135
+ listOrders: (input: ListOrdersInput) => Promise<ListOrdersOutput>;
136
+ placeOrder: (input: PlaceOrderInput, context: {
137
+ projectId: string;
138
+ customerId: string;
139
+ }) => Promise<Order>;
140
+ getOrderItems: (orderId: string) => Promise<OrderItem[]>;
141
+ updateOrderStatus: (orderId: string, status: Order["status"]) => Promise<Order>;
142
+ listPayouts: (storeId: string) => Promise<Payout[]>;
143
+ listReviews: (productId: string) => Promise<Review[]>;
144
+ submitReview: (input: {
145
+ productId: string;
146
+ customerId: string;
147
+ orderId?: string;
148
+ rating: number;
149
+ comment?: string;
150
+ }) => Promise<Review>;
151
+ };
152
+ type MarketplaceHandlers = ReturnType<typeof createMarketplaceHandlers>;
153
+ //#endregion
154
+ export { AddProductInput, CreateStoreInput, ListOrdersInput, ListOrdersOutput, ListProductsInput, ListProductsOutput, ListStoresInput, ListStoresOutput, MarketplaceHandlers, Order, OrderItem, Payout, PlaceOrderInput, Product, Review, Store, createMarketplaceHandlers };
155
+ //# sourceMappingURL=marketplace.handlers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"marketplace.handlers.d.ts","names":[],"sources":["../../src/handlers/marketplace.handlers.ts"],"sourcesContent":[],"mappings":";;;;AA2DiB,UA/CA,KAAA,CA+CS;EAST,EAAA,EAAA,MAAM;EAUN,SAAM,EAAA,MAAA;EAUN,cAAA,EAAA,MAAgB;EAKhB,IAAA,EAAA,MAAA;EAWA,WAAA,CAAA,EAAA,MAAe;EAMf,MAAA,EAAA,SAAA,GAAe,QAAA,GAAA,WAAA;EAQf,MAAA,EAAA,MAAA;EAKA,WAAA,EAAA,MAAA;E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