@confect/server 9.0.0-next.6 → 9.0.0-next.8

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 (159) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/ActionCtx.d.ts +1 -1
  3. package/dist/ActionCtx.js +1 -1
  4. package/dist/ActionCtx.js.map +1 -1
  5. package/dist/ActionRunner.d.ts +6 -4
  6. package/dist/ActionRunner.d.ts.map +1 -1
  7. package/dist/ActionRunner.js +4 -3
  8. package/dist/ActionRunner.js.map +1 -1
  9. package/dist/Auth.d.ts +5 -3
  10. package/dist/Auth.d.ts.map +1 -1
  11. package/dist/Auth.js +5 -1
  12. package/dist/Auth.js.map +1 -1
  13. package/dist/BlobNotFoundError.d.ts +1 -1
  14. package/dist/BlobNotFoundError.d.ts.map +1 -1
  15. package/dist/BlobNotFoundError.js +1 -1
  16. package/dist/BlobNotFoundError.js.map +1 -1
  17. package/dist/ConvexConfigProvider.d.ts +1 -1
  18. package/dist/ConvexConfigProvider.d.ts.map +1 -1
  19. package/dist/ConvexConfigProvider.js +6 -1
  20. package/dist/ConvexConfigProvider.js.map +1 -1
  21. package/dist/CronJob.d.ts +3 -3
  22. package/dist/CronJob.d.ts.map +1 -1
  23. package/dist/CronJob.js +1 -1
  24. package/dist/CronJob.js.map +1 -1
  25. package/dist/CronJobs.d.ts.map +1 -1
  26. package/dist/CronJobs.js +11 -4
  27. package/dist/CronJobs.js.map +1 -1
  28. package/dist/DatabaseReader.d.ts +347 -346
  29. package/dist/DatabaseReader.d.ts.map +1 -1
  30. package/dist/DatabaseReader.js +2 -1
  31. package/dist/DatabaseReader.js.map +1 -1
  32. package/dist/DatabaseSchema.js +1 -1
  33. package/dist/DatabaseSchema.js.map +1 -1
  34. package/dist/DatabaseWriter.d.ts +7 -5
  35. package/dist/DatabaseWriter.d.ts.map +1 -1
  36. package/dist/DatabaseWriter.js +5 -1
  37. package/dist/DatabaseWriter.js.map +1 -1
  38. package/dist/Document.d.ts +2 -1
  39. package/dist/Document.d.ts.map +1 -1
  40. package/dist/Document.js +5 -1
  41. package/dist/Document.js.map +1 -1
  42. package/dist/FunctionImpl.d.ts +2 -1
  43. package/dist/FunctionImpl.d.ts.map +1 -1
  44. package/dist/FunctionImpl.js +4 -1
  45. package/dist/FunctionImpl.js.map +1 -1
  46. package/dist/GroupImpl.d.ts +2 -1
  47. package/dist/GroupImpl.d.ts.map +1 -1
  48. package/dist/GroupImpl.js +9 -1
  49. package/dist/GroupImpl.js.map +1 -1
  50. package/dist/Handler.d.ts +2 -2
  51. package/dist/HttpApi.d.ts +4 -2
  52. package/dist/HttpApi.d.ts.map +1 -1
  53. package/dist/HttpApi.js +7 -2
  54. package/dist/HttpApi.js.map +1 -1
  55. package/dist/MutationCtx.d.ts +1 -1
  56. package/dist/MutationCtx.js +1 -1
  57. package/dist/MutationCtx.js.map +1 -1
  58. package/dist/MutationRunner.d.ts +6 -4
  59. package/dist/MutationRunner.d.ts.map +1 -1
  60. package/dist/MutationRunner.js +4 -3
  61. package/dist/MutationRunner.js.map +1 -1
  62. package/dist/OrderedQuery.d.ts +7 -5
  63. package/dist/OrderedQuery.d.ts.map +1 -1
  64. package/dist/OrderedQuery.js +4 -1
  65. package/dist/OrderedQuery.js.map +1 -1
  66. package/dist/QueryCtx.d.ts +1 -1
  67. package/dist/QueryCtx.js +1 -1
  68. package/dist/QueryCtx.js.map +1 -1
  69. package/dist/QueryInitializer.d.ts +3 -2
  70. package/dist/QueryInitializer.d.ts.map +1 -1
  71. package/dist/QueryInitializer.js +5 -1
  72. package/dist/QueryInitializer.js.map +1 -1
  73. package/dist/QueryRunner.d.ts +6 -4
  74. package/dist/QueryRunner.d.ts.map +1 -1
  75. package/dist/QueryRunner.js +4 -3
  76. package/dist/QueryRunner.js.map +1 -1
  77. package/dist/RegisteredConvexFunction.d.ts +98 -96
  78. package/dist/RegisteredConvexFunction.d.ts.map +1 -1
  79. package/dist/RegisteredConvexFunction.js +6 -1
  80. package/dist/RegisteredConvexFunction.js.map +1 -1
  81. package/dist/RegisteredFunction.d.ts +8 -6
  82. package/dist/RegisteredFunction.d.ts.map +1 -1
  83. package/dist/RegisteredFunction.js +5 -1
  84. package/dist/RegisteredFunction.js.map +1 -1
  85. package/dist/RegisteredFunctions.d.ts.map +1 -1
  86. package/dist/RegisteredFunctions.js +2 -1
  87. package/dist/RegisteredFunctions.js.map +1 -1
  88. package/dist/RegisteredNodeFunction.d.ts.map +1 -1
  89. package/dist/RegisteredNodeFunction.js +3 -2
  90. package/dist/RegisteredNodeFunction.js.map +1 -1
  91. package/dist/RegistryItem.js +1 -1
  92. package/dist/RegistryItem.js.map +1 -1
  93. package/dist/Scheduler.d.ts +12 -8
  94. package/dist/Scheduler.d.ts.map +1 -1
  95. package/dist/Scheduler.js +10 -6
  96. package/dist/Scheduler.js.map +1 -1
  97. package/dist/SchemaToValidator.d.ts +4 -1
  98. package/dist/SchemaToValidator.d.ts.map +1 -1
  99. package/dist/SchemaToValidator.js +13 -1
  100. package/dist/SchemaToValidator.js.map +1 -1
  101. package/dist/StorageActionWriter.d.ts +4 -3
  102. package/dist/StorageActionWriter.d.ts.map +1 -1
  103. package/dist/StorageActionWriter.js +4 -1
  104. package/dist/StorageActionWriter.js.map +1 -1
  105. package/dist/StorageReader.d.ts +3 -2
  106. package/dist/StorageReader.d.ts.map +1 -1
  107. package/dist/StorageReader.js +5 -1
  108. package/dist/StorageReader.js.map +1 -1
  109. package/dist/StorageWriter.d.ts +3 -2
  110. package/dist/StorageWriter.d.ts.map +1 -1
  111. package/dist/StorageWriter.js +4 -1
  112. package/dist/StorageWriter.js.map +1 -1
  113. package/dist/Table.d.ts +15 -15
  114. package/dist/Table.d.ts.map +1 -1
  115. package/dist/Table.js +2 -1
  116. package/dist/Table.js.map +1 -1
  117. package/dist/TableInfo.d.ts +1 -1
  118. package/dist/VectorSearch.d.ts +3 -1
  119. package/dist/VectorSearch.d.ts.map +1 -1
  120. package/dist/VectorSearch.js +3 -1
  121. package/dist/VectorSearch.js.map +1 -1
  122. package/dist/internal/utils.d.ts +3 -2
  123. package/dist/internal/utils.d.ts.map +1 -1
  124. package/dist/internal/utils.js +3 -1
  125. package/dist/internal/utils.js.map +1 -1
  126. package/package.json +2 -2
  127. package/src/ActionCtx.ts +1 -1
  128. package/src/ActionRunner.ts +2 -1
  129. package/src/Auth.ts +5 -1
  130. package/src/BlobNotFoundError.ts +1 -1
  131. package/src/ConvexConfigProvider.ts +6 -8
  132. package/src/CronJob.ts +1 -1
  133. package/src/CronJobs.ts +8 -10
  134. package/src/DatabaseReader.ts +2 -1
  135. package/src/DatabaseSchema.ts +1 -1
  136. package/src/DatabaseWriter.ts +5 -1
  137. package/src/Document.ts +5 -1
  138. package/src/FunctionImpl.ts +4 -1
  139. package/src/GroupImpl.ts +9 -11
  140. package/src/HttpApi.ts +8 -9
  141. package/src/MutationCtx.ts +1 -1
  142. package/src/MutationRunner.ts +2 -1
  143. package/src/OrderedQuery.ts +5 -1
  144. package/src/QueryCtx.ts +1 -1
  145. package/src/QueryInitializer.ts +5 -1
  146. package/src/QueryRunner.ts +2 -1
  147. package/src/RegisteredConvexFunction.ts +6 -1
  148. package/src/RegisteredFunction.ts +5 -1
  149. package/src/RegisteredFunctions.ts +3 -1
  150. package/src/RegisteredNodeFunction.ts +4 -2
  151. package/src/RegistryItem.ts +1 -1
  152. package/src/Scheduler.ts +5 -1
  153. package/src/SchemaToValidator.ts +14 -16
  154. package/src/StorageActionWriter.ts +4 -1
  155. package/src/StorageReader.ts +5 -1
  156. package/src/StorageWriter.ts +4 -1
  157. package/src/Table.ts +2 -1
  158. package/src/VectorSearch.ts +3 -1
  159. package/src/internal/utils.ts +3 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,42 @@
