How to use the @seagull/libraries.getRandomSequenceToken function in @seagull/libraries

To help you get started, we’ve selected a few @seagull/libraries 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 seagull-js / seagull / packages / mock-cloudwatchlogs / src / mock_cloudwatchlogs_fs.ts View on Github external
putLogEvents = (Input: PutLogRequest, cb: any) => {
    let existingLogs: any[] = []
    Input.logGroupName = this.formatGroupName(Input.logGroupName)
    this.ensureLogGroup(Input.logGroupName)
    const path = this.getEncodedPath(Input)
    if (this.fsModule.existsSync(path)) {
      const data = this.fsModule.readFileSync(path, 'utf-8')
      existingLogs = existingLogs.concat(JSON.parse(data))
    }
    const logs = existingLogs.concat(Input.logEvents)
    const content = JSON.stringify(logs)
    this.fsModule.writeFileSync(path, `${content}\n`, 'utf-8')
    const result = {
      logStreamName: Input.logStreamName,
      nextSequenceToken: getRandomSequenceToken(),
    }
    return this.result(cb, result)
  }
github seagull-js / seagull / packages / mock-cloudwatchlogs / src / mock_cloudwatchlogs_mem.ts View on Github external
putLogEvents = (Input: PutLogRequest, cb: any) => {
    this.ensureLogGroup(Input.logGroupName)
    const existingLogs =
      this.storage[Input.logGroupName][Input.logStreamName] || []
    this.storage[Input.logGroupName][Input.logStreamName] = existingLogs.concat(
      Input.logEvents
    )
    const result = {
      logStreamName: Input.logStreamName,
      nextSequenceToken: getRandomSequenceToken(),
    }
    return this.result(cb, result)
  }