@confect/core 9.0.0-next.7 → 9.0.0-next.9

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 (54) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/FunctionProvenance.d.ts +32 -31
  3. package/dist/FunctionProvenance.d.ts.map +1 -1
  4. package/dist/FunctionProvenance.js +1 -1
  5. package/dist/FunctionProvenance.js.map +1 -1
  6. package/dist/FunctionSpec.d.ts +1 -1
  7. package/dist/FunctionSpec.js +1 -1
  8. package/dist/FunctionSpec.js.map +1 -1
  9. package/dist/GenericId.d.ts +4 -2
  10. package/dist/GenericId.d.ts.map +1 -1
  11. package/dist/GenericId.js +2 -1
  12. package/dist/GenericId.js.map +1 -1
  13. package/dist/GroupSpec.d.ts +7 -7
  14. package/dist/GroupSpec.d.ts.map +1 -1
  15. package/dist/GroupSpec.js +2 -1
  16. package/dist/GroupSpec.js.map +1 -1
  17. package/dist/PaginationResult.d.ts +1 -1
  18. package/dist/PaginationResult.js +1 -1
  19. package/dist/PaginationResult.js.map +1 -1
  20. package/dist/Ref.d.ts +5 -3
  21. package/dist/Ref.d.ts.map +1 -1
  22. package/dist/Ref.js +4 -1
  23. package/dist/Ref.js.map +1 -1
  24. package/dist/Refs.d.ts +8 -8
  25. package/dist/Refs.d.ts.map +1 -1
  26. package/dist/Refs.js +5 -10
  27. package/dist/Refs.js.map +1 -1
  28. package/dist/Registry.d.ts +2 -1
  29. package/dist/Registry.d.ts.map +1 -1
  30. package/dist/Registry.js +2 -1
  31. package/dist/Registry.js.map +1 -1
  32. package/dist/Spec.d.ts +15 -21
  33. package/dist/Spec.d.ts.map +1 -1
  34. package/dist/Spec.js +9 -49
  35. package/dist/Spec.js.map +1 -1
  36. package/dist/SystemFields.d.ts +1 -1
  37. package/dist/SystemFields.js +1 -1
  38. package/dist/SystemFields.js.map +1 -1
  39. package/dist/Types.d.ts +1 -1
  40. package/dist/UserIdentity.d.ts +1 -1
  41. package/dist/UserIdentity.js +1 -1
  42. package/dist/UserIdentity.js.map +1 -1
  43. package/package.json +1 -1
  44. package/src/FunctionProvenance.ts +1 -1
  45. package/src/FunctionSpec.ts +1 -1
  46. package/src/GenericId.ts +3 -1
  47. package/src/GroupSpec.ts +9 -7
  48. package/src/PaginationResult.ts +1 -1
  49. package/src/Ref.ts +4 -1
  50. package/src/Refs.ts +13 -44
  51. package/src/Registry.ts +2 -1
  52. package/src/Spec.ts +18 -82
  53. package/src/SystemFields.ts +1 -1
  54. package/src/UserIdentity.ts +1 -1
package/dist/Refs.d.ts CHANGED
@@ -1,22 +1,22 @@
1
1
  import { AnyWithProps, GetFunctionVisibility, GetRuntimeAndFunctionType, Name as Name$1, WithName } from "./FunctionSpec.js";
2
- import { AnyWithProps as AnyWithProps$1, Functions, GroupSpec, Groups, Name as Name$2, WithName as WithName$1 } from "./GroupSpec.js";
3
- import { Any, AnyInternal, AnyPublic, FromFunctionSpec, Ref as Ref$1 } from "./Ref.js";
4
- import { AnyWithPropsWithRuntime, Groups as Groups$1 } from "./Spec.js";
2
+ import { AnyWithProps as AnyWithProps$1, Functions, Groups, Name as Name$2, WithName as WithName$1 } from "./GroupSpec.js";
3
+ import { Any, AnyInternal, AnyPublic, FromFunctionSpec, Ref } from "./Ref.js";
4
+ import { AnyWithProps as AnyWithProps$2, Groups as Groups$1 } from "./Spec.js";
5
5
  import { Types } from "effect";
6
6
 
7
7
  //#region src/Refs.d.ts
8
8
  declare namespace Refs_d_exports {
9
9
  export { Refs, make };
10
10
  }
11
- type Refs<ConvexSpec extends AnyWithPropsWithRuntime<"Convex">, NodeSpec extends AnyWithPropsWithRuntime<"Node"> = never, Predicate extends Any = Any> = Types.Simplify<OmitEmpty<Helper<Groups$1<ConvexSpec> | (NodeSpec extends never ? never : GroupSpec<"Node", "node", never, NodeSpec["groups"][keyof NodeSpec["groups"]]>), Predicate>>>;
11
+ type Refs<Spec_ extends AnyWithProps$2, Predicate extends Any = Any> = Types.Simplify<OmitEmpty<Helper<Groups$1<Spec_>, Predicate>>>;
12
12
  type GroupRefs<Group extends AnyWithProps$1, Predicate extends Any> = Types.Simplify<OmitEmpty<Helper<Groups<Group>, Predicate>> & FilteredFunctions<Functions<Group>, Predicate>>;
13
13
  type OmitEmpty<T> = { [K in keyof T as keyof T[K] extends never ? never : K]: T[K] };
14
- type FunctionSpecMatchesPredicate<FunctionSpec_ extends AnyWithProps, Predicate extends Any> = Ref$1<GetRuntimeAndFunctionType<FunctionSpec_>, GetFunctionVisibility<FunctionSpec_>, any, any> extends Predicate ? true : false;
14
+ type FunctionSpecMatchesPredicate<FunctionSpec_ extends AnyWithProps, Predicate extends Any> = Ref<GetRuntimeAndFunctionType<FunctionSpec_>, GetFunctionVisibility<FunctionSpec_>, any, any> extends Predicate ? true : false;
15
15
  type FilteredFunctions<FunctionSpecs extends AnyWithProps, Predicate extends Any> = { [Name in Name$1<FunctionSpecs> as WithName<FunctionSpecs, Name> extends infer FunctionSpec_ extends AnyWithProps ? FunctionSpecMatchesPredicate<FunctionSpec_, Predicate> extends true ? Name : never : never]: WithName<FunctionSpecs, Name> extends infer F extends AnyWithProps ? FromFunctionSpec<F> : never };
16
16
  type Helper<Groups extends AnyWithProps$1, Predicate extends Any> = { [GroupName in Name$2<Groups>]: WithName$1<Groups, GroupName> extends infer Group extends AnyWithProps$1 ? GroupRefs<Group, Predicate> : never };
