@gaganref/confect-cli 10.3.1-fork.96 → 10.6.0-fork.2

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 (98) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/dist/Ansi.mjs +1 -2
  3. package/dist/BuildError.mjs +5 -5
  4. package/dist/BuildError.mjs.map +1 -1
  5. package/dist/Bundler.mjs +103 -76
  6. package/dist/Bundler.mjs.map +1 -1
  7. package/dist/CodeBlockWriter.mjs +1 -2
  8. package/dist/CodegenError.mjs +27 -17
  9. package/dist/CodegenError.mjs.map +1 -1
  10. package/dist/ConfectDirectory.mjs +8 -3
  11. package/dist/ConfectDirectory.mjs.map +1 -1
  12. package/dist/ConvexConfig.mjs +23 -15
  13. package/dist/ConvexConfig.mjs.map +1 -1
  14. package/dist/ConvexDirectory.mjs +6 -4
  15. package/dist/ConvexDirectory.mjs.map +1 -1
  16. package/dist/Declaration.mjs +92 -56
  17. package/dist/Declaration.mjs.map +1 -1
  18. package/dist/DirectoryOptions.mjs +13 -8
  19. package/dist/DirectoryOptions.mjs.map +1 -1
  20. package/dist/DocName.mjs +1 -2
  21. package/dist/EntryPoint.mjs +17 -15
  22. package/dist/EntryPoint.mjs.map +1 -1
  23. package/dist/Evaluation.mjs +24 -13
  24. package/dist/Evaluation.mjs.map +1 -1
  25. package/dist/EvaluationWorker.mjs +5 -6
  26. package/dist/EvaluationWorker.mjs.map +1 -1
  27. package/dist/FunctionModule.mjs +85 -47
  28. package/dist/FunctionModule.mjs.map +1 -1
  29. package/dist/FunctionPath.mjs +1 -2
  30. package/dist/FunctionPath.mjs.map +1 -1
  31. package/dist/FunctionPaths.mjs +2 -3
  32. package/dist/GenerationSnapshot.mjs +30 -22
  33. package/dist/GenerationSnapshot.mjs.map +1 -1
  34. package/dist/GroupPath.mjs +6 -3
  35. package/dist/GroupPath.mjs.map +1 -1
  36. package/dist/GroupPaths.mjs +1 -2
  37. package/dist/ImplModulePath.mjs +1 -2
  38. package/dist/Json.mjs +13 -0
  39. package/dist/Json.mjs.map +1 -0
  40. package/dist/LeafModule.mjs +121 -41
  41. package/dist/LeafModule.mjs.map +1 -1
  42. package/dist/ManifestSections.mjs +23 -19
  43. package/dist/ManifestSections.mjs.map +1 -1
  44. package/dist/PackageSelfReference.mjs +32 -0
  45. package/dist/PackageSelfReference.mjs.map +1 -0
  46. package/dist/ProjectRoot.mjs +11 -3
  47. package/dist/ProjectRoot.mjs.map +1 -1
  48. package/dist/RelativeModulePath.mjs +1 -2
  49. package/dist/Remove.mjs +2 -3
  50. package/dist/Remove.mjs.map +1 -1
  51. package/dist/RestoreWatcher.mjs +1 -2
  52. package/dist/Rollback.mjs +7 -6
  53. package/dist/Rollback.mjs.map +1 -1
  54. package/dist/SectionFiles.mjs +77 -48
  55. package/dist/SectionFiles.mjs.map +1 -1
  56. package/dist/SnapshotError.mjs +3 -3
  57. package/dist/SnapshotError.mjs.map +1 -1
  58. package/dist/SpecAssemblyNode.mjs +1 -2
  59. package/dist/SpecModulePath.mjs +4 -4
  60. package/dist/SpecModulePath.mjs.map +1 -1
  61. package/dist/SyncState.mjs +3 -4
  62. package/dist/SyncState.mjs.map +1 -1
  63. package/dist/TableModule.mjs +18 -10
  64. package/dist/TableModule.mjs.map +1 -1
  65. package/dist/TableModulePath.mjs +3 -3
  66. package/dist/TableModulePath.mjs.map +1 -1
  67. package/dist/TypeScriptConfig.mjs +135 -0
  68. package/dist/TypeScriptConfig.mjs.map +1 -0
  69. package/dist/WatchBuild.mjs +107 -32
  70. package/dist/WatchBuild.mjs.map +1 -1
  71. package/dist/WatchGraph.mjs +4 -4
  72. package/dist/WatchGraph.mjs.map +1 -1
  73. package/dist/WatchTopology.mjs +5 -4
  74. package/dist/WatchTopology.mjs.map +1 -1
  75. package/dist/Watcher.mjs +179 -108
  76. package/dist/Watcher.mjs.map +1 -1
  77. package/dist/cliApp.mjs +5 -3
  78. package/dist/cliApp.mjs.map +1 -1
  79. package/dist/confect/codegen.mjs +95 -53
  80. package/dist/confect/codegen.mjs.map +1 -1
  81. package/dist/confect/declaration.mjs +76 -42
  82. package/dist/confect/declaration.mjs.map +1 -1
  83. package/dist/confect/dev.mjs +18 -12
  84. package/dist/confect/dev.mjs.map +1 -1
  85. package/dist/confect.mjs +4 -2
  86. package/dist/confect.mjs.map +1 -1
  87. package/dist/index.mjs +1 -2
  88. package/dist/log.mjs +13 -5
  89. package/dist/log.mjs.map +1 -1
  90. package/dist/package.json.mjs +5 -0
  91. package/dist/package.json.mjs.map +1 -0
  92. package/dist/templates.mjs +34 -22
  93. package/dist/templates.mjs.map +1 -1
  94. package/dist/utils.mjs +36 -5
  95. package/dist/utils.mjs.map +1 -1
  96. package/package.json +10 -10
  97. package/dist/package.mjs +0 -6
  98. package/dist/package.mjs.map +0 -1
package/dist/DocName.mjs CHANGED
@@ -2,7 +2,7 @@ import * as Array from "effect/Array";
2
2
  import { pipe } from "effect/Function";
3
3
  import * as String from "effect/String";
4
4
  import * as Brand from "effect/Brand";
5
- //#region src/DocName.ts
5
+ // src/DocName.ts
6
6
  const DocName = Brand.nominal();
7
7
  /**
8
8
  * Convert a Convex table name to the name of its generated document type in
@@ -19,7 +19,6 @@ const DocName = Brand.nominal();
19
19
  * verbatim table name, which is what document lookups index through.
20
20
  */
21
21
  const fromTableName = (tableName) => DocName(pipe(tableName, String.split("_"), Array.filter(String.isNonEmpty), Array.map(String.capitalize), Array.join(""), String.concat("Doc")));
22
- //#endregion
23
22
  export { fromTableName };
24
23
 
25
24
  //# sourceMappingURL=DocName.mjs.map
@@ -1,9 +1,9 @@
1
- import { ConvexDirectory } from "./ConvexDirectory.mjs";
2
- import { ConfectDirectory } from "./ConfectDirectory.mjs";
3
- import { CONVEX_CONFIG_FILENAME } from "./ConvexConfig.mjs";
4
1
  import { ImplModulePath } from "./ImplModulePath.mjs";
5
2
  import { SpecModulePath, toImpl } from "./SpecModulePath.mjs";
6
3
  import { TableModulePath } from "./TableModulePath.mjs";
4
+ import { ConfectDirectory } from "./ConfectDirectory.mjs";
5
+ import { ConvexDirectory } from "./ConvexDirectory.mjs";
6
+ import { CONVEX_CONFIG_FILENAME } from "./ConvexConfig.mjs";
7
7
  import { discoverLeafImplFiles, discoverLeafSpecFiles } from "./LeafModule.mjs";
8
8
  import { discoverTableFiles } from "./TableModule.mjs";
9
9
  import * as Effect from "effect/Effect";
@@ -16,12 +16,15 @@ import * as Chunk from "effect/Chunk";
16
16
  import * as Schema from "effect/Schema";
17
17
  import * as Predicate from "effect/Predicate";
18
18
  import * as Data from "effect/Data";
19
- //#region src/EntryPoint.ts
19
+ // src/EntryPoint.ts
20
20
  const Kind = Data.taggedEnum();
21
21
  const Declaration = Schema.TaggedUnion({
22
22
  Spec: { relativePath: SpecModulePath },
23
23
  Table: { relativePath: TableModulePath }
24
24
  });
