@tstdl/base 0.90.43 → 0.90.46
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/examples/api/basic-overview.js +4 -4
- package/examples/api/streaming.js +1 -1
- package/mail/clients/nodemailer.mail-client.d.ts +1 -2
- package/mail/clients/nodemailer.mail-client.js +3 -3
- package/mail/mail.service.d.ts +2 -6
- package/mail/mail.service.js +18 -16
- package/package.json +9 -11
- package/rxjs/index.d.ts +1 -0
- package/rxjs/index.js +1 -0
- package/rxjs/reject-error.d.ts +2 -0
- package/rxjs/reject-error.js +9 -0
- package/signals/pipe.d.ts +3 -22
- package/signals/pipe.js +4 -10
- package/utils/timing.js +1 -1
|
@@ -38,11 +38,11 @@ const users = [
|
|
|
38
38
|
{ id: 3, name: 'Bob' }
|
|
39
39
|
];
|
|
40
40
|
const usersApiDefinition = defineApi({
|
|
41
|
-
resource: 'users',
|
|
41
|
+
resource: 'users', // /api/:version/users
|
|
42
42
|
endpoints: {
|
|
43
43
|
load: {
|
|
44
|
-
method: 'GET',
|
|
45
|
-
resource: ':id',
|
|
44
|
+
method: 'GET', // GET is default
|
|
45
|
+
resource: ':id', // => /api/v1/users/:id
|
|
46
46
|
version: 1,
|
|
47
47
|
parameters: object({
|
|
48
48
|
id: number({ coerce: true })
|
|
@@ -54,7 +54,7 @@ const usersApiDefinition = defineApi({
|
|
|
54
54
|
},
|
|
55
55
|
delete: {
|
|
56
56
|
method: 'DELETE',
|
|
57
|
-
resource: ':id',
|
|
57
|
+
resource: ':id', // => /api/v1/users/:id
|
|
58
58
|
parameters: object({
|
|
59
59
|
id: number({ coerce: true })
|
|
60
60
|
}),
|
|
@@ -26,7 +26,7 @@ import { Agent } from 'undici';
|
|
|
26
26
|
configureTstdl();
|
|
27
27
|
const logger = getGlobalInjector().resolve(CORE_LOGGER);
|
|
28
28
|
const streamingApiDefinition = defineApi({
|
|
29
|
-
resource: 'streams',
|
|
29
|
+
resource: 'streams', // /api/:version/users
|
|
30
30
|
endpoints: {
|
|
31
31
|
echo: {
|
|
32
32
|
method: 'POST',
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Disposable } from '../../disposable/disposable.js';
|
|
2
|
-
import
|
|
3
|
-
import { MailClient } from '../mail.client.js';
|
|
2
|
+
import { MailClient, MailClientConfig } from '../mail.client.js';
|
|
4
3
|
import type { MailData, MailSendResult } from '../models/index.js';
|
|
5
4
|
export declare class NodemailerMailClient extends MailClient implements Disposable {
|
|
6
5
|
#private;
|
|
@@ -5,14 +5,14 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { createTransport } from 'nodemailer';
|
|
8
|
-
import { Singleton, injectArgument } from '../../injector/index.js';
|
|
8
|
+
import { Singleton, inject, injectArgument } from '../../injector/index.js';
|
|
9
9
|
import { Injector } from '../../injector/injector.js';
|
|
10
10
|
import { assertDefined, isUndefined } from '../../utils/type-guards.js';
|
|
11
|
-
import { MailClient } from '../mail.client.js';
|
|
11
|
+
import { MailClient, MailClientConfig } from '../mail.client.js';
|
|
12
12
|
let NodemailerMailClient = class NodemailerMailClient extends MailClient {
|
|
13
13
|
#stack = new DisposableStack();
|
|
14
14
|
#transports = new Map();
|
|
15
|
-
#defaultClientConfig = injectArgument(this, { optional: true });
|
|
15
|
+
#defaultClientConfig = injectArgument(this, { optional: true }) ?? inject(MailClientConfig, undefined, { optional: true });
|
|
16
16
|
[Symbol.dispose]() {
|
|
17
17
|
this.#stack.dispose();
|
|
18
18
|
}
|
package/mail/mail.service.d.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import type { TypedOmit } from '../types.js';
|
|
2
|
-
import
|
|
2
|
+
import { MailClientConfig } from './mail.client.js';
|
|
3
3
|
import type { MailData, MailSendResult, MailTemplate } from './models/index.js';
|
|
4
4
|
export declare class MailService {
|
|
5
|
-
private
|
|
6
|
-
private readonly templateService;
|
|
7
|
-
private readonly mailLogRepository;
|
|
8
|
-
private readonly defaultData;
|
|
9
|
-
private readonly logger;
|
|
5
|
+
#private;
|
|
10
6
|
send(mailData: MailData, clientConfig?: MailClientConfig): Promise<MailSendResult>;
|
|
11
7
|
/** @deprecated internal */
|
|
12
8
|
send(mailData: MailData, clientConfig?: MailClientConfig, templateName?: string): Promise<MailSendResult>;
|
package/mail/mail.service.js
CHANGED
|
@@ -9,22 +9,24 @@ import { Logger } from '../logger/index.js';
|
|
|
9
9
|
import { TemplateService } from '../templates/template.service.js';
|
|
10
10
|
import { currentTimestamp } from '../utils/date-time.js';
|
|
11
11
|
import { formatError } from '../utils/format-error.js';
|
|
12
|
-
import { isDefined } from '../utils/type-guards.js';
|
|
13
|
-
import { MailClient } from './mail.client.js';
|
|
12
|
+
import { assertDefined, isDefined } from '../utils/type-guards.js';
|
|
13
|
+
import { MailClient, MailClientConfig } from './mail.client.js';
|
|
14
14
|
import { MailLogRepository } from './repositories/mail-log.repository.js';
|
|
15
15
|
import { MAIL_DEFAULT_DATA } from './tokens.js';
|
|
16
16
|
let MailService = class MailService {
|
|
17
|
-
mailClient = inject(MailClient);
|
|
18
|
-
templateService = inject(TemplateService);
|
|
19
|
-
mailLogRepository = inject(MailLogRepository, undefined, { optional: true });
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
#mailClient = inject(MailClient);
|
|
18
|
+
#templateService = inject(TemplateService);
|
|
19
|
+
#mailLogRepository = inject(MailLogRepository, undefined, { optional: true });
|
|
20
|
+
#defaultClientConfig = inject(MailClientConfig, undefined, { optional: true });
|
|
21
|
+
#defaultData = inject(MAIL_DEFAULT_DATA, undefined, { optional: true });
|
|
22
|
+
#logger = inject(Logger, 'MailService');
|
|
22
23
|
async send(mailData, clientConfigOrTemplateName, templateNameOrNothing) {
|
|
23
|
-
const clientConfig = (typeof clientConfigOrTemplateName == 'object') ? clientConfigOrTemplateName :
|
|
24
|
+
const clientConfig = (typeof clientConfigOrTemplateName == 'object') ? clientConfigOrTemplateName : this.#defaultClientConfig;
|
|
24
25
|
const templateName = (typeof clientConfigOrTemplateName == 'object') ? templateNameOrNothing : clientConfigOrTemplateName;
|
|
25
|
-
|
|
26
|
+
assertDefined(clientConfig, 'No mail client config provided.');
|
|
27
|
+
const data = { ...this.#defaultData, ...mailData };
|
|
26
28
|
let mailLog;
|
|
27
|
-
if (isDefined(this
|
|
29
|
+
if (isDefined(this.#mailLogRepository)) {
|
|
28
30
|
const log = {
|
|
29
31
|
timestamp: currentTimestamp(),
|
|
30
32
|
template: templateName ?? null,
|
|
@@ -32,29 +34,29 @@ let MailService = class MailService {
|
|
|
32
34
|
sendResult: null,
|
|
33
35
|
errors: null
|
|
34
36
|
};
|
|
35
|
-
mailLog = await this
|
|
37
|
+
mailLog = await this.#mailLogRepository.insert(log);
|
|
36
38
|
}
|
|
37
39
|
try {
|
|
38
|
-
const result = await this
|
|
40
|
+
const result = await this.#mailClient.send(data, clientConfig);
|
|
39
41
|
if (isDefined(mailLog)) {
|
|
40
|
-
await this
|
|
42
|
+
await this.#mailLogRepository.patch(mailLog, { sendResult: result });
|
|
41
43
|
}
|
|
42
44
|
return result;
|
|
43
45
|
}
|
|
44
46
|
catch (error) {
|
|
45
47
|
try {
|
|
46
48
|
if (isDefined(mailLog)) {
|
|
47
|
-
await this
|
|
49
|
+
await this.#mailLogRepository.patch(mailLog, { errors: [formatError(error)] });
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
catch (logError) {
|
|
51
|
-
this
|
|
53
|
+
this.#logger.error(logError);
|
|
52
54
|
}
|
|
53
55
|
throw error;
|
|
54
56
|
}
|
|
55
57
|
}
|
|
56
58
|
async sendTemplate(keyOrTemplate, mailData, templateContext, clientConfig) {
|
|
57
|
-
const { name, fields: { subject, html, text } } = await this
|
|
59
|
+
const { name, fields: { subject, html, text } } = await this.#templateService.render(keyOrTemplate, templateContext);
|
|
58
60
|
const fullMailData = { ...mailData, subject, content: { html, text } };
|
|
59
61
|
return this.send(fullMailData, clientConfig, name);
|
|
60
62
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tstdl/base",
|
|
3
|
-
"version": "0.90.
|
|
3
|
+
"version": "0.90.46",
|
|
4
4
|
"author": "Patrick Hein",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
},
|
|
21
21
|
"exports": {
|
|
22
22
|
"./tsconfig.json": "./tsconfig.json",
|
|
23
|
-
|
|
24
23
|
".": "./index.js",
|
|
25
24
|
"./environment": "./environment.js",
|
|
26
25
|
"./interfaces": "./interfaces.js",
|
|
@@ -30,7 +29,6 @@
|
|
|
30
29
|
"./tokens": "./tokens.js",
|
|
31
30
|
"./types": "./types.js",
|
|
32
31
|
"./web-types": "./web-types.js",
|
|
33
|
-
|
|
34
32
|
"./api": "./api/index.js",
|
|
35
33
|
"./application": "./application/index.js",
|
|
36
34
|
"./authentication": "./authentication/index.js",
|
|
@@ -109,8 +107,7 @@
|
|
|
109
107
|
"disposablestack": "^1.1",
|
|
110
108
|
"luxon": "^3.4",
|
|
111
109
|
"reflect-metadata": "^0.1",
|
|
112
|
-
"rxjs": "^7.8"
|
|
113
|
-
"type-fest": "^4.7"
|
|
110
|
+
"rxjs": "^7.8"
|
|
114
111
|
},
|
|
115
112
|
"devDependencies": {
|
|
116
113
|
"@mxssfd/typedoc-theme": "1.1",
|
|
@@ -121,17 +118,18 @@
|
|
|
121
118
|
"@types/mjml": "4.7",
|
|
122
119
|
"@types/node": "20",
|
|
123
120
|
"@types/nodemailer": "6.4",
|
|
124
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
125
|
-
"@typescript-eslint/parser": "6.
|
|
121
|
+
"@typescript-eslint/eslint-plugin": "6.12",
|
|
122
|
+
"@typescript-eslint/parser": "6.12",
|
|
126
123
|
"concurrently": "8.2",
|
|
127
124
|
"esbuild": "0.19",
|
|
128
|
-
"eslint": "8.
|
|
125
|
+
"eslint": "8.54",
|
|
129
126
|
"eslint-import-resolver-typescript": "3.6",
|
|
130
127
|
"eslint-plugin-import": "2.29",
|
|
131
128
|
"tsc-alias": "1.8",
|
|
129
|
+
"type-fest": "4.7",
|
|
132
130
|
"typedoc": "0.25",
|
|
133
131
|
"typedoc-plugin-missing-exports": "2.1",
|
|
134
|
-
"typescript": "5.
|
|
132
|
+
"typescript": "5.3"
|
|
135
133
|
},
|
|
136
134
|
"peerDependencies": {
|
|
137
135
|
"@elastic/elasticsearch": "^8.10",
|
|
@@ -146,9 +144,9 @@
|
|
|
146
144
|
"koa": "^2.14",
|
|
147
145
|
"minio": "^7.1",
|
|
148
146
|
"mjml": "^4.14",
|
|
149
|
-
"mongodb": "^6.
|
|
147
|
+
"mongodb": "^6.3",
|
|
150
148
|
"nodemailer": "^6.9",
|
|
151
|
-
"playwright": "^1.
|
|
149
|
+
"playwright": "^1.40",
|
|
152
150
|
"preact": "^10.19",
|
|
153
151
|
"preact-render-to-string": "^6.3",
|
|
154
152
|
"undici": "^5.27",
|
package/rxjs/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './media-query.js';
|
|
|
4
4
|
export * from './mutation-observer.js';
|
|
5
5
|
export * from './noop.js';
|
|
6
6
|
export * from './performance-observer.js';
|
|
7
|
+
export * from './reject-error.js';
|
|
7
8
|
export * from './resize-observer.js';
|
|
8
9
|
export * from './retry-backoff.js';
|
|
9
10
|
export * from './slow-array.js';
|
package/rxjs/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export * from './media-query.js';
|
|
|
4
4
|
export * from './mutation-observer.js';
|
|
5
5
|
export * from './noop.js';
|
|
6
6
|
export * from './performance-observer.js';
|
|
7
|
+
export * from './reject-error.js';
|
|
7
8
|
export * from './resize-observer.js';
|
|
8
9
|
export * from './retry-backoff.js';
|
|
9
10
|
export * from './slow-array.js';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
export function rejectErrors() {
|
|
3
|
+
return function rejectErrors(source) {
|
|
4
|
+
return new Observable((subscriber) => source.subscribe({
|
|
5
|
+
next: (value) => subscriber.next(value),
|
|
6
|
+
complete: () => subscriber.complete()
|
|
7
|
+
}));
|
|
8
|
+
};
|
|
9
|
+
}
|
package/signals/pipe.d.ts
CHANGED
|
@@ -1,49 +1,30 @@
|
|
|
1
1
|
import { type OperatorFunction } from 'rxjs';
|
|
2
|
-
import type { Signal
|
|
3
|
-
export type PipeOptions = Pick<ToSignalOptions, 'rejectErrors'>;
|
|
2
|
+
import type { Signal } from './api.js';
|
|
4
3
|
/**
|
|
5
4
|
* As we need an synchronous value for the resulting signal and effect scheduling is async, it uses the source signals value as the initial value for the pipe.
|
|
6
5
|
* This would normally result in double emission inside the pipe, but is mitigated by using {@link SignalPipeOptions.distinctUntilChanged}. Because of this, mutating source signals are not supported.
|
|
7
6
|
* If you have an mutating signal or require more control for whatever reason, use {@link rawPipe} instead.
|
|
8
7
|
*/
|
|
9
8
|
export declare function pipe<T, A>(source: Signal<T>, op1: OperatorFunction<T, A>): Signal<A>;
|
|
10
|
-
export declare function pipe<T, A>(source: Signal<T>, op1: OperatorFunction<T, A>, options: PipeOptions): Signal<A>;
|
|
11
9
|
export declare function pipe<T, A, B>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>): Signal<B>;
|
|
12
|
-
export declare function pipe<T, A, B>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, options: PipeOptions): Signal<B>;
|
|
13
10
|
export declare function pipe<T, A, B, C>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>): Signal<C>;
|
|
14
|
-
export declare function pipe<T, A, B, C>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, options: PipeOptions): Signal<C>;
|
|
15
11
|
export declare function pipe<T, A, B, C, D>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>): Signal<D>;
|
|
16
|
-
export declare function pipe<T, A, B, C, D>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, options: PipeOptions): Signal<D>;
|
|
17
12
|
export declare function pipe<T, A, B, C, D, E>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>): Signal<E>;
|
|
18
|
-
export declare function pipe<T, A, B, C, D, E>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, options: PipeOptions): Signal<E>;
|
|
19
13
|
export declare function pipe<T, A, B, C, D, E, F>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>): Signal<F>;
|
|
20
|
-
export declare function pipe<T, A, B, C, D, E, F>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, options: PipeOptions): Signal<F>;
|
|
21
14
|
export declare function pipe<T, A, B, C, D, E, F, G>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>): Signal<G>;
|
|
22
|
-
export declare function pipe<T, A, B, C, D, E, F, G>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, options: PipeOptions): Signal<G>;
|
|
23
15
|
export declare function pipe<T, A, B, C, D, E, F, G, H>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>): Signal<H>;
|
|
24
|
-
export declare function pipe<T, A, B, C, D, E, F, G, H>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, options: PipeOptions): Signal<H>;
|
|
25
16
|
export declare function pipe<T, A, B, C, D, E, F, G, H, I>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>): Signal<I>;
|
|
26
|
-
export declare function pipe
|
|
27
|
-
export declare function pipe(source: Signal<unknown>, ...operatorsAndOptions: (OperatorFunction<unknown, unknown> | PipeOptions)[]): Signal<unknown>;
|
|
17
|
+
export declare function pipe(source: Signal<unknown>, ...operators: OperatorFunction<unknown, unknown>[]): Signal<unknown>;
|
|
28
18
|
/**
|
|
29
19
|
* As we need an synchronous value for the resulting signal and effect scheduling is async, you have to provide an immediate value on subscription, for example via the `startWith` operator, otherwise an error is thrown.
|
|
30
20
|
*/
|
|
31
21
|
export declare function rawPipe<T, A>(source: Signal<T>, op1: OperatorFunction<T, A>): Signal<A>;
|
|
32
|
-
export declare function rawPipe<T, A>(source: Signal<T>, op1: OperatorFunction<T, A>, options: PipeOptions): Signal<A>;
|
|
33
22
|
export declare function rawPipe<T, A, B>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>): Signal<B>;
|
|
34
|
-
export declare function rawPipe<T, A, B>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, options: PipeOptions): Signal<B>;
|
|
35
23
|
export declare function rawPipe<T, A, B, C>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>): Signal<C>;
|
|
36
|
-
export declare function rawPipe<T, A, B, C>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, options: PipeOptions): Signal<C>;
|
|
37
24
|
export declare function rawPipe<T, A, B, C, D>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>): Signal<D>;
|
|
38
|
-
export declare function rawPipe<T, A, B, C, D>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, options: PipeOptions): Signal<D>;
|
|
39
25
|
export declare function rawPipe<T, A, B, C, D, E>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>): Signal<E>;
|
|
40
|
-
export declare function rawPipe<T, A, B, C, D, E>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, options: PipeOptions): Signal<E>;
|
|
41
26
|
export declare function rawPipe<T, A, B, C, D, E, F>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>): Signal<F>;
|
|
42
|
-
export declare function rawPipe<T, A, B, C, D, E, F>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, options: PipeOptions): Signal<F>;
|
|
43
27
|
export declare function rawPipe<T, A, B, C, D, E, F, G>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>): Signal<G>;
|
|
44
|
-
export declare function rawPipe<T, A, B, C, D, E, F, G>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, options: PipeOptions): Signal<G>;
|
|
45
28
|
export declare function rawPipe<T, A, B, C, D, E, F, G, H>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>): Signal<H>;
|
|
46
|
-
export declare function rawPipe<T, A, B, C, D, E, F, G, H>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, options: PipeOptions): Signal<H>;
|
|
47
29
|
export declare function rawPipe<T, A, B, C, D, E, F, G, H, I>(source: Signal<T>, op1: OperatorFunction<T, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, I>): Signal<I>;
|
|
48
|
-
export declare function rawPipe
|
|
49
|
-
export declare function rawPipe(source: Signal<unknown>, ...operatorsAndOptions: (OperatorFunction<unknown, unknown> | PipeOptions)[]): Signal<unknown>;
|
|
30
|
+
export declare function rawPipe(source: Signal<unknown>, ...operators: OperatorFunction<unknown, unknown>[]): Signal<unknown>;
|
package/signals/pipe.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/unified-signatures */
|
|
2
1
|
import { distinctUntilChanged } from 'rxjs';
|
|
3
2
|
import { startWithProvider } from '../rxjs/start-with-provider.js';
|
|
4
3
|
import { untrack } from '../rxjs/untrack.js';
|
|
5
|
-
import { isNotFunction } from '../utils/type-guards.js';
|
|
6
4
|
import { toObservable, toSignal } from './api.js';
|
|
7
|
-
export function pipe(source, ...
|
|
8
|
-
return rawPipe(source, startWithProvider(source), distinctUntilChanged(), ...
|
|
5
|
+
export function pipe(source, ...operators) {
|
|
6
|
+
return rawPipe(source, startWithProvider(source), distinctUntilChanged(), ...operators);
|
|
9
7
|
}
|
|
10
|
-
export function rawPipe(source, ...
|
|
11
|
-
const last = operatorsAndOptions.at(-1);
|
|
12
|
-
const lastIsOptions = isNotFunction(last);
|
|
13
|
-
const options = lastIsOptions ? last : undefined;
|
|
14
|
-
const operators = (lastIsOptions ? operatorsAndOptions.slice(0, -1) : operatorsAndOptions);
|
|
8
|
+
export function rawPipe(source, ...operators) {
|
|
15
9
|
const piped = toObservable(source).pipe(...operators, untrack());
|
|
16
|
-
return toSignal(piped, {
|
|
10
|
+
return toSignal(piped, { requireSync: true });
|
|
17
11
|
}
|
package/utils/timing.js
CHANGED
|
@@ -21,7 +21,7 @@ export async function timeoutUntil(timestamp) {
|
|
|
21
21
|
/** timeout for specified duration */
|
|
22
22
|
export async function cancelableTimeout(milliseconds, cancelSignal) {
|
|
23
23
|
return firstValueFrom(race([
|
|
24
|
-
timer(milliseconds).pipe(map(() => false)),
|
|
24
|
+
timer(milliseconds).pipe(map(() => false)), // eslint-disable-line @typescript-eslint/no-unsafe-argument
|
|
25
25
|
cancelSignal.set$.pipe(map(() => true)) // eslint-disable-line @typescript-eslint/no-unsafe-argument
|
|
26
26
|
]));
|
|
27
27
|
}
|