Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JoshBarr/2b64ed796cea542743de40e165abc10e to your computer and use it in GitHub Desktop.
Save JoshBarr/2b64ed796cea542743de40e165abc10e to your computer and use it in GitHub Desktop.
ts-rest serverless patch
diff --git a/fetch.js b/fetch.js
index f894066798bb1e429c2d2f07d1964371df58e91f..ae7d5ac0554c86203b0eaf5ba004a1ab43e818a9 100644
--- a/fetch.js
+++ b/fetch.js
@@ -2,8 +2,8 @@
Object.defineProperty(exports, '__esModule', { value: true });
-var router = require('./router.cjs');
-var types = require('./types.cjs');
+var router = require('./router.js');
+var types = require('./types.js');
require('@ts-rest/core');
const tsr = {
diff --git a/fetch.mjs b/fetch.mjs
index 96e851c88efc150056445068872a71b110283ea6..9b5b62d6c310c16f0e79471265af789113983937 100644
--- a/fetch.mjs
+++ b/fetch.mjs
@@ -1,5 +1,5 @@
-import { c as createServerlessRouter, s as serverlessErrorHandler } from './router.js';
-import { c as TsRestRequest } from './types.js';
+import { c as createServerlessRouter, s as serverlessErrorHandler } from './router.mjs';
+import { c as TsRestRequest } from './types.mjs';
import '@ts-rest/core';
const tsr = {
diff --git a/index.js b/index.js
index f3d8a1d75b627b2ac11f90c55eed6ecf6f7a49ef..09c6b521ee00ee15223b1e7957bbba0bf162cce1 100644
--- a/index.js
+++ b/index.js
@@ -2,7 +2,7 @@
Object.defineProperty(exports, '__esModule', { value: true });
-var types = require('./types.cjs');
+var types = require('./types.js');
require('@ts-rest/core');
diff --git a/index.mjs b/index.mjs
index 955dae247684df6ac88d37ab5f624d7ec09ba959..336b2a05a820d9be8c3d0dcf4e41d5531493c51d 100644
--- a/index.mjs
+++ b/index.mjs
@@ -1,2 +1,2 @@
-export { R as RequestValidationError, a as ResponseValidationError, T as TsRestHttpError, c as TsRestRequest, d as TsRestResponse, b as TsRestRouteError } from './types.js';
+export { R as RequestValidationError, a as ResponseValidationError, T as TsRestHttpError, c as TsRestRequest, d as TsRestResponse, b as TsRestRouteError } from './types.mjs';
import '@ts-rest/core';
diff --git a/lambda.js b/lambda.js
index 70589b58e47cfde30dc6074f5df3a2051901caa9..307e8383ce104a57afc0d45c1ce36e00b10bf0b9 100644
--- a/lambda.js
+++ b/lambda.js
@@ -2,8 +2,8 @@
Object.defineProperty(exports, '__esModule', { value: true });
-var types = require('./types.cjs');
-var router = require('./router.cjs');
+var types = require('./types.js');
+var router = require('./router.js');
require('@ts-rest/core');
function isV2(event) {
diff --git a/lambda.mjs b/lambda.mjs
index f10f32359388b2e11e7834eb6d2dac2f16e78d4c..d8b5e1e229668a7f473d11ed1601a36c3b739c1e 100644
--- a/lambda.mjs
+++ b/lambda.mjs
@@ -1,5 +1,5 @@
-import { c as TsRestRequest } from './types.js';
-import { a as splitCookiesString, b as arrayBufferToString, d as arrayBufferToBase64, c as createServerlessRouter, s as serverlessErrorHandler } from './router.js';
+import { c as TsRestRequest } from './types.mjs';
+import { a as splitCookiesString, b as arrayBufferToString, d as arrayBufferToBase64, c as createServerlessRouter, s as serverlessErrorHandler } from './router.mjs';
import '@ts-rest/core';
function isV2(event) {
diff --git a/next-edge.js b/next-edge.js
index 9500c6a3a7c9c726878ac3410ee95b70b7b8891a..42558f0435a72697a4bf261a95b731017a10a686 100644
--- a/next-edge.js
+++ b/next-edge.js
@@ -2,8 +2,8 @@
Object.defineProperty(exports, '__esModule', { value: true });
-var router = require('./router.cjs');
-var types = require('./types.cjs');
+var router = require('./router.js');
+var types = require('./types.js');
require('@ts-rest/core');
const tsr = {
diff --git a/next-edge.mjs b/next-edge.mjs
index 659af5178d573396be07585e45c20c85eb3f2108..f74b2bc931796e407b5cf99f80ff2b02ec8ff951 100644
--- a/next-edge.mjs
+++ b/next-edge.mjs
@@ -1,5 +1,5 @@
-import { c as createServerlessRouter, s as serverlessErrorHandler } from './router.js';
-import { c as TsRestRequest } from './types.js';
+import { c as createServerlessRouter, s as serverlessErrorHandler } from './router.mjs';
+import { c as TsRestRequest } from './types.mjs';
import '@ts-rest/core';
const tsr = {
diff --git a/router.js b/router.js
index 2d6e9a474ca08092f62eea347d841f11366955e0..91e0980f2294d858d5a6f0f5823d64b3dbd5b0c9 100644
--- a/router.js
+++ b/router.js
@@ -1,7 +1,7 @@
'use strict';
var core = require('@ts-rest/core');
-var types = require('./types.cjs');
+var types = require('./types.js');
const e=({base:e="",routes:t=[]}={})=>({__proto__:new Proxy({},{get:(o,s,r,n)=>(o,...a)=>t.push([s.toUpperCase(),RegExp(`^${(n=(e+"/"+o).replace(/\/+(\/|$)/g,"$1")).replace(/(\/?\.?):(\w+)\+/g,"($1(?<$2>*))").replace(/(\/?\.?):(\w+)/g,"($1(?<$2>[^$1/]+?))").replace(/\./g,"\\.").replace(/(\/?)\*/g,"($1.*)?")}/*$`),a,n])&&r}),routes:t,async handle(e,...o){let s,r,n=new URL(e.url),a=e.query={__proto__:null};for(let[e,t]of n.searchParams)a[e]=void 0===a[e]?t:[a[e],t].flat();for(let[a,c,l,i]of t)if((a===e.method||"ALL"===a)&&(r=n.pathname.match(c))){e.params=r.groups||{},e.route=i;for(let t of l)if(void 0!==(s=await t(e.proxy||e,...o)))return s}}});const h=e=>{e.proxy=new Proxy(e.proxy||e,{get:(t,o)=>{let s;return void 0!==(s=t[o])?s.bind?.(e)||s:t?.params?.[o]}});};
diff --git a/router.mjs b/router.mjs
index 035a497f9168ba0714742fa71831142bd26e14e5..a1ad25085d0bbfae7013d0296c5ff1e67f51cc23 100644
--- a/router.mjs
+++ b/router.mjs
@@ -1,5 +1,5 @@
import { isAppRoute, validateResponse, ResponseValidationError, isAppRouteOtherResponse, checkZodSchema, parseJsonQueryObject } from '@ts-rest/core';
-import { d as TsRestResponse, T as TsRestHttpError, a as ResponseValidationError$1, R as RequestValidationError } from './types.js';
+import { d as TsRestResponse, T as TsRestHttpError, a as ResponseValidationError$1, R as RequestValidationError } from './types.mjs';
const e=({base:e="",routes:t=[]}={})=>({__proto__:new Proxy({},{get:(o,s,r,n)=>(o,...a)=>t.push([s.toUpperCase(),RegExp(`^${(n=(e+"/"+o).replace(/\/+(\/|$)/g,"$1")).replace(/(\/?\.?):(\w+)\+/g,"($1(?<$2>*))").replace(/(\/?\.?):(\w+)/g,"($1(?<$2>[^$1/]+?))").replace(/\./g,"\\.").replace(/(\/?)\*/g,"($1.*)?")}/*$`),a,n])&&r}),routes:t,async handle(e,...o){let s,r,n=new URL(e.url),a=e.query={__proto__:null};for(let[e,t]of n.searchParams)a[e]=void 0===a[e]?t:[a[e],t].flat();for(let[a,c,l,i]of t)if((a===e.method||"ALL"===a)&&(r=n.pathname.match(c))){e.params=r.groups||{},e.route=i;for(let t of l)if(void 0!==(s=await t(e.proxy||e,...o)))return s}}});const h=e=>{e.proxy=new Proxy(e.proxy||e,{get:(t,o)=>{let s;return void 0!==(s=t[o])?s.bind?.(e)||s:t?.params?.[o]}});};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment