@keboola/api-client 0.1.0 → 1.0.1

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 (138) hide show
  1. package/README.md +18 -1
  2. package/dist/ai/index.cjs +7 -1
  3. package/dist/ai/index.cjs.map +1 -1
  4. package/dist/ai/index.js +7 -1
  5. package/dist/ai/index.js.map +1 -1
  6. package/dist/assets/index.cjs +7 -1
  7. package/dist/assets/index.cjs.map +1 -1
  8. package/dist/assets/index.js +7 -1
  9. package/dist/assets/index.js.map +1 -1
  10. package/dist/chat/index.cjs +3 -1
  11. package/dist/chat/index.cjs.map +1 -1
  12. package/dist/chat/index.d.cts +1 -1
  13. package/dist/chat/index.d.ts +1 -1
  14. package/dist/chat/index.js +3 -1
  15. package/dist/chat/index.js.map +1 -1
  16. package/dist/chat/types.d.cts +1 -1
  17. package/dist/chat/types.d.ts +1 -1
  18. package/dist/constants/index.cjs +145 -0
  19. package/dist/constants/index.cjs.map +1 -0
  20. package/dist/constants/index.d.cts +28 -0
  21. package/dist/constants/index.d.ts +28 -0
  22. package/dist/constants/index.js +142 -0
  23. package/dist/constants/index.js.map +1 -0
  24. package/dist/dataScience/index.cjs +7 -2
  25. package/dist/dataScience/index.cjs.map +1 -1
  26. package/dist/dataScience/index.js +7 -2
  27. package/dist/dataScience/index.js.map +1 -1
  28. package/dist/domain/permissions/index.cjs +13 -0
  29. package/dist/domain/permissions/index.cjs.map +1 -0
  30. package/dist/domain/permissions/index.d.cts +5 -0
  31. package/dist/domain/permissions/index.d.ts +5 -0
  32. package/dist/domain/permissions/index.js +11 -0
  33. package/dist/domain/permissions/index.js.map +1 -0
  34. package/dist/editor/index.cjs +7 -10
  35. package/dist/editor/index.cjs.map +1 -1
  36. package/dist/editor/index.d.cts +11 -19
  37. package/dist/editor/index.d.ts +11 -19
  38. package/dist/editor/index.js +7 -10
  39. package/dist/editor/index.js.map +1 -1
  40. package/dist/editor/types.d.cts +1 -1
  41. package/dist/editor/types.d.ts +1 -1
  42. package/dist/encryption/index.cjs +7 -1
  43. package/dist/encryption/index.cjs.map +1 -1
  44. package/dist/encryption/index.js +7 -1
  45. package/dist/encryption/index.js.map +1 -1
  46. package/dist/import/index.cjs +7 -1
  47. package/dist/import/index.cjs.map +1 -1
  48. package/dist/import/index.js +7 -1
  49. package/dist/import/index.js.map +1 -1
  50. package/dist/index.cjs +308 -42
  51. package/dist/index.cjs.map +1 -1
  52. package/dist/index.d.cts +1085 -122
  53. package/dist/index.d.ts +1085 -122
  54. package/dist/index.js +308 -42
  55. package/dist/index.js.map +1 -1
  56. package/dist/management/index.cjs +40 -23
  57. package/dist/management/index.cjs.map +1 -1
  58. package/dist/management/index.d.cts +59 -23
  59. package/dist/management/index.d.ts +59 -23
  60. package/dist/management/index.js +40 -23
  61. package/dist/management/index.js.map +1 -1
  62. package/dist/management/types.d.cts +2 -2
  63. package/dist/management/types.d.ts +2 -2
  64. package/dist/metastore/index.cjs +7 -1
  65. package/dist/metastore/index.cjs.map +1 -1
  66. package/dist/metastore/index.js +7 -1
  67. package/dist/metastore/index.js.map +1 -1
  68. package/dist/oauth/index.cjs +234 -0
  69. package/dist/oauth/index.cjs.map +1 -0
  70. package/dist/oauth/index.d.cts +12 -0
  71. package/dist/oauth/index.d.ts +12 -0
  72. package/dist/oauth/index.js +228 -0
  73. package/dist/oauth/index.js.map +1 -0
  74. package/dist/oauth/types.cjs +4 -0
  75. package/dist/oauth/types.cjs.map +1 -0
  76. package/dist/oauth/types.d.cts +34 -0
  77. package/dist/oauth/types.d.ts +34 -0
  78. package/dist/oauth/types.js +3 -0
  79. package/dist/oauth/types.js.map +1 -0
  80. package/dist/queryService/index.cjs +7 -1
  81. package/dist/queryService/index.cjs.map +1 -1
  82. package/dist/queryService/index.js +7 -1
  83. package/dist/queryService/index.js.map +1 -1
  84. package/dist/queue/index.cjs +7 -1
  85. package/dist/queue/index.cjs.map +1 -1
  86. package/dist/queue/index.js +7 -1
  87. package/dist/queue/index.js.map +1 -1
  88. package/dist/sdk/configurations/index.cjs +14 -0
  89. package/dist/sdk/configurations/index.cjs.map +1 -0
  90. package/dist/sdk/configurations/index.d.cts +24 -0
  91. package/dist/sdk/configurations/index.d.ts +24 -0
  92. package/dist/sdk/configurations/index.js +11 -0
  93. package/dist/sdk/configurations/index.js.map +1 -0
  94. package/dist/sdk/storage/index.cjs +179 -1
  95. package/dist/sdk/storage/index.cjs.map +1 -1
  96. package/dist/sdk/storage/index.d.cts +118 -13
  97. package/dist/sdk/storage/index.d.ts +118 -13
  98. package/dist/sdk/storage/index.js +169 -2
  99. package/dist/sdk/storage/index.js.map +1 -1
  100. package/dist/status/index.cjs +7 -1
  101. package/dist/status/index.cjs.map +1 -1
  102. package/dist/status/index.js +7 -1
  103. package/dist/status/index.js.map +1 -1
  104. package/dist/storage/index.cjs +107 -9
  105. package/dist/storage/index.cjs.map +1 -1
  106. package/dist/storage/index.d.cts +1 -1
  107. package/dist/storage/index.d.ts +1 -1
  108. package/dist/storage/index.js +107 -9
  109. package/dist/storage/index.js.map +1 -1
  110. package/dist/storage/types.d.cts +2977 -1306
  111. package/dist/storage/types.d.ts +2977 -1306
  112. package/dist/{storageClient-DPLh_p0V.d.cts → storageClient-DSLTM3Cr.d.cts} +20 -1
  113. package/dist/{storageClient-YVWer22Y.d.ts → storageClient-DrYOs4Xm.d.ts} +20 -1
  114. package/dist/storageSdk-BBqAo0Vx.d.cts +143 -0
  115. package/dist/storageSdk-ZVmKQQSl.d.ts +143 -0
  116. package/dist/syncActions/index.cjs +7 -1
  117. package/dist/syncActions/index.cjs.map +1 -1
  118. package/dist/syncActions/index.js +7 -1
  119. package/dist/syncActions/index.js.map +1 -1
  120. package/dist/telemetry/index.cjs +7 -1
  121. package/dist/telemetry/index.cjs.map +1 -1
  122. package/dist/telemetry/index.js +7 -1
  123. package/dist/telemetry/index.js.map +1 -1
  124. package/dist/{types-B7k8S4ki.d.ts → types-B--u7l2H.d.ts} +33 -118
  125. package/dist/{types-BeShtGlc.d.cts → types-BTcT8Q0T.d.cts} +15 -1
  126. package/dist/{types-BeShtGlc.d.ts → types-BTcT8Q0T.d.ts} +15 -1
  127. package/dist/{types-BNQK_jR_.d.cts → types-C0Owx2P7.d.cts} +33 -118
  128. package/dist/{types-DJ6nbNq5.d.cts → types-CNkgmuhe.d.cts} +1 -1
  129. package/dist/{types-BjrNNn5I.d.ts → types-DzwzVgyG.d.ts} +1 -1
  130. package/dist/vault/index.cjs +3 -1
  131. package/dist/vault/index.cjs.map +1 -1
  132. package/dist/vault/index.js +3 -1
  133. package/dist/vault/index.js.map +1 -1
  134. package/dist/verify/index.cjs +3 -1
  135. package/dist/verify/index.cjs.map +1 -1
  136. package/dist/verify/index.js +3 -1
  137. package/dist/verify/index.js.map +1 -1
  138. package/package.json +71 -5
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/errors/ApiError.ts","../../src/fetchClient/createFetchClient/utils.ts","../../src/fetchClient/createFetchClient/createFetchClient.ts","../../src/fetchClient/createOpenapiFetchClient.ts","../../src/clients/syncActions/constants.ts","../../src/clients/syncActions/gitRepository/schemas.ts","../../src/clients/syncActions/gitRepository/utils.ts","../../src/clients/syncActions/gitRepository/gitRepository.ts","../../src/clients/syncActions/syncActionsClient.ts"],"names":["email"],"mappings":";;;;AAEO,IAAM,QAAA,GAAN,cAAuB,KAAA,CAAM;AAAA,EAClC,QAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EAEA,WAAA,CAAY,EAAE,QAAA,EAAU,OAAA,EAAS,MAAK,EAAgB;AACpD,IAAA,KAAA,CAAM,SAAS,UAAU,CAAA;AACzB,IAAA,IAAA,CAAK,QAAA,GAAW,QAAA;AAChB,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AAAA,EACd;AACF,CAAA;ACRO,IAAM,UAAA,GAAa;AAAA,EACxB,YAAA,EAAc,cAEhB,CAAA;AAEO,IAAM,eAAA,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,OACF;AAAA,MACA,EAAE,MAAA;AAAO,KACX;AAEA,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AACF,CAAA;AAKO,IAAM,uBAAA,GAA0B,CAAC,EAAE,OAAA,EAAS,aAAY,KAAyB;AACtF,EAAA,MAAM,SAAS,wBAAA,CAAgC;AAAA,IAC7C,OAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,MAAM,cAAA,GAAiB,qBAAqB,MAAM,CAAA;AAElD,EAAA,MAAM,SAAA,GAAY,CAAC,EAAE,KAAA,EAAAA,QAAO,GAAG,IAAA,IAAwB,MAAA,KAAyB;AAC9E,IAAA,OAAO,cAAA;AAAA,MACL;AAAA,QACE,GAAG,IAAA;AAAA,QACH,QAAQ,UAAA,CAAW,UAAA;AAAA,QACnB,UAAA,EAAY;AAAA,UACV,UAAA,EAAY;AAAA,YACV,IAAA,EAAM;AAAA,cACJ,KAAA,EAAAA;AAAA;AACF;AACF;AACF,OACF;AAAA,MACA;AAAA,KACF;AAAA,EACF,CAAA;AAEA,EAAA,OAAO;AAAA,IACL,SAAA;AAAA,IACA,aAAA,EAAe,oBAAoB,cAAc;AAAA,GACnD;AACF","file":"index.js","sourcesContent":["import type { ApiResponse } from '../fetchClient/createFetchClient/types';\n\nexport class ApiError extends Error {\n response: Response;\n request: Request;\n data: unknown;\n\n constructor({ response, request, data }: ApiResponse) {\n super(response.statusText);\n this.response = response;\n this.request = request;\n this.data = data;\n }\n}\n","import type { IStringifyOptions } from 'qs';\nimport qs from 'qs';\n\nimport type { BodyParam, CreateFetchRequestFn, PathParam, ValidateStatusFn } from './types';\n\nexport const HttpHeader = {\n CONTENT_TYPE: 'content-type',\n CONTENT_DISPOSITION: 'content-disposition',\n};\n\nexport const HttpContentType = {\n JSON: 'application/json',\n TEXT_PLAIN: 'text/plain',\n FORM_DATA: 'multipart/form-data',\n TEXT_HTML: 'text/html',\n};\n\nexport const defaultValidateStatus: ValidateStatusFn = ({ response }) =>\n response.status >= 200 && response.status <= 299;\n\nfunction removeUndefined(obj: Record<string, string>) {\n const objCopy = { ...obj };\n for (const [key, value] of Object.entries(objCopy)) {\n if (value == null) delete objCopy[key];\n }\n return objCopy;\n}\n\nexport const parseData = async (response: Response) => {\n // HTTP 204 - no content\n if (response.status === 204) return null;\n\n // headers indicates that the content is JSON, so parse it.\n const contentType = response.headers.get(HttpHeader.CONTENT_TYPE);\n if (contentType && contentType == HttpContentType.JSON) {\n return response.json();\n }\n\n // try JSON parsing on the text\n // If it fails, return the string. The headers does not have a content type.\n const text = await response.text();\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n};\n\n// Header instance serialize undefined value as `undefined`, we do not want that\nconst cleanHeadersInit = (headersInit: HeadersInit | undefined) => {\n if (Array.isArray(headersInit)) return headersInit;\n if (headersInit instanceof Headers) return headersInit;\n if (headersInit == null) return headersInit;\n\n return removeUndefined(headersInit);\n};\n\nconst createHeaders = (\n headersInitA: HeadersInit | undefined,\n headersInitB: HeadersInit | undefined,\n) => {\n const headersA = new Headers(cleanHeadersInit(headersInitA));\n const headersB = new Headers(cleanHeadersInit(headersInitB));\n\n headersB.forEach((value, key) => {\n headersA.set(key, value);\n });\n\n return headersA;\n};\n\nexport const createPath = (path: string, pathParam: PathParam = {}) =>\n path.replace(/\\{([^}]+)}/g, (_, key) => {\n if (!(key in pathParam))\n throw new Error(`Path parameter \"${key}\" is missing in the path \"${path}\"`);\n\n return encodeURIComponent(pathParam[key]!);\n });\n\nexport const createSearch = (\n query: Record<string, unknown>,\n options: Pick<IStringifyOptions, 'arrayFormat'> = {},\n) => {\n return qs.stringify(query, {\n encodeValuesOnly: true,\n skipNulls: true,\n ...options,\n });\n};\n\nexport const createBody = (body: BodyParam, headers: Headers) => {\n if (body == null) return null;\n if (body instanceof FormData) return body; // fetch automatically sets content-type header\n if (typeof body === 'string') return body; // fetch automatically sets content-type header\n\n const stringifyBody = JSON.stringify(body);\n const stringBody = stringifyBody === '{}' ? null : stringifyBody;\n if (stringBody) headers.set(HttpHeader.CONTENT_TYPE, HttpContentType.JSON);\n\n return stringBody;\n};\n\nexport const parseContentDispositionHeader = (contentDisposition?: string | null) => {\n // extract the type ('inline' or 'attachment'), default the type to 'unknown'\n const type = (() => {\n const typeMatch = contentDisposition?.match(/^\\s*(inline|attachment)\\s*;/i);\n return (typeMatch?.[1]?.toLowerCase() ?? 'unknown') as 'inline' | 'attachment' | 'unknown';\n })();\n\n // extract the filename, default the type to null\n const filename = (() => {\n const filenameMatch = contentDisposition?.match(/filename=\"([^\"]+)\"/i);\n if (filenameMatch) return filenameMatch[1];\n\n // If no filename=\"...\", check for encoded filename*=UTF-8''\n const encodedFilenameMatch = contentDisposition?.match(/filename\\*=(?:UTF-8'')?([^;]+)/i);\n if (encodedFilenameMatch?.[1]) return decodeURIComponent(encodedFilenameMatch[1]);\n\n // Check for unquoted filenames (rare but possible)\n const unquotedFilenameMatch = contentDisposition?.match(/filename=([^;]+)/i);\n return unquotedFilenameMatch?.[1] ?? null;\n })();\n\n // Return the parsed result\n return { type, filename };\n};\n\nexport const createFetchRequest: CreateFetchRequestFn = ({\n url,\n method,\n params,\n options = {},\n defaultOptions,\n}) => {\n const {\n baseUrl,\n validateStatus: defValidateStatus = defaultValidateStatus,\n headers: defaultHeaders,\n ...restDefaultOptions\n } = defaultOptions;\n const { validateStatus, queryArrayFormat, headers: endpointHeaders, ...restOptions } = options;\n\n const headers = createHeaders(defaultHeaders, endpointHeaders);\n const path = createPath(url, params.path);\n const search = createSearch(params.query ?? {}, { arrayFormat: queryArrayFormat });\n const body = createBody(params.body, headers);\n\n const urlInstance = new URL(baseUrl + path);\n urlInstance.search = search;\n\n const request = new Request(urlInstance, {\n ...restDefaultOptions,\n ...restOptions,\n headers,\n method: method.toUpperCase(),\n body,\n });\n\n return { request, validateStatus: validateStatus ?? defValidateStatus };\n};\n","import { ApiError } from '../../errors';\n\nimport type {\n BaseFetchParams,\n CoreFetchFn,\n CreateFetchClientOptions,\n FetchClientOptions,\n FetchFn,\n HttpMethod,\n} from './types';\nimport { createFetchRequest, parseData } from './utils';\n\nexport type FetchClientError = TypeError | ApiError | SyntaxError | DOMException;\n\nexport const isApiError = (error: unknown): error is ApiError => error instanceof ApiError;\n\nexport const isAbortError = (error: unknown): error is DOMException =>\n error instanceof DOMException && error.name === 'AbortError';\n\nexport const isFetchClientError = (error: unknown): error is FetchClientError =>\n error instanceof TypeError || error instanceof SyntaxError || isApiError(error);\n\nconst createCoreFetch =\n (fetchFn: FetchFn): CoreFetchFn =>\n async ({ request, validateStatus }) => {\n const response = await fetchFn(request);\n const data = await parseData(response);\n\n const apiResponse = {\n request,\n response,\n data,\n };\n\n const boolOrError = validateStatus(apiResponse);\n if (isApiError(boolOrError)) throw boolOrError;\n if (!boolOrError) throw new ApiError(apiResponse);\n\n return apiResponse;\n };\n\nexport const createFetchClient = ({\n middlewares = [],\n ...defaultOptions\n}: CreateFetchClientOptions) => {\n const coreFetch = createCoreFetch(defaultOptions.fetchFn ?? fetch);\n const fetchWithMiddlewares = middlewares.reduceRight(\n (next, middleware) => middleware(next),\n coreFetch,\n );\n\n const createFetchMethod =\n (method: HttpMethod) =>\n async (url: string, params: BaseFetchParams, options: FetchClientOptions = {}) => {\n const request = createFetchRequest({\n url,\n method,\n params,\n defaultOptions,\n options,\n });\n\n const methodMiddlewares = options?.middlewares ?? [];\n\n return methodMiddlewares.reduceRight(\n (next, middleware) => middleware(next),\n fetchWithMiddlewares,\n )(request);\n };\n\n return {\n get: createFetchMethod('get'),\n post: createFetchMethod('post'),\n put: createFetchMethod('put'),\n patch: createFetchMethod('patch'),\n delete: createFetchMethod('delete'),\n };\n};\n","import {\n type ApiResponse,\n createFetchClient,\n type CreateFetchClientOptions,\n type FetchClientOptions,\n type HttpMethod,\n} from './createFetchClient';\nimport type { OpenapiParametersType, OpenapiReturnType } from './types';\n\ntype OpenapiPaths<Paths> = {\n [P in keyof Paths]: {\n [M in HttpMethod]?: unknown;\n };\n};\n\ntype PathsWithMethod<Paths extends OpenapiPaths<Paths>, PathnameMethod extends HttpMethod> = {\n [Pathname in keyof Paths]: Paths[Pathname] extends {\n [K in PathnameMethod]: any;\n }\n ? Pathname\n : never;\n}[keyof Paths];\n\ntype FetchMethod<Paths extends OpenapiPaths<Paths>, Method extends HttpMethod> = <\n Path extends PathsWithMethod<Paths, Method>,\n>(\n url: Path,\n params: OpenapiParametersType<Paths[Path][Method]>,\n options?: FetchClientOptions,\n) => Promise<ApiResponse<OpenapiReturnType<Paths[Path][Method]>>>;\n\ntype FetchClient<Paths extends OpenapiPaths<Paths>> = {\n get: FetchMethod<Paths, 'get'>;\n post: FetchMethod<Paths, 'post'>;\n put: FetchMethod<Paths, 'put'>;\n patch: FetchMethod<Paths, 'patch'>;\n delete: FetchMethod<Paths, 'delete'>;\n};\n\nexport const createOpenapiFetchClient = <Paths extends OpenapiPaths<Paths>>(\n defaultOptions: CreateFetchClientOptions,\n) => createFetchClient(defaultOptions) as FetchClient<Paths>;\n","export const SyncAction = {\n DATA_APP_GIT_REPOSITORY: 'git-repository',\n GIT_REPOSITORY: 'gitRepository',\n ENROLL_MFA: 'enrollMFA',\n};\n\nexport const Component = {\n DATA_APP: 'keboola.data-apps',\n};\n","import * as z from 'zod';\n\nconst Author = z.object({\n name: z.string(),\n email: z.email(),\n});\n\nconst RepositoryBranch = z.object({\n sha: z.string(),\n date: z.string(),\n comment: z.string(),\n branch: z.string(),\n author: Author,\n});\n\nexport const Repository = z.object({\n repository: z.object({\n url: z.string(),\n }),\n branches: z.array(RepositoryBranch),\n});\n","type GitRepoConfig = {\n username?: string;\n '#password'?: string;\n '#sshKey'?: string;\n};\n\nclass GitRepoConfigDataBuilder {\n private readonly repositoryUrl: string;\n private config: GitRepoConfig = {};\n\n constructor(repositoryUrl: string) {\n this.repositoryUrl = repositoryUrl;\n }\n\n withCredentials(username: string, password: string) {\n this.config.username = username;\n\n delete this.config['#sshKey'];\n this.config['#password'] = password;\n return this;\n }\n\n withSshKey(username: string, sshKey: string) {\n this.config.username = username;\n\n delete this.config['#password'];\n this.config['#sshKey'] = sshKey;\n return this;\n }\n\n build() {\n return {\n parameters: {\n git: {\n repo: this.repositoryUrl,\n ...this.config,\n },\n },\n };\n }\n\n buildForDataApp() {\n return {\n parameters: {\n dataApp: {\n git: {\n repository: this.repositoryUrl,\n ...this.config,\n },\n },\n },\n };\n }\n}\n\nexport const createGitRepoConfigDataBuilder = (repositoryUrl: string) =>\n new GitRepoConfigDataBuilder(repositoryUrl);\n","import { Component, SyncAction } from '../constants';\nimport type { SendSyncAction } from '../syncActionsClient';\n\nimport { Repository } from './schemas';\nimport type {\n GetDataAppPasswordPrivateGitRepositoryInput,\n GetDataAppPublicGitRepositoryInput,\n GetDataAppSSHKeyPrivateGitRepositoryInput,\n GetGitPrivateRepositoryInput,\n GetPublicGitRepositoryInput,\n} from './types';\nimport { createGitRepoConfigDataBuilder } from './utils';\n\nexport const createGitRepository = (sendSyncAction: SendSyncAction) => {\n const getDataAppPublicGitRepository = async (\n { repositoryUrl, ...other }: GetDataAppPublicGitRepositoryInput,\n signal?: AbortSignal,\n ) => {\n const data = await sendSyncAction(\n {\n ...other,\n action: SyncAction.DATA_APP_GIT_REPOSITORY,\n componentId: Component.DATA_APP,\n configData: createGitRepoConfigDataBuilder(repositoryUrl).buildForDataApp(),\n },\n signal,\n );\n\n return Repository.parse(data);\n };\n\n const getDataAppPasswordPrivateGitRepository = async (\n { repositoryUrl, username, password, ...other }: GetDataAppPasswordPrivateGitRepositoryInput,\n signal?: AbortSignal,\n ) => {\n const data = await sendSyncAction(\n {\n ...other,\n action: SyncAction.DATA_APP_GIT_REPOSITORY,\n componentId: Component.DATA_APP,\n configData: createGitRepoConfigDataBuilder(repositoryUrl)\n .withCredentials(username, password)\n .buildForDataApp(),\n },\n signal,\n );\n\n return Repository.parse(data);\n };\n\n const getDataAppSSHKeyPrivateGitRepository = async (\n { repositoryUrl, username, sshKey, ...other }: GetDataAppSSHKeyPrivateGitRepositoryInput,\n signal?: AbortSignal,\n ) => {\n const data = await sendSyncAction(\n {\n ...other,\n action: SyncAction.DATA_APP_GIT_REPOSITORY,\n componentId: Component.DATA_APP,\n configData: createGitRepoConfigDataBuilder(repositoryUrl)\n .withSshKey(username, sshKey)\n .buildForDataApp(),\n },\n signal,\n );\n\n return Repository.parse(data);\n };\n\n const getPublicGitRepository = async (\n { repositoryUrl, componentId, ...other }: GetPublicGitRepositoryInput,\n signal?: AbortSignal,\n ) => {\n const data = await sendSyncAction(\n {\n ...other,\n action: SyncAction.GIT_REPOSITORY,\n componentId,\n configData: createGitRepoConfigDataBuilder(repositoryUrl).build(),\n },\n signal,\n );\n\n return Repository.parse(data);\n };\n\n const getPrivateGitRepository = async (\n { repositoryUrl, username, password, componentId, ...other }: GetGitPrivateRepositoryInput,\n signal?: AbortSignal,\n ) => {\n const data = await sendSyncAction(\n {\n ...other,\n action: SyncAction.GIT_REPOSITORY,\n componentId,\n configData: createGitRepoConfigDataBuilder(repositoryUrl)\n .withCredentials(username, password)\n .build(),\n },\n signal,\n );\n\n return Repository.parse(data);\n };\n\n return {\n getDataAppPublicGitRepository,\n getDataAppPasswordPrivateGitRepository,\n getDataAppSSHKeyPrivateGitRepository,\n getPublicGitRepository,\n getPrivateGitRepository,\n };\n};\n","import { createOpenapiFetchClient } from '../../fetchClient';\nimport type { ClientInitOptions } from '../types';\n\nimport type { paths } from './__generated__/schema';\nimport { SyncAction } from './constants';\nimport { createGitRepository } from './gitRepository';\nimport type { EnrollMFAInput, PostActionsBody, PostActionsBodyRaw } from './types';\n\n/**\n * Creates a call private action endpoint.\n */\nconst createSendSyncAction = (client: SyncActionClient) => {\n return async (body: PostActionsBody, signal?: AbortSignal) => {\n const { data } = await client.post(\n '/actions',\n {\n body: body as unknown as PostActionsBodyRaw,\n },\n { signal },\n );\n\n return data;\n };\n};\n\nexport type SendSyncAction = ReturnType<typeof createSendSyncAction>;\ntype SyncActionClient = ReturnType<typeof createOpenapiFetchClient<paths>>;\n\nexport const createSyncActionsClient = ({ baseUrl, middlewares }: ClientInitOptions) => {\n const client = createOpenapiFetchClient<paths>({\n baseUrl,\n middlewares,\n });\n\n const sendSyncAction = createSendSyncAction(client);\n\n const enrollMFA = ({ email, ...rest }: EnrollMFAInput, signal?: AbortSignal) => {\n return sendSyncAction(\n {\n ...rest,\n action: SyncAction.ENROLL_MFA,\n configData: {\n parameters: {\n user: {\n email,\n },\n },\n },\n },\n signal,\n );\n };\n\n return {\n enrollMFA,\n gitRepository: createGitRepository(sendSyncAction),\n };\n};\n"]}
1
+ {"version":3,"sources":["../../src/errors/ApiError.ts","../../src/constants.ts","../../src/fetchClient/createFetchClient/utils.ts","../../src/fetchClient/createFetchClient/createFetchClient.ts","../../src/fetchClient/createOpenapiFetchClient.ts","../../src/clients/syncActions/constants.ts","../../src/clients/syncActions/gitRepository/schemas.ts","../../src/clients/syncActions/gitRepository/utils.ts","../../src/clients/syncActions/gitRepository/gitRepository.ts","../../src/clients/syncActions/syncActionsClient.ts"],"names":["email"],"mappings":";;;;AAEO,IAAM,QAAA,GAAN,cAAuB,KAAA,CAAM;AAAA,EAClC,QAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EAEA,WAAA,CAAY,EAAE,QAAA,EAAU,OAAA,EAAS,MAAK,EAAgB;AACpD,IAAA,KAAA,CAAM,SAAS,UAAU,CAAA;AACzB,IAAA,IAAA,CAAK,QAAA,GAAW,QAAA;AAChB,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AAAA,EACd;AACF,CAAA;;;ACPO,IAAM,UAAA,GAAa;AAAA,EACxB,UAAA,EAAY,GAOd,CAAA;;;ACPO,IAAM,UAAA,GAAa;AAAA,EACxB,YAAA,EAAc,cAEhB,CAAA;AAEO,IAAM,eAAA,GAAkB;AAAA,EAC7B,IAAA,EAAM,kBAIR,CAAA;AAEO,IAAM,qBAAA,GAA0C,CAAC,EAAE,QAAA,OACxD,QAAA,CAAS,MAAA,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uBAAA,GAA0B,CAAC,EAAE,OAAA,EAAS,aAAY,KAAyB;AACtF,EAAA,MAAM,SAAS,wBAAA,CAAgC;AAAA,IAC7C,OAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,MAAM,cAAA,GAAiB,qBAAqB,MAAM,CAAA;AAElD,EAAA,MAAM,SAAA,GAAY,CAAC,EAAE,KAAA,EAAAA,QAAO,GAAG,IAAA,IAAwB,MAAA,KAAyB;AAC9E,IAAA,OAAO,cAAA;AAAA,MACL;AAAA,QACE,GAAG,IAAA;AAAA,QACH,QAAQ,UAAA,CAAW,UAAA;AAAA,QACnB,UAAA,EAAY;AAAA,UACV,UAAA,EAAY;AAAA,YACV,IAAA,EAAM;AAAA,cACJ,KAAA,EAAAA;AAAA;AACF;AACF;AACF,OACF;AAAA,MACA;AAAA,KACF;AAAA,EACF,CAAA;AAEA,EAAA,OAAO;AAAA,IACL,SAAA;AAAA,IACA,aAAA,EAAe,oBAAoB,cAAc;AAAA,GACnD;AACF","file":"index.js","sourcesContent":["import type { ApiResponse } from '../fetchClient/createFetchClient/types';\n\nexport class ApiError extends Error {\n response: Response;\n request: Request;\n data: unknown;\n\n constructor({ response, request, data }: ApiResponse) {\n super(response.statusText);\n this.response = response;\n this.request = request;\n this.data = data;\n }\n}\n","export const KeboolaHttpHeader = {\n STORAGE_API_TOKEN: 'X-StorageApi-Token',\n MANAGEMENT_API_TOKEN: 'X-Kbc-Manageapitoken',\n STORAGE_API_URL: 'x-storageapi-url',\n};\n\nexport const HttpStatus = {\n NO_CONTENT: 204,\n BAD_REQUEST: 400,\n UNPROCESSABLE_ENTITY: 422,\n INTERNAL_SERVER_ERROR: 500,\n BAD_GATEWAY: 502,\n SERVICE_UNAVAILABLE: 503,\n GATEWAY_TIMEOUT: 504,\n} as const;\n\nexport const ENCRYPTED_VALUE_PREFIX = 'KBC::';\n","import type { IStringifyOptions } from 'qs';\nimport qs from 'qs';\n\nimport { HttpStatus } from '../../constants';\n\nimport type { BodyParam, CreateFetchRequestFn, PathParam, ValidateStatusFn } from './types';\n\nexport const HttpHeader = {\n CONTENT_TYPE: 'content-type',\n CONTENT_DISPOSITION: 'content-disposition',\n};\n\nexport const HttpContentType = {\n JSON: 'application/json',\n TEXT_PLAIN: 'text/plain',\n FORM_DATA: 'multipart/form-data',\n TEXT_HTML: 'text/html',\n};\n\nexport const defaultValidateStatus: ValidateStatusFn = ({ response }) =>\n response.status >= 200 && response.status <= 299;\n\nfunction removeUndefined(obj: Record<string, string>) {\n const objCopy = { ...obj };\n for (const [key, value] of Object.entries(objCopy)) {\n if (value == null) delete objCopy[key];\n }\n return objCopy;\n}\n\nexport const parseData = async (response: Response) => {\n if (response.status === HttpStatus.NO_CONTENT) return null;\n\n // headers indicates that the content is JSON, so parse it.\n const contentType = response.headers.get(HttpHeader.CONTENT_TYPE);\n if (contentType && contentType == HttpContentType.JSON) {\n return response.json();\n }\n\n // try JSON parsing on the text\n // If it fails, return the string. The headers does not have a content type.\n const text = await response.text();\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n};\n\n// Header instance serialize undefined value as `undefined`, we do not want that\nconst cleanHeadersInit = (headersInit: HeadersInit | undefined) => {\n if (Array.isArray(headersInit)) return headersInit;\n if (headersInit instanceof Headers) return headersInit;\n if (headersInit == null) return headersInit;\n\n return removeUndefined(headersInit);\n};\n\nconst createHeaders = (\n headersInitA: HeadersInit | undefined,\n headersInitB: HeadersInit | undefined,\n) => {\n const headersA = new Headers(cleanHeadersInit(headersInitA));\n const headersB = new Headers(cleanHeadersInit(headersInitB));\n\n headersB.forEach((value, key) => {\n headersA.set(key, value);\n });\n\n return headersA;\n};\n\nexport const createPath = (path: string, pathParam: PathParam = {}) =>\n path.replace(/\\{([^}]+)}/g, (_, key) => {\n if (!(key in pathParam))\n throw new Error(`Path parameter \"${key}\" is missing in the path \"${path}\"`);\n\n return encodeURIComponent(pathParam[key]!);\n });\n\nexport const createSearch = (\n query: Record<string, unknown>,\n options: Pick<IStringifyOptions, 'arrayFormat'> = {},\n) => {\n return qs.stringify(query, {\n encodeValuesOnly: true,\n skipNulls: true,\n ...options,\n });\n};\n\nexport const createBody = (body: BodyParam, headers: Headers) => {\n if (body == null) return null;\n if (body instanceof FormData) return body; // fetch automatically sets content-type header\n if (typeof body === 'string') return body; // fetch automatically sets content-type header\n\n const stringifyBody = JSON.stringify(body);\n const stringBody = stringifyBody === '{}' ? null : stringifyBody;\n if (stringBody) headers.set(HttpHeader.CONTENT_TYPE, HttpContentType.JSON);\n\n return stringBody;\n};\n\nexport const parseContentDispositionHeader = (contentDisposition?: string | null) => {\n // extract the type ('inline' or 'attachment'), default the type to 'unknown'\n const type = (() => {\n const typeMatch = contentDisposition?.match(/^\\s*(inline|attachment)\\s*;/i);\n return (typeMatch?.[1]?.toLowerCase() ?? 'unknown') as 'inline' | 'attachment' | 'unknown';\n })();\n\n // extract the filename, default the type to null\n const filename = (() => {\n const filenameMatch = contentDisposition?.match(/filename=\"([^\"]+)\"/i);\n if (filenameMatch) return filenameMatch[1];\n\n // If no filename=\"...\", check for encoded filename*=UTF-8''\n const encodedFilenameMatch = contentDisposition?.match(/filename\\*=(?:UTF-8'')?([^;]+)/i);\n if (encodedFilenameMatch?.[1]) return decodeURIComponent(encodedFilenameMatch[1]);\n\n // Check for unquoted filenames (rare but possible)\n const unquotedFilenameMatch = contentDisposition?.match(/filename=([^;]+)/i);\n return unquotedFilenameMatch?.[1] ?? null;\n })();\n\n // Return the parsed result\n return { type, filename };\n};\n\nexport const createFetchRequest: CreateFetchRequestFn = ({\n url,\n method,\n params,\n options = {},\n defaultOptions,\n}) => {\n const {\n baseUrl,\n validateStatus: defValidateStatus = defaultValidateStatus,\n headers: defaultHeaders,\n ...restDefaultOptions\n } = defaultOptions;\n const { validateStatus, queryArrayFormat, headers: endpointHeaders, ...restOptions } = options;\n\n const headers = createHeaders(defaultHeaders, endpointHeaders);\n const path = createPath(url, params.path);\n const search = createSearch(params.query ?? {}, { arrayFormat: queryArrayFormat });\n const body = createBody(params.body, headers);\n\n const urlInstance = new URL(baseUrl + path);\n urlInstance.search = search;\n\n const request = new Request(urlInstance, {\n ...restDefaultOptions,\n ...restOptions,\n headers,\n method: method.toUpperCase(),\n body,\n });\n\n return { request, validateStatus: validateStatus ?? defValidateStatus };\n};\n","import { ApiError } from '../../errors';\n\nimport type {\n BaseFetchParams,\n CoreFetchFn,\n CreateFetchClientOptions,\n FetchClientOptions,\n FetchFn,\n HttpMethod,\n} from './types';\nimport { createFetchRequest, parseData } from './utils';\n\nexport type FetchClientError = TypeError | ApiError | SyntaxError | DOMException;\n\nexport const isApiError = (error: unknown): error is ApiError => error instanceof ApiError;\n\nexport const isAbortError = (error: unknown): error is DOMException =>\n error instanceof DOMException && error.name === 'AbortError';\n\nexport const isFetchClientError = (error: unknown): error is FetchClientError =>\n error instanceof TypeError || error instanceof SyntaxError || isApiError(error);\n\nconst createCoreFetch =\n (fetchFn: FetchFn): CoreFetchFn =>\n async ({ request, validateStatus }) => {\n const response = await fetchFn(request);\n const data = await parseData(response);\n\n const apiResponse = {\n request,\n response,\n data,\n };\n\n const boolOrError = validateStatus(apiResponse);\n if (isApiError(boolOrError)) throw boolOrError;\n if (!boolOrError) throw new ApiError(apiResponse);\n\n return apiResponse;\n };\n\nexport const createFetchClient = ({\n middlewares = [],\n ...defaultOptions\n}: CreateFetchClientOptions) => {\n const coreFetch = createCoreFetch(defaultOptions.fetchFn ?? fetch);\n const fetchWithMiddlewares = middlewares.reduceRight(\n (next, middleware) => middleware(next),\n coreFetch,\n );\n\n const createFetchMethod =\n (method: HttpMethod) =>\n async (url: string, params: BaseFetchParams, options: FetchClientOptions = {}) => {\n const request = createFetchRequest({\n url,\n method,\n params,\n defaultOptions,\n options,\n });\n\n const methodMiddlewares = options?.middlewares ?? [];\n\n return methodMiddlewares.reduceRight(\n (next, middleware) => middleware(next),\n fetchWithMiddlewares,\n )(request);\n };\n\n return {\n get: createFetchMethod('get'),\n post: createFetchMethod('post'),\n put: createFetchMethod('put'),\n patch: createFetchMethod('patch'),\n delete: createFetchMethod('delete'),\n };\n};\n","import {\n type ApiResponse,\n createFetchClient,\n type CreateFetchClientOptions,\n type FetchClientOptions,\n type HttpMethod,\n} from './createFetchClient';\nimport type { OpenapiParametersType, OpenapiReturnType } from './types';\n\ntype OpenapiPaths<Paths> = {\n [P in keyof Paths]: {\n [M in HttpMethod]?: unknown;\n };\n};\n\ntype PathsWithMethod<Paths extends OpenapiPaths<Paths>, PathnameMethod extends HttpMethod> = {\n [Pathname in keyof Paths]: Paths[Pathname] extends {\n [K in PathnameMethod]: any;\n }\n ? Pathname\n : never;\n}[keyof Paths];\n\ntype FetchMethod<Paths extends OpenapiPaths<Paths>, Method extends HttpMethod> = <\n Path extends PathsWithMethod<Paths, Method>,\n>(\n url: Path,\n params: OpenapiParametersType<Paths[Path][Method]>,\n options?: FetchClientOptions,\n) => Promise<ApiResponse<OpenapiReturnType<Paths[Path][Method]>>>;\n\ntype FetchClient<Paths extends OpenapiPaths<Paths>> = {\n get: FetchMethod<Paths, 'get'>;\n post: FetchMethod<Paths, 'post'>;\n put: FetchMethod<Paths, 'put'>;\n patch: FetchMethod<Paths, 'patch'>;\n delete: FetchMethod<Paths, 'delete'>;\n};\n\nexport const createOpenapiFetchClient = <Paths extends OpenapiPaths<Paths>>(\n defaultOptions: CreateFetchClientOptions,\n) => createFetchClient(defaultOptions) as FetchClient<Paths>;\n","export const SyncAction = {\n DATA_APP_GIT_REPOSITORY: 'git-repository',\n GIT_REPOSITORY: 'gitRepository',\n ENROLL_MFA: 'enrollMFA',\n};\n\nexport const Component = {\n DATA_APP: 'keboola.data-apps',\n};\n","import * as z from 'zod';\n\nconst Author = z.object({\n name: z.string(),\n email: z.email(),\n});\n\nconst RepositoryBranch = z.object({\n sha: z.string(),\n date: z.string(),\n comment: z.string(),\n branch: z.string(),\n author: Author,\n});\n\nexport const Repository = z.object({\n repository: z.object({\n url: z.string(),\n }),\n branches: z.array(RepositoryBranch),\n});\n","type GitRepoConfig = {\n username?: string;\n '#password'?: string;\n '#sshKey'?: string;\n};\n\nclass GitRepoConfigDataBuilder {\n private readonly repositoryUrl: string;\n private config: GitRepoConfig = {};\n\n constructor(repositoryUrl: string) {\n this.repositoryUrl = repositoryUrl;\n }\n\n withCredentials(username: string, password: string) {\n this.config.username = username;\n\n delete this.config['#sshKey'];\n this.config['#password'] = password;\n return this;\n }\n\n withSshKey(username: string, sshKey: string) {\n this.config.username = username;\n\n delete this.config['#password'];\n this.config['#sshKey'] = sshKey;\n return this;\n }\n\n build() {\n return {\n parameters: {\n git: {\n repo: this.repositoryUrl,\n ...this.config,\n },\n },\n };\n }\n\n buildForDataApp() {\n return {\n parameters: {\n dataApp: {\n git: {\n repository: this.repositoryUrl,\n ...this.config,\n },\n },\n },\n };\n }\n}\n\nexport const createGitRepoConfigDataBuilder = (repositoryUrl: string) =>\n new GitRepoConfigDataBuilder(repositoryUrl);\n","import { Component, SyncAction } from '../constants';\nimport type { SendSyncAction } from '../syncActionsClient';\n\nimport { Repository } from './schemas';\nimport type {\n GetDataAppPasswordPrivateGitRepositoryInput,\n GetDataAppPublicGitRepositoryInput,\n GetDataAppSSHKeyPrivateGitRepositoryInput,\n GetGitPrivateRepositoryInput,\n GetPublicGitRepositoryInput,\n} from './types';\nimport { createGitRepoConfigDataBuilder } from './utils';\n\nexport const createGitRepository = (sendSyncAction: SendSyncAction) => {\n const getDataAppPublicGitRepository = async (\n { repositoryUrl, ...other }: GetDataAppPublicGitRepositoryInput,\n signal?: AbortSignal,\n ) => {\n const data = await sendSyncAction(\n {\n ...other,\n action: SyncAction.DATA_APP_GIT_REPOSITORY,\n componentId: Component.DATA_APP,\n configData: createGitRepoConfigDataBuilder(repositoryUrl).buildForDataApp(),\n },\n signal,\n );\n\n return Repository.parse(data);\n };\n\n const getDataAppPasswordPrivateGitRepository = async (\n { repositoryUrl, username, password, ...other }: GetDataAppPasswordPrivateGitRepositoryInput,\n signal?: AbortSignal,\n ) => {\n const data = await sendSyncAction(\n {\n ...other,\n action: SyncAction.DATA_APP_GIT_REPOSITORY,\n componentId: Component.DATA_APP,\n configData: createGitRepoConfigDataBuilder(repositoryUrl)\n .withCredentials(username, password)\n .buildForDataApp(),\n },\n signal,\n );\n\n return Repository.parse(data);\n };\n\n const getDataAppSSHKeyPrivateGitRepository = async (\n { repositoryUrl, username, sshKey, ...other }: GetDataAppSSHKeyPrivateGitRepositoryInput,\n signal?: AbortSignal,\n ) => {\n const data = await sendSyncAction(\n {\n ...other,\n action: SyncAction.DATA_APP_GIT_REPOSITORY,\n componentId: Component.DATA_APP,\n configData: createGitRepoConfigDataBuilder(repositoryUrl)\n .withSshKey(username, sshKey)\n .buildForDataApp(),\n },\n signal,\n );\n\n return Repository.parse(data);\n };\n\n const getPublicGitRepository = async (\n { repositoryUrl, componentId, ...other }: GetPublicGitRepositoryInput,\n signal?: AbortSignal,\n ) => {\n const data = await sendSyncAction(\n {\n ...other,\n action: SyncAction.GIT_REPOSITORY,\n componentId,\n configData: createGitRepoConfigDataBuilder(repositoryUrl).build(),\n },\n signal,\n );\n\n return Repository.parse(data);\n };\n\n const getPrivateGitRepository = async (\n { repositoryUrl, username, password, componentId, ...other }: GetGitPrivateRepositoryInput,\n signal?: AbortSignal,\n ) => {\n const data = await sendSyncAction(\n {\n ...other,\n action: SyncAction.GIT_REPOSITORY,\n componentId,\n configData: createGitRepoConfigDataBuilder(repositoryUrl)\n .withCredentials(username, password)\n .build(),\n },\n signal,\n );\n\n return Repository.parse(data);\n };\n\n return {\n getDataAppPublicGitRepository,\n getDataAppPasswordPrivateGitRepository,\n getDataAppSSHKeyPrivateGitRepository,\n getPublicGitRepository,\n getPrivateGitRepository,\n };\n};\n","import { createOpenapiFetchClient } from '../../fetchClient';\nimport type { ClientInitOptions } from '../types';\n\nimport type { paths } from './__generated__/schema';\nimport { SyncAction } from './constants';\nimport { createGitRepository } from './gitRepository';\nimport type { EnrollMFAInput, PostActionsBody, PostActionsBodyRaw } from './types';\n\n/**\n * Creates a call private action endpoint.\n */\nconst createSendSyncAction = (client: SyncActionClient) => {\n return async (body: PostActionsBody, signal?: AbortSignal) => {\n const { data } = await client.post(\n '/actions',\n {\n body: body as unknown as PostActionsBodyRaw,\n },\n { signal },\n );\n\n return data;\n };\n};\n\nexport type SendSyncAction = ReturnType<typeof createSendSyncAction>;\ntype SyncActionClient = ReturnType<typeof createOpenapiFetchClient<paths>>;\n\nexport const createSyncActionsClient = ({ baseUrl, middlewares }: ClientInitOptions) => {\n const client = createOpenapiFetchClient<paths>({\n baseUrl,\n middlewares,\n });\n\n const sendSyncAction = createSendSyncAction(client);\n\n const enrollMFA = ({ email, ...rest }: EnrollMFAInput, signal?: AbortSignal) => {\n return sendSyncAction(\n {\n ...rest,\n action: SyncAction.ENROLL_MFA,\n configData: {\n parameters: {\n user: {\n email,\n },\n },\n },\n },\n signal,\n );\n };\n\n return {\n enrollMFA,\n gitRepository: createGitRepository(sendSyncAction),\n };\n};\n"]}
@@ -18,6 +18,12 @@ var ApiError = class extends Error {
18
18
  this.data = data;
19
19
  }
20
20
  };
