{"version":3,"file":"shared.cjs","names":[],"sources":["../../src/resources/shared.ts"],"sourcesContent":["import type { Client } from \"../generated/mapi/client\";\nimport type { FetchOptions } from \"../client\";\n\nexport interface SpaceIdPathOverride {\n  path?: {\n    space_id?: number;\n  };\n}\n\n/**\n * Assembles the optional fields shared by every wrapped SDK call: a\n * `throwOnError` override (forwarded only when explicitly set) and\n * `fetchOptions` merged into the client's configured `kyOptions`.\n */\nexport function buildCallOptions(\n  client: Client,\n  throwOnError: boolean | undefined,\n  fetchOptions: FetchOptions | undefined,\n): { throwOnError?: boolean; kyOptions?: Record<string, unknown> } {\n  return {\n    ...(throwOnError === undefined ? {} : { throwOnError }),\n    ...(fetchOptions ? { kyOptions: { ...client.getConfig().kyOptions, ...fetchOptions } } : {}),\n  };\n}\n\nexport function resolveSpaceId(\n  spaceId: number | undefined,\n  path?: SpaceIdPathOverride[\"path\"],\n): number {\n  const resolvedSpaceId = path?.space_id ?? spaceId;\n\n  if (resolvedSpaceId === undefined) {\n    throw new Error(\n      \"Missing space_id. Provide `spaceId` when creating the client or pass `path.space_id` to the request method.\",\n    );\n  }\n\n  return resolvedSpaceId;\n}\n"],"mappings":";;;;;;AAcA,SAAgB,iBACd,QACA,cACA,cACiE;CACjE,OAAO;EACL,GAAI,iBAAiB,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa;EACrD,GAAI,eAAe,EAAE,WAAW;GAAE,GAAG,OAAO,UAAU,CAAC,CAAC;GAAW,GAAG;EAAa,EAAE,IAAI,CAAC;CAC5F;AACF;AAEA,SAAgB,eACd,SACA,MACQ;CACR,MAAM,kBAAkB,MAAM,YAAY;CAE1C,IAAI,oBAAoB,KAAA,GACtB,MAAM,IAAI,MACR,6GACF;CAGF,OAAO;AACT"}