@perses-dev/core 0.34.0 → 0.36.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.
Files changed (72) hide show
  1. package/dist/cjs/model/calculations.js +112 -33
  2. package/dist/cjs/model/index.js +1 -0
  3. package/dist/cjs/model/legend.js +19 -2
  4. package/dist/cjs/model/units/bytes.js +84 -0
  5. package/dist/cjs/model/units/constants.js +23 -0
  6. package/dist/cjs/model/units/decimal.js +62 -0
  7. package/dist/cjs/model/units/index.js +31 -0
  8. package/dist/cjs/model/units/percent.js +73 -0
  9. package/dist/cjs/model/units/time.js +105 -0
  10. package/dist/cjs/model/units/types.js +28 -0
  11. package/dist/cjs/model/units/units.js +101 -0
  12. package/dist/cjs/model/units/utils.js +42 -0
  13. package/dist/cjs/model/variables.js +5 -0
  14. package/dist/model/calculations.d.ts +29 -5
  15. package/dist/model/calculations.d.ts.map +1 -1
  16. package/dist/model/calculations.js +121 -28
  17. package/dist/model/calculations.js.map +1 -1
  18. package/dist/model/dashboard.d.ts +1 -0
  19. package/dist/model/dashboard.d.ts.map +1 -1
  20. package/dist/model/dashboard.js.map +1 -1
  21. package/dist/model/index.d.ts +1 -0
  22. package/dist/model/index.d.ts.map +1 -1
  23. package/dist/model/index.js +1 -0
  24. package/dist/model/index.js.map +1 -1
  25. package/dist/model/legend.d.ts +5 -0
  26. package/dist/model/legend.d.ts.map +1 -1
  27. package/dist/model/legend.js +15 -1
  28. package/dist/model/legend.js.map +1 -1
  29. package/dist/model/thresholds.d.ts +4 -0
  30. package/dist/model/thresholds.d.ts.map +1 -1
  31. package/dist/model/thresholds.js.map +1 -1
  32. package/dist/model/units/bytes.d.ts +13 -0
  33. package/dist/model/units/bytes.d.ts.map +1 -0
  34. package/dist/model/units/bytes.js +66 -0
  35. package/dist/model/units/bytes.js.map +1 -0
  36. package/dist/model/units/constants.d.ts +2 -0
  37. package/dist/model/units/constants.d.ts.map +1 -0
  38. package/dist/model/units/constants.js +17 -0
  39. package/dist/model/units/constants.js.map +1 -0
  40. package/dist/model/units/decimal.d.ts +13 -0
  41. package/dist/model/units/decimal.d.ts.map +1 -0
  42. package/dist/model/units/decimal.js +49 -0
  43. package/dist/model/units/decimal.js.map +1 -0
  44. package/dist/model/units/index.d.ts +5 -0
  45. package/dist/model/units/index.d.ts.map +1 -0
  46. package/dist/model/units/index.js +18 -0
  47. package/dist/model/units/index.js.map +1 -0
  48. package/dist/model/units/percent.d.ts +12 -0
  49. package/dist/model/units/percent.d.ts.map +1 -0
  50. package/dist/model/units/percent.js +60 -0
  51. package/dist/model/units/percent.js.map +1 -0
  52. package/dist/model/units/time.d.ts +22 -0
  53. package/dist/model/units/time.d.ts.map +1 -0
  54. package/dist/model/units/time.js +91 -0
  55. package/dist/model/units/time.js.map +1 -0
  56. package/dist/model/units/types.d.ts +47 -0
  57. package/dist/model/units/types.d.ts.map +1 -0
  58. package/dist/model/units/types.js +22 -0
  59. package/dist/model/units/types.js.map +1 -0
  60. package/dist/model/units/units.d.ts +40 -0
  61. package/dist/model/units/units.d.ts.map +1 -0
  62. package/dist/model/units/units.js +80 -0
  63. package/dist/model/units/units.js.map +1 -0
  64. package/dist/model/units/utils.d.ts +4 -0
  65. package/dist/model/units/utils.d.ts.map +1 -0
  66. package/dist/model/units/utils.js +32 -0
  67. package/dist/model/units/utils.js.map +1 -0
  68. package/dist/model/variables.d.ts +1 -0
  69. package/dist/model/variables.d.ts.map +1 -1
  70. package/dist/model/variables.js +1 -1
  71. package/dist/model/variables.js.map +1 -1
  72. package/package.json +3 -2
@@ -0,0 +1,80 @@
1
+ // Copyright 2023 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 { BYTES_GROUP_CONFIG, BYTES_UNIT_CONFIG, formatBytes } from './bytes';
14
+ import { DECIMAL_UNIT_CONFIG, formatDecimal, DECIMAL_GROUP_CONFIG } from './decimal';
15
+ import { PERCENT_GROUP_CONFIG, formatPercent, PERCENT_UNIT_CONFIG } from './percent';
16
+ import { formatTime, TIME_GROUP_CONFIG, TIME_UNIT_CONFIG } from './time';
17
+ export const UNIT_GROUP_CONFIG = {
18
+ Time: TIME_GROUP_CONFIG,
19
+ Percent: PERCENT_GROUP_CONFIG,
20
+ Decimal: DECIMAL_GROUP_CONFIG,
21
+ Bytes: BYTES_GROUP_CONFIG
22
+ };
23
+ export const UNIT_CONFIG = {
24
+ ...TIME_UNIT_CONFIG,
25
+ ...PERCENT_UNIT_CONFIG,
26
+ ...DECIMAL_UNIT_CONFIG,
27
+ ...BYTES_UNIT_CONFIG
28
+ };
29
+ export function formatValue(value, unitOptions) {
30
+ if (unitOptions === undefined) {
31
+ return value.toString();
32
+ }
33
+ if (isDecimalUnit(unitOptions)) {
34
+ return formatDecimal(value, unitOptions);
35
+ }
36
+ if (isTimeUnit(unitOptions)) {
37
+ return formatTime(value, unitOptions);
38
+ }
39
+ if (isPercentUnit(unitOptions)) {
40
+ return formatPercent(value, unitOptions);
41
+ }
42
+ if (isBytesUnit(unitOptions)) {
43
+ return formatBytes(value, unitOptions);
44
+ }
45
+ const exhaustive = unitOptions;
46
+ throw new Error(`Unknown unit options ${exhaustive}`);
47
+ }
48
+ export function getUnitKindConfig(unitOptions) {
49
+ return UNIT_CONFIG[unitOptions.kind];
50
+ }
51
+ export function getUnitGroup(unitOptions) {
52
+ return getUnitKindConfig(unitOptions).group;
53
+ }
54
+ export function getUnitGroupConfig(unitOptions) {
55
+ const unitConfig = getUnitKindConfig(unitOptions);
56
+ return UNIT_GROUP_CONFIG[unitConfig.group];
57
+ }
58
+ // Type guards
59
+ export function isTimeUnit(unitOptions) {
60
+ return getUnitGroup(unitOptions) === 'Time';
61
+ }
62
+ export function isPercentUnit(unitOptions) {
63
+ return getUnitGroup(unitOptions) === 'Percent';
64
+ }
65
+ export function isDecimalUnit(unitOptions) {
66
+ return getUnitGroup(unitOptions) === 'Decimal';
67
+ }
68
+ export function isBytesUnit(unitOptions) {
69
+ return getUnitGroup(unitOptions) === 'Bytes';
70
+ }
71
+ export function isUnitWithDecimalPlaces(unitOptions) {
72
+ const groupConfig = getUnitGroupConfig(unitOptions);
73
+ return !!groupConfig.decimal_places;
74
+ }
75
+ export function isUnitWithAbbreviate(unitOptions) {
76
+ const groupConfig = getUnitGroupConfig(unitOptions);
77
+ return !!groupConfig.abbreviate;
78
+ }
79
+
80
+ //# sourceMappingURL=units.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/model/units/units.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 { BytesUnitOptions, BYTES_GROUP_CONFIG, BYTES_UNIT_CONFIG, formatBytes } from './bytes';\nimport { DecimalUnitOptions, DECIMAL_UNIT_CONFIG, formatDecimal, DECIMAL_GROUP_CONFIG } from './decimal';\nimport { PERCENT_GROUP_CONFIG, formatPercent, PercentUnitOptions, PERCENT_UNIT_CONFIG } from './percent';\nimport { formatTime, TimeUnitOptions, TIME_GROUP_CONFIG, TIME_UNIT_CONFIG } from './time';\nimport { UnitGroup, UnitGroupConfig, UnitConfig } from './types';\n\nexport const UNIT_GROUP_CONFIG: Readonly<Record<UnitGroup, UnitGroupConfig>> = {\n Time: TIME_GROUP_CONFIG,\n Percent: PERCENT_GROUP_CONFIG,\n Decimal: DECIMAL_GROUP_CONFIG,\n Bytes: BYTES_GROUP_CONFIG,\n};\nexport const UNIT_CONFIG = {\n ...TIME_UNIT_CONFIG,\n ...PERCENT_UNIT_CONFIG,\n ...DECIMAL_UNIT_CONFIG,\n ...BYTES_UNIT_CONFIG,\n} as const;\n\nexport type UnitOptions = TimeUnitOptions | PercentUnitOptions | DecimalUnitOptions | BytesUnitOptions;\n\ntype HasDecimalPlaces<UnitOpt> = UnitOpt extends { decimal_places?: number } ? UnitOpt : never;\ntype HasAbbreviate<UnitOpt> = UnitOpt extends { abbreviate?: boolean } ? UnitOpt : never;\n\nexport function formatValue(value: number, unitOptions?: UnitOptions): string {\n if (unitOptions === undefined) {\n return value.toString();\n }\n\n if (isDecimalUnit(unitOptions)) {\n return formatDecimal(value, unitOptions);\n }\n\n if (isTimeUnit(unitOptions)) {\n return formatTime(value, unitOptions);\n }\n\n if (isPercentUnit(unitOptions)) {\n return formatPercent(value, unitOptions);\n }\n\n if (isBytesUnit(unitOptions)) {\n return formatBytes(value, unitOptions);\n }\n\n const exhaustive: never = unitOptions;\n throw new Error(`Unknown unit options ${exhaustive}`);\n}\n\nexport function getUnitKindConfig(unitOptions: UnitOptions): UnitConfig {\n return UNIT_CONFIG[unitOptions.kind];\n}\n\nexport function getUnitGroup(unitOptions: UnitOptions): UnitGroup {\n return getUnitKindConfig(unitOptions).group;\n}\n\nexport function getUnitGroupConfig(unitOptions: UnitOptions): UnitGroupConfig {\n const unitConfig = getUnitKindConfig(unitOptions);\n return UNIT_GROUP_CONFIG[unitConfig.group];\n}\n\n// Type guards\nexport function isTimeUnit(unitOptions: UnitOptions): unitOptions is TimeUnitOptions {\n return getUnitGroup(unitOptions) === 'Time';\n}\n\nexport function isPercentUnit(unitOptions: UnitOptions): unitOptions is PercentUnitOptions {\n return getUnitGroup(unitOptions) === 'Percent';\n}\n\nexport function isDecimalUnit(unitOptions: UnitOptions): unitOptions is DecimalUnitOptions {\n return getUnitGroup(unitOptions) === 'Decimal';\n}\n\nexport function isBytesUnit(unitOptions: UnitOptions): unitOptions is BytesUnitOptions {\n return getUnitGroup(unitOptions) === 'Bytes';\n}\n\nexport function isUnitWithDecimalPlaces(unitOptions: UnitOptions): unitOptions is HasDecimalPlaces<UnitOptions> {\n const groupConfig = getUnitGroupConfig(unitOptions);\n\n return !!groupConfig.decimal_places;\n}\n\nexport function isUnitWithAbbreviate(unitOptions: UnitOptions): unitOptions is HasAbbreviate<UnitOptions> {\n const groupConfig = getUnitGroupConfig(unitOptions);\n\n return !!groupConfig.abbreviate;\n}\n"],"names":["BYTES_GROUP_CONFIG","BYTES_UNIT_CONFIG","formatBytes","DECIMAL_UNIT_CONFIG","formatDecimal","DECIMAL_GROUP_CONFIG","PERCENT_GROUP_CONFIG","formatPercent","PERCENT_UNIT_CONFIG","formatTime","TIME_GROUP_CONFIG","TIME_UNIT_CONFIG","UNIT_GROUP_CONFIG","Time","Percent","Decimal","Bytes","UNIT_CONFIG","formatValue","value","unitOptions","undefined","toString","isDecimalUnit","isTimeUnit","isPercentUnit","isBytesUnit","exhaustive","Error","getUnitKindConfig","kind","getUnitGroup","group","getUnitGroupConfig","unitConfig","isUnitWithDecimalPlaces","groupConfig","decimal_places","isUnitWithAbbreviate","abbreviate"],"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,SAA2BA,kBAAkB,EAAEC,iBAAiB,EAAEC,WAAW,QAAQ,SAAS,CAAC;AAC/F,SAA6BC,mBAAmB,EAAEC,aAAa,EAAEC,oBAAoB,QAAQ,WAAW,CAAC;AACzG,SAASC,oBAAoB,EAAEC,aAAa,EAAsBC,mBAAmB,QAAQ,WAAW,CAAC;AACzG,SAASC,UAAU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AY,CAACX,WAAwB,EAAa;IAChE,OAAOS,iBAAiB,CAACT,WAAW,CAAC,CAACY,KAAK,CAAC;AAC9C,CAAC;AAED,OAAO,SAASC,kBAAkB,CAACb,WAAwB,EAAmB;IAC5E,MAAMc,UAAU,GAAGL,iBAAiB,CAACT,WAAW,CAAC,AAAC;IAClD,OAAOR,iBAAiB,CAACsB,UAAU,CAACF,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED,cAAc;AACd,OAAO,SAASR,UAAU,CAACJ,WAAwB,EAAkC;IACnF,OAAOW,YAAY,CAACX,WAAW,CAAC,KAAK,MAAM,CAAC;AAC9C,CAAC;AAED,OAAO,SAASK,aAAa,CAACL,WAAwB,EAAqC;IACzF,OAAOW,YAAY,CAACX,WAAW,CAAC,KAAK,SAAS,CAAC;AACjD,CAAC;AAED,OAAO,SAASG,aAAa,CAACH,WAAwB,EAAqC;IACzF,OAAOW,YAAY,CAACX,WAAW,CAAC,KAAK,SAAS,CAAC;AACjD,CAAC;AAED,OAAO,SAASM,WAAW,CAACN,WAAwB,EAAmC;IACrF,OAAOW,YAAY,CAACX,WAAW,CAAC,KAAK,OAAO,CAAC;AAC/C,CAAC;AAED,OAAO,SAASe,uBAAuB,CAACf,WAAwB,EAAgD;IAC9G,MAAMgB,WAAW,GAAGH,kBAAkB,CAACb,WAAW,CAAC,AAAC;IAEpD,OAAO,CAAC,CAACgB,WAAW,CAACC,cAAc,CAAC;AACtC,CAAC;AAED,OAAO,SAASC,oBAAoB,CAAClB,WAAwB,EAA6C;IACxG,MAAMgB,WAAW,GAAGH,kBAAkB,CAACb,WAAW,CAAC,AAAC;IAEpD,OAAO,CAAC,CAACgB,WAAW,CAACG,UAAU,CAAC;AAClC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function shouldAbbreviate(abbreviate?: boolean): boolean;
2
+ export declare function hasDecimalPlaces(decimal_places?: number): boolean;
3
+ export declare function limitDecimalPlaces(num?: number): number | undefined;
4
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/model/units/utils.ts"],"names":[],"mappings":"AAaA,wBAAgB,gBAAgB,CAAC,UAAU,CAAC,EAAE,OAAO,WAEpD;AAED,wBAAgB,gBAAgB,CAAC,cAAc,CAAC,EAAE,MAAM,WAEvD;AAKD,wBAAgB,kBAAkB,CAAC,GAAG,CAAC,EAAE,MAAM,sBAU9C"}
@@ -0,0 +1,32 @@
1
+ // Copyright 2023 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
+ export function shouldAbbreviate(abbreviate) {
14
+ return abbreviate !== false;
15
+ }
16
+ export function hasDecimalPlaces(decimal_places) {
17
+ return typeof decimal_places === 'number';
18
+ }
19
+ // Avoids maximumFractionDigits out-of-range error.
20
+ // Allowed values are 0 to 20.
21
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#maximumfractiondigits
22
+ export function limitDecimalPlaces(num) {
23
+ if (!num) return num;
24
+ if (num < 0) {
25
+ num = 0;
26
+ } else if (num > 20) {
27
+ num = 20;
28
+ }
29
+ return num;
30
+ }
31
+
32
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/model/units/utils.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 function shouldAbbreviate(abbreviate?: boolean) {\n return abbreviate !== false;\n}\n\nexport function hasDecimalPlaces(decimal_places?: number) {\n return typeof decimal_places === 'number';\n}\n\n// Avoids maximumFractionDigits out-of-range error.\n// Allowed values are 0 to 20.\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#maximumfractiondigits\nexport function limitDecimalPlaces(num?: number) {\n if (!num) return num;\n\n if (num < 0) {\n num = 0;\n } else if (num > 20) {\n num = 20;\n }\n\n return num;\n}\n"],"names":["shouldAbbreviate","abbreviate","hasDecimalPlaces","decimal_places","limitDecimalPlaces","num"],"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,OAAO,SAASA,gBAAgB,CAACC,UAAoB,EAAE;IACrD,OAAOA,UAAU,KAAK,KAAK,CAAC;AAC9B,CAAC;AAED,OAAO,SAASC,gBAAgB,CAACC,cAAuB,EAAE;IACxD,OAAO,OAAOA,cAAc,KAAK,QAAQ,CAAC;AAC5C,CAAC;AAED,mDAAmD;AACnD,8BAA8B;AAC9B,wIAAwI;AACxI,OAAO,SAASC,kBAAkB,CAACC,GAAY,EAAE;IAC/C,IAAI,CAACA,GAAG,EAAE,OAAOA,GAAG,CAAC;IAErB,IAAIA,GAAG,GAAG,CAAC,EAAE;QACXA,GAAG,GAAG,CAAC,CAAC;IACV,OAAO,IAAIA,GAAG,GAAG,EAAE,EAAE;QACnBA,GAAG,GAAG,EAAE,CAAC;IACX,CAAC;IAED,OAAOA,GAAG,CAAC;AACb,CAAC"}
@@ -26,5 +26,6 @@ export interface ListVariableSpec<PluginSpec> extends VariableSpec {
26
26
  plugin: Definition<PluginSpec>;
27
27
  }
28
28
  export declare type VariableDefinition = TextVariableDefinition | ListVariableDefinition;
29
+ export declare const DEFAULT_ALL_VALUE: "$__all";
29
30
  export {};
30
31
  //# sourceMappingURL=variables.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/model/variables.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,oBAAY,YAAY,GAAG,MAAM,CAAC;AAElC,oBAAY,aAAa,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;AAErD,UAAU,YAAY;IACpB,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,GAAG;QAClB,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,sBAAuB,SAAQ,UAAU,CAAC,gBAAgB,CAAC;IAC1E,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sBAAsB,CAAC,UAAU,GAAG,WAAW,CAAE,SAAQ,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAChH,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB,CAAC,UAAU,CAAE,SAAQ,YAAY;IAChE,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,UA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,6 +10,6 @@
10
10
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
11
  // See the License for the specific language governing permissions and
12
12
  // limitations under the License.
13
- export { };
13
+ export const DEFAULT_ALL_VALUE = '$__all';
14
14
 
15
15
  //# sourceMappingURL=variables.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/variables.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 { Definition, UnknownSpec } from './definitions';\nimport { Display } from './display';\n\nexport type VariableName = string;\n\nexport type VariableValue = string | string[] | null;\n\ninterface VariableSpec {\n name: VariableName;\n display?: Display & {\n hidden?: boolean;\n };\n}\n\nexport interface TextVariableDefinition extends Definition<TextVariableSpec> {\n kind: 'TextVariable';\n}\n\nexport interface TextVariableSpec extends VariableSpec {\n value: string;\n}\n\nexport interface ListVariableDefinition<PluginSpec = UnknownSpec> extends Definition<ListVariableSpec<PluginSpec>> {\n kind: 'ListVariable';\n}\n\nexport interface ListVariableSpec<PluginSpec> extends VariableSpec {\n default_value?: VariableValue;\n allow_multiple?: boolean;\n allow_all_value?: boolean;\n custom_all_value?: string;\n capturing_regexp?: string;\n plugin: Definition<PluginSpec>;\n}\n\nexport type VariableDefinition = TextVariableDefinition | ListVariableDefinition;\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,WAmCiF"}
1
+ {"version":3,"sources":["../../src/model/variables.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 { Definition, UnknownSpec } from './definitions';\nimport { Display } from './display';\n\nexport type VariableName = string;\n\nexport type VariableValue = string | string[] | null;\n\ninterface VariableSpec {\n name: VariableName;\n display?: Display & {\n hidden?: boolean;\n };\n}\n\nexport interface TextVariableDefinition extends Definition<TextVariableSpec> {\n kind: 'TextVariable';\n}\n\nexport interface TextVariableSpec extends VariableSpec {\n value: string;\n}\n\nexport interface ListVariableDefinition<PluginSpec = UnknownSpec> extends Definition<ListVariableSpec<PluginSpec>> {\n kind: 'ListVariable';\n}\n\nexport interface ListVariableSpec<PluginSpec> extends VariableSpec {\n default_value?: VariableValue;\n allow_multiple?: boolean;\n allow_all_value?: boolean;\n custom_all_value?: string;\n capturing_regexp?: string;\n plugin: Definition<PluginSpec>;\n}\n\nexport type VariableDefinition = TextVariableDefinition | ListVariableDefinition;\n\nexport const DEFAULT_ALL_VALUE = '$__all' as const;\n"],"names":["DEFAULT_ALL_VALUE"],"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,OAAO,MAAMA,iBAAiB,GAAG,QAAQ,AAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@perses-dev/core",
3
- "version": "0.34.0",
3
+ "version": "0.36.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",
@@ -31,7 +31,8 @@
31
31
  "dependencies": {
32
32
  "date-fns": "^2.28.0",
33
33
  "lodash": "^4.17.21",
34
- "mathjs": "^10.6.4"
34
+ "mathjs": "^10.6.4",
35
+ "numbro": "^2.3.6"
35
36
  },
36
37
  "peerDependencies": {
37
38
  "react": "^17.0.2 || ^18.0.0",