@01.software/sdk 0.5.10 → 0.7.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.
Files changed (46) hide show
  1. package/README.md +14 -2
  2. package/dist/auth.d.cts +1 -1
  3. package/dist/auth.d.ts +1 -1
  4. package/dist/{const-DQZQAXex.d.cts → const-6BfmvZug.d.cts} +2 -2
  5. package/dist/{const-Bk3-zigV.d.ts → const-DQYzabjw.d.ts} +2 -2
  6. package/dist/index.cjs +7 -7
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.d.cts +19 -9
  9. package/dist/index.d.ts +19 -9
  10. package/dist/index.js +7 -7
  11. package/dist/index.js.map +1 -1
  12. package/dist/{payload-types-DCVm1syH.d.cts → payload-types-CFDtFiSz.d.cts} +47 -47
  13. package/dist/{payload-types-DCVm1syH.d.ts → payload-types-CFDtFiSz.d.ts} +47 -47
  14. package/dist/realtime.cjs.map +1 -1
  15. package/dist/realtime.d.cts +2 -2
  16. package/dist/realtime.d.ts +2 -2
  17. package/dist/realtime.js.map +1 -1
  18. package/dist/{server-StNHlSjW.d.cts → server-DxhuG-_s.d.cts} +34 -34
  19. package/dist/{server-StNHlSjW.d.ts → server-DxhuG-_s.d.ts} +34 -34
  20. package/dist/ui/{flow → canvas}/server.cjs +20 -20
  21. package/dist/ui/canvas/server.cjs.map +1 -0
  22. package/dist/ui/canvas/server.d.cts +3 -0
  23. package/dist/ui/canvas/server.d.ts +3 -0
  24. package/dist/ui/{flow → canvas}/server.js +19 -19
  25. package/dist/ui/canvas/server.js.map +1 -0
  26. package/dist/ui/{flow.cjs → canvas.cjs} +63 -63
  27. package/dist/ui/canvas.cjs.map +1 -0
  28. package/dist/ui/{flow.d.cts → canvas.d.cts} +35 -35
  29. package/dist/ui/{flow.d.ts → canvas.d.ts} +35 -35
  30. package/dist/ui/{flow.js → canvas.js} +59 -59
  31. package/dist/ui/canvas.js.map +1 -0
  32. package/dist/ui/form.d.cts +1 -1
  33. package/dist/ui/form.d.ts +1 -1
  34. package/dist/ui/video.d.cts +1 -1
  35. package/dist/ui/video.d.ts +1 -1
  36. package/dist/{webhook-BTtG_8f2.d.ts → webhook-BB8amLBv.d.ts} +2 -2
  37. package/dist/{webhook-TDfT7aKA.d.cts → webhook-CrBjPpUT.d.cts} +2 -2
  38. package/dist/webhook.d.cts +3 -3
  39. package/dist/webhook.d.ts +3 -3
  40. package/package.json +13 -13
  41. package/dist/ui/flow/server.cjs.map +0 -1
  42. package/dist/ui/flow/server.d.cts +0 -3
  43. package/dist/ui/flow/server.d.ts +0 -3
  44. package/dist/ui/flow/server.js.map +0 -1
  45. package/dist/ui/flow.cjs.map +0 -1
  46. package/dist/ui/flow.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/core/query/realtime-hooks.ts","../src/core/query/realtime.ts","../src/core/client/types.ts","../src/core/query/query-keys.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { RealtimeConnection, type RealtimeEvent } from './realtime'\nimport { resolveApiUrl, type PublicCollection } from '../client/types'\nimport { collectionKeys } from './query-keys'\n\nexport type { RealtimeEvent }\n\nexport interface UseRealtimeQueryOptions {\n /** Filter events to specific collections. Empty/undefined = all collections. */\n collections?: PublicCollection[]\n /** Enable/disable the SSE connection. Default: true. */\n enabled?: boolean\n}\n\nexport interface UseRealtimeQueryResult {\n /** Whether the SSE connection is currently active. */\n connected: boolean\n /** The last received event, or null. */\n lastEvent: RealtimeEvent | null\n}\n\n/**\n * React hook that subscribes to real-time collection change events via SSE.\n * Automatically invalidates React Query cache when changes are detected.\n *\n * @example\n * ```tsx\n * const { connected } = useRealtimeQuery({\n * clientKey: 'your-key',\n * getToken: () => client.customer.getToken(),\n * collections: ['products', 'orders'],\n * })\n * ```\n */\nexport function useRealtimeQuery(options: {\n clientKey: string\n getToken: () => string | null\n collections?: PublicCollection[]\n enabled?: boolean\n}): UseRealtimeQueryResult {\n const { clientKey, getToken, collections, enabled = true } = options\n const queryClient = useQueryClient()\n const [connected, setConnected] = useState(false)\n const [lastEvent, setLastEvent] = useState<RealtimeEvent | null>(null)\n const connectionRef = useRef<RealtimeConnection | null>(null)\n\n useEffect(() => {\n if (!enabled || !clientKey) return\n\n const baseUrl = resolveApiUrl()\n const conn = new RealtimeConnection(\n baseUrl,\n clientKey,\n getToken,\n collections,\n )\n connectionRef.current = conn\n\n // Listen for events and invalidate queries\n const removeListener = conn.addListener((event) => {\n setLastEvent(event)\n\n // Invalidate all queries for the changed collection\n const keys = collectionKeys(event.collection as PublicCollection)\n queryClient.invalidateQueries({ queryKey: keys.all })\n })\n\n // Track connection state\n const pollInterval = setInterval(() => {\n setConnected(conn.connected)\n }, 1000)\n\n conn.connect()\n\n return () => {\n conn.disconnect()\n removeListener()\n clearInterval(pollInterval)\n connectionRef.current = null\n setConnected(false)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [clientKey, enabled, collections?.join(',')])\n\n return { connected, lastEvent }\n}\n","/**\n * Fetch-based SSE connection manager for real-time collection change events.\n * Uses fetch + ReadableStream to support custom auth headers (unlike native EventSource).\n */\n\nexport interface RealtimeEvent {\n collection: string\n operation: string\n id: string | null\n timestamp: string\n}\n\nexport type RealtimeListener = (event: RealtimeEvent) => void\n\nconst INITIAL_RECONNECT_DELAY = 1_000\nconst MAX_RECONNECT_DELAY = 30_000\nconst RECONNECT_BACKOFF_FACTOR = 2\nconst MAX_NO_TOKEN_RETRIES = 5\n\nexport class RealtimeConnection {\n private abortController: AbortController | null = null\n private reconnectAttempt = 0\n private noTokenAttempts = 0\n private reconnectTimer: ReturnType<typeof setTimeout> | null = null\n private listeners = new Set<RealtimeListener>()\n private _connected = false\n\n constructor(\n private baseUrl: string,\n private clientKey: string,\n private getToken: () => string | null,\n private collections?: string[],\n ) {}\n\n get connected(): boolean {\n return this._connected\n }\n\n addListener(fn: RealtimeListener): () => void {\n this.listeners.add(fn)\n return () => this.listeners.delete(fn)\n }\n\n connect(): void {\n if (this.abortController) return // Already connecting/connected\n\n this.abortController = new AbortController()\n this.startStream(this.abortController.signal)\n }\n\n disconnect(): void {\n this._connected = false\n if (this.reconnectTimer) {\n clearTimeout(this.reconnectTimer)\n this.reconnectTimer = null\n }\n if (this.abortController) {\n this.abortController.abort()\n this.abortController = null\n }\n this.reconnectAttempt = 0\n this.noTokenAttempts = 0\n }\n\n private async startStream(signal: AbortSignal): Promise<void> {\n const token = this.getToken()\n if (!token) {\n this.noTokenAttempts++\n if (this.noTokenAttempts >= MAX_NO_TOKEN_RETRIES) {\n // Stop reconnecting — no token available after multiple attempts\n this._connected = false\n this.abortController = null\n return\n }\n this.scheduleReconnect()\n return\n }\n this.noTokenAttempts = 0\n\n const params = this.collections?.length\n ? `?collections=${this.collections.join(',')}`\n : ''\n const url = `${this.baseUrl}/api/events/stream${params}`\n\n try {\n const response = await fetch(url, {\n headers: {\n 'X-Client-Key': this.clientKey,\n Authorization: `Bearer ${token}`,\n },\n signal,\n })\n\n if (!response.ok) {\n if (response.status === 401) {\n // Token expired — try reconnecting (will get fresh token)\n this.scheduleReconnect()\n return\n }\n throw new Error(`SSE connection failed: ${response.status}`)\n }\n\n if (!response.body) {\n throw new Error('SSE response has no body')\n }\n\n this._connected = true\n this.reconnectAttempt = 0\n\n await this.readStream(response.body, signal)\n } catch {\n if (signal.aborted) return // Intentional disconnect\n this._connected = false\n this.scheduleReconnect()\n }\n }\n\n private async readStream(\n body: ReadableStream<Uint8Array>,\n signal: AbortSignal,\n ): Promise<void> {\n const reader = body.getReader()\n const decoder = new TextDecoder()\n let buffer = ''\n let currentEvent = ''\n let currentData = ''\n\n try {\n while (true) {\n const { done, value } = await reader.read()\n if (done || signal.aborted) break\n\n buffer += decoder.decode(value, { stream: true })\n const lines = buffer.split('\\n')\n buffer = lines.pop() ?? '' // Keep incomplete last line in buffer\n\n for (const line of lines) {\n if (line.startsWith('event: ')) {\n currentEvent = line.slice(7)\n } else if (line.startsWith('data: ')) {\n currentData += (currentData ? '\\n' : '') + line.slice(6)\n } else if (line === '') {\n // Empty line = end of event\n if (currentEvent === 'collection:change' && currentData) {\n try {\n const event: RealtimeEvent = JSON.parse(currentData)\n for (const listener of this.listeners) {\n try {\n listener(event)\n } catch {\n // Listener error — ignore\n }\n }\n } catch {\n // Malformed JSON — ignore\n }\n }\n currentEvent = ''\n currentData = ''\n }\n // Ignore comment lines (: heartbeat)\n }\n }\n } catch {\n // Stream read error\n } finally {\n reader.releaseLock()\n this._connected = false\n if (!signal.aborted) {\n this.scheduleReconnect()\n }\n }\n }\n\n private scheduleReconnect(): void {\n if (this.reconnectTimer) return\n\n const delay = Math.min(\n INITIAL_RECONNECT_DELAY *\n Math.pow(RECONNECT_BACKOFF_FACTOR, this.reconnectAttempt),\n MAX_RECONNECT_DELAY,\n )\n this.reconnectAttempt++\n\n this.reconnectTimer = setTimeout(() => {\n this.reconnectTimer = null\n this.abortController = new AbortController()\n this.startStream(this.abortController.signal)\n }, delay)\n }\n}\n","import type { Sort, Where } from 'payload'\n\nimport type { Collection, PublicCollection } from '../collection/const'\n\nexport type { Collection, PublicCollection }\n\n// ============================================================================\n// API URL Configuration\n// ============================================================================\n\ndeclare const __DEFAULT_API_URL__: string\n\n/**\n * API URL을 반환합니다.\n * 환경변수 SOFTWARE_API_URL 또는 NEXT_PUBLIC_SOFTWARE_API_URL로 오버라이드 가능.\n * 빌드 시 버전에 따라 기본값 결정: dev 빌드 → api-dev, 정식 → api.01.software\n */\nexport function resolveApiUrl(): string {\n if (typeof process !== 'undefined' && process.env) {\n const envUrl =\n process.env.SOFTWARE_API_URL || process.env.NEXT_PUBLIC_SOFTWARE_API_URL\n if (envUrl) {\n return envUrl.replace(/\\/$/, '')\n }\n }\n return __DEFAULT_API_URL__\n}\n\n// ============================================================================\n// Client Configuration\n// ============================================================================\n\nexport interface ClientConfig {\n clientKey: string\n /**\n * Customer authentication options.\n * Used to initialize CustomerAuth on Client.\n */\n customer?: {\n /**\n * Persist token in localStorage. Defaults to `true`.\n * - `true` (default): uses key `'customer-token'`\n * - `string`: uses the given string as localStorage key\n * - `false`: disables persistence (token/onTokenChange used instead)\n *\n * Handles SSR safely (no-op on server).\n * When enabled, `token` and `onTokenChange` are ignored.\n */\n persist?: boolean | string\n /** Initial token (e.g. from SSR cookie) */\n token?: string\n /** Called when token changes (login/logout) — use to persist in localStorage/cookie */\n onTokenChange?: (token: string | null) => void\n }\n}\n\nexport interface ClientServerConfig extends ClientConfig {\n secretKey: string\n}\n\nexport interface ClientMetadata {\n userAgent?: string\n timestamp: number\n}\n\nexport interface ClientState {\n metadata: ClientMetadata\n}\n\n// ============================================================================\n// API Response Types\n// ============================================================================\n\nexport interface PaginationMeta {\n page: number\n limit: number\n totalDocs: number\n totalPages: number\n hasNextPage: boolean\n hasPrevPage: boolean\n pagingCounter: number\n prevPage: number | null\n nextPage: number | null\n}\n\n// ============================================================================\n// Payload CMS Native Response Types\n// ============================================================================\n\n/**\n * Payload CMS Find (List) Response\n * GET /api/{collection}\n */\nexport interface PayloadFindResponse<T = unknown> {\n docs: T[]\n totalDocs: number\n limit: number\n totalPages: number\n page: number\n pagingCounter: number\n hasPrevPage: boolean\n hasNextPage: boolean\n prevPage: number | null\n nextPage: number | null\n}\n\n/**\n * Payload CMS Create/Update Response\n * POST /api/{collection}\n * PATCH /api/{collection}/{id}\n */\nexport interface PayloadMutationResponse<T = unknown> {\n message: string\n doc: T\n errors?: unknown[]\n}\n\n// ============================================================================\n// Query Options\n// ============================================================================\n\nexport interface ApiQueryOptions {\n page?: number\n limit?: number\n sort?: Sort\n where?: Where\n depth?: number\n select?: Record<string, boolean>\n}\n\n// ============================================================================\n// Debug & Retry Configuration\n// ============================================================================\n\nexport interface DebugConfig {\n logRequests?: boolean\n logResponses?: boolean\n logErrors?: boolean\n}\n\nexport interface RetryConfig {\n maxRetries?: number\n retryableStatuses?: number[]\n retryDelay?: (attempt: number) => number\n}\n\n\n// ============================================================================\n// Collection Types (re-exported from collection/const)\n// ============================================================================\n\n// ============================================================================\n// Type Utilities\n// ============================================================================\n\nexport type DeepPartial<T> = {\n [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]\n}\n\nexport type ExtractArrayType<T> = T extends (infer U)[] ? U : never\n","import type { PublicCollection, ApiQueryOptions } from '../client/types'\n\nexport function collectionKeys<T extends PublicCollection>(collection: T) {\n return {\n all: [collection] as const,\n lists: () => [collection, 'list'] as const,\n list: (options?: ApiQueryOptions) => [collection, 'list', options] as const,\n details: () => [collection, 'detail'] as const,\n detail: (id: string, options?: ApiQueryOptions) =>\n [collection, 'detail', id, options] as const,\n infinites: () => [collection, 'infinite'] as const,\n infinite: (options?: Omit<ApiQueryOptions, 'page'>) =>\n [collection, 'infinite', options] as const,\n }\n}\n\nexport const customerKeys = {\n all: ['customer'] as const,\n me: () => ['customer', 'me'] as const,\n}\n"],"mappings":";AAAA,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,sBAAsB;;;ACa/B,IAAM,0BAA0B;AAChC,IAAM,sBAAsB;AAC5B,IAAM,2BAA2B;AACjC,IAAM,uBAAuB;AAEtB,IAAM,qBAAN,MAAyB;AAAA,EAQ9B,YACU,SACA,WACA,UACA,aACR;AAJQ;AACA;AACA;AACA;AAXV,SAAQ,kBAA0C;AAClD,SAAQ,mBAAmB;AAC3B,SAAQ,kBAAkB;AAC1B,SAAQ,iBAAuD;AAC/D,SAAQ,YAAY,oBAAI,IAAsB;AAC9C,SAAQ,aAAa;AAAA,EAOlB;AAAA,EAEH,IAAI,YAAqB;AACvB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,YAAY,IAAkC;AAC5C,SAAK,UAAU,IAAI,EAAE;AACrB,WAAO,MAAM,KAAK,UAAU,OAAO,EAAE;AAAA,EACvC;AAAA,EAEA,UAAgB;AACd,QAAI,KAAK,gBAAiB;AAE1B,SAAK,kBAAkB,IAAI,gBAAgB;AAC3C,SAAK,YAAY,KAAK,gBAAgB,MAAM;AAAA,EAC9C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K;AAGlB,YAAM,OAAO,eAAe,MAAM,UAA8B;AAChE,kBAAY,kBAAkB,EAAE,UAAU,KAAK,IAAI,CAAC;AAAA,IACtD,CAAC;AAGD,UAAM,eAAe,YAAY,MAAM;AACrC,mBAAa,KAAK,SAAS;AAAA,IAC7B,GAAG,GAAI;AAEP,SAAK,QAAQ;AAEb,WAAO,MAAM;AACX,WAAK,WAAW;AAChB,qBAAe;AACf,oBAAc,YAAY;AAC1B,oBAAc,UAAU;AACxB,mBAAa,KAAK;AAAA,IACpB;AAAA,EAEF,GAAG,CAAC,WAAW,SAAS,aAAa,KAAK,GAAG,CAAC,CAAC;AAE/C,SAAO,EAAE,WAAW,UAAU;AAChC;","names":[]}
1
+ {"version":3,"sources":["../src/core/query/realtime-hooks.ts","../src/core/query/realtime.ts","../src/core/client/types.ts","../src/core/query/query-keys.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { RealtimeConnection, type RealtimeEvent } from './realtime'\nimport { resolveApiUrl, type PublicCollection } from '../client/types'\nimport { collectionKeys } from './query-keys'\n\nexport type { RealtimeEvent }\n\nexport interface UseRealtimeQueryOptions {\n /** Filter events to specific collections. Empty/undefined = all collections. */\n collections?: PublicCollection[]\n /** Enable/disable the SSE connection. Default: true. */\n enabled?: boolean\n}\n\nexport interface UseRealtimeQueryResult {\n /** Whether the SSE connection is currently active. */\n connected: boolean\n /** The last received event, or null. */\n lastEvent: RealtimeEvent | null\n}\n\n/**\n * React hook that subscribes to real-time collection change events via SSE.\n * Automatically invalidates React Query cache when changes are detected.\n *\n * @example\n * ```tsx\n * const { connected } = useRealtimeQuery({\n * clientKey: 'your-key',\n * getToken: () => client.customer.getToken(),\n * collections: ['products', 'orders'],\n * })\n * ```\n */\nexport function useRealtimeQuery(options: {\n clientKey: string\n getToken: () => string | null\n collections?: PublicCollection[]\n enabled?: boolean\n}): UseRealtimeQueryResult {\n const { clientKey, getToken, collections, enabled = true } = options\n const queryClient = useQueryClient()\n const [connected, setConnected] = useState(false)\n const [lastEvent, setLastEvent] = useState<RealtimeEvent | null>(null)\n const connectionRef = useRef<RealtimeConnection | null>(null)\n\n useEffect(() => {\n if (!enabled || !clientKey) return\n\n const baseUrl = resolveApiUrl()\n const conn = new RealtimeConnection(\n baseUrl,\n clientKey,\n getToken,\n collections,\n )\n connectionRef.current = conn\n\n // Listen for events and invalidate queries\n const removeListener = conn.addListener((event) => {\n setLastEvent(event)\n\n // Invalidate all queries for the changed collection\n const keys = collectionKeys(event.collection as PublicCollection)\n queryClient.invalidateQueries({ queryKey: keys.all })\n })\n\n // Track connection state\n const pollInterval = setInterval(() => {\n setConnected(conn.connected)\n }, 1000)\n\n conn.connect()\n\n return () => {\n conn.disconnect()\n removeListener()\n clearInterval(pollInterval)\n connectionRef.current = null\n setConnected(false)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [clientKey, enabled, collections?.join(',')])\n\n return { connected, lastEvent }\n}\n","/**\n * Fetch-based SSE connection manager for real-time collection change events.\n * Uses fetch + ReadableStream to support custom auth headers (unlike native EventSource).\n */\n\nexport interface RealtimeEvent {\n collection: string\n operation: string\n id: string | null\n timestamp: string\n}\n\nexport type RealtimeListener = (event: RealtimeEvent) => void\n\nconst INITIAL_RECONNECT_DELAY = 1_000\nconst MAX_RECONNECT_DELAY = 30_000\nconst RECONNECT_BACKOFF_FACTOR = 2\nconst MAX_NO_TOKEN_RETRIES = 5\n\nexport class RealtimeConnection {\n private abortController: AbortController | null = null\n private reconnectAttempt = 0\n private noTokenAttempts = 0\n private reconnectTimer: ReturnType<typeof setTimeout> | null = null\n private listeners = new Set<RealtimeListener>()\n private _connected = false\n\n constructor(\n private baseUrl: string,\n private clientKey: string,\n private getToken: () => string | null,\n private collections?: string[],\n ) {}\n\n get connected(): boolean {\n return this._connected\n }\n\n addListener(fn: RealtimeListener): () => void {\n this.listeners.add(fn)\n return () => this.listeners.delete(fn)\n }\n\n connect(): void {\n if (this.abortController) return // Already connecting/connected\n\n this.abortController = new AbortController()\n this.startStream(this.abortController.signal)\n }\n\n disconnect(): void {\n this._connected = false\n if (this.reconnectTimer) {\n clearTimeout(this.reconnectTimer)\n this.reconnectTimer = null\n }\n if (this.abortController) {\n this.abortController.abort()\n this.abortController = null\n }\n this.reconnectAttempt = 0\n this.noTokenAttempts = 0\n }\n\n private async startStream(signal: AbortSignal): Promise<void> {\n const token = this.getToken()\n if (!token) {\n this.noTokenAttempts++\n if (this.noTokenAttempts >= MAX_NO_TOKEN_RETRIES) {\n // Stop reconnecting — no token available after multiple attempts\n this._connected = false\n this.abortController = null\n return\n }\n this.scheduleReconnect()\n return\n }\n this.noTokenAttempts = 0\n\n const params = this.collections?.length\n ? `?collections=${this.collections.join(',')}`\n : ''\n const url = `${this.baseUrl}/api/events/stream${params}`\n\n try {\n const response = await fetch(url, {\n headers: {\n 'X-Client-Key': this.clientKey,\n Authorization: `Bearer ${token}`,\n },\n signal,\n })\n\n if (!response.ok) {\n if (response.status === 401) {\n // Token expired — try reconnecting (will get fresh token)\n this.scheduleReconnect()\n return\n }\n throw new Error(`SSE connection failed: ${response.status}`)\n }\n\n if (!response.body) {\n throw new Error('SSE response has no body')\n }\n\n this._connected = true\n this.reconnectAttempt = 0\n\n await this.readStream(response.body, signal)\n } catch {\n if (signal.aborted) return // Intentional disconnect\n this._connected = false\n this.scheduleReconnect()\n }\n }\n\n private async readStream(\n body: ReadableStream<Uint8Array>,\n signal: AbortSignal,\n ): Promise<void> {\n const reader = body.getReader()\n const decoder = new TextDecoder()\n let buffer = ''\n let currentEvent = ''\n let currentData = ''\n\n try {\n while (true) {\n const { done, value } = await reader.read()\n if (done || signal.aborted) break\n\n buffer += decoder.decode(value, { stream: true })\n const lines = buffer.split('\\n')\n buffer = lines.pop() ?? '' // Keep incomplete last line in buffer\n\n for (const line of lines) {\n if (line.startsWith('event: ')) {\n currentEvent = line.slice(7)\n } else if (line.startsWith('data: ')) {\n currentData += (currentData ? '\\n' : '') + line.slice(6)\n } else if (line === '') {\n // Empty line = end of event\n if (currentEvent === 'collection:change' && currentData) {\n try {\n const event: RealtimeEvent = JSON.parse(currentData)\n for (const listener of this.listeners) {\n try {\n listener(event)\n } catch {\n // Listener error — ignore\n }\n }\n } catch {\n // Malformed JSON — ignore\n }\n }\n currentEvent = ''\n currentData = ''\n }\n // Ignore comment lines (: heartbeat)\n }\n }\n } catch {\n // Stream read error\n } finally {\n reader.releaseLock()\n this._connected = false\n if (!signal.aborted) {\n this.scheduleReconnect()\n }\n }\n }\n\n private scheduleReconnect(): void {\n if (this.reconnectTimer) return\n\n const delay = Math.min(\n INITIAL_RECONNECT_DELAY *\n Math.pow(RECONNECT_BACKOFF_FACTOR, this.reconnectAttempt),\n MAX_RECONNECT_DELAY,\n )\n this.reconnectAttempt++\n\n this.reconnectTimer = setTimeout(() => {\n this.reconnectTimer = null\n this.abortController = new AbortController()\n this.startStream(this.abortController.signal)\n }, delay)\n }\n}\n","import type { Sort, Where } from 'payload'\n\nimport type { Collection, PublicCollection } from '../collection/const'\n\nexport type { Collection, PublicCollection }\n\n// ============================================================================\n// API URL Configuration\n// ============================================================================\n\ndeclare const __DEFAULT_API_URL__: string\n\n/**\n * API URL을 반환합니다.\n * 환경변수 SOFTWARE_API_URL 또는 NEXT_PUBLIC_SOFTWARE_API_URL로 오버라이드 가능.\n * 빌드 시 버전에 따라 기본값 결정: dev 빌드 → api-dev, 정식 → api.01.software\n */\nexport function resolveApiUrl(): string {\n if (typeof process !== 'undefined' && process.env) {\n const envUrl =\n process.env.SOFTWARE_API_URL || process.env.NEXT_PUBLIC_SOFTWARE_API_URL\n if (envUrl) {\n return envUrl.replace(/\\/$/, '')\n }\n }\n return __DEFAULT_API_URL__\n}\n\n// ============================================================================\n// Client Configuration\n// ============================================================================\n\nexport interface ClientConfig {\n clientKey: string\n /**\n * Customer authentication options.\n * Used to initialize CustomerAuth on Client.\n */\n customer?: {\n /**\n * Persist token in localStorage. Defaults to `true`.\n * - `true` (default): uses key `'customer-token'`\n * - `string`: uses the given string as localStorage key\n * - `false`: disables persistence (token/onTokenChange used instead)\n *\n * Handles SSR safely (no-op on server).\n * When enabled, `token` and `onTokenChange` are ignored.\n */\n persist?: boolean | string\n /** Initial token (e.g. from SSR cookie) */\n token?: string\n /** Called when token changes (login/logout) — use to persist in localStorage/cookie */\n onTokenChange?: (token: string | null) => void\n }\n}\n\nexport interface ClientServerConfig extends ClientConfig {\n secretKey: string\n}\n\nexport interface ClientMetadata {\n userAgent?: string\n timestamp: number\n}\n\nexport interface ClientState {\n metadata: ClientMetadata\n}\n\n// ============================================================================\n// API Response Types\n// ============================================================================\n\nexport interface PaginationMeta {\n page: number\n limit: number\n totalDocs: number\n totalPages: number\n hasNextPage: boolean\n hasPrevPage: boolean\n pagingCounter: number\n prevPage: number | null\n nextPage: number | null\n}\n\n// ============================================================================\n// Payload CMS Native Response Types\n// ============================================================================\n\n/**\n * Payload CMS Find (List) Response\n * GET /api/{collection}\n */\nexport interface PayloadFindResponse<T = unknown> {\n docs: T[]\n totalDocs: number\n limit: number\n totalPages: number\n page: number\n pagingCounter: number\n hasPrevPage: boolean\n hasNextPage: boolean\n prevPage: number | null\n nextPage: number | null\n}\n\n/**\n * Payload CMS Create/Update Response\n * POST /api/{collection}\n * PATCH /api/{collection}/{id}\n */\nexport interface PayloadMutationResponse<T = unknown> {\n message: string\n doc: T\n errors?: unknown[]\n}\n\n// ============================================================================\n// Query Options\n// ============================================================================\n\nexport interface ApiQueryOptions {\n page?: number\n limit?: number\n sort?: Sort\n where?: Where\n depth?: number\n select?: Record<string, boolean>\n /** Per-collection field selection for populated relationships (keyed by collection slug) */\n populate?: Record<string, boolean | Record<string, boolean>>\n /** Join field control: pagination/filter per join, or false to disable */\n joins?:\n | Record<\n string,\n | {\n limit?: number\n page?: number\n sort?: string\n where?: Where\n count?: boolean\n }\n | false\n >\n | false\n}\n\n// ============================================================================\n// Debug & Retry Configuration\n// ============================================================================\n\nexport interface DebugConfig {\n logRequests?: boolean\n logResponses?: boolean\n logErrors?: boolean\n}\n\nexport interface RetryConfig {\n maxRetries?: number\n retryableStatuses?: number[]\n retryDelay?: (attempt: number) => number\n}\n\n\n// ============================================================================\n// Collection Types (re-exported from collection/const)\n// ============================================================================\n\n// ============================================================================\n// Type Utilities\n// ============================================================================\n\nexport type DeepPartial<T> = {\n [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]\n}\n\nexport type ExtractArrayType<T> = T extends (infer U)[] ? U : never\n","import type { PublicCollection, ApiQueryOptions } from '../client/types'\n\nexport function collectionKeys<T extends PublicCollection>(collection: T) {\n return {\n all: [collection] as const,\n lists: () => [collection, 'list'] as const,\n list: (options?: ApiQueryOptions) => [collection, 'list', options] as const,\n details: () => [collection, 'detail'] as const,\n detail: (id: string, options?: ApiQueryOptions) =>\n [collection, 'detail', id, options] as const,\n infinites: () => [collection, 'infinite'] as const,\n infinite: (options?: Omit<ApiQueryOptions, 'page'>) =>\n [collection, 'infinite', options] as const,\n }\n}\n\nexport const customerKeys = {\n all: ['customer'] as const,\n me: () => ['customer', 'me'] as const,\n}\n"],"mappings":";AAAA,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,sBAAsB;;;ACa/B,IAAM,0BAA0B;AAChC,IAAM,sBAAsB;AAC5B,IAAM,2BAA2B;AACjC,IAAM,uBAAuB;AAEtB,IAAM,qBAAN,MAAyB;AAAA,EAQ9B,YACU,SACA,WACA,UACA,aACR;AAJQ;AACA;AACA;AACA;AAXV,SAAQ,kBAA0C;AAClD,SAAQ,mBAAmB;AAC3B,SAAQ,kBAAkB;AAC1B,SAAQ,iBAAuD;AAC/D,SAAQ,YAAY,oBAAI,IAAsB;AAC9C,SAAQ,aAAa;AAAA,EAOlB;AAAA,EAEH,IAAI,YAAqB;AACvB,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,YAAY,IAAkC;AAC5C,SAAK,UAAU,IAAI,EAAE;AACrB,WAAO,MAAM,KAAK,UAAU,OAAO,EA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,OAAO,IAAI;AAAA,MACf;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,kBAAc,UAAU;AAGxB,UAAM,iBAAiB,KAAK,YAAY,CAAC,UAAU;AACjD,mBAAa,KAAK;AAGlB,YAAM,OAAO,eAAe,MAAM,UAA8B;AAChE,kBAAY,kBAAkB,EAAE,UAAU,KAAK,IAAI,CAAC;AAAA,IACtD,CAAC;AAGD,UAAM,eAAe,YAAY,MAAM;AACrC,mBAAa,KAAK,SAAS;AAAA,IAC7B,GAAG,GAAI;AAEP,SAAK,QAAQ;AAEb,WAAO,MAAM;AACX,WAAK,WAAW;AAChB,qBAAe;AACf,oBAAc,YAAY;AAC1B,oBAAc,UAAU;AACxB,mBAAa,KAAK;AAAA,IACpB;AAAA,EAEF,GAAG,CAAC,WAAW,SAAS,aAAa,KAAK,GAAG,CAAC,CAAC;AAE/C,SAAO,EAAE,WAAW,UAAU;AAChC;","names":[]}
@@ -6,16 +6,16 @@ interface DynamicNodeData {
6
6
  label: string;
7
7
  fields: Record<string, unknown>;
8
8
  }
9
- type FlowNodeData = (DynamicNodeData | FrameNodeData) & Record<string, unknown>;
10
- interface FlowNodePosition {
9
+ type CanvasNodeData = (DynamicNodeData | FrameNodeData) & Record<string, unknown>;
10
+ interface CanvasNodePosition {
11
11
  x: number;
12
12
  y: number;
13
13
  }
14
- interface FlowNode {
14
+ interface CanvasNode {
15
15
  id: string;
16
16
  type?: string;
17
- position: FlowNodePosition;
18
- data: FlowNodeData;
17
+ position: CanvasNodePosition;
18
+ data: CanvasNodeData;
19
19
  parentId?: string;
20
20
  style?: React.CSSProperties;
21
21
  width?: number;
@@ -28,7 +28,7 @@ interface FlowNode {
28
28
  selectable?: boolean;
29
29
  [key: string]: unknown;
30
30
  }
31
- interface FlowEdge {
31
+ interface CanvasEdge {
32
32
  id: string;
33
33
  source: string;
34
34
  target: string;
@@ -43,15 +43,15 @@ interface FlowEdge {
43
43
  fields?: Record<string, unknown>;
44
44
  [key: string]: unknown;
45
45
  }
46
- interface FlowViewport {
46
+ interface CanvasViewport {
47
47
  x: number;
48
48
  y: number;
49
49
  zoom: number;
50
50
  }
51
51
  interface CanvasData {
52
- nodes: FlowNode[];
53
- edges: FlowEdge[];
54
- viewport: FlowViewport;
52
+ nodes: CanvasNode[];
53
+ edges: CanvasEdge[];
54
+ viewport: CanvasViewport;
55
55
  }
56
56
  interface NodeTypeFieldDef {
57
57
  name: string;
@@ -88,10 +88,10 @@ interface EdgeTypeDef {
88
88
  markerEnd: string;
89
89
  fields: NodeTypeFieldDef[];
90
90
  }
91
- declare function isDynamicNode(node: FlowNode): node is FlowNode & {
91
+ declare function isDynamicNode(node: CanvasNode): node is CanvasNode & {
92
92
  data: DynamicNodeData;
93
93
  };
94
- declare function isFrameNode(node: FlowNode): node is FlowNode & {
94
+ declare function isFrameNode(node: CanvasNode): node is CanvasNode & {
95
95
  data: FrameNodeData;
96
96
  };
97
97
  interface DynamicNodeSlotProps {
@@ -145,7 +145,7 @@ interface NodeWrapperSlotProps {
145
145
  nodeTypeDef?: NodeTypeDef;
146
146
  children: React.ReactNode;
147
147
  }
148
- interface FlowBounds {
148
+ interface CanvasBounds {
149
149
  x: number;
150
150
  y: number;
151
151
  width: number;
@@ -156,78 +156,78 @@ declare const BUILT_IN_NODE_TYPES: NodeTypeDef[];
156
156
 
157
157
  declare const BUILT_IN_EDGE_TYPES: EdgeTypeDef[];
158
158
 
159
- type FlowCollection = 'flows' | 'flow-node-types' | 'flow-edge-types';
159
+ type CanvasCollection = 'canvases' | 'canvas-node-types' | 'canvas-edge-types';
160
160
  type AnyFn = (...args: any[]) => any;
161
161
  interface SDKClient {
162
- from(collection: FlowCollection): {
162
+ from(collection: CanvasCollection): {
163
163
  find: AnyFn;
164
164
  findById: AnyFn;
165
165
  };
166
166
  queryClient: QueryClient;
167
167
  }
168
- interface UseFlowOptions {
168
+ interface UseCanvasOptions {
169
169
  /** SDK client instance (Client or ServerClient) */
170
170
  client: SDKClient;
171
- /** Flow slug (URL-friendly identifier) */
171
+ /** Canvas slug (URL-friendly identifier) */
172
172
  slug?: string;
173
- /** Flow document ID (UUID) */
173
+ /** Canvas document ID (UUID) */
174
174
  id?: string;
175
175
  /** Enable/disable data fetching (default: true) */
176
176
  enabled?: boolean;
177
177
  }
178
- interface UseFlowResult {
178
+ interface UseCanvasResult {
179
179
  data: CanvasData | undefined;
180
180
  nodeTypeDefs: NodeTypeDef[];
181
181
  edgeTypeDefs: EdgeTypeDef[];
182
- flow: Record<string, unknown> | undefined;
182
+ canvas: Record<string, unknown> | undefined;
183
183
  isLoading: boolean;
184
184
  error: Error | null;
185
185
  }
186
- declare function useFlow(options: UseFlowOptions): UseFlowResult;
186
+ declare function useCanvas(options: UseCanvasOptions): UseCanvasResult;
187
187
 
188
- interface PrefetchFlowOptions {
188
+ interface PrefetchCanvasOptions {
189
189
  /** SDK client instance (Client or ServerClient) */
190
190
  client: SDKClient;
191
- /** Flow slug (URL-friendly identifier) */
191
+ /** Canvas slug (URL-friendly identifier) */
192
192
  slug?: string;
193
- /** Flow document ID (UUID) */
193
+ /** Canvas document ID (UUID) */
194
194
  id?: string;
195
195
  }
196
196
  /**
197
- * Prefetch flow data into the query cache.
197
+ * Prefetch canvas data into the query cache.
198
198
  * Call in route loaders or server components to eliminate loading states on mount.
199
199
  *
200
200
  * ```ts
201
201
  * // React Router loader / Server Component
202
- * await prefetchFlow({ client, slug: 'Home' })
202
+ * await prefetchCanvas({ client, slug: 'Home' })
203
203
  * ```
204
204
  */
205
- declare function prefetchFlow(options: PrefetchFlowOptions): Promise<void>;
205
+ declare function prefetchCanvas(options: PrefetchCanvasOptions): Promise<void>;
206
206
 
207
207
  /**
208
208
  * Calculate bounding box for given node IDs.
209
209
  * Pure function — usable in SSR, server components, or outside React.
210
210
  */
211
- declare function getNodeBounds(nodes: FlowNode[], nodeIds: string[]): FlowBounds | undefined;
211
+ declare function getNodeBounds(nodes: CanvasNode[], nodeIds: string[]): CanvasBounds | undefined;
212
212
  /**
213
213
  * Get all frame nodes with their bounds.
214
214
  * Sorted by position (top-left to bottom-right).
215
215
  */
216
- declare function getFrames(nodes: FlowNode[]): Array<{
216
+ declare function getFrames(nodes: CanvasNode[]): Array<{
217
217
  id: string;
218
218
  label: string;
219
- bounds: FlowBounds;
219
+ bounds: CanvasBounds;
220
220
  }>;
221
221
  /** Result of getFrameData — contains filtered canvas + dual bounds. */
222
222
  interface FrameData {
223
223
  /** Canvas data containing only the frame's descendants (nodes have draggable: false). */
224
224
  data: CanvasData;
225
225
  /** Bounding box of child content nodes — use for initial viewport fit (centering). */
226
- fitBounds: FlowBounds;
226
+ fitBounds: CanvasBounds;
227
227
  /** Bounding box of the frame itself — use for panning/zoom restriction (clamp). */
228
- clampBounds: FlowBounds;
228
+ clampBounds: CanvasBounds;
229
229
  /** @deprecated Use fitBounds instead. Alias for clampBounds for backward compatibility. */
230
- bounds: FlowBounds;
230
+ bounds: CanvasBounds;
231
231
  }
232
232
  /**
233
233
  * Extract a frame's descendants and related edges from canvas data.
@@ -243,4 +243,4 @@ interface FrameData {
243
243
  */
244
244
  declare function getFrameData(data: CanvasData, frameId: string): FrameData | undefined;
245
245
 
246
- export { BUILT_IN_NODE_TYPES as B, type CanvasData as C, type DynamicNodeSlotProps as D, type EdgeTypeDef as E, type FlowNode as F, type NodeTypeDef as N, type PrefetchFlowOptions as P, type SDKClient as S, type UseFlowOptions as U, type NodeTypeFieldDef as a, type FlowEdge as b, type FrameNodeSlotProps as c, type EdgeSlotProps as d, type NodeWrapperSlotProps as e, type FlowViewport as f, type FlowBounds as g, type FrameData as h, type FlowNodePosition as i, type FlowNodeData as j, type DynamicNodeData as k, type FrameNodeData as l, isDynamicNode as m, isFrameNode as n, BUILT_IN_EDGE_TYPES as o, type UseFlowResult as p, prefetchFlow as q, getNodeBounds as r, getFrames as s, getFrameData as t, useFlow as u };
246
+ export { BUILT_IN_NODE_TYPES as B, type CanvasData as C, type DynamicNodeSlotProps as D, type EdgeTypeDef as E, type FrameNodeSlotProps as F, type NodeTypeDef as N, type PrefetchCanvasOptions as P, type SDKClient as S, type UseCanvasOptions as U, type CanvasNode as a, type NodeTypeFieldDef as b, type CanvasEdge as c, type EdgeSlotProps as d, type NodeWrapperSlotProps as e, type CanvasViewport as f, type CanvasBounds as g, type FrameData as h, type CanvasNodePosition as i, type CanvasNodeData as j, type DynamicNodeData as k, type FrameNodeData as l, isDynamicNode as m, isFrameNode as n, BUILT_IN_EDGE_TYPES as o, type UseCanvasResult as p, prefetchCanvas as q, getNodeBounds as r, getFrames as s, getFrameData as t, useCanvas as u };
@@ -6,16 +6,16 @@ interface DynamicNodeData {
6
6
  label: string;
7
7
  fields: Record<string, unknown>;
8
8
  }
9
- type FlowNodeData = (DynamicNodeData | FrameNodeData) & Record<string, unknown>;
10
- interface FlowNodePosition {
9
+ type CanvasNodeData = (DynamicNodeData | FrameNodeData) & Record<string, unknown>;
10
+ interface CanvasNodePosition {
11
11
  x: number;
12
12
  y: number;
13
13
  }
14
- interface FlowNode {
14
+ interface CanvasNode {
15
15
  id: string;
16
16
  type?: string;
17
- position: FlowNodePosition;
18
- data: FlowNodeData;
17
+ position: CanvasNodePosition;
18
+ data: CanvasNodeData;
19
19
  parentId?: string;
20
20
  style?: React.CSSProperties;
21
21
  width?: number;
@@ -28,7 +28,7 @@ interface FlowNode {
28
28
  selectable?: boolean;
29
29
  [key: string]: unknown;
30
30
  }
31
- interface FlowEdge {
31
+ interface CanvasEdge {
32
32
  id: string;
33
33
  source: string;
34
34
  target: string;
@@ -43,15 +43,15 @@ interface FlowEdge {
43
43
  fields?: Record<string, unknown>;
44
44
  [key: string]: unknown;
45
45
  }
46
- interface FlowViewport {
46
+ interface CanvasViewport {
47
47
  x: number;
48
48
  y: number;
49
49
  zoom: number;
50
50
  }
51
51
  interface CanvasData {
52
- nodes: FlowNode[];
53
- edges: FlowEdge[];
54
- viewport: FlowViewport;
52
+ nodes: CanvasNode[];
53
+ edges: CanvasEdge[];
54
+ viewport: CanvasViewport;
55
55
  }
56
56
  interface NodeTypeFieldDef {
57
57
  name: string;
@@ -88,10 +88,10 @@ interface EdgeTypeDef {
88
88
  markerEnd: string;
89
89
  fields: NodeTypeFieldDef[];
90
90
  }
91
- declare function isDynamicNode(node: FlowNode): node is FlowNode & {
91
+ declare function isDynamicNode(node: CanvasNode): node is CanvasNode & {
92
92
  data: DynamicNodeData;
93
93
  };
94
- declare function isFrameNode(node: FlowNode): node is FlowNode & {
94
+ declare function isFrameNode(node: CanvasNode): node is CanvasNode & {
95
95
  data: FrameNodeData;
96
96
  };
97
97
  interface DynamicNodeSlotProps {
@@ -145,7 +145,7 @@ interface NodeWrapperSlotProps {
145
145
  nodeTypeDef?: NodeTypeDef;
146
146
  children: React.ReactNode;
147
147
  }
148
- interface FlowBounds {
148
+ interface CanvasBounds {
149
149
  x: number;
150
150
  y: number;
151
151
  width: number;
@@ -156,78 +156,78 @@ declare const BUILT_IN_NODE_TYPES: NodeTypeDef[];
156
156
 
157
157
  declare const BUILT_IN_EDGE_TYPES: EdgeTypeDef[];
158
158
 
159
- type FlowCollection = 'flows' | 'flow-node-types' | 'flow-edge-types';
159
+ type CanvasCollection = 'canvases' | 'canvas-node-types' | 'canvas-edge-types';
160
160
  type AnyFn = (...args: any[]) => any;
161
161
  interface SDKClient {
162
- from(collection: FlowCollection): {
162
+ from(collection: CanvasCollection): {
163
163
  find: AnyFn;
164
164
  findById: AnyFn;
165
165
  };
166
166
  queryClient: QueryClient;
167
167
  }
168
- interface UseFlowOptions {
168
+ interface UseCanvasOptions {
169
169
  /** SDK client instance (Client or ServerClient) */
170
170
  client: SDKClient;
171
- /** Flow slug (URL-friendly identifier) */
171
+ /** Canvas slug (URL-friendly identifier) */
172
172
  slug?: string;
173
- /** Flow document ID (UUID) */
173
+ /** Canvas document ID (UUID) */
174
174
  id?: string;
175
175
  /** Enable/disable data fetching (default: true) */
176
176
  enabled?: boolean;
177
177
  }
178
- interface UseFlowResult {
178
+ interface UseCanvasResult {
179
179
  data: CanvasData | undefined;
180
180
  nodeTypeDefs: NodeTypeDef[];
181
181
  edgeTypeDefs: EdgeTypeDef[];
182
- flow: Record<string, unknown> | undefined;
182
+ canvas: Record<string, unknown> | undefined;
183
183
  isLoading: boolean;
184
184
  error: Error | null;
185
185
  }
186
- declare function useFlow(options: UseFlowOptions): UseFlowResult;
186
+ declare function useCanvas(options: UseCanvasOptions): UseCanvasResult;
187
187
 
188
- interface PrefetchFlowOptions {
188
+ interface PrefetchCanvasOptions {
189
189
  /** SDK client instance (Client or ServerClient) */
190
190
  client: SDKClient;
191
- /** Flow slug (URL-friendly identifier) */
191
+ /** Canvas slug (URL-friendly identifier) */
192
192
  slug?: string;
193
- /** Flow document ID (UUID) */
193
+ /** Canvas document ID (UUID) */
194
194
  id?: string;
195
195
  }
196
196
  /**
197
- * Prefetch flow data into the query cache.
197
+ * Prefetch canvas data into the query cache.
198
198
  * Call in route loaders or server components to eliminate loading states on mount.
199
199
  *
200
200
  * ```ts
201
201
  * // React Router loader / Server Component
202
- * await prefetchFlow({ client, slug: 'Home' })
202
+ * await prefetchCanvas({ client, slug: 'Home' })
203
203
  * ```
204
204
  */
205
- declare function prefetchFlow(options: PrefetchFlowOptions): Promise<void>;
205
+ declare function prefetchCanvas(options: PrefetchCanvasOptions): Promise<void>;
206
206
 
207
207
  /**
208
208
  * Calculate bounding box for given node IDs.
209
209
  * Pure function — usable in SSR, server components, or outside React.
210
210
  */
211
- declare function getNodeBounds(nodes: FlowNode[], nodeIds: string[]): FlowBounds | undefined;
211
+ declare function getNodeBounds(nodes: CanvasNode[], nodeIds: string[]): CanvasBounds | undefined;
212
212
  /**
213
213
  * Get all frame nodes with their bounds.
214
214
  * Sorted by position (top-left to bottom-right).
215
215
  */
216
- declare function getFrames(nodes: FlowNode[]): Array<{
216
+ declare function getFrames(nodes: CanvasNode[]): Array<{
217
217
  id: string;
218
218
  label: string;
219
- bounds: FlowBounds;
219
+ bounds: CanvasBounds;
220
220
  }>;
221
221
  /** Result of getFrameData — contains filtered canvas + dual bounds. */
222
222
  interface FrameData {
223
223
  /** Canvas data containing only the frame's descendants (nodes have draggable: false). */
224
224
  data: CanvasData;
225
225
  /** Bounding box of child content nodes — use for initial viewport fit (centering). */
226
- fitBounds: FlowBounds;
226
+ fitBounds: CanvasBounds;
227
227
  /** Bounding box of the frame itself — use for panning/zoom restriction (clamp). */
228
- clampBounds: FlowBounds;
228
+ clampBounds: CanvasBounds;
229
229
  /** @deprecated Use fitBounds instead. Alias for clampBounds for backward compatibility. */
230
- bounds: FlowBounds;
230
+ bounds: CanvasBounds;
231
231
  }
232
232
  /**
233
233
  * Extract a frame's descendants and related edges from canvas data.
@@ -243,4 +243,4 @@ interface FrameData {
243
243
  */
244
244
  declare function getFrameData(data: CanvasData, frameId: string): FrameData | undefined;
245
245
 
246
- export { BUILT_IN_NODE_TYPES as B, type CanvasData as C, type DynamicNodeSlotProps as D, type EdgeTypeDef as E, type FlowNode as F, type NodeTypeDef as N, type PrefetchFlowOptions as P, type SDKClient as S, type UseFlowOptions as U, type NodeTypeFieldDef as a, type FlowEdge as b, type FrameNodeSlotProps as c, type EdgeSlotProps as d, type NodeWrapperSlotProps as e, type FlowViewport as f, type FlowBounds as g, type FrameData as h, type FlowNodePosition as i, type FlowNodeData as j, type DynamicNodeData as k, type FrameNodeData as l, isDynamicNode as m, isFrameNode as n, BUILT_IN_EDGE_TYPES as o, type UseFlowResult as p, prefetchFlow as q, getNodeBounds as r, getFrames as s, getFrameData as t, useFlow as u };
246
+ export { BUILT_IN_NODE_TYPES as B, type CanvasData as C, type DynamicNodeSlotProps as D, type EdgeTypeDef as E, type FrameNodeSlotProps as F, type NodeTypeDef as N, type PrefetchCanvasOptions as P, type SDKClient as S, type UseCanvasOptions as U, type CanvasNode as a, type NodeTypeFieldDef as b, type CanvasEdge as c, type EdgeSlotProps as d, type NodeWrapperSlotProps as e, type CanvasViewport as f, type CanvasBounds as g, type FrameData as h, type CanvasNodePosition as i, type CanvasNodeData as j, type DynamicNodeData as k, type FrameNodeData as l, isDynamicNode as m, isFrameNode as n, BUILT_IN_EDGE_TYPES as o, type UseCanvasResult as p, prefetchCanvas as q, getNodeBounds as r, getFrames as s, getFrameData as t, useCanvas as u };
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/ui/Flow/server.ts
20
+ // src/ui/Canvas/server.ts
21
21
  var server_exports = {};
22
22
  __export(server_exports, {
23
23
  BUILT_IN_EDGE_TYPES: () => BUILT_IN_EDGE_TYPES,
@@ -27,7 +27,7 @@ __export(server_exports, {
27
27
  getNodeBounds: () => getNodeBounds,
28
28
  isDynamicNode: () => isDynamicNode,
29
29
  isFrameNode: () => isFrameNode,
30
- prefetchFlow: () => prefetchFlow
30
+ prefetchCanvas: () => prefetchCanvas
31
31
  });
32
32
  module.exports = __toCommonJS(server_exports);
33
33
 
@@ -44,56 +44,56 @@ function collectionKeys(collection) {
44
44
  };
45
45
  }
46
46
 
47
- // src/ui/Flow/query-options.ts
48
- function flowQueryOptions(client, slug, id) {
47
+ // src/ui/Canvas/query-options.ts
48
+ function canvasQueryOptions(client, slug, id) {
49
49
  const identifier = id ?? slug ?? "";
50
50
  return {
51
- queryKey: collectionKeys("flows").detail(identifier),
51
+ queryKey: collectionKeys("canvases").detail(identifier),
52
52
  queryFn: async () => {
53
- if (id) return client.from("flows").findById(id);
54
- const result = await client.from("flows").find({
53
+ if (id) return client.from("canvases").findById(id);
54
+ const result = await client.from("canvases").find({
55
55
  where: { slug: { equals: slug } },
56
56
  limit: 1
57
57
  });
58
58
  const doc = result.docs[0];
59
- if (!doc) throw new Error(`Flow not found: ${slug}`);
59
+ if (!doc) throw new Error(`Canvas not found: ${slug}`);
60
60
  return doc;
61
61
  }
62
62
  };
63
63
  }
64
64
  function nodeTypesQueryOptions(client) {
65
65
  return {
66
- queryKey: collectionKeys("flow-node-types").lists(),
66
+ queryKey: collectionKeys("canvas-node-types").lists(),
67
67
  queryFn: async () => {
68
- const result = await client.from("flow-node-types").find({ limit: 0 });
68
+ const result = await client.from("canvas-node-types").find({ limit: 0 });
69
69
  return result.docs;
70
70
  }
71
71
  };
72
72
  }
73
73
  function edgeTypesQueryOptions(client) {
74
74
  return {
75
- queryKey: collectionKeys("flow-edge-types").lists(),
75
+ queryKey: collectionKeys("canvas-edge-types").lists(),
76
76
  queryFn: async () => {
77
- const result = await client.from("flow-edge-types").find({ limit: 0 });
77
+ const result = await client.from("canvas-edge-types").find({ limit: 0 });
78
78
  return result.docs;
79
79
  }
80
80
  };
81
81
  }
82
82
 
83
- // src/ui/Flow/prefetchFlow.ts
84
- async function prefetchFlow(options) {
83
+ // src/ui/Canvas/prefetchCanvas.ts
84
+ async function prefetchCanvas(options) {
85
85
  const { client, slug, id } = options;
86
86
  if (!slug && !id) {
87
- throw new Error("prefetchFlow requires either slug or id");
87
+ throw new Error("prefetchCanvas requires either slug or id");
88
88
  }
89
89
  await Promise.all([
90
- client.queryClient.prefetchQuery(flowQueryOptions(client, slug, id)),
90
+ client.queryClient.prefetchQuery(canvasQueryOptions(client, slug, id)),
91
91
  client.queryClient.prefetchQuery(nodeTypesQueryOptions(client)),
92
92
  client.queryClient.prefetchQuery(edgeTypesQueryOptions(client))
93
93
  ]);
94
94
  }
95
95
 
96
- // src/ui/Flow/utils.ts
96
+ // src/ui/Canvas/utils.ts
97
97
  function getNodeSize(node) {
98
98
  return {
99
99
  width: node.style?.width ?? node.measured?.width ?? node.width ?? 200,
@@ -210,7 +210,7 @@ function getFrameData(data, frameId) {
210
210
  };
211
211
  }
212
212
 
213
- // src/ui/Flow/types.ts
213
+ // src/ui/Canvas/types.ts
214
214
  function isDynamicNode(node) {
215
215
  return node.type === "dynamic";
216
216
  }
@@ -218,7 +218,7 @@ function isFrameNode(node) {
218
218
  return node.type === "frame";
219
219
  }
220
220
 
221
- // src/ui/Flow/built-in-node-types.ts
221
+ // src/ui/Canvas/built-in-node-types.ts
222
222
  var BUILT_IN_NODE_TYPES = [
223
223
  {
224
224
  slug: "text",
@@ -241,7 +241,7 @@ var BUILT_IN_NODE_TYPES = [
241
241
  }
242
242
  ];
243
243
 
244
- // src/ui/Flow/built-in-edge-types.ts
244
+ // src/ui/Canvas/built-in-edge-types.ts
245
245
  var BUILT_IN_EDGE_TYPES = [
246
246
  {
247
247
  slug: "default",
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/ui/Canvas/server.ts","../../../src/core/query/query-keys.ts","../../../src/ui/Canvas/query-options.ts","../../../src/ui/Canvas/prefetchCanvas.ts","../../../src/ui/Canvas/utils.ts","../../../src/ui/Canvas/types.ts","../../../src/ui/Canvas/built-in-node-types.ts","../../../src/ui/Canvas/built-in-edge-types.ts"],"sourcesContent":["// Server-safe exports (no 'use client' directive).\n// Use `@01.software/sdk/ui/canvas/server` for server components and route loaders.\n\nexport { prefetchCanvas } from './prefetchCanvas'\nexport type { PrefetchCanvasOptions } from './prefetchCanvas'\nexport { getNodeBounds, getFrames, getFrameData } from './utils'\nexport type { FrameData } from './utils'\nexport type {\n CanvasData,\n CanvasNode,\n CanvasEdge,\n CanvasViewport,\n CanvasNodePosition,\n CanvasNodeData,\n DynamicNodeData,\n FrameNodeData,\n CanvasBounds,\n NodeTypeDef,\n NodeTypeFieldDef,\n EdgeTypeDef,\n} from './types'\nexport { isDynamicNode, isFrameNode } from './types'\nexport { BUILT_IN_NODE_TYPES } from './built-in-node-types'\nexport { BUILT_IN_EDGE_TYPES } from './built-in-edge-types'\n","import type { PublicCollection, ApiQueryOptions } from '../client/types'\n\nexport function collectionKeys<T extends PublicCollection>(collection: T) {\n return {\n all: [collection] as const,\n lists: () => [collection, 'list'] as const,\n list: (options?: ApiQueryOptions) => [collection, 'list', options] as const,\n details: () => [collection, 'detail'] as const,\n detail: (id: string, options?: ApiQueryOptions) =>\n [collection, 'detail', id, options] as const,\n infinites: () => [collection, 'infinite'] as const,\n infinite: (options?: Omit<ApiQueryOptions, 'page'>) =>\n [collection, 'infinite', options] as const,\n }\n}\n\nexport const customerKeys = {\n all: ['customer'] as const,\n me: () => ['customer', 'me'] as const,\n}\n","import { collectionKeys } from '../../core/query/query-keys'\nimport type { SDKClient } from './useCanvas'\n\nexport function canvasQueryOptions(\n client: SDKClient,\n slug?: string,\n id?: string,\n) {\n const identifier = id ?? slug ?? ''\n return {\n queryKey: collectionKeys('canvases').detail(identifier),\n queryFn: async () => {\n if (id) return client.from('canvases').findById(id)\n const result = await client.from('canvases').find({\n where: { slug: { equals: slug } },\n limit: 1,\n })\n const doc = result.docs[0]\n if (!doc) throw new Error(`Canvas not found: ${slug}`)\n return doc\n },\n }\n}\n\nexport function nodeTypesQueryOptions(client: SDKClient) {\n return {\n queryKey: collectionKeys('canvas-node-types').lists(),\n queryFn: async () => {\n // limit: 0 = fetch all documents (Payload CMS convention, disables pagination)\n const result = await client.from('canvas-node-types').find({ limit: 0 })\n return result.docs\n },\n }\n}\n\nexport function edgeTypesQueryOptions(client: SDKClient) {\n return {\n queryKey: collectionKeys('canvas-edge-types').lists(),\n queryFn: async () => {\n const result = await client.from('canvas-edge-types').find({ limit: 0 })\n return result.docs\n },\n }\n}\n","import type { SDKClient } from './useCanvas'\nimport {\n canvasQueryOptions,\n nodeTypesQueryOptions,\n edgeTypesQueryOptions,\n} from './query-options'\n\nexport interface PrefetchCanvasOptions {\n /** SDK client instance (Client or ServerClient) */\n client: SDKClient\n /** Canvas slug (URL-friendly identifier) */\n slug?: string\n /** Canvas document ID (UUID) */\n id?: string\n}\n\n/**\n * Prefetch canvas data into the query cache.\n * Call in route loaders or server components to eliminate loading states on mount.\n *\n * ```ts\n * // React Router loader / Server Component\n * await prefetchCanvas({ client, slug: 'Home' })\n * ```\n */\nexport async function prefetchCanvas(\n options: PrefetchCanvasOptions,\n): Promise<void> {\n const { client, slug, id } = options\n\n if (!slug && !id) {\n throw new Error('prefetchCanvas requires either slug or id')\n }\n\n await Promise.all([\n client.queryClient.prefetchQuery(canvasQueryOptions(client, slug, id)),\n client.queryClient.prefetchQuery(nodeTypesQueryOptions(client)),\n client.queryClient.prefetchQuery(edgeTypesQueryOptions(client)),\n ])\n}\n","import type { CanvasNode, CanvasEdge, CanvasBounds, CanvasData } from './types'\n\n// ── Shared helpers ──\n\nfunction getNodeSize(node: CanvasNode): { width: number; height: number } {\n return {\n width:\n (node.style?.width as number) ??\n node.measured?.width ??\n node.width ??\n 200,\n height:\n (node.style?.height as number) ??\n node.measured?.height ??\n node.height ??\n 200,\n }\n}\n\nfunction getAbsolutePosition(\n node: CanvasNode,\n nodeMap: Map<string, CanvasNode>,\n): { x: number; y: number } {\n let x = node.position.x\n let y = node.position.y\n let current = node\n const visited = new Set<string>([node.id])\n while (current.parentId) {\n const parentId = current.parentId\n if (visited.has(parentId)) break\n const parent = nodeMap.get(parentId)\n if (!parent) break\n visited.add(parent.id)\n x += parent.position.x\n y += parent.position.y\n current = parent\n }\n return { x, y }\n}\n\n/** Collect a node and all its descendants using a pre-built parent→children map (O(N)). */\nfunction collectDescendants(\n nodes: CanvasNode[],\n rootId: string,\n): Set<string> {\n // Build parent → children lookup in O(N)\n const childrenMap = new Map<string, string[]>()\n for (const n of nodes) {\n if (n.parentId) {\n let siblings = childrenMap.get(n.parentId)\n if (!siblings) {\n siblings = []\n childrenMap.set(n.parentId, siblings)\n }\n siblings.push(n.id)\n }\n }\n\n // BFS over children map in O(descendants)\n const result = new Set<string>([rootId])\n const queue = [rootId]\n let i = 0\n while (i < queue.length) {\n const children = childrenMap.get(queue[i++]!)\n if (children) {\n for (const childId of children) {\n if (!result.has(childId)) {\n result.add(childId)\n queue.push(childId)\n }\n }\n }\n }\n return result\n}\n\n// ── Public utilities ──\n\n/**\n * Calculate bounding box for given node IDs.\n * Pure function — usable in SSR, server components, or outside React.\n */\nexport function getNodeBounds(\n nodes: CanvasNode[],\n nodeIds: string[],\n): CanvasBounds | undefined {\n const idSet = new Set(nodeIds)\n const targetNodes = nodes.filter((n) => idSet.has(n.id))\n if (targetNodes.length === 0) return undefined\n\n const nodeMap = new Map(nodes.map((n) => [n.id, n]))\n\n let minX = Infinity\n let minY = Infinity\n let maxX = -Infinity\n let maxY = -Infinity\n\n for (const node of targetNodes) {\n const abs = getAbsolutePosition(node, nodeMap)\n const { width: w, height: h } = getNodeSize(node)\n minX = Math.min(minX, abs.x)\n minY = Math.min(minY, abs.y)\n maxX = Math.max(maxX, abs.x + w)\n maxY = Math.max(maxY, abs.y + h)\n }\n\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY }\n}\n\n/**\n * Get all frame nodes with their bounds.\n * Sorted by position (top-left to bottom-right).\n */\nexport function getFrames(\n nodes: CanvasNode[],\n): Array<{ id: string; label: string; bounds: CanvasBounds }> {\n const frames = nodes.filter((n) => n.type === 'frame')\n if (frames.length === 0) return []\n\n const nodeMap = new Map(nodes.map((n) => [n.id, n]))\n\n return frames\n .map((f) => {\n const data = f.data as { label?: string }\n const abs = getAbsolutePosition(f, nodeMap)\n const { width: w, height: h } = getNodeSize(f)\n return {\n id: f.id,\n label: data.label ?? '',\n bounds: { x: abs.x, y: abs.y, width: w, height: h },\n }\n })\n .sort((a, b) => a.bounds.y - b.bounds.y || a.bounds.x - b.bounds.x)\n}\n\n/** Result of getFrameData — contains filtered canvas + dual bounds. */\nexport interface FrameData {\n /** Canvas data containing only the frame's descendants (nodes have draggable: false). */\n data: CanvasData\n /** Bounding box of child content nodes — use for initial viewport fit (centering). */\n fitBounds: CanvasBounds\n /** Bounding box of the frame itself — use for panning/zoom restriction (clamp). */\n clampBounds: CanvasBounds\n /** @deprecated Use fitBounds instead. Alias for clampBounds for backward compatibility. */\n bounds: CanvasBounds\n}\n\n/**\n * Extract a frame's descendants and related edges from canvas data.\n * Recursively collects all nested children (supports nested frames).\n * Returns undefined if frameId is not found or is not a frame node.\n *\n * Child nodes are marked `draggable: false` to prevent interfering with canvas panning.\n * The frame node itself is included (use `frameRenderer={() => null}` to hide it).\n *\n * Returns dual bounds:\n * - `fitBounds`: child content bounding box (for centering the viewport)\n * - `clampBounds`: frame area bounding box (for panning restriction)\n */\nexport function getFrameData(\n data: CanvasData,\n frameId: string,\n): FrameData | undefined {\n const frame = data.nodes.find((n) => n.id === frameId)\n if (!frame || frame.type !== 'frame') return undefined\n\n // Recursively collect frame + all descendants\n const descendantIds = collectDescendants(data.nodes, frameId)\n const childNodes = data.nodes\n .filter((n) => descendantIds.has(n.id))\n .map((n) => ({ ...n, draggable: false }))\n\n // Keep only edges where both source and target are within the frame\n const childEdges = data.edges.filter(\n (e: CanvasEdge) => descendantIds.has(e.source) && descendantIds.has(e.target),\n )\n\n // clampBounds: frame's own bounding box (for panning restriction)\n const frameBounds = getNodeBounds(data.nodes, [frameId])\n const { width: w, height: h } = getNodeSize(frame)\n const clampBounds: CanvasBounds = frameBounds ?? {\n x: frame.position.x,\n y: frame.position.y,\n width: w,\n height: h,\n }\n\n // fitBounds: child content bounding box (for centering)\n const contentNodeIds = childNodes\n .filter((n) => n.id !== frameId)\n .map((n) => n.id)\n const contentBounds = contentNodeIds.length > 0\n ? getNodeBounds(data.nodes, contentNodeIds)\n : undefined\n const fitBounds = contentBounds ?? clampBounds\n\n return {\n data: {\n nodes: childNodes,\n edges: childEdges,\n viewport: data.viewport,\n },\n fitBounds,\n clampBounds,\n bounds: clampBounds,\n }\n}\n","import type React from 'react'\n\n// ── Dynamic node data ──\n\nexport interface DynamicNodeData {\n nodeTypeSlug: string\n label: string\n fields: Record<string, unknown>\n}\n\nexport type CanvasNodeData = (DynamicNodeData | FrameNodeData) &\n Record<string, unknown>\n\n// ── Canvas types (mirrors @xyflow/react but standalone) ──\n\nexport interface CanvasNodePosition {\n x: number\n y: number\n}\n\nexport interface CanvasNode {\n id: string\n type?: string\n position: CanvasNodePosition\n data: CanvasNodeData\n parentId?: string\n style?: React.CSSProperties\n width?: number\n height?: number\n measured?: { width?: number; height?: number }\n draggable?: boolean\n selectable?: boolean\n [key: string]: unknown\n}\n\nexport interface CanvasEdge {\n id: string\n source: string\n target: string\n sourceHandle?: string | null\n targetHandle?: string | null\n type?: string\n style?: React.CSSProperties\n animated?: boolean\n markerStart?: unknown\n markerEnd?: unknown\n edgeTypeSlug?: string\n fields?: Record<string, unknown>\n [key: string]: unknown\n}\n\nexport interface CanvasViewport {\n x: number\n y: number\n zoom: number\n}\n\nexport interface CanvasData {\n nodes: CanvasNode[]\n edges: CanvasEdge[]\n viewport: CanvasViewport\n}\n\n// ── Node type definitions (mirrors console's NodeTypeDef) ──\n\nexport interface NodeTypeFieldDef {\n name: string\n label: string\n fieldType:\n | 'text'\n | 'textarea'\n | 'number'\n | 'url'\n | 'color'\n | 'image'\n | 'select'\n | 'toggle'\n options?: { label: string; value: string }[]\n defaultValue?: string\n required?: boolean\n}\n\nexport interface NodeTypeDef {\n slug: string\n name: string\n color: string\n defaultSize: { width: number; height: number }\n fields: NodeTypeFieldDef[]\n transparentBackground?: boolean\n template?: string | null\n customCSS?: string | null\n}\n\n// ── Edge type definitions (mirrors console's EdgeTypeDef) ──\n\nexport interface EdgeTypeDef {\n slug: string\n name: string\n color: string\n strokeWidth: number\n animated: boolean\n lineStyle: string\n markerStart: string\n markerEnd: string\n fields: NodeTypeFieldDef[]\n}\n\n// ── Type guards ──\n\nexport function isDynamicNode(\n node: CanvasNode,\n): node is CanvasNode & { data: DynamicNodeData } {\n return node.type === 'dynamic'\n}\n\nexport function isFrameNode(\n node: CanvasNode,\n): node is CanvasNode & { data: FrameNodeData } {\n return node.type === 'frame'\n}\n\n// ── Component slot props ──\n\nexport interface DynamicNodeSlotProps {\n id: string\n nodeTypeSlug: string\n label: string\n fields: Record<string, unknown>\n nodeTypeDef?: NodeTypeDef\n /** Whether this node is currently selected */\n selected?: boolean\n /** Measured node width (undefined before first measurement) */\n width?: number\n /** Measured node height (undefined before first measurement) */\n height?: number\n /** The default rendering (template or field-based). Allows custom renderers to wrap/extend instead of replacing entirely. */\n defaultRender?: React.ReactElement\n}\n\n// ── Frame node data ──\n\nexport interface FrameNodeData {\n label: string\n color?: string\n padding?: number\n borderStyle?: 'dashed' | 'solid' | 'none'\n opacity?: number\n}\n\n// S1: Frame renderer slot\nexport interface FrameNodeSlotProps {\n id: string\n label: string\n color?: string\n padding?: number\n borderStyle?: 'dashed' | 'solid' | 'none'\n opacity?: number\n width?: number\n height?: number\n children?: React.ReactNode\n}\n\n// S2: Edge renderer slot\nexport interface EdgeSlotProps {\n id: string\n edgeTypeSlug?: string\n source: string\n target: string\n label?: string\n fields?: Record<string, unknown>\n edgeTypeDef?: EdgeTypeDef\n style?: React.CSSProperties\n}\n\n// S3: Node wrapper slot\nexport interface NodeWrapperSlotProps {\n id: string\n nodeTypeSlug: string\n label: string\n selected?: boolean\n nodeTypeDef?: NodeTypeDef\n children: React.ReactNode\n}\n\n// S8: Viewport focus\nexport interface CanvasBounds {\n x: number\n y: number\n width: number\n height: number\n}\n","import type { NodeTypeDef } from './types'\n\nexport const BUILT_IN_NODE_TYPES: NodeTypeDef[] = [\n {\n slug: 'text',\n name: 'Text',\n color: '#e5e7eb',\n defaultSize: { width: 200, height: 200 },\n fields: [{ name: 'body', label: 'Body', fieldType: 'textarea' }],\n },\n {\n slug: 'image',\n name: 'Image',\n color: '#e5e7eb',\n transparentBackground: true,\n defaultSize: { width: 200, height: 200 },\n fields: [\n { name: 'image', label: 'Image', fieldType: 'image' },\n { name: 'alt', label: 'Alt Text', fieldType: 'text' },\n { name: 'caption', label: 'Caption', fieldType: 'text' },\n ],\n },\n]\n","import type { EdgeTypeDef } from './types'\n\nexport const BUILT_IN_EDGE_TYPES: EdgeTypeDef[] = [\n {\n slug: 'default',\n name: 'Default',\n color: '',\n strokeWidth: 2,\n animated: false,\n lineStyle: 'default',\n markerStart: 'none',\n markerEnd: 'arrow',\n fields: [],\n },\n]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC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ACpBO,IAAM,sBAAqC;AAAA,EAChD;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,aAAa;AAAA,IACb,UAAU;AAAA,IACV,WAAW;AAAA,IACX,aAAa;AAAA,IACb,WAAW;AAAA,IACX,QAAQ,CAAC;AAAA,EACX;AACF;","names":[]}
@@ -0,0 +1,3 @@
1
+ export { o as BUILT_IN_EDGE_TYPES, B as BUILT_IN_NODE_TYPES, g as CanvasBounds, C as CanvasData, c as CanvasEdge, a as CanvasNode, j as CanvasNodeData, i as CanvasNodePosition, f as CanvasViewport, k as DynamicNodeData, E as EdgeTypeDef, h as FrameData, l as FrameNodeData, N as NodeTypeDef, b as NodeTypeFieldDef, P as PrefetchCanvasOptions, t as getFrameData, s as getFrames, r as getNodeBounds, m as isDynamicNode, n as isFrameNode, q as prefetchCanvas } from '../../server-DxhuG-_s.cjs';
2
+ import '@tanstack/react-query';
3
+ import 'react';
@@ -0,0 +1,3 @@
1
+ export { o as BUILT_IN_EDGE_TYPES, B as BUILT_IN_NODE_TYPES, g as CanvasBounds, C as CanvasData, c as CanvasEdge, a as CanvasNode, j as CanvasNodeData, i as CanvasNodePosition, f as CanvasViewport, k as DynamicNodeData, E as EdgeTypeDef, h as FrameData, l as FrameNodeData, N as NodeTypeDef, b as NodeTypeFieldDef, P as PrefetchCanvasOptions, t as getFrameData, s as getFrames, r as getNodeBounds, m as isDynamicNode, n as isFrameNode, q as prefetchCanvas } from '../../server-DxhuG-_s.js';
2
+ import '@tanstack/react-query';
3
+ import 'react';