@tstdl/base 0.92.95 → 0.92.97
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/cookie/cookie.d.ts +1 -0
- package/cookie/cookie.js +14 -3
- package/document-management/server/services/document-management.service.js +0 -1
- package/orm/server/repository.d.ts +1 -1
- package/orm/server/repository.js +9 -6
- package/orm/types.d.ts +2 -2
- package/orm/types.js +2 -2
- package/package.json +3 -3
- package/sse/server-sent-events.js +1 -1
package/cookie/cookie.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export type SetCookieOptions = {
|
|
|
8
8
|
partitioned?: boolean;
|
|
9
9
|
path?: string;
|
|
10
10
|
sameSite?: 'strict' | 'lax' | 'none';
|
|
11
|
+
priority?: 'low' | 'medium' | 'high';
|
|
11
12
|
secure?: boolean;
|
|
12
13
|
};
|
|
13
14
|
export declare function formatSetCookie(name: string, value: string, options?: SetCookieOptions): string;
|
package/cookie/cookie.js
CHANGED
|
@@ -6,9 +6,13 @@ const sameSiteMap = {
|
|
|
6
6
|
lax: 'Lax',
|
|
7
7
|
strict: 'Strict'
|
|
8
8
|
};
|
|
9
|
+
const priorityMap = {
|
|
10
|
+
low: 'Low',
|
|
11
|
+
medium: 'Medium',
|
|
12
|
+
high: 'High'
|
|
13
|
+
};
|
|
9
14
|
export function formatSetCookie(name, value, options = {}) {
|
|
10
|
-
|
|
11
|
-
let cookie = `${name}="${encodedValue}"`;
|
|
15
|
+
let cookie = `${name}=${encodeURIComponent(value)}`;
|
|
12
16
|
if (isDefined(options.domain)) {
|
|
13
17
|
cookie = `${cookie}; Domain=${options.domain}`;
|
|
14
18
|
}
|
|
@@ -31,10 +35,17 @@ export function formatSetCookie(name, value, options = {}) {
|
|
|
31
35
|
if (isDefined(options.sameSite)) {
|
|
32
36
|
const sameSiteValue = sameSiteMap[options.sameSite];
|
|
33
37
|
if (isUndefined(sameSiteValue)) {
|
|
34
|
-
throw new NotSupportedError(`Unknown option
|
|
38
|
+
throw new NotSupportedError(`Unknown option sameSite "${options.sameSite}".`);
|
|
35
39
|
}
|
|
36
40
|
cookie = `${cookie}; SameSite=${sameSiteValue}`;
|
|
37
41
|
}
|
|
42
|
+
if (isDefined(options.priority)) {
|
|
43
|
+
const priorityValue = priorityMap[options.priority];
|
|
44
|
+
if (isUndefined(priorityValue)) {
|
|
45
|
+
throw new NotSupportedError(`Unknown option priority "${options.priority}".`);
|
|
46
|
+
}
|
|
47
|
+
cookie = `${cookie}; Priority=${priorityValue}`;
|
|
48
|
+
}
|
|
38
49
|
if (isDefined(options.secure) && options.secure) {
|
|
39
50
|
cookie = `${cookie}; Secure`;
|
|
40
51
|
}
|
|
@@ -801,7 +801,6 @@ Antworte auf deutsch.`
|
|
|
801
801
|
DocumentManagementService = DocumentManagementService_1 = __decorate([
|
|
802
802
|
Singleton({
|
|
803
803
|
providers: [
|
|
804
|
-
provide(EntityRepositoryConfig, { useValue: { schema: 'document_management' } }),
|
|
805
804
|
{ provide: DatabaseConfig, useFactory: (_, context) => context.resolve(DocumentManagementConfig).database ?? context.resolve(DatabaseConfig, undefined, { skipSelf: true }) }
|
|
806
805
|
]
|
|
807
806
|
})
|
|
@@ -76,7 +76,7 @@ export declare class EntityRepository<T extends Entity | EntityWithoutMetadata =
|
|
|
76
76
|
hardDeleteMany(ids: string[]): Promise<T[]>;
|
|
77
77
|
hardDeleteManyByQuery(query: Query<T>): Promise<T[]>;
|
|
78
78
|
getColumn(pathOrColumn: Paths<UntaggedDeep<T>> | ColumnDefinition): PgColumn;
|
|
79
|
-
convertOrderBy(
|
|
79
|
+
convertOrderBy(order: Order<T>): SQL[];
|
|
80
80
|
convertQuery(query: Query<T>): SQL;
|
|
81
81
|
mapManyToEntity(columns: InferSelect[]): Promise<T[]>;
|
|
82
82
|
mapToEntity(columns: InferSelect): Promise<T>;
|
package/orm/server/repository.js
CHANGED
|
@@ -46,7 +46,7 @@ let EntityRepository = class EntityRepository {
|
|
|
46
46
|
#transformContext = this.#context.transformContext;
|
|
47
47
|
type = this.#context.type ?? injectArgument(this, { optional: true }) ?? assertDefinedPass(this.constructor[entityTypeToken], 'Missing entity type.');
|
|
48
48
|
typeName = this.type.entityName ?? this.type.name;
|
|
49
|
-
#table = this.#context.table ?? getDrizzleTableFromType(this.type, inject(EntityRepositoryConfig)
|
|
49
|
+
#table = this.#context.table ?? getDrizzleTableFromType(this.type, inject(EntityRepositoryConfig, undefined, { optional: true })?.schema);
|
|
50
50
|
#tableWithMetadata = this.#table;
|
|
51
51
|
#columnDefinitions = this.#context.columnDefinitions ?? getColumnDefinitions(this.#table);
|
|
52
52
|
#columnDefinitionsMap = this.#context.columnDefinitionsMap ?? new Map(this.#columnDefinitions.map((column) => [column.objectPath.path, column]));
|
|
@@ -434,9 +434,9 @@ let EntityRepository = class EntityRepository {
|
|
|
434
434
|
}
|
|
435
435
|
return this.#table[pathOrColumn.name];
|
|
436
436
|
}
|
|
437
|
-
convertOrderBy(
|
|
438
|
-
if (isArray(
|
|
439
|
-
return
|
|
437
|
+
convertOrderBy(order) {
|
|
438
|
+
if (isArray(order)) {
|
|
439
|
+
return order.map((item) => {
|
|
440
440
|
const itemIsArray = isArray(item);
|
|
441
441
|
const target = itemIsArray ? item[0] : item;
|
|
442
442
|
const column = isSQLWrapper(target) ? target : this.getColumn(target);
|
|
@@ -444,8 +444,11 @@ let EntityRepository = class EntityRepository {
|
|
|
444
444
|
return direction == 'asc' ? asc(column) : desc(column);
|
|
445
445
|
});
|
|
446
446
|
}
|
|
447
|
-
|
|
448
|
-
.
|
|
447
|
+
if (isString(order)) {
|
|
448
|
+
const column = this.getColumn(order);
|
|
449
|
+
return [asc(column)];
|
|
450
|
+
}
|
|
451
|
+
return objectEntries(order).map(([path, direction]) => {
|
|
449
452
|
const column = this.getColumn(path);
|
|
450
453
|
return direction == 'asc' ? asc(column) : desc(column);
|
|
451
454
|
});
|
package/orm/types.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Array, Integer } from '../schema/index.js';
|
|
|
4
4
|
import type { AbstractConstructor, EnumerationObject, EnumerationValue, ObjectLiteral, UnionToTuple } from '../types.js';
|
|
5
5
|
import type { GetTagMetadata, HasTag, Tagged, UnwrapTagged } from '../types/index.js';
|
|
6
6
|
import type { bytea, numericDate, timestamp } from './data-types/index.js';
|
|
7
|
-
import { Check, Column, Embedded, Encrypted, Index, PrimaryKey, References, Unique } from './decorators.js';
|
|
7
|
+
import { Check, Column, Embedded, Encrypted, Index, PrimaryKey, References, Table, Unique } from './decorators.js';
|
|
8
8
|
import { Json, NumericDate, Timestamp, Uuid } from './schemas/index.js';
|
|
9
9
|
export type ColumnTypeTag = 'column';
|
|
10
10
|
export type EmbeddedConfigTag = 'embedded';
|
|
@@ -27,4 +27,4 @@ export type NumericDate = Tagged<number, ColumnTypeTag, ReturnType<typeof numeri
|
|
|
27
27
|
export type Timestamp = Tagged<number, ColumnTypeTag, ReturnType<typeof timestamp>>;
|
|
28
28
|
export type Bytea = Tagged<Uint8Array, ColumnTypeTag, ReturnType<typeof bytea>>;
|
|
29
29
|
export type Encrypted<T> = Tagged<T, ColumnTypeTag, ReturnType<typeof bytea>>;
|
|
30
|
-
export { Array, Check, Column, Embedded, Encrypted, Index, Integer, Json, NumericDate, PrimaryKey, References, Timestamp, Unique, Uuid };
|
|
30
|
+
export { Array, Check, Column, Embedded, Encrypted, Index, Integer, Json, NumericDate, PrimaryKey, References, Table, Timestamp, Unique, Uuid };
|
package/orm/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Array, Integer } from '../schema/index.js';
|
|
2
|
-
import { Check, Column, Embedded, Encrypted, Index, PrimaryKey, References, Unique } from './decorators.js';
|
|
2
|
+
import { Check, Column, Embedded, Encrypted, Index, PrimaryKey, References, Table, Unique } from './decorators.js';
|
|
3
3
|
import { Json, NumericDate, Timestamp, Uuid } from './schemas/index.js';
|
|
4
|
-
export { Array, Check, Column, Embedded, Encrypted, Index, Integer, Json, NumericDate, PrimaryKey, References, Timestamp, Unique, Uuid };
|
|
4
|
+
export { Array, Check, Column, Embedded, Encrypted, Index, Integer, Json, NumericDate, PrimaryKey, References, Table, Timestamp, Unique, Uuid };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.92.
|
|
3
|
+
"version": "0.92.97",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
"@typescript-eslint/eslint-plugin": "8.26",
|
|
154
154
|
"concurrently": "9.1",
|
|
155
155
|
"drizzle-kit": "0.30",
|
|
156
|
-
"eslint": "9.
|
|
156
|
+
"eslint": "9.22",
|
|
157
157
|
"globals": "16.0",
|
|
158
158
|
"tsc-alias": "1.8",
|
|
159
159
|
"typescript": "5.8"
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
"mjml": "^4.15",
|
|
174
174
|
"mongodb": "^6.14",
|
|
175
175
|
"nodemailer": "^6.10",
|
|
176
|
-
"pg": "^8.
|
|
176
|
+
"pg": "^8.14",
|
|
177
177
|
"playwright": "^1.51",
|
|
178
178
|
"preact": "^10.26",
|
|
179
179
|
"preact-render-to-string": "^6.5",
|
|
@@ -77,7 +77,7 @@ export class ServerSentEvents {
|
|
|
77
77
|
constructor(url, options) {
|
|
78
78
|
this.eventSource = new EventSource(url, options);
|
|
79
79
|
this.closeSubject = new ReplaySubject(1);
|
|
80
|
-
const open$ = fromEvent(this.eventSource, 'open');
|
|
80
|
+
const open$ = fromEvent(this.eventSource, 'open').pipe(takeUntil(this.close$));
|
|
81
81
|
this.close$ = this.closeSubject.asObservable();
|
|
82
82
|
this.error$ = fromEvent(this.eventSource, 'error').pipe(takeUntil(this.close$), share());
|
|
83
83
|
this.state$ = merge(open$, this.error$, this.close$).pipe(startWith(undefined), map(() => this.state), distinctUntilChanged(), shareReplay({ bufferSize: 1, refCount: true }));
|