From 2aada37c3652096d92ac7530c40a4ebcfde74449 Mon Sep 17 00:00:00 2001 From: Michael O'Brien Date: Sat, 2 Sep 2023 11:47:45 +1000 Subject: [PATCH] DEV: regen --- dist/cjs/index.d.ts | 4 ++++ dist/cjs/index.js | 6 +++++- dist/mjs/index.d.ts | 4 ++++ dist/mjs/index.js | 7 ++++++- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/dist/cjs/index.d.ts b/dist/cjs/index.d.ts index 91ec7e3..8a8d2bf 100644 --- a/dist/cjs/index.d.ts +++ b/dist/cjs/index.d.ts @@ -74,6 +74,9 @@ export type MetricOptions = { spans?: SpanDef[]; table?: string; ttl?: number; + type?: { + [key: string]: string; + }; tableName?: string; }; export type MetricBufferOptions = { @@ -120,6 +123,7 @@ export declare class CustomMetrics { private spans; private table; private timestamp; + private type; private ttl; constructor(options?: MetricOptions); emit(namespace: string, metricName: string, value: number, dimensionsList?: MetricDimensionsList, options?: MetricEmitOptions): Promise; diff --git a/dist/cjs/index.js b/dist/cjs/index.js index fef255e..2624641 100644 --- a/dist/cjs/index.js +++ b/dist/cjs/index.js @@ -58,6 +58,7 @@ class CustomMetrics { } this.primaryKey = options.primaryKey || 'pk'; this.sortKey = options.sortKey || 'sk'; + this.type = options.type || { _type: 'Metric' }; if (options.client) { this.client = options.client; } @@ -67,7 +68,6 @@ class CustomMetrics { credentials, region: credentials.region || options.region, }; - this.log.info(`@@ METRICS Constructor params`, { params }); this.client = new client_dynamodb_1.DynamoDBClient(params); } if (!options.table && !options.tableName) { @@ -718,6 +718,10 @@ class CustomMetrics { seq: item.seq, _source: item._source, }; + if (this.type) { + let [key, model] = Object.entries(this.type)[0]; + result[key] = model; + } for (let span of result.spans) { for (let p of span.pt) { this.assert(p.s != null && !isNaN(p.s)); diff --git a/dist/mjs/index.d.ts b/dist/mjs/index.d.ts index 91ec7e3..8a8d2bf 100644 --- a/dist/mjs/index.d.ts +++ b/dist/mjs/index.d.ts @@ -74,6 +74,9 @@ export type MetricOptions = { spans?: SpanDef[]; table?: string; ttl?: number; + type?: { + [key: string]: string; + }; tableName?: string; }; export type MetricBufferOptions = { @@ -120,6 +123,7 @@ export declare class CustomMetrics { private spans; private table; private timestamp; + private type; private ttl; constructor(options?: MetricOptions); emit(namespace: string, metricName: string, value: number, dimensionsList?: MetricDimensionsList, options?: MetricEmitOptions): Promise; diff --git a/dist/mjs/index.js b/dist/mjs/index.js index 95f8168..7a539aa 100644 --- a/dist/mjs/index.js +++ b/dist/mjs/index.js @@ -42,6 +42,7 @@ class CustomMetrics { spans; table; timestamp; + type; ttl; constructor(options = {}) { this.log = new Log(options.log); @@ -71,6 +72,7 @@ class CustomMetrics { } this.primaryKey = options.primaryKey || 'pk'; this.sortKey = options.sortKey || 'sk'; + this.type = options.type || { _type: 'Metric' }; if (options.client) { this.client = options.client; } @@ -80,7 +82,6 @@ class CustomMetrics { credentials, region: credentials.region || options.region, }; - this.log.info(`@@ METRICS Constructor params`, { params }); this.client = new client_dynamodb_1.DynamoDBClient(params); } if (!options.table && !options.tableName) { @@ -731,6 +732,10 @@ class CustomMetrics { seq: item.seq, _source: item._source, }; + if (this.type) { + let [key, model] = Object.entries(this.type)[0]; + result[key] = model; + } for (let span of result.spans) { for (let p of span.pt) { this.assert(p.s != null && !isNaN(p.s));