@notionhq/custom-blocks-host 0.2.19 → 0.2.20

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/dist/browser.js CHANGED
@@ -1 +1 @@
1
- function Ar(e){let{manifestProperties:o,propertySchemasById:n}=e,s=[];for(let[c,l]of Object.entries(o)){let f=qr({propertyKey:c,manifestProperty:l,propertySchemasById:n});f!==void 0&&s.push([c,f])}return Object.fromEntries(s)}function qr(e){let{propertyKey:o,manifestProperty:n,propertySchemasById:s}=e,c=tt(n.name),l=Object.entries(s).filter(([f,y])=>y.type===n.type&&(f===o||tt(y.name)===c));return l.length===1?l[0][0]:void 0}function tt(e){return e.trim().toLowerCase()}var Re,Tr={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Te(e){return!e&&!Re?Tr:{lang:e?.lang??Re?.lang,message:e?.message,abortEarly:e?.abortEarly??Re?.abortEarly,abortPipeEarly:e?.abortPipeEarly??Re?.abortPipeEarly}}var Nr;function Fr(e){return Nr?.get(e)}var Ur;function zr(e){return Ur?.get(e)}var Hr;function Lr(e,o){return Hr?.get(e)?.get(o)}function ge(e){let o=typeof e;return o==="string"?`"${e}"`:o==="number"||o==="bigint"||o==="boolean"?`${e}`:o==="object"||o==="function"?(e&&Object.getPrototypeOf(e)?.constructor?.name)??"null":o}function j(e,o,n,s,c){let l=c&&"input"in c?c.input:n.value,f=c?.expected??e.expects??null,y=c?.received??ge(l),m={kind:e.kind,type:e.type,input:l,expected:f,received:y,message:`Invalid ${o}: ${f?`Expected ${f} but r`:"R"}eceived ${y}`,requirement:e.requirement,path:c?.path,issues:c?.issues,lang:s.lang,abortEarly:s.abortEarly,abortPipeEarly:s.abortPipeEarly},S=e.kind==="schema",I=c?.message??e.message??Lr(e.reference,m.lang)??(S?zr(m.lang):null)??s.message??Fr(m.lang);I!==void 0&&(m.message=typeof I=="function"?I(m):I),S&&(n.typed=!1),n.issues?n.issues.push(m):n.issues=[m]}var rt=new WeakMap;function U(e){let o=rt.get(e);return o||(o={version:1,vendor:"valibot",validate(n){return e["~run"]({value:n},Te())}},rt.set(e,o)),o}function Gr(e,o){return Object.prototype.hasOwnProperty.call(e,o)&&o!=="__proto__"&&o!=="prototype"&&o!=="constructor"}function Ne(e,o){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${o} `)})`:n[0]??"never"}var Vr=class extends Error{constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};function te(e){return{kind:"transformation",type:"brand",reference:te,async:!1,name:e,"~run"(o){return o}}}function be(e){return{kind:"validation",type:"finite",reference:be,async:!1,expects:null,requirement:Number.isFinite,message:e,"~run"(o,n){return o.typed&&!this.requirement(o.value)&&j(this,"finite",o,n),o}}}function Me(e,o){return{kind:"validation",type:"max_length",reference:Me,async:!1,expects:`<=${e}`,requirement:e,message:o,"~run"(n,s){return n.typed&&n.value.length>this.requirement&&j(this,"length",n,s,{received:`${n.value.length}`}),n}}}function ke(e,o){return{kind:"validation",type:"min_length",reference:ke,async:!1,expects:`>=${e}`,requirement:e,message:o,"~run"(n,s){return n.typed&&n.value.length<this.requirement&&j(this,"length",n,s,{received:`${n.value.length}`}),n}}}function Se(e,o){return{kind:"validation",type:"min_value",reference:Se,async:!1,expects:`>=${e instanceof Date?e.toJSON():ge(e)}`,requirement:e,message:o,"~run"(n,s){return n.typed&&!(n.value>=this.requirement)&&j(this,"value",n,s,{received:n.value instanceof Date?n.value.toJSON():ge(n.value)}),n}}}function Fe(e,o){return{kind:"validation",type:"regex",reference:Fe,async:!1,expects:`${e}`,requirement:e,message:o,"~run"(n,s){return n.typed&&!this.requirement.test(n.value)&&j(this,"format",n,s),n}}}function Ue(e){return{kind:"transformation",type:"transform",reference:Ue,async:!1,operation:e,"~run"(o){return o.value=this.operation(o.value),o}}}var ot={abortEarly:!0};function it(e,o,n){return typeof e.fallback=="function"?e.fallback(o,n):e.fallback}function De(e,o,n){return typeof e.default=="function"?e.default(o,n):e.default}function st(e,o){return!e["~run"]({value:o},ot).issues}function E(e,o){return{kind:"schema",type:"array",reference:E,expects:"Array",async:!1,item:e,message:o,get"~standard"(){return U(this)},"~run"(n,s){let c=n.value;if(Array.isArray(c)){n.typed=!0,n.value=[];for(let l=0;l<c.length;l++){let f=c[l],y=this.item["~run"]({value:f},s);if(y.issues){let m={type:"array",origin:"value",input:c,key:l,value:f};for(let S of y.issues)S.path?S.path.unshift(m):S.path=[m],n.issues?.push(S);if(n.issues||(n.issues=y.issues),s.abortEarly){n.typed=!1;break}}y.typed||(n.typed=!1),n.value.push(y.value)}}else j(this,"type",n,s);return n}}}function b(e){return{kind:"schema",type:"boolean",reference:b,expects:"boolean",async:!1,message:e,get"~standard"(){return U(this)},"~run"(o,n){return typeof o.value=="boolean"?o.typed=!0:j(this,"type",o,n),o}}}function i(e,o){return{kind:"schema",type:"literal",reference:i,expects:ge(e),async:!1,literal:e,message:o,get"~standard"(){return U(this)},"~run"(n,s){return n.value===this.literal?n.typed=!0:j(this,"type",n,s),n}}}function ze(e){return{kind:"schema",type:"nan",reference:ze,expects:"NaN",async:!1,message:e,get"~standard"(){return U(this)},"~run"(o,n){return Number.isNaN(o.value)?o.typed=!0:j(this,"type",o,n),o}}}function Z(e,o){return{kind:"schema",type:"nullable",reference:Z,expects:`(${e.expects} | null)`,async:!1,wrapped:e,default:o,get"~standard"(){return U(this)},"~run"(n,s){return n.value===null&&(this.default!==void 0&&(n.value=De(this,n,s)),n.value===null)?(n.typed=!0,n):this.wrapped["~run"](n,s)}}}function O(e){return{kind:"schema",type:"number",reference:O,expects:"number",async:!1,message:e,get"~standard"(){return U(this)},"~run"(o,n){return typeof o.value=="number"&&!isNaN(o.value)?o.typed=!0:j(this,"type",o,n),o}}}function r(e,o){return{kind:"schema",type:"object",reference:r,expects:"Object",async:!1,entries:e,message:o,get"~standard"(){return U(this)},"~run"(n,s){let c=n.value;if(c&&typeof c=="object"){n.typed=!0,n.value={};for(let l in this.entries){let f=this.entries[l];if(l in c||(f.type==="exact_optional"||f.type==="optional"||f.type==="nullish")&&f.default!==void 0){let y=l in c?c[l]:De(f),m=f["~run"]({value:y},s);if(m.issues){let S={type:"object",origin:"value",input:c,key:l,value:y};for(let I of m.issues)I.path?I.path.unshift(S):I.path=[S],n.issues?.push(I);if(n.issues||(n.issues=m.issues),s.abortEarly){n.typed=!1;break}}m.typed||(n.typed=!1),n.value[l]=m.value}else if(f.fallback!==void 0)n.value[l]=it(f);else if(f.type!=="exact_optional"&&f.type!=="optional"&&f.type!=="nullish"&&(j(this,"key",n,s,{input:void 0,expected:`"${l}"`,path:[{type:"object",origin:"key",input:c,key:l,value:c[l]}]}),s.abortEarly))break}}else j(this,"type",n,s);return n}}}function a(e,o){return{kind:"schema",type:"optional",reference:a,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:o,get"~standard"(){return U(this)},"~run"(n,s){return n.value===void 0&&(this.default!==void 0&&(n.value=De(this,n,s)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,s)}}}function D(e,o){return{kind:"schema",type:"picklist",reference:D,expects:Ne(e.map(ge),"|"),async:!1,options:e,message:o,get"~standard"(){return U(this)},"~run"(n,s){return this.options.includes(n.value)?n.typed=!0:j(this,"type",n,s),n}}}function z(e,o,n){return{kind:"schema",type:"record",reference:z,expects:"Object",async:!1,key:e,value:o,message:n,get"~standard"(){return U(this)},"~run"(s,c){let l=s.value;if(l&&typeof l=="object"){s.typed=!0,s.value={};for(let f in l)if(Gr(l,f)){let y=l[f],m=this.key["~run"]({value:f},c);if(m.issues){let I={type:"object",origin:"key",input:l,key:f,value:y};for(let B of m.issues)B.path=[I],s.issues?.push(B);if(s.issues||(s.issues=m.issues),c.abortEarly){s.typed=!1;break}}let S=this.value["~run"]({value:y},c);if(S.issues){let I={type:"object",origin:"value",input:l,key:f,value:y};for(let B of S.issues)B.path?B.path.unshift(I):B.path=[I],s.issues?.push(B);if(s.issues||(s.issues=S.issues),c.abortEarly){s.typed=!1;break}}(!m.typed||!S.typed)&&(s.typed=!1),m.typed&&(s.value[m.value]=S.value)}}else j(this,"type",s,c);return s}}}function p(e,o){return{kind:"schema",type:"strict_object",reference:p,expects:"Object",async:!1,entries:e,message:o,get"~standard"(){return U(this)},"~run"(n,s){let c=n.value;if(c&&typeof c=="object"){n.typed=!0,n.value={};for(let l in this.entries){let f=this.entries[l];if(l in c||(f.type==="exact_optional"||f.type==="optional"||f.type==="nullish")&&f.default!==void 0){let y=l in c?c[l]:De(f),m=f["~run"]({value:y},s);if(m.issues){let S={type:"object",origin:"value",input:c,key:l,value:y};for(let I of m.issues)I.path?I.path.unshift(S):I.path=[S],n.issues?.push(I);if(n.issues||(n.issues=m.issues),s.abortEarly){n.typed=!1;break}}m.typed||(n.typed=!1),n.value[l]=m.value}else if(f.fallback!==void 0)n.value[l]=it(f);else if(f.type!=="exact_optional"&&f.type!=="optional"&&f.type!=="nullish"&&(j(this,"key",n,s,{input:void 0,expected:`"${l}"`,path:[{type:"object",origin:"key",input:c,key:l,value:c[l]}]}),s.abortEarly))break}if(!n.issues||!s.abortEarly){for(let l in c)if(!(l in this.entries)){j(this,"key",n,s,{input:l,expected:"never",path:[{type:"object",origin:"key",input:c,key:l,value:c[l]}]});break}}}else j(this,"type",n,s);return n}}}function t(e){return{kind:"schema",type:"string",reference:t,expects:"string",async:!1,message:e,get"~standard"(){return U(this)},"~run"(o,n){return typeof o.value=="string"?o.typed=!0:j(this,"type",o,n),o}}}function nt(e){let o;if(e)for(let n of e)if(o)for(let s of n.issues)o.push(s);else o=n.issues;return o}function x(e,o){return{kind:"schema",type:"union",reference:x,expects:Ne(e.map(n=>n.expects),"|"),async:!1,options:e,message:o,get"~standard"(){return U(this)},"~run"(n,s){let c,l,f;for(let y of this.options){let m=y["~run"]({value:n.value},s);if(m.typed)if(m.issues)l?l.push(m):l=[m];else{c=m;break}else f?f.push(m):f=[m]}if(c)return c;if(l){if(l.length===1)return l[0];j(this,"type",n,s,{issues:nt(l)}),n.typed=!0}else{if(f?.length===1)return f[0];j(this,"type",n,s,{issues:nt(f)})}return n}}}function Ie(){return{kind:"schema",type:"unknown",reference:Ie,expects:"unknown",async:!1,get"~standard"(){return U(this)},"~run"(e){return e.typed=!0,e}}}function h(e,o,n){return{kind:"schema",type:"variant",reference:h,expects:"Object",async:!1,key:e,options:o,message:n,get"~standard"(){return U(this)},"~run"(s,c){let l=s.value;if(l&&typeof l=="object"){let f,y=0,m=this.key,S=[],I=(B,k)=>{for(let L of B.options){if(L.type==="variant")I(L,new Set(k).add(L.key));else{let W=!0,T=0;for(let R of k){let N=L.entries[R];if(R in l?N["~run"]({typed:!1,value:l[R]},ot).issues:N.type!=="exact_optional"&&N.type!=="optional"&&N.type!=="nullish"){W=!1,m!==R&&(y<T||y===T&&R in l&&!(m in l))&&(y=T,m=R,S=[]),m===R&&S.push(L.entries[R].expects);break}T++}if(W){let R=L["~run"]({value:l},c);(!f||!f.typed&&R.typed)&&(f=R)}}if(f&&!f.issues)break}};if(I(this,new Set([this.key])),f)return f;j(this,"type",s,c,{input:l[m],expected:Ne(S,"|"),path:[{type:"object",origin:"value",input:l,key:m,value:l[m]}]})}else j(this,"type",s,c);return s}}}function ut(e,o){let n={...e.entries};for(let s of o)delete n[s];return{...e,entries:n,get"~standard"(){return U(this)}}}function fe(e,o,n){let s=e["~run"]({value:o},Te(n));if(s.issues)throw new Vr(s.issues);return s.value}function H(...e){return{...e[0],pipe:e,get"~standard"(){return U(this)},"~run"(o,n){for(let s of e)if(s.kind!=="metadata"){if(o.issues&&(s.kind==="schema"||s.kind==="transformation")){o.typed=!1;break}(!o.issues||!n.abortEarly&&!n.abortPipeEarly)&&(o=s["~run"](o,n))}return o}}}function xe(e,o,n){let s=e["~run"]({value:o},Te(n));return{typed:s.typed,success:!s.issues,output:s.value,issues:s.issues}}var re=H(t(),te("NotionBlockId")),Y=H(t(),te("NotionDataSourceId")),q=H(t(),te("NotionPageId")),at=H(t(),te("NotionAgentId")),ct=H(t(),te("NotionSpaceId"));var lt=D(["default","gray","brown","orange","yellow","green","blue","purple","pink","red","gray_background","brown_background","orange_background","yellow_background","green_background","blue_background","purple_background","pink_background","red_background","default_background"]),He=r({id:t(),name:t(),color:a(lt),description:a(t())}),$r=r({id:t(),name:t(),color:a(lt),option_ids:E(t())}),Qr=r({synced_property_id:t(),synced_property_name:t()}),P=r({name:t(),description:a(t())}),Xr=["title","rich_text","number","checkbox","url","email","phone_number","select","multi_select","status","date","people","files","unique_id","relation","place","formula","rollup","button","verification","last_visited_time","location","created_time","last_edited_time","created_by","last_edited_by"],pt=D(Xr),ft=["title","rich_text","number","checkbox","url","email","phone_number","date","created_time","last_edited_time","people","created_by"],Le=h("type",[r({...P.entries,type:i("title")}),r({...P.entries,type:i("rich_text")}),r({...P.entries,type:i("number")}),r({...P.entries,type:i("checkbox")}),r({...P.entries,type:i("url")}),r({...P.entries,type:i("email")}),r({...P.entries,type:i("phone_number")}),r({...P.entries,type:i("select"),options:E(He)}),r({...P.entries,type:i("multi_select"),options:E(He)}),r({...P.entries,type:i("status"),options:E(He),groups:E($r)}),r({...P.entries,type:i("date")}),r({...P.entries,type:i("people")}),r({...P.entries,type:i("files")}),r({...P.entries,type:i("unique_id")}),r({...P.entries,type:i("relation"),data_source_id:a(t()),dual_property:a(Qr)}),r({...P.entries,type:i("place")}),r({...P.entries,type:i("formula")}),r({...P.entries,type:i("rollup")}),r({...P.entries,type:i("button")}),r({...P.entries,type:i("verification")}),r({...P.entries,type:i("last_visited_time")}),r({...P.entries,type:i("location")}),r({...P.entries,type:i("created_time")}),r({...P.entries,type:i("last_edited_time")}),r({...P.entries,type:i("created_by")}),r({...P.entries,type:i("last_edited_by")})]);var mt={created_time:{type:"created_time",name:"Created time"},last_edited_time:{type:"last_edited_time",name:"Last edited time"},created_by:{type:"created_by",name:"Created by"},last_edited_by:{type:"last_edited_by",name:"Last edited by"}};var yt=r({id:Y,table:t(),spaceId:a(ct)}),vt=r({id:a(Y),propertiesById:z(t(),Le)}),fo=r({key:t(),collectionPointer:a(yt),collectionSchema:a(vt),propertyIdsByKey:z(t(),a(t())),propertySchemasById:z(t(),Le)}),Wr=r({collectionPointer:a(yt),collectionSchema:a(vt),propertyIdsByKey:a(z(t(),a(t())))}),le=z(t(),Wr);var Jr=h("type",[r({type:i("emoji"),emoji:t()}),r({type:i("external"),url:t()})]),Kr=r({name:t(),description:a(t()),type:pt}),Zr=r({name:t(),description:a(t()),icon:a(Jr),properties:a(z(t(),Kr),{})}),pe=r({version:i(1),name:a(t()),description:a(t()),slashCommand:a(t()),icon:a(r({type:i("emoji"),emoji:t()})),dataSources:a(z(t(),Zr),{})});var me=D(["standard","high"]),dt="standard";var ht=r({type:i("contrastModeChanged"),contrastMode:me});var ne=h("type",[r({type:i("page_id"),page_id:q}),r({type:i("data_source_id"),data_source_id:Y}),r({type:i("workspace"),workspace:i(!0)}),r({type:i("block_id"),block_id:re}),r({type:i("agent_id"),agent_id:at}),r({type:i("unavailable")})]);var ye=h("type",[r({type:i("unavailable")}),r({type:i("page"),id:q,parent:ne})]),Yr=r({type:i("emoji"),emoji:t()}),en=r({type:i("custom_emoji"),custom_emoji:r({id:t(),name:a(t()),url:a(t())})}),bt=r({type:i("external"),external:r({url:t()})}),kt=r({type:i("file"),file:r({url:t(),expiry_time:a(t())})}),Ve=h("type",[Yr,en,bt,kt]),$e=h("type",[bt,kt]),X=Z(t()),gt=z(t(),Ie()),Ge=x([r({id:t(),name:a(t()),color:a(t()),description:a(X)}),r({name:t(),id:a(t()),color:a(t()),description:a(X)})]),tn=r({start:t(),end:a(X),time_zone:a(X)}),rn=x([r({object:a(i("user")),id:t()}),r({object:i("group"),id:t(),name:a(X)})]),nn=r({id:t()}),on=x([r({type:i("external"),name:t(),external:r({url:t()})}),r({type:i("file"),name:t(),file:r({url:t(),expiry_time:a(t())})})]),sn=r({lat:O(),lon:O(),name:a(X),address:a(X),aws_place_id:a(X),google_place_id:a(X)}),V={id:t()},un=h("type",[r({...V,type:i("title"),title:E(gt)}),r({...V,type:i("rich_text"),rich_text:E(gt)}),r({...V,type:i("number"),number:Z(O())}),r({...V,type:i("url"),url:X}),r({...V,type:i("email"),email:X}),r({...V,type:i("phone_number"),phone_number:X}),r({...V,type:i("checkbox"),checkbox:b()}),r({...V,type:i("select"),select:Z(Ge)}),r({...V,type:i("status"),status:Z(Ge)}),r({...V,type:i("multi_select"),multi_select:E(Ge)}),r({...V,type:i("date"),date:Z(tn)}),r({...V,type:i("people"),people:E(rn)}),r({...V,type:i("relation"),has_more:a(b()),relation:E(nn)}),r({...V,type:i("files"),files:E(on)}),r({...V,type:i("place"),place:Z(sn)})]),_e=z(t(),un),ve=r({object:i("page"),id:q,parent:ne,properties:_e,created_time:a(t()),last_edited_time:a(t()),icon:a(Ve),cover:a($e),url:a(t()),public_url:a(t()),is_archived:b(),in_trash:b()});var an=t(),cn=r({code:an,message:t(),isRetryable:b()}),St=h("status",[r({type:i("createPageResult"),requestId:t(),status:i("success"),page:ve}),r({type:i("createPageResult"),requestId:t(),status:i("error"),error:cn})]);var Qe=H(t(),te("NotionUserId")),oe=r({object:i("user"),id:Qe,name:a(t()),avatar_url:Z(t()),type:i("person"),person:r({email:t()})}),It=r({object:i("list"),results:E(oe),next_cursor:Z(t()),has_more:b(),type:i("user"),user:z(t(),Ie())});var xt=r({type:i("currentUserChanged"),currentUser:oe});var _t=r({type:i("dataSourcesChanged"),dataSources:r({bindings:le})});var ln=t(),pn=r({code:ln,message:t(),isRetryable:b()}),Ct=r({type:i("getPage"),requestId:t(),pageId:q}),Ot=h("status",[r({type:i("getPageResult"),requestId:t(),status:i("success"),page:ve}),r({type:i("getPageResult"),requestId:t(),status:i("error"),error:pn})]);var fn=t(),mn=r({code:fn,message:t(),isRetryable:b()}),Et=r({type:i("getUser"),requestId:t(),userId:Qe}),Pt=h("status",[r({type:i("getUserResult"),requestId:t(),status:i("success"),user:oe}),r({type:i("getUserResult"),requestId:t(),status:i("error"),error:mn})]);var de=D(["light","dark"]);var yn=t(),vn=r({code:yn,message:t(),isRetryable:b()});var we=h("status",[r({type:i("init"),initializationId:t(),status:i("success"),theme:de,contrastMode:me,blockId:re,parent:ne,page:ye,manifest:pe,dataSources:r({bindings:le}),currentUser:oe}),r({type:i("init"),initializationId:t(),status:i("error"),error:vn})]);var jt=r({type:i("invalidSandboxMessage"),reason:t()});var dn=t(),hn=r({code:dn,message:t(),isRetryable:b()}),Bt=r({type:i("listUsers"),requestId:t(),startCursor:a(t()),pageSize:a(O())}),Rt=h("status",[r({type:i("listUsersResult"),requestId:t(),status:i("success"),list:It}),r({type:i("listUsersResult"),requestId:t(),status:i("error"),error:hn})]);var gn=D(["side_peek","center_peek"]),bn=t(),kn=r({code:bn,message:t(),isRetryable:b()}),Mt=r({type:i("openPage"),requestId:t(),pageId:q,mode:gn}),Dt=h("status",[r({type:i("openPageResult"),requestId:t(),status:i("success"),pageId:q}),r({type:i("openPageResult"),requestId:t(),status:i("error"),error:kn})]);var wt=r({type:i("pageChanged"),page:ye});var At=r({type:i("parentChanged"),parent:ne});var qt=r({unit:D(["year","month","week","day"]),value:O(),time:t(),defaultTimeZone:a(t())}),Sn=r({unit:D(["hour","minute"]),value:O()}),Tt=r({unit:i("none")}),In=x([qt,Sn]),Nt=a(x([qt,Tt])),Ft=a(x([In,Tt])),xn=r({type:i("date"),start_date:t(),reminder:Nt}),_n=r({type:i("daterange"),start_date:t(),end_date:t(),reminder:Nt}),Cn=r({type:i("datetime"),start_date:t(),start_time:t(),time_zone:a(t()),reminder:Ft}),On=r({type:i("datetimerange"),start_date:t(),start_time:t(),end_date:t(),end_time:t(),time_zone:a(t()),reminder:Ft}),Ut=h("type",[xn,_n,Cn,On]);var zt=r({id:t(),table:t()});var Ht=x([t(),O(),b(),Ut,E(t()),E(zt)]);var Lt=r({id:q,is_archived:b(),in_trash:b(),propertiesById:z(t(),a(Ht))});var En=t(),Pn=r({code:En,message:t(),isRetryable:b()}),Gt=h("status",[r({type:i("queryDataSourceResult"),subscriptionId:t(),status:i("success"),items:E(Lt),hasMore:b()}),r({type:i("queryDataSourceResult"),subscriptionId:t(),status:i("error"),error:Pn})]);var Vt=r({type:i("themeChanged"),theme:de});var jn=t(),Bn=r({code:jn,message:t(),isRetryable:b()}),$t=h("status",[r({type:i("updatePageResult"),requestId:t(),status:i("success"),page:ve}),r({type:i("updatePageResult"),requestId:t(),status:i("error"),error:Bn})]);var Qt=h("type",[we,Vt,ht,At,wt,xt,_t,Gt,St,Ot,Pt,Rt,Dt,$t,jt]);function Xt(){return{code:"no_connect",message:"Sandbox did not send a connect message.",isRetryable:!0}}function Wt(){return{code:"invalid_connect_payload",message:"Sandbox sent an invalid connect message.",isRetryable:!1}}function Xe(e){let{currentBridgeProtocolVersion:o}=e;return{code:"invalid_protocol_version",message:`Sandbox reported an invalid bridge protocol version: ${o}`,isRetryable:!1}}function We(e){let{currentBridgeProtocolVersion:o,minBridgeProtocolVersion:n}=e;return{code:"unsupported_protocol_version",message:`Sandbox bridge protocol version ${o} is not supported. Minimum supported version is ${n}.`,isRetryable:!1}}function Je(){return{code:"context_unavailable",message:"Host page context is unavailable.",isRetryable:!0}}function Jt(){return{code:"initial_state_timeout",message:"Host did not prepare initial state before the timeout.",isRetryable:!0}}function Kt(){return{code:"missing_data_source_binding",message:"A required data source is not mapped.",isRetryable:!1}}function Zt(){return{code:"missing_property_binding",message:"A required data source property is not mapped.",isRetryable:!1}}function Yt(){return{code:"invalid_property_binding",message:"A mapped data source property is missing or incompatible.",isRetryable:!1}}function er(){return{code:"no_init_result",message:"Sandbox did not acknowledge initialization.",isRetryable:!0}}function tr(){return{code:"invalid_init_result_payload",message:"Sandbox sent an invalid initialization result.",isRetryable:!1}}function rr(){return{code:"unknown_error",message:"Unexpected error while initializing custom block.",isRetryable:!1}}function ie(e){throw new Error(`[custom-blocks-host] Unexpected value encountered: ${JSON.stringify(e)}`)}function Ke(e){return Number.isFinite(e)&&Number.isInteger(e)&&e>=1}var Rn=5e3,Mn=5e3,Dn=5e3;function nr(e){let{prepareInit:o,sendInitMessage:n,warn:s,flushPendingHostStateChanges:c,minBridgeProtocolVersion:l,noConnectTimeoutMs:f=Rn,initialStateTimeoutMs:y=Mn,noInitResultTimeoutMs:m=Dn,stopHostWithFailure:S,onInitResult:I,onConnectionFailure:B}=e,k="waitingForConnect",L,W,T,R,N=!1,se=!1;function Q(){L!==void 0&&(window.clearTimeout(L),L=void 0)}function M(){W!==void 0&&(window.clearTimeout(W),W=void 0)}function F(){T!==void 0&&(window.clearTimeout(T),T=void 0)}function A(g){let{initializationId:v,error:G,phase:K,source:Be}=g;switch(k){case"waitingForConnect":case"preparingInit":break;case"waitingForInitResult":case"initialized":case"error":case"stopped":return;default:return ie(k)}k="error",R=v,Q(),M(),n({type:"init",initializationId:v,status:"error",error:G}),B?.({...G,phase:K,source:Be})}async function J(g){if(k==="waitingForConnect"){k="preparingInit",R=g.initializationId,Q(),W=window.setTimeout(()=>{if(k!=="preparingInit")return;let v=Jt();s({...v,initializationId:g.initializationId}),A({initializationId:g.initializationId,error:v,phase:"init",source:"host"})},y);try{let v=await o(g);if(k!=="preparingInit")return;if(M(),v.status==="error"){A({initializationId:g.initializationId,error:v.error,phase:"init",source:"host"});return}k="waitingForInitResult";let G={type:"init",initializationId:g.initializationId,status:"success",theme:v.initialState.theme,contrastMode:v.initialState.contrastMode??dt,blockId:v.initialState.blockId,parent:v.initialState.parent,page:v.initialState.page,currentUser:v.initialState.currentUser,manifest:v.initialState.manifest,dataSources:v.initialState.dataSources};n(G),T=window.setTimeout(()=>{if(k!=="waitingForInitResult")return;k="error";let K=er();B?.({...K,phase:"initResult",source:"host"}),s({...K,initializationId:g.initializationId})},m)}catch(v){if(k!=="preparingInit")return;s({message:"Failed to prepare custom block initialization",error:v}),A({initializationId:g.initializationId,error:rr(),phase:"init",source:"host"})}}}function ee(g){if(k!=="stopped"&&k==="waitingForConnect"){if(!Ke(g.bridgeProtocolVersion)){let v=Xe({currentBridgeProtocolVersion:g.bridgeProtocolVersion});A({initializationId:g.initializationId,error:v,phase:"connect",source:"host"});return}if(g.bridgeProtocolVersion<l){let v=We({currentBridgeProtocolVersion:g.bridgeProtocolVersion,minBridgeProtocolVersion:l});A({initializationId:g.initializationId,error:v,phase:"connect",source:"host"});return}if(g.status==="error"){A({initializationId:g.initializationId,error:g.error,phase:"connect",source:"sandbox"});return}se=!0,J(g)}}function _(g){if(k==="stopped"||k!=="waitingForConnect")return"handled";let{initializationId:v,bridgeProtocolVersion:G}=g;if(v===void 0)return"nack";let K=g.error;return G!==void 0&&(Ke(G)?G<l&&(K=We({currentBridgeProtocolVersion:G,minBridgeProtocolVersion:l})):K=Xe({currentBridgeProtocolVersion:G})),A({initializationId:v,error:K,phase:"connect",source:"host"}),"handled"}function ue(g){let{initializationId:v,error:G}=g;k!=="waitingForInitResult"||v===void 0||v!==R||(Q(),F(),k="error",s(G),B?.({...G,phase:"initResult",source:"host"}))}function je(){if(k!=="stopped"){if(N){S({phase:"runtime",source:"host",code:"iframe_reloaded",message:"The iframe reloaded. Create a new host and iframe to reconnect.",isRetryable:!0});return}N=!0,Q(),k==="waitingForConnect"&&(L=window.setTimeout(()=>{if(k!=="waitingForConnect")return;k="error";let g=Xt();s(g),B?.({...g,phase:"connect",source:"host"})},f))}}function he(g){if(k!=="waitingForInitResult"||g.initializationId!==R){s({message:"Ignored stale or unexpected initResult",payload:g});return}F(),k=g.status==="success"?"initialized":"error",g.status==="success"?c():B?.({...g.error,phase:"initResult",source:"sandbox"}),I?.(g)}function ae(){k="stopped",Q(),M(),F()}return{get status(){return k},get hasConnectedSandbox(){return se},handleConnect:ee,handleInitResult:he,handleInvalidConnect:_,handleInvalidInitResult:ue,onIframeLoad:je,stop:ae}}function or(e,o){return o>=5||!(e.type==="init"&&e.status==="success"||e.type==="dataSourcesChanged")?e:{...e,dataSources:{bindings:Object.fromEntries(Object.entries(e.dataSources.bindings).map(([s,c])=>[s,{...c,collectionSchema:{...c.collectionSchema,propertiesById:{...c.collectionSchema?.propertiesById,...mt}}}]))}}}var ir=r({theme:de,contrastMode:a(me),blockId:re,parent:ne,page:ye,manifest:pe,dataSources:r({bindings:le}),currentUser:oe});function sr(e){switch(e.type){case"connect":case"init":case"initResult":return!0;default:return!1}}var ur=r({code:t(),message:t(),isRetryable:b()});var ar={type:i("connect"),initializationId:t(),bridgeProtocolVersion:O(),sdkVersion:t()},cr=h("status",[r({status:i("success"),manifest:a(pe),...ar}),r({status:i("error"),error:ur,...ar})]);var wn=h("type",[r({type:i("start")}),r({type:i("end")}),r({type:i("before"),blockId:re}),r({type:i("after"),blockId:re})]),An=h("type",[r({type:i("page_id"),page_id:q}),r({type:i("data_source_id"),data_source_id:Y})]),lr=r({type:i("createPage"),requestId:t(),parent:An,properties:_e,position:a(wn)});var qn=t(),Tn=r({code:qn,message:t(),isRetryable:b()}),pr=h("status",[r({type:i("initResult"),initializationId:t(),status:i("success"),initialHeight:a(H(O(),be(),Se(0)))}),r({type:i("initResult"),initializationId:t(),status:i("error"),error:Tn})]);var fr=r({type:i("invalidHostMessage"),reason:t()});var mr=D(["ascending","descending"]);var yr=H(q,Fe(/^(?:[0-9a-f]{32}|[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})$/i),Ue(e=>e.replaceAll("-","").toLowerCase().replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/,"$1-$2-$3-$4-$5"))),Ze=x([p({contains:yr}),p({does_not_contain:yr})]),Pe=x([p({is_empty:i(!0)}),p({is_not_empty:i(!0)})]),Ee=x([t(),E(t())]),vr=p({object:D(["user","group"]),id:H(t(),ke(1))}),Nn=x([p({contains:vr}),p({does_not_contain:vr}),Pe]),dr=p({object:i("user"),id:H(t(),ke(1),Me(2e3))}),Fn=x([p({contains:dr}),p({does_not_contain:dr}),p({is_empty:i(!0)}),p({is_not_empty:i(!0)})]),Ce=x([p({equals:t()}),p({does_not_equal:t()}),p({contains:t()}),p({does_not_contain:t()}),p({starts_with:t()}),p({ends_with:t()}),Pe]),Un=x([p({equals:O()}),p({does_not_equal:O()}),p({greater_than:O()}),p({less_than:O()}),p({greater_than_or_equal_to:O()}),p({less_than_or_equal_to:O()}),Pe]),zn=x([p({equals:b()}),p({does_not_equal:b()})]),kr=x([p({equals:Ee}),p({does_not_equal:Ee}),Pe]),hr=D(["To-do","In progress","Complete","Current","Future"]),gr=x([hr,H(E(hr),ke(1),Me(5))]),Hn=x([p({group_equals:gr}),p({group_does_not_equal:gr})]),Ln=x([kr,Hn]),Gn=x([p({contains:Ee}),p({contains_all:Ee}),p({does_not_contain:Ee}),Pe]),$=D(["start_date","end_date"]),Vn=D(["today","tomorrow","yesterday","one_week_ago","one_week_from_now","one_month_ago","one_month_from_now"]),Oe=x([Vn,t()]),$n=x([p({target:a($),equals:Oe}),p({target:a($),before:Oe}),p({target:a($),after:Oe}),p({target:a($),on_or_before:Oe}),p({target:a($),on_or_after:Oe}),p({target:a($),this_week:p({})}),p({target:a($),past_week:p({})}),p({target:a($),past_month:p({})}),p({target:a($),past_year:p({})}),p({target:a($),next_week:p({})}),p({target:a($),next_month:p({})}),p({target:a($),next_year:p({})}),p({target:a($),is_empty:i(!0)}),p({target:a($),is_not_empty:i(!0)})]),br=x([p({propertyId:t(),relation:Ze}),p({propertyId:t(),created_by:Fn}),p({propertyId:t(),title:Ce}),p({propertyId:t(),rich_text:Ce}),p({propertyId:t(),url:Ce}),p({propertyId:t(),email:Ce}),p({propertyId:t(),phone_number:Ce}),p({propertyId:t(),number:Un}),p({propertyId:t(),checkbox:zn}),p({propertyId:t(),select:kr}),p({propertyId:t(),multi_select:Gn}),p({propertyId:t(),status:Ln}),p({propertyId:t(),date:$n}),p({propertyId:t(),people:Nn})]),Qn=x([br,p({and:E(br)})]),Ye=10,Xn=p({propertyId:t(),direction:mr}),Sr=r({type:i("queryDataSource"),subscriptionId:t(),dataSourceId:Y,limit:O(),filter:a(Qn),sorts:a(E(Xn))});var Ir=r({type:i("resize"),height:H(O(),be(),Se(0))});var xr=r({type:i("unsubscribeDataSourceQuery"),subscriptionId:t()});var _r=r({type:i("updatePage"),requestId:t(),pageId:q,properties:a(_e),icon:a(Ve),cover:a($e),archived:a(b())});var Cr=h("type",[cr,pr,Sr,xr,lr,Ct,Et,Bt,Mt,_r,Ir,fr]);function Or(e){if(typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string")return e.type}function Er(e){let o=Or(e);return o==="invalidHostMessage"||o==="invalidSandboxMessage"?{incomingType:o}:{incomingType:o,nack:{type:"invalidSandboxMessage",reason:Wn(o)}}}function Wn(e){return e!==void 0?`Unsupported sandbox message of type "${e}"`:"Unsupported sandbox message (no `type` field or non-object payload)"}var Pr=r({initializationId:t()}),Jn=r({bridgeProtocolVersion:x([O(),ze()])});function jr(e){let{iframe:o,sandboxOrigin:n,getInitStatus:s,emit:c,sendNack:l,onInvalidConnect:f,onInvalidInitResult:y,onConnect:m,onInitResult:S,onQueryDataSource:I,onUnsubscribeDataSourceQuery:B,onCreatePage:k,onGetPage:L,onOpenPage:W,onGetUser:T,onListUsers:R,onUpdatePage:N,onResize:se}=e;function Q(M,F){c("warn",{message:"Ignored unsupported sandbox message",payload:M,issues:F});let A=Er(M);if(A.incomingType==="connect"){let J=xe(Pr,M),ee=xe(Jn,M);if(f({initializationId:J.success?J.output.initializationId:void 0,error:Wt(),bridgeProtocolVersion:ee.success?ee.output.bridgeProtocolVersion:void 0})==="handled")return}if(A.incomingType==="initResult"){let J=xe(Pr,M);y({initializationId:J.success?J.output.initializationId:void 0,error:tr()})}A.nack!==void 0&&s()!=="stopped"&&l(A.nack)}return function(F){let A=F.source===o.contentWindow,J=F.origin===n;if(!A||!J)return;let ee=xe(Cr,F.data);if(!ee.success){Q(F.data,ee.issues);return}let _=ee.output;if(!sr(_)&&s()!=="initialized"){c("warn",{message:`Ignored ${_.type} before initialization completed`,payload:_});return}switch(c("in",_),_.type){case"connect":m(_);return;case"initResult":S(_);return;case"queryDataSource":I(_);return;case"unsubscribeDataSourceQuery":B(_);return;case"createPage":k(_);return;case"openPage":W(_);return;case"getPage":L(_);return;case"getUser":T(_);return;case"listUsers":R(_);return;case"updatePage":N(_);return;case"resize":se(_);return;case"invalidHostMessage":return;default:ie(_)}}}var Ae=class{constructor(o){this.onUnsubscribe=o}onUnsubscribe;bySubscriptionId=new Map;subscribe(o){this.unsubscribe(o.subscriptionId);let n={_tag:"QuerySubscriptionToken"};return this.bySubscriptionId.set(o.subscriptionId,{message:o,token:n,isRefreshing:!0,shouldRefreshAgain:!1}),n}isCurrent(o,n){return this.bySubscriptionId.get(o)?.token===n}unsubscribe(o){this.bySubscriptionId.delete(o)&&this.onUnsubscribe(o)}refresh(o){let n=[],s=!1;for(let c of this.bySubscriptionId.values())if(c.message.dataSourceId===o){if(s=!0,c.isRefreshing){c.shouldRefreshAgain=!0;continue}c.isRefreshing=!0,n.push({message:c.message,token:c.token})}return s?n:void 0}finish(o,n){let s=this.bySubscriptionId.get(o);if(s?.token===n&&(s.isRefreshing=!1,!!s.shouldRefreshAgain))return s.shouldRefreshAgain=!1,s.isRefreshing=!0,{message:s.message,token:s.token}}unsubscribeAll(){for(let o of this.bySubscriptionId.keys())this.unsubscribe(o)}};function Br(e,o){if(e===void 0)return;let n="and"in e?e.and:[e];for(let s of n){let c=Kn(s,o);if(c!==void 0)return c}}function Kn(e,o){if(!Object.hasOwn(o.propertiesById,e.propertyId))return{code:"invalid_data_source_query_filter",message:`Data source query filter property ID "${e.propertyId}" is not defined in the bound data source schema.`,isRetryable:!1};let n=o.propertiesById[e.propertyId],s=Object.keys(e).find(y=>y!=="propertyId");if(s!==n.type)return{code:"invalid_data_source_query_filter",message:`Data source query filter branch "${s}" does not match property type "${n.type}".`,isRetryable:!1};if("status"in e&&n.type==="status"){let y=e.status;if("group_equals"in y||"group_does_not_equal"in y){let m="group_equals"in y?y.group_equals:y.group_does_not_equal,I=(Array.isArray(m)?m:[m]).find(B=>!n.groups.some(k=>k.name===B));return I===void 0?void 0:{code:"invalid_data_source_query_filter",message:`Unknown status group "${I}".`,isRetryable:!1}}}if("relation"in e&&!st(Ze,e.relation))return{code:"invalid_data_source_query_filter",message:"Relation filters require a page ID.",isRetryable:!1};let c=Zn(e);if(c===void 0||n.type!==c.propertyType)return;let l=new Set(n.options.map(y=>y.name)),f=Yn(c.operator).find(y=>!l.has(y));if(f!==void 0)return{code:"invalid_data_source_query_filter",message:`Data source query filter option "${f}" is not defined for property "${e.propertyId}".`,isRetryable:!1}}function Zn(e){if("select"in e)return{propertyType:"select",operator:e.select};if("multi_select"in e)return{propertyType:"multi_select",operator:e.multi_select};if("status"in e){let o=e.status;return"group_equals"in o||"group_does_not_equal"in o?void 0:{propertyType:"status",operator:o}}}function Yn(e){let o;if("equals"in e)o=e.equals;else if("does_not_equal"in e)o=e.does_not_equal;else if("contains"in e)o=e.contains;else if("contains_all"in e)o=e.contains_all;else if("does_not_contain"in e)o=e.does_not_contain;else return"is_empty"in e||"is_not_empty"in e?[]:ie(e);return Array.isArray(o)?o:[o]}var eo=new Set(ft);function Rr(e,o){if(e===void 0)return;if(e.length>Ye)return{code:"invalid_data_source_query_sort",message:`Data source query sorts may contain at most ${Ye} entries.`,isRetryable:!1};let n=new Set;for(let s of e){if(n.has(s.propertyId))return{code:"invalid_data_source_query_sort",message:`Data source query sorts cannot contain duplicate property ID "${s.propertyId}".`,isRetryable:!1};if(n.add(s.propertyId),!Object.hasOwn(o.propertiesById,s.propertyId))return{code:"invalid_data_source_query_sort",message:`Data source query sort property ID "${s.propertyId}" is not defined in the bound data source schema.`,isRetryable:!1};let c=o.propertiesById[s.propertyId];if(!eo.has(c.type))return{code:"invalid_data_source_query_sort",message:`Data source query sorts do not yet support property type "${c.type}".`,isRetryable:!1}}}var Dr=5;function ro(e){let{iframe:o,getInitialState:n,handlers:s,onManifest:c,onInitialized:l,onConnectionFailure:f,onLog:y,onQueryUnsubscribed:m,sandboxOrigin:S,minBridgeProtocolVersion:I,noConnectTimeoutMs:B,initialStateTimeoutMs:k,noInitResultTimeoutMs:L}=e,W=Math.max(I??3,3),T={},R=!1,N,se,Q=5,M=new Ae(u=>{m?.(u)});function F(u,C){y?.(u,C)}function A(u){let C=v.status;switch(C){case"waitingForConnect":case"preparingInit":case"waitingForInitResult":case"initialized":case"error":break;case"stopped":return;default:return ie(C)}let w=or(u,Q);F("out",w),o.contentWindow?.postMessage(w,S)}function J(u){A(fe(we,u))}function ee(u){A(u)}function _(u){let C=v.status;switch(C){case"initialized":A(fe(Qt,u));return;case"waitingForConnect":case"preparingInit":case"waitingForInitResult":case"error":case"stopped":return;default:ie(C)}}async function ue(u,C){if(C===void 0)return;let w=await C(u);_({type:`${u.type}Result`,requestId:u.requestId,...w})}function je(u){let C=u.response.status==="error"?{type:"queryDataSourceResult",subscriptionId:u.subscriptionId,status:"error",error:u.response.error}:{type:"queryDataSourceResult",subscriptionId:u.subscriptionId,status:"success",items:u.response.items,hasMore:u.response.hasMore};_(C)}async function he(u,C=M.subscribe(u)){try{let w=no(se,u.dataSourceId),ce=oo(u,w);if(ce!==void 0){M.isCurrent(u.subscriptionId,C)&&(M.unsubscribe(u.subscriptionId),je({subscriptionId:u.subscriptionId,response:{status:"error",error:ce}}));return}let qe=await s.queryDataSource(u);if(!M.isCurrent(u.subscriptionId,C))return;qe.status==="error"&&!qe.error.isRetryable&&M.unsubscribe(u.subscriptionId),je({subscriptionId:u.subscriptionId,response:qe})}finally{let w=M.finish(u.subscriptionId,C);w!==void 0&&he(w.message,w.token)}}function ae(u){v.status==="stopped"||v.status==="error"||(Object.assign(T,u),g())}function g(){if(v.status!=="initialized")return;let u=T;T={},u.theme!==void 0&&_({type:"themeChanged",theme:u.theme}),u.contrastMode!==void 0&&_({type:"contrastModeChanged",contrastMode:u.contrastMode}),u.parent!==void 0&&_({type:"parentChanged",parent:u.parent}),u.page!==void 0&&_({type:"pageChanged",page:u.page}),u.dataSources!==void 0&&_({type:"dataSourcesChanged",dataSources:u.dataSources}),u.currentUser!==void 0&&_({type:"currentUserChanged",currentUser:u.currentUser})}let v=nr({async prepareInit(u){Q=u.bridgeProtocolVersion;let C=await n(u);return v.status!=="preparingInit"?C:G(C)},sendInitMessage:J,warn:u=>F("warn",u),flushPendingHostStateChanges:g,minBridgeProtocolVersion:W,noConnectTimeoutMs:B,initialStateTimeoutMs:k,noInitResultTimeoutMs:L,stopHostWithFailure:et,onInitResult(u){u.status==="success"&&N!==void 0&&l?.({manifest:N,initialHeight:u.initialHeight})},onConnectionFailure:f});function G(u){if(u.status==="error")return u;N=fe(pe,u.initialState.manifest),c?.(N);let C={...u.initialState,...T};T={};let w={...fe(ut(ir,["manifest"]),C),manifest:N};if(Q<Dr&&w.page.type==="unavailable")return{status:"error",error:Je()};let ce=wr(w.manifest,w.dataSources);return ce!==void 0?{status:"error",error:ce}:(se=w.dataSources,R=!0,{status:"success",initialState:w})}let K=jr({iframe:o,sandboxOrigin:S,getInitStatus:()=>v.status,emit:F,sendNack:ee,onInvalidConnect:v.handleInvalidConnect,onInvalidInitResult:v.handleInvalidInitResult,onConnect:v.handleConnect,onInitResult:v.handleInitResult,onQueryDataSource:he,onUnsubscribeDataSourceQuery:u=>M.unsubscribe(u.subscriptionId),onCreatePage:u=>ue(u,s.createPage),onGetPage:u=>ue(u,s.getPage),onOpenPage:u=>ue(u,s.openPage),onGetUser:u=>ue(u,s.getUser),onListUsers:u=>ue(u,s.listUsers),onUpdatePage:u=>ue(u,s.updatePage),onResize:u=>s.resize?.(u)});window.addEventListener("message",K),o.addEventListener("load",v.onIframeLoad);function Be(){window.removeEventListener("message",K),o.removeEventListener("load",v.onIframeLoad),v.stop(),M.unsubscribeAll()}function et(u){Be(),F("warn",u),f?.(u)}return{stop:Be,setTheme(u){ae({theme:u})},setContrastMode(u){ae({contrastMode:u})},setParent(u){ae({parent:u})},setPage(u){if(u.type==="unavailable"&&Q<Dr&&(v.status==="preparingInit"&&R||v.status==="waitingForInitResult"||v.status==="initialized")){et({...Je(),phase:"runtime",source:"host"});return}ae({page:u})},setCurrentUser(u){ae({currentUser:u})},setDataSources(u){let C={bindings:fe(le,u.bindings)};if(v.hasConnectedSandbox&&N!==void 0&&wr(N,C)!==void 0){F("warn",{message:"Ignored invalid data source bindings update",payload:C});return}se=C,ae({dataSources:C})},refreshQuery({dataSourceId:u}){if(v.status!=="initialized")return;let C=fe(Y,u),w=M.refresh(C);if(w===void 0){F("warn",`No active query exists for data source "${u}"`);return}for(let ce of w)he(ce.message,ce.token)}}}function no(e,o){return Object.values(e?.bindings??{}).find(n=>n.collectionPointer?.id===o)?.collectionSchema}function wr(e,o){for(let[n,s]of Object.entries(e.dataSources)){let c=o.bindings[n];if(c?.collectionPointer===void 0||c.collectionSchema===void 0)return Kt();for(let[l,f]of Object.entries(s.properties??{})){let y=c.propertyIdsByKey?.[l];if(y===void 0)return Zt();if(c.collectionSchema.propertiesById[y]?.type!==f.type)return Yt()}}}function oo(e,o){return o===void 0?e.filter===void 0&&(e.sorts?.length??0)===0?void 0:{code:"data_source_schema_unavailable",message:"You cannot query this data source with filters or sorts because its schema is unavailable.",isRetryable:!1}:Br(e.filter,o)??Rr(e.sorts,o)}function io(e){return(e.protocol==="http:"||e.protocol==="https:")&&(e.hostname==="localhost"||e.hostname==="127.0.0.1"||e.hostname.endsWith(".localhost"))&&e.username===""&&e.password===""}export{ro as createCustomBlockHost,Ar as getAutoBoundPropertyIdsByKey,io as isLocalCustomBlockUrl};
1
+ function qr(e){let{manifestProperties:o,propertySchemasById:n}=e,s=[];for(let[c,l]of Object.entries(o)){let f=Tr({propertyKey:c,manifestProperty:l,propertySchemasById:n});f!==void 0&&s.push([c,f])}return Object.fromEntries(s)}function Tr(e){let{propertyKey:o,manifestProperty:n,propertySchemasById:s}=e,c=rt(n.name),l=Object.entries(s).filter(([f,y])=>y.type===n.type&&(f===o||rt(y.name)===c));return l.length===1?l[0][0]:void 0}function rt(e){return e.trim().toLowerCase()}var Re,Nr={lang:void 0,message:void 0,abortEarly:void 0,abortPipeEarly:void 0};function Ne(e){return!e&&!Re?Nr:{lang:e?.lang??Re?.lang,message:e?.message,abortEarly:e?.abortEarly??Re?.abortEarly,abortPipeEarly:e?.abortPipeEarly??Re?.abortPipeEarly}}var Fr;function Ur(e){return Fr?.get(e)}var zr;function Hr(e){return zr?.get(e)}var Lr;function Gr(e,o){return Lr?.get(e)?.get(o)}function ge(e){let o=typeof e;return o==="string"?`"${e}"`:o==="number"||o==="bigint"||o==="boolean"?`${e}`:o==="object"||o==="function"?(e&&Object.getPrototypeOf(e)?.constructor?.name)??"null":o}function j(e,o,n,s,c){let l=c&&"input"in c?c.input:n.value,f=c?.expected??e.expects??null,y=c?.received??ge(l),m={kind:e.kind,type:e.type,input:l,expected:f,received:y,message:`Invalid ${o}: ${f?`Expected ${f} but r`:"R"}eceived ${y}`,requirement:e.requirement,path:c?.path,issues:c?.issues,lang:s.lang,abortEarly:s.abortEarly,abortPipeEarly:s.abortPipeEarly},S=e.kind==="schema",I=c?.message??e.message??Gr(e.reference,m.lang)??(S?Hr(m.lang):null)??s.message??Ur(m.lang);I!==void 0&&(m.message=typeof I=="function"?I(m):I),S&&(n.typed=!1),n.issues?n.issues.push(m):n.issues=[m]}var nt=new WeakMap;function z(e){let o=nt.get(e);return o||(o={version:1,vendor:"valibot",validate(n){return e["~run"]({value:n},Ne())}},nt.set(e,o)),o}function Vr(e,o){return Object.prototype.hasOwnProperty.call(e,o)&&o!=="__proto__"&&o!=="prototype"&&o!=="constructor"}function Fe(e,o){let n=[...new Set(e)];return n.length>1?`(${n.join(` ${o} `)})`:n[0]??"never"}var $r=class extends Error{constructor(e){super(e[0].message),this.name="ValiError",this.issues=e}};function te(e){return{kind:"transformation",type:"brand",reference:te,async:!1,name:e,"~run"(o){return o}}}function be(e){return{kind:"validation",type:"finite",reference:be,async:!1,expects:null,requirement:Number.isFinite,message:e,"~run"(o,n){return o.typed&&!this.requirement(o.value)&&j(this,"finite",o,n),o}}}function Me(e,o){return{kind:"validation",type:"max_length",reference:Me,async:!1,expects:`<=${e}`,requirement:e,message:o,"~run"(n,s){return n.typed&&n.value.length>this.requirement&&j(this,"length",n,s,{received:`${n.value.length}`}),n}}}function ke(e,o){return{kind:"validation",type:"min_length",reference:ke,async:!1,expects:`>=${e}`,requirement:e,message:o,"~run"(n,s){return n.typed&&n.value.length<this.requirement&&j(this,"length",n,s,{received:`${n.value.length}`}),n}}}function Se(e,o){return{kind:"validation",type:"min_value",reference:Se,async:!1,expects:`>=${e instanceof Date?e.toJSON():ge(e)}`,requirement:e,message:o,"~run"(n,s){return n.typed&&!(n.value>=this.requirement)&&j(this,"value",n,s,{received:n.value instanceof Date?n.value.toJSON():ge(n.value)}),n}}}function Ue(e,o){return{kind:"validation",type:"regex",reference:Ue,async:!1,expects:`${e}`,requirement:e,message:o,"~run"(n,s){return n.typed&&!this.requirement.test(n.value)&&j(this,"format",n,s),n}}}function ze(e){return{kind:"transformation",type:"transform",reference:ze,async:!1,operation:e,"~run"(o){return o.value=this.operation(o.value),o}}}var it={abortEarly:!0};function st(e,o,n){return typeof e.fallback=="function"?e.fallback(o,n):e.fallback}function De(e,o,n){return typeof e.default=="function"?e.default(o,n):e.default}function ut(e,o){return!e["~run"]({value:o},it).issues}function O(e,o){return{kind:"schema",type:"array",reference:O,expects:"Array",async:!1,item:e,message:o,get"~standard"(){return z(this)},"~run"(n,s){let c=n.value;if(Array.isArray(c)){n.typed=!0,n.value=[];for(let l=0;l<c.length;l++){let f=c[l],y=this.item["~run"]({value:f},s);if(y.issues){let m={type:"array",origin:"value",input:c,key:l,value:f};for(let S of y.issues)S.path?S.path.unshift(m):S.path=[m],n.issues?.push(S);if(n.issues||(n.issues=y.issues),s.abortEarly){n.typed=!1;break}}y.typed||(n.typed=!1),n.value.push(y.value)}}else j(this,"type",n,s);return n}}}function b(e){return{kind:"schema",type:"boolean",reference:b,expects:"boolean",async:!1,message:e,get"~standard"(){return z(this)},"~run"(o,n){return typeof o.value=="boolean"?o.typed=!0:j(this,"type",o,n),o}}}function i(e,o){return{kind:"schema",type:"literal",reference:i,expects:ge(e),async:!1,literal:e,message:o,get"~standard"(){return z(this)},"~run"(n,s){return n.value===this.literal?n.typed=!0:j(this,"type",n,s),n}}}function He(e){return{kind:"schema",type:"nan",reference:He,expects:"NaN",async:!1,message:e,get"~standard"(){return z(this)},"~run"(o,n){return Number.isNaN(o.value)?o.typed=!0:j(this,"type",o,n),o}}}function W(e,o){return{kind:"schema",type:"nullable",reference:W,expects:`(${e.expects} | null)`,async:!1,wrapped:e,default:o,get"~standard"(){return z(this)},"~run"(n,s){return n.value===null&&(this.default!==void 0&&(n.value=De(this,n,s)),n.value===null)?(n.typed=!0,n):this.wrapped["~run"](n,s)}}}function E(e){return{kind:"schema",type:"number",reference:E,expects:"number",async:!1,message:e,get"~standard"(){return z(this)},"~run"(o,n){return typeof o.value=="number"&&!isNaN(o.value)?o.typed=!0:j(this,"type",o,n),o}}}function r(e,o){return{kind:"schema",type:"object",reference:r,expects:"Object",async:!1,entries:e,message:o,get"~standard"(){return z(this)},"~run"(n,s){let c=n.value;if(c&&typeof c=="object"){n.typed=!0,n.value={};for(let l in this.entries){let f=this.entries[l];if(l in c||(f.type==="exact_optional"||f.type==="optional"||f.type==="nullish")&&f.default!==void 0){let y=l in c?c[l]:De(f),m=f["~run"]({value:y},s);if(m.issues){let S={type:"object",origin:"value",input:c,key:l,value:y};for(let I of m.issues)I.path?I.path.unshift(S):I.path=[S],n.issues?.push(I);if(n.issues||(n.issues=m.issues),s.abortEarly){n.typed=!1;break}}m.typed||(n.typed=!1),n.value[l]=m.value}else if(f.fallback!==void 0)n.value[l]=st(f);else if(f.type!=="exact_optional"&&f.type!=="optional"&&f.type!=="nullish"&&(j(this,"key",n,s,{input:void 0,expected:`"${l}"`,path:[{type:"object",origin:"key",input:c,key:l,value:c[l]}]}),s.abortEarly))break}}else j(this,"type",n,s);return n}}}function u(e,o){return{kind:"schema",type:"optional",reference:u,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:o,get"~standard"(){return z(this)},"~run"(n,s){return n.value===void 0&&(this.default!==void 0&&(n.value=De(this,n,s)),n.value===void 0)?(n.typed=!0,n):this.wrapped["~run"](n,s)}}}function B(e,o){return{kind:"schema",type:"picklist",reference:B,expects:Fe(e.map(ge),"|"),async:!1,options:e,message:o,get"~standard"(){return z(this)},"~run"(n,s){return this.options.includes(n.value)?n.typed=!0:j(this,"type",n,s),n}}}function H(e,o,n){return{kind:"schema",type:"record",reference:H,expects:"Object",async:!1,key:e,value:o,message:n,get"~standard"(){return z(this)},"~run"(s,c){let l=s.value;if(l&&typeof l=="object"){s.typed=!0,s.value={};for(let f in l)if(Vr(l,f)){let y=l[f],m=this.key["~run"]({value:f},c);if(m.issues){let I={type:"object",origin:"key",input:l,key:f,value:y};for(let R of m.issues)R.path=[I],s.issues?.push(R);if(s.issues||(s.issues=m.issues),c.abortEarly){s.typed=!1;break}}let S=this.value["~run"]({value:y},c);if(S.issues){let I={type:"object",origin:"value",input:l,key:f,value:y};for(let R of S.issues)R.path?R.path.unshift(I):R.path=[I],s.issues?.push(R);if(s.issues||(s.issues=S.issues),c.abortEarly){s.typed=!1;break}}(!m.typed||!S.typed)&&(s.typed=!1),m.typed&&(s.value[m.value]=S.value)}}else j(this,"type",s,c);return s}}}function p(e,o){return{kind:"schema",type:"strict_object",reference:p,expects:"Object",async:!1,entries:e,message:o,get"~standard"(){return z(this)},"~run"(n,s){let c=n.value;if(c&&typeof c=="object"){n.typed=!0,n.value={};for(let l in this.entries){let f=this.entries[l];if(l in c||(f.type==="exact_optional"||f.type==="optional"||f.type==="nullish")&&f.default!==void 0){let y=l in c?c[l]:De(f),m=f["~run"]({value:y},s);if(m.issues){let S={type:"object",origin:"value",input:c,key:l,value:y};for(let I of m.issues)I.path?I.path.unshift(S):I.path=[S],n.issues?.push(I);if(n.issues||(n.issues=m.issues),s.abortEarly){n.typed=!1;break}}m.typed||(n.typed=!1),n.value[l]=m.value}else if(f.fallback!==void 0)n.value[l]=st(f);else if(f.type!=="exact_optional"&&f.type!=="optional"&&f.type!=="nullish"&&(j(this,"key",n,s,{input:void 0,expected:`"${l}"`,path:[{type:"object",origin:"key",input:c,key:l,value:c[l]}]}),s.abortEarly))break}if(!n.issues||!s.abortEarly){for(let l in c)if(!(l in this.entries)){j(this,"key",n,s,{input:l,expected:"never",path:[{type:"object",origin:"key",input:c,key:l,value:c[l]}]});break}}}else j(this,"type",n,s);return n}}}function t(e){return{kind:"schema",type:"string",reference:t,expects:"string",async:!1,message:e,get"~standard"(){return z(this)},"~run"(o,n){return typeof o.value=="string"?o.typed=!0:j(this,"type",o,n),o}}}function ot(e){let o;if(e)for(let n of e)if(o)for(let s of n.issues)o.push(s);else o=n.issues;return o}function _(e,o){return{kind:"schema",type:"union",reference:_,expects:Fe(e.map(n=>n.expects),"|"),async:!1,options:e,message:o,get"~standard"(){return z(this)},"~run"(n,s){let c,l,f;for(let y of this.options){let m=y["~run"]({value:n.value},s);if(m.typed)if(m.issues)l?l.push(m):l=[m];else{c=m;break}else f?f.push(m):f=[m]}if(c)return c;if(l){if(l.length===1)return l[0];j(this,"type",n,s,{issues:ot(l)}),n.typed=!0}else{if(f?.length===1)return f[0];j(this,"type",n,s,{issues:ot(f)})}return n}}}function Ie(){return{kind:"schema",type:"unknown",reference:Ie,expects:"unknown",async:!1,get"~standard"(){return z(this)},"~run"(e){return e.typed=!0,e}}}function h(e,o,n){return{kind:"schema",type:"variant",reference:h,expects:"Object",async:!1,key:e,options:o,message:n,get"~standard"(){return z(this)},"~run"(s,c){let l=s.value;if(l&&typeof l=="object"){let f,y=0,m=this.key,S=[],I=(R,k)=>{for(let G of R.options){if(G.type==="variant")I(G,new Set(k).add(G.key));else{let J=!0,N=0;for(let M of k){let F=G.entries[M];if(M in l?F["~run"]({typed:!1,value:l[M]},it).issues:F.type!=="exact_optional"&&F.type!=="optional"&&F.type!=="nullish"){J=!1,m!==M&&(y<N||y===N&&M in l&&!(m in l))&&(y=N,m=M,S=[]),m===M&&S.push(G.entries[M].expects);break}N++}if(J){let M=G["~run"]({value:l},c);(!f||!f.typed&&M.typed)&&(f=M)}}if(f&&!f.issues)break}};if(I(this,new Set([this.key])),f)return f;j(this,"type",s,c,{input:l[m],expected:Fe(S,"|"),path:[{type:"object",origin:"value",input:l,key:m,value:l[m]}]})}else j(this,"type",s,c);return s}}}function at(e,o){let n={...e.entries};for(let s of o)delete n[s];return{...e,entries:n,get"~standard"(){return z(this)}}}function fe(e,o,n){let s=e["~run"]({value:o},Ne(n));if(s.issues)throw new $r(s.issues);return s.value}function L(...e){return{...e[0],pipe:e,get"~standard"(){return z(this)},"~run"(o,n){for(let s of e)if(s.kind!=="metadata"){if(o.issues&&(s.kind==="schema"||s.kind==="transformation")){o.typed=!1;break}(!o.issues||!n.abortEarly&&!n.abortPipeEarly)&&(o=s["~run"](o,n))}return o}}}function _e(e,o,n){let s=e["~run"]({value:o},Ne(n));return{typed:s.typed,success:!s.issues,output:s.value,issues:s.issues}}var re=L(t(),te("NotionBlockId")),Y=L(t(),te("NotionDataSourceId")),T=L(t(),te("NotionPageId")),ct=L(t(),te("NotionAgentId")),lt=L(t(),te("NotionSpaceId"));var pt=B(["default","gray","brown","orange","yellow","green","blue","purple","pink","red","gray_background","brown_background","orange_background","yellow_background","green_background","blue_background","purple_background","pink_background","red_background","default_background"]),Le=r({id:t(),name:t(),color:u(pt),description:u(t())}),Qr=r({id:t(),name:t(),color:u(pt),option_ids:O(t())}),Xr=r({synced_property_id:t(),synced_property_name:t()}),P=r({name:t(),description:u(t())}),Wr=["title","rich_text","number","checkbox","url","email","phone_number","select","multi_select","status","date","people","files","unique_id","relation","place","formula","rollup","button","verification","last_visited_time","location","created_time","last_edited_time","created_by","last_edited_by"],ft=B(Wr),mt=["title","rich_text","number","checkbox","url","email","phone_number","date","created_time","last_edited_time","people","created_by"],Ge=h("type",[r({...P.entries,type:i("title")}),r({...P.entries,type:i("rich_text")}),r({...P.entries,type:i("number")}),r({...P.entries,type:i("checkbox")}),r({...P.entries,type:i("url")}),r({...P.entries,type:i("email")}),r({...P.entries,type:i("phone_number")}),r({...P.entries,type:i("select"),options:O(Le)}),r({...P.entries,type:i("multi_select"),options:O(Le)}),r({...P.entries,type:i("status"),options:O(Le),groups:O(Qr)}),r({...P.entries,type:i("date")}),r({...P.entries,type:i("people")}),r({...P.entries,type:i("files")}),r({...P.entries,type:i("unique_id")}),r({...P.entries,type:i("relation"),data_source_id:u(t()),dual_property:u(Xr)}),r({...P.entries,type:i("place")}),r({...P.entries,type:i("formula")}),r({...P.entries,type:i("rollup")}),r({...P.entries,type:i("button")}),r({...P.entries,type:i("verification")}),r({...P.entries,type:i("last_visited_time")}),r({...P.entries,type:i("location")}),r({...P.entries,type:i("created_time")}),r({...P.entries,type:i("last_edited_time")}),r({...P.entries,type:i("created_by")}),r({...P.entries,type:i("last_edited_by")})]);var yt={created_time:{type:"created_time",name:"Created time"},last_edited_time:{type:"last_edited_time",name:"Last edited time"},created_by:{type:"created_by",name:"Created by"},last_edited_by:{type:"last_edited_by",name:"Last edited by"}};var vt=r({id:Y,table:t(),spaceId:u(lt)}),dt=r({id:u(Y),propertiesById:H(t(),Ge)}),mo=r({key:t(),collectionPointer:u(vt),collectionSchema:u(dt),propertyIdsByKey:H(t(),u(t())),propertySchemasById:H(t(),Ge)}),Jr=r({collectionPointer:u(vt),collectionSchema:u(dt),propertyIdsByKey:u(H(t(),u(t())))}),le=H(t(),Jr);var Kr=h("type",[r({type:i("emoji"),emoji:t()}),r({type:i("external"),url:t()})]),Zr=r({name:t(),description:u(t()),type:ft}),Yr=r({name:t(),description:u(t()),icon:u(Kr),properties:u(H(t(),Zr),{})}),pe=r({version:i(1),name:u(t()),description:u(t()),slashCommand:u(t()),icon:u(r({type:i("emoji"),emoji:t()})),dataSources:u(H(t(),Yr),{})});var me=B(["standard","high"]),ht="standard";var gt=r({type:i("contrastModeChanged"),contrastMode:me});var we=r({id:t(),table:t()});var ne=h("type",[r({type:i("page_id"),page_id:T}),r({type:i("data_source_id"),data_source_id:Y}),r({type:i("workspace"),workspace:i(!0)}),r({type:i("block_id"),block_id:re}),r({type:i("agent_id"),agent_id:ct}),r({type:i("unavailable")})]);var ye=h("type",[r({type:i("unavailable")}),r({type:i("page"),id:T,parent:ne})]),en=r({type:i("emoji"),emoji:t()}),tn=r({type:i("custom_emoji"),custom_emoji:r({id:t(),name:u(t()),url:u(t())})}),St=r({type:i("external"),external:r({url:t()})}),It=r({type:i("file"),file:r({url:t(),expiry_time:u(t())})}),$e=h("type",[en,tn,St,It]),Qe=h("type",[St,It]),$=W(t()),bt=H(t(),Ie()),Ve=_([r({id:t(),name:u(t()),color:u(t()),description:u($)}),r({name:t(),id:u(t()),color:u(t()),description:u($)})]),rn=r({start:t(),end:u($),time_zone:u($)}),nn=_([r({object:u(i("user")),id:t()}),r({object:i("group"),id:t(),name:u($)})]),on=r({id:t()}),sn=_([r({type:i("external"),name:t(),external:r({url:t()})}),r({type:i("file"),name:t(),file:r({url:t(),expiry_time:u(t())})})]),un=r({lat:E(),lon:E(),name:u($),address:u($),aws_place_id:u($),google_place_id:u($)}),w={id:t()},kt=W(r({...we.entries,table:B(["notion_user","bot","organization_bot"]),spaceId:u(t())})),an=h("type",[r({...w,type:i("title"),title:O(bt)}),r({...w,type:i("rich_text"),rich_text:O(bt)}),r({...w,type:i("number"),number:W(E())}),r({...w,type:i("url"),url:$}),r({...w,type:i("email"),email:$}),r({...w,type:i("phone_number"),phone_number:$}),r({...w,type:i("checkbox"),checkbox:b()}),r({...w,type:i("select"),select:W(Ve)}),r({...w,type:i("status"),status:W(Ve)}),r({...w,type:i("multi_select"),multi_select:O(Ve)}),r({...w,type:i("date"),date:W(rn)}),r({...w,type:i("people"),people:O(nn)}),r({...w,type:i("relation"),has_more:u(b()),relation:O(on)}),r({...w,type:i("files"),files:O(sn)}),r({...w,type:i("place"),place:W(un)}),r({...w,type:i("created_time"),created_time:$}),r({...w,type:i("last_edited_time"),last_edited_time:$}),r({...w,type:i("created_by"),created_by:kt}),r({...w,type:i("last_edited_by"),last_edited_by:kt}),r({...w,type:i("last_visited_time"),last_visited_time:$})]),xe=H(t(),an),ve=r({object:i("page"),id:T,parent:ne,properties:xe,created_time:u(t()),last_edited_time:u(t()),icon:u($e),cover:u(Qe),url:u(t()),public_url:u(t()),is_archived:b(),in_trash:b()});var cn=t(),ln=r({code:cn,message:t(),isRetryable:b()}),_t=h("status",[r({type:i("createPageResult"),requestId:t(),status:i("success"),page:ve}),r({type:i("createPageResult"),requestId:t(),status:i("error"),error:ln})]);var Xe=L(t(),te("NotionUserId")),oe=r({object:i("user"),id:Xe,name:u(t()),avatar_url:W(t()),type:i("person"),person:r({email:t()})}),xt=r({object:i("list"),results:O(oe),next_cursor:W(t()),has_more:b(),type:i("user"),user:H(t(),Ie())});var Ct=r({type:i("currentUserChanged"),currentUser:oe});var Et=r({type:i("dataSourcesChanged"),dataSources:r({bindings:le})});var pn=t(),fn=r({code:pn,message:t(),isRetryable:b()}),Ot=r({type:i("getPage"),requestId:t(),pageId:T}),Pt=h("status",[r({type:i("getPageResult"),requestId:t(),status:i("success"),page:ve}),r({type:i("getPageResult"),requestId:t(),status:i("error"),error:fn})]);var mn=t(),yn=r({code:mn,message:t(),isRetryable:b()}),jt=r({type:i("getUser"),requestId:t(),userId:Xe}),Bt=h("status",[r({type:i("getUserResult"),requestId:t(),status:i("success"),user:oe}),r({type:i("getUserResult"),requestId:t(),status:i("error"),error:yn})]);var de=B(["light","dark"]);var vn=t(),dn=r({code:vn,message:t(),isRetryable:b()});var Ae=h("status",[r({type:i("init"),initializationId:t(),status:i("success"),theme:de,contrastMode:me,blockId:re,parent:ne,page:ye,manifest:pe,dataSources:r({bindings:le}),currentUser:oe}),r({type:i("init"),initializationId:t(),status:i("error"),error:dn})]);var Rt=r({type:i("invalidSandboxMessage"),reason:t()});var hn=t(),gn=r({code:hn,message:t(),isRetryable:b()}),Mt=r({type:i("listUsers"),requestId:t(),startCursor:u(t()),pageSize:u(E())}),Dt=h("status",[r({type:i("listUsersResult"),requestId:t(),status:i("success"),list:xt}),r({type:i("listUsersResult"),requestId:t(),status:i("error"),error:gn})]);var bn=B(["side_peek","center_peek"]),kn=t(),Sn=r({code:kn,message:t(),isRetryable:b()}),wt=r({type:i("openPage"),requestId:t(),pageId:T,mode:bn}),At=h("status",[r({type:i("openPageResult"),requestId:t(),status:i("success"),pageId:T}),r({type:i("openPageResult"),requestId:t(),status:i("error"),error:Sn})]);var qt=r({type:i("pageChanged"),page:ye});var Tt=r({type:i("parentChanged"),parent:ne});var Nt=r({unit:B(["year","month","week","day"]),value:E(),time:t(),defaultTimeZone:u(t())}),In=r({unit:B(["hour","minute"]),value:E()}),Ft=r({unit:i("none")}),_n=_([Nt,In]),Ut=u(_([Nt,Ft])),zt=u(_([_n,Ft])),xn=r({type:i("date"),start_date:t(),reminder:Ut}),Cn=r({type:i("daterange"),start_date:t(),end_date:t(),reminder:Ut}),En=r({type:i("datetime"),start_date:t(),start_time:t(),time_zone:u(t()),reminder:zt}),On=r({type:i("datetimerange"),start_date:t(),start_time:t(),end_date:t(),end_time:t(),time_zone:u(t()),reminder:zt}),Ht=h("type",[xn,Cn,En,On]);var Lt=_([t(),E(),b(),Ht,O(t()),O(we)]);var Gt=r({id:T,is_archived:b(),in_trash:b(),propertiesById:H(t(),u(Lt))});var Pn=t(),jn=r({code:Pn,message:t(),isRetryable:b()}),Vt=h("status",[r({type:i("queryDataSourceResult"),subscriptionId:t(),status:i("success"),items:O(Gt),hasMore:b()}),r({type:i("queryDataSourceResult"),subscriptionId:t(),status:i("error"),error:jn})]);var $t=r({type:i("themeChanged"),theme:de});var Bn=t(),Rn=r({code:Bn,message:t(),isRetryable:b()}),Qt=h("status",[r({type:i("updatePageResult"),requestId:t(),status:i("success"),page:ve}),r({type:i("updatePageResult"),requestId:t(),status:i("error"),error:Rn})]);var Xt=h("type",[Ae,$t,gt,Tt,qt,Ct,Et,Vt,_t,Pt,Bt,Dt,At,Qt,Rt]);function Wt(){return{code:"no_connect",message:"Sandbox did not send a connect message.",isRetryable:!0}}function Jt(){return{code:"invalid_connect_payload",message:"Sandbox sent an invalid connect message.",isRetryable:!1}}function We(e){let{currentBridgeProtocolVersion:o}=e;return{code:"invalid_protocol_version",message:`Sandbox reported an invalid bridge protocol version: ${o}`,isRetryable:!1}}function Je(e){let{currentBridgeProtocolVersion:o,minBridgeProtocolVersion:n}=e;return{code:"unsupported_protocol_version",message:`Sandbox bridge protocol version ${o} is not supported. Minimum supported version is ${n}.`,isRetryable:!1}}function Ke(){return{code:"context_unavailable",message:"Host page context is unavailable.",isRetryable:!0}}function Kt(){return{code:"initial_state_timeout",message:"Host did not prepare initial state before the timeout.",isRetryable:!0}}function Zt(){return{code:"missing_data_source_binding",message:"A required data source is not mapped.",isRetryable:!1}}function Yt(){return{code:"missing_property_binding",message:"A required data source property is not mapped.",isRetryable:!1}}function er(){return{code:"invalid_property_binding",message:"A mapped data source property is missing or incompatible.",isRetryable:!1}}function tr(){return{code:"no_init_result",message:"Sandbox did not acknowledge initialization.",isRetryable:!0}}function rr(){return{code:"invalid_init_result_payload",message:"Sandbox sent an invalid initialization result.",isRetryable:!1}}function nr(){return{code:"unknown_error",message:"Unexpected error while initializing custom block.",isRetryable:!1}}function ie(e){throw new Error(`[custom-blocks-host] Unexpected value encountered: ${JSON.stringify(e)}`)}function Ze(e){return Number.isFinite(e)&&Number.isInteger(e)&&e>=1}var Mn=5e3,Dn=5e3,wn=5e3;function or(e){let{prepareInit:o,sendInitMessage:n,warn:s,flushPendingHostStateChanges:c,minBridgeProtocolVersion:l,noConnectTimeoutMs:f=Mn,initialStateTimeoutMs:y=Dn,noInitResultTimeoutMs:m=wn,stopHostWithFailure:S,onInitResult:I,onConnectionFailure:R}=e,k="waitingForConnect",G,J,N,M,F=!1,se=!1;function X(){G!==void 0&&(window.clearTimeout(G),G=void 0)}function D(){J!==void 0&&(window.clearTimeout(J),J=void 0)}function U(){N!==void 0&&(window.clearTimeout(N),N=void 0)}function q(g){let{initializationId:v,error:V,phase:Z,source:Be}=g;switch(k){case"waitingForConnect":case"preparingInit":break;case"waitingForInitResult":case"initialized":case"error":case"stopped":return;default:return ie(k)}k="error",M=v,X(),D(),n({type:"init",initializationId:v,status:"error",error:V}),R?.({...V,phase:Z,source:Be})}async function K(g){if(k==="waitingForConnect"){k="preparingInit",M=g.initializationId,X(),J=window.setTimeout(()=>{if(k!=="preparingInit")return;let v=Kt();s({...v,initializationId:g.initializationId}),q({initializationId:g.initializationId,error:v,phase:"init",source:"host"})},y);try{let v=await o(g);if(k!=="preparingInit")return;if(D(),v.status==="error"){q({initializationId:g.initializationId,error:v.error,phase:"init",source:"host"});return}k="waitingForInitResult";let V={type:"init",initializationId:g.initializationId,status:"success",theme:v.initialState.theme,contrastMode:v.initialState.contrastMode??ht,blockId:v.initialState.blockId,parent:v.initialState.parent,page:v.initialState.page,currentUser:v.initialState.currentUser,manifest:v.initialState.manifest,dataSources:v.initialState.dataSources};n(V),N=window.setTimeout(()=>{if(k!=="waitingForInitResult")return;k="error";let Z=tr();R?.({...Z,phase:"initResult",source:"host"}),s({...Z,initializationId:g.initializationId})},m)}catch(v){if(k!=="preparingInit")return;s({message:"Failed to prepare custom block initialization",error:v}),q({initializationId:g.initializationId,error:nr(),phase:"init",source:"host"})}}}function ee(g){if(k!=="stopped"&&k==="waitingForConnect"){if(!Ze(g.bridgeProtocolVersion)){let v=We({currentBridgeProtocolVersion:g.bridgeProtocolVersion});q({initializationId:g.initializationId,error:v,phase:"connect",source:"host"});return}if(g.bridgeProtocolVersion<l){let v=Je({currentBridgeProtocolVersion:g.bridgeProtocolVersion,minBridgeProtocolVersion:l});q({initializationId:g.initializationId,error:v,phase:"connect",source:"host"});return}if(g.status==="error"){q({initializationId:g.initializationId,error:g.error,phase:"connect",source:"sandbox"});return}se=!0,K(g)}}function x(g){if(k==="stopped"||k!=="waitingForConnect")return"handled";let{initializationId:v,bridgeProtocolVersion:V}=g;if(v===void 0)return"nack";let Z=g.error;return V!==void 0&&(Ze(V)?V<l&&(Z=Je({currentBridgeProtocolVersion:V,minBridgeProtocolVersion:l})):Z=We({currentBridgeProtocolVersion:V})),q({initializationId:v,error:Z,phase:"connect",source:"host"}),"handled"}function ue(g){let{initializationId:v,error:V}=g;k!=="waitingForInitResult"||v===void 0||v!==M||(X(),U(),k="error",s(V),R?.({...V,phase:"initResult",source:"host"}))}function je(){if(k!=="stopped"){if(F){S({phase:"runtime",source:"host",code:"iframe_reloaded",message:"The iframe reloaded. Create a new host and iframe to reconnect.",isRetryable:!0});return}F=!0,X(),k==="waitingForConnect"&&(G=window.setTimeout(()=>{if(k!=="waitingForConnect")return;k="error";let g=Wt();s(g),R?.({...g,phase:"connect",source:"host"})},f))}}function he(g){if(k!=="waitingForInitResult"||g.initializationId!==M){s({message:"Ignored stale or unexpected initResult",payload:g});return}U(),k=g.status==="success"?"initialized":"error",g.status==="success"?c():R?.({...g.error,phase:"initResult",source:"sandbox"}),I?.(g)}function ae(){k="stopped",X(),D(),U()}return{get status(){return k},get hasConnectedSandbox(){return se},handleConnect:ee,handleInitResult:he,handleInvalidConnect:x,handleInvalidInitResult:ue,onIframeLoad:je,stop:ae}}function ir(e,o){return o>=5||!(e.type==="init"&&e.status==="success"||e.type==="dataSourcesChanged")?e:{...e,dataSources:{bindings:Object.fromEntries(Object.entries(e.dataSources.bindings).map(([s,c])=>[s,{...c,collectionSchema:{...c.collectionSchema,propertiesById:{...c.collectionSchema?.propertiesById,...yt}}}]))}}}var sr=r({theme:de,contrastMode:u(me),blockId:re,parent:ne,page:ye,manifest:pe,dataSources:r({bindings:le}),currentUser:oe});function ur(e){switch(e.type){case"connect":case"init":case"initResult":return!0;default:return!1}}var ar=r({code:t(),message:t(),isRetryable:b()});var cr={type:i("connect"),initializationId:t(),bridgeProtocolVersion:E(),sdkVersion:t()},lr=h("status",[r({status:i("success"),manifest:u(pe),...cr}),r({status:i("error"),error:ar,...cr})]);var An=h("type",[r({type:i("start")}),r({type:i("end")}),r({type:i("before"),blockId:re}),r({type:i("after"),blockId:re})]),qn=h("type",[r({type:i("page_id"),page_id:T}),r({type:i("data_source_id"),data_source_id:Y})]),pr=r({type:i("createPage"),requestId:t(),parent:qn,properties:xe,position:u(An)});var Tn=t(),Nn=r({code:Tn,message:t(),isRetryable:b()}),fr=h("status",[r({type:i("initResult"),initializationId:t(),status:i("success"),initialHeight:u(L(E(),be(),Se(0)))}),r({type:i("initResult"),initializationId:t(),status:i("error"),error:Nn})]);var mr=r({type:i("invalidHostMessage"),reason:t()});var yr=B(["ascending","descending"]);var vr=L(T,Ue(/^(?:[0-9a-f]{32}|[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})$/i),ze(e=>e.replaceAll("-","").toLowerCase().replace(/^(.{8})(.{4})(.{4})(.{4})(.{12})$/,"$1-$2-$3-$4-$5"))),Ye=_([p({contains:vr}),p({does_not_contain:vr})]),Pe=_([p({is_empty:i(!0)}),p({is_not_empty:i(!0)})]),Oe=_([t(),O(t())]),dr=p({object:B(["user","group"]),id:L(t(),ke(1))}),Fn=_([p({contains:dr}),p({does_not_contain:dr}),Pe]),hr=p({object:i("user"),id:L(t(),ke(1),Me(2e3))}),Un=_([p({contains:hr}),p({does_not_contain:hr}),p({is_empty:i(!0)}),p({is_not_empty:i(!0)})]),Ce=_([p({equals:t()}),p({does_not_equal:t()}),p({contains:t()}),p({does_not_contain:t()}),p({starts_with:t()}),p({ends_with:t()}),Pe]),zn=_([p({equals:E()}),p({does_not_equal:E()}),p({greater_than:E()}),p({less_than:E()}),p({greater_than_or_equal_to:E()}),p({less_than_or_equal_to:E()}),Pe]),Hn=_([p({equals:b()}),p({does_not_equal:b()})]),Sr=_([p({equals:Oe}),p({does_not_equal:Oe}),Pe]),gr=B(["To-do","In progress","Complete","Current","Future"]),br=_([gr,L(O(gr),ke(1),Me(5))]),Ln=_([p({group_equals:br}),p({group_does_not_equal:br})]),Gn=_([Sr,Ln]),Vn=_([p({contains:Oe}),p({contains_all:Oe}),p({does_not_contain:Oe}),Pe]),Q=B(["start_date","end_date"]),$n=B(["today","tomorrow","yesterday","one_week_ago","one_week_from_now","one_month_ago","one_month_from_now"]),Ee=_([$n,t()]),Qn=_([p({target:u(Q),equals:Ee}),p({target:u(Q),before:Ee}),p({target:u(Q),after:Ee}),p({target:u(Q),on_or_before:Ee}),p({target:u(Q),on_or_after:Ee}),p({target:u(Q),this_week:p({})}),p({target:u(Q),past_week:p({})}),p({target:u(Q),past_month:p({})}),p({target:u(Q),past_year:p({})}),p({target:u(Q),next_week:p({})}),p({target:u(Q),next_month:p({})}),p({target:u(Q),next_year:p({})}),p({target:u(Q),is_empty:i(!0)}),p({target:u(Q),is_not_empty:i(!0)})]),kr=_([p({propertyId:t(),relation:Ye}),p({propertyId:t(),created_by:Un}),p({propertyId:t(),title:Ce}),p({propertyId:t(),rich_text:Ce}),p({propertyId:t(),url:Ce}),p({propertyId:t(),email:Ce}),p({propertyId:t(),phone_number:Ce}),p({propertyId:t(),number:zn}),p({propertyId:t(),checkbox:Hn}),p({propertyId:t(),select:Sr}),p({propertyId:t(),multi_select:Vn}),p({propertyId:t(),status:Gn}),p({propertyId:t(),date:Qn}),p({propertyId:t(),people:Fn})]),Xn=_([kr,p({and:O(kr)})]),et=10,Wn=p({propertyId:t(),direction:yr}),Ir=r({type:i("queryDataSource"),subscriptionId:t(),dataSourceId:Y,limit:E(),filter:u(Xn),sorts:u(O(Wn))});var _r=r({type:i("resize"),height:L(E(),be(),Se(0))});var xr=r({type:i("unsubscribeDataSourceQuery"),subscriptionId:t()});var Cr=r({type:i("updatePage"),requestId:t(),pageId:T,properties:u(xe),icon:u($e),cover:u(Qe),archived:u(b())});var Er=h("type",[lr,fr,Ir,xr,pr,Ot,jt,Mt,wt,Cr,_r,mr]);function Or(e){if(typeof e=="object"&&e!==null&&"type"in e&&typeof e.type=="string")return e.type}function Pr(e){let o=Or(e);return o==="invalidHostMessage"||o==="invalidSandboxMessage"?{incomingType:o}:{incomingType:o,nack:{type:"invalidSandboxMessage",reason:Jn(o)}}}function Jn(e){return e!==void 0?`Unsupported sandbox message of type "${e}"`:"Unsupported sandbox message (no `type` field or non-object payload)"}var jr=r({initializationId:t()}),Kn=r({bridgeProtocolVersion:_([E(),He()])});function Br(e){let{iframe:o,sandboxOrigin:n,getInitStatus:s,emit:c,sendNack:l,onInvalidConnect:f,onInvalidInitResult:y,onConnect:m,onInitResult:S,onQueryDataSource:I,onUnsubscribeDataSourceQuery:R,onCreatePage:k,onGetPage:G,onOpenPage:J,onGetUser:N,onListUsers:M,onUpdatePage:F,onResize:se}=e;function X(D,U){c("warn",{message:"Ignored unsupported sandbox message",payload:D,issues:U});let q=Pr(D);if(q.incomingType==="connect"){let K=_e(jr,D),ee=_e(Kn,D);if(f({initializationId:K.success?K.output.initializationId:void 0,error:Jt(),bridgeProtocolVersion:ee.success?ee.output.bridgeProtocolVersion:void 0})==="handled")return}if(q.incomingType==="initResult"){let K=_e(jr,D);y({initializationId:K.success?K.output.initializationId:void 0,error:rr()})}q.nack!==void 0&&s()!=="stopped"&&l(q.nack)}return function(U){let q=U.source===o.contentWindow,K=U.origin===n;if(!q||!K)return;let ee=_e(Er,U.data);if(!ee.success){X(U.data,ee.issues);return}let x=ee.output;if(!ur(x)&&s()!=="initialized"){c("warn",{message:`Ignored ${x.type} before initialization completed`,payload:x});return}switch(c("in",x),x.type){case"connect":m(x);return;case"initResult":S(x);return;case"queryDataSource":I(x);return;case"unsubscribeDataSourceQuery":R(x);return;case"createPage":k(x);return;case"openPage":J(x);return;case"getPage":G(x);return;case"getUser":N(x);return;case"listUsers":M(x);return;case"updatePage":F(x);return;case"resize":se(x);return;case"invalidHostMessage":return;default:ie(x)}}}var qe=class{constructor(o){this.onUnsubscribe=o}onUnsubscribe;bySubscriptionId=new Map;subscribe(o){this.unsubscribe(o.subscriptionId);let n={_tag:"QuerySubscriptionToken"};return this.bySubscriptionId.set(o.subscriptionId,{message:o,token:n,isRefreshing:!0,shouldRefreshAgain:!1}),n}isCurrent(o,n){return this.bySubscriptionId.get(o)?.token===n}unsubscribe(o){this.bySubscriptionId.delete(o)&&this.onUnsubscribe(o)}refresh(o){let n=[],s=!1;for(let c of this.bySubscriptionId.values())if(c.message.dataSourceId===o){if(s=!0,c.isRefreshing){c.shouldRefreshAgain=!0;continue}c.isRefreshing=!0,n.push({message:c.message,token:c.token})}return s?n:void 0}finish(o,n){let s=this.bySubscriptionId.get(o);if(s?.token===n&&(s.isRefreshing=!1,!!s.shouldRefreshAgain))return s.shouldRefreshAgain=!1,s.isRefreshing=!0,{message:s.message,token:s.token}}unsubscribeAll(){for(let o of this.bySubscriptionId.keys())this.unsubscribe(o)}};function Rr(e,o){if(e===void 0)return;let n="and"in e?e.and:[e];for(let s of n){let c=Zn(s,o);if(c!==void 0)return c}}function Zn(e,o){if(!Object.hasOwn(o.propertiesById,e.propertyId))return{code:"invalid_data_source_query_filter",message:`Data source query filter property ID "${e.propertyId}" is not defined in the bound data source schema.`,isRetryable:!1};let n=o.propertiesById[e.propertyId],s=Object.keys(e).find(y=>y!=="propertyId");if(s!==n.type)return{code:"invalid_data_source_query_filter",message:`Data source query filter branch "${s}" does not match property type "${n.type}".`,isRetryable:!1};if("status"in e&&n.type==="status"){let y=e.status;if("group_equals"in y||"group_does_not_equal"in y){let m="group_equals"in y?y.group_equals:y.group_does_not_equal,I=(Array.isArray(m)?m:[m]).find(R=>!n.groups.some(k=>k.name===R));return I===void 0?void 0:{code:"invalid_data_source_query_filter",message:`Unknown status group "${I}".`,isRetryable:!1}}}if("relation"in e&&!ut(Ye,e.relation))return{code:"invalid_data_source_query_filter",message:"Relation filters require a page ID.",isRetryable:!1};let c=Yn(e);if(c===void 0||n.type!==c.propertyType)return;let l=new Set(n.options.map(y=>y.name)),f=eo(c.operator).find(y=>!l.has(y));if(f!==void 0)return{code:"invalid_data_source_query_filter",message:`Data source query filter option "${f}" is not defined for property "${e.propertyId}".`,isRetryable:!1}}function Yn(e){if("select"in e)return{propertyType:"select",operator:e.select};if("multi_select"in e)return{propertyType:"multi_select",operator:e.multi_select};if("status"in e){let o=e.status;return"group_equals"in o||"group_does_not_equal"in o?void 0:{propertyType:"status",operator:o}}}function eo(e){let o;if("equals"in e)o=e.equals;else if("does_not_equal"in e)o=e.does_not_equal;else if("contains"in e)o=e.contains;else if("contains_all"in e)o=e.contains_all;else if("does_not_contain"in e)o=e.does_not_contain;else return"is_empty"in e||"is_not_empty"in e?[]:ie(e);return Array.isArray(o)?o:[o]}var to=new Set(mt);function Mr(e,o){if(e===void 0)return;if(e.length>et)return{code:"invalid_data_source_query_sort",message:`Data source query sorts may contain at most ${et} entries.`,isRetryable:!1};let n=new Set;for(let s of e){if(n.has(s.propertyId))return{code:"invalid_data_source_query_sort",message:`Data source query sorts cannot contain duplicate property ID "${s.propertyId}".`,isRetryable:!1};if(n.add(s.propertyId),!Object.hasOwn(o.propertiesById,s.propertyId))return{code:"invalid_data_source_query_sort",message:`Data source query sort property ID "${s.propertyId}" is not defined in the bound data source schema.`,isRetryable:!1};let c=o.propertiesById[s.propertyId];if(!to.has(c.type))return{code:"invalid_data_source_query_sort",message:`Data source query sorts do not yet support property type "${c.type}".`,isRetryable:!1}}}var wr=5;function no(e){let{iframe:o,getInitialState:n,handlers:s,onManifest:c,onInitialized:l,onConnectionFailure:f,onLog:y,onQueryUnsubscribed:m,sandboxOrigin:S,minBridgeProtocolVersion:I,noConnectTimeoutMs:R,initialStateTimeoutMs:k,noInitResultTimeoutMs:G}=e,J=Math.max(I??3,3),N={},M=!1,F,se,X=5,D=new qe(a=>{m?.(a)});function U(a,C){y?.(a,C)}function q(a){let C=v.status;switch(C){case"waitingForConnect":case"preparingInit":case"waitingForInitResult":case"initialized":case"error":break;case"stopped":return;default:return ie(C)}let A=ir(a,X);U("out",A),o.contentWindow?.postMessage(A,S)}function K(a){q(fe(Ae,a))}function ee(a){q(a)}function x(a){let C=v.status;switch(C){case"initialized":q(fe(Xt,a));return;case"waitingForConnect":case"preparingInit":case"waitingForInitResult":case"error":case"stopped":return;default:ie(C)}}async function ue(a,C){if(C===void 0)return;let A=await C(a);x({type:`${a.type}Result`,requestId:a.requestId,...A})}function je(a){let C=a.response.status==="error"?{type:"queryDataSourceResult",subscriptionId:a.subscriptionId,status:"error",error:a.response.error}:{type:"queryDataSourceResult",subscriptionId:a.subscriptionId,status:"success",items:a.response.items,hasMore:a.response.hasMore};x(C)}async function he(a,C=D.subscribe(a)){try{let A=oo(se,a.dataSourceId),ce=io(a,A);if(ce!==void 0){D.isCurrent(a.subscriptionId,C)&&(D.unsubscribe(a.subscriptionId),je({subscriptionId:a.subscriptionId,response:{status:"error",error:ce}}));return}let Te=await s.queryDataSource(a);if(!D.isCurrent(a.subscriptionId,C))return;Te.status==="error"&&!Te.error.isRetryable&&D.unsubscribe(a.subscriptionId),je({subscriptionId:a.subscriptionId,response:Te})}finally{let A=D.finish(a.subscriptionId,C);A!==void 0&&he(A.message,A.token)}}function ae(a){v.status==="stopped"||v.status==="error"||(Object.assign(N,a),g())}function g(){if(v.status!=="initialized")return;let a=N;N={},a.theme!==void 0&&x({type:"themeChanged",theme:a.theme}),a.contrastMode!==void 0&&x({type:"contrastModeChanged",contrastMode:a.contrastMode}),a.parent!==void 0&&x({type:"parentChanged",parent:a.parent}),a.page!==void 0&&x({type:"pageChanged",page:a.page}),a.dataSources!==void 0&&x({type:"dataSourcesChanged",dataSources:a.dataSources}),a.currentUser!==void 0&&x({type:"currentUserChanged",currentUser:a.currentUser})}let v=or({async prepareInit(a){X=a.bridgeProtocolVersion;let C=await n(a);return v.status!=="preparingInit"?C:V(C)},sendInitMessage:K,warn:a=>U("warn",a),flushPendingHostStateChanges:g,minBridgeProtocolVersion:J,noConnectTimeoutMs:R,initialStateTimeoutMs:k,noInitResultTimeoutMs:G,stopHostWithFailure:tt,onInitResult(a){a.status==="success"&&F!==void 0&&l?.({manifest:F,initialHeight:a.initialHeight})},onConnectionFailure:f});function V(a){if(a.status==="error")return a;F=fe(pe,a.initialState.manifest),c?.(F);let C={...a.initialState,...N};N={};let A={...fe(at(sr,["manifest"]),C),manifest:F};if(X<wr&&A.page.type==="unavailable")return{status:"error",error:Ke()};let ce=Ar(A.manifest,A.dataSources);return ce!==void 0?{status:"error",error:ce}:(se=A.dataSources,M=!0,{status:"success",initialState:A})}let Z=Br({iframe:o,sandboxOrigin:S,getInitStatus:()=>v.status,emit:U,sendNack:ee,onInvalidConnect:v.handleInvalidConnect,onInvalidInitResult:v.handleInvalidInitResult,onConnect:v.handleConnect,onInitResult:v.handleInitResult,onQueryDataSource:he,onUnsubscribeDataSourceQuery:a=>D.unsubscribe(a.subscriptionId),onCreatePage:a=>ue(a,s.createPage),onGetPage:a=>ue(a,s.getPage),onOpenPage:a=>ue(a,s.openPage),onGetUser:a=>ue(a,s.getUser),onListUsers:a=>ue(a,s.listUsers),onUpdatePage:a=>ue(a,s.updatePage),onResize:a=>s.resize?.(a)});window.addEventListener("message",Z),o.addEventListener("load",v.onIframeLoad);function Be(){window.removeEventListener("message",Z),o.removeEventListener("load",v.onIframeLoad),v.stop(),D.unsubscribeAll()}function tt(a){Be(),U("warn",a),f?.(a)}return{stop:Be,setTheme(a){ae({theme:a})},setContrastMode(a){ae({contrastMode:a})},setParent(a){ae({parent:a})},setPage(a){if(a.type==="unavailable"&&X<wr&&(v.status==="preparingInit"&&M||v.status==="waitingForInitResult"||v.status==="initialized")){tt({...Ke(),phase:"runtime",source:"host"});return}ae({page:a})},setCurrentUser(a){ae({currentUser:a})},setDataSources(a){let C={bindings:fe(le,a.bindings)};if(v.hasConnectedSandbox&&F!==void 0&&Ar(F,C)!==void 0){U("warn",{message:"Ignored invalid data source bindings update",payload:C});return}se=C,ae({dataSources:C})},refreshQuery({dataSourceId:a}){if(v.status!=="initialized")return;let C=fe(Y,a),A=D.refresh(C);if(A===void 0){U("warn",`No active query exists for data source "${a}"`);return}for(let ce of A)he(ce.message,ce.token)}}}function oo(e,o){return Object.values(e?.bindings??{}).find(n=>n.collectionPointer?.id===o)?.collectionSchema}function Ar(e,o){for(let[n,s]of Object.entries(e.dataSources)){let c=o.bindings[n];if(c?.collectionPointer===void 0||c.collectionSchema===void 0)return Zt();for(let[l,f]of Object.entries(s.properties??{})){let y=c.propertyIdsByKey?.[l];if(y===void 0)return Yt();if(c.collectionSchema.propertiesById[y]?.type!==f.type)return er()}}}function io(e,o){return o===void 0?e.filter===void 0&&(e.sorts?.length??0)===0?void 0:{code:"data_source_schema_unavailable",message:"You cannot query this data source with filters or sorts because its schema is unavailable.",isRetryable:!1}:Rr(e.filter,o)??Mr(e.sorts,o)}function so(e){return(e.protocol==="http:"||e.protocol==="https:")&&(e.hostname==="localhost"||e.hostname==="127.0.0.1"||e.hostname.endsWith(".localhost"))&&e.username===""&&e.password===""}export{no as createCustomBlockHost,qr as getAutoBoundPropertyIdsByKey,so as isLocalCustomBlockUrl};
package/dist/index.d.ts CHANGED
@@ -7,7 +7,7 @@ export type { OpenPageMessage } from "./protocol/messages/openPage.js";
7
7
  export type { CustomBlockCheckboxFilterOperator, CustomBlockContainsFilterOperator, CustomBlockCreatedByFilterOperator, CustomBlockDateFilterOperator, CustomBlockNumberFilterOperator, CustomBlockOptionFilterOperator, CustomBlockPeopleFilterOperator, CustomBlockPersonFilterValue, CustomBlockRelationFilterOperator, CustomBlockStatusFilterOperator, CustomBlockStatusGroupFilterOperator, CustomBlockStatusGroupName, CustomBlockTextFilterOperator, QueryDataSourceMessage, ResolvedCustomBlockDataSourceFilter, ResolvedCustomBlockDataSourcePropertyFilter, ResolvedCustomBlockDataSourceSort, } from "./protocol/messages/queryDataSource.js";
8
8
  export type { ResizeMessage } from "./protocol/messages/resize.js";
9
9
  export type { UpdatePageMessage } from "./protocol/messages/updatePage.js";
10
- export type { NotionDateInput, NotionFileInput, NotionPageCover, NotionPageIcon, NotionPagePropertyValue, NotionPagePropertyWriteMap, NotionRichTextItem, NotionSelectOptionInput, } from "./protocol/pages/page.js";
10
+ export type { NotionDateInput, NotionFileInput, NotionPageCover, NotionPageIcon, NotionPagePropertyReadMap, NotionPagePropertyValue, NotionPagePropertyWriteMap, NotionRichTextItem, NotionSelectOptionInput, } from "./protocol/pages/page.js";
11
11
  export { type AutoBindableProperty, getAutoBoundPropertyIdsByKey, } from "./autoBindProperties.js";
12
12
  export { type CustomBlockHostHandle, type CustomBlockHostOptions, createCustomBlockHost, } from "./createCustomBlockHost.js";
13
13
  export type { ConnectSuccessMessage, CustomBlockHostDataSourcesPayload, CustomBlockHostGetInitialState, CustomBlockHostInitialState, CustomBlockHostInitialStateResult, } from "./lifecycle/types.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAA;AACtF,YAAY,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAA;AAChG,YAAY,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAA;AAC1F,YAAY,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAA;AAC1F,YAAY,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAA;AAC9F,YAAY,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAC5F,YAAY,EACX,iCAAiC,EACjC,iCAAiC,EACjC,kCAAkC,EAClC,6BAA6B,EAC7B,+BAA+B,EAC/B,+BAA+B,EAC/B,+BAA+B,EAC/B,4BAA4B,EAC5B,iCAAiC,EACjC,+BAA+B,EAC/B,oCAAoC,EACpC,0BAA0B,EAC1B,6BAA6B,EAC7B,sBAAsB,EACtB,mCAAmC,EACnC,2CAA2C,EAC3C,iCAAiC,GACjC,MAAM,8DAA8D,CAAA;AACrE,YAAY,EAAE,aAAa,EAAE,MAAM,qDAAqD,CAAA;AACxF,YAAY,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAA;AAChG,YAAY,EACX,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,0BAA0B,EAC1B,kBAAkB,EAClB,uBAAuB,GACvB,MAAM,gDAAgD,CAAA;AACvD,OAAO,EACN,KAAK,oBAAoB,EACzB,4BAA4B,GAC5B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,qBAAqB,GACrB,MAAM,4BAA4B,CAAA;AACnC,YAAY,EACX,qBAAqB,EACrB,iCAAiC,EACjC,8BAA8B,EAC9B,2BAA2B,EAC3B,iCAAiC,GACjC,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,YAAY,EACX,sBAAsB,EACtB,+BAA+B,EAC/B,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAC5B,uBAAuB,EACvB,8BAA8B,EAC9B,2BAA2B,EAC3B,6BAA6B,EAC7B,+BAA+B,EAC/B,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,2BAA2B,EAC3B,kBAAkB,EAClB,sBAAsB,GACtB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EAAE,oCAAoC,EAAE,MAAM,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAA;AACtF,YAAY,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAA;AAChG,YAAY,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAA;AAC1F,YAAY,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAA;AAC1F,YAAY,EAAE,gBAAgB,EAAE,MAAM,wDAAwD,CAAA;AAC9F,YAAY,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAC5F,YAAY,EACX,iCAAiC,EACjC,iCAAiC,EACjC,kCAAkC,EAClC,6BAA6B,EAC7B,+BAA+B,EAC/B,+BAA+B,EAC/B,+BAA+B,EAC/B,4BAA4B,EAC5B,iCAAiC,EACjC,+BAA+B,EAC/B,oCAAoC,EACpC,0BAA0B,EAC1B,6BAA6B,EAC7B,sBAAsB,EACtB,mCAAmC,EACnC,2CAA2C,EAC3C,iCAAiC,GACjC,MAAM,8DAA8D,CAAA;AACrE,YAAY,EAAE,aAAa,EAAE,MAAM,qDAAqD,CAAA;AACxF,YAAY,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAA;AAChG,YAAY,EACX,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,yBAAyB,EACzB,uBAAuB,EACvB,0BAA0B,EAC1B,kBAAkB,EAClB,uBAAuB,GACvB,MAAM,gDAAgD,CAAA;AACvD,OAAO,EACN,KAAK,oBAAoB,EACzB,4BAA4B,GAC5B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,qBAAqB,GACrB,MAAM,4BAA4B,CAAA;AACnC,YAAY,EACX,qBAAqB,EACrB,iCAAiC,EACjC,8BAA8B,EAC9B,2BAA2B,EAC3B,iCAAiC,GACjC,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,YAAY,EACX,sBAAsB,EACtB,+BAA+B,EAC/B,sBAAsB,EACtB,4BAA4B,EAC5B,4BAA4B,EAC5B,uBAAuB,EACvB,8BAA8B,EAC9B,2BAA2B,EAC3B,6BAA6B,EAC7B,+BAA+B,EAC/B,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,2BAA2B,EAC3B,kBAAkB,EAClB,sBAAsB,GACtB,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EAAE,oCAAoC,EAAE,MAAM,oBAAoB,CAAA"}
@@ -181,6 +181,34 @@ export declare const createPageMessageSchema: v.ObjectSchema<{
181
181
  readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
182
182
  readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
183
183
  }, undefined>, undefined>;
184
+ }, undefined>, v.ObjectSchema<{
185
+ readonly id: v.StringSchema<undefined>;
186
+ readonly type: v.LiteralSchema<"created_time", undefined>;
187
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
188
+ }, undefined>, v.ObjectSchema<{
189
+ readonly id: v.StringSchema<undefined>;
190
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
191
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
192
+ }, undefined>, v.ObjectSchema<{
193
+ readonly id: v.StringSchema<undefined>;
194
+ readonly type: v.LiteralSchema<"created_by", undefined>;
195
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
196
+ readonly id: v.StringSchema<undefined>;
197
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
198
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
199
+ }, undefined>, undefined>;
200
+ }, undefined>, v.ObjectSchema<{
201
+ readonly id: v.StringSchema<undefined>;
202
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
203
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
204
+ readonly id: v.StringSchema<undefined>;
205
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
206
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
207
+ }, undefined>, undefined>;
208
+ }, undefined>, v.ObjectSchema<{
209
+ readonly id: v.StringSchema<undefined>;
210
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
211
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
184
212
  }, undefined>], undefined>, undefined>;
185
213
  readonly position: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
186
214
  readonly type: v.LiteralSchema<"start", undefined>;
@@ -1,6 +1,6 @@
1
1
  import * as v from "valibot";
2
2
  import { notionBlockIdSchema, notionDataSourceIdSchema, notionPageIdSchema, } from "../ids.js";
3
- import { notionPagePropertyWriteMapSchema } from "../pages/page.js";
3
+ import { notionPagePropertyReadMapSchema } from "../pages/page.js";
4
4
  /**
5
5
  * Describes where the newly created page should be inserted.
6
6
  * - `start` / `end` (default): prepend / append to the request's `parent`
@@ -46,6 +46,6 @@ export const createPageMessageSchema = v.object({
46
46
  * To create a page with manifest-defined property keys, call `pages.create`. The SDK resolves
47
47
  * those keys before it sends this message.
48
48
  */
49
- properties: notionPagePropertyWriteMapSchema,
49
+ properties: notionPagePropertyReadMapSchema,
50
50
  position: v.optional(notionCreatePagePositionSchema),
51
51
  });
@@ -161,6 +161,34 @@ export declare const createPageResultMessageSchema: v.VariantSchema<"status", [v
161
161
  readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
162
162
  readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
163
163
  }, undefined>, undefined>;
164
+ }, undefined>, v.ObjectSchema<{
165
+ readonly id: v.StringSchema<undefined>;
166
+ readonly type: v.LiteralSchema<"created_time", undefined>;
167
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
168
+ }, undefined>, v.ObjectSchema<{
169
+ readonly id: v.StringSchema<undefined>;
170
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
171
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
172
+ }, undefined>, v.ObjectSchema<{
173
+ readonly id: v.StringSchema<undefined>;
174
+ readonly type: v.LiteralSchema<"created_by", undefined>;
175
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
176
+ readonly id: v.StringSchema<undefined>;
177
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
178
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
179
+ }, undefined>, undefined>;
180
+ }, undefined>, v.ObjectSchema<{
181
+ readonly id: v.StringSchema<undefined>;
182
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
183
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
184
+ readonly id: v.StringSchema<undefined>;
185
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
186
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
187
+ }, undefined>, undefined>;
188
+ }, undefined>, v.ObjectSchema<{
189
+ readonly id: v.StringSchema<undefined>;
190
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
191
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
164
192
  }, undefined>], undefined>, undefined>;