1
1
  # @confect/server
2
2
 
3
+ ## 9.0.0-next.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 3fec285: Import Effect from its submodule paths internally to shrink per-function cold-start bundles.
8
+
9
+ Confect's packages now import Effect modules from their submodule paths (`import * as Schema from "effect/Schema"`) instead of the `"effect"` barrel (`import { Schema } from "effect"`).
10
+
11
+ ### Why
12
+
13
+ A barrel import of a namespace re-export defeats esbuild's tree-shaking: accessing `Schema.X` from `import { Schema } from "effect"` retains the _entire_ `Schema` namespace, because the bundler can't prune property access on the barrel's `export * as Schema`. So every Convex function's cold-start bundle was pulling all of `effect/Schema` and `effect/Stream` — and, transitively through Schema's `Arbitrary`, `fast-check` — whether the function used them or not.
14
+
15
+ Importing from the submodule path tree-shakes normally. On a minimal function this cut the bundle esbuild produces by ~54% (the `effect/Schema` module alone by ~75%) and its cold-start module-evaluation time by ~35%, with `fast-check` dropped entirely. This is also the import style Effect v4 recommends, so it's forward-compatible. A `no-restricted-imports` ESLint rule now enforces it across the codebase (type-only imports and `@effect/vitest` are exempt).
16
+
17
+ No API changes — your existing code keeps working.
18
+
19
+ ### Getting the full win in your own code
20
+
21
+ This change shrinks the Confect code in every function bundle, but a function's bundle also includes your own `confect/tables/*` and `*.spec.ts` files. esbuild retains the union across all importers, so a single barrel import anywhere in a function's module graph re-pins the whole `effect/Schema` namespace and undoes the reduction. To get the full bundle/cold-start savings, import Effect from its submodule paths in your own Confect files too:
22
+
23
+ ```diff
24
+ - import { Schema } from "effect";
25
+ + import * as Schema from "effect/Schema";
26
+ ```
27
+
28
+ Bare helpers (`pipe`, `flow`, `identity`) come from `"effect/Function"`.
29
+
30
+ - Updated dependencies [3fec285]
31
+ - @confect/core@9.0.0-next.8
32
+
33
+ ## 9.0.0-next.7
34
+
35
+ ### Patch Changes
36
+
37
+ - Updated dependencies [5d19484]
38
+ - @confect/core@9.0.0-next.7
39
+
3
40
  ## 9.0.0-next.6
4
41
 
5
42
  ### Major Changes
@@ -1,4 +1,4 @@
1
- import { Context } from "effect";
1
+ import * as Context from "effect/Context";
2
2
  import { GenericActionCtx, GenericDataModel } from "convex/server";
3
3
 
4
4
  //#region src/ActionCtx.d.ts
package/dist/ActionCtx.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Context } from "effect";
2
+ import * as Context from "effect/Context";
3
3
 
4
4
  //#region src/ActionCtx.ts
5
5
  var ActionCtx_exports = /* @__PURE__ */ __exportAll({ ActionCtx: () => ActionCtx });
@@ -1 +1 @@
1
- {"version":3,"file":"ActionCtx.js","names":[],"sources":["../src/ActionCtx.ts"],"sourcesContent":["import type { GenericActionCtx, GenericDataModel } from \"convex/server\";\nimport { Context } from \"effect\";\n\nexport const ActionCtx = <DataModel extends GenericDataModel>() =>\n Context.GenericTag<GenericActionCtx<DataModel>>(\"@confect/server/ActionCtx\");\n\nexport type ActionCtx<DataModel extends GenericDataModel> = ReturnType<\n typeof ActionCtx<DataModel>\n>[\"Identifier\"];\n"],"mappings":";;;;;AAGA,MAAa,kBACX,QAAQ,WAAwC,4BAA4B"}
1
+ {"version":3,"file":"ActionCtx.js","names":[],"sources":["../src/ActionCtx.ts"],"sourcesContent":["import type { GenericActionCtx, GenericDataModel } from \"convex/server\";\nimport * as Context from \"effect/Context\";\n\nexport const ActionCtx = <DataModel extends GenericDataModel>() =>\n Context.GenericTag<GenericActionCtx<DataModel>>(\"@confect/server/ActionCtx\");\n\nexport type ActionCtx<DataModel extends GenericDataModel> = ReturnType<\n typeof ActionCtx<DataModel>\n>[\"Identifier\"];\n"],"mappings":";;;;;AAGA,MAAa,kBACX,QAAQ,WAAwC,4BAA4B"}
@@ -1,14 +1,16 @@
1
- import { Context, Effect, Layer, ParseResult } from "effect";
2
- import * as Ref$1 from "@confect/core/Ref";
1
+ import * as Context from "effect/Context";
2
+ import * as Ref from "@confect/core/Ref";
3
3
  import { GenericActionCtx } from "convex/server";
4
+ import * as Layer$1 from "effect/Layer";
5
+ import { Effect, ParseResult } from "effect";
4
6
 
5
7
  //#region src/ActionRunner.d.ts
6
8
  declare namespace ActionRunner_d_exports {
7
9
  export { ActionRunner, layer };
8
10
  }
9
- declare const ActionRunner: Context.Tag<(<Action extends Ref$1.AnyAction>(action: Action, ...args: Ref$1.OptionalArgs<Action>) => Effect.Effect<Ref$1.Returns<Action>, Ref$1.Error<Action> | ParseResult.ParseError>), <Action extends Ref$1.AnyAction>(action: Action, ...args: Ref$1.OptionalArgs<Action>) => Effect.Effect<Ref$1.Returns<Action>, Ref$1.Error<Action> | ParseResult.ParseError>>;
11
+ declare const ActionRunner: Context.Tag<(<Action extends Ref.AnyAction>(action: Action, ...args: Ref.OptionalArgs<Action>) => Effect.Effect<Ref.Returns<Action>, Ref.Error<Action> | ParseResult.ParseError>), <Action extends Ref.AnyAction>(action: Action, ...args: Ref.OptionalArgs<Action>) => Effect.Effect<Ref.Returns<Action>, Ref.Error<Action> | ParseResult.ParseError>>;
10
12
  type ActionRunner = typeof ActionRunner.Identifier;
11
- declare const layer: (runAction: GenericActionCtx<any>["runAction"]) => Layer.Layer<(<Action extends Ref$1.AnyAction>(action: Action, ...args: Ref$1.OptionalArgs<Action>) => Effect.Effect<Ref$1.Returns<Action>, Ref$1.Error<Action> | ParseResult.ParseError>), never, never>;
13
+ declare const layer: (runAction: GenericActionCtx<any>["runAction"]) => Layer$1.Layer<(<Action extends Ref.AnyAction>(action: Action, ...args: Ref.OptionalArgs<Action>) => Effect.Effect<Ref.Returns<Action>, Ref.Error<Action> | ParseResult.ParseError>), never, never>;
12
14
  //#endregion
13
15
  export { ActionRunner, ActionRunner_d_exports, layer };
14
16
  //# sourceMappingURL=ActionRunner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ActionRunner.d.ts","names":[],"sources":["../src/ActionRunner.ts"],"mappings":";;;;;;;;cAqBa,YAAA,EAAY,OAAA,CAAA,GAAA,kBAdP,KAAA,CAAI,SAAA,EAAS,MAAA,EACnB,MAAA,KAAM,IAAA,EACL,KAAA,CAAI,YAAA,CAAa,MAAA,MACzB,MAAA,CAAO,MAAA,CACR,KAAA,CAAI,OAAA,CAAQ,MAAA,GACZ,KAAA,CAAI,KAAA,CAAM,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CAAA,KAAA,kBAnBjD,GAAA,CAAI,SAAA,EAAS,MAAA,EACnB,MAAA,KAAM,IAAA,EACL,GAAA,CAAI,YAAA,CAAa,MAAA,MACzB,MAAA,CAAO,MAAA,CACR,GAAA,CAAI,OAAA,CAAQ,MAAA,GACZ,GAAA,CAAI,KAAA,CAAM,MAAA,IAAU,WAAA,CAAY,UAAA"}
@@ -1,14 +1,15 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Context, Layer } from "effect";
3
- import * as Ref$1 from "@confect/core/Ref";
2
+ import * as Context from "effect/Context";
3
+ import * as Ref from "@confect/core/Ref";
4
4
  import "convex/server";
5
+ import * as Layer from "effect/Layer";
5
6
 
6
7
  //#region src/ActionRunner.ts
7
8
  var ActionRunner_exports = /* @__PURE__ */ __exportAll({
8
9
  ActionRunner: () => ActionRunner,
9
10
  layer: () => layer
10
11
  });
11
- const make = (runAction) => (action, ...args) => Ref$1.runWithCodec(action, args[0] ?? {}, (functionReference, encodedArgs) => runAction(functionReference, encodedArgs));
12
+ const make = (runAction) => (action, ...args) => Ref.runWithCodec(action, args[0] ?? {}, (functionReference, encodedArgs) => runAction(functionReference, encodedArgs));
12
13
  const ActionRunner = Context.GenericTag("@confect/server/ActionRunner");
13
14
  const layer = (runAction) => Layer.succeed(ActionRunner, make(runAction));
14
15
 
@@ -1 +1 @@
1
- {"version":3,"file":"ActionRunner.js","names":["Ref"],"sources":["../src/ActionRunner.ts"],"sourcesContent":["import * as Ref from \"@confect/core/Ref\";\nimport { type GenericActionCtx } from \"convex/server\";\nimport type { ParseResult, Effect } from \"effect\";\nimport { Context, Layer } from \"effect\";\n\nconst make =\n (runAction: GenericActionCtx<any>[\"runAction\"]) =>\n <Action extends Ref.AnyAction>(\n action: Action,\n ...args: Ref.OptionalArgs<Action>\n ): Effect.Effect<\n Ref.Returns<Action>,\n Ref.Error<Action> | ParseResult.ParseError\n > =>\n Ref.runWithCodec(\n action,\n (args[0] ?? {}) as Ref.Args<Action>,\n (functionReference, encodedArgs) =>\n runAction(functionReference, encodedArgs),\n );\n\nexport const ActionRunner = Context.GenericTag<ReturnType<typeof make>>(\n \"@confect/server/ActionRunner\",\n);\nexport type ActionRunner = typeof ActionRunner.Identifier;\n\nexport const layer = (runAction: GenericActionCtx<any>[\"runAction\"]) =>\n Layer.succeed(ActionRunner, make(runAction));\n"],"mappings":";;;;;;;;;;AAKA,MAAM,QACH,eAEC,QACA,GAAG,SAKHA,MAAI,aACF,QACC,KAAK,MAAM,EAAE,GACb,mBAAmB,gBAClB,UAAU,mBAAmB,YAAY,CAC5C;AAEL,MAAa,eAAe,QAAQ,WAClC,+BACD;AAGD,MAAa,SAAS,cACpB,MAAM,QAAQ,cAAc,KAAK,UAAU,CAAC"}
1
+ {"version":3,"file":"ActionRunner.js","names":[],"sources":["../src/ActionRunner.ts"],"sourcesContent":["import * as Ref from \"@confect/core/Ref\";\nimport { type GenericActionCtx } from \"convex/server\";\nimport type { ParseResult, Effect } from \"effect\";\nimport * as Context from \"effect/Context\";\nimport * as Layer from \"effect/Layer\";\n\nconst make =\n (runAction: GenericActionCtx<any>[\"runAction\"]) =>\n <Action extends Ref.AnyAction>(\n action: Action,\n ...args: Ref.OptionalArgs<Action>\n ): Effect.Effect<\n Ref.Returns<Action>,\n Ref.Error<Action> | ParseResult.ParseError\n > =>\n Ref.runWithCodec(\n action,\n (args[0] ?? {}) as Ref.Args<Action>,\n (functionReference, encodedArgs) =>\n runAction(functionReference, encodedArgs),\n );\n\nexport const ActionRunner = Context.GenericTag<ReturnType<typeof make>>(\n \"@confect/server/ActionRunner\",\n);\nexport type ActionRunner = typeof ActionRunner.Identifier;\n\nexport const layer = (runAction: GenericActionCtx<any>[\"runAction\"]) =>\n Layer.succeed(ActionRunner, make(runAction));\n"],"mappings":";;;;;;;;;;;AAMA,MAAM,QACH,eAEC,QACA,GAAG,SAKH,IAAI,aACF,QACC,KAAK,MAAM,EAAE,GACb,mBAAmB,gBAClB,UAAU,mBAAmB,YAAY,CAC5C;AAEL,MAAa,eAAe,QAAQ,WAClC,+BACD;AAGD,MAAa,SAAS,cACpB,MAAM,QAAQ,cAAc,KAAK,UAAU,CAAC"}
package/dist/Auth.d.ts CHANGED
@@ -1,7 +1,9 @@
1
- import { Effect, Layer, Schema } from "effect";
1
+ import * as effect_Context0 from "effect/Context";
2
2
  import * as convex_server0 from "convex/server";
3
3
  import { Auth as Auth$1 } from "convex/server";
4
- import * as effect_Context0 from "effect/Context";
4
+ import * as Layer from "effect/Layer";
5
+ import * as Effect from "effect/Effect";
6
+ import * as Schema from "effect/Schema";
5
7
  import * as effect_Cause0 from "effect/Cause";
6
8
 
7
9
  //#region src/Auth.d.ts
@@ -15,7 +17,7 @@ declare const Auth_base: effect_Context0.TagClass<Auth, "@confect/server/Auth",
15
17
  }> & {
16
18
  use: <X>(body: (_: {
17
19
  getUserIdentity: Effect.Effect<convex_server0.UserIdentity, NoUserIdentityFoundError, never>;
18
- }) => X) => [X] extends [Effect.Effect<infer A, infer E, infer R>] ? Effect.Effect<A, E, Auth | R> : [X] extends [PromiseLike<infer A_1>] ? Effect.Effect<A_1, effect_Cause0.UnknownException, Auth> : Effect.Effect<X, never, Auth>;
20
+ }) => X) => [X] extends [Effect.Effect<infer A, infer E, infer R>] ? Effect.Effect<A, E, R | Auth> : [X] extends [PromiseLike<infer A_1>] ? Effect.Effect<A_1, effect_Cause0.UnknownException, Auth> : Effect.Effect<X, never, Auth>;
19
21
  };
