Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
before(() => {
InputAndEmit("eventName")(Test, "test", {} as any);
this.store = Store.from(Test);
});
before(() => {
Title("title")(Test, "test", descriptorOf(Test, "test"));
this.store = Store.from(Test, "test", descriptorOf(Test, "test"));
});
it("should set the schema", () => {
before(() => {
Title("title")(Test, "test", 0);
this.store = Store.from(Test, "test", 0);
});
it("should set the schema", () => {
before(() => {
this.descriptor = {};
this.options = 200;
Status(this.options, {
description: "description",
use: "use",
collection: "collection",
headers: {
"200": {
value: "headers"
}
}
})(Test, "test", this.descriptor);
this.middleware = UseAfter.args[0][0];
this.store = Store.from(Test, "test", this.descriptor);
});
before(() => {
Broadcast("eventName")(Test, "test", {} as any);
this.store = Store.from(Test);
});
before(() => {
SocketEventName(Test, "test", 0);
this.store = Store.from(Test);
});
inject([InjectorService], (injectorService: InjectorService) => {
this.registrySettings = {
onInvoke: Sinon.stub()
};
this.designParamTypes = [TestDep];
this.getRegistrySettingsStub = Sinon.stub(GlobalProviders, "getRegistrySettings").returns(this.registrySettings);
this.getParamTypesStub = Sinon.stub(Metadata, "getParamTypes").returns(this.designParamTypes);
this.getStub = Sinon.stub(injectorService, "getProvider").returns(undefined);
this.mapServicesStub = Sinon.stub(injectorService as any, "mapServices").returns((this.dep = new TestDep()));
Store.from(Test).set("scope", "request");
this.locals = new Map();
this.result = injectorService.invoke(Test, this.locals, undefined, false);
})
);
return (target: Type) => {
Store.from(target).merge("socketIO", {
type: SocketProviderTypes.MIDDLEWARE,
error: true,
handlers: {
use: {
methodClassName: "use"
}
}
});
return Middleware()(target);
};
}
return (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor | number): any => {
const bindingType = getDecoratorType([target, propertyKey, descriptor], true);
switch (bindingType) {
case "parameter":
case "parameter.constructor":
if (symbol) {
const paramTypes = Metadata.getParamTypes(target, propertyKey);
paramTypes[descriptor as number] = symbol;
Metadata.setParamTypes(target, propertyKey, paramTypes);
}
break;
case "property":
Store.from(target).merge("injectableProperties", {
[propertyKey]: {
bindingType,
propertyKey,
useType: symbol || Metadata.getType(target, propertyKey)
}
});
break;
case "method":
Store.from(target).merge("injectableProperties", {
[propertyKey]: {
bindingType,
propertyKey
}
});
export function Ref(model: string | any, type: MongooseSchemaTypes = MongooseSchemaTypes.OBJECT_ID) {
return applyDecorators(
Property({use: String}),
Schema({
type: String,
example: "5ce7ad3028890bd71749d477",
description: "Mongoose Ref ObjectId"
}),
StoreFn((store: Store) => {
delete store.get("schema").$ref;
}),
StoreMerge(MONGOOSE_SCHEMA, {
type: MongooseSchema.Types[type],
ref: typeof model === "string" ? model : Store.from(model).get(MONGOOSE_MODEL_NAME)
})
);
}