@party-stack/runtime 0.4.0 → 0.4.2

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.
Files changed (57) hide show
  1. package/lib/coordinator/createPersistedCollectionCoordinator.d.ts +4 -2
  2. package/lib/coordinator/createPersistedCollectionCoordinator.d.ts.map +1 -1
  3. package/lib/coordinator/createPersistedCollectionCoordinator.js +506 -555
  4. package/lib/coordinator/createPersistedCollectionCoordinator.js.map +1 -1
  5. package/lib/coordinator/index.d.ts +2 -2
  6. package/lib/coordinator/index.js +0 -1
  7. package/lib/effection/index.d.ts +4 -2
  8. package/lib/effection/index.d.ts.map +1 -1
  9. package/lib/effection/index.js +25 -25
  10. package/lib/effection/index.js.map +1 -1
  11. package/lib/index.d.ts +11 -11
  12. package/lib/index.js +10 -9
  13. package/lib/memory/MemoryBlobBytesStore.d.ts +8 -6
  14. package/lib/memory/MemoryBlobBytesStore.d.ts.map +1 -1
  15. package/lib/memory/MemoryBlobBytesStore.js +22 -20
  16. package/lib/memory/MemoryBlobBytesStore.js.map +1 -1
  17. package/lib/types.d.ts +31 -29
  18. package/lib/types.d.ts.map +1 -1
  19. package/lib/types.js +0 -1
  20. package/lib/utils/BrowserAuthenticationCancelledError.d.ts +3 -1
  21. package/lib/utils/BrowserAuthenticationCancelledError.d.ts.map +1 -1
  22. package/lib/utils/BrowserAuthenticationCancelledError.js +10 -6
  23. package/lib/utils/BrowserAuthenticationCancelledError.js.map +1 -1
  24. package/lib/utils/createCollectionPersistence.d.ts +4 -2
  25. package/lib/utils/createCollectionPersistence.d.ts.map +1 -1
  26. package/lib/utils/createCollectionPersistence.js +20 -16
  27. package/lib/utils/createCollectionPersistence.js.map +1 -1
  28. package/lib/utils/createDefaultRuntime.d.ts +4 -1
  29. package/lib/utils/createDefaultRuntime.d.ts.map +1 -1
  30. package/lib/utils/createDefaultRuntime.js +15 -11
  31. package/lib/utils/createDefaultRuntime.js.map +1 -1
  32. package/lib/utils/createLocalCollection.d.ts +8 -6
  33. package/lib/utils/createLocalCollection.d.ts.map +1 -1
  34. package/lib/utils/createLocalCollection.js +19 -15
  35. package/lib/utils/createLocalCollection.js.map +1 -1
  36. package/lib/utils/defineRuntime.d.ts +3 -1
  37. package/lib/utils/defineRuntime.d.ts.map +1 -1
  38. package/lib/utils/defineRuntime.js +26 -30
  39. package/lib/utils/defineRuntime.js.map +1 -1
  40. package/package.json +12 -18
  41. package/lib/coordinator/index.d.ts.map +0 -1
  42. package/lib/coordinator/index.js.map +0 -1
  43. package/lib/index.d.ts.map +0 -1
  44. package/lib/index.js.map +0 -1
  45. package/lib/memory/MemoryBlobBytesStore.test.d.ts +0 -2
  46. package/lib/memory/MemoryBlobBytesStore.test.d.ts.map +0 -1
  47. package/lib/memory/MemoryBlobBytesStore.test.js +0 -12
  48. package/lib/memory/MemoryBlobBytesStore.test.js.map +0 -1
  49. package/lib/types.js.map +0 -1
  50. package/lib/utils/createLocalCollection.test.d.ts +0 -2
  51. package/lib/utils/createLocalCollection.test.d.ts.map +0 -1
  52. package/lib/utils/createLocalCollection.test.js +0 -748
  53. package/lib/utils/createLocalCollection.test.js.map +0 -1
  54. package/lib/utils/defineRuntime.test.d.ts +0 -2
  55. package/lib/utils/defineRuntime.test.d.ts.map +0 -1
  56. package/lib/utils/defineRuntime.test.js +0 -40
  57. package/lib/utils/defineRuntime.test.js.map +0 -1
@@ -1,2 +1,5 @@
1
- export declare const createDefaultRuntime: (owner: string, namespace: string) => import("../types.js").RuntimeAdapter;
1
+ import { RuntimeAdapter } from "../types.js";
2
+ //#region src/utils/createDefaultRuntime.d.ts
3
+ export declare const createDefaultRuntime: (owner: string, namespace: string) => RuntimeAdapter;
4
+ //#endregion
2
5
  //# sourceMappingURL=createDefaultRuntime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createDefaultRuntime.d.ts","sourceRoot":"","sources":["../../src/utils/createDefaultRuntime.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,oBAAoB,4EAc/B,CAAC"}
1
+ {"version":3,"file":"createDefaultRuntime.d.ts","names":["_$___types_js0.RuntimeAdapter"],"sources":["../../src/utils/createDefaultRuntime.ts"],"mappings":";;qBAIa,uBAAoB,eAAA,sBAApBA"}
@@ -1,15 +1,19 @@
1
- import { SingleProcessCoordination } from "@party-stack/coordination";
2
1
  import { MemoryBlobBytesStore } from "../memory/MemoryBlobBytesStore.js";
3
2
  import { defineRuntime } from "./defineRuntime.js";
4
- export const createDefaultRuntime = defineRuntime((owner, namespace) => {
5
- const scope = `party-stack:${owner}:${namespace}`;
6
- const coordination = new SingleProcessCoordination({ scope });
7
- return {
8
- owner,
9
- namespace,
10
- blobBytes: new MemoryBlobBytesStore(),
11
- coordination,
12
- cleanup: () => coordination.close(),
13
- };
3
+ import { SingleProcessCoordination } from "@party-stack/coordination";
4
+ //#region src/utils/createDefaultRuntime.ts
5
+ const createDefaultRuntime = defineRuntime((owner, namespace) => {
6
+ const scope = `party-stack:${owner}:${namespace}`;
7
+ const coordination = new SingleProcessCoordination({ scope });
8
+ return {
9
+ owner,
10
+ namespace,
11
+ blobBytes: new MemoryBlobBytesStore(),
12
+ coordination,
13
+ cleanup: () => coordination.close()
14
+ };
14
15
  });
16
+ //#endregion
17
+ export { createDefaultRuntime };
18
+
15
19
  //# sourceMappingURL=createDefaultRuntime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createDefaultRuntime.js","sourceRoot":"","sources":["../../src/utils/createDefaultRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAC,CAC9C,KAAK,EACL,SAAS,EACX,EAAE;IACA,MAAM,KAAK,GAAG,eAAe,KAAK,IAAI,SAAS,EAAE,CAAC;IAClD,MAAM,YAAY,GACd,IAAI,yBAAyB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAC7C,OAAO;QACH,KAAK;QACL,SAAS;QACT,SAAS,EAAE,IAAI,oBAAoB,EAAE;QACrC,YAAY;QACZ,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,EAAE;KACtC,CAAC;AACN,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"createDefaultRuntime.js","names":[],"sources":["../../src/utils/createDefaultRuntime.ts"],"sourcesContent":["import { SingleProcessCoordination } from \"@party-stack/coordination\";\nimport { MemoryBlobBytesStore } from \"../memory/MemoryBlobBytesStore.js\";\nimport { defineRuntime } from \"./defineRuntime.js\";\n\nexport const createDefaultRuntime = defineRuntime((owner, namespace) => {\n const scope = `party-stack:${owner}:${namespace}`;\n const coordination = new SingleProcessCoordination({ scope });\n return {\n owner,\n namespace,\n blobBytes: new MemoryBlobBytesStore(),\n coordination,\n cleanup: () => coordination.close(),\n };\n});\n"],"mappings":";;;;AAIA,MAAa,uBAAuB,eAAe,OAAO,cAAc;CACpE,MAAM,QAAQ,eAAe,MAAM,GAAG;CACtC,MAAM,eAAe,IAAI,0BAA0B,EAAE,MAAM,CAAC;CAC5D,OAAO;EACH;EACA;EACA,WAAW,IAAI,qBAAqB;EACpC;EACA,eAAe,aAAa,MAAM;CACtC;AACJ,CAAC"}
@@ -1,9 +1,11 @@
1
- import { type Collection } from "@tanstack/db";
2
- import type { RuntimeAdapter } from "../types.js";
1
+ import { RuntimeAdapter } from "../types.js";
2
+ import { Collection } from "@tanstack/db";
3
+ //#region src/utils/createLocalCollection.d.ts
3
4
  export declare function createLocalCollection<T extends object, TKey extends string | number>(options: {
4
- name: string;
5
- getKey: (value: T) => TKey;
6
- runtime: RuntimeAdapter;
7
- schemaVersion?: number;
5
+ name: string;
6
+ getKey: (value: T) => TKey;
7
+ runtime: RuntimeAdapter;
8
+ schemaVersion?: number;
8
9
  }): Collection<T, TKey>;
10
+ //#endregion
9
11
  //# sourceMappingURL=createLocalCollection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createLocalCollection.d.ts","sourceRoot":"","sources":["../../src/utils/createLocalCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgD,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAG7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,OAAO,EAAE;IAC3F,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC3B,OAAO,EAAE,cAAc,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,UAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAgBtB"}
1
+ {"version":3,"file":"createLocalCollection.d.ts","names":[],"sources":["../../src/utils/createLocalCollection.ts"],"mappings":";;;wBAKgB,sBAAsB,kBAAkB,8BAA8B;EAClF;EACA,SAAS,OAAO,MAAM;EACtB,SAAS;EACT;IACA,WAAW,GAAG"}
@@ -1,18 +1,22 @@
1
- import { createCollection, localOnlyCollectionOptions } from "@tanstack/db";
2
- import { persistedCollectionOptions } from "@tanstack/db-sqlite-persistence-core";
3
1
  import { createCollectionPersistence } from "./createCollectionPersistence.js";
4
- export function createLocalCollection(options) {
5
- const collectionOptions = {
6
- id: `party-stack:${options.runtime.owner}:${options.runtime.namespace}:${options.name}`,
7
- getKey: options.getKey,
8
- };
9
- const persistence = options.runtime.persistence;
10
- return createCollection(persistence
11
- ? persistedCollectionOptions({
12
- ...collectionOptions,
13
- schemaVersion: options.schemaVersion,
14
- persistence: createCollectionPersistence(options.runtime.coordination, persistence),
15
- })
16
- : localOnlyCollectionOptions(collectionOptions));
2
+ import { persistedCollectionOptions } from "@tanstack/db-sqlite-persistence-core";
3
+ import { BasicIndex, createCollection, localOnlyCollectionOptions } from "@tanstack/db";
4
+ //#region src/utils/createLocalCollection.ts
5
+ function createLocalCollection(options) {
6
+ const collectionOptions = {
7
+ id: `party-stack:${options.runtime.owner}:${options.runtime.namespace}:${options.name}`,
8
+ getKey: options.getKey,
9
+ defaultIndexType: BasicIndex,
10
+ autoIndex: "eager"
11
+ };
12
+ const persistence = options.runtime.persistence;
13
+ return createCollection(persistence ? persistedCollectionOptions({
14
+ ...collectionOptions,
15
+ schemaVersion: options.schemaVersion,
16
+ persistence: createCollectionPersistence(options.runtime.coordination, persistence)
17
+ }) : localOnlyCollectionOptions(collectionOptions));
17
18
  }
19
+ //#endregion
20
+ export { createLocalCollection };
21
+
18
22
  //# sourceMappingURL=createLocalCollection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createLocalCollection.js","sourceRoot":"","sources":["../../src/utils/createLocalCollection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAmB,MAAM,cAAc,CAAC;AAC7F,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAG/E,MAAM,UAAU,qBAAqB,CAAiD,OAKrF;IACG,MAAM,iBAAiB,GAAG;QACtB,EAAE,EAAE,eAAe,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,IAAI,EAAE;QACvF,MAAM,EAAE,OAAO,CAAC,MAAM;KACzB,CAAC;IACF,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;IAEhD,OAAO,gBAAgB,CACnB,WAAW;QACP,CAAC,CAAC,0BAA0B,CAAU;YAChC,GAAG,iBAAiB;YACpB,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,WAAW,EAAE,2BAA2B,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,WAAW,CAAC;SACtF,CAAC;QACJ,CAAC,CAAC,0BAA0B,CAAU,iBAAiB,CAAC,CAC/D,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"createLocalCollection.js","names":[],"sources":["../../src/utils/createLocalCollection.ts"],"sourcesContent":["import { BasicIndex, createCollection, localOnlyCollectionOptions, type Collection } from \"@tanstack/db\";\nimport { persistedCollectionOptions } from \"@tanstack/db-sqlite-persistence-core\";\nimport { createCollectionPersistence } from \"./createCollectionPersistence.js\";\nimport type { RuntimeAdapter } from \"../types.js\";\n\nexport function createLocalCollection<T extends object, TKey extends string | number>(options: {\n name: string;\n getKey: (value: T) => TKey;\n runtime: RuntimeAdapter;\n schemaVersion?: number;\n}): Collection<T, TKey> {\n const collectionOptions = {\n id: `party-stack:${options.runtime.owner}:${options.runtime.namespace}:${options.name}`,\n getKey: options.getKey,\n defaultIndexType: BasicIndex,\n autoIndex: \"eager\" as const,\n };\n const persistence = options.runtime.persistence;\n\n return createCollection(\n persistence\n ? persistedCollectionOptions<T, TKey>({\n ...collectionOptions,\n schemaVersion: options.schemaVersion,\n persistence: createCollectionPersistence(options.runtime.coordination, persistence),\n })\n : localOnlyCollectionOptions<T, TKey>(collectionOptions)\n );\n}\n"],"mappings":";;;;AAKA,SAAgB,sBAAsE,SAK9D;CACpB,MAAM,oBAAoB;EACtB,IAAI,eAAe,QAAQ,QAAQ,MAAM,GAAG,QAAQ,QAAQ,UAAU,GAAG,QAAQ;EACjF,QAAQ,QAAQ;EAChB,kBAAkB;EAClB,WAAW;CACf;CACA,MAAM,cAAc,QAAQ,QAAQ;CAEpC,OAAO,iBACH,cACM,2BAAoC;EAChC,GAAG;EACH,eAAe,QAAQ;EACvB,aAAa,4BAA4B,QAAQ,QAAQ,cAAc,WAAW;CACtF,CAAC,IACD,2BAAoC,iBAAiB,CAC/D;AACJ"}
@@ -1,7 +1,9 @@
1
- import type { RuntimeAdapter } from "../types.js";
1
+ import { RuntimeAdapter } from "../types.js";
2
+ //#region src/utils/defineRuntime.d.ts
2
3
  type SyncRuntimeAdapterProvider = (owner: string, namespace: string) => RuntimeAdapter;
3
4
  type AsyncRuntimeAdapterProvider = (owner: string, namespace: string) => Promise<RuntimeAdapter>;
4
5
  export declare function defineRuntime(provider: SyncRuntimeAdapterProvider): SyncRuntimeAdapterProvider;
5
6
  export declare function defineRuntime(provider: AsyncRuntimeAdapterProvider): AsyncRuntimeAdapterProvider;
7
+ //#endregion
6
8
  export {};
7
9
  //# sourceMappingURL=defineRuntime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"defineRuntime.d.ts","sourceRoot":"","sources":["../../src/utils/defineRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,cAAc,EAEjB,MAAM,aAAa,CAAC;AAErB,KAAK,0BAA0B,GAAG,CAC9B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,KAChB,cAAc,CAAC;AAEpB,KAAK,2BAA2B,GAAG,CAC/B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,KAChB,OAAO,CAAC,cAAc,CAAC,CAAC;AAkC7B,wBAAgB,aAAa,CACzB,QAAQ,EAAE,0BAA0B,GACrC,0BAA0B,CAAC;AAC9B,wBAAgB,aAAa,CACzB,QAAQ,EAAE,2BAA2B,GACtC,2BAA2B,CAAC"}
1
+ {"version":3,"file":"defineRuntime.d.ts","names":[],"sources":["../../src/utils/defineRuntime.ts"],"mappings":";;KAEK,8BAA8B,eAAe,sBAAsB;KAEnE,+BAA+B,eAAe,sBAAsB,QAAQ;wBA8BjE,cAAc,UAAU,6BAA6B;wBACrD,cAAc,UAAU,8BAA8B"}
@@ -1,34 +1,30 @@
1
+ //#region src/utils/defineRuntime.ts
1
2
  function manageRuntime(runtime) {
2
- const rawCleanup = runtime.cleanup?.bind(runtime);
3
- const rawDestroy = runtime.destroy?.bind(runtime);
4
- let cleanupPromise;
5
- let destroyPromise;
6
- const cleanup = () => {
7
- cleanupPromise ??= Promise.resolve()
8
- .then(() => rawCleanup?.())
9
- .then(() => undefined);
10
- return cleanupPromise;
11
- };
12
- const destroy = rawDestroy
13
- ? () => {
14
- destroyPromise ??= cleanup()
15
- .then(() => rawDestroy())
16
- .then(() => undefined);
17
- return destroyPromise;
18
- }
19
- : undefined;
20
- return {
21
- ...runtime,
22
- cleanup,
23
- destroy,
24
- };
3
+ const rawCleanup = runtime.cleanup?.bind(runtime);
4
+ const rawDestroy = runtime.destroy?.bind(runtime);
5
+ let cleanupPromise;
6
+ let destroyPromise;
7
+ const cleanup = () => {
8
+ cleanupPromise ??= Promise.resolve().then(() => rawCleanup?.()).then(() => void 0);
9
+ return cleanupPromise;
10
+ };
11
+ const destroy = rawDestroy ? () => {
12
+ destroyPromise ??= cleanup().then(() => rawDestroy()).then(() => void 0);
13
+ return destroyPromise;
14
+ } : void 0;
15
+ return {
16
+ ...runtime,
17
+ cleanup,
18
+ destroy
19
+ };
25
20
  }
26
- export function defineRuntime(provider) {
27
- return (owner, namespace) => {
28
- const runtime = provider(owner, namespace);
29
- return runtime instanceof Promise
30
- ? runtime.then(manageRuntime)
31
- : manageRuntime(runtime);
32
- };
21
+ function defineRuntime(provider) {
22
+ return (owner, namespace) => {
23
+ const runtime = provider(owner, namespace);
24
+ return runtime instanceof Promise ? runtime.then(manageRuntime) : manageRuntime(runtime);
25
+ };
33
26
  }
27
+ //#endregion
28
+ export { defineRuntime };
29
+
34
30
  //# sourceMappingURL=defineRuntime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defineRuntime.js","sourceRoot":"","sources":["../../src/utils/defineRuntime.ts"],"names":[],"mappings":"AAeA,SAAS,aAAa,CAClB,OAAuB;IAEvB,MAAM,UAAU,GACZ,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACnC,MAAM,UAAU,GACZ,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,cAAyC,CAAC;IAC9C,IAAI,cAAyC,CAAC;IAE9C,MAAM,OAAO,GAAG,GAAkB,EAAE;QAChC,cAAc,KAAK,OAAO,CAAC,OAAO,EAAE;aAC/B,IAAI,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,EAAE,CAAC;aAC1B,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QAC3B,OAAO,cAAc,CAAC;IAC1B,CAAC,CAAC;IACF,MAAM,OAAO,GAAG,UAAU;QACtB,CAAC,CAAC,GAAkB,EAAE;YAChB,cAAc,KAAK,OAAO,EAAE;iBACvB,IAAI,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC;iBACxB,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YAC3B,OAAO,cAAc,CAAC;QAC1B,CAAC;QACH,CAAC,CAAC,SAAS,CAAC;IAEhB,OAAO;QACH,GAAG,OAAO;QACV,OAAO;QACP,OAAO;KACV,CAAC;AACN,CAAC;AAQD,MAAM,UAAU,aAAa,CACzB,QAAgC;IAEhC,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;QACxB,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAC3C,OAAO,OAAO,YAAY,OAAO;YAC7B,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC;YAC7B,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"defineRuntime.js","names":[],"sources":["../../src/utils/defineRuntime.ts"],"sourcesContent":["import type { RuntimeAdapter, RuntimeAdapterProvider } from \"../types.js\";\n\ntype SyncRuntimeAdapterProvider = (owner: string, namespace: string) => RuntimeAdapter;\n\ntype AsyncRuntimeAdapterProvider = (owner: string, namespace: string) => Promise<RuntimeAdapter>;\n\nfunction manageRuntime(runtime: RuntimeAdapter): RuntimeAdapter {\n const rawCleanup = runtime.cleanup?.bind(runtime);\n const rawDestroy = runtime.destroy?.bind(runtime);\n let cleanupPromise: Promise<void> | undefined;\n let destroyPromise: Promise<void> | undefined;\n\n const cleanup = (): Promise<void> => {\n cleanupPromise ??= Promise.resolve()\n .then(() => rawCleanup?.())\n .then(() => undefined);\n return cleanupPromise;\n };\n const destroy = rawDestroy\n ? (): Promise<void> => {\n destroyPromise ??= cleanup()\n .then(() => rawDestroy())\n .then(() => undefined);\n return destroyPromise;\n }\n : undefined;\n\n return {\n ...runtime,\n cleanup,\n destroy,\n };\n}\n\nexport function defineRuntime(provider: SyncRuntimeAdapterProvider): SyncRuntimeAdapterProvider;\nexport function defineRuntime(provider: AsyncRuntimeAdapterProvider): AsyncRuntimeAdapterProvider;\nexport function defineRuntime(provider: RuntimeAdapterProvider): RuntimeAdapterProvider {\n return (owner, namespace) => {\n const runtime = provider(owner, namespace);\n return runtime instanceof Promise ? runtime.then(manageRuntime) : manageRuntime(runtime);\n };\n}\n"],"mappings":";AAMA,SAAS,cAAc,SAAyC;CAC5D,MAAM,aAAa,QAAQ,SAAS,KAAK,OAAO;CAChD,MAAM,aAAa,QAAQ,SAAS,KAAK,OAAO;CAChD,IAAI;CACJ,IAAI;CAEJ,MAAM,gBAA+B;EACjC,mBAAmB,QAAQ,QAAQ,CAAC,CAC/B,WAAW,aAAa,CAAC,CAAC,CAC1B,WAAW,KAAA,CAAS;EACzB,OAAO;CACX;CACA,MAAM,UAAU,mBACW;EACjB,mBAAmB,QAAQ,CAAC,CACvB,WAAW,WAAW,CAAC,CAAC,CACxB,WAAW,KAAA,CAAS;EACzB,OAAO;CACX,IACA,KAAA;CAEN,OAAO;EACH,GAAG;EACH;EACA;CACJ;AACJ;AAIA,SAAgB,cAAc,UAA0D;CACpF,QAAQ,OAAO,cAAc;EACzB,MAAM,UAAU,SAAS,OAAO,SAAS;EACzC,OAAO,mBAAmB,UAAU,QAAQ,KAAK,aAAa,IAAI,cAAc,OAAO;CAC3F;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "@party-stack/runtime",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
+ "files": [
5
+ "lib"
6
+ ],
4
7
  "type": "module",
5
8
  "exports": {
6
9
  ".": {
@@ -12,28 +15,19 @@
12
15
  "default": "./lib/effection/index.js"
13
16
  }
14
17
  },
15
- "files": [
16
- "lib"
17
- ],
18
18
  "dependencies": {
19
19
  "effection": "^4.0.2",
20
- "@party-stack/coordination": "0.3.0"
20
+ "@party-stack/coordination": "0.3.1"
21
21
  },
22
22
  "devDependencies": {
23
- "@bobbyfidz/universal-build-config": "^0.1.1",
24
- "@tanstack/db": "0.12.1",
25
- "@tanstack/db-sqlite-persistence-core": "0.4.5",
26
- "eslint": "^9.25.0",
27
- "typescript": "~5.8.3",
28
- "vitest": "^3.1.1"
23
+ "@tanstack/db": "0.14.0",
24
+ "@tanstack/db-sqlite-persistence-core": "0.4.9",
25
+ "typescript": "~7.0.2",
26
+ "vite-plus": "1.2.0",
27
+ "@party-stack/build-config": "0.1.3"
29
28
  },
30
29
  "peerDependencies": {
31
- "@tanstack/db": "0.12.1",
32
- "@tanstack/db-sqlite-persistence-core": "0.4.5"
33
- },
34
- "scripts": {
35
- "build": "tsc",
36
- "lint": "eslint",
37
- "test": "vitest run"
30
+ "@tanstack/db": "0.14.0",
31
+ "@tanstack/db-sqlite-persistence-core": "0.4.9"
38
32
  }
39
33
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/coordinator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,2CAA2C,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/coordinator/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,2CAA2C,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,mCAAmC,EAAE,MAAM,gDAAgD,CAAC;AACrG,OAAO,EACH,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACxB,6BAA6B,EAC7B,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,EACzB,kBAAkB,GACrB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACR,cAAc,EACd,qBAAqB,EACrB,iCAAiC,EACjC,4BAA4B,EAC5B,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,sBAAsB,GACzB,MAAM,YAAY,CAAC;AACpB,YAAY,EACR,YAAY,EACZ,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,yBAAyB,EACzB,yBAAyB,EACzB,0BAA0B,EAC1B,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC5B,yBAAyB,EACzB,uBAAuB,EACvB,gCAAgC,GACnC,MAAM,2BAA2B,CAAC"}
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,mCAAmC,EAAE,MAAM,gDAAgD,CAAC;AACrG,OAAO,EACH,uBAAuB,EACvB,iBAAiB,EACjB,yBAAyB,EACzB,wBAAwB,EACxB,6BAA6B,EAC7B,0BAA0B,EAC1B,yBAAyB,EACzB,yBAAyB,EACzB,kBAAkB,GACrB,MAAM,2BAA2B,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=MemoryBlobBytesStore.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MemoryBlobBytesStore.test.d.ts","sourceRoot":"","sources":["../../src/memory/MemoryBlobBytesStore.test.ts"],"names":[],"mappings":""}
@@ -1,12 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { MemoryBlobBytesStore } from "./MemoryBlobBytesStore.js";
3
- describe("MemoryBlobBytesStore", () => {
4
- it("stores, reads, and deletes blobs", async () => {
5
- const store = new MemoryBlobBytesStore();
6
- await store.write("folder/blob", new Blob(["hello"]));
7
- expect(await (await store.read("folder/blob")).text()).toBe("hello");
8
- await store.delete("folder/blob");
9
- await expect(store.read("folder/blob")).rejects.toThrow('Blob bytes not found for "folder/blob".');
10
- });
11
- });
12
- //# sourceMappingURL=MemoryBlobBytesStore.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"MemoryBlobBytesStore.test.js","sourceRoot":"","sources":["../../src/memory/MemoryBlobBytesStore.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAC9C,MAAM,KAAK,GAAG,IAAI,oBAAoB,EAAE,CAAC;QACzC,MAAM,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAEtD,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAErE,MAAM,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAClC,MAAM,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CACnD,yCAAyC,CAC5C,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
package/lib/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=createLocalCollection.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createLocalCollection.test.d.ts","sourceRoot":"","sources":["../../src/utils/createLocalCollection.test.ts"],"names":[],"mappings":""}