@twin.org/core 0.0.1-next.51 → 0.0.1-next.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/cjs/index.cjs +144 -70
  2. package/dist/esm/index.mjs +144 -71
  3. package/dist/types/index.d.ts +2 -0
  4. package/dist/types/models/II18nShared.d.ts +29 -0
  5. package/dist/types/utils/sharedStore.d.ts +23 -0
  6. package/docs/changelog.md +7 -0
  7. package/docs/reference/classes/AlreadyExistsError.md +7 -7
  8. package/docs/reference/classes/ArrayHelper.md +3 -3
  9. package/docs/reference/classes/AsyncCache.md +14 -8
  10. package/docs/reference/classes/Base32.md +3 -3
  11. package/docs/reference/classes/Base58.md +3 -3
  12. package/docs/reference/classes/Base64.md +3 -3
  13. package/docs/reference/classes/Base64Url.md +3 -3
  14. package/docs/reference/classes/BaseError.md +5 -5
  15. package/docs/reference/classes/BitString.md +5 -5
  16. package/docs/reference/classes/Coerce.md +7 -5
  17. package/docs/reference/classes/Compression.md +3 -3
  18. package/docs/reference/classes/ConflictError.md +7 -7
  19. package/docs/reference/classes/Converter.md +6 -6
  20. package/docs/reference/classes/EnvHelper.md +7 -5
  21. package/docs/reference/classes/ErrorHelper.md +3 -3
  22. package/docs/reference/classes/Factory.md +17 -7
  23. package/docs/reference/classes/FilenameHelper.md +3 -3
  24. package/docs/reference/classes/GeneralError.md +7 -7
  25. package/docs/reference/classes/GuardError.md +7 -7
  26. package/docs/reference/classes/Guards.md +18 -8
  27. package/docs/reference/classes/HexHelper.md +3 -3
  28. package/docs/reference/classes/I18n.md +6 -6
  29. package/docs/reference/classes/Is.md +21 -9
  30. package/docs/reference/classes/JsonHelper.md +10 -6
  31. package/docs/reference/classes/NotFoundError.md +7 -7
  32. package/docs/reference/classes/NotImplementedError.md +7 -7
  33. package/docs/reference/classes/NotSupportedError.md +7 -7
  34. package/docs/reference/classes/ObjectHelper.md +40 -18
  35. package/docs/reference/classes/RandomHelper.md +3 -3
  36. package/docs/reference/classes/SharedStore.md +94 -0
  37. package/docs/reference/classes/StringHelper.md +3 -3
  38. package/docs/reference/classes/Uint8ArrayHelper.md +3 -3
  39. package/docs/reference/classes/UnauthorizedError.md +7 -7
  40. package/docs/reference/classes/UnprocessableError.md +7 -7
  41. package/docs/reference/classes/Url.md +7 -7
  42. package/docs/reference/classes/Urn.md +9 -9
  43. package/docs/reference/classes/Validation.md +36 -28
  44. package/docs/reference/classes/ValidationError.md +7 -7
  45. package/docs/reference/index.md +2 -0
  46. package/docs/reference/interfaces/IComponent.md +3 -3
  47. package/docs/reference/interfaces/IError.md +1 -1
  48. package/docs/reference/interfaces/II18nShared.md +47 -0
  49. package/docs/reference/interfaces/IKeyValue.md +3 -1
  50. package/docs/reference/interfaces/ILabelledValue.md +3 -1
  51. package/docs/reference/interfaces/ILocaleDictionary.md +1 -1
  52. package/docs/reference/type-aliases/CoerceType.md +1 -1
  53. package/docs/reference/type-aliases/CompressionType.md +1 -1
  54. package/package.json +2 -2
@@ -1814,6 +1814,53 @@ class Guards {
1814
1814
  }
1815
1815
  }
1816
1816
 
