@gaganref/confect-core 10.3.1-fork.72 → 10.3.1-fork.74
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.
- package/dist/App.d.ts +27 -88
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +23 -36
- package/dist/App.js.map +1 -1
- package/dist/Auth.d.ts +2 -3
- package/dist/Auth.d.ts.map +1 -1
- package/dist/Auth.js +2 -1
- package/dist/Auth.js.map +1 -1
- package/dist/Component.d.ts +39 -0
- package/dist/Component.d.ts.map +1 -1
- package/dist/Component.js +22 -4
- package/dist/Component.js.map +1 -1
- package/dist/GenericId.js +3 -3
- package/dist/Http.js +1 -1
- package/dist/Mount.d.ts +182 -0
- package/dist/Mount.d.ts.map +1 -0
- package/dist/Mount.js +57 -0
- package/dist/Mount.js.map +1 -0
- package/dist/PaginationError.js +1 -1
- package/dist/Ref.js +2 -2
- package/dist/Refs.js +1 -1
- package/dist/SchemaToValidator.js +6 -6
- package/dist/SystemFields.js +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -5
- package/package.json +1 -1
- package/src/App.ts +32 -130
- package/src/Auth.ts +6 -5
- package/src/Component.ts +50 -0
- package/src/Mount.ts +284 -0
- package/src/index.ts +1 -0
package/dist/Component.js.map
CHANGED
|
@@ -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\";\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\nexport interface Component<\n Spec_ extends Spec.AnyWithProps,\n Scope extends IdScope.IdScope,\n Tables extends string = string,\n> {\n readonly [TypeId]: {\n readonly refs: Tree;\n readonly scope: Scope;\n readonly tables: ReadonlyArray<Tables>;\n };\n readonly \"~Spec\": Spec_;\n}\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 */\nexport const 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> => {\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 return {\n [TypeId]: { refs: collect(specGroups), scope, tables },\n } as Component<Spec_, Scope, Tables>;\n};\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqBA,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,CA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;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"}
|
|
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\";\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\nexport interface Component<\n Spec_ extends Spec.AnyWithProps,\n Scope extends IdScope.IdScope,\n Tables extends string = string,\n> {\n readonly [TypeId]: {\n readonly refs: Tree;\n readonly scope: Scope;\n readonly tables: ReadonlyArray<Tables>;\n };\n readonly \"~Spec\": Spec_;\n}\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 */\nexport const 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> => {\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 return {\n [TypeId]: { refs: collect(specGroups), scope, tables },\n } as Component<Spec_, Scope, Tables>;\n};\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":";;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAa,2BAAb,cAA8C,KAAK,YACjD,0BACF,CAAC,CAEE;CACD,IAAa,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U,YAAY,CAAC,KACzB;;;;;;;;;;;;;;AA4CF,MAAa,QAIX,MACA,aAC+B;CAAE,GAAG;CAAS;AAAK"}
|
package/dist/GenericId.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { app } from "./IdScope.js";
|
|
3
3
|
import * as Schema from "effect/Schema";
|
|
4
|
-
import * as
|
|
5
|
-
import * as Option from "effect/Option";
|
|
4
|
+
import * as SchemaAST from "effect/SchemaAST";
|
|
6
5
|
import * as Array from "effect/Array";
|
|
7
6
|
import { memoize } from "effect/Function";
|
|
8
|
-
import * as
|
|
7
|
+
import * as Match from "effect/Match";
|
|
8
|
+
import * as Option from "effect/Option";
|
|
9
9
|
//#region src/GenericId.ts
|
|
10
10
|
var GenericId_exports = /* @__PURE__ */ __exportAll({
|
|
11
11
|
GenericId: () => GenericId,
|
package/dist/Http.js
CHANGED
|
@@ -3,8 +3,8 @@ import { mounts } from "./App.js";
|
|
|
3
3
|
import { scalarDocs } from "./internal/scalarDocs.js";
|
|
4
4
|
import * as Predicate from "effect/Predicate";
|
|
5
5
|
import * as Data from "effect/Data";
|
|
6
|
-
import * as Result from "effect/Result";
|
|
7
6
|
import * as SchemaAST from "effect/SchemaAST";
|
|
7
|
+
import * as Result from "effect/Result";
|
|
8
8
|
import * as Layer from "effect/Layer";
|
|
9
9
|
import * as HttpApiBuilder from "effect/http-api/HttpApiBuilder";
|
|
10
10
|
//#region src/Http.ts
|
package/dist/Mount.d.ts
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
import type * as App from "./App.js";
|
|
4
|
+
import type * as Callback from "./Callback.js";
|
|
5
|
+
import * as Component from "./Component.js";
|
|
6
|
+
import type * as Env from "./Env.js";
|
|
7
|
+
import type * as GenericId from "./GenericId.js";
|
|
8
|
+
import type * as IdScope from "./IdScope.js";
|
|
9
|
+
import type * as Ref from "./Ref.js";
|
|
10
|
+
declare const TypeId = "~@confect/core/Mount";
|
|
11
|
+
type Handle = Ref.AnyConfect & {
|
|
12
|
+
readonly "~@confect/core/Callback/Handle": Callback.Id;
|
|
13
|
+
};
|
|
14
|
+
type ContractOf<H extends Handle> = Callback.Contract<H["~@confect/core/Callback/Handle"], Ref.GetFunctionType<H>, H["args"]["fields"], H["returns"], Extract<NonNullable<H["error"]>, Schema.Top>>;
|
|
15
|
+
/**
|
|
16
|
+
* What a mount passes for `init`'s args: the same shape, with a host ref in
|
|
17
|
+
* each callback slot.
|
|
18
|
+
*/
|
|
19
|
+
type Input<T> = T extends Handle ? Ref.AnyConfect : T extends object ? {
|
|
20
|
+
readonly [K in keyof T]: Input<T[K]>;
|
|
21
|
+
} : T;
|
|
22
|
+
/**
|
|
23
|
+
* `A` when every alternative of `A` fits `T`; otherwise a type that refuses
|
|
24
|
+
* each alternative that does not. A callback slot takes an internal host ref
|
|
25
|
+
* that satisfies the slot's contract. Whether a slot may be left `undefined` is
|
|
26
|
+
* `Input`'s to say.
|
|
27
|
+
*/
|
|
28
|
+
type Check<T, A> = A extends unknown ? Fit<T, A> : never;
|
|
29
|
+
/**
|
|
30
|
+
* Distributes over the members of `T`, so a value is checked against the
|
|
31
|
+
* members whose shape it has and fits when it fits one of them.
|
|
32
|
+
*/
|
|
33
|
+
type Fit<T, A> = T extends Handle ? A extends Ref.AnyConfect ? A & Callback.Check<ContractOf<T>, A> & (Ref.GetFunctionVisibility<A> extends "internal" ? unknown : {
|
|
34
|
+
readonly callbackMustBeInternal: never;
|
|
35
|
+
}) : never : T extends object ? A extends Input<T> ? {
|
|
36
|
+
readonly [K in keyof A]: K extends keyof T ? Check<T[K], A[K]> : never;
|
|
37
|
+
} : never : A extends T ? A : never;
|
|
38
|
+
type ArgsOf<C> = C extends {
|
|
39
|
+
readonly init: infer I extends Component.Init;
|
|
40
|
+
} ? Ref.Args<I> : never;
|
|
41
|
+
/**
|
|
42
|
+
* `[C]`, not a bare `C`, so the conditional is not distributive. A distributive
|
|
43
|
+
* one resolves against `Component.Descriptor` while `C` is inferred, drops `A`
|
|
44
|
+
* from the contextual type, and widens inline literals until `A` falls back to
|
|
45
|
+
* its constraint.
|
|
46
|
+
*/
|
|
47
|
+
type ArgsField<C, A> = [C] extends [
|
|
48
|
+
{
|
|
49
|
+
readonly init: infer I extends Component.Init;
|
|
50
|
+
}
|
|
51
|
+
] ? {
|
|
52
|
+
readonly args: A & NoInfer<Check<Ref.Args<I>, A>>;
|
|
53
|
+
} : {
|
|
54
|
+
readonly args?: never;
|
|
55
|
+
};
|
|
56
|
+
type IsOptional<S> = S extends {
|
|
57
|
+
readonly "~type.optionality": "optional";
|
|
58
|
+
} ? true : false;
|
|
59
|
+
type RequiredKeys<E> = {
|
|
60
|
+
[K in keyof E]: IsOptional<E[K]> extends true ? never : K;
|
|
61
|
+
}[keyof E];
|
|
62
|
+
type SlotValue<S> = Extract<Schema.Schema.Type<S & Schema.Top>, string>;
|
|
63
|
+
/**
|
|
64
|
+
* What one env slot accepts: a constant, or an entry of the host's env whose
|
|
65
|
+
* value fits. A required slot takes only a required entry.
|
|
66
|
+
*/
|
|
67
|
+
type Slot<S> = IsOptional<S> extends true ? SlotValue<S> | undefined | Env.Entry<string, any, SlotValue<S>, boolean> : SlotValue<S> | Env.Entry<string, any, SlotValue<S>, false>;
|
|
68
|
+
type Bindings<E> = {
|
|
69
|
+
readonly [K in RequiredKeys<E>]: Slot<E[K]>;
|
|
70
|
+
} & {
|
|
71
|
+
readonly [K in Exclude<keyof E, RequiredKeys<E>>]?: Slot<E[K]>;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* `B` keeps the bindings as written, so `App.make` can see which backends their
|
|
75
|
+
* entries come from. `[C]` for the reason `ArgsField` gives: a bare `C` widens
|
|
76
|
+
* an inline constant to `string`.
|
|
77
|
+
*/
|
|
78
|
+
type EnvField<C, B> = [C] extends [{
|
|
79
|
+
readonly env: infer E;
|
|
80
|
+
}] ? [RequiredKeys<E>] extends [never] ? {
|
|
81
|
+
readonly env?: B & Bindings<E> & NoExtra<B, E>;
|
|
82
|
+
} : {
|
|
83
|
+
readonly env: B & Bindings<E> & NoExtra<B, E>;
|
|
84
|
+
} : {
|
|
85
|
+
readonly env?: never;
|
|
86
|
+
};
|
|
87
|
+
type NoExtra<B, E> = {
|
|
88
|
+
readonly [K in Exclude<keyof B, keyof E>]: never;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* The client constructor's parameters after the native mount decide whether
|
|
92
|
+
* `options` is absent, optional or required. A client that takes no native
|
|
93
|
+
* mount cannot be mounted. That branch is an object, not `never`, so the
|
|
94
|
+
* literal `name` and `args` beside it keep their types.
|
|
95
|
+
*/
|
|
96
|
+
type OptionsField<C extends Component.Descriptor> = Parameters<C["client"]> extends [unknown, ...infer Rest] ? Rest extends [] ? {
|
|
97
|
+
readonly options?: never;
|
|
98
|
+
} : Rest extends [infer O] ? {
|
|
99
|
+
readonly options: O;
|
|
100
|
+
} : Rest extends [options?: infer O] ? {
|
|
101
|
+
readonly options?: Exclude<O, undefined>;
|
|
102
|
+
} : never : {
|
|
103
|
+
readonly options: never;
|
|
104
|
+
};
|
|
105
|
+
export type Client<C extends Component.Descriptor> = ReturnType<C["client"]>;
|
|
106
|
+
export interface Data<C extends Component.Descriptor = Component.Descriptor> {
|
|
107
|
+
readonly component: C;
|
|
108
|
+
readonly name: string;
|
|
109
|
+
readonly httpPrefix?: App.HttpPrefix;
|
|
110
|
+
readonly env?: Readonly<Record<string, string | Env.AnyEntry | undefined>>;
|
|
111
|
+
readonly args?: unknown;
|
|
112
|
+
readonly options?: unknown;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* What a mount was declared with, as written: its HTTP prefix and env bindings.
|
|
116
|
+
*/
|
|
117
|
+
export interface Declared<P extends App.HttpPrefix | undefined = App.HttpPrefix | undefined, B = unknown> {
|
|
118
|
+
readonly httpPrefix: P;
|
|
119
|
+
readonly env: B;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* A mounted Convex component. Yield it for its client. Its default is the
|
|
123
|
+
* component's client over this mount, and `Effect.provideService` replaces it.
|
|
124
|
+
*/
|
|
125
|
+
export interface Mount<C extends Component.Descriptor, Name extends string, D extends Declared = Declared> extends Context.Reference<Client<C>> {
|
|
126
|
+
readonly [TypeId]: Data<C> & {
|
|
127
|
+
readonly name: Name;
|
|
128
|
+
};
|
|
129
|
+
readonly "~declared"?: D;
|
|
130
|
+
}
|
|
131
|
+
export type Any = Mount<Component.Descriptor, string>;
|
|
132
|
+
export type NameOf<M> = M extends Mount<any, infer N, any> ? N : never;
|
|
133
|
+
type InitArgs<C> = C extends {
|
|
134
|
+
readonly init: infer I extends Component.Init;
|
|
135
|
+
} ? Ref.Args<I> : never;
|
|
136
|
+
type CallbackSlot<C> = {
|
|
137
|
+
[K in keyof InitArgs<C>]-?: NonNullable<InitArgs<C>[K]> extends Handle ? K : never;
|
|
138
|
+
}[keyof InitArgs<C>] & string;
|
|
139
|
+
type SlotArgs<C, K extends PropertyKey> = Extract<NonNullable<InitArgs<C>[K & keyof InitArgs<C>]>, Handle>["args"]["fields"];
|
|
140
|
+
/**
|
|
141
|
+
* `callbackArgs`, on a mount whose descriptor carries its contract.
|
|
142
|
+
*/
|
|
143
|
+
type CallbackArgs<C, Name extends string> = C extends {
|
|
144
|
+
readonly contract: Component.Component<any, infer From, any>;
|
|
145
|
+
} ? {
|
|
146
|
+
/**
|
|
147
|
+
* A callback slot's contract args, with the component's ids typed for
|
|
148
|
+
* this mount, for the host function that answers the callback.
|
|
149
|
+
*/
|
|
150
|
+
readonly callbackArgs: <const K extends CallbackSlot<C>>(slot: K) => GenericId.RebaseSchema<Schema.Struct<SlotArgs<C, K>>, From, Component.MountScope<IdScope.App, Name>>["fields"];
|
|
151
|
+
} : unknown;
|
|
152
|
+
/**
|
|
153
|
+
* Mount a Convex component, as Convex's `app.use` does, in the host's
|
|
154
|
+
* `confect/<mount>.ts`. `args` is typed from the component's `init`, `env` from
|
|
155
|
+
* its env slots, and `options` from its client constructor. A handler reaches
|
|
156
|
+
* the client with `yield* BulkEmail`.
|
|
157
|
+
*
|
|
158
|
+
* ```ts
|
|
159
|
+
* export const BulkEmail = Mount.make(Email, {
|
|
160
|
+
* name: "bulkEmail",
|
|
161
|
+
* httpPrefix: "/bulk-email",
|
|
162
|
+
* env: { RESEND_API_KEY: env.BULK_RESEND_KEY },
|
|
163
|
+
* args: {
|
|
164
|
+
* fromName: "School office",
|
|
165
|
+
* onEvent: refs.internal.circulars.onEmailEvent,
|
|
166
|
+
* },
|
|
167
|
+
* });
|
|
168
|
+
* ```
|
|
169
|
+
*/
|
|
170
|
+
export declare const make: <C extends Component.Descriptor, const Name extends string, const A extends Input<ArgsOf<C>>, const P extends App.HttpPrefix = never, const B = {}>(component: C, options: {
|
|
171
|
+
readonly name: Name;
|
|
172
|
+
readonly httpPrefix?: P;
|
|
173
|
+
} & EnvField<C, B> & ArgsField<C, A> & OptionsField<C>) => Mount<C, Name, Declared<[P] extends [never] ? undefined : P, B>> & CallbackArgs<C, Name>;
|
|
174
|
+
/**
|
|
175
|
+
* What a mount was declared with: its component, name, HTTP prefix, env, args
|
|
176
|
+
* and options.
|
|
177
|
+
*/
|
|
178
|
+
export declare const data: <C extends Component.Descriptor, Name extends string>(mount: Mount<C, Name, Declared>) => Data<C> & {
|
|
179
|
+
readonly name: Name;
|
|
180
|
+
};
|
|
181
|
+
export {};
|
|
182
|
+
//# sourceMappingURL=Mount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mount.d.ts","sourceRoot":"","sources":["../src/Mount.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,KAAK,GAAG,MAAM,UAAU,CAAC;AACrC,OAAO,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O,CAAC,GAAG,EAAE,IAAI,CAAC,CACxC,CAAC,QAAQ,CAAC,CAAC;CACb,GACD,OAAO,CAAC;AAEZ;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,IAAI,GACf,CAAC,SAAS,SAAS,CAAC,UAAU,EAC9B,KAAK,CAAC,IAAI,SAAS,MAAM,EACzB,KAAK,CAAC,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAChC,KAAK,CAAC,CAAC,SAAS,GAAG,CAAC,UAAU,GAAG,KAAK,EACtC,KAAK,CAAC,CAAC,GAAG,EAAE,aAED,CAAC,WACH;IACP,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;CACzB,GAAG,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAChB,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GACf,YAAY,CAAC,CAAC,CAAC,KAChB,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,SAAS,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GACjE,YAAY,CAAC,CAAC,EAAE,IAAI,CA4BrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,IAAI,GAAI,CAAC,SAAS,SAAS,CAAC,UAAU,EAAE,IAAI,SAAS,MAAM,SAC/D,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,KAC9B,IAAI,CAAC,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAA;CAAmB,CAAC"}
|
package/dist/Mount.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { bind, schema } from "./Component.js";
|
|
3
|
+
import { CallbackContract } from "./internal/annotations.js";
|
|
4
|
+
import * as Context from "effect/Context";
|
|
5
|
+
import * as Schema from "effect/Schema";
|
|
6
|
+
import { componentsGeneric } from "convex/server";
|
|
7
|
+
import * as SchemaAST from "effect/SchemaAST";
|
|
8
|
+
//#region src/Mount.ts
|
|
9
|
+
var Mount_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
+
data: () => data,
|
|
11
|
+
make: () => make
|
|
12
|
+
});
|
|
13
|
+
const TypeId = "~@confect/core/Mount";
|
|
14
|
+
/**
|
|
15
|
+
* Mount a Convex component, as Convex's `app.use` does, in the host's
|
|
16
|
+
* `confect/<mount>.ts`. `args` is typed from the component's `init`, `env` from
|
|
17
|
+
* its env slots, and `options` from its client constructor. A handler reaches
|
|
18
|
+
* the client with `yield* BulkEmail`.
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* export const BulkEmail = Mount.make(Email, {
|
|
22
|
+
* name: "bulkEmail",
|
|
23
|
+
* httpPrefix: "/bulk-email",
|
|
24
|
+
* env: { RESEND_API_KEY: env.BULK_RESEND_KEY },
|
|
25
|
+
* args: {
|
|
26
|
+
* fromName: "School office",
|
|
27
|
+
* onEvent: refs.internal.circulars.onEmailEvent,
|
|
28
|
+
* },
|
|
29
|
+
* });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
const make = (component, options) => {
|
|
33
|
+
const data = {
|
|
34
|
+
...options,
|
|
35
|
+
component
|
|
36
|
+
};
|
|
37
|
+
const client = component.client;
|
|
38
|
+
const native = () => componentsGeneric()[data.name];
|
|
39
|
+
const mount = Context.Reference(`mount/${data.name}`, { defaultValue: () => client(native(), data.options) });
|
|
40
|
+
const { contract, init } = component;
|
|
41
|
+
const callbackArgs = (slot) => {
|
|
42
|
+
const field = init.args.fields[slot];
|
|
43
|
+
const callback = SchemaAST.resolveAt(CallbackContract)(Schema.toEncoded(field).ast);
|
|
44
|
+
const bound = bind(contract, native());
|
|
45
|
+
return schema(bound, callback.functionProvenance.args).fields;
|
|
46
|
+
};
|
|
47
|
+
return Object.assign(mount, { [TypeId]: data }, contract === void 0 ? {} : { callbackArgs });
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* What a mount was declared with: its component, name, HTTP prefix, env, args
|
|
51
|
+
* and options.
|
|
52
|
+
*/
|
|
53
|
+
const data = (mount) => mount[TypeId];
|
|
54
|
+
//#endregion
|
|
55
|
+
export { Mount_exports, data, make };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=Mount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mount.js","names":["Component.bind","Component.schema"],"sources":["../src/Mount.ts"],"sourcesContent":["import { componentsGeneric } from \"convex/server\";\nimport * as Context from \"effect/Context\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaAST from \"effect/SchemaAST\";\nimport type * as App from \"./App.js\";\nimport type * as Callback from \"./Callback.js\";\nimport * as Component from \"./Component.js\";\nimport type * as Env from \"./Env.js\";\nimport type * as GenericId from \"./GenericId.js\";\nimport type * as IdScope from \"./IdScope.js\";\nimport { CallbackContract } from \"./internal/annotations.js\";\nimport type * as Ref from \"./Ref.js\";\n\nconst TypeId = \"~@confect/core/Mount\";\n\ntype Handle = Ref.AnyConfect & {\n readonly \"~@confect/core/Callback/Handle\": Callback.Id;\n};\n\ntype ContractOf<H extends Handle> = Callback.Contract<\n H[\"~@confect/core/Callback/Handle\"],\n Ref.GetFunctionType<H>,\n H[\"args\"][\"fields\"],\n H[\"returns\"],\n Extract<NonNullable<H[\"error\"]>, Schema.Top>\n>;\n\n/**\n * What a mount passes for `init`'s args: the same shape, with a host ref in\n * each callback slot.\n */\ntype Input<T> = T extends Handle\n ? Ref.AnyConfect\n : T extends object\n ? { readonly [K in keyof T]: Input<T[K]> }\n : T;\n\n/**\n * `A` when every alternative of `A` fits `T`; otherwise a type that refuses\n * each alternative that does not. A callback slot takes an internal host ref\n * that satisfies the slot's contract. Whether a slot may be left `undefined` is\n * `Input`'s to say.\n */\ntype Check<T, A> = A extends unknown ? Fit<T, A> : never;\n\n/**\n * Distributes over the members of `T`, so a value is checked against the\n * members whose shape it has and fits when it fits one of them.\n */\ntype Fit<T, A> = T extends Handle\n ? A extends Ref.AnyConfect\n ? A &\n Callback.Check<ContractOf<T>, A> &\n (Ref.GetFunctionVisibility<A> extends \"internal\"\n ? unknown\n : { readonly callbackMustBeInternal: never })\n : never\n : T extends object\n ? A extends Input<T>\n ? {\n readonly [K in keyof A]: K extends keyof T\n ? Check<T[K], A[K]>\n : never;\n }\n : never\n : A extends T\n ? A\n : never;\n\ntype ArgsOf<C> = C extends { readonly init: infer I extends Component.Init }\n ? Ref.Args<I>\n : never;\n\n/**\n * `[C]`, not a bare `C`, so the conditional is not distributive. A distributive\n * one resolves against `Component.Descriptor` while `C` is inferred, drops `A`\n * from the contextual type, and widens inline literals until `A` falls back to\n * its constraint.\n */\ntype ArgsField<C, A> = [C] extends [\n { readonly init: infer I extends Component.Init },\n]\n ? { readonly args: A & NoInfer<Check<Ref.Args<I>, A>> }\n : { readonly args?: never };\n\ntype IsOptional<S> = S extends { readonly \"~type.optionality\": \"optional\" }\n ? true\n : false;\n\ntype RequiredKeys<E> = {\n [K in keyof E]: IsOptional<E[K]> extends true ? never : K;\n}[keyof E];\n\ntype SlotValue<S> = Extract<Schema.Schema.Type<S & Schema.Top>, string>;\n\n/**\n * What one env slot accepts: a constant, or an entry of the host's env whose\n * value fits. A required slot takes only a required entry.\n */\ntype Slot<S> =\n IsOptional<S> extends true\n ? SlotValue<S> | undefined | Env.Entry<string, any, SlotValue<S>, boolean>\n : SlotValue<S> | Env.Entry<string, any, SlotValue<S>, false>;\n\ntype Bindings<E> = { readonly [K in RequiredKeys<E>]: Slot<E[K]> } & {\n readonly [K in Exclude<keyof E, RequiredKeys<E>>]?: Slot<E[K]>;\n};\n\n/**\n * `B` keeps the bindings as written, so `App.make` can see which backends their\n * entries come from. `[C]` for the reason `ArgsField` gives: a bare `C` widens\n * an inline constant to `string`.\n */\ntype EnvField<C, B> = [C] extends [{ readonly env: infer E }]\n ? [RequiredKeys<E>] extends [never]\n ? { readonly env?: B & Bindings<E> & NoExtra<B, E> }\n : { readonly env: B & Bindings<E> & NoExtra<B, E> }\n : { readonly env?: never };\n\ntype NoExtra<B, E> = { readonly [K in Exclude<keyof B, keyof E>]: never };\n\n/**\n * The client constructor's parameters after the native mount decide whether\n * `options` is absent, optional or required. A client that takes no native\n * mount cannot be mounted. That branch is an object, not `never`, so the\n * literal `name` and `args` beside it keep their types.\n */\ntype OptionsField<C extends Component.Descriptor> =\n Parameters<C[\"client\"]> extends [unknown, ...infer Rest]\n ? Rest extends []\n ? { readonly options?: never }\n : Rest extends [infer O]\n ? { readonly options: O }\n : Rest extends [options?: infer O]\n ? { readonly options?: Exclude<O, undefined> }\n : never\n : { readonly options: never };\n\nexport type Client<C extends Component.Descriptor> = ReturnType<C[\"client\"]>;\n\nexport interface Data<C extends Component.Descriptor = Component.Descriptor> {\n readonly component: C;\n readonly name: string;\n readonly httpPrefix?: App.HttpPrefix;\n readonly env?: Readonly<Record<string, string | Env.AnyEntry | undefined>>;\n readonly args?: unknown;\n readonly options?: unknown;\n}\n\n/**\n * What a mount was declared with, as written: its HTTP prefix and env bindings.\n */\nexport interface Declared<\n P extends App.HttpPrefix | undefined = App.HttpPrefix | undefined,\n B = unknown,\n> {\n readonly httpPrefix: P;\n readonly env: B;\n}\n\n/**\n * A mounted Convex component. Yield it for its client. Its default is the\n * component's client over this mount, and `Effect.provideService` replaces it.\n */\nexport interface Mount<\n C extends Component.Descriptor,\n Name extends string,\n D extends Declared = Declared,\n> extends Context.Reference<Client<C>> {\n readonly [TypeId]: Data<C> & { readonly name: Name };\n readonly \"~declared\"?: D;\n}\n\nexport type Any = Mount<Component.Descriptor, string>;\n\nexport type NameOf<M> = M extends Mount<any, infer N, any> ? N : never;\n\ntype InitArgs<C> = C extends { readonly init: infer I extends Component.Init }\n ? Ref.Args<I>\n : never;\n\ntype CallbackSlot<C> = {\n [K in keyof InitArgs<C>]-?: NonNullable<InitArgs<C>[K]> extends Handle\n ? K\n : never;\n}[keyof InitArgs<C>] &\n string;\n\ntype SlotArgs<C, K extends PropertyKey> = Extract<\n NonNullable<InitArgs<C>[K & keyof InitArgs<C>]>,\n Handle\n>[\"args\"][\"fields\"];\n\n/**\n * `callbackArgs`, on a mount whose descriptor carries its contract.\n */\ntype CallbackArgs<C, Name extends string> = C extends {\n readonly contract: Component.Component<any, infer From, any>;\n}\n ? {\n /**\n * A callback slot's contract args, with the component's ids typed for\n * this mount, for the host function that answers the callback.\n */\n readonly callbackArgs: <const K extends CallbackSlot<C>>(\n slot: K,\n ) => GenericId.RebaseSchema<\n Schema.Struct<SlotArgs<C, K>>,\n From,\n Component.MountScope<IdScope.App, Name>\n >[\"fields\"];\n }\n : unknown;\n\n/**\n * Mount a Convex component, as Convex's `app.use` does, in the host's\n * `confect/<mount>.ts`. `args` is typed from the component's `init`, `env` from\n * its env slots, and `options` from its client constructor. A handler reaches\n * the client with `yield* BulkEmail`.\n *\n * ```ts\n * export const BulkEmail = Mount.make(Email, {\n * name: \"bulkEmail\",\n * httpPrefix: \"/bulk-email\",\n * env: { RESEND_API_KEY: env.BULK_RESEND_KEY },\n * args: {\n * fromName: \"School office\",\n * onEvent: refs.internal.circulars.onEmailEvent,\n * },\n * });\n * ```\n */\nexport const make = <\n C extends Component.Descriptor,\n const Name extends string,\n const A extends Input<ArgsOf<C>>,\n const P extends App.HttpPrefix = never,\n const B = {},\n>(\n component: C,\n options: {\n readonly name: Name;\n readonly httpPrefix?: P;\n } & EnvField<C, B> &\n ArgsField<C, A> &\n OptionsField<C>,\n): Mount<C, Name, Declared<[P] extends [never] ? undefined : P, B>> &\n CallbackArgs<C, Name> => {\n const data = { ...(options as object), component } as Data<C> & {\n readonly name: Name;\n };\n // The options were checked against the constructor's parameters above.\n const client = component.client as unknown as (\n native: unknown,\n options?: unknown,\n ) => Client<C>;\n const native = () => componentsGeneric()[data.name];\n const mount = Context.Reference<Client<C>>(`mount/${data.name}`, {\n defaultValue: () => client(native(), data.options),\n });\n const { contract, init } = component;\n const callbackArgs = (slot: string) => {\n const field = init!.args.fields[slot]!;\n const callback = SchemaAST.resolveAt<Callback.Any>(CallbackContract)(\n Schema.toEncoded(field).ast,\n )!;\n const bound = Component.bind(contract!, native() as never);\n return Component.schema(bound, callback.functionProvenance.args).fields;\n };\n return Object.assign(\n mount,\n { [TypeId]: data },\n contract === undefined ? {} : { callbackArgs },\n ) as Mount<C, Name, Declared<[P] extends [never] ? undefined : P, B>> &\n CallbackArgs<C, Name>;\n};\n\n/**\n * What a mount was declared with: its component, name, HTTP prefix, env, args\n * and options.\n */\nexport const data = <C extends Component.Descriptor, Name extends string>(\n mount: Mount<C, Name, Declared>,\n): Data<C> & { readonly name: Name } => mount[TypeId];\n"],"mappings":";;;;;;;;;;;;AAaA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;AA2Nf,MAAa,QAOX,WACA,YAOyB;CACzB,MAAM,OAAO;EAAE,GAAI;EAAoB;CAAU;CAIjD,MAAM,SAAS,UAAU;CAIzB,MAAM,eAAe,kBAAkB,CAAC,CAAC,KAAK;CAC9C,MAAM,QAAQ,QAAQ,UAAqB,SAAS,KAAK,QAAQ,EAC/D,oBAAoB,OAAO,OAAO,GAAG,KAAK,OAAO,EACnD,CAAC;CACD,MAAM,EAAE,UAAU,SAAS;CAC3B,MAAM,gBAAgB,SAAiB;EACrC,MAAM,QAAQ,KAAM,KAAK,OAAO;EAChC,MAAM,WAAW,UAAU,UAAwB,gBAAgB,CAAC,CAClE,OAAO,UAAU,KAAK,CAAC,CAAC,GAC1B;EACA,MAAM,QAAQA,KAAe,UAAW,OAAO,CAAU;EACzD,OAAOC,OAAiB,OAAO,SAAS,mBAAmB,IAAI,CAAC,CAAC;CACnE;CACA,OAAO,OAAO,OACZ,OACA,GAAG,SAAS,KAAK,GACjB,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,aAAa,CAC/C;AAEF;;;;;AAMA,MAAa,QACX,UACsC,MAAM"}
|
package/dist/PaginationError.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
|
-
import { ConvexError } from "convex/values";
|
|
4
3
|
import * as Match from "effect/Match";
|
|
5
4
|
import * as Option from "effect/Option";
|
|
5
|
+
import { ConvexError } from "convex/values";
|
|
6
6
|
//#region src/PaginationError.ts
|
|
7
7
|
var PaginationError_exports = /* @__PURE__ */ __exportAll({
|
|
8
8
|
InvalidCursor: () => InvalidCursor,
|
package/dist/Ref.js
CHANGED
|
@@ -5,10 +5,10 @@ import { getFunctionReference } from "./RefInternal.js";
|
|
|
5
5
|
import * as Schema from "effect/Schema";
|
|
6
6
|
import * as Predicate from "effect/Predicate";
|
|
7
7
|
import { getFunctionAddress } from "convex/server";
|
|
8
|
-
import { ConvexError } from "convex/values";
|
|
9
|
-
import * as Effect from "effect/Effect";
|
|
10
8
|
import * as Match from "effect/Match";
|
|
11
9
|
import * as Option from "effect/Option";
|
|
10
|
+
import { ConvexError } from "convex/values";
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
12
|
//#region src/Ref.ts
|
|
13
13
|
var Ref_exports = /* @__PURE__ */ __exportAll({
|
|
14
14
|
TypeId: () => TypeId,
|
package/dist/Refs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { getConvexFunctionName, make as make$1 } from "./Ref.js";
|
|
3
3
|
import { groups } from "./Spec.js";
|
|
4
|
-
import * as Option from "effect/Option";
|
|
5
4
|
import { pipe } from "effect/Function";
|
|
6
5
|
import * as Record from "effect/Record";
|
|
6
|
+
import * as Option from "effect/Option";
|
|
7
7
|
//#region src/Refs.ts
|
|
8
8
|
var Refs_exports = /* @__PURE__ */ __exportAll({ make: () => make });
|
|
9
9
|
const make = (spec) => {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { CallbackContract } from "./internal/annotations.js";
|
|
3
2
|
import { app } from "./IdScope.js";
|
|
4
3
|
import { scope, tableName } from "./GenericId.js";
|
|
4
|
+
import { CallbackContract } from "./internal/annotations.js";
|
|
5
5
|
import * as Schema from "effect/Schema";
|
|
6
6
|
import * as Predicate from "effect/Predicate";
|
|
7
7
|
import * as Data from "effect/Data";
|
|
8
|
-
import
|
|
9
|
-
import * as Effect from "effect/Effect";
|
|
10
|
-
import * as Match from "effect/Match";
|
|
11
|
-
import * as Option from "effect/Option";
|
|
8
|
+
import * as SchemaAST from "effect/SchemaAST";
|
|
12
9
|
import * as Array from "effect/Array";
|
|
13
10
|
import { pipe } from "effect/Function";
|
|
14
|
-
import * as
|
|
11
|
+
import * as Match from "effect/Match";
|
|
12
|
+
import * as Option from "effect/Option";
|
|
13
|
+
import { v } from "convex/values";
|
|
14
|
+
import * as Effect from "effect/Effect";
|
|
15
15
|
import * as Number from "effect/Number";
|
|
16
16
|
import * as String from "effect/String";
|
|
17
17
|
//#region src/SchemaToValidator.ts
|
package/dist/SystemFields.js
CHANGED
|
@@ -2,13 +2,13 @@ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { GenericId } from "./GenericId.js";
|
|
3
3
|
import * as Schema from "effect/Schema";
|
|
4
4
|
import * as Predicate from "effect/Predicate";
|
|
5
|
-
import * as
|
|
6
|
-
import * as Effect from "effect/Effect";
|
|
7
|
-
import * as Option from "effect/Option";
|
|
5
|
+
import * as SchemaAST from "effect/SchemaAST";
|
|
8
6
|
import * as Array from "effect/Array";
|
|
9
7
|
import { pipe } from "effect/Function";
|
|
10
8
|
import * as Record from "effect/Record";
|
|
11
|
-
import * as
|
|
9
|
+
import * as Option from "effect/Option";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import * as SchemaGetter from "effect/SchemaGetter";
|
|
12
12
|
import * as SchemaTransformation from "effect/SchemaTransformation";
|
|
13
13
|
import * as Struct from "effect/Struct";
|
|
14
14
|
//#region src/SystemFields.ts
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * as Identifier from "./Identifier.js";
|
|
|
15
15
|
export * as Lazy from "./Lazy.js";
|
|
16
16
|
export * as Manifest from "./Manifest.js";
|
|
17
17
|
export * as ManifestSection from "./ManifestSection.js";
|
|
18
|
+
export * as Mount from "./Mount.js";
|
|
18
19
|
export * as MiddlewareAttachment from "./MiddlewareAttachment.js";
|
|
19
20
|
export * as MiddlewareSpec from "./MiddlewareSpec.js";
|
|
20
21
|
export * as PaginationError from "./PaginationError.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,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,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,oBAAoB,MAAM,2BAA2B,CAAC;AAClE,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,sBAAsB,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,16 +7,17 @@ import { MiddlewareSpec_exports } from "./MiddlewareSpec.js";
|
|
|
7
7
|
import { RuntimeAndFunctionType_exports } from "./RuntimeAndFunctionType.js";
|
|
8
8
|
import { FunctionSpec_exports } from "./FunctionSpec.js";
|
|
9
9
|
import { ActionCall_exports } from "./ActionCall.js";
|
|
10
|
-
import { App_exports } from "./App.js";
|
|
11
|
-
import { Auth_exports } from "./Auth.js";
|
|
12
|
-
import { Ref_exports } from "./Ref.js";
|
|
13
|
-
import { Callback_exports } from "./Callback.js";
|
|
14
10
|
import { IdScope_exports } from "./IdScope.js";
|
|
15
11
|
import { GenericId_exports } from "./GenericId.js";
|
|
12
|
+
import { Ref_exports } from "./Ref.js";
|
|
16
13
|
import { MiddlewareAttachment_exports } from "./MiddlewareAttachment.js";
|
|
17
14
|
import { GroupSpec_exports } from "./GroupSpec.js";
|
|
18
15
|
import { Spec_exports } from "./Spec.js";
|
|
19
16
|
import { Component_exports } from "./Component.js";
|
|
17
|
+
import { Mount_exports } from "./Mount.js";
|
|
18
|
+
import { App_exports } from "./App.js";
|
|
19
|
+
import { Auth_exports } from "./Auth.js";
|
|
20
|
+
import { Callback_exports } from "./Callback.js";
|
|
20
21
|
import { Env_exports } from "./Env.js";
|
|
21
22
|
import { GroupPath_exports } from "./GroupPath.js";
|
|
22
23
|
import { Http_exports } from "./Http.js";
|
|
@@ -30,4 +31,4 @@ import { SystemFields_exports } from "./SystemFields.js";
|
|
|
30
31
|
import { Table_exports } from "./Table.js";
|
|
31
32
|
import { Types_exports } from "./Types.js";
|
|
32
33
|
import { UserIdentity_exports } from "./UserIdentity.js";
|
|
33
|
-
export { ActionCall_exports as ActionCall, App_exports as App, Auth_exports as Auth, Callback_exports as Callback, Component_exports as Component, Env_exports as Env, FunctionProvenance_exports as FunctionProvenance, FunctionSpec_exports as FunctionSpec, GenericId_exports as GenericId, GroupPath_exports as GroupPath, GroupSpec_exports as GroupSpec, Http_exports as Http, IdScope_exports as IdScope, Identifier_exports as Identifier, Lazy_exports as Lazy, Manifest_exports as Manifest, ManifestSection_exports as ManifestSection, MiddlewareAttachment_exports as MiddlewareAttachment, MiddlewareSpec_exports as MiddlewareSpec, PaginationError_exports as PaginationError, PaginationOptions_exports as PaginationOptions, PaginationResult_exports as PaginationResult, Profile_exports as Profile, Ref_exports as Ref, Refs_exports as Refs, RuntimeAndFunctionType_exports as RuntimeAndFunctionType, SchemaToValidator_exports as SchemaToValidator, Spec_exports as Spec, SystemFields_exports as SystemFields, Table_exports as Table, Types_exports as Types, UserIdentity_exports as UserIdentity };
|
|
34
|
+
export { ActionCall_exports as ActionCall, App_exports as App, Auth_exports as Auth, Callback_exports as Callback, Component_exports as Component, Env_exports as Env, FunctionProvenance_exports as FunctionProvenance, FunctionSpec_exports as FunctionSpec, GenericId_exports as GenericId, GroupPath_exports as GroupPath, GroupSpec_exports as GroupSpec, Http_exports as Http, IdScope_exports as IdScope, Identifier_exports as Identifier, Lazy_exports as Lazy, Manifest_exports as Manifest, ManifestSection_exports as ManifestSection, MiddlewareAttachment_exports as MiddlewareAttachment, MiddlewareSpec_exports as MiddlewareSpec, Mount_exports as Mount, PaginationError_exports as PaginationError, PaginationOptions_exports as PaginationOptions, PaginationResult_exports as PaginationResult, Profile_exports as Profile, Ref_exports as Ref, Refs_exports as Refs, RuntimeAndFunctionType_exports as RuntimeAndFunctionType, SchemaToValidator_exports as SchemaToValidator, Spec_exports as Spec, SystemFields_exports as SystemFields, Table_exports as Table, Types_exports as Types, UserIdentity_exports as UserIdentity };
|