inversify-typesafe 0.3.2 → 0.5.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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -12
- package/dist/index.d.ts +8 -12
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
1
|
+
var e=require("inversify");exports.createTypesafeContainer=function(n,r){var t=new e.Container(r);return Object.entries(n).forEach(function(e){(0,e[1])(t.bind(e[0]),t)}),t},exports.returnTypesafeInject=function(){return function(n){return e.inject(n)}};
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import { BindToFluentSyntax, Container, ContainerOptions, inject } from \"inversify\";\n\nexport type
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import { BindToFluentSyntax, Container, ContainerOptions, inject, ServiceIdentifier } from \"inversify\";\n\nexport type TypesafeContainer<S extends Record<string, unknown>> =\n Omit<Container, \"get\"> & {\n get<T extends keyof S>(serviceName: T | Exclude<ServiceIdentifier<T>, string>): S[T];\n };\n\nexport type TypesafeServiceConfig<S extends Record<string, unknown>> = {\n [K in keyof S]: ((\n bind: BindToFluentSyntax<S[K]>,\n container: TypesafeContainer<S>\n ) => void);\n};\n\nexport const returnTypesafeInject = <S extends Record<string, unknown>>() => (name: Extract<keyof S, string>) => inject(name);\n\nexport const createTypesafeContainer = <S extends Record<string, unknown>>(\n serviceConfig: TypesafeServiceConfig<S>,\n options?: ContainerOptions,\n): TypesafeContainer<S> => {\n const container = new Container(options);\n\n Object.entries(serviceConfig).forEach(([name, bindingFunction]) => {\n bindingFunction(container.bind(name), container);\n });\n\n return container;\n};"],"names":["serviceConfig","options","container","Container","Object","entries","forEach","_ref","bindingFunction","bind","name","inject"],"mappings":"2DAgBuC,SACrCA,EACAC,GAEA,IAAMC,EAAY,IAAIC,EAAAA,UAAUF,GAMhC,OAJAG,OAAOC,QAAQL,GAAeM,QAAQ,SAAAC,IACpCC,EAD2DD,EAC3DC,IAAgBN,EAAUO,KADgBF,MACJL,EACxC,GAEOA,CACT,+BAboC,kBAA0CQ,SAAAA,UAAmCC,EAAAA,OAAOD,EAAK,CAE7H"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { BindToFluentSyntax, Container, ContainerOptions } from "inversify";
|
|
2
|
-
export type
|
|
3
|
-
|
|
4
|
-
get<T extends keyof S>(serviceName: T): S[T];
|
|
5
|
-
}) => void);
|
|
1
|
+
import { BindToFluentSyntax, Container, ContainerOptions, ServiceIdentifier } from "inversify";
|
|
2
|
+
export type TypesafeContainer<S extends Record<string, unknown>> = Omit<Container, "get"> & {
|
|
3
|
+
get<T extends keyof S>(serviceName: T | Exclude<ServiceIdentifier<T>, string>): S[T];
|
|
6
4
|
};
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
getContainer(): Container;
|
|
13
|
-
}
|
|
5
|
+
export type TypesafeServiceConfig<S extends Record<string, unknown>> = {
|
|
6
|
+
[K in keyof S]: ((bind: BindToFluentSyntax<S[K]>, container: TypesafeContainer<S>) => void);
|
|
7
|
+
};
|
|
8
|
+
export declare const returnTypesafeInject: <S extends Record<string, unknown>>() => (name: Extract<keyof S, string>) => MethodDecorator & ParameterDecorator & PropertyDecorator;
|
|
9
|
+
export declare const createTypesafeContainer: <S extends Record<string, unknown>>(serviceConfig: TypesafeServiceConfig<S>, options?: ContainerOptions) => TypesafeContainer<S>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { BindToFluentSyntax, Container, ContainerOptions } from "inversify";
|
|
2
|
-
export type
|
|
3
|
-
|
|
4
|
-
get<T extends keyof S>(serviceName: T): S[T];
|
|
5
|
-
}) => void);
|
|
1
|
+
import { BindToFluentSyntax, Container, ContainerOptions, ServiceIdentifier } from "inversify";
|
|
2
|
+
export type TypesafeContainer<S extends Record<string, unknown>> = Omit<Container, "get"> & {
|
|
3
|
+
get<T extends keyof S>(serviceName: T | Exclude<ServiceIdentifier<T>, string>): S[T];
|
|
6
4
|
};
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
getContainer(): Container;
|
|
13
|
-
}
|
|
5
|
+
export type TypesafeServiceConfig<S extends Record<string, unknown>> = {
|
|
6
|
+
[K in keyof S]: ((bind: BindToFluentSyntax<S[K]>, container: TypesafeContainer<S>) => void);
|
|
7
|
+
};
|
|
8
|
+
export declare const returnTypesafeInject: <S extends Record<string, unknown>>() => (name: Extract<keyof S, string>) => MethodDecorator & ParameterDecorator & PropertyDecorator;
|
|
9
|
+
export declare const createTypesafeContainer: <S extends Record<string, unknown>>(serviceConfig: TypesafeServiceConfig<S>, options?: ContainerOptions) => TypesafeContainer<S>;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{inject as
|
|
1
|
+
import{inject as r,Container as e}from"inversify";const n=()=>e=>r(e),t=(r,n)=>{const t=new e(n);return Object.entries(r).forEach(([r,e])=>{e(t.bind(r),t)}),t};export{t as createTypesafeContainer,n as returnTypesafeInject};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { BindToFluentSyntax, Container, ContainerOptions, inject } from \"inversify\";\n\nexport type
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import { BindToFluentSyntax, Container, ContainerOptions, inject, ServiceIdentifier } from \"inversify\";\n\nexport type TypesafeContainer<S extends Record<string, unknown>> =\n Omit<Container, \"get\"> & {\n get<T extends keyof S>(serviceName: T | Exclude<ServiceIdentifier<T>, string>): S[T];\n };\n\nexport type TypesafeServiceConfig<S extends Record<string, unknown>> = {\n [K in keyof S]: ((\n bind: BindToFluentSyntax<S[K]>,\n container: TypesafeContainer<S>\n ) => void);\n};\n\nexport const returnTypesafeInject = <S extends Record<string, unknown>>() => (name: Extract<keyof S, string>) => inject(name);\n\nexport const createTypesafeContainer = <S extends Record<string, unknown>>(\n serviceConfig: TypesafeServiceConfig<S>,\n options?: ContainerOptions,\n): TypesafeContainer<S> => {\n const container = new Container(options);\n\n Object.entries(serviceConfig).forEach(([name, bindingFunction]) => {\n bindingFunction(container.bind(name), container);\n });\n\n return container;\n};"],"names":["returnTypesafeInject","name","inject","createTypesafeContainer","serviceConfig","options","container","Container","Object","entries","forEach","bindingFunction","bind"],"mappings":"kDAca,MAAAA,EAAuBA,IAA0CC,GAAmCC,EAAOD,GAE3GE,EAA0BA,CACrCC,EACAC,KAEA,MAAMC,EAAY,IAAIC,EAAUF,GAMhC,OAJAG,OAAOC,QAAQL,GAAeM,QAAQ,EAAET,EAAMU,MAC5CA,EAAgBL,EAAUM,KAAKX,GAAOK,KAGjCA"}
|
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(n
|
|
1
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("inversify")):"function"==typeof define&&define.amd?define(["exports","inversify"],n):n((e||self).inversifyTypesafe={},e.inversify)}(this,function(e,n){e.createTypesafeContainer=function(e,i){var t=new n.Container(i);return Object.entries(e).forEach(function(e){(0,e[1])(t.bind(e[0]),t)}),t},e.returnTypesafeInject=function(){return function(e){return n.inject(e)}}});
|
|
2
2
|
//# sourceMappingURL=index.umd.js.map
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/index.ts"],"sourcesContent":["import { BindToFluentSyntax, Container, ContainerOptions, inject } from \"inversify\";\n\nexport type
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/index.ts"],"sourcesContent":["import { BindToFluentSyntax, Container, ContainerOptions, inject, ServiceIdentifier } from \"inversify\";\n\nexport type TypesafeContainer<S extends Record<string, unknown>> =\n Omit<Container, \"get\"> & {\n get<T extends keyof S>(serviceName: T | Exclude<ServiceIdentifier<T>, string>): S[T];\n };\n\nexport type TypesafeServiceConfig<S extends Record<string, unknown>> = {\n [K in keyof S]: ((\n bind: BindToFluentSyntax<S[K]>,\n container: TypesafeContainer<S>\n ) => void);\n};\n\nexport const returnTypesafeInject = <S extends Record<string, unknown>>() => (name: Extract<keyof S, string>) => inject(name);\n\nexport const createTypesafeContainer = <S extends Record<string, unknown>>(\n serviceConfig: TypesafeServiceConfig<S>,\n options?: ContainerOptions,\n): TypesafeContainer<S> => {\n const container = new Container(options);\n\n Object.entries(serviceConfig).forEach(([name, bindingFunction]) => {\n bindingFunction(container.bind(name), container);\n });\n\n return container;\n};"],"names":["serviceConfig","options","container","Container","Object","entries","forEach","_ref","bindingFunction","bind","name","inject"],"mappings":"oTAgBuC,SACrCA,EACAC,GAEA,IAAMC,EAAY,IAAIC,EAAAA,UAAUF,GAMhC,OAJAG,OAAOC,QAAQL,GAAeM,QAAQ,SAAAC,IACpCC,EAD2DD,EAC3DC,IAAgBN,EAAUO,KADgBF,MACJL,EACxC,GAEOA,CACT,yBAboC,kBAA0CQ,SAAAA,UAAmCC,EAAAA,OAAOD,EAAK,CAE7H"}
|