@djangocfg/monitor 2.1.227 → 2.1.229

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +2 -6
  2. package/dist/client.cjs +48 -26
  3. package/dist/client.cjs.map +1 -1
  4. package/dist/client.d.cts +31 -33
  5. package/dist/client.d.ts +31 -33
  6. package/dist/client.mjs +48 -26
  7. package/dist/client.mjs.map +1 -1
  8. package/dist/index.cjs +9 -10
  9. package/dist/index.cjs.map +1 -1
  10. package/dist/index.d.cts +29 -33
  11. package/dist/index.d.ts +29 -33
  12. package/dist/index.mjs +9 -10
  13. package/dist/index.mjs.map +1 -1
  14. package/dist/server.cjs +10 -11
  15. package/dist/server.cjs.map +1 -1
  16. package/dist/server.d.cts +29 -33
  17. package/dist/server.d.ts +29 -33
  18. package/dist/server.mjs +10 -11
  19. package/dist/server.mjs.map +1 -1
  20. package/package.json +2 -2
  21. package/src/_api/generated/cfg_monitor/_utils/schemas/FrontendEventIngestRequest.schema.ts +5 -6
  22. package/src/_api/generated/cfg_monitor/_utils/schemas/IngestBatchRequest.schema.ts +2 -2
  23. package/src/_api/generated/cfg_monitor/enums.ts +14 -16
  24. package/src/_api/generated/cfg_monitor/monitor/client.ts +2 -1
  25. package/src/_api/generated/cfg_monitor/monitor/models.ts +16 -18
  26. package/src/_api/generated/cfg_monitor/schema.json +19 -27
  27. package/src/client/capture/console.ts +3 -1
  28. package/src/client/capture/js-errors.ts +7 -0
  29. package/src/client/capture/network.ts +1 -1
  30. package/src/client/capture/validation.ts +1 -1
  31. package/src/client/constants.ts +7 -0
  32. package/src/client/index.ts +2 -1
  33. package/src/client/store/index.ts +28 -2
  34. package/src/client/transport/ingest.ts +5 -9
  35. package/src/client/window.ts +3 -3
  36. package/src/server/index.ts +1 -1
package/dist/server.mjs CHANGED
@@ -262,7 +262,8 @@ var _Monitor = class _Monitor {
262
262
  /**
263
263
  * Ingest browser events
264
264
  *
265
- * Accepts a batch of up to 50 frontend events. No authentication required.
265
+ * Accepts a batch of up to 50 frontend events. No authentication required
266
+ * — anonymous visitors can send events.
266
267
  */
267
268
  async ingestCreate(data) {
268
269
  const response = await this.client.request("POST", "/cfg/monitor/ingest/", { body: data });
@@ -1027,19 +1028,18 @@ var MemoryStorageAdapter = _MemoryStorageAdapter;
1027
1028
 
1028
1029
  // src/_api/generated/cfg_monitor/enums.ts
1029
1030
  var FrontendEventIngestRequestEventType = /* @__PURE__ */ ((FrontendEventIngestRequestEventType2) => {
1031
+ FrontendEventIngestRequestEventType2["JS_ERROR"] = "JS_ERROR";
1032
+ FrontendEventIngestRequestEventType2["NETWORK_ERROR"] = "NETWORK_ERROR";
1030
1033
  FrontendEventIngestRequestEventType2["ERROR"] = "ERROR";
1031
1034
  FrontendEventIngestRequestEventType2["WARNING"] = "WARNING";
1032
- FrontendEventIngestRequestEventType2["INFO"] = "INFO";
1033
1035
  FrontendEventIngestRequestEventType2["PAGE_VIEW"] = "PAGE_VIEW";
1034
1036
  FrontendEventIngestRequestEventType2["PERFORMANCE"] = "PERFORMANCE";
1035
- FrontendEventIngestRequestEventType2["NETWORK_ERROR"] = "NETWORK_ERROR";
1036
- FrontendEventIngestRequestEventType2["JS_ERROR"] = "JS_ERROR";
1037
1037
  FrontendEventIngestRequestEventType2["CONSOLE"] = "CONSOLE";
1038
1038
  return FrontendEventIngestRequestEventType2;
1039
1039
  })(FrontendEventIngestRequestEventType || {});
1040
1040
  var FrontendEventIngestRequestLevel = /* @__PURE__ */ ((FrontendEventIngestRequestLevel2) => {
1041
1041
  FrontendEventIngestRequestLevel2["ERROR"] = "error";
1042
- FrontendEventIngestRequestLevel2["WARN"] = "warn";
1042
+ FrontendEventIngestRequestLevel2["WARNING"] = "warning";
1043
1043
  FrontendEventIngestRequestLevel2["INFO"] = "info";
1044
1044
  FrontendEventIngestRequestLevel2["DEBUG"] = "debug";
1045
1045
  return FrontendEventIngestRequestLevel2;
@@ -1057,13 +1057,12 @@ var FrontendEventIngestRequestSchema = z.object({
1057
1057
  http_status: z.number().int().nullable().optional(),
1058
1058
  http_method: z.string().max(10).optional(),
1059
1059
  http_url: z.string().max(2e3).optional(),
1060
+ session_id: z.string().max(64).optional(),
1060
1061
  user_agent: z.string().max(500).optional(),
1061
- session_id: z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).nullable().optional(),
1062
- browser_fingerprint: z.string().max(64).optional(),
1063
- extra: z.record(z.string(), z.any()).optional(),
1064
- project_name: z.string().max(100).optional(),
1062
+ build_id: z.string().max(100).optional(),
1065
1063
  environment: z.string().max(20).optional(),
1066
- build_id: z.string().max(100).optional()
1064
+ extra: z.record(z.string(), z.any()).optional(),
1065
+ project_name: z.string().max(100).optional()
1067
1066
  });
1068
1067
 
1069
1068
  // src/_api/generated/cfg_monitor/_utils/schemas/IngestBatchRequest.schema.ts
@@ -1271,7 +1270,7 @@ var serverMonitor = {
1271
1270
  async captureNetworkError(status, method, apiUrl, ctx) {
1272
1271
  await send([withDefaults({
1273
1272
  event_type: "NETWORK_ERROR" /* NETWORK_ERROR */,
1274
- level: status >= 500 ? "error" /* ERROR */ : "warn" /* WARN */,
1273
+ level: status >= 500 ? "error" /* ERROR */ : "warning" /* WARNING */,
1275
1274
  message: `HTTP ${status} \u2014 ${method} ${apiUrl}`,
1276
1275
  url: ctx?.pageUrl ?? "",
1277
1276
  http_status: status,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js","../../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js","../../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js","../src/_api/generated/cfg_monitor/monitor/client.ts","../src/_api/generated/cfg_monitor/http.ts","../src/_api/generated/cfg_monitor/errors.ts","../src/_api/generated/cfg_monitor/logger.ts","../../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js","../../../node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.js","../src/_api/generated/cfg_monitor/retry.ts","../src/_api/generated/cfg_monitor/client.ts","../src/_api/generated/cfg_monitor/storage.ts","../src/_api/generated/cfg_monitor/enums.ts","../src/_api/generated/cfg_monitor/_utils/schemas/FrontendEventIngestRequest.schema.ts","../src/_api/generated/cfg_monitor/_utils/schemas/IngestBatchRequest.schema.ts","../src/_api/generated/cfg_monitor/index.ts","../src/_api/BaseClient.ts","../src/server/index.ts"],"sourcesContent":["function RetryOperation(timeouts, options) {\n // Compatibility for the old (timeouts, retryForever) signature\n if (typeof options === 'boolean') {\n options = { forever: options };\n }\n\n this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));\n this._timeouts = timeouts;\n this._options = options || {};\n this._maxRetryTime = options && options.maxRetryTime || Infinity;\n this._fn = null;\n this._errors = [];\n this._attempts = 1;\n this._operationTimeout = null;\n this._operationTimeoutCb = null;\n this._timeout = null;\n this._operationStart = null;\n this._timer = null;\n\n if (this._options.forever) {\n this._cachedTimeouts = this._timeouts.slice(0);\n }\n}\nmodule.exports = RetryOperation;\n\nRetryOperation.prototype.reset = function() {\n this._attempts = 1;\n this._timeouts = this._originalTimeouts.slice(0);\n}\n\nRetryOperation.prototype.stop = function() {\n if (this._timeout) {\n clearTimeout(this._timeout);\n }\n if (this._timer) {\n clearTimeout(this._timer);\n }\n\n this._timeouts = [];\n this._cachedTimeouts = null;\n};\n\nRetryOperation.prototype.retry = function(err) {\n if (this._timeout) {\n clearTimeout(this._timeout);\n }\n\n if (!err) {\n return false;\n }\n var currentTime = new Date().getTime();\n if (err && currentTime - this._operationStart >= this._maxRetryTime) {\n this._errors.push(err);\n this._errors.unshift(new Error('RetryOperation timeout occurred'));\n return false;\n }\n\n this._errors.push(err);\n\n var timeout = this._timeouts.shift();\n if (timeout === undefined) {\n if (this._cachedTimeouts) {\n // retry forever, only keep last error\n this._errors.splice(0, this._errors.length - 1);\n timeout = this._cachedTimeouts.slice(-1);\n } else {\n return false;\n }\n }\n\n var self = this;\n this._timer = setTimeout(function() {\n self._attempts++;\n\n if (self._operationTimeoutCb) {\n self._timeout = setTimeout(function() {\n self._operationTimeoutCb(self._attempts);\n }, self._operationTimeout);\n\n if (self._options.unref) {\n self._timeout.unref();\n }\n }\n\n self._fn(self._attempts);\n }, timeout);\n\n if (this._options.unref) {\n this._timer.unref();\n }\n\n return true;\n};\n\nRetryOperation.prototype.attempt = function(fn, timeoutOps) {\n this._fn = fn;\n\n if (timeoutOps) {\n if (timeoutOps.timeout) {\n this._operationTimeout = timeoutOps.timeout;\n }\n if (timeoutOps.cb) {\n this._operationTimeoutCb = timeoutOps.cb;\n }\n }\n\n var self = this;\n if (this._operationTimeoutCb) {\n this._timeout = setTimeout(function() {\n self._operationTimeoutCb();\n }, self._operationTimeout);\n }\n\n this._operationStart = new Date().getTime();\n\n this._fn(this._attempts);\n};\n\nRetryOperation.prototype.try = function(fn) {\n console.log('Using RetryOperation.try() is deprecated');\n this.attempt(fn);\n};\n\nRetryOperation.prototype.start = function(fn) {\n console.log('Using RetryOperation.start() is deprecated');\n this.attempt(fn);\n};\n\nRetryOperation.prototype.start = RetryOperation.prototype.try;\n\nRetryOperation.prototype.errors = function() {\n return this._errors;\n};\n\nRetryOperation.prototype.attempts = function() {\n return this._attempts;\n};\n\nRetryOperation.prototype.mainError = function() {\n if (this._errors.length === 0) {\n return null;\n }\n\n var counts = {};\n var mainError = null;\n var mainErrorCount = 0;\n\n for (var i = 0; i < this._errors.length; i++) {\n var error = this._errors[i];\n var message = error.message;\n var count = (counts[message] || 0) + 1;\n\n counts[message] = count;\n\n if (count >= mainErrorCount) {\n mainError = error;\n mainErrorCount = count;\n }\n }\n\n return mainError;\n};\n","var RetryOperation = require('./retry_operation');\n\nexports.operation = function(options) {\n var timeouts = exports.timeouts(options);\n return new RetryOperation(timeouts, {\n forever: options && (options.forever || options.retries === Infinity),\n unref: options && options.unref,\n maxRetryTime: options && options.maxRetryTime\n });\n};\n\nexports.timeouts = function(options) {\n if (options instanceof Array) {\n return [].concat(options);\n }\n\n var opts = {\n retries: 10,\n factor: 2,\n minTimeout: 1 * 1000,\n maxTimeout: Infinity,\n randomize: false\n };\n for (var key in options) {\n opts[key] = options[key];\n }\n\n if (opts.minTimeout > opts.maxTimeout) {\n throw new Error('minTimeout is greater than maxTimeout');\n }\n\n var timeouts = [];\n for (var i = 0; i < opts.retries; i++) {\n timeouts.push(this.createTimeout(i, opts));\n }\n\n if (options && options.forever && !timeouts.length) {\n timeouts.push(this.createTimeout(i, opts));\n }\n\n // sort the array numerically ascending\n timeouts.sort(function(a,b) {\n return a - b;\n });\n\n return timeouts;\n};\n\nexports.createTimeout = function(attempt, opts) {\n var random = (opts.randomize)\n ? (Math.random() + 1)\n : 1;\n\n var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));\n timeout = Math.min(timeout, opts.maxTimeout);\n\n return timeout;\n};\n\nexports.wrap = function(obj, options, methods) {\n if (options instanceof Array) {\n methods = options;\n options = null;\n }\n\n if (!methods) {\n methods = [];\n for (var key in obj) {\n if (typeof obj[key] === 'function') {\n methods.push(key);\n }\n }\n }\n\n for (var i = 0; i < methods.length; i++) {\n var method = methods[i];\n var original = obj[method];\n\n obj[method] = function retryWrapper(original) {\n var op = exports.operation(options);\n var args = Array.prototype.slice.call(arguments, 1);\n var callback = args.pop();\n\n args.push(function(err) {\n if (op.retry(err)) {\n return;\n }\n if (err) {\n arguments[0] = op.mainError();\n }\n callback.apply(this, arguments);\n });\n\n op.attempt(function() {\n original.apply(obj, args);\n });\n }.bind(obj, original);\n obj[method].options = options;\n }\n};\n","module.exports = require('./lib/retry');","// @ts-nocheck\nimport * as Models from \"./models\";\n\n\n/**\n * API endpoints for Monitor.\n */\nexport class Monitor {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * Ingest browser events\n * \n * Accepts a batch of up to 50 frontend events. No authentication required.\n */\n async ingestCreate(data: Models.IngestBatchRequest): Promise<any> {\n const response = await this.client.request('POST', \"/cfg/monitor/ingest/\", { body: data });\n return response;\n }\n\n}","// @ts-nocheck\n// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * HTTP Client Adapter Pattern\n *\n * Allows switching between fetch/axios/httpx without changing generated code.\n * Provides unified interface for making HTTP requests.\n */\n\nexport interface HttpRequest {\n method: string;\n url: string;\n headers?: Record<string, string>;\n body?: any;\n params?: Record<string, any>;\n /** FormData for file uploads (multipart/form-data) */\n formData?: FormData;\n /** Binary data for octet-stream uploads */\n binaryBody?: Blob | ArrayBuffer;\n}\n\nexport interface HttpResponse<T = any> {\n data: T;\n status: number;\n statusText: string;\n headers: Record<string, string>;\n}\n\n/**\n * HTTP Client Adapter Interface.\n * Implement this to use custom HTTP clients (axios, httpx, etc.)\n */\nexport interface HttpClientAdapter {\n request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;\n}\n\n/**\n * Default Fetch API adapter.\n * Uses native browser fetch() with proper error handling.\n */\nexport class FetchAdapter implements HttpClientAdapter {\n async request<T = any>(request: HttpRequest): Promise<HttpResponse<T>> {\n const { method, url, headers, body, params, formData, binaryBody } = request;\n\n // Build URL with query params\n let finalUrl = url;\n if (params) {\n const searchParams = new URLSearchParams();\n Object.entries(params).forEach(([key, value]) => {\n if (value !== null && value !== undefined) {\n searchParams.append(key, String(value));\n }\n });\n const queryString = searchParams.toString();\n if (queryString) {\n finalUrl = url.includes('?') ? `${url}&${queryString}` : `${url}?${queryString}`;\n }\n }\n\n // Build headers\n const finalHeaders: Record<string, string> = { ...headers };\n\n // Determine body and content-type\n let requestBody: string | FormData | Blob | ArrayBuffer | undefined;\n\n if (formData) {\n // For multipart/form-data, let browser set Content-Type with boundary\n requestBody = formData;\n // Don't set Content-Type - browser will set it with boundary\n } else if (binaryBody) {\n // Binary upload (application/octet-stream)\n finalHeaders['Content-Type'] = 'application/octet-stream';\n requestBody = binaryBody;\n } else if (body) {\n // JSON request\n finalHeaders['Content-Type'] = 'application/json';\n requestBody = JSON.stringify(body);\n }\n\n // Make request\n const response = await fetch(finalUrl, {\n method,\n headers: finalHeaders,\n body: requestBody,\n credentials: 'include', // Include Django session cookies\n });\n\n // Parse response\n let data: any = null;\n const contentType = response.headers.get('content-type');\n\n if (response.status !== 204 && contentType?.includes('application/json')) {\n data = await response.json();\n } else if (response.status !== 204) {\n data = await response.text();\n }\n\n // Convert Headers to plain object\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((value, key) => {\n responseHeaders[key] = value;\n });\n\n return {\n data,\n status: response.status,\n statusText: response.statusText,\n headers: responseHeaders,\n };\n }\n}\n\n/**\n * FetchAdapter with keepalive:true.\n *\n * Use this adapter when you need requests to survive page unload\n * (visibilitychange / beforeunload) — the browser will complete the request\n * even after the page is navigated away. Typical use: monitor / analytics flush.\n *\n * @example\n * ```typescript\n * import { APIClient, KeepAliveFetchAdapter } from './client';\n * const client = new APIClient(baseUrl, { httpClient: new KeepAliveFetchAdapter() });\n * ```\n */\nexport class KeepAliveFetchAdapter extends FetchAdapter {\n async request<T = any>(request: HttpRequest): Promise<HttpResponse<T>> {\n const origFetch = globalThis.fetch;\n globalThis.fetch = (input: RequestInfo | URL, init?: RequestInit) =>\n origFetch(input, { ...init, keepalive: true });\n try {\n return await super.request<T>(request);\n } finally {\n globalThis.fetch = origFetch;\n }\n }\n}","// @ts-nocheck\n// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * API Error Classes\n *\n * Typed error classes with Django REST Framework support.\n */\n\n/**\n * HTTP API Error with DRF field-specific validation errors.\n *\n * Usage:\n * ```typescript\n * try {\n * await api.users.create(userData);\n * } catch (error) {\n * if (error instanceof APIError) {\n * if (error.isValidationError) {\n * console.log('Field errors:', error.fieldErrors);\n * // { \"email\": [\"Email already exists\"], \"username\": [\"Required\"] }\n * }\n * }\n * }\n * ```\n */\nexport class APIError extends Error {\n constructor(\n public statusCode: number,\n public statusText: string,\n public response: any,\n public url: string,\n message?: string\n ) {\n super(message || `HTTP ${statusCode}: ${statusText}`);\n this.name = 'APIError';\n }\n\n /**\n * Get error details from response.\n * DRF typically returns: { \"detail\": \"Error message\" } or { \"field\": [\"error1\", \"error2\"] }\n */\n get details(): Record<string, any> | null {\n if (typeof this.response === 'object' && this.response !== null) {\n return this.response;\n }\n return null;\n }\n\n /**\n * Get field-specific validation errors from DRF.\n * Returns: { \"field_name\": [\"error1\", \"error2\"], ... }\n */\n get fieldErrors(): Record<string, string[]> | null {\n const details = this.details;\n if (!details) return null;\n\n // DRF typically returns: { \"field\": [\"error1\", \"error2\"] }\n const fieldErrors: Record<string, string[]> = {};\n for (const [key, value] of Object.entries(details)) {\n if (Array.isArray(value)) {\n fieldErrors[key] = value;\n }\n }\n\n return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;\n }\n\n /**\n * Get single error message from DRF.\n * Checks for \"detail\", \"message\", or first field error.\n */\n get errorMessage(): string {\n const details = this.details;\n if (!details) return this.message;\n\n // Check for \"detail\" field (common in DRF)\n if (details.detail) {\n return Array.isArray(details.detail) ? details.detail.join(', ') : String(details.detail);\n }\n\n // Check for \"message\" field\n if (details.message) {\n return String(details.message);\n }\n\n // Return first field error\n const fieldErrors = this.fieldErrors;\n if (fieldErrors) {\n const firstField = Object.keys(fieldErrors)[0];\n if (firstField) {\n return `${firstField}: ${fieldErrors[firstField]?.join(', ')}`;\n }\n }\n\n return this.message;\n }\n\n // Helper methods for common HTTP status codes\n get isValidationError(): boolean { return this.statusCode === 400; }\n get isAuthError(): boolean { return this.statusCode === 401; }\n get isPermissionError(): boolean { return this.statusCode === 403; }\n get isNotFoundError(): boolean { return this.statusCode === 404; }\n get isServerError(): boolean { return this.statusCode >= 500 && this.statusCode < 600; }\n}\n\n/**\n * Network Error (connection failed, timeout, etc.)\n */\nexport class NetworkError extends Error {\n constructor(\n message: string,\n public url: string,\n public originalError?: Error\n ) {\n super(message);\n this.name = 'NetworkError';\n }\n}","// @ts-nocheck\n// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * API Logger with Consola\n * Beautiful console logging for API requests and responses\n *\n * Installation:\n * npm install consola\n */\n\nimport { type ConsolaInstance, createConsola } from 'consola';\n\n/**\n * Request log data\n */\nexport interface RequestLog {\n method: string;\n url: string;\n headers?: Record<string, string>;\n body?: any;\n timestamp: number;\n}\n\n/**\n * Response log data\n */\nexport interface ResponseLog {\n status: number;\n statusText: string;\n data?: any;\n duration: number;\n timestamp: number;\n}\n\n/**\n * Error log data\n */\nexport interface ErrorLog {\n message: string;\n statusCode?: number;\n fieldErrors?: Record<string, string[]>;\n duration: number;\n timestamp: number;\n}\n\n/**\n * Logger configuration\n */\nexport interface LoggerConfig {\n /** Enable logging */\n enabled: boolean;\n /** Log requests */\n logRequests: boolean;\n /** Log responses */\n logResponses: boolean;\n /** Log errors */\n logErrors: boolean;\n /** Log request/response bodies */\n logBodies: boolean;\n /** Log headers (excluding sensitive ones) */\n logHeaders: boolean;\n /** Custom consola instance */\n consola?: ConsolaInstance;\n}\n\n/**\n * Default logger configuration\n */\nconst DEFAULT_CONFIG: LoggerConfig = {\n enabled: process.env.NODE_ENV !== 'production',\n logRequests: true,\n logResponses: true,\n logErrors: true,\n logBodies: true,\n logHeaders: false,\n};\n\n/**\n * Sensitive header names to filter out\n */\nconst SENSITIVE_HEADERS = [\n 'authorization',\n 'cookie',\n 'set-cookie',\n 'x-api-key',\n 'x-csrf-token',\n];\n\n/**\n * API Logger class\n */\nexport class APILogger {\n private config: LoggerConfig;\n private consola: ConsolaInstance;\n\n constructor(config: Partial<LoggerConfig> = {}) {\n this.config = { ...DEFAULT_CONFIG, ...config };\n this.consola = config.consola || createConsola({\n level: this.config.enabled ? 4 : 0,\n });\n }\n\n /**\n * Enable logging\n */\n enable(): void {\n this.config.enabled = true;\n }\n\n /**\n * Disable logging\n */\n disable(): void {\n this.config.enabled = false;\n }\n\n /**\n * Update configuration\n */\n setConfig(config: Partial<LoggerConfig>): void {\n this.config = { ...this.config, ...config };\n }\n\n /**\n * Filter sensitive headers\n */\n private filterHeaders(headers?: Record<string, string>): Record<string, string> {\n if (!headers) return {};\n\n const filtered: Record<string, string> = {};\n Object.keys(headers).forEach((key) => {\n const lowerKey = key.toLowerCase();\n if (SENSITIVE_HEADERS.includes(lowerKey)) {\n filtered[key] = '***';\n } else {\n filtered[key] = headers[key] || '';\n }\n });\n\n return filtered;\n }\n\n /**\n * Log request\n */\n logRequest(request: RequestLog): void {\n if (!this.config.enabled || !this.config.logRequests) return;\n\n const { method, url, headers, body } = request;\n\n this.consola.start(`${method} ${url}`);\n\n if (this.config.logHeaders && headers) {\n this.consola.debug('Headers:', this.filterHeaders(headers));\n }\n\n if (this.config.logBodies && body) {\n this.consola.debug('Body:', body);\n }\n }\n\n /**\n * Log response\n */\n logResponse(request: RequestLog, response: ResponseLog): void {\n if (!this.config.enabled || !this.config.logResponses) return;\n\n const { method, url } = request;\n const { status, statusText, data, duration } = response;\n\n const statusColor = status >= 500 ? 'red'\n : status >= 400 ? 'yellow'\n : status >= 300 ? 'cyan'\n : 'green';\n\n this.consola.success(\n `${method} ${url} ${status} ${statusText} (${duration}ms)`\n );\n\n if (this.config.logBodies && data) {\n this.consola.debug('Response:', data);\n }\n }\n\n /**\n * Log error\n */\n logError(request: RequestLog, error: ErrorLog): void {\n if (!this.config.enabled || !this.config.logErrors) return;\n\n const { method, url } = request;\n const { message, statusCode, fieldErrors, duration } = error;\n\n this.consola.error(\n `${method} ${url} ${statusCode || 'Network'} Error (${duration}ms)`\n );\n\n this.consola.error('Message:', message);\n\n if (fieldErrors && Object.keys(fieldErrors).length > 0) {\n this.consola.error('Field Errors:');\n Object.entries(fieldErrors).forEach(([field, errors]) => {\n errors.forEach((err) => {\n this.consola.error(` • ${field}: ${err}`);\n });\n });\n }\n }\n\n /**\n * Log general info\n */\n info(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.info(message, ...args);\n }\n\n /**\n * Log warning\n */\n warn(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.warn(message, ...args);\n }\n\n /**\n * Log error\n */\n error(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.error(message, ...args);\n }\n\n /**\n * Log debug\n */\n debug(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.debug(message, ...args);\n }\n\n /**\n * Log success\n */\n success(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.success(message, ...args);\n }\n\n /**\n * Create a sub-logger with prefix\n */\n withTag(tag: string): ConsolaInstance {\n return this.consola.withTag(tag);\n }\n}\n\n/**\n * Default logger instance\n */\nexport const defaultLogger = new APILogger();","import retry from 'retry';\nimport isNetworkError from 'is-network-error';\n\nexport class AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\n\t\tif (message instanceof Error) {\n\t\t\tthis.originalError = message;\n\t\t\t({message} = message);\n\t\t} else {\n\t\t\tthis.originalError = new Error(message);\n\t\t\tthis.originalError.stack = this.stack;\n\t\t}\n\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\nconst decorateErrorWithCounts = (error, attemptNumber, options) => {\n\t// Minus 1 from attemptNumber because the first attempt does not count as a retry\n\tconst retriesLeft = options.retries - (attemptNumber - 1);\n\n\terror.attemptNumber = attemptNumber;\n\terror.retriesLeft = retriesLeft;\n\treturn error;\n};\n\nexport default async function pRetry(input, options) {\n\treturn new Promise((resolve, reject) => {\n\t\toptions = {...options};\n\t\toptions.onFailedAttempt ??= () => {};\n\t\toptions.shouldRetry ??= () => true;\n\t\toptions.retries ??= 10;\n\n\t\tconst operation = retry.operation(options);\n\n\t\tconst abortHandler = () => {\n\t\t\toperation.stop();\n\t\t\treject(options.signal?.reason);\n\t\t};\n\n\t\tif (options.signal && !options.signal.aborted) {\n\t\t\toptions.signal.addEventListener('abort', abortHandler, {once: true});\n\t\t}\n\n\t\tconst cleanUp = () => {\n\t\t\toptions.signal?.removeEventListener('abort', abortHandler);\n\t\t\toperation.stop();\n\t\t};\n\n\t\toperation.attempt(async attemptNumber => {\n\t\t\ttry {\n\t\t\t\tconst result = await input(attemptNumber);\n\t\t\t\tcleanUp();\n\t\t\t\tresolve(result);\n\t\t\t} catch (error) {\n\t\t\t\ttry {\n\t\t\t\t\tif (!(error instanceof Error)) {\n\t\t\t\t\t\tthrow new TypeError(`Non-error was thrown: \"${error}\". You should only throw errors.`);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (error instanceof AbortError) {\n\t\t\t\t\t\tthrow error.originalError;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (error instanceof TypeError && !isNetworkError(error)) {\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\n\t\t\t\t\tdecorateErrorWithCounts(error, attemptNumber, options);\n\n\t\t\t\t\tif (!(await options.shouldRetry(error))) {\n\t\t\t\t\t\toperation.stop();\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t}\n\n\t\t\t\t\tawait options.onFailedAttempt(error);\n\n\t\t\t\t\tif (!operation.retry(error)) {\n\t\t\t\t\t\tthrow operation.mainError();\n\t\t\t\t\t}\n\t\t\t\t} catch (finalError) {\n\t\t\t\t\tdecorateErrorWithCounts(finalError, attemptNumber, options);\n\t\t\t\t\tcleanUp();\n\t\t\t\t\treject(finalError);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n}\n","const objectToString = Object.prototype.toString;\n\nconst isError = value => objectToString.call(value) === '[object Error]';\n\nconst errorMessages = new Set([\n\t'network error', // Chrome\n\t'Failed to fetch', // Chrome\n\t'NetworkError when attempting to fetch resource.', // Firefox\n\t'The Internet connection appears to be offline.', // Safari 16\n\t'Network request failed', // `cross-fetch`\n\t'fetch failed', // Undici (Node.js)\n\t'terminated', // Undici (Node.js)\n\t' A network error occurred.', // Bun (WebKit)\n\t'Network connection lost', // Cloudflare Workers (fetch)\n]);\n\nexport default function isNetworkError(error) {\n\tconst isValid = error\n\t\t&& isError(error)\n\t\t&& error.name === 'TypeError'\n\t\t&& typeof error.message === 'string';\n\n\tif (!isValid) {\n\t\treturn false;\n\t}\n\n\tconst {message, stack} = error;\n\n\t// Safari 17+ has generic message but no stack for network errors\n\tif (message === 'Load failed') {\n\t\treturn stack === undefined\n\t\t\t// Sentry adds its own stack trace to the fetch error, so also check for that\n\t\t\t|| '__sentry_captured__' in error;\n\t}\n\n\t// Deno network errors start with specific text\n\tif (message.startsWith('error sending request for url')) {\n\t\treturn true;\n\t}\n\n\t// Standard network error messages\n\treturn errorMessages.has(message);\n}\n","// @ts-nocheck\n// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Retry Configuration and Utilities\n *\n * Provides automatic retry logic for failed HTTP requests using p-retry.\n * Retries only on network errors and server errors (5xx), not client errors (4xx).\n */\n\nimport pRetry, { AbortError } from 'p-retry';\nimport { APIError, NetworkError } from './errors';\n\n/**\n * Information about a failed retry attempt.\n */\nexport interface FailedAttemptInfo {\n /** The error that caused the failure */\n error: Error;\n /** The attempt number (1-indexed) */\n attemptNumber: number;\n /** Number of retries left */\n retriesLeft: number;\n}\n\n/**\n * Retry configuration options.\n *\n * Uses exponential backoff with jitter by default to avoid thundering herd.\n */\nexport interface RetryConfig {\n /**\n * Maximum number of retry attempts.\n * @default 3\n */\n retries?: number;\n\n /**\n * Exponential backoff factor.\n * @default 2\n */\n factor?: number;\n\n /**\n * Minimum wait time between retries (ms).\n * @default 1000\n */\n minTimeout?: number;\n\n /**\n * Maximum wait time between retries (ms).\n * @default 60000\n */\n maxTimeout?: number;\n\n /**\n * Add randomness to wait times (jitter).\n * Helps avoid thundering herd problem.\n * @default true\n */\n randomize?: boolean;\n\n /**\n * Callback called on each failed attempt.\n */\n onFailedAttempt?: (info: FailedAttemptInfo) => void;\n}\n\n/**\n * Default retry configuration.\n */\nexport const DEFAULT_RETRY_CONFIG: Required<RetryConfig> = {\n retries: 3,\n factor: 2,\n minTimeout: 1000,\n maxTimeout: 60000,\n randomize: true,\n onFailedAttempt: () => {},\n};\n\n/**\n * Determine if an error should trigger a retry.\n *\n * Retries on:\n * - Network errors (connection refused, timeout, etc.)\n * - Server errors (5xx status codes)\n * - Rate limiting (429 status code)\n *\n * Does NOT retry on:\n * - Client errors (4xx except 429)\n * - Authentication errors (401, 403)\n * - Not found (404)\n *\n * @param error - The error to check\n * @returns true if should retry, false otherwise\n */\nexport function shouldRetry(error: any): boolean {\n // Always retry network errors\n if (error instanceof NetworkError) {\n return true;\n }\n\n // For API errors, check status code\n if (error instanceof APIError) {\n const status = error.statusCode;\n\n // Retry on 5xx server errors\n if (status >= 500 && status < 600) {\n return true;\n }\n\n // Retry on 429 (rate limit)\n if (status === 429) {\n return true;\n }\n\n // Do NOT retry on 4xx client errors\n return false;\n }\n\n // Retry on unknown errors (might be network issues)\n return true;\n}\n\n/**\n * Wrap a function with retry logic.\n *\n * @param fn - Async function to retry\n * @param config - Retry configuration\n * @returns Result of the function\n *\n * @example\n * ```typescript\n * const result = await withRetry(\n * async () => fetch('https://api.example.com/users'),\n * { retries: 5, minTimeout: 2000 }\n * );\n * ```\n */\nexport async function withRetry<T>(\n fn: () => Promise<T>,\n config?: RetryConfig\n): Promise<T> {\n const finalConfig = { ...DEFAULT_RETRY_CONFIG, ...config };\n\n return pRetry(\n async () => {\n try {\n return await fn();\n } catch (error) {\n // Check if we should retry this error\n if (!shouldRetry(error)) {\n // Abort retry immediately for non-retryable errors\n throw new AbortError(error as Error);\n }\n\n // Re-throw error to trigger retry\n throw error;\n }\n },\n {\n retries: finalConfig.retries,\n factor: finalConfig.factor,\n minTimeout: finalConfig.minTimeout,\n maxTimeout: finalConfig.maxTimeout,\n randomize: finalConfig.randomize,\n onFailedAttempt: finalConfig.onFailedAttempt ? (error) => {\n // Adapt p-retry's FailedAttemptError to our FailedAttemptInfo\n const pRetryError = error as any; // p-retry's internal type\n finalConfig.onFailedAttempt!({\n error: pRetryError as Error,\n attemptNumber: pRetryError.attemptNumber,\n retriesLeft: pRetryError.retriesLeft,\n });\n } : undefined,\n }\n );\n}","import { Monitor } from \"./monitor\";\nimport { HttpClientAdapter, FetchAdapter } from \"./http\";\nimport { APIError, NetworkError } from \"./errors\";\nimport { APILogger, type LoggerConfig } from \"./logger\";\nimport { withRetry, type RetryConfig } from \"./retry\";\n\n\n/**\n * Async API client for Django CFG API.\n *\n * Usage:\n * ```typescript\n * const client = new APIClient('https://api.example.com');\n * const users = await client.users.list();\n * const post = await client.posts.create(newPost);\n *\n * // Custom HTTP adapter (e.g., Axios)\n * const client = new APIClient('https://api.example.com', {\n * httpClient: new AxiosAdapter()\n * });\n * ```\n */\nexport class APIClient {\n private baseUrl: string;\n private httpClient: HttpClientAdapter;\n private logger: APILogger | null = null;\n private retryConfig: RetryConfig | null = null;\n private tokenGetter: (() => string | null) | null = null;\n\n // Sub-clients\n public monitor: Monitor;\n\n constructor(\n baseUrl: string,\n options?: {\n httpClient?: HttpClientAdapter;\n loggerConfig?: Partial<LoggerConfig>;\n retryConfig?: RetryConfig;\n tokenGetter?: () => string | null;\n }\n ) {\n this.baseUrl = baseUrl.replace(/\\/$/, '');\n this.httpClient = options?.httpClient || new FetchAdapter();\n this.tokenGetter = options?.tokenGetter || null;\n\n // Initialize logger if config provided\n if (options?.loggerConfig !== undefined) {\n this.logger = new APILogger(options.loggerConfig);\n }\n\n // Store retry configuration\n if (options?.retryConfig !== undefined) {\n this.retryConfig = options.retryConfig;\n }\n\n // Initialize sub-clients\n this.monitor = new Monitor(this);\n }\n\n /**\n * Get CSRF token from cookies (for SessionAuthentication).\n *\n * Returns null if cookie doesn't exist (JWT-only auth).\n */\n getCsrfToken(): string | null {\n const name = 'csrftoken';\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${name}=`);\n if (parts.length === 2) {\n return parts.pop()?.split(';').shift() || null;\n }\n return null;\n }\n\n /**\n * Get the base URL for building streaming/download URLs.\n */\n getBaseUrl(): string {\n return this.baseUrl;\n }\n\n /**\n * Get JWT token for URL authentication (used in streaming endpoints).\n * Returns null if no token getter is configured or no token is available.\n */\n getToken(): string | null {\n return this.tokenGetter ? this.tokenGetter() : null;\n }\n\n /**\n * Make HTTP request with Django CSRF and session handling.\n * Automatically retries on network errors and 5xx server errors.\n */\n async request<T>(\n method: string,\n path: string,\n options?: {\n params?: Record<string, any>;\n body?: any;\n formData?: FormData;\n binaryBody?: Blob | ArrayBuffer;\n headers?: Record<string, string>;\n }\n ): Promise<T> {\n // Wrap request in retry logic if configured\n if (this.retryConfig) {\n return withRetry(() => this._makeRequest<T>(method, path, options), {\n ...this.retryConfig,\n onFailedAttempt: (info) => {\n // Log retry attempts\n if (this.logger) {\n this.logger.warn(\n `Retry attempt ${info.attemptNumber}/${info.retriesLeft + info.attemptNumber} ` +\n `for ${method} ${path}: ${info.error.message}`\n );\n }\n // Call user's onFailedAttempt if provided\n this.retryConfig?.onFailedAttempt?.(info);\n },\n });\n }\n\n // No retry configured, make request directly\n return this._makeRequest<T>(method, path, options);\n }\n\n /**\n * Internal request method (without retry wrapper).\n * Used by request() method with optional retry logic.\n */\n private async _makeRequest<T>(\n method: string,\n path: string,\n options?: {\n params?: Record<string, any>;\n body?: any;\n formData?: FormData;\n binaryBody?: Blob | ArrayBuffer;\n headers?: Record<string, string>;\n }\n ): Promise<T> {\n // Build URL - handle both absolute and relative paths\n // When baseUrl is empty (static builds), path is used as-is (relative to current origin)\n const url = this.baseUrl ? `${this.baseUrl}${path}` : path;\n const startTime = Date.now();\n\n // Build headers - start with custom headers from options\n const headers: Record<string, string> = {\n ...(options?.headers || {})\n };\n\n // Don't set Content-Type for FormData/binaryBody (browser will set it with boundary)\n if (!options?.formData && !options?.binaryBody && !headers['Content-Type']) {\n headers['Content-Type'] = 'application/json';\n }\n\n // CSRF not needed - SessionAuthentication not enabled in DRF config\n // Your API uses JWT/Token authentication (no CSRF required)\n\n // Log request\n if (this.logger) {\n this.logger.logRequest({\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n });\n }\n\n try {\n // Make request via HTTP adapter\n const response = await this.httpClient.request<T>({\n method,\n url: url,\n headers,\n params: options?.params,\n body: options?.body,\n formData: options?.formData,\n binaryBody: options?.binaryBody,\n });\n\n const duration = Date.now() - startTime;\n\n // Check for HTTP errors\n if (response.status >= 400) {\n const error = new APIError(\n response.status,\n response.statusText,\n response.data,\n url\n );\n\n // Log error\n if (this.logger) {\n this.logger.logError(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n message: error.message,\n statusCode: response.status,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n throw error;\n }\n\n // Log successful response\n if (this.logger) {\n this.logger.logResponse(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n status: response.status,\n statusText: response.statusText,\n data: response.data,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n return response.data as T;\n } catch (error) {\n const duration = Date.now() - startTime;\n\n // Re-throw APIError as-is\n if (error instanceof APIError) {\n throw error;\n }\n\n // Detect CORS errors and dispatch event\n const isCORSError = error instanceof TypeError &&\n (error.message.toLowerCase().includes('cors') ||\n error.message.toLowerCase().includes('failed to fetch') ||\n error.message.toLowerCase().includes('network request failed'));\n\n // Log specific error type first\n if (this.logger) {\n if (isCORSError) {\n this.logger.error(`🚫 CORS Error: ${method} ${url}`);\n this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);\n this.logger.error(` → Configure security_domains parameter on the server`);\n } else {\n this.logger.error(`⚠️ Network Error: ${method} ${url}`);\n this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n\n // Dispatch browser events\n if (typeof window !== 'undefined') {\n try {\n if (isCORSError) {\n // Dispatch CORS-specific error event\n window.dispatchEvent(new CustomEvent('cors-error', {\n detail: {\n url: url,\n method: method,\n error: error instanceof Error ? error.message : String(error),\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n }));\n } else {\n // Dispatch generic network error event\n window.dispatchEvent(new CustomEvent('network-error', {\n detail: {\n url: url,\n method: method,\n error: error instanceof Error ? error.message : String(error),\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n }));\n }\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n }\n }\n\n // Wrap other errors as NetworkError\n const networkError = error instanceof Error\n ? new NetworkError(error.message, url, error)\n : new NetworkError('Unknown error', url);\n\n // Detailed logging via logger.logError\n if (this.logger) {\n this.logger.logError(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n message: networkError.message,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n throw networkError;\n }\n }\n}\n","// @ts-nocheck\n// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Storage adapters for cross-platform token storage.\n *\n * Supports:\n * - LocalStorage (browser)\n * - Cookies (SSR/browser)\n * - Memory (Node.js/Electron/testing)\n */\n\nimport type { APILogger } from './logger';\n\n/**\n * Storage adapter interface for cross-platform token storage.\n */\nexport interface StorageAdapter {\n getItem(key: string): string | null;\n setItem(key: string, value: string): void;\n removeItem(key: string): void;\n}\n\n/**\n * LocalStorage adapter with safe try-catch for browser environments.\n * Works in modern browsers with localStorage support.\n * \n * Note: This adapter uses window.localStorage and should only be used in browser/client environments.\n * For server-side usage, use MemoryStorageAdapter or CookieStorageAdapter instead.\n */\nexport class LocalStorageAdapter implements StorageAdapter {\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n const value = localStorage.getItem(key);\n this.logger?.debug(`LocalStorage.getItem(\"${key}\"): ${value ? 'found' : 'not found'}`);\n return value;\n }\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n } catch (error) {\n this.logger?.error('LocalStorage.getItem failed:', error);\n }\n return null;\n }\n\n setItem(key: string, value: string): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n localStorage.setItem(key, value);\n this.logger?.debug(`LocalStorage.setItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n }\n } catch (error) {\n this.logger?.error('LocalStorage.setItem failed:', error);\n }\n }\n\n removeItem(key: string): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n localStorage.removeItem(key);\n this.logger?.debug(`LocalStorage.removeItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n }\n } catch (error) {\n this.logger?.error('LocalStorage.removeItem failed:', error);\n }\n }\n}\n\n/**\n * Cookie-based storage adapter for SSR and browser environments.\n * Useful for Next.js, Nuxt.js, and other SSR frameworks.\n */\nexport class CookieStorageAdapter implements StorageAdapter {\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n try {\n if (typeof document === 'undefined') {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n return null;\n }\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${key}=`);\n if (parts.length === 2) {\n const result = parts.pop()?.split(';').shift() || null;\n this.logger?.debug(`CookieStorage.getItem(\"${key}\"): ${result ? 'found' : 'not found'}`);\n return result;\n }\n this.logger?.debug(`CookieStorage.getItem(\"${key}\"): not found`);\n } catch (error) {\n this.logger?.error('CookieStorage.getItem failed:', error);\n }\n return null;\n }\n\n setItem(key: string, value: string): void {\n try {\n if (typeof document !== 'undefined') {\n document.cookie = `${key}=${value}; path=/; max-age=31536000`;\n this.logger?.debug(`CookieStorage.setItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n }\n } catch (error) {\n this.logger?.error('CookieStorage.setItem failed:', error);\n }\n }\n\n removeItem(key: string): void {\n try {\n if (typeof document !== 'undefined') {\n document.cookie = `${key}=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT`;\n this.logger?.debug(`CookieStorage.removeItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n }\n } catch (error) {\n this.logger?.error('CookieStorage.removeItem failed:', error);\n }\n }\n}\n\n/**\n * In-memory storage adapter for Node.js, Electron, and testing environments.\n * Data is stored in RAM and cleared when process exits.\n */\nexport class MemoryStorageAdapter implements StorageAdapter {\n private storage: Map<string, string> = new Map();\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n const value = this.storage.get(key) || null;\n this.logger?.debug(`MemoryStorage.getItem(\"${key}\"): ${value ? 'found' : 'not found'}`);\n return value;\n }\n\n setItem(key: string, value: string): void {\n this.storage.set(key, value);\n this.logger?.debug(`MemoryStorage.setItem(\"${key}\"): success`);\n }\n\n removeItem(key: string): void {\n this.storage.delete(key);\n this.logger?.debug(`MemoryStorage.removeItem(\"${key}\"): success`);\n }\n}","// @ts-nocheck\n// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * * `ERROR` - Error\n * * `WARNING` - Warning\n * * `INFO` - Info\n * * `PAGE_VIEW` - Page View\n * * `PERFORMANCE` - Performance\n * * `NETWORK_ERROR` - Network Error\n * * `JS_ERROR` - JS Error\n * * `CONSOLE` - Console\n */\nexport enum FrontendEventIngestRequestEventType {\n ERROR = \"ERROR\",\n WARNING = \"WARNING\",\n INFO = \"INFO\",\n PAGE_VIEW = \"PAGE_VIEW\",\n PERFORMANCE = \"PERFORMANCE\",\n NETWORK_ERROR = \"NETWORK_ERROR\",\n JS_ERROR = \"JS_ERROR\",\n CONSOLE = \"CONSOLE\",\n}\n\n/**\n * * `error` - Error\n * * `warn` - Warning\n * * `info` - Info\n * * `debug` - Debug\n */\nexport enum FrontendEventIngestRequestLevel {\n ERROR = \"error\",\n WARN = \"warn\",\n INFO = \"info\",\n DEBUG = \"debug\",\n}\n\n","/**\n * Zod schema for FrontendEventIngestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Validates a single event from the browser.\n * */\nimport { z } from 'zod'\nimport * as Enums from '../../enums'\n\n/**\n * Validates a single event from the browser.\n */\nexport const FrontendEventIngestRequestSchema = z.object({\n event_type: z.nativeEnum(Enums.FrontendEventIngestRequestEventType),\n message: z.string().min(1).max(5000),\n level: z.nativeEnum(Enums.FrontendEventIngestRequestLevel).optional(),\n stack_trace: z.string().max(10000).optional(),\n url: z.string().max(2000).optional(),\n fingerprint: z.string().max(64).optional(),\n http_status: z.number().int().nullable().optional(),\n http_method: z.string().max(10).optional(),\n http_url: z.string().max(2000).optional(),\n user_agent: z.string().max(500).optional(),\n session_id: z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).nullable().optional(),\n browser_fingerprint: z.string().max(64).optional(),\n extra: z.record(z.string(), z.any()).optional(),\n project_name: z.string().max(100).optional(),\n environment: z.string().max(20).optional(),\n build_id: z.string().max(100).optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type FrontendEventIngestRequest = z.infer<typeof FrontendEventIngestRequestSchema>","/**\n * Zod schema for IngestBatchRequest\n *\n * This schema provides runtime validation and type inference.\n * * Wraps a list of events. Enforces max batch size.\n * */\nimport { z } from 'zod'\nimport { FrontendEventIngestRequestSchema } from './FrontendEventIngestRequest.schema'\n\n/**\n * Wraps a list of events. Enforces max batch size.\n */\nexport const IngestBatchRequestSchema = z.object({\n events: z.array(FrontendEventIngestRequestSchema),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type IngestBatchRequest = z.infer<typeof IngestBatchRequestSchema>","// @ts-nocheck\n// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Django CFG API - API Client with JWT Management\n *\n * Usage:\n * ```typescript\n * import { API } from './api';\n *\n * const api = new API('https://api.example.com');\n *\n * // Set JWT token\n * api.setToken('your-jwt-token', 'refresh-token');\n *\n * // Use API\n * const posts = await api.posts.list();\n * const user = await api.users.retrieve(1);\n *\n * // Check authentication\n * if (api.isAuthenticated()) {\n * // ...\n * }\n *\n * // Custom storage with logging (for Electron/Node.js)\n * import { MemoryStorageAdapter, APILogger } from './storage';\n * const logger = new APILogger({ enabled: true, logLevel: 'debug' });\n * const api = new API('https://api.example.com', {\n * storage: new MemoryStorageAdapter(logger),\n * loggerConfig: { enabled: true, logLevel: 'debug' }\n * });\n *\n * // Get OpenAPI schema\n * const schema = api.getSchema();\n * ```\n */\n\nimport { APIClient } from \"./client\";\nimport {\n StorageAdapter,\n LocalStorageAdapter,\n CookieStorageAdapter,\n MemoryStorageAdapter\n} from \"./storage\";\nimport type { RetryConfig } from \"./retry\";\nimport type { LoggerConfig } from \"./logger\";\nimport { APILogger } from \"./logger\";\nimport { Monitor } from \"./monitor/client\";\nexport * as MonitorTypes from \"./monitor/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\nexport * as Enums from \"./enums\";\n\n// Re-export Zod schemas for runtime validation\nexport * as Schemas from \"./_utils/schemas\";\n// Also export all schemas directly for convenience\nexport * from \"./_utils/schemas\";\n\n// Re-export Zod validation events for browser integration\nexport type { ValidationErrorDetail, ValidationErrorEvent } from \"./validation-events\";\nexport { dispatchValidationError, onValidationError, formatZodError } from \"./validation-events\";\n\n// Re-export typed fetchers for universal usage\nexport * as Fetchers from \"./_utils/fetchers\";\nexport * from \"./_utils/fetchers\";\n\n// Re-export API instance configuration functions\nexport {\n configureAPI,\n getAPIInstance,\n reconfigureAPI,\n clearAPITokens,\n resetAPI,\n isAPIConfigured\n} from \"./api-instance\";\n// NOTE: SWR hooks are generated in ./_utils/hooks/ but NOT exported here to keep\n// the main bundle server-safe. Import hooks directly from the hooks directory:\n// import { useUsers } from './_utils/hooks';\n// Or use a separate entry point like '@djangocfg/api/hooks' for client components.\n\n// Re-export core client\nexport { APIClient };\n\n// Re-export storage adapters for convenience\nexport type { StorageAdapter };\nexport { LocalStorageAdapter, CookieStorageAdapter, MemoryStorageAdapter };\n\n// Re-export error classes for convenience\nexport { APIError, NetworkError } from \"./errors\";\n\n// Re-export HTTP adapters for custom implementations\nexport type { HttpClientAdapter, HttpRequest, HttpResponse } from \"./http\";\nexport { FetchAdapter, KeepAliveFetchAdapter } from \"./http\";\n\n// Re-export logger types and classes\nexport type { LoggerConfig, RequestLog, ResponseLog, ErrorLog } from \"./logger\";\nexport { APILogger } from \"./logger\";\n\n// Re-export retry configuration and utilities\nexport type { RetryConfig, FailedAttemptInfo } from \"./retry\";\nexport { withRetry, shouldRetry, DEFAULT_RETRY_CONFIG } from \"./retry\";\n\nexport const TOKEN_KEY = \"auth_token\";\nexport const REFRESH_TOKEN_KEY = \"refresh_token\";\n\n/** Auto-detect locale from cookie NEXT_LOCALE or navigator.language */\nfunction detectLocale(): string | null {\n try {\n if (typeof document !== 'undefined') {\n const match = document.cookie.match(/(?:^|;\\s*)NEXT_LOCALE=([^;]*)/);\n if (match) return match[1];\n }\n if (typeof navigator !== 'undefined' && navigator.language) {\n return navigator.language;\n }\n } catch {}\n return null;\n}\n\nexport interface APIOptions {\n /** Custom storage adapter (defaults to LocalStorageAdapter) */\n storage?: StorageAdapter;\n /** Custom HTTP client adapter (defaults to FetchAdapter) */\n httpClient?: HttpClientAdapter;\n /** Retry configuration for failed requests */\n retryConfig?: RetryConfig;\n /** Logger configuration */\n loggerConfig?: Partial<LoggerConfig>;\n /** Locale for Accept-Language header (e.g. 'en', 'ko', 'ru') */\n locale?: string;\n}\n\nexport class API {\n private baseUrl: string;\n private _client: APIClient;\n private _token: string | null = null;\n private _refreshToken: string | null = null;\n private _locale: string | null = null;\n private storage: StorageAdapter;\n private options?: APIOptions;\n\n // Sub-clients\n public monitor!: Monitor;\n\n constructor(baseUrl: string, options?: APIOptions) {\n this.baseUrl = baseUrl;\n this.options = options;\n\n // Create logger if config provided\n const logger = options?.loggerConfig ? new APILogger(options.loggerConfig) : undefined;\n\n // Initialize storage with logger\n this.storage = options?.storage || new LocalStorageAdapter(logger);\n\n this._locale = options?.locale || null;\n\n this._loadTokensFromStorage();\n\n // Initialize APIClient with token getter for URL authentication\n this._client = new APIClient(this.baseUrl, {\n httpClient: this.options?.httpClient,\n retryConfig: this.options?.retryConfig,\n loggerConfig: this.options?.loggerConfig,\n tokenGetter: () => this.getToken(),\n });\n\n // Always inject auth header wrapper (reads token dynamically from storage)\n this._injectAuthHeader();\n\n // Initialize sub-clients from APIClient\n this.monitor = this._client.monitor;\n }\n\n private _loadTokensFromStorage(): void {\n this._token = this.storage.getItem(TOKEN_KEY);\n this._refreshToken = this.storage.getItem(REFRESH_TOKEN_KEY);\n }\n\n private _reinitClients(): void {\n this._client = new APIClient(this.baseUrl, {\n httpClient: this.options?.httpClient,\n retryConfig: this.options?.retryConfig,\n loggerConfig: this.options?.loggerConfig,\n tokenGetter: () => this.getToken(),\n });\n\n // Always inject auth header wrapper (reads token dynamically from storage)\n this._injectAuthHeader();\n\n // Reinitialize sub-clients\n this.monitor = this._client.monitor;\n }\n\n private _injectAuthHeader(): void {\n // Override request method to inject auth header\n const originalRequest = this._client.request.bind(this._client);\n this._client.request = async <T>(\n method: string,\n path: string,\n options?: { params?: Record<string, any>; body?: any; formData?: FormData; headers?: Record<string, string> }\n ): Promise<T> => {\n // Read token from storage dynamically (supports JWT injection after instantiation)\n const token = this.getToken();\n const locale = this._locale || detectLocale();\n const mergedOptions = {\n ...options,\n headers: {\n ...(options?.headers || {}),\n ...(token ? { 'Authorization': `Bearer ${token}` } : {}),\n ...(locale ? { 'Accept-Language': locale } : {}),\n },\n };\n\n return originalRequest(method, path, mergedOptions);\n };\n }\n\n /**\n * Get current JWT token\n */\n getToken(): string | null {\n return this.storage.getItem(TOKEN_KEY);\n }\n\n /**\n * Get current refresh token\n */\n getRefreshToken(): string | null {\n return this.storage.getItem(REFRESH_TOKEN_KEY);\n }\n\n /**\n * Set JWT token and refresh token\n * @param token - JWT access token\n * @param refreshToken - JWT refresh token (optional)\n */\n setToken(token: string, refreshToken?: string): void {\n this._token = token;\n this.storage.setItem(TOKEN_KEY, token);\n\n if (refreshToken) {\n this._refreshToken = refreshToken;\n this.storage.setItem(REFRESH_TOKEN_KEY, refreshToken);\n }\n\n // Reinitialize clients with new token\n this._reinitClients();\n }\n\n /**\n * Clear all tokens\n */\n clearTokens(): void {\n this._token = null;\n this._refreshToken = null;\n this.storage.removeItem(TOKEN_KEY);\n this.storage.removeItem(REFRESH_TOKEN_KEY);\n\n // Reinitialize clients without token\n this._reinitClients();\n }\n\n /**\n * Check if user is authenticated\n */\n isAuthenticated(): boolean {\n return !!this.getToken();\n }\n\n /**\n * Update base URL and reinitialize clients\n * @param url - New base URL\n */\n setBaseUrl(url: string): void {\n this.baseUrl = url;\n this._reinitClients();\n }\n\n /**\n * Get current base URL\n */\n getBaseUrl(): string {\n return this.baseUrl;\n }\n\n /**\n * Set locale for Accept-Language header\n * @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear\n */\n setLocale(locale: string | null): void {\n this._locale = locale;\n }\n\n /**\n * Get current locale\n */\n getLocale(): string | null {\n return this._locale;\n }\n\n /**\n * Get OpenAPI schema path\n * @returns Path to the OpenAPI schema JSON file\n *\n * Note: The OpenAPI schema is available in the schema.json file.\n * You can load it dynamically using:\n * ```typescript\n * const schema = await fetch('./schema.json').then(r => r.json());\n * // or using fs in Node.js:\n * // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));\n * ```\n */\n getSchemaPath(): string {\n return './schema.json';\n }\n}\n\nexport default API;","/**\n * BaseClient for @djangocfg/monitor\n *\n * Singleton monitorApi instance for the frontend monitor ingest endpoint.\n * Uses MemoryStorageAdapter — ingest is public (no auth tokens needed).\n */\n\nimport { API, MemoryStorageAdapter } from './generated/cfg_monitor'\n\nexport const monitorApi = new API('', { storage: new MemoryStorageAdapter() })\n\nexport function configureMonitorApi(baseUrl: string): void {\n monitorApi.setBaseUrl(baseUrl)\n}\n\nexport class BaseClient {\n protected static monitorApi = monitorApi\n}\n","/**\n * @djangocfg/monitor/server\n *\n * Server-side monitor for Next.js route handlers, Server Components,\n * and middleware. Does NOT use browser APIs — safe in Node.js / Edge Runtime.\n *\n * @example\n * ```ts\n * // lib/monitor.ts\n * import { serverMonitor } from '@djangocfg/monitor/server'\n * serverMonitor.configure({ project: 'my-app', environment: 'production', baseUrl: 'https://api.myapp.com' })\n * export { serverMonitor }\n *\n * // app/api/orders/route.ts\n * import { serverMonitor } from '@/lib/monitor'\n * export async function POST(req: Request) {\n * try { ... } catch (err) {\n * await serverMonitor.captureError(err, { url: req.url })\n * return new Response('Internal Server Error', { status: 500 })\n * }\n * }\n * ```\n */\n\nimport { monitorApi, configureMonitorApi, EventType, EventLevel } from '../_api'\nimport type { FrontendEventIngestRequest } from '../_api'\nimport type { ServerMonitorConfig } from '../types'\n\nexport type { ServerMonitorConfig } from '../types'\nexport type { EventType, EventLevel, MonitorEvent } from '../types'\n\nlet _config: ServerMonitorConfig = {}\n\nasync function send(events: FrontendEventIngestRequest[]): Promise<void> {\n if (events.length === 0) return\n try {\n await monitorApi.monitor.ingestCreate({ events })\n } catch {\n // Never throw from monitor\n }\n}\n\nfunction withDefaults(event: FrontendEventIngestRequest): FrontendEventIngestRequest {\n return { project_name: _config.project, environment: _config.environment, ...event }\n}\n\nexport const serverMonitor = {\n configure(config: ServerMonitorConfig): void {\n _config = config\n if (config.baseUrl) configureMonitorApi(config.baseUrl)\n },\n\n async captureError(err: unknown, ctx?: { url?: string; extra?: Record<string, unknown> }): Promise<void> {\n await send([withDefaults({\n event_type: EventType.JS_ERROR,\n level: EventLevel.ERROR,\n message: err instanceof Error ? err.message : String(err),\n stack_trace: err instanceof Error ? (err.stack ?? '') : '',\n url: ctx?.url ?? '',\n extra: ctx?.extra,\n })])\n },\n\n async captureNetworkError(\n status: number,\n method: string,\n apiUrl: string,\n ctx?: { pageUrl?: string; extra?: Record<string, unknown> },\n ): Promise<void> {\n await send([withDefaults({\n event_type: EventType.NETWORK_ERROR,\n level: status >= 500 ? EventLevel.ERROR : EventLevel.WARN,\n message: `HTTP ${status} — ${method} ${apiUrl}`,\n url: ctx?.pageUrl ?? '',\n http_status: status,\n http_method: method,\n http_url: apiUrl,\n extra: ct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AAC;AAAA,EAClC;AACF;","names":["original","require_retry","retry","FrontendEventIngestRequestEventType","FrontendEventIngestRequestLevel","z","z"]}
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js","../../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js","../../../node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js","../src/_api/generated/cfg_monitor/monitor/client.ts","../src/_api/generated/cfg_monitor/http.ts","../src/_api/generated/cfg_monitor/errors.ts","../src/_api/generated/cfg_monitor/logger.ts","../../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js","../../../node_modules/.pnpm/is-network-error@1.3.0/node_modules/is-network-error/index.js","../src/_api/generated/cfg_monitor/retry.ts","../src/_api/generated/cfg_monitor/client.ts","../src/_api/generated/cfg_monitor/storage.ts","../src/_api/generated/cfg_monitor/enums.ts","../src/_api/generated/cfg_monitor/_utils/schemas/FrontendEventIngestRequest.schema.ts","../src/_api/generated/cfg_monitor/_utils/schemas/IngestBatchRequest.schema.ts","../src/_api/generated/cfg_monitor/index.ts","../src/_api/BaseClient.ts","../src/server/index.ts"],"sourcesContent":["function RetryOperation(timeouts, options) {\n // Compatibility for the old (timeouts, retryForever) signature\n if (typeof options === 'boolean') {\n options = { forever: options };\n }\n\n this._originalTimeouts = JSON.parse(JSON.stringify(timeouts));\n this._timeouts = timeouts;\n this._options = options || {};\n this._maxRetryTime = options && options.maxRetryTime || Infinity;\n this._fn = null;\n this._errors = [];\n this._attempts = 1;\n this._operationTimeout = null;\n this._operationTimeoutCb = null;\n this._timeout = null;\n this._operationStart = null;\n this._timer = null;\n\n if (this._options.forever) {\n this._cachedTimeouts = this._timeouts.slice(0);\n }\n}\nmodule.exports = RetryOperation;\n\nRetryOperation.prototype.reset = function() {\n this._attempts = 1;\n this._timeouts = this._originalTimeouts.slice(0);\n}\n\nRetryOperation.prototype.stop = function() {\n if (this._timeout) {\n clearTimeout(this._timeout);\n }\n if (this._timer) {\n clearTimeout(this._timer);\n }\n\n this._timeouts = [];\n this._cachedTimeouts = null;\n};\n\nRetryOperation.prototype.retry = function(err) {\n if (this._timeout) {\n clearTimeout(this._timeout);\n }\n\n if (!err) {\n return false;\n }\n var currentTime = new Date().getTime();\n if (err && currentTime - this._operationStart >= this._maxRetryTime) {\n this._errors.push(err);\n this._errors.unshift(new Error('RetryOperation timeout occurred'));\n return false;\n }\n\n this._errors.push(err);\n\n var timeout = this._timeouts.shift();\n if (timeout === undefined) {\n if (this._cachedTimeouts) {\n // retry forever, only keep last error\n this._errors.splice(0, this._errors.length - 1);\n timeout = this._cachedTimeouts.slice(-1);\n } else {\n return false;\n }\n }\n\n var self = this;\n this._timer = setTimeout(function() {\n self._attempts++;\n\n if (self._operationTimeoutCb) {\n self._timeout = setTimeout(function() {\n self._operationTimeoutCb(self._attempts);\n }, self._operationTimeout);\n\n if (self._options.unref) {\n self._timeout.unref();\n }\n }\n\n self._fn(self._attempts);\n }, timeout);\n\n if (this._options.unref) {\n this._timer.unref();\n }\n\n return true;\n};\n\nRetryOperation.prototype.attempt = function(fn, timeoutOps) {\n this._fn = fn;\n\n if (timeoutOps) {\n if (timeoutOps.timeout) {\n this._operationTimeout = timeoutOps.timeout;\n }\n if (timeoutOps.cb) {\n this._operationTimeoutCb = timeoutOps.cb;\n }\n }\n\n var self = this;\n if (this._operationTimeoutCb) {\n this._timeout = setTimeout(function() {\n self._operationTimeoutCb();\n }, self._operationTimeout);\n }\n\n this._operationStart = new Date().getTime();\n\n this._fn(this._attempts);\n};\n\nRetryOperation.prototype.try = function(fn) {\n console.log('Using RetryOperation.try() is deprecated');\n this.attempt(fn);\n};\n\nRetryOperation.prototype.start = function(fn) {\n console.log('Using RetryOperation.start() is deprecated');\n this.attempt(fn);\n};\n\nRetryOperation.prototype.start = RetryOperation.prototype.try;\n\nRetryOperation.prototype.errors = function() {\n return this._errors;\n};\n\nRetryOperation.prototype.attempts = function() {\n return this._attempts;\n};\n\nRetryOperation.prototype.mainError = function() {\n if (this._errors.length === 0) {\n return null;\n }\n\n var counts = {};\n var mainError = null;\n var mainErrorCount = 0;\n\n for (var i = 0; i < this._errors.length; i++) {\n var error = this._errors[i];\n var message = error.message;\n var count = (counts[message] || 0) + 1;\n\n counts[message] = count;\n\n if (count >= mainErrorCount) {\n mainError = error;\n mainErrorCount = count;\n }\n }\n\n return mainError;\n};\n","var RetryOperation = require('./retry_operation');\n\nexports.operation = function(options) {\n var timeouts = exports.timeouts(options);\n return new RetryOperation(timeouts, {\n forever: options && (options.forever || options.retries === Infinity),\n unref: options && options.unref,\n maxRetryTime: options && options.maxRetryTime\n });\n};\n\nexports.timeouts = function(options) {\n if (options instanceof Array) {\n return [].concat(options);\n }\n\n var opts = {\n retries: 10,\n factor: 2,\n minTimeout: 1 * 1000,\n maxTimeout: Infinity,\n randomize: false\n };\n for (var key in options) {\n opts[key] = options[key];\n }\n\n if (opts.minTimeout > opts.maxTimeout) {\n throw new Error('minTimeout is greater than maxTimeout');\n }\n\n var timeouts = [];\n for (var i = 0; i < opts.retries; i++) {\n timeouts.push(this.createTimeout(i, opts));\n }\n\n if (options && options.forever && !timeouts.length) {\n timeouts.push(this.createTimeout(i, opts));\n }\n\n // sort the array numerically ascending\n timeouts.sort(function(a,b) {\n return a - b;\n });\n\n return timeouts;\n};\n\nexports.createTimeout = function(attempt, opts) {\n var random = (opts.randomize)\n ? (Math.random() + 1)\n : 1;\n\n var timeout = Math.round(random * Math.max(opts.minTimeout, 1) * Math.pow(opts.factor, attempt));\n timeout = Math.min(timeout, opts.maxTimeout);\n\n return timeout;\n};\n\nexports.wrap = function(obj, options, methods) {\n if (options instanceof Array) {\n methods = options;\n options = null;\n }\n\n if (!methods) {\n methods = [];\n for (var key in obj) {\n if (typeof obj[key] === 'function') {\n methods.push(key);\n }\n }\n }\n\n for (var i = 0; i < methods.length; i++) {\n var method = methods[i];\n var original = obj[method];\n\n obj[method] = function retryWrapper(original) {\n var op = exports.operation(options);\n var args = Array.prototype.slice.call(arguments, 1);\n var callback = args.pop();\n\n args.push(function(err) {\n if (op.retry(err)) {\n return;\n }\n if (err) {\n arguments[0] = op.mainError();\n }\n callback.apply(this, arguments);\n });\n\n op.attempt(function() {\n original.apply(obj, args);\n });\n }.bind(obj, original);\n obj[method].options = options;\n }\n};\n","module.exports = require('./lib/retry');","// @ts-nocheck\nimport * as Models from \"./models\";\n\n\n/**\n * API endpoints for Monitor.\n */\nexport class Monitor {\n private client: any;\n\n constructor(client: any) {\n this.client = client;\n }\n\n /**\n * Ingest browser events\n * \n * Accepts a batch of up to 50 frontend events. No authentication required\n * — anonymous visitors can send events.\n */\n async ingestCreate(data: Models.IngestBatchRequest): Promise<any> {\n const response = await this.client.request('POST', \"/cfg/monitor/ingest/\", { body: data });\n return response;\n }\n\n}","// @ts-nocheck\n// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * HTTP Client Adapter Pattern\n *\n * Allows switching between fetch/axios/httpx without changing generated code.\n * Provides unified interface for making HTTP requests.\n */\n\nexport interface HttpRequest {\n method: string;\n url: string;\n headers?: Record<string, string>;\n body?: any;\n params?: Record<string, any>;\n /** FormData for file uploads (multipart/form-data) */\n formData?: FormData;\n /** Binary data for octet-stream uploads */\n binaryBody?: Blob | ArrayBuffer;\n}\n\nexport interface HttpResponse<T = any> {\n data: T;\n status: number;\n statusText: string;\n headers: Record<string, string>;\n}\n\n/**\n * HTTP Client Adapter Interface.\n * Implement this to use custom HTTP clients (axios, httpx, etc.)\n */\nexport interface HttpClientAdapter {\n request<T = any>(request: HttpRequest): Promise<HttpResponse<T>>;\n}\n\n/**\n * Default Fetch API adapter.\n * Uses native browser fetch() with proper error handling.\n */\nexport class FetchAdapter implements HttpClientAdapter {\n async request<T = any>(request: HttpRequest): Promise<HttpResponse<T>> {\n const { method, url, headers, body, params, formData, binaryBody } = request;\n\n // Build URL with query params\n let finalUrl = url;\n if (params) {\n const searchParams = new URLSearchParams();\n Object.entries(params).forEach(([key, value]) => {\n if (value !== null && value !== undefined) {\n searchParams.append(key, String(value));\n }\n });\n const queryString = searchParams.toString();\n if (queryString) {\n finalUrl = url.includes('?') ? `${url}&${queryString}` : `${url}?${queryString}`;\n }\n }\n\n // Build headers\n const finalHeaders: Record<string, string> = { ...headers };\n\n // Determine body and content-type\n let requestBody: string | FormData | Blob | ArrayBuffer | undefined;\n\n if (formData) {\n // For multipart/form-data, let browser set Content-Type with boundary\n requestBody = formData;\n // Don't set Content-Type - browser will set it with boundary\n } else if (binaryBody) {\n // Binary upload (application/octet-stream)\n finalHeaders['Content-Type'] = 'application/octet-stream';\n requestBody = binaryBody;\n } else if (body) {\n // JSON request\n finalHeaders['Content-Type'] = 'application/json';\n requestBody = JSON.stringify(body);\n }\n\n // Make request\n const response = await fetch(finalUrl, {\n method,\n headers: finalHeaders,\n body: requestBody,\n credentials: 'include', // Include Django session cookies\n });\n\n // Parse response\n let data: any = null;\n const contentType = response.headers.get('content-type');\n\n if (response.status !== 204 && contentType?.includes('application/json')) {\n data = await response.json();\n } else if (response.status !== 204) {\n data = await response.text();\n }\n\n // Convert Headers to plain object\n const responseHeaders: Record<string, string> = {};\n response.headers.forEach((value, key) => {\n responseHeaders[key] = value;\n });\n\n return {\n data,\n status: response.status,\n statusText: response.statusText,\n headers: responseHeaders,\n };\n }\n}\n\n/**\n * FetchAdapter with keepalive:true.\n *\n * Use this adapter when you need requests to survive page unload\n * (visibilitychange / beforeunload) — the browser will complete the request\n * even after the page is navigated away. Typical use: monitor / analytics flush.\n *\n * @example\n * ```typescript\n * import { APIClient, KeepAliveFetchAdapter } from './client';\n * const client = new APIClient(baseUrl, { httpClient: new KeepAliveFetchAdapter() });\n * ```\n */\nexport class KeepAliveFetchAdapter extends FetchAdapter {\n async request<T = any>(request: HttpRequest): Promise<HttpResponse<T>> {\n const origFetch = globalThis.fetch;\n globalThis.fetch = (input: RequestInfo | URL, init?: RequestInit) =>\n origFetch(input, { ...init, keepalive: true });\n try {\n return await super.request<T>(request);\n } finally {\n globalThis.fetch = origFetch;\n }\n }\n}","// @ts-nocheck\n// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * API Error Classes\n *\n * Typed error classes with Django REST Framework support.\n */\n\n/**\n * HTTP API Error with DRF field-specific validation errors.\n *\n * Usage:\n * ```typescript\n * try {\n * await api.users.create(userData);\n * } catch (error) {\n * if (error instanceof APIError) {\n * if (error.isValidationError) {\n * console.log('Field errors:', error.fieldErrors);\n * // { \"email\": [\"Email already exists\"], \"username\": [\"Required\"] }\n * }\n * }\n * }\n * ```\n */\nexport class APIError extends Error {\n constructor(\n public statusCode: number,\n public statusText: string,\n public response: any,\n public url: string,\n message?: string\n ) {\n super(message || `HTTP ${statusCode}: ${statusText}`);\n this.name = 'APIError';\n }\n\n /**\n * Get error details from response.\n * DRF typically returns: { \"detail\": \"Error message\" } or { \"field\": [\"error1\", \"error2\"] }\n */\n get details(): Record<string, any> | null {\n if (typeof this.response === 'object' && this.response !== null) {\n return this.response;\n }\n return null;\n }\n\n /**\n * Get field-specific validation errors from DRF.\n * Returns: { \"field_name\": [\"error1\", \"error2\"], ... }\n */\n get fieldErrors(): Record<string, string[]> | null {\n const details = this.details;\n if (!details) return null;\n\n // DRF typically returns: { \"field\": [\"error1\", \"error2\"] }\n const fieldErrors: Record<string, string[]> = {};\n for (const [key, value] of Object.entries(details)) {\n if (Array.isArray(value)) {\n fieldErrors[key] = value;\n }\n }\n\n return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;\n }\n\n /**\n * Get single error message from DRF.\n * Checks for \"detail\", \"message\", or first field error.\n */\n get errorMessage(): string {\n const details = this.details;\n if (!details) return this.message;\n\n // Check for \"detail\" field (common in DRF)\n if (details.detail) {\n return Array.isArray(details.detail) ? details.detail.join(', ') : String(details.detail);\n }\n\n // Check for \"message\" field\n if (details.message) {\n return String(details.message);\n }\n\n // Return first field error\n const fieldErrors = this.fieldErrors;\n if (fieldErrors) {\n const firstField = Object.keys(fieldErrors)[0];\n if (firstField) {\n return `${firstField}: ${fieldErrors[firstField]?.join(', ')}`;\n }\n }\n\n return this.message;\n }\n\n // Helper methods for common HTTP status codes\n get isValidationError(): boolean { return this.statusCode === 400; }\n get isAuthError(): boolean { return this.statusCode === 401; }\n get isPermissionError(): boolean { return this.statusCode === 403; }\n get isNotFoundError(): boolean { return this.statusCode === 404; }\n get isServerError(): boolean { return this.statusCode >= 500 && this.statusCode < 600; }\n}\n\n/**\n * Network Error (connection failed, timeout, etc.)\n */\nexport class NetworkError extends Error {\n constructor(\n message: string,\n public url: string,\n public originalError?: Error\n ) {\n super(message);\n this.name = 'NetworkError';\n }\n}","// @ts-nocheck\n// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * API Logger with Consola\n * Beautiful console logging for API requests and responses\n *\n * Installation:\n * npm install consola\n */\n\nimport { type ConsolaInstance, createConsola } from 'consola';\n\n/**\n * Request log data\n */\nexport interface RequestLog {\n method: string;\n url: string;\n headers?: Record<string, string>;\n body?: any;\n timestamp: number;\n}\n\n/**\n * Response log data\n */\nexport interface ResponseLog {\n status: number;\n statusText: string;\n data?: any;\n duration: number;\n timestamp: number;\n}\n\n/**\n * Error log data\n */\nexport interface ErrorLog {\n message: string;\n statusCode?: number;\n fieldErrors?: Record<string, string[]>;\n duration: number;\n timestamp: number;\n}\n\n/**\n * Logger configuration\n */\nexport interface LoggerConfig {\n /** Enable logging */\n enabled: boolean;\n /** Log requests */\n logRequests: boolean;\n /** Log responses */\n logResponses: boolean;\n /** Log errors */\n logErrors: boolean;\n /** Log request/response bodies */\n logBodies: boolean;\n /** Log headers (excluding sensitive ones) */\n logHeaders: boolean;\n /** Custom consola instance */\n consola?: ConsolaInstance;\n}\n\n/**\n * Default logger configuration\n */\nconst DEFAULT_CONFIG: LoggerConfig = {\n enabled: process.env.NODE_ENV !== 'production',\n logRequests: true,\n logResponses: true,\n logErrors: true,\n logBodies: true,\n logHeaders: false,\n};\n\n/**\n * Sensitive header names to filter out\n */\nconst SENSITIVE_HEADERS = [\n 'authorization',\n 'cookie',\n 'set-cookie',\n 'x-api-key',\n 'x-csrf-token',\n];\n\n/**\n * API Logger class\n */\nexport class APILogger {\n private config: LoggerConfig;\n private consola: ConsolaInstance;\n\n constructor(config: Partial<LoggerConfig> = {}) {\n this.config = { ...DEFAULT_CONFIG, ...config };\n this.consola = config.consola || createConsola({\n level: this.config.enabled ? 4 : 0,\n });\n }\n\n /**\n * Enable logging\n */\n enable(): void {\n this.config.enabled = true;\n }\n\n /**\n * Disable logging\n */\n disable(): void {\n this.config.enabled = false;\n }\n\n /**\n * Update configuration\n */\n setConfig(config: Partial<LoggerConfig>): void {\n this.config = { ...this.config, ...config };\n }\n\n /**\n * Filter sensitive headers\n */\n private filterHeaders(headers?: Record<string, string>): Record<string, string> {\n if (!headers) return {};\n\n const filtered: Record<string, string> = {};\n Object.keys(headers).forEach((key) => {\n const lowerKey = key.toLowerCase();\n if (SENSITIVE_HEADERS.includes(lowerKey)) {\n filtered[key] = '***';\n } else {\n filtered[key] = headers[key] || '';\n }\n });\n\n return filtered;\n }\n\n /**\n * Log request\n */\n logRequest(request: RequestLog): void {\n if (!this.config.enabled || !this.config.logRequests) return;\n\n const { method, url, headers, body } = request;\n\n this.consola.start(`${method} ${url}`);\n\n if (this.config.logHeaders && headers) {\n this.consola.debug('Headers:', this.filterHeaders(headers));\n }\n\n if (this.config.logBodies && body) {\n this.consola.debug('Body:', body);\n }\n }\n\n /**\n * Log response\n */\n logResponse(request: RequestLog, response: ResponseLog): void {\n if (!this.config.enabled || !this.config.logResponses) return;\n\n const { method, url } = request;\n const { status, statusText, data, duration } = response;\n\n const statusColor = status >= 500 ? 'red'\n : status >= 400 ? 'yellow'\n : status >= 300 ? 'cyan'\n : 'green';\n\n this.consola.success(\n `${method} ${url} ${status} ${statusText} (${duration}ms)`\n );\n\n if (this.config.logBodies && data) {\n this.consola.debug('Response:', data);\n }\n }\n\n /**\n * Log error\n */\n logError(request: RequestLog, error: ErrorLog): void {\n if (!this.config.enabled || !this.config.logErrors) return;\n\n const { method, url } = request;\n const { message, statusCode, fieldErrors, duration } = error;\n\n this.consola.error(\n `${method} ${url} ${statusCode || 'Network'} Error (${duration}ms)`\n );\n\n this.consola.error('Message:', message);\n\n if (fieldErrors && Object.keys(fieldErrors).length > 0) {\n this.consola.error('Field Errors:');\n Object.entries(fieldErrors).forEach(([field, errors]) => {\n errors.forEach((err) => {\n this.consola.error(` • ${field}: ${err}`);\n });\n });\n }\n }\n\n /**\n * Log general info\n */\n info(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.info(message, ...args);\n }\n\n /**\n * Log warning\n */\n warn(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.warn(message, ...args);\n }\n\n /**\n * Log error\n */\n error(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.error(message, ...args);\n }\n\n /**\n * Log debug\n */\n debug(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.debug(message, ...args);\n }\n\n /**\n * Log success\n */\n success(message: string, ...args: any[]): void {\n if (!this.config.enabled) return;\n this.consola.success(message, ...args);\n }\n\n /**\n * Create a sub-logger with prefix\n */\n withTag(tag: string): ConsolaInstance {\n return this.consola.withTag(tag);\n }\n}\n\n/**\n * Default logger instance\n */\nexport const defaultLogger = new APILogger();","import retry from 'retry';\nimport isNetworkError from 'is-network-error';\n\nexport class AbortError extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\n\t\tif (message instanceof Error) {\n\t\t\tthis.originalError = message;\n\t\t\t({message} = message);\n\t\t} else {\n\t\t\tthis.originalError = new Error(message);\n\t\t\tthis.originalError.stack = this.stack;\n\t\t}\n\n\t\tthis.name = 'AbortError';\n\t\tthis.message = message;\n\t}\n}\n\nconst decorateErrorWithCounts = (error, attemptNumber, options) => {\n\t// Minus 1 from attemptNumber because the first attempt does not count as a retry\n\tconst retriesLeft = options.retries - (attemptNumber - 1);\n\n\terror.attemptNumber = attemptNumber;\n\terror.retriesLeft = retriesLeft;\n\treturn error;\n};\n\nexport default async function pRetry(input, options) {\n\treturn new Promise((resolve, reject) => {\n\t\toptions = {...options};\n\t\toptions.onFailedAttempt ??= () => {};\n\t\toptions.shouldRetry ??= () => true;\n\t\toptions.retries ??= 10;\n\n\t\tconst operation = retry.operation(options);\n\n\t\tconst abortHandler = () => {\n\t\t\toperation.stop();\n\t\t\treject(options.signal?.reason);\n\t\t};\n\n\t\tif (options.signal && !options.signal.aborted) {\n\t\t\toptions.signal.addEventListener('abort', abortHandler, {once: true});\n\t\t}\n\n\t\tconst cleanUp = () => {\n\t\t\toptions.signal?.removeEventListener('abort', abortHandler);\n\t\t\toperation.stop();\n\t\t};\n\n\t\toperation.attempt(async attemptNumber => {\n\t\t\ttry {\n\t\t\t\tconst result = await input(attemptNumber);\n\t\t\t\tcleanUp();\n\t\t\t\tresolve(result);\n\t\t\t} catch (error) {\n\t\t\t\ttry {\n\t\t\t\t\tif (!(error instanceof Error)) {\n\t\t\t\t\t\tthrow new TypeError(`Non-error was thrown: \"${error}\". You should only throw errors.`);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (error instanceof AbortError) {\n\t\t\t\t\t\tthrow error.originalError;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (error instanceof TypeError && !isNetworkError(error)) {\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\n\t\t\t\t\tdecorateErrorWithCounts(error, attemptNumber, options);\n\n\t\t\t\t\tif (!(await options.shouldRetry(error))) {\n\t\t\t\t\t\toperation.stop();\n\t\t\t\t\t\treject(error);\n\t\t\t\t\t}\n\n\t\t\t\t\tawait options.onFailedAttempt(error);\n\n\t\t\t\t\tif (!operation.retry(error)) {\n\t\t\t\t\t\tthrow operation.mainError();\n\t\t\t\t\t}\n\t\t\t\t} catch (finalError) {\n\t\t\t\t\tdecorateErrorWithCounts(finalError, attemptNumber, options);\n\t\t\t\t\tcleanUp();\n\t\t\t\t\treject(finalError);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n}\n","const objectToString = Object.prototype.toString;\n\nconst isError = value => objectToString.call(value) === '[object Error]';\n\nconst errorMessages = new Set([\n\t'network error', // Chrome\n\t'Failed to fetch', // Chrome\n\t'NetworkError when attempting to fetch resource.', // Firefox\n\t'The Internet connection appears to be offline.', // Safari 16\n\t'Network request failed', // `cross-fetch`\n\t'fetch failed', // Undici (Node.js)\n\t'terminated', // Undici (Node.js)\n\t' A network error occurred.', // Bun (WebKit)\n\t'Network connection lost', // Cloudflare Workers (fetch)\n]);\n\nexport default function isNetworkError(error) {\n\tconst isValid = error\n\t\t&& isError(error)\n\t\t&& error.name === 'TypeError'\n\t\t&& typeof error.message === 'string';\n\n\tif (!isValid) {\n\t\treturn false;\n\t}\n\n\tconst {message, stack} = error;\n\n\t// Safari 17+ has generic message but no stack for network errors\n\tif (message === 'Load failed') {\n\t\treturn stack === undefined\n\t\t\t// Sentry adds its own stack trace to the fetch error, so also check for that\n\t\t\t|| '__sentry_captured__' in error;\n\t}\n\n\t// Deno network errors start with specific text\n\tif (message.startsWith('error sending request for url')) {\n\t\treturn true;\n\t}\n\n\t// Standard network error messages\n\treturn errorMessages.has(message);\n}\n","// @ts-nocheck\n// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Retry Configuration and Utilities\n *\n * Provides automatic retry logic for failed HTTP requests using p-retry.\n * Retries only on network errors and server errors (5xx), not client errors (4xx).\n */\n\nimport pRetry, { AbortError } from 'p-retry';\nimport { APIError, NetworkError } from './errors';\n\n/**\n * Information about a failed retry attempt.\n */\nexport interface FailedAttemptInfo {\n /** The error that caused the failure */\n error: Error;\n /** The attempt number (1-indexed) */\n attemptNumber: number;\n /** Number of retries left */\n retriesLeft: number;\n}\n\n/**\n * Retry configuration options.\n *\n * Uses exponential backoff with jitter by default to avoid thundering herd.\n */\nexport interface RetryConfig {\n /**\n * Maximum number of retry attempts.\n * @default 3\n */\n retries?: number;\n\n /**\n * Exponential backoff factor.\n * @default 2\n */\n factor?: number;\n\n /**\n * Minimum wait time between retries (ms).\n * @default 1000\n */\n minTimeout?: number;\n\n /**\n * Maximum wait time between retries (ms).\n * @default 60000\n */\n maxTimeout?: number;\n\n /**\n * Add randomness to wait times (jitter).\n * Helps avoid thundering herd problem.\n * @default true\n */\n randomize?: boolean;\n\n /**\n * Callback called on each failed attempt.\n */\n onFailedAttempt?: (info: FailedAttemptInfo) => void;\n}\n\n/**\n * Default retry configuration.\n */\nexport const DEFAULT_RETRY_CONFIG: Required<RetryConfig> = {\n retries: 3,\n factor: 2,\n minTimeout: 1000,\n maxTimeout: 60000,\n randomize: true,\n onFailedAttempt: () => {},\n};\n\n/**\n * Determine if an error should trigger a retry.\n *\n * Retries on:\n * - Network errors (connection refused, timeout, etc.)\n * - Server errors (5xx status codes)\n * - Rate limiting (429 status code)\n *\n * Does NOT retry on:\n * - Client errors (4xx except 429)\n * - Authentication errors (401, 403)\n * - Not found (404)\n *\n * @param error - The error to check\n * @returns true if should retry, false otherwise\n */\nexport function shouldRetry(error: any): boolean {\n // Always retry network errors\n if (error instanceof NetworkError) {\n return true;\n }\n\n // For API errors, check status code\n if (error instanceof APIError) {\n const status = error.statusCode;\n\n // Retry on 5xx server errors\n if (status >= 500 && status < 600) {\n return true;\n }\n\n // Retry on 429 (rate limit)\n if (status === 429) {\n return true;\n }\n\n // Do NOT retry on 4xx client errors\n return false;\n }\n\n // Retry on unknown errors (might be network issues)\n return true;\n}\n\n/**\n * Wrap a function with retry logic.\n *\n * @param fn - Async function to retry\n * @param config - Retry configuration\n * @returns Result of the function\n *\n * @example\n * ```typescript\n * const result = await withRetry(\n * async () => fetch('https://api.example.com/users'),\n * { retries: 5, minTimeout: 2000 }\n * );\n * ```\n */\nexport async function withRetry<T>(\n fn: () => Promise<T>,\n config?: RetryConfig\n): Promise<T> {\n const finalConfig = { ...DEFAULT_RETRY_CONFIG, ...config };\n\n return pRetry(\n async () => {\n try {\n return await fn();\n } catch (error) {\n // Check if we should retry this error\n if (!shouldRetry(error)) {\n // Abort retry immediately for non-retryable errors\n throw new AbortError(error as Error);\n }\n\n // Re-throw error to trigger retry\n throw error;\n }\n },\n {\n retries: finalConfig.retries,\n factor: finalConfig.factor,\n minTimeout: finalConfig.minTimeout,\n maxTimeout: finalConfig.maxTimeout,\n randomize: finalConfig.randomize,\n onFailedAttempt: finalConfig.onFailedAttempt ? (error) => {\n // Adapt p-retry's FailedAttemptError to our FailedAttemptInfo\n const pRetryError = error as any; // p-retry's internal type\n finalConfig.onFailedAttempt!({\n error: pRetryError as Error,\n attemptNumber: pRetryError.attemptNumber,\n retriesLeft: pRetryError.retriesLeft,\n });\n } : undefined,\n }\n );\n}","import { Monitor } from \"./monitor\";\nimport { HttpClientAdapter, FetchAdapter } from \"./http\";\nimport { APIError, NetworkError } from \"./errors\";\nimport { APILogger, type LoggerConfig } from \"./logger\";\nimport { withRetry, type RetryConfig } from \"./retry\";\n\n\n/**\n * Async API client for Django CFG API.\n *\n * Usage:\n * ```typescript\n * const client = new APIClient('https://api.example.com');\n * const users = await client.users.list();\n * const post = await client.posts.create(newPost);\n *\n * // Custom HTTP adapter (e.g., Axios)\n * const client = new APIClient('https://api.example.com', {\n * httpClient: new AxiosAdapter()\n * });\n * ```\n */\nexport class APIClient {\n private baseUrl: string;\n private httpClient: HttpClientAdapter;\n private logger: APILogger | null = null;\n private retryConfig: RetryConfig | null = null;\n private tokenGetter: (() => string | null) | null = null;\n\n // Sub-clients\n public monitor: Monitor;\n\n constructor(\n baseUrl: string,\n options?: {\n httpClient?: HttpClientAdapter;\n loggerConfig?: Partial<LoggerConfig>;\n retryConfig?: RetryConfig;\n tokenGetter?: () => string | null;\n }\n ) {\n this.baseUrl = baseUrl.replace(/\\/$/, '');\n this.httpClient = options?.httpClient || new FetchAdapter();\n this.tokenGetter = options?.tokenGetter || null;\n\n // Initialize logger if config provided\n if (options?.loggerConfig !== undefined) {\n this.logger = new APILogger(options.loggerConfig);\n }\n\n // Store retry configuration\n if (options?.retryConfig !== undefined) {\n this.retryConfig = options.retryConfig;\n }\n\n // Initialize sub-clients\n this.monitor = new Monitor(this);\n }\n\n /**\n * Get CSRF token from cookies (for SessionAuthentication).\n *\n * Returns null if cookie doesn't exist (JWT-only auth).\n */\n getCsrfToken(): string | null {\n const name = 'csrftoken';\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${name}=`);\n if (parts.length === 2) {\n return parts.pop()?.split(';').shift() || null;\n }\n return null;\n }\n\n /**\n * Get the base URL for building streaming/download URLs.\n */\n getBaseUrl(): string {\n return this.baseUrl;\n }\n\n /**\n * Get JWT token for URL authentication (used in streaming endpoints).\n * Returns null if no token getter is configured or no token is available.\n */\n getToken(): string | null {\n return this.tokenGetter ? this.tokenGetter() : null;\n }\n\n /**\n * Make HTTP request with Django CSRF and session handling.\n * Automatically retries on network errors and 5xx server errors.\n */\n async request<T>(\n method: string,\n path: string,\n options?: {\n params?: Record<string, any>;\n body?: any;\n formData?: FormData;\n binaryBody?: Blob | ArrayBuffer;\n headers?: Record<string, string>;\n }\n ): Promise<T> {\n // Wrap request in retry logic if configured\n if (this.retryConfig) {\n return withRetry(() => this._makeRequest<T>(method, path, options), {\n ...this.retryConfig,\n onFailedAttempt: (info) => {\n // Log retry attempts\n if (this.logger) {\n this.logger.warn(\n `Retry attempt ${info.attemptNumber}/${info.retriesLeft + info.attemptNumber} ` +\n `for ${method} ${path}: ${info.error.message}`\n );\n }\n // Call user's onFailedAttempt if provided\n this.retryConfig?.onFailedAttempt?.(info);\n },\n });\n }\n\n // No retry configured, make request directly\n return this._makeRequest<T>(method, path, options);\n }\n\n /**\n * Internal request method (without retry wrapper).\n * Used by request() method with optional retry logic.\n */\n private async _makeRequest<T>(\n method: string,\n path: string,\n options?: {\n params?: Record<string, any>;\n body?: any;\n formData?: FormData;\n binaryBody?: Blob | ArrayBuffer;\n headers?: Record<string, string>;\n }\n ): Promise<T> {\n // Build URL - handle both absolute and relative paths\n // When baseUrl is empty (static builds), path is used as-is (relative to current origin)\n const url = this.baseUrl ? `${this.baseUrl}${path}` : path;\n const startTime = Date.now();\n\n // Build headers - start with custom headers from options\n const headers: Record<string, string> = {\n ...(options?.headers || {})\n };\n\n // Don't set Content-Type for FormData/binaryBody (browser will set it with boundary)\n if (!options?.formData && !options?.binaryBody && !headers['Content-Type']) {\n headers['Content-Type'] = 'application/json';\n }\n\n // CSRF not needed - SessionAuthentication not enabled in DRF config\n // Your API uses JWT/Token authentication (no CSRF required)\n\n // Log request\n if (this.logger) {\n this.logger.logRequest({\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n });\n }\n\n try {\n // Make request via HTTP adapter\n const response = await this.httpClient.request<T>({\n method,\n url: url,\n headers,\n params: options?.params,\n body: options?.body,\n formData: options?.formData,\n binaryBody: options?.binaryBody,\n });\n\n const duration = Date.now() - startTime;\n\n // Check for HTTP errors\n if (response.status >= 400) {\n const error = new APIError(\n response.status,\n response.statusText,\n response.data,\n url\n );\n\n // Log error\n if (this.logger) {\n this.logger.logError(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n message: error.message,\n statusCode: response.status,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n throw error;\n }\n\n // Log successful response\n if (this.logger) {\n this.logger.logResponse(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n status: response.status,\n statusText: response.statusText,\n data: response.data,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n return response.data as T;\n } catch (error) {\n const duration = Date.now() - startTime;\n\n // Re-throw APIError as-is\n if (error instanceof APIError) {\n throw error;\n }\n\n // Detect CORS errors and dispatch event\n const isCORSError = error instanceof TypeError &&\n (error.message.toLowerCase().includes('cors') ||\n error.message.toLowerCase().includes('failed to fetch') ||\n error.message.toLowerCase().includes('network request failed'));\n\n // Log specific error type first\n if (this.logger) {\n if (isCORSError) {\n this.logger.error(`🚫 CORS Error: ${method} ${url}`);\n this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);\n this.logger.error(` → Configure security_domains parameter on the server`);\n } else {\n this.logger.error(`⚠️ Network Error: ${method} ${url}`);\n this.logger.error(` → ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n\n // Dispatch browser events\n if (typeof window !== 'undefined') {\n try {\n if (isCORSError) {\n // Dispatch CORS-specific error event\n window.dispatchEvent(new CustomEvent('cors-error', {\n detail: {\n url: url,\n method: method,\n error: error instanceof Error ? error.message : String(error),\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n }));\n } else {\n // Dispatch generic network error event\n window.dispatchEvent(new CustomEvent('network-error', {\n detail: {\n url: url,\n method: method,\n error: error instanceof Error ? error.message : String(error),\n timestamp: new Date(),\n },\n bubbles: true,\n cancelable: false,\n }));\n }\n } catch (eventError) {\n // Silently fail - event dispatch should never crash the app\n }\n }\n\n // Wrap other errors as NetworkError\n const networkError = error instanceof Error\n ? new NetworkError(error.message, url, error)\n : new NetworkError('Unknown error', url);\n\n // Detailed logging via logger.logError\n if (this.logger) {\n this.logger.logError(\n {\n method,\n url: url,\n headers,\n body: options?.formData || options?.body,\n timestamp: startTime,\n },\n {\n message: networkError.message,\n duration,\n timestamp: Date.now(),\n }\n );\n }\n\n throw networkError;\n }\n }\n}\n","// @ts-nocheck\n// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Storage adapters for cross-platform token storage.\n *\n * Supports:\n * - LocalStorage (browser)\n * - Cookies (SSR/browser)\n * - Memory (Node.js/Electron/testing)\n */\n\nimport type { APILogger } from './logger';\n\n/**\n * Storage adapter interface for cross-platform token storage.\n */\nexport interface StorageAdapter {\n getItem(key: string): string | null;\n setItem(key: string, value: string): void;\n removeItem(key: string): void;\n}\n\n/**\n * LocalStorage adapter with safe try-catch for browser environments.\n * Works in modern browsers with localStorage support.\n * \n * Note: This adapter uses window.localStorage and should only be used in browser/client environments.\n * For server-side usage, use MemoryStorageAdapter or CookieStorageAdapter instead.\n */\nexport class LocalStorageAdapter implements StorageAdapter {\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n const value = localStorage.getItem(key);\n this.logger?.debug(`LocalStorage.getItem(\"${key}\"): ${value ? 'found' : 'not found'}`);\n return value;\n }\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n } catch (error) {\n this.logger?.error('LocalStorage.getItem failed:', error);\n }\n return null;\n }\n\n setItem(key: string, value: string): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n localStorage.setItem(key, value);\n this.logger?.debug(`LocalStorage.setItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n }\n } catch (error) {\n this.logger?.error('LocalStorage.setItem failed:', error);\n }\n }\n\n removeItem(key: string): void {\n try {\n if (typeof window !== 'undefined' && window.localStorage) {\n localStorage.removeItem(key);\n this.logger?.debug(`LocalStorage.removeItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('LocalStorage not available: window.localStorage is undefined');\n }\n } catch (error) {\n this.logger?.error('LocalStorage.removeItem failed:', error);\n }\n }\n}\n\n/**\n * Cookie-based storage adapter for SSR and browser environments.\n * Useful for Next.js, Nuxt.js, and other SSR frameworks.\n */\nexport class CookieStorageAdapter implements StorageAdapter {\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n try {\n if (typeof document === 'undefined') {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n return null;\n }\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${key}=`);\n if (parts.length === 2) {\n const result = parts.pop()?.split(';').shift() || null;\n this.logger?.debug(`CookieStorage.getItem(\"${key}\"): ${result ? 'found' : 'not found'}`);\n return result;\n }\n this.logger?.debug(`CookieStorage.getItem(\"${key}\"): not found`);\n } catch (error) {\n this.logger?.error('CookieStorage.getItem failed:', error);\n }\n return null;\n }\n\n setItem(key: string, value: string): void {\n try {\n if (typeof document !== 'undefined') {\n document.cookie = `${key}=${value}; path=/; max-age=31536000`;\n this.logger?.debug(`CookieStorage.setItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n }\n } catch (error) {\n this.logger?.error('CookieStorage.setItem failed:', error);\n }\n }\n\n removeItem(key: string): void {\n try {\n if (typeof document !== 'undefined') {\n document.cookie = `${key}=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT`;\n this.logger?.debug(`CookieStorage.removeItem(\"${key}\"): success`);\n } else {\n this.logger?.warn('Cookies not available: document is undefined (SSR context?)');\n }\n } catch (error) {\n this.logger?.error('CookieStorage.removeItem failed:', error);\n }\n }\n}\n\n/**\n * In-memory storage adapter for Node.js, Electron, and testing environments.\n * Data is stored in RAM and cleared when process exits.\n */\nexport class MemoryStorageAdapter implements StorageAdapter {\n private storage: Map<string, string> = new Map();\n private logger?: APILogger;\n\n constructor(logger?: APILogger) {\n this.logger = logger;\n }\n\n getItem(key: string): string | null {\n const value = this.storage.get(key) || null;\n this.logger?.debug(`MemoryStorage.getItem(\"${key}\"): ${value ? 'found' : 'not found'}`);\n return value;\n }\n\n setItem(key: string, value: string): void {\n this.storage.set(key, value);\n this.logger?.debug(`MemoryStorage.setItem(\"${key}\"): success`);\n }\n\n removeItem(key: string): void {\n this.storage.delete(key);\n this.logger?.debug(`MemoryStorage.removeItem(\"${key}\"): success`);\n }\n}","// @ts-nocheck\n// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * * `JS_ERROR` - JS_ERROR\n * * `NETWORK_ERROR` - NETWORK_ERROR\n * * `ERROR` - ERROR\n * * `WARNING` - WARNING\n * * `PAGE_VIEW` - PAGE_VIEW\n * * `PERFORMANCE` - PERFORMANCE\n * * `CONSOLE` - CONSOLE\n */\nexport enum FrontendEventIngestRequestEventType {\n JS_ERROR = \"JS_ERROR\",\n NETWORK_ERROR = \"NETWORK_ERROR\",\n ERROR = \"ERROR\",\n WARNING = \"WARNING\",\n PAGE_VIEW = \"PAGE_VIEW\",\n PERFORMANCE = \"PERFORMANCE\",\n CONSOLE = \"CONSOLE\",\n}\n\n/**\n * * `error` - error\n * * `warning` - warning\n * * `info` - info\n * * `debug` - debug\n */\nexport enum FrontendEventIngestRequestLevel {\n ERROR = \"error\",\n WARNING = \"warning\",\n INFO = \"info\",\n DEBUG = \"debug\",\n}\n\n","/**\n * Zod schema for FrontendEventIngestRequest\n *\n * This schema provides runtime validation and type inference.\n * * Single browser event payload.\n * */\nimport { z } from 'zod'\nimport * as Enums from '../../enums'\n\n/**\n * Single browser event payload.\n */\nexport const FrontendEventIngestRequestSchema = z.object({\n event_type: z.nativeEnum(Enums.FrontendEventIngestRequestEventType),\n message: z.string().min(1).max(5000),\n level: z.nativeEnum(Enums.FrontendEventIngestRequestLevel).optional(),\n stack_trace: z.string().max(10000).optional(),\n url: z.string().max(2000).optional(),\n fingerprint: z.string().max(64).optional(),\n http_status: z.number().int().nullable().optional(),\n http_method: z.string().max(10).optional(),\n http_url: z.string().max(2000).optional(),\n session_id: z.string().max(64).optional(),\n user_agent: z.string().max(500).optional(),\n build_id: z.string().max(100).optional(),\n environment: z.string().max(20).optional(),\n extra: z.record(z.string(), z.any()).optional(),\n project_name: z.string().max(100).optional(),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type FrontendEventIngestRequest = z.infer<typeof FrontendEventIngestRequestSchema>","/**\n * Zod schema for IngestBatchRequest\n *\n * This schema provides runtime validation and type inference.\n * * Batch of up to 50 browser events.\n * */\nimport { z } from 'zod'\nimport { FrontendEventIngestRequestSchema } from './FrontendEventIngestRequest.schema'\n\n/**\n * Batch of up to 50 browser events.\n */\nexport const IngestBatchRequestSchema = z.object({\n events: z.array(FrontendEventIngestRequestSchema),\n})\n\n/**\n * Infer TypeScript type from Zod schema\n */\nexport type IngestBatchRequest = z.infer<typeof IngestBatchRequestSchema>","// @ts-nocheck\n// Auto-generated by DjangoCFG - see CLAUDE.md\n/**\n * Django CFG API - API Client with JWT Management\n *\n * Usage:\n * ```typescript\n * import { API } from './api';\n *\n * const api = new API('https://api.example.com');\n *\n * // Set JWT token\n * api.setToken('your-jwt-token', 'refresh-token');\n *\n * // Use API\n * const posts = await api.posts.list();\n * const user = await api.users.retrieve(1);\n *\n * // Check authentication\n * if (api.isAuthenticated()) {\n * // ...\n * }\n *\n * // Custom storage with logging (for Electron/Node.js)\n * import { MemoryStorageAdapter, APILogger } from './storage';\n * const logger = new APILogger({ enabled: true, logLevel: 'debug' });\n * const api = new API('https://api.example.com', {\n * storage: new MemoryStorageAdapter(logger),\n * loggerConfig: { enabled: true, logLevel: 'debug' }\n * });\n *\n * // Get OpenAPI schema\n * const schema = api.getSchema();\n * ```\n */\n\nimport { APIClient } from \"./client\";\nimport {\n StorageAdapter,\n LocalStorageAdapter,\n CookieStorageAdapter,\n MemoryStorageAdapter\n} from \"./storage\";\nimport type { RetryConfig } from \"./retry\";\nimport type { LoggerConfig } from \"./logger\";\nimport { APILogger } from \"./logger\";\nimport { Monitor } from \"./monitor/client\";\nexport * as MonitorTypes from \"./monitor/models\";\n// Note: Direct exports (export * from) are removed to avoid duplicate type conflicts\n// Use namespace exports like CfgAccountsTypes.User or import from specific modules\nexport * as Enums from \"./enums\";\n\n// Re-export Zod schemas for runtime validation\nexport * as Schemas from \"./_utils/schemas\";\n// Also export all schemas directly for convenience\nexport * from \"./_utils/schemas\";\n\n// Re-export Zod validation events for browser integration\nexport type { ValidationErrorDetail, ValidationErrorEvent } from \"./validation-events\";\nexport { dispatchValidationError, onValidationError, formatZodError } from \"./validation-events\";\n\n// Re-export typed fetchers for universal usage\nexport * as Fetchers from \"./_utils/fetchers\";\nexport * from \"./_utils/fetchers\";\n\n// Re-export API instance configuration functions\nexport {\n configureAPI,\n getAPIInstance,\n reconfigureAPI,\n clearAPITokens,\n resetAPI,\n isAPIConfigured\n} from \"./api-instance\";\n// NOTE: SWR hooks are generated in ./_utils/hooks/ but NOT exported here to keep\n// the main bundle server-safe. Import hooks directly from the hooks directory:\n// import { useUsers } from './_utils/hooks';\n// Or use a separate entry point like '@djangocfg/api/hooks' for client components.\n\n// Re-export core client\nexport { APIClient };\n\n// Re-export storage adapters for convenience\nexport type { StorageAdapter };\nexport { LocalStorageAdapter, CookieStorageAdapter, MemoryStorageAdapter };\n\n// Re-export error classes for convenience\nexport { APIError, NetworkError } from \"./errors\";\n\n// Re-export HTTP adapters for custom implementations\nexport type { HttpClientAdapter, HttpRequest, HttpResponse } from \"./http\";\nexport { FetchAdapter, KeepAliveFetchAdapter } from \"./http\";\n\n// Re-export logger types and classes\nexport type { LoggerConfig, RequestLog, ResponseLog, ErrorLog } from \"./logger\";\nexport { APILogger } from \"./logger\";\n\n// Re-export retry configuration and utilities\nexport type { RetryConfig, FailedAttemptInfo } from \"./retry\";\nexport { withRetry, shouldRetry, DEFAULT_RETRY_CONFIG } from \"./retry\";\n\nexport const TOKEN_KEY = \"auth_token\";\nexport const REFRESH_TOKEN_KEY = \"refresh_token\";\n\n/** Auto-detect locale from cookie NEXT_LOCALE or navigator.language */\nfunction detectLocale(): string | null {\n try {\n if (typeof document !== 'undefined') {\n const match = document.cookie.match(/(?:^|;\\s*)NEXT_LOCALE=([^;]*)/);\n if (match) return match[1];\n }\n if (typeof navigator !== 'undefined' && navigator.language) {\n return navigator.language;\n }\n } catch {}\n return null;\n}\n\nexport interface APIOptions {\n /** Custom storage adapter (defaults to LocalStorageAdapter) */\n storage?: StorageAdapter;\n /** Custom HTTP client adapter (defaults to FetchAdapter) */\n httpClient?: HttpClientAdapter;\n /** Retry configuration for failed requests */\n retryConfig?: RetryConfig;\n /** Logger configuration */\n loggerConfig?: Partial<LoggerConfig>;\n /** Locale for Accept-Language header (e.g. 'en', 'ko', 'ru') */\n locale?: string;\n}\n\nexport class API {\n private baseUrl: string;\n private _client: APIClient;\n private _token: string | null = null;\n private _refreshToken: string | null = null;\n private _locale: string | null = null;\n private storage: StorageAdapter;\n private options?: APIOptions;\n\n // Sub-clients\n public monitor!: Monitor;\n\n constructor(baseUrl: string, options?: APIOptions) {\n this.baseUrl = baseUrl;\n this.options = options;\n\n // Create logger if config provided\n const logger = options?.loggerConfig ? new APILogger(options.loggerConfig) : undefined;\n\n // Initialize storage with logger\n this.storage = options?.storage || new LocalStorageAdapter(logger);\n\n this._locale = options?.locale || null;\n\n this._loadTokensFromStorage();\n\n // Initialize APIClient with token getter for URL authentication\n this._client = new APIClient(this.baseUrl, {\n httpClient: this.options?.httpClient,\n retryConfig: this.options?.retryConfig,\n loggerConfig: this.options?.loggerConfig,\n tokenGetter: () => this.getToken(),\n });\n\n // Always inject auth header wrapper (reads token dynamically from storage)\n this._injectAuthHeader();\n\n // Initialize sub-clients from APIClient\n this.monitor = this._client.monitor;\n }\n\n private _loadTokensFromStorage(): void {\n this._token = this.storage.getItem(TOKEN_KEY);\n this._refreshToken = this.storage.getItem(REFRESH_TOKEN_KEY);\n }\n\n private _reinitClients(): void {\n this._client = new APIClient(this.baseUrl, {\n httpClient: this.options?.httpClient,\n retryConfig: this.options?.retryConfig,\n loggerConfig: this.options?.loggerConfig,\n tokenGetter: () => this.getToken(),\n });\n\n // Always inject auth header wrapper (reads token dynamically from storage)\n this._injectAuthHeader();\n\n // Reinitialize sub-clients\n this.monitor = this._client.monitor;\n }\n\n private _injectAuthHeader(): void {\n // Override request method to inject auth header\n const originalRequest = this._client.request.bind(this._client);\n this._client.request = async <T>(\n method: string,\n path: string,\n options?: { params?: Record<string, any>; body?: any; formData?: FormData; headers?: Record<string, string> }\n ): Promise<T> => {\n // Read token from storage dynamically (supports JWT injection after instantiation)\n const token = this.getToken();\n const locale = this._locale || detectLocale();\n const mergedOptions = {\n ...options,\n headers: {\n ...(options?.headers || {}),\n ...(token ? { 'Authorization': `Bearer ${token}` } : {}),\n ...(locale ? { 'Accept-Language': locale } : {}),\n },\n };\n\n return originalRequest(method, path, mergedOptions);\n };\n }\n\n /**\n * Get current JWT token\n */\n getToken(): string | null {\n return this.storage.getItem(TOKEN_KEY);\n }\n\n /**\n * Get current refresh token\n */\n getRefreshToken(): string | null {\n return this.storage.getItem(REFRESH_TOKEN_KEY);\n }\n\n /**\n * Set JWT token and refresh token\n * @param token - JWT access token\n * @param refreshToken - JWT refresh token (optional)\n */\n setToken(token: string, refreshToken?: string): void {\n this._token = token;\n this.storage.setItem(TOKEN_KEY, token);\n\n if (refreshToken) {\n this._refreshToken = refreshToken;\n this.storage.setItem(REFRESH_TOKEN_KEY, refreshToken);\n }\n\n // Reinitialize clients with new token\n this._reinitClients();\n }\n\n /**\n * Clear all tokens\n */\n clearTokens(): void {\n this._token = null;\n this._refreshToken = null;\n this.storage.removeItem(TOKEN_KEY);\n this.storage.removeItem(REFRESH_TOKEN_KEY);\n\n // Reinitialize clients without token\n this._reinitClients();\n }\n\n /**\n * Check if user is authenticated\n */\n isAuthenticated(): boolean {\n return !!this.getToken();\n }\n\n /**\n * Update base URL and reinitialize clients\n * @param url - New base URL\n */\n setBaseUrl(url: string): void {\n this.baseUrl = url;\n this._reinitClients();\n }\n\n /**\n * Get current base URL\n */\n getBaseUrl(): string {\n return this.baseUrl;\n }\n\n /**\n * Set locale for Accept-Language header\n * @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear\n */\n setLocale(locale: string | null): void {\n this._locale = locale;\n }\n\n /**\n * Get current locale\n */\n getLocale(): string | null {\n return this._locale;\n }\n\n /**\n * Get OpenAPI schema path\n * @returns Path to the OpenAPI schema JSON file\n *\n * Note: The OpenAPI schema is available in the schema.json file.\n * You can load it dynamically using:\n * ```typescript\n * const schema = await fetch('./schema.json').then(r => r.json());\n * // or using fs in Node.js:\n * // const schema = JSON.parse(fs.readFileSync('./schema.json', 'utf-8'));\n * ```\n */\n getSchemaPath(): string {\n return './schema.json';\n }\n}\n\nexport default API;","/**\n * BaseClient for @djangocfg/monitor\n *\n * Singleton monitorApi instance for the frontend monitor ingest endpoint.\n * Uses MemoryStorageAdapter — ingest is public (no auth tokens needed).\n */\n\nimport { API, MemoryStorageAdapter } from './generated/cfg_monitor'\n\nexport const monitorApi = new API('', { storage: new MemoryStorageAdapter() })\n\nexport function configureMonitorApi(baseUrl: string): void {\n monitorApi.setBaseUrl(baseUrl)\n}\n\nexport class BaseClient {\n protected static monitorApi = monitorApi\n}\n","/**\n * @djangocfg/monitor/server\n *\n * Server-side monitor for Next.js route handlers, Server Components,\n * and middleware. Does NOT use browser APIs — safe in Node.js / Edge Runtime.\n *\n * @example\n * ```ts\n * // lib/monitor.ts\n * import { serverMonitor } from '@djangocfg/monitor/server'\n * serverMonitor.configure({ project: 'my-app', environment: 'production', baseUrl: 'https://api.myapp.com' })\n * export { serverMonitor }\n *\n * // app/api/orders/route.ts\n * import { serverMonitor } from '@/lib/monitor'\n * export async function POST(req: Request) {\n * try { ... } catch (err) {\n * await serverMonitor.captureError(err, { url: req.url })\n * return new Response('Internal Server Error', { status: 500 })\n * }\n * }\n * ```\n */\n\nimport { monitorApi, configureMonitorApi, EventType, EventLevel } from '../_api'\nimport type { FrontendEventIngestRequest } from '../_api'\nimport type { ServerMonitorConfig } from '../types'\n\nexport type { ServerMonitorConfig } from '../types'\nexport type { EventType, EventLevel, MonitorEvent } from '../types'\n\nlet _config: ServerMonitorConfig = {}\n\nasync function send(events: FrontendEventIngestRequest[]): Promise<void> {\n if (events.length === 0) return\n try {\n await monitorApi.monitor.ingestCreate({ events })\n } catch {\n // Never throw from monitor\n }\n}\n\nfunction withDefaults(event: FrontendEventIngestRequest): FrontendEventIngestRequest {\n return { project_name: _config.project, environment: _config.environment, ...event }\n}\n\nexport const serverMonitor = {\n configure(config: ServerMonitorConfig): void {\n _config = config\n if (config.baseUrl) configureMonitorApi(config.baseUrl)\n },\n\n async captureError(err: unknown, ctx?: { url?: string; extra?: Record<string, unknown> }): Promise<void> {\n await send([withDefaults({\n event_type: EventType.JS_ERROR,\n level: EventLevel.ERROR,\n message: err instanceof Error ? err.message : String(err),\n stack_trace: err instanceof Error ? (err.stack ?? '') : '',\n url: ctx?.url ?? '',\n extra: ctx?.extra,\n })])\n },\n\n async captureNetworkError(\n status: number,\n method: string,\n apiUrl: string,\n ctx?: { pageUrl?: string; extra?: Record<string, unknown> },\n ): Promise<void> {\n await send([withDefaults({\n event_type: EventType.NETWORK_ERROR,\n level: status >= 500 ? EventLevel.ERROR : EventLevel.WARNING,\n message: `HTTP ${status} — ${method} ${apiUrl}`,\n url: ctx?.pageUrl ?? '',\n http_status: status,\n http_method: method,\n http_url: apiUrl,\n extra: ctx?.extra,\n })])\n },\n\n async capture(event: FrontendEventIngestRequest): Promise<void> {\n await send([withDefaults(event)])\n },\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,aAAS,eAAe,UAAU,SAAS;AAEzC,UAAI,OAAO,YAAY,WAAW;AAChC,kBAAU,EAAE,SAAS,QAAQ;AAAA,MAC/B;AAEA,WAAK,oBAAoB,KAAK,MAAM,KAAK,UAAU,QAAQ,CAAC;AAC5D,WAAK,YAAY;AACjB,WAAK,WAAW,WAAW,CAAC;AAC5B,WAAK,gBAAgB,WAAW,QAAQ,gBAAgB;AACxD,WAAK,MAAM;AACX,WAAK,UAAU,CAAC;AAChB,WAAK,YAAY;AACjB,WAAK,oBAAoB;AACzB,WAAK,sBAAsB;AAC3B,WAAK,WAAW;AAChB,WAAK,kBAAkB;AACvB,WAAK,SAAS;AAEd,UAAI,KAAK,SAAS,SAAS;AACzB,aAAK,kBAAkB,KAAK,UAAU,MAAM,CAAC;AAAA,MAC/C;AAAA,IACF;AAtBS;AAuBT,WAAO,UAAU;AAEjB,mBAAe,UAAU,QAAQ,WAAW;AAC1C,WAAK,YAAY;AACjB,WAAK,YAAY,KAAK,kBAAkB,MAAM,CAAC;AAAA,IACjD;AAEA,mBAAe,UAAU,OAAO,WAAW;AACzC,UAAI,KAAK,UAAU;AACjB,qBAAa,KAAK,QAAQ;AAAA,MAC5B;AACA,UAAI,KAAK,QAAQ;AACf,qBAAa,KAAK,MAAM;AAAA,MAC1B;AAEA,WAA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A,MACrB,aAAa;AAAA,MACb,aAAa;AAAA,MACb,UAAU;AAAA,MACV,OAAO,KAAK;AAAA,IACd,CAAC,CAAC,CAAC;AAAA,EACL;AAAA,EAEA,MAAM,QAAQ,OAAkD;AAC9D,UAAM,KAAK,CAAC,aAAa,KAAK,CAAC,CAAC;AAAA,EAClC;AACF;","names":["original","require_retry","retry","FrontendEventIngestRequestEventType","FrontendEventIngestRequestLevel","z","z"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/monitor",
3
- "version": "2.1.227",
3
+ "version": "2.1.229",
4
4
  "description": "Browser error and event monitoring SDK for django-cfg backends. Captures JS errors, network failures, console logs, and performance metrics.",
5
5
  "keywords": [
6
6
  "django",
@@ -83,7 +83,7 @@
83
83
  }
84
84
  },
85
85
  "devDependencies": {
86
- "@djangocfg/typescript-config": "^2.1.227",
86
+ "@djangocfg/typescript-config": "^2.1.229",
87
87
  "p-retry": "^6.2.0",
88
88
  "@types/node": "^24.7.2",
89
89
  "@types/react": "^19.1.0",
@@ -2,13 +2,13 @@
2
2
  * Zod schema for FrontendEventIngestRequest
3
3
  *
4
4
  * This schema provides runtime validation and type inference.
5
- * * Validates a single event from the browser.
5
+ * * Single browser event payload.
6
6
  * */
7
7
  import { z } from 'zod'
8
8
  import * as Enums from '../../enums'
9
9
 
10
10
  /**
11
- * Validates a single event from the browser.
11
+ * Single browser event payload.
12
12
  */
13
13
  export const FrontendEventIngestRequestSchema = z.object({
14
14
  event_type: z.nativeEnum(Enums.FrontendEventIngestRequestEventType),
@@ -20,13 +20,12 @@ export const FrontendEventIngestRequestSchema = z.object({
20
20
  http_status: z.number().int().nullable().optional(),
21
21
  http_method: z.string().max(10).optional(),
22
22
  http_url: z.string().max(2000).optional(),
23
+ session_id: z.string().max(64).optional(),
23
24
  user_agent: z.string().max(500).optional(),
24
- session_id: z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).nullable().optional(),
25
- browser_fingerprint: z.string().max(64).optional(),
25
+ build_id: z.string().max(100).optional(),
26
+ environment: z.string().max(20).optional(),
26
27
  extra: z.record(z.string(), z.any()).optional(),
27
28
  project_name: z.string().max(100).optional(),
28
- environment: z.string().max(20).optional(),
29
- build_id: z.string().max(100).optional(),
30
29
  })
31
30
 
32
31
  /**
@@ -2,13 +2,13 @@
2
2
  * Zod schema for IngestBatchRequest
3
3
  *
4
4
  * This schema provides runtime validation and type inference.
5
- * * Wraps a list of events. Enforces max batch size.
5
+ * * Batch of up to 50 browser events.
6
6
  * */
7
7
  import { z } from 'zod'
8
8
  import { FrontendEventIngestRequestSchema } from './FrontendEventIngestRequest.schema'
9
9
 
10
10
  /**
11
- * Wraps a list of events. Enforces max batch size.
11
+ * Batch of up to 50 browser events.
12
12
  */
13
13
  export const IngestBatchRequestSchema = z.object({
14
14
  events: z.array(FrontendEventIngestRequestSchema),
@@ -1,35 +1,33 @@
1
1
  // @ts-nocheck
2
2
  // Auto-generated by DjangoCFG - see CLAUDE.md
3
3
  /**
4
- * * `ERROR` - Error
5
- * * `WARNING` - Warning
6
- * * `INFO` - Info
7
- * * `PAGE_VIEW` - Page View
8
- * * `PERFORMANCE` - Performance
9
- * * `NETWORK_ERROR` - Network Error
10
- * * `JS_ERROR` - JS Error
11
- * * `CONSOLE` - Console
4
+ * * `JS_ERROR` - JS_ERROR
5
+ * * `NETWORK_ERROR` - NETWORK_ERROR
6
+ * * `ERROR` - ERROR
7
+ * * `WARNING` - WARNING
8
+ * * `PAGE_VIEW` - PAGE_VIEW
9
+ * * `PERFORMANCE` - PERFORMANCE
10
+ * * `CONSOLE` - CONSOLE
12
11
  */
13
12
  export enum FrontendEventIngestRequestEventType {
13
+ JS_ERROR = "JS_ERROR",
14
+ NETWORK_ERROR = "NETWORK_ERROR",
14
15
  ERROR = "ERROR",
15
16
  WARNING = "WARNING",
16
- INFO = "INFO",
17
17
  PAGE_VIEW = "PAGE_VIEW",
18
18
  PERFORMANCE = "PERFORMANCE",
19
- NETWORK_ERROR = "NETWORK_ERROR",
20
- JS_ERROR = "JS_ERROR",
21
19
  CONSOLE = "CONSOLE",
22
20
  }
23
21
 
24
22
  /**
25
- * * `error` - Error
26
- * * `warn` - Warning
27
- * * `info` - Info
28
- * * `debug` - Debug
23
+ * * `error` - error
24
+ * * `warning` - warning
25
+ * * `info` - info
26
+ * * `debug` - debug
29
27
  */
30
28
  export enum FrontendEventIngestRequestLevel {
31
29
  ERROR = "error",
32
- WARN = "warn",
30
+ WARNING = "warning",
33
31
  INFO = "info",
34
32
  DEBUG = "debug",
35
33
  }
@@ -15,7 +15,8 @@ export class Monitor {
15
15
  /**
16
16
  * Ingest browser events
17
17
  *
18
- * Accepts a batch of up to 50 frontend events. No authentication required.
18
+ * Accepts a batch of up to 50 frontend events. No authentication required
19
+ * — anonymous visitors can send events.
19
20
  */
20
21
  async ingestCreate(data: Models.IngestBatchRequest): Promise<any> {
21
22
  const response = await this.client.request('POST', "/cfg/monitor/ingest/", { body: data });