20
22
  declare class Auth extends Auth_base {}
21
23
  declare const layer: (auth: Auth$1) => Layer.Layer<Auth, never, never>;
@@ -1 +1 @@
1
- {"version":3,"file":"Auth.d.ts","names":[],"sources":["../src/Auth.ts"],"mappings":";;;;;;;;;;cAC6D,SAAA;;;;;;;;;cAgBhD,IAAA,SAAa,SAAA;AAAA,cAKb,KAAA,GAAS,IAAA,EAAM,MAAA,KAAU,KAAA,CAAA,KAAA,CAAA,IAAA;AAAA,cAAqC,6BAAA;;;cAE9D,wBAAA,SAAiC,6BAAA;EAAA,IAI/B,OAAA,CAAA;AAAA"}
1
+ {"version":3,"file":"Auth.d.ts","names":[],"sources":["../src/Auth.ts"],"mappings":";;;;;;;;;;;;cAKwC,SAAA;;;;;;;;;cAgB3B,IAAA,SAAa,SAAA;AAAA,cAKb,KAAA,GAAS,IAAA,EAAM,MAAA,KAAU,KAAA,CAAA,KAAA,CAAA,IAAA;AAAA,cAAqC,6BAAA;;;cAE9D,wBAAA,SAAiC,6BAAA;EAAA,IAI/B,OAAA,CAAA;AAAA"}
package/dist/Auth.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Effect, Layer, Option, Schema, flow } from "effect";
2
+ import * as Layer from "effect/Layer";
3
+ import { flow } from "effect/Function";
4
+ import * as Effect from "effect/Effect";
5
+ import * as Option from "effect/Option";
6
+ import * as Schema from "effect/Schema";
3
7
 
4
8
  //#region src/Auth.ts
