@nubitio/core 0.11.0 → 0.11.2

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/README.md CHANGED
@@ -24,11 +24,7 @@ import { CoreProvider } from '@nubitio/core';
24
24
 
25
25
  export function App() {
26
26
  return (
27
- <CoreProvider
28
- apiBaseUrl="https://api.example.com"
29
- timezone="UTC"
30
- locale="en"
31
- >
27
+ <CoreProvider apiBaseUrl="https://api.example.com" timezone="UTC" locale="en">
32
28
  {/* your app */}
33
29
  </CoreProvider>
34
30
  );
@@ -47,6 +43,23 @@ Timezone (and other core settings) are configured once via `CoreConfigProvider`
47
43
 
48
44
  - `getCoreTimezone()` and `DateUtils` read from this config (works in React and non-React code).
49
45
  - Default is `UTC`. Use `DEFAULT_TIMEZONE` only as a fallback constant if you need one outside the provider.
46
+ - A Nubit backend stores timestamps in UTC and reports the display zone as `timeZone` in `GET /api/me`; pass that to the provider so the client formats the way the server intends.
47
+
48
+ ## Money
49
+
50
+ Monetary values arrive as `{ amount, currency, scale, minorAmount }` and are handled exactly — never as a JavaScript number.
51
+
52
+ ```ts
53
+ import { parseMoney, formatMoney, sumMoney, parseMoneyInput } from '@nubitio/core';
54
+
55
+ const total = sumMoney(rows.map((row) => parseMoney(row.total)!)); // exact
56
+ formatMoney(total, { showCurrency: true }); // "€1,234.50" in the active locale
57
+ parseMoneyInput('1.234,56', 'EUR', 2); // accepts the locale's separators
58
+ ```
59
+
60
+ `amount` is the authority, not `minorAmount`: the latter is a JSON number, and past 2^53 minor units a JSON number is already approximate. Everything here parses the decimal string into a `BigInt`, which is exact at any size.
61
+
62
+ `sumMoney` returns `null` for mixed currencies rather than a total. A footer that adds euros to dollars is worse than an empty one, because it looks right.
50
63
 
51
64
  ## API Base URL
52
65
 
@@ -102,12 +115,12 @@ See `CoreHttpClientConfig` for all options.
102
115
 
103
116
  ## Key exports
104
117
 
105
- | Export | Description |
106
- |--------|-------------|
107
- | `CoreProvider` | Root provider — wraps HTTP, i18n, React Query, and runtime config |
108
- | `CoreHttpClient` | Type-safe HTTP client with error normalisation + pluggable auth refresh |
109
- | `dispatch` / `useEvents` | Lightweight event bus for cross-component communication |
110
- | `createCrudEvents` | Factory for typed CRUD event sets |
111
- | `MercureProvider` | Real-time SSE integration via Mercure hub |
112
- | `DateUtils` | Timezone-aware date formatting powered by Luxon |
113
- | `coreTranslationsEs` / `coreTranslationsEn` | Built-in translations for Spanish and English |
118
+ | Export | Description |
119
+ | ------------------------------------------- | ----------------------------------------------------------------------- |
120
+ | `CoreProvider` | Root provider — wraps HTTP, i18n, React Query, and runtime config |
121
+ | `CoreHttpClient` | Type-safe HTTP client with error normalisation + pluggable auth refresh |
122
+ | `dispatch` / `useEvents` | Lightweight event bus for cross-component communication |
123
+ | `createCrudEvents` | Factory for typed CRUD event sets |
124
+ | `MercureProvider` | Real-time SSE integration via Mercure hub |
125
+ | `DateUtils` | Timezone-aware date formatting powered by Luxon |
126
+ | `coreTranslationsEs` / `coreTranslationsEn` | Built-in translations for Spanish and English |
package/dist/index.cjs CHANGED
@@ -181,6 +181,149 @@ var DateUtils = class {
181
181
  }
182
182
  };
183
183
  //#endregion
184
+ //#region packages/core/money/Money.ts
185
+ const DECIMAL_PATTERN = /^[+-]?\d+(\.\d+)?$/;
186
+ /**
187
+ * Reads a value coming off the wire.
188
+ *
189
+ * Returns null rather than throwing for anything unrecognised: a grid renders
190
+ * thousands of cells, and one malformed row must not take the page down.
191
+ */
192
+ function parseMoney(raw) {
193
+ if (raw === null || raw === void 0) return null;
194
+ if (typeof raw !== "object") return null;
195
+ const candidate = raw;
196
+ const { amount, currency, scale } = candidate;
197
+ if (typeof amount !== "string" || !DECIMAL_PATTERN.test(amount)) return null;
198
+ if (typeof currency !== "string" || currency.length !== 3) return null;
199
+ const resolvedScale = typeof scale === "number" && Number.isInteger(scale) && scale >= 0 ? scale : decimalsOf(amount);
200
+ return {
201
+ amount,
202
+ currency: currency.toUpperCase(),
203
+ scale: resolvedScale,
204
+ minorAmount: typeof candidate.minorAmount === "number" ? candidate.minorAmount : void 0
205
+ };
206
+ }
207
+ function isMoneyValue(raw) {
208
+ return parseMoney(raw) !== null;
209
+ }
210
+ /** Exact minor units, computed from the decimal string rather than trusted from the wire. */
211
+ function toMinorUnits(value) {
212
+ const negative = value.amount.startsWith("-");
213
+ const [integerPart, fractionPart = ""] = value.amount.replace(/^[+-]/, "").split(".");
214
+ const combined = `${integerPart}${fractionPart.padEnd(value.scale, "0").slice(0, value.scale)}` || "0";
215
+ const magnitude = BigInt(combined);
216
+ return negative ? -magnitude : magnitude;
217
+ }
218
+ function fromMinorUnits(minor, currency, scale) {
219
+ return {
220
+ amount: formatMinorUnits(minor, scale),
221
+ currency: currency.toUpperCase(),
222
+ scale
223
+ };
224
+ }
225
+ /** Renders an exact integer count of minor units as a decimal literal. */
226
+ function formatMinorUnits(minor, scale) {
227
+ if (scale === 0) return minor.toString();
228
+ const negative = minor < 0n;
229
+ const digits = (negative ? -minor : minor).toString().padStart(scale + 1, "0");
230
+ const integerPart = digits.slice(0, digits.length - scale);
231
+ const fractionPart = digits.slice(digits.length - scale);
232
+ return `${negative ? "-" : ""}${integerPart}.${fractionPart}`;
233
+ }
234
+ /**
235
+ * Adds a list of amounts exactly.
236
+ *
237
+ * Mixed currencies produce null rather than a wrong total: a grid footer that
238
+ * adds euros to dollars is worse than one that shows nothing, because it looks
239
+ * right.
240
+ */
241
+ function sumMoney(values) {
242
+ if (values.length === 0) return null;
243
+ const [first] = values;
244
+ let total = 0n;
245
+ for (const value of values) {
246
+ if (value.currency !== first.currency || value.scale !== first.scale) return null;
247
+ total += toMinorUnits(value);
248
+ }
249
+ return fromMinorUnits(total, first.currency, first.scale);
250
+ }
251
+ /**
252
+ * Formats for display, in the viewer's locale.
253
+ *
254
+ * The decimal string is handed to Intl directly. Converting to a number first
255
+ * would round the value before it is ever shown — the one place where the drift
256
+ * would be visible and blamed on the database.
257
+ */
258
+ function formatMoney(value, options = {}) {
259
+ if (!value) return "";
260
+ const locale = options.locale ?? getCoreLocale();
261
+ const formatOptions = {
262
+ minimumFractionDigits: value.scale,
263
+ maximumFractionDigits: value.scale,
264
+ ...options.showCurrency ? {
265
+ style: "currency",
266
+ currency: value.currency
267
+ } : {}
268
+ };
269
+ try {
270
+ return new Intl.NumberFormat(locale, formatOptions).format(value.amount);
271
+ } catch {
272
+ return new Intl.NumberFormat(locale, {
273
+ minimumFractionDigits: value.scale,
274
+ maximumFractionDigits: value.scale
275
+ }).format(value.amount);
276
+ }
277
+ }
278
+ /**
279
+ * Turns what a user typed into an amount.
280
+ *
281
+ * Accepts the separators of the active locale as well as plain "1234.56", since
282
+ * both reach a form: one from typing, the other from a paste. Returns null when
283
+ * the text is not a number, and a rejection when it carries more decimals than
284
+ * the currency has — silently dropping a digit the user typed would change the
285
+ * value they think they entered.
286
+ */
287
+ function parseMoneyInput(text, currency, scale, locale = getCoreLocale()) {
288
+ const trimmed = text.trim();
289
+ if (trimmed === "") return {
290
+ ok: false,
291
+ reason: "invalid"
292
+ };
293
+ const normalized = normalizeSeparators(trimmed, locale);
294
+ if (!DECIMAL_PATTERN.test(normalized)) return {
295
+ ok: false,
296
+ reason: "invalid"
297
+ };
298
+ if (decimalsOf(normalized) > scale) return {
299
+ ok: false,
300
+ reason: "too-precise"
301
+ };
302
+ const negative = normalized.startsWith("-");
303
+ const [integerPart, fractionPart = ""] = normalized.replace(/^[+-]/, "").split(".");
304
+ const minor = BigInt(`${integerPart}${fractionPart.padEnd(scale, "0")}`);
305
+ return {
306
+ ok: true,
307
+ value: fromMinorUnits(negative ? -minor : minor, currency, scale)
308
+ };
309
+ }
310
+ /**
311
+ * Rewrites locale separators into the canonical form.
312
+ *
313
+ * "1.234,56" and "1,234.56" are the same amount written for different readers.
314
+ * The decimal separator is taken from the locale rather than guessed, because
315
+ * guessing turns "1.234" into either 1234 or 1.234 depending on the reader.
316
+ */
317
+ function normalizeSeparators(text, locale) {
318
+ const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((part) => part.type === "decimal")?.value ?? ".";
319
+ const groupSeparator = decimalSeparator === "," ? "." : ",";
320
+ return text.split(groupSeparator).join("").replace(/\s/g, "").split(decimalSeparator).join(".");
321
+ }
322
+ function decimalsOf(decimal) {
323
+ const index = decimal.indexOf(".");
324
+ return index === -1 ? 0 : decimal.length - index - 1;
325
+ }
326
+ //#endregion
184
327
  //#region packages/core/event/EventHook.ts
185
328
  const listeners = /* @__PURE__ */ new Map();
