@gaganref/confect-core 10.3.1-fork.6 → 10.3.1-fork.61

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 (69) hide show
  1. package/dist/ActionCall.d.ts +18 -0
  2. package/dist/ActionCall.d.ts.map +1 -0
  3. package/dist/ActionCall.js +21 -0
  4. package/dist/ActionCall.js.map +1 -0
  5. package/dist/App.d.ts +13 -2
  6. package/dist/App.d.ts.map +1 -1
  7. package/dist/App.js +6 -3
  8. package/dist/App.js.map +1 -1
  9. package/dist/Auth.d.ts +31 -6
  10. package/dist/Auth.d.ts.map +1 -1
  11. package/dist/Auth.js +15 -1
  12. package/dist/Auth.js.map +1 -1
  13. package/dist/Callback.d.ts.map +1 -1
  14. package/dist/Callback.js +4 -3
  15. package/dist/Callback.js.map +1 -1
  16. package/dist/Component.d.ts.map +1 -1
  17. package/dist/Component.js +1 -1
  18. package/dist/Component.js.map +1 -1
  19. package/dist/FunctionSpec.d.ts +365 -2
  20. package/dist/FunctionSpec.d.ts.map +1 -1
  21. package/dist/FunctionSpec.js +66 -3
  22. package/dist/FunctionSpec.js.map +1 -1
  23. package/dist/GroupSpec.js +1 -1
  24. package/dist/Http.d.ts.map +1 -1
  25. package/dist/Http.js +2 -2
  26. package/dist/Http.js.map +1 -1
  27. package/dist/ManifestSection.d.ts +66 -0
  28. package/dist/ManifestSection.d.ts.map +1 -0
  29. package/dist/ManifestSection.js +7 -0
  30. package/dist/ManifestSection.js.map +1 -0
  31. package/dist/Profile.d.ts +95 -0
  32. package/dist/Profile.d.ts.map +1 -0
  33. package/dist/Profile.js +15 -0
  34. package/dist/Profile.js.map +1 -0
  35. package/dist/Ref.d.ts +4 -3
  36. package/dist/Ref.d.ts.map +1 -1
  37. package/dist/Ref.js +11 -17
  38. package/dist/Ref.js.map +1 -1
  39. package/dist/RefInternal.d.ts +3 -0
  40. package/dist/RefInternal.d.ts.map +1 -0
  41. package/dist/RefInternal.js +16 -0
  42. package/dist/RefInternal.js.map +1 -0
  43. package/dist/SchemaToValidator.d.ts +10 -1
  44. package/dist/SchemaToValidator.d.ts.map +1 -1
  45. package/dist/SchemaToValidator.js +19 -4
  46. package/dist/SchemaToValidator.js.map +1 -1
  47. package/dist/SystemFields.js +1 -1
  48. package/dist/index.d.ts +3 -0
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +9 -6
  51. package/dist/internal/scalarDocs.d.ts +5 -0
  52. package/dist/internal/scalarDocs.d.ts.map +1 -0
  53. package/dist/internal/scalarDocs.js +43 -0
  54. package/dist/internal/scalarDocs.js.map +1 -0
  55. package/package.json +3 -3
  56. package/src/ActionCall.ts +25 -0
  57. package/src/App.ts +19 -3
  58. package/src/Auth.ts +48 -6
  59. package/src/Callback.ts +3 -1
  60. package/src/Component.ts +2 -0
  61. package/src/FunctionSpec.ts +566 -5
  62. package/src/Http.ts +2 -5
  63. package/src/ManifestSection.ts +74 -0
  64. package/src/Profile.ts +141 -0
  65. package/src/Ref.ts +19 -26
  66. package/src/RefInternal.ts +26 -0
  67. package/src/SchemaToValidator.ts +22 -1
  68. package/src/index.ts +3 -0
  69. package/src/internal/scalarDocs.ts +72 -0
@@ -0,0 +1,74 @@
1
+ import type * as FunctionSpec from "./FunctionSpec.js";
2
+ import type * as MiddlewareSpec from "./MiddlewareSpec.js";
3
+
4
+ export interface Data<Value = unknown> {
5
+ readonly format: number;
6
+ readonly functions: Readonly<Record<string, Value>>;
7
+ }
8
+
9
+ /**
10
+ * What codegen hands a section's `render`: the exports of each `confect/` file
11
+ * it matched, every registered function with the spec file declaring it, and
12
+ * each mounted component with the specifier of its definition.
13
+ */
14
+ export interface GenerateInput {
15
+ readonly modules: ReadonlyArray<{
16
+ readonly relativePath: string;
17
+ readonly exports: Readonly<Record<string, unknown>>;
18
+ }>;
19
+ readonly functions: ReadonlyArray<{
20
+ readonly path: string;
21
+ readonly source: string;
22
+ }>;
23
+ readonly mounts: ReadonlyArray<{
24
+ readonly name: string;
25
+ readonly definition: string;
26
+ }>;
27
+ }
28
+
29
+ export interface Generate {
30
+ readonly file: string;
31
+ match(relativePath: string): boolean;
32
+ render(input: GenerateInput): {
33
+ readonly contents: string;
34
+ readonly errors: ReadonlyArray<string>;
35
+ };
36
+ }
37
+
38
+ /**
39
+ * What codegen hands a section's `summarize`: the `confect/` files its
40
+ * `generate` matched, and each function's description by path.
41
+ */
42
+ export interface SummarizeInput<Value = unknown> {
43
+ readonly modules: GenerateInput["modules"];
44
+ readonly functions: Readonly<Record<string, Value>>;
45
+ }
46
+
47
+ export interface ManifestSection<
48
+ Value = unknown,
49
+ Data_ extends { readonly format: number } = Data<Value>,
50
+ > {
51
+ readonly owner: string;
52
+ readonly format: number;
53
+ describe(input: {
54
+ readonly path: string;
55
+ readonly spec: FunctionSpec.AnyWithProps;
56
+ readonly middleware: ReadonlyArray<MiddlewareSpec.AnyMiddlewareSpec>;
57
+ }): Value;
58
+ summarize?(input: SummarizeInput<Value>): Data_;
59
+ check?(
60
+ next: Data_,
61
+ previous: unknown,
62
+ ): {
63
+ readonly errors: ReadonlyArray<string>;
64
+ readonly notes: ReadonlyArray<string>;
65
+ };
66
+ readonly generate?: Generate;
67
+ }
68
+
69
+ export type Any = ManifestSection<unknown, { readonly format: number }>;
70
+
71
+ export interface Entry {
72
+ readonly key: string;
73
+ readonly section: Any;
74
+ }
package/src/Profile.ts ADDED
@@ -0,0 +1,141 @@
1
+ import type * as Schema from "effect/Schema";
2
+ import type * as FunctionProvenance from "./FunctionProvenance.js";
3
+ import type * as MiddlewareSpec from "./MiddlewareSpec.js";
4
+
5
+ /**
6
+ * A type-level function from a function's name and args fields to the fields a
7
+ * profile's builders require. Read `this["Name"]` and `this["Args"]` directly
8
+ * in `Type`, passing them to a type alias; a nested object type cannot name
9
+ * `this`.
10
+ */
11
+ export interface Fields {
12
+ readonly Name: string;
13
+ // `unknown`, not `ArgsFields`: an index signature here would leak into
14
+ // `keyof this["Args"]`.
15
+ readonly Args: unknown;
16
+ readonly Type: object;
17
+ }
18
+
19
+ export interface NoFields extends Fields {
20
+ readonly Type: {};
21
+ }
22
+
23
+ export type Apply<
24
+ Fields_ extends Fields,
25
+ Name_ extends string,
26
+ Args_,
27
+ > = (Fields_ & { readonly Name: Name_; readonly Args: Args_ })["Type"];
28
+
29
+ /**
30
+ * A base profile's fields and its extension's, for one function.
31
+ */
32
+ export interface Both<
33
+ Base extends Fields,
34
+ Extension extends Fields,
35
+ > extends Fields {
36
+ readonly Type: Apply<Base, this["Name"], this["Args"]> &
37
+ Apply<Extension, this["Name"], this["Args"]>;
38
+ }
39
+
40
+ /**
41
+ * What a profile callback sees. `args` stays a thunk.
42
+ */
43
+ export interface Info<FieldsType> {
44
+ readonly name: string;
45
+ readonly description?: string;
46
+ readonly args: () => FunctionProvenance.ArgsFields;
47
+ readonly fields: "description" extends keyof FieldsType
48
+ ? Omit<FieldsType, "description">
49
+ : FieldsType;
50
+ }
51
+
52
+ export interface Attachment<
53
+ MiddlewareSpec_ extends MiddlewareSpec.AnyMiddlewareSpec,
54
+ FieldsType,
55
+ > {
56
+ readonly spec: MiddlewareSpec_;
57
+ readonly options: (
58
+ info: Info<FieldsType>,
59
+ ) => MiddlewareSpec.Options<MiddlewareSpec_>;
60
+ }
61
+
62
+ /**
63
+ * A middleware without options has none to compute and is attached at most
64
+ * once, so it joins a profile's list directly.
65
+ */
66
+ type TakesOptions<MiddlewareSpec_ extends MiddlewareSpec.AnyMiddlewareSpec> = [
67
+ MiddlewareSpec.WithoutOptions<MiddlewareSpec_>,
68
+ ] extends [never]
69
+ ? unknown
70
+ : MiddlewareSpec.AttachmentError<`Middleware "${MiddlewareSpec.Key<MiddlewareSpec_>}" takes no options, so list it without Profile.attach`>;
71
+
72
+ /**
73
+ * Attach a middleware that takes options to every function a profile builds,
74
+ * with options computed from each function's fields.
75
+ */
76
+ export const attach = <
77
+ MiddlewareSpec_ extends MiddlewareSpec.AnyMiddlewareSpec,
78
+ FieldsType,
79
+ >(
80
+ spec: MiddlewareSpec_ & TakesOptions<MiddlewareSpec_>,
81
+ options: (
82
+ info: Info<FieldsType>,
83
+ ) => MiddlewareSpec.Options<NoInfer<MiddlewareSpec_>>,
84
+ ): Attachment<MiddlewareSpec_, FieldsType> => ({ spec, options });
85
+
86
+ /**
87
+ * A type function for a schema wrapper, applied to each declared codec.
88
+ */
89
+ export interface SchemaTransform {
90
+ readonly Input: Schema.Codec<unknown, unknown>;
91
+ readonly Type: Schema.Codec<any, any>;
92
+ }
93
+
94
+ /**
95
+ * Args wrappers transform the declared field map, before Struct composition.
96
+ */
97
+ export interface ArgsTransform {
98
+ readonly Input: unknown;
99
+ readonly Type: FunctionProvenance.ArgsFields;
100
+ }
101
+
102
+ export interface Transforms {
103
+ readonly args?: ArgsTransform;
104
+ readonly returns?: SchemaTransform;
105
+ readonly item?: SchemaTransform;
106
+ readonly error?: SchemaTransform;
107
+ }
108
+
109
+ export type Transform<T, Input> = (T & { readonly Input: Input })["Type" &
110
+ keyof T];
111
+
112
+ /**
113
+ * Error wrappers opt into Schema.Never when no error thunk was declared.
114
+ */
115
+ export type Wrappers<T extends Transforms, FieldsType> = {
116
+ readonly [K in keyof T]-?: K extends keyof Transforms
117
+ ? <
118
+ Input extends (K extends "args"
119
+ ? FunctionProvenance.ArgsFields
120
+ : Schema.Codec<any, any>),
121
+ >(
122
+ thunk: () => Input,
123
+ info: Info<FieldsType>,
124
+ ) => () => Transform<T[K], Input>
125
+ : never;
126
+ } & { readonly [K in Exclude<keyof Transforms, keyof T>]?: never };
127
+
128
+ type NonemptyError<T extends Transforms> = T extends {
129
+ readonly error: infer E extends SchemaTransform;
130
+ }
131
+ ? [Transform<E, typeof Schema.Never>["Type"]] extends [never]
132
+ ? MiddlewareSpec.AttachmentError<"Profile error wrapper must add an error to Schema.Never">
133
+ : unknown
134
+ : unknown;
135
+
136
+ export type SchemaConfig<T extends Transforms, FieldsType> = ([
137
+ keyof T,
138
+ ] extends [never]
139
+ ? { readonly schemas?: never }
140
+ : { readonly schemas: Wrappers<T, FieldsType> }) &
141
+ NonemptyError<T>;
package/src/Ref.ts CHANGED
@@ -6,7 +6,7 @@ import type {
6
6
  PaginationOptions,
7
7
  PaginationResult,
8
8
  } from "convex/server";
