@confect/core 10.0.0-next.15 → 10.0.0-next.18
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 +246 -0
- package/dist/FunctionProvenance.d.ts +18 -18
- package/dist/FunctionProvenance.d.ts.map +1 -1
- package/dist/FunctionProvenance.js +1 -1
- package/dist/FunctionProvenance.js.map +1 -1
- package/dist/FunctionSpec.d.ts +54 -48
- package/dist/FunctionSpec.d.ts.map +1 -1
- package/dist/FunctionSpec.js +23 -5
- package/dist/FunctionSpec.js.map +1 -1
- package/dist/GroupPath.d.ts +1 -4
- package/dist/GroupPath.d.ts.map +1 -1
- package/dist/GroupPath.js.map +1 -1
- package/dist/GroupSpec.d.ts +16 -10
- package/dist/GroupSpec.d.ts.map +1 -1
- package/dist/GroupSpec.js +34 -11
- package/dist/GroupSpec.js.map +1 -1
- package/dist/Lazy.d.ts +2 -3
- package/dist/Lazy.d.ts.map +1 -1
- package/dist/Lazy.js +2 -3
- package/dist/Lazy.js.map +1 -1
- package/dist/MiddlewareSpec.d.ts +184 -0
- package/dist/MiddlewareSpec.d.ts.map +1 -0
- package/dist/MiddlewareSpec.js +55 -0
- package/dist/MiddlewareSpec.js.map +1 -0
- package/dist/Ref.d.ts +53 -37
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +53 -35
- package/dist/Ref.js.map +1 -1
- package/dist/Refs.d.ts +8 -3
- package/dist/Refs.d.ts.map +1 -1
- package/dist/Refs.js +3 -3
- package/dist/Refs.js.map +1 -1
- package/dist/SchemaToValidator.d.ts +99 -0
- package/dist/SchemaToValidator.d.ts.map +1 -0
- package/dist/SchemaToValidator.js +156 -0
- package/dist/SchemaToValidator.js.map +1 -0
- package/dist/Spec.d.ts +3 -2
- package/dist/Spec.d.ts.map +1 -1
- package/dist/Spec.js +1 -1
- package/dist/Spec.js.map +1 -1
- package/dist/Table.d.ts +74 -0
- package/dist/Table.d.ts.map +1 -0
- package/dist/Table.js +77 -0
- package/dist/Table.js.map +1 -0
- package/dist/Types.d.ts +8 -2
- package/dist/Types.d.ts.map +1 -1
- package/dist/Types.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/package.json +9 -8
- package/src/FunctionProvenance.ts +8 -8
- package/src/FunctionSpec.ts +93 -14
- package/src/GroupPath.ts +1 -6
- package/src/GroupSpec.ts +125 -18
- package/src/Lazy.ts +2 -3
- package/src/MiddlewareSpec.ts +356 -0
- package/src/Ref.ts +310 -205
- package/src/Refs.ts +40 -16
- package/src/SchemaToValidator.ts +601 -0
- package/src/Spec.ts +4 -4
- package/src/Table.ts +426 -0
- package/src/Types.ts +9 -3
- package/src/index.ts +3 -1
- package/dist/Registry.d.ts +0 -24
- package/dist/Registry.d.ts.map +0 -1
- package/dist/Registry.js +0 -19
- package/dist/Registry.js.map +0 -1
- package/dist/tsconfig.src.tsbuildinfo +0 -1
- package/src/Registry.ts +0 -30
package/dist/Types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../src/Types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEpC,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IACzC,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;AAEvC,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;AAEtD,MAAM,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SAAS,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,SAAS,CACjE,CAAC,EAAE,MAAM,MAAM,KACZ,IAAI,GACL,MAAM,GACN,KAAK,CAAC;AAEZ,KAAK,cAAc,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,OAAO,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,GAAG,KAAK,CAAC,SAAS,CAC5E,CAAC,EAAE,MAAM,YAAY,KAClB,IAAI,GACL,YAAY,GACZ,KAAK,CAAC;AAEV,KAAK,OAAO,CAAC,CAAC,EAAE,IAAI,IAAI,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC;AAMlD,MAAM,MAAM,oBAAoB,CAC9B,eAAe,SAAS,gBAAgB,EACxC,KAAK,SAAS,qBAAqB,CAAC,eAAe,CAAC,EACpD,CAAC,SAAS,MAAM,EAAE,IAChB,CAAC,SAAS,SAAS,CAAC,GAAG,MAAM,IAAI,EAAE,GAAG,CAAC,GACvC,IAAI,SAAS,SAAS,MAAM,EAAE,GAC5B;KACG,CAAC,IAAI,MAAM,IAAI,GAAG,sBAAsB,CACvC,cAAc,CAAC,eAAe,EAAE,KAAK,CAAC,EACtC,IAAI,CAAC,CAAC,CAAC,CACR;CACF,GACD,KAAK,GACP,KAAK,CAAC;AAGV,MAAM,MAAM,kBAAkB,CAAC,SAAS,SAAS,gBAAgB,IAAI;IACnE,GAAG,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,CAAC;IAC7C,KAAK,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC;CAClD,CAAC"}
|
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 : {\n -readonly [K in keyof T]: IsOptional<T, K> extends true\n ? DeepMutable<Exclude<T[K], undefined>>\n : DeepMutable<T[K]>;\n };\n\nexport
|
|
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 interface TypeError<Message extends string, T = never> {\n readonly \"~@confect/core/Types/TypeError\": Message;\n readonly \"~value\"?: T;\n}\n\nexport interface TypeDefect<Message extends string, T = never> {\n readonly \"~@confect/core/Types/TypeDefect\": Message;\n readonly \"~value\"?: T;\n}\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/index.d.ts
CHANGED
|
@@ -5,14 +5,16 @@ 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 MiddlewareSpec from "./MiddlewareSpec";
|
|
8
9
|
export * as PaginationOptions from "./PaginationOptions";
|
|
9
10
|
export * as PaginationResult from "./PaginationResult";
|
|
10
11
|
export * as Ref from "./Ref";
|
|
11
12
|
export * as Refs from "./Refs";
|
|
12
|
-
export * as Registry from "./Registry";
|
|
13
13
|
export * as RuntimeAndFunctionType from "./RuntimeAndFunctionType";
|
|
14
|
+
export * as SchemaToValidator from "./SchemaToValidator";
|
|
14
15
|
export * as Spec from "./Spec";
|
|
15
16
|
export * as SystemFields from "./SystemFields";
|
|
17
|
+
export * as Table from "./Table";
|
|
16
18
|
export * as Types from "./Types";
|
|
17
19
|
export * as UserIdentity from "./UserIdentity";
|
|
18
20
|
//# sourceMappingURL=index.d.ts.map
|
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,CAAC;AAC3D,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,sBAAsB,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,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,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,11 +8,13 @@ import { FunctionSpec_exports } from "./FunctionSpec.js";
|
|
|
8
8
|
import { GenericId_exports } from "./GenericId.js";
|
|
9
9
|
import { GroupPath_exports } from "./GroupPath.js";
|
|
10
10
|
import { GroupSpec_exports } from "./GroupSpec.js";
|
|
11
|
+
import { MiddlewareSpec_exports } from "./MiddlewareSpec.js";
|
|
11
12
|
import { Ref_exports } from "./Ref.js";
|
|
12
13
|
import { Refs_exports } from "./Refs.js";
|
|
13
|
-
import {
|
|
14
|
+
import { SchemaToValidator_exports } from "./SchemaToValidator.js";
|
|
14
15
|
import { Spec_exports } from "./Spec.js";
|
|
15
16
|
import { SystemFields_exports } from "./SystemFields.js";
|
|
17
|
+
import { Table_exports } from "./Table.js";
|
|
16
18
|
import { Types_exports } from "./Types.js";
|
|
17
19
|
import { UserIdentity_exports } from "./UserIdentity.js";
|
|
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,
|
|
20
|
+
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, MiddlewareSpec_exports as MiddlewareSpec, PaginationOptions_exports as PaginationOptions, PaginationResult_exports as PaginationResult, Ref_exports as Ref, Refs_exports as Refs, RuntimeAndFunctionType_exports as RuntimeAndFunctionType, SchemaToValidator_exports as SchemaToValidator, Spec_exports as Spec, SystemFields_exports as SystemFields, Table_exports as Table, Types_exports as Types, UserIdentity_exports as UserIdentity };
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@confect/core",
|
|
3
3
|
"description": "Shared specs and schemas used by all Confect packages",
|
|
4
|
-
"version": "10.0.0-next.
|
|
4
|
+
"version": "10.0.0-next.18",
|
|
5
5
|
"author": "RJ Dellecese",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/rjdellecese/confect/issues"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@effect/vitest": "4.0.0-rc.
|
|
11
|
-
"@types/node": "
|
|
12
|
-
"effect": "4.0.0-rc.
|
|
10
|
+
"@effect/vitest": "4.0.0-rc.111",
|
|
11
|
+
"@types/node": "22.20.1",
|
|
12
|
+
"effect": "4.0.0-rc.111",
|
|
13
13
|
"tsdown": "0.22.14",
|
|
14
|
-
"tsx": "4.23.
|
|
14
|
+
"tsx": "4.23.12",
|
|
15
15
|
"typescript": "7.0.2",
|
|
16
16
|
"unrun": "0.3.1",
|
|
17
17
|
"vitest": "4.1.10",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"LICENSE",
|
|
38
38
|
"README.md",
|
|
39
39
|
"dist",
|
|
40
|
+
"!dist/*.tsbuildinfo",
|
|
40
41
|
"package.json",
|
|
41
42
|
"src"
|
|
42
43
|
],
|
|
@@ -50,11 +51,11 @@
|
|
|
50
51
|
"module": "./dist/index.js",
|
|
51
52
|
"peerDependencies": {
|
|
52
53
|
"convex": "^1.32.0",
|
|
53
|
-
"effect": "^4.0.0-rc.
|
|
54
|
+
"effect": "^4.0.0-rc.111"
|
|
54
55
|
},
|
|
55
56
|
"repository": {
|
|
56
57
|
"type": "git",
|
|
57
|
-
"url": "https://github.com/rjdellecese/confect.git"
|
|
58
|
+
"url": "git+https://github.com/rjdellecese/confect.git"
|
|
58
59
|
},
|
|
59
60
|
"sideEffects": false,
|
|
60
61
|
"type": "module",
|
|
@@ -62,7 +63,7 @@
|
|
|
62
63
|
"scripts": {
|
|
63
64
|
"bench": "tsx test/Refs.bench.ts",
|
|
64
65
|
"clean": "shx rm -rf dist coverage node_modules",
|
|
65
|
-
"dev": "tsdown --watch --config-loader unrun",
|
|
66
|
+
"dev": "tsdown --watch --no-clean --config-loader unrun",
|
|
66
67
|
"test": "vitest run",
|
|
67
68
|
"typecheck": "tsc -b tsconfig.src.json"
|
|
68
69
|
}
|
|
@@ -14,9 +14,9 @@ export type FunctionProvenance = Data.TaggedEnum<{
|
|
|
14
14
|
};
|
|
15
15
|
Convex: {
|
|
16
16
|
/** @internal */
|
|
17
|
-
|
|
17
|
+
"~args": DefaultFunctionArgs;
|
|
18
18
|
/** @internal */
|
|
19
|
-
|
|
19
|
+
"~returns": any;
|
|
20
20
|
};
|
|
21
21
|
}>;
|
|
22
22
|
|
|
@@ -67,8 +67,8 @@ export interface AnyConfect extends Confect<
|
|
|
67
67
|
|
|
68
68
|
export interface Convex<Args extends DefaultFunctionArgs, Returns> {
|
|
69
69
|
readonly _tag: "Convex";
|
|
70
|
-
readonly
|
|
71
|
-
readonly
|
|
70
|
+
readonly "~args": Args;
|
|
71
|
+
readonly "~returns": Returns;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
export interface AnyConvex extends Convex<DefaultFunctionArgs, any> {}
|
|
@@ -81,7 +81,7 @@ const Standard: Standard = { _tag: "Standard" };
|
|
|
81
81
|
* Build a `Confect` provenance from lazy schema thunks. `args`, `returns`,
|
|
82
82
|
* and `error` are exposed as sync lazy memoised getters (via {@link Lazy.defineProperty})
|
|
83
83
|
* that only evaluate their thunk on first access, mirroring how `Table`
|
|
84
|
-
* defers `Fields`/`Doc
|
|
84
|
+
* defers `Fields`/`Doc`. This keeps importing the assembled
|
|
85
85
|
* `_generated/spec.ts` cheap — no `Schema.Struct(...)` / `Schema.Array(...)`
|
|
86
86
|
* work runs at module load; it is deferred to the first invocation that
|
|
87
87
|
* actually compiles validators or runs a codec.
|
|
@@ -223,10 +223,10 @@ export const ConfectPaginated = <
|
|
|
223
223
|
return self;
|
|
224
224
|
};
|
|
225
225
|
|
|
226
|
-
export const Convex = <
|
|
226
|
+
export const Convex = <Args extends DefaultFunctionArgs, Returns>() =>
|
|
227
227
|
FunctionProvenance.Convex(
|
|
228
228
|
{} as {
|
|
229
|
-
|
|
230
|
-
|
|
229
|
+
"~args": Args;
|
|
230
|
+
"~returns": Returns;
|
|
231
231
|
},
|
|
232
232
|
);
|
package/src/FunctionSpec.ts
CHANGED
|
@@ -9,9 +9,10 @@ import * as Schema from "effect/Schema";
|
|
|
9
9
|
import * as Predicate from "effect/Predicate";
|
|
10
10
|
import * as FunctionProvenance from "./FunctionProvenance";
|
|
11
11
|
import { validateConfectFunctionIdentifier } from "./Identifier";
|
|
12
|
+
import type * as MiddlewareSpec from "./MiddlewareSpec";
|
|
12
13
|
import * as RuntimeAndFunctionType from "./RuntimeAndFunctionType";
|
|
13
14
|
|
|
14
|
-
export const TypeId = "
|
|
15
|
+
export const TypeId = "~@confect/core/FunctionSpec";
|
|
15
16
|
export type TypeId = typeof TypeId;
|
|
16
17
|
|
|
17
18
|
export const isFunctionSpec = (u: unknown): u is AnyWithProps =>
|
|
@@ -22,12 +23,44 @@ export interface FunctionSpec<
|
|
|
22
23
|
FunctionVisibility_ extends FunctionVisibility,
|
|
23
24
|
Name_ extends string,
|
|
24
25
|
FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,
|
|
26
|
+
MiddlewareSpecs_ extends MiddlewareSpec.AnyMiddlewareSpec = never,
|
|
25
27
|
> {
|
|
26
28
|
readonly [TypeId]: TypeId;
|
|
27
29
|
readonly runtimeAndFunctionType: RuntimeAndFunctionType_;
|
|
28
30
|
readonly functionVisibility: FunctionVisibility_;
|
|
29
31
|
readonly name: Name_;
|
|
30
32
|
readonly functionProvenance: FunctionProvenance_;
|
|
33
|
+
readonly middlewareSpecs: ReadonlyArray<MiddlewareSpecs_>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface Builder<
|
|
37
|
+
RuntimeAndFunctionType_ extends RuntimeAndFunctionType.RuntimeAndFunctionType,
|
|
38
|
+
FunctionVisibility_ extends FunctionVisibility,
|
|
39
|
+
Name_ extends string,
|
|
40
|
+
FunctionProvenance_ extends FunctionProvenance.FunctionProvenance,
|
|
41
|
+
MiddlewareSpecs_ extends MiddlewareSpec.AnyMiddlewareSpec = never,
|
|
42
|
+
> extends FunctionSpec<
|
|
43
|
+
RuntimeAndFunctionType_,
|
|
44
|
+
FunctionVisibility_,
|
|
45
|
+
Name_,
|
|
46
|
+
FunctionProvenance_,
|
|
47
|
+
MiddlewareSpecs_
|
|
48
|
+
> {
|
|
49
|
+
middleware<MiddlewareSpec_ extends MiddlewareSpec.AnyMiddlewareSpec>(
|
|
50
|
+
middlewareSpec: MiddlewareSpec_ &
|
|
51
|
+
MiddlewareSpec.ValidateFunctionAttach<
|
|
52
|
+
MiddlewareSpec_,
|
|
53
|
+
RuntimeAndFunctionType_,
|
|
54
|
+
FunctionProvenance_,
|
|
55
|
+
MiddlewareSpecs_
|
|
56
|
+
>,
|
|
57
|
+
): Builder<
|
|
58
|
+
RuntimeAndFunctionType_,
|
|
59
|
+
FunctionVisibility_,
|
|
60
|
+
Name_,
|
|
61
|
+
FunctionProvenance_,
|
|
62
|
+
MiddlewareSpecs_ | MiddlewareSpec_
|
|
63
|
+
>;
|
|
31
64
|
}
|
|
32
65
|
|
|
33
66
|
export interface Any {
|
|
@@ -38,21 +71,24 @@ export interface AnyWithProps extends FunctionSpec<
|
|
|
38
71
|
RuntimeAndFunctionType.RuntimeAndFunctionType,
|
|
39
72
|
FunctionVisibility,
|
|
40
73
|
string,
|
|
41
|
-
FunctionProvenance.FunctionProvenance
|
|
74
|
+
FunctionProvenance.FunctionProvenance,
|
|
75
|
+
MiddlewareSpec.AnyMiddlewareSpec
|
|
42
76
|
> {}
|
|
43
77
|
|
|
44
78
|
export interface AnyConfect extends FunctionSpec<
|
|
45
79
|
RuntimeAndFunctionType.RuntimeAndFunctionType,
|
|
46
80
|
FunctionVisibility,
|
|
47
81
|
string,
|
|
48
|
-
FunctionProvenance.AnyConfect
|
|
82
|
+
FunctionProvenance.AnyConfect,
|
|
83
|
+
MiddlewareSpec.AnyMiddlewareSpec
|
|
49
84
|
> {}
|
|
50
85
|
|
|
51
86
|
export interface AnyConvex extends FunctionSpec<
|
|
52
87
|
RuntimeAndFunctionType.RuntimeAndFunctionType,
|
|
53
88
|
FunctionVisibility,
|
|
54
89
|
string,
|
|
55
|
-
FunctionProvenance.AnyConvex
|
|
90
|
+
FunctionProvenance.AnyConvex,
|
|
91
|
+
MiddlewareSpec.AnyMiddlewareSpec
|
|
56
92
|
> {}
|
|
57
93
|
|
|
58
94
|
export interface AnyWithPropsWithRuntime<
|
|
@@ -61,7 +97,8 @@ export interface AnyWithPropsWithRuntime<
|
|
|
61
97
|
RuntimeAndFunctionType.WithRuntime<Runtime>,
|
|
62
98
|
FunctionVisibility,
|
|
63
99
|
string,
|
|
64
|
-
FunctionProvenance.FunctionProvenance
|
|
100
|
+
FunctionProvenance.FunctionProvenance,
|
|
101
|
+
MiddlewareSpec.AnyMiddlewareSpec
|
|
65
102
|
> {}
|
|
66
103
|
|
|
67
104
|
export interface AnyWithPropsWithFunctionType<
|
|
@@ -70,7 +107,8 @@ export interface AnyWithPropsWithFunctionType<
|
|
|
70
107
|
RuntimeAndFunctionType_,
|
|
71
108
|
FunctionVisibility,
|
|
72
109
|
string,
|
|
73
|
-
FunctionProvenance.FunctionProvenance
|
|
110
|
+
FunctionProvenance.FunctionProvenance,
|
|
111
|
+
MiddlewareSpec.AnyMiddlewareSpec
|
|
74
112
|
> {}
|
|
75
113
|
|
|
76
114
|
export interface AnyWithPropsWithFunctionProvenance<
|
|
@@ -79,7 +117,8 @@ export interface AnyWithPropsWithFunctionProvenance<
|
|
|
79
117
|
RuntimeAndFunctionType.RuntimeAndFunctionType,
|
|
80
118
|
FunctionVisibility,
|
|
81
119
|
string,
|
|
82
|
-
FunctionProvenance_
|
|
120
|
+
FunctionProvenance_,
|
|
121
|
+
MiddlewareSpec.AnyMiddlewareSpec
|
|
83
122
|
> {}
|
|
84
123
|
|
|
85
124
|
export type GetRuntimeAndFunctionType<FunctionSpec_ extends AnyWithProps> =
|
|
@@ -90,6 +129,9 @@ export type GetFunctionVisibility<FunctionSpec_ extends AnyWithProps> =
|
|
|
90
129
|
|
|
91
130
|
export type Name<FunctionSpec_ extends AnyWithProps> = FunctionSpec_["name"];
|
|
92
131
|
|
|
132
|
+
export type MiddlewareSpecs<FunctionSpec_ extends AnyWithProps> =
|
|
133
|
+
FunctionSpec_["middlewareSpecs"][number];
|
|
134
|
+
|
|
93
135
|
export type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
94
136
|
functionProvenance: {
|
|
95
137
|
_tag: "Confect";
|
|
@@ -98,7 +140,7 @@ export type Args<FunctionSpec_ extends AnyWithProps> = FunctionSpec_ extends {
|
|
|
98
140
|
}
|
|
99
141
|
? ArgsSchema_["Type"]
|
|
100
142
|
: FunctionSpec_ extends {
|
|
101
|
-
functionProvenance: { _tag: "Convex";
|
|
143
|
+
functionProvenance: { _tag: "Convex"; "~args": infer Args_ };
|
|
102
144
|
}
|
|
103
145
|
? Args_
|
|
104
146
|
: never;
|
|
@@ -112,7 +154,7 @@ export type Returns<FunctionSpec_ extends AnyWithProps> =
|
|
|
112
154
|
}
|
|
113
155
|
? ReturnsSchema_["Type"]
|
|
114
156
|
: FunctionSpec_ extends {
|
|
115
|
-
functionProvenance: { _tag: "Convex";
|
|
157
|
+
functionProvenance: { _tag: "Convex"; "~returns": infer Returns_ };
|
|
116
158
|
}
|
|
117
159
|
? Awaited<Returns_>
|
|
118
160
|
: never;
|
|
@@ -126,7 +168,7 @@ export type EncodedArgs<FunctionSpec_ extends AnyWithProps> =
|
|
|
126
168
|
}
|
|
127
169
|
? ArgsSchema_["Encoded"]
|
|
128
170
|
: FunctionSpec_ extends {
|
|
129
|
-
functionProvenance: { _tag: "Convex";
|
|
171
|
+
functionProvenance: { _tag: "Convex"; "~args": infer Args_ };
|
|
130
172
|
}
|
|
131
173
|
? Args_
|
|
132
174
|
: never;
|
|
@@ -140,7 +182,7 @@ export type EncodedReturns<FunctionSpec_ extends AnyWithProps> =
|
|
|
140
182
|
}
|
|
141
183
|
? ReturnsSchema_["Encoded"]
|
|
142
184
|
: FunctionSpec_ extends {
|
|
143
|
-
functionProvenance: { _tag: "Convex";
|
|
185
|
+
functionProvenance: { _tag: "Convex"; "~returns": infer Returns_ };
|
|
144
186
|
}
|
|
145
187
|
? Returns_
|
|
146
188
|
: never;
|
|
@@ -202,6 +244,40 @@ export type WithoutName<
|
|
|
202
244
|
|
|
203
245
|
const Proto = {
|
|
204
246
|
[TypeId]: TypeId,
|
|
247
|
+
|
|
248
|
+
middleware(
|
|
249
|
+
this: AnyWithProps,
|
|
250
|
+
middlewareSpec: MiddlewareSpec.AnyMiddlewareSpec,
|
|
251
|
+
) {
|
|
252
|
+
if (this.functionProvenance._tag === "Convex") {
|
|
253
|
+
throw new Error(
|
|
254
|
+
`Plain Convex function "${this.name}" cannot have middleware`,
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
const functionType = this.runtimeAndFunctionType.functionType;
|
|
258
|
+
if (!middlewareSpec.functionTypes[functionType]) {
|
|
259
|
+
throw new Error(
|
|
260
|
+
`Middleware "${middlewareSpec.key}" does not declare function type "${functionType}" of function "${this.name}"`,
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
if (
|
|
264
|
+
this.middlewareSpecs.some(
|
|
265
|
+
(existing) => existing.key === middlewareSpec.key,
|
|
266
|
+
)
|
|
267
|
+
) {
|
|
268
|
+
throw new Error(
|
|
269
|
+
`Middleware "${middlewareSpec.key}" is already attached to function "${this.name}"`,
|
|
270
|
+
);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return Object.assign(Object.create(Proto), {
|
|
274
|
+
runtimeAndFunctionType: this.runtimeAndFunctionType,
|
|
275
|
+
functionVisibility: this.functionVisibility,
|
|
276
|
+
name: this.name,
|
|
277
|
+
functionProvenance: this.functionProvenance,
|
|
278
|
+
middlewareSpecs: [...this.middlewareSpecs, middlewareSpec],
|
|
279
|
+
});
|
|
280
|
+
},
|
|
205
281
|
};
|
|
206
282
|
|
|
207
283
|
const make =
|
|
@@ -228,7 +304,7 @@ const make =
|
|
|
228
304
|
args: () => Args_;
|
|
229
305
|
returns: () => Returns_;
|
|
230
306
|
error?: () => Error_;
|
|
231
|
-
}):
|
|
307
|
+
}): Builder<
|
|
232
308
|
RuntimeAndFunctionType_,
|
|
233
309
|
FunctionVisibility_,
|
|
234
310
|
Name_,
|
|
@@ -241,6 +317,7 @@ const make =
|
|
|
241
317
|
functionVisibility,
|
|
242
318
|
name,
|
|
243
319
|
functionProvenance: FunctionProvenance.Confect(args, returns, error),
|
|
320
|
+
middlewareSpecs: [],
|
|
244
321
|
});
|
|
245
322
|
};
|
|
246
323
|
|
|
@@ -281,7 +358,7 @@ const makePaginated =
|
|
|
281
358
|
/** The page element schema. */
|
|
282
359
|
item: () => Item_;
|
|
283
360
|
error?: () => Error_;
|
|
284
|
-
}):
|
|
361
|
+
}): Builder<
|
|
285
362
|
RuntimeAndFunctionType_,
|
|
286
363
|
FunctionVisibility_,
|
|
287
364
|
Name_,
|
|
@@ -299,6 +376,7 @@ const makePaginated =
|
|
|
299
376
|
item,
|
|
300
377
|
error,
|
|
301
378
|
),
|
|
379
|
+
middlewareSpecs: [],
|
|
302
380
|
});
|
|
303
381
|
};
|
|
304
382
|
|
|
@@ -385,7 +463,7 @@ const makeConvex =
|
|
|
385
463
|
>() =>
|
|
386
464
|
<const Name_ extends string>(
|
|
387
465
|
name: Name_,
|
|
388
|
-
):
|
|
466
|
+
): Builder<
|
|
389
467
|
RuntimeAndFunctionType_,
|
|
390
468
|
FunctionVisibility_,
|
|
391
469
|
Name_,
|
|
@@ -401,6 +479,7 @@ const makeConvex =
|
|
|
401
479
|
ExtractArgs<F>,
|
|
402
480
|
ExtractReturns<F>
|
|
403
481
|
>(),
|
|
482
|
+
middlewareSpecs: [],
|
|
404
483
|
}) as any;
|
|
405
484
|
};
|
|
406
485
|
|
package/src/GroupPath.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Record } from "effect";
|
|
2
1
|
import type * as GroupSpec from "./GroupSpec";
|
|
3
2
|
|
|
4
3
|
/**
|
|
@@ -41,11 +40,7 @@ export type GroupAt<
|
|
|
41
40
|
> = Group extends GroupSpec.AnyWithProps
|
|
42
41
|
? Path extends `${infer Head}.${infer Tail}`
|
|
43
42
|
? Group extends { readonly name: Head }
|
|
44
|
-
? Group
|
|
45
|
-
readonly groups: Record.ReadonlyRecord<string, infer SubGroup>;
|
|
46
|
-
}
|
|
47
|
-
? GroupAt<SubGroup, Tail>
|
|
48
|
-
: never
|
|
43
|
+
? GroupAt<GroupSpec.Groups<Group>, Tail>
|
|
49
44
|
: never
|
|
50
45
|
: GroupSpec.WithName<Group, Path>
|
|
51
46
|
: never;
|