@tstdl/base 0.85.26 → 0.86.0-beta10
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/_container/decorators.d.ts +76 -0
- package/_container/decorators.js +110 -0
- package/_container/index.d.ts +10 -0
- package/_container/index.js +27 -0
- package/_container/interfaces.d.ts +16 -0
- package/_container/interfaces.js +26 -0
- package/_container/token.d.ts +18 -0
- package/_container/token.js +41 -0
- package/api/client/client.d.ts +2 -2
- package/api/client/client.js +5 -3
- package/api/server/api-controller.d.ts +2 -2
- package/api/server/api-controller.js +5 -4
- package/api/server/api-request-token.provider.js +2 -2
- package/api/server/gateway.d.ts +5 -6
- package/api/server/gateway.js +25 -12
- package/api/server/module.js +4 -4
- package/api/server/tokens.d.ts +4 -1
- package/api/server/tokens.js +8 -2
- package/application/application.d.ts +13 -10
- package/application/application.js +38 -45
- package/authentication/client/api.client.js +3 -3
- package/authentication/client/authentication.service.d.ts +4 -4
- package/authentication/client/authentication.service.js +20 -21
- package/authentication/client/http-client.middleware.d.ts +3 -5
- package/authentication/client/http-client.middleware.js +3 -12
- package/authentication/client/module.d.ts +2 -1
- package/authentication/client/module.js +15 -7
- package/authentication/client/tokens.d.ts +2 -2
- package/authentication/client/tokens.js +5 -4
- package/authentication/server/authentication-api-request-token.provider.js +2 -2
- package/authentication/server/authentication-secret-requirements.validator.js +2 -2
- package/authentication/server/authentication.service.d.ts +2 -2
- package/authentication/server/authentication.service.js +9 -9
- package/authentication/server/module.d.ts +2 -1
- package/authentication/server/module.js +8 -7
- package/authentication/server/mongo/mongo-authentication-credentials.repository.d.ts +3 -3
- package/authentication/server/mongo/mongo-authentication-credentials.repository.js +4 -4
- package/authentication/server/mongo/mongo-authentication-session.repository.d.ts +3 -3
- package/authentication/server/mongo/mongo-authentication-session.repository.js +4 -4
- package/browser/browser-context-controller.d.ts +4 -4
- package/browser/browser-context-controller.js +15 -9
- package/browser/browser-controller.d.ts +12 -5
- package/browser/browser-controller.js +24 -10
- package/browser/browser.service.d.ts +12 -6
- package/browser/browser.service.js +13 -10
- package/browser/module.js +2 -2
- package/container/decorators.d.ts +2 -76
- package/container/decorators.js +12 -88
- package/container/index.d.ts +0 -7
- package/container/index.js +0 -7
- package/container/interfaces.d.ts +2 -16
- package/container/interfaces.js +3 -4
- package/container/token.d.ts +2 -18
- package/container/token.js +4 -19
- package/core.d.ts +4 -2
- package/core.js +15 -8
- package/database/mongo/classes.d.ts +5 -5
- package/database/mongo/classes.js +5 -4
- package/database/mongo/module.js +24 -16
- package/database/mongo/mongo-entity-repository.d.ts +2 -2
- package/database/mongo/mongo-entity-repository.js +2 -2
- package/disposable/async-disposer.d.ts +4 -4
- package/distributed-loop/distributed-loop.d.ts +3 -3
- package/distributed-loop/distributed-loop.js +3 -3
- package/distributed-loop/provider.js +2 -2
- package/examples/api/authentication.js +17 -10
- package/examples/api/basic-overview.js +4 -5
- package/examples/api/custom-authentication.js +9 -6
- package/examples/api/streaming.js +5 -5
- package/examples/browser/basic.js +5 -5
- package/examples/http/client.js +6 -4
- package/examples/mail/basic.js +9 -4
- package/examples/pdf/basic.js +9 -5
- package/examples/template/basic.js +8 -6
- package/function/log.js +1 -1
- package/http/client/adapters/undici-http-client.adapter.js +7 -6
- package/http/client/http-client-options.d.ts +0 -5
- package/http/client/http-client-options.js +0 -4
- package/http/client/http-client.d.ts +5 -8
- package/http/client/http-client.js +10 -7
- package/http/client/middleware.d.ts +6 -0
- package/http/client/middleware.js +16 -0
- package/http/client/module.d.ts +6 -1
- package/http/client/module.js +10 -5
- package/http/client/tokens.d.ts +2 -0
- package/http/client/tokens.js +25 -0
- package/http/server/node/module.js +2 -2
- package/http/server/node/node-http-server.d.ts +1 -4
- package/http/server/node/node-http-server.js +3 -7
- package/image-service/imgproxy/imgproxy-image-service.d.ts +6 -8
- package/image-service/imgproxy/imgproxy-image-service.js +17 -16
- package/injector/decorators.d.ts +12 -6
- package/injector/decorators.js +14 -0
- package/injector/index.d.ts +11 -0
- package/injector/index.js +28 -0
- package/injector/inject.d.ts +6 -1
- package/injector/inject.js +14 -2
- package/injector/injector.d.ts +14 -34
- package/injector/injector.js +91 -48
- package/injector/interfaces.d.ts +7 -5
- package/injector/provider.d.ts +19 -14
- package/injector/token.d.ts +10 -3
- package/injector/token.js +1 -1
- package/injector/type-info.d.ts +2 -0
- package/injector/types.d.ts +13 -7
- package/key-value-store/key-value.store.d.ts +3 -3
- package/key-value-store/key-value.store.js +1 -1
- package/key-value-store/mongo/module.js +4 -4
- package/key-value-store/mongo/mongo-key-value-store.provider.js +2 -2
- package/key-value-store/mongo/mongo-key-value.repository.d.ts +3 -3
- package/key-value-store/mongo/mongo-key-value.repository.js +4 -4
- package/key-value-store/mongo/mongo-key-value.store.js +3 -3
- package/key-value-store/mongo/tokens.d.ts +1 -1
- package/key-value-store/mongo/tokens.js +1 -1
- package/lock/lock.d.ts +3 -2
- package/lock/lock.js +1 -0
- package/lock/mongo/lock.js +4 -4
- package/lock/mongo/module.js +3 -3
- package/lock/mongo/mongo-lock-repository.d.ts +3 -3
- package/lock/mongo/mongo-lock-repository.js +3 -3
- package/lock/mongo/provider.js +5 -5
- package/lock/provider.d.ts +3 -2
- package/lock/provider.js +1 -0
- package/lock/web/module.js +3 -3
- package/lock/web/web-lock.js +2 -2
- package/lock/web/web-lock.provider.js +3 -3
- package/logger/console/logger.js +2 -2
- package/logger/logger.d.ts +3 -2
- package/logger/logger.js +1 -0
- package/mail/clients/nodemailer.mail-client.js +6 -5
- package/mail/mail.client.d.ts +3 -2
- package/mail/mail.client.js +1 -0
- package/mail/mail.service.js +7 -7
- package/mail/module.js +5 -5
- package/mail/repositories/mongo-mail-log.repository.d.ts +3 -3
- package/mail/repositories/mongo-mail-log.repository.js +3 -3
- package/mail/tokens.d.ts +1 -1
- package/mail/tokens.js +2 -2
- package/message-bus/broadcast-channel/broadcast-channel-message-bus-provider.js +3 -3
- package/message-bus/broadcast-channel/broadcast-channel-message-bus.d.ts +1 -1
- package/message-bus/broadcast-channel/broadcast-channel-message-bus.js +3 -3
- package/message-bus/broadcast-channel/module.js +3 -3
- package/message-bus/local/local-message-bus-provider.js +4 -4
- package/message-bus/local/local-message-bus.d.ts +1 -1
- package/message-bus/local/local-message-bus.js +3 -3
- package/message-bus/local/module.js +3 -3
- package/message-bus/message-bus.d.ts +3 -3
- package/message-bus/message-bus.js +1 -0
- package/migration/index.d.ts +1 -1
- package/migration/index.js +1 -1
- package/migration/migrator.js +4 -4
- package/migration/mongo/migration-state-repository.d.ts +3 -3
- package/migration/mongo/migration-state-repository.js +4 -4
- package/migration/mongo/module.js +2 -2
- package/module/modules/web-server.module.d.ts +5 -10
- package/module/modules/web-server.module.js +16 -36
- package/notification/notification.service.js +2 -2
- package/object-storage/object-storage.d.ts +3 -3
- package/object-storage/object-storage.js +1 -0
- package/object-storage/s3/s3.object-storage-provider.js +6 -5
- package/object-storage/s3/s3.object-storage.d.ts +2 -2
- package/object-storage/s3/s3.object-storage.js +4 -4
- package/openid-connect/cached-oidc-configuration.service.js +3 -3
- package/openid-connect/index.d.ts +1 -1
- package/openid-connect/index.js +3 -3
- package/openid-connect/mongo-oidc-state.repository.d.ts +3 -3
- package/openid-connect/mongo-oidc-state.repository.js +6 -5
- package/openid-connect/oidc-configuration.service.js +2 -2
- package/openid-connect/oidc.service.js +4 -4
- package/package.json +1 -1
- package/pdf/pdf.service.d.ts +3 -3
- package/pdf/pdf.service.js +5 -5
- package/process-shutdown.d.ts +2 -2
- package/process-shutdown.js +6 -8
- package/queue/mongo/mongo-job.repository.d.ts +3 -3
- package/queue/mongo/mongo-job.repository.js +4 -4
- package/queue/mongo/queue.js +4 -4
- package/queue/mongo/queue.provider.d.ts +3 -3
- package/queue/mongo/queue.provider.js +8 -6
- package/queue/queue.d.ts +3 -3
- package/queue/queue.js +1 -1
- package/search-index/elastic/config.d.ts +3 -3
- package/search-index/elastic/config.js +4 -3
- package/search-index/elastic/module.d.ts +1 -3
- package/search-index/elastic/module.js +21 -18
- package/search-index/elastic/search-index.d.ts +2 -2
- package/search-index/elastic/search-index.js +2 -2
- package/templates/module.d.ts +2 -2
- package/templates/module.js +12 -26
- package/templates/providers/file.template-provider.d.ts +3 -3
- package/templates/providers/file.template-provider.js +5 -4
- package/templates/providers/memory.template-provider.js +2 -2
- package/templates/renderers/handlebars.template-renderer.js +2 -2
- package/templates/renderers/jsx.template-renderer.js +2 -2
- package/templates/renderers/mjml.template-renderer.js +3 -3
- package/templates/renderers/string.template-renderer.js +2 -2
- package/templates/resolvers/file.template-resolver.d.ts +3 -3
- package/templates/resolvers/file.template-resolver.js +6 -5
- package/templates/resolvers/jsx.template-resolver.js +2 -2
- package/templates/resolvers/string.template-resolver.js +2 -2
- package/templates/template-renderer.provider.js +3 -3
- package/templates/template-resolver.provider.js +3 -3
- package/templates/template.service.js +4 -4
- package/templates/tokens.d.ts +2 -2
- package/templates/tokens.js +3 -3
- package/text/dynamic-text.model.js +3 -4
- package/text/localization.service.js +3 -3
- package/theme/theme-service.d.ts +1 -1
- package/theme/theme-service.js +7 -6
- package/tokens.d.ts +1 -1
- package/tokens.js +2 -2
- /package/{container → _container}/container.d.ts +0 -0
- /package/{container → _container}/container.js +0 -0
- /package/{container → _container}/provider.d.ts +0 -0
- /package/{container → _container}/provider.js +0 -0
- /package/{container → _container}/resolve-chain.d.ts +0 -0
- /package/{container → _container}/resolve-chain.js +0 -0
- /package/{container → _container}/resolve.error.d.ts +0 -0
- /package/{container → _container}/resolve.error.js +0 -0
- /package/{container → _container}/type-info.d.ts +0 -0
- /package/{container → _container}/type-info.js +0 -0
- /package/{container → _container}/types.d.ts +0 -0
- /package/{container → _container}/types.js +0 -0
- /package/{container → _container}/utils.d.ts +0 -0
- /package/{container → _container}/utils.js +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { Injectable } from '../../../container/index.js';
|
|
2
|
-
import { type resolveArgumentType } from '../../../container/index.js';
|
|
3
1
|
import type { CollectionArgument } from '../../../database/mongo/index.js';
|
|
4
2
|
import { Collection, MongoEntityRepository } from '../../../database/mongo/index.js';
|
|
3
|
+
import { resolveArgumentType } from '../../../injector/index.js';
|
|
4
|
+
import type { Resolvable } from '../../../injector/interfaces.js';
|
|
5
5
|
import { Logger } from '../../../logger/index.js';
|
|
6
6
|
import type { AuthenticationSession, NewAuthenticationSession } from '../../models/index.js';
|
|
7
7
|
import type { AuthenticationSessionExtendData } from '../authentication-session.repository.js';
|
|
8
8
|
import { AuthenticationSessionRepository } from '../authentication-session.repository.js';
|
|
9
9
|
export type MongoAuthenticationSessionRepositoryConfig = MongoAuthenticationSessionRepositoryArgument;
|
|
10
10
|
export type MongoAuthenticationSessionRepositoryArgument = CollectionArgument<AuthenticationSession>;
|
|
11
|
-
export declare class InternalMongoAuthenticationSessionRepository extends MongoEntityRepository<AuthenticationSession> implements
|
|
11
|
+
export declare class InternalMongoAuthenticationSessionRepository extends MongoEntityRepository<AuthenticationSession> implements Resolvable<MongoAuthenticationSessionRepositoryArgument> {
|
|
12
12
|
readonly [resolveArgumentType]: MongoAuthenticationSessionRepositoryArgument;
|
|
13
13
|
constructor(collection: Collection<AuthenticationSession>, logger: Logger);
|
|
14
14
|
}
|
|
@@ -23,8 +23,8 @@ __export(mongo_authentication_session_repository_exports, {
|
|
|
23
23
|
configureMongoAuthenticationSessionRepository: () => configureMongoAuthenticationSessionRepository
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(mongo_authentication_session_repository_exports);
|
|
26
|
-
var import_container = require("../../../container/index.js");
|
|
27
26
|
var import_mongo = require("../../../database/mongo/index.js");
|
|
27
|
+
var import_injector = require("../../../injector/index.js");
|
|
28
28
|
var import_logger = require("../../../logger/index.js");
|
|
29
29
|
var import_authentication_session_repository = require("../authentication-session.repository.js");
|
|
30
30
|
var __decorate = function(decorators, target, key, desc) {
|
|
@@ -54,10 +54,10 @@ let InternalMongoAuthenticationSessionRepository = class InternalMongoAuthentica
|
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
InternalMongoAuthenticationSessionRepository = __decorate([
|
|
57
|
-
(0,
|
|
57
|
+
(0, import_injector.Singleton)({
|
|
58
58
|
defaultArgumentProvider: () => defaultArgument
|
|
59
59
|
}),
|
|
60
|
-
__param(0, (0,
|
|
60
|
+
__param(0, (0, import_injector.ForwardArg)()),
|
|
61
61
|
__metadata("design:paramtypes", [import_mongo.Collection, import_logger.Logger])
|
|
62
62
|
], InternalMongoAuthenticationSessionRepository);
|
|
63
63
|
let MongoAuthenticationSessionRepository = class MongoAuthenticationSessionRepository2 extends import_authentication_session_repository.AuthenticationSessionRepository {
|
|
@@ -85,7 +85,7 @@ let MongoAuthenticationSessionRepository = class MongoAuthenticationSessionRepos
|
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
87
|
MongoAuthenticationSessionRepository = __decorate([
|
|
88
|
-
(0,
|
|
88
|
+
(0, import_injector.Singleton)(),
|
|
89
89
|
__metadata("design:paramtypes", [InternalMongoAuthenticationSessionRepository])
|
|
90
90
|
], MongoAuthenticationSessionRepository);
|
|
91
91
|
function configureMongoAuthenticationSessionRepository(config) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { BrowserContext } from 'playwright';
|
|
2
|
-
import type { Injectable } from '../container/interfaces.js';
|
|
3
|
-
import { resolveArgumentType } from '../container/interfaces.js';
|
|
4
2
|
import type { AsyncDisposable } from '../disposable/disposable.js';
|
|
5
3
|
import { disposeAsync } from '../disposable/disposable.js';
|
|
4
|
+
import type { Resolvable } from '../injector/interfaces.js';
|
|
5
|
+
import { resolveArgumentType } from '../injector/interfaces.js';
|
|
6
6
|
import type { Logger } from '../logger/logger.js';
|
|
7
7
|
import type { Record } from '../types.js';
|
|
8
8
|
import type { Opaque } from 'type-fest';
|
|
@@ -18,10 +18,10 @@ export type NewPageOptions = {
|
|
|
18
18
|
};
|
|
19
19
|
export type BrowserContextState = Opaque<Record<string | number, unknown>, 'BrowserContextState'>;
|
|
20
20
|
export type BrowserContextControllerArgument = NewBrowserContextOptions;
|
|
21
|
-
export declare class BrowserContextController implements AsyncDisposable,
|
|
22
|
-
private readonly options;
|
|
21
|
+
export declare class BrowserContextController implements AsyncDisposable, Resolvable<BrowserContextControllerArgument> {
|
|
23
22
|
/** @deprecated should be avoided */
|
|
24
23
|
readonly context: BrowserContext;
|
|
24
|
+
readonly options: BrowserContextControllerOptions;
|
|
25
25
|
readonly [resolveArgumentType]: BrowserContextControllerArgument;
|
|
26
26
|
constructor(context: BrowserContext, options?: BrowserContextControllerOptions);
|
|
27
27
|
[disposeAsync](): Promise<void>;
|
|
@@ -21,9 +21,9 @@ __export(browser_context_controller_exports, {
|
|
|
21
21
|
BrowserContextController: () => BrowserContextController
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(browser_context_controller_exports);
|
|
24
|
-
var import_decorators = require("../container/decorators.js");
|
|
25
|
-
var import_interfaces = require("../container/interfaces.js");
|
|
26
24
|
var import_disposable = require("../disposable/disposable.js");
|
|
25
|
+
var import_decorators = require("../injector/decorators.js");
|
|
26
|
+
var import_interfaces = require("../injector/interfaces.js");
|
|
27
27
|
var import_object = require("../utils/object/object.js");
|
|
28
28
|
var import_type_guards = require("../utils/type-guards.js");
|
|
29
29
|
var import_browser_controller = require("./browser-controller.js");
|
|
@@ -43,10 +43,11 @@ var __metadata = function(k, v) {
|
|
|
43
43
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
44
44
|
return Reflect.metadata(k, v);
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
var BrowserContextController_1;
|
|
47
|
+
let BrowserContextController = BrowserContextController_1 = class BrowserContextController2 {
|
|
48
48
|
/** @deprecated should be avoided */
|
|
49
49
|
context;
|
|
50
|
+
options;
|
|
50
51
|
constructor(context, options = {}) {
|
|
51
52
|
this.context = context;
|
|
52
53
|
this.options = options;
|
|
@@ -94,12 +95,17 @@ let BrowserContextController = class BrowserContextController2 {
|
|
|
94
95
|
(0, import_utils.attachLogger)(this.context, logger);
|
|
95
96
|
}
|
|
96
97
|
};
|
|
97
|
-
BrowserContextController = __decorate([
|
|
98
|
-
(0, import_decorators.
|
|
98
|
+
BrowserContextController = BrowserContextController_1 = __decorate([
|
|
99
|
+
(0, import_decorators.Injectable)({
|
|
99
100
|
provider: {
|
|
100
|
-
useFactory:
|
|
101
|
-
|
|
102
|
-
return
|
|
101
|
+
useFactory: (_, context) => {
|
|
102
|
+
context.context.browserController = context.resolve(import_browser_controller.BrowserController);
|
|
103
|
+
return new BrowserContextController_1(null);
|
|
104
|
+
},
|
|
105
|
+
async afterResolve(value, argument, context) {
|
|
106
|
+
const { context: browserContext, controllerOptions } = await context.browserController.newRawContext(argument);
|
|
107
|
+
value.context = browserContext;
|
|
108
|
+
value.options = controllerOptions;
|
|
103
109
|
}
|
|
104
110
|
}
|
|
105
111
|
}),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { Browser } from 'playwright';
|
|
2
|
-
import type { Injectable } from '../container/interfaces.js';
|
|
3
|
-
import { resolveArgumentType } from '../container/interfaces.js';
|
|
1
|
+
import type { Browser, BrowserContext } from 'playwright';
|
|
4
2
|
import type { AsyncDisposable } from '../disposable/disposable.js';
|
|
5
3
|
import { disposeAsync } from '../disposable/disposable.js';
|
|
4
|
+
import type { Resolvable } from '../injector/interfaces.js';
|
|
5
|
+
import { resolveArgumentType } from '../injector/interfaces.js';
|
|
6
6
|
import type { Record } from '../types.js';
|
|
7
|
-
import type { BrowserContextState, NewPageOptions } from './browser-context-controller.js';
|
|
7
|
+
import type { BrowserContextControllerOptions, BrowserContextState, NewPageOptions } from './browser-context-controller.js';
|
|
8
8
|
import { BrowserContextController } from './browser-context-controller.js';
|
|
9
9
|
import type { NewBrowserOptions } from './browser.service.js';
|
|
10
10
|
export type BrowserControllerOptions = {
|
|
@@ -29,13 +29,20 @@ export type NewBrowserContextOptions = {
|
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
export type BrowserControllerArgument = NewBrowserOptions;
|
|
32
|
-
export declare class BrowserController implements AsyncDisposable,
|
|
32
|
+
export declare class BrowserController implements AsyncDisposable, Resolvable<BrowserControllerArgument> {
|
|
33
33
|
/** @deprecated should be avoided */
|
|
34
34
|
readonly browser: Browser;
|
|
35
35
|
readonly options: BrowserControllerOptions | undefined;
|
|
36
36
|
readonly [resolveArgumentType]: BrowserControllerArgument;
|
|
37
37
|
constructor(browser: Browser, options?: BrowserControllerOptions);
|
|
38
38
|
[disposeAsync](): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated for internal use
|
|
41
|
+
*/
|
|
42
|
+
newRawContext(options?: NewBrowserContextOptions): Promise<{
|
|
43
|
+
context: BrowserContext;
|
|
44
|
+
controllerOptions: BrowserContextControllerOptions;
|
|
45
|
+
}>;
|
|
39
46
|
newContext(options?: NewBrowserContextOptions): Promise<BrowserContextController>;
|
|
40
47
|
close(): Promise<void>;
|
|
41
48
|
waitForNoContexts(): Promise<void>;
|
|
@@ -21,9 +21,10 @@ __export(browser_controller_exports, {
|
|
|
21
21
|
BrowserController: () => BrowserController
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(browser_controller_exports);
|
|
24
|
-
var import_decorators = require("../container/decorators.js");
|
|
25
|
-
var import_interfaces = require("../container/interfaces.js");
|
|
26
24
|
var import_disposable = require("../disposable/disposable.js");
|
|
25
|
+
var import_decorators = require("../injector/decorators.js");
|
|
26
|
+
var import_inject = require("../injector/inject.js");
|
|
27
|
+
var import_interfaces = require("../injector/interfaces.js");
|
|
27
28
|
var import_object = require("../utils/object/object.js");
|
|
28
29
|
var import_type_guards = require("../utils/type-guards.js");
|
|
29
30
|
var import_browser_context_controller = require("./browser-context-controller.js");
|
|
@@ -43,7 +44,8 @@ var __metadata = function(k, v) {
|
|
|
43
44
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
44
45
|
return Reflect.metadata(k, v);
|
|
45
46
|
};
|
|
46
|
-
|
|
47
|
+
var BrowserController_1;
|
|
48
|
+
let BrowserController = BrowserController_1 = class BrowserController2 {
|
|
47
49
|
/** @deprecated should be avoided */
|
|
48
50
|
browser;
|
|
49
51
|
options;
|
|
@@ -54,7 +56,10 @@ let BrowserController = class BrowserController2 {
|
|
|
54
56
|
async [import_disposable.disposeAsync]() {
|
|
55
57
|
await this.close();
|
|
56
58
|
}
|
|
57
|
-
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated for internal use
|
|
61
|
+
*/
|
|
62
|
+
async newRawContext(options) {
|
|
58
63
|
const mergedOptions = (0, import_utils.mergeNewBrowserContextOptions)(this.options?.defaultNewContextOptions, options);
|
|
59
64
|
const context = await this.browser.newContext({
|
|
60
65
|
storageState: mergedOptions.state,
|
|
@@ -65,7 +70,11 @@ let BrowserController = class BrowserController2 {
|
|
|
65
70
|
proxy: mergedOptions.proxy,
|
|
66
71
|
extraHTTPHeaders: (0, import_type_guards.isDefined)(mergedOptions.extraHttpHeaders) ? (0, import_object.filterUndefinedFromRecord)(mergedOptions.extraHttpHeaders) : void 0
|
|
67
72
|
});
|
|
68
|
-
return
|
|
73
|
+
return { context, controllerOptions: mergedOptions };
|
|
74
|
+
}
|
|
75
|
+
async newContext(options) {
|
|
76
|
+
const { context, controllerOptions } = await this.newRawContext(options);
|
|
77
|
+
return new import_browser_context_controller.BrowserContextController(context, controllerOptions);
|
|
69
78
|
}
|
|
70
79
|
async close() {
|
|
71
80
|
if (this.browser.isConnected()) {
|
|
@@ -94,12 +103,17 @@ let BrowserController = class BrowserController2 {
|
|
|
94
103
|
});
|
|
95
104
|
}
|
|
96
105
|
};
|
|
97
|
-
BrowserController = __decorate([
|
|
98
|
-
(0, import_decorators.
|
|
106
|
+
BrowserController = BrowserController_1 = __decorate([
|
|
107
|
+
(0, import_decorators.Injectable)({
|
|
99
108
|
provider: {
|
|
100
|
-
useFactory:
|
|
101
|
-
|
|
102
|
-
return
|
|
109
|
+
useFactory: (_argument, context) => {
|
|
110
|
+
context.context.browserService = (0, import_inject.inject)(import_browser_service.BrowserService);
|
|
111
|
+
return new BrowserController_1(null);
|
|
112
|
+
},
|
|
113
|
+
async afterResolve(value, argument, context) {
|
|
114
|
+
const { browser, controllerOptions } = await context.browserService.newRawBrowser(argument);
|
|
115
|
+
value.browser = browser;
|
|
116
|
+
value.options = controllerOptions;
|
|
103
117
|
}
|
|
104
118
|
}
|
|
105
119
|
}),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { LaunchOptions } from 'playwright';
|
|
2
|
-
import type { Injectable } from '../container/interfaces.js';
|
|
3
|
-
import { afterResolve, resolveArgumentType } from '../container/interfaces.js';
|
|
1
|
+
import type { Browser, LaunchOptions } from 'playwright';
|
|
4
2
|
import type { AsyncDisposable } from '../disposable/disposable.js';
|
|
5
3
|
import { disposeAsync } from '../disposable/disposable.js';
|
|
4
|
+
import type { Resolvable } from '../injector/interfaces.js';
|
|
5
|
+
import { resolveArgumentType } from '../injector/interfaces.js';
|
|
6
6
|
import { BrowserContextController } from './browser-context-controller.js';
|
|
7
|
-
import type { NewBrowserContextOptions } from './browser-controller.js';
|
|
7
|
+
import type { BrowserControllerOptions, NewBrowserContextOptions } from './browser-controller.js';
|
|
8
8
|
import { BrowserController } from './browser-controller.js';
|
|
9
9
|
export declare class BrowserServiceOptions {
|
|
10
10
|
defaultNewBrowserOptions?: NewBrowserOptions;
|
|
@@ -22,14 +22,20 @@ export type NewBrowserOptions = {
|
|
|
22
22
|
browserArguments?: string[];
|
|
23
23
|
defaultNewContextOptions?: NewBrowserContextOptions;
|
|
24
24
|
};
|
|
25
|
-
export declare class BrowserService implements AsyncDisposable,
|
|
25
|
+
export declare class BrowserService implements AsyncDisposable, Resolvable<BrowserServiceArgument> {
|
|
26
26
|
private readonly browsers;
|
|
27
27
|
private readonly persistentBrowserContexts;
|
|
28
28
|
readonly options: BrowserServiceOptions | undefined;
|
|
29
29
|
readonly [resolveArgumentType]: BrowserServiceArgument;
|
|
30
30
|
constructor(options?: BrowserServiceOptions);
|
|
31
|
-
[afterResolve](): void;
|
|
32
31
|
[disposeAsync](): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated internal use only
|
|
34
|
+
*/
|
|
35
|
+
newRawBrowser(options?: NewBrowserOptions): Promise<{
|
|
36
|
+
browser: Browser;
|
|
37
|
+
controllerOptions: BrowserControllerOptions;
|
|
38
|
+
}>;
|
|
33
39
|
newBrowser(options?: NewBrowserOptions): Promise<BrowserController>;
|
|
34
40
|
newPersistentContext(dataDirectory: string, browserOptions?: NewBrowserOptions, contextOptions?: NewBrowserContextOptions): Promise<BrowserContextController>;
|
|
35
41
|
waitForNoBrowsers(): Promise<void>;
|
|
@@ -22,10 +22,9 @@ __export(browser_service_exports, {
|
|
|
22
22
|
BrowserServiceOptions: () => BrowserServiceOptions
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(browser_service_exports);
|
|
25
|
-
var import_decorators = require("../container/decorators.js");
|
|
26
|
-
var import_interfaces = require("../container/interfaces.js");
|
|
27
|
-
var import_core = require("../core.js");
|
|
28
25
|
var import_disposable = require("../disposable/disposable.js");
|
|
26
|
+
var import_decorators = require("../injector/decorators.js");
|
|
27
|
+
var import_interfaces = require("../injector/interfaces.js");
|
|
29
28
|
var import_object = require("../utils/object/object.js");
|
|
30
29
|
var import_type_guards = require("../utils/type-guards.js");
|
|
31
30
|
var import_browser_context_controller = require("./browser-context-controller.js");
|
|
@@ -63,19 +62,23 @@ let BrowserService = class BrowserService2 {
|
|
|
63
62
|
this.browsers = /* @__PURE__ */ new Set();
|
|
64
63
|
this.persistentBrowserContexts = /* @__PURE__ */ new Set();
|
|
65
64
|
}
|
|
66
|
-
[import_interfaces.afterResolve]() {
|
|
67
|
-
import_core.disposer.add(this);
|
|
68
|
-
}
|
|
69
65
|
async [import_disposable.disposeAsync]() {
|
|
70
66
|
return this.dispose();
|
|
71
67
|
}
|
|
72
|
-
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated internal use only
|
|
70
|
+
*/
|
|
71
|
+
async newRawBrowser(options) {
|
|
73
72
|
const mergedOptions = { ...this.options?.defaultNewBrowserOptions, ...options };
|
|
74
73
|
const launchOptions = (0, import_utils.getLaunchOptions)(mergedOptions);
|
|
75
74
|
const browser = await (0, import_module.getBrowserType)(mergedOptions.browser).launch(launchOptions);
|
|
76
75
|
this.browsers.add(browser);
|
|
77
76
|
browser.once("disconnected", () => this.browsers.delete(browser));
|
|
78
|
-
return
|
|
77
|
+
return { browser, controllerOptions: { defaultNewContextOptions: mergedOptions.defaultNewContextOptions } };
|
|
78
|
+
}
|
|
79
|
+
async newBrowser(options) {
|
|
80
|
+
const { browser, controllerOptions } = await this.newRawBrowser(options);
|
|
81
|
+
return new import_browser_controller.BrowserController(browser, controllerOptions);
|
|
79
82
|
}
|
|
80
83
|
async newPersistentContext(dataDirectory, browserOptions = {}, contextOptions = {}) {
|
|
81
84
|
const mergedBrowserOptions = { ...this.options?.defaultNewBrowserOptions, ...browserOptions };
|
|
@@ -118,7 +121,7 @@ let BrowserService = class BrowserService2 {
|
|
|
118
121
|
}
|
|
119
122
|
};
|
|
120
123
|
BrowserService = __decorate([
|
|
121
|
-
(0, import_decorators.
|
|
122
|
-
__param(0, (0, import_decorators.
|
|
124
|
+
(0, import_decorators.Singleton)(),
|
|
125
|
+
__param(0, (0, import_decorators.InjectArg)()),
|
|
123
126
|
__metadata("design:paramtypes", [BrowserServiceOptions])
|
|
124
127
|
], BrowserService);
|
package/browser/module.js
CHANGED
|
@@ -23,8 +23,8 @@ __export(module_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(module_exports);
|
|
25
25
|
var import_playwright = require("playwright");
|
|
26
|
-
var import_container = require("../container/container.js");
|
|
27
26
|
var import_not_supported_error = require("../error/not-supported.error.js");
|
|
27
|
+
var import_injector = require("../injector/injector.js");
|
|
28
28
|
var import_object = require("../utils/object/object.js");
|
|
29
29
|
var import_type_guards = require("../utils/type-guards.js");
|
|
30
30
|
var import_browser_service = require("./browser.service.js");
|
|
@@ -39,7 +39,7 @@ function configureBrowser(options) {
|
|
|
39
39
|
(0, import_object.copyObjectProperties)(filtered, browserTypes);
|
|
40
40
|
}
|
|
41
41
|
if ((0, import_type_guards.isDefined)(options.options)) {
|
|
42
|
-
|
|
42
|
+
import_injector.Injector.register(import_browser_service.BrowserServiceOptions, { useValue: options.options });
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
function getBrowserType(type) {
|
|
@@ -1,76 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { RegistrationOptions } from './container.js';
|
|
4
|
-
import type { Provider } from './provider.js';
|
|
5
|
-
import type { InjectionToken } from './token.js';
|
|
6
|
-
import type { ArgumentProvider, ForwardRefInjectionToken, Mapper } from './types.js';
|
|
7
|
-
type InjectDecorator = Decorator<'property' | 'accessor' | 'constructorParameter'>;
|
|
8
|
-
export type InjectableOptions<T, A> = RegistrationOptions<T> & {
|
|
9
|
-
/** aliases (tokens) for the class. Useful for example for circular dependencies when you can't use the class itself as a token */
|
|
10
|
-
alias?: OneOrMany<InjectionToken>;
|
|
11
|
-
/** custom provider. Useful for example if initialization is required */
|
|
12
|
-
provider?: Provider<T, A>;
|
|
13
|
-
};
|
|
14
|
-
export type InjectableOptionsWithoutLifecycle<T, A> = Simplify<TypedOmit<InjectableOptions<T, A>, 'lifecycle'>>;
|
|
15
|
-
/**
|
|
16
|
-
* Helper decorator to replace a class definition with an other
|
|
17
|
-
* can be used for example to type external classes with the {@link Injectable} interface
|
|
18
|
-
* @param constructor class to replace with
|
|
19
|
-
*/
|
|
20
|
-
export declare function replaceClass<T>(constructor: Constructor<T>): ClassDecorator;
|
|
21
|
-
/**
|
|
22
|
-
* registers the class in the global container. Decorated class is not modified in any way
|
|
23
|
-
* @param options registration options
|
|
24
|
-
*/
|
|
25
|
-
export declare function injectable<T = any, A = any>(options?: InjectableOptions<T, A>): ClassDecorator;
|
|
26
|
-
/**
|
|
27
|
-
* registers the class in the global container with singleton lifecycle. Decorated class is not modified in any way
|
|
28
|
-
* @param options registration options
|
|
29
|
-
*/
|
|
30
|
-
export declare function singleton<T = any, A = any>(options?: InjectableOptionsWithoutLifecycle<T, A>): ClassDecorator;
|
|
31
|
-
/**
|
|
32
|
-
* registers the class in the global container with scoped lifecycle. Decorated class is not modified in any way
|
|
33
|
-
* @param options registration options
|
|
34
|
-
*/
|
|
35
|
-
export declare function scoped<T = any, A = any>(lifecycle: 'resolution', options?: InjectableOptionsWithoutLifecycle<T, A>): ClassDecorator;
|
|
36
|
-
/**
|
|
37
|
-
* sets the token used to resolve the parameter
|
|
38
|
-
* @param token token used for resolving
|
|
39
|
-
* @param argument resolve argument
|
|
40
|
-
* @param mapperOrKey map the resolved value. If {@link PropertyKey} is provided, that property of the resolved value will be injected
|
|
41
|
-
*/
|
|
42
|
-
export declare function inject<T, A>(token?: InjectionToken<T, A>, argument?: A, mapperOrKey?: Mapper<T> | keyof T): InjectDecorator;
|
|
43
|
-
/**
|
|
44
|
-
* sets the argument used for resolving the parameter
|
|
45
|
-
* @param argument
|
|
46
|
-
*/
|
|
47
|
-
export declare function resolveArg<T>(argument: T): InjectDecorator;
|
|
48
|
-
/**
|
|
49
|
-
* sets the argument provider used for resolving the parameter
|
|
50
|
-
* @param argumentProvider
|
|
51
|
-
*/
|
|
52
|
-
export declare function resolveArgProvider<T>(argumentProvider: ArgumentProvider<T>): InjectDecorator;
|
|
53
|
-
/**
|
|
54
|
-
* injects the argument used for resolving the class instead of resolving the parameter
|
|
55
|
-
* @param argument
|
|
56
|
-
* @param mapperOrKey map the resolved value. If {@link PropertyKey} is provided, that property of the resolved value will be injected
|
|
57
|
-
*/
|
|
58
|
-
export declare function injectArg<T>(mapperOrKey?: Mapper<T> | keyof T): InjectDecorator;
|
|
59
|
-
/**
|
|
60
|
-
* sets the argument used for resolving the decorated parameter to the the argument provided for parent resolve
|
|
61
|
-
* @param mapper map the argument (for example to select a property instead of forwarding the whole object)
|
|
62
|
-
*/
|
|
63
|
-
export declare function forwardArg(): InjectDecorator;
|
|
64
|
-
export declare function forwardArg<T, U>(mapper: Mapper<T, U>): InjectDecorator;
|
|
65
|
-
/**
|
|
66
|
-
* marks the argument as optional
|
|
67
|
-
* @param argument
|
|
68
|
-
*/
|
|
69
|
-
export declare function optional(): InjectDecorator;
|
|
70
|
-
/**
|
|
71
|
-
* resolve using ForwardRef to handle circular dependencies. Resolve logic derefs all ForwardRefs which are direct properties of resolved instances automatically
|
|
72
|
-
* @param token token to resolve
|
|
73
|
-
* @param argument resolve argument
|
|
74
|
-
*/
|
|
75
|
-
export declare function forwardRef<T extends object, A>(token: ForwardRefInjectionToken<T>, argument?: A): InjectDecorator;
|
|
76
|
-
export {};
|
|
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
CHANGED
|
@@ -18,93 +18,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var decorators_exports = {};
|
|
20
20
|
__export(decorators_exports, {
|
|
21
|
-
forwardArg: () =>
|
|
22
|
-
forwardRef: () =>
|
|
23
|
-
inject: () =>
|
|
24
|
-
injectArg: () =>
|
|
25
|
-
injectable: () =>
|
|
26
|
-
optional: () =>
|
|
27
|
-
replaceClass: () =>
|
|
28
|
-
resolveArg: () =>
|
|
29
|
-
resolveArgProvider: () =>
|
|
30
|
-
scoped: () =>
|
|
31
|
-
singleton: () =>
|
|
21
|
+
forwardArg: () => import_decorators.ForwardArg,
|
|
22
|
+
forwardRef: () => import_decorators.ForwardRef,
|
|
23
|
+
inject: () => import_decorators.Inject,
|
|
24
|
+
injectArg: () => import_decorators.InjectArg,
|
|
25
|
+
injectable: () => import_decorators.Injectable,
|
|
26
|
+
optional: () => import_decorators.Optional,
|
|
27
|
+
replaceClass: () => import_decorators.ReplaceClass,
|
|
28
|
+
resolveArg: () => import_decorators.ResolveArg,
|
|
29
|
+
resolveArgProvider: () => import_decorators.ResolveArgProvider,
|
|
30
|
+
scoped: () => import_decorators.Scoped,
|
|
31
|
+
singleton: () => import_decorators.Singleton
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(decorators_exports);
|
|
34
|
-
var
|
|
35
|
-
var import_array = require("../utils/array/array.js");
|
|
36
|
-
var import_type_guards = require("../utils/type-guards.js");
|
|
37
|
-
var import_container = require("./container.js");
|
|
38
|
-
function replaceClass(constructor) {
|
|
39
|
-
return (0, import_reflection.createClassDecorator)({ handler: () => constructor });
|
|
40
|
-
}
|
|
41
|
-
function injectable(options = {}) {
|
|
42
|
-
return (0, import_reflection.createClassDecorator)({
|
|
43
|
-
data: { [import_container.injectMetadataSymbol]: {} },
|
|
44
|
-
mergeData: true,
|
|
45
|
-
handler: (data) => {
|
|
46
|
-
const { alias: aliases, provider, ...registrationOptions } = options;
|
|
47
|
-
const targetProvider = provider ?? { useClass: data.constructor };
|
|
48
|
-
import_container.container.register(data.constructor, targetProvider, registrationOptions);
|
|
49
|
-
if ((0, import_type_guards.isDefined)(aliases)) {
|
|
50
|
-
for (const alias of (0, import_array.toArray)(aliases)) {
|
|
51
|
-
import_container.container.register(alias, { useToken: data.constructor }, registrationOptions);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
function singleton(options = {}) {
|
|
58
|
-
return injectable({ ...options, lifecycle: "singleton" });
|
|
59
|
-
}
|
|
60
|
-
function scoped(lifecycle, options = {}) {
|
|
61
|
-
return injectable({ ...options, lifecycle });
|
|
62
|
-
}
|
|
63
|
-
function inject(token, argument, mapperOrKey) {
|
|
64
|
-
const injectMetadata = {};
|
|
65
|
-
if ((0, import_type_guards.isDefined)(token)) {
|
|
66
|
-
injectMetadata.injectToken = token;
|
|
67
|
-
}
|
|
68
|
-
if ((0, import_type_guards.isDefined)(argument)) {
|
|
69
|
-
injectMetadata.resolveArgumentProvider = () => argument;
|
|
70
|
-
}
|
|
71
|
-
if ((0, import_type_guards.isDefined)(mapperOrKey)) {
|
|
72
|
-
injectMetadata.mapper = (0, import_type_guards.isFunction)(mapperOrKey) ? mapperOrKey : (value) => value[mapperOrKey];
|
|
73
|
-
}
|
|
74
|
-
return createInjectDecorator(injectMetadata);
|
|
75
|
-
}
|
|
76
|
-
function resolveArg(argument) {
|
|
77
|
-
return resolveArgProvider(() => argument);
|
|
78
|
-
}
|
|
79
|
-
function resolveArgProvider(argumentProvider) {
|
|
80
|
-
return createInjectDecorator({ resolveArgumentProvider: argumentProvider });
|
|
81
|
-
}
|
|
82
|
-
function injectArg(mapperOrKey) {
|
|
83
|
-
return createInjectDecorator({
|
|
84
|
-
injectArgumentMapper: (0, import_type_guards.isFunction)(mapperOrKey) ? mapperOrKey : (0, import_type_guards.isDefined)(mapperOrKey) ? (value) => value[mapperOrKey] : (value) => value
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
function forwardArg(mapper = (value) => value) {
|
|
88
|
-
return createInjectDecorator({ forwardArgumentMapper: mapper });
|
|
89
|
-
}
|
|
90
|
-
function optional() {
|
|
91
|
-
return createInjectDecorator({ optional: true });
|
|
92
|
-
}
|
|
93
|
-
function forwardRef(token, argument) {
|
|
94
|
-
const injectMetadata = {
|
|
95
|
-
forwardRefToken: token
|
|
96
|
-
};
|
|
97
|
-
if ((0, import_type_guards.isDefined)(argument)) {
|
|
98
|
-
injectMetadata.resolveArgumentProvider = () => argument;
|
|
99
|
-
}
|
|
100
|
-
return createInjectDecorator(injectMetadata);
|
|
101
|
-
}
|
|
102
|
-
function createInjectDecorator(metadata) {
|
|
103
|
-
return (0, import_reflection.createDecorator)({
|
|
104
|
-
property: true,
|
|
105
|
-
accessor: true,
|
|
106
|
-
constructorParameter: true,
|
|
107
|
-
data: { [import_container.injectMetadataSymbol]: metadata },
|
|
108
|
-
mergeData: true
|
|
109
|
-
});
|
|
110
|
-
}
|
|
34
|
+
var import_decorators = require("../injector/decorators.js");
|
package/container/index.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
export * from './container.js';
|
|
2
1
|
export * from './decorators.js';
|
|
3
2
|
export * from './interfaces.js';
|
|
4
|
-
export * from './provider.js';
|
|
5
|
-
export * from './resolve-chain.js';
|
|
6
|
-
export * from './resolve.error.js';
|
|
7
3
|
export * from './token.js';
|
|
8
|
-
export * from './type-info.js';
|
|
9
|
-
export * from './types.js';
|
|
10
|
-
export * from './utils.js';
|
package/container/index.js
CHANGED
|
@@ -15,13 +15,6 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
15
15
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
16
|
var container_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(container_exports);
|
|
18
|
-
__reExport(container_exports, require("./container.js"), module.exports);
|
|
19
18
|
__reExport(container_exports, require("./decorators.js"), module.exports);
|
|
20
19
|
__reExport(container_exports, require("./interfaces.js"), module.exports);
|
|
21
|
-
__reExport(container_exports, require("./provider.js"), module.exports);
|
|
22
|
-
__reExport(container_exports, require("./resolve-chain.js"), module.exports);
|
|
23
|
-
__reExport(container_exports, require("./resolve.error.js"), module.exports);
|
|
24
20
|
__reExport(container_exports, require("./token.js"), module.exports);
|
|
25
|
-
__reExport(container_exports, require("./type-info.js"), module.exports);
|
|
26
|
-
__reExport(container_exports, require("./types.js"), module.exports);
|
|
27
|
-
__reExport(container_exports, require("./utils.js"), module.exports);
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export type InjectableArgument<T, Fallback> = T extends Injectable<infer A> ? A : Fallback;
|
|
4
|
-
export interface Injectable<T = unknown> {
|
|
5
|
-
/**
|
|
6
|
-
* type of resolve argument
|
|
7
|
-
* @deprecated only used for type inference
|
|
8
|
-
*/
|
|
9
|
-
readonly [resolveArgumentType]: T;
|
|
10
|
-
}
|
|
11
|
-
export interface AfterResolve {
|
|
12
|
-
/**
|
|
13
|
-
* called after resolve through container
|
|
14
|
-
*/
|
|
15
|
-
[afterResolve](): void | Promise<void>;
|
|
16
|
-
}
|
|
1
|
+
export { afterResolve, resolveArgumentType } from '../injector/interfaces.js';
|
|
2
|
+
export type { AfterResolve, Resolvable as Injectable, ResolveArgument as InjectableArgument } from '../injector/interfaces.js';
|
package/container/interfaces.js
CHANGED
|
@@ -18,9 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var interfaces_exports = {};
|
|
20
20
|
__export(interfaces_exports, {
|
|
21
|
-
afterResolve: () => afterResolve,
|
|
22
|
-
resolveArgumentType: () => resolveArgumentType
|
|
21
|
+
afterResolve: () => import_interfaces.afterResolve,
|
|
22
|
+
resolveArgumentType: () => import_interfaces.resolveArgumentType
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(interfaces_exports);
|
|
25
|
-
|
|
26
|
-
const afterResolve = Symbol("after resolve");
|
|
25
|
+
var import_interfaces = require("../injector/interfaces.js");
|
package/container/token.d.ts
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const argument: unique symbol;
|
|
4
|
-
export type ArgumentedInjectionToken<T, A> = SimpleInjectionToken<T> & {
|
|
5
|
-
[argument]?: A;
|
|
6
|
-
};
|
|
7
|
-
export type SimpleInjectionToken<T> = AbstractConstructor<T> | EnumerationObject;
|
|
8
|
-
export type InjectionToken<T = any, A = any> = SimpleInjectionToken<T> | ArgumentedInjectionToken<T, A> | ReifyingInjectionToken<T, A>;
|
|
9
|
-
export declare class ReifyingInjectionToken<T = any, A = any> {
|
|
10
|
-
private readonly [type];
|
|
11
|
-
private readonly [argument];
|
|
12
|
-
readonly description: string;
|
|
13
|
-
constructor(description: string);
|
|
14
|
-
toString(): string;
|
|
15
|
-
}
|
|
16
|
-
export declare function injectionToken<T, A = any>(description: string): InjectionToken<T, A>;
|
|
17
|
-
export declare function getTokenName(token: InjectionToken | undefined): string;
|
|
18
|
-
export {};
|
|
1
|
+
export { ReifyingInjectionToken, getTokenName, injectionToken } from '../injector/token.js';
|
|
2
|
+
export type { ArgumentedInjectionToken, InjectionToken, SimpleInjectionToken } from '../injector/token.js';
|
package/container/token.js
CHANGED
|
@@ -18,24 +18,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var token_exports = {};
|
|
20
20
|
__export(token_exports, {
|
|
21
|
-
ReifyingInjectionToken: () => ReifyingInjectionToken,
|
|
22
|
-
getTokenName: () => getTokenName,
|
|
23
|
-
injectionToken: () => injectionToken
|
|
21
|
+
ReifyingInjectionToken: () => import_token.ReifyingInjectionToken,
|
|
22
|
+
getTokenName: () => import_token.getTokenName,
|
|
23
|
+
injectionToken: () => import_token.injectionToken
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(token_exports);
|
|
26
|
-
var
|
|
27
|
-
class ReifyingInjectionToken {
|
|
28
|
-
description;
|
|
29
|
-
constructor(description) {
|
|
30
|
-
this.description = description;
|
|
31
|
-
}
|
|
32
|
-
toString() {
|
|
33
|
-
return `InjectionToken["${this.description}"]`;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
function injectionToken(description) {
|
|
37
|
-
return new ReifyingInjectionToken(description);
|
|
38
|
-
}
|
|
39
|
-
function getTokenName(token) {
|
|
40
|
-
return (0, import_type_guards.isFunction)(token) ? token.name : (0, import_type_guards.isString)(token) ? `"${token}"` : String(token);
|
|
41
|
-
}
|
|
26
|
+
var import_token = require("../injector/token.js");
|