build
This commit is contained in:
commit
d2e64f8373
|
|
@ -1,12 +0,0 @@
|
|||
import { Context as ContextInterface } from 'oak-domain/lib/types/Context';
|
||||
import { EntityDict, OpRecord } from 'oak-domain/lib/types/Entity';
|
||||
import TreeStore from './store';
|
||||
export declare class Context<ED extends EntityDict> implements ContextInterface<ED> {
|
||||
rowStore: TreeStore<ED>;
|
||||
uuid?: string;
|
||||
opRecords: OpRecord<ED>[];
|
||||
constructor(store: TreeStore<ED>);
|
||||
begin(options?: object): Promise<void>;
|
||||
commit(): Promise<void>;
|
||||
rollback(): Promise<void>;
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Context = void 0;
|
||||
const uuid_1 = require("uuid");
|
||||
class Context {
|
||||
rowStore;
|
||||
uuid;
|
||||
opRecords;
|
||||
constructor(store) {
|
||||
this.rowStore = store;
|
||||
this.opRecords = [];
|
||||
}
|
||||
async begin(options) {
|
||||
if (!this.uuid) {
|
||||
const random = await getRandomValues(16);
|
||||
this.uuid = (0, uuid_1.v4)({ random });
|
||||
this.rowStore.begin(this.uuid);
|
||||
}
|
||||
}
|
||||
async commit() {
|
||||
if (this.uuid) {
|
||||
this.rowStore.commit(this.uuid);
|
||||
this.uuid = undefined;
|
||||
}
|
||||
}
|
||||
async rollback() {
|
||||
if (this.uuid) {
|
||||
this.rowStore.rollback(this.uuid);
|
||||
this.uuid = undefined;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Context = Context;
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
"build": "tsc",
|
||||
"postinstall": "npm link oak-domain"
|
||||
},
|
||||
"main": "src/index",
|
||||
"main": "lib/index",
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.12.13",
|
||||
"@babel/core": "^7.12.13",
|
||||
|
|
|
|||
Loading…
Reference in New Issue