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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/ActionCtx.d.ts +1 -1
  3. package/dist/ActionCtx.js +1 -1
  4. package/dist/ActionCtx.js.map +1 -1
  5. package/dist/ActionRunner.d.ts +6 -4
  6. package/dist/ActionRunner.d.ts.map +1 -1
  7. package/dist/ActionRunner.js +4 -3
  8. package/dist/ActionRunner.js.map +1 -1
  9. package/dist/Auth.d.ts +5 -3
  10. package/dist/Auth.d.ts.map +1 -1
  11. package/dist/Auth.js +5 -1
  12. package/dist/Auth.js.map +1 -1
  13. package/dist/BlobNotFoundError.d.ts +1 -1
  14. package/dist/BlobNotFoundError.d.ts.map +1 -1
  15. package/dist/BlobNotFoundError.js +1 -1
  16. package/dist/BlobNotFoundError.js.map +1 -1
  17. package/dist/ConvexConfigProvider.d.ts +1 -1
  18. package/dist/ConvexConfigProvider.d.ts.map +1 -1
  19. package/dist/ConvexConfigProvider.js +6 -1
  20. package/dist/ConvexConfigProvider.js.map +1 -1
  21. package/dist/CronJob.d.ts +3 -3
  22. package/dist/CronJob.d.ts.map +1 -1
  23. package/dist/CronJob.js +1 -1
  24. package/dist/CronJob.js.map +1 -1
  25. package/dist/CronJobs.d.ts.map +1 -1
  26. package/dist/CronJobs.js +11 -4
  27. package/dist/CronJobs.js.map +1 -1
  28. package/dist/DatabaseReader.d.ts +436 -435
  29. package/dist/DatabaseReader.d.ts.map +1 -1
  30. package/dist/DatabaseReader.js +2 -1
  31. package/dist/DatabaseReader.js.map +1 -1
  32. package/dist/DatabaseSchema.js +1 -1
  33. package/dist/DatabaseSchema.js.map +1 -1
  34. package/dist/DatabaseWriter.d.ts +3 -1
  35. package/dist/DatabaseWriter.d.ts.map +1 -1
  36. package/dist/DatabaseWriter.js +5 -1
  37. package/dist/DatabaseWriter.js.map +1 -1
  38. package/dist/Document.d.ts +2 -1
  39. package/dist/Document.d.ts.map +1 -1
  40. package/dist/Document.js +5 -1
  41. package/dist/Document.js.map +1 -1
  42. package/dist/FunctionImpl.d.ts +2 -1
  43. package/dist/FunctionImpl.d.ts.map +1 -1
  44. package/dist/FunctionImpl.js +4 -1
  45. package/dist/FunctionImpl.js.map +1 -1
  46. package/dist/GroupImpl.d.ts +2 -1
  47. package/dist/GroupImpl.d.ts.map +1 -1
  48. package/dist/GroupImpl.js +9 -1
  49. package/dist/GroupImpl.js.map +1 -1
  50. package/dist/Handler.d.ts +2 -2
  51. package/dist/HttpApi.d.ts +4 -2
  52. package/dist/HttpApi.d.ts.map +1 -1
  53. package/dist/HttpApi.js +7 -2
  54. package/dist/HttpApi.js.map +1 -1
  55. package/dist/MutationCtx.d.ts +1 -1
  56. package/dist/MutationCtx.js +1 -1
  57. package/dist/MutationCtx.js.map +1 -1
  58. package/dist/MutationRunner.d.ts +6 -4
  59. package/dist/MutationRunner.d.ts.map +1 -1
  60. package/dist/MutationRunner.js +4 -3
  61. package/dist/MutationRunner.js.map +1 -1
  62. package/dist/OrderedQuery.d.ts +7 -5
  63. package/dist/OrderedQuery.d.ts.map +1 -1
  64. package/dist/OrderedQuery.js +4 -1
  65. package/dist/OrderedQuery.js.map +1 -1
  66. package/dist/QueryCtx.d.ts +1 -1
  67. package/dist/QueryCtx.js +1 -1
  68. package/dist/QueryCtx.js.map +1 -1
  69. package/dist/QueryInitializer.d.ts +2 -1
  70. package/dist/QueryInitializer.d.ts.map +1 -1
  71. package/dist/QueryInitializer.js +5 -1
  72. package/dist/QueryInitializer.js.map +1 -1
  73. package/dist/QueryRunner.d.ts +6 -4
  74. package/dist/QueryRunner.d.ts.map +1 -1
  75. package/dist/QueryRunner.js +4 -3
  76. package/dist/QueryRunner.js.map +1 -1
  77. package/dist/RegisteredConvexFunction.d.ts +117 -115
  78. package/dist/RegisteredConvexFunction.d.ts.map +1 -1
  79. package/dist/RegisteredConvexFunction.js +6 -1
  80. package/dist/RegisteredConvexFunction.js.map +1 -1
  81. package/dist/RegisteredFunction.d.ts +8 -6
  82. package/dist/RegisteredFunction.d.ts.map +1 -1
  83. package/dist/RegisteredFunction.js +5 -1
  84. package/dist/RegisteredFunction.js.map +1 -1
  85. package/dist/RegisteredFunctions.d.ts.map +1 -1
  86. package/dist/RegisteredFunctions.js +2 -1
  87. package/dist/RegisteredFunctions.js.map +1 -1
  88. package/dist/RegisteredNodeFunction.d.ts.map +1 -1
  89. package/dist/RegisteredNodeFunction.js +3 -2
  90. package/dist/RegisteredNodeFunction.js.map +1 -1
  91. package/dist/RegistryItem.js +1 -1
  92. package/dist/RegistryItem.js.map +1 -1
  93. package/dist/Scheduler.d.ts +12 -8
  94. package/dist/Scheduler.d.ts.map +1 -1
  95. package/dist/Scheduler.js +10 -6
  96. package/dist/Scheduler.js.map +1 -1
  97. package/dist/SchemaToValidator.d.ts +4 -1
  98. package/dist/SchemaToValidator.d.ts.map +1 -1
  99. package/dist/SchemaToValidator.js +13 -1
  100. package/dist/SchemaToValidator.js.map +1 -1
  101. package/dist/StorageActionWriter.d.ts +3 -2
  102. package/dist/StorageActionWriter.d.ts.map +1 -1
  103. package/dist/StorageActionWriter.js +4 -1
  104. package/dist/StorageActionWriter.js.map +1 -1
  105. package/dist/StorageReader.d.ts +3 -2
  106. package/dist/StorageReader.d.ts.map +1 -1
  107. package/dist/StorageReader.js +5 -1
  108. package/dist/StorageReader.js.map +1 -1
  109. package/dist/StorageWriter.d.ts +3 -2
  110. package/dist/StorageWriter.d.ts.map +1 -1
  111. package/dist/StorageWriter.js +4 -1
  112. package/dist/StorageWriter.js.map +1 -1
  113. package/dist/Table.d.ts +19 -19
  114. package/dist/Table.d.ts.map +1 -1
  115. package/dist/Table.js +2 -1
  116. package/dist/Table.js.map +1 -1
  117. package/dist/TableInfo.d.ts +1 -1
  118. package/dist/VectorSearch.d.ts +3 -1
  119. package/dist/VectorSearch.d.ts.map +1 -1
  120. package/dist/VectorSearch.js +3 -1
  121. package/dist/VectorSearch.js.map +1 -1
  122. package/dist/internal/utils.d.ts +3 -2
  123. package/dist/internal/utils.d.ts.map +1 -1
  124. package/dist/internal/utils.js +3 -1
  125. package/dist/internal/utils.js.map +1 -1
  126. package/package.json +2 -2
  127. package/src/ActionCtx.ts +1 -1
  128. package/src/ActionRunner.ts +2 -1
  129. package/src/Auth.ts +5 -1
  130. package/src/BlobNotFoundError.ts +1 -1
  131. package/src/ConvexConfigProvider.ts +6 -8
  132. package/src/CronJob.ts +1 -1
  133. package/src/CronJobs.ts +8 -10
  134. package/src/DatabaseReader.ts +2 -1
  135. package/src/DatabaseSchema.ts +1 -1
  136. package/src/DatabaseWriter.ts +5 -1
  137. package/src/Document.ts +5 -1
  138. package/src/FunctionImpl.ts +4 -1
  139. package/src/GroupImpl.ts +9 -11
  140. package/src/HttpApi.ts +8 -9
  141. package/src/MutationCtx.ts +1 -1
  142. package/src/MutationRunner.ts +2 -1
  143. package/src/OrderedQuery.ts +5 -1
  144. package/src/QueryCtx.ts +1 -1
  145. package/src/QueryInitializer.ts +5 -1
  146. package/src/QueryRunner.ts +2 -1
  147. package/src/RegisteredConvexFunction.ts +6 -1
  148. package/src/RegisteredFunction.ts +5 -1
  149. package/src/RegisteredFunctions.ts +3 -1
  150. package/src/RegisteredNodeFunction.ts +4 -2
  151. package/src/RegistryItem.ts +1 -1
  152. package/src/Scheduler.ts +5 -1
  153. package/src/SchemaToValidator.ts +14 -16
  154. package/src/StorageActionWriter.ts +4 -1
  155. package/src/StorageReader.ts +5 -1
  156. package/src/StorageWriter.ts +4 -1
  157. package/src/Table.ts +2 -1
  158. package/src/VectorSearch.ts +3 -1
  159. package/src/internal/utils.ts +3 -1
@@ -1 +1 @@
1
- {"version":3,"file":"DatabaseReader.d.ts","names":[],"sources":["../src/DatabaseReader.ts"],"mappings":";;;;;;;;;;;;;;;;;;;cAQa,IAAA,2BAAgC,YAAA,EAC3C,cAAA,EAAgB,eAAA,EAChB,oBAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuCf,cAAA,yBACc,YAAA,IACtB,UAAA,QAAkB,cAAA,CAAe,eAAA;AAAA,cAExB,KAAA,2BAAiC,YAAA,EAC5C,cAAA,EAAgB,eAAA,EAChB,oBAAA,EAAsB,qBAAA,CACpB,QAAA,CAAmB,UAAA,CAAqB,eAAA,QACzC,KAAA,CAAA,KAAA;wEA/CwB,IAAA,CAAA,MAAA,CAAA,eAAA,IAAA,SAAA,EAAA,SAAA;IAAA"}
@@ -1,7 +1,8 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import { make as make$1 } from "./QueryInitializer.js";
3
3
  import { systemTables } from "./Table.js";
4
- import { Context, Layer } from "effect";
4
+ import * as Context from "effect/Context";
5
+ import * as Layer from "effect/Layer";
5
6
 
6
7
  //#region src/DatabaseReader.ts
