How to use the @tsed/core.Store.from function in @tsed/core

To help you get started, we’ve selected a few @tsed/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TypedProject / ts-express-decorators / test / units / socketio / decorators / inputAndEmit.spec.ts View on Github external
before(() => {
    InputAndEmit("eventName")(Test, "test", {} as any);
    this.store = Store.from(Test);
  });
github TypedProject / ts-express-decorators / test / units / swagger / decorators / title.spec.ts View on Github external
before(() => {
      Title("title")(Test, "test", descriptorOf(Test, "test"));
      this.store = Store.from(Test, "test", descriptorOf(Test, "test"));
    });
    it("should set the schema", () => {
github TypedProject / ts-express-decorators / test / units / swagger / decorators / title.spec.ts View on Github external
before(() => {
      Title("title")(Test, "test", 0);
      this.store = Store.from(Test, "test", 0);
    });
    it("should set the schema", () => {
github TypedProject / ts-express-decorators / test / units / mvc / decorators / method / status.spec.ts View on Github external
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);
  });
github TypedProject / ts-express-decorators / test / units / socketio / decorators / broadcast.spec.ts View on Github external
before(() => {
    Broadcast("eventName")(Test, "test", {} as any);
    this.store = Store.from(Test);
  });
github TypedProject / ts-express-decorators / test / units / socketio / decorators / socketEventName.spec.ts View on Github external
before(() => {
    SocketEventName(Test, "test", 0);
    this.store = Store.from(Test);
  });
github TypedProject / ts-express-decorators / test / units / di / services / InjectorService.spec.ts View on Github external
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);
        })
      );
github TypedProject / ts-express-decorators / packages / socketio / src / decorators / socketMiddlewareError.ts View on Github external
return (target: Type) => {
    Store.from(target).merge("socketIO", {
      type: SocketProviderTypes.MIDDLEWARE,
      error: true,

      handlers: {
        use: {
          methodClassName: "use"
        }
      }
    });

    return Middleware()(target);
  };
}
github TypedProject / ts-express-decorators / packages / di / src / decorators / inject.ts View on Github external
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
          }
        });
github TypedProject / ts-express-decorators / packages / mongoose / src / decorators / ref.ts View on Github external
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)
    })
  );
}