@confect/server 8.0.0 → 9.0.0-next.0

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 (45) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/DatabaseSchema.d.ts +9 -4
  3. package/dist/DatabaseSchema.d.ts.map +1 -1
  4. package/dist/DatabaseSchema.js +4 -3
  5. package/dist/DatabaseSchema.js.map +1 -1
  6. package/dist/FunctionImpl.d.ts +10 -7
  7. package/dist/FunctionImpl.d.ts.map +1 -1
  8. package/dist/FunctionImpl.js +8 -8
  9. package/dist/FunctionImpl.js.map +1 -1
  10. package/dist/GroupImpl.d.ts +51 -12
  11. package/dist/GroupImpl.d.ts.map +1 -1
  12. package/dist/GroupImpl.js +72 -4
  13. package/dist/GroupImpl.js.map +1 -1
  14. package/dist/GroupPath.d.ts +8 -0
  15. package/dist/GroupPath.d.ts.map +1 -0
  16. package/dist/GroupPath.js +10 -0
  17. package/dist/GroupPath.js.map +1 -0
  18. package/dist/RegisteredConvexFunction.d.ts +6 -6
  19. package/dist/RegisteredConvexFunction.d.ts.map +1 -1
  20. package/dist/RegisteredFunction.d.ts +3 -3
  21. package/dist/RegisteredFunction.d.ts.map +1 -1
  22. package/dist/RegisteredFunctions.d.ts +15 -4
  23. package/dist/RegisteredFunctions.d.ts.map +1 -1
  24. package/dist/RegisteredFunctions.js +20 -11
  25. package/dist/RegisteredFunctions.js.map +1 -1
  26. package/dist/StorageActionWriter.d.ts +1 -1
  27. package/dist/index.d.ts +1 -3
  28. package/dist/index.js +1 -3
  29. package/package.json +4 -6
  30. package/src/DatabaseSchema.ts +10 -7
  31. package/src/FunctionImpl.ts +27 -36
  32. package/src/GroupImpl.ts +168 -32
  33. package/src/GroupPath.ts +43 -0
  34. package/src/RegisteredFunctions.ts +78 -28
  35. package/src/index.ts +0 -2
  36. package/dist/Impl.d.ts +0 -24
  37. package/dist/Impl.d.ts.map +0 -1
  38. package/dist/Impl.js +0 -28
  39. package/dist/Impl.js.map +0 -1
  40. package/dist/Registry.d.ts +0 -15
  41. package/dist/Registry.d.ts.map +0 -1
  42. package/dist/Registry.js +0 -10
  43. package/dist/Registry.js.map +0 -1
  44. package/src/Impl.ts +0 -59
  45. package/src/Registry.ts +0 -13
package/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # @confect/server
2
2
 
3
+ ## 9.0.0-next.0
4
+
5
+ ### Major Changes
6
+
7
+ - 6db3a3a: Derive Confect function paths from the filesystem layout of `confect/`. Each group lives in a colocated `*.spec.ts`/`*.impl.ts` pair, and the group's name is its path within `confect/` (file stem for top-level groups, dot-joined directory path for nested groups). See [Project Structure](https://confect.dev/concepts/project-structure), [File Naming Conventions](https://confect.dev/concepts/file-naming-conventions), and [The Spec/Impl Model](https://confect.dev/concepts/spec-impl-model) for the current model.
8
+
9
+ Each `*.spec.ts` default-exports its `GroupSpec`. Each `*.impl.ts` default-imports its sibling spec, builds its `GroupImpl`, and default-exports the result of `GroupImpl.finalize`. Named co-exports on `*.spec.ts` (such as error classes) remain allowed.
10
+
11
+ ### Why
12
+
13
+ The previous model assembled every group's impl into a single root `confect/impl.ts` (plus `confect/nodeImpl.ts`), which `confect codegen` emitted as the aggregate `_generated/registeredFunctions.ts`. Every generated `convex/` module — one per Convex function — imported from that aggregate, so loading any single query, mutation, or action transitively loaded the impl module of every other Convex function in the project, along with all of their dependencies. For large projects this inflated each function's bundle and added meaningful cold-start cost on Convex.
14
+
15
+ Splitting impl across colocated `*.impl.ts` files is the vehicle for fixing that. With this change, `confect codegen` emits one `_generated/registeredFunctions/{path}.ts` per group, and each generated `convex/` module imports only its own group's per-group registry — which in turn imports only its own sibling `.impl.ts`. A Convex function's cold-start bundle now scales with its own group's impl rather than with the size of the whole project.
16
+
17
+ ### Breaking changes
18
+ - `GroupSpec.make()` and `GroupSpec.makeNode()` no longer take a name argument; the group name is derived from the spec file's path within `confect/`.
19
+ - `FunctionImpl.make(api, groupSpec, fn, handler)` and `GroupImpl.make(api, groupSpec)` now take the imported sibling spec object as their second argument instead of a dot-path string.
20
+ - Every `GroupImpl` pipeline must end with `GroupImpl.finalize`, which only typechecks once every function declared by the spec has a corresponding `FunctionImpl` provided to the group layer. `GroupImpl.finalize` snapshots the names of every registered function onto the produced `Finalized` `GroupImpl` service value, and `confect codegen` reads those names to verify per-function coverage against the spec at runtime.
21
+ - The previously-exported `Impl.make` and `Impl.finalize` (used by the old root `impl.ts`/`nodeImpl.ts` files) are removed. Per-group completeness is now enforced by `GroupImpl.finalize`.
22
+ - Root `confect/spec.ts`, `confect/impl.ts`, `confect/nodeSpec.ts`, `confect/nodeImpl.ts`, and any parent aggregator `*.spec.ts`/`*.impl.ts` files are no longer used. `confect codegen` deletes any of these on upgrade, along with the stale `_generated/registeredFunctions.ts` and `_generated/nodeRegisteredFunctions.ts`.
23
+ - Every module under `convex/` is re-emitted to import from `_generated/registeredFunctions/{path}` instead of the previous aggregate file. Users who commit `convex/` to source control should expect a full rewrite of that directory on first codegen.
24
+
25
+ ### Migration
26
+ 1. For each existing group, create a colocated `confect/{path}.spec.ts` and `confect/{path}.impl.ts` pair (under a subdirectory for nested groups).
27
+ - In each spec, call `GroupSpec.make()` (or `GroupSpec.makeNode()`) without a name and `export default` the result.
28
+ - In each impl, default-import the sibling spec (e.g. `import notes from "./notes.spec"`), pass it to `FunctionImpl.make`/`GroupImpl.make` in place of the previous dot-path string, append `GroupImpl.finalize` to the pipeline, and `export default` the resulting `GroupImpl` layer:
29
+ ```ts
30
+ export default GroupImpl.make(api, notes).pipe(
31
+ Layer.provide(list),
32
+ Layer.provide(insert),
33
+ GroupImpl.finalize,
34
+ );
35
+ ```
36
+ 2. Delete root `confect/spec.ts`, `confect/impl.ts`, `confect/nodeSpec.ts`, `confect/nodeImpl.ts`, and any parent aggregator spec/impl files. (`confect codegen` will also delete any of these it finds, plus the stale `_generated/registeredFunctions.ts` and `_generated/nodeRegisteredFunctions.ts`, so this step can be skipped.)
37
+ 3. Run `confect codegen`. Every module under `convex/` will be re-emitted.
38
+
39
+ ### Patch Changes
40
+
41
+ - Updated dependencies [6db3a3a]
42
+ - @confect/core@9.0.0-next.0
43
+
3
44
  ## 8.0.0
4
45
 
5
46
  ### Major Changes
@@ -1,18 +1,23 @@
1
1
  import { AnyWithProps as AnyWithProps$1, Name, SystemTables, Table, TablesRecord, WithName } from "./Table.js";
2
2
  import { Expand, GenericSchema, SchemaDefinition } from "convex/server";
3
3
  import * as convex_values0 from "convex/values";
4
- import { Any, TypeId, TypeId as TypeId$1, isDatabaseSchema } from "@confect/core/DatabaseSchema";
5
4
  import * as effect_Schema0 from "effect/Schema";
6
5
 
7
6
  //#region src/DatabaseSchema.d.ts
8
7
  declare namespace DatabaseSchema_d_exports {
9
8
  export { Any, AnyWithProps, ConvexDatabaseSchemaFromTables, DatabaseSchema, ExtendWithSystemTables, IncludeSystemTables, TableNames, TableWithName, Tables, TypeId, extendWithSystemTables, isDatabaseSchema, make, systemSchema };
10
9
  }
10
+ declare const TypeId = "@confect/server/DatabaseSchema";
11
+ type TypeId = typeof TypeId;
12
+ interface Any {
13
+ readonly [TypeId]: TypeId;
14
+ }
15
+ declare const isDatabaseSchema: (u: unknown) => u is Any;
11
16
  /**
12
17
  * A schema definition tracks the schema and its Convex schema definition.
13
18
  */
