@notionhq/client 5.7.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.
@@ -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,eAAe,qBAAqB;IACpC,aAAa,mBAAmB;IAChC,mBAAmB,0BAA0B;IAC7C,kBAAkB,wBAAwB;CAC3C;AAED;;GAEG;AACH,oBAAY,eAAe;IACzB,cAAc,oCAAoC;IAClD,aAAa,mCAAmC;CACjD;AAED;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,YAAY,GAAG,eAAe,CAAA;AAE5D;;GAEG;AACH,uBAAe,qBAAqB,CAClC,IAAI,SAAS,eAAe,CAC5B,SAAQ,KAAK;IACb,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,mBAAmB,GACnB,wBAAwB,GACxB,gBAAgB,CAAA;AAapB;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,iBAAiB,CAE5B;AAeD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,qBAAqB,CAAC,eAAe,CAAC,cAAc,CAAC;IAC5F,QAAQ,CAAC,IAAI,kCAAiC;IAC9C,QAAQ,CAAC,IAAI,yBAAwB;gBAEzB,OAAO,SAAwC;IAI3D,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG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qB;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,IA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;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}\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,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,eAIX;AAJD,WAAY,eAAe;IACzB,qEAAkD,CAAA;IAClD,mEAAgD,CAAA;IAChD,kFAA+D,CAAA;AACjE,CAAC,EAJW,eAAe,+BAAf,eAAe,QAI1B;AAOD;;GAEG;AACH,MAAe,qBAEb,SAAQ,KAAK;CAEd;AAyBD;;;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,CAA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,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,IAAI,wBAAwB,CAAC;QAClC,OAAO,EAAE,SAAS;QAClB,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,WAAW,EAAE,QAAQ;KACtB,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,yBAAyB,CAAC,IAAY;IAQ7C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAM;IACR,CAAC;IAED,IAAI,MAAe,CAAA;IACnB,IAAI,CAAC;QACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,UAAU,EAAE,CAAC;QACpB,OAAM;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,qBAAq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B,0BAA0B,EAC1B,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,kCAAkC,EAClC,oBAAoB,EACpB,kCAAkC,EAClC,gCAAgC,EAChC,gBAAgB,EAChB,cAAc,EACd,gCAAgC,EAChC,wBAAwB,EACxB,sBAAsB,EACtB,gCAAgC,EAChC,8BAA8B,EAC9B,wBAAwB,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,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,EAC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Aa,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.7.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"