Options
All
  • Public
  • Public/Protected
  • All
Menu

Module core

@dvelop-sdk/core

npm (scoped) npm bundle size (scoped) GitHub license

This package contains shared functionality for the @dvelop-sdk packages.

Explore the docs »
Install via npm »
Check us out on GitHub »

Index

Variables

DVELOP_REQUEST_ID_HEADER: "x-dv-request-id" = "x-dv-request-id"

HTTP Header for the requestId for the request. Forward this id to make calls trackable throughout d.velop apps.

DVELOP_REQUEST_SIGNATURE_HEADER: "x-dv-sig-1" = "x-dv-sig-1"

HTTP Header for the requestSignature. The requestSignature should be validated for every request when recieving calls from the d.velop cloud. Refer to the d.velop basics tenant header section for more information.

DVELOP_SYSTEM_BASE_URI_HEADER: "x-dv-baseuri" = "x-dv-baseuri"

HTTP Header for the systemBaseUri for the tenant.

DVELOP_TENANT_ID_HEADER: "x-dv-tenant-id" = "x-dv-tenant-id"

HTTP Header for the tenantId for the tenant.

TRACEPARENT_HEADER: "traceparent" = "traceparent"

HTTP Header used for W3C Trace Context specification.

Core Functions

  • generateRequestId(): string
  • Generate a unique requestId.

    import { generateRequestId } from "@dvelop-sdk/core"

    const requestId: string = generateRequestId();
    console.log(requestId); //ac25ae73-f4b6-477e-a5fa-877c8dea863d

    Returns string

  • generateSpanId(): string
  • generateTraceContext(traceId?: string, parentId?: string, spandId?: string, sampled?: boolean, version?: number): TraceContext
  • Generate a new TraceContext-object. See W3C Trace Context for more information.

    import { TraceContext, generateTraceContext } from "@dvelop-sdk/core";

    const traceContext: TraceContext = generateTraceContext();
    console.log(traceContext); // { traceId: '14d3ce602b42d045776144889ac22065', parentId: undefined, spanId: '5afd7bd9caad89de', version: 0, sampled: false }

    // can also be initialized with predefined values
    const traceContext2: TraceContext = generateTraceContext("4ea7f85225da7d0acc52f7fce3db4a92", "cacc9b0efc059633");
    console.log(traceContext2); //{ traceId: '4ea7f85225da7d0acc52f7fce3db4a92', parentId: 'cacc9b0efc059633', spanId: '7164846a72d30523', version: 0, sampled: false }

    Parameters

    • Optional traceId: string
    • Optional parentId: string
    • Optional spandId: string
    • Optional sampled: boolean
    • Optional version: number

    Returns TraceContext

  • generateTraceId(): string
  • generateUuid(): string
  • parseTraceparentHeader(traceparentHeader: string, spanId?: string): TraceContext
  • Parses the traceparent-HTTP-header into a TraceContext-object. See W3C Trace Context for more information.

    import { parseTraceparentHeader } from "@dvelop-sdk/core";

    const traceContext: TraceContext = parseTraceparentHeader("00-00cbe959725ad2d75abd9d47017604d7-d84f4664cc5d1266-00")
    console.log(traceContext); // { traceId: '00cbe959725ad2d75abd9d47017604d7', spanId: '48743343d1130693', parentId: 'd84f4664cc5d1266', sampled: false, version: 0 }

    Parameters

    • traceparentHeader: string
    • Optional spanId: string

    Returns TraceContext

Other Functions

  • deepMergeObjects<T>(...objects: T[]): T

Generated using TypeDoc