@notionhq/client 1.0.3 → 1.0.4

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": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "A simple and easy to use client for the Notion API",
5
5
  "engines": {
6
6
  "node": ">=12"
@@ -41,8 +41,8 @@ class Client {
41
41
  return this.request({
42
42
  path: api_endpoints_1.getBlock.path(args),
43
43
  method: api_endpoints_1.getBlock.method,
44
- query: helpers_1.pick(args, api_endpoints_1.getBlock.queryParams),
45
- body: helpers_1.pick(args, api_endpoints_1.getBlock.bodyParams),
44
+ query: (0, helpers_1.pick)(args, api_endpoints_1.getBlock.queryParams),
45
+ body: (0, helpers_1.pick)(args, api_endpoints_1.getBlock.bodyParams),
46
46
  auth: args === null || args === void 0 ? void 0 : args.auth,
47
47
  });
48
48
  },
@@ -53,8 +53,8 @@ class Client {
53
53
  return this.request({
54
54
  path: api_endpoints_1.updateBlock.path(args),
55
55
  method: api_endpoints_1.updateBlock.method,
56
- query: helpers_1.pick(args, api_endpoints_1.updateBlock.queryParams),
57
- body: helpers_1.pick(args, api_endpoints_1.updateBlock.bodyParams),
56
+ query: (0, helpers_1.pick)(args, api_endpoints_1.updateBlock.queryParams),
57
+ body: (0, helpers_1.pick)(args, api_endpoints_1.updateBlock.bodyParams),
58
58
  auth: args === null || args === void 0 ? void 0 : args.auth,
59
59
  });
60
60
  },
@@ -65,8 +65,8 @@ class Client {
65
65
  return this.request({
66
66
  path: api_endpoints_1.deleteBlock.path(args),
67
67
  method: api_endpoints_1.deleteBlock.method,
68
- query: helpers_1.pick(args, api_endpoints_1.deleteBlock.queryParams),
69
- body: helpers_1.pick(args, api_endpoints_1.deleteBlock.bodyParams),
68
+ query: (0, helpers_1.pick)(args, api_endpoints_1.deleteBlock.queryParams),
69
+ body: (0, helpers_1.pick)(args, api_endpoints_1.deleteBlock.bodyParams),
70
70
  auth: args === null || args === void 0 ? void 0 : args.auth,
71
71
  });
72
72
  },
@@ -78,8 +78,8 @@ class Client {
78
78
  return this.request({
79
79
  path: api_endpoints_1.appendBlockChildren.path(args),
80
80
  method: api_endpoints_1.appendBlockChildren.method,
81
- query: helpers_1.pick(args, api_endpoints_1.appendBlockChildren.queryParams),
82
- body: helpers_1.pick(args, api_endpoints_1.appendBlockChildren.bodyParams),
81
+ query: (0, helpers_1.pick)(args, api_endpoints_1.appendBlockChildren.queryParams),
82
+ body: (0, helpers_1.pick)(args, api_endpoints_1.appendBlockChildren.bodyParams),
83
83
  auth: args === null || args === void 0 ? void 0 : args.auth,
84
84
  });
85
85
  },
@@ -90,8 +90,8 @@ class Client {
90
90
  return this.request({
91
91
  path: api_endpoints_1.listBlockChildren.path(args),
92
92
  method: api_endpoints_1.listBlockChildren.method,
93
- query: helpers_1.pick(args, api_endpoints_1.listBlockChildren.queryParams),
94
- body: helpers_1.pick(args, api_endpoints_1.listBlockChildren.bodyParams),
93
+ query: (0, helpers_1.pick)(args, api_endpoints_1.listBlockChildren.queryParams),
94
+ body: (0, helpers_1.pick)(args, api_endpoints_1.listBlockChildren.bodyParams),
95
95
  auth: args === null || args === void 0 ? void 0 : args.auth,
96
96
  });
97
97
  },
@@ -107,8 +107,8 @@ class Client {
107
107
  return this.request({
108
108
  path: api_endpoints_1.listDatabases.path(),
109
109
  method: api_endpoints_1.listDatabases.method,
110
- query: helpers_1.pick(args, api_endpoints_1.listDatabases.queryParams),
111
- body: helpers_1.pick(args, api_endpoints_1.listDatabases.bodyParams),
110
+ query: (0, helpers_1.pick)(args, api_endpoints_1.listDatabases.queryParams),
111
+ body: (0, helpers_1.pick)(args, api_endpoints_1.listDatabases.bodyParams),
112
112
  auth: args === null || args === void 0 ? void 0 : args.auth,
113
113
  });
114
114
  },
@@ -119,8 +119,8 @@ class Client {
119
119
  return this.request({
120
120
  path: api_endpoints_1.getDatabase.path(args),
121
121
  method: api_endpoints_1.getDatabase.method,
122
- query: helpers_1.pick(args, api_endpoints_1.getDatabase.queryParams),
123
- body: helpers_1.pick(args, api_endpoints_1.getDatabase.bodyParams),
122
+ query: (0, helpers_1.pick)(args, api_endpoints_1.getDatabase.queryParams),
123
+ body: (0, helpers_1.pick)(args, api_endpoints_1.getDatabase.bodyParams),
124
124
  auth: args === null || args === void 0 ? void 0 : args.auth,
125
125
  });
126
126
  },
@@ -131,8 +131,8 @@ class Client {
131
131
  return this.request({
132
132
  path: api_endpoints_1.queryDatabase.path(args),
133
133
  method: api_endpoints_1.queryDatabase.method,
134
- query: helpers_1.pick(args, api_endpoints_1.queryDatabase.queryParams),
135
- body: helpers_1.pick(args, api_endpoints_1.queryDatabase.bodyParams),
134
+ query: (0, helpers_1.pick)(args, api_endpoints_1.queryDatabase.queryParams),
135
+ body: (0, helpers_1.pick)(args, api_endpoints_1.queryDatabase.bodyParams),
136
136
  auth: args === null || args === void 0 ? void 0 : args.auth,
137
137
  });
138
138
  },
@@ -143,8 +143,8 @@ class Client {
143
143
  return this.request({
144
144
  path: api_endpoints_1.createDatabase.path(),
145
145
  method: api_endpoints_1.createDatabase.method,
146
- query: helpers_1.pick(args, api_endpoints_1.createDatabase.queryParams),
147
- body: helpers_1.pick(args, api_endpoints_1.createDatabase.bodyParams),
146
+ query: (0, helpers_1.pick)(args, api_endpoints_1.createDatabase.queryParams),
147
+ body: (0, helpers_1.pick)(args, api_endpoints_1.createDatabase.bodyParams),
148
148
  auth: args === null || args === void 0 ? void 0 : args.auth,
149
149
  });
150
150
  },
@@ -155,8 +155,8 @@ class Client {
155
155
  return this.request({
156
156
  path: api_endpoints_1.updateDatabase.path(args),
157
157
  method: api_endpoints_1.updateDatabase.method,
158
- query: helpers_1.pick(args, api_endpoints_1.updateDatabase.queryParams),
159
- body: helpers_1.pick(args, api_endpoints_1.updateDatabase.bodyParams),
158
+ query: (0, helpers_1.pick)(args, api_endpoints_1.updateDatabase.queryParams),
159
+ body: (0, helpers_1.pick)(args, api_endpoints_1.updateDatabase.bodyParams),
160
160
  auth: args === null || args === void 0 ? void 0 : args.auth,
161
161
  });
162
162
  },
@@ -169,8 +169,8 @@ class Client {
169
169
  return this.request({
170
170
  path: api_endpoints_1.createPage.path(),
171
171
  method: api_endpoints_1.createPage.method,
172
- query: helpers_1.pick(args, api_endpoints_1.createPage.queryParams),
173
- body: helpers_1.pick(args, api_endpoints_1.createPage.bodyParams),
172
+ query: (0, helpers_1.pick)(args, api_endpoints_1.createPage.queryParams),
173
+ body: (0, helpers_1.pick)(args, api_endpoints_1.createPage.bodyParams),
174
174
  auth: args === null || args === void 0 ? void 0 : args.auth,
175
175
  });
176
176
  },
@@ -181,8 +181,8 @@ class Client {
181
181
  return this.request({
182
182
  path: api_endpoints_1.getPage.path(args),
183
183
  method: api_endpoints_1.getPage.method,
184
- query: helpers_1.pick(args, api_endpoints_1.getPage.queryParams),
185
- body: helpers_1.pick(args, api_endpoints_1.getPage.bodyParams),
184
+ query: (0, helpers_1.pick)(args, api_endpoints_1.getPage.queryParams),
185
+ body: (0, helpers_1.pick)(args, api_endpoints_1.getPage.bodyParams),
186
186
  auth: args === null || args === void 0 ? void 0 : args.auth,
187
187
  });
188
188
  },
@@ -193,8 +193,8 @@ class Client {
193
193
  return this.request({
194
194
  path: api_endpoints_1.updatePage.path(args),
195
195
  method: api_endpoints_1.updatePage.method,
196
- query: helpers_1.pick(args, api_endpoints_1.updatePage.queryParams),
197
- body: helpers_1.pick(args, api_endpoints_1.updatePage.bodyParams),
196
+ query: (0, helpers_1.pick)(args, api_endpoints_1.updatePage.queryParams),
197
+ body: (0, helpers_1.pick)(args, api_endpoints_1.updatePage.bodyParams),
198
198
  auth: args === null || args === void 0 ? void 0 : args.auth,
199
199
  });
200
200
  },
@@ -206,8 +206,8 @@ class Client {
206
206
  return this.request({
207
207
  path: api_endpoints_1.getPageProperty.path(args),
208
208
  method: api_endpoints_1.getPageProperty.method,
209
- query: helpers_1.pick(args, api_endpoints_1.getPageProperty.queryParams),
210
- body: helpers_1.pick(args, api_endpoints_1.getPageProperty.bodyParams),
209
+ query: (0, helpers_1.pick)(args, api_endpoints_1.getPageProperty.queryParams),
210
+ body: (0, helpers_1.pick)(args, api_endpoints_1.getPageProperty.bodyParams),
211
211
  auth: args === null || args === void 0 ? void 0 : args.auth,
212
212
  });
213
213
  },
@@ -221,8 +221,8 @@ class Client {
221
221
  return this.request({
222
222
  path: api_endpoints_1.getUser.path(args),
223
223
  method: api_endpoints_1.getUser.method,
224
- query: helpers_1.pick(args, api_endpoints_1.getUser.queryParams),
225
- body: helpers_1.pick(args, api_endpoints_1.getUser.bodyParams),
224
+ query: (0, helpers_1.pick)(args, api_endpoints_1.getUser.queryParams),
225
+ body: (0, helpers_1.pick)(args, api_endpoints_1.getUser.bodyParams),
226
226
  auth: args === null || args === void 0 ? void 0 : args.auth,
227
227
  });
228
228
  },
@@ -233,8 +233,8 @@ class Client {
233
233
  return this.request({
234
234
  path: api_endpoints_1.listUsers.path(),
235
235
  method: api_endpoints_1.listUsers.method,
236
- query: helpers_1.pick(args, api_endpoints_1.listUsers.queryParams),
237
- body: helpers_1.pick(args, api_endpoints_1.listUsers.bodyParams),
236
+ query: (0, helpers_1.pick)(args, api_endpoints_1.listUsers.queryParams),
237
+ body: (0, helpers_1.pick)(args, api_endpoints_1.listUsers.bodyParams),
238
238
  auth: args === null || args === void 0 ? void 0 : args.auth,
239
239
  });
240
240
  },
@@ -245,15 +245,15 @@ class Client {
245
245
  return this.request({
246
246
  path: api_endpoints_1.getSelf.path(),
247
247
  method: api_endpoints_1.getSelf.method,
248
- query: helpers_1.pick(args, api_endpoints_1.getSelf.queryParams),
249
- body: helpers_1.pick(args, api_endpoints_1.getSelf.bodyParams),
248
+ query: (0, helpers_1.pick)(args, api_endpoints_1.getSelf.queryParams),
249
+ body: (0, helpers_1.pick)(args, api_endpoints_1.getSelf.bodyParams),
250
250
  auth: args === null || args === void 0 ? void 0 : args.auth,
251
251
  });
252
252
  },
253
253
  };