21
+
22
+ // src/constants.ts
23
+ var HttpStatus = {
24
+ NO_CONTENT: 204};
25
+
26
+ // src/fetchClient/createFetchClient/utils.ts
21
27
  var HttpHeader = {
22
28
  CONTENT_TYPE: "content-type"};
23
29
  var HttpContentType = {
@@ -31,7 +37,7 @@ function removeUndefined(obj) {
31
37
  return objCopy;
32
38
  }
33
39
  var parseData = async (response) => {
34
- if (response.status === 204) return null;
40
+ if (response.status === HttpStatus.NO_CONTENT) return null;
35
41
  const contentType = response.headers.get(HttpHeader.CONTENT_TYPE);
36
42
  if (contentType && contentType == HttpContentType.JSON) {
37
43
  return response.json();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/errors/ApiError.ts","../../src/fetchClient/createFetchClient/utils.ts","../../src/fetchClient/createFetchClient/createFetchClient.ts","../../src/fetchClient/createGenericFetchClient.ts","../../src/clients/telemetry/provisioning/provisioning.ts","../../src/clients/telemetry/telemet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yBAAA;AAAA,MACA,EAAE,IAAA,EAAK;AAAA,MACP,EAAE,MAAA;AAAO,KACX;AAEA,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAEA,EAAA,OAAO;AAAA,IACL;AAAA,GACF;AACF,CAAA;;;ACXO,IAAM,qBAAA,GAAwB,CAAC,EAAE,OAAA,EAAS,aAAY,KAAyB;AACpF,EAAA,MAAM,SAAS,wBAAA,CAAyB;AAAA,IACtC,OAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,OAAO;AAAA,IACL,YAAA,EAAc,mBAAmB,MAAM;AAAA,GACzC;AACF","file":"index.cjs","sourcesContent":["import type { ApiResponse } from '../fetchClient/createFetchClient/types';\n\nexport class ApiError extends Error {\n response: Response;\n request: Request;\n data: unknown;\n\n constructor({ response, request, data }: ApiResponse) {\n super(response.statusText);\n this.response = response;\n this.request = request;\n this.data = data;\n }\n}\n","import type { IStringifyOptions } from 'qs';\nimport qs from 'qs';\n\nimport type { BodyParam, CreateFetchRequestFn, PathParam, ValidateStatusFn } from './types';\n\nexport const HttpHeader = {\n CONTENT_TYPE: 'content-type',\n CONTENT_DISPOSITION: 'content-disposition',\n};\n\nexport const HttpContentType = {\n JSON: 'application/json',\n TEXT_PLAIN: 'text/plain',\n FORM_DATA: 'multipart/form-data',\n TEXT_HTML: 'text/html',\n};\n\nexport const defaultValidateStatus: ValidateStatusFn = ({ response }) =>\n response.status >= 200 && response.status <= 299;\n\nfunction removeUndefined(obj: Record<string, string>) {\n const objCopy = { ...obj };\n for (const [key, value] of Object.entries(objCopy)) {\n if (value == null) delete objCopy[key];\n }\n return objCopy;\n}\n\nexport const parseData = async (response: Response) => {\n // HTTP 204 - no content\n if (response.status === 204) return null;\n\n // headers indicates that the content is JSON, so parse it.\n const contentType = response.headers.get(HttpHeader.CONTENT_TYPE);\n if (contentType && contentType == HttpContentType.JSON) {\n return response.json();\n }\n\n // try JSON parsing on the text\n // If it fails, return the string. The headers does not have a content type.\n const text = await response.text();\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n};\n\n// Header instance serialize undefined value as `undefined`, we do not want that\nconst cleanHeadersInit = (headersInit: HeadersInit | undefined) => {\n if (Array.isArray(headersInit)) return headersInit;\n if (headersInit instanceof Headers) return headersInit;\n if (headersInit == null) return headersInit;\n\n return removeUndefined(headersInit);\n};\n\nconst createHeaders = (\n headersInitA: HeadersInit | undefined,\n headersInitB: HeadersInit | undefined,\n) => {\n const headersA = new Headers(cleanHeadersInit(headersInitA));\n const headersB = new Headers(cleanHeadersInit(headersInitB));\n\n headersB.forEach((value, key) => {\n headersA.set(key, value);\n });\n\n return headersA;\n};\n\nexport const createPath = (path: string, pathParam: PathParam = {}) =>\n path.replace(/\\{([^}]+)}/g, (_, key) => {\n if (!(key in pathParam))\n throw new Error(`Path parameter \"${key}\" is missing in the path \"${path}\"`);\n\n return encodeURIComponent(pathParam[key]!);\n });\n\nexport const createSearch = (\n query: Record<string, unknown>,\n options: Pick<IStringifyOptions, 'arrayFormat'> = {},\n) => {\n return qs.stringify(query, {\n encodeValuesOnly: true,\n skipNulls: true,\n ...options,\n });\n};\n\nexport const createBody = (body: BodyParam, headers: Headers) => {\n if (body == null) return null;\n if (body instanceof FormData) return body; // fetch automatically sets content-type header\n if (typeof body === 'string') return body; // fetch automatically sets content-type header\n\n const stringifyBody = JSON.stringify(body);\n const stringBody = stringifyBody === '{}' ? null : stringifyBody;\n if (stringBody) headers.set(HttpHeader.CONTENT_TYPE, HttpContentType.JSON);\n\n return stringBody;\n};\n\nexport const parseContentDispositionHeader = (contentDisposition?: string | null) => {\n // extract the type ('inline' or 'attachment'), default the type to 'unknown'\n const type = (() => {\n const typeMatch = contentDisposition?.match(/^\\s*(inline|attachment)\\s*;/i);\n return (typeMatch?.[1]?.toLowerCase() ?? 'unknown') as 'inline' | 'attachment' | 'unknown';\n })();\n\n // extract the filename, default the type to null\n const filename = (() => {\n const filenameMatch = contentDisposition?.match(/filename=\"([^\"]+)\"/i);\n if (filenameMatch) return filenameMatch[1];\n\n // If no filename=\"...\", check for encoded filename*=UTF-8''\n const encodedFilenameMatch = contentDisposition?.match(/filename\\*=(?:UTF-8'')?([^;]+)/i);\n if (encodedFilenameMatch?.[1]) return decodeURIComponent(encodedFilenameMatch[1]);\n\n // Check for unquoted filenames (rare but possible)\n const unquotedFilenameMatch = contentDisposition?.match(/filename=([^;]+)/i);\n return unquotedFilenameMatch?.[1] ?? null;\n })();\n\n // Return the parsed result\n return { type, filename };\n};\n\nexport const createFetchRequest: CreateFetchRequestFn = ({\n url,\n method,\n params,\n options = {},\n defaultOptions,\n}) => {\n const {\n baseUrl,\n validateStatus: defValidateStatus = defaultValidateStatus,\n headers: defaultHeaders,\n ...restDefaultOptions\n } = defaultOptions;\n const { validateStatus, queryArrayFormat, headers: endpointHeaders, ...restOptions } = options;\n\n const headers = createHeaders(defaultHeaders, endpointHeaders);\n const path = createPath(url, params.path);\n const search = createSearch(params.query ?? {}, { arrayFormat: queryArrayFormat });\n const body = createBody(params.body, headers);\n\n const urlInstance = new URL(baseUrl + path);\n urlInstance.search = search;\n\n const request = new Request(urlInstance, {\n ...restDefaultOptions,\n ...restOptions,\n headers,\n method: method.toUpperCase(),\n body,\n });\n\n return { request, validateStatus: validateStatus ?? defValidateStatus };\n};\n","import { ApiError } from '../../errors';\n\nimport type {\n BaseFetchParams,\n CoreFetchFn,\n CreateFetchClientOptions,\n FetchClientOptions,\n FetchFn,\n HttpMethod,\n} from './types';\nimport { createFetchRequest, parseData } from './utils';\n\nexport type FetchClientError = TypeError | ApiError | SyntaxError | DOMException;\n\nexport const isApiError = (error: unknown): error is ApiError => error instanceof ApiError;\n\nexport const isAbortError = (error: unknown): error is DOMException =>\n error instanceof DOMException && error.name === 'AbortError';\n\nexport const isFetchClientError = (error: unknown): error is FetchClientError =>\n error instanceof TypeError || error instanceof SyntaxError || isApiError(error);\n\nconst createCoreFetch =\n (fetchFn: FetchFn): CoreFetchFn =>\n async ({ request, validateStatus }) => {\n const response = await fetchFn(request);\n const data = await parseData(response);\n\n const apiResponse = {\n request,\n response,\n data,\n };\n\n const boolOrError = validateStatus(apiResponse);\n if (isApiError(boolOrError)) throw boolOrError;\n if (!boolOrError) throw new ApiError(apiResponse);\n\n return apiResponse;\n };\n\nexport const createFetchClient = ({\n middlewares = [],\n ...defaultOptions\n}: CreateFetchClientOptions) => {\n const coreFetch = createCoreFetch(defaultOptions.fetchFn ?? fetch);\n const fetchWithMiddlewares = middlewares.reduceRight(\n (next, middleware) => middleware(next),\n coreFetch,\n );\n\n const createFetchMethod =\n (method: HttpMethod) =>\n async (url: string, params: BaseFetchParams, options: FetchClientOptions = {}) => {\n const request = createFetchRequest({\n url,\n method,\n params,\n defaultOptions,\n options,\n });\n\n const methodMiddlewares = options?.middlewares ?? [];\n\n return methodMiddlewares.reduceRight(\n (next, middleware) => middleware(next),\n fetchWithMiddlewares,\n )(request);\n };\n\n return {\n get: createFetchMethod('get'),\n post: createFetchMethod('post'),\n put: createFetchMethod('put'),\n patch: createFetchMethod('patch'),\n delete: createFetchMethod('delete'),\n };\n};\n","import type {\n ApiResponse,\n BodyParam,\n CreateFetchClientOptions,\n FetchClientOptions,\n PathParam,\n QueryParam,\n} from './createFetchClient';\nimport { createFetchClient } from './createFetchClient';\n\ntype FetchParams<Path = PathParam, Query = QueryParam, Body = BodyParam> = {\n path?: Path;\n query?: Query;\n body?: Body;\n};\n\ntype FetchMethod = <Data, Path = PathParam, Query = QueryParam, Body = BodyParam>(\n url: string,\n params: FetchParams<Path, Query, Body>,\n options?: FetchClientOptions,\n) => Promise<ApiResponse<Data>>;\n\ntype FetchClient = {\n get: FetchMethod;\n post: FetchMethod;\n put: FetchMethod;\n patch: FetchMethod;\n delete: FetchMethod;\n};\n\nexport const createGenericFetchClient = (defaultOptions: CreateFetchClientOptions) =>\n createFetchClient(defaultOptions) as FetchClient;\n","import type { GenericFetchClient } from '../telemetryClient';\n\nimport type { CreateCredentialsBody, WorkspaceData } from './types';\n\nexport const createProvisioning = (client: GenericFetchClient) => {\n const createCredentials = async (body: CreateCredentialsBody, signal?: AbortSignal) => {\n const { data } = await client.post<WorkspaceData, void, void, CreateCredentialsBody>(\n '/provisioning/workspace',\n { body },\n { signal },\n );\n\n return data;\n };\n\n return {\n createCredentials,\n };\n};\n","import { createGenericFetchClient } from '../../fetchClient';\nimport type { ClientInitOptions } from '../types';\n\nimport { createProvisioning } from './provisioning/provisioning';\n\nexport type GenericFetchClient = ReturnType<typeof createGenericFetchClient>;\n\nexport const createTelemetryClient = ({ baseUrl, middlewares }: ClientInitOptions) => {\n const client = createGenericFetchClient({\n baseUrl,\n middlewares,\n });\n\n return {\n provisioning: createProvisioning(client),\n };\n};\n"]}
1
+ {"version":3,"sources":["../../src/errors/ApiError.ts","../../src/constants.ts","../../src/fetchClient/createFetchClient/utils.ts","../../src/fetchClient/createFetchClient/createFetchClient.ts","../../src/fetchClient/createGenericFetchClient.ts","../../src/clients/telemetry/provisioning/provisioning.ts","../../src/clients/telemetry/telemetryClient.ts"],"names":["qs"],"mappings":";;;;;;;;;AAEO,IAAM,QAAA,GAAN,cAAuB,KAAA,CAAM;AAAA,EAClC,QAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EAEA,WAAA,CAAY,EAAE,QAAA,EAAU,OAAA,EAAS,MAAK,EAAgB;AACpD,IAAA,KAAA,CAAM,SAAS,UAAU,CAAA;AACzB,IAAA,IAAA,CAAK,QAAA,GAAW,QAAA;AAChB,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AAAA,EACd;AACF,CAAA;;;ACPO,IAAM,UAAA,GAAa;AAAA,EACxB,UAAA,EAAY,GAOd,CAAA;;;ACPO,IAAM,UAAA,GAAa;AAAA,EACxB,YAAA,EAAc,cAEhB,CAAA;AAEO,IAAM,eAAA,GAAkB;AAAA,EAC7B,IAAA,EAAM,kBAIR,CAAA;AAEO,IAAM,qBAAA,GAA0C,CAAC,EA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EAAC;AAEnD,IAAA,OAAO,iBAAA,CAAkB,WAAA;AAAA,MACvB,CAAC,IAAA,EAAM,UAAA,KAAe,UAAA,CAAW,IAAI,CAAA;AAAA,MACrC;AAAA,MACA,OAAO,CAAA;AAAA,EACX,CAAA;AAEF,EAAA,OAAO;AAAA,IACL,GAAA,EAAK,kBAAkB,KAAK,CAAA;AAAA,IAC5B,IAAA,EAAM,kBAAkB,MAAM,CAAA;AAAA,IAC9B,GAAA,EAAK,kBAAkB,KAAK,CAAA;AAAA,IAC5B,KAAA,EAAO,kBAAkB,OAAO,CAAA;AAAA,IAChC,MAAA,EAAQ,kBAAkB,QAAQ;AAAA,GACpC;AACF,CAAA;;;AC/CO,IAAM,wBAAA,GAA2B,CAAC,cAAA,KACvC,iBAAA,CAAkB,cAAc,CAAA;;;AC3B3B,IAAM,kBAAA,GAAqB,CAAC,MAAA,KAA+B;AAChE,EAAA,MAAM,iBAAA,GAAoB,OAAO,IAAA,EAA6B,MAAA,KAAyB;AACrF,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,MAAA,CAAO,IAAA;AAAA,MAC5B,yBAAA;AAAA,MACA,EAAE,IAAA,EAAK;AAAA,MACP,EAAE,MAAA;AAAO,KACX;AAEA,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAEA,EAAA,OAAO;AAAA,IACL;AAAA,GACF;AACF,CAAA;;;ACXO,IAAM,qBAAA,GAAwB,CAAC,EAAE,OAAA,EAAS,aAAY,KAAyB;AACpF,EAAA,MAAM,SAAS,wBAAA,CAAyB;AAAA,IACtC,OAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,OAAO;AAAA,IACL,YAAA,EAAc,mBAAmB,MAAM;AAAA,GACzC;AACF","file":"index.cjs","sourcesContent":["import type { ApiResponse } from '../fetchClient/createFetchClient/types';\n\nexport class ApiError extends Error {\n response: Response;\n request: Request;\n data: unknown;\n\n constructor({ response, request, data }: ApiResponse) {\n super(response.statusText);\n this.response = response;\n this.request = request;\n this.data = data;\n }\n}\n","export const KeboolaHttpHeader = {\n STORAGE_API_TOKEN: 'X-StorageApi-Token',\n MANAGEMENT_API_TOKEN: 'X-Kbc-Manageapitoken',\n STORAGE_API_URL: 'x-storageapi-url',\n};\n\nexport const HttpStatus = {\n NO_CONTENT: 204,\n BAD_REQUEST: 400,\n UNPROCESSABLE_ENTITY: 422,\n INTERNAL_SERVER_ERROR: 500,\n BAD_GATEWAY: 502,\n SERVICE_UNAVAILABLE: 503,\n GATEWAY_TIMEOUT: 504,\n} as const;\n\nexport const ENCRYPTED_VALUE_PREFIX = 'KBC::';\n","import type { IStringifyOptions } from 'qs';\nimport qs from 'qs';\n\nimport { HttpStatus } from '../../constants';\n\nimport type { BodyParam, CreateFetchRequestFn, PathParam, ValidateStatusFn } from './types';\n\nexport const HttpHeader = {\n CONTENT_TYPE: 'content-type',\n CONTENT_DISPOSITION: 'content-disposition',\n};\n\nexport const HttpContentType = {\n JSON: 'application/json',\n TEXT_PLAIN: 'text/plain',\n FORM_DATA: 'multipart/form-data',\n TEXT_HTML: 'text/html',\n};\n\nexport const defaultValidateStatus: ValidateStatusFn = ({ response }) =>\n response.status >= 200 && response.status <= 299;\n\nfunction removeUndefined(obj: Record<string, string>) {\n const objCopy = { ...obj };\n for (const [key, value] of Object.entries(objCopy)) {\n if (value == null) delete objCopy[key];\n }\n return objCopy;\n}\n\nexport const parseData = async (response: Response) => {\n if (response.status === HttpStatus.NO_CONTENT) return null;\n\n // headers indicates that the content is JSON, so parse it.\n const contentType = response.headers.get(HttpHeader.CONTENT_TYPE);\n if (contentType && contentType == HttpContentType.JSON) {\n return response.json();\n }\n\n // try JSON parsing on the text\n // If it fails, return the string. The headers does not have a content type.\n const text = await response.text();\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n};\n\n// Header instance serialize undefined value as `undefined`, we do not want that\nconst cleanHeadersInit = (headersInit: HeadersInit | undefined) => {\n if (Array.isArray(headersInit)) return headersInit;\n if (headersInit instanceof Headers) return headersInit;\n if (headersInit == null) return headersInit;\n\n return removeUndefined(headersInit);\n};\n\nconst createHeaders = (\n headersInitA: HeadersInit | undefined,\n headersInitB: HeadersInit | undefined,\n) => {\n const headersA = new Headers(cleanHeadersInit(headersInitA));\n const headersB = new Headers(cleanHeadersInit(headersInitB));\n\n headersB.forEach((value, key) => {\n headersA.set(key, value);\n });\n\n return headersA;\n};\n\nexport const createPath = (path: string, pathParam: PathParam = {}) =>\n path.replace(/\\{([^}]+)}/g, (_, key) => {\n if (!(key in pathParam))\n throw new Error(`Path parameter \"${key}\" is missing in the path \"${path}\"`);\n\n return encodeURIComponent(pathParam[key]!);\n });\n\nexport const createSearch = (\n query: Record<string, unknown>,\n options: Pick<IStringifyOptions, 'arrayFormat'> = {},\n) => {\n return qs.stringify(query, {\n encodeValuesOnly: true,\n skipNulls: true,\n ...options,\n });\n};\n\nexport const createBody = (body: BodyParam, headers: Headers) => {\n if (body == null) return null;\n if (body instanceof FormData) return body; // fetch automatically sets content-type header\n if (typeof body === 'string') return body; // fetch automatically sets content-type header\n\n const stringifyBody = JSON.stringify(body);\n const stringBody = stringifyBody === '{}' ? null : stringifyBody;\n if (stringBody) headers.set(HttpHeader.CONTENT_TYPE, HttpContentType.JSON);\n\n return stringBody;\n};\n\nexport const parseContentDispositionHeader = (contentDisposition?: string | null) => {\n // extract the type ('inline' or 'attachment'), default the type to 'unknown'\n const type = (() => {\n const typeMatch = contentDisposition?.match(/^\\s*(inline|attachment)\\s*;/i);\n return (typeMatch?.[1]?.toLowerCase() ?? 'unknown') as 'inline' | 'attachment' | 'unknown';\n })();\n\n // extract the filename, default the type to null\n const filename = (() => {\n const filenameMatch = contentDisposition?.match(/filename=\"([^\"]+)\"/i);\n if (filenameMatch) return filenameMatch[1];\n\n // If no filename=\"...\", check for encoded filename*=UTF-8''\n const encodedFilenameMatch = contentDisposition?.match(/filename\\*=(?:UTF-8'')?([^;]+)/i);\n if (encodedFilenameMatch?.[1]) return decodeURIComponent(encodedFilenameMatch[1]);\n\n // Check for unquoted filenames (rare but possible)\n const unquotedFilenameMatch = contentDisposition?.match(/filename=([^;]+)/i);\n return unquotedFilenameMatch?.[1] ?? null;\n })();\n\n // Return the parsed result\n return { type, filename };\n};\n\nexport const createFetchRequest: CreateFetchRequestFn = ({\n url,\n method,\n params,\n options = {},\n defaultOptions,\n}) => {\n const {\n baseUrl,\n validateStatus: defValidateStatus = defaultValidateStatus,\n headers: defaultHeaders,\n ...restDefaultOptions\n } = defaultOptions;\n const { validateStatus, queryArrayFormat, headers: endpointHeaders, ...restOptions } = options;\n\n const headers = createHeaders(defaultHeaders, endpointHeaders);\n const path = createPath(url, params.path);\n const search = createSearch(params.query ?? {}, { arrayFormat: queryArrayFormat });\n const body = createBody(params.body, headers);\n\n const urlInstance = new URL(baseUrl + path);\n urlInstance.search = search;\n\n const request = new Request(urlInstance, {\n ...restDefaultOptions,\n ...restOptions,\n headers,\n method: method.toUpperCase(),\n body,\n });\n\n return { request, validateStatus: validateStatus ?? defValidateStatus };\n};\n","import { ApiError } from '../../errors';\n\nimport type {\n BaseFetchParams,\n CoreFetchFn,\n CreateFetchClientOptions,\n FetchClientOptions,\n FetchFn,\n HttpMethod,\n} from './types';\nimport { createFetchRequest, parseData } from './utils';\n\nexport type FetchClientError = TypeError | ApiError | SyntaxError | DOMException;\n\nexport const isApiError = (error: unknown): error is ApiError => error instanceof ApiError;\n\nexport const isAbortError = (error: unknown): error is DOMException =>\n error instanceof DOMException && error.name === 'AbortError';\n\nexport const isFetchClientError = (error: unknown): error is FetchClientError =>\n error instanceof TypeError || error instanceof SyntaxError || isApiError(error);\n\nconst createCoreFetch =\n (fetchFn: FetchFn): CoreFetchFn =>\n async ({ request, validateStatus }) => {\n const response = await fetchFn(request);\n const data = await parseData(response);\n\n const apiResponse = {\n request,\n response,\n data,\n };\n\n const boolOrError = validateStatus(apiResponse);\n if (isApiError(boolOrError)) throw boolOrError;\n if (!boolOrError) throw new ApiError(apiResponse);\n\n return apiResponse;\n };\n\nexport const createFetchClient = ({\n middlewares = [],\n ...defaultOptions\n}: CreateFetchClientOptions) => {\n const coreFetch = createCoreFetch(defaultOptions.fetchFn ?? fetch);\n const fetchWithMiddlewares = middlewares.reduceRight(\n (next, middleware) => middleware(next),\n coreFetch,\n );\n\n const createFetchMethod =\n (method: HttpMethod) =>\n async (url: string, params: BaseFetchParams, options: FetchClientOptions = {}) => {\n const request = createFetchRequest({\n url,\n method,\n params,\n defaultOptions,\n options,\n });\n\n const methodMiddlewares = options?.middlewares ?? [];\n\n return methodMiddlewares.reduceRight(\n (next, middleware) => middleware(next),\n fetchWithMiddlewares,\n )(request);\n };\n\n return {\n get: createFetchMethod('get'),\n post: createFetchMethod('post'),\n put: createFetchMethod('put'),\n patch: createFetchMethod('patch'),\n delete: createFetchMethod('delete'),\n };\n};\n","import type {\n ApiResponse,\n BodyParam,\n CreateFetchClientOptions,\n FetchClientOptions,\n PathParam,\n QueryParam,\n} from './createFetchClient';\nimport { createFetchClient } from './createFetchClient';\n\ntype FetchParams<Path = PathParam, Query = QueryParam, Body = BodyParam> = {\n path?: Path;\n query?: Query;\n body?: Body;\n};\n\ntype FetchMethod = <Data, Path = PathParam, Query = QueryParam, Body = BodyParam>(\n url: string,\n params: FetchParams<Path, Query, Body>,\n options?: FetchClientOptions,\n) => Promise<ApiResponse<Data>>;\n\ntype FetchClient = {\n get: FetchMethod;\n post: FetchMethod;\n put: FetchMethod;\n patch: FetchMethod;\n delete: FetchMethod;\n};\n\nexport const createGenericFetchClient = (defaultOptions: CreateFetchClientOptions) =>\n createFetchClient(defaultOptions) as FetchClient;\n","import type { GenericFetchClient } from '../telemetryClient';\n\nimport type { CreateCredentialsBody, WorkspaceData } from './types';\n\nexport const createProvisioning = (client: GenericFetchClient) => {\n const createCredentials = async (body: CreateCredentialsBody, signal?: AbortSignal) => {\n const { data } = await client.post<WorkspaceData, void, void, CreateCredentialsBody>(\n '/provisioning/workspace',\n { body },\n { signal },\n );\n\n return data;\n };\n\n return {\n createCredentials,\n };\n};\n","import { createGenericFetchClient } from '../../fetchClient';\nimport type { ClientInitOptions } from '../types';\n\nimport { createProvisioning } from './provisioning/provisioning';\n\nexport type GenericFetchClient = ReturnType<typeof createGenericFetchClient>;\n\nexport const createTelemetryClient = ({ baseUrl, middlewares }: ClientInitOptions) => {\n const client = createGenericFetchClient({\n baseUrl,\n middlewares,\n });\n\n return {\n provisioning: createProvisioning(client),\n };\n};\n"]}
@@ -12,6 +12,12 @@ var ApiError = class extends Error {
12
12
  this.data = data;
13
13
  }
14
14
  };
15
+
16
+ // src/constants.ts
17
+ var HttpStatus = {
18
+ NO_CONTENT: 204};
19
+
20
+ // src/fetchClient/createFetchClient/utils.ts
15
21
  var HttpHeader = {
16
22
  CONTENT_TYPE: "content-type"};
17
23
  var HttpContentType = {
@@ -25,7 +31,7 @@ function removeUndefined(obj) {
25
31
  return objCopy;
26
32
  }
27
33
  var parseData = async (response) => {
28
- if (response.status === 204) return null;
34
+ if (response.status === HttpStatus.NO_CONTENT) return null;
29
35
  const contentType = response.headers.get(HttpHeader.CONTENT_TYPE);
30
36
  if (contentType && contentType == HttpContentType.JSON) {
31
37
  return response.json();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/errors/ApiError.ts","../../src/fetchClient/createFetchClient/utils.ts","../../src/fetchClient/createFetchClient/createFetchClient.ts","../../src/fetchClient/createGenericFetchClient.ts","../../src/clients/telemetry/provisioning/provisioning.ts","../../src/clients/telemetry/telemetryClient.ts"],"names":[],"mappings":";;;AAEO,IAAM,QAAA,GAAN,cAAuB,KAAA,CAAM;AAAA,EAClC,QAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EAEA,WAAA,CAAY,EAAE,QAAA,EAAU,OAAA,EAAS,MAAK,EAAgB;AACpD,IAAA,KAAA,CAAM,SAAS,UAAU,CAAA;AACzB,IAAA,IAAA,CAAK,QAAA,GAAW,QAAA;AAChB,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,I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,IACL,YAAA,EAAc,mBAAmB,MAAM;AAAA,GACzC;AACF","file":"index.js","sourcesContent":["import type { ApiResponse } from '../fetchClient/createFetchClient/types';\n\nexport class ApiError extends Error {\n response: Response;\n request: Request;\n data: unknown;\n\n constructor({ response, request, data }: ApiResponse) {\n super(response.statusText);\n this.response = response;\n this.request = request;\n this.data = data;\n }\n}\n","import type { IStringifyOptions } from 'qs';\nimport qs from 'qs';\n\nimport type { BodyParam, CreateFetchRequestFn, PathParam, ValidateStatusFn } from './types';\n\nexport const HttpHeader = {\n CONTENT_TYPE: 'content-type',\n CONTENT_DISPOSITION: 'content-disposition',\n};\n\nexport const HttpContentType = {\n JSON: 'application/json',\n TEXT_PLAIN: 'text/plain',\n FORM_DATA: 'multipart/form-data',\n TEXT_HTML: 'text/html',\n};\n\nexport const defaultValidateStatus: ValidateStatusFn = ({ response }) =>\n response.status >= 200 && response.status <= 299;\n\nfunction removeUndefined(obj: Record<string, string>) {\n const objCopy = { ...obj };\n for (const [key, value] of Object.entries(objCopy)) {\n if (value == null) delete objCopy[key];\n }\n return objCopy;\n}\n\nexport const parseData = async (response: Response) => {\n // HTTP 204 - no content\n if (response.status === 204) return null;\n\n // headers indicates that the content is JSON, so parse it.\n const contentType = response.headers.get(HttpHeader.CONTENT_TYPE);\n if (contentType && contentType == HttpContentType.JSON) {\n return response.json();\n }\n\n // try JSON parsing on the text\n // If it fails, return the string. The headers does not have a content type.\n const text = await response.text();\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n};\n\n// Header instance serialize undefined value as `undefined`, we do not want that\nconst cleanHeadersInit = (headersInit: HeadersInit | undefined) => {\n if (Array.isArray(headersInit)) return headersInit;\n if (headersInit instanceof Headers) return headersInit;\n if (headersInit == null) return headersInit;\n\n return removeUndefined(headersInit);\n};\n\nconst createHeaders = (\n headersInitA: HeadersInit | undefined,\n headersInitB: HeadersInit | undefined,\n) => {\n const headersA = new Headers(cleanHeadersInit(headersInitA));\n const headersB = new Headers(cleanHeadersInit(headersInitB));\n\n headersB.forEach((value, key) => {\n headersA.set(key, value);\n });\n\n return headersA;\n};\n\nexport const createPath = (path: string, pathParam: PathParam = {}) =>\n path.replace(/\\{([^}]+)}/g, (_, key) => {\n if (!(key in pathParam))\n throw new Error(`Path parameter \"${key}\" is missing in the path \"${path}\"`);\n\n return encodeURIComponent(pathParam[key]!);\n });\n\nexport const createSearch = (\n query: Record<string, unknown>,\n options: Pick<IStringifyOptions, 'arrayFormat'> = {},\n) => {\n return qs.stringify(query, {\n encodeValuesOnly: true,\n skipNulls: true,\n ...options,\n });\n};\n\nexport const createBody = (body: BodyParam, headers: Headers) => {\n if (body == null) return null;\n if (body instanceof FormData) return body; // fetch automatically sets content-type header\n if (typeof body === 'string') return body; // fetch automatically sets content-type header\n\n const stringifyBody = JSON.stringify(body);\n const stringBody = stringifyBody === '{}' ? null : stringifyBody;\n if (stringBody) headers.set(HttpHeader.CONTENT_TYPE, HttpContentType.JSON);\n\n return stringBody;\n};\n\nexport const parseContentDispositionHeader = (contentDisposition?: string | null) => {\n // extract the type ('inline' or 'attachment'), default the type to 'unknown'\n const type = (() => {\n const typeMatch = contentDisposition?.match(/^\\s*(inline|attachment)\\s*;/i);\n return (typeMatch?.[1]?.toLowerCase() ?? 'unknown') as 'inline' | 'attachment' | 'unknown';\n })();\n\n // extract the filename, default the type to null\n const filename = (() => {\n const filenameMatch = contentDisposition?.match(/filename=\"([^\"]+)\"/i);\n if (filenameMatch) return filenameMatch[1];\n\n // If no filename=\"...\", check for encoded filename*=UTF-8''\n const encodedFilenameMatch = contentDisposition?.match(/filename\\*=(?:UTF-8'')?([^;]+)/i);\n if (encodedFilenameMatch?.[1]) return decodeURIComponent(encodedFilenameMatch[1]);\n\n // Check for unquoted filenames (rare but possible)\n const unquotedFilenameMatch = contentDisposition?.match(/filename=([^;]+)/i);\n return unquotedFilenameMatch?.[1] ?? null;\n })();\n\n // Return the parsed result\n return { type, filename };\n};\n\nexport const createFetchRequest: CreateFetchRequestFn = ({\n url,\n method,\n params,\n options = {},\n defaultOptions,\n}) => {\n const {\n baseUrl,\n validateStatus: defValidateStatus = defaultValidateStatus,\n headers: defaultHeaders,\n ...restDefaultOptions\n } = defaultOptions;\n const { validateStatus, queryArrayFormat, headers: endpointHeaders, ...restOptions } = options;\n\n const headers = createHeaders(defaultHeaders, endpointHeaders);\n const path = createPath(url, params.path);\n const search = createSearch(params.query ?? {}, { arrayFormat: queryArrayFormat });\n const body = createBody(params.body, headers);\n\n const urlInstance = new URL(baseUrl + path);\n urlInstance.search = search;\n\n const request = new Request(urlInstance, {\n ...restDefaultOptions,\n ...restOptions,\n headers,\n method: method.toUpperCase(),\n body,\n });\n\n return { request, validateStatus: validateStatus ?? defValidateStatus };\n};\n","import { ApiError } from '../../errors';\n\nimport type {\n BaseFetchParams,\n CoreFetchFn,\n CreateFetchClientOptions,\n FetchClientOptions,\n FetchFn,\n HttpMethod,\n} from './types';\nimport { createFetchRequest, parseData } from './utils';\n\nexport type FetchClientError = TypeError | ApiError | SyntaxError | DOMException;\n\nexport const isApiError = (error: unknown): error is ApiError => error instanceof ApiError;\n\nexport const isAbortError = (error: unknown): error is DOMException =>\n error instanceof DOMException && error.name === 'AbortError';\n\nexport const isFetchClientError = (error: unknown): error is FetchClientError =>\n error instanceof TypeError || error instanceof SyntaxError || isApiError(error);\n\nconst createCoreFetch =\n (fetchFn: FetchFn): CoreFetchFn =>\n async ({ request, validateStatus }) => {\n const response = await fetchFn(request);\n const data = await parseData(response);\n\n const apiResponse = {\n request,\n response,\n data,\n };\n\n const boolOrError = validateStatus(apiResponse);\n if (isApiError(boolOrError)) throw boolOrError;\n if (!boolOrError) throw new ApiError(apiResponse);\n\n return apiResponse;\n };\n\nexport const createFetchClient = ({\n middlewares = [],\n ...defaultOptions\n}: CreateFetchClientOptions) => {\n const coreFetch = createCoreFetch(defaultOptions.fetchFn ?? fetch);\n const fetchWithMiddlewares = middlewares.reduceRight(\n (next, middleware) => middleware(next),\n coreFetch,\n );\n\n const createFetchMethod =\n (method: HttpMethod) =>\n async (url: string, params: BaseFetchParams, options: FetchClientOptions = {}) => {\n const request = createFetchRequest({\n url,\n method,\n params,\n defaultOptions,\n options,\n });\n\n const methodMiddlewares = options?.middlewares ?? [];\n\n return methodMiddlewares.reduceRight(\n (next, middleware) => middleware(next),\n fetchWithMiddlewares,\n )(request);\n };\n\n return {\n get: createFetchMethod('get'),\n post: createFetchMethod('post'),\n put: createFetchMethod('put'),\n patch: createFetchMethod('patch'),\n delete: createFetchMethod('delete'),\n };\n};\n","import type {\n ApiResponse,\n BodyParam,\n CreateFetchClientOptions,\n FetchClientOptions,\n PathParam,\n QueryParam,\n} from './createFetchClient';\nimport { createFetchClient } from './createFetchClient';\n\ntype FetchParams<Path = PathParam, Query = QueryParam, Body = BodyParam> = {\n path?: Path;\n query?: Query;\n body?: Body;\n};\n\ntype FetchMethod = <Data, Path = PathParam, Query = QueryParam, Body = BodyParam>(\n url: string,\n params: FetchParams<Path, Query, Body>,\n options?: FetchClientOptions,\n) => Promise<ApiResponse<Data>>;\n\ntype FetchClient = {\n get: FetchMethod;\n post: FetchMethod;\n put: FetchMethod;\n patch: FetchMethod;\n delete: FetchMethod;\n};\n\nexport const createGenericFetchClient = (defaultOptions: CreateFetchClientOptions) =>\n createFetchClient(defaultOptions) as FetchClient;\n","import type { GenericFetchClient } from '../telemetryClient';\n\nimport type { CreateCredentialsBody, WorkspaceData } from './types';\n\nexport const createProvisioning = (client: GenericFetchClient) => {\n const createCredentials = async (body: CreateCredentialsBody, signal?: AbortSignal) => {\n const { data } = await client.post<WorkspaceData, void, void, CreateCredentialsBody>(\n '/provisioning/workspace',\n { body },\n { signal },\n );\n\n return data;\n };\n\n return {\n createCredentials,\n };\n};\n","import { createGenericFetchClient } from '../../fetchClient';\nimport type { ClientInitOptions } from '../types';\n\nimport { createProvisioning } from './provisioning/provisioning';\n\nexport type GenericFetchClient = ReturnType<typeof createGenericFetchClient>;\n\nexport const createTelemetryClient = ({ baseUrl, middlewares }: ClientInitOptions) => {\n const client = createGenericFetchClient({\n baseUrl,\n middlewares,\n });\n\n return {\n provisioning: createProvisioning(client),\n };\n};\n"]}
1
+ {"version":3,"sources":["../../src/errors/ApiError.ts","../../src/constants.ts","../../src/fetchClient/createFetchClient/utils.ts","../../src/fetchClient/createFetchClient/createFetchClient.ts","../../src/fetchClient/createGenericFetchClient.ts","../../src/clients/telemetry/provisioning/provisioning.ts","../../src/clients/telemetry/telemetryClient.ts"],"names":[],"mappings":";;;AAEO,IAAM,QAAA,GAAN,cAAuB,KAAA,CAAM;AAAA,EAClC,QAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EAEA,WAAA,CAAY,EAAE,QAAA,EAAU,OAAA,EAAS,MAAK,EAAgB;AACpD,IAAA,KAAA,CAAM,SAAS,UAAU,CAAA;AACzB,IAAA,IAAA,CAAK,QAAA,GAAW,QAAA;AAChB,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AAAA,EACd;AACF,CAAA;;;ACPO,IAAM,UAAA,GAAa;AAAA,EACxB,UAAA,EAAY,GAOd,CAAA;;;ACPO,IAAM,UAAA,GAAa;AAAA,EACxB,YAAA,EAAc,cAEhB,CAAA;AAEO,IAAM,eAAA,GAAkB;AAAA,EAC7B,IAAA,EAAM,kBAIR,CAAA;AAEO,IAAM,qBAAA,GAA0C,CAAC,EAAE,QAAA,OACxD,QAAA,CAAS,MAAA,IAAU,GAAA,IAAO,QAAA,CAAS,MAAA,IAAU,GAAA;AAE/C,SAAS,gBAAgB,GAAA,EAA6B;AACpD,EAAA,MAAM,OAAA,GAAU,EAAE,GAAG,GAAA,EAAI;AACzB,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,OAAO,CAAA,EAAG;AAClD,IAAA,IAAI,KAAA,IAAS,IAAA,EAAM,OAAO,OAAA,CAAQ,GAAG,CAAA;AAAA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,OAAO,CAAA;AAAA,IAChC,MAAA,EAAQ,kBAAkB,QAAQ;AAAA,GACpC;AACF,CAAA;;;AC/CO,IAAM,wBAAA,GAA2B,CAAC,cAAA,KACvC,iBAAA,CAAkB,cAAc,CAAA;;;AC3B3B,IAAM,kBAAA,GAAqB,CAAC,MAAA,KAA+B;AAChE,EAAA,MAAM,iBAAA,GAAoB,OAAO,IAAA,EAA6B,MAAA,KAAyB;AACrF,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,MAAA,CAAO,IAAA;AAAA,MAC5B,yBAAA;AAAA,MACA,EAAE,IAAA,EAAK;AAAA,MACP,EAAE,MAAA;AAAO,KACX;AAEA,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAEA,EAAA,OAAO;AAAA,IACL;AAAA,GACF;AACF,CAAA;;;ACXO,IAAM,qBAAA,GAAwB,CAAC,EAAE,OAAA,EAAS,aAAY,KAAyB;AACpF,EAAA,MAAM,SAAS,wBAAA,CAAyB;AAAA,IACtC,OAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,OAAO;AAAA,IACL,YAAA,EAAc,mBAAmB,MAAM;AAAA,GACzC;AACF","file":"index.js","sourcesContent":["import type { ApiResponse } from '../fetchClient/createFetchClient/types';\n\nexport class ApiError extends Error {\n response: Response;\n request: Request;\n data: unknown;\n\n constructor({ response, request, data }: ApiResponse) {\n super(response.statusText);\n this.response = response;\n this.request = request;\n this.data = data;\n }\n}\n","export const KeboolaHttpHeader = {\n STORAGE_API_TOKEN: 'X-StorageApi-Token',\n MANAGEMENT_API_TOKEN: 'X-Kbc-Manageapitoken',\n STORAGE_API_URL: 'x-storageapi-url',\n};\n\nexport const HttpStatus = {\n NO_CONTENT: 204,\n BAD_REQUEST: 400,\n UNPROCESSABLE_ENTITY: 422,\n INTERNAL_SERVER_ERROR: 500,\n BAD_GATEWAY: 502,\n SERVICE_UNAVAILABLE: 503,\n GATEWAY_TIMEOUT: 504,\n} as const;\n\nexport const ENCRYPTED_VALUE_PREFIX = 'KBC::';\n","import type { IStringifyOptions } from 'qs';\nimport qs from 'qs';\n\nimport { HttpStatus } from '../../constants';\n\nimport type { BodyParam, CreateFetchRequestFn, PathParam, ValidateStatusFn } from './types';\n\nexport const HttpHeader = {\n CONTENT_TYPE: 'content-type',\n CONTENT_DISPOSITION: 'content-disposition',\n};\n\nexport const HttpContentType = {\n JSON: 'application/json',\n TEXT_PLAIN: 'text/plain',\n FORM_DATA: 'multipart/form-data',\n TEXT_HTML: 'text/html',\n};\n\nexport const defaultValidateStatus: ValidateStatusFn = ({ response }) =>\n response.status >= 200 && response.status <= 299;\n\nfunction removeUndefined(obj: Record<string, string>) {\n const objCopy = { ...obj };\n for (const [key, value] of Object.entries(objCopy)) {\n if (value == null) delete objCopy[key];\n }\n return objCopy;\n}\n\nexport const parseData = async (response: Response) => {\n if (response.status === HttpStatus.NO_CONTENT) return null;\n\n // headers indicates that the content is JSON, so parse it.\n const contentType = response.headers.get(HttpHeader.CONTENT_TYPE);\n if (contentType && contentType == HttpContentType.JSON) {\n return response.json();\n }\n\n // try JSON parsing on the text\n // If it fails, return the string. The headers does not have a content type.\n const text = await response.text();\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n};\n\n// Header instance serialize undefined value as `undefined`, we do not want that\nconst cleanHeadersInit = (headersInit: HeadersInit | undefined) => {\n if (Array.isArray(headersInit)) return headersInit;\n if (headersInit instanceof Headers) return headersInit;\n if (headersInit == null) return headersInit;\n\n return removeUndefined(headersInit);\n};\n\nconst createHeaders = (\n headersInitA: HeadersInit | undefined,\n headersInitB: HeadersInit | undefined,\n) => {\n const headersA = new Headers(cleanHeadersInit(headersInitA));\n const headersB = new Headers(cleanHeadersInit(headersInitB));\n\n headersB.forEach((value, key) => {\n headersA.set(key, value);\n });\n\n return headersA;\n};\n\nexport const createPath = (path: string, pathParam: PathParam = {}) =>\n path.replace(/\\{([^}]+)}/g, (_, key) => {\n if (!(key in pathParam))\n throw new Error(`Path parameter \"${key}\" is missing in the path \"${path}\"`);\n\n return encodeURIComponent(pathParam[key]!);\n });\n\nexport const createSearch = (\n query: Record<string, unknown>,\n options: Pick<IStringifyOptions, 'arrayFormat'> = {},\n) => {\n return qs.stringify(query, {\n encodeValuesOnly: true,\n skipNulls: true,\n ...options,\n });\n};\n\nexport const createBody = (body: BodyParam, headers: Headers) => {\n if (body == null) return null;\n if (body instanceof FormData) return body; // fetch automatically sets content-type header\n if (typeof body === 'string') return body; // fetch automatically sets content-type header\n\n const stringifyBody = JSON.stringify(body);\n const stringBody = stringifyBody === '{}' ? null : stringifyBody;\n if (stringBody) headers.set(HttpHeader.CONTENT_TYPE, HttpContentType.JSON);\n\n return stringBody;\n};\n\nexport const parseContentDispositionHeader = (contentDisposition?: string | null) => {\n // extract the type ('inline' or 'attachment'), default the type to 'unknown'\n const type = (() => {\n const typeMatch = contentDisposition?.match(/^\\s*(inline|attachment)\\s*;/i);\n return (typeMatch?.[1]?.toLowerCase() ?? 'unknown') as 'inline' | 'attachment' | 'unknown';\n })();\n\n // extract the filename, default the type to null\n const filename = (() => {\n const filenameMatch = contentDisposition?.match(/filename=\"([^\"]+)\"/i);\n if (filenameMatch) return filenameMatch[1];\n\n // If no filename=\"...\", check for encoded filename*=UTF-8''\n const encodedFilenameMatch = contentDisposition?.match(/filename\\*=(?:UTF-8'')?([^;]+)/i);\n if (encodedFilenameMatch?.[1]) return decodeURIComponent(encodedFilenameMatch[1]);\n\n // Check for unquoted filenames (rare but possible)\n const unquotedFilenameMatch = contentDisposition?.match(/filename=([^;]+)/i);\n return unquotedFilenameMatch?.[1] ?? null;\n })();\n\n // Return the parsed result\n return { type, filename };\n};\n\nexport const createFetchRequest: CreateFetchRequestFn = ({\n url,\n method,\n params,\n options = {},\n defaultOptions,\n}) => {\n const {\n baseUrl,\n validateStatus: defValidateStatus = defaultValidateStatus,\n headers: defaultHeaders,\n ...restDefaultOptions\n } = defaultOptions;\n const { validateStatus, queryArrayFormat, headers: endpointHeaders, ...restOptions } = options;\n\n const headers = createHeaders(defaultHeaders, endpointHeaders);\n const path = createPath(url, params.path);\n const search = createSearch(params.query ?? {}, { arrayFormat: queryArrayFormat });\n const body = createBody(params.body, headers);\n\n const urlInstance = new URL(baseUrl + path);\n urlInstance.search = search;\n\n const request = new Request(urlInstance, {\n ...restDefaultOptions,\n ...restOptions,\n headers,\n method: method.toUpperCase(),\n body,\n });\n\n return { request, validateStatus: validateStatus ?? defValidateStatus };\n};\n","import { ApiError } from '../../errors';\n\nimport type {\n BaseFetchParams,\n CoreFetchFn,\n CreateFetchClientOptions,\n FetchClientOptions,\n FetchFn,\n HttpMethod,\n} from './types';\nimport { createFetchRequest, parseData } from './utils';\n\nexport type FetchClientError = TypeError | ApiError | SyntaxError | DOMException;\n\nexport const isApiError = (error: unknown): error is ApiError => error instanceof ApiError;\n\nexport const isAbortError = (error: unknown): error is DOMException =>\n error instanceof DOMException && error.name === 'AbortError';\n\nexport const isFetchClientError = (error: unknown): error is FetchClientError =>\n error instanceof TypeError || error instanceof SyntaxError || isApiError(error);\n\nconst createCoreFetch =\n (fetchFn: FetchFn): CoreFetchFn =>\n async ({ request, validateStatus }) => {\n const response = await fetchFn(request);\n const data = await parseData(response);\n\n const apiResponse = {\n request,\n response,\n data,\n };\n\n const boolOrError = validateStatus(apiResponse);\n if (isApiError(boolOrError)) throw boolOrError;\n if (!boolOrError) throw new ApiError(apiResponse);\n\n return apiResponse;\n };\n\nexport const createFetchClient = ({\n middlewares = [],\n ...defaultOptions\n}: CreateFetchClientOptions) => {\n const coreFetch = createCoreFetch(defaultOptions.fetchFn ?? fetch);\n const fetchWithMiddlewares = middlewares.reduceRight(\n (next, middleware) => middleware(next),\n coreFetch,\n );\n\n const createFetchMethod =\n (method: HttpMethod) =>\n async (url: string, params: BaseFetchParams, options: FetchClientOptions = {}) => {\n const request = createFetchRequest({\n url,\n method,\n params,\n defaultOptions,\n options,\n });\n\n const methodMiddlewares = options?.middlewares ?? [];\n\n return methodMiddlewares.reduceRight(\n (next, middleware) => middleware(next),\n fetchWithMiddlewares,\n )(request);\n };\n\n return {\n get: createFetchMethod('get'),\n post: createFetchMethod('post'),\n put: createFetchMethod('put'),\n patch: createFetchMethod('patch'),\n delete: createFetchMethod('delete'),\n };\n};\n","import type {\n ApiResponse,\n BodyParam,\n CreateFetchClientOptions,\n FetchClientOptions,\n PathParam,\n QueryParam,\n} from './createFetchClient';\nimport { createFetchClient } from './createFetchClient';\n\ntype FetchParams<Path = PathParam, Query = QueryParam, Body = BodyParam> = {\n path?: Path;\n query?: Query;\n body?: Body;\n};\n\ntype FetchMethod = <Data, Path = PathParam, Query = QueryParam, Body = BodyParam>(\n url: string,\n params: FetchParams<Path, Query, Body>,\n options?: FetchClientOptions,\n) => Promise<ApiResponse<Data>>;\n\ntype FetchClient = {\n get: FetchMethod;\n post: FetchMethod;\n put: FetchMethod;\n patch: FetchMethod;\n delete: FetchMethod;\n};\n\nexport const createGenericFetchClient = (defaultOptions: CreateFetchClientOptions) =>\n createFetchClient(defaultOptions) as FetchClient;\n","import type { GenericFetchClient } from '../telemetryClient';\n\nimport type { CreateCredentialsBody, WorkspaceData } from './types';\n\nexport const createProvisioning = (client: GenericFetchClient) => {\n const createCredentials = async (body: CreateCredentialsBody, signal?: AbortSignal) => {\n const { data } = await client.post<WorkspaceData, void, void, CreateCredentialsBody>(\n '/provisioning/workspace',\n { body },\n { signal },\n );\n\n return data;\n };\n\n return {\n createCredentials,\n };\n};\n","import { createGenericFetchClient } from '../../fetchClient';\nimport type { ClientInitOptions } from '../types';\n\nimport { createProvisioning } from './provisioning/provisioning';\n\nexport type GenericFetchClient = ReturnType<typeof createGenericFetchClient>;\n\nexport const createTelemetryClient = ({ baseUrl, middlewares }: ClientInitOptions) => {\n const client = createGenericFetchClient({\n baseUrl,\n middlewares,\n });\n\n return {\n provisioning: createProvisioning(client),\n };\n};\n"]}
@@ -116,31 +116,6 @@ type paths = {
116
116
  patch?: never;
117
117
  trace?: never;
118
118
  };
119
- '/sql/sessions/{id}/workspace-password': {
120
- parameters: {
121
- query?: never;
122
- header?: never;
123
- path?: never;
124
- cookie?: never;
125
- };
126
- /**
127
- * Get workspace password for a SQL Editor session (deprecated)
128
- * @description Retrieves the workspace username and password for a SQL Editor session from the sandboxes API.
129
- * This endpoint is only available for Snowflake workspaces. For non-Snowflake workspaces,
130
- * a 400 Bad Request error will be returned.
131
- *
132
- * **Important:** This operation is provided only for backward compatibility with legacy password-based workspaces
133
- * until the support for password authentication is completely removed.
134
- */
135
- get: operations['getSqlEditorSessionWorkspacePassword'];
136
- put?: never;
137
- post?: never;
138
- delete?: never;
139
- options?: never;
140
- head?: never;
141
- patch?: never;
142
- trace?: never;
143
- };
144
119
  '/sql/sessions/{id}/load': {
145
120
  parameters: {
146
121
  query?: never;
@@ -200,7 +175,7 @@ type paths = {
200
175
  * and updates the public key in the workspace. Returns both the private and public keys.
201
176
  * The private key is generated in-memory only and is never stored.
202
177
  *
203
- * **Important:** This operation is only supported for Snowflake backend sessions in 'ready' or 'loading' status.
178
+ * **Important:** This operation is only supported for Snowflake backend sessions in 'ready', 'loading' or 'unloading' status.
204
179
  *
205
180
  * **Security Note:** The private key returned in the response must be securely stored by the client.
206
181
  * It will not be available again after this request completes.
@@ -226,7 +201,7 @@ type paths = {
226
201
  * @description Resets the password for a workspace session. For Snowflake workspaces, generates a new password
227
202
  * via the Storage API and returns the username and password.
228
203
  *
229
- * **Important:** This operation is only supported for Snowflake backend sessions in 'ready' or 'loading' status.
204
+ * **Important:** This operation is only supported for Snowflake backend sessions in 'ready', 'loading' or 'unloading' status.
230
205
  * **Important:** This operation is provided only for backward compatibility with legacy password-based workspaces
231
206
  * until the support for password authentication is completely removed.
232
207
  */
@@ -386,7 +361,6 @@ type components = {
386
361
  * @description Specifies the loading mode for the session:
387
362
  * * `clean` - Creates a clean session (default)
388
363
  * * `input` - Loads with input data (not yet implemented)
389
- * @default clean
390
364
  * @enum {string}
391
365
  */
392
366
  loadMode: 'input' | 'clean';
@@ -422,8 +396,9 @@ type components = {
422
396
  /**
423
397
  * @description Current status of the session
424
398
  * @example initializing
399
+ * @enum {string}
425
400
  */
426
- status: string;
401
+ status: 'initializing' | 'ready' | 'loading' | 'unloading' | 'failed' | 'deleted';
427
402
  /** @description ID of the user who created the session */
428
403
  userId: string;
429
404
  /** @description The ID of the branch this session belongs to */
@@ -434,8 +409,12 @@ type components = {
434
409
  configurationId: string;
435
410
  /** @description Schema name in the workspace */
436
411
  workspaceSchema: string;
437
- /** @description Database name in the workspace */
438
- workspaceDatabase: string;
412
+ /**
413
+ * @description Database name in the workspace. Null on BigQuery — BQ workspaces
414
+ * have no database tier (the GCP project id lives in workspace
415
+ * credentials, not as a database name).
416
+ */
417
+ workspaceDatabase?: string | null;
439
418
  /** @description ID of the associated workspace */
440
419
  workspaceId: string;
441
420
  /** @description ID of the job that is creating the workspace */
@@ -565,38 +544,6 @@ type components = {
565
544
  */
566
545
  warehouse: string;
567
546
  };
568
- WorkspacePasswordResponse: {
569
- /**
570
- * @description Username for the Snowflake workspace from sandboxes API
571
- * @example KEBOOLA_WORKSPACE_123456
572
- */
573
- username: string;
574
- /**
575
- * @description Password for the Snowflake workspace from sandboxes API
576
- * @example a1b2c3d4e5f6g7h8i9j0
577
- */
578
- password: string;
579
- /**
580
- * @description Snowflake host/account identifier
581
- * @example keboola.snowflakecomputing.com
582
- */
583
- host: string;
584
- /**
585
- * @description Database name in Snowflake
586
- * @example KEBOOLA_1234
587
- */
588
- database: string;
589
- /**
590
- * @description Schema name in the workspace
591
- * @example WORKSPACE_123456
592
- */
593
- schema: string;
594
- /**
595
- * @description Snowflake warehouse name
596
- * @example KEBOOLA_PROD
597
- */
598
- warehouse: string;
599
- };
600
547
  ReloadSessionRequest: {
601
548
  /**
602
549
  * @description The mode to reload the session in. 'input' reloads input tables, 'clean' cleans the workspace.
@@ -634,7 +581,9 @@ type components = {
634
581
  */
635
582
  tableName: string;
636
583
  /**
637
- * @description Name of the database containing the table (optional)
584
+ * @description Name of the database containing the table (optional). Ignored on
585
+ * BigQuery workspaces — a BQ session is bound to a single GCP project,
586
+ * so `dataset.table` is the only valid form.
638
587
  * @example KEBOOLA_123
639
588
  */
640
589
  databaseName?: string | null;
@@ -685,8 +634,14 @@ type components = {
685
634
  databases: components['schemas']['Catalog'][];
686
635
  };
687
636
  Catalog: {
688
- /** @description Database database name */
689
- name: string;
637
+ /**
638
+ * @description Database identifier. On Snowflake this is the actual database name
639
+ * (own buckets land under the workspace's database; linked buckets
640
+ * surface under the source project's database). Null on BigQuery —
641
+ * BQ workspaces are bound to a single GCP project so there is no
642
+ * cross-project database tier to surface.
643
+ */
644
+ name: string | null;
690
645
  /** @description User-friendly name for the database (typically project name) */
691
646
  displayName?: string | null;
692
647
  /** @description List of schemas in the database */
@@ -695,6 +650,12 @@ type components = {
695
650
  Schema: {
696
651
  /** @description Schema name */
697
652
  name: string;
653
+ /**
654
+ * @description True when this schema/bucket comes from the current development branch's storage rather than production.
655
+ * When projects have `protected-default-branch` or `storage-branches` features, the same logical bucket can
656
+ * appear twice.
657
+ */
658
+ isBranched: boolean;
698
659
  /** @description User-friendly name for the schema (typically bucket display name) */
699
660
  displayName?: string | null;
700
661
  /** @description List of tables in the schema */
@@ -804,6 +765,8 @@ type operations = {
804
765
  query?: {
805
766
  /** @description If set to "1", returns all sessions in the project. If omitted or set to "0", returns only sessions for the current user. */
806
767
  listAll?: '0' | '1';
768
+ /** @description If provided, only sessions belonging to the given branch are returned. If omitted, sessions across all branches are returned. */
769
+ branchId?: string;
807
770
  };
808
771
  header?: never;
809
772
  path?: never;
@@ -978,56 +941,6 @@ type operations = {
978
941
  };
979
942
  };
980
943
  };
981
- getSqlEditorSessionWorkspacePassword: {
982
- parameters: {
983
- query?: never;
984
- header?: never;
985
- path: {
986
- /** @description SQL Editor session ID (UUID) */
987
- id: string;
988
- };
989
- cookie?: never;
990
- };
991
- requestBody?: never;
992
- responses: {
993
- /** @description Workspace password retrieved successfully */
994
- 200: {
995
- headers: {
996
- [name: string]: unknown;
997
- };
998
- content: {
999
- 'application/json': components['schemas']['WorkspacePasswordResponse'];
1000
- };
1001
- };
1002
- /** @description Bad request (non-Snowflake workspace) */
1003
- 400: {
1004
- headers: {
1005
- [name: string]: unknown;
1006
- };
1007
- content: {
1008
- 'application/json': components['schemas']['Error'];
1009
- };
1010
- };
1011
- /** @description Session not found */
1012
- 404: {
1013
- headers: {
1014
- [name: string]: unknown;
1015
- };
1016
- content: {
1017
- 'application/json': components['schemas']['Error'];
1018
- };
1019
- };
1020
- /** @description Error response */
1021
- default: {
1022
- headers: {
1023
- [name: string]: unknown;
1024
- };
1025
- content: {
1026
- 'application/json': components['schemas']['Error'];
1027
- };
1028
- };
1029
- };
1030
- };
1031
944
  loadSqlEditorSession: {
1032
945
  parameters: {
1033
946
  query?: never;
@@ -1453,10 +1366,12 @@ type operations = {
1453
1366
  */
1454
1367
  schemaName: string;
1455
1368
  /**
1456
- * @description Name of the database containing the table
1369
+ * @description Name of the database containing the table. Ignored on BigQuery workspaces
1370
+ * (a BigQuery session is bound to a single GCP project, so `dataset.table`
1371
+ * is the only valid form).
1457
1372
  * @example KEBOOLA_123
1458
1373
  */
1459
- databaseName: string;
1374
+ databaseName?: string | null;
1460
1375
  };
1461
1376
  header?: never;
1462
1377
  path: {
@@ -2600,6 +2600,13 @@ type components = {
2600
2600
  defaultFileStorageId?: number | null;
2601
2601
  /** @description Zendesk URL for this maintainer. */
2602
2602
  zendeskUrl?: string | null;
2603
+ /** @description Simplified list of organizations belonging to this maintainer. */
2604
+ organizations: {
2605
+ /** @description Organization identifier. */
2606
+ id: number;
2607
+ /** @description Organization name. */
2608
+ name: string;
2609
+ }[];
2603
2610
  };
2604
2611
  MaintainerInvitationDetailResponse: {
2605
2612
  /** @description Invitation identifier. */
@@ -2640,6 +2647,8 @@ type components = {
2640
2647
  activityCenterProjectId?: number | null;
2641
2648
  /** @description Whether MFA is required. */
2642
2649
  mfaRequired: boolean;
2650
+ /** @description Number of projects in this organization. */
2651
+ projectsCount: number;
2643
2652
  };
2644
2653
  MaintainerDetailResponse: components['schemas']['MaintainerResponse'] & {
2645
2654
  /** @description List of organizations belonging to this maintainer. */
@@ -8399,6 +8408,10 @@ type MaintainerUser = {
8399
8408
  id: number;
8400
8409
  name: string;
8401
8410
  email: string;
8411
+ mfaEnabled: boolean;
8412
+ features: string[];
8413
+ canAccessLogs: boolean;
8414
+ isSuperAdmin: boolean;
8402
8415
  };
8403
8416
  type MetadataItem = {
8404
8417
  id: number;
@@ -8445,6 +8458,7 @@ type OrganizationProject = {
8445
8458
  rowsCount: number;
8446
8459
  defaultBackend: string;
8447
8460
  isDisabled: boolean;
8461
+ usersCount: number;
8448
8462
  };
8449
8463
  type AdminUser = components['schemas']['UserResponse'];
8450
8464
 
@@ -8588,4 +8602,4 @@ type User = {
8588
8602
  canApproveMergeRequests: boolean;
8589
8603
  };
8590
8604
 
8591
- export type { AddMaintainerUserBody as A, Maintainer as B, CreateMaintainerBody as C, MaintainerDetail as D, MaintainerInvitationDetail as E, Feature as F, GetAllFeaturesQuery as G, OrganizationDetail as H, OrganizationInvitationDetail as I, OrganizationListItem as J, OrganizationMaintainer as K, ListProjectUsersPath as L, MaintainerUser as M, OrganizationProject as N, Organization as O, Project as P, ProjectMetadataInput as Q, RemoveProjectFeaturePath as R, SetMaintainerMetadataBody as S, UpdateMaintainerBody as U, CreateMaintainerInvitationBody as a, CreateMaintainerOrganizationBody as b, components as c, MetadataItem as d, UpdateOrganizationBody as e, AddOrganizationUserBody as f, CreateOrganizationInvitationBody as g, CreateOrganizationProjectBody as h, SetOrganizationMetadataBody as i, GetProjectPath as j, CreateProjectFeaturePath as k, CreateProjectFeatureBody as l, User as m, GetProjectMetadataPath as n, ProjectMetadataItem as o, SetProjectMetadataPath as p, SetProjectMetadataBody as q, GetProjectReviewersPath as r, Reviewer as s, SetProjectReviewersPath as t, SetProjectReviewersBody as u, AddUserFeatureBody as v, AddUserFeaturePath as w, RemoveUserFeaturePath as x, AdminUser as y, FeatureType as z };
8605
+ export type { AddMaintainerUserBody as A, Maintainer as B, CreateMaintainerBody as C, MaintainerDetail as D, MaintainerInvitationDetail as E, Feature as F, GetAllFeaturesQuery as G, Organization as H, OrganizationInvitationDetail as I, OrganizationListItem as J, OrganizationMaintainer as K, ListProjectUsersPath as L, MaintainerUser as M, OrganizationProject as N, OrganizationDetail as O, Project as P, ProjectMetadataInput as Q, RemoveProjectFeaturePath as R, SetMaintainerMetadataBody as S, UpdateMaintainerBody as U, CreateMaintainerInvitationBody as a, CreateMaintainerOrganizationBody as b, components as c, MetadataItem as d, UpdateOrganizationBody as e, AddOrganizationUserBody as f, CreateOrganizationInvitationBody as g, CreateOrganizationProjectBody as h, SetOrganizationMetadataBody as i, GetProjectPath as j, CreateProjectFeaturePath as k, CreateProjectFeatureBody as l, User as m, GetProjectMetadataPath as n, ProjectMetadataItem as o, SetProjectMetadataPath as p, SetProjectMetadataBody as q, GetProjectReviewersPath as r, Reviewer as s, SetProjectReviewersPath as t, SetProjectReviewersBody as u, AddUserFeatureBody as v, AddUserFeaturePath as w, RemoveUserFeaturePath as x, AdminUser as y, FeatureType as z };