@tstdl/base 0.92.118 → 0.92.120
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/api/index.d.ts
CHANGED
package/api/index.js
CHANGED
|
@@ -392,7 +392,7 @@ export declare const documentManagementApiDefinition: {
|
|
|
392
392
|
};
|
|
393
393
|
};
|
|
394
394
|
};
|
|
395
|
-
declare const _DocumentManagementApi: import("../../api/index.js").ApiClient<{
|
|
395
|
+
declare const _DocumentManagementApi: import("../../api/client/index.js").ApiClient<{
|
|
396
396
|
resource: string;
|
|
397
397
|
endpoints: {
|
|
398
398
|
loadData: {
|
|
@@ -4,7 +4,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { compileClient
|
|
7
|
+
import { compileClient } from '../../api/client/index.js';
|
|
8
|
+
import { defineApi } from '../../api/index.js';
|
|
8
9
|
import { ReplaceClass } from '../../injector/decorators.js';
|
|
9
10
|
import { boolean, literal, nullable, object, optional, string } from '../../schema/index.js';
|
|
10
11
|
import { megabyte } from '../../utils/units.js';
|
package/formats.d.ts
CHANGED
|
@@ -26,20 +26,22 @@ export declare function formatDate(dateOrTimestamp: number | Date): string;
|
|
|
26
26
|
export declare function formatNumericDate(numericDate: number): string;
|
|
27
27
|
export declare function formatEuro(value: number): string;
|
|
28
28
|
export declare function formatPercent(value: number): string;
|
|
29
|
-
export type FormatPersonNameOptions = {
|
|
29
|
+
export type FormatPersonNameOptions<F = unknown> = {
|
|
30
30
|
lastNameFirst?: boolean;
|
|
31
|
-
|
|
31
|
+
fallback?: F;
|
|
32
32
|
};
|
|
33
|
+
export declare function formatPersonName<F>(person: {
|
|
34
|
+
firstName?: string | null;
|
|
35
|
+
lastName?: string | null;
|
|
36
|
+
} | null | undefined, options: FormatPersonNameOptions<F> & {
|
|
37
|
+
fallback: F;
|
|
38
|
+
}): string | F;
|
|
33
39
|
export declare function formatPersonName(person: {
|
|
34
|
-
firstName
|
|
35
|
-
lastName
|
|
36
|
-
} | null | undefined, options
|
|
37
|
-
|
|
38
|
-
}): string
|
|
39
|
-
export declare function formatPersonName(person: {
|
|
40
|
-
firstName: string;
|
|
41
|
-
lastName: string | null;
|
|
42
|
-
} | null | undefined, options?: FormatPersonNameOptions): string;
|
|
40
|
+
firstName?: string | null;
|
|
41
|
+
lastName?: string | null;
|
|
42
|
+
} | null | undefined, options?: FormatPersonNameOptions & {
|
|
43
|
+
fallback?: undefined;
|
|
44
|
+
}): string;
|
|
43
45
|
/**
|
|
44
46
|
* @deprecated use {@link formatPersonName} instead
|
|
45
47
|
*/
|
package/formats.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { numericDateToTimestamp } from './utils/date-time.js';
|
|
2
2
|
import { memoize, memoizeSingle } from './utils/function/memoize.js';
|
|
3
|
-
import {
|
|
3
|
+
import { isNullOrUndefined, isUndefined } from './utils/type-guards.js';
|
|
4
4
|
export let locale = 'de-DE';
|
|
5
5
|
export function configureFormats(options) {
|
|
6
6
|
locale = options.locale ?? locale;
|
|
@@ -120,12 +120,9 @@ export function formatEuro(value) {
|
|
|
120
120
|
export function formatPercent(value) {
|
|
121
121
|
return percentFormatter(locale).format(value);
|
|
122
122
|
}
|
|
123
|
-
export function formatPersonName(person, { lastNameFirst = false,
|
|
124
|
-
if (isNullOrUndefined(person)) {
|
|
125
|
-
return
|
|
126
|
-
}
|
|
127
|
-
if (isNull(person.lastName)) {
|
|
128
|
-
return person.firstName;
|
|
123
|
+
export function formatPersonName(person, { lastNameFirst = false, fallback } = {}) {
|
|
124
|
+
if (isNullOrUndefined(person?.firstName) || isNullOrUndefined(person.lastName)) {
|
|
125
|
+
return person?.firstName ?? person?.lastName ?? fallback ?? '-';
|
|
129
126
|
}
|
|
130
127
|
if (lastNameFirst) {
|
|
131
128
|
return `${person.lastName}, ${person.firstName}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.92.
|
|
3
|
+
"version": "0.92.120",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
"./web-types": "./web-types.js",
|
|
44
44
|
"./ai": "./ai/index.js",
|
|
45
45
|
"./api": "./api/index.js",
|
|
46
|
+
"./api/client": "./api/client/index.js",
|
|
47
|
+
"./api/server": "./api/server/index.js",
|
|
46
48
|
"./application": "./application/index.js",
|
|
47
49
|
"./authentication": "./authentication/index.js",
|
|
48
50
|
"./authentication/server": "./authentication/server/index.js",
|