@nubitio/core 1.3.0 → 1.4.0
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/index.cjs +27 -51
- package/dist/index.d.cts +60 -113
- package/dist/index.d.mts +60 -113
- package/dist/index.mjs +25 -48
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,14 +20,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
value: mod,
|
|
21
21
|
enumerable: true
|
|
22
22
|
}) : target, mod));
|
|
23
|
-
//#endregion
|
|
24
23
|
let react = require("react");
|
|
25
|
-
react = __toESM(react, 1);
|
|
26
24
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
27
|
-
let react_i18next = require("react-i18next");
|
|
28
25
|
let i18next = require("i18next");
|
|
26
|
+
let react_i18next = require("react-i18next");
|
|
27
|
+
react = __toESM(react, 1);
|
|
29
28
|
i18next = __toESM(i18next, 1);
|
|
30
|
-
|
|
29
|
+
// packages/core/config/CoreConfig.tsx
|
|
31
30
|
const _coreConfig = {
|
|
32
31
|
locale: "en",
|
|
33
32
|
timezone: "UTC",
|
|
@@ -105,8 +104,7 @@ const CoreConfigProvider = ({ locale, timezone, apiBaseUrl, currency, mercureTop
|
|
|
105
104
|
function useCoreConfig() {
|
|
106
105
|
return react.default.useContext(CoreConfigContext);
|
|
107
106
|
}
|
|
108
|
-
|
|
109
|
-
//#region packages/core/date/DateUtils.ts
|
|
107
|
+
// packages/core/date/DateUtils.ts
|
|
110
108
|
/**
|
|
111
109
|
* Recommended default for new projects using @nubitio/core.
|
|
112
110
|
* You should almost always override this via CoreConfigProvider.
|
|
@@ -180,8 +178,7 @@ var DateUtils = class {
|
|
|
180
178
|
return months <= 0 ? 0 : months;
|
|
181
179
|
}
|
|
182
180
|
};
|
|
183
|
-
|
|
184
|
-
//#region packages/core/money/Money.ts
|
|
181
|
+
// packages/core/money/Money.ts
|
|
185
182
|
const DECIMAL_PATTERN = /^[+-]?\d+(\.\d+)?$/;
|
|
186
183
|
/**
|
|
187
184
|
* Reads a value coming off the wire.
|
|
@@ -323,8 +320,7 @@ function decimalsOf(decimal) {
|
|
|
323
320
|
const index = decimal.indexOf(".");
|
|
324
321
|
return index === -1 ? 0 : decimal.length - index - 1;
|
|
325
322
|
}
|
|
326
|
-
|
|
327
|
-
//#region packages/core/event/EventHook.ts
|
|
323
|
+
// packages/core/event/EventHook.ts
|
|
328
324
|
const listeners = /* @__PURE__ */ new Map();
|
|
329
325
|
function subscribe(name, handler) {
|
|
330
326
|
if (!listeners.has(name)) listeners.set(name, /* @__PURE__ */ new Set());
|
|
@@ -370,8 +366,7 @@ const dispatch = (name, payload) => {
|
|
|
370
366
|
} catch {}
|
|
371
367
|
});
|
|
372
368
|
};
|
|
373
|
-
|
|
374
|
-
//#region packages/core/event/createCrudEvents.ts
|
|
369
|
+
// packages/core/event/createCrudEvents.ts
|
|
375
370
|
/**
|
|
376
371
|
* Generic factory that builds a typed set of CRUD event name strings for a
|
|
377
372
|
* given `prefix`. The returned object is `const`-asserted so every value is
|
|
@@ -395,8 +390,7 @@ const createCrudEvents = (prefix) => ({
|
|
|
395
390
|
SUCCESS: `${prefix}:success`,
|
|
396
391
|
LOADING: `${prefix}:loading`
|
|
397
392
|
});
|
|
398
|
-
|
|
399
|
-
//#region packages/core/event/createScopedEventBus.ts
|
|
393
|
+
// packages/core/event/createScopedEventBus.ts
|
|
400
394
|
/**
|
|
401
395
|
* Creates a scoped event bus for the given resource.
|
|
402
396
|
*
|
|
@@ -417,8 +411,7 @@ function createScopedEventBus(resourceId) {
|
|
|
417
411
|
_scopeId: scopeId
|
|
418
412
|
};
|
|
419
413
|
}
|
|
420
|
-
|
|
421
|
-
//#region packages/core/i18n/coreTranslations.ts
|
|
414
|
+
// packages/core/i18n/coreTranslations.ts
|
|
422
415
|
const coreTranslationsEs = {
|
|
423
416
|
"crudPage.selectedCount": "{{count}} seleccionados",
|
|
424
417
|
"crudPage.auditTrailButton": "Historial",
|
|
@@ -783,20 +776,17 @@ const coreTranslationsEn = {
|
|
|
783
776
|
"form.fileUploadEmpty": "No file",
|
|
784
777
|
"crudPage.confirmActionTitle": "Confirm action"
|
|
785
778
|
};
|
|
786
|
-
|
|
787
|
-
//#region packages/core/i18n/useCoreTranslation.ts
|
|
779
|
+
// packages/core/i18n/useCoreTranslation.ts
|
|
788
780
|
function useCoreTranslation() {
|
|
789
781
|
const { t } = (0, react_i18next.useTranslation)("core");
|
|
790
|
-
return { t: (key, options) => t(key, options) };
|
|
782
|
+
return { t: (key, options) => t(key, options ?? {}) };
|
|
791
783
|
}
|
|
792
|
-
|
|
793
|
-
//#region packages/core/i18n/initCoreI18n.ts
|
|
784
|
+
// packages/core/i18n/initCoreI18n.ts
|
|
794
785
|
function initCoreI18n() {
|
|
795
786
|
i18next.default.addResourceBundle("es", "core", coreTranslationsEs, true, false);
|
|
796
787
|
i18next.default.addResourceBundle("en", "core", coreTranslationsEn, true, false);
|
|
797
788
|
}
|
|
798
|
-
|
|
799
|
-
//#region packages/core/mercure/MercureManager.ts
|
|
789
|
+
// packages/core/mercure/MercureManager.ts
|
|
800
790
|
var MercureManager = class {
|
|
801
791
|
hubUrl = null;
|
|
802
792
|
topics = /* @__PURE__ */ new Map();
|
|
@@ -913,8 +903,7 @@ var MercureManager = class {
|
|
|
913
903
|
};
|
|
914
904
|
/** Singleton instance — shared across the entire application. */
|
|
915
905
|
const mercureManager = new MercureManager();
|
|
916
|
-
|
|
917
|
-
//#region packages/core/mercure/mercureDiscovery.ts
|
|
906
|
+
// packages/core/mercure/mercureDiscovery.ts
|
|
918
907
|
let discoveredTopicOrigin;
|
|
919
908
|
const topicOriginListeners = /* @__PURE__ */ new Set();
|
|
920
909
|
/**
|
|
@@ -1019,8 +1008,7 @@ function discoverMercureFromResponse(response, data) {
|
|
|
1019
1008
|
const topicOrigin = extractTopicOriginFromPayload(data);
|
|
1020
1009
|
if (topicOrigin) setDiscoveredTopicOrigin(topicOrigin);
|
|
1021
1010
|
}
|
|
1022
|
-
|
|
1023
|
-
//#region packages/core/http/correlationId.ts
|
|
1011
|
+
// packages/core/http/correlationId.ts
|
|
1024
1012
|
/**
|
|
1025
1013
|
* Generates a client-side correlation id for one logical HTTP request.
|
|
1026
1014
|
*
|
|
@@ -1040,8 +1028,7 @@ function generateCorrelationId() {
|
|
|
1040
1028
|
if (cryptoRef && typeof cryptoRef.randomUUID === "function") return cryptoRef.randomUUID();
|
|
1041
1029
|
return `req-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
1042
1030
|
}
|
|
1043
|
-
|
|
1044
|
-
//#region packages/core/http/CoreHttpClient.ts
|
|
1031
|
+
// packages/core/http/CoreHttpClient.ts
|
|
1045
1032
|
/** Default value of {@link CoreHttpClientConfig.csrfHeaderName}. */
|
|
1046
1033
|
const DEFAULT_CSRF_HEADER_NAME = "X-CSRF-Token";
|
|
1047
1034
|
/** Default value of {@link CoreHttpClientConfig.correlationIdHeaderName}. */
|
|
@@ -1254,8 +1241,7 @@ var CoreHttpClient = class {
|
|
|
1254
1241
|
function createCoreHttpClient(config) {
|
|
1255
1242
|
return new CoreHttpClient(config);
|
|
1256
1243
|
}
|
|
1257
|
-
|
|
1258
|
-
//#region packages/core/http/CoreHttpContext.tsx
|
|
1244
|
+
// packages/core/http/CoreHttpContext.tsx
|
|
1259
1245
|
const defaultHttpClient = createCoreHttpClient();
|
|
1260
1246
|
const CoreHttpContext = (0, react.createContext)(defaultHttpClient);
|
|
1261
1247
|
function CoreHttpProvider({ children, client, config }) {
|
|
@@ -1274,8 +1260,7 @@ function CoreHttpProvider({ children, client, config }) {
|
|
|
1274
1260
|
function useCoreHttpClient() {
|
|
1275
1261
|
return (0, react.useContext)(CoreHttpContext);
|
|
1276
1262
|
}
|
|
1277
|
-
|
|
1278
|
-
//#region packages/core/http/csrf.ts
|
|
1263
|
+
// packages/core/http/csrf.ts
|
|
1279
1264
|
/** Name of the cookie the Nubit backend sets for the double-submit CSRF policy. */
|
|
1280
1265
|
const CSRF_COOKIE_NAME = "CSRF_TOKEN";
|
|
1281
1266
|
/**
|
|
@@ -1301,8 +1286,7 @@ function readCsrfToken(cookieName = CSRF_COOKIE_NAME) {
|
|
|
1301
1286
|
}
|
|
1302
1287
|
}
|
|
1303
1288
|
}
|
|
1304
|
-
|
|
1305
|
-
//#region packages/core/runtime/CoreRuntimeContext.tsx
|
|
1289
|
+
// packages/core/runtime/CoreRuntimeContext.tsx
|
|
1306
1290
|
const defaultRuntime = {
|
|
1307
1291
|
notify: () => void 0,
|
|
1308
1292
|
confirm: (message) => {
|
|
@@ -1324,8 +1308,7 @@ function CoreRuntimeProvider({ children, runtime }) {
|
|
|
1324
1308
|
function useCoreRuntime() {
|
|
1325
1309
|
return (0, react.useContext)(CoreRuntimeContext);
|
|
1326
1310
|
}
|
|
1327
|
-
|
|
1328
|
-
//#region packages/core/provider/CoreProvider.tsx
|
|
1311
|
+
// packages/core/provider/CoreProvider.tsx
|
|
1329
1312
|
function CoreProvider({ children, http, httpClient, runtime }) {
|
|
1330
1313
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CoreHttpProvider, {
|
|
1331
1314
|
client: httpClient,
|
|
@@ -1336,8 +1319,7 @@ function CoreProvider({ children, http, httpClient, runtime }) {
|
|
|
1336
1319
|
})
|
|
1337
1320
|
});
|
|
1338
1321
|
}
|
|
1339
|
-
|
|
1340
|
-
//#region packages/core/featureFlags/FeatureFlags.tsx
|
|
1322
|
+
// packages/core/featureFlags/FeatureFlags.tsx
|
|
1341
1323
|
var StaticFeatureFlagClient = class {
|
|
1342
1324
|
flags;
|
|
1343
1325
|
context;
|
|
@@ -1390,8 +1372,7 @@ function useNumberFlag(key, defaultValue = 0) {
|
|
|
1390
1372
|
function useObjectFlag(key, defaultValue) {
|
|
1391
1373
|
return useFeatureFlags().getObjectValue(key, defaultValue);
|
|
1392
1374
|
}
|
|
1393
|
-
|
|
1394
|
-
//#region packages/core/mercure/MercureProvider.tsx
|
|
1375
|
+
// packages/core/mercure/MercureProvider.tsx
|
|
1395
1376
|
/**
|
|
1396
1377
|
* MercureProvider — React context provider for the Mercure hub URL.
|
|
1397
1378
|
*
|
|
@@ -1439,8 +1420,7 @@ function MercureProvider({ hubUrl: hubUrlOverride, children }) {
|
|
|
1439
1420
|
children
|
|
1440
1421
|
});
|
|
1441
1422
|
}
|
|
1442
|
-
|
|
1443
|
-
//#region packages/core/mercure/useMercureHub.ts
|
|
1423
|
+
// packages/core/mercure/useMercureHub.ts
|
|
1444
1424
|
/**
|
|
1445
1425
|
* useMercureHub — Hook that returns the Mercure hub URL from context.
|
|
1446
1426
|
*
|
|
@@ -1467,8 +1447,7 @@ function MercureProvider({ hubUrl: hubUrlOverride, children }) {
|
|
|
1467
1447
|
function useMercureHub() {
|
|
1468
1448
|
return (0, react.useContext)(MercureContext);
|
|
1469
1449
|
}
|
|
1470
|
-
|
|
1471
|
-
//#region packages/core/mercure/mercureTopics.ts
|
|
1450
|
+
// packages/core/mercure/mercureTopics.ts
|
|
1472
1451
|
/**
|
|
1473
1452
|
* Resolves the origin used to build Mercure collection topic URIs.
|
|
1474
1453
|
*
|
|
@@ -1504,8 +1483,7 @@ function buildMercureCollectionTopic(apiUrl, configuredOrigin, apiBaseUrl = getC
|
|
|
1504
1483
|
if (tenantId !== void 0 && tenantId !== null && `${tenantId}` !== "") return `${origin}/api/tenants/${tenantId}/${normalizedPath.replace(/^api\//, "")}/*`;
|
|
1505
1484
|
return `${origin}/${normalizedPath}/*`;
|
|
1506
1485
|
}
|
|
1507
|
-
|
|
1508
|
-
//#region packages/core/mercure/useDiscoveredMercureTopicOrigin.ts
|
|
1486
|
+
// packages/core/mercure/useDiscoveredMercureTopicOrigin.ts
|
|
1509
1487
|
/**
|
|
1510
1488
|
* Returns the Mercure topic origin autodiscovered from Hydra `@id` IRIs.
|
|
1511
1489
|
* Re-renders when a new origin is discovered from a subsequent API response.
|
|
@@ -1515,8 +1493,7 @@ function useDiscoveredMercureTopicOrigin() {
|
|
|
1515
1493
|
(0, react.useEffect)(() => onMercureTopicOriginChange(setOrigin), []);
|
|
1516
1494
|
return origin;
|
|
1517
1495
|
}
|
|
1518
|
-
|
|
1519
|
-
//#region packages/core/mercure/useMercureSubscription.ts
|
|
1496
|
+
// packages/core/mercure/useMercureSubscription.ts
|
|
1520
1497
|
/**
|
|
1521
1498
|
* useMercureSubscription — Hook that subscribes to a Mercure topic and calls
|
|
1522
1499
|
* a callback whenever an SSE message is received for that topic.
|
|
@@ -1569,7 +1546,6 @@ function useMercureSubscription(apiUrl, onUpdate, enabled = true) {
|
|
|
1569
1546
|
apiBaseUrl
|
|
1570
1547
|
]);
|
|
1571
1548
|
}
|
|
1572
|
-
//#endregion
|
|
1573
1549
|
exports.CSRF_COOKIE_NAME = CSRF_COOKIE_NAME;
|
|
1574
1550
|
exports.CoreConfigProvider = CoreConfigProvider;
|
|
1575
1551
|
exports.CoreHttpClient = CoreHttpClient;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
|
|
2
|
+
import { TOptions } from "i18next";
|
|
3
3
|
type DataRecord = Record<string, unknown>;
|
|
4
|
-
//#endregion
|
|
5
|
-
//#region packages/core/data/GridData.d.ts
|
|
6
4
|
interface GridData<T> {
|
|
7
5
|
data: T[];
|
|
8
6
|
totalCount: number;
|
|
@@ -27,14 +25,12 @@ interface GridData<T> {
|
|
|
27
25
|
*/
|
|
28
26
|
nextPageUrl?: string | null;
|
|
29
27
|
}
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region packages/core/date/DateUtils.d.ts
|
|
32
28
|
/**
|
|
33
29
|
* Recommended default for new projects using @nubitio/core.
|
|
34
30
|
* You should almost always override this via CoreConfigProvider.
|
|
35
31
|
*/
|
|
36
|
-
declare const DEFAULT_TIMEZONE = "UTC";
|
|
37
|
-
declare class DateUtils {
|
|
32
|
+
export declare const DEFAULT_TIMEZONE = "UTC";
|
|
33
|
+
export declare class DateUtils {
|
|
38
34
|
static dateFormatter(date: Date): string;
|
|
39
35
|
static dateParser(dateString: string): Date;
|
|
40
36
|
static format(dateString: string, formatOptions?: Intl.DateTimeFormatOptions): string;
|
|
@@ -44,8 +40,6 @@ declare class DateUtils {
|
|
|
44
40
|
static dayDiff(startDate: string | number | Date, endDate: string | number | Date): number;
|
|
45
41
|
static monthDiff(startDate: string | number | Date, endDate: string | number | Date): number;
|
|
46
42
|
}
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region packages/core/money/Money.d.ts
|
|
49
43
|
/**
|
|
50
44
|
* A monetary amount as the API publishes it.
|
|
51
45
|
*
|
|
@@ -71,13 +65,13 @@ interface MoneyValue {
|
|
|
71
65
|
* Returns null rather than throwing for anything unrecognised: a grid renders
|
|
72
66
|
* thousands of cells, and one malformed row must not take the page down.
|
|
73
67
|
*/
|
|
74
|
-
declare function parseMoney(raw: unknown): MoneyValue | null;
|
|
75
|
-
declare function isMoneyValue(raw: unknown): raw is MoneyValue;
|
|
68
|
+
export declare function parseMoney(raw: unknown): MoneyValue | null;
|
|
69
|
+
export declare function isMoneyValue(raw: unknown): raw is MoneyValue;
|
|
76
70
|
/** Exact minor units, computed from the decimal string rather than trusted from the wire. */
|
|
77
|
-
declare function toMinorUnits(value: MoneyValue): bigint;
|
|
78
|
-
declare function fromMinorUnits(minor: bigint, currency: string, scale: number): MoneyValue;
|
|
71
|
+
export declare function toMinorUnits(value: MoneyValue): bigint;
|
|
72
|
+
export declare function fromMinorUnits(minor: bigint, currency: string, scale: number): MoneyValue;
|
|
79
73
|
/** Renders an exact integer count of minor units as a decimal literal. */
|
|
80
|
-
declare function formatMinorUnits(minor: bigint, scale: number): string;
|
|
74
|
+
export declare function formatMinorUnits(minor: bigint, scale: number): string;
|
|
81
75
|
/**
|
|
82
76
|
* Adds a list of amounts exactly.
|
|
83
77
|
*
|
|
@@ -85,7 +79,7 @@ declare function formatMinorUnits(minor: bigint, scale: number): string;
|
|
|
85
79
|
* adds euros to dollars is worse than one that shows nothing, because it looks
|
|
86
80
|
* right.
|
|
87
81
|
*/
|
|
88
|
-
declare function sumMoney(values: readonly MoneyValue[]): MoneyValue | null;
|
|
82
|
+
export declare function sumMoney(values: readonly MoneyValue[]): MoneyValue | null;
|
|
89
83
|
interface FormatMoneyOptions {
|
|
90
84
|
locale?: string;
|
|
91
85
|
/** Show the currency symbol or code. Off for grid cells, on for totals. */
|
|
@@ -98,7 +92,7 @@ interface FormatMoneyOptions {
|
|
|
98
92
|
* would round the value before it is ever shown — the one place where the drift
|
|
99
93
|
* would be visible and blamed on the database.
|
|
100
94
|
*/
|
|
101
|
-
declare function formatMoney(value: MoneyValue | null | undefined, options?: FormatMoneyOptions): string;
|
|
95
|
+
export declare function formatMoney(value: MoneyValue | null | undefined, options?: FormatMoneyOptions): string;
|
|
102
96
|
/**
|
|
103
97
|
* Turns what a user typed into an amount.
|
|
104
98
|
*
|
|
@@ -108,15 +102,13 @@ declare function formatMoney(value: MoneyValue | null | undefined, options?: For
|
|
|
108
102
|
* the currency has — silently dropping a digit the user typed would change the
|
|
109
103
|
* value they think they entered.
|
|
110
104
|
*/
|
|
111
|
-
declare function parseMoneyInput(text: string, currency: string, scale: number, locale?: string): {
|
|
105
|
+
export declare function parseMoneyInput(text: string, currency: string, scale: number, locale?: string): {
|
|
112
106
|
ok: true;
|
|
113
107
|
value: MoneyValue;
|
|
114
108
|
} | {
|
|
115
109
|
ok: false;
|
|
116
110
|
reason: 'invalid' | 'too-precise';
|
|
117
111
|
};
|
|
118
|
-
//#endregion
|
|
119
|
-
//#region packages/core/config/CoreConfig.d.ts
|
|
120
112
|
interface CoreConfig {
|
|
121
113
|
locale: string;
|
|
122
114
|
timezone: string;
|
|
@@ -140,17 +132,17 @@ interface CoreConfig {
|
|
|
140
132
|
* This updates the module-level singleton so it can be read from non-React code
|
|
141
133
|
* (e.g. inside defineResource, entityField builders, DateUtils, etc.).
|
|
142
134
|
*/
|
|
143
|
-
declare function configureCore(config: Partial<CoreConfig>): void;
|
|
135
|
+
export declare function configureCore(config: Partial<CoreConfig>): void;
|
|
144
136
|
/**
|
|
145
137
|
* @deprecated Use configureCore() instead.
|
|
146
138
|
*/
|
|
147
|
-
declare const configureCoreDate: typeof configureCore;
|
|
148
|
-
declare function getCoreLocale(): string;
|
|
149
|
-
declare function getCoreTimezone(): string;
|
|
150
|
-
declare function getCoreApiBaseUrl(): string;
|
|
139
|
+
export declare const configureCoreDate: typeof configureCore;
|
|
140
|
+
export declare function getCoreLocale(): string;
|
|
141
|
+
export declare function getCoreTimezone(): string;
|
|
142
|
+
export declare function getCoreApiBaseUrl(): string;
|
|
151
143
|
/** App-wide default currency (ISO 4217), or undefined when not configured. */
|
|
152
|
-
declare function getCoreCurrency(): string | undefined;
|
|
153
|
-
declare function getMercureTopicOrigin(): string | undefined;
|
|
144
|
+
export declare function getCoreCurrency(): string | undefined;
|
|
145
|
+
export declare function getMercureTopicOrigin(): string | undefined;
|
|
154
146
|
interface CoreConfigProviderProps {
|
|
155
147
|
locale: string;
|
|
156
148
|
timezone: string;
|
|
@@ -162,10 +154,8 @@ interface CoreConfigProviderProps {
|
|
|
162
154
|
mercureTenantId?: number | string;
|
|
163
155
|
children: React.ReactNode;
|
|
164
156
|
}
|
|
165
|
-
declare const CoreConfigProvider: ({ locale, timezone, apiBaseUrl, currency, mercureTopicOrigin, mercureTenantId, children }: CoreConfigProviderProps) => React.JSX.Element;
|
|
166
|
-
declare function useCoreConfig(): CoreConfig;
|
|
167
|
-
//#endregion
|
|
168
|
-
//#region packages/core/event/EventHook.d.ts
|
|
157
|
+
export declare const CoreConfigProvider: ({ locale, timezone, apiBaseUrl, currency, mercureTopicOrigin, mercureTenantId, children }: CoreConfigProviderProps) => React.JSX.Element;
|
|
158
|
+
export declare function useCoreConfig(): CoreConfig;
|
|
169
159
|
type Unsubscribe = () => void;
|
|
170
160
|
/** Minimal subscription token — compatible with RxJS Subscription.unsubscribe() call-sites */
|
|
171
161
|
interface EventSubscription {
|
|
@@ -173,10 +163,8 @@ interface EventSubscription {
|
|
|
173
163
|
/** Convenience alias used by some call-sites via .add() — no-op, kept for compat */
|
|
174
164
|
add: (teardown: Unsubscribe) => EventSubscription;
|
|
175
165
|
}
|
|
176
|
-
declare const useEvents: () => readonly [<T>(name: string, handler: (payload: T) => void) => EventSubscription, <T>(name: string, payload?: T) => void];
|
|
177
|
-
declare const dispatch: <T>(name: string, payload?: T) => void;
|
|
178
|
-
//#endregion
|
|
179
|
-
//#region packages/core/event/createCrudEvents.d.ts
|
|
166
|
+
export declare const useEvents: () => readonly [<T>(name: string, handler: (payload: T) => void) => EventSubscription, <T>(name: string, payload?: T) => void];
|
|
167
|
+
export declare const dispatch: <T>(name: string, payload?: T) => void;
|
|
180
168
|
/**
|
|
181
169
|
* Generic factory that builds a typed set of CRUD event name strings for a
|
|
182
170
|
* given `prefix`. The returned object is `const`-asserted so every value is
|
|
@@ -191,7 +179,7 @@ declare const dispatch: <T>(name: string, payload?: T) => void;
|
|
|
191
179
|
* const productEvents = createCrudEvents('product');
|
|
192
180
|
* // productEvents.ADD === 'product:add'
|
|
193
181
|
*/
|
|
194
|
-
declare const createCrudEvents: <TPrefix extends string>(prefix: TPrefix) => {
|
|
182
|
+
export declare const createCrudEvents: <TPrefix extends string>(prefix: TPrefix) => {
|
|
195
183
|
readonly ADD: `${TPrefix}:add`;
|
|
196
184
|
readonly EDIT: `${TPrefix}:edit`;
|
|
197
185
|
readonly DELETE: `${TPrefix}:delete`;
|
|
@@ -200,8 +188,6 @@ declare const createCrudEvents: <TPrefix extends string>(prefix: TPrefix) => {
|
|
|
200
188
|
readonly SUCCESS: `${TPrefix}:success`;
|
|
201
189
|
readonly LOADING: `${TPrefix}:loading`;
|
|
202
190
|
};
|
|
203
|
-
//#endregion
|
|
204
|
-
//#region packages/core/event/EventTypes.d.ts
|
|
205
191
|
/**
|
|
206
192
|
* Typed event name interfaces for core components.
|
|
207
193
|
* Each field is optional — only declare the events your feature uses.
|
|
@@ -242,8 +228,6 @@ interface ToolbarButtonItem {
|
|
|
242
228
|
disabled?: boolean;
|
|
243
229
|
visible?: boolean;
|
|
244
230
|
}
|
|
245
|
-
//#endregion
|
|
246
|
-
//#region packages/core/event/createScopedEventBus.d.ts
|
|
247
231
|
/**
|
|
248
232
|
* A `FormEventNames` object whose event strings are namespaced with a
|
|
249
233
|
* per-instance scope ID to prevent cross-component event leakage.
|
|
@@ -265,9 +249,7 @@ type ScopedFormEventNames = FormEventNames & {
|
|
|
265
249
|
* @param resourceId - The resource id (e.g. `'product'`).
|
|
266
250
|
* @returns A `ScopedFormEventNames` object with a stable `_scopeId` tag.
|
|
267
251
|
*/
|
|
268
|
-
declare function createScopedEventBus(resourceId: string): ScopedFormEventNames;
|
|
269
|
-
//#endregion
|
|
270
|
-
//#region packages/core/i18n/CoreTranslationKeys.d.ts
|
|
252
|
+
export declare function createScopedEventBus(resourceId: string): ScopedFormEventNames;
|
|
271
253
|
interface CoreTranslationKeys {
|
|
272
254
|
'crudPage.selectedCount': string;
|
|
273
255
|
'crudPage.auditTrailButton': string;
|
|
@@ -450,20 +432,12 @@ interface CoreTranslationKeys {
|
|
|
450
432
|
'import.numberFormatComma': string;
|
|
451
433
|
'import.failed': string;
|
|
452
434
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
declare
|
|
456
|
-
|
|
457
|
-
//#endregion
|
|
458
|
-
//#region packages/core/i18n/useCoreTranslation.d.ts
|
|
459
|
-
declare function useCoreTranslation(): {
|
|
460
|
-
t: (key: keyof CoreTranslationKeys, options?: DataRecord) => string;
|
|
435
|
+
export declare const coreTranslationsEs: CoreTranslationKeys;
|
|
436
|
+
export declare const coreTranslationsEn: CoreTranslationKeys;
|
|
437
|
+
export declare function useCoreTranslation(): {
|
|
438
|
+
t: (key: keyof CoreTranslationKeys, options?: TOptions) => string;
|
|
461
439
|
};
|
|
462
|
-
|
|
463
|
-
//#region packages/core/i18n/initCoreI18n.d.ts
|
|
464
|
-
declare function initCoreI18n(): void;
|
|
465
|
-
//#endregion
|
|
466
|
-
//#region packages/core/http/CoreHttpClient.d.ts
|
|
440
|
+
export declare function initCoreI18n(): void;
|
|
467
441
|
type CoreResponseType = 'json' | 'arraybuffer' | 'blob' | 'text';
|
|
468
442
|
interface CoreRequestConfig {
|
|
469
443
|
params?: DataRecord;
|
|
@@ -496,9 +470,9 @@ interface CoreHttpError extends Error {
|
|
|
496
470
|
correlationId?: string;
|
|
497
471
|
}
|
|
498
472
|
/** Default value of {@link CoreHttpClientConfig.csrfHeaderName}. */
|
|
499
|
-
declare const DEFAULT_CSRF_HEADER_NAME = "X-CSRF-Token";
|
|
473
|
+
export declare const DEFAULT_CSRF_HEADER_NAME = "X-CSRF-Token";
|
|
500
474
|
/** Default value of {@link CoreHttpClientConfig.correlationIdHeaderName}. */
|
|
501
|
-
declare const DEFAULT_CORRELATION_ID_HEADER_NAME = "X-Request-Id";
|
|
475
|
+
export declare const DEFAULT_CORRELATION_ID_HEADER_NAME = "X-Request-Id";
|
|
502
476
|
interface CoreHttpClientConfig {
|
|
503
477
|
baseUrl?: string;
|
|
504
478
|
credentials?: RequestCredentials;
|
|
@@ -604,7 +578,7 @@ interface CoreHttpClientConfig {
|
|
|
604
578
|
*/
|
|
605
579
|
getCorrelationId?: () => string;
|
|
606
580
|
}
|
|
607
|
-
declare class CoreHttpClient {
|
|
581
|
+
export declare class CoreHttpClient {
|
|
608
582
|
private readonly config;
|
|
609
583
|
private refreshPromise;
|
|
610
584
|
constructor(config?: CoreHttpClientConfig);
|
|
@@ -638,18 +612,14 @@ declare class CoreHttpClient {
|
|
|
638
612
|
patch<T>(url: string, data?: unknown, config?: CoreRequestConfig): Promise<CoreHttpResponse<T>>;
|
|
639
613
|
delete<T>(url: string, config?: CoreRequestConfig): Promise<CoreHttpResponse<T>>;
|
|
640
614
|
}
|
|
641
|
-
declare function createCoreHttpClient(config?: CoreHttpClientConfig): CoreHttpClient;
|
|
642
|
-
//#endregion
|
|
643
|
-
//#region packages/core/http/CoreHttpContext.d.ts
|
|
615
|
+
export declare function createCoreHttpClient(config?: CoreHttpClientConfig): CoreHttpClient;
|
|
644
616
|
interface CoreHttpProviderProps {
|
|
645
617
|
children: React.ReactNode;
|
|
646
618
|
client?: CoreHttpClient;
|
|
647
619
|
config?: CoreHttpClientConfig;
|
|
648
620
|
}
|
|
649
|
-
declare function CoreHttpProvider({ children, client, config }: CoreHttpProviderProps): React.JSX.Element;
|
|
650
|
-
declare function useCoreHttpClient(): CoreHttpClient;
|
|
651
|
-
//#endregion
|
|
652
|
-
//#region packages/core/http/correlationId.d.ts
|
|
621
|
+
export declare function CoreHttpProvider({ children, client, config }: CoreHttpProviderProps): React.JSX.Element;
|
|
622
|
+
export declare function useCoreHttpClient(): CoreHttpClient;
|
|
653
623
|
/**
|
|
654
624
|
* Generates a client-side correlation id for one logical HTTP request.
|
|
655
625
|
*
|
|
@@ -664,11 +634,9 @@ declare function useCoreHttpClient(): CoreHttpClient;
|
|
|
664
634
|
* `CoreHttpClientConfig.getCorrelationId` (or `CoreRequestConfig.headers`)
|
|
665
635
|
* so the id logged in the offline queue matches the one the backend sees.
|
|
666
636
|
*/
|
|
667
|
-
declare function generateCorrelationId(): string;
|
|
668
|
-
//#endregion
|
|
669
|
-
//#region packages/core/http/csrf.d.ts
|
|
637
|
+
export declare function generateCorrelationId(): string;
|
|
670
638
|
/** Name of the cookie the Nubit backend sets for the double-submit CSRF policy. */
|
|
671
|
-
declare const CSRF_COOKIE_NAME = "CSRF_TOKEN";
|
|
639
|
+
export declare const CSRF_COOKIE_NAME = "CSRF_TOKEN";
|
|
672
640
|
/**
|
|
673
641
|
* Reads the double-submit CSRF token from `document.cookie`.
|
|
674
642
|
*
|
|
@@ -677,9 +645,7 @@ declare const CSRF_COOKIE_NAME = "CSRF_TOKEN";
|
|
|
677
645
|
* back in the `X-CSRF-Token` header. Returns `undefined` outside a browser or
|
|
678
646
|
* before login has issued the cookie.
|
|
679
647
|
*/
|
|
680
|
-
declare function readCsrfToken(cookieName?: string): string | undefined;
|
|
681
|
-
//#endregion
|
|
682
|
-
//#region packages/core/runtime/CoreRuntimeContext.d.ts
|
|
648
|
+
export declare function readCsrfToken(cookieName?: string): string | undefined;
|
|
683
649
|
type CoreNotificationType = 'success' | 'error' | 'warning' | 'info';
|
|
684
650
|
interface CoreRuntime {
|
|
685
651
|
notify: (message: string, type?: CoreNotificationType, durationMs?: number) => void;
|
|
@@ -689,19 +655,15 @@ interface CoreRuntimeProviderProps {
|
|
|
689
655
|
children: React.ReactNode;
|
|
690
656
|
runtime?: Partial<CoreRuntime>;
|
|
691
657
|
}
|
|
692
|
-
declare function CoreRuntimeProvider({ children, runtime }: CoreRuntimeProviderProps): React.JSX.Element;
|
|
693
|
-
declare function useCoreRuntime(): CoreRuntime;
|
|
694
|
-
//#endregion
|
|
695
|
-
//#region packages/core/provider/CoreProvider.d.ts
|
|
658
|
+
export declare function CoreRuntimeProvider({ children, runtime }: CoreRuntimeProviderProps): React.JSX.Element;
|
|
659
|
+
export declare function useCoreRuntime(): CoreRuntime;
|
|
696
660
|
interface CoreProviderProps {
|
|
697
661
|
children: React.ReactNode;
|
|
698
662
|
http?: CoreHttpClientConfig;
|
|
699
663
|
httpClient?: CoreHttpClient;
|
|
700
664
|
runtime?: Partial<CoreRuntime>;
|
|
701
665
|
}
|
|
702
|
-
declare function CoreProvider({ children, http, httpClient, runtime }: CoreProviderProps): React.JSX.Element;
|
|
703
|
-
//#endregion
|
|
704
|
-
//#region packages/core/featureFlags/FeatureFlags.d.ts
|
|
666
|
+
export declare function CoreProvider({ children, http, httpClient, runtime }: CoreProviderProps): React.JSX.Element;
|
|
705
667
|
interface FeatureFlagEvaluationContext {
|
|
706
668
|
targetingKey?: string;
|
|
707
669
|
tenantId?: number;
|
|
@@ -715,7 +677,7 @@ interface FeatureFlagClient {
|
|
|
715
677
|
getNumberValue(key: string, defaultValue: number): number;
|
|
716
678
|
getObjectValue<T extends object>(key: string, defaultValue: T): T;
|
|
717
679
|
}
|
|
718
|
-
declare class StaticFeatureFlagClient implements FeatureFlagClient {
|
|
680
|
+
export declare class StaticFeatureFlagClient implements FeatureFlagClient {
|
|
719
681
|
private readonly flags;
|
|
720
682
|
readonly context: FeatureFlagEvaluationContext;
|
|
721
683
|
constructor(flags?: FeatureFlagValues, context?: FeatureFlagEvaluationContext);
|
|
@@ -730,14 +692,12 @@ interface FeatureFlagsProviderProps {
|
|
|
730
692
|
flags?: FeatureFlagValues;
|
|
731
693
|
context?: FeatureFlagEvaluationContext;
|
|
732
694
|
}
|
|
733
|
-
declare function FeatureFlagsProvider({ children, client, flags, context }: FeatureFlagsProviderProps): React.JSX.Element;
|
|
734
|
-
declare function useFeatureFlags(): FeatureFlagClient;
|
|
735
|
-
declare function useBooleanFlag(key: string, defaultValue?: boolean): boolean;
|
|
736
|
-
declare function useStringFlag(key: string, defaultValue?: string): string;
|
|
737
|
-
declare function useNumberFlag(key: string, defaultValue?: number): number;
|
|
738
|
-
declare function useObjectFlag<T extends object>(key: string, defaultValue: T): T;
|
|
739
|
-
//#endregion
|
|
740
|
-
//#region packages/core/mercure/MercureProvider.d.ts
|
|
695
|
+
export declare function FeatureFlagsProvider({ children, client, flags, context }: FeatureFlagsProviderProps): React.JSX.Element;
|
|
696
|
+
export declare function useFeatureFlags(): FeatureFlagClient;
|
|
697
|
+
export declare function useBooleanFlag(key: string, defaultValue?: boolean): boolean;
|
|
698
|
+
export declare function useStringFlag(key: string, defaultValue?: string): string;
|
|
699
|
+
export declare function useNumberFlag(key: string, defaultValue?: number): number;
|
|
700
|
+
export declare function useObjectFlag<T extends object>(key: string, defaultValue: T): T;
|
|
741
701
|
interface MercureProviderProps {
|
|
742
702
|
/**
|
|
743
703
|
* Hub URL override. When omitted, the provider listens to autodiscovery
|
|
@@ -750,9 +710,7 @@ interface MercureProviderProps {
|
|
|
750
710
|
* Provides the Mercure hub URL to the React tree and keeps `MercureManager`
|
|
751
711
|
* in sync whenever the URL changes.
|
|
752
712
|
*/
|
|
753
|
-
declare function MercureProvider({ hubUrl: hubUrlOverride, children }: MercureProviderProps): React.JSX.Element;
|
|
754
|
-
//#endregion
|
|
755
|
-
//#region packages/core/mercure/useMercureHub.d.ts
|
|
713
|
+
export declare function MercureProvider({ hubUrl: hubUrlOverride, children }: MercureProviderProps): React.JSX.Element;
|
|
756
714
|
/**
|
|
757
715
|
* useMercureHub — Hook that returns the Mercure hub URL from context.
|
|
758
716
|
*
|
|
@@ -776,9 +734,7 @@ declare function MercureProvider({ hubUrl: hubUrlOverride, children }: MercurePr
|
|
|
776
734
|
* Returns the Mercure hub URL from the nearest `<MercureProvider>`,
|
|
777
735
|
* or `null` if the hub is not available.
|
|
778
736
|
*/
|
|
779
|
-
declare function useMercureHub(): string | null;
|
|
780
|
-
//#endregion
|
|
781
|
-
//#region packages/core/mercure/useMercureSubscription.d.ts
|
|
737
|
+
export declare function useMercureHub(): string | null;
|
|
782
738
|
/**
|
|
783
739
|
* useMercureSubscription — Hook that subscribes to a Mercure topic and calls
|
|
784
740
|
* a callback whenever an SSE message is received for that topic.
|
|
@@ -807,9 +763,7 @@ declare function useMercureHub(): string | null;
|
|
|
807
763
|
* @param onUpdate Callback invoked on every SSE message for the topic.
|
|
808
764
|
* @param enabled When false, the subscription is skipped entirely. Defaults to true.
|
|
809
765
|
*/
|
|
810
|
-
declare function useMercureSubscription(apiUrl: string | undefined, onUpdate: () => void, enabled?: boolean): void;
|
|
811
|
-
//#endregion
|
|
812
|
-
//#region packages/core/mercure/mercureTopics.d.ts
|
|
766
|
+
export declare function useMercureSubscription(apiUrl: string | undefined, onUpdate: () => void, enabled?: boolean): void;
|
|
813
767
|
/**
|
|
814
768
|
* Resolves the origin used to build Mercure collection topic URIs.
|
|
815
769
|
*
|
|
@@ -819,14 +773,12 @@ declare function useMercureSubscription(apiUrl: string | undefined, onUpdate: ()
|
|
|
819
773
|
* from absolute Hydra `@id` values on API responses. Set `mercureTopicOrigin`
|
|
820
774
|
* on CoreConfig only when autodiscovery cannot infer the correct origin.
|
|
821
775
|
*/
|
|
822
|
-
declare function resolveMercureTopicOrigin(apiBaseUrl?: string, configuredOrigin?: string, discoveredOrigin?: string | undefined): string;
|
|
776
|
+
export declare function resolveMercureTopicOrigin(apiBaseUrl?: string, configuredOrigin?: string, discoveredOrigin?: string | undefined): string;
|
|
823
777
|
/**
|
|
824
778
|
* Wildcard collection topic (WHATWG URL Pattern) for a resource API path.
|
|
825
779
|
* e.g. `/api/products` → `http://localhost:8000/api/products/*`
|
|
826
780
|
*/
|
|
827
|
-
declare function buildMercureCollectionTopic(apiUrl: string, configuredOrigin?: string, apiBaseUrl?: string): string | null;
|
|
828
|
-
//#endregion
|
|
829
|
-
//#region packages/core/mercure/mercureDiscovery.d.ts
|
|
781
|
+
export declare function buildMercureCollectionTopic(apiUrl: string, configuredOrigin?: string, apiBaseUrl?: string): string | null;
|
|
830
782
|
/** Parsed RFC 8288 Link header entry. */
|
|
831
783
|
interface ParsedLink {
|
|
832
784
|
url: string;
|
|
@@ -836,32 +788,28 @@ interface ParsedLink {
|
|
|
836
788
|
* Parse a `Link` response header value into `{ url, rel }` pairs.
|
|
837
789
|
* Handles API Platform's `</.well-known/mercure>; rel="mercure"` format.
|
|
838
790
|
*/
|
|
839
|
-
declare function parseLinkHeader(header: string): ParsedLink[];
|
|
791
|
+
export declare function parseLinkHeader(header: string): ParsedLink[];
|
|
840
792
|
/**
|
|
841
793
|
* Extract the Mercure hub URL from response headers, if present.
|
|
842
794
|
* Relative URLs are resolved against the request URL.
|
|
843
795
|
*/
|
|
844
|
-
declare function extractMercureHubUrl(headers: Headers, responseUrl: string): string | null;
|
|
796
|
+
export declare function extractMercureHubUrl(headers: Headers, responseUrl: string): string | null;
|
|
845
797
|
/**
|
|
846
798
|
* Infer the API origin from Hydra `@id` values (entrypoint or collection items).
|
|
847
799
|
* API Platform publishes absolute IRIs when `DEFAULT_URI` is configured.
|
|
848
800
|
*/
|
|
849
|
-
declare function extractTopicOriginFromPayload(data: unknown): string | null;
|
|
850
|
-
declare function getDiscoveredMercureTopicOrigin(): string | undefined;
|
|
801
|
+
export declare function extractTopicOriginFromPayload(data: unknown): string | null;
|
|
802
|
+
export declare function getDiscoveredMercureTopicOrigin(): string | undefined;
|
|
851
803
|
/**
|
|
852
804
|
* Inspect an API response and update Mercure hub URL / topic origin when found.
|
|
853
805
|
* Called from `CoreHttpClient` on every successful response.
|
|
854
806
|
*/
|
|
855
|
-
declare function discoverMercureFromResponse(response: Response, data: unknown): void;
|
|
856
|
-
//#endregion
|
|
857
|
-
//#region packages/core/mercure/useDiscoveredMercureTopicOrigin.d.ts
|
|
807
|
+
export declare function discoverMercureFromResponse(response: Response, data: unknown): void;
|
|
858
808
|
/**
|
|
859
809
|
* Returns the Mercure topic origin autodiscovered from Hydra `@id` IRIs.
|
|
860
810
|
* Re-renders when a new origin is discovered from a subsequent API response.
|
|
861
811
|
*/
|
|
862
|
-
declare function useDiscoveredMercureTopicOrigin(): string | undefined;
|
|
863
|
-
//#endregion
|
|
864
|
-
//#region packages/core/mercure/MercureManager.d.ts
|
|
812
|
+
export declare function useDiscoveredMercureTopicOrigin(): string | undefined;
|
|
865
813
|
/**
|
|
866
814
|
* MercureManager — Singleton that manages the lifecycle of EventSource connections.
|
|
867
815
|
*
|
|
@@ -924,5 +872,4 @@ declare class MercureManager {
|
|
|
924
872
|
}
|
|
925
873
|
/** Singleton instance — shared across the entire application. */
|
|
926
874
|
declare const mercureManager: MercureManager;
|
|
927
|
-
|
|
928
|
-
export { CSRF_COOKIE_NAME, 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_CORRELATION_ID_HEADER_NAME, DEFAULT_CSRF_HEADER_NAME, 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, generateCorrelationId, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, getDiscoveredMercureTopicOrigin, getMercureTopicOrigin, initCoreI18n, isMoneyValue, parseLinkHeader, parseMoney, parseMoneyInput, readCsrfToken, resolveMercureTopicOrigin, sumMoney, toMinorUnits, useBooleanFlag, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useDiscoveredMercureTopicOrigin, useEvents, useFeatureFlags, useMercureHub, useMercureSubscription, useNumberFlag, useObjectFlag, useStringFlag };
|
|
875
|
+
export { type CoreConfig, type CoreConfigProviderProps, type CoreHttpClientConfig, type CoreHttpError, type CoreHttpErrorData, type CoreHttpProviderProps, type CoreHttpResponse, type CoreNotificationType, type CoreProviderProps, type CoreRequestConfig, type CoreResponseType, type CoreRuntime, type CoreRuntimeProviderProps, type CoreTranslationKeys, type DataGridEventNames, type DataRecord, type DialogEventNames, type EventSubscription, type FeatureFlagClient, type FeatureFlagEvaluationContext, type FeatureFlagValues, type FeatureFlagsProviderProps, type FormEventNames, type FormatMoneyOptions, type GridData, mercureManager as MercureManager, type MercureManager as MercureManagerType, type MercureProviderProps, type MoneyValue, type ScopedFormEventNames, type ToolbarButtonItem };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
|
|
2
|
+
import { TOptions } from "i18next";
|
|
3
3
|
type DataRecord = Record<string, unknown>;
|
|
4
|
-
//#endregion
|
|
5
|
-
//#region packages/core/data/GridData.d.ts
|
|
6
4
|
interface GridData<T> {
|
|
7
5
|
data: T[];
|
|
8
6
|
totalCount: number;
|
|
@@ -27,14 +25,12 @@ interface GridData<T> {
|
|
|
27
25
|
*/
|
|
28
26
|
nextPageUrl?: string | null;
|
|
29
27
|
}
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region packages/core/date/DateUtils.d.ts
|
|
32
28
|
/**
|
|
33
29
|
* Recommended default for new projects using @nubitio/core.
|
|
34
30
|
* You should almost always override this via CoreConfigProvider.
|
|
35
31
|
*/
|
|
36
|
-
declare const DEFAULT_TIMEZONE = "UTC";
|
|
37
|
-
declare class DateUtils {
|
|
32
|
+
export declare const DEFAULT_TIMEZONE = "UTC";
|
|
33
|
+
export declare class DateUtils {
|
|
38
34
|
static dateFormatter(date: Date): string;
|
|
39
35
|
static dateParser(dateString: string): Date;
|
|
40
36
|
static format(dateString: string, formatOptions?: Intl.DateTimeFormatOptions): string;
|
|
@@ -44,8 +40,6 @@ declare class DateUtils {
|
|
|
44
40
|
static dayDiff(startDate: string | number | Date, endDate: string | number | Date): number;
|
|
45
41
|
static monthDiff(startDate: string | number | Date, endDate: string | number | Date): number;
|
|
46
42
|
}
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region packages/core/money/Money.d.ts
|
|
49
43
|
/**
|
|
50
44
|
* A monetary amount as the API publishes it.
|
|
51
45
|
*
|
|
@@ -71,13 +65,13 @@ interface MoneyValue {
|
|
|
71
65
|
* Returns null rather than throwing for anything unrecognised: a grid renders
|
|
72
66
|
* thousands of cells, and one malformed row must not take the page down.
|
|
73
67
|
*/
|
|
74
|
-
declare function parseMoney(raw: unknown): MoneyValue | null;
|
|
75
|
-
declare function isMoneyValue(raw: unknown): raw is MoneyValue;
|
|
68
|
+
export declare function parseMoney(raw: unknown): MoneyValue | null;
|
|
69
|
+
export declare function isMoneyValue(raw: unknown): raw is MoneyValue;
|
|
76
70
|
/** Exact minor units, computed from the decimal string rather than trusted from the wire. */
|
|
77
|
-
declare function toMinorUnits(value: MoneyValue): bigint;
|
|
78
|
-
declare function fromMinorUnits(minor: bigint, currency: string, scale: number): MoneyValue;
|
|
71
|
+
export declare function toMinorUnits(value: MoneyValue): bigint;
|
|
72
|
+
export declare function fromMinorUnits(minor: bigint, currency: string, scale: number): MoneyValue;
|
|
79
73
|
/** Renders an exact integer count of minor units as a decimal literal. */
|
|
80
|
-
declare function formatMinorUnits(minor: bigint, scale: number): string;
|
|
74
|
+
export declare function formatMinorUnits(minor: bigint, scale: number): string;
|
|
81
75
|
/**
|
|
82
76
|
* Adds a list of amounts exactly.
|
|
83
77
|
*
|
|
@@ -85,7 +79,7 @@ declare function formatMinorUnits(minor: bigint, scale: number): string;
|
|
|
85
79
|
* adds euros to dollars is worse than one that shows nothing, because it looks
|
|
86
80
|
* right.
|
|
87
81
|
*/
|
|
88
|
-
declare function sumMoney(values: readonly MoneyValue[]): MoneyValue | null;
|
|
82
|
+
export declare function sumMoney(values: readonly MoneyValue[]): MoneyValue | null;
|
|
89
83
|
interface FormatMoneyOptions {
|
|
90
84
|
locale?: string;
|
|
91
85
|
/** Show the currency symbol or code. Off for grid cells, on for totals. */
|
|
@@ -98,7 +92,7 @@ interface FormatMoneyOptions {
|
|
|
98
92
|
* would round the value before it is ever shown — the one place where the drift
|
|
99
93
|
* would be visible and blamed on the database.
|
|
100
94
|
*/
|
|
101
|
-
declare function formatMoney(value: MoneyValue | null | undefined, options?: FormatMoneyOptions): string;
|
|
95
|
+
export declare function formatMoney(value: MoneyValue | null | undefined, options?: FormatMoneyOptions): string;
|
|
102
96
|
/**
|
|
103
97
|
* Turns what a user typed into an amount.
|
|
104
98
|
*
|
|
@@ -108,15 +102,13 @@ declare function formatMoney(value: MoneyValue | null | undefined, options?: For
|
|
|
108
102
|
* the currency has — silently dropping a digit the user typed would change the
|
|
109
103
|
* value they think they entered.
|
|
110
104
|
*/
|
|
111
|
-
declare function parseMoneyInput(text: string, currency: string, scale: number, locale?: string): {
|
|
105
|
+
export declare function parseMoneyInput(text: string, currency: string, scale: number, locale?: string): {
|
|
112
106
|
ok: true;
|
|
113
107
|
value: MoneyValue;
|
|
114
108
|
} | {
|
|
115
109
|
ok: false;
|
|
116
110
|
reason: 'invalid' | 'too-precise';
|
|
117
111
|
};
|
|
118
|
-
//#endregion
|
|
119
|
-
//#region packages/core/config/CoreConfig.d.ts
|
|
120
112
|
interface CoreConfig {
|
|
121
113
|
locale: string;
|
|
122
114
|
timezone: string;
|
|
@@ -140,17 +132,17 @@ interface CoreConfig {
|
|
|
140
132
|
* This updates the module-level singleton so it can be read from non-React code
|
|
141
133
|
* (e.g. inside defineResource, entityField builders, DateUtils, etc.).
|
|
142
134
|
*/
|
|
143
|
-
declare function configureCore(config: Partial<CoreConfig>): void;
|
|
135
|
+
export declare function configureCore(config: Partial<CoreConfig>): void;
|
|
144
136
|
/**
|
|
145
137
|
* @deprecated Use configureCore() instead.
|
|
146
138
|
*/
|
|
147
|
-
declare const configureCoreDate: typeof configureCore;
|
|
148
|
-
declare function getCoreLocale(): string;
|
|
149
|
-
declare function getCoreTimezone(): string;
|
|
150
|
-
declare function getCoreApiBaseUrl(): string;
|
|
139
|
+
export declare const configureCoreDate: typeof configureCore;
|
|
140
|
+
export declare function getCoreLocale(): string;
|
|
141
|
+
export declare function getCoreTimezone(): string;
|
|
142
|
+
export declare function getCoreApiBaseUrl(): string;
|
|
151
143
|
/** App-wide default currency (ISO 4217), or undefined when not configured. */
|
|
152
|
-
declare function getCoreCurrency(): string | undefined;
|
|
153
|
-
declare function getMercureTopicOrigin(): string | undefined;
|
|
144
|
+
export declare function getCoreCurrency(): string | undefined;
|
|
145
|
+
export declare function getMercureTopicOrigin(): string | undefined;
|
|
154
146
|
interface CoreConfigProviderProps {
|
|
155
147
|
locale: string;
|
|
156
148
|
timezone: string;
|
|
@@ -162,10 +154,8 @@ interface CoreConfigProviderProps {
|
|
|
162
154
|
mercureTenantId?: number | string;
|
|
163
155
|
children: React.ReactNode;
|
|
164
156
|
}
|
|
165
|
-
declare const CoreConfigProvider: ({ locale, timezone, apiBaseUrl, currency, mercureTopicOrigin, mercureTenantId, children }: CoreConfigProviderProps) => React.JSX.Element;
|
|
166
|
-
declare function useCoreConfig(): CoreConfig;
|
|
167
|
-
//#endregion
|
|
168
|
-
//#region packages/core/event/EventHook.d.ts
|
|
157
|
+
export declare const CoreConfigProvider: ({ locale, timezone, apiBaseUrl, currency, mercureTopicOrigin, mercureTenantId, children }: CoreConfigProviderProps) => React.JSX.Element;
|
|
158
|
+
export declare function useCoreConfig(): CoreConfig;
|
|
169
159
|
type Unsubscribe = () => void;
|
|
170
160
|
/** Minimal subscription token — compatible with RxJS Subscription.unsubscribe() call-sites */
|
|
171
161
|
interface EventSubscription {
|
|
@@ -173,10 +163,8 @@ interface EventSubscription {
|
|
|
173
163
|
/** Convenience alias used by some call-sites via .add() — no-op, kept for compat */
|
|
174
164
|
add: (teardown: Unsubscribe) => EventSubscription;
|
|
175
165
|
}
|
|
176
|
-
declare const useEvents: () => readonly [<T>(name: string, handler: (payload: T) => void) => EventSubscription, <T>(name: string, payload?: T) => void];
|
|
177
|
-
declare const dispatch: <T>(name: string, payload?: T) => void;
|
|
178
|
-
//#endregion
|
|
179
|
-
//#region packages/core/event/createCrudEvents.d.ts
|
|
166
|
+
export declare const useEvents: () => readonly [<T>(name: string, handler: (payload: T) => void) => EventSubscription, <T>(name: string, payload?: T) => void];
|
|
167
|
+
export declare const dispatch: <T>(name: string, payload?: T) => void;
|
|
180
168
|
/**
|
|
181
169
|
* Generic factory that builds a typed set of CRUD event name strings for a
|
|
182
170
|
* given `prefix`. The returned object is `const`-asserted so every value is
|
|
@@ -191,7 +179,7 @@ declare const dispatch: <T>(name: string, payload?: T) => void;
|
|
|
191
179
|
* const productEvents = createCrudEvents('product');
|
|
192
180
|
* // productEvents.ADD === 'product:add'
|
|
193
181
|
*/
|
|
194
|
-
declare const createCrudEvents: <TPrefix extends string>(prefix: TPrefix) => {
|
|
182
|
+
export declare const createCrudEvents: <TPrefix extends string>(prefix: TPrefix) => {
|
|
195
183
|
readonly ADD: `${TPrefix}:add`;
|
|
196
184
|
readonly EDIT: `${TPrefix}:edit`;
|
|
197
185
|
readonly DELETE: `${TPrefix}:delete`;
|
|
@@ -200,8 +188,6 @@ declare const createCrudEvents: <TPrefix extends string>(prefix: TPrefix) => {
|
|
|
200
188
|
readonly SUCCESS: `${TPrefix}:success`;
|
|
201
189
|
readonly LOADING: `${TPrefix}:loading`;
|
|
202
190
|
};
|
|
203
|
-
//#endregion
|
|
204
|
-
//#region packages/core/event/EventTypes.d.ts
|
|
205
191
|
/**
|
|
206
192
|
* Typed event name interfaces for core components.
|
|
207
193
|
* Each field is optional — only declare the events your feature uses.
|
|
@@ -242,8 +228,6 @@ interface ToolbarButtonItem {
|
|
|
242
228
|
disabled?: boolean;
|
|
243
229
|
visible?: boolean;
|
|
244
230
|
}
|
|
245
|
-
//#endregion
|
|
246
|
-
//#region packages/core/event/createScopedEventBus.d.ts
|
|
247
231
|
/**
|
|
248
232
|
* A `FormEventNames` object whose event strings are namespaced with a
|
|
249
233
|
* per-instance scope ID to prevent cross-component event leakage.
|
|
@@ -265,9 +249,7 @@ type ScopedFormEventNames = FormEventNames & {
|
|
|
265
249
|
* @param resourceId - The resource id (e.g. `'product'`).
|
|
266
250
|
* @returns A `ScopedFormEventNames` object with a stable `_scopeId` tag.
|
|
267
251
|
*/
|
|
268
|
-
declare function createScopedEventBus(resourceId: string): ScopedFormEventNames;
|
|
269
|
-
//#endregion
|
|
270
|
-
//#region packages/core/i18n/CoreTranslationKeys.d.ts
|
|
252
|
+
export declare function createScopedEventBus(resourceId: string): ScopedFormEventNames;
|
|
271
253
|
interface CoreTranslationKeys {
|
|
272
254
|
'crudPage.selectedCount': string;
|
|
273
255
|
'crudPage.auditTrailButton': string;
|
|
@@ -450,20 +432,12 @@ interface CoreTranslationKeys {
|
|
|
450
432
|
'import.numberFormatComma': string;
|
|
451
433
|
'import.failed': string;
|
|
452
434
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
declare
|
|
456
|
-
|
|
457
|
-
//#endregion
|
|
458
|
-
//#region packages/core/i18n/useCoreTranslation.d.ts
|
|
459
|
-
declare function useCoreTranslation(): {
|
|
460
|
-
t: (key: keyof CoreTranslationKeys, options?: DataRecord) => string;
|
|
435
|
+
export declare const coreTranslationsEs: CoreTranslationKeys;
|
|
436
|
+
export declare const coreTranslationsEn: CoreTranslationKeys;
|
|
437
|
+
export declare function useCoreTranslation(): {
|
|
438
|
+
t: (key: keyof CoreTranslationKeys, options?: TOptions) => string;
|
|
461
439
|
};
|
|
462
|
-
|
|
463
|
-
//#region packages/core/i18n/initCoreI18n.d.ts
|
|
464
|
-
declare function initCoreI18n(): void;
|
|
465
|
-
//#endregion
|
|
466
|
-
//#region packages/core/http/CoreHttpClient.d.ts
|
|
440
|
+
export declare function initCoreI18n(): void;
|
|
467
441
|
type CoreResponseType = 'json' | 'arraybuffer' | 'blob' | 'text';
|
|
468
442
|
interface CoreRequestConfig {
|
|
469
443
|
params?: DataRecord;
|
|
@@ -496,9 +470,9 @@ interface CoreHttpError extends Error {
|
|
|
496
470
|
correlationId?: string;
|
|
497
471
|
}
|
|
498
472
|
/** Default value of {@link CoreHttpClientConfig.csrfHeaderName}. */
|
|
499
|
-
declare const DEFAULT_CSRF_HEADER_NAME = "X-CSRF-Token";
|
|
473
|
+
export declare const DEFAULT_CSRF_HEADER_NAME = "X-CSRF-Token";
|
|
500
474
|
/** Default value of {@link CoreHttpClientConfig.correlationIdHeaderName}. */
|
|
501
|
-
declare const DEFAULT_CORRELATION_ID_HEADER_NAME = "X-Request-Id";
|
|
475
|
+
export declare const DEFAULT_CORRELATION_ID_HEADER_NAME = "X-Request-Id";
|
|
502
476
|
interface CoreHttpClientConfig {
|
|
503
477
|
baseUrl?: string;
|
|
504
478
|
credentials?: RequestCredentials;
|
|
@@ -604,7 +578,7 @@ interface CoreHttpClientConfig {
|
|
|
604
578
|
*/
|
|
605
579
|
getCorrelationId?: () => string;
|
|
606
580
|
}
|
|
607
|
-
declare class CoreHttpClient {
|
|
581
|
+
export declare class CoreHttpClient {
|
|
608
582
|
private readonly config;
|
|
609
583
|
private refreshPromise;
|
|
610
584
|
constructor(config?: CoreHttpClientConfig);
|
|
@@ -638,18 +612,14 @@ declare class CoreHttpClient {
|
|
|
638
612
|
patch<T>(url: string, data?: unknown, config?: CoreRequestConfig): Promise<CoreHttpResponse<T>>;
|
|
639
613
|
delete<T>(url: string, config?: CoreRequestConfig): Promise<CoreHttpResponse<T>>;
|
|
640
614
|
}
|
|
641
|
-
declare function createCoreHttpClient(config?: CoreHttpClientConfig): CoreHttpClient;
|
|
642
|
-
//#endregion
|
|
643
|
-
//#region packages/core/http/CoreHttpContext.d.ts
|
|
615
|
+
export declare function createCoreHttpClient(config?: CoreHttpClientConfig): CoreHttpClient;
|
|
644
616
|
interface CoreHttpProviderProps {
|
|
645
617
|
children: React.ReactNode;
|
|
646
618
|
client?: CoreHttpClient;
|
|
647
619
|
config?: CoreHttpClientConfig;
|
|
648
620
|
}
|
|
649
|
-
declare function CoreHttpProvider({ children, client, config }: CoreHttpProviderProps): React.JSX.Element;
|
|
650
|
-
declare function useCoreHttpClient(): CoreHttpClient;
|
|
651
|
-
//#endregion
|
|
652
|
-
//#region packages/core/http/correlationId.d.ts
|
|
621
|
+
export declare function CoreHttpProvider({ children, client, config }: CoreHttpProviderProps): React.JSX.Element;
|
|
622
|
+
export declare function useCoreHttpClient(): CoreHttpClient;
|
|
653
623
|
/**
|
|
654
624
|
* Generates a client-side correlation id for one logical HTTP request.
|
|
655
625
|
*
|
|
@@ -664,11 +634,9 @@ declare function useCoreHttpClient(): CoreHttpClient;
|
|
|
664
634
|
* `CoreHttpClientConfig.getCorrelationId` (or `CoreRequestConfig.headers`)
|
|
665
635
|
* so the id logged in the offline queue matches the one the backend sees.
|
|
666
636
|
*/
|
|
667
|
-
declare function generateCorrelationId(): string;
|
|
668
|
-
//#endregion
|
|
669
|
-
//#region packages/core/http/csrf.d.ts
|
|
637
|
+
export declare function generateCorrelationId(): string;
|
|
670
638
|
/** Name of the cookie the Nubit backend sets for the double-submit CSRF policy. */
|
|
671
|
-
declare const CSRF_COOKIE_NAME = "CSRF_TOKEN";
|
|
639
|
+
export declare const CSRF_COOKIE_NAME = "CSRF_TOKEN";
|
|
672
640
|
/**
|
|
673
641
|
* Reads the double-submit CSRF token from `document.cookie`.
|
|
674
642
|
*
|
|
@@ -677,9 +645,7 @@ declare const CSRF_COOKIE_NAME = "CSRF_TOKEN";
|
|
|
677
645
|
* back in the `X-CSRF-Token` header. Returns `undefined` outside a browser or
|
|
678
646
|
* before login has issued the cookie.
|
|
679
647
|
*/
|
|
680
|
-
declare function readCsrfToken(cookieName?: string): string | undefined;
|
|
681
|
-
//#endregion
|
|
682
|
-
//#region packages/core/runtime/CoreRuntimeContext.d.ts
|
|
648
|
+
export declare function readCsrfToken(cookieName?: string): string | undefined;
|
|
683
649
|
type CoreNotificationType = 'success' | 'error' | 'warning' | 'info';
|
|
684
650
|
interface CoreRuntime {
|
|
685
651
|
notify: (message: string, type?: CoreNotificationType, durationMs?: number) => void;
|
|
@@ -689,19 +655,15 @@ interface CoreRuntimeProviderProps {
|
|
|
689
655
|
children: React.ReactNode;
|
|
690
656
|
runtime?: Partial<CoreRuntime>;
|
|
691
657
|
}
|
|
692
|
-
declare function CoreRuntimeProvider({ children, runtime }: CoreRuntimeProviderProps): React.JSX.Element;
|
|
693
|
-
declare function useCoreRuntime(): CoreRuntime;
|
|
694
|
-
//#endregion
|
|
695
|
-
//#region packages/core/provider/CoreProvider.d.ts
|
|
658
|
+
export declare function CoreRuntimeProvider({ children, runtime }: CoreRuntimeProviderProps): React.JSX.Element;
|
|
659
|
+
export declare function useCoreRuntime(): CoreRuntime;
|
|
696
660
|
interface CoreProviderProps {
|
|
697
661
|
children: React.ReactNode;
|
|
698
662
|
http?: CoreHttpClientConfig;
|
|
699
663
|
httpClient?: CoreHttpClient;
|
|
700
664
|
runtime?: Partial<CoreRuntime>;
|
|
701
665
|
}
|
|
702
|
-
declare function CoreProvider({ children, http, httpClient, runtime }: CoreProviderProps): React.JSX.Element;
|
|
703
|
-
//#endregion
|
|
704
|
-
//#region packages/core/featureFlags/FeatureFlags.d.ts
|
|
666
|
+
export declare function CoreProvider({ children, http, httpClient, runtime }: CoreProviderProps): React.JSX.Element;
|
|
705
667
|
interface FeatureFlagEvaluationContext {
|
|
706
668
|
targetingKey?: string;
|
|
707
669
|
tenantId?: number;
|
|
@@ -715,7 +677,7 @@ interface FeatureFlagClient {
|
|
|
715
677
|
getNumberValue(key: string, defaultValue: number): number;
|
|
716
678
|
getObjectValue<T extends object>(key: string, defaultValue: T): T;
|
|
717
679
|
}
|
|
718
|
-
declare class StaticFeatureFlagClient implements FeatureFlagClient {
|
|
680
|
+
export declare class StaticFeatureFlagClient implements FeatureFlagClient {
|
|
719
681
|
private readonly flags;
|
|
720
682
|
readonly context: FeatureFlagEvaluationContext;
|
|
721
683
|
constructor(flags?: FeatureFlagValues, context?: FeatureFlagEvaluationContext);
|
|
@@ -730,14 +692,12 @@ interface FeatureFlagsProviderProps {
|
|
|
730
692
|
flags?: FeatureFlagValues;
|
|
731
693
|
context?: FeatureFlagEvaluationContext;
|
|
732
694
|
}
|
|
733
|
-
declare function FeatureFlagsProvider({ children, client, flags, context }: FeatureFlagsProviderProps): React.JSX.Element;
|
|
734
|
-
declare function useFeatureFlags(): FeatureFlagClient;
|
|
735
|
-
declare function useBooleanFlag(key: string, defaultValue?: boolean): boolean;
|
|
736
|
-
declare function useStringFlag(key: string, defaultValue?: string): string;
|
|
737
|
-
declare function useNumberFlag(key: string, defaultValue?: number): number;
|
|
738
|
-
declare function useObjectFlag<T extends object>(key: string, defaultValue: T): T;
|
|
739
|
-
//#endregion
|
|
740
|
-
//#region packages/core/mercure/MercureProvider.d.ts
|
|
695
|
+
export declare function FeatureFlagsProvider({ children, client, flags, context }: FeatureFlagsProviderProps): React.JSX.Element;
|
|
696
|
+
export declare function useFeatureFlags(): FeatureFlagClient;
|
|
697
|
+
export declare function useBooleanFlag(key: string, defaultValue?: boolean): boolean;
|
|
698
|
+
export declare function useStringFlag(key: string, defaultValue?: string): string;
|
|
699
|
+
export declare function useNumberFlag(key: string, defaultValue?: number): number;
|
|
700
|
+
export declare function useObjectFlag<T extends object>(key: string, defaultValue: T): T;
|
|
741
701
|
interface MercureProviderProps {
|
|
742
702
|
/**
|
|
743
703
|
* Hub URL override. When omitted, the provider listens to autodiscovery
|
|
@@ -750,9 +710,7 @@ interface MercureProviderProps {
|
|
|
750
710
|
* Provides the Mercure hub URL to the React tree and keeps `MercureManager`
|
|
751
711
|
* in sync whenever the URL changes.
|
|
752
712
|
*/
|
|
753
|
-
declare function MercureProvider({ hubUrl: hubUrlOverride, children }: MercureProviderProps): React.JSX.Element;
|
|
754
|
-
//#endregion
|
|
755
|
-
//#region packages/core/mercure/useMercureHub.d.ts
|
|
713
|
+
export declare function MercureProvider({ hubUrl: hubUrlOverride, children }: MercureProviderProps): React.JSX.Element;
|
|
756
714
|
/**
|
|
757
715
|
* useMercureHub — Hook that returns the Mercure hub URL from context.
|
|
758
716
|
*
|
|
@@ -776,9 +734,7 @@ declare function MercureProvider({ hubUrl: hubUrlOverride, children }: MercurePr
|
|
|
776
734
|
* Returns the Mercure hub URL from the nearest `<MercureProvider>`,
|
|
777
735
|
* or `null` if the hub is not available.
|
|
778
736
|
*/
|
|
779
|
-
declare function useMercureHub(): string | null;
|
|
780
|
-
//#endregion
|
|
781
|
-
//#region packages/core/mercure/useMercureSubscription.d.ts
|
|
737
|
+
export declare function useMercureHub(): string | null;
|
|
782
738
|
/**
|
|
783
739
|
* useMercureSubscription — Hook that subscribes to a Mercure topic and calls
|
|
784
740
|
* a callback whenever an SSE message is received for that topic.
|
|
@@ -807,9 +763,7 @@ declare function useMercureHub(): string | null;
|
|
|
807
763
|
* @param onUpdate Callback invoked on every SSE message for the topic.
|
|
808
764
|
* @param enabled When false, the subscription is skipped entirely. Defaults to true.
|
|
809
765
|
*/
|
|
810
|
-
declare function useMercureSubscription(apiUrl: string | undefined, onUpdate: () => void, enabled?: boolean): void;
|
|
811
|
-
//#endregion
|
|
812
|
-
//#region packages/core/mercure/mercureTopics.d.ts
|
|
766
|
+
export declare function useMercureSubscription(apiUrl: string | undefined, onUpdate: () => void, enabled?: boolean): void;
|
|
813
767
|
/**
|
|
814
768
|
* Resolves the origin used to build Mercure collection topic URIs.
|
|
815
769
|
*
|
|
@@ -819,14 +773,12 @@ declare function useMercureSubscription(apiUrl: string | undefined, onUpdate: ()
|
|
|
819
773
|
* from absolute Hydra `@id` values on API responses. Set `mercureTopicOrigin`
|
|
820
774
|
* on CoreConfig only when autodiscovery cannot infer the correct origin.
|
|
821
775
|
*/
|
|
822
|
-
declare function resolveMercureTopicOrigin(apiBaseUrl?: string, configuredOrigin?: string, discoveredOrigin?: string | undefined): string;
|
|
776
|
+
export declare function resolveMercureTopicOrigin(apiBaseUrl?: string, configuredOrigin?: string, discoveredOrigin?: string | undefined): string;
|
|
823
777
|
/**
|
|
824
778
|
* Wildcard collection topic (WHATWG URL Pattern) for a resource API path.
|
|
825
779
|
* e.g. `/api/products` → `http://localhost:8000/api/products/*`
|
|
826
780
|
*/
|
|
827
|
-
declare function buildMercureCollectionTopic(apiUrl: string, configuredOrigin?: string, apiBaseUrl?: string): string | null;
|
|
828
|
-
//#endregion
|
|
829
|
-
//#region packages/core/mercure/mercureDiscovery.d.ts
|
|
781
|
+
export declare function buildMercureCollectionTopic(apiUrl: string, configuredOrigin?: string, apiBaseUrl?: string): string | null;
|
|
830
782
|
/** Parsed RFC 8288 Link header entry. */
|
|
831
783
|
interface ParsedLink {
|
|
832
784
|
url: string;
|
|
@@ -836,32 +788,28 @@ interface ParsedLink {
|
|
|
836
788
|
* Parse a `Link` response header value into `{ url, rel }` pairs.
|
|
837
789
|
* Handles API Platform's `</.well-known/mercure>; rel="mercure"` format.
|
|
838
790
|
*/
|
|
839
|
-
declare function parseLinkHeader(header: string): ParsedLink[];
|
|
791
|
+
export declare function parseLinkHeader(header: string): ParsedLink[];
|
|
840
792
|
/**
|
|
841
793
|
* Extract the Mercure hub URL from response headers, if present.
|
|
842
794
|
* Relative URLs are resolved against the request URL.
|
|
843
795
|
*/
|
|
844
|
-
declare function extractMercureHubUrl(headers: Headers, responseUrl: string): string | null;
|
|
796
|
+
export declare function extractMercureHubUrl(headers: Headers, responseUrl: string): string | null;
|
|
845
797
|
/**
|
|
846
798
|
* Infer the API origin from Hydra `@id` values (entrypoint or collection items).
|
|
847
799
|
* API Platform publishes absolute IRIs when `DEFAULT_URI` is configured.
|
|
848
800
|
*/
|
|
849
|
-
declare function extractTopicOriginFromPayload(data: unknown): string | null;
|
|
850
|
-
declare function getDiscoveredMercureTopicOrigin(): string | undefined;
|
|
801
|
+
export declare function extractTopicOriginFromPayload(data: unknown): string | null;
|
|
802
|
+
export declare function getDiscoveredMercureTopicOrigin(): string | undefined;
|
|
851
803
|
/**
|
|
852
804
|
* Inspect an API response and update Mercure hub URL / topic origin when found.
|
|
853
805
|
* Called from `CoreHttpClient` on every successful response.
|
|
854
806
|
*/
|
|
855
|
-
declare function discoverMercureFromResponse(response: Response, data: unknown): void;
|
|
856
|
-
//#endregion
|
|
857
|
-
//#region packages/core/mercure/useDiscoveredMercureTopicOrigin.d.ts
|
|
807
|
+
export declare function discoverMercureFromResponse(response: Response, data: unknown): void;
|
|
858
808
|
/**
|
|
859
809
|
* Returns the Mercure topic origin autodiscovered from Hydra `@id` IRIs.
|
|
860
810
|
* Re-renders when a new origin is discovered from a subsequent API response.
|
|
861
811
|
*/
|
|
862
|
-
declare function useDiscoveredMercureTopicOrigin(): string | undefined;
|
|
863
|
-
//#endregion
|
|
864
|
-
//#region packages/core/mercure/MercureManager.d.ts
|
|
812
|
+
export declare function useDiscoveredMercureTopicOrigin(): string | undefined;
|
|
865
813
|
/**
|
|
866
814
|
* MercureManager — Singleton that manages the lifecycle of EventSource connections.
|
|
867
815
|
*
|
|
@@ -924,5 +872,4 @@ declare class MercureManager {
|
|
|
924
872
|
}
|
|
925
873
|
/** Singleton instance — shared across the entire application. */
|
|
926
874
|
declare const mercureManager: MercureManager;
|
|
927
|
-
|
|
928
|
-
export { CSRF_COOKIE_NAME, 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_CORRELATION_ID_HEADER_NAME, DEFAULT_CSRF_HEADER_NAME, 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, generateCorrelationId, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, getDiscoveredMercureTopicOrigin, getMercureTopicOrigin, initCoreI18n, isMoneyValue, parseLinkHeader, parseMoney, parseMoneyInput, readCsrfToken, resolveMercureTopicOrigin, sumMoney, toMinorUnits, useBooleanFlag, useCoreConfig, useCoreHttpClient, useCoreRuntime, useCoreTranslation, useDiscoveredMercureTopicOrigin, useEvents, useFeatureFlags, useMercureHub, useMercureSubscription, useNumberFlag, useObjectFlag, useStringFlag };
|
|
875
|
+
export { type CoreConfig, type CoreConfigProviderProps, type CoreHttpClientConfig, type CoreHttpError, type CoreHttpErrorData, type CoreHttpProviderProps, type CoreHttpResponse, type CoreNotificationType, type CoreProviderProps, type CoreRequestConfig, type CoreResponseType, type CoreRuntime, type CoreRuntimeProviderProps, type CoreTranslationKeys, type DataGridEventNames, type DataRecord, type DialogEventNames, type EventSubscription, type FeatureFlagClient, type FeatureFlagEvaluationContext, type FeatureFlagValues, type FeatureFlagsProviderProps, type FormEventNames, type FormatMoneyOptions, type GridData, mercureManager as MercureManager, type MercureManager as MercureManagerType, type MercureProviderProps, type MoneyValue, type ScopedFormEventNames, type ToolbarButtonItem };
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { createContext, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
3
|
import i18next from "i18next";
|
|
5
|
-
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
// packages/core/config/CoreConfig.tsx
|
|
6
6
|
const _coreConfig = {
|
|
7
7
|
locale: "en",
|
|
8
8
|
timezone: "UTC",
|
|
@@ -80,8 +80,7 @@ const CoreConfigProvider = ({ locale, timezone, apiBaseUrl, currency, mercureTop
|
|
|
80
80
|
function useCoreConfig() {
|
|
81
81
|
return React.useContext(CoreConfigContext);
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
//#region packages/core/date/DateUtils.ts
|
|
83
|
+
// packages/core/date/DateUtils.ts
|
|
85
84
|
/**
|
|
86
85
|
* Recommended default for new projects using @nubitio/core.
|
|
87
86
|
* You should almost always override this via CoreConfigProvider.
|
|
@@ -155,8 +154,7 @@ var DateUtils = class {
|
|
|
155
154
|
return months <= 0 ? 0 : months;
|
|
156
155
|
}
|
|
157
156
|
};
|
|
158
|
-
|
|
159
|
-
//#region packages/core/money/Money.ts
|
|
157
|
+
// packages/core/money/Money.ts
|
|
160
158
|
const DECIMAL_PATTERN = /^[+-]?\d+(\.\d+)?$/;
|
|
161
159
|
/**
|
|
162
160
|
* Reads a value coming off the wire.
|
|
@@ -298,8 +296,7 @@ function decimalsOf(decimal) {
|
|
|
298
296
|
const index = decimal.indexOf(".");
|
|
299
297
|
return index === -1 ? 0 : decimal.length - index - 1;
|
|
300
298
|
}
|
|
301
|
-
|
|
302
|
-
//#region packages/core/event/EventHook.ts
|
|
299
|
+
// packages/core/event/EventHook.ts
|
|
303
300
|
const listeners = /* @__PURE__ */ new Map();
|
|
304
301
|
function subscribe(name, handler) {
|
|
305
302
|
if (!listeners.has(name)) listeners.set(name, /* @__PURE__ */ new Set());
|
|
@@ -345,8 +342,7 @@ const dispatch = (name, payload) => {
|
|
|
345
342
|
} catch {}
|
|
346
343
|
});
|
|
347
344
|
};
|
|
348
|
-
|
|
349
|
-
//#region packages/core/event/createCrudEvents.ts
|
|
345
|
+
// packages/core/event/createCrudEvents.ts
|
|
350
346
|
/**
|
|
351
347
|
* Generic factory that builds a typed set of CRUD event name strings for a
|
|
352
348
|
* given `prefix`. The returned object is `const`-asserted so every value is
|
|
@@ -370,8 +366,7 @@ const createCrudEvents = (prefix) => ({
|
|
|
370
366
|
SUCCESS: `${prefix}:success`,
|
|
371
367
|
LOADING: `${prefix}:loading`
|
|
372
368
|
});
|
|
373
|
-
|
|
374
|
-
//#region packages/core/event/createScopedEventBus.ts
|
|
369
|
+
// packages/core/event/createScopedEventBus.ts
|
|
375
370
|
/**
|
|
376
371
|
* Creates a scoped event bus for the given resource.
|
|
377
372
|
*
|
|
@@ -392,8 +387,7 @@ function createScopedEventBus(resourceId) {
|
|
|
392
387
|
_scopeId: scopeId
|
|
393
388
|
};
|
|
394
389
|
}
|
|
395
|
-
|
|
396
|
-
//#region packages/core/i18n/coreTranslations.ts
|
|
390
|
+
// packages/core/i18n/coreTranslations.ts
|
|
397
391
|
const coreTranslationsEs = {
|
|
398
392
|
"crudPage.selectedCount": "{{count}} seleccionados",
|
|
399
393
|
"crudPage.auditTrailButton": "Historial",
|
|
@@ -758,20 +752,17 @@ const coreTranslationsEn = {
|
|
|
758
752
|
"form.fileUploadEmpty": "No file",
|
|
759
753
|
"crudPage.confirmActionTitle": "Confirm action"
|
|
760
754
|
};
|
|
761
|
-
|
|
762
|
-
//#region packages/core/i18n/useCoreTranslation.ts
|
|
755
|
+
// packages/core/i18n/useCoreTranslation.ts
|
|
763
756
|
function useCoreTranslation() {
|
|
764
757
|
const { t } = useTranslation("core");
|
|
765
|
-
return { t: (key, options) => t(key, options) };
|
|
758
|
+
return { t: (key, options) => t(key, options ?? {}) };
|
|
766
759
|
}
|
|
767
|
-
|
|
768
|
-
//#region packages/core/i18n/initCoreI18n.ts
|
|
760
|
+
// packages/core/i18n/initCoreI18n.ts
|
|
769
761
|
function initCoreI18n() {
|
|
770
762
|
i18next.addResourceBundle("es", "core", coreTranslationsEs, true, false);
|
|
771
763
|
i18next.addResourceBundle("en", "core", coreTranslationsEn, true, false);
|
|
772
764
|
}
|
|
773
|
-
|
|
774
|
-
//#region packages/core/mercure/MercureManager.ts
|
|
765
|
+
// packages/core/mercure/MercureManager.ts
|
|
775
766
|
var MercureManager = class {
|
|
776
767
|
hubUrl = null;
|
|
777
768
|
topics = /* @__PURE__ */ new Map();
|
|
@@ -888,8 +879,7 @@ var MercureManager = class {
|
|
|
888
879
|
};
|
|
889
880
|
/** Singleton instance — shared across the entire application. */
|
|
890
881
|
const mercureManager = new MercureManager();
|
|
891
|
-
|
|
892
|
-
//#region packages/core/mercure/mercureDiscovery.ts
|
|
882
|
+
// packages/core/mercure/mercureDiscovery.ts
|
|
893
883
|
let discoveredTopicOrigin;
|
|
894
884
|
const topicOriginListeners = /* @__PURE__ */ new Set();
|
|
895
885
|
/**
|
|
@@ -994,8 +984,7 @@ function discoverMercureFromResponse(response, data) {
|
|
|
994
984
|
const topicOrigin = extractTopicOriginFromPayload(data);
|
|
995
985
|
if (topicOrigin) setDiscoveredTopicOrigin(topicOrigin);
|
|
996
986
|
}
|
|
997
|
-
|
|
998
|
-
//#region packages/core/http/correlationId.ts
|
|
987
|
+
// packages/core/http/correlationId.ts
|
|
999
988
|
/**
|
|
1000
989
|
* Generates a client-side correlation id for one logical HTTP request.
|
|
1001
990
|
*
|
|
@@ -1015,8 +1004,7 @@ function generateCorrelationId() {
|
|
|
1015
1004
|
if (cryptoRef && typeof cryptoRef.randomUUID === "function") return cryptoRef.randomUUID();
|
|
1016
1005
|
return `req-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
1017
1006
|
}
|
|
1018
|
-
|
|
1019
|
-
//#region packages/core/http/CoreHttpClient.ts
|
|
1007
|
+
// packages/core/http/CoreHttpClient.ts
|
|
1020
1008
|
/** Default value of {@link CoreHttpClientConfig.csrfHeaderName}. */
|
|
1021
1009
|
const DEFAULT_CSRF_HEADER_NAME = "X-CSRF-Token";
|
|
1022
1010
|
/** Default value of {@link CoreHttpClientConfig.correlationIdHeaderName}. */
|
|
@@ -1229,8 +1217,7 @@ var CoreHttpClient = class {
|
|
|
1229
1217
|
function createCoreHttpClient(config) {
|
|
1230
1218
|
return new CoreHttpClient(config);
|
|
1231
1219
|
}
|
|
1232
|
-
|
|
1233
|
-
//#region packages/core/http/CoreHttpContext.tsx
|
|
1220
|
+
// packages/core/http/CoreHttpContext.tsx
|
|
1234
1221
|
const defaultHttpClient = createCoreHttpClient();
|
|
1235
1222
|
const CoreHttpContext = createContext(defaultHttpClient);
|
|
1236
1223
|
function CoreHttpProvider({ children, client, config }) {
|
|
@@ -1249,8 +1236,7 @@ function CoreHttpProvider({ children, client, config }) {
|
|
|
1249
1236
|
function useCoreHttpClient() {
|
|
1250
1237
|
return useContext(CoreHttpContext);
|
|
1251
1238
|
}
|
|
1252
|
-
|
|
1253
|
-
//#region packages/core/http/csrf.ts
|
|
1239
|
+
// packages/core/http/csrf.ts
|
|
1254
1240
|
/** Name of the cookie the Nubit backend sets for the double-submit CSRF policy. */
|
|
1255
1241
|
const CSRF_COOKIE_NAME = "CSRF_TOKEN";
|
|
1256
1242
|
/**
|
|
@@ -1276,8 +1262,7 @@ function readCsrfToken(cookieName = CSRF_COOKIE_NAME) {
|
|
|
1276
1262
|
}
|
|
1277
1263
|
}
|
|
1278
1264
|
}
|
|
1279
|
-
|
|
1280
|
-
//#region packages/core/runtime/CoreRuntimeContext.tsx
|
|
1265
|
+
// packages/core/runtime/CoreRuntimeContext.tsx
|
|
1281
1266
|
const defaultRuntime = {
|
|
1282
1267
|
notify: () => void 0,
|
|
1283
1268
|
confirm: (message) => {
|
|
@@ -1299,8 +1284,7 @@ function CoreRuntimeProvider({ children, runtime }) {
|
|
|
1299
1284
|
function useCoreRuntime() {
|
|
1300
1285
|
return useContext(CoreRuntimeContext);
|
|
1301
1286
|
}
|
|
1302
|
-
|
|
1303
|
-
//#region packages/core/provider/CoreProvider.tsx
|
|
1287
|
+
// packages/core/provider/CoreProvider.tsx
|
|
1304
1288
|
function CoreProvider({ children, http, httpClient, runtime }) {
|
|
1305
1289
|
return /* @__PURE__ */ jsx(CoreHttpProvider, {
|
|
1306
1290
|
client: httpClient,
|
|
@@ -1311,8 +1295,7 @@ function CoreProvider({ children, http, httpClient, runtime }) {
|
|
|
1311
1295
|
})
|
|
1312
1296
|
});
|
|
1313
1297
|
}
|
|
1314
|
-
|
|
1315
|
-
//#region packages/core/featureFlags/FeatureFlags.tsx
|
|
1298
|
+
// packages/core/featureFlags/FeatureFlags.tsx
|
|
1316
1299
|
var StaticFeatureFlagClient = class {
|
|
1317
1300
|
flags;
|
|
1318
1301
|
context;
|
|
@@ -1365,8 +1348,7 @@ function useNumberFlag(key, defaultValue = 0) {
|
|
|
1365
1348
|
function useObjectFlag(key, defaultValue) {
|
|
1366
1349
|
return useFeatureFlags().getObjectValue(key, defaultValue);
|
|
1367
1350
|
}
|
|
1368
|
-
|
|
1369
|
-
//#region packages/core/mercure/MercureProvider.tsx
|
|
1351
|
+
// packages/core/mercure/MercureProvider.tsx
|
|
1370
1352
|
/**
|
|
1371
1353
|
* MercureProvider — React context provider for the Mercure hub URL.
|
|
1372
1354
|
*
|
|
@@ -1414,8 +1396,7 @@ function MercureProvider({ hubUrl: hubUrlOverride, children }) {
|
|
|
1414
1396
|
children
|
|
1415
1397
|
});
|
|
1416
1398
|
}
|
|
1417
|
-
|
|
1418
|
-
//#region packages/core/mercure/useMercureHub.ts
|
|
1399
|
+
// packages/core/mercure/useMercureHub.ts
|
|
1419
1400
|
/**
|
|
1420
1401
|
* useMercureHub — Hook that returns the Mercure hub URL from context.
|
|
1421
1402
|
*
|
|
@@ -1442,8 +1423,7 @@ function MercureProvider({ hubUrl: hubUrlOverride, children }) {
|
|
|
1442
1423
|
function useMercureHub() {
|
|
1443
1424
|
return useContext(MercureContext);
|
|
1444
1425
|
}
|
|
1445
|
-
|
|
1446
|
-
//#region packages/core/mercure/mercureTopics.ts
|
|
1426
|
+
// packages/core/mercure/mercureTopics.ts
|
|
1447
1427
|
/**
|
|
1448
1428
|
* Resolves the origin used to build Mercure collection topic URIs.
|
|
1449
1429
|
*
|
|
@@ -1479,8 +1459,7 @@ function buildMercureCollectionTopic(apiUrl, configuredOrigin, apiBaseUrl = getC
|
|
|
1479
1459
|
if (tenantId !== void 0 && tenantId !== null && `${tenantId}` !== "") return `${origin}/api/tenants/${tenantId}/${normalizedPath.replace(/^api\//, "")}/*`;
|
|
1480
1460
|
return `${origin}/${normalizedPath}/*`;
|
|
1481
1461
|
}
|
|
1482
|
-
|
|
1483
|
-
//#region packages/core/mercure/useDiscoveredMercureTopicOrigin.ts
|
|
1462
|
+
// packages/core/mercure/useDiscoveredMercureTopicOrigin.ts
|
|
1484
1463
|
/**
|
|
1485
1464
|
* Returns the Mercure topic origin autodiscovered from Hydra `@id` IRIs.
|
|
1486
1465
|
* Re-renders when a new origin is discovered from a subsequent API response.
|
|
@@ -1490,8 +1469,7 @@ function useDiscoveredMercureTopicOrigin() {
|
|
|
1490
1469
|
useEffect(() => onMercureTopicOriginChange(setOrigin), []);
|
|
1491
1470
|
return origin;
|
|
1492
1471
|
}
|
|
1493
|
-
|
|
1494
|
-
//#region packages/core/mercure/useMercureSubscription.ts
|
|
1472
|
+
// packages/core/mercure/useMercureSubscription.ts
|
|
1495
1473
|
/**
|
|
1496
1474
|
* useMercureSubscription — Hook that subscribes to a Mercure topic and calls
|
|
1497
1475
|
* a callback whenever an SSE message is received for that topic.
|
|
@@ -1544,5 +1522,4 @@ function useMercureSubscription(apiUrl, onUpdate, enabled = true) {
|
|
|
1544
1522
|
apiBaseUrl
|
|
1545
1523
|
]);
|
|
1546
1524
|
}
|
|
1547
|
-
//#endregion
|
|
1548
1525
|
export { CSRF_COOKIE_NAME, CoreConfigProvider, CoreHttpClient, CoreHttpProvider, CoreProvider, CoreRuntimeProvider, DEFAULT_CORRELATION_ID_HEADER_NAME, DEFAULT_CSRF_HEADER_NAME, DEFAULT_TIMEZONE, DateUtils, FeatureFlagsProvider, mercureManager as MercureManager, MercureProvider, StaticFeatureFlagClient, buildMercureCollectionTopic, configureCore, configureCoreDate, coreTranslationsEn, coreTranslationsEs, createCoreHttpClient, createCrudEvents, createScopedEventBus, discoverMercureFromResponse, dispatch, extractMercureHubUrl, extractTopicOriginFromPayload, formatMinorUnits, formatMoney, fromMinorUnits, generateCorrelationId, getCoreApiBaseUrl, getCoreCurrency, getCoreLocale, getCoreTimezone, getDiscoveredMercureTopicOrigin, getMercureTopicOrigin, initCoreI18n, isMoneyValue, parseLinkHeader, parseMoney, parseMoneyInput, readCsrfToken, 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": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
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",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"i18next": "^23.0.0",
|
|
50
|
+
"i18next": "^23.0.0 || ^27.0.0",
|
|
51
51
|
"react": "^18.2.0 || ^19.0.0",
|
|
52
52
|
"react-dom": "^18.2.0 || ^19.0.0",
|
|
53
|
-
"react-i18next": "^14.0.0"
|
|
53
|
+
"react-i18next": "^14.0.0 || ^15.0.0 || ^18.0.0"
|
|
54
54
|
}
|
|
55
55
|
}
|