@makeswift/express-react 0.0.9-canary.0 → 0.1.0-canary.2
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/cjs/server/api-handler.js +2 -2
- package/dist/cjs/server/api-handler.js.map +1 -1
- package/dist/esm/server/api-handler.js +2 -2
- package/dist/esm/server/api-handler.js.map +1 -1
- package/dist/types/server/api-handler.d.ts +1 -1
- package/dist/types/server/api-handler.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -24,8 +24,8 @@ module.exports = __toCommonJS(api_handler_exports);
|
|
|
24
24
|
var import_unstable_framework_support = require("@makeswift/runtime/unstable-framework-support");
|
|
25
25
|
var import_client = require("../client");
|
|
26
26
|
const API_PATH_PREFIX = "/api/makeswift/";
|
|
27
|
-
function createApiHandler(apiKey, {
|
|
28
|
-
const client = new import_client.Makeswift(apiKey, {
|
|
27
|
+
function createApiHandler(apiKey, { runtime, revalidationHandler, ...userConfig }) {
|
|
28
|
+
const client = new import_client.Makeswift(apiKey, { runtime });
|
|
29
29
|
return async function apiHandler(req, res, next) {
|
|
30
30
|
if (!req.path.startsWith(API_PATH_PREFIX)) {
|
|
31
31
|
return next();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/api-handler.ts"],"sourcesContent":["import {\n type Request as ExpressRequest,\n type Response as ExpressResponse,\n type RequestHandler,\n type NextFunction,\n} from 'express'\n\nimport {\n type ApiHandlerUserConfig,\n MAKESWIFT_SITE_VERSION_COOKIE,\n createApiHandler as createMakeswiftApiHandler,\n toApiRequest,\n pipeResponseTo,\n} from '@makeswift/runtime/unstable-framework-support'\n\nimport { Makeswift as MakeswiftClient } from '../client'\n\nconst API_PATH_PREFIX = '/api/makeswift/'\n\ntype UserConfig = ApiHandlerUserConfig & {\n revalidationHandler?: (path?: string) => Promise<void>\n}\n\nexport function createApiHandler(\n apiKey: string,\n {
|
|
1
|
+
{"version":3,"sources":["../../../src/server/api-handler.ts"],"sourcesContent":["import {\n type Request as ExpressRequest,\n type Response as ExpressResponse,\n type RequestHandler,\n type NextFunction,\n} from 'express'\n\nimport {\n type ApiHandlerUserConfig,\n MAKESWIFT_SITE_VERSION_COOKIE,\n createApiHandler as createMakeswiftApiHandler,\n toApiRequest,\n pipeResponseTo,\n} from '@makeswift/runtime/unstable-framework-support'\n\nimport { Makeswift as MakeswiftClient } from '../client'\n\nconst API_PATH_PREFIX = '/api/makeswift/'\n\ntype UserConfig = ApiHandlerUserConfig & {\n revalidationHandler?: (path?: string) => Promise<void>\n}\n\nexport function createApiHandler(\n apiKey: string,\n { runtime, revalidationHandler, ...userConfig }: UserConfig,\n): RequestHandler {\n const client = new MakeswiftClient(apiKey, { runtime })\n\n return async function apiHandler(req: ExpressRequest, res: ExpressResponse, next: NextFunction) {\n if (!req.path.startsWith(API_PATH_PREFIX)) {\n return next()\n }\n\n const route = `/${req.path.replace(API_PATH_PREFIX, '')}`\n\n const apiHandler = createMakeswiftApiHandler(apiKey, {\n ...userConfig,\n previewCookieNames: [MAKESWIFT_SITE_VERSION_COOKIE],\n revalidationHandler: revalidationHandler ?? (() => Promise.resolve()),\n runtime,\n client,\n })\n\n return pipeResponseTo(await apiHandler(toApiRequest(req), route), res)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,wCAMO;AAEP,oBAA6C;AAE7C,MAAM,kBAAkB;AAMjB,SAAS,iBACd,QACA,EAAE,SAAS,qBAAqB,GAAG,WAAW,GAC9B;AAChB,QAAM,SAAS,IAAI,cAAAA,UAAgB,QAAQ,EAAE,QAAQ,CAAC;AAEtD,SAAO,eAAe,WAAW,KAAqB,KAAsB,MAAoB;AAC9F,QAAI,CAAC,IAAI,KAAK,WAAW,eAAe,GAAG;AACzC,aAAO,KAAK;AAAA,IACd;AAEA,UAAM,QAAQ,IAAI,IAAI,KAAK,QAAQ,iBAAiB,EAAE,CAAC;AAEvD,UAAMC,kBAAa,kCAAAC,kBAA0B,QAAQ;AAAA,MACnD,GAAG;AAAA,MACH,oBAAoB,CAAC,+DAA6B;AAAA,MAClD,qBAAqB,wBAAwB,MAAM,QAAQ,QAAQ;AAAA,MACnE;AAAA,MACA;AAAA,IACF,CAAC;AAED,eAAO,kDAAe,MAAMD,gBAAW,gDAAa,GAAG,GAAG,KAAK,GAAG,GAAG;AAAA,EACvE;AACF;","names":["MakeswiftClient","apiHandler","createMakeswiftApiHandler"]}
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
} from "@makeswift/runtime/unstable-framework-support";
|
|
7
7
|
import { Makeswift as MakeswiftClient } from "../client";
|
|
8
8
|
const API_PATH_PREFIX = "/api/makeswift/";
|
|
9
|
-
function createApiHandler(apiKey, {
|
|
10
|
-
const client = new MakeswiftClient(apiKey, {
|
|
9
|
+
function createApiHandler(apiKey, { runtime, revalidationHandler, ...userConfig }) {
|
|
10
|
+
const client = new MakeswiftClient(apiKey, { runtime });
|
|
11
11
|
return async function apiHandler(req, res, next) {
|
|
12
12
|
if (!req.path.startsWith(API_PATH_PREFIX)) {
|
|
13
13
|
return next();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/server/api-handler.ts"],"sourcesContent":["import {\n type Request as ExpressRequest,\n type Response as ExpressResponse,\n type RequestHandler,\n type NextFunction,\n} from 'express'\n\nimport {\n type ApiHandlerUserConfig,\n MAKESWIFT_SITE_VERSION_COOKIE,\n createApiHandler as createMakeswiftApiHandler,\n toApiRequest,\n pipeResponseTo,\n} from '@makeswift/runtime/unstable-framework-support'\n\nimport { Makeswift as MakeswiftClient } from '../client'\n\nconst API_PATH_PREFIX = '/api/makeswift/'\n\ntype UserConfig = ApiHandlerUserConfig & {\n revalidationHandler?: (path?: string) => Promise<void>\n}\n\nexport function createApiHandler(\n apiKey: string,\n {
|
|
1
|
+
{"version":3,"sources":["../../../src/server/api-handler.ts"],"sourcesContent":["import {\n type Request as ExpressRequest,\n type Response as ExpressResponse,\n type RequestHandler,\n type NextFunction,\n} from 'express'\n\nimport {\n type ApiHandlerUserConfig,\n MAKESWIFT_SITE_VERSION_COOKIE,\n createApiHandler as createMakeswiftApiHandler,\n toApiRequest,\n pipeResponseTo,\n} from '@makeswift/runtime/unstable-framework-support'\n\nimport { Makeswift as MakeswiftClient } from '../client'\n\nconst API_PATH_PREFIX = '/api/makeswift/'\n\ntype UserConfig = ApiHandlerUserConfig & {\n revalidationHandler?: (path?: string) => Promise<void>\n}\n\nexport function createApiHandler(\n apiKey: string,\n { runtime, revalidationHandler, ...userConfig }: UserConfig,\n): RequestHandler {\n const client = new MakeswiftClient(apiKey, { runtime })\n\n return async function apiHandler(req: ExpressRequest, res: ExpressResponse, next: NextFunction) {\n if (!req.path.startsWith(API_PATH_PREFIX)) {\n return next()\n }\n\n const route = `/${req.path.replace(API_PATH_PREFIX, '')}`\n\n const apiHandler = createMakeswiftApiHandler(apiKey, {\n ...userConfig,\n previewCookieNames: [MAKESWIFT_SITE_VERSION_COOKIE],\n revalidationHandler: revalidationHandler ?? (() => Promise.resolve()),\n runtime,\n client,\n })\n\n return pipeResponseTo(await apiHandler(toApiRequest(req), route), res)\n }\n}\n"],"mappings":"AAOA;AAAA,EAEE;AAAA,EACA,oBAAoB;AAAA,EACpB;AAAA,EACA;AAAA,OACK;AAEP,SAAS,aAAa,uBAAuB;AAE7C,MAAM,kBAAkB;AAMjB,SAAS,iBACd,QACA,EAAE,SAAS,qBAAqB,GAAG,WAAW,GAC9B;AAChB,QAAM,SAAS,IAAI,gBAAgB,QAAQ,EAAE,QAAQ,CAAC;AAEtD,SAAO,eAAe,WAAW,KAAqB,KAAsB,MAAoB;AAC9F,QAAI,CAAC,IAAI,KAAK,WAAW,eAAe,GAAG;AACzC,aAAO,KAAK;AAAA,IACd;AAEA,UAAM,QAAQ,IAAI,IAAI,KAAK,QAAQ,iBAAiB,EAAE,CAAC;AAEvD,UAAMA,cAAa,0BAA0B,QAAQ;AAAA,MACnD,GAAG;AAAA,MACH,oBAAoB,CAAC,6BAA6B;AAAA,MAClD,qBAAqB,wBAAwB,MAAM,QAAQ,QAAQ;AAAA,MACnE;AAAA,MACA;AAAA,IACF,CAAC;AAED,WAAO,eAAe,MAAMA,YAAW,aAAa,GAAG,GAAG,KAAK,GAAG,GAAG;AAAA,EACvE;AACF;","names":["apiHandler"]}
|
|
@@ -3,6 +3,6 @@ import { type ApiHandlerUserConfig } from '@makeswift/runtime/unstable-framework
|
|
|
3
3
|
type UserConfig = ApiHandlerUserConfig & {
|
|
4
4
|
revalidationHandler?: (path?: string) => Promise<void>;
|
|
5
5
|
};
|
|
6
|
-
export declare function createApiHandler(apiKey: string, {
|
|
6
|
+
export declare function createApiHandler(apiKey: string, { runtime, revalidationHandler, ...userConfig }: UserConfig): RequestHandler;
|
|
7
7
|
export {};
|
|
8
8
|
//# sourceMappingURL=api-handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-handler.d.ts","sourceRoot":"","sources":["../../../src/server/api-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EAEpB,MAAM,SAAS,CAAA;AAEhB,OAAO,EACL,KAAK,oBAAoB,EAK1B,MAAM,+CAA+C,CAAA;AAMtD,KAAK,UAAU,GAAG,oBAAoB,GAAG;IACvC,mBAAmB,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACvD,CAAA;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,EAAE,
|
|
1
|
+
{"version":3,"file":"api-handler.d.ts","sourceRoot":"","sources":["../../../src/server/api-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EAEpB,MAAM,SAAS,CAAA;AAEhB,OAAO,EACL,KAAK,oBAAoB,EAK1B,MAAM,+CAA+C,CAAA;AAMtD,KAAK,UAAU,GAAG,oBAAoB,GAAG;IACvC,mBAAmB,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACvD,CAAA;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,EAAE,OAAO,EAAE,mBAAmB,EAAE,GAAG,UAAU,EAAE,EAAE,UAAU,GAC1D,cAAc,CAoBhB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makeswift/express-react",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0-canary.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "makeswift/makeswift",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"cookie": "^1.0.2",
|
|
31
|
-
"@makeswift/runtime": "0.
|
|
31
|
+
"@makeswift/runtime": "0.27.0-canary.2"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@types/express": "^5.0.0",
|