@goodz-core/sdk 0.3.1 → 0.3.2

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.
@@ -1,4 +1,4 @@
1
- import { X as TransportConfig } from '../transport-BOlScYEv.js';
1
+ import { Y as TransportConfig } from '../transport-BeRIHrA1.js';
2
2
 
3
3
  /**
4
4
  * @goodz-core/sdk — Alive API Type Definitions
@@ -98,5 +98,5 @@ function createGoodZClient(config = {}) {
98
98
  var createUserClient = createGoodZClient;
99
99
 
100
100
  export { createGoodZClient, createUserClient };
101
- //# sourceMappingURL=chunk-KLMCZG4N.js.map
102
- //# sourceMappingURL=chunk-KLMCZG4N.js.map
101
+ //# sourceMappingURL=chunk-GRHO47XL.js.map
102
+ //# sourceMappingURL=chunk-GRHO47XL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":"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","file":"chunk-GRHO47XL.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 InventoryItem,\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<InventoryItem[]>;\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, InventoryItem[]>(\"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"]}
@@ -1,4 +1,4 @@
1
- import { X as TransportConfig } from '../transport-BOlScYEv.js';
1
+ import { Y as TransportConfig } from '../transport-BeRIHrA1.js';
2
2
 
3
3
  /**
4
4
  * @goodz-core/sdk — Commerce / Shops API Type Definitions
@@ -4,8 +4,8 @@ import { ExchangeNamespace } from '../exchange/index.js';
4
4
  export { CompensationDirection, ExchangeAddToWatchlistInput, ExchangeBid, ExchangeBrowseMarketplaceInput, ExchangeBuyListingInput, ExchangeBuyListingOutput, ExchangeCancelListingInput, ExchangeCancelWtbInput, ExchangeCreateListingInput, ExchangeCreateListingOutput, ExchangeCreateWtbInput, ExchangeFulfillWtbInput, ExchangeFulfillWtbOutput, ExchangeGetBidsInput, ExchangeGetListingDetailInput, ExchangeGetMarketDataInput, ExchangeListing, ExchangeMarketData, ExchangePlaceBidInput, ExchangePlaceBidOutput, ExchangePricePoint, ExchangeProposeTradeInput, ExchangeRemoveFromWatchlistInput, ExchangeRespondToTradeInput, ExchangeRespondToTradeOutput, ExchangeTradeItem, ExchangeTradeProposal, ExchangeWatchlistItem, ExchangeWtb, ListingCondition, ListingType } from '../exchange/index.js';
5
5
  import { AliveNamespace } from '../alive/index.js';
6
6
  export { AliveBuildContextInput, AliveChatResponse, AliveClassifiedIntent, AliveClassifyIntentInput, AliveContext, AliveForgetMemoryInput, AliveGetIntimacyInput, AliveIntimacy, AliveMemory, AliveRecallMemoriesInput, AliveSendMessageInput, AliveStoreMemoryInput, AliveUpdateIntimacyInput, IntentCategory, MemoryType, MoodState } from '../alive/index.js';
7
- import { b as AuthUser, A as AuthGetOAuthAppInfoInput, a as AuthOAuthAppInfo, e as CollectibleGetInstanceByIdInput, f as CollectibleGetPublicInstanceInput, g as CollectibleGetPublicInstancesBatchInput, d as CollectibleGetCardProfileInput, h as CollectibleGetShellImageUrlInput, O as ZcoinGetMyBalanceOutput, Q as ZcoinGetMyHistoryInput, L as ZcoinGetDepositPackagesInput, K as ZcoinDepositPackage, D as ZcoinCreateDepositOrderInput, E as ZcoinCreateDepositOrderOutput, M as ZcoinGetDepositStatusInput, N as ZcoinGetDepositStatusOutput, z as ZcoinCommercialTransferInput, B as ZcoinCommercialTransferOutput, R as ZcoinMintAndChargeInput, V as ZcoinMintAndChargeOutput, Z as ZcoinChargeUserInput, y as ZcoinChargeUserOutput, H as ZcoinCreateDirectPurchaseOrderInput, J as ZcoinCreateDirectPurchaseOrderOutput, l as InventoryGetUserInventoryInput, I as InventoryConfirmOwnershipInput, k as InventoryConfirmOwnershipOutput, n as InventoryMintInput, o as InventoryMintOutput, s as InventoryTransferInput, t as InventoryTransferOutput, p as InventoryTransferByCardInput, q as InventoryTransferByCardOutput, m as InventoryGrantMintAuthInput, r as InventoryTransferHistoryInput, w as UserGetPublicProfileInput, x as UserPublicProfile, U as UserGetPublicProfileByIdInput, F as FranchiseGetInput, u as SeriesGetInput, v as SeriesListByFranchiseInput, C as CardGetInput, c as CardListBySeriesInput } from '../transport-BOlScYEv.js';
8
- export { G as GoodZApiError, i as GoodZApiFieldError, j as GoodZErrorV2, P as PurchaseChannel, S as SaleType, T as TransferReason, W as ZcoinTxType } from '../transport-BOlScYEv.js';
7
+ import { b as AuthUser, A as AuthGetOAuthAppInfoInput, a as AuthOAuthAppInfo, e as CollectibleGetInstanceByIdInput, f as CollectibleGetPublicInstanceInput, g as CollectibleGetPublicInstancesBatchInput, d as CollectibleGetCardProfileInput, h as CollectibleGetShellImageUrlInput, Q as ZcoinGetMyBalanceOutput, R as ZcoinGetMyHistoryInput, M as ZcoinGetDepositPackagesInput, L as ZcoinDepositPackage, E as ZcoinCreateDepositOrderInput, H as ZcoinCreateDepositOrderOutput, N as ZcoinGetDepositStatusInput, O as ZcoinGetDepositStatusOutput, B as ZcoinCommercialTransferInput, D as ZcoinCommercialTransferOutput, V as ZcoinMintAndChargeInput, W as ZcoinMintAndChargeOutput, Z as ZcoinChargeUserInput, z as ZcoinChargeUserOutput, J as ZcoinCreateDirectPurchaseOrderInput, K as ZcoinCreateDirectPurchaseOrderOutput, l as InventoryGetUserInventoryInput, n as InventoryItem, I as InventoryConfirmOwnershipInput, k as InventoryConfirmOwnershipOutput, o as InventoryMintInput, p as InventoryMintOutput, t as InventoryTransferInput, u as InventoryTransferOutput, q as InventoryTransferByCardInput, r as InventoryTransferByCardOutput, m as InventoryGrantMintAuthInput, s as InventoryTransferHistoryInput, x as UserGetPublicProfileInput, y as UserPublicProfile, U as UserGetPublicProfileByIdInput, F as FranchiseGetInput, v as SeriesGetInput, w as SeriesListByFranchiseInput, C as CardGetInput, c as CardListBySeriesInput } from '../transport-BeRIHrA1.js';
8
+ export { G as GoodZApiError, i as GoodZApiFieldError, j as GoodZErrorV2, P as PurchaseChannel, S as SaleType, T as TransferReason, X as ZcoinTxType } from '../transport-BeRIHrA1.js';
9
9
 
10
10
  /**
11
11
  * @goodz-core/sdk/core — Unified GoodZ API Client
@@ -142,7 +142,7 @@ interface ZcoinNamespace {
142
142
  }
143
143
  interface InventoryNamespace {
144
144
  /** Get a user's inventory (owned card instances). */
145
- getUserInventory(input: InventoryGetUserInventoryInput): Promise<any[]>;
145
+ getUserInventory(input: InventoryGetUserInventoryInput): Promise<InventoryItem[]>;
146
146
  /** Check if a user owns at least one instance of a specific card. */
147
147
  confirmOwnership(input: InventoryConfirmOwnershipInput): Promise<InventoryConfirmOwnershipOutput>;
148
148
  /**
@@ -279,4 +279,4 @@ declare function createGoodZClient(config?: GoodZClientConfig): GoodZClient;
279
279
  */
280
280
  declare const createUserClient: typeof createGoodZClient;
281
281
 
282
- export { AliveNamespace, AuthGetOAuthAppInfoInput, type AuthNamespace, AuthOAuthAppInfo, AuthUser, CardGetInput, CardListBySeriesInput, CollectibleGetCardProfileInput, CollectibleGetInstanceByIdInput, CollectibleGetPublicInstanceInput, CollectibleGetPublicInstancesBatchInput, CollectibleGetShellImageUrlInput, type CollectibleNamespace, CommerceNamespace, ExchangeNamespace, FranchiseGetInput, type GoodZClient, type GoodZClientConfig, InventoryConfirmOwnershipInput, InventoryConfirmOwnershipOutput, InventoryGetUserInventoryInput, InventoryGrantMintAuthInput, InventoryMintInput, InventoryMintOutput, type InventoryNamespace, InventoryTransferByCardInput, InventoryTransferByCardOutput, InventoryTransferHistoryInput, InventoryTransferInput, InventoryTransferOutput, type IpNamespace, SeriesGetInput, SeriesListByFranchiseInput, UserGetPublicProfileByIdInput, UserGetPublicProfileInput, type UserNamespace, UserPublicProfile, ZcoinChargeUserInput, ZcoinChargeUserOutput, ZcoinCommercialTransferInput, ZcoinCommercialTransferOutput, ZcoinCreateDepositOrderInput, ZcoinCreateDepositOrderOutput, ZcoinCreateDirectPurchaseOrderInput, ZcoinCreateDirectPurchaseOrderOutput, ZcoinDepositPackage, ZcoinGetDepositPackagesInput, ZcoinGetDepositStatusInput, ZcoinGetDepositStatusOutput, ZcoinGetMyBalanceOutput, ZcoinGetMyHistoryInput, ZcoinMintAndChargeInput, ZcoinMintAndChargeOutput, type ZcoinNamespace, createGoodZClient, createUserClient };
282
+ export { AliveNamespace, AuthGetOAuthAppInfoInput, type AuthNamespace, AuthOAuthAppInfo, AuthUser, CardGetInput, CardListBySeriesInput, CollectibleGetCardProfileInput, CollectibleGetInstanceByIdInput, CollectibleGetPublicInstanceInput, CollectibleGetPublicInstancesBatchInput, CollectibleGetShellImageUrlInput, type CollectibleNamespace, CommerceNamespace, ExchangeNamespace, FranchiseGetInput, type GoodZClient, type GoodZClientConfig, InventoryConfirmOwnershipInput, InventoryConfirmOwnershipOutput, InventoryGetUserInventoryInput, InventoryGrantMintAuthInput, InventoryItem, InventoryMintInput, InventoryMintOutput, type InventoryNamespace, InventoryTransferByCardInput, InventoryTransferByCardOutput, InventoryTransferHistoryInput, InventoryTransferInput, InventoryTransferOutput, type IpNamespace, SeriesGetInput, SeriesListByFranchiseInput, UserGetPublicProfileByIdInput, UserGetPublicProfileInput, type UserNamespace, UserPublicProfile, ZcoinChargeUserInput, ZcoinChargeUserOutput, ZcoinCommercialTransferInput, ZcoinCommercialTransferOutput, ZcoinCreateDepositOrderInput, ZcoinCreateDepositOrderOutput, ZcoinCreateDirectPurchaseOrderInput, ZcoinCreateDirectPurchaseOrderOutput, ZcoinDepositPackage, ZcoinGetDepositPackagesInput, ZcoinGetDepositStatusInput, ZcoinGetDepositStatusOutput, ZcoinGetMyBalanceOutput, ZcoinGetMyHistoryInput, ZcoinMintAndChargeInput, ZcoinMintAndChargeOutput, type ZcoinNamespace, createGoodZClient, createUserClient };
@@ -1,4 +1,4 @@
1
- export { createGoodZClient, createUserClient } from '../chunk-KLMCZG4N.js';
1
+ export { createGoodZClient, createUserClient } from '../chunk-GRHO47XL.js';
2
2
  import '../chunk-V73MMKHI.js';
3
3
  import '../chunk-OUKZ2PRD.js';
4
4
  import '../chunk-JAVMQXJM.js';
@@ -1,4 +1,4 @@
1
- import { X as TransportConfig } from '../transport-BOlScYEv.js';
1
+ import { Y as TransportConfig } from '../transport-BeRIHrA1.js';
2
2
 
3
3
  /**
4
4
  * @goodz-core/sdk — Exchange API Type Definitions
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { AuthNamespace, CollectibleNamespace, GoodZClient, GoodZClientConfig, InventoryNamespace, IpNamespace, UserNamespace, ZcoinNamespace, createGoodZClient, createUserClient } from './core/index.js';
2
- export { A as AuthGetOAuthAppInfoInput, a as AuthOAuthAppInfo, b as AuthUser, C as CardGetInput, c as CardListBySeriesInput, d as CollectibleGetCardProfileInput, e as CollectibleGetInstanceByIdInput, f as CollectibleGetPublicInstanceInput, g as CollectibleGetPublicInstancesBatchInput, h as CollectibleGetShellImageUrlInput, F as FranchiseGetInput, G as GoodZApiError, i as GoodZApiFieldError, j as GoodZErrorV2, I as InventoryConfirmOwnershipInput, k as InventoryConfirmOwnershipOutput, l as InventoryGetUserInventoryInput, m as InventoryGrantMintAuthInput, n as InventoryMintInput, o as InventoryMintOutput, p as InventoryTransferByCardInput, q as InventoryTransferByCardOutput, r as InventoryTransferHistoryInput, s as InventoryTransferInput, t as InventoryTransferOutput, P as PurchaseChannel, S as SaleType, u as SeriesGetInput, v as SeriesListByFranchiseInput, T as TransferReason, U as UserGetPublicProfileByIdInput, w as UserGetPublicProfileInput, x as UserPublicProfile, Z as ZcoinChargeUserInput, y as ZcoinChargeUserOutput, z as ZcoinCommercialTransferInput, B as ZcoinCommercialTransferOutput, D as ZcoinCreateDepositOrderInput, E as ZcoinCreateDepositOrderOutput, H as ZcoinCreateDirectPurchaseOrderInput, J as ZcoinCreateDirectPurchaseOrderOutput, K as ZcoinDepositPackage, L as ZcoinGetDepositPackagesInput, M as ZcoinGetDepositStatusInput, N as ZcoinGetDepositStatusOutput, O as ZcoinGetMyBalanceOutput, Q as ZcoinGetMyHistoryInput, R as ZcoinMintAndChargeInput, V as ZcoinMintAndChargeOutput, W as ZcoinTxType } from './transport-BOlScYEv.js';
2
+ export { A as AuthGetOAuthAppInfoInput, a as AuthOAuthAppInfo, b as AuthUser, C as CardGetInput, c as CardListBySeriesInput, d as CollectibleGetCardProfileInput, e as CollectibleGetInstanceByIdInput, f as CollectibleGetPublicInstanceInput, g as CollectibleGetPublicInstancesBatchInput, h as CollectibleGetShellImageUrlInput, F as FranchiseGetInput, G as GoodZApiError, i as GoodZApiFieldError, j as GoodZErrorV2, I as InventoryConfirmOwnershipInput, k as InventoryConfirmOwnershipOutput, l as InventoryGetUserInventoryInput, m as InventoryGrantMintAuthInput, n as InventoryItem, o as InventoryMintInput, p as InventoryMintOutput, q as InventoryTransferByCardInput, r as InventoryTransferByCardOutput, s as InventoryTransferHistoryInput, t as InventoryTransferInput, u as InventoryTransferOutput, P as PurchaseChannel, S as SaleType, v as SeriesGetInput, w as SeriesListByFranchiseInput, T as TransferReason, U as UserGetPublicProfileByIdInput, x as UserGetPublicProfileInput, y as UserPublicProfile, Z as ZcoinChargeUserInput, z as ZcoinChargeUserOutput, B as ZcoinCommercialTransferInput, D as ZcoinCommercialTransferOutput, E as ZcoinCreateDepositOrderInput, H as ZcoinCreateDepositOrderOutput, J as ZcoinCreateDirectPurchaseOrderInput, K as ZcoinCreateDirectPurchaseOrderOutput, L as ZcoinDepositPackage, M as ZcoinGetDepositPackagesInput, N as ZcoinGetDepositStatusInput, O as ZcoinGetDepositStatusOutput, Q as ZcoinGetMyBalanceOutput, R as ZcoinGetMyHistoryInput, V as ZcoinMintAndChargeInput, W as ZcoinMintAndChargeOutput, X as ZcoinTxType } from './transport-BeRIHrA1.js';
3
3
  export { AuthorizationMode, CampaignStatus, CommerceActivateCampaignInput, CommerceBatch, CommerceBatchTier, CommerceBrowseWholesaleInput, CommerceCampaign, CommerceCampaignItem, CommerceCreateBatchInput, CommerceCreateGachaPoolInput, CommerceCreateShopInput, CommerceDeleteWebhookInput, CommerceDrawResult, CommerceEndCampaignInput, CommerceExecutePurchaseInput, CommerceGachaItem, CommerceGachaPool, CommerceGetAuthUrlInput, CommerceGetCampaignInfoInput, CommerceGetCampaignItemsInput, CommerceGetMyOrdersInput, CommerceGetSettlementReportInput, CommerceGetShopDashboardInput, CommerceGetShopsByBlueprintInput, CommerceLaunchCampaignInput, CommerceListMyAppsInput, CommerceManageInventoryInput, CommerceMintToInventoryInput, CommerceNamespace, CommerceOrder, CommercePauseCampaignInput, CommercePityConfig, CommerceProcureBatchInput, CommercePublishToWholesaleInput, CommerceRedeemPhysicalInput, CommerceRegisterAppInput, CommerceRegisterInstancesInput, CommerceRegisterWebhookInput, CommerceSearchMarketplaceInput, CommerceShop, CommerceShopDashboard, CommerceTestWebhookInput, CommerceUpdateAppInput, CommerceUpdateCampaignInput, CommerceWebhook, CommerceWholesaleListing, IntegrationMode, SaleMode } from './commerce/index.js';
4
4
  export { CompensationDirection, ExchangeAddToWatchlistInput, ExchangeBid, ExchangeBrowseMarketplaceInput, ExchangeBuyListingInput, ExchangeBuyListingOutput, ExchangeCancelListingInput, ExchangeCancelWtbInput, ExchangeCreateListingInput, ExchangeCreateListingOutput, ExchangeCreateWtbInput, ExchangeFulfillWtbInput, ExchangeFulfillWtbOutput, ExchangeGetBidsInput, ExchangeGetListingDetailInput, ExchangeGetMarketDataInput, ExchangeListing, ExchangeMarketData, ExchangeNamespace, ExchangePlaceBidInput, ExchangePlaceBidOutput, ExchangePricePoint, ExchangeProposeTradeInput, ExchangeRemoveFromWatchlistInput, ExchangeRespondToTradeInput, ExchangeRespondToTradeOutput, ExchangeTradeItem, ExchangeTradeProposal, ExchangeWatchlistItem, ExchangeWtb, ListingCondition, ListingType } from './exchange/index.js';
5
5
  export { AliveBuildContextInput, AliveChatResponse, AliveClassifiedIntent, AliveClassifyIntentInput, AliveContext, AliveForgetMemoryInput, AliveGetIntimacyInput, AliveIntimacy, AliveMemory, AliveNamespace, AliveRecallMemoriesInput, AliveSendMessageInput, AliveStoreMemoryInput, AliveUpdateIntimacyInput, IntentCategory, MemoryType, MoodState } from './alive/index.js';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { createGoodZClient, createUserClient } from './chunk-KLMCZG4N.js';
1
+ export { createGoodZClient, createUserClient } from './chunk-GRHO47XL.js';
2
2
  export { TokenManager, buildAuthorizationUrl, exchangeCode } from './chunk-EUKUN4JF.js';
3
3
  export { ZCOIN_PRECISION, formatZcoin, formatZcoinWithSymbol, toDisplay, toHundredths } from './chunk-2ZETOE2X.js';
4
4
  export { FORM_FACTORS, GoodZCardFocus, getAspectRatioCSS, getFormFactorSpec } from './chunk-K6IFJWLB.js';
@@ -185,6 +185,37 @@ interface InventoryGetUserInventoryInput {
185
185
  limit?: number;
186
186
  offset?: number;
187
187
  }
188
+ /** A single item in the getUserInventory / mine response */
189
+ interface InventoryItem {
190
+ instanceId: number;
191
+ instanceCode: string;
192
+ shortCode: string;
193
+ instanceNumber: number;
194
+ currentOwnerId: number;
195
+ mintedVia: string;
196
+ mintedAt: number;
197
+ isRedeemed: boolean | null;
198
+ collectibleImageUrl: string | null;
199
+ shellImageUrl: string | null;
200
+ backgroundTemplate: string | null;
201
+ version: number;
202
+ cardId: number;
203
+ cardName: string;
204
+ cardImageUrl: string | null;
205
+ cardFormFactor: string | null;
206
+ /** Rarity label set by the creator (e.g. "SSR", "Rare", "Common") */
207
+ rarity: string | null;
208
+ /** Listing/display image URL — may differ from cardImageUrl */
209
+ listingImageUrl: string | null;
210
+ seriesId: number;
211
+ seriesName: string;
212
+ /** URL to the card blueprint page */
213
+ blueprintUrl: string;
214
+ /** URL to the instance profile page */
215
+ profileUrl: string;
216
+ /** Short public URL (if shortCode exists) */
217
+ publicUrl: string | null;
218
+ }
188
219
  interface InventoryConfirmOwnershipInput {
189
220
  userId: number;
190
221
  cardId: number;
@@ -374,4 +405,4 @@ interface TransportConfig {
374
405
  getHeaders: () => Record<string, string> | Promise<Record<string, string>>;
375
406
  }
376
407
 
377
- export { type AuthGetOAuthAppInfoInput as A, type ZcoinCommercialTransferOutput as B, type CardGetInput as C, type ZcoinCreateDepositOrderInput as D, type ZcoinCreateDepositOrderOutput as E, type FranchiseGetInput as F, GoodZApiError as G, type ZcoinCreateDirectPurchaseOrderInput as H, type InventoryConfirmOwnershipInput as I, type ZcoinCreateDirectPurchaseOrderOutput as J, type ZcoinDepositPackage as K, type ZcoinGetDepositPackagesInput as L, type ZcoinGetDepositStatusInput as M, type ZcoinGetDepositStatusOutput as N, type ZcoinGetMyBalanceOutput as O, type PurchaseChannel as P, type ZcoinGetMyHistoryInput as Q, type ZcoinMintAndChargeInput as R, type SaleType as S, type TransferReason as T, type UserGetPublicProfileByIdInput as U, type ZcoinMintAndChargeOutput as V, type ZcoinTxType as W, type TransportConfig as X, type ZcoinChargeUserInput as Z, type AuthOAuthAppInfo as a, type AuthUser as b, type CardListBySeriesInput as c, type CollectibleGetCardProfileInput as d, type CollectibleGetInstanceByIdInput as e, type CollectibleGetPublicInstanceInput as f, type CollectibleGetPublicInstancesBatchInput as g, type CollectibleGetShellImageUrlInput as h, type GoodZApiFieldError as i, type GoodZErrorV2 as j, type InventoryConfirmOwnershipOutput as k, type InventoryGetUserInventoryInput as l, type InventoryGrantMintAuthInput as m, type InventoryMintInput as n, type InventoryMintOutput as o, type InventoryTransferByCardInput as p, type InventoryTransferByCardOutput as q, type InventoryTransferHistoryInput as r, type InventoryTransferInput as s, type InventoryTransferOutput as t, type SeriesGetInput as u, type SeriesListByFranchiseInput as v, type UserGetPublicProfileInput as w, type UserPublicProfile as x, type ZcoinChargeUserOutput as y, type ZcoinCommercialTransferInput as z };
408
+ export { type AuthGetOAuthAppInfoInput as A, type ZcoinCommercialTransferInput as B, type CardGetInput as C, type ZcoinCommercialTransferOutput as D, type ZcoinCreateDepositOrderInput as E, type FranchiseGetInput as F, GoodZApiError as G, type ZcoinCreateDepositOrderOutput as H, type InventoryConfirmOwnershipInput as I, type ZcoinCreateDirectPurchaseOrderInput as J, type ZcoinCreateDirectPurchaseOrderOutput as K, type ZcoinDepositPackage as L, type ZcoinGetDepositPackagesInput as M, type ZcoinGetDepositStatusInput as N, type ZcoinGetDepositStatusOutput as O, type PurchaseChannel as P, type ZcoinGetMyBalanceOutput as Q, type ZcoinGetMyHistoryInput as R, type SaleType as S, type TransferReason as T, type UserGetPublicProfileByIdInput as U, type ZcoinMintAndChargeInput as V, type ZcoinMintAndChargeOutput as W, type ZcoinTxType as X, type TransportConfig as Y, type ZcoinChargeUserInput as Z, type AuthOAuthAppInfo as a, type AuthUser as b, type CardListBySeriesInput as c, type CollectibleGetCardProfileInput as d, type CollectibleGetInstanceByIdInput as e, type CollectibleGetPublicInstanceInput as f, type CollectibleGetPublicInstancesBatchInput as g, type CollectibleGetShellImageUrlInput as h, type GoodZApiFieldError as i, type GoodZErrorV2 as j, type InventoryConfirmOwnershipOutput as k, type InventoryGetUserInventoryInput as l, type InventoryGrantMintAuthInput as m, type InventoryItem as n, type InventoryMintInput as o, type InventoryMintOutput as p, type InventoryTransferByCardInput as q, type InventoryTransferByCardOutput as r, type InventoryTransferHistoryInput as s, type InventoryTransferInput as t, type InventoryTransferOutput as u, type SeriesGetInput as v, type SeriesListByFranchiseInput as w, type UserGetPublicProfileInput as x, type UserPublicProfile as y, type ZcoinChargeUserOutput as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodz-core/sdk",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Official SDK for the GoodZ Ecosystem — unified API client for Core, Commerce, Exchange, and Alive. Includes OAuth helpers, Z-coin utilities, and React UI components.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/core/index.ts"],"names":[],"mappings":"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","file":"chunk-KLMCZG4N.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"]}