@notionhq/client 2.2.1 → 2.2.3
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.
- package/README.md +1 -1
- package/build/package.json +4 -4
- package/build/src/Client.d.ts +3 -3
- package/build/src/Client.d.ts.map +1 -1
- package/build/src/Client.js +6 -1
- package/build/src/Client.js.map +1 -1
- package/build/src/api-endpoints.d.ts +216 -208
- package/build/src/api-endpoints.d.ts.map +1 -1
- package/build/src/api-endpoints.js +2 -2
- package/build/src/api-endpoints.js.map +1 -1
- package/build/src/errors.d.ts +3 -3
- package/build/src/errors.d.ts.map +1 -1
- package/build/src/fetch-types.d.ts +7 -7
- package/build/src/fetch-types.d.ts.map +1 -1
- package/build/src/type-utils.d.ts +1 -1
- package/build/src/type-utils.d.ts.map +1 -1
- package/build/src/utils.d.ts +2 -2
- package/build/src/utils.d.ts.map +1 -1
- package/build/src/utils.js.map +1 -1
- package/package.json +4 -4
package/build/src/errors.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export declare enum ClientErrorCode {
|
|
|
25
25
|
/**
|
|
26
26
|
* Error codes on errors thrown by the `Client`.
|
|
27
27
|
*/
|
|
28
|
-
export
|
|
28
|
+
export type NotionErrorCode = APIErrorCode | ClientErrorCode;
|
|
29
29
|
/**
|
|
30
30
|
* Base error type.
|
|
31
31
|
*/
|
|
@@ -35,7 +35,7 @@ declare abstract class NotionClientErrorBase<Code extends NotionErrorCode> exten
|
|
|
35
35
|
/**
|
|
36
36
|
* Error type that encompasses all the kinds of errors that the Notion client will throw.
|
|
37
37
|
*/
|
|
38
|
-
export
|
|
38
|
+
export type NotionClientError = RequestTimeoutError | UnknownHTTPResponseError | APIResponseError;
|
|
39
39
|
/**
|
|
40
40
|
* @param error any value, usually a caught error.
|
|
41
41
|
* @returns `true` if error is a `NotionClientError`.
|
|
@@ -51,7 +51,7 @@ export declare class RequestTimeoutError extends NotionClientErrorBase<ClientErr
|
|
|
51
51
|
static isRequestTimeoutError(error: unknown): error is RequestTimeoutError;
|
|
52
52
|
static rejectAfterTimeout<T>(promise: Promise<T>, timeoutMS: number): Promise<T>;
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
type HTTPResponseErrorCode = ClientErrorCode.ResponseError | APIErrorCode;
|
|
55
55
|
declare class HTTPResponseError<Code extends HTTPResponseErrorCode> extends NotionClientErrorBase<Code> {
|
|
56
56
|
readonly name: string;
|
|
57
57
|
readonly code: 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,
|
|
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;AAC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;QAChB,IAAI,EAAE,IAAI,CAAA;QACV,MAAM,EAAE,MAAM,CAAA;QACd,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAA;QACrC,WAAW,EAAE,MAAM,CAAA;KACpB;CAQF;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;IAUD,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;IAElC,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,CAiB7C"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/// <reference lib="dom" />
|
|
2
2
|
import type { RequestInit as NodeRequestInit, Response as NodeResponse } from "node-fetch";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
7
|
-
export
|
|
3
|
+
type FetchFn = typeof fetch;
|
|
4
|
+
type FetchResponse = Awaited<ReturnType<FetchFn>>;
|
|
5
|
+
type RequestInit = NonNullable<Parameters<FetchFn>[1]>;
|
|
6
|
+
export type SupportedRequestInfo = string;
|
|
7
|
+
export type SupportedRequestInit = {
|
|
8
8
|
agent?: NodeRequestInit["agent"];
|
|
9
9
|
body?: NonNullable<RequestInit["body"]> & NonNullable<NodeRequestInit["body"]>;
|
|
10
10
|
headers?: NonNullable<RequestInit["headers"]> & NonNullable<NodeRequestInit["headers"]>;
|
|
11
11
|
method?: RequestInit["method"];
|
|
12
12
|
redirect?: RequestInit["redirect"];
|
|
13
13
|
};
|
|
14
|
-
export
|
|
15
|
-
export
|
|
14
|
+
export type SupportedResponse = FetchResponse | NodeResponse;
|
|
15
|
+
export type SupportedFetch = (url: SupportedRequestInfo, init?: SupportedRequestInit) => Promise<SupportedResponse>;
|
|
16
16
|
export {};
|
|
17
17
|
//# sourceMappingURL=fetch-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch-types.d.ts","sourceRoot":"","sources":["../../src/fetch-types.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EACV,WAAW,IAAI,eAAe,EAC9B,QAAQ,IAAI,YAAY,EACzB,MAAM,YAAY,CAAA;AAEnB,
|
|
1
|
+
{"version":3,"file":"fetch-types.d.ts","sourceRoot":"","sources":["../../src/fetch-types.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EACV,WAAW,IAAI,eAAe,EAC9B,QAAQ,IAAI,YAAY,EACzB,MAAM,YAAY,CAAA;AAEnB,KAAK,OAAO,GAAG,OAAO,KAAK,CAAA;AAC3B,KAAK,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAA;AAEjD,KAAK,WAAW,GAAG,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAEtD,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAA;AAGzC,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,WAAW,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAA;IAC9E,OAAO,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,GAC3C,WAAW,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAA;IACzC,MAAM,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAA;IAC9B,QAAQ,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,CAAA;CACnC,CAAA;AAGD,MAAM,MAAM,iBAAiB,GAAG,aAAa,GAAG,YAAY,CAAA;AAE5D,MAAM,MAAM,cAAc,GAAG,CAC3B,GAAG,EAAE,oBAAoB,EACzB,IAAI,CAAC,EAAE,oBAAoB,KACxB,OAAO,CAAC,iBAAiB,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-utils.d.ts","sourceRoot":"","sources":["../../src/type-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"type-utils.d.ts","sourceRoot":"","sources":["../../src/type-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA"}
|
package/build/src/utils.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* @param value The variable with no remaining values
|
|
7
7
|
*/
|
|
8
8
|
export declare function assertNever(value: never): never;
|
|
9
|
-
|
|
10
|
-
export declare function pick<O
|
|
9
|
+
type AllKeys<T> = T extends unknown ? keyof T : never;
|
|
10
|
+
export declare function pick<O, K extends AllKeys<O>>(base: O, keys: readonly K[]): Pick<O, K>;
|
|
11
11
|
export declare function isObject(o: unknown): o is Record<PropertyKey, unknown>;
|
|
12
12
|
export {};
|
|
13
13
|
//# sourceMappingURL=utils.d.ts.map
|
package/build/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAE/C;AAED,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAE/C;AAED,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,OAAO,GAAG,MAAM,CAAC,GAAG,KAAK,CAAA;AAErD,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,CAAC,CAAC,CAAC,EAC1C,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,SAAS,CAAC,EAAE,GACjB,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAGZ;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAEtE"}
|
package/build/src/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,KAAY;IACtC,MAAM,IAAI,KAAK,CAAC,wCAAwC,KAAK,EAAE,CAAC,CAAA;AAClE,CAAC;AAFD,kCAEC;AAID,SAAgB,IAAI,CAClB,IAAO,EACP,IAAkB;IAElB,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAG,GAAG,CAAC,CAAC,CAAC,CAAA;IACnD,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;AACpC,CAAC;AAND,oBAMC;AAED,SAAgB,QAAQ,CAAC,CAAU;IACjC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAA;AAC5C,CAAC;AAFD,4BAEC","sourcesContent":["/**\n * Utility for enforcing exhaustiveness checks in the type system.\n *\n * @see https://basarat.gitbook.io/typescript/type-system/discriminated-unions#throw-in-exhaustive-checks\n *\n * @param value The variable with no remaining values\n */\nexport function assertNever(value: never): never {\n throw new Error(`Unexpected value should never occur: ${value}`)\n}\n\ntype AllKeys<T> = T extends unknown ? keyof T : never\n\nexport function pick<O
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,KAAY;IACtC,MAAM,IAAI,KAAK,CAAC,wCAAwC,KAAK,EAAE,CAAC,CAAA;AAClE,CAAC;AAFD,kCAEC;AAID,SAAgB,IAAI,CAClB,IAAO,EACP,IAAkB;IAElB,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAG,GAAG,CAAC,CAAC,CAAC,CAAA;IACnD,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;AACpC,CAAC;AAND,oBAMC;AAED,SAAgB,QAAQ,CAAC,CAAU;IACjC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,CAAA;AAC5C,CAAC;AAFD,4BAEC","sourcesContent":["/**\n * Utility for enforcing exhaustiveness checks in the type system.\n *\n * @see https://basarat.gitbook.io/typescript/type-system/discriminated-unions#throw-in-exhaustive-checks\n *\n * @param value The variable with no remaining values\n */\nexport function assertNever(value: never): never {\n throw new Error(`Unexpected value should never occur: ${value}`)\n}\n\ntype AllKeys<T> = T extends unknown ? keyof T : never\n\nexport function pick<O, K extends AllKeys<O>>(\n base: O,\n keys: readonly K[]\n): Pick<O, K> {\n const entries = keys.map(key => [key, base?.[key]])\n return Object.fromEntries(entries)\n}\n\nexport function isObject(o: unknown): o is Record<PropertyKey, unknown> {\n return typeof o === \"object\" && o !== null\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@notionhq/client",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "A simple and easy to use client for the Notion API",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=12"
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@types/jest": "^28.1.4",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
49
|
-
"@typescript-eslint/parser": "^
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^5.39.0",
|
|
49
|
+
"@typescript-eslint/parser": "^5.39.0",
|
|
50
50
|
"cspell": "^5.4.1",
|
|
51
51
|
"eslint": "^7.24.0",
|
|
52
52
|
"jest": "^28.1.2",
|
|
53
53
|
"markdown-link-check": "^3.8.7",
|
|
54
54
|
"prettier": "^2.3.0",
|
|
55
55
|
"ts-jest": "^28.0.5",
|
|
56
|
-
"typescript": "^4.
|
|
56
|
+
"typescript": "^4.8.4"
|
|
57
57
|
}
|
|
58
58
|
}
|