@priceos/next 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -71,7 +71,7 @@ function priceosHandler(options = {}) {
71
71
  return jsonResponse(401, { error: "Customer not identified" });
72
72
  }
73
73
  try {
74
- const data = await client.getCustomer(customerId);
74
+ const data = await client.customers.get(customerId);
75
75
  return jsonResponse(200, data);
76
76
  } catch (error) {
77
77
  if (error instanceof import_priceos.PriceOSError) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { PriceOS, PriceOSError } from \"priceos\";\n\nexport type PriceOSGetCustomerId = (\n request: Request\n) => string | null | undefined | Promise<string | null | undefined>;\n\nexport type PriceOSPagesRequest = {\n method?: string;\n headers?: Record<string, string | string[] | undefined>;\n url?: string;\n socket?: { encrypted?: boolean };\n};\n\nexport type PriceOSPagesResponse = {\n status?: (code: number) => PriceOSPagesResponse;\n setHeader?: (name: string, value: string | string[]) => void;\n end?: (body?: string) => void;\n statusCode?: number;\n};\n\nexport type PriceOSPagesGetCustomerId = (\n request: PriceOSPagesRequest\n) => string | null | undefined | Promise<string | null | undefined>;\n\nexport type PriceOSNextHandlerOptions = {\n apiKey?: string;\n baseUrl?: string;\n basePath?: string;\n getCustomerId?: PriceOSGetCustomerId;\n};\n\nexport type PriceOSPagesHandlerOptions = Omit<PriceOSNextHandlerOptions, \"getCustomerId\"> & {\n getCustomerId?: PriceOSPagesGetCustomerId;\n};\n\nconst DEFAULT_BASE_PATH = \"/api/priceos\";\n\nconst normalizePath = (value: string) => value.replace(/^\\/+/, \"\");\n\nconst jsonResponse = (status: number, body: unknown) =>\n new Response(JSON.stringify(body), {\n status,\n headers: { \"content-type\": \"application/json\" },\n });\n\nexport function priceosHandler(options: PriceOSNextHandlerOptions = {}) {\n const envApiKey = (globalThis as { process?: { env?: Record<string, string | undefined> } })\n .process?.env?.PRICEOS_API_KEY;\n const apiKey = options.apiKey ?? envApiKey;\n const getCustomerId = options.getCustomerId;\n const baseUrl = (options.baseUrl ?? \"https://api.priceos.com\").replace(/\\/$/, \"\");\n const basePath = (options.basePath ?? DEFAULT_BASE_PATH).replace(/\\/+$/, \"\");\n\n return async (request: Request) => {\n if (!apiKey) {\n return new Response(\"Missing PRICEOS_API_KEY.\", { status: 500 });\n }\n\n if (!getCustomerId) {\n return jsonResponse(500, { error: \"Missing getCustomerId function\" });\n }\n\n let path = \"\";\n const url = new URL(request.url);\n const pathname = url.pathname;\n if (pathname.startsWith(basePath)) {\n path = normalizePath(pathname.slice(basePath.length));\n }\n\n if (path !== \"v1/customer\") {\n return new Response(\"Not found.\", { status: 404 });\n }\n\n const client = new PriceOS(apiKey, { baseUrl });\n const method = request.method.toUpperCase();\n if (method !== \"GET\") {\n return new Response(\"Method not allowed.\", { status: 405 });\n }\n\n if (url.searchParams.has(\"customerId\")) {\n return jsonResponse(400, { error: \"customerId must be set via getCustomerId\" });\n }\n\n let customerId: string | null | undefined;\n try {\n customerId = await getCustomerId(request);\n } catch (error) {\n return jsonResponse(500, { error: \"Failed to resolve customerId\" });\n }\n\n if (typeof customerId !== \"string\" || !customerId) {\n return jsonResponse(401, { error: \"Customer not identified\" });\n }\n\n try {\n const data = await client.getCustomer(customerId);\n return jsonResponse(200, data);\n } catch (error) {\n if (error instanceof PriceOSError) {\n return jsonResponse(error.status ?? 500, { error: error.message });\n }\n return jsonResponse(500, { error: \"Request failed\" });\n }\n };\n}\n\nconst getHeaderValue = (\n headers: Record<string, string | string[] | undefined> | undefined,\n key: string\n) => {\n const value = headers?.[key];\n if (Array.isArray(value)) return value.join(\",\");\n return value;\n};\n\nconst toHeaders = (headers: Record<string, string | string[] | undefined> | undefined) => {\n const result = new Headers();\n if (!headers) return result;\n for (const [key, value] of Object.entries(headers)) {\n if (typeof value === \"string\") result.set(key, value);\n if (Array.isArray(value)) result.set(key, value.join(\",\"));\n }\n return result;\n};\n\nconst buildRequest = (req: PriceOSPagesRequest) => {\n const headers = req.headers ?? {};\n const forwardedProto = getHeaderValue(headers, \"x-forwarded-proto\");\n const protocol =\n forwardedProto?.split(\",\")[0] ?? (req.socket?.encrypted ? \"https\" : \"http\");\n const host =\n getHeaderValue(headers, \"x-forwarded-host\") ??\n getHeaderValue(headers, \"host\") ??\n \"localhost\";\n const url = new URL(req.url ?? \"/\", `${protocol}://${host}`);\n return new Request(url, { method: req.method ?? \"GET\", headers: toHeaders(headers) });\n};\n\nconst sendResponse = async (res: PriceOSPagesResponse, response: Response) => {\n if (typeof res.status === \"function\") {\n res.status(response.status);\n } else {\n res.statusCode = response.status;\n }\n\n if (typeof res.setHeader === \"function\") {\n response.headers.forEach((value, key) => {\n res.setHeader?.(key, value);\n });\n }\n\n const body = await response.text();\n res.end?.(body || undefined);\n};\n\nexport function priceosPagesHandler(options: PriceOSPagesHandlerOptions = {}) {\n return async (req: PriceOSPagesRequest, res: PriceOSPagesResponse) => {\n const getCustomerId = options.getCustomerId;\n const handler = priceosHandler({\n ...options,\n getCustomerId: getCustomerId ? () => getCustomerId(req) : undefined,\n });\n const request = buildRequest(req);\n const response = await handler(request);\n await sendResponse(res, response);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAsC;AAmCtC,IAAM,oBAAoB;AAE1B,IAAM,gBAAgB,CAAC,UAAkB,MAAM,QAAQ,QAAQ,EAAE;AAEjE,IAAM,eAAe,CAAC,QAAgB,SACpC,IAAI,SAAS,KAAK,UAAU,IAAI,GAAG;AAAA,EACjC;AAAA,EACA,SAAS,EAAE,gBAAgB,mBAAmB;AAChD,CAAC;AAEI,SAAS,eAAe,UAAqC,CAAC,GAAG;AACtE,QAAM,YAAa,WAChB,SAAS,KAAK;AACjB,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,gBAAgB,QAAQ;AAC9B,QAAM,WAAW,QAAQ,WAAW,2BAA2B,QAAQ,OAAO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AAO,IAAI,cAAc,YAAY;AACvC,aAAS,QAAQ,QAAQ,CAAC,OAAO,QAAQ;AACvC,UAAI,YAAY,KAAK,KAAK;AAAA,IAC5B,CAAC;AAAA,EACH;AAEA,QAAM,OAAO,MAAM,SAAS,KAAK;AACjC,MAAI,MAAM,QAAQ,MAAS;AAC7B;AAEO,SAAS,oBAAoB,UAAsC,CAAC,GAAG;AAC5E,SAAO,OAAO,KAA0B,QAA8B;AACpE,UAAM,gBAAgB,QAAQ;AAC9B,UAAM,UAAU,eAAe;AAAA,MAC7B,GAAG;AAAA,MACH,eAAe,gBAAgB,MAAM,cAAc,GAAG,IAAI;AAAA,IAC5D,CAAC;AACD,UAAM,UAAU,aAAa,GAAG;AAChC,UAAM,WAAW,MAAM,QAAQ,OAAO;AACtC,UAAM,aAAa,KAAK,QAAQ;AAAA,EAClC;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { PriceOS, PriceOSError } from \"priceos\";\n\nexport type PriceOSGetCustomerId = (\n request: Request\n) => string | null | undefined | Promise<string | null | undefined>;\n\nexport type PriceOSPagesRequest = {\n method?: string;\n headers?: Record<string, string | string[] | undefined>;\n url?: string;\n socket?: { encrypted?: boolean };\n};\n\nexport type PriceOSPagesResponse = {\n status?: (code: number) => PriceOSPagesResponse;\n setHeader?: (name: string, value: string | string[]) => void;\n end?: (body?: string) => void;\n statusCode?: number;\n};\n\nexport type PriceOSPagesGetCustomerId = (\n request: PriceOSPagesRequest\n) => string | null | undefined | Promise<string | null | undefined>;\n\nexport type PriceOSNextHandlerOptions = {\n apiKey?: string;\n baseUrl?: string;\n basePath?: string;\n getCustomerId?: PriceOSGetCustomerId;\n};\n\nexport type PriceOSPagesHandlerOptions = Omit<PriceOSNextHandlerOptions, \"getCustomerId\"> & {\n getCustomerId?: PriceOSPagesGetCustomerId;\n};\n\nconst DEFAULT_BASE_PATH = \"/api/priceos\";\n\nconst normalizePath = (value: string) => value.replace(/^\\/+/, \"\");\n\nconst jsonResponse = (status: number, body: unknown) =>\n new Response(JSON.stringify(body), {\n status,\n headers: { \"content-type\": \"application/json\" },\n });\n\nexport function priceosHandler(options: PriceOSNextHandlerOptions = {}) {\n const envApiKey = (globalThis as { process?: { env?: Record<string, string | undefined> } })\n .process?.env?.PRICEOS_API_KEY;\n const apiKey = options.apiKey ?? envApiKey;\n const getCustomerId = options.getCustomerId;\n const baseUrl = (options.baseUrl ?? \"https://api.priceos.com\").replace(/\\/$/, \"\");\n const basePath = (options.basePath ?? DEFAULT_BASE_PATH).replace(/\\/+$/, \"\");\n\n return async (request: Request) => {\n if (!apiKey) {\n return new Response(\"Missing PRICEOS_API_KEY.\", { status: 500 });\n }\n\n if (!getCustomerId) {\n return jsonResponse(500, { error: \"Missing getCustomerId function\" });\n }\n\n let path = \"\";\n const url = new URL(request.url);\n const pathname = url.pathname;\n if (pathname.startsWith(basePath)) {\n path = normalizePath(pathname.slice(basePath.length));\n }\n\n if (path !== \"v1/customer\") {\n return new Response(\"Not found.\", { status: 404 });\n }\n\n const client = new PriceOS(apiKey, { baseUrl });\n const method = request.method.toUpperCase();\n if (method !== \"GET\") {\n return new Response(\"Method not allowed.\", { status: 405 });\n }\n\n if (url.searchParams.has(\"customerId\")) {\n return jsonResponse(400, { error: \"customerId must be set via getCustomerId\" });\n }\n\n let customerId: string | null | undefined;\n try {\n customerId = await getCustomerId(request);\n } catch (error) {\n return jsonResponse(500, { error: \"Failed to resolve customerId\" });\n }\n\n if (typeof customerId !== \"string\" || !customerId) {\n return jsonResponse(401, { error: \"Customer not identified\" });\n }\n\n try {\n const data = await client.customers.get(customerId);\n return jsonResponse(200, data);\n } catch (error) {\n if (error instanceof PriceOSError) {\n return jsonResponse(error.status ?? 500, { error: error.message });\n }\n return jsonResponse(500, { error: \"Request failed\" });\n }\n };\n}\n\nconst getHeaderValue = (\n headers: Record<string, string | string[] | undefined> | undefined,\n key: string\n) => {\n const value = headers?.[key];\n if (Array.isArray(value)) return value.join(\",\");\n return value;\n};\n\nconst toHeaders = (headers: Record<string, string | string[] | undefined> | undefined) => {\n const result = new Headers();\n if (!headers) return result;\n for (const [key, value] of Object.entries(headers)) {\n if (typeof value === \"string\") result.set(key, value);\n if (Array.isArray(value)) result.set(key, value.join(\",\"));\n }\n return result;\n};\n\nconst buildRequest = (req: PriceOSPagesRequest) => {\n const headers = req.headers ?? {};\n const forwardedProto = getHeaderValue(headers, \"x-forwarded-proto\");\n const protocol =\n forwardedProto?.split(\",\")[0] ?? (req.socket?.encrypted ? \"https\" : \"http\");\n const host =\n getHeaderValue(headers, \"x-forwarded-host\") ??\n getHeaderValue(headers, \"host\") ??\n \"localhost\";\n const url = new URL(req.url ?? \"/\", `${protocol}://${host}`);\n return new Request(url, { method: req.method ?? \"GET\", headers: toHeaders(headers) });\n};\n\nconst sendResponse = async (res: PriceOSPagesResponse, response: Response) => {\n if (typeof res.status === \"function\") {\n res.status(response.status);\n } else {\n res.statusCode = response.status;\n }\n\n if (typeof res.setHeader === \"function\") {\n response.headers.forEach((value, key) => {\n res.setHeader?.(key, value);\n });\n }\n\n const body = await response.text();\n res.end?.(body || undefined);\n};\n\nexport function priceosPagesHandler(options: PriceOSPagesHandlerOptions = {}) {\n return async (req: PriceOSPagesRequest, res: PriceOSPagesResponse) => {\n const getCustomerId = options.getCustomerId;\n const handler = priceosHandler({\n ...options,\n getCustomerId: getCustomerId ? () => getCustomerId(req) : undefined,\n });\n const request = buildRequest(req);\n const response = await handler(request);\n await sendResponse(res, response);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAsC;AAmCtC,IAAM,oBAAoB;AAE1B,IAAM,gBAAgB,CAAC,UAAkB,MAAM,QAAQ,QAAQ,EAAE;AAEjE,IAAM,eAAe,CAAC,QAAgB,SACpC,IAAI,SAAS,KAAK,UAAU,IAAI,GAAG;AAAA,EACjC;AAAA,EACA,SAAS,EAAE,gBAAgB,mBAAmB;AAChD,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AAO,EAAE,CAAC;AACtF;AAEA,IAAM,eAAe,OAAO,KAA2B,aAAuB;AAC5E,MAAI,OAAO,IAAI,WAAW,YAAY;AACpC,QAAI,OAAO,SAAS,MAAM;AAAA,EAC5B,OAAO;AACL,QAAI,aAAa,SAAS;AAAA,EAC5B;AAEA,MAAI,OAAO,IAAI,cAAc,YAAY;AACvC,aAAS,QAAQ,QAAQ,CAAC,OAAO,QAAQ;AACvC,UAAI,YAAY,KAAK,KAAK;AAAA,IAC5B,CAAC;AAAA,EACH;AAEA,QAAM,OAAO,MAAM,SAAS,KAAK;AACjC,MAAI,MAAM,QAAQ,MAAS;AAC7B;AAEO,SAAS,oBAAoB,UAAsC,CAAC,GAAG;AAC5E,SAAO,OAAO,KAA0B,QAA8B;AACpE,UAAM,gBAAgB,QAAQ;AAC9B,UAAM,UAAU,eAAe;AAAA,MAC7B,GAAG;AAAA,MACH,eAAe,gBAAgB,MAAM,cAAc,GAAG,IAAI;AAAA,IAC5D,CAAC;AACD,UAAM,UAAU,aAAa,GAAG;AAChC,UAAM,WAAW,MAAM,QAAQ,OAAO;AACtC,UAAM,aAAa,KAAK,QAAQ;AAAA,EAClC;AACF;","names":[]}
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ function priceosHandler(options = {}) {
46
46
  return jsonResponse(401, { error: "Customer not identified" });
47
47
  }
