@flowselections/floriday-afhandeling-module 1.0.20 → 1.0.21

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.
@@ -1,3 +1,3 @@
1
1
  import type { SupabaseClient } from "@supabase/supabase-js";
2
- export declare function handleDispatchCarrierSignups(_request: Request, injected?: SupabaseClient): Promise<Response>;
2
+ export declare function handleDispatchCarrierSignups(request: Request, injected?: SupabaseClient): Promise<Response>;
3
3
  //# sourceMappingURL=dispatchCarrierSignups.handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dispatchCarrierSignups.handler.d.ts","sourceRoot":"","sources":["../../../src/lib/serverRoutes/dispatchCarrierSignups.handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA+G5D,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,OAAO,EACjB,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,QAAQ,CAAC,CA0UnB"}
1
+ {"version":3,"file":"dispatchCarrierSignups.handler.d.ts","sourceRoot":"","sources":["../../../src/lib/serverRoutes/dispatchCarrierSignups.handler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AA+G5D,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,OAAO,EAChB,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,QAAQ,CAAC,CAgVnB"}
@@ -42,7 +42,12 @@ function cartsFor(items) {
42
42
  }
43
43
  return { carts, plants };
44
44
  }
45
- export async function handleDispatchCarrierSignups(_request, injected) {
45
+ export async function handleDispatchCarrierSignups(request, injected) {
46
+ const apikey = request.headers.get("apikey") ?? request.headers.get("x-api-key");
47
+ const expected = process.env.SUPABASE_PUBLISHABLE_KEY;
48
+ if (!expected || !apikey || apikey !== expected) {
49
+ return new Response("Unauthorized", { status: 401 });
50
+ }
46
51
  let admin;
47
52
  if (injected) {
48
53
  admin = injected;
@@ -1,3 +1,3 @@
1
1
  import { type SupabaseClient } from "@supabase/supabase-js";
2
- export declare function handleLogisticsTick(_request: Request, injected?: SupabaseClient): Promise<Response>;
2
+ export declare function handleLogisticsTick(request: Request, injected?: SupabaseClient): Promise<Response>;
3
3
  //# sourceMappingURL=logisticsTick.handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logisticsTick.handler.d.ts","sourceRoot":"","sources":["../../../src/lib/serverRoutes/logisticsTick.handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG1E,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,OAAO,EACjB,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,QAAQ,CAAC,CA8BnB"}
1
+ {"version":3,"file":"logisticsTick.handler.d.ts","sourceRoot":"","sources":["../../../src/lib/serverRoutes/logisticsTick.handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG1E,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,OAAO,EAChB,QAAQ,CAAC,EAAE,cAAc,GACxB,OAAO,CAAC,QAAQ,CAAC,CAoCnB"}
@@ -2,7 +2,12 @@
2
2
  // NB: dit endpoint is publiek en heeft géén auth-check — nog niet in het shell-manifest.
3
3
  import { createClient } from "@supabase/supabase-js";
4
4
  import { runStrategyPlannerForUser } from "../logisticsEngine/evaluate.functions";
5
- export async function handleLogisticsTick(_request, injected) {
5
+ export async function handleLogisticsTick(request, injected) {
6
+ const apikey = request.headers.get("apikey") ?? request.headers.get("x-api-key");
7
+ const expected = process.env.SUPABASE_PUBLISHABLE_KEY;
8
+ if (!expected || !apikey || apikey !== expected) {
9
+ return new Response("Unauthorized", { status: 401 });
10
+ }
6
11
  let admin;
7
12
  if (injected) {
8
13
  admin = injected;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowselections/floriday-afhandeling-module",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "private": false,
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -152,6 +152,22 @@
152
152
  "methods": [
153
153
  "POST"
154
154
  ]
155
+ },
156
+ {
157
+ "routePath": "/api/public/hooks/logistics-tick",
158
+ "import": "@flowselections/floriday-afhandeling-module/server-routes",
159
+ "handler": "handleLogisticsTick",
160
+ "methods": [
161
+ "POST"
162
+ ]
163
+ },
164
+ {
165
+ "routePath": "/api/public/hooks/dispatch-carrier-signups",
166
+ "import": "@flowselections/floriday-afhandeling-module/server-routes",
167
+ "handler": "handleDispatchCarrierSignups",
168
+ "methods": [
169
+ "POST"
170
+ ]
155
171
  }
156
172
  ]
157
173
  }