@instantdb/platform 0.22.100 → 0.22.101
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/.turbo/turbo-build.log
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
|
|
2
|
-
> @instantdb/platform@0.22.
|
|
2
|
+
> @instantdb/platform@0.22.101 build /home/runner/work/instant/instant/client/packages/platform
|
|
3
3
|
> rm -rf dist; npm run build:tshy && npm run build:standalone && npm run check-exports
|
|
4
4
|
|
|
5
5
|
npm warn Unknown env config "verify-deps-before-run". This will stop working in the next major version of npm.
|
|
6
6
|
npm warn Unknown user config "always-auth". This will stop working in the next major version of npm.
|
|
7
7
|
|
|
8
|
-
> @instantdb/platform@0.22.
|
|
8
|
+
> @instantdb/platform@0.22.101 build:tshy
|
|
9
9
|
> tshy
|
|
10
10
|
|
|
11
11
|
npm warn Unknown env config "verify-deps-before-run". This will stop working in the next major version of npm.
|
|
12
12
|
npm warn Unknown user config "always-auth". This will stop working in the next major version of npm.
|
|
13
13
|
|
|
14
|
-
> @instantdb/platform@0.22.
|
|
14
|
+
> @instantdb/platform@0.22.101 build:standalone
|
|
15
15
|
> vite build
|
|
16
16
|
|
|
17
17
|
[36mvite v5.4.14 [32mbuilding for production...[36m[39m
|
|
@@ -21,15 +21,15 @@ rendering chunks...
|
|
|
21
21
|
computing gzip size...
|
|
22
22
|
[2mdist/standalone/[22m[36mindex.umd.cjs [39m[1m[2m350.81 kB[22m[1m[22m[2m │ gzip: 95.26 kB[22m
|
|
23
23
|
[2mdist/standalone/[22m[36mindex.js [39m[1m[2m457.48 kB[22m[1m[22m[2m │ gzip: 107.25 kB[22m
|
|
24
|
-
[32m✓ built in 2.
|
|
24
|
+
[32m✓ built in 2.12s[39m
|
|
25
25
|
npm warn Unknown env config "verify-deps-before-run". This will stop working in the next major version of npm.
|
|
26
26
|
npm warn Unknown user config "always-auth". This will stop working in the next major version of npm.
|
|
27
27
|
|
|
28
|
-
> @instantdb/platform@0.22.
|
|
28
|
+
> @instantdb/platform@0.22.101 check-exports
|
|
29
29
|
> attw --pack .
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
@instantdb/platform v0.22.
|
|
32
|
+
@instantdb/platform v0.22.101
|
|
33
33
|
|
|
34
34
|
Build tools:
|
|
35
35
|
- @arethetypeswrong/cli@^0.17.4
|
package/dist/standalone/index.js
CHANGED
|
@@ -833,7 +833,7 @@ class $e extends Ut {
|
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
835
|
typeof window < "u" && typeof window.localStorage < "u" && (window.localStorage.getItem("devBackend"), window.localStorage.getItem("__instantLogging"), window.localStorage.getItem("__devtoolLocalDash"));
|
|
836
|
-
const je = "v0.22.
|
|
836
|
+
const je = "v0.22.101";
|
|
837
837
|
class Q {
|
|
838
838
|
constructor(t, s, e, i = { indexed: !1, unique: !1 }) {
|
|
839
839
|
m(this, "valueType");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(S,v){typeof exports=="object"&&typeof module<"u"?v(exports):typeof define=="function"&&define.amd?define(["exports"],v):(S=typeof globalThis<"u"?globalThis:S||self,v(S.instant={}))})(this,function(S){"use strict";var Bn=Object.defineProperty;var yi=S=>{throw TypeError(S)};var Rn=(S,v,N)=>v in S?Bn(S,v,{enumerable:!0,configurable:!0,writable:!0,value:N}):S[v]=N;var m=(S,v,N)=>Rn(S,typeof v!="symbol"?v+"":v,N),xi=(S,v,N)=>v.has(S)||yi("Cannot "+N);var w=(S,v,N)=>(xi(S,v,"read from private field"),N?N.call(S):v.get(S)),xe=(S,v,N)=>v.has(S)?yi("Cannot add the same private member more than once"):v instanceof WeakSet?v.add(S):v.set(S,N),Pe=(S,v,N,Le)=>(xi(S,v,"write to private field"),Le?Le.call(S,N):v.set(S,N),N);var se,Y,ft,dt,mt,F,j;class v extends Error{constructor(s){super(s.message);m(this,"error");m(this,"errorDescription");const e=new.target.prototype;Object.setPrototypeOf&&Object.setPrototypeOf(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,v),this.name="InstantOAuthError",this.error=s.error,this.errorDescription=s.errorDescription}get[Symbol.toStringTag](){return"InstantAPIError"}}const N={Remove:"remove",Replace:"replace",Add:"add"},Le=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),We=Symbol.iterator,Z={mutable:"mutable",immutable:"immutable"},xt={};function Me(r,t){return r instanceof Map?r.has(t):Object.prototype.hasOwnProperty.call(r,t)}function as(r,t){if(t in r){let s=Reflect.getPrototypeOf(r);for(;s;){const e=Reflect.getOwnPropertyDescriptor(s,t);if(e)return e;s=Reflect.getPrototypeOf(s)}}}function ns(r){return Object.getPrototypeOf(r)===Set.prototype}function os(r){return Object.getPrototypeOf(r)===Map.prototype}function G(r){var t;return(t=r.copy)!==null&&t!==void 0?t:r.original}function Pt(r){return!!L(r)}function L(r){return typeof r!="object"?null:r==null?void 0:r[Le]}function gt(r){var t;const s=L(r);return s?(t=s.copy)!==null&&t!==void 0?t:s.original:r}function ge(r,t){if(!r||typeof r!="object")return!1;let s;return Object.getPrototypeOf(r)===Object.prototype||Array.isArray(r)||r instanceof Map||r instanceof Set||!!(t!=null&&t.mark)&&((s=t.mark(r,Z))===Z.immutable||typeof s=="function")}function cs(r,t=[]){if(Object.hasOwnProperty.call(r,"key")){const s=r.parent.copy,e=L(he(s,r.key));if(e!==null&&(e==null?void 0:e.original)!==r.original)return null;const i=r.parent.type===3,a=i?Array.from(r.parent.setMap.keys()).indexOf(r.key):r.key;if(!(i&&s.size>a||Me(s,a)))return null;t.push(a)}if(r.parent)return cs(r.parent,t);t.reverse();try{Pi(r.copy,t)}catch{return null}return t}function Fe(r){return Array.isArray(r)?1:r instanceof Map?2:r instanceof Set?3:0}function he(r,t){return Fe(r)===2?r.get(t):r[t]}function bt(r,t,s){Fe(r)===2?r.set(t,s):r[t]=s}function Tt(r,t){const s=L(r);return(s?G(s):r)[t]}function be(r,t){return r===t?r!==0||1/r===1/t:r!==r&&t!==t}function Te(r,t){return t?r:[""].concat(r).map(s=>{const e=`${s}`;return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}).join("/")}function Pi(r,t){for(let s=0;s<t.length-1;s+=1){const e=t[s];if(r=he(Fe(r)===3?Array.from(r):r,e),typeof r!="object")throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}return r}function gi(r){const t=Object.create(Object.getPrototypeOf(r));return Reflect.ownKeys(r).forEach(s=>{let e=Reflect.getOwnPropertyDescriptor(r,s);if(e.enumerable&&e.configurable&&e.writable){t[s]=r[s];return}e.writable||(e.writable=!0,e.configurable=!0),(e.get||e.set)&&(e={configurable:!0,writable:!0,enumerable:e.enumerable,value:r[s]}),Reflect.defineProperty(t,s,e)}),t}const bi=Object.prototype.propertyIsEnumerable;function Ti(r,t){let s;if(Array.isArray(r))return Array.prototype.concat.call(r);if(r instanceof Set){if(!ns(r)){const e=Object.getPrototypeOf(r).constructor;return new e(r.values())}return Set.prototype.difference?Set.prototype.difference.call(r,new Set):new Set(r.values())}else if(r instanceof Map){if(!os(r)){const e=Object.getPrototypeOf(r).constructor;return new e(r)}return new Map(r)}else if(t!=null&&t.mark&&(s=t.mark(r,Z),s!==void 0)&&s!==Z.mutable){if(s===Z.immutable)return gi(r);if(typeof s=="function"){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return s()}throw new Error(`Unsupported mark result: ${s}`)}else if(typeof r=="object"&&Object.getPrototypeOf(r)===Object.prototype){const e={};return Object.keys(r).forEach(i=>{e[i]=r[i]}),Object.getOwnPropertySymbols(r).forEach(i=>{bi.call(r,i)&&(e[i]=r[i])}),e}else throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function H(r){r.copy||(r.copy=Ti(r.original,r.options))}function Be(r){if(!ge(r))return gt(r);if(Array.isArray(r))return r.map(Be);if(r instanceof Map){const s=Array.from(r.entries()).map(([e,i])=>[e,Be(i)]);if(!os(r)){const e=Object.getPrototypeOf(r).constructor;return new e(s)}return new Map(s)}if(r instanceof Set){const s=Array.from(r).map(Be);if(!ns(r)){const e=Object.getPrototypeOf(r).constructor;return new e(s)}return new Set(s)}const t=Object.create(Object.getPrototypeOf(r));for(const s in r)t[s]=Be(r[s]);return t}function Xe(r){return Pt(r)?Be(r):r}function ie(r){var t;r.assignedMap=(t=r.assignedMap)!==null&&t!==void 0?t:new Map,r.operated||(r.operated=!0,r.parent&&ie(r.parent))}function wi(r,t){const s=Fe(r);if(s===0)Reflect.ownKeys(r).forEach(e=>{t(e,r[e],r)});else if(s===1){let e=0;for(const i of r)t(e,i,r),e+=1}else r.forEach((e,i)=>t(i,e,r))}function hs(r,t,s){if(Pt(r)||!ge(r,s)||t.has(r)||Object.isFrozen(r))return;const e=r instanceof Set,i=e?new Map:void 0;if(t.add(r),wi(r,(a,n)=>{var o;if(Pt(n)){const c=L(n);H(c);const h=!((o=c.assignedMap)===null||o===void 0)&&o.size||c.operated?c.copy:c.original;bt(e?i:r,a,h)}else hs(n,t,s)}),i){const a=r,n=Array.from(a);a.clear(),n.forEach(o=>{a.add(i.has(o)?i.get(o):o)})}}function Ai(r,t){const s=r.type===3?r.setMap:r.copy;r.finalities.revoke.length>1&&r.assignedMap.get(t)&&s&&hs(he(s,t),r.finalities.handledSet,r.options)}function wt(r){r.type===3&&r.copy&&(r.copy.clear(),r.setMap.forEach(t=>{r.copy.add(gt(t))}))}function At(r,t,s,e){if(r.operated&&r.assignedMap&&r.assignedMap.size>0&&!r.finalized){if(s&&e){const a=cs(r);a&&t(r,a,s,e)}r.finalized=!0}}function St(r,t,s,e){const i=L(s);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push((a,n)=>{var o;const c=r.type===3?r.setMap:r.copy;if(be(he(c,t),s)){let h=i.original;i.copy&&(h=i.copy),wt(r),At(r,e,a,n),r.options.enableAutoFreeze&&(r.options.updatedValues=(o=r.options.updatedValues)!==null&&o!==void 0?o:new WeakMap,r.options.updatedValues.set(h,i.original)),bt(c,t,h)}}),r.options.enableAutoFreeze&&i.finalities!==r.finalities&&(r.options.enableAutoFreeze=!1)),ge(s,r.options)&&r.finalities.draft.push(()=>{const a=r.type===3?r.setMap:r.copy;be(he(a,t),s)&&Ai(r,t)})}function Si(r,t,s,e,i){let{original:a,assignedMap:n,options:o}=r,c=r.copy;c.length<a.length&&([a,c]=[c,a],[s,e]=[e,s]);for(let h=0;h<a.length;h+=1)if(n.get(h.toString())&&c[h]!==a[h]){const l=t.concat([h]),p=Te(l,i);s.push({op:N.Replace,path:p,value:Xe(c[h])}),e.push({op:N.Replace,path:p,value:Xe(a[h])})}for(let h=a.length;h<c.length;h+=1){const l=t.concat([h]),p=Te(l,i);s.push({op:N.Add,path:p,value:Xe(c[h])})}if(a.length<c.length){const{arrayLengthAssignment:h=!0}=o.enablePatches;if(h){const l=t.concat(["length"]),p=Te(l,i);e.push({op:N.Replace,path:p,value:a.length})}else for(let l=c.length;a.length<l;l-=1){const p=t.concat([l-1]),d=Te(p,i);e.push({op:N.Remove,path:d})}}}function Ii({original:r,copy:t,assignedMap:s},e,i,a,n){s.forEach((o,c)=>{const h=he(r,c),l=Xe(he(t,c)),p=o?Me(r,c)?N.Replace:N.Add:N.Remove;if(be(h,l)&&p===N.Replace)return;const d=e.concat(c),f=Te(d,n);i.push(p===N.Remove?{op:p,path:f}:{op:p,path:f,value:l}),a.push(p===N.Add?{op:N.Remove,path:f}:p===N.Remove?{op:N.Add,path:f,value:h}:{op:N.Replace,path:f,value:h})})}function Ei({original:r,copy:t},s,e,i,a){let n=0;r.forEach(o=>{if(!t.has(o)){const c=s.concat([n]),h=Te(c,a);e.push({op:N.Remove,path:h,value:o}),i.unshift({op:N.Add,path:h,value:o})}n+=1}),n=0,t.forEach(o=>{if(!r.has(o)){const c=s.concat([n]),h=Te(c,a);e.push({op:N.Add,path:h,value:o}),i.unshift({op:N.Remove,path:h,value:o})}n+=1})}function Re(r,t,s,e){const{pathAsArray:i=!0}=r.options.enablePatches;switch(r.type){case 0:case 2:return Ii(r,t,s,e,i);case 1:return Si(r,t,s,e,i);case 3:return Ei(r,t,s,e,i)}}const Ge=(r,t,s=!1)=>{if(typeof r=="object"&&r!==null&&(!ge(r,t)||s))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},It={get size(){return G(L(this)).size},has(r){return G(L(this)).has(r)},set(r,t){const s=L(this),e=G(s);return(!e.has(r)||!be(e.get(r),t))&&(H(s),ie(s),s.assignedMap.set(r,!0),s.copy.set(r,t),St(s,r,t,Re)),this},delete(r){if(!this.has(r))return!1;const t=L(this);return H(t),ie(t),t.original.has(r)?t.assignedMap.set(r,!1):t.assignedMap.delete(r),t.copy.delete(r),!0},clear(){const r=L(this);if(this.size){H(r),ie(r),r.assignedMap=new Map;for(const[t]of r.original)r.assignedMap.set(t,!1);r.copy.clear()}},forEach(r,t){const s=L(this);G(s).forEach((e,i)=>{r.call(t,this.get(i),i,this)})},get(r){var t,s;const e=L(this),i=G(e).get(r),a=((s=(t=e.options).mark)===null||s===void 0?void 0:s.call(t,i,Z))===Z.mutable;if(e.options.strict&&Ge(i,e.options,a),a||e.finalized||!ge(i,e.options)||i!==e.original.get(r))return i;const n=xt.createDraft({original:i,parentDraft:e,key:r,finalities:e.finalities,options:e.options});return H(e),e.copy.set(r,n),n},keys(){return G(L(this)).keys()},values(){const r=this.keys();return{[We]:()=>this.values(),next:()=>{const t=r.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const r=this.keys();return{[We]:()=>this.entries(),next:()=>{const t=r.next();if(t.done)return t;const s=this.get(t.value);return{done:!1,value:[t.value,s]}}}},[We](){return this.entries()}},Ci=Reflect.ownKeys(It),ls=(r,t,{isValuesIterator:s})=>()=>{var e,i;const a=t.next();if(a.done)return a;const n=a.value;let o=r.setMap.get(n);const c=L(o),h=((i=(e=r.options).mark)===null||i===void 0?void 0:i.call(e,o,Z))===Z.mutable;if(r.options.strict&&Ge(n,r.options,h),!h&&!c&&ge(n,r.options)&&!r.finalized&&r.original.has(n)){const l=xt.createDraft({original:n,parentDraft:r,key:n,finalities:r.finalities,options:r.options});r.setMap.set(n,l),o=l}else c&&(o=c.proxy);return{done:!1,value:s?o:[o,o]}},Ye={get size(){return L(this).setMap.size},has(r){const t=L(this);if(t.setMap.has(r))return!0;H(t);const s=L(r);return!!(s&&t.setMap.has(s.original))},add(r){const t=L(this);return this.has(r)||(H(t),ie(t),t.assignedMap.set(r,!0),t.setMap.set(r,r),St(t,r,r,Re)),this},delete(r){if(!this.has(r))return!1;const t=L(this);H(t),ie(t);const s=L(r);return s&&t.setMap.has(s.original)?(t.assignedMap.set(s.original,!1),t.setMap.delete(s.original)):(!s&&t.setMap.has(r)?t.assignedMap.set(r,!1):t.assignedMap.delete(r),t.setMap.delete(r))},clear(){if(!this.size)return;const r=L(this);H(r),ie(r);for(const t of r.original)r.assignedMap.set(t,!1);r.setMap.clear()},values(){const r=L(this);H(r);const t=r.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:ls(r,t,{isValuesIterator:!0})}},entries(){const r=L(this);H(r);const t=r.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:ls(r,t,{isValuesIterator:!1})}},keys(){return this.values()},[We](){return this.values()},forEach(r,t){const s=this.values();let e=s.next();for(;!e.done;)r.call(t,e.value,e.value,this),e=s.next()}};Set.prototype.difference&&Object.assign(Ye,{intersection(r){return Set.prototype.intersection.call(new Set(this.values()),r)},union(r){return Set.prototype.union.call(new Set(this.values()),r)},difference(r){return Set.prototype.difference.call(new Set(this.values()),r)},symmetricDifference(r){return Set.prototype.symmetricDifference.call(new Set(this.values()),r)},isSubsetOf(r){return Set.prototype.isSubsetOf.call(new Set(this.values()),r)},isSupersetOf(r){return Set.prototype.isSupersetOf.call(new Set(this.values()),r)},isDisjointFrom(r){return Set.prototype.isDisjointFrom.call(new Set(this.values()),r)}});const Ni=Reflect.ownKeys(Ye),us=new WeakSet,ps={get(r,t,s){var e,i;const a=(e=r.copy)===null||e===void 0?void 0:e[t];if(a&&us.has(a))return a;if(t===Le)return r;let n;if(r.options.mark){const h=t==="size"&&(r.original instanceof Map||r.original instanceof Set)?Reflect.get(r.original,t):Reflect.get(r.original,t,s);if(n=r.options.mark(h,Z),n===Z.mutable)return r.options.strict&&Ge(h,r.options,!0),h}const o=G(r);if(o instanceof Map&&Ci.includes(t)){if(t==="size")return Object.getOwnPropertyDescriptor(It,"size").get.call(r.proxy);const h=It[t];if(h)return h.bind(r.proxy)}if(o instanceof Set&&Ni.includes(t)){if(t==="size")return Object.getOwnPropertyDescriptor(Ye,"size").get.call(r.proxy);const h=Ye[t];if(h)return h.bind(r.proxy)}if(!Me(o,t)){const h=as(o,t);return h?"value"in h?h.value:(i=h.get)===null||i===void 0?void 0:i.call(r.proxy):void 0}const c=o[t];if(r.options.strict&&Ge(c,r.options),r.finalized||!ge(c,r.options))return c;if(c===Tt(r.original,t)){if(H(r),r.copy[t]=fs({original:r.original[t],parentDraft:r,key:r.type===1?Number(t):t,finalities:r.finalities,options:r.options}),typeof n=="function"){const h=L(r.copy[t]);return H(h),ie(h),h.copy}return r.copy[t]}return c},set(r,t,s){var e;if(r.type===3||r.type===2)throw new Error("Map/Set draft does not support any property assignment.");let i;if(r.type===1&&t!=="length"&&!(Number.isInteger(i=Number(t))&&i>=0&&(t===0||i===0||String(i)===String(t))))throw new Error("Only supports setting array indices and the 'length' property.");const a=as(G(r),t);if(a!=null&&a.set)return a.set.call(r.proxy,s),!0;const n=Tt(G(r),t),o=L(n);return o&&be(o.original,s)?(r.copy[t]=s,r.assignedMap=(e=r.assignedMap)!==null&&e!==void 0?e:new Map,r.assignedMap.set(t,!1),!0):(be(s,n)&&(s!==void 0||Me(r.original,t))||(H(r),ie(r),Me(r.original,t)&&be(s,r.original[t])?r.assignedMap.delete(t):r.assignedMap.set(t,!0),r.copy[t]=s,St(r,t,s,Re)),!0)},has(r,t){return t in G(r)},ownKeys(r){return Reflect.ownKeys(G(r))},getOwnPropertyDescriptor(r,t){const s=G(r),e=Reflect.getOwnPropertyDescriptor(s,t);return e&&{writable:!0,configurable:r.type!==1||t!=="length",enumerable:e.enumerable,value:s[t]}},getPrototypeOf(r){return Reflect.getPrototypeOf(r.original)},setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(r,t){var s;return r.type===1?ps.set.call(this,r,t,void 0,r.proxy):(Tt(r.original,t)!==void 0||t in r.original?(H(r),ie(r),r.assignedMap.set(t,!1)):(r.assignedMap=(s=r.assignedMap)!==null&&s!==void 0?s:new Map,r.assignedMap.delete(t)),r.copy&&delete r.copy[t],!0)}};function fs(r){const{original:t,parentDraft:s,key:e,finalities:i,options:a}=r,n=Fe(t),o={type:n,finalized:!1,parent:s,original:t,copy:null,proxy:null,finalities:i,options:a,setMap:n===3?new Map(t.entries()):void 0};(e||"key"in r)&&(o.key=e);const{proxy:c,revoke:h}=Proxy.revocable(n===1?Object.assign([],o):o,ps);if(i.revoke.push(h),us.add(c),o.proxy=c,s){const l=s;l.finalities.draft.push((p,d)=>{var f,x;const A=L(c);let _=l.type===3?l.setMap:l.copy;const C=he(_,e),O=L(C);if(O){let U=O.original;O.operated&&(U=gt(C)),wt(O),At(O,Re,p,d),l.options.enableAutoFreeze&&(l.options.updatedValues=(f=l.options.updatedValues)!==null&&f!==void 0?f:new WeakMap,l.options.updatedValues.set(U,O.original)),bt(_,e,U)}(x=A.callbacks)===null||x===void 0||x.forEach(U=>{U(p,d)})})}else{const l=L(c);l.finalities.draft.push((p,d)=>{wt(l),At(l,Re,p,d)})}return c}xt.createDraft=fs,Object.prototype.constructor.toString();const z=[];for(let r=0;r<256;++r)z.push((r+256).toString(16).slice(1));function ki(r,t=0){return(z[r[t+0]]+z[r[t+1]]+z[r[t+2]]+z[r[t+3]]+"-"+z[r[t+4]]+z[r[t+5]]+"-"+z[r[t+6]]+z[r[t+7]]+"-"+z[r[t+8]]+z[r[t+9]]+"-"+z[r[t+10]]+z[r[t+11]]+z[r[t+12]]+z[r[t+13]]+z[r[t+14]]+z[r[t+15]]).toLowerCase()}let Et;const vi=new Uint8Array(16);function Di(){if(!Et){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Et=crypto.getRandomValues.bind(crypto)}return Et(vi)}const ds={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Oi(r,t,s){var i;if(ds.randomUUID&&!r)return ds.randomUUID();r=r||{};const e=r.random??((i=r.rng)==null?void 0:i.call(r))??Di();if(e.length<16)throw new Error("Random bytes length must be >= 16");return e[6]=e[6]&15|64,e[8]=e[8]&63|128,ki(e)}function ms(){return Oi()}function Li(r,t){return r.localeCompare(t)}function Mi(){let r=Li;if(typeof Intl=="object"&&Intl.hasOwnProperty("Collator"))try{r=Intl.Collator("en-US").compare}catch{}return r}Mi();function Fi(){const t={__etype:1,__ops:1,create:1,update:1,link:1,unlink:1,delete:1,merge:1,ruleParams:1};return new Set(Object.keys(t))}const Bi=Fi();function Ct(r,t,s){const e={__etype:r,__ops:s};return new Proxy(e,{get:(i,a)=>{if(a==="__ops")return s;if(a==="__etype")return r;if(Bi.has(a))return(n,o)=>Ct(r,t,[...s,o?[a,r,t,n,o]:[a,r,t,n]])}})}function Ri(r){return r.startsWith("lookup__")}function ji(r){const[t,s,...e]=r.split("__");return[s,JSON.parse(e.join("__"))]}function _i(r){return new Proxy({__etype:r},{get(t,s){if(s==="__etype")return r;const e=s;return Ri(e)?Ct(r,ji(e),[]):Ct(r,e,[])}})}function Ui(){return new Proxy({},{get(r,t){return _i(t)}})}Ui();class Nt extends Error{constructor(s,e){super(s);m(this,"hint");this.hint=e;const i=new.target.prototype;Object.setPrototypeOf&&Object.setPrototypeOf(this,i),Error.captureStackTrace&&Error.captureStackTrace(this,Nt),this.name="InstantError"}get[Symbol.toStringTag](){return"InstantError"}}class je extends Nt{constructor(s){var a;const e=((a=s.body)==null?void 0:a.message)||`API Error (${s.status})`;super(e,s.body.hint);m(this,"body");m(this,"status");const i=new.target.prototype;Object.setPrototypeOf&&Object.setPrototypeOf(this,i),Error.captureStackTrace&&Error.captureStackTrace(this,je),this.name="InstantAPIError",this.status=s.status,this.body=s.body}get[Symbol.toStringTag](){return"InstantAPIError"}}typeof window<"u"&&typeof window.localStorage<"u"&&(window.localStorage.getItem("devBackend"),window.localStorage.getItem("__instantLogging"),window.localStorage.getItem("__devtoolLocalDash"));const Ee="v0.22.100";class ee{constructor(t,s,e,i={indexed:!1,unique:!1}){m(this,"valueType");m(this,"required");m(this,"isIndexed");m(this,"config");m(this,"metadata",{});this.valueType=t,this.required=s,this.isIndexed=e,this.config=i}clientRequired(){return new ee(this.valueType,!1,this.isIndexed,this.config)}optional(){return new ee(this.valueType,!1,this.isIndexed,this.config)}unique(){return new ee(this.valueType,this.required,this.isIndexed,{...this.config,unique:!0})}indexed(){return new ee(this.valueType,this.required,!0,{...this.config,indexed:!0})}}class Qe{constructor(t,s){m(this,"attrs");m(this,"links");this.attrs=t,this.links=s}asType(){return new Qe(this.attrs,this.links)}}class Ze{constructor(t,s,e){m(this,"entities");m(this,"links");m(this,"rooms");this.entities=t,this.links=s,this.rooms=e}withRoomSchema(){return new Ze(this.entities,this.links,{})}}var ys;(function(r){r.InitialSyncBatch="InitialSyncBatch",r.InitialSyncComplete="InitialSyncComplete",r.LoadFromStorage="LoadFromStorage",r.SyncTransaction="SyncTransaction",r.Error="Error"})(ys||(ys={}));function $i(r,t){return new Ze(xs(r,t),t,void 0)}function qi(r){return new Qe(r,{})}function zi(){return new ee("string",!0,!1)}function Vi(){return new ee("number",!0,!1)}function Hi(){return new ee("boolean",!0,!1)}function Ki(){return new ee("date",!0,!1)}function Ji(){return new ee("json",!0,!1)}function Wi(){return new ee("json",!0,!1)}function xs(r,t){var i,a,n,o;const s={fwd:{},rev:{}};for(const c of Object.values(t))(i=s.fwd)[a=c.forward.on]||(i[a]={}),(n=s.rev)[o=c.reverse.on]||(n[o]={}),s.fwd[c.forward.on][c.forward.label]={entityName:c.reverse.on,cardinality:c.forward.has},s.rev[c.reverse.on][c.reverse.label]={entityName:c.forward.on,cardinality:c.reverse.has};return Object.fromEntries(Object.entries(r).map(([c,h])=>[c,new Qe(h.attrs,{...s.fwd[c],...s.rev[c]})]))}function Xi({entities:r,links:t,rooms:s}){const e=t??{},i=s??{};return new Ze(xs(r,e),e,i)}const V={graph:$i,schema:Xi,entity:qi,string:zi,number:Vi,boolean:Hi,date:Ki,json:Ji,any:Wi};function Gi(){return globalThis.__instantDbSchemaHashStore=globalThis.__instantDbSchemaHashStore??new WeakMap,globalThis.__instantDbSchemaHashStore}function Yi(){return globalThis.__instantDbStore=globalThis.__instantDbStore??{},globalThis.__instantDbStore}Yi(),Gi();function Qi(){const r="0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz-._~";let t="";for(const s of crypto.getRandomValues(new Uint8Array(64)))t=t+r[s%r.length];return t}function Zi(r){return crypto.subtle.digest({name:"SHA-256"},new TextEncoder().encode(r))}function er(r){return r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function tr(r){return Zi(r).then(t=>er(btoa(String.fromCharCode(...Array.from(new Uint8Array(t))))))}function sr(){const r=Math.min(800,Math.floor(window.outerWidth*.8)),t=Math.min(630,Math.floor(window.outerHeight*.5)),s={width:r,height:t,left:Math.round(window.screenX+(window.outerWidth-r)/2),top:Math.round(window.screenY+(window.outerHeight-t)/8)},e={width:s.width,height:s.height,left:s.left,top:s.top,toolbar:0,scrollbars:1,status:1,resizable:1,menuBar:0,rel:"opener"};return Object.keys(e).map(i=>`${i}=${e[i]}`).join(",")}let Ps=null;function ir({clientId:r,state:t,codeChallenge:s,apiURI:e,redirectUri:i,scopes:a}){const n=new URL(`${e}/platform/oauth/start`);return n.searchParams.set("client_id",r),n.searchParams.set("redirect_uri",i),n.searchParams.set("scope",a.join(" ")),n.searchParams.set("state",t),n.searchParams.set("response_type","code"),n.searchParams.set("code_challenge",s),n.searchParams.set("code_challenge_method","S256"),n.toString()}async function rr({code:r,clientId:t,verifier:s,apiURI:e,redirectUri:i}){const a=await fetch(`${e}/platform/oauth/token`,{method:"POST",headers:{"Content-type":"application/json","Instant-Platform-Version":Ee,"Instant-Core-Version":Ee},body:JSON.stringify({grant_type:"authorization_code",code:r,redirect_uri:i,client_id:t,code_verifier:s})});if(!a.ok){const o=await a.text();let c;try{const h=JSON.parse(o);c={error:h.error,errorDescription:h.error_description,message:`OAuth error: ${h.error||"server_error"}`}}catch{c={error:"server_error",message:"OAuth error: server_error"}}throw new v(c)}const n=await a.json();return{token:n.access_token,expiresAt:new Date(Date.now()+(n.expires_in-30)*1e3)}}function ar(){if(typeof window>"u")throw new Error("This function may only be used in a browser context.");const r=new URL(window.location.href).searchParams,t=r.get("state"),s=r.get("error"),e=r.get("error_description"),i=r.get("code");if(!t)throw new Error("Invalid redirect. The state param is missing.");const a=new BroadcastChannel(t);return a.addEventListener("message",n=>{n.data.type==="oauth-redirect-window-done"&&window.close()}),a.postMessage({type:"oauth-redirect",state:t,error:s,errorDescription:e,code:i}),()=>{a.close()}}function nr({clientId:r,apiURI:t,redirectUri:s,scopes:e}){if(typeof window>"u")throw new Error("OAuth flow can only be started on the client.");const i=Ps;i&&i.close();const a=crypto.randomUUID(),n=Qi(),o=new BroadcastChannel(a),c=new Promise((l,p)=>{o.addEventListener("message",async d=>{if(d.data.type!=="oauth-redirect")return;const{state:f,error:x,code:A,errorDescription:_}=d.data;if(!(!f||f!==a)){if(A)try{const C=await rr({clientId:r,code:A,verifier:n,apiURI:t,redirectUri:s});l(C)}catch(C){C instanceof v&&p(C),p(new v({error:"server_error",message:"OAuth error exchanging code for token"}))}else p(typeof x=="string"?new v({error:x,errorDescription:_,message:`OAuth error: ${x}`}):new v({error:"server_error",message:"OAuth error: server_error"}));o.postMessage({type:"oauth-redirect-window-done"})}})}),h=window.open("",`instantdb_oauth_${Math.random()}`.replace(".",""),sr());return h?(Ps=h,tr(n).then(l=>{const p=ir({clientId:r,state:a,codeChallenge:l,apiURI:t,redirectUri:s,scopes:e});h.location.href=p}),c.finally(()=>o.close())):Promise.reject({error:"Could not open Auth window"})}class or{constructor(t){m(this,"redirectUri");m(this,"clientId");m(this,"apiURI");this.redirectUri=t.redirectUri,this.apiURI=t.apiURI??"https://api.instantdb.com",this.clientId=t.clientId}startClientOnlyFlow(t){return nr({clientId:this.clientId,apiURI:this.apiURI,redirectUri:this.redirectUri,scopes:t})}handleClientRedirect(){return ar()}}function cr(r,t){const s=r&&Object.keys(r).length?JSON.stringify(r,null,2):`{
|
|
1
|
+
(function(S,v){typeof exports=="object"&&typeof module<"u"?v(exports):typeof define=="function"&&define.amd?define(["exports"],v):(S=typeof globalThis<"u"?globalThis:S||self,v(S.instant={}))})(this,function(S){"use strict";var Bn=Object.defineProperty;var yi=S=>{throw TypeError(S)};var Rn=(S,v,N)=>v in S?Bn(S,v,{enumerable:!0,configurable:!0,writable:!0,value:N}):S[v]=N;var m=(S,v,N)=>Rn(S,typeof v!="symbol"?v+"":v,N),xi=(S,v,N)=>v.has(S)||yi("Cannot "+N);var w=(S,v,N)=>(xi(S,v,"read from private field"),N?N.call(S):v.get(S)),xe=(S,v,N)=>v.has(S)?yi("Cannot add the same private member more than once"):v instanceof WeakSet?v.add(S):v.set(S,N),Pe=(S,v,N,Le)=>(xi(S,v,"write to private field"),Le?Le.call(S,N):v.set(S,N),N);var se,Y,ft,dt,mt,F,j;class v extends Error{constructor(s){super(s.message);m(this,"error");m(this,"errorDescription");const e=new.target.prototype;Object.setPrototypeOf&&Object.setPrototypeOf(this,e),Error.captureStackTrace&&Error.captureStackTrace(this,v),this.name="InstantOAuthError",this.error=s.error,this.errorDescription=s.errorDescription}get[Symbol.toStringTag](){return"InstantAPIError"}}const N={Remove:"remove",Replace:"replace",Add:"add"},Le=Symbol.for("__MUTATIVE_PROXY_DRAFT__"),We=Symbol.iterator,Z={mutable:"mutable",immutable:"immutable"},xt={};function Me(r,t){return r instanceof Map?r.has(t):Object.prototype.hasOwnProperty.call(r,t)}function as(r,t){if(t in r){let s=Reflect.getPrototypeOf(r);for(;s;){const e=Reflect.getOwnPropertyDescriptor(s,t);if(e)return e;s=Reflect.getPrototypeOf(s)}}}function ns(r){return Object.getPrototypeOf(r)===Set.prototype}function os(r){return Object.getPrototypeOf(r)===Map.prototype}function G(r){var t;return(t=r.copy)!==null&&t!==void 0?t:r.original}function Pt(r){return!!L(r)}function L(r){return typeof r!="object"?null:r==null?void 0:r[Le]}function gt(r){var t;const s=L(r);return s?(t=s.copy)!==null&&t!==void 0?t:s.original:r}function ge(r,t){if(!r||typeof r!="object")return!1;let s;return Object.getPrototypeOf(r)===Object.prototype||Array.isArray(r)||r instanceof Map||r instanceof Set||!!(t!=null&&t.mark)&&((s=t.mark(r,Z))===Z.immutable||typeof s=="function")}function cs(r,t=[]){if(Object.hasOwnProperty.call(r,"key")){const s=r.parent.copy,e=L(he(s,r.key));if(e!==null&&(e==null?void 0:e.original)!==r.original)return null;const i=r.parent.type===3,a=i?Array.from(r.parent.setMap.keys()).indexOf(r.key):r.key;if(!(i&&s.size>a||Me(s,a)))return null;t.push(a)}if(r.parent)return cs(r.parent,t);t.reverse();try{Pi(r.copy,t)}catch{return null}return t}function Fe(r){return Array.isArray(r)?1:r instanceof Map?2:r instanceof Set?3:0}function he(r,t){return Fe(r)===2?r.get(t):r[t]}function bt(r,t,s){Fe(r)===2?r.set(t,s):r[t]=s}function Tt(r,t){const s=L(r);return(s?G(s):r)[t]}function be(r,t){return r===t?r!==0||1/r===1/t:r!==r&&t!==t}function Te(r,t){return t?r:[""].concat(r).map(s=>{const e=`${s}`;return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}).join("/")}function Pi(r,t){for(let s=0;s<t.length-1;s+=1){const e=t[s];if(r=he(Fe(r)===3?Array.from(r):r,e),typeof r!="object")throw new Error(`Cannot resolve patch at '${t.join("/")}'.`)}return r}function gi(r){const t=Object.create(Object.getPrototypeOf(r));return Reflect.ownKeys(r).forEach(s=>{let e=Reflect.getOwnPropertyDescriptor(r,s);if(e.enumerable&&e.configurable&&e.writable){t[s]=r[s];return}e.writable||(e.writable=!0,e.configurable=!0),(e.get||e.set)&&(e={configurable:!0,writable:!0,enumerable:e.enumerable,value:r[s]}),Reflect.defineProperty(t,s,e)}),t}const bi=Object.prototype.propertyIsEnumerable;function Ti(r,t){let s;if(Array.isArray(r))return Array.prototype.concat.call(r);if(r instanceof Set){if(!ns(r)){const e=Object.getPrototypeOf(r).constructor;return new e(r.values())}return Set.prototype.difference?Set.prototype.difference.call(r,new Set):new Set(r.values())}else if(r instanceof Map){if(!os(r)){const e=Object.getPrototypeOf(r).constructor;return new e(r)}return new Map(r)}else if(t!=null&&t.mark&&(s=t.mark(r,Z),s!==void 0)&&s!==Z.mutable){if(s===Z.immutable)return gi(r);if(typeof s=="function"){if(t.enablePatches||t.enableAutoFreeze)throw new Error("You can't use mark and patches or auto freeze together.");return s()}throw new Error(`Unsupported mark result: ${s}`)}else if(typeof r=="object"&&Object.getPrototypeOf(r)===Object.prototype){const e={};return Object.keys(r).forEach(i=>{e[i]=r[i]}),Object.getOwnPropertySymbols(r).forEach(i=>{bi.call(r,i)&&(e[i]=r[i])}),e}else throw new Error("Please check mark() to ensure that it is a stable marker draftable function.")}function H(r){r.copy||(r.copy=Ti(r.original,r.options))}function Be(r){if(!ge(r))return gt(r);if(Array.isArray(r))return r.map(Be);if(r instanceof Map){const s=Array.from(r.entries()).map(([e,i])=>[e,Be(i)]);if(!os(r)){const e=Object.getPrototypeOf(r).constructor;return new e(s)}return new Map(s)}if(r instanceof Set){const s=Array.from(r).map(Be);if(!ns(r)){const e=Object.getPrototypeOf(r).constructor;return new e(s)}return new Set(s)}const t=Object.create(Object.getPrototypeOf(r));for(const s in r)t[s]=Be(r[s]);return t}function Xe(r){return Pt(r)?Be(r):r}function ie(r){var t;r.assignedMap=(t=r.assignedMap)!==null&&t!==void 0?t:new Map,r.operated||(r.operated=!0,r.parent&&ie(r.parent))}function wi(r,t){const s=Fe(r);if(s===0)Reflect.ownKeys(r).forEach(e=>{t(e,r[e],r)});else if(s===1){let e=0;for(const i of r)t(e,i,r),e+=1}else r.forEach((e,i)=>t(i,e,r))}function hs(r,t,s){if(Pt(r)||!ge(r,s)||t.has(r)||Object.isFrozen(r))return;const e=r instanceof Set,i=e?new Map:void 0;if(t.add(r),wi(r,(a,n)=>{var o;if(Pt(n)){const c=L(n);H(c);const h=!((o=c.assignedMap)===null||o===void 0)&&o.size||c.operated?c.copy:c.original;bt(e?i:r,a,h)}else hs(n,t,s)}),i){const a=r,n=Array.from(a);a.clear(),n.forEach(o=>{a.add(i.has(o)?i.get(o):o)})}}function Ai(r,t){const s=r.type===3?r.setMap:r.copy;r.finalities.revoke.length>1&&r.assignedMap.get(t)&&s&&hs(he(s,t),r.finalities.handledSet,r.options)}function wt(r){r.type===3&&r.copy&&(r.copy.clear(),r.setMap.forEach(t=>{r.copy.add(gt(t))}))}function At(r,t,s,e){if(r.operated&&r.assignedMap&&r.assignedMap.size>0&&!r.finalized){if(s&&e){const a=cs(r);a&&t(r,a,s,e)}r.finalized=!0}}function St(r,t,s,e){const i=L(s);i&&(i.callbacks||(i.callbacks=[]),i.callbacks.push((a,n)=>{var o;const c=r.type===3?r.setMap:r.copy;if(be(he(c,t),s)){let h=i.original;i.copy&&(h=i.copy),wt(r),At(r,e,a,n),r.options.enableAutoFreeze&&(r.options.updatedValues=(o=r.options.updatedValues)!==null&&o!==void 0?o:new WeakMap,r.options.updatedValues.set(h,i.original)),bt(c,t,h)}}),r.options.enableAutoFreeze&&i.finalities!==r.finalities&&(r.options.enableAutoFreeze=!1)),ge(s,r.options)&&r.finalities.draft.push(()=>{const a=r.type===3?r.setMap:r.copy;be(he(a,t),s)&&Ai(r,t)})}function Si(r,t,s,e,i){let{original:a,assignedMap:n,options:o}=r,c=r.copy;c.length<a.length&&([a,c]=[c,a],[s,e]=[e,s]);for(let h=0;h<a.length;h+=1)if(n.get(h.toString())&&c[h]!==a[h]){const l=t.concat([h]),p=Te(l,i);s.push({op:N.Replace,path:p,value:Xe(c[h])}),e.push({op:N.Replace,path:p,value:Xe(a[h])})}for(let h=a.length;h<c.length;h+=1){const l=t.concat([h]),p=Te(l,i);s.push({op:N.Add,path:p,value:Xe(c[h])})}if(a.length<c.length){const{arrayLengthAssignment:h=!0}=o.enablePatches;if(h){const l=t.concat(["length"]),p=Te(l,i);e.push({op:N.Replace,path:p,value:a.length})}else for(let l=c.length;a.length<l;l-=1){const p=t.concat([l-1]),d=Te(p,i);e.push({op:N.Remove,path:d})}}}function Ii({original:r,copy:t,assignedMap:s},e,i,a,n){s.forEach((o,c)=>{const h=he(r,c),l=Xe(he(t,c)),p=o?Me(r,c)?N.Replace:N.Add:N.Remove;if(be(h,l)&&p===N.Replace)return;const d=e.concat(c),f=Te(d,n);i.push(p===N.Remove?{op:p,path:f}:{op:p,path:f,value:l}),a.push(p===N.Add?{op:N.Remove,path:f}:p===N.Remove?{op:N.Add,path:f,value:h}:{op:N.Replace,path:f,value:h})})}function Ei({original:r,copy:t},s,e,i,a){let n=0;r.forEach(o=>{if(!t.has(o)){const c=s.concat([n]),h=Te(c,a);e.push({op:N.Remove,path:h,value:o}),i.unshift({op:N.Add,path:h,value:o})}n+=1}),n=0,t.forEach(o=>{if(!r.has(o)){const c=s.concat([n]),h=Te(c,a);e.push({op:N.Add,path:h,value:o}),i.unshift({op:N.Remove,path:h,value:o})}n+=1})}function Re(r,t,s,e){const{pathAsArray:i=!0}=r.options.enablePatches;switch(r.type){case 0:case 2:return Ii(r,t,s,e,i);case 1:return Si(r,t,s,e,i);case 3:return Ei(r,t,s,e,i)}}const Ge=(r,t,s=!1)=>{if(typeof r=="object"&&r!==null&&(!ge(r,t)||s))throw new Error("Strict mode: Mutable data cannot be accessed directly, please use 'unsafe(callback)' wrap.")},It={get size(){return G(L(this)).size},has(r){return G(L(this)).has(r)},set(r,t){const s=L(this),e=G(s);return(!e.has(r)||!be(e.get(r),t))&&(H(s),ie(s),s.assignedMap.set(r,!0),s.copy.set(r,t),St(s,r,t,Re)),this},delete(r){if(!this.has(r))return!1;const t=L(this);return H(t),ie(t),t.original.has(r)?t.assignedMap.set(r,!1):t.assignedMap.delete(r),t.copy.delete(r),!0},clear(){const r=L(this);if(this.size){H(r),ie(r),r.assignedMap=new Map;for(const[t]of r.original)r.assignedMap.set(t,!1);r.copy.clear()}},forEach(r,t){const s=L(this);G(s).forEach((e,i)=>{r.call(t,this.get(i),i,this)})},get(r){var t,s;const e=L(this),i=G(e).get(r),a=((s=(t=e.options).mark)===null||s===void 0?void 0:s.call(t,i,Z))===Z.mutable;if(e.options.strict&&Ge(i,e.options,a),a||e.finalized||!ge(i,e.options)||i!==e.original.get(r))return i;const n=xt.createDraft({original:i,parentDraft:e,key:r,finalities:e.finalities,options:e.options});return H(e),e.copy.set(r,n),n},keys(){return G(L(this)).keys()},values(){const r=this.keys();return{[We]:()=>this.values(),next:()=>{const t=r.next();return t.done?t:{done:!1,value:this.get(t.value)}}}},entries(){const r=this.keys();return{[We]:()=>this.entries(),next:()=>{const t=r.next();if(t.done)return t;const s=this.get(t.value);return{done:!1,value:[t.value,s]}}}},[We](){return this.entries()}},Ci=Reflect.ownKeys(It),ls=(r,t,{isValuesIterator:s})=>()=>{var e,i;const a=t.next();if(a.done)return a;const n=a.value;let o=r.setMap.get(n);const c=L(o),h=((i=(e=r.options).mark)===null||i===void 0?void 0:i.call(e,o,Z))===Z.mutable;if(r.options.strict&&Ge(n,r.options,h),!h&&!c&&ge(n,r.options)&&!r.finalized&&r.original.has(n)){const l=xt.createDraft({original:n,parentDraft:r,key:n,finalities:r.finalities,options:r.options});r.setMap.set(n,l),o=l}else c&&(o=c.proxy);return{done:!1,value:s?o:[o,o]}},Ye={get size(){return L(this).setMap.size},has(r){const t=L(this);if(t.setMap.has(r))return!0;H(t);const s=L(r);return!!(s&&t.setMap.has(s.original))},add(r){const t=L(this);return this.has(r)||(H(t),ie(t),t.assignedMap.set(r,!0),t.setMap.set(r,r),St(t,r,r,Re)),this},delete(r){if(!this.has(r))return!1;const t=L(this);H(t),ie(t);const s=L(r);return s&&t.setMap.has(s.original)?(t.assignedMap.set(s.original,!1),t.setMap.delete(s.original)):(!s&&t.setMap.has(r)?t.assignedMap.set(r,!1):t.assignedMap.delete(r),t.setMap.delete(r))},clear(){if(!this.size)return;const r=L(this);H(r),ie(r);for(const t of r.original)r.assignedMap.set(t,!1);r.setMap.clear()},values(){const r=L(this);H(r);const t=r.setMap.keys();return{[Symbol.iterator]:()=>this.values(),next:ls(r,t,{isValuesIterator:!0})}},entries(){const r=L(this);H(r);const t=r.setMap.keys();return{[Symbol.iterator]:()=>this.entries(),next:ls(r,t,{isValuesIterator:!1})}},keys(){return this.values()},[We](){return this.values()},forEach(r,t){const s=this.values();let e=s.next();for(;!e.done;)r.call(t,e.value,e.value,this),e=s.next()}};Set.prototype.difference&&Object.assign(Ye,{intersection(r){return Set.prototype.intersection.call(new Set(this.values()),r)},union(r){return Set.prototype.union.call(new Set(this.values()),r)},difference(r){return Set.prototype.difference.call(new Set(this.values()),r)},symmetricDifference(r){return Set.prototype.symmetricDifference.call(new Set(this.values()),r)},isSubsetOf(r){return Set.prototype.isSubsetOf.call(new Set(this.values()),r)},isSupersetOf(r){return Set.prototype.isSupersetOf.call(new Set(this.values()),r)},isDisjointFrom(r){return Set.prototype.isDisjointFrom.call(new Set(this.values()),r)}});const Ni=Reflect.ownKeys(Ye),us=new WeakSet,ps={get(r,t,s){var e,i;const a=(e=r.copy)===null||e===void 0?void 0:e[t];if(a&&us.has(a))return a;if(t===Le)return r;let n;if(r.options.mark){const h=t==="size"&&(r.original instanceof Map||r.original instanceof Set)?Reflect.get(r.original,t):Reflect.get(r.original,t,s);if(n=r.options.mark(h,Z),n===Z.mutable)return r.options.strict&&Ge(h,r.options,!0),h}const o=G(r);if(o instanceof Map&&Ci.includes(t)){if(t==="size")return Object.getOwnPropertyDescriptor(It,"size").get.call(r.proxy);const h=It[t];if(h)return h.bind(r.proxy)}if(o instanceof Set&&Ni.includes(t)){if(t==="size")return Object.getOwnPropertyDescriptor(Ye,"size").get.call(r.proxy);const h=Ye[t];if(h)return h.bind(r.proxy)}if(!Me(o,t)){const h=as(o,t);return h?"value"in h?h.value:(i=h.get)===null||i===void 0?void 0:i.call(r.proxy):void 0}const c=o[t];if(r.options.strict&&Ge(c,r.options),r.finalized||!ge(c,r.options))return c;if(c===Tt(r.original,t)){if(H(r),r.copy[t]=fs({original:r.original[t],parentDraft:r,key:r.type===1?Number(t):t,finalities:r.finalities,options:r.options}),typeof n=="function"){const h=L(r.copy[t]);return H(h),ie(h),h.copy}return r.copy[t]}return c},set(r,t,s){var e;if(r.type===3||r.type===2)throw new Error("Map/Set draft does not support any property assignment.");let i;if(r.type===1&&t!=="length"&&!(Number.isInteger(i=Number(t))&&i>=0&&(t===0||i===0||String(i)===String(t))))throw new Error("Only supports setting array indices and the 'length' property.");const a=as(G(r),t);if(a!=null&&a.set)return a.set.call(r.proxy,s),!0;const n=Tt(G(r),t),o=L(n);return o&&be(o.original,s)?(r.copy[t]=s,r.assignedMap=(e=r.assignedMap)!==null&&e!==void 0?e:new Map,r.assignedMap.set(t,!1),!0):(be(s,n)&&(s!==void 0||Me(r.original,t))||(H(r),ie(r),Me(r.original,t)&&be(s,r.original[t])?r.assignedMap.delete(t):r.assignedMap.set(t,!0),r.copy[t]=s,St(r,t,s,Re)),!0)},has(r,t){return t in G(r)},ownKeys(r){return Reflect.ownKeys(G(r))},getOwnPropertyDescriptor(r,t){const s=G(r),e=Reflect.getOwnPropertyDescriptor(s,t);return e&&{writable:!0,configurable:r.type!==1||t!=="length",enumerable:e.enumerable,value:s[t]}},getPrototypeOf(r){return Reflect.getPrototypeOf(r.original)},setPrototypeOf(){throw new Error("Cannot call 'setPrototypeOf()' on drafts")},defineProperty(){throw new Error("Cannot call 'defineProperty()' on drafts")},deleteProperty(r,t){var s;return r.type===1?ps.set.call(this,r,t,void 0,r.proxy):(Tt(r.original,t)!==void 0||t in r.original?(H(r),ie(r),r.assignedMap.set(t,!1)):(r.assignedMap=(s=r.assignedMap)!==null&&s!==void 0?s:new Map,r.assignedMap.delete(t)),r.copy&&delete r.copy[t],!0)}};function fs(r){const{original:t,parentDraft:s,key:e,finalities:i,options:a}=r,n=Fe(t),o={type:n,finalized:!1,parent:s,original:t,copy:null,proxy:null,finalities:i,options:a,setMap:n===3?new Map(t.entries()):void 0};(e||"key"in r)&&(o.key=e);const{proxy:c,revoke:h}=Proxy.revocable(n===1?Object.assign([],o):o,ps);if(i.revoke.push(h),us.add(c),o.proxy=c,s){const l=s;l.finalities.draft.push((p,d)=>{var f,x;const A=L(c);let _=l.type===3?l.setMap:l.copy;const C=he(_,e),O=L(C);if(O){let U=O.original;O.operated&&(U=gt(C)),wt(O),At(O,Re,p,d),l.options.enableAutoFreeze&&(l.options.updatedValues=(f=l.options.updatedValues)!==null&&f!==void 0?f:new WeakMap,l.options.updatedValues.set(U,O.original)),bt(_,e,U)}(x=A.callbacks)===null||x===void 0||x.forEach(U=>{U(p,d)})})}else{const l=L(c);l.finalities.draft.push((p,d)=>{wt(l),At(l,Re,p,d)})}return c}xt.createDraft=fs,Object.prototype.constructor.toString();const z=[];for(let r=0;r<256;++r)z.push((r+256).toString(16).slice(1));function ki(r,t=0){return(z[r[t+0]]+z[r[t+1]]+z[r[t+2]]+z[r[t+3]]+"-"+z[r[t+4]]+z[r[t+5]]+"-"+z[r[t+6]]+z[r[t+7]]+"-"+z[r[t+8]]+z[r[t+9]]+"-"+z[r[t+10]]+z[r[t+11]]+z[r[t+12]]+z[r[t+13]]+z[r[t+14]]+z[r[t+15]]).toLowerCase()}let Et;const vi=new Uint8Array(16);function Di(){if(!Et){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Et=crypto.getRandomValues.bind(crypto)}return Et(vi)}const ds={randomUUID:typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Oi(r,t,s){var i;if(ds.randomUUID&&!r)return ds.randomUUID();r=r||{};const e=r.random??((i=r.rng)==null?void 0:i.call(r))??Di();if(e.length<16)throw new Error("Random bytes length must be >= 16");return e[6]=e[6]&15|64,e[8]=e[8]&63|128,ki(e)}function ms(){return Oi()}function Li(r,t){return r.localeCompare(t)}function Mi(){let r=Li;if(typeof Intl=="object"&&Intl.hasOwnProperty("Collator"))try{r=Intl.Collator("en-US").compare}catch{}return r}Mi();function Fi(){const t={__etype:1,__ops:1,create:1,update:1,link:1,unlink:1,delete:1,merge:1,ruleParams:1};return new Set(Object.keys(t))}const Bi=Fi();function Ct(r,t,s){const e={__etype:r,__ops:s};return new Proxy(e,{get:(i,a)=>{if(a==="__ops")return s;if(a==="__etype")return r;if(Bi.has(a))return(n,o)=>Ct(r,t,[...s,o?[a,r,t,n,o]:[a,r,t,n]])}})}function Ri(r){return r.startsWith("lookup__")}function ji(r){const[t,s,...e]=r.split("__");return[s,JSON.parse(e.join("__"))]}function _i(r){return new Proxy({__etype:r},{get(t,s){if(s==="__etype")return r;const e=s;return Ri(e)?Ct(r,ji(e),[]):Ct(r,e,[])}})}function Ui(){return new Proxy({},{get(r,t){return _i(t)}})}Ui();class Nt extends Error{constructor(s,e){super(s);m(this,"hint");this.hint=e;const i=new.target.prototype;Object.setPrototypeOf&&Object.setPrototypeOf(this,i),Error.captureStackTrace&&Error.captureStackTrace(this,Nt),this.name="InstantError"}get[Symbol.toStringTag](){return"InstantError"}}class je extends Nt{constructor(s){var a;const e=((a=s.body)==null?void 0:a.message)||`API Error (${s.status})`;super(e,s.body.hint);m(this,"body");m(this,"status");const i=new.target.prototype;Object.setPrototypeOf&&Object.setPrototypeOf(this,i),Error.captureStackTrace&&Error.captureStackTrace(this,je),this.name="InstantAPIError",this.status=s.status,this.body=s.body}get[Symbol.toStringTag](){return"InstantAPIError"}}typeof window<"u"&&typeof window.localStorage<"u"&&(window.localStorage.getItem("devBackend"),window.localStorage.getItem("__instantLogging"),window.localStorage.getItem("__devtoolLocalDash"));const Ee="v0.22.101";class ee{constructor(t,s,e,i={indexed:!1,unique:!1}){m(this,"valueType");m(this,"required");m(this,"isIndexed");m(this,"config");m(this,"metadata",{});this.valueType=t,this.required=s,this.isIndexed=e,this.config=i}clientRequired(){return new ee(this.valueType,!1,this.isIndexed,this.config)}optional(){return new ee(this.valueType,!1,this.isIndexed,this.config)}unique(){return new ee(this.valueType,this.required,this.isIndexed,{...this.config,unique:!0})}indexed(){return new ee(this.valueType,this.required,!0,{...this.config,indexed:!0})}}class Qe{constructor(t,s){m(this,"attrs");m(this,"links");this.attrs=t,this.links=s}asType(){return new Qe(this.attrs,this.links)}}class Ze{constructor(t,s,e){m(this,"entities");m(this,"links");m(this,"rooms");this.entities=t,this.links=s,this.rooms=e}withRoomSchema(){return new Ze(this.entities,this.links,{})}}var ys;(function(r){r.InitialSyncBatch="InitialSyncBatch",r.InitialSyncComplete="InitialSyncComplete",r.LoadFromStorage="LoadFromStorage",r.SyncTransaction="SyncTransaction",r.Error="Error"})(ys||(ys={}));function $i(r,t){return new Ze(xs(r,t),t,void 0)}function qi(r){return new Qe(r,{})}function zi(){return new ee("string",!0,!1)}function Vi(){return new ee("number",!0,!1)}function Hi(){return new ee("boolean",!0,!1)}function Ki(){return new ee("date",!0,!1)}function Ji(){return new ee("json",!0,!1)}function Wi(){return new ee("json",!0,!1)}function xs(r,t){var i,a,n,o;const s={fwd:{},rev:{}};for(const c of Object.values(t))(i=s.fwd)[a=c.forward.on]||(i[a]={}),(n=s.rev)[o=c.reverse.on]||(n[o]={}),s.fwd[c.forward.on][c.forward.label]={entityName:c.reverse.on,cardinality:c.forward.has},s.rev[c.reverse.on][c.reverse.label]={entityName:c.forward.on,cardinality:c.reverse.has};return Object.fromEntries(Object.entries(r).map(([c,h])=>[c,new Qe(h.attrs,{...s.fwd[c],...s.rev[c]})]))}function Xi({entities:r,links:t,rooms:s}){const e=t??{},i=s??{};return new Ze(xs(r,e),e,i)}const V={graph:$i,schema:Xi,entity:qi,string:zi,number:Vi,boolean:Hi,date:Ki,json:Ji,any:Wi};function Gi(){return globalThis.__instantDbSchemaHashStore=globalThis.__instantDbSchemaHashStore??new WeakMap,globalThis.__instantDbSchemaHashStore}function Yi(){return globalThis.__instantDbStore=globalThis.__instantDbStore??{},globalThis.__instantDbStore}Yi(),Gi();function Qi(){const r="0123456789AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz-._~";let t="";for(const s of crypto.getRandomValues(new Uint8Array(64)))t=t+r[s%r.length];return t}function Zi(r){return crypto.subtle.digest({name:"SHA-256"},new TextEncoder().encode(r))}function er(r){return r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function tr(r){return Zi(r).then(t=>er(btoa(String.fromCharCode(...Array.from(new Uint8Array(t))))))}function sr(){const r=Math.min(800,Math.floor(window.outerWidth*.8)),t=Math.min(630,Math.floor(window.outerHeight*.5)),s={width:r,height:t,left:Math.round(window.screenX+(window.outerWidth-r)/2),top:Math.round(window.screenY+(window.outerHeight-t)/8)},e={width:s.width,height:s.height,left:s.left,top:s.top,toolbar:0,scrollbars:1,status:1,resizable:1,menuBar:0,rel:"opener"};return Object.keys(e).map(i=>`${i}=${e[i]}`).join(",")}let Ps=null;function ir({clientId:r,state:t,codeChallenge:s,apiURI:e,redirectUri:i,scopes:a}){const n=new URL(`${e}/platform/oauth/start`);return n.searchParams.set("client_id",r),n.searchParams.set("redirect_uri",i),n.searchParams.set("scope",a.join(" ")),n.searchParams.set("state",t),n.searchParams.set("response_type","code"),n.searchParams.set("code_challenge",s),n.searchParams.set("code_challenge_method","S256"),n.toString()}async function rr({code:r,clientId:t,verifier:s,apiURI:e,redirectUri:i}){const a=await fetch(`${e}/platform/oauth/token`,{method:"POST",headers:{"Content-type":"application/json","Instant-Platform-Version":Ee,"Instant-Core-Version":Ee},body:JSON.stringify({grant_type:"authorization_code",code:r,redirect_uri:i,client_id:t,code_verifier:s})});if(!a.ok){const o=await a.text();let c;try{const h=JSON.parse(o);c={error:h.error,errorDescription:h.error_description,message:`OAuth error: ${h.error||"server_error"}`}}catch{c={error:"server_error",message:"OAuth error: server_error"}}throw new v(c)}const n=await a.json();return{token:n.access_token,expiresAt:new Date(Date.now()+(n.expires_in-30)*1e3)}}function ar(){if(typeof window>"u")throw new Error("This function may only be used in a browser context.");const r=new URL(window.location.href).searchParams,t=r.get("state"),s=r.get("error"),e=r.get("error_description"),i=r.get("code");if(!t)throw new Error("Invalid redirect. The state param is missing.");const a=new BroadcastChannel(t);return a.addEventListener("message",n=>{n.data.type==="oauth-redirect-window-done"&&window.close()}),a.postMessage({type:"oauth-redirect",state:t,error:s,errorDescription:e,code:i}),()=>{a.close()}}function nr({clientId:r,apiURI:t,redirectUri:s,scopes:e}){if(typeof window>"u")throw new Error("OAuth flow can only be started on the client.");const i=Ps;i&&i.close();const a=crypto.randomUUID(),n=Qi(),o=new BroadcastChannel(a),c=new Promise((l,p)=>{o.addEventListener("message",async d=>{if(d.data.type!=="oauth-redirect")return;const{state:f,error:x,code:A,errorDescription:_}=d.data;if(!(!f||f!==a)){if(A)try{const C=await rr({clientId:r,code:A,verifier:n,apiURI:t,redirectUri:s});l(C)}catch(C){C instanceof v&&p(C),p(new v({error:"server_error",message:"OAuth error exchanging code for token"}))}else p(typeof x=="string"?new v({error:x,errorDescription:_,message:`OAuth error: ${x}`}):new v({error:"server_error",message:"OAuth error: server_error"}));o.postMessage({type:"oauth-redirect-window-done"})}})}),h=window.open("",`instantdb_oauth_${Math.random()}`.replace(".",""),sr());return h?(Ps=h,tr(n).then(l=>{const p=ir({clientId:r,state:a,codeChallenge:l,apiURI:t,redirectUri:s,scopes:e});h.location.href=p}),c.finally(()=>o.close())):Promise.reject({error:"Could not open Auth window"})}class or{constructor(t){m(this,"redirectUri");m(this,"clientId");m(this,"apiURI");this.redirectUri=t.redirectUri,this.apiURI=t.apiURI??"https://api.instantdb.com",this.clientId=t.clientId}startClientOnlyFlow(t){return nr({clientId:this.clientId,apiURI:this.apiURI,redirectUri:this.redirectUri,scopes:t})}handleClientRedirect(){return ar()}}function cr(r,t){const s=r&&Object.keys(r).length?JSON.stringify(r,null,2):`{
|
|
2
2
|
/**
|
|
3
3
|
* Welcome to Instant's permission system!
|
|
4
4
|
* Right now your rules are empty. To start filling them in, check out the docs:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instantdb/platform",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.101",
|
|
4
4
|
"description": "Instant's platform package for managing Instant apps.",
|
|
5
5
|
"homepage": "https://github.com/instantdb/instant/tree/main/client/packages/platform",
|
|
6
6
|
"repository": {
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@babel/parser": "^8.0.0-beta.0",
|
|
56
56
|
"@babel/types": "^8.0.0-beta.0",
|
|
57
|
-
"@instantdb/core": "0.22.
|
|
58
|
-
"@instantdb/version": "0.22.
|
|
57
|
+
"@instantdb/core": "0.22.101",
|
|
58
|
+
"@instantdb/version": "0.22.101"
|
|
59
59
|
},
|
|
60
60
|
"scripts": {
|
|
61
61
|
"test": "vitest",
|