186
329
  function subscribe(name, handler) {
@@ -327,6 +470,35 @@ const coreTranslationsEs = {
327
470
  "grid.buttonActions": "Acciones",
328
471
  "grid.buttonView": "Ver",
329
472
  "grid.buttonExport": "Exportar",
473
+ "document.print": "Imprimir",
474
+ "document.reissue": "Emitir corrección",
475
+ "document.reissueConfirm": "Se emitirá una copia nueva que reemplaza a la anterior. La anterior seguirá siendo legible.",
476
+ "document.download": "Descargar",
477
+ "document.history": "Historial de emisiones",
478
+ "document.pending": "Generando el documento…",
479
+ "document.failed": "No se pudo generar el documento",
480
+ "document.superseded": "Reemplazado",
481
+ "document.empty": "Este registro aún no tiene documentos emitidos",
482
+ "document.loading": "Cargando…",
483
+ "document.error": "No se pudo cargar el historial",
484
+ "import.title": "Importar desde archivo",
485
+ "import.chooseFile": "Seleccionar archivo",
486
+ "import.analyze": "Analizar",
487
+ "import.analyzing": "Analizando el archivo…",
488
+ "import.confirm": "Aplicar importación",
489
+ "import.applying": "Aplicando…",
490
+ "import.applied": "Importación aplicada",
491
+ "import.summary": "{{rows}} filas: {{inserts}} nuevas, {{updates}} actualizadas, {{invalid}} con errores",
492
+ "import.nothingApplied": "Nada se ha escrito todavía. Revisa el resumen antes de aplicar.",
493
+ "import.blockedByErrors": "Corrige los errores del archivo y vuelve a subirlo: una importación parcial no es posible.",
494
+ "import.errorsTitle": "Filas con errores",
495
+ "import.errorLine": "Fila {{line}}",
496
+ "import.unmapped": "Campos sin columna: {{fields}}",
497
+ "import.numberFormat": "Formato numérico del archivo",
498
+ "import.numberFormatAuto": "Detectar",
499
+ "import.numberFormatDot": "1,234.56",
500
+ "import.numberFormatComma": "1.234,56",
501
+ "import.failed": "No se pudo procesar el archivo",
330
502
  "grid.exportError": "No se pudo exportar. Intenta de nuevo.",
331
503
  "grid.rowsPerPage": "Filas por página",
332
504
  "grid.recordRange": "{{start}}-{{end}} de {{total}} registros",
@@ -468,6 +640,35 @@ const coreTranslationsEn = {
468
640
  "grid.buttonActions": "Actions",
469
641
  "grid.buttonView": "View",
470
642
  "grid.buttonExport": "Export",
643
+ "document.print": "Print",
644
+ "document.reissue": "Issue correction",
645
+ "document.reissueConfirm": "A new copy will be issued replacing the previous one. The previous copy stays readable.",
646
+ "document.download": "Download",
647
+ "document.history": "Issue history",
648
+ "document.pending": "Preparing the document…",
649
+ "document.failed": "The document could not be produced",
650
+ "document.superseded": "Superseded",
651
+ "document.empty": "No document has been issued for this record yet",
652
+ "document.loading": "Loading…",
653
+ "document.error": "The history could not be loaded",
654
+ "import.title": "Import from a file",
655
+ "import.chooseFile": "Choose a file",
656
+ "import.analyze": "Analyse",
657
+ "import.analyzing": "Analysing the file…",
658
+ "import.confirm": "Apply import",
659
+ "import.applying": "Applying…",
660
+ "import.applied": "Import applied",
661
+ "import.summary": "{{rows}} rows: {{inserts}} new, {{updates}} updated, {{invalid}} with errors",
662
+ "import.nothingApplied": "Nothing has been written yet. Review the summary before applying.",
663
+ "import.blockedByErrors": "Fix the errors in the file and upload it again; a partial import is not possible.",
664
+ "import.errorsTitle": "Rows with errors",
665
+ "import.errorLine": "Row {{line}}",
666
+ "import.unmapped": "Fields with no column: {{fields}}",
667
+ "import.numberFormat": "Number format in the file",
668
+ "import.numberFormatAuto": "Detect",
669
+ "import.numberFormatDot": "1,234.56",
670
+ "import.numberFormatComma": "1.234,56",
671
+ "import.failed": "The file could not be processed",
471
672
  "grid.exportError": "Couldn't export. Try again.",
472
673
  "grid.rowsPerPage": "Rows per page",
473
674
  "grid.recordRange": "{{start}}-{{end}} of {{total}} records",
@@ -1252,6 +1453,9 @@ exports.discoverMercureFromResponse = discoverMercureFromResponse;
1252
1453
  exports.dispatch = dispatch;
1253
1454
  exports.extractMercureHubUrl = extractMercureHubUrl;
1254
1455
  exports.extractTopicOriginFromPayload = extractTopicOriginFromPayload;
1456
+ exports.formatMinorUnits = formatMinorUnits;
1457
+ exports.formatMoney = formatMoney;
1458
+ exports.fromMinorUnits = fromMinorUnits;
1255
1459
  exports.getCoreApiBaseUrl = getCoreApiBaseUrl;
1256
1460
  exports.getCoreCurrency = getCoreCurrency;
1257
1461
  exports.getCoreLocale = getCoreLocale;
@@ -1259,8 +1463,13 @@ exports.getCoreTimezone = getCoreTimezone;
1259
1463
  exports.getDiscoveredMercureTopicOrigin = getDiscoveredMercureTopicOrigin;
1260
1464
  exports.getMercureTopicOrigin = getMercureTopicOrigin;
1261
1465
  exports.initCoreI18n = initCoreI18n;
1466
+ exports.isMoneyValue = isMoneyValue;
1262
1467
  exports.parseLinkHeader = parseLinkHeader;
1468
+ exports.parseMoney = parseMoney;
1469
+ exports.parseMoneyInput = parseMoneyInput;
1263
1470
  exports.resolveMercureTopicOrigin = resolveMercureTopicOrigin;
1471
+ exports.sumMoney = sumMoney;
1472
+ exports.toMinorUnits = toMinorUnits;
1264
1473
  exports.useBooleanFlag = useBooleanFlag;
1265
1474
  exports.useCoreConfig = useCoreConfig;
1266
1475
  exports.useCoreHttpClient = useCoreHttpClient;
package/dist/index.d.cts CHANGED
@@ -10,6 +10,23 @@ interface GridData<T> {
10
10
  summary: T[] | null;
11
11
  /** Server-computed column aggregates (from X-Grid-Summary header). */
12
12
  gridSummary?: Record<string, unknown> | null;
13
+ /**
14
+ * True when `totalCount` is an estimate, or unknown.
15
+ *
16
+ * A resource that paginates by cursor gives up the exact count deliberately —
17
+ * `COUNT(*)` is what stops scaling first. Rendering an estimate as if it were
18
+ * exact is how a user reconciles against it and files a bug; the grid shows
19
+ * "about N", or a page indicator, when this is set.
20
+ */
21
+ totalIsEstimate?: boolean;
22
+ /**
23
+ * The server's own link to the next page.
24
+ *
25
+ * Cursor pagination cannot be driven by a page number the client calculates:
26
+ * each page is defined by the last row of the previous one. Following this is
27
+ * the only correct way to advance.
28
+ */
29
+ nextPageUrl?: string | null;
13
30
  }
14
31
  //#endregion
15
32
  //#region packages/core/date/DateUtils.d.ts
@@ -29,6 +46,77 @@ declare class DateUtils {
29
46
  static monthDiff(startDate: string | number | Date, endDate: string | number | Date): number;
30
47
  }
31
48
  //#endregion
49
+ //#region packages/core/money/Money.d.ts
50
+ /**
51
+ * A monetary amount as the API publishes it.
52
+ *
53
+ * `amount` is the authority. `minorAmount` arrives as a JSON number and is kept
54
+ * for convenience, but nothing here computes from it: a JSON number is an
55
+ * IEEE-754 double in every JavaScript runtime, so past 2^53 minor units it is
56
+ * already approximate. Every operation below parses the decimal string into a
57
+ * BigInt instead, which is exact at any size.
58
+ */
59
+ interface MoneyValue {
60
+ /** Decimal literal in major units, e.g. "1234567.89". */
61
+ readonly amount: string;
62
+ /** ISO-4217 code, e.g. "EUR". */
63
+ readonly currency: string;
64
+ /** Decimal places the currency has: 2 for EUR, 0 for JPY, 3 for KWD. */
65
+ readonly scale: number;
66
+ /** Amount in minor units, as sent by the API. Informational only. */
67
+ readonly minorAmount?: number;
68
+ }
69
+ /**
70
+ * Reads a value coming off the wire.
71
+ *
72
+ * Returns null rather than throwing for anything unrecognised: a grid renders
73
+ * thousands of cells, and one malformed row must not take the page down.
74
+ */
75
+ declare function parseMoney(raw: unknown): MoneyValue | null;
76
+ declare function isMoneyValue(raw: unknown): raw is MoneyValue;
77
+ /** Exact minor units, computed from the decimal string rather than trusted from the wire. */
78
+ declare function toMinorUnits(value: MoneyValue): bigint;
79
+ declare function fromMinorUnits(minor: bigint, currency: string, scale: number): MoneyValue;
80
+ /** Renders an exact integer count of minor units as a decimal literal. */
81
+ declare function formatMinorUnits(minor: bigint, scale: number): string;
82
+ /**
83
+ * Adds a list of amounts exactly.
84
+ *
85
+ * Mixed currencies produce null rather than a wrong total: a grid footer that
86
+ * adds euros to dollars is worse than one that shows nothing, because it looks
87
+ * right.
88
+ */
89
+ declare function sumMoney(values: readonly MoneyValue[]): MoneyValue | null;
90
+ interface FormatMoneyOptions {
91
+ locale?: string;
92
+ /** Show the currency symbol or code. Off for grid cells, on for totals. */
93
+ showCurrency?: boolean;
94
+ }
95
+ /**
96
+ * Formats for display, in the viewer's locale.
97
+ *
98
+ * The decimal string is handed to Intl directly. Converting to a number first
99
+ * would round the value before it is ever shown — the one place where the drift
100
+ * would be visible and blamed on the database.
101
+ */
102
+ declare function formatMoney(value: MoneyValue | null | undefined, options?: FormatMoneyOptions): string;
103
+ /**
104
+ * Turns what a user typed into an amount.
105
+ *
106
+ * Accepts the separators of the active locale as well as plain "1234.56", since
107
+ * both reach a form: one from typing, the other from a paste. Returns null when
108
+ * the text is not a number, and a rejection when it carries more decimals than
109
+ * the currency has — silently dropping a digit the user typed would change the
110
+ * value they think they entered.
111
+ */
112
+ declare function parseMoneyInput(text: string, currency: string, scale: number, locale?: string): {
113
+ ok: true;
114
+ value: MoneyValue;
115
+ } | {
116
+ ok: false;
117
+ reason: 'invalid' | 'too-precise';
118
+ };
119
+ //#endregion
32
120
  //#region packages/core/config/CoreConfig.d.ts
33
121
  interface CoreConfig {
34
122
  locale: string;
@@ -329,6 +417,35 @@ interface CoreTranslationKeys {
329
417
  'form.imageUploadPrompt': string;
330
418
  'form.imageUploadHint': string;
331
419
  'crudPage.confirmActionTitle': string;
420
+ 'document.print': string;
421
+ 'document.reissue': string;
422
+ 'document.reissueConfirm': string;
423
+ 'document.download': string;
424
+ 'document.history': string;
425
+ 'document.pending': string;
426
+ 'document.failed': string;
427
+ 'document.superseded': string;
428
+ 'document.empty': string;
429
+ 'document.loading': string;
430
+ 'document.error': string;
431
+ 'import.title': string;
432
+ 'import.chooseFile': string;
433
+ 'import.analyze': string;
434
+ 'import.analyzing': string;
435
+ 'import.confirm': string;
436
+ 'import.applying': string;
437
+ 'import.applied': string;
438
+ 'import.summary': string;
439
+ 'import.nothingApplied': string;
440
+ 'import.blockedByErrors': string;
441
+ 'import.errorsTitle': string;
442
+ 'import.errorLine': string;
443
+ 'import.unmapped': string;
444
+ 'import.numberFormat': string;
445
+ 'import.numberFormatAuto': string;
446
+ 'import.numberFormatDot': string;
447
+ 'import.numberFormatComma': string;
448
+ 'import.failed': string;
332
449
  }
333
450
  //#endregion
334
451
  //#region packages/core/i18n/coreTranslations.d.ts
@@ -699,4 +816,4 @@ declare class MercureManager {
699
816
  /** Singleton instance — shared across the entire application. */
700
817
  declare const mercureManager: MercureManager;
701
818
  //#endregion
702
- export { type CoreConfig, CoreConfigProvider, type CoreConfigProviderProps, CoreHttpClient, type CoreHttpClientConfig, type CoreHttpError, type CoreHttpErrorData, CoreHttpProvider, type CoreHttpProviderProps, type CoreHttpResponse, type CoreNotificationType, CoreProvider, type CoreProviderProps, type CoreRequestConfig, type CoreResponseType, type CoreRuntime, CoreRuntimeProvider, type CoreRuntimeProviderProps, type CoreTranslationKeys, DEFAULT_TIMEZONE, type DataGridEventNames, type DataRecord, DateUtils, type DialogEventNames, type EventSubscription, type FeatureFlagClient, type FeatureFlagEvaluationContext, type FeatureFlagValues, FeatureFlagsProvider, type FeatureFlagsProviderProps, type FormEventNames, type GridData, mercureManager as MercureManager, type MercureManager as MercureManagerType, MercureProvider, type MercureProviderProps, type ScopedFormEventNames, StaticFeatureFlagClient, type ToolbarButtonItem, buildMercureCollectionTopic, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, discoverMercureFromResponse, dispatch, extractMercureHubUrl, extractTopicOriginFromPayload, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, getDiscoveredMercureTopicOrigin, getMercureTopicOrigin, initCoreI18n, parseLinkHeader, resolveMercureTopicOrigin, useBooleanFlag, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useDiscoveredMercureTopicOrigin, useEvents, useFeatureFlags, useMercureHub, useMercureSubscription, useNumberFlag, useObjectFlag, useStringFlag };
819
+ export { type CoreConfig, CoreConfigProvider, type CoreConfigProviderProps, CoreHttpClient, type CoreHttpClientConfig, type CoreHttpError, type CoreHttpErrorData, CoreHttpProvider, type CoreHttpProviderProps, type CoreHttpResponse, type CoreNotificationType, CoreProvider, type CoreProviderProps, type CoreRequestConfig, type CoreResponseType, type CoreRuntime, CoreRuntimeProvider, type CoreRuntimeProviderProps, type CoreTranslationKeys, DEFAULT_TIMEZONE, type DataGridEventNames, type DataRecord, DateUtils, type DialogEventNames, type EventSubscription, type FeatureFlagClient, type FeatureFlagEvaluationContext, type FeatureFlagValues, FeatureFlagsProvider, type FeatureFlagsProviderProps, type FormEventNames, type FormatMoneyOptions, type GridData, mercureManager as MercureManager, type MercureManager as MercureManagerType, MercureProvider, type MercureProviderProps, type MoneyValue, type ScopedFormEventNames, StaticFeatureFlagClient, type ToolbarButtonItem, buildMercureCollectionTopic, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, discoverMercureFromResponse, dispatch, extractMercureHubUrl, extractTopicOriginFromPayload, formatMinorUnits, formatMoney, fromMinorUnits, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, getDiscoveredMercureTopicOrigin, getMercureTopicOrigin, initCoreI18n, isMoneyValue, parseLinkHeader, parseMoney, parseMoneyInput, resolveMercureTopicOrigin, sumMoney, toMinorUnits, useBooleanFlag, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useDiscoveredMercureTopicOrigin, useEvents, useFeatureFlags, useMercureHub, useMercureSubscription, useNumberFlag, useObjectFlag, useStringFlag };
package/dist/index.d.mts CHANGED
@@ -10,6 +10,23 @@ interface GridData<T> {
10
10
  summary: T[] | null;
11
11
  /** Server-computed column aggregates (from X-Grid-Summary header). */
12
12
  gridSummary?: Record<string, unknown> | null;
13
+ /**
14
+ * True when `totalCount` is an estimate, or unknown.
15
+ *
16
+ * A resource that paginates by cursor gives up the exact count deliberately —
17
+ * `COUNT(*)` is what stops scaling first. Rendering an estimate as if it were
18
+ * exact is how a user reconciles against it and files a bug; the grid shows
19
+ * "about N", or a page indicator, when this is set.
20
+ */
21
+ totalIsEstimate?: boolean;
22
+ /**
23
+ * The server's own link to the next page.
24
+ *
25
+ * Cursor pagination cannot be driven by a page number the client calculates:
26
+ * each page is defined by the last row of the previous one. Following this is
27
+ * the only correct way to advance.
28
+ */
29
+ nextPageUrl?: string | null;
13
30
  }
14
31
  //#endregion
15
32
  //#region packages/core/date/DateUtils.d.ts
@@ -29,6 +46,77 @@ declare class DateUtils {
29
46
  static monthDiff(startDate: string | number | Date, endDate: string | number | Date): number;
30
47
  }
31
48
  //#endregion
49
+ //#region packages/core/money/Money.d.ts
50
+ /**
51
+ * A monetary amount as the API publishes it.
52
+ *
53
+ * `amount` is the authority. `minorAmount` arrives as a JSON number and is kept
54
+ * for convenience, but nothing here computes from it: a JSON number is an
55
+ * IEEE-754 double in every JavaScript runtime, so past 2^53 minor units it is
56
+ * already approximate. Every operation below parses the decimal string into a
57
+ * BigInt instead, which is exact at any size.
58
+ */
59
+ interface MoneyValue {
60
+ /** Decimal literal in major units, e.g. "1234567.89". */
61
+ readonly amount: string;
62
+ /** ISO-4217 code, e.g. "EUR". */
63
+ readonly currency: string;
64
+ /** Decimal places the currency has: 2 for EUR, 0 for JPY, 3 for KWD. */
65
+ readonly scale: number;
66
+ /** Amount in minor units, as sent by the API. Informational only. */
67
+ readonly minorAmount?: number;
68
+ }
69
+ /**
70
+ * Reads a value coming off the wire.
71
+ *
72
+ * Returns null rather than throwing for anything unrecognised: a grid renders
73
+ * thousands of cells, and one malformed row must not take the page down.
74
+ */
75
+ declare function parseMoney(raw: unknown): MoneyValue | null;
76
+ declare function isMoneyValue(raw: unknown): raw is MoneyValue;
77
+ /** Exact minor units, computed from the decimal string rather than trusted from the wire. */
78
+ declare function toMinorUnits(value: MoneyValue): bigint;
79
+ declare function fromMinorUnits(minor: bigint, currency: string, scale: number): MoneyValue;
80
+ /** Renders an exact integer count of minor units as a decimal literal. */
81
+ declare function formatMinorUnits(minor: bigint, scale: number): string;
82
+ /**
83
+ * Adds a list of amounts exactly.
84
+ *
85
+ * Mixed currencies produce null rather than a wrong total: a grid footer that
86
+ * adds euros to dollars is worse than one that shows nothing, because it looks
87
+ * right.
88
+ */
89
+ declare function sumMoney(values: readonly MoneyValue[]): MoneyValue | null;
90
+ interface FormatMoneyOptions {
91
+ locale?: string;
92
+ /** Show the currency symbol or code. Off for grid cells, on for totals. */
93
+ showCurrency?: boolean;
94
+ }
95
+ /**
96
+ * Formats for display, in the viewer's locale.
97
+ *
98
+ * The decimal string is handed to Intl directly. Converting to a number first
99
+ * would round the value before it is ever shown — the one place where the drift
100
+ * would be visible and blamed on the database.
101
+ */
102
+ declare function formatMoney(value: MoneyValue | null | undefined, options?: FormatMoneyOptions): string;
103
+ /**
104
+ * Turns what a user typed into an amount.
105
+ *
106
+ * Accepts the separators of the active locale as well as plain "1234.56", since
107
+ * both reach a form: one from typing, the other from a paste. Returns null when
108
+ * the text is not a number, and a rejection when it carries more decimals than
109
+ * the currency has — silently dropping a digit the user typed would change the
110
+ * value they think they entered.
111
+ */
112
+ declare function parseMoneyInput(text: string, currency: string, scale: number, locale?: string): {
113
+ ok: true;
114
+ value: MoneyValue;
115
+ } | {
116
+ ok: false;
117
+ reason: 'invalid' | 'too-precise';
118
+ };
119
+ //#endregion
32
120
  //#region packages/core/config/CoreConfig.d.ts
33
121
  interface CoreConfig {
34
122
  locale: string;
@@ -329,6 +417,35 @@ interface CoreTranslationKeys {
329
417
  'form.imageUploadPrompt': string;
330
418
  'form.imageUploadHint': string;
331
419
  'crudPage.confirmActionTitle': string;
420
+ 'document.print': string;
421
+ 'document.reissue': string;
422
+ 'document.reissueConfirm': string;
423
+ 'document.download': string;
424
+ 'document.history': string;
425
+ 'document.pending': string;
426
+ 'document.failed': string;
427
+ 'document.superseded': string;
428
+ 'document.empty': string;
429
+ 'document.loading': string;
430
+ 'document.error': string;
431
+ 'import.title': string;
432
+ 'import.chooseFile': string;
433
+ 'import.analyze': string;
434
+ 'import.analyzing': string;
435
+ 'import.confirm': string;
436
+ 'import.applying': string;
437
+ 'import.applied': string;
438
+ 'import.summary': string;
439
+ 'import.nothingApplied': string;
440
+ 'import.blockedByErrors': string;
441
+ 'import.errorsTitle': string;
442
+ 'import.errorLine': string;
443
+ 'import.unmapped': string;
444
+ 'import.numberFormat': string;
445
+ 'import.numberFormatAuto': string;
446
+ 'import.numberFormatDot': string;
447
+ 'import.numberFormatComma': string;
448
+ 'import.failed': string;
332
449
  }
333
450
  //#endregion
334
451
  //#region packages/core/i18n/coreTranslations.d.ts
@@ -699,4 +816,4 @@ declare class MercureManager {
699
816
  /** Singleton instance — shared across the entire application. */
700
817
  declare const mercureManager: MercureManager;
701
818
  //#endregion
702
- export { type CoreConfig, CoreConfigProvider, type CoreConfigProviderProps, CoreHttpClient, type CoreHttpClientConfig, type CoreHttpError, type CoreHttpErrorData, CoreHttpProvider, type CoreHttpProviderProps, type CoreHttpResponse, type CoreNotificationType, CoreProvider, type CoreProviderProps, type CoreRequestConfig, type CoreResponseType, type CoreRuntime, CoreRuntimeProvider, type CoreRuntimeProviderProps, type CoreTranslationKeys, DEFAULT_TIMEZONE, type DataGridEventNames, type DataRecord, DateUtils, type DialogEventNames, type EventSubscription, type FeatureFlagClient, type FeatureFlagEvaluationContext, type FeatureFlagValues, FeatureFlagsProvider, type FeatureFlagsProviderProps, type FormEventNames, type GridData, mercureManager as MercureManager, type MercureManager as MercureManagerType, MercureProvider, type MercureProviderProps, type ScopedFormEventNames, StaticFeatureFlagClient, type ToolbarButtonItem, buildMercureCollectionTopic, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, discoverMercureFromResponse, dispatch, extractMercureHubUrl, extractTopicOriginFromPayload, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, getDiscoveredMercureTopicOrigin, getMercureTopicOrigin, initCoreI18n, parseLinkHeader, resolveMercureTopicOrigin, useBooleanFlag, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useDiscoveredMercureTopicOrigin, useEvents, useFeatureFlags, useMercureHub, useMercureSubscription, useNumberFlag, useObjectFlag, useStringFlag };
819
+ export { type CoreConfig, CoreConfigProvider, type CoreConfigProviderProps, CoreHttpClient, type CoreHttpClientConfig, type CoreHttpError, type CoreHttpErrorData, CoreHttpProvider, type CoreHttpProviderProps, type CoreHttpResponse, type CoreNotificationType, CoreProvider, type CoreProviderProps, type CoreRequestConfig, type CoreResponseType, type CoreRuntime, CoreRuntimeProvider, type CoreRuntimeProviderProps, type CoreTranslationKeys, DEFAULT_TIMEZONE, type DataGridEventNames, type DataRecord, DateUtils, type DialogEventNames, type EventSubscription, type FeatureFlagClient, type FeatureFlagEvaluationContext, type FeatureFlagValues, FeatureFlagsProvider, type FeatureFlagsProviderProps, type FormEventNames, type FormatMoneyOptions, type GridData, mercureManager as MercureManager, type MercureManager as MercureManagerType, MercureProvider, type MercureProviderProps, type MoneyValue, type ScopedFormEventNames, StaticFeatureFlagClient, type ToolbarButtonItem, buildMercureCollectionTopic, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, discoverMercureFromResponse, dispatch, extractMercureHubUrl, extractTopicOriginFromPayload, formatMinorUnits, formatMoney, fromMinorUnits, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, getDiscoveredMercureTopicOrigin, getMercureTopicOrigin, initCoreI18n, isMoneyValue, parseLinkHeader, parseMoney, parseMoneyInput, resolveMercureTopicOrigin, sumMoney, toMinorUnits, useBooleanFlag, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useDiscoveredMercureTopicOrigin, useEvents, useFeatureFlags, useMercureHub, useMercureSubscription, useNumberFlag, useObjectFlag, useStringFlag };
package/dist/index.mjs CHANGED
@@ -156,6 +156,149 @@ var DateUtils = class {
156
156
  }
157
157
  };
158
158
  //#endregion
159
+ //#region packages/core/money/Money.ts
160
+ const DECIMAL_PATTERN = /^[+-]?\d+(\.\d+)?$/;
161
+ /**
162
+ * Reads a value coming off the wire.
163
+ *
164
+ * Returns null rather than throwing for anything unrecognised: a grid renders
165
+ * thousands of cells, and one malformed row must not take the page down.
166
+ */
167
+ function parseMoney(raw) {
168
+ if (raw === null || raw === void 0) return null;
169
+ if (typeof raw !== "object") return null;
170
+ const candidate = raw;
171
+ const { amount, currency, scale } = candidate;
172
+ if (typeof amount !== "string" || !DECIMAL_PATTERN.test(amount)) return null;
173
+ if (typeof currency !== "string" || currency.length !== 3) return null;
174
+ const resolvedScale = typeof scale === "number" && Number.isInteger(scale) && scale >= 0 ? scale : decimalsOf(amount);
175
+ return {
176
+ amount,
177
+ currency: currency.toUpperCase(),
178
+ scale: resolvedScale,
179
+ minorAmount: typeof candidate.minorAmount === "number" ? candidate.minorAmount : void 0
180
+ };
181
+ }
182
+ function isMoneyValue(raw) {
183
+ return parseMoney(raw) !== null;
184
+ }
185
+ /** Exact minor units, computed from the decimal string rather than trusted from the wire. */
186
+ function toMinorUnits(value) {
187
+ const negative = value.amount.startsWith("-");
188
+ const [integerPart, fractionPart = ""] = value.amount.replace(/^[+-]/, "").split(".");
189
+ const combined = `${integerPart}${fractionPart.padEnd(value.scale, "0").slice(0, value.scale)}` || "0";
190
+ const magnitude = BigInt(combined);
191
+ return negative ? -magnitude : magnitude;
192
+ }
193
+ function fromMinorUnits(minor, currency, scale) {
194
+ return {
195
+ amount: formatMinorUnits(minor, scale),
196
+ currency: currency.toUpperCase(),
197
+ scale
198
+ };
199
+ }
200
+ /** Renders an exact integer count of minor units as a decimal literal. */
201
+ function formatMinorUnits(minor, scale) {
202
+ if (scale === 0) return minor.toString();
203
+ const negative = minor < 0n;
204
+ const digits = (negative ? -minor : minor).toString().padStart(scale + 1, "0");
205
+ const integerPart = digits.slice(0, digits.length - scale);
206
+ const fractionPart = digits.slice(digits.length - scale);
207
+ return `${negative ? "-" : ""}${integerPart}.${fractionPart}`;
208
+ }
209
+ /**
210
+ * Adds a list of amounts exactly.
211
+ *
212
+ * Mixed currencies produce null rather than a wrong total: a grid footer that
213
+ * adds euros to dollars is worse than one that shows nothing, because it looks
214
+ * right.
215
+ */
216
+ function sumMoney(values) {
217
+ if (values.length === 0) return null;
218
+ const [first] = values;
219
+ let total = 0n;
220
+ for (const value of values) {
221
+ if (value.currency !== first.currency || value.scale !== first.scale) return null;
222
+ total += toMinorUnits(value);
223
+ }
224
+ return fromMinorUnits(total, first.currency, first.scale);
225
+ }
226
+ /**
227
+ * Formats for display, in the viewer's locale.
228
+ *
229
+ * The decimal string is handed to Intl directly. Converting to a number first
230
+ * would round the value before it is ever shown — the one place where the drift
231
+ * would be visible and blamed on the database.
232
+ */
233
+ function formatMoney(value, options = {}) {
234
+ if (!value) return "";
235
+ const locale = options.locale ?? getCoreLocale();
236
+ const formatOptions = {
237
+ minimumFractionDigits: value.scale,
238
+ maximumFractionDigits: value.scale,
239
+ ...options.showCurrency ? {
240
+ style: "currency",
241
+ currency: value.currency
242
+ } : {}
243
+ };
244
+ try {
245
+ return new Intl.NumberFormat(locale, formatOptions).format(value.amount);
246
+ } catch {
247
+ return new Intl.NumberFormat(locale, {
248
+ minimumFractionDigits: value.scale,
249
+ maximumFractionDigits: value.scale
250
+ }).format(value.amount);
251
+ }
252
+ }
253
+ /**
254
+ * Turns what a user typed into an amount.
255
+ *
256
+ * Accepts the separators of the active locale as well as plain "1234.56", since
257
+ * both reach a form: one from typing, the other from a paste. Returns null when
258
+ * the text is not a number, and a rejection when it carries more decimals than
259
+ * the currency has — silently dropping a digit the user typed would change the
260
+ * value they think they entered.
261
+ */
262
+ function parseMoneyInput(text, currency, scale, locale = getCoreLocale()) {
263
+ const trimmed = text.trim();
264
+ if (trimmed === "") return {
265
+ ok: false,
266
+ reason: "invalid"
267
+ };
268
+ const normalized = normalizeSeparators(trimmed, locale);
269
+ if (!DECIMAL_PATTERN.test(normalized)) return {
270
+ ok: false,
271
+ reason: "invalid"
272
+ };
273
+ if (decimalsOf(normalized) > scale) return {
274
+ ok: false,
275
+ reason: "too-precise"
276
+ };
277
+ const negative = normalized.startsWith("-");
278
+ const [integerPart, fractionPart = ""] = normalized.replace(/^[+-]/, "").split(".");
279
+ const minor = BigInt(`${integerPart}${fractionPart.padEnd(scale, "0")}`);
280
+ return {
281
+ ok: true,
282
+ value: fromMinorUnits(negative ? -minor : minor, currency, scale)
283
+ };
284
+ }
285
+ /**
286
+ * Rewrites locale separators into the canonical form.
287
+ *
288
+ * "1.234,56" and "1,234.56" are the same amount written for different readers.
289
+ * The decimal separator is taken from the locale rather than guessed, because
290
+ * guessing turns "1.234" into either 1234 or 1.234 depending on the reader.
291
+ */
292
+ function normalizeSeparators(text, locale) {
293
+ const decimalSeparator = new Intl.NumberFormat(locale).formatToParts(1.1).find((part) => part.type === "decimal")?.value ?? ".";
294
+ const groupSeparator = decimalSeparator === "," ? "." : ",";
295
+ return text.split(groupSeparator).join("").replace(/\s/g, "").split(decimalSeparator).join(".");
296
+ }
297
+ function decimalsOf(decimal) {
298
+ const index = decimal.indexOf(".");
299
+ return index === -1 ? 0 : decimal.length - index - 1;
300
+ }
301
+ //#endregion
159
302
  //#region packages/core/event/EventHook.ts
160
303
  const listeners = /* @__PURE__ */ new Map();
161
304
  function subscribe(name, handler) {
@@ -302,6 +445,35 @@ const coreTranslationsEs = {
302
445
  "grid.buttonActions": "Acciones",
303
446
  "grid.buttonView": "Ver",
304
447
  "grid.buttonExport": "Exportar",
448
+ "document.print": "Imprimir",
449
+ "document.reissue": "Emitir corrección",
450
+ "document.reissueConfirm": "Se emitirá una copia nueva que reemplaza a la anterior. La anterior seguirá siendo legible.",
451
+ "document.download": "Descargar",
452
+ "document.history": "Historial de emisiones",
453
+ "document.pending": "Generando el documento…",
454
+ "document.failed": "No se pudo generar el documento",
455
+ "document.superseded": "Reemplazado",
456
+ "document.empty": "Este registro aún no tiene documentos emitidos",
457
+ "document.loading": "Cargando…",
458
+ "document.error": "No se pudo cargar el historial",
459
+ "import.title": "Importar desde archivo",
460
+ "import.chooseFile": "Seleccionar archivo",
461
+ "import.analyze": "Analizar",
462
+ "import.analyzing": "Analizando el archivo…",
463
+ "import.confirm": "Aplicar importación",
464
+ "import.applying": "Aplicando…",
465
+ "import.applied": "Importación aplicada",
466
+ "import.summary": "{{rows}} filas: {{inserts}} nuevas, {{updates}} actualizadas, {{invalid}} con errores",
467
+ "import.nothingApplied": "Nada se ha escrito todavía. Revisa el resumen antes de aplicar.",
468
+ "import.blockedByErrors": "Corrige los errores del archivo y vuelve a subirlo: una importación parcial no es posible.",
469
+ "import.errorsTitle": "Filas con errores",
470
+ "import.errorLine": "Fila {{line}}",
471
+ "import.unmapped": "Campos sin columna: {{fields}}",
472
+ "import.numberFormat": "Formato numérico del archivo",
473
+ "import.numberFormatAuto": "Detectar",
474
+ "import.numberFormatDot": "1,234.56",
475
+ "import.numberFormatComma": "1.234,56",
476
+ "import.failed": "No se pudo procesar el archivo",
305
477
  "grid.exportError": "No se pudo exportar. Intenta de nuevo.",
306
478
  "grid.rowsPerPage": "Filas por página",
307
479
  "grid.recordRange": "{{start}}-{{end}} de {{total}} registros",
@@ -443,6 +615,35 @@ const coreTranslationsEn = {
443
615
  "grid.buttonActions": "Actions",
444
616
  "grid.buttonView": "View",
445
617
  "grid.buttonExport": "Export",
618
+ "document.print": "Print",
619
+ "document.reissue": "Issue correction",
620
+ "document.reissueConfirm": "A new copy will be issued replacing the previous one. The previous copy stays readable.",
621
+ "document.download": "Download",
622
+ "document.history": "Issue history",
623
+ "document.pending": "Preparing the document…",
624
+ "document.failed": "The document could not be produced",
625
+ "document.superseded": "Superseded",
626
+ "document.empty": "No document has been issued for this record yet",
627
+ "document.loading": "Loading…",
628
+ "document.error": "The history could not be loaded",
629
+ "import.title": "Import from a file",
630
+ "import.chooseFile": "Choose a file",
631
+ "import.analyze": "Analyse",
632
+ "import.analyzing": "Analysing the file…",
633
+ "import.confirm": "Apply import",
634
+ "import.applying": "Applying…",
635
+ "import.applied": "Import applied",
636
+ "import.summary": "{{rows}} rows: {{inserts}} new, {{updates}} updated, {{invalid}} with errors",
637
+ "import.nothingApplied": "Nothing has been written yet. Review the summary before applying.",
638
+ "import.blockedByErrors": "Fix the errors in the file and upload it again; a partial import is not possible.",
639
+ "import.errorsTitle": "Rows with errors",
640
+ "import.errorLine": "Row {{line}}",
641
+ "import.unmapped": "Fields with no column: {{fields}}",
642
+ "import.numberFormat": "Number format in the file",
643
+ "import.numberFormatAuto": "Detect",
644
+ "import.numberFormatDot": "1,234.56",
645
+ "import.numberFormatComma": "1.234,56",
646
+ "import.failed": "The file could not be processed",
446
647
  "grid.exportError": "Couldn't export. Try again.",
447
648
  "grid.rowsPerPage": "Rows per page",
448
649
  "grid.recordRange": "{{start}}-{{end}} of {{total}} records",
@@ -1204,4 +1405,4 @@ function useMercureSubscription(apiUrl, onUpdate, enabled = true) {
1204
1405
  ]);
1205
1406
  }
1206
1407
  //#endregion
1207
- export { CoreConfigProvider, CoreHttpClient, CoreHttpProvider, CoreProvider, CoreRuntimeProvider, DEFAULT_TIMEZONE, DateUtils, FeatureFlagsProvider, mercureManager as MercureManager, MercureProvider, StaticFeatureFlagClient, buildMercureCollectionTopic, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, discoverMercureFromResponse, dispatch, extractMercureHubUrl, extractTopicOriginFromPayload, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, getDiscoveredMercureTopicOrigin, getMercureTopicOrigin, initCoreI18n, parseLinkHeader, resolveMercureTopicOrigin, useBooleanFlag, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useDiscoveredMercureTopicOrigin, useEvents, useFeatureFlags, useMercureHub, useMercureSubscription, useNumberFlag, useObjectFlag, useStringFlag };
1408
+ export { CoreConfigProvider, CoreHttpClient, CoreHttpProvider, CoreProvider, CoreRuntimeProvider, DEFAULT_TIMEZONE, DateUtils, FeatureFlagsProvider, mercureManager as MercureManager, MercureProvider, StaticFeatureFlagClient, buildMercureCollectionTopic, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, discoverMercureFromResponse, dispatch, extractMercureHubUrl, extractTopicOriginFromPayload, formatMinorUnits, formatMoney, fromMinorUnits, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, getDiscoveredMercureTopicOrigin, getMercureTopicOrigin, initCoreI18n, isMoneyValue, parseLinkHeader, parseMoney, parseMoneyInput, resolveMercureTopicOrigin, sumMoney, toMinorUnits, useBooleanFlag, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useDiscoveredMercureTopicOrigin, useEvents, useFeatureFlags, useMercureHub, useMercureSubscription, useNumberFlag, useObjectFlag, useStringFlag };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nubitio/core",
3
- "version": "0.11.0",
3
+ "version": "0.11.2",
4
4
  "type": "module",
5
5
  "description": "Runtime foundation for Nubit: HTTP, events, i18n, Mercure, feature flags, providers, and date utilities.",
6
6
  "license": "MIT",