@flowselections/floriday-voorraad 1.0.13 → 1.0.15

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 (114) hide show
  1. package/dist-lib/assets/floriday-logo.png.asset.json +11 -0
  2. package/dist-lib/components/voorraad/ArtikelWizard.d.ts +5 -0
  3. package/dist-lib/components/voorraad/ArtikelWizard.d.ts.map +1 -0
  4. package/dist-lib/components/voorraad/ArtikelWizard.js +1229 -0
  5. package/dist-lib/components/voorraad/EditArtikelPage.d.ts +4 -0
  6. package/dist-lib/components/voorraad/EditArtikelPage.d.ts.map +1 -0
  7. package/dist-lib/components/voorraad/EditArtikelPage.js +51 -0
  8. package/dist-lib/components/voorraad/NieuwArtikelPage.d.ts +2 -0
  9. package/dist-lib/components/voorraad/NieuwArtikelPage.d.ts.map +1 -0
  10. package/dist-lib/components/voorraad/NieuwArtikelPage.js +5 -0
  11. package/dist-lib/components/voorraad/StockBulkButtons.d.ts +7 -0
  12. package/dist-lib/components/voorraad/StockBulkButtons.d.ts.map +1 -0
  13. package/dist-lib/components/voorraad/StockBulkButtons.js +356 -0
  14. package/dist-lib/components/voorraad/ValidationOverviewTable.d.ts +7 -0
  15. package/dist-lib/components/voorraad/ValidationOverviewTable.d.ts.map +1 -0
  16. package/dist-lib/components/voorraad/ValidationOverviewTable.js +87 -0
  17. package/dist-lib/components/voorraad/ValidationPage.d.ts +2 -0
  18. package/dist-lib/components/voorraad/ValidationPage.d.ts.map +1 -0
  19. package/dist-lib/components/voorraad/ValidationPage.js +12 -0
  20. package/dist-lib/components/voorraad/VoorraadDashboard.d.ts +6 -0
  21. package/dist-lib/components/voorraad/VoorraadDashboard.d.ts.map +1 -0
  22. package/dist-lib/components/voorraad/VoorraadDashboard.js +42 -0
  23. package/dist-lib/components/voorraad/VoorraadPage.d.ts.map +1 -1
  24. package/dist-lib/components/voorraad/VoorraadPage.js +70 -11
  25. package/dist-lib/components/voorraad/VoorraadPagination.d.ts +10 -0
  26. package/dist-lib/components/voorraad/VoorraadPagination.d.ts.map +1 -0
  27. package/dist-lib/components/voorraad/VoorraadPagination.js +12 -0
  28. package/dist-lib/components/voorraad/VoorraadStockCard.d.ts +8 -0
  29. package/dist-lib/components/voorraad/VoorraadStockCard.d.ts.map +1 -0
  30. package/dist-lib/components/voorraad/VoorraadStockCard.js +33 -0
  31. package/dist-lib/components/voorraad/VoorraadTable.d.ts.map +1 -1
  32. package/dist-lib/components/voorraad/VoorraadTable.js +16 -5
  33. package/dist-lib/hooks/useFloriday.d.ts +55 -0
  34. package/dist-lib/hooks/useFloriday.d.ts.map +1 -0
  35. package/dist-lib/hooks/useFloriday.js +298 -0
  36. package/dist-lib/hooks/useLocalTradeItems.d.ts +17 -1
  37. package/dist-lib/hooks/useLocalTradeItems.d.ts.map +1 -1
  38. package/dist-lib/hooks/useLocalTradeItems.js +54 -10
  39. package/dist-lib/hooks/useTradeItemSpec.d.ts +42 -0
  40. package/dist-lib/hooks/useTradeItemSpec.d.ts.map +1 -0
  41. package/dist-lib/hooks/useTradeItemSpec.js +448 -0
  42. package/dist-lib/hooks/useTradeItemStock.d.ts +19 -0
  43. package/dist-lib/hooks/useTradeItemStock.d.ts.map +1 -0
  44. package/dist-lib/hooks/useTradeItemStock.js +78 -0
  45. package/dist-lib/hooks/useVbnRegulatoryFeatures.d.ts +3 -0
  46. package/dist-lib/hooks/useVbnRegulatoryFeatures.d.ts.map +1 -0
  47. package/dist-lib/hooks/useVbnRegulatoryFeatures.js +19 -0
  48. package/dist-lib/hooks/useVoorraadData.d.ts +2 -1
  49. package/dist-lib/hooks/useVoorraadData.d.ts.map +1 -1
  50. package/dist-lib/hooks/useVoorraadData.js +39 -11
  51. package/dist-lib/index.d.ts +4 -0
  52. package/dist-lib/index.d.ts.map +1 -1
  53. package/dist-lib/index.js +6 -5
  54. package/dist-lib/integrations/supabase/auth-middleware.d.ts +8346 -3367
  55. package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
  56. package/dist-lib/integrations/supabase/client.d.ts +8346 -3367
  57. package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
  58. package/dist-lib/integrations/supabase/client.server.d.ts +8346 -3367
  59. package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
  60. package/dist-lib/integrations/supabase/types.d.ts +8460 -3341
  61. package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
  62. package/dist-lib/integrations/supabase/types.js +10 -1
  63. package/dist-lib/lib/__tests__/floricode-required-features.test.d.ts +2 -0
  64. package/dist-lib/lib/__tests__/floricode-required-features.test.d.ts.map +1 -0
  65. package/dist-lib/lib/__tests__/floricode-required-features.test.js +186 -0
  66. package/dist-lib/lib/floricode-client.d.ts +15 -1
  67. package/dist-lib/lib/floricode-client.d.ts.map +1 -1
  68. package/dist-lib/lib/floricode-client.js +42 -4
  69. package/dist-lib/lib/floricode-required-features.functions.d.ts +10026 -0
  70. package/dist-lib/lib/floricode-required-features.functions.d.ts.map +1 -0
  71. package/dist-lib/lib/floricode-required-features.functions.js +170 -0
  72. package/dist-lib/lib/floriday-client.d.ts +36 -8
  73. package/dist-lib/lib/floriday-client.d.ts.map +1 -1
  74. package/dist-lib/lib/floriday-client.js +206 -25
  75. package/dist-lib/lib/floriday-env.d.ts +29 -0
  76. package/dist-lib/lib/floriday-env.d.ts.map +1 -0
  77. package/dist-lib/lib/floriday-env.js +42 -0
  78. package/dist-lib/lib/floriday-env.server.d.ts +15 -0
  79. package/dist-lib/lib/floriday-env.server.d.ts.map +1 -0
  80. package/dist-lib/lib/floriday-env.server.js +13 -0
  81. package/dist-lib/lib/floriday-field-sources.d.ts +18 -0
  82. package/dist-lib/lib/floriday-field-sources.d.ts.map +1 -0
  83. package/dist-lib/lib/floriday-field-sources.js +45 -0
  84. package/dist-lib/lib/floriday-gateway-entities.d.ts +44 -0
  85. package/dist-lib/lib/floriday-gateway-entities.d.ts.map +1 -0
  86. package/dist-lib/lib/floriday-gateway-entities.js +51 -0
  87. package/dist-lib/lib/floriday-gateway.functions.d.ts +39999 -0
  88. package/dist-lib/lib/floriday-gateway.functions.d.ts.map +1 -0
  89. package/dist-lib/lib/floriday-gateway.functions.js +68 -0
  90. package/dist-lib/lib/floriday-gateway.server.d.ts +122 -0
  91. package/dist-lib/lib/floriday-gateway.server.d.ts.map +1 -0
  92. package/dist-lib/lib/floriday-gateway.server.js +230 -0
  93. package/dist-lib/lib/floriday-import-validator.d.ts +26 -0
  94. package/dist-lib/lib/floriday-import-validator.d.ts.map +1 -0
  95. package/dist-lib/lib/floriday-import-validator.js +41 -0
  96. package/dist-lib/lib/floriday-payload.d.ts +47 -3
  97. package/dist-lib/lib/floriday-payload.d.ts.map +1 -1
  98. package/dist-lib/lib/floriday-payload.js +179 -7
  99. package/dist-lib/lib/floriday-schema-to-zod.d.ts +9 -0
  100. package/dist-lib/lib/floriday-schema-to-zod.d.ts.map +1 -0
  101. package/dist-lib/lib/floriday-schema-to-zod.js +53 -0
  102. package/dist-lib/lib/floriday-writes.functions.d.ts +19998 -0
  103. package/dist-lib/lib/floriday-writes.functions.d.ts.map +1 -0
  104. package/dist-lib/lib/floriday-writes.functions.js +74 -0
  105. package/dist-lib/lib/image-resize.d.ts +43 -0
  106. package/dist-lib/lib/image-resize.d.ts.map +1 -0
  107. package/dist-lib/lib/image-resize.js +212 -0
  108. package/dist-lib/lib/normalize-errors-middleware.d.ts +2 -0
  109. package/dist-lib/lib/normalize-errors-middleware.d.ts.map +1 -0
  110. package/dist-lib/lib/normalize-errors-middleware.js +24 -0
  111. package/dist-lib/lib/wizard-step-fields.d.ts +15 -0
  112. package/dist-lib/lib/wizard-step-fields.d.ts.map +1 -0
  113. package/dist-lib/lib/wizard-step-fields.js +51 -0
  114. package/package.json +35 -14
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Client-safe environment helpers voor Floriday.
3
+ *
4
+ * De Auth-gateway accepteert uitsluitend exact "staging" of "live" in de
5
+ * request-body. Eén bron van waarheid: de actieve Floriday-connectie
6
+ * (`floriday_settings.active_environment` of `floriday_connections.environment`).
7
+ *
8
+ * `normalizeFloridayEnvironment` is pure en mag overal worden geïmporteerd.
9
+ * De async resolver die de Supabase-RPC raakt staat in `floriday-env.server.ts`.
10
+ */
11
+ export class FloridayEnvError extends Error {
12
+ constructor(code, message) {
13
+ // Prefix met code zodat normalize-errors-middleware / safe() de code
14
+ // intact doorgeeft naar de UI (geen gestructureerde RPC-errors nodig).
15
+ super(`[${code}] ${message}`);
16
+ this.code = code;
17
+ this.name = "FloridayEnvError";
18
+ }
19
+ }
20
+ /**
21
+ * Mapt een ruwe environment-string uit de DB naar exact "staging" of "live".
22
+ * Werpt `FloridayEnvError("INVALID_FLORIDAY_ENVIRONMENT")` bij alles wat niet
23
+ * te mappen valt — geen stille defaults.
24
+ */
25
+ export function normalizeFloridayEnvironment(raw) {
26
+ const v = (raw ?? "").trim().toLowerCase();
27
+ if (v === "staging" || v === "stg")
28
+ return "staging";
29
+ if (v === "live" || v === "production" || v === "prod")
30
+ return "live";
31
+ throw new FloridayEnvError("INVALID_FLORIDAY_ENVIRONMENT", `Ongeldige Floriday-environment: "${raw ?? ""}". Verwacht "staging" of "live".`);
32
+ }
33
+ /**
34
+ * Detecteer een FloridayEnvError aan de hand van de message-prefix.
35
+ * Bruikbaar in UI-code waar alleen de Error-message beschikbaar is
36
+ * (server-fn errors worden door TanStack platgeslagen naar `new Error(message)`).
37
+ */
38
+ export function getFloridayEnvErrorCode(err) {
39
+ const msg = err instanceof Error ? err.message : String(err ?? "");
40
+ const m = msg.match(/\[(NO_ACTIVE_FLORIDAY_CONNECTION|INVALID_FLORIDAY_ENVIRONMENT)\]/);
41
+ return m?.[1] ?? null;
42
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Server-only resolver voor de actieve Floriday-environment.
3
+ *
4
+ * Single source of truth: dezelfde RPC die `useFloridayConnection` client-side
5
+ * gebruikt (`get_active_floriday_connection_public`). Dit voorkomt dat
6
+ * cached-list/write/media-upload elk een eigen environment-bron kiezen.
7
+ *
8
+ * NOOIT importeren vanuit componenten — filename eindigt op `.server.ts`
9
+ * en wordt geblokkeerd door de client-bundler.
10
+ */
11
+ import type { SupabaseClient } from "@supabase/supabase-js";
12
+ import { type FloridayEnvironment } from "./floriday-env";
13
+ export { FloridayEnvError, normalizeFloridayEnvironment, type FloridayEnvironment, } from "./floriday-env";
14
+ export declare function resolveFloridayEnvironment(supabase: SupabaseClient<any, any, any>): Promise<FloridayEnvironment>;
15
+ //# sourceMappingURL=floriday-env.server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floriday-env.server.d.ts","sourceRoot":"","sources":["../../src/lib/floriday-env.server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAGL,KAAK,mBAAmB,EACzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACL,gBAAgB,EAChB,4BAA4B,EAC5B,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC;AAExB,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GACtC,OAAO,CAAC,mBAAmB,CAAC,CAmB9B"}
@@ -0,0 +1,13 @@
1
+ import { FloridayEnvError, normalizeFloridayEnvironment, } from "./floriday-env";
2
+ export { FloridayEnvError, normalizeFloridayEnvironment, } from "./floriday-env";
3
+ export async function resolveFloridayEnvironment(supabase) {
4
+ const { data, error } = await supabase.rpc("get_active_floriday_connection_public");
5
+ if (error) {
6
+ throw new FloridayEnvError("NO_ACTIVE_FLORIDAY_CONNECTION", `Kon actieve Floriday-connectie niet ophalen: ${error.message}`);
7
+ }
8
+ const row = (Array.isArray(data) ? data[0] : data);
9
+ if (!row || !row.id) {
10
+ throw new FloridayEnvError("NO_ACTIVE_FLORIDAY_CONNECTION", "Geen actieve Floriday-connectie gevonden. Ga naar Instellingen → Floriday.");
11
+ }
12
+ return normalizeFloridayEnvironment(row.active_environment);
13
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Mapping van Floriday-veldnamen naar hun waarde-bron.
3
+ *
4
+ * - CODE_LIST_BY_FIELD: veld met vaste enum-waardes uit /gateway/code-list.
5
+ * - REF_ENTITY_BY_FIELD: veld dat verwijst naar een rij in een stamdata-cache,
6
+ * te lezen via /gateway/cached-list. Waarden zijn kebab-case Floriday-
7
+ * resources (GatewayEntity) — NIET de Supabase-tabelnaam.
8
+ * - REF_TABLE_BY_FIELD: identieke mapping naar de Supabase-cache-tabelnaam,
9
+ * uitsluitend voor directe `supabase.from(...)` reads in deze module.
10
+ */
11
+ import { type GatewayEntity } from "./floriday-gateway-entities";
12
+ export declare const CODE_LIST_BY_FIELD: Record<string, string>;
13
+ export declare const REF_ENTITY_BY_FIELD: Record<string, GatewayEntity>;
14
+ export declare const REF_TABLE_BY_FIELD: Record<string, string>;
15
+ export declare function codeListFor(field: string): string | undefined;
16
+ export declare function refEntityFor(field: string): GatewayEntity | undefined;
17
+ export declare function refTableFor(field: string): string | undefined;
18
+ //# sourceMappingURL=floriday-field-sources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floriday-field-sources.d.ts","sourceRoot":"","sources":["../../src/lib/floriday-field-sources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEnF,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAUrD,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAM7D,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAMrD,CAAC;AAEF,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE7D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAErE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE7D"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Mapping van Floriday-veldnamen naar hun waarde-bron.
3
+ *
4
+ * - CODE_LIST_BY_FIELD: veld met vaste enum-waardes uit /gateway/code-list.
5
+ * - REF_ENTITY_BY_FIELD: veld dat verwijst naar een rij in een stamdata-cache,
6
+ * te lezen via /gateway/cached-list. Waarden zijn kebab-case Floriday-
7
+ * resources (GatewayEntity) — NIET de Supabase-tabelnaam.
8
+ * - REF_TABLE_BY_FIELD: identieke mapping naar de Supabase-cache-tabelnaam,
9
+ * uitsluitend voor directe `supabase.from(...)` reads in deze module.
10
+ */
11
+ import { GATEWAY_ENTITIES } from "./floriday-gateway-entities";
12
+ export const CODE_LIST_BY_FIELD = {
13
+ currency: "Currency",
14
+ salesUnit: "SalesUnit",
15
+ auctionLocation: "AuctionLocation",
16
+ supplyType: "SupplyType",
17
+ loadCarrierType: "SupplyLoadCarrierType",
18
+ packingType: "PackingType",
19
+ qualityMark: "QualityMark",
20
+ country: "Country",
21
+ countryOfOrigin: "Country",
22
+ };
23
+ export const REF_ENTITY_BY_FIELD = {
24
+ packingId: GATEWAY_ENTITIES.packings,
25
+ warehouseId: GATEWAY_ENTITIES.warehouses,
26
+ deliveryLocationId: GATEWAY_ENTITIES.deliveryLocations,
27
+ priceGroupId: GATEWAY_ENTITIES.priceGroups,
28
+ collectionId: GATEWAY_ENTITIES.collections,
29
+ };
30
+ export const REF_TABLE_BY_FIELD = {
31
+ packingId: "floriday_packings_cache",
32
+ warehouseId: "floriday_warehouses_cache",
33
+ deliveryLocationId: "floriday_delivery_locations_cache",
34
+ priceGroupId: "floriday_price_groups_cache",
35
+ collectionId: "floriday_collections_cache",
36
+ };
37
+ export function codeListFor(field) {
38
+ return CODE_LIST_BY_FIELD[field];
39
+ }
40
+ export function refEntityFor(field) {
41
+ return REF_ENTITY_BY_FIELD[field];
42
+ }
43
+ export function refTableFor(field) {
44
+ return REF_TABLE_BY_FIELD[field];
45
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Whitelist van kebab-case Floriday-resource-namen die de centrale Auth-gateway
3
+ * accepteert op `/api/public/gateway/cached-list`. 1-op-1 overgenomen uit
4
+ * `src/routes/api/public/gateway/cached-list.ts` aan Auth-zijde.
5
+ *
6
+ * Componenten geven NOOIT een Supabase-tabelnaam (`floriday_<x>_cache`)
7
+ * door als `entity` — gebruik altijd de kebab-case key uit dit bestand.
8
+ */
9
+ export declare const GATEWAY_ENTITIES: {
10
+ readonly salesOrders: "sales-orders";
11
+ readonly tradeItems: "trade-items";
12
+ readonly customerOrganizations: "customer-organizations";
13
+ readonly carriers: "carriers";
14
+ readonly fulfillmentOrders: "fulfillment-orders";
15
+ readonly deliveryOrders: "delivery-orders";
16
+ readonly clockSupplies: "clock-supplies";
17
+ readonly clockPresales: "clock-presales";
18
+ readonly contracts: "contracts";
19
+ readonly blanketOrders: "blanket-orders";
20
+ readonly warehouses: "warehouses";
21
+ readonly deliveryLocations: "delivery-locations";
22
+ readonly packings: "packings";
23
+ readonly connections: "connections";
24
+ readonly customerStickers: "customer-stickers";
25
+ readonly additionalServices: "additional-services";
26
+ readonly commercialServiceTypes: "commercial-service-types";
27
+ readonly collections: "collections";
28
+ readonly priceGroups: "price-groups";
29
+ readonly deliveryConditionSets: "delivery-condition-sets";
30
+ readonly salesStrategies: "sales-strategies";
31
+ readonly baseItems: "base-items";
32
+ readonly contractTradeItemGroups: "contract-trade-item-groups";
33
+ };
34
+ export type GatewayEntity = (typeof GATEWAY_ENTITIES)[keyof typeof GATEWAY_ENTITIES];
35
+ export declare function isGatewayEntity(value: unknown): value is GatewayEntity;
36
+ /**
37
+ * Compat-bridge: zet een Supabase-cache-tabelnaam (`floriday_<x>_cache`) om
38
+ * naar de bijbehorende kebab-case entity. Alleen bedoeld als tijdelijke
39
+ * helper tijdens de migratie — nieuwe code geeft direct een `GatewayEntity`.
40
+ *
41
+ * Retourneert `undefined` wanneer er geen geldige mapping is.
42
+ */
43
+ export declare function tableToEntity(cacheTable: string): GatewayEntity | undefined;
44
+ //# sourceMappingURL=floriday-gateway-entities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floriday-gateway-entities.d.ts","sourceRoot":"","sources":["../../src/lib/floriday-gateway-entities.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;CAwBnB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAIrF,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAM3E"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Whitelist van kebab-case Floriday-resource-namen die de centrale Auth-gateway
3
+ * accepteert op `/api/public/gateway/cached-list`. 1-op-1 overgenomen uit
4
+ * `src/routes/api/public/gateway/cached-list.ts` aan Auth-zijde.
5
+ *
6
+ * Componenten geven NOOIT een Supabase-tabelnaam (`floriday_<x>_cache`)
7
+ * door als `entity` — gebruik altijd de kebab-case key uit dit bestand.
8
+ */
9
+ export const GATEWAY_ENTITIES = {
10
+ salesOrders: "sales-orders",
11
+ tradeItems: "trade-items",
12
+ customerOrganizations: "customer-organizations",
13
+ carriers: "carriers",
14
+ fulfillmentOrders: "fulfillment-orders",
15
+ deliveryOrders: "delivery-orders",
16
+ clockSupplies: "clock-supplies",
17
+ clockPresales: "clock-presales",
18
+ contracts: "contracts",
19
+ blanketOrders: "blanket-orders",
20
+ warehouses: "warehouses",
21
+ deliveryLocations: "delivery-locations",
22
+ packings: "packings",
23
+ connections: "connections",
24
+ customerStickers: "customer-stickers",
25
+ additionalServices: "additional-services",
26
+ commercialServiceTypes: "commercial-service-types",
27
+ collections: "collections",
28
+ priceGroups: "price-groups",
29
+ deliveryConditionSets: "delivery-condition-sets",
30
+ salesStrategies: "sales-strategies",
31
+ baseItems: "base-items",
32
+ contractTradeItemGroups: "contract-trade-item-groups",
33
+ };
34
+ const ALL = new Set(Object.values(GATEWAY_ENTITIES));
35
+ export function isGatewayEntity(value) {
36
+ return typeof value === "string" && ALL.has(value);
37
+ }
38
+ /**
39
+ * Compat-bridge: zet een Supabase-cache-tabelnaam (`floriday_<x>_cache`) om
40
+ * naar de bijbehorende kebab-case entity. Alleen bedoeld als tijdelijke
41
+ * helper tijdens de migratie — nieuwe code geeft direct een `GatewayEntity`.
42
+ *
43
+ * Retourneert `undefined` wanneer er geen geldige mapping is.
44
+ */
45
+ export function tableToEntity(cacheTable) {
46
+ const stripped = cacheTable
47
+ .replace(/^floriday_/, "")
48
+ .replace(/_cache$/, "")
49
+ .replace(/_/g, "-");
50
+ return isGatewayEntity(stripped) ? stripped : undefined;
51
+ }