How to use @wireapp/store-engine-fs - 3 common examples

To help you get started, we’ve selected a few @wireapp/store-engine-fs 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 wireapp / wire-web-packages / packages / api-client / demo.ts View on Github external
(async () => {
    const storeOptions = {fileExtension: '.json'};
    const storeEngine = new FileEngine(storagePath, storeOptions);
    await storeEngine.init(storagePath, storeOptions);

    const config = {
      store: storeEngine,
      urls: APIClient.BACKEND.STAGING,
    };

    const apiClient = new APIClient(config);

    apiClient.on(APIClient.TOPIC.ACCESS_TOKEN_REFRESH, async (accessToken: AccessTokenData) => {
      await storeEngine.updateOrCreate(AUTH_TABLE_NAME, AUTH_ACCESS_TOKEN_KEY, accessToken);
      logger.log(`Saved access token`, accessToken);
    });

    apiClient.on(APIClient.TOPIC.COOKIE_REFRESH, async (cookie?: Cookie) => {
      if (cookie) {
github wireapp / wire-web-packages / packages / cli-client / src / index.ts View on Github external
const storeEngineProvider = async (storeName: string) => {
  const engine = new FileEngine(directory);
  await engine.init(storeName, {fileExtension: '.json'});
  return engine;
};
github wireapp / wire-web-packages / packages / core / src / demo / sender.js View on Github external
(async () => {
  const CONVERSATION_ID = program.conversationId || process.env.WIRE_CONVERSATION_ID;
  const MESSAGE_TIMER = TimeUtil.TimeInMillis.SECOND * 5;

  const login = {
    clientType: ClientType.TEMPORARY,
    email: process.env.WIRE_EMAIL,
    password: process.env.WIRE_PASSWORD,
  };

  const backend = process.env.WIRE_BACKEND === 'staging' ? APIClient.BACKEND.STAGING : APIClient.BACKEND.PRODUCTION;
  const engine = new FileEngine(path.join(__dirname, '.tmp', 'sender'));
  await engine.init(undefined, {fileExtension: '.json'});

  const apiClient = new APIClient({store: engine, urls: backend});
  const account = new Account(apiClient);
  await account.login(login);
  await account.listen();

  account.on('error', error => logger.error(error));

  const name = await account.service.self.getName();

  logger.log('Name', name);
  logger.log('User ID', account.apiClient.context.userId);
  logger.log('Client ID', account.apiClient.context.clientId);

  async function sendAndDeleteMessage() {

@wireapp/store-engine-fs

Store Engine implementation for Node.js' File System.

GPL-3.0
Latest version published 5 months ago

Package Health Score

57 / 100
Full package analysis

Popular @wireapp/store-engine-fs functions

Similar packages