@cedarjs/api-server 4.0.0-canary.13869 → 4.0.0-canary.13871

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.
@@ -0,0 +1,28 @@
1
+ import type { EntryMeta } from '@universal-deploy/store';
2
+ import type { Fetchable } from './udFetchable.js';
3
+ export interface CedarDispatcherOptions {
4
+ apiRootPath?: string;
5
+ discoverFunctionsGlob?: string | string[];
6
+ /**
7
+ * Cache-bust token appended to dynamic ESM imports. Use this in dev to
8
+ * bypass Node.js's ESM module cache after a rebuild. Production builds
9
+ * should omit this.
10
+ */
11
+ cacheBust?: string | number;
12
+ }
13
+ export interface CedarDispatcherResult {
14
+ fetchable: Fetchable;
15
+ registrations: EntryMeta[];
16
+ }
17
+ /**
18
+ * Shared aggregate Cedar API dispatcher used by
19
+ * `cedarUniversalDeployPlugin` (via `virtual:cedar-api`).
20
+ *
21
+ * Discovers Cedar API functions in `api/dist/functions/`, builds a rou3 router
22
+ * and a map of route names to Fetchables, then returns a single Fetchable that
23
+ * routes incoming Fetch-API requests to the correct per-function handler.
24
+ * Also returns the list of `EntryMeta` registrations so callers can forward
25
+ * them to `@universal-deploy/store` via `addEntry()`.
26
+ */
27
+ export declare function buildCedarDispatcher(options?: CedarDispatcherOptions): Promise<CedarDispatcherResult>;
28
+ //# sourceMappingURL=udDispatcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"udDispatcher.d.ts","sourceRoot":"","sources":["../../src/udDispatcher.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAUxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAgBjD,MAAM,WAAW,sBAAsB;IACrC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,qBAAqB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACzC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,SAAS,CAAA;IACpB,aAAa,EAAE,SAAS,EAAE,CAAA;CAC3B;AA6BD;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CAmNhC"}
@@ -0,0 +1,192 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var udDispatcher_exports = {};
30
+ __export(udDispatcher_exports, {
31
+ buildCedarDispatcher: () => buildCedarDispatcher
32
+ });
33
+ module.exports = __toCommonJS(udDispatcher_exports);
34
+ var import_node_path = __toESM(require("node:path"), 1);
35
+ var import_node_url = require("node:url");
36
+ var import_fast_glob = __toESM(require("fast-glob"), 1);
37
+ var import_rou3 = require("rou3");
38
+ var import_runtime = require("@cedarjs/api/runtime");
39
+ var import_store = require("@cedarjs/context/dist/store");
40
+ var import_project_config = require("@cedarjs/project-config");
41
+ var import_udFetchable = require("./udFetchable.js");
42
+ const ALL_HTTP_METHODS = [
43
+ "GET",
44
+ "HEAD",
45
+ "POST",
46
+ "PUT",
47
+ "DELETE",
48
+ "PATCH",
49
+ "OPTIONS",
50
+ "CONNECT",
51
+ "TRACE"
52
+ ];
53
+ const GRAPHQL_METHODS = ["GET", "POST", "OPTIONS"];
54
+ function normalizeApiRootPath(rootPath) {
55
+ let normalized = rootPath;
56
+ if (!normalized.startsWith("/")) {
57
+ normalized = "/" + normalized;
58
+ }
59
+ if (!normalized.endsWith("/")) {
60
+ normalized = normalized + "/";
61
+ }
62
+ return normalized;
63
+ }
64
+ async function buildCedarDispatcher(options) {
65
+ const normalizedApiRootPath = normalizeApiRootPath(
66
+ options?.apiRootPath ?? "/"
67
+ );
68
+ const discoverFunctionsGlob = options?.discoverFunctionsGlob ?? "dist/functions/**/*.{ts,js}";
69
+ const serverFunctions = import_fast_glob.default.sync(discoverFunctionsGlob, {
70
+ cwd: (0, import_project_config.getPaths)().api.base,
71
+ deep: 2,
72
+ absolute: true
73
+ });
74
+ const graphqlIdx = serverFunctions.findIndex(
75
+ (x) => import_node_path.default.basename(x, import_node_path.default.extname(x)) === "graphql"
76
+ );
77
+ if (graphqlIdx >= 0) {
78
+ const [graphqlFn] = serverFunctions.splice(graphqlIdx, 1);
79
+ serverFunctions.unshift(graphqlFn);
80
+ }
81
+ const fetchableMap = /* @__PURE__ */ new Map();
82
+ const router = (0, import_rou3.createRouter)();
83
+ const registrations = [];
84
+ for (const fnPath of serverFunctions) {
85
+ const routeName = import_node_path.default.basename(fnPath, import_node_path.default.extname(fnPath));
86
+ const routePath = routeName === "graphql" ? "/graphql" : `/${routeName}`;
87
+ const importUrl = options?.cacheBust ? `${(0, import_node_url.pathToFileURL)(fnPath).href}?t=${options.cacheBust}` : (0, import_node_url.pathToFileURL)(fnPath).href;
88
+ const fnImport = await import(importUrl);
89
+ if ("__rw_graphqlOptions" in fnImport && fnImport.__rw_graphqlOptions != null) {
90
+ const { createGraphQLYoga } = await import("@cedarjs/graphql-server");
91
+ const graphqlOptions = fnImport.__rw_graphqlOptions;
92
+ const { yoga } = await createGraphQLYoga(graphqlOptions);
93
+ const graphqlFetchable = {
94
+ async fetch(request) {
95
+ const cedarContext = await (0, import_runtime.buildCedarContext)(request, {
96
+ authDecoder: graphqlOptions.authDecoder
97
+ });
98
+ const event = await (0, import_runtime.requestToLegacyEvent)(request, cedarContext);
99
+ return yoga.handle(request, {
100
+ request,
101
+ cedarContext,
102
+ event,
103
+ requestContext: void 0
104
+ });
105
+ }
106
+ };
107
+ fetchableMap.set(routeName, graphqlFetchable);
108
+ registrations.push({
109
+ id: routePath,
110
+ route: routePath,
111
+ method: [...GRAPHQL_METHODS]
112
+ });
113
+ for (const method of GRAPHQL_METHODS) {
114
+ (0, import_rou3.addRoute)(router, method, routePath, routeName);
115
+ (0, import_rou3.addRoute)(router, method, `${routePath}/**`, routeName);
116
+ }
117
+ continue;
118
+ }
119
+ const cedarHandler = (() => {
120
+ if ("handle" in fnImport && typeof fnImport.handle === "function") {
121
+ return fnImport.handle;
122
+ }
123
+ if ("default" in fnImport && fnImport.default != null && "handle" in fnImport.default && typeof fnImport.default.handle === "function") {
124
+ return fnImport.default.handle;
125
+ }
126
+ return void 0;
127
+ })();
128
+ if (!cedarHandler) {
129
+ console.warn(
130
+ routeName,
131
+ "at",
132
+ fnPath,
133
+ "does not export a Fetch-native `handle` function and will not be served by the Universal Deploy server. Migrate to `export async function handle(request, ctx)` or use `yarn cedar serve` for legacy Lambda-shaped handler support."
134
+ );
135
+ continue;
136
+ }
137
+ const handler = cedarHandler;
138
+ fetchableMap.set(routeName, (0, import_udFetchable.createCedarFetchable)(handler));
139
+ registrations.push({
140
+ id: routePath,
141
+ route: routePath
142
+ // method omitted → matches all HTTP methods per @universal-deploy/store docs
143
+ });
144
+ for (const method of ALL_HTTP_METHODS) {
145
+ (0, import_rou3.addRoute)(router, method, routePath, routeName);
146
+ (0, import_rou3.addRoute)(router, method, `${routePath}/**`, routeName);
147
+ }
148
+ }
149
+ const fetchable = {
150
+ fetch(request) {
151
+ return (0, import_store.getAsyncStoreInstance)().run(
152
+ /* @__PURE__ */ new Map(),
153
+ async () => {
154
+ const url = new URL(request.url);
155
+ let routePathname = url.pathname;
156
+ if (normalizedApiRootPath !== "/" && routePathname.startsWith(normalizedApiRootPath)) {
157
+ routePathname = routePathname.slice(
158
+ normalizedApiRootPath.length - 1
159
+ );
160
+ }
161
+ if (!routePathname.startsWith("/")) {
162
+ routePathname = "/" + routePathname;
163
+ }
164
+ const match = (0, import_rou3.findRoute)(router, request.method, routePathname);
165
+ if (!match) {
166
+ return new Response("Not Found", { status: 404 });
167
+ }
168
+ const matchedRouteName = match.data;
169
+ const fnFetchable = fetchableMap.get(matchedRouteName);
170
+ if (!fnFetchable) {
171
+ return new Response("Not Found", { status: 404 });
172
+ }
173
+ try {
174
+ return await fnFetchable.fetch(request);
175
+ } catch (err) {
176
+ console.error(
177
+ "Unhandled error in fetch handler for route",
178
+ matchedRouteName,
179
+ err
180
+ );
181
+ return new Response("Internal Server Error", { status: 500 });
182
+ }
183
+ }
184
+ );
185
+ }
186
+ };
187
+ return { fetchable, registrations };
188
+ }
189
+ // Annotate the CommonJS export names for ESM import in node:
190
+ 0 && (module.exports = {
191
+ buildCedarDispatcher
192
+ });
@@ -0,0 +1,12 @@
1
+ import type { CedarHandler } from '@cedarjs/api/runtime';
2
+ export interface Fetchable {
3
+ fetch(request: Request): Response | Promise<Response>;
4
+ }
5
+ /**
6
+ * Wraps a CedarHandler in a WinterTC-compatible Fetchable.
7
+ *
8
+ * The Fetchable calls buildCedarContext to produce a CedarRequestContext,
9
+ * then delegates to the handler.
10
+ */
11
+ export declare function createCedarFetchable(handler: CedarHandler): Fetchable;
12
+ //# sourceMappingURL=udFetchable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"udFetchable.d.ts","sourceRoot":"","sources":["../../src/udFetchable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGxD,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;CACtD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,SAAS,CAOrE"}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var udFetchable_exports = {};
20
+ __export(udFetchable_exports, {
21
+ createCedarFetchable: () => createCedarFetchable
22
+ });
23
+ module.exports = __toCommonJS(udFetchable_exports);
24
+ var import_runtime = require("@cedarjs/api/runtime");
25
+ function createCedarFetchable(handler) {
26
+ return {
27
+ async fetch(request) {
28
+ const ctx = await (0, import_runtime.buildCedarContext)(request);
29
+ return handler(request, ctx);
30
+ }
31
+ };
32
+ }
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ createCedarFetchable
36
+ });
@@ -0,0 +1,28 @@
1
+ import type { EntryMeta } from '@universal-deploy/store';
2
+ import type { Fetchable } from './udFetchable.js';
3
+ export interface CedarDispatcherOptions {
4
+ apiRootPath?: string;
5
+ discoverFunctionsGlob?: string | string[];
6
+ /**
7
+ * Cache-bust token appended to dynamic ESM imports. Use this in dev to
8
+ * bypass Node.js's ESM module cache after a rebuild. Production builds
9
+ * should omit this.
10
+ */
11
+ cacheBust?: string | number;
12
+ }
13
+ export interface CedarDispatcherResult {
14
+ fetchable: Fetchable;
15
+ registrations: EntryMeta[];
16
+ }
17
+ /**
18
+ * Shared aggregate Cedar API dispatcher used by
19
+ * `cedarUniversalDeployPlugin` (via `virtual:cedar-api`).
20
+ *
21
+ * Discovers Cedar API functions in `api/dist/functions/`, builds a rou3 router
22
+ * and a map of route names to Fetchables, then returns a single Fetchable that
23
+ * routes incoming Fetch-API requests to the correct per-function handler.
24
+ * Also returns the list of `EntryMeta` registrations so callers can forward
25
+ * them to `@universal-deploy/store` via `addEntry()`.
26
+ */
27
+ export declare function buildCedarDispatcher(options?: CedarDispatcherOptions): Promise<CedarDispatcherResult>;
28
+ //# sourceMappingURL=udDispatcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"udDispatcher.d.ts","sourceRoot":"","sources":["../src/udDispatcher.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAUxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAgBjD,MAAM,WAAW,sBAAsB;IACrC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,qBAAqB,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACzC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,SAAS,CAAA;IACpB,aAAa,EAAE,SAAS,EAAE,CAAA;CAC3B;AA6BD;;;;;;;;;GASG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CAmNhC"}
@@ -0,0 +1,158 @@
1
+ import path from "node:path";
2
+ import { pathToFileURL } from "node:url";
3
+ import fg from "fast-glob";
4
+ import { addRoute, createRouter, findRoute } from "rou3";
5
+ import { buildCedarContext, requestToLegacyEvent } from "@cedarjs/api/runtime";
6
+ import { getAsyncStoreInstance } from "@cedarjs/context/dist/store";
7
+ import { getPaths } from "@cedarjs/project-config";
8
+ import { createCedarFetchable } from "./udFetchable.js";
9
+ const ALL_HTTP_METHODS = [
10
+ "GET",
11
+ "HEAD",
12
+ "POST",
13
+ "PUT",
14
+ "DELETE",
15
+ "PATCH",
16
+ "OPTIONS",
17
+ "CONNECT",
18
+ "TRACE"
19
+ ];
20
+ const GRAPHQL_METHODS = ["GET", "POST", "OPTIONS"];
21
+ function normalizeApiRootPath(rootPath) {
22
+ let normalized = rootPath;
23
+ if (!normalized.startsWith("/")) {
24
+ normalized = "/" + normalized;
25
+ }
26
+ if (!normalized.endsWith("/")) {
27
+ normalized = normalized + "/";
28
+ }
29
+ return normalized;
30
+ }
31
+ async function buildCedarDispatcher(options) {
32
+ const normalizedApiRootPath = normalizeApiRootPath(
33
+ options?.apiRootPath ?? "/"
34
+ );
35
+ const discoverFunctionsGlob = options?.discoverFunctionsGlob ?? "dist/functions/**/*.{ts,js}";
36
+ const serverFunctions = fg.sync(discoverFunctionsGlob, {
37
+ cwd: getPaths().api.base,
38
+ deep: 2,
39
+ absolute: true
40
+ });
41
+ const graphqlIdx = serverFunctions.findIndex(
42
+ (x) => path.basename(x, path.extname(x)) === "graphql"
43
+ );
44
+ if (graphqlIdx >= 0) {
45
+ const [graphqlFn] = serverFunctions.splice(graphqlIdx, 1);
46
+ serverFunctions.unshift(graphqlFn);
47
+ }
48
+ const fetchableMap = /* @__PURE__ */ new Map();
49
+ const router = createRouter();
50
+ const registrations = [];
51
+ for (const fnPath of serverFunctions) {
52
+ const routeName = path.basename(fnPath, path.extname(fnPath));
53
+ const routePath = routeName === "graphql" ? "/graphql" : `/${routeName}`;
54
+ const importUrl = options?.cacheBust ? `${pathToFileURL(fnPath).href}?t=${options.cacheBust}` : pathToFileURL(fnPath).href;
55
+ const fnImport = await import(importUrl);
56
+ if ("__rw_graphqlOptions" in fnImport && fnImport.__rw_graphqlOptions != null) {
57
+ const { createGraphQLYoga } = await import("@cedarjs/graphql-server");
58
+ const graphqlOptions = fnImport.__rw_graphqlOptions;
59
+ const { yoga } = await createGraphQLYoga(graphqlOptions);
60
+ const graphqlFetchable = {
61
+ async fetch(request) {
62
+ const cedarContext = await buildCedarContext(request, {
63
+ authDecoder: graphqlOptions.authDecoder
64
+ });
65
+ const event = await requestToLegacyEvent(request, cedarContext);
66
+ return yoga.handle(request, {
67
+ request,
68
+ cedarContext,
69
+ event,
70
+ requestContext: void 0
71
+ });
72
+ }
73
+ };
74
+ fetchableMap.set(routeName, graphqlFetchable);
75
+ registrations.push({
76
+ id: routePath,
77
+ route: routePath,
78
+ method: [...GRAPHQL_METHODS]
79
+ });
80
+ for (const method of GRAPHQL_METHODS) {
81
+ addRoute(router, method, routePath, routeName);
82
+ addRoute(router, method, `${routePath}/**`, routeName);
83
+ }
84
+ continue;
85
+ }
86
+ const cedarHandler = (() => {
87
+ if ("handle" in fnImport && typeof fnImport.handle === "function") {
88
+ return fnImport.handle;
89
+ }
90
+ if ("default" in fnImport && fnImport.default != null && "handle" in fnImport.default && typeof fnImport.default.handle === "function") {
91
+ return fnImport.default.handle;
92
+ }
93
+ return void 0;
94
+ })();
95
+ if (!cedarHandler) {
96
+ console.warn(
97
+ routeName,
98
+ "at",
99
+ fnPath,
100
+ "does not export a Fetch-native `handle` function and will not be served by the Universal Deploy server. Migrate to `export async function handle(request, ctx)` or use `yarn cedar serve` for legacy Lambda-shaped handler support."
101
+ );
102
+ continue;
103
+ }
104
+ const handler = cedarHandler;
105
+ fetchableMap.set(routeName, createCedarFetchable(handler));
106
+ registrations.push({
107
+ id: routePath,
108
+ route: routePath
109
+ // method omitted → matches all HTTP methods per @universal-deploy/store docs
110
+ });
111
+ for (const method of ALL_HTTP_METHODS) {
112
+ addRoute(router, method, routePath, routeName);
113
+ addRoute(router, method, `${routePath}/**`, routeName);
114
+ }
115
+ }
116
+ const fetchable = {
117
+ fetch(request) {
118
+ return getAsyncStoreInstance().run(
119
+ /* @__PURE__ */ new Map(),
120
+ async () => {
121
+ const url = new URL(request.url);
122
+ let routePathname = url.pathname;
123
+ if (normalizedApiRootPath !== "/" && routePathname.startsWith(normalizedApiRootPath)) {
124
+ routePathname = routePathname.slice(
125
+ normalizedApiRootPath.length - 1
126
+ );
127
+ }
128
+ if (!routePathname.startsWith("/")) {
129
+ routePathname = "/" + routePathname;
130
+ }
131
+ const match = findRoute(router, request.method, routePathname);
132
+ if (!match) {
133
+ return new Response("Not Found", { status: 404 });
134
+ }
135
+ const matchedRouteName = match.data;
136
+ const fnFetchable = fetchableMap.get(matchedRouteName);
137
+ if (!fnFetchable) {
138
+ return new Response("Not Found", { status: 404 });
139
+ }
140
+ try {
141
+ return await fnFetchable.fetch(request);
142
+ } catch (err) {
143
+ console.error(
144
+ "Unhandled error in fetch handler for route",
145
+ matchedRouteName,
146
+ err
147
+ );
148
+ return new Response("Internal Server Error", { status: 500 });
149
+ }
150
+ }
151
+ );
152
+ }
153
+ };
154
+ return { fetchable, registrations };
155
+ }
156
+ export {
157
+ buildCedarDispatcher
158
+ };
@@ -0,0 +1,12 @@
1
+ import type { CedarHandler } from '@cedarjs/api/runtime';
2
+ export interface Fetchable {
3
+ fetch(request: Request): Response | Promise<Response>;
4
+ }
5
+ /**
6
+ * Wraps a CedarHandler in a WinterTC-compatible Fetchable.
7
+ *
8
+ * The Fetchable calls buildCedarContext to produce a CedarRequestContext,
9
+ * then delegates to the handler.
10
+ */
11
+ export declare function createCedarFetchable(handler: CedarHandler): Fetchable;
12
+ //# sourceMappingURL=udFetchable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"udFetchable.d.ts","sourceRoot":"","sources":["../src/udFetchable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGxD,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAA;CACtD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,SAAS,CAOrE"}
@@ -0,0 +1,12 @@
1
+ import { buildCedarContext } from "@cedarjs/api/runtime";
2
+ function createCedarFetchable(handler) {
3
+ return {
4
+ async fetch(request) {
5
+ const ctx = await buildCedarContext(request);
6
+ return handler(request, ctx);
7
+ }
8
+ };
9
+ }
10
+ export {
11
+ createCedarFetchable
12
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/api-server",
3
- "version": "4.0.0-canary.13869+572dd23657",
3
+ "version": "4.0.0-canary.13871+0dee87603c",
4
4
  "description": "CedarJS's HTTP server for Serverless Functions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -73,6 +73,18 @@
73
73
  "types": "./dist/cjs/bothCLIConfigHandler.d.ts",
74
74
  "default": "./dist/cjs/bothCLIConfigHandler.js"
75
75
  },
76
+ "./udDispatcher": {
77
+ "import": {
78
+ "types": "./dist/udDispatcher.d.ts",
79
+ "default": "./dist/udDispatcher.js"
80
+ }
81
+ },
82
+ "./udFetchable": {
83
+ "import": {
84
+ "types": "./dist/udFetchable.d.ts",
85
+ "default": "./dist/udFetchable.js"
86
+ }
87
+ },
76
88
  "./watch": {
77
89
  "import": {
78
90
  "types": "./dist/watch.d.ts",
@@ -123,13 +135,15 @@
123
135
  "test:watch": "vitest watch"
124
136
  },
125
137
  "dependencies": {
126
- "@cedarjs/context": "4.0.0-canary.13869",
127
- "@cedarjs/fastify-web": "4.0.0-canary.13869",
128
- "@cedarjs/internal": "4.0.0-canary.13869",
129
- "@cedarjs/project-config": "4.0.0-canary.13869",
130
- "@cedarjs/web-server": "4.0.0-canary.13869",
138
+ "@cedarjs/context": "4.0.0-canary.13871",
139
+ "@cedarjs/fastify-web": "4.0.0-canary.13871",
140
+ "@cedarjs/internal": "4.0.0-canary.13871",
141
+ "@cedarjs/project-config": "4.0.0-canary.13871",
142
+ "@cedarjs/web-server": "4.0.0-canary.13871",
131
143
  "@fastify/multipart": "9.4.0",
132
144
  "@fastify/url-data": "6.0.3",
145
+ "@universal-deploy/node": "^0.1.6",
146
+ "@universal-deploy/store": "^0.2.1",
133
147
  "ansis": "4.2.0",
134
148
  "chokidar": "3.6.0",
135
149
  "dotenv-defaults": "5.0.2",
@@ -140,12 +154,14 @@
140
154
  "picoquery": "2.5.0",
141
155
  "pretty-bytes": "5.6.0",
142
156
  "pretty-ms": "7.0.1",
157
+ "rou3": "^0.8.1",
143
158
  "split2": "4.2.0",
159
+ "srvx": "^0.11.9",
144
160
  "termi-link": "1.1.0",
145
161
  "yargs": "17.7.2"
146
162
  },
147
163
  "devDependencies": {
148
- "@cedarjs/framework-tools": "4.0.0-canary.13869",
164
+ "@cedarjs/framework-tools": "4.0.0-canary.13871",
149
165
  "@types/aws-lambda": "8.10.161",
150
166
  "@types/dotenv-defaults": "^5.0.0",
151
167
  "@types/split2": "4.2.3",
@@ -158,7 +174,7 @@
158
174
  "vitest": "3.2.4"
159
175
  },
160
176
  "peerDependencies": {
161
- "@cedarjs/graphql-server": "4.0.0-canary.13869"
177
+ "@cedarjs/graphql-server": "4.0.0-canary.13871"
162
178
  },
163
179
  "peerDependenciesMeta": {
164
180
  "@cedarjs/graphql-server": {
@@ -168,5 +184,5 @@
168
184
  "publishConfig": {
169
185
  "access": "public"
170
186
  },
171
- "gitHead": "572dd236578efed144ab85d042496cd75950bd5c"
187
+ "gitHead": "0dee87603cbf1edb678047367320a4efaadcec81"
172
188
  }