9
- import { getFunctionAddress, makeFunctionReference } from "convex/server";
9
+ import { getFunctionAddress } from "convex/server";
10
10
  import type { Value } from "convex/values";
11
11
  import { ConvexError } from "convex/values";
12
12
  import * as Effect from "effect/Effect";
@@ -18,6 +18,7 @@ import type * as FunctionProvenance from "./FunctionProvenance.js";
18
18
  import type * as FunctionSpec from "./FunctionSpec.js";
19
19
  import * as Lazy from "./Lazy.js";
20
20
  import * as MiddlewareSpec from "./MiddlewareSpec.js";
21
+ import { getFunctionReference } from "./RefInternal.js";
21
22
  import type * as RuntimeAndFunctionType from "./RuntimeAndFunctionType.js";
22
23
 
23
24
  export const TypeId = "~@confect/core/Ref";
@@ -41,7 +42,9 @@ export interface Base<
41
42
  : (args: Args_) => void;
42
43
  readonly "~Returns": Returns_;
43
44
  readonly "~Error": Error_;
45
+ readonly functionType?: RuntimeAndFunctionType_["functionType"];
44
46
  readonly convexFunctionName: string;
47
+ readonly reservedArgument?: string;
45
48
  /**
46
49
  * Preserved for component references and function handles, which have no
47
50
  * local name.
@@ -447,14 +450,19 @@ export const make = <
447
450
  ({
448
451
  [TypeId]: TypeId,
449
452
  _tag: "Convex",
453
+ functionType: functionSpec.runtimeAndFunctionType.functionType,
450
454
  convexFunctionName,
451
455
  }) as Any,
452
456
  ),
453
457
  Match.tag("Confect", (provenance): Any =>
454
- fromProvenance(convexFunctionName, provenance, [
455
- ...groupMiddlewareAttachments,
456
- ...functionSpec.middlewareAttachments,
457
- ]),
458
+ fromProvenance(
459
+ convexFunctionName,
460
+ provenance,
461
+ [...groupMiddlewareAttachments, ...functionSpec.middlewareAttachments],
462
+ undefined,
463
+ functionSpec.runtimeAndFunctionType.functionType,
464
+ functionSpec.reservedArgument,
465
+ ),
458
466
  ),
459
467
  Match.exhaustive,
460
468
  ) as FromFunctionSpec<
@@ -476,11 +484,15 @@ export const fromProvenance = (
476
484
  provenance: FunctionProvenance.AnyConfect,
477
485
  middlewareAttachments: ReadonlyArray<MiddlewareAttachment.MiddlewareAttachment>,
478
486
  functionReference?: ConvexFunctionReference<any, any>,
487
+ functionType?: "query" | "mutation" | "action",
488
+ reservedArgument?: string,
479
489
  ): AnyConfect => {
480
490
  const ref = {
481
491
  [TypeId]: TypeId as TypeId,
482
492
  _tag: "Confect" as const,
493
+ ...(functionType === undefined ? {} : { functionType }),
483
494
  convexFunctionName,
495
+ ...(reservedArgument === undefined ? {} : { reservedArgument }),
484
496
  ...(functionReference === undefined ? {} : { functionReference }),
485
497
  kind: provenance.kind,
486
498
  middlewareAttachments,
@@ -501,27 +513,6 @@ export const fromProvenance = (
501
513
  export const getConvexFunctionName = (ref: Any): string =>
502
514
  ref.convexFunctionName;
503
515
 
504
- const functionReferenceCache = new Map<string, FunctionReference<Any>>();
505
-
506
- export const getFunctionReference = <Ref_ extends Any>(
507
- ref: Ref_,
508
- ): FunctionReference<Ref_> => {
509
- if (ref.functionReference !== undefined) {
510
- return ref.functionReference as FunctionReference<Ref_>;
511
- }
512
- const convexFunctionName = getConvexFunctionName(ref);
513
-
514
- const cached = functionReferenceCache.get(convexFunctionName);
515
- if (cached !== undefined) {
516
- return cached as FunctionReference<Ref_>;
517
- }
518
-
519
- const functionReference = makeFunctionReference(convexFunctionName);
520
- functionReferenceCache.set(convexFunctionName, functionReference);
521
-
522
- return functionReference as FunctionReference<Ref_>;
523
- };
524
-
525
516
  /**
526
517
  * Adapt a native reference without assigning Confect codecs or typed errors.
527
518
  */
