Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add transact to app #121

Open
terrablue opened this issue May 24, 2024 · 0 comments
Open

add transact to app #121

terrablue opened this issue May 24, 2024 · 0 comments
Milestone

Comments

@terrablue
Copy link
Contributor

add the ability to create a transaction from the app object with (in the init hook)

app.set("store", "transact", async callback => {
  const { id, transaction } = await make_transaction(env);
  try {
    return await transaction([], stores => {
      const store = stores.reduce((base, [name, store]) =>
        o.extend(base, o.inflate(name, store))
      , {});
      return callback(store);
    },
    );
  } catch (error) {
    env.log.auto(error);
    TransactionRolledBack.warn(env.log, id, error.name);

    // let core handle error
    throw error;
  }
);

depends on #120

@terrablue terrablue added this to the 0.32.0 milestone Jun 9, 2024
@terrablue terrablue modified the milestones: 0.32.0, 0.33.0 Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant