@livestore/common-cf 0.0.0-snapshot-644b60846789438e12ef25590475aba75c7b176d → 0.0.0-snapshot-a77b91f5d94e186cc27b3fbc5a7334fb969707c2

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,25 @@
1
+ import type * as CfTypes from './cf-types.ts';
2
+ export declare namespace HelperTypes {
3
+ type AnyDON = CfTypes.DurableObjectNamespace<any>;
4
+ type DOKeys<T> = {
5
+ [K in keyof T]-?: T[K] extends AnyDON ? K : never;
6
+ }[keyof T];
7
+ /**
8
+ * Helper type to extract DurableObject keys from Env to give consumer type safety.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * type PlatformEnv = {
13
+ * DB: D1Database
14
+ * ADMIN_TOKEN: string
15
+ * SYNC_BACKEND_DO: DurableObjectNamespace<SyncBackendDO>
16
+ * }
17
+ * export default makeWorker<PlatformEnv>({
18
+ * syncBackendBinding: 'SYNC_BACKEND_DO',
19
+ * // ^ (property) syncBackendBinding: "SYNC_BACKEND_DO"
20
+ * });
21
+ */
22
+ export type ExtractDurableObjectKeys<TEnv> = DOKeys<TEnv> extends never ? string : DOKeys<TEnv> & string;
23
+ export {};
24
+ }
25
+ //# sourceMappingURL=helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,eAAe,CAAA;AAE7C,yBAAiB,WAAW,CAAC;IAC3B,KAAK,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAA;IAEjD,KAAK,MAAM,CAAC,CAAC,IAAI;SACd,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK;KAClD,CAAC,MAAM,CAAC,CAAC,CAAA;IAEV;;;;;;;;;;;;;;OAcG;IACH,MAAM,MAAM,wBAAwB,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAA;;CACzG"}
package/dist/helper.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":""}
package/dist/mod.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export type * as CfTypes from './cf-types.ts';
2
2
  export * from './do-rpc/mod.ts';
3
+ export * from './helper.ts';
3
4
  export * from './ws-rpc/ws-rpc-server.ts';
4
5
  //# sourceMappingURL=mod.d.ts.map
package/dist/mod.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,YAAY,KAAK,OAAO,MAAM,eAAe,CAAA;AAC7C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,2BAA2B,CAAA"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,YAAY,KAAK,OAAO,MAAM,eAAe,CAAA;AAC7C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,2BAA2B,CAAA"}
package/dist/mod.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from "./do-rpc/mod.js";
2
+ export * from "./helper.js";
2
3
  export * from "./ws-rpc/ws-rpc-server.js";
3
4
  //# sourceMappingURL=mod.js.map
package/dist/mod.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,2BAA2B,CAAA"}
1
+ {"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,cAAc,2BAA2B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livestore/common-cf",
3
- "version": "0.0.0-snapshot-644b60846789438e12ef25590475aba75c7b176d",
3
+ "version": "0.0.0-snapshot-a77b91f5d94e186cc27b3fbc5a7334fb969707c2",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -9,13 +9,13 @@
9
9
  },
10
10
  "dependencies": {
11
11
  "@cloudflare/workers-types": "4.20250923.0",
12
- "@livestore/common": "0.0.0-snapshot-644b60846789438e12ef25590475aba75c7b176d",
13
- "@livestore/utils": "0.0.0-snapshot-644b60846789438e12ef25590475aba75c7b176d"
12
+ "@livestore/common": "0.0.0-snapshot-a77b91f5d94e186cc27b3fbc5a7334fb969707c2",
13
+ "@livestore/utils": "0.0.0-snapshot-a77b91f5d94e186cc27b3fbc5a7334fb969707c2"
14
14
  },
15
15
  "devDependencies": {
16
16
  "vitest": "3.2.4",
17
17
  "wrangler": "4.38.0",
18
- "@livestore/utils-dev": "0.0.0-snapshot-644b60846789438e12ef25590475aba75c7b176d"
18
+ "@livestore/utils-dev": "0.0.0-snapshot-a77b91f5d94e186cc27b3fbc5a7334fb969707c2"
19
19
  },
20
20
  "files": [
21
21
  "dist",
package/src/helper.ts ADDED
@@ -0,0 +1,26 @@
1
+ import type * as CfTypes from './cf-types.ts'
2
+
3
+ export namespace HelperTypes {
4
+ type AnyDON = CfTypes.DurableObjectNamespace<any>
5
+
6
+ type DOKeys<T> = {
7
+ [K in keyof T]-?: T[K] extends AnyDON ? K : never
8
+ }[keyof T]
9
+
10
+ /**
11
+ * Helper type to extract DurableObject keys from Env to give consumer type safety.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * type PlatformEnv = {
16
+ * DB: D1Database
17
+ * ADMIN_TOKEN: string
18
+ * SYNC_BACKEND_DO: DurableObjectNamespace<SyncBackendDO>
19
+ * }
20
+ * export default makeWorker<PlatformEnv>({
21
+ * syncBackendBinding: 'SYNC_BACKEND_DO',
22
+ * // ^ (property) syncBackendBinding: "SYNC_BACKEND_DO"
23
+ * });
24
+ */
25
+ export type ExtractDurableObjectKeys<TEnv> = DOKeys<TEnv> extends never ? string : DOKeys<TEnv> & string
26
+ }
package/src/mod.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export type * as CfTypes from './cf-types.ts'
2
2
  export * from './do-rpc/mod.ts'
3
+ export * from './helper.ts'
3
4
  export * from './ws-rpc/ws-rpc-server.ts'