@tstdl/base 0.88.7 → 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/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 {};
|
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';
|