@confect/core 10.0.0-next.0 → 10.0.0-next.10
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/CHANGELOG.md +112 -0
- package/dist/FunctionProvenance.d.ts +74 -3
- package/dist/FunctionProvenance.d.ts.map +1 -1
- package/dist/FunctionProvenance.js +44 -4
- package/dist/FunctionProvenance.js.map +1 -1
- package/dist/FunctionSpec.d.ts +42 -9
- package/dist/FunctionSpec.d.ts.map +1 -1
- package/dist/FunctionSpec.js +17 -4
- package/dist/FunctionSpec.js.map +1 -1
- package/dist/GenericId.js +2 -3
- package/dist/GenericId.js.map +1 -1
- package/dist/GroupPath.js +1 -2
- package/dist/GroupSpec.js +1 -2
- package/dist/GroupSpec.js.map +1 -1
- package/dist/Identifier.js +3 -4
- package/dist/Identifier.js.map +1 -1
- package/dist/Lazy.js +1 -2
- package/dist/Lazy.js.map +1 -1
- package/dist/PaginationOptions.d.ts +23 -0
- package/dist/PaginationOptions.d.ts.map +1 -0
- package/dist/PaginationOptions.js +29 -0
- package/dist/PaginationOptions.js.map +1 -0
- package/dist/PaginationResult.d.ts +1 -0
- package/dist/PaginationResult.d.ts.map +1 -1
- package/dist/PaginationResult.js +1 -2
- package/dist/PaginationResult.js.map +1 -1
- package/dist/Ref.d.ts +34 -5
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +51 -13
- package/dist/Ref.js.map +1 -1
- package/dist/Refs.js +1 -2
- package/dist/Refs.js.map +1 -1
- package/dist/Registry.js +1 -2
- package/dist/Registry.js.map +1 -1
- package/dist/RuntimeAndFunctionType.js +1 -2
- package/dist/RuntimeAndFunctionType.js.map +1 -1
- package/dist/Spec.js +1 -2
- package/dist/Spec.js.map +1 -1
- package/dist/SystemFields.d.ts.map +1 -1
- package/dist/SystemFields.js +2 -3
- package/dist/SystemFields.js.map +1 -1
- package/dist/Types.d.ts +1 -1
- package/dist/Types.d.ts.map +1 -1
- package/dist/Types.js +1 -2
- package/dist/Types.js.map +1 -1
- package/dist/UserIdentity.js +1 -2
- package/dist/UserIdentity.js.map +1 -1
- package/dist/_virtual/_rolldown/runtime.js +6 -11
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/tsconfig.src.tsbuildinfo +1 -1
- package/package.json +11 -10
- package/src/FunctionProvenance.ts +147 -4
- package/src/FunctionSpec.ts +67 -1
- package/src/PaginationOptions.ts +23 -0
- package/src/PaginationResult.ts +4 -0
- package/src/Ref.ts +90 -25
- package/src/SystemFields.ts +2 -5
- package/src/Types.ts +5 -1
- package/src/index.ts +1 -0
package/dist/Ref.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ref.js","names":[],"sources":["../src/Ref.ts"],"sourcesContent":["import type {\n FunctionReference as ConvexFunctionReference,\n FunctionVisibility,\n} from \"convex/server\";\nimport { makeFunctionReference } from \"convex/server\";\nimport type { Value } from \"convex/values\";\nimport { ConvexError } from \"convex/values\";\nimport * as Effect from \"effect/Effect\";\nimport * as Match from \"effect/Match\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\n\nexport interface Ref<\n _RuntimeAndFunctionType extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n _FunctionVisibility extends FunctionVisibility,\n _Args,\n _Returns,\n _Error = never,\n> {\n readonly _RuntimeAndFunctionType?: _RuntimeAndFunctionType;\n readonly _FunctionVisibility?: _FunctionVisibility;\n readonly _Args?: _Args;\n readonly _Returns?: _Returns;\n readonly _Error?: _Error;\n /** @internal */\n readonly functionSpec: FunctionSpec.AnyWithProps;\n /** @internal */\n readonly functionNamespace: string;\n}\n\nexport interface Any extends Ref<any, any, any, any, any> {}\n\nexport interface AnyInternal extends Ref<any, \"internal\", any, any, any> {}\n\nexport interface AnyPublic extends Ref<any, \"public\", any, any, any> {}\n\nexport interface AnyQuery extends Ref<\n RuntimeAndFunctionType.AnyQuery,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyMutation extends Ref<\n RuntimeAndFunctionType.AnyMutation,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyAction extends Ref<\n RuntimeAndFunctionType.AnyAction,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicQuery extends Ref<\n RuntimeAndFunctionType.AnyQuery,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicMutation extends Ref<\n RuntimeAndFunctionType.AnyMutation,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicAction extends Ref<\n RuntimeAndFunctionType.AnyAction,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport type GetRuntimeAndFunctionType<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType_\n : never;\n\nexport type GetRuntime<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType.GetRuntime<RuntimeAndFunctionType_>\n : never;\n\nexport type GetFunctionType<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_>\n : never;\n\nexport type GetFunctionVisibility<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer FunctionVisibility_,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? FunctionVisibility_\n : never;\n\nexport type Args<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer Args_,\n infer _Returns,\n infer _Error\n >\n ? Args_\n : never;\n\nexport type OptionalArgs<Ref_ extends Any> = keyof Args<Ref_> extends never\n ? [args?: Args<Ref_>]\n : [args: Args<Ref_>];\n\nexport type Returns<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer _Args,\n infer Returns_,\n infer _Error\n >\n ? Returns_\n : never;\n\nexport type Error<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer Error_\n >\n ? Error_\n : never;\n\nexport type FunctionReference<Ref_ extends Any> = ConvexFunctionReference<\n GetFunctionType<Ref_>,\n GetFunctionVisibility<Ref_>\n>;\n\nexport type FromFunctionSpec<FunctionSpec_ extends FunctionSpec.AnyWithProps> =\n Ref<\n FunctionSpec.GetRuntimeAndFunctionType<FunctionSpec_>,\n FunctionSpec.GetFunctionVisibility<FunctionSpec_>,\n FunctionSpec.Args<FunctionSpec_>,\n FunctionSpec.Returns<FunctionSpec_>,\n FunctionSpec.Error<FunctionSpec_>\n >;\n\nexport const make = <FunctionSpec_ extends FunctionSpec.AnyWithProps>(\n /**\n * The namespace portion of a Convex function name, i.e. the part before the\n * colon. For example, for `myGroupDir/myGroupMod:myFunc` this would be\n * `myGroupDir/myGroupMod`.\n */\n functionNamespace: string,\n functionSpec: FunctionSpec_,\n): FromFunctionSpec<FunctionSpec_> => ({ functionSpec, functionNamespace });\n\nexport const getConvexFunctionName = (ref: Any): string =>\n `${ref.functionNamespace}:${ref.functionSpec.name}`;\n\nconst functionReferenceCache = new Map<string, FunctionReference<Any>>();\n\nexport const getFunctionReference = <Ref_ extends Any>(\n ref: Ref_,\n): FunctionReference<Ref_> => {\n const functionName = getConvexFunctionName(ref);\n\n const cached = functionReferenceCache.get(functionName);\n if (cached !== undefined) {\n return cached as FunctionReference<Ref_>;\n }\n\n const functionReference = makeFunctionReference(functionName);\n functionReferenceCache.set(functionName, functionReference);\n\n return functionReference as FunctionReference<Ref_>;\n};\n\nexport const hasErrorSchema = (ref: Any): boolean =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\n \"Confect\",\n (confectFunctionProvenance) => \"error\" in confectFunctionProvenance,\n ),\n Match.tag(\"Convex\", () => false),\n Match.exhaustive,\n );\n\nexport const encodeArgs = <Ref_ extends Any>(\n ref: Ref_,\n args: Args<Ref_>,\n): Effect.Effect<unknown, Schema.SchemaError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.encodeEffect(confectFunctionProvenance.args)(args),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(args)),\n Match.exhaustive,\n );\n\nexport const decodeReturns = <Ref_ extends Any>(\n ref: Ref_,\n returns: unknown,\n): Effect.Effect<Returns<Ref_>, Schema.SchemaError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.decodeUnknownEffect(confectFunctionProvenance.returns)(returns),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(returns)),\n Match.exhaustive,\n );\n\nexport const encodeArgsSync = <Ref_ extends Any>(\n ref: Ref_,\n args: Args<Ref_>,\n): unknown =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.encodeSync(confectFunctionProvenance.args)(args),\n ),\n Match.tag(\"Convex\", () => args),\n Match.exhaustive,\n );\n\nexport const decodeArgsSync = <Ref_ extends Any>(\n ref: Ref_,\n encodedArgs: unknown,\n): Args<Ref_> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.decodeUnknownSync(confectFunctionProvenance.args)(encodedArgs),\n ),\n Match.tag(\"Convex\", () => encodedArgs),\n Match.exhaustive,\n ) as Args<Ref_>;\n\nexport const encodeReturnsSync = <Ref_ extends Any>(\n ref: Ref_,\n returns: Returns<Ref_>,\n): unknown =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.encodeSync(confectFunctionProvenance.returns)(returns),\n ),\n Match.tag(\"Convex\", () => returns),\n Match.exhaustive,\n );\n\nexport const decodeReturnsSync = <Ref_ extends Any>(\n ref: Ref_,\n encodedReturns: unknown,\n): Returns<Ref_> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.decodeUnknownSync(confectFunctionProvenance.returns)(\n encodedReturns,\n ),\n ),\n Match.tag(\"Convex\", () => encodedReturns),\n Match.exhaustive,\n ) as Returns<Ref_>;\n\nconst ConvexErrorIdentifier = Symbol.for(\"ConvexError\");\n\nexport const isConvexError = (error: unknown): error is ConvexError<Value> =>\n error instanceof ConvexError ||\n (typeof error === \"object\" &&\n error !== null &&\n ConvexErrorIdentifier in error);\n\n/**\n * Build a callback-style handler that decodes the ref's typed error from a\n * caught `ConvexError`, or else forwards the value to `mapUnknownError`. The\n * fallback is also invoked when the input *is* a `ConvexError` but the ref\n * doesn't declare a typed-error schema—by definition such a value falls\n * outside the ref's error contract. Useful when adapting non-Effect APIs (e.g.\n * emitter callbacks for streamed subscriptions) to the same error semantics\n * that `runWithCodec` provides.\n */\nexport const decodeErrorOrElse =\n <Ref_ extends Any, E>(ref: Ref_, mapUnknownError: (error: unknown) => E) =>\n (error: unknown): Error<Ref_> | E => {\n if (isConvexError(error)) {\n const decoded = decodeErrorSync(ref, error.data);\n if (Option.isSome(decoded)) {\n return decoded.value;\n }\n }\n return mapUnknownError(error);\n };\n\n/**\n * Decode `encodedError` against the ref's error schema. Returns `None` if the\n * ref doesn't declare a typed error (Confect ref without an `error` schema, or\n * a Convex-provenance ref)—by definition there's nothing to decode the value\n * into, and the caller is responsible for deciding what to do (typically:\n * surface the original value as a defect).\n */\nexport const decodeError = <Ref_ extends Any>(\n ref: Ref_,\n encodedError: unknown,\n): Effect.Effect<Option.Option<Error<Ref_>>, Schema.SchemaError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n \"error\" in confectFunctionProvenance\n ? Effect.map(\n Schema.decodeUnknownEffect(confectFunctionProvenance.error)(\n encodedError,\n ),\n Option.some,\n )\n : Effect.succeed(Option.none<Error<Ref_>>()),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(Option.none<Error<Ref_>>())),\n Match.exhaustive,\n );\n\n/**\n * Synchronous counterpart to `decodeError`. Throws on schema decode failure;\n * returns `None` when the ref doesn't declare a typed error.\n */\nexport const decodeErrorSync = <Ref_ extends Any>(\n ref: Ref_,\n encodedError: unknown,\n): Option.Option<Error<Ref_>> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n \"error\" in confectFunctionProvenance\n ? Option.some(\n Schema.decodeUnknownSync(confectFunctionProvenance.error)(\n encodedError,\n ) as Error<Ref_>,\n )\n : Option.none<Error<Ref_>>(),\n ),\n Match.tag(\"Convex\", () => Option.none<Error<Ref_>>()),\n Match.exhaustive,\n );\n\nexport const maybeDecodeErrorSync = <Ref_ extends Any>(\n ref: Ref_,\n error: unknown,\n): unknown =>\n isConvexError(error)\n ? Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n \"error\" in confectFunctionProvenance\n ? Schema.decodeUnknownSync(confectFunctionProvenance.error)(\n error.data,\n )\n : error,\n ),\n Match.tag(\"Convex\", () => error),\n Match.exhaustive,\n )\n : error;\n\n/**\n * Encode args via the ref's args schema, invoke `call`, decode returns via the\n * ref's returns schema, and translate any thrown `ConvexError` into the ref's\n * typed error. Anything else the Promise rejects with—network failures,\n * server-side runtime errors, validation failures, etc.—is passed to\n * `mapUnknownError` to be turned into a typed `E`, or surfaced as a defect when\n * no handler is provided.\n */\nexport const runWithCodec = <Ref_ extends Any, E = never>(\n ref: Ref_,\n args: Args<Ref_>,\n call: (\n functionReference: FunctionReference<Ref_>,\n encodedArgs: unknown,\n ) => PromiseLike<unknown>,\n mapUnknownError?: (error: unknown) => E,\n): Effect.Effect<Returns<Ref_>, E | Error<Ref_> | Schema.SchemaError> =>\n Effect.gen(function* () {\n const functionReference = getFunctionReference(ref);\n const functionProvenance = ref.functionSpec.functionProvenance;\n const invoke = (\n encodedArgs: unknown,\n ): Effect.Effect<unknown, Error<Ref_> | E> =>\n Effect.tryPromise({\n try: () => Promise.resolve(call(functionReference, encodedArgs)),\n catch: (error): Error<Ref_> | E => {\n if (isConvexError(error)) {\n const decoded = decodeErrorSync(ref, error.data);\n if (Option.isSome(decoded)) {\n return decoded.value;\n }\n }\n if (mapUnknownError !== undefined) {\n return mapUnknownError(error);\n }\n throw error;\n },\n });\n return yield* Match.value(functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Effect.gen(function* () {\n const encodedArgs = yield* Schema.encodeEffect(\n confectFunctionProvenance.args,\n )(args);\n const encodedReturns = yield* invoke(encodedArgs);\n return yield* Schema.decodeUnknownEffect(\n confectFunctionProvenance.returns,\n )(encodedReturns);\n }),\n ),\n Match.tag(\"Convex\", () => invoke(args)),\n Match.exhaustive,\n );\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAqLA,MAAa,QAMX,mBACA,kBACqC;CAAE;CAAc;CAAmB;AAE1E,MAAa,yBAAyB,QACpC,GAAG,IAAI,kBAAkB,GAAG,IAAI,aAAa;AAE/C,MAAM,yCAAyB,IAAI,KAAqC;AAExE,MAAa,wBACX,QAC4B;CAC5B,MAAM,eAAe,sBAAsB,IAAI;CAE/C,MAAM,SAAS,uBAAuB,IAAI,aAAa;AACvD,KAAI,WAAW,OACb,QAAO;CAGT,MAAM,oBAAoB,sBAAsB,aAAa;AAC7D,wBAAuB,IAAI,cAAc,kBAAkB;AAE3D,QAAO;;AAGT,MAAa,kBAAkB,QAC7B,MAAM,MAAM,IAAI,aAAa,mBAAmB,CAAC,KAC/C,MA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A,MACA,MAIA,oBAEA,OAAO,IAAI,aAAa;CACtB,MAAM,oBAAoB,qBAAqB,IAAI;CACnD,MAAM,qBAAqB,IAAI,aAAa;CAC5C,MAAM,UACJ,gBAEA,OAAO,WAAW;EAChB,WAAW,QAAQ,QAAQ,KAAK,mBAAmB,YAAY,CAAC;EAChE,QAAQ,UAA2B;AACjC,OAAI,cAAc,MAAM,EAAE;IACxB,MAAM,UAAU,gBAAgB,KAAK,MAAM,KAAK;AAChD,QAAI,OAAO,OAAO,QAAQ,CACxB,QAAO,QAAQ;;AAGnB,OAAI,oBAAoB,OACtB,QAAO,gBAAgB,MAAM;AAE/B,SAAM;;EAET,CAAC;AACJ,QAAO,OAAO,MAAM,MAAM,mBAAmB,CAAC,KAC5C,MAAM,IAAI,YAAY,8BACpB,OAAO,IAAI,aAAa;EAItB,MAAM,iBAAiB,OAAO,OAHV,OAAO,OAAO,aAChC,0BAA0B,KAC3B,CAAC,KAAK,CAC0C;AACjD,SAAO,OAAO,OAAO,oBACnB,0BAA0B,QAC3B,CAAC,eAAe;GACjB,CACH,EACD,MAAM,IAAI,gBAAgB,OAAO,KAAK,CAAC,EACvC,MAAM,WACP;EACD"}
|
|
1
|
+
{"version":3,"file":"Ref.js","names":[],"sources":["../src/Ref.ts"],"sourcesContent":["import type {\n FunctionReference as ConvexFunctionReference,\n FunctionVisibility,\n PaginationOptions,\n PaginationResult,\n} from \"convex/server\";\nimport { makeFunctionReference } from \"convex/server\";\nimport type { Value } from \"convex/values\";\nimport { ConvexError } from \"convex/values\";\nimport * as Effect from \"effect/Effect\";\nimport * as Match from \"effect/Match\";\nimport * as Option from \"effect/Option\";\nimport * as Schema from \"effect/Schema\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport type * as RuntimeAndFunctionType from \"./RuntimeAndFunctionType\";\n\nexport interface Ref<\n _RuntimeAndFunctionType extends RuntimeAndFunctionType.RuntimeAndFunctionType,\n _FunctionVisibility extends FunctionVisibility,\n _Args,\n _Returns,\n _Error = never,\n> {\n readonly _RuntimeAndFunctionType?: _RuntimeAndFunctionType;\n readonly _FunctionVisibility?: _FunctionVisibility;\n readonly _Args?: _Args;\n readonly _Returns?: _Returns;\n readonly _Error?: _Error;\n /** @internal */\n readonly functionSpec: FunctionSpec.AnyWithProps;\n /** @internal */\n readonly functionNamespace: string;\n}\n\nexport interface Any extends Ref<any, any, any, any, any> {}\n\nexport interface AnyInternal extends Ref<any, \"internal\", any, any, any> {}\n\nexport interface AnyPublic extends Ref<any, \"public\", any, any, any> {}\n\nexport interface AnyQuery extends Ref<\n RuntimeAndFunctionType.AnyQuery,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicPaginatedQuery extends Ref<\n RuntimeAndFunctionType.AnyQuery,\n \"public\",\n {\n [key: string]: any;\n paginationOpts: PaginationOptions;\n },\n PaginationResult<any>,\n any\n> {}\n\nexport interface AnyMutation extends Ref<\n RuntimeAndFunctionType.AnyMutation,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyAction extends Ref<\n RuntimeAndFunctionType.AnyAction,\n FunctionVisibility,\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicQuery extends Ref<\n RuntimeAndFunctionType.AnyQuery,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicMutation extends Ref<\n RuntimeAndFunctionType.AnyMutation,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport interface AnyPublicAction extends Ref<\n RuntimeAndFunctionType.AnyAction,\n \"public\",\n any,\n any,\n any\n> {}\n\nexport type GetRuntimeAndFunctionType<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType_\n : never;\n\nexport type GetRuntime<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType.GetRuntime<RuntimeAndFunctionType_>\n : never;\n\nexport type GetFunctionType<Ref_> =\n Ref_ extends Ref<\n infer RuntimeAndFunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? RuntimeAndFunctionType.GetFunctionType<RuntimeAndFunctionType_>\n : never;\n\nexport type GetFunctionVisibility<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer FunctionVisibility_,\n infer _Args,\n infer _Returns,\n infer _Error\n >\n ? FunctionVisibility_\n : never;\n\nexport type Args<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer Args_,\n infer _Returns,\n infer _Error\n >\n ? Args_\n : never;\n\nexport type OptionalArgs<Ref_ extends Any> = keyof Args<Ref_> extends never\n ? [args?: Args<Ref_>]\n : [args: Args<Ref_>];\n\nexport type Returns<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer _Args,\n infer Returns_,\n infer _Error\n >\n ? Returns_\n : never;\n\nexport type Error<Ref_> =\n Ref_ extends Ref<\n infer _RuntimeAndFunctionType,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns,\n infer Error_\n >\n ? Error_\n : never;\n\nexport type FunctionReference<Ref_ extends Any> = ConvexFunctionReference<\n GetFunctionType<Ref_>,\n GetFunctionVisibility<Ref_>\n>;\n\nexport type FromFunctionSpec<FunctionSpec_ extends FunctionSpec.AnyWithProps> =\n Ref<\n FunctionSpec.GetRuntimeAndFunctionType<FunctionSpec_>,\n FunctionSpec.GetFunctionVisibility<FunctionSpec_>,\n FunctionSpec.Args<FunctionSpec_>,\n FunctionSpec.Returns<FunctionSpec_>,\n FunctionSpec.Error<FunctionSpec_>\n >;\n\nexport const make = <FunctionSpec_ extends FunctionSpec.AnyWithProps>(\n /**\n * The namespace portion of a Convex function name, i.e. the part before the\n * colon. For example, for `myGroupDir/myGroupMod:myFunc` this would be\n * `myGroupDir/myGroupMod`.\n */\n functionNamespace: string,\n functionSpec: FunctionSpec_,\n): FromFunctionSpec<FunctionSpec_> => ({ functionSpec, functionNamespace });\n\nexport const getConvexFunctionName = (ref: Any): string =>\n `${ref.functionNamespace}:${ref.functionSpec.name}`;\n\nconst functionReferenceCache = new Map<string, FunctionReference<Any>>();\n\nexport const getFunctionReference = <Ref_ extends Any>(\n ref: Ref_,\n): FunctionReference<Ref_> => {\n const functionName = getConvexFunctionName(ref);\n\n const cached = functionReferenceCache.get(functionName);\n if (cached !== undefined) {\n return cached as FunctionReference<Ref_>;\n }\n\n const functionReference = makeFunctionReference(functionName);\n functionReferenceCache.set(functionName, functionReference);\n\n return functionReference as FunctionReference<Ref_>;\n};\n\nexport const hasErrorSchema = (ref: Any): boolean =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\n \"Confect\",\n (confectFunctionProvenance) => \"error\" in confectFunctionProvenance,\n ),\n Match.tag(\"Convex\", () => false),\n Match.exhaustive,\n );\n\nexport const encodeArgs = <Ref_ extends Any>(\n ref: Ref_,\n args: Args<Ref_>,\n): Effect.Effect<unknown, Schema.SchemaError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.encodeEffect(confectFunctionProvenance.args)(args),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(args)),\n Match.exhaustive,\n );\n\nexport const decodeReturns = <Ref_ extends Any>(\n ref: Ref_,\n returns: unknown,\n): Effect.Effect<Returns<Ref_>, Schema.SchemaError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.decodeUnknownEffect(confectFunctionProvenance.returns)(returns),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(returns)),\n Match.exhaustive,\n );\n\nexport const encodeArgsSync = <Ref_ extends Any>(\n ref: Ref_,\n args: Args<Ref_>,\n): unknown =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.encodeSync(confectFunctionProvenance.args)(args),\n ),\n Match.tag(\"Convex\", () => args),\n Match.exhaustive,\n );\n\nexport const decodeArgsSync = <Ref_ extends Any>(\n ref: Ref_,\n encodedArgs: unknown,\n): Args<Ref_> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.decodeUnknownSync(confectFunctionProvenance.args)(encodedArgs),\n ),\n Match.tag(\"Convex\", () => encodedArgs),\n Match.exhaustive,\n ) as Args<Ref_>;\n\nexport const encodeReturnsSync = <Ref_ extends Any>(\n ref: Ref_,\n returns: Returns<Ref_>,\n): unknown =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.encodeSync(confectFunctionProvenance.returns)(returns),\n ),\n Match.tag(\"Convex\", () => returns),\n Match.exhaustive,\n );\n\nexport const decodeReturnsSync = <Ref_ extends Any>(\n ref: Ref_,\n encodedReturns: unknown,\n): Returns<Ref_> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Schema.decodeUnknownSync(confectFunctionProvenance.returns)(\n encodedReturns,\n ),\n ),\n Match.tag(\"Convex\", () => encodedReturns),\n Match.exhaustive,\n ) as Returns<Ref_>;\n\nconst ConvexErrorIdentifier = Symbol.for(\"ConvexError\");\n\nexport const isConvexError = (error: unknown): error is ConvexError<Value> =>\n error instanceof ConvexError ||\n (typeof error === \"object\" &&\n error !== null &&\n ConvexErrorIdentifier in error);\n\n/**\n * Build a callback-style handler that decodes the ref's typed error from a\n * caught `ConvexError`, or else forwards the value to `mapUnknownError`. The\n * fallback is also invoked when the input *is* a `ConvexError` but the ref\n * doesn't declare a typed-error schema—by definition such a value falls\n * outside the ref's error contract. Useful when adapting non-Effect APIs (e.g.\n * emitter callbacks for streamed subscriptions) to the same error semantics\n * that `runWithCodec` provides.\n */\nexport const decodeErrorOrElse =\n <Ref_ extends Any, E>(ref: Ref_, mapUnknownError: (error: unknown) => E) =>\n (error: unknown): Error<Ref_> | E => {\n if (isConvexError(error)) {\n const decoded = decodeErrorOption(ref, error.data);\n if (Option.isSome(decoded)) {\n return decoded.value;\n }\n }\n return mapUnknownError(error);\n };\n\n/**\n * Decode `encodedError` against the ref's error schema. Returns `None` if the\n * ref doesn't declare a typed error (Confect ref without an `error` schema, or\n * a Convex-provenance ref)—by definition there's nothing to decode the value\n * into, and the caller is responsible for deciding what to do (typically:\n * surface the original value as a defect).\n */\nexport const decodeError = <Ref_ extends Any>(\n ref: Ref_,\n encodedError: unknown,\n): Effect.Effect<Option.Option<Error<Ref_>>, Schema.SchemaError> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n \"error\" in confectFunctionProvenance\n ? Effect.map(\n Schema.decodeUnknownEffect(confectFunctionProvenance.error)(\n encodedError,\n ),\n Option.some,\n )\n : Effect.succeed(Option.none<Error<Ref_>>()),\n ),\n Match.tag(\"Convex\", () => Effect.succeed(Option.none<Error<Ref_>>())),\n Match.exhaustive,\n );\n\n/**\n * Synchronous counterpart to `decodeError`. Returns `None` when the value is\n * not this ref's typed error — either because the ref declares no `error`\n * schema, or because `encodedError` doesn't match the one it declares.\n *\n * The second case is reachable in normal operation: Convex raises its own\n * `ConvexError`s (an `InvalidCursor` pagination error, for instance), and\n * those never match a user-declared error schema. Callers pair this with a\n * fallback that surfaces the original error, so failing to decode must not\n * throw — a `ParseError` here would replace the real error with an opaque one\n * and lose the only useful diagnostic. Hence the `Option` suffix rather than\n * `Sync`, matching `Schema.decodeUnknownOption`: the sibling `*Sync` helpers\n * in this module all throw on a parse failure, and this one deliberately\n * doesn't.\n */\nexport const decodeErrorOption = <Ref_ extends Any>(\n ref: Ref_,\n encodedError: unknown,\n): Option.Option<Error<Ref_>> =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n \"error\" in confectFunctionProvenance\n ? (Schema.decodeUnknownOption(confectFunctionProvenance.error)(\n encodedError,\n ) as Option.Option<Error<Ref_>>)\n : Option.none<Error<Ref_>>(),\n ),\n Match.tag(\"Convex\", () => Option.none<Error<Ref_>>()),\n Match.exhaustive,\n );\n\nconst missingPaginatedProvenanceError = (ref: Any) =>\n new globalThis.Error(\n `Paginated query ref \"${getConvexFunctionName(ref)}\" was not built with ` +\n \"`FunctionSpec.publicPaginatedQuery` (or `FunctionSpec.internalPaginatedQuery`). \" +\n \"Paginated encoding and decoding require the user-args and item schemas \" +\n \"those constructors store. Define the function as, e.g.:\\n\\n\" +\n \" FunctionSpec.publicPaginatedQuery({\\n\" +\n ' name: \"...\",\\n' +\n \" args: () => Schema.Struct({ ... }), // optional; without paginationOpts\\n\" +\n \" item: () => ItemSchema,\\n\" +\n \" })\",\n );\n\n/**\n * Encode the args of a paginated query ref via its user-args schema —\n * `paginationOpts` is excluded, since the pagination protocol fields are\n * managed by the client (e.g. `usePaginatedQuery` from `convex/react`), not by\n * the caller. Requires a ref built with `FunctionSpec.publicPaginatedQuery`\n * (or `internalPaginatedQuery`).\n */\nexport const encodePaginatedQueryArgsSync = <\n Ref_ extends AnyPublicPaginatedQuery,\n>(\n ref: Ref_,\n args: Omit<Args<Ref_>, \"paginationOpts\">,\n): unknown =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) => {\n if (confectFunctionProvenance.kind._tag !== \"Paginated\") {\n throw missingPaginatedProvenanceError(ref);\n }\n return Schema.encodeUnknownSync(confectFunctionProvenance.kind.userArgs)(\n args,\n );\n }),\n Match.tag(\"Convex\", () => args),\n Match.exhaustive,\n );\n\n/**\n * Decode a page of a paginated query's results via the ref's item schema.\n * Requires a ref built with `FunctionSpec.publicPaginatedQuery` (or\n * `internalPaginatedQuery`).\n */\nexport const decodePaginationPageSync = <Ref_ extends AnyPublicPaginatedQuery>(\n ref: Ref_,\n encodedPage: unknown,\n): Returns<Ref_>[\"page\"] =>\n Match.value(ref.functionSpec.functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) => {\n if (confectFunctionProvenance.kind._tag !== \"Paginated\") {\n throw missingPaginatedProvenanceError(ref);\n }\n return Schema.decodeUnknownSync(confectFunctionProvenance.kind.page)(\n encodedPage,\n );\n }),\n Match.tag(\"Convex\", () => encodedPage),\n Match.exhaustive,\n ) as Returns<Ref_>[\"page\"];\n\n/**\n * Encode args via the ref's args schema, invoke `call`, decode returns via the\n * ref's returns schema, and translate any thrown `ConvexError` into the ref's\n * typed error. Anything else the Promise rejects with—network failures,\n * server-side runtime errors, validation failures, etc.—is passed to\n * `mapUnknownError` to be turned into a typed `E`, or surfaced as a defect when\n * no handler is provided.\n */\nexport const runWithCodec = <Ref_ extends Any, E = never>(\n ref: Ref_,\n args: Args<Ref_>,\n call: (\n functionReference: FunctionReference<Ref_>,\n encodedArgs: unknown,\n ) => PromiseLike<unknown>,\n mapUnknownError?: (error: unknown) => E,\n): Effect.Effect<Returns<Ref_>, E | Error<Ref_> | Schema.SchemaError> =>\n Effect.gen(function* () {\n const functionReference = getFunctionReference(ref);\n const functionProvenance = ref.functionSpec.functionProvenance;\n const invoke = (\n encodedArgs: unknown,\n ): Effect.Effect<unknown, Error<Ref_> | E> =>\n Effect.tryPromise({\n try: () => Promise.resolve(call(functionReference, encodedArgs)),\n catch: (error): Error<Ref_> | E => {\n if (isConvexError(error)) {\n const decoded = decodeErrorOption(ref, error.data);\n if (Option.isSome(decoded)) {\n return decoded.value;\n }\n }\n if (mapUnknownError !== undefined) {\n return mapUnknownError(error);\n }\n throw error;\n },\n });\n return yield* Match.value(functionProvenance).pipe(\n Match.tag(\"Confect\", (confectFunctionProvenance) =>\n Effect.gen(function* () {\n const encodedArgs = yield* Schema.encodeEffect(\n confectFunctionProvenance.args,\n )(args);\n const encodedReturns = yield* invoke(encodedArgs);\n return yield* Schema.decodeUnknownE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IAAI,aAAa;CAC5C,MAAM,UACJ,gBAEA,OAAO,WAAW;EAChB,WAAW,QAAQ,QAAQ,KAAK,mBAAmB,WAAW,CAAC;EAC/D,QAAQ,UAA2B;GACjC,IAAI,cAAc,KAAK,GAAG;IACxB,MAAM,UAAU,kBAAkB,KAAK,MAAM,IAAI;IACjD,IAAI,OAAO,OAAO,OAAO,GACvB,OAAO,QAAQ;GAEnB;GACA,IAAI,oBAAoB,KAAA,GACtB,OAAO,gBAAgB,KAAK;GAE9B,MAAM;EACR;CACF,CAAC;CACH,OAAO,OAAO,MAAM,MAAM,kBAAkB,CAAC,CAAC,KAC5C,MAAM,IAAI,YAAY,8BACpB,OAAO,IAAI,aAAa;EACtB,MAAM,cAAc,OAAO,OAAO,aAChC,0BAA0B,IAC5B,CAAC,CAAC,IAAI;EACN,MAAM,iBAAiB,OAAO,OAAO,WAAW;EAChD,OAAO,OAAO,OAAO,oBACnB,0BAA0B,OAC5B,CAAC,CAAC,cAAc;CAClB,CAAC,CACH,GACA,MAAM,IAAI,gBAAgB,OAAO,IAAI,CAAC,GACtC,MAAM,UACR;AACF,CAAC"}
|
package/dist/Refs.js
CHANGED
|
@@ -3,7 +3,6 @@ import { getConvexFunctionName, make as make$1 } from "./Ref.js";
|
|
|
3
3
|
import * as Option from "effect/Option";
|
|
4
4
|
import * as Record from "effect/Record";
|
|
5
5
|
import { pipe } from "effect/Function";
|
|
6
|
-
|
|
7
6
|
//#region src/Refs.ts
|
|
8
7
|
var Refs_exports = /* @__PURE__ */ __exportAll({ make: () => make });
|
|
9
8
|
const make = (spec) => {
|
|
@@ -22,7 +21,7 @@ const makeHelper = (groups, functionNamespace = Option.none()) => pipe(groups, R
|
|
|
22
21
|
throw new Error(`Group and function at same level have same name ('${getConvexFunctionName(_function)}')`);
|
|
23
22
|
});
|
|
24
23
|
}));
|
|
25
|
-
|
|
26
24
|
//#endregion
|
|
27
25
|
export { Refs_exports, make };
|
|
26
|
+
|
|
28
27
|
//# sourceMappingURL=Refs.js.map
|
package/dist/Refs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Refs.js","names":["Ref.make","Ref.getConvexFunctionName"],"sources":["../src/Refs.ts"],"sourcesContent":["import type { Types } from \"effect\";\nimport { pipe } from \"effect/Function\";\nimport * as Option from \"effect/Option\";\nimport * as Record from \"effect/Record\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport type * as GroupSpec from \"./GroupSpec\";\nimport * as Ref from \"./Ref\";\nimport type * as Spec from \"./Spec\";\n\nexport type Refs<\n Spec_ extends Spec.AnyWithProps,\n Predicate extends Ref.Any = Ref.Any,\n> = Types.Simplify<OmitEmpty<Helper<Spec.Groups<Spec_>, Predicate>>>;\n\nexport interface FromSpec<Spec_ extends Spec.AnyWithProps> {\n public: Refs<Spec_, Ref.AnyPublic>;\n internal: Refs<Spec_, Ref.AnyInternal>;\n}\n\ntype GroupRefs<\n Group extends GroupSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> = Types.Simplify<\n OmitEmpty<Helper<GroupSpec.Groups<Group>, Predicate>> &\n FilteredFunctions<GroupSpec.Functions<Group>, Predicate>\n>;\n\ntype OmitEmpty<T> = {\n [K in keyof T as keyof T[K] extends never ? never : K]: T[K];\n};\n\ntype FunctionSpecMatchesPredicate<\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> =\n Ref.Ref<\n FunctionSpec.GetRuntimeAndFunctionType<FunctionSpec_>,\n FunctionSpec.GetFunctionVisibility<FunctionSpec_>,\n any,\n any\n > extends Predicate\n ? true\n : false;\n\ntype FilteredFunctions<\n FunctionSpecs extends FunctionSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> = {\n [Name in FunctionSpec.Name<FunctionSpecs> as FunctionSpec.WithName<\n FunctionSpecs,\n Name\n > extends infer FunctionSpec_ extends FunctionSpec.AnyWithProps\n ? FunctionSpecMatchesPredicate<FunctionSpec_, Predicate> extends true\n ? Name\n : never\n : never]: FunctionSpec.WithName<FunctionSpecs, Name> extends infer F extends\n FunctionSpec.AnyWithProps\n ? Ref.FromFunctionSpec<F>\n : never;\n};\n\ntype Helper<\n Groups extends GroupSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> = {\n [GroupName in GroupSpec.Name<Groups>]: GroupSpec.WithName<\n Groups,\n GroupName\n > extends infer Group extends GroupSpec.AnyWithProps\n ? GroupRefs<Group, Predicate>\n : never;\n};\n\ntype Any =\n | {\n readonly [key: string]: Any;\n }\n | Ref.Any;\n\nexport const make = <Spec_ extends Spec.AnyWithProps>(\n spec: Spec_,\n): FromSpec<Spec_> => {\n const refs = makeHelper(spec.groups);\n return {\n public: refs as Refs<Spec_, Ref.AnyPublic>,\n internal: refs as Refs<Spec_, Ref.AnyInternal>,\n };\n};\n\nconst makeHelper = (\n groups: Record.ReadonlyRecord<string, GroupSpec.Any>,\n functionNamespace: Option.Option<string> = Option.none(),\n): Any =>\n pipe(\n groups as Record.ReadonlyRecord<string, GroupSpec.AnyWithProps>,\n Record.map((group, name) => {\n const currentFunctionNamespace = Option.match(functionNamespace, {\n onNone: () => name,\n onSome: (parentNamespace) => `${parentNamespace}/${name}`,\n });\n\n return Record.union(\n makeHelper(group.groups, Option.some(currentFunctionNamespace)),\n Record.map(group.functions, (function_) =>\n Ref.make(currentFunctionNamespace, function_),\n ),\n (_subGroup, _function) => {\n throw new Error(\n `Group and function at same level have same name ('${Ref.getConvexFunctionName(_function)}')`,\n );\n },\n );\n }),\n );\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Refs.js","names":["Ref.make","Ref.getConvexFunctionName"],"sources":["../src/Refs.ts"],"sourcesContent":["import type { Types } from \"effect\";\nimport { pipe } from \"effect/Function\";\nimport * as Option from \"effect/Option\";\nimport * as Record from \"effect/Record\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\nimport type * as GroupSpec from \"./GroupSpec\";\nimport * as Ref from \"./Ref\";\nimport type * as Spec from \"./Spec\";\n\nexport type Refs<\n Spec_ extends Spec.AnyWithProps,\n Predicate extends Ref.Any = Ref.Any,\n> = Types.Simplify<OmitEmpty<Helper<Spec.Groups<Spec_>, Predicate>>>;\n\nexport interface FromSpec<Spec_ extends Spec.AnyWithProps> {\n public: Refs<Spec_, Ref.AnyPublic>;\n internal: Refs<Spec_, Ref.AnyInternal>;\n}\n\ntype GroupRefs<\n Group extends GroupSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> = Types.Simplify<\n OmitEmpty<Helper<GroupSpec.Groups<Group>, Predicate>> &\n FilteredFunctions<GroupSpec.Functions<Group>, Predicate>\n>;\n\ntype OmitEmpty<T> = {\n [K in keyof T as keyof T[K] extends never ? never : K]: T[K];\n};\n\ntype FunctionSpecMatchesPredicate<\n FunctionSpec_ extends FunctionSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> =\n Ref.Ref<\n FunctionSpec.GetRuntimeAndFunctionType<FunctionSpec_>,\n FunctionSpec.GetFunctionVisibility<FunctionSpec_>,\n any,\n any\n > extends Predicate\n ? true\n : false;\n\ntype FilteredFunctions<\n FunctionSpecs extends FunctionSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> = {\n [Name in FunctionSpec.Name<FunctionSpecs> as FunctionSpec.WithName<\n FunctionSpecs,\n Name\n > extends infer FunctionSpec_ extends FunctionSpec.AnyWithProps\n ? FunctionSpecMatchesPredicate<FunctionSpec_, Predicate> extends true\n ? Name\n : never\n : never]: FunctionSpec.WithName<FunctionSpecs, Name> extends infer F extends\n FunctionSpec.AnyWithProps\n ? Ref.FromFunctionSpec<F>\n : never;\n};\n\ntype Helper<\n Groups extends GroupSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> = {\n [GroupName in GroupSpec.Name<Groups>]: GroupSpec.WithName<\n Groups,\n GroupName\n > extends infer Group extends GroupSpec.AnyWithProps\n ? GroupRefs<Group, Predicate>\n : never;\n};\n\ntype Any =\n | {\n readonly [key: string]: Any;\n }\n | Ref.Any;\n\nexport const make = <Spec_ extends Spec.AnyWithProps>(\n spec: Spec_,\n): FromSpec<Spec_> => {\n const refs = makeHelper(spec.groups);\n return {\n public: refs as Refs<Spec_, Ref.AnyPublic>,\n internal: refs as Refs<Spec_, Ref.AnyInternal>,\n };\n};\n\nconst makeHelper = (\n groups: Record.ReadonlyRecord<string, GroupSpec.Any>,\n functionNamespace: Option.Option<string> = Option.none(),\n): Any =>\n pipe(\n groups as Record.ReadonlyRecord<string, GroupSpec.AnyWithProps>,\n Record.map((group, name) => {\n const currentFunctionNamespace = Option.match(functionNamespace, {\n onNone: () => name,\n onSome: (parentNamespace) => `${parentNamespace}/${name}`,\n });\n\n return Record.union(\n makeHelper(group.groups, Option.some(currentFunctionNamespace)),\n Record.map(group.functions, (function_) =>\n Ref.make(currentFunctionNamespace, function_),\n ),\n (_subGroup, _function) => {\n throw new Error(\n `Group and function at same level have same name ('${Ref.getConvexFunctionName(_function)}')`,\n );\n },\n );\n }),\n );\n"],"mappings":";;;;;;;AA+EA,MAAa,QACX,SACoB;CACpB,MAAM,OAAO,WAAW,KAAK,MAAM;CACnC,OAAO;EACL,QAAQ;EACR,UAAU;CACZ;AACF;AAEA,MAAM,cACJ,QACA,oBAA2C,OAAO,KAAK,MAEvD,KACE,QACA,OAAO,KAAK,OAAO,SAAS;CAC1B,MAAM,2BAA2B,OAAO,MAAM,mBAAmB;EAC/D,cAAc;EACd,SAAS,oBAAoB,GAAG,gBAAgB,GAAG;CACrD,CAAC;CAED,OAAO,OAAO,MACZ,WAAW,MAAM,QAAQ,OAAO,KAAK,wBAAwB,CAAC,GAC9D,OAAO,IAAI,MAAM,YAAY,cAC3BA,OAAS,0BAA0B,SAAS,CAC9C,IACC,WAAW,cAAc;EACxB,MAAM,IAAI,MACR,qDAAqDC,sBAA0B,SAAS,EAAE,GAC5F;CACF,CACF;AACF,CAAC,CACH"}
|
package/dist/Registry.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import * as Context from "effect/Context";
|
|
3
3
|
import * as Ref from "effect/Ref";
|
|
4
|
-
|
|
5
4
|
//#region src/Registry.ts
|
|
6
5
|
var Registry_exports = /* @__PURE__ */ __exportAll({ Registry: () => Registry });
|
|
7
6
|
/**
|
|
@@ -14,7 +13,7 @@ var Registry_exports = /* @__PURE__ */ __exportAll({ Registry: () => Registry })
|
|
|
14
13
|
* by string key.
|
|
15
14
|
*/
|
|
16
15
|
const Registry = Context.Reference("@confect/core/Registry", { defaultValue: () => Ref.makeUnsafe({}) });
|
|
17
|
-
|
|
18
16
|
//#endregion
|
|
19
17
|
export { Registry, Registry_exports };
|
|
18
|
+
|
|
20
19
|
//# sourceMappingURL=Registry.js.map
|
package/dist/Registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Registry.js","names":[],"sources":["../src/Registry.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Ref from \"effect/Ref\";\n\n/**\n * Recursive tree that mirrors a `Spec`'s group structure. Leaves are the\n * per-function items written by each `FunctionImpl`'s layer initializer. The\n * leaf type is intentionally `unknown` here so `@confect/core` does not need\n * to know about `@confect/server`'s `RegistryItem` shape; producers and\n * consumers (the server runtime and the CLI's `implValidation`) narrow as\n * needed.\n */\nexport interface RegistryItems {\n readonly [key: string]: unknown | RegistryItems;\n}\n\n/**\n * Effect `Context.Reference` keyed by `@confect/core/Registry`. Lives in\n * `@confect/core` so `@confect/server` (which writes to it from\n * `FunctionImpl` initializers and reads it from `RegisteredFunctions`) and\n * `@confect/cli` (which inspects it during impl validation) can share the\n * exact same `Ref` instance by importing the same tag — without relying on\n * Effect's global default-value cache to align two separately-defined tags\n * by string key.\n */\nexport const Registry = Context.Reference<Ref.Ref<RegistryItems>>(\n \"@confect/core/Registry\",\n {\n defaultValue: () => Ref.makeUnsafe<RegistryItems>({}),\n },\n);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Registry.js","names":[],"sources":["../src/Registry.ts"],"sourcesContent":["import * as Context from \"effect/Context\";\nimport * as Ref from \"effect/Ref\";\n\n/**\n * Recursive tree that mirrors a `Spec`'s group structure. Leaves are the\n * per-function items written by each `FunctionImpl`'s layer initializer. The\n * leaf type is intentionally `unknown` here so `@confect/core` does not need\n * to know about `@confect/server`'s `RegistryItem` shape; producers and\n * consumers (the server runtime and the CLI's `implValidation`) narrow as\n * needed.\n */\nexport interface RegistryItems {\n readonly [key: string]: unknown | RegistryItems;\n}\n\n/**\n * Effect `Context.Reference` keyed by `@confect/core/Registry`. Lives in\n * `@confect/core` so `@confect/server` (which writes to it from\n * `FunctionImpl` initializers and reads it from `RegisteredFunctions`) and\n * `@confect/cli` (which inspects it during impl validation) can share the\n * exact same `Ref` instance by importing the same tag — without relying on\n * Effect's global default-value cache to align two separately-defined tags\n * by string key.\n */\nexport const Registry = Context.Reference<Ref.Ref<RegistryItems>>(\n \"@confect/core/Registry\",\n {\n defaultValue: () => Ref.makeUnsafe<RegistryItems>({}),\n },\n);\n"],"mappings":";;;;;;;;;;;;;;AAwBA,MAAa,WAAW,QAAQ,UAC9B,0BACA,EACE,oBAAoB,IAAI,WAA0B,CAAC,CAAC,EACtD,CACF"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
|
-
|
|
3
2
|
//#region src/RuntimeAndFunctionType.ts
|
|
4
3
|
var RuntimeAndFunctionType_exports = /* @__PURE__ */ __exportAll({
|
|
5
4
|
ConvexAction: () => ConvexAction,
|
|
@@ -15,7 +14,7 @@ const ConvexQuery = make("Convex", "query");
|
|
|
15
14
|
const ConvexMutation = make("Convex", "mutation");
|
|
16
15
|
const ConvexAction = make("Convex", "action");
|
|
17
16
|
const NodeAction = make("Node", "action");
|
|
18
|
-
|
|
19
17
|
//#endregion
|
|
20
18
|
export { ConvexAction, ConvexMutation, ConvexQuery, NodeAction, RuntimeAndFunctionType_exports };
|
|
19
|
+
|
|
21
20
|
//# sourceMappingURL=RuntimeAndFunctionType.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeAndFunctionType.js","names":[],"sources":["../src/RuntimeAndFunctionType.ts"],"sourcesContent":["export type RuntimeAndFunctionType =\n | { readonly runtime: \"Convex\"; readonly functionType: \"query\" }\n | { readonly runtime: \"Convex\"; readonly functionType: \"mutation\" }\n | { readonly runtime: \"Convex\"; readonly functionType: \"action\" }\n | { readonly runtime: \"Node\"; readonly functionType: \"action\" };\n\nexport type Runtime = RuntimeAndFunctionType[\"runtime\"];\n\nconst make = <\n Runtime_ extends Runtime,\n FunctionType_ extends GetFunctionType<WithRuntime<Runtime_>>,\n>(\n runtime: Runtime_,\n functionType: FunctionType_,\n): { readonly runtime: Runtime_; readonly functionType: FunctionType_ } => ({\n runtime,\n functionType,\n});\n\nexport type AnyQuery = Extract<\n RuntimeAndFunctionType,\n { readonly functionType: \"query\" }\n>;\n\nexport type AnyMutation = Extract<\n RuntimeAndFunctionType,\n { readonly functionType: \"mutation\" }\n>;\n\nexport type AnyAction = Extract<\n RuntimeAndFunctionType,\n { readonly functionType: \"action\" }\n>;\n\nexport type WithRuntime<Runtime_ extends Runtime> = Extract<\n RuntimeAndFunctionType,\n { readonly runtime: Runtime_ }\n>;\n\nexport type GetRuntime<RuntimeAndFunctionType_ extends RuntimeAndFunctionType> =\n RuntimeAndFunctionType_[\"runtime\"];\n\nexport type GetFunctionType<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType,\n> = RuntimeAndFunctionType_[\"functionType\"];\n\nexport const ConvexQuery = make(\"Convex\", \"query\");\nexport type ConvexQuery = typeof ConvexQuery;\n\nexport const ConvexMutation = make(\"Convex\", \"mutation\");\nexport type ConvexMutation = typeof ConvexMutation;\n\nexport const ConvexAction = make(\"Convex\", \"action\");\nexport type ConvexAction = typeof ConvexAction;\n\nexport const NodeAction = make(\"Node\", \"action\");\nexport type NodeAction = typeof NodeAction;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"RuntimeAndFunctionType.js","names":[],"sources":["../src/RuntimeAndFunctionType.ts"],"sourcesContent":["export type RuntimeAndFunctionType =\n | { readonly runtime: \"Convex\"; readonly functionType: \"query\" }\n | { readonly runtime: \"Convex\"; readonly functionType: \"mutation\" }\n | { readonly runtime: \"Convex\"; readonly functionType: \"action\" }\n | { readonly runtime: \"Node\"; readonly functionType: \"action\" };\n\nexport type Runtime = RuntimeAndFunctionType[\"runtime\"];\n\nconst make = <\n Runtime_ extends Runtime,\n FunctionType_ extends GetFunctionType<WithRuntime<Runtime_>>,\n>(\n runtime: Runtime_,\n functionType: FunctionType_,\n): { readonly runtime: Runtime_; readonly functionType: FunctionType_ } => ({\n runtime,\n functionType,\n});\n\nexport type AnyQuery = Extract<\n RuntimeAndFunctionType,\n { readonly functionType: \"query\" }\n>;\n\nexport type AnyMutation = Extract<\n RuntimeAndFunctionType,\n { readonly functionType: \"mutation\" }\n>;\n\nexport type AnyAction = Extract<\n RuntimeAndFunctionType,\n { readonly functionType: \"action\" }\n>;\n\nexport type WithRuntime<Runtime_ extends Runtime> = Extract<\n RuntimeAndFunctionType,\n { readonly runtime: Runtime_ }\n>;\n\nexport type GetRuntime<RuntimeAndFunctionType_ extends RuntimeAndFunctionType> =\n RuntimeAndFunctionType_[\"runtime\"];\n\nexport type GetFunctionType<\n RuntimeAndFunctionType_ extends RuntimeAndFunctionType,\n> = RuntimeAndFunctionType_[\"functionType\"];\n\nexport const ConvexQuery = make(\"Convex\", \"query\");\nexport type ConvexQuery = typeof ConvexQuery;\n\nexport const ConvexMutation = make(\"Convex\", \"mutation\");\nexport type ConvexMutation = typeof ConvexMutation;\n\nexport const ConvexAction = make(\"Convex\", \"action\");\nexport type ConvexAction = typeof ConvexAction;\n\nexport const NodeAction = make(\"Node\", \"action\");\nexport type NodeAction = typeof NodeAction;\n"],"mappings":";;;;;;;;AAQA,MAAM,QAIJ,SACA,kBAC0E;CAC1E;CACA;AACF;AA6BA,MAAa,cAAc,KAAK,UAAU,OAAO;AAGjD,MAAa,iBAAiB,KAAK,UAAU,UAAU;AAGvD,MAAa,eAAe,KAAK,UAAU,QAAQ;AAGnD,MAAa,aAAa,KAAK,QAAQ,QAAQ"}
|
package/dist/Spec.js
CHANGED
|
@@ -2,7 +2,6 @@ import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { withName } from "./GroupSpec.js";
|
|
3
3
|
import * as Predicate from "effect/Predicate";
|
|
4
4
|
import * as Record from "effect/Record";
|
|
5
|
-
|
|
6
5
|
//#region src/Spec.ts
|
|
7
6
|
var Spec_exports = /* @__PURE__ */ __exportAll({
|
|
8
7
|
TypeId: () => TypeId,
|
|
@@ -22,7 +21,7 @@ const Proto = {
|
|
|
22
21
|
};
|
|
23
22
|
const makeProto = ({ groups }) => Object.assign(Object.create(Proto), { groups });
|
|
24
23
|
const make = () => makeProto({ groups: {} });
|
|
25
|
-
|
|
26
24
|
//#endregion
|
|
27
25
|
export { Spec_exports, TypeId, isSpec, make };
|
|
26
|
+
|
|
28
27
|
//# sourceMappingURL=Spec.js.map
|
package/dist/Spec.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spec.js","names":["GroupSpec.withName"],"sources":["../src/Spec.ts"],"sourcesContent":["import * as Predicate from \"effect/Predicate\";\nimport * as Record from \"effect/Record\";\nimport * as GroupSpec from \"./GroupSpec\";\n\nexport const TypeId = \"@confect/core/Spec\";\nexport type TypeId = typeof TypeId;\n\nexport const isSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\n/**\n * A Confect spec: a flat container of function groups. Groups may be of any\n * runtime — a group built with `GroupSpec.makeNode()` (a Node action group) sits\n * alongside `GroupSpec.make()` groups in the same namespace. The runtime of a\n * group lives on the group itself (`GroupSpec.runtime`) and on each function's\n * `RuntimeAndFunctionType`; the spec does not carry a runtime of its own.\n */\nexport interface Spec<Groups_ extends GroupSpec.AnyWithProps = never> {\n readonly [TypeId]: TypeId;\n readonly groups: {\n [GroupName in GroupSpec.Name<Groups_>]: GroupSpec.WithName<\n Groups_,\n GroupName\n >;\n };\n\n add<Group extends GroupSpec.AnyWithProps>(\n group: Group,\n ): Spec<Groups_ | Group>;\n\n addAt<const Name extends string, Group extends GroupSpec.AnyWithProps>(\n name: Name,\n group: Group,\n ): Spec<Groups_ | GroupSpec.NamedAt<Group, Name>>;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends Spec<GroupSpec.AnyWithProps> {}\n\nexport type Groups<Spec_ extends AnyWithProps> =\n Spec_[\"groups\"][keyof Spec_[\"groups\"]];\n\nconst Proto = {\n [TypeId]: TypeId,\n\n add<Group extends GroupSpec.AnyWithProps>(this: AnyWithProps, group: Group) {\n return makeProto({\n groups: Record.set(this.groups, group.name, group),\n });\n },\n\n addAt<Group extends GroupSpec.AnyWithProps>(\n this: AnyWithProps,\n name: string,\n group: Group,\n ) {\n return makeProto({\n groups: Record.set(this.groups, name, GroupSpec.withName(name, group)),\n });\n },\n};\n\nconst makeProto = <Groups_ extends GroupSpec.AnyWithProps>({\n groups,\n}: {\n groups: Record.ReadonlyRecord<string, Groups_>;\n}): Spec<Groups_> =>\n Object.assign(Object.create(Proto), {\n groups,\n });\n\nexport const make = (): Spec => makeProto({ groups: {} });\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Spec.js","names":["GroupSpec.withName"],"sources":["../src/Spec.ts"],"sourcesContent":["import * as Predicate from \"effect/Predicate\";\nimport * as Record from \"effect/Record\";\nimport * as GroupSpec from \"./GroupSpec\";\n\nexport const TypeId = \"@confect/core/Spec\";\nexport type TypeId = typeof TypeId;\n\nexport const isSpec = (u: unknown): u is AnyWithProps =>\n Predicate.hasProperty(u, TypeId);\n\n/**\n * A Confect spec: a flat container of function groups. Groups may be of any\n * runtime — a group built with `GroupSpec.makeNode()` (a Node action group) sits\n * alongside `GroupSpec.make()` groups in the same namespace. The runtime of a\n * group lives on the group itself (`GroupSpec.runtime`) and on each function's\n * `RuntimeAndFunctionType`; the spec does not carry a runtime of its own.\n */\nexport interface Spec<Groups_ extends GroupSpec.AnyWithProps = never> {\n readonly [TypeId]: TypeId;\n readonly groups: {\n [GroupName in GroupSpec.Name<Groups_>]: GroupSpec.WithName<\n Groups_,\n GroupName\n >;\n };\n\n add<Group extends GroupSpec.AnyWithProps>(\n group: Group,\n ): Spec<Groups_ | Group>;\n\n addAt<const Name extends string, Group extends GroupSpec.AnyWithProps>(\n name: Name,\n group: Group,\n ): Spec<Groups_ | GroupSpec.NamedAt<Group, Name>>;\n}\n\nexport interface Any {\n readonly [TypeId]: TypeId;\n}\n\nexport interface AnyWithProps extends Spec<GroupSpec.AnyWithProps> {}\n\nexport type Groups<Spec_ extends AnyWithProps> =\n Spec_[\"groups\"][keyof Spec_[\"groups\"]];\n\nconst Proto = {\n [TypeId]: TypeId,\n\n add<Group extends GroupSpec.AnyWithProps>(this: AnyWithProps, group: Group) {\n return makeProto({\n groups: Record.set(this.groups, group.name, group),\n });\n },\n\n addAt<Group extends GroupSpec.AnyWithProps>(\n this: AnyWithProps,\n name: string,\n group: Group,\n ) {\n return makeProto({\n groups: Record.set(this.groups, name, GroupSpec.withName(name, group)),\n });\n },\n};\n\nconst makeProto = <Groups_ extends GroupSpec.AnyWithProps>({\n groups,\n}: {\n groups: Record.ReadonlyRecord<string, Groups_>;\n}): Spec<Groups_> =>\n Object.assign(Object.create(Proto), {\n groups,\n });\n\nexport const make = (): Spec => makeProto({ groups: {} });\n"],"mappings":";;;;;;;;;;AAIA,MAAa,SAAS;AAGtB,MAAa,UAAU,MACrB,UAAU,YAAY,GAAG,MAAM;AAqCjC,MAAM,QAAQ;EACX,SAAS;CAEV,IAA8D,OAAc;EAC1E,OAAO,UAAU,EACf,QAAQ,OAAO,IAAI,KAAK,QAAQ,MAAM,MAAM,KAAK,EACnD,CAAC;CACH;CAEA,MAEE,MACA,OACA;EACA,OAAO,UAAU,EACf,QAAQ,OAAO,IAAI,KAAK,QAAQ,MAAMA,SAAmB,MAAM,KAAK,CAAC,EACvE,CAAC;CACH;AACF;AAEA,MAAM,aAAqD,EACzD,aAIA,OAAO,OAAO,OAAO,OAAO,KAAK,GAAG,EAClC,OACF,CAAC;AAEH,MAAa,aAAmB,UAAU,EAAE,QAAQ,CAAC,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemFields.d.ts","sourceRoot":"","sources":["../src/SystemFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAOhF,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,SAAS,MAAM,EAAE,WAAW,SAAS;;;EAIvE,CAAC;AAEL;;;GAGG;AACH,KAAK,eAAe,CAAC,SAAS,SAAS,MAAM,IAAI,UAAU,CACzD,OAAO,YAAY,CAAC,SAAS,CAAC,CAC/B,CAAC,QAAQ,CAAC,CAAC;AA4HZ;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,SAAS,MAAM,EACxB,WAAW,SAAS,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,EAE1C,WAAW,SAAS,EACpB,QAAQ,WAAW,KAClB,sBAAsB,CAAC,SAAS,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"SystemFields.d.ts","sourceRoot":"","sources":["../src/SystemFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,IAAI,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAOhF,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC;;GAEG;AACH,eAAO,MAAM,YAAY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CAAC,IAAI,MAAM,OAAO,GAAG,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;CACpE,CAAC,CACH,CACF,GACD,iBAAiB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAEhD;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,CAC1B,SAAS,SAAS,MAAM,EACxB,QAAQ,IACN,QAAQ,SAAS,OAAO,GACxB,OAAO,CAAC,SAAS,CAAC,GAAG,iBAAiB,GAAG,QAAQ,GACjD,KAAK,CAAC"}
|
package/dist/SystemFields.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { GenericId } from "./GenericId.js";
|
|
3
|
+
import * as Schema from "effect/Schema";
|
|
3
4
|
import * as Predicate from "effect/Predicate";
|
|
4
5
|
import * as Option from "effect/Option";
|
|
5
|
-
import * as Schema from "effect/Schema";
|
|
6
6
|
import * as SchemaAST from "effect/SchemaAST";
|
|
7
7
|
import * as Record from "effect/Record";
|
|
8
8
|
import * as Effect from "effect/Effect";
|
|
@@ -11,7 +11,6 @@ import * as Array from "effect/Array";
|
|
|
11
11
|
import * as SchemaGetter from "effect/SchemaGetter";
|
|
12
12
|
import * as SchemaTransformation from "effect/SchemaTransformation";
|
|
13
13
|
import * as Struct from "effect/Struct";
|
|
14
|
-
|
|
15
14
|
//#region src/SystemFields.ts
|
|
16
15
|
var SystemFields_exports = /* @__PURE__ */ __exportAll({
|
|
17
16
|
SystemFields: () => SystemFields,
|
|
@@ -95,7 +94,7 @@ const extendWithSystemFields = (tableName, schema) => {
|
|
|
95
94
|
};
|
|
96
95
|
return extend(schema);
|
|
97
96
|
};
|
|
98
|
-
|
|
99
97
|
//#endregion
|
|
100
98
|
export { SystemFields, SystemFields_exports, extendWithSystemFields };
|
|
99
|
+
|
|
101
100
|
//# sourceMappingURL=SystemFields.js.map
|
package/dist/SystemFields.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SystemFields.js","names":["GenericId.GenericId"],"sources":["../src/SystemFields.ts"],"sourcesContent":["import type { IdField, SystemFields as NonIdSystemFields } from \"convex/server\";\nimport { pipe } from \"effect/Function\";\nimport * as Array from \"effect/Array\";\nimport * as Effect from \"effect/Effect\";\nimport * as Option from \"effect/Option\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Record from \"effect/Record\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaAST from \"effect/SchemaAST\";\nimport * as SchemaGetter from \"effect/SchemaGetter\";\nimport * as SchemaTransformation from \"effect/SchemaTransformation\";\nimport * as Struct from \"effect/Struct\";\nimport * as GenericId from \"./GenericId\";\n\n/**\n * Produces a schema for Convex system fields. In Confect, system fields include `_id`.\n */\nexport const SystemFields = <TableName extends string>(tableName: TableName) =>\n Schema.Struct({\n _id: GenericId.GenericId(tableName),\n _creationTime: Schema.Number,\n });\n\n/**\n * The field map added to a table schema, derived from {@link SystemFields} so it\n * stays in lockstep with the runtime schema.\n */\ntype SystemFieldsFor<TableName extends string> = ReturnType<\n typeof SystemFields<TableName>\n>[\"fields\"];\n\n/**\n * The system field names, derived from {@link SystemFields} so they stay in\n * lockstep with the schema.\n */\nconst systemFieldNames: ReadonlyArray<string> = Record.keys(\n SystemFields(\"\").fields,\n);\n\nconst isSystemFieldKey = (key: string | symbol): key is string =>\n Predicate.isString(key) && Array.contains(systemFieldNames, key);\n\nconst splitSystemFields = (input: { [key: PropertyKey]: unknown }) => {\n const keys = Reflect.ownKeys(input);\n const pick = (pickedKeys: ReadonlyArray<string | symbol>) =>\n Record.fromEntries(\n Array.map(pickedKeys, (key) => [key, input[key]] as const),\n );\n return {\n system: pick(Array.filter(keys, isSystemFieldKey)),\n rest: pick(Array.filter(keys, Predicate.not(isSystemFieldKey))),\n };\n};\n\n/**\n * Wraps a transformation getter so the system fields bypass it: they are split\n * off the input before the user-defined getter runs and merged back into its\n * output. Transformations construct fresh objects, so without this the system\n * fields would be dropped at every transformation step.\n */\nconst wrapGetter = (\n getter: SchemaGetter.Getter<any, any, any>,\n): SchemaGetter.Getter<any, any, any> =>\n new SchemaGetter.Getter((input, options) => {\n if (Option.isNone(input) || !Predicate.isObject(input.value)) {\n return getter.run(input, options);\n }\n const { system, rest } = splitSystemFields(input.value);\n return getter\n .run(Option.some(rest), options)\n .pipe(\n Effect.map(\n Option.map((output) =>\n Predicate.isObject(output) ? Struct.assign(output, system) : output,\n ),\n ),\n );\n });\n\nconst wrapTransformation = (\n transformation: SchemaAST.Link[\"transformation\"],\n): SchemaTransformation.Transformation<any, any, any, any> => {\n if (!SchemaTransformation.isTransformation(transformation)) {\n throw new Error(\n \"Cannot extend a table schema that uses decoding/encoding middleware with system fields\",\n );\n }\n return new SchemaTransformation.Transformation(\n wrapGetter(transformation.decode),\n wrapGetter(transformation.encode),\n );\n};\n\n/**\n * Builds an AST walker that adds the given system-field property signatures to\n * every object node of a schema's AST — including each step of its encoding\n * chain — wrapping transformations so the fields survive them.\n */\nconst makeExtendAst = (\n systemPropertySignatures: ReadonlyArray<SchemaAST.PropertySignature>,\n) => {\n const extendEncoding = (encoding: SchemaAST.Encoding): SchemaAST.Encoding =>\n Array.map(\n encoding,\n (link) =>\n new SchemaAST.Link(\n extendAst(link.to),\n wrapTransformation(link.transformation),\n ),\n );\n\n const extendAst = (ast: SchemaAST.AST): SchemaAST.AST => {\n if (SchemaAST.isUnion(ast)) {\n return new SchemaAST.Union(\n Array.map(ast.types, extendAst),\n ast.mode,\n ast.annotations,\n ast.checks,\n ast.encoding === undefined ? undefined : extendEncoding(ast.encoding),\n ast.context,\n ast.encodingChecks,\n );\n }\n if (SchemaAST.isSuspend(ast)) {\n return new SchemaAST.Suspend(\n () => extendAst(ast.thunk()),\n ast.annotations,\n undefined,\n ast.encoding === undefined ? undefined : extendEncoding(ast.encoding),\n ast.context,\n );\n }\n if (SchemaAST.isObjects(ast)) {\n return new SchemaAST.Objects(\n Array.appendAll(ast.propertySignatures, systemPropertySignatures),\n ast.indexSignatures,\n ast.annotations,\n ast.checks,\n ast.encoding === undefined ? undefined : extendEncoding(ast.encoding),\n ast.context,\n ast.encodingChecks,\n );\n }\n throw new Error(\n ast._tag === \"Declaration\"\n ? \"Cannot extend a `Declaration` schema (such as a `Schema.Class`) with system fields: its decoded values are constructed instances, which cannot gain extra fields. Use a plain `Schema.Struct`, or transform to one with `Schema.decodeTo`.\"\n : `Cannot extend a \\`${ast._tag}\\` schema node with system fields: a table schema must resolve to an object shape at every step of its encoding.`,\n );\n };\n\n return extendAst;\n};\n\n/**\n * Extend a table schema with Convex system fields.\n *\n * A plain `Struct` gains the fields via `Schema.fieldsAssign` and a `Union`\n * has them distributed across its members, preserving the schema's\n * `Struct`/`Union` structure. Any other object-shaped schema — one built with\n * `Schema.decodeTo`/`Schema.encodeKeys`, a branded struct, a suspended schema\n * — is extended at the AST level: every object node in its encoding chain\n * gains the system fields, and each transformation is wrapped so the fields\n * bypass the user-defined getters. Schemas that do not resolve to an object\n * shape at every step (such as `Schema.Class`, whose decoded values are class\n * instances) are rejected with a descriptive error.\n *\n * Note that struct-level checks on an extended schema observe the value with\n * the system fields attached, and encoding an extended schema emits the system\n * fields alongside the table fields.\n */\nexport const extendWithSystemFields = <\n TableName extends string,\n TableSchema extends Schema.Codec<any, any>,\n>(\n tableName: TableName,\n schema: TableSchema,\n): ExtendWithSystemFields<TableName, TableSchema> => {\n const system = SystemFields(tableName).fields;\n\n const extendAst = makeExtendAst(\n pipe(\n system,\n Record.toEntries,\n Array.map(\n ([name, field]) => new SchemaAST.PropertySignature(name, field.ast),\n ),\n ),\n );\n\n const extend = (s: Schema.Top): Schema.Top => {\n if (\n s.ast.encoding === undefined &&\n SchemaAST.isUnion(s.ast) &&\n Array.isArray(\n (s as Partial<Schema.Union<ReadonlyArray<Schema.Top>>>).members,\n )\n ) {\n return Schema.Union(\n Array.map(\n (s as Schema.Union<ReadonlyArray<Schema.Top>>).members,\n extend,\n ),\n );\n }\n if (\n s.ast.encoding === undefined &&\n SchemaAST.isObjects(s.ast) &&\n typeof (s as Partial<Schema.Struct<Schema.Struct.Fields>>).mapFields ===\n \"function\"\n ) {\n return Schema.fieldsAssign(system)(\n s as Schema.Struct<Schema.Struct.Fields>,\n );\n }\n return Schema.make(extendAst(s.ast));\n };\n\n return extend(schema) as unknown as ExtendWithSystemFields<\n TableName,\n TableSchema\n >;\n};\n\n/**\n * Applies the system fields to a single struct, mirroring `Schema.fieldsAssign`.\n * Any other (already-extended or opaque) schema falls back to a `Codec` carrying\n * the system-field document shape.\n */\ntype ApplySystemFields<TableName extends string, S> =\n S extends Schema.Struct<infer Fields extends Schema.Struct.Fields>\n ? Schema.Struct<\n Struct.Simplify<Struct.Assign<Fields, SystemFieldsFor<TableName>>>\n >\n : S extends Schema.Codec<infer Type, infer Encoded>\n ? Schema.Codec<\n WithSystemFields<TableName, Type>,\n WithSystemFields<TableName, Encoded>\n >\n : never;\n\n/**\n * Extend a table schema with Convex system fields at the type level.\n *\n * This mirrors the runtime {@link extendWithSystemFields}: a `Struct` gains the\n * system fields directly (matching `Schema.fieldsAssign`), and a `Union` has\n * them distributed across its members (matching\n * `union.mapMembers(Tuple.map(Schema.fieldsAssign(...)))`). The `Struct`/`Union`\n * structure is preserved rather than collapsed to a bare `Codec`; any other\n * schema falls back to a `Codec` carrying the system-field document shape,\n * matching the runtime's AST-level extension.\n */\nexport type ExtendWithSystemFields<\n TableName extends string,\n TableSchema extends Schema.Top,\n> =\n TableSchema extends Schema.Union<\n infer Members extends ReadonlyArray<Schema.Top>\n >\n ? Schema.Union<\n Struct.Simplify<\n Readonly<{\n [K in keyof Members]: ExtendWithSystemFields<TableName, Members[K]>;\n }>\n >\n >\n : ApplySystemFields<TableName, TableSchema>;\n\n/**\n * The decoded/encoded document shape: a table's fields plus Convex's system\n * fields. Deliberately a bare intersection (no `Expand`/`Simplify`) — flattening\n * it with a homomorphic mapped type collapses to `{ [x: string]: any }` when\n * `Document` is still an unresolved generic, which breaks structural\n * comparability in the database reader/writer plumbing.\n */\nexport type WithSystemFields<\n TableName extends string,\n Document,\n> = Document extends unknown\n ? IdField<TableName> & NonIdSystemFields & Document\n : never;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiBA,MAAa,gBAA0C,cACrD,OAAO,OAAO;CACZ,KAAKA,UAAoB,UAAU;CACnC,eAAe,OAAO;CACvB,CAAC;;;;;AAcJ,MAAM,mBAA0C,OAAO,KACrD,aAAa,GAAG,CAAC,OAClB;AAED,MAAM,oBAAoB,QACxB,UAAU,SAAS,IAAI,IAAI,MAAM,SAAS,kBAAkB,IAAI;AAElE,MAAM,qBAAqB,UAA2C;CACpE,MAAM,OAAO,QAAQ,QAAQ,MAAM;CACnC,MAAM,QAAQ,eACZ,OAAO,YACL,MAAM,IAAI,aAAa,QAAQ,CAAC,KAAK,MAAM,KAAK,CAAU,CAC3D;AACH,QAAO;EACL,QAAQ,KAAK,MAAM,OAAO,MAAM,iBAAiB,CAAC;EAClD,MAAM,KAAK,MAAM,OAAO,MAAM,UAAU,IAAI,iBAAiB,CAAC,CAAC;EAChE;;;;;;;;AASH,MAAM,cACJ,WAEA,IAAI,aAAa,QAAQ,OAAO,YAAY;AAC1C,KAAI,OAAO,OAAO,MAAM,IAAI,CAAC,UAAU,SAAS,MAAM,MAAM,CAC1D,QAAO,OAAO,IAAI,OAAO,QAAQ;CAEnC,MAAM,EAAE,QAAQ,SAAS,kBAAkB,MAAM,MAAM;AACvD,QAAO,OACJ,IAAI,OAAO,KAAK,KAAK,EAAE,QAAQ,CAC/B,KACC,OAAO,IACL,OAAO,KAAK,WACV,UAAU,SAAS,OAAO,GAAG,OAAO,OAAO,QAAQ,OAAO,GAAG,OAC9D,CACF,CACF;EACH;AAEJ,MAAM,sBACJ,mBAC4D;AAC5D,KAAI,CAAC,qBAAqB,iBAAiB,eAAe,CACxD,OAAM,IAAI,MACR,yFACD;AAEH,QAAO,IAAI,qBAAqB,eAC9B,WAAW,eA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O,OAAO,MACZ,MAAM,IACH,EAA8C,SAC/C,OACD,CACF;AAEH,MACE,EAAE,IAAI,aAAa,UACnB,UAAU,UAAU,EAAE,IAAI,IAC1B,OAAQ,EAAmD,cACzD,WAEF,QAAO,OAAO,aAAa,OAAO,CAChC,EACD;AAEH,SAAO,OAAO,KAAK,UAAU,EAAE,IAAI,CAAC;;AAGtC,QAAO,OAAO,OAAO"}
|
|
1
|
+
{"version":3,"file":"SystemFields.js","names":["GenericId.GenericId"],"sources":["../src/SystemFields.ts"],"sourcesContent":["import type { IdField, SystemFields as NonIdSystemFields } from \"convex/server\";\nimport { pipe } from \"effect/Function\";\nimport * as Array from \"effect/Array\";\nimport * as Effect from \"effect/Effect\";\nimport * as Option from \"effect/Option\";\nimport * as Predicate from \"effect/Predicate\";\nimport * as Record from \"effect/Record\";\nimport * as Schema from \"effect/Schema\";\nimport * as SchemaAST from \"effect/SchemaAST\";\nimport * as SchemaGetter from \"effect/SchemaGetter\";\nimport * as SchemaTransformation from \"effect/SchemaTransformation\";\nimport * as Struct from \"effect/Struct\";\nimport * as GenericId from \"./GenericId\";\n\n/**\n * Produces a schema for Convex system fields. In Confect, system fields include `_id`.\n */\nexport const SystemFields = <TableName extends string>(tableName: TableName) =>\n Schema.Struct({\n _id: GenericId.GenericId(tableName),\n _creationTime: Schema.Number,\n });\n\n/**\n * The field map added to a table schema, derived from {@link SystemFields} so it\n * stays in lockstep with the runtime schema.\n */\ntype SystemFieldsFor<TableName extends string> = ReturnType<\n typeof SystemFields<TableName>\n>[\"fields\"];\n\n/**\n * The system field names, derived from {@link SystemFields} so they stay in\n * lockstep with the schema.\n */\nconst systemFieldNames: ReadonlyArray<string> = Record.keys(\n SystemFields(\"\").fields,\n);\n\nconst isSystemFieldKey = (key: string | symbol): key is string =>\n Predicate.isString(key) && Array.contains(systemFieldNames, key);\n\nconst splitSystemFields = (input: { [key: PropertyKey]: unknown }) => {\n const keys = Reflect.ownKeys(input);\n const pick = (pickedKeys: ReadonlyArray<string | symbol>) =>\n Record.fromEntries(\n Array.map(pickedKeys, (key) => [key, input[key]] as const),\n );\n return {\n system: pick(Array.filter(keys, isSystemFieldKey)),\n rest: pick(Array.filter(keys, Predicate.not(isSystemFieldKey))),\n };\n};\n\n/**\n * Wraps a transformation getter so the system fields bypass it: they are split\n * off the input before the user-defined getter runs and merged back into its\n * output. Transformations construct fresh objects, so without this the system\n * fields would be dropped at every transformation step.\n */\nconst wrapGetter = (\n getter: SchemaGetter.Getter<any, any, any>,\n): SchemaGetter.Getter<any, any, any> =>\n new SchemaGetter.Getter((input, options) => {\n if (Option.isNone(input) || !Predicate.isObject(input.value)) {\n return getter.run(input, options);\n }\n const { system, rest } = splitSystemFields(input.value);\n return getter\n .run(Option.some(rest), options)\n .pipe(\n Effect.map(\n Option.map((output) =>\n Predicate.isObject(output) ? Struct.assign(output, system) : output,\n ),\n ),\n );\n });\n\nconst wrapTransformation = (\n transformation: SchemaAST.Link[\"transformation\"],\n): SchemaTransformation.Transformation<any, any, any, any> => {\n if (!SchemaTransformation.isTransformation(transformation)) {\n throw new Error(\n \"Cannot extend a table schema that uses decoding/encoding middleware with system fields\",\n );\n }\n return new SchemaTransformation.Transformation(\n wrapGetter(transformation.decode),\n wrapGetter(transformation.encode),\n );\n};\n\n/**\n * Builds an AST walker that adds the given system-field property signatures to\n * every object node of a schema's AST — including each step of its encoding\n * chain — wrapping transformations so the fields survive them.\n */\nconst makeExtendAst = (\n systemPropertySignatures: ReadonlyArray<SchemaAST.PropertySignature>,\n) => {\n const extendEncoding = (encoding: SchemaAST.Encoding): SchemaAST.Encoding =>\n Array.map(\n encoding,\n (link) =>\n new SchemaAST.Link(\n extendAst(link.to),\n wrapTransformation(link.transformation),\n ),\n );\n\n const extendAst = (ast: SchemaAST.AST): SchemaAST.AST => {\n if (SchemaAST.isUnion(ast)) {\n return new SchemaAST.Union(\n Array.map(ast.types, extendAst),\n ast.mode,\n ast.annotations,\n ast.checks,\n ast.encoding === undefined ? undefined : extendEncoding(ast.encoding),\n ast.context,\n ast.encodingChecks,\n );\n }\n if (SchemaAST.isSuspend(ast)) {\n return new SchemaAST.Suspend(\n () => extendAst(ast.thunk()),\n ast.annotations,\n undefined,\n ast.encoding === undefined ? undefined : extendEncoding(ast.encoding),\n ast.context,\n );\n }\n if (SchemaAST.isObjects(ast)) {\n return new SchemaAST.Objects(\n Array.appendAll(ast.propertySignatures, systemPropertySignatures),\n ast.indexSignatures,\n ast.annotations,\n ast.checks,\n ast.encoding === undefined ? undefined : extendEncoding(ast.encoding),\n ast.context,\n ast.encodingChecks,\n );\n }\n throw new Error(\n ast._tag === \"Declaration\"\n ? \"Cannot extend a `Declaration` schema (such as a `Schema.Class`) with system fields: its decoded values are constructed instances, which cannot gain extra fields. Use a plain `Schema.Struct`, or transform to one with `Schema.decodeTo`.\"\n : `Cannot extend a \\`${ast._tag}\\` schema node with system fields: a table schema must resolve to an object shape at every step of its encoding.`,\n );\n };\n\n return extendAst;\n};\n\n/**\n * Extend a table schema with Convex system fields.\n *\n * A plain `Struct` gains the fields via `Schema.fieldsAssign` and a `Union`\n * has them distributed across its members, preserving the schema's\n * `Struct`/`Union` structure. Any other object-shaped schema — one built with\n * `Schema.decodeTo`/`Schema.encodeKeys`, a branded struct, a suspended schema\n * — is extended at the AST level: every object node in its encoding chain\n * gains the system fields, and each transformation is wrapped so the fields\n * bypass the user-defined getters. Schemas that do not resolve to an object\n * shape at every step (such as `Schema.Class`, whose decoded values are class\n * instances) are rejected with a descriptive error.\n *\n * Note that struct-level checks on an extended schema observe the value with\n * the system fields attached, and encoding an extended schema emits the system\n * fields alongside the table fields.\n */\nexport const extendWithSystemFields = <\n TableName extends string,\n TableSchema extends Schema.Codec<any, any>,\n>(\n tableName: TableName,\n schema: TableSchema,\n): ExtendWithSystemFields<TableName, TableSchema> => {\n const system = SystemFields(tableName).fields;\n\n const extendAst = makeExtendAst(\n pipe(\n system,\n Record.toEntries,\n Array.map(\n ([name, field]) => new SchemaAST.PropertySignature(name, field.ast),\n ),\n ),\n );\n\n const extend = (s: Schema.Top): Schema.Top => {\n if (\n s.ast.encoding === undefined &&\n SchemaAST.isUnion(s.ast) &&\n Array.isArray((s as { readonly members?: unknown }).members)\n ) {\n return Schema.Union(\n Array.map(\n (s as Schema.Union<ReadonlyArray<Schema.Top>>).members,\n extend,\n ),\n );\n }\n if (\n s.ast.encoding === undefined &&\n SchemaAST.isObjects(s.ast) &&\n typeof (s as { readonly mapFields?: unknown }).mapFields === \"function\"\n ) {\n return Schema.fieldsAssign(system)(\n s as Schema.Struct<Schema.Struct.Fields>,\n );\n }\n return Schema.make(extendAst(s.ast));\n };\n\n return extend(schema) as unknown as ExtendWithSystemFields<\n TableName,\n TableSchema\n >;\n};\n\n/**\n * Applies the system fields to a single struct, mirroring `Schema.fieldsAssign`.\n * Any other (already-extended or opaque) schema falls back to a `Codec` carrying\n * the system-field document shape.\n */\ntype ApplySystemFields<TableName extends string, S> =\n S extends Schema.Struct<infer Fields extends Schema.Struct.Fields>\n ? Schema.Struct<\n Struct.Simplify<Struct.Assign<Fields, SystemFieldsFor<TableName>>>\n >\n : S extends Schema.Codec<infer Type, infer Encoded>\n ? Schema.Codec<\n WithSystemFields<TableName, Type>,\n WithSystemFields<TableName, Encoded>\n >\n : never;\n\n/**\n * Extend a table schema with Convex system fields at the type level.\n *\n * This mirrors the runtime {@link extendWithSystemFields}: a `Struct` gains the\n * system fields directly (matching `Schema.fieldsAssign`), and a `Union` has\n * them distributed across its members (matching\n * `union.mapMembers(Tuple.map(Schema.fieldsAssign(...)))`). The `Struct`/`Union`\n * structure is preserved rather than collapsed to a bare `Codec`; any other\n * schema falls back to a `Codec` carrying the system-field document shape,\n * matching the runtime's AST-level extension.\n */\nexport type ExtendWithSystemFields<\n TableName extends string,\n TableSchema extends Schema.Top,\n> =\n TableSchema extends Schema.Union<\n infer Members extends ReadonlyArray<Schema.Top>\n >\n ? Schema.Union<\n Struct.Simplify<\n Readonly<{\n [K in keyof Members]: ExtendWithSystemFields<TableName, Members[K]>;\n }>\n >\n >\n : ApplySystemFields<TableName, TableSchema>;\n\n/**\n * The decoded/encoded document shape: a table's fields plus Convex's system\n * fields. Deliberately a bare intersection (no `Expand`/`Simplify`) — flattening\n * it with a homomorphic mapped type collapses to `{ [x: string]: any }` when\n * `Document` is still an unresolved generic, which breaks structural\n * comparability in the database reader/writer plumbing.\n */\nexport type WithSystemFields<\n TableName extends string,\n Document,\n> = Document extends unknown\n ? IdField<TableName> & NonIdSystemFields & Document\n : never;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAiBA,MAAa,gBAA0C,cACrD,OAAO,OAAO;CACZ,KAAKA,UAAoB,SAAS;CAClC,eAAe,OAAO;AACxB,CAAC;;;;;AAcH,MAAM,mBAA0C,OAAO,KACrD,aAAa,EAAE,CAAC,CAAC,MACnB;AAEA,MAAM,oBAAoB,QACxB,UAAU,SAAS,GAAG,KAAK,MAAM,SAAS,kBAAkB,GAAG;AAEjE,MAAM,qBAAqB,UAA2C;CACpE,MAAM,OAAO,QAAQ,QAAQ,KAAK;CAClC,MAAM,QAAQ,eACZ,OAAO,YACL,MAAM,IAAI,aAAa,QAAQ,CAAC,KAAK,MAAM,IAAI,CAAU,CAC3D;CACF,OAAO;EACL,QAAQ,KAAK,MAAM,OAAO,MAAM,gBAAgB,CAAC;EACjD,MAAM,KAAK,MAAM,OAAO,MAAM,UAAU,IAAI,gBAAgB,CAAC,CAAC;CAChE;AACF;;;;;;;AAQA,MAAM,cACJ,WAEA,IAAI,aAAa,QAAQ,OAAO,YAAY;CAC1C,IAAI,OAAO,OAAO,KAAK,KAAK,CAAC,UAAU,SAAS,MAAM,KAAK,GACzD,OAAO,OAAO,IAAI,OAAO,OAAO;CAElC,MAAM,EAAE,QAAQ,SAAS,kBAAkB,MAAM,KAAK;CACtD,OAAO,OACJ,IAAI,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,CAC/B,KACC,OAAO,IACL,OAAO,KAAK,WACV,UAAU,SAAS,MAA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AAS,CAAC,CAAC;CAEvC,MAAM,YAAY,cAChB,KACE,QACA,OAAO,WACP,MAAM,KACH,CAAC,MAAM,WAAW,IAAI,UAAU,kBAAkB,MAAM,MAAM,GAAG,CACpE,CACF,CACF;CAEA,MAAM,UAAU,MAA8B;EAC5C,IACE,EAAE,IAAI,aAAa,KAAA,KACnB,UAAU,QAAQ,EAAE,GAAG,KACvB,MAAM,QAAS,EAAqC,OAAO,GAE3D,OAAO,OAAO,MACZ,MAAM,IACH,EAA8C,SAC/C,MACF,CACF;EAEF,IACE,EAAE,IAAI,aAAa,KAAA,KACnB,UAAU,UAAU,EAAE,GAAG,KACzB,OAAQ,EAAuC,cAAc,YAE7D,OAAO,OAAO,aAAa,MAAM,CAAC,CAChC,CACF;EAEF,OAAO,OAAO,KAAK,UAAU,EAAE,GAAG,CAAC;CACrC;CAEA,OAAO,OAAO,MAAM;AAItB"}
|
package/dist/Types.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type IsValueLiteral<Vl> = [Vl] extends [never] ? never : IsUnion<Vl> exte
|
|
|
10
10
|
*/
|
|
11
11
|
export type IsRecord<T> = [T] extends [never] ? false : IsUnion<T> extends true ? false : T extends Record<string, infer V> ? string extends keyof T ? keyof T extends string ? T extends Record<string, V> ? Record<string, V> extends T ? true : false : false : false : false : false;
|
|
12
12
|
export type DeepMutable<T> = IsAny<T> extends true ? any : T extends NonRecursiveLeaf ? T : T extends ReadonlyMap<infer K, infer V> ? Map<DeepMutable<K>, DeepMutable<V>> : T extends ReadonlySet<infer V> ? Set<DeepMutable<V>> : [keyof T] extends [never] ? T : {
|
|
13
|
-
-readonly [K in keyof T]: DeepMutable<T[K]>;
|
|
13
|
+
-readonly [K in keyof T]: IsOptional<T, K> extends true ? DeepMutable<Exclude<T[K], undefined>> : DeepMutable<T[K]>;
|
|
14
14
|
};
|
|
15
15
|
export type TypeError<Message extends string, T = never> = [Message, T];
|
|
16
16
|
export type TypeDefect<Message extends string, T = never> = [Message, T];
|
package/d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AC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC;CAClD,CAAC"}
|
package/dist/Types.js
CHANGED
package/dist/Types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Types.js","names":[],"sources":["../src/Types.ts"],"sourcesContent":["import type {\n DocumentByName,\n FieldTypeFromFieldPath,\n GenericDatabaseReader,\n GenericDataModel,\n TableNamesInDataModel,\n} from \"convex/server\";\nimport type { GenericId } from \"convex/values\";\nimport type { Brand } from \"effect\";\n\nexport type IsOptional<T, K extends keyof T> =\n {} extends Pick<T, K> ? true : false;\n\nexport type IsAny<T> = 0 extends 1 & T ? true : false;\n\nexport type IsUnion<T, U extends T = T> = T extends unknown\n ? [U] extends [T]\n ? false\n : true\n : never;\n\n// https://stackoverflow.com/a/52806744\nexport type IsValueLiteral<Vl> = [Vl] extends [never]\n ? never\n : IsUnion<Vl> extends true\n ? false\n : [Vl] extends [string | number | bigint | boolean]\n ? [string] extends [Vl]\n ? false\n : [number] extends [Vl]\n ? false\n : [boolean] extends [Vl]\n ? false\n : [bigint] extends [Vl]\n ? false\n : true\n : false;\n\n/**\n * Only checks for records with string keys.\n */\nexport type IsRecord<T> = [T] extends [never]\n ? false\n : IsUnion<T> extends true\n ? false\n : T extends Record<string, infer V>\n ? string extends keyof T\n ? keyof T extends string\n ? T extends Record<string, V>\n ? Record<string, V> extends T\n ? true\n : false\n : false\n : false\n : false\n : false;\n\nexport type DeepMutable<T> =\n IsAny<T> extends true\n ? any\n : T extends NonRecursiveLeaf\n ? T\n : T extends ReadonlyMap<infer K, infer V>\n ? Map<DeepMutable<K>, DeepMutable<V>>\n : T extends ReadonlySet<infer V>\n ? Set<DeepMutable<V>>\n : [keyof T] extends [never]\n ? T\n : {
|
|
1
|
+
{"version":3,"file":"Types.js","names":[],"sources":["../src/Types.ts"],"sourcesContent":["import type {\n DocumentByName,\n FieldTypeFromFieldPath,\n GenericDatabaseReader,\n GenericDataModel,\n TableNamesInDataModel,\n} from \"convex/server\";\nimport type { GenericId } from \"convex/values\";\nimport type { Brand } from \"effect\";\n\nexport type IsOptional<T, K extends keyof T> =\n {} extends Pick<T, K> ? true : false;\n\nexport type IsAny<T> = 0 extends 1 & T ? true : false;\n\nexport type IsUnion<T, U extends T = T> = T extends unknown\n ? [U] extends [T]\n ? false\n : true\n : never;\n\n// https://stackoverflow.com/a/52806744\nexport type IsValueLiteral<Vl> = [Vl] extends [never]\n ? never\n : IsUnion<Vl> extends true\n ? false\n : [Vl] extends [string | number | bigint | boolean]\n ? [string] extends [Vl]\n ? false\n : [number] extends [Vl]\n ? false\n : [boolean] extends [Vl]\n ? false\n : [bigint] extends [Vl]\n ? false\n : true\n : false;\n\n/**\n * Only checks for records with string keys.\n */\nexport type IsRecord<T> = [T] extends [never]\n ? false\n : IsUnion<T> extends true\n ? false\n : T extends Record<string, infer V>\n ? string extends keyof T\n ? keyof T extends string\n ? T extends Record<string, V>\n ? Record<string, V> extends T\n ? true\n : false\n : false\n : false\n : false\n : false;\n\nexport type DeepMutable<T> =\n IsAny<T> extends true\n ? any\n : T extends NonRecursiveLeaf\n ? T\n : T extends ReadonlyMap<infer K, infer V>\n ? Map<DeepMutable<K>, DeepMutable<V>>\n : T extends ReadonlySet<infer V>\n ? Set<DeepMutable<V>>\n : [keyof T] extends [never]\n ? T\n : {\n -readonly [K in keyof T]: IsOptional<T, K> extends true\n ? DeepMutable<Exclude<T[K], undefined>>\n : DeepMutable<T[K]>;\n };\n\nexport type TypeError<Message extends string, T = never> = [Message, T];\n\nexport type TypeDefect<Message extends string, T = never> = [Message, T];\n\nexport type IsRecursive<T> = true extends DetectCycle<T> ? true : false;\n\ntype NonRecursiveLeaf = Brand.Brand<any> | GenericId<any> | ArrayBuffer;\n\ntype DetectCycle<T, Cache extends any[] = []> =\n IsAny<T> extends true\n ? false\n : [T] extends [any]\n ? T extends NonRecursiveLeaf\n ? false\n : T extends Cache[number]\n ? true\n : T extends Array<infer U>\n ? DetectCycle<U, [...Cache, T]>\n : T extends Map<infer _U, infer V>\n ? DetectCycle<V, [...Cache, T]>\n : T extends Set<infer U>\n ? DetectCycle<U, [...Cache, T]>\n : T extends object\n ? true extends {\n [K in keyof T]: DetectCycle<T[K], [...Cache, T]>;\n }[keyof T]\n ? true\n : false\n : false\n : never;\n\n//////////////////////////////////\n// START: Vendored from Arktype //\n//////////////////////////////////\n\n// https://github.com/arktypeio/arktype/blob/2e911d01a741ccee7a17e31ee144049817fabbb8/ark/util/unionToTuple.ts#L9\n\nexport type UnionToTuple<t> =\n _unionToTuple<t, []> extends infer result ? conform<result, t[]> : never;\n\ntype _unionToTuple<t, result extends unknown[]> =\n getLastBranch<t> extends infer current\n ? [t] extends [never]\n ? result\n : _unionToTuple<Exclude<t, current>, [current, ...result]>\n : never;\n\ntype getLastBranch<t> =\n intersectUnion<t extends unknown ? (x: t) => void : never> extends (\n x: infer branch,\n ) => void\n ? branch\n : never;\n\ntype intersectUnion<t> = (t extends unknown ? (_: t) => void : never) extends (\n _: infer intersection,\n) => void\n ? intersection\n : never;\n\ntype conform<t, base> = t extends base ? t : base;\n\n////////////////////////////////\n// END: Vendored from Arktype //\n////////////////////////////////\n\nexport type IndexFieldTypesForEq<\n ConvexDataModel extends GenericDataModel,\n Table extends TableNamesInDataModel<ConvexDataModel>,\n T extends string[],\n> = T extends readonly [...infer Rest, any]\n ? Rest extends readonly string[]\n ? {\n [K in keyof Rest]: FieldTypeFromFieldPath<\n DocumentByName<ConvexDataModel, Table>,\n Rest[K]\n >;\n }\n : never\n : never;\n\n// Would prefer to use `BaseDatabaseReader` from the `convex` package, but it's not exported.\nexport type BaseDatabaseReader<DataModel extends GenericDataModel> = {\n get: GenericDatabaseReader<DataModel>[\"get\"];\n query: GenericDatabaseReader<DataModel>[\"query\"];\n};\n"],"mappings":""}
|
package/dist/UserIdentity.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import * as Schema from "effect/Schema";
|
|
3
|
-
|
|
4
3
|
//#region src/UserIdentity.ts
|
|
5
4
|
var UserIdentity_exports = /* @__PURE__ */ __exportAll({ UserIdentity: () => UserIdentity });
|
|
6
5
|
const UserIdentity = (customClaimsFields) => Schema.Struct({
|
|
@@ -26,7 +25,7 @@ const UserIdentity = (customClaimsFields) => Schema.Struct({
|
|
|
26
25
|
address: Schema.optionalKey(Schema.String),
|
|
27
26
|
updatedAt: Schema.optionalKey(Schema.String)
|
|
28
27
|
});
|
|
29
|
-
|
|
30
28
|
//#endregion
|
|
31
29
|
export { UserIdentity, UserIdentity_exports };
|
|
30
|
+
|
|
32
31
|
//# sourceMappingURL=UserIdentity.js.map
|
package/dist/UserIdentity.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserIdentity.js","names":[],"sources":["../src/UserIdentity.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\nexport const UserIdentity = <CustomClaimsFields extends Schema.Struct.Fields>(\n customClaimsFields: CustomClaimsFields,\n) =>\n Schema.Struct({\n ...customClaimsFields,\n tokenIdentifier: Schema.String,\n subject: Schema.String,\n issuer: Schema.String,\n name: Schema.optionalKey(Schema.String),\n givenName: Schema.optionalKey(Schema.String),\n familyName: Schema.optionalKey(Schema.String),\n nickname: Schema.optionalKey(Schema.String),\n preferredUsername: Schema.optionalKey(Schema.String),\n profileUrl: Schema.optionalKey(Schema.String),\n pictureUrl: Schema.optionalKey(Schema.String),\n email: Schema.optionalKey(Schema.String),\n emailVerified: Schema.optionalKey(Schema.Boolean),\n gender: Schema.optionalKey(Schema.String),\n birthday: Schema.optionalKey(Schema.String),\n timezone: Schema.optionalKey(Schema.String),\n language: Schema.optionalKey(Schema.String),\n phoneNumber: Schema.optionalKey(Schema.String),\n phoneNumberVerified: Schema.optionalKey(Schema.Boolean),\n address: Schema.optionalKey(Schema.String),\n updatedAt: Schema.optionalKey(Schema.String),\n });\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"UserIdentity.js","names":[],"sources":["../src/UserIdentity.ts"],"sourcesContent":["import * as Schema from \"effect/Schema\";\n\nexport const UserIdentity = <CustomClaimsFields extends Schema.Struct.Fields>(\n customClaimsFields: CustomClaimsFields,\n) =>\n Schema.Struct({\n ...customClaimsFields,\n tokenIdentifier: Schema.String,\n subject: Schema.String,\n issuer: Schema.String,\n name: Schema.optionalKey(Schema.String),\n givenName: Schema.optionalKey(Schema.String),\n familyName: Schema.optionalKey(Schema.String),\n nickname: Schema.optionalKey(Schema.String),\n preferredUsername: Schema.optionalKey(Schema.String),\n profileUrl: Schema.optionalKey(Schema.String),\n pictureUrl: Schema.optionalKey(Schema.String),\n email: Schema.optionalKey(Schema.String),\n emailVerified: Schema.optionalKey(Schema.Boolean),\n gender: Schema.optionalKey(Schema.String),\n birthday: Schema.optionalKey(Schema.String),\n timezone: Schema.optionalKey(Schema.String),\n language: Schema.optionalKey(Schema.String),\n phoneNumber: Schema.optionalKey(Schema.String),\n phoneNumberVerified: Schema.optionalKey(Schema.Boolean),\n address: Schema.optionalKey(Schema.String),\n updatedAt: Schema.optionalKey(Schema.String),\n });\n"],"mappings":";;;;AAEA,MAAa,gBACX,uBAEA,OAAO,OAAO;CACZ,GAAG;CACH,iBAAiB,OAAO;CACxB,SAAS,OAAO;CAChB,QAAQ,OAAO;CACf,MAAM,OAAO,YAAY,OAAO,MAAM;CACtC,WAAW,OAAO,YAAY,OAAO,MAAM;CAC3C,YAAY,OAAO,YAAY,OAAO,MAAM;CAC5C,UAAU,OAAO,YAAY,OAAO,MAAM;CAC1C,mBAAmB,OAAO,YAAY,OAAO,MAAM;CACnD,YAAY,OAAO,YAAY,OAAO,MAAM;CAC5C,YAAY,OAAO,YAAY,OAAO,MAAM;CAC5C,OAAO,OAAO,YAAY,OAAO,MAAM;CACvC,eAAe,OAAO,YAAY,OAAO,OAAO;CAChD,QAAQ,OAAO,YAAY,OAAO,MAAM;CACxC,UAAU,OAAO,YAAY,OAAO,MAAM;CAC1C,UAAU,OAAO,YAAY,OAAO,MAAM;CAC1C,UAAU,OAAO,YAAY,OAAO,MAAM;CAC1C,aAAa,OAAO,YAAY,OAAO,MAAM;CAC7C,qBAAqB,OAAO,YAAY,OAAO,OAAO;CACtD,SAAS,OAAO,YAAY,OAAO,MAAM;CACzC,WAAW,OAAO,YAAY,OAAO,MAAM;AAC7C,CAAC"}
|
|
@@ -2,17 +2,12 @@
|
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __exportAll = (all, no_symbols) => {
|
|
4
4
|
let target = {};
|
|
5
|
-
for (var name in all) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
if (!no_symbols) {
|
|
12
|
-
__defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
13
|
-
}
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
14
10
|
return target;
|
|
15
11
|
};
|
|
16
|
-
|
|
17
12
|
//#endregion
|
|
18
|
-
export { __exportAll };
|
|
13
|
+
export { __exportAll };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * as GroupPath from "./GroupPath";
|
|
|
5
5
|
export * as GroupSpec from "./GroupSpec";
|
|
6
6
|
export * as Identifier from "./Identifier";
|
|
7
7
|
export * as Lazy from "./Lazy";
|
|
8
|
+
export * as PaginationOptions from "./PaginationOptions";
|
|
8
9
|
export * as PaginationResult from "./PaginationResult";
|
|
9
10
|
export * as Ref from "./Ref";
|
|
10
11
|
export * as Refs from "./Refs";
|
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,kBAAkB,MAAM,sBAAsB,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AAC/B,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,sBAAsB,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Lazy_exports } from "./Lazy.js";
|
|
2
|
+
import { PaginationOptions_exports } from "./PaginationOptions.js";
|
|
3
|
+
import { PaginationResult_exports } from "./PaginationResult.js";
|
|
2
4
|
import { FunctionProvenance_exports } from "./FunctionProvenance.js";
|
|
3
5
|
import { Identifier_exports } from "./Identifier.js";
|
|
4
6
|
import { RuntimeAndFunctionType_exports } from "./RuntimeAndFunctionType.js";
|
|
@@ -6,7 +8,6 @@ import { FunctionSpec_exports } from "./FunctionSpec.js";
|
|
|
6
8
|
import { GenericId_exports } from "./GenericId.js";
|
|
7
9
|
import { GroupPath_exports } from "./GroupPath.js";
|
|
8
10
|
import { GroupSpec_exports } from "./GroupSpec.js";
|
|
9
|
-
import { PaginationResult_exports } from "./PaginationResult.js";
|
|
10
11
|
import { Ref_exports } from "./Ref.js";
|
|
11
12
|
import { Refs_exports } from "./Refs.js";
|
|
12
13
|
import { Registry_exports } from "./Registry.js";
|
|
@@ -14,5 +15,4 @@ import { Spec_exports } from "./Spec.js";
|
|
|
14
15
|
import { SystemFields_exports } from "./SystemFields.js";
|
|
15
16
|
import { Types_exports } from "./Types.js";
|
|
16
17
|
import { UserIdentity_exports } from "./UserIdentity.js";
|
|
17
|
-
|
|
18
|
-
export { FunctionProvenance_exports as FunctionProvenance, FunctionSpec_exports as FunctionSpec, GenericId_exports as GenericId, GroupPath_exports as GroupPath, GroupSpec_exports as GroupSpec, Identifier_exports as Identifier, Lazy_exports as Lazy, PaginationResult_exports as PaginationResult, Ref_exports as Ref, Refs_exports as Refs, Registry_exports as Registry, RuntimeAndFunctionType_exports as RuntimeAndFunctionType, Spec_exports as Spec, SystemFields_exports as SystemFields, Types_exports as Types, UserIdentity_exports as UserIdentity };
|
|
18
|
+
export { FunctionProvenance_exports as FunctionProvenance, FunctionSpec_exports as FunctionSpec, GenericId_exports as GenericId, GroupPath_exports as GroupPath, GroupSpec_exports as GroupSpec, Identifier_exports as Identifier, Lazy_exports as Lazy, PaginationOptions_exports as PaginationOptions, PaginationResult_exports as PaginationResult, Ref_exports as Ref, Refs_exports as Refs, Registry_exports as Registry, RuntimeAndFunctionType_exports as RuntimeAndFunctionType, Spec_exports as Spec, SystemFields_exports as SystemFields, Types_exports as Types, UserIdentity_exports as UserIdentity };
|