@flowselections/floriday-authenticatie-module 1.0.72 → 1.0.75

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.
Files changed (30) hide show
  1. package/dist-lib/integrations/supabase/types.d.ts +15 -0
  2. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  3. package/dist-lib/lib/floriday-gateway-auth.js +5 -5
  4. package/dist-lib/lib/floriday-gateway-hmac.d.ts +10 -0
  5. package/dist-lib/lib/floriday-gateway-hmac.d.ts.map +1 -1
  6. package/dist-lib/lib/floriday-gateway-hmac.js +53 -44
  7. package/dist-lib/lib/gateway/active-environment.js +1 -1
  8. package/dist-lib/lib/gateway/auto-process.js +1 -1
  9. package/dist-lib/lib/gateway/cached-list.js +1 -1
  10. package/dist-lib/lib/gateway/code-list.js +1 -1
  11. package/dist-lib/lib/gateway/cron-scan.js +1 -1
  12. package/dist-lib/lib/gateway/diagnostics.js +1 -1
  13. package/dist-lib/lib/gateway/floricode-records.js +1 -1
  14. package/dist-lib/lib/gateway/floriday-get.js +1 -1
  15. package/dist-lib/lib/gateway/fulfillment-order-send.js +1 -1
  16. package/dist-lib/lib/gateway/fulfillment-order-status.js +1 -1
  17. package/dist-lib/lib/gateway/media-upload.js +1 -1
  18. package/dist-lib/lib/gateway/media.js +1 -1
  19. package/dist-lib/lib/gateway/pdf-bulk-merged.js +1 -1
  20. package/dist-lib/lib/gateway/pdf-bulk.js +1 -1
  21. package/dist-lib/lib/gateway/pdf.js +1 -1
  22. package/dist-lib/lib/gateway/product-characteristics.js +1 -1
  23. package/dist-lib/lib/gateway/schema.js +1 -1
  24. package/dist-lib/lib/gateway/supply-line.js +1 -1
  25. package/dist-lib/lib/gateway/trade-item-version.js +1 -1
  26. package/dist-lib/lib/gateway/write.js +1 -1
  27. package/dist-lib/lib/module-version.d.ts +1 -1
  28. package/dist-lib/lib/module-version.d.ts.map +1 -1
  29. package/dist-lib/lib/module-version.js +2 -3
  30. package/package.json +2 -2
@@ -68,19 +68,19 @@ async function verifySupabaseBearer(request, supabase) {
68
68
  try {
69
69
  const { data, error } = await supabase.auth.getUser(token);
70
70
  if (error || !data?.user?.id) {
71
- return { ok: false, status: 401, error: "Ongeldige of verlopen sessie" };
71
+ return { ok: false, status: 401, code: "invalid_session", error: "Ongeldige of verlopen sessie" };
72
72
  }
73
73
  return { ok: true, userId: String(data.user.id) };
74
74
  }
75
75
  catch {
76
- return { ok: false, status: 401, error: "Sessie kon niet worden geverifieerd" };
76
+ return { ok: false, status: 401, code: "invalid_session", error: "Sessie kon niet worden geverifieerd" };
77
77
  }
78
78
  }
79
79
  // Standalone Lovable-deploy: publishable key uit env (backwards-compat).
80
80
  const SUPABASE_URL = process.env.SUPABASE_URL;
81
81
  const SUPABASE_PUBLISHABLE_KEY = process.env.SUPABASE_PUBLISHABLE_KEY;
82
82
  if (!SUPABASE_URL || !SUPABASE_PUBLISHABLE_KEY) {
83
- return { ok: false, status: 500, error: "Supabase niet geconfigureerd op gateway" };
83
+ return { ok: false, status: 500, code: "gateway_not_configured", error: "Supabase niet geconfigureerd op gateway" };
84
84
  }
