UNPKG

@bitblit/ratchet-epsilon-common

Version:

Tiny adapter to simplify building API gateway Lambda APIS

20 lines 737 B
import { StringRatchet } from '@bitblit/ratchet-common/lang/string-ratchet'; import { ContextUtil } from '../util/context-util.js'; export class BuiltInTraceIdGenerators { static fullAwsRequestId() { return ContextUtil.defaultedCurrentRequestId(); } static shortAwsRequestId() { let rval = BuiltInTraceIdGenerators.fullAwsRequestId(); if (rval.length > 10) { let idx = rval.lastIndexOf('-'); idx = idx === -1 ? rval.length - 10 : idx; rval = rval.substring(idx); } return rval; } static fixedLengthHex(length = 10) { return StringRatchet.createRandomHexString(length); } } //# sourceMappingURL=built-in-trace-id-generators.js.map