254
254
  __classPrivateFieldSet(this, _Client_auth, options === null || options === void 0 ? void 0 : options.auth, "f");
255
255
  __classPrivateFieldSet(this, _Client_logLevel, (_a = options === null || options === void 0 ? void 0 : options.logLevel) !== null && _a !== void 0 ? _a : logging_1.LogLevel.WARN, "f");
256
- __classPrivateFieldSet(this, _Client_logger, (_b = options === null || options === void 0 ? void 0 : options.logger) !== null && _b !== void 0 ? _b : logging_1.makeConsoleLogger(package_json_1.name), "f");
256
+ __classPrivateFieldSet(this, _Client_logger, (_b = options === null || options === void 0 ? void 0 : options.logger) !== null && _b !== void 0 ? _b : (0, logging_1.makeConsoleLogger)(package_json_1.name), "f");
257
257
  __classPrivateFieldSet(this, _Client_prefixUrl, ((_c = options === null || options === void 0 ? void 0 : options.baseUrl) !== null && _c !== void 0 ? _c : "https://api.notion.com") + "/v1/", "f");
258
258
  __classPrivateFieldSet(this, _Client_timeoutMs, (_d = options === null || options === void 0 ? void 0 : options.timeoutMs) !== null && _d !== void 0 ? _d : 60000, "f");
259
259
  __classPrivateFieldSet(this, _Client_notionVersion, (_e = options === null || options === void 0 ? void 0 : options.notionVersion) !== null && _e !== void 0 ? _e : Client.defaultNotionVersion, "f");
@@ -301,14 +301,14 @@ class Client {
301
301
  }), __classPrivateFieldGet(this, _Client_timeoutMs, "f"));
302
302
  const responseText = await response.text();
303
303
  if (!response.ok) {
304
- throw errors_1.buildRequestError(response, responseText);
304
+ throw (0, errors_1.buildRequestError)(response, responseText);
305
305
  }
306
306
  const responseJson = JSON.parse(responseText);
307
307
  this.log(logging_1.LogLevel.INFO, `request success`, { method, path });
308
308
  return responseJson;
309
309
  }
310
310
  catch (error) {
311
- if (!errors_1.isNotionClientError(error)) {
311
+ if (!(0, errors_1.isNotionClientError)(error)) {
312
312
  throw error;
313
313
  }
314
314
  // Log the error if it's one of our known error types
@@ -316,7 +316,7 @@ class Client {
316
316
  code: error.code,
317
317
  message: error.message,
318
318
  });
319
- if (errors_1.isHTTPResponseError(error)) {
319
+ if ((0, errors_1.isHTTPResponseError)(error)) {
320
320
  // The response body may contain sensitive information so it is logged separately at the DEBUG level
321
321
  this.log(logging_1.LogLevel.DEBUG, `failed response body`, {
322
322
  body: error.body,
@@ -332,8 +332,8 @@ class Client {
332
332
  return this.request({
333
333
  path: api_endpoints_1.search.path(),
334
334
  method: api_endpoints_1.search.method,
335
- query: helpers_1.pick(args, api_endpoints_1.search.queryParams),
336
- body: helpers_1.pick(args, api_endpoints_1.search.bodyParams),
335
+ query: (0, helpers_1.pick)(args, api_endpoints_1.search.queryParams),
336
+ body: (0, helpers_1.pick)(args, api_endpoints_1.search.bodyParams),
337
337
  auth: args === null || args === void 0 ? void 0 : args.auth,
338
338
  });
339
339
  }
@@ -344,7 +344,7 @@ class Client {
344
344
  * @param args Arguments to send to the console
345
345
  */
346
346
  log(level, message, extraInfo) {
347
- if (logging_1.logLevelSeverity(level) >= logging_1.logLevelSeverity(__classPrivateFieldGet(this, _Client_logLevel, "f"))) {
347
+ if ((0, logging_1.logLevelSeverity)(level) >= (0, logging_1.logLevelSeverity)(__classPrivateFieldGet(this, _Client_logLevel, "f"))) {
348
348
  __classPrivateFieldGet(this, _Client_logger, "f").call(this, level, message, extraInfo);
349
349
  }
350
350
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Client.js","sourceRoot":"","sources":["../../src/Client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,uCAKkB;AAClB,qCAKiB;AACjB,uCAAgC;AAChC,mDAuDwB;AACxB,2CAAkC;AAClC,kDAGwB;AAuBxB,MAAqB,MAAM;IAazB,YAAmB,OAAuB;;QAZ1C,+BAAc;QACd,mCAAmB;QACnB,iCAAe;QACf,oCAAkB;QAClB,oCAAkB;QAClB,wCAAsB;QACtB,gCAAsB;QACtB,gCAAyB;QACzB,oCAAkB;QAmGlB;;WAEG;QAEa,WAAM,GAAG;YACvB;;eAEG;YACH,QAAQ,EAAE,CACR,IAAkC,EACP,EAAE;gBAC7B,OAAO,IAAI,CAAC,OA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O,GAA2B,EAAE,CAAA;QAC1C,MAAM,eAAe,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,uBAAA,IAAI,oBAAM,CAAA;QAC1C,IAAI,eAAe,KAAK,SAAS,EAAE;YACjC,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,eAAe,EAAE,CAAA;SACvD;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;;AAhaH,yBAiaC;;AAtZiB,2BAAoB,GAAG,YAAY,CAAA","sourcesContent":["import type { Agent } from \"http\"\nimport {\n 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 \"./helpers\"\nimport {\n GetBlockParameters,\n GetBlockResponse,\n getBlock,\n UpdateBlockParameters,\n UpdateBlockResponse,\n updateBlock,\n DeleteBlockParameters,\n DeleteBlockResponse,\n deleteBlock,\n AppendBlockChildrenParameters,\n AppendBlockChildrenResponse,\n appendBlockChildren,\n ListBlockChildrenParameters,\n ListBlockChildrenResponse,\n listBlockChildren,\n ListDatabasesParameters,\n ListDatabasesResponse,\n listDatabases,\n GetDatabaseParameters,\n GetDatabaseResponse,\n getDatabase,\n QueryDatabaseParameters,\n QueryDatabaseResponse,\n queryDatabase,\n CreateDatabaseParameters,\n CreateDatabaseResponse,\n createDatabase,\n UpdateDatabaseParameters,\n UpdateDatabaseResponse,\n updateDatabase,\n CreatePageParameters,\n CreatePageResponse,\n createPage,\n GetPageParameters,\n GetPageResponse,\n getPage,\n UpdatePageParameters,\n UpdatePageResponse,\n updatePage,\n GetUserParameters,\n GetUserResponse,\n getUser,\n ListUsersParameters,\n ListUsersResponse,\n listUsers,\n SearchParameters,\n SearchResponse,\n search,\n GetSelfParameters,\n GetSelfResponse,\n getSelf,\n GetPagePropertyParameters,\n GetPagePropertyResponse,\n getPageProperty,\n} from \"./api-endpoints\"\nimport nodeFetch from \"node-fetch\"\nimport {\n version as PACKAGE_VERSION,\n name as PACKAGE_NAME,\n} from \"../package.json\"\nimport { 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\nexport interface RequestParameters {\n path: string\n method: Method\n query?: QueryParams\n body?: Record<string, unknown>\n auth?: string\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 = \"2022-02-22\"\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 ?? nodeFetch\n this.#agent = options?.agent\n this.#userAgent = `notionhq-client/${PACKAGE_VERSION}`\n }\n\n /**\n * Sends a request.\n *\n * @param path\n * @param method\n * @param query\n * @param body\n * @returns\n */\n public async request<ResponseBody>({\n path,\n method,\n query,\n body,\n auth,\n }: RequestParameters): Promise<ResponseBody> {\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 url.searchParams.append(key, String(value))\n }\n }\n }\n\n const headers: Record<string, string> = {\n ...this.authAsHeaders(auth),\n \"Notion-Version\": this.#notionVersion,\n \"user-agent\": this.#userAgent,\n }\n\n if (bodyAsJsonString !== undefined) {\n headers[\"content-type\"] = \"application/json\"\n }\n try {\n const response = await RequestTimeoutError.rejectAfterTimeout(\n this.#fetch(url.toString(), {\n method,\n headers,\n body: bodyAsJsonString,\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`, { method, path })\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 })\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 * List databases\n *\n * @deprecated Please use `search`\n */\n list: (\n args: WithAuth<ListDatabasesParameters>\n ): Promise<ListDatabasesResponse> => {\n return this.request<ListDatabasesResponse>({\n path: listDatabases.path(),\n method: listDatabases.method,\n query: pick(args, listDatabases.queryParams),\n body: pick(args, listDatabases.bodyParams),\n auth: args?.auth,\n })\n },\n\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 * Query a database\n */\n query: (\n args: WithAuth<QueryDatabaseParameters>\n ): Promise<QueryDatabaseResponse> => {\n return this.request<QueryDatabaseResponse>({\n path: queryDatabase.path(args),\n method: queryDatabase.method,\n query: pick(args, queryDatabase.queryParams),\n body: pick(args, queryDatabase.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 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 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 /**\n * Search\n */\n public search(args: WithAuth<SearchParameters>): 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 /**\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> | URLSearchParams\n\ntype WithAuth<P> = P & { auth?: string }\n"]}
1
+ {"version":3,"file":"Client.js","sourceRoot":"","sources":["../../src/Client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,uCAKk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AI,EAAE;YACnB,MAAM,EAAE,sBAAM,CAAC,MAAM;YACrB,KAAK,EAAE,IAAA,cAAI,EAAC,IAAI,EAAE,sBAAM,CAAC,WAAW,CAAC;YACrC,IAAI,EAAE,IAAA,cAAI,EAAC,IAAI,EAAE,sBAAM,CAAC,UAAU,CAAC;YACnC,IAAI,EAAE,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI;SACjB,CAAC,CAAA;IACJ,CAAC;IAED;;;;;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;YAC/D,uBAAA,IAAI,sBAAQ,MAAZ,IAAI,EAAS,KAAK,EAAE,OAAO,EAAE,SAAS,CAAC,CAAA;SACxC;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;YACjC,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,eAAe,EAAE,CAAA;SACvD;QACD,OAAO,OAAO,CAAA;IAChB,CAAC;;AAhaH,yBAiaC;;AAtZiB,2BAAoB,GAAG,YAAY,CAAA","sourcesContent":["import type { Agent } from \"http\"\nimport {\n 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 \"./helpers\"\nimport {\n GetBlockParameters,\n GetBlockResponse,\n getBlock,\n UpdateBlockParameters,\n UpdateBlockResponse,\n updateBlock,\n DeleteBlockParameters,\n DeleteBlockResponse,\n deleteBlock,\n AppendBlockChildrenParameters,\n AppendBlockChildrenResponse,\n appendBlockChildren,\n ListBlockChildrenParameters,\n ListBlockChildrenResponse,\n listBlockChildren,\n ListDatabasesParameters,\n ListDatabasesResponse,\n listDatabases,\n GetDatabaseParameters,\n GetDatabaseResponse,\n getDatabase,\n QueryDatabaseParameters,\n QueryDatabaseResponse,\n queryDatabase,\n CreateDatabaseParameters,\n CreateDatabaseResponse,\n createDatabase,\n UpdateDatabaseParameters,\n UpdateDatabaseResponse,\n updateDatabase,\n CreatePageParameters,\n CreatePageResponse,\n createPage,\n GetPageParameters,\n GetPageResponse,\n getPage,\n UpdatePageParameters,\n UpdatePageResponse,\n updatePage,\n GetUserParameters,\n GetUserResponse,\n getUser,\n ListUsersParameters,\n ListUsersResponse,\n listUsers,\n SearchParameters,\n SearchResponse,\n search,\n GetSelfParameters,\n GetSelfResponse,\n getSelf,\n GetPagePropertyParameters,\n GetPagePropertyResponse,\n getPageProperty,\n} from \"./api-endpoints\"\nimport nodeFetch from \"node-fetch\"\nimport {\n version as PACKAGE_VERSION,\n name as PACKAGE_NAME,\n} from \"../package.json\"\nimport { 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\nexport interface RequestParameters {\n path: string\n method: Method\n query?: QueryParams\n body?: Record<string, unknown>\n auth?: string\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 = \"2022-02-22\"\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 ?? nodeFetch\n this.#agent = options?.agent\n this.#userAgent = `notionhq-client/${PACKAGE_VERSION}`\n }\n\n /**\n * Sends a request.\n *\n * @param path\n * @param method\n * @param query\n * @param body\n * @returns\n */\n public async request<ResponseBody>({\n path,\n method,\n query,\n body,\n auth,\n }: RequestParameters): Promise<ResponseBody> {\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 url.searchParams.append(key, String(value))\n }\n }\n }\n\n const headers: Record<string, string> = {\n ...this.authAsHeaders(auth),\n \"Notion-Version\": this.#notionVersion,\n \"user-agent\": this.#userAgent,\n }\n\n if (bodyAsJsonString !== undefined) {\n headers[\"content-type\"] = \"application/json\"\n }\n try {\n const response = await RequestTimeoutError.rejectAfterTimeout(\n this.#fetch(url.toString(), {\n method,\n headers,\n body: bodyAsJsonString,\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`, { method, path })\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 })\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 * List databases\n *\n * @deprecated Please use `search`\n */\n list: (\n args: WithAuth<ListDatabasesParameters>\n ): Promise<ListDatabasesResponse> => {\n return this.request<ListDatabasesResponse>({\n path: listDatabases.path(),\n method: listDatabases.method,\n query: pick(args, listDatabases.queryParams),\n body: pick(args, listDatabases.bodyParams),\n auth: args?.auth,\n })\n },\n\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 * Query a database\n */\n query: (\n args: WithAuth<QueryDatabaseParameters>\n ): Promise<QueryDatabaseResponse> => {\n return this.request<QueryDatabaseResponse>({\n path: queryDatabase.path(args),\n method: queryDatabase.method,\n query: pick(args, queryDatabase.queryParams),\n body: pick(args, queryDatabase.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 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 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 /**\n * Search\n */\n public search(args: WithAuth<SearchParameters>): 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 /**\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> | URLSearchParams\n\ntype WithAuth<P> = P & { auth?: string }\n"]}
@@ -4601,6 +4601,16 @@ declare type PropertyFilter = {
4601
4601
  property: string;
4602
4602
  type?: "rollup";
4603
4603
  };
4604
+ declare type TimestampCreatedTimeFilter = {
4605
+ created_time: DatePropertyFilter;
4606
+ timestamp: "created_time";
4607
+ type?: "created_time";
4608
+ };
4609
+ declare type TimestampLastEditedTimeFilter = {
4610
+ last_edited_time: DatePropertyFilter;
4611
+ timestamp: "last_edited_time";
4612
+ type?: "last_edited_time";
4613
+ };
4604
4614
  export declare type GetSelfParameters = Record<string, never>;
4605
4615
  export declare type GetSelfResponse = UserObjectResponse;
4606
4616
  export declare const getSelf: {
@@ -5667,34 +5677,42 @@ export declare type GetPagePropertyResponse = {
5667
5677
  type: "number";
5668
5678
  number: number | null;
5669
5679
  object: "property_item";
5680
+ id: string;
5670
5681
  } | {
5671
5682
  type: "url";
5672
5683
  url: string | null;
5673
5684
  object: "property_item";
5685
+ id: string;
5674
5686
  } | {
5675
5687
  type: "select";
5676
5688
  select: SelectPropertyResponse | null;
5677
5689
  object: "property_item";
5690
+ id: string;
5678
5691
  } | {
5679
5692
  type: "multi_select";
5680
5693
  multi_select: Array<SelectPropertyResponse>;
5681
5694
  object: "property_item";
5695
+ id: string;
5682
5696
  } | {
5683
5697
  type: "date";
5684
5698
  date: DateResponse | null;
5685
5699
  object: "property_item";
5700
+ id: string;
5686
5701
  } | {
5687
5702
  type: "email";
5688
5703
  email: string | null;
5689
5704
  object: "property_item";
5705
+ id: string;
5690
5706
  } | {
5691
5707
  type: "phone_number";
5692
5708
  phone_number: string | null;
5693
5709
  object: "property_item";
5710
+ id: string;
5694
5711
  } | {
5695
5712
  type: "checkbox";
5696
5713
  checkbox: boolean;
5697
5714
  object: "property_item";
5715
+ id: string;
5698
5716
  } | {
5699
5717
  type: "files";
5700
5718
  files: Array<{
@@ -5712,22 +5730,27 @@ export declare type GetPagePropertyResponse = {
5712
5730
  type?: "external";
5713
5731
  }>;
5714
5732
  object: "property_item";
5733
+ id: string;
5715
5734
  } | {
5716
5735
  type: "created_by";
5717
5736
  created_by: PartialUserObjectResponse;
5718
5737
  object: "property_item";
5738
+ id: string;
5719
5739
  } | {
5720
5740
  type: "created_time";
5721
5741
  created_time: string;
5722
5742
  object: "property_item";
5743
+ id: string;
5723
5744
  } | {
5724
5745
  type: "last_edited_by";
5725
5746
  last_edited_by: PartialUserObjectResponse;
5726
5747
  object: "property_item";
5748
+ id: string;
5727
5749
  } | {
5728
5750
  type: "last_edited_time";
5729
5751
  last_edited_time: string;
5730
5752
  object: "property_item";
5753
+ id: string;
5731
5754
  } | {
5732
5755
  type: "formula";
5733
5756
  formula: {
@@ -5744,24 +5767,29 @@ export declare type GetPagePropertyResponse = {
5744
5767
  boolean: boolean | null;
5745
5768
  };
5746
5769
  object: "property_item";
5770
+ id: string;
5747
5771
  } | {
5748
5772
  type: "title";
5749
5773
  title: RichTextItemResponse;
5750
5774
  object: "property_item";
5775
+ id: string;
5751
5776
  } | {
5752
5777
  type: "rich_text";
5753
5778
  rich_text: RichTextItemResponse;
5754
5779
  object: "property_item";
5780
+ id: string;
5755
5781
  } | {
5756
5782
  type: "people";
5757
5783
  people: PartialUserObjectResponse;
5758
5784
  object: "property_item";
5785
+ id: string;
5759
5786
  } | {
5760
5787
  type: "relation";
5761
5788
  relation: {
5762
5789
  id: string;
5763
5790
  };
5764
5791
  object: "property_item";
5792
+ id: string;
5765
5793
  } | {
5766
5794
  type: "rollup";
5767
5795
  rollup: {
@@ -5786,24 +5814,29 @@ export declare type GetPagePropertyResponse = {
5786
5814
  function: RollupFunction;
5787
5815
  };
5788
5816
  object: "property_item";
5817
+ id: string;
5789
5818
  } | {
5790
5819
  type: "property_item";
5791
5820
  property_item: {
5792
5821
  type: "title";
5793
5822
  title: EmptyObject;
5794
5823
  next_url: string | null;
5824
+ id: string;
5795
5825
  } | {
5796
5826
  type: "rich_text";
5797
5827
  rich_text: EmptyObject;
5798
5828
  next_url: string | null;
5829
+ id: string;
5799
5830
  } | {
5800
5831
  type: "people";
5801
5832
  people: EmptyObject;
5802
5833
  next_url: string | null;
5834
+ id: string;
5803
5835
  } | {
5804
5836
  type: "relation";
5805
5837
  relation: EmptyObject;
5806
5838
  next_url: string | null;
5839
+ id: string;
5807
5840
  } | {
5808
5841
  type: "rollup";
5809
5842
  rollup: {
@@ -5828,6 +5861,7 @@ export declare type GetPagePropertyResponse = {
5828
5861
  function: RollupFunction;
5829
5862
  };
5830
5863
  next_url: string | null;
5864
+ id: string;
5831
5865
  };
5832
5866
  object: "list";
5833
5867
  next_cursor: string | null;
@@ -5836,34 +5870,42 @@ export declare type GetPagePropertyResponse = {
5836
5870
  type: "number";
5837
5871
  number: number | null;
5838
5872
  object: "property_item";
5873
+ id: string;
5839
5874
  } | {
5840
5875
  type: "url";
5841
5876
  url: string | null;
5842
5877
  object: "property_item";
5878
+ id: string;
5843
5879
  } | {
5844
5880
  type: "select";
5845
5881
  select: SelectPropertyResponse | null;
5846
5882
  object: "property_item";
5883
+ id: string;
5847
5884
  } | {
5848
5885
  type: "multi_select";
5849
5886
  multi_select: Array<SelectPropertyResponse>;
5850
5887
  object: "property_item";
5888
+ id: string;
5851
5889
  } | {
5852
5890
  type: "date";
5853
5891
  date: DateResponse | null;
5854
5892
  object: "property_item";
5893
+ id: string;
5855
5894
  } | {
5856
5895
  type: "email";
5857
5896
  email: string | null;
5858
5897
  object: "property_item";
5898
+ id: string;
5859
5899
  } | {
5860
5900
  type: "phone_number";
5861
5901
  phone_number: string | null;
5862
5902
  object: "property_item";
5903
+ id: string;
5863
5904
  } | {
5864
5905
  type: "checkbox";
5865
5906
  checkbox: boolean;
5866
5907
  object: "property_item";
5908
+ id: string;
5867
5909
  } | {
5868
5910
  type: "files";
5869
5911
  files: Array<{
@@ -5881,22 +5923,27 @@ export declare type GetPagePropertyResponse = {
5881
5923
  type?: "external";
5882
5924
  }>;
5883
5925
  object: "property_item";
5926
+ id: string;
5884
5927
  } | {
5885
5928
  type: "created_by";
5886
5929
  created_by: PartialUserObjectResponse;
5887
5930
  object: "property_item";
5931
+ id: string;
5888
5932
  } | {
5889
5933
  type: "created_time";
5890
5934
  created_time: string;
5891
5935
  object: "property_item";
5936
+ id: string;
5892
5937
  } | {
5893
5938
  type: "last_edited_by";
5894
5939
  last_edited_by: PartialUserObjectResponse;
5895
5940
  object: "property_item";
5941
+ id: string;
5896
5942
  } | {
5897
5943
  type: "last_edited_time";
5898
5944
  last_edited_time: string;
5899
5945
  object: "property_item";
5946
+ id: string;
5900
5947
  } | {
5901
5948
  type: "formula";
5902
5949
  formula: {
@@ -5913,24 +5960,29 @@ export declare type GetPagePropertyResponse = {
5913
5960
  boolean: boolean | null;
5914
5961
  };
5915
5962
  object: "property_item";
5963
+ id: string;
5916
5964
  } | {
5917
5965
  type: "title";
5918
5966
  title: RichTextItemResponse;
5919
5967
  object: "property_item";
5968
+ id: string;
5920
5969
  } | {
5921
5970
  type: "rich_text";
5922
5971
  rich_text: RichTextItemResponse;
5923
5972
  object: "property_item";
5973
+ id: string;
5924
5974
  } | {
5925
5975
  type: "people";
5926
5976
  people: PartialUserObjectResponse;
5927
5977
  object: "property_item";
5978
+ id: string;
5928
5979
  } | {
5929
5980
  type: "relation";
5930
5981
  relation: {
5931
5982
  id: string;
5932
5983
  };
5933
5984
  object: "property_item";
5985
+ id: string;
5934
5986
  } | {
5935
5987
  type: "rollup";
5936
5988
  rollup: {
@@ -5955,6 +6007,7 @@ export declare type GetPagePropertyResponse = {
5955
6007
  function: RollupFunction;
5956
6008
  };
5957
6009
  object: "property_item";
6010
+ id: string;
5958
6011
  }>;
5959
6012
  };
5960
6013
  export declare const getPageProperty: {
@@ -7031,18 +7084,18 @@ declare type QueryDatabaseBodyParameters = {
7031
7084
  direction: "ascending" | "descending";
7032
7085
  }>;
7033
7086
  filter?: {
7034
- or: Array<PropertyFilter | {
7087
+ or: Array<PropertyFilter | TimestampCreatedTimeFilter | TimestampLastEditedTimeFilter | {
7035
7088
  or: Array<PropertyFilter>;
7036
7089
  } | {
7037
7090
  and: Array<PropertyFilter>;
7038
7091
  }>;
7039
7092
  } | {
7040
- and: Array<PropertyFilter | {
7093
+ and: Array<PropertyFilter | TimestampCreatedTimeFilter | TimestampLastEditedTimeFilter | {
7041
7094
  or: Array<PropertyFilter>;
7042
7095
  } | {
7043
7096
  and: Array<PropertyFilter>;
7044
7097
  }>;
7045
- } | PropertyFilter;
7098
+ } | PropertyFilter | TimestampCreatedTimeFilter | TimestampLastEditedTimeFilter;
7046
7099
  start_cursor?: string;
7047
7100
  page_size?: number;
7048
7101
  archived?: boolean;