@perses-dev/core 0.48.0 → 0.49.0-rc.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.
@@ -38,6 +38,7 @@ _export_star(require("./time"), exports);
38
38
  _export_star(require("./time-series-data"), exports);
39
39
  _export_star(require("./time-series-queries"), exports);
40
40
  _export_star(require("./trace-data"), exports);
41
+ _export_star(require("./transforms"), exports);
41
42
  _export_star(require("./units"), exports);
42
43
  _export_star(require("./user"), exports);
43
44
  _export_star(require("./variables"), exports);
@@ -0,0 +1,28 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ Object.defineProperty(exports, "TRANSFORM_TEXT", {
18
+ enumerable: true,
19
+ get: function() {
20
+ return TRANSFORM_TEXT;
21
+ }
22
+ });
23
+ const TRANSFORM_TEXT = {
24
+ JoinByColumnValue: 'Join by column value',
25
+ MergeColumns: 'Merge columns',
26
+ MergeIndexedColumns: 'Merge indexed columns',
27
+ MergeSeries: 'Merge series'
28
+ };
@@ -125,7 +125,7 @@ function buildVariableListSchema(pluginSchema) {
125
125
  const variableTextSpecSchema = _zod.z.object({
126
126
  name: _zod.z.string().min(1),
127
127
  display: variableDisplaySchema.optional(),
128
- value: _zod.z.string().min(1),
128
+ value: _zod.z.string(),
129
129
  constant: _zod.z.boolean().optional()
130
130
  });
131
131
  const variableTextSchema = _zod.z.object({
@@ -21,6 +21,7 @@ _export_star(require("./memo"), exports);
21
21
  _export_star(require("./panel-refs"), exports);
22
22
  _export_star(require("./text"), exports);
23
23
  _export_star(require("./time-series-data"), exports);
24
+ _export_star(require("./transform-data"), exports);
24
25
  _export_star(require("./types"), exports);
25
26
  function _export_star(from, to) {
26
27
  Object.keys(from).forEach(function(k) {
@@ -0,0 +1,167 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "use strict";
14
+ Object.defineProperty(exports, "__esModule", {
15
+ value: true
16
+ });
17
+ function _export(target, all) {
18
+ for(var name in all)Object.defineProperty(target, name, {
19
+ enumerable: true,
20
+ get: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ applyJoinTransform: function() {
25
+ return applyJoinTransform;
26
+ },
27
+ applyMergeColumnsTransform: function() {
28
+ return applyMergeColumnsTransform;
29
+ },
30
+ applyMergeIndexedColumnsTransform: function() {
31
+ return applyMergeIndexedColumnsTransform;
32
+ },
33
+ applyMergeSeriesTransform: function() {
34
+ return applyMergeSeriesTransform;
35
+ },
36
+ transformData: function() {
37
+ return transformData;
38
+ },
39
+ useTransformData: function() {
40
+ return useTransformData;
41
+ }
42
+ });
43
+ const _react = require("react");
44
+ function applyJoinTransform(data, columns) {
45
+ // If column is undefined or empty, return data as is
46
+ if (columns.length === 0) {
47
+ return data;
48
+ }
49
+ const rowHashed = {};
50
+ for (const row of data){
51
+ const rowHash = Object.keys(row).filter((k)=>columns.includes(k)).map((k)=>row[k]).join('|');
52
+ const rowHashedValue = rowHashed[rowHash];
53
+ if (rowHashedValue) {
54
+ rowHashed[rowHash] = {
55
+ ...rowHashedValue,
56
+ ...row
57
+ };
58
+ } else {
59
+ rowHashed[rowHash] = {
60
+ ...row
61
+ };
62
+ }
63
+ }
64
+ return Object.values(rowHashed);
65
+ }
66
+ function applyMergeColumnsTransform(data, selectedColumns, outputName) {
67
+ const result = [];
68
+ for (const row of data){
69
+ const columns = Object.keys(row).filter((k)=>selectedColumns.includes(k));
70
+ const selectedColumnValues = {};
71
+ for (const column of columns){
72
+ selectedColumnValues[column] = row[column];
73
+ delete row[column];
74
+ }
75
+ for (const column of columns){
76
+ result.push({
77
+ ...row,
78
+ [outputName]: selectedColumnValues[column]
79
+ });
80
+ }
81
+ if (columns.length === 0) {
82
+ result.push(row);
83
+ }
84
+ }
85
+ return result;
86
+ }
87
+ function applyMergeIndexedColumnsTransform(data, column) {
88
+ const result = [];
89
+ for (const entry of data){
90
+ const indexedColumns = Object.keys(entry).filter((k)=>new RegExp('^(' + column + ' #\\d+)|(' + column + ')$').test(k));
91
+ const indexedColumnValues = {};
92
+ for (const indexedColumn of indexedColumns){
93
+ indexedColumnValues[indexedColumn] = entry[indexedColumn];
94
+ delete entry[indexedColumn];
95
+ }
96
+ for (const indexedColumn of indexedColumns){
97
+ result.push({
98
+ ...entry,
99
+ [column]: indexedColumnValues[indexedColumn]
100
+ });
101
+ }
102
+ if (indexedColumns.length === 0) {
103
+ result.push(entry);
104
+ }
105
+ }
106
+ return result;
107
+ }
108
+ function applyMergeSeriesTransform(data) {
109
+ let result = [
110
+ ...data
111
+ ];
112
+ const labelColumns = Array.from(new Set(data.flatMap(Object.keys).map((label)=>label.replace(/ #\d+/, '')).filter((label)=>label !== 'value')));
113
+ for (const label of labelColumns){
114
+ result = applyMergeIndexedColumnsTransform(result, label);
115
+ }
116
+ result = applyJoinTransform(result, labelColumns);
117
+ return result;
118
+ }
119
+ function transformData(data, transforms) {
120
+ let result = data;
121
+ // Apply transforms by their orders
122
+ for (const transform of transforms !== null && transforms !== void 0 ? transforms : []){
123
+ if (transform.spec.disabled) continue;
124
+ switch(transform.kind){
125
+ case 'JoinByColumnValue':
126
+ {
127
+ if (transform.spec.columns && transform.spec.columns.length > 0) {
128
+ result = applyJoinTransform(result, transform.spec.columns);
129
+ }
130
+ break;
131
+ }
132
+ case 'MergeIndexedColumns':
133
+ {
134
+ if (transform.spec.column) {
135
+ result = applyMergeIndexedColumnsTransform(result, transform.spec.column);
136
+ }
137
+ break;
138
+ }
139
+ case 'MergeColumns':
140
+ {
141
+ if (transform.spec.columns && transform.spec.columns.length > 0 && transform.spec.name) {
142
+ result = applyMergeColumnsTransform(result, transform.spec.columns, transform.spec.name);
143
+ }
144
+ break;
145
+ }
146
+ case 'MergeSeries':
147
+ {
148
+ result = applyMergeSeriesTransform(result);
149
+ break;
150
+ }
151
+ }
152
+ }
153
+ // Ordering data column alphabetically
154
+ result = result.map((row)=>{
155
+ return Object.keys(row).sort().reduce((obj, key)=>{
156
+ obj[key] = row[key];
157
+ return obj;
158
+ }, {});
159
+ });
160
+ return result;
161
+ }
162
+ function useTransformData(data, transforms) {
163
+ return (0, _react.useMemo)(()=>transformData(data, transforms), [
164
+ data,
165
+ transforms
166
+ ]);
167
+ }
@@ -22,6 +22,7 @@ export * from './time';
22
22
  export * from './time-series-data';
23
23
  export * from './time-series-queries';
24
24
  export * from './trace-data';
25
+ export * from './transforms';
25
26
  export * from './units';
26
27
  export * from './user';
27
28
  export * from './variables';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC"}
@@ -34,6 +34,7 @@ export * from './time';
34
34
  export * from './time-series-data';
35
35
  export * from './time-series-queries';
36
36
  export * from './trace-data';
37
+ export * from './transforms';
37
38
  export * from './units';
38
39
  export * from './user';
39
40
  export * from './variables';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './calculations';\nexport * from './dashboard';\nexport * from './datasource';\nexport * from './definitions';\nexport * from './display';\nexport * from './ephemeraldashboard';\nexport * from './http';\nexport * from './http-proxy';\nexport * from './kind';\nexport * from './layout';\nexport * from './legend';\nexport * from './notice';\nexport * from './panels';\nexport * from './project';\nexport * from './query';\nexport * from './resource';\nexport * from './roles';\nexport * from './rolebindings';\nexport * from './secrets';\nexport * from './thresholds';\nexport * from './time';\nexport * from './time-series-data';\nexport * from './time-series-queries';\nexport * from './trace-data';\nexport * from './units';\nexport * from './user';\nexport * from './variables';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,iBAAiB;AAC/B,cAAc,cAAc;AAC5B,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,YAAY;AAC1B,cAAc,uBAAuB;AACrC,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,UAAU;AACxB,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,iBAAiB;AAC/B,cAAc,YAAY;AAC1B,cAAc,eAAe;AAC7B,cAAc,SAAS;AACvB,cAAc,qBAAqB;AACnC,cAAc,wBAAwB;AACtC,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,cAAc"}
1
+ {"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './calculations';\nexport * from './dashboard';\nexport * from './datasource';\nexport * from './definitions';\nexport * from './display';\nexport * from './ephemeraldashboard';\nexport * from './http';\nexport * from './http-proxy';\nexport * from './kind';\nexport * from './layout';\nexport * from './legend';\nexport * from './notice';\nexport * from './panels';\nexport * from './project';\nexport * from './query';\nexport * from './resource';\nexport * from './roles';\nexport * from './rolebindings';\nexport * from './secrets';\nexport * from './thresholds';\nexport * from './time';\nexport * from './time-series-data';\nexport * from './time-series-queries';\nexport * from './trace-data';\nexport * from './transforms';\nexport * from './units';\nexport * from './user';\nexport * from './variables';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,iBAAiB;AAC/B,cAAc,cAAc;AAC5B,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,YAAY;AAC1B,cAAc,uBAAuB;AACrC,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,UAAU;AACxB,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,iBAAiB;AAC/B,cAAc,YAAY;AAC1B,cAAc,eAAe;AAC7B,cAAc,SAAS;AACvB,cAAc,qBAAqB;AACnC,cAAc,wBAAwB;AACtC,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,cAAc"}
@@ -0,0 +1,34 @@
1
+ export interface TransformCommonSpec {
2
+ disabled?: boolean;
3
+ }
4
+ export interface JoinByColumnValueTransform {
5
+ kind: 'JoinByColumnValue';
6
+ spec: TransformCommonSpec & {
7
+ columns: string[];
8
+ };
9
+ }
10
+ export interface MergeColumnsTransform {
11
+ kind: 'MergeColumns';
12
+ spec: TransformCommonSpec & {
13
+ columns: string[];
14
+ name: string;
15
+ };
16
+ }
17
+ export interface MergeIndexedColumnsTransform {
18
+ kind: 'MergeIndexedColumns';
19
+ spec: TransformCommonSpec & {
20
+ column: string;
21
+ };
22
+ }
23
+ export interface MergeSeriesTransform {
24
+ kind: 'MergeSeries';
25
+ spec: TransformCommonSpec;
26
+ }
27
+ export type Transform = JoinByColumnValueTransform | MergeColumnsTransform | MergeIndexedColumnsTransform | MergeSeriesTransform;
28
+ export declare const TRANSFORM_TEXT: {
29
+ JoinByColumnValue: string;
30
+ MergeColumns: string;
31
+ MergeIndexedColumns: string;
32
+ MergeSeries: string;
33
+ };
34
+ //# sourceMappingURL=transforms.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transforms.d.ts","sourceRoot":"","sources":["../../src/model/transforms.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,IAAI,EAAE,mBAAmB,GAAG;QAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,mBAAmB,GAAG;QAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,qBAAqB,CAAC;IAC5B,IAAI,EAAE,mBAAmB,GAAG;QAC1B,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,mBAAmB,CAAC;CAC3B;AAED,MAAM,MAAM,SAAS,GACjB,0BAA0B,GAC1B,qBAAqB,GACrB,4BAA4B,GAC5B,oBAAoB,CAAC;AAGzB,eAAO,MAAM,cAAc;;;;;CAK1B,CAAC"}
@@ -0,0 +1,21 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ // Can be moved somewhere else
14
+ export const TRANSFORM_TEXT = {
15
+ JoinByColumnValue: 'Join by column value',
16
+ MergeColumns: 'Merge columns',
17
+ MergeIndexedColumns: 'Merge indexed columns',
18
+ MergeSeries: 'Merge series'
19
+ };
20
+
21
+ //# sourceMappingURL=transforms.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/model/transforms.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport interface TransformCommonSpec {\n disabled?: boolean;\n}\n\nexport interface JoinByColumnValueTransform {\n kind: 'JoinByColumnValue';\n spec: TransformCommonSpec & {\n columns: string[];\n };\n}\n\nexport interface MergeColumnsTransform {\n kind: 'MergeColumns';\n spec: TransformCommonSpec & {\n columns: string[];\n name: string;\n };\n}\n\nexport interface MergeIndexedColumnsTransform {\n kind: 'MergeIndexedColumns';\n spec: TransformCommonSpec & {\n column: string;\n };\n}\n\nexport interface MergeSeriesTransform {\n kind: 'MergeSeries';\n spec: TransformCommonSpec;\n}\n\nexport type Transform =\n | JoinByColumnValueTransform\n | MergeColumnsTransform\n | MergeIndexedColumnsTransform\n | MergeSeriesTransform;\n\n// Can be moved somewhere else\nexport const TRANSFORM_TEXT = {\n JoinByColumnValue: 'Join by column value',\n MergeColumns: 'Merge columns',\n MergeIndexedColumns: 'Merge indexed columns',\n MergeSeries: 'Merge series',\n};\n"],"names":["TRANSFORM_TEXT","JoinByColumnValue","MergeColumns","MergeIndexedColumns","MergeSeries"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAuCjC,8BAA8B;AAC9B,OAAO,MAAMA,iBAAiB;IAC5BC,mBAAmB;IACnBC,cAAc;IACdC,qBAAqB;IACrBC,aAAa;AACf,EAAE"}
@@ -71,7 +71,7 @@ export function buildVariableListSchema(pluginSchema) {
71
71
  export const variableTextSpecSchema = z.object({
72
72
  name: z.string().min(1),
73
73
  display: variableDisplaySchema.optional(),
74
- value: z.string().min(1),
74
+ value: z.string(),
75
75
  constant: z.boolean().optional()
76
76
  });
77
77
  export const variableTextSchema = z.object({
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/schema/variable.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { z } from 'zod';\nimport {\n ListVariableDefinition,\n ListVariableSpec,\n TextVariableDefinition,\n TextVariableSpec,\n Variable,\n VariableDefinition,\n VariableDisplay,\n} from '../model';\nimport { projectMetadataSchema } from './metadata';\nimport { PluginSchema, pluginSchema } from './plugin';\n\nexport const variableDisplaySchema: z.ZodSchema<VariableDisplay> = z.object({\n name: z.string().optional(),\n description: z.string().optional(),\n hidden: z.boolean().optional(),\n});\n\nexport const variableListSpecSchema: z.ZodSchema<ListVariableSpec> = z.object({\n name: z.string().min(1),\n display: variableDisplaySchema.optional(),\n defaultValue: z.string().or(z.array(z.string())).optional(),\n allowAllValue: z.boolean(),\n allowMultiple: z.boolean(),\n customAllValue: z.string().optional(),\n capturingRegexp: z.string().optional(),\n sort: z\n .enum([\n 'none',\n 'alphabetical-asc',\n 'alphabetical-desc',\n 'numerical-asc',\n 'numerical-desc',\n 'alphabetical-ci-asc',\n 'alphabetical-ci-desc',\n ])\n .optional(),\n plugin: pluginSchema,\n});\n\nexport function buildVariableListSpecSchema(pluginSchema: PluginSchema): z.ZodSchema<ListVariableSpec> {\n return z.object({\n name: z.string().min(1),\n display: variableDisplaySchema.optional(),\n defaultValue: z.string().or(z.array(z.string())).optional(),\n allowAllValue: z.boolean(),\n allowMultiple: z.boolean(),\n customAllValue: z.string().optional(),\n capturingRegexp: z.string().optional(),\n sort: z\n .enum([\n 'none',\n 'alphabetical-asc',\n 'alphabetical-desc',\n 'numerical-asc',\n 'numerical-desc',\n 'alphabetical-ci-asc',\n 'alphabetical-ci-desc',\n ])\n .optional(),\n plugin: pluginSchema,\n });\n}\n\nexport const variableListSchema = z.object({\n kind: z.literal('ListVariable'),\n spec: variableListSpecSchema,\n});\n\nexport function buildVariableListSchema(pluginSchema: PluginSchema): typeof variableListSchema {\n return z.object({\n kind: z.literal('ListVariable'),\n spec: buildVariableListSpecSchema(pluginSchema),\n });\n}\n\nexport const variableTextSpecSchema: z.ZodSchema<TextVariableSpec> = z.object({\n name: z.string().min(1),\n display: variableDisplaySchema.optional(),\n value: z.string().min(1),\n constant: z.boolean().optional(),\n});\n\nexport const variableTextSchema = z.object({\n kind: z.literal('TextVariable'),\n spec: variableTextSpecSchema,\n});\n\nexport const variableSpecSchema: z.ZodSchema<TextVariableDefinition | ListVariableDefinition> = z.discriminatedUnion(\n 'kind',\n [variableTextSchema, variableListSchema]\n);\n\nexport function buildVariableSpecSchema(pluginSchema: PluginSchema): z.ZodSchema<VariableDefinition> {\n return z.union([variableTextSchema, buildVariableListSchema(pluginSchema)]);\n}\n\nexport const variableSchema = z.object({\n kind: z.literal('Variable'),\n metadata: projectMetadataSchema,\n spec: variableSpecSchema,\n});\n\nexport const globalVariableSchema = z.object({\n kind: z.literal('GlobalVariable'),\n metadata: projectMetadataSchema,\n spec: variableSpecSchema,\n});\n\nexport const variablesSchema: z.ZodSchema<Variable> = z.discriminatedUnion('kind', [\n variableSchema,\n globalVariableSchema,\n]);\n\nexport const variableDefinitionSchema: z.ZodSchema<VariableDefinition> = variableSpecSchema;\n\nexport function buildVariableDefinitionSchema(pluginSchema: PluginSchema): z.ZodSchema<VariableDefinition> {\n return z.discriminatedUnion('kind', [\n z.object({\n kind: z.literal('ListVariable'),\n spec: buildVariableListSpecSchema(pluginSchema),\n }),\n z.object({\n kind: z.literal('TextVariable'),\n spec: variableTextSpecSchema,\n }),\n ]);\n}\n"],"names":["z","projectMetadataSchema","pluginSchema","variableDisplaySchema","object","name","string","optional","description","hidden","boolean","variableListSpecSchema","min","display","defaultValue","or","array","allowAllValue","allowMultiple","customAllValue","capturingRegexp","sort","enum","plugin","buildVariableListSpecSchema","variableListSchema","kind","literal","spec","buildVariableListSchema","variableTextSpecSchema","value","constant","variableTextSchema","variableSpecSchema","discriminatedUnion","buildVariableSpecSchema","union","variableSchema","metadata","globalVariableSchema","variablesSchema","variableDefinitionSchema","buildVariableDefinitionSchema"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,CAAC,QAAQ,MAAM;AAUxB,SAASC,qBAAqB,QAAQ,aAAa;AACnD,SAAuBC,YAAY,QAAQ,WAAW;AAEtD,OAAO,MAAMC,wBAAsDH,EAAEI,MAAM,CAAC;IAC1EC,MAAML,EAAEM,MAAM,GAAGC,QAAQ;IACzBC,aAAaR,EAAEM,MAAM,GAAGC,QAAQ;IAChCE,QAAQT,EAAEU,OAAO,GAAGH,QAAQ;AAC9B,GAAG;AAEH,OAAO,MAAMI,yBAAwDX,EAAEI,MAAM,CAAC;IAC5EC,MAAML,EAAEM,MAAM,GAAGM,GAAG,CAAC;IACrBC,SAASV,sBAAsBI,QAAQ;IACvCO,cAAcd,EAAEM,MAAM,GAAGS,EAAE,CAACf,EAAEgB,KAAK,CAAChB,EAAEM,MAAM,KAAKC,QAAQ;IACzDU,eAAejB,EAAEU,OAAO;IACxBQ,eAAelB,EAAEU,OA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,EAAEI,MAAM,CAAC;IACzCsB,MAAM1B,EAAE2B,OAAO,CAAC;IAChBC,MAAME;AACR,GAAG;AAEH,OAAO,MAAMI,qBAAmFlC,EAAEmC,kBAAkB,CAClH,QACA;IAACF;IAAoBR;CAAmB,EACxC;AAEF,OAAO,SAASW,wBAAwBlC,YAA0B;IAChE,OAAOF,EAAEqC,KAAK,CAAC;QAACJ;QAAoBJ,wBAAwB3B;KAAc;AAC5E;AAEA,OAAO,MAAMoC,iBAAiBtC,EAAEI,MAAM,CAAC;IACrCsB,MAAM1B,EAAE2B,OAAO,CAAC;IAChBY,UAAUtC;IACV2B,MAAMM;AACR,GAAG;AAEH,OAAO,MAAMM,uBAAuBxC,EAAEI,MAAM,CAAC;IAC3CsB,MAAM1B,EAAE2B,OAAO,CAAC;IAChBY,UAAUtC;IACV2B,MAAMM;AACR,GAAG;AAEH,OAAO,MAAMO,kBAAyCzC,EAAEmC,kBAAkB,CAAC,QAAQ;IACjFG;IACAE;CACD,EAAE;AAEH,OAAO,MAAME,2BAA4DR,mBAAmB;AAE5F,OAAO,SAASS,8BAA8BzC,YAA0B;IACtE,OAAOF,EAAEmC,kBAAkB,CAAC,QAAQ;QAClCnC,EAAEI,MAAM,CAAC;YACPsB,MAAM1B,EAAE2B,OAAO,CAAC;YAChBC,MAAMJ,4BAA4BtB;QACpC;QACAF,EAAEI,MAAM,CAAC;YACPsB,MAAM1B,EAAE2B,OAAO,CAAC;YAChBC,MAAME;QACR;KACD;AACH"}
1
+ {"version":3,"sources":["../../src/schema/variable.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { z } from 'zod';\nimport {\n ListVariableDefinition,\n ListVariableSpec,\n TextVariableDefinition,\n TextVariableSpec,\n Variable,\n VariableDefinition,\n VariableDisplay,\n} from '../model';\nimport { projectMetadataSchema } from './metadata';\nimport { PluginSchema, pluginSchema } from './plugin';\n\nexport const variableDisplaySchema: z.ZodSchema<VariableDisplay> = z.object({\n name: z.string().optional(),\n description: z.string().optional(),\n hidden: z.boolean().optional(),\n});\n\nexport const variableListSpecSchema: z.ZodSchema<ListVariableSpec> = z.object({\n name: z.string().min(1),\n display: variableDisplaySchema.optional(),\n defaultValue: z.string().or(z.array(z.string())).optional(),\n allowAllValue: z.boolean(),\n allowMultiple: z.boolean(),\n customAllValue: z.string().optional(),\n capturingRegexp: z.string().optional(),\n sort: z\n .enum([\n 'none',\n 'alphabetical-asc',\n 'alphabetical-desc',\n 'numerical-asc',\n 'numerical-desc',\n 'alphabetical-ci-asc',\n 'alphabetical-ci-desc',\n ])\n .optional(),\n plugin: pluginSchema,\n});\n\nexport function buildVariableListSpecSchema(pluginSchema: PluginSchema): z.ZodSchema<ListVariableSpec> {\n return z.object({\n name: z.string().min(1),\n display: variableDisplaySchema.optional(),\n defaultValue: z.string().or(z.array(z.string())).optional(),\n allowAllValue: z.boolean(),\n allowMultiple: z.boolean(),\n customAllValue: z.string().optional(),\n capturingRegexp: z.string().optional(),\n sort: z\n .enum([\n 'none',\n 'alphabetical-asc',\n 'alphabetical-desc',\n 'numerical-asc',\n 'numerical-desc',\n 'alphabetical-ci-asc',\n 'alphabetical-ci-desc',\n ])\n .optional(),\n plugin: pluginSchema,\n });\n}\n\nexport const variableListSchema = z.object({\n kind: z.literal('ListVariable'),\n spec: variableListSpecSchema,\n});\n\nexport function buildVariableListSchema(pluginSchema: PluginSchema): typeof variableListSchema {\n return z.object({\n kind: z.literal('ListVariable'),\n spec: buildVariableListSpecSchema(pluginSchema),\n });\n}\n\nexport const variableTextSpecSchema: z.ZodSchema<TextVariableSpec> = z.object({\n name: z.string().min(1),\n display: variableDisplaySchema.optional(),\n value: z.string(),\n constant: z.boolean().optional(),\n});\n\nexport const variableTextSchema = z.object({\n kind: z.literal('TextVariable'),\n spec: variableTextSpecSchema,\n});\n\nexport const variableSpecSchema: z.ZodSchema<TextVariableDefinition | ListVariableDefinition> = z.discriminatedUnion(\n 'kind',\n [variableTextSchema, variableListSchema]\n);\n\nexport function buildVariableSpecSchema(pluginSchema: PluginSchema): z.ZodSchema<VariableDefinition> {\n return z.union([variableTextSchema, buildVariableListSchema(pluginSchema)]);\n}\n\nexport const variableSchema = z.object({\n kind: z.literal('Variable'),\n metadata: projectMetadataSchema,\n spec: variableSpecSchema,\n});\n\nexport const globalVariableSchema = z.object({\n kind: z.literal('GlobalVariable'),\n metadata: projectMetadataSchema,\n spec: variableSpecSchema,\n});\n\nexport const variablesSchema: z.ZodSchema<Variable> = z.discriminatedUnion('kind', [\n variableSchema,\n globalVariableSchema,\n]);\n\nexport const variableDefinitionSchema: z.ZodSchema<VariableDefinition> = variableSpecSchema;\n\nexport function buildVariableDefinitionSchema(pluginSchema: PluginSchema): z.ZodSchema<VariableDefinition> {\n return z.discriminatedUnion('kind', [\n z.object({\n kind: z.literal('ListVariable'),\n spec: buildVariableListSpecSchema(pluginSchema),\n }),\n z.object({\n kind: z.literal('TextVariable'),\n spec: variableTextSpecSchema,\n }),\n ]);\n}\n"],"names":["z","projectMetadataSchema","pluginSchema","variableDisplaySchema","object","name","string","optional","description","hidden","boolean","variableListSpecSchema","min","display","defaultValue","or","array","allowAllValue","allowMultiple","customAllValue","capturingRegexp","sort","enum","plugin","buildVariableListSpecSchema","variableListSchema","kind","literal","spec","buildVariableListSchema","variableTextSpecSchema","value","constant","variableTextSchema","variableSpecSchema","discriminatedUnion","buildVariableSpecSchema","union","variableSchema","metadata","globalVariableSchema","variablesSchema","variableDefinitionSchema","buildVariableDefinitionSchema"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0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kBAAkB,CAAC,QAAQ;IACjFG;IACAE;CACD,EAAE;AAEH,OAAO,MAAME,2BAA4DR,mBAAmB;AAE5F,OAAO,SAASS,8BAA8BzC,YAA0B;IACtE,OAAOF,EAAEmC,kBAAkB,CAAC,QAAQ;QAClCnC,EAAEI,MAAM,CAAC;YACPsB,MAAM1B,EAAE2B,OAAO,CAAC;YAChBC,MAAMJ,4BAA4BtB;QACpC;QACAF,EAAEI,MAAM,CAAC;YACPsB,MAAM1B,EAAE2B,OAAO,CAAC;YAChBC,MAAME;QACR;KACD;AACH"}
@@ -5,5 +5,6 @@ export * from './memo';
5
5
  export * from './panel-refs';
6
6
  export * from './text';
7
7
  export * from './time-series-data';
8
+ export * from './transform-data';
8
9
  export * from './types';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAaA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC"}
@@ -17,6 +17,7 @@ export * from './memo';
17
17
  export * from './panel-refs';
18
18
  export * from './text';
19
19
  export * from './time-series-data';
20
+ export * from './transform-data';
20
21
  export * from './types';
21
22
 
22
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './event';\nexport * from './fetch';\nexport * from './is-empty-object';\nexport * from './memo';\nexport * from './panel-refs';\nexport * from './text';\nexport * from './time-series-data';\nexport * from './types';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,oBAAoB;AAClC,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,SAAS;AACvB,cAAc,qBAAqB;AACnC,cAAc,UAAU"}
1
+ {"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './event';\nexport * from './fetch';\nexport * from './is-empty-object';\nexport * from './memo';\nexport * from './panel-refs';\nexport * from './text';\nexport * from './time-series-data';\nexport * from './transform-data';\nexport * from './types';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,UAAU;AACxB,cAAc,UAAU;AACxB,cAAc,oBAAoB;AAClC,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,SAAS;AACvB,cAAc,qBAAqB;AACnC,cAAc,mBAAmB;AACjC,cAAc,UAAU"}
@@ -0,0 +1,8 @@
1
+ import { Transform } from '@perses-dev/core';
2
+ export declare function applyJoinTransform(data: Array<Record<string, unknown>>, columns: string[]): Array<Record<string, unknown>>;
3
+ export declare function applyMergeColumnsTransform(data: Array<Record<string, unknown>>, selectedColumns: string[], outputName: string): Record<string, unknown>[];
4
+ export declare function applyMergeIndexedColumnsTransform(data: Array<Record<string, unknown>>, column: string): Record<string, unknown>[];
5
+ export declare function applyMergeSeriesTransform(data: Array<Record<string, unknown>>): Array<Record<string, unknown>>;
6
+ export declare function transformData(data: Array<Record<string, unknown>>, transforms: Transform[]): Array<Record<string, unknown>>;
7
+ export declare function useTransformData(data: Array<Record<string, unknown>>, transforms: Transform[]): Array<Record<string, unknown>>;
8
+ //# sourceMappingURL=transform-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-data.d.ts","sourceRoot":"","sources":["../../src/utils/transform-data.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAsB7C,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACpC,OAAO,EAAE,MAAM,EAAE,GAChB,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAsBhC;AA0BD,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACpC,eAAe,EAAE,MAAM,EAAE,EACzB,UAAU,EAAE,MAAM,6BAwBnB;AA0BD,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,6BAwBrG;AAmBD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAmB9G;AAKD,wBAAgB,aAAa,CAC3B,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACpC,UAAU,EAAE,SAAS,EAAE,GACtB,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA2ChC;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACpC,UAAU,EAAE,SAAS,EAAE,GACtB,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAEhC"}
@@ -0,0 +1,221 @@
1
+ // Copyright 2024 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ import { useMemo } from 'react';
14
+ /*
15
+ * Join: Regroup rows with equal cell value in a column.
16
+ * If there are multiple line with same value, next row values override the current one
17
+ *
18
+ * Example: Join on 'mount' column
19
+ * INPUT:
20
+ * | timestamp | value #1 | value #3 | mount |
21
+ * |------------|----------|----------|-----------|
22
+ * | 1630000000 | 1 | | / |
23
+ * | 1630000000 | 2 | | /boot/efi |
24
+ * | 1630000000 | | 3 | / |
25
+ * | 1630000000 | | 4 | /boot/efi |
26
+ *
27
+ * OUTPUT:
28
+ * | timestamp | value #1 | value #3 | mount |
29
+ * |------------|----------|----------|-----------|
30
+ * | 1630000000 | 1 | 3 | / |
31
+ * | 1630000000 | 2 | 4 | /boot/efi |
32
+ */ export function applyJoinTransform(data, columns) {
33
+ // If column is undefined or empty, return data as is
34
+ if (columns.length === 0) {
35
+ return data;
36
+ }
37
+ const rowHashed = {};
38
+ for (const row of data){
39
+ const rowHash = Object.keys(row).filter((k)=>columns.includes(k)).map((k)=>row[k]).join('|');
40
+ const rowHashedValue = rowHashed[rowHash];
41
+ if (rowHashedValue) {
42
+ rowHashed[rowHash] = {
43
+ ...rowHashedValue,
44
+ ...row
45
+ };
46
+ } else {
47
+ rowHashed[rowHash] = {
48
+ ...row
49
+ };
50
+ }
51
+ }
52
+ return Object.values(rowHashed);
53
+ }
54
+ /*
55
+ * Merges selected columns into a single column.
56
+ *
57
+ * Example: Merge columns 'value #1' and 'value #2' into a single column 'MERGED'
58
+ * INPUT:
59
+ * +------------+----------+----------+-----------+-----------+
60
+ * | timestamp | value #1 | value #2 | mount #1 | mount #2 |
61
+ * +------------+----------+----------+-----------+-----------+
62
+ * | 1630000000 | 1 | | / | |
63
+ * | 1630000000 | 2 | | /boot/efi | |
64
+ * | 1630000000 | | 3 | | / |
65
+ * | 1630000000 | | 4 | | /boot/efi |
66
+ * +------------+----------+----------+-----------+-----------+
67
+ *
68
+ * OUTPUT:
69
+ * +------------+--------+-----------+-----------+
70
+ * | timestamp | MERGED | mount #1 | mount #2 |
71
+ * +------------+--------+-----------+-----------+
72
+ * | 1630000000 | 1 | / | |
73
+ * | 1630000000 | 2 | /boot/efi | |
74
+ * | 1630000000 | 2 | | / |
75
+ * | 1630000000 | 3 | | /boot/efi |
76
+ * +------------+--------+-----------+-----------+
77
+ */ export function applyMergeColumnsTransform(data, selectedColumns, outputName) {
78
+ const result = [];
79
+ for (const row of data){
80
+ const columns = Object.keys(row).filter((k)=>selectedColumns.includes(k));
81
+ const selectedColumnValues = {};
82
+ for (const column of columns){
83
+ selectedColumnValues[column] = row[column];
84
+ delete row[column];
85
+ }
86
+ for (const column of columns){
87
+ result.push({
88
+ ...row,
89
+ [outputName]: selectedColumnValues[column]
90
+ });
91
+ }
92
+ if (columns.length === 0) {
93
+ result.push(row);
94
+ }
95
+ }
96
+ return result;
97
+ }
98
+ /*
99
+ * Merge Indexed Columns: All indexed columns are merged to one column
100
+ *
101
+ * Example: Join on 'value' column
102
+ * INPUT:
103
+ * | timestamp #1 | timestamp #2 | value #1 | value #2 | instance #1 | instance #2 |
104
+ * |--------------|--------------|----------|----------|-------------|-------------|
105
+ * | 1630000000 | | 55 | | toto | |
106
+ * | 1630000000 | | 33 | | toto | |
107
+ * | 1630000000 | | 45 | | toto | |
108
+ * | | 1630000000 | | 112 | | titi |
109
+ * | | 1630000000 | | 20 | | titi |
110
+ * | | 1630000000 | | 10 | | titi |
111
+ *
112
+ * OUTPUT:
113
+ * | timestamp #1 | timestamp #2 | value | instance #1 | instance #2 |
114
+ * |--------------|--------------|-------|-------------|-------------|
115
+ * | 1630000000 | | 55 | toto | |
116
+ * | 1630000000 | | 33 | toto | |
117
+ * | 1630000000 | | 45 | toto | |
118
+ * | | 1630000000 | 112 | | titi |
119
+ * | | 1630000000 | 20 | | titi |
120
+ * | | 1630000000 | 10 | | titi |
121
+ */ export function applyMergeIndexedColumnsTransform(data, column) {
122
+ const result = [];
123
+ for (const entry of data){
124
+ const indexedColumns = Object.keys(entry).filter((k)=>new RegExp('^(' + column + ' #\\d+)|(' + column + ')$').test(k));
125
+ const indexedColumnValues = {};
126
+ for (const indexedColumn of indexedColumns){
127
+ indexedColumnValues[indexedColumn] = entry[indexedColumn];
128
+ delete entry[indexedColumn];
129
+ }
130
+ for (const indexedColumn of indexedColumns){
131
+ result.push({
132
+ ...entry,
133
+ [column]: indexedColumnValues[indexedColumn]
134
+ });
135
+ }
136
+ if (indexedColumns.length === 0) {
137
+ result.push(entry);
138
+ }
139
+ }
140
+ return result;
141
+ }
142
+ /*
143
+ * Merge Indexed Columns: All indexed columns are merged to one column
144
+ *
145
+ * INPUT:
146
+ * | timestamp | value #1 | value #2 | mount #1 | mount #2 | instance #1 | instance #2 | env #1 | env #2 |
147
+ * |------------|----------|----------|-----------|-----------|-------------|-------------|--------|--------|
148
+ * | 1630000000 | 1 | | / | | test:44 | | prd | |
149
+ * | 1630000000 | 2 | | /boot/efi | | test:44 | | prd | |
150
+ * | 1630000000 | | 5 | | / | | test:44 | | prd |
151
+ * | 1630000000 | | 6 | | /boot/efi | | test:44 | | prd |
152
+ *
153
+ * OUTPUT:
154
+ * | timestamp | value #1 | value #2 | mount | instance | env |
155
+ * |------------|----------|----------|-----------|----------|-----|
156
+ * | 1630000000 | 1 | 5 | / | test:44 | prd |
157
+ * | 1630000000 | 2 | 6 | /boot/efi | test:44 | prd |
158
+ */ export function applyMergeSeriesTransform(data) {
159
+ let result = [
160
+ ...data
161
+ ];
162
+ const labelColumns = Array.from(new Set(data.flatMap(Object.keys).map((label)=>label.replace(/ #\d+/, '')).filter((label)=>label !== 'value')));
163
+ for (const label of labelColumns){
164
+ result = applyMergeIndexedColumnsTransform(result, label);
165
+ }
166
+ result = applyJoinTransform(result, labelColumns);
167
+ return result;
168
+ }
169
+ /*
170
+ * Transforms query data with the given transforms
171
+ */ export function transformData(data, transforms) {
172
+ let result = data;
173
+ // Apply transforms by their orders
174
+ for (const transform of transforms !== null && transforms !== void 0 ? transforms : []){
175
+ if (transform.spec.disabled) continue;
176
+ switch(transform.kind){
177
+ case 'JoinByColumnValue':
178
+ {
179
+ if (transform.spec.columns && transform.spec.columns.length > 0) {
180
+ result = applyJoinTransform(result, transform.spec.columns);
181
+ }
182
+ break;
183
+ }
184
+ case 'MergeIndexedColumns':
185
+ {
186
+ if (transform.spec.column) {
187
+ result = applyMergeIndexedColumnsTransform(result, transform.spec.column);
188
+ }
189
+ break;
190
+ }
191
+ case 'MergeColumns':
192
+ {
193
+ if (transform.spec.columns && transform.spec.columns.length > 0 && transform.spec.name) {
194
+ result = applyMergeColumnsTransform(result, transform.spec.columns, transform.spec.name);
195
+ }
196
+ break;
197
+ }
198
+ case 'MergeSeries':
199
+ {
200
+ result = applyMergeSeriesTransform(result);
201
+ break;
202
+ }
203
+ }
204
+ }
205
+ // Ordering data column alphabetically
206
+ result = result.map((row)=>{
207
+ return Object.keys(row).sort().reduce((obj, key)=>{
208
+ obj[key] = row[key];
209
+ return obj;
210
+ }, {});
211
+ });
212
+ return result;
213
+ }
214
+ export function useTransformData(data, transforms) {
215
+ return useMemo(()=>transformData(data, transforms), [
216
+ data,
217
+ transforms
218
+ ]);
219
+ }
220
+
221
+ //# sourceMappingURL=transform-data.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/transform-data.ts"],"sourcesContent":["// Copyright 2024 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Transform } from '@perses-dev/core';\nimport { useMemo } from 'react';\n\n/*\n * Join: Regroup rows with equal cell value in a column.\n * If there are multiple line with same value, next row values override the current one\n *\n * Example: Join on 'mount' column\n * INPUT:\n * | timestamp | value #1 | value #3 | mount |\n * |------------|----------|----------|-----------|\n * | 1630000000 | 1 | | / |\n * | 1630000000 | 2 | | /boot/efi |\n * | 1630000000 | | 3 | / |\n * | 1630000000 | | 4 | /boot/efi |\n *\n * OUTPUT:\n * | timestamp | value #1 | value #3 | mount |\n * |------------|----------|----------|-----------|\n * | 1630000000 | 1 | 3 | / |\n * | 1630000000 | 2 | 4 | /boot/efi |\n */\nexport function applyJoinTransform(\n data: Array<Record<string, unknown>>,\n columns: string[]\n): Array<Record<string, unknown>> {\n // If column is undefined or empty, return data as is\n if (columns.length === 0) {\n return data;\n }\n\n const rowHashed: { [key: string]: Record<string, unknown> } = {};\n\n for (const row of data) {\n const rowHash = Object.keys(row)\n .filter((k) => columns.includes(k))\n .map((k) => row[k])\n .join('|');\n\n const rowHashedValue = rowHashed[rowHash];\n if (rowHashedValue) {\n rowHashed[rowHash] = { ...rowHashedValue, ...row };\n } else {\n rowHashed[rowHash] = { ...row };\n }\n }\n return Object.values(rowHashed);\n}\n\n/*\n * Merges selected columns into a single column.\n *\n * Example: Merge columns 'value #1' and 'value #2' into a single column 'MERGED'\n * INPUT:\n * +------------+----------+----------+-----------+-----------+\n * | timestamp | value #1 | value #2 | mount #1 | mount #2 |\n * +------------+----------+----------+-----------+-----------+\n * | 1630000000 | 1 | | / | |\n * | 1630000000 | 2 | | /boot/efi | |\n * | 1630000000 | | 3 | | / |\n * | 1630000000 | | 4 | | /boot/efi |\n * +------------+----------+----------+-----------+-----------+\n *\n * OUTPUT:\n * +------------+--------+-----------+-----------+\n * | timestamp | MERGED | mount #1 | mount #2 |\n * +------------+--------+-----------+-----------+\n * | 1630000000 | 1 | / | |\n * | 1630000000 | 2 | /boot/efi | |\n * | 1630000000 | 2 | | / |\n * | 1630000000 | 3 | | /boot/efi |\n * +------------+--------+-----------+-----------+\n */\nexport function applyMergeColumnsTransform(\n data: Array<Record<string, unknown>>,\n selectedColumns: string[],\n outputName: string\n) {\n const result: Array<Record<string, unknown>> = [];\n\n for (const row of data) {\n const columns = Object.keys(row).filter((k) => selectedColumns.includes(k));\n\n const selectedColumnValues: Record<string, unknown> = {};\n\n for (const column of columns) {\n selectedColumnValues[column] = row[column];\n delete row[column];\n }\n\n for (const column of columns) {\n result.push({ ...row, [outputName]: selectedColumnValues[column] });\n }\n\n if (columns.length === 0) {\n result.push(row);\n }\n }\n\n return result;\n}\n\n/*\n * Merge Indexed Columns: All indexed columns are merged to one column\n *\n * Example: Join on 'value' column\n * INPUT:\n * | timestamp #1 | timestamp #2 | value #1 | value #2 | instance #1 | instance #2 |\n * |--------------|--------------|----------|----------|-------------|-------------|\n * | 1630000000 | | 55 | | toto | |\n * | 1630000000 | | 33 | | toto | |\n * | 1630000000 | | 45 | | toto | |\n * | | 1630000000 | | 112 | | titi |\n * | | 1630000000 | | 20 | | titi |\n * | | 1630000000 | | 10 | | titi |\n *\n * OUTPUT:\n * | timestamp #1 | timestamp #2 | value | instance #1 | instance #2 |\n * |--------------|--------------|-------|-------------|-------------|\n * | 1630000000 | | 55 | toto | |\n * | 1630000000 | | 33 | toto | |\n * | 1630000000 | | 45 | toto | |\n * | | 1630000000 | 112 | | titi |\n * | | 1630000000 | 20 | | titi |\n * | | 1630000000 | 10 | | titi |\n */\nexport function applyMergeIndexedColumnsTransform(data: Array<Record<string, unknown>>, column: string) {\n const result: Array<Record<string, unknown>> = [];\n\n for (const entry of data) {\n const indexedColumns = Object.keys(entry).filter((k) =>\n new RegExp('^(' + column + ' #\\\\d+)|(' + column + ')$').test(k)\n );\n const indexedColumnValues: Record<string, unknown> = {};\n\n for (const indexedColumn of indexedColumns) {\n indexedColumnValues[indexedColumn] = entry[indexedColumn];\n delete entry[indexedColumn];\n }\n\n for (const indexedColumn of indexedColumns) {\n result.push({ ...entry, [column]: indexedColumnValues[indexedColumn] });\n }\n\n if (indexedColumns.length === 0) {\n result.push(entry);\n }\n }\n\n return result;\n}\n\n/*\n * Merge Indexed Columns: All indexed columns are merged to one column\n *\n * INPUT:\n * | timestamp | value #1 | value #2 | mount #1 | mount #2 | instance #1 | instance #2 | env #1 | env #2 |\n * |------------|----------|----------|-----------|-----------|-------------|-------------|--------|--------|\n * | 1630000000 | 1 | | / | | test:44 | | prd | |\n * | 1630000000 | 2 | | /boot/efi | | test:44 | | prd | |\n * | 1630000000 | | 5 | | / | | test:44 | | prd |\n * | 1630000000 | | 6 | | /boot/efi | | test:44 | | prd |\n *\n * OUTPUT:\n * | timestamp | value #1 | value #2 | mount | instance | env |\n * |------------|----------|----------|-----------|----------|-----|\n * | 1630000000 | 1 | 5 | / | test:44 | prd |\n * | 1630000000 | 2 | 6 | /boot/efi | test:44 | prd |\n */\nexport function applyMergeSeriesTransform(data: Array<Record<string, unknown>>): Array<Record<string, unknown>> {\n let result: Array<Record<string, unknown>> = [...data];\n\n const labelColumns = Array.from(\n new Set(\n data\n .flatMap(Object.keys)\n .map((label) => label.replace(/ #\\d+/, ''))\n .filter((label) => label !== 'value')\n )\n );\n\n for (const label of labelColumns) {\n result = applyMergeIndexedColumnsTransform(result, label);\n }\n\n result = applyJoinTransform(result, labelColumns);\n\n return result;\n}\n\n/*\n * Transforms query data with the given transforms\n */\nexport function transformData(\n data: Array<Record<string, unknown>>,\n transforms: Transform[]\n): Array<Record<string, unknown>> {\n let result: Array<Record<string, unknown>> = data;\n\n // Apply transforms by their orders\n for (const transform of transforms ?? []) {\n if (transform.spec.disabled) continue;\n\n switch (transform.kind) {\n case 'JoinByColumnValue': {\n if (transform.spec.columns && transform.spec.columns.length > 0) {\n result = applyJoinTransform(result, transform.spec.columns);\n }\n break;\n }\n case 'MergeIndexedColumns': {\n if (transform.spec.column) {\n result = applyMergeIndexedColumnsTransform(result, transform.spec.column);\n }\n break;\n }\n case 'MergeColumns': {\n if (transform.spec.columns && transform.spec.columns.length > 0 && transform.spec.name) {\n result = applyMergeColumnsTransform(result, transform.spec.columns, transform.spec.name);\n }\n break;\n }\n case 'MergeSeries': {\n result = applyMergeSeriesTransform(result);\n break;\n }\n }\n }\n\n // Ordering data column alphabetically\n result = result.map((row) => {\n return Object.keys(row)\n .sort()\n .reduce((obj: Record<string, unknown>, key: string) => {\n obj[key] = row[key];\n return obj;\n }, {});\n });\n return result;\n}\n\nexport function useTransformData(\n data: Array<Record<string, unknown>>,\n transforms: Transform[]\n): Array<Record<string, unknown>> {\n return useMemo(() => transformData(data, transforms), [data, transforms]);\n}\n"],"names":["useMemo","applyJoinTransform","data","columns","length","rowHashed","row","rowHash","Object","keys","filter","k","includes","map","join","rowHashedValue","values","applyMergeColumnsTransform","selectedColumns","outputName","result","selectedColumnValues","column","push","applyMergeIndexedColumnsTransform","entry","indexedColumns","RegExp","test","indexedColumnValues","indexedColumn","applyMergeSeriesTransform","labelColumns","Array","from","Set","flatMap","label","replace","transformData","transforms","transform","spec","disabled","kind","name","sort","reduce","obj","key","useTransformData"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAGjC,SAASA,OAAO,QAAQ,QAAQ;AAEhC;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASC,mBACdC,IAAoC,EACpCC,OAAiB;IAEjB,qDAAqD;IACrD,IAAIA,QAAQC,MAAM,KAAK,GAAG;QACxB,OAAOF;IACT;IAEA,MAAMG,YAAwD,CAAC;IAE/D,KAAK,MAAMC,OAAOJ,KAAM;QACtB,MAAMK,UAAUC,OAAOC,IAAI,CAACH,KACzBI,MAAM,CAAC,CAACC,IAAMR,QAAQS,QAAQ,CAACD,IAC/BE,GAAG,CAAC,CAACF,IAAML,GAAG,CAACK,EAAE,EACjBG,IAAI,CAAC;QAER,MAAMC,iBAAiBV,SAAS,CAACE,QAAQ;QACzC,IAAIQ,gBAAgB;YAClBV,SAAS,CAACE,QAAQ,GAAG;gBAAE,GAAGQ,cAAc;gBAAE,GAAGT,GAAG;YAAC;QACnD,OAAO;YACLD,SAAS,CAACE,QAAQ,GAAG;gBAAE,GAAGD,GAAG;YAAC;QAChC;IACF;IACA,OAAOE,OAAOQ,MAAM,CAACX;AACvB;AAEA;;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,KAAKqC,UAAUC,IAAI,CAACG,IAAI,EAAE;wBACtFzB,SAASH,2BAA2BG,QAAQqB,UAAUC,IAAI,CAACvC,OAAO,EAAEsC,UAAUC,IAAI,CAACG,IAAI;oBACzF;oBACA;gBACF;YACA,KAAK;gBAAe;oBAClBzB,SAASW,0BAA0BX;oBACnC;gBACF;QACF;IACF;IAEA,sCAAsC;IACtCA,SAASA,OAAOP,GAAG,CAAC,CAACP;QACnB,OAAOE,OAAOC,IAAI,CAACH,KAChBwC,IAAI,GACJC,MAAM,CAAC,CAACC,KAA8BC;YACrCD,GAAG,CAACC,IAAI,GAAG3C,GAAG,CAAC2C,IAAI;YACnB,OAAOD;QACT,GAAG,CAAC;IACR;IACA,OAAO5B;AACT;AAEA,OAAO,SAAS8B,iBACdhD,IAAoC,EACpCsC,UAAuB;IAEvB,OAAOxC,QAAQ,IAAMuC,cAAcrC,MAAMsC,aAAa;QAACtC;QAAMsC;KAAW;AAC1E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/core",
3
- "version": "0.48.0",
3
+ "version": "0.49.0-rc.0",
4
4
  "description": "Core functionality consumed by both the Perses UI and plugins",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/perses/perses/blob/main/README.md",