@flowselections/floriday-authenticatie-module 1.0.41 → 1.0.43
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-lib/components/settings/FlorydaySettingsCard.js +4 -9
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +728 -9
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +728 -9
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +728 -9
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +736 -9
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/floricode.functions.d.ts +5412 -379
- package/dist-lib/lib/floricode.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-auction-letters.functions.d.ts +728 -9
- package/dist-lib/lib/floriday-auction-letters.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-labels.functions.d.ts +728 -9
- package/dist-lib/lib/floriday-labels.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-public.functions.d.ts +4605 -291
- package/dist-lib/lib/floriday-public.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-stickers.functions.d.ts +728 -9
- package/dist-lib/lib/floriday-stickers.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-sync.functions.d.ts +24780 -2491
- package/dist-lib/lib/floriday-sync.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-tray-stickers.functions.d.ts +14 -0
- package/dist-lib/lib/floriday-tray-stickers.functions.d.ts.map +1 -0
- package/dist-lib/lib/floriday-tray-stickers.functions.js +66 -0
- package/dist-lib/lib/floriday-writes.functions.d.ts +52015 -515
- package/dist-lib/lib/floriday-writes.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-writes.functions.js +17 -12
- package/dist-lib/lib/floriday.functions.d.ts +15017 -1229
- package/dist-lib/lib/floriday.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday.functions.js +76 -21
- package/dist-lib/lib/gateway/fulfillment-order-body.d.ts +37 -1
- package/dist-lib/lib/gateway/fulfillment-order-body.d.ts.map +1 -1
- package/dist-lib/lib/gateway/fulfillment-order-body.js +179 -119
- package/dist-lib/lib/gateway/fulfillment-order-send.d.ts.map +1 -1
- package/dist-lib/lib/gateway/fulfillment-order-send.js +6 -0
- package/dist-lib/lib/gateway/fulfillment-order-status.d.ts +11 -0
- package/dist-lib/lib/gateway/fulfillment-order-status.d.ts.map +1 -0
- package/dist-lib/lib/gateway/fulfillment-order-status.js +84 -0
- package/dist-lib/lib/gateway/index.d.ts +1 -0
- package/dist-lib/lib/gateway/index.d.ts.map +1 -1
- package/dist-lib/lib/gateway/index.js +1 -0
- package/dist-lib/lib/gateway/pdf.d.ts +1 -1
- package/dist-lib/lib/gateway/pdf.d.ts.map +1 -1
- package/dist-lib/lib/gateway/pdf.js +11 -0
- package/package.json +10 -1
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Gateway module: status van een fulfillment-order bij Floriday.
|
|
2
|
+
//
|
|
3
|
+
// GET /fulfillment-orders/{id}/status (scope fulfillment:read) geeft
|
|
4
|
+
// { status: DRAFT | PENDING | ACCEPTED | FAILED | CANCELLED | DELIVERED,
|
|
5
|
+
// submissionError }. Pas bij ACCEPTED/DELIVERED levert Floriday de
|
|
6
|
+
// logistieke labels (verzendbrief) betrouwbaar op.
|
|
7
|
+
import { resolveGatewayEnvironment } from "./shared.js";
|
|
8
|
+
import { SUPPLIERS_API_VERSION, florydayFetch } from "../floriday.functions.js";
|
|
9
|
+
export async function runFulfillmentOrderStatus(supabase, input) {
|
|
10
|
+
const fulfillmentOrderId = String(input?.fulfillmentOrderId ?? "").trim();
|
|
11
|
+
if (!fulfillmentOrderId) {
|
|
12
|
+
return {
|
|
13
|
+
status: 400,
|
|
14
|
+
payload: { ok: false, error: "fulfillmentOrderId is verplicht" },
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const env = await resolveGatewayEnvironment(supabase, input?.environment);
|
|
18
|
+
const path = `/${SUPPLIERS_API_VERSION}/fulfillment-orders/${encodeURIComponent(fulfillmentOrderId)}/status`;
|
|
19
|
+
const res = await florydayFetch(supabase, env, path, { cache: "no-store" });
|
|
20
|
+
const text = await res.text().catch(() => "");
|
|
21
|
+
let data = null;
|
|
22
|
+
try {
|
|
23
|
+
data = text ? JSON.parse(text) : null;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
data = text || null;
|
|
27
|
+
}
|
|
28
|
+
if (!res.ok) {
|
|
29
|
+
return {
|
|
30
|
+
status: res.status === 404 ? 404 : 502,
|
|
31
|
+
payload: {
|
|
32
|
+
ok: false,
|
|
33
|
+
error: `Floriday fulfillment-order status ${res.status}`,
|
|
34
|
+
detail: data,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
status: 200,
|
|
40
|
+
payload: {
|
|
41
|
+
ok: true,
|
|
42
|
+
fulfillmentOrderId,
|
|
43
|
+
environment: env,
|
|
44
|
+
fulfillmentStatus: data?.status ?? null,
|
|
45
|
+
submissionError: data?.submissionError ?? null,
|
|
46
|
+
data,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
// HTTP-handler
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
import { verifyGatewayCaller, corsPreflight, withCors, } from "../floriday-gateway-auth.js";
|
|
54
|
+
const _fosStatusJson = (data, init) => withCors(Response.json(data, init));
|
|
55
|
+
export async function handleFulfillmentOrderStatus(request, supabase) {
|
|
56
|
+
if (request.method === "OPTIONS")
|
|
57
|
+
return corsPreflight();
|
|
58
|
+
const auth = await verifyGatewayCaller(request, supabase);
|
|
59
|
+
if (!auth.ok) {
|
|
60
|
+
return _fosStatusJson({ ok: false, error: auth.error }, { status: auth.status });
|
|
61
|
+
}
|
|
62
|
+
let body;
|
|
63
|
+
try {
|
|
64
|
+
body = JSON.parse(auth.rawBody || "{}");
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return _fosStatusJson({ ok: false, error: "Ongeldige JSON-body" }, { status: 400 });
|
|
68
|
+
}
|
|
69
|
+
if (body?.environment !== undefined &&
|
|
70
|
+
body.environment !== "staging" &&
|
|
71
|
+
body.environment !== "live") {
|
|
72
|
+
return _fosStatusJson({ ok: false, error: "Ongeldige environment" }, { status: 400 });
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
const { status, payload } = await runFulfillmentOrderStatus(supabase, {
|
|
76
|
+
fulfillmentOrderId: String(body?.fulfillmentOrderId ?? ""),
|
|
77
|
+
environment: body?.environment,
|
|
78
|
+
});
|
|
79
|
+
return _fosStatusJson(payload, { status });
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
return _fosStatusJson({ ok: false, error: String(e?.message ?? e) }, { status: 500 });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -11,6 +11,7 @@ export * from "./pdf-bulk.js";
|
|
|
11
11
|
export * from "./pdf-bulk-merged.js";
|
|
12
12
|
export * from "./write.js";
|
|
13
13
|
export * from "./fulfillment-order-send.js";
|
|
14
|
+
export * from "./fulfillment-order-status.js";
|
|
14
15
|
export * from "./diagnostics.js";
|
|
15
16
|
export * from "./media.js";
|
|
16
17
|
export * from "./media-upload.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/gateway/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/gateway/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,6BAA6B,CAAC"}
|
|
@@ -11,6 +11,7 @@ export * from "./pdf-bulk.js";
|
|
|
11
11
|
export * from "./pdf-bulk-merged.js";
|
|
12
12
|
export * from "./write.js";
|
|
13
13
|
export * from "./fulfillment-order-send.js";
|
|
14
|
+
export * from "./fulfillment-order-status.js";
|
|
14
15
|
export * from "./diagnostics.js";
|
|
15
16
|
export * from "./media.js";
|
|
16
17
|
export * from "./media-upload.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SupabaseClient } from "@supabase/supabase-js";
|
|
2
|
-
type Kind = "logistic-label" | "delivery-note" | "auction-letter" | "customer-sticker";
|
|
2
|
+
type Kind = "logistic-label" | "delivery-note" | "auction-letter" | "customer-sticker" | "tray-stickers";
|
|
3
3
|
export interface PdfInput {
|
|
4
4
|
environment?: "staging" | "live";
|
|
5
5
|
kind: Kind;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pdf.d.ts","sourceRoot":"","sources":["../../../src/lib/gateway/pdf.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,KAAK,IAAI,GACL,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"pdf.d.ts","sourceRoot":"","sources":["../../../src/lib/gateway/pdf.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,KAAK,IAAI,GACL,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,kBAAkB,GAClB,eAAe,CAAC;AAGpB,MAAM,WAAW,QAAQ;IACvB,WAAW,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IACjC,IAAI,EAAE,IAAI,CAAC;IACX,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,SAAS,GACjB,CAAC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,GACpC;IACE,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;CAChC,CAAC;AAEN,wBAAsB,MAAM,CAC1B,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,QAAQ,EAChB,WAAW,EAAE,SAAS,GAAG,MAAM,GAC9B,OAAO,CAAC,SAAS,CAAC,CAkFpB;AAgBD,wBAAsB,SAAS,CAC7B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,cAAc,GACvB,OAAO,CAAC,QAAQ,CAAC,CAuCnB"}
|
|
@@ -60,6 +60,17 @@ export async function runPdf(supabase, parsed, environment) {
|
|
|
60
60
|
});
|
|
61
61
|
return { ok: true, ...result };
|
|
62
62
|
}
|
|
63
|
+
if (parsed.kind === "tray-stickers") {
|
|
64
|
+
if (!parsed.deliveryOrderId) {
|
|
65
|
+
return { ok: false, status: 400, error: "deliveryOrderId is verplicht" };
|
|
66
|
+
}
|
|
67
|
+
const { resolveTrayStickers } = await import("../floriday-tray-stickers.functions.js");
|
|
68
|
+
const result = await resolveTrayStickers(supabase, {
|
|
69
|
+
environment,
|
|
70
|
+
deliveryOrderId: parsed.deliveryOrderId,
|
|
71
|
+
});
|
|
72
|
+
return { ok: true, ...result };
|
|
73
|
+
}
|
|
63
74
|
return { ok: false, status: 400, error: `Onbekend kind: ${parsed.kind}` };
|
|
64
75
|
}
|
|
65
76
|
// ---------------------------------------------------------------------------
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowselections/floriday-authenticatie-module",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.43",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist-lib/index.js",
|
|
@@ -156,6 +156,15 @@
|
|
|
156
156
|
"OPTIONS"
|
|
157
157
|
]
|
|
158
158
|
},
|
|
159
|
+
{
|
|
160
|
+
"routePath": "/api/public/gateway/fulfillment-order/status",
|
|
161
|
+
"import": "@flowselections/floriday-authenticatie-module/gateway",
|
|
162
|
+
"handler": "handleFulfillmentOrderStatus",
|
|
163
|
+
"methods": [
|
|
164
|
+
"POST",
|
|
165
|
+
"OPTIONS"
|
|
166
|
+
]
|
|
167
|
+
},
|
|
159
168
|
{
|
|
160
169
|
"routePath": "/api/public/gateway/media",
|
|
161
170
|
"import": "@flowselections/floriday-authenticatie-module/gateway",
|