@tstdl/base 0.88.6 → 0.89.0
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 +7 -3
- package/api/index.js +7 -3
- package/application/index.d.ts +5 -0
- package/application/index.js +5 -0
- package/authentication/client/authentication.service.d.ts +1 -1
- package/authentication/client/authentication.service.js +4 -4
- package/authentication/client/http-client.middleware.d.ts +2 -2
- package/authentication/client/module.d.ts +2 -2
- package/authentication/client/module.js +2 -2
- package/authentication/index.d.ts +7 -0
- package/authentication/index.js +7 -0
- package/browser/index.d.ts +5 -0
- package/browser/index.js +5 -0
- package/cancellation/index.d.ts +4 -0
- package/cancellation/index.js +4 -0
- package/collections/index.d.ts +5 -0
- package/collections/index.js +5 -0
- package/cookie/index.d.ts +5 -0
- package/cookie/index.js +5 -0
- package/data-structures/index.d.ts +5 -0
- package/data-structures/index.js +5 -0
- package/database/index.d.ts +5 -0
- package/database/index.js +5 -0
- package/database/mongo/index.d.ts +5 -0
- package/database/mongo/index.js +5 -0
- package/database/mongo/module.js +1 -1
- package/decorators/index.d.ts +5 -0
- package/decorators/index.js +5 -0
- package/disposable/index.d.ts +5 -0
- package/disposable/index.js +5 -0
- package/distributed-loop/index.d.ts +5 -0
- package/distributed-loop/index.js +5 -0
- package/enumerable/index.d.ts +5 -0
- package/enumerable/index.js +5 -0
- package/error/index.d.ts +5 -0
- package/error/index.js +5 -0
- package/examples/api/authentication.js +1 -1
- package/examples/api/custom-authentication.js +1 -1
- package/function/index.d.ts +5 -0
- package/function/index.js +5 -0
- package/http/client/index.d.ts +1 -0
- package/http/client/index.js +1 -0
- package/http/index.d.ts +6 -0
- package/http/index.js +6 -0
- package/http/server/index.d.ts +2 -1
- package/http/server/index.js +2 -1
- package/image-service/index.d.ts +6 -0
- package/image-service/index.js +6 -0
- package/index.d.ts +5 -0
- package/index.js +5 -0
- package/injector/index.d.ts +5 -0
- package/injector/index.js +5 -0
- package/json-path/index.d.ts +5 -0
- package/json-path/index.js +5 -0
- package/key-value-store/index.d.ts +6 -0
- package/key-value-store/index.js +6 -0
- package/lock/index.d.ts +7 -0
- package/lock/index.js +7 -0
- package/lock/mongo/lock.d.ts +1 -2
- package/lock/mongo/lock.js +9 -9
- package/lock/mongo/provider.d.ts +3 -7
- package/lock/mongo/provider.js +14 -24
- package/logger/index.d.ts +7 -0
- package/logger/index.js +7 -0
- package/mail/index.d.ts +6 -1
- package/mail/index.js +6 -1
- package/mail/repositories/index.d.ts +2 -1
- package/mail/repositories/index.js +2 -1
- package/memory/index.d.ts +5 -0
- package/memory/index.js +5 -0
- package/message-bus/index.d.ts +7 -0
- package/message-bus/index.js +7 -0
- package/migration/index.d.ts +6 -0
- package/migration/index.js +6 -0
- package/module/index.d.ts +6 -0
- package/module/index.js +6 -0
- package/object-storage/index.d.ts +8 -2
- package/object-storage/index.js +8 -2
- package/openid-connect/index.d.ts +5 -0
- package/openid-connect/index.js +5 -0
- package/package.json +6 -24
- package/password/index.d.ts +5 -0
- package/password/index.js +5 -0
- package/pdf/pdf.service.d.ts +5 -0
- package/pdf/pdf.service.js +5 -0
- package/pool/index.d.ts +5 -0
- package/pool/index.js +5 -0
- package/promise/cancelable-promise.d.ts +10 -2
- package/promise/cancelable-promise.js +23 -19
- package/promise/custom-promise.d.ts +6 -0
- package/promise/custom-promise.js +14 -0
- package/promise/deferred-promise.d.ts +3 -3
- package/promise/deferred-promise.js +5 -8
- package/promise/index.d.ts +6 -0
- package/promise/index.js +6 -0
- package/promise/lazy-promise.d.ts +6 -6
- package/promise/lazy-promise.js +23 -15
- package/promise/types.d.ts +3 -0
- package/promise/types.js +1 -0
- package/signals/implementation/graph.d.ts +2 -15
- package/signals/implementation/graph.js +6 -1
- package/signals/implementation/to-observable.d.ts +1 -1
- package/signals/implementation/to-observable.js +1 -1
- package/signals/implementation/watch.d.ts +6 -0
- package/signals/implementation/watch.js +25 -2
- package/signals/index.d.ts +1 -0
- package/signals/index.js +1 -0
- package/signals/to-observable-2.d.ts +8 -0
- package/signals/to-observable-2.js +9 -0
- package/signals/to-signal-2.d.ts +4 -1
- package/utils/type-guards.d.ts +6 -0
- package/utils/type-guards.js +7 -0
- package/container/decorators.d.ts +0 -2
- package/container/decorators.js +0 -1
- package/container/index.d.ts +0 -3
- package/container/index.js +0 -3
- package/container/interfaces.d.ts +0 -2
- package/container/interfaces.js +0 -1
- package/container/token.d.ts +0 -2
- package/container/token.js +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
private
|
|
1
|
+
import { CustomPromise } from './custom-promise.js';
|
|
2
|
+
import type { PromiseExecutor } from './types.js';
|
|
3
|
+
export declare class LazyPromise<T> extends CustomPromise<T> {
|
|
4
|
+
#private;
|
|
5
5
|
readonly [Symbol.toStringTag] = "LazyPromise";
|
|
6
|
-
constructor(executorOrPromiseProvider:
|
|
6
|
+
constructor(executorOrPromiseProvider: PromiseExecutor<T> | (() => PromiseLike<T>));
|
|
7
7
|
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null | undefined, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null | undefined): Promise<TResult1 | TResult2>;
|
|
8
8
|
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null | undefined): Promise<T | TResult>;
|
|
9
9
|
finally(onfinally?: (() => void) | null | undefined): Promise<T>;
|
|
10
|
+
private execute;
|
|
10
11
|
}
|
|
11
|
-
export {};
|
package/promise/lazy-promise.js
CHANGED
|
@@ -1,25 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export class LazyPromise {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { isPromiseLike } from '../utils/type-guards.js';
|
|
2
|
+
import { CustomPromise } from './custom-promise.js';
|
|
3
|
+
export class LazyPromise extends CustomPromise {
|
|
4
|
+
#executed = false;
|
|
5
|
+
#executorOrPromiseProvider;
|
|
6
6
|
[Symbol.toStringTag] = 'LazyPromise';
|
|
7
7
|
constructor(executorOrPromiseProvider) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (isPromise(providedValue)) {
|
|
11
|
-
return providedValue;
|
|
12
|
-
}
|
|
13
|
-
return new Promise(providedValue);
|
|
14
|
-
});
|
|
8
|
+
super();
|
|
9
|
+
this.#executorOrPromiseProvider = executorOrPromiseProvider;
|
|
15
10
|
}
|
|
16
11
|
async then(onfulfilled, onrejected) {
|
|
17
|
-
|
|
12
|
+
this.execute();
|
|
13
|
+
return super.then(onfulfilled, onrejected);
|
|
18
14
|
}
|
|
19
15
|
async catch(onrejected) {
|
|
20
|
-
|
|
16
|
+
this.execute();
|
|
17
|
+
return super.catch(onrejected);
|
|
21
18
|
}
|
|
22
19
|
async finally(onfinally) {
|
|
23
|
-
|
|
20
|
+
this.execute();
|
|
21
|
+
return super.finally(onfinally);
|
|
22
|
+
}
|
|
23
|
+
execute() {
|
|
24
|
+
if (this.#executed) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
this.#executed = true;
|
|
28
|
+
const result = this.#executorOrPromiseProvider(this.resolve, this.reject);
|
|
29
|
+
if (isPromiseLike(result)) {
|
|
30
|
+
this.resolve(result);
|
|
31
|
+
}
|
|
24
32
|
}
|
|
25
33
|
}
|
package/promise/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -9,21 +9,8 @@ type Version = number & {
|
|
|
9
9
|
__brand: 'Version';
|
|
10
10
|
};
|
|
11
11
|
export declare function setActiveConsumer(consumer: ReactiveNode | null): ReactiveNode | null;
|
|
12
|
-
export declare
|
|
13
|
-
|
|
14
|
-
dirty: boolean;
|
|
15
|
-
producerNode: undefined;
|
|
16
|
-
producerLastReadVersion: undefined;
|
|
17
|
-
producerIndexOfThis: undefined;
|
|
18
|
-
nextProducerIndex: number;
|
|
19
|
-
liveConsumerNode: undefined;
|
|
20
|
-
liveConsumerIndexOfThis: undefined;
|
|
21
|
-
consumerAllowSignalWrites: boolean;
|
|
22
|
-
consumerIsAlwaysLive: boolean;
|
|
23
|
-
producerMustRecompute: () => boolean;
|
|
24
|
-
producerRecomputeValue: () => void;
|
|
25
|
-
consumerMarkedDirty: () => void;
|
|
26
|
-
};
|
|
12
|
+
export declare function isInNotificationPhase(): boolean;
|
|
13
|
+
export declare const REACTIVE_NODE: ReactiveNode;
|
|
27
14
|
/**
|
|
28
15
|
* A producer and/or consumer which participates in the reactive graph.
|
|
29
16
|
*
|
|
@@ -17,6 +17,9 @@ export function setActiveConsumer(consumer) {
|
|
|
17
17
|
activeConsumer = consumer;
|
|
18
18
|
return prev;
|
|
19
19
|
}
|
|
20
|
+
export function isInNotificationPhase() {
|
|
21
|
+
return inNotificationPhase;
|
|
22
|
+
}
|
|
20
23
|
export const REACTIVE_NODE = {
|
|
21
24
|
version: 0,
|
|
22
25
|
dirty: false,
|
|
@@ -153,7 +156,9 @@ export function consumerAfterComputation(node, prevConsumer) {
|
|
|
153
156
|
}
|
|
154
157
|
}
|
|
155
158
|
// Truncate the producer tracking arrays.
|
|
156
|
-
|
|
159
|
+
// Perf note: this is essentially truncating the length to `node.nextProducerIndex`, but
|
|
160
|
+
// benchmarking has shown that individual pop operations are faster.
|
|
161
|
+
while (node.producerNode.length > node.nextProducerIndex) {
|
|
157
162
|
node.producerNode.pop();
|
|
158
163
|
node.producerLastReadVersion.pop();
|
|
159
164
|
node.producerIndexOfThis.pop();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import type { Signal } from './api.js';
|
|
3
3
|
/**
|
|
4
|
-
* Exposes the value of an
|
|
4
|
+
* Exposes the value of an `Signal` as an RxJS `Observable`.
|
|
5
5
|
*
|
|
6
6
|
* The signal's value will be propagated into the `Observable`'s subscribers using an `effect`.
|
|
7
7
|
*/
|
|
@@ -2,7 +2,7 @@ import { Observable } from 'rxjs';
|
|
|
2
2
|
import { effect } from './effect.js';
|
|
3
3
|
import { untracked } from './untracked.js';
|
|
4
4
|
/**
|
|
5
|
-
* Exposes the value of an
|
|
5
|
+
* Exposes the value of an `Signal` as an RxJS `Observable`.
|
|
6
6
|
*
|
|
7
7
|
* The signal's value will be propagated into the `Observable`'s subscribers using an `effect`.
|
|
8
8
|
*/
|
|
@@ -24,5 +24,11 @@ export interface Watch {
|
|
|
24
24
|
*/
|
|
25
25
|
run(): void;
|
|
26
26
|
cleanup(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Destroy the watcher:
|
|
29
|
+
* - disconnect it from the reactive graph;
|
|
30
|
+
* - mark it as destroyed so subsequent run and notify operations are noop.
|
|
31
|
+
*/
|
|
32
|
+
destroy(): void;
|
|
27
33
|
}
|
|
28
34
|
export declare function watch(fn: (onCleanup: WatchCleanupRegisterFn) => void, schedule: (watch: Watch) => void, allowSignalWrites: boolean): Watch;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
import { consumerAfterComputation, consumerBeforeComputation, consumerMarkDirty, consumerPollProducersForChange, REACTIVE_NODE } from './graph.js';
|
|
8
|
+
import { consumerAfterComputation, consumerBeforeComputation, consumerDestroy, consumerMarkDirty, consumerPollProducersForChange, isInNotificationPhase, REACTIVE_NODE } from './graph.js';
|
|
9
9
|
export function watch(fn, schedule, allowSignalWrites) {
|
|
10
10
|
const node = Object.create(WATCH_NODE);
|
|
11
11
|
if (allowSignalWrites) {
|
|
@@ -16,7 +16,27 @@ export function watch(fn, schedule, allowSignalWrites) {
|
|
|
16
16
|
const registerOnCleanup = (cleanupFn) => {
|
|
17
17
|
node.cleanupFn = cleanupFn;
|
|
18
18
|
};
|
|
19
|
+
function isWatchNodeDestroyed(node) {
|
|
20
|
+
return node.fn === null && node.schedule === null;
|
|
21
|
+
}
|
|
22
|
+
function destroyWatchNode(node) {
|
|
23
|
+
if (!isWatchNodeDestroyed(node)) {
|
|
24
|
+
consumerDestroy(node); // disconnect watcher from the reactive graph
|
|
25
|
+
node.cleanupFn();
|
|
26
|
+
// nullify references to the integration functions to mark node as destroyed
|
|
27
|
+
node.fn = null;
|
|
28
|
+
node.schedule = null;
|
|
29
|
+
node.cleanupFn = NOOP_CLEANUP_FN;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
19
32
|
const run = () => {
|
|
33
|
+
if (node.fn === null) {
|
|
34
|
+
// trying to run a destroyed watch is noop
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (isInNotificationPhase()) {
|
|
38
|
+
throw new Error(`Schedulers cannot synchronously execute watches while scheduling.`);
|
|
39
|
+
}
|
|
20
40
|
node.dirty = false;
|
|
21
41
|
if (node.hasRun && !consumerPollProducersForChange(node)) {
|
|
22
42
|
return;
|
|
@@ -36,6 +56,7 @@ export function watch(fn, schedule, allowSignalWrites) {
|
|
|
36
56
|
notify: () => consumerMarkDirty(node),
|
|
37
57
|
run,
|
|
38
58
|
cleanup: () => node.cleanupFn(),
|
|
59
|
+
destroy: () => destroyWatchNode(node),
|
|
39
60
|
};
|
|
40
61
|
return node.ref;
|
|
41
62
|
}
|
|
@@ -45,7 +66,9 @@ const WATCH_NODE = {
|
|
|
45
66
|
consumerIsAlwaysLive: true,
|
|
46
67
|
consumerAllowSignalWrites: false,
|
|
47
68
|
consumerMarkedDirty: (node) => {
|
|
48
|
-
node.schedule
|
|
69
|
+
if (node.schedule !== null) {
|
|
70
|
+
node.schedule(node.ref);
|
|
71
|
+
}
|
|
49
72
|
},
|
|
50
73
|
hasRun: false,
|
|
51
74
|
cleanupFn: NOOP_CLEANUP_FN,
|
package/signals/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './effect-with-dependencies.js';
|
|
|
4
4
|
export * from './lazylize.js';
|
|
5
5
|
export * from './pipe.js';
|
|
6
6
|
export * from './switch-map.js';
|
|
7
|
+
export * from './to-observable-2.js';
|
|
7
8
|
export * from './to-signal-2.js';
|
|
8
9
|
export * from './types.js';
|
|
9
10
|
export * from './untracked-operator.js';
|
package/signals/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export * from './effect-with-dependencies.js';
|
|
|
4
4
|
export * from './lazylize.js';
|
|
5
5
|
export * from './pipe.js';
|
|
6
6
|
export * from './switch-map.js';
|
|
7
|
+
export * from './to-observable-2.js';
|
|
7
8
|
export * from './to-signal-2.js';
|
|
8
9
|
export * from './types.js';
|
|
9
10
|
export * from './untracked-operator.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Observable } from 'rxjs';
|
|
2
|
+
import type { Signal } from './api.js';
|
|
3
|
+
/**
|
|
4
|
+
* Exposes the value of an `Signal` as an RxJS `Observable`.
|
|
5
|
+
*
|
|
6
|
+
* The signal's value will be propagated into the `Observable`'s subscribers using an `effect`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function toObservable2<T>(source: Signal<T>): Observable<T>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { toObservable } from './implementation/to-observable.js';
|
|
2
|
+
/**
|
|
3
|
+
* Exposes the value of an `Signal` as an RxJS `Observable`.
|
|
4
|
+
*
|
|
5
|
+
* The signal's value will be propagated into the `Observable`'s subscribers using an `effect`.
|
|
6
|
+
*/
|
|
7
|
+
export function toObservable2(source) {
|
|
8
|
+
return toObservable(source);
|
|
9
|
+
}
|
package/signals/to-signal-2.d.ts
CHANGED
|
@@ -5,7 +5,10 @@ export type ToSignal2Options<T> = ToSignalOptions<T> & {
|
|
|
5
5
|
/** defer subscription until signal is used */
|
|
6
6
|
lazy?: boolean;
|
|
7
7
|
};
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Like `toSignal`, except that it uses untracked internal operations (required for some scenarios, but might be less safe in terms of bugs catching) and has the ability to subscribe lazily.
|
|
10
|
+
* Subscription to observable is cleaned up using finalization (garbage collection) of the signal.
|
|
11
|
+
*/
|
|
9
12
|
export declare function toSignal2<T>(source: ToSignalInput<T>): Signal<T | undefined>;
|
|
10
13
|
export declare function toSignal2<T>(source: ToSignalInput<T>, options: ToSignal2Options<undefined> & {
|
|
11
14
|
requireSync: true;
|
package/utils/type-guards.d.ts
CHANGED
|
@@ -252,6 +252,12 @@ export declare const assertPromise: AssertFunction<Promise<any>>;
|
|
|
252
252
|
export declare const assertNotPromise: AssertNotFunction<Promise<any>>;
|
|
253
253
|
export declare const assertPromisePass: AssertPassFunction<Promise<any>>;
|
|
254
254
|
export declare const assertNotPromisePass: AssertNotPassFunction<Promise<any>>;
|
|
255
|
+
export declare const isPromiseLike: IsFunction<PromiseLike<any>>;
|
|
256
|
+
export declare const isNotPromiseLike: IsNotFunction<PromiseLike<any>>;
|
|
257
|
+
export declare const assertPromiseLike: AssertFunction<PromiseLike<any>>;
|
|
258
|
+
export declare const assertNotPromiseLike: AssertNotFunction<PromiseLike<any>>;
|
|
259
|
+
export declare const assertPromiseLikePass: AssertPassFunction<PromiseLike<any>>;
|
|
260
|
+
export declare const assertNotPromiseLikePass: AssertNotPassFunction<PromiseLike<any>>;
|
|
255
261
|
export declare const isError: IsFunction<Error>;
|
|
256
262
|
export declare const isNotError: IsNotFunction<Error>;
|
|
257
263
|
export declare const assertError: AssertFunction<Error>;
|
package/utils/type-guards.js
CHANGED
|
@@ -313,6 +313,13 @@ export const assertPromise = promiseGuards.assertPromise;
|
|
|
313
313
|
export const assertNotPromise = promiseGuards.assertNotPromise;
|
|
314
314
|
export const assertPromisePass = promiseGuards.assertPromisePass;
|
|
315
315
|
export const assertNotPromisePass = promiseGuards.assertNotPromisePass;
|
|
316
|
+
const promiseLikeGuards = createGuards('PromiseLike', (value) => isPromise(value) || ((((typeof value == 'object') && (value != null)) || isFunction(value)) && ((typeof value.then) == 'function')));
|
|
317
|
+
export const isPromiseLike = promiseLikeGuards.isPromiseLike;
|
|
318
|
+
export const isNotPromiseLike = promiseLikeGuards.isNotPromiseLike;
|
|
319
|
+
export const assertPromiseLike = promiseLikeGuards.assertPromiseLike;
|
|
320
|
+
export const assertNotPromiseLike = promiseLikeGuards.assertNotPromiseLike;
|
|
321
|
+
export const assertPromiseLikePass = promiseLikeGuards.assertPromiseLikePass;
|
|
322
|
+
export const assertNotPromiseLikePass = promiseLikeGuards.assertNotPromiseLikePass;
|
|
316
323
|
const errorGuards = createInstanceGuards('error', Error);
|
|
317
324
|
export const isError = errorGuards.isError;
|
|
318
325
|
export const isNotError = errorGuards.isNotError;
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export { ForwardArg as forwardArg, ForwardRef as forwardRef, Inject as inject, InjectArg as injectArg, Injectable as injectable, Optional as optional, ReplaceClass as replaceClass, ResolveArg as resolveArg, ResolveArgProvider as resolveArgProvider, Scoped as scoped, Singleton as singleton } from '../injector/decorators.js';
|
|
2
|
-
export type { InjectableOptionsWithoutLifecycle } from '../injector/decorators.js';
|
package/container/decorators.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ForwardArg as forwardArg, ForwardRef as forwardRef, Inject as inject, InjectArg as injectArg, Injectable as injectable, Optional as optional, ReplaceClass as replaceClass, ResolveArg as resolveArg, ResolveArgProvider as resolveArgProvider, Scoped as scoped, Singleton as singleton } from '../injector/decorators.js';
|
package/container/index.d.ts
DELETED
package/container/index.js
DELETED
package/container/interfaces.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { afterResolve, resolveArgumentType } from '../injector/interfaces.js';
|
package/container/token.d.ts
DELETED
package/container/token.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ReifyingInjectionToken, getTokenName, injectionToken } from '../injector/token.js';
|