165
193
  readonly created_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
166
194
  readonly last_edited_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -166,6 +166,34 @@ export declare const getPageResultMessageSchema: v.VariantSchema<"status", [v.Ob
166
166
  readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
167
167
  readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
168
168
  }, undefined>, undefined>;
169
+ }, undefined>, v.ObjectSchema<{
170
+ readonly id: v.StringSchema<undefined>;
171
+ readonly type: v.LiteralSchema<"created_time", undefined>;
172
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
173
+ }, undefined>, v.ObjectSchema<{
174
+ readonly id: v.StringSchema<undefined>;
175
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
176
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
177
+ }, undefined>, v.ObjectSchema<{
178
+ readonly id: v.StringSchema<undefined>;
179
+ readonly type: v.LiteralSchema<"created_by", undefined>;
180
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
181
+ readonly id: v.StringSchema<undefined>;
182
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
183
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
184
+ }, undefined>, undefined>;
185
+ }, undefined>, v.ObjectSchema<{
186
+ readonly id: v.StringSchema<undefined>;
187
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
188
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
189
+ readonly id: v.StringSchema<undefined>;
190
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
191
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
192
+ }, undefined>, undefined>;
193
+ }, undefined>, v.ObjectSchema<{
194
+ readonly id: v.StringSchema<undefined>;
195
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
196
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
169
197
  }, undefined>], undefined>, undefined>;
