@nubitio/core 1.3.1 → 2.0.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 +29 -51
- package/dist/index.d.cts +61 -113
- package/dist/index.d.mts +61 -113
- package/dist/index.mjs +27 -48
- package/package.json +3 -3
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;
|
|
@@ -357,6 +339,7 @@ interface CoreTranslationKeys {
|
|
|
357
339
|
'grid.clearFilters': string;
|
|
358
340
|
'grid.done': string;
|
|
359
341
|
'grid.searchPlaceholder': string;
|
|
342
|
+
'grid.quickSearch': string;
|
|
360
343
|
'grid.showMore': string;
|
|
361
344
|
'grid.showLess': string;
|
|
362
345
|
'grid.presentation': string;
|
|
@@ -450,20 +433,12 @@ interface CoreTranslationKeys {
|
|
|
450
433
|
'import.numberFormatComma': string;
|
|
451
434
|
'import.failed': string;
|
|
452
435
|
}
|
|
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;
|
|
436
|
+
export declare const coreTranslationsEs: CoreTranslationKeys;
|
|
437
|
+
export declare const coreTranslationsEn: CoreTranslationKeys;
|
|
438
|
+
export declare function useCoreTranslation(): {
|
|
439
|
+
t: (key: keyof CoreTranslationKeys, options?: TOptions) => string;
|
|
461
440
|
};
|
|
462
|
-
|
|
463
|
-
//#region packages/core/i18n/initCoreI18n.d.ts
|
|
464
|
-
declare function initCoreI18n(): void;
|
|
465
|
-
//#endregion
|
|
466
|
-
//#region packages/core/http/CoreHttpClient.d.ts
|
|
441
|
+
export declare function initCoreI18n(): void;
|
|
467
442
|
type CoreResponseType = 'json' | 'arraybuffer' | 'blob' | 'text';
|
|
468
443
|
interface CoreRequestConfig {
|
|
469
444
|
params?: DataRecord;
|
|
@@ -496,9 +471,9 @@ interface CoreHttpError extends Error {
|
|
|
496
471
|
correlationId?: string;
|
|
497
472
|
}
|
|
498
473
|
/** Default value of {@link CoreHttpClientConfig.csrfHeaderName}. */
|
|
499
|
-
declare const DEFAULT_CSRF_HEADER_NAME = "X-CSRF-Token";
|
|
474
|
+
export declare const DEFAULT_CSRF_HEADER_NAME = "X-CSRF-Token";
|
|
500
475
|
/** Default value of {@link CoreHttpClientConfig.correlationIdHeaderName}. */
|
|
501
|
-
declare const DEFAULT_CORRELATION_ID_HEADER_NAME = "X-Request-Id";
|
|
476
|
+
export declare const DEFAULT_CORRELATION_ID_HEADER_NAME = "X-Request-Id";
|
|
502
477
|
interface CoreHttpClientConfig {
|
|
503
478
|
baseUrl?: string;
|
|
504
479
|
credentials?: RequestCredentials;
|
|
@@ -604,7 +579,7 @@ interface CoreHttpClientConfig {
|
|
|
604
579
|
*/
|
|
605
580
|
getCorrelationId?: () => string;
|
|
606
581
|
}
|
|
607
|
-
declare class CoreHttpClient {
|
|
582
|
+
export declare class CoreHttpClient {
|
|
608
583
|
private readonly config;
|
|
609
584
|
private refreshPromise;
|
|
610
585
|
constructor(config?: CoreHttpClientConfig);
|
|
@@ -638,18 +613,14 @@ declare class CoreHttpClient {
|
|
|
638
613
|
patch<T>(url: string, data?: unknown, config?: CoreRequestConfig): Promise<CoreHttpResponse<T>>;
|
|
639
614
|
delete<T>(url: string, config?: CoreRequestConfig): Promise<CoreHttpResponse<T>>;
|
|
640
615
|
}
|
|
641
|
-
declare function createCoreHttpClient(config?: CoreHttpClientConfig): CoreHttpClient;
|
|
642
|
-
//#endregion
|
|
643
|
-
//#region packages/core/http/CoreHttpContext.d.ts
|
|
616
|
+
export declare function createCoreHttpClient(config?: CoreHttpClientConfig): CoreHttpClient;
|
|
644
617
|
interface CoreHttpProviderProps {
|
|
645
618
|
children: React.ReactNode;
|
|
646
619
|
client?: CoreHttpClient;
|
|
647
620
|
config?: CoreHttpClientConfig;
|
|
648
621
|
}
|
|
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
|
|
622
|
+
export declare function CoreHttpProvider({ children, client, config }: CoreHttpProviderProps): React.JSX.Element;
|
|
623
|
+
export declare function useCoreHttpClient(): CoreHttpClient;
|
|
653
624
|
/**
|
|
654
625
|
* Generates a client-side correlation id for one logical HTTP request.
|
|
655
626
|
*
|
|
@@ -664,11 +635,9 @@ declare function useCoreHttpClient(): CoreHttpClient;
|
|
|
664
635
|
* `CoreHttpClientConfig.getCorrelationId` (or `CoreRequestConfig.headers`)
|
|
665
636
|
* so the id logged in the offline queue matches the one the backend sees.
|
|
666
637
|
*/
|
|
667
|
-
declare function generateCorrelationId(): string;
|
|
668
|
-
//#endregion
|
|
669
|
-
//#region packages/core/http/csrf.d.ts
|
|
638
|
+
export declare function generateCorrelationId(): string;
|
|
670
639
|
/** Name of the cookie the Nubit backend sets for the double-submit CSRF policy. */
|
|
671
|
-
declare const CSRF_COOKIE_NAME = "CSRF_TOKEN";
|
|
640
|
+
export declare const CSRF_COOKIE_NAME = "CSRF_TOKEN";
|
|
672
641
|
/**
|
|
673
642
|
* Reads the double-submit CSRF token from `document.cookie`.
|
|
674
643
|
*
|
|
@@ -677,9 +646,7 @@ declare const CSRF_COOKIE_NAME = "CSRF_TOKEN";
|
|
|
677
646
|
* back in the `X-CSRF-Token` header. Returns `undefined` outside a browser or
|
|
678
647
|
* before login has issued the cookie.
|
|
679
648
|
*/
|
|
680
|
-
declare function readCsrfToken(cookieName?: string): string | undefined;
|
|
681
|
-
//#endregion
|
|
682
|
-
//#region packages/core/runtime/CoreRuntimeContext.d.ts
|
|
649
|
+
export declare function readCsrfToken(cookieName?: string): string | undefined;
|
|
683
650
|
type CoreNotificationType = 'success' | 'error' | 'warning' | 'info';
|
|
684
651
|
interface CoreRuntime {
|
|
685
652
|
notify: (message: string, type?: CoreNotificationType, durationMs?: number) => void;
|
|
@@ -689,19 +656,15 @@ interface CoreRuntimeProviderProps {
|
|
|
689
656
|
children: React.ReactNode;
|
|
690
657
|
runtime?: Partial<CoreRuntime>;
|
|
691
658
|
}
|
|
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
|
|
659
|
+
export declare function CoreRuntimeProvider({ children, runtime }: CoreRuntimeProviderProps): React.JSX.Element;
|
|
660
|
+
export declare function useCoreRuntime(): CoreRuntime;
|
|
696
661
|
interface CoreProviderProps {
|
|
697
662
|
children: React.ReactNode;
|
|
698
663
|
http?: CoreHttpClientConfig;
|
|
699
664
|
httpClient?: CoreHttpClient;
|
|
700
665
|
runtime?: Partial<CoreRuntime>;
|
|
701
666
|
}
|
|
702
|
-
declare function CoreProvider({ children, http, httpClient, runtime }: CoreProviderProps): React.JSX.Element;
|
|
703
|
-
//#endregion
|
|
704
|
-
//#region packages/core/featureFlags/FeatureFlags.d.ts
|
|
667
|
+
export declare function CoreProvider({ children, http, httpClient, runtime }: CoreProviderProps): React.JSX.Element;
|
|
705
668
|
interface FeatureFlagEvaluationContext {
|
|
706
669
|
targetingKey?: string;
|
|
707
670
|
tenantId?: number;
|
|
@@ -715,7 +678,7 @@ interface FeatureFlagClient {
|
|
|
715
678
|
getNumberValue(key: string, defaultValue: number): number;
|
|
716
679
|
getObjectValue<T extends object>(key: string, defaultValue: T): T;
|
|
717
680
|
}
|
|
718
|
-
declare class StaticFeatureFlagClient implements FeatureFlagClient {
|
|
681
|
+
export declare class StaticFeatureFlagClient implements FeatureFlagClient {
|
|
719
682
|
private readonly flags;
|
|
720
683
|
readonly context: FeatureFlagEvaluationContext;
|
|
721
684
|
constructor(flags?: FeatureFlagValues, context?: FeatureFlagEvaluationContext);
|
|
@@ -730,14 +693,12 @@ interface FeatureFlagsProviderProps {
|
|
|
730
693
|
flags?: FeatureFlagValues;
|
|
731
694
|
context?: FeatureFlagEvaluationContext;
|
|
732
695
|
}
|
|
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
|
|
696
|
+
export declare function FeatureFlagsProvider({ children, client, flags, context }: FeatureFlagsProviderProps): React.JSX.Element;
|
|
697
|
+
export declare function useFeatureFlags(): FeatureFlagClient;
|
|
698
|
+
export declare function useBooleanFlag(key: string, defaultValue?: boolean): boolean;
|
|
699
|
+
export declare function useStringFlag(key: string, defaultValue?: string): string;
|
|
700
|
+
export declare function useNumberFlag(key: string, defaultValue?: number): number;
|
|
701
|
+
export declare function useObjectFlag<T extends object>(key: string, defaultValue: T): T;
|
|
741
702
|
interface MercureProviderProps {
|
|
742
703
|
/**
|
|
743
704
|
* Hub URL override. When omitted, the provider listens to autodiscovery
|
|
@@ -750,9 +711,7 @@ interface MercureProviderProps {
|
|
|
750
711
|
* Provides the Mercure hub URL to the React tree and keeps `MercureManager`
|
|
751
712
|
* in sync whenever the URL changes.
|
|
752
713
|
*/
|
|
753
|
-
declare function MercureProvider({ hubUrl: hubUrlOverride, children }: MercureProviderProps): React.JSX.Element;
|
|
754
|
-
//#endregion
|
|
755
|
-
//#region packages/core/mercure/useMercureHub.d.ts
|
|
714
|
+
export declare function MercureProvider({ hubUrl: hubUrlOverride, children }: MercureProviderProps): React.JSX.Element;
|
|
756
715
|
/**
|
|
757
716
|
* useMercureHub — Hook that returns the Mercure hub URL from context.
|
|
758
717
|
*
|
|
@@ -776,9 +735,7 @@ declare function MercureProvider({ hubUrl: hubUrlOverride, children }: MercurePr
|
|
|
776
735
|
* Returns the Mercure hub URL from the nearest `<MercureProvider>`,
|
|
777
736
|
* or `null` if the hub is not available.
|
|
778
737
|
*/
|
|
779
|
-
declare function useMercureHub(): string | null;
|
|
780
|
-
//#endregion
|
|
781
|
-
//#region packages/core/mercure/useMercureSubscription.d.ts
|
|
738
|
+
export declare function useMercureHub(): string | null;
|
|
782
739
|
/**
|
|
783
740
|
* useMercureSubscription — Hook that subscribes to a Mercure topic and calls
|
|
784
741
|
* a callback whenever an SSE message is received for that topic.
|
|
@@ -807,9 +764,7 @@ declare function useMercureHub(): string | null;
|
|
|
807
764
|
* @param onUpdate Callback invoked on every SSE message for the topic.
|
|
808
765
|
* @param enabled When false, the subscription is skipped entirely. Defaults to true.
|
|
809
766
|
*/
|
|
810
|
-
declare function useMercureSubscription(apiUrl: string | undefined, onUpdate: () => void, enabled?: boolean): void;
|
|
811
|
-
//#endregion
|
|
812
|
-
//#region packages/core/mercure/mercureTopics.d.ts
|
|
767
|
+
export declare function useMercureSubscription(apiUrl: string | undefined, onUpdate: () => void, enabled?: boolean): void;
|
|
813
768
|
/**
|
|
814
769
|
* Resolves the origin used to build Mercure collection topic URIs.
|
|
815
770
|
*
|
|
@@ -819,14 +774,12 @@ declare function useMercureSubscription(apiUrl: string | undefined, onUpdate: ()
|
|
|
819
774
|
* from absolute Hydra `@id` values on API responses. Set `mercureTopicOrigin`
|
|
820
775
|
* on CoreConfig only when autodiscovery cannot infer the correct origin.
|
|
821
776
|
*/
|
|
822
|
-
declare function resolveMercureTopicOrigin(apiBaseUrl?: string, configuredOrigin?: string, discoveredOrigin?: string | undefined): string;
|
|
777
|
+
export declare function resolveMercureTopicOrigin(apiBaseUrl?: string, configuredOrigin?: string, discoveredOrigin?: string | undefined): string;
|
|
823
778
|
/**
|
|
824
779
|
* Wildcard collection topic (WHATWG URL Pattern) for a resource API path.
|
|
825
780
|
* e.g. `/api/products` → `http://localhost:8000/api/products/*`
|
|
826
781
|
*/
|
|
827
|
-
declare function buildMercureCollectionTopic(apiUrl: string, configuredOrigin?: string, apiBaseUrl?: string): string | null;
|
|
828
|
-
//#endregion
|
|
829
|
-
//#region packages/core/mercure/mercureDiscovery.d.ts
|
|
782
|
+
export declare function buildMercureCollectionTopic(apiUrl: string, configuredOrigin?: string, apiBaseUrl?: string): string | null;
|
|
830
783
|
/** Parsed RFC 8288 Link header entry. */
|
|
831
784
|
interface ParsedLink {
|
|
832
785
|
url: string;
|
|
@@ -836,32 +789,28 @@ interface ParsedLink {
|
|
|
836
789
|
* Parse a `Link` response header value into `{ url, rel }` pairs.
|
|
837
790
|
* Handles API Platform's `</.well-known/mercure>; rel="mercure"` format.
|
|
838
791
|
*/
|
|
839
|
-
declare function parseLinkHeader(header: string): ParsedLink[];
|
|
792
|
+
export declare function parseLinkHeader(header: string): ParsedLink[];
|
|
840
793
|
/**
|
|
841
794
|
* Extract the Mercure hub URL from response headers, if present.
|
|
842
795
|
* Relative URLs are resolved against the request URL.
|
|
843
796
|
*/
|
|
844
|
-
declare function extractMercureHubUrl(headers: Headers, responseUrl: string): string | null;
|
|
797
|
+
export declare function extractMercureHubUrl(headers: Headers, responseUrl: string): string | null;
|
|
845
798
|
/**
|
|
846
799
|
* Infer the API origin from Hydra `@id` values (entrypoint or collection items).
|
|
847
800
|
* API Platform publishes absolute IRIs when `DEFAULT_URI` is configured.
|
|
848
801
|
*/
|
|
849
|
-
declare function extractTopicOriginFromPayload(data: unknown): string | null;
|
|
850
|
-
declare function getDiscoveredMercureTopicOrigin(): string | undefined;
|
|
802
|
+
export declare function extractTopicOriginFromPayload(data: unknown): string | null;
|
|
803
|
+
export declare function getDiscoveredMercureTopicOrigin(): string | undefined;
|
|
851
804
|
/**
|
|
852
805
|
* Inspect an API response and update Mercure hub URL / topic origin when found.
|
|
853
806
|
* Called from `CoreHttpClient` on every successful response.
|
|
854
807
|
*/
|
|
855
|
-
declare function discoverMercureFromResponse(response: Response, data: unknown): void;
|
|
856
|
-
//#endregion
|
|
857
|
-
//#region packages/core/mercure/useDiscoveredMercureTopicOrigin.d.ts
|
|
808
|
+
export declare function discoverMercureFromResponse(response: Response, data: unknown): void;
|
|
858
809
|
/**
|
|
859
810
|
* Returns the Mercure topic origin autodiscovered from Hydra `@id` IRIs.
|
|
860
811
|
* Re-renders when a new origin is discovered from a subsequent API response.
|
|
861
812
|
*/
|
|
862
|
-
declare function useDiscoveredMercureTopicOrigin(): string | undefined;
|
|
863
|
-
//#endregion
|
|
864
|
-
//#region packages/core/mercure/MercureManager.d.ts
|
|
813
|
+
export declare function useDiscoveredMercureTopicOrigin(): string | undefined;
|
|
865
814
|
/**
|
|
866
815
|
* MercureManager — Singleton that manages the lifecycle of EventSource connections.
|
|
867
816
|
*
|
|
@@ -924,5 +873,4 @@ declare class MercureManager {
|
|
|
924
873
|
}
|
|
925
874
|
/** Singleton instance — shared across the entire application. */
|
|
926
875
|
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 };
|
|
876
|
+
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",
|
|
@@ -512,6 +506,7 @@ const coreTranslationsEs = {
|
|
|
512
506
|
"grid.clearFilters": "Limpiar filtros",
|
|
513
507
|
"grid.done": "Listo",
|
|
514
508
|
"grid.searchPlaceholder": "Buscar por {{column}}",
|
|
509
|
+
"grid.quickSearch": "Buscar registros",
|
|
515
510
|
"grid.showMore": "Ver más",
|
|
516
511
|
"grid.presentation": "Presentación",
|
|
517
512
|
"grid.tableView": "Tabla",
|
|
@@ -694,6 +689,7 @@ const coreTranslationsEn = {
|
|
|
694
689
|
"grid.clearFilters": "Clear filters",
|
|
695
690
|
"grid.done": "Done",
|
|
696
691
|
"grid.searchPlaceholder": "Search by {{column}}",
|
|
692
|
+
"grid.quickSearch": "Search records",
|
|
697
693
|
"grid.showMore": "Show more",
|
|
698
694
|
"grid.presentation": "Presentation",
|
|
699
695
|
"grid.tableView": "Table",
|
|
@@ -758,20 +754,17 @@ const coreTranslationsEn = {
|
|
|
758
754
|
"form.fileUploadEmpty": "No file",
|
|
759
755
|
"crudPage.confirmActionTitle": "Confirm action"
|
|
760
756
|
};
|
|
761
|
-
|
|
762
|
-
//#region packages/core/i18n/useCoreTranslation.ts
|
|
757
|
+
// packages/core/i18n/useCoreTranslation.ts
|
|
763
758
|
function useCoreTranslation() {
|
|
764
759
|
const { t } = useTranslation("core");
|
|
765
|
-
return { t: (key, options) => t(key, options) };
|
|
760
|
+
return { t: (key, options) => t(key, options ?? {}) };
|
|
766
761
|
}
|
|
767
|
-
|
|
768
|
-
//#region packages/core/i18n/initCoreI18n.ts
|
|
762
|
+
// packages/core/i18n/initCoreI18n.ts
|
|
769
763
|
function initCoreI18n() {
|
|
770
764
|
i18next.addResourceBundle("es", "core", coreTranslationsEs, true, false);
|
|
771
765
|
i18next.addResourceBundle("en", "core", coreTranslationsEn, true, false);
|
|
772
766
|
}
|
|
773
|
-
|
|
774
|
-
//#region packages/core/mercure/MercureManager.ts
|
|
767
|
+
// packages/core/mercure/MercureManager.ts
|
|
775
768
|
var MercureManager = class {
|
|
776
769
|
hubUrl = null;
|
|
777
770
|
topics = /* @__PURE__ */ new Map();
|
|
@@ -888,8 +881,7 @@ var MercureManager = class {
|
|
|
888
881
|
};
|
|
889
882
|
/** Singleton instance — shared across the entire application. */
|
|
890
883
|
const mercureManager = new MercureManager();
|
|
891
|
-
|
|
892
|
-
//#region packages/core/mercure/mercureDiscovery.ts
|
|
884
|
+
// packages/core/mercure/mercureDiscovery.ts
|
|
893
885
|
let discoveredTopicOrigin;
|
|
894
886
|
const topicOriginListeners = /* @__PURE__ */ new Set();
|
|
895
887
|
/**
|
|
@@ -994,8 +986,7 @@ function discoverMercureFromResponse(response, data) {
|
|
|
994
986
|
const topicOrigin = extractTopicOriginFromPayload(data);
|
|
995
987
|
if (topicOrigin) setDiscoveredTopicOrigin(topicOrigin);
|
|
996
988
|
}
|
|
997
|
-
|
|
998
|
-
//#region packages/core/http/correlationId.ts
|
|
989
|
+
// packages/core/http/correlationId.ts
|
|
999
990
|
/**
|
|
1000
991
|
* Generates a client-side correlation id for one logical HTTP request.
|
|
1001
992
|
*
|
|
@@ -1015,8 +1006,7 @@ function generateCorrelationId() {
|
|
|
1015
1006
|
if (cryptoRef && typeof cryptoRef.randomUUID === "function") return cryptoRef.randomUUID();
|
|
1016
1007
|
return `req-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
1017
1008
|
}
|
|
1018
|
-
|
|
1019
|
-
//#region packages/core/http/CoreHttpClient.ts
|
|
1009
|
+
// packages/core/http/CoreHttpClient.ts
|
|
1020
1010
|
/** Default value of {@link CoreHttpClientConfig.csrfHeaderName}. */
|
|
1021
1011
|
const DEFAULT_CSRF_HEADER_NAME = "X-CSRF-Token";
|
|
1022
1012
|
/** Default value of {@link CoreHttpClientConfig.correlationIdHeaderName}. */
|
|
@@ -1229,8 +1219,7 @@ var CoreHttpClient = class {
|
|
|
1229
1219
|
function createCoreHttpClient(config) {
|
|
1230
1220
|
return new CoreHttpClient(config);
|
|
1231
1221
|
}
|
|
1232
|
-
|
|
1233
|
-
//#region packages/core/http/CoreHttpContext.tsx
|
|
1222
|
+
// packages/core/http/CoreHttpContext.tsx
|
|
1234
1223
|
const defaultHttpClient = createCoreHttpClient();
|
|
1235
1224
|
const CoreHttpContext = createContext(defaultHttpClient);
|
|
1236
1225
|
function CoreHttpProvider({ children, client, config }) {
|
|
@@ -1249,8 +1238,7 @@ function CoreHttpProvider({ children, client, config }) {
|
|
|
1249
1238
|
function useCoreHttpClient() {
|
|
1250
1239
|
return useContext(CoreHttpContext);
|
|
1251
1240
|
}
|
|
1252
|
-
|
|
1253
|
-
//#region packages/core/http/csrf.ts
|
|
1241
|
+
// packages/core/http/csrf.ts
|
|
1254
1242
|
/** Name of the cookie the Nubit backend sets for the double-submit CSRF policy. */
|
|
1255
1243
|
const CSRF_COOKIE_NAME = "CSRF_TOKEN";
|
|
1256
1244
|
/**
|
|
@@ -1276,8 +1264,7 @@ function readCsrfToken(cookieName = CSRF_COOKIE_NAME) {
|
|
|
1276
1264
|
}
|
|
1277
1265
|
}
|
|
1278
1266
|
}
|
|
1279
|
-
|
|
1280
|
-
//#region packages/core/runtime/CoreRuntimeContext.tsx
|
|
1267
|
+
// packages/core/runtime/CoreRuntimeContext.tsx
|
|
1281
1268
|
const defaultRuntime = {
|
|
1282
1269
|
notify: () => void 0,
|
|
1283
1270
|
confirm: (message) => {
|
|
@@ -1299,8 +1286,7 @@ function CoreRuntimeProvider({ children, runtime }) {
|
|
|
1299
1286
|
function useCoreRuntime() {
|
|
1300
1287
|
return useContext(CoreRuntimeContext);
|
|
1301
1288
|
}
|
|
1302
|
-
|
|
1303
|
-
//#region packages/core/provider/CoreProvider.tsx
|
|
1289
|
+
// packages/core/provider/CoreProvider.tsx
|
|
1304
1290
|
function CoreProvider({ children, http, httpClient, runtime }) {
|
|
1305
1291
|
return /* @__PURE__ */ jsx(CoreHttpProvider, {
|
|
1306
1292
|
client: httpClient,
|
|
@@ -1311,8 +1297,7 @@ function CoreProvider({ children, http, httpClient, runtime }) {
|
|
|
1311
1297
|
})
|
|
1312
1298
|
});
|
|
1313
1299
|
}
|
|
1314
|
-
|
|
1315
|
-
//#region packages/core/featureFlags/FeatureFlags.tsx
|
|
1300
|
+
// packages/core/featureFlags/FeatureFlags.tsx
|
|
1316
1301
|
var StaticFeatureFlagClient = class {
|
|
1317
1302
|
flags;
|
|
1318
1303
|
context;
|
|
@@ -1365,8 +1350,7 @@ function useNumberFlag(key, defaultValue = 0) {
|
|
|
1365
1350
|
function useObjectFlag(key, defaultValue) {
|
|
1366
1351
|
return useFeatureFlags().getObjectValue(key, defaultValue);
|
|
1367
1352
|
}
|
|
1368
|
-
|
|
1369
|
-
//#region packages/core/mercure/MercureProvider.tsx
|
|
1353
|
+
// packages/core/mercure/MercureProvider.tsx
|
|
1370
1354
|
/**
|
|
1371
1355
|
* MercureProvider — React context provider for the Mercure hub URL.
|
|
1372
1356
|
*
|
|
@@ -1414,8 +1398,7 @@ function MercureProvider({ hubUrl: hubUrlOverride, children }) {
|
|
|
1414
1398
|
children
|
|
1415
1399
|
});
|
|
1416
1400
|
}
|
|
1417
|
-
|
|
1418
|
-
//#region packages/core/mercure/useMercureHub.ts
|
|
1401
|
+
// packages/core/mercure/useMercureHub.ts
|
|
1419
1402
|
/**
|
|
1420
1403
|
* useMercureHub — Hook that returns the Mercure hub URL from context.
|
|
1421
1404
|
*
|
|
@@ -1442,8 +1425,7 @@ function MercureProvider({ hubUrl: hubUrlOverride, children }) {
|
|
|
1442
1425
|
function useMercureHub() {
|
|
1443
1426
|
return useContext(MercureContext);
|
|
1444
1427
|
}
|
|
1445
|
-
|
|
1446
|
-
//#region packages/core/mercure/mercureTopics.ts
|
|
1428
|
+
// packages/core/mercure/mercureTopics.ts
|
|
1447
1429
|
/**
|
|
1448
1430
|
* Resolves the origin used to build Mercure collection topic URIs.
|
|
1449
1431
|
*
|
|
@@ -1479,8 +1461,7 @@ function buildMercureCollectionTopic(apiUrl, configuredOrigin, apiBaseUrl = getC
|
|
|
1479
1461
|
if (tenantId !== void 0 && tenantId !== null && `${tenantId}` !== "") return `${origin}/api/tenants/${tenantId}/${normalizedPath.replace(/^api\//, "")}/*`;
|
|
1480
1462
|
return `${origin}/${normalizedPath}/*`;
|
|
1481
1463
|
}
|
|
1482
|
-
|
|
1483
|
-
//#region packages/core/mercure/useDiscoveredMercureTopicOrigin.ts
|
|
1464
|
+
// packages/core/mercure/useDiscoveredMercureTopicOrigin.ts
|
|
1484
1465
|
/**
|
|
1485
1466
|
* Returns the Mercure topic origin autodiscovered from Hydra `@id` IRIs.
|
|
1486
1467
|
* Re-renders when a new origin is discovered from a subsequent API response.
|
|
@@ -1490,8 +1471,7 @@ function useDiscoveredMercureTopicOrigin() {
|
|
|
1490
1471
|
useEffect(() => onMercureTopicOriginChange(setOrigin), []);
|
|
1491
1472
|
return origin;
|
|
1492
1473
|
}
|
|
1493
|
-
|
|
1494
|
-
//#region packages/core/mercure/useMercureSubscription.ts
|
|
1474
|
+
// packages/core/mercure/useMercureSubscription.ts
|
|
1495
1475
|
/**
|
|
1496
1476
|
* useMercureSubscription — Hook that subscribes to a Mercure topic and calls
|
|
1497
1477
|
* a callback whenever an SSE message is received for that topic.
|
|
@@ -1544,5 +1524,4 @@ function useMercureSubscription(apiUrl, onUpdate, enabled = true) {
|
|
|
1544
1524
|
apiBaseUrl
|
|
1545
1525
|
]);
|
|
1546
1526
|
}
|
|
1547
|
-
//#endregion
|
|
1548
1527
|
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 };
|