{"version":3,"sources":["../../../../node_modules/.pnpm/@osdk+shared.client@1.0.1/node_modules/@osdk/shared.client/index.js","../../../../node_modules/.pnpm/@osdk+shared.client2@1.0.0/node_modules/@osdk/shared.client2/index.js","../../../../node_modules/.pnpm/@osdk+shared.net.errors@2.5.0-beta.2/node_modules/@osdk/shared.net.errors/build/esm/PalantirApiError.js","../../../../node_modules/.pnpm/@osdk+shared.net.errors@2.5.0-beta.2/node_modules/@osdk/shared.net.errors/build/esm/UnknownError.js","../../../../node_modules/.pnpm/@osdk+shared.net.platformapi@1.5.0/node_modules/@osdk/shared.net.platformapi/build/esm/foundryPlatformFetch.js"],"names":["symbolClientContext"],"mappings":";;;AAgBO,IAAM,mBAAA,GAAsB,OAAO,eAAe,CAAA;;;ACAlD,IAAMA,oBAAAA,GAAsB,qBAAA;;;ACA5B,IAAM,gBAAA,GAAN,cAA+B,KAAA,CAAM;AAAA,EAC1C,YAAY,OAAA,EAAS,SAAA,EAAW,WAAW,gBAAA,EAAkB,UAAA,EAAY,iBAAiB,UAAA,EAAY;AACpG,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AACjB,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AACjB,IAAA,IAAA,CAAK,gBAAA,GAAmB,gBAAA;AACxB,IAAA,IAAA,CAAK,UAAA,GAAa,UAAA;AAClB,IAAA,IAAA,CAAK,eAAA,GAAkB,eAAA;AACvB,IAAA,IAAA,CAAK,UAAA,GAAa,UAAA;AAAA,EACpB;AACF,CAAA;;;ACVO,IAAM,YAAA,GAAN,cAA2B,gBAAA,CAAiB;AAAA,EACjD,WAAA,CAAY,OAAA,EAAS,SAAA,EAAW,aAAA,EAAe,UAAA,EAAY;AACzD,IAAA,KAAA,CAAM,OAAA,EAAS,SAAA,EAAW,MAAA,EAAW,MAAA,EAAW,UAAU,CAAA;AAC1D,IAAA,IAAA,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,IACrD,IAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA,EAAS;AAAA,GACV,CAAA;AAID,EAAA,IAAI,CAAC,SAAS,EAAA,EAAI;AAChB,IAAA,IAAI;AACF,MAAA,MAAM,cAAA,GAAiB,MAAM,QAAA,CAAS,IAAA,EAAK;AAC3C,MAAA,OAAO,IAAI,gBAAA,CAAiB,cAAA,CAAe,OAAA,EAAS,eAAe,SAAA,EAAW,cAAA,CAAe,SAAA,EAAW,cAAA,CAAe,kBAAkB,QAAA,CAAS,MAAA,EAAQ,cAAA,CAAe,eAAA,EAAiB,eAAe,UAAU,CAAA;AAAA,IACrN,SAAS,CAAA,EAAG;AACV,MAAA,IAAI,aAAa,KAAA,EAAO;AACtB,QAAA,OAAO,IAAI,YAAA,CAAa,CAAA,CAAE,OAAA,EAAS,SAAS,CAAA;AAAA,MAC9C;AACA,MAAA,OAAO,IAAI,YAAA,CAAa,gCAAA,EAAkC,SAAS,CAAA;AAAA,IACrE;AAAA,EACF;AAEA,EAAA,IAAI,QAAA,CAAS,WAAW,GAAA,EAAK;AAC3B,IAAA;AAAA,EACF;AACA,EAAA,IAAI,iBAAA,IAAqB,IAAA,IAAQ,iBAAA,KAAsB,kBAAA,EAAoB;AACzE,IAAA,OAAO,MAAM,SAAS,IAAA,EAAK;AAAA,EAC7B;AACA,EAAA,OAAO,QAAA;AACT;AACO,SAAS,QAAA,CAAS,SAAS,YAAA,EAAc;AAC9C,EAAA,OAAA,IAAW,OAAA,CAAQ,QAAA,CAAS,GAAG,CAAA,GAAI,EAAA,GAAK,GAAA;AACxC,EAAA,OAAO,IAAI,GAAA,CAAI,CAAA,GAAA,EAAM,YAAY,IAAI,OAAO,CAAA;AAC9C","file":"chunk-YF3Y7K6K.cjs","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const symbolClientContext = Symbol(\"ClientContext\");","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const symbolClientContext = \"__osdkClientContext\";","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport class PalantirApiError extends Error {\n  constructor(message, errorName, errorCode, errorDescription, statusCode, errorInstanceId, parameters) {\n    super(message);\n    this.message = message;\n    this.errorName = errorName;\n    this.errorCode = errorCode;\n    this.errorDescription = errorDescription;\n    this.statusCode = statusCode;\n    this.errorInstanceId = errorInstanceId;\n    this.parameters = parameters;\n  }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { PalantirApiError } from \"./PalantirApiError.js\";\nexport class UnknownError extends PalantirApiError {\n  constructor(message, errorName, originalError, statusCode) {\n    super(message, errorName, undefined, undefined, statusCode);\n    this.originalError = originalError;\n  }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\nimport { symbolClientContext } from \"@osdk/shared.client2\";\nimport { PalantirApiError, UnknownError } from \"@osdk/shared.net.errors\";\nexport async function foundryPlatformFetch(client, [httpMethodNum, origPath, flags, contentType, responseContentType], ...args) {\n  const path = origPath.replace(/\\{([^}]+)\\}/g, () => encodeURIComponent(args.shift()));\n  const body = flags & 1 ? args.shift() : undefined;\n  const queryArgs = flags & 2 ? args.shift() : undefined;\n  const headerArgs = flags & 4 ? args.shift() : undefined;\n  const method = [\"GET\", \"POST\", \"PUT\", \"DELETE\", \"PATCH\"][httpMethodNum];\n  return await apiFetch(client[symbolClientContext] ?? client[oldSymbolClientContext] ?? client, method, path, body, queryArgs, headerArgs, contentType, responseContentType);\n}\nasync function apiFetch(clientCtx, method, endpointPath, data, queryArguments, headers, requestMediaType, responseMediaType) {\n  const url = parseUrl(clientCtx.baseUrl, endpointPath);\n  for (const [key, value] of Object.entries(queryArguments || {})) {\n    if (value == null) {\n      continue;\n    }\n    if (Array.isArray(value)) {\n      for (const item of value) {\n        url.searchParams.append(key, item);\n      }\n    } else {\n      url.searchParams.append(key, value);\n    }\n  }\n  const headersInit = new Headers();\n  headersInit.set(\"Content-Type\", requestMediaType ?? \"application/json\");\n  headersInit.set(\"Accept\", responseMediaType ?? \"application/json\");\n  Object.entries(headers || {}).forEach(([key, value]) => {\n    if (key === \"Content-Type\" && typeof value === \"string\") {\n      headersInit.set(\"Content-Type\", value);\n    } else if (key === \"Accept\" && typeof value === \"string\") {\n      headersInit.set(\"Accept\", value);\n    } else if (value != null) {\n      headersInit.append(key, value.toString());\n    }\n  });\n  const body = data == null || data instanceof globalThis.Blob ? data : JSON.stringify(data);\n  // Because this uses the client's fetch, there is a 99.99% chance that it is already going\n  // to handle the error case and throw a PalantirApiError since its wrapped in a\n  // createFetchOrThrow.\n  const response = await clientCtx.fetch(url.toString(), {\n    body,\n    method: method,\n    headers: headersInit\n  });\n  // However, if we ended up using a \"regular\" fetch, the\n  // error status codes are not thrown by fetch automatically,\n  // we have to look at the ok property and behave accordingly\n  if (!response.ok) {\n    try {\n      const convertedError = await response.json();\n      return new PalantirApiError(convertedError.message, convertedError.errorName, convertedError.errorCode, convertedError.errorDescription, response.status, convertedError.errorInstanceId, convertedError.parameters);\n    } catch (e) {\n      if (e instanceof Error) {\n        return new UnknownError(e.message, \"UNKNOWN\");\n      }\n      return new UnknownError(\"Unable to parse error response\", \"UNKNOWN\");\n    }\n  }\n  // Do not return anything if its a 204. Do not parse either!\n  if (response.status === 204) {\n    return;\n  }\n  if (responseMediaType == null || responseMediaType === \"application/json\") {\n    return await response.json();\n  }\n  return response;\n}\nexport function parseUrl(baseUrl, endpointPath) {\n  baseUrl += baseUrl.endsWith(\"/\") ? \"\" : \"/\";\n  return new URL(`api${endpointPath}`, baseUrl);\n}"]}