85
85
  const client = createClient(SUPABASE_URL, SUPABASE_PUBLISHABLE_KEY, {
86
86
  auth: { storage: undefined, persistSession: false, autoRefreshToken: false },
@@ -88,12 +88,12 @@ async function verifySupabaseBearer(request, supabase) {
88
88
  try {
89
89
  const { data, error } = await client.auth.getClaims(token);
90
90
  if (error || !data?.claims?.sub) {
91
- return { ok: false, status: 401, error: "Ongeldige of verlopen sessie" };
91
+ return { ok: false, status: 401, code: "invalid_session", error: "Ongeldige of verlopen sessie" };
92
92
  }
93
93
  return { ok: true, userId: String(data.claims.sub) };
94
94
  }
95
95
  catch {
96
- return { ok: false, status: 401, error: "Sessie kon niet worden geverifieerd" };
96
+ return { ok: false, status: 401, code: "invalid_session", error: "Sessie kon niet worden geverifieerd" };
97
97
  }
98
98
  }
99
99
  /**
@@ -8,11 +8,21 @@ export interface GatewayAuthOk {
8
8
  caller: string;
9
9
  rawBody: string;
10
10
  }
11
+ export type GatewayAuthErrorCode = "gateway_not_configured" | "missing_signature" | "invalid_timestamp" | "timestamp_out_of_range" | "invalid_signature" | "invalid_session";
11
12
  export interface GatewayAuthFail {
12
13
  ok: false;
13
14
  status: number;
15
+ code: GatewayAuthErrorCode;
14
16
  error: string;
15
17
  }
18
+ /**
19
+ * Leest de tijd uit x-floriday-timestamp. Geaccepteerd:
20
+ * - alleen cijfers, 13+ cijfers = epoch-milliseconden
21
+ * - alleen cijfers, 10 cijfers = epoch-seconden
22
+ * - anders ISO-8601 via Date.parse
23
+ * Retourneert epoch-ms of null. De HMAC blijft over de letterlijke headerwaarde.
24
+ */
25
+ export declare function parseGatewayTimestamp(raw: string | null | undefined): number | null;
16
26
  /**
17
27
  * Verifieer een gateway-request. Bij succes geeft het de raw body terug
18
28
  * (kant-en-klaar voor `JSON.parse`). Bij falen krijgt de caller een
@@ -1 +1 @@
1
- {"version":3,"file":"floriday-gateway-hmac.d.ts","sourceRoot":"","sources":["../../src/lib/floriday-gateway-hmac.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAC/D,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAC/D,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AAczD,MAAM,MAAM,yBAAyB,GAAG,MACpC,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAClC,MAAM,GACN,IAAI,GACJ,SAAS,CAAC;AAId,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,yBAAyB,GAAG,IAAI,GACzC,IAAI,CAKN;AAkDD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,IAAI,CAAC;IACT,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AA0BD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,aAAa,GAAG,eAAe,CAAC,CAwC1C;AAQD,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,IAAI,CAAC;IACT,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,UAAU,CAAC;CACvB;AAaD,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,mBAAmB,GAAG,eAAe,CAAC,CAyChD"}
1
+ {"version":3,"file":"floriday-gateway-hmac.d.ts","sourceRoot":"","sources":["../../src/lib/floriday-gateway-hmac.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAC/D,eAAO,MAAM,wBAAwB,yBAAyB,CAAC;AAC/D,eAAO,MAAM,qBAAqB,sBAAsB,CAAC;AAczD,MAAM,MAAM,yBAAyB,GAAG,MACpC,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAClC,MAAM,GACN,IAAI,GACJ,SAAS,CAAC;AAId,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,yBAAyB,GAAG,IAAI,GACzC,IAAI,CAKN;AAkDD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,IAAI,CAAC;IACT,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,oBAAoB,GAC5B,wBAAwB,GACxB,mBAAmB,GACnB,mBAAmB,GACnB,wBAAwB,GACxB,mBAAmB,GACnB,iBAAiB,CAAC;AAEtB,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAUnF;AAsDD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,aAAa,GAAG,eAAe,CAAC,CAqB1C;AAQD,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,IAAI,CAAC;IACT,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,UAAU,CAAC;CACvB;AAaD,wBAAsB,0BAA0B,CAC9C,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,mBAAmB,GAAG,eAAe,CAAC,CAsBhD"}
@@ -69,6 +69,47 @@ async function resolveGatewaySecret() {
69
69
  })());
70
70
  return _inflightCentral;
71
71
  }
72
+ /**
73
+ * Leest de tijd uit x-floriday-timestamp. Geaccepteerd:
74
+ * - alleen cijfers, 13+ cijfers = epoch-milliseconden
75
+ * - alleen cijfers, 10 cijfers = epoch-seconden
76
+ * - anders ISO-8601 via Date.parse
77
+ * Retourneert epoch-ms of null. De HMAC blijft over de letterlijke headerwaarde.
78
+ */
79
+ export function parseGatewayTimestamp(raw) {
80
+ const v = (raw ?? "").trim();
81
+ if (!v)
82
+ return null;
83
+ if (/^\d+$/.test(v)) {
84
+ if (v.length === 10)
85
+ return Number(v) * 1000;
86
+ if (v.length >= 12 && v.length <= 14)
87
+ return Number(v);
88
+ return null;
89
+ }
90
+ const t = Date.parse(v);
91
+ return Number.isFinite(t) ? t : null;
92
+ }
93
+ function checkHeaders(timestampHeader, signatureHeader, now) {
94
+ if (!timestampHeader || !signatureHeader) {
95
+ return { ok: false, status: 401, code: "missing_signature", error: "Ontbrekende handtekening-headers" };
96
+ }
97
+ const ts = parseGatewayTimestamp(timestampHeader);
98
+ if (ts === null) {
99
+ return { ok: false, status: 400, code: "invalid_timestamp", error: "Ongeldig timestamp (gebruik epoch-milliseconden, epoch-seconden of ISO-8601)" };
100
+ }
101
+ if (Math.abs(now - ts) > MAX_CLOCK_SKEW_MS) {
102
+ return { ok: false, status: 400, code: "timestamp_out_of_range", error: "Timestamp valt buiten de toegestane marge (±5 min)" };
103
+ }
104
+ return { ok: true };
105
+ }
106
+ const NOT_CONFIGURED = {
107
+ ok: false,
108
+ status: 500,
109
+ code: "gateway_not_configured",
110
+ error: "Gateway niet geconfigureerd (FLORIDAY_GATEWAY_SECRET ontbreekt)",
111
+ };
112
+ const BAD_SIGNATURE = { ok: false, status: 401, code: "invalid_signature", error: "Ongeldige handtekening" };
72
113
  async function hmacSha256Hex(secret, payload) {
73
114
  const enc = new TextEncoder();
74
115
  const key = await crypto.subtle.importKey("raw", enc.encode(secret), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
@@ -96,35 +137,19 @@ function timingSafeEqualHex(a, b) {
96
137
  */
97
138
  export async function verifyGatewayRequest(request) {
98
139
  const secret = await resolveGatewaySecret();
99
- if (!secret) {
100
- return {
101
- ok: false,
102
- status: 500,
103
- error: "Gateway niet geconfigureerd (FLORIDAY_GATEWAY_SECRET ontbreekt)",
104
- };
105
- }
140
+ if (!secret)
141
+ return NOT_CONFIGURED;
106
142
  const timestampHeader = request.headers.get(GATEWAY_HEADER_TIMESTAMP);
107
143
  const signatureHeader = request.headers.get(GATEWAY_HEADER_SIGNATURE);
108
144
  const callerHeader = request.headers.get(GATEWAY_HEADER_CALLER);
109
- if (!timestampHeader || !signatureHeader) {
110
- return { ok: false, status: 401, error: "Ontbrekende handtekening-headers" };
111
- }
112
- const ts = Number(timestampHeader);
113
- if (!Number.isFinite(ts)) {
114
- return { ok: false, status: 400, error: "Ongeldig timestamp" };
115
- }
116
- if (Math.abs(Date.now() - ts) > MAX_CLOCK_SKEW_MS) {
117
- return {
118
- ok: false,
119
- status: 400,
120
- error: "Timestamp valt buiten de toegestane marge (±5 min)",
121
- };
122
- }
145
+ const pre = checkHeaders(timestampHeader, signatureHeader, Date.now());
146
+ if (!pre.ok)
147
+ return pre;
123
148
  const rawBody = await request.text();
124
149
  const expected = await hmacSha256Hex(secret, `${timestampHeader}.${rawBody}`);
125
150
  const presented = signatureHeader.replace(/^sha256=/i, "").toLowerCase();
126
151
  if (!timingSafeEqualHex(expected, presented)) {
127
- return { ok: false, status: 401, error: "Ongeldige handtekening" };
152
+ return BAD_SIGNATURE;
128
153
  }
129
154
  const caller = (callerHeader ?? "").trim().slice(0, 64) || "external";
130
155
  return { ok: true, caller, rawBody };
@@ -138,36 +163,20 @@ async function sha256Hex(bytes) {
138
163
  }
139
164
  export async function verifyGatewayBinaryRequest(request) {
140
165
  const secret = await resolveGatewaySecret();
141
- if (!secret) {
142
- return {
143
- ok: false,
144
- status: 500,
145
- error: "Gateway niet geconfigureerd (FLORIDAY_GATEWAY_SECRET ontbreekt)",
146
- };
147
- }
166
+ if (!secret)
167
+ return NOT_CONFIGURED;
148
168
  const timestampHeader = request.headers.get(GATEWAY_HEADER_TIMESTAMP);
149
169
  const signatureHeader = request.headers.get(GATEWAY_HEADER_SIGNATURE);
150
170
  const callerHeader = request.headers.get(GATEWAY_HEADER_CALLER);
151
- if (!timestampHeader || !signatureHeader) {
152
- return { ok: false, status: 401, error: "Ontbrekende handtekening-headers" };
153
- }
154
- const ts = Number(timestampHeader);
155
- if (!Number.isFinite(ts)) {
156
- return { ok: false, status: 400, error: "Ongeldig timestamp" };
157
- }
158
- if (Math.abs(Date.now() - ts) > MAX_CLOCK_SKEW_MS) {
159
- return {
160
- ok: false,
161
- status: 400,
162
- error: "Timestamp valt buiten de toegestane marge (±5 min)",
163
- };
164
- }
171
+ const pre = checkHeaders(timestampHeader, signatureHeader, Date.now());
172
+ if (!pre.ok)
173
+ return pre;
165
174
  const bodyBytes = new Uint8Array(await request.arrayBuffer());
166
175
  const bodyHash = await sha256Hex(bodyBytes);
167
176
  const expected = await hmacSha256Hex(secret, `${timestampHeader}.${bodyHash}`);
168
177
  const presented = signatureHeader.replace(/^sha256=/i, "").toLowerCase();
169
178
  if (!timingSafeEqualHex(expected, presented)) {
170
- return { ok: false, status: 401, error: "Ongeldige handtekening" };
179
+ return BAD_SIGNATURE;
171
180
  }
172
181
  const caller = (callerHeader ?? "").trim().slice(0, 64) || "external";
173
182
  return { ok: true, caller, bodyBytes };
@@ -30,7 +30,7 @@ export async function handleActiveEnvironment(request, supabase) {
30
30
  return corsPreflight();
31
31
  const auth = await verifyGatewayCaller(request, supabase);
32
32
  if (!auth.ok) {
33
- return _aeJson({ ok: false, error: auth.error }, { status: auth.status });
33
+ return _aeJson({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
34
34
  }
35
35
  try {
36
36
  const result = await runActiveEnvironment(supabase);
@@ -8,7 +8,7 @@ export async function handleAutoProcess(request, supabase) {
8
8
  return corsPreflight();
9
9
  const auth = await verifyGatewayCaller(request, supabase);
10
10
  if (!auth.ok)
11
- return json({ ok: false, error: auth.error }, { status: auth.status });
11
+ return json({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
12
12
  let body;
13
13
  try {
14
14
  body = JSON.parse(auth.rawBody || "{}");
@@ -40,7 +40,7 @@ import { verifyGatewayCaller } from "../floriday-gateway-auth.js";
40
40
  export async function handleCachedList(request, supabase) {
41
41
  const auth = await verifyGatewayCaller(request, supabase);
42
42
  if (!auth.ok) {
43
- return Response.json({ ok: false, error: auth.error }, { status: auth.status });
43
+ return Response.json({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
44
44
  }
45
45
  let parsed;
46
46
  try {
@@ -33,7 +33,7 @@ import { verifyGatewayCaller } from "../floriday-gateway-auth.js";
33
33
  export async function handleCodeList(request, supabase) {
34
34
  const auth = await verifyGatewayCaller(request, supabase);
35
35
  if (!auth.ok) {
36
- return Response.json({ ok: false, error: auth.error }, { status: auth.status });
36
+ return Response.json({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
37
37
  }
38
38
  let parsed;
39
39
  try {
@@ -8,7 +8,7 @@ export async function handleCronScan(request, supabase) {
8
8
  return corsPreflight();
9
9
  const auth = await verifyGatewayCaller(request, supabase);
10
10
  if (!auth.ok)
11
- return json({ ok: false, error: auth.error }, { status: auth.status });
11
+ return json({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
12
12
  try {
13
13
  const { scanAndTriggerAutoProcess } = await import("../floriday-auto-process.server.js");
14
14
  const summary = await scanAndTriggerAutoProcess(supabase);
@@ -97,7 +97,7 @@ export async function handleDiagnostics(request, supabase) {
97
97
  }
98
98
  const auth = await verifyGatewayCaller(request, supabase);
99
99
  if (!auth.ok) {
100
- return _diagJson({ ok: false, error: auth.error }, { status: auth.status });
100
+ return _diagJson({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
101
101
  }
102
102
  if (auth.rawBody.length > DIAGNOSTICS_MAX_BODY_BYTES) {
103
103
  return _diagJson({ ok: false, error: "Diagnostics-payload te groot (max 256 KB)" }, { status: 413 });
@@ -37,7 +37,7 @@ import { verifyGatewayCaller } from "../floriday-gateway-auth.js";
37
37
  export async function handleFloricodeRecords(request, supabase) {
38
38
  const auth = await verifyGatewayCaller(request, supabase);
39
39
  if (!auth.ok) {
40
- return Response.json({ ok: false, error: auth.error }, { status: auth.status });
40
+ return Response.json({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
41
41
  }
42
42
  let body;
43
43
  try {
@@ -167,7 +167,7 @@ export async function handleFloridayGet(request, supabase) {
167
167
  return corsPreflight();
168
168
  const auth = await verifyGatewayRequest(request);
169
169
  if (!auth.ok)
170
- return _json({ ok: false, error: auth.error }, { status: auth.status });
170
+ return _json({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
171
171
  let body;
172
172
  try {
173
173
  body = JSON.parse(auth.rawBody || "{}");
@@ -245,7 +245,7 @@ export async function handleFulfillmentOrderSend(request, supabase) {
245
245
  return corsPreflight();
246
246
  const auth = await verifyGatewayCaller(request, supabase);
247
247
  if (!auth.ok)
248
- return _fosJson({ ok: false, error: auth.error }, { status: auth.status });
248
+ return _fosJson({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
249
249
  let body;
250
250
  try {
251
251
  body = JSON.parse(auth.rawBody || "{}");
@@ -277,7 +277,7 @@ export async function handleFulfillmentOrderStatus(request, supabase) {
277
277
  return corsPreflight();
278
278
  const auth = await verifyGatewayCaller(request, supabase);
279
279
  if (!auth.ok) {
280
- return _fosStatusJson({ ok: false, code: auth.status === 401 ? "invalid_signature" : "gateway_error", error: auth.error }, { status: auth.status });
280
+ return _fosStatusJson({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
281
281
  }
282
282
  let body;
283
283
  try {
@@ -136,7 +136,7 @@ export async function handleMediaUpload(request, supabase) {
136
136
  }
137
137
  const auth = await verifyGatewayBinaryCaller(request, supabase);
138
138
  if (!auth.ok) {
139
- return _muJson({ ok: false, error: auth.error }, { status: auth.status });
139
+ return _muJson({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
140
140
  }
141
141
  if (auth.bodyBytes.byteLength === 0) {
142
142
  return _muJson({ ok: false, error: "Lege body" }, { status: 400 });
@@ -133,7 +133,7 @@ export async function handleMedia(request, supabase) {
133
133
  }
134
134
  const auth = await verifyGatewayCaller(request, supabase);
135
135
  if (!auth.ok) {
136
- return _mediaJson({ ok: false, error: auth.error }, { status: auth.status });
136
+ return _mediaJson({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
137
137
  }
138
138
  if (auth.rawBody.length > MEDIA_MAX_BASE64_REQUEST_BYTES) {
139
139
  return _mediaJson({
@@ -89,7 +89,7 @@ export async function handlePdfBulkMerged(request, supabase) {
89
89
  return corsPreflight();
90
90
  const auth = await verifyGatewayCaller(request, supabase);
91
91
  if (!auth.ok) {
92
- return _pbmJson({ ok: false, error: auth.error }, { status: auth.status });
92
+ return _pbmJson({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
93
93
  }
94
94
  let parsed;
95
95
  try {
@@ -74,7 +74,7 @@ export async function handlePdfBulk(request, supabase) {
74
74
  return corsPreflight();
75
75
  const auth = await verifyGatewayCaller(request, supabase);
76
76
  if (!auth.ok) {
77
- return _pbJson({ ok: false, error: auth.error }, { status: auth.status });
77
+ return _pbJson({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
78
78
  }
79
79
  let parsed;
80
80
  try {
@@ -83,7 +83,7 @@ export async function handlePdf(request, supabase) {
83
83
  return corsPreflight();
84
84
  const auth = await verifyGatewayCaller(request, supabase);
85
85
  if (!auth.ok) {
86
- return _pdfJson({ ok: false, error: auth.error }, { status: auth.status });
86
+ return _pdfJson({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
87
87
  }
88
88
  let parsed;
89
89
  try {
@@ -33,7 +33,7 @@ export async function handleProductCharacteristics(request, supabase) {
33
33
  }
34
34
  const auth = await verifyGatewayCaller(request, supabase);
35
35
  if (!auth.ok) {
36
- return _pcJson({ ok: false, error: auth.error }, { status: auth.status });
36
+ return _pcJson({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
37
37
  }
38
38
  let parsed;
39
39
  try {
@@ -107,7 +107,7 @@ import { verifyGatewayCaller } from "../floriday-gateway-auth.js";
107
107
  export async function handleSchema(request, supabase) {
108
108
  const auth = await verifyGatewayCaller(request, supabase);
109
109
  if (!auth.ok) {
110
- return Response.json({ ok: false, error: auth.error }, { status: auth.status });
110
+ return Response.json({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
111
111
  }
112
112
  let parsed;
113
113
  try {
@@ -346,7 +346,7 @@ export async function handleSupplyLine(request, supabase) {
346
346
  return corsPreflight();
347
347
  const auth = await verifyGatewayCaller(request, supabase);
348
348
  if (!auth.ok)
349
- return _slJson({ ok: false, error: auth.error }, { status: auth.status });
349
+ return _slJson({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
350
350
  let raw;
351
351
  try {
352
352
  raw = JSON.parse(auth.rawBody);
@@ -72,7 +72,7 @@ export async function runTradeItemVersion(supabase, input) {
72
72
  export async function handleTradeItemVersion(request, supabase) {
73
73
  const auth = await verifyGatewayCaller(request, supabase);
74
74
  if (!auth.ok) {
75
- return Response.json({ ok: false, error: auth.error }, { status: auth.status });
75
+ return Response.json({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
76
76
  }
77
77
  let parsed;
78
78
  try {
@@ -38,7 +38,7 @@ export async function runWrite(supabase, parsed, caller) {
38
38
  export async function handleWrite(request, supabase) {
39
39
  const auth = await verifyGatewayCaller(request, supabase);
40
40
  if (!auth.ok) {
41
- return Response.json({ ok: false, error: auth.error }, { status: auth.status });
41
+ return Response.json({ ok: false, code: auth.code, error: auth.error }, { status: auth.status });
42
42
  }
43
43
  let parsed;
44
44
  try {
@@ -1,2 +1,2 @@
1
- export declare const MODULE_VERSION = "1.0.71";
1
+ export declare const MODULE_VERSION = "1.0.75";
2
2
  //# sourceMappingURL=module-version.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-version.d.ts","sourceRoot":"","sources":["../../src/lib/module-version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"module-version.d.ts","sourceRoot":"","sources":["../../src/lib/module-version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,cAAc,WAAW,CAAC"}
@@ -1,3 +1,2 @@
1
- // Versie van dit pakket, meegegeven in gateway-antwoorden (moduleVersion).
2
- // Moet gelijk zijn aan "version" in package.json; tests/module-version.test.ts bewaakt dat.
3
- export const MODULE_VERSION = "1.0.71";
1
+ // GEGENEREERD door scripts/write-module-version.mjs uit package.json — niet handmatig wijzigen.
2
+ export const MODULE_VERSION = "1.0.75";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowselections/floriday-authenticatie-module",
3
- "version": "1.0.72",
3
+ "version": "1.0.75",
4
4
  "sideEffects": false,
5
5
  "type": "module",
6
6
  "main": "./dist-lib/index.js",
@@ -33,7 +33,7 @@
33
33
  "scripts": {
34
34
  "dev": "vite dev",
35
35
  "build": "vite build",
36
- "build:lib": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && node -e \"require('fs').writeFileSync('dist-lib/styles.css', '@source \\\"./\\\";\\n')\"",
36
+ "build:lib": "node scripts/write-module-version.mjs && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && node -e \"require('fs').writeFileSync('dist-lib/styles.css', '@source \\\"./\\\";\\n')\"",
37
37
  "build:lib:watch": "tsc -p tsconfig.build.json --watch",
38
38
  "build:dev": "vite build --mode development",
39
39
  "preview": "vite preview",