@@ -532,6 +523,7 @@ export const fromFunctionReference = <
532
523
  Returns_,
533
524
  >(
534
525
  functionReference: ConvexFunctionReference<Type, Visibility, Args_, Returns_>,
526
+ functionType?: NoInfer<Type>,
535
527
  ): ConvexRef<
536
528
  Extract<
537
529
  RuntimeAndFunctionType.RuntimeAndFunctionType,
@@ -545,6 +537,7 @@ export const fromFunctionReference = <
545
537
  return {
546
538
  [TypeId]: TypeId,
547
539
  _tag: "Convex",
540
+ ...(functionType === undefined ? {} : { functionType }),
548
541
  convexFunctionName:
549
542
  address.name ??
550
543
  address.reference ??
@@ -0,0 +1,26 @@
1
+ import { makeFunctionReference } from "convex/server";
2
+ import type * as Ref from "./Ref.js";
3
+
4
+ const functionReferenceCache = new Map<
5
+ string,
6
+ Ref.FunctionReference<Ref.Any>
7
+ >();
8
+
9
+ export const getFunctionReference = <Ref_ extends Ref.Any>(
10
+ ref: Ref_,
11
+ ): Ref.FunctionReference<Ref_> => {
12
+ if (ref.functionReference !== undefined) {
13
+ return ref.functionReference as Ref.FunctionReference<Ref_>;
14
+ }
15
+ const convexFunctionName = ref.convexFunctionName;
16
+
17
+ const cached = functionReferenceCache.get(convexFunctionName);
18
+ if (cached !== undefined) {
19
+ return cached as Ref.FunctionReference<Ref_>;
20
+ }
21
+
22
+ const functionReference = makeFunctionReference(convexFunctionName);
23
+ functionReferenceCache.set(convexFunctionName, functionReference);
24
+
25
+ return functionReference as Ref.FunctionReference<Ref_>;
26
+ };
@@ -46,10 +46,12 @@ import type {
46
46
  export const compileArgsSchema = <ConfectValue, ConvexValue>(
47
47
  argsSchema: Schema.Codec<ConfectValue, ConvexValue>,
48
48
  scope: IdScope.IdScope = IdScope.app,
49
+ reservedArgument?: string,
50
+ functionName?: string,
49
51
  ): PropertyValidators => {
50
52
  const ast = Schema.toEncoded(argsSchema).ast;
51
53
 
52
- return pipe(
54
+ const validators = pipe(
53
55
  ast,
54
56
  Match.value,
55
57
  Match.tag("Objects", (objectsAst) =>
@@ -60,8 +62,27 @@ export const compileArgsSchema = <ConfectValue, ConvexValue>(
60
62
  Match.orElse(() => Effect.fail(new TopLevelMustBeObjectError())),
61
63
  Effect.runSync,
62
64
  );
65
+ if (reservedArgument === undefined) return validators;
66
+ if (Object.hasOwn(validators, reservedArgument)) {
67
+ throw new ReservedArgumentCollision({
68
+ functionName,
69
+ argument: reservedArgument,
70
+ });
71
+ }
72
+ return { ...validators, [reservedArgument]: v.optional(v.any()) };
63
73
  };
64
74
 
75
+ export class ReservedArgumentCollision extends Data.TaggedError(
76
+ "ReservedArgumentCollision",
77
+ )<{
78
+ readonly functionName: string | undefined;
79
+ readonly argument: string;
80
+ }> {
81
+ override get message() {
82
+ return `${this.functionName} declares the argument "${this.argument}", which its profile reserves. Rename the argument.`;
83
+ }
84
+ }
85
+
65
86
  // Returns
66
87
 
67
88
  export const compileReturnsSchema = <ConfectValue, ConvexValue>(
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * as ActionCall from "./ActionCall.js";
1
2
  export * as Callback from "./Callback.js";
2
3
  export * as FunctionProvenance from "./FunctionProvenance.js";
3
4
  export * as FunctionSpec from "./FunctionSpec.js";
@@ -13,11 +14,13 @@ export * as GroupSpec from "./GroupSpec.js";
13
14
  export * as Identifier from "./Identifier.js";
14
15
  export * as Lazy from "./Lazy.js";
15
16
  export * as Manifest from "./Manifest.js";
17
+ export * as ManifestSection from "./ManifestSection.js";
16
18
  export * as MiddlewareAttachment from "./MiddlewareAttachment.js";
17
19
  export * as MiddlewareSpec from "./MiddlewareSpec.js";
18
20
  export * as PaginationError from "./PaginationError.js";
19
21
  export * as PaginationOptions from "./PaginationOptions.js";
20
22
  export * as PaginationResult from "./PaginationResult.js";
23
+ export * as Profile from "./Profile.js";
21
24
  export * as Ref from "./Ref.js";
22
25
  export * as Refs from "./Refs.js";
23
26
  export * as RuntimeAndFunctionType from "./RuntimeAndFunctionType.js";
@@ -0,0 +1,72 @@
1
+ import * as Effect from "effect/Effect";
2
+ import * as HttpRouter from "effect/http/HttpRouter";
3
+ import * as HttpServerResponse from "effect/http/HttpServerResponse";
4
+ import type * as HttpApi from "effect/http-api/HttpApi";
5
+ import type * as HttpApiGroup from "effect/http-api/HttpApiGroup";
6
+ import * as OpenApi from "effect/http-api/OpenApi";
7
+
8
+ const escape = (value: string) =>
9
+ value
10
+ .replaceAll("&", "&amp;")
11
+ .replaceAll("<", "&lt;")
12
+ .replaceAll(">", "&gt;");
13
+
14
+ const escapeAttribute = (value: string) =>
15
+ escape(value).replaceAll('"', "&quot;").replaceAll("'", "&#39;");
16
+
17
+ const escapeJson = (value: unknown) =>
18
+ JSON.stringify(value)
19
+ .replaceAll("<", "\\u003c")
20
+ .replaceAll("\u2028", "\\u2028")
21
+ .replaceAll("\u2029", "\\u2029");
22
+
23
+ // WORKAROUND: Effect 4.0.6's HttpApiScalar module imports its inline Scalar
24
+ // script dynamically, and Convex's bundler then splits a schema that reaches it
25
+ // into an imported chunk, which Convex refuses. This copies `layerCdn`'s page
26
+ // byte for byte. Remove when `checkSchemaBundle.mjs` passes with
27
+ // `HttpApiScalar.layerCdn` restored.
28
+ export const scalarDocs = <
29
+ Id extends string,
30
+ Groups extends HttpApiGroup.Constraint,
31
+ >(
32
+ api: HttpApi.HttpApi<Id, Groups>,
33
+ path: `/${string}`,
34
+ ) =>
35
+ HttpRouter.use((router) => {
36
+ let response: HttpServerResponse.HttpServerResponse | undefined;
37
+ return router.add(
38
+ "GET",
39
+ path,
40
+ Effect.sync(() => {
41
+ if (response !== undefined) return response;
42
+ const spec = OpenApi.fromApi(api);
43
+ const description = (tag: string) =>
44
+ !spec.info.description
45
+ ? ""
46
+ : `<meta name="${tag}" content="${escapeAttribute(spec.info.description)}"/>`;
47
+ response = HttpServerResponse.html(`<!doctype html>
48
+ <html>
49
+ <head>
50
+ <meta charset="utf-8" />
51
+ <title>${escape(spec.info.title)}</title>
52
+ ${description("description")}
53
+ ${description("og:description")}
54
+ <meta
55
+ name="viewport"
56
+ content="width=device-width, initial-scale=1" />
57
+ </head>
58
+ <body>
59
+ <div id="api-reference-container"></div>
60
+ <script src="${escapeAttribute("https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/browser/standalone.min.js")}" crossorigin></script>
61
+ <script>
62
+ window.Scalar.createApiReference(document.getElementById('api-reference-container'), {
63
+ ...${escapeJson({ _integration: "html" })},
64
+ content: ${escapeJson(spec)}
65
+ })
66
+ </script>
67
+ </body>
68
+ </html>`);
69
+ return response;
70
+ }),
71
+ );
72
+ });