14
19
  interface DatabaseSchema<Tables_ extends AnyWithProps$1 = never> {
15
- readonly [TypeId$1]: TypeId$1;
20
+ readonly [TypeId]: TypeId;
16
21
  readonly tables: TablesRecord<Tables_>;
17
22
  readonly convexSchemaDefinition: SchemaDefinition<ConvexDatabaseSchemaFromTables<Tables_>, true>;
18
23
  /**
@@ -21,7 +26,7 @@ interface DatabaseSchema<Tables_ extends AnyWithProps$1 = never> {
21
26
  addTable<TableDef extends AnyWithProps$1>(table: TableDef): DatabaseSchema<Tables_ | TableDef>;
22
27
  }
23
28
  interface AnyWithProps {
24
- readonly [TypeId$1]: TypeId$1;
29
+ readonly [TypeId]: TypeId;
25
30
  readonly tables: Record<string, AnyWithProps$1>;
26
31
  readonly convexSchemaDefinition: SchemaDefinition<GenericSchema, true>;
27
32
  addTable<TableDef extends AnyWithProps$1>(table: TableDef): AnyWithProps;
@@ -130,5 +135,5 @@ declare const extendWithSystemTables: <Tables_ extends AnyWithProps$1>(tables: T
130
135
  type ExtendWithSystemTables<Tables_ extends AnyWithProps$1> = TablesRecord<Tables_ | SystemTables>;
131
136
  type IncludeSystemTables<Tables_ extends AnyWithProps$1> = Tables_ | SystemTables extends infer T ? T extends AnyWithProps$1 ? T : never : never;
132
137
  //#endregion
133
- export { type Any, AnyWithProps, ConvexDatabaseSchemaFromTables, DatabaseSchema, DatabaseSchema_d_exports, ExtendWithSystemTables, IncludeSystemTables, TableNames, TableWithName, Tables, TypeId, extendWithSystemTables, isDatabaseSchema, make, systemSchema };
138
+ export { Any, AnyWithProps, ConvexDatabaseSchemaFromTables, DatabaseSchema, DatabaseSchema_d_exports, ExtendWithSystemTables, IncludeSystemTables, TableNames, TableWithName, Tables, TypeId, extendWithSystemTables, isDatabaseSchema, make, systemSchema };
134
139
  //# sourceMappingURL=DatabaseSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatabaseSchema.d.ts","names":[],"sources":["../src/DatabaseSchema.ts"],"mappings":";;;;;;;;;;;;;UAkBiB,cAAA,iBAA+B,cAAA;EAAA,UACpC,QAAA,GAAS,QAAA;EAAA,SACV,MAAA,EAAQ,YAAA,CAAmB,OAAA;EAAA,SAC3B,sBAAA,EAAwB,gBAAA,CAC/B,8BAAA,CAA+B,OAAA;;;;EAOjC,QAAA,kBAA0B,cAAA,EACxB,KAAA,EAAO,QAAA,GACN,cAAA,CAAe,OAAA,GAAU,QAAA;AAAA;AAAA,UAGb,YAAA;EAAA,UACL,QAAA,GAAS,QAAA;EAAA,SACV,MAAA,EAAQ,MAAA,SAAe,cAAA;EAAA,SACvB,sBAAA,EAAwB,gBAAA,CAAiB,aAAA;EAClD,QAAA,kBAA0B,cAAA,EAAoB,KA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AAAA,KAEnB,mBAAA,iBAAoC,cAAA,IAC5C,OAAA,GACA,YAAA,mBACA,CAAA,SAAU,cAAA,GACR,CAAA"}
@@ -1,8 +1,7 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import { scheduledFunctionsTable, storageTable, systemTables } from "./Table.js";
3
- import { Array, Record, pipe } from "effect";
3
+ import { Array, Predicate, Record, pipe } from "effect";
4
4
  import { defineSchema } from "convex/server";
5
- import { TypeId, TypeId as TypeId$1, isDatabaseSchema } from "@confect/core/DatabaseSchema";
6
5
 
7
6
  //#region src/DatabaseSchema.ts
8
7
  var DatabaseSchema_exports = /* @__PURE__ */ __exportAll({
@@ -12,8 +11,10 @@ var DatabaseSchema_exports = /* @__PURE__ */ __exportAll({
12
11
  make: () => make,
13
12
  systemSchema: () => systemSchema
14
13
  });
14
+ const TypeId = "@confect/server/DatabaseSchema";
15
+ const isDatabaseSchema = (u) => Predicate.hasProperty(u, TypeId);
15
16
  const Proto = {
16
- [TypeId$1]: TypeId$1,
17
+ [TypeId]: TypeId,
17
18
  addTable(table) {
18
19
  const newTablesArray = [...Object.values(this.tables), table];
19
20
  return makeProto({
@@ -1 +1 @@
1
- {"version":3,"file":"DatabaseSchema.js","names":["TypeId","defineConvexSchema","Table.scheduledFunctionsTable","Table.storageTable","Table.systemTables"],"sources":["../src/DatabaseSchema.ts"],"sourcesContent":["import type { Expand, GenericSchema } from \"convex/server\";\nimport {\n defineSchema as defineConvexSchema,\n type SchemaDefinition,\n} from \"convex/server\";\nimport { Array, pipe, Record } from \"effect\";\nimport * as Table from \"./Table\";\nimport { TypeId } from \"@confect/core/DatabaseSchema\";\n\nexport {\n type Any,\n isDatabaseSchema,\n TypeId,\n} from \"@confect/core/DatabaseSchema\";\n\n/**\n * A schema definition tracks the schema and its Convex schema definition.\n */\nexport interface DatabaseSchema<Tables_ extends Table.AnyWithProps = never> {\n readonly [TypeId]: TypeId;\n readonly tables: Table.TablesRecord<Tables_>;\n readonly convexSchemaDefinition: SchemaDefinition<\n ConvexDatabaseSchemaFromTables<Tables_>,\n true\n >;\n\n /**\n * Add a table definition to the schema.\n */\n addTable<TableDef extends Table.AnyWithProps>(\n table: TableDef,\n ): DatabaseSchema<Tables_ | TableDef>;\n}\n\nexport interface AnyWithProps {\n readonly [TypeId]: TypeId;\n readonly tables: Record<string, Table.AnyWithProps>;\n readonly convexSchemaDefinition: SchemaDefinition<GenericSchema, true>;\n addTable<TableDef extends Table.AnyWithProps>(table: TableDef): AnyWithProps;\n}\n\nexport type Tables<DatabaseSchema_ extends AnyWithProps> =\n DatabaseSchema_ extends DatabaseSchema<infer Tables_> ? Tables_ : never;\n\nexport type TableNames<DatabaseSchema_ extends AnyWithProps> = Table.Name<\n Tables<DatabaseSchema_>\n> &\n string;\n\nexport type TableWithName<\n DatabaseSchema_ extends AnyWithProps,\n TableName extends TableNames<DatabaseSchema_>,\n> = Extract<Tables<DatabaseSchema_>, { readonly name: TableName }>;\n\nconst Proto = {\n [TypeId]: TypeId,\n\n addTable<TableDef extends Table.AnyWithProps>(\n this: DatabaseSchema<Table.AnyWithProps>,\n table: TableDef,\n ) {\n const tablesArray = Object.values(this.tables) as Table.AnyWithProps[];\n const newTablesArray = [...tablesArray, table];\n\n return makeProto({\n tables: Record.set(this.tables, table.name, table),\n convexSchemaDefinition: pipe(\n newTablesArray,\n Array.map(\n ({ name, tableDefinition }) => [name, tableDefinition] as const,\n ),\n Record.fromEntries,\n defineConvexSchema,\n ),\n });\n },\n};\n\nconst makeProto = <Tables_ extends Table.AnyWithProps>({\n tables,\n convexSchemaDefinition,\n}: {\n tables: Record.ReadonlyRecord<string, Tables_>;\n convexSchemaDefinition: SchemaDefinition<GenericSchema, true>;\n}): DatabaseSchema<Tables_> =>\n Object.assign(Object.create(Proto), {\n tables,\n convexSchemaDefinition,\n });\n\n/**\n * Create an empty schema definition. Add tables incrementally via `addTable`.\n */\nexport const make = (): DatabaseSchema<never> =>\n makeProto({\n tables: Record.empty(),\n convexSchemaDefinition: defineConvexSchema({}),\n });\n\nexport type ConvexDatabaseSchemaFromTables<Tables_ extends Table.AnyWithProps> =\n Expand<{\n [TableName in Table.Name<Tables_> & string]: Table.WithName<\n Tables_,\n TableName\n >[\"tableDefinition\"];\n }>;\n\n// System tables\n\nexport const systemSchema = make()\n .addTable(Table.scheduledFunctionsTable)\n .addTable(Table.storageTable);\n\nexport const extendWithSystemTables = <Tables_ extends Table.AnyWithProps>(\n tables: Table.TablesRecord<Tables_>,\n): ExtendWithSystemTables<Tables_> =>\n ({\n ...tables,\n ...Table.systemTables,\n }) as ExtendWithSystemTables<Tables_>;\n\nexport type ExtendWithSystemTables<Tables_ extends Table.AnyWithProps> =\n Table.TablesRecord<Tables_ | Table.SystemTables>;\n\nexport type IncludeSystemTables<Tables_ extends Table.AnyWithProps> =\n | Tables_\n | Table.SystemTables extends infer T\n ? T extends Table.AnyWithProps\n ? T\n : never\n : never;\n"],"mappings":";;;;;;;;;;;;;;AAsDA,MAAM,QAAQ;EACXA,WAASA;CAEV,SAEE,OACA;EAEA,MAAM,iBAAiB,CAAC,GADJ,OAAO,OAAO,KAAK,OAAO,EACN,MAAM;AAE9C,SAAO,UAAU;GACf,QAAQ,OAAO,IAAI,KAAK,QAAQ,MAAM,MAAM,MAAM;GAClD,wBAAwB,KACtB,gBACA,MAAM,KACH,EAAE,MAAM,sBAAsB,CAAC,MAAM,gBAAgB,CACvD,EACD,OAAO,aACPC,aACD;GACF,CAAC;;CAEL;AAED,MAAM,aAAiD,EACrD,QACA,6BAKA,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;CAClC;CACA;CACD,CAAC;;;;AAKJ,MAAa,aACX,UAAU;CACR,QAAQ,OAAO,OAAO;CACtB,wBAAwBA,aAAmB,EAAE,CAAC;CAC/C,CAAC;AAYJ,MAAa,eAAe,MAAM,CAC/B,SAASC,wBAA8B,CACvC,SAASC,aAAmB;AAE/B,MAAa,0BACX,YAEC;CACC,GAAG;CACH,GAAGC;CACJ"}
1
+ {"version":3,"file":"DatabaseSchema.js","names":["defineConvexSchema","Table.scheduledFunctionsTable","Table.storageTable","Table.systemTables"],"sources":["../src/DatabaseSchema.ts"],"sourcesContent":["import type { Expand, GenericSchema } from \"convex/server\";\nimport {\n defineSchema as defineConvexSchema,\n type SchemaDefinition,\n} from \"convex/server\";\nimport { Array, pipe, Predicate, Record } from \"effect\";\nimport * as Table from \"./Table\";\n\nexport const TypeId = \"@confect/server/DatabaseSchema\";\nexport type TypeId = typeof TypeId;\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport const isDatabaseSchema = (u: unknown): u is Any =>\n Predicate.hasProperty(u, TypeId);\n\n/**\n * A schema definition tracks the schema and its Convex schema definition.\n */\nexport interface DatabaseSchema<Tables_ extends Table.AnyWithProps = never> {\n readonly [TypeId]: TypeId;\n readonly tables: Table.TablesRecord<Tables_>;\n readonly convexSchemaDefinition: SchemaDefinition<\n ConvexDatabaseSchemaFromTables<Tables_>,\n true\n >;\n\n /**\n * Add a table definition to the schema.\n */\n addTable<TableDef extends Table.AnyWithProps>(\n table: TableDef,\n ): DatabaseSchema<Tables_ | TableDef>;\n}\n\nexport interface AnyWithProps {\n readonly [TypeId]: TypeId;\n readonly tables: Record<string, Table.AnyWithProps>;\n readonly convexSchemaDefinition: SchemaDefinition<GenericSchema, true>;\n addTable<TableDef extends Table.AnyWithProps>(table: TableDef): AnyWithProps;\n}\n\nexport type Tables<DatabaseSchema_ extends AnyWithProps> =\n DatabaseSchema_ extends DatabaseSchema<infer Tables_> ? Tables_ : never;\n\nexport type TableNames<DatabaseSchema_ extends AnyWithProps> = Table.Name<\n Tables<DatabaseSchema_>\n> &\n string;\n\nexport type TableWithName<\n DatabaseSchema_ extends AnyWithProps,\n TableName extends TableNames<DatabaseSchema_>,\n> = Extract<Tables<DatabaseSchema_>, { readonly name: TableName }>;\n\nconst Proto = {\n [TypeId]: TypeId,\n\n addTable<TableDef extends Table.AnyWithProps>(\n this: DatabaseSchema<Table.AnyWithProps>,\n table: TableDef,\n ) {\n const tablesArray = Object.values(this.tables) as Table.AnyWithProps[];\n const newTablesArray = [...tablesArray, table];\n\n return makeProto({\n tables: Record.set(this.tables, table.name, table),\n convexSchemaDefinition: pipe(\n newTablesArray,\n Array.map(\n ({ name, tableDefinition }) => [name, tableDefinition] as const,\n ),\n Record.fromEntries,\n defineConvexSchema,\n ),\n });\n },\n};\n\nconst makeProto = <Tables_ extends Table.AnyWithProps>({\n tables,\n convexSchemaDefinition,\n}: {\n tables: Record.ReadonlyRecord<string, Tables_>;\n convexSchemaDefinition: SchemaDefinition<GenericSchema, true>;\n}): DatabaseSchema<Tables_> =>\n Object.assign(Object.create(Proto), {\n tables,\n convexSchemaDefinition,\n });\n\n/**\n * Create an empty schema definition. Add tables incrementally via `addTable`.\n */\nexport const make = (): DatabaseSchema<never> =>\n makeProto({\n tables: Record.empty(),\n convexSchemaDefinition: defineConvexSchema({}),\n });\n\nexport type ConvexDatabaseSchemaFromTables<Tables_ extends Table.AnyWithProps> =\n Expand<{\n [TableName in Table.Name<Tables_> & string]: Table.WithName<\n Tables_,\n TableName\n >[\"tableDefinition\"];\n }>;\n\n// System tables\n\nexport const systemSchema = make()\n .addTable(Table.scheduledFunctionsTable)\n .addTable(Table.storageTable);\n\nexport const extendWithSystemTables = <Tables_ extends Table.AnyWithProps>(\n tables: Table.TablesRecord<Tables_>,\n): ExtendWithSystemTables<Tables_> =>\n ({\n ...tables,\n ...Table.systemTables,\n }) as ExtendWithSystemTables<Tables_>;\n\nexport type ExtendWithSystemTables<Tables_ extends Table.AnyWithProps> =\n Table.TablesRecord<Tables_ | Table.SystemTables>;\n\nexport type IncludeSystemTables<Tables_ extends Table.AnyWithProps> =\n | Tables_\n | Table.SystemTables extends infer T\n ? T extends Table.AnyWithProps\n ? T\n : never\n : never;\n"],"mappings":";;;;;;;;;;;;;AAQA,MAAa,SAAS;AAOtB,MAAa,oBAAoB,MAC/B,UAAU,YAAY,GAAG,OAAO;AAyClC,MAAM,QAAQ;EACX,SAAS;CAEV,SAEE,OACA;EAEA,MAAM,iBAAiB,CAAC,GADJ,OAAO,OAAO,KAAK,OAAO,EACN,MAAM;AAE9C,SAAO,UAAU;GACf,QAAQ,OAAO,IAAI,KAAK,QAAQ,MAAM,MAAM,MAAM;GAClD,wBAAwB,KACtB,gBACA,MAAM,KACH,EAAE,MAAM,sBAAsB,CAAC,MAAM,gBAAgB,CACvD,EACD,OAAO,aACPA,aACD;GACF,CAAC;;CAEL;AAED,MAAM,aAAiD,EACrD,QACA,6BAKA,OAAO,OAAO,OAAO,OAAO,MAAM,EAAE;CAClC;CACA;CACD,CAAC;;;;AAKJ,MAAa,aACX,UAAU;CACR,QAAQ,OAAO,OAAO;CACtB,wBAAwBA,aAAmB,EAAE,CAAC;CAC/C,CAAC;AAYJ,MAAa,eAAe,MAAM,CAC/B,SAASC,wBAA8B,CACvC,SAASC,aAAmB;AAE/B,MAAa,0BACX,YAEC;CACC,GAAG;CACH,GAAGC;CACJ"}
@@ -1,13 +1,12 @@
1
- import { AnyWithProps, Groups, Schema as Schema$1 } from "./Api.js";
1
+ import { AnyWithProps, Schema as Schema$1 } from "./Api.js";
2
2
  import { WithName } from "./Handler.js";
3
3
  import { Context, Layer } from "effect";
4
4
  import * as FunctionSpec from "@confect/core/FunctionSpec";
5
- import * as GroupPath from "@confect/core/GroupPath";
6
5
  import * as GroupSpec from "@confect/core/GroupSpec";
7
6
 
8
7
  //#region src/FunctionImpl.d.ts
9
8
  declare namespace FunctionImpl_d_exports {
10
- export { ForGroupPathAndFunction, FromGroupAtPath, FunctionImpl, make };
9
+ export { ForGroupPathAndFunction, FromGroupAtPath, FromGroupSpec, FunctionImpl, make };
11
10
  }
12
11
  interface FunctionImpl<GroupPath_ extends string, FunctionName extends string> {
13
12
  readonly groupPath: GroupPath_;
@@ -20,15 +19,19 @@ declare const FunctionImpl: <GroupPath_ extends string, FunctionName extends str
20
19
  groupPath: GroupPath_;
21
20
  functionName: FunctionName;
22
21
  }) => Context.Tag<FunctionImpl<GroupPath_, FunctionName>, FunctionImpl<GroupPath_, FunctionName>>;
23
- declare const make: <Api_ extends AnyWithProps, const GroupPath_ extends GroupPath.All<Groups<Api_>>, const FunctionName extends FunctionSpec.Name<GroupSpec.Functions<GroupPath.GroupAt<Groups<Api_>, GroupPath_>>>>(api: Api_, groupPath: GroupPath_, functionName: FunctionName, handler: WithName<Schema$1<Api_>, GroupSpec.Functions<GroupPath.GroupAt<Groups<Api_>, GroupPath_>>, FunctionName>) => Layer.Layer<FunctionImpl<GroupPath_, FunctionName>>;
22
+ declare const make: <Api_ extends AnyWithProps, Group extends GroupSpec.AnyWithProps, const FunctionName extends FunctionSpec.Name<GroupSpec.Functions<Group>>>(api: Api_, group: Group, functionName: FunctionName, handler: WithName<Schema$1<Api_>, GroupSpec.Functions<Group>, FunctionName>) => Layer.Layer<FunctionImpl<string, FunctionName>>;
24
23
  /**
25
24
  * Get the function implementation service type for a specific group path and function name.
26
25
  */
27
26
  type ForGroupPathAndFunction<GroupPath_ extends string, FunctionName extends string> = FunctionImpl<GroupPath_, FunctionName>;
28
27
  /**
29
- * Get all function implementation services required for a group at a given path.
28
+ * Get all function implementation services required for a group spec.
30
29
  */
31
- type FromGroupAtPath<GroupPath_ extends string, Group extends GroupSpec.AnyWithProps> = GroupPath.GroupAt<Group, GroupPath_> extends infer GroupAtPath extends GroupSpec.AnyWithProps ? FunctionSpec.Name<GroupSpec.Functions<GroupAtPath>> extends infer FunctionNames extends string ? FunctionNames extends string ? FunctionImpl<GroupPath_, FunctionNames> : never : never : never;
30
+ type FromGroupSpec<Group extends GroupSpec.AnyWithProps> = FunctionSpec.Name<GroupSpec.Functions<Group>> extends infer FunctionNames extends string ? FunctionNames extends string ? FunctionImpl<string, FunctionNames> : never : never;
31
+ /**
32
+ * @deprecated Use {@link FromGroupSpec} instead.
33
+ */
34
+ type FromGroupAtPath<_GroupPath extends string, Group extends GroupSpec.AnyWithProps> = FromGroupSpec<Group>;
32
35
  //#endregion
33
- export { ForGroupPathAndFunction, FromGroupAtPath, FunctionImpl, FunctionImpl_d_exports, make };
36
+ export { ForGroupPathAndFunction, FromGroupAtPath, FromGroupSpec, FunctionImpl, FunctionImpl_d_exports, make };
34
37
  //# sourceMappingURL=FunctionImpl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"FunctionImpl.d.ts","names":[],"sources":["../src/FunctionImpl.ts"],"mappings":";;;;;;;;;;;UAUiB,YAAA;EAAA,SAIN,SAAA,EAAW,UAAA;EAAA,SACX,YAAA,EAAc,YAAA;AAAA;AAAA,cAGZ,YAAA;EAGX,SAAA;EAAA;AAAA;EAIA,SAAA,EAAW,UAAA;EACX,YAAA,EAAc,YAAA;AAAA,MACf,OAAA,CAAA,GAAA,CAAA,YAAA,CAAA,UAAA,EAAA,YAAA,GAAA,YAAA,CAAA,UAAA,EAAA,YAAA;AAAA,cAKY,IAAA,gBACE,YAAA,2BACY,SAAA,CAAU,GAAA,CAAI,MAAA,CAAW,IAAA,+BACvB,YAAA,CAAa,IAAA,CACtC,SAAA,CAAU,SAAA,CAAU,SAAA,CAAU,OAAA,CAAQ,MAAA,CAAW,IAAA,GAAO,UAAA,KAG1D,GAAA,EAAK,IAAA,EACL,SAAA,EAAW,UAAA,EACX,YAAA,EAAc,YAAA,EACd,OAAA,EAAS,QAAA,CACP,QAAA,CAAW,IAAA,GACX,SAAA,CAAU,SAAA,CAAU,SAAA,CAAU,OAAA,CAAQ,MAAA,CAAW,IAAA,GAAO,UAAA,IACxD,YAAA,MAED,KAAA,CAAM,KAAA,CAAM,YAAA,CAAa,UAAA,EAAY,YAAA;AArCxC;;;AAAA,KAgFY,uBAAA,2DAGR,YAAA,CAAa,UAAA,EAAY,YAAA;;;;KAKjB,eAAA,0CAEI,SAAA,CAAU,YAAA,IAExB,SAAA,CAAU,OAAA,CAAQ,KAAA,EAAO,UAAA,oCACvB,SAAA,CAAU,YAAA,GACR,YAAA,CAAa,IAAA,CACX,SAAA,CAAU,SAAA,CAAU,WAAA,gDAEpB,aAAA,kBACE,YAAA,CAAa,UAAA,EAAY,aAAA"}
1
+ {"version":3,"file":"FunctionImpl.d.ts","names":[],"sources":["../src/FunctionImpl.ts"],"mappings":";;;;;;;;;;UAUiB,YAAA;EAAA,SAIN,SAAA,EAAW,UAAA;EAAA,SACX,YAAA,EAAc,YAAA;AAAA;AAAA,cAGZ,YAAA;EAGX,SAAA;EAAA;AAAA;EAIA,SAAA,EAAW,UAAA;EACX,YAAA,EAAc,YAAA;AAAA,MACf,OAAA,CAAA,GAAA,CAAA,YAAA,CAAA,UAAA,EAAA,YAAA,GAAA,YAAA,CAAA,UAAA,EAAA,YAAA;AAAA,cAKY,IAAA,gBACE,YAAA,gBACC,SAAA,CAAU,YAAA,6BACG,YAAA,CAAa,IAAA,CAAK,SAAA,CAAU,SAAA,CAAU,KAAA,IAEjE,GAAA,EAAK,IAAA,EACL,KAAA,EAAO,KAAA,EACP,YAAA,EAAc,YAAA,EACd,OAAA,EAAS,QAAA,CACP,QAAA,CAAW,IAAA,GACX,SAAA,CAAU,SAAA,CAAU,KAAA,GACpB,YAAA,MAED,KAAA,CAAM,KAAA,CAAM,YAAA,SAAqB,YAAA;;AAnCpC;;KAqEY,uBAAA,2DAGR,YAAA,CAAa,UAAA,EAAY,YAAA;;;;KAKjB,aAAA,eAA4B,SAAA,CAAU,YAAA,IAChD,YAAA,CAAa,IAAA,CACX,SAAA,CAAU,SAAA,CAAU,KAAA,gDAElB,aAAA,kBACE,YAAA,SAAqB,aAAA;;;;KAOjB,eAAA,0CAEI,SAAA,CAAU,YAAA,IACtB,aAAA,CAAc,KAAA"}
@@ -1,8 +1,9 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
+ import { resolveGroupPathUnsafe } from "./GroupPath.js";
2
3
  import { setNestedProperty } from "./internal/utils.js";
3
- import { Registry } from "./Registry.js";
4
4
  import { make as make$1 } from "./RegistryItem.js";
5
- import { Array, Context, Effect, Layer, Ref, String } from "effect";
5
+ import { Context, Effect, Layer, Ref, String } from "effect";
6
+ import * as Registry from "@confect/core/Registry";
6
7
 
7
8
  //#region src/FunctionImpl.ts
8
9
  var FunctionImpl_exports = /* @__PURE__ */ __exportAll({
@@ -10,16 +11,15 @@ var FunctionImpl_exports = /* @__PURE__ */ __exportAll({
10
11
  make: () => make
11
12
  });
12
13
  const FunctionImpl = ({ groupPath, functionName }) => Context.GenericTag(`@confect/server/FunctionImpl/${groupPath}/${functionName}`);
13
- const make = (api, groupPath, functionName, handler) => {
14
- const groupPathParts = String.split(groupPath, ".");
15
- const [firstGroupPathPart, ...restGroupPathParts] = groupPathParts;
16
- const functionSpec = Array.reduce(restGroupPathParts, api.spec.groups[firstGroupPathPart], (currentGroup, groupPathPart) => currentGroup.groups[groupPathPart]).functions[functionName];
14
+ const make = (api, group, functionName, handler) => {
15
+ const groupPath = resolveGroupPathUnsafe(api.spec, group);
16
+ const functionSpec = group.functions[functionName];
17
17
  return Layer.effect(FunctionImpl({
18
18
  groupPath,
19
19
  functionName
20
20
  }), Effect.gen(function* () {
21
- const registry = yield* Registry;
22
- yield* Ref.update(registry, (registryItems) => setNestedProperty(registryItems, [...groupPathParts, functionName], make$1({
21
+ const registry = yield* Registry.Registry;
22
+ yield* Ref.update(registry, (registryItems) => setNestedProperty(registryItems, [...String.split(groupPath, "."), functionName], make$1({
23
23
  functionSpec,
24
24
  handler
25
25
  })));
@@ -1 +1 @@
1
- {"version":3,"file":"FunctionImpl.js","names":["Registry.Registry","RegistryItem.make"],"sources":["../src/FunctionImpl.ts"],"sourcesContent":["import type * as FunctionSpec from \"@confect/core/FunctionSpec\";\nimport type * as GroupPath from \"@confect/core/GroupPath\";\nimport type * as GroupSpec from \"@confect/core/GroupSpec\";\nimport { Array, Context, Effect, Layer, Ref, String } from \"effect\";\nimport type * as Api from \"./Api\";\nimport type * as Handler from \"./Handler\";\nimport { setNestedProperty } from \"./internal/utils\";\nimport * as Registry from \"./Registry\";\nimport * as RegistryItem from \"./RegistryItem\";\n\nexport interface FunctionImpl<\n GroupPath_ extends string,\n FunctionName extends string,\n> {\n readonly groupPath: GroupPath_;\n readonly functionName: FunctionName;\n}\n\nexport const FunctionImpl = <\n GroupPath_ extends string,\n FunctionName extends string,\n>({\n groupPath,\n functionName,\n}: {\n groupPath: GroupPath_;\n functionName: FunctionName;\n}) =>\n Context.GenericTag<FunctionImpl<GroupPath_, FunctionName>>(\n `@confect/server/FunctionImpl/${groupPath}/${functionName}`,\n );\n\nexport const make = <\n Api_ extends Api.AnyWithProps,\n const GroupPath_ extends GroupPath.All<Api.Groups<Api_>>,\n const FunctionName extends FunctionSpec.Name<\n GroupSpec.Functions<GroupPath.GroupAt<Api.Groups<Api_>, GroupPath_>>\n >,\n>(\n api: Api_,\n groupPath: GroupPath_,\n functionName: FunctionName,\n handler: Handler.WithName<\n Api.Schema<Api_>,\n GroupSpec.Functions<GroupPath.GroupAt<Api.Groups<Api_>, GroupPath_>>,\n FunctionName\n >,\n): Layer.Layer<FunctionImpl<GroupPath_, FunctionName>> => {\n const groupPathParts = String.split(groupPath, \".\");\n const [firstGroupPathPart, ...restGroupPathParts] = groupPathParts;\n\n const group_: GroupSpec.AnyWithProps = Array.reduce(\n restGroupPathParts,\n (api as any).spec.groups[firstGroupPathPart as any]!,\n (currentGroup: any, groupPathPart: any) =>\n currentGroup.groups[groupPathPart],\n );\n\n const functionSpec = group_.functions[functionName]!;\n\n return Layer.effect(\n FunctionImpl<GroupPath_, FunctionName>({\n groupPath,\n functionName,\n }),\n Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n\n yield* Ref.update(registry, (registryItems) =>\n setNestedProperty(\n registryItems,\n [...groupPathParts, functionName],\n RegistryItem.make({\n functionSpec,\n handler,\n }),\n ),\n );\n\n return {\n groupPath,\n functionName,\n };\n }),\n );\n};\n\n/**\n * Get the function implementation service type for a specific group path and function name.\n */\nexport type ForGroupPathAndFunction<\n GroupPath_ extends string,\n FunctionName extends string,\n> = FunctionImpl<GroupPath_, FunctionName>;\n\n/**\n * Get all function implementation services required for a group at a given path.\n */\nexport type FromGroupAtPath<\n GroupPath_ extends string,\n Group extends GroupSpec.AnyWithProps,\n> =\n GroupPath.GroupAt<Group, GroupPath_> extends infer GroupAtPath extends\n GroupSpec.AnyWithProps\n ? FunctionSpec.Name<\n GroupSpec.Functions<GroupAtPath>\n > extends infer FunctionNames extends string\n ? FunctionNames extends string\n ? FunctionImpl<GroupPath_, FunctionNames>\n : never\n : never\n : never;\n"],"mappings":";;;;;;;;;;;AAkBA,MAAa,gBAGX,EACA,WACA,mBAKA,QAAQ,WACN,gCAAgC,UAAU,GAAG,eAC9C;AAEH,MAAa,QAOX,KACA,WACA,cACA,YAKwD;CACxD,MAAM,iBAAiB,OAAO,MAAM,WAAW,IAAI;CACnD,MAAM,CAAC,oBAAoB,GAAG,sBAAsB;CASpD,MAAM,eAPiC,MAAM,OAC3C,oBACC,IAAY,KAAK,OAAO,sBACxB,cAAmB,kBAClB,aAAa,OAAO,eACvB,CAE2B,UAAU;AAEtC,QAAO,MAAM,OACX,aAAuC;EACrC;EACA;EACD,CAAC,EACF,OAAO,IAAI,aAAa;EACtB,MAAM,WAAW,OAAOA;AAExB,SAAO,IAAI,OAAO,WAAW,kBAC3B,kBACE,eACA,CAAC,GAAG,gBAAgB,aAAa,EACjCC,OAAkB;GAChB;GACA;GACD,CAAC,CACH,CACF;AAED,SAAO;GACL;GACA;GACD;GACD,CACH"}
1
+ {"version":3,"file":"FunctionImpl.js","names":["RegistryItem.make"],"sources":["../src/FunctionImpl.ts"],"sourcesContent":["import type * as FunctionSpec from \"@confect/core/FunctionSpec\";\nimport type * as GroupSpec from \"@confect/core/GroupSpec\";\nimport * as Registry from \"@confect/core/Registry\";\nimport { Context, Effect, Layer, Ref, String } from \"effect\";\nimport type * as Api from \"./Api\";\nimport { resolveGroupPathUnsafe } from \"./GroupPath\";\nimport type * as Handler from \"./Handler\";\nimport { setNestedProperty } from \"./internal/utils\";\nimport * as RegistryItem from \"./RegistryItem\";\n\nexport interface FunctionImpl<\n GroupPath_ extends string,\n FunctionName extends string,\n> {\n readonly groupPath: GroupPath_;\n readonly functionName: FunctionName;\n}\n\nexport const FunctionImpl = <\n GroupPath_ extends string,\n FunctionName extends string,\n>({\n groupPath,\n functionName,\n}: {\n groupPath: GroupPath_;\n functionName: FunctionName;\n}) =>\n Context.GenericTag<FunctionImpl<GroupPath_, FunctionName>>(\n `@confect/server/FunctionImpl/${groupPath}/${functionName}`,\n );\n\nexport const make = <\n Api_ extends Api.AnyWithProps,\n Group extends GroupSpec.AnyWithProps,\n const FunctionName extends FunctionSpec.Name<GroupSpec.Functions<Group>>,\n>(\n api: Api_,\n group: Group,\n functionName: FunctionName,\n handler: Handler.WithName<\n Api.Schema<Api_>,\n GroupSpec.Functions<Group>,\n FunctionName\n >,\n): Layer.Layer<FunctionImpl<string, FunctionName>> => {\n const groupPath = resolveGroupPathUnsafe(api.spec, group);\n const functionSpec = group.functions[functionName]!;\n\n return Layer.effect(\n FunctionImpl<string, FunctionName>({\n groupPath,\n functionName,\n }),\n Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n\n yield* Ref.update(registry, (registryItems) =>\n setNestedProperty(\n registryItems,\n [...String.split(groupPath, \".\"), functionName],\n RegistryItem.make({\n functionSpec,\n handler,\n }),\n ),\n );\n\n return {\n groupPath,\n functionName,\n };\n }),\n );\n};\n\n/**\n * Get the function implementation service type for a specific group path and function name.\n */\nexport type ForGroupPathAndFunction<\n GroupPath_ extends string,\n FunctionName extends string,\n> = FunctionImpl<GroupPath_, FunctionName>;\n\n/**\n * Get all function implementation services required for a group spec.\n */\nexport type FromGroupSpec<Group extends GroupSpec.AnyWithProps> =\n FunctionSpec.Name<\n GroupSpec.Functions<Group>\n > extends infer FunctionNames extends string\n ? FunctionNames extends string\n ? FunctionImpl<string, FunctionNames>\n : never\n : never;\n\n/**\n * @deprecated Use {@link FromGroupSpec} instead.\n */\nexport type FromGroupAtPath<\n _GroupPath extends string,\n Group extends GroupSpec.AnyWithProps,\n> = FromGroupSpec<Group>;\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAa,gBAGX,EACA,WACA,mBAKA,QAAQ,WACN,gCAAgC,UAAU,GAAG,eAC9C;AAEH,MAAa,QAKX,KACA,OACA,cACA,YAKoD;CACpD,MAAM,YAAY,uBAAuB,IAAI,MAAM,MAAM;CACzD,MAAM,eAAe,MAAM,UAAU;AAErC,QAAO,MAAM,OACX,aAAmC;EACjC;EACA;EACD,CAAC,EACF,OAAO,IAAI,aAAa;EACtB,MAAM,WAAW,OAAO,SAAS;AAEjC,SAAO,IAAI,OAAO,WAAW,kBAC3B,kBACE,eACA,CAAC,GAAG,OAAO,MAAM,WAAW,IAAI,EAAE,aAAa,EAC/CA,OAAkB;GAChB;GACA;GACD,CAAC,CACH,CACF;AAED,SAAO;GACL;GACA;GACD;GACD,CACH"}
@@ -1,24 +1,63 @@
1
- import { AnyWithProps, Groups } from "./Api.js";
2
- import { FromGroupAtPath } from "./FunctionImpl.js";
1
+ import { AnyWithProps } from "./Api.js";
2
+ import { FromGroupSpec as FromGroupSpec$1 } from "./FunctionImpl.js";
3
3
  import { Context, Layer } from "effect";
4
- import * as GroupPath from "@confect/core/GroupPath";
5
4
  import * as GroupSpec from "@confect/core/GroupSpec";
6
5
 
7
6
  //#region src/GroupImpl.d.ts
8
7
  declare namespace GroupImpl_d_exports {
9
- export { FromGroupWithPath, FromGroups, GroupImpl, make };
8
+ export { Any, AnyFinalized, AnyUnfinalized, FinalizationStatus, FromGroupSpec, GroupImpl, TypeId, finalize, isFinalizedGroupImpl, isGroupImpl, isUnfinalizedGroupImpl, make };
10
9
  }
11
- interface GroupImpl<GroupPath_ extends string> {
10
+ declare const TypeId = "@confect/server/GroupImpl";
11
+ type TypeId = typeof TypeId;
12
+ type FinalizationStatus = "Unfinalized" | "Finalized";
13
+ interface GroupImpl<GroupPath_ extends string, FinalizationStatus_ extends FinalizationStatus = "Unfinalized"> {
14
+ readonly [TypeId]: TypeId;
12
15
  readonly groupPath: GroupPath_;
16
+ readonly finalizationStatus: FinalizationStatus_;
17
+ /**
18
+ * Names of every function registered into this group's layer scope by
19
+ * `FunctionImpl.make`. Authoritative only when `finalizationStatus` is
20
+ * `"Finalized"`; the `"Unfinalized"` value is set to `[]` at `make`-time
21
+ * since the list is only known once `finalize` snapshots the registry.
22
+ */
23
+ readonly registeredFunctionNames: ReadonlyArray<string>;
13
24
  }
14
- declare const GroupImpl: <GroupPath_ extends string>({
15
- groupPath
25
+ interface Any extends GroupImpl<string, FinalizationStatus> {}
26
+ declare const isGroupImpl: (u: unknown) => u is Any;
27
+ interface AnyFinalized extends GroupImpl<string, "Finalized"> {}
28
+ interface AnyUnfinalized extends GroupImpl<string, "Unfinalized"> {}
29
+ declare const isFinalizedGroupImpl: (u: unknown) => u is AnyFinalized;
30
+ declare const isUnfinalizedGroupImpl: (u: unknown) => u is AnyUnfinalized;
31
+ /**
32
+ * Build the runtime tag for a `GroupImpl` service. The finalization status is
33
+ * embedded in the tag string so that `Unfinalized` and `Finalized` are distinct
34
+ * services at runtime; consumers of a finalized layer (the server's
35
+ * `RegisteredFunctions.buildForGroup` and the CLI's `implValidation`) retrieve
36
+ * the typed `Finalized` service directly rather than scanning the context.
37
+ */
38
+ declare const GroupImpl: <GroupPath_ extends string, FinalizationStatus_ extends FinalizationStatus>({
39
+ groupPath,
40
+ finalizationStatus
16
41
  }: {
17
42
  groupPath: GroupPath_;
18
- }) => Context.Tag<GroupImpl<GroupPath_>, GroupImpl<GroupPath_>>;
19
- declare const make: <Api_ extends AnyWithProps, const GroupPath_ extends GroupPath.All<Groups<Api_>>>(_api: Api_, groupPath: GroupPath_) => Layer.Layer<GroupImpl<GroupPath_>, never, FromGroupWithPath<GroupPath_, Groups<Api_>> | FromGroupAtPath<GroupPath_, Groups<Api_>>>;
20
- type FromGroups<Groups extends GroupSpec.Any> = Groups extends never ? never : Groups extends GroupSpec.AnyWithProps ? GroupImpl<GroupSpec.Name<Groups>> : never;
21
- type FromGroupWithPath<GroupPath_ extends string, Group extends GroupSpec.AnyWithProps> = GroupPath.SubGroupsAt<Group, GroupPath_> extends infer SubGroupPaths ? SubGroupPaths extends string ? GroupImpl<SubGroupPaths> : never : never;
43
+ finalizationStatus: FinalizationStatus_;
44
+ }) => Context.Tag<GroupImpl<GroupPath_, FinalizationStatus_>, GroupImpl<GroupPath_, FinalizationStatus_>>;
45
+ declare const make: <Api_ extends AnyWithProps, Group extends GroupSpec.AnyWithProps>(api: Api_, group: Group) => Layer.Layer<GroupImpl<string, "Unfinalized">, never, FromGroupSpec$1<Group>>;
46
+ /**
47
+ * Mark a `GroupImpl` layer as fully implemented. The parameter type defaults
48
+ * `RIn = never`, so passing a layer that still requires any `FunctionImpl`
49
+ * service produces a type error at the impl author's site. The codegen
50
+ * boundary requires the resulting `"Finalized"` brand, so omitting this call
51
+ * is also rejected downstream.
52
+ *
53
+ * As a side effect of finalization, the names of every `FunctionImpl` that
54
+ * registered into this group's scope are snapshotted onto the produced
55
+ * service value's `registeredFunctionNames` field, so consumers can verify
56
+ * impl completeness against a `GroupSpec`'s expected functions without
57
+ * having to inspect the `Registry` themselves.
58
+ */
59
+ declare const finalize: <GroupPath_ extends string>(group: Layer.Layer<GroupImpl<GroupPath_, "Unfinalized">>) => Layer.Layer<GroupImpl<GroupPath_, "Finalized">>;
60
+ type FromGroupSpec<Group extends GroupSpec.AnyWithProps> = FromGroupSpec$1<Group>;
22
61
  //#endregion
23
- export { FromGroupWithPath, FromGroups, GroupImpl, GroupImpl_d_exports, make };
62
+ export { Any, AnyFinalized, AnyUnfinalized, FinalizationStatus, FromGroupSpec, GroupImpl, GroupImpl_d_exports, TypeId, finalize, isFinalizedGroupImpl, isGroupImpl, isUnfinalizedGroupImpl, make };
24
63
  //# sourceMappingURL=GroupImpl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GroupImpl.d.ts","names":[],"sources":["../src/GroupImpl.ts"],"mappings":";;;;;;;;;;UAM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Aa,CAAA,IAAK,YAAA;AAAA,cAG1C,sBAAA,GAA0B,CAAA,cAAa,CAAA,IAAK,cAAA;;;;AA7BzD;;;;cAuCa,SAAA,0DAEiB,kBAAA;EAC5B,SAAA;EAAA;AAAA;EAIA,SAAA,EAAW,UAAA;EACX,kBAAA,EAAoB,mBAAA;AAAA,MACrB,OAAA,CAAA,GAAA,CAAA,SAAA,CAAA,UAAA,EAAA,mBAAA,GAAA,SAAA,CAAA,UAAA,EAAA,mBAAA;AAAA,cAKY,IAAA,gBACE,YAAA,gBACC,SAAA,CAAU,YAAA,EAExB,GAAA,EAAK,IAAA,EACL,KAAA,EAAO,KAAA,KACN,KAAA,CAAM,KAAA,CACP,SAAA,gCAEA,eAAA,CAA2B,KAAA;;;;;;;;;;;;;;cAuEhB,QAAA,8BACX,KAAA,EAAO,KAAA,CAAM,KAAA,CAAM,SAAA,CAAU,UAAA,sBAC5B,KAAA,CAAM,KAAA,CAAM,SAAA,CAAU,UAAA;AAAA,KAsCb,aAAA,eAA4B,SAAA,CAAU,YAAA,IAChD,eAAA,CAA2B,KAAA"}
package/dist/GroupImpl.js CHANGED
@@ -1,14 +1,82 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Context, Layer } from "effect";
2
+ import { resolveGroupPathUnsafe } from "./GroupPath.js";
3
+ import { Array, Context, Effect, Layer, Option, Predicate, Record, Ref, String, pipe } from "effect";
4
+ import * as Registry from "@confect/core/Registry";
3
5
 
4
6
  //#region src/GroupImpl.ts
5
7
  var GroupImpl_exports = /* @__PURE__ */ __exportAll({
6
8
  GroupImpl: () => GroupImpl,
9
+ TypeId: () => TypeId,
10
+ finalize: () => finalize,
11
+ isFinalizedGroupImpl: () => isFinalizedGroupImpl,
12
+ isGroupImpl: () => isGroupImpl,
13
+ isUnfinalizedGroupImpl: () => isUnfinalizedGroupImpl,
7
14
  make: () => make
8
15
  });
9
- const GroupImpl = ({ groupPath }) => Context.GenericTag(`@confect/server/GroupImpl/${groupPath}`);
10
- const make = (_api, groupPath) => Layer.succeed(GroupImpl({ groupPath }), { groupPath });
16
+ const TypeId = "@confect/server/GroupImpl";
17
+ const isGroupImpl = (u) => Predicate.hasProperty(u, TypeId);
18
+ const isFinalizedGroupImpl = (u) => isGroupImpl(u) && u.finalizationStatus === "Finalized";
19
+ const isUnfinalizedGroupImpl = (u) => isGroupImpl(u) && u.finalizationStatus === "Unfinalized";
20
+ /**
21
+ * Build the runtime tag for a `GroupImpl` service. The finalization status is
22
+ * embedded in the tag string so that `Unfinalized` and `Finalized` are distinct
23
+ * services at runtime; consumers of a finalized layer (the server's
24
+ * `RegisteredFunctions.buildForGroup` and the CLI's `implValidation`) retrieve
25
+ * the typed `Finalized` service directly rather than scanning the context.
26
+ */
27
+ const GroupImpl = ({ groupPath, finalizationStatus }) => Context.GenericTag(`@confect/server/GroupImpl/${finalizationStatus}/${groupPath}`);
28
+ const make = (api, group) => {
29
+ const groupPath = resolveGroupPathUnsafe(api.spec, group);
30
+ return Layer.succeed(GroupImpl({
31
+ groupPath,
32
+ finalizationStatus: "Unfinalized"
33
+ }), {
34
+ [TypeId]: TypeId,
35
+ groupPath,
36
+ finalizationStatus: "Unfinalized",
37
+ registeredFunctionNames: []
38
+ });
39
+ };
40
+ const isFunctionShaped = (value) => Predicate.isRecord(value) && "functionSpec" in value;
41
+ /**
42
+ * Walk a `RegistryItems` tree to the entries at `groupPath` and return the
43
+ * names of the function-shaped leaves directly underneath.
44
+ */
45
+ const collectFunctionNamesAtPath = (items, groupPath) => pipe(String.split(groupPath, "."), Array.reduce(Option.some(items), (acc, segment) => acc.pipe(Option.filter(Predicate.isRecord), Option.flatMap((node) => segment in node ? Option.some(node[segment]) : Option.none()))), Option.filter(Predicate.isRecord), Option.map(Record.toEntries), Option.map(Array.filterMap(([name, value]) => isFunctionShaped(value) ? Option.some(name) : Option.none())), Option.getOrElse(() => []));
46
+ const findUnfinalizedGroupImpl = (context) => Array.findFirst(context.unsafeMap.values(), isUnfinalizedGroupImpl);
47
+ /**
48
+ * Mark a `GroupImpl` layer as fully implemented. The parameter type defaults
49
+ * `RIn = never`, so passing a layer that still requires any `FunctionImpl`
50
+ * service produces a type error at the impl author's site. The codegen
51
+ * boundary requires the resulting `"Finalized"` brand, so omitting this call
52
+ * is also rejected downstream.
53
+ *
54
+ * As a side effect of finalization, the names of every `FunctionImpl` that
55
+ * registered into this group's scope are snapshotted onto the produced
56
+ * service value's `registeredFunctionNames` field, so consumers can verify
57
+ * impl completeness against a `GroupSpec`'s expected functions without
58
+ * having to inspect the `Registry` themselves.
59
+ */
60
+ const finalize = (group) => Layer.flatMap(group, (context) => findUnfinalizedGroupImpl(context).pipe(Option.match({
61
+ onNone: () => Layer.die(/* @__PURE__ */ new Error("GroupImpl.finalize: no Unfinalized GroupImpl service was found in the layer's context.")),
62
+ onSome: (unfinalized) => {
63
+ const groupPath = unfinalized.groupPath;
64
+ return Layer.effect(GroupImpl({
65
+ groupPath,
66
+ finalizationStatus: "Finalized"
67
+ }), Effect.gen(function* () {
68
+ const registry = yield* Registry.Registry;
69
+ const items = yield* Ref.get(registry);
70
+ return {
71
+ [TypeId]: TypeId,
72
+ groupPath,
73
+ finalizationStatus: "Finalized",
74
+ registeredFunctionNames: collectFunctionNamesAtPath(items, groupPath)
75
+ };
76
+ }));
77
+ }
78
+ })));
11
79
 
12
80
  //#endregion
13
- export { GroupImpl, GroupImpl_exports, make };
81
+ export { GroupImpl, GroupImpl_exports, TypeId, finalize, isFinalizedGroupImpl, isGroupImpl, isUnfinalizedGroupImpl, make };
14
82
  //# sourceMappingURL=GroupImpl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GroupImpl.js","names":[],"sources":["../src/GroupImpl.ts"],"sourcesContent":["import type * as GroupPath from \"@confect/core/GroupPath\";\nimport type * as GroupSpec from \"@confect/core/GroupSpec\";\nimport { Context, Layer } from \"effect\";\nimport type * as Api from \"./Api\";\nimport type * as FunctionImpl from \"./FunctionImpl\";\n\nexport interface GroupImpl<GroupPath_ extends string> {\n readonly groupPath: GroupPath_;\n}\n\nexport const GroupImpl = <GroupPath_ extends string>({\n groupPath,\n}: {\n groupPath: GroupPath_;\n}) =>\n Context.GenericTag<GroupImpl<GroupPath_>>(\n `@confect/server/GroupImpl/${groupPath}`,\n );\n\nexport const make = <\n Api_ extends Api.AnyWithProps,\n const GroupPath_ extends GroupPath.All<Api.Groups<Api_>>,\n>(\n _api: Api_,\n groupPath: GroupPath_,\n): Layer.Layer<\n GroupImpl<GroupPath_>,\n never,\n | FromGroupWithPath<GroupPath_, Api.Groups<Api_>>\n | FunctionImpl.FromGroupAtPath<GroupPath_, Api.Groups<Api_>>\n> =>\n Layer.succeed(\n GroupImpl<GroupPath_>({\n groupPath,\n }),\n {\n groupPath,\n },\n ) as Layer.Layer<\n GroupImpl<GroupPath_>,\n never,\n | FromGroupWithPath<GroupPath_, Api.Groups<Api_>>\n | FunctionImpl.FromGroupAtPath<GroupPath_, Api.Groups<Api_>>\n >;\n\nexport type FromGroups<Groups extends GroupSpec.Any> = Groups extends never\n ? never\n : Groups extends GroupSpec.AnyWithProps\n ? GroupImpl<GroupSpec.Name<Groups>>\n : never;\n\nexport type FromGroupWithPath<\n GroupPath_ extends string,\n Group extends GroupSpec.AnyWithProps,\n> =\n GroupPath.SubGroupsAt<Group, GroupPath_> extends infer SubGroupPaths\n ? SubGroupPaths extends string\n ? GroupImpl<SubGroupPaths>\n : never\n : never;\n"],"mappings":";;;;;;;;AAUA,MAAa,aAAwC,EACnD,gBAIA,QAAQ,WACN,6BAA6B,YAC9B;AAEH,MAAa,QAIX,MACA,cAOA,MAAM,QACJ,UAAsB,EACpB,WACD,CAAC,EACF,EACE,WACD,CACF"}
1
+ {"version":3,"file":"GroupImpl.js","names":[],"sources":["../src/GroupImpl.ts"],"sourcesContent":["import type * as GroupSpec from \"@confect/core/GroupSpec\";\nimport * as Registry from \"@confect/core/Registry\";\nimport {\n Array,\n Context,\n Effect,\n Layer,\n Option,\n pipe,\n Predicate,\n Record,\n Ref,\n String,\n} from \"effect\";\nimport type * as Api from \"./Api\";\nimport type * as FunctionImpl from \"./FunctionImpl\";\nimport { resolveGroupPathUnsafe } from \"./GroupPath\";\n\nexport const TypeId = \"@confect/server/GroupImpl\";\nexport type TypeId = typeof TypeId;\n\nexport type FinalizationStatus = \"Unfinalized\" | \"Finalized\";\n\nexport interface GroupImpl<\n GroupPath_ extends string,\n FinalizationStatus_ extends FinalizationStatus = \"Unfinalized\",\n> {\n readonly [TypeId]: TypeId;\n readonly groupPath: GroupPath_;\n readonly finalizationStatus: FinalizationStatus_;\n /**\n * Names of every function registered into this group's layer scope by\n * `FunctionImpl.make`. Authoritative only when `finalizationStatus` is\n * `\"Finalized\"`; the `\"Unfinalized\"` value is set to `[]` at `make`-time\n * since the list is only known once `finalize` snapshots the registry.\n */\n readonly registeredFunctionNames: ReadonlyArray<string>;\n}\n\nexport interface Any extends GroupImpl<string, FinalizationStatus> {}\n\nexport const isGroupImpl = (u: unknown): u is Any =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface AnyFinalized extends GroupImpl<string, \"Finalized\"> {}\nexport interface AnyUnfinalized extends GroupImpl<string, \"Unfinalized\"> {}\n\nexport const isFinalizedGroupImpl = (u: unknown): u is AnyFinalized =>\n isGroupImpl(u) && u.finalizationStatus === \"Finalized\";\n\nexport const isUnfinalizedGroupImpl = (u: unknown): u is AnyUnfinalized =>\n isGroupImpl(u) && u.finalizationStatus === \"Unfinalized\";\n\n/**\n * Build the runtime tag for a `GroupImpl` service. The finalization status is\n * embedded in the tag string so that `Unfinalized` and `Finalized` are distinct\n * services at runtime; consumers of a finalized layer (the server's\n * `RegisteredFunctions.buildForGroup` and the CLI's `implValidation`) retrieve\n * the typed `Finalized` service directly rather than scanning the context.\n */\nexport const GroupImpl = <\n GroupPath_ extends string,\n FinalizationStatus_ extends FinalizationStatus,\n>({\n groupPath,\n finalizationStatus,\n}: {\n groupPath: GroupPath_;\n finalizationStatus: FinalizationStatus_;\n}) =>\n Context.GenericTag<GroupImpl<GroupPath_, FinalizationStatus_>>(\n `@confect/server/GroupImpl/${finalizationStatus}/${groupPath}`,\n );\n\nexport const make = <\n Api_ extends Api.AnyWithProps,\n Group extends GroupSpec.AnyWithProps,\n>(\n api: Api_,\n group: Group,\n): Layer.Layer<\n GroupImpl<string, \"Unfinalized\">,\n never,\n FunctionImpl.FromGroupSpec<Group>\n> => {\n const groupPath = resolveGroupPathUnsafe(api.spec, group);\n\n return Layer.succeed(\n GroupImpl<string, \"Unfinalized\">({\n groupPath,\n finalizationStatus: \"Unfinalized\",\n }),\n {\n [TypeId]: TypeId,\n groupPath,\n finalizationStatus: \"Unfinalized\" as const,\n registeredFunctionNames: [],\n },\n ) as Layer.Layer<\n GroupImpl<string, \"Unfinalized\">,\n never,\n FunctionImpl.FromGroupSpec<Group>\n >;\n};\n\nconst isFunctionShaped = (value: unknown): boolean =>\n Predicate.isRecord(value) && \"functionSpec\" in value;\n\n/**\n * Walk a `RegistryItems` tree to the entries at `groupPath` and return the\n * names of the function-shaped leaves directly underneath.\n */\nconst collectFunctionNamesAtPath = (\n items: Registry.RegistryItems,\n groupPath: string,\n): ReadonlyArray<string> =>\n pipe(\n String.split(groupPath, \".\"),\n Array.reduce(Option.some<unknown>(items), (acc, segment) =>\n acc.pipe(\n Option.filter(Predicate.isRecord),\n Option.flatMap((node) =>\n segment in node ? Option.some(node[segment]) : Option.none(),\n ),\n ),\n ),\n Option.filter(Predicate.isRecord),\n Option.map(Record.toEntries),\n Option.map(\n Array.filterMap(([name, value]) =>\n isFunctionShaped(value) ? Option.some(name) : Option.none(),\n ),\n ),\n Option.getOrElse((): ReadonlyArray<string> => []),\n );\n\nconst findUnfinalizedGroupImpl = <S>(\n context: Context.Context<S>,\n): Option.Option<AnyUnfinalized> =>\n Array.findFirst(context.unsafeMap.values(), isUnfinalizedGroupImpl);\n\n/**\n * Mark a `GroupImpl` layer as fully implemented. The parameter type defaults\n * `RIn = never`, so passing a layer that still requires any `FunctionImpl`\n * service produces a type error at the impl author's site. The codegen\n * boundary requires the resulting `\"Finalized\"` brand, so omitting this call\n * is also rejected downstream.\n *\n * As a side effect of finalization, the names of every `FunctionImpl` that\n * registered into this group's scope are snapshotted onto the produced\n * service value's `registeredFunctionNames` field, so consumers can verify\n * impl completeness against a `GroupSpec`'s expected functions without\n * having to inspect the `Registry` themselves.\n */\nexport const finalize = <GroupPath_ extends string>(\n group: Layer.Layer<GroupImpl<GroupPath_, \"Unfinalized\">>,\n): Layer.Layer<GroupImpl<GroupPath_, \"Finalized\">> =>\n Layer.flatMap(\n group,\n (context): Layer.Layer<GroupImpl<GroupPath_, \"Finalized\">> =>\n findUnfinalizedGroupImpl(context).pipe(\n Option.match({\n onNone: () =>\n Layer.die(\n new Error(\n \"GroupImpl.finalize: no Unfinalized GroupImpl service was found in the layer's context.\",\n ),\n ),\n onSome: (unfinalized) => {\n const groupPath = unfinalized.groupPath as GroupPath_;\n return Layer.effect(\n GroupImpl<GroupPath_, \"Finalized\">({\n groupPath,\n finalizationStatus: \"Finalized\",\n }),\n Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n const items = yield* Ref.get(registry);\n return {\n [TypeId]: TypeId,\n groupPath,\n finalizationStatus: \"Finalized\" as const,\n registeredFunctionNames: collectFunctionNamesAtPath(\n items,\n groupPath,\n ),\n };\n }),\n );\n },\n }),\n ),\n );\n\nexport type FromGroupSpec<Group extends GroupSpec.AnyWithProps> =\n FunctionImpl.FromGroupSpec<Group>;\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAa,SAAS;AAuBtB,MAAa,eAAe,MAC1B,UAAU,YAAY,GAAG,OAAO;AAKlC,MAAa,wBAAwB,MACnC,YAAY,EAAE,IAAI,EAAE,uBAAuB;AAE7C,MAAa,0BAA0B,MACrC,YAAY,EAAE,IAAI,EAAE,uBAAuB;;;;;;;;AAS7C,MAAa,aAGX,EACA,WACA,yBAKA,QAAQ,WACN,6BAA6B,mBAAmB,GAAG,YACpD;AAEH,M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,CAAC,CACH,CACJ"}
@@ -0,0 +1,8 @@
1
+ import * as Spec from "@confect/core/Spec";
2
+ import * as GroupSpec from "@confect/core/GroupSpec";
3
+
4
+ //#region src/GroupPath.d.ts
5
+ declare const resolveGroupPathUnsafe: (spec: Spec.AnyWithProps, target: GroupSpec.AnyWithProps) => string;
6
+ //#endregion
7
+ export { resolveGroupPathUnsafe };
8
+ //# sourceMappingURL=GroupPath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroupPath.d.ts","names":[],"sources":["../src/GroupPath.ts"],"mappings":";;;;cA+Ba,sBAAA,GACX,IAAA,EAAM,IAAA,CAAK,YAAA,EACX,MAAA,EAAQ,SAAA,CAAU,YAAA"}
@@ -0,0 +1,10 @@
1
+ import { Array, Option, Record, pipe } from "effect";
2
+
3
+ //#region src/GroupPath.ts
4
+ const resolveGroupPathInGroup = (group, target, pathSegments) => pipe(Record.toEntries(group.groups), Array.findFirst(([name, child]) => child === target ? Option.some(Array.join([...pathSegments, name], ".")) : resolveGroupPathInGroup(child, target, [...pathSegments, name])));
5
+ const resolveGroupPath = (spec, target) => pipe(Record.toEntries(spec.groups), Array.findFirst(([name, group]) => group === target ? Option.some(name) : resolveGroupPathInGroup(group, target, [name])));
6
+ const resolveGroupPathUnsafe = (spec, target) => resolveGroupPath(spec, target).pipe(Option.getOrThrowWith(() => /* @__PURE__ */ new Error("Could not resolve group path for the provided GroupSpec. Ensure the spec is part of the assembled API spec tree.")));
7
+
8
+ //#endregion
9
+ export { resolveGroupPathUnsafe };
10
+ //# sourceMappingURL=GroupPath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GroupPath.js","names":[],"sources":["../src/GroupPath.ts"],"sourcesContent":["import type * as GroupSpec from \"@confect/core/GroupSpec\";\nimport type * as Spec from \"@confect/core/Spec\";\nimport { Array, Option, pipe, Record } from \"effect\";\n\nconst resolveGroupPathInGroup = (\n group: GroupSpec.AnyWithProps,\n target: GroupSpec.AnyWithProps,\n pathSegments: ReadonlyArray<string>,\n): Option.Option<string> =>\n pipe(\n Record.toEntries(group.groups),\n Array.findFirst(([name, child]) =>\n child === target\n ? Option.some(Array.join([...pathSegments, name], \".\"))\n : resolveGroupPathInGroup(child, target, [...pathSegments, name]),\n ),\n );\n\nconst resolveGroupPath = (\n spec: Spec.AnyWithProps,\n target: GroupSpec.AnyWithProps,\n): Option.Option<string> =>\n pipe(\n Record.toEntries(spec.groups),\n Array.findFirst(([name, group]) =>\n group === target\n ? Option.some(name)\n : resolveGroupPathInGroup(group, target, [name]),\n ),\n );\n\nexport const resolveGroupPathUnsafe = (\n spec: Spec.AnyWithProps,\n target: GroupSpec.AnyWithProps,\n): string =>\n resolveGroupPath(spec, target).pipe(\n Option.getOrThrowWith(\n () =>\n new Error(\n \"Could not resolve group path for the provided GroupSpec. Ensure the spec is part of the assembled API spec tree.\",\n ),\n ),\n );\n"],"mappings":";;;AAIA,MAAM,2BACJ,OACA,QACA,iBAEA,KACE,OAAO,UAAU,MAAM,OAAO,EAC9B,MAAM,WAAW,CAAC,MAAM,WACtB,UAAU,SACN,OAAO,KAAK,MAAM,KAAK,CAAC,GAAG,cAAc,KAAK,EAAE,IAAI,CAAC,GACrD,wBAAwB,OAAO,QAAQ,CAAC,GAAG,cAAc,KAAK,CAAC,CACpE,CACF;AAEH,MAAM,oBACJ,MACA,WAEA,KACE,OAAO,UAAU,KAAK,OAAO,EAC7B,MAAM,WAAW,CAAC,MAAM,WACtB,UAAU,SACN,OAAO,KAAK,KAAK,GACjB,wBAAwB,OAAO,QAAQ,CAAC,KAAK,CAAC,CACnD,CACF;AAEH,MAAa,0BACX,MACA,WAEA,iBAAiB,MAAM,OAAO,CAAC,KAC7B,OAAO,qCAEH,IAAI,MACF,mHACD,CACJ,CACF"}
@@ -23,9 +23,9 @@ import * as convex_server0 from "convex/server";
23
23
  import { GenericMutationCtx } from "convex/server";
24
24
  import * as convex_values0 from "convex/values";
25
25
  import * as _confect_core_Types0 from "@confect/core/Types";
26
- import * as effect_ParseResult0 from "effect/ParseResult";
27
26
  import * as effect_Duration0 from "effect/Duration";
28
27
  import * as effect_DateTime0 from "effect/DateTime";
28
+ import * as effect_ParseResult0 from "effect/ParseResult";
29
29
 
30
30
  //#region src/RegisteredConvexFunction.d.ts
31
31
  declare namespace RegisteredConvexFunction_d_exports {
@@ -35,7 +35,10 @@ declare const make: <Api_ extends AnyWithPropsWithRuntime<"Convex">>(api: Api_,
35
35
  functionSpec,
36
36
  handler
37
37
  }: AnyWithProps$1) => Any;
38
- declare const mutationLayer: <Schema extends AnyWithProps>(schema: Schema, ctx: GenericMutationCtx<ToConvex<FromSchema<Schema>>>) => Layer.Layer<StorageReader$1 | StorageWriter$1 | (<Query extends _confect_core_Ref0.AnyQuery>(query: Query, ...args: _confect_core_Ref0.OptionalArgs<Query>) => Effect.Effect<_confect_core_Ref0.Returns<Query>, _confect_core_Ref0.Error<Query> | effect_ParseResult0.ParseError>) | GenericMutationCtx<ToConvex<FromSchema<Schema>>> | {
38
+ declare const mutationLayer: <Schema extends AnyWithProps>(schema: Schema, ctx: GenericMutationCtx<ToConvex<FromSchema<Schema>>>) => Layer.Layer<Auth$1 | {
39
+ runAfter: <Ref_ extends _confect_core_Ref0.AnyMutation | _confect_core_Ref0.AnyAction>(delay: effect_Duration0.Duration, ref: Ref_, ...args: _confect_core_Ref0.OptionalArgs<Ref_>) => Effect.Effect<convex_values0.GenericId<"_scheduled_functions">, never, never>;
40
+ runAt: <Ref_ extends _confect_core_Ref0.AnyMutation | _confect_core_Ref0.AnyAction>(dateTime: effect_DateTime0.DateTime, ref: Ref_, ...args: _confect_core_Ref0.OptionalArgs<Ref_>) => Effect.Effect<convex_values0.GenericId<"_scheduled_functions">, never, never>;
41
+ } | StorageReader$1 | StorageWriter$1 | (<Query extends _confect_core_Ref0.AnyQuery>(query: Query, ...args: _confect_core_Ref0.OptionalArgs<Query>) => Effect.Effect<_confect_core_Ref0.Returns<Query>, _confect_core_Ref0.Error<Query> | effect_ParseResult0.ParseError>) | (<Mutation extends _confect_core_Ref0.AnyMutation>(mutation: Mutation, ...args: _confect_core_Ref0.OptionalArgs<Mutation>) => Effect.Effect<_confect_core_Ref0.Returns<Mutation>, _confect_core_Ref0.Error<Mutation> | effect_ParseResult0.ParseError>) | GenericMutationCtx<ToConvex<FromSchema<Schema>>> | {
39
42
  table: <const TableName extends Name<IncludeSystemTables<Tables<Schema>>>>(tableName: TableName) => {
40
43
  readonly get: {
41
44
  (id: convex_values0.GenericId<TableName>): Effect.Effect<TableInfo<WithName<IncludeSystemTables<Tables<Schema>>, TableName>>["document"], DocumentDecodeError | GetByIdFailure, never>;
@@ -54,10 +57,7 @@ declare const mutationLayer: <Schema extends AnyWithProps>(schema: Schema, ctx:
54
57
  replace: (id: convex_values0.GenericId<TableName>, value: convex_server0.Expand<convex_server0.BetterOmit<DocumentByName<FromSchema<Schema>, TableName>, "_id" | "_creationTime">>) => Effect.Effect<void, DocumentEncodeError, never>;
55
58
  delete: (id: convex_values0.GenericId<TableName>) => Effect.Effect<void, never, never>;
56
59
  };
57
- } | Auth$1 | {
58
- runAfter: <Ref_ extends _confect_core_Ref0.AnyMutation | _confect_core_Ref0.AnyAction>(delay: effect_Duration0.Duration, ref: Ref_, ...args: _confect_core_Ref0.OptionalArgs<Ref_>) => Effect.Effect<convex_values0.GenericId<"_scheduled_functions">, never, never>;
59
- runAt: <Ref_ extends _confect_core_Ref0.AnyMutation | _confect_core_Ref0.AnyAction>(dateTime: effect_DateTime0.DateTime, ref: Ref_, ...args: _confect_core_Ref0.OptionalArgs<Ref_>) => Effect.Effect<convex_values0.GenericId<"_scheduled_functions">, never, never>;
60
- } | (<Mutation extends _confect_core_Ref0.AnyMutation>(mutation: Mutation, ...args: _confect_core_Ref0.OptionalArgs<Mutation>) => Effect.Effect<_confect_core_Ref0.Returns<Mutation>, _confect_core_Ref0.Error<Mutation> | effect_ParseResult0.ParseError>), never, never>;
60
+ }, never, never>;
61
61
  type MutationServices<Schema extends AnyWithProps> = DatabaseReader<Schema> | DatabaseWriter<Schema> | Auth$1 | Scheduler$1 | StorageReader$1 | StorageWriter$1 | QueryRunner | MutationRunner | MutationCtx<ToConvex<FromSchema<Schema>>>;
62
62
  //#endregion
63
63
  export { MutationServices, RegisteredConvexFunction_d_exports, make, mutationLayer };
@@ -1 +1 @@
1
- {"version":3,"file":"RegisteredConvexFunction.d.ts","names":[],"sources":["../src/RegisteredConvexFunction.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiCa,IAAA,gBAAqB,uBAAA,YAChC,GAAA,EAAK,IAAA;EACL,YAAA;EAAA;AAAA,GAA2B,cAAA,KAC1B,GAAA;AAAA,cAkLU,aAAA,kBAAgC,YAAA,EAC3C,MAAA,EAAQ,MAAA,EACR,GAAA,EAAK,kBAAA,CAAmB,QAAA,CAAmB,UAAA,CAAqB,MAAA,QAAS,KAAA,CAAA,KAAA,CAAA,eAAA,GAAA,eAAA,mBAAA,kBAAA,CAAA,QAAA,EAAA,KAAA,EAAA,KAAA,KAAA,IAAA,EAAA,kBAAA,CAAA,YAAA,CAAA,KAAA,MAAA,MAAA,CAAA,MAAA,CAAA,kBAAA,CAAA,OAAA,CAAA,KAAA,GAAA,kBAAA,CAAA,KAAA,CAAA,KAAA,IAAA,mBAAA,CAAA,UAAA,KAAA,kBAAA,CAAA,QAAA,CAAA,UAAA,CAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;KAoB/D,gBAAA,gBAAgC,YAAA,IACxC,cAAA,CAA8B,MAAA,IAC9B,cAAA,CAA8B,MAAA,IAC9B,MAAA,GACA,WAAA,GACA,eAAA,GACA,eAAA,GACA,WAAA,GACA,cAAA,GACA,WAAA,CAAwB,QAAA,CAAmB,UAAA,CAAqB,MAAA"}
1
+ {"version":3,"file":"RegisteredConvexFunction.d.ts","names":[],"sources":["../src/RegisteredConvexFunction.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiCa,IAAA,gBAAqB,uBAAA,YAChC,GAAA,EAAK,IAAA;EACL,YAAA;EAAA;AAAA,GAA2B,cAAA,KAC1B,GAAA;AAAA,cAkLU,aAAA,kBAAgC,YAAA,EAC3C,MAAA,EAAQ,MAAA,EACR,GAAA,EAAK,kBAAA,CAAmB,QAAA,CAAmB,UAAA,CAAqB,MAAA,QAAS,KAAA,CAAA,KAAA,CAAA,MAAA;0BAAA,kBAAA,CAAA,WAAA;;;;;;;;;;;;;;;;;;;;;;KAoB/D,gBAAA,gBAAgC,YAAA,IACxC,cAAA,CAA8B,MAAA,IAC9B,cAAA,CAA8B,MAAA,IAC9B,MAAA,GACA,WAAA,GACA,eAAA,GACA,eAAA,GACA,WAAA,GACA,cAAA,GACA,WAAA,CAAwB,QAAA,CAAmB,UAAA,CAAqB,MAAA"}
@@ -18,9 +18,9 @@ import { FunctionSpec, RuntimeAndFunctionType } from "@confect/core";
18
18
  import * as convex_values0 from "convex/values";
19
19
  import { Value } from "convex/values";
20
20
  import * as FunctionProvenance from "@confect/core/FunctionProvenance";
21
- import * as effect_ParseResult0 from "effect/ParseResult";
22
21
  import * as effect_Duration0 from "effect/Duration";
23
22
  import * as effect_DateTime0 from "effect/DateTime";
23
+ import * as effect_ParseResult0 from "effect/ParseResult";
24
24
 
25
25
  //#region src/RegisteredFunction.d.ts
26
26
  declare namespace RegisteredFunction_d_exports {
@@ -70,10 +70,10 @@ declare const actionFunctionBase: <Schema extends AnyWithProps, Args, ConvexArgs
70
70
  handler: (ctx: GenericActionCtx<ToConvex<FromSchema<Schema>>>, actualArgs: ConvexArgs) => Promise<ConvexReturns>;
71
71
  };
72
72
  type ActionServices<DatabaseSchema_ extends AnyWithProps> = Scheduler$1 | Auth$1 | StorageReader$1 | StorageWriter$1 | StorageActionWriter$1 | QueryRunner | MutationRunner | ActionRunner | VectorSearch<FromSchema<DatabaseSchema_>> | ActionCtx<ToConvex<FromSchema<DatabaseSchema_>>>;
73
- declare const actionLayer: <DatabaseSchema_ extends AnyWithProps>(databaseSchema: DatabaseSchema_, ctx: GenericActionCtx<ToConvex<FromSchema<DatabaseSchema_>>>) => Layer.Layer<StorageActionWriter$1 | StorageReader$1 | StorageWriter$1 | (<Action extends _confect_core_Ref0.AnyAction>(action: Action, ...args: _confect_core_Ref0.OptionalArgs<Action>) => Effect.Effect<_confect_core_Ref0.Returns<Action>, _confect_core_Ref0.Error<Action> | effect_ParseResult0.ParseError>) | (<Query extends _confect_core_Ref0.AnyQuery>(query: Query, ...args: _confect_core_Ref0.OptionalArgs<Query>) => Effect.Effect<_confect_core_Ref0.Returns<Query>, _confect_core_Ref0.Error<Query> | effect_ParseResult0.ParseError>) | Auth$1 | {
73
+ declare const actionLayer: <DatabaseSchema_ extends AnyWithProps>(databaseSchema: DatabaseSchema_, ctx: GenericActionCtx<ToConvex<FromSchema<DatabaseSchema_>>>) => Layer.Layer<Auth$1 | GenericActionCtx<ToConvex<FromSchema<DatabaseSchema_>>> | {
74
74
  runAfter: <Ref_ extends _confect_core_Ref0.AnyMutation | _confect_core_Ref0.AnyAction>(delay: effect_Duration0.Duration, ref: Ref_, ...args: _confect_core_Ref0.OptionalArgs<Ref_>) => Effect.Effect<convex_values0.GenericId<"_scheduled_functions">, never, never>;
75
75
  runAt: <Ref_ extends _confect_core_Ref0.AnyMutation | _confect_core_Ref0.AnyAction>(dateTime: effect_DateTime0.DateTime, ref: Ref_, ...args: _confect_core_Ref0.OptionalArgs<Ref_>) => Effect.Effect<convex_values0.GenericId<"_scheduled_functions">, never, never>;
76
- } | (<Mutation extends _confect_core_Ref0.AnyMutation>(mutation: Mutation, ...args: _confect_core_Ref0.OptionalArgs<Mutation>) => Effect.Effect<_confect_core_Ref0.Returns<Mutation>, _confect_core_Ref0.Error<Mutation> | effect_ParseResult0.ParseError>) | GenericActionCtx<ToConvex<FromSchema<DatabaseSchema_>>> | (<TableName extends TableNames<FromSchema<DatabaseSchema_>>, IndexName extends keyof convex_server0.VectorIndexes<convex_server0.NamedTableInfo<ToConvex<FromSchema<DatabaseSchema_>>, TableName>>>(tableName: TableName, indexName: IndexName, query: {
76
+ } | StorageReader$1 | StorageWriter$1 | StorageActionWriter$1 | (<Query extends _confect_core_Ref0.AnyQuery>(query: Query, ...args: _confect_core_Ref0.OptionalArgs<Query>) => Effect.Effect<_confect_core_Ref0.Returns<Query>, _confect_core_Ref0.Error<Query> | effect_ParseResult0.ParseError>) | (<Mutation extends _confect_core_Ref0.AnyMutation>(mutation: Mutation, ...args: _confect_core_Ref0.OptionalArgs<Mutation>) => Effect.Effect<_confect_core_Ref0.Returns<Mutation>, _confect_core_Ref0.Error<Mutation> | effect_ParseResult0.ParseError>) | (<Action extends _confect_core_Ref0.AnyAction>(action: Action, ...args: _confect_core_Ref0.OptionalArgs<Action>) => Effect.Effect<_confect_core_Ref0.Returns<Action>, _confect_core_Ref0.Error<Action> | effect_ParseResult0.ParseError>) | (<TableName extends TableNames<FromSchema<DatabaseSchema_>>, IndexName extends keyof convex_server0.VectorIndexes<convex_server0.NamedTableInfo<ToConvex<FromSchema<DatabaseSchema_>>, TableName>>>(tableName: TableName, indexName: IndexName, query: {
77
77
  vector: number[];
78
78
  limit?: number;
79
79
  filter?: (q: convex_server0.VectorFilterBuilder<convex_server0.DocumentByInfo<convex_server0.NamedTableInfo<ToConvex<FromSchema<DatabaseSchema_>>, TableName>>, convex_server0.NamedVectorIndex<convex_server0.NamedTableInfo<ToConvex<FromSchema<DatabaseSchema_>>, TableName>, IndexName>>) => convex_server0.FilterExpression<boolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"RegisteredFunction.d.ts","names":[],"sources":["../src/RegisteredFunction.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BY,GAAA,GACR,eAAA,CAAgB,kBAAA,EAAoB,mBAAA,SACpC,kBAAA,CAAmB,kBAAA,EAAoB,mBAAA,SACvC,gBAAA,CAAiB,kBAAA,EAAoB,mBAAA;AAAA,KAEpC,yBAAA,uBACmB,YAAA,CAAa,YAAA,IAEnC,YA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