48
48
  try {
49
- const data = await client.getCustomer(customerId);
49
+ const data = await client.customers.get(customerId);
50
50
  return jsonResponse(200, data);
51
51
  } catch (error) {
52
52
  if (error instanceof PriceOSError) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { PriceOS, PriceOSError } from \"priceos\";\n\nexport type PriceOSGetCustomerId = (\n request: Request\n) => string | null | undefined | Promise<string | null | undefined>;\n\nexport type PriceOSPagesRequest = {\n method?: string;\n headers?: Record<string, string | string[] | undefined>;\n url?: string;\n socket?: { encrypted?: boolean };\n};\n\nexport type PriceOSPagesResponse = {\n status?: (code: number) => PriceOSPagesResponse;\n setHeader?: (name: string, value: string | string[]) => void;\n end?: (body?: string) => void;\n statusCode?: number;\n};\n\nexport type PriceOSPagesGetCustomerId = (\n request: PriceOSPagesRequest\n) => string | null | undefined | Promise<string | null | undefined>;\n\nexport type PriceOSNextHandlerOptions = {\n apiKey?: string;\n baseUrl?: string;\n basePath?: string;\n getCustomerId?: PriceOSGetCustomerId;\n};\n\nexport type PriceOSPagesHandlerOptions = Omit<PriceOSNextHandlerOptions, \"getCustomerId\"> & {\n getCustomerId?: PriceOSPagesGetCustomerId;\n};\n\nconst DEFAULT_BASE_PATH = \"/api/priceos\";\n\nconst normalizePath = (value: string) => value.replace(/^\\/+/, \"\");\n\nconst jsonResponse = (status: number, body: unknown) =>\n new Response(JSON.stringify(body), {\n status,\n headers: { \"content-type\": \"application/json\" },\n });\n\nexport function priceosHandler(options: PriceOSNextHandlerOptions = {}) {\n const envApiKey = (globalThis as { process?: { env?: Record<string, string | undefined> } })\n .process?.env?.PRICEOS_API_KEY;\n const apiKey = options.apiKey ?? envApiKey;\n const getCustomerId = options.getCustomerId;\n const baseUrl = (options.baseUrl ?? \"https://api.priceos.com\").replace(/\\/$/, \"\");\n const basePath = (options.basePath ?? DEFAULT_BASE_PATH).replace(/\\/+$/, \"\");\n\n return async (request: Request) => {\n if (!apiKey) {\n return new Response(\"Missing PRICEOS_API_KEY.\", { status: 500 });\n }\n\n if (!getCustomerId) {\n return jsonResponse(500, { error: \"Missing getCustomerId function\" });\n }\n\n let path = \"\";\n const url = new URL(request.url);\n const pathname = url.pathname;\n if (pathname.startsWith(basePath)) {\n path = normalizePath(pathname.slice(basePath.length));\n }\n\n if (path !== \"v1/customer\") {\n return new Response(\"Not found.\", { status: 404 });\n }\n\n const client = new PriceOS(apiKey, { baseUrl });\n const method = request.method.toUpperCase();\n if (method !== \"GET\") {\n return new Response(\"Method not allowed.\", { status: 405 });\n }\n\n if (url.searchParams.has(\"customerId\")) {\n return jsonResponse(400, { error: \"customerId must be set via getCustomerId\" });\n }\n\n let customerId: string | null | undefined;\n try {\n customerId = await getCustomerId(request);\n } catch (error) {\n return jsonResponse(500, { error: \"Failed to resolve customerId\" });\n }\n\n if (typeof customerId !== \"string\" || !customerId) {\n return jsonResponse(401, { error: \"Customer not identified\" });\n }\n\n try {\n const data = await client.getCustomer(customerId);\n return jsonResponse(200, data);\n } catch (error) {\n if (error instanceof PriceOSError) {\n return jsonResponse(error.status ?? 500, { error: error.message });\n }\n return jsonResponse(500, { error: \"Request failed\" });\n }\n };\n}\n\nconst getHeaderValue = (\n headers: Record<string, string | string[] | undefined> | undefined,\n key: string\n) => {\n const value = headers?.[key];\n if (Array.isArray(value)) return value.join(\",\");\n return value;\n};\n\nconst toHeaders = (headers: Record<string, string | string[] | undefined> | undefined) => {\n const result = new Headers();\n if (!headers) return result;\n for (const [key, value] of Object.entries(headers)) {\n if (typeof value === \"string\") result.set(key, value);\n if (Array.isArray(value)) result.set(key, value.join(\",\"));\n }\n return result;\n};\n\nconst buildRequest = (req: PriceOSPagesRequest) => {\n const headers = req.headers ?? {};\n const forwardedProto = getHeaderValue(headers, \"x-forwarded-proto\");\n const protocol =\n forwardedProto?.split(\",\")[0] ?? (req.socket?.encrypted ? \"https\" : \"http\");\n const host =\n getHeaderValue(headers, \"x-forwarded-host\") ??\n getHeaderValue(headers, \"host\") ??\n \"localhost\";\n const url = new URL(req.url ?? \"/\", `${protocol}://${host}`);\n return new Request(url, { method: req.method ?? \"GET\", headers: toHeaders(headers) });\n};\n\nconst sendResponse = async (res: PriceOSPagesResponse, response: Response) => {\n if (typeof res.status === \"function\") {\n res.status(response.status);\n } else {\n res.statusCode = response.status;\n }\n\n if (typeof res.setHeader === \"function\") {\n response.headers.forEach((value, key) => {\n res.setHeader?.(key, value);\n });\n }\n\n const body = await response.text();\n res.end?.(body || undefined);\n};\n\nexport function priceosPagesHandler(options: PriceOSPagesHandlerOptions = {}) {\n return async (req: PriceOSPagesRequest, res: PriceOSPagesResponse) => {\n const getCustomerId = options.getCustomerId;\n const handler = priceosHandler({\n ...options,\n getCustomerId: getCustomerId ? () => getCustomerId(req) : undefined,\n });\n const request = buildRequest(req);\n const response = await handler(request);\n await sendResponse(res, response);\n };\n}\n"],"mappings":";AAAA,SAAS,SAAS,oBAAoB;AAmCtC,IAAM,oBAAoB;AAE1B,IAAM,gBAAgB,CAAC,UAAkB,MAAM,QAAQ,QAAQ,EAAE;AAEjE,IAAM,eAAe,CAAC,QAAgB,SACpC,IAAI,SAAS,KAAK,UAAU,IAAI,GAAG;AAAA,EACjC;AAAA,EACA,SAAS,EAAE,gBAAgB,mBAAmB;AAChD,CAAC;AAEI,SAAS,eAAe,UAAqC,CAAC,GAAG;AACtE,QAAM,YAAa,WAChB,SAAS,KAAK;AACjB,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,gBAAgB,QAAQ;AAC9B,QAAM,WAAW,QAAQ,WAAW,2BAA2B,QAAQ,OAAO,EAAE;AAChF,QAAM,YAAY,QAAQ,YAAY,mBAAmB,QAAQ,QAAQ,EAAE;AAE3E,SAAO,OAAO,YAAqB;AACjC,QAAI,CAAC,QAAQ;AACX,aAAO,IAAI,SAAS,4BAA4B,EAAE,QAAQ,IAAI,CAAC;AAAA,IACjE;AAEA,QAAI,CAAC,eAAe;AAClB,aAAO,aAAa,KAAK,EAAE,OAAO,iCAAiC,CAAC;AAAA,IACtE;AAEA,QAAI,OAAO;AACX,UAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;AAC/B,UAAM,WAAW,IAAI;AACrB,QAAI,SAAS,WAAW,QAAQ,GAAG;AACjC,aAAO,cAAc,SAAS,MAAM,SAAS,MAAM,CAAC;AAAA,IACtD;AAEA,QAAI,SAAS,eAAe;AAC1B,aAAO,IAAI,SAAS,cAAc,EAAE,QAAQ,IAAI,CAAC;AAAA,IACnD;AAEA,UAAM,SAAS,IAAI,QAAQ,QAAQ,EAAE,QAAQ,CAAC;AAC9C,UAAM,SAAS,QAAQ,OAAO,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QAA6B;AACjD,QAAM,UAAU,IAAI,WAAW,CAAC;AAChC,QAAM,iBAAiB,eAAe,SAAS,mBAAmB;AAClE,QAAM,WACJ,gBAAgB,MAAM,GAAG,EAAE,CAAC,MAAM,IAAI,QAAQ,YAAY,UAAU;AACtE,QAAM,OACJ,eAAe,SAAS,kBAAkB,KAC1C,eAAe,SAAS,MAAM,KAC9B;AACF,QAAM,MAAM,IAAI,IAAI,IAAI,OAAO,KAAK,GAAG,QAAQ,MAAM,IAAI,EAAE;AAC3D,SAAO,IAAI,QAAQ,KAAK,EAAE,QAAQ,IAAI,UAAU,OAAO,SAAS,UAAU,OAAO,EAAE,CAAC;AACtF;AAEA,IAAM,eAAe,OAAO,KAA2B,aAAuB;AAC5E,MAAI,OAAO,IAAI,WAAW,YAAY;AACpC,QAAI,OAAO,SAAS,MAAM;AAAA,EAC5B,OAAO;AACL,QAAI,aAAa,SAAS;AAAA,EAC5B;AAEA,MAAI,OAAO,IAAI,cAAc,YAAY;AACvC,aAAS,QAAQ,QAAQ,CAAC,OAAO,QAAQ;AACvC,UAAI,YAAY,KAAK,KAAK;AAAA,IAC5B,CAAC;AAAA,EACH;AAEA,QAAM,OAAO,MAAM,SAAS,KAAK;AACjC,MAAI,MAAM,QAAQ,MAAS;AAC7B;AAEO,SAAS,oBAAoB,UAAsC,CAAC,GAAG;AAC5E,SAAO,OAAO,KAA0B,QAA8B;AACpE,UAAM,gBAAgB,QAAQ;AAC9B,UAAM,UAAU,eAAe;AAAA,MAC7B,GAAG;AAAA,MACH,eAAe,gBAAgB,MAAM,cAAc,GAAG,IAAI;AAAA,IAC5D,CAAC;AACD,UAAM,UAAU,aAAa,GAAG;AAChC,UAAM,WAAW,MAAM,QAAQ,OAAO;AACtC,UAAM,aAAa,KAAK,QAAQ;AAAA,EAClC;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { PriceOS, PriceOSError } from \"priceos\";\n\nexport type PriceOSGetCustomerId = (\n request: Request\n) => string | null | undefined | Promise<string | null | undefined>;\n\nexport type PriceOSPagesRequest = {\n method?: string;\n headers?: Record<string, string | string[] | undefined>;\n url?: string;\n socket?: { encrypted?: boolean };\n};\n\nexport type PriceOSPagesResponse = {\n status?: (code: number) => PriceOSPagesResponse;\n setHeader?: (name: string, value: string | string[]) => void;\n end?: (body?: string) => void;\n statusCode?: number;\n};\n\nexport type PriceOSPagesGetCustomerId = (\n request: PriceOSPagesRequest\n) => string | null | undefined | Promise<string | null | undefined>;\n\nexport type PriceOSNextHandlerOptions = {\n apiKey?: string;\n baseUrl?: string;\n basePath?: string;\n getCustomerId?: PriceOSGetCustomerId;\n};\n\nexport type PriceOSPagesHandlerOptions = Omit<PriceOSNextHandlerOptions, \"getCustomerId\"> & {\n getCustomerId?: PriceOSPagesGetCustomerId;\n};\n\nconst DEFAULT_BASE_PATH = \"/api/priceos\";\n\nconst normalizePath = (value: string) => value.replace(/^\\/+/, \"\");\n\nconst jsonResponse = (status: number, body: unknown) =>\n new Response(JSON.stringify(body), {\n status,\n headers: { \"content-type\": \"application/json\" },\n });\n\nexport function priceosHandler(options: PriceOSNextHandlerOptions = {}) {\n const envApiKey = (globalThis as { process?: { env?: Record<string, string | undefined> } })\n .process?.env?.PRICEOS_API_KEY;\n const apiKey = options.apiKey ?? envApiKey;\n const getCustomerId = options.getCustomerId;\n const baseUrl = (options.baseUrl ?? \"https://api.priceos.com\").replace(/\\/$/, \"\");\n const basePath = (options.basePath ?? DEFAULT_BASE_PATH).replace(/\\/+$/, \"\");\n\n return async (request: Request) => {\n if (!apiKey) {\n return new Response(\"Missing PRICEOS_API_KEY.\", { status: 500 });\n }\n\n if (!getCustomerId) {\n return jsonResponse(500, { error: \"Missing getCustomerId function\" });\n }\n\n let path = \"\";\n const url = new URL(request.url);\n const pathname = url.pathname;\n if (pathname.startsWith(basePath)) {\n path = normalizePath(pathname.slice(basePath.length));\n }\n\n if (path !== \"v1/customer\") {\n return new Response(\"Not found.\", { status: 404 });\n }\n\n const client = new PriceOS(apiKey, { baseUrl });\n const method = request.method.toUpperCase();\n if (method !== \"GET\") {\n return new Response(\"Method not allowed.\", { status: 405 });\n }\n\n if (url.searchParams.has(\"customerId\")) {\n return jsonResponse(400, { error: \"customerId must be set via getCustomerId\" });\n }\n\n let customerId: string | null | undefined;\n try {\n customerId = await getCustomerId(request);\n } catch (error) {\n return jsonResponse(500, { error: \"Failed to resolve customerId\" });\n }\n\n if (typeof customerId !== \"string\" || !customerId) {\n return jsonResponse(401, { error: \"Customer not identified\" });\n }\n\n try {\n const data = await client.customers.get(customerId);\n return jsonResponse(200, data);\n } catch (error) {\n if (error instanceof PriceOSError) {\n return jsonResponse(error.status ?? 500, { error: error.message });\n }\n return jsonResponse(500, { error: \"Request failed\" });\n }\n };\n}\n\nconst getHeaderValue = (\n headers: Record<string, string | string[] | undefined> | undefined,\n key: string\n) => {\n const value = headers?.[key];\n if (Array.isArray(value)) return value.join(\",\");\n return value;\n};\n\nconst toHeaders = (headers: Record<string, string | string[] | undefined> | undefined) => {\n const result = new Headers();\n if (!headers) return result;\n for (const [key, value] of Object.entries(headers)) {\n if (typeof value === \"string\") result.set(key, value);\n if (Array.isArray(value)) result.set(key, value.join(\",\"));\n }\n return result;\n};\n\nconst buildRequest = (req: PriceOSPagesRequest) => {\n const headers = req.headers ?? {};\n const forwardedProto = getHeaderValue(headers, \"x-forwarded-proto\");\n const protocol =\n forwardedProto?.split(\",\")[0] ?? (req.socket?.encrypted ? \"https\" : \"http\");\n const host =\n getHeaderValue(headers, \"x-forwarded-host\") ??\n getHeaderValue(headers, \"host\") ??\n \"localhost\";\n const url = new URL(req.url ?? \"/\", `${protocol}://${host}`);\n return new Request(url, { method: req.method ?? \"GET\", headers: toHeaders(headers) });\n};\n\nconst sendResponse = async (res: PriceOSPagesResponse, response: Response) => {\n if (typeof res.status === \"function\") {\n res.status(response.status);\n } else {\n res.statusCode = response.status;\n }\n\n if (typeof res.setHeader === \"function\") {\n response.headers.forEach((value, key) => {\n res.setHeader?.(key, value);\n });\n }\n\n const body = await response.text();\n res.end?.(body || undefined);\n};\n\nexport function priceosPagesHandler(options: PriceOSPagesHandlerOptions = {}) {\n return async (req: PriceOSPagesRequest, res: PriceOSPagesResponse) => {\n const getCustomerId = options.getCustomerId;\n const handler = priceosHandler({\n ...options,\n getCustomerId: getCustomerId ? () => getCustomerId(req) : undefined,\n });\n const request = buildRequest(req);\n const response = await handler(request);\n await sendResponse(res, response);\n };\n}\n"],"mappings":";AAAA,SAAS,SAAS,oBAAoB;AAmCtC,IAAM,oBAAoB;AAE1B,IAAM,gBAAgB,CAAC,UAAkB,MAAM,QAAQ,QAAQ,EAAE;AAEjE,IAAM,eAAe,CAAC,QAAgB,SACpC,IAAI,SAAS,KAAK,UAAU,IAAI,GAAG;AAAA,EACjC;AAAA,EACA,SAAS,EAAE,gBAAgB,mBAAmB;AAChD,CAAC;AAEI,SAAS,eAAe,UAAqC,CAAC,GAAG;AACtE,QAAM,YAAa,WAChB,SAAS,KAAK;AACjB,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,gBAAgB,QAAQ;AAC9B,QAAM,WAAW,QAAQ,WAAW,2BAA2B,QAAQ,OAAO,EAAE;AAChF,QAAM,YAAY,QAAQ,YAAY,mBAAmB,QAAQ,QAAQ,EAAE;AAE3E,SAAO,OAAO,YAAqB;AACjC,QAAI,CAAC,QAAQ;AACX,aAAO,IAAI,SAAS,4BAA4B,EAAE,QAAQ,IAAI,CAAC;AAAA,IACjE;AAEA,QAAI,CAAC,eAAe;AAClB,aAAO,aAAa,KAAK,EAAE,OAAO,iCAAiC,CAAC;AAAA,IACtE;AAEA,QAAI,OAAO;AACX,UAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;AAC/B,UAAM,WAAW,IAAI;AACrB,QAAI,SAAS,WAAW,QAAQ,GAAG;AACjC,aAAO,cAAc,SAAS,MAAM,SAAS,MAAM,CAAC;AAAA,IACtD;AAEA,QAAI,SAAS,eAAe;AAC1B,aAAO,IAA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,aAAa,KAAK,QAAQ;AAAA,EAClC;AACF;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@priceos/next",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",