@confect/core 1.0.0-next.0 → 1.0.0-next.1
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 +6 -0
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js.map +1 -1
- package/dist/Refs.d.ts +4 -3
- package/dist/Refs.d.ts.map +1 -1
- package/dist/Refs.js.map +1 -1
- package/dist/Types.d.ts +3 -4
- package/dist/Types.d.ts.map +1 -1
- package/dist/Types.js.map +1 -1
- package/package.json +7 -5
- package/src/Ref.ts +0 -2
- package/src/Refs.ts +7 -8
- package/src/Types.ts +1 -15
package/CHANGELOG.md
CHANGED
package/dist/Ref.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ref.d.ts","names":[],"sources":["../src/Ref.ts"],"sourcesContent":[],"mappings":";;;;;;;;UAIiB,0BACO,0CACM,kCACd,MAAA,CAAO,MAAA,CAAO,+BACX,MAAA,CAAO,MAAA,CAAO;2BAEN;iCACM;mBACd;sBACG;;UAGL,GAAA,SAAY;UAEZ,WAAA,SAAoB;UAEpB,SAAA,SAAkB;UAElB,QAAA,SACP,aAEN,oBACA,MAAA,CAAO,MAAA,CAAO,cACd,MAAA,CAAO,MAAA,CAAO;UAGD,WAAA,SACP,gBAEN,oBACA,MAAA,CAAO,MAAA,CAAO,cACd,MAAA,CAAO,MAAA,CAAO;UAGD,SAAA,SACP,cAEN,oBACA,MAAA,CAAO,MAAA,CAAO,cACd,MAAA,CAAO,MAAA,CAAO;UAGD,cAAA,SACP,uBAGN,MAAA,CAAO,MAAA,CAAO,cACd,MAAA,CAAO,MAAA,CAAO;UAGD,iBAAA,SACP,0BAGN,MAAA,CAAO,MAAA,CAAO,cACd,MAAA,CAAO,MAAA,CAAO;UAGD,eAAA,SACP,wBAGN,MAAA,CAAO,MAAA,CAAO,cACd,MAAA,CAAO,MAAA,CAAO,eA/DlB;AACwB,KAiEZ,eAjEY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uIwB,UAvIxB,CAAA,CAAA,CAAA,GAAA,EAyI/B,IAzI+B,EAAA,GA0InC,cA1ImC,CA0IpB,IA1IoB,CAAA;AAEtC,KA6IK,wBAAA,GA5IH,MAAA;AAEE,cA4IS,qBA5IT,EAAA,CAAA,wBA6IoB,YA7IpB,EAAA,8BA8I0B,kBA9I1B,EAAA,gBA+IY,MAAA,CAAO,MAAA,CAAO,YA/I1B,EAAA,mBAgJe,MAAA,CAAO,MAAA,CAAO,YAhJ7B,CAAA,CAAA,GAAA,EAkJG,GAlJH,CAkJO,eAlJP,EAkJsB,qBAlJtB,EAkJ2C,OAlJ3C,EAkJkD,UAlJlD,CAAA,EAAA,GAmJD,wBAnJC"}
|
package/dist/Ref.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ref.js","names":[],"sources":["../src/Ref.ts"],"sourcesContent":["import type { FunctionType, FunctionVisibility } from \"convex/server\";\nimport type { Schema } from \"effect\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\n\nexport interface Ref<\n _FunctionType extends FunctionType,\n _FunctionVisibility extends FunctionVisibility,\n _Args extends Schema.Schema.AnyNoContext,\n _Returns extends Schema.Schema.AnyNoContext,\n> {\n readonly _FunctionType?: _FunctionType;\n readonly _FunctionVisibility?: _FunctionVisibility;\n readonly _Args?: _Args;\n readonly _Returns?: _Returns;\n}\n\nexport interface Any extends Ref<any, any, any, any> {}\n\nexport interface AnyInternal extends Ref<any, \"internal\", any, any> {}\n\nexport interface AnyPublic extends Ref<any, \"public\", any, any> {}\n\nexport interface AnyQuery\n extends Ref<\n \"query\",\n FunctionVisibility,\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n > {}\n\nexport interface AnyMutation\n extends Ref<\n \"mutation\",\n FunctionVisibility,\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n > {}\n\nexport interface AnyAction\n extends Ref<\n \"action\",\n FunctionVisibility,\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n > {}\n\nexport interface AnyPublicQuery\n extends Ref<\n \"query\",\n \"public\",\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n > {}\n\nexport interface AnyPublicMutation\n extends Ref<\n \"mutation\",\n \"public\",\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n > {}\n\nexport interface AnyPublicAction\n extends Ref<\n \"action\",\n \"public\",\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n > {}\n\nexport type GetFunctionType<Ref_> =\n Ref_ extends Ref<\n infer FunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns\n >\n ? FunctionType_\n : never;\n\nexport type GetFunctionVisibility<Ref_> =\n Ref_ extends Ref<\n infer _FunctionType,\n infer FunctionVisibility_,\n infer _Args,\n infer _Returns\n >\n ? FunctionVisibility_\n : never;\n\nexport type Args<Ref_> =\n Ref_ extends Ref<\n infer _FunctionType,\n infer _FunctionVisibility,\n infer Args_,\n infer _Returns\n >\n ? Args_\n : never;\n\nexport type Returns<Ref_> =\n Ref_ extends Ref<\n infer _FunctionType,\n infer _FunctionVisibility,\n infer _Args,\n infer Returns_\n >\n ? Returns_\n : never;\n\nexport type FromFunctionSpec<F extends FunctionSpec.AnyWithProps> = Ref<\n FunctionSpec.GetFunctionType<F>,\n FunctionSpec.GetFunctionVisibility<F>,\n FunctionSpec.Args<F>,\n FunctionSpec.Returns<F>\n>;\n\nexport const make = <\n FunctionType_ extends FunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Args_ extends Schema.Schema.AnyNoContext,\n Returns_ extends Schema.Schema.AnyNoContext,\n>(\n /**\n * This is a Convex \"function name\" of the format \"myGroupDir/myGroupMod:myFunc\".\n */\n convexFunctionName: string,\n
|
|
1
|
+
{"version":3,"file":"Ref.js","names":[],"sources":["../src/Ref.ts"],"sourcesContent":["import type { FunctionType, FunctionVisibility } from \"convex/server\";\nimport type { Schema } from \"effect\";\nimport type * as FunctionSpec from \"./FunctionSpec\";\n\nexport interface Ref<\n _FunctionType extends FunctionType,\n _FunctionVisibility extends FunctionVisibility,\n _Args extends Schema.Schema.AnyNoContext,\n _Returns extends Schema.Schema.AnyNoContext,\n> {\n readonly _FunctionType?: _FunctionType;\n readonly _FunctionVisibility?: _FunctionVisibility;\n readonly _Args?: _Args;\n readonly _Returns?: _Returns;\n}\n\nexport interface Any extends Ref<any, any, any, any> {}\n\nexport interface AnyInternal extends Ref<any, \"internal\", any, any> {}\n\nexport interface AnyPublic extends Ref<any, \"public\", any, any> {}\n\nexport interface AnyQuery\n extends Ref<\n \"query\",\n FunctionVisibility,\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n > {}\n\nexport interface AnyMutation\n extends Ref<\n \"mutation\",\n FunctionVisibility,\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n > {}\n\nexport interface AnyAction\n extends Ref<\n \"action\",\n FunctionVisibility,\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n > {}\n\nexport interface AnyPublicQuery\n extends Ref<\n \"query\",\n \"public\",\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n > {}\n\nexport interface AnyPublicMutation\n extends Ref<\n \"mutation\",\n \"public\",\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n > {}\n\nexport interface AnyPublicAction\n extends Ref<\n \"action\",\n \"public\",\n Schema.Schema.AnyNoContext,\n Schema.Schema.AnyNoContext\n > {}\n\nexport type GetFunctionType<Ref_> =\n Ref_ extends Ref<\n infer FunctionType_,\n infer _FunctionVisibility,\n infer _Args,\n infer _Returns\n >\n ? FunctionType_\n : never;\n\nexport type GetFunctionVisibility<Ref_> =\n Ref_ extends Ref<\n infer _FunctionType,\n infer FunctionVisibility_,\n infer _Args,\n infer _Returns\n >\n ? FunctionVisibility_\n : never;\n\nexport type Args<Ref_> =\n Ref_ extends Ref<\n infer _FunctionType,\n infer _FunctionVisibility,\n infer Args_,\n infer _Returns\n >\n ? Args_\n : never;\n\nexport type Returns<Ref_> =\n Ref_ extends Ref<\n infer _FunctionType,\n infer _FunctionVisibility,\n infer _Args,\n infer Returns_\n >\n ? Returns_\n : never;\n\nexport type FromFunctionSpec<F extends FunctionSpec.AnyWithProps> = Ref<\n FunctionSpec.GetFunctionType<F>,\n FunctionSpec.GetFunctionVisibility<F>,\n FunctionSpec.Args<F>,\n FunctionSpec.Returns<F>\n>;\n\nexport const make = <\n FunctionType_ extends FunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Args_ extends Schema.Schema.AnyNoContext,\n Returns_ extends Schema.Schema.AnyNoContext,\n>(\n /**\n * This is a Convex \"function name\" of the format \"myGroupDir/myGroupMod:myFunc\".\n */\n convexFunctionName: string,\n function_: FunctionSpec.FunctionSpec<\n FunctionType_,\n FunctionVisibility_,\n string,\n Args_,\n Returns_\n >,\n): Ref<FunctionType_, FunctionVisibility_, Args_, Returns_> =>\n ({\n [HiddenFunctionKey]: function_,\n [HiddenConvexFunctionNameKey]: convexFunctionName,\n }) as Ref<FunctionType_, FunctionVisibility_, Args_, Returns_>;\n\nconst HiddenFunctionKey = \"@confect/core/api/HiddenFunctionKey\";\ntype HiddenFunctionKey = typeof HiddenFunctionKey;\ntype HiddenFunction<Ref_ extends Any> = FunctionSpec.FunctionSpec<\n GetFunctionType<Ref_>,\n GetFunctionVisibility<Ref_>,\n string,\n Args<Ref_>,\n Returns<Ref_>\n>;\n\nexport const getFunction = <\n FunctionType_ extends FunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Args_ extends Schema.Schema.AnyNoContext,\n Returns_ extends Schema.Schema.AnyNoContext,\n Ref_ extends Ref<FunctionType_, FunctionVisibility_, Args_, Returns_>,\n>(\n ref: Ref_,\n): HiddenFunction<Ref_> => (ref as any)[HiddenFunctionKey];\n\nconst HiddenConvexFunctionNameKey =\n \"@confect/core/api/HiddenConvexFunctionNameKey\";\ntype HiddenConvexFunctionNameKey = typeof HiddenConvexFunctionNameKey;\ntype HiddenConvexFunctionName = string;\n\nexport const getConvexFunctionName = <\n FunctionType_ extends FunctionType,\n FunctionVisibility_ extends FunctionVisibility,\n Args_ extends Schema.Schema.AnyNoContext,\n Returns_ extends Schema.Schema.AnyNoContext,\n>(\n ref: Ref<FunctionType_, FunctionVisibility_, Args_, Returns_>,\n): HiddenConvexFunctionName => (ref as any)[HiddenConvexFunctionNameKey];\n"],"mappings":";;;;;;;;AAqHA,MAAa,QASX,oBACA,eAQC;EACE,oBAAoB;EACpB,8BAA8B;CAChC;AAEH,MAAM,oBAAoB;AAU1B,MAAa,eAOX,QAC0B,IAAY;AAExC,MAAM,8BACJ;AAIF,MAAa,yBAMX,QAC8B,IAAY"}
|
package/dist/Refs.d.ts
CHANGED
|
@@ -8,10 +8,11 @@ import { Types } from "effect";
|
|
|
8
8
|
declare namespace Refs_d_exports {
|
|
9
9
|
export { Refs, make };
|
|
10
10
|
}
|
|
11
|
-
type Refs<Spec_ extends AnyWithProps$2, Predicate$1 extends Any = Any> = Types.Simplify<Helper<Groups$1<Spec_>, Predicate$1
|
|
12
|
-
type GroupRefs<Group$1 extends AnyWithProps$1, Predicate$1 extends Any> = Types.Simplify<Helper<Groups<Group$1>, Predicate$1
|
|
11
|
+
type Refs<Spec_ extends AnyWithProps$2, Predicate$1 extends Any = Any> = Types.Simplify<OmitEmpty<Helper<Groups$1<Spec_>, Predicate$1>>>;
|
|
12
|
+
type GroupRefs<Group$1 extends AnyWithProps$1, Predicate$1 extends Any> = Types.Simplify<OmitEmpty<Helper<Groups<Group$1>, Predicate$1>> & FilteredFunctions<Functions<Group$1>, Predicate$1>>;
|
|
13
|
+
type OmitEmpty<T> = { [K in keyof T as keyof T[K] extends never ? never : K]: T[K] };
|
|
13
14
|
type FilteredFunctions<Functions$1 extends AnyWithProps, Predicate$1 extends Any> = { [Name in Name$1<Functions$1> as WithName<Functions$1, Name> extends infer F extends AnyWithProps ? FromFunctionSpec<F> extends Predicate$1 ? Name : never : never]: WithName<Functions$1, Name> extends infer F extends AnyWithProps ? FromFunctionSpec<F> : never };
|
|
14
|
-
type Helper<Groups$2 extends AnyWithProps$1, Predicate$1 extends Any> = { [GroupName in Name$2<Groups$2>
|
|
15
|
+
type Helper<Groups$2 extends AnyWithProps$1, Predicate$1 extends Any> = { [GroupName in Name$2<Groups$2>]: WithName$1<Groups$2, GroupName> extends infer Group extends AnyWithProps$1 ? GroupRefs<Group, Predicate$1> : never };
|
|
15
16
|
declare const make: <Spec_ extends AnyWithProps$2>(spec: Spec_) => {
|
|
16
17
|
all: Refs<Spec_>;
|
|
17
18
|
public: Refs<Spec_, AnyPublic>;
|
package/dist/Refs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Refs.d.ts","names":[],"sources":["../src/Refs.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;KAOY,mBACI,oCACI,MAAU,OAC1B,KAAA,CAAM,SAAS,OAAO,SAAY,QAAQ;
|
|
1
|
+
{"version":3,"file":"Refs.d.ts","names":[],"sources":["../src/Refs.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;KAOY,mBACI,oCACI,MAAU,OAC1B,KAAA,CAAM,SAAS,UAAU,OAAO,SAAY,QAAQ;KAEnD,0BACW,oCACI,OAChB,KAAA,CAAM,SACR,UAAU,OAAO,OAAiB,UAAQ,gBACxC,kBAAkB,UAAoB,UAAQ;KAG7C,6BACS,WAAW,EAAE,2BAA2B,IAAI,EAAE;KAGvD,sCACe,kCACA,kBAET,OAAkB,gBAAc,SACvC,aACA,8BACwB,eACtB,iBAAqB,WAAW,cAC9B,uBAEM,SAAsB,aAAW,8BAC3C,eACE,iBAAqB,YA9B3B;KAkCK,MAjCW,CAAA,iBAkCC,cAlCD,EAAA,oBAmCI,GAnCJ,CAAA,GAAA,gBAqCA,MApCI,CAoCW,QApCX,CAAA,GAoCqB,UApCrB,CAqChB,QArCgB,EAsChB,SAtCgB,CAAA,SAAA,KAAA,eAuCY,cAvCZ,GAwCd,SAxCc,CAwCJ,KAxCI,EAwCG,WAxCH,CAAA,GAAA,KAAA,EAAU;AACkB,cAiDnC,IAjDmC,EAAA,CAAA,cAiDb,cAjDa,CAAA,CAAA,IAAA,EAkDxC,KAlDwC,EAAA,GAAA;EAAZ,GAAA,EAoD7B,IApD6B,CAoDxB,KApDwB,CAAA;EAAoB,MAAA,EAqD9C,IArD8C,CAqDzC,KArDyC,EAqDlC,SArDkC,CAAA;EAA3B,QAAA,EAsDjB,IAtDiB,CAsDZ,KAtDY,EAsDL,WAtDK,CAAA;CAAV"}
|
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, Record } from \"effect\";\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<Helper<Spec.Groups<Spec_>, Predicate
|
|
1
|
+
{"version":3,"file":"Refs.js","names":["Ref.make","Ref.getConvexFunctionName"],"sources":["../src/Refs.ts"],"sourcesContent":["import type { Types } from \"effect\";\nimport { pipe, Record } from \"effect\";\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\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 FilteredFunctions<\n Functions extends FunctionSpec.AnyWithProps,\n Predicate extends Ref.Any,\n> = {\n [Name in FunctionSpec.Name<Functions> as FunctionSpec.WithName<\n Functions,\n Name\n > extends infer F extends FunctionSpec.AnyWithProps\n ? Ref.FromFunctionSpec<F> extends Predicate\n ? Name\n : never\n : never]: FunctionSpec.WithName<Functions, 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): {\n all: Refs<Spec_>;\n public: Refs<Spec_, Ref.AnyPublic>;\n internal: Refs<Spec_, Ref.AnyInternal>;\n} => {\n const refs = makeHelper(spec.groups);\n return {\n all: refs as Refs<Spec_>,\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 groupPath: string | null = null,\n): Any =>\n pipe(\n groups as Record.ReadonlyRecord<string, GroupSpec.AnyWithProps>,\n Record.map((group) => {\n const currentGroupPath = groupPath\n ? `${groupPath}/${group.name}`\n : group.name;\n\n return Record.union(\n makeHelper(group.groups, currentGroupPath),\n Record.map(group.functions, (function_) =>\n Ref.make(`${currentGroupPath}:${function_.name}`, 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":";;;;;;AA2DA,MAAa,QACX,SAKG;CACH,MAAM,OAAO,WAAW,KAAK,OAAO;AACpC,QAAO;EACL,KAAK;EACL,QAAQ;EACR,UAAU;EACX;;AAGH,MAAM,cACJ,QACA,YAA2B,SAE3B,KACE,QACA,OAAO,KAAK,UAAU;CACpB,MAAM,mBAAmB,YACrB,GAAG,UAAU,GAAG,MAAM,SACtB,MAAM;AAEV,QAAO,OAAO,MACZ,WAAW,MAAM,QAAQ,iBAAiB,EAC1C,OAAO,IAAI,MAAM,YAAY,cAC3BA,OAAS,GAAG,iBAAiB,GAAG,UAAU,QAAQ,UAAU,CAC7D,GACA,WAAW,cAAc;AACxB,QAAM,IAAI,MACR,qDAAqDC,sBAA0B,UAAU,CAAC,IAC3F;GAEJ;EACD,CACH"}
|
package/dist/Types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { GenericId } from "convex/values";
|
|
|
4
4
|
|
|
5
5
|
//#region src/Types.d.ts
|
|
6
6
|
declare namespace Types_d_exports {
|
|
7
|
-
export { BaseDatabaseReader, DeepMutable,
|
|
7
|
+
export { BaseDatabaseReader, DeepMutable, IndexFieldTypesForEq, IsAny, IsOptional, IsRecord, IsRecursive, IsUnion, IsValueLiteral, TypeDefect, TypeError, UnionToTuple };
|
|
8
8
|
}
|
|
9
9
|
type IsOptional<T, K$1 extends keyof T> = {} extends Pick<T, K$1> ? true : false;
|
|
10
10
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
@@ -15,9 +15,8 @@ type IsValueLiteral<Vl> = [Vl] extends [never] ? never : IsUnion<Vl> extends tru
|
|
|
15
15
|
*/
|
|
16
16
|
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;
|
|
17
17
|
type DeepMutable<T> = IsAny<T> extends true ? any : T extends Brand.Brand<any> | GenericId<any> ? 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 : { -readonly [K in keyof T]: DeepMutable<T[K]> };
|
|
18
|
-
type DeepReadonly<T> = IsAny<T> extends true ? any : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer V> ? ReadonlySet<DeepReadonly<V>> : [keyof T] extends [never] ? T : { readonly [K in keyof T]: DeepReadonly<T[K]> };
|
|
19
18
|
type TypeError<Message extends string, T = never> = [Message, T];
|
|
20
|
-
type TypeDefect<Message extends string, T = never> =
|
|
19
|
+
type TypeDefect<Message extends string, T = never> = [Message, T];
|
|
21
20
|
type IsRecursive<T> = true extends DetectCycle<T> ? true : false;
|
|
22
21
|
type DetectCycle<T, Cache extends any[] = []> = IsAny<T> extends true ? false : [T] extends [any] ? T extends Cache[number] ? true : T extends Array<infer U> ? DetectCycle<U, [...Cache, T]> : T extends Map<infer _U, infer V> ? DetectCycle<V, [...Cache, T]> : T extends Set<infer U> ? DetectCycle<U, [...Cache, T]> : T extends object ? true extends { [K in keyof T]: DetectCycle<T[K], [...Cache, T]> }[keyof T] ? true : false : false : never;
|
|
23
22
|
type UnionToTuple<t> = _unionToTuple<t, []> extends infer result ? conform<result, t[]> : never;
|
|
@@ -31,5 +30,5 @@ type BaseDatabaseReader<DataModel extends GenericDataModel> = {
|
|
|
31
30
|
query: GenericDatabaseReader<DataModel>["query"];
|
|
32
31
|
};
|
|
33
32
|
//#endregion
|
|
34
|
-
export { BaseDatabaseReader, DeepMutable,
|
|
33
|
+
export { BaseDatabaseReader, DeepMutable, IndexFieldTypesForEq, IsAny, IsOptional, IsRecord, IsRecursive, IsUnion, IsValueLiteral, TypeDefect, TypeError, Types_d_exports, UnionToTuple };
|
|
35
34
|
//# sourceMappingURL=Types.d.ts.map
|
package/dist/Types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Types.d.ts","names":[],"sources":["../src/Types.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAUY,gCAA8B,gBAC7B,KAAK,GAAG;KAET,yBAAyB;KAEzB,uBAAqB,IAAI,KAAK,qBACrC,cAAY;KAML,sBAAsB,8BAE9B,QAAQ,4BAEL,qEACmB,gCAEE,iCAEG,gCAEC;;;;KAQpB,eAAe,6BAEvB,QAAQ,0BAEN,UAAU,+CACa,UACb,mBACJ,UAAU,eAAe,KACvB,eAAe,WAAW;KAQ5B,iBACV,MAAM,wBAEF,UAAU,KAAA,CAAM,aAAa,iBAC3B,IACA,UAAU,gCACR,IAAI,YAAY,IAAI,YAAY,MAChC,UAAU,uBACR,IAAI,YAAY,aACT,qBACL,4BACwB,IAAI,YAAY,EAAE;KAE5C,
|
|
1
|
+
{"version":3,"file":"Types.d.ts","names":[],"sources":["../src/Types.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAUY,gCAA8B,gBAC7B,KAAK,GAAG;KAET,yBAAyB;KAEzB,uBAAqB,IAAI,KAAK,qBACrC,cAAY;KAML,sBAAsB,8BAE9B,QAAQ,4BAEL,qEACmB,gCAEE,iCAEG,gCAEC;;;;KAQpB,eAAe,6BAEvB,QAAQ,0BAEN,UAAU,+CACa,UACb,mBACJ,UAAU,eAAe,KACvB,eAAe,WAAW;KAQ5B,iBACV,MAAM,wBAEF,UAAU,KAAA,CAAM,aAAa,iBAC3B,IACA,UAAU,gCACR,IAAI,YAAY,IAAI,YAAY,MAChC,UAAU,uBACR,IAAI,YAAY,aACT,qBACL,4BACwB,IAAI,YAAY,EAAE;KAE5C,gDAAgD,SAAS;KAEzD,iDAAiD,SAAS;KAE1D,8BAA8B,YAAY;KAEjD,2CACH,MAAM,2BAED,mBACC,UAAU,uBAER,UAAU,iBACR,YAAY,OAAO,OAAO,MAC1B,UAAU,yBACR,YAAY,OAAO,OAAO,MAC1B,UAAU,eACR,YAAY,OAAO,OAAO,MAC1B,8CAEgB,IAAI,YAA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AA,CAAA,GAAA,KAAA,KAAA,EAAA,GAAA,CAAA,GA8Hb,IA9Ha,SAAA,SAAA,MAAA,EAAA,GAAA,QAEL,MA8HQ,IA9HH,GA8HU,sBA9HW,CA+H5B,cA/H4B,CA+Hb,eA/Ha,EA+HI,KA/HJ,CAAA,EAgI5B,IAhI4B,CAgIvB,CAhIuB,CAAA,CAAA,EAEtC,GAAY,KAAA,GAAA,KAAO;AAAc,KAqIrB,kBArIqB,CAAA,kBAqIgB,gBArIhB,CAAA,GAAA;EAAI,GAAA,EAsI9B,qBAtI8B,CAsIR,SAtIQ,CAAA,CAAA,KAAA,CAAA;EAAK,KAAA,EAuIjC,qBAvIiC,CAuIX,SAvIW,CAAA,CAAA,OAAA,CAAA;CACrC"}
|
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 Brand.Brand<any> | GenericId<any>\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 : { -readonly [K in keyof T]: DeepMutable<T[K]> };\n\nexport type
|
|
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 Brand.Brand<any> | GenericId<any>\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 : { -readonly [K in keyof T]: DeepMutable<T[K]> };\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 DetectCycle<T, Cache extends any[] = []> =\n IsAny<T> extends true\n ? false\n : [T] extends [any]\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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@confect/core",
|
|
3
|
-
"version": "1.0.0-next.
|
|
4
|
-
"description": "Confect
|
|
3
|
+
"version": "1.0.0-next.1",
|
|
4
|
+
"description": "Shared specs and schemas used by all Confect packages",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/rjdellecese/confect.git"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/rjdellecese/confect/issues"
|
|
11
11
|
},
|
|
12
|
-
"homepage": "https://confect.
|
|
12
|
+
"homepage": "https://confect.dev",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"type": "module",
|
|
15
15
|
"files": [
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@ark/attest": "^0.56.0",
|
|
43
43
|
"@effect/language-service": "0.56.0",
|
|
44
|
+
"@effect/vitest": "0.27.0",
|
|
44
45
|
"@eslint/js": "9.39.1",
|
|
45
|
-
"@tsconfig/strictest": "2.0.8",
|
|
46
46
|
"@types/node": "24.10.1",
|
|
47
47
|
"eslint": "9.39.1",
|
|
48
48
|
"prettier": "3.6.2",
|
|
@@ -64,9 +64,11 @@
|
|
|
64
64
|
"scripts": {
|
|
65
65
|
"build": "tsdown --config-loader unrun",
|
|
66
66
|
"dev": "tsdown --watch",
|
|
67
|
+
"test": "vitest run",
|
|
67
68
|
"typecheck": "tsc --noEmit --project tsconfig.json",
|
|
68
69
|
"fix": "prettier --write . && eslint --fix . --max-warnings=0",
|
|
69
|
-
"
|
|
70
|
+
"format": "prettier --check .",
|
|
71
|
+
"lint": "eslint . --max-warnings=0",
|
|
70
72
|
"bench": "tsx test/Refs.bench.ts",
|
|
71
73
|
"clean": "rm -rf dist coverage node_modules"
|
|
72
74
|
}
|
package/src/Ref.ts
CHANGED
|
@@ -125,7 +125,6 @@ export const make = <
|
|
|
125
125
|
* This is a Convex "function name" of the format "myGroupDir/myGroupMod:myFunc".
|
|
126
126
|
*/
|
|
127
127
|
convexFunctionName: string,
|
|
128
|
-
// TODO: Pull out all of the fields from the function spec except the name (we don't need it because we already have the convex function name) and spread them here
|
|
129
128
|
function_: FunctionSpec.FunctionSpec<
|
|
130
129
|
FunctionType_,
|
|
131
130
|
FunctionVisibility_,
|
|
@@ -139,7 +138,6 @@ export const make = <
|
|
|
139
138
|
[HiddenConvexFunctionNameKey]: convexFunctionName,
|
|
140
139
|
}) as Ref<FunctionType_, FunctionVisibility_, Args_, Returns_>;
|
|
141
140
|
|
|
142
|
-
// TODO: Is this hidden stuff necessary/useful still?
|
|
143
141
|
const HiddenFunctionKey = "@confect/core/api/HiddenFunctionKey";
|
|
144
142
|
type HiddenFunctionKey = typeof HiddenFunctionKey;
|
|
145
143
|
type HiddenFunction<Ref_ extends Any> = FunctionSpec.FunctionSpec<
|
package/src/Refs.ts
CHANGED
|
@@ -8,16 +8,20 @@ import type * as Spec from "./Spec";
|
|
|
8
8
|
export type Refs<
|
|
9
9
|
Spec_ extends Spec.AnyWithProps,
|
|
10
10
|
Predicate extends Ref.Any = Ref.Any,
|
|
11
|
-
> = Types.Simplify<Helper<Spec.Groups<Spec_>, Predicate
|
|
11
|
+
> = Types.Simplify<OmitEmpty<Helper<Spec.Groups<Spec_>, Predicate>>>;
|
|
12
12
|
|
|
13
13
|
type GroupRefs<
|
|
14
14
|
Group extends GroupSpec.AnyWithProps,
|
|
15
15
|
Predicate extends Ref.Any,
|
|
16
16
|
> = Types.Simplify<
|
|
17
|
-
Helper<GroupSpec.Groups<Group>, Predicate
|
|
17
|
+
OmitEmpty<Helper<GroupSpec.Groups<Group>, Predicate>> &
|
|
18
18
|
FilteredFunctions<GroupSpec.Functions<Group>, Predicate>
|
|
19
19
|
>;
|
|
20
20
|
|
|
21
|
+
type OmitEmpty<T> = {
|
|
22
|
+
[K in keyof T as keyof T[K] extends never ? never : K]: T[K];
|
|
23
|
+
};
|
|
24
|
+
|
|
21
25
|
type FilteredFunctions<
|
|
22
26
|
Functions extends FunctionSpec.AnyWithProps,
|
|
23
27
|
Predicate extends Ref.Any,
|
|
@@ -39,15 +43,10 @@ type Helper<
|
|
|
39
43
|
Groups extends GroupSpec.AnyWithProps,
|
|
40
44
|
Predicate extends Ref.Any,
|
|
41
45
|
> = {
|
|
42
|
-
[GroupName in GroupSpec.Name<Groups>
|
|
46
|
+
[GroupName in GroupSpec.Name<Groups>]: GroupSpec.WithName<
|
|
43
47
|
Groups,
|
|
44
48
|
GroupName
|
|
45
49
|
> extends infer Group extends GroupSpec.AnyWithProps
|
|
46
|
-
? GroupRefs<Group, Predicate> extends Record<string, never>
|
|
47
|
-
? never
|
|
48
|
-
: GroupName
|
|
49
|
-
: never]: GroupSpec.WithName<Groups, GroupName> extends infer Group extends
|
|
50
|
-
GroupSpec.AnyWithProps
|
|
51
50
|
? GroupRefs<Group, Predicate>
|
|
52
51
|
: never;
|
|
53
52
|
};
|
package/src/Types.ts
CHANGED
|
@@ -68,23 +68,9 @@ export type DeepMutable<T> =
|
|
|
68
68
|
? T
|
|
69
69
|
: { -readonly [K in keyof T]: DeepMutable<T[K]> };
|
|
70
70
|
|
|
71
|
-
export type DeepReadonly<T> =
|
|
72
|
-
IsAny<T> extends true
|
|
73
|
-
? any
|
|
74
|
-
: T extends Map<infer K, infer V>
|
|
75
|
-
? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>>
|
|
76
|
-
: T extends Set<infer V>
|
|
77
|
-
? ReadonlySet<DeepReadonly<V>>
|
|
78
|
-
: [keyof T] extends [never]
|
|
79
|
-
? T
|
|
80
|
-
: { readonly [K in keyof T]: DeepReadonly<T[K]> };
|
|
81
|
-
|
|
82
71
|
export type TypeError<Message extends string, T = never> = [Message, T];
|
|
83
72
|
|
|
84
|
-
export type TypeDefect<Message extends string, T = never> =
|
|
85
|
-
`Unexpected type error:\n ${Message}`,
|
|
86
|
-
T
|
|
87
|
-
>;
|
|
73
|
+
export type TypeDefect<Message extends string, T = never> = [Message, T];
|
|
88
74
|
|
|
89
75
|
export type IsRecursive<T> = true extends DetectCycle<T> ? true : false;
|
|
90
76
|
|