17
- declare const make: <ConvexSpec extends AnyWithPropsWithRuntime<"Convex">, NodeSpec extends AnyWithPropsWithRuntime<"Node"> = never>(convexSpec: ConvexSpec, nodeSpec?: NodeSpec) => {
18
- public: Refs<ConvexSpec, NodeSpec, AnyPublic>;
19
- internal: Refs<ConvexSpec, NodeSpec, AnyInternal>;
17
+ declare const make: <Spec_ extends AnyWithProps$2>(spec: Spec_) => {
18
+ public: Refs<Spec_, AnyPublic>;
19
+ internal: Refs<Spec_, AnyInternal>;
20
20
  };
21
21
  //#endregion
22
22
  export { Refs, Refs_d_exports, make };
@@ -1 +1 @@
1
- {"version":3,"file":"Refs.d.ts","names":[],"sources":["../src/Refs.ts"],"mappings":";;;;;;;;;;KAOY,IAAA,oBACS,uBAAA,6BACF,uBAAA,oCACC,GAAA,GAAU,GAAA,IAC1B,KAAA,CAAM,QAAA,CACR,SAAA,CACE,MAAA,CACI,QAAA,CAAY,UAAA,KACX,QAAA,yBAEG,SAAA,wBAIE,QAAA,iBAAyB,QAAA,eAEjC,SAAA;AAAA,KAKD,SAAA,eACW,cAAA,oBACI,GAAA,IAChB,KAAA,CAAM,QAAA,CACR,SAAA,CAAU,MAAA,CAAO,MAAA,CAAiB,KAAA,GAAQ,SAAA,KACxC,iBAAA,CAAkB,SAAA,CAAoB,KAAA,GAAQ,SAAA;AAAA,KAG7C,SAAA,oBACS,CAAA,UAAW,CAAA,CAAE,CAAA,0BAA2B,CAAA,GAAI,CAAA,CAAE,CAAA;AAAA,KAGvD,4BAAA,uBACmB,YAAA,oBACJ,GAAA,IAElB,KAAA,CACE,yBAAA,CAAuC,aAAA,GACvC,qBAAA,CAAmC,aAAA,qBAG3B,SAAA;AAAA,KAIP,iBAAA,uBACmB,YAAA,oBACJ,GAAA,eAET,MAAA,CAAkB,aAAA,KAAkB,QAAA,CAC3C,aAAA,EACA,IAAA,sCACoC,YAAA,GAClC,4BAAA,CAA6B,aAAA,EAAe,SAAA,iBAC1C,IAAA,mBAEM,QAAA,CAAsB,aAAA,EAAe,IAAA,0BAC/C,YAAA,GACE,gBAAA,CAAqB,CAAA;AAAA,KAItB,MAAA,gBACY,cAAA,oBACG,GAAA,oBAEJ,MAAA,CAAe,MAAA,IAAU,UAAA,CACrC,MAAA,EACA,SAAA,8BAC4B,cAAA,GAC1B,SAAA,CAAU,KAAA,EAAO,SAAA;AAAA,cAUV,IAAA,sBACQ,uBAAA,6BACF,uBAAA,kBAEjB,UAAA,EAAY,UAAA,EACZ,QAAA,GAAW,QAAA;EAEX,MAAA,EAAQ,IAAA,CAAK,UAAA,EAAY,QAAA,EAAU,SAAA;EACnC,QAAA,EAAU,IAAA,CAAK,UAAA,EAAY,QAAA,EAAU,WAAA;AAAA"}
1
+ {"version":3,"file":"Refs.d.ts","names":[],"sources":["../src/Refs.ts"],"mappings":";;;;;;;;;;KASY,IAAA,eACI,cAAA,oBACI,GAAA,GAAU,GAAA,IAC1B,KAAA,CAAM,QAAA,CAAS,SAAA,CAAU,MAAA,CAAO,QAAA,CAAY,KAAA,GAAQ,SAAA;AAAA,KAEnD,SAAA,eACW,cAAA,oBACI,GAAA,IAChB,KAAA,CAAM,QAAA,CACR,SAAA,CAAU,MAAA,CAAO,MAAA,CAAiB,KAAA,GAAQ,SAAA,KACxC,iBAAA,CAAkB,SAAA,CAAoB,KAAA,GAAQ,SAAA;AAAA,KAG7C,SAAA,oBACS,CAAA,UAAW,CAAA,CAAE,CAAA,0BAA2B,CAAA,GAAI,CAAA,CAAE,CAAA;AAAA,KAGvD,4BAAA,uBACmB,YAAA,oBACJ,GAAA,IAElB,GAAA,CACE,yBAAA,CAAuC,aAAA,GACvC,qBAAA,CAAmC,aAAA,qBAG3B,SAAA;AAAA,KAIP,iBAAA,uBACmB,YAAA,oBACJ,GAAA,eAET,MAAA,CAAkB,aAAA,KAAkB,QAAA,CAC3C,aAAA,EACA,IAAA,sCACoC,YAAA,GAClC,4BAAA,CAA6B,aAAA,EAAe,SAAA,iBAC1C,IAAA,mBAEM,QAAA,CAAsB,aAAA,EAAe,IAAA,0BAC/C,YAAA,GACE,gBAAA,CAAqB,CAAA;AAAA,KAItB,MAAA,gBACY,cAAA,oBACG,GAAA,oBAEJ,MAAA,CAAe,MAAA,IAAU,UAAA,CACrC,MAAA,EACA,SAAA,8BAC4B,cAAA,GAC1B,SAAA,CAAU,KAAA,EAAO,SAAA;AAAA,cAUV,IAAA,iBAAsB,cAAA,EACjC,IAAA,EAAM,KAAA;EAEN,MAAA,EAAQ,IAAA,CAAK,KAAA,EAAO,SAAA;EACpB,QAAA,EAAU,IAAA,CAAK,KAAA,EAAO,WAAA;AAAA"}
package/dist/Refs.js CHANGED
@@ -1,18 +1,13 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { makeNodeAt } from "./GroupSpec.js";
3
2
  import { getConvexFunctionName, make as make$1 } from "./Ref.js";
4
- import { Array, Option, Record, pipe } from "effect";
3
+ import * as Record from "effect/Record";
4
+ import * as Option from "effect/Option";
5
+ import { pipe } from "effect/Function";
5
6
 
6
7
  //#region src/Refs.ts
7
8
  var Refs_exports = /* @__PURE__ */ __exportAll({ make: () => make });
8
- const make = (convexSpec, nodeSpec) => {
9
- const refs = makeHelper(Option.fromNullable(nodeSpec).pipe(Option.map((nodeSpec_) => Array.reduce(Record.toEntries(nodeSpec_.groups), makeNodeAt("node"), (nodeGroupSpec, [name, group]) => nodeGroupSpec.addGroupAt(name, group))), Option.match({
10
- onNone: () => convexSpec.groups,
11
- onSome: (nodeGroup) => ({
12
- ...convexSpec.groups,
13
- node: nodeGroup
14
- })
15
- })));
9
+ const make = (spec) => {
10
+ const refs = makeHelper(spec.groups);
16
11
  return {
17
12
  public: refs,
18
13
  internal: refs
package/dist/Refs.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Refs.js","names":["GroupSpec.makeNodeAt","Ref.make","Ref.getConvexFunctionName"],"sources":["../src/Refs.ts"],"sourcesContent":["import type { Types } from \"effect\";\nimport { Array, Option, pipe, Record } from \"effect\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport * as GroupSpec from \"./GroupSpec\";\nimport * as Ref from \"./Ref\";\nimport type * as Spec from \"./Spec\";\n\nexport type Refs<\n ConvexSpec extends Spec.AnyWithPropsWithRuntime<\"Convex\">,\n NodeSpec extends Spec.AnyWithPropsWithRuntime<\"Node\"> = never,\n Predicate extends Ref.Any = Ref.Any,\n> = Types.Simplify<\n OmitEmpty<\n Helper<\n | Spec.Groups<ConvexSpec>\n | (NodeSpec extends never\n ? never\n : GroupSpec.GroupSpec<\n \"Node\",\n \"node\",\n never,\n NodeSpec[\"groups\"][keyof NodeSpec[\"groups\"]]\n >),\n Predicate\n >\n >\n>;\n\ntype GroupRefs<\n Group extends GroupSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> = Types.Simplify<\n OmitEmpty<Helper<GroupSpec.Groups<Group>, Predicate>> &\n FilteredFunctions<GroupSpec.Functions<Group>, Predicate>\n>;\n\ntype OmitEmpty<T> = {\n [K in keyof T as keyof T[K] extends never ? never : K]: T[K];\n};\n\ntype FunctionSpecMatchesPredicate<\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> =\n Ref.Ref<\n FunctionSpec.GetRuntimeAndFunctionType<FunctionSpec_>,\n FunctionSpec.GetFunctionVisibility<FunctionSpec_>,\n any,\n any\n > extends Predicate\n ? true\n : false;\n\ntype FilteredFunctions<\n FunctionSpecs extends FunctionSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> = {\n [Name in FunctionSpec.Name<FunctionSpecs> as FunctionSpec.WithName<\n FunctionSpecs,\n Name\n > extends infer FunctionSpec_ extends FunctionSpec.AnyWithProps\n ? FunctionSpecMatchesPredicate<FunctionSpec_, Predicate> extends true\n ? Name\n : never\n : never]: FunctionSpec.WithName<FunctionSpecs, Name> extends infer F extends\n FunctionSpec.AnyWithProps\n ? Ref.FromFunctionSpec<F>\n : never;\n};\n\ntype Helper<\n Groups extends GroupSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> = {\n [GroupName in GroupSpec.Name<Groups>]: GroupSpec.WithName<\n Groups,\n GroupName\n > extends infer Group extends GroupSpec.AnyWithProps\n ? GroupRefs<Group, Predicate>\n : never;\n};\n\ntype Any =\n | {\n readonly [key: string]: Any;\n }\n | Ref.Any;\n\nexport const make = <\n ConvexSpec extends Spec.AnyWithPropsWithRuntime<\"Convex\">,\n NodeSpec extends Spec.AnyWithPropsWithRuntime<\"Node\"> = never,\n>(\n convexSpec: ConvexSpec,\n nodeSpec?: NodeSpec,\n): {\n public: Refs<ConvexSpec, NodeSpec, Ref.AnyPublic>;\n internal: Refs<ConvexSpec, NodeSpec, Ref.AnyInternal>;\n} => {\n const groups = Option.fromNullable(nodeSpec).pipe(\n Option.map((nodeSpec_) =>\n Array.reduce(\n Record.toEntries(nodeSpec_.groups),\n GroupSpec.makeNodeAt(\"node\"),\n (nodeGroupSpec, [name, group]) => nodeGroupSpec.addGroupAt(name, group),\n ),\n ),\n Option.match({\n onNone: () => convexSpec.groups,\n onSome: (nodeGroup) => ({ ...convexSpec.groups, node: nodeGroup }),\n }),\n );\n const refs = makeHelper(groups);\n return {\n public: refs as Refs<ConvexSpec, NodeSpec, Ref.AnyPublic>,\n internal: refs as Refs<ConvexSpec, NodeSpec, Ref.AnyInternal>,\n };\n};\n\nconst makeHelper = (\n groups: Record.ReadonlyRecord<string, GroupSpec.Any>,\n functionNamespace: Option.Option<string> = Option.none(),\n): Any =>\n pipe(\n groups as Record.ReadonlyRecord<string, GroupSpec.AnyWithProps>,\n Record.map((group, name) => {\n const currentFunctionNamespace = Option.match(functionNamespace, {\n onNone: () => name,\n onSome: (parentNamespace) => `${parentNamespace}/${name}`,\n });\n\n return Record.union(\n makeHelper(group.groups, Option.some(currentFunctionNamespace)),\n Record.map(group.functions, (function_) =>\n Ref.make(currentFunctionNamespace, function_),\n ),\n (_subGroup, _function) => {\n throw new Error(\n `Group and function at same level have same name ('${Ref.getConvexFunctionName(_function)}')`,\n );\n },\n );\n }),\n );\n"],"mappings":";;;;;;;AAwFA,MAAa,QAIX,YACA,aAIG;CAcH,MAAM,OAAO,WAbE,OAAO,aAAa,SAAS,CAAC,KAC3C,OAAO,KAAK,cACV,MAAM,OACJ,OAAO,UAAU,UAAU,OAAO,EAClCA,WAAqB,OAAO,GAC3B,eAAe,CAAC,MAAM,WAAW,cAAc,WAAW,MAAM,MAAM,CACxE,CACF,EACD,OAAO,MAAM;EACX,cAAc,WAAW;EACzB,SAAS,eAAe;GAAE,GAAG,WAAW;GAAQ,MAAM;GAAW;EAClE,CAAC,CACH,CAC8B;AAC/B,QAAO;EACL,QAAQ;EACR,UAAU;EACX;;AAGH,MAAM,cACJ,QACA,oBAA2C,OAAO,MAAM,KAExD,KACE,QACA,OAAO,KAAK,OAAO,SAAS;CAC1B,MAAM,2BAA2B,OAAO,MAAM,mBAAmB;EAC/D,cAAc;EACd,SAAS,oBAAoB,GAAG,gBAAgB,GAAG;EACpD,CAAC;AAEF,QAAO,OAAO,MACZ,WAAW,MAAM,QAAQ,OAAO,KAAK,yBAAyB,CAAC,EAC/D,OAAO,IAAI,MAAM,YAAY,cAC3BC,OAAS,0BAA0B,UAAU,CAC9C,GACA,WAAW,cAAc;AACxB,QAAM,IAAI,MACR,qDAAqDC,sBAA0B,UAAU,CAAC,IAC3F;GAEJ;EACD,CACH"}
1
+ {"version":3,"file":"Refs.js","names":["Ref.make","Ref.getConvexFunctionName"],"sources":["../src/Refs.ts"],"sourcesContent":["import type { Types } from \"effect\";\nimport { pipe } from \"effect/Function\";\nimport * as Option from \"effect/Option\";\nimport * as Record from \"effect/Record\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport type * as GroupSpec from \"./GroupSpec\";\nimport * as Ref from \"./Ref\";\nimport type * as Spec from \"./Spec\";\n\nexport type Refs<\n Spec_ extends Spec.AnyWithProps,\n Predicate extends Ref.Any = Ref.Any,\n> = Types.Simplify<OmitEmpty<Helper<Spec.Groups<Spec_>, Predicate>>>;\n\ntype GroupRefs<\n Group extends GroupSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> = Types.Simplify<\n OmitEmpty<Helper<GroupSpec.Groups<Group>, Predicate>> &\n FilteredFunctions<GroupSpec.Functions<Group>, Predicate>\n>;\n\ntype OmitEmpty<T> = {\n [K in keyof T as keyof T[K] extends never ? never : K]: T[K];\n};\n\ntype FunctionSpecMatchesPredicate<\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> =\n Ref.Ref<\n FunctionSpec.GetRuntimeAndFunctionType<FunctionSpec_>,\n FunctionSpec.GetFunctionVisibility<FunctionSpec_>,\n any,\n any\n > extends Predicate\n ? true\n : false;\n\ntype FilteredFunctions<\n FunctionSpecs extends FunctionSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> = {\n [Name in FunctionSpec.Name<FunctionSpecs> as FunctionSpec.WithName<\n FunctionSpecs,\n Name\n > extends infer FunctionSpec_ extends FunctionSpec.AnyWithProps\n ? FunctionSpecMatchesPredicate<FunctionSpec_, Predicate> extends true\n ? Name\n : never\n : never]: FunctionSpec.WithName<FunctionSpecs, Name> extends infer F extends\n FunctionSpec.AnyWithProps\n ? Ref.FromFunctionSpec<F>\n : never;\n};\n\ntype Helper<\n Groups extends GroupSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> = {\n [GroupName in GroupSpec.Name<Groups>]: GroupSpec.WithName<\n Groups,\n GroupName\n > extends infer Group extends GroupSpec.AnyWithProps\n ? GroupRefs<Group, Predicate>\n : never;\n};\n\ntype Any =\n | {\n readonly [key: string]: Any;\n }\n | Ref.Any;\n\nexport const make = <Spec_ extends Spec.AnyWithProps>(\n spec: Spec_,\n): {\n public: Refs<Spec_, Ref.AnyPublic>;\n internal: Refs<Spec_, Ref.AnyInternal>;\n} => {\n const refs = makeHelper(spec.groups);\n return {\n public: refs as Refs<Spec_, Ref.AnyPublic>,\n internal: refs as Refs<Spec_, Ref.AnyInternal>,\n };\n};\n\nconst makeHelper = (\n groups: Record.ReadonlyRecord<string, GroupSpec.Any>,\n functionNamespace: Option.Option<string> = Option.none(),\n): Any =>\n pipe(\n groups as Record.ReadonlyRecord<string, GroupSpec.AnyWithProps>,\n Record.map((group, name) => {\n const currentFunctionNamespace = Option.match(functionNamespace, {\n onNone: () => name,\n onSome: (parentNamespace) => `${parentNamespace}/${name}`,\n });\n\n return Record.union(\n makeHelper(group.groups, Option.some(currentFunctionNamespace)),\n Record.map(group.functions, (function_) =>\n Ref.make(currentFunctionNamespace, function_),\n ),\n (_subGroup, _function) => {\n throw new Error(\n `Group and function at same level have same name ('${Ref.getConvexFunctionName(_function)}')`,\n );\n },\n );\n }),\n );\n"],"mappings":";;;;;;;;AA0EA,MAAa,QACX,SAIG;CACH,MAAM,OAAO,WAAW,KAAK,OAAO;AACpC,QAAO;EACL,QAAQ;EACR,UAAU;EACX;;AAGH,MAAM,cACJ,QACA,oBAA2C,OAAO,MAAM,KAExD,KACE,QACA,OAAO,KAAK,OAAO,SAAS;CAC1B,MAAM,2BAA2B,OAAO,MAAM,mBAAmB;EAC/D,cAAc;EACd,SAAS,oBAAoB,GAAG,gBAAgB,GAAG;EACpD,CAAC;AAEF,QAAO,OAAO,MACZ,WAAW,MAAM,QAAQ,OAAO,KAAK,yBAAyB,CAAC,EAC/D,OAAO,IAAI,MAAM,YAAY,cAC3BA,OAAS,0BAA0B,UAAU,CAC9C,GACA,WAAW,cAAc;AACxB,QAAM,IAAI,MACR,qDAAqDC,sBAA0B,UAAU,CAAC,IAC3F;GAEJ;EACD,CACH"}
@@ -1,4 +1,5 @@
1
- import { Context, Ref } from "effect";
1
+ import * as Context from "effect/Context";
2
+ import * as Ref from "effect/Ref";
2
3
 
3
4
  //#region src/Registry.d.ts
4
5
  declare namespace Registry_d_exports {
@@ -1 +1 @@
1
- {"version":3,"file":"Registry.d.ts","names":[],"sources":["../src/Registry.ts"],"mappings":";;;;;;;;;;;;;AAUA;UAAiB,aAAA;EAAA,UACL,GAAA,qBAAwB,aAAA;AAAA;AAAA,cACnC,aAAA;AAAA;;;;;;;;;AAAA,cAWY,QAAA,SAAiB,aAAA"}
1
+ {"version":3,"file":"Registry.d.ts","names":[],"sources":["../src/Registry.ts"],"mappings":";;;;;;;;;;;;;;AAWA;UAAiB,aAAA;EAAA,UACL,GAAA,qBAAwB,aAAA;AAAA;AAAA,cACnC,aAAA;AAAA;;;;;;;;;AAAA,cAWY,QAAA,SAAiB,aAAA"}
package/dist/Registry.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Context, Ref } from "effect";
2
+ import * as Context from "effect/Context";
3
+ import * as Ref from "effect/Ref";
3
4
 
4
5
  //#region src/Registry.ts
5
6
  var Registry_exports = /* @__PURE__ */ __exportAll({ Registry: () => Registry });
@@ -1 +1 @@
1
- {"version":3,"file":"Registry.js","names":[],"sources":["../src/Registry.ts"],"sourcesContent":["import { Context, Ref } from \"effect\";\n\n/**\n * Recursive tree that mirrors a `Spec`'s group structure. Leaves are the\n * per-function items written by each `FunctionImpl`'s layer initializer. The\n * leaf type is intentionally `unknown` here so `@confect/core` does not need\n * to know about `@confect/server`'s `RegistryItem` shape; producers and\n * consumers (the server runtime and the CLI's `implValidation`) narrow as\n * needed.\n */\nexport interface RegistryItems {\n readonly [key: string]: unknown | RegistryItems;\n}\n\n/**\n * Effect `Context.Reference` keyed by `@confect/core/Registry`. Lives in\n * `@confect/core` so `@confect/server` (which writes to it from\n * `FunctionImpl` initializers and reads it from `RegisteredFunctions`) and\n * `@confect/cli` (which inspects it during impl validation) can share the\n * exact same `Ref` instance by importing the same tag — without relying on\n * Effect's global default-value cache to align two separately-defined tags\n * by string key.\n */\nexport class Registry extends Context.Reference<Registry>()(\n \"@confect/core/Registry\",\n {\n defaultValue: () => Ref.unsafeMake<RegistryItems>({}),\n },\n) {}\n"],"mappings":";;;;;;;;;;;;;;AAuBA,IAAa,WAAb,cAA8B,QAAQ,WAAqB,CACzD,0BACA,EACE,oBAAoB,IAAI,WAA0B,EAAE,CAAC,EACtD,CACF,CAAC"}
1
+ {"version":3,"file":"Registry.js","names":[],"sources":["../src/Registry.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Ref from \"effect/Ref\";\n\n/**\n * Recursive tree that mirrors a `Spec`'s group structure. Leaves are the\n * per-function items written by each `FunctionImpl`'s layer initializer. The\n * leaf type is intentionally `unknown` here so `@confect/core` does not need\n * to know about `@confect/server`'s `RegistryItem` shape; producers and\n * consumers (the server runtime and the CLI's `implValidation`) narrow as\n * needed.\n */\nexport interface RegistryItems {\n readonly [key: string]: unknown | RegistryItems;\n}\n\n/**\n * Effect `Context.Reference` keyed by `@confect/core/Registry`. Lives in\n * `@confect/core` so `@confect/server` (which writes to it from\n * `FunctionImpl` initializers and reads it from `RegisteredFunctions`) and\n * `@confect/cli` (which inspects it during impl validation) can share the\n * exact same `Ref` instance by importing the same tag — without relying on\n * Effect's global default-value cache to align two separately-defined tags\n * by string key.\n */\nexport class Registry extends Context.Reference<Registry>()(\n \"@confect/core/Registry\",\n {\n defaultValue: () => Ref.unsafeMake<RegistryItems>({}),\n },\n) {}\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,IAAa,WAAb,cAA8B,QAAQ,WAAqB,CACzD,0BACA,EACE,oBAAoB,IAAI,WAA0B,EAAE,CAAC,EACtD,CACF,CAAC"}
package/dist/Spec.d.ts CHANGED
@@ -1,37 +1,31 @@
1
- import { Runtime } from "./RuntimeAndFunctionType.js";
2
- import { AnyWithProps as AnyWithProps$1, AnyWithPropsWithRuntime as AnyWithPropsWithRuntime$1, Name, NamedAt, WithName } from "./GroupSpec.js";
1
+ import { AnyWithProps as AnyWithProps$1, Name, NamedAt, WithName } from "./GroupSpec.js";
3
2
 
4
3
  //#region src/Spec.d.ts
5
4
  declare namespace Spec_d_exports {
6
- export { Any, AnyWithProps, AnyWithPropsWithRuntime, Groups, Spec, TypeId, isConvexSpec, isNodeSpec, isSpec, make, makeNode, merge };
5
+ export { Any, AnyWithProps, Groups, Spec, TypeId, isSpec, make };
7
6
  }
8
7
  declare const TypeId = "@confect/core/Spec";
9
8
  type TypeId = typeof TypeId;
10
9
  declare const isSpec: (u: unknown) => u is AnyWithProps;
11
- declare const isConvexSpec: (u: unknown) => u is AnyWithPropsWithRuntime<"Convex">;
12
- declare const isNodeSpec: (u: unknown) => u is AnyWithPropsWithRuntime<"Node">;
13
- interface Spec<Runtime$2 extends Runtime, Groups_ extends AnyWithPropsWithRuntime$1<Runtime$2> = never> {
10
+ /**
11
+ * A Confect spec: a flat container of function groups. Groups may be of any
12
+ * runtime a group built with `GroupSpec.makeNode()` (a Node action group) sits
13
+ * alongside `GroupSpec.make()` groups in the same namespace. The runtime of a
14
+ * group lives on the group itself (`GroupSpec.runtime`) and on each function's
15
+ * `RuntimeAndFunctionType`; the spec does not carry a runtime of its own.
16
+ */
17
+ interface Spec<Groups_ extends AnyWithProps$1 = never> {
14
18
  readonly [TypeId]: TypeId;
15
- readonly runtime: Runtime$2;
16
19
  readonly groups: { [GroupName in Name<Groups_>]: WithName<Groups_, GroupName> };
17
- add<Group extends AnyWithPropsWithRuntime$1<Runtime$2>>(group: Group): Spec<Runtime$2, Groups_ | Group>;
18
- addAt<const Name$1 extends string, Group extends AnyWithPropsWithRuntime$1<Runtime$2>>(name: Name$1, group: Group): Spec<Runtime$2, Groups_ | NamedAt<Group, Name$1>>;
20
+ add<Group extends AnyWithProps$1>(group: Group): Spec<Groups_ | Group>;
21
+ addAt<const Name$1 extends string, Group extends AnyWithProps$1>(name: Name$1, group: Group): Spec<Groups_ | NamedAt<Group, Name$1>>;
19
22
  }
20
23
  interface Any {
21
24
  readonly [TypeId]: TypeId;
22
25
  }
23
- interface AnyWithProps extends Spec<Runtime, AnyWithProps$1> {}
24
- interface AnyWithPropsWithRuntime<Runtime$1 extends Runtime> extends Spec<Runtime$1, AnyWithPropsWithRuntime$1<Runtime$1>> {}
26
+ interface AnyWithProps extends Spec<AnyWithProps$1> {}
25
27
  type Groups<Spec_ extends AnyWithProps> = Spec_["groups"][keyof Spec_["groups"]];
26
- declare const make: () => Spec<"Convex">;
27
- declare const makeNode: () => Spec<"Node">;
28
- /**
29
- * Merges a Convex spec with an optional Node spec into a single assembled
30
- * spec (used by codegen to build `Refs.make` and to enumerate function paths).
31
- * When `nodeSpec` is provided, its groups are merged under a "node" namespace,
32
- * mirroring the structure used by `Refs.make`.
33
- */
34
- declare const merge: <ConvexSpec extends AnyWithPropsWithRuntime<"Convex">, NodeSpec extends AnyWithPropsWithRuntime<"Node">>(convexSpec: ConvexSpec, nodeSpec?: NodeSpec) => AnyWithProps;
28
+ declare const make: () => Spec;
35
29
  //#endregion
36
- export { Any, AnyWithProps, AnyWithPropsWithRuntime, Groups, Spec, Spec_d_exports, TypeId, isConvexSpec, isNodeSpec, isSpec, make, makeNode, merge };
30
+ export { Any, AnyWithProps, Groups, Spec, Spec_d_exports, TypeId, isSpec, make };
37
31
  //# sourceMappingURL=Spec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Spec.d.ts","names":[],"sources":["../src/Spec.ts"],"mappings":";;;;;;;cAIa,MAAA;AAAA,KACD,MAAA,UAAgB,MAAA;AAAA,cAEf,MAAA,GAAU,CAAA,cAAa,CAAA,IAAK,YAAA;AAAA,cAG5B,YAAA,GACX,CAAA,cACC,CAAA,IAAK,uBAAA;AAAA,cAKK,UAAA,GAAc,CAAA,cAAa,CAAA,IAAK,uBAAA;AAAA,UAK5B,IAAA,mBACC,OAAA,kBACA,yBAAA,CAAkC,SAAA;EAAA,UAExC,MAAA,GAAS,MAAA;EAAA,SACV,OAAA,EAAS,SAAA;EAAA,SACT,MAAA,kBACO,IAAA,CAAe,OAAA,IAAW,QAAA,CACtC,OAAA,EACA,SAAA;EAIJ,GAAA,eAAkB,yBAAA,CAAkC,SAAA,GAClD,KAAA,EAAO,KAAA,GACN,IAAA,CAAK,SAAA,EAAS,OAAA,GAAU,KAAA;EAE3B,KAAA,4CAEgB,yBAAA,CAAkC,SAAA,GAEhD,IAAA,EAAM,MAAA,EACN,KAAA,EAAO,KAAA,GACN,IAAA,CAAK,SAAA,EAAS,OAAA,GAAU,OAAA,CAAkB,KAAA,EAAO,MAAA;AAAA;AAAA,UAGrC,GAAA;EAAA,UACL,MAAA,GAAS,MAAA;AAAA;AAAA,UAGJ,YAAA,SAAqB,IAAA,CACpC,OAAA,EACA,cAAA;AAAA,UAGe,uBAAA,mBACC,OAAA,UACR,IAAA,CAAK,SAAA,EAAS,yBAAA,CAAkC,SAAA;AAAA,KAE9C,MAAA,eAAqB,YAAA,IAC/B,KAAA,iBAAsB,KAAA;AAAA,cAuCX,IAAA,QAAW,IAAA;AAAA,cAGX,QAAA,QAAe,IAAA;;;;AAjG5B;;;cA0Ga,KAAA,sBACQ,uBAAA,6BACF,uBAAA,UAEjB,UAAA,EAAY,UAAA,EACZ,QAAA,GAAW,QAAA,KACV,YAAA"}
1
+ {"version":3,"file":"Spec.d.ts","names":[],"sources":["../src/Spec.ts"],"mappings":";;;;;;cAIa,MAAA;AAAA,KACD,MAAA,UAAgB,MAAA;AAAA,cAEf,MAAA,GAAU,CAAA,cAAa,CAAA,IAAK,YAAA;;;;;;;;UAUxB,IAAA,iBAAqB,cAAA;EAAA,UAC1B,MAAA,GAAS,MAAA;EAAA,SACV,MAAA,kBACO,IAAA,CAAe,OAAA,IAAW,QAAA,CACtC,OAAA,EACA,SAAA;EAIJ,GAAA,eAAkB,cAAA,EAChB,KAAA,EAAO,KAAA,GACN,IAAA,CAAK,OAAA,GAAU,KAAA;EAElB,KAAA,4CAA+C,cAAA,EAC7C,IAAA,EAAM,MAAA,EACN,KAAA,EAAO,KAAA,GACN,IAAA,CAAK,OAAA,GAAU,OAAA,CAAkB,KAAA,EAAO,MAAA;AAAA;AAAA,UAG5B,GAAA;EAAA,UACL,MAAA,GAAS,MAAA;AAAA;AAAA,UAGJ,YAAA,SAAqB,IAAA,CAAK,cAAA;AAAA,KAE/B,MAAA,eAAqB,YAAA,IAC/B,KAAA,iBAAsB,KAAA;AAAA,cA+BX,IAAA,QAAW,IAAA"}
package/dist/Spec.js CHANGED
@@ -1,68 +1,28 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { makeNodeAt, withName } from "./GroupSpec.js";
3
- import { Array, Option, Predicate, Record } from "effect";
2
+ import { withName } from "./GroupSpec.js";
3
+ import * as Predicate from "effect/Predicate";
4
+ import * as Record from "effect/Record";
4
5
 
5
6
  //#region src/Spec.ts
6
7
  var Spec_exports = /* @__PURE__ */ __exportAll({
7
8
  TypeId: () => TypeId,
8
- isConvexSpec: () => isConvexSpec,
9
- isNodeSpec: () => isNodeSpec,
10
9
  isSpec: () => isSpec,
11
- make: () => make,
12
- makeNode: () => makeNode,
13
- merge: () => merge
10
+ make: () => make
14
11
  });
15
12
  const TypeId = "@confect/core/Spec";
16
13
  const isSpec = (u) => Predicate.hasProperty(u, TypeId);
17
- const isConvexSpec = (u) => Predicate.hasProperty(u, TypeId) && Predicate.hasProperty(u, "runtime") && u.runtime === "Convex";
18
- const isNodeSpec = (u) => Predicate.hasProperty(u, TypeId) && Predicate.hasProperty(u, "runtime") && u.runtime === "Node";
19
14
  const Proto = {
20
15
  [TypeId]: TypeId,
21
16
  add(group) {
22
- return makeProto({
23
- runtime: this.runtime,
24
- groups: Record.set(this.groups, group.name, group)
25
- });
17
+ return makeProto({ groups: Record.set(this.groups, group.name, group) });
26
18
  },
27
19
  addAt(name, group) {
28
- return makeProto({
29
- runtime: this.runtime,
30
- groups: Record.set(this.groups, name, withName(name, group))
31
- });
20
+ return makeProto({ groups: Record.set(this.groups, name, withName(name, group)) });
32
21
  }
33
22
  };
34
- const makeProto = ({ runtime, groups }) => Object.assign(Object.create(Proto), {
35
- runtime,
36
- groups
37
- });
38
- const make = () => makeProto({
39
- runtime: "Convex",
40
- groups: {}
41
- });
42
- const makeNode = () => makeProto({
43
- runtime: "Node",
44
- groups: {}
45
- });
46
- /**
47
- * Merges a Convex spec with an optional Node spec into a single assembled
48
- * spec (used by codegen to build `Refs.make` and to enumerate function paths).
49
- * When `nodeSpec` is provided, its groups are merged under a "node" namespace,
50
- * mirroring the structure used by `Refs.make`.
51
- */
52
- const merge = (convexSpec, nodeSpec) => {
53
- const groups = Option.fromNullable(nodeSpec).pipe(Option.map((nodeSpec_) => Array.reduce(Record.toEntries(nodeSpec_.groups), makeNodeAt("node"), (nodeGroupSpec, [name, group]) => nodeGroupSpec.addGroupAt(name, group))), Option.match({
54
- onNone: () => convexSpec.groups,
55
- onSome: (nodeGroup) => ({
56
- ...convexSpec.groups,
57
- node: nodeGroup
58
- })
59
- }));
60
- return Object.assign(Object.create(Proto), {
61
- runtime: "Convex",
62
- groups
63
- });
64
- };
23
+ const makeProto = ({ groups }) => Object.assign(Object.create(Proto), { groups });
24
+ const make = () => makeProto({ groups: {} });
65
25
 
66
26
  //#endregion
67
- export { Spec_exports, TypeId, isConvexSpec, isNodeSpec, isSpec, make, makeNode, merge };
27
+ export { Spec_exports, TypeId, isSpec, make };
68
28
  //# sourceMappingURL=Spec.js.map
package/dist/Spec.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Spec.js","names":["GroupSpec.withName","GroupSpec.makeNodeAt"],"sources":["../src/Spec.ts"],"sourcesContent":["import { Array, Option, Predicate, Record } from \"effect\";\nimport * as GroupSpec from \"./GroupSpec\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\n\nexport const TypeId = \"@confect/core/Spec\";\nexport type TypeId = typeof TypeId;\n\nexport const isSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\nexport const isConvexSpec = (\n u: unknown,\n): u is AnyWithPropsWithRuntime<\"Convex\"> =>\n Predicate.hasProperty(u, TypeId) &&\n Predicate.hasProperty(u, \"runtime\") &&\n u.runtime === \"Convex\";\n\nexport const isNodeSpec = (u: unknown): u is AnyWithPropsWithRuntime<\"Node\"> =>\n Predicate.hasProperty(u, TypeId) &&\n Predicate.hasProperty(u, \"runtime\") &&\n u.runtime === \"Node\";\n\nexport interface Spec<\n Runtime extends RuntimeAndFunctionType.Runtime,\n Groups_ extends GroupSpec.AnyWithPropsWithRuntime<Runtime> = never,\n> {\n readonly [TypeId]: TypeId;\n readonly runtime: Runtime;\n readonly groups: {\n [GroupName in GroupSpec.Name<Groups_>]: GroupSpec.WithName<\n Groups_,\n GroupName\n >;\n };\n\n add<Group extends GroupSpec.AnyWithPropsWithRuntime<Runtime>>(\n group: Group,\n ): Spec<Runtime, Groups_ | Group>;\n\n addAt<\n const Name extends string,\n Group extends GroupSpec.AnyWithPropsWithRuntime<Runtime>,\n >(\n name: Name,\n group: Group,\n ): Spec<Runtime, Groups_ | GroupSpec.NamedAt<Group, Name>>;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends Spec<\n RuntimeAndFunctionType.Runtime,\n GroupSpec.AnyWithProps\n> {}\n\nexport interface AnyWithPropsWithRuntime<\n Runtime extends RuntimeAndFunctionType.Runtime,\n> extends Spec<Runtime, GroupSpec.AnyWithPropsWithRuntime<Runtime>> {}\n\nexport type Groups<Spec_ extends AnyWithProps> =\n Spec_[\"groups\"][keyof Spec_[\"groups\"]];\n\nconst Proto = {\n [TypeId]: TypeId,\n\n add<Group extends GroupSpec.AnyWithProps>(this: AnyWithProps, group: Group) {\n return makeProto({\n runtime: this.runtime,\n groups: Record.set(this.groups, group.name, group),\n });\n },\n\n addAt<Group extends GroupSpec.AnyWithProps>(\n this: AnyWithProps,\n name: string,\n group: Group,\n ) {\n return makeProto({\n runtime: this.runtime,\n groups: Record.set(this.groups, name, GroupSpec.withName(name, group)),\n });\n },\n};\n\nconst makeProto = <\n Runtime extends RuntimeAndFunctionType.Runtime,\n Groups_ extends GroupSpec.AnyWithPropsWithRuntime<Runtime>,\n>({\n runtime,\n groups,\n}: {\n runtime: Runtime;\n groups: Record.ReadonlyRecord<string, Groups_>;\n}): Spec<Runtime, Groups_> =>\n Object.assign(Object.create(Proto), {\n runtime,\n groups,\n });\n\nexport const make = (): Spec<\"Convex\"> =>\n makeProto({ runtime: \"Convex\", groups: {} });\n\nexport const makeNode = (): Spec<\"Node\"> =>\n makeProto({ runtime: \"Node\", groups: {} });\n\n/**\n * Merges a Convex spec with an optional Node spec into a single assembled\n * spec (used by codegen to build `Refs.make` and to enumerate function paths).\n * When `nodeSpec` is provided, its groups are merged under a \"node\" namespace,\n * mirroring the structure used by `Refs.make`.\n */\nexport const merge = <\n ConvexSpec extends AnyWithPropsWithRuntime<\"Convex\">,\n NodeSpec extends AnyWithPropsWithRuntime<\"Node\">,\n>(\n convexSpec: ConvexSpec,\n nodeSpec?: NodeSpec,\n): AnyWithProps => {\n const groups = Option.fromNullable(nodeSpec).pipe(\n Option.map((nodeSpec_) =>\n Array.reduce(\n Record.toEntries(nodeSpec_.groups),\n GroupSpec.makeNodeAt(\"node\"),\n (nodeGroupSpec, [name, group]) => nodeGroupSpec.addGroupAt(name, group),\n ),\n ),\n Option.match({\n onNone: () => convexSpec.groups,\n onSome: (nodeGroup) => ({ ...convexSpec.groups, node: nodeGroup }),\n }),\n );\n\n return Object.assign(Object.create(Proto), {\n runtime: \"Convex\" as const,\n groups,\n }) as AnyWithProps;\n};\n"],"mappings":";;;;;;;;;;;;;;AAIA,MAAa,SAAS;AAGtB,MAAa,UAAU,MACrB,UAAU,YAAY,GAAG,OAAO;AAElC,MAAa,gBACX,MAEA,UAAU,YAAY,GAAG,OAAO,IAChC,UAAU,YAAY,GAAG,UAAU,IACnC,EAAE,YAAY;AAEhB,MAAa,cAAc,MACzB,UAAU,YAAY,GAAG,OAAO,IAChC,UAAU,YAAY,GAAG,UAAU,IACnC,EAAE,YAAY;AA4ChB,MAAM,QAAQ;EACX,SAAS;CAEV,IAA8D,OAAc;AAC1E,SAAO,UAAU;GACf,SAAS,KAAK;GACd,QAAQ,OAAO,IAAI,KAAK,QAAQ,MAAM,MAAM,MAAM;GACnD,CAAC;;CAGJ,MAEE,MACA,OACA;AACA,SAAO,UAAU;GACf,SAAS,KAAK;GACd,QAAQ,OAAO,IAAI,KAAK,QAAQ,MAAMA,SAAmB,MAAM,MAAM,CAAC;GACvE,CAAC;;CAEL;AAED,MAAM,aAGJ,EACA,SACA,aAKA,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;CAClC;CACA;CACD,CAAC;AAEJ,MAAa,aACX,UAAU;CAAE,SAAS;CAAU,QAAQ,EAAE;CAAE,CAAC;AAE9C,MAAa,iBACX,UAAU;CAAE,SAAS;CAAQ,QAAQ,EAAE;CAAE,CAAC;;;;;;;AAQ5C,MAAa,SAIX,YACA,aACiB;CACjB,MAAM,SAAS,OAAO,aAAa,SAAS,CAAC,KAC3C,OAAO,KAAK,cACV,MAAM,OACJ,OAAO,UAAU,UAAU,OAAO,EAClCC,WAAqB,OAAO,GAC3B,eAAe,CAAC,MAAM,WAAW,cAAc,WAAW,MAAM,MAAM,CACxE,CACF,EACD,OAAO,MAAM;EACX,cAAc,WAAW;EACzB,SAAS,eAAe;GAAE,GAAG,WAAW;GAAQ,MAAM;GAAW;EAClE,CAAC,CACH;AAED,QAAO,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;EACzC,SAAS;EACT;EACD,CAAC"}
1
+ {"version":3,"file":"Spec.js","names":["GroupSpec.withName"],"sources":["../src/Spec.ts"],"sourcesContent":["import * as Predicate from \"effect/Predicate\";\nimport * as Record from \"effect/Record\";\nimport * as GroupSpec from \"./GroupSpec\";\n\nexport const TypeId = \"@confect/core/Spec\";\nexport type TypeId = typeof TypeId;\n\nexport const isSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\n/**\n * A Confect spec: a flat container of function groups. Groups may be of any\n * runtime — a group built with `GroupSpec.makeNode()` (a Node action group) sits\n * alongside `GroupSpec.make()` groups in the same namespace. The runtime of a\n * group lives on the group itself (`GroupSpec.runtime`) and on each function's\n * `RuntimeAndFunctionType`; the spec does not carry a runtime of its own.\n */\nexport interface Spec<Groups_ extends GroupSpec.AnyWithProps = never> {\n readonly [TypeId]: TypeId;\n readonly groups: {\n [GroupName in GroupSpec.Name<Groups_>]: GroupSpec.WithName<\n Groups_,\n GroupName\n >;\n };\n\n add<Group extends GroupSpec.AnyWithProps>(\n group: Group,\n ): Spec<Groups_ | Group>;\n\n addAt<const Name extends string, Group extends GroupSpec.AnyWithProps>(\n name: Name,\n group: Group,\n ): Spec<Groups_ | GroupSpec.NamedAt<Group, Name>>;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends Spec<GroupSpec.AnyWithProps> {}\n\nexport type Groups<Spec_ extends AnyWithProps> =\n Spec_[\"groups\"][keyof Spec_[\"groups\"]];\n\nconst Proto = {\n [TypeId]: TypeId,\n\n add<Group extends GroupSpec.AnyWithProps>(this: AnyWithProps, group: Group) {\n return makeProto({\n groups: Record.set(this.groups, group.name, group),\n });\n },\n\n addAt<Group extends GroupSpec.AnyWithProps>(\n this: AnyWithProps,\n name: string,\n group: Group,\n ) {\n return makeProto({\n groups: Record.set(this.groups, name, GroupSpec.withName(name, group)),\n });\n },\n};\n\nconst makeProto = <Groups_ extends GroupSpec.AnyWithProps>({\n groups,\n}: {\n groups: Record.ReadonlyRecord<string, Groups_>;\n}): Spec<Groups_> =>\n Object.assign(Object.create(Proto), {\n groups,\n });\n\nexport const make = (): Spec => makeProto({ groups: {} });\n"],"mappings":";;;;;;;;;;;AAIA,MAAa,SAAS;AAGtB,MAAa,UAAU,MACrB,UAAU,YAAY,GAAG,OAAO;AAqClC,MAAM,QAAQ;EACX,SAAS;CAEV,IAA8D,OAAc;AAC1E,SAAO,UAAU,EACf,QAAQ,OAAO,IAAI,KAAK,QAAQ,MAAM,MAAM,MAAM,EACnD,CAAC;;CAGJ,MAEE,MACA,OACA;AACA,SAAO,UAAU,EACf,QAAQ,OAAO,IAAI,KAAK,QAAQ,MAAMA,SAAmB,MAAM,MAAM,CAAC,EACvE,CAAC;;CAEL;AAED,MAAM,aAAqD,EACzD,aAIA,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE,EAClC,QACD,CAAC;AAEJ,MAAa,aAAmB,UAAU,EAAE,QAAQ,EAAE,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { GenericId } from "./GenericId.js";
2
- import { Schema } from "effect";
2
+ import * as Schema from "effect/Schema";
3
3
  import { Expand, IdField, SystemFields as SystemFields$1 } from "convex/server";
4
4
 
5
5
  //#region src/SystemFields.d.ts
@@ -1,6 +1,6 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import { GenericId } from "./GenericId.js";
3
- import { Schema } from "effect";
3
+ import * as Schema from "effect/Schema";
4
4
 
5
5
  //#region src/SystemFields.ts
6
6
  var SystemFields_exports = /* @__PURE__ */ __exportAll({
@@ -1 +1 @@
1
- {"version":3,"file":"SystemFields.js","names":["GenericId.GenericId"],"sources":["../src/SystemFields.ts"],"sourcesContent":["import type {\n Expand,\n IdField,\n SystemFields as NonIdSystemFields,\n} from \"convex/server\";\nimport { Schema } from \"effect\";\nimport * as GenericId from \"./GenericId\";\n\ntype SystemFieldsSchema<TableName extends string> = Schema.Struct<{\n _id: Schema.Schema<\n GenericId.GenericId<TableName>,\n GenericId.GenericId<TableName>,\n never\n >;\n _creationTime: typeof Schema.Number;\n}>;\n\n/**\n * Produces a schema for Convex system fields.\n */\nexport const SystemFields = <TableName extends string>(\n tableName: TableName,\n): SystemFieldsSchema<TableName> =>\n Schema.Struct({\n _id: GenericId.GenericId(tableName),\n _creationTime: Schema.Number,\n });\n\n/**\n * Extend a table schema with Convex system fields.\n */\nexport const extendWithSystemFields = <\n TableName extends string,\n TableSchema extends Schema.Schema.AnyNoContext,\n>(\n tableName: TableName,\n schema: TableSchema,\n): ExtendWithSystemFields<TableName, TableSchema> =>\n Schema.extend(SystemFields(tableName), schema);\n\n/**\n * Extend a table schema with Convex system fields at the type level.\n */\nexport type ExtendWithSystemFields<\n TableName extends string,\n TableSchema extends Schema.Schema.AnyNoContext,\n> = Schema.extend<SystemFieldsSchema<TableName>, TableSchema>;\n\nexport type WithSystemFields<TableName extends string, Document> = Expand<\n Readonly<IdField<TableName>> & Readonly<NonIdSystemFields> & Document\n>;\n"],"mappings":";;;;;;;;;;;;AAoBA,MAAa,gBACX,cAEA,OAAO,OAAO;CACZ,KAAKA,UAAoB,UAAU;CACnC,eAAe,OAAO;CACvB,CAAC;;;;AAKJ,MAAa,0BAIX,WACA,WAEA,OAAO,OAAO,aAAa,UAAU,EAAE,OAAO"}
1
+ {"version":3,"file":"SystemFields.js","names":["GenericId.GenericId"],"sources":["../src/SystemFields.ts"],"sourcesContent":["import type {\n Expand,\n IdField,\n SystemFields as NonIdSystemFields,\n} from \"convex/server\";\nimport * as Schema from \"effect/Schema\";\nimport * as GenericId from \"./GenericId\";\n\ntype SystemFieldsSchema<TableName extends string> = Schema.Struct<{\n _id: Schema.Schema<\n GenericId.GenericId<TableName>,\n GenericId.GenericId<TableName>,\n never\n >;\n _creationTime: typeof Schema.Number;\n}>;\n\n/**\n * Produces a schema for Convex system fields.\n */\nexport const SystemFields = <TableName extends string>(\n tableName: TableName,\n): SystemFieldsSchema<TableName> =>\n Schema.Struct({\n _id: GenericId.GenericId(tableName),\n _creationTime: Schema.Number,\n });\n\n/**\n * Extend a table schema with Convex system fields.\n */\nexport const extendWithSystemFields = <\n TableName extends string,\n TableSchema extends Schema.Schema.AnyNoContext,\n>(\n tableName: TableName,\n schema: TableSchema,\n): ExtendWithSystemFields<TableName, TableSchema> =>\n Schema.extend(SystemFields(tableName), schema);\n\n/**\n * Extend a table schema with Convex system fields at the type level.\n */\nexport type ExtendWithSystemFields<\n TableName extends string,\n TableSchema extends Schema.Schema.AnyNoContext,\n> = Schema.extend<SystemFieldsSchema<TableName>, TableSchema>;\n\nexport type WithSystemFields<TableName extends string, Document> = Expand<\n Readonly<IdField<TableName>> & Readonly<NonIdSystemFields> & Document\n>;\n"],"mappings":";;;;;;;;;;;;AAoBA,MAAa,gBACX,cAEA,OAAO,OAAO;CACZ,KAAKA,UAAoB,UAAU;CACnC,eAAe,OAAO;CACvB,CAAC;;;;AAKJ,MAAa,0BAIX,WACA,WAEA,OAAO,OAAO,aAAa,UAAU,EAAE,OAAO"}
package/dist/Types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Brand } from "effect";
2
1
  import { DocumentByName, FieldTypeFromFieldPath, GenericDataModel, GenericDatabaseReader, TableNamesInDataModel } from "convex/server";
3
2
  import { GenericId } from "convex/values";
3
+ import { Brand } from "effect";
4
4
 
5
5
  //#region src/Types.d.ts
6
6
  declare namespace Types_d_exports {
@@ -1,4 +1,4 @@
1
- import { Schema } from "effect";
1
+ import * as Schema from "effect/Schema";
2
2
 
3
3
  //#region src/UserIdentity.d.ts
4
4
  declare namespace UserIdentity_d_exports {
@@ -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/UserIdentity.ts
5
5
  var UserIdentity_exports = /* @__PURE__ */ __exportAll({ UserIdentity: () => UserIdentity });
@@ -1 +1 @@
1
- {"version":3,"file":"UserIdentity.js","names":[],"sources":["../src/UserIdentity.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nexport const UserIdentity = <CustomClaimsFields extends Schema.Struct.Fields>(\n customClaimsFields: CustomClaimsFields,\n) =>\n Schema.Struct({\n ...customClaimsFields,\n tokenIdentifier: Schema.String,\n subject: Schema.String,\n issuer: Schema.String,\n name: Schema.optionalWith(Schema.String, { exact: true }),\n givenName: Schema.optionalWith(Schema.String, { exact: true }),\n familyName: Schema.optionalWith(Schema.String, { exact: true }),\n nickname: Schema.optionalWith(Schema.String, { exact: true }),\n preferredUsername: Schema.optionalWith(Schema.String, { exact: true }),\n profileUrl: Schema.optionalWith(Schema.String, { exact: true }),\n pictureUrl: Schema.optionalWith(Schema.String, { exact: true }),\n email: Schema.optionalWith(Schema.String, { exact: true }),\n emailVerified: Schema.optionalWith(Schema.Boolean, { exact: true }),\n gender: Schema.optionalWith(Schema.String, { exact: true }),\n birthday: Schema.optionalWith(Schema.String, { exact: true }),\n timezone: Schema.optionalWith(Schema.String, { exact: true }),\n language: Schema.optionalWith(Schema.String, { exact: true }),\n phoneNumber: Schema.optionalWith(Schema.String, { exact: true }),\n phoneNumberVerified: Schema.optionalWith(Schema.Boolean, { exact: true }),\n address: Schema.optionalWith(Schema.String, { exact: true }),\n updatedAt: Schema.optionalWith(Schema.String, { exact: true }),\n });\n"],"mappings":";;;;;AAEA,MAAa,gBACX,uBAEA,OAAO,OAAO;CACZ,GAAG;CACH,iBAAiB,OAAO;CACxB,SAAS,OAAO;CAChB,QAAQ,OAAO;CACf,MAAM,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CACzD,WAAW,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC9D,YAAY,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC/D,UAAU,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC7D,mBAAmB,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CACtE,YAAY,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC/D,YAAY,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC/D,OAAO,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC1D,eAAe,OAAO,aAAa,OAAO,SAAS,EAAE,OAAO,MAAM,CAAC;CACnE,QAAQ,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC3D,UAAU,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC7D,UAAU,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC7D,UAAU,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC7D,aAAa,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAChE,qBAAqB,OAAO,aAAa,OAAO,SAAS,EAAE,OAAO,MAAM,CAAC;CACzE,SAAS,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC5D,WAAW,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC/D,CAAC"}
1
+ {"version":3,"file":"UserIdentity.js","names":[],"sources":["../src/UserIdentity.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\nexport const UserIdentity = <CustomClaimsFields extends Schema.Struct.Fields>(\n customClaimsFields: CustomClaimsFields,\n) =>\n Schema.Struct({\n ...customClaimsFields,\n tokenIdentifier: Schema.String,\n subject: Schema.String,\n issuer: Schema.String,\n name: Schema.optionalWith(Schema.String, { exact: true }),\n givenName: Schema.optionalWith(Schema.String, { exact: true }),\n familyName: Schema.optionalWith(Schema.String, { exact: true }),\n nickname: Schema.optionalWith(Schema.String, { exact: true }),\n preferredUsername: Schema.optionalWith(Schema.String, { exact: true }),\n profileUrl: Schema.optionalWith(Schema.String, { exact: true }),\n pictureUrl: Schema.optionalWith(Schema.String, { exact: true }),\n email: Schema.optionalWith(Schema.String, { exact: true }),\n emailVerified: Schema.optionalWith(Schema.Boolean, { exact: true }),\n gender: Schema.optionalWith(Schema.String, { exact: true }),\n birthday: Schema.optionalWith(Schema.String, { exact: true }),\n timezone: Schema.optionalWith(Schema.String, { exact: true }),\n language: Schema.optionalWith(Schema.String, { exact: true }),\n phoneNumber: Schema.optionalWith(Schema.String, { exact: true }),\n phoneNumberVerified: Schema.optionalWith(Schema.Boolean, { exact: true }),\n address: Schema.optionalWith(Schema.String, { exact: true }),\n updatedAt: Schema.optionalWith(Schema.String, { exact: true }),\n });\n"],"mappings":";;;;;AAEA,MAAa,gBACX,uBAEA,OAAO,OAAO;CACZ,GAAG;CACH,iBAAiB,OAAO;CACxB,SAAS,OAAO;CAChB,QAAQ,OAAO;CACf,MAAM,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CACzD,WAAW,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC9D,YAAY,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC/D,UAAU,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC7D,mBAAmB,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CACtE,YAAY,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC/D,YAAY,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC/D,OAAO,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC1D,eAAe,OAAO,aAAa,OAAO,SAAS,EAAE,OAAO,MAAM,CAAC;CACnE,QAAQ,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC3D,UAAU,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC7D,UAAU,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC7D,UAAU,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC7D,aAAa,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAChE,qBAAqB,OAAO,aAAa,OAAO,SAAS,EAAE,OAAO,MAAM,CAAC;CACzE,SAAS,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC5D,WAAW,OAAO,aAAa,OAAO,QAAQ,EAAE,OAAO,MAAM,CAAC;CAC/D,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@confect/core",
3
3
  "description": "Shared specs and schemas used by all Confect packages",
4
- "version": "9.0.0-next.7",
4
+ "version": "9.0.0-next.9",
5
5
  "author": "RJ Dellecese",
6
6
  "bugs": {
7
7
  "url": "https://github.com/rjdellecese/confect/issues"
@@ -1,6 +1,6 @@
1
1
  import type { DefaultFunctionArgs } from "convex/server";
2
2
  import type { Schema } from "effect";
3
- import { Data } from "effect";
3
+ import * as Data from "effect/Data";
4
4
  import * as Lazy from "./Lazy";
5
5
 
6
6
  export type FunctionProvenance = Data.TaggedEnum<{
@@ -6,7 +6,7 @@ import type {
6
6
  RegisteredQuery,
7
7
  } from "convex/server";
8
8
  import type { Schema } from "effect";
9
- import { Predicate } from "effect";
9
+ import * as Predicate from "effect/Predicate";
10
10
  import * as FunctionProvenance from "./FunctionProvenance";
11
11
  import { validateConfectFunctionIdentifier } from "./Identifier";
12
12
  import * as RuntimeAndFunctionType from "./RuntimeAndFunctionType";
package/src/GenericId.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import type { GenericId as ConvexGenericId } from "convex/values";
2
- import { type Option, Schema, SchemaAST } from "effect";
2
+ import type { Option } from "effect";
3
+ import * as Schema from "effect/Schema";
4
+ import * as SchemaAST from "effect/SchemaAST";
3
5
 
4
6
  const ConvexId = Symbol.for("ConvexId");
5
7
 
package/src/GroupSpec.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { Predicate, Record } from "effect";
1
+ import * as Predicate from "effect/Predicate";
2
+ import * as Record from "effect/Record";
2
3
  import type * as FunctionSpec from "./FunctionSpec";
3
4
  import type * as RuntimeAndFunctionType from "./RuntimeAndFunctionType";
4
5
  import { validateConfectFunctionIdentifier } from "./Identifier";
@@ -13,7 +14,11 @@ export interface GroupSpec<
13
14
  Runtime extends RuntimeAndFunctionType.Runtime,
14
15
  Name_ extends string,
15
16
  Functions_ extends FunctionSpec.AnyWithPropsWithRuntime<Runtime> = never,
16
- Groups_ extends AnyWithPropsWithRuntime<Runtime> = never,
17
+ // Subgroups may be of any runtime, independent of this group's own runtime: a
18
+ // group is only a namespace for its children, which are otherwise-independent
19
+ // modules. Functions, by contrast, stay homogeneous (a Node group only accepts
20
+ // Node actions) — `addFunction` keeps the `<Runtime>` bound below.
21
+ Groups_ extends AnyWithProps = never,
17
22
  > {
18
23
  readonly [TypeId]: TypeId;
19
24
  readonly runtime: Runtime;
@@ -31,14 +36,11 @@ export interface GroupSpec<
31
36
  function_: Function,
32
37
  ): GroupSpec<Runtime, Name_, Functions_ | Function, Groups_>;
33
38
 
34
- addGroup<Group extends AnyWithPropsWithRuntime<Runtime>>(
39
+ addGroup<Group extends AnyWithProps>(
35
40
  group: Group,
36
41
  ): GroupSpec<Runtime, Name_, Functions_, Groups_ | Group>;
37
42
 
38
- addGroupAt<
39
- const AtName extends string,
40
- Group extends AnyWithPropsWithRuntime<Runtime>,
41
- >(
43
+ addGroupAt<const AtName extends string, Group extends AnyWithProps>(
42
44
  name: AtName,
43
45
  group: Group,
44
46
  ): GroupSpec<Runtime, Name_, Functions_, Groups_ | NamedAt<Group, AtName>>;
@@ -1,4 +1,4 @@
1
- import { Schema } from "effect";
1
+ import * as Schema from "effect/Schema";
2
2
 
3
3
  export const PaginationResult = <Doc extends Schema.Schema.AnyNoContext>(
4
4
  Doc: Doc,
package/src/Ref.ts CHANGED
@@ -6,7 +6,10 @@ import { makeFunctionReference } from "convex/server";
6
6
  import type { Value } from "convex/values";
7
7
  import { ConvexError } from "convex/values";
8
8
  import type { ParseResult } from "effect";
9
- import { Effect, Match, Option, Schema } from "effect";
9
+ import * as Effect from "effect/Effect";
10
+ import * as Match from "effect/Match";
11
+ import * as Option from "effect/Option";
12
+ import * as Schema from "effect/Schema";
10
13
  import type * as FunctionSpec from "./FunctionSpec";
11
14
  import type * as RuntimeAndFunctionType from "./RuntimeAndFunctionType";
12
15
 
package/src/Refs.ts CHANGED
@@ -1,30 +1,16 @@
1
1
  import type { Types } from "effect";
2
- import { Array, Option, pipe, Record } from "effect";
2
+ import { pipe } from "effect/Function";
3
+ import * as Option from "effect/Option";
4
+ import * as Record from "effect/Record";
3
5
  import type * as FunctionSpec from "./FunctionSpec";
4
- import * as GroupSpec from "./GroupSpec";
6
+ import type * as GroupSpec from "./GroupSpec";
5
7
  import * as Ref from "./Ref";
6
8
  import type * as Spec from "./Spec";
7
9
 
8
10
  export type Refs<
9
- ConvexSpec extends Spec.AnyWithPropsWithRuntime<"Convex">,
10
- NodeSpec extends Spec.AnyWithPropsWithRuntime<"Node"> = never,
11
+ Spec_ extends Spec.AnyWithProps,
11
12
  Predicate extends Ref.Any = Ref.Any,
12
- > = Types.Simplify<
13
- OmitEmpty<
14
- Helper<
15
- | Spec.Groups<ConvexSpec>
16
- | (NodeSpec extends never
17
- ? never
18
- : GroupSpec.GroupSpec<
19
- "Node",
20
- "node",
21
- never,
22
- NodeSpec["groups"][keyof NodeSpec["groups"]]
23
- >),
24
- Predicate
25
- >
26
- >
27
- >;
13
+ > = Types.Simplify<OmitEmpty<Helper<Spec.Groups<Spec_>, Predicate>>>;
28
14
 
29
15
  type GroupRefs<
30
16
  Group extends GroupSpec.AnyWithProps,
@@ -86,33 +72,16 @@ type Any =
86
72
  }
87
73
  | Ref.Any;
88
74
 
89
- export const make = <
90
- ConvexSpec extends Spec.AnyWithPropsWithRuntime<"Convex">,
91
- NodeSpec extends Spec.AnyWithPropsWithRuntime<"Node"> = never,
92
- >(
93
- convexSpec: ConvexSpec,
94
- nodeSpec?: NodeSpec,
75
+ export const make = <Spec_ extends Spec.AnyWithProps>(
76
+ spec: Spec_,
95
77
  ): {
96
- public: Refs<ConvexSpec, NodeSpec, Ref.AnyPublic>;
97
- internal: Refs<ConvexSpec, NodeSpec, Ref.AnyInternal>;
78
+ public: Refs<Spec_, Ref.AnyPublic>;
79
+ internal: Refs<Spec_, Ref.AnyInternal>;
98
80
  } => {
99
- const groups = Option.fromNullable(nodeSpec).pipe(
100
- Option.map((nodeSpec_) =>
101
- Array.reduce(
102
- Record.toEntries(nodeSpec_.groups),
103
- GroupSpec.makeNodeAt("node"),
104
- (nodeGroupSpec, [name, group]) => nodeGroupSpec.addGroupAt(name, group),
105
- ),
106
- ),
107
- Option.match({
108
- onNone: () => convexSpec.groups,
109
- onSome: (nodeGroup) => ({ ...convexSpec.groups, node: nodeGroup }),
110
- }),
111
- );
112
- const refs = makeHelper(groups);
81
+ const refs = makeHelper(spec.groups);
113
82
  return {
114
- public: refs as Refs<ConvexSpec, NodeSpec, Ref.AnyPublic>,
115
- internal: refs as Refs<ConvexSpec, NodeSpec, Ref.AnyInternal>,
83
+ public: refs as Refs<Spec_, Ref.AnyPublic>,
84
+ internal: refs as Refs<Spec_, Ref.AnyInternal>,
116
85
  };
117
86
  };
118
87
 
package/src/Registry.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { Context, Ref } from "effect";
1
+ import * as Context from "effect/Context";
2
+ import * as Ref from "effect/Ref";
2
3
 
3
4
  /**
4
5
  * Recursive tree that mirrors a `Spec`'s group structure. Leaves are the