@gaganref/confect-server 10.3.1-fork.8 → 10.3.1-fork.81

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 (180) hide show
  1. package/dist/ActionCall.d.ts +30 -0
  2. package/dist/ActionCall.d.ts.map +1 -0
  3. package/dist/ActionCall.js +41 -0
  4. package/dist/ActionCall.js.map +1 -0
  5. package/dist/ActionRunner.d.ts +1 -1
  6. package/dist/ActionRunner.d.ts.map +1 -1
  7. package/dist/ActionRunner.js +3 -3
  8. package/dist/ActionRunner.js.map +1 -1
  9. package/dist/AiGatewayDecisionClient.js +1 -1
  10. package/dist/AiGatewayLanguageClient.js +1 -1
  11. package/dist/Auth.d.ts +31 -2
  12. package/dist/Auth.d.ts.map +1 -1
  13. package/dist/Auth.js +23 -3
  14. package/dist/Auth.js.map +1 -1
  15. package/dist/Callback.d.ts +1 -1
  16. package/dist/Callback.d.ts.map +1 -1
  17. package/dist/Callback.js +6 -6
  18. package/dist/Callback.js.map +1 -1
  19. package/dist/ConvexConfigProvider.js +2 -2
  20. package/dist/ConvexFunctionDefinitions.d.ts.map +1 -1
  21. package/dist/ConvexFunctionDefinitions.js +4 -4
  22. package/dist/ConvexFunctionDefinitions.js.map +1 -1
  23. package/dist/ConvexLogger.js +1 -1
  24. package/dist/CronJobs.d.ts.map +1 -1
  25. package/dist/CronJobs.js +7 -6
  26. package/dist/CronJobs.js.map +1 -1
  27. package/dist/DatabaseSchema.js +2 -2
  28. package/dist/DatabaseWriter.d.ts +36 -2
  29. package/dist/DatabaseWriter.d.ts.map +1 -1
  30. package/dist/DatabaseWriter.js +55 -8
  31. package/dist/DatabaseWriter.js.map +1 -1
  32. package/dist/ExecutionMetadata.js +1 -1
  33. package/dist/FunctionImpl.js +2 -2
  34. package/dist/FunctionRegistryItem.d.ts +1 -0
  35. package/dist/FunctionRegistryItem.d.ts.map +1 -1
  36. package/dist/FunctionRegistryItem.js +2 -1
  37. package/dist/FunctionRegistryItem.js.map +1 -1
  38. package/dist/GroupImpl.d.ts +21 -2
  39. package/dist/GroupImpl.d.ts.map +1 -1
  40. package/dist/GroupImpl.js +21 -22
  41. package/dist/GroupImpl.js.map +1 -1
  42. package/dist/GroupRegistry.d.ts +1 -0
  43. package/dist/GroupRegistry.d.ts.map +1 -1
  44. package/dist/GroupRegistry.js +10 -3
  45. package/dist/GroupRegistry.js.map +1 -1
  46. package/dist/Handler.d.ts +8 -4
  47. package/dist/Handler.d.ts.map +1 -1
  48. package/dist/Handler.js.map +1 -1
  49. package/dist/HttpRouter.d.ts +3 -0
  50. package/dist/HttpRouter.d.ts.map +1 -1
  51. package/dist/HttpRouter.js +29 -10
  52. package/dist/HttpRouter.js.map +1 -1
  53. package/dist/MiddlewareImpl.js +1 -1
  54. package/dist/MountInit.d.ts +31 -0
  55. package/dist/MountInit.d.ts.map +1 -0
  56. package/dist/MountInit.js +49 -0
  57. package/dist/MountInit.js.map +1 -0
  58. package/dist/MutationRunner.d.ts +1 -1
  59. package/dist/MutationRunner.d.ts.map +1 -1
  60. package/dist/MutationRunner.js +3 -3
  61. package/dist/MutationRunner.js.map +1 -1
  62. package/dist/MutationTransactionContext.d.ts.map +1 -1
  63. package/dist/MutationTransactionContext.js +4 -3
  64. package/dist/MutationTransactionContext.js.map +1 -1
  65. package/dist/OfficialComponent.d.ts +60 -0
  66. package/dist/OfficialComponent.d.ts.map +1 -0
  67. package/dist/OfficialComponent.js +72 -0
  68. package/dist/OfficialComponent.js.map +1 -0
  69. package/dist/OrderedQuery.d.ts +4 -5
  70. package/dist/OrderedQuery.d.ts.map +1 -1
  71. package/dist/OrderedQuery.js.map +1 -1
  72. package/dist/QueryInitializer.js +2 -2
  73. package/dist/QueryRunner.js +2 -2
  74. package/dist/QueryStream.d.ts +120 -12
  75. package/dist/QueryStream.d.ts.map +1 -1
  76. package/dist/QueryStream.js +143 -41
  77. package/dist/QueryStream.js.map +1 -1
  78. package/dist/QueryStreamCursor.js +1 -1
  79. package/dist/QueryStreamIndexPrefix.js +1 -1
  80. package/dist/QueryStreamIndexRange.js +2 -2
  81. package/dist/QueryStreamKey.js +1 -1
  82. package/dist/QueryStreamKeyBounds.js +2 -2
  83. package/dist/QueryStreamKeyLayout.js +2 -2
  84. package/dist/QueryStreamKeyValues.js +2 -2
  85. package/dist/QueryStreamPagination.js +1 -1
  86. package/dist/QueryStreamReadBudget.d.ts +3 -2
  87. package/dist/QueryStreamReadBudget.d.ts.map +1 -1
  88. package/dist/QueryStreamReadBudget.js +8 -5
  89. package/dist/QueryStreamReadBudget.js.map +1 -1
  90. package/dist/QueryTransactionContext.js +2 -2
  91. package/dist/RegisteredConvexFunction.d.ts +10 -5
  92. package/dist/RegisteredConvexFunction.d.ts.map +1 -1
  93. package/dist/RegisteredConvexFunction.js +45 -29
  94. package/dist/RegisteredConvexFunction.js.map +1 -1
  95. package/dist/RegisteredFunction.d.ts +39 -22
  96. package/dist/RegisteredFunction.d.ts.map +1 -1
  97. package/dist/RegisteredFunction.js +155 -42
  98. package/dist/RegisteredFunction.js.map +1 -1
  99. package/dist/RegisteredNodeFunction.d.ts +1 -1
  100. package/dist/RegisteredNodeFunction.d.ts.map +1 -1
  101. package/dist/RegisteredNodeFunction.js +10 -6
  102. package/dist/RegisteredNodeFunction.js.map +1 -1
  103. package/dist/RegistryItems.d.ts +7 -0
  104. package/dist/RegistryItems.d.ts.map +1 -1
  105. package/dist/RegistryItems.js +8 -3
  106. package/dist/RegistryItems.js.map +1 -1
  107. package/dist/RequestMetadata.js +1 -1
  108. package/dist/Scheduler.d.ts +1 -1
  109. package/dist/Scheduler.d.ts.map +1 -1
  110. package/dist/Scheduler.js +14 -13
  111. package/dist/Scheduler.js.map +1 -1
  112. package/dist/Storage.js +1 -1
  113. package/dist/StorageActionWriter.js +1 -1
  114. package/dist/StorageReader.js +1 -1
  115. package/dist/StorageWriter.js +1 -1
  116. package/dist/Table.d.ts +6 -6
  117. package/dist/Table.d.ts.map +1 -1
  118. package/dist/TableInfo.d.ts +1 -1
  119. package/dist/TableInfo.d.ts.map +1 -1
  120. package/dist/TableInfo.js.map +1 -1
  121. package/dist/TransactionMetadata.js +1 -1
  122. package/dist/VectorSearch.js +1 -1
  123. package/dist/index.d.ts +3 -0
  124. package/dist/index.d.ts.map +1 -1
  125. package/dist/index.js +21 -18
  126. package/dist/internal/AiGatewayDecisionClient.js +1 -1
  127. package/dist/internal/AiGatewayLanguageClient.js +1 -1
  128. package/dist/internal/AiGatewayServiceToken.js +1 -1
  129. package/dist/internal/DocumentPatch.d.ts +16 -0
  130. package/dist/internal/DocumentPatch.d.ts.map +1 -0
  131. package/dist/internal/DocumentPatch.js +36 -0
  132. package/dist/internal/DocumentPatch.js.map +1 -0
  133. package/dist/internal/httpBody.d.ts +13 -0
  134. package/dist/internal/httpBody.d.ts.map +1 -0
  135. package/dist/internal/httpBody.js +47 -0
  136. package/dist/internal/httpBody.js.map +1 -0
  137. package/dist/internal/httpOptions.d.ts +4 -0
  138. package/dist/internal/httpOptions.d.ts.map +1 -0
  139. package/dist/internal/httpOptions.js +83 -0
  140. package/dist/internal/httpOptions.js.map +1 -0
  141. package/dist/internal/observability.d.ts +5 -0
  142. package/dist/internal/observability.d.ts.map +1 -0
  143. package/dist/internal/observability.js +21 -0
  144. package/dist/internal/observability.js.map +1 -0
  145. package/dist/internal/reservedArgument.d.ts +8 -0
  146. package/dist/internal/reservedArgument.d.ts.map +1 -0
  147. package/dist/internal/reservedArgument.js +30 -0
  148. package/dist/internal/reservedArgument.js.map +1 -0
  149. package/package.json +5 -5
  150. package/src/ActionCall.ts +83 -0
  151. package/src/ActionRunner.ts +3 -2
  152. package/src/Auth.ts +49 -1
  153. package/src/Callback.ts +3 -2
  154. package/src/ConvexFunctionDefinitions.ts +2 -1
  155. package/src/CronJobs.ts +2 -1
  156. package/src/DatabaseWriter.ts +183 -25
  157. package/src/FunctionRegistryItem.ts +4 -0
  158. package/src/GroupImpl.ts +61 -8
  159. package/src/GroupRegistry.ts +7 -3
  160. package/src/Handler.ts +21 -5
  161. package/src/HttpRouter.ts +69 -5
  162. package/src/MountInit.ts +80 -0
  163. package/src/MutationRunner.ts +3 -2
  164. package/src/MutationTransactionContext.ts +2 -1
  165. package/src/OfficialComponent.ts +168 -0
  166. package/src/OrderedQuery.ts +4 -5
  167. package/src/QueryStream.ts +391 -61
  168. package/src/QueryStreamReadBudget.ts +19 -6
  169. package/src/RegisteredConvexFunction.ts +35 -2
  170. package/src/RegisteredFunction.ts +251 -45
  171. package/src/RegisteredNodeFunction.ts +11 -1
  172. package/src/RegistryItems.ts +31 -0
  173. package/src/Scheduler.ts +17 -19
  174. package/src/TableInfo.ts +2 -1
  175. package/src/index.ts +3 -0
  176. package/src/internal/DocumentPatch.ts +87 -0
  177. package/src/internal/httpBody.ts +72 -0
  178. package/src/internal/httpOptions.ts +154 -0
  179. package/src/internal/observability.ts +27 -0
  180. package/src/internal/reservedArgument.ts +56 -0
