@livestore/webmesh 0.0.0-snapshot-057a9e3a18ca69a310d4eb8cf35a34e94fa1841e → 0.0.0-snapshot-9d9745f6fc391ab1a695b44e8fad6c460c7b3b77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import type { PubSub } from '@livestore/utils/effect';
2
2
  import { Effect, Queue, Scope, WebChannel } from '@livestore/utils/effect';
3
- import { type ChannelName, type MeshNodeName, type MessageQueueItem } from '../common.js';
4
- import * as MeshSchema from '../mesh-schema.js';
3
+ import { type ChannelName, type MeshNodeName, type MessageQueueItem } from '../common.ts';
4
+ import * as MeshSchema from '../mesh-schema.ts';
5
5
  export interface MakeDirectChannelArgs {
6
6
  nodeName: MeshNodeName;
7
7
  /** Queue of incoming messages for this channel */
@@ -1,7 +1,7 @@
1
1
  import { casesHandled, shouldNeverHappen } from '@livestore/utils';
2
2
  import { Deferred, Effect, Exit, OtelTracer, Predicate, Queue, Schema, Scope, Stream, WebChannel, } from '@livestore/utils/effect';
3
- import { packetAsOtelAttributes } from '../common.js';
4
- import * as MeshSchema from '../mesh-schema.js';
3
+ import { packetAsOtelAttributes } from "../common.js";
4
+ import * as MeshSchema from "../mesh-schema.js";
5
5
  const makeDeferredResult = (Deferred.make);
6
6
  /**
7
7
  * The channel version is important here, as a channel will only be established once both sides have the same version.
@@ -1,5 +1,5 @@
1
1
  import { Deferred, Effect, Scope, WebChannel } from '@livestore/utils/effect';
2
- import type { MakeDirectChannelArgs } from './direct-channel-internal.js';
2
+ import type { MakeDirectChannelArgs } from './direct-channel-internal.ts';
3
3
  /**
4
4
  * Behaviour:
5
5
  * - Waits until there is an initial edge
@@ -1,7 +1,7 @@
1
1
  import { Cause, Deferred, Effect, Either, Exit, Option, Queue, Schema, Scope, Stream, TQueue, WebChannel, } from '@livestore/utils/effect';
2
2
  import { nanoid } from '@livestore/utils/nanoid';
3
- import * as WebmeshSchema from '../mesh-schema.js';
4
- import { makeDirectChannelInternal } from './direct-channel-internal.js';
3
+ import * as WebmeshSchema from "../mesh-schema.js";
4
+ import { makeDirectChannelInternal } from "./direct-channel-internal.js";
5
5
  /**
6
6
  * Behaviour:
7
7
  * - Waits until there is an initial edge
@@ -1,7 +1,7 @@
1
1
  import type { PubSub } from '@livestore/utils/effect';
2
2
  import { Effect, Queue, Schema, Scope, WebChannel } from '@livestore/utils/effect';
3
- import { type ChannelName, type MeshNodeName, type ProxyQueueItem } from '../common.js';
4
- import * as MeshSchema from '../mesh-schema.js';
3
+ import { type ChannelName, type MeshNodeName, type ProxyQueueItem } from '../common.ts';
4
+ import * as MeshSchema from '../mesh-schema.ts';
5
5
  interface MakeProxyChannelArgs {
6
6
  queue: Queue.Queue<ProxyQueueItem>;
7
7
  nodeName: MeshNodeName;
@@ -1,8 +1,8 @@
1
1
  import { casesHandled, shouldNeverHappen } from '@livestore/utils';
2
2
  import { Deferred, Effect, Either, Exit, Fiber, FiberHandle, Queue, Schedule, Schema, Scope, Stream, SubscriptionRef, WebChannel, } from '@livestore/utils/effect';
3
3
  import { nanoid } from '@livestore/utils/nanoid';
4
- import { packetAsOtelAttributes, } from '../common.js';
5
- import * as MeshSchema from '../mesh-schema.js';
4
+ import { packetAsOtelAttributes, } from "../common.js";
5
+ import * as MeshSchema from "../mesh-schema.js";
6
6
  export const makeProxyChannel = ({ queue, nodeName, newEdgeAvailablePubSub, sendPacket, target, channelName, schema, }) => Effect.scopeWithCloseable((scope) => Effect.gen(function* () {
7
7
  const channelStateRef = { current: { _tag: 'Initial' } };
8
8
  const debugInfo = {
package/dist/common.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type Effect, Schema } from '@livestore/utils/effect';
2
- import type { DirectChannelPacket, Packet, ProxyChannelPacket } from './mesh-schema.js';
2
+ import type { DirectChannelPacket, Packet, ProxyChannelPacket } from './mesh-schema.ts';
3
3
  export type ProxyQueueItem = {
4
4
  packet: typeof ProxyChannelPacket.Type;
5
5
  respondToSender: (msg: typeof ProxyChannelPacket.Type) => Effect.Effect<void>;
package/dist/mod.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { EdgeAlreadyExistsError } from './common.js';
2
- export * as WebmeshSchema from './mesh-schema.js';
3
- export * from './node.js';
4
- export * from './websocket-edge.js';
1
+ export { EdgeAlreadyExistsError } from './common.ts';
2
+ export * as WebmeshSchema from './mesh-schema.ts';
3
+ export * from './node.ts';
4
+ export * from './websocket-edge.ts';
5
5
  //# sourceMappingURL=mod.d.ts.map
package/dist/mod.js CHANGED
@@ -1,5 +1,5 @@
1
- export { EdgeAlreadyExistsError } from './common.js';
2
- export * as WebmeshSchema from './mesh-schema.js';
3
- export * from './node.js';
4
- export * from './websocket-edge.js';
1
+ export { EdgeAlreadyExistsError } from "./common.js";
2
+ export * as WebmeshSchema from "./mesh-schema.js";
3
+ export * from "./node.js";
4
+ export * from "./websocket-edge.js";
5
5
  //# sourceMappingURL=mod.js.map
package/dist/node.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Cause, Duration, Effect, Schema, Scope, Stream, WebChannel } from '@livestore/utils/effect';
2
- import type { ListenForChannelResult, MeshNodeName } from './common.js';
3
- import { EdgeAlreadyExistsError } from './common.js';
4
- import * as WebmeshSchema from './mesh-schema.js';
2
+ import type { ListenForChannelResult, MeshNodeName } from './common.ts';
3
+ import { EdgeAlreadyExistsError } from './common.ts';
4
+ import * as WebmeshSchema from './mesh-schema.ts';
5
5
  type EdgeChannel = WebChannel.WebChannel<typeof WebmeshSchema.Packet.Type, typeof WebmeshSchema.Packet.Type>;
6
6
  export interface MeshNode<TName extends MeshNodeName = MeshNodeName> {
7
7
  nodeName: TName;
package/dist/node.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { indent, LS_DEV, shouldNeverHappen } from '@livestore/utils';
2
2
  import { Cause, Deferred, Duration, Effect, Exit, Fiber, Option, PubSub, Queue, Schema, Scope, Stream, WebChannel, } from '@livestore/utils/effect';
3
- import { makeDirectChannel } from './channel/direct-channel.js';
4
- import { makeProxyChannel } from './channel/proxy-channel.js';
5
- import { EdgeAlreadyExistsError, packetAsOtelAttributes } from './common.js';
6
- import * as WebmeshSchema from './mesh-schema.js';
7
- import { TimeoutSet } from './utils.js';
3
+ import { makeDirectChannel } from "./channel/direct-channel.js";
4
+ import { makeProxyChannel } from "./channel/proxy-channel.js";
5
+ import { EdgeAlreadyExistsError, packetAsOtelAttributes } from "./common.js";
6
+ import * as WebmeshSchema from "./mesh-schema.js";
7
+ import { TimeoutSet } from "./utils.js";
8
8
  export const makeMeshNode = (nodeName) => Effect.gen(function* () {
9
9
  const edgeChannels = new Map();
10
10
  // To avoid unbounded memory growth, we automatically forget about packet ids after a while
package/dist/node.test.js CHANGED
@@ -4,8 +4,8 @@ import { Chunk, Deferred, Effect, Exit, identity, Layer, Logger, LogLevel, Schem
4
4
  import { OtelLiveHttp } from '@livestore/utils-dev/node';
5
5
  import { Vitest } from '@livestore/utils-dev/node-vitest';
6
6
  import { expect } from 'vitest';
7
- import { Packet } from './mesh-schema.js';
8
- import { makeMeshNode } from './node.js';
7
+ import { Packet } from "./mesh-schema.js";
8
+ import { makeMeshNode } from "./node.js";
9
9
  // TODO test cases where in-between node only comes online later
10
10
  // TODO test cases where other side tries to reconnect
11
11
  // TODO test combination of channel types (message, proxy)
@@ -1,7 +1,7 @@
1
1
  import type { HttpClient } from '@livestore/utils/effect';
2
2
  import { Effect, Schema, Scope, Socket, WebChannel } from '@livestore/utils/effect';
3
- import * as WebmeshSchema from './mesh-schema.js';
4
- import type { MeshNode } from './node.js';
3
+ import * as WebmeshSchema from './mesh-schema.ts';
4
+ import type { MeshNode } from './node.ts';
5
5
  declare const WSEdgeInit_base: Schema.TaggedStruct<"WSEdgeInit", {
6
6
  from: typeof Schema.String;
7
7
  }>;
@@ -1,5 +1,5 @@
1
1
  import { Deferred, Effect, Either, Exit, Layer, Queue, Schedule, Schema, Scope, Socket, Stream, WebChannel, } from '@livestore/utils/effect';
2
- import * as WebmeshSchema from './mesh-schema.js';
2
+ import * as WebmeshSchema from "./mesh-schema.js";
3
3
  export class WSEdgeInit extends Schema.TaggedStruct('WSEdgeInit', {
4
4
  from: Schema.String,
5
5
  }) {
package/package.json CHANGED
@@ -1,27 +1,18 @@
1
1
  {
2
2
  "name": "@livestore/webmesh",
3
- "version": "0.0.0-snapshot-057a9e3a18ca69a310d4eb8cf35a34e94fa1841e",
3
+ "version": "0.0.0-snapshot-9d9745f6fc391ab1a695b44e8fad6c460c7b3b77",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
7
- ".": {
8
- "types": "./dist/mod.d.ts",
9
- "bun": "./src/mod.ts",
10
- "default": "./dist/mod.js"
11
- },
12
- "./websocket-server": {
13
- "types": "./dist/websocket-server.d.ts",
14
- "bun": "./src/websocket-server.ts",
15
- "default": "./dist/websocket-server.js"
16
- }
7
+ ".": "./dist/mod.js",
8
+ "./websocket-server": "./dist/websocket-server.js"
17
9
  },
18
- "types": "./dist/mod.d.ts",
19
10
  "dependencies": {
20
- "@livestore/utils": "0.0.0-snapshot-057a9e3a18ca69a310d4eb8cf35a34e94fa1841e"
11
+ "@livestore/utils": "0.0.0-snapshot-9d9745f6fc391ab1a695b44e8fad6c460c7b3b77"
21
12
  },
22
13
  "devDependencies": {
23
14
  "vitest": "3.2.4",
24
- "@livestore/utils-dev": "0.0.0-snapshot-057a9e3a18ca69a310d4eb8cf35a34e94fa1841e"
15
+ "@livestore/utils-dev": "0.0.0-snapshot-9d9745f6fc391ab1a695b44e8fad6c460c7b3b77"
25
16
  },
26
17
  "files": [
27
18
  "package.json",
@@ -13,8 +13,8 @@ import {
13
13
  WebChannel,
14
14
  } from '@livestore/utils/effect'
15
15
 
16
- import { type ChannelName, type MeshNodeName, type MessageQueueItem, packetAsOtelAttributes } from '../common.js'
17
- import * as MeshSchema from '../mesh-schema.js'
16
+ import { type ChannelName, type MeshNodeName, type MessageQueueItem, packetAsOtelAttributes } from '../common.ts'
17
+ import * as MeshSchema from '../mesh-schema.ts'
18
18
 
19
19
  export interface MakeDirectChannelArgs {
20
20
  nodeName: MeshNodeName
@@ -14,9 +14,9 @@ import {
14
14
  } from '@livestore/utils/effect'
15
15
  import { nanoid } from '@livestore/utils/nanoid'
16
16
 
17
- import * as WebmeshSchema from '../mesh-schema.js'
18
- import type { MakeDirectChannelArgs } from './direct-channel-internal.js'
19
- import { makeDirectChannelInternal } from './direct-channel-internal.js'
17
+ import * as WebmeshSchema from '../mesh-schema.ts'
18
+ import type { MakeDirectChannelArgs } from './direct-channel-internal.ts'
19
+ import { makeDirectChannelInternal } from './direct-channel-internal.ts'
20
20
 
21
21
  /**
22
22
  * Behaviour:
@@ -23,8 +23,8 @@ import {
23
23
  type MeshNodeName,
24
24
  type ProxyQueueItem,
25
25
  packetAsOtelAttributes,
26
- } from '../common.js'
27
- import * as MeshSchema from '../mesh-schema.js'
26
+ } from '../common.ts'
27
+ import * as MeshSchema from '../mesh-schema.ts'
28
28
 
29
29
  interface MakeProxyChannelArgs {
30
30
  queue: Queue.Queue<ProxyQueueItem>
package/src/common.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type Effect, Predicate, Schema } from '@livestore/utils/effect'
2
2
 
3
- import type { DirectChannelPacket, Packet, ProxyChannelPacket } from './mesh-schema.js'
3
+ import type { DirectChannelPacket, Packet, ProxyChannelPacket } from './mesh-schema.ts'
4
4
 
5
5
  export type ProxyQueueItem = {
6
6
  packet: typeof ProxyChannelPacket.Type
package/src/mod.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { EdgeAlreadyExistsError } from './common.js'
2
- export * as WebmeshSchema from './mesh-schema.js'
3
- export * from './node.js'
4
- export * from './websocket-edge.js'
1
+ export { EdgeAlreadyExistsError } from './common.ts'
2
+ export * as WebmeshSchema from './mesh-schema.ts'
3
+ export * from './node.ts'
4
+ export * from './websocket-edge.ts'
package/src/node.test.ts CHANGED
@@ -19,9 +19,9 @@ import { OtelLiveHttp } from '@livestore/utils-dev/node'
19
19
  import { Vitest } from '@livestore/utils-dev/node-vitest'
20
20
  import { expect } from 'vitest'
21
21
 
22
- import { Packet } from './mesh-schema.js'
23
- import type { MeshNode } from './node.js'
24
- import { makeMeshNode } from './node.js'
22
+ import { Packet } from './mesh-schema.ts'
23
+ import type { MeshNode } from './node.ts'
24
+ import { makeMeshNode } from './node.ts'
25
25
 
26
26
  // TODO test cases where in-between node only comes online later
27
27
  // TODO test cases where other side tries to reconnect
package/src/node.ts CHANGED
@@ -15,12 +15,12 @@ import {
15
15
  WebChannel,
16
16
  } from '@livestore/utils/effect'
17
17
 
18
- import { makeDirectChannel } from './channel/direct-channel.js'
19
- import { makeProxyChannel } from './channel/proxy-channel.js'
20
- import type { ChannelKey, ListenForChannelResult, MeshNodeName, MessageQueueItem, ProxyQueueItem } from './common.js'
21
- import { EdgeAlreadyExistsError, packetAsOtelAttributes } from './common.js'
22
- import * as WebmeshSchema from './mesh-schema.js'
23
- import { TimeoutSet } from './utils.js'
18
+ import { makeDirectChannel } from './channel/direct-channel.ts'
19
+ import { makeProxyChannel } from './channel/proxy-channel.ts'
20
+ import type { ChannelKey, ListenForChannelResult, MeshNodeName, MessageQueueItem, ProxyQueueItem } from './common.ts'
21
+ import { EdgeAlreadyExistsError, packetAsOtelAttributes } from './common.ts'
22
+ import * as WebmeshSchema from './mesh-schema.ts'
23
+ import { TimeoutSet } from './utils.ts'
24
24
 
25
25
  type EdgeChannel = WebChannel.WebChannel<typeof WebmeshSchema.Packet.Type, typeof WebmeshSchema.Packet.Type>
26
26
 
@@ -14,8 +14,8 @@ import {
14
14
  WebChannel,
15
15
  } from '@livestore/utils/effect'
16
16
 
17
- import * as WebmeshSchema from './mesh-schema.js'
18
- import type { MeshNode } from './node.js'
17
+ import * as WebmeshSchema from './mesh-schema.ts'
18
+ import type { MeshNode } from './node.ts'
19
19
 
20
20
  export class WSEdgeInit extends Schema.TaggedStruct('WSEdgeInit', {
21
21
  from: Schema.String,