New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ember-alexandria

Package Overview
Dependencies
Maintainers
5
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-alexandria

The default blueprint for ember-cli addons.

  • 4.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
215
decreased by-49.05%
Maintainers
5
Weekly downloads
 
Created
Source

ember-alexandria

Test Dependabot Code Style: Prettier License: LGPL-3.0

The frontend for the alexandria document management service

Compatibility

  • Ember.js v4.4 or above
  • Ember CLI v4.4 or above
  • Node.js v14 or above

Installation

ember install ember-alexandria

Then add the following lines to your app/styles/app.scss:

@import "ember-uikit";
@import "ember-alexandria";

Usage

Mount the engine with the following command in your app/router.js:

this.mount("ember-alexandria", { path: "/" });

To pass the required services update your app.js:

constructor(...args) {
  super(...args);

  this.engines = {
    "ember-alexandria": {
      dependencies: {
        services: [
          "session",
          "intl",
          "notification",
          "router",
          { config: "alexandria-config" },
        ],
      },
    },
  };
}

Configuration

You can configure if the models should be filtered by meta and what the default meta value for a model should be. Each configuration field is scoped by model name (check out the example to understand what is meant by this).

For this you need to create a service extending from ember-alexandria/services/config which you then have to pass as config to alexandria.

This is needed since an engine does not merge its env into the host apps. See https://github.com/ember-engines/ember-engines/issues/176 for more info.

If you mounted alexandria with query params this.mount("ember-alexandria", {path: "/:your_query_param/documents/"}); you can access the query params in you config service (as shown in the example above) with this.alexandriaQueryParams.your_query_param.

If you need to access the alexandriaQueryParams inside your config check that you define modelMetaFilters and/or defaultModelMeta as getters. If you don't need alexandriaQueryParams you can ignore the getters and just define the field as usual.

Example:

import ConfigService from "ember-alexandria/services/config";

export default class AlexandriaConfigService extends ConfigService {
  get modelMetaFilters() {
    return {
      document: [
        { key: "your_meta_field", value: this.alexandriaQueryParams.your_query_param
},
      ],
    };
  }

  get defaultModelMeta() {
    return {
      document: {
        your_meta_field: this.alexandriaQueryParams.your_query_param,
      },
      file: {
        is_alexandria_file: true
      }
    };
  }
}

As the Alexandria backend returns IDs for the user and groups you can add a resolver from your project to turn the IDs to something the user can relate to.

Just replace the identity functions on the config service.

Example:

import ConfigService from "ember-alexandria/services/config";
import { inject as service } from "@ember/service";

export default class AlexandriaConfigService extends ConfigService {
  @service store;
  
  resolveUser(id) { return this.store.peekRecord("user", id); }
  resolveGroup(id) { return this.store.peekRecord("group", id); }
}

Contributing

See the Contributing guide for details.

License

This project is licensed under the LGPL-3.0-or-later license.

Keywords

FAQs

Package last updated on 03 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc