How to use the @cardstack/di.getOwner function in @cardstack/di

To help you get started, we’ve selected a few @cardstack/di 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 cardstack / cardstack / packages / hub / indexers.js View on Github external
async _doUpdate(forceRefresh, hints) {
      log.debug('begin update, forceRefresh=%s', forceRefresh);
      let priorCache = this._schemaCache;
      let running = new RunningIndexers(
        await this._seedSchema(),
        this.client,
        this.emit.bind(this),
        this.schemaLoader.ownTypes(),
        getOwner(this)
      );
      try {
        let newSchema = await running.update(forceRefresh, hints);
        if (this._schemaCache === priorCache) {
          // nobody else has done a more recent update of the schema
          // cache than us, so we can try to update it.
          if (priorCache) {
            let oldSchema = await priorCache;
            if (!newSchema.equalTo(oldSchema)) {
              log.info('schema was changed');
              this._schemaCache = newSchema;
              if (oldSchema) {
                await oldSchema.teardown();
              }
            }
          } else {
github cardstack / cardstack / packages / hub / plugin-loader.js View on Github external
_instance(resolverName) {
    if (resolverName) {
      return getOwner(this).lookup(resolverName);
    }
  }
github cardstack / cardstack / packages / hub / plugin-loader.js View on Github external
_factory(resolverName) {
    if (resolverName) {
      return getOwner(this).factoryFor(resolverName);
    }
  }
github cardstack / cardstack / packages / hub / indexers.js View on Github external
this._schemaCache = (async () => {
          let running = new RunningIndexers(
            await this._seedSchema(),
            this.client,
            this.emit.bind(this),
            this.schemaLoader.ownTypes(),
            getOwner(this)
          );
          try {
            return await running.schemas();
          } finally {
            await running.destroy();
          }
        })();
      }
github cardstack / cardstack / packages / hub / schema-loader.js View on Github external
log.trace('default data source %j', defaultDataSource);
      let groups = findGroups(models, fields, computedFields);
      let types = findTypes(
        models,
        fields,
        computedFields,
        constraints,
        dataSources,
        defaultDataSource,
        grants,
        groups
      );
      validateRelatedTypes(types, fields);
      log.debug(`SchemaLoader.loadFrom completed loading schema`);

      return getOwner(this)
        .factoryFor('hub:schema')
        .create({ types, fields, computedFields, dataSources, inputModels, plugins, grants });
    }
  }

@cardstack/di

dependency injection support for cardstack hub

MIT
Latest version published 1 year ago

Package Health Score

58 / 100
Full package analysis

Similar packages