@urun-sh/core 0.1.38 → 0.1.41

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.
@@ -0,0 +1 @@
1
+ var M=Object.create;var m=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty;var $=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var A=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(s){throw t=[s],s}};var g=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},w=(r,e)=>{for(var t in e)m(r,t,{get:e[t],enumerable:!0})},p=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of I(e))!v.call(r,o)&&o!==t&&m(r,o,{get:()=>e[o],enumerable:!(s=y(e,o))||s.enumerable});return r};var z=(r,e,t)=>(t=r!=null?M(_(r)):{},p(e||!r||!r.__esModule?m(t,"default",{value:r,enumerable:!0}):t,r)),H=r=>p(m({},"__esModule",{value:!0}),r);var G={};w(G,{createSupportsColor:()=>T,default:()=>S});import O from"process";import N from"os";import C from"tty";function i(r,e=globalThis.Deno?globalThis.Deno.args:O.argv){let t=r.startsWith("-")?"":r.length===1?"-":"--",s=e.indexOf(t+r),o=e.indexOf("--");return s!==-1&&(o===-1||s<o)}function b(){if(!("FORCE_COLOR"in n))return;if(n.FORCE_COLOR==="true")return 1;if(n.FORCE_COLOR==="false")return 0;if(n.FORCE_COLOR.length===0)return 1;let r=Math.min(Number.parseInt(n.FORCE_COLOR,10),3);if([0,1,2,3].includes(r))return r}function L(r){return r===0?!1:{level:r,hasBasic:!0,has256:r>=2,has16m:r>=3}}function x(r,{streamIsTTY:e,sniffFlags:t=!0}={}){let s=b();s!==void 0&&(d=s);let o=t?d:s;if(o===0)return 0;if(t){if(i("color=16m")||i("color=full")||i("color=truecolor"))return 3;if(i("color=256"))return 2}if("TF_BUILD"in n&&"AGENT_NAME"in n)return 1;if(r&&!e&&o===void 0)return 0;let R=o||0;if(n.TERM==="dumb")return R;if(O.platform==="win32"){let u=N.release().split(".");return Number(u[0])>=10&&Number(u[2])>=10586?Number(u[2])>=14931?3:2:1}if("CI"in n)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(u=>u in n)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(u=>u in n)||n.CI_NAME==="codeship"?1:R;if("TEAMCITY_VERSION"in n)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(n.TEAMCITY_VERSION)?1:0;if(n.COLORTERM==="truecolor"||n.TERM==="xterm-kitty"||n.TERM==="xterm-ghostty"||n.TERM==="wezterm")return 3;if("TERM_PROGRAM"in n){let u=Number.parseInt((n.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(n.TERM_PROGRAM){case"iTerm.app":return u>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(n.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(n.TERM)||"COLORTERM"in n?1:R}function T(r,e={}){let t=x(r,{streamIsTTY:r&&r.isTTY,...e});return L(t)}var n,d,F,S,P=A(()=>{"use strict";({env:n}=O);i("no-color")||i("no-colors")||i("color=false")||i("color=never")?d=0:(i("color")||i("colors")||i("color=true")||i("color=always"))&&(d=1);F={stdout:T({isTTY:C.isatty(1)}),stderr:T({isTTY:C.isatty(2)})},S=F});var U=g((q,E)=>{"use strict";var a=1e3,f=a*60,l=f*60,c=l*24,Y=c*7,B=c*365.25;E.exports=function(r,e){e=e||{};var t=typeof r;if(t==="string"&&r.length>0)return D(r);if(t==="number"&&isFinite(r))return e.long?k(r):V(r);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(r))};function D(r){if(r=String(r),!(r.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(r);if(e){var t=parseFloat(e[1]),s=(e[2]||"ms").toLowerCase();switch(s){case"years":case"year":case"yrs":case"yr":case"y":return t*B;case"weeks":case"week":case"w":return t*Y;case"days":case"day":case"d":return t*c;case"hours":case"hour":case"hrs":case"hr":case"h":return t*l;case"minutes":case"minute":case"mins":case"min":case"m":return t*f;case"seconds":case"second":case"secs":case"sec":case"s":return t*a;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return t;default:return}}}}function V(r){var e=Math.abs(r);return e>=c?Math.round(r/c)+"d":e>=l?Math.round(r/l)+"h":e>=f?Math.round(r/f)+"m":e>=a?Math.round(r/a)+"s":r+"ms"}function k(r){var e=Math.abs(r);return e>=c?h(r,e,c,"day"):e>=l?h(r,e,l,"hour"):e>=f?h(r,e,f,"minute"):e>=a?h(r,e,a,"second"):r+" ms"}function h(r,e,t,s){var o=e>=t*1.5;return Math.round(r/t)+" "+s+(o?"s":"")}});export{$ as a,g as b,w as c,z as d,H as e,U as f,G as g,P as h};
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as AppOptions, A as App$1, k as SessionDocument, p as SessionText, j as Session$1, C as ChannelEndpoint, T as TransportSession, b as AttachOptions, l as SessionPhase, o as SessionStream$1, R as RequestOptions, h as RequestStreamOptions, r as StoreOptions, q as Store, d as ChannelMultiplexer } from './internal-CrXsIQMr.mjs';
2
- export { L as Layer, f as LayoutConfig, g as LayoutContext, S as SceneContext, i as SceneGraph, m as SessionPhaseName, t as TransportState } from './internal-CrXsIQMr.mjs';
1
+ import { a as AppOptions, A as App$1, k as SessionDocument, p as SessionText, j as Session$1, C as ChannelEndpoint, T as TransportSession, b as AttachOptions, l as SessionPhase, o as SessionStream$1, R as RequestOptions, h as RequestStreamOptions, r as StoreOptions, q as Store, d as ChannelMultiplexer } from './transport-CI8aVD2U.mjs';
2
+ export { L as Layer, f as LayoutConfig, g as LayoutContext, S as SceneContext, i as SceneGraph, m as SessionPhaseName, t as TransportState } from './transport-CI8aVD2U.mjs';
3
3
  import * as Y from 'yjs';
4
4
 
5
5
  declare function App(appId: string, options: AppOptions): App$1;
@@ -28,6 +28,8 @@ declare class SessionDocumentImpl implements SessionDocument {
28
28
 
29
29
  private _pendingPatches;
30
30
 
31
+ private _syncWaiters;
32
+
31
33
  private _texts;
32
34
  private _observer;
33
35
  private _updateHandler;
@@ -35,6 +37,10 @@ declare class SessionDocumentImpl implements SessionDocument {
35
37
 
36
38
  setSessionId(sessionId: string): void;
37
39
 
40
+ get synced(): boolean;
41
+
42
+ onSynced(handler: () => void): () => void;
43
+
38
44
  set(patch: Record<string, unknown>): void;
39
45
  get(path?: string, defaultValue?: unknown): unknown;
40
46
  on(event: 'change', handler: (snap: Record<string, unknown>) => void): () => void;
@@ -62,6 +68,7 @@ declare class SessionTextImpl implements SessionText {
62
68
  dispose(): void;
63
69
  }
64
70
 
71
+ declare const DEFAULT_DOC_SYNC_TIMEOUT_MS = 30000;
65
72
  declare class SessionStream implements SessionStream$1 {
66
73
  private _name;
67
74
  private _transport;
@@ -78,6 +85,8 @@ declare class SessionStream implements SessionStream$1 {
78
85
  private _laneUnsubs;
79
86
 
80
87
  private _laneSeen;
88
+
89
+ private _replay;
81
90
  private _disposed;
82
91
  constructor(_name: string, _transport: TransportSession,
83
92
 
@@ -90,7 +99,11 @@ declare class SessionStream implements SessionStream$1 {
90
99
  private _drainLane;
91
100
  get track(): MediaStreamTrack | null;
92
101
  attach(track: MediaStreamTrack): Promise<void>;
102
+
103
+ attachVideo(track: MediaStreamTrack): Promise<void>;
93
104
  detach(): Promise<void>;
105
+
106
+ detachVideo(): Promise<void>;
94
107
  seek(target: number | 'live'): Promise<void>;
95
108
  on(event: 'track', handler: (track: MediaStreamTrack | null) => void): () => void;
96
109
  dispose(): void;
@@ -119,6 +132,8 @@ declare class Session implements Session$1 {
119
132
 
120
133
  doc(key: string): SessionDocumentImpl;
121
134
 
135
+ sendImage(value: string): void;
136
+
122
137
  request(payload: unknown, options?: RequestOptions): Promise<unknown>;
123
138
 
124
139
  private _consumeResponse;
@@ -161,6 +176,12 @@ declare class RequestTimeoutError extends RequestError {
161
176
  constructor(timeoutMs: number, requestId?: string);
162
177
  }
163
178
 
179
+ declare class RequestDocSyncError extends RequestError {
180
+
181
+ readonly timeoutMs: number;
182
+ constructor(timeoutMs: number, requestId?: string);
183
+ }
184
+
164
185
  declare class RequestAbortError extends RequestError {
165
186
  constructor(requestId?: string);
166
187
  }
@@ -169,4 +190,4 @@ declare class RequestCancelledError extends RequestError {
169
190
  constructor(requestId?: string);
170
191
  }
171
192
 
172
- export { App, App$1 as AppInterface, AppOptions, AttachOptions, RequestAbortError, RequestCancelledError, RequestError, RequestOptions, RequestStreamOptions, RequestTimeoutError, Session, SessionDocument, Session$1 as SessionInterface, SessionPhase, SessionStream$1 as SessionStream, SessionText, Store, StoreOptions, type VideoStreamOptions, createStore, videoStream };
193
+ export { App, App$1 as AppInterface, AppOptions, AttachOptions, DEFAULT_DOC_SYNC_TIMEOUT_MS, RequestAbortError, RequestCancelledError, RequestDocSyncError, RequestError, RequestOptions, RequestStreamOptions, RequestTimeoutError, Session, SessionDocument, Session$1 as SessionInterface, SessionPhase, SessionStream$1 as SessionStream, SessionText, Store, StoreOptions, type VideoStreamOptions, createStore, videoStream };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as AppOptions, A as App$1, k as SessionDocument, p as SessionText, j as Session$1, C as ChannelEndpoint, T as TransportSession, b as AttachOptions, l as SessionPhase, o as SessionStream$1, R as RequestOptions, h as RequestStreamOptions, r as StoreOptions, q as Store, d as ChannelMultiplexer } from './internal-CrXsIQMr.js';
2
- export { L as Layer, f as LayoutConfig, g as LayoutContext, S as SceneContext, i as SceneGraph, m as SessionPhaseName, t as TransportState } from './internal-CrXsIQMr.js';
1
+ import { a as AppOptions, A as App$1, k as SessionDocument, p as SessionText, j as Session$1, C as ChannelEndpoint, T as TransportSession, b as AttachOptions, l as SessionPhase, o as SessionStream$1, R as RequestOptions, h as RequestStreamOptions, r as StoreOptions, q as Store, d as ChannelMultiplexer } from './transport-CI8aVD2U.js';
2
+ export { L as Layer, f as LayoutConfig, g as LayoutContext, S as SceneContext, i as SceneGraph, m as SessionPhaseName, t as TransportState } from './transport-CI8aVD2U.js';
3
3
  import * as Y from 'yjs';
4
4
 
5
5
  declare function App(appId: string, options: AppOptions): App$1;
@@ -28,6 +28,8 @@ declare class SessionDocumentImpl implements SessionDocument {
28
28
 
29
29
  private _pendingPatches;
30
30
 
31
+ private _syncWaiters;
32
+
31
33
  private _texts;
32
34
  private _observer;
33
35
  private _updateHandler;
@@ -35,6 +37,10 @@ declare class SessionDocumentImpl implements SessionDocument {
35
37
 
36
38
  setSessionId(sessionId: string): void;
37
39
 
40
+ get synced(): boolean;
41
+
42
+ onSynced(handler: () => void): () => void;
43
+
38
44
  set(patch: Record<string, unknown>): void;
39
45
  get(path?: string, defaultValue?: unknown): unknown;
40
46
  on(event: 'change', handler: (snap: Record<string, unknown>) => void): () => void;
@@ -62,6 +68,7 @@ declare class SessionTextImpl implements SessionText {
62
68
  dispose(): void;
63
69
  }
64
70
 
71
+ declare const DEFAULT_DOC_SYNC_TIMEOUT_MS = 30000;
65
72
  declare class SessionStream implements SessionStream$1 {
66
73
  private _name;
67
74
  private _transport;
@@ -78,6 +85,8 @@ declare class SessionStream implements SessionStream$1 {
78
85
  private _laneUnsubs;
79
86
 
80
87
  private _laneSeen;
88
+
89
+ private _replay;
81
90
  private _disposed;
82
91
  constructor(_name: string, _transport: TransportSession,
83
92
 
@@ -90,7 +99,11 @@ declare class SessionStream implements SessionStream$1 {
90
99
  private _drainLane;
91
100
  get track(): MediaStreamTrack | null;
92
101
  attach(track: MediaStreamTrack): Promise<void>;
102
+
103
+ attachVideo(track: MediaStreamTrack): Promise<void>;
93
104
  detach(): Promise<void>;
105
+
106
+ detachVideo(): Promise<void>;
94
107
  seek(target: number | 'live'): Promise<void>;
95
108
  on(event: 'track', handler: (track: MediaStreamTrack | null) => void): () => void;
96
109
  dispose(): void;
@@ -119,6 +132,8 @@ declare class Session implements Session$1 {
119
132
 
120
133
  doc(key: string): SessionDocumentImpl;
121
134
 
135
+ sendImage(value: string): void;
136
+
122
137
  request(payload: unknown, options?: RequestOptions): Promise<unknown>;
123
138
 
124
139
  private _consumeResponse;
@@ -161,6 +176,12 @@ declare class RequestTimeoutError extends RequestError {
161
176
  constructor(timeoutMs: number, requestId?: string);
162
177
  }
163
178
 
179
+ declare class RequestDocSyncError extends RequestError {
180
+
181
+ readonly timeoutMs: number;
182
+ constructor(timeoutMs: number, requestId?: string);
183
+ }
184
+
164
185
  declare class RequestAbortError extends RequestError {
165
186
  constructor(requestId?: string);
166
187
  }
@@ -169,4 +190,4 @@ declare class RequestCancelledError extends RequestError {
169
190
  constructor(requestId?: string);
170
191
  }
171
192
 
172
- export { App, App$1 as AppInterface, AppOptions, AttachOptions, RequestAbortError, RequestCancelledError, RequestError, RequestOptions, RequestStreamOptions, RequestTimeoutError, Session, SessionDocument, Session$1 as SessionInterface, SessionPhase, SessionStream$1 as SessionStream, SessionText, Store, StoreOptions, type VideoStreamOptions, createStore, videoStream };
193
+ export { App, App$1 as AppInterface, AppOptions, AttachOptions, DEFAULT_DOC_SYNC_TIMEOUT_MS, RequestAbortError, RequestCancelledError, RequestDocSyncError, RequestError, RequestOptions, RequestStreamOptions, RequestTimeoutError, Session, SessionDocument, Session$1 as SessionInterface, SessionPhase, SessionStream$1 as SessionStream, SessionText, Store, StoreOptions, type VideoStreamOptions, createStore, videoStream };