@@ -18,32 +18,30 @@ export const DOContainerOptionsSchema = z.object({
1818} ) ;
1919export type DOContainerOptions = z . infer < typeof DOContainerOptionsSchema > ;
2020
21- export const DurableObjectsOptionsSchema = z . object ( {
22- durableObjects : z
23- . record (
24- z . union ( [
25- z . string ( ) ,
26- z . object ( {
27- className : z . string ( ) ,
28- scriptName : z . string ( ) . optional ( ) ,
29- useSQLite : z . boolean ( ) . optional ( ) ,
30- // Allow `uniqueKey` to be customised. We use in Wrangler when setting
31- // up stub Durable Objects that proxy requests to Durable Objects in
32- // another `workerd` process, to ensure the IDs created by the stub
33- // object can be used by the real object too.
34- unsafeUniqueKey : z
35- . union ( [ z . string ( ) , z . literal ( kUnsafeEphemeralUniqueKey ) ] )
36- . optional ( ) ,
37- // Prevents the Durable Object being evicted.
38- unsafePreventEviction : z . boolean ( ) . optional ( ) ,
39- remoteProxyConnectionString : z
40- . custom < RemoteProxyConnectionString > ( )
41- . optional ( ) ,
42- container : z . custom < DOContainerOptions > ( ) . optional ( ) ,
43- } ) ,
44- ] )
45- )
21+ const DurableObject = z . object ( {
22+ className : z . string ( ) ,
23+ scriptName : z . string ( ) . optional ( ) ,
24+ useSQLite : z . boolean ( ) . optional ( ) ,
25+ // Allow `uniqueKey` to be customised. We use in Wrangler when setting
26+ // up stub Durable Objects that proxy requests to Durable Objects in
27+ // another `workerd` process, to ensure the IDs created by the stub
28+ // object can be used by the real object too.
29+ unsafeUniqueKey : z
30+ . union ( [ z . string ( ) , z . literal ( kUnsafeEphemeralUniqueKey ) ] )
31+ . optional ( ) ,
32+ // Prevents the Durable Object being evicted.
33+ unsafePreventEviction : z . boolean ( ) . optional ( ) ,
34+ remoteProxyConnectionString : z
35+ . custom < RemoteProxyConnectionString > ( )
4636 . optional ( ) ,
37+ container : z . custom < DOContainerOptions > ( ) . optional ( ) ,
38+ } ) ;
39+
40+ export const DurableObjectsOptionsSchema = z . object ( {
41+ durableObjects : z . record ( z . union ( [ z . string ( ) , DurableObject ] ) ) . optional ( ) ,
42+ // Not all DOs are configured as bindings! Include these in a different key
43+ // These might just be configured via migrations, but should still be allocated storage for e.g. ctx.exports support
44+ additionalUnboundDurableObjects : z . array ( DurableObject ) . optional ( ) ,
4745} ) ;
4846export const DurableObjectsSharedOptionsSchema = z . object ( {
4947 durableObjectsPersist : PersistenceSchema ,
0 commit comments