@@ -1 +1 @@
1
- {"version":3,"file":"RegisteredNodeFunction.js","names":["GroupRegistry.make","FunctionRegistryItem.isFunctionRegistryItem","ResolvedMiddleware.resolve","RegisteredFunction.actionFunctionBase","RegisteredFunction.actionLayer"],"sources":["../src/RegisteredNodeFunction.ts"],"sourcesContent":["import * as NodeServices from \"@effect/platform-node/NodeServices\";\nimport {\n actionGeneric,\n type DefaultFunctionArgs,\n type FunctionVisibility,\n internalActionGeneric,\n} from \"convex/server\";\nimport type { Effect } from \"effect\";\nimport type { Schema } from \"effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Match from \"effect/Match\";\nimport type * as DatabaseSchema from \"./DatabaseSchema.js\";\nimport * as RegisteredFunction from \"./RegisteredFunction.js\";\nimport * as FunctionRegistryItem from \"./FunctionRegistryItem.js\";\nimport * as ResolvedMiddleware from \"./ResolvedMiddleware.js\";\nimport * as GroupRegistry from \"./GroupRegistry.js\";\nimport type * as GroupSpec from \"@confect/core/GroupSpec\";\nimport type * as GroupImpl from \"./GroupImpl.js\";\nimport type * as RegisteredFunctions from \"./RegisteredFunctions.js\";\nimport { mapLeaves } from \"./internal/utils.js\";\n\nexport const buildForGroup = <Group extends GroupSpec.AnyWithProps>(\n databaseSchema: DatabaseSchema.AnyWithProps,\n groupLayer: Layer.Layer<GroupImpl.GroupImpl<\"Finalized\">>,\n): RegisteredFunctions.RegisteredFunctionsForGroupSpec<Group> => {\n const { functionRegistryItems, middlewareRegistryItems } =\n GroupRegistry.make(groupLayer);\n return mapLeaves<FunctionRegistryItem.AnyWithProps, RegisteredFunction.Any>(\n functionRegistryItems as {\n [key: string]: FunctionRegistryItem.AnyWithProps;\n },\n FunctionRegistryItem.isFunctionRegistryItem,\n (item) =>\n Match.value(item).pipe(\n Match.tag(\"Convex\", ({ handler }) => handler),\n Match.tag(\"Confect\", (confect) =>\n make(\n databaseSchema,\n confect,\n ResolvedMiddleware.resolve(confect, middlewareRegistryItems),\n ),\n ),\n Match.exhaustive,\n ),\n ) as RegisteredFunctions.RegisteredFunctionsForGroupSpec<Group>;\n};\n\nexport const make = (\n databaseSchema: DatabaseSchema.AnyWithProps,\n item: FunctionRegistryItem.ConfectFunctionRegistryItem,\n resolvedMiddlewares: ReadonlyArray<ResolvedMiddleware.ResolvedMiddleware> = [],\n): RegisteredFunction.Any => {\n const genericFunction = Match.value(item.functionVisibility).pipe(\n Match.when(\"public\", () => actionGeneric),\n Match.when(\"internal\", () => internalActionGeneric),\n Match.exhaustive,\n );\n\n return genericFunction(\n nodeActionFunction(databaseSchema, {\n name: item.name,\n functionVisibility: item.functionVisibility,\n args: item.args,\n returns: item.returns,\n error: item.error,\n handler: item.handler,\n resolvedMiddlewares,\n }),\n );\n};\n\nconst nodeActionFunction = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Args,\n ConvexArgs extends DefaultFunctionArgs,\n Returns,\n ConvexReturns,\n E,\n>(\n databaseSchema: DatabaseSchema_,\n {\n name,\n functionVisibility,\n args,\n returns,\n error,\n handler,\n resolvedMiddlewares,\n }: {\n name: string;\n functionVisibility: FunctionVisibility;\n args: Schema.Codec<Args, ConvexArgs>;\n returns: Schema.Codec<Returns, ConvexReturns>;\n error: Schema.Codec<any, any> | undefined;\n handler: (\n a: Args,\n ) => Effect.Effect<\n Returns,\n E,\n | RegisteredFunction.ActionServices<DatabaseSchema_>\n | NodeServices.NodeServices\n >;\n resolvedMiddlewares: ReadonlyArray<ResolvedMiddleware.ResolvedMiddleware>;\n },\n) =>\n RegisteredFunction.actionFunctionBase({\n scope: databaseSchema.target.scope,\n name,\n functionVisibility,\n args,\n returns,\n error,\n handler,\n resolvedMiddlewares,\n createLayer: (ctx) =>\n Layer.mergeAll(\n RegisteredFunction.actionLayer(databaseSchema, ctx),\n NodeServices.layer,\n ),\n });\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAa,iBACX,gBACA,eAC+D;CAC/D,MAAM,EAAE,uBAAuB,4BAC7BA,OAAmB,UAAU;CAC/B,OAAO,UACL,uBAGAC,yBACC,SACC,MAAM,MAAM,IAAI,CAAC,CAAC,KAChB,MAAM,IAAI,WAAW,EAAE,cAAc,OAAO,GAC5C,MAAM,IAAI,YAAY,YACpB,KACE,gBACA,SACAC,QAA2B,SAAS,uBAAuB,CAC7D,CACF,GACA,MAAM,UACR,CACJ;AACF;AAEA,MAAa,QACX,gBACA,MACA,sBAA4E,CAAC,MAClD;CAO3B,OANwB,MAAM,MAAM,KAAK,kBAAkB,CAAC,CAAC,KAC3D,MAAM,KAAK,gBAAgB,aAAa,GACxC,MAAM,KAAK,kBAAkB,qBAAqB,GAClD,MAAM,UAGa,CAAC,CACpB,mBAAmB,gBAAgB;EACjC,MAAM,KAAK;EACX,oBAAoB,KAAK;EACzB,MAAM,KAAK;EACX,SAAS,KAAK;EACd,OAAO,KAAK;EACZ,SAAS,KAAK;EACd;CACF,CAAC,CACH;AACF;AAEA,MAAM,sBAQJ,gBACA,EACE,MACA,oBACA,MACA,SACA,OACA,SACA,0BAkBFC,mBAAsC;CACpC,OAAO,eAAe,OAAO;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA,cAAc,QACZ,MAAM,SACJC,YAA+B,gBAAgB,GAAG,GAClD,aAAa,KACf;AACJ,CAAC"}
1
+ {"version":3,"file":"RegisteredNodeFunction.js","names":["GroupRegistry.make","FunctionRegistryItem.isFunctionRegistryItem","ResolvedMiddleware.resolve","RegisteredFunction.actionFunctionBase","RegisteredFunction.actionLayer"],"sources":["../src/RegisteredNodeFunction.ts"],"sourcesContent":["import * as NodeServices from \"@effect/platform-node/NodeServices\";\nimport {\n actionGeneric,\n type DefaultFunctionArgs,\n type FunctionVisibility,\n internalActionGeneric,\n} from \"convex/server\";\nimport type { Effect } from \"effect\";\nimport type { Schema } from \"effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Match from \"effect/Match\";\nimport type * as DatabaseSchema from \"./DatabaseSchema.js\";\nimport * as RegisteredFunction from \"./RegisteredFunction.js\";\nimport * as FunctionRegistryItem from \"./FunctionRegistryItem.js\";\nimport * as ResolvedMiddleware from \"./ResolvedMiddleware.js\";\nimport * as GroupRegistry from \"./GroupRegistry.js\";\nimport type * as GroupSpec from \"@confect/core/GroupSpec\";\nimport type * as GroupImpl from \"./GroupImpl.js\";\nimport type * as RegisteredFunctions from \"./RegisteredFunctions.js\";\nimport { mapLeaves } from \"./internal/utils.js\";\n\nexport const buildForGroup = <Group extends GroupSpec.AnyWithProps>(\n databaseSchema: DatabaseSchema.AnyWithProps,\n groupLayer: Layer.Layer<GroupImpl.GroupImpl<\"Finalized\">>,\n): RegisteredFunctions.RegisteredFunctionsForGroupSpec<Group> => {\n const { functionRegistryItems, middlewareRegistryItems, observability } =\n GroupRegistry.make(groupLayer);\n return mapLeaves<FunctionRegistryItem.AnyWithProps, RegisteredFunction.Any>(\n functionRegistryItems as {\n [key: string]: FunctionRegistryItem.AnyWithProps;\n },\n FunctionRegistryItem.isFunctionRegistryItem,\n (item) =>\n Match.value(item).pipe(\n Match.tag(\"Convex\", ({ handler }) => handler),\n Match.tag(\"Confect\", (confect) =>\n make(\n databaseSchema,\n confect,\n ResolvedMiddleware.resolve(confect, middlewareRegistryItems),\n observability,\n ),\n ),\n Match.exhaustive,\n ),\n ) as RegisteredFunctions.RegisteredFunctionsForGroupSpec<Group>;\n};\n\nexport const make = (\n databaseSchema: DatabaseSchema.AnyWithProps,\n item: FunctionRegistryItem.ConfectFunctionRegistryItem,\n resolvedMiddlewares: ReadonlyArray<ResolvedMiddleware.ResolvedMiddleware> = [],\n observability?: Layer.Layer<never>,\n): RegisteredFunction.Any => {\n const genericFunction = Match.value(item.functionVisibility).pipe(\n Match.when(\"public\", () => actionGeneric),\n Match.when(\"internal\", () => internalActionGeneric),\n Match.exhaustive,\n );\n\n return genericFunction(\n nodeActionFunction(databaseSchema, {\n name: item.name,\n reservedArgument: item.reservedArgument,\n observability,\n functionVisibility: item.functionVisibility,\n args: item.args,\n returns: item.returns,\n error: item.error,\n handler: item.handler,\n resolvedMiddlewares,\n }),\n );\n};\n\nconst nodeActionFunction = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Args,\n ConvexArgs extends DefaultFunctionArgs,\n Returns,\n ConvexReturns,\n E,\n>(\n databaseSchema: DatabaseSchema_,\n {\n name,\n functionVisibility,\n args,\n returns,\n error,\n handler,\n resolvedMiddlewares,\n observability,\n reservedArgument,\n }: {\n name: string;\n reservedArgument?: string | undefined;\n functionVisibility: FunctionVisibility;\n args: Schema.Codec<Args, ConvexArgs>;\n returns: Schema.Codec<Returns, ConvexReturns>;\n error: Schema.Codec<any, any> | undefined;\n handler: (\n a: Args,\n ) => Effect.Effect<\n Returns,\n E,\n | RegisteredFunction.ActionServices<DatabaseSchema_>\n | NodeServices.NodeServices\n >;\n resolvedMiddlewares: ReadonlyArray<ResolvedMiddleware.ResolvedMiddleware>;\n observability?: Layer.Layer<never> | undefined;\n },\n) =>\n RegisteredFunction.actionFunctionBase({\n scope: databaseSchema.target.scope,\n name,\n functionVisibility,\n args,\n returns,\n error,\n handler,\n resolvedMiddlewares,\n observability,\n reservedArgument,\n createLayer: (ctx) =>\n Layer.mergeAll(\n RegisteredFunction.actionLayer(databaseSchema, ctx),\n NodeServices.layer,\n ),\n });\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAa,iBACX,gBACA,eAC+D;CAC/D,MAAM,EAAE,uBAAuB,yBAAyB,kBACtDA,OAAmB,UAAU;CAC/B,OAAO,UACL,uBAGAC,yBACC,SACC,MAAM,MAAM,IAAI,CAAC,CAAC,KAChB,MAAM,IAAI,WAAW,EAAE,cAAc,OAAO,GAC5C,MAAM,IAAI,YAAY,YACpB,KACE,gBACA,SACAC,QAA2B,SAAS,uBAAuB,GAC3D,aACF,CACF,GACA,MAAM,UACR,CACJ;AACF;AAEA,MAAa,QACX,gBACA,MACA,sBAA4E,CAAC,GAC7E,kBAC2B;CAO3B,OANwB,MAAM,MAAM,KAAK,kBAAkB,CAAC,CAAC,KAC3D,MAAM,KAAK,gBAAgB,aAAa,GACxC,MAAM,KAAK,kBAAkB,qBAAqB,GAClD,MAAM,UAGa,CAAC,CACpB,mBAAmB,gBAAgB;EACjC,MAAM,KAAK;EACX,kBAAkB,KAAK;EACvB;EACA,oBAAoB,KAAK;EACzB,MAAM,KAAK;EACX,SAAS,KAAK;EACd,OAAO,KAAK;EACZ,SAAS,KAAK;EACd;CACF,CAAC,CACH;AACF;AAEA,MAAM,sBAQJ,gBACA,EACE,MACA,oBACA,MACA,SACA,OACA,SACA,qBACA,eACA,uBAoBFC,mBAAsC;CACpC,OAAO,eAAe,OAAO;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,cAAc,QACZ,MAAM,SACJC,YAA+B,gBAAgB,GAAG,GAClD,aAAa,KACf;AACJ,CAAC"}
@@ -18,4 +18,11 @@ export declare const functionNames: (items: RegistryItems) => ReadonlyArray<stri
18
18
  * (stored under `middleware:<key>` entries by `MiddlewareImpl`).
19
19
  */
20
20
  export declare const middlewareKeys: (items: RegistryItems) => ReadonlyArray<string>;
21
+ export interface MissingMiddleware {
22
+ readonly functionName: string;
23
+ readonly middlewareKey: string;
24
+ }
25
+ export declare const missingRequired: (items: RegistryItems, required: ReadonlyArray<{
26
+ readonly key: string;
27
+ }>, groupPath?: string) => ReadonlyArray<MissingMiddleware>;
21
28
  //# sourceMappingURL=RegistryItems.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RegistryItems.d.ts","sourceRoot":"","sources":["../src/RegistryItems.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,UAAW,aAAa,KAAG,aAAa,CAAC,MAAM,CAOtE,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,cAAc,UAAW,aAAa,KAAG,aAAa,CAAC,MAAM,CAKvE,CAAC"}
1
+ {"version":3,"file":"RegistryItems.d.ts","sourceRoot":"","sources":["../src/RegistryItems.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,UAAW,aAAa,KAAG,aAAa,CAAC,MAAM,CAOtE,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,cAAc,UAAW,aAAa,KAAG,aAAa,CAAC,MAAM,CAKvE,CAAC;AAEJ,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,eAAO,MAAM,eAAe,UACnB,aAAa,YACV,aAAa,CAAC;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,yBAEhD,aAAa,CAAC,iBAAiB,CAoB7B,CAAC"}
@@ -1,13 +1,14 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import { isMiddlewareRegistryItem } from "./MiddlewareRegistryItem.js";
3
3
  import { isFunctionRegistryItem } from "./FunctionRegistryItem.js";
4
- import { pipe } from "effect/Function";
5
4
  import * as Array from "effect/Array";
6
5
  import * as Record from "effect/Record";
6
+ import { pipe } from "effect/Function";
7
7
  //#region src/RegistryItems.ts
8
8
  var RegistryItems_exports = /* @__PURE__ */ __exportAll({
9
9
  functionNames: () => functionNames,
10
- middlewareKeys: () => middlewareKeys
10
+ middlewareKeys: () => middlewareKeys,
11
+ missingRequired: () => missingRequired
11
12
  });
12
13
  /**
13
14
  * The names of the function-shaped entries in a group's (flat, isolated)
@@ -21,7 +22,11 @@ const functionNames = (items) => pipe(Record.toEntries(items), Array.filter(([,
21
22
  * (stored under `middleware:<key>` entries by `MiddlewareImpl`).
22
23
  */
23
24
  const middlewareKeys = (items) => pipe(Record.values(items), Array.filter(isMiddlewareRegistryItem), Array.map((item) => item.middlewareSpec.key));
25
+ const missingRequired = (items, required, groupPath = "") => Object.entries(items).sort(([left], [right]) => left.localeCompare(right)).flatMap(([functionName, value]) => isFunctionRegistryItem(value) ? required.flatMap(({ key }) => value._tag === "Confect" && value.middlewareAttachments.some(({ spec }) => spec.key === key) ? [] : [{
26
+ functionName: groupPath === "" ? functionName : `${groupPath}.${functionName}`,
27
+ middlewareKey: key
28
+ }]) : []);
24
29
  //#endregion
25
- export { RegistryItems_exports, functionNames, middlewareKeys };
30
+ export { RegistryItems_exports, functionNames, middlewareKeys, missingRequired };
26
31
 
27
32
  //# sourceMappingURL=RegistryItems.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RegistryItems.js","names":["FunctionRegistryItem.isFunctionRegistryItem","MiddlewareRegistryItem.isMiddlewareRegistryItem"],"sources":["../src/RegistryItems.ts"],"sourcesContent":["import * as Array from \"effect/Array\";\nimport { pipe } from \"effect/Function\";\nimport * as Record from \"effect/Record\";\nimport * as FunctionRegistryItem from \"./FunctionRegistryItem.js\";\nimport * as MiddlewareRegistryItem from \"./MiddlewareRegistryItem.js\";\n\n/**\n * Runtime tree that mirrors a `Spec`'s group structure. Values remain unknown\n * at this boundary so producers and consumers can narrow branches and registry\n * items as needed.\n */\nexport interface RegistryItems {\n readonly [key: string]: unknown;\n}\n\n/**\n * The names of the function-shaped entries in a group's (flat, isolated)\n * registry. `FunctionImpl.make` registers each function under a single-segment\n * key, so the registry built for one group contains exactly that group's\n * functions at the top level.\n */\nexport const functionNames = (items: RegistryItems): ReadonlyArray<string> =>\n pipe(\n Record.toEntries(items),\n Array.filter(([, value]) =>\n FunctionRegistryItem.isFunctionRegistryItem(value),\n ),\n Array.map(([name]) => name),\n );\n\n/**\n * The keys of the middleware implementations registered into a group's registry\n * (stored under `middleware:<key>` entries by `MiddlewareImpl`).\n */\nexport const middlewareKeys = (items: RegistryItems): ReadonlyArray<string> =>\n pipe(\n Record.values(items),\n Array.filter(MiddlewareRegistryItem.isMiddlewareRegistryItem),\n Array.map((item) => item.middlewareSpec.key),\n );\n"],"mappings":";;;;;;;;;;;;;;;;;AAqBA,MAAa,iBAAiB,UAC5B,KACE,OAAO,UAAU,KAAK,GACtB,MAAM,QAAQ,GAAG,WACfA,uBAA4C,KAAK,CACnD,GACA,MAAM,KAAK,CAAC,UAAU,IAAI,CAC5B;;;;;AAMF,MAAa,kBAAkB,UAC7B,KACE,OAAO,OAAO,KAAK,GACnB,MAAM,OAAOC,wBAA+C,GAC5D,MAAM,KAAK,SAAS,KAAK,eAAe,GAAG,CAC7C"}
1
+ {"version":3,"file":"RegistryItems.js","names":["FunctionRegistryItem.isFunctionRegistryItem","MiddlewareRegistryItem.isMiddlewareRegistryItem"],"sources":["../src/RegistryItems.ts"],"sourcesContent":["import * as Array from \"effect/Array\";\nimport { pipe } from \"effect/Function\";\nimport * as Record from \"effect/Record\";\nimport * as FunctionRegistryItem from \"./FunctionRegistryItem.js\";\nimport * as MiddlewareRegistryItem from \"./MiddlewareRegistryItem.js\";\n\n/**\n * Runtime tree that mirrors a `Spec`'s group structure. Values remain unknown\n * at this boundary so producers and consumers can narrow branches and registry\n * items as needed.\n */\nexport interface RegistryItems {\n readonly [key: string]: unknown;\n}\n\n/**\n * The names of the function-shaped entries in a group's (flat, isolated)\n * registry. `FunctionImpl.make` registers each function under a single-segment\n * key, so the registry built for one group contains exactly that group's\n * functions at the top level.\n */\nexport const functionNames = (items: RegistryItems): ReadonlyArray<string> =>\n pipe(\n Record.toEntries(items),\n Array.filter(([, value]) =>\n FunctionRegistryItem.isFunctionRegistryItem(value),\n ),\n Array.map(([name]) => name),\n );\n\n/**\n * The keys of the middleware implementations registered into a group's registry\n * (stored under `middleware:<key>` entries by `MiddlewareImpl`).\n */\nexport const middlewareKeys = (items: RegistryItems): ReadonlyArray<string> =>\n pipe(\n Record.values(items),\n Array.filter(MiddlewareRegistryItem.isMiddlewareRegistryItem),\n Array.map((item) => item.middlewareSpec.key),\n );\n\nexport interface MissingMiddleware {\n readonly functionName: string;\n readonly middlewareKey: string;\n}\n\nexport const missingRequired = (\n items: RegistryItems,\n required: ReadonlyArray<{ readonly key: string }>,\n groupPath = \"\",\n): ReadonlyArray<MissingMiddleware> =>\n Object.entries(items)\n .sort(([left], [right]) => left.localeCompare(right))\n .flatMap(([functionName, value]) =>\n FunctionRegistryItem.isFunctionRegistryItem(value)\n ? required.flatMap(({ key }) =>\n value._tag === \"Confect\" &&\n value.middlewareAttachments.some(({ spec }) => spec.key === key)\n ? []\n : [\n {\n functionName:\n groupPath === \"\"\n ? functionName\n : `${groupPath}.${functionName}`,\n middlewareKey: key,\n },\n ],\n )\n : [],\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqBA,MAAa,iBAAiB,UAC5B,KACE,OAAO,UAAU,KAAK,GACtB,MAAM,QAAQ,GAAG,WACfA,uBAA4C,KAAK,CACnD,GACA,MAAM,KAAK,CAAC,UAAU,IAAI,CAC5B;;;;;AAMF,MAAa,kBAAkB,UAC7B,KACE,OAAO,OAAO,KAAK,GACnB,MAAM,OAAOC,wBAA+C,GAC5D,MAAM,KAAK,SAAS,KAAK,eAAe,GAAG,CAC7C;AAOF,MAAa,mBACX,OACA,UACA,YAAY,OAEZ,OAAO,QAAQ,KAAK,CAAC,CAClB,MAAM,CAAC,OAAO,CAAC,WAAW,KAAK,cAAc,KAAK,CAAC,CAAC,CACpD,SAAS,CAAC,cAAc,WACvBD,uBAA4C,KAAK,IAC7C,SAAS,SAAS,EAAE,UAClB,MAAM,SAAS,aACf,MAAM,sBAAsB,MAAM,EAAE,WAAW,KAAK,QAAQ,GAAG,IAC3D,CAAC,IACD,CACE;CACE,cACE,cAAc,KACV,eACA,GAAG,UAAU,GAAG;CACtB,eAAe;AACjB,CACF,CACN,IACA,CAAC,CACP"}
@@ -1,7 +1,7 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import * as Context from "effect/Context";
3
- import * as Layer from "effect/Layer";
4
3
  import * as Effect from "effect/Effect";
4
+ import * as Layer from "effect/Layer";
5
5
  //#region src/RequestMetadata.ts
6
6
  var RequestMetadata_exports = /* @__PURE__ */ __exportAll({
7
7
  RequestMetadata: () => RequestMetadata,
@@ -1,5 +1,5 @@
1
1
  import type * as IdScope from "@confect/core/IdScope";
2
- import { Ref } from "@confect/core";
2
+ import type { Ref } from "@confect/core";
3
3
  import type { GenericId } from "@confect/core/GenericId";
4
4
  import type { Scheduler as ConvexScheduler } from "convex/server";
5
5
  import type { GenericId as ConvexGenericId } from "convex/values";
@@ -1 +1 @@
1
- {"version":3,"file":"Scheduler.d.ts","sourceRoot":"","sources":["../src/Scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,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S,GACT;IAAE,QAAQ,CAAC,kBAAkB,EAAE,KAAK,CAAA;CAAE,CAAC;AAE3C,eAAO,MAAM,QAAQ,GACnB,KAAK,SAAS,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,OACxC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CACN,CAAC;AAE/C,eAAO,MAAM,KAAK,GAAI,KAAK,SAAS,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,aACpD,eAAe,WACjB,KAAK,+CAMb,CAAC"}
package/dist/Scheduler.js CHANGED
@@ -1,10 +1,11 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
+ import { encodeArgs } from "./internal/reservedArgument.js";
2
3
  import * as Context from "effect/Context";
3
- import * as Layer from "effect/Layer";
4
4
  import * as Effect from "effect/Effect";
5
- import * as Duration from "effect/Duration";
6
- import { Ref } from "@confect/core";
5
+ import * as Layer from "effect/Layer";
6
+ import { getFunctionReference } from "@confect/core/RefInternal";
7
7
  import * as DateTime from "effect/DateTime";
8
+ import * as Duration from "effect/Duration";
8
9
  //#region src/Scheduler.ts
9
10
  var Scheduler_exports = /* @__PURE__ */ __exportAll({
10
11
  Scheduler: () => Scheduler,
@@ -13,18 +14,18 @@ var Scheduler_exports = /* @__PURE__ */ __exportAll({
13
14
  });
14
15
  const make = (scheduler) => ({
15
16
  cancel: (id) => Effect.promise(() => scheduler.cancel(id)),
16
- runAfter: (delay, ref, ...args) => {
17
+ runAfter: Effect.fn("Scheduler.runAfter")(function* (delay, ref, ...args) {
17
18
  const delayMs = Duration.toMillis(delay);
18
- const functionReference = Ref.getFunctionReference(ref);
19
- const encodedArgs = Ref.encodeArgsSync(ref, args[0] ?? {});
20
- return Effect.promise(() => scheduler.runAfter(delayMs, functionReference, encodedArgs));
21
- },
22
- runAt: (dateTime, ref, ...args) => {
19
+ const functionReference = getFunctionReference(ref);
20
+ const encodedArgs = yield* encodeArgs(ref, args[0] ?? {});
21
+ return yield* Effect.promise(() => scheduler.runAfter(delayMs, functionReference, encodedArgs));
22
+ }),
23
+ runAt: Effect.fn("Scheduler.runAt")(function* (dateTime, ref, ...args) {
23
24
  const timestamp = DateTime.toEpochMillis(dateTime);
24
- const functionReference = Ref.getFunctionReference(ref);
25
- const encodedArgs = Ref.encodeArgsSync(ref, args[0] ?? {});
26
- return Effect.promise(() => scheduler.runAt(timestamp, functionReference, encodedArgs));
27
- }
25
+ const functionReference = getFunctionReference(ref);
26
+ const encodedArgs = yield* encodeArgs(ref, args[0] ?? {});
27
+ return yield* Effect.promise(() => scheduler.runAt(timestamp, functionReference, encodedArgs));
28
+ })
28
29
  });
29
30
  const Scheduler = Context.Service("@confect/server/Scheduler");
30
31
  const forScope = () => Context.Service("@confect/server/Scheduler");
@@ -1 +1 @@
1
- {"version":3,"file":"Scheduler.js","names":[],"sources":["../src/Scheduler.ts"],"sourcesContent":["import type * as IdScope from \"@confect/core/IdScope\";\nimport { Ref } from \"@confect/core\";\nimport type { GenericId } from \"@confect/core/GenericId\";\nimport type { Scheduler as ConvexScheduler } from \"convex/server\";\nimport type { GenericId as ConvexGenericId } from \"convex/values\";\nimport * as Context from \"effect/Context\";\nimport * as DateTime from \"effect/DateTime\";\nimport * as Duration from \"effect/Duration\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\n\nconst make = (scheduler: ConvexScheduler) => ({\n cancel: (id: ConvexGenericId<\"_scheduled_functions\">) =>\n Effect.promise(() => scheduler.cancel(id)),\n runAfter: <Ref_ extends Ref.AnyMutation | Ref.AnyAction>(\n delay: Duration.Duration,\n ref: Ref_,\n ...args: Ref.OptionalArgs<Ref_>\n ) => {\n const delayMs = Duration.toMillis(delay);\n const functionReference = Ref.getFunctionReference(ref);\n const encodedArgs = Ref.encodeArgsSync(\n ref,\n (args[0] ?? {}) as Ref.Args<Ref_>,\n );\n\n return Effect.promise(() =>\n scheduler.runAfter(delayMs, functionReference, encodedArgs),\n );\n },\n runAt: <Ref_ extends Ref.AnyMutation | Ref.AnyAction>(\n dateTime: DateTime.DateTime,\n ref: Ref_,\n ...args: Ref.OptionalArgs<Ref_>\n ) => {\n const timestamp = DateTime.toEpochMillis(dateTime);\n const functionReference = Ref.getFunctionReference(ref);\n const encodedArgs = Ref.encodeArgsSync(\n ref,\n (args[0] ?? {}) as Ref.Args<Ref_>,\n );\n\n return Effect.promise(() =>\n scheduler.runAt(timestamp, functionReference, encodedArgs),\n );\n },\n});\n\nexport const Scheduler = Context.Service<ReturnType<typeof make>>(\n \"@confect/server/Scheduler\",\n);\nexport type Scheduler = typeof Scheduler.Identifier;\n\nexport interface Service<Scope extends IdScope.IdScope = IdScope.App> {\n cancel(id: GenericId<\"_scheduled_functions\", Scope>): Effect.Effect<void>;\n runAfter<Ref_ extends Ref.AnyMutation | Ref.AnyAction>(\n delay: Duration.Duration,\n ref: Ref_,\n ...args: Ref.OptionalArgs<Ref_>\n ): Effect.Effect<GenericId<\"_scheduled_functions\", Scope>>;\n runAt<Ref_ extends Ref.AnyMutation | Ref.AnyAction>(\n dateTime: DateTime.DateTime,\n ref: Ref_,\n ...args: Ref.OptionalArgs<Ref_>\n ): Effect.Effect<GenericId<\"_scheduled_functions\", Scope>>;\n}\n\nexport type ForScope<Scope extends IdScope.IdScope> = Scope extends IdScope.App\n ? Scheduler\n : { readonly \"~ScopedScheduler\": Scope };\n\nexport const forScope = <\n Scope extends IdScope.IdScope = IdScope.App,\n>(): Context.Service<ForScope<Scope>, Service<Scope>> =>\n Context.Service(\"@confect/server/Scheduler\");\n\nexport const layer = <Scope extends IdScope.IdScope = IdScope.App>(\n scheduler: ConvexScheduler,\n _scope?: Scope,\n) =>\n // Scopes are phantom: Convex still receives and returns the same ID strings.\n Layer.succeed(\n forScope<Scope>(),\n make(scheduler) as unknown as Service<Scope>,\n );\n"],"mappings":";;;;;;;;;;;;;AAWA,MAAM,QAAQ,eAAgC;CAC5C,SAAS,OACP,OAAO,cAAc,UAAU,OAAO,EAAE,CAAC;CAC3C,WACE,OACA,KACA,GAAG,SACA;EACH,MAAM,UAAU,SAAS,SAAS,KAAK;EACvC,MAAM,oBAAoB,IAAI,qBAAqB,GAAG;EACtD,MAAM,cAAc,IAAI,eACtB,KACC,KAAK,MAAM,CAAC,CACf;EAEA,OAAO,OAAO,cACZ,UAAU,SAAS,SAAS,mBAAmB,WAAW,CAC5D;CACF;CACA,QACE,UACA,KACA,GAAG,SACA;EACH,MAAM,YAAY,SAAS,cAAc,QAAQ;EACjD,MAAM,oBAAoB,IAAI,qBAAqB,GAAG;EACtD,MAAM,cAAc,IAAI,eACtB,KACC,KAAK,MAAM,CAAC,CACf;EAEA,OAAO,OAAO,cACZ,UAAU,MAAM,WAAW,mBAAmB,WAAW,CAC3D;CACF;AACF;AAEA,MAAa,YAAY,QAAQ,QAC/B,2BACF;AAqBA,MAAa,iBAGX,QAAQ,QAAQ,2BAA2B;AAE7C,MAAa,SACX,WACA,WAGA,MAAM,QACJ,SAAgB,GAChB,KAAK,SAAS,CAChB"}
1
+ {"version":3,"file":"Scheduler.js","names":["ReservedArgument.encodeArgs"],"sources":["../src/Scheduler.ts"],"sourcesContent":["import * as ReservedArgument from \"./internal/reservedArgument.js\";\nimport type * as IdScope from \"@confect/core/IdScope\";\nimport type { Ref } from \"@confect/core\";\nimport { getFunctionReference } from \"@confect/core/RefInternal\";\nimport type { GenericId } from \"@confect/core/GenericId\";\nimport type { Scheduler as ConvexScheduler } from \"convex/server\";\nimport type { GenericId as ConvexGenericId } from \"convex/values\";\nimport * as Context from \"effect/Context\";\nimport * as DateTime from \"effect/DateTime\";\nimport * as Duration from \"effect/Duration\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\n\nconst make = (scheduler: ConvexScheduler) => ({\n cancel: (id: ConvexGenericId<\"_scheduled_functions\">) =>\n Effect.promise(() => scheduler.cancel(id)),\n runAfter: Effect.fn(\"Scheduler.runAfter\")(function* <\n Ref_ extends Ref.AnyMutation | Ref.AnyAction,\n >(delay: Duration.Duration, ref: Ref_, ...args: Ref.OptionalArgs<Ref_>) {\n const delayMs = Duration.toMillis(delay);\n const functionReference = getFunctionReference(ref);\n const encodedArgs = yield* ReservedArgument.encodeArgs(\n ref,\n (args[0] ?? {}) as Ref.Args<Ref_>,\n );\n\n return yield* Effect.promise(() =>\n scheduler.runAfter(delayMs, functionReference, encodedArgs),\n );\n }),\n runAt: Effect.fn(\"Scheduler.runAt\")(function* <\n Ref_ extends Ref.AnyMutation | Ref.AnyAction,\n >(dateTime: DateTime.DateTime, ref: Ref_, ...args: Ref.OptionalArgs<Ref_>) {\n const timestamp = DateTime.toEpochMillis(dateTime);\n const functionReference = getFunctionReference(ref);\n const encodedArgs = yield* ReservedArgument.encodeArgs(\n ref,\n (args[0] ?? {}) as Ref.Args<Ref_>,\n );\n\n return yield* Effect.promise(() =>\n scheduler.runAt(timestamp, functionReference, encodedArgs),\n );\n }),\n});\n\nexport const Scheduler = Context.Service<ReturnType<typeof make>>(\n \"@confect/server/Scheduler\",\n);\nexport type Scheduler = typeof Scheduler.Identifier;\n\nexport interface Service<Scope extends IdScope.IdScope = IdScope.App> {\n cancel(id: GenericId<\"_scheduled_functions\", Scope>): Effect.Effect<void>;\n runAfter<Ref_ extends Ref.AnyMutation | Ref.AnyAction>(\n delay: Duration.Duration,\n ref: Ref_,\n ...args: Ref.OptionalArgs<Ref_>\n ): Effect.Effect<GenericId<\"_scheduled_functions\", Scope>>;\n runAt<Ref_ extends Ref.AnyMutation | Ref.AnyAction>(\n dateTime: DateTime.DateTime,\n ref: Ref_,\n ...args: Ref.OptionalArgs<Ref_>\n ): Effect.Effect<GenericId<\"_scheduled_functions\", Scope>>;\n}\n\nexport type ForScope<Scope extends IdScope.IdScope> = Scope extends IdScope.App\n ? Scheduler\n : { readonly \"~ScopedScheduler\": Scope };\n\nexport const forScope = <\n Scope extends IdScope.IdScope = IdScope.App,\n>(): Context.Service<ForScope<Scope>, Service<Scope>> =>\n Context.Service(\"@confect/server/Scheduler\");\n\nexport const layer = <Scope extends IdScope.IdScope = IdScope.App>(\n scheduler: ConvexScheduler,\n _scope?: Scope,\n) =>\n // Scopes are phantom: Convex still receives and returns the same ID strings.\n Layer.succeed(\n forScope<Scope>(),\n make(scheduler) as unknown as Service<Scope>,\n );\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAM,QAAQ,eAAgC;CAC5C,SAAS,OACP,OAAO,cAAc,UAAU,OAAO,EAAE,CAAC;CAC3C,UAAU,OAAO,GAAG,oBAAoB,CAAC,CAAC,WAExC,OAA0B,KAAW,GAAG,MAA8B;EACtE,MAAM,UAAU,SAAS,SAAS,KAAK;EACvC,MAAM,oBAAoB,qBAAqB,GAAG;EAClD,MAAM,cAAc,OAAOA,WACzB,KACC,KAAK,MAAM,CAAC,CACf;EAEA,OAAO,OAAO,OAAO,cACnB,UAAU,SAAS,SAAS,mBAAmB,WAAW,CAC5D;CACF,CAAC;CACD,OAAO,OAAO,GAAG,iBAAiB,CAAC,CAAC,WAElC,UAA6B,KAAW,GAAG,MAA8B;EACzE,MAAM,YAAY,SAAS,cAAc,QAAQ;EACjD,MAAM,oBAAoB,qBAAqB,GAAG;EAClD,MAAM,cAAc,OAAOA,WACzB,KACC,KAAK,MAAM,CAAC,CACf;EAEA,OAAO,OAAO,OAAO,cACnB,UAAU,MAAM,WAAW,mBAAmB,WAAW,CAC3D;CACF,CAAC;AACH;AAEA,MAAa,YAAY,QAAQ,QAC/B,2BACF;AAqBA,MAAa,iBAGX,QAAQ,QAAQ,2BAA2B;AAE7C,MAAa,SACX,WACA,WAGA,MAAM,QACJ,SAAgB,GAChB,KAAK,SAAS,CAChB"}
package/dist/Storage.js CHANGED
@@ -3,8 +3,8 @@ import { StorageActionWriter } from "./StorageActionWriter.js";
3
3
  import { StorageReader } from "./StorageReader.js";
4
4
  import { StorageWriter } from "./StorageWriter.js";
5
5
  import * as Context from "effect/Context";
6
- import * as Layer from "effect/Layer";
7
6
  import * as Effect from "effect/Effect";
7
+ import * as Layer from "effect/Layer";
8
8
  //#region src/Storage.ts
9
9
  var Storage_exports = /* @__PURE__ */ __exportAll({
10
10
  Storage: () => Storage,
@@ -1,8 +1,8 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import { BlobNotFoundError } from "./BlobNotFoundError.js";
3
3
  import * as Context from "effect/Context";
4
- import * as Layer from "effect/Layer";
5
4
  import * as Effect from "effect/Effect";
5
+ import * as Layer from "effect/Layer";
6
6
  import { flow } from "effect/Function";
7
7
  import * as Option from "effect/Option";
8
8
  //#region src/StorageActionWriter.ts
@@ -1,8 +1,8 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import { BlobNotFoundError } from "./BlobNotFoundError.js";
3
3
  import * as Context from "effect/Context";
4
- import * as Layer from "effect/Layer";
5
4
  import * as Effect from "effect/Effect";
5
+ import * as Layer from "effect/Layer";
6
6
  import * as Schema from "effect/Schema";
7
7
  import { flow, pipe } from "effect/Function";
8
8
  import * as Option from "effect/Option";
@@ -1,8 +1,8 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import { BlobNotFoundError } from "./BlobNotFoundError.js";
3
3
  import * as Context from "effect/Context";
4
- import * as Layer from "effect/Layer";
5
4
  import * as Effect from "effect/Effect";
5
+ import * as Layer from "effect/Layer";
6
6
  import * as Schema from "effect/Schema";
7
7
  import { pipe } from "effect/Function";
8
8
  //#region src/StorageWriter.ts
package/dist/Table.d.ts CHANGED
@@ -77,7 +77,7 @@ export declare const scheduledFunctionsTable: Table_.Table<"_scheduled_functions
77
77
  }, {
78
78
  kind: import("convex/values").VLiteral<"canceled", "required">;
79
79
  }, "required", "kind">], "required", "error" | "kind">;
80
- }, "required", "args" | "completedTime" | "name" | "scheduledTime" | "state" | "state.error" | "state.kind">, {}, {}, {}, IdScope.App>;
80
+ }, "required", "args" | "completedTime" | "name" | "scheduledTime" | "state" | "state.error" | "state.kind">, {}, {}, {}, IdScope.App, undefined>;
81
81
  export declare const storageTable: Table_.Table<"_storage", Schema.Struct<{
82
82
  readonly sha256: Schema.String;
83
83
  readonly size: Schema.Finite;
@@ -90,7 +90,7 @@ export declare const storageTable: Table_.Table<"_storage", Schema.Struct<{
90
90
  sha256: import("convex/values").VString<string, "required">;
91
91
  size: import("convex/values").VFloat64<number, "required">;
92
92
  contentType: import("convex/values").VString<string | undefined, "optional">;
93
- }, "required", "contentType" | "sha256" | "size">, {}, {}, {}, IdScope.App>;
93
+ }, "required", "contentType" | "sha256" | "size">, {}, {}, {}, IdScope.App, undefined>;
94
94
  export declare const systemTables: {
95
95
  readonly _scheduled_functions: Table_.Table<"_scheduled_functions", Schema.Struct<{
96
96
  readonly name: Schema.String;
@@ -165,7 +165,7 @@ export declare const systemTables: {
165
165
  }, {
166
166
  kind: import("convex/values").VLiteral<"canceled", "required">;
167
167
  }, "required", "kind">], "required", "error" | "kind">;
168
- }, "required", "args" | "completedTime" | "name" | "scheduledTime" | "state" | "state.error" | "state.kind">, {}, {}, {}, IdScope.App>;
168
+ }, "required", "args" | "completedTime" | "name" | "scheduledTime" | "state" | "state.error" | "state.kind">, {}, {}, {}, IdScope.App, undefined>;
169
169
  readonly _storage: Table_.Table<"_storage", Schema.Struct<{
170
170
  readonly sha256: Schema.String;
171
171
  readonly size: Schema.Finite;
@@ -178,7 +178,7 @@ export declare const systemTables: {
178
178
  sha256: import("convex/values").VString<string, "required">;
179
179
  size: import("convex/values").VFloat64<number, "required">;
180
180
  contentType: import("convex/values").VString<string | undefined, "optional">;
181
- }, "required", "contentType" | "sha256" | "size">, {}, {}, {}, IdScope.App>;
181
+ }, "required", "contentType" | "sha256" | "size">, {}, {}, {}, IdScope.App, undefined>;
182
182
  };
183
183
  declare const makeSystemTables: <const Scope_ extends IdScope.IdScope>(scope: Scope_) => {
184
184
  _scheduled_functions: Table_.Table<"_scheduled_functions", Schema.Struct<{
@@ -254,7 +254,7 @@ declare const makeSystemTables: <const Scope_ extends IdScope.IdScope>(scope: Sc
254
254
  }, {
255
255
  kind: import("convex/values").VLiteral<"canceled", "required">;
256
256
  }, "required", "kind">], "required", "error" | "kind">;
257
- }, "required", "args" | "completedTime" | "name" | "scheduledTime" | "state" | "state.error" | "state.kind">, {}, {}, {}, Scope_>;
257
+ }, "required", "args" | "completedTime" | "name" | "scheduledTime" | "state" | "state.error" | "state.kind">, {}, {}, {}, Scope_, undefined>;
258
258
  _storage: Table_.Table<"_storage", Schema.Struct<{
259
259
  readonly sha256: Schema.String;
260
260
  readonly size: Schema.Finite;
@@ -267,7 +267,7 @@ declare const makeSystemTables: <const Scope_ extends IdScope.IdScope>(scope: Sc
267
267
  sha256: import("convex/values").VString<string, "required">;
268
268
  size: import("convex/values").VFloat64<number, "required">;
269
269
  contentType: import("convex/values").VString<string | undefined, "optional">;
270
- }, "required", "contentType" | "sha256" | "size">, {}, {}, {}, Scope_>;
270
+ }, "required", "contentType" | "sha256" | "size">, {}, {}, {}, Scope_, undefined>;
271
271
  };
272
272
  export declare const systemTablesForScope: <const Scope_ extends IdScope.IdScope>(scope: Scope_) => ReturnType<typeof makeSystemTables<Scope_>>;
273
273
  export type SystemTables<Scope_ extends IdScope.IdScope = IdScope.App> = ReturnType<typeof systemTablesForScope<Scope_>>[keyof typeof systemTables];
@@ -1 +1 @@
1
- {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../src/Table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,uBAAuB,CAAC;AAEtD,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAElE,OAAO,EACL,MAAM,EACN,OAAO,EACP,cAAc,EACd,IAAI,EACJ,KAAK,KAAK,EACV,KAAK,GAAG,EACR,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,UA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B,eAAO,MAAM,YAAY;;;;;;;;;;;;sFAMZ,CAAC;AAEd,eAAO,MAAM,YAAY;aACvB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aACpB,QAAQ;;;;;;;;;;;;;CACA,CAAC;AAEX,QAAA,MAAM,gBAAgB,GAAI,KAAK,CAAC,MAAM,SAAS,OAAO,CAAC,OAAO,SACrD,MAAM;IAEb,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIpB,QAAQ;;;;;;;;;;;;;CACR,CAAC;AAOH,eAAO,MAAM,oBAAoB,GAAI,KAAK,CAAC,MAAM,SAAS,OAAO,CAAC,OAAO,SAChE,MAAM,KACZ,UAAU,CAAC,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAS5C,CAAC;AAEF,MAAM,MAAM,YAAY,CAAC,MAAM,SAAS,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,IACnE,UAAU,CAAC,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}
@@ -7,7 +7,7 @@ import type * as Document_ from "./Document.js";
7
7
  import type * as Table from "./Table.js";
8
8
  export declare const TypeId: "~@confect/server/TableInfo";
9
9
  export type TypeId = typeof TypeId;
10
- export type TableInfo<Table_ extends Table.AnyWithProps> = Table_ extends Table.Table<infer TableName, infer TableSchema_, infer TableValidator, infer Indexes, infer SearchIndexes, infer VectorIndexes, infer Scope> ? {
10
+ export type TableInfo<Table_ extends Table.AnyWithProps> = Table_ extends Table.Table<infer TableName, infer TableSchema_, infer TableValidator, infer Indexes, infer SearchIndexes, infer VectorIndexes, infer Scope, any> ? {
11
11
  readonly [TypeId]: TypeId;
12
12
  readonly document: WithSystemFields<TableName, Schema.Schema.Type<TableSchema_>, Scope>;
13
13
  readonly encodedDocument: WithSystemFields<TableName, Schema.Codec.Encoded<TableSchema_>, Scope>;
@@ -1 +1 @@
1
- {"version":3,"file":"TableInfo.d.ts","sourceRoot":"","sources":["../src/TableInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,yBAAyB,EACzB,OAAO,EACP,YAAY,EACZ,aAAa,EACd,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,KAAK,SAAS,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AAEzC,MAAM,CAAC,OAAO,CAAC,MAAM,MAAM,EAAE,4BAA4B,CAAC;AAC1D,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC;AAEnC,MAAM,MAAM,SAAS,CAAC,MAAM,SAAS,KAAK,CAAC,YAAY,IACrD,MAAM,SAAS,KAAK,CAAC,KAAK,CACxB,MAAM,SAAS,EACf,MAAM,YAAY,EAClB,MAAM,cAAc,EACpB,MAAM,OAAO,EACb,MAAM,aAAa,EACnB,MAAM,aAAa,EACnB,MAAM,KAAK,CACZ,GACG;IACE,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CACjC,SAAS,EACT,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAChC,KAAK,CACN,CAAC;IACF,QAAQ,CAAC,eAAe,EAAE,gBAAgB,CACxC,SAAS,EACT,MAAM,CAAC,KAAK,CAAC,OAAO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"sources":["../src/TableInfo.ts"],"sourcesContent":["import type * as IdScope from \"@confect/core/IdScope\";\nimport type {\n GenericDocument,\n GenericFieldPaths,\n GenericTableIndexes,\n GenericTableSearchIndexes,\n GenericTableVectorIndexes,\n IdField,\n SystemFields,\n SystemIndexes,\n} from \"convex/server\";\nimport type { GenericValidator } from \"convex/values\";\nimport type { Schema, Types } from \"effect\";\nimport type { WithSystemFields } from \"@confect/core/SystemFields\";\nimport type * as Document_ from \"./Document.js\";\nimport type * as Table from \"./Table.js\";\n\nexport declare const TypeId: \"~@confect/server/TableInfo\";\nexport type TypeId = typeof TypeId;\n\nexport type TableInfo<Table_ extends Table.AnyWithProps> =\n Table_ extends Table.Table<\n infer TableName,\n infer TableSchema_,\n infer TableValidator,\n infer Indexes,\n infer SearchIndexes,\n infer VectorIndexes,\n infer Scope\n >\n ? {\n readonly [TypeId]: TypeId;\n readonly document: WithSystemFields<\n TableName,\n Schema.Schema.Type<TableSchema_>,\n Scope\n >;\n readonly encodedDocument: WithSystemFields<\n TableName,\n Schema.Codec.Encoded<TableSchema_>,\n Scope\n >;\n readonly convexDocument: ExtractConvexDocument<\n TableName,\n TableValidator,\n Scope\n >;\n readonly fieldPaths:\n | keyof IdField<TableName>\n | ExtractFieldPaths<TableValidator>;\n readonly indexes: Types.Simplify<Indexes & SystemIndexes>;\n readonly searchIndexes: SearchIndexes;\n readonly vectorIndexes: VectorIndexes;\n }\n : never;\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends Any {\n readonly document: Document_.Any;\n readonly encodedDocument: Document_.AnyEncoded;\n readonly convexDocument: GenericDocument;\n readonly fieldPaths: GenericFieldPaths;\n readonly indexes: GenericTableIndexes;\n readonly searchIndexes: GenericTableSearchIndexes;\n readonly vectorIndexes: GenericTableVectorIndexes;\n}\n\nexport type ConvexTableInfo<TableInfo_ extends AnyWithProps> = {\n document: TableInfo_[\"convexDocument\"];\n fieldPaths: TableInfo_[\"fieldPaths\"];\n indexes: TableInfo_[\"indexes\"];\n searchIndexes: TableInfo_[\"searchIndexes\"];\n vectorIndexes: TableInfo_[\"vectorIndexes\"];\n};\n\nexport type TableSchema<TableInfo_ extends AnyWithProps> = Schema.Codec<\n TableInfo_[\"document\"],\n TableInfo_[\"encodedDocument\"]\n>;\n\nexport type Document<TableInfo_ extends AnyWithProps> = TableInfo_[\"document\"];\n\n// Vendored types from convex-js, partially modified.\n// See https://github.com/get-convex/convex-js/pull/14\n\ntype ExtractFieldPaths<TableValidator extends GenericValidator> =\n | TableValidator[\"fieldPaths\"]\n | keyof SystemFields;\n\ntype ExtractConvexDocument<\n TableName extends string,\n TableValidator extends GenericValidator,\n Scope extends IdScope.IdScope = IdScope.App,\n> =\n WithSystemFields<\n TableName,\n TableValidator[\"type\"],\n Scope\n > extends GenericDocument\n ? WithSystemFields<TableName, TableValidator[\"type\"], Scope>\n : never;\n\n// End of vendored types from convex-js, partially modified.\n"],"mappings":""}
1
+ {"version":3,"file":"TableInfo.js","names":[],"sources":["../src/TableInfo.ts"],"sourcesContent":["import type * as IdScope from \"@confect/core/IdScope\";\nimport type {\n GenericDocument,\n GenericFieldPaths,\n GenericTableIndexes,\n GenericTableSearchIndexes,\n GenericTableVectorIndexes,\n IdField,\n SystemFields,\n SystemIndexes,\n} from \"convex/server\";\nimport type { GenericValidator } from \"convex/values\";\nimport type { Schema, Types } from \"effect\";\nimport type { WithSystemFields } from \"@confect/core/SystemFields\";\nimport type * as Document_ from \"./Document.js\";\nimport type * as Table from \"./Table.js\";\n\nexport declare const TypeId: \"~@confect/server/TableInfo\";\nexport type TypeId = typeof TypeId;\n\nexport type TableInfo<Table_ extends Table.AnyWithProps> =\n Table_ extends Table.Table<\n infer TableName,\n infer TableSchema_,\n infer TableValidator,\n infer Indexes,\n infer SearchIndexes,\n infer VectorIndexes,\n infer Scope,\n any\n >\n ? {\n readonly [TypeId]: TypeId;\n readonly document: WithSystemFields<\n TableName,\n Schema.Schema.Type<TableSchema_>,\n Scope\n >;\n readonly encodedDocument: WithSystemFields<\n TableName,\n Schema.Codec.Encoded<TableSchema_>,\n Scope\n >;\n readonly convexDocument: ExtractConvexDocument<\n TableName,\n TableValidator,\n Scope\n >;\n readonly fieldPaths:\n | keyof IdField<TableName>\n | ExtractFieldPaths<TableValidator>;\n readonly indexes: Types.Simplify<Indexes & SystemIndexes>;\n readonly searchIndexes: SearchIndexes;\n readonly vectorIndexes: VectorIndexes;\n }\n : never;\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends Any {\n readonly document: Document_.Any;\n readonly encodedDocument: Document_.AnyEncoded;\n readonly convexDocument: GenericDocument;\n readonly fieldPaths: GenericFieldPaths;\n readonly indexes: GenericTableIndexes;\n readonly searchIndexes: GenericTableSearchIndexes;\n readonly vectorIndexes: GenericTableVectorIndexes;\n}\n\nexport type ConvexTableInfo<TableInfo_ extends AnyWithProps> = {\n document: TableInfo_[\"convexDocument\"];\n fieldPaths: TableInfo_[\"fieldPaths\"];\n indexes: TableInfo_[\"indexes\"];\n searchIndexes: TableInfo_[\"searchIndexes\"];\n vectorIndexes: TableInfo_[\"vectorIndexes\"];\n};\n\nexport type TableSchema<TableInfo_ extends AnyWithProps> = Schema.Codec<\n TableInfo_[\"document\"],\n TableInfo_[\"encodedDocument\"]\n>;\n\nexport type Document<TableInfo_ extends AnyWithProps> = TableInfo_[\"document\"];\n\n// Vendored types from convex-js, partially modified.\n// See https://github.com/get-convex/convex-js/pull/14\n\ntype ExtractFieldPaths<TableValidator extends GenericValidator> =\n | TableValidator[\"fieldPaths\"]\n | keyof SystemFields;\n\ntype ExtractConvexDocument<\n TableName extends string,\n TableValidator extends GenericValidator,\n Scope extends IdScope.IdScope = IdScope.App,\n> =\n WithSystemFields<\n TableName,\n TableValidator[\"type\"],\n Scope\n > extends GenericDocument\n ? WithSystemFields<TableName, TableValidator[\"type\"], Scope>\n : never;\n\n// End of vendored types from convex-js, partially modified.\n"],"mappings":""}
@@ -1,7 +1,7 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import * as Context from "effect/Context";
3
- import * as Layer from "effect/Layer";
4
3
  import * as Effect from "effect/Effect";
4
+ import * as Layer from "effect/Layer";
5
5
  //#region src/TransactionMetadata.ts
6
6
  var TransactionMetadata_exports = /* @__PURE__ */ __exportAll({
7
7
  TransactionMetadata: () => TransactionMetadata,
@@ -1,7 +1,7 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import * as Context from "effect/Context";
3
- import * as Layer from "effect/Layer";
4
3
  import * as Effect from "effect/Effect";
4
+ import * as Layer from "effect/Layer";
5
5
  //#region src/VectorSearch.ts
6
6
  var VectorSearch_exports = /* @__PURE__ */ __exportAll({
7
7
  VectorSearch: () => VectorSearch,
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * as ActionCall from "./ActionCall.js";
1
2
  export * as AiGatewayDecisionClient from "./AiGatewayDecisionClient.js";
2
3
  export * as AiGatewayDecisionModel from "./AiGatewayDecisionModel.js";
3
4
  export * as AiGatewayLanguageClient from "./AiGatewayLanguageClient.js";
@@ -25,9 +26,11 @@ export * as Handler from "./Handler.js";
25
26
  export * as HttpRouter from "./HttpRouter.js";
26
27
  export * as MiddlewareImpl from "./MiddlewareImpl.js";
27
28
  export * as MiddlewareRegistryItem from "./MiddlewareRegistryItem.js";
29
+ export * as MountInit from "./MountInit.js";
28
30
  export * as MutationCtx from "./MutationCtx.js";
29
31
  export * as MutationRunner from "./MutationRunner.js";
30
32
  export * as MutationTransactionContext from "./MutationTransactionContext.js";
33
+ export * as OfficialComponent from "./OfficialComponent.js";
31
34
  export * as OrderedQuery from "./OrderedQuery.js";
32
35
  export * as QueryCtx from "./QueryCtx.js";
33
36
  export * as QueryInitializer from "./QueryInitializer.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,uBAAuB,MA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G;AACH,OAAO,KAAK,oBAAoB,MAAM,2BAA2B,CAAC;AAClE;;GAEG;AACH,OAAO,KAAK,oBAAoB,MAAM,2BAA2B,CAAC;AAClE;;GAEG;AACH,OAAO,KAAK,qBAAqB,MAAM,4BAA4B,CAAC;AACpE;;GAEG;AACH,OAAO,KAAK,qBAAqB,MAAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,wBAAwB,MAAM,+BAA+B,CAAC;AAC1E,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,14 @@
1
1
  import { ActionCtx_exports } from "./ActionCtx.js";
2
2
  import { ActionRunner_exports } from "./ActionRunner.js";
3
+ import { Registry_exports } from "./Registry.js";
4
+ import { MiddlewareRegistryItem_exports } from "./MiddlewareRegistryItem.js";
5
+ import { MiddlewareImpl_exports } from "./MiddlewareImpl.js";
6
+ import { MutationTransactionContext_exports } from "./MutationTransactionContext.js";
7
+ import { MutationRunner_exports } from "./MutationRunner.js";
8
+ import { QueryTransactionContext_exports } from "./QueryTransactionContext.js";
9
+ import { QueryRunner_exports } from "./QueryRunner.js";
10
+ import { Scheduler_exports } from "./Scheduler.js";
11
+ import { ActionCall_exports } from "./ActionCall.js";
3
12
  import { AiGatewayDecisionClient_exports } from "./AiGatewayDecisionClient.js";
4
13
  import { AiGatewayDecisionModel_exports } from "./AiGatewayDecisionModel.js";
5
14
  import { AiGatewayLanguageClient_exports } from "./AiGatewayLanguageClient.js";
@@ -8,8 +17,15 @@ import { Auth_exports } from "./Auth.js";
8
17
  import { BlobNotFoundError_exports } from "./BlobNotFoundError.js";
9
18
  import { Callback_exports } from "./Callback.js";
10
19
  import { ConvexConfigProvider_exports } from "./ConvexConfigProvider.js";
11
- import { Registry_exports } from "./Registry.js";
12
- import { MiddlewareRegistryItem_exports } from "./MiddlewareRegistryItem.js";
20
+ import { ConvexLogger_exports } from "./ConvexLogger.js";
21
+ import { ExecutionMetadata_exports } from "./ExecutionMetadata.js";
22
+ import { RequestMetadata_exports } from "./RequestMetadata.js";
23
+ import { StorageActionWriter_exports } from "./StorageActionWriter.js";
24
+ import { StorageReader_exports } from "./StorageReader.js";
25
+ import { StorageWriter_exports } from "./StorageWriter.js";
26
+ import { Storage_exports } from "./Storage.js";
27
+ import { VectorSearch_exports } from "./VectorSearch.js";
28
+ import { RegisteredFunction_exports } from "./RegisteredFunction.js";
13
29
  import { FunctionRegistryItem_exports } from "./FunctionRegistryItem.js";
14
30
  import { DatabaseSchema_exports } from "./DatabaseSchema.js";
15
31
  import { Document_exports } from "./Document.js";
@@ -27,23 +43,9 @@ import { QueryInitializer_exports } from "./QueryInitializer.js";
27
43
  import { Table_exports } from "./Table.js";
28
44
  import { DatabaseReader_exports } from "./DatabaseReader.js";
29
45
  import { DatabaseWriter_exports } from "./DatabaseWriter.js";
30
- import { ExecutionMetadata_exports } from "./ExecutionMetadata.js";
31
- import { RequestMetadata_exports } from "./RequestMetadata.js";
32
46
  import { TransactionMetadata_exports } from "./TransactionMetadata.js";
33
47
  import { MutationCtx_exports } from "./MutationCtx.js";
34
- import { MutationTransactionContext_exports } from "./MutationTransactionContext.js";
35
- import { MutationRunner_exports } from "./MutationRunner.js";
36
48
  import { QueryCtx_exports } from "./QueryCtx.js";
37
- import { QueryTransactionContext_exports } from "./QueryTransactionContext.js";
38
- import { QueryRunner_exports } from "./QueryRunner.js";
39
- import { ConvexLogger_exports } from "./ConvexLogger.js";
40
- import { Scheduler_exports } from "./Scheduler.js";
41
- import { StorageActionWriter_exports } from "./StorageActionWriter.js";
42
- import { StorageReader_exports } from "./StorageReader.js";
43
- import { StorageWriter_exports } from "./StorageWriter.js";
44
- import { Storage_exports } from "./Storage.js";
45
- import { VectorSearch_exports } from "./VectorSearch.js";
46
- import { RegisteredFunction_exports } from "./RegisteredFunction.js";
47
49
  import { RegisteredConvexFunction_exports } from "./RegisteredConvexFunction.js";
48
50
  import { ResolvedMiddleware_exports } from "./ResolvedMiddleware.js";
49
51
  import { ConvexFunctionDefinitions_exports } from "./ConvexFunctionDefinitions.js";
@@ -55,7 +57,8 @@ import { RegistryItems_exports } from "./RegistryItems.js";
55
57
  import { GroupImpl_exports } from "./GroupImpl.js";
56
58
  import { Handler_exports } from "./Handler.js";
57
59
  import { HttpRouter_exports } from "./HttpRouter.js";
58
- import { MiddlewareImpl_exports } from "./MiddlewareImpl.js";
60
+ import { MountInit_exports } from "./MountInit.js";
61
+ import { OfficialComponent_exports } from "./OfficialComponent.js";
59
62
  import { RegisteredFunctions_exports } from "./RegisteredFunctions.js";
60
63
  import { TableInfo_exports } from "./TableInfo.js";
61
- export { ActionCtx_exports as ActionCtx, ActionRunner_exports as ActionRunner, AiGatewayDecisionClient_exports as AiGatewayDecisionClient, AiGatewayDecisionModel_exports as AiGatewayDecisionModel, AiGatewayLanguageClient_exports as AiGatewayLanguageClient, AiGatewayLanguageModel_exports as AiGatewayLanguageModel, Auth_exports as Auth, BlobNotFoundError_exports as BlobNotFoundError, Callback_exports as Callback, ConvexConfigProvider_exports as ConvexConfigProvider, ConvexFunctionDefinitions_exports as ConvexFunctionDefinitions, ConvexLogger_exports as ConvexLogger, CronJob_exports as CronJob, CronJobs_exports as CronJobs, DataModel_exports as DataModel, DatabaseReader_exports as DatabaseReader, DatabaseSchema_exports as DatabaseSchema, DatabaseWriter_exports as DatabaseWriter, Document_exports as Document, ExecutionMetadata_exports as ExecutionMetadata, FunctionImpl_exports as FunctionImpl, FunctionRegistryItem_exports as FunctionRegistryItem, GroupImpl_exports as GroupImpl, Handler_exports as Handler, HttpRouter_exports as HttpRouter, MiddlewareImpl_exports as MiddlewareImpl, MiddlewareRegistryItem_exports as MiddlewareRegistryItem, MutationCtx_exports as MutationCtx, MutationRunner_exports as MutationRunner, MutationTransactionContext_exports as MutationTransactionContext, OrderedQuery_exports as OrderedQuery, QueryCtx_exports as QueryCtx, QueryInitializer_exports as QueryInitializer, QueryRunner_exports as QueryRunner, QueryStream_exports as QueryStream, QueryStreamCursor_exports as QueryStreamCursor, QueryStreamIndexRange_exports as QueryStreamIndexRange, QueryStreamKeyBounds_exports as QueryStreamKeyBounds, QueryStreamKeyLabels_exports as QueryStreamKeyLabels, QueryStreamKeyLayout_exports as QueryStreamKeyLayout, QueryStreamKeyValues_exports as QueryStreamKeyValues, QueryStreamOrderDirection_exports as QueryStreamOrderDirection, QueryStreamReadBudget_exports as QueryStreamReadBudget, QueryTransactionContext_exports as QueryTransactionContext, RegisteredConvexFunction_exports as RegisteredConvexFunction, RegisteredFunction_exports as RegisteredFunction, RegisteredFunctions_exports as RegisteredFunctions, Registry_exports as Registry, RegistryItems_exports as RegistryItems, RequestMetadata_exports as RequestMetadata, ResolvedMiddleware_exports as ResolvedMiddleware, Scheduler_exports as Scheduler, Storage_exports as Storage, StorageActionWriter_exports as StorageActionWriter, StorageReader_exports as StorageReader, StorageWriter_exports as StorageWriter, Table_exports as Table, TableInfo_exports as TableInfo, TransactionMetadata_exports as TransactionMetadata, VectorSearch_exports as VectorSearch };
64
+ export { ActionCall_exports as ActionCall, ActionCtx_exports as ActionCtx, ActionRunner_exports as ActionRunner, AiGatewayDecisionClient_exports as AiGatewayDecisionClient, AiGatewayDecisionModel_exports as AiGatewayDecisionModel, AiGatewayLanguageClient_exports as AiGatewayLanguageClient, AiGatewayLanguageModel_exports as AiGatewayLanguageModel, Auth_exports as Auth, BlobNotFoundError_exports as BlobNotFoundError, Callback_exports as Callback, ConvexConfigProvider_exports as ConvexConfigProvider, ConvexFunctionDefinitions_exports as ConvexFunctionDefinitions, ConvexLogger_exports as ConvexLogger, CronJob_exports as CronJob, CronJobs_exports as CronJobs, DataModel_exports as DataModel, DatabaseReader_exports as DatabaseReader, DatabaseSchema_exports as DatabaseSchema, DatabaseWriter_exports as DatabaseWriter, Document_exports as Document, ExecutionMetadata_exports as ExecutionMetadata, FunctionImpl_exports as FunctionImpl, FunctionRegistryItem_exports as FunctionRegistryItem, GroupImpl_exports as GroupImpl, Handler_exports as Handler, HttpRouter_exports as HttpRouter, MiddlewareImpl_exports as MiddlewareImpl, MiddlewareRegistryItem_exports as MiddlewareRegistryItem, MountInit_exports as MountInit, MutationCtx_exports as MutationCtx, MutationRunner_exports as MutationRunner, MutationTransactionContext_exports as MutationTransactionContext, OfficialComponent_exports as OfficialComponent, OrderedQuery_exports as OrderedQuery, QueryCtx_exports as QueryCtx, QueryInitializer_exports as QueryInitializer, QueryRunner_exports as QueryRunner, QueryStream_exports as QueryStream, QueryStreamCursor_exports as QueryStreamCursor, QueryStreamIndexRange_exports as QueryStreamIndexRange, QueryStreamKeyBounds_exports as QueryStreamKeyBounds, QueryStreamKeyLabels_exports as QueryStreamKeyLabels, QueryStreamKeyLayout_exports as QueryStreamKeyLayout, QueryStreamKeyValues_exports as QueryStreamKeyValues, QueryStreamOrderDirection_exports as QueryStreamOrderDirection, QueryStreamReadBudget_exports as QueryStreamReadBudget, QueryTransactionContext_exports as QueryTransactionContext, RegisteredConvexFunction_exports as RegisteredConvexFunction, RegisteredFunction_exports as RegisteredFunction, RegisteredFunctions_exports as RegisteredFunctions, Registry_exports as Registry, RegistryItems_exports as RegistryItems, RequestMetadata_exports as RequestMetadata, ResolvedMiddleware_exports as ResolvedMiddleware, Scheduler_exports as Scheduler, Storage_exports as Storage, StorageActionWriter_exports as StorageActionWriter, StorageReader_exports as StorageReader, StorageWriter_exports as StorageWriter, Table_exports as Table, TableInfo_exports as TableInfo, TransactionMetadata_exports as TransactionMetadata, VectorSearch_exports as VectorSearch };
@@ -1,7 +1,7 @@
1
1
  import { AiGatewayServiceToken, transformClientRequest } from "./AiGatewayServiceToken.js";
2
2
  import { AI_GATEWAY_API_URL } from "./constants.js";
3
- import * as Layer from "effect/Layer";
4
3
  import * as Effect from "effect/Effect";
4
+ import * as Layer from "effect/Layer";
5
5
  import * as OpenRouterClient from "@effect/ai-openrouter/OpenRouterClient";
6
6
  //#region src/internal/AiGatewayDecisionClient.ts
7
7
  const make = Effect.gen(function* () {
@@ -1,7 +1,7 @@
1
1
  import { AiGatewayServiceToken, transformClientRequest } from "./AiGatewayServiceToken.js";
2
2
  import { AI_GATEWAY_API_URL } from "./constants.js";
3
- import * as Layer from "effect/Layer";
4
3
  import * as Effect from "effect/Effect";
4
+ import * as Layer from "effect/Layer";
5
5
  import * as OpenAiClient from "@effect/ai-openai-compat/OpenAiClient";
6
6
  //#region src/internal/AiGatewayLanguageClient.ts
7
7
  const make = Effect.gen(function* () {
@@ -1,6 +1,6 @@
1
1
  import * as Context from "effect/Context";
2
- import * as Layer from "effect/Layer";
3
2
  import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
4
  import { getServiceToken } from "convex/server";
5
5
  import * as Schema from "effect/Schema";
6
6
  import * as HttpClient from "effect/http/HttpClient";
@@ -0,0 +1,16 @@
1
+ import type { ReadonlyValue } from "@confect/core/SchemaToValidator";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Record from "effect/Record";
4
+ import * as Schema from "effect/Schema";
5
+ import type * as Table from "../Table.js";
6
+ export type EncodedPatch = Record.ReadonlyRecord<string, ReadonlyValue | undefined>;
7
+ export type PatchEncoder = (patch: Record.ReadonlyRecord<string, unknown>) => Effect.Effect<EncodedPatch, Schema.SchemaError>;
8
+ /**
9
+ * Returns the encoder for patches to the table's documents, or `undefined` when
10
+ * the table's codec does not encode each field independently. The encoder maps
11
+ * every patched field of the table to its encoded value, or to `undefined` when
12
+ * the patch unsets the field or the field's codec encodes the value as an
13
+ * absent key. Keys outside the table's fields are left out.
14
+ */
15
+ export declare const encoder: (table: Table.AnyWithProps) => PatchEncoder | undefined;
16
+ //# sourceMappingURL=DocumentPatch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentPatch.d.ts","sourceRoot":"","sources":["../../src/internal/DocumentPatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAErE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAE1C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,cAAc,CAC9C,MAAM,EACN,aAAa,GAAG,SAAS,CAC1B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,CACzB,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,KAC1C,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;AAIrD;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,UACX,KAAK,CAAC,YAAY,KACxB,YAAY,GAAG,SAOjB,CAAC"}
@@ -0,0 +1,36 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as Record from "effect/Record";
3
+ import * as Schema from "effect/Schema";
4
+ import { pipe } from "effect/Function";
5
+ import * as SchemaAST from "effect/SchemaAST";
6
+ //#region src/internal/DocumentPatch.ts
7
+ const patchEncoders = /* @__PURE__ */ new WeakMap();
8
+ /**
9
+ * Returns the encoder for patches to the table's documents, or `undefined` when
10
+ * the table's codec does not encode each field independently. The encoder maps
11
+ * every patched field of the table to its encoded value, or to `undefined` when
12
+ * the patch unsets the field or the field's codec encodes the value as an
13
+ * absent key. Keys outside the table's fields are left out.
14
+ */
15
+ const encoder = (table) => {
16
+ let cached = patchEncoders.get(table);
17
+ if (cached === void 0) {
18
+ cached = makePatchEncoder(table);
19
+ patchEncoders.set(table, cached);
20
+ }
21
+ return cached ?? void 0;
22
+ };
23
+ const makePatchEncoder = (table) => {
24
+ const ast = table.Fields.ast;
25
+ if (!SchemaAST.isObjects(ast) || ast.encoding !== void 0 || ast.checks !== void 0 || ast.indexSignatures.length > 0) return null;
26
+ const fieldEncoders = Object.fromEntries(ast.propertySignatures.map(({ name, type }) => {
27
+ const key = String(name);
28
+ const encode = Schema.encodeUnknownEffect(Schema.Struct({ [key]: Schema.optionalKey(Schema.make(type)) }));
29
+ return [key, (value) => Effect.map(encode({ [key]: value }), (encoded) => encoded[key])];
30
+ }));
31
+ return (patch) => pipe(fieldEncoders, Record.filter((_, name) => Object.hasOwn(patch, name)), Record.map((encode, name) => patch[name] === void 0 ? Effect.undefined : encode(patch[name])), Effect.all);
32
+ };
33
+ //#endregion
34
+ export { encoder };
35
+
36
+ //# sourceMappingURL=DocumentPatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DocumentPatch.js","names":[],"sources":["../../src/internal/DocumentPatch.ts"],"sourcesContent":["import type { ReadonlyValue } from \"@confect/core/SchemaToValidator\";\nimport { pipe } from \"effect/Function\";\nimport * as Effect from \"effect/Effect\";\nimport * as Record from \"effect/Record\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaAST from \"effect/SchemaAST\";\nimport type * as Table from \"../Table.js\";\n\nexport type EncodedPatch = Record.ReadonlyRecord<\n string,\n ReadonlyValue | undefined\n>;\n\nexport type PatchEncoder = (\n patch: Record.ReadonlyRecord<string, unknown>,\n) => Effect.Effect<EncodedPatch, Schema.SchemaError>;\n\nconst patchEncoders = new WeakMap<Table.AnyWithProps, PatchEncoder | null>();\n\n/**\n * Returns the encoder for patches to the table's documents, or `undefined` when\n * the table's codec does not encode each field independently. The encoder maps\n * every patched field of the table to its encoded value, or to `undefined` when\n * the patch unsets the field or the field's codec encodes the value as an\n * absent key. Keys outside the table's fields are left out.\n */\nexport const encoder = (\n table: Table.AnyWithProps,\n): PatchEncoder | undefined => {\n let cached = patchEncoders.get(table);\n if (cached === undefined) {\n cached = makePatchEncoder(table);\n patchEncoders.set(table, cached);\n }\n return cached ?? undefined;\n};\n\n// A struct with no encoding of its own encodes each field through that field's\n// codec alone, so a patch encodes field by field. A union or a transformation\n// over the whole struct can make one field's encoding depend on another field.\n// A struct-level check must see the decoded fields before they are encoded,\n// and keys under an index signature have no field codec of their own.\nconst makePatchEncoder = (table: Table.AnyWithProps): PatchEncoder | null => {\n const ast = table.Fields.ast;\n if (\n !SchemaAST.isObjects(ast) ||\n ast.encoding !== undefined ||\n ast.checks !== undefined ||\n ast.indexSignatures.length > 0\n ) {\n return null;\n }\n // A field's codec runs only when the patch gives the field a value, since a\n // codec can handle a missing key. Each comes from the table, whose codecs\n // need no services.\n const fieldEncoders: Record.ReadonlyRecord<\n string,\n (\n value: unknown,\n ) => Effect.Effect<ReadonlyValue | undefined, Schema.SchemaError>\n > = Object.fromEntries(\n ast.propertySignatures.map(({ name, type }) => {\n const key = String(name);\n const encode = Schema.encodeUnknownEffect(\n Schema.Struct({\n [key]: Schema.optionalKey(\n Schema.make<Schema.Codec<unknown, ReadonlyValue>>(type),\n ),\n }),\n );\n return [\n key,\n (value: unknown) =>\n Effect.map(encode({ [key]: value }), (encoded) => encoded[key]),\n ];\n }),\n );\n return (patch) =>\n pipe(\n fieldEncoders,\n Record.filter((_, name) => Object.hasOwn(patch, name)),\n Record.map((encode, name) =>\n patch[name] === undefined ? Effect.undefined : encode(patch[name]),\n ),\n Effect.all,\n );\n};\n"],"mappings":";;;;;;AAiBA,MAAM,gCAAgB,IAAI,QAAiD;;;;;;;;AAS3E,MAAa,WACX,UAC6B;CAC7B,IAAI,SAAS,cAAc,IAAI,KAAK;CACpC,IAAI,WAAW,KAAA,GAAW;EACxB,SAAS,iBAAiB,KAAK;EAC/B,cAAc,IAAI,OAAO,MAAM;CACjC;CACA,OAAO,UAAU,KAAA;AACnB;AAOA,MAAM,oBAAoB,UAAmD;CAC3E,MAAM,MAAM,MAAM,OAAO;CACzB,IACE,CAAC,UAAU,UAAU,GAAG,KACxB,IAAI,aAAa,KAAA,KACjB,IAAI,WAAW,KAAA,KACf,IAAI,gBAAgB,SAAS,GAE7B,OAAO;CAKT,MAAM,gBAKF,OAAO,YACT,IAAI,mBAAmB,KAAK,EAAE,MAAM,WAAW;EAC7C,MAAM,MAAM,OAAO,IAAI;EACvB,MAAM,SAAS,OAAO,oBACpB,OAAO,OAAO,GACX,MAAM,OAAO,YACZ,OAAO,KAA2C,IAAI,CACxD,EACF,CAAC,CACH;EACA,OAAO,CACL,MACC,UACC,OAAO,IAAI,OAAO,GAAG,MAAM,MAAM,CAAC,IAAI,YAAY,QAAQ,IAAI,CAClE;CACF,CAAC,CACH;CACA,QAAQ,UACN,KACE,eACA,OAAO,QAAQ,GAAG,SAAS,OAAO,OAAO,OAAO,IAAI,CAAC,GACrD,OAAO,KAAK,QAAQ,SAClB,MAAM,UAAU,KAAA,IAAY,OAAO,YAAY,OAAO,MAAM,KAAK,CACnE,GACA,OAAO,GACT;AACJ"}