ditox 2.2.0 → 2.3.1

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.
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.injectableProps = exports.resolveProps = exports.getProps = exports.getValues = void 0;
4
- const utils_1 = require("./utils");
5
- /**
6
- * Returns an array of resolved values by the specified token.
7
- * If a token is not found, then `undefined` value is used.
8
- *
9
- * @deprecated Use `tryResolveValues()` function.
10
- */
11
- function getValues(container, ...tokens) {
12
- return (0, utils_1.tryResolveValues)(container, ...tokens);
13
- }
14
- exports.getValues = getValues;
15
- /**
16
- * Returns an object with resolved properties which are specified by token properties.
17
- * If a token is not found, then `undefined` value is used.
18
- *
19
- * @deprecated Use `tryResolveValue()` function.
20
- *
21
- * @example
22
- * ```ts
23
- * const props = getProps(container, {a: tokenA, b: tokenB});
24
- * console.log(props); // {a: 1, b: 2}
25
- * ```
26
- */
27
- function getProps(container, tokens) {
28
- return (0, utils_1.tryResolveValue)(container, tokens);
29
- }
30
- exports.getProps = getProps;
31
- /**
32
- * Returns an object with resolved properties which are specified by token properties.
33
- * If a token is not found, then `ResolverError` is thrown.
34
- *
35
- * @deprecated Use `resolveValue()` function.
36
- *
37
- * @example
38
- * ```ts
39
- * const props = resolveProps(container, {a: tokenA, b: tokenB});
40
- * console.log(props); // {a: 1, b: 2}
41
- * ```
42
- */
43
- function resolveProps(container, tokens) {
44
- return (0, utils_1.resolveValue)(container, tokens);
45
- }
46
- exports.resolveProps = resolveProps;
47
- /**
48
- * Decorates a factory by passing a resolved object with tokens as the first argument.
49
- * @param factory - A factory.
50
- * @param tokens - Object with tokens.
51
- * @return Decorated factory which takes a dependency container as a single argument.
52
- *
53
- * @deprecated Use `injectable()` function.
54
- *
55
- * @example
56
- * ```ts
57
- * const factory = ({a, b}: {a: number, b: number}) => a + b;
58
- * const decoratedFactory = injectableProps(factory, {a: tokenA, b: tokenB});
59
- * const result = decoratedFactory(container);
60
- * ```
61
- */
62
- function injectableProps(factory, tokens) {
63
- return (0, utils_1.injectable)(factory, tokens);
64
- }
65
- exports.injectableProps = injectableProps;
66
- //# sourceMappingURL=utils-deprecated.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-deprecated.js","sourceRoot":"","sources":["../../src/utils-deprecated.ts"],"names":[],"mappings":";;;AACA,mCAKiB;AAOjB;;;;;GAKG;AACH,SAAgB,SAAS,CAKvB,SAAoB,EAAE,GAAG,MAAc;IACvC,OAAO,IAAA,wBAAgB,EAAC,SAAS,EAAE,GAAG,MAAM,CAAC,CAAC;AAChD,CAAC;AAPD,8BAOC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,QAAQ,CACtB,SAAoB,EACpB,MAAyB;IAEzB,OAAO,IAAA,uBAAe,EAAC,SAAS,EAAE,MAAM,CAAmB,CAAC;AAC9D,CAAC;AALD,4BAKC;AAED;;;;;;;;;;;GAWG;AACH,SAAgB,YAAY,CAC1B,SAAoB,EACpB,MAAyB;IAEzB,OAAO,IAAA,oBAAY,EAAC,SAAS,EAAE,MAAM,CAAU,CAAC;AAClD,CAAC;AALD,oCAKC;AAED;;;;;;;;;;;;;;GAcG;AACH,SAAgB,eAAe,CAC7B,OAAiC,EACjC,MAAyB;IAEzB,OAAO,IAAA,kBAAU,EAAC,OAAc,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC;AALD,0CAKC"}
@@ -1,59 +0,0 @@
1
- import type { Container, Token } from './ditox';
2
- declare type ValuesProps = {
3
- [key: string]: unknown;
4
- };
5
- declare type TokenProps<Props extends ValuesProps> = {
6
- [K in keyof Props]: Token<Props[K]>;
7
- };
8
- /**
9
- * Returns an array of resolved values by the specified token.
10
- * If a token is not found, then `undefined` value is used.
11
- *
12
- * @deprecated Use `tryResolveValues()` function.
13
- */
14
- export declare function getValues<Tokens extends Token<unknown>[], Values extends {
15
- [K in keyof Tokens]: Tokens[K] extends Token<infer V> ? V : never;
16
- }>(container: Container, ...tokens: Tokens): Values;
17
- /**
18
- * Returns an object with resolved properties which are specified by token properties.
19
- * If a token is not found, then `undefined` value is used.
20
- *
21
- * @deprecated Use `tryResolveValue()` function.
22
- *
23
- * @example
24
- * ```ts
25
- * const props = getProps(container, {a: tokenA, b: tokenB});
26
- * console.log(props); // {a: 1, b: 2}
27
- * ```
28
- */
29
- export declare function getProps<Props extends ValuesProps>(container: Container, tokens: TokenProps<Props>): Partial<Props>;
30
- /**
31
- * Returns an object with resolved properties which are specified by token properties.
32
- * If a token is not found, then `ResolverError` is thrown.
33
- *
34
- * @deprecated Use `resolveValue()` function.
35
- *
36
- * @example
37
- * ```ts
38
- * const props = resolveProps(container, {a: tokenA, b: tokenB});
39
- * console.log(props); // {a: 1, b: 2}
40
- * ```
41
- */
42
- export declare function resolveProps<Props extends ValuesProps>(container: Container, tokens: TokenProps<Props>): Props;
43
- /**
44
- * Decorates a factory by passing a resolved object with tokens as the first argument.
45
- * @param factory - A factory.
46
- * @param tokens - Object with tokens.
47
- * @return Decorated factory which takes a dependency container as a single argument.
48
- *
49
- * @deprecated Use `injectable()` function.
50
- *
51
- * @example
52
- * ```ts
53
- * const factory = ({a, b}: {a: number, b: number}) => a + b;
54
- * const decoratedFactory = injectableProps(factory, {a: tokenA, b: tokenB});
55
- * const result = decoratedFactory(container);
56
- * ```
57
- */
58
- export declare function injectableProps<Props extends ValuesProps, Result>(factory: (props: Props) => Result, tokens: TokenProps<Props>): (container: Container) => Result;
59
- export {};
@@ -1,59 +0,0 @@
1
- import { injectable, resolveValue, tryResolveValue, tryResolveValues, } from './utils';
2
- /**
3
- * Returns an array of resolved values by the specified token.
4
- * If a token is not found, then `undefined` value is used.
5
- *
6
- * @deprecated Use `tryResolveValues()` function.
7
- */
8
- export function getValues(container, ...tokens) {
9
- return tryResolveValues(container, ...tokens);
10
- }
11
- /**
12
- * Returns an object with resolved properties which are specified by token properties.
13
- * If a token is not found, then `undefined` value is used.
14
- *
15
- * @deprecated Use `tryResolveValue()` function.
16
- *
17
- * @example
18
- * ```ts
19
- * const props = getProps(container, {a: tokenA, b: tokenB});
20
- * console.log(props); // {a: 1, b: 2}
21
- * ```
22
- */
23
- export function getProps(container, tokens) {
24
- return tryResolveValue(container, tokens);
25
- }
26
- /**
27
- * Returns an object with resolved properties which are specified by token properties.
28
- * If a token is not found, then `ResolverError` is thrown.
29
- *
30
- * @deprecated Use `resolveValue()` function.
31
- *
32
- * @example
33
- * ```ts
34
- * const props = resolveProps(container, {a: tokenA, b: tokenB});
35
- * console.log(props); // {a: 1, b: 2}
36
- * ```
37
- */
38
- export function resolveProps(container, tokens) {
39
- return resolveValue(container, tokens);
40
- }
41
- /**
42
- * Decorates a factory by passing a resolved object with tokens as the first argument.
43
- * @param factory - A factory.
44
- * @param tokens - Object with tokens.
45
- * @return Decorated factory which takes a dependency container as a single argument.
46
- *
47
- * @deprecated Use `injectable()` function.
48
- *
49
- * @example
50
- * ```ts
51
- * const factory = ({a, b}: {a: number, b: number}) => a + b;
52
- * const decoratedFactory = injectableProps(factory, {a: tokenA, b: tokenB});
53
- * const result = decoratedFactory(container);
54
- * ```
55
- */
56
- export function injectableProps(factory, tokens) {
57
- return injectable(factory, tokens);
58
- }
59
- //# sourceMappingURL=utils-deprecated.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils-deprecated.js","sourceRoot":"","sources":["../../src/utils-deprecated.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,eAAe,EACf,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAOjB;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAKvB,SAAoB,EAAE,GAAG,MAAc;IACvC,OAAO,gBAAgB,CAAC,SAAS,EAAE,GAAG,MAAM,CAAC,CAAC;AAChD,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,QAAQ,CACtB,SAAoB,EACpB,MAAyB;IAEzB,OAAO,eAAe,CAAC,SAAS,EAAE,MAAM,CAAmB,CAAC;AAC9D,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAC1B,SAAoB,EACpB,MAAyB;IAEzB,OAAO,YAAY,CAAC,SAAS,EAAE,MAAM,CAAU,CAAC;AAClD,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAiC,EACjC,MAAyB;IAEzB,OAAO,UAAU,CAAC,OAAc,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC"}
package/docs/.nojekyll DELETED
@@ -1 +0,0 @@
1
- TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false.