@adonisjs/fold
Advanced tools
Comparing version 9.3.1-0 to 9.3.2-0
import type { Make, Constructor, HookCallback, BindingResolver, ExtractFunctions, ContainerOptions } from './types.js'; | ||
import { ContainerResolver } from './resolver.js'; | ||
export declare class Container<KnownBindings extends Record<any, any>> { | ||
export declare class Container<KnownBindings extends Record<any, any> = Record<any, any>> { | ||
#private; | ||
@@ -5,0 +5,0 @@ constructor(options?: ContainerOptions); |
@@ -16,3 +16,3 @@ import { resolveDefault } from './helpers.js'; | ||
if (container) { | ||
return async function (...args) { | ||
return async function (args) { | ||
defaultExport = defaultExport || (await resolveDefault(importPath, parentURL)); | ||
@@ -22,3 +22,3 @@ return container.call(await container.make(defaultExport), method, args); | ||
} | ||
return async function (resolver, ...args) { | ||
return async function (resolver, args) { | ||
defaultExport = defaultExport || (await resolveDefault(importPath, parentURL)); | ||
@@ -33,3 +33,3 @@ return resolver.call(await resolver.make(defaultExport), method, args); | ||
return { | ||
async handle(...args) { | ||
async handle(args) { | ||
defaultExport = defaultExport || (await resolveDefault(importPath, parentURL)); | ||
@@ -41,3 +41,3 @@ return container.call(await container.make(defaultExport), method, args); | ||
return { | ||
async handle(resolver, ...args) { | ||
async handle(resolver, args) { | ||
defaultExport = defaultExport || (await resolveDefault(importPath, parentURL)); | ||
@@ -44,0 +44,0 @@ return resolver.call(await resolver.make(defaultExport), method, args); |
@@ -7,3 +7,3 @@ import { importDefault } from './helpers.js'; | ||
if (container) { | ||
return async function (...args) { | ||
return async function (args) { | ||
defaultExport = defaultExport || (await importDefault(importFn)); | ||
@@ -13,3 +13,3 @@ return container.call(await container.make(defaultExport), method, args); | ||
} | ||
return async function (resolver, ...args) { | ||
return async function (resolver, args) { | ||
defaultExport = defaultExport || (await importDefault(importFn)); | ||
@@ -23,3 +23,3 @@ return resolver.call(await resolver.make(defaultExport), method, args); | ||
return { | ||
async handle(...args) { | ||
async handle(args) { | ||
defaultExport = defaultExport || (await importDefault(importFn)); | ||
@@ -31,3 +31,3 @@ return container.call(await container.make(defaultExport), method, args); | ||
return { | ||
async handle(resolver, ...args) { | ||
async handle(resolver, args) { | ||
defaultExport = defaultExport || (await importDefault(importFn)); | ||
@@ -34,0 +34,0 @@ return resolver.call(await resolver.make(defaultExport), method, args); |
import type { Make, Hooks, Swaps, Bindings, Constructor, BindingValues, ExtractFunctions, ContainerOptions } from './types.js'; | ||
export declare class ContainerResolver<KnownBindings extends Record<any, any>> { | ||
export declare class ContainerResolver<KnownBindings extends Record<any, any> = Record<any, any>> { | ||
#private; | ||
@@ -4,0 +4,0 @@ constructor(bindings: Bindings, bindingValues: BindingValues, swaps: Swaps, hooks: Hooks, options: ContainerOptions); |
@@ -38,7 +38,7 @@ import type { Container } from './container.js'; | ||
}; | ||
export type ModuleCallable<T, Args extends any[]> = T extends undefined ? (resolver: ContainerResolver<any> | Container<any>, ...args: Args) => Promise<any> : (...args: Args) => Promise<any>; | ||
export type ModuleCallable<T, Args extends any[]> = T extends undefined ? (resolver: ContainerResolver<any> | Container<any>, args: Args) => Promise<any> : (args: Args) => Promise<any>; | ||
export type ModuleHandler<T, Args extends any[]> = T extends undefined ? { | ||
handle(resolver: ContainerResolver<any> | Container<any>, ...args: Args): Promise<any>; | ||
handle(resolver: ContainerResolver<any> | Container<any>, args: Args): Promise<any>; | ||
} : { | ||
handle(...args: Args): Promise<any>; | ||
handle(args: Args): Promise<any>; | ||
}; |
{ | ||
"name": "@adonisjs/fold", | ||
"version": "9.3.1-0", | ||
"version": "9.3.2-0", | ||
"description": "Simplest and straight forward implementation for IoC container in JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
@@ -506,3 +506,3 @@ # AdonisJS Fold | ||
const resolver = container.createResolver() | ||
await fn(resolver, ctx) | ||
await fn(resolver, [ctx]) | ||
``` | ||
@@ -520,3 +520,3 @@ | ||
// Later call it | ||
await fn(ctx) | ||
await fn([ctx]) | ||
``` | ||
@@ -541,3 +541,3 @@ | ||
const resolver = container.createResolver() | ||
await handler.handle(resolver, ctx) | ||
await handler.handle(resolver, [ctx]) | ||
``` | ||
@@ -556,3 +556,3 @@ | ||
// Later call it | ||
await handler.handle(ctx) | ||
await handler.handle([ctx]) | ||
``` | ||
@@ -586,3 +586,3 @@ | ||
const resolver = container.createResolver() | ||
await fn(resolver, ctx) | ||
await fn(resolver, [ctx]) | ||
``` | ||
@@ -603,3 +603,3 @@ | ||
const resolver = container.createResolver() | ||
await handler.handle(resolver, ctx) | ||
await handler.handle(resolver, [ctx]) | ||
``` | ||
@@ -606,0 +606,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48703