@kuzntsv/uikit 1.0.71 → 1.0.72
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.
|
@@ -2,7 +2,7 @@ import * as i0 from "@angular/core";
|
|
|
2
2
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, Directive, ElementRef, HostListener, Injectable, InjectionToken, Injector, NgZone, Pipe, computed, effect, inject, input, linkedSignal, makeEnvironmentProviders, model, output, signal, viewChild } from "@angular/core";
|
|
3
3
|
import { Router, RouterLink } from "@angular/router";
|
|
4
4
|
import { ReplaySubject, Subject, Subscription, filter, finalize, forkJoin, map, of, startWith, switchMap, take, tap } from "rxjs";
|
|
5
|
-
import { API_NAME, AuthService, HIDE_ROLE_MARKER, NotificationService, RoleService, UIKIT_NOTIFICATION_TOKEN } from "@kuzntsv/uikit";
|
|
5
|
+
import { API_NAME, AuthService, HIDE_ROLE_MARKER, NotificationService, RoleService, UIKIT_NOTIFICATION_TOKEN, formatZodError } from "@kuzntsv/uikit";
|
|
6
6
|
import * as i1$1 from "@angular/forms";
|
|
7
7
|
import { FormControl, FormGroup, FormsModule, NgControl, ReactiveFormsModule, Validators } from "@angular/forms";
|
|
8
8
|
import { MatAnchor, MatButton, MatIconButton } from "@angular/material/button";
|
|
@@ -3145,7 +3145,7 @@ var BaseSignalServiceClass = class BaseSignalServiceClass {
|
|
|
3145
3145
|
defaultValue: [],
|
|
3146
3146
|
parse: (data) => {
|
|
3147
3147
|
if (!data) return [];
|
|
3148
|
-
return z.array(this.schema)
|
|
3148
|
+
return this.safeParseData(z.array(this.schema), data);
|
|
3149
3149
|
}
|
|
3150
3150
|
});
|
|
3151
3151
|
}
|
|
@@ -3161,7 +3161,7 @@ var BaseSignalServiceClass = class BaseSignalServiceClass {
|
|
|
3161
3161
|
defaultValue: null,
|
|
3162
3162
|
parse: (data) => {
|
|
3163
3163
|
if (!data) return null;
|
|
3164
|
-
return this.schema
|
|
3164
|
+
return this.safeParseData(this.schema, data);
|
|
3165
3165
|
}
|
|
3166
3166
|
});
|
|
3167
3167
|
}
|
|
@@ -3188,7 +3188,7 @@ var BaseSignalServiceClass = class BaseSignalServiceClass {
|
|
|
3188
3188
|
defaultValue: [],
|
|
3189
3189
|
parse: (data) => {
|
|
3190
3190
|
if (!data) return [];
|
|
3191
|
-
return z.array(this.schema)
|
|
3191
|
+
return this.safeParseData(z.array(this.schema), data);
|
|
3192
3192
|
}
|
|
3193
3193
|
});
|
|
3194
3194
|
}
|
|
@@ -3210,7 +3210,7 @@ var BaseSignalServiceClass = class BaseSignalServiceClass {
|
|
|
3210
3210
|
defaultValue: [],
|
|
3211
3211
|
parse: (data) => {
|
|
3212
3212
|
if (!data) return [];
|
|
3213
|
-
return z.array(this.schema)
|
|
3213
|
+
return this.safeParseData(z.array(this.schema), data);
|
|
3214
3214
|
}
|
|
3215
3215
|
});
|
|
3216
3216
|
}
|
|
@@ -3260,6 +3260,14 @@ var BaseSignalServiceClass = class BaseSignalServiceClass {
|
|
|
3260
3260
|
if (!this.apiContextName) return {};
|
|
3261
3261
|
return { context: new HttpContext().set(API_NAME, this.apiContextName) };
|
|
3262
3262
|
}
|
|
3263
|
+
safeParseData(schema, data) {
|
|
3264
|
+
const result = schema.safeParse(data);
|
|
3265
|
+
if (!result.success) {
|
|
3266
|
+
const formattedErrorMessage = formatZodError(result.error);
|
|
3267
|
+
throw new Error(formattedErrorMessage);
|
|
3268
|
+
}
|
|
3269
|
+
return result.data;
|
|
3270
|
+
}
|
|
3263
3271
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
3264
3272
|
minVersion: "12.0.0",
|
|
3265
3273
|
version: "22.2.2",
|