@notionhq/client 5.8.0 → 5.9.0

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/client",
3
- "version": "5.8.0",
3
+ "version": "5.9.0",
4
4
  "description": "A simple and easy to use client for the Notion API",
5
5
  "engines": {
6
6
  "node": ">=18"
@@ -1 +1 @@
1
- {"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../../src/Client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EACL,KAAK,MAAM,EACX,QAAQ,EAGT,MAAM,WAAW,CAAA;AAQlB,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EAErB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAExB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EAExB,KAAK,6BAA6B,EAClC,KAAK,2BAA2B,EAEhC,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,EAE9B,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAE5B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAE7B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAE7B,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAE1B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EAEvB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EAEpB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EAEvB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EAErB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EAEpB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EAEtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EAEnB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EAEpB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAE5B,KAAK,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AO,CAAC,GAAG;IAUX;;;;;;;;OAQG;IACH,OAAO,CAAC,aAAa;CAQtB;AAKD,KAAK,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;AACjD,KAAK,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,eAAe,CAAA;AAE/E,KAAK,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA"}
@@ -480,6 +480,7 @@ class Client {
480
480
  */
481
481
  async request(args) {
482
482
  const { path, method, query, body, formDataParams, auth } = args;
483
+ (0, errors_1.validateRequestPath)(path);
483
484
  this.log(logging_1.LogLevel.INFO, "request start", { method, path });
484
485
  // If the body is empty, don't send the body in the HTTP request
485
486
  const bodyAsJsonString = !body || Object.entries(body).length === 0
@@ -1 +1 @@
1
- {"version":3,"file":"Client.js","sourceRoot":"","sources":["../../src/Client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,uCAKkB;AAClB,qCAKiB;AACjB,mCAA8B;AAC9B,mDAoGwB;AACxB,kDAGwB;AAwCxB,MAAqB,MAAM;IAazB,YAAmB,OAAuB;;QAZ1C,+BAAc;QACd,mCAAmB;QACnB,iCAAe;QACf,oCAAkB;QAClB,oCAAkB;QAClB,wCAAsB;QACtB,gCAAsB;QACtB,gCAAyB;QACzB,oCAAkB;QAkJlB;;WAEG;QAEa,WAAM,GAAG;YACvB;;eAEG;YACH,QAAQ,EAAE,CACR,IAAkC,EACP,EAAE;gBAC7B,OAAO,IAAI,CAAC,OAAO,CAAmB;oBACpC,IAAI,EAAE,wBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;oBACzB,MAAM,EAAE,wBAAQ,CAAC,MAAM;oBACvB,KAAK,EAAE,IAAA,YAAI,EAAC,IAAI,EAAE,wBAAQ,CAAC,WAAW,CAAC;oBACvC,IAAI,EAAE,IAA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AM,eAAe,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,uBAAA,IAAI,oBAAM,CAAA;QAC1C,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;YAClC,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,eAAe,EAAE,CAAA;QACxD,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;;;AAnsBe,2BAAoB,GAAG,YAAY,AAAf,CAAe;kBAXhC,MAAM","sourcesContent":["import type { Agent } from \"node:http\"\nimport {\n type Logger,\n LogLevel,\n logLevelSeverity,\n makeConsoleLogger,\n} from \"./logging\"\nimport {\n buildRequestError,\n isHTTPResponseError,\n isNotionClientError,\n RequestTimeoutError,\n} from \"./errors\"\nimport { pick } from \"./utils\"\nimport {\n type GetBlockParameters,\n type GetBlockResponse,\n getBlock,\n type UpdateBlockParameters,\n type UpdateBlockResponse,\n updateBlock,\n type DeleteBlockParameters,\n type DeleteBlockResponse,\n deleteBlock,\n type AppendBlockChildrenParameters,\n type AppendBlockChildrenResponse,\n appendBlockChildren,\n type ListBlockChildrenParameters,\n type ListBlockChildrenResponse,\n listBlockChildren,\n type QueryDataSourceParameters,\n type QueryDataSourceResponse,\n queryDataSource,\n type CreateDataSourceParameters,\n type CreateDataSourceResponse,\n createDataSource,\n type UpdateDataSourceParameters,\n type UpdateDataSourceResponse,\n updateDataSource,\n type GetDataSourceParameters,\n type GetDataSourceResponse,\n getDataSource,\n type CreatePageParameters,\n type CreatePageResponse,\n createPage,\n type GetPageParameters,\n type GetPageResponse,\n getPage,\n type UpdatePageParameters,\n type UpdatePageResponse,\n updatePage,\n type MovePageParameters,\n type MovePageResponse,\n movePage,\n type GetUserParameters,\n type GetUserResponse,\n getUser,\n type ListUsersParameters,\n type ListUsersResponse,\n listUsers,\n type SearchParameters,\n type SearchResponse,\n search,\n type GetSelfParameters,\n type GetSelfResponse,\n getSelf,\n type GetPagePropertyParameters,\n type GetPagePropertyResponse,\n getPageProperty,\n type CreateCommentParameters,\n type CreateCommentResponse,\n createComment,\n type ListCommentsParameters,\n type ListCommentsResponse,\n listComments,\n type GetCommentParameters,\n type GetCommentResponse,\n getComment,\n type OauthTokenResponse,\n type OauthTokenParameters,\n oauthToken,\n type OauthIntrospectResponse,\n type OauthIntrospectParameters,\n oauthIntrospect,\n type OauthRevokeResponse,\n type OauthRevokeParameters,\n oauthRevoke,\n type CreateFileUploadParameters,\n type CreateFileUploadResponse,\n createFileUpload,\n type GetFileUploadResponse,\n type GetFileUploadParameters,\n getFileUpload,\n type SendFileUploadParameters,\n type SendFileUploadResponse,\n sendFileUpload,\n type CompleteFileUploadParameters,\n type CompleteFileUploadResponse,\n completeFileUpload,\n type ListFileUploadsParameters,\n type ListFileUploadsResponse,\n listFileUploads,\n GetDatabaseParameters,\n GetDatabaseResponse,\n getDatabase,\n CreateDatabaseResponse,\n CreateDatabaseParameters,\n createDatabase,\n UpdateDatabaseParameters,\n UpdateDatabaseResponse,\n updateDatabase,\n listDataSourceTemplates,\n ListDataSourceTemplatesResponse,\n ListDataSourceTemplatesParameters,\n} from \"./api-endpoints\"\nimport {\n version as PACKAGE_VERSION,\n name as PACKAGE_NAME,\n} from \"../package.json\"\nimport type { SupportedFetch } from \"./fetch-types\"\n\nexport interface ClientOptions {\n auth?: string\n timeoutMs?: number\n baseUrl?: string\n logLevel?: LogLevel\n logger?: Logger\n notionVersion?: string\n fetch?: SupportedFetch\n /** Silently ignored in the browser */\n agent?: Agent\n}\n\ntype FileParam = {\n filename?: string\n data: string | Blob\n}\n\nexport interface RequestParameters {\n path: string\n method: Method\n query?: QueryParams\n body?: Record<string, unknown>\n formDataParams?: Record<string, string | FileParam>\n headers?: Record<string, string>\n /**\n * To authenticate using public API token, `auth` should be passed as a\n * string. If you are trying to complete OAuth, then `auth` should be an object\n * containing your integration's client ID and secret.\n */\n auth?:\n | string\n | {\n client_id: string\n client_secret: string\n }\n}\n\nexport default class Client {\n #auth?: string\n #logLevel: LogLevel\n #logger: Logger\n #prefixUrl: string\n #timeoutMs: number\n #notionVersion: string\n #fetch: SupportedFetch\n #agent: Agent | undefined\n #userAgent: string\n\n static readonly defaultNotionVersion = \"2025-09-03\"\n\n public constructor(options?: ClientOptions) {\n this.#auth = options?.auth\n this.#logLevel = options?.logLevel ?? LogLevel.WARN\n this.#logger = options?.logger ?? makeConsoleLogger(PACKAGE_NAME)\n this.#prefixUrl = `${options?.baseUrl ?? \"https://api.notion.com\"}/v1/`\n this.#timeoutMs = options?.timeoutMs ?? 60_000\n this.#notionVersion = options?.notionVersion ?? Client.defaultNotionVersion\n this.#fetch = options?.fetch ?? fetch\n this.#agent = options?.agent\n this.#userAgent = `notionhq-client/${PACKAGE_VERSION}`\n }\n\n /**\n * Sends a request.\n */\n public async request<ResponseBody extends object>(\n args: RequestParameters\n ): Promise<ResponseBody> {\n const { path, method, query, body, formDataParams, auth } = args\n\n this.log(LogLevel.INFO, \"request start\", { method, path })\n\n // If the body is empty, don't send the body in the HTTP request\n const bodyAsJsonString =\n !body || Object.entries(body).length === 0\n ? undefined\n : JSON.stringify(body)\n\n const url = new URL(`${this.#prefixUrl}${path}`)\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) {\n if (Array.isArray(value)) {\n for (const val of value) {\n url.searchParams.append(key, decodeURIComponent(val))\n }\n } else {\n url.searchParams.append(key, String(value))\n }\n }\n }\n }\n\n // Allow both client ID / client secret based auth as well as token based auth.\n let authorizationHeader: Record<string, string>\n if (typeof auth === \"object\") {\n // Client ID and secret based auth is **ONLY** supported when using the\n // `/oauth/token` endpoint. If this is the case, handle formatting the\n // authorization header as required by `Basic` auth.\n const unencodedCredential = `${auth.client_id}:${auth.client_secret}`\n const encodedCredential =\n Buffer.from(unencodedCredential).toString(\"base64\")\n authorizationHeader = { authorization: `Basic ${encodedCredential}` }\n } else {\n // Otherwise format authorization header as `Bearer` token auth.\n authorizationHeader = this.authAsHeaders(auth)\n }\n\n const headers: Record<string, string> = {\n // Request-level custom additional headers can be provided, but\n // don't allow them to override all other headers, e.g. the\n // standard user agent.\n ...args.headers,\n ...authorizationHeader,\n \"Notion-Version\": this.#notionVersion,\n \"user-agent\": this.#userAgent,\n }\n\n if (bodyAsJsonString !== undefined) {\n headers[\"content-type\"] = \"application/json\"\n }\n\n let formData: FormData | undefined\n if (formDataParams) {\n delete headers[\"content-type\"]\n\n formData = new FormData()\n for (const [key, value] of Object.entries(formDataParams)) {\n if (typeof value === \"string\") {\n formData.append(key, value)\n } else if (typeof value === \"object\") {\n formData.append(\n key,\n typeof value.data === \"object\"\n ? value.data\n : new Blob([value.data]),\n value.filename\n )\n }\n }\n }\n\n try {\n const response = await RequestTimeoutError.rejectAfterTimeout(\n this.#fetch(url.toString(), {\n method: method.toUpperCase(),\n headers,\n body: bodyAsJsonString ?? formData,\n agent: this.#agent,\n }),\n this.#timeoutMs\n )\n\n const responseText = await response.text()\n if (!response.ok) {\n throw buildRequestError(response, responseText)\n }\n\n const responseJson: ResponseBody = JSON.parse(responseText)\n this.log(LogLevel.INFO, \"request success\", {\n method,\n path,\n ...(\"request_id\" in responseJson && responseJson.request_id\n ? { requestId: responseJson.request_id }\n : {}),\n })\n return responseJson\n } catch (error: unknown) {\n if (!isNotionClientError(error)) {\n throw error\n }\n\n // Log the error if it's one of our known error types\n this.log(LogLevel.WARN, \"request fail\", {\n code: error.code,\n message: error.message,\n ...(\"request_id\" in error && error.request_id\n ? { requestId: error.request_id }\n : {}),\n })\n\n if (isHTTPResponseError(error)) {\n // The response body may contain sensitive information so it is logged separately at the DEBUG level\n this.log(LogLevel.DEBUG, \"failed response body\", {\n body: error.body,\n })\n }\n\n throw error\n }\n }\n\n /*\n * Notion API endpoints\n */\n\n public readonly blocks = {\n /**\n * Retrieve block\n */\n retrieve: (\n args: WithAuth<GetBlockParameters>\n ): Promise<GetBlockResponse> => {\n return this.request<GetBlockResponse>({\n path: getBlock.path(args),\n method: getBlock.method,\n query: pick(args, getBlock.queryParams),\n body: pick(args, getBlock.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Update block\n */\n update: (\n args: WithAuth<UpdateBlockParameters>\n ): Promise<UpdateBlockResponse> => {\n return this.request<UpdateBlockResponse>({\n path: updateBlock.path(args),\n method: updateBlock.method,\n query: pick(args, updateBlock.queryParams),\n body: pick(args, updateBlock.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Delete block\n */\n delete: (\n args: WithAuth<DeleteBlockParameters>\n ): Promise<DeleteBlockResponse> => {\n return this.request<DeleteBlockResponse>({\n path: deleteBlock.path(args),\n method: deleteBlock.method,\n query: pick(args, deleteBlock.queryParams),\n body: pick(args, deleteBlock.bodyParams),\n auth: args?.auth,\n })\n },\n children: {\n /**\n * Append block children\n */\n append: (\n args: WithAuth<AppendBlockChildrenParameters>\n ): Promise<AppendBlockChildrenResponse> => {\n return this.request<AppendBlockChildrenResponse>({\n path: appendBlockChildren.path(args),\n method: appendBlockChildren.method,\n query: pick(args, appendBlockChildren.queryParams),\n body: pick(args, appendBlockChildren.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Retrieve block children\n */\n list: (\n args: WithAuth<ListBlockChildrenParameters>\n ): Promise<ListBlockChildrenResponse> => {\n return this.request<ListBlockChildrenResponse>({\n path: listBlockChildren.path(args),\n method: listBlockChildren.method,\n query: pick(args, listBlockChildren.queryParams),\n body: pick(args, listBlockChildren.bodyParams),\n auth: args?.auth,\n })\n },\n },\n }\n\n public readonly databases = {\n /**\n * Retrieve a database\n */\n retrieve: (\n args: WithAuth<GetDatabaseParameters>\n ): Promise<GetDatabaseResponse> => {\n return this.request<GetDatabaseResponse>({\n path: getDatabase.path(args),\n method: getDatabase.method,\n query: pick(args, getDatabase.queryParams),\n body: pick(args, getDatabase.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Create a database\n */\n create: (\n args: WithAuth<CreateDatabaseParameters>\n ): Promise<CreateDatabaseResponse> => {\n return this.request<CreateDatabaseResponse>({\n path: createDatabase.path(),\n method: createDatabase.method,\n query: pick(args, createDatabase.queryParams),\n body: pick(args, createDatabase.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Update a database\n */\n update: (\n args: WithAuth<UpdateDatabaseParameters>\n ): Promise<UpdateDatabaseResponse> => {\n return this.request<UpdateDatabaseResponse>({\n path: updateDatabase.path(args),\n method: updateDatabase.method,\n query: pick(args, updateDatabase.queryParams),\n body: pick(args, updateDatabase.bodyParams),\n auth: args?.auth,\n })\n },\n }\n\n public readonly dataSources = {\n /**\n * Retrieve a data source\n */\n retrieve: (\n args: WithAuth<GetDataSourceParameters>\n ): Promise<GetDataSourceResponse> => {\n return this.request<GetDataSourceResponse>({\n path: getDataSource.path(args),\n method: getDataSource.method,\n query: pick(args, getDataSource.queryParams),\n body: pick(args, getDataSource.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Query a data source\n */\n query: (\n args: WithAuth<QueryDataSourceParameters>\n ): Promise<QueryDataSourceResponse> => {\n return this.request<QueryDataSourceResponse>({\n path: queryDataSource.path(args),\n method: queryDataSource.method,\n query: pick(args, queryDataSource.queryParams),\n body: pick(args, queryDataSource.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Create a data source\n */\n create: (\n args: WithAuth<CreateDataSourceParameters>\n ): Promise<CreateDataSourceResponse> => {\n return this.request<CreateDataSourceResponse>({\n path: createDataSource.path(),\n method: createDataSource.method,\n query: pick(args, createDataSource.queryParams),\n body: pick(args, createDataSource.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Update a data source\n */\n update: (\n args: WithAuth<UpdateDataSourceParameters>\n ): Promise<UpdateDataSourceResponse> => {\n return this.request<UpdateDataSourceResponse>({\n path: updateDataSource.path(args),\n method: updateDataSource.method,\n query: pick(args, updateDataSource.queryParams),\n body: pick(args, updateDataSource.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * List page templates that are available for a data source\n */\n listTemplates: (\n args: WithAuth<ListDataSourceTemplatesParameters>\n ): Promise<ListDataSourceTemplatesResponse> => {\n return this.request<ListDataSourceTemplatesResponse>({\n path: listDataSourceTemplates.path(args),\n method: listDataSourceTemplates.method,\n query: pick(args, listDataSourceTemplates.queryParams),\n body: pick(args, listDataSourceTemplates.bodyParams),\n auth: args?.auth,\n })\n },\n }\n\n public readonly pages = {\n /**\n * Create a page\n */\n create: (\n args: WithAuth<CreatePageParameters>\n ): Promise<CreatePageResponse> => {\n return this.request<CreatePageResponse>({\n path: createPage.path(),\n method: createPage.method,\n query: pick(args, createPage.queryParams),\n body: pick(args, createPage.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Retrieve a page\n */\n retrieve: (args: WithAuth<GetPageParameters>): Promise<GetPageResponse> => {\n return this.request<GetPageResponse>({\n path: getPage.path(args),\n method: getPage.method,\n query: pick(args, getPage.queryParams),\n body: pick(args, getPage.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Update page properties\n */\n update: (\n args: WithAuth<UpdatePageParameters>\n ): Promise<UpdatePageResponse> => {\n return this.request<UpdatePageResponse>({\n path: updatePage.path(args),\n method: updatePage.method,\n query: pick(args, updatePage.queryParams),\n body: pick(args, updatePage.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Move a page\n */\n move: (args: WithAuth<MovePageParameters>): Promise<MovePageResponse> => {\n return this.request<MovePageResponse>({\n path: movePage.path(args),\n method: movePage.method,\n query: pick(args, movePage.queryParams),\n body: pick(args, movePage.bodyParams),\n auth: args?.auth,\n })\n },\n properties: {\n /**\n * Retrieve page property\n */\n retrieve: (\n args: WithAuth<GetPagePropertyParameters>\n ): Promise<GetPagePropertyResponse> => {\n return this.request<GetPagePropertyResponse>({\n path: getPageProperty.path(args),\n method: getPageProperty.method,\n query: pick(args, getPageProperty.queryParams),\n body: pick(args, getPageProperty.bodyParams),\n auth: args?.auth,\n })\n },\n },\n }\n\n public readonly users = {\n /**\n * Retrieve a user\n */\n retrieve: (args: WithAuth<GetUserParameters>): Promise<GetUserResponse> => {\n return this.request<GetUserResponse>({\n path: getUser.path(args),\n method: getUser.method,\n query: pick(args, getUser.queryParams),\n body: pick(args, getUser.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * List all users\n */\n list: (args: WithAuth<ListUsersParameters>): Promise<ListUsersResponse> => {\n return this.request<ListUsersResponse>({\n path: listUsers.path(),\n method: listUsers.method,\n query: pick(args, listUsers.queryParams),\n body: pick(args, listUsers.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Get details about bot\n */\n me: (args: WithAuth<GetSelfParameters>): Promise<GetSelfResponse> => {\n return this.request<GetSelfResponse>({\n path: getSelf.path(),\n method: getSelf.method,\n query: pick(args, getSelf.queryParams),\n body: pick(args, getSelf.bodyParams),\n auth: args?.auth,\n })\n },\n }\n\n public readonly comments = {\n /**\n * Create a comment\n */\n create: (\n args: WithAuth<CreateCommentParameters>\n ): Promise<CreateCommentResponse> => {\n return this.request<CreateCommentResponse>({\n path: createComment.path(),\n method: createComment.method,\n query: pick(args, createComment.queryParams),\n body: pick(args, createComment.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * List comments\n */\n list: (\n args: WithAuth<ListCommentsParameters>\n ): Promise<ListCommentsResponse> => {\n return this.request<ListCommentsResponse>({\n path: listComments.path(),\n method: listComments.method,\n query: pick(args, listComments.queryParams),\n body: pick(args, listComments.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Retrieve a comment\n */\n retrieve: (\n args: WithAuth<GetCommentParameters>\n ): Promise<GetCommentResponse> => {\n return this.request<GetCommentResponse>({\n path: getComment.path(args),\n method: getComment.method,\n query: pick(args, getComment.queryParams),\n body: pick(args, getComment.bodyParams),\n auth: args?.auth,\n })\n },\n }\n\n public readonly fileUploads = {\n /**\n * Create a file upload\n */\n create: (\n args: WithAuth<CreateFileUploadParameters>\n ): Promise<CreateFileUploadResponse> => {\n return this.request<CreateFileUploadResponse>({\n path: createFileUpload.path(),\n method: createFileUpload.method,\n query: pick(args, createFileUpload.queryParams),\n body: pick(args, createFileUpload.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Retrieve a file upload\n */\n retrieve: (\n args: WithAuth<GetFileUploadParameters>\n ): Promise<GetFileUploadResponse> => {\n return this.request<GetFileUploadResponse>({\n path: getFileUpload.path(args),\n method: getFileUpload.method,\n query: pick(args, getFileUpload.queryParams),\n auth: args?.auth,\n })\n },\n\n /**\n * List file uploads\n */\n list: (\n args: WithAuth<ListFileUploadsParameters>\n ): Promise<ListFileUploadsResponse> => {\n return this.request<ListFileUploadsResponse>({\n path: listFileUploads.path(),\n method: listFileUploads.method,\n query: pick(args, listFileUploads.queryParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Send a file upload\n *\n * Requires a `file_upload_id`, obtained from the `id` of the Create File\n * Upload API response.\n *\n * The `file` parameter contains the raw file contents or Blob/File object\n * under `file.data`, and an optional `file.filename` string.\n *\n * Supply a stringified `part_number` parameter when using file uploads\n * in multi-part mode.\n *\n * This endpoint sends HTTP multipart/form-data instead of JSON parameters.\n */\n send: (\n args: WithAuth<SendFileUploadParameters>\n ): Promise<SendFileUploadResponse> => {\n return this.request<SendFileUploadResponse>({\n path: sendFileUpload.path(args),\n method: sendFileUpload.method,\n query: pick(args, sendFileUpload.queryParams),\n formDataParams: pick(args, sendFileUpload.formDataParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Complete a file upload\n */\n complete: (\n args: WithAuth<CompleteFileUploadParameters>\n ): Promise<CompleteFileUploadResponse> => {\n return this.request<CompleteFileUploadResponse>({\n path: completeFileUpload.path(args),\n method: completeFileUpload.method,\n query: pick(args, completeFileUpload.queryParams),\n auth: args?.auth,\n })\n },\n }\n\n /**\n * Search\n */\n public search = (\n args: WithAuth<SearchParameters>\n ): Promise<SearchResponse> => {\n return this.request<SearchResponse>({\n path: search.path(),\n method: search.method,\n query: pick(args, search.queryParams),\n body: pick(args, search.bodyParams),\n auth: args?.auth,\n })\n }\n\n public readonly oauth = {\n /**\n * Get token\n */\n token: (\n args: OauthTokenParameters & {\n client_id: string\n client_secret: string\n }\n ): Promise<OauthTokenResponse> => {\n return this.request<OauthTokenResponse>({\n path: oauthToken.path(),\n method: oauthToken.method,\n query: pick(args, oauthToken.queryParams),\n body: pick(args, oauthToken.bodyParams),\n auth: {\n client_id: args.client_id,\n client_secret: args.client_secret,\n },\n })\n },\n /**\n * Introspect token\n */\n introspect: (\n args: OauthIntrospectParameters & {\n client_id: string\n client_secret: string\n }\n ): Promise<OauthIntrospectResponse> => {\n return this.request<OauthIntrospectResponse>({\n path: oauthIntrospect.path(),\n method: oauthIntrospect.method,\n query: pick(args, oauthIntrospect.queryParams),\n body: pick(args, oauthIntrospect.bodyParams),\n auth: {\n client_id: args.client_id,\n client_secret: args.client_secret,\n },\n })\n },\n /**\n * Revoke token\n */\n revoke: (\n args: OauthRevokeParameters & {\n client_id: string\n client_secret: string\n }\n ): Promise<OauthRevokeResponse> => {\n return this.request<OauthRevokeResponse>({\n path: oauthRevoke.path(),\n method: oauthRevoke.method,\n query: pick(args, oauthRevoke.queryParams),\n body: pick(args, oauthRevoke.bodyParams),\n auth: {\n client_id: args.client_id,\n client_secret: args.client_secret,\n },\n })\n },\n }\n\n /**\n * Emits a log message to the console.\n *\n * @param level The level for this message\n * @param args Arguments to send to the console\n */\n private log(\n level: LogLevel,\n message: string,\n extraInfo: Record<string, unknown>\n ) {\n if (logLevelSeverity(level) >= logLevelSeverity(this.#logLevel)) {\n this.#logger(level, message, extraInfo)\n }\n }\n\n /**\n * Transforms an API key or access token into a headers object suitable for an HTTP request.\n *\n * This method uses the instance's value as the default when the input is undefined. If neither are defined, it returns\n * an empty object\n *\n * @param auth API key or access token\n * @returns headers key-value object\n */\n private authAsHeaders(auth?: string): Record<string, string> {\n const headers: Record<string, string> = {}\n const authHeaderValue = auth ?? this.#auth\n if (authHeaderValue !== undefined) {\n headers[\"authorization\"] = `Bearer ${authHeaderValue}`\n }\n return headers\n }\n}\n\n/*\n * Type aliases to support the generic request interface.\n */\ntype Method = \"get\" | \"post\" | \"patch\" | \"delete\"\ntype QueryParams = Record<string, string | number | string[]> | URLSearchParams\n\ntype WithAuth<P> = P & { auth?: string }\n"]}
1
+ {"version":3,"file":"Client.js","sourceRoot":"","sources":["../../src/Client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,uCAKkB;AAClB,qCAMiB;AACjB,mCAA8B;AAC9B,mDAoGwB;AACxB,kDAGwB;AAwCxB,MAAqB,MAAM;IAazB,YAAmB,OAAuB;;QAZ1C,+BAAc;QACd,mCAAmB;QACnB,iCAAe;QACf,oCAAkB;QAClB,oCAAkB;QAClB,wCAAsB;QACtB,gCAAsB;QACtB,gCAAyB;QACzB,oCAAkB;QAoJlB;;WAEG;QAEa,WAAM,GAAG;YACvB;;eAEG;YACH,QAAQ,EAAE,CACR,IAAkC,EACP,EAAE;gBAC7B,OAAO,IAAI,CAAC,OAAO,CAAmB;oBACpC,IAAI,EAAE,wBAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;oBACzB,MAAM,EAAE,wBAAQ,CAAC,MAAM;oBACvB,KAAK,EAAE,IAAA,YAAI,EAAC,IAAI,EAAE,wBAAQ,CAAC,WAAW,CAAC;oBACvC,IAAI,EAAE,IAAA,YAAI,EAAC,IAAI,EAAE,wBAAQ,CAAC,UAAU,CAAC;oBACrC,IAAI,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI;iBACjB,CAAC,CAAA;YACJ,CAAC;YAED;;eAEG;YACH,MAAM,EAAE,CACN,IAAqC,EACP,EAAE;gBAChC,OAAO,IAAI,CAAC,OAAO,CAAsB;oBACvC,IAAI,EAAE,2BAAW,CAAC,IAAI,CAAC,IAAI,CAAC;oBAC5B,MAAM,EAAE,2BAAW,CAAC,MAAM;oBAC1B,KAAK,EAAE,IAAA,YAAI,EAAC,IAAI,EAAE,2BAAW,CAAC,WAAW,CAAC;oBAC1C,IAAI,EAAE,IAAA,YAAI,EAAC,IAAI,EAAE,2BAAW,CAAC,UAAU,CAAC;oBACxC,IAAI,EAAE,I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,IAAI,KAAK,CAAC,UAAU;oBAC3C,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,UAAU,EAAE;oBACjC,CAAC,CAAC,EAAE,CAAC;aACR,CAAC,CAAA;YAEF,IAAI,IAAA,4BAAmB,EAAC,KAAK,CAAC,EAAE,CAAC;gBAC/B,oGAAoG;gBACpG,IAAI,CAAC,GAAG,CAAC,kBAAQ,CAAC,KAAK,EAAE,sBAAsB,EAAE;oBAC/C,IAAI,EAAE,KAAK,CAAC,IAAI;iBACjB,CAAC,CAAA;YACJ,CAAC;YAED,MAAM,KAAK,CAAA;QACb,CAAC;IACH,CAAC;IAqhBD;;;;;OAKG;IACK,GAAG,CACT,KAAe,EACf,OAAe,EACf,SAAkC;QAElC,IAAI,IAAA,0BAAgB,EAAC,KAAK,CAAC,IAAI,IAAA,0BAAgB,EAAC,uBAAA,IAAI,wBAAU,CAAC,EAAE,CAAC;YAChE,uBAAA,IAAI,sBAAQ,MAAZ,IAAI,EAAS,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,CAAA;QACzC,CAAC;IACH,CAAC;IAED;;;;;;;;OAQG;IACK,aAAa,CAAC,IAAa;QACjC,MAAM,OAAO,GAA2B,EAAE,CAAA;QAC1C,MAAM,eAAe,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,uBAAA,IAAI,oBAAM,CAAA;QAC1C,IAAI,eAAe,KAAK,SAAS,EAAE,CAAC;YAClC,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,eAAe,EAAE,CAAA;QACxD,CAAC;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;;;AArsBe,2BAAoB,GAAG,YAAY,AAAf,CAAe;kBAXhC,MAAM","sourcesContent":["import type { Agent } from \"node:http\"\nimport {\n type Logger,\n LogLevel,\n logLevelSeverity,\n makeConsoleLogger,\n} from \"./logging\"\nimport {\n buildRequestError,\n isHTTPResponseError,\n isNotionClientError,\n RequestTimeoutError,\n validateRequestPath,\n} from \"./errors\"\nimport { pick } from \"./utils\"\nimport {\n type GetBlockParameters,\n type GetBlockResponse,\n getBlock,\n type UpdateBlockParameters,\n type UpdateBlockResponse,\n updateBlock,\n type DeleteBlockParameters,\n type DeleteBlockResponse,\n deleteBlock,\n type AppendBlockChildrenParameters,\n type AppendBlockChildrenResponse,\n appendBlockChildren,\n type ListBlockChildrenParameters,\n type ListBlockChildrenResponse,\n listBlockChildren,\n type QueryDataSourceParameters,\n type QueryDataSourceResponse,\n queryDataSource,\n type CreateDataSourceParameters,\n type CreateDataSourceResponse,\n createDataSource,\n type UpdateDataSourceParameters,\n type UpdateDataSourceResponse,\n updateDataSource,\n type GetDataSourceParameters,\n type GetDataSourceResponse,\n getDataSource,\n type CreatePageParameters,\n type CreatePageResponse,\n createPage,\n type GetPageParameters,\n type GetPageResponse,\n getPage,\n type UpdatePageParameters,\n type UpdatePageResponse,\n updatePage,\n type MovePageParameters,\n type MovePageResponse,\n movePage,\n type GetUserParameters,\n type GetUserResponse,\n getUser,\n type ListUsersParameters,\n type ListUsersResponse,\n listUsers,\n type SearchParameters,\n type SearchResponse,\n search,\n type GetSelfParameters,\n type GetSelfResponse,\n getSelf,\n type GetPagePropertyParameters,\n type GetPagePropertyResponse,\n getPageProperty,\n type CreateCommentParameters,\n type CreateCommentResponse,\n createComment,\n type ListCommentsParameters,\n type ListCommentsResponse,\n listComments,\n type GetCommentParameters,\n type GetCommentResponse,\n getComment,\n type OauthTokenResponse,\n type OauthTokenParameters,\n oauthToken,\n type OauthIntrospectResponse,\n type OauthIntrospectParameters,\n oauthIntrospect,\n type OauthRevokeResponse,\n type OauthRevokeParameters,\n oauthRevoke,\n type CreateFileUploadParameters,\n type CreateFileUploadResponse,\n createFileUpload,\n type GetFileUploadResponse,\n type GetFileUploadParameters,\n getFileUpload,\n type SendFileUploadParameters,\n type SendFileUploadResponse,\n sendFileUpload,\n type CompleteFileUploadParameters,\n type CompleteFileUploadResponse,\n completeFileUpload,\n type ListFileUploadsParameters,\n type ListFileUploadsResponse,\n listFileUploads,\n GetDatabaseParameters,\n GetDatabaseResponse,\n getDatabase,\n CreateDatabaseResponse,\n CreateDatabaseParameters,\n createDatabase,\n UpdateDatabaseParameters,\n UpdateDatabaseResponse,\n updateDatabase,\n listDataSourceTemplates,\n ListDataSourceTemplatesResponse,\n ListDataSourceTemplatesParameters,\n} from \"./api-endpoints\"\nimport {\n version as PACKAGE_VERSION,\n name as PACKAGE_NAME,\n} from \"../package.json\"\nimport type { SupportedFetch } from \"./fetch-types\"\n\nexport interface ClientOptions {\n auth?: string\n timeoutMs?: number\n baseUrl?: string\n logLevel?: LogLevel\n logger?: Logger\n notionVersion?: string\n fetch?: SupportedFetch\n /** Silently ignored in the browser */\n agent?: Agent\n}\n\ntype FileParam = {\n filename?: string\n data: string | Blob\n}\n\nexport interface RequestParameters {\n path: string\n method: Method\n query?: QueryParams\n body?: Record<string, unknown>\n formDataParams?: Record<string, string | FileParam>\n headers?: Record<string, string>\n /**\n * To authenticate using public API token, `auth` should be passed as a\n * string. If you are trying to complete OAuth, then `auth` should be an object\n * containing your integration's client ID and secret.\n */\n auth?:\n | string\n | {\n client_id: string\n client_secret: string\n }\n}\n\nexport default class Client {\n #auth?: string\n #logLevel: LogLevel\n #logger: Logger\n #prefixUrl: string\n #timeoutMs: number\n #notionVersion: string\n #fetch: SupportedFetch\n #agent: Agent | undefined\n #userAgent: string\n\n static readonly defaultNotionVersion = \"2025-09-03\"\n\n public constructor(options?: ClientOptions) {\n this.#auth = options?.auth\n this.#logLevel = options?.logLevel ?? LogLevel.WARN\n this.#logger = options?.logger ?? makeConsoleLogger(PACKAGE_NAME)\n this.#prefixUrl = `${options?.baseUrl ?? \"https://api.notion.com\"}/v1/`\n this.#timeoutMs = options?.timeoutMs ?? 60_000\n this.#notionVersion = options?.notionVersion ?? Client.defaultNotionVersion\n this.#fetch = options?.fetch ?? fetch\n this.#agent = options?.agent\n this.#userAgent = `notionhq-client/${PACKAGE_VERSION}`\n }\n\n /**\n * Sends a request.\n */\n public async request<ResponseBody extends object>(\n args: RequestParameters\n ): Promise<ResponseBody> {\n const { path, method, query, body, formDataParams, auth } = args\n\n validateRequestPath(path)\n\n this.log(LogLevel.INFO, \"request start\", { method, path })\n\n // If the body is empty, don't send the body in the HTTP request\n const bodyAsJsonString =\n !body || Object.entries(body).length === 0\n ? undefined\n : JSON.stringify(body)\n\n const url = new URL(`${this.#prefixUrl}${path}`)\n if (query) {\n for (const [key, value] of Object.entries(query)) {\n if (value !== undefined) {\n if (Array.isArray(value)) {\n for (const val of value) {\n url.searchParams.append(key, decodeURIComponent(val))\n }\n } else {\n url.searchParams.append(key, String(value))\n }\n }\n }\n }\n\n // Allow both client ID / client secret based auth as well as token based auth.\n let authorizationHeader: Record<string, string>\n if (typeof auth === \"object\") {\n // Client ID and secret based auth is **ONLY** supported when using the\n // `/oauth/token` endpoint. If this is the case, handle formatting the\n // authorization header as required by `Basic` auth.\n const unencodedCredential = `${auth.client_id}:${auth.client_secret}`\n const encodedCredential =\n Buffer.from(unencodedCredential).toString(\"base64\")\n authorizationHeader = { authorization: `Basic ${encodedCredential}` }\n } else {\n // Otherwise format authorization header as `Bearer` token auth.\n authorizationHeader = this.authAsHeaders(auth)\n }\n\n const headers: Record<string, string> = {\n // Request-level custom additional headers can be provided, but\n // don't allow them to override all other headers, e.g. the\n // standard user agent.\n ...args.headers,\n ...authorizationHeader,\n \"Notion-Version\": this.#notionVersion,\n \"user-agent\": this.#userAgent,\n }\n\n if (bodyAsJsonString !== undefined) {\n headers[\"content-type\"] = \"application/json\"\n }\n\n let formData: FormData | undefined\n if (formDataParams) {\n delete headers[\"content-type\"]\n\n formData = new FormData()\n for (const [key, value] of Object.entries(formDataParams)) {\n if (typeof value === \"string\") {\n formData.append(key, value)\n } else if (typeof value === \"object\") {\n formData.append(\n key,\n typeof value.data === \"object\"\n ? value.data\n : new Blob([value.data]),\n value.filename\n )\n }\n }\n }\n\n try {\n const response = await RequestTimeoutError.rejectAfterTimeout(\n this.#fetch(url.toString(), {\n method: method.toUpperCase(),\n headers,\n body: bodyAsJsonString ?? formData,\n agent: this.#agent,\n }),\n this.#timeoutMs\n )\n\n const responseText = await response.text()\n if (!response.ok) {\n throw buildRequestError(response, responseText)\n }\n\n const responseJson: ResponseBody = JSON.parse(responseText)\n this.log(LogLevel.INFO, \"request success\", {\n method,\n path,\n ...(\"request_id\" in responseJson && responseJson.request_id\n ? { requestId: responseJson.request_id }\n : {}),\n })\n return responseJson\n } catch (error: unknown) {\n if (!isNotionClientError(error)) {\n throw error\n }\n\n // Log the error if it's one of our known error types\n this.log(LogLevel.WARN, \"request fail\", {\n code: error.code,\n message: error.message,\n ...(\"request_id\" in error && error.request_id\n ? { requestId: error.request_id }\n : {}),\n })\n\n if (isHTTPResponseError(error)) {\n // The response body may contain sensitive information so it is logged separately at the DEBUG level\n this.log(LogLevel.DEBUG, \"failed response body\", {\n body: error.body,\n })\n }\n\n throw error\n }\n }\n\n /*\n * Notion API endpoints\n */\n\n public readonly blocks = {\n /**\n * Retrieve block\n */\n retrieve: (\n args: WithAuth<GetBlockParameters>\n ): Promise<GetBlockResponse> => {\n return this.request<GetBlockResponse>({\n path: getBlock.path(args),\n method: getBlock.method,\n query: pick(args, getBlock.queryParams),\n body: pick(args, getBlock.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Update block\n */\n update: (\n args: WithAuth<UpdateBlockParameters>\n ): Promise<UpdateBlockResponse> => {\n return this.request<UpdateBlockResponse>({\n path: updateBlock.path(args),\n method: updateBlock.method,\n query: pick(args, updateBlock.queryParams),\n body: pick(args, updateBlock.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Delete block\n */\n delete: (\n args: WithAuth<DeleteBlockParameters>\n ): Promise<DeleteBlockResponse> => {\n return this.request<DeleteBlockResponse>({\n path: deleteBlock.path(args),\n method: deleteBlock.method,\n query: pick(args, deleteBlock.queryParams),\n body: pick(args, deleteBlock.bodyParams),\n auth: args?.auth,\n })\n },\n children: {\n /**\n * Append block children\n */\n append: (\n args: WithAuth<AppendBlockChildrenParameters>\n ): Promise<AppendBlockChildrenResponse> => {\n return this.request<AppendBlockChildrenResponse>({\n path: appendBlockChildren.path(args),\n method: appendBlockChildren.method,\n query: pick(args, appendBlockChildren.queryParams),\n body: pick(args, appendBlockChildren.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Retrieve block children\n */\n list: (\n args: WithAuth<ListBlockChildrenParameters>\n ): Promise<ListBlockChildrenResponse> => {\n return this.request<ListBlockChildrenResponse>({\n path: listBlockChildren.path(args),\n method: listBlockChildren.method,\n query: pick(args, listBlockChildren.queryParams),\n body: pick(args, listBlockChildren.bodyParams),\n auth: args?.auth,\n })\n },\n },\n }\n\n public readonly databases = {\n /**\n * Retrieve a database\n */\n retrieve: (\n args: WithAuth<GetDatabaseParameters>\n ): Promise<GetDatabaseResponse> => {\n return this.request<GetDatabaseResponse>({\n path: getDatabase.path(args),\n method: getDatabase.method,\n query: pick(args, getDatabase.queryParams),\n body: pick(args, getDatabase.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Create a database\n */\n create: (\n args: WithAuth<CreateDatabaseParameters>\n ): Promise<CreateDatabaseResponse> => {\n return this.request<CreateDatabaseResponse>({\n path: createDatabase.path(),\n method: createDatabase.method,\n query: pick(args, createDatabase.queryParams),\n body: pick(args, createDatabase.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Update a database\n */\n update: (\n args: WithAuth<UpdateDatabaseParameters>\n ): Promise<UpdateDatabaseResponse> => {\n return this.request<UpdateDatabaseResponse>({\n path: updateDatabase.path(args),\n method: updateDatabase.method,\n query: pick(args, updateDatabase.queryParams),\n body: pick(args, updateDatabase.bodyParams),\n auth: args?.auth,\n })\n },\n }\n\n public readonly dataSources = {\n /**\n * Retrieve a data source\n */\n retrieve: (\n args: WithAuth<GetDataSourceParameters>\n ): Promise<GetDataSourceResponse> => {\n return this.request<GetDataSourceResponse>({\n path: getDataSource.path(args),\n method: getDataSource.method,\n query: pick(args, getDataSource.queryParams),\n body: pick(args, getDataSource.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Query a data source\n */\n query: (\n args: WithAuth<QueryDataSourceParameters>\n ): Promise<QueryDataSourceResponse> => {\n return this.request<QueryDataSourceResponse>({\n path: queryDataSource.path(args),\n method: queryDataSource.method,\n query: pick(args, queryDataSource.queryParams),\n body: pick(args, queryDataSource.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Create a data source\n */\n create: (\n args: WithAuth<CreateDataSourceParameters>\n ): Promise<CreateDataSourceResponse> => {\n return this.request<CreateDataSourceResponse>({\n path: createDataSource.path(),\n method: createDataSource.method,\n query: pick(args, createDataSource.queryParams),\n body: pick(args, createDataSource.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Update a data source\n */\n update: (\n args: WithAuth<UpdateDataSourceParameters>\n ): Promise<UpdateDataSourceResponse> => {\n return this.request<UpdateDataSourceResponse>({\n path: updateDataSource.path(args),\n method: updateDataSource.method,\n query: pick(args, updateDataSource.queryParams),\n body: pick(args, updateDataSource.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * List page templates that are available for a data source\n */\n listTemplates: (\n args: WithAuth<ListDataSourceTemplatesParameters>\n ): Promise<ListDataSourceTemplatesResponse> => {\n return this.request<ListDataSourceTemplatesResponse>({\n path: listDataSourceTemplates.path(args),\n method: listDataSourceTemplates.method,\n query: pick(args, listDataSourceTemplates.queryParams),\n body: pick(args, listDataSourceTemplates.bodyParams),\n auth: args?.auth,\n })\n },\n }\n\n public readonly pages = {\n /**\n * Create a page\n */\n create: (\n args: WithAuth<CreatePageParameters>\n ): Promise<CreatePageResponse> => {\n return this.request<CreatePageResponse>({\n path: createPage.path(),\n method: createPage.method,\n query: pick(args, createPage.queryParams),\n body: pick(args, createPage.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Retrieve a page\n */\n retrieve: (args: WithAuth<GetPageParameters>): Promise<GetPageResponse> => {\n return this.request<GetPageResponse>({\n path: getPage.path(args),\n method: getPage.method,\n query: pick(args, getPage.queryParams),\n body: pick(args, getPage.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Update page properties\n */\n update: (\n args: WithAuth<UpdatePageParameters>\n ): Promise<UpdatePageResponse> => {\n return this.request<UpdatePageResponse>({\n path: updatePage.path(args),\n method: updatePage.method,\n query: pick(args, updatePage.queryParams),\n body: pick(args, updatePage.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Move a page\n */\n move: (args: WithAuth<MovePageParameters>): Promise<MovePageResponse> => {\n return this.request<MovePageResponse>({\n path: movePage.path(args),\n method: movePage.method,\n query: pick(args, movePage.queryParams),\n body: pick(args, movePage.bodyParams),\n auth: args?.auth,\n })\n },\n properties: {\n /**\n * Retrieve page property\n */\n retrieve: (\n args: WithAuth<GetPagePropertyParameters>\n ): Promise<GetPagePropertyResponse> => {\n return this.request<GetPagePropertyResponse>({\n path: getPageProperty.path(args),\n method: getPageProperty.method,\n query: pick(args, getPageProperty.queryParams),\n body: pick(args, getPageProperty.bodyParams),\n auth: args?.auth,\n })\n },\n },\n }\n\n public readonly users = {\n /**\n * Retrieve a user\n */\n retrieve: (args: WithAuth<GetUserParameters>): Promise<GetUserResponse> => {\n return this.request<GetUserResponse>({\n path: getUser.path(args),\n method: getUser.method,\n query: pick(args, getUser.queryParams),\n body: pick(args, getUser.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * List all users\n */\n list: (args: WithAuth<ListUsersParameters>): Promise<ListUsersResponse> => {\n return this.request<ListUsersResponse>({\n path: listUsers.path(),\n method: listUsers.method,\n query: pick(args, listUsers.queryParams),\n body: pick(args, listUsers.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Get details about bot\n */\n me: (args: WithAuth<GetSelfParameters>): Promise<GetSelfResponse> => {\n return this.request<GetSelfResponse>({\n path: getSelf.path(),\n method: getSelf.method,\n query: pick(args, getSelf.queryParams),\n body: pick(args, getSelf.bodyParams),\n auth: args?.auth,\n })\n },\n }\n\n public readonly comments = {\n /**\n * Create a comment\n */\n create: (\n args: WithAuth<CreateCommentParameters>\n ): Promise<CreateCommentResponse> => {\n return this.request<CreateCommentResponse>({\n path: createComment.path(),\n method: createComment.method,\n query: pick(args, createComment.queryParams),\n body: pick(args, createComment.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * List comments\n */\n list: (\n args: WithAuth<ListCommentsParameters>\n ): Promise<ListCommentsResponse> => {\n return this.request<ListCommentsResponse>({\n path: listComments.path(),\n method: listComments.method,\n query: pick(args, listComments.queryParams),\n body: pick(args, listComments.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Retrieve a comment\n */\n retrieve: (\n args: WithAuth<GetCommentParameters>\n ): Promise<GetCommentResponse> => {\n return this.request<GetCommentResponse>({\n path: getComment.path(args),\n method: getComment.method,\n query: pick(args, getComment.queryParams),\n body: pick(args, getComment.bodyParams),\n auth: args?.auth,\n })\n },\n }\n\n public readonly fileUploads = {\n /**\n * Create a file upload\n */\n create: (\n args: WithAuth<CreateFileUploadParameters>\n ): Promise<CreateFileUploadResponse> => {\n return this.request<CreateFileUploadResponse>({\n path: createFileUpload.path(),\n method: createFileUpload.method,\n query: pick(args, createFileUpload.queryParams),\n body: pick(args, createFileUpload.bodyParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Retrieve a file upload\n */\n retrieve: (\n args: WithAuth<GetFileUploadParameters>\n ): Promise<GetFileUploadResponse> => {\n return this.request<GetFileUploadResponse>({\n path: getFileUpload.path(args),\n method: getFileUpload.method,\n query: pick(args, getFileUpload.queryParams),\n auth: args?.auth,\n })\n },\n\n /**\n * List file uploads\n */\n list: (\n args: WithAuth<ListFileUploadsParameters>\n ): Promise<ListFileUploadsResponse> => {\n return this.request<ListFileUploadsResponse>({\n path: listFileUploads.path(),\n method: listFileUploads.method,\n query: pick(args, listFileUploads.queryParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Send a file upload\n *\n * Requires a `file_upload_id`, obtained from the `id` of the Create File\n * Upload API response.\n *\n * The `file` parameter contains the raw file contents or Blob/File object\n * under `file.data`, and an optional `file.filename` string.\n *\n * Supply a stringified `part_number` parameter when using file uploads\n * in multi-part mode.\n *\n * This endpoint sends HTTP multipart/form-data instead of JSON parameters.\n */\n send: (\n args: WithAuth<SendFileUploadParameters>\n ): Promise<SendFileUploadResponse> => {\n return this.request<SendFileUploadResponse>({\n path: sendFileUpload.path(args),\n method: sendFileUpload.method,\n query: pick(args, sendFileUpload.queryParams),\n formDataParams: pick(args, sendFileUpload.formDataParams),\n auth: args?.auth,\n })\n },\n\n /**\n * Complete a file upload\n */\n complete: (\n args: WithAuth<CompleteFileUploadParameters>\n ): Promise<CompleteFileUploadResponse> => {\n return this.request<CompleteFileUploadResponse>({\n path: completeFileUpload.path(args),\n method: completeFileUpload.method,\n query: pick(args, completeFileUpload.queryParams),\n auth: args?.auth,\n })\n },\n }\n\n /**\n * Search\n */\n public search = (\n args: WithAuth<SearchParameters>\n ): Promise<SearchResponse> => {\n return this.request<SearchResponse>({\n path: search.path(),\n method: search.method,\n query: pick(args, search.queryParams),\n body: pick(args, search.bodyParams),\n auth: args?.auth,\n })\n }\n\n public readonly oauth = {\n /**\n * Get token\n */\n token: (\n args: OauthTokenParameters & {\n client_id: string\n client_secret: string\n }\n ): Promise<OauthTokenResponse> => {\n return this.request<OauthTokenResponse>({\n path: oauthToken.path(),\n method: oauthToken.method,\n query: pick(args, oauthToken.queryParams),\n body: pick(args, oauthToken.bodyParams),\n auth: {\n client_id: args.client_id,\n client_secret: args.client_secret,\n },\n })\n },\n /**\n * Introspect token\n */\n introspect: (\n args: OauthIntrospectParameters & {\n client_id: string\n client_secret: string\n }\n ): Promise<OauthIntrospectResponse> => {\n return this.request<OauthIntrospectResponse>({\n path: oauthIntrospect.path(),\n method: oauthIntrospect.method,\n query: pick(args, oauthIntrospect.queryParams),\n body: pick(args, oauthIntrospect.bodyParams),\n auth: {\n client_id: args.client_id,\n client_secret: args.client_secret,\n },\n })\n },\n /**\n * Revoke token\n */\n revoke: (\n args: OauthRevokeParameters & {\n client_id: string\n client_secret: string\n }\n ): Promise<OauthRevokeResponse> => {\n return this.request<OauthRevokeResponse>({\n path: oauthRevoke.path(),\n method: oauthRevoke.method,\n query: pick(args, oauthRevoke.queryParams),\n body: pick(args, oauthRevoke.bodyParams),\n auth: {\n client_id: args.client_id,\n client_secret: args.client_secret,\n },\n })\n },\n }\n\n /**\n * Emits a log message to the console.\n *\n * @param level The level for this message\n * @param args Arguments to send to the console\n */\n private log(\n level: LogLevel,\n message: string,\n extraInfo: Record<string, unknown>\n ) {\n if (logLevelSeverity(level) >= logLevelSeverity(this.#logLevel)) {\n this.#logger(level, message, extraInfo)\n }\n }\n\n /**\n * Transforms an API key or access token into a headers object suitable for an HTTP request.\n *\n * This method uses the instance's value as the default when the input is undefined. If neither are defined, it returns\n * an empty object\n *\n * @param auth API key or access token\n * @returns headers key-value object\n */\n private authAsHeaders(auth?: string): Record<string, string> {\n const headers: Record<string, string> = {}\n const authHeaderValue = auth ?? this.#auth\n if (authHeaderValue !== undefined) {\n headers[\"authorization\"] = `Bearer ${authHeaderValue}`\n }\n return headers\n }\n}\n\n/*\n * Type aliases to support the generic request interface.\n */\ntype Method = \"get\" | \"post\" | \"patch\" | \"delete\"\ntype QueryParams = Record<string, string | number | string[]> | URLSearchParams\n\ntype WithAuth<P> = P & { auth?: string }\n"]}
@@ -20,7 +20,8 @@ export declare enum APIErrorCode {
20
20
  */
21
21
  export declare enum ClientErrorCode {
22
22
  RequestTimeout = "notionhq_client_request_timeout",
23
- ResponseError = "notionhq_client_response_error"
23
+ ResponseError = "notionhq_client_response_error",
24
+ InvalidPathParameter = "notionhq_client_invalid_path_parameter"
24
25
  }
25
26
  /**
26
27
  * Error codes on errors thrown by the `Client`.
@@ -35,7 +36,7 @@ declare abstract class NotionClientErrorBase<Code extends NotionErrorCode> exten
35
36
  /**
36
37
  * Error type that encompasses all the kinds of errors that the Notion client will throw.
37
38
  */
38
- export type NotionClientError = RequestTimeoutError | UnknownHTTPResponseError | APIResponseError;
39
+ export type NotionClientError = RequestTimeoutError | UnknownHTTPResponseError | APIResponseError | InvalidPathParameterError;
39
40
  /**
40
41
  * @param error any value, usually a caught error.
41
42
  * @returns `true` if error is a `NotionClientError`.
@@ -51,6 +52,22 @@ export declare class RequestTimeoutError extends NotionClientErrorBase<ClientErr
51
52
  static isRequestTimeoutError(error: unknown): error is RequestTimeoutError;
52
53
  static rejectAfterTimeout<T>(promise: Promise<T>, timeoutMS: number): Promise<T>;
53
54
  }
55
+ /**
56
+ * Error thrown when a path parameter contains invalid characters such as
57
+ * path traversal sequences (..) that could alter the intended API endpoint.
58
+ */
59
+ export declare class InvalidPathParameterError extends NotionClientErrorBase<ClientErrorCode.InvalidPathParameter> {
60
+ readonly code = ClientErrorCode.InvalidPathParameter;
61
+ readonly name = "InvalidPathParameterError";
62
+ constructor(message?: string);
63
+ static isInvalidPathParameterError(error: unknown): error is InvalidPathParameterError;
64
+ }
65
+ /**
66
+ * Validates that a request path does not contain path traversal sequences.
67
+ * Throws InvalidPathParameterError if the path contains ".." segments,
68
+ * including URL-encoded variants like %2e%2e.
69
+ */
70
+ export declare function validateRequestPath(path: string): void;
54
71
  type HTTPResponseErrorCode = ClientErrorCode.ResponseError | APIErrorCode;
55
72
  type AdditionalData = Record<string, string | string[]>;
56
73
  declare class HTTPResponseError<Code extends HTTPResponseErrorCode> extends NotionClientErrorBase<Code> {
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAIjD;;GAEG;AACH,oBAAY,YAAY;IACtB,YAAY,iBAAiB;IAC7B,kBAAkB,wBAAwB;IAC1C,cAAc,qBAAqB;IACnC,WAAW,iBAAiB;IAC5B,WAAW,iBAAiB;IAC5B,iBAAiB,wBAAwB;IACzC,cAAc,oBAAoB;IAClC,e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,MAAM,CAAA;QACf,OAAO,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAA;QACrC,WAAW,EAAE,MAAM,CAAA;QACnB,eAAe,EAAE,cAAc,GAAG,SAAS,CAAA;QAC3C,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;KAC/B;CAWF;AAiBD,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,wBAAwB,GAAG,gBAAgB,CAWtD;AAED;;;GAGG;AACH,qBAAa,wBAAyB,SAAQ,iBAAiB,CAAC,eAAe,CAAC,aAAa,CAAC;IAC5F,QAAQ,CAAC,IAAI,8BAA6B;gBAE9B,IAAI,EAAE;QAChB,MAAM,EAAE,MAAM,CAAA;QACd,OAAO,EAAE,MAAM,GAAG,SAAS,CAAA;QAC3B,OAAO,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAA;QACrC,WAAW,EAAE,MAAM,CAAA;KACpB;IAYD,MAAM,CAAC,0BAA0B,CAC/B,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,wBAAwB;CAKrC;AAgBD;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,iBAAiB,CAAC,YAAY,CAAC;IACnE,QAAQ,CAAC,IAAI,sBAAqB;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAEvC,MAAM,CAAC,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB;CAGrE;AAED,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,iBAAiB,EAC3B,QAAQ,EAAE,MAAM,GACf,gBAAgB,GAAG,wBAAwB,CAmB7C"}
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.APIResponseError = exports.UnknownHTTPResponseError = exports.RequestTimeoutError = exports.ClientErrorCode = exports.APIErrorCode = void 0;
3
+ exports.APIResponseError = exports.UnknownHTTPResponseError = exports.InvalidPathParameterError = exports.RequestTimeoutError = exports.ClientErrorCode = exports.APIErrorCode = void 0;
4
4
  exports.isNotionClientError = isNotionClientError;
5
+ exports.validateRequestPath = validateRequestPath;
5
6
  exports.isHTTPResponseError = isHTTPResponseError;
6
7
  exports.buildRequestError = buildRequestError;
7
8
  const utils_1 = require("./utils");
@@ -29,6 +30,7 @@ var ClientErrorCode;
29
30
  (function (ClientErrorCode) {
30
31
  ClientErrorCode["RequestTimeout"] = "notionhq_client_request_timeout";
31
32
  ClientErrorCode["ResponseError"] = "notionhq_client_response_error";
33
+ ClientErrorCode["InvalidPathParameter"] = "notionhq_client_invalid_path_parameter";
32
34
  })(ClientErrorCode || (exports.ClientErrorCode = ClientErrorCode = {}));
33
35
  /**
34
36
  * Base error type.
@@ -78,6 +80,49 @@ class RequestTimeoutError extends NotionClientErrorBase {
78
80
  }
79
81
  }
80
82
  exports.RequestTimeoutError = RequestTimeoutError;
83
+ /**
84
+ * Error thrown when a path parameter contains invalid characters such as
85
+ * path traversal sequences (..) that could alter the intended API endpoint.
86
+ */
87
+ class InvalidPathParameterError extends NotionClientErrorBase {
88
+ constructor(message = "Path parameter contains invalid characters that could alter the request path") {
89
+ super(message);
90
+ this.code = ClientErrorCode.InvalidPathParameter;
91
+ this.name = "InvalidPathParameterError";
92
+ }
93
+ static isInvalidPathParameterError(error) {
94
+ return isNotionClientErrorWithCode(error, {
95
+ [ClientErrorCode.InvalidPathParameter]: true,
96
+ });
97
+ }
98
+ }
99
+ exports.InvalidPathParameterError = InvalidPathParameterError;
100
+ /**
101
+ * Validates that a request path does not contain path traversal sequences.
102
+ * Throws InvalidPathParameterError if the path contains ".." segments,
103
+ * including URL-encoded variants like %2e%2e.
104
+ */
105
+ function validateRequestPath(path) {
106
+ // Check for literal path traversal
107
+ if (path.includes("..")) {
108
+ throw new InvalidPathParameterError(`Request path "${path}" contains path traversal sequence ".."`);
109
+ }
110
+ // Check for URL-encoded path traversal (%2e = '.')
111
+ // Only decode if path contains potential encoded dots
112
+ if (/%2e/i.test(path)) {
113
+ let decoded;
114
+ try {
115
+ decoded = decodeURIComponent(path);
116
+ }
117
+ catch {
118
+ // Invalid percent encoding - not a traversal concern
119
+ return;
120
+ }
121
+ if (decoded.includes("..")) {
122
+ throw new InvalidPathParameterError(`Request path "${path}" contains encoded path traversal sequence`);
123
+ }
124
+ }
125
+ }
81
126
  class HTTPResponseError extends NotionClientErrorBase {
82
127
  constructor(args) {
83
128
  super(args.message);
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":";;;AAkEA,kDAIC;AAoGD,kDAaC;AA8DD,8CAsBC;AA1QD,mCAAkC;AAGlC;;GAEG;AACH,IAAY,YAYX;AAZD,WAAY,YAAY;IACtB,6CAA6B,CAAA;IAC7B,0DAA0C,CAAA;IAC1C,mDAAmC,CAAA;IACnC,4CAA4B,CAAA;IAC5B,4CAA4B,CAAA;IAC5B,yDAAyC,CAAA;IACzC,kDAAkC,CAAA;IAClC,oDAAoC,CAAA;IACpC,gDAAgC,CAAA;IAChC,6DAA6C,CAAA;IAC7C,0DAA0C,CAAA;AAC5C,CAAC,EAZW,YAAY,4BAAZ,YAAY,QAYvB;AAED;;GAEG;AACH,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,qEAAkD,CAAA;IAClD,mEAAgD,CAAA;AAClD,CAAC,EAHW,eAAe,+BAAf,eAAe,QAG1B;AAOD;;GAEG;AACH,MAAe,qBAEb,SAAQ,KAAK;CAEd;AAqBD;;;GAGG;AACH,SAAgB,mBAAmB,CACjC,KAAc;IAEd,OAAO,IAAA,gBAAQ,EAAC,KAAK,CAAC,IAAI,KAAK,YAAY,qBAAqB,CAAA;AAClE,CAAC;AAED;;;;;GAKG;AACH,SAAS,2BAA2B,CAClC,KAAc,EACd,KAA4B;IAE5B,OAAO,mBAAmB,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAA;AAC1D,CAAC;AAED;;GAEG;A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","sourcesContent":["import { SupportedResponse } from \"./fetch-types\"\nimport { isObject } from \"./utils\"\nimport { Assert } from \"./type-utils\"\n\n/**\n * Error codes returned in responses from the API.\n */\nexport enum APIErrorCode {\n Unauthorized = \"unauthorized\",\n RestrictedResource = \"restricted_resource\",\n ObjectNotFound = \"object_not_found\",\n RateLimited = \"rate_limited\",\n InvalidJSON = \"invalid_json\",\n InvalidRequestURL = \"invalid_request_url\",\n InvalidRequest = \"invalid_request\",\n ValidationError = \"validation_error\",\n ConflictError = \"conflict_error\",\n InternalServerError = \"internal_server_error\",\n ServiceUnavailable = \"service_unavailable\",\n}\n\n/**\n * Error codes generated for client errors.\n */\nexport enum ClientErrorCode {\n RequestTimeout = \"notionhq_client_request_timeout\",\n ResponseError = \"notionhq_client_response_error\",\n}\n\n/**\n * Error codes on errors thrown by the `Client`.\n */\nexport type NotionErrorCode = APIErrorCode | ClientErrorCode\n\n/**\n * Base error type.\n */\nabstract class NotionClientErrorBase<\n Code extends NotionErrorCode\n> extends Error {\n abstract code: Code\n}\n\n/**\n * Error type that encompasses all the kinds of errors that the Notion client will throw.\n */\nexport type NotionClientError =\n | RequestTimeoutError\n | UnknownHTTPResponseError\n | APIResponseError\n\n// Assert that NotionClientError's `code` property is a narrow type.\n// This prevents us from accidentally regressing to `string`-typed name field.\ntype _assertCodeIsNarrow = Assert<NotionErrorCode, NotionClientError[\"code\"]>\n\n// Assert that the type of `name` in NotionErrorCode is a narrow type.\n// This prevents us from accidentally regressing to `string`-typed name field.\ntype _assertNameIsNarrow = Assert<\n \"RequestTimeoutError\" | \"UnknownHTTPResponseError\" | \"APIResponseError\",\n NotionClientError[\"name\"]\n>\n\n/**\n * @param error any value, usually a caught error.\n * @returns `true` if error is a `NotionClientError`.\n */\nexport function isNotionClientError(\n error: unknown\n): error is NotionClientError {\n return isObject(error) && error instanceof NotionClientErrorBase\n}\n\n/**\n * Narrows down the types of a NotionClientError.\n * @param error any value, usually a caught error.\n * @param codes an object mapping from possible error codes to `true`\n * @returns `true` if error is a `NotionClientError` with a code in `codes`.\n */\nfunction isNotionClientErrorWithCode<Code extends NotionErrorCode>(\n error: unknown,\n codes: { [C in Code]: true }\n): error is NotionClientError & { code: Code } {\n return isNotionClientError(error) && error.code in codes\n}\n\n/**\n * Error thrown by the client if a request times out.\n */\nexport class RequestTimeoutError extends NotionClientErrorBase<ClientErrorCode.RequestTimeout> {\n readonly code = ClientErrorCode.RequestTimeout\n readonly name = \"RequestTimeoutError\"\n\n constructor(message = \"Request to Notion API has timed out\") {\n super(message)\n }\n\n static isRequestTimeoutError(error: unknown): error is RequestTimeoutError {\n return isNotionClientErrorWithCode(error, {\n [ClientErrorCode.RequestTimeout]: true,\n })\n }\n\n static rejectAfterTimeout<T>(\n promise: Promise<T>,\n timeoutMS: number\n ): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const timeoutId = setTimeout(() => {\n reject(new RequestTimeoutError())\n }, timeoutMS)\n\n promise\n .then(resolve)\n .catch(reject)\n .then(() => clearTimeout(timeoutId))\n })\n }\n}\n\ntype HTTPResponseErrorCode = ClientErrorCode.ResponseError | APIErrorCode\n\ntype AdditionalData = Record<string, string | string[]>\n\nclass HTTPResponseError<\n Code extends HTTPResponseErrorCode\n> extends NotionClientErrorBase<Code> {\n readonly name: string = \"HTTPResponseError\"\n readonly code: Code\n readonly status: number\n readonly headers: SupportedResponse[\"headers\"]\n readonly body: string\n readonly additional_data: AdditionalData | undefined\n readonly request_id: string | undefined\n\n constructor(args: {\n code: Code\n status: number\n message: string\n headers: SupportedResponse[\"headers\"]\n rawBodyText: string\n additional_data: AdditionalData | undefined\n request_id: string | undefined\n }) {\n super(args.message)\n const { code, status, headers, rawBodyText, additional_data, request_id } =\n args\n this.code = code\n this.status = status\n this.headers = headers\n this.body = rawBodyText\n this.additional_data = additional_data\n this.request_id = request_id\n }\n}\n\nconst httpResponseErrorCodes: { [C in HTTPResponseErrorCode]: true } = {\n [ClientErrorCode.ResponseError]: true,\n [APIErrorCode.Unauthorized]: true,\n [APIErrorCode.RestrictedResource]: true,\n [APIErrorCode.ObjectNotFound]: true,\n [APIErrorCode.RateLimited]: true,\n [APIErrorCode.InvalidJSON]: true,\n [APIErrorCode.InvalidRequestURL]: true,\n [APIErrorCode.InvalidRequest]: true,\n [APIErrorCode.ValidationError]: true,\n [APIErrorCode.ConflictError]: true,\n [APIErrorCode.InternalServerError]: true,\n [APIErrorCode.ServiceUnavailable]: true,\n}\n\nexport function isHTTPResponseError(\n error: unknown\n): error is UnknownHTTPResponseError | APIResponseError {\n if (!isNotionClientErrorWithCode(error, httpResponseErrorCodes)) {\n return false\n }\n\n type _assert = Assert<\n UnknownHTTPResponseError | APIResponseError,\n typeof error\n >\n\n return true\n}\n\n/**\n * Error thrown if an API call responds with an unknown error code, or does not respond with\n * a property-formatted error.\n */\nexport class UnknownHTTPResponseError extends HTTPResponseError<ClientErrorCode.ResponseError> {\n readonly name = \"UnknownHTTPResponseError\"\n\n constructor(args: {\n status: number\n message: string | undefined\n headers: SupportedResponse[\"headers\"]\n rawBodyText: string\n }) {\n super({\n ...args,\n code: ClientErrorCode.ResponseError,\n message:\n args.message ??\n `Request to Notion API failed with status: ${args.status}`,\n additional_data: undefined,\n request_id: undefined,\n })\n }\n\n static isUnknownHTTPResponseError(\n error: unknown\n ): error is UnknownHTTPResponseError {\n return isNotionClientErrorWithCode(error, {\n [ClientErrorCode.ResponseError]: true,\n })\n }\n}\n\nconst apiErrorCodes: { [C in APIErrorCode]: true } = {\n [APIErrorCode.Unauthorized]: true,\n [APIErrorCode.RestrictedResource]: true,\n [APIErrorCode.ObjectNotFound]: true,\n [APIErrorCode.RateLimited]: true,\n [APIErrorCode.InvalidJSON]: true,\n [APIErrorCode.InvalidRequestURL]: true,\n [APIErrorCode.InvalidRequest]: true,\n [APIErrorCode.ValidationError]: true,\n [APIErrorCode.ConflictError]: true,\n [APIErrorCode.InternalServerError]: true,\n [APIErrorCode.ServiceUnavailable]: true,\n}\n\n/**\n * A response from the API indicating a problem.\n * Use the `code` property to handle various kinds of errors. All its possible values are in `APIErrorCode`.\n */\nexport class APIResponseError extends HTTPResponseError<APIErrorCode> {\n readonly name = \"APIResponseError\"\n readonly request_id: string | undefined\n\n static isAPIResponseError(error: unknown): error is APIResponseError {\n return isNotionClientErrorWithCode(error, apiErrorCodes)\n }\n}\n\nexport function buildRequestError(\n response: SupportedResponse,\n bodyText: string\n): APIResponseError | UnknownHTTPResponseError {\n const apiErrorResponseBody = parseAPIErrorResponseBody(bodyText)\n if (apiErrorResponseBody !== undefined) {\n return new APIResponseError({\n code: apiErrorResponseBody.code,\n message: apiErrorResponseBody.message,\n headers: response.headers,\n status: response.status,\n rawBodyText: bodyText,\n additional_data: apiErrorResponseBody.additional_data,\n request_id: apiErrorResponseBody.request_id,\n })\n }\n return new UnknownHTTPResponseError({\n message: undefined,\n headers: response.headers,\n status: response.status,\n rawBodyText: bodyText,\n })\n}\n\nfunction parseAPIErrorResponseBody(body: string):\n | {\n code: APIErrorCode\n message: string\n additional_data: AdditionalData | undefined\n request_id: string | undefined\n }\n | undefined {\n if (typeof body !== \"string\") {\n return\n }\n\n let parsed: unknown\n try {\n parsed = JSON.parse(body)\n } catch (parseError) {\n return\n }\n\n if (\n !isObject(parsed) ||\n typeof parsed[\"message\"] !== \"string\" ||\n !isAPIErrorCode(parsed[\"code\"])\n ) {\n return\n }\n\n const additional_data = parsed[\"additional_data\"] as\n | AdditionalData\n | undefined\n const request_id = parsed[\"request_id\"] as string | undefined\n\n return {\n ...parsed,\n code: parsed[\"code\"],\n message: parsed[\"message\"],\n additional_data,\n request_id,\n }\n}\n\nfunction isAPIErrorCode(code: unknown): code is APIErrorCode {\n return typeof code === \"string\" && code in apiErrorCodes\n}\n"]}
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":";;;AAuEA,kDAIC;AA6ED,kDAwBC;AAqDD,kDAaC;AA8DD,8CAsBC;AArUD,mCAAkC;AAGlC;;GAEG;AACH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AAM;IACR,CAAC;IAED,IACE,CAAC,IAAA,gBAAQ,EAAC,MAAM,CAAC;QACjB,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,QAAQ;QACrC,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAC/B,CAAC;QACD,OAAM;IACR,CAAC;IAED,MAAM,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAEnC,CAAA;IACb,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAAuB,CAAA;IAE7D,OAAO;QACL,GAAG,MAAM;QACT,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC;QAC1B,eAAe;QACf,UAAU;KACX,CAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,IAAa;IACnC,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,IAAI,aAAa,CAAA;AAC1D,CAAC","sourcesContent":["import { SupportedResponse } from \"./fetch-types\"\nimport { isObject } from \"./utils\"\nimport { Assert } from \"./type-utils\"\n\n/**\n * Error codes returned in responses from the API.\n */\nexport enum APIErrorCode {\n Unauthorized = \"unauthorized\",\n RestrictedResource = \"restricted_resource\",\n ObjectNotFound = \"object_not_found\",\n RateLimited = \"rate_limited\",\n InvalidJSON = \"invalid_json\",\n InvalidRequestURL = \"invalid_request_url\",\n InvalidRequest = \"invalid_request\",\n ValidationError = \"validation_error\",\n ConflictError = \"conflict_error\",\n InternalServerError = \"internal_server_error\",\n ServiceUnavailable = \"service_unavailable\",\n}\n\n/**\n * Error codes generated for client errors.\n */\nexport enum ClientErrorCode {\n RequestTimeout = \"notionhq_client_request_timeout\",\n ResponseError = \"notionhq_client_response_error\",\n InvalidPathParameter = \"notionhq_client_invalid_path_parameter\",\n}\n\n/**\n * Error codes on errors thrown by the `Client`.\n */\nexport type NotionErrorCode = APIErrorCode | ClientErrorCode\n\n/**\n * Base error type.\n */\nabstract class NotionClientErrorBase<\n Code extends NotionErrorCode\n> extends Error {\n abstract code: Code\n}\n\n/**\n * Error type that encompasses all the kinds of errors that the Notion client will throw.\n */\nexport type NotionClientError =\n | RequestTimeoutError\n | UnknownHTTPResponseError\n | APIResponseError\n | InvalidPathParameterError\n\n// Assert that NotionClientError's `code` property is a narrow type.\n// This prevents us from accidentally regressing to `string`-typed name field.\ntype _assertCodeIsNarrow = Assert<NotionErrorCode, NotionClientError[\"code\"]>\n\n// Assert that the type of `name` in NotionErrorCode is a narrow type.\n// This prevents us from accidentally regressing to `string`-typed name field.\ntype _assertNameIsNarrow = Assert<\n | \"RequestTimeoutError\"\n | \"UnknownHTTPResponseError\"\n | \"APIResponseError\"\n | \"InvalidPathParameterError\",\n NotionClientError[\"name\"]\n>\n\n/**\n * @param error any value, usually a caught error.\n * @returns `true` if error is a `NotionClientError`.\n */\nexport function isNotionClientError(\n error: unknown\n): error is NotionClientError {\n return isObject(error) && error instanceof NotionClientErrorBase\n}\n\n/**\n * Narrows down the types of a NotionClientError.\n * @param error any value, usually a caught error.\n * @param codes an object mapping from possible error codes to `true`\n * @returns `true` if error is a `NotionClientError` with a code in `codes`.\n */\nfunction isNotionClientErrorWithCode<Code extends NotionErrorCode>(\n error: unknown,\n codes: { [C in Code]: true }\n): error is NotionClientError & { code: Code } {\n return isNotionClientError(error) && error.code in codes\n}\n\n/**\n * Error thrown by the client if a request times out.\n */\nexport class RequestTimeoutError extends NotionClientErrorBase<ClientErrorCode.RequestTimeout> {\n readonly code = ClientErrorCode.RequestTimeout\n readonly name = \"RequestTimeoutError\"\n\n constructor(message = \"Request to Notion API has timed out\") {\n super(message)\n }\n\n static isRequestTimeoutError(error: unknown): error is RequestTimeoutError {\n return isNotionClientErrorWithCode(error, {\n [ClientErrorCode.RequestTimeout]: true,\n })\n }\n\n static rejectAfterTimeout<T>(\n promise: Promise<T>,\n timeoutMS: number\n ): Promise<T> {\n return new Promise<T>((resolve, reject) => {\n const timeoutId = setTimeout(() => {\n reject(new RequestTimeoutError())\n }, timeoutMS)\n\n promise\n .then(resolve)\n .catch(reject)\n .then(() => clearTimeout(timeoutId))\n })\n }\n}\n\n/**\n * Error thrown when a path parameter contains invalid characters such as\n * path traversal sequences (..) that could alter the intended API endpoint.\n */\nexport class InvalidPathParameterError extends NotionClientErrorBase<ClientErrorCode.InvalidPathParameter> {\n readonly code = ClientErrorCode.InvalidPathParameter\n readonly name = \"InvalidPathParameterError\"\n\n constructor(\n message = \"Path parameter contains invalid characters that could alter the request path\"\n ) {\n super(message)\n }\n\n static isInvalidPathParameterError(\n error: unknown\n ): error is InvalidPathParameterError {\n return isNotionClientErrorWithCode(error, {\n [ClientErrorCode.InvalidPathParameter]: true,\n })\n }\n}\n\n/**\n * Validates that a request path does not contain path traversal sequences.\n * Throws InvalidPathParameterError if the path contains \"..\" segments,\n * including URL-encoded variants like %2e%2e.\n */\nexport function validateRequestPath(path: string): void {\n // Check for literal path traversal\n if (path.includes(\"..\")) {\n throw new InvalidPathParameterError(\n `Request path \"${path}\" contains path traversal sequence \"..\"`\n )\n }\n\n // Check for URL-encoded path traversal (%2e = '.')\n // Only decode if path contains potential encoded dots\n if (/%2e/i.test(path)) {\n let decoded: string\n try {\n decoded = decodeURIComponent(path)\n } catch {\n // Invalid percent encoding - not a traversal concern\n return\n }\n if (decoded.includes(\"..\")) {\n throw new InvalidPathParameterError(\n `Request path \"${path}\" contains encoded path traversal sequence`\n )\n }\n }\n}\n\ntype HTTPResponseErrorCode = ClientErrorCode.ResponseError | APIErrorCode\n\ntype AdditionalData = Record<string, string | string[]>\n\nclass HTTPResponseError<\n Code extends HTTPResponseErrorCode\n> extends NotionClientErrorBase<Code> {\n readonly name: string = \"HTTPResponseError\"\n readonly code: Code\n readonly status: number\n readonly headers: SupportedResponse[\"headers\"]\n readonly body: string\n readonly additional_data: AdditionalData | undefined\n readonly request_id: string | undefined\n\n constructor(args: {\n code: Code\n status: number\n message: string\n headers: SupportedResponse[\"headers\"]\n rawBodyText: string\n additional_data: AdditionalData | undefined\n request_id: string | undefined\n }) {\n super(args.message)\n const { code, status, headers, rawBodyText, additional_data, request_id } =\n args\n this.code = code\n this.status = status\n this.headers = headers\n this.body = rawBodyText\n this.additional_data = additional_data\n this.request_id = request_id\n }\n}\n\nconst httpResponseErrorCodes: { [C in HTTPResponseErrorCode]: true } = {\n [ClientErrorCode.ResponseError]: true,\n [APIErrorCode.Unauthorized]: true,\n [APIErrorCode.RestrictedResource]: true,\n [APIErrorCode.ObjectNotFound]: true,\n [APIErrorCode.RateLimited]: true,\n [APIErrorCode.InvalidJSON]: true,\n [APIErrorCode.InvalidRequestURL]: true,\n [APIErrorCode.InvalidRequest]: true,\n [APIErrorCode.ValidationError]: true,\n [APIErrorCode.ConflictError]: true,\n [APIErrorCode.InternalServerError]: true,\n [APIErrorCode.ServiceUnavailable]: true,\n}\n\nexport function isHTTPResponseError(\n error: unknown\n): error is UnknownHTTPResponseError | APIResponseError {\n if (!isNotionClientErrorWithCode(error, httpResponseErrorCodes)) {\n return false\n }\n\n type _assert = Assert<\n UnknownHTTPResponseError | APIResponseError,\n typeof error\n >\n\n return true\n}\n\n/**\n * Error thrown if an API call responds with an unknown error code, or does not respond with\n * a property-formatted error.\n */\nexport class UnknownHTTPResponseError extends HTTPResponseError<ClientErrorCode.ResponseError> {\n readonly name = \"UnknownHTTPResponseError\"\n\n constructor(args: {\n status: number\n message: string | undefined\n headers: SupportedResponse[\"headers\"]\n rawBodyText: string\n }) {\n super({\n ...args,\n code: ClientErrorCode.ResponseError,\n message:\n args.message ??\n `Request to Notion API failed with status: ${args.status}`,\n additional_data: undefined,\n request_id: undefined,\n })\n }\n\n static isUnknownHTTPResponseError(\n error: unknown\n ): error is UnknownHTTPResponseError {\n return isNotionClientErrorWithCode(error, {\n [ClientErrorCode.ResponseError]: true,\n })\n }\n}\n\nconst apiErrorCodes: { [C in APIErrorCode]: true } = {\n [APIErrorCode.Unauthorized]: true,\n [APIErrorCode.RestrictedResource]: true,\n [APIErrorCode.ObjectNotFound]: true,\n [APIErrorCode.RateLimited]: true,\n [APIErrorCode.InvalidJSON]: true,\n [APIErrorCode.InvalidRequestURL]: true,\n [APIErrorCode.InvalidRequest]: true,\n [APIErrorCode.ValidationError]: true,\n [APIErrorCode.ConflictError]: true,\n [APIErrorCode.InternalServerError]: true,\n [APIErrorCode.ServiceUnavailable]: true,\n}\n\n/**\n * A response from the API indicating a problem.\n * Use the `code` property to handle various kinds of errors. All its possible values are in `APIErrorCode`.\n */\nexport class APIResponseError extends HTTPResponseError<APIErrorCode> {\n readonly name = \"APIResponseError\"\n readonly request_id: string | undefined\n\n static isAPIResponseError(error: unknown): error is APIResponseError {\n return isNotionClientErrorWithCode(error, apiErrorCodes)\n }\n}\n\nexport function buildRequestError(\n response: SupportedResponse,\n bodyText: string\n): APIResponseError | UnknownHTTPResponseError {\n const apiErrorResponseBody = parseAPIErrorResponseBody(bodyText)\n if (apiErrorResponseBody !== undefined) {\n return new APIResponseError({\n code: apiErrorResponseBody.code,\n message: apiErrorResponseBody.message,\n headers: response.headers,\n status: response.status,\n rawBodyText: bodyText,\n additional_data: apiErrorResponseBody.additional_data,\n request_id: apiErrorResponseBody.request_id,\n })\n }\n return new UnknownHTTPResponseError({\n message: undefined,\n headers: response.headers,\n status: response.status,\n rawBodyText: bodyText,\n })\n}\n\nfunction parseAPIErrorResponseBody(body: string):\n | {\n code: APIErrorCode\n message: string\n additional_data: AdditionalData | undefined\n request_id: string | undefined\n }\n | undefined {\n if (typeof body !== \"string\") {\n return\n }\n\n let parsed: unknown\n try {\n parsed = JSON.parse(body)\n } catch (parseError) {\n return\n }\n\n if (\n !isObject(parsed) ||\n typeof parsed[\"message\"] !== \"string\" ||\n !isAPIErrorCode(parsed[\"code\"])\n ) {\n return\n }\n\n const additional_data = parsed[\"additional_data\"] as\n | AdditionalData\n | undefined\n const request_id = parsed[\"request_id\"] as string | undefined\n\n return {\n ...parsed,\n code: parsed[\"code\"],\n message: parsed[\"message\"],\n additional_data,\n request_id,\n }\n}\n\nfunction isAPIErrorCode(code: unknown): code is APIErrorCode {\n return typeof code === \"string\" && code in apiErrorCodes\n}\n"]}
@@ -9,6 +9,6 @@
9
9
  export type { AppendBlockChildrenParameters, AppendBlockChildrenResponse, AudioBlockObjectResponse, BlockObjectRequest, BlockObjectResponse, BookmarkBlockObjectResponse, BotUserObjectResponse, BreadcrumbBlockObjectResponse, BulletedListItemBlockObjectResponse, ButtonPropertyItemObjectResponse, CalloutBlockObjectResponse, CheckboxPropertyItemObjectResponse, ChildDatabaseBlockObjectResponse, ChildPageBlockObjectResponse, CodeBlockObjectResponse, ColumnBlockObjectResponse, ColumnListBlockObjectResponse, CommentObjectResponse, CompleteFileUploadParameters, CompleteFileUploadResponse, CreateCommentParameters, CreateCommentResponse, CreateDatabaseParameters, CreateDatabaseResponse, CreateDataSourceParameters, CreateDataSourceResponse, CreatedByPropertyItemObjectResponse, CreatedTimePropertyItemObjectResponse, CreateFileUploadParameters, CreateFileUploadResponse, CreatePageParameters, CreatePageResponse, DatabaseObjectResponse, DataSourceObjectResponse, DatePropertyItemObjectResponse, DeleteBlockParameters, DeleteBlockResponse, DividerBlockObjectResponse, EmailPropertyItemObjectResponse, EmbedBlockObjectResponse, EquationBlockObjectResponse, EquationRichTextItemResponse, FileBlockObjectResponse, FilesPropertyItemObjectResponse, FileUploadObjectResponse, FormulaPropertyItemObjectResponse, GetBlockParameters, GetBlockResponse, GetCommentParameters, GetCommentResponse, GetDatabaseParameters, GetDatabaseResponse, GetDataSourceParameters, GetDataSourceResponse, GetFileUploadParameters, GetFileUploadResponse, GetPageParameters, GetPagePropertyParameters, GetPagePropertyResponse, GetPageResponse, GetSelfParameters, GetSelfResponse, GetUserParameters, GetUserResponse, GroupObjectResponse, Heading1BlockObjectResponse, Heading2BlockObjectResponse, Heading3BlockObjectResponse, ImageBlockObjectResponse, LastEditedByPropertyItemObjectResponse, LastEditedTimePropertyItemObjectResponse, LinkPreviewBlockObjectResponse, LinkToPageBlockObjectResponse, ListBlockChildrenParameters, ListBlockChildrenResponse, ListCommentsParameters, ListCommentsResponse, ListFileUploadsParameters, ListFileUploadsResponse, ListUsersParameters, ListUsersResponse, MentionRichTextItemResponse, MovePageParameters, MovePageResponse, MultiSelectPropertyItemObjectResponse, NumberedListItemBlockObjectResponse, NumberPropertyItemObjectResponse, OauthIntrospectParameters, OauthIntrospectResponse, OauthRevokeParameters, OauthRevokeResponse, OauthTokenParameters, OauthTokenResponse, PageObjectResponse, ParagraphBlockObjectResponse, PartialBlockObjectResponse, PartialCommentObjectResponse, PartialDatabaseObjectResponse, PartialDataSourceObjectResponse, PartialPageObjectResponse, PartialUserObjectResponse, PdfBlockObjectResponse, PeoplePropertyItemObjectResponse, PersonUserObjectResponse, PhoneNumberPropertyItemObjectResponse, PropertyItemListResponse, PropertyItemObjectResponse, QueryDataSourceParameters, QueryDataSourceResponse, QuoteBlockObjectResponse, RelationPropertyItemObjectResponse, RichTextItemResponse, RichTextPropertyItemObjectResponse, RollupPropertyItemObjectResponse, SearchParameters, SearchResponse, SelectPropertyItemObjectResponse, SendFileUploadParameters, SendFileUploadResponse, StatusPropertyItemObjectResponse, SyncedBlockBlockObjectResponse, TableBlockObjectResponse, TableOfContentsBlockObjectResponse, TableRowBlockObjectResponse, TemplateBlockObjectResponse, TextRichTextItemResponse, TitlePropertyItemObjectResponse, ToDoBlockObjectResponse, ToggleBlockObjectResponse, UniqueIdPropertyItemObjectResponse, UnsupportedBlockObjectResponse, UpdateBlockParameters, UpdateBlockResponse, UpdateDatabaseParameters, UpdateDatabaseResponse, UpdateDataSourceParameters, UpdateDataSourceResponse, UpdatePageParameters, UpdatePageResponse, UrlPropertyItemObjectResponse, UserObjectResponse, VerificationPropertyItemObjectResponse, VideoBlockObjectResponse, } from "./api-endpoints";
10
10
  export { default as Client } from "./Client";
11
11
  export { LogLevel, Logger } from "./logging";
12
- export { NotionErrorCode, APIErrorCode, ClientErrorCode, NotionClientError, APIResponseError, UnknownHTTPResponseError, RequestTimeoutError, isNotionClientError, } from "./errors";
12
+ export { NotionErrorCode, APIErrorCode, ClientErrorCode, NotionClientError, APIResponseError, UnknownHTTPResponseError, RequestTimeoutError, InvalidPathParameterError, isNotionClientError, } from "./errors";
13
13
  export { collectPaginatedAPI, iteratePaginatedAPI, collectDataSourceTemplates, iterateDataSourceTemplates, isFullBlock, isFullDataSource, isFullDatabase, isFullPage, isFullUser, isFullComment, isFullPageOrDataSource, extractNotionId, extractDatabaseId, extractPageId, extractBlockId, } from "./helpers";
14
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EACV,6BAA6B,EAC7B,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,qBAAqB,EACrB,6BAA6B,EAC7B,mCAAmC,EACnC,gCAAgC,EAChC,0BAA0B,EAC1B,kCAAkC,EAClC,gCAAgC,EAChC,4BAA4B,EAC5B,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC7B,qBAAqB,EACrB,4BAA4B,EAC5B,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,mCAAmC,EACnC,qCAAqC,EACrC,0BAA0B,EAC1B,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,8BAA8B,EAC9B,qBAAqB,EACrB,mBAAmB,EACnB,0BAA0B,EAC1B,+BAA+B,EAC/B,wBAAwB,EACxB,2BAA2B,EAC3B,4BAA4B,EAC5B,uBAAuB,EACvB,+BAA+B,EAC/B,wBAAwB,EACxB,iCAAiC,EACjC,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,mBAAmB,EACnB,uBAAuB,EACvB,qB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,kBAAkB,EAClB,6BAA6B,EAC7B,kBAAkB,EAClB,sCAAsC,EACtC,wBAAwB,GACzB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAEL,eAAe,EACf,YAAY,EACZ,eAAe,EAEf,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,EAEnB,mBAAmB,GACpB,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,0BAA0B,EAC1B,0BAA0B,EAC1B,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,UAAU,EACV,aAAa,EACb,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,cAAc,GACf,MAAM,WAAW,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,YAAY,EACV,6BAA6B,EAC7B,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,2BAA2B,EAC3B,qBAAqB,EACrB,6BAA6B,EAC7B,mCAAmC,EACnC,gCAAgC,EAChC,0BAA0B,EAC1B,kCAAkC,EAClC,gCAAgC,EAChC,4BAA4B,EAC5B,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC7B,qBAAqB,EACrB,4BAA4B,EAC5B,0BAA0B,EAC1B,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,mCAAmC,EACnC,qCAAqC,EACrC,0BAA0B,EAC1B,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,wBAAwB,EACxB,8BAA8B,EAC9B,qBAAqB,EACrB,mBAA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BAAwB,EACxB,kCAAkC,EAClC,2BAA2B,EAC3B,2BAA2B,EAC3B,wBAAwB,EACxB,+BAA+B,EAC/B,uBAAuB,EACvB,yBAAyB,EACzB,kCAAkC,EAClC,8BAA8B,EAC9B,qBAAqB,EACrB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,oBAAoB,EACpB,kBAAkB,EAClB,6BAA6B,EAC7B,kBAAkB,EAClB,sCAAsC,EACtC,wBAAwB,GACzB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,UAAU,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAC5C,OAAO,EAEL,eAAe,EACf,YAAY,EACZ,eAAe,EAEf,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,EAEzB,mBAAmB,GACpB,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,0BAA0B,EAC1B,0BAA0B,EAC1B,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,UAAU,EACV,aAAa,EACb,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,cAAc,GACf,MAAM,WAAW,CAAA"}
@@ -8,7 +8,7 @@
8
8
  * @packageDocumentation
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.extractBlockId = exports.extractPageId = exports.extractDatabaseId = exports.extractNotionId = exports.isFullPageOrDataSource = exports.isFullComment = exports.isFullUser = exports.isFullPage = exports.isFullDatabase = exports.isFullDataSource = exports.isFullBlock = exports.iterateDataSourceTemplates = exports.collectDataSourceTemplates = exports.iteratePaginatedAPI = exports.collectPaginatedAPI = exports.isNotionClientError = exports.RequestTimeoutError = exports.UnknownHTTPResponseError = exports.APIResponseError = exports.ClientErrorCode = exports.APIErrorCode = exports.LogLevel = exports.Client = void 0;
11
+ exports.extractBlockId = exports.extractPageId = exports.extractDatabaseId = exports.extractNotionId = exports.isFullPageOrDataSource = exports.isFullComment = exports.isFullUser = exports.isFullPage = exports.isFullDatabase = exports.isFullDataSource = exports.isFullBlock = exports.iterateDataSourceTemplates = exports.collectDataSourceTemplates = exports.iteratePaginatedAPI = exports.collectPaginatedAPI = exports.isNotionClientError = exports.InvalidPathParameterError = exports.RequestTimeoutError = exports.UnknownHTTPResponseError = exports.APIResponseError = exports.ClientErrorCode = exports.APIErrorCode = exports.LogLevel = exports.Client = void 0;
12
12
  var Client_1 = require("./Client");
13
13
  Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return Client_1.default; } });
14
14
  var logging_1 = require("./logging");
@@ -19,6 +19,7 @@ Object.defineProperty(exports, "ClientErrorCode", { enumerable: true, get: funct
19
19
  Object.defineProperty(exports, "APIResponseError", { enumerable: true, get: function () { return errors_1.APIResponseError; } });
20
20
  Object.defineProperty(exports, "UnknownHTTPResponseError", { enumerable: true, get: function () { return errors_1.UnknownHTTPResponseError; } });
21
21
  Object.defineProperty(exports, "RequestTimeoutError", { enumerable: true, get: function () { return errors_1.RequestTimeoutError; } });
22
+ Object.defineProperty(exports, "InvalidPathParameterError", { enumerable: true, get: function () { return errors_1.InvalidPathParameterError; } });
22
23
  // Error helpers
23
24
  Object.defineProperty(exports, "isNotionClientError", { enumerable: true, get: function () { return errors_1.isNotionClientError; } });
24
25
  var helpers_1 = require("./helpers");
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAmJH,mCAA4C;AAAnC,gGAAA,OAAO,OAAU;AAC1B,qCAA4C;AAAnC,mGAAA,QAAQ,OAAA;AACjB,mCAYiB;AATf,sGAAA,YAAY,OAAA;AACZ,yGAAA,eAAe,OAAA;AAGf,0GAAA,gBAAgB,OAAA;AAChB,kHAAA,wBAAwB,OAAA;AACxB,6GAAA,mBAAmB,OAAA;AACnB,gBAAgB;AAChB,6GAAA,mBAAmB,OAAA;AAErB,qCAgBkB;AAfhB,8GAAA,mBAAmB,OAAA;AACnB,8GAAA,mBAAmB,OAAA;AACnB,qHAAA,0BAA0B,OAAA;AAC1B,qHAAA,0BAA0B,OAAA;AAC1B,sGAAA,WAAW,OAAA;AACX,2GAAA,gBAAgB,OAAA;AAChB,yGAAA,cAAc,OAAA;AACd,qGAAA,UAAU,OAAA;AACV,qGAAA,UAAU,OAAA;AACV,wGAAA,aAAa,OAAA;AACb,iHAAA,sBAAsB,OAAA;AACtB,0GAAA,eAAe,OAAA;AACf,4GAAA,iBAAiB,OAAA;AACjB,wGAAA,aAAa,OAAA;AACb,yGAAA,cAAc,OAAA","sourcesContent":["/**\n * index.ts\n *\n * This file is the entry point for the Notion SDK.\n * It exports the Client class and all the API endpoints.\n *\n * @packageDocumentation\n */\n\nexport type {\n AppendBlockChildrenParameters,\n AppendBlockChildrenResponse,\n AudioBlockObjectResponse,\n BlockObjectRequest,\n BlockObjectResponse,\n BookmarkBlockObjectResponse,\n BotUserObjectResponse,\n BreadcrumbBlockObjectResponse,\n BulletedListItemBlockObjectResponse,\n ButtonPropertyItemObjectResponse,\n CalloutBlockObjectResponse,\n CheckboxPropertyItemObjectResponse,\n ChildDatabaseBlockObjectResponse,\n ChildPageBlockObjectResponse,\n CodeBlockObjectResponse,\n ColumnBlockObjectResponse,\n ColumnListBlockObjectResponse,\n CommentObjectResponse,\n CompleteFileUploadParameters,\n CompleteFileUploadResponse,\n CreateCommentParameters,\n CreateCommentResponse,\n CreateDatabaseParameters,\n CreateDatabaseResponse,\n CreateDataSourceParameters,\n CreateDataSourceResponse,\n CreatedByPropertyItemObjectResponse,\n CreatedTimePropertyItemObjectResponse,\n CreateFileUploadParameters,\n CreateFileUploadResponse,\n CreatePageParameters,\n CreatePageResponse,\n DatabaseObjectResponse,\n DataSourceObjectResponse,\n DatePropertyItemObjectResponse,\n DeleteBlockParameters,\n DeleteBlockResponse,\n DividerBlockObjectResponse,\n EmailPropertyItemObjectResponse,\n EmbedBlockObjectResponse,\n EquationBlockObjectResponse,\n EquationRichTextItemResponse,\n FileBlockObjectResponse,\n FilesPropertyItemObjectResponse,\n FileUploadObjectResponse,\n FormulaPropertyItemObjectResponse,\n GetBlockParameters,\n GetBlockResponse,\n GetCommentParameters,\n GetCommentResponse,\n GetDatabaseParameters,\n GetDatabaseResponse,\n GetDataSourceParameters,\n GetDataSourceResponse,\n GetFileUploadParameters,\n GetFileUploadResponse,\n GetPageParameters,\n GetPagePropertyParameters,\n GetPagePropertyResponse,\n GetPageResponse,\n GetSelfParameters,\n GetSelfResponse,\n GetUserParameters,\n GetUserResponse,\n GroupObjectResponse,\n Heading1BlockObjectResponse,\n Heading2BlockObjectResponse,\n Heading3BlockObjectResponse,\n ImageBlockObjectResponse,\n LastEditedByPropertyItemObjectResponse,\n LastEditedTimePropertyItemObjectResponse,\n LinkPreviewBlockObjectResponse,\n LinkToPageBlockObjectResponse,\n ListBlockChildrenParameters,\n ListBlockChildrenResponse,\n ListCommentsParameters,\n ListCommentsResponse,\n ListFileUploadsParameters,\n ListFileUploadsResponse,\n ListUsersParameters,\n ListUsersResponse,\n MentionRichTextItemResponse,\n MovePageParameters,\n MovePageResponse,\n MultiSelectPropertyItemObjectResponse,\n NumberedListItemBlockObjectResponse,\n NumberPropertyItemObjectResponse,\n OauthIntrospectParameters,\n OauthIntrospectResponse,\n OauthRevokeParameters,\n OauthRevokeResponse,\n OauthTokenParameters,\n OauthTokenResponse,\n PageObjectResponse,\n ParagraphBlockObjectResponse,\n PartialBlockObjectResponse,\n PartialCommentObjectResponse,\n PartialDatabaseObjectResponse,\n PartialDataSourceObjectResponse,\n PartialPageObjectResponse,\n PartialUserObjectResponse,\n PdfBlockObjectResponse,\n PeoplePropertyItemObjectResponse,\n PersonUserObjectResponse,\n PhoneNumberPropertyItemObjectResponse,\n PropertyItemListResponse,\n PropertyItemObjectResponse,\n QueryDataSourceParameters,\n QueryDataSourceResponse,\n QuoteBlockObjectResponse,\n RelationPropertyItemObjectResponse,\n RichTextItemResponse,\n RichTextPropertyItemObjectResponse,\n RollupPropertyItemObjectResponse,\n SearchParameters,\n SearchResponse,\n SelectPropertyItemObjectResponse,\n SendFileUploadParameters,\n SendFileUploadResponse,\n StatusPropertyItemObjectResponse,\n SyncedBlockBlockObjectResponse,\n TableBlockObjectResponse,\n TableOfContentsBlockObjectResponse,\n TableRowBlockObjectResponse,\n TemplateBlockObjectResponse,\n TextRichTextItemResponse,\n TitlePropertyItemObjectResponse,\n ToDoBlockObjectResponse,\n ToggleBlockObjectResponse,\n UniqueIdPropertyItemObjectResponse,\n UnsupportedBlockObjectResponse,\n UpdateBlockParameters,\n UpdateBlockResponse,\n UpdateDatabaseParameters,\n UpdateDatabaseResponse,\n UpdateDataSourceParameters,\n UpdateDataSourceResponse,\n UpdatePageParameters,\n UpdatePageResponse,\n UrlPropertyItemObjectResponse,\n UserObjectResponse,\n VerificationPropertyItemObjectResponse,\n VideoBlockObjectResponse,\n} from \"./api-endpoints\"\nexport { default as Client } from \"./Client\"\nexport { LogLevel, Logger } from \"./logging\"\nexport {\n // Error codes\n NotionErrorCode,\n APIErrorCode,\n ClientErrorCode,\n // Error types\n NotionClientError,\n APIResponseError,\n UnknownHTTPResponseError,\n RequestTimeoutError,\n // Error helpers\n isNotionClientError,\n} from \"./errors\"\nexport {\n collectPaginatedAPI,\n iteratePaginatedAPI,\n collectDataSourceTemplates,\n iterateDataSourceTemplates,\n isFullBlock,\n isFullDataSource,\n isFullDatabase,\n isFullPage,\n isFullUser,\n isFullComment,\n isFullPageOrDataSource,\n extractNotionId,\n extractDatabaseId,\n extractPageId,\n extractBlockId,\n} from \"./helpers\"\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAmJH,mCAA4C;AAAnC,gGAAA,OAAO,OAAU;AAC1B,qCAA4C;AAAnC,mGAAA,QAAQ,OAAA;AACjB,mCAaiB;AAVf,sGAAA,YAAY,OAAA;AACZ,yGAAA,eAAe,OAAA;AAGf,0GAAA,gBAAgB,OAAA;AAChB,kHAAA,wBAAwB,OAAA;AACxB,6GAAA,mBAAmB,OAAA;AACnB,mHAAA,yBAAyB,OAAA;AACzB,gBAAgB;AAChB,6GAAA,mBAAmB,OAAA;AAErB,qCAgBkB;AAfhB,8GAAA,mBAAmB,OAAA;AACnB,8GAAA,mBAAmB,OAAA;AACnB,qHAAA,0BAA0B,OAAA;AAC1B,qHAAA,0BAA0B,OAAA;AAC1B,sGAAA,WAAW,OAAA;AACX,2GAAA,gBAAgB,OAAA;AAChB,yGAAA,cAAc,OAAA;AACd,qGAAA,UAAU,OAAA;AACV,qGAAA,UAAU,OAAA;AACV,wGAAA,aAAa,OAAA;AACb,iHAAA,sBAAsB,OAAA;AACtB,0GAAA,eAAe,OAAA;AACf,4GAAA,iBAAiB,OAAA;AACjB,wGAAA,aAAa,OAAA;AACb,yGAAA,cAAc,OAAA","sourcesContent":["/**\n * index.ts\n *\n * This file is the entry point for the Notion SDK.\n * It exports the Client class and all the API endpoints.\n *\n * @packageDocumentation\n */\n\nexport type {\n AppendBlockChildrenParameters,\n AppendBlockChildrenResponse,\n AudioBlockObjectResponse,\n BlockObjectRequest,\n BlockObjectResponse,\n BookmarkBlockObjectResponse,\n BotUserObjectResponse,\n BreadcrumbBlockObjectResponse,\n BulletedListItemBlockObjectResponse,\n ButtonPropertyItemObjectResponse,\n CalloutBlockObjectResponse,\n CheckboxPropertyItemObjectResponse,\n ChildDatabaseBlockObjectResponse,\n ChildPageBlockObjectResponse,\n CodeBlockObjectResponse,\n ColumnBlockObjectResponse,\n ColumnListBlockObjectResponse,\n CommentObjectResponse,\n CompleteFileUploadParameters,\n CompleteFileUploadResponse,\n CreateCommentParameters,\n CreateCommentResponse,\n CreateDatabaseParameters,\n CreateDatabaseResponse,\n CreateDataSourceParameters,\n CreateDataSourceResponse,\n CreatedByPropertyItemObjectResponse,\n CreatedTimePropertyItemObjectResponse,\n CreateFileUploadParameters,\n CreateFileUploadResponse,\n CreatePageParameters,\n CreatePageResponse,\n DatabaseObjectResponse,\n DataSourceObjectResponse,\n DatePropertyItemObjectResponse,\n DeleteBlockParameters,\n DeleteBlockResponse,\n DividerBlockObjectResponse,\n EmailPropertyItemObjectResponse,\n EmbedBlockObjectResponse,\n EquationBlockObjectResponse,\n EquationRichTextItemResponse,\n FileBlockObjectResponse,\n FilesPropertyItemObjectResponse,\n FileUploadObjectResponse,\n FormulaPropertyItemObjectResponse,\n GetBlockParameters,\n GetBlockResponse,\n GetCommentParameters,\n GetCommentResponse,\n GetDatabaseParameters,\n GetDatabaseResponse,\n GetDataSourceParameters,\n GetDataSourceResponse,\n GetFileUploadParameters,\n GetFileUploadResponse,\n GetPageParameters,\n GetPagePropertyParameters,\n GetPagePropertyResponse,\n GetPageResponse,\n GetSelfParameters,\n GetSelfResponse,\n GetUserParameters,\n GetUserResponse,\n GroupObjectResponse,\n Heading1BlockObjectResponse,\n Heading2BlockObjectResponse,\n Heading3BlockObjectResponse,\n ImageBlockObjectResponse,\n LastEditedByPropertyItemObjectResponse,\n LastEditedTimePropertyItemObjectResponse,\n LinkPreviewBlockObjectResponse,\n LinkToPageBlockObjectResponse,\n ListBlockChildrenParameters,\n ListBlockChildrenResponse,\n ListCommentsParameters,\n ListCommentsResponse,\n ListFileUploadsParameters,\n ListFileUploadsResponse,\n ListUsersParameters,\n ListUsersResponse,\n MentionRichTextItemResponse,\n MovePageParameters,\n MovePageResponse,\n MultiSelectPropertyItemObjectResponse,\n NumberedListItemBlockObjectResponse,\n NumberPropertyItemObjectResponse,\n OauthIntrospectParameters,\n OauthIntrospectResponse,\n OauthRevokeParameters,\n OauthRevokeResponse,\n OauthTokenParameters,\n OauthTokenResponse,\n PageObjectResponse,\n ParagraphBlockObjectResponse,\n PartialBlockObjectResponse,\n PartialCommentObjectResponse,\n PartialDatabaseObjectResponse,\n PartialDataSourceObjectResponse,\n PartialPageObjectResponse,\n PartialUserObjectResponse,\n PdfBlockObjectResponse,\n PeoplePropertyItemObjectResponse,\n PersonUserObjectResponse,\n PhoneNumberPropertyItemObjectResponse,\n PropertyItemListResponse,\n PropertyItemObjectResponse,\n QueryDataSourceParameters,\n QueryDataSourceResponse,\n QuoteBlockObjectResponse,\n RelationPropertyItemObjectResponse,\n RichTextItemResponse,\n RichTextPropertyItemObjectResponse,\n RollupPropertyItemObjectResponse,\n SearchParameters,\n SearchResponse,\n SelectPropertyItemObjectResponse,\n SendFileUploadParameters,\n SendFileUploadResponse,\n StatusPropertyItemObjectResponse,\n SyncedBlockBlockObjectResponse,\n TableBlockObjectResponse,\n TableOfContentsBlockObjectResponse,\n TableRowBlockObjectResponse,\n TemplateBlockObjectResponse,\n TextRichTextItemResponse,\n TitlePropertyItemObjectResponse,\n ToDoBlockObjectResponse,\n ToggleBlockObjectResponse,\n UniqueIdPropertyItemObjectResponse,\n UnsupportedBlockObjectResponse,\n UpdateBlockParameters,\n UpdateBlockResponse,\n UpdateDatabaseParameters,\n UpdateDatabaseResponse,\n UpdateDataSourceParameters,\n UpdateDataSourceResponse,\n UpdatePageParameters,\n UpdatePageResponse,\n UrlPropertyItemObjectResponse,\n UserObjectResponse,\n VerificationPropertyItemObjectResponse,\n VideoBlockObjectResponse,\n} from \"./api-endpoints\"\nexport { default as Client } from \"./Client\"\nexport { LogLevel, Logger } from \"./logging\"\nexport {\n // Error codes\n NotionErrorCode,\n APIErrorCode,\n ClientErrorCode,\n // Error types\n NotionClientError,\n APIResponseError,\n UnknownHTTPResponseError,\n RequestTimeoutError,\n InvalidPathParameterError,\n // Error helpers\n isNotionClientError,\n} from \"./errors\"\nexport {\n collectPaginatedAPI,\n iteratePaginatedAPI,\n collectDataSourceTemplates,\n iterateDataSourceTemplates,\n isFullBlock,\n isFullDataSource,\n isFullDatabase,\n isFullPage,\n isFullUser,\n isFullComment,\n isFullPageOrDataSource,\n extractNotionId,\n extractDatabaseId,\n extractPageId,\n extractBlockId,\n} from \"./helpers\"\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/client",
3
- "version": "5.8.0",
3
+ "version": "5.9.0",
4
4
  "description": "A simple and easy to use client for the Notion API",
5
5
  "engines": {
6
6
  "node": ">=18"