get-notion-object-title
Version:
get human readable names from Notion objects.
1 lines • 41.7 kB
JavaScript
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(e,t)=>()=>(e&&(t=e(e=0)),t),a=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),o=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},s=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!r.call(i,d)&&d!==o&&e(i,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return i},c=t=>r.call(t,`module.exports`)?t[`module.exports`]:s(e({},`__esModule`,{value:!0}),t),l=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.assertNever=t,e.pick=n,e.isObject=r,e.getUnknownParams=i;function t(e){throw Error(`Unexpected value should never occur: ${e}`)}function n(e,t){let n=t.map(t=>[t,e?.[t]]);return Object.fromEntries(n)}function r(e){return typeof e==`object`&&!!e}function i(e,t){let n=new Set([...t.pathParams,...t.queryParams,...t.bodyParams,...t.formDataParams??[],`auth`]);return Object.keys(e).filter(e=>!n.has(e))}})),u=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.LogLevel=void 0,e.makeConsoleLogger=r,e.logLevelSeverity=i;var t=l(),n;(function(e){e.DEBUG=`debug`,e.INFO=`info`,e.WARN=`warn`,e.ERROR=`error`})(n||(e.LogLevel=n={}));function r(e){return(t,n,r)=>{console[t](`${e} ${t}:`,n,r)}}function i(e){switch(e){case n.DEBUG:return 20;case n.INFO:return 40;case n.WARN:return 60;case n.ERROR:return 80;default:return(0,t.assertNever)(e)}}})),d=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.APIResponseError=e.UnknownHTTPResponseError=e.InvalidPathParameterError=e.RequestTimeoutError=e.ClientErrorCode=e.APIErrorCode=void 0,e.isNotionClientError=a,e.validateRequestPath=c,e.isHTTPResponseError=f,e.buildRequestError=g;var t=l(),n;(function(e){e.Unauthorized=`unauthorized`,e.RestrictedResource=`restricted_resource`,e.ObjectNotFound=`object_not_found`,e.RateLimited=`rate_limited`,e.InvalidJSON=`invalid_json`,e.InvalidRequestURL=`invalid_request_url`,e.InvalidRequest=`invalid_request`,e.ValidationError=`validation_error`,e.ConflictError=`conflict_error`,e.InternalServerError=`internal_server_error`,e.ServiceUnavailable=`service_unavailable`,e.GatewayTimeout=`gateway_timeout`})(n||(e.APIErrorCode=n={}));var r;(function(e){e.RequestTimeout=`notionhq_client_request_timeout`,e.ResponseError=`notionhq_client_response_error`,e.InvalidPathParameter=`notionhq_client_invalid_path_parameter`})(r||(e.ClientErrorCode=r={}));var i=class extends Error{};function a(e){return(0,t.isObject)(e)&&e instanceof i}function o(e,t){return a(e)&&e.code in t}e.RequestTimeoutError=class e extends i{constructor(e=`Request to Notion API has timed out`){super(e),this.code=r.RequestTimeout,this.name=`RequestTimeoutError`}static isRequestTimeoutError(e){return o(e,{[r.RequestTimeout]:!0})}static rejectAfterTimeout(t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(new e)},n);t.then(r).catch(i).then(()=>clearTimeout(a))})}};var s=class extends i{constructor(e=`Path parameter contains invalid characters that could alter the request path`){super(e),this.code=r.InvalidPathParameter,this.name=`InvalidPathParameterError`}static isInvalidPathParameterError(e){return o(e,{[r.InvalidPathParameter]:!0})}};e.InvalidPathParameterError=s;function c(e){if(e.includes(`..`))throw new s(`Request path "${e}" contains path traversal sequence ".."`);if(/%2e/i.test(e)){let t;try{t=decodeURIComponent(e)}catch{return}if(t.includes(`..`))throw new s(`Request path "${e}" contains encoded path traversal sequence`)}}var u=class extends i{constructor(e){super(e.message),this.name=`HTTPResponseError`;let{code:t,status:n,headers:r,rawBodyText:i,additional_data:a,request_id:o}=e;this.code=t,this.status=n,this.headers=r,this.body=i,this.additional_data=a,this.request_id=o}},d={[r.ResponseError]:!0,[n.Unauthorized]:!0,[n.RestrictedResource]:!0,[n.ObjectNotFound]:!0,[n.RateLimited]:!0,[n.InvalidJSON]:!0,[n.InvalidRequestURL]:!0,[n.InvalidRequest]:!0,[n.ValidationError]:!0,[n.ConflictError]:!0,[n.InternalServerError]:!0,[n.ServiceUnavailable]:!0,[n.GatewayTimeout]:!0};function f(e){return!!o(e,d)}var p=class extends u{constructor(e){super({...e,code:r.ResponseError,message:e.message??`Request to Notion API failed with status: ${e.status}`,additional_data:void 0,request_id:void 0}),this.name=`UnknownHTTPResponseError`}static isUnknownHTTPResponseError(e){return o(e,{[r.ResponseError]:!0})}};e.UnknownHTTPResponseError=p;var m={[n.Unauthorized]:!0,[n.RestrictedResource]:!0,[n.ObjectNotFound]:!0,[n.RateLimited]:!0,[n.InvalidJSON]:!0,[n.InvalidRequestURL]:!0,[n.InvalidRequest]:!0,[n.ValidationError]:!0,[n.ConflictError]:!0,[n.InternalServerError]:!0,[n.ServiceUnavailable]:!0,[n.GatewayTimeout]:!0},h=class extends u{constructor(){super(...arguments),this.name=`APIResponseError`}static isAPIResponseError(e){return o(e,m)}};e.APIResponseError=h;function g(e,t){let n=_(t);return n===void 0?new p({message:void 0,headers:e.headers,status:e.status,rawBodyText:t}):new h({code:n.code,message:n.message,headers:e.headers,status:e.status,rawBodyText:t,additional_data:n.additional_data,request_id:n.request_id})}function _(e){if(typeof e!=`string`)return;let n;try{n=JSON.parse(e)}catch{return}if(!(0,t.isObject)(n)||typeof n.message!=`string`||!v(n.code))return;let r=n.additional_data,i=n.request_id;return{...n,code:n.code,message:n.message,additional_data:r,request_id:i}}function v(e){return typeof e==`string`&&e in m}})),f=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MIN_VIEW_COLUMN_WIDTH=e.DEFAULT_MAX_RETRY_DELAY_MS=e.DEFAULT_INITIAL_RETRY_DELAY_MS=e.DEFAULT_MAX_RETRIES=e.DEFAULT_TIMEOUT_MS=e.DEFAULT_BASE_URL=void 0,e.DEFAULT_BASE_URL=`https://api.notion.com`,e.DEFAULT_TIMEOUT_MS=6e4,e.DEFAULT_MAX_RETRIES=2,e.DEFAULT_INITIAL_RETRY_DELAY_MS=1e3,e.DEFAULT_MAX_RETRY_DELAY_MS=6e4,e.MIN_VIEW_COLUMN_WIDTH=32})),p=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.appendBlockChildren=e.listBlockChildren=e.deleteBlock=e.updateBlock=e.getBlock=void 0,e.getBlock={method:`get`,pathParams:[`block_id`],queryParams:[],bodyParams:[],path:e=>`blocks/${e.block_id}`},e.updateBlock={method:`patch`,pathParams:[`block_id`],queryParams:[],bodyParams:`archived.embed.type.in_trash.bookmark.image.video.pdf.file.audio.code.equation.divider.breadcrumb.tab.table_of_contents.link_to_page.table_row.heading_1.heading_2.heading_3.heading_4.paragraph.bulleted_list_item.numbered_list_item.quote.to_do.toggle.template.callout.synced_block.table.column`.split(`.`),path:e=>`blocks/${e.block_id}`},e.deleteBlock={method:`delete`,pathParams:[`block_id`],queryParams:[],bodyParams:[],path:e=>`blocks/${e.block_id}`},e.listBlockChildren={method:`get`,pathParams:[`block_id`],queryParams:[`start_cursor`,`page_size`],bodyParams:[],path:e=>`blocks/${e.block_id}/children`},e.appendBlockChildren={method:`patch`,pathParams:[`block_id`],queryParams:[],bodyParams:[`after`,`children`,`position`],path:e=>`blocks/${e.block_id}/children`}})),m=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.deleteComment=e.updateComment=e.getComment=e.listComments=e.createComment=void 0,e.createComment={method:`post`,pathParams:[],queryParams:[],bodyParams:[`attachments`,`display_name`,`parent`,`rich_text`,`markdown`,`discussion_id`],path:()=>`comments`},e.listComments={method:`get`,pathParams:[],queryParams:[`block_id`,`start_cursor`,`page_size`],bodyParams:[],path:()=>`comments`},e.getComment={method:`get`,pathParams:[`comment_id`],queryParams:[],bodyParams:[],path:e=>`comments/${e.comment_id}`},e.updateComment={method:`patch`,pathParams:[`comment_id`],queryParams:[],bodyParams:[`rich_text`,`markdown`],path:e=>`comments/${e.comment_id}`},e.deleteComment={method:`delete`,pathParams:[`comment_id`],queryParams:[],bodyParams:[],path:e=>`comments/${e.comment_id}`}})),h=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),g=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.listCustomEmojis=void 0,e.listCustomEmojis={method:`get`,pathParams:[],queryParams:[`start_cursor`,`page_size`,`name`],bodyParams:[],path:()=>`custom_emojis`}})),_=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.listDataSourceTemplates=e.createDataSource=e.queryDataSource=e.updateDataSource=e.getDataSource=void 0,e.getDataSource={method:`get`,pathParams:[`data_source_id`],queryParams:[],bodyParams:[],path:e=>`data_sources/${e.data_source_id}`},e.updateDataSource={method:`patch`,pathParams:[`data_source_id`],queryParams:[],bodyParams:[`archived`,`title`,`icon`,`properties`,`in_trash`,`parent`],path:e=>`data_sources/${e.data_source_id}`},e.queryDataSource={method:`post`,pathParams:[`data_source_id`],queryParams:[`filter_properties`],bodyParams:[`archived`,`sorts`,`filter`,`start_cursor`,`page_size`,`in_trash`,`result_type`],path:e=>`data_sources/${e.data_source_id}/query`},e.createDataSource={method:`post`,pathParams:[],queryParams:[],bodyParams:[`parent`,`properties`,`title`,`icon`],path:()=>`data_sources`},e.listDataSourceTemplates={method:`get`,pathParams:[`data_source_id`],queryParams:[`name`,`start_cursor`,`page_size`],bodyParams:[],path:e=>`data_sources/${e.data_source_id}/templates`}})),v=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createDatabase=e.updateDatabase=e.getDatabase=void 0,e.getDatabase={method:`get`,pathParams:[`database_id`],queryParams:[],bodyParams:[],path:e=>`databases/${e.database_id}`},e.updateDatabase={method:`patch`,pathParams:[`database_id`],queryParams:[],bodyParams:[`parent`,`title`,`description`,`is_inline`,`icon`,`cover`,`in_trash`,`is_locked`],path:e=>`databases/${e.database_id}`},e.createDatabase={method:`post`,pathParams:[],queryParams:[],bodyParams:[`parent`,`title`,`description`,`is_inline`,`initial_data_source`,`icon`,`cover`],path:()=>`databases`}})),y=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.getFileUpload=e.completeFileUpload=e.sendFileUpload=e.listFileUploads=e.createFileUpload=void 0,e.createFileUpload={method:`post`,pathParams:[],queryParams:[],bodyParams:[`mode`,`filename`,`content_type`,`number_of_parts`,`external_url`],path:()=>`file_uploads`},e.listFileUploads={method:`get`,pathParams:[],queryParams:[`status`,`start_cursor`,`page_size`],bodyParams:[],path:()=>`file_uploads`},e.sendFileUpload={method:`post`,pathParams:[`file_upload_id`],queryParams:[],bodyParams:[],formDataParams:[`file`,`part_number`],path:e=>`file_uploads/${e.file_upload_id}/send`},e.completeFileUpload={method:`post`,pathParams:[`file_upload_id`],queryParams:[],bodyParams:[],path:e=>`file_uploads/${e.file_upload_id}/complete`},e.getFileUpload={method:`get`,pathParams:[`file_upload_id`],queryParams:[],bodyParams:[],path:e=>`file_uploads/${e.file_upload_id}`}})),b=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.oauthIntrospect=e.oauthRevoke=e.oauthToken=void 0,e.oauthToken={method:`post`,pathParams:[],queryParams:[],bodyParams:[`grant_type`,`code`,`redirect_uri`,`external_account`,`refresh_token`],path:()=>`oauth/token`},e.oauthRevoke={method:`post`,pathParams:[],queryParams:[],bodyParams:[`token`],path:()=>`oauth/revoke`},e.oauthIntrospect={method:`post`,pathParams:[],queryParams:[],bodyParams:[`token`],path:()=>`oauth/introspect`}})),x=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.updatePageMarkdown=e.getPageMarkdown=e.getPageProperty=e.movePage=e.updatePage=e.getPage=e.createPage=void 0,e.createPage={method:`post`,pathParams:[],queryParams:[],bodyParams:[`parent`,`properties`,`icon`,`cover`,`content`,`children`,`markdown`,`template`,`position`],path:()=>`pages`},e.getPage={method:`get`,pathParams:[`page_id`],queryParams:[`filter_properties`],bodyParams:[],path:e=>`pages/${e.page_id}`},e.updatePage={method:`patch`,pathParams:[`page_id`],queryParams:[],bodyParams:[`archived`,`properties`,`icon`,`cover`,`is_locked`,`template`,`erase_content`,`in_trash`,`is_archived`],path:e=>`pages/${e.page_id}`},e.movePage={method:`post`,pathParams:[`page_id`],queryParams:[],bodyParams:[`parent`],path:e=>`pages/${e.page_id}/move`},e.getPageProperty={method:`get`,pathParams:[`page_id`,`property_id`],queryParams:[`start_cursor`,`page_size`],bodyParams:[],path:e=>`pages/${e.page_id}/properties/${e.property_id}`},e.getPageMarkdown={method:`get`,pathParams:[`page_id`],queryParams:[`include_transcript`],bodyParams:[],path:e=>`pages/${e.page_id}/markdown`},e.updatePageMarkdown={method:`patch`,pathParams:[`page_id`],queryParams:[],bodyParams:[`type`,`insert_content`,`replace_content_range`,`update_content`,`replace_content`],path:e=>`pages/${e.page_id}/markdown`}})),S=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.search=void 0,e.search={method:`post`,pathParams:[],queryParams:[],bodyParams:[`sort`,`query`,`start_cursor`,`page_size`,`filter`],path:()=>`search`}})),C=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.listUsers=e.getUser=e.getSelf=void 0,e.getSelf={method:`get`,pathParams:[],queryParams:[],bodyParams:[],path:()=>`users/me`},e.getUser={method:`get`,pathParams:[`user_id`],queryParams:[],bodyParams:[],path:e=>`users/${e.user_id}`},e.listUsers={method:`get`,pathParams:[],queryParams:[`start_cursor`,`page_size`],bodyParams:[],path:()=>`users`}})),w=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.deleteViewQuery=e.getViewQueryResults=e.createViewQuery=e.deleteView=e.updateView=e.getView=e.createView=e.listDatabaseViews=void 0,e.listDatabaseViews={method:`get`,pathParams:[],queryParams:[`database_id`,`data_source_id`,`start_cursor`,`page_size`],bodyParams:[],path:()=>`views`},e.createView={method:`post`,pathParams:[],queryParams:[],bodyParams:[],path:()=>`views`},e.getView={method:`get`,pathParams:[`view_id`],queryParams:[],bodyParams:[],path:e=>`views/${e.view_id}`},e.updateView={method:`patch`,pathParams:[`view_id`],queryParams:[],bodyParams:[],path:e=>`views/${e.view_id}`},e.deleteView={method:`delete`,pathParams:[`view_id`],queryParams:[],bodyParams:[],path:e=>`views/${e.view_id}`},e.createViewQuery={method:`post`,pathParams:[`view_id`],queryParams:[],bodyParams:[],path:e=>`views/${e.view_id}/queries`},e.getViewQueryResults={method:`get`,pathParams:[`view_id`,`query_id`],queryParams:[`start_cursor`,`page_size`],bodyParams:[],path:e=>`views/${e.view_id}/queries/${e.query_id}`},e.deleteViewQuery={method:`delete`,pathParams:[`view_id`,`query_id`],queryParams:[],bodyParams:[],path:e=>`views/${e.view_id}/queries/${e.query_id}`}})),T=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0})})),E=a((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),n(p(),e),n(m(),e),n(h(),e),n(g(),e),n(_(),e),n(v(),e),n(y(),e),n(b(),e),n(x(),e),n(S(),e),n(C(),e),n(w(),e),n(T(),e)})),D=o({author:()=>``,bugs:()=>N,default:()=>V,description:()=>A,devDependencies:()=>B,engines:()=>j,files:()=>z,homepage:()=>M,keywords:()=>F,license:()=>`MIT`,main:()=>I,name:()=>O,repository:()=>P,scripts:()=>R,types:()=>L,version:()=>k}),O,k,A,j,M,N,P,F,I,L,R,z,B,V,H=i((()=>{O=`@notionhq/client`,k=`5.20.0`,A=`A simple and easy to use client for the Notion API`,j={node:`>=18`},M=`https://developers.notion.com/docs/getting-started`,N={url:`https://github.com/makenotion/notion-sdk-js/issues`},P={type:`git`,url:`https://github.com/makenotion/notion-sdk-js/`},F=[`notion`,`notionapi`,`rest`,`notion-api`],I=`./build/src`,L=`./build/src/index.d.ts`,R={prepare:`husky && npm run build`,prepublishOnly:`npm run checkLoggedIn && npm run lint && npm run test`,build:`tsc`,prettier:`prettier --write .`,lint:`prettier --check . && eslint . --ext .ts && cspell '**/*' `,test:`jest ./test`,"check-links":`git ls-files | grep md$ | xargs -n 1 markdown-link-check`,prebuild:`npm run clean`,clean:`rm -rf ./build`,checkLoggedIn:`./scripts/verifyLoggedIn.sh`},z=[`build/package.json`,`build/src/**`],B={"@types/jest":`29.5.14`,"@typescript-eslint/eslint-plugin":`7.18.0`,"@typescript-eslint/parser":`7.18.0`,cspell:`8.17.1`,eslint:`8.57.1`,husky:`^9.1.7`,jest:`29.7.0`,"lint-staged":`^16.2.6`,"markdown-link-check":`3.13.7`,prettier:`3.3.3`,"ts-jest":`29.2.5`,typescript:`5.9.2`},V={name:O,version:k,description:A,engines:j,homepage:M,bugs:N,repository:P,keywords:F,main:I,types:L,scripts:R,"lint-staged":{"*.{ts,js,json,md}":`prettier --write`,"*.ts":`eslint --fix`},author:``,license:`MIT`,files:z,devDependencies:B}})),U=a((e=>{var t=e&&e.__classPrivateFieldSet||function(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n},n=e&&e.__classPrivateFieldGet||function(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)},r,i,a,o,s,p,m,h,g,_,v,y;Object.defineProperty(e,`__esModule`,{value:!0});var b=u(),x=d(),S=l(),C=f(),w=E(),T=(H(),c(D).default),O=class e{constructor(n){r.set(this,void 0),i.set(this,void 0),a.set(this,void 0),o.set(this,void 0),s.set(this,void 0),p.set(this,void 0),m.set(this,void 0),h.set(this,void 0),g.set(this,void 0),_.set(this,void 0),v.set(this,void 0),y.set(this,void 0),this.blocks={retrieve:e=>(this.warnUnknownParams(e,w.getBlock),this.request({path:w.getBlock.path(e),method:w.getBlock.method,query:(0,S.pick)(e,w.getBlock.queryParams),body:(0,S.pick)(e,w.getBlock.bodyParams),auth:e?.auth})),update:e=>(this.warnUnknownParams(e,w.updateBlock),this.request({path:w.updateBlock.path(e),method:w.updateBlock.method,query:(0,S.pick)(e,w.updateBlock.queryParams),body:(0,S.pick)(e,w.updateBlock.bodyParams),auth:e?.auth})),delete:e=>(this.warnUnknownParams(e,w.deleteBlock),this.request({path:w.deleteBlock.path(e),method:w.deleteBlock.method,query:(0,S.pick)(e,w.deleteBlock.queryParams),body:(0,S.pick)(e,w.deleteBlock.bodyParams),auth:e?.auth})),children:{append:e=>(this.warnUnknownParams(e,w.appendBlockChildren),this.request({path:w.appendBlockChildren.path(e),method:w.appendBlockChildren.method,query:(0,S.pick)(e,w.appendBlockChildren.queryParams),body:(0,S.pick)(e,w.appendBlockChildren.bodyParams),auth:e?.auth})),list:e=>(this.warnUnknownParams(e,w.listBlockChildren),this.request({path:w.listBlockChildren.path(e),method:w.listBlockChildren.method,query:(0,S.pick)(e,w.listBlockChildren.queryParams),body:(0,S.pick)(e,w.listBlockChildren.bodyParams),auth:e?.auth}))}},this.databases={retrieve:e=>(this.warnUnknownParams(e,w.getDatabase),this.request({path:w.getDatabase.path(e),method:w.getDatabase.method,query:(0,S.pick)(e,w.getDatabase.queryParams),body:(0,S.pick)(e,w.getDatabase.bodyParams),auth:e?.auth})),create:e=>(this.warnUnknownParams(e,w.createDatabase),this.request({path:w.createDatabase.path(),method:w.createDatabase.method,query:(0,S.pick)(e,w.createDatabase.queryParams),body:(0,S.pick)(e,w.createDatabase.bodyParams),auth:e?.auth})),update:e=>(this.warnUnknownParams(e,w.updateDatabase),this.request({path:w.updateDatabase.path(e),method:w.updateDatabase.method,query:(0,S.pick)(e,w.updateDatabase.queryParams),body:(0,S.pick)(e,w.updateDatabase.bodyParams),auth:e?.auth}))},this.dataSources={retrieve:e=>(this.warnUnknownParams(e,w.getDataSource),this.request({path:w.getDataSource.path(e),method:w.getDataSource.method,query:(0,S.pick)(e,w.getDataSource.queryParams),body:(0,S.pick)(e,w.getDataSource.bodyParams),auth:e?.auth})),query:e=>(this.warnUnknownParams(e,w.queryDataSource),this.request({path:w.queryDataSource.path(e),method:w.queryDataSource.method,query:(0,S.pick)(e,w.queryDataSource.queryParams),body:(0,S.pick)(e,w.queryDataSource.bodyParams),auth:e?.auth})),create:e=>(this.warnUnknownParams(e,w.createDataSource),this.request({path:w.createDataSource.path(),method:w.createDataSource.method,query:(0,S.pick)(e,w.createDataSource.queryParams),body:(0,S.pick)(e,w.createDataSource.bodyParams),auth:e?.auth})),update:e=>(this.warnUnknownParams(e,w.updateDataSource),this.request({path:w.updateDataSource.path(e),method:w.updateDataSource.method,query:(0,S.pick)(e,w.updateDataSource.queryParams),body:(0,S.pick)(e,w.updateDataSource.bodyParams),auth:e?.auth})),listTemplates:e=>(this.warnUnknownParams(e,w.listDataSourceTemplates),this.request({path:w.listDataSourceTemplates.path(e),method:w.listDataSourceTemplates.method,query:(0,S.pick)(e,w.listDataSourceTemplates.queryParams),body:(0,S.pick)(e,w.listDataSourceTemplates.bodyParams),auth:e?.auth}))},this.pages={create:e=>(this.warnUnknownParams(e,w.createPage),this.request({path:w.createPage.path(),method:w.createPage.method,query:(0,S.pick)(e,w.createPage.queryParams),body:(0,S.pick)(e,w.createPage.bodyParams),auth:e?.auth})),retrieve:e=>(this.warnUnknownParams(e,w.getPage),this.request({path:w.getPage.path(e),method:w.getPage.method,query:(0,S.pick)(e,w.getPage.queryParams),body:(0,S.pick)(e,w.getPage.bodyParams),auth:e?.auth})),update:e=>(this.warnUnknownParams(e,w.updatePage),this.request({path:w.updatePage.path(e),method:w.updatePage.method,query:(0,S.pick)(e,w.updatePage.queryParams),body:(0,S.pick)(e,w.updatePage.bodyParams),auth:e?.auth})),move:e=>(this.warnUnknownParams(e,w.movePage),this.request({path:w.movePage.path(e),method:w.movePage.method,query:(0,S.pick)(e,w.movePage.queryParams),body:(0,S.pick)(e,w.movePage.bodyParams),auth:e?.auth})),retrieveMarkdown:e=>this.request({path:w.getPageMarkdown.path(e),method:w.getPageMarkdown.method,query:(0,S.pick)(e,w.getPageMarkdown.queryParams),body:(0,S.pick)(e,w.getPageMarkdown.bodyParams),auth:e?.auth}),updateMarkdown:e=>this.request({path:w.updatePageMarkdown.path(e),method:w.updatePageMarkdown.method,query:(0,S.pick)(e,w.updatePageMarkdown.queryParams),body:(0,S.pick)(e,w.updatePageMarkdown.bodyParams),auth:e?.auth}),properties:{retrieve:e=>(this.warnUnknownParams(e,w.getPageProperty),this.request({path:w.getPageProperty.path(e),method:w.getPageProperty.method,query:(0,S.pick)(e,w.getPageProperty.queryParams),body:(0,S.pick)(e,w.getPageProperty.bodyParams),auth:e?.auth}))}},this.users={retrieve:e=>(this.warnUnknownParams(e,w.getUser),this.request({path:w.getUser.path(e),method:w.getUser.method,query:(0,S.pick)(e,w.getUser.queryParams),body:(0,S.pick)(e,w.getUser.bodyParams),auth:e?.auth})),list:e=>(this.warnUnknownParams(e,w.listUsers),this.request({path:w.listUsers.path(),method:w.listUsers.method,query:(0,S.pick)(e,w.listUsers.queryParams),body:(0,S.pick)(e,w.listUsers.bodyParams),auth:e?.auth})),me:e=>(this.warnUnknownParams(e,w.getSelf),this.request({path:w.getSelf.path(),method:w.getSelf.method,query:(0,S.pick)(e,w.getSelf.queryParams),body:(0,S.pick)(e,w.getSelf.bodyParams),auth:e?.auth}))},this.customEmojis={list:e=>(this.warnUnknownParams(e??{},w.listCustomEmojis),this.request({path:w.listCustomEmojis.path(),method:w.listCustomEmojis.method,query:(0,S.pick)(e??{},w.listCustomEmojis.queryParams),body:(0,S.pick)(e??{},w.listCustomEmojis.bodyParams),auth:e?.auth}))},this.comments={create:e=>(this.warnUnknownParams(e,w.createComment),this.request({path:w.createComment.path(),method:w.createComment.method,query:(0,S.pick)(e,w.createComment.queryParams),body:(0,S.pick)(e,w.createComment.bodyParams),auth:e?.auth})),list:e=>(this.warnUnknownParams(e,w.listComments),this.request({path:w.listComments.path(),method:w.listComments.method,query:(0,S.pick)(e,w.listComments.queryParams),body:(0,S.pick)(e,w.listComments.bodyParams),auth:e?.auth})),retrieve:e=>(this.warnUnknownParams(e,w.getComment),this.request({path:w.getComment.path(e),method:w.getComment.method,query:(0,S.pick)(e,w.getComment.queryParams),body:(0,S.pick)(e,w.getComment.bodyParams),auth:e?.auth})),update:e=>(this.warnUnknownParams(e,w.updateComment),this.request({path:w.updateComment.path(e),method:w.updateComment.method,query:(0,S.pick)(e,w.updateComment.queryParams),body:(0,S.pick)(e,w.updateComment.bodyParams),auth:e?.auth})),delete:e=>(this.warnUnknownParams(e,w.deleteComment),this.request({path:w.deleteComment.path(e),method:w.deleteComment.method,query:(0,S.pick)(e,w.deleteComment.queryParams),body:(0,S.pick)(e,w.deleteComment.bodyParams),auth:e?.auth}))},this.fileUploads={create:e=>(this.warnUnknownParams(e,w.createFileUpload),this.request({path:w.createFileUpload.path(),method:w.createFileUpload.method,query:(0,S.pick)(e,w.createFileUpload.queryParams),body:(0,S.pick)(e,w.createFileUpload.bodyParams),auth:e?.auth})),retrieve:e=>(this.warnUnknownParams(e,w.getFileUpload),this.request({path:w.getFileUpload.path(e),method:w.getFileUpload.method,query:(0,S.pick)(e,w.getFileUpload.queryParams),auth:e?.auth})),list:e=>(this.warnUnknownParams(e,w.listFileUploads),this.request({path:w.listFileUploads.path(),method:w.listFileUploads.method,query:(0,S.pick)(e,w.listFileUploads.queryParams),auth:e?.auth})),send:e=>(this.warnUnknownParams(e,w.sendFileUpload),this.request({path:w.sendFileUpload.path(e),method:w.sendFileUpload.method,query:(0,S.pick)(e,w.sendFileUpload.queryParams),formDataParams:(0,S.pick)(e,w.sendFileUpload.formDataParams),auth:e?.auth})),complete:e=>(this.warnUnknownParams(e,w.completeFileUpload),this.request({path:w.completeFileUpload.path(e),method:w.completeFileUpload.method,query:(0,S.pick)(e,w.completeFileUpload.queryParams),auth:e?.auth}))},this.views={create:e=>this.request({path:w.createView.path(),method:w.createView.method,query:(0,S.pick)(e,w.createView.queryParams),body:(0,S.pick)(e,[`data_source_id`,`name`,`type`,`database_id`,`view_id`,`filter`,`sorts`,`quick_filters`,`create_database`,`configuration`,`position`,`placement`]),auth:e?.auth}),retrieve:e=>(this.warnUnknownParams(e,w.getView),this.request({path:w.getView.path(e),method:w.getView.method,query:(0,S.pick)(e,w.getView.queryParams),body:(0,S.pick)(e,w.getView.bodyParams),auth:e?.auth})),update:e=>this.request({path:w.updateView.path(e),method:w.updateView.method,query:(0,S.pick)(e,w.updateView.queryParams),body:(0,S.pick)(e,[`name`,`filter`,`sorts`,`quick_filters`,`configuration`]),auth:e?.auth}),delete:e=>(this.warnUnknownParams(e,w.deleteView),this.request({path:w.deleteView.path(e),method:w.deleteView.method,query:(0,S.pick)(e,w.deleteView.queryParams),body:(0,S.pick)(e,w.deleteView.bodyParams),auth:e?.auth})),list:e=>(this.warnUnknownParams(e,w.listDatabaseViews),this.request({path:w.listDatabaseViews.path(),method:w.listDatabaseViews.method,query:(0,S.pick)(e,w.listDatabaseViews.queryParams),body:(0,S.pick)(e,w.listDatabaseViews.bodyParams),auth:e?.auth})),queries:{create:e=>this.request({path:w.createViewQuery.path(e),method:w.createViewQuery.method,query:(0,S.pick)(e,w.createViewQuery.queryParams),body:(0,S.pick)(e,[`page_size`]),auth:e?.auth}),results:e=>(this.warnUnknownParams(e,w.getViewQueryResults),this.request({path:w.getViewQueryResults.path(e),method:w.getViewQueryResults.method,query:(0,S.pick)(e,w.getViewQueryResults.queryParams),body:(0,S.pick)(e,w.getViewQueryResults.bodyParams),auth:e?.auth})),delete:e=>(this.warnUnknownParams(e,w.deleteViewQuery),this.request({path:w.deleteViewQuery.path(e),method:w.deleteViewQuery.method,query:(0,S.pick)(e,w.deleteViewQuery.queryParams),body:(0,S.pick)(e,w.deleteViewQuery.bodyParams),auth:e?.auth}))}},this.search=e=>(this.warnUnknownParams(e,w.search),this.request({path:w.search.path(),method:w.search.method,query:(0,S.pick)(e,w.search.queryParams),body:(0,S.pick)(e,w.search.bodyParams),auth:e?.auth})),this.oauth={token:e=>this.request({path:w.oauthToken.path(),method:w.oauthToken.method,query:(0,S.pick)(e,w.oauthToken.queryParams),body:(0,S.pick)(e,w.oauthToken.bodyParams),auth:{client_id:e.client_id,client_secret:e.client_secret}}),introspect:e=>this.request({path:w.oauthIntrospect.path(),method:w.oauthIntrospect.method,query:(0,S.pick)(e,w.oauthIntrospect.queryParams),body:(0,S.pick)(e,w.oauthIntrospect.bodyParams),auth:{client_id:e.client_id,client_secret:e.client_secret}}),revoke:e=>this.request({path:w.oauthRevoke.path(),method:w.oauthRevoke.method,query:(0,S.pick)(e,w.oauthRevoke.queryParams),body:(0,S.pick)(e,w.oauthRevoke.bodyParams),auth:{client_id:e.client_id,client_secret:e.client_secret}})},t(this,r,n?.auth,`f`),t(this,i,n?.logLevel??b.LogLevel.WARN,`f`),t(this,a,n?.logger??(0,b.makeConsoleLogger)(T.name),`f`),t(this,o,`${n?.baseUrl??C.DEFAULT_BASE_URL}/v1/`,`f`),t(this,s,n?.timeoutMs??C.DEFAULT_TIMEOUT_MS,`f`),t(this,p,n?.notionVersion??e.defaultNotionVersion,`f`),t(this,m,n?.fetch??fetch.bind(globalThis),`f`),t(this,h,n?.agent,`f`),t(this,g,`notionhq-client/${T.version}`,`f`),n?.retry===!1?(t(this,_,0,`f`),t(this,v,0,`f`),t(this,y,0,`f`)):(t(this,_,n?.retry?.maxRetries??C.DEFAULT_MAX_RETRIES,`f`),t(this,v,n?.retry?.initialRetryDelayMs??C.DEFAULT_INITIAL_RETRY_DELAY_MS,`f`),t(this,y,n?.retry?.maxRetryDelayMs??C.DEFAULT_MAX_RETRY_DELAY_MS,`f`))}async request(e){let{path:t,method:n,query:r,body:i,formDataParams:a,auth:o}=e;(0,x.validateRequestPath)(t),this.log(b.LogLevel.INFO,`request start`,{method:n,path:t});let s=this.buildRequestUrl(t,r),c=this.serializeBody(i),l=this.buildRequestHeaders(e.headers,o,c),u=this.buildFormData(a,l);return this.executeWithRetry({url:s,method:n,path:t,headers:l,body:c??u})}buildRequestUrl(e,t){let r=new URL(`${n(this,o,`f`)}${e}`);if(t){for(let[e,n]of Object.entries(t))if(n!==void 0)if(Array.isArray(n))for(let t of n)r.searchParams.append(e,decodeURIComponent(t));else r.searchParams.append(e,String(n))}return r}serializeBody(e){if(!(!e||Object.entries(e).length===0))return JSON.stringify(e)}buildRequestHeaders(e,t,r){let i=this.buildAuthHeader(t),a={...e,...i,"Notion-Version":n(this,p,`f`),"user-agent":n(this,g,`f`)};return r!==void 0&&(a[`content-type`]=`application/json`),a}buildAuthHeader(e){if(typeof e==`object`){let t=`${e.client_id}:${e.client_secret}`;return{authorization:`Basic ${Buffer.from(t).toString(`base64`)}`}}return this.authAsHeaders(e)}buildFormData(e,t){if(!e)return;delete t[`content-type`];let n=new FormData;for(let[t,r]of Object.entries(e))typeof r==`string`?n.append(t,r):typeof r==`object`&&n.append(t,typeof r.data==`object`?r.data:new Blob([r.data]),r.filename);return n}async executeWithRetry(e){let{url:t,method:r,path:i,headers:a,body:o}=e,s=0;for(;;)try{return await this.executeSingleRequest({url:t,method:r,path:i,headers:a,body:o})}catch(e){if(!(0,x.isNotionClientError)(e))throw e;if(this.logRequestError(e,s),s<n(this,_,`f`)&&this.canRetry(e,r)){let t=this.calculateRetryDelay(e,s);this.log(b.LogLevel.INFO,`retrying request`,{method:r,path:i,attempt:s+1,delayMs:t}),await this.sleep(t),s++;continue}throw e}}async executeSingleRequest(e){let{url:t,method:r,path:i,headers:a,body:o}=e,c=await x.RequestTimeoutError.rejectAfterTimeout(n(this,m,`f`).call(this,t.toString(),{method:r.toUpperCase(),headers:a,body:o,agent:n(this,h,`f`)}),n(this,s,`f`)),l=await c.text();if(!c.ok)throw(0,x.buildRequestError)(c,l);let u=JSON.parse(l);return this.log(b.LogLevel.INFO,`request success`,{method:r,path:i,...this.extractRequestId(u)}),u}logRequestError(e,t){this.log(b.LogLevel.WARN,`request fail`,{code:e.code,message:e.message,attempt:t,...this.extractRequestId(e)}),(0,x.isHTTPResponseError)(e)&&this.log(b.LogLevel.DEBUG,`failed response body`,{body:e.body})}extractRequestId(e){return e&&typeof e==`object`&&`request_id`in e&&typeof e.request_id==`string`?{requestId:e.request_id}:{}}canRetry(e,t){return x.APIResponseError.isAPIResponseError(e)?e.code===x.APIErrorCode.RateLimited?!0:t===`get`||t===`delete`?e.code===x.APIErrorCode.InternalServerError||e.code===x.APIErrorCode.ServiceUnavailable:!1:!1}calculateRetryDelay(e,t){if(x.APIResponseError.isAPIResponseError(e)){let t=this.parseRetryAfterHeader(e.headers);if(t!==void 0)return Math.min(t,n(this,y,`f`))}let r=n(this,v,`f`)*2**t;return Math.min(r*Math.random()+r/2,n(this,y,`f`))}parseRetryAfterHeader(e){if(!e)return;let t=null;if(typeof e==`object`&&`get`in e)t=e.get(`retry-after`);else if(typeof e==`object`){let n=e;t=n[`retry-after`]??n[`Retry-After`]??null}if(!t)return;let n=parseInt(t,10);if(!isNaN(n)&&n>=0)return n*1e3;let r=Date.parse(t);if(!isNaN(r)){let e=r-Date.now();return e>0?e:0}}sleep(e){return new Promise(t=>setTimeout(t,e))}warnUnknownParams(e,t){if(!e||typeof e!=`object`)return;let n=(0,S.getUnknownParams)(e,t);n.length>0&&this.log(b.LogLevel.WARN,`unknown parameters were ignored`,{unknownParams:n,knownParams:[...t.pathParams,...t.queryParams,...t.bodyParams,...t.formDataParams??[]]})}log(e,t,r){(0,b.logLevelSeverity)(e)>=(0,b.logLevelSeverity)(n(this,i,`f`))&&n(this,a,`f`).call(this,e,t,r)}authAsHeaders(e){let t={},i=e??n(this,r,`f`);return i!==void 0&&(t.authorization=`Bearer ${i}`),t}};r=new WeakMap,i=new WeakMap,a=new WeakMap,o=new WeakMap,s=new WeakMap,p=new WeakMap,m=new WeakMap,h=new WeakMap,g=new WeakMap,_=new WeakMap,v=new WeakMap,y=new WeakMap,O.defaultNotionVersion=`2025-09-03`,e.default=O})),W=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.iteratePaginatedAPI=t,e.collectPaginatedAPI=n,e.iterateDataSourceTemplates=r,e.collectDataSourceTemplates=i,e.isFullBlock=a,e.isFullPage=o,e.isFullDataSource=s,e.isFullDatabase=c,e.isFullPageOrDataSource=l,e.isFullUser=u,e.isFullComment=d,e.isFullView=f,e.isTextRichTextItemResponse=p,e.isEquationRichTextItemResponse=m,e.isMentionRichTextItemResponse=h,e.extractNotionId=g,e.extractDatabaseId=v,e.extractPageId=y,e.extractBlockId=b;async function*t(e,t){let n=t.start_cursor;do{let r=await e({...t,start_cursor:n});yield*r.results,n=r.next_cursor}while(n)}async function n(e,n){let r=[];for await(let i of t(e,n))r.push(i);return r}async function*r(e,t){let n=t.start_cursor;do{let r=await e.dataSources.listTemplates({...t,start_cursor:n});yield*r.templates,n=r.next_cursor}while(n)}async function i(e,t){let n=[];for await(let i of r(e,t))n.push(i);return n}function a(e){return e.object===`block`&&`type`in e}function o(e){return e.object===`page`&&`url`in e}function s(e){return e.object===`data_source`}function c(e){return e.object===`database`}function l(e){return e.object===`data_source`?s(e):o(e)}function u(e){return`type`in e}function d(e){return`created_by`in e}function f(e){return`type`in e}function p(e){return e.type===`text`}function m(e){return e.type===`equation`}function h(e){return e.type===`mention`}function g(e){if(!e||typeof e!=`string`)return null;let t=e.trim();if(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t))return t.toLowerCase();if(/^[0-9a-f]{32}$/i.test(t))return _(t);let n=t.match(/\/[^/?#]*-([0-9a-f]{32})(?:[/?#]|$)/i);if(n&&n[1])return _(n[1]);let r=t.match(/[?&](?:p|page_id|database_id)=([0-9a-f]{32})/i);if(r&&r[1])return _(r[1]);let i=t.match(/([0-9a-f]{32})/i);return i&&i[1]?_(i[1]):null}function _(e){let t=e.toLowerCase();return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20,32)}`}function v(e){return g(e)}function y(e){return g(e)}function b(e){if(!e||typeof e!=`string`)return null;let t=e.match(/#(?:block-)?([0-9a-f]{32})/i);return t&&t[1]?_(t[1]):null}})),G=a((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.extractBlockId=e.extractPageId=e.extractDatabaseId=e.extractNotionId=e.isFullPageOrDataSource=e.isFullView=e.isFullComment=e.isFullUser=e.isFullPage=e.isFullDatabase=e.isFullDataSource=e.isFullBlock=e.iterateDataSourceTemplates=e.collectDataSourceTemplates=e.iteratePaginatedAPI=e.collectPaginatedAPI=e.MIN_VIEW_COLUMN_WIDTH=e.DEFAULT_MAX_RETRY_DELAY_MS=e.DEFAULT_INITIAL_RETRY_DELAY_MS=e.DEFAULT_MAX_RETRIES=e.DEFAULT_TIMEOUT_MS=e.DEFAULT_BASE_URL=e.isHTTPResponseError=e.isNotionClientError=e.InvalidPathParameterError=e.RequestTimeoutError=e.UnknownHTTPResponseError=e.APIResponseError=e.ClientErrorCode=e.APIErrorCode=e.LogLevel=e.Client=void 0;var t=U();Object.defineProperty(e,`Client`,{enumerable:!0,get:function(){return t.default}});var n=u();Object.defineProperty(e,`LogLevel`,{enumerable:!0,get:function(){return n.LogLevel}});var r=d();Object.defineProperty(e,`APIErrorCode`,{enumerable:!0,get:function(){return r.APIErrorCode}}),Object.defineProperty(e,`ClientErrorCode`,{enumerable:!0,get:function(){return r.ClientErrorCode}}),Object.defineProperty(e,`APIResponseError`,{enumerable:!0,get:function(){return r.APIResponseError}}),Object.defineProperty(e,`UnknownHTTPResponseError`,{enumerable:!0,get:function(){return r.UnknownHTTPResponseError}}),Object.defineProperty(e,`RequestTimeoutError`,{enumerable:!0,get:function(){return r.RequestTimeoutError}}),Object.defineProperty(e,`InvalidPathParameterError`,{enumerable:!0,get:function(){return r.InvalidPathParameterError}}),Object.defineProperty(e,`isNotionClientError`,{enumerable:!0,get:function(){return r.isNotionClientError}}),Object.defineProperty(e,`isHTTPResponseError`,{enumerable:!0,get:function(){return r.isHTTPResponseError}});var i=f();Object.defineProperty(e,`DEFAULT_BASE_URL`,{enumerable:!0,get:function(){return i.DEFAULT_BASE_URL}}),Object.defineProperty(e,`DEFAULT_TIMEOUT_MS`,{enumerable:!0,get:function(){return i.DEFAULT_TIMEOUT_MS}}),Object.defineProperty(e,`DEFAULT_MAX_RETRIES`,{enumerable:!0,get:function(){return i.DEFAULT_MAX_RETRIES}}),Object.defineProperty(e,`DEFAULT_INITIAL_RETRY_DELAY_MS`,{enumerable:!0,get:function(){return i.DEFAULT_INITIAL_RETRY_DELAY_MS}}),Object.defineProperty(e,`DEFAULT_MAX_RETRY_DELAY_MS`,{enumerable:!0,get:function(){return i.DEFAULT_MAX_RETRY_DELAY_MS}}),Object.defineProperty(e,`MIN_VIEW_COLUMN_WIDTH`,{enumerable:!0,get:function(){return i.MIN_VIEW_COLUMN_WIDTH}});var a=W();Object.defineProperty(e,`collectPaginatedAPI`,{enumerable:!0,get:function(){return a.collectPaginatedAPI}}),Object.defineProperty(e,`iteratePaginatedAPI`,{enumerable:!0,get:function(){return a.iteratePaginatedAPI}}),Object.defineProperty(e,`collectDataSourceTemplates`,{enumerable:!0,get:function(){return a.collectDataSourceTemplates}}),Object.defineProperty(e,`iterateDataSourceTemplates`,{enumerable:!0,get:function(){return a.iterateDataSourceTemplates}}),Object.defineProperty(e,`isFullBlock`,{enumerable:!0,get:function(){return a.isFullBlock}}),Object.defineProperty(e,`isFullDataSource`,{enumerable:!0,get:function(){return a.isFullDataSource}}),Object.defineProperty(e,`isFullDatabase`,{enumerable:!0,get:function(){return a.isFullDatabase}}),Object.defineProperty(e,`isFullPage`,{enumerable:!0,get:function(){return a.isFullPage}}),Object.defineProperty(e,`isFullUser`,{enumerable:!0,get:function(){return a.isFullUser}}),Object.defineProperty(e,`isFullComment`,{enumerable:!0,get:function(){return a.isFullComment}}),Object.defineProperty(e,`isFullView`,{enumerable:!0,get:function(){return a.isFullView}}),Object.defineProperty(e,`isFullPageOrDataSource`,{enumerable:!0,get:function(){return a.isFullPageOrDataSource}}),Object.defineProperty(e,`extractNotionId`,{enumerable:!0,get:function(){return a.extractNotionId}}),Object.defineProperty(e,`extractDatabaseId`,{enumerable:!0,get:function(){return a.extractDatabaseId}}),Object.defineProperty(e,`extractPageId`,{enumerable:!0,get:function(){return a.extractPageId}}),Object.defineProperty(e,`extractBlockId`,{enumerable:!0,get:function(){return a.extractBlockId}})}))(),K=e=>e.map(e=>e.plain_text).join(``),q=e=>{let t,n;return t=e[e.type].external?e[e.type].external.url:e[e.type].file?e[e.type].file.url:e[e.type].url?e[e.type].url:`[Missing case for media block types]: `+e.type,e[e.type].caption.length?(n=K(e[e.type].caption),n+`: `+t):t},J=e=>{let t;if(e[e.type].rich_text)t=K(e[e.type].rich_text);else switch(e.type){case`unsupported`:t=`[Unsupported block type]`;break;case`bookmark`:t=e.bookmark.url;break;case`child_database`:t=e.child_database.title;break;case`child_page`:t=e.child_page.title;break;case`embed`:case`video`:case`file`:case`image`:case`pdf`:t=q(e);break;case`equation`:t=e.equation.expression;break;case`link_preview`:t=e.link_preview.url;break;case`synced_block`:t=e.synced_block.synced_from?`This block is synced with a block with the following ID: `+e.synced_block.synced_from[e.synced_block.synced_from.type]:`Source sync block that another blocked is synced with.`;break;case`table`:t=`Table width: `+e.table.table_width;break;case`table_of_contents`:t=`ToC color: `+e.table_of_contents.color;break;case`breadcrumb`:case`column_list`:case`divider`:t=`No text available`;break;default:t=`[Needs case added]`;break}return e.has_children&&(t+=` (Has children)`),e.type+`: `+t},Y=e=>e?e.type===`emoji`?e.emoji:e.type===`custom_emoji`?e.custom_emoji.name:e.type===`icon`?e.icon.name:null:null,X=e=>Array.isArray(e)?e.map(e=>e.plain_text).join(``):``,Z=e=>{if(!e)return``;if(`rich_text`in e)return X(e.rich_text);if(`title`in e)return X(e.title)},Q=(e,t={emoji:!0})=>{let n=e;if((0,G.isFullPage)(n)&&n.object===`page`&&n.properties){let e=[`title`,`Page`,`Name`,`Topic`].find(e=>Z(n.properties[e])),r=Y(n.icon)??``;if(e)return t.emoji?`${r}${Z(n.properties[e])}`:Z(n.properties[e]);let i=Object.keys(n.properties).reverse().map(e=>Z(n.properties[e])).filter(e=>e).reduce((e,t)=>`${e} ${t}`,``);return t.emoji?`${r}${i}`:i}let r=e;if((0,G.isFullDatabase)(r)){let e=X(r.title);return t.emoji?`${Y(n.icon)??``}${e}`:e}return e?.type===void 0?`Untitled`:J(e)};exports.getNotionObjectTitle=Q;