@spike-forms/sdk 0.2.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.
- package/README.md +89 -0
- package/dist/index.d.mts +2345 -0
- package/dist/index.d.ts +2345 -0
- package/dist/index.js +1569 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1552 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/http.ts","../src/resources/forms.ts","../src/resources/submissions.ts","../src/resources/rules.ts","../src/resources/projects.ts","../src/resources/teams.ts","../src/resources/user.ts","../src/resources/billing.ts","../src/resources/files.ts","../src/client.ts","../src/index.ts"],"names":[],"mappings":";AA4BO,IAAM,UAAA,GAAN,cAAyB,KAAA,CAAM;AAAA;AAAA,EAEpC,UAAA;AAAA;AAAA,EAGA,IAAA;AAAA;AAAA,EAGA,SAAA;AAAA,EAEA,WAAA,CACE,SACA,OAAA,EAKA;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,IAAA,GAAO,YAAA;AACZ,IAAA,IAAA,CAAK,aAAa,OAAA,EAAS,UAAA;AAC3B,IAAA,IAAA,CAAK,OAAO,OAAA,EAAS,IAAA;AACrB,IAAA,IAAA,CAAK,YAAY,OAAA,EAAS,SAAA;AAG1B,IAAA,IAAI,MAAM,iBAAA,EAAmB;AAC3B,MAAA,KAAA,CAAM,iBAAA,CAAkB,IAAA,EAAM,IAAA,CAAK,WAAW,CAAA;AAAA,IAChD;AAAA,EACF;AACF;AAqBO,IAAM,mBAAA,GAAN,cAAkC,UAAA,CAAW;AAAA,EAClD,WAAA,CACE,SACA,OAAA,EAIA;AACA,IAAA,KAAA,CAAM,SAAS,EAAE,UAAA,EAAY,GAAA,EAAK,GAAG,SAAS,CAAA;AAC9C,IAAA,IAAA,CAAK,IAAA,GAAO,qBAAA;AAAA,EACd;AACF;AAqBO,IA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AAK,KAAA,GAAQ,IAAI,aAAA,CAAc,IAAA,CAAK,IAAI,CAAA;AACxC,IAAA,IAAA,CAAK,QAAA,GAAW,IAAI,gBAAA,CAAiB,IAAA,CAAK,IAAI,CAAA;AAC9C,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAI,aAAA,CAAc,IAAA,CAAK,IAAI,CAAA;AACxC,IAAA,IAAA,CAAK,IAAA,GAAO,IAAI,YAAA,CAAa,IAAA,CAAK,IAAI,CAAA;AACtC,IAAA,IAAA,CAAK,OAAA,GAAU,IAAI,eAAA,CAAgB,IAAA,CAAK,IAAI,CAAA;AAC5C,IAAA,IAAA,CAAK,KAAA,GAAQ,IAAI,aAAA,CAAc,IAAA,CAAK,IAAI,CAAA;AAAA,EAC1C;AACF;;;ACnKO,IAAM,OAAA,GAAU","file":"index.mjs","sourcesContent":["/**\n * Error classes for the Spike Forms SDK\n *\n * Provides a hierarchy of error types for different API error conditions:\n * - SpikeError: Base error class for all SDK errors\n * - AuthenticationError: 401 Unauthorized errors\n * - NotFoundError: 404 Not Found errors\n * - RateLimitError: 429 Too Many Requests errors\n * - ValidationError: 400 Bad Request errors\n * - NetworkError: Network/connection failures\n */\n\n/**\n * Base error class for all Spike SDK errors.\n *\n * @example\n * ```typescript\n * try {\n * await client.forms.get('invalid-id');\n * } catch (error) {\n * if (error instanceof SpikeError) {\n * console.log(error.statusCode); // HTTP status code\n * console.log(error.code); // Error code from API\n * console.log(error.requestId); // Request ID for debugging\n * }\n * }\n * ```\n */\nexport class SpikeError extends Error {\n /** HTTP status code from the API response */\n statusCode?: number;\n\n /** Error code from the API (e.g., 'INVALID_API_KEY', 'FORM_NOT_FOUND') */\n code?: string;\n\n /** Request ID for debugging and support purposes */\n requestId?: string;\n\n constructor(\n message: string,\n options?: {\n statusCode?: number;\n code?: string;\n requestId?: string;\n }\n ) {\n super(message);\n this.name = 'SpikeError';\n this.statusCode = options?.statusCode;\n this.code = options?.code;\n this.requestId = options?.requestId;\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, this.constructor);\n }\n }\n}\n\n/**\n * Error thrown when authentication fails (HTTP 401).\n *\n * This error is thrown when:\n * - The API key is invalid or expired\n * - The API key is missing from the request\n * - The API key doesn't have permission for the requested resource\n *\n * @example\n * ```typescript\n * try {\n * await client.forms.list();\n * } catch (error) {\n * if (error instanceof AuthenticationError) {\n * console.log('Please check your API key');\n * }\n * }\n * ```\n */\nexport class AuthenticationError extends SpikeError {\n constructor(\n message: string,\n options?: {\n code?: string;\n requestId?: string;\n }\n ) {\n super(message, { statusCode: 401, ...options });\n this.name = 'AuthenticationError';\n }\n}\n\n/**\n * Error thrown when a resource is not found (HTTP 404).\n *\n * This error is thrown when:\n * - The requested form, project, team, or other resource doesn't exist\n * - The resource ID is invalid\n * - The resource was deleted\n *\n * @example\n * ```typescript\n * try {\n * await client.forms.get('non-existent-id');\n * } catch (error) {\n * if (error instanceof NotFoundError) {\n * console.log('Form not found');\n * }\n * }\n * ```\n */\nexport class NotFoundError extends SpikeError {\n constructor(\n message: string,\n options?: {\n code?: string;\n requestId?: string;\n }\n ) {\n super(message, { statusCode: 404, ...options });\n this.name = 'NotFoundError';\n }\n}\n\n/**\n * Error thrown when rate limit is exceeded (HTTP 429).\n *\n * This error is thrown when too many requests are made in a short period.\n * The `retryAfter` property indicates how many seconds to wait before retrying.\n *\n * @example\n * ```typescript\n * try {\n * await client.forms.list();\n * } catch (error) {\n * if (error instanceof RateLimitError) {\n * console.log(`Rate limited. Retry after ${error.retryAfter} seconds`);\n * await sleep(error.retryAfter * 1000);\n * // Retry the request\n * }\n * }\n * ```\n */\nexport class RateLimitError extends SpikeError {\n /** Number of seconds to wait before retrying the request */\n retryAfter?: number;\n\n constructor(\n message: string,\n options?: {\n code?: string;\n requestId?: string;\n retryAfter?: number;\n }\n ) {\n super(message, { statusCode: 429, code: options?.code, requestId: options?.requestId });\n this.name = 'RateLimitError';\n this.retryAfter = options?.retryAfter;\n }\n}\n\n/**\n * Error thrown when request validation fails (HTTP 400).\n *\n * This error is thrown when:\n * - Required fields are missing\n * - Field values are invalid\n * - Request body format is incorrect\n *\n * The `details` property contains field-specific validation errors.\n *\n * @example\n * ```typescript\n * try {\n * await client.forms.create({ name: '' });\n * } catch (error) {\n * if (error instanceof ValidationError) {\n * console.log('Validation failed:', error.details);\n * // { name: 'Name is required' }\n * }\n * }\n * ```\n */\nexport class ValidationError extends SpikeError {\n /** Field-specific validation error details */\n details?: Record<string, unknown>;\n\n constructor(\n message: string,\n options?: {\n code?: string;\n requestId?: string;\n details?: Record<string, unknown>;\n }\n ) {\n super(message, { statusCode: 400, code: options?.code, requestId: options?.requestId });\n this.name = 'ValidationError';\n this.details = options?.details;\n }\n}\n\n/**\n * Error thrown when a network error occurs.\n *\n * This error is thrown when:\n * - The network connection fails\n * - The request times out\n * - DNS resolution fails\n * - The server is unreachable\n *\n * @example\n * ```typescript\n * try {\n * await client.forms.list();\n * } catch (error) {\n * if (error instanceof NetworkError) {\n * console.log('Network error:', error.message);\n * // Retry with exponential backoff\n * }\n * }\n * ```\n */\nexport class NetworkError extends SpikeError {\n constructor(\n message: string,\n options?: {\n code?: string;\n requestId?: string;\n }\n ) {\n super(message, { code: options?.code, requestId: options?.requestId });\n this.name = 'NetworkError';\n // NetworkError doesn't have a statusCode since it's not an HTTP response\n }\n}\n","/**\n * HTTP Client for the Spike Forms SDK\n *\n * Provides a wrapper around fetch that handles:\n * - Authentication with Bearer token\n * - Request timeout with AbortController\n * - Query parameter encoding\n * - Error response mapping to SDK error types\n */\n\nimport {\n SpikeError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n ValidationError,\n NetworkError,\n} from './errors';\n\n/**\n * Options for HTTP requests\n */\nexport interface RequestOptions {\n /** Query parameters to append to the URL */\n params?: Record<string, string | number | boolean | undefined>;\n /** Additional headers to include in the request */\n headers?: Record<string, string>;\n}\n\n/**\n * Configuration for the HTTP client\n */\nexport interface HttpClientConfig {\n /** API key for authentication */\n apiKey: string;\n /** Base URL for API requests */\n baseUrl: string;\n /** Request timeout in milliseconds */\n timeout: number;\n}\n\n/**\n * API error response structure\n */\ninterface ApiErrorResponse {\n error?: string;\n message?: string;\n code?: string;\n details?: Record<string, unknown>;\n}\n\n/**\n * HTTP client for making authenticated requests to the Spike Forms API.\n *\n * @example\n * ```typescript\n * const http = new HttpClient({\n * apiKey: 'sk_test_123',\n * baseUrl: 'https://spike.ac',\n * timeout: 30000\n * });\n *\n * const forms = await http.get<Form[]>('/api/forms');\n * ```\n */\nexport class HttpClient {\n private readonly apiKey: string;\n private readonly baseUrl: string;\n private readonly timeout: number;\n\n constructor(config: HttpClientConfig) {\n this.apiKey = config.apiKey;\n this.baseUrl = config.baseUrl;\n this.timeout = config.timeout;\n }\n\n /**\n * Make a GET request\n */\n async get<T>(path: string, options?: RequestOptions): Promise<T> {\n return this.request<T>('GET', path, undefined, options);\n }\n\n /**\n * Make a POST request with authentication\n */\n async post<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T> {\n return this.request<T>('POST', path, body, options);\n }\n\n /**\n * Make a PATCH request\n */\n async patch<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T> {\n return this.request<T>('PATCH', path, body, options);\n }\n\n /**\n * Make a PUT request\n */\n async put<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T> {\n return this.request<T>('PUT', path, body, options);\n }\n\n /**\n * Make a DELETE request\n */\n async delete<T>(path: string, options?: RequestOptions): Promise<T> {\n return this.request<T>('DELETE', path, undefined, options);\n }\n\n /**\n * Make a POST request without authentication (for public form submissions)\n */\n async postPublic<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T> {\n return this.request<T>('POST', path, body, options, false);\n }\n\n /**\n * Build a URL with query parameters\n */\n buildUrl(path: string, params?: Record<string, string | number | boolean | undefined>): string {\n const url = new URL(path, this.baseUrl);\n\n if (params) {\n for (const [key, value] of Object.entries(params)) {\n // Omit undefined parameters\n if (value !== undefined) {\n url.searchParams.append(key, String(value));\n }\n }\n }\n\n return url.toString();\n }\n\n /**\n * Make an HTTP request with timeout and error handling\n */\n private async request<T>(\n method: string,\n path: string,\n body?: unknown,\n options?: RequestOptions,\n authenticated: boolean = true\n ): Promise<T> {\n const url = this.buildUrl(path, options?.params);\n\n // Set up timeout with AbortController\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), this.timeout);\n\n try {\n const headers: Record<string, string> = {\n ...options?.headers,\n };\n\n // Add Authorization header for authenticated requests\n if (authenticated) {\n headers['Authorization'] = `Bearer ${this.apiKey}`;\n }\n\n // Add Content-Type header for requests with JSON bodies\n if (body !== undefined) {\n headers['Content-Type'] = 'application/json';\n }\n\n const response = await fetch(url, {\n method,\n headers,\n body: body !== undefined ? JSON.stringify(body) : undefined,\n signal: controller.signal,\n });\n\n // Clear the timeout since request completed\n clearTimeout(timeoutId);\n\n // Handle error responses\n if (!response.ok) {\n await this.handleErrorResponse(response);\n }\n\n // Parse and return successful response\n // Handle empty responses (e.g., 204 No Content)\n const text = await response.text();\n if (!text) {\n return {} as T;\n }\n\n return JSON.parse(text) as T;\n } catch (error) {\n // Clear the timeout on error\n clearTimeout(timeoutId);\n\n // Handle abort (timeout)\n if (error instanceof Error && error.name === 'AbortError') {\n throw new NetworkError(`Request timeout after ${this.timeout}ms`);\n }\n\n // Re-throw SDK errors\n if (error instanceof SpikeError) {\n throw error;\n }\n\n // Wrap other errors as NetworkError\n if (error instanceof Error) {\n throw new NetworkError(error.message);\n }\n\n throw new NetworkError('An unknown network error occurred');\n }\n }\n\n /**\n * Handle error responses and throw appropriate SDK errors\n */\n private async handleErrorResponse(response: Response): Promise<never> {\n let errorData: ApiErrorResponse = {};\n const requestId = response.headers.get('x-request-id') ?? undefined;\n\n try {\n const text = await response.text();\n if (text) {\n errorData = JSON.parse(text);\n }\n } catch {\n // If we can't parse the error response, use status text\n }\n\n const message = errorData.error || errorData.message || response.statusText || 'Request failed';\n const code = errorData.code;\n\n switch (response.status) {\n case 400:\n throw new ValidationError(message, {\n code,\n requestId,\n details: errorData.details,\n });\n\n case 401:\n throw new AuthenticationError(message, {\n code,\n requestId,\n });\n\n case 404:\n throw new NotFoundError(message, {\n code,\n requestId,\n });\n\n case 429: {\n const retryAfterHeader = response.headers.get('Retry-After');\n const retryAfter = retryAfterHeader ? parseInt(retryAfterHeader, 10) : undefined;\n\n throw new RateLimitError(message, {\n code,\n requestId,\n retryAfter: Number.isNaN(retryAfter) ? undefined : retryAfter,\n });\n }\n\n default:\n throw new SpikeError(message, {\n statusCode: response.status,\n code,\n requestId,\n });\n }\n }\n}\n","/**\n * Forms Resource for the Spike Forms SDK\n *\n * Provides methods for managing forms:\n * - list: Get all forms with pagination support\n * - create: Create a new form\n * - get: Retrieve a single form by ID\n * - update: Update form properties\n * - delete: Delete a form by ID\n * - submit: Submit data to a form (public, no auth required)\n * - getHtml: Get the HTML template for a form\n * - saveHtml: Save HTML template for a form\n *\n * @module resources/forms\n */\n\nimport { HttpClient } from '../http';\nimport {\n Form,\n ListFormsParams,\n CreateFormRequest,\n UpdateFormRequest,\n SuccessResponse,\n SubmissionResponse,\n} from '../types';\n\n/**\n * Response type for getHtml method.\n */\nexport interface FormHtmlResponse {\n html: string;\n}\n\n/**\n * Response type for saveHtml method.\n */\nexport interface SaveFormHtmlResponse {\n success: boolean;\n html_url: string | null;\n}\n\n/**\n * Resource class for managing forms in Spike Forms.\n *\n * @example\n * ```typescript\n * // List all forms\n * const forms = await client.forms.list({ limit: 10 });\n *\n * // Create a new form\n * const form = await client.forms.create({ name: 'Contact Form' });\n *\n * // Get a specific form\n * const form = await client.forms.get('form_123');\n *\n * // Update a form\n * const updated = await client.forms.update('form_123', { name: 'New Name' });\n *\n * // Delete a form\n * await client.forms.delete('form_123');\n *\n * // Submit to a form (public, no auth)\n * const result = await client.forms.submit('my-form-slug', { email: 'user@example.com' });\n *\n * // Get form HTML template\n * const { html } = await client.forms.getHtml('form_123');\n *\n * // Save form HTML template\n * await client.forms.saveHtml('form_123', '<html>...</html>');\n * ```\n */\nexport class FormsResource {\n private readonly http: HttpClient;\n\n /**\n * Create a new FormsResource instance\n * @param http - The HTTP client to use for API requests\n */\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /**\n * List all forms with optional pagination and filtering.\n *\n * @param params - Optional parameters for filtering and pagination\n * @param params.limit - Maximum number of forms to return\n * @param params.offset - Number of forms to skip for pagination\n * @param params.project_id - Filter forms by project ID\n * @param params.include_inactive - Include inactive forms in the results\n * @returns Promise resolving to an array of forms\n *\n * @example\n * ```typescript\n * // Get all forms\n * const forms = await client.forms.list();\n *\n * // Get forms with pagination\n * const forms = await client.forms.list({ limit: 10, offset: 20 });\n *\n * // Get forms for a specific project\n * const forms = await client.forms.list({ project_id: 'proj_123' });\n *\n * // Include inactive forms\n * const forms = await client.forms.list({ include_inactive: true });\n * ```\n *\n * @see Requirements 4.1\n */\n async list(params?: ListFormsParams): Promise<Form[]> {\n return this.http.get<Form[]>('/forms', {\n params: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * Create a new form.\n *\n * @param data - The form data to create\n * @param data.name - Display name for the form (required)\n * @param data.project_id - ID of the project to add the form to (optional)\n * @returns Promise resolving to the created form\n *\n * @example\n * ```typescript\n * // Create a simple form\n * const form = await client.forms.create({ name: 'Contact Form' });\n *\n * // Create a form in a project\n * const form = await client.forms.create({\n * name: 'Feedback Form',\n * project_id: 'proj_123'\n * });\n * ```\n *\n * @see Requirements 4.2\n */\n async create(data: CreateFormRequest): Promise<Form> {\n return this.http.post<Form>('/forms', data);\n }\n\n /**\n * Get a single form by ID.\n *\n * @param id - The unique identifier of the form\n * @returns Promise resolving to the form\n * @throws NotFoundError if the form does not exist\n *\n * @example\n * ```typescript\n * const form = await client.forms.get('form_123');\n * console.log(form.name, form.submission_count);\n * ```\n *\n * @see Requirements 4.3\n */\n async get(id: string): Promise<Form> {\n return this.http.get<Form>(`/forms/${id}`);\n }\n\n /**\n * Update a form's properties.\n *\n * @param id - The unique identifier of the form to update\n * @param data - The properties to update\n * @param data.name - New display name for the form\n * @param data.project_id - ID of the project to move the form to (or null to remove from project)\n * @param data.is_active - Whether the form should be active\n * @returns Promise resolving to the updated form\n * @throws NotFoundError if the form does not exist\n *\n * @example\n * ```typescript\n * // Update form name\n * const form = await client.forms.update('form_123', { name: 'New Name' });\n *\n * // Deactivate a form\n * const form = await client.forms.update('form_123', { is_active: false });\n *\n * // Move form to a different project\n * const form = await client.forms.update('form_123', { project_id: 'proj_456' });\n * ```\n *\n * @see Requirements 4.4\n */\n async update(id: string, data: UpdateFormRequest): Promise<Form> {\n return this.http.patch<Form>(`/forms/${id}`, data);\n }\n\n /**\n * Delete a form by ID.\n *\n * @param id - The unique identifier of the form to delete\n * @returns Promise resolving to a success response\n * @throws NotFoundError if the form does not exist\n *\n * @example\n * ```typescript\n * await client.forms.delete('form_123');\n * ```\n *\n * @see Requirements 4.5\n */\n async delete(id: string): Promise<SuccessResponse> {\n return this.http.delete<SuccessResponse>(`/forms/${id}`);\n }\n\n /**\n * Submit data to a form. This is a public endpoint that does not require authentication.\n *\n * @param slug - The URL-friendly slug of the form\n * @param data - The form data to submit as key-value pairs\n * @returns Promise resolving to the submission response\n * @throws NotFoundError if the form does not exist\n * @throws ValidationError if the form is inactive or data is invalid\n *\n * @example\n * ```typescript\n * // Submit to a contact form\n * const result = await client.forms.submit('contact-form', {\n * name: 'John Doe',\n * email: 'john@example.com',\n * message: 'Hello!'\n * });\n *\n * if (result.success) {\n * console.log('Submission ID:', result.submission_id);\n * }\n * ```\n *\n * @see Requirements 4.6\n */\n async submit(slug: string, data: Record<string, unknown>): Promise<SubmissionResponse> {\n return this.http.postPublic<SubmissionResponse>(`/f/${slug}`, data);\n }\n\n /**\n * Get the HTML template for a form.\n *\n * Returns the stored HTML from S3 or a default template if none exists.\n *\n * @param id - The unique identifier of the form\n * @returns Promise resolving to the HTML content\n * @throws NotFoundError if the form does not exist\n *\n * @example\n * ```typescript\n * const { html } = await client.forms.getHtml('form_123');\n * console.log(html);\n * ```\n */\n async getHtml(id: string): Promise<FormHtmlResponse> {\n return this.http.get<FormHtmlResponse>(`/forms/${id}/html`);\n }\n\n /**\n * Save HTML template for a form to S3 storage.\n *\n * @param id - The unique identifier of the form\n * @param html - The HTML content to save\n * @returns Promise resolving to the save response with the S3 URL\n * @throws NotFoundError if the form does not exist\n *\n * @example\n * ```typescript\n * const result = await client.forms.saveHtml('form_123', '<html>...</html>');\n * if (result.success) {\n * console.log('Saved to:', result.html_url);\n * }\n * ```\n */\n async saveHtml(id: string, html: string): Promise<SaveFormHtmlResponse> {\n return this.http.put<SaveFormHtmlResponse>(`/forms/${id}/html`, { html });\n }\n}\n","/**\n * Submissions Resource for the Spike Forms SDK\n *\n * Provides methods for managing form submissions:\n * - list: Get submissions with filtering options\n * - getStats: Get submission statistics for a form\n * - export: Export all submissions as JSON\n * - bulkUpdate: Perform batch operations on submissions\n * - bulkDelete: Delete multiple submissions\n *\n * @module resources/submissions\n */\n\nimport { HttpClient } from '../http';\nimport {\n Submission,\n SubmissionStats,\n ListSubmissionsParams,\n BulkUpdateRequest,\n SuccessResponse,\n} from '../types';\n\n/**\n * Resource class for managing form submissions in Spike Forms.\n *\n * @example\n * ```typescript\n * // List submissions for a form\n * const submissions = await client.submissions.list('form_123', { limit: 10 });\n *\n * // Get submission statistics\n * const stats = await client.submissions.getStats('form_123');\n *\n * // Export all submissions\n * const allSubmissions = await client.submissions.export('form_123');\n *\n * // Bulk update submissions\n * await client.submissions.bulkUpdate('form_123', {\n * action: 'markRead',\n * submission_ids: ['sub_1', 'sub_2']\n * });\n *\n * // Bulk delete submissions\n * await client.submissions.bulkDelete('form_123', ['sub_1', 'sub_2']);\n * ```\n */\nexport class SubmissionsResource {\n private readonly http: HttpClient;\n\n /**\n * Create a new SubmissionsResource instance\n * @param http - The HTTP client to use for API requests\n */\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /**\n * List submissions for a form with optional filtering and pagination.\n *\n * @param formId - The unique identifier of the form\n * @param params - Optional parameters for filtering and pagination\n * @param params.limit - Maximum number of submissions to return\n * @param params.offset - Number of submissions to skip for pagination\n * @param params.since - Only return submissions created after this ISO 8601 timestamp\n * @param params.order - Sort order for submissions ('asc' or 'desc')\n * @param params.filter - Filter string for searching submissions\n * @param params.is_spam - Filter by spam status\n * @param params.is_read - Filter by read status\n * @returns Promise resolving to an array of submissions\n * @throws NotFoundError if the form does not exist\n *\n * @example\n * ```typescript\n * // Get all submissions for a form\n * const submissions = await client.submissions.list('form_123');\n *\n * // Get submissions with pagination\n * const submissions = await client.submissions.list('form_123', {\n * limit: 10,\n * offset: 20\n * });\n *\n * // Get unread submissions\n * const unread = await client.submissions.list('form_123', {\n * is_read: false\n * });\n *\n * // Get non-spam submissions since a date\n * const recent = await client.submissions.list('form_123', {\n * since: '2024-01-01T00:00:00Z',\n * is_spam: false,\n * order: 'desc'\n * });\n *\n * // Search submissions\n * const filtered = await client.submissions.list('form_123', {\n * filter: 'john@example.com'\n * });\n * ```\n *\n * @see Requirements 5.1\n */\n async list(formId: string, params?: ListSubmissionsParams): Promise<Submission[]> {\n return this.http.get<Submission[]>(`/forms/${formId}/submissions`, {\n params: params as Record<string, string | number | boolean | undefined>,\n });\n }\n\n /**\n * Get submission statistics for a form.\n *\n * @param formId - The unique identifier of the form\n * @returns Promise resolving to submission statistics\n * @throws NotFoundError if the form does not exist\n *\n * @example\n * ```typescript\n * const stats = await client.submissions.getStats('form_123');\n * console.log(`Total: ${stats.total}, Unread: ${stats.unread}, Spam: ${stats.spam}`);\n * console.log(`Today: ${stats.today}, This week: ${stats.this_week}`);\n * ```\n *\n * @see Requirements 5.2\n */\n async getStats(formId: string): Promise<SubmissionStats> {\n return this.http.get<SubmissionStats>(`/forms/${formId}/submissions/stats`);\n }\n\n /**\n * Export all submissions for a form as JSON.\n *\n * @param formId - The unique identifier of the form\n * @returns Promise resolving to an array of all submissions\n * @throws NotFoundError if the form does not exist\n *\n * @example\n * ```typescript\n * // Export all submissions\n * const allSubmissions = await client.submissions.export('form_123');\n *\n * // Process exported data\n * for (const submission of allSubmissions) {\n * console.log(submission.data);\n * }\n * ```\n *\n * @see Requirements 5.3\n */\n async export(formId: string): Promise<Submission[]> {\n return this.http.get<Submission[]>(`/forms/${formId}/submissions/export`);\n }\n\n /**\n * Perform a bulk update operation on multiple submissions.\n *\n * @param formId - The unique identifier of the form\n * @param data - The bulk update request\n * @param data.action - The action to perform ('markRead', 'markUnread', 'star', 'unstar', 'markSpam', 'notSpam')\n * @param data.submission_ids - Array of submission IDs to update\n * @returns Promise resolving to a success response\n * @throws NotFoundError if the form does not exist\n * @throws ValidationError if the action is invalid or submission IDs are empty\n *\n * @example\n * ```typescript\n * // Mark submissions as read\n * await client.submissions.bulkUpdate('form_123', {\n * action: 'markRead',\n * submission_ids: ['sub_1', 'sub_2', 'sub_3']\n * });\n *\n * // Star submissions\n * await client.submissions.bulkUpdate('form_123', {\n * action: 'star',\n * submission_ids: ['sub_1']\n * });\n *\n * // Mark submissions as spam\n * await client.submissions.bulkUpdate('form_123', {\n * action: 'markSpam',\n * submission_ids: ['sub_4', 'sub_5']\n * });\n *\n * // Mark submissions as not spam\n * await client.submissions.bulkUpdate('form_123', {\n * action: 'notSpam',\n * submission_ids: ['sub_6']\n * });\n * ```\n *\n * @see Requirements 5.4\n */\n async bulkUpdate(formId: string, data: BulkUpdateRequest): Promise<SuccessResponse> {\n return this.http.post<SuccessResponse>(`/forms/${formId}/submissions/bulk`, data);\n }\n\n /**\n * Delete multiple submissions from a form.\n *\n * @param formId - The unique identifier of the form\n * @param submissionIds - Array of submission IDs to delete\n * @returns Promise resolving to a success response\n * @throws NotFoundError if the form does not exist\n * @throws ValidationError if submission IDs are empty\n *\n * @example\n * ```typescript\n * // Delete multiple submissions\n * await client.submissions.bulkDelete('form_123', ['sub_1', 'sub_2', 'sub_3']);\n * ```\n *\n * @see Requirements 5.5\n */\n async bulkDelete(formId: string, submissionIds: string[]): Promise<SuccessResponse> {\n return this.http.delete<SuccessResponse>(`/forms/${formId}/submissions/bulk`, {\n params: {\n ids: submissionIds.join(','),\n },\n });\n }\n}\n","/**\n * Rules Resource for the Spike Forms SDK\n *\n * Provides methods for managing form rules:\n * - list: Get all rules for a form\n * - create: Create a new rule for a form\n * - update: Update a rule by ID\n * - delete: Delete a rule by ID\n *\n * @module resources/rules\n */\n\nimport { HttpClient } from '../http';\nimport {\n Rule,\n CreateRuleRequest,\n UpdateRuleRequest,\n SuccessResponse,\n} from '../types';\n\n/**\n * Resource class for managing form rules in Spike Forms.\n *\n * Rules allow you to configure conditional routing and processing for form submissions.\n * Each rule consists of conditions that must be met and actions to take when they are.\n *\n * @example\n * ```typescript\n * // List all rules for a form\n * const rules = await client.rules.list('form_123');\n *\n * // Create a new rule\n * const rule = await client.rules.create('form_123', {\n * name: 'Email notification',\n * conditions: [{ field: 'email', operator: 'contains', value: '@company.com' }],\n * actions: [{ type: 'email', config: { to: 'team@company.com' } }]\n * });\n *\n * // Update a rule\n * const updated = await client.rules.update('form_123', 'rule_456', {\n * is_active: false\n * });\n *\n * // Delete a rule\n * await client.rules.delete('form_123', 'rule_456');\n * ```\n */\nexport class RulesResource {\n private readonly http: HttpClient;\n\n /**\n * Create a new RulesResource instance\n * @param http - The HTTP client to use for API requests\n */\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /**\n * List all rules for a form.\n *\n * @param formId - The unique identifier of the form\n * @returns Promise resolving to an array of rules\n * @throws NotFoundError if the form does not exist\n *\n * @example\n * ```typescript\n * // Get all rules for a form\n * const rules = await client.rules.list('form_123');\n *\n * // Filter active rules\n * const activeRules = rules.filter(rule => rule.is_active);\n *\n * // Check rule conditions\n * for (const rule of rules) {\n * console.log(`Rule: ${rule.name}, Conditions: ${rule.conditions.length}`);\n * }\n * ```\n *\n * @see Requirements 6.1\n */\n async list(formId: string): Promise<Rule[]> {\n return this.http.get<Rule[]>(`/forms/${formId}/rules`);\n }\n\n /**\n * Create a new rule for a form.\n *\n * @param formId - The unique identifier of the form\n * @param data - The rule data to create\n * @param data.name - Display name for the rule (required)\n * @param data.conditions - Array of conditions that must be met (required)\n * @param data.actions - Array of actions to take when conditions are met (required)\n * @param data.is_active - Whether the rule should be active (defaults to true)\n * @returns Promise resolving to the created rule\n * @throws NotFoundError if the form does not exist\n * @throws ValidationError if the rule data is invalid\n *\n * @example\n * ```typescript\n * // Create a simple email notification rule\n * const rule = await client.rules.create('form_123', {\n * name: 'Notify on VIP submission',\n * conditions: [\n * { field: 'email', operator: 'ends_with', value: '@vip.com' }\n * ],\n * actions: [\n * { type: 'email', config: { to: 'sales@company.com', subject: 'VIP Lead!' } }\n * ]\n * });\n *\n * // Create a webhook rule with multiple conditions\n * const webhookRule = await client.rules.create('form_123', {\n * name: 'Send to CRM',\n * conditions: [\n * { field: 'type', operator: 'equals', value: 'enterprise' },\n * { field: 'budget', operator: 'contains', value: '10000' }\n * ],\n * actions: [\n * { type: 'webhook', config: { url: 'https://crm.example.com/leads' } }\n * ],\n * is_active: true\n * });\n *\n * // Create an inactive rule (for testing)\n * const testRule = await client.rules.create('form_123', {\n * name: 'Test Rule',\n * conditions: [{ field: 'test', operator: 'equals', value: 'true' }],\n * actions: [{ type: 'slack', config: { channel: '#test' } }],\n * is_active: false\n * });\n * ```\n *\n * @see Requirements 6.2\n */\n async create(formId: string, data: CreateRuleRequest): Promise<Rule> {\n return this.http.post<Rule>(`/forms/${formId}/rules`, data);\n }\n\n /**\n * Update a rule's properties.\n *\n * @param formId - The unique identifier of the form\n * @param ruleId - The unique identifier of the rule to update\n * @param data - The properties to update\n * @param data.name - New display name for the rule\n * @param data.conditions - New conditions for the rule\n * @param data.actions - New actions for the rule\n * @param data.is_active - Whether the rule should be active\n * @returns Promise resolving to the updated rule\n * @throws NotFoundError if the form or rule does not exist\n * @throws ValidationError if the update data is invalid\n *\n * @example\n * ```typescript\n * // Update rule name\n * const rule = await client.rules.update('form_123', 'rule_456', {\n * name: 'Updated Rule Name'\n * });\n *\n * // Deactivate a rule\n * const rule = await client.rules.update('form_123', 'rule_456', {\n * is_active: false\n * });\n *\n * // Update conditions\n * const rule = await client.rules.update('form_123', 'rule_456', {\n * conditions: [\n * { field: 'email', operator: 'contains', value: '@newdomain.com' }\n * ]\n * });\n *\n * // Update actions\n * const rule = await client.rules.update('form_123', 'rule_456', {\n * actions: [\n * { type: 'discord', config: { webhook_url: 'https://discord.com/api/webhooks/...' } }\n * ]\n * });\n *\n * // Update multiple properties at once\n * const rule = await client.rules.update('form_123', 'rule_456', {\n * name: 'New Name',\n * is_active: true,\n * conditions: [{ field: 'status', operator: 'equals', value: 'urgent' }],\n * actions: [{ type: 'email', config: { to: 'urgent@company.com' } }]\n * });\n * ```\n *\n * @see Requirements 6.3\n */\n async update(formId: string, ruleId: string, data: UpdateRuleRequest): Promise<Rule> {\n return this.http.patch<Rule>(`/forms/${formId}/rules/${ruleId}`, data);\n }\n\n /**\n * Delete a rule by ID.\n *\n * @param formId - The unique identifier of the form\n * @param ruleId - The unique identifier of the rule to delete\n * @returns Promise resolving to a success response\n * @throws NotFoundError if the form or rule does not exist\n *\n * @example\n * ```typescript\n * // Delete a rule\n * await client.rules.delete('form_123', 'rule_456');\n *\n * // Delete multiple rules\n * const ruleIds = ['rule_1', 'rule_2', 'rule_3'];\n * for (const ruleId of ruleIds) {\n * await client.rules.delete('form_123', ruleId);\n * }\n * ```\n *\n * @see Requirements 6.4\n */\n async delete(formId: string, ruleId: string): Promise<SuccessResponse> {\n return this.http.delete<SuccessResponse>(`/forms/${formId}/rules/${ruleId}`);\n }\n}\n","/**\n * Projects Resource for the Spike Forms SDK\n *\n * Provides methods for managing projects:\n * - list: Get all projects\n * - create: Create a new project\n * - get: Retrieve a single project by ID\n * - update: Update project properties\n * - delete: Delete a project by ID\n *\n * @module resources/projects\n */\n\nimport { HttpClient } from '../http';\nimport {\n Project,\n CreateProjectRequest,\n UpdateProjectRequest,\n SuccessResponse,\n} from '../types';\n\n/**\n * Resource class for managing projects in Spike Forms.\n *\n * Projects are used to organize forms into logical groups.\n *\n * @example\n * ```typescript\n * // List all projects\n * const projects = await client.projects.list();\n *\n * // Create a new project\n * const project = await client.projects.create({ name: 'Marketing Forms' });\n *\n * // Get a specific project\n * const project = await client.projects.get('proj_123');\n *\n * // Update a project\n * const updated = await client.projects.update('proj_123', { name: 'New Name' });\n *\n * // Delete a project\n * await client.projects.delete('proj_123');\n * ```\n */\nexport class ProjectsResource {\n private readonly http: HttpClient;\n\n /**\n * Create a new ProjectsResource instance\n * @param http - The HTTP client to use for API requests\n */\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /**\n * List all projects.\n *\n * @returns Promise resolving to an array of projects\n *\n * @example\n * ```typescript\n * const projects = await client.projects.list();\n * console.log(`Found ${projects.length} projects`);\n * ```\n *\n * @see Requirements 7.1\n */\n async list(): Promise<Project[]> {\n const response = await this.http.get<{ projects: Project[]; total: number }>('/projects');\n return response.projects;\n }\n\n /**\n * Create a new project.\n *\n * @param data - The project data to create\n * @param data.name - Display name for the project (required)\n * @returns Promise resolving to the created project\n *\n * @example\n * ```typescript\n * const project = await client.projects.create({ name: 'Marketing Forms' });\n * console.log('Created project:', project.id);\n * ```\n *\n * @see Requirements 7.2\n */\n async create(data: CreateProjectRequest): Promise<Project> {\n return this.http.post<Project>('/projects', data);\n }\n\n /**\n * Get a single project by ID.\n *\n * @param id - The unique identifier of the project\n * @returns Promise resolving to the project\n * @throws NotFoundError if the project does not exist\n *\n * @example\n * ```typescript\n * const project = await client.projects.get('proj_123');\n * console.log(project.name, project.form_count);\n * ```\n *\n * @see Requirements 7.3\n */\n async get(id: string): Promise<Project> {\n return this.http.get<Project>(`/projects/${id}`);\n }\n\n /**\n * Update a project's properties.\n *\n * @param id - The unique identifier of the project to update\n * @param data - The properties to update\n * @param data.name - New display name for the project\n * @returns Promise resolving to the updated project\n * @throws NotFoundError if the project does not exist\n *\n * @example\n * ```typescript\n * const project = await client.projects.update('proj_123', { name: 'New Name' });\n * console.log('Updated project:', project.name);\n * ```\n *\n * @see Requirements 7.4\n */\n async update(id: string, data: UpdateProjectRequest): Promise<Project> {\n return this.http.patch<Project>(`/projects/${id}`, data);\n }\n\n /**\n * Delete a project by ID.\n *\n * @param id - The unique identifier of the project to delete\n * @returns Promise resolving to a success response\n * @throws NotFoundError if the project does not exist\n *\n * @example\n * ```typescript\n * await client.projects.delete('proj_123');\n * ```\n *\n * @see Requirements 7.5\n */\n async delete(id: string): Promise<SuccessResponse> {\n return this.http.delete<SuccessResponse>(`/projects/${id}`);\n }\n}\n","/**\n * Teams Resource for the Spike Forms SDK\n *\n * Provides methods for managing teams and team collaboration:\n * - list: Get all teams\n * - create: Create a new team\n * - get: Retrieve a single team by ID\n * - update: Update team properties\n * - delete: Delete a team by ID\n * - listMembers: Get all members of a team\n * - addMember: Add a user to a team\n * - updateMember: Update a member's role\n * - removeMember: Remove a member from a team\n * - listInvitations: Get pending invitations for a team\n * - invite: Create a new invitation\n * - cancelInvitation: Cancel a pending invitation\n * - acceptInvitation: Accept an invitation\n *\n * @module resources/teams\n */\n\nimport { HttpClient } from '../http';\nimport {\n Team,\n TeamMember,\n TeamInvitation,\n CreateTeamRequest,\n UpdateTeamRequest,\n InviteMemberRequest,\n UpdateMemberRequest,\n SuccessResponse,\n} from '../types';\n\n/**\n * Resource class for managing teams in Spike Forms.\n *\n * Teams enable collaborative form management with role-based access control.\n *\n * @example\n * ```typescript\n * // List all teams\n * const teams = await client.teams.list();\n *\n * // Create a new team\n * const team = await client.teams.create({ name: 'Marketing Team' });\n *\n * // Get a specific team\n * const team = await client.teams.get('team_123');\n *\n * // Update a team\n * const updated = await client.teams.update('team_123', { name: 'New Name' });\n *\n * // Delete a team\n * await client.teams.delete('team_123');\n *\n * // Manage team members\n * const members = await client.teams.listMembers('team_123');\n * await client.teams.invite('team_123', { email: 'user@example.com', role: 'member' });\n * ```\n */\nexport class TeamsResource {\n private readonly http: HttpClient;\n\n /**\n * Create a new TeamsResource instance\n * @param http - The HTTP client to use for API requests\n */\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /**\n * List all teams.\n *\n * @returns Promise resolving to an array of teams\n *\n * @example\n * ```typescript\n * const teams = await client.teams.list();\n * console.log(`Found ${teams.length} teams`);\n * ```\n *\n * @see Requirements 8.1\n */\n async list(): Promise<Team[]> {\n return this.http.get<Team[]>('/teams');\n }\n\n /**\n * Create a new team.\n *\n * @param data - The team data to create\n * @param data.name - Display name for the team (required)\n * @returns Promise resolving to the created team\n *\n * @example\n * ```typescript\n * const team = await client.teams.create({ name: 'Marketing Team' });\n * console.log('Created team:', team.id);\n * ```\n *\n * @see Requirements 8.2\n */\n async create(data: CreateTeamRequest): Promise<Team> {\n return this.http.post<Team>('/teams', data);\n }\n\n /**\n * Get a single team by ID.\n *\n * @param id - The unique identifier of the team\n * @returns Promise resolving to the team\n * @throws NotFoundError if the team does not exist\n *\n * @example\n * ```typescript\n * const team = await client.teams.get('team_123');\n * console.log(team.name, team.member_count);\n * ```\n *\n * @see Requirements 8.3\n */\n async get(id: string): Promise<Team> {\n return this.http.get<Team>(`/teams/${id}`);\n }\n\n /**\n * Update a team's properties.\n *\n * @param id - The unique identifier of the team to update\n * @param data - The properties to update\n * @param data.name - New display name for the team\n * @returns Promise resolving to the updated team\n * @throws NotFoundError if the team does not exist\n *\n * @example\n * ```typescript\n * const team = await client.teams.update('team_123', { name: 'New Name' });\n * console.log('Updated team:', team.name);\n * ```\n *\n * @see Requirements 8.4\n */\n async update(id: string, data: UpdateTeamRequest): Promise<Team> {\n return this.http.patch<Team>(`/teams/${id}`, data);\n }\n\n /**\n * Delete a team by ID.\n *\n * @param id - The unique identifier of the team to delete\n * @returns Promise resolving to a success response\n * @throws NotFoundError if the team does not exist\n *\n * @example\n * ```typescript\n * await client.teams.delete('team_123');\n * ```\n *\n * @see Requirements 8.5\n */\n async delete(id: string): Promise<SuccessResponse> {\n return this.http.delete<SuccessResponse>(`/teams/${id}`);\n }\n\n /**\n * List all members of a team.\n *\n * @param teamId - The unique identifier of the team\n * @returns Promise resolving to an array of team members\n * @throws NotFoundError if the team does not exist\n *\n * @example\n * ```typescript\n * const members = await client.teams.listMembers('team_123');\n * members.forEach(member => {\n * console.log(`${member.user.name} (${member.role})`);\n * });\n * ```\n *\n * @see Requirements 8.6\n */\n async listMembers(teamId: string): Promise<TeamMember[]> {\n return this.http.get<TeamMember[]>(`/teams/${teamId}/members`);\n }\n\n /**\n * Add a user to a team.\n *\n * @param teamId - The unique identifier of the team\n * @param data - The member data\n * @param data.email - Email address of the user to add\n * @param data.role - Role to assign ('admin' or 'member')\n * @returns Promise resolving to the created team member\n * @throws NotFoundError if the team does not exist\n * @throws ValidationError if the user is already a member\n *\n * @example\n * ```typescript\n * const member = await client.teams.addMember('team_123', {\n * email: 'user@example.com',\n * role: 'member'\n * });\n * console.log('Added member:', member.user.name);\n * ```\n *\n * @see Requirements 8.7\n */\n async addMember(teamId: string, data: InviteMemberRequest): Promise<TeamMember> {\n return this.http.post<TeamMember>(`/teams/${teamId}/members`, data);\n }\n\n /**\n * Update a team member's role.\n *\n * @param teamId - The unique identifier of the team\n * @param memberId - The unique identifier of the team member\n * @param data - The properties to update\n * @param data.role - New role for the member ('admin' or 'member')\n * @returns Promise resolving to the updated team member\n * @throws NotFoundError if the team or member does not exist\n *\n * @example\n * ```typescript\n * const member = await client.teams.updateMember('team_123', 'member_456', {\n * role: 'admin'\n * });\n * console.log('Updated role to:', member.role);\n * ```\n *\n * @see Requirements 8.8\n */\n async updateMember(\n teamId: string,\n memberId: string,\n data: UpdateMemberRequest\n ): Promise<TeamMember> {\n return this.http.patch<TeamMember>(`/teams/${teamId}/members/${memberId}`, data);\n }\n\n /**\n * Remove a member from a team.\n *\n * @param teamId - The unique identifier of the team\n * @param memberId - The unique identifier of the team member to remove\n * @returns Promise resolving to a success response\n * @throws NotFoundError if the team or member does not exist\n *\n * @example\n * ```typescript\n * await client.teams.removeMember('team_123', 'member_456');\n * ```\n *\n * @see Requirements 8.9\n */\n async removeMember(teamId: string, memberId: string): Promise<SuccessResponse> {\n return this.http.delete<SuccessResponse>(`/teams/${teamId}/members/${memberId}`);\n }\n\n /**\n * List all pending invitations for a team.\n *\n * @param teamId - The unique identifier of the team\n * @returns Promise resolving to an array of pending invitations\n * @throws NotFoundError if the team does not exist\n *\n * @example\n * ```typescript\n * const invitations = await client.teams.listInvitations('team_123');\n * invitations.forEach(inv => {\n * console.log(`${inv.email} invited as ${inv.role}`);\n * });\n * ```\n *\n * @see Requirements 8.10\n */\n async listInvitations(teamId: string): Promise<TeamInvitation[]> {\n return this.http.get<TeamInvitation[]>(`/teams/${teamId}/invitations`);\n }\n\n /**\n * Create a new invitation to join a team.\n *\n * @param teamId - The unique identifier of the team\n * @param data - The invitation data\n * @param data.email - Email address of the person to invite\n * @param data.role - Role to assign upon acceptance ('admin' or 'member')\n * @returns Promise resolving to the created invitation\n * @throws NotFoundError if the team does not exist\n * @throws ValidationError if an invitation already exists for this email\n *\n * @example\n * ```typescript\n * const invitation = await client.teams.invite('team_123', {\n * email: 'newuser@example.com',\n * role: 'member'\n * });\n * console.log('Invitation token:', invitation.token);\n * ```\n *\n * @see Requirements 8.11\n */\n async invite(teamId: string, data: InviteMemberRequest): Promise<TeamInvitation> {\n return this.http.post<TeamInvitation>(`/teams/${teamId}/invitations`, data);\n }\n\n /**\n * Cancel a pending invitation.\n *\n * @param teamId - The unique identifier of the team\n * @param invitationId - The unique identifier of the invitation to cancel\n * @returns Promise resolving to a success response\n * @throws NotFoundError if the team or invitation does not exist\n *\n * @example\n * ```typescript\n * await client.teams.cancelInvitation('team_123', 'inv_456');\n * ```\n *\n * @see Requirements 8.12\n */\n async cancelInvitation(teamId: string, invitationId: string): Promise<SuccessResponse> {\n return this.http.delete<SuccessResponse>(`/teams/${teamId}/invitations/${invitationId}`);\n }\n\n /**\n * Accept a team invitation using the invitation token.\n *\n * @param token - The unique invitation token\n * @returns Promise resolving to a success response\n * @throws NotFoundError if the invitation does not exist or has expired\n *\n * @example\n * ```typescript\n * await client.teams.acceptInvitation('inv_token_abc123');\n * ```\n *\n * @see Requirements 8.13\n */\n async acceptInvitation(token: string): Promise<SuccessResponse> {\n return this.http.post<SuccessResponse>(`/invitations/${token}/accept`);\n }\n}\n","/**\n * User Resource for the Spike Forms SDK\n *\n * Provides methods for managing user profile and security settings:\n * - get: Get the current user profile\n * - update: Update user profile properties\n * - delete: Delete the user account\n * - setup2FA: Initiate 2FA setup and get secret\n * - enable2FA: Enable 2FA with a verification code\n * - disable2FA: Disable 2FA with a verification code\n * - verify2FA: Verify a 2FA code\n * - listApiKeys: Get all user API keys\n * - createApiKey: Create a new API key\n * - deleteApiKey: Delete an API key\n *\n * @module resources/user\n */\n\nimport { HttpClient } from '../http';\nimport {\n User,\n ApiKey,\n UpdateUserRequest,\n Setup2FAResponse,\n CreateApiKeyRequest,\n SuccessResponse,\n} from '../types';\n\n/**\n * Resource class for managing user profile and security settings in Spike Forms.\n *\n * Provides access to user profile management, two-factor authentication,\n * and API key management.\n *\n * @example\n * ```typescript\n * // Get current user profile\n * const user = await client.user.get();\n *\n * // Update user profile\n * const updated = await client.user.update({ name: 'New Name' });\n *\n * // Set up 2FA\n * const setup = await client.user.setup2FA();\n * console.log('Scan QR code:', setup.qr_code);\n *\n * // Enable 2FA with verification code\n * await client.user.enable2FA('123456');\n *\n * // Manage API keys\n * const keys = await client.user.listApiKeys();\n * const newKey = await client.user.createApiKey({ name: 'My App' });\n * ```\n */\nexport class UserResource {\n private readonly http: HttpClient;\n\n /**\n * Create a new UserResource instance\n * @param http - The HTTP client to use for API requests\n */\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /**\n * Get the current user profile.\n *\n * @returns Promise resolving to the current user\n *\n * @example\n * ```typescript\n * const user = await client.user.get();\n * console.log(`Hello, ${user.name}!`);\n * console.log(`2FA enabled: ${user.two_factor_enabled}`);\n * ```\n *\n * @see Requirements 9.1\n */\n async get(): Promise<User> {\n return this.http.get<User>('/user');\n }\n\n /**\n * Update the current user's profile properties.\n *\n * @param data - The properties to update\n * @param data.name - New display name for the user\n * @param data.email - New email address for the user\n * @returns Promise resolving to the updated user\n *\n * @example\n * ```typescript\n * const user = await client.user.update({ name: 'New Name' });\n * console.log('Updated name:', user.name);\n * ```\n *\n * @see Requirements 9.2\n */\n async update(data: UpdateUserRequest): Promise<User> {\n return this.http.patch<User>('/user', data);\n }\n\n /**\n * Delete the current user's account.\n *\n * This action is irreversible and will delete all associated data.\n *\n * @returns Promise resolving to a success response\n *\n * @example\n * ```typescript\n * await client.user.delete();\n * console.log('Account deleted');\n * ```\n *\n * @see Requirements 9.3\n */\n async delete(): Promise<SuccessResponse> {\n return this.http.delete<SuccessResponse>('/user');\n }\n\n /**\n * Initiate two-factor authentication setup.\n *\n * Returns a secret and QR code for configuring an authenticator app.\n *\n * @returns Promise resolving to the 2FA setup response with secret and QR code\n *\n * @example\n * ```typescript\n * const setup = await client.user.setup2FA();\n * console.log('Secret:', setup.secret);\n * console.log('QR Code:', setup.qr_code);\n * // Display QR code to user for scanning with authenticator app\n * ```\n *\n * @see Requirements 9.4\n */\n async setup2FA(): Promise<Setup2FAResponse> {\n return this.http.post<Setup2FAResponse>('/user/2fa/setup');\n }\n\n /**\n * Enable two-factor authentication with a verification code.\n *\n * Call this after setup2FA to confirm the user has configured their\n * authenticator app correctly.\n *\n * @param code - The 6-digit verification code from the authenticator app\n * @returns Promise resolving to a success response\n * @throws ValidationError if the code is invalid\n *\n * @example\n * ```typescript\n * await client.user.enable2FA('123456');\n * console.log('2FA enabled successfully');\n * ```\n *\n * @see Requirements 9.5\n */\n async enable2FA(code: string): Promise<SuccessResponse> {\n return this.http.post<SuccessResponse>('/user/2fa/enable', { code });\n }\n\n /**\n * Disable two-factor authentication.\n *\n * Requires a valid verification code to confirm the user's identity.\n *\n * @param code - The 6-digit verification code from the authenticator app\n * @returns Promise resolving to a success response\n * @throws ValidationError if the code is invalid\n *\n * @example\n * ```typescript\n * await client.user.disable2FA('123456');\n * console.log('2FA disabled');\n * ```\n *\n * @see Requirements 9.6\n */\n async disable2FA(code: string): Promise<SuccessResponse> {\n return this.http.post<SuccessResponse>('/user/2fa/disable', { code });\n }\n\n /**\n * Verify a two-factor authentication code.\n *\n * Use this to verify a 2FA code during login or sensitive operations.\n *\n * @param code - The 6-digit verification code from the authenticator app\n * @returns Promise resolving to a success response\n * @throws ValidationError if the code is invalid\n *\n * @example\n * ```typescript\n * await client.user.verify2FA('123456');\n * console.log('2FA code verified');\n * ```\n *\n * @see Requirements 9.7\n */\n async verify2FA(code: string): Promise<SuccessResponse> {\n return this.http.post<SuccessResponse>('/user/2fa/verify', { code });\n }\n\n /**\n * List all API keys for the current user.\n *\n * Note: The `key` field will only contain the full key value when\n * the key is first created. For existing keys, it may be masked.\n *\n * @returns Promise resolving to an array of API keys\n *\n * @example\n * ```typescript\n * const keys = await client.user.listApiKeys();\n * keys.forEach(key => {\n * console.log(`${key.name}: last used ${key.last_used_at || 'never'}`);\n * });\n * ```\n *\n * @see Requirements 9.8\n */\n async listApiKeys(): Promise<ApiKey[]> {\n const response = await this.http.get<{ apiKeys: ApiKey[] }>('/user/api-keys');\n return response.apiKeys;\n }\n\n /**\n * Create a new API key.\n *\n * The returned API key will include the full key value in the `key` field.\n * This is the only time the full key is available - store it securely.\n *\n * @param data - The API key data\n * @param data.name - Display name for the API key (required)\n * @returns Promise resolving to the created API key with full key value\n *\n * @example\n * ```typescript\n * const apiKey = await client.user.createApiKey({ name: 'My Application' });\n * console.log('API Key created:', apiKey.key);\n * // Store this key securely - it won't be shown again!\n * ```\n *\n * @see Requirements 9.9\n */\n async createApiKey(data: CreateApiKeyRequest): Promise<ApiKey> {\n const response = await this.http.post<{ apiKey: ApiKey }>('/user/api-keys', data);\n return response.apiKey;\n }\n\n /**\n * Delete an API key by ID.\n *\n * @param id - The unique identifier of the API key to delete\n * @returns Promise resolving to a success response\n * @throws NotFoundError if the API key does not exist\n *\n * @example\n * ```typescript\n * await client.user.deleteApiKey('key_123');\n * console.log('API key deleted');\n * ```\n *\n * @see Requirements 9.10\n */\n async deleteApiKey(id: string): Promise<SuccessResponse> {\n return this.http.delete<SuccessResponse>(`/user/api-keys/${id}`);\n }\n}\n","/**\n * Billing Resource for the Spike Forms SDK\n *\n * Provides methods for managing billing and subscriptions:\n * - createCheckout: Create a Stripe checkout session for subscription\n * - createPortal: Create a Stripe billing portal session for managing subscription\n *\n * @module resources/billing\n */\n\nimport { HttpClient } from '../http';\nimport {\n CreateCheckoutRequest,\n CheckoutResponse,\n PortalResponse,\n} from '../types';\n\n/**\n * Resource class for managing billing and subscriptions in Spike Forms.\n *\n * Provides access to Stripe checkout and billing portal functionality\n * for managing user subscriptions.\n *\n * @example\n * ```typescript\n * // Create a checkout session for a new subscription\n * const checkout = await client.billing.createCheckout({\n * price_id: 'price_123',\n * success_url: 'https://myapp.com/success',\n * cancel_url: 'https://myapp.com/cancel'\n * });\n * // Redirect user to checkout.url\n *\n * // Create a billing portal session for managing subscription\n * const portal = await client.billing.createPortal();\n * // Redirect user to portal.url\n * ```\n */\nexport class BillingResource {\n private readonly http: HttpClient;\n\n /**\n * Create a new BillingResource instance\n * @param http - The HTTP client to use for API requests\n */\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /**\n * Create a Stripe checkout session for starting a new subscription.\n *\n * Returns a URL that the user should be redirected to in order to\n * complete the checkout process on Stripe's hosted checkout page.\n *\n * @param data - The checkout session configuration\n * @param data.price_id - The Stripe price ID for the subscription plan\n * @param data.success_url - URL to redirect to after successful checkout\n * @param data.cancel_url - URL to redirect to if checkout is cancelled\n * @returns Promise resolving to the checkout response with redirect URL\n *\n * @example\n * ```typescript\n * const checkout = await client.billing.createCheckout({\n * price_id: 'price_1234567890',\n * success_url: 'https://myapp.com/checkout/success',\n * cancel_url: 'https://myapp.com/checkout/cancel'\n * });\n *\n * // Redirect the user to complete checkout\n * window.location.href = checkout.url;\n * ```\n *\n * @see Requirements 10.1\n */\n async createCheckout(data: CreateCheckoutRequest): Promise<CheckoutResponse> {\n return this.http.post<CheckoutResponse>('/billing/checkout', data);\n }\n\n /**\n * Create a Stripe billing portal session for managing an existing subscription.\n *\n * Returns a URL that the user should be redirected to in order to\n * access the Stripe billing portal where they can:\n * - View and update payment methods\n * - View billing history and invoices\n * - Upgrade, downgrade, or cancel their subscription\n *\n * @returns Promise resolving to the portal response with redirect URL\n *\n * @example\n * ```typescript\n * const portal = await client.billing.createPortal();\n *\n * // Redirect the user to the billing portal\n * window.location.href = portal.url;\n * ```\n *\n * @see Requirements 10.2\n */\n async createPortal(): Promise<PortalResponse> {\n return this.http.post<PortalResponse>('/billing/portal');\n }\n}\n","/**\n * Files Resource for the Spike Forms SDK\n *\n * Provides methods for managing uploaded files:\n * - getDownloadUrl: Get a signed download URL for a file\n * - delete: Delete a file by ID\n *\n * @module resources/files\n */\n\nimport { HttpClient } from '../http';\nimport { FileDownloadResponse, SuccessResponse } from '../types';\n\n/**\n * Resource class for managing uploaded files in Spike Forms.\n *\n * Provides access to file download URLs and deletion functionality\n * for files attached to form submissions.\n *\n * @example\n * ```typescript\n * // Get a signed download URL for a file\n * const download = await client.files.getDownloadUrl('file_123');\n * console.log(download.url); // Signed URL for downloading\n * console.log(download.expires_at); // When the URL expires\n *\n * // Delete a file\n * const result = await client.files.delete('file_123');\n * console.log(result.success); // true\n * ```\n */\nexport class FilesResource {\n private readonly http: HttpClient;\n\n /**\n * Create a new FilesResource instance\n * @param http - The HTTP client to use for API requests\n */\n constructor(http: HttpClient) {\n this.http = http;\n }\n\n /**\n * Get a signed download URL for a file.\n *\n * Returns a temporary signed URL that can be used to download the file.\n * The URL will expire at the time indicated in the response.\n *\n * @param id - The unique identifier of the file\n * @returns Promise resolving to the download response with signed URL and expiration\n *\n * @example\n * ```typescript\n * const download = await client.files.getDownloadUrl('file_abc123');\n *\n * // Use the signed URL to download the file\n * const response = await fetch(download.url);\n * const blob = await response.blob();\n *\n * // Check when the URL expires\n * console.log(`URL expires at: ${download.expires_at}`);\n * ```\n *\n * @see Requirements 11.1\n */\n async getDownloadUrl(id: string): Promise<FileDownloadResponse> {\n return this.http.get<FileDownloadResponse>(`/files/${id}/download`);\n }\n\n /**\n * Delete a file by ID.\n *\n * Permanently removes the file from storage. This action cannot be undone.\n *\n * @param id - The unique identifier of the file to delete\n * @returns Promise resolving to a success response\n *\n * @example\n * ```typescript\n * const result = await client.files.delete('file_abc123');\n *\n * if (result.success) {\n * console.log('File deleted successfully');\n * }\n * ```\n *\n * @see Requirements 11.2\n */\n async delete(id: string): Promise<SuccessResponse> {\n return this.http.delete<SuccessResponse>(`/files/${id}`);\n }\n}\n","/**\n * Spike Client for the Spike Forms SDK\n *\n * The main entry point for the SDK. Initializes all resource classes\n * and manages configuration for authenticated API requests.\n *\n * @module client\n */\n\nimport { HttpClient } from './http';\nimport { ValidationError } from './errors';\nimport { FormsResource } from './resources/forms';\nimport { SubmissionsResource } from './resources/submissions';\nimport { RulesResource } from './resources/rules';\nimport { ProjectsResource } from './resources/projects';\nimport { TeamsResource } from './resources/teams';\nimport { UserResource } from './resources/user';\nimport { BillingResource } from './resources/billing';\nimport { FilesResource } from './resources/files';\n\n/**\n * Default base URL for the Spike Forms API\n * @see Requirements 2.2\n */\nconst DEFAULT_BASE_URL = 'https://api.spike.ac';\n\n/**\n * Default timeout for API requests in milliseconds\n * @see Requirements 1.5\n */\nconst DEFAULT_TIMEOUT = 30000;\n\n/**\n * Configuration options for the Spike client.\n *\n * @example\n * ```typescript\n * const config: SpikeClientConfig = {\n * apiKey: 'sk_live_abc123',\n * baseUrl: 'https://spike.ac',\n * timeout: 30000\n * };\n * ```\n */\nexport interface SpikeClientConfig {\n /**\n * API key for authentication.\n * User API keys are prefixed with `sk_`.\n * @see Requirements 1.1, 1.6\n */\n apiKey: string;\n\n /**\n * Base URL for API requests.\n * @default 'https://api.spike.ac'\n * @see Requirements 2.2\n */\n baseUrl?: string;\n\n /**\n * Request timeout in milliseconds.\n * @default 30000\n * @see Requirements 1.5\n */\n timeout?: number;\n}\n\n/**\n * The main Spike Forms SDK client.\n *\n * Provides access to all Spike Forms API resources through a unified interface.\n * Initialize with your API key to start making authenticated requests.\n *\n * @example\n * ```typescript\n * // Basic initialization\n * const client = new SpikeClient({ apiKey: 'sk_live_abc123' });\n *\n * // With custom configuration\n * const client = new SpikeClient({\n * apiKey: 'sk_live_abc123',\n * baseUrl: 'https://custom.spike.ac',\n * timeout: 60000\n * });\n *\n * // Use resources\n * const forms = await client.forms.list();\n * const projects = await client.projects.list();\n * const user = await client.user.get();\n * ```\n *\n * @see Requirements 1.1, 1.2, 1.3, 1.4, 1.5, 1.6\n */\nexport class SpikeClient {\n /**\n * Resource for managing forms.\n * @see FormsResource\n */\n readonly forms: FormsResource;\n\n /**\n * Resource for managing form submissions.\n * @see SubmissionsResource\n */\n readonly submissions: SubmissionsResource;\n\n /**\n * Resource for managing form rules.\n * @see RulesResource\n */\n readonly rules: RulesResource;\n\n /**\n * Resource for managing projects.\n * @see ProjectsResource\n */\n readonly projects: ProjectsResource;\n\n /**\n * Resource for managing teams.\n * @see TeamsResource\n */\n readonly teams: TeamsResource;\n\n /**\n * Resource for managing user profile and settings.\n * @see UserResource\n */\n readonly user: UserResource;\n\n /**\n * Resource for managing billing and subscriptions.\n * @see BillingResource\n */\n readonly billing: BillingResource;\n\n /**\n * Resource for managing uploaded files.\n * @see FilesResource\n */\n readonly files: FilesResource;\n\n /**\n * The HTTP client used for API requests.\n * @internal\n */\n private readonly http: HttpClient;\n\n /**\n * Create a new Spike client instance.\n *\n * @param config - Configuration options for the client\n * @throws ValidationError if the API key is missing or empty\n *\n * @example\n * ```typescript\n * // Basic usage with API key\n * const client = new SpikeClient({ apiKey: 'sk_live_abc123' });\n *\n * // With all configuration options\n * const client = new SpikeClient({\n * apiKey: 'sk_live_abc123',\n * baseUrl: 'https://spike.ac',\n * timeout: 30000\n * });\n * ```\n *\n * @see Requirements 1.1, 1.2, 1.3, 1.4, 1.5\n */\n constructor(config: SpikeClientConfig) {\n // Validate API key is provided\n // @see Requirements 1.2\n if (!config.apiKey) {\n throw new ValidationError('API key is required. Please provide a valid API key.');\n }\n\n // Initialize HTTP client with configuration\n // @see Requirements 1.1, 1.3, 1.4, 1.5\n this.http = new HttpClient({\n apiKey: config.apiKey,\n baseUrl: config.baseUrl ?? DEFAULT_BASE_URL,\n timeout: config.timeout ?? DEFAULT_TIMEOUT,\n });\n\n // Initialize all resource classes\n this.forms = new FormsResource(this.http);\n this.submissions = new SubmissionsResource(this.http);\n this.rules = new RulesResource(this.http);\n this.projects = new ProjectsResource(this.http);\n this.teams = new TeamsResource(this.http);\n this.user = new UserResource(this.http);\n this.billing = new BillingResource(this.http);\n this.files = new FilesResource(this.http);\n }\n}\n","/**\n * @spike-forms/sdk\n * TypeScript SDK for the Spike Forms API\n *\n * This module exports all SDK components including:\n * - SpikeClient: The main client class for API access\n * - Error classes: Custom error types for different error conditions\n * - Type definitions: TypeScript interfaces for all entities and requests\n * - Resource classes: Individual resource classes for direct use\n *\n * @example\n * ```typescript\n * import { SpikeClient, SpikeError, NotFoundError } from '@spike-forms/sdk';\n *\n * const client = new SpikeClient({ apiKey: 'sk_live_abc123' });\n *\n * try {\n * const forms = await client.forms.list();\n * console.log(forms);\n * } catch (error) {\n * if (error instanceof NotFoundError) {\n * console.log('Resource not found');\n * } else if (error instanceof SpikeError) {\n * console.log('API error:', error.message);\n * }\n * }\n * ```\n *\n * @module @spike-forms/sdk\n */\n\nexport const VERSION = '0.1.0';\n\n// =============================================================================\n// Client Exports\n// =============================================================================\n\n/**\n * Export the main SpikeClient class and its configuration interface.\n * @see Requirements 1.1, 1.2, 1.3, 1.4, 1.5, 1.6\n */\nexport { SpikeClient } from './client';\nexport type { SpikeClientConfig } from './client';\n\n// =============================================================================\n// Error Class Exports\n// =============================================================================\n\n/**\n * Export all error classes for handling different API error conditions.\n * @see Requirements 3.1, 3.2, 3.3, 3.4, 3.5, 3.6\n */\nexport {\n SpikeError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n ValidationError,\n NetworkError,\n} from './errors';\n\n// =============================================================================\n// Resource Class Exports\n// =============================================================================\n\n/**\n * Export all resource classes for direct use.\n * These are also available through the SpikeClient instance.\n * @see Requirements 4-11\n */\nexport { FormsResource } from './resources/forms';\nexport { SubmissionsResource } from './resources/submissions';\nexport { RulesResource } from './resources/rules';\nexport { ProjectsResource } from './resources/projects';\nexport { TeamsResource } from './resources/teams';\nexport { UserResource } from './resources/user';\nexport { BillingResource } from './resources/billing';\nexport { FilesResource } from './resources/files';\n\n// =============================================================================\n// Type Definition Exports\n// =============================================================================\n\n/**\n * Export all type definitions for TypeScript support.\n * @see Requirements 12.1, 12.2, 12.3\n */\nexport type {\n // Core entities\n Form,\n Submission,\n SubmissionStats,\n Project,\n Team,\n TeamMember,\n TeamMemberRole,\n TeamInvitation,\n TeamInvitationRole,\n User,\n ApiKey,\n\n // Rule types\n Rule,\n RuleCondition,\n RuleConditionOperator,\n RuleAction,\n RuleActionType,\n\n // Response types\n SuccessResponse,\n SubmissionResponse,\n\n // Forms request types\n ListFormsParams,\n CreateFormRequest,\n UpdateFormRequest,\n\n // Submissions request types\n ListSubmissionsParams,\n SubmissionOrder,\n BulkAction,\n BulkUpdateRequest,\n\n // Rules request types\n CreateRuleRequest,\n UpdateRuleRequest,\n\n // Projects request types\n CreateProjectRequest,\n UpdateProjectRequest,\n\n // Teams request types\n CreateTeamRequest,\n UpdateTeamRequest,\n InviteMemberRequest,\n UpdateMemberRequest,\n\n // User request types\n UpdateUserRequest,\n Setup2FAResponse,\n CreateApiKeyRequest,\n\n // Billing types\n CreateCheckoutRequest,\n CheckoutResponse,\n PortalResponse,\n\n // Files types\n FileDownloadResponse,\n\n // Pagination types\n PaginationParams,\n PaginatedResponse,\n} from './types';\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@spike-forms/sdk",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "TypeScript SDK for the Spike Forms API",
|
|
5
|
+
"main": "./dist/index.cjs",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.cts",
|
|
16
|
+
"default": "./dist/index.cjs"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "tsup",
|
|
25
|
+
"dev": "tsup --watch",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"test:watch": "vitest",
|
|
28
|
+
"test:real-api": "vitest run tests/real-api.test.ts",
|
|
29
|
+
"test:sdk-integration": "vitest run tests/sdk-integration.test.ts",
|
|
30
|
+
"test:integration": "vitest run --config vitest.integration.config.ts --reporter=verbose",
|
|
31
|
+
"test:integration:ci": "vitest run --config vitest.integration.config.ts --reporter=verbose --reporter=json --outputFile=./test-results/integration-results.json",
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
33
|
+
"clean": "rm -rf dist"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"spike",
|
|
37
|
+
"forms",
|
|
38
|
+
"api",
|
|
39
|
+
"sdk",
|
|
40
|
+
"typescript"
|
|
41
|
+
],
|
|
42
|
+
"author": "",
|
|
43
|
+
"license": "MIT",
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"fast-check": "^4.5.3",
|
|
46
|
+
"msw": "^2.7.5",
|
|
47
|
+
"tsup": "^8.5.0",
|
|
48
|
+
"typescript": "^5.8.3",
|
|
49
|
+
"vitest": "^4.0.17"
|
|
50
|
+
},
|
|
51
|
+
"peerDependencies": {
|
|
52
|
+
"typescript": ">=5.0.0"
|
|
53
|
+
},
|
|
54
|
+
"peerDependenciesMeta": {
|
|
55
|
+
"typescript": {
|
|
56
|
+
"optional": true
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=18.0.0"
|
|
61
|
+
}
|
|
62
|
+
}
|