@tstdl/base 0.85.5 → 0.85.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tstdl/base",
3
- "version": "0.85.5",
3
+ "version": "0.85.7",
4
4
  "author": "Patrick Hein",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -58,7 +58,7 @@
58
58
  "koa": "^2.14",
59
59
  "minio": "^7.1",
60
60
  "mjml": "^4.14",
61
- "mongodb": "^5.6",
61
+ "mongodb": "^5.7",
62
62
  "nodemailer": "^6.9",
63
63
  "playwright": "^1.35",
64
64
  "preact": "^10.15",
@@ -60,7 +60,7 @@ class EffectManager {
60
60
  };
61
61
  }
62
62
  flush() {
63
- if (this.queue.size === 0) {
63
+ if (this.queue.size == 0) {
64
64
  return;
65
65
  }
66
66
  for (const watch of this.queue) {
@@ -2,3 +2,4 @@ export * from './api.js';
2
2
  export * from './computed-with-dependencies.js';
3
3
  export * from './effect-with-dependencies.js';
4
4
  export * from './pipe.js';
5
+ export * from './types.js';
package/signals/index.js CHANGED
@@ -19,3 +19,4 @@ __reExport(signals_exports, require("./api.js"), module.exports);
19
19
  __reExport(signals_exports, require("./computed-with-dependencies.js"), module.exports);
20
20
  __reExport(signals_exports, require("./effect-with-dependencies.js"), module.exports);
21
21
  __reExport(signals_exports, require("./pipe.js"), module.exports);
22
+ __reExport(signals_exports, require("./types.js"), module.exports);
@@ -0,0 +1,5 @@
1
+ import type { Signal } from './api.js';
2
+ export type UnwrappedSignal<T extends Signal<unknown>> = T extends Signal<infer U> ? U : never;
3
+ export type UnwrappedSignals<T extends readonly Signal<unknown>[]> = {
4
+ [P in keyof T]: UnwrappedSignal<T[P]>;
5
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
@@ -66,6 +66,8 @@ export declare class LocalizationService {
66
66
  #private;
67
67
  readonly activeLanguage: Signal<Language | null>;
68
68
  readonly availableLanguages: Signal<Language[]>;
69
+ readonly activeLanguage$: Observable<Language | null>;
70
+ readonly availableLanguages$: Observable<Language[]>;
69
71
  constructor(logger: Logger);
70
72
  registerLocalization(...localizations: Localization[]): void;
71
73
  hasLanguage(languageCode: string): boolean;
@@ -34,7 +34,6 @@ var import_container = require("../container/index.js");
34
34
  var import_details_error = require("../error/details.error.js");
35
35
  var import_logger = require("../logger/index.js");
36
36
  var import_api = require("../signals/api.js");
37
- var import_computed_with_dependencies = require("../signals/computed-with-dependencies.js");
38
37
  var import_enum = require("../utils/enum.js");
39
38
  var import_memoize = require("../utils/function/memoize.js");
40
39
  var import_object = require("../utils/object/object.js");
@@ -89,7 +88,7 @@ let LocalizationService = class LocalizationService2 {
89
88
  #activeLanguage = (0, import_api.signal)(null);
90
89
  #availableLanguages = (0, import_api.signal)([]);
91
90
  #activeLocalization = (0, import_api.computed)(() => {
92
- const language = this.activeLanguage();
91
+ const language = this.#activeLanguage();
93
92
  if ((0, import_type_guards.isNull)(language)) {
94
93
  return null;
95
94
  }
@@ -97,6 +96,8 @@ let LocalizationService = class LocalizationService2 {
97
96
  });
98
97
  activeLanguage = this.#activeLanguage.asReadonly();
99
98
  availableLanguages = this.#availableLanguages.asReadonly();
99
+ activeLanguage$ = (0, import_api.toObservable)(this.activeLanguage);
100
+ availableLanguages$ = (0, import_api.toObservable)(this.availableLanguages);
100
101
  constructor(logger) {
101
102
  this.#logger = logger;
102
103
  }
@@ -110,11 +111,11 @@ let LocalizationService = class LocalizationService2 {
110
111
  } else {
111
112
  this.#localizations.set(localization.language.code, mappedLocalization);
112
113
  }
113
- if ((0, import_type_guards.isUndefined)(this.activeLanguage)) {
114
- this.setLocalization(localization);
115
- }
116
114
  const availableLanguages = [...this.#localizations].map(([, loc]) => loc.language);
117
115
  this.#availableLanguages.set(availableLanguages);
116
+ if ((0, import_type_guards.isNullOrUndefined)(this.#activeLanguage())) {
117
+ this.setLanguage(localization.language.code);
118
+ }
118
119
  }
119
120
  }
120
121
  hasLanguage(languageCode) {
@@ -131,7 +132,7 @@ let LocalizationService = class LocalizationService2 {
131
132
  this.#activeLanguage.set(language);
132
133
  }
133
134
  setLocalization(localization) {
134
- this.setLanguage(localization.language);
135
+ this.setLanguage(localization.language.code);
135
136
  }
136
137
  tryGetItem(keyOrData) {
137
138
  const activeLanguageCode = this.#activeLanguage()?.code;
@@ -179,10 +180,10 @@ let LocalizationService = class LocalizationService2 {
179
180
  return this.localizeItem(key, item, parameters);
180
181
  }
181
182
  localize(data) {
182
- return (0, import_computed_with_dependencies.computedWithDependencies)(() => this.localizeOnce(data), [this.#activeLanguage]);
183
+ return (0, import_api.computed)(() => this.localizeOnce(data));
183
184
  }
184
185
  localizeEnum(enumeration, value, parameters) {
185
- return (0, import_computed_with_dependencies.computedWithDependencies)(() => this.localizeEnumOnce(enumeration, value, parameters), [this.#activeLanguage]);
186
+ return (0, import_api.computed)(() => this.localizeEnumOnce(enumeration, value, parameters));
186
187
  }
187
188
  localize$(data) {
188
189
  return (0, import_api.toObservable)(this.localize(data));