@gaganref/confect-core 10.3.1-fork.83 → 10.3.1-fork.85

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.
@@ -188,6 +188,14 @@ export interface DescriptorOptions {
188
188
  */
189
189
  readonly contract?: Component<Spec.AnyWithProps, IdScope.IdScope, string>;
190
190
  readonly env?: Readonly<Record<string, Schema.Top>>;
191
+ /**
192
+ * The package specifier of the test kit whose `register(t, name)` installs
193
+ * this component and its children under `TestConfect`, such as
194
+ * `"@acme/email/testing"`. Codegen imports it for each mount of the
195
+ * descriptor from another package in place of `<package>/testing` or
196
+ * `<package>/test`. A local component's mount ignores it.
197
+ */
198
+ readonly testing?: string;
191
199
  /**
192
200
  * Builds the component's client from its native mount, then the mount's
193
201
  * `options` when the client takes any.
@@ -1 +1 @@
1
- {"version":3,"file":"Component.d.ts","sourceRoot":"","sources":["../src/Component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAQ5E,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,KAAK,YAAY,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,KAAK,SAAS,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AAGxC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,KAAK,sBAAsB,MAAM,6BAA6B,CAAC;AAC3E,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,MAAM,YAAY,CAAC;;;;AAE1C,qBAAa,wBAAyB,SAAQ,8BAE5C;IACA,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC,OAAO,CAAC;CAC3C,C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IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC;AAEtC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,IAAI,GACf,KAAK,CAAC,IAAI,SAAS,MAAM,EACzB,KAAK,CAAC,OAAO,SAAS,iBAAiB,QAEjC,IAAI,WACD,OAAO,KACf,UAAU,CAAC,IAAI,EAAE,OAAO,CAA2B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Component.js","names":["Spec.groups","Ref.make","IdScope.instance","IdScope.app","rebase","GenericId.rebase","Ref.isRef","Ref.fromProvenance","GenericId.GenericId"],"sources":["../src/Component.ts"],"sourcesContent":["import type { DefaultFunctionArgs, FunctionReference } from \"convex/server\";\nimport { getFunctionAddress } from \"convex/server\";\nimport * as Array from \"effect/Array\";\nimport * as Data from \"effect/Data\";\nimport * as Result from \"effect/Result\";\nimport { memoize, pipe } from \"effect/Function\";\nimport * as Match from \"effect/Match\";\nimport * as Record from \"effect/Record\";\nimport * as Schema from \"effect/Schema\";\nimport type * as FunctionProvenance from \"./FunctionProvenance.js\";\nimport type * as FunctionSpec from \"./FunctionSpec.js\";\nimport * as GenericId from \"./GenericId.js\";\nimport type * as GroupSpec from \"./GroupSpec.js\";\nimport * as IdScope from \"./IdScope.js\";\nimport * as Lazy from \"./Lazy.js\";\nimport type * as MiddlewareSpec from \"./MiddlewareSpec.js\";\nimport * as Ref from \"./Ref.js\";\nimport type * as Refs from \"./Refs.js\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType.js\";\nimport * as Spec from \"./Spec.js\";\nimport type * as Table_ from \"./Table.js\";\n\nexport class EmptyComponentScopeError extends Data.TaggedError(\n \"EmptyComponentScopeError\",\n)<{\n readonly definitionScope: IdScope.IdScope;\n}> {\n override get message(): string {\n return \"A component contract requires a nonempty definition scope.\";\n }\n}\n\nexport class ComponentNameCollisionError extends Data.TaggedError(\n \"ComponentNameCollisionError\",\n)<{\n readonly groupPath: string;\n readonly functionName: string;\n}> {\n override get message(): string {\n return `Group and function at same level have same name ('${this.groupPath}:${this.functionName}')`;\n }\n}\n\nexport class UninstalledComponentReferenceError extends Data.TaggedError(\n \"UninstalledComponentReferenceError\",\n)<{\n readonly definitionScope: IdScope.IdScope;\n}> {\n override get message(): string {\n return \"Component.bind expects an installed component from the generated components registry.\";\n }\n}\n\nconst validateNames = (\n groups: Readonly<Record<string, GroupSpec.AnyWithProps>>,\n prefix = \"\",\n): Result.Result<void, ComponentNameCollisionError> => {\n for (const [name, group] of Record.toEntries(groups)) {\n const path = prefix === \"\" ? name : `${prefix}/${name}`;\n for (const functionSpec of Record.values(group.functions)) {\n if (Record.has(group.groups, functionSpec.name)) {\n return Result.fail(\n new ComponentNameCollisionError({\n groupPath: path,\n functionName: functionSpec.name,\n }),\n );\n }\n }\n const nested = validateNames(group.groups, path);\n if (Result.isFailure(nested)) return nested;\n }\n return Result.succeed(undefined);\n};\n\nconst validateContract = (\n scope: IdScope.IdScope,\n groups: Readonly<Record<string, GroupSpec.AnyWithProps>>,\n): Result.Result<\n void,\n EmptyComponentScopeError | ComponentNameCollisionError\n> =>\n scope === \"\"\n ? Result.fail(new EmptyComponentScopeError({ definitionScope: scope }))\n : validateNames(groups);\n\nconst TypeId = \"~@confect/core/Component\";\nconst BoundTypeId = \"~@confect/core/BoundComponent\";\n\n/**\n * Convex's generated ComponentApi erases database ID brands at the boundary.\n */\ntype Wire<A> = A extends { readonly __tableName: string }\n ? string\n : A extends\n | string\n | number\n | bigint\n | boolean\n | null\n | undefined\n | ArrayBuffer\n ? A\n : { [K in keyof A]: Wire<A[K]> };\n\ntype OmitEmpty<A> = {\n [K in keyof A as keyof A[K] extends never ? never : K]: A[K];\n};\ntype ApiGroups<\n GroupSpec_ extends GroupSpec.AnyWithProps,\n Name extends string | undefined,\n> = OmitEmpty<{\n [GroupName in GroupSpec.Name<GroupSpec_>]: ApiGroup<\n GroupSpec.WithName<GroupSpec_, GroupName>,\n Name\n >;\n}>;\ntype ApiGroup<\n GroupSpec_ extends GroupSpec.AnyWithProps,\n Name extends string | undefined,\n> = ApiGroups<GroupSpec.Groups<GroupSpec_>, Name> & {\n [\n FunctionSpec_ in GroupSpec.Functions<GroupSpec_> as FunctionSpec.GetFunctionVisibility<FunctionSpec_> extends \"public\"\n ? FunctionSpec.Name<FunctionSpec_>\n : never\n ]: FunctionReference<\n RuntimeAndFunctionType.GetFunctionType<\n FunctionSpec_[\"runtimeAndFunctionType\"]\n >,\n \"internal\",\n Extract<Wire<FunctionSpec.EncodedArgs<FunctionSpec_>>, DefaultFunctionArgs>,\n Wire<FunctionSpec.EncodedReturns<FunctionSpec_>>,\n Name\n >;\n};\n\nexport type Api<\n Spec_ extends Spec.AnyWithProps,\n Name extends string | undefined = string | undefined,\n> = ApiGroups<Spec.Groups<Spec_>, Name>;\n\ninterface Tree {\n readonly [key: string]: Tree | Ref.Any;\n}\n\n/**\n * Each grouped table's name, mapped to its id field and that id's table.\n */\nexport interface GroupMap {\n readonly [table: string]: { readonly key: string; readonly table: string };\n}\n\nexport interface Component<\n Spec_ extends Spec.AnyWithProps,\n Scope extends IdScope.IdScope,\n Tables extends string = string,\n Groups_ extends GroupMap = GroupMap,\n> {\n readonly [TypeId]: {\n readonly refs: Tree;\n readonly scope: Scope;\n readonly tables: ReadonlyArray<Tables>;\n readonly groups: Groups_;\n };\n readonly \"~Spec\": Spec_;\n}\n\n/**\n * A component's tables as `contract` takes them: a table, or the name of a\n * system table.\n */\nexport type TableEntry = string | Table_.AnyWithProps;\n\ntype EntryName<Entry extends TableEntry> = Entry extends string\n ? Entry\n : Entry extends Table_.AnyWithProps\n ? Table_.Name<Entry>\n : never;\n\ntype Many<A, All = A> = string extends A\n ? true\n : number extends A\n ? true\n : A extends unknown\n ? [All] extends [A]\n ? never\n : true\n : never;\n\ntype Loose<Entries extends ReadonlyArray<TableEntry>> = true extends\n | Many<Entries>\n | Many<Entries[\"length\"]>\n | { [Index in keyof Entries]: Many<Entries[Index]> }[number]\n ? \"pass one table or one name per entry; a union may be absent at runtime\"\n : never;\n\ntype StrayGroup<\n Entries extends ReadonlyArray<TableEntry>,\n Scope extends IdScope.IdScope,\n> = [Loose<Entries>] extends [never]\n ? {\n [Index in keyof Entries]: Entries[Index] extends {\n readonly tableName: infer Name extends string;\n readonly group: Table_.Group<infer Key, infer Target, infer GroupScope>;\n }\n ? [Target, GroupScope] extends [EntryName<Entries[number]>, Scope]\n ? never\n : `${Name}.${Key} is not an id of a table of this component`\n : never;\n }[number]\n : Loose<Entries>;\n\n/**\n * The group map `contract` publishes for these table entries.\n */\nexport type Groups<Entries extends ReadonlyArray<TableEntry>> = {\n readonly [\n Entry in Extract<\n Entries[number],\n { readonly tableName: string; readonly group: Table_.Group }\n > as Entry[\"tableName\"]\n ]: {\n readonly key: Entry[\"group\"][\"key\"];\n readonly table: Entry[\"group\"][\"table\"];\n };\n};\n\n/**\n * `unknown` when every entry is one table or name and every group's id names a\n * table of this component in its scope, otherwise an object type naming the\n * refused entry.\n */\nexport type CheckGroups<\n Entries extends ReadonlyArray<TableEntry>,\n Scope extends IdScope.IdScope,\n> = [StrayGroup<Entries, Scope>] extends [never]\n ? unknown\n : { readonly \"~StrayGroup\": StrayGroup<Entries, Scope> };\n\n/**\n * An opaque identity: its string representation is not part of the API.\n */\nexport type MountScope<\n Parent extends IdScope.IdScope,\n Name extends string | undefined,\n> = IdScope.Mount<Parent, Name>;\n\ntype MountName<ComponentApi> =\n ComponentApi extends FunctionReference<any, any, any, any, infer Name>\n ? Name\n : ComponentApi extends object\n ? {\n [Key in keyof ComponentApi]: MountName<ComponentApi[Key]>;\n }[keyof ComponentApi]\n : never;\n\ntype BindRefs<\n RefTree,\n From extends IdScope.IdScope,\n To extends IdScope.IdScope,\n> = RefTree extends Ref.Any\n ? RefTree extends { readonly _tag: \"Convex\" }\n ? Ref.ConvexRef<\n Ref.GetRuntimeAndFunctionType<RefTree>,\n \"internal\",\n Extract<Wire<Ref.Args<RefTree>>, DefaultFunctionArgs>,\n Wire<Ref.Returns<RefTree>>\n >\n : Extract<\n Ref.Ref<\n Ref.GetRuntimeAndFunctionType<RefTree>,\n \"internal\",\n Extract<\n GenericId.Rebase<Ref.Args<RefTree>, From, To>,\n DefaultFunctionArgs\n >,\n GenericId.Rebase<Ref.Returns<RefTree>, From, To>,\n GenericId.Rebase<Ref.Error<RefTree>, From, To>\n >,\n { readonly _tag: RefTree[\"_tag\"] }\n >\n : { [Key in keyof RefTree]: BindRefs<RefTree[Key], From, To> };\n\nexport type Bound<\n Spec_ extends Spec.AnyWithProps,\n From extends IdScope.IdScope,\n To extends IdScope.IdScope,\n Tables extends string,\n> = BindRefs<Refs.Refs<Spec_, Ref.AnyPublic>, From, To> & {\n readonly [BoundTypeId]: {\n readonly from: From;\n readonly scope: To;\n readonly tables: ReadonlyArray<Tables>;\n };\n};\n\n/**\n * Build a publishable contract containing only exported functions and codecs.\n * `tables` lists the component's tables, each a table or a system table's name.\n * A table grouped by an id must group by an id of one of these tables.\n */\nexport function contract<\n Spec_ extends Spec.AnyWithProps,\n const Scope extends IdScope.IdScope,\n const Entries extends ReadonlyArray<TableEntry>,\n>(\n spec: Spec_,\n scope: Scope,\n tables: Entries & CheckGroups<Entries, Scope>,\n): Component<Spec_, Scope, EntryName<Entries[number]>, Groups<Entries>>;\n/**\n * Table names alone, as in an explicit third type argument, carry no groups.\n */\nexport function contract<\n Spec_ extends Spec.AnyWithProps,\n const Scope extends IdScope.IdScope,\n const Tables extends string,\n>(\n spec: Spec_,\n scope: Scope,\n tables: ReadonlyArray<Tables>,\n): Component<Spec_, Scope, Tables, {}>;\nexport function contract(\n spec: Spec.AnyWithProps,\n scope: IdScope.IdScope,\n tables: ReadonlyArray<TableEntry>,\n): Component<Spec.AnyWithProps, IdScope.IdScope> {\n const specGroups = Spec.groups(spec);\n Result.getOrThrow(validateContract(scope, specGroups));\n const collect = (\n groups: Readonly<Record<string, GroupSpec.AnyWithProps>>,\n prefix = \"\",\n ): Tree =>\n pipe(\n groups,\n Record.map((group, name) => {\n const path = prefix === \"\" ? name : `${prefix}/${name}`;\n const functions = pipe(\n group.functions,\n Record.filter((functionSpec) => {\n return Match.value(functionSpec.functionVisibility).pipe(\n Match.when(\"public\", () => true),\n Match.when(\"internal\", () => false),\n Match.exhaustive,\n );\n }),\n Record.map((functionSpec) =>\n Ref.make(path, functionSpec, group.middlewareAttachments),\n ),\n );\n return { ...collect(group.groups, path), ...functions };\n }),\n Record.filter((children) => !Record.isEmptyRecord(children)),\n );\n const grouped: GroupMap = pipe(\n tables,\n Array.flatMap((entry) =>\n typeof entry !== \"string\" && entry.group !== undefined\n ? [[entry.tableName, entry.group] as const]\n : [],\n ),\n Record.fromEntries,\n );\n const published: Component<\n Spec.AnyWithProps,\n IdScope.IdScope\n >[typeof TypeId] = {\n refs: collect(specGroups),\n scope,\n tables: Array.map(tables, (entry) =>\n typeof entry === \"string\" ? entry : entry.tableName,\n ),\n groups: grouped,\n };\n return { [TypeId]: published } as Component<\n Spec.AnyWithProps,\n IdScope.IdScope\n >;\n}\n\n/**\n * Each grouped table's id field and the table that id names.\n */\nexport const groups = <Groups_ extends GroupMap>(\n component: Component<Spec.AnyWithProps, IdScope.IdScope, string, Groups_>,\n): Groups_ =>\n Record.map(component[TypeId].groups, ({ key, table }) => ({\n key,\n table,\n })) as Groups_;\n\n/**\n * Bind the published contract to an actual installed component reference.\n */\nexport const bind = <\n Spec_ extends Spec.AnyWithProps,\n From extends IdScope.IdScope,\n Tables extends string,\n Native extends Api<NoInfer<Spec_>>,\n const Parent extends IdScope.IdScope = IdScope.App,\n>(\n component: Component<Spec_, From, Tables>,\n native: Native,\n options?: { readonly parentScope: Parent },\n): Bound<\n Spec_,\n From,\n MountScope<Parent, Extract<MountName<Native>, string | undefined>>,\n Tables\n> => {\n const published = component[TypeId];\n const address = getFunctionAddress(native);\n const installedReference = Result.getOrThrow(\n Result.fromNullishOr(\n address.reference,\n () =>\n new UninstalledComponentReferenceError({\n definitionScope: published.scope,\n }),\n ),\n );\n // Preserve the opaque address as an identity only. Calls retain the native\n // references; no component address is constructed or parsed for routing.\n const scope = IdScope.instance(\n options?.parentScope ?? IdScope.app,\n installedReference,\n );\n const rebase = (schema: Schema.ConstraintCodec<any, any, never, never>) =>\n GenericId.rebase(schema, published.scope, scope);\n const rebaseMiddleware = memoize(\n (middleware: MiddlewareSpec.AnyMiddlewareSpec) => {\n if (!(\"error\" in middleware)) return middleware;\n const boundMiddleware = Object.create(\n middleware,\n ) as MiddlewareSpec.AnyMiddlewareSpec;\n Lazy.defineProperty(boundMiddleware, \"error\", () => {\n const error = middleware.error;\n return error === undefined ? undefined : rebase(error);\n });\n return boundMiddleware;\n },\n );\n const visit = (tree: Tree, references: unknown): Tree =>\n Record.map(tree, (child, key) => {\n const reference = (references as Record<string, unknown>)[key];\n if (Ref.isRef(child)) {\n const nativeRef = reference as FunctionReference<any, any>;\n return Match.value(child).pipe(\n Match.tag(\"Convex\", (ref) => ({\n ...ref,\n functionReference: nativeRef,\n })),\n Match.tag(\"Confect\", (ref) => {\n const provenance = {\n _tag: \"Confect\" as const,\n kind: Match.value(ref.kind).pipe(\n Match.tag(\"Standard\", (kind) => kind),\n Match.tag(\"Paginated\", (kind) => {\n const boundKind = { _tag: \"Paginated\" as const };\n Lazy.defineProperty(boundKind, \"userArgs\", () =>\n Schema.Struct(Record.map(kind.userArgs.fields, rebase)),\n );\n Lazy.defineProperty(boundKind, \"item\", () =>\n rebase(kind.item),\n );\n Lazy.defineProperty(boundKind, \"page\", () =>\n rebase(kind.page),\n );\n return boundKind as FunctionProvenance.Paginated;\n }),\n Match.exhaustive,\n ),\n };\n Lazy.defineProperty(provenance, \"args\", () =>\n Schema.Struct(Record.map(ref.args.fields, rebase)),\n );\n Lazy.defineProperty(provenance, \"returns\", () =>\n rebase(ref.returns),\n );\n if (\"error\" in ref) {\n Lazy.defineProperty(provenance, \"error\", () => {\n const error = ref.error;\n return error === undefined ? undefined : rebase(error);\n });\n }\n return Ref.fromProvenance(\n ref.convexFunctionName,\n provenance as FunctionProvenance.AnyConfect,\n Array.map(ref.middlewareAttachments, (attachment) => ({\n ...attachment,\n spec: rebaseMiddleware(attachment.spec),\n })),\n nativeRef,\n ref.functionType,\n ref.reservedArgument,\n );\n }),\n Match.exhaustive,\n );\n } else {\n return visit(child, reference);\n }\n });\n const refs = visit(published.refs, native);\n Object.defineProperty(refs, BoundTypeId, {\n value: { from: published.scope, scope, tables: published.tables },\n });\n return refs as Bound<\n Spec_,\n From,\n MountScope<Parent, Extract<MountName<Native>, string | undefined>>,\n Tables\n >;\n};\n\n/**\n * Reference an installed component's table ID in host schemas.\n */\nexport const id = <\n From extends IdScope.IdScope,\n To extends IdScope.IdScope,\n Tables extends string,\n const Table extends Tables,\n>(\n component: {\n readonly [BoundTypeId]: {\n readonly from: From;\n readonly scope: To;\n readonly tables: ReadonlyArray<Tables>;\n };\n },\n table: Table,\n) => GenericId.GenericId(table, component[BoundTypeId].scope);\n\n/**\n * Reuse a component's codec in a host function or table without losing its\n * scope.\n */\nexport const schema = <\n From extends IdScope.IdScope,\n To extends IdScope.IdScope,\n Schema_ extends Schema.Codec<any, any>,\n>(\n component: {\n readonly [BoundTypeId]: { readonly from: From; readonly scope: To };\n },\n codec: Schema_,\n) =>\n GenericId.rebase(\n codec,\n component[BoundTypeId].from,\n component[BoundTypeId].scope,\n );\n\n/**\n * A component's `init`: an internal Confect mutation whose args are the install\n * args each mount passes.\n */\nexport type Init = Ref.AnyConfect & {\n readonly \"~RuntimeAndFunctionType\": RuntimeAndFunctionType.ConvexMutation;\n readonly \"~FunctionVisibility\": \"internal\";\n};\n\nexport interface DescriptorOptions {\n readonly init?: Init;\n /**\n * The component's `_generated/component` contract. A mount of a descriptor\n * with one rebases a callback slot's args with `callbackArgs`.\n */\n readonly contract?: Component<Spec.AnyWithProps, IdScope.IdScope, string>;\n readonly env?: Readonly<Record<string, Schema.Top>>;\n /**\n * Builds the component's client from its native mount, then the mount's\n * `options` when the client takes any.\n */\n readonly client: (...args: never) => unknown;\n}\n\nexport type Descriptor<\n Name extends string = string,\n Options extends DescriptorOptions = DescriptorOptions,\n> = Options & { readonly name: Name };\n\n/**\n * Describe a Convex component for `Mount.make`, as `defineComponent` does for\n * Convex. A component with `init` takes install `args` at each mount, and one\n * with `env` takes `env`. Export it from the package's `./client` entry.\n *\n * ```ts\n * export default Component.make(\"email\", {\n * init: refs.internal.install.init,\n * env: { RESEND_API_KEY: Schema.String },\n * client: Client.make,\n * });\n * ```\n */\nexport const make = <\n const Name extends string,\n const Options extends DescriptorOptions,\n>(\n name: Name,\n options: Options,\n): Descriptor<Name, Options> => ({ ...options, name });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAa,2BAAb,cAA8C,KAAK,YACjD,0BACF,CAAC,CAEE;CACD,IAAa,UAAkB;EAC7B,OAAO;CACT;AACF;AAEA,IAAa,8BAAb,cAAiD,KAAK,YACpD,6BACF,CAAC,CAGE;CACD,IAAa,UAAkB;EAC7B,OAAO,qDAAqD,KAAK,UAAU,GAAG,KAAK,aAAa;CAClG;AACF;AAEA,IAAa,qCAAb,cAAwD,KAAK,YAC3D,oCACF,CAAC,CAEE;CACD,IAAa,UAAkB;EAC7B,OAAO;CACT;AACF;AAEA,MAAM,iBACJ,QACA,SAAS,OAC4C;CACrD,KAAK,MAAM,CAAC,MAAM,UAAU,OAAO,UAAU,MAAM,GAAG;EACpD,MAAM,OAAO,WAAW,KAAK,OAAO,GAAG,OAAO,GAAG;EACjD,KAAK,MAAM,gBAAgB,OAAO,OAAO,MAAM,SAAS,GACtD,IAAI,OAAO,IAAI,MAAM,QAAQ,aAAa,IAAI,GAC5C,OAAO,OAAO,KACZ,IAAI,4BAA4B;GAC9B,WAAW;GACX,cAAc,aAAa;EAC7B,CAAC,CACH;EAGJ,MAAM,SAAS,cAAc,MAAM,QAAQ,IAAI;EAC/C,IAAI,OAAO,UAAU,MAAM,GAAG,OAAO;CACvC;CACA,OAAO,OAAO,QAAQ,KAAA,CAA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,CAClB;MACA,OAAO;KACT,CAAC,GACD,MAAM,UACR;IACF;IACA,eAAoB,YAAY,cAC9B,OAAO,OAAO,OAAO,IAAI,IAAI,KAAK,QAAQA,QAAM,CAAC,CACnD;IACA,eAAoB,YAAY,iBAC9BA,SAAO,IAAI,OAAO,CACpB;IACA,IAAI,WAAW,KACb,eAAoB,YAAY,eAAe;KAC7C,MAAM,QAAQ,IAAI;KAClB,OAAO,UAAU,KAAA,IAAY,KAAA,IAAYA,SAAO,KAAK;IACvD,CAAC;IAEH,OAAOG,eACL,IAAI,oBACJ,YACA,MAAM,IAAI,IAAI,wBAAwB,gBAAgB;KACpD,GAAG;KACH,MAAM,iBAAiB,WAAW,IAAI;IACxC,EAAE,GACF,WACA,IAAI,cACJ,IAAI,gBACN;GACF,CAAC,GACD,MAAM,UACR;EACF,OACE,OAAO,MAAM,OAAO,SAAS;CAEjC,CAAC;CACH,MAAM,OAAO,MAAM,UAAU,MAAM,MAAM;CACzC,OAAO,eAAe,MAAM,aAAa,EACvC,OAAO;EAAE,MAAM,UAAU;EAAO;EAAO,QAAQ,UAAU;CAAO,EAClE,CAAC;CACD,OAAO;AAMT;;;;AAKA,MAAa,MAMX,WAOA,UACGC,UAAoB,OAAO,UAAU,YAAY,CAAC,KAAK;;;;;AAM5D,MAAa,UAKX,WAGA,UAEAH,OACE,OACA,UAAU,YAAY,CAAC,MACvB,UAAU,YAAY,CAAC,KACzB;;;;;;;;;;;;;;AA4CF,MAAa,QAIX,MACA,aAC+B;CAAE,GAAG;CAAS;AAAK"}
1
+ {"version":3,"file":"Component.js","names":["Spec.groups","Ref.make","IdScope.instance","IdScope.app","rebase","GenericId.rebase","Ref.isRef","Ref.fromProvenance","GenericId.GenericId"],"sources":["../src/Component.ts"],"sourcesContent":["import type { DefaultFunctionArgs, FunctionReference } from \"convex/server\";\nimport { getFunctionAddress } from \"convex/server\";\nimport * as Array from \"effect/Array\";\nimport * as Data from \"effect/Data\";\nimport * as Result from \"effect/Result\";\nimport { memoize, pipe } from \"effect/Function\";\nimport * as Match from \"effect/Match\";\nimport * as Record from \"effect/Record\";\nimport * as Schema from \"effect/Schema\";\nimport type * as FunctionProvenance from \"./FunctionProvenance.js\";\nimport type * as FunctionSpec from \"./FunctionSpec.js\";\nimport * as GenericId from \"./GenericId.js\";\nimport type * as GroupSpec from \"./GroupSpec.js\";\nimport * as IdScope from \"./IdScope.js\";\nimport * as Lazy from \"./Lazy.js\";\nimport type * as MiddlewareSpec from \"./MiddlewareSpec.js\";\nimport * as Ref from \"./Ref.js\";\nimport type * as Refs from \"./Refs.js\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType.js\";\nimport * as Spec from \"./Spec.js\";\nimport type * as Table_ from \"./Table.js\";\n\nexport class EmptyComponentScopeError extends Data.TaggedError(\n \"EmptyComponentScopeError\",\n)<{\n readonly definitionScope: IdScope.IdScope;\n}> {\n override get message(): string {\n return \"A component contract requires a nonempty definition scope.\";\n }\n}\n\nexport class ComponentNameCollisionError extends Data.TaggedError(\n \"ComponentNameCollisionError\",\n)<{\n readonly groupPath: string;\n readonly functionName: string;\n}> {\n override get message(): string {\n return `Group and function at same level have same name ('${this.groupPath}:${this.functionName}')`;\n }\n}\n\nexport class UninstalledComponentReferenceError extends Data.TaggedError(\n \"UninstalledComponentReferenceError\",\n)<{\n readonly definitionScope: IdScope.IdScope;\n}> {\n override get message(): string {\n return \"Component.bind expects an installed component from the generated components registry.\";\n }\n}\n\nconst validateNames = (\n groups: Readonly<Record<string, GroupSpec.AnyWithProps>>,\n prefix = \"\",\n): Result.Result<void, ComponentNameCollisionError> => {\n for (const [name, group] of Record.toEntries(groups)) {\n const path = prefix === \"\" ? name : `${prefix}/${name}`;\n for (const functionSpec of Record.values(group.functions)) {\n if (Record.has(group.groups, functionSpec.name)) {\n return Result.fail(\n new ComponentNameCollisionError({\n groupPath: path,\n functionName: functionSpec.name,\n }),\n );\n }\n }\n const nested = validateNames(group.groups, path);\n if (Result.isFailure(nested)) return nested;\n }\n return Result.succeed(undefined);\n};\n\nconst validateContract = (\n scope: IdScope.IdScope,\n groups: Readonly<Record<string, GroupSpec.AnyWithProps>>,\n): Result.Result<\n void,\n EmptyComponentScopeError | ComponentNameCollisionError\n> =>\n scope === \"\"\n ? Result.fail(new EmptyComponentScopeError({ definitionScope: scope }))\n : validateNames(groups);\n\nconst TypeId = \"~@confect/core/Component\";\nconst BoundTypeId = \"~@confect/core/BoundComponent\";\n\n/**\n * Convex's generated ComponentApi erases database ID brands at the boundary.\n */\ntype Wire<A> = A extends { readonly __tableName: string }\n ? string\n : A extends\n | string\n | number\n | bigint\n | boolean\n | null\n | undefined\n | ArrayBuffer\n ? A\n : { [K in keyof A]: Wire<A[K]> };\n\ntype OmitEmpty<A> = {\n [K in keyof A as keyof A[K] extends never ? never : K]: A[K];\n};\ntype ApiGroups<\n GroupSpec_ extends GroupSpec.AnyWithProps,\n Name extends string | undefined,\n> = OmitEmpty<{\n [GroupName in GroupSpec.Name<GroupSpec_>]: ApiGroup<\n GroupSpec.WithName<GroupSpec_, GroupName>,\n Name\n >;\n}>;\ntype ApiGroup<\n GroupSpec_ extends GroupSpec.AnyWithProps,\n Name extends string | undefined,\n> = ApiGroups<GroupSpec.Groups<GroupSpec_>, Name> & {\n [\n FunctionSpec_ in GroupSpec.Functions<GroupSpec_> as FunctionSpec.GetFunctionVisibility<FunctionSpec_> extends \"public\"\n ? FunctionSpec.Name<FunctionSpec_>\n : never\n ]: FunctionReference<\n RuntimeAndFunctionType.GetFunctionType<\n FunctionSpec_[\"runtimeAndFunctionType\"]\n >,\n \"internal\",\n Extract<Wire<FunctionSpec.EncodedArgs<FunctionSpec_>>, DefaultFunctionArgs>,\n Wire<FunctionSpec.EncodedReturns<FunctionSpec_>>,\n Name\n >;\n};\n\nexport type Api<\n Spec_ extends Spec.AnyWithProps,\n Name extends string | undefined = string | undefined,\n> = ApiGroups<Spec.Groups<Spec_>, Name>;\n\ninterface Tree {\n readonly [key: string]: Tree | Ref.Any;\n}\n\n/**\n * Each grouped table's name, mapped to its id field and that id's table.\n */\nexport interface GroupMap {\n readonly [table: string]: { readonly key: string; readonly table: string };\n}\n\nexport interface Component<\n Spec_ extends Spec.AnyWithProps,\n Scope extends IdScope.IdScope,\n Tables extends string = string,\n Groups_ extends GroupMap = GroupMap,\n> {\n readonly [TypeId]: {\n readonly refs: Tree;\n readonly scope: Scope;\n readonly tables: ReadonlyArray<Tables>;\n readonly groups: Groups_;\n };\n readonly \"~Spec\": Spec_;\n}\n\n/**\n * A component's tables as `contract` takes them: a table, or the name of a\n * system table.\n */\nexport type TableEntry = string | Table_.AnyWithProps;\n\ntype EntryName<Entry extends TableEntry> = Entry extends string\n ? Entry\n : Entry extends Table_.AnyWithProps\n ? Table_.Name<Entry>\n : never;\n\ntype Many<A, All = A> = string extends A\n ? true\n : number extends A\n ? true\n : A extends unknown\n ? [All] extends [A]\n ? never\n : true\n : never;\n\ntype Loose<Entries extends ReadonlyArray<TableEntry>> = true extends\n | Many<Entries>\n | Many<Entries[\"length\"]>\n | { [Index in keyof Entries]: Many<Entries[Index]> }[number]\n ? \"pass one table or one name per entry; a union may be absent at runtime\"\n : never;\n\ntype StrayGroup<\n Entries extends ReadonlyArray<TableEntry>,\n Scope extends IdScope.IdScope,\n> = [Loose<Entries>] extends [never]\n ? {\n [Index in keyof Entries]: Entries[Index] extends {\n readonly tableName: infer Name extends string;\n readonly group: Table_.Group<infer Key, infer Target, infer GroupScope>;\n }\n ? [Target, GroupScope] extends [EntryName<Entries[number]>, Scope]\n ? never\n : `${Name}.${Key} is not an id of a table of this component`\n : never;\n }[number]\n : Loose<Entries>;\n\n/**\n * The group map `contract` publishes for these table entries.\n */\nexport type Groups<Entries extends ReadonlyArray<TableEntry>> = {\n readonly [\n Entry in Extract<\n Entries[number],\n { readonly tableName: string; readonly group: Table_.Group }\n > as Entry[\"tableName\"]\n ]: {\n readonly key: Entry[\"group\"][\"key\"];\n readonly table: Entry[\"group\"][\"table\"];\n };\n};\n\n/**\n * `unknown` when every entry is one table or name and every group's id names a\n * table of this component in its scope, otherwise an object type naming the\n * refused entry.\n */\nexport type CheckGroups<\n Entries extends ReadonlyArray<TableEntry>,\n Scope extends IdScope.IdScope,\n> = [StrayGroup<Entries, Scope>] extends [never]\n ? unknown\n : { readonly \"~StrayGroup\": StrayGroup<Entries, Scope> };\n\n/**\n * An opaque identity: its string representation is not part of the API.\n */\nexport type MountScope<\n Parent extends IdScope.IdScope,\n Name extends string | undefined,\n> = IdScope.Mount<Parent, Name>;\n\ntype MountName<ComponentApi> =\n ComponentApi extends FunctionReference<any, any, any, any, infer Name>\n ? Name\n : ComponentApi extends object\n ? {\n [Key in keyof ComponentApi]: MountName<ComponentApi[Key]>;\n }[keyof ComponentApi]\n : never;\n\ntype BindRefs<\n RefTree,\n From extends IdScope.IdScope,\n To extends IdScope.IdScope,\n> = RefTree extends Ref.Any\n ? RefTree extends { readonly _tag: \"Convex\" }\n ? Ref.ConvexRef<\n Ref.GetRuntimeAndFunctionType<RefTree>,\n \"internal\",\n Extract<Wire<Ref.Args<RefTree>>, DefaultFunctionArgs>,\n Wire<Ref.Returns<RefTree>>\n >\n : Extract<\n Ref.Ref<\n Ref.GetRuntimeAndFunctionType<RefTree>,\n \"internal\",\n Extract<\n GenericId.Rebase<Ref.Args<RefTree>, From, To>,\n DefaultFunctionArgs\n >,\n GenericId.Rebase<Ref.Returns<RefTree>, From, To>,\n GenericId.Rebase<Ref.Error<RefTree>, From, To>\n >,\n { readonly _tag: RefTree[\"_tag\"] }\n >\n : { [Key in keyof RefTree]: BindRefs<RefTree[Key], From, To> };\n\nexport type Bound<\n Spec_ extends Spec.AnyWithProps,\n From extends IdScope.IdScope,\n To extends IdScope.IdScope,\n Tables extends string,\n> = BindRefs<Refs.Refs<Spec_, Ref.AnyPublic>, From, To> & {\n readonly [BoundTypeId]: {\n readonly from: From;\n readonly scope: To;\n readonly tables: ReadonlyArray<Tables>;\n };\n};\n\n/**\n * Build a publishable contract containing only exported functions and codecs.\n * `tables` lists the component's tables, each a table or a system table's name.\n * A table grouped by an id must group by an id of one of these tables.\n */\nexport function contract<\n Spec_ extends Spec.AnyWithProps,\n const Scope extends IdScope.IdScope,\n const Entries extends ReadonlyArray<TableEntry>,\n>(\n spec: Spec_,\n scope: Scope,\n tables: Entries & CheckGroups<Entries, Scope>,\n): Component<Spec_, Scope, EntryName<Entries[number]>, Groups<Entries>>;\n/**\n * Table names alone, as in an explicit third type argument, carry no groups.\n */\nexport function contract<\n Spec_ extends Spec.AnyWithProps,\n const Scope extends IdScope.IdScope,\n const Tables extends string,\n>(\n spec: Spec_,\n scope: Scope,\n tables: ReadonlyArray<Tables>,\n): Component<Spec_, Scope, Tables, {}>;\nexport function contract(\n spec: Spec.AnyWithProps,\n scope: IdScope.IdScope,\n tables: ReadonlyArray<TableEntry>,\n): Component<Spec.AnyWithProps, IdScope.IdScope> {\n const specGroups = Spec.groups(spec);\n Result.getOrThrow(validateContract(scope, specGroups));\n const collect = (\n groups: Readonly<Record<string, GroupSpec.AnyWithProps>>,\n prefix = \"\",\n ): Tree =>\n pipe(\n groups,\n Record.map((group, name) => {\n const path = prefix === \"\" ? name : `${prefix}/${name}`;\n const functions = pipe(\n group.functions,\n Record.filter((functionSpec) => {\n return Match.value(functionSpec.functionVisibility).pipe(\n Match.when(\"public\", () => true),\n Match.when(\"internal\", () => false),\n Match.exhaustive,\n );\n }),\n Record.map((functionSpec) =>\n Ref.make(path, functionSpec, group.middlewareAttachments),\n ),\n );\n return { ...collect(group.groups, path), ...functions };\n }),\n Record.filter((children) => !Record.isEmptyRecord(children)),\n );\n const grouped: GroupMap = pipe(\n tables,\n Array.flatMap((entry) =>\n typeof entry !== \"string\" && entry.group !== undefined\n ? [[entry.tableName, entry.group] as const]\n : [],\n ),\n Record.fromEntries,\n );\n const published: Component<\n Spec.AnyWithProps,\n IdScope.IdScope\n >[typeof TypeId] = {\n refs: collect(specGroups),\n scope,\n tables: Array.map(tables, (entry) =>\n typeof entry === \"string\" ? entry : entry.tableName,\n ),\n groups: grouped,\n };\n return { [TypeId]: published } as Component<\n Spec.AnyWithProps,\n IdScope.IdScope\n >;\n}\n\n/**\n * Each grouped table's id field and the table that id names.\n */\nexport const groups = <Groups_ extends GroupMap>(\n component: Component<Spec.AnyWithProps, IdScope.IdScope, string, Groups_>,\n): Groups_ =>\n Record.map(component[TypeId].groups, ({ key, table }) => ({\n key,\n table,\n })) as Groups_;\n\n/**\n * Bind the published contract to an actual installed component reference.\n */\nexport const bind = <\n Spec_ extends Spec.AnyWithProps,\n From extends IdScope.IdScope,\n Tables extends string,\n Native extends Api<NoInfer<Spec_>>,\n const Parent extends IdScope.IdScope = IdScope.App,\n>(\n component: Component<Spec_, From, Tables>,\n native: Native,\n options?: { readonly parentScope: Parent },\n): Bound<\n Spec_,\n From,\n MountScope<Parent, Extract<MountName<Native>, string | undefined>>,\n Tables\n> => {\n const published = component[TypeId];\n const address = getFunctionAddress(native);\n const installedReference = Result.getOrThrow(\n Result.fromNullishOr(\n address.reference,\n () =>\n new UninstalledComponentReferenceError({\n definitionScope: published.scope,\n }),\n ),\n );\n // Preserve the opaque address as an identity only. Calls retain the native\n // references; no component address is constructed or parsed for routing.\n const scope = IdScope.instance(\n options?.parentScope ?? IdScope.app,\n installedReference,\n );\n const rebase = (schema: Schema.ConstraintCodec<any, any, never, never>) =>\n GenericId.rebase(schema, published.scope, scope);\n const rebaseMiddleware = memoize(\n (middleware: MiddlewareSpec.AnyMiddlewareSpec) => {\n if (!(\"error\" in middleware)) return middleware;\n const boundMiddleware = Object.create(\n middleware,\n ) as MiddlewareSpec.AnyMiddlewareSpec;\n Lazy.defineProperty(boundMiddleware, \"error\", () => {\n const error = middleware.error;\n return error === undefined ? undefined : rebase(error);\n });\n return boundMiddleware;\n },\n );\n const visit = (tree: Tree, references: unknown): Tree =>\n Record.map(tree, (child, key) => {\n const reference = (references as Record<string, unknown>)[key];\n if (Ref.isRef(child)) {\n const nativeRef = reference as FunctionReference<any, any>;\n return Match.value(child).pipe(\n Match.tag(\"Convex\", (ref) => ({\n ...ref,\n functionReference: nativeRef,\n })),\n Match.tag(\"Confect\", (ref) => {\n const provenance = {\n _tag: \"Confect\" as const,\n kind: Match.value(ref.kind).pipe(\n Match.tag(\"Standard\", (kind) => kind),\n Match.tag(\"Paginated\", (kind) => {\n const boundKind = { _tag: \"Paginated\" as const };\n Lazy.defineProperty(boundKind, \"userArgs\", () =>\n Schema.Struct(Record.map(kind.userArgs.fields, rebase)),\n );\n Lazy.defineProperty(boundKind, \"item\", () =>\n rebase(kind.item),\n );\n Lazy.defineProperty(boundKind, \"page\", () =>\n rebase(kind.page),\n );\n return boundKind as FunctionProvenance.Paginated;\n }),\n Match.exhaustive,\n ),\n };\n Lazy.defineProperty(provenance, \"args\", () =>\n Schema.Struct(Record.map(ref.args.fields, rebase)),\n );\n Lazy.defineProperty(provenance, \"returns\", () =>\n rebase(ref.returns),\n );\n if (\"error\" in ref) {\n Lazy.defineProperty(provenance, \"error\", () => {\n const error = ref.error;\n return error === undefined ? undefined : rebase(error);\n });\n }\n return Ref.fromProvenance(\n ref.convexFunctionName,\n provenance as FunctionProvenance.AnyConfect,\n Array.map(ref.middlewareAttachments, (attachment) => ({\n ...attachment,\n spec: rebaseMiddleware(attachment.spec),\n })),\n nativeRef,\n ref.functionType,\n ref.reservedArgument,\n );\n }),\n Match.exhaustive,\n );\n } else {\n return visit(child, reference);\n }\n });\n const refs = visit(published.refs, native);\n Object.defineProperty(refs, BoundTypeId, {\n value: { from: published.scope, scope, tables: published.tables },\n });\n return refs as Bound<\n Spec_,\n From,\n MountScope<Parent, Extract<MountName<Native>, string | undefined>>,\n Tables\n >;\n};\n\n/**\n * Reference an installed component's table ID in host schemas.\n */\nexport const id = <\n From extends IdScope.IdScope,\n To extends IdScope.IdScope,\n Tables extends string,\n const Table extends Tables,\n>(\n component: {\n readonly [BoundTypeId]: {\n readonly from: From;\n readonly scope: To;\n readonly tables: ReadonlyArray<Tables>;\n };\n },\n table: Table,\n) => GenericId.GenericId(table, component[BoundTypeId].scope);\n\n/**\n * Reuse a component's codec in a host function or table without losing its\n * scope.\n */\nexport const schema = <\n From extends IdScope.IdScope,\n To extends IdScope.IdScope,\n Schema_ extends Schema.Codec<any, any>,\n>(\n component: {\n readonly [BoundTypeId]: { readonly from: From; readonly scope: To };\n },\n codec: Schema_,\n) =>\n GenericId.rebase(\n codec,\n component[BoundTypeId].from,\n component[BoundTypeId].scope,\n );\n\n/**\n * A component's `init`: an internal Confect mutation whose args are the install\n * args each mount passes.\n */\nexport type Init = Ref.AnyConfect & {\n readonly \"~RuntimeAndFunctionType\": RuntimeAndFunctionType.ConvexMutation;\n readonly \"~FunctionVisibility\": \"internal\";\n};\n\nexport interface DescriptorOptions {\n readonly init?: Init;\n /**\n * The component's `_generated/component` contract. A mount of a descriptor\n * with one rebases a callback slot's args with `callbackArgs`.\n */\n readonly contract?: Component<Spec.AnyWithProps, IdScope.IdScope, string>;\n readonly env?: Readonly<Record<string, Schema.Top>>;\n /**\n * The package specifier of the test kit whose `register(t, name)` installs\n * this component and its children under `TestConfect`, such as\n * `\"@acme/email/testing\"`. Codegen imports it for each mount of the\n * descriptor from another package in place of `<package>/testing` or\n * `<package>/test`. A local component's mount ignores it.\n */\n readonly testing?: string;\n /**\n * Builds the component's client from its native mount, then the mount's\n * `options` when the client takes any.\n */\n readonly client: (...args: never) => unknown;\n}\n\nexport type Descriptor<\n Name extends string = string,\n Options extends DescriptorOptions = DescriptorOptions,\n> = Options & { readonly name: Name };\n\n/**\n * Describe a Convex component for `Mount.make`, as `defineComponent` does for\n * Convex. A component with `init` takes install `args` at each mount, and one\n * with `env` takes `env`. Export it from the package's `./client` entry.\n *\n * ```ts\n * export default Component.make(\"email\", {\n * init: refs.internal.install.init,\n * env: { RESEND_API_KEY: Schema.String },\n * client: Client.make,\n * });\n * ```\n */\nexport const make = <\n const Name extends string,\n const Options extends DescriptorOptions,\n>(\n name: Name,\n options: Options,\n): Descriptor<Name, Options>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wBAAwB,gBAAgB;KACpD,GAAG;KACH,MAAM,iBAAiB,WAAW,IAAI;IACxC,EAAE,GACF,WACA,IAAI,cACJ,IAAI,gBACN;GACF,CAAC,GACD,MAAM,UACR;EACF,OACE,OAAO,MAAM,OAAO,SAAS;CAEjC,CAAC;CACH,MAAM,OAAO,MAAM,UAAU,MAAM,MAAM;CACzC,OAAO,eAAe,MAAM,aAAa,EACvC,OAAO;EAAE,MAAM,UAAU;EAAO;EAAO,QAAQ,UAAU;CAAO,EAClE,CAAC;CACD,OAAO;AAMT;;;;AAKA,MAAa,MAMX,WAOA,UACGC,UAAoB,OAAO,UAAU,YAAY,CAAC,KAAK;;;;;AAM5D,MAAa,UAKX,WAGA,UAEAH,OACE,OACA,UAAU,YAAY,CAAC,MACvB,UAAU,YAAY,CAAC,KACzB;;;;;;;;;;;;;;AAoDF,MAAa,QAIX,MACA,aAC+B;CAAE,GAAG;CAAS;AAAK"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gaganref/confect-core",
3
- "version": "10.3.1-fork.83",
3
+ "version": "10.3.1-fork.85",
4
4
  "peerDependencies": {
5
5
  "convex": "^1.49.0",
6
6
  "effect": ">=4.0.0 <4.1.0"
package/src/Component.ts CHANGED
@@ -569,6 +569,14 @@ export interface DescriptorOptions {
569
569
  */
570
570
  readonly contract?: Component<Spec.AnyWithProps, IdScope.IdScope, string>;
571
571
  readonly env?: Readonly<Record<string, Schema.Top>>;
572
+ /**
573
+ * The package specifier of the test kit whose `register(t, name)` installs
574
+ * this component and its children under `TestConfect`, such as
575
+ * `"@acme/email/testing"`. Codegen imports it for each mount of the
576
+ * descriptor from another package in place of `<package>/testing` or
577
+ * `<package>/test`. A local component's mount ignores it.
578
+ */
579
+ readonly testing?: string;
572
580
  /**
573
581
  * Builds the component's client from its native mount, then the mount's
574
582
  * `options` when the client takes any.