@goodz-core/sdk 0.1.0 → 0.3.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.
@@ -0,0 +1,407 @@
1
+ import { X as TransportConfig } from '../transport-BOlScYEv.js';
2
+
3
+ /**
4
+ * @goodz-core/sdk — Commerce / Shops API Type Definitions
5
+ *
6
+ * Hand-crafted types mirroring the GoodZ.Commerce MCP tool surface.
7
+ * These cover shop management, batches, gacha pools, campaigns,
8
+ * wholesale, purchases, and settlement.
9
+ *
10
+ * @module
11
+ */
12
+ type CampaignStatus = "draft" | "active" | "paused" | "ended" | "sold_out";
13
+ type SaleMode = "blind_box" | "ichiban_kuji" | "direct_sale" | "gacha";
14
+ type AuthorizationMode = "open" | "whitelist" | "approved_only";
15
+ type IntegrationMode = "hosted" | "custom";
16
+ interface CommerceCreateShopInput {
17
+ name: string;
18
+ description?: string;
19
+ imageUrl?: string;
20
+ userId?: number;
21
+ }
22
+ interface CommerceShop {
23
+ id: number;
24
+ name: string;
25
+ description: string | null;
26
+ imageUrl: string | null;
27
+ ownerId: number;
28
+ createdAt: string;
29
+ }
30
+ interface CommerceGetShopDashboardInput {
31
+ shopId?: number;
32
+ userId?: number;
33
+ }
34
+ interface CommerceShopDashboard {
35
+ shop: CommerceShop;
36
+ stats: {
37
+ totalOrders: number;
38
+ totalRevenue: number;
39
+ platformFees: number;
40
+ creatorShare: number;
41
+ shopShare: number;
42
+ activeCampaigns: number;
43
+ };
44
+ recentOrders: any[];
45
+ }
46
+ interface CommerceBatchTier {
47
+ tierName: string;
48
+ coreCardId: number;
49
+ quantity: number;
50
+ retailPriceCents: number;
51
+ imageUrl?: string;
52
+ }
53
+ interface CommerceCreateBatchInput {
54
+ shopId?: number;
55
+ name: string;
56
+ description?: string;
57
+ imageUrl?: string;
58
+ saleMode: SaleMode;
59
+ tiers: CommerceBatchTier[];
60
+ userId?: number;
61
+ }
62
+ interface CommerceBatch {
63
+ id: number;
64
+ name: string;
65
+ description: string | null;
66
+ saleMode: SaleMode;
67
+ status: string;
68
+ tiers: CommerceBatchTier[];
69
+ createdAt: string;
70
+ }
71
+ interface CommerceGachaItem {
72
+ coreCardId: number;
73
+ name?: string;
74
+ imageUrl?: string;
75
+ weight: number;
76
+ rarity?: string;
77
+ quantity?: number;
78
+ }
79
+ interface CommercePityConfig {
80
+ softPityStart?: number;
81
+ hardPityAt?: number;
82
+ stepUpGuarantee?: number;
83
+ guaranteedRarity?: string;
84
+ }
85
+ interface CommerceCreateGachaPoolInput {
86
+ shopId?: number;
87
+ name: string;
88
+ description?: string;
89
+ imageUrl?: string;
90
+ pricePerDrawCents: number;
91
+ isLimited: boolean;
92
+ totalDraws?: number;
93
+ items?: CommerceGachaItem[];
94
+ pityConfig?: CommercePityConfig;
95
+ userId?: number;
96
+ }
97
+ interface CommerceGachaPool {
98
+ id: number;
99
+ name: string;
100
+ description: string | null;
101
+ pricePerDrawCents: number;
102
+ isLimited: boolean;
103
+ totalDraws: number | null;
104
+ remainingDraws: number | null;
105
+ items: CommerceGachaItem[];
106
+ pityConfig: CommercePityConfig | null;
107
+ createdAt: string;
108
+ }
109
+ interface CommerceLaunchCampaignInput {
110
+ shopId?: number;
111
+ name: string;
112
+ description?: string;
113
+ imageUrl?: string;
114
+ batchId?: number;
115
+ gachaPoolId?: number;
116
+ isProcured?: boolean;
117
+ procurementId?: number;
118
+ startsAt?: string;
119
+ endsAt?: string;
120
+ userId?: number;
121
+ }
122
+ interface CommerceCampaign {
123
+ id: number;
124
+ name: string;
125
+ description: string | null;
126
+ imageUrl: string | null;
127
+ status: CampaignStatus;
128
+ batchId: number | null;
129
+ gachaPoolId: number | null;
130
+ startsAt: string | null;
131
+ endsAt: string | null;
132
+ createdAt: string;
133
+ }
134
+ interface CommerceActivateCampaignInput {
135
+ campaignId: number;
136
+ userId?: number;
137
+ }
138
+ interface CommercePauseCampaignInput {
139
+ campaignId: number;
140
+ userId?: number;
141
+ }
142
+ interface CommerceEndCampaignInput {
143
+ campaignId: number;
144
+ userId?: number;
145
+ }
146
+ interface CommerceUpdateCampaignInput {
147
+ campaignId: number;
148
+ name?: string;
149
+ description?: string;
150
+ imageUrl?: string;
151
+ startsAt?: string;
152
+ endsAt?: string;
153
+ userId?: number;
154
+ }
155
+ interface CommerceGetCampaignInfoInput {
156
+ campaignId: number;
157
+ }
158
+ interface CommerceGetCampaignItemsInput {
159
+ campaign_id: number;
160
+ enrich_images?: boolean;
161
+ }
162
+ interface CommerceCampaignItem {
163
+ sourceType: "batch" | "gacha";
164
+ coreCardId: number;
165
+ name: string | null;
166
+ imageUrl: string | null;
167
+ quantity: number | null;
168
+ probability: number | null;
169
+ retailPriceCents: number | null;
170
+ rarity: string | null;
171
+ }
172
+ interface CommerceExecutePurchaseInput {
173
+ campaignId: number;
174
+ quantity?: number;
175
+ tierId?: number;
176
+ userId?: number;
177
+ }
178
+ interface CommerceDrawResult {
179
+ orderId: number;
180
+ items: Array<{
181
+ cardId: number;
182
+ cardName: string | null;
183
+ imageUrl: string | null;
184
+ instanceId: number;
185
+ instanceCode: string;
186
+ rarity: string | null;
187
+ tierName: string | null;
188
+ }>;
189
+ totalCharged: number;
190
+ platformFee: number;
191
+ }
192
+ interface CommerceGetMyOrdersInput {
193
+ userId?: number;
194
+ limit?: number;
195
+ }
196
+ interface CommerceOrder {
197
+ id: number;
198
+ campaignId: number;
199
+ campaignName: string;
200
+ quantity: number;
201
+ totalPaid: number;
202
+ status: string;
203
+ createdAt: string;
204
+ items: any[];
205
+ }
206
+ interface CommercePublishToWholesaleInput {
207
+ batchId: number;
208
+ wholesalePriceCents?: number;
209
+ channelMarginBps?: number;
210
+ totalStock?: number;
211
+ authorizationMode?: AuthorizationMode;
212
+ userId?: number;
213
+ }
214
+ interface CommerceBrowseWholesaleInput {
215
+ keyword?: string;
216
+ minPrice?: number;
217
+ maxPrice?: number;
218
+ authorizationMode?: AuthorizationMode;
219
+ creatorId?: string;
220
+ saleMode?: string;
221
+ limit?: number;
222
+ }
223
+ interface CommerceWholesaleListing {
224
+ id: number;
225
+ batchId: number;
226
+ batchName: string;
227
+ wholesalePriceCents: number | null;
228
+ channelMarginBps: number | null;
229
+ totalStock: number | null;
230
+ remainingStock: number | null;
231
+ authorizationMode: AuthorizationMode;
232
+ saleMode: SaleMode;
233
+ creatorId: string;
234
+ }
235
+ interface CommerceProcureBatchInput {
236
+ listingId: number;
237
+ quantity?: number;
238
+ shopId?: number;
239
+ userId?: number;
240
+ }
241
+ interface CommerceManageInventoryInput {
242
+ action?: "list" | "sync";
243
+ shopId?: number;
244
+ userId?: number;
245
+ }
246
+ interface CommerceRegisterInstancesInput {
247
+ shopId?: number;
248
+ instanceIds: number[];
249
+ userId?: number;
250
+ }
251
+ interface CommerceMintToInventoryInput {
252
+ shopId?: number;
253
+ coreCardId: number;
254
+ quantity?: number;
255
+ userId?: number;
256
+ }
257
+ interface CommerceGetSettlementReportInput {
258
+ shopId?: number;
259
+ userId?: number;
260
+ period?: string;
261
+ }
262
+ interface CommerceSearchMarketplaceInput {
263
+ keyword?: string;
264
+ saleMode?: SaleMode;
265
+ minPrice?: number;
266
+ maxPrice?: number;
267
+ limit?: number;
268
+ offset?: number;
269
+ }
270
+ interface CommerceGetShopsByBlueprintInput {
271
+ coreCardId: number;
272
+ limit?: number;
273
+ }
274
+ interface CommerceRedeemPhysicalInput {
275
+ orderItemId: number;
276
+ shippingName: string;
277
+ shippingAddress: string;
278
+ shippingPhone: string;
279
+ coreCardId?: number;
280
+ userId?: number;
281
+ }
282
+ interface CommerceRegisterWebhookInput {
283
+ url: string;
284
+ events: string[];
285
+ shop_id?: number;
286
+ }
287
+ interface CommerceWebhook {
288
+ id: number;
289
+ url: string;
290
+ events: string[];
291
+ status: string;
292
+ failureCount: number;
293
+ signingSecret?: string;
294
+ }
295
+ interface CommerceTestWebhookInput {
296
+ webhook_id: number;
297
+ }
298
+ interface CommerceDeleteWebhookInput {
299
+ webhook_id: number;
300
+ }
301
+ interface CommerceRegisterAppInput {
302
+ appName: string;
303
+ redirectUris?: string[];
304
+ coreScopes?: string[];
305
+ commerceScopes?: string[];
306
+ userId?: number;
307
+ }
308
+ interface CommerceUpdateAppInput {
309
+ clientId: string;
310
+ appName?: string;
311
+ description?: string;
312
+ websiteUrl?: string;
313
+ iconUrl?: string;
314
+ redirectUris?: string[];
315
+ coreScopes?: string[];
316
+ commerceScopes?: string[];
317
+ integrationMode?: IntegrationMode;
318
+ userId?: number;
319
+ }
320
+ interface CommerceListMyAppsInput {
321
+ userId?: number;
322
+ }
323
+ interface CommerceGetAuthUrlInput {
324
+ callbackUrl?: string;
325
+ }
326
+
327
+ /**
328
+ * @goodz-core/sdk — Commerce / Shops Namespace
329
+ *
330
+ * Provides typed access to GoodZ.Commerce MCP tools:
331
+ * shop management, batches, gacha pools, campaigns,
332
+ * wholesale, purchases, settlement, and webhooks.
333
+ *
334
+ * @module
335
+ */
336
+
337
+ interface CommerceNamespace {
338
+ /** Create a new shop. */
339
+ createShop(input: CommerceCreateShopInput): Promise<CommerceShop>;
340
+ /** Get shop dashboard with stats, revenue, and recent orders. */
341
+ getShopDashboard(input?: CommerceGetShopDashboardInput): Promise<CommerceShopDashboard>;
342
+ /** Create a batch (product assembly with tiers). Supports blind_box, ichiban_kuji, direct_sale. */
343
+ createBatch(input: CommerceCreateBatchInput): Promise<CommerceBatch>;
344
+ /** Create a gacha pool with weighted probabilities and optional pity mechanics. */
345
+ createGachaPool(input: CommerceCreateGachaPoolInput): Promise<CommerceGachaPool>;
346
+ /** Launch a sales campaign in draft status. Connect a Batch or Gacha pool to the storefront. */
347
+ launchCampaign(input: CommerceLaunchCampaignInput): Promise<CommerceCampaign>;
348
+ /** Activate a draft/paused campaign — makes it live and purchasable. */
349
+ activateCampaign(input: CommerceActivateCampaignInput): Promise<CommerceCampaign>;
350
+ /** Pause an active campaign. Existing orders unaffected. */
351
+ pauseCampaign(input: CommercePauseCampaignInput): Promise<CommerceCampaign>;
352
+ /** Permanently end a campaign (terminal state). */
353
+ endCampaign(input: CommerceEndCampaignInput): Promise<CommerceCampaign>;
354
+ /** Update campaign configuration (editable fields depend on status). */
355
+ updateCampaign(input: CommerceUpdateCampaignInput): Promise<CommerceCampaign>;
356
+ /** Get detailed campaign info including batch/gacha config and tiers. */
357
+ getCampaignInfo(input: CommerceGetCampaignInfoInput): Promise<any>;
358
+ /** Get unified campaign items list (works for both batch and gacha campaigns). */
359
+ getCampaignItems(input: CommerceGetCampaignItemsInput): Promise<CommerceCampaignItem[]>;
360
+ /** Execute a purchase or draw. Handles payment, draw mechanics, settlement, and ownership transfer. */
361
+ executePurchase(input: CommerceExecutePurchaseInput): Promise<CommerceDrawResult>;
362
+ /** Get the authenticated user's order history. */
363
+ getMyOrders(input?: CommerceGetMyOrdersInput): Promise<CommerceOrder[]>;
364
+ /** Publish a batch to the wholesale market for other shopkeepers to procure. */
365
+ publishToWholesale(input: CommercePublishToWholesaleInput): Promise<any>;
366
+ /** Browse available wholesale listings. */
367
+ browseWholesale(input?: CommerceBrowseWholesaleInput): Promise<CommerceWholesaleListing[]>;
368
+ /** Procure goods from the wholesale market. */
369
+ procureBatch(input: CommerceProcureBatchInput): Promise<any>;
370
+ /** View and manage shop inventory (list or sync from Core). */
371
+ manageInventory(input?: CommerceManageInventoryInput): Promise<any>;
372
+ /** Register existing Core instances into shop inventory. */
373
+ registerInstances(input: CommerceRegisterInstancesInput): Promise<any>;
374
+ /** Mint new instances directly into shop inventory. */
375
+ mintToInventory(input: CommerceMintToInventoryInput): Promise<any>;
376
+ /** Get settlement report with revenue breakdown. */
377
+ getSettlementReport(input?: CommerceGetSettlementReportInput): Promise<any>;
378
+ /** Search the marketplace for campaigns. */
379
+ searchMarketplace(input?: CommerceSearchMarketplaceInput): Promise<any[]>;
380
+ /** Find shops selling a specific GoodZ card. */
381
+ getShopsByBlueprint(input: CommerceGetShopsByBlueprintInput): Promise<any[]>;
382
+ /** Request physical redemption for a purchased item. */
383
+ redeemPhysical(input: CommerceRedeemPhysicalInput): Promise<any>;
384
+ /** Register a webhook URL to receive shop event notifications. */
385
+ registerWebhook(input: CommerceRegisterWebhookInput): Promise<CommerceWebhook>;
386
+ /** List all registered webhook endpoints. */
387
+ listWebhooks(): Promise<CommerceWebhook[]>;
388
+ /** Send a test ping to a webhook endpoint. */
389
+ testWebhook(input: CommerceTestWebhookInput): Promise<any>;
390
+ /** Delete a webhook endpoint. */
391
+ deleteWebhook(input: CommerceDeleteWebhookInput): Promise<any>;
392
+ /** Register a new OAuth application with Commerce scopes. */
393
+ registerApp(input: CommerceRegisterAppInput): Promise<any>;
394
+ /** Update an existing OAuth application. */
395
+ updateApp(input: CommerceUpdateAppInput): Promise<any>;
396
+ /** List all OAuth applications owned by the user. */
397
+ listMyApps(input?: CommerceListMyAppsInput): Promise<any[]>;
398
+ /** Generate an OAuth authorization URL. */
399
+ getAuthUrl(input?: CommerceGetAuthUrlInput): Promise<{
400
+ url: string;
401
+ }>;
402
+ /** Call a raw MCP tool by name. Escape hatch for tools not yet in the typed API. */
403
+ rawTool<T = any>(toolName: string, args?: Record<string, any>): Promise<T>;
404
+ }
405
+ declare function createCommerceNamespace(transport: TransportConfig): CommerceNamespace;
406
+
407
+ export { type AuthorizationMode, type CampaignStatus, type CommerceActivateCampaignInput, type CommerceBatch, type CommerceBatchTier, type CommerceBrowseWholesaleInput, type CommerceCampaign, type CommerceCampaignItem, type CommerceCreateBatchInput, type CommerceCreateGachaPoolInput, type CommerceCreateShopInput, type CommerceDeleteWebhookInput, type CommerceDrawResult, type CommerceEndCampaignInput, type CommerceExecutePurchaseInput, type CommerceGachaItem, type CommerceGachaPool, type CommerceGetAuthUrlInput, type CommerceGetCampaignInfoInput, type CommerceGetCampaignItemsInput, type CommerceGetMyOrdersInput, type CommerceGetSettlementReportInput, type CommerceGetShopDashboardInput, type CommerceGetShopsByBlueprintInput, type CommerceLaunchCampaignInput, type CommerceListMyAppsInput, type CommerceManageInventoryInput, type CommerceMintToInventoryInput, type CommerceNamespace, type CommerceOrder, type CommercePauseCampaignInput, type CommercePityConfig, type CommerceProcureBatchInput, type CommercePublishToWholesaleInput, type CommerceRedeemPhysicalInput, type CommerceRegisterAppInput, type CommerceRegisterInstancesInput, type CommerceRegisterWebhookInput, type CommerceSearchMarketplaceInput, type CommerceShop, type CommerceShopDashboard, type CommerceTestWebhookInput, type CommerceUpdateAppInput, type CommerceUpdateCampaignInput, type CommerceWebhook, type CommerceWholesaleListing, type IntegrationMode, type SaleMode, createCommerceNamespace };
@@ -0,0 +1,4 @@
1
+ export { createCommerceNamespace } from '../chunk-MUZDYQ67.js';
2
+ import '../chunk-4SU7SU7K.js';
3
+ //# sourceMappingURL=index.js.map
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}