7
8
  var DatabaseReader_exports = /* @__PURE__ */ __exportAll({
@@ -1 +1 @@
1
- {"version":3,"file":"DatabaseReader.js","names":["Table.systemTables","QueryInitializer.make"],"sources":["../src/DatabaseReader.ts"],"sourcesContent":["import type { GenericDatabaseReader } from \"convex/server\";\nimport { Context, Layer } from \"effect\";\nimport type { BaseDatabaseReader } from \"@confect/core/Types\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as DataModel from \"./DataModel\";\nimport * as QueryInitializer from \"./QueryInitializer\";\nimport * as Table from \"./Table\";\n\nexport const make = <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(\n databaseSchema: DatabaseSchema_,\n convexDatabaseReader: GenericDatabaseReader<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >,\n) => {\n type Tables = DatabaseSchema.Tables<DatabaseSchema_>;\n type IncludedTables = Tables | Table.SystemTables;\n\n return {\n table: <const TableName extends Table.Name<IncludedTables>>(\n tableName: TableName,\n ) => {\n const isSystem = Object.hasOwn(Table.systemTables, tableName);\n\n const baseDatabaseReader: BaseDatabaseReader<any> = isSystem\n ? {\n get: convexDatabaseReader.system.get,\n query: convexDatabaseReader.system.query,\n }\n : {\n get: convexDatabaseReader.get,\n query: convexDatabaseReader.query,\n };\n\n const table = (\n isSystem\n ? (Table.systemTables as Record<string, Table.AnyWithProps>)[\n tableName\n ]\n : databaseSchema.tables[tableName]\n ) as Table.WithName<IncludedTables, TableName>;\n\n return QueryInitializer.make<IncludedTables, TableName>(\n tableName,\n baseDatabaseReader,\n table,\n );\n },\n };\n};\n\nexport const DatabaseReader = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n>() =>\n Context.GenericTag<ReturnType<typeof make<DatabaseSchema_>>>(\n \"@confect/server/DatabaseReader\",\n );\n\nexport type DatabaseReader<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n> = ReturnType<typeof DatabaseReader<DatabaseSchema_>>[\"Identifier\"];\n\nexport const layer = <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(\n databaseSchema: DatabaseSchema_,\n convexDatabaseReader: GenericDatabaseReader<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >,\n) =>\n Layer.succeed(\n DatabaseReader<DatabaseSchema_>(),\n make(databaseSchema, convexDatabaseReader),\n );\n"],"mappings":";;;;;;;;;;;AAQA,MAAa,QACX,gBACA,yBAGG;AAIH,QAAO,EACL,QACE,cACG;EACH,MAAM,WAAW,OAAO,OAAOA,cAAoB,UAAU;EAE7D,MAAM,qBAA8C,WAChD;GACE,KAAK,qBAAqB,OAAO;GACjC,OAAO,qBAAqB,OAAO;GACpC,GACD;GACE,KAAK,qBAAqB;GAC1B,OAAO,qBAAqB;GAC7B;EAEL,MAAM,QACJ,WACKA,aACC,aAEF,eAAe,OAAO;AAG5B,SAAOC,OACL,WACA,oBACA,MACD;IAEJ;;AAGH,MAAa,uBAGX,QAAQ,WACN,iCACD;AAMH,MAAa,SACX,gBACA,yBAIA,MAAM,QACJ,gBAAiC,EACjC,KAAK,gBAAgB,qBAAqB,CAC3C"}
1
+ {"version":3,"file":"DatabaseReader.js","names":["Table.systemTables","QueryInitializer.make"],"sources":["../src/DatabaseReader.ts"],"sourcesContent":["import type { GenericDatabaseReader } from \"convex/server\";\nimport * as Context from \"effect/Context\";\nimport * as Layer from \"effect/Layer\";\nimport type { BaseDatabaseReader } from \"@confect/core/Types\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as DataModel from \"./DataModel\";\nimport * as QueryInitializer from \"./QueryInitializer\";\nimport * as Table from \"./Table\";\n\nexport const make = <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(\n databaseSchema: DatabaseSchema_,\n convexDatabaseReader: GenericDatabaseReader<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >,\n) => {\n type Tables = DatabaseSchema.Tables<DatabaseSchema_>;\n type IncludedTables = Tables | Table.SystemTables;\n\n return {\n table: <const TableName extends Table.Name<IncludedTables>>(\n tableName: TableName,\n ) => {\n const isSystem = Object.hasOwn(Table.systemTables, tableName);\n\n const baseDatabaseReader: BaseDatabaseReader<any> = isSystem\n ? {\n get: convexDatabaseReader.system.get,\n query: convexDatabaseReader.system.query,\n }\n : {\n get: convexDatabaseReader.get,\n query: convexDatabaseReader.query,\n };\n\n const table = (\n isSystem\n ? (Table.systemTables as Record<string, Table.AnyWithProps>)[\n tableName\n ]\n : databaseSchema.tables[tableName]\n ) as Table.WithName<IncludedTables, TableName>;\n\n return QueryInitializer.make<IncludedTables, TableName>(\n tableName,\n baseDatabaseReader,\n table,\n );\n },\n };\n};\n\nexport const DatabaseReader = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n>() =>\n Context.GenericTag<ReturnType<typeof make<DatabaseSchema_>>>(\n \"@confect/server/DatabaseReader\",\n );\n\nexport type DatabaseReader<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n> = ReturnType<typeof DatabaseReader<DatabaseSchema_>>[\"Identifier\"];\n\nexport const layer = <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(\n databaseSchema: DatabaseSchema_,\n convexDatabaseReader: GenericDatabaseReader<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >,\n) =>\n Layer.succeed(\n DatabaseReader<DatabaseSchema_>(),\n make(databaseSchema, convexDatabaseReader),\n );\n"],"mappings":";;;;;;;;;;;;AASA,MAAa,QACX,gBACA,yBAGG;AAIH,QAAO,EACL,QACE,cACG;EACH,MAAM,WAAW,OAAO,OAAOA,cAAoB,UAAU;EAE7D,MAAM,qBAA8C,WAChD;GACE,KAAK,qBAAqB,OAAO;GACjC,OAAO,qBAAqB,OAAO;GACpC,GACD;GACE,KAAK,qBAAqB;GAC1B,OAAO,qBAAqB;GAC7B;EAEL,MAAM,QACJ,WACKA,aACC,aAEF,eAAe,OAAO;AAG5B,SAAOC,OACL,WACA,oBACA,MACD;IAEJ;;AAGH,MAAa,uBAGX,QAAQ,WACN,iCACD;AAMH,MAAa,SACX,gBACA,yBAIA,MAAM,QACJ,gBAAiC,EACjC,KAAK,gBAAgB,qBAAqB,CAC3C"}
@@ -1,5 +1,5 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Predicate } from "effect";
2
+ import * as Predicate from "effect/Predicate";
3
3
 
4
4
  //#region src/DatabaseSchema.ts
5
5
  var DatabaseSchema_exports = /* @__PURE__ */ __exportAll({
@@ -1 +1 @@
1
- {"version":3,"file":"DatabaseSchema.js","names":[],"sources":["../src/DatabaseSchema.ts"],"sourcesContent":["import { Predicate } from \"effect\";\nimport type * 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 holding a record of bound `Table`s keyed by table\n * name. Codegen emits a single static `DatabaseSchema.make({ ... })` call;\n * laziness now lives entirely on each `Table` (its `Fields`, `Doc`, and\n * `tableDefinition` are lazy memoised getters), so this layer is a plain\n * record indirection with no module-loading or async machinery.\n */\nexport interface DatabaseSchema<Tables_ extends Table.AnyWithProps = never> {\n readonly [TypeId]: TypeId;\n readonly tables: {\n readonly [TableName in Table.Name<Tables_>]: Table.WithName<\n Tables_,\n TableName\n >;\n };\n}\n\nexport interface AnyWithProps {\n readonly [TypeId]: TypeId;\n readonly tables: Record<string, Table.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 tableName: TableName }>;\n\n/**\n * Construct a `DatabaseSchema` from a record of bound `Table`s. The empty\n * case is `DatabaseSchema.make({})`. The `Tables_` union is inferred from\n * the value record's values, so codegen-emitted calls of the form\n * `DatabaseSchema.make({ notes, tags, users })` do not need an explicit\n * type argument.\n *\n * Invariant: each record **key must equal its value's `tableName`**. The\n * record is stored verbatim and later read by key (`databaseSchema.tables[\n * tableName]` in `DatabaseReader`/`DatabaseWriter`), so a key that diverges\n * from the bound table's name would make those lookups silently miss. The\n * type signature does not enforce this — codegen upholds it by deriving both\n * the key and the table name from the same filename (and the shorthand\n * `{ notes, tags, users }` form it emits makes them identical by\n * construction). Hand-written calls must preserve it.\n */\nexport const make = <\n const TablesRecord extends Record<string, Table.AnyWithProps>,\n>(\n tables: TablesRecord,\n): DatabaseSchema<TablesRecord[keyof TablesRecord]> => ({\n [TypeId]: TypeId,\n tables: tables as unknown as DatabaseSchema<\n TablesRecord[keyof TablesRecord]\n >[\"tables\"],\n});\n"],"mappings":";;;;;;;;;AAGA,MAAa,SAAS;AAOtB,MAAa,oBAAoB,MAC/B,UAAU,YAAY,GAAG,OAAO;;;;;;;;;;;;;;;;;AAqDlC,MAAa,QAGX,YACsD;EACrD,SAAS;CACF;CAGT"}
1
+ {"version":3,"file":"DatabaseSchema.js","names":[],"sources":["../src/DatabaseSchema.ts"],"sourcesContent":["import * as Predicate from \"effect/Predicate\";\nimport type * 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 holding a record of bound `Table`s keyed by table\n * name. Codegen emits a single static `DatabaseSchema.make({ ... })` call;\n * laziness now lives entirely on each `Table` (its `Fields`, `Doc`, and\n * `tableDefinition` are lazy memoised getters), so this layer is a plain\n * record indirection with no module-loading or async machinery.\n */\nexport interface DatabaseSchema<Tables_ extends Table.AnyWithProps = never> {\n readonly [TypeId]: TypeId;\n readonly tables: {\n readonly [TableName in Table.Name<Tables_>]: Table.WithName<\n Tables_,\n TableName\n >;\n };\n}\n\nexport interface AnyWithProps {\n readonly [TypeId]: TypeId;\n readonly tables: Record<string, Table.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 tableName: TableName }>;\n\n/**\n * Construct a `DatabaseSchema` from a record of bound `Table`s. The empty\n * case is `DatabaseSchema.make({})`. The `Tables_` union is inferred from\n * the value record's values, so codegen-emitted calls of the form\n * `DatabaseSchema.make({ notes, tags, users })` do not need an explicit\n * type argument.\n *\n * Invariant: each record **key must equal its value's `tableName`**. The\n * record is stored verbatim and later read by key (`databaseSchema.tables[\n * tableName]` in `DatabaseReader`/`DatabaseWriter`), so a key that diverges\n * from the bound table's name would make those lookups silently miss. The\n * type signature does not enforce this — codegen upholds it by deriving both\n * the key and the table name from the same filename (and the shorthand\n * `{ notes, tags, users }` form it emits makes them identical by\n * construction). Hand-written calls must preserve it.\n */\nexport const make = <\n const TablesRecord extends Record<string, Table.AnyWithProps>,\n>(\n tables: TablesRecord,\n): DatabaseSchema<TablesRecord[keyof TablesRecord]> => ({\n [TypeId]: TypeId,\n tables: tables as unknown as DatabaseSchema<\n TablesRecord[keyof TablesRecord]\n >[\"tables\"],\n});\n"],"mappings":";;;;;;;;;AAGA,MAAa,SAAS;AAOtB,MAAa,oBAAoB,MAC/B,UAAU,YAAY,GAAG,OAAO;;;;;;;;;;;;;;;;;AAqDlC,MAAa,QAGX,YACsD;EACrD,SAAS;CACF;CAGT"}
@@ -2,8 +2,10 @@ import { AnyWithProps } from "./DatabaseSchema.js";
2
2
  import { DocumentDecodeError, DocumentEncodeError, WithoutSystemFields as WithoutSystemFields$1 } from "./Document.js";
3
3
  import { DocumentByName, FromSchema, TableNames, ToConvex } from "./DataModel.js";
4
4
  import { GetByIdFailure } from "./QueryInitializer.js";
5
- import { Context, Effect, Layer } from "effect";
5
+ import * as Context from "effect/Context";
6
6
  import { BetterOmit, Expand, GenericDatabaseWriter, WithoutSystemFields } from "convex/server";
7
+ import * as Layer from "effect/Layer";
8
+ import * as Effect from "effect/Effect";
7
9
  import { GenericId } from "convex/values";
8
10
 
9
11
  //#region src/DatabaseWriter.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"DatabaseWriter.d.ts","names":[],"sources":["../src/DatabaseWriter.ts"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"./_virtual/_rolldown/runtime.js";
2
2
  import { encode } from "./Document.js";
3
3
  import { getById } from "./QueryInitializer.js";
4
- import { Context, Effect, Layer, Record, pipe } from "effect";
4
+ import * as Context from "effect/Context";
5
+ import * as Layer from "effect/Layer";
6
+ import { pipe } from "effect/Function";
7
+ import * as Effect from "effect/Effect";
8
+ import * as Record from "effect/Record";
5
9
 
6
10
  //#region src/DatabaseWriter.ts
7
11
  var DatabaseWriter_exports = /* @__PURE__ */ __exportAll({
@@ -1 +1 @@
1
- {"version":3,"file":"DatabaseWriter.js","names":["Document.encode","QueryInitializer.getById"],"sources":["../src/DatabaseWriter.ts"],"sourcesContent":["import type {\n BetterOmit,\n DocumentByName,\n Expand,\n GenericDatabaseWriter,\n WithoutSystemFields,\n} from \"convex/server\";\nimport type { GenericId } from \"convex/values\";\nimport { Context, Effect, Layer, pipe, Record } from \"effect\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as DataModel from \"./DataModel\";\nimport type { DocumentByName as DocumentByName_ } from \"./DataModel\";\nimport * as Document from \"./Document\";\nimport * as QueryInitializer from \"./QueryInitializer\";\nimport type * as Table from \"./Table\";\nimport type * as TableInfo from \"./TableInfo\";\n\nexport const make = <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(\n databaseSchema: DatabaseSchema_,\n convexDatabaseWriter: GenericDatabaseWriter<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >,\n) => {\n type DataModel_ = DataModel.FromSchema<DatabaseSchema_>;\n\n const table = <const TableName extends DataModel.TableNames<DataModel_>>(\n tableName: TableName,\n ) => {\n const tableDef = databaseSchema.tables[tableName] as Table.WithName<\n DatabaseSchema.Tables<DatabaseSchema_>,\n TableName\n >;\n\n const insert = (\n document: Document.WithoutSystemFields<\n DocumentByName_<DataModel_, TableName>\n >,\n ) =>\n Effect.gen(function* () {\n const encodedDocument = yield* Document.encode(\n document,\n tableName,\n tableDef.Fields,\n );\n\n const id = yield* Effect.promise(() =>\n convexDatabaseWriter.insert(\n tableName,\n encodedDocument as WithoutSystemFields<\n DocumentByName<DataModel.ToConvex<DataModel_>, TableName>\n >,\n ),\n );\n\n return id;\n });\n\n const patch = (\n id: GenericId<TableName>,\n patchedValues: Partial<\n WithoutSystemFields<DocumentByName_<DataModel_, TableName>>\n >,\n ) =>\n Effect.gen(function* () {\n const tableSchema = tableDef.Fields as TableInfo.TableSchema<\n DataModel.TableInfoWithName_<DataModel_, TableName>\n >;\n\n const originalDecodedDoc = yield* QueryInitializer.getById(\n tableName,\n convexDatabaseWriter as any,\n tableDef,\n )(id);\n\n const updatedEncodedDoc = yield* pipe(\n patchedValues,\n Record.reduce(originalDecodedDoc, (acc, value, key) =>\n value === undefined\n ? Record.remove(acc, key)\n : Record.set(acc, key, value),\n ),\n Document.encode(tableName, tableSchema),\n );\n\n yield* Effect.promise(() =>\n convexDatabaseWriter.replace(\n id,\n updatedEncodedDoc as Expand<\n BetterOmit<\n DocumentByName<DataModel.ToConvex<DataModel_>, TableName>,\n \"_creationTime\" | \"_id\"\n >\n >,\n ),\n );\n });\n\n const replace = (\n id: GenericId<TableName>,\n value: WithoutSystemFields<DocumentByName_<DataModel_, TableName>>,\n ) =>\n Effect.gen(function* () {\n const updatedEncodedDoc = yield* Document.encode(\n value,\n tableName,\n tableDef.Fields,\n );\n\n yield* Effect.promise(() =>\n convexDatabaseWriter.replace(\n id,\n updatedEncodedDoc as Expand<\n BetterOmit<\n DocumentByName<DataModel.ToConvex<DataModel_>, TableName>,\n \"_creationTime\" | \"_id\"\n >\n >,\n ),\n );\n });\n\n const delete_ = (id: GenericId<TableName>) =>\n Effect.promise(() => convexDatabaseWriter.delete(id));\n\n return {\n insert,\n patch,\n replace,\n delete: delete_,\n };\n };\n\n return {\n table,\n };\n};\n\nexport const DatabaseWriter = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n>() =>\n Context.GenericTag<ReturnType<typeof make<DatabaseSchema_>>>(\n \"@confect/server/DatabaseWriter\",\n );\n\nexport type DatabaseWriter<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n> = ReturnType<typeof DatabaseWriter<DatabaseSchema_>>[\"Identifier\"];\n\nexport const layer = <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(\n databaseSchema: DatabaseSchema_,\n convexDatabaseWriter: GenericDatabaseWriter<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >,\n) =>\n Layer.succeed(\n DatabaseWriter<DatabaseSchema_>(),\n make(databaseSchema, convexDatabaseWriter),\n );\n"],"mappings":";;;;;;;;;;;AAiBA,MAAa,QACX,gBACA,yBAGG;CAGH,MAAM,SACJ,cACG;EACH,MAAM,WAAW,eAAe,OAAO;EAKvC,MAAM,UACJ,aAIA,OAAO,IAAI,aAAa;GACtB,MAAM,kBAAkB,OAAOA,OAC7B,UACA,WACA,SAAS,OACV;AAWD,UATW,OAAO,OAAO,cACvB,qBAAqB,OACnB,WACA,gBAGD,CACF;IAGD;EAEJ,MAAM,SACJ,IACA,kBAIA,OAAO,IAAI,aAAa;GACtB,MAAM,cAAc,SAAS;GAI7B,MAAM,qBAAqB,OAAOC,QAChC,WACA,sBACA,SACD,CAAC,GAAG;GAEL,MAAM,oBAAoB,OAAO,KAC/B,eACA,OAAO,OAAO,qBAAqB,KAAK,OAAO,QAC7C,UAAU,SACN,OAAO,OAAO,KAAK,IAAI,GACvB,OAAO,IAAI,KAAK,KAAK,MAAM,CAChC,EACDD,OAAgB,WAAW,YAAY,CACxC;AAED,UAAO,OAAO,cACZ,qBAAqB,QACnB,IACA,kBAMD,CACF;IACD;EAEJ,MAAM,WACJ,IACA,UAEA,OAAO,IAAI,aAAa;GACtB,MAAM,oBAAoB,OAAOA,OAC/B,OACA,WACA,SAAS,OACV;AAED,UAAO,OAAO,cACZ,qBAAqB,QACnB,IACA,kBAMD,CACF;IACD;EAEJ,MAAM,WAAW,OACf,OAAO,cAAc,qBAAqB,OAAO,GAAG,CAAC;AAEvD,SAAO;GACL;GACA;GACA;GACA,QAAQ;GACT;;AAGH,QAAO,EACL,OACD;;AAGH,MAAa,uBAGX,QAAQ,WACN,iCACD;AAMH,MAAa,SACX,gBACA,yBAIA,MAAM,QACJ,gBAAiC,EACjC,KAAK,gBAAgB,qBAAqB,CAC3C"}
1
+ {"version":3,"file":"DatabaseWriter.js","names":["Document.encode","QueryInitializer.getById"],"sources":["../src/DatabaseWriter.ts"],"sourcesContent":["import type {\n BetterOmit,\n DocumentByName,\n Expand,\n GenericDatabaseWriter,\n WithoutSystemFields,\n} from \"convex/server\";\nimport type { GenericId } from \"convex/values\";\nimport { pipe } from \"effect/Function\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Record from \"effect/Record\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as DataModel from \"./DataModel\";\nimport type { DocumentByName as DocumentByName_ } from \"./DataModel\";\nimport * as Document from \"./Document\";\nimport * as QueryInitializer from \"./QueryInitializer\";\nimport type * as Table from \"./Table\";\nimport type * as TableInfo from \"./TableInfo\";\n\nexport const make = <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(\n databaseSchema: DatabaseSchema_,\n convexDatabaseWriter: GenericDatabaseWriter<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >,\n) => {\n type DataModel_ = DataModel.FromSchema<DatabaseSchema_>;\n\n const table = <const TableName extends DataModel.TableNames<DataModel_>>(\n tableName: TableName,\n ) => {\n const tableDef = databaseSchema.tables[tableName] as Table.WithName<\n DatabaseSchema.Tables<DatabaseSchema_>,\n TableName\n >;\n\n const insert = (\n document: Document.WithoutSystemFields<\n DocumentByName_<DataModel_, TableName>\n >,\n ) =>\n Effect.gen(function* () {\n const encodedDocument = yield* Document.encode(\n document,\n tableName,\n tableDef.Fields,\n );\n\n const id = yield* Effect.promise(() =>\n convexDatabaseWriter.insert(\n tableName,\n encodedDocument as WithoutSystemFields<\n DocumentByName<DataModel.ToConvex<DataModel_>, TableName>\n >,\n ),\n );\n\n return id;\n });\n\n const patch = (\n id: GenericId<TableName>,\n patchedValues: Partial<\n WithoutSystemFields<DocumentByName_<DataModel_, TableName>>\n >,\n ) =>\n Effect.gen(function* () {\n const tableSchema = tableDef.Fields as TableInfo.TableSchema<\n DataModel.TableInfoWithName_<DataModel_, TableName>\n >;\n\n const originalDecodedDoc = yield* QueryInitializer.getById(\n tableName,\n convexDatabaseWriter as any,\n tableDef,\n )(id);\n\n const updatedEncodedDoc = yield* pipe(\n patchedValues,\n Record.reduce(originalDecodedDoc, (acc, value, key) =>\n value === undefined\n ? Record.remove(acc, key)\n : Record.set(acc, key, value),\n ),\n Document.encode(tableName, tableSchema),\n );\n\n yield* Effect.promise(() =>\n convexDatabaseWriter.replace(\n id,\n updatedEncodedDoc as Expand<\n BetterOmit<\n DocumentByName<DataModel.ToConvex<DataModel_>, TableName>,\n \"_creationTime\" | \"_id\"\n >\n >,\n ),\n );\n });\n\n const replace = (\n id: GenericId<TableName>,\n value: WithoutSystemFields<DocumentByName_<DataModel_, TableName>>,\n ) =>\n Effect.gen(function* () {\n const updatedEncodedDoc = yield* Document.encode(\n value,\n tableName,\n tableDef.Fields,\n );\n\n yield* Effect.promise(() =>\n convexDatabaseWriter.replace(\n id,\n updatedEncodedDoc as Expand<\n BetterOmit<\n DocumentByName<DataModel.ToConvex<DataModel_>, TableName>,\n \"_creationTime\" | \"_id\"\n >\n >,\n ),\n );\n });\n\n const delete_ = (id: GenericId<TableName>) =>\n Effect.promise(() => convexDatabaseWriter.delete(id));\n\n return {\n insert,\n patch,\n replace,\n delete: delete_,\n };\n };\n\n return {\n table,\n };\n};\n\nexport const DatabaseWriter = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n>() =>\n Context.GenericTag<ReturnType<typeof make<DatabaseSchema_>>>(\n \"@confect/server/DatabaseWriter\",\n );\n\nexport type DatabaseWriter<\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n> = ReturnType<typeof DatabaseWriter<DatabaseSchema_>>[\"Identifier\"];\n\nexport const layer = <DatabaseSchema_ extends DatabaseSchema.AnyWithProps>(\n databaseSchema: DatabaseSchema_,\n convexDatabaseWriter: GenericDatabaseWriter<\n DataModel.ToConvex<DataModel.FromSchema<DatabaseSchema_>>\n >,\n) =>\n Layer.succeed(\n DatabaseWriter<DatabaseSchema_>(),\n make(databaseSchema, convexDatabaseWriter),\n );\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAa,QACX,gBACA,yBAGG;CAGH,MAAM,SACJ,cACG;EACH,MAAM,WAAW,eAAe,OAAO;EAKvC,MAAM,UACJ,aAIA,OAAO,IAAI,aAAa;GACtB,MAAM,kBAAkB,OAAOA,OAC7B,UACA,WACA,SAAS,OACV;AAWD,UATW,OAAO,OAAO,cACvB,qBAAqB,OACnB,WACA,gBAGD,CACF;IAGD;EAEJ,MAAM,SACJ,IACA,kBAIA,OAAO,IAAI,aAAa;GACtB,MAAM,cAAc,SAAS;GAI7B,MAAM,qBAAqB,OAAOC,QAChC,WACA,sBACA,SACD,CAAC,GAAG;GAEL,MAAM,oBAAoB,OAAO,KAC/B,eACA,OAAO,OAAO,qBAAqB,KAAK,OAAO,QAC7C,UAAU,SACN,OAAO,OAAO,KAAK,IAAI,GACvB,OAAO,IAAI,KAAK,KAAK,MAAM,CAChC,EACDD,OAAgB,WAAW,YAAY,CACxC;AAED,UAAO,OAAO,cACZ,qBAAqB,QACnB,IACA,kBAMD,CACF;IACD;EAEJ,MAAM,WACJ,IACA,UAEA,OAAO,IAAI,aAAa;GACtB,MAAM,oBAAoB,OAAOA,OAC/B,OACA,WACA,SAAS,OACV;AAED,UAAO,OAAO,cACZ,qBAAqB,QACnB,IACA,kBAMD,CACF;IACD;EAEJ,MAAM,WAAW,OACf,OAAO,cAAc,qBAAqB,OAAO,GAAG,CAAC;AAEvD,SAAO;GACL;GACA;GACA;GACA,QAAQ;GACT;;AAGH,QAAO,EACL,OACD;;AAGH,MAAa,uBAGX,QAAQ,WACN,iCACD;AAMH,MAAa,SACX,gBACA,yBAIA,MAAM,QACJ,gBAAiC,EACjC,KAAK,gBAAgB,qBAAqB,CAC3C"}
@@ -1,7 +1,8 @@
1
1
  import { ReadonlyValue } from "./SchemaToValidator.js";
2
2
  import { TableSchema } from "./TableInfo.js";
3
3
  import { AnyWithProps, TableInfoWithName_, TableNames } from "./DataModel.js";
4
- import { Effect, Schema } from "effect";
4
+ import * as Effect from "effect/Effect";
5
+ import * as Schema from "effect/Schema";
5
6
  import { ReadonlyRecord } from "effect/Record";
6
7
 
7
8
  //#region src/Document.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"Document.d.ts","names":[],"sources":["../src/Document.ts"],"mappings":";;;;;;;;;;KAOY,mBAAA,QAA2B,IAAA,CAAK,GAAA;AAAA,KAEhC,GAAA;AAAA,KACA,UAAA,GAAa,cAAA,SAAuB,aAAA;AAAA,cAiCnC,MAAA,uBAEU,YAAA,oBACD,UAAA,CAAqB,UAAA,GAAW,SAAA,EAEvC,SAAA,EAAS,WAAA,EACP,WAAA,CACX,kBAAA,CAA6B,UAAA,EAAY,SAAA,QAG3C,IAAA,EAAM,kBAAA,CAA6B,UAAA,EAAY,SAAA,wBAC5C,MAAA,CAAO,MAAA,CACV,kBAAA,CAA6B,UAAA,EAAY,SAAA,eACzC,mBAAA,0BAGmB,YAAA,oBACD,UAAA,CAAqB,UAAA,GAAW,IAAA,EAE5C,kBAAA,CAA6B,UAAA,EAAY,SAAA,qBAA4B,SAAA,EAChE,SAAA,EAAS,WAAA,EACP,WAAA,CACX,kBAAA,CAA6B,UAAA,EAAY,SAAA,OAExC,MAAA,CAAO,MAAA,CACV,kBAAA,CAA6B,UAAA,EAAY,SAAA,eACzC,mBAAA;AAAA,cAsDS,MAAA,uBAEU,YAAA,oBACD,UAAA,CAAqB,UAAA,GAAW,SAAA,EAEvC,SAAA,EAAS,WAAA,EACP,WAAA,CACX,kBAAA,CAA6B,UAAA,EAAY,SA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EACP,WAAA,CACX,kBAAA,CAA6B,UAAA,EAAY,SAAA,OAExC,MAAA,CAAO,MAAA,CACV,kBAAA,CAA6B,UAAA,EAAY,SAAA,eACzC,mBAAA;AAAA,cAsDS,MAAA,uBAEU,YAAA,oBACD,UAAA,CAAqB,UAAA,GAAW,SAAA,EAEvC,SAAA,EAAS,WAAA,EACP,WAAA,CACX,kBAAA,CAA6B,UAAA,EAAY,SAAA,QAG3C,IAAA,EAAM,kBAAA,CAA6B,UAAA,EAAY,SAAA,kBAC5C,MAAA,CAAO,MAAA,CACV,kBAAA,CAA6B,UAAA,EAAY,SAAA,sBACzC,mBAAA,0BAGmB,YAAA,oBACD,UAAA,CAAqB,UAAA,GAAW,IAAA,EAE5C,kBAAA,CAA6B,UAAA,EAAY,SAAA,eAAsB,SAAA,EAC1D,SAAA,EAAS,WAAA,EACP,WAAA,CACX,kBAAA,CAA6B,UAAA,EAAY,SAAA,OAExC,MAAA,CAAO,MAAA,CACV,kBAAA,CAA6B,UAAA,EAAY,SAAA,sBACzC,mBAAA;AAAA,cAwCF,wBAAA;;;;;;;cAEW,mBAAA,SAA4B,wBAAA;EAAA,IAQ1B,OAAA,CAAA;AAAA;AAAA,cAOd,wBAAA;;;;;;;cAEY,mBAAA,SAA4B,wBAAA;EAAA,IAQ1B,OAAA,CAAA;AAAA;AAAA,cASF,oBAAA;EAAwB,EAAA;EAAA,SAAA;EAAA;AAAA;EAKnC,EAAA;EACA,SAAA;EACA,OAAA;AAAA"}
package/dist/Document.js CHANGED
@@ -1,6 +1,10 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Effect, Function, ParseResult, Schema, pipe } from "effect";
2
+ import * as Function from "effect/Function";
3
+ import { pipe } from "effect/Function";
4
+ import * as Effect from "effect/Effect";
5
+ import * as Schema from "effect/Schema";
3
6
  import * as SystemFields from "@confect/core/SystemFields";
7
+ import * as ParseResult from "effect/ParseResult";
4
8
 
5
9
  //#region src/Document.ts
6
10
  var Document_exports = /* @__PURE__ */ __exportAll({
@@ -1 +1 @@
1
- {"version":3,"file":"Document.js","names":[],"sources":["../src/Document.ts"],"sourcesContent":["import * as SystemFields from \"@confect/core/SystemFields\";\nimport { Effect, Function, ParseResult, pipe, Schema } from \"effect\";\nimport type { ReadonlyRecord } from \"effect/Record\";\nimport type * as DataModel from \"./DataModel\";\nimport type { ReadonlyValue } from \"./SchemaToValidator\";\nimport type * as TableInfo from \"./TableInfo\";\n\nexport type WithoutSystemFields<Doc> = Omit<Doc, \"_creationTime\" | \"_id\">;\n\nexport type Any = any;\nexport type AnyEncoded = ReadonlyRecord<string, ReadonlyValue>;\n\ntype Decode = (doc: unknown) => Effect.Effect<unknown, ParseResult.ParseError>;\n\nconst decoderCache = new WeakMap<\n Schema.Schema.AnyNoContext,\n Map<string, Decode>\n>();\n\nconst getDecoder = (\n tableName: string,\n tableSchema: Schema.Schema.AnyNoContext,\n): Decode => {\n const byTable =\n decoderCache.get(tableSchema) ??\n (() => {\n const map = new Map<string, Decode>();\n decoderCache.set(tableSchema, map);\n return map;\n })();\n\n return (\n byTable.get(tableName) ??\n (() => {\n const decoder = Schema.decode(\n SystemFields.extendWithSystemFields(tableName, tableSchema),\n ) as Decode;\n byTable.set(tableName, decoder);\n return decoder;\n })()\n );\n};\n\nexport const decode = Function.dual<\n <\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n >(\n tableName: TableName,\n tableSchema: TableInfo.TableSchema<\n DataModel.TableInfoWithName_<DataModel_, TableName>\n >,\n ) => (\n self: DataModel.TableInfoWithName_<DataModel_, TableName>[\"convexDocument\"],\n ) => Effect.Effect<\n DataModel.TableInfoWithName_<DataModel_, TableName>[\"document\"],\n DocumentDecodeError\n >,\n <\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n >(\n self: DataModel.TableInfoWithName_<DataModel_, TableName>[\"convexDocument\"],\n tableName: TableName,\n tableSchema: TableInfo.TableSchema<\n DataModel.TableInfoWithName_<DataModel_, TableName>\n >,\n ) => Effect.Effect<\n DataModel.TableInfoWithName_<DataModel_, TableName>[\"document\"],\n DocumentDecodeError\n >\n>(\n 3,\n <\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n >(\n self: DataModel.TableInfoWithName_<DataModel_, TableName>[\"convexDocument\"],\n tableName: TableName,\n tableSchema: TableInfo.TableSchema<\n DataModel.TableInfoWithName_<DataModel_, TableName>\n >,\n ): Effect.Effect<\n DataModel.TableInfoWithName_<DataModel_, TableName>[\"document\"],\n DocumentDecodeError\n > =>\n pipe(\n self,\n getDecoder(tableName, tableSchema),\n Effect.catchIf(ParseResult.isParseError, (parseError) =>\n Effect.gen(function* () {\n const formattedParseError =\n yield* ParseResult.TreeFormatter.formatError(parseError);\n\n return yield* new DocumentDecodeError({\n tableName,\n id: self._id,\n parseError: formattedParseError,\n });\n }),\n ),\n Effect.map(\n (decodedDoc) =>\n decodedDoc as DataModel.TableInfoWithName_<\n DataModel_,\n TableName\n >[\"document\"],\n ),\n ),\n);\n\ntype Encode = (doc: unknown) => Effect.Effect<unknown, ParseResult.ParseError>;\n\nconst encoderCache = new WeakMap<Schema.Schema.AnyNoContext, Encode>();\n\nconst getEncoder = (tableSchema: Schema.Schema.AnyNoContext): Encode =>\n encoderCache.get(tableSchema) ??\n (() => {\n const encoder = Schema.encode(tableSchema) as Encode;\n encoderCache.set(tableSchema, encoder);\n return encoder;\n })();\n\nexport const encode = Function.dual<\n <\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n >(\n tableName: TableName,\n tableSchema: TableInfo.TableSchema<\n DataModel.TableInfoWithName_<DataModel_, TableName>\n >,\n ) => (\n self: DataModel.TableInfoWithName_<DataModel_, TableName>[\"document\"],\n ) => Effect.Effect<\n DataModel.TableInfoWithName_<DataModel_, TableName>[\"encodedDocument\"],\n DocumentEncodeError\n >,\n <\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n >(\n self: DataModel.TableInfoWithName_<DataModel_, TableName>[\"document\"],\n tableName: TableName,\n tableSchema: TableInfo.TableSchema<\n DataModel.TableInfoWithName_<DataModel_, TableName>\n >,\n ) => Effect.Effect<\n DataModel.TableInfoWithName_<DataModel_, TableName>[\"encodedDocument\"],\n DocumentEncodeError\n >\n>(\n 3,\n <\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n >(\n self: DataModel.TableInfoWithName_<DataModel_, TableName>[\"document\"],\n tableName: TableName,\n tableSchema: TableInfo.TableSchema<\n DataModel.TableInfoWithName_<DataModel_, TableName>\n >,\n ): Effect.Effect<\n DataModel.TableInfoWithName_<DataModel_, TableName>[\"encodedDocument\"],\n DocumentEncodeError\n > =>\n pipe(\n self,\n getEncoder(tableSchema),\n Effect.catchIf(ParseResult.isParseError, (parseError) =>\n Effect.gen(function* () {\n const formattedParseError =\n yield* ParseResult.TreeFormatter.formatError(parseError);\n\n return yield* new DocumentEncodeError({\n tableName,\n id: self._id,\n parseError: formattedParseError,\n });\n }),\n ),\n Effect.map(\n (encodedDoc) =>\n encodedDoc as DataModel.TableInfoWithName_<\n DataModel_,\n TableName\n >[\"encodedDocument\"],\n ),\n ),\n);\n\nexport class DocumentDecodeError extends Schema.TaggedError<DocumentDecodeError>()(\n \"DocumentDecodeError\",\n {\n tableName: Schema.String,\n id: Schema.String,\n parseError: Schema.String,\n },\n) {\n override get message(): string {\n return documentErrorMessage({\n id: this.id,\n tableName: this.tableName,\n message: `could not be decoded:\\n\\n${this.parseError}`,\n });\n }\n}\n\nexport class DocumentEncodeError extends Schema.TaggedError<DocumentEncodeError>()(\n \"DocumentEncodeError\",\n {\n tableName: Schema.String,\n id: Schema.String,\n parseError: Schema.String,\n },\n) {\n override get message(): string {\n return documentErrorMessage({\n id: this.id,\n tableName: this.tableName,\n message: `could not be encoded:\\n\\n${this.parseError}`,\n });\n }\n}\n\nexport const documentErrorMessage = ({\n id,\n tableName,\n message,\n}: {\n id: string;\n tableName: string;\n message: string;\n}) => `Document with ID '${id}' in table '${tableName}' ${message}`;\n"],"mappings":";;;;;;;;;;;;AAcA,MAAM,+BAAe,IAAI,SAGtB;AAEH,MAAM,cACJ,WACA,gBACW;CACX,MAAM,UACJ,aAAa,IAAI,YAAY,WACtB;EACL,MAAM,sBAAM,IAAI,KAAqB;AACrC,eAAa,IAAI,aAAa,IAAI;AAClC,SAAO;KACL;AAEN,QACE,QAAQ,IAAI,UAAU,WACf;EACL,MAAM,UAAU,OAAO,OACrB,aAAa,uBAAuB,WAAW,YAAY,CAC5D;AACD,UAAQ,IAAI,WAAW,QAAQ;AAC/B,SAAO;KACL;;AAIR,MAAa,SAAS,SAAS,KA6B7B,IAKE,MACA,WACA,gBAOA,KACE,MACA,WAAW,WAAW,YAAY,EAClC,OAAO,QAAQ,YAAY,eAAe,eACxC,OAAO,IAAI,aAAa;CACtB,MAAM,sBACJ,OAAO,YAAY,cAAc,YAAY,WAAW;AAE1D,QAAO,OAAO,IAAI,oBAAoB;EACpC;EACA,IAAI,KAAK;EACT,YAAY;EACb,CAAC;EACF,CACH,EACD,OAAO,KACJ,eACC,WAIH,CACF,CACJ;AAID,MAAM,+BAAe,IAAI,SAA6C;AAEtE,MAAM,cAAc,gBAClB,aAAa,IAAI,YAAY,WACtB;CACL,MAAM,UAAU,OAAO,OAAO,YAAY;AAC1C,cAAa,IAAI,aAAa,QAAQ;AACtC,QAAO;IACL;AAEN,MAAa,SAAS,SAAS,KA6B7B,IAKE,MACA,WACA,gBAOA,KACE,MACA,WAAW,YAAY,EACvB,OAAO,QAAQ,YAAY,eAAe,eACxC,OAAO,IAAI,aAAa;CACtB,MAAM,sBACJ,OAAO,YAAY,cAAc,YAAY,WAAW;AAE1D,QAAO,OAAO,IAAI,oBAAoB;EACpC;EACA,IAAI,KAAK;EACT,YAAY;EACb,CAAC;EACF,CACH,EACD,OAAO,KACJ,eACC,WAIH,CACF,CACJ;AAED,IAAa,sBAAb,cAAyC,OAAO,aAAkC,CAChF,uBACA;CACE,WAAW,OAAO;CAClB,IAAI,OAAO;CACX,YAAY,OAAO;CACpB,CACF,CAAC;CACA,IAAa,UAAkB;AAC7B,SAAO,qBAAqB;GAC1B,IAAI,KAAK;GACT,WAAW,KAAK;GAChB,SAAS,4BAA4B,KAAK;GAC3C,CAAC;;;AAIN,IAAa,sBAAb,cAAyC,OAAO,aAAkC,CAChF,uBACA;CACE,WAAW,OAAO;CAClB,IAAI,OAAO;CACX,YAAY,OAAO;CACpB,CACF,CAAC;CACA,IAAa,UAAkB;AAC7B,SAAO,qBAAqB;GAC1B,IAAI,KAAK;GACT,WAAW,KAAK;GAChB,SAAS,4BAA4B,KAAK;GAC3C,CAAC;;;AAIN,MAAa,wBAAwB,EACnC,IACA,WACA,cAKI,qBAAqB,GAAG,cAAc,UAAU,IAAI"}
1
+ {"version":3,"file":"Document.js","names":[],"sources":["../src/Document.ts"],"sourcesContent":["import * as SystemFields from \"@confect/core/SystemFields\";\nimport { pipe } from \"effect/Function\";\nimport * as Effect from \"effect/Effect\";\nimport * as Function from \"effect/Function\";\nimport * as ParseResult from \"effect/ParseResult\";\nimport * as Schema from \"effect/Schema\";\nimport type { ReadonlyRecord } from \"effect/Record\";\nimport type * as DataModel from \"./DataModel\";\nimport type { ReadonlyValue } from \"./SchemaToValidator\";\nimport type * as TableInfo from \"./TableInfo\";\n\nexport type WithoutSystemFields<Doc> = Omit<Doc, \"_creationTime\" | \"_id\">;\n\nexport type Any = any;\nexport type AnyEncoded = ReadonlyRecord<string, ReadonlyValue>;\n\ntype Decode = (doc: unknown) => Effect.Effect<unknown, ParseResult.ParseError>;\n\nconst decoderCache = new WeakMap<\n Schema.Schema.AnyNoContext,\n Map<string, Decode>\n>();\n\nconst getDecoder = (\n tableName: string,\n tableSchema: Schema.Schema.AnyNoContext,\n): Decode => {\n const byTable =\n decoderCache.get(tableSchema) ??\n (() => {\n const map = new Map<string, Decode>();\n decoderCache.set(tableSchema, map);\n return map;\n })();\n\n return (\n byTable.get(tableName) ??\n (() => {\n const decoder = Schema.decode(\n SystemFields.extendWithSystemFields(tableName, tableSchema),\n ) as Decode;\n byTable.set(tableName, decoder);\n return decoder;\n })()\n );\n};\n\nexport const decode = Function.dual<\n <\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n >(\n tableName: TableName,\n tableSchema: TableInfo.TableSchema<\n DataModel.TableInfoWithName_<DataModel_, TableName>\n >,\n ) => (\n self: DataModel.TableInfoWithName_<DataModel_, TableName>[\"convexDocument\"],\n ) => Effect.Effect<\n DataModel.TableInfoWithName_<DataModel_, TableName>[\"document\"],\n DocumentDecodeError\n >,\n <\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n >(\n self: DataModel.TableInfoWithName_<DataModel_, TableName>[\"convexDocument\"],\n tableName: TableName,\n tableSchema: TableInfo.TableSchema<\n DataModel.TableInfoWithName_<DataModel_, TableName>\n >,\n ) => Effect.Effect<\n DataModel.TableInfoWithName_<DataModel_, TableName>[\"document\"],\n DocumentDecodeError\n >\n>(\n 3,\n <\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n >(\n self: DataModel.TableInfoWithName_<DataModel_, TableName>[\"convexDocument\"],\n tableName: TableName,\n tableSchema: TableInfo.TableSchema<\n DataModel.TableInfoWithName_<DataModel_, TableName>\n >,\n ): Effect.Effect<\n DataModel.TableInfoWithName_<DataModel_, TableName>[\"document\"],\n DocumentDecodeError\n > =>\n pipe(\n self,\n getDecoder(tableName, tableSchema),\n Effect.catchIf(ParseResult.isParseError, (parseError) =>\n Effect.gen(function* () {\n const formattedParseError =\n yield* ParseResult.TreeFormatter.formatError(parseError);\n\n return yield* new DocumentDecodeError({\n tableName,\n id: self._id,\n parseError: formattedParseError,\n });\n }),\n ),\n Effect.map(\n (decodedDoc) =>\n decodedDoc as DataModel.TableInfoWithName_<\n DataModel_,\n TableName\n >[\"document\"],\n ),\n ),\n);\n\ntype Encode = (doc: unknown) => Effect.Effect<unknown, ParseResult.ParseError>;\n\nconst encoderCache = new WeakMap<Schema.Schema.AnyNoContext, Encode>();\n\nconst getEncoder = (tableSchema: Schema.Schema.AnyNoContext): Encode =>\n encoderCache.get(tableSchema) ??\n (() => {\n const encoder = Schema.encode(tableSchema) as Encode;\n encoderCache.set(tableSchema, encoder);\n return encoder;\n })();\n\nexport const encode = Function.dual<\n <\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n >(\n tableName: TableName,\n tableSchema: TableInfo.TableSchema<\n DataModel.TableInfoWithName_<DataModel_, TableName>\n >,\n ) => (\n self: DataModel.TableInfoWithName_<DataModel_, TableName>[\"document\"],\n ) => Effect.Effect<\n DataModel.TableInfoWithName_<DataModel_, TableName>[\"encodedDocument\"],\n DocumentEncodeError\n >,\n <\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n >(\n self: DataModel.TableInfoWithName_<DataModel_, TableName>[\"document\"],\n tableName: TableName,\n tableSchema: TableInfo.TableSchema<\n DataModel.TableInfoWithName_<DataModel_, TableName>\n >,\n ) => Effect.Effect<\n DataModel.TableInfoWithName_<DataModel_, TableName>[\"encodedDocument\"],\n DocumentEncodeError\n >\n>(\n 3,\n <\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n >(\n self: DataModel.TableInfoWithName_<DataModel_, TableName>[\"document\"],\n tableName: TableName,\n tableSchema: TableInfo.TableSchema<\n DataModel.TableInfoWithName_<DataModel_, TableName>\n >,\n ): Effect.Effect<\n DataModel.TableInfoWithName_<DataModel_, TableName>[\"encodedDocument\"],\n DocumentEncodeError\n > =>\n pipe(\n self,\n getEncoder(tableSchema),\n Effect.catchIf(ParseResult.isParseError, (parseError) =>\n Effect.gen(function* () {\n const formattedParseError =\n yield* ParseResult.TreeFormatter.formatError(parseError);\n\n return yield* new DocumentEncodeError({\n tableName,\n id: self._id,\n parseError: formattedParseError,\n });\n }),\n ),\n Effect.map(\n (encodedDoc) =>\n encodedDoc as DataModel.TableInfoWithName_<\n DataModel_,\n TableName\n >[\"encodedDocument\"],\n ),\n ),\n);\n\nexport class DocumentDecodeError extends Schema.TaggedError<DocumentDecodeError>()(\n \"DocumentDecodeError\",\n {\n tableName: Schema.String,\n id: Schema.String,\n parseError: Schema.String,\n },\n) {\n override get message(): string {\n return documentErrorMessage({\n id: this.id,\n tableName: this.tableName,\n message: `could not be decoded:\\n\\n${this.parseError}`,\n });\n }\n}\n\nexport class DocumentEncodeError extends Schema.TaggedError<DocumentEncodeError>()(\n \"DocumentEncodeError\",\n {\n tableName: Schema.String,\n id: Schema.String,\n parseError: Schema.String,\n },\n) {\n override get message(): string {\n return documentErrorMessage({\n id: this.id,\n tableName: this.tableName,\n message: `could not be encoded:\\n\\n${this.parseError}`,\n });\n }\n}\n\nexport const documentErrorMessage = ({\n id,\n tableName,\n message,\n}: {\n id: string;\n tableName: string;\n message: string;\n}) => `Document with ID '${id}' in table '${tableName}' ${message}`;\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,MAAM,+BAAe,IAAI,SAGtB;AAEH,MAAM,cACJ,WACA,gBACW;CACX,MAAM,UACJ,aAAa,IAAI,YAAY,WACtB;EACL,MAAM,sBAAM,IAAI,KAAqB;AACrC,eAAa,IAAI,aAAa,IAAI;AAClC,SAAO;KACL;AAEN,QACE,QAAQ,IAAI,UAAU,WACf;EACL,MAAM,UAAU,OAAO,OACrB,aAAa,uBAAuB,WAAW,YAAY,CAC5D;AACD,UAAQ,IAAI,WAAW,QAAQ;AAC/B,SAAO;KACL;;AAIR,MAAa,SAAS,SAAS,KA6B7B,IAKE,MACA,WACA,gBAOA,KACE,MACA,WAAW,WAAW,YAAY,EAClC,OAAO,QAAQ,YAAY,eAAe,eACxC,OAAO,IAAI,aAAa;CACtB,MAAM,sBACJ,OAAO,YAAY,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import { WithName } from "./Handler.js";
3
- import { Context, Layer } from "effect";
3
+ import * as Context from "effect/Context";
4
+ import * as Layer from "effect/Layer";
4
5
  import * as FunctionSpec from "@confect/core/FunctionSpec";
5
6
  import * as GroupSpec from "@confect/core/GroupSpec";
6
7
 
@@ -1 +1 @@
1
- {"version":3,"file":"FunctionImpl.d.ts","names":[],"sources":["../src/FunctionImpl.ts"],"mappings":";;;;;;;;;;UASiB,YAAA;EAAA,SACN,YAAA,EAAc,YAAA;AAAA;AAAA,cAGZ,YAAA;EAA6C;AAAA;EAGxD,YAAA,EAAc,YAAA;AAAA,MACf,OAAA,CAAA,GAAA,CAAA,YAAA,CAAA,YAAA,GAAA,YAAA,CAAA,YAAA;;;;AARD;;;;;;;;;AAIA;;;;cAyBa,IAAA,2BACa,YAAA,gBACV,SAAA,CAAU,YAAA,6BACG,YAAA,CAAa,IAAA,CAAK,SAAA,CAAU,SAAA,CAAU,KAAA,IAEjE,eAAA,EAAiB,eAAA,EACjB,KAAA,EAAO,KAAA,EACP,YAAA,EAAc,YAAA,EACd,OAAA,EAAS,QAAA,CACP,eAAA,EACA,SAAA,CAAU,SAAA,CAAU,KAAA,GACpB,YAAA,MAED,KAAA,CAAM,KAAA,CAAM,YAAA,CAAa,YAAA;;;;KA2BhB,WAAA,gCACV,YAAA,CAAa,YAAA;;;;KAKH,aAAA,eAA4B,SAAA,CAAU,YAAA,IAChD,YAAA,CAAa,IAAA,CACX,SAAA,CAAU,SAAA,CAAU,KAAA,gDAElB,aAAA,kBACE,YAAA,CAAa,aAAA"}
1
+ {"version":3,"file":"FunctionImpl.d.ts","names":[],"sources":["../src/FunctionImpl.ts"],"mappings":";;;;;;;;;;;UAYiB,YAAA;EAAA,SACN,YAAA,EAAc,YAAA;AAAA;AAAA,cAGZ,YAAA;EAA6C;AAAA;EAGxD,YAAA,EAAc,YAAA;AAAA,MACf,OAAA,CAAA,GAAA,CAAA,YAAA,CAAA,YAAA,GAAA,YAAA,CAAA,YAAA;;;;AARD;;;;;;;;;AAIA;;;;cAyBa,IAAA,2BACa,YAAA,gBACV,SAAA,CAAU,YAAA,6BACG,YAAA,CAAa,IAAA,CAAK,SAAA,CAAU,SAAA,CAAU,KAAA,IAEjE,eAAA,EAAiB,eAAA,EACjB,KAAA,EAAO,KAAA,EACP,YAAA,EAAc,YAAA,EACd,OAAA,EAAS,QAAA,CACP,eAAA,EACA,SAAA,CAAU,SAAA,CAAU,KAAA,GACpB,YAAA,MAED,KAAA,CAAM,KAAA,CAAM,YAAA,CAAa,YAAA;;;;KA2BhB,WAAA,gCACV,YAAA,CAAa,YAAA;;;;KAKH,aAAA,eAA4B,SAAA,CAAU,YAAA,IAChD,YAAA,CAAa,IAAA,CACX,SAAA,CAAU,SAAA,CAAU,KAAA,gDAElB,aAAA,kBACE,YAAA,CAAa,aAAA"}
@@ -1,8 +1,11 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
2
  import { setNestedProperty } from "./internal/utils.js";
3
3
  import { make as make$1 } from "./RegistryItem.js";
4
- import { Context, Effect, Layer, Ref } from "effect";
4
+ import * as Context from "effect/Context";
5
+ import * as Layer from "effect/Layer";
6
+ import * as Effect from "effect/Effect";
5
7
  import * as Registry from "@confect/core/Registry";
8
+ import * as Ref from "effect/Ref";
6
9
 
7
10
  //#region src/FunctionImpl.ts
8
11
  var FunctionImpl_exports = /* @__PURE__ */ __exportAll({
@@ -1 +1 @@
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 } from \"effect\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as Handler from \"./Handler\";\nimport { setNestedProperty } from \"./internal/utils\";\nimport * as RegistryItem from \"./RegistryItem\";\n\nexport interface FunctionImpl<FunctionName extends string> {\n readonly functionName: FunctionName;\n}\n\nexport const FunctionImpl = <FunctionName extends string>({\n functionName,\n}: {\n functionName: FunctionName;\n}) =>\n Context.GenericTag<FunctionImpl<FunctionName>>(\n `@confect/server/FunctionImpl/${functionName}`,\n );\n\n/**\n * Register a single function's implementation into the group's `Registry`.\n *\n * The function is registered under a flat, single-segment key (its own\n * `functionName`), not a project-wide dot-path. Each group's impl layer is\n * built in isolation — `RegisteredFunctions.buildForGroup` (and the CLI's\n * `validateImpl`) provide a fresh `Registry` per group — so function names\n * only need to be unique within their own group.\n *\n * `databaseSchema` is retained purely as a type-level carrier: the handler's\n * ctx-service requirements (`DatabaseReader`, `QueryCtx<DataModel>`, …) are\n * derived from it via `Handler.WithName`. It is not read at runtime — the\n * generated per-group registry forwards the schema value to the function\n * builders — so impls depend on `_generated/schema` (table schemas) rather than\n * `_generated/api` (which transitively imports every function spec).\n */\nexport const make = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Group extends GroupSpec.AnyWithProps,\n const FunctionName extends FunctionSpec.Name<GroupSpec.Functions<Group>>,\n>(\n _databaseSchema: DatabaseSchema_,\n group: Group,\n functionName: FunctionName,\n handler: Handler.WithName<\n DatabaseSchema_,\n GroupSpec.Functions<Group>,\n FunctionName\n >,\n): Layer.Layer<FunctionImpl<FunctionName>> => {\n const functionSpec = group.functions[functionName]!;\n\n return Layer.effect(\n FunctionImpl<FunctionName>({ functionName }),\n Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n\n yield* Ref.update(registry, (registryItems) =>\n setNestedProperty(\n registryItems,\n [functionName],\n RegistryItem.make({\n functionSpec,\n handler,\n }),\n ),\n );\n\n return { functionName };\n }),\n );\n};\n\n/**\n * Get the function implementation service type for a specific function name.\n */\nexport type ForFunction<FunctionName extends string> =\n FunctionImpl<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<FunctionNames>\n : never\n : never;\n"],"mappings":";;;;;;;;;;;AAaA,MAAa,gBAA6C,EACxD,mBAIA,QAAQ,WACN,gCAAgC,eACjC;;;;;;;;;;;;;;;;;AAkBH,MAAa,QAKX,iBACA,OACA,cACA,YAK4C;CAC5C,MAAM,eAAe,MAAM,UAAU;AAErC,QAAO,MAAM,OACX,aAA2B,EAAE,cAAc,CAAC,EAC5C,OAAO,IAAI,aAAa;EACtB,MAAM,WAAW,OAAO,SAAS;AAEjC,SAAO,IAAI,OAAO,WAAW,kBAC3B,kBACE,eACA,CAAC,aAAa,EACdA,OAAkB;GAChB;GACA;GACD,CAAC,CACH,CACF;AAED,SAAO,EAAE,cAAc;GACvB,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 * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Ref from \"effect/Ref\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as Handler from \"./Handler\";\nimport { setNestedProperty } from \"./internal/utils\";\nimport * as RegistryItem from \"./RegistryItem\";\n\nexport interface FunctionImpl<FunctionName extends string> {\n readonly functionName: FunctionName;\n}\n\nexport const FunctionImpl = <FunctionName extends string>({\n functionName,\n}: {\n functionName: FunctionName;\n}) =>\n Context.GenericTag<FunctionImpl<FunctionName>>(\n `@confect/server/FunctionImpl/${functionName}`,\n );\n\n/**\n * Register a single function's implementation into the group's `Registry`.\n *\n * The function is registered under a flat, single-segment key (its own\n * `functionName`), not a project-wide dot-path. Each group's impl layer is\n * built in isolation — `RegisteredFunctions.buildForGroup` (and the CLI's\n * `validateImpl`) provide a fresh `Registry` per group — so function names\n * only need to be unique within their own group.\n *\n * `databaseSchema` is retained purely as a type-level carrier: the handler's\n * ctx-service requirements (`DatabaseReader`, `QueryCtx<DataModel>`, …) are\n * derived from it via `Handler.WithName`. It is not read at runtime — the\n * generated per-group registry forwards the schema value to the function\n * builders — so impls depend on `_generated/schema` (table schemas) rather than\n * `_generated/api` (which transitively imports every function spec).\n */\nexport const make = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Group extends GroupSpec.AnyWithProps,\n const FunctionName extends FunctionSpec.Name<GroupSpec.Functions<Group>>,\n>(\n _databaseSchema: DatabaseSchema_,\n group: Group,\n functionName: FunctionName,\n handler: Handler.WithName<\n DatabaseSchema_,\n GroupSpec.Functions<Group>,\n FunctionName\n >,\n): Layer.Layer<FunctionImpl<FunctionName>> => {\n const functionSpec = group.functions[functionName]!;\n\n return Layer.effect(\n FunctionImpl<FunctionName>({ functionName }),\n Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n\n yield* Ref.update(registry, (registryItems) =>\n setNestedProperty(\n registryItems,\n [functionName],\n RegistryItem.make({\n functionSpec,\n handler,\n }),\n ),\n );\n\n return { functionName };\n }),\n );\n};\n\n/**\n * Get the function implementation service type for a specific function name.\n */\nexport type ForFunction<FunctionName extends string> =\n FunctionImpl<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<FunctionNames>\n : never\n : never;\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAa,gBAA6C,EACxD,mBAIA,QAAQ,WACN,gCAAgC,eACjC;;;;;;;;;;;;;;;;;AAkBH,MAAa,QAKX,iBACA,OACA,cACA,YAK4C;CAC5C,MAAM,eAAe,MAAM,UAAU;AAErC,QAAO,MAAM,OACX,aAA2B,EAAE,cAAc,CAAC,EAC5C,OAAO,IAAI,aAAa;EACtB,MAAM,WAAW,OAAO,SAAS;AAEjC,SAAO,IAAI,OAAO,WAAW,kBAC3B,kBACE,eACA,CAAC,aAAa,EACdA,OAAkB;GAChB;GACA;GACD,CAAC,CACH,CACF;AAED,SAAO,EAAE,cAAc;GACvB,CACH"}
@@ -1,6 +1,7 @@
1
1
  import { AnyWithProps } from "./DatabaseSchema.js";
2
2
  import { FromGroupSpec as FromGroupSpec$1 } from "./FunctionImpl.js";
3
- import { Context, Layer } from "effect";
3
+ import * as Context from "effect/Context";
4
+ import * as Layer from "effect/Layer";
4
5
  import * as GroupSpec from "@confect/core/GroupSpec";
5
6
 
6
7
  //#region src/GroupImpl.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"GroupImpl.d.ts","names":[],"sources":["../src/GroupImpl.ts"],"mappings":";;;;;;;;;cAgBa,MAAA;AAAA,KACD,MAAA,UAAgB,MAAA;AAAA,KAEhB,kBAAA;AAAA,UAEK,SAAA,6BACa,kBAAA;EAAA,UAElB,MAAA,GAAS,MAAA;EAAA,SACV,kBAAA,EAAoB,mBAAA;;;;;;;WAOpB,uBAAA,EAAyB,aAAA;AAAA;AAAA,UAGnB,GAAA,SAAY,SAAA,CAAU,kBAAA;AAAA,cAE1B,WAAA,GAAe,CAAA,cAAa,CAAA,IAAK,GAAA;AAAA,UAG7B,YAAA,SAAqB,SAAA;AAAA,UACrB,cAAA,SAAuB,SAAA;AAAA,cAE3B,oBAAA,GAAwB,CAAA,cAAa,CAAA,IAAK,YAAA;AAAA,cAG1C,sBAAA,GAA0B,CAAA,cAAa,CAAA,IAAK,cAAA;;;;;AA3BzD;;;;;AAEA;;;cAwCa,SAAA,+BAAyC,kBAAA;EAAoB;AAAA;EAGxE,kBAAA,EAAoB,mBAAA;AAAA,MACrB,OAAA,CAAA,GAAA,CAAA,SAAA,CAAA,mBAAA,GAAA,SAAA,CAAA,mBAAA;;;;;;;;cAYY,IAAA,2BACa,YAAA,gBACV,SAAA,CAAU,YAAA,EAExB,eA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QAAA,GACX,KAAA,EAAO,KAAA,CAAM,KAAA,CAAM,SAAA,qBAClB,KAAA,CAAM,KAAA,CAAM,SAAA;AAAA,KA6BH,aAAA,eAA4B,SAAA,CAAU,YAAA,IAChD,eAAA,CAA2B,KAAA"}
package/dist/GroupImpl.js CHANGED
@@ -1,6 +1,14 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Array, Context, Effect, Layer, Option, Predicate, Record, Ref, pipe } from "effect";
2
+ import * as Context from "effect/Context";
3
+ import * as Layer from "effect/Layer";
4
+ import { pipe } from "effect/Function";
5
+ import * as Effect from "effect/Effect";
6
+ import * as Option from "effect/Option";
7
+ import * as Array from "effect/Array";
8
+ import * as Predicate from "effect/Predicate";
9
+ import * as Record from "effect/Record";
3
10
  import * as Registry from "@confect/core/Registry";
11
+ import * as Ref from "effect/Ref";
4
12
 
5
13
  //#region src/GroupImpl.ts
6
14
  var GroupImpl_exports = /* @__PURE__ */ __exportAll({
@@ -1 +1 @@
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} from \"effect\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as FunctionImpl from \"./FunctionImpl\";\n\nexport const TypeId = \"@confect/server/GroupImpl\";\nexport type TypeId = typeof TypeId;\n\nexport type FinalizationStatus = \"Unfinalized\" | \"Finalized\";\n\nexport interface GroupImpl<\n FinalizationStatus_ extends FinalizationStatus = \"Unfinalized\",\n> {\n readonly [TypeId]: TypeId;\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<FinalizationStatus> {}\n\nexport const isGroupImpl = (u: unknown): u is Any =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface AnyFinalized extends GroupImpl<\"Finalized\"> {}\nexport interface AnyUnfinalized extends GroupImpl<\"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 `validateImpl`) retrieve\n * the typed `Finalized` service directly rather than scanning the context.\n *\n * The tag is keyed only by finalization status — no group path — because each\n * group's impl layer is built in its own isolated scope (`buildForGroup` /\n * `validateImpl` each provide a fresh `Registry`), so at most one `GroupImpl`\n * service of each status exists per build.\n */\nexport const GroupImpl = <FinalizationStatus_ extends FinalizationStatus>({\n finalizationStatus,\n}: {\n finalizationStatus: FinalizationStatus_;\n}) =>\n Context.GenericTag<GroupImpl<FinalizationStatus_>>(\n `@confect/server/GroupImpl/${finalizationStatus}`,\n );\n\n/**\n * Begin a group's impl layer. `databaseSchema` and `group` are retained only as\n * type-level carriers (`group` drives the required `FunctionImpl` services via\n * `FromGroupSpec<Group>`; `databaseSchema` keeps the impl's dependency on\n * `_generated/schema` symmetric with `FunctionImpl.make`). Neither is read at\n * runtime.\n */\nexport const make = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Group extends GroupSpec.AnyWithProps,\n>(\n _databaseSchema: DatabaseSchema_,\n _group: Group,\n): Layer.Layer<\n GroupImpl<\"Unfinalized\">,\n never,\n FunctionImpl.FromGroupSpec<Group>\n> =>\n Layer.succeed(\n GroupImpl<\"Unfinalized\">({ finalizationStatus: \"Unfinalized\" }),\n {\n [TypeId]: TypeId,\n finalizationStatus: \"Unfinalized\" as const,\n registeredFunctionNames: [],\n },\n ) as Layer.Layer<\n GroupImpl<\"Unfinalized\">,\n never,\n FunctionImpl.FromGroupSpec<Group>\n >;\n\nconst isFunctionShaped = (value: unknown): boolean =>\n Predicate.isRecord(value) && \"functionSpec\" in value;\n\n/**\n * Return the names of the function-shaped entries in a group's (flat,\n * isolated) registry. `FunctionImpl.make` registers each function under a\n * single-segment key, so the registry built for one group contains exactly\n * that group's functions at the top level.\n */\nconst collectFunctionNames = (\n items: Registry.RegistryItems,\n): ReadonlyArray<string> =>\n pipe(\n Record.toEntries(items),\n Array.filterMap(([name, value]) =>\n isFunctionShaped(value) ? Option.some(name) : Option.none(),\n ),\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 = (\n group: Layer.Layer<GroupImpl<\"Unfinalized\">>,\n): Layer.Layer<GroupImpl<\"Finalized\">> =>\n Layer.flatMap(\n group,\n (context): Layer.Layer<GroupImpl<\"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: () =>\n Layer.effect(\n GroupImpl<\"Finalized\">({ finalizationStatus: \"Finalized\" }),\n Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n const items = yield* Ref.get(registry);\n return {\n [TypeId]: TypeId,\n finalizationStatus: \"Finalized\" as const,\n registeredFunctionNames: collectFunctionNames(items),\n };\n }),\n ),\n }),\n ),\n );\n\nexport type FromGroupSpec<Group extends GroupSpec.AnyWithProps> =\n FunctionImpl.FromGroupSpec<Group>;\n"],"mappings":";;;;;;;;;;;;;;AAgBA,MAAa,SAAS;AAqBtB,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;;;;;;;;;;;;;AAc7C,MAAa,aAA6D,EACxE,yBAIA,QAAQ,WACN,6BAA6B,qBAC9B;;;;;;;;AASH,MAAa,QAIX,iBACA,WAMA,MAAM,QACJ,UAAyB,EAAE,oBAAoB,eAAe,CAAC,EAC/D;EACG,SAAS;CACV,oBAAoB;CACpB,yBAAyB,EAAE;CAC5B,CACF;AAMH,MAAM,oBAAoB,UACxB,UAAU,SAAS,MAAM,IAAI,kBAAkB;;;;;;;AAQjD,MAAM,wBACJ,UAEA,KACE,OAAO,UAAU,MAAM,EACvB,MAAM,WAAW,CAAC,MAAM,WACtB,iBAAiB,MAAM,GAAG,OAAO,KAAK,KAAK,GAAG,OAAO,MAAM,CAC5D,CACF;AAEH,MAAM,4BACJ,YAEA,MAAM,UAAU,QAAQ,UAAU,QAAQ,EAAE,uBAAuB;;;;;;;;;;;;;;AAerE,MAAa,YACX,UAEA,MAAM,QACJ,QACC,YACC,yBAAyB,QAAQ,CAAC,KAChC,OAAO,MAAM;CACX,cACE,MAAM,oBACJ,IAAI,MACF,yFACD,CACF;CACH,cACE,MAAM,OACJ,UAAuB,EAAE,oBAAoB,aAAa,CAAC,EAC3D,OAAO,IAAI,aAAa;EACtB,MAAM,WAAW,OAAO,SAAS;EACjC,MAAM,QAAQ,OAAO,IAAI,IAAI,SAAS;AACtC,SAAO;IACJ,SAAS;GACV,oBAAoB;GACpB,yBAAyB,qBAAqB,MAAM;GACrD;GACD,CACH;CACJ,CAAC,CACH,CACJ"}
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 { pipe } from \"effect/Function\";\nimport * as Array from \"effect/Array\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Option from \"effect/Option\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Record from \"effect/Record\";\nimport * as Ref from \"effect/Ref\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport type * as FunctionImpl from \"./FunctionImpl\";\n\nexport const TypeId = \"@confect/server/GroupImpl\";\nexport type TypeId = typeof TypeId;\n\nexport type FinalizationStatus = \"Unfinalized\" | \"Finalized\";\n\nexport interface GroupImpl<\n FinalizationStatus_ extends FinalizationStatus = \"Unfinalized\",\n> {\n readonly [TypeId]: TypeId;\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<FinalizationStatus> {}\n\nexport const isGroupImpl = (u: unknown): u is Any =>\n Predicate.hasProperty(u, TypeId);\n\nexport interface AnyFinalized extends GroupImpl<\"Finalized\"> {}\nexport interface AnyUnfinalized extends GroupImpl<\"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 `validateImpl`) retrieve\n * the typed `Finalized` service directly rather than scanning the context.\n *\n * The tag is keyed only by finalization status — no group path — because each\n * group's impl layer is built in its own isolated scope (`buildForGroup` /\n * `validateImpl` each provide a fresh `Registry`), so at most one `GroupImpl`\n * service of each status exists per build.\n */\nexport const GroupImpl = <FinalizationStatus_ extends FinalizationStatus>({\n finalizationStatus,\n}: {\n finalizationStatus: FinalizationStatus_;\n}) =>\n Context.GenericTag<GroupImpl<FinalizationStatus_>>(\n `@confect/server/GroupImpl/${finalizationStatus}`,\n );\n\n/**\n * Begin a group's impl layer. `databaseSchema` and `group` are retained only as\n * type-level carriers (`group` drives the required `FunctionImpl` services via\n * `FromGroupSpec<Group>`; `databaseSchema` keeps the impl's dependency on\n * `_generated/schema` symmetric with `FunctionImpl.make`). Neither is read at\n * runtime.\n */\nexport const make = <\n DatabaseSchema_ extends DatabaseSchema.AnyWithProps,\n Group extends GroupSpec.AnyWithProps,\n>(\n _databaseSchema: DatabaseSchema_,\n _group: Group,\n): Layer.Layer<\n GroupImpl<\"Unfinalized\">,\n never,\n FunctionImpl.FromGroupSpec<Group>\n> =>\n Layer.succeed(\n GroupImpl<\"Unfinalized\">({ finalizationStatus: \"Unfinalized\" }),\n {\n [TypeId]: TypeId,\n finalizationStatus: \"Unfinalized\" as const,\n registeredFunctionNames: [],\n },\n ) as Layer.Layer<\n GroupImpl<\"Unfinalized\">,\n never,\n FunctionImpl.FromGroupSpec<Group>\n >;\n\nconst isFunctionShaped = (value: unknown): boolean =>\n Predicate.isRecord(value) && \"functionSpec\" in value;\n\n/**\n * Return the names of the function-shaped entries in a group's (flat,\n * isolated) registry. `FunctionImpl.make` registers each function under a\n * single-segment key, so the registry built for one group contains exactly\n * that group's functions at the top level.\n */\nconst collectFunctionNames = (\n items: Registry.RegistryItems,\n): ReadonlyArray<string> =>\n pipe(\n Record.toEntries(items),\n Array.filterMap(([name, value]) =>\n isFunctionShaped(value) ? Option.some(name) : Option.none(),\n ),\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 = (\n group: Layer.Layer<GroupImpl<\"Unfinalized\">>,\n): Layer.Layer<GroupImpl<\"Finalized\">> =>\n Layer.flatMap(\n group,\n (context): Layer.Layer<GroupImpl<\"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: () =>\n Layer.effect(\n GroupImpl<\"Finalized\">({ finalizationStatus: \"Finalized\" }),\n Effect.gen(function* () {\n const registry = yield* Registry.Registry;\n const items = yield* Ref.get(registry);\n return {\n [TypeId]: TypeId,\n finalizationStatus: \"Finalized\" as const,\n registeredFunctionNames: collectFunctionNames(items),\n };\n }),\n ),\n }),\n ),\n );\n\nexport type FromGroupSpec<Group extends GroupSpec.AnyWithProps> =\n FunctionImpl.FromGroupSpec<Group>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAcA,MAAa,SAAS;AAqBtB,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;;;;;;;;;;;;;AAc7C,MAAa,aAA6D,EACxE,yBAIA,QAAQ,WACN,6BAA6B,qBAC9B;;;;;;;;AASH,MAAa,QAIX,iBACA,WAMA,MAAM,QACJ,UAAyB,EAAE,oBAAoB,eAAe,CAAC,EAC/D;EACG,SAAS;CACV,oBAAoB;CACpB,yBAAyB,EAAE;CAC5B,CACF;AAMH,MAAM,oBAAoB,UACxB,UAAU,SAAS,MAAM,IAAI,kBAAkB;;;;;;;AAQjD,MAAM,wBACJ,UAEA,KACE,OAAO,UAAU,MAAM,EACvB,MAAM,WAAW,CAAC,MAAM,WACtB,iBAAiB,MAAM,GAAG,OAAO,KAAK,KAAK,GAAG,OAAO,MAAM,CAC5D,CACF;AAEH,MAAM,4BACJ,YAEA,MAAM,UAAU,QAAQ,UAAU,QAAQ,EAAE,uBAAuB;;;;;;;;;;;;;;AAerE,MAAa,YACX,UAEA,MAAM,QACJ,QACC,YACC,yBAAyB,QAAQ,CAAC,KAChC,OAAO,MAAM;CACX,cACE,MAAM,oBACJ,IAAI,MACF,yFACD,CACF;CACH,cACE,MAAM,OACJ,UAAuB,EAAE,oBAAoB,aAAa,CAAC,EAC3D,OAAO,IAAI,aAAa;EACtB,MAAM,WAAW,OAAO,SAAS;EACjC,MAAM,QAAQ,OAAO,IAAI,IAAI,SAAS;AACtC,SAAO;IACJ,SAAS;GACV,oBAAoB;GACpB,yBAAyB,qBAAqB,MAAM;GACrD;GACD,CACH;CACJ,CAAC,CACH,CACJ"}
package/dist/Handler.d.ts CHANGED
@@ -15,10 +15,10 @@ import { StorageReader } from "./StorageReader.js";
15
15
  import { StorageWriter } from "./StorageWriter.js";
16
16
  import { VectorSearch } from "./VectorSearch.js";
17
17
  import { Any as Any$1, ConvexRegisteredFunction } from "./RegisteredFunction.js";
18
- import { Effect } from "effect";
19
18
  import { FunctionSpec, RuntimeAndFunctionType } from "@confect/core";
20
- import { NodeContext } from "@effect/platform-node";
19
+ import { Effect } from "effect";
21
20
  import * as FunctionProvenance from "@confect/core/FunctionProvenance";
21
+ import { NodeContext } from "@effect/platform-node";
22
22
 
23
23
  //#region src/Handler.d.ts
24
24
  declare namespace Handler_d_exports {
package/dist/HttpApi.d.ts CHANGED
@@ -6,9 +6,11 @@ import { Scheduler as Scheduler$1 } from "./Scheduler.js";
6
6
  import { StorageActionWriter as StorageActionWriter$1 } from "./StorageActionWriter.js";
7
7
  import { StorageReader as StorageReader$1 } from "./StorageReader.js";
8
8
  import { StorageWriter as StorageWriter$1 } from "./StorageWriter.js";
9
- import { Layer } from "effect";
10
9
  import { HttpRouter } from "convex/server";
11
- import { HttpApi, HttpApiBuilder, HttpApiScalar, HttpApp, HttpRouter as HttpRouter$1 } from "@effect/platform";
10
+ import * as Layer from "effect/Layer";
11
+ import * as HttpApiBuilder from "@effect/platform/HttpApiBuilder";
12
+ import * as HttpApiScalar from "@effect/platform/HttpApiScalar";
13
+ import { HttpApi, HttpApp, HttpRouter as HttpRouter$1 } from "@effect/platform";
12
14
 
13
15
  //#region src/HttpApi.d.ts
14
16
  declare namespace HttpApi_d_exports {
@@ -1 +1 @@
1
- {"version":3,"file":"HttpApi.d.ts","names":[],"sources":["../src/HttpApi.ts"],"mappings":";;;;;;;;;;;;;;;;KA6BK,UAAA,IACH,OAAA,EAAS,OAAA,CAAQ,OAAA,KACd,OAAA,CAAQ,OAAA,QAEX,OAAA,CAAQ,GAAA,GAAM,cAAA,CAAe,MAAA,GAAS,YAAA,CAAW,UAAA,CAAW,eAAA;AAAA,KAsGlD,QAAA;EACV,OAAA,EAAS,KAAA,CAAM,KAAA,CACb,OAAA,CAAQ,GAAA,SAEN,WAAA,GACA,cAAA,GACA,YAAA,GACA,WAAA,GACA,MAAA,GACA,eAAA,GACA,eAAA,GACA,qBAAA;EAEJ,UAAA,GAAa,UAAA;EACb,MAAA,GAAS,aAAA,CAAc,YAAA;AAAA;AAAA,KAGb,SAAA;AAAA,KA8CP,QAAA,GAAW,OAAA,CAAQ,MAAA,CAAO,SAAA,EAAW,QAAA;AAAA,cAE7B,IAAA,GAAQ,QAAA,EAAU,QAAA,KAAW,UAAA"}
1
+ {"version":3,"file":"HttpApi.d.ts","names":[],"sources":["../src/HttpApi.ts"],"mappings":";;;;;;;;;;;;;;;;;;KA4BK,UAAA,IACH,OAAA,EAAS,OAAA,CAAQ,OAAA,KACd,OAAA,CAAQ,OAAA,QAEX,OAAA,CAAQ,GAAA,GAAM,cAAA,CAAe,MAAA,GAAS,YAAA,CAAW,UAAA,CAAW,eAAA;AAAA,KAsGlD,QAAA;EACV,OAAA,EAAS,KAAA,CAAM,KAAA,CACb,OAAA,CAAQ,GAAA,SAEN,WAAA,GACA,cAAA,GACA,YAAA,GACA,WAAA,GACA,MAAA,GACA,eAAA,GACA,eAAA,GACA,qBAAA;EAEJ,UAAA,GAAa,UAAA;EACb,MAAA,GAAS,aAAA,CAAc,YAAA;AAAA;AAAA,KAGb,SAAA;AAAA,KA8CP,QAAA,GAAW,OAAA,CAAQ,MAAA,CAAO,SAAA,EAAW,QAAA;AAAA,cAE7B,IAAA,GAAQ,QAAA,EAAU,QAAA,KAAW,UAAA"}
package/dist/HttpApi.js CHANGED
@@ -9,9 +9,14 @@ import { layer as layer$4 } from "./Scheduler.js";
9
9
  import { StorageActionWriter as StorageActionWriter$1 } from "./StorageActionWriter.js";
10
10
  import { StorageReader as StorageReader$1 } from "./StorageReader.js";
11
11
  import { StorageWriter as StorageWriter$1 } from "./StorageWriter.js";
12
- import { Array, Layer, Record, pipe } from "effect";
13
12
  import { ROUTABLE_HTTP_METHODS, httpActionGeneric, httpRouter } from "convex/server";
14
- import { HttpApiBuilder, HttpApiScalar, HttpServer } from "@effect/platform";
13
+ import * as Layer from "effect/Layer";
14
+ import { pipe } from "effect/Function";
15
+ import * as Array from "effect/Array";
16
+ import * as Record from "effect/Record";
17
+ import * as HttpApiBuilder from "@effect/platform/HttpApiBuilder";
18
+ import * as HttpApiScalar from "@effect/platform/HttpApiScalar";
19
+ import * as HttpServer from "@effect/platform/HttpServer";
15
20
 
16
21
  //#region src/HttpApi.ts
17
22
  var HttpApi_exports = /* @__PURE__ */ __exportAll({ make: () => make });
@@ -1 +1 @@
1
- {"version":3,"file":"HttpApi.js","names":["QueryRunner.layer","MutationRunner.layer","ActionRunner.layer","Scheduler.layer","Auth.layer","StorageReader","StorageWriter","StorageActionWriter","ActionCtx.ActionCtx","ConvexConfigProvider.make"],"sources":["../src/HttpApi.ts"],"sourcesContent":["import {\n type HttpApi,\n HttpApiBuilder,\n HttpApiScalar,\n type HttpApp,\n type HttpRouter,\n HttpServer,\n} from \"@effect/platform\";\nimport {\n type HttpRouter as ConvexHttpRouter,\n type GenericActionCtx,\n type GenericDataModel,\n httpActionGeneric,\n httpRouter,\n ROUTABLE_HTTP_METHODS,\n type RouteSpecWithPathPrefix,\n} from \"convex/server\";\nimport { Array, Layer, pipe, Record } from \"effect\";\nimport * as ActionCtx from \"./ActionCtx\";\nimport * as ActionRunner from \"./ActionRunner\";\nimport * as Auth from \"./Auth\";\nimport * as ConvexConfigProvider from \"./ConvexConfigProvider\";\nimport * as MutationRunner from \"./MutationRunner\";\nimport * as QueryRunner from \"./QueryRunner\";\nimport * as Scheduler from \"./Scheduler\";\nimport { StorageActionWriter } from \"./StorageActionWriter\";\nimport { StorageReader } from \"./StorageReader\";\nimport { StorageWriter } from \"./StorageWriter\";\n\ntype Middleware = (\n httpApp: HttpApp.Default,\n) => HttpApp.Default<\n never,\n HttpApi.Api | HttpApiBuilder.Router | HttpRouter.HttpRouter.DefaultServices\n>;\n\nconst makeHandler =\n <DataModel extends GenericDataModel>({\n pathPrefix,\n apiLive,\n middleware,\n scalar,\n }: {\n pathPrefix: RoutePath;\n apiLive: Layer.Layer<\n HttpApi.Api,\n never,\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n | GenericActionCtx<DataModel>\n >;\n middleware?: Middleware;\n scalar?: HttpApiScalar.ScalarConfig;\n }) =>\n (ctx: GenericActionCtx<DataModel>, request: Request): Promise<Response> => {\n const ApiLive = apiLive.pipe(\n Layer.provide(\n Layer.mergeAll(\n QueryRunner.layer(ctx.runQuery),\n MutationRunner.layer(ctx.runMutation),\n ActionRunner.layer(ctx.runAction),\n Scheduler.layer(ctx.scheduler),\n Auth.layer(ctx.auth),\n StorageReader.layer(ctx.storage),\n StorageWriter.layer(ctx.storage),\n StorageActionWriter.layer(ctx.storage),\n Layer.succeed(ActionCtx.ActionCtx<DataModel>(), ctx),\n ),\n ),\n );\n\n const ApiDocsLive = HttpApiScalar.layer({\n path: `${pathPrefix}docs`,\n scalar: {\n baseServerURL: `${process.env[\"CONVEX_SITE_URL\"]}${pathPrefix}`,\n ...scalar,\n },\n }).pipe(Layer.provide(ApiLive));\n\n const EnvLive = Layer.mergeAll(\n ApiLive,\n ApiDocsLive,\n HttpServer.layerContext,\n Layer.setConfigProvider(ConvexConfigProvider.make()),\n );\n\n const { handler } = HttpApiBuilder.toWebHandler(\n EnvLive,\n middleware ? { middleware } : {},\n );\n\n return handler(request);\n };\n\nconst makeHttpAction = <DataModel extends GenericDataModel>({\n pathPrefix,\n apiLive,\n middleware,\n scalar,\n}: {\n pathPrefix: RoutePath;\n apiLive: Layer.Layer<\n HttpApi.Api,\n never,\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n | GenericActionCtx<DataModel>\n >;\n middleware?: Middleware;\n scalar?: HttpApiScalar.ScalarConfig;\n}) =>\n httpActionGeneric(\n makeHandler<DataModel>({\n pathPrefix,\n apiLive,\n ...(middleware ? { middleware } : {}),\n ...(scalar ? { scalar } : {}),\n }) as unknown as (\n ctx: GenericActionCtx<GenericDataModel>,\n request: Request,\n ) => Promise<Response>,\n );\n\nexport type HttpApi_ = {\n apiLive: Layer.Layer<\n HttpApi.Api,\n never,\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n >;\n middleware?: Middleware;\n scalar?: HttpApiScalar.ScalarConfig;\n};\n\nexport type RoutePath = \"/\" | `/${string}/`;\n\nconst mountEffectHttpApi =\n <DataModel extends GenericDataModel>({\n pathPrefix,\n apiLive,\n middleware,\n scalar,\n }: {\n pathPrefix: RoutePath;\n apiLive: Layer.Layer<\n HttpApi.Api,\n never,\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n | GenericActionCtx<DataModel>\n >;\n middleware?: Middleware;\n scalar?: HttpApiScalar.ScalarConfig;\n }) =>\n (convexHttpRouter: ConvexHttpRouter): ConvexHttpRouter => {\n const handler = makeHttpAction<DataModel>({\n pathPrefix,\n apiLive,\n ...(middleware ? { middleware } : {}),\n ...(scalar ? { scalar } : {}),\n });\n\n Array.forEach(ROUTABLE_HTTP_METHODS, (method) => {\n const routeSpec: RouteSpecWithPathPrefix = {\n pathPrefix,\n method,\n handler,\n };\n convexHttpRouter.route(routeSpec);\n });\n\n return convexHttpRouter;\n };\n\ntype HttpApis = Partial<Record<RoutePath, HttpApi_>>;\n\nexport const make = (httpApis: HttpApis): ConvexHttpRouter => {\n applyMonkeyPatches();\n\n return pipe(\n httpApis as Record<RoutePath, HttpApi_>,\n Record.toEntries,\n Array.reduce(\n httpRouter(),\n (convexHttpRouter, [pathPrefix, { apiLive, middleware, scalar }]) =>\n mountEffectHttpApi({\n pathPrefix: pathPrefix as RoutePath,\n apiLive,\n ...(middleware ? { middleware } : {}),\n ...(scalar ? { scalar } : {}),\n })(convexHttpRouter),\n ),\n );\n};\n\nconst applyMonkeyPatches = () => {\n // These are necessary until the Convex runtime supports these APIs. See https://discord.com/channels/1019350475847499849/1281364098419785760\n\n // eslint-disable-next-line no-global-assign\n URL = class extends URL {\n override get username() {\n return \"\";\n }\n override get password() {\n return \"\";\n }\n };\n\n Object.defineProperty(Request.prototype, \"signal\", {\n get: () => new AbortSignal(),\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAoCA,MAAM,eACiC,EACnC,YACA,SACA,YACA,cAmBD,KAAkC,YAAwC;CACzE,MAAM,UAAU,QAAQ,KACtB,MAAM,QACJ,MAAM,SACJA,QAAkB,IAAI,SAAS,EAC/BC,QAAqB,IAAI,YAAY,EACrCC,MAAmB,IAAI,UAAU,EACjCC,QAAgB,IAAI,UAAU,EAC9BC,QAAW,IAAI,KAAK,EACpBC,gBAAc,MAAM,IAAI,QAAQ,EAChCC,gBAAc,MAAM,IAAI,QAAQ,EAChCC,sBAAoB,MAAM,IAAI,QAAQ,EACtC,MAAM,QAAQC,WAAgC,EAAE,IAAI,CACrD,CACF,CACF;CAED,MAAM,cAAc,cAAc,MAAM;EACtC,MAAM,GAAG,WAAW;EACpB,QAAQ;GACN,eAAe,GAAG,QAAQ,IAAI,qBAAqB;GACnD,GAAG;GACJ;EACF,CAAC,CAAC,KAAK,MAAM,QAAQ,QAAQ,CAAC;CAE/B,MAAM,UAAU,MAAM,SACpB,SACA,aACA,WAAW,cACX,MAAM,kBAAkBC,QAA2B,CAAC,CACrD;CAED,MAAM,EAAE,YAAY,eAAe,aACjC,SACA,aAAa,EAAE,YAAY,GAAG,EAAE,CACjC;AAED,QAAO,QAAQ,QAAQ;;AAG3B,MAAM,kBAAsD,EAC1D,YACA,SACA,YACA,aAmBA,kBACE,YAAuB;CACrB;CACA;CACA,GAAI,aAAa,EAAE,YAAY,GAAG,EAAE;CACpC,GAAI,SAAS,EAAE,QAAQ,GAAG,EAAE;CAC7B,CAAC,CAIH;AAqBH,MAAM,sBACiC,EACnC,YACA,SACA,YACA,cAmBD,qBAAyD;CACxD,MAAM,UAAU,eAA0B;EACxC;EACA;EACA,GAAI,aAAa,EAAE,YAAY,GAAG,EAAE;EACpC,GAAI,SAAS,EAAE,QAAQ,GAAG,EAAE;EAC7B,CAAC;AAEF,OAAM,QAAQ,wBAAwB,WAAW;EAC/C,MAAM,YAAqC;GACzC;GACA;GACA;GACD;AACD,mBAAiB,MAAM,UAAU;GACjC;AAEF,QAAO;;AAKX,MAAa,QAAQ,aAAyC;AAC5D,qBAAoB;AAEpB,QAAO,KACL,UACA,OAAO,WACP,MAAM,OACJ,YAAY,GACX,kBAAkB,CAAC,YAAY,EAAE,SAAS,YAAY,cACrD,mBAAmB;EACL;EACZ;EACA,GAAI,aAAa,EAAE,YAAY,GAAG,EAAE;EACpC,GAAI,SAAS,EAAE,QAAQ,GAAG,EAAE;EAC7B,CAAC,CAAC,iBAAiB,CACvB,CACF;;AAGH,MAAM,2BAA2B;AAI/B,OAAM,cAAc,IAAI;EACtB,IAAa,WAAW;AACtB,UAAO;;EAET,IAAa,WAAW;AACtB,UAAO;;;AAIX,QAAO,eAAe,QAAQ,WAAW,UAAU,EACjD,WAAW,IAAI,aAAa,EAC7B,CAAC"}
1
+ {"version":3,"file":"HttpApi.js","names":["QueryRunner.layer","MutationRunner.layer","ActionRunner.layer","Scheduler.layer","Auth.layer","StorageReader","StorageWriter","StorageActionWriter","ActionCtx.ActionCtx","ConvexConfigProvider.make"],"sources":["../src/HttpApi.ts"],"sourcesContent":["import type { HttpApi, HttpApp, HttpRouter } from \"@effect/platform\";\nimport * as HttpApiBuilder from \"@effect/platform/HttpApiBuilder\";\nimport * as HttpApiScalar from \"@effect/platform/HttpApiScalar\";\nimport * as HttpServer from \"@effect/platform/HttpServer\";\nimport {\n type HttpRouter as ConvexHttpRouter,\n type GenericActionCtx,\n type GenericDataModel,\n httpActionGeneric,\n httpRouter,\n ROUTABLE_HTTP_METHODS,\n type RouteSpecWithPathPrefix,\n} from \"convex/server\";\nimport { pipe } from \"effect/Function\";\nimport * as Array from \"effect/Array\";\nimport * as Layer from \"effect/Layer\";\nimport * as Record from \"effect/Record\";\nimport * as ActionCtx from \"./ActionCtx\";\nimport * as ActionRunner from \"./ActionRunner\";\nimport * as Auth from \"./Auth\";\nimport * as ConvexConfigProvider from \"./ConvexConfigProvider\";\nimport * as MutationRunner from \"./MutationRunner\";\nimport * as QueryRunner from \"./QueryRunner\";\nimport * as Scheduler from \"./Scheduler\";\nimport { StorageActionWriter } from \"./StorageActionWriter\";\nimport { StorageReader } from \"./StorageReader\";\nimport { StorageWriter } from \"./StorageWriter\";\n\ntype Middleware = (\n httpApp: HttpApp.Default,\n) => HttpApp.Default<\n never,\n HttpApi.Api | HttpApiBuilder.Router | HttpRouter.HttpRouter.DefaultServices\n>;\n\nconst makeHandler =\n <DataModel extends GenericDataModel>({\n pathPrefix,\n apiLive,\n middleware,\n scalar,\n }: {\n pathPrefix: RoutePath;\n apiLive: Layer.Layer<\n HttpApi.Api,\n never,\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n | GenericActionCtx<DataModel>\n >;\n middleware?: Middleware;\n scalar?: HttpApiScalar.ScalarConfig;\n }) =>\n (ctx: GenericActionCtx<DataModel>, request: Request): Promise<Response> => {\n const ApiLive = apiLive.pipe(\n Layer.provide(\n Layer.mergeAll(\n QueryRunner.layer(ctx.runQuery),\n MutationRunner.layer(ctx.runMutation),\n ActionRunner.layer(ctx.runAction),\n Scheduler.layer(ctx.scheduler),\n Auth.layer(ctx.auth),\n StorageReader.layer(ctx.storage),\n StorageWriter.layer(ctx.storage),\n StorageActionWriter.layer(ctx.storage),\n Layer.succeed(ActionCtx.ActionCtx<DataModel>(), ctx),\n ),\n ),\n );\n\n const ApiDocsLive = HttpApiScalar.layer({\n path: `${pathPrefix}docs`,\n scalar: {\n baseServerURL: `${process.env[\"CONVEX_SITE_URL\"]}${pathPrefix}`,\n ...scalar,\n },\n }).pipe(Layer.provide(ApiLive));\n\n const EnvLive = Layer.mergeAll(\n ApiLive,\n ApiDocsLive,\n HttpServer.layerContext,\n Layer.setConfigProvider(ConvexConfigProvider.make()),\n );\n\n const { handler } = HttpApiBuilder.toWebHandler(\n EnvLive,\n middleware ? { middleware } : {},\n );\n\n return handler(request);\n };\n\nconst makeHttpAction = <DataModel extends GenericDataModel>({\n pathPrefix,\n apiLive,\n middleware,\n scalar,\n}: {\n pathPrefix: RoutePath;\n apiLive: Layer.Layer<\n HttpApi.Api,\n never,\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n | GenericActionCtx<DataModel>\n >;\n middleware?: Middleware;\n scalar?: HttpApiScalar.ScalarConfig;\n}) =>\n httpActionGeneric(\n makeHandler<DataModel>({\n pathPrefix,\n apiLive,\n ...(middleware ? { middleware } : {}),\n ...(scalar ? { scalar } : {}),\n }) as unknown as (\n ctx: GenericActionCtx<GenericDataModel>,\n request: Request,\n ) => Promise<Response>,\n );\n\nexport type HttpApi_ = {\n apiLive: Layer.Layer<\n HttpApi.Api,\n never,\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n >;\n middleware?: Middleware;\n scalar?: HttpApiScalar.ScalarConfig;\n};\n\nexport type RoutePath = \"/\" | `/${string}/`;\n\nconst mountEffectHttpApi =\n <DataModel extends GenericDataModel>({\n pathPrefix,\n apiLive,\n middleware,\n scalar,\n }: {\n pathPrefix: RoutePath;\n apiLive: Layer.Layer<\n HttpApi.Api,\n never,\n | QueryRunner.QueryRunner\n | MutationRunner.MutationRunner\n | ActionRunner.ActionRunner\n | Scheduler.Scheduler\n | Auth.Auth\n | StorageReader\n | StorageWriter\n | StorageActionWriter\n | GenericActionCtx<DataModel>\n >;\n middleware?: Middleware;\n scalar?: HttpApiScalar.ScalarConfig;\n }) =>\n (convexHttpRouter: ConvexHttpRouter): ConvexHttpRouter => {\n const handler = makeHttpAction<DataModel>({\n pathPrefix,\n apiLive,\n ...(middleware ? { middleware } : {}),\n ...(scalar ? { scalar } : {}),\n });\n\n Array.forEach(ROUTABLE_HTTP_METHODS, (method) => {\n const routeSpec: RouteSpecWithPathPrefix = {\n pathPrefix,\n method,\n handler,\n };\n convexHttpRouter.route(routeSpec);\n });\n\n return convexHttpRouter;\n };\n\ntype HttpApis = Partial<Record<RoutePath, HttpApi_>>;\n\nexport const make = (httpApis: HttpApis): ConvexHttpRouter => {\n applyMonkeyPatches();\n\n return pipe(\n httpApis as Record<RoutePath, HttpApi_>,\n Record.toEntries,\n Array.reduce(\n httpRouter(),\n (convexHttpRouter, [pathPrefix, { apiLive, middleware, scalar }]) =>\n mountEffectHttpApi({\n pathPrefix: pathPrefix as RoutePath,\n apiLive,\n ...(middleware ? { middleware } : {}),\n ...(scalar ? { scalar } : {}),\n })(convexHttpRouter),\n ),\n );\n};\n\nconst applyMonkeyPatches = () => {\n // These are necessary until the Convex runtime supports these APIs. See https://discord.com/channels/1019350475847499849/1281364098419785760\n\n // eslint-disable-next-line no-global-assign\n URL = class extends URL {\n override get username() {\n return \"\";\n }\n override get password() {\n return \"\";\n }\n };\n\n Object.defineProperty(Request.prototype, \"signal\", {\n get: () => new AbortSignal(),\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,eACiC,EACnC,YACA,SACA,YACA,cAmBD,KAAkC,YAAwC;CACzE,MAAM,UAAU,QAAQ,KACtB,MAAM,QACJ,MAAM,SACJA,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AAkB,CAAC,YAAY,EAAE,SAAS,YAAY,cACrD,mBAAmB;EACL;EACZ;EACA,GAAI,aAAa,EAAE,YAAY,GAAG,EAAE;EACpC,GAAI,SAAS,EAAE,QAAQ,GAAG,EAAE;EAC7B,CAAC,CAAC,iBAAiB,CACvB,CACF;;AAGH,MAAM,2BAA2B;AAI/B,OAAM,cAAc,IAAI;EACtB,IAAa,WAAW;AACtB,UAAO;;EAET,IAAa,WAAW;AACtB,UAAO;;;AAIX,QAAO,eAAe,QAAQ,WAAW,UAAU,EACjD,WAAW,IAAI,aAAa,EAC7B,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Context } from "effect";
1
+ import * as Context from "effect/Context";
2
2
  import { GenericDataModel, GenericMutationCtx } from "convex/server";
3
3
 
4
4
  //#region src/MutationCtx.d.ts
@@ -1,5 +1,5 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Context } from "effect";
2
+ import * as Context from "effect/Context";
3
3
 
4
4
  //#region src/MutationCtx.ts
5
5
  var MutationCtx_exports = /* @__PURE__ */ __exportAll({ MutationCtx: () => MutationCtx });
@@ -1 +1 @@
1
- {"version":3,"file":"MutationCtx.js","names":[],"sources":["../src/MutationCtx.ts"],"sourcesContent":["import type { GenericDataModel, GenericMutationCtx } from \"convex/server\";\nimport { Context } from \"effect\";\n\nexport const MutationCtx = <DataModel extends GenericDataModel>() =>\n Context.GenericTag<GenericMutationCtx<DataModel>>(\n \"@confect/server/MutationCtx\",\n );\n\nexport type MutationCtx<DataModel extends GenericDataModel> = ReturnType<\n typeof MutationCtx<DataModel>\n>[\"Identifier\"];\n"],"mappings":";;;;;AAGA,MAAa,oBACX,QAAQ,WACN,8BACD"}
1
+ {"version":3,"file":"MutationCtx.js","names":[],"sources":["../src/MutationCtx.ts"],"sourcesContent":["import type { GenericDataModel, GenericMutationCtx } from \"convex/server\";\nimport * as Context from \"effect/Context\";\n\nexport const MutationCtx = <DataModel extends GenericDataModel>() =>\n Context.GenericTag<GenericMutationCtx<DataModel>>(\n \"@confect/server/MutationCtx\",\n );\n\nexport type MutationCtx<DataModel extends GenericDataModel> = ReturnType<\n typeof MutationCtx<DataModel>\n>[\"Identifier\"];\n"],"mappings":";;;;;AAGA,MAAa,oBACX,QAAQ,WACN,8BACD"}
@@ -1,14 +1,16 @@
1
- import { Context, Effect, Layer, ParseResult } from "effect";
2
- import * as Ref$1 from "@confect/core/Ref";
1
+ import * as Context from "effect/Context";
2
+ import * as Ref from "@confect/core/Ref";
3
3
  import { GenericMutationCtx } from "convex/server";
4
+ import * as Layer$1 from "effect/Layer";
5
+ import { Effect, ParseResult } from "effect";
4
6
 
5
7
  //#region src/MutationRunner.d.ts
6
8
  declare namespace MutationRunner_d_exports {
7
9
  export { MutationRunner, layer };
8
10
  }
9
- declare const MutationRunner: Context.Tag<(<Mutation extends Ref$1.AnyMutation>(mutation: Mutation, ...args: Ref$1.OptionalArgs<Mutation>) => Effect.Effect<Ref$1.Returns<Mutation>, Ref$1.Error<Mutation> | ParseResult.ParseError>), <Mutation extends Ref$1.AnyMutation>(mutation: Mutation, ...args: Ref$1.OptionalArgs<Mutation>) => Effect.Effect<Ref$1.Returns<Mutation>, Ref$1.Error<Mutation> | ParseResult.ParseError>>;
11
+ declare const MutationRunner: Context.Tag<(<Mutation extends Ref.AnyMutation>(mutation: Mutation, ...args: Ref.OptionalArgs<Mutation>) => Effect.Effect<Ref.Returns<Mutation>, Ref.Error<Mutation> | ParseResult.ParseError>), <Mutation extends Ref.AnyMutation>(mutation: Mutation, ...args: Ref.OptionalArgs<Mutation>) => Effect.Effect<Ref.Returns<Mutation>, Ref.Error<Mutation> | ParseResult.ParseError>>;
10
12
  type MutationRunner = typeof MutationRunner.Identifier;
11
- declare const layer: (runMutation: GenericMutationCtx<any>["runMutation"]) => Layer.Layer<(<Mutation extends Ref$1.AnyMutation>(mutation: Mutation, ...args: Ref$1.OptionalArgs<Mutation>) => Effect.Effect<Ref$1.Returns<Mutation>, Ref$1.Error<Mutation> | ParseResult.ParseError>), never, never>;
13
+ declare const layer: (runMutation: GenericMutationCtx<any>["runMutation"]) => Layer$1.Layer<(<Mutation extends Ref.AnyMutation>(mutation: Mutation, ...args: Ref.OptionalArgs<Mutation>) => Effect.Effect<Ref.Returns<Mutation>, Ref.Error<Mutation> | ParseResult.ParseError>), never, never>;
12
14
  //#endregion
13
15
  export { MutationRunner, MutationRunner_d_exports, layer };
14
16
  //# sourceMappingURL=MutationRunner.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"MutationRunner.d.ts","names":[],"sources":["../src/MutationRunner.ts"],"mappings":";;;;;;;;cAqBa,cAAA,EAAc,OAAA,CAAA,GAAA,oBAdP,KAAA,CAAI,WAAA,EAAW,QAAA,EACrB,QAAA,KAAQ,IAAA,EACT,KAAA,CAAI,YAAA,CAAa,QAAA,MACzB,MAAA,CAAO,MAAA,CACR,KAAA,CAAI,OAAA,CAAQ,QAAA,GACZ,KAAA,CAAI,KAAA,CAAM,QAAA,IAAY,WAAA,CAAY,UAAA,sBALlB,KAAA,CAAI,WAAA,EAAW,QAAA,EACrB,QAAA,KAAQ,IAAA,EACT,KAAA,CAAI,YAAA,CAAa,QAAA,MACzB,MAAA,CAAO,MAAA,CACR,KAAA,CAAI,OAAA,CAAQ,QAAA,GACZ,KAAA,CAAI,KAAA,CAAM,QAAA,IAAY,WAAA,CAAY,UAAA;AAAA,KAY1B,cAAA,UAAwB,cAAA,CAAe,UAAA;AAAA,cAEtC,KAAA,GAAS,WAAA,EAAa,kBAAA,yBAAsC,KAAA,CAAA,KAAA,oBAnBrD,KAAA,CAAI,WAAA,EAAW,QAAA,EACrB,QAAA,KAAQ,IAAA,EACT,KAAA,CAAI,YAAA,CAAa,QAAA,MACzB,MAAA,CAAO,MAAA,CACR,KAAA,CAAI,OAAA,CAAQ,QAAA,GACZ,KAAA,CAAI,KAAA,CAAM,QAAA,IAAY,WAAA,CAAY,UAAA"}
1
+ {"version":3,"file":"MutationRunner.d.ts","names":[],"sources":["../src/MutationRunner.ts"],"mappings":";;;;;;;;;;cAsBa,cAAA,EAAc,OAAA,CAAA,GAAA,oBAdP,GAAA,CAAI,WAAA,EAAW,QAAA,EACrB,QAAA,KAAQ,IAAA,EACT,GAAA,CAAI,YAAA,CAAa,QAAA,MACzB,MAAA,CAAO,MAAA,CACR,GAAA,CAAI,OAAA,CAAQ,QAAA,GACZ,GAAA,CAAI,KAAA,CAAM,QAAA,IAAY,WAAA,CAAY,UAAA,sBALlB,GAAA,CAAI,WAAA,EAAW,QAAA,EACrB,QAAA,KAAQ,IAAA,EACT,GAAA,CAAI,YAAA,CAAa,QAAA,MACzB,MAAA,CAAO,MAAA,CACR,GAAA,CAAI,OAAA,CAAQ,QAAA,GACZ,GAAA,CAAI,KAAA,CAAM,QAAA,IAAY,WAAA,CAAY,UAAA;AAAA,KAY1B,cAAA,UAAwB,cAAA,CAAe,UAAA;AAAA,cAEtC,KAAA,GAAS,WAAA,EAAa,kBAAA,yBAAsC,OAAA,CAAA,KAAA,oBAnBrD,GAAA,CAAI,WAAA,EAAW,QAAA,EACrB,QAAA,KAAQ,IAAA,EACT,GAAA,CAAI,YAAA,CAAa,QAAA,MACzB,MAAA,CAAO,MAAA,CACR,GAAA,CAAI,OAAA,CAAQ,QAAA,GACZ,GAAA,CAAI,KAAA,CAAM,QAAA,IAAY,WAAA,CAAY,UAAA"}
@@ -1,14 +1,15 @@
1
1
  import { __exportAll } from "./_virtual/_rolldown/runtime.js";
2
- import { Context, Layer } from "effect";
3
- import * as Ref$1 from "@confect/core/Ref";
2
+ import * as Context from "effect/Context";
3
+ import * as Ref from "@confect/core/Ref";
4
4
  import "convex/server";
5
+ import * as Layer from "effect/Layer";
5
6
 
6
7
  //#region src/MutationRunner.ts
7
8
  var MutationRunner_exports = /* @__PURE__ */ __exportAll({
8
9
  MutationRunner: () => MutationRunner,
9
10
  layer: () => layer
10
11
  });
11
- const make = (runMutation) => (mutation, ...args) => Ref$1.runWithCodec(mutation, args[0] ?? {}, (functionReference, encodedArgs) => runMutation(functionReference, encodedArgs));
12
+ const make = (runMutation) => (mutation, ...args) => Ref.runWithCodec(mutation, args[0] ?? {}, (functionReference, encodedArgs) => runMutation(functionReference, encodedArgs));
12
13
  const MutationRunner = Context.GenericTag("@confect/server/MutationRunner");
13
14
  const layer = (runMutation) => Layer.succeed(MutationRunner, make(runMutation));
14
15
 
@@ -1 +1 @@
1
- {"version":3,"file":"MutationRunner.js","names":["Ref"],"sources":["../src/MutationRunner.ts"],"sourcesContent":["import * as Ref from \"@confect/core/Ref\";\nimport { type GenericMutationCtx } from \"convex/server\";\nimport type { ParseResult, Effect } from \"effect\";\nimport { Context, Layer } from \"effect\";\n\nconst make =\n (runMutation: GenericMutationCtx<any>[\"runMutation\"]) =>\n <Mutation extends Ref.AnyMutation>(\n mutation: Mutation,\n ...args: Ref.OptionalArgs<Mutation>\n ): Effect.Effect<\n Ref.Returns<Mutation>,\n Ref.Error<Mutation> | ParseResult.ParseError\n > =>\n Ref.runWithCodec(\n mutation,\n (args[0] ?? {}) as Ref.Args<Mutation>,\n (functionReference, encodedArgs) =>\n runMutation(functionReference, encodedArgs),\n );\n\nexport const MutationRunner = Context.GenericTag<ReturnType<typeof make>>(\n \"@confect/server/MutationRunner\",\n);\nexport type MutationRunner = typeof MutationRunner.Identifier;\n\nexport const layer = (runMutation: GenericMutationCtx<any>[\"runMutation\"]) =>\n Layer.succeed(MutationRunner, make(runMutation));\n"],"mappings":";;;;;;;;;;AAKA,MAAM,QACH,iBAEC,UACA,GAAG,SAKHA,MAAI,aACF,UACC,KAAK,MAAM,EAAE,GACb,mBAAmB,gBAClB,YAAY,mBAAmB,YAAY,CAC9C;AAEL,MAAa,iBAAiB,QAAQ,WACpC,iCACD;AAGD,MAAa,SAAS,gBACpB,MAAM,QAAQ,gBAAgB,KAAK,YAAY,CAAC"}
1
+ {"version":3,"file":"MutationRunner.js","names":[],"sources":["../src/MutationRunner.ts"],"sourcesContent":["import * as Ref from \"@confect/core/Ref\";\nimport { type GenericMutationCtx } from \"convex/server\";\nimport type { ParseResult, Effect } from \"effect\";\nimport * as Context from \"effect/Context\";\nimport * as Layer from \"effect/Layer\";\n\nconst make =\n (runMutation: GenericMutationCtx<any>[\"runMutation\"]) =>\n <Mutation extends Ref.AnyMutation>(\n mutation: Mutation,\n ...args: Ref.OptionalArgs<Mutation>\n ): Effect.Effect<\n Ref.Returns<Mutation>,\n Ref.Error<Mutation> | ParseResult.ParseError\n > =>\n Ref.runWithCodec(\n mutation,\n (args[0] ?? {}) as Ref.Args<Mutation>,\n (functionReference, encodedArgs) =>\n runMutation(functionReference, encodedArgs),\n );\n\nexport const MutationRunner = Context.GenericTag<ReturnType<typeof make>>(\n \"@confect/server/MutationRunner\",\n);\nexport type MutationRunner = typeof MutationRunner.Identifier;\n\nexport const layer = (runMutation: GenericMutationCtx<any>[\"runMutation\"]) =>\n Layer.succeed(MutationRunner, make(runMutation));\n"],"mappings":";;;;;;;;;;;AAMA,MAAM,QACH,iBAEC,UACA,GAAG,SAKH,IAAI,aACF,UACC,KAAK,MAAM,EAAE,GACb,mBAAmB,gBAClB,YAAY,mBAAmB,YAAY,CAC9C;AAEL,MAAa,iBAAiB,QAAQ,WACpC,iCACD;AAGD,MAAa,SAAS,gBACpB,MAAM,QAAQ,gBAAgB,KAAK,YAAY,CAAC"}
@@ -1,21 +1,23 @@
1
1
  import { DocumentDecodeError } from "./Document.js";
2
2
  import { AnyWithProps, ConvexTableInfo, TableSchema } from "./TableInfo.js";
3
- import { Effect, Option, Stream } from "effect";
4
3
  import { ExpressionOrValue, FilterBuilder, OrderedQuery as OrderedQuery$1, PaginationResult } from "convex/server";
4
+ import * as Effect$1 from "effect/Effect";
5
+ import * as Stream from "effect/Stream";
6
+ import { Option } from "effect";
5
7
 
6
8
  //#region src/OrderedQuery.d.ts
7
9
  declare namespace OrderedQuery_d_exports {
8
10
  export { OrderedQuery, make };
9
11
  }
10
12
  type OrderedQuery<TableInfo_ extends AnyWithProps, _TableName extends string> = {
11
- readonly first: () => Effect.Effect<Option.Option<TableInfo_["document"]>, DocumentDecodeError>;
12
- readonly take: (n: number) => Effect.Effect<ReadonlyArray<TableInfo_["document"]>, DocumentDecodeError>;
13
- readonly collect: () => Effect.Effect<ReadonlyArray<TableInfo_["document"]>, DocumentDecodeError>;
13
+ readonly first: () => Effect$1.Effect<Option.Option<TableInfo_["document"]>, DocumentDecodeError>;
14
+ readonly take: (n: number) => Effect$1.Effect<ReadonlyArray<TableInfo_["document"]>, DocumentDecodeError>;
15
+ readonly collect: () => Effect$1.Effect<ReadonlyArray<TableInfo_["document"]>, DocumentDecodeError>;
14
16
  readonly stream: () => Stream.Stream<TableInfo_["document"], DocumentDecodeError>;
15
17
  readonly paginate: (options: {
16
18
  cursor: string | null;
17
19
  numItems: number;
18
- }, filter?: (q: FilterBuilder<ConvexTableInfo<TableInfo_>>) => ExpressionOrValue<boolean>) => Effect.Effect<PaginationResult<TableInfo_["document"]>, DocumentDecodeError>;
20
+ }, filter?: (q: FilterBuilder<ConvexTableInfo<TableInfo_>>) => ExpressionOrValue<boolean>) => Effect$1.Effect<PaginationResult<TableInfo_["document"]>, DocumentDecodeError>;
19
21
  };
20
22
  declare const make: <TableInfo_ extends AnyWithProps, TableName extends string>(query: OrderedQuery$1<ConvexTableInfo<TableInfo_>>, tableName: TableName, tableSchema: TableSchema<TableInfo_>) => OrderedQuery<TableInfo_, TableName>;
21
23
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"OrderedQuery.d.ts","names":[],"sources":["../src/OrderedQuery.ts"],"mappings":";;;;;;;;;KAUY,YAAA,oBACS,YAAA;EAAA,SAGV,KAAA,QAAa,MAAA,CAAO,MAAA,CAC3B,MAAA,CAAO,MAAA,CAAO,UAAA,eACd,mBAAA;EAAA,SAEO,IAAA,GACP,CAAA,aACG,MAAA,CAAO,MAAA,CACV,aAAA,CAAc,UAAA,eACd,mBAAA;EAAA,SAEO,OAAA,QAAe,MAAA,CAAO,MAAA,CAC7B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