@gaganref/confect-core 10.3.1-fork.5 → 10.3.1-fork.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActionCall.d.ts +18 -0
- package/dist/ActionCall.d.ts.map +1 -0
- package/dist/ActionCall.js +21 -0
- package/dist/ActionCall.js.map +1 -0
- package/dist/App.d.ts +13 -2
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +6 -3
- package/dist/App.js.map +1 -1
- package/dist/Auth.d.ts +31 -6
- package/dist/Auth.d.ts.map +1 -1
- package/dist/Auth.js +15 -1
- package/dist/Auth.js.map +1 -1
- package/dist/Callback.d.ts.map +1 -1
- package/dist/Callback.js +2 -2
- package/dist/Callback.js.map +1 -1
- package/dist/Component.d.ts.map +1 -1
- package/dist/Component.js +1 -1
- package/dist/Component.js.map +1 -1
- package/dist/FunctionSpec.d.ts +365 -2
- package/dist/FunctionSpec.d.ts.map +1 -1
- package/dist/FunctionSpec.js +66 -3
- package/dist/FunctionSpec.js.map +1 -1
- package/dist/GroupSpec.js +1 -1
- package/dist/Http.d.ts.map +1 -1
- package/dist/Http.js +2 -2
- package/dist/Http.js.map +1 -1
- package/dist/ManifestSection.d.ts +24 -0
- package/dist/ManifestSection.d.ts.map +1 -0
- package/dist/ManifestSection.js +7 -0
- package/dist/ManifestSection.js.map +1 -0
- package/dist/Profile.d.ts +95 -0
- package/dist/Profile.d.ts.map +1 -0
- package/dist/Profile.js +15 -0
- package/dist/Profile.js.map +1 -0
- package/dist/Ref.d.ts +4 -2
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +8 -4
- package/dist/Ref.js.map +1 -1
- package/dist/SchemaToValidator.d.ts +10 -1
- package/dist/SchemaToValidator.d.ts.map +1 -1
- package/dist/SchemaToValidator.js +19 -4
- package/dist/SchemaToValidator.js.map +1 -1
- package/dist/SystemFields.js +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -6
- package/dist/internal/scalarDocs.d.ts +5 -0
- package/dist/internal/scalarDocs.d.ts.map +1 -0
- package/dist/internal/scalarDocs.js +43 -0
- package/dist/internal/scalarDocs.js.map +1 -0
- package/package.json +3 -3
- package/src/ActionCall.ts +25 -0
- package/src/App.ts +19 -3
- package/src/Auth.ts +48 -6
- package/src/Callback.ts +1 -0
- package/src/Component.ts +2 -0
- package/src/FunctionSpec.ts +570 -5
- package/src/Http.ts +2 -5
- package/src/ManifestSection.ts +29 -0
- package/src/Profile.ts +141 -0
- package/src/Ref.ts +17 -4
- package/src/SchemaToValidator.ts +22 -1
- package/src/index.ts +3 -0
- package/src/internal/scalarDocs.ts +72 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * as ActionCall from "./ActionCall.js";
|
|
1
2
|
export * as Callback from "./Callback.js";
|
|
2
3
|
export * as FunctionProvenance from "./FunctionProvenance.js";
|
|
3
4
|
export * as FunctionSpec from "./FunctionSpec.js";
|
|
@@ -13,11 +14,13 @@ export * as GroupSpec from "./GroupSpec.js";
|
|
|
13
14
|
export * as Identifier from "./Identifier.js";
|
|
14
15
|
export * as Lazy from "./Lazy.js";
|
|
15
16
|
export * as Manifest from "./Manifest.js";
|
|
17
|
+
export * as ManifestSection from "./ManifestSection.js";
|
|
16
18
|
export * as MiddlewareAttachment from "./MiddlewareAttachment.js";
|
|
17
19
|
export * as MiddlewareSpec from "./MiddlewareSpec.js";
|
|
18
20
|
export * as PaginationError from "./PaginationError.js";
|
|
19
21
|
export * as PaginationOptions from "./PaginationOptions.js";
|
|
20
22
|
export * as PaginationResult from "./PaginationResult.js";
|
|
23
|
+
export * as Profile from "./Profile.js";
|
|
21
24
|
export * as Ref from "./Ref.js";
|
|
22
25
|
export * as Refs from "./Refs.js";
|
|
23
26
|
export * as RuntimeAndFunctionType from "./RuntimeAndFunctionType.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1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OAAO,KAAK,GAAG,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,sBAAsB,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,30 +1,33 @@
|
|
|
1
|
-
import { App_exports } from "./App.js";
|
|
2
|
-
import { Auth_exports } from "./Auth.js";
|
|
3
1
|
import { Lazy_exports } from "./Lazy.js";
|
|
4
2
|
import { PaginationOptions_exports } from "./PaginationOptions.js";
|
|
5
3
|
import { PaginationResult_exports } from "./PaginationResult.js";
|
|
6
4
|
import { FunctionProvenance_exports } from "./FunctionProvenance.js";
|
|
5
|
+
import { Identifier_exports } from "./Identifier.js";
|
|
7
6
|
import { MiddlewareSpec_exports } from "./MiddlewareSpec.js";
|
|
7
|
+
import { RuntimeAndFunctionType_exports } from "./RuntimeAndFunctionType.js";
|
|
8
|
+
import { FunctionSpec_exports } from "./FunctionSpec.js";
|
|
9
|
+
import { ActionCall_exports } from "./ActionCall.js";
|
|
10
|
+
import { App_exports } from "./App.js";
|
|
11
|
+
import { Auth_exports } from "./Auth.js";
|
|
8
12
|
import { Ref_exports } from "./Ref.js";
|
|
9
13
|
import { Callback_exports } from "./Callback.js";
|
|
10
14
|
import { IdScope_exports } from "./IdScope.js";
|
|
11
15
|
import { GenericId_exports } from "./GenericId.js";
|
|
12
16
|
import { MiddlewareAttachment_exports } from "./MiddlewareAttachment.js";
|
|
13
|
-
import { Identifier_exports } from "./Identifier.js";
|
|
14
17
|
import { GroupSpec_exports } from "./GroupSpec.js";
|
|
15
18
|
import { Spec_exports } from "./Spec.js";
|
|
16
19
|
import { Component_exports } from "./Component.js";
|
|
17
20
|
import { Env_exports } from "./Env.js";
|
|
18
|
-
import { RuntimeAndFunctionType_exports } from "./RuntimeAndFunctionType.js";
|
|
19
|
-
import { FunctionSpec_exports } from "./FunctionSpec.js";
|
|
20
21
|
import { GroupPath_exports } from "./GroupPath.js";
|
|
21
22
|
import { Http_exports } from "./Http.js";
|
|
22
23
|
import { Manifest_exports } from "./Manifest.js";
|
|
24
|
+
import { ManifestSection_exports } from "./ManifestSection.js";
|
|
23
25
|
import { PaginationError_exports } from "./PaginationError.js";
|
|
26
|
+
import { Profile_exports } from "./Profile.js";
|
|
24
27
|
import { Refs_exports } from "./Refs.js";
|
|
25
28
|
import { SchemaToValidator_exports } from "./SchemaToValidator.js";
|
|
26
29
|
import { SystemFields_exports } from "./SystemFields.js";
|
|
27
30
|
import { Table_exports } from "./Table.js";
|
|
28
31
|
import { Types_exports } from "./Types.js";
|
|
29
32
|
import { UserIdentity_exports } from "./UserIdentity.js";
|
|
30
|
-
export { App_exports as App, Auth_exports as Auth, Callback_exports as Callback, Component_exports as Component, Env_exports as Env, FunctionProvenance_exports as FunctionProvenance, FunctionSpec_exports as FunctionSpec, GenericId_exports as GenericId, GroupPath_exports as GroupPath, GroupSpec_exports as GroupSpec, Http_exports as Http, IdScope_exports as IdScope, Identifier_exports as Identifier, Lazy_exports as Lazy, Manifest_exports as Manifest, MiddlewareAttachment_exports as MiddlewareAttachment, MiddlewareSpec_exports as MiddlewareSpec, PaginationError_exports as PaginationError, 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 };
|
|
33
|
+
export { ActionCall_exports as ActionCall, App_exports as App, Auth_exports as Auth, Callback_exports as Callback, Component_exports as Component, Env_exports as Env, FunctionProvenance_exports as FunctionProvenance, FunctionSpec_exports as FunctionSpec, GenericId_exports as GenericId, GroupPath_exports as GroupPath, GroupSpec_exports as GroupSpec, Http_exports as Http, IdScope_exports as IdScope, Identifier_exports as Identifier, Lazy_exports as Lazy, Manifest_exports as Manifest, ManifestSection_exports as ManifestSection, MiddlewareAttachment_exports as MiddlewareAttachment, MiddlewareSpec_exports as MiddlewareSpec, PaginationError_exports as PaginationError, PaginationOptions_exports as PaginationOptions, PaginationResult_exports as PaginationResult, Profile_exports as Profile, Ref_exports as Ref, Refs_exports as Refs, RuntimeAndFunctionType_exports as RuntimeAndFunctionType, SchemaToValidator_exports as SchemaToValidator, Spec_exports as Spec, SystemFields_exports as SystemFields, Table_exports as Table, Types_exports as Types, UserIdentity_exports as UserIdentity };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as HttpRouter from "effect/http/HttpRouter";
|
|
2
|
+
import type * as HttpApi from "effect/http-api/HttpApi";
|
|
3
|
+
import type * as HttpApiGroup from "effect/http-api/HttpApiGroup";
|
|
4
|
+
export declare const scalarDocs: <Id extends string, Groups extends HttpApiGroup.Constraint>(api: HttpApi.HttpApi<Id, Groups>, path: `/${string}`) => import("effect/Layer").Layer<never, never, HttpRouter.HttpRouter>;
|
|
5
|
+
//# sourceMappingURL=scalarDocs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalarDocs.d.ts","sourceRoot":"","sources":["../../src/internal/scalarDocs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAErD,OAAO,KAAK,KAAK,OAAO,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,KAAK,YAAY,MAAM,8BAA8B,CAAC;AAuBlE,eAAO,MAAM,UAAU,GACrB,EAAE,SAAS,MAAM,EACjB,MAAM,SAAS,YAAY,CAAC,UAAU,OAEjC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,QAC1B,IAAI,MAAM,EAAE,sEAuChB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as HttpRouter from "effect/http/HttpRouter";
|
|
3
|
+
import * as HttpServerResponse from "effect/http/HttpServerResponse";
|
|
4
|
+
import * as OpenApi from "effect/http-api/OpenApi";
|
|
5
|
+
//#region src/internal/scalarDocs.ts
|
|
6
|
+
const escape = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
7
|
+
const escapeAttribute = (value) => escape(value).replaceAll("\"", """).replaceAll("'", "'");
|
|
8
|
+
const escapeJson = (value) => JSON.stringify(value).replaceAll("<", "\\u003c").replaceAll("\u2028", "\\u2028").replaceAll("\u2029", "\\u2029");
|
|
9
|
+
const scalarDocs = (api, path) => HttpRouter.use((router) => {
|
|
10
|
+
let response;
|
|
11
|
+
return router.add("GET", path, Effect.sync(() => {
|
|
12
|
+
if (response !== void 0) return response;
|
|
13
|
+
const spec = OpenApi.fromApi(api);
|
|
14
|
+
const description = (tag) => !spec.info.description ? "" : `<meta name="${tag}" content="${escapeAttribute(spec.info.description)}"/>`;
|
|
15
|
+
response = HttpServerResponse.html(`<!doctype html>
|
|
16
|
+
<html>
|
|
17
|
+
<head>
|
|
18
|
+
<meta charset="utf-8" />
|
|
19
|
+
<title>${escape(spec.info.title)}</title>
|
|
20
|
+
${description("description")}
|
|
21
|
+
${description("og:description")}
|
|
22
|
+
<meta
|
|
23
|
+
name="viewport"
|
|
24
|
+
content="width=device-width, initial-scale=1" />
|
|
25
|
+
</head>
|
|
26
|
+
<body>
|
|
27
|
+
<div id="api-reference-container"></div>
|
|
28
|
+
<script src="${escapeAttribute("https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/browser/standalone.min.js")}" crossorigin><\/script>
|
|
29
|
+
<script>
|
|
30
|
+
window.Scalar.createApiReference(document.getElementById('api-reference-container'), {
|
|
31
|
+
...${escapeJson({ _integration: "html" })},
|
|
32
|
+
content: ${escapeJson(spec)}
|
|
33
|
+
})
|
|
34
|
+
<\/script>
|
|
35
|
+
</body>
|
|
36
|
+
</html>`);
|
|
37
|
+
return response;
|
|
38
|
+
}));
|
|
39
|
+
});
|
|
40
|
+
//#endregion
|
|
41
|
+
export { scalarDocs };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=scalarDocs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalarDocs.js","names":[],"sources":["../../src/internal/scalarDocs.ts"],"sourcesContent":["import * as Effect from \"effect/Effect\";\nimport * as HttpRouter from \"effect/http/HttpRouter\";\nimport * as HttpServerResponse from \"effect/http/HttpServerResponse\";\nimport type * as HttpApi from \"effect/http-api/HttpApi\";\nimport type * as HttpApiGroup from \"effect/http-api/HttpApiGroup\";\nimport * as OpenApi from \"effect/http-api/OpenApi\";\n\nconst escape = (value: string) =>\n value\n .replaceAll(\"&\", \"&\")\n .replaceAll(\"<\", \"<\")\n .replaceAll(\">\", \">\");\n\nconst escapeAttribute = (value: string) =>\n escape(value).replaceAll('\"', \""\").replaceAll(\"'\", \"'\");\n\nconst escapeJson = (value: unknown) =>\n JSON.stringify(value)\n .replaceAll(\"<\", \"\\\\u003c\")\n .replaceAll(\"\\u2028\", \"\\\\u2028\")\n .replaceAll(\"\\u2029\", \"\\\\u2029\");\n\n// WORKAROUND: Effect 4.0.6's HttpApiScalar module imports its inline Scalar\n// script dynamically, and Convex's bundler then splits a schema that reaches it\n// into an imported chunk, which Convex refuses. This copies `layerCdn`'s page\n// byte for byte. Remove when `checkSchemaBundle.mjs` passes with\n// `HttpApiScalar.layerCdn` restored.\nexport const scalarDocs = <\n Id extends string,\n Groups extends HttpApiGroup.Constraint,\n>(\n api: HttpApi.HttpApi<Id, Groups>,\n path: `/${string}`,\n) =>\n HttpRouter.use((router) => {\n let response: HttpServerResponse.HttpServerResponse | undefined;\n return router.add(\n \"GET\",\n path,\n Effect.sync(() => {\n if (response !== undefined) return response;\n const spec = OpenApi.fromApi(api);\n const description = (tag: string) =>\n !spec.info.description\n ? \"\"\n : `<meta name=\"${tag}\" content=\"${escapeAttribute(spec.info.description)}\"/>`;\n response = HttpServerResponse.html(`<!doctype html>\n<html>\n <head>\n <meta charset=\"utf-8\" />\n <title>${escape(spec.info.title)}</title>\n ${description(\"description\")}\n ${description(\"og:description\")}\n <meta\n name=\"viewport\"\n content=\"width=device-width, initial-scale=1\" />\n </head>\n <body>\n <div id=\"api-reference-container\"></div>\n <script src=\"${escapeAttribute(\"https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest/dist/browser/standalone.min.js\")}\" crossorigin></script>\n <script>\n window.Scalar.createApiReference(document.getElementById('api-reference-container'), {\n ...${escapeJson({ _integration: \"html\" })},\n content: ${escapeJson(spec)}\n })\n </script>\n </body>\n</html>`);\n return response;\n }),\n );\n });\n"],"mappings":";;;;;AAOA,MAAM,UAAU,UACd,MACG,WAAW,KAAK,OAAO,CAAC,CACxB,WAAW,KAAK,MAAM,CAAC,CACvB,WAAW,KAAK,MAAM;AAE3B,MAAM,mBAAmB,UACvB,OAAO,KAAK,CAAC,CAAC,WAAW,MAAK,QAAQ,CAAC,CAAC,WAAW,KAAK,OAAO;AAEjE,MAAM,cAAc,UAClB,KAAK,UAAU,KAAK,CAAC,CAClB,WAAW,KAAK,SAAS,CAAC,CAC1B,WAAW,UAAU,SAAS,CAAC,CAC/B,WAAW,UAAU,SAAS;AAOnC,MAAa,cAIX,KACA,SAEA,WAAW,KAAK,WAAW;CACzB,IAAI;CACJ,OAAO,OAAO,IACZ,OACA,MACA,OAAO,WAAW;EAChB,IAAI,aAAa,KAAA,GAAW,OAAO;EACnC,MAAM,OAAO,QAAQ,QAAQ,GAAG;EAChC,MAAM,eAAe,QACnB,CAAC,KAAK,KAAK,cACP,KACA,eAAe,IAAI,aAAa,gBAAgB,KAAK,KAAK,WAAW,EAAE;EAC7E,WAAW,mBAAmB,KAAK;;;;aAI9B,OAAO,KAAK,KAAK,KAAK,EAAE;MAC/B,YAAY,aAAa,EAAE;MAC3B,YAAY,gBAAgB,EAAE;;;;;;;mBAOjB,gBAAgB,0FAA0F,EAAE;;;aAGlH,WAAW,EAAE,cAAc,OAAO,CAAC,EAAE;mBAC/B,WAAW,IAAI,EAAE;;;;QAI5B;EACA,OAAO;CACT,CAAC,CACH;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gaganref/confect-core",
|
|
3
|
-
"version": "10.3.1-fork.
|
|
3
|
+
"version": "10.3.1-fork.50",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"convex": "^1.
|
|
6
|
-
"effect": "
|
|
5
|
+
"convex": "^1.48.0",
|
|
6
|
+
"effect": ">=4.0.0 <4.1.0"
|
|
7
7
|
},
|
|
8
8
|
"description": "Shared specs and schemas used by all Confect packages",
|
|
9
9
|
"author": "RJ Dellecese",
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as Context from "effect/Context";
|
|
2
|
+
import type * as Effect from "effect/Effect";
|
|
3
|
+
import type * as Schema from "effect/Schema";
|
|
4
|
+
import * as FunctionSpec from "./FunctionSpec.js";
|
|
5
|
+
import * as MiddlewareSpec from "./MiddlewareSpec.js";
|
|
6
|
+
import type * as Ref from "./Ref.js";
|
|
7
|
+
|
|
8
|
+
export interface Call {
|
|
9
|
+
<Target extends Ref.AnyQuery | Ref.AnyMutation>(
|
|
10
|
+
target: Target,
|
|
11
|
+
...args: Ref.OptionalArgs<NoInfer<Target>>
|
|
12
|
+
): Effect.Effect<Ref.Returns<Target>, Ref.Error<Target> | Schema.SchemaError>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class ActionCall extends Context.Service<ActionCall, Call>()(
|
|
16
|
+
"@confect/core/ActionCall",
|
|
17
|
+
) {}
|
|
18
|
+
export class Middleware extends MiddlewareSpec.MiddlewareSpec<
|
|
19
|
+
Middleware,
|
|
20
|
+
{ provides: ActionCall }
|
|
21
|
+
>()("@confect/core/ActionCall/Middleware", {
|
|
22
|
+
functionTypes: { query: false, mutation: false, action: true },
|
|
23
|
+
}) {}
|
|
24
|
+
|
|
25
|
+
export const profile = FunctionSpec.extend()({ middleware: [Middleware] });
|
package/src/App.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { Infer, Validator } from "convex/values";
|
|
|
3
3
|
import type * as HttpApi from "effect/http-api/HttpApi";
|
|
4
4
|
import * as Predicate from "effect/Predicate";
|
|
5
5
|
import type * as Env from "./Env.js";
|
|
6
|
+
import type * as MiddlewareSpec from "./MiddlewareSpec.js";
|
|
6
7
|
|
|
7
8
|
const TypeId = "~@confect/core/App";
|
|
8
9
|
const MountTypeId = "~@confect/core/App/Mount";
|
|
@@ -48,13 +49,21 @@ type HttpOptions =
|
|
|
48
49
|
| { readonly httpPrefix?: never; readonly api?: never }
|
|
49
50
|
| { readonly httpPrefix: HttpPrefix; readonly api?: Api };
|
|
50
51
|
|
|
51
|
-
export type Options<D extends Definition> = HttpOptions &
|
|
52
|
-
|
|
52
|
+
export type Options<D extends Definition> = HttpOptions & {
|
|
53
|
+
/**
|
|
54
|
+
* The package specifier of the module whose `register(t, name)` the generated
|
|
55
|
+
* test registry calls for this mount, in place of the component package's own
|
|
56
|
+
* `<package>/test`. The kit registers the mount's children.
|
|
57
|
+
*/
|
|
58
|
+
readonly testing?: string;
|
|
59
|
+
} & ([RequiredKeys<EnvOf<D>>] extends [never]
|
|
53
60
|
? { readonly env?: Bindings<EnvOf<D>> }
|
|
54
61
|
: { readonly env: Bindings<EnvOf<D>> });
|
|
55
62
|
|
|
56
63
|
type Exact<D extends Definition, O> = {
|
|
57
|
-
readonly [
|
|
64
|
+
readonly [
|
|
65
|
+
K in Exclude<keyof O, "env" | "httpPrefix" | "api" | "testing">
|
|
66
|
+
]: never;
|
|
58
67
|
} & (O extends { readonly env: infer B }
|
|
59
68
|
? {
|
|
60
69
|
readonly env: { readonly [K in Exclude<keyof B, keyof EnvOf<D>>]: never };
|
|
@@ -66,6 +75,7 @@ export interface MountData {
|
|
|
66
75
|
readonly httpPrefix: HttpPrefix | undefined;
|
|
67
76
|
readonly api: Api | undefined;
|
|
68
77
|
readonly env: Readonly<Record<string, string | Env.AnyEntry | undefined>>;
|
|
78
|
+
readonly testing: string | undefined;
|
|
69
79
|
}
|
|
70
80
|
|
|
71
81
|
/**
|
|
@@ -106,6 +116,7 @@ export function mount(
|
|
|
106
116
|
readonly httpPrefix?: HttpPrefix;
|
|
107
117
|
readonly api?: Api;
|
|
108
118
|
readonly env?: MountData["env"];
|
|
119
|
+
readonly testing?: string;
|
|
109
120
|
},
|
|
110
121
|
): AnyMount {
|
|
111
122
|
return {
|
|
@@ -114,6 +125,7 @@ export function mount(
|
|
|
114
125
|
httpPrefix: options?.httpPrefix,
|
|
115
126
|
api: options?.api,
|
|
116
127
|
env: options?.env ?? {},
|
|
128
|
+
testing: options?.testing,
|
|
117
129
|
// The overloads above carry the precise types; this body serves both.
|
|
118
130
|
} as AnyMount;
|
|
119
131
|
}
|
|
@@ -144,6 +156,7 @@ export interface App<
|
|
|
144
156
|
readonly kind: K;
|
|
145
157
|
readonly env: E;
|
|
146
158
|
readonly mounts: M;
|
|
159
|
+
readonly requiresMiddleware: ReadonlyArray<MiddlewareSpec.AnyMiddlewareSpec>;
|
|
147
160
|
}
|
|
148
161
|
|
|
149
162
|
export type Any = App<Env.Any, Readonly<Record<string, AnyMount>>>;
|
|
@@ -175,6 +188,7 @@ export const make = <
|
|
|
175
188
|
>(
|
|
176
189
|
options: {
|
|
177
190
|
readonly env: E;
|
|
191
|
+
readonly requiresMiddleware?: ReadonlyArray<MiddlewareSpec.AnyMiddlewareSpec>;
|
|
178
192
|
readonly mounts?: M & OwnedBy<NoInfer<Env.Name<E>>, NoInfer<M>>;
|
|
179
193
|
} & ([K] extends ["app"] ? { readonly kind?: K } : { readonly kind: K }),
|
|
180
194
|
): App<E, M, K> => ({
|
|
@@ -182,6 +196,7 @@ export const make = <
|
|
|
182
196
|
kind: options.kind ?? ("app" as K),
|
|
183
197
|
env: options.env,
|
|
184
198
|
mounts: options.mounts ?? ({} as M),
|
|
199
|
+
requiresMiddleware: options.requiresMiddleware ?? [],
|
|
185
200
|
});
|
|
186
201
|
|
|
187
202
|
export const isApp = (u: unknown): u is Any =>
|
|
@@ -207,4 +222,5 @@ export const mounts = (
|
|
|
207
222
|
httpPrefix: installed.httpPrefix,
|
|
208
223
|
api: installed.api,
|
|
209
224
|
env: installed.env,
|
|
225
|
+
testing: installed.testing,
|
|
210
226
|
}));
|
package/src/Auth.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { AuthProvider } from "convex/server";
|
|
2
2
|
import * as Predicate from "effect/Predicate";
|
|
3
3
|
import type * as App from "./App.js";
|
|
4
|
+
import type * as Env from "./Env.js";
|
|
4
5
|
import type { TypeError } from "./Types.js";
|
|
5
6
|
|
|
6
7
|
const TypeId = "~@confect/core/Auth";
|
|
8
|
+
const CloudUrlTypeId = "~@confect/core/Auth/CloudUrl";
|
|
7
9
|
const SiteUrlTypeId = "~@confect/core/Auth/SiteUrl";
|
|
8
10
|
|
|
9
11
|
/**
|
|
@@ -15,19 +17,59 @@ export interface SiteUrl {
|
|
|
15
17
|
readonly path: string;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
/**
|
|
21
|
+
* The deployment's cloud URL (`CONVEX_CLOUD_URL`) plus a path.
|
|
22
|
+
*/
|
|
23
|
+
export interface CloudUrl {
|
|
24
|
+
readonly [CloudUrlTypeId]: typeof CloudUrlTypeId;
|
|
25
|
+
readonly path: string;
|
|
26
|
+
}
|
|
19
27
|
|
|
20
|
-
type
|
|
28
|
+
type Url =
|
|
29
|
+
| string
|
|
30
|
+
| SiteUrl
|
|
31
|
+
| CloudUrl
|
|
32
|
+
| Env.Entry<string, string, string, false>;
|
|
33
|
+
|
|
34
|
+
type WithUrls<P> = P extends unknown
|
|
21
35
|
? {
|
|
22
|
-
[K in keyof P]: K extends "domain" | "issuer" | "jwks"
|
|
36
|
+
[K in keyof P]: K extends "domain" | "issuer" | "jwks" | "applicationID"
|
|
37
|
+
? Url
|
|
38
|
+
: P[K];
|
|
23
39
|
}
|
|
24
40
|
: never;
|
|
25
41
|
|
|
26
42
|
/**
|
|
27
|
-
* Convex's
|
|
28
|
-
|
|
43
|
+
* Convex's provider list with deployment URLs and required, public env strings.
|
|
44
|
+
*/
|
|
45
|
+
export type Provider = WithUrls<AuthProvider> & {
|
|
46
|
+
/**
|
|
47
|
+
* Application-defined token family, copied to the runtime provider data.
|
|
48
|
+
*/
|
|
49
|
+
readonly family?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Application-defined issuer name, for example a trusted service.
|
|
52
|
+
*/
|
|
53
|
+
readonly name?: string;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The cloud URL, or a path under it, resolved when Convex loads auth config.
|
|
29
58
|
*/
|
|
30
|
-
export
|
|
59
|
+
export const cloudUrl = (path: `/${string}` | "" = ""): CloudUrl => ({
|
|
60
|
+
[CloudUrlTypeId]: CloudUrlTypeId,
|
|
61
|
+
path,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The path of a cloud URL placeholder, or `undefined` for another value.
|
|
66
|
+
*/
|
|
67
|
+
export const cloudUrlPath = (u: unknown): string | undefined =>
|
|
68
|
+
Predicate.hasProperty(u, CloudUrlTypeId) &&
|
|
69
|
+
Predicate.hasProperty(u, "path") &&
|
|
70
|
+
typeof u.path === "string"
|
|
71
|
+
? u.path
|
|
72
|
+
: undefined;
|
|
31
73
|
|
|
32
74
|
export interface Auth<A extends App.Any> {
|
|
33
75
|
readonly [TypeId]: typeof TypeId;
|
package/src/Callback.ts
CHANGED
|
@@ -145,6 +145,7 @@ const fromText = <Contract_ extends Any>(
|
|
|
145
145
|
[],
|
|
146
146
|
// Convex types a handle as a string that is also a function reference.
|
|
147
147
|
text as unknown as FunctionReference<any, any>,
|
|
148
|
+
contract.functionType,
|
|
148
149
|
),
|
|
149
150
|
{ [HandleTypeId]: contract.id },
|
|
150
151
|
) as unknown as Handle<Contract_>;
|