@goodz-core/sdk 0.2.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 @@
1
+ {"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":"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","file":"chunk-7O6UN2D2.js","sourcesContent":["/**\n * @goodz-core/sdk/core — Unified GoodZ API Client\n *\n * One client, all services. Stripe-style namespace architecture:\n * goodz.zcoin.* → Core settlement & Z-coin\n * goodz.inventory.* → Core instance management\n * goodz.collectible.* → Core card queries\n * goodz.user.* → Core user profiles\n * goodz.auth.* → Core auth\n * goodz.ip.* → Core IP (franchise/series/card)\n * goodz.commerce.* → Commerce/Shops (MCP)\n * goodz.exchange.* → Exchange marketplace (MCP)\n * goodz.alive.* → Alive companions (MCP)\n *\n * Core uses tRPC HTTP wire protocol; sub-sites use MCP JSON-RPC 2.0.\n * The client handles routing transparently.\n *\n * @example\n * ```ts\n * import { createGoodZClient } from \"@goodz-core/sdk\";\n *\n * const goodz = createGoodZClient({\n * accessToken: \"your-jwt-token\",\n * });\n *\n * // Core APIs\n * const balance = await goodz.zcoin.getMyBalance();\n * const result = await goodz.zcoin.commercialTransfer({ ... });\n *\n * // Commerce APIs\n * const shop = await goodz.commerce.createShop({ name: \"My Shop\" });\n * const order = await goodz.commerce.executePurchase({ campaignId: 1, quantity: 1 });\n *\n * // Exchange APIs\n * const listing = await goodz.exchange.createListing({ ... });\n * const data = await goodz.exchange.getMarketData({ coreGoodzId: 42 });\n *\n * // Alive APIs\n * const chat = await goodz.alive.sendMessage({ instanceId: 1, userId: 1, message: \"Hello!\" });\n * const memories = await goodz.alive.recallMemories({ instanceId: 1, userId: 1, query: \"birthday\" });\n * ```\n *\n * @module\n */\n\nimport { callQuery, callMutation, GoodZApiError } from \"../transport\";\nimport type { TransportConfig } from \"../transport\";\nimport { createMcpTransportConfig } from \"../mcp-transport\";\nimport { createCommerceNamespace } from \"../commerce/index\";\nimport type { CommerceNamespace } from \"../commerce/index\";\nimport { createExchangeNamespace } from \"../exchange/index\";\nimport type { ExchangeNamespace } from \"../exchange/index\";\nimport { createAliveNamespace } from \"../alive/index\";\nimport type { AliveNamespace } from \"../alive/index\";\nimport type {\n // zcoin\n ZcoinGetMyBalanceOutput,\n ZcoinGetMyHistoryInput,\n ZcoinCommercialTransferInput,\n ZcoinCommercialTransferOutput,\n ZcoinMintAndChargeInput,\n ZcoinMintAndChargeOutput,\n ZcoinChargeUserInput,\n ZcoinChargeUserOutput,\n ZcoinCreateDirectPurchaseOrderInput,\n ZcoinCreateDirectPurchaseOrderOutput,\n ZcoinGetDepositPackagesInput,\n ZcoinDepositPackage,\n ZcoinCreateDepositOrderInput,\n ZcoinCreateDepositOrderOutput,\n ZcoinGetDepositStatusInput,\n ZcoinGetDepositStatusOutput,\n // inventory\n InventoryGetUserInventoryInput,\n InventoryConfirmOwnershipInput,\n InventoryConfirmOwnershipOutput,\n InventoryMintInput,\n InventoryMintOutput,\n InventoryTransferInput,\n InventoryTransferOutput,\n InventoryTransferByCardInput,\n InventoryTransferByCardOutput,\n InventoryGrantMintAuthInput,\n InventoryTransferHistoryInput,\n // collectible\n CollectibleGetInstanceByIdInput,\n CollectibleGetPublicInstanceInput,\n CollectibleGetPublicInstancesBatchInput,\n CollectibleGetCardProfileInput,\n CollectibleGetShellImageUrlInput,\n // user\n UserGetPublicProfileInput,\n UserPublicProfile,\n UserGetPublicProfileByIdInput,\n // auth\n AuthGetOAuthAppInfoInput,\n AuthOAuthAppInfo,\n AuthUser,\n // ip\n FranchiseGetInput,\n SeriesGetInput,\n SeriesListByFranchiseInput,\n CardGetInput,\n CardListBySeriesInput,\n} from \"../types\";\n\n// ─── Re-export types and error class ─────────────────────────\n\nexport { GoodZApiError } from \"../transport\";\nexport type * from \"../types\";\nexport type * from \"../types-commerce\";\nexport type * from \"../types-exchange\";\nexport type * from \"../types-alive\";\nexport type { CommerceNamespace } from \"../commerce/index\";\nexport type { ExchangeNamespace } from \"../exchange/index\";\nexport type { AliveNamespace } from \"../alive/index\";\n\n// ─── Default sub-site URLs ──────────────────────────────────\n\nconst DEFAULT_CORE_URL = \"https://goodzcore.manus.space\";\nconst DEFAULT_COMMERCE_URL = \"https://goodzcommerce.manus.space\";\nconst DEFAULT_EXCHANGE_URL = \"https://goodzexchange.manus.space\";\nconst DEFAULT_ALIVE_URL = \"https://goodzalive.manus.space\";\n\n// ─── Client config ───────────────────────────────────────────\n\nexport interface GoodZClientConfig {\n /**\n * GoodZ.Core base URL.\n * @default \"https://goodzcore.manus.space\"\n */\n coreUrl?: string;\n\n /**\n * GoodZ.Commerce (Shops) base URL.\n * @default \"https://goodzcommerce.manus.space\"\n */\n commerceUrl?: string;\n\n /**\n * GoodZ.Exchange base URL.\n * @default \"https://goodzexchange.manus.space\"\n */\n exchangeUrl?: string;\n\n /**\n * GoodZ.Alive base URL.\n * @default \"https://goodzalive.manus.space\"\n */\n aliveUrl?: string;\n\n /**\n * Static access token (JWT) for authentication.\n * For server-to-server calls, obtain this via OAuth client_credentials flow.\n * For user-context calls, pass the user's access token.\n */\n accessToken?: string;\n\n /**\n * Dynamic token provider — called before every request.\n * Use this when tokens may rotate (e.g., auto-refresh).\n * Takes precedence over `accessToken` if both are set.\n */\n getAccessToken?: () => string | Promise<string>;\n\n /**\n * Custom headers to include in every request.\n * Useful for passing app identifiers or tracing headers.\n */\n headers?: Record<string, string>;\n}\n\n// ─── Core namespace interfaces (tRPC) ───────────────────────\n\nexport interface ZcoinNamespace {\n /** Get the authenticated user's Z-coin balance. */\n getMyBalance(): Promise<ZcoinGetMyBalanceOutput>;\n\n /** Get the authenticated user's Z-coin transaction history. */\n getMyHistory(input?: ZcoinGetMyHistoryInput): Promise<any[]>;\n\n /** Get available Z-coin deposit packages with pricing. */\n getDepositPackages(input?: ZcoinGetDepositPackagesInput): Promise<ZcoinDepositPackage[]>;\n\n /** Create a Stripe checkout session for Z-coin deposit. */\n createDepositOrder(input: ZcoinCreateDepositOrderInput): Promise<ZcoinCreateDepositOrderOutput>;\n\n /** Check the status of a deposit checkout session. */\n getDepositStatus(input: ZcoinGetDepositStatusInput): Promise<ZcoinGetDepositStatusOutput>;\n\n /**\n * Atomic commercial transfer: Z-coin payment + ownership transfer in one transaction.\n * This is the primary API for Commerce and Exchange purchase flows.\n *\n * Idempotent via referenceId — duplicate calls return the same result.\n *\n * @throws {GoodZApiError} BAD_REQUEST — insufficient balance\n * @throws {GoodZApiError} CONFLICT — version conflict (retry)\n * @throws {GoodZApiError} FORBIDDEN — seller doesn't own instance\n */\n commercialTransfer(input: ZcoinCommercialTransferInput): Promise<ZcoinCommercialTransferOutput>;\n\n /**\n * Mint a new card instance and charge the buyer in one atomic transaction.\n * Used by Commerce for gacha and direct-from-creator purchases.\n *\n * Requires mint authorization (granted via inventory.grantMintAuth).\n * Idempotent via referenceId.\n *\n * @throws {GoodZApiError} FORBIDDEN — no mint authorization\n * @throws {GoodZApiError} BAD_REQUEST — insufficient balance\n */\n mintAndCharge(input: ZcoinMintAndChargeInput): Promise<ZcoinMintAndChargeOutput>;\n\n /**\n * Charge a user's Z-coin balance for an in-app purchase.\n * Used by apps that sell non-GoodZ digital goods/services.\n *\n * Idempotent via appOrderId.\n *\n * @throws {GoodZApiError} BAD_REQUEST — insufficient balance\n * @throws {GoodZApiError} CONFLICT — version conflict\n */\n chargeUser(input: ZcoinChargeUserInput): Promise<ZcoinChargeUserOutput>;\n\n /**\n * Create a direct purchase checkout session (fiat → Z-coin → transfer).\n * Transparent intermediation: user sees fiat price, Core handles conversion.\n */\n createDirectPurchaseOrder(input: ZcoinCreateDirectPurchaseOrderInput): Promise<ZcoinCreateDirectPurchaseOrderOutput>;\n}\n\nexport interface InventoryNamespace {\n /** Get a user's inventory (owned card instances). */\n getUserInventory(input: InventoryGetUserInventoryInput): Promise<any[]>;\n\n /** Check if a user owns at least one instance of a specific card. */\n confirmOwnership(input: InventoryConfirmOwnershipInput): Promise<InventoryConfirmOwnershipOutput>;\n\n /**\n * Mint new card instances. Requires franchise ownership or admin role.\n * For Commerce/Exchange, use zcoin.mintAndCharge instead (includes payment).\n */\n mint(input: InventoryMintInput): Promise<InventoryMintOutput>;\n\n /**\n * Transfer a specific card instance to another user.\n * For commercial transfers, use zcoin.commercialTransfer instead.\n *\n * @deprecated for reason=\"purchase\"|\"trade\" — use commercialTransfer\n */\n transfer(input: InventoryTransferInput): Promise<InventoryTransferOutput>;\n\n /**\n * Transfer card instances by cardId (transfers oldest instances).\n * For commercial transfers, use zcoin.commercialTransfer instead.\n *\n * @deprecated for reason=\"purchase\"|\"trade\" — use commercialTransfer\n */\n transferByCard(input: InventoryTransferByCardInput): Promise<InventoryTransferByCardOutput>;\n\n /**\n * Grant mint authorization to another user/app for a specific card.\n * Required before Commerce can call zcoin.mintAndCharge for that card.\n */\n grantMintAuth(input: InventoryGrantMintAuthInput): Promise<any>;\n\n /** Get transfer/ownership history for an instance, card, or user. */\n transferHistory(input: InventoryTransferHistoryInput): Promise<any[]>;\n}\n\nexport interface CollectibleNamespace {\n /** Get a card instance by its numeric ID. Returns full instance data with card chain. */\n getInstanceById(input: CollectibleGetInstanceByIdInput): Promise<any>;\n\n /** Get a card instance by its instance code (public-facing identifier). */\n getPublicInstance(input: CollectibleGetPublicInstanceInput): Promise<any>;\n\n /** Batch-fetch multiple card instances by their IDs (max 100). */\n getPublicInstancesBatch(input: CollectibleGetPublicInstancesBatchInput): Promise<any[]>;\n\n /** Get the card profile (metadata, rarity, series info). */\n getCardProfile(input: CollectibleGetCardProfileInput): Promise<any>;\n\n /** Get the shell (packaging) image URL for a card. */\n getShellImageUrl(input: CollectibleGetShellImageUrlInput): Promise<any>;\n}\n\nexport interface UserNamespace {\n /** Get a user's public profile by openId. */\n getPublicProfile(input: UserGetPublicProfileInput): Promise<UserPublicProfile>;\n\n /** Get a user's public profile by internal userId. */\n getPublicProfileById(input: UserGetPublicProfileByIdInput): Promise<UserPublicProfile>;\n}\n\nexport interface AuthNamespace {\n /** Get the authenticated user's profile. Returns null if not authenticated. */\n me(): Promise<AuthUser | null>;\n\n /** Get public info about an OAuth app by its client ID. */\n getOAuthAppInfo(input: AuthGetOAuthAppInfoInput): Promise<AuthOAuthAppInfo | null>;\n}\n\nexport interface IpNamespace {\n /** Get a franchise by ID or slug. */\n getFranchise(input: FranchiseGetInput): Promise<any>;\n\n /** Get a series by ID or slug. */\n getSeries(input: SeriesGetInput): Promise<any>;\n\n /** List all series in a franchise. */\n listSeriesByFranchise(input: SeriesListByFranchiseInput): Promise<any[]>;\n\n /** Get a card by ID. */\n getCard(input: CardGetInput): Promise<any>;\n\n /** List all cards in a series. */\n listCardsBySeries(input: CardListBySeriesInput): Promise<any[]>;\n}\n\n// ─── GoodZClient type ────────────────────────────────────────\n\nexport interface GoodZClient {\n // ── Core namespaces (tRPC) ──\n readonly zcoin: ZcoinNamespace;\n readonly inventory: InventoryNamespace;\n readonly collectible: CollectibleNamespace;\n readonly user: UserNamespace;\n readonly auth: AuthNamespace;\n readonly ip: IpNamespace;\n\n // ── Sub-site namespaces (MCP) ──\n readonly commerce: CommerceNamespace;\n readonly exchange: ExchangeNamespace;\n readonly alive: AliveNamespace;\n\n /**\n * Make a raw tRPC query call to Core. Use this for routes not yet covered\n * by the typed namespaces.\n */\n rawQuery<T = any>(path: string, input?: any): Promise<T>;\n\n /**\n * Make a raw tRPC mutation call to Core. Use this for routes not yet covered\n * by the typed namespaces.\n */\n rawMutation<T = any>(path: string, input?: any): Promise<T>;\n}\n\n// ─── Client factory ──────────────────────────────────────────\n\n/**\n * Create a unified GoodZ API client — one client for all services.\n *\n * @example Server-to-server with static token\n * ```ts\n * const goodz = createGoodZClient({\n * accessToken: process.env.CORE_ACCESS_TOKEN,\n * });\n *\n * // Core\n * const balance = await goodz.zcoin.getMyBalance();\n *\n * // Commerce\n * const shop = await goodz.commerce.createShop({ name: \"My Shop\" });\n *\n * // Exchange\n * const listings = await goodz.exchange.browseMarketplace();\n *\n * // Alive\n * const chat = await goodz.alive.sendMessage({ instanceId: 1, userId: 1, message: \"Hi!\" });\n * ```\n *\n * @example With dynamic token provider (auto-refresh)\n * ```ts\n * const goodz = createGoodZClient({\n * getAccessToken: async () => {\n * const token = await refreshTokenIfNeeded();\n * return token;\n * },\n * });\n * ```\n *\n * @example Custom sub-site URLs (e.g., staging environment)\n * ```ts\n * const goodz = createGoodZClient({\n * accessToken: \"...\",\n * coreUrl: \"https://staging-core.goodz.dev\",\n * commerceUrl: \"https://staging-commerce.goodz.dev\",\n * exchangeUrl: \"https://staging-exchange.goodz.dev\",\n * aliveUrl: \"https://staging-alive.goodz.dev\",\n * });\n * ```\n */\nexport function createGoodZClient(config: GoodZClientConfig = {}): GoodZClient {\n const {\n coreUrl = DEFAULT_CORE_URL,\n commerceUrl = DEFAULT_COMMERCE_URL,\n exchangeUrl = DEFAULT_EXCHANGE_URL,\n aliveUrl = DEFAULT_ALIVE_URL,\n accessToken,\n getAccessToken,\n headers: customHeaders,\n } = config;\n\n // Shared header builder — used by both tRPC and MCP transports\n const buildHeaders = async (): Promise<Record<string, string>> => {\n const h: Record<string, string> = { ...customHeaders };\n const token = getAccessToken ? await getAccessToken() : accessToken;\n if (token) {\n h[\"Authorization\"] = `Bearer ${token}`;\n }\n return h;\n };\n\n // ── Core transport (tRPC) ──\n const coreTransport: TransportConfig = {\n baseUrl: coreUrl.replace(/\\/$/, \"\"),\n getHeaders: buildHeaders,\n };\n\n // ── Sub-site transports (MCP) ──\n const commerceTransport = createMcpTransportConfig(commerceUrl, buildHeaders);\n const exchangeTransport = createMcpTransportConfig(exchangeUrl, buildHeaders);\n const aliveTransport = createMcpTransportConfig(aliveUrl, buildHeaders);\n\n // Helper shortcuts for Core tRPC\n const q = <I, O>(path: string) => (input?: I) => callQuery<I, O>(coreTransport, path, input);\n const m = <I, O>(path: string) => (input?: I) => callMutation<I, O>(coreTransport, path, input);\n\n return {\n // ── zcoin ──────────────────────────────────────────────\n zcoin: {\n getMyBalance: q<void, ZcoinGetMyBalanceOutput>(\"zcoin.getMyBalance\"),\n getMyHistory: q<ZcoinGetMyHistoryInput, any[]>(\"zcoin.getMyHistory\"),\n getDepositPackages: q<ZcoinGetDepositPackagesInput, ZcoinDepositPackage[]>(\"zcoin.getDepositPackages\"),\n createDepositOrder: m<ZcoinCreateDepositOrderInput, ZcoinCreateDepositOrderOutput>(\"zcoin.createDepositOrder\"),\n getDepositStatus: q<ZcoinGetDepositStatusInput, ZcoinGetDepositStatusOutput>(\"zcoin.getDepositStatus\"),\n commercialTransfer: m<ZcoinCommercialTransferInput, ZcoinCommercialTransferOutput>(\"zcoin.commercialTransfer\"),\n mintAndCharge: m<ZcoinMintAndChargeInput, ZcoinMintAndChargeOutput>(\"zcoin.mintAndCharge\"),\n chargeUser: m<ZcoinChargeUserInput, ZcoinChargeUserOutput>(\"zcoin.chargeUser\"),\n createDirectPurchaseOrder: m<ZcoinCreateDirectPurchaseOrderInput, ZcoinCreateDirectPurchaseOrderOutput>(\"zcoin.createDirectPurchaseOrder\"),\n },\n\n // ── inventory ──────────────────────────────────────────\n inventory: {\n getUserInventory: q<InventoryGetUserInventoryInput, any[]>(\"inventory.getUserInventory\"),\n confirmOwnership: q<InventoryConfirmOwnershipInput, InventoryConfirmOwnershipOutput>(\"inventory.confirmOwnership\"),\n mint: m<InventoryMintInput, InventoryMintOutput>(\"inventory.mint\"),\n transfer: m<InventoryTransferInput, InventoryTransferOutput>(\"inventory.transfer\"),\n transferByCard: m<InventoryTransferByCardInput, InventoryTransferByCardOutput>(\"inventory.transferByCard\"),\n grantMintAuth: m<InventoryGrantMintAuthInput, any>(\"inventory.grantMintAuth\"),\n transferHistory: q<InventoryTransferHistoryInput, any[]>(\"inventory.transferHistory\"),\n },\n\n // ── collectible ────────────────────────────────────────\n collectible: {\n getInstanceById: q<CollectibleGetInstanceByIdInput, any>(\"collectible.getInstanceById\"),\n getPublicInstance: q<CollectibleGetPublicInstanceInput, any>(\"collectible.getPublicInstance\"),\n getPublicInstancesBatch: q<CollectibleGetPublicInstancesBatchInput, any[]>(\"collectible.getPublicInstancesBatch\"),\n getCardProfile: q<CollectibleGetCardProfileInput, any>(\"collectible.getCardProfile\"),\n getShellImageUrl: q<CollectibleGetShellImageUrlInput, any>(\"collectible.getShellImageUrl\"),\n },\n\n // ── user ───────────────────────────────────────────────\n user: {\n getPublicProfile: q<UserGetPublicProfileInput, UserPublicProfile>(\"user.getPublicProfile\"),\n getPublicProfileById: q<UserGetPublicProfileByIdInput, UserPublicProfile>(\"user.getPublicProfileById\"),\n },\n\n // ── auth ───────────────────────────────────────────────\n auth: {\n me: q<void, AuthUser | null>(\"auth.me\"),\n getOAuthAppInfo: q<AuthGetOAuthAppInfoInput, AuthOAuthAppInfo | null>(\"auth.getOAuthAppInfo\"),\n },\n\n // ── ip (franchise/series/card) ─────────────────────────\n ip: {\n getFranchise: q<FranchiseGetInput, any>(\"franchise.get\"),\n getSeries: q<SeriesGetInput, any>(\"series.get\"),\n listSeriesByFranchise: q<SeriesListByFranchiseInput, any[]>(\"series.listByFranchise\"),\n getCard: q<CardGetInput, any>(\"card.get\"),\n listCardsBySeries: q<CardListBySeriesInput, any[]>(\"card.listBySeries\"),\n },\n\n // ── commerce (MCP) ─────────────────────────────────────\n commerce: createCommerceNamespace(commerceTransport),\n\n // ── exchange (MCP) ─────────────────────────────────────\n exchange: createExchangeNamespace(exchangeTransport),\n\n // ── alive (MCP) ────────────────────────────────────────\n alive: createAliveNamespace(aliveTransport),\n\n // ── raw escape hatches (Core tRPC only) ────────────────\n rawQuery: <T = any>(path: string, input?: any) => callQuery<any, T>(coreTransport, path, input),\n rawMutation: <T = any>(path: string, input?: any) => callMutation<any, T>(coreTransport, path, input),\n };\n}\n\n/**\n * Alias for createGoodZClient — creates a client acting on behalf of a user.\n * Semantically identical, but makes the intent clearer in server-to-server code.\n */\nexport const createUserClient = createGoodZClient;\n"]}
@@ -0,0 +1,27 @@
1
+ import { callMcpTool } from './chunk-4SU7SU7K.js';
2
+
3
+ // src/alive/index.ts
4
+ function createAliveNamespace(transport) {
5
+ const tool = (name) => (input) => callMcpTool(transport, name, input);
6
+ return {
7
+ // Memory
8
+ storeMemory: tool("store_memory"),
9
+ recallMemories: tool("recall_memories"),
10
+ forgetMemory: tool("forget_memory"),
11
+ // Intimacy
12
+ getIntimacy: tool("get_intimacy"),
13
+ updateIntimacy: tool("update_intimacy"),
14
+ // Context
15
+ buildContext: tool("build_context"),
16
+ // Intent
17
+ classifyIntent: tool("classify_intent"),
18
+ // Chat
19
+ sendMessage: tool("send_message"),
20
+ // Raw escape hatch
21
+ rawTool: (toolName, args) => callMcpTool(transport, toolName, args)
22
+ };
23
+ }
24
+
25
+ export { createAliveNamespace };
26
+ //# sourceMappingURL=chunk-JAVMQXJM.js.map
27
+ //# sourceMappingURL=chunk-JAVMQXJM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/alive/index.ts"],"names":[],"mappings":";;;AAqEO,SAAS,qBAAqB,SAAA,EAA4C;AAC/E,EAAA,MAAM,IAAA,GAAO,CAAmC,IAAA,KAC9C,CAAC,UAAc,WAAA,CAAkB,SAAA,EAAW,MAAM,KAAU,CAAA;AAE9D,EAAA,OAAO;AAAA;AAAA,IAEL,WAAA,EAAa,KAAyC,cAAc,CAAA;AAAA,IACpE,cAAA,EAAgB,KAA8C,iBAAiB,CAAA;AAAA,IAC/E,YAAA,EAAc,KAAkC,eAAe,CAAA;AAAA;AAAA,IAG/D,WAAA,EAAa,KAA2C,cAAc,CAAA;AAAA,IACtE,cAAA,EAAgB,KAA8C,iBAAiB,CAAA;AAAA;AAAA,IAG/E,YAAA,EAAc,KAA2C,eAAe,CAAA;AAAA;AAAA,IAGxE,cAAA,EAAgB,KAAsD,iBAAiB,CAAA;AAAA;AAAA,IAGvF,WAAA,EAAa,KAA+C,cAAc,CAAA;AAAA;AAAA,IAG1E,SAAS,CAAU,QAAA,EAAkB,SACnC,WAAA,CAAoC,SAAA,EAAW,UAAU,IAAI;AAAA,GACjE;AACF","file":"chunk-JAVMQXJM.js","sourcesContent":["/**\n * @goodz-core/sdk — Alive Namespace\n *\n * Provides typed access to GoodZ.Alive MCP tools:\n * memory management, intimacy/affection, context building,\n * intent classification, and chat sessions.\n *\n * GoodZ.Alive gives each GoodZ card a \"soul\" — an AI-powered\n * companion that remembers, grows, and responds uniquely.\n *\n * @module\n */\n\nimport { callMcpTool } from \"../mcp-transport\";\nimport type { TransportConfig } from \"../mcp-transport\";\nimport type {\n AliveStoreMemoryInput,\n AliveMemory,\n AliveRecallMemoriesInput,\n AliveForgetMemoryInput,\n AliveGetIntimacyInput,\n AliveIntimacy,\n AliveUpdateIntimacyInput,\n AliveBuildContextInput,\n AliveContext,\n AliveClassifyIntentInput,\n AliveClassifiedIntent,\n AliveSendMessageInput,\n AliveChatResponse,\n} from \"../types-alive\";\n\n// Re-export all Alive types\nexport type * from \"../types-alive\";\n\n// ─── Namespace interface ────────────────────────────────────\n\nexport interface AliveNamespace {\n // Memory\n /** Store a new memory for a character-user pair. */\n storeMemory(input: AliveStoreMemoryInput): Promise<AliveMemory>;\n /** Recall relevant memories using semantic search. */\n recallMemories(input: AliveRecallMemoriesInput): Promise<AliveMemory[]>;\n /** Delete a specific memory. */\n forgetMemory(input: AliveForgetMemoryInput): Promise<any>;\n\n // Intimacy\n /** Get the intimacy/affection state between a character and user. */\n getIntimacy(input: AliveGetIntimacyInput): Promise<AliveIntimacy>;\n /** Update intimacy level (e.g., after a positive/negative interaction). */\n updateIntimacy(input: AliveUpdateIntimacyInput): Promise<AliveIntimacy>;\n\n // Context\n /** Build a full context object for AI generation (profile + memories + history + system prompt). */\n buildContext(input: AliveBuildContextInput): Promise<AliveContext>;\n\n // Intent\n /** Classify a user's message into an intent category. */\n classifyIntent(input: AliveClassifyIntentInput): Promise<AliveClassifiedIntent>;\n\n // Chat\n /** Send a message and get a character response (includes memory, intimacy, and intent processing). */\n sendMessage(input: AliveSendMessageInput): Promise<AliveChatResponse>;\n\n /** Call a raw MCP tool by name. Escape hatch for tools not yet in the typed API. */\n rawTool<T = any>(toolName: string, args?: Record<string, any>): Promise<T>;\n}\n\n// ─── Factory ────────────────────────────────────────────────\n\nexport function createAliveNamespace(transport: TransportConfig): AliveNamespace {\n const tool = <I extends Record<string, any>, O>(name: string) =>\n (input?: I) => callMcpTool<I, O>(transport, name, input as I);\n\n return {\n // Memory\n storeMemory: tool<AliveStoreMemoryInput, AliveMemory>(\"store_memory\"),\n recallMemories: tool<AliveRecallMemoriesInput, AliveMemory[]>(\"recall_memories\"),\n forgetMemory: tool<AliveForgetMemoryInput, any>(\"forget_memory\"),\n\n // Intimacy\n getIntimacy: tool<AliveGetIntimacyInput, AliveIntimacy>(\"get_intimacy\"),\n updateIntimacy: tool<AliveUpdateIntimacyInput, AliveIntimacy>(\"update_intimacy\"),\n\n // Context\n buildContext: tool<AliveBuildContextInput, AliveContext>(\"build_context\"),\n\n // Intent\n classifyIntent: tool<AliveClassifyIntentInput, AliveClassifiedIntent>(\"classify_intent\"),\n\n // Chat\n sendMessage: tool<AliveSendMessageInput, AliveChatResponse>(\"send_message\"),\n\n // Raw escape hatch\n rawTool: <T = any>(toolName: string, args?: Record<string, any>) =>\n callMcpTool<Record<string, any>, T>(transport, toolName, args),\n };\n}\n"]}
@@ -0,0 +1,56 @@
1
+ import { callMcpTool } from './chunk-4SU7SU7K.js';
2
+
3
+ // src/commerce/index.ts
4
+ function createCommerceNamespace(transport) {
5
+ const tool = (name) => (input) => callMcpTool(transport, name, input);
6
+ return {
7
+ // Shop
8
+ createShop: tool("create_shop"),
9
+ getShopDashboard: tool("get_shop_dashboard"),
10
+ // Product Assembly
11
+ createBatch: tool("create_batch"),
12
+ createGachaPool: tool("create_gacha_pool"),
13
+ // Campaign Lifecycle
14
+ launchCampaign: tool("launch_sales_campaign"),
15
+ activateCampaign: tool("activate_campaign"),
16
+ pauseCampaign: tool("pause_campaign"),
17
+ endCampaign: tool("end_campaign"),
18
+ updateCampaign: tool("update_campaign"),
19
+ getCampaignInfo: tool("get_campaign_info"),
20
+ getCampaignItems: tool("get_campaign_items"),
21
+ // Purchase
22
+ executePurchase: tool("execute_purchase"),
23
+ getMyOrders: tool("get_my_orders"),
24
+ // Wholesale
25
+ publishToWholesale: tool("publish_to_wholesale"),
26
+ browseWholesale: tool("browse_wholesale"),
27
+ procureBatch: tool("procure_batch"),
28
+ // Inventory
29
+ manageInventory: tool("manage_inventory"),
30
+ registerInstances: tool("register_instances"),
31
+ mintToInventory: tool("mint_to_inventory"),
32
+ // Settlement
33
+ getSettlementReport: tool("get_settlement_report"),
34
+ // Discovery
35
+ searchMarketplace: tool("search_marketplace"),
36
+ getShopsByBlueprint: tool("get_shops_by_blueprint"),
37
+ // Physical Redemption
38
+ redeemPhysical: tool("redeem_physical_goodz"),
39
+ // Webhooks
40
+ registerWebhook: tool("register_webhook"),
41
+ listWebhooks: tool("list_webhooks"),
42
+ testWebhook: tool("test_webhook"),
43
+ deleteWebhook: tool("delete_webhook"),
44
+ // OAuth App
45
+ registerApp: tool("register_app"),
46
+ updateApp: tool("update_app"),
47
+ listMyApps: tool("list_my_apps"),
48
+ getAuthUrl: tool("get_auth_url"),
49
+ // Raw escape hatch
50
+ rawTool: (toolName, args) => callMcpTool(transport, toolName, args)
51
+ };
52
+ }
53
+
54
+ export { createCommerceNamespace };
55
+ //# sourceMappingURL=chunk-MUZDYQ67.js.map
56
+ //# sourceMappingURL=chunk-MUZDYQ67.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commerce/index.ts"],"names":[],"mappings":";;;AAuJO,SAAS,wBAAwB,SAAA,EAA+C;AACrF,EAAA,MAAM,IAAA,GAAO,CAAmC,IAAA,KAC9C,CAAC,UAAc,WAAA,CAAkB,SAAA,EAAW,MAAM,KAAU,CAAA;AAE9D,EAAA,OAAO;AAAA;AAAA,IAEL,UAAA,EAAY,KAA4C,aAAa,CAAA;AAAA,IACrE,gBAAA,EAAkB,KAA2D,oBAAoB,CAAA;AAAA;AAAA,IAGjG,WAAA,EAAa,KAA8C,cAAc,CAAA;AAAA,IACzE,eAAA,EAAiB,KAAsD,mBAAmB,CAAA;AAAA;AAAA,IAG1F,cAAA,EAAgB,KAAoD,uBAAuB,CAAA;AAAA,IAC3F,gBAAA,EAAkB,KAAsD,mBAAmB,CAAA;AAAA,IAC3F,aAAA,EAAe,KAAmD,gBAAgB,CAAA;AAAA,IAClF,WAAA,EAAa,KAAiD,cAAc,CAAA;AAAA,IAC5E,cAAA,EAAgB,KAAoD,iBAAiB,CAAA;AAAA,IACrF,eAAA,EAAiB,KAAwC,mBAAmB,CAAA;AAAA,IAC5E,gBAAA,EAAkB,KAA4D,oBAAoB,CAAA;AAAA;AAAA,IAGlG,eAAA,EAAiB,KAAuD,kBAAkB,CAAA;AAAA,IAC1F,WAAA,EAAa,KAAgD,eAAe,CAAA;AAAA;AAAA,IAG5E,kBAAA,EAAoB,KAA2C,sBAAsB,CAAA;AAAA,IACrF,eAAA,EAAiB,KAA+D,kBAAkB,CAAA;AAAA,IAClG,YAAA,EAAc,KAAqC,eAAe,CAAA;AAAA;AAAA,IAGlE,eAAA,EAAiB,KAAwC,kBAAkB,CAAA;AAAA,IAC3E,iBAAA,EAAmB,KAA0C,oBAAoB,CAAA;AAAA,IACjF,eAAA,EAAiB,KAAwC,mBAAmB,CAAA;AAAA;AAAA,IAG5E,mBAAA,EAAqB,KAA4C,uBAAuB,CAAA;AAAA;AAAA,IAGxF,iBAAA,EAAmB,KAA4C,oBAAoB,CAAA;AAAA,IACnF,mBAAA,EAAqB,KAA8C,wBAAwB,CAAA;AAAA;AAAA,IAG3F,cAAA,EAAgB,KAAuC,uBAAuB,CAAA;AAAA;AAAA,IAG9E,eAAA,EAAiB,KAAoD,kBAAkB,CAAA;AAAA,IACvF,YAAA,EAAc,KAA+C,eAAe,CAAA;AAAA,IAC5E,WAAA,EAAa,KAAoC,cAAc,CAAA;AAAA,IAC/D,aAAA,EAAe,KAAsC,gBAAgB,CAAA;AAAA;AAAA,IAGrE,WAAA,EAAa,KAAoC,cAAc,CAAA;AAAA,IAC/D,SAAA,EAAW,KAAkC,YAAY,CAAA;AAAA,IACzD,UAAA,EAAY,KAAqC,cAAc,CAAA;AAAA,IAC/D,UAAA,EAAY,KAA+C,cAAc,CAAA;AAAA;AAAA,IAGzE,SAAS,CAAU,QAAA,EAAkB,SACnC,WAAA,CAAoC,SAAA,EAAW,UAAU,IAAI;AAAA,GACjE;AACF","file":"chunk-MUZDYQ67.js","sourcesContent":["/**\n * @goodz-core/sdk — Commerce / Shops Namespace\n *\n * Provides typed access to GoodZ.Commerce MCP tools:\n * shop management, batches, gacha pools, campaigns,\n * wholesale, purchases, settlement, and webhooks.\n *\n * @module\n */\n\nimport { callMcpTool } from \"../mcp-transport\";\nimport type { TransportConfig } from \"../mcp-transport\";\nimport type {\n CommerceCreateShopInput,\n CommerceShop,\n CommerceGetShopDashboardInput,\n CommerceShopDashboard,\n CommerceCreateBatchInput,\n CommerceBatch,\n CommerceCreateGachaPoolInput,\n CommerceGachaPool,\n CommerceLaunchCampaignInput,\n CommerceCampaign,\n CommerceActivateCampaignInput,\n CommercePauseCampaignInput,\n CommerceEndCampaignInput,\n CommerceUpdateCampaignInput,\n CommerceGetCampaignInfoInput,\n CommerceGetCampaignItemsInput,\n CommerceCampaignItem,\n CommerceExecutePurchaseInput,\n CommerceDrawResult,\n CommerceGetMyOrdersInput,\n CommerceOrder,\n CommercePublishToWholesaleInput,\n CommerceBrowseWholesaleInput,\n CommerceWholesaleListing,\n CommerceProcureBatchInput,\n CommerceManageInventoryInput,\n CommerceRegisterInstancesInput,\n CommerceMintToInventoryInput,\n CommerceGetSettlementReportInput,\n CommerceSearchMarketplaceInput,\n CommerceGetShopsByBlueprintInput,\n CommerceRedeemPhysicalInput,\n CommerceRegisterWebhookInput,\n CommerceWebhook,\n CommerceTestWebhookInput,\n CommerceDeleteWebhookInput,\n CommerceRegisterAppInput,\n CommerceUpdateAppInput,\n CommerceListMyAppsInput,\n CommerceGetAuthUrlInput,\n} from \"../types-commerce\";\n\n// Re-export all Commerce types\nexport type * from \"../types-commerce\";\n\n// ─── Namespace interface ────────────────────────────────────\n\nexport interface CommerceNamespace {\n // Shop Management\n /** Create a new shop. */\n createShop(input: CommerceCreateShopInput): Promise<CommerceShop>;\n /** Get shop dashboard with stats, revenue, and recent orders. */\n getShopDashboard(input?: CommerceGetShopDashboardInput): Promise<CommerceShopDashboard>;\n\n // Product Assembly\n /** Create a batch (product assembly with tiers). Supports blind_box, ichiban_kuji, direct_sale. */\n createBatch(input: CommerceCreateBatchInput): Promise<CommerceBatch>;\n /** Create a gacha pool with weighted probabilities and optional pity mechanics. */\n createGachaPool(input: CommerceCreateGachaPoolInput): Promise<CommerceGachaPool>;\n\n // Campaign Lifecycle\n /** Launch a sales campaign in draft status. Connect a Batch or Gacha pool to the storefront. */\n launchCampaign(input: CommerceLaunchCampaignInput): Promise<CommerceCampaign>;\n /** Activate a draft/paused campaign — makes it live and purchasable. */\n activateCampaign(input: CommerceActivateCampaignInput): Promise<CommerceCampaign>;\n /** Pause an active campaign. Existing orders unaffected. */\n pauseCampaign(input: CommercePauseCampaignInput): Promise<CommerceCampaign>;\n /** Permanently end a campaign (terminal state). */\n endCampaign(input: CommerceEndCampaignInput): Promise<CommerceCampaign>;\n /** Update campaign configuration (editable fields depend on status). */\n updateCampaign(input: CommerceUpdateCampaignInput): Promise<CommerceCampaign>;\n /** Get detailed campaign info including batch/gacha config and tiers. */\n getCampaignInfo(input: CommerceGetCampaignInfoInput): Promise<any>;\n /** Get unified campaign items list (works for both batch and gacha campaigns). */\n getCampaignItems(input: CommerceGetCampaignItemsInput): Promise<CommerceCampaignItem[]>;\n\n // Purchase / Draw\n /** Execute a purchase or draw. Handles payment, draw mechanics, settlement, and ownership transfer. */\n executePurchase(input: CommerceExecutePurchaseInput): Promise<CommerceDrawResult>;\n /** Get the authenticated user's order history. */\n getMyOrders(input?: CommerceGetMyOrdersInput): Promise<CommerceOrder[]>;\n\n // Wholesale\n /** Publish a batch to the wholesale market for other shopkeepers to procure. */\n publishToWholesale(input: CommercePublishToWholesaleInput): Promise<any>;\n /** Browse available wholesale listings. */\n browseWholesale(input?: CommerceBrowseWholesaleInput): Promise<CommerceWholesaleListing[]>;\n /** Procure goods from the wholesale market. */\n procureBatch(input: CommerceProcureBatchInput): Promise<any>;\n\n // Inventory\n /** View and manage shop inventory (list or sync from Core). */\n manageInventory(input?: CommerceManageInventoryInput): Promise<any>;\n /** Register existing Core instances into shop inventory. */\n registerInstances(input: CommerceRegisterInstancesInput): Promise<any>;\n /** Mint new instances directly into shop inventory. */\n mintToInventory(input: CommerceMintToInventoryInput): Promise<any>;\n\n // Settlement\n /** Get settlement report with revenue breakdown. */\n getSettlementReport(input?: CommerceGetSettlementReportInput): Promise<any>;\n\n // Discovery\n /** Search the marketplace for campaigns. */\n searchMarketplace(input?: CommerceSearchMarketplaceInput): Promise<any[]>;\n /** Find shops selling a specific GoodZ card. */\n getShopsByBlueprint(input: CommerceGetShopsByBlueprintInput): Promise<any[]>;\n\n // Physical Redemption\n /** Request physical redemption for a purchased item. */\n redeemPhysical(input: CommerceRedeemPhysicalInput): Promise<any>;\n\n // Webhooks\n /** Register a webhook URL to receive shop event notifications. */\n registerWebhook(input: CommerceRegisterWebhookInput): Promise<CommerceWebhook>;\n /** List all registered webhook endpoints. */\n listWebhooks(): Promise<CommerceWebhook[]>;\n /** Send a test ping to a webhook endpoint. */\n testWebhook(input: CommerceTestWebhookInput): Promise<any>;\n /** Delete a webhook endpoint. */\n deleteWebhook(input: CommerceDeleteWebhookInput): Promise<any>;\n\n // OAuth App Management\n /** Register a new OAuth application with Commerce scopes. */\n registerApp(input: CommerceRegisterAppInput): Promise<any>;\n /** Update an existing OAuth application. */\n updateApp(input: CommerceUpdateAppInput): Promise<any>;\n /** List all OAuth applications owned by the user. */\n listMyApps(input?: CommerceListMyAppsInput): Promise<any[]>;\n /** Generate an OAuth authorization URL. */\n getAuthUrl(input?: CommerceGetAuthUrlInput): Promise<{ url: string }>;\n\n /** Call a raw MCP tool by name. Escape hatch for tools not yet in the typed API. */\n rawTool<T = any>(toolName: string, args?: Record<string, any>): Promise<T>;\n}\n\n// ─── Factory ────────────────────────────────────────────────\n\nexport function createCommerceNamespace(transport: TransportConfig): CommerceNamespace {\n const tool = <I extends Record<string, any>, O>(name: string) =>\n (input?: I) => callMcpTool<I, O>(transport, name, input as I);\n\n return {\n // Shop\n createShop: tool<CommerceCreateShopInput, CommerceShop>(\"create_shop\"),\n getShopDashboard: tool<CommerceGetShopDashboardInput, CommerceShopDashboard>(\"get_shop_dashboard\"),\n\n // Product Assembly\n createBatch: tool<CommerceCreateBatchInput, CommerceBatch>(\"create_batch\"),\n createGachaPool: tool<CommerceCreateGachaPoolInput, CommerceGachaPool>(\"create_gacha_pool\"),\n\n // Campaign Lifecycle\n launchCampaign: tool<CommerceLaunchCampaignInput, CommerceCampaign>(\"launch_sales_campaign\"),\n activateCampaign: tool<CommerceActivateCampaignInput, CommerceCampaign>(\"activate_campaign\"),\n pauseCampaign: tool<CommercePauseCampaignInput, CommerceCampaign>(\"pause_campaign\"),\n endCampaign: tool<CommerceEndCampaignInput, CommerceCampaign>(\"end_campaign\"),\n updateCampaign: tool<CommerceUpdateCampaignInput, CommerceCampaign>(\"update_campaign\"),\n getCampaignInfo: tool<CommerceGetCampaignInfoInput, any>(\"get_campaign_info\"),\n getCampaignItems: tool<CommerceGetCampaignItemsInput, CommerceCampaignItem[]>(\"get_campaign_items\"),\n\n // Purchase\n executePurchase: tool<CommerceExecutePurchaseInput, CommerceDrawResult>(\"execute_purchase\"),\n getMyOrders: tool<CommerceGetMyOrdersInput, CommerceOrder[]>(\"get_my_orders\"),\n\n // Wholesale\n publishToWholesale: tool<CommercePublishToWholesaleInput, any>(\"publish_to_wholesale\"),\n browseWholesale: tool<CommerceBrowseWholesaleInput, CommerceWholesaleListing[]>(\"browse_wholesale\"),\n procureBatch: tool<CommerceProcureBatchInput, any>(\"procure_batch\"),\n\n // Inventory\n manageInventory: tool<CommerceManageInventoryInput, any>(\"manage_inventory\"),\n registerInstances: tool<CommerceRegisterInstancesInput, any>(\"register_instances\"),\n mintToInventory: tool<CommerceMintToInventoryInput, any>(\"mint_to_inventory\"),\n\n // Settlement\n getSettlementReport: tool<CommerceGetSettlementReportInput, any>(\"get_settlement_report\"),\n\n // Discovery\n searchMarketplace: tool<CommerceSearchMarketplaceInput, any[]>(\"search_marketplace\"),\n getShopsByBlueprint: tool<CommerceGetShopsByBlueprintInput, any[]>(\"get_shops_by_blueprint\"),\n\n // Physical Redemption\n redeemPhysical: tool<CommerceRedeemPhysicalInput, any>(\"redeem_physical_goodz\"),\n\n // Webhooks\n registerWebhook: tool<CommerceRegisterWebhookInput, CommerceWebhook>(\"register_webhook\"),\n listWebhooks: tool<Record<string, never>, CommerceWebhook[]>(\"list_webhooks\"),\n testWebhook: tool<CommerceTestWebhookInput, any>(\"test_webhook\"),\n deleteWebhook: tool<CommerceDeleteWebhookInput, any>(\"delete_webhook\"),\n\n // OAuth App\n registerApp: tool<CommerceRegisterAppInput, any>(\"register_app\"),\n updateApp: tool<CommerceUpdateAppInput, any>(\"update_app\"),\n listMyApps: tool<CommerceListMyAppsInput, any[]>(\"list_my_apps\"),\n getAuthUrl: tool<CommerceGetAuthUrlInput, { url: string }>(\"get_auth_url\"),\n\n // Raw escape hatch\n rawTool: <T = any>(toolName: string, args?: Record<string, any>) =>\n callMcpTool<Record<string, any>, T>(transport, toolName, args),\n };\n}\n"]}
@@ -0,0 +1,37 @@
1
+ import { callMcpTool } from './chunk-4SU7SU7K.js';
2
+
3
+ // src/exchange/index.ts
4
+ function createExchangeNamespace(transport) {
5
+ const tool = (name) => (input) => callMcpTool(transport, name, input);
6
+ return {
7
+ // Marketplace
8
+ browseMarketplace: tool("browse_marketplace"),
9
+ getListingDetail: tool("get_listing_detail"),
10
+ // Listing Management
11
+ createListing: tool("create_listing"),
12
+ cancelListing: tool("cancel_listing"),
13
+ // Purchase & Bidding
14
+ buyListing: tool("buy_listing"),
15
+ placeBid: tool("place_bid"),
16
+ getBids: tool("get_bids"),
17
+ // WTB
18
+ createWtb: tool("create_wtb"),
19
+ fulfillWtb: tool("fulfill_wtb"),
20
+ cancelWtb: tool("cancel_wtb"),
21
+ // P2P Trade
22
+ proposeTrade: tool("propose_trade"),
23
+ respondToTrade: tool("respond_to_trade"),
24
+ // Watchlist
25
+ getWatchlist: tool("get_watchlist"),
26
+ addToWatchlist: tool("add_to_watchlist"),
27
+ removeFromWatchlist: tool("remove_from_watchlist"),
28
+ // Market Data
29
+ getMarketData: tool("get_market_data"),
30
+ // Raw escape hatch
31
+ rawTool: (toolName, args) => callMcpTool(transport, toolName, args)
32
+ };
33
+ }
34
+
35
+ export { createExchangeNamespace };
36
+ //# sourceMappingURL=chunk-OUKZ2PRD.js.map
37
+ //# sourceMappingURL=chunk-OUKZ2PRD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/exchange/index.ts"],"names":[],"mappings":";;;AAqGO,SAAS,wBAAwB,SAAA,EAA+C;AACrF,EAAA,MAAM,IAAA,GAAO,CAAmC,IAAA,KAC9C,CAAC,UAAc,WAAA,CAAkB,SAAA,EAAW,MAAM,KAAU,CAAA;AAE9D,EAAA,OAAO;AAAA;AAAA,IAEL,iBAAA,EAAmB,KAAwD,oBAAoB,CAAA;AAAA,IAC/F,gBAAA,EAAkB,KAAqD,oBAAoB,CAAA;AAAA;AAAA,IAG3F,aAAA,EAAe,KAA8D,gBAAgB,CAAA;AAAA,IAC7F,aAAA,EAAe,KAAsC,gBAAgB,CAAA;AAAA;AAAA,IAGrE,UAAA,EAAY,KAAwD,aAAa,CAAA;AAAA,IACjF,QAAA,EAAU,KAAoD,WAAW,CAAA;AAAA,IACzE,OAAA,EAAS,KAA0C,UAAU,CAAA;AAAA;AAAA,IAG7D,SAAA,EAAW,KAA0C,YAAY,CAAA;AAAA,IACjE,UAAA,EAAY,KAAwD,aAAa,CAAA;AAAA,IACjF,SAAA,EAAW,KAAkC,YAAY,CAAA;AAAA;AAAA,IAGzD,YAAA,EAAc,KAAuD,eAAe,CAAA;AAAA,IACpF,cAAA,EAAgB,KAAgE,kBAAkB,CAAA;AAAA;AAAA,IAGlG,YAAA,EAAc,KAAqD,eAAe,CAAA;AAAA,IAClF,cAAA,EAAgB,KAAyD,kBAAkB,CAAA;AAAA,IAC3F,mBAAA,EAAqB,KAA4C,uBAAuB,CAAA;AAAA;AAAA,IAGxF,aAAA,EAAe,KAAqD,iBAAiB,CAAA;AAAA;AAAA,IAGrF,SAAS,CAAU,QAAA,EAAkB,SACnC,WAAA,CAAoC,SAAA,EAAW,UAAU,IAAI;AAAA,GACjE;AACF","file":"chunk-OUKZ2PRD.js","sourcesContent":["/**\n * @goodz-core/sdk — Exchange Namespace\n *\n * Provides typed access to GoodZ.Exchange MCP tools:\n * marketplace listings, auctions, WTB, P2P trades,\n * watchlist, and market data.\n *\n * All prices are in Z-coin (1 Z-coin = $0.10 USD).\n *\n * @module\n */\n\nimport { callMcpTool } from \"../mcp-transport\";\nimport type { TransportConfig } from \"../mcp-transport\";\nimport type {\n ExchangeBrowseMarketplaceInput,\n ExchangeListing,\n ExchangeGetListingDetailInput,\n ExchangeCreateListingInput,\n ExchangeCreateListingOutput,\n ExchangeCancelListingInput,\n ExchangeBuyListingInput,\n ExchangeBuyListingOutput,\n ExchangePlaceBidInput,\n ExchangePlaceBidOutput,\n ExchangeGetBidsInput,\n ExchangeBid,\n ExchangeCreateWtbInput,\n ExchangeWtb,\n ExchangeFulfillWtbInput,\n ExchangeFulfillWtbOutput,\n ExchangeCancelWtbInput,\n ExchangeProposeTradeInput,\n ExchangeTradeProposal,\n ExchangeRespondToTradeInput,\n ExchangeRespondToTradeOutput,\n ExchangeAddToWatchlistInput,\n ExchangeWatchlistItem,\n ExchangeRemoveFromWatchlistInput,\n ExchangeGetMarketDataInput,\n ExchangeMarketData,\n} from \"../types-exchange\";\n\n// Re-export all Exchange types\nexport type * from \"../types-exchange\";\n\n// ─── Namespace interface ────────────────────────────────────\n\nexport interface ExchangeNamespace {\n // Marketplace\n /** Browse active marketplace listings. */\n browseMarketplace(input?: ExchangeBrowseMarketplaceInput): Promise<ExchangeListing[]>;\n /** Get detailed info about a specific listing. */\n getListingDetail(input: ExchangeGetListingDetailInput): Promise<ExchangeListing>;\n\n // Listing Management\n /** Create a new listing (fixed_price or auction). Core locks the instance atomically. */\n createListing(input: ExchangeCreateListingInput): Promise<ExchangeCreateListingOutput>;\n /** Cancel an active listing. Core unlocks the instance. */\n cancelListing(input: ExchangeCancelListingInput): Promise<any>;\n\n // Purchase & Bidding\n /** Buy a fixed-price listing. Z-coin debit + ownership transfer via Core settlement. */\n buyListing(input: ExchangeBuyListingInput): Promise<ExchangeBuyListingOutput>;\n /** Place a bid on an auction. If bid meets buy-now price, immediate purchase is executed. */\n placeBid(input: ExchangePlaceBidInput): Promise<ExchangePlaceBidOutput>;\n /** Get all bids for an auction listing (highest first). */\n getBids(input: ExchangeGetBidsInput): Promise<ExchangeBid[]>;\n\n // Want-to-Buy\n /** Create a WTB request — announce what you're looking for. */\n createWtb(input: ExchangeCreateWtbInput): Promise<ExchangeWtb>;\n /** Fulfill a WTB request by offering your item. Settlement via Core. */\n fulfillWtb(input: ExchangeFulfillWtbInput): Promise<ExchangeFulfillWtbOutput>;\n /** Cancel your own WTB request. */\n cancelWtb(input: ExchangeCancelWtbInput): Promise<any>;\n\n // P2P Trade\n /** Propose a trade/swap with another user. Optional Z-coin compensation. */\n proposeTrade(input: ExchangeProposeTradeInput): Promise<ExchangeTradeProposal>;\n /** Accept or reject a trade proposal. If accepted, all items transfer via Core. */\n respondToTrade(input: ExchangeRespondToTradeInput): Promise<ExchangeRespondToTradeOutput>;\n\n // Watchlist\n /** Get your watchlist. */\n getWatchlist(): Promise<ExchangeWatchlistItem[]>;\n /** Add a GoodZ or listing to your watchlist. */\n addToWatchlist(input: ExchangeAddToWatchlistInput): Promise<ExchangeWatchlistItem>;\n /** Remove an item from your watchlist. */\n removeFromWatchlist(input: ExchangeRemoveFromWatchlistInput): Promise<any>;\n\n // Market Data\n /** Get market data: price history, floor price, volume, trends. */\n getMarketData(input: ExchangeGetMarketDataInput): Promise<ExchangeMarketData>;\n\n /** Call a raw MCP tool by name. Escape hatch for tools not yet in the typed API. */\n rawTool<T = any>(toolName: string, args?: Record<string, any>): Promise<T>;\n}\n\n// ─── Factory ────────────────────────────────────────────────\n\nexport function createExchangeNamespace(transport: TransportConfig): ExchangeNamespace {\n const tool = <I extends Record<string, any>, O>(name: string) =>\n (input?: I) => callMcpTool<I, O>(transport, name, input as I);\n\n return {\n // Marketplace\n browseMarketplace: tool<ExchangeBrowseMarketplaceInput, ExchangeListing[]>(\"browse_marketplace\"),\n getListingDetail: tool<ExchangeGetListingDetailInput, ExchangeListing>(\"get_listing_detail\"),\n\n // Listing Management\n createListing: tool<ExchangeCreateListingInput, ExchangeCreateListingOutput>(\"create_listing\"),\n cancelListing: tool<ExchangeCancelListingInput, any>(\"cancel_listing\"),\n\n // Purchase & Bidding\n buyListing: tool<ExchangeBuyListingInput, ExchangeBuyListingOutput>(\"buy_listing\"),\n placeBid: tool<ExchangePlaceBidInput, ExchangePlaceBidOutput>(\"place_bid\"),\n getBids: tool<ExchangeGetBidsInput, ExchangeBid[]>(\"get_bids\"),\n\n // WTB\n createWtb: tool<ExchangeCreateWtbInput, ExchangeWtb>(\"create_wtb\"),\n fulfillWtb: tool<ExchangeFulfillWtbInput, ExchangeFulfillWtbOutput>(\"fulfill_wtb\"),\n cancelWtb: tool<ExchangeCancelWtbInput, any>(\"cancel_wtb\"),\n\n // P2P Trade\n proposeTrade: tool<ExchangeProposeTradeInput, ExchangeTradeProposal>(\"propose_trade\"),\n respondToTrade: tool<ExchangeRespondToTradeInput, ExchangeRespondToTradeOutput>(\"respond_to_trade\"),\n\n // Watchlist\n getWatchlist: tool<Record<string, never>, ExchangeWatchlistItem[]>(\"get_watchlist\"),\n addToWatchlist: tool<ExchangeAddToWatchlistInput, ExchangeWatchlistItem>(\"add_to_watchlist\"),\n removeFromWatchlist: tool<ExchangeRemoveFromWatchlistInput, any>(\"remove_from_watchlist\"),\n\n // Market Data\n getMarketData: tool<ExchangeGetMarketDataInput, ExchangeMarketData>(\"get_market_data\"),\n\n // Raw escape hatch\n rawTool: <T = any>(toolName: string, args?: Record<string, any>) =>\n callMcpTool<Record<string, any>, T>(transport, toolName, args),\n };\n}\n"]}
@@ -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"}