@flowselections/floriday-voorraad 1.0.129 → 1.0.131
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/voorraad/ArtikelWizard.d.ts.map +1 -1
- package/dist-lib/components/voorraad/ArtikelWizard.js +102 -19
- package/dist-lib/components/voorraad/PriceStatusBadge.d.ts.map +1 -1
- package/dist-lib/components/voorraad/PriceStatusBadge.js +21 -45
- package/dist-lib/components/voorraad/ProductStructureCard.d.ts.map +1 -1
- package/dist-lib/components/voorraad/ProductStructureCard.js +6 -2
- package/dist-lib/integrations/supabase/types.d.ts +779 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/__tests__/release-130.test.d.ts +2 -0
- package/dist-lib/lib/__tests__/release-130.test.d.ts.map +1 -0
- package/dist-lib/lib/__tests__/release-130.test.js +103 -0
- package/dist-lib/lib/floriday-2026v1.server.d.ts +1 -8
- package/dist-lib/lib/floriday-2026v1.server.d.ts.map +1 -1
- package/dist-lib/lib/floriday-2026v1.server.js +0 -10
- package/dist-lib/lib/floriday-gateway.functions.d.ts +6 -0
- package/dist-lib/lib/floriday-gateway.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-gateway.functions.js +7 -0
- package/dist-lib/lib/floriday-gateway.server.d.ts +17 -4
- package/dist-lib/lib/floriday-gateway.server.d.ts.map +1 -1
- package/dist-lib/lib/floriday-gateway.server.js +80 -2
- package/dist-lib/lib/floriday-payload.d.ts.map +1 -1
- package/dist-lib/lib/floriday-payload.js +9 -4
- package/dist-lib/lib/floriday-read-contract.d.ts +49 -0
- package/dist-lib/lib/floriday-read-contract.d.ts.map +1 -0
- package/dist-lib/lib/floriday-read-contract.js +92 -0
- package/dist-lib/lib/price-status.d.ts +14 -0
- package/dist-lib/lib/price-status.d.ts.map +1 -0
- package/dist-lib/lib/price-status.js +16 -0
- package/dist-lib/lib/publish-pipeline.d.ts.map +1 -1
- package/dist-lib/lib/publish-pipeline.js +2 -7
- package/dist-lib/lib/publish-status.d.ts +26 -0
- package/dist-lib/lib/publish-status.d.ts.map +1 -0
- package/dist-lib/lib/publish-status.js +30 -0
- package/dist-lib/server-hooks/floriday-continuous-stock-pull.d.ts.map +1 -1
- package/dist-lib/server-hooks/floriday-continuous-stock-pull.js +37 -50
- package/package.json +1 -1
- package/sql/floriday-voorraad-schema.sql +31 -3
|
@@ -145,13 +145,8 @@ function sanitizeResult(value) {
|
|
|
145
145
|
export async function finishPublishJob(jobId, patch) {
|
|
146
146
|
const { data } = await steps().select("status, step_key").eq("job_id", jobId);
|
|
147
147
|
const rows = (data ?? []);
|
|
148
|
-
const
|
|
149
|
-
const
|
|
150
|
-
const status = coreFailed
|
|
151
|
-
? "failed"
|
|
152
|
-
: failed.length > 0
|
|
153
|
-
? "succeeded_with_warnings"
|
|
154
|
-
: "succeeded";
|
|
148
|
+
const { publishOutcome } = await import("./publish-status.js");
|
|
149
|
+
const status = publishOutcome(rows);
|
|
155
150
|
await jobs()
|
|
156
151
|
.update({
|
|
157
152
|
status,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regels voor de publicatiestatus van een artikel (1.0.130).
|
|
3
|
+
* - Een artikel met een Floriday-id telt als gepubliceerd.
|
|
4
|
+
* - Een mislukte controle is een waarschuwing, geen mislukte publicatie.
|
|
5
|
+
* - Wijzigingen gaan naar Floriday als er een Floriday-id is, tenzij er een
|
|
6
|
+
* reden is waarom dat niet kan; die reden wordt dan getoond.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isPublishedToFloriday(...ids: Array<string | null | undefined>): boolean;
|
|
9
|
+
export type StepOutcome = {
|
|
10
|
+
step_key: string;
|
|
11
|
+
status: string;
|
|
12
|
+
};
|
|
13
|
+
export type PublishOutcome = "failed" | "succeeded_with_warnings" | "succeeded";
|
|
14
|
+
/** Alleen de artikelstap bepaalt of de publicatie mislukt is. */
|
|
15
|
+
export declare function publishOutcome(steps: StepOutcome[]): PublishOutcome;
|
|
16
|
+
export interface EditTarget {
|
|
17
|
+
sendsToFloriday: boolean;
|
|
18
|
+
text: string;
|
|
19
|
+
}
|
|
20
|
+
/** Wat het bewerkscherm belooft over het versturen van wijzigingen. */
|
|
21
|
+
export declare function editTargetText(input: {
|
|
22
|
+
floridayId: string | null | undefined;
|
|
23
|
+
writeReadOnly: boolean | null | undefined;
|
|
24
|
+
writeReason?: string | null;
|
|
25
|
+
}): EditTarget;
|
|
26
|
+
//# sourceMappingURL=publish-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publish-status.d.ts","sourceRoot":"","sources":["../../src/lib/publish-status.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,wBAAgB,qBAAqB,CAAC,GAAG,GAAG,EAAE,KAAK,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,OAAO,CAEvF;AAED,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/D,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,yBAAyB,GAAG,WAAW,CAAC;AAEhF,iEAAiE;AACjE,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,cAAc,CAInE;AAED,MAAM,WAAW,UAAU;IACzB,eAAe,EAAE,OAAO,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,KAAK,EAAE;IACpC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACtC,aAAa,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,GAAG,UAAU,CAWb"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regels voor de publicatiestatus van een artikel (1.0.130).
|
|
3
|
+
* - Een artikel met een Floriday-id telt als gepubliceerd.
|
|
4
|
+
* - Een mislukte controle is een waarschuwing, geen mislukte publicatie.
|
|
5
|
+
* - Wijzigingen gaan naar Floriday als er een Floriday-id is, tenzij er een
|
|
6
|
+
* reden is waarom dat niet kan; die reden wordt dan getoond.
|
|
7
|
+
*/
|
|
8
|
+
export function isPublishedToFloriday(...ids) {
|
|
9
|
+
return ids.some((id) => typeof id === "string" && id.trim().length > 0);
|
|
10
|
+
}
|
|
11
|
+
/** Alleen de artikelstap bepaalt of de publicatie mislukt is. */
|
|
12
|
+
export function publishOutcome(steps) {
|
|
13
|
+
const failed = steps.filter((s) => s.status === "failed");
|
|
14
|
+
if (failed.some((s) => s.step_key === "trade-item"))
|
|
15
|
+
return "failed";
|
|
16
|
+
return failed.length ? "succeeded_with_warnings" : "succeeded";
|
|
17
|
+
}
|
|
18
|
+
/** Wat het bewerkscherm belooft over het versturen van wijzigingen. */
|
|
19
|
+
export function editTargetText(input) {
|
|
20
|
+
if (!isPublishedToFloriday(input.floridayId)) {
|
|
21
|
+
return { sendsToFloriday: false, text: "Dit artikel staat nog niet in Floriday; wijzigingen blijven in dit systeem." };
|
|
22
|
+
}
|
|
23
|
+
if (input.writeReadOnly) {
|
|
24
|
+
return {
|
|
25
|
+
sendsToFloriday: false,
|
|
26
|
+
text: `Wijzigingen worden nu níet naar Floriday verstuurd: ${input.writeReason ?? "Floriday staat op alleen lezen (oorzaak onbekend)"}.`,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return { sendsToFloriday: true, text: "Wijzigingen worden direct naar Floriday verstuurd." };
|
|
30
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"floriday-continuous-stock-pull.d.ts","sourceRoot":"","sources":["../../src/server-hooks/floriday-continuous-stock-pull.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"floriday-continuous-stock-pull.d.ts","sourceRoot":"","sources":["../../src/server-hooks/floriday-continuous-stock-pull.ts"],"names":[],"mappings":"AA0LA,oIAAoI;AACpI,wBAAsB,iCAAiC,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAE3F"}
|
|
@@ -8,23 +8,10 @@
|
|
|
8
8
|
* bestaande push-hook).
|
|
9
9
|
*
|
|
10
10
|
* Rate limits en CPU-tijd op Cloudflare Workers: max 200 items per run,
|
|
11
|
-
* oudste `fetched_at` eerst;
|
|
11
|
+
* oudste `fetched_at` eerst; 10 artikelen per aanroep van floriday-get.
|
|
12
12
|
*/
|
|
13
13
|
import { runGuardedHook } from "./guard.js";
|
|
14
14
|
const MAX_ITEMS_PER_RUN = 200;
|
|
15
|
-
const PARALLEL = 5;
|
|
16
|
-
async function pMapLimited(items, limit, worker) {
|
|
17
|
-
const results = new Array(items.length);
|
|
18
|
-
let i = 0;
|
|
19
|
-
const runners = Array.from({ length: Math.min(limit, items.length) }, async () => {
|
|
20
|
-
while (i < items.length) {
|
|
21
|
-
const idx = i++;
|
|
22
|
-
results[idx] = await worker(items[idx]);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
await Promise.all(runners);
|
|
26
|
-
return results;
|
|
27
|
-
}
|
|
28
15
|
async function handle(request) {
|
|
29
16
|
{
|
|
30
17
|
void 0;
|
|
@@ -39,7 +26,7 @@ async function handle(request) {
|
|
|
39
26
|
}
|
|
40
27
|
const { getAdminClient } = await import("../lib/supabase-admin.server.js");
|
|
41
28
|
const supabaseAdmin = getAdminClient();
|
|
42
|
-
const {
|
|
29
|
+
const { gatewayReadMany } = await import("../lib/floriday-gateway.server.js");
|
|
43
30
|
const { resolveActiveFloridayConnection } = await import("../lib/floriday-env.server.js");
|
|
44
31
|
const activeConnection = await resolveActiveFloridayConnection(supabaseAdmin);
|
|
45
32
|
const connections = [activeConnection];
|
|
@@ -92,50 +79,50 @@ async function handle(request) {
|
|
|
92
79
|
let ok = 0;
|
|
93
80
|
let fail = 0;
|
|
94
81
|
const upserts = [];
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
82
|
+
// Bundel 10 artikelen per aanroep van floriday-get; de limiet per pad
|
|
83
|
+
// bewaakt Floriday-authenticatie. 429 → wachten volgens retryAfterMs
|
|
84
|
+
// en die artikelen één keer opnieuw vragen.
|
|
85
|
+
const { chunk, interpretContinuousStock } = await import("../lib/floriday-read-contract.js");
|
|
86
|
+
let pending = batch.slice();
|
|
87
|
+
for (let round = 0; round < 2 && pending.length; round++) {
|
|
88
|
+
const retry = [];
|
|
89
|
+
let waitMs = 0;
|
|
90
|
+
for (const group of chunk(pending)) {
|
|
91
|
+
let results;
|
|
92
|
+
try {
|
|
93
|
+
results = await gatewayReadMany(environment, group.map((id) => `/trade-items/${id}/continuous-stock`));
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
console.error(`[continuous-stock-pull] batch:`, e?.message ?? e);
|
|
97
|
+
fail += group.length;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
results.forEach((r, i) => {
|
|
101
|
+
const tradeItemId = group[i];
|
|
102
|
+
const o = interpretContinuousStock(r);
|
|
103
|
+
if (o.kind === "pieces") {
|
|
104
104
|
upserts.push({
|
|
105
105
|
connection_id: conn.id,
|
|
106
106
|
trade_item_id: tradeItemId,
|
|
107
|
-
number_of_pieces:
|
|
107
|
+
number_of_pieces: o.pieces,
|
|
108
108
|
fetched_at: new Date().toISOString(),
|
|
109
109
|
});
|
|
110
110
|
ok++;
|
|
111
|
-
return;
|
|
112
111
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const pieces = typeof data.numberOfPieces === "number"
|
|
122
|
-
? data.numberOfPieces
|
|
123
|
-
: data.available === true
|
|
124
|
-
? 1
|
|
125
|
-
: 0;
|
|
126
|
-
upserts.push({
|
|
127
|
-
connection_id: conn.id,
|
|
128
|
-
trade_item_id: tradeItemId,
|
|
129
|
-
number_of_pieces: pieces,
|
|
130
|
-
fetched_at: new Date().toISOString(),
|
|
112
|
+
else if (o.kind === "retry" && round === 0) {
|
|
113
|
+
retry.push(tradeItemId);
|
|
114
|
+
waitMs = Math.max(waitMs, o.waitMs);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
console.error(`[continuous-stock-pull] ${tradeItemId}: ${o.kind === "fail" ? o.error : "429"}`);
|
|
118
|
+
fail++;
|
|
119
|
+
}
|
|
131
120
|
});
|
|
132
|
-
ok++;
|
|
133
|
-
}
|
|
134
|
-
catch (e) {
|
|
135
|
-
console.error(`[continuous-stock-pull] ${tradeItemId}:`, e?.message ?? e);
|
|
136
|
-
fail++;
|
|
137
121
|
}
|
|
138
|
-
|
|
122
|
+
pending = retry;
|
|
123
|
+
if (pending.length)
|
|
124
|
+
await new Promise((r) => setTimeout(r, Math.min(waitMs, 10000)));
|
|
125
|
+
}
|
|
139
126
|
if (upserts.length) {
|
|
140
127
|
const { error: upErr } = await supabaseAdmin
|
|
141
128
|
.from("floriday_continuous_stock_cache")
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
-- @flowselections/floriday-voorraad 1.0.
|
|
1
|
+
-- @flowselections/floriday-voorraad 1.0.130 – volledig schema (idempotent, geen gegevens).
|
|
2
2
|
-- Gegenereerd uit de database met scripts/generate-voorraad-schema.py. Niet met de hand wijzigen.
|
|
3
3
|
-- Volgorde 20. Ontbrekende tabellen van andere modules worden overgeslagen met een NOTICE; draai opnieuw na die module.
|
|
4
4
|
-- De statuscontrole van floriday_continuous_stock_queue is van Voorraad en wordt hier opnieuw gemaakt.
|
|
@@ -8830,6 +8830,34 @@ REVOKE ALL ON FUNCTION voorraad_fust_juist(uuid) FROM PUBLIC;
|
|
|
8830
8830
|
REVOKE ALL ON FUNCTION voorraad_fust_juist(uuid) FROM anon;
|
|
8831
8831
|
GRANT EXECUTE ON FUNCTION voorraad_fust_juist(uuid) TO authenticated;
|
|
8832
8832
|
GRANT EXECUTE ON FUNCTION voorraad_fust_juist(uuid) TO service_role;
|
|
8833
|
+
CREATE OR REPLACE FUNCTION public.voorraad_gateway_routes_check()
|
|
8834
|
+
RETURNS jsonb
|
|
8835
|
+
LANGUAGE plpgsql
|
|
8836
|
+
STABLE SECURITY DEFINER
|
|
8837
|
+
SET search_path TO 'public'
|
|
8838
|
+
AS $function$
|
|
8839
|
+
DECLARE
|
|
8840
|
+
v_req text[] := ARRAY['/api/public/gateway/write','/api/public/gateway/floriday-get'];
|
|
8841
|
+
v_raw text; v_cfg jsonb := '{}'::jsonb; v_out jsonb;
|
|
8842
|
+
BEGIN
|
|
8843
|
+
PERFORM public.voorraad_vereis('server', 'voorraad_gateway_routes_check');
|
|
8844
|
+
SELECT value INTO v_raw FROM public.module_runtime_config WHERE key = 'voorraad_gateway_routes';
|
|
8845
|
+
BEGIN v_cfg := COALESCE(v_raw::jsonb, '{}'::jsonb); EXCEPTION WHEN others THEN v_cfg := '{}'::jsonb; END;
|
|
8846
|
+
SELECT jsonb_agg(jsonb_build_object(
|
|
8847
|
+
'route', r,
|
|
8848
|
+
'status', COALESCE(v_cfg->r->>'status', 'niet_gecontroleerd'),
|
|
8849
|
+
'gecontroleerd_op', v_cfg->r->>'checked_at',
|
|
8850
|
+
'melding', CASE COALESCE(v_cfg->r->>'status','')
|
|
8851
|
+
WHEN 'aanwezig' THEN NULL
|
|
8852
|
+
WHEN 'ontbreekt' THEN 'Route ontbreekt in de shell: ' || r
|
|
8853
|
+
ELSE 'Nog niet gecontroleerd; draai de routecontrole of wacht op de eerste Floriday-aanroep' END)
|
|
8854
|
+
ORDER BY r) INTO v_out FROM unnest(v_req) r;
|
|
8855
|
+
RETURN v_out;
|
|
8856
|
+
END $function$
|
|
8857
|
+
;
|
|
8858
|
+
REVOKE ALL ON FUNCTION voorraad_gateway_routes_check() FROM PUBLIC;
|
|
8859
|
+
REVOKE ALL ON FUNCTION voorraad_gateway_routes_check() FROM anon;
|
|
8860
|
+
GRANT EXECUTE ON FUNCTION voorraad_gateway_routes_check() TO service_role;
|
|
8833
8861
|
CREATE OR REPLACE FUNCTION public.voorraad_hook_base_url()
|
|
8834
8862
|
RETURNS text
|
|
8835
8863
|
LANGUAGE plpgsql
|
|
@@ -8947,7 +8975,7 @@ CREATE OR REPLACE FUNCTION public.voorraad_install_check()
|
|
|
8947
8975
|
STABLE SECURITY DEFINER
|
|
8948
8976
|
SET search_path TO 'public'
|
|
8949
8977
|
AS $function$
|
|
8950
|
-
DECLARE v_f text[] := ARRAY['voorraad_placeholder_code_reason','trg_products_placeholder_code','voorraad_fust_juist','voorraad_correctie_1121','voorraad_correctie_1121_regels','voorraad_correctie_1123','voorraad_correctie_1124','voorraad_load_carriers','voorraad_packing_from_floriday','voorraad_packing_missing','voorraad_correctie_1126','voorraad_correctie_1127','trg_voorraad_link_primary_packing','voorraad_order_geannuleerd','voorraad_article_vbn','voorraad_correctie_1112','voorraad_reverse_order_mutations','voorraad_withdraw_stock_row','ensure_voorraad_local_context','get_stock_context','voorraad_stock_context_status','voorraad_fcsq_local_guard','_floriday_queue_cleanup_batch','_migrate_rewrite_stock_key','_stock_import_caller','apply_fust_stock_mutation','apply_stock_consumption','apply_stock_reservation','autolink_product_to_floriday','backfill_open_order_reservations','calculate_floriday_desired_stock','calculate_structure_available','canonicalize_trade_item_stock_key','check_product_structure','claim_floriday_base_supply','claim_floriday_stock_queue','cleanup_floriday_stock_queue','cleanup_voorraad_module_history','complete_floriday_base_supply','complete_floriday_stock_queue','complete_floriday_stock_queue_outcome','consume_bom_for_production','consume_order_item','drain_inventory_recompute_queue','enqueue_floriday_continuous_stock','enqueue_floriday_continuous_stock_after_warehouse_preference','enqueue_structure_recompute','ensure_inventory_recompute_drain','ensure_trade_item_stock_row','ensure_trade_item_stock_row_key','fcsq_block_disabled','fcsq_fallback_supersede','fcsq_wake_base_supply','find_trade_item_key','floriday_adopt_connection','floriday_autoheal_connections','floriday_capture_stock_snapshot','floriday_cleanup_stock_queue_v2','floriday_compact_stock_snapshots','floriday_default_owner','floriday_desired_stock_regression_check','floriday_ensure_inventory_settings','floriday_erp_leading_preview','floriday_fill_publish_horizon','floriday_follow_apply','floriday_ingest_sales_orders','floriday_leading_summary','floriday_make_erp_leading','floriday_norm_offer_forms','floriday_orphan_settings_count','floriday_publish_horizon_weeks','floriday_queue_erp_guard','floriday_queue_first_positive','floriday_recompute_inventory','floriday_relink_products','floriday_requeue_dead_letters','floriday_settings_change_recompute','floriday_settings_change_recompute_stmt','floriday_stock_change_recompute','floriday_stock_queue_supersede','floriday_takeover_apply','floriday_takeover_fetch_state','floriday_takeover_store_forms','floriday_takeover_undo','fust_negative_stock_report','fust_types_duplicate_guard','get_active_floriday_context','get_group_allocation_keys','get_group_head_key','get_product_stock','get_product_structure_totals','get_product_structure_totals_batch','inventory_inline_budget_ok','merge_products','normalize_order_source','process_inventory_recompute_queue','produce_designed_product','product_active_group_id','product_id_from_ref','product_is_set','product_label','product_member_group_ids','product_own_available','product_packings_derive','product_packings_replace','product_packings_sync_from_floriday','product_primary_pieces','product_set_depth_above','product_set_depth_below','product_structure_ancestors','product_structure_max_depth','product_structure_path','product_tray_stickers_touch','product_type','promote_trade_item_key','recompute_all_reserved_stock','recompute_order_status','recompute_reserved_for_order','recompute_reserved_stock','requeue_skipped_stock_rows','reset_stalled_floriday_stock_queue','resolve_group_allocation','resolve_group_member_stock_key','resolve_product_id_for_item','resolve_stock_trade_item_key','reverse_production','run_floriday_base_supply_process','run_floriday_continuous_stock_sync','run_floriday_follow','run_floriday_stock_queue_process','run_floriday_stock_reconcile','run_logistics_tasks_dispatch','self_heal_floriday_links','set_module_runtime_config_updated_at','set_product_bom_tenant','set_product_stock','set_updated_at_order_fust_bookings','stock_import_cleanup','stock_import_create','stock_import_process_chunk','stock_import_stop','stock_import_undo_chunk','sync_order_item_fusten','sync_products_quantity_from_stock','touch_fust_types_updated_at','trade_item_drafts_readonly','trade_item_prices_touch_updated_at','trade_item_stock_duplicates','trg_cart_numbers_sync_order_status_fn','trg_cart_session_consume_fn','trg_check_product_structure','trg_floriday_cache_relink_fn','trg_floriday_trade_items_autolink_fn','trg_order_items_autolink_fn','trg_order_items_fusten','trg_order_items_reserve_fn','trg_orders_cancel_release_fn','trg_orders_consume_on_complete_fn','trg_orders_default_phase_fn','trg_orders_external_fulfilled_fn','trg_orders_recompute_reserved_fn','trg_pgi_assign_sort_order','trg_pgi_order_taken_check','trg_process_recompute_on_commit','trg_product_packings_derive_fn','trg_products_autolink_fn','trg_products_floriday_link_enqueue','trg_products_seed_stock_fn','trg_requeue_no_warehouse_cache','trg_requeue_no_warehouse_connection','trg_requeue_no_warehouse_item_pref','trg_requeue_skipped_no_price','trg_stock_structure_recompute_ins','trg_stock_structure_recompute_upd','trg_structure_change_recompute','trg_trade_item_drafts_autolink_fn','trg_trade_item_stock_auto_bom','trg_trade_item_stock_auto_bom_reverse','trg_trade_item_stock_log_change','trg_trade_item_stock_reserve_fn','trg_trade_item_stock_zero_watch','trg_trade_items_cache_autolink_fn','update_updated_at_column','voorraad_alert_floriday_not_updated','voorraad_can_write','voorraad_cleanup_old_rows','voorraad_consume_external_fulfilled','voorraad_correctie_1098','voorraad_correctie_status','voorraad_external_fulfilled_ids','voorraad_floriday_leads_key','voorraad_fust_dimensions','voorraad_hook_base_url','voorraad_hook_on','voorraad_hook_post','voorraad_hook_switch_jobs','voorraad_install_check','voorraad_is_server','voorraad_mark_floriday_sold_before_switch','voorraad_production_enabled','voorraad_schema_ddl','voorraad_touch_updated_at','voorraad_vereis','voorraad_week_is_past'];
|
|
8978
|
+
DECLARE v_f text[] := ARRAY['voorraad_gateway_routes_check','voorraad_placeholder_code_reason','trg_products_placeholder_code','voorraad_fust_juist','voorraad_correctie_1121','voorraad_correctie_1121_regels','voorraad_correctie_1123','voorraad_correctie_1124','voorraad_load_carriers','voorraad_packing_from_floriday','voorraad_packing_missing','voorraad_correctie_1126','voorraad_correctie_1127','trg_voorraad_link_primary_packing','voorraad_order_geannuleerd','voorraad_article_vbn','voorraad_correctie_1112','voorraad_reverse_order_mutations','voorraad_withdraw_stock_row','ensure_voorraad_local_context','get_stock_context','voorraad_stock_context_status','voorraad_fcsq_local_guard','_floriday_queue_cleanup_batch','_migrate_rewrite_stock_key','_stock_import_caller','apply_fust_stock_mutation','apply_stock_consumption','apply_stock_reservation','autolink_product_to_floriday','backfill_open_order_reservations','calculate_floriday_desired_stock','calculate_structure_available','canonicalize_trade_item_stock_key','check_product_structure','claim_floriday_base_supply','claim_floriday_stock_queue','cleanup_floriday_stock_queue','cleanup_voorraad_module_history','complete_floriday_base_supply','complete_floriday_stock_queue','complete_floriday_stock_queue_outcome','consume_bom_for_production','consume_order_item','drain_inventory_recompute_queue','enqueue_floriday_continuous_stock','enqueue_floriday_continuous_stock_after_warehouse_preference','enqueue_structure_recompute','ensure_inventory_recompute_drain','ensure_trade_item_stock_row','ensure_trade_item_stock_row_key','fcsq_block_disabled','fcsq_fallback_supersede','fcsq_wake_base_supply','find_trade_item_key','floriday_adopt_connection','floriday_autoheal_connections','floriday_capture_stock_snapshot','floriday_cleanup_stock_queue_v2','floriday_compact_stock_snapshots','floriday_default_owner','floriday_desired_stock_regression_check','floriday_ensure_inventory_settings','floriday_erp_leading_preview','floriday_fill_publish_horizon','floriday_follow_apply','floriday_ingest_sales_orders','floriday_leading_summary','floriday_make_erp_leading','floriday_norm_offer_forms','floriday_orphan_settings_count','floriday_publish_horizon_weeks','floriday_queue_erp_guard','floriday_queue_first_positive','floriday_recompute_inventory','floriday_relink_products','floriday_requeue_dead_letters','floriday_settings_change_recompute','floriday_settings_change_recompute_stmt','floriday_stock_change_recompute','floriday_stock_queue_supersede','floriday_takeover_apply','floriday_takeover_fetch_state','floriday_takeover_store_forms','floriday_takeover_undo','fust_negative_stock_report','fust_types_duplicate_guard','get_active_floriday_context','get_group_allocation_keys','get_group_head_key','get_product_stock','get_product_structure_totals','get_product_structure_totals_batch','inventory_inline_budget_ok','merge_products','normalize_order_source','process_inventory_recompute_queue','produce_designed_product','product_active_group_id','product_id_from_ref','product_is_set','product_label','product_member_group_ids','product_own_available','product_packings_derive','product_packings_replace','product_packings_sync_from_floriday','product_primary_pieces','product_set_depth_above','product_set_depth_below','product_structure_ancestors','product_structure_max_depth','product_structure_path','product_tray_stickers_touch','product_type','promote_trade_item_key','recompute_all_reserved_stock','recompute_order_status','recompute_reserved_for_order','recompute_reserved_stock','requeue_skipped_stock_rows','reset_stalled_floriday_stock_queue','resolve_group_allocation','resolve_group_member_stock_key','resolve_product_id_for_item','resolve_stock_trade_item_key','reverse_production','run_floriday_base_supply_process','run_floriday_continuous_stock_sync','run_floriday_follow','run_floriday_stock_queue_process','run_floriday_stock_reconcile','run_logistics_tasks_dispatch','self_heal_floriday_links','set_module_runtime_config_updated_at','set_product_bom_tenant','set_product_stock','set_updated_at_order_fust_bookings','stock_import_cleanup','stock_import_create','stock_import_process_chunk','stock_import_stop','stock_import_undo_chunk','sync_order_item_fusten','sync_products_quantity_from_stock','touch_fust_types_updated_at','trade_item_drafts_readonly','trade_item_prices_touch_updated_at','trade_item_stock_duplicates','trg_cart_numbers_sync_order_status_fn','trg_cart_session_consume_fn','trg_check_product_structure','trg_floriday_cache_relink_fn','trg_floriday_trade_items_autolink_fn','trg_order_items_autolink_fn','trg_order_items_fusten','trg_order_items_reserve_fn','trg_orders_cancel_release_fn','trg_orders_consume_on_complete_fn','trg_orders_default_phase_fn','trg_orders_external_fulfilled_fn','trg_orders_recompute_reserved_fn','trg_pgi_assign_sort_order','trg_pgi_order_taken_check','trg_process_recompute_on_commit','trg_product_packings_derive_fn','trg_products_autolink_fn','trg_products_floriday_link_enqueue','trg_products_seed_stock_fn','trg_requeue_no_warehouse_cache','trg_requeue_no_warehouse_connection','trg_requeue_no_warehouse_item_pref','trg_requeue_skipped_no_price','trg_stock_structure_recompute_ins','trg_stock_structure_recompute_upd','trg_structure_change_recompute','trg_trade_item_drafts_autolink_fn','trg_trade_item_stock_auto_bom','trg_trade_item_stock_auto_bom_reverse','trg_trade_item_stock_log_change','trg_trade_item_stock_reserve_fn','trg_trade_item_stock_zero_watch','trg_trade_items_cache_autolink_fn','update_updated_at_column','voorraad_alert_floriday_not_updated','voorraad_can_write','voorraad_cleanup_old_rows','voorraad_consume_external_fulfilled','voorraad_correctie_1098','voorraad_correctie_status','voorraad_external_fulfilled_ids','voorraad_floriday_leads_key','voorraad_fust_dimensions','voorraad_hook_base_url','voorraad_hook_on','voorraad_hook_post','voorraad_hook_switch_jobs','voorraad_install_check','voorraad_is_server','voorraad_mark_floriday_sold_before_switch','voorraad_production_enabled','voorraad_schema_ddl','voorraad_touch_updated_at','voorraad_vereis','voorraad_week_is_past'];
|
|
8951
8979
|
v_t text[] := ARRAY['trg_voorraad_link_primary_packing@products','aa0_fcsq_local_context_guard@floriday_continuous_stock_queue','aa_fcsq_erp_leading_guard@floriday_continuous_stock_queue','aa_fis_norm_offer_forms@floriday_inventory_settings','aa_pgi_assign_sort_order@product_group_items','fcsq_block_disabled@floriday_continuous_stock_queue','fcsq_wake_base_supply_ins@floriday_continuous_stock_queue','fcsq_wake_base_supply_upd@floriday_continuous_stock_queue','fust_stock_mutations_apply@fust_stock_mutations','fust_types_duplicate_guard@fust_types','fust_types_touch@fust_types','product_packings_derive_trg@product_packings','product_packings_updated_at@product_packings','set_product_bom_tenant_trigger@product_bom_items','trade_item_prices_set_updated_at@trade_item_prices','trg_cart_numbers_sync_order_status@cart_numbers','trg_cart_session_consume@cart_control_sessions','trg_check_product_structure@product_bom_items','trg_check_product_structure@product_group_items','trg_check_product_structure@product_groups','trg_fcs_queue_updated_at@floriday_continuous_stock_queue','trg_fcsq_fallback_supersede@floriday_continuous_stock_queue','trg_fcsq_supersede@floriday_continuous_stock_queue','trg_floriday_cache_relink@floriday_trade_items_cache','trg_floriday_ensure_inventory_settings@products','trg_floriday_gate_stock_queue@floriday_continuous_stock_queue','trg_floriday_settings_change_recompute_ins@floriday_inventory_settings','trg_floriday_settings_change_recompute_upd@floriday_inventory_settings','trg_floriday_stock_change_recompute@trade_item_stock','trg_floriday_takeover_runs_updated_at@floriday_takeover_runs','trg_floriday_trade_items_autolink@floriday_trade_items_cache','trg_fust_types_requeue_blocked@fust_types','trg_module_runtime_config_updated_at@module_runtime_config','trg_order_fust_bookings_updated_at@order_fust_bookings','trg_order_items_autolink@order_items','trg_order_items_fusten_aiud@order_items','trg_order_items_reserve@order_items','trg_orders_cancel_release@orders','trg_orders_consume_on_complete@orders','trg_orders_default_phase@orders','trg_orders_external_fulfilled@orders','trg_orders_recompute_reserved@orders','trg_prevent_duplicate_product_draft@trade_item_drafts','trg_product_tray_stickers_touch@product_tray_stickers','trg_products_autolink@products','trg_products_floriday_link_enqueue@products','trg_products_seed_stock@products','trg_requeue_no_warehouse_cache@floriday_trade_items_cache','trg_requeue_no_warehouse_connection@floriday_connections','trg_requeue_no_warehouse_item_pref@trade_item_warehouse_preferences','trg_requeue_skipped_no_price@products','trg_stock_mutation_alert@stock_mutation_log','trg_stock_structure_recompute_ins@trade_item_stock','trg_stock_structure_recompute_upd@trade_item_stock','trg_structure_change_recompute@product_bom_items','trg_structure_change_recompute@product_group_items','trg_structure_change_recompute@product_groups','trg_sync_layer_stock_from_trade_stock@trade_item_stock','trg_sync_products_quantity_from_stock_del@trade_item_stock','trg_sync_products_quantity_from_stock_iu@trade_item_stock','trg_trade_item_drafts_autolink@trade_item_drafts','trg_trade_item_drafts_readonly@trade_item_drafts','trg_trade_item_stock_canonical_key@trade_item_stock','trg_trade_item_stock_publish@trade_item_stock','trg_trade_item_stock_reserve@trade_item_stock','trg_trade_item_stock_updated_at@trade_item_stock','trg_trade_item_stock_zero_watch@trade_item_stock','trg_trade_item_supply_lines_touch@trade_item_supply_lines','trg_trade_item_warehouse_preference_enqueue_stock@trade_item_warehouse_preferences','trg_trade_items_cache_autolink@floriday_trade_items_cache','trg_voorraad_buffer_state_updated_at@voorraad_buffer_state','trg_voorraad_event_log_updated_at@voorraad_logistics_event_log','update_trade_item_drafts_updated_at@trade_item_drafts','update_trade_item_warehouse_preferences_updated_at@trade_item_warehouse_preferences','update_voorraad_custom_fields_updated_at@voorraad_custom_fields','update_voorraad_publish_jobs_updated_at@voorraad_publish_jobs','update_voorraad_publish_learnings_updated_at@voorraad_publish_learnings','update_voorraad_publish_steps_updated_at@voorraad_publish_steps','voorraad_hook_switch_jobs@module_runtime_config','zz_fcsq_first_positive@floriday_continuous_stock_queue'];
|
|
8952
8980
|
v_p text[] := ARRAY['Authenticated can add learnings@voorraad_publish_learnings','Authenticated can delete voorraad custom fields@voorraad_custom_fields','Authenticated can insert vbn required characteristics@floriday_vbn_required_characteristics','Authenticated can insert voorraad custom fields@voorraad_custom_fields','Authenticated can read continuous stock cache@floriday_continuous_stock_cache','Authenticated can read learnings@voorraad_publish_learnings','Authenticated can read vbn required characteristics@floriday_vbn_required_characteristics','Authenticated can read voorraad custom fields@voorraad_custom_fields','Authenticated can update learnings@voorraad_publish_learnings','Authenticated can update vbn required characteristics@floriday_vbn_required_characteristics','Authenticated can update voorraad custom fields@voorraad_custom_fields','Authenticated delete trade_item_warehouse_preferences@trade_item_warehouse_preferences','Authenticated insert trade_item_warehouse_preferences@trade_item_warehouse_preferences','Authenticated select trade_item_warehouse_preferences@trade_item_warehouse_preferences','Authenticated update trade_item_warehouse_preferences@trade_item_warehouse_preferences','Eigen momentopnamen lezen@inventory_stock_snapshots','Eigen voorraadinstellingen beheren@floriday_inventory_settings','Eigenaar leest importporties@stock_import_chunks','Eigenaar leest importregels@stock_import_rows','Fust mutations delete@fust_stock_mutations','Fust mutations insert@fust_stock_mutations','Fust mutations read@fust_stock_mutations','Fust mutations update@fust_stock_mutations','Fust types delete@fust_types','Fust types insert@fust_types','Fust types read@fust_types','Fust types update@fust_types','Ingelogde gebruikers kunnen bufferstatus lezen@voorraad_buffer_state','Ingelogde gebruikers kunnen de eventlog lezen@voorraad_logistics_event_log','Ingelogde gebruikers kunnen fustboekingen lezen@order_fust_bookings','Ingelogde gebruikers lezen drempels@inventory_recompute_limits','Ingelogde gebruikers lezen opruimlogboek@structure_cleanup_log','Ingelogde gebruikers lezen opruimruns@floriday_queue_cleanup_runs','Ingelogden beheren traystickers@product_tray_stickers','Ingelogden lezen herberekenwachtrij@inventory_recompute_queue','Ingelogden lezen voorraadmeldingen@stock_integrity_alerts','Ingelogden markeren voorraadmeldingen als gezien@stock_integrity_alerts','Own queue rows select@floriday_continuous_stock_queue','Owner delete trade_item_drafts@trade_item_drafts','Owner insert trade_item_drafts@trade_item_drafts','Owner select trade_item_drafts@trade_item_drafts','Owner update trade_item_drafts@trade_item_drafts','Signed-in users read reconcile runs@floriday_reconcile_runs','Stock delete@trade_item_stock','Stock insert@trade_item_stock','Stock read@trade_item_stock','Stock update@trade_item_stock','Synchronisatieposities lezen@floriday_sync_cursors','Users can insert own publish attempts@voorraad_publish_attempts','Users can read own publish attempts@voorraad_publish_attempts','Users can read own stock mutations@stock_mutation_log','Users manage own import runs@stock_import_runs','Users manage own supply lines@trade_item_supply_lines','Users manage own trade item prices@trade_item_prices','Users manage their own publish jobs@voorraad_publish_jobs','Users manage their own publish steps@voorraad_publish_steps','Verwerkte orders lezen@floriday_sales_order_ingest','Voorraadschrijvers lezen overnameregels@floriday_takeover_items','Voorraadschrijvers lezen overnames@floriday_takeover_runs','authenticated can insert merge log@product_merge_log','authenticated can read merge log@product_merge_log','service role only@voorraad_media_upload_failures','product_packings_read@product_packings','product_packings_write@product_packings'];
|
|
8953
8981
|
v_open text[] := ARRAY['voorraad_is_server','voorraad_vereis'];
|
|
@@ -8975,7 +9003,7 @@ BEGIN
|
|
|
8975
9003
|
SELECT jsonb_agg(jsonb_build_object('policy', split_part(t, '@', 1), 'tabel', split_part(t, '@', 2),
|
|
8976
9004
|
'aanwezig', EXISTS (SELECT 1 FROM pg_policies x WHERE x.schemaname = 'public' AND x.policyname = split_part(t, '@', 1)
|
|
8977
9005
|
AND x.tablename = split_part(t, '@', 2))) ORDER BY t) INTO v_pol FROM unnest(v_p) t;
|
|
8978
|
-
RETURN jsonb_build_object(
|
|
9006
|
+
RETURN jsonb_build_object('gateway_routes', public.voorraad_gateway_routes_check(),
|
|
8979
9007
|
'samenvatting', jsonb_build_object(
|
|
8980
9008
|
'functies', jsonb_array_length(v_func),
|
|
8981
9009
|
'functies_ontbrekend', (SELECT count(*) FROM jsonb_array_elements(v_func) e WHERE NOT (e->>'aanwezig')::boolean),
|