@lyxa.ai/core 1.3.276 → 1.3.277

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.
@@ -8,7 +8,7 @@ function corsMiddleware(options = {}) {
8
8
  credentials: options.credentials || false,
9
9
  maxAge: options.maxAge || 86400,
10
10
  preflightContinue: options.preflightContinue || false,
11
- allowedHeaders: options.allowedHeaders || ['Content-Type', 'Authorization', 'X-Requested-With', 'x-refresh-token'],
11
+ allowedHeaders: options.allowedHeaders || ['Content-Type', 'Authorization', 'X-Requested-With', 'x-refresh-token', 'x-client-type'],
12
12
  exposedHeaders: options.exposedHeaders || ['Content-Range', 'X-Content-Range', 'X-New-Access-Token', 'X-New-Refresh-Token'],
13
13
  };
14
14
  const methodsString = Array.isArray(config.methods) ? config.methods.join(', ') : config.methods;
@@ -1 +1 @@
1
- {"version":3,"file":"cors.js","sourceRoot":"/","sources":["libraries/trpc/middlewares/cors.ts"],"names":[],"mappings":";;AAqBA,wCA6DC;AA7DD,SAAgB,cAAc,CAAC,UAAuB,EAAE;IAEvD,MAAM,MAAM,GAA0B;QACrC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,GAAG;QAC7B,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,CAAC,oBAAoB,CAAC;QAClD,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,KAAK;QACzC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,KAAK;QAC/B,iBAAiB,EAAE,OAAO,CAAC,iBAAiB,IAAI,KAAK;QACrD,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,CAAC,cAAc,EAAE,eAAe,EAAE,kBAAkB,EAAE,iBAAiB,CAAC;QAClH,cAAc,EAAE,OAAO,CAAC,cAAc,IAAI,CAAC,eAAe,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,qBAAqB,CAAC;KAC3H,CAAC;IAGF,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAA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YAGD,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC9B,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;gBACnB,GAAG,CAAC,GAAG,EAAE,CAAC;gBACV,OAAO;YACR,CAAC;YAGD,IAAI,EAAE,CAAC;QACR,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAEhB,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;YAE/C,IAAI,EAAE,CAAC;QACR,CAAC;IACF,CAAC,CAAC;AACH,CAAC","sourcesContent":["import type { IncomingMessage, ServerResponse } from 'http';\n\n/**\n * Interface for CORS middleware options\n */\ninterface CorsOptions {\n\torigin?: string | string[];\n\tmethods?: string[];\n\tallowedHeaders?: string[];\n\texposedHeaders?: string[];\n\tcredentials?: boolean;\n\tmaxAge?: number;\n\tpreflightContinue?: boolean;\n}\n\n/**\n * Creates a configurable CORS middleware for tRPC applications\n *\n * @param options Configuration options for CORS\n * @returns A middleware function for handling CORS\n */\nexport function corsMiddleware(options: CorsOptions = {}) {\n\t// Default configuration with sensible values\n\tconst config: Required<CorsOptions> = {\n\t\torigin: options.origin || '*',\n\t\tmethods: options.methods || ['GET, POST, OPTIONS'],\n\t\tcredentials: options.credentials || false,\n\t\tmaxAge: options.maxAge || 86400, // 24 hours\n\t\tpreflightContinue: options.preflightContinue || false,\n\t\tallowedHeaders: options.allowedHeaders || ['Content-Type', 'Authorization', 'X-Requested-With', 'x-refresh-token'],\n\t\texposedHeaders: options.exposedHeaders || ['Content-Range', 'X-Content-Range', 'X-New-Access-Token', 'X-New-Refresh-Token'],\n\t};\n\n\t// Convert arrays to comma-separated strings for header values\n\tconst methodsString = Array.isArray(config.methods) ? config.methods.join(', ') : config.methods;\n\tconst allowedHeadersString = Array.isArray(config.allowedHeaders)\n\t\t? config.allowedHeaders.join(', ')\n\t\t: config.allowedHeaders;\n\tconst exposedHeadersString = Array.isArray(config.exposedHeaders)\n\t\t? config.exposedHeaders.join(', ')\n\t\t: config.exposedHeaders;\n\n\t// Return the middleware function\n\treturn (req: IncomingMessage, res: ServerResponse, next: () => void) => {\n\t\ttry {\n\t\t\t// Always set the CORS headers\n\t\t\tres.setHeader('Access-Control-Allow-Origin', config.origin);\n\n\t\t\t// Only set other headers if origin is not blocking the request\n\t\t\tif (config.origin !== 'none') {\n\t\t\t\tres.setHeader('Access-Control-Allow-Methods', methodsString);\n\t\t\t\tres.setHeader('Access-Control-Allow-Headers', allowedHeadersString);\n\n\t\t\t\tif (exposedHeadersString) {\n\t\t\t\t\tres.setHeader('Access-Control-Expose-Headers', exposedHeadersString);\n\t\t\t\t}\n\n\t\t\t\tif (config.credentials) {\n\t\t\t\t\tres.setHeader('Access-Control-Allow-Credentials', 'true');\n\t\t\t\t}\n\n\t\t\t\tif (config.maxAge) {\n\t\t\t\t\tres.setHeader('Access-Control-Max-Age', config.maxAge.toString());\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Handle OPTIONS preflight requests\n\t\t\tif (req.method === 'OPTIONS') {\n\t\t\t\tres.writeHead(204); // 204 No Content is more appropriate for preflight\n\t\t\t\tres.end();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Move to the next middleware\n\t\t\tnext();\n\t\t} catch (error) {\n\t\t\t// Handle any errors that might occur\n\t\t\tconsole.error('CORS middleware error:', error);\n\t\t\t// Call next without the error as it expects no arguments\n\t\t\tnext();\n\t\t}\n\t};\n}\n"]}
1
+ {"version":3,"file":"cors.js","sourceRoot":"/","sources":["libraries/trpc/middlewares/cors.ts"],"names":[],"mappings":";;AAqBA,wCA6DC;AA7DD,SAAgB,cAAc,CAAC,UAAuB,EAAE;IAEvD,MAAM,MAAM,GAA0B;QACrC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,GAAG;QAC7B,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,CAAC,oBAAoB,CAAC;QAClD,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,KAAK;Q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IAAI,oBAAoB,EAAE,CAAC;oBAC1B,GAAG,CAAC,SAAS,CAAC,+BAA+B,EAAE,oBAAoB,CAAC,CAAC;gBACtE,CAAC;gBAED,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;oBACxB,GAAG,CAAC,SAAS,CAAC,kCAAkC,EAAE,MAAM,CAAC,CAAC;gBAC3D,CAAC;gBAED,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;oBACnB,GAAG,CAAC,SAAS,CAAC,wBAAwB,EAAE,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;gBACnE,CAAC;YACF,CAAC;YAGD,IAAI,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC9B,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;gBACnB,GAAG,CAAC,GAAG,EAAE,CAAC;gBACV,OAAO;YACR,CAAC;YAGD,IAAI,EAAE,CAAC;QACR,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAEhB,OAAO,CAAC,KAAK,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;YAE/C,IAAI,EAAE,CAAC;QACR,CAAC;IACF,CAAC,CAAC;AACH,CAAC","sourcesContent":["import type { IncomingMessage, ServerResponse } from 'http';\n\n/**\n * Interface for CORS middleware options\n */\ninterface CorsOptions {\n\torigin?: string | string[];\n\tmethods?: string[];\n\tallowedHeaders?: string[];\n\texposedHeaders?: string[];\n\tcredentials?: boolean;\n\tmaxAge?: number;\n\tpreflightContinue?: boolean;\n}\n\n/**\n * Creates a configurable CORS middleware for tRPC applications\n *\n * @param options Configuration options for CORS\n * @returns A middleware function for handling CORS\n */\nexport function corsMiddleware(options: CorsOptions = {}) {\n\t// Default configuration with sensible values\n\tconst config: Required<CorsOptions> = {\n\t\torigin: options.origin || '*',\n\t\tmethods: options.methods || ['GET, POST, OPTIONS'],\n\t\tcredentials: options.credentials || false,\n\t\tmaxAge: options.maxAge || 86400, // 24 hours\n\t\tpreflightContinue: options.preflightContinue || false,\n\t\tallowedHeaders: options.allowedHeaders || ['Content-Type', 'Authorization', 'X-Requested-With', 'x-refresh-token', 'x-client-type'],\n\t\texposedHeaders: options.exposedHeaders || ['Content-Range', 'X-Content-Range', 'X-New-Access-Token', 'X-New-Refresh-Token'],\n\t};\n\n\t// Convert arrays to comma-separated strings for header values\n\tconst methodsString = Array.isArray(config.methods) ? config.methods.join(', ') : config.methods;\n\tconst allowedHeadersString = Array.isArray(config.allowedHeaders)\n\t\t? config.allowedHeaders.join(', ')\n\t\t: config.allowedHeaders;\n\tconst exposedHeadersString = Array.isArray(config.exposedHeaders)\n\t\t? config.exposedHeaders.join(', ')\n\t\t: config.exposedHeaders;\n\n\t// Return the middleware function\n\treturn (req: IncomingMessage, res: ServerResponse, next: () => void) => {\n\t\ttry {\n\t\t\t// Always set the CORS headers\n\t\t\tres.setHeader('Access-Control-Allow-Origin', config.origin);\n\n\t\t\t// Only set other headers if origin is not blocking the request\n\t\t\tif (config.origin !== 'none') {\n\t\t\t\tres.setHeader('Access-Control-Allow-Methods', methodsString);\n\t\t\t\tres.setHeader('Access-Control-Allow-Headers', allowedHeadersString);\n\n\t\t\t\tif (exposedHeadersString) {\n\t\t\t\t\tres.setHeader('Access-Control-Expose-Headers', exposedHeadersString);\n\t\t\t\t}\n\n\t\t\t\tif (config.credentials) {\n\t\t\t\t\tres.setHeader('Access-Control-Allow-Credentials', 'true');\n\t\t\t\t}\n\n\t\t\t\tif (config.maxAge) {\n\t\t\t\t\tres.setHeader('Access-Control-Max-Age', config.maxAge.toString());\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Handle OPTIONS preflight requests\n\t\t\tif (req.method === 'OPTIONS') {\n\t\t\t\tres.writeHead(204); // 204 No Content is more appropriate for preflight\n\t\t\t\tres.end();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Move to the next middleware\n\t\t\tnext();\n\t\t} catch (error) {\n\t\t\t// Handle any errors that might occur\n\t\t\tconsole.error('CORS middleware error:', error);\n\t\t\t// Call next without the error as it expects no arguments\n\t\t\tnext();\n\t\t}\n\t};\n}\n"]}
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.3.276
25
+ Version: 1.3.277
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.3.276",
3
+ "version": "1.3.277",
4
4
  "description": "Lyxa type definitions and validation schemas for both frontend and backend",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/core",
3
- "version": "1.3.276",
3
+ "version": "1.3.277",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",