25
+ /**
26
+ * @internal
27
+ */
25
28
  const planDeclarations = (declarations, affectedImpls, path) => {
26
29
  const plan = Array.reduce(declarations, {
27
30
  tables: Chunk.empty(),
@@ -59,6 +62,9 @@ const parse = (relativePath) => {
59
62
  if (Option.isSome(specPath)) return Option.some(Kind.Spec({ relativePath: specPath.value }));
60
63
  return Schema.decodeOption(ImplModulePath)(relativePath).pipe(Option.map((implPath) => Kind.Impl({ relativePath: implPath })));
61
64
  };
65
+ /**
66
+ * @internal
67
+ */
62
68
  const discover = Effect.gen(function* () {
63
69
  const fs = yield* FileSystem.FileSystem;
64
70
  const path = yield* Path.Path;
@@ -87,17 +93,14 @@ const discover = Effect.gen(function* () {
87
93
  discoverLeafImplFiles,
88
94
  discoverTableFiles
89
95
  ]).pipe(Effect.map(Array.flatten));
90
- const moduleEntryOptions = yield* Effect.forEach(Array.getSomes(moduleRelativePaths.map(parse)), tryEntry);
96
+ const moduleEntryOptions = yield* Effect.forEach(Array.getSomes(Array.map(moduleRelativePaths, parse)), tryEntry);
91
97
  const convexDirectory = yield* ConvexDirectory.get;
92
- const convexConfigEntryOption = yield* Effect.gen(function* () {
93
- const absolutePath = path.join(convexDirectory, CONVEX_CONFIG_FILENAME);
94
- if (Option.isSome(declaration) || !(yield* fs.exists(absolutePath))) return Option.none();
95
- return Option.some({
96
- ...Kind.Config(),
97
- absolutePath,
98
- inputPath: yield* fs.realPath(absolutePath).pipe(Effect.orElseSucceed(() => absolutePath))
99
- });
100
- });
98
+ const absolutePath = path.join(convexDirectory, CONVEX_CONFIG_FILENAME);
99
+ const convexConfigEntryOption = Option.isNone(declaration) && (yield* fs.exists(absolutePath)) ? Option.some({
100
+ ...Kind.Config(),
101
+ absolutePath,
102
+ inputPath: yield* fs.realPath(absolutePath).pipe(Effect.orElseSucceed(() => absolutePath))
103
+ }) : Option.none();
101
104
  return Array.getSomes([
102
105
  ...fixedEntryOptions,
103
106
  convexConfigEntryOption,
@@ -107,7 +110,6 @@ const discover = Effect.gen(function* () {
107
110
  times: 3,
108
111
  while: (error) => error._tag === "PlatformError" && error.reason._tag === "NotFound"
109
112
  }));
110
- //#endregion
111
113
  export { Declaration, Kind, discover, isOptional, parse, planDeclarations };
112
114
 
113
115
  //# sourceMappingURL=EntryPoint.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"EntryPoint.mjs","names":["SpecModulePath.SpecModulePath","SpecModulePath.toImpl"],"sources":["../src/EntryPoint.ts"],"sourcesContent":["import * as Array from \"effect/Array\";\nimport * as Chunk from \"effect/Chunk\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as HashSet from \"effect/HashSet\";\nimport * as Option from \"effect/Option\";\nimport * as Path from \"effect/Path\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Schema from \"effect/Schema\";\nimport { ImplModulePath } from \"./ImplModulePath.js\";\nimport * as SpecModulePath from \"./SpecModulePath.js\";\nimport { TableModulePath } from \"./TableModulePath.js\";\nimport { ConfectDirectory } from \"./ConfectDirectory.js\";\nimport { ConvexDirectory } from \"./ConvexDirectory.js\";\nimport { CONVEX_CONFIG_FILENAME } from \"./ConvexConfig.js\";\nimport { discoverLeafImplFiles, discoverLeafSpecFiles } from \"./LeafModule.js\";\nimport { discoverTableFiles, type TableModule } from \"./TableModule.js\";\n\nexport type Kind = Data.TaggedEnum<{\n Env: { readonly relativePath: \"env.ts\" };\n App: { readonly relativePath: \"app.ts\" };\n Runtime: { readonly relativePath: \"runtime.ts\" };\n Callbacks: { readonly relativePath: \"callbacks.ts\" };\n Spec: { readonly relativePath: SpecModulePath.SpecModulePath };\n Impl: { readonly relativePath: ImplModulePath };\n Table: { readonly relativePath: TableModulePath };\n Http: { readonly relativePath: \"http.ts\" };\n Crons: { readonly relativePath: \"crons.ts\" };\n Auth: { readonly relativePath: \"auth.ts\" };\n Config: {};\n}>;\n\nexport const Kind = Data.taggedEnum<Kind>();\nexport const Declaration = Schema.TaggedUnion({\n Spec: { relativePath: SpecModulePath.SpecModulePath },\n Table: { relativePath: TableModulePath },\n});\nexport type Declaration = typeof Declaration.Type;\n\nexport const planDeclarations = (\n declarations: Array.NonEmptyReadonlyArray<Declaration>,\n affectedImpls: ReadonlyArray<ImplModulePath>,\n path: Path.Path,\n): {\n readonly tables: ReadonlyArray<TableModule>;\n readonly paths: ReadonlyArray<ImplModulePath>;\n} => {\n const plan = Array.reduce(\n declarations,\n {\n tables: Chunk.empty<TableModule>(),\n paths: HashSet.fromIterable(affectedImpls),\n },\n (state, declaration) =>\n Declaration.match(declaration, {\n Spec: ({ relativePath }) => ({\n ...state,\n paths: HashSet.add(state.paths, SpecModulePath.toImpl(relativePath)),\n }),\n Table: ({ relativePath }) => ({\n ...state,\n tables: Chunk.append(state.tables, {\n relativePath,\n tableName: path.parse(relativePath).name,\n }),\n }),\n }),\n );\n return {\n tables: Chunk.toReadonlyArray(plan.tables),\n paths: Array.fromIterable(plan.paths),\n };\n};\n\nexport type EntryPoint = Kind & {\n readonly absolutePath: string;\n readonly inputPath: string;\n};\nexport type OptionalFile = \"Http\" | \"Crons\" | \"Auth\";\n\nexport const isOptional = Predicate.or(\n Kind.$is(\"Http\"),\n Predicate.or(Kind.$is(\"Crons\"), Kind.$is(\"Auth\")),\n);\n\nexport const parse = (\n relativePath: string,\n): Option.Option<Exclude<Kind, { readonly _tag: \"Config\" }>> => {\n if (relativePath === \"runtime.ts\")\n return Option.some(Kind.Runtime({ relativePath }));\n if (relativePath === \"env.ts\") return Option.some(Kind.Env({ relativePath }));\n if (relativePath === \"app.ts\") return Option.some(Kind.App({ relativePath }));\n if (relativePath === \"callbacks.ts\")\n return Option.some(Kind.Callbacks({ relativePath }));\n if (relativePath === \"http.ts\")\n return Option.some(Kind.Http({ relativePath }));\n if (relativePath === \"crons.ts\")\n return Option.some(Kind.Crons({ relativePath }));\n if (relativePath === \"auth.ts\")\n return Option.some(Kind.Auth({ relativePath }));\n const tablePath = Schema.decodeOption(TableModulePath)(relativePath);\n if (Option.isSome(tablePath))\n return Option.some(Kind.Table({ relativePath: tablePath.value }));\n const specPath = Schema.decodeOption(SpecModulePath.SpecModulePath)(\n relativePath,\n );\n if (Option.isSome(specPath))\n return Option.some(Kind.Spec({ relativePath: specPath.value }));\n return Schema.decodeOption(ImplModulePath)(relativePath).pipe(\n Option.map((implPath) => Kind.Impl({ relativePath: implPath })),\n );\n};\n\nexport const discover = Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const confectDirectory = yield* ConfectDirectory.get;\n\n const tryEntry = Effect.fnUntraced(function* (\n kind: Exclude<Kind, { readonly _tag: \"Config\" }>,\n ) {\n const absolutePath = path.join(confectDirectory, kind.relativePath);\n if (!(yield* fs.exists(absolutePath))) {\n return Option.none<EntryPoint>();\n }\n return Option.some<EntryPoint>({\n ...kind,\n absolutePath,\n inputPath: yield* fs\n .realPath(absolutePath)\n .pipe(Effect.orElseSucceed(() => absolutePath)),\n });\n });\n\n const declaration = yield* tryEntry(Kind.App({ relativePath: \"app.ts\" }));\n const fixedEntryOptions = yield* Effect.all([\n tryEntry(Kind.Env({ relativePath: \"env.ts\" })),\n tryEntry(Kind.Runtime({ relativePath: \"runtime.ts\" })),\n Effect.succeed(declaration),\n (yield* ConvexDirectory.target).kind === \"component\"\n ? tryEntry(Kind.Callbacks({ relativePath: \"callbacks.ts\" }))\n : Effect.succeedNone,\n tryEntry(Kind.Http({ relativePath: \"http.ts\" })),\n tryEntry(Kind.Crons({ relativePath: \"crons.ts\" })),\n tryEntry(Kind.Auth({ relativePath: \"auth.ts\" })),\n ]);\n\n const moduleRelativePaths = yield* Effect.all([\n discoverLeafSpecFiles,\n discoverLeafImplFiles,\n discoverTableFiles,\n ]).pipe(Effect.map(Array.flatten));\n const moduleEntryOptions = yield* Effect.forEach(\n Array.getSomes(moduleRelativePaths.map(parse)),\n tryEntry,\n );\n\n // `convex/convex.config.ts` feeds the generated components registry, so\n // edits to it (or to a locally-defined component definition it imports—npm component definitions are externalized and not watched) must re-run\n // codegen.\n const convexDirectory = yield* ConvexDirectory.get;\n const convexConfigEntryOption = yield* Effect.gen(function* () {\n const absolutePath = path.join(convexDirectory, CONVEX_CONFIG_FILENAME);\n // A declared backend's `convex.config.ts` is codegen output, not input.\n if (Option.isSome(declaration) || !(yield* fs.exists(absolutePath))) {\n return Option.none<EntryPoint>();\n }\n return Option.some<EntryPoint>({\n ...Kind.Config(),\n absolutePath,\n inputPath: yield* fs\n .realPath(absolutePath)\n .pipe(Effect.orElseSucceed(() => absolutePath)),\n });\n });\n\n return Array.getSomes([\n ...fixedEntryOptions,\n convexConfigEntryOption,\n ...moduleEntryOptions,\n ]);\n}).pipe(\n Effect.retry({\n times: 3,\n while: (error) =>\n error._tag === \"PlatformError\" && error.reason._tag === \"NotFound\",\n }),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiCA,MAAa,OAAO,KAAK,WAAiB;AAC1C,MAAa,cAAc,OAAO,YAAY;CAC5C,MAAM,EAAE,cAAcA,eAA8B;CACpD,OAAO,EAAE,cAAc,gBAAgB;AACzC,CAAC;AAGD,MAAa,oBACX,cAC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AAS,KAAK,KAAK,EAAE,cAAc,UAAU,CAAC,CAAC;EAC/C,SAAS,KAAK,MAAM,EAAE,cAAc,WAAW,CAAC,CAAC;EACjD,SAAS,KAAK,KAAK,EAAE,cAAc,UAAU,CAAC,CAAC;CACjD,CAAC;CAED,MAAM,sBAAsB,OAAO,OAAO,IAAI;EAC5C;EACA;EACA;CACF,CAAC,CAAC,CAAC,KAAK,OAAO,IAAI,MAAM,OAAO,CAAC;CACjC,MAAM,qBAAqB,OAAO,OAAO,QACvC,MAAM,SAAS,oBAAoB,IAAI,KAAK,CAAC,GAC7C,QACF;CAKA,MAAM,kBAAkB,OAAO,gBAAgB;CAC/C,MAAM,0BAA0B,OAAO,OAAO,IAAI,aAAa;EAC7D,MAAM,eAAe,KAAK,KAAK,iBAAiB,sBAAsB;EAEtE,IAAI,OAAO,OAAO,WAAW,KAAK,EAAE,OAAO,GAAG,OAAO,YAAY,IAC/D,OAAO,OAAO,KAAiB;EAEjC,OAAO,OAAO,KAAiB;GAC7B,GAAG,KAAK,OAAO;GACf;GACA,WAAW,OAAO,GACf,SAAS,YAAY,CAAC,CACtB,KAAK,OAAO,oBAAoB,YAAY,CAAC;EAClD,CAAC;CACH,CAAC;CAED,OAAO,MAAM,SAAS;EACpB,GAAG;EACH;EACA,GAAG;CACL,CAAC;AACH,CAAC,CAAC,CAAC,KACD,OAAO,MAAM;CACX,OAAO;CACP,QAAQ,UACN,MAAM,SAAS,mBAAmB,MAAM,OAAO,SAAS;AAC5D,CAAC,CACH"}
1
+ {"version":3,"file":"EntryPoint.mjs","names":["SpecModulePath.SpecModulePath","SpecModulePath.toImpl"],"sources":["../src/EntryPoint.ts"],"sourcesContent":["import * as Array from \"effect/Array\";\nimport * as Chunk from \"effect/Chunk\";\nimport * as Data from \"effect/Data\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as HashSet from \"effect/HashSet\";\nimport * as Option from \"effect/Option\";\nimport * as Path from \"effect/Path\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Schema from \"effect/Schema\";\nimport { ImplModulePath } from \"./ImplModulePath.js\";\nimport * as SpecModulePath from \"./SpecModulePath.js\";\nimport { TableModulePath } from \"./TableModulePath.js\";\nimport { ConfectDirectory } from \"./ConfectDirectory.js\";\nimport { ConvexDirectory } from \"./ConvexDirectory.js\";\nimport { CONVEX_CONFIG_FILENAME } from \"./ConvexConfig.js\";\nimport { discoverLeafImplFiles, discoverLeafSpecFiles } from \"./LeafModule.js\";\nimport { discoverTableFiles, type TableModule } from \"./TableModule.js\";\n\nexport type Kind = Data.TaggedEnum<{\n Env: { readonly relativePath: \"env.ts\" };\n App: { readonly relativePath: \"app.ts\" };\n Runtime: { readonly relativePath: \"runtime.ts\" };\n Callbacks: { readonly relativePath: \"callbacks.ts\" };\n Spec: { readonly relativePath: SpecModulePath.SpecModulePath };\n Impl: { readonly relativePath: ImplModulePath };\n Table: { readonly relativePath: TableModulePath };\n Http: { readonly relativePath: \"http.ts\" };\n Crons: { readonly relativePath: \"crons.ts\" };\n Auth: { readonly relativePath: \"auth.ts\" };\n Config: {};\n}>;\n\nexport const Kind = Data.taggedEnum<Kind>();\nexport const Declaration = Schema.TaggedUnion({\n Spec: { relativePath: SpecModulePath.SpecModulePath },\n Table: { relativePath: TableModulePath },\n});\nexport type Declaration = typeof Declaration.Type;\n\n/**\n * @internal\n */\nexport const planDeclarations = (\n declarations: Array.NonEmptyReadonlyArray<Declaration>,\n affectedImpls: ReadonlyArray<ImplModulePath>,\n path: Path.Path,\n): {\n readonly tables: ReadonlyArray<TableModule>;\n readonly paths: ReadonlyArray<ImplModulePath>;\n} => {\n const plan = Array.reduce(\n declarations,\n {\n tables: Chunk.empty<TableModule>(),\n paths: HashSet.fromIterable(affectedImpls),\n },\n (state, declaration) =>\n Declaration.match(declaration, {\n Spec: ({ relativePath }) => ({\n ...state,\n paths: HashSet.add(state.paths, SpecModulePath.toImpl(relativePath)),\n }),\n Table: ({ relativePath }) => ({\n ...state,\n tables: Chunk.append(state.tables, {\n relativePath,\n tableName: path.parse(relativePath).name,\n }),\n }),\n }),\n );\n return {\n tables: Chunk.toReadonlyArray(plan.tables),\n paths: Array.fromIterable(plan.paths),\n };\n};\n\nexport type EntryPoint = Kind & {\n readonly absolutePath: string;\n readonly inputPath: string;\n};\nexport type OptionalFile = \"Http\" | \"Crons\" | \"Auth\";\n\nexport const isOptional = Predicate.or(\n Kind.$is(\"Http\"),\n Predicate.or(Kind.$is(\"Crons\"), Kind.$is(\"Auth\")),\n);\n\nexport const parse = (\n relativePath: string,\n): Option.Option<Exclude<Kind, { readonly _tag: \"Config\" }>> => {\n if (relativePath === \"runtime.ts\")\n return Option.some(Kind.Runtime({ relativePath }));\n if (relativePath === \"env.ts\") return Option.some(Kind.Env({ relativePath }));\n if (relativePath === \"app.ts\") return Option.some(Kind.App({ relativePath }));\n if (relativePath === \"callbacks.ts\")\n return Option.some(Kind.Callbacks({ relativePath }));\n if (relativePath === \"http.ts\")\n return Option.some(Kind.Http({ relativePath }));\n if (relativePath === \"crons.ts\")\n return Option.some(Kind.Crons({ relativePath }));\n if (relativePath === \"auth.ts\")\n return Option.some(Kind.Auth({ relativePath }));\n const tablePath = Schema.decodeOption(TableModulePath)(relativePath);\n if (Option.isSome(tablePath))\n return Option.some(Kind.Table({ relativePath: tablePath.value }));\n const specPath = Schema.decodeOption(SpecModulePath.SpecModulePath)(\n relativePath,\n );\n if (Option.isSome(specPath))\n return Option.some(Kind.Spec({ relativePath: specPath.value }));\n return Schema.decodeOption(ImplModulePath)(relativePath).pipe(\n Option.map((implPath) => Kind.Impl({ relativePath: implPath })),\n );\n};\n\n/**\n * @internal\n */\nexport const discover = Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const confectDirectory = yield* ConfectDirectory.get;\n\n const tryEntry = Effect.fnUntraced(function* (\n kind: Exclude<Kind, { readonly _tag: \"Config\" }>,\n ) {\n const absolutePath = path.join(confectDirectory, kind.relativePath);\n if (!(yield* fs.exists(absolutePath))) {\n return Option.none<EntryPoint>();\n }\n return Option.some<EntryPoint>({\n ...kind,\n absolutePath,\n inputPath: yield* fs\n .realPath(absolutePath)\n .pipe(Effect.orElseSucceed(() => absolutePath)),\n });\n });\n\n const declaration = yield* tryEntry(Kind.App({ relativePath: \"app.ts\" }));\n const fixedEntryOptions = yield* Effect.all([\n tryEntry(Kind.Env({ relativePath: \"env.ts\" })),\n tryEntry(Kind.Runtime({ relativePath: \"runtime.ts\" })),\n Effect.succeed(declaration),\n (yield* ConvexDirectory.target).kind === \"component\"\n ? tryEntry(Kind.Callbacks({ relativePath: \"callbacks.ts\" }))\n : Effect.succeedNone,\n tryEntry(Kind.Http({ relativePath: \"http.ts\" })),\n tryEntry(Kind.Crons({ relativePath: \"crons.ts\" })),\n tryEntry(Kind.Auth({ relativePath: \"auth.ts\" })),\n ]);\n\n const moduleRelativePaths = yield* Effect.all([\n discoverLeafSpecFiles,\n discoverLeafImplFiles,\n discoverTableFiles,\n ]).pipe(Effect.map(Array.flatten));\n const moduleEntryOptions = yield* Effect.forEach(\n Array.getSomes(Array.map(moduleRelativePaths, parse)),\n tryEntry,\n );\n\n // `convex/convex.config.ts` feeds the generated components registry, so\n // edits to it (or to a locally-defined component definition it imports—npm component definitions are externalized and not watched) must re-run\n // codegen.\n const convexDirectory = yield* ConvexDirectory.get;\n const absolutePath = path.join(convexDirectory, CONVEX_CONFIG_FILENAME);\n // A declared backend's `convex.config.ts` is codegen output, not input.\n const convexConfigEntryOption =\n Option.isNone(declaration) && (yield* fs.exists(absolutePath))\n ? Option.some<EntryPoint>({\n ...Kind.Config(),\n absolutePath,\n inputPath: yield* fs\n .realPath(absolutePath)\n .pipe(Effect.orElseSucceed(() => absolutePath)),\n })\n : Option.none<EntryPoint>();\n\n return Array.getSomes([\n ...fixedEntryOptions,\n convexConfigEntryOption,\n ...moduleEntryOptions,\n ]);\n}).pipe(\n Effect.retry({\n times: 3,\n while: (error) =>\n error._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C1C,SAAS,KAAK,IAAI,EAAE,cAAc,SAAS,CAAC,CAAC;EAC7C,SAAS,KAAK,QAAQ,EAAE,cAAc,aAAa,CAAC,CAAC;EACrD,OAAO,QAAQ,WAAW;GACzB,OAAO,gBAAgB,OAAA,CAAQ,SAAS,cACrC,SAAS,KAAK,UAAU,EAAE,cAAc,eAAe,CAAC,CAAC,IACzD,OAAO;EACX,SAAS,KAAK,KAAK,EAAE,cAAc,UAAU,CAAC,CAAC;EAC/C,SAAS,KAAK,MAAM,EAAE,cAAc,WAAW,CAAC,CAAC;EACjD,SAAS,KAAK,KAAK,EAAE,cAAc,UAAU,CAAC,CAAC;CACjD,CAAC;CAED,MAAM,sBAAsB,OAAO,OAAO,IAAI;EAC5C;EACA;EACA;CACF,CAAC,CAAC,CAAC,KAAK,OAAO,IAAI,MAAM,OAAO,CAAC;CACjC,MAAM,qBAAqB,OAAO,OAAO,QACvC,MAAM,SAAS,MAAM,IAAI,qBAAqB,KAAK,CAAC,GACpD,QACF;CAKA,MAAM,kBAAkB,OAAO,gBAAgB;CAC/C,MAAM,eAAe,KAAK,KAAK,iBAAiB,sBAAsB;CAEtE,MAAM,0BACJ,OAAO,OAAO,WAAW,MAAM,OAAO,GAAG,OAAO,YAAY,KACxD,OAAO,KAAiB;EACtB,GAAG,KAAK,OAAO;EACf;EACA,WAAW,OAAO,GACf,SAAS,YAAY,CAAC,CACtB,KAAK,OAAO,oBAAoB,YAAY,CAAC;CAClD,CAAC,IACD,OAAO,KAAiB;CAE9B,OAAO,MAAM,SAAS;EACpB,GAAG;EACH;EACA,GAAG;CACL,CAAC;AACH,CAAC,CAAC,CAAC,KACD,OAAO,MAAM;CACX,OAAO;CACP,QAAQ,UACN,MAAM,SAAS,mBAAmB,MAAM,OAAO,SAAS;AAC5D,CAAC,CACH"}
@@ -1,19 +1,21 @@
1
- import { ProjectRoot } from "./ProjectRoot.mjs";
2
1
  import { ComponentNodeGroupError, logCodegenError } from "./CodegenError.mjs";
3
- import { ConvexDirectory } from "./ConvexDirectory.mjs";
2
+ import { Declaration } from "./EntryPoint.mjs";
3
+ import { GenerationSnapshot, functionPaths } from "./GenerationSnapshot.mjs";
4
4
  import { ConfectDirectory } from "./ConfectDirectory.mjs";
5
+ import { ConvexDirectory } from "./ConvexDirectory.mjs";
5
6
  import { FunctionPaths } from "./FunctionPaths.mjs";
6
7
  import { ImplModulePath } from "./ImplModulePath.mjs";
7
- import { GenerationSnapshot, functionPaths } from "./GenerationSnapshot.mjs";
8
- import { Declaration } from "./EntryPoint.mjs";
8
+ import { ProjectRoot } from "./ProjectRoot.mjs";
9
9
  import * as Effect from "effect/Effect";
10
10
  import * as FileSystem from "effect/FileSystem";
11
11
  import * as Path from "effect/Path";
12
+ import { pipe } from "effect/Function";
12
13
  import * as HashSet from "effect/HashSet";
13
14
  import * as Match from "effect/Match";
14
15
  import * as Option from "effect/Option";
15
16
  import * as Context from "effect/Context";
16
17
  import * as Schema from "effect/Schema";
18
+ import * as String from "effect/String";
17
19
  import * as Console from "effect/Console";
18
20
  import * as Layer from "effect/Layer";
19
21
  import * as NodeWorker from "@effect/platform-node/NodeWorker";
@@ -24,7 +26,7 @@ import * as References from "effect/References";
24
26
  import * as Rpc from "effect/rpc/Rpc";
25
27
  import * as RpcClient from "effect/rpc/RpcClient";
26
28
  import * as RpcGroup from "effect/rpc/RpcGroup";
27
- //#region src/Evaluation.ts
29
+ // src/Evaluation.ts
28
30
  const RequestContext = Schema.Struct({
29
31
  projectRoot: Schema.String,
30
32
  confectDirectory: Schema.String,
@@ -37,6 +39,9 @@ const RequestContext = Schema.Struct({
37
39
  });
38
40
  var EvaluationError = class extends Schema.TaggedError()("EvaluationError", { diagnostic: Schema.String }) {};
39
41
  const Failure = Schema.Union([EvaluationError, ComponentNodeGroupError]);
42
+ /**
43
+ * @internal
44
+ */
40
45
  const requests = RpcGroup.make(Rpc.make("Ready", { success: Schema.Void }), Rpc.make("Previous", {
41
46
  payload: RequestContext,
42
47
  success: FunctionPaths,
@@ -86,13 +91,17 @@ const prewarmedLayer = Layer.effect(Standby, Pool.make({
86
91
  size: 1
87
92
  }));
88
93
  const withWorker = Effect.fn("Evaluation.withWorker")(function* (run) {
94
+ const projectRoot = yield* ProjectRoot.get;
95
+ const confectDirectory = yield* ConfectDirectory.get;
96
+ const convexDirectory = yield* ConvexDirectory.get;
97
+ const target = yield* ConvexDirectory.target;
89
98
  const requestContext = {
90
- projectRoot: yield* ProjectRoot.get,
91
- confectDirectory: yield* ConfectDirectory.get,
92
- convexDirectory: yield* ConvexDirectory.get,
93
- target: Match.value(yield* ConvexDirectory.target).pipe(Match.when({ kind: "app" }, () => ({ kind: "app" })), Match.when({ kind: "component" }, ({ scope }) => ({
99
+ projectRoot,
100
+ confectDirectory,
101
+ convexDirectory,
102
+ target: Match.value(target).pipe(Match.when({ kind: "app" }, () => ({ kind: "app" })), Match.when({ kind: "component" }, ({ scope }) => ({
94
103
  kind: "component",
95
- definition: scope.slice(10)
104
+ definition: pipe(scope, String.slice(10))
96
105
  })), Match.exhaustive),
97
106
  minimumLogLevel: yield* References.MinimumLogLevel
98
107
  };
@@ -110,10 +119,13 @@ const withWorker = Effect.fn("Evaluation.withWorker")(function* (run) {
110
119
  })
111
120
  })).client, requestContext);
112
121
  })).pipe(Effect.catchTags({
113
- WorkerError: (error) => Effect.fail(new EvaluationError({ diagnostic: error.message })),
114
- RpcClientError: (error) => Effect.fail(new EvaluationError({ diagnostic: error.message }))
122
+ WorkerError: (error) => Effect.fail(EvaluationError.make({ diagnostic: error.message })),
123
+ RpcClientError: (error) => Effect.fail(EvaluationError.make({ diagnostic: error.message }))
115
124
  }));
116
125
  });
126
+ /**
127
+ * @internal
128
+ */
117
129
  const loadPreviousFunctionPaths = Effect.gen(function* () {
118
130
  const fs = yield* FileSystem.FileSystem;
119
131
  const path = yield* Path.Path;
@@ -137,7 +149,6 @@ const catchAndLog = (effect) => effect.pipe(Effect.asSome, Effect.catchTags({
137
149
  EvaluationError: ({ diagnostic }) => Console.error(diagnostic).pipe(Effect.as(Option.none())),
138
150
  ComponentNodeGroupError: (error) => logCodegenError(error).pipe(Effect.as(Option.none()))
139
151
  }));
140
- //#endregion
141
152
  export { EvaluationError, RequestContext, catchAndLog, generateSnapshot, loadPreviousFunctionPaths, prewarmedLayer, requests, updateDeclarations, validate };
142
153
 
143
154
  //# sourceMappingURL=Evaluation.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Evaluation.mjs","names":["GenerationSnapshot.GenerationSnapshot","EntryPoint.Declaration","GenerationSnapshot.functionPaths"],"sources":["../src/Evaluation.ts"],"sourcesContent":["import * as NodeWorker from \"@effect/platform-node/NodeWorker\";\nimport { fork } from \"node:child_process\";\nimport * as Console from \"effect/Console\";\nimport * as Context from \"effect/Context\";\nimport * as Pool from \"effect/Pool\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as HashSet from \"effect/HashSet\";\nimport * as Layer from \"effect/Layer\";\nimport * as LogLevel from \"effect/LogLevel\";\nimport * as Option from \"effect/Option\";\nimport * as Path from \"effect/Path\";\nimport * as Schema from \"effect/Schema\";\nimport * as References from \"effect/References\";\nimport * as Rpc from \"effect/rpc/Rpc\";\nimport * as RpcClient from \"effect/rpc/RpcClient\";\nimport type { RpcClientError } from \"effect/rpc/RpcClientError\";\nimport * as RpcGroup from \"effect/rpc/RpcGroup\";\nimport type * as Array from \"effect/Array\";\nimport * as Match from \"effect/Match\";\nimport { ComponentNodeGroupError, logCodegenError } from \"./CodegenError.js\";\nimport * as EntryPoint from \"./EntryPoint.js\";\nimport * as GenerationSnapshot from \"./GenerationSnapshot.js\";\nimport { ConfectDirectory } from \"./ConfectDirectory.js\";\nimport { ConvexDirectory } from \"./ConvexDirectory.js\";\nimport { FunctionPaths } from \"./FunctionPaths.js\";\nimport { ImplModulePath } from \"./ImplModulePath.js\";\nimport { ProjectRoot } from \"./ProjectRoot.js\";\n\nexport const RequestContext = Schema.Struct({\n projectRoot: Schema.String,\n confectDirectory: Schema.String,\n convexDirectory: Schema.String,\n target: Schema.Union([\n Schema.Struct({ kind: Schema.Literal(\"app\") }),\n Schema.Struct({\n kind: Schema.Literal(\"component\"),\n definition: Schema.String,\n }),\n ]),\n minimumLogLevel: Schema.Literals(LogLevel.values),\n});\nexport type RequestContext = typeof RequestContext.Type;\n\nexport class EvaluationError extends Schema.TaggedError<EvaluationError>()(\n \"EvaluationError\",\n { diagnostic: Schema.String },\n) {}\n\n// A rejected Node group stays typed so the caller can restore component output.\nconst Failure = Schema.Union([EvaluationError, ComponentNodeGroupError]);\n\nexport const requests = RpcGroup.make(\n Rpc.make(\"Ready\", { success: Schema.Void }),\n Rpc.make(\"Previous\", {\n payload: RequestContext,\n success: FunctionPaths,\n error: Failure,\n }),\n Rpc.make(\"Generate\", {\n payload: RequestContext,\n success: GenerationSnapshot.GenerationSnapshot,\n error: Failure,\n }),\n Rpc.make(\"Validate\", {\n payload: Schema.Struct({\n ...RequestContext.fields,\n paths: Schema.Array(ImplModulePath),\n }),\n success: Schema.Void,\n error: Failure,\n }),\n Rpc.make(\"Update\", {\n payload: Schema.Struct({\n ...RequestContext.fields,\n snapshot: GenerationSnapshot.GenerationSnapshot,\n declarations: Schema.NonEmptyArray(EntryPoint.Declaration),\n paths: Schema.Array(ImplModulePath),\n }),\n success: GenerationSnapshot.GenerationSnapshot,\n error: Failure,\n }),\n);\n\nconst acquireWorker = Effect.gen(function* () {\n const child = yield* Effect.acquireRelease(\n Effect.sync(() =>\n fork(new URL(\"../dist/EvaluationWorker.mjs\", import.meta.url), {\n serialization: \"advanced\",\n }),\n ),\n (evaluator) =>\n Effect.callback<void>((resume) => {\n if (evaluator.exitCode !== null || evaluator.signalCode !== null) {\n resume(Effect.void);\n return;\n }\n evaluator.once(\"exit\", () => resume(Effect.void));\n evaluator.kill(\"SIGKILL\");\n }),\n );\n const protocol = yield* Layer.build(\n RpcClient.layerProtocolWorker({ size: 1 }).pipe(\n Layer.provide(NodeWorker.layer(() => child)),\n ),\n );\n const client = yield* RpcClient.make(requests).pipe(\n Effect.provideContext(protocol),\n );\n yield* client.Ready();\n yield* Effect.logDebug(\"Evaluator ready\").pipe(\n Effect.annotateLogs({ pid: child.pid }),\n );\n return { child, client };\n});\n\nclass Standby extends Context.Service<\n Standby,\n Pool.Pool<\n Effect.Success<typeof acquireWorker>,\n Effect.Error<typeof acquireWorker>\n >\n>()(\"@confect/cli/Evaluation/Standby\") {}\n\n// Each evaluator handles one evaluation to isolate globals and module caches.\n// Discarding it bounds memory and recovers from crashes. Dev prepares the next\n// evaluator between saves.\nexport const prewarmedLayer = Layer.effect(\n Standby,\n Pool.make({ acquire: acquireWorker, size: 1 }),\n);\n\nconst withWorker = Effect.fn(\"Evaluation.withWorker\")(function* <A>(\n run: (\n client: RpcClient.RpcClient<RpcGroup.Rpcs<typeof requests>, RpcClientError>,\n requestContext: RequestContext,\n ) => Effect.Effect<\n A,\n EvaluationError | ComponentNodeGroupError | RpcClientError\n >,\n) {\n const requestContext = {\n projectRoot: yield* ProjectRoot.get,\n confectDirectory: yield* ConfectDirectory.get,\n convexDirectory: yield* ConvexDirectory.get,\n target: Match.value(yield* ConvexDirectory.target).pipe(\n Match.when({ kind: \"app\" }, () => ({ kind: \"app\" as const })),\n Match.when({ kind: \"component\" }, ({ scope }) => ({\n kind: \"component\" as const,\n definition: scope.slice(\"component:\".length),\n })),\n Match.exhaustive,\n ),\n minimumLogLevel: yield* References.MinimumLogLevel,\n };\n return yield* Effect.scoped(\n Effect.gen(function* () {\n const standby = yield* Effect.serviceOption(Standby);\n const worker = yield* Option.match(standby, {\n onNone: () => acquireWorker,\n onSome: (pool) =>\n Effect.gen(function* () {\n while (true) {\n const candidate = yield* Pool.get(pool);\n yield* Effect.addFinalizer(() =>\n Pool.invalidate(pool, candidate),\n );\n // An idle exit has no pending RPC to fail.\n if (\n candidate.child.connected &&\n candidate.child.exitCode === null &&\n candidate.child.signalCode === null\n )\n return candidate;\n yield* Pool.invalidate(pool, candidate);\n }\n }),\n });\n return yield* run(worker.client, requestContext);\n }),\n ).pipe(\n Effect.catchTags({\n WorkerError: (error) =>\n Effect.fail(new EvaluationError({ diagnostic: error.message })),\n RpcClientError: (error) =>\n Effect.fail(new EvaluationError({ diagnostic: error.message })),\n }),\n );\n});\n\nexport const loadPreviousFunctionPaths = Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const confectDirectory = yield* ConfectDirectory.get;\n if (\n !(yield* fs.exists(path.join(confectDirectory, \"_generated\", \"spec.ts\")))\n ) {\n return FunctionPaths.make(HashSet.empty());\n }\n return yield* withWorker((client, requestContext) =>\n client.Previous(requestContext),\n );\n});\n\nexport const generateSnapshot = withWorker((client, requestContext) =>\n client.Generate(requestContext),\n);\n\nexport const generate = generateSnapshot.pipe(\n Effect.map(GenerationSnapshot.functionPaths),\n);\n\nexport const updateDeclarations = (\n snapshot: GenerationSnapshot.GenerationSnapshot,\n declarations: Array.NonEmptyReadonlyArray<EntryPoint.Declaration>,\n paths: ReadonlyArray<ImplModulePath>,\n) =>\n withWorker((client, requestContext) =>\n client.Update({\n ...requestContext,\n snapshot,\n declarations,\n paths,\n }),\n );\n\nexport const validate = (paths: ReadonlyArray<ImplModulePath>) =>\n withWorker((client, requestContext) =>\n client.Validate({ ...requestContext, paths }),\n );\n\nexport const catchAndLog = <A, R>(\n effect: Effect.Effect<A, EvaluationError | ComponentNodeGroupError, R>,\n): Effect.Effect<Option.Option<A>, never, R> =>\n effect.pipe(\n Effect.asSome,\n Effect.catchTags({\n EvaluationError: ({ diagnostic }) =>\n Console.error(diagnostic).pipe(Effect.as(Option.none<A>())),\n ComponentNodeGroupError: (error) =>\n logCodegenError(error).pipe(Effect.as(Option.none<A>())),\n }),\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,iBAAiB,OAAO,OAAO;CAC1C,aAAa,OAAO;CACpB,kBAAkB,OAAO;CACzB,iBAAiB,OAAO;CACxB,QAA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ACL,OAAO,QACP,OAAO,UAAU;CACf,kBAAkB,EAAE,iBAClB,QAAQ,MAAM,UAAU,CAAC,CAAC,KAAK,OAAO,GAAG,OAAO,KAAQ,CAAC,CAAC;CAC5D,0BAA0B,UACxB,gBAAgB,KAAK,CAAC,CAAC,KAAK,OAAO,GAAG,OAAO,KAAQ,CAAC,CAAC;AAC3D,CAAC,CACH"}
1
+ {"version":3,"file":"Evaluation.mjs","names":["GenerationSnapshot.GenerationSnapshot","EntryPoint.Declaration","GenerationSnapshot.functionPaths"],"sources":["../src/Evaluation.ts"],"sourcesContent":["import * as NodeWorker from \"@effect/platform-node/NodeWorker\";\n// oxlint-disable-next-line effecttsgo/node-builtin-import -- Process isolation and advanced IPC require native fork; Effect's process handle cannot back NodeWorker.\nimport { fork } from \"node:child_process\";\nimport * as Console from \"effect/Console\";\nimport * as Context from \"effect/Context\";\nimport * as Pool from \"effect/Pool\";\nimport * as Effect from \"effect/Effect\";\nimport * as FileSystem from \"effect/FileSystem\";\nimport * as HashSet from \"effect/HashSet\";\nimport * as Layer from \"effect/Layer\";\nimport * as LogLevel from \"effect/LogLevel\";\nimport * as Option from \"effect/Option\";\nimport * as Path from \"effect/Path\";\nimport * as Schema from \"effect/Schema\";\nimport * as References from \"effect/References\";\nimport * as Rpc from \"effect/rpc/Rpc\";\nimport * as RpcClient from \"effect/rpc/RpcClient\";\nimport type { RpcClientError } from \"effect/rpc/RpcClientError\";\nimport * as RpcGroup from \"effect/rpc/RpcGroup\";\nimport type * as Array from \"effect/Array\";\nimport * as Match from \"effect/Match\";\nimport { ComponentNodeGroupError, logCodegenError } from \"./CodegenError.js\";\nimport * as EntryPoint from \"./EntryPoint.js\";\nimport * as GenerationSnapshot from \"./GenerationSnapshot.js\";\nimport { ConfectDirectory } from \"./ConfectDirectory.js\";\nimport { ConvexDirectory } from \"./ConvexDirectory.js\";\nimport { FunctionPaths } from \"./FunctionPaths.js\";\nimport { ImplModulePath } from \"./ImplModulePath.js\";\nimport { ProjectRoot } from \"./ProjectRoot.js\";\nimport * as String from \"effect/String\";\nimport { pipe } from \"effect/Function\";\n\nexport const RequestContext = Schema.Struct({\n projectRoot: Schema.String,\n confectDirectory: Schema.String,\n convexDirectory: Schema.String,\n target: Schema.Union([\n Schema.Struct({ kind: Schema.Literal(\"app\") }),\n Schema.Struct({\n kind: Schema.Literal(\"component\"),\n definition: Schema.String,\n }),\n ]),\n minimumLogLevel: Schema.Literals(LogLevel.values),\n});\nexport type RequestContext = typeof RequestContext.Type;\n\nexport class EvaluationError extends Schema.TaggedError<\n EvaluationError,\n { readonly brand: unique symbol }\n>()(\"EvaluationError\", { diagnostic: Schema.String }) {}\n\n// A rejected Node group stays typed so the caller can restore component output.\nconst Failure = Schema.Union([EvaluationError, ComponentNodeGroupError]);\n\n/**\n * @internal\n */\nexport const requests = RpcGroup.make(\n Rpc.make(\"Ready\", { success: Schema.Void }),\n Rpc.make(\"Previous\", {\n payload: RequestContext,\n success: FunctionPaths,\n error: Failure,\n }),\n Rpc.make(\"Generate\", {\n payload: RequestContext,\n success: GenerationSnapshot.GenerationSnapshot,\n error: Failure,\n }),\n Rpc.make(\"Validate\", {\n payload: Schema.Struct({\n ...RequestContext.fields,\n paths: Schema.Array(ImplModulePath),\n }),\n success: Schema.Void,\n error: Failure,\n }),\n Rpc.make(\"Update\", {\n payload: Schema.Struct({\n ...RequestContext.fields,\n snapshot: GenerationSnapshot.GenerationSnapshot,\n declarations: Schema.NonEmptyArray(EntryPoint.Declaration),\n paths: Schema.Array(ImplModulePath),\n }),\n success: GenerationSnapshot.GenerationSnapshot,\n error: Failure,\n }),\n);\n\nconst acquireWorker = Effect.gen(function* () {\n const child = yield* Effect.acquireRelease(\n Effect.sync(() =>\n fork(new URL(\"../dist/EvaluationWorker.mjs\", import.meta.url), {\n serialization: \"advanced\",\n }),\n ),\n (evaluator) =>\n Effect.callback<void>((resume) => {\n if (evaluator.exitCode !== null || evaluator.signalCode !== null) {\n resume(Effect.void);\n return;\n }\n evaluator.once(\"exit\", () => resume(Effect.void));\n evaluator.kill(\"SIGKILL\");\n }),\n );\n const protocol = yield* Layer.build(\n RpcClient.layerProtocolWorker({ size: 1 }).pipe(\n Layer.provide(NodeWorker.layer(() => child)),\n ),\n );\n const client = yield* RpcClient.make(requests).pipe(\n Effect.provideContext(protocol),\n );\n yield* client.Ready();\n yield* Effect.logDebug(\"Evaluator ready\").pipe(\n Effect.annotateLogs({ pid: child.pid }),\n );\n return { child, client };\n});\n\nclass Standby extends Context.Service<\n Standby,\n Pool.Pool<\n Effect.Success<typeof acquireWorker>,\n Effect.Error<typeof acquireWorker>\n >\n>()(\"@confect/cli/Evaluation/Standby\") {}\n\n// Each evaluator handles one evaluation to isolate globals and module caches.\n// Discarding it bounds memory and recovers from crashes. Dev prepares the next\n// evaluator between saves.\nexport const prewarmedLayer = Layer.effect(\n Standby,\n Pool.make({ acquire: acquireWorker, size: 1 }),\n);\n\nconst withWorker = Effect.fn(\"Evaluation.withWorker\")(function* <A>(\n run: (\n client: RpcClient.RpcClient<RpcGroup.Rpcs<typeof requests>, RpcClientError>,\n requestContext: RequestContext,\n ) => Effect.Effect<\n A,\n EvaluationError | ComponentNodeGroupError | RpcClientError\n >,\n) {\n const projectRoot = yield* ProjectRoot.get;\n const confectDirectory = yield* ConfectDirectory.get;\n const convexDirectory = yield* ConvexDirectory.get;\n const target = yield* ConvexDirectory.target;\n const requestContext = {\n projectRoot,\n confectDirectory,\n convexDirectory,\n target: Match.value(target).pipe(\n Match.when({ kind: \"app\" }, () => ({ kind: \"app\" as const })),\n Match.when({ kind: \"component\" }, ({ scope }) => ({\n kind: \"component\" as const,\n definition: pipe(scope, String.slice(\"component:\".length)),\n })),\n Match.exhaustive,\n ),\n minimumLogLevel: yield* References.MinimumLogLevel,\n };\n return yield* Effect.scoped(\n Effect.gen(function* () {\n const standby = yield* Effect.serviceOption(Standby);\n const worker = yield* Option.match(standby, {\n onNone: () => acquireWorker,\n onSome: (pool) =>\n Effect.gen(function* () {\n while (true) {\n const candidate = yield* Pool.get(pool);\n yield* Effect.addFinalizer(() =>\n Pool.invalidate(pool, candidate),\n );\n // An idle exit has no pending RPC to fail.\n if (\n candidate.child.connected &&\n candidate.child.exitCode === null &&\n candidate.child.signalCode === null\n )\n return candidate;\n yield* Pool.invalidate(pool, candidate);\n }\n }),\n });\n return yield* run(worker.client, requestContext);\n }),\n ).pipe(\n Effect.catchTags({\n WorkerError: (error) =>\n Effect.fail(EvaluationError.make({ diagnostic: error.message })),\n RpcClientError: (error) =>\n Effect.fail(EvaluationError.make({ diagnostic: error.message })),\n }),\n );\n});\n\n/**\n * @internal\n */\nexport const loadPreviousFunctionPaths = Effect.gen(function* () {\n const fs = yield* FileSystem.FileSystem;\n const path = yield* Path.Path;\n const confectDirectory = yield* ConfectDirectory.get;\n if (\n !(yield* fs.exists(path.join(confectDirectory, \"_generated\", \"spec.ts\")))\n ) {\n return FunctionPaths.make(HashSet.empty());\n }\n return yield* withWorker((client, requestContext) =>\n client.Previous(requestContext),\n );\n});\n\nexport const generateSnapshot = withWorker((client, requestContext) =>\n client.Generate(requestContext),\n);\n\nexport const generate = generateSnapshot.pipe(\n Effect.map(GenerationSnapshot.functionPaths),\n);\n\nexport const updateDeclarations = (\n snapshot: GenerationSnapshot.GenerationSnapshot,\n declarations: Array.NonEmptyReadonlyArray<EntryPoint.Declaration>,\n paths: ReadonlyArray<ImplModulePath>,\n) =>\n withWorker((client, requestContext) =>\n client.Update({\n ...requestContext,\n snapshot,\n declarations,\n paths,\n }),\n );\n\nexport const validate = (paths: ReadonlyArray<ImplModulePath>) =>\n withWorker((client, requestContext) =>\n client.Validate({ ...requestContext, paths }),\n );\n\nexport const catchAndLog = <A, R>(\n effect: Effect.Effect<A, EvaluationError | ComponentNodeGroupError, R>,\n): Effect.Effect<Option.Option<A>, never, R> =>\n effect.pipe(\n Effect.asSome,\n Effect.catchTags({\n EvaluationError: ({ diagnostic }) =>\n Console.error(diagnostic).pipe(Effect.as(Option.none<A>())),\n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cAAc,CAChC;AAEwB,iBAAiB,KACvC,OAAO,IAAIE,aAAgC,CAC7C;AAEA,MAAa,sBACX,UACA,cACA,UAEA,YAAY,QAAQ,mBAClB,OAAO,OAAO;CACZ,GAAG;CACH;CACA;CACA;AACF,CAAC,CACH;AAEF,MAAa,YAAY,UACvB,YAAY,QAAQ,mBAClB,OAAO,SAAS;CAAE,GAAG;CAAgB;AAAM,CAAC,CAC9C;AAEF,MAAa,eACX,WAEA,OAAO,KACL,OAAO,QACP,OAAO,UAAU;CACf,kBAAkB,EAAE,iBAClB,QAAQ,MAAM,UAAU,CAAC,CAAC,KAAK,OAAO,GAAG,OAAO,KAAQ,CAAC,CAAC;CAC5D,0BAA0B,UACxB,gBAAgB,KAAK,CAAC,CAAC,KAAK,OAAO,GAAG,OAAO,KAAQ,CAAC,CAAC;AAC3D,CAAC,CACH"}
@@ -1,10 +1,10 @@
1
- import { ProjectRoot } from "./ProjectRoot.mjs";
2
1
  import { ComponentNodeGroupError, isCodegenError, renderCodegenError } from "./CodegenError.mjs";
3
- import { ConvexDirectory } from "./ConvexDirectory.mjs";
4
2
  import { ConfectDirectory } from "./ConfectDirectory.mjs";
3
+ import { ConvexDirectory } from "./ConvexDirectory.mjs";
4
+ import { EvaluationError, requests } from "./Evaluation.mjs";
5
5
  import { validateImplFiles } from "./LeafModule.mjs";
6
+ import { ProjectRoot } from "./ProjectRoot.mjs";
6
7
  import { generateWithSnapshot, loadPreviousFunctionPaths, updateDeclarations } from "./confect/codegen.mjs";
7
- import { EvaluationError, requests } from "./Evaluation.mjs";
8
8
  import * as NodeServices from "@effect/platform-node/NodeServices";
9
9
  import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
10
10
  import * as Effect from "effect/Effect";
@@ -19,7 +19,7 @@ import * as Schedule from "effect/Schedule";
19
19
  import * as References from "effect/References";
20
20
  import * as NodeWorkerRunner from "@effect/platform-node/NodeWorkerRunner";
21
21
  import * as RpcServer from "effect/rpc/RpcServer";
22
- //#region src/EvaluationWorker.ts
22
+ // src/EvaluationWorker.ts
23
23
  const evaluate = (requestContext, effect) => effect.pipe(Effect.provideService(References.MinimumLogLevel, requestContext.minimumLogLevel), Effect.provideService(ProjectRoot, { get: Effect.succeed(requestContext.projectRoot) }), Effect.provideService(ConfectDirectory, { get: Effect.succeed(requestContext.confectDirectory) }), Effect.provideService(ConvexDirectory, {
24
24
  get: Effect.succeed(requestContext.convexDirectory),
25
25
  target: Match.value(requestContext.target).pipe(Match.when({ kind: "app" }, () => ({
@@ -32,7 +32,7 @@ const evaluate = (requestContext, effect) => effect.pipe(Effect.provideService(R
32
32
  }), Effect.catchCause((cause) => {
33
33
  const failure = Cause.findErrorOption(cause);
34
34
  if (Option.isSome(failure) && Schema.is(ComponentNodeGroupError)(failure.value)) return Effect.fail(failure.value);
35
- return Effect.fail(new EvaluationError({ diagnostic: Option.isSome(failure) && isCodegenError(failure.value) ? renderCodegenError(failure.value) : Cause.pretty(cause) }));
35
+ return Effect.fail(EvaluationError.make({ diagnostic: Option.isSome(failure) && isCodegenError(failure.value) ? renderCodegenError(failure.value) : Cause.pretty(cause) }));
36
36
  }));
37
37
  const handlers = requests.toLayer({
38
38
  Ready: () => Effect.void,
@@ -52,7 +52,6 @@ const watchParent = Effect.sync(() => {
52
52
  }
53
53
  }).pipe(Effect.repeat({ schedule: Schedule.spaced("1 second") }));
54
54
  RpcServer.layer(requests).pipe(Layer.provide(handlers), Layer.provide(NodeServices.layer), Layer.provide(RpcServer.layerProtocolWorkerRunner.pipe(Layer.provide(NodeWorkerRunner.layer))), Layer.launch, Effect.raceFirst(watchParent), Effect.ensuring(Effect.promise(() => esbuild.stop())), NodeRuntime.runMain);
55
- //#endregion
56
55
  export {};
57
56
 
58
57
  //# sourceMappingURL=EvaluationWorker.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"EvaluationWorker.mjs","names":["CodegenError.ComponentNodeGroupError","CodegenError.isCodegenError","CodegenError.renderCodegenError"],"sources":["../src/EvaluationWorker.ts"],"sourcesContent":["import * as NodeRuntime from \"@effect/platform-node/NodeRuntime\";\nimport * as NodeServices from \"@effect/platform-node/NodeServices\";\nimport * as NodeWorkerRunner from \"@effect/platform-node/NodeWorkerRunner\";\nimport * as IdScope from \"@confect/core/IdScope\";\nimport * as Cause from \"effect/Cause\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Match from \"effect/Match\";\nimport * as Option from \"effect/Option\";\nimport * as References from \"effect/References\";\nimport * as Schema from \"effect/Schema\";\nimport * as Schedule from \"effect/Schedule\";\nimport * as RpcServer from \"effect/rpc/RpcServer\";\nimport * as esbuild from \"esbuild\";\nimport * as CodegenError from \"./CodegenError.js\";\nimport { ConfectDirectory } from \"./ConfectDirectory.js\";\nimport { ConvexDirectory } from \"./ConvexDirectory.js\";\nimport type { RequestContext } from \"./Evaluation.js\";\nimport { EvaluationError, requests } from \"./Evaluation.js\";\nimport { validateImplFiles } from \"./LeafModule.js\";\nimport { ProjectRoot } from \"./ProjectRoot.js\";\nimport {\n generateWithSnapshot,\n loadPreviousFunctionPaths,\n updateDeclarations,\n} from \"./confect/codegen.js\";\n\nconst evaluate = <A, E, R>(\n requestContext: RequestContext,\n effect: Effect.Effect<A, E, R>,\n) =>\n effect.pipe(\n Effect.provideService(\n References.MinimumLogLevel,\n requestContext.minimumLogLevel,\n ),\n Effect.provideService(ProjectRoot, {\n get: Effect.succeed(requestContext.projectRoot),\n }),\n Effect.provideService(ConfectDirectory, {\n get: Effect.succeed(requestContext.confectDirectory),\n }),\n Effect.provideService(ConvexDirectory, {\n get: Effect.succeed(requestContext.convexDirectory),\n target: Match.value(requestContext.target).pipe(\n Match.when({ kind: \"app\" }, () => ({\n kind: \"app\" as const,\n scope: IdScope.app,\n })),\n Match.when({ kind: \"component\" }, ({ definition }) => ({\n kind: \"component\" as const,\n scope: IdScope.component(definition),\n })),\n Match.exhaustive,\n ),\n }),\n Effect.catchCause(\n (\n cause,\n ): Effect.Effect<\n never,\n EvaluationError | CodegenError.ComponentNodeGroupError\n > => {\n const failure = Cause.findErrorOption(cause);\n if (\n Option.isSome(failure) &&\n Schema.is(CodegenError.ComponentNodeGroupError)(failure.value)\n )\n return Effect.fail(failure.value);\n return Effect.fail(\n new EvaluationError({\n diagnostic:\n Option.isSome(failure) &&\n CodegenError.isCodegenError(failure.value)\n ? CodegenError.renderCodegenError(failure.value)\n : Cause.pretty(cause),\n }),\n );\n },\n ),\n );\n\nconst handlers = requests.toLayer({\n Ready: () => Effect.void,\n Previous: (requestContext) =>\n evaluate(requestContext, loadPreviousFunctionPaths),\n Generate: (requestContext) =>\n evaluate(\n requestContext,\n generateWithSnapshot.pipe(Effect.map(({ snapshot }) => snapshot)),\n ),\n Validate: (request) => evaluate(request, validateImplFiles(request.paths)),\n Update: (request) =>\n evaluate(\n request,\n updateDeclarations(request.snapshot, request.declarations, request.paths),\n ),\n});\n\n// Evaluators must not outlive the CLI, even when it is killed without cleanup.\nconst parentPid = process.ppid;\nprocess.once(\"disconnect\", () => process.exit(0));\nconst watchParent = Effect.sync(() => {\n if (!process.connected || process.ppid !== parentPid) process.exit(0);\n try {\n process.kill(parentPid, 0);\n } catch {\n process.exit(0);\n }\n}).pipe(Effect.repeat({ schedule: Schedule.spaced(\"1 second\") }));\n\nRpcServer.layer(requests).pipe(\n Layer.provide(handlers),\n Layer.provide(NodeServices.layer),\n Layer.provide(\n RpcServer.layerProtocolWorkerRunner.pipe(\n Layer.provide(NodeWorkerRunner.layer),\n ),\n ),\n Layer.launch,\n Effect.raceFirst(watchParent),\n Effect.ensuring(Effect.promise(() => esbuild.stop())),\n NodeRuntime.runMain,\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,YACJ,gBACA,WAEA,OAAO,KACL,OAAO,eACL,WAAW,iBACX,eAAe,eACjB,GACA,OAAO,eAAe,aAAa,EACjC,KAAK,OAAO,QAAQ,eAAe,WAAW,EAChD,CAAC,GACD,OAAO,eAAe,kBAAkB,EACtC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AQ,KAAK,CAAC;CACpE,IAAI;EACF,QAAQ,KAAK,WAAW,CAAC;CAC3B,QAAQ;EACN,QAAQ,KAAK,CAAC;CAChB;AACF,CAAC,CAAC,CAAC,KAAK,OAAO,OAAO,EAAE,UAAU,SAAS,OAAO,UAAU,EAAE,CAAC,CAAC;AAEhE,UAAU,MAAM,QAAQ,CAAC,CAAC,KACxB,MAAM,QAAQ,QAAQ,GACtB,MAAM,QAAQ,aAAa,KAAK,GAChC,MAAM,QACJ,UAAU,0BAA0B,KAClC,MAAM,QAAQ,iBAAiB,KAAK,CACtC,CACF,GACA,MAAM,QACN,OAAO,UAAU,WAAW,GAC5B,OAAO,SAAS,OAAO,cAAc,QAAQ,KAAK,CAAC,CAAC,GACpD,YAAY,OACd"}
1
+ {"version":3,"file":"EvaluationWorker.mjs","names":["CodegenError.ComponentNodeGroupError","CodegenError.isCodegenError","CodegenError.renderCodegenError"],"sources":["../src/EvaluationWorker.ts"],"sourcesContent":["import * as NodeRuntime from \"@effect/platform-node/NodeRuntime\";\nimport * as NodeServices from \"@effect/platform-node/NodeServices\";\nimport * as NodeWorkerRunner from \"@effect/platform-node/NodeWorkerRunner\";\nimport * as IdScope from \"@confect/core/IdScope\";\nimport * as Cause from \"effect/Cause\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport * as Match from \"effect/Match\";\nimport * as Option from \"effect/Option\";\nimport * as References from \"effect/References\";\nimport * as Schema from \"effect/Schema\";\nimport * as Schedule from \"effect/Schedule\";\nimport * as RpcServer from \"effect/rpc/RpcServer\";\nimport * as esbuild from \"esbuild\";\nimport * as CodegenError from \"./CodegenError.js\";\nimport { ConfectDirectory } from \"./ConfectDirectory.js\";\nimport { ConvexDirectory } from \"./ConvexDirectory.js\";\nimport type { RequestContext } from \"./Evaluation.js\";\nimport { EvaluationError, requests } from \"./Evaluation.js\";\nimport { validateImplFiles } from \"./LeafModule.js\";\nimport { ProjectRoot } from \"./ProjectRoot.js\";\nimport {\n generateWithSnapshot,\n loadPreviousFunctionPaths,\n updateDeclarations,\n} from \"./confect/codegen.js\";\n\nconst evaluate = <A, E, R>(\n requestContext: RequestContext,\n effect: Effect.Effect<A, E, R>,\n) =>\n effect.pipe(\n Effect.provideService(\n References.MinimumLogLevel,\n requestContext.minimumLogLevel,\n ),\n Effect.provideService(ProjectRoot, {\n get: Effect.succeed(requestContext.projectRoot),\n }),\n Effect.provideService(ConfectDirectory, {\n get: Effect.succeed(requestContext.confectDirectory),\n }),\n Effect.provideService(ConvexDirectory, {\n get: Effect.succeed(requestContext.convexDirectory),\n target: Match.value(requestContext.target).pipe(\n Match.when({ kind: \"app\" }, () => ({\n kind: \"app\" as const,\n scope: IdScope.app,\n })),\n Match.when({ kind: \"component\" }, ({ definition }) => ({\n kind: \"component\" as const,\n scope: IdScope.component(definition),\n })),\n Match.exhaustive,\n ),\n }),\n Effect.catchCause(\n (\n cause,\n ): Effect.Effect<\n never,\n EvaluationError | CodegenError.ComponentNodeGroupError\n > => {\n const failure = Cause.findErrorOption(cause);\n if (\n Option.isSome(failure) &&\n Schema.is(CodegenError.ComponentNodeGroupError)(failure.value)\n )\n return Effect.fail(failure.value);\n return Effect.fail(\n EvaluationError.make({\n diagnostic:\n Option.isSome(failure) &&\n CodegenError.isCodegenError(failure.value)\n ? CodegenError.renderCodegenError(failure.value)\n : Cause.pretty(cause),\n }),\n );\n },\n ),\n );\n\nconst handlers = requests.toLayer({\n Ready: () => Effect.void,\n Previous: (requestContext) =>\n evaluate(requestContext, loadPreviousFunctionPaths),\n Generate: (requestContext) =>\n evaluate(\n requestContext,\n generateWithSnapshot.pipe(Effect.map(({ snapshot }) => snapshot)),\n ),\n Validate: (request) => evaluate(request, validateImplFiles(request.paths)),\n Update: (request) =>\n evaluate(\n request,\n updateDeclarations(request.snapshot, request.declarations, request.paths),\n ),\n});\n\n// Evaluators must not outlive the CLI, even when it is killed without cleanup.\nconst parentPid = process.ppid;\nprocess.once(\"disconnect\", () => process.exit(0));\nconst watchParent = Effect.sync(() => {\n if (!process.connected || process.ppid !== parentPid) process.exit(0);\n try {\n process.kill(parentPid, 0);\n } catch {\n process.exit(0);\n }\n}).pipe(Effect.repeat({ schedule: Schedule.spaced(\"1 second\") }));\n\nRpcServer.layer(requests).pipe(\n Layer.provide(handlers),\n Layer.provide(NodeServices.layer),\n Layer.provide(\n RpcServer.layerProtocolWorkerRunner.pipe(\n Layer.provide(NodeWorkerRunner.layer),\n ),\n ),\n Layer.launch,\n Effect.raceFirst(watchParent),\n Effect.ensuring(Effect.promise(() => esbuild.stop())),\n NodeRuntime.runMain,\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,YACJ,gBACA,WAEA,OAAO,KACL,OAAO,eACL,WAAW,iBACX,eAAe,eACjB,GACA,OAAO,eAAe,aAAa,EACjC,KAAK,OAAO,QAAQ,eAAe,WAAW,EAChD,CAAC,GACD,OAAO,eAAe,kBAAkB,EACtC,KAAK,OAAO,QAAQ,eAAe,gBAAgB,EACrD,CAAC,GACD,OAAO,eAAe,iBAAiB;CACrC,KAAK,OAAO,QAAQ,eAAe,eAAe;CAClD,QAAQ,MAAM,MAAM,eAAe,MAAM,CAAC,CAAC,KACzC,MAAM,KAAK,EAAE,MAAM,MAAM,UAAU;EACjC,MAAM;EACN,OAAO,QAAQ;CACjB,EAAE,GACF,MAAM,KAAK,EAAE,MAAM,YAAY,IAAI,EAAE,kBAAkB;EACrD,MAAM;EACN,OAAO,QAAQ,UAAU,UAAU;CACrC,EAAE,GACF,MAAM,UACR;AACF,CAAC,GACD,OAAO,YAEH,UAIG;CACH,MAAM,UAAU,MAAM,gBAAgB,KAAK;CAC3C,IACE,OAAO,OAAO,OAAO,KACrB,OAAO,GAAGA,uBAAoC,CAAC,CAAC,QAAQ,KAAK,GAE7D,OAAO,OAAO,KAAK,QAAQ,KAAK;CAClC,OAAO,OAAO,KACZ,gBAAgB,KAAK,EACnB,YACE,OAAO,OAAO,OAAO,KACrBC,eAA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