How to use the api/storage.PersistentStorage.persist function in api

To help you get started, we’ve selected a few api 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 500tech / mimic / lib / api / mocked-requests.js View on Github external
addStateToMockedRequest(mockedRequestId, { name, response }) {
    this.findById(mockedRequestId).addState({ name, response });

    PersistentStorage.persist();
  }
github 500tech / mimic / lib / api / scenarios.js View on Github external
addScenario(name) {
    this.scenarios.push(new Scenario({name}));

    PersistentStorage.persist();
  }
github 500tech / mimic / lib / api / groups.js View on Github external
setGroups(groups) {
    this.all = groups.map((group) => new Group(group));

    PersistentStorage.dataTree.groups = this.all;
    PersistentStorage.persist();
  }
}
github 500tech / mimic / lib / api / mocked-requests.js View on Github external
selectStateInMockedRequest(mockedRequestId, stateId) {
    this.findById(mockedRequestId).selectState(stateId);

    PersistentStorage.persist();
  }
github 500tech / mimic / lib / api / groups.js View on Github external
mergeGroups(groups) {
    for (const group of groups) {
      const existingGroup = find(this.all, { id: group.id });

      if (existingGroup) {
        assign(existingGroup, group);
      } else {
        this.all.push(new Group(group));
      }
    }

    PersistentStorage.persist();
  }
github 500tech / mimic / lib / api / mocks.js View on Github external
updateMock(mockId, request) {
    this.find({ id: mockId }).update(request);

    PersistentStorage.persist();
  }
github 500tech / mimic / lib / api / scenarios.js View on Github external
toggle(id) {
    const scenario = this.getById(id);
    scenario.active = !scenario.active;

    PersistentStorage.persist();
  }
github 500tech / mimic / lib / api / scenarios.js View on Github external
updateMockRequest(scenarioId, mockRequestId, request) {
    this.getById(scenarioId).updateMockedRequest(mockRequestId, request);

    PersistentStorage.persist();
  }
github 500tech / mimic / lib / api / mocked-requests.js View on Github external
addMockedRequest(capturedRequest) {
    this.mockedRequests.push(
      new MockedRequest(capturedRequest.buildMockedRequestData())
    );

    PersistentStorage.persist();
  }
github 500tech / mimic / lib / api / mocks.js View on Github external
const done = (id) => {
      PersistentStorage.persist();
      cb(id);
    };