170
198
  readonly created_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
171
199
  readonly last_edited_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -685,6 +685,34 @@ export declare const hostToSandboxMessageSchema: v.VariantSchema<"type", [v.Vari
685
685
  readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
686
686
  readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
687
687
  }, undefined>, undefined>;
688
+ }, undefined>, v.ObjectSchema<{
689
+ readonly id: v.StringSchema<undefined>;
690
+ readonly type: v.LiteralSchema<"created_time", undefined>;
691
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
692
+ }, undefined>, v.ObjectSchema<{
693
+ readonly id: v.StringSchema<undefined>;
694
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
695
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
696
+ }, undefined>, v.ObjectSchema<{
697
+ readonly id: v.StringSchema<undefined>;
698
+ readonly type: v.LiteralSchema<"created_by", undefined>;
699
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
700
+ readonly id: v.StringSchema<undefined>;
701
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
702
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
703
+ }, undefined>, undefined>;
704
+ }, undefined>, v.ObjectSchema<{
705
+ readonly id: v.StringSchema<undefined>;
706
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
707
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
708
+ readonly id: v.StringSchema<undefined>;
709
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
710
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
711
+ }, undefined>, undefined>;
712
+ }, undefined>, v.ObjectSchema<{
713
+ readonly id: v.StringSchema<undefined>;
714
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
715
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
688
716
  }, undefined>], undefined>, undefined>;
689
717
  readonly created_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
690
718
  readonly last_edited_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -885,6 +913,34 @@ export declare const hostToSandboxMessageSchema: v.VariantSchema<"type", [v.Vari
885
913
  readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
886
914
  readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
887
915
  }, undefined>, undefined>;
916
+ }, undefined>, v.ObjectSchema<{
917
+ readonly id: v.StringSchema<undefined>;
918
+ readonly type: v.LiteralSchema<"created_time", undefined>;
919
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
920
+ }, undefined>, v.ObjectSchema<{
921
+ readonly id: v.StringSchema<undefined>;
922
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
923
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
924
+ }, undefined>, v.ObjectSchema<{
925
+ readonly id: v.StringSchema<undefined>;
926
+ readonly type: v.LiteralSchema<"created_by", undefined>;
927
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
928
+ readonly id: v.StringSchema<undefined>;
929
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
930
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
931
+ }, undefined>, undefined>;
932
+ }, undefined>, v.ObjectSchema<{
933
+ readonly id: v.StringSchema<undefined>;
934
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
935
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
936
+ readonly id: v.StringSchema<undefined>;
937
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
938
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
939
+ }, undefined>, undefined>;
940
+ }, undefined>, v.ObjectSchema<{
941
+ readonly id: v.StringSchema<undefined>;
942
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
943
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
888
944
  }, undefined>], undefined>, undefined>;
889
945
  readonly created_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
890
946
  readonly last_edited_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -1152,6 +1208,34 @@ export declare const hostToSandboxMessageSchema: v.VariantSchema<"type", [v.Vari
1152
1208
  readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1153
1209
  readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
1154
1210
  }, undefined>, undefined>;
1211
+ }, undefined>, v.ObjectSchema<{
1212
+ readonly id: v.StringSchema<undefined>;
1213
+ readonly type: v.LiteralSchema<"created_time", undefined>;
1214
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1215
+ }, undefined>, v.ObjectSchema<{
1216
+ readonly id: v.StringSchema<undefined>;
1217
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
1218
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1219
+ }, undefined>, v.ObjectSchema<{
1220
+ readonly id: v.StringSchema<undefined>;
1221
+ readonly type: v.LiteralSchema<"created_by", undefined>;
1222
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
1223
+ readonly id: v.StringSchema<undefined>;
1224
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
1225
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1226
+ }, undefined>, undefined>;
1227
+ }, undefined>, v.ObjectSchema<{
1228
+ readonly id: v.StringSchema<undefined>;
1229
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
1230
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
1231
+ readonly id: v.StringSchema<undefined>;
1232
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
1233
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1234
+ }, undefined>, undefined>;
1235
+ }, undefined>, v.ObjectSchema<{
1236
+ readonly id: v.StringSchema<undefined>;
1237
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
1238
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
1155
1239
  }, undefined>], undefined>, undefined>;
1156
1240
  readonly created_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
1157
1241
  readonly last_edited_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -701,6 +701,34 @@ export declare const sandboxToHostMessageSchema: v.VariantSchema<"type", [v.Vari
701
701
  readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
702
702
  readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
703
703
  }, undefined>, undefined>;
704
+ }, undefined>, v.ObjectSchema<{
705
+ readonly id: v.StringSchema<undefined>;
706
+ readonly type: v.LiteralSchema<"created_time", undefined>;
707
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
708
+ }, undefined>, v.ObjectSchema<{
709
+ readonly id: v.StringSchema<undefined>;
710
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
711
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
712
+ }, undefined>, v.ObjectSchema<{
713
+ readonly id: v.StringSchema<undefined>;
714
+ readonly type: v.LiteralSchema<"created_by", undefined>;
715
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
716
+ readonly id: v.StringSchema<undefined>;
717
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
718
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
719
+ }, undefined>, undefined>;
720
+ }, undefined>, v.ObjectSchema<{
721
+ readonly id: v.StringSchema<undefined>;
722
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
723
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
724
+ readonly id: v.StringSchema<undefined>;
725
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
726
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
727
+ }, undefined>, undefined>;
728
+ }, undefined>, v.ObjectSchema<{
729
+ readonly id: v.StringSchema<undefined>;
730
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
731
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
704
732
  }, undefined>], undefined>, undefined>;
