How to use the @firebase/util.assertionError function in @firebase/util

To help you get started, we’ve selected a few @firebase/util 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 firebase / firebase-js-sdk / packages / database / src / core / snap / indexes / KeyIndex.ts View on Github external
isDefinedOn(node: Node): boolean {
    // We could probably return true here (since every node has a key), but it's never called
    // so just leaving unimplemented for now.
    throw assertionError('KeyIndex.isDefinedOn not expected to be called.');
  }
github firebase / firebase-js-sdk / packages / database / src / core / WriteTree.ts View on Github external
Path.Empty,
                write.children
              );
            } else {
              const child = safeGet(write.children, relativePath.getFront());
              if (child) {
                // There exists a child in this node that matches the root path
                const deepNode = child.getChild(relativePath.popFront());
                compoundWrite = compoundWrite.addWrite(Path.Empty, deepNode);
              }
            }
          } else {
            // There is no overlap between root path and write path, ignore write
          }
        } else {
          throw assertionError('WriteRecord should have .snap or .children');
        }
      }
    }
    return compoundWrite;
  }
}
github firebase / firebase-js-sdk / packages / database / src / core / view / ChildChangeAccumulator.ts View on Github external
Change.childAddedChange(childKey, change.snapshotNode)
        );
      } else if (
        type === Change.CHILD_CHANGED &&
        oldType === Change.CHILD_CHANGED
      ) {
        this.changeMap.set(
          childKey,
          Change.childChangedChange(
            childKey,
            change.snapshotNode,
            oldChange.oldSnap
          )
        );
      } else {
        throw assertionError(
          'Illegal combination of changes: ' +
            change +
            ' occurred after ' +
            oldChange
        );
      }
    } else {
      this.changeMap.set(childKey, change);
    }
  }
github firebase / firebase-js-sdk / packages / database / src / core / view / EventGenerator.ts View on Github external
private compareChanges_(a: Change, b: Change) {
    if (a.childName == null || b.childName == null) {
      throw assertionError('Should only compare child_ events.');
    }
    const aWrapped = new NamedNode(a.childName, a.snapshotNode);
    const bWrapped = new NamedNode(b.childName, b.snapshotNode);
    return this.index_.compare(aWrapped, bWrapped);
  }
}
github firebase / firebase-js-sdk / packages / database / src / core / view / ViewProcessor.ts View on Github external
oldViewCache,
          ackUserWrite.path,
          writesCache,
          completeCache,
          accumulator
        );
      }
    } else if (operation.type === OperationType.LISTEN_COMPLETE) {
      newViewCache = this.listenComplete_(
        oldViewCache,
        operation.path,
        writesCache,
        accumulator
      );
    } else {
      throw assertionError('Unknown operation type: ' + operation.type);
    }
    const changes = accumulator.getChanges();
    ViewProcessor.maybeAddValueEvent_(oldViewCache, newViewCache, changes);
    return new ProcessorResult(newViewCache, changes);
  }