1817
+ // Copyright 2024 IOTA Stiftung.
1818
+ // SPDX-License-Identifier: Apache-2.0.
1819
+ /**
1820
+ * Provide a store for shared objects which can be accesses through multiple
1821
+ * instance loads of a packages.
1822
+ */
1823
+ class SharedStore {
1824
+ /**
1825
+ * Get a property from the shared store.
1826
+ * @param prop The name of the property to get.
1827
+ * @returns The property if it exists.
1828
+ */
1829
+ static get(prop) {
1830
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1831
+ const shared = globalThis.__TWIN_SHARED__;
1832
+ if (Is.undefined(shared)) {
1833
+ return;
1834
+ }
1835
+ return shared[prop];
1836
+ }
1837
+ /**
1838
+ * Set the property in the shared store.
1839
+ * @param prop The name of the property to set.
1840
+ * @param value The value to set.
1841
+ */
1842
+ static set(prop, value) {
1843
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1844
+ if (Is.undefined(globalThis.__TWIN_SHARED__)) {
1845
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1846
+ globalThis.__TWIN_SHARED__ = {};
1847
+ }
1848
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1849
+ globalThis.__TWIN_SHARED__[prop] = value;
1850
+ }
1851
+ /**
1852
+ * Remove a property from the shared store.
1853
+ * @param prop The name of the property to remove.
1854
+ */
1855
+ static remove(prop) {
1856
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1857
+ const shared = globalThis.__TWIN_SHARED__;
1858
+ if (!Is.undefined(shared)) {
1859
+ delete shared[prop];
1860
+ }
1861
+ }
1862
+ }
1863
+
1817
1864
  /**
1818
1865
  * Factory for creating implementation of generic types.
1819
1866
  */
@@ -1823,11 +1870,6 @@ class Factory {
1823
1870
  * @internal
1824
1871
  */
1825
1872
  static _CLASS_NAME = "Factory";
1826
- /**
1827
- * Store all the created factories.
1828
- * @internal
1829
- */
1830
- static _factories = {};
1831
1873
  /**
1832
1874
  * Type name for the instances.
1833
1875
  * @internal
@@ -1881,32 +1923,40 @@ class Factory {
1881
1923
  * @returns The factory instance.
1882
1924
  */
1883
1925
  static createFactory(typeName, autoInstance = false, matcher) {
1884
- if (Is.undefined(Factory._factories[typeName])) {
1885
- Factory._factories[typeName] = new Factory(typeName, autoInstance, matcher);
1926
+ const factories = Factory.getFactories();
1927
+ if (Is.undefined(factories[typeName])) {
1928
+ factories[typeName] = new Factory(typeName, autoInstance, matcher);
1886
1929
  }
1887
- return Factory._factories[typeName];
1930
+ return factories[typeName];
1888
1931
  }
1889
1932
  /**
1890
1933
  * Get all the factories.
1891
1934
  * @returns All the factories.
1892
1935
  */
1893
1936
  static getFactories() {
1894
- return Factory._factories;
1937
+ let factories = SharedStore.get("factories");
1938
+ if (Is.undefined(factories)) {
1939
+ factories = {};
1940
+ SharedStore.set("factories", factories);
1941
+ }
1942
+ return factories;
1895
1943
  }
1896
1944
  /**
1897
1945
  * Reset all the factories, which removes any created instances, but not the registrations.
1898
1946
  */
1899
1947
  static resetFactories() {
1900
- for (const typeName in Factory._factories) {
1901
- Factory._factories[typeName].reset();
1948
+ const factories = Factory.getFactories();
1949
+ for (const typeName in factories) {
1950
+ factories[typeName].reset();
1902
1951
  }
1903
1952
  }
1904
1953
  /**
1905
1954
  * Clear all the factories, which removes anything registered with the factories.
1906
1955
  */
1907
1956
  static clearFactories() {
1908
- for (const typeName in Factory._factories) {
1909
- Factory._factories[typeName].clear();
1957
+ const factories = Factory.getFactories();
1958
+ for (const typeName in factories) {
1959
+ factories[typeName].clear();
1910
1960
  }
1911
1961
  }
1912
1962
  /**
@@ -2854,34 +2904,15 @@ class I18n {
2854
2904
  * The default translation.
2855
2905
  */
2856
2906
  static DEFAULT_LOCALE = "en";
2857
- /**
2858
- * Dictionaries for lookups.
2859
- * @internal
2860
- */
2861
- static _localeDictionaries = {};
2862
- /**
2863
- * The current locale.
2864
- * @internal
2865
- */
2866
- static _currentLocale = I18n.DEFAULT_LOCALE;
2867
- /**
2868
- * Change handler for the locale being updated.
2869
- * @internal
2870
- */
2871
- static _localeChangedHandlers = {};
2872
- /**
2873
- * Change handler for the dictionaries being updated.
2874
- * @internal
2875
- */
2876
- static _dictionaryChangedHandlers = {};
2877
2907
  /**
2878
2908
  * Set the locale.
2879
2909
  * @param locale The new locale.
2880
2910
  */
2881
2911
  static setLocale(locale) {
2882
- I18n._currentLocale = locale;
2883
- for (const callback in I18n._localeChangedHandlers) {
2884
- I18n._localeChangedHandlers[callback](I18n._currentLocale);
2912
+ const i18nShared = I18n.getI18nShared();
2913
+ i18nShared.currentLocale = locale;
2914
+ for (const callback in i18nShared.localeChangedHandlers) {
2915
+ i18nShared.localeChangedHandlers[callback](i18nShared.currentLocale);
2885
2916
  }
2886
2917
  }
2887
2918
  /**
@@ -2889,7 +2920,8 @@ class I18n {
2889
2920
  * @returns The current locale.
2890
2921
  */
2891
2922
  static getLocale() {
2892
- return I18n._currentLocale;
2923
+ const i18nShared = I18n.getI18nShared();
2924
+ return i18nShared.currentLocale;
2893
2925
  }
2894
2926
  /**
2895
2927
  * Add a locale dictionary.
@@ -2897,11 +2929,12 @@ class I18n {
2897
2929
  * @param dictionary The dictionary to add.
2898
2930
  */
2899
2931
  static addDictionary(locale, dictionary) {
2932
+ const i18nShared = I18n.getI18nShared();
2900
2933
  const mergedKeys = {};
2901
2934
  I18n.flattenTranslationKeys(dictionary, "", mergedKeys);
2902
- I18n._localeDictionaries[locale] = mergedKeys;
2903
- for (const callback in I18n._dictionaryChangedHandlers) {
2904
- I18n._dictionaryChangedHandlers[callback](I18n._currentLocale);
2935
+ i18nShared.localeDictionaries[locale] = mergedKeys;
2936
+ for (const callback in i18nShared.dictionaryChangedHandlers) {
2937
+ i18nShared.dictionaryChangedHandlers[callback](i18nShared.currentLocale);
2905
2938
  }
2906
2939
  }
2907
2940
  /**
@@ -2910,14 +2943,16 @@ class I18n {
2910
2943
  * @returns The dictionary of undefined if it does not exist.
2911
2944
  */
2912
2945
  static getDictionary(locale) {
2913
- return I18n._localeDictionaries[locale];
2946
+ const i18nShared = I18n.getI18nShared();
2947
+ return i18nShared.localeDictionaries[locale];
2914
2948
  }
2915
2949
  /**
2916
2950
  * Get all the locale dictionaries.
2917
2951
  * @returns The dictionaries.
2918
2952
  */
2919
2953
  static getAllDictionaries() {
2920
- return I18n._localeDictionaries;
2954
+ const i18nShared = I18n.getI18nShared();
2955
+ return i18nShared.localeDictionaries;
2921
2956
  }
2922
2957
  /**
2923
2958
  * Add a locale changed handler.
@@ -2925,14 +2960,16 @@ class I18n {
2925
2960
  * @param handler The handler to add.
2926
2961
  */
2927
2962
  static addLocaleHandler(id, handler) {
2928
- I18n._localeChangedHandlers[id] = handler;
2963
+ const i18nShared = I18n.getI18nShared();
2964
+ i18nShared.localeChangedHandlers[id] = handler;
2929
2965
  }
2930
2966
  /**
2931
2967
  * Remove a locale changed handler.
2932
2968
  * @param id The id of the handler.
2933
2969
  */
2934
2970
  static removeLocaleHandler(id) {
2935
- delete I18n._localeChangedHandlers[id];
2971
+ const i18nShared = I18n.getI18nShared();
2972
+ delete i18nShared.localeChangedHandlers[id];
2936
2973
  }
2937
2974
  /**
2938
2975
  * Add a dictionary changed handler.
@@ -2940,14 +2977,16 @@ class I18n {
2940
2977
  * @param handler The handler to add.
2941
2978
  */
2942
2979
  static addDictionaryHandler(id, handler) {
2943
- I18n._dictionaryChangedHandlers[id] = handler;
2980
+ const i18nShared = I18n.getI18nShared();
2981
+ i18nShared.dictionaryChangedHandlers[id] = handler;
2944
2982
  }
2945
2983
  /**
2946
2984
  * Remove a dictionary changed handler.
2947
2985
  * @param id The id of the handler.
2948
2986
  */
2949
2987
  static removeDictionaryHandler(id) {
2950
- delete I18n._dictionaryChangedHandlers[id];
2988
+ const i18nShared = I18n.getI18nShared();
2989
+ delete i18nShared.dictionaryChangedHandlers[id];
2951
2990
  }
2952
2991
  /**
2953
2992
  * Format a message.
@@ -2957,21 +2996,22 @@ class I18n {
2957
2996
  * @returns The formatted string.
2958
2997
  */
2959
2998
  static formatMessage(key, values, overrideLocale) {
2960
- let cl = overrideLocale ?? I18n._currentLocale;
2999
+ const i18nShared = I18n.getI18nShared();
3000
+ let cl = overrideLocale ?? i18nShared.currentLocale;
2961
3001
  if (cl.startsWith("debug-")) {
2962
3002
  cl = I18n.DEFAULT_LOCALE;
2963
3003
  }
2964
- if (!I18n._localeDictionaries[cl]) {
3004
+ if (!i18nShared.localeDictionaries[cl]) {
2965
3005
  return `!!Missing ${cl}`;
2966
3006
  }
2967
- if (!I18n._localeDictionaries[cl][key]) {
3007
+ if (!i18nShared.localeDictionaries[cl][key]) {
2968
3008
  return `!!Missing ${cl}.${key}`;
2969
3009
  }
2970
- if (I18n._currentLocale === "debug-k") {
3010
+ if (i18nShared.currentLocale === "debug-k") {
2971
3011
  return key;
2972
3012
  }
2973
- let ret = new IntlMessageFormat(I18n._localeDictionaries[cl][key], cl).format(values);
2974
- if (I18n._currentLocale === "debug-x") {
3013
+ let ret = new IntlMessageFormat(i18nShared.localeDictionaries[cl][key], cl).format(values);
3014
+ if (i18nShared.currentLocale === "debug-x") {
2975
3015
  ret = ret.replace(/[a-z]/g, "x").replace(/[A-Z]/g, "x").replace(/\d/g, "n");
2976
3016
  }
2977
3017
  return ret;
@@ -2982,7 +3022,8 @@ class I18n {
2982
3022
  * @returns True if the key exists.
2983
3023
  */
2984
3024
  static hasMessage(key) {
2985
- return Is.string(I18n._localeDictionaries[I18n._currentLocale]?.[key]);
3025
+ const i18nShared = I18n.getI18nShared();
3026
+ return Is.string(i18nShared.localeDictionaries[i18nShared.currentLocale]?.[key]);
2986
3027
  }
2987
3028
  /**
2988
3029
  * Flatten the translation property paths for faster lookup.
@@ -3003,6 +3044,24 @@ class I18n {
3003
3044
  }
3004
3045
  }
3005
3046
  }
3047
+ /**
3048
+ * Get the I18n shared data.
3049
+ * @returns The I18n shared data.
3050
+ * @internal
3051
+ */
3052
+ static getI18nShared() {
3053
+ let i18nShared = SharedStore.get("i18n");
3054
+ if (Is.undefined(i18nShared)) {
3055
+ i18nShared = {
3056
+ localeDictionaries: {},
3057
+ currentLocale: I18n.DEFAULT_LOCALE,
3058
+ localeChangedHandlers: {},
3059
+ dictionaryChangedHandlers: {}
3060
+ };
3061
+ SharedStore.set("i18n", i18nShared);
3062
+ }
3063
+ return i18nShared;
3064
+ }
3006
3065
  }
3007
3066
 
3008
3067
  // Copyright 2024 IOTA Stiftung.
@@ -3940,11 +3999,6 @@ class Urn {
3940
3999
  * Cache the results from asynchronous requests.
3941
4000
  */
3942
4001
  class AsyncCache {
3943
- /**
3944
- * Cache for the fetch requests.
3945
- * @internal
3946
- */
3947
- static _cache = {};
3948
4002
  /**
3949
4003
  * Execute an async request and cache the result.
3950
4004
  * @param key The key for the entry in the cache.
@@ -3956,13 +4010,14 @@ class AsyncCache {
3956
4010
  const cacheEnabled = Is.integer(ttlMs) && ttlMs >= 0;
3957
4011
  if (cacheEnabled) {
3958
4012
  AsyncCache.cleanupExpired();
3959
- if (!this._cache[key]) {
3960
- this._cache[key] = {
4013
+ const cache = AsyncCache.getSharedCache();
4014
+ if (!cache[key]) {
4015
+ cache[key] = {
3961
4016
  response: requestMethod(),
3962
4017
  expires: ttlMs === 0 ? 0 : Date.now() + ttlMs
3963
4018
  };
3964
4019
  }
3965
- return this._cache[key].response;
4020
+ return cache[key].response;
3966
4021
  }
3967
4022
  }
3968
4023
  /**
@@ -3971,7 +4026,8 @@ class AsyncCache {
3971
4026
  * @returns The item from the cache if it exists.
3972
4027
  */
3973
4028
  static async get(key) {
3974
- return AsyncCache._cache[key]?.response;
4029
+ const cache = AsyncCache.getSharedCache();
4030
+ return cache[key]?.response;
3975
4031
  }
3976
4032
  /**
3977
4033
  * Set an entry into the cache.
@@ -3981,7 +4037,8 @@ class AsyncCache {
3981
4037
  * @returns Nothing.
3982
4038
  */
3983
4039
  static async set(key, value, ttlMs) {
3984
- AsyncCache._cache[key] = {
4040
+ const cache = AsyncCache.getSharedCache();
4041
+ cache[key] = {
3985
4042
  response: Promise.resolve(value),
3986
4043
  expires: Date.now() + (ttlMs ?? 1000)
3987
4044
  };
@@ -3991,34 +4048,50 @@ class AsyncCache {
3991
4048
  * @param key The key to remove from the cache.
3992
4049
  */
3993
4050
  static remove(key) {
3994
- delete AsyncCache._cache[key];
4051
+ const cache = AsyncCache.getSharedCache();
4052
+ delete cache[key];
3995
4053
  }
3996
4054
  /**
3997
4055
  * Clear the cache.
3998
4056
  * @param prefix Optional prefix to clear only entries with that prefix.
3999
4057
  */
4000
4058
  static clearCache(prefix) {
4059
+ const cache = AsyncCache.getSharedCache();
4001
4060
  if (Is.stringValue(prefix)) {
4002
- for (const entry in this._cache) {
4061
+ for (const entry in cache) {
4003
4062
  if (entry.startsWith(prefix)) {
4004
- delete this._cache[entry];
4063
+ delete cache[entry];
4005
4064
  }
4006
4065
  }
4007
4066
  }
4008
4067
  else {
4009
- AsyncCache._cache = {};
4068
+ SharedStore.set("asyncCache", {});
4010
4069
  }
4011
4070
  }
4012
4071
  /**
4013
4072
  * Perform a cleanup of the expired entries in the cache.
4014
4073
  */
4015
4074
  static cleanupExpired() {
4016
- for (const entry in this._cache) {
4017
- if (AsyncCache._cache[entry].expires > 0 && AsyncCache._cache[entry].expires < Date.now()) {
4018
- delete this._cache[entry];
4075
+ const cache = AsyncCache.getSharedCache();
4076
+ for (const entry in cache) {
4077
+ if (cache[entry].expires > 0 && cache[entry].expires < Date.now()) {
4078
+ delete cache[entry];
4019
4079
  }
4020
4080
  }
4021
4081
  }
4082
+ /**
4083
+ * Get the shared cache.
4084
+ * @returns The shared cache.
4085
+ * @internal
4086
+ */
4087
+ static getSharedCache() {
4088
+ let sharedCache = SharedStore.get("asyncCache");
4089
+ if (Is.undefined(sharedCache)) {
4090
+ sharedCache = {};
4091
+ SharedStore.set("asyncCache", sharedCache);
4092
+ }
4093
+ return sharedCache;
4094
+ }
4022
4095
  }
4023
4096
 
4024
4097
  /**
@@ -4842,4 +4915,4 @@ class Validation {
4842
4915
  }
4843
4916
  }
4844
4917
 
4845
- export { AlreadyExistsError, ArrayHelper, AsyncCache, Base32, Base58, Base64, Base64Url, BaseError, BitString, Coerce, CoerceType, ComponentFactory, Compression, CompressionType, ConflictError, Converter, EnvHelper, ErrorHelper, Factory, FilenameHelper, GeneralError, GuardError, Guards, HexHelper, I18n, Is, JsonHelper, NotFoundError, NotImplementedError, NotSupportedError, ObjectHelper, RandomHelper, StringHelper, Uint8ArrayHelper, UnauthorizedError, UnprocessableError, Url, Urn, Validation, ValidationError };
4918
+ export { AlreadyExistsError, ArrayHelper, AsyncCache, Base32, Base58, Base64, Base64Url, BaseError, BitString, Coerce, CoerceType, ComponentFactory, Compression, CompressionType, ConflictError, Converter, EnvHelper, ErrorHelper, Factory, FilenameHelper, GeneralError, GuardError, Guards, HexHelper, I18n, Is, JsonHelper, NotFoundError, NotImplementedError, NotSupportedError, ObjectHelper, RandomHelper, SharedStore, StringHelper, Uint8ArrayHelper, UnauthorizedError, UnprocessableError, Url, Urn, Validation, ValidationError };
@@ -29,6 +29,7 @@ export * from "./models/coerceType";
29
29
  export * from "./models/compressionType";
30
30
  export * from "./models/IComponent";
31
31
  export * from "./models/IError";
32
+ export * from "./models/II18nShared";
32
33
  export * from "./models/IKeyValue";
33
34
  export * from "./models/ILabelledValue";
34
35
  export * from "./models/ILocale";
@@ -47,4 +48,5 @@ export * from "./utils/converter";
47
48
  export * from "./utils/guards";
48
49
  export * from "./utils/i18n";
49
50
  export * from "./utils/is";
51
+ export * from "./utils/sharedStore";
50
52
  export * from "./utils/validation";
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The shared state for the I18n global.
3
+ */
4
+ export interface II18nShared {
5
+ /**
6
+ * Dictionaries for lookups.
7
+ */
8
+ localeDictionaries: {
9
+ [locale: string]: {
10
+ [key: string]: string;
11
+ };
12
+ };
13
+ /**
14
+ * The current locale.
15
+ */
16
+ currentLocale: string;
17
+ /**
18
+ * Change handler for the locale being updated.
19
+ */
20
+ localeChangedHandlers: {
21
+ [id: string]: (locale: string) => void;
22
+ };
23
+ /**
24
+ * Change handler for the dictionaries being updated.
25
+ */
26
+ dictionaryChangedHandlers: {
27
+ [id: string]: (locale: string) => void;
28
+ };
29
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Provide a store for shared objects which can be accesses through multiple
3
+ * instance loads of a packages.
4
+ */
5
+ export declare class SharedStore {
6
+ /**
7
+ * Get a property from the shared store.
8
+ * @param prop The name of the property to get.
9
+ * @returns The property if it exists.
10
+ */
11
+ static get<T = unknown>(prop: string): T | undefined;
12
+ /**
13
+ * Set the property in the shared store.
14
+ * @param prop The name of the property to set.
15
+ * @param value The value to set.
16
+ */
17
+ static set<T = unknown>(prop: string, value: T): void;
18
+ /**
19
+ * Remove a property from the shared store.
20
+ * @param prop The name of the property to remove.
21
+ */
22
+ static remove(prop: string): void;
23
+ }
package/docs/changelog.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @twin.org/core - Changelog
2
2
 
3
+ ## [0.0.1-next.52](https://github.com/twinfoundation/framework/compare/core-v0.0.1-next.51...core-v0.0.1-next.52) (2025-04-17)
4
+
5
+
6
+ ### Features
7
+
8
+ * use new shared store mechanism ([#131](https://github.com/twinfoundation/framework/issues/131)) ([934385b](https://github.com/twinfoundation/framework/commit/934385b2fbaf9f5c00a505ebf9d093bd5a425f55))
9
+
3
10
  ## [0.0.1-next.51](https://github.com/twinfoundation/framework/compare/core-v0.0.1-next.50...core-v0.0.1-next.51) (2025-03-27)
4
11
 
5
12
 
@@ -8,9 +8,9 @@ Class to handle errors which are triggered by data already existing.
8
8
 
9
9
  ## Constructors
10
10
 
11
- ### new AlreadyExistsError()
11
+ ### Constructor
12
12
 
13
- > **new AlreadyExistsError**(`source`, `message`, `existingId`?, `inner`?): [`AlreadyExistsError`](AlreadyExistsError.md)
13
+ > **new AlreadyExistsError**(`source`, `message`, `existingId?`, `inner?`): `AlreadyExistsError`
14
14
 
15
15
  Create a new instance of AlreadyExistsError.
16
16
 
@@ -42,11 +42,11 @@ The inner error if we have wrapped another error.
42
42
 
43
43
  #### Returns
44
44
 
45
- [`AlreadyExistsError`](AlreadyExistsError.md)
45
+ `AlreadyExistsError`
46
46
 
47
47
  #### Overrides
48
48
 
49
- [`BaseError`](BaseError.md).[`constructor`](BaseError.md#constructors)
49
+ [`BaseError`](BaseError.md).[`constructor`](BaseError.md#constructor)
50
50
 
51
51
  ## Properties
52
52
 
@@ -66,7 +66,7 @@ The source of the error.
66
66
 
67
67
  #### Inherited from
68
68
 
69
- [`BaseError`](BaseError.md).[`source`](BaseError.md#source-1)
69
+ [`BaseError`](BaseError.md).[`source`](BaseError.md#source)
70
70
 
71
71
  ***
72
72
 
@@ -82,7 +82,7 @@ Any additional information for the error.
82
82
 
83
83
  #### Inherited from
84
84
 
85
- [`BaseError`](BaseError.md).[`properties`](BaseError.md#properties-1)
85
+ [`BaseError`](BaseError.md).[`properties`](BaseError.md#properties)
86
86
 
87
87
  ***
88
88
 
@@ -94,7 +94,7 @@ The inner error if there was one.
94
94
 
95
95
  #### Inherited from
96
96
 
97
- [`BaseError`](BaseError.md).[`inner`](BaseError.md#inner-1)
97
+ [`BaseError`](BaseError.md).[`inner`](BaseError.md#inner)
98
98
 
99
99
  ## Methods
100
100
 
@@ -4,13 +4,13 @@ Class to help with arrays.
4
4
 
5
5
  ## Constructors
6
6
 
7
- ### new ArrayHelper()
7
+ ### Constructor
8
8
 
9
- > **new ArrayHelper**(): [`ArrayHelper`](ArrayHelper.md)
9
+ > **new ArrayHelper**(): `ArrayHelper`
10
10
 
11
11
  #### Returns
12
12
 
13
- [`ArrayHelper`](ArrayHelper.md)
13
+ `ArrayHelper`
14
14
 
15
15
  ## Methods
16
16
 
@@ -4,13 +4,13 @@ Cache the results from asynchronous requests.
4
4
 
5
5
  ## Constructors
6
6
 
7
- ### new AsyncCache()
7
+ ### Constructor
8
8
 
9
- > **new AsyncCache**(): [`AsyncCache`](AsyncCache.md)
9
+ > **new AsyncCache**(): `AsyncCache`
10
10
 
11
11
  #### Returns
12
12
 
13
- [`AsyncCache`](AsyncCache.md)
13
+ `AsyncCache`
14
14
 
15
15
  ## Methods
16
16
 
@@ -22,7 +22,9 @@ Execute an async request and cache the result.
22
22
 
23
23
  #### Type Parameters
24
24
 
25
- **T** = `unknown`
25
+ ##### T
26
+
27
+ `T` = `unknown`
26
28
 
27
29
  #### Parameters
28
30
 
@@ -60,7 +62,9 @@ Get an entry from the cache.
60
62
 
61
63
  #### Type Parameters
62
64
 
63
- **T** = `unknown`
65
+ ##### T
66
+
67
+ `T` = `unknown`
64
68
 
65
69
  #### Parameters
66
70
 
@@ -80,13 +84,15 @@ The item from the cache if it exists.
80
84
 
81
85
  ### set()
82
86
 
83
- > `static` **set**\<`T`\>(`key`, `value`, `ttlMs`?): `Promise`\<`void`\>
87
+ > `static` **set**\<`T`\>(`key`, `value`, `ttlMs?`): `Promise`\<`void`\>
84
88
 
85
89
  Set an entry into the cache.
86
90
 
87
91
  #### Type Parameters
88
92
 
89
- **T** = `unknown`
93
+ ##### T
94
+
95
+ `T` = `unknown`
90
96
 
91
97
  #### Parameters
92
98
 
@@ -138,7 +144,7 @@ The key to remove from the cache.
138
144
 
139
145
  ### clearCache()
140
146
 
141
- > `static` **clearCache**(`prefix`?): `void`
147
+ > `static` **clearCache**(`prefix?`): `void`
142
148
 
143
149
  Clear the cache.
144
150
 
@@ -4,13 +4,13 @@ Class to help with base63 Encoding/Decoding.
4
4
 
5
5
  ## Constructors
6
6
 
7
- ### new Base32()
7
+ ### Constructor
8
8
 
9
- > **new Base32**(): [`Base32`](Base32.md)
9
+ > **new Base32**(): `Base32`
10
10
 
11
11
  #### Returns
12
12
 
13
- [`Base32`](Base32.md)
13
+ `Base32`
14
14
 
15
15
  ## Methods
16
16
 
@@ -4,13 +4,13 @@ Class to help with base58 Encoding/Decoding.
4
4
 
5
5
  ## Constructors
6
6
 
7
- ### new Base58()
7
+ ### Constructor
8
8
 
9
- > **new Base58**(): [`Base58`](Base58.md)
9
+ > **new Base58**(): `Base58`
10
10
 
11
11
  #### Returns
12
12
 
13
- [`Base58`](Base58.md)
13
+ `Base58`
14
14
 
15
15
  ## Methods
16
16
 
@@ -5,13 +5,13 @@ Sourced from https://github.com/beatgammit/base64-js.
5
5
 
6
6
  ## Constructors
7
7
 
8
- ### new Base64()
8
+ ### Constructor
9
9
 
10
- > **new Base64**(): [`Base64`](Base64.md)
10
+ > **new Base64**(): `Base64`
11
11
 
12
12
  #### Returns
13
13
 
14
- [`Base64`](Base64.md)
14
+ `Base64`
15
15
 
16
16
  ## Methods
17
17