705
733
  readonly position: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
706
734
  readonly type: v.LiteralSchema<"start", undefined>;
@@ -859,6 +887,34 @@ export declare const sandboxToHostMessageSchema: v.VariantSchema<"type", [v.Vari
859
887
  readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
860
888
  readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
861
889
  }, undefined>, undefined>;
890
+ }, undefined>, v.ObjectSchema<{
891
+ readonly id: v.StringSchema<undefined>;
892
+ readonly type: v.LiteralSchema<"created_time", undefined>;
893
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
894
+ }, undefined>, v.ObjectSchema<{
895
+ readonly id: v.StringSchema<undefined>;
896
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
897
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
898
+ }, undefined>, v.ObjectSchema<{
899
+ readonly id: v.StringSchema<undefined>;
900
+ readonly type: v.LiteralSchema<"created_by", undefined>;
901
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
902
+ readonly id: v.StringSchema<undefined>;
903
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
904
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
905
+ }, undefined>, undefined>;
906
+ }, undefined>, v.ObjectSchema<{
907
+ readonly id: v.StringSchema<undefined>;
908
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
909
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
910
+ readonly id: v.StringSchema<undefined>;
911
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
912
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
913
+ }, undefined>, undefined>;
914
+ }, undefined>, v.ObjectSchema<{
915
+ readonly id: v.StringSchema<undefined>;
916
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
917
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
862
918
  }, undefined>], undefined>, undefined>, undefined>;
863
919
  readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
864
920
  readonly type: v.LiteralSchema<"emoji", undefined>;
@@ -137,6 +137,34 @@ export declare const updatePageMessageSchema: v.ObjectSchema<{
137
137
  readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
138
138
  readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
139
139
  }, undefined>, undefined>;
140
+ }, undefined>, v.ObjectSchema<{
141
+ readonly id: v.StringSchema<undefined>;
142
+ readonly type: v.LiteralSchema<"created_time", undefined>;
143
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
144
+ }, undefined>, v.ObjectSchema<{
145
+ readonly id: v.StringSchema<undefined>;
146
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
147
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
148
+ }, undefined>, v.ObjectSchema<{
149
+ readonly id: v.StringSchema<undefined>;
150
+ readonly type: v.LiteralSchema<"created_by", undefined>;
151
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
152
+ readonly id: v.StringSchema<undefined>;
153
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
154
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
155
+ }, undefined>, undefined>;
156
+ }, undefined>, v.ObjectSchema<{
157
+ readonly id: v.StringSchema<undefined>;
158
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
159
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
160
+ readonly id: v.StringSchema<undefined>;
161
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
162
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
163
+ }, undefined>, undefined>;
164
+ }, undefined>, v.ObjectSchema<{
165
+ readonly id: v.StringSchema<undefined>;
166
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
167
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
140
168
  }, undefined>], undefined>, undefined>, undefined>;
141
169
  readonly icon: v.OptionalSchema<v.VariantSchema<"type", [v.ObjectSchema<{
142
170
  readonly type: v.LiteralSchema<"emoji", undefined>;
@@ -1,6 +1,6 @@
1
1
  import * as v from "valibot";
2
2
  import { notionPageIdSchema } from "../ids.js";
3
- import { notionPageCoverSchema, notionPageIconSchema, notionPagePropertyWriteMapSchema, } from "../pages/page.js";
3
+ import { notionPageCoverSchema, notionPageIconSchema, notionPagePropertyReadMapSchema, } from "../pages/page.js";
4
4
  /**
5
5
  * The sandbox sends this message to patch a page.
6
6
  */
@@ -15,7 +15,7 @@ export const updatePageMessageSchema = v.object({
15
15
  * To update a page with manifest-defined property keys, call `row.update()` on a row returned
16
16
  * by `useDataSource()`. The SDK resolves those keys before it sends this message.
17
17
  */
18
- properties: v.optional(notionPagePropertyWriteMapSchema),
18
+ properties: v.optional(notionPagePropertyReadMapSchema),
19
19
  icon: v.optional(notionPageIconSchema),
20
20
  cover: v.optional(notionPageCoverSchema),
21
21
  archived: v.optional(v.boolean()),
@@ -160,6 +160,34 @@ export declare const updatePageResultMessageSchema: v.VariantSchema<"status", [v
160
160
  readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
161
161
  readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
162
162
  }, undefined>, undefined>;
163
+ }, undefined>, v.ObjectSchema<{
164
+ readonly id: v.StringSchema<undefined>;
165
+ readonly type: v.LiteralSchema<"created_time", undefined>;
166
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
167
+ }, undefined>, v.ObjectSchema<{
168
+ readonly id: v.StringSchema<undefined>;
169
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
170
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
171
+ }, undefined>, v.ObjectSchema<{
172
+ readonly id: v.StringSchema<undefined>;
173
+ readonly type: v.LiteralSchema<"created_by", undefined>;
174
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
175
+ readonly id: v.StringSchema<undefined>;
176
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
177
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
178
+ }, undefined>, undefined>;
179
+ }, undefined>, v.ObjectSchema<{
180
+ readonly id: v.StringSchema<undefined>;
181
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
182
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
183
+ readonly id: v.StringSchema<undefined>;
184
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
185
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
186
+ }, undefined>, undefined>;
187
+ }, undefined>, v.ObjectSchema<{
188
+ readonly id: v.StringSchema<undefined>;
189
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
190
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
163
191
  }, undefined>], undefined>, undefined>;
164
192
  readonly created_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
165
193
  readonly last_edited_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -283,9 +283,37 @@ export declare const notionPagePropertyValueSchema: v.VariantSchema<"type", [v.O
283
283
  readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
284
284
  readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
285
285
  }, undefined>, undefined>;
286
+ }, undefined>, v.ObjectSchema<{
287
+ readonly id: v.StringSchema<undefined>;
288
+ readonly type: v.LiteralSchema<"created_time", undefined>;
289
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
290
+ }, undefined>, v.ObjectSchema<{
291
+ readonly id: v.StringSchema<undefined>;
292
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
293
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
294
+ }, undefined>, v.ObjectSchema<{
295
+ readonly id: v.StringSchema<undefined>;
296
+ readonly type: v.LiteralSchema<"created_by", undefined>;
297
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
298
+ readonly id: v.StringSchema<undefined>;
299
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
300
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
301
+ }, undefined>, undefined>;
302
+ }, undefined>, v.ObjectSchema<{
303
+ readonly id: v.StringSchema<undefined>;
304
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
305
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
306
+ readonly id: v.StringSchema<undefined>;
307
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
308
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
309
+ }, undefined>, undefined>;
310
+ }, undefined>, v.ObjectSchema<{
311
+ readonly id: v.StringSchema<undefined>;
312
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
313
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
286
314
  }, undefined>], undefined>;
287
315
  export type NotionPagePropertyValue = v.InferOutput<typeof notionPagePropertyValueSchema>;
288
- export declare const notionPagePropertyWriteMapSchema: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
316
+ export declare const notionPagePropertyReadMapSchema: v.RecordSchema<v.StringSchema<undefined>, v.VariantSchema<"type", [v.ObjectSchema<{
289
317
  readonly id: v.StringSchema<undefined>;
290
318
  readonly type: v.LiteralSchema<"title", undefined>;
291
319
  readonly title: v.ArraySchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, undefined>;
@@ -409,8 +437,39 @@ export declare const notionPagePropertyWriteMapSchema: v.RecordSchema<v.StringSc
409
437
  readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
410
438
  readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
411
439
  }, undefined>, undefined>;
440
+ }, undefined>, v.ObjectSchema<{
441
+ readonly id: v.StringSchema<undefined>;
442
+ readonly type: v.LiteralSchema<"created_time", undefined>;
443
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
444
+ }, undefined>, v.ObjectSchema<{
445
+ readonly id: v.StringSchema<undefined>;
446
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
447
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
448
+ }, undefined>, v.ObjectSchema<{
449
+ readonly id: v.StringSchema<undefined>;
450
+ readonly type: v.LiteralSchema<"created_by", undefined>;
451
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
452
+ readonly id: v.StringSchema<undefined>;
453
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
454
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
455
+ }, undefined>, undefined>;
456
+ }, undefined>, v.ObjectSchema<{
457
+ readonly id: v.StringSchema<undefined>;
458
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
459
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
460
+ readonly id: v.StringSchema<undefined>;
461
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
462
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
463
+ }, undefined>, undefined>;
464
+ }, undefined>, v.ObjectSchema<{
465
+ readonly id: v.StringSchema<undefined>;
466
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
467
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
412
468
  }, undefined>], undefined>, undefined>;
413
- export type NotionPagePropertyWriteMap = v.InferOutput<typeof notionPagePropertyWriteMapSchema>;
469
+ export type NotionPagePropertyReadMap = v.InferOutput<typeof notionPagePropertyReadMapSchema>;
470
+ export type NotionPagePropertyWriteMap = Record<string, Exclude<NotionPagePropertyValue, {
471
+ type: "created_time" | "last_edited_time" | "created_by" | "last_edited_by" | "last_visited_time";
472
+ }>>;
414
473
  /**
415
474
  * The `Page` object returned in `createPageResult` messages.
416
475
  */
@@ -559,6 +618,34 @@ export declare const notionPageSchema: v.ObjectSchema<{
559
618
  readonly aws_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
560
619
  readonly google_place_id: v.OptionalSchema<v.NullableSchema<v.StringSchema<undefined>, undefined>, undefined>;
561
620
  }, undefined>, undefined>;
621
+ }, undefined>, v.ObjectSchema<{
622
+ readonly id: v.StringSchema<undefined>;
623
+ readonly type: v.LiteralSchema<"created_time", undefined>;
624
+ readonly created_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
625
+ }, undefined>, v.ObjectSchema<{
626
+ readonly id: v.StringSchema<undefined>;
627
+ readonly type: v.LiteralSchema<"last_edited_time", undefined>;
628
+ readonly last_edited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
629
+ }, undefined>, v.ObjectSchema<{
630
+ readonly id: v.StringSchema<undefined>;
631
+ readonly type: v.LiteralSchema<"created_by", undefined>;
632
+ readonly created_by: v.NullableSchema<v.ObjectSchema<{
633
+ readonly id: v.StringSchema<undefined>;
634
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
635
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
636
+ }, undefined>, undefined>;
637
+ }, undefined>, v.ObjectSchema<{
638
+ readonly id: v.StringSchema<undefined>;
639
+ readonly type: v.LiteralSchema<"last_edited_by", undefined>;
640
+ readonly last_edited_by: v.NullableSchema<v.ObjectSchema<{
641
+ readonly id: v.StringSchema<undefined>;
642
+ readonly table: v.PicklistSchema<["notion_user", "bot", "organization_bot"], undefined>;
643
+ readonly spaceId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
644
+ }, undefined>, undefined>;
645
+ }, undefined>, v.ObjectSchema<{
646
+ readonly id: v.StringSchema<undefined>;
647
+ readonly type: v.LiteralSchema<"last_visited_time", undefined>;
648
+ readonly last_visited_time: v.NullableSchema<v.StringSchema<undefined>, undefined>;
562
649
  }, undefined>], undefined>, undefined>;
563
650
  readonly created_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
564
651
  readonly last_edited_time: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -5,6 +5,7 @@
5
5
  * shape the host delivers for messages like `createPageResult`.
6
6
  */
7
7
  import * as v from "valibot";
8
+ import { notionRecordPointerSchema } from "../dataSources/recordPointer.js";
8
9
  import { notionPageIdSchema } from "../ids.js";
9
10
  import { notionParentSchema } from "../parent.js";
10
11
  /**
@@ -117,6 +118,11 @@ const notionPlaceInputSchema = v.object({
117
118
  const pagePropertyBaseSchema = {
118
119
  id: v.string(),
119
120
  };
121
+ const metadataActorSchema = v.nullable(v.object({
122
+ ...notionRecordPointerSchema.entries,
123
+ table: v.picklist(["notion_user", "bot", "organization_bot"]),
124
+ spaceId: v.optional(v.string()),
125
+ }));
120
126
  /**
121
127
  * A page property value.
122
128
  */
@@ -197,8 +203,33 @@ export const notionPagePropertyValueSchema = v.variant("type", [
197
203
  type: v.literal("place"),
198
204
  place: v.nullable(notionPlaceInputSchema),
199
205
  }),
206
+ v.object({
207
+ ...pagePropertyBaseSchema,
208
+ type: v.literal("created_time"),
209
+ created_time: nullableStringSchema,
210
+ }),
211
+ v.object({
212
+ ...pagePropertyBaseSchema,
213
+ type: v.literal("last_edited_time"),
214
+ last_edited_time: nullableStringSchema,
215
+ }),
216
+ v.object({
217
+ ...pagePropertyBaseSchema,
218
+ type: v.literal("created_by"),
219
+ created_by: metadataActorSchema,
220
+ }),
221
+ v.object({
222
+ ...pagePropertyBaseSchema,
223
+ type: v.literal("last_edited_by"),
224
+ last_edited_by: metadataActorSchema,
225
+ }),
226
+ v.object({
227
+ ...pagePropertyBaseSchema,
228
+ type: v.literal("last_visited_time"),
229
+ last_visited_time: nullableStringSchema,
230
+ }),
200
231
  ]);
201
- export const notionPagePropertyWriteMapSchema = v.record(v.string(), notionPagePropertyValueSchema);
232
+ export const notionPagePropertyReadMapSchema = v.record(v.string(), notionPagePropertyValueSchema);
202
233
  /**
203
234
  * The `Page` object returned in `createPageResult` messages.
204
235
  */
@@ -206,7 +237,7 @@ export const notionPageSchema = v.object({
206
237
  object: v.literal("page"),
207
238
  id: notionPageIdSchema,
208
239
  parent: notionParentSchema,
209
- properties: notionPagePropertyWriteMapSchema,
240
+ properties: notionPagePropertyReadMapSchema,
210
241
  created_time: v.optional(v.string()),
211
242
  last_edited_time: v.optional(v.string()),
212
243
  icon: v.optional(notionPageIconSchema),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@notionhq/custom-blocks-host",
3
- "version": "0.2.19",
3
+ "version": "0.2.20",
4
4
  "description": "Reusable host runtime for Notion custom blocks.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -30,6 +30,7 @@ export type {
30
30
  NotionFileInput,
31
31
  NotionPageCover,
32
32
  NotionPageIcon,
33
+ NotionPagePropertyReadMap,
33
34
  NotionPagePropertyValue,
34
35
  NotionPagePropertyWriteMap,
35
36
  NotionRichTextItem,