5
9
  var Auth_exports = /* @__PURE__ */ __exportAll({
package/dist/Auth.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Auth.js","names":[],"sources":["../src/Auth.ts"],"sourcesContent":["import type { Auth as ConvexAuth } from \"convex/server\";\nimport { Effect, flow, Layer, Option, Schema } from \"effect\";\n\nconst make = (auth: ConvexAuth) => ({\n getUserIdentity: Effect.promise(() => auth.getUserIdentity()).pipe(\n Effect.andThen(\n flow(\n Option.fromNullable,\n Option.match({\n onNone: () => Effect.fail(new NoUserIdentityFoundError()),\n onSome: Effect.succeed,\n }),\n ),\n ),\n ),\n});\n\nexport class Auth extends Effect.Tag(\"@confect/server/Auth\")<\n Auth,\n ReturnType<typeof make>\n>() {}\n\nexport const layer = (auth: ConvexAuth) => Layer.succeed(Auth, make(auth));\n\nexport class NoUserIdentityFoundError extends Schema.TaggedError<NoUserIdentityFoundError>()(\n \"NoUserIdentityFoundError\",\n {},\n) {\n override get message(): string {\n return \"No user identity found\";\n }\n}\n"],"mappings":";;;;;;;;;AAGA,MAAM,QAAQ,UAAsB,EAClC,iBAAiB,OAAO,cAAc,KAAK,iBAAiB,CAAC,CAAC,KAC5D,OAAO,QACL,KACE,OAAO,cACP,OAAO,MAAM;CACX,cAAc,OAAO,KAAK,IAAI,0BAA0B,CAAC;CACzD,QAAQ,OAAO;CAChB,CAAC,CACH,CACF,CACF,EACF;AAED,IAAa,OAAb,cAA0B,OAAO,IAAI,uBAAuB,EAGzD,CAAC;AAEJ,MAAa,SAAS,SAAqB,MAAM,QAAQ,MAAM,KAAK,KAAK,CAAC;AAE1E,IAAa,2BAAb,cAA8C,OAAO,aAAuC,CAC1F,4BACA,EAAE,CACH,CAAC;CACA,IAAa,UAAkB;AAC7B,SAAO"}
1
+ {"version":3,"file":"Auth.js","names":[],"sources":["../src/Auth.ts"],"sourcesContent":["import type { Auth as ConvexAuth } from \"convex/server\";\nimport { flow } from \"effect/Function\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\n\nconst make = (auth: ConvexAuth) => ({\n getUserIdentity: Effect.promise(() => auth.getUserIdentity()).pipe(\n Effect.andThen(\n flow(\n Option.fromNullable,\n Option.match({\n onNone: () => Effect.fail(new NoUserIdentityFoundError()),\n onSome: Effect.succeed,\n }),\n ),\n ),\n ),\n});\n\nexport class Auth extends Effect.Tag(\"@confect/server/Auth\")<\n Auth,\n ReturnType<typeof make>\n>() {}\n\nexport const layer = (auth: ConvexAuth) => Layer.succeed(Auth, make(auth));\n\nexport class NoUserIdentityFoundError extends Schema.TaggedError<NoUserIdentityFoundError>()(\n \"NoUserIdentityFoundError\",\n {},\n) {\n override get message(): string {\n return \"No user identity found\";\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAOA,MAAM,QAAQ,UAAsB,EAClC,iBAAiB,OAAO,cAAc,KAAK,iBAAiB,CAAC,CAAC,KAC5D,OAAO,QACL,KACE,OAAO,cACP,OAAO,MAAM;CACX,cAAc,OAAO,KAAK,IAAI,0BAA0B,CAAC;CACzD,QAAQ,OAAO;CAChB,CAAC,CACH,CACF,CACF,EACF;AAED,IAAa,OAAb,cAA0B,OAAO,IAAI,uBAAuB,EAGzD,CAAC;AAEJ,MAAa,SAAS,SAAqB,MAAM,QAAQ,MAAM,KAAK,KAAK,CAAC;AAE1E,IAAa,2BAAb,cAA8C,OAAO,aAAuC,CAC1F,4BACA,EAAE,CACH,CAAC;CACA,IAAa,UAAkB;AAC7B,SAAO"}
@@ -1,4 +1,4 @@
1
- import { Schema } from "effect";
1
+ import * as Schema from "effect/Schema";
2
2
 
3
3
  //#region src/BlobNotFoundError.d.ts
4
4
  declare namespace BlobNotFoundError_d_exports {
@@ -1 +1 @@
1
- {"version":3,"file":"BlobNotFoundError.d.ts","names":[],"sources":["../src/BlobNotFoundError.ts"],"mappings":";;;;;;cAAgC,sBAAA;;;;;cAEnB,iBAAA,SAA0B,sBAAA;EAAA,IAMxB,OAAA,CAAA;AAAA"}
1
+ {"version":3,"file":"BlobNotFoundError.d.ts","names":[],"sources":["../src/BlobNotFoundError.ts"],"mappings":";;;;;;cAAwC,sBAAA;;;;;cAE3B,iBAAA,SAA0B,sBAAA;EAAA,IAMxB,OAAA,CAAA;AAAA"}
@@ -1,5 +1,5 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Schema } from "effect";
2
+ import * as Schema from "effect/Schema";
3
3
 
4
4
  //#region src/BlobNotFoundError.ts
5
5
  var BlobNotFoundError_exports = /* @__PURE__ */ __exportAll({ BlobNotFoundError: () => BlobNotFoundError });
@@ -1 +1 @@
1
- {"version":3,"file":"BlobNotFoundError.js","names":[],"sources":["../src/BlobNotFoundError.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nexport class BlobNotFoundError extends Schema.TaggedError<BlobNotFoundError>()(\n \"BlobNotFoundError\",\n {\n id: Schema.String,\n },\n) {\n override get message(): string {\n return `File with ID '${this.id}' not found`;\n }\n}\n"],"mappings":";;;;;AAEA,IAAa,oBAAb,cAAuC,OAAO,aAAgC,CAC5E,qBACA,EACE,IAAI,OAAO,QACZ,CACF,CAAC;CACA,IAAa,UAAkB;AAC7B,SAAO,iBAAiB,KAAK,GAAG"}
1
+ {"version":3,"file":"BlobNotFoundError.js","names":[],"sources":["../src/BlobNotFoundError.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\nexport class BlobNotFoundError extends Schema.TaggedError<BlobNotFoundError>()(\n \"BlobNotFoundError\",\n {\n id: Schema.String,\n },\n) {\n override get message(): string {\n return `File with ID '${this.id}' not found`;\n }\n}\n"],"mappings":";;;;;AAEA,IAAa,oBAAb,cAAuC,OAAO,aAAgC,CAC5E,qBACA,EACE,IAAI,OAAO,QACZ,CACF,CAAC;CACA,IAAa,UAAkB;AAC7B,SAAO,iBAAiB,KAAK,GAAG"}
@@ -1,4 +1,4 @@
1
- import { ConfigProvider } from "effect";
1
+ import * as ConfigProvider from "effect/ConfigProvider";
2
2
 
3
3
  //#region src/ConvexConfigProvider.d.ts
4
4
  declare namespace ConvexConfigProvider_d_exports {
@@ -1 +1 @@
1
- {"version":3,"file":"ConvexConfigProvider.d.ts","names":[],"sources":["../src/ConvexConfigProvider.ts"],"mappings":";;;;;;cAWa,IAAA,GACX,OAAA,GAAU,OAAA,CAAQ,cAAA,CAAe,cAAA,CAAe,aAAA,MAC/C,cAAA,CAAe,cAAA"}
1
+ {"version":3,"file":"ConvexConfigProvider.d.ts","names":[],"sources":["../src/ConvexConfigProvider.ts"],"mappings":";;;;;;cASa,IAAA,GACX,OAAA,GAAU,OAAA,CAAQ,cAAA,CAAe,cAAA,CAAe,aAAA,MAC/C,cAAA,CAAe,cAAA"}
@@ -1,5 +1,10 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Array, ConfigError, ConfigProvider, ConfigProviderPathPatch, Effect, pipe } from "effect";
2
+ import { pipe } from "effect/Function";
3
+ import * as Effect from "effect/Effect";
4
+ import * as Array from "effect/Array";
5
+ import * as ConfigError from "effect/ConfigError";
6
+ import * as ConfigProvider from "effect/ConfigProvider";
7
+ import * as ConfigProviderPathPatch from "effect/ConfigProviderPathPatch";
3
8
 
4
9
  //#region src/ConvexConfigProvider.ts
5
10
  var ConvexConfigProvider_exports = /* @__PURE__ */ __exportAll({ make: () => make });
@@ -1 +1 @@
1
- {"version":3,"file":"ConvexConfigProvider.js","names":[],"sources":["../src/ConvexConfigProvider.ts"],"sourcesContent":["import {\n Array,\n ConfigError,\n ConfigProvider,\n ConfigProviderPathPatch,\n Effect,\n pipe,\n} from \"effect\";\n\ndeclare const process: { env: Record<string, string | undefined> };\n\nexport const make = (\n options?: Partial<ConfigProvider.ConfigProvider.FromEnvConfig>,\n): ConfigProvider.ConfigProvider => {\n const pathDelim = options?.pathDelim ?? \"_\";\n const seqDelim = options?.seqDelim ?? \",\";\n\n return ConfigProvider.fromFlat(\n ConfigProvider.makeFlat({\n load: (path, primitive, split = true) => {\n const pathString = Array.join(path, pathDelim);\n const value = process.env[pathString];\n\n if (value === undefined) {\n return Effect.fail(\n ConfigError.MissingData(\n [...path],\n `Expected ${pathString} to exist in the process context`,\n ),\n );\n }\n\n const parse = (text: string) =>\n pipe(\n primitive.parse(text.trim()),\n Effect.mapError(ConfigError.prefixed([...path])),\n );\n\n if (!split) {\n return pipe(parse(value), Effect.map(Array.of));\n } else {\n return pipe(\n value.split(seqDelim),\n Effect.forEach((v) => parse(v)),\n );\n }\n },\n enumerateChildren: (path) =>\n Effect.fail(\n ConfigError.Unsupported(\n [...path],\n \"process.env is not enumerable in the Convex runtime\",\n ),\n ),\n patch: ConfigProviderPathPatch.empty,\n }),\n );\n};\n"],"mappings":";;;;;AAWA,MAAa,QACX,YACkC;CAClC,MAAM,YAAY,SAAS,aAAa;CACxC,MAAM,WAAW,SAAS,YAAY;AAEtC,QAAO,eAAe,SACpB,eAAe,SAAS;EACtB,OAAO,MAAM,WAAW,QAAQ,SAAS;GACvC,MAAM,aAAa,MAAM,KAAK,MAAM,UAAU;GAC9C,MAAM,QAAQ,QAAQ,IAAI;AAE1B,OAAI,UAAU,OACZ,QAAO,OAAO,KACZ,YAAY,YACV,CAAC,GAAG,KAAK,EACT,YAAY,WAAW,kCACxB,CACF;GAGH,MAAM,SAAS,SACb,KACE,UAAU,MAAM,KAAK,MAAM,CAAC,EAC5B,OAAO,SAAS,YAAY,SAAS,CAAC,GAAG,KAAK,CAAC,CAAC,CACjD;AAEH,OAAI,CAAC,MACH,QAAO,KAAK,MAAM,MAAM,EAAE,OAAO,IAAI,MAAM,GAAG,CAAC;OAE/C,QAAO,KACL,MAAM,MAAM,SAAS,EACrB,OAAO,SAAS,MAAM,MAAM,EAAE,CAAC,CAChC;;EAGL,oBAAoB,SAClB,OAAO,KACL,YAAY,YACV,CAAC,GAAG,KAAK,EACT,sDACD,CACF;EACH,OAAO,wBAAwB;EAChC,CAAC,CACH"}
1
+ {"version":3,"file":"ConvexConfigProvider.js","names":[],"sources":["../src/ConvexConfigProvider.ts"],"sourcesContent":["import { pipe } from \"effect/Function\";\nimport * as Array from \"effect/Array\";\nimport * as ConfigError from \"effect/ConfigError\";\nimport * as ConfigProvider from \"effect/ConfigProvider\";\nimport * as ConfigProviderPathPatch from \"effect/ConfigProviderPathPatch\";\nimport * as Effect from \"effect/Effect\";\n\ndeclare const process: { env: Record<string, string | undefined> };\n\nexport const make = (\n options?: Partial<ConfigProvider.ConfigProvider.FromEnvConfig>,\n): ConfigProvider.ConfigProvider => {\n const pathDelim = options?.pathDelim ?? \"_\";\n const seqDelim = options?.seqDelim ?? \",\";\n\n return ConfigProvider.fromFlat(\n ConfigProvider.makeFlat({\n load: (path, primitive, split = true) => {\n const pathString = Array.join(path, pathDelim);\n const value = process.env[pathString];\n\n if (value === undefined) {\n return Effect.fail(\n ConfigError.MissingData(\n [...path],\n `Expected ${pathString} to exist in the process context`,\n ),\n );\n }\n\n const parse = (text: string) =>\n pipe(\n primitive.parse(text.trim()),\n Effect.mapError(ConfigError.prefixed([...path])),\n );\n\n if (!split) {\n return pipe(parse(value), Effect.map(Array.of));\n } else {\n return pipe(\n value.split(seqDelim),\n Effect.forEach((v) => parse(v)),\n );\n }\n },\n enumerateChildren: (path) =>\n Effect.fail(\n ConfigError.Unsupported(\n [...path],\n \"process.env is not enumerable in the Convex runtime\",\n ),\n ),\n patch: ConfigProviderPathPatch.empty,\n }),\n );\n};\n"],"mappings":";;;;;;;;;;AASA,MAAa,QACX,YACkC;CAClC,MAAM,YAAY,SAAS,aAAa;CACxC,MAAM,WAAW,SAAS,YAAY;AAEtC,QAAO,eAAe,SACpB,eAAe,SAAS;EACtB,OAAO,MAAM,WAAW,QAAQ,SAAS;GACvC,MAAM,aAAa,MAAM,KAAK,MAAM,UAAU;GAC9C,MAAM,QAAQ,QAAQ,IAAI;AAE1B,OAAI,UAAU,OACZ,QAAO,OAAO,KACZ,YAAY,YACV,CAAC,GAAG,KAAK,EACT,YAAY,WAAW,kCACxB,CACF;GAGH,MAAM,SAAS,SACb,KACE,UAAU,MAAM,KAAK,MAAM,CAAC,EAC5B,OAAO,SAAS,YAAY,SAAS,CAAC,GAAG,KAAK,CAAC,CAAC,CACjD;AAEH,OAAI,CAAC,MACH,QAAO,KAAK,MAAM,MAAM,EAAE,OAAO,IAAI,MAAM,GAAG,CAAC;OAE/C,QAAO,KACL,MAAM,MAAM,SAAS,EACrB,OAAO,SAAS,MAAM,MAAM,EAAE,CAAC,CAChC;;EAGL,oBAAoB,SAClB,OAAO,KACL,YAAY,YACV,CAAC,GAAG,KAAK,EACT,sDACD,CACF;EACH,OAAO,wBAAwB;EAChC,CAAC,CACH"}
package/dist/CronJob.d.ts CHANGED
@@ -1,5 +1,5 @@
1
+ import { Ref } from "@confect/core";
1
2
  import { Cron, Duration } from "effect";
2
- import { Ref as Ref$1 } from "@confect/core";
3
3
 
4
4
  //#region src/CronJob.d.ts
5
5
  declare namespace CronJob_d_exports {
@@ -11,11 +11,11 @@ interface CronJob {
11
11
  readonly [TypeId]: TypeId;
12
12
  readonly identifier: string;
13
13
  readonly schedule: Cron.Cron | Duration.Duration;
14
- readonly ref: Ref$1.AnyMutation | Ref$1.AnyAction;
14
+ readonly ref: Ref.AnyMutation | Ref.AnyAction;
15
15
  readonly args: Record<string, unknown>;
16
16
  }
17
17
  declare const isCronJob: (u: unknown) => u is CronJob;
18
- declare const make: <R extends Ref$1.AnyMutation | Ref$1.AnyAction>(identifier: string, schedule: Cron.Cron | Duration.Duration, ref: R, ...args: Ref$1.OptionalArgs<R>) => CronJob;
18
+ declare const make: <R extends Ref.AnyMutation | Ref.AnyAction>(identifier: string, schedule: Cron.Cron | Duration.Duration, ref: R, ...args: Ref.OptionalArgs<R>) => CronJob;
19
19
  //#endregion
20
20
  export { CronJob, CronJob_d_exports, TypeId, isCronJob, make };
21
21
  //# sourceMappingURL=CronJob.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CronJob.d.ts","names":[],"sources":["../src/CronJob.ts"],"mappings":";;;;;;;cAIa,MAAA;AAAA,KACD,MAAA,UAAgB,MAAA;AAAA,UAEX,OAAA;EAAA,UACL,MAAA,GAAS,MAAA;EAAA,SAEV,UAAA;EAAA,SACA,QAAA,EAAU,IAAA,CAAK,IAAA,GAAO,QAAA,CAAS,QAAA;EAAA,SAC/B,GAAA,EAAK,KAAA,CAAI,WAAA,GAAc,KAAA,CAAI,SAAA;EAAA,SAC3B,IAAA,EAAM,MAAA;AAAA;AAAA,cAGJ,SAAA,GAAa,CAAA,cAAa,CAAA,IAAK,OAAA;AAAA,cAoB/B,IAAA,aAAkB,KAAA,CAAI,WAAA,GAAc,KAAA,CAAI,SAAA,EACnD,UAAA,UACA,QAAA,EAAU,IAAA,CAAK,IAAA,GAAO,QAAA,CAAS,QAAA,EAC/B,GAAA,EAAK,CAAA,KACF,IAAA,EAAM,KAAA,CAAI,YAAA,CAAa,CAAA,MACzB,OAAA"}
1
+ {"version":3,"file":"CronJob.d.ts","names":[],"sources":["../src/CronJob.ts"],"mappings":";;;;;;;cAIa,MAAA;AAAA,KACD,MAAA,UAAgB,MAAA;AAAA,UAEX,OAAA;EAAA,UACL,MAAA,GAAS,MAAA;EAAA,SAEV,UAAA;EAAA,SACA,QAAA,EAAU,IAAA,CAAK,IAAA,GAAO,QAAA,CAAS,QAAA;EAAA,SAC/B,GAAA,EAAK,GAAA,CAAI,WAAA,GAAc,GAAA,CAAI,SAAA;EAAA,SAC3B,IAAA,EAAM,MAAA;AAAA;AAAA,cAGJ,SAAA,GAAa,CAAA,cAAa,CAAA,IAAK,OAAA;AAAA,cAoB/B,IAAA,aAAkB,GAAA,CAAI,WAAA,GAAc,GAAA,CAAI,SAAA,EACnD,UAAA,UACA,QAAA,EAAU,IAAA,CAAK,IAAA,GAAO,QAAA,CAAS,QAAA,EAC/B,GAAA,EAAK,CAAA,KACF,IAAA,EAAM,GAAA,CAAI,YAAA,CAAa,CAAA,MACzB,OAAA"}
package/dist/CronJob.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Predicate } from "effect";
2
+ import * as Predicate from "effect/Predicate";
3
3
 
4
4
  //#region src/CronJob.ts
5
5
  var CronJob_exports = /* @__PURE__ */ __exportAll({
@@ -1 +1 @@
1
- {"version":3,"file":"CronJob.js","names":[],"sources":["../src/CronJob.ts"],"sourcesContent":["import type { Ref } from \"@confect/core\";\nimport type { Cron, Duration } from \"effect\";\nimport { Predicate } from \"effect\";\n\nexport const TypeId = \"@confect/server/CronJob\";\nexport type TypeId = typeof TypeId;\n\nexport interface CronJob {\n readonly [TypeId]: TypeId;\n\n readonly identifier: string;\n readonly schedule: Cron.Cron | Duration.Duration;\n readonly ref: Ref.AnyMutation | Ref.AnyAction;\n readonly args: Record<string, unknown>;\n}\n\nexport const isCronJob = (u: unknown): u is CronJob =>\n Predicate.hasProperty(u, TypeId);\n\nconst Proto = {\n [TypeId]: TypeId,\n};\n\nconst makeProto = (\n identifier: string,\n schedule: Cron.Cron | Duration.Duration,\n ref: Ref.AnyMutation | Ref.AnyAction,\n args: Record<string, unknown>,\n): CronJob =>\n Object.assign(Object.create(Proto), {\n identifier,\n schedule,\n ref,\n args,\n });\n\nexport const make = <R extends Ref.AnyMutation | Ref.AnyAction>(\n identifier: string,\n schedule: Cron.Cron | Duration.Duration,\n ref: R,\n ...args: Ref.OptionalArgs<R>\n): CronJob => makeProto(identifier, schedule, ref, args[0] ?? {});\n"],"mappings":";;;;;;;;;AAIA,MAAa,SAAS;AAYtB,MAAa,aAAa,MACxB,UAAU,YAAY,GAAG,OAAO;AAElC,MAAM,QAAQ,GACX,SAAS,QACX;AAED,MAAM,aACJ,YACA,UACA,KACA,SAEA,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;CAClC;CACA;CACA;CACA;CACD,CAAC;AAEJ,MAAa,QACX,YACA,UACA,KACA,GAAG,SACS,UAAU,YAAY,UAAU,KAAK,KAAK,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"CronJob.js","names":[],"sources":["../src/CronJob.ts"],"sourcesContent":["import type { Ref } from \"@confect/core\";\nimport type { Cron, Duration } from \"effect\";\nimport * as Predicate from \"effect/Predicate\";\n\nexport const TypeId = \"@confect/server/CronJob\";\nexport type TypeId = typeof TypeId;\n\nexport interface CronJob {\n readonly [TypeId]: TypeId;\n\n readonly identifier: string;\n readonly schedule: Cron.Cron | Duration.Duration;\n readonly ref: Ref.AnyMutation | Ref.AnyAction;\n readonly args: Record<string, unknown>;\n}\n\nexport const isCronJob = (u: unknown): u is CronJob =>\n Predicate.hasProperty(u, TypeId);\n\nconst Proto = {\n [TypeId]: TypeId,\n};\n\nconst makeProto = (\n identifier: string,\n schedule: Cron.Cron | Duration.Duration,\n ref: Ref.AnyMutation | Ref.AnyAction,\n args: Record<string, unknown>,\n): CronJob =>\n Object.assign(Object.create(Proto), {\n identifier,\n schedule,\n ref,\n args,\n });\n\nexport const make = <R extends Ref.AnyMutation | Ref.AnyAction>(\n identifier: string,\n schedule: Cron.Cron | Duration.Duration,\n ref: R,\n ...args: Ref.OptionalArgs<R>\n): CronJob => makeProto(identifier, schedule, ref, args[0] ?? {});\n"],"mappings":";;;;;;;;;AAIA,MAAa,SAAS;AAYtB,MAAa,aAAa,MACxB,UAAU,YAAY,GAAG,OAAO;AAElC,MAAM,QAAQ,GACX,SAAS,QACX;AAED,MAAM,aACJ,YACA,UACA,KACA,SAEA,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;CAClC;CACA;CACA;CACA;CACD,CAAC;AAEJ,MAAa,QACX,YACA,UACA,KACA,GAAG,SACS,UAAU,YAAY,UAAU,KAAK,KAAK,MAAM,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"CronJobs.d.ts","names":[],"sources":["../src/CronJobs.ts"],"mappings":";;;;;;;cAea,MAAA;AAAA,KACD,MAAA,UAAgB,MAAA;AAAA,UAEX,QAAA;EAAA,UACL,MAAA,GAAS,MAAA;EAAA,SACV,QAAA,EAAU,MAAA,SAAe,OAAA;EAAA,SACzB,cAAA,EAAgB,KAAA;EAEzB,GAAA,CAAI,IAAA,EAAM,OAAA,GAAkB,QAAA;AAAA;AAAA,cAGjB,UAAA,GAAc,CAAA,cAAa,CAAA,IAAK,QAAA;AAAA,cAkDhC,IAAA,QAAW,QAAA"}
1
+ {"version":3,"file":"CronJobs.d.ts","names":[],"sources":["../src/CronJobs.ts"],"mappings":";;;;;;;cAaa,MAAA;AAAA,KACD,MAAA,UAAgB,MAAA;AAAA,UAEX,QAAA;EAAA,UACL,MAAA,GAAS,MAAA;EAAA,SACV,QAAA,EAAU,MAAA,SAAe,OAAA;EAAA,SACzB,cAAA,EAAgB,KAAA;EAEzB,GAAA,CAAI,IAAA,EAAM,OAAA,GAAkB,QAAA;AAAA;AAAA,cAGjB,UAAA,GAAc,CAAA,cAAa,CAAA,IAAK,QAAA;AAAA,cAkDhC,IAAA,QAAW,QAAA"}
package/dist/CronJobs.js CHANGED
@@ -1,7 +1,14 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Array, Cron, Duration, Match, Order, Predicate, Record, pipe } from "effect";
3
2
  import { cronJobs } from "convex/server";
4
- import { Ref as Ref$1 } from "@confect/core";
3
+ import { pipe } from "effect/Function";
4
+ import * as Array from "effect/Array";
5
+ import * as Predicate from "effect/Predicate";
6
+ import { Ref } from "@confect/core";
7
+ import * as Cron from "effect/Cron";
8
+ import * as Duration from "effect/Duration";
9
+ import * as Match from "effect/Match";
10
+ import * as Order from "effect/Order";
11
+ import * as Record from "effect/Record";
5
12
 
6
13
  //#region src/CronJobs.ts
7
14
  var CronJobs_exports = /* @__PURE__ */ __exportAll({
@@ -17,8 +24,8 @@ const Proto = {
17
24
  [TypeId]: TypeId,
18
25
  add(cronJob) {
19
26
  const newConvexCrons = Object.assign(cronJobs(), { crons: { ...this.convexCronJobs.crons } });
20
- const functionReference = Ref$1.getFunctionReference(cronJob.ref);
21
- const encodedArgs = Ref$1.encodeArgsSync(cronJob.ref, cronJob.args);
27
+ const functionReference = Ref.getFunctionReference(cronJob.ref);
28
+ const encodedArgs = Ref.encodeArgsSync(cronJob.ref, cronJob.args);
22
29
  Match.value(cronJob.schedule).pipe(Match.when(Cron.isCron, (cron) => {
23
30
  newConvexCrons.cron(cronJob.identifier, cronToConvexCronString(cron), functionReference, encodedArgs);
24
31
  }), Match.when(Duration.isDuration, (duration) => {
@@ -1 +1 @@
1
- {"version":3,"file":"CronJobs.js","names":["makeConvexCrons","Ref"],"sources":["../src/CronJobs.ts"],"sourcesContent":["import { Ref } from \"@confect/core\";\nimport type { CronJob as ConvexCronJob } from \"convex/server\";\nimport { cronJobs as makeConvexCrons, type Crons } from \"convex/server\";\nimport {\n Array,\n Cron,\n Duration,\n Match,\n Order,\n pipe,\n Predicate,\n Record,\n} from \"effect\";\nimport type * as CronJob from \"./CronJob\";\n\nexport const TypeId = \"@confect/server/CronJobs\";\nexport type TypeId = typeof TypeId;\n\nexport interface CronJobs {\n readonly [TypeId]: TypeId;\n readonly cronJobs: Record<string, CronJob.CronJob>;\n readonly convexCronJobs: Crons;\n\n add(cron: CronJob.CronJob): CronJobs;\n}\n\nexport const isCronJobs = (u: unknown): u is CronJobs =>\n Predicate.hasProperty(u, TypeId);\n\nconst Proto = {\n [TypeId]: TypeId,\n\n add(this: CronJobs, cronJob: CronJob.CronJob) {\n const newConvexCrons = Object.assign(makeConvexCrons(), {\n crons: { ...this.convexCronJobs.crons },\n });\n\n const functionReference = Ref.getFunctionReference(cronJob.ref);\n const encodedArgs = Ref.encodeArgsSync(cronJob.ref, cronJob.args);\n\n Match.value(cronJob.schedule).pipe(\n Match.when(Cron.isCron, (cron) => {\n newConvexCrons.cron(\n cronJob.identifier,\n cronToConvexCronString(cron),\n functionReference,\n encodedArgs,\n );\n }),\n Match.when(Duration.isDuration, (duration) => {\n newConvexCrons.interval(\n cronJob.identifier,\n durationToConvexIntervalSchedule(duration),\n functionReference,\n encodedArgs,\n );\n }),\n Match.exhaustive,\n );\n\n return makeProto(\n Record.set(this.cronJobs, cronJob.identifier, cronJob),\n newConvexCrons,\n );\n },\n};\n\nconst makeProto = (\n cronJobs: Record<string, CronJob.CronJob>,\n convexCronJobs: Crons,\n): CronJobs =>\n Object.assign(Object.create(Proto), {\n cronJobs,\n convexCronJobs,\n });\n\nexport const make = (): CronJobs => makeProto({}, makeConvexCrons());\n\n/** @internal */\nexport const cronToConvexCronString = (cron: Cron.Cron): string => {\n const hasNonDefaultSeconds = cron.seconds.size !== 1 || !cron.seconds.has(0);\n if (hasNonDefaultSeconds) {\n throw new Error(\n \"Convex cron expressions do not support a seconds field. \" +\n \"The seconds field must be the default {0}. \" +\n \"Sub-minute scheduling is supported only by interval schedules defined using a Duration.\",\n );\n }\n\n return Array.join(\n [\n setToField(cron.minutes),\n setToField(cron.hours),\n setToField(cron.days),\n setToField(cron.months),\n setToField(cron.weekdays),\n ],\n \" \",\n );\n};\n\nconst setToField = (set: ReadonlySet<number>): string => {\n if (set.size === 0) return \"*\";\n return pipe(\n set,\n Array.sort(Order.number),\n Array.map((n) => n.toString()),\n Array.join(\",\"),\n );\n};\n\n/** @internal */\nexport const durationToConvexIntervalSchedule = (\n duration: Duration.Duration,\n): IntervalSchedule => {\n const millis = Duration.toMillis(duration);\n if (millis <= 0) {\n throw new Error(\"Interval must be a positive duration.\");\n }\n\n const oneHourInMillis = Duration.hours(1).pipe(Duration.toMillis);\n const hours = millis / oneHourInMillis;\n if (Number.isInteger(hours)) {\n return { type: \"interval\", hours };\n }\n\n const oneMinuteInMillis = Duration.minutes(1).pipe(Duration.toMillis);\n const minutes = millis / oneMinuteInMillis;\n if (Number.isInteger(minutes)) {\n return { type: \"interval\", minutes };\n }\n\n const oneSecondInMillis = Duration.seconds(1).pipe(Duration.toMillis);\n const seconds = millis / oneSecondInMillis;\n if (Number.isInteger(seconds)) {\n return { type: \"interval\", seconds };\n }\n\n throw new Error(\n \"Interval must be a whole number of seconds, minutes, or hours.\",\n );\n};\n\ntype IntervalSchedule = Extract<\n ConvexCronJob[\"schedule\"],\n { type: \"interval\" }\n>;\n"],"mappings":";;;;;;;;;;;;;AAeA,MAAa,SAAS;AAWtB,MAAa,cAAc,MACzB,UAAU,YAAY,GAAG,OAAO;AAElC,MAAM,QAAQ;EACX,SAAS;CAEV,IAAoB,SAA0B;EAC5C,MAAM,iBAAiB,OAAO,OAAOA,UAAiB,EAAE,EACtD,OAAO,EAAE,GAAG,KAAK,eAAe,OAAO,EACxC,CAAC;EAEF,MAAM,oBAAoBC,MAAI,qBAAqB,QAAQ,IAAI;EAC/D,MAAM,cAAcA,MAAI,eAAe,QAAQ,KAAK,QAAQ,KAAK;AAEjE,QAAM,MAAM,QAAQ,SAAS,CAAC,KAC5B,MAAM,KAAK,KAAK,SAAS,SAAS;AAChC,kBAAe,KACb,QAAQ,YACR,uBAAuB,KAAK,EAC5B,mBACA,YACD;IACD,EACF,MAAM,KAAK,SAAS,aAAa,aAAa;AAC5C,kBAAe,SACb,QAAQ,YACR,iCAAiC,SAAS,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,MAAM;EAAY;EAAS;AAGtC,OAAM,IAAI,MACR,iEACD"}
1
+ {"version":3,"file":"CronJobs.js","names":["makeConvexCrons"],"sources":["../src/CronJobs.ts"],"sourcesContent":["import { Ref } from \"@confect/core\";\nimport type { CronJob as ConvexCronJob } from \"convex/server\";\nimport { cronJobs as makeConvexCrons, type Crons } from \"convex/server\";\nimport { pipe } from \"effect/Function\";\nimport * as Array from \"effect/Array\";\nimport * as Cron from \"effect/Cron\";\nimport * as Duration from \"effect/Duration\";\nimport * as Match from \"effect/Match\";\nimport * as Order from \"effect/Order\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Record from \"effect/Record\";\nimport type * as CronJob from \"./CronJob\";\n\nexport const TypeId = \"@confect/server/CronJobs\";\nexport type TypeId = typeof TypeId;\n\nexport interface CronJobs {\n readonly [TypeId]: TypeId;\n readonly cronJobs: Record<string, CronJob.CronJob>;\n readonly convexCronJobs: Crons;\n\n add(cron: CronJob.CronJob): CronJobs;\n}\n\nexport const isCronJobs = (u: unknown): u is CronJobs =>\n Predicate.hasProperty(u, TypeId);\n\nconst Proto = {\n [TypeId]: TypeId,\n\n add(this: CronJobs, cronJob: CronJob.CronJob) {\n const newConvexCrons = Object.assign(makeConvexCrons(), {\n crons: { ...this.convexCronJobs.crons },\n });\n\n const functionReference = Ref.getFunctionReference(cronJob.ref);\n const encodedArgs = Ref.encodeArgsSync(cronJob.ref, cronJob.args);\n\n Match.value(cronJob.schedule).pipe(\n Match.when(Cron.isCron, (cron) => {\n newConvexCrons.cron(\n cronJob.identifier,\n cronToConvexCronString(cron),\n functionReference,\n encodedArgs,\n );\n }),\n Match.when(Duration.isDuration, (duration) => {\n newConvexCrons.interval(\n cronJob.identifier,\n durationToConvexIntervalSchedule(duration),\n functionReference,\n encodedArgs,\n );\n }),\n Match.exhaustive,\n );\n\n return makeProto(\n Record.set(this.cronJobs, cronJob.identifier, cronJob),\n newConvexCrons,\n );\n },\n};\n\nconst makeProto = (\n cronJobs: Record<string, CronJob.CronJob>,\n convexCronJobs: Crons,\n): CronJobs =>\n Object.assign(Object.create(Proto), {\n cronJobs,\n convexCronJobs,\n });\n\nexport const make = (): CronJobs => makeProto({}, makeConvexCrons());\n\n/** @internal */\nexport const cronToConvexCronString = (cron: Cron.Cron): string => {\n const hasNonDefaultSeconds = cron.seconds.size !== 1 || !cron.seconds.has(0);\n if (hasNonDefaultSeconds) {\n throw new Error(\n \"Convex cron expressions do not support a seconds field. \" +\n \"The seconds field must be the default {0}. \" +\n \"Sub-minute scheduling is supported only by interval schedules defined using a Duration.\",\n );\n }\n\n return Array.join(\n [\n setToField(cron.minutes),\n setToField(cron.hours),\n setToField(cron.days),\n setToField(cron.months),\n setToField(cron.weekdays),\n ],\n \" \",\n );\n};\n\nconst setToField = (set: ReadonlySet<number>): string => {\n if (set.size === 0) return \"*\";\n return pipe(\n set,\n Array.sort(Order.number),\n Array.map((n) => n.toString()),\n Array.join(\",\"),\n );\n};\n\n/** @internal */\nexport const durationToConvexIntervalSchedule = (\n duration: Duration.Duration,\n): IntervalSchedule => {\n const millis = Duration.toMillis(duration);\n if (millis <= 0) {\n throw new Error(\"Interval must be a positive duration.\");\n }\n\n const oneHourInMillis = Duration.hours(1).pipe(Duration.toMillis);\n const hours = millis / oneHourInMillis;\n if (Number.isInteger(hours)) {\n return { type: \"interval\", hours };\n }\n\n const oneMinuteInMillis = Duration.minutes(1).pipe(Duration.toMillis);\n const minutes = millis / oneMinuteInMillis;\n if (Number.isInteger(minutes)) {\n return { type: \"interval\", minutes };\n }\n\n const oneSecondInMillis = Duration.seconds(1).pipe(Duration.toMillis);\n const seconds = millis / oneSecondInMillis;\n if (Number.isInteger(seconds)) {\n return { type: \"interval\", seconds };\n }\n\n throw new Error(\n \"Interval must be a whole number of seconds, minutes, or hours.\",\n );\n};\n\ntype IntervalSchedule = Extract<\n ConvexCronJob[\"schedule\"],\n { type: \"interval\" }\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAaA,MAAa,SAAS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