@lightdash/common 0.1405.0 → 0.1406.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@ export declare enum RequestMethod {
2
2
  CLI = "CLI",
3
3
  CLI_CI = "CLI_CI",
4
4
  WEB_APP = "WEB_APP",
5
+ HEADLESS_BROWSER = "HEADLESS_BROWSER",
5
6
  UNKNOWN = "UNKNOWN"
6
7
  }
7
8
  export declare const isRequestMethod: (value: string | undefined) => value is RequestMethod;
package/dist/types/api.js CHANGED
@@ -6,6 +6,7 @@ var RequestMethod;
6
6
  RequestMethod["CLI"] = "CLI";
7
7
  RequestMethod["CLI_CI"] = "CLI_CI";
8
8
  RequestMethod["WEB_APP"] = "WEB_APP";
9
+ RequestMethod["HEADLESS_BROWSER"] = "HEADLESS_BROWSER";
9
10
  RequestMethod["UNKNOWN"] = "UNKNOWN";
10
11
  })(RequestMethod = exports.RequestMethod || (exports.RequestMethod = {}));
11
12
  const isRequestMethod = (value) => !!value && Object.values(RequestMethod).includes(value);
@@ -40,6 +40,11 @@ export interface Content {
40
40
  views: number;
41
41
  firstViewedAt: Date | null;
42
42
  }
43
+ export declare enum ContentSortByColumns {
44
+ NAME = "name",
45
+ SPACE_NAME = "space_name",
46
+ LAST_UPDATED_AT = "last_updated_at"
47
+ }
43
48
  export declare enum ChartSourceType {
44
49
  DBT_EXPLORE = "dbt_explore",
45
50
  SQL = "sql",
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChartSourceType = exports.ContentType = void 0;
3
+ exports.ChartSourceType = exports.ContentSortByColumns = exports.ContentType = void 0;
4
4
  var ContentType;
5
5
  (function (ContentType) {
6
6
  ContentType["CHART"] = "chart";
7
7
  ContentType["DASHBOARD"] = "dashboard";
8
8
  })(ContentType = exports.ContentType || (exports.ContentType = {}));
9
+ var ContentSortByColumns;
10
+ (function (ContentSortByColumns) {
11
+ ContentSortByColumns["NAME"] = "name";
12
+ ContentSortByColumns["SPACE_NAME"] = "space_name";
13
+ ContentSortByColumns["LAST_UPDATED_AT"] = "last_updated_at";
14
+ })(ContentSortByColumns = exports.ContentSortByColumns || (exports.ContentSortByColumns = {}));
9
15
  // Chart types
10
16
  var ChartSourceType;
11
17
  (function (ChartSourceType) {
@@ -1,6 +1,6 @@
1
+ import { z } from 'zod';
1
2
  import { type MetricWithAssociatedTimeDimension } from './catalog';
2
3
  import type { ItemsMap } from './field';
3
- import type { ResultRow } from './results';
4
4
  export declare enum MetricExplorerComparison {
5
5
  NONE = "none",
6
6
  PREVIOUS_PERIOD = "previous_period",
@@ -17,17 +17,36 @@ export type MetricExplorerComparisonType = {
17
17
  metricTable: string;
18
18
  metricName: string;
19
19
  };
20
+ export declare const metricExploreDataPointWithDateValueSchema: z.ZodObject<z.objectUtil.extendShape<{
21
+ date: z.ZodDate;
22
+ metric: z.ZodNullable<z.ZodNumber>;
23
+ compareMetric: z.ZodNullable<z.ZodNumber>;
24
+ }, {
25
+ dateValue: z.ZodNumber;
26
+ }>, "strip", z.ZodTypeAny, {
27
+ metric: number | null;
28
+ date: Date;
29
+ compareMetric: number | null;
30
+ dateValue: number;
31
+ }, {
32
+ metric: number | null;
33
+ date: Date;
34
+ compareMetric: number | null;
35
+ dateValue: number;
36
+ }>;
20
37
  export type MetricExploreDataPoint = {
21
38
  date: Date;
22
- metric: unknown;
23
- compareMetric: unknown;
39
+ metric: number | null;
40
+ compareMetric: number | null;
41
+ };
42
+ export type MetricExploreDataPointWithDateValue = MetricExploreDataPoint & {
43
+ dateValue: number;
24
44
  };
25
45
  export type MetricsExplorerQueryResults = {
26
46
  metric: MetricWithAssociatedTimeDimension;
27
- comparisonMetric: MetricWithAssociatedTimeDimension | undefined;
28
- rows: ResultRow[];
29
- comparisonRows: ResultRow[] | undefined;
47
+ compareMetric: MetricWithAssociatedTimeDimension | undefined;
30
48
  fields: ItemsMap;
49
+ results: MetricExploreDataPointWithDateValue[];
31
50
  };
32
51
  export type ApiMetricsExplorerQueryResults = {
33
52
  status: 'ok';
@@ -1,9 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MetricExplorerComparison = void 0;
3
+ exports.metricExploreDataPointWithDateValueSchema = exports.MetricExplorerComparison = void 0;
4
+ const zod_1 = require("zod");
4
5
  var MetricExplorerComparison;
5
6
  (function (MetricExplorerComparison) {
6
7
  MetricExplorerComparison["NONE"] = "none";
7
8
  MetricExplorerComparison["PREVIOUS_PERIOD"] = "previous_period";
8
9
  MetricExplorerComparison["DIFFERENT_METRIC"] = "different_metric";
9
10
  })(MetricExplorerComparison = exports.MetricExplorerComparison || (exports.MetricExplorerComparison = {}));
11
+ const metricExploreDataPointSchema = zod_1.z.object({
12
+ date: zod_1.z.date({ coerce: true }),
13
+ metric: zod_1.z.number().nullable(),
14
+ compareMetric: zod_1.z.number().nullable(),
15
+ });
16
+ exports.metricExploreDataPointWithDateValueSchema = metricExploreDataPointSchema.extend({
17
+ dateValue: zod_1.z.number(),
18
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightdash/common",
3
- "version": "0.1405.0",
3
+ "version": "0.1406.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [