nodestack-client 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.ts", "../src/auth/BaseAuthStore.ts", "../src/auth/LocalAuthStore.ts", "../src/errors/ClientResponseError.ts", "../src/services/BaseService.ts", "../src/services/RecordService.ts", "../src/services/FileService.ts", "../src/services/RealtimeService.ts", "../src/services/AdminService.ts", "../src/services/CollectionService.ts", "../src/Client.ts", "../src/auth/MemoryAuthStore.ts"],
4
+ "sourcesContent": ["// Main Client\nexport { NodeStackClient } from './Client';\nexport { NodeStackClient as default } from './Client';\n\n// Errors\nexport { ClientResponseError, ClientResponseErrorOptions } from './errors/ClientResponseError';\n\n// Auth Stores\nexport { BaseAuthStore, AuthChangeListener, decodeJwtPayload } from './auth/BaseAuthStore';\nexport { LocalAuthStore, StorageLike } from './auth/LocalAuthStore';\nexport { MemoryAuthStore } from './auth/MemoryAuthStore';\n\n// Services\nexport { BaseService, ClientInterface } from './services/BaseService';\nexport { RecordService, ClientWithRealtime } from './services/RecordService';\nexport { FileService, FileUrlOptions } from './services/FileService';\nexport { RealtimeService } from './services/RealtimeService';\nexport { AdminService } from './services/AdminService';\nexport { CollectionService } from './services/CollectionService';\n\n// Types & Models\nexport * from './types';\n", "import type { RecordModel, AdminModel } from '../types';\n\nexport type AuthChangeListener = (token: string, model: RecordModel | AdminModel | null) => void;\n\n/**\n * Lightweight helper to decode JWT payload without external dependencies.\n */\nexport function decodeJwtPayload(token: string): Record<string, any> | null {\n if (!token || typeof token !== 'string') return null;\n const parts = token.split('.');\n if (parts.length !== 3) return null;\n\n try {\n let b64 = parts[1].replace(/-/g, '+').replace(/_/g, '/');\n while (b64.length % 4) {\n b64 += '=';\n }\n\n let jsonStr: string;\n const globalObj: any =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof window !== 'undefined'\n ? window\n : typeof self !== 'undefined'\n ? self\n : {};\n\n if (typeof globalObj.atob === 'function') {\n jsonStr = decodeURIComponent(\n Array.prototype.map\n .call(globalObj.atob(b64), (c: string) => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2))\n .join('')\n );\n } else if (typeof globalObj.Buffer !== 'undefined') {\n jsonStr = globalObj.Buffer.from(b64, 'base64').toString('utf8');\n } else {\n return null;\n }\n\n return JSON.parse(jsonStr);\n } catch {\n return null;\n }\n}\n\n/**\n * Base abstract class for authentication stores.\n */\nexport abstract class BaseAuthStore {\n protected _token: string = '';\n protected _model: RecordModel | AdminModel | null = null;\n private _listeners: Set<AuthChangeListener> = new Set();\n\n public get token(): string {\n return this._token;\n }\n\n public get model(): RecordModel | AdminModel | null {\n return this._model;\n }\n\n /**\n * Returns true if a token exists and has not yet expired.\n */\n public get isValid(): boolean {\n if (!this._token) {\n return false;\n }\n\n const payload = decodeJwtPayload(this._token);\n if (!payload) {\n return false;\n }\n\n if (payload.exp && typeof payload.exp === 'number') {\n const now = Math.floor(Date.now() / 1000);\n return payload.exp > now;\n }\n\n return true;\n }\n\n /**\n * Saves the token and associated user or admin model.\n */\n public save(token: string, model?: RecordModel | AdminModel | null): void {\n this._token = token || '';\n this._model = model || null;\n this.notify();\n }\n\n /**\n * Clears the current authentication state.\n */\n public clear(): void {\n this._token = '';\n this._model = null;\n this.notify();\n }\n\n /**\n * Subscribes to changes in authentication state (token or model).\n * Returns an unbind function.\n */\n public onChange(callback: AuthChangeListener, fireImmediately = false): () => void {\n this._listeners.add(callback);\n if (fireImmediately) {\n try {\n callback(this._token, this._model);\n } catch (err) {\n console.error('[AuthStore] Error in immediate onChange listener:', err);\n }\n }\n\n return () => {\n this._listeners.delete(callback);\n };\n }\n\n /**\n * Triggers all subscribed change listeners.\n */\n protected notify(): void {\n for (const listener of this._listeners) {\n try {\n listener(this._token, this._model);\n } catch (err) {\n console.error('[AuthStore] Error in onChange listener:', err);\n }\n }\n }\n}\n", "import { BaseAuthStore } from './BaseAuthStore';\nimport type { RecordModel, AdminModel } from '../types';\n\nexport interface StorageLike {\n getItem(key: string): string | null;\n setItem(key: string, value: string): void;\n removeItem(key: string): void;\n}\n\nconst DEFAULT_STORAGE_KEY = 'nodestack_auth';\n\n/**\n * Storage-backed AuthStore that syncs token and model with localStorage\n * (or any custom StorageLike object, such as sessionStorage or AsyncStorage).\n * Safely degrades to memory if storage is not available.\n */\nexport class LocalAuthStore extends BaseAuthStore {\n private storageKey: string;\n private storage?: StorageLike;\n\n constructor(storageKey: string = DEFAULT_STORAGE_KEY, customStorage?: StorageLike) {\n super();\n this.storageKey = storageKey;\n\n if (customStorage) {\n this.storage = customStorage;\n } else if (typeof window !== 'undefined' && window.localStorage) {\n this.storage = window.localStorage;\n }\n\n this.loadInitial();\n }\n\n private loadInitial(): void {\n if (!this.storage) return;\n\n try {\n const raw = this.storage.getItem(this.storageKey);\n if (raw) {\n const parsed = JSON.parse(raw);\n if (parsed && typeof parsed.token === 'string') {\n this._token = parsed.token;\n this._model = parsed.model || null;\n }\n }\n } catch {\n // Ignore parse or storage errors\n }\n }\n\n public override save(token: string, model?: RecordModel | AdminModel | null): void {\n super.save(token, model);\n\n if (this.storage) {\n try {\n this.storage.setItem(\n this.storageKey,\n JSON.stringify({\n token: this._token,\n model: this._model,\n })\n );\n } catch {\n // Storage might be full or disabled\n }\n }\n }\n\n public override clear(): void {\n super.clear();\n\n if (this.storage) {\n try {\n this.storage.removeItem(this.storageKey);\n } catch {\n // Ignore storage error\n }\n }\n }\n}\n", "export interface ClientResponseErrorOptions {\n url?: string;\n status?: number;\n data?: any;\n isAbort?: boolean;\n originalError?: any;\n message?: string;\n}\n\n/**\n * Standardized client response error representing failed HTTP requests\n * or network exceptions when interacting with NodeStack.\n */\nexport class ClientResponseError extends Error {\n public readonly url: string;\n public readonly status: number;\n public readonly data: any;\n public readonly isAbort: boolean;\n public readonly originalError?: any;\n\n constructor(options: ClientResponseErrorOptions = {}) {\n const status = options.status || 0;\n const message =\n options.message ||\n options.data?.message ||\n (status > 0 ? `NodeStack request failed with status ${status}` : 'NodeStack network request failed');\n\n super(message);\n this.name = 'ClientResponseError';\n this.url = options.url || '';\n this.status = status;\n this.data = options.data || {};\n this.isAbort = Boolean(options.isAbort);\n this.originalError = options.originalError;\n\n // Restore prototype chain\n Object.setPrototypeOf(this, ClientResponseError.prototype);\n }\n\n public toJSON() {\n return {\n name: this.name,\n message: this.message,\n url: this.url,\n status: this.status,\n data: this.data,\n isAbort: this.isAbort,\n };\n }\n}\n", "import type { SendOptions } from '../types';\nimport type { BaseAuthStore } from '../auth/BaseAuthStore';\n\nexport interface ClientInterface {\n baseUrl: string;\n authStore: BaseAuthStore;\n send<T = any>(path: string, options?: SendOptions): Promise<T>;\n}\n\n/**\n * Base service class from which all specific domain services inherit.\n */\nexport abstract class BaseService {\n constructor(protected readonly client: ClientInterface) {}\n\n protected send<T = any>(path: string, options: SendOptions = {}): Promise<T> {\n return this.client.send<T>(path, options);\n }\n}\n", "import { BaseService, ClientInterface } from './BaseService';\nimport { ClientResponseError } from '../errors/ClientResponseError';\nimport type {\n ListResult,\n QueryOptions,\n RecordModel,\n RecordAuthResponse,\n ImportResult,\n RealtimeCallback,\n UnsubscribeFunc,\n} from '../types';\n\nexport interface ClientWithRealtime extends ClientInterface {\n realtime: {\n subscribe<R = any>(topic: string, callback: RealtimeCallback<R>): Promise<UnsubscribeFunc>;\n unsubscribe(topic?: string, callback?: RealtimeCallback<any>): Promise<void>;\n };\n}\n\n/**\n * Service for managing CRUD, authentication, file handling, and subscriptions\n * for a specific collection.\n */\nexport class RecordService<T = RecordModel> extends BaseService {\n constructor(\n client: ClientWithRealtime,\n public readonly collectionName: string\n ) {\n super(client);\n }\n\n private get clientWithRealtime(): ClientWithRealtime {\n return this.client as ClientWithRealtime;\n }\n\n /**\n * Returns a paginated list of records matching the query options.\n */\n public async getList(\n page = 1,\n perPage = 30,\n options: QueryOptions = {}\n ): Promise<ListResult<T>> {\n return this.send<ListResult<T>>(\n `/api/collections/${encodeURIComponent(this.collectionName)}/records`,\n {\n method: 'GET',\n query: {\n page,\n perPage,\n ...options,\n },\n }\n );\n }\n\n /**\n * Fetches and aggregates all records in the collection across multiple pages.\n */\n public async getFullList(\n options: QueryOptions & { batch?: number } = {}\n ): Promise<T[]> {\n const batch = Math.max(1, Math.min(500, options.batch || 200));\n const query = { ...options };\n delete query.batch;\n\n const firstPage = await this.getList(1, batch, query);\n const items: T[] = [...firstPage.items];\n\n if (firstPage.totalPages <= 1) {\n return items;\n }\n\n for (let page = 2; page <= firstPage.totalPages; page++) {\n const result = await this.getList(page, batch, query);\n items.push(...result.items);\n }\n\n return items;\n }\n\n /**\n * Returns the first record matching the specified filter expression.\n * Throws ClientResponseError(404) if no record matches.\n */\n public async getFirstListItem(\n filter: string,\n options: QueryOptions = {}\n ): Promise<T> {\n const list = await this.getList(1, 1, {\n ...options,\n filter,\n });\n\n if (!list.items || list.items.length === 0) {\n throw new ClientResponseError({\n status: 404,\n url: `/api/collections/${this.collectionName}/records`,\n message: `The requested record was not found in collection '${this.collectionName}'.`,\n });\n }\n\n return list.items[0];\n }\n\n /**\n * Retrieves a single record by its ID.\n */\n public async getOne(id: string, options: QueryOptions = {}): Promise<T> {\n return this.send<T>(\n `/api/collections/${encodeURIComponent(this.collectionName)}/records/${encodeURIComponent(id)}`,\n {\n method: 'GET',\n query: options,\n }\n );\n }\n\n /**\n * Creates a new record in the collection.\n * Accepts a plain object or FormData (for file uploads).\n */\n public async create(\n data: Record<string, any> | FormData,\n options: QueryOptions = {}\n ): Promise<T> {\n return this.send<T>(\n `/api/collections/${encodeURIComponent(this.collectionName)}/records`,\n {\n method: 'POST',\n body: data,\n query: options,\n }\n );\n }\n\n /**\n * Updates an existing record by its ID.\n * Accepts a plain object or FormData (for file updates).\n */\n public async update(\n id: string,\n data: Record<string, any> | FormData,\n options: QueryOptions = {}\n ): Promise<T> {\n return this.send<T>(\n `/api/collections/${encodeURIComponent(this.collectionName)}/records/${encodeURIComponent(id)}`,\n {\n method: 'PATCH',\n body: data,\n query: options,\n }\n );\n }\n\n /**\n * Deletes a record by its ID.\n */\n public async delete(id: string): Promise<boolean> {\n await this.send<void>(\n `/api/collections/${encodeURIComponent(this.collectionName)}/records/${encodeURIComponent(id)}`,\n {\n method: 'DELETE',\n }\n );\n return true;\n }\n\n /**\n * Authenticates against an auth collection using identity/email and password.\n * On success, automatically persists the token and record to authStore.\n */\n public async authWithPassword(\n identity: string,\n password: string\n ): Promise<RecordAuthResponse<T>> {\n const result = await this.send<RecordAuthResponse<T>>(\n `/api/collections/${encodeURIComponent(this.collectionName)}/auth-with-password`,\n {\n method: 'POST',\n body: { identity, password },\n }\n );\n\n if (result && result.token) {\n this.client.authStore.save(result.token, result.record as any);\n }\n\n return result;\n }\n\n /**\n * Exports records from the collection as CSV or JSON.\n */\n public async export(\n format: 'csv' | 'json' = 'csv',\n options: QueryOptions = {}\n ): Promise<string> {\n return this.send<string>(\n `/api/collections/${encodeURIComponent(this.collectionName)}/export`,\n {\n method: 'GET',\n query: {\n ...options,\n format,\n },\n }\n );\n }\n\n /**\n * Imports records into the collection.\n */\n public async import(\n data: any[] | FormData | Blob | string,\n options: { continueOnError?: boolean } = {}\n ): Promise<ImportResult> {\n return this.send<ImportResult>(\n `/api/collections/${encodeURIComponent(this.collectionName)}/import`,\n {\n method: 'POST',\n body: data,\n query: options,\n }\n );\n }\n\n /**\n * Subscribes to realtime events on this collection or a specific record ID.\n *\n * Example:\n * // Listen to all records in collection:\n * client.collection('posts').subscribe('*', (e) => console.log(e.action, e.record));\n *\n * // Listen to single record changes:\n * client.collection('posts').subscribe('record_id_123', (e) => console.log(e.action, e.record));\n */\n public async subscribe(\n topicOrCallback: string | RealtimeCallback<T>,\n callback?: RealtimeCallback<T>\n ): Promise<UnsubscribeFunc> {\n let topic = '*';\n let cb: RealtimeCallback<T>;\n\n if (typeof topicOrCallback === 'function') {\n topic = '*';\n cb = topicOrCallback;\n } else {\n topic = topicOrCallback;\n cb = callback!;\n }\n\n const fullTopic = topic === '*' ? this.collectionName : `${this.collectionName}/${topic}`;\n return this.clientWithRealtime.realtime.subscribe<T>(fullTopic, cb);\n }\n\n /**\n * Unsubscribes from realtime events for this collection.\n */\n public async unsubscribe(topic?: string): Promise<void> {\n const fullTopic = !topic || topic === '*' ? this.collectionName : `${this.collectionName}/${topic}`;\n return this.clientWithRealtime.realtime.unsubscribe(fullTopic);\n }\n}\n", "import { BaseService } from './BaseService';\n\nexport interface FileUrlOptions {\n download?: boolean;\n token?: string | boolean;\n collection?: string;\n}\n\n/**\n * Service for generating file URLs for assets uploaded to NodeStack.\n */\nexport class FileService extends BaseService {\n /**\n * Generates a fully qualified URL to an uploaded file.\n *\n * @param record - Record object or record ID string\n * @param filename - Name of the file stored on the record\n * @param options - Additional options (download flag, auth token, collection override)\n */\n public getUrl(\n record: { id: string; collection?: string; collectionName?: string; [key: string]: any } | string,\n filename: string,\n options: FileUrlOptions = {}\n ): string {\n if (!filename) return '';\n\n let recordId = '';\n let collectionName = options.collection || '';\n\n if (typeof record === 'string') {\n recordId = record;\n } else if (record && typeof record === 'object') {\n recordId = record.id || '';\n collectionName =\n collectionName ||\n record.collection ||\n record.collectionName ||\n record['@collectionName'] ||\n '';\n }\n\n if (!recordId) {\n throw new Error('[FileService] A valid record or recordId is required to construct a file URL.');\n }\n\n if (!collectionName) {\n throw new Error(\n '[FileService] Collection name is required. Either provide a record with collection info or pass options.collection.'\n );\n }\n\n const cleanBase = (this.client.baseUrl || '').replace(/\\/+$/, '');\n const cleanCol = encodeURIComponent(collectionName);\n const cleanId = encodeURIComponent(recordId);\n const cleanFile = encodeURIComponent(filename);\n\n let url = `${cleanBase}/api/files/${cleanCol}/${cleanId}/${cleanFile}`;\n\n const queryParts: string[] = [];\n\n if (options.download) {\n queryParts.push('download=1');\n }\n\n // Attach token if requested\n if (typeof options.token === 'string' && options.token) {\n queryParts.push(`token=${encodeURIComponent(options.token)}`);\n } else if (options.token === true && this.client.authStore.token) {\n queryParts.push(`token=${encodeURIComponent(this.client.authStore.token)}`);\n }\n\n if (queryParts.length > 0) {\n url += `?${queryParts.join('&')}`;\n }\n\n return url;\n }\n}\n", "import { BaseService, ClientInterface } from './BaseService';\nimport type { RealtimeEvent, RealtimeCallback, UnsubscribeFunc } from '../types';\n\n/**\n * Multiplexed Realtime Server-Sent Events (SSE) service.\n * Manages a single persistent SSE connection and dispatches events to subscribed listeners.\n */\nexport class RealtimeService extends BaseService {\n private eventSource: any = null;\n private clientId: string = '';\n private isConnecting: boolean = false;\n private connectPromise: Promise<string> | null = null;\n private reconnectTimeout: any = null;\n private reconnectAttempts: number = 0;\n private customEventSource?: any;\n\n // Map of topic -> Set of callbacks\n private subscriptions: Map<string, Set<RealtimeCallback<any>>> = new Map();\n\n // Set of registered event names on the active EventSource\n private registeredEventNames: Set<string> = new Set();\n\n constructor(client: ClientInterface, customEventSource?: any) {\n super(client);\n this.customEventSource = customEventSource;\n }\n\n /**\n * Returns whether there is an active EventSource connection.\n */\n public get isConnected(): boolean {\n return Boolean(this.eventSource && this.clientId);\n }\n\n /**\n * Resolves the EventSource constructor available in the current environment.\n */\n private getEventSourceConstructor(): any {\n if (this.customEventSource) {\n return this.customEventSource;\n }\n if (typeof window !== 'undefined' && (window as any).EventSource) {\n return (window as any).EventSource;\n }\n if (typeof globalThis !== 'undefined' && (globalThis as any).EventSource) {\n return (globalThis as any).EventSource;\n }\n throw new Error(\n '[RealtimeService] EventSource is not supported natively in this environment. ' +\n 'Please pass an EventSource polyfill to ClientOptions (e.g. from the \"eventsource\" package).'\n );\n }\n\n /**\n * Connects to the SSE stream if not already connected.\n * Returns the connected clientId.\n */\n public async connect(): Promise<string> {\n if (this.clientId && this.eventSource) {\n return this.clientId;\n }\n\n if (this.connectPromise) {\n return this.connectPromise;\n }\n\n this.connectPromise = new Promise<string>((resolve, reject) => {\n try {\n const EventSourceClass = this.getEventSourceConstructor();\n const base = (this.client.baseUrl || '').replace(/\\/+$/, '');\n let url = `${base}/api/realtime`;\n\n if (this.client.authStore.token) {\n url += `?token=${encodeURIComponent(this.client.authStore.token)}`;\n }\n\n this.eventSource = new EventSourceClass(url);\n\n const handleConnect = async (event: any) => {\n try {\n const data = JSON.parse(event.data);\n this.clientId = data.clientId;\n this.reconnectAttempts = 0;\n\n // Re-apply any existing subscriptions on the server\n await this.syncSubscriptions();\n\n resolve(this.clientId);\n } catch (err) {\n reject(err);\n }\n };\n\n this.eventSource.addEventListener('NS_CONNECT', handleConnect);\n this.eventSource.addEventListener('NB_CONNECT', handleConnect);\n\n this.eventSource.onerror = (err: any) => {\n if (!this.clientId) {\n reject(err);\n }\n this.handleDisconnect();\n };\n\n // Bind listeners for all known collection topics\n this.bindActiveTopics();\n } catch (err) {\n this.connectPromise = null;\n reject(err);\n }\n }).finally(() => {\n this.connectPromise = null;\n });\n\n return this.connectPromise;\n }\n\n /**\n * Subscribes to realtime updates for a collection or record.\n *\n * @param topic - Collection name ('posts'), wildcard ('*'), or specific record ('posts/rec_123')\n * @param callback - Event listener callback\n * @returns Unsubscribe function\n */\n public async subscribe<T = any>(\n topic: string,\n callback: RealtimeCallback<T>\n ): Promise<UnsubscribeFunc> {\n const cleanTopic = (topic || '*').trim();\n\n if (!this.subscriptions.has(cleanTopic)) {\n this.subscriptions.set(cleanTopic, new Set());\n }\n\n this.subscriptions.get(cleanTopic)!.add(callback);\n\n // If connected, sync subscriptions with server\n if (this.isConnected) {\n this.bindTopicListener(cleanTopic);\n await this.syncSubscriptions();\n } else {\n // Connect and sync\n await this.connect();\n }\n\n return () => this.unsubscribe(cleanTopic, callback);\n }\n\n /**\n * Unsubscribes from a topic or specific callback.\n */\n public async unsubscribe(topic?: string, callback?: RealtimeCallback<any>): Promise<void> {\n if (!topic) {\n // Unsubscribe all\n this.subscriptions.clear();\n if (this.isConnected) {\n await this.syncSubscriptions();\n }\n return;\n }\n\n const cleanTopic = topic.trim();\n if (!this.subscriptions.has(cleanTopic)) {\n return;\n }\n\n if (callback) {\n this.subscriptions.get(cleanTopic)!.delete(callback);\n if (this.subscriptions.get(cleanTopic)!.size === 0) {\n this.subscriptions.delete(cleanTopic);\n }\n } else {\n this.subscriptions.delete(cleanTopic);\n }\n\n if (this.isConnected) {\n await this.syncSubscriptions();\n }\n }\n\n /**\n * Closes the SSE connection and clears state.\n */\n public disconnect(): void {\n if (this.reconnectTimeout) {\n clearTimeout(this.reconnectTimeout);\n this.reconnectTimeout = null;\n }\n\n if (this.eventSource) {\n try {\n this.eventSource.close();\n } catch {}\n this.eventSource = null;\n }\n\n this.clientId = '';\n this.registeredEventNames.clear();\n }\n\n /**\n * Synchronizes active subscriptions with the backend via POST /api/realtime.\n */\n private async syncSubscriptions(): Promise<void> {\n if (!this.clientId) return;\n\n const topics = Array.from(this.subscriptions.keys());\n\n try {\n await this.client.send('/api/realtime', {\n method: 'POST',\n body: {\n clientId: this.clientId,\n subscriptions: topics.length > 0 ? topics : ['__noop__'],\n },\n });\n } catch (err) {\n console.warn('[RealtimeService] Failed to sync subscriptions with server:', err);\n }\n }\n\n /**\n * Binds an EventSource listener for the collection corresponding to a topic.\n */\n private bindTopicListener(topic: string): void {\n if (!this.eventSource) return;\n\n // Determine collection name\n const collectionName = topic.includes('/') ? topic.split('/')[0] : topic;\n\n if (this.registeredEventNames.has(collectionName)) {\n return;\n }\n\n this.registeredEventNames.add(collectionName);\n\n this.eventSource.addEventListener(collectionName, (event: any) => {\n try {\n const payload: RealtimeEvent<any> = JSON.parse(event.data);\n this.dispatchEvent(collectionName, payload);\n } catch (err) {\n console.error(`[RealtimeService] Error handling event for ${collectionName}:`, err);\n }\n });\n }\n\n private bindActiveTopics(): void {\n for (const topic of this.subscriptions.keys()) {\n this.bindTopicListener(topic);\n }\n }\n\n /**\n * Dispatches received SSE events to matching subscribed listeners.\n */\n private dispatchEvent(collectionName: string, event: RealtimeEvent<any>): void {\n const recordId = event.record?.id;\n\n // Check wildcard subscription '*'\n this.triggerListeners('*', event);\n\n // Check collection subscription e.g. 'posts' or 'posts/*'\n this.triggerListeners(collectionName, event);\n this.triggerListeners(`${collectionName}/*`, event);\n\n // Check record-specific subscription e.g. 'posts/rec_123'\n if (recordId) {\n this.triggerListeners(`${collectionName}/${recordId}`, event);\n }\n }\n\n private triggerListeners(topic: string, event: RealtimeEvent<any>): void {\n const callbacks = this.subscriptions.get(topic);\n if (!callbacks || callbacks.size === 0) return;\n\n for (const cb of callbacks) {\n try {\n cb(event);\n } catch (err) {\n console.error(`[RealtimeService] Error in realtime listener for ${topic}:`, err);\n }\n }\n }\n\n /**\n * Handles disconnections and schedules automatic reconnection.\n */\n private handleDisconnect(): void {\n if (this.reconnectTimeout) return;\n\n this.disconnect();\n\n // Exponential backoff up to 10 seconds\n const delay = Math.min(10000, 500 * Math.pow(1.5, this.reconnectAttempts));\n this.reconnectAttempts++;\n\n this.reconnectTimeout = setTimeout(() => {\n this.reconnectTimeout = null;\n if (this.subscriptions.size > 0) {\n this.connect().catch(() => {});\n }\n }, delay);\n }\n}\n", "import { BaseService } from './BaseService';\nimport type { AdminAuthResponse, AdminModel } from '../types';\n\n/**\n * Service for administrative and superuser actions.\n */\nexport class AdminService extends BaseService {\n /**\n * Checks whether at least one superuser / admin account exists in NodeStack.\n */\n public async hasAdmins(): Promise<boolean> {\n const res = await this.send<{ hasAdmins: boolean }>('/api/admins/has-admins', {\n method: 'GET',\n });\n return Boolean(res?.hasAdmins);\n }\n\n /**\n * Creates the initial superuser account during first-time setup.\n * Automatically persists the returned admin token and model to authStore.\n */\n public async createInitial(email: string, password: string): Promise<AdminAuthResponse> {\n const res = await this.send<AdminAuthResponse>('/api/admins/create-initial', {\n method: 'POST',\n body: { email, password },\n });\n\n if (res?.token) {\n this.client.authStore.save(res.token, res.admin);\n }\n\n return res;\n }\n\n /**\n * Authenticates a superuser / admin using email and password.\n * Automatically persists the returned admin token and model to authStore.\n */\n public async authWithPassword(identity: string, password: string): Promise<AdminAuthResponse> {\n const res = await this.send<AdminAuthResponse>('/api/admins/auth-with-password', {\n method: 'POST',\n body: { identity, password },\n });\n\n if (res?.token) {\n this.client.authStore.save(res.token, res.admin);\n }\n\n return res;\n }\n\n /**\n * Retrieves the currently authenticated superuser's profile.\n */\n public async getMe(): Promise<AdminModel> {\n return this.send<AdminModel>('/api/admins/me', {\n method: 'GET',\n });\n }\n}\n", "import { BaseService } from './BaseService';\n\n/**\n * Service for managing collection schema definitions (Admin only).\n */\nexport class CollectionService extends BaseService {\n /**\n * Retrieves all collection schema models.\n */\n public async getList(): Promise<any[]> {\n const res = await this.send<{ items: any[]; totalItems: number } | any[]>('/api/collections', {\n method: 'GET',\n });\n return Array.isArray(res) ? res : res?.items || [];\n }\n\n /**\n * Retrieves a single collection schema by name or ID.\n */\n public async getOne(nameOrId: string): Promise<any> {\n return this.send<any>(`/api/collections/${encodeURIComponent(nameOrId)}`, {\n method: 'GET',\n });\n }\n\n /**\n * Creates a new collection schema.\n */\n public async create(data: any): Promise<any> {\n return this.send<any>('/api/collections', {\n method: 'POST',\n body: data,\n });\n }\n\n /**\n * Updates an existing collection schema.\n */\n public async update(nameOrId: string, data: any): Promise<any> {\n return this.send<any>(`/api/collections/${encodeURIComponent(nameOrId)}`, {\n method: 'PATCH',\n body: data,\n });\n }\n\n /**\n * Deletes a collection schema and its corresponding SQLite table.\n */\n public async delete(nameOrId: string): Promise<boolean> {\n await this.send<void>(`/api/collections/${encodeURIComponent(nameOrId)}`, {\n method: 'DELETE',\n });\n return true;\n }\n}\n", "import { BaseAuthStore } from './auth/BaseAuthStore';\nimport { LocalAuthStore } from './auth/LocalAuthStore';\nimport { ClientResponseError } from './errors/ClientResponseError';\nimport { RecordService } from './services/RecordService';\nimport { FileService } from './services/FileService';\nimport { RealtimeService } from './services/RealtimeService';\nimport { AdminService } from './services/AdminService';\nimport { CollectionService } from './services/CollectionService';\nimport type {\n ClientOptions,\n SendOptions,\n RecordModel,\n} from './types';\n\n/**\n * Main NodeStack Client SDK entry point.\n */\nexport class NodeStackClient<TCollections extends Record<string, any> = Record<string, RecordModel>> {\n public readonly baseUrl: string;\n public readonly authStore: BaseAuthStore;\n public readonly files: FileService;\n public readonly realtime: RealtimeService;\n public readonly admins: AdminService;\n public readonly collections: CollectionService;\n\n private customFetch?: typeof fetch;\n private defaultHeaders: Record<string, string>;\n private defaultTimeout: number;\n private recordServices: Map<string, RecordService<any>> = new Map();\n\n constructor(baseUrl: string = '/', options: ClientOptions = {}) {\n this.baseUrl = (baseUrl || '/').replace(/\\/+$/, '');\n this.authStore = options.authStore || new LocalAuthStore();\n this.customFetch = options.fetch;\n this.defaultHeaders = options.headers || {};\n this.defaultTimeout = options.timeout || 120000; // 2 minutes default\n\n this.files = new FileService(this);\n this.realtime = new RealtimeService(this, options.EventSource);\n this.admins = new AdminService(this);\n this.collections = new CollectionService(this);\n }\n\n /**\n * Returns a RecordService for interacting with a specific collection.\n * If a schema map type is provided to NodeStackClient, collection names\n * and record response types are automatically inferred and type-safe.\n */\n public collection<K extends keyof TCollections>(name: K): RecordService<TCollections[K]>;\n public collection<T = RecordModel>(name: string): RecordService<T>;\n public collection(name: string): RecordService<any> {\n const colName = String(name);\n let service = this.recordServices.get(colName);\n if (!service) {\n service = new RecordService(this, colName);\n this.recordServices.set(colName, service);\n }\n return service;\n }\n\n /**\n * Sends an HTTP request to NodeStack with automatic authentication,\n * header injection, query serialization, and standardized error handling.\n */\n public async send<T = any>(path: string, options: SendOptions = {}): Promise<T> {\n const fetchFn = this.customFetch || (typeof fetch !== 'undefined' ? fetch : null);\n if (!fetchFn) {\n throw new Error(\n '[NodeStackClient] fetch is not available in this environment. ' +\n 'Please pass a custom fetch implementation to ClientOptions.'\n );\n }\n\n // 1. Build URL & Query parameters\n let url = path.startsWith('http://') || path.startsWith('https://')\n ? path\n : `${this.baseUrl}${path.startsWith('/') ? path : `/${path}`}`;\n\n if (options.query) {\n const searchParams = new URLSearchParams();\n for (const [key, val] of Object.entries(options.query)) {\n if (val === undefined || val === null) continue;\n searchParams.append(key, String(val));\n }\n const queryStr = searchParams.toString();\n if (queryStr) {\n url += (url.includes('?') ? '&' : '?') + queryStr;\n }\n }\n\n // 2. Prepare headers\n const headers: Record<string, string> = {\n ...this.defaultHeaders,\n ...(options.headers || {}),\n };\n\n if (this.authStore.token && !headers['Authorization'] && !headers['authorization']) {\n headers['Authorization'] = `Bearer ${this.authStore.token}`;\n }\n\n // 3. Serialize body\n let body: any = options.body;\n const isFormData = typeof FormData !== 'undefined' && body instanceof FormData;\n const isBlob = typeof Blob !== 'undefined' && body instanceof Blob;\n\n if (body !== undefined && body !== null) {\n if (isFormData) {\n // Let the environment compute multipart boundary headers automatically\n delete headers['Content-Type'];\n delete headers['content-type'];\n } else if (isBlob || typeof body === 'string') {\n // Leave body as-is\n } else if (typeof body === 'object') {\n headers['Content-Type'] = 'application/json';\n body = JSON.stringify(body);\n }\n }\n\n // 4. Handle abort signal & timeout\n let signal = options.signal;\n let timeoutId: any = null;\n\n if (!signal && this.defaultTimeout > 0 && typeof AbortController !== 'undefined') {\n const controller = new AbortController();\n signal = controller.signal;\n timeoutId = setTimeout(() => controller.abort(), this.defaultTimeout);\n }\n\n try {\n const response = await fetchFn(url, {\n ...options,\n headers,\n body,\n signal,\n });\n\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n // Handle 204 No Content\n if (response.status === 204) {\n return null as any;\n }\n\n const contentType = response.headers.get('content-type') || '';\n let data: any;\n\n if (contentType.includes('application/json')) {\n data = await response.json().catch(() => ({}));\n } else {\n data = await response.text();\n }\n\n if (!response.ok) {\n throw new ClientResponseError({\n url,\n status: response.status,\n data,\n message: typeof data === 'object' && data?.message ? data.message : undefined,\n });\n }\n\n return data as T;\n } catch (err: any) {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n\n if (err instanceof ClientResponseError) {\n throw err;\n }\n\n const isAbort =\n err?.name === 'AbortError' ||\n (signal && signal.aborted) ||\n Boolean(options.signal && options.signal.aborted);\n\n throw new ClientResponseError({\n url,\n status: isAbort ? 0 : 0,\n isAbort,\n originalError: err,\n message: isAbort ? 'Request was aborted' : err?.message || 'Network request failed',\n });\n }\n }\n\n /**\n * Checks backend system health.\n */\n public async health(): Promise<{ status: string; [key: string]: any }> {\n return this.send('/api/health', { method: 'GET' });\n }\n\n /**\n * Retrieves server runtime settings.\n */\n public async settings(): Promise<any> {\n return this.send('/api/settings', { method: 'GET' });\n }\n\n /**\n * Fetches request logs (Admin only).\n */\n public async logs(page = 1, perPage = 50): Promise<any> {\n return this.send('/api/logs', {\n method: 'GET',\n query: { page, perPage },\n });\n }\n\n /**\n * Fetches system metrics & analytics (Admin only).\n */\n public async metrics(): Promise<any> {\n return this.send('/api/metrics', { method: 'GET' });\n }\n}\n", "import { BaseAuthStore } from './BaseAuthStore';\n\n/**\n * In-memory authentication store.\n * Ideal for Node.js scripts, server-side rendering (SSR), and testing environments.\n */\nexport class MemoryAuthStore extends BaseAuthStore {\n // Inherits default in-memory behavior of BaseAuthStore\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACOO,SAAS,iBAAiB,OAA2C;AAC1E,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO;AAChD,QAAM,QAAQ,MAAM,MAAM,GAAG;AAC7B,MAAI,MAAM,WAAW,EAAG,QAAO;AAE/B,MAAI;AACF,QAAI,MAAM,MAAM,CAAC,EAAE,QAAQ,MAAM,GAAG,EAAE,QAAQ,MAAM,GAAG;AACvD,WAAO,IAAI,SAAS,GAAG;AACrB,aAAO;AAAA,IACT;AAEA,QAAI;AACJ,UAAM,YACJ,OAAO,eAAe,cAClB,aACA,OAAO,WAAW,cAChB,SACA,OAAO,SAAS,cACd,OACA,CAAC;AAEX,QAAI,OAAO,UAAU,SAAS,YAAY;AACxC,gBAAU;AAAA,QACR,MAAM,UAAU,IACb,KAAK,UAAU,KAAK,GAAG,GAAG,CAAC,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AAoB;AAAA,UAC5B;AAAA,UACA,QAAQ,SAAS;AAAA,UACjB;AAAA,UACA,SAAS,OAAO,SAAS,YAAY,MAAM,UAAU,KAAK,UAAU;AAAA,QACtE,CAAC;AAAA,MACH;AAEA,aAAO;AAAA,IACT,SAAS,KAAU;AACjB,UAAI,WAAW;AACb,qBAAa,SAAS;AAAA,MACxB;AAEA,UAAI,eAAe,qBAAqB;AACtC,cAAM;AAAA,MACR;AAEA,YAAM,UACJ,KAAK,SAAS,gBACb,UAAU,OAAO,WAClB,QAAQ,QAAQ,UAAU,QAAQ,OAAO,OAAO;AAElD,YAAM,IAAI,oBAAoB;AAAA,QAC5B;AAAA,QACA,QAAQ,UAAU,IAAI;AAAA,QACtB;AAAA,QACA,eAAe;AAAA,QACf,SAAS,UAAU,wBAAwB,KAAK,WAAW;AAAA,MAC7D,CAAC;AAAA,IACH;AAAA,EACF;AAAA;AAAA;AAAA;AAAA,EAKA,MAAa,SAA0D;AACrE,WAAO,KAAK,KAAK,eAAe,EAAE,QAAQ,MAAM,CAAC;AAAA,EACnD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAa,WAAyB;AACpC,WAAO,KAAK,KAAK,iBAAiB,EAAE,QAAQ,MAAM,CAAC;AAAA,EACrD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAa,KAAK,OAAO,GAAG,UAAU,IAAkB;AACtD,WAAO,KAAK,KAAK,aAAa;AAAA,MAC5B,QAAQ;AAAA,MACR,OAAO,EAAE,MAAM,QAAQ;AAAA,IACzB,CAAC;AAAA,EACH;AAAA;AAAA;AAAA;AAAA,EAKA,MAAa,UAAwB;AACnC,WAAO,KAAK,KAAK,gBAAgB,EAAE,QAAQ,MAAM,CAAC;AAAA,EACpD;AACF;;;ACpNO,IAAM,kBAAN,cAA8B,cAAc;AAAA;AAEnD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,14 @@
1
+ export { NodeStackClient } from './Client';
2
+ export { NodeStackClient as default } from './Client';
3
+ export { ClientResponseError, ClientResponseErrorOptions } from './errors/ClientResponseError';
4
+ export { BaseAuthStore, AuthChangeListener, decodeJwtPayload } from './auth/BaseAuthStore';
5
+ export { LocalAuthStore, StorageLike } from './auth/LocalAuthStore';
6
+ export { MemoryAuthStore } from './auth/MemoryAuthStore';
7
+ export { BaseService, ClientInterface } from './services/BaseService';
8
+ export { RecordService, ClientWithRealtime } from './services/RecordService';
9
+ export { FileService, FileUrlOptions } from './services/FileService';
10
+ export { RealtimeService } from './services/RealtimeService';
11
+ export { AdminService } from './services/AdminService';
12
+ export { CollectionService } from './services/CollectionService';
13
+ export * from './types';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,MAAM,UAAU,CAAC;AAGtD,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAG/F,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAGjE,cAAc,SAAS,CAAC"}