@perses-dev/core 0.52.0-beta.2 → 0.52.0-beta.4
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.
- package/dist/cjs/{src/model → model}/index.js +1 -0
- package/dist/cjs/model/otlp/resource/v1/resource.js +16 -0
- package/dist/constants/dashboard-defaults.js.map +1 -0
- package/dist/{src/model/notice.js.map → constants/index.js.map} +1 -1
- package/dist/index.js.map +1 -0
- package/dist/model/calculations.js.map +1 -0
- package/dist/model/dashboard.js.map +1 -0
- package/dist/model/datasource.js.map +1 -0
- package/dist/model/definitions.js.map +1 -0
- package/dist/{src/model/http.js.map → model/display.js.map} +1 -1
- package/dist/model/ephemeraldashboard.js.map +1 -0
- package/dist/model/http-proxy.js.map +1 -0
- package/dist/model/http.js.map +1 -0
- package/dist/model/index.d.ts +1 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/{src/model → model}/index.js +1 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/kind.js.map +1 -0
- package/dist/model/layout.js.map +1 -0
- package/dist/model/legend.js.map +1 -0
- package/dist/model/log-data.d.ts +48 -0
- package/dist/model/log-data.d.ts.map +1 -0
- package/dist/model/log-data.js +15 -0
- package/dist/model/log-data.js.map +1 -0
- package/dist/model/notice.js.map +1 -0
- package/dist/model/otlp/common/v1/common.js.map +1 -0
- package/dist/model/otlp/index.js.map +1 -0
- package/dist/model/otlp/resource/v1/resource.js.map +1 -0
- package/dist/model/otlp/trace/v1/trace.js.map +1 -0
- package/dist/model/panels.js.map +1 -0
- package/dist/model/profile-data.js.map +1 -0
- package/dist/model/project.js.map +1 -0
- package/dist/model/query.d.ts +2 -0
- package/dist/model/query.d.ts.map +1 -1
- package/dist/model/query.js.map +1 -0
- package/dist/model/resource.js.map +1 -0
- package/dist/model/rolebindings.js.map +1 -0
- package/dist/model/roles.js.map +1 -0
- package/dist/model/secrets.js.map +1 -0
- package/dist/model/thresholds.js.map +1 -0
- package/dist/model/time-series-data.js.map +1 -0
- package/dist/model/time-series-queries.js.map +1 -0
- package/dist/model/time.js.map +1 -0
- package/dist/model/trace-data.js.map +1 -0
- package/dist/model/transforms.js.map +1 -0
- package/dist/model/units/bytes.js.map +1 -0
- package/dist/model/units/constants.js.map +1 -0
- package/dist/model/units/currency.js.map +1 -0
- package/dist/model/units/decimal.js.map +1 -0
- package/dist/model/units/index.js.map +1 -0
- package/dist/model/units/percent.js.map +1 -0
- package/dist/model/units/throughput.js.map +1 -0
- package/dist/model/units/time.js.map +1 -0
- package/dist/model/units/types.js.map +1 -0
- package/dist/model/units/units.js.map +1 -0
- package/dist/model/units/utils.js.map +1 -0
- package/dist/model/user.js.map +1 -0
- package/dist/model/value-mapping.js.map +1 -0
- package/dist/model/variables.js.map +1 -0
- package/dist/schema/datasource.js.map +1 -0
- package/dist/schema/display.js.map +1 -0
- package/dist/schema/duration.js.map +1 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/metadata.js.map +1 -0
- package/dist/schema/panel.js.map +1 -0
- package/dist/schema/plugin.js.map +1 -0
- package/dist/schema/role.js.map +1 -0
- package/dist/schema/rolebinding.js.map +1 -0
- package/dist/schema/secret.js.map +1 -0
- package/dist/schema/user.js.map +1 -0
- package/dist/schema/variable.js.map +1 -0
- package/dist/{src/model/display.js.map → test/setup-tests.js.map} +1 -1
- package/dist/utils/event.js.map +1 -0
- package/dist/utils/fetch.js.map +1 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/is-empty-object.js.map +1 -0
- package/dist/utils/mathjs.js.map +1 -0
- package/dist/utils/memo.js.map +1 -0
- package/dist/utils/panel-refs.js.map +1 -0
- package/dist/utils/regexp.js.map +1 -0
- package/dist/utils/text.js.map +1 -0
- package/dist/utils/time-series-data.js.map +1 -0
- package/dist/utils/transform-data.js.map +1 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/utils/value-mapping.js.map +1 -0
- package/package.json +3 -3
- package/dist/src/constants/dashboard-defaults.js.map +0 -1
- package/dist/src/constants/index.js.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/model/calculations.js.map +0 -1
- package/dist/src/model/dashboard.js.map +0 -1
- package/dist/src/model/datasource.js.map +0 -1
- package/dist/src/model/definitions.js.map +0 -1
- package/dist/src/model/ephemeraldashboard.js.map +0 -1
- package/dist/src/model/http-proxy.js.map +0 -1
- package/dist/src/model/index.js.map +0 -1
- package/dist/src/model/kind.js.map +0 -1
- package/dist/src/model/layout.js.map +0 -1
- package/dist/src/model/legend.js.map +0 -1
- package/dist/src/model/otlp/common/v1/common.js.map +0 -1
- package/dist/src/model/otlp/index.js.map +0 -1
- package/dist/src/model/otlp/resource/v1/resource.js.map +0 -1
- package/dist/src/model/otlp/trace/v1/trace.js.map +0 -1
- package/dist/src/model/panels.js.map +0 -1
- package/dist/src/model/profile-data.js.map +0 -1
- package/dist/src/model/project.js.map +0 -1
- package/dist/src/model/query.js.map +0 -1
- package/dist/src/model/resource.js.map +0 -1
- package/dist/src/model/rolebindings.js.map +0 -1
- package/dist/src/model/roles.js.map +0 -1
- package/dist/src/model/secrets.js.map +0 -1
- package/dist/src/model/thresholds.js.map +0 -1
- package/dist/src/model/time-series-data.js.map +0 -1
- package/dist/src/model/time-series-queries.js.map +0 -1
- package/dist/src/model/time.js.map +0 -1
- package/dist/src/model/trace-data.js.map +0 -1
- package/dist/src/model/transforms.js.map +0 -1
- package/dist/src/model/units/bytes.js.map +0 -1
- package/dist/src/model/units/constants.js.map +0 -1
- package/dist/src/model/units/currency.js.map +0 -1
- package/dist/src/model/units/decimal.js.map +0 -1
- package/dist/src/model/units/index.js.map +0 -1
- package/dist/src/model/units/percent.js.map +0 -1
- package/dist/src/model/units/throughput.js.map +0 -1
- package/dist/src/model/units/time.js.map +0 -1
- package/dist/src/model/units/types.js.map +0 -1
- package/dist/src/model/units/units.js.map +0 -1
- package/dist/src/model/units/utils.js.map +0 -1
- package/dist/src/model/user.js.map +0 -1
- package/dist/src/model/value-mapping.js.map +0 -1
- package/dist/src/model/variables.js.map +0 -1
- package/dist/src/schema/datasource.js.map +0 -1
- package/dist/src/schema/display.js.map +0 -1
- package/dist/src/schema/duration.js.map +0 -1
- package/dist/src/schema/index.js.map +0 -1
- package/dist/src/schema/metadata.js.map +0 -1
- package/dist/src/schema/panel.js.map +0 -1
- package/dist/src/schema/plugin.js.map +0 -1
- package/dist/src/schema/role.js.map +0 -1
- package/dist/src/schema/rolebinding.js.map +0 -1
- package/dist/src/schema/secret.js.map +0 -1
- package/dist/src/schema/user.js.map +0 -1
- package/dist/src/schema/variable.js.map +0 -1
- package/dist/src/test/setup-tests.js.map +0 -1
- package/dist/src/utils/event.js.map +0 -1
- package/dist/src/utils/fetch.js.map +0 -1
- package/dist/src/utils/index.js.map +0 -1
- package/dist/src/utils/is-empty-object.js.map +0 -1
- package/dist/src/utils/mathjs.js.map +0 -1
- package/dist/src/utils/memo.js.map +0 -1
- package/dist/src/utils/panel-refs.js.map +0 -1
- package/dist/src/utils/regexp.js.map +0 -1
- package/dist/src/utils/text.js.map +0 -1
- package/dist/src/utils/time-series-data.js.map +0 -1
- package/dist/src/utils/transform-data.js.map +0 -1
- package/dist/src/utils/types.js.map +0 -1
- package/dist/src/utils/value-mapping.js.map +0 -1
- /package/dist/cjs/{src/constants → constants}/dashboard-defaults.js +0 -0
- /package/dist/cjs/{src/constants → constants}/index.js +0 -0
- /package/dist/cjs/{src/index.js → index.js} +0 -0
- /package/dist/cjs/{src/model → model}/calculations.js +0 -0
- /package/dist/cjs/{src/model → model}/dashboard.js +0 -0
- /package/dist/cjs/{src/model → model}/datasource.js +0 -0
- /package/dist/cjs/{src/model → model}/definitions.js +0 -0
- /package/dist/cjs/{src/model → model}/display.js +0 -0
- /package/dist/cjs/{src/model → model}/ephemeraldashboard.js +0 -0
- /package/dist/cjs/{src/model → model}/http-proxy.js +0 -0
- /package/dist/cjs/{src/model → model}/http.js +0 -0
- /package/dist/cjs/{src/model → model}/kind.js +0 -0
- /package/dist/cjs/{src/model → model}/layout.js +0 -0
- /package/dist/cjs/{src/model → model}/legend.js +0 -0
- /package/dist/cjs/{src/model/otlp/resource/v1/resource.js → model/log-data.js} +0 -0
- /package/dist/cjs/{src/model → model}/notice.js +0 -0
- /package/dist/cjs/{src/model → model}/otlp/common/v1/common.js +0 -0
- /package/dist/cjs/{src/model → model}/otlp/index.js +0 -0
- /package/dist/cjs/{src/model → model}/otlp/trace/v1/trace.js +0 -0
- /package/dist/cjs/{src/model → model}/panels.js +0 -0
- /package/dist/cjs/{src/model → model}/profile-data.js +0 -0
- /package/dist/cjs/{src/model → model}/project.js +0 -0
- /package/dist/cjs/{src/model → model}/query.js +0 -0
- /package/dist/cjs/{src/model → model}/resource.js +0 -0
- /package/dist/cjs/{src/model → model}/rolebindings.js +0 -0
- /package/dist/cjs/{src/model → model}/roles.js +0 -0
- /package/dist/cjs/{src/model → model}/secrets.js +0 -0
- /package/dist/cjs/{src/model → model}/thresholds.js +0 -0
- /package/dist/cjs/{src/model → model}/time-series-data.js +0 -0
- /package/dist/cjs/{src/model → model}/time-series-queries.js +0 -0
- /package/dist/cjs/{src/model → model}/time.js +0 -0
- /package/dist/cjs/{src/model → model}/trace-data.js +0 -0
- /package/dist/cjs/{src/model → model}/transforms.js +0 -0
- /package/dist/cjs/{src/model → model}/units/bytes.js +0 -0
- /package/dist/cjs/{src/model → model}/units/constants.js +0 -0
- /package/dist/cjs/{src/model → model}/units/currency.js +0 -0
- /package/dist/cjs/{src/model → model}/units/decimal.js +0 -0
- /package/dist/cjs/{src/model → model}/units/index.js +0 -0
- /package/dist/cjs/{src/model → model}/units/percent.js +0 -0
- /package/dist/cjs/{src/model → model}/units/throughput.js +0 -0
- /package/dist/cjs/{src/model → model}/units/time.js +0 -0
- /package/dist/cjs/{src/model → model}/units/types.js +0 -0
- /package/dist/cjs/{src/model → model}/units/units.js +0 -0
- /package/dist/cjs/{src/model → model}/units/utils.js +0 -0
- /package/dist/cjs/{src/model → model}/user.js +0 -0
- /package/dist/cjs/{src/model → model}/value-mapping.js +0 -0
- /package/dist/cjs/{src/model → model}/variables.js +0 -0
- /package/dist/cjs/{src/schema → schema}/datasource.js +0 -0
- /package/dist/cjs/{src/schema → schema}/display.js +0 -0
- /package/dist/cjs/{src/schema → schema}/duration.js +0 -0
- /package/dist/cjs/{src/schema → schema}/index.js +0 -0
- /package/dist/cjs/{src/schema → schema}/metadata.js +0 -0
- /package/dist/cjs/{src/schema → schema}/panel.js +0 -0
- /package/dist/cjs/{src/schema → schema}/plugin.js +0 -0
- /package/dist/cjs/{src/schema → schema}/role.js +0 -0
- /package/dist/cjs/{src/schema → schema}/rolebinding.js +0 -0
- /package/dist/cjs/{src/schema → schema}/secret.js +0 -0
- /package/dist/cjs/{src/schema → schema}/user.js +0 -0
- /package/dist/cjs/{src/schema → schema}/variable.js +0 -0
- /package/dist/cjs/{src/test → test}/setup-tests.js +0 -0
- /package/dist/cjs/{src/utils → utils}/event.js +0 -0
- /package/dist/cjs/{src/utils → utils}/fetch.js +0 -0
- /package/dist/cjs/{src/utils → utils}/index.js +0 -0
- /package/dist/cjs/{src/utils → utils}/is-empty-object.js +0 -0
- /package/dist/cjs/{src/utils → utils}/mathjs.js +0 -0
- /package/dist/cjs/{src/utils → utils}/memo.js +0 -0
- /package/dist/cjs/{src/utils → utils}/panel-refs.js +0 -0
- /package/dist/cjs/{src/utils → utils}/regexp.js +0 -0
- /package/dist/cjs/{src/utils → utils}/text.js +0 -0
- /package/dist/cjs/{src/utils → utils}/time-series-data.js +0 -0
- /package/dist/cjs/{src/utils → utils}/transform-data.js +0 -0
- /package/dist/cjs/{src/utils → utils}/types.js +0 -0
- /package/dist/cjs/{src/utils → utils}/value-mapping.js +0 -0
- /package/dist/{src/constants → constants}/dashboard-defaults.js +0 -0
- /package/dist/{src/constants → constants}/index.js +0 -0
- /package/dist/{src/index.js → index.js} +0 -0
- /package/dist/{src/model → model}/calculations.js +0 -0
- /package/dist/{src/model → model}/dashboard.js +0 -0
- /package/dist/{src/model → model}/datasource.js +0 -0
- /package/dist/{src/model → model}/definitions.js +0 -0
- /package/dist/{src/model → model}/display.js +0 -0
- /package/dist/{src/model → model}/ephemeraldashboard.js +0 -0
- /package/dist/{src/model → model}/http-proxy.js +0 -0
- /package/dist/{src/model → model}/http.js +0 -0
- /package/dist/{src/model → model}/kind.js +0 -0
- /package/dist/{src/model → model}/layout.js +0 -0
- /package/dist/{src/model → model}/legend.js +0 -0
- /package/dist/{src/model → model}/notice.js +0 -0
- /package/dist/{src/model → model}/otlp/common/v1/common.js +0 -0
- /package/dist/{src/model → model}/otlp/index.js +0 -0
- /package/dist/{src/model → model}/otlp/resource/v1/resource.js +0 -0
- /package/dist/{src/model → model}/otlp/trace/v1/trace.js +0 -0
- /package/dist/{src/model → model}/panels.js +0 -0
- /package/dist/{src/model → model}/profile-data.js +0 -0
- /package/dist/{src/model → model}/project.js +0 -0
- /package/dist/{src/model → model}/query.js +0 -0
- /package/dist/{src/model → model}/resource.js +0 -0
- /package/dist/{src/model → model}/rolebindings.js +0 -0
- /package/dist/{src/model → model}/roles.js +0 -0
- /package/dist/{src/model → model}/secrets.js +0 -0
- /package/dist/{src/model → model}/thresholds.js +0 -0
- /package/dist/{src/model → model}/time-series-data.js +0 -0
- /package/dist/{src/model → model}/time-series-queries.js +0 -0
- /package/dist/{src/model → model}/time.js +0 -0
- /package/dist/{src/model → model}/trace-data.js +0 -0
- /package/dist/{src/model → model}/transforms.js +0 -0
- /package/dist/{src/model → model}/units/bytes.js +0 -0
- /package/dist/{src/model → model}/units/constants.js +0 -0
- /package/dist/{src/model → model}/units/currency.js +0 -0
- /package/dist/{src/model → model}/units/decimal.js +0 -0
- /package/dist/{src/model → model}/units/index.js +0 -0
- /package/dist/{src/model → model}/units/percent.js +0 -0
- /package/dist/{src/model → model}/units/throughput.js +0 -0
- /package/dist/{src/model → model}/units/time.js +0 -0
- /package/dist/{src/model → model}/units/types.js +0 -0
- /package/dist/{src/model → model}/units/units.js +0 -0
- /package/dist/{src/model → model}/units/utils.js +0 -0
- /package/dist/{src/model → model}/user.js +0 -0
- /package/dist/{src/model → model}/value-mapping.js +0 -0
- /package/dist/{src/model → model}/variables.js +0 -0
- /package/dist/{src/schema → schema}/datasource.js +0 -0
- /package/dist/{src/schema → schema}/display.js +0 -0
- /package/dist/{src/schema → schema}/duration.js +0 -0
- /package/dist/{src/schema → schema}/index.js +0 -0
- /package/dist/{src/schema → schema}/metadata.js +0 -0
- /package/dist/{src/schema → schema}/panel.js +0 -0
- /package/dist/{src/schema → schema}/plugin.js +0 -0
- /package/dist/{src/schema → schema}/role.js +0 -0
- /package/dist/{src/schema → schema}/rolebinding.js +0 -0
- /package/dist/{src/schema → schema}/secret.js +0 -0
- /package/dist/{src/schema → schema}/user.js +0 -0
- /package/dist/{src/schema → schema}/variable.js +0 -0
- /package/dist/{src/test → test}/setup-tests.js +0 -0
- /package/dist/{src/utils → utils}/event.js +0 -0
- /package/dist/{src/utils → utils}/fetch.js +0 -0
- /package/dist/{src/utils → utils}/index.js +0 -0
- /package/dist/{src/utils → utils}/is-empty-object.js +0 -0
- /package/dist/{src/utils → utils}/mathjs.js +0 -0
- /package/dist/{src/utils → utils}/memo.js +0 -0
- /package/dist/{src/utils → utils}/panel-refs.js +0 -0
- /package/dist/{src/utils → utils}/regexp.js +0 -0
- /package/dist/{src/utils → utils}/text.js +0 -0
- /package/dist/{src/utils → utils}/time-series-data.js +0 -0
- /package/dist/{src/utils → utils}/transform-data.js +0 -0
- /package/dist/{src/utils → utils}/types.js +0 -0
- /package/dist/{src/utils → utils}/value-mapping.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/time.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 { MAX_SIGNIFICANT_DIGITS } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\nimport { hasDecimalPlaces, limitDecimalPlaces } from './utils';\n\ntype TimeUnits = 'milliseconds' | 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' | 'years';\nexport type TimeFormatOptions = {\n unit?: TimeUnits;\n decimalPlaces?: number;\n};\nconst TIME_GROUP = 'Time';\nexport const TIME_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Time',\n decimalPlaces: true,\n};\nexport const TIME_UNIT_CONFIG: Readonly<Record<TimeUnits, UnitConfig>> = {\n milliseconds: {\n group: TIME_GROUP,\n label: 'Milliseconds',\n },\n seconds: {\n group: TIME_GROUP,\n label: 'Seconds',\n },\n minutes: {\n group: TIME_GROUP,\n label: 'Minutes',\n },\n hours: {\n group: TIME_GROUP,\n label: 'Hours',\n },\n days: {\n group: TIME_GROUP,\n label: 'Days',\n },\n weeks: {\n group: TIME_GROUP,\n label: 'Weeks',\n },\n months: {\n group: TIME_GROUP,\n label: 'Months',\n },\n years: {\n group: TIME_GROUP,\n label: 'Years',\n },\n};\n\n// Mapping of time units to what Intl.NumberFormat formatter expects\n// https://v8.dev/features/intl-numberformat#units\nexport enum PersesTimeToIntlTime {\n milliseconds = 'millisecond',\n seconds = 'second',\n minutes = 'minute',\n hours = 'hour',\n days = 'day',\n weeks = 'week',\n months = 'month',\n years = 'year',\n}\n\n/**\n * Note: This conversion will not be exactly accurate for months and years,\n * due variations in the lengths of months (i.e. 28 - 31 days) and years (i.e. leap years).\n * For precision with months and years, we would need more complex algorithms and/or external libraries.\n * However, we expect that measurements in months and years will be rare.\n */\nconst TIME_UNITS_IN_SECONDS: Record<TimeUnits, number> = {\n years: 31536000, // 365 days\n months: 2592000, // 30 days\n weeks: 604800, // 7 days\n days: 86400,\n hours: 3600,\n minutes: 60,\n seconds: 1,\n milliseconds: 0.001,\n};\n\nconst LARGEST_TO_SMALLEST_TIME_UNITS: TimeUnits[] = [\n 'years',\n 'months',\n 'weeks',\n 'days',\n 'hours',\n 'minutes',\n 'seconds',\n 'milliseconds',\n];\n\n/**\n * Choose the first time unit that produces a number greater than 1, starting from the biggest time unit.\n */\nfunction getValueAndKindForNaturalNumbers(value: number, unit: TimeUnits): { value: number; unit: TimeUnits } {\n const valueInSeconds = value * TIME_UNITS_IN_SECONDS[unit];\n\n // Initialize for TS\n const largestTimeUnit = LARGEST_TO_SMALLEST_TIME_UNITS[0] || 'years';\n let timeUnit: TimeUnits = largestTimeUnit;\n let valueInTimeUnit: number = valueInSeconds / TIME_UNITS_IN_SECONDS[largestTimeUnit];\n\n for (timeUnit of LARGEST_TO_SMALLEST_TIME_UNITS) {\n valueInTimeUnit = valueInSeconds / TIME_UNITS_IN_SECONDS[timeUnit];\n if (valueInTimeUnit >= 1) {\n return { value: valueInTimeUnit, unit: timeUnit };\n }\n }\n\n // If we didn't find a time unit, we have to settle for the smallest time unit (which is the last time unit).\n return { value: valueInTimeUnit, unit: timeUnit };\n}\n\nfunction isMonthOrYear(unit: TimeUnits): boolean {\n return unit === 'months' || unit === 'years';\n}\n\nexport function formatTime(value: number, { unit, decimalPlaces }: TimeFormatOptions): string {\n if (value === 0) return '0s';\n\n const results = getValueAndKindForNaturalNumbers(value, unit ?? 'seconds');\n\n const formatterOptions: Intl.NumberFormatOptions = {\n style: 'unit',\n unit: PersesTimeToIntlTime[results.unit],\n unitDisplay: isMonthOrYear(results.unit) ? 'long' : 'narrow',\n };\n\n if (hasDecimalPlaces(decimalPlaces)) {\n formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimalPlaces);\n formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimalPlaces);\n } else {\n formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;\n }\n\n const formatter = Intl.NumberFormat('en-US', formatterOptions);\n return formatter.format(results.value);\n}\n"],"names":["MAX_SIGNIFICANT_DIGITS","hasDecimalPlaces","limitDecimalPlaces","TIME_GROUP","TIME_GROUP_CONFIG","label","decimalPlaces","TIME_UNIT_CONFIG","milliseconds","group","seconds","minutes","hours","days","weeks","months","years","PersesTimeToIntlTime","TIME_UNITS_IN_SECONDS","LARGEST_TO_SMALLEST_TIME_UNITS","getValueAndKindForNaturalNumbers","value","unit","valueInSeconds","largestTimeUnit","timeUnit","valueInTimeUnit","isMonthOrYear","formatTime","results","formatterOptions","style","unitDisplay","minimumFractionDigits","maximumFractionDigits","maximumSignificantDigits","formatter","Intl","NumberFormat","format"],"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,sBAAsB,QAAQ,cAAc;AAErD,SAASC,gBAAgB,EAAEC,kBAAkB,QAAQ,UAAU;AAO/D,MAAMC,aAAa;AACnB,OAAO,MAAMC,oBAAqC;IAChDC,OAAO;IACPC,eAAe;AACjB,EAAE;AACF,OAAO,MAAMC,mBAA4D;IACvEC,cAAc;QACZC,OAAON;QACPE,OAAO;IACT;IACAK,SAAS;QACPD,OAAON;QACPE,OAAO;IACT;IACAM,SAAS;QACPF,OAAON;QACPE,OAAO;IACT;IACAO,OAAO;QACLH,OAAON;QACPE,OAAO;IACT;IACAQ,MAAM;QACJJ,OAAON;QACPE,OAAO;IACT;IACAS,OAAO;QACLL,OAAON;QACPE,OAAO;IACT;IACAU,QAAQ;QACNN,OAAON;QACPE,OAAO;IACT;IACAW,OAAO;QACLP,OAAON;QACPE,OAAO;IACT;AACF,EAAE;AAEF,oEAAoE;AACpE,kDAAkD;AAClD,OAAO,IAAA,AAAKY,8CAAAA;;;;;;;;;WAAAA;MASX;AAED;;;;;CAKC,GACD,MAAMC,wBAAmD;IAC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OAAOM,UAAUG,MAAM,CAACV,QAAQR,KAAK;AACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/types.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\n// Common types needed across individual unit groups and the overall combined\n// units.\n\nimport { Duration } from 'date-fns';\nimport { AbsoluteTimeRange, DurationString } from '../time';\nimport { FormatOptions } from './units';\n\nexport type UnitGroup = 'Time' | 'Percent' | 'Decimal' | 'Bytes' | 'Throughput' | 'Currency';\n\n/**\n * Configuration for rendering units that are part of a group.\n */\nexport type UnitGroupConfig = {\n /**\n * The label that is shown in the UI.\n */\n label: string;\n /**\n * When true, the unit group supports setting decimal places.\n */\n decimalPlaces?: boolean;\n /**\n * When true, the unit group supports enabling shortValues.\n */\n shortValues?: boolean;\n};\n\n/**\n * Configuration for rendering a specific unit.\n */\nexport type UnitConfig = {\n /**\n * The group the unit is part of. This will inform common rendering behavior.\n */\n group?: UnitGroup;\n\n /**\n * When true, this unit will not be displayed in the unit selector. This is\n * useful for units that are shorthand variants of other units.\n */\n disableSelectorOption?: boolean;\n\n /**\n * The label that is shown in the UI.\n */\n label: string;\n};\n\n/**\n * Used in the tests for each type of unit.\n */\nexport interface UnitTestCase {\n value: number;\n format: FormatOptions;\n expected: string;\n}\n\nexport interface IntervalTestCase {\n timeRange: AbsoluteTimeRange;\n expected: Duration;\n}\n\nexport interface FormatTestCase {\n duration: Duration;\n expected: DurationString;\n}\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,6EAA6E;AAC7E,SAAS;AA6DT,WAGC"}
|
|
@@ -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 { formatBytes, BytesFormatOptions as BytesFormatOptions, BYTES_GROUP_CONFIG, BYTES_UNIT_CONFIG } from './bytes';\nimport {\n formatDecimal,\n DecimalFormatOptions as DecimalFormatOptions,\n DECIMAL_GROUP_CONFIG,\n DECIMAL_UNIT_CONFIG,\n} from './decimal';\nimport {\n formatPercent,\n PercentFormatOptions as PercentFormatOptions,\n PERCENT_GROUP_CONFIG,\n PERCENT_UNIT_CONFIG,\n} from './percent';\nimport { formatTime, TimeFormatOptions as TimeFormatOptions, TIME_GROUP_CONFIG, TIME_UNIT_CONFIG } from './time';\nimport { UnitGroup, UnitGroupConfig, UnitConfig } from './types';\nimport {\n formatThroughput,\n THROUGHPUT_GROUP_CONFIG,\n THROUGHPUT_UNIT_CONFIG,\n ThroughputFormatOptions,\n} from './throughput';\nimport { formatCurrency, CURRENCY_GROUP_CONFIG, CURRENCY_UNIT_CONFIG, CurrencyFormatOptions } from './currency';\n\n/**\n * Most of the number formatting is based on Intl.NumberFormat, which is built into JavaScript.\n * Prefer Intl.NumbeFormat because it covers most use cases and will continue to be supported with time.\n *\n * To format bytes, we also make use of the `numbro` package,\n * because it can handle adding units like KB, MB, GB, etc. correctly.\n */\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 Throughput: THROUGHPUT_GROUP_CONFIG,\n Currency: CURRENCY_GROUP_CONFIG,\n};\nexport const UNIT_CONFIG = {\n ...TIME_UNIT_CONFIG,\n ...PERCENT_UNIT_CONFIG,\n ...DECIMAL_UNIT_CONFIG,\n ...BYTES_UNIT_CONFIG,\n ...THROUGHPUT_UNIT_CONFIG,\n ...CURRENCY_UNIT_CONFIG,\n} as const;\n\nexport type FormatOptions =\n | TimeFormatOptions\n | PercentFormatOptions\n | DecimalFormatOptions\n | BytesFormatOptions\n | ThroughputFormatOptions\n | CurrencyFormatOptions;\n\ntype HasDecimalPlaces<UnitOpt> = UnitOpt extends { decimalPlaces?: number } ? UnitOpt : never;\ntype HasShortValues<UnitOpt> = UnitOpt extends { shortValues?: boolean } ? UnitOpt : never;\n\nexport function formatValue(value: number, formatOptions?: FormatOptions): string {\n if (formatOptions === undefined) {\n return value.toString();\n }\n\n if (isBytesUnit(formatOptions)) {\n return formatBytes(value, formatOptions);\n }\n\n if (isDecimalUnit(formatOptions)) {\n return formatDecimal(value, formatOptions);\n }\n\n if (isPercentUnit(formatOptions)) {\n return formatPercent(value, formatOptions);\n }\n\n if (isTimeUnit(formatOptions)) {\n return formatTime(value, formatOptions);\n }\n\n if (isThroughputUnit(formatOptions)) {\n return formatThroughput(value, formatOptions);\n }\n\n if (isCurrencyUnit(formatOptions)) {\n return formatCurrency(value, formatOptions);\n }\n\n const exhaustive: never = formatOptions;\n throw new Error(`Unknown unit options ${exhaustive}`);\n}\n\nexport function getUnitConfig(formatOptions: FormatOptions): UnitConfig {\n const unit = formatOptions.unit ?? 'decimal';\n return UNIT_CONFIG[unit];\n}\n\nexport function getUnitGroup(formatOptions: FormatOptions): UnitGroup {\n return getUnitConfig(formatOptions).group ?? 'Decimal';\n}\n\nexport function getUnitGroupConfig(formatOptions: FormatOptions): UnitGroupConfig {\n const unitConfig = getUnitConfig(formatOptions);\n return UNIT_GROUP_CONFIG[unitConfig.group ?? 'Decimal'];\n}\n\n// Type guards\nexport function isTimeUnit(formatOptions: FormatOptions): formatOptions is TimeFormatOptions {\n return getUnitGroup(formatOptions) === 'Time';\n}\n\nexport function isPercentUnit(formatOptions: FormatOptions): formatOptions is PercentFormatOptions {\n return getUnitGroup(formatOptions) === 'Percent';\n}\n\nexport function isDecimalUnit(formatOptions: FormatOptions): formatOptions is DecimalFormatOptions {\n return getUnitGroup(formatOptions) === 'Decimal';\n}\n\nexport function isBytesUnit(formatOptions: FormatOptions): formatOptions is BytesFormatOptions {\n return getUnitGroup(formatOptions) === 'Bytes';\n}\n\nexport function isUnitWithDecimalPlaces(\n formatOptions: FormatOptions\n): formatOptions is HasDecimalPlaces<FormatOptions> {\n const groupConfig = getUnitGroupConfig(formatOptions);\n\n return !!groupConfig.decimalPlaces;\n}\n\nexport function isUnitWithShortValues(formatOptions: FormatOptions): formatOptions is HasShortValues<FormatOptions> {\n const groupConfig = getUnitGroupConfig(formatOptions);\n\n return !!groupConfig.shortValues;\n}\n\nexport function isThroughputUnit(formatOptions: FormatOptions): formatOptions is ThroughputFormatOptions {\n return getUnitGroup(formatOptions) === 'Throughput';\n}\n\nexport function isCurrencyUnit(formatOptions: FormatOptions): formatOptions is CurrencyFormatOptions {\n return getUnitGroup(formatOptions) === 'Currency';\n}\n"],"names":["formatBytes","BYTES_GROUP_CONFIG","BYTES_UNIT_CONFIG","formatDecimal","DECIMAL_GROUP_CONFIG","DECIMAL_UNIT_CONFIG","formatPercent","PERCENT_GROUP_CONFIG","PERCENT_UNIT_CONFIG","formatTime","TIME_GROUP_CONFIG","TIME_UNIT_CONFIG","formatThroughput","THROUGHPUT_GROUP_CONFIG","THROUGHPUT_UNIT_CONFIG","formatCurrency","CURRENCY_GROUP_CONFIG","CURRENCY_UNIT_CONFIG","UNIT_GROUP_CONFIG","Time","Percent","Decimal","Bytes","Throughput","Currency","UNIT_CONFIG","formatValue","value","formatOptions","undefined","toString","isBytesUnit","isDecimalUnit","isPercentUnit","isTimeUnit","isThroughputUnit","isCurrencyUnit","exhaustive","Error","getUnitConfig","unit","getUnitGroup","group","getUnitGroupConfig","unitConfig","isUnitWithDecimalPlaces","groupConfig","decimalPlaces","isUnitWithShortValues","shortValues"],"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,WAAW,EAA4CC,kBAAkB,EAAEC,iBAAiB,QAAQ,UAAU;AACvH,SACEC,aAAa,EAEbC,oBAAoB,EACpBC,mBAAmB,QACd,YAAY;AACnB,SACEC,aAAa,EAEbC,oBAAoB,EACpBC,mBAAmB,QACd,YAAY;AACnB,SAASC,UAAU,EAA0CC,iBAAiB,EAAEC,gBAAgB,QAAQ,SAAS;AAEjH,SACEC,gBAAgB,EAChBC,uBAAuB,EACvBC,sBAAsB,QAEjB,eAAe;AACtB,SAASC,cAAc,EAAEC,qBAAqB,EAAEC,oBAAoB,QAA+B,aAAa;AAEhH;;;;;;CAMC,GAED,OAAO,MAAMC,oBAAkE;IAC7EC,MAAMT;IACNU,SAASb;IACTc,SAASjB;IACTkB,OAAOrB;IACPsB,YAAYV;IACZW,UAAUR;AACZ,EAAE;AACF,OAAO,MAAMS,cAAc;IACzB,GAAGd,gBAAgB;IACnB,GAAGH,mBAAmB;IACtB,GAAGH,mBAAmB;IACtB,GAAGH,iBAAiB;IACpB,GAAGY,sBAAsB;IACzB,GAAGG,oBAAoB;AACzB,EAAW;AAaX,OAAO,SAASS,YAAYC,KAAa,EAAEC,aAA6B;IACtE,IAAIA,kBAAk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AEA,OAAO,SAASC,sBAAsBpB,aAA4B;IAChE,MAAMkB,cAAcH,mBAAmBf;IAEvC,OAAO,CAAC,CAACkB,YAAYG,WAAW;AAClC;AAEA,OAAO,SAASd,iBAAiBP,aAA4B;IAC3D,OAAOa,aAAab,mBAAmB;AACzC;AAEA,OAAO,SAASQ,eAAeR,aAA4B;IACzD,OAAOa,aAAab,mBAAmB;AACzC"}
|
|
@@ -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 shouldShortenValues(shortValues?: boolean): boolean {\n return shortValues !== false;\n}\n\nexport function hasDecimalPlaces(decimalPlaces?: number): boolean {\n return typeof decimalPlaces === '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): number | undefined {\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":["shouldShortenValues","shortValues","hasDecimalPlaces","decimalPlaces","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,oBAAoBC,WAAqB;IACvD,OAAOA,gBAAgB;AACzB;AAEA,OAAO,SAASC,iBAAiBC,aAAsB;IACrD,OAAO,OAAOA,kBAAkB;AAClC;AAEA,mDAAmD;AACnD,8BAA8B;AAC9B,wIAAwI;AACxI,OAAO,SAASC,mBAAmBC,GAAY;IAC7C,IAAI,CAACA,KAAK,OAAOA;IAEjB,IAAIA,MAAM,GAAG;QACXA,MAAM;IACR,OAAO,IAAIA,MAAM,IAAI;QACnBA,MAAM;IACR;IAEA,OAAOA;AACT"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/user.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 { Metadata } from './resource';\n\nexport interface NativeProvider {\n password?: string;\n}\n\nexport interface OAuthProvider {\n issuer?: string;\n email?: string;\n subject?: string;\n}\n\nexport interface UserSpec {\n firstName?: string;\n lastName?: string;\n nativeProvider?: NativeProvider;\n oauthProviders?: OAuthProvider[];\n}\n\nexport interface UserResource {\n kind: 'User';\n metadata: Metadata;\n spec: UserSpec;\n}\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;AAqBjC,WAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/value-mapping.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 type ValueMapping =\n | ValueMappingOptions\n | ValueMappingOptionsRange\n | ValueMappingOptionsRegex\n | ValueMappingOptionsMisc;\n\nexport interface ValueMappingOptions {\n kind: 'Value';\n spec: {\n value: string | number;\n result: MappedValue;\n };\n}\n\nexport interface ValueMappingOptionsRange {\n kind: 'Range';\n spec: {\n from?: number;\n to?: number;\n result: MappedValue;\n };\n}\n\nexport interface ValueMappingOptionsRegex {\n kind: 'Regex';\n spec: {\n pattern: string;\n result: MappedValue;\n };\n}\n\nexport interface ValueMappingOptionsMisc {\n kind: 'Misc';\n spec: {\n value: 'empty' | 'null' | 'NaN' | 'true' | 'false';\n result: MappedValue;\n };\n}\n\nexport interface MappedValue {\n value: number | string;\n color?: string;\n}\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;AAyCjC,WAGC"}
|
|
@@ -0,0 +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';\nimport { Metadata, ProjectMetadata } from './resource';\n\nexport type VariableName = string;\n\nexport type VariableValue = string | string[] | null;\n\nexport interface VariableDisplay extends Display {\n hidden?: boolean;\n}\n\nexport interface VariableSpec {\n name: VariableName;\n display?: VariableDisplay;\n}\n\nexport interface TextVariableDefinition extends Definition<TextVariableSpec> {\n kind: 'TextVariable';\n}\n\nexport interface TextVariableSpec extends VariableSpec {\n value: string;\n constant?: boolean;\n}\n\nexport interface ListVariableDefinition extends Definition<ListVariableSpec> {\n kind: 'ListVariable';\n}\n\nexport interface ListVariableSpec<PluginSpec = UnknownSpec> extends VariableSpec {\n defaultValue?: VariableValue;\n allowMultiple: boolean;\n allowAllValue: boolean;\n customAllValue?: string;\n capturingRegexp?: string;\n sort?: string;\n plugin: Definition<PluginSpec>;\n}\n\nexport interface BuiltinVariableDefinition extends Definition<BuiltinVariableSpec> {\n kind: 'BuiltinVariable';\n}\n\nexport interface BuiltinVariableSpec extends VariableSpec {\n value: () => string;\n source: string;\n}\n\nexport type VariableDefinition = TextVariableDefinition | ListVariableDefinition;\n\n/**\n * A variable that belongs to a project.\n */\nexport interface VariableResource {\n kind: 'Variable';\n metadata: ProjectMetadata;\n spec: VariableDefinition;\n}\n\n/**\n * A global variable that doesn´t belong to a project.\n */\nexport interface GlobalVariableResource {\n kind: 'GlobalVariable';\n metadata: Metadata;\n spec: VariableDefinition;\n}\n\nexport type Variable = VariableResource | GlobalVariableResource;\n\nexport function getVariableProject(variable: Variable): string | undefined {\n return 'project' in variable.metadata ? variable.metadata.project : undefined;\n}\n\nexport const DEFAULT_ALL_VALUE = '$__all' as const;\n"],"names":["getVariableProject","variable","metadata","project","undefined","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;AAyEjC,OAAO,SAASA,mBAAmBC,QAAkB;IACnD,OAAO,aAAaA,SAASC,QAAQ,GAAGD,SAASC,QAAQ,CAACC,OAAO,GAAGC;AACtE;AAEA,OAAO,MAAMC,oBAAoB,SAAkB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/datasource.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 { Datasource, DatasourceDefinition, DatasourceSpec } from '../model';\nimport { metadataSchema, projectMetadataSchema } from './metadata';\nimport { PluginSchema, pluginSchema } from './plugin';\nimport { displaySchema } from './display';\n\nexport const datasourceSpecSchema: z.ZodSchema<DatasourceSpec> = z.object({\n display: displaySchema.optional(),\n default: z.boolean(),\n plugin: pluginSchema,\n});\n\nexport function buildDatasourceSpecSchema(pluginSchema: PluginSchema): z.ZodSchema<DatasourceSpec> {\n return z.object({\n display: displaySchema.optional(),\n default: z.boolean(),\n plugin: pluginSchema,\n });\n}\n\nexport const datasourceSchema = z.object({\n kind: z.literal('Datasource'),\n metadata: projectMetadataSchema,\n spec: datasourceSpecSchema,\n});\n\nexport const globalDatasourceSchema = z.object({\n kind: z.literal('GlobalDatasource'),\n metadata: metadataSchema,\n spec: datasourceSpecSchema,\n});\n\nexport const datasourcesSchema: z.Schema<Datasource> = z.discriminatedUnion('kind', [\n datasourceSchema,\n globalDatasourceSchema,\n]);\n\nexport const datasourceDefinitionSchema: z.Schema<DatasourceDefinition> = z.object({\n name: z.string().min(1),\n spec: datasourceSpecSchema,\n});\n\nexport function buildDatasourceDefinitionSchema(pluginSchema: PluginSchema): z.Schema<DatasourceDefinition> {\n return z.object({\n name: z.string().min(1),\n spec: buildDatasourceSpecSchema(pluginSchema),\n });\n}\n"],"names":["z","metadataSchema","projectMetadataSchema","pluginSchema","displaySchema","datasourceSpecSchema","object","display","optional","default","boolean","plugin","buildDatasourceSpecSchema","datasourceSchema","kind","literal","metadata","spec","globalDatasourceSchema","datasourcesSchema","discriminatedUnion","datasourceDefinitionSchema","name","string","min","buildDatasourceDefinitionSchema"],"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;AAExB,SAASC,cAAc,EAAEC,qBAAqB,QAAQ,aAAa;AACnE,SAAuBC,YAAY,QAAQ,WAAW;AACtD,SAASC,aAAa,QAAQ,YAAY;AAE1C,OAAO,MAAMC,uBAAoDL,EAAEM,MAAM,CAAC;IACxEC,SAASH,cAAcI,QAAQ;IAC/BC,SAAST,EAAEU,OAAO;IAClBC,QAAQR;AACV,GAAG;AAEH,OAAO,SAASS,0BAA0BT,YAA0B;IAClE,OAAOH,EAAEM,MAAM,CAAC;QACdC,SAASH,cAAcI,QAAQ;QAC/BC,SAAST,EAAEU,OAAO;QAClBC,QAAQR;IACV;AACF;AAEA,OAAO,MAAMU,mBAAmBb,EAAEM,MAAM,CAAC;IACvCQ,MAAMd,EAAEe,OAAO,CAAC;IAChBC,UAAUd;IACVe,MAAMZ;AACR,GAAG;AAEH,OAAO,MAAMa,yBAAyBlB,EAAEM,MAAM,CAAC;IAC7CQ,MAAMd,EAAEe,OAAO,CAAC;IAChBC,UAAUf;IACVgB,MAAMZ;AACR,GAAG;AAEH,OAAO,MAAMc,oBAA0CnB,EAAEoB,kBAAkB,CAAC,QAAQ;IAClFP;IACAK;CACD,EAAE;AAEH,OAAO,MAAMG,6BAA6DrB,EAAEM,MAAM,CAAC;IACjFgB,MAAMtB,EAAEuB,MAAM,GAAGC,GAAG,CAAC;IACrBP,MAAMZ;AACR,GAAG;AAEH,OAAO,SAASoB,gCAAgCtB,YAA0B;IACxE,OAAOH,EAAEM,MAAM,CAAC;QACdgB,MAAMtB,EAAEuB,MAAM,GAAGC,GAAG,CAAC;QACrBP,MAAML,0BAA0BT;IAClC;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/display.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 { z } from 'zod';\n\nexport const displaySchema = z.object({\n name: z.string().optional(),\n description: z.string().optional(),\n});\n"],"names":["z","displaySchema","object","name","string","optional","description"],"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;AAExB,OAAO,MAAMC,gBAAgBD,EAAEE,MAAM,CAAC;IACpCC,MAAMH,EAAEI,MAAM,GAAGC,QAAQ;IACzBC,aAAaN,EAAEI,MAAM,GAAGC,QAAQ;AAClC,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/duration.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 { z } from 'zod';\nimport { DURATION_REGEX } from '../model';\n\nexport const durationValidationSchema = z\n .string()\n .min(1, 'Required')\n .regex(DURATION_REGEX, 'Must be a valid duration string');\n"],"names":["z","DURATION_REGEX","durationValidationSchema","string","min","regex"],"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;AACxB,SAASC,cAAc,QAAQ,WAAW;AAE1C,OAAO,MAAMC,2BAA2BF,EACrCG,MAAM,GACNC,GAAG,CAAC,GAAG,YACPC,KAAK,CAACJ,gBAAgB,mCAAmC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/index.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 * from './datasource';\nexport * from './display';\nexport * from './duration';\nexport * from './metadata';\nexport * from './panel';\nexport * from './plugin';\nexport * from './role';\nexport * from './rolebinding';\nexport * from './secret';\nexport * from './user';\nexport * from './variable';\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,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,aAAa;AAC3B,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,gBAAgB;AAC9B,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,aAAa"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/metadata.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 { z } from 'zod';\n\nexport const nameSchema = z\n .string()\n .min(1, 'Required')\n .max(75, 'Must be 75 or fewer characters long')\n .regex(/^[a-zA-Z0-9_.-]+$/, 'Must only contains alphanumerical characters and special characters _ . -');\n\nexport const metadataSchema = z.object({\n name: nameSchema,\n});\n\nexport const projectMetadataSchema = metadataSchema.extend({\n project: nameSchema,\n});\n"],"names":["z","nameSchema","string","min","max","regex","metadataSchema","object","name","projectMetadataSchema","extend","project"],"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;AAExB,OAAO,MAAMC,aAAaD,EACvBE,MAAM,GACNC,GAAG,CAAC,GAAG,YACPC,GAAG,CAAC,IAAI,uCACRC,KAAK,CAAC,qBAAqB,6EAA6E;AAE3G,OAAO,MAAMC,iBAAiBN,EAAEO,MAAM,CAAC;IACrCC,MAAMP;AACR,GAAG;AAEH,OAAO,MAAMQ,wBAAwBH,eAAeI,MAAM,CAAC;IACzDC,SAASV;AACX,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/panel.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 { z } from 'zod';\nimport { Link, PanelDefinition, PanelDisplay, PanelEditorValues, PanelSpec, QueryDefinition } from '../model';\nimport { PluginSchema, pluginSchema } from './plugin';\n\nexport const panelDisplaySpec: z.ZodSchema<PanelDisplay> = z.object({\n name: z.string().min(1, { message: 'Required' }),\n description: z.string().optional(),\n});\n\nexport const querySpecSchema: z.ZodSchema<QueryDefinition> = z.object({\n kind: z.string().min(1),\n spec: z.object({\n plugin: pluginSchema,\n }),\n});\n\nexport const linkSchema: z.ZodSchema<Link> = z.object({\n name: z.string().optional(),\n url: z.string().min(1),\n tooltip: z.string().optional(),\n renderVariables: z.boolean().optional(),\n targetBlank: z.boolean().optional(),\n});\n\nexport const panelSpecSchema: z.ZodSchema<PanelSpec> = z.object({\n display: panelDisplaySpec,\n plugin: pluginSchema,\n queries: z.array(querySpecSchema).optional(),\n links: z.array(linkSchema).optional(),\n});\n\nexport function buildPanelSpecSchema(pluginSchema: PluginSchema): z.ZodSchema<PanelSpec> {\n return z.object({\n display: panelDisplaySpec,\n plugin: pluginSchema,\n queries: z.array(querySpecSchema).optional(),\n links: z.array(linkSchema).optional(),\n });\n}\n\nexport const panelDefinitionSchema: z.ZodSchema<PanelDefinition> = z.object({\n kind: z.literal('Panel'),\n spec: panelSpecSchema,\n});\n\nexport function buildPanelDefinitionSchema(pluginSchema: PluginSchema): z.ZodSchema<PanelDefinition> {\n return z.object({\n kind: z.literal('Panel'),\n spec: buildPanelSpecSchema(pluginSchema),\n });\n}\n\nexport const panelEditorSchema: z.ZodSchema<PanelEditorValues> = z.object({\n groupId: z.number(),\n panelDefinition: panelDefinitionSchema,\n});\n\nexport function buildPanelEditorSchema(pluginSchema: PluginSchema): z.ZodSchema<PanelEditorValues> {\n return z.object({\n groupId: z.number(),\n panelDefinition: buildPanelDefinitionSchema(pluginSchema),\n });\n}\n"],"names":["z","pluginSchema","panelDisplaySpec","object","name","string","min","message","description","optional","querySpecSchema","kind","spec","plugin","linkSchema","url","tooltip","renderVariables","boolean","targetBlank","panelSpecSchema","display","queries","array","links","buildPanelSpecSchema","panelDefinitionSchema","literal","buildPanelDefinitionSchema","panelEditorSchema","groupId","number","panelDefinition","buildPanelEditorSchema"],"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;AAExB,SAAuBC,YAAY,QAAQ,WAAW;AAEtD,OAAO,MAAMC,mBAA8CF,EAAEG,MAAM,CAAC;IAClEC,MAAMJ,EAAEK,MAAM,GAAGC,GAAG,CAAC,GAAG;QAAEC,SAAS;IAAW;IAC9CC,aAAaR,EAAEK,MAAM,GAAGI,QAAQ;AAClC,GAAG;AAEH,OAAO,MAAMC,kBAAgDV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;IAC/D,OAAOD,EAAEG,MAAM,CAAC;QACd2B,SAAS9B,EAAE+B,MAAM;QACjBC,iBAAiBJ,2BAA2B3B;IAC9C;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/plugin.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 { z } from 'zod';\n\nexport const pluginSchema = z.object({\n kind: z.string().min(1, 'Required'),\n spec: z.record(z.string(), z.any()),\n});\n\nexport type PluginSchemaType = z.infer<typeof pluginSchema>;\nexport type PluginSchema = typeof pluginSchema;\n"],"names":["z","pluginSchema","object","kind","string","min","spec","record","any"],"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;AAExB,OAAO,MAAMC,eAAeD,EAAEE,MAAM,CAAC;IACnCC,MAAMH,EAAEI,MAAM,GAAGC,GAAG,CAAC,GAAG;IACxBC,MAAMN,EAAEO,MAAM,CAACP,EAAEI,MAAM,IAAIJ,EAAEQ,GAAG;AAClC,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/role.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 { Permission, Role, RoleSpec } from '../model';\nimport { metadataSchema, projectMetadataSchema } from './metadata';\n\nexport const permissionSchema: z.ZodSchema<Permission> = z.object({\n // TODO: use SCOPE & ACTIONS constants\n actions: z.array(z.enum(['*', 'create', 'read', 'update', 'delete'])).nonempty('Must contains at least 1 action'),\n scopes: z\n .array(\n z.enum([\n '*',\n 'Dashboard',\n 'Datasource',\n 'EphemeralDashboard',\n 'Folder',\n 'GlobalDatasource',\n 'GlobalRole',\n 'GlobalRoleBinding',\n 'GlobalSecret',\n 'GlobalVariable',\n 'Project',\n 'Role',\n 'RoleBinding',\n 'Secret',\n 'User',\n 'Variable',\n ])\n )\n .nonempty('Must contains at least 1 scope'), // TODO: limit project role\n});\n\nexport const roleSpecSchema: z.ZodSchema<RoleSpec> = z.object({\n permissions: z.array(permissionSchema),\n});\n\nexport const roleSchema = z.object({\n kind: z.literal('Role'),\n metadata: projectMetadataSchema,\n spec: roleSpecSchema,\n});\n\nexport const globalRoleSchema = z.object({\n kind: z.literal('GlobalRole'),\n metadata: metadataSchema,\n spec: roleSpecSchema,\n});\n\nexport const rolesEditorSchema: z.ZodSchema<Role> = z.discriminatedUnion('kind', [roleSchema, globalRoleSchema]);\n"],"names":["z","metadataSchema","projectMetadataSchema","permissionSchema","object","actions","array","enum","nonempty","scopes","roleSpecSchema","permissions","roleSchema","kind","literal","metadata","spec","globalRoleSchema","rolesEditorSchema","discriminatedUnion"],"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;AAExB,SAASC,cAAc,EAAEC,qBAAqB,QAAQ,aAAa;AAEnE,OAAO,MAAMC,mBAA4CH,EAAEI,MAAM,CAAC;IAChE,sCAAsC;IACtCC,SAASL,EAAEM,KAAK,CAACN,EAAEO,IAAI,CAAC;QAAC;QAAK;QAAU;QAAQ;QAAU;KAAS,GAAGC,QAAQ,CAAC;IAC/EC,QAAQT,EACLM,KAAK,CACJN,EAAEO,IAAI,CAAC;QACL;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;KACD,GAEFC,QAAQ,CAAC;AACd,GAAG;AAEH,OAAO,MAAME,iBAAwCV,EAAEI,MAAM,CAAC;IAC5DO,aAAaX,EAAEM,KAAK,CAACH;AACvB,GAAG;AAEH,OAAO,MAAMS,aAAaZ,EAAEI,MAAM,CAAC;IACjCS,MAAMb,EAAEc,OAAO,CAAC;IAChBC,UAAUb;IACVc,MAAMN;AACR,GAAG;AAEH,OAAO,MAAMO,mBAAmBjB,EAAEI,MAAM,CAAC;IACvCS,MAAMb,EAAEc,OAAO,CAAC;IAChBC,UAAUd;IACVe,MAAMN;AACR,GAAG;AAEH,OAAO,MAAMQ,oBAAuClB,EAAEmB,kBAAkB,CAAC,QAAQ;IAACP;IAAYK;CAAiB,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/rolebinding.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 { RoleBinding, RoleBindingSpec, Subject } from '../model';\nimport { nameSchema, metadataSchema, projectMetadataSchema } from './metadata';\n\nexport const subjectSchema: z.ZodSchema<Subject> = z.object({\n kind: z.enum(['User']),\n name: nameSchema,\n});\n\nexport const roleBindingSpecSchema: z.ZodSchema<RoleBindingSpec> = z.object({\n role: nameSchema,\n subjects: z.array(subjectSchema).nonempty(),\n});\n\nexport const roleBindingSchema = z.object({\n kind: z.literal('RoleBinding'),\n metadata: projectMetadataSchema,\n spec: roleBindingSpecSchema,\n});\n\nexport const globalRoleBindingSchema = z.object({\n kind: z.literal('GlobalRoleBinding'),\n metadata: metadataSchema,\n spec: roleBindingSpecSchema,\n});\n\nexport const roleBindingsEditorSchema: z.ZodSchema<RoleBinding> = z.discriminatedUnion('kind', [\n roleBindingSchema,\n globalRoleBindingSchema,\n]);\n"],"names":["z","nameSchema","metadataSchema","projectMetadataSchema","subjectSchema","object","kind","enum","name","roleBindingSpecSchema","role","subjects","array","nonempty","roleBindingSchema","literal","metadata","spec","globalRoleBindingSchema","roleBindingsEditorSchema","discriminatedUnion"],"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;AAExB,SAASC,UAAU,EAAEC,cAAc,EAAEC,qBAAqB,QAAQ,aAAa;AAE/E,OAAO,MAAMC,gBAAsCJ,EAAEK,MAAM,CAAC;IAC1DC,MAAMN,EAAEO,IAAI,CAAC;QAAC;KAAO;IACrBC,MAAMP;AACR,GAAG;AAEH,OAAO,MAAMQ,wBAAsDT,EAAEK,MAAM,CAAC;IAC1EK,MAAMT;IACNU,UAAUX,EAAEY,KAAK,CAACR,eAAeS,QAAQ;AAC3C,GAAG;AAEH,OAAO,MAAMC,oBAAoBd,EAAEK,MAAM,CAAC;IACxCC,MAAMN,EAAEe,OAAO,CAAC;IAChBC,UAAUb;IACVc,MAAMR;AACR,GAAG;AAEH,OAAO,MAAMS,0BAA0BlB,EAAEK,MAAM,CAAC;IAC9CC,MAAMN,EAAEe,OAAO,CAAC;IAChBC,UAAUd;IACVe,MAAMR;AACR,GAAG;AAEH,OAAO,MAAMU,2BAAqDnB,EAAEoB,kBAAkB,CAAC,QAAQ;IAC7FN;IACAI;CACD,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/secret.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 { metadataSchema, projectMetadataSchema } from './metadata';\n\nexport const secretSpecSchema = z\n .object({\n basicAuth: z\n .object({\n username: z.string().min(1),\n password: z.string().optional(),\n passwordFile: z.string().optional(),\n })\n .superRefine((val, ctx) => {\n if (val.password && val.password.length > 0 && val.passwordFile && val.passwordFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['password'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['passwordFile'],\n });\n }\n })\n .optional(),\n authorization: z\n .object({\n type: z.string().optional(),\n credentials: z.string().optional(),\n credentialsFile: z.string().optional(),\n })\n .superRefine((val, ctx) => {\n if (val.credentials && val.credentials.length > 0 && val.credentialsFile && val.credentialsFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['credentials'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['credentialsFile'],\n });\n }\n })\n .optional(),\n oauth: z\n .object({\n clientID: z.string().min(1),\n clientSecret: z.string().optional(),\n clientSecretFile: z.string().optional(),\n tokenURL: z.string().min(1),\n scopes: z.array(z.string().nonempty()).default([]),\n endpointParams: z.record(z.string().nonempty(), z.array(z.string())).default({}).optional(),\n authStyle: z.union([z.literal(0), z.literal(1), z.literal(2)]).optional(),\n })\n .superRefine((val, ctx) => {\n if (\n val.clientSecret &&\n val.clientSecret.length > 0 &&\n val.clientSecretFile &&\n val.clientSecretFile.length > 0\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['clientSecret'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['clientSecretFile'],\n });\n }\n })\n .optional(),\n tlsConfig: z\n .object({\n ca: z.string().optional(),\n cert: z.string().optional(),\n key: z.string().optional(),\n caFile: z.string().optional(),\n certFile: z.string().optional(),\n keyFile: z.string().optional(),\n serverName: z.string().optional(),\n insecureSkipVerify: z.boolean().optional(),\n })\n .superRefine((val, ctx) => {\n if (val.ca && val.ca.length > 0 && val.caFile && val.caFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['ca'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['caFile'],\n });\n }\n\n if (val.cert && val.cert.length > 0 && val.certFile && val.certFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['cert'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['certFile'],\n });\n }\n\n if (val.key && val.key.length > 0 && val.keyFile && val.keyFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['key'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['keyFile'],\n });\n }\n })\n .optional(),\n })\n .superRefine((val, ctx) => {\n if (val.basicAuth && val.authorization && val.oauth) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['basicAuth'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['authorization'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['oauth'],\n });\n }\n });\n\nexport const secretSchema = z.object({\n kind: z.literal('Secret'),\n metadata: projectMetadataSchema,\n spec: secretSpecSchema,\n});\n\nexport const globalSecretSchema = z.object({\n kind: z.literal('GlobalSecret'),\n metadata: metadataSchema,\n spec: secretSpecSchema,\n});\n\nexport const secretsEditorSchema = z.discriminatedUnion('kind', [secretSchema, globalSecretSchema]);\n\nexport type SecretsEditorSchemaType = z.infer<typeof secretsEditorSchema>;\n"],"names":["z","metadataSchema","projectMetadataSchema","secretSpecSchema","object","basicAuth","username","string","min","password","optional","passwordFile","superRefine","val","ctx","length","addIssue","code","ZodIssueCode","custom","message","path","authorization","type","credentials","credentialsFile","oauth","clientID","clientSecret","clientSecretFile","tokenURL","scopes","array","nonempty","default","endpointParams","record","authStyle","union","literal","tlsConfig","ca","cert","key","caFile","certFile","keyFile","serverName","insecureSkipVerify","boolean","secretSchema","kind","metadata","spec","globalSecretSchema","secretsEditorSchema","discriminatedUnion"],"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;AACxB,SAASC,cAAc,EAAEC,qBAAqB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EAAEkB,YAAY,CAACC,MAAM;gBAC3BC,SAAS;gBACTC,MAAM;oBAAC;iBAAM;YACf;YACAP,IAAIE,QAAQ,CAAC;gBACXC,MAAMjB,EAAEkB,YAAY,CAACC,MAAM;gBAC3BC,SAAS;gBACTC,MAAM;oBAAC;iBAAU;YACnB;QACF;IACF,GACCX,QAAQ;AACb,GACCE,WAAW,CAAC,CAACC,KAAKC;IACjB,IAAID,IAAIR,SAAS,IAAIQ,IAAIS,aAAa,IAAIT,IAAIa,KAAK,EAAE;QACnDZ,IAAIE,QAAQ,CAAC;YACXC,MAAMjB,EAAEkB,YAAY,CAACC,MAAM;YAC3BC,SAAS;YACTC,MAAM;gBAAC;aAAY;QACrB;QACAP,IAAIE,QAAQ,CAAC;YACXC,MAAMjB,EAAEkB,YAAY,CAACC,MAAM;YAC3BC,SAAS;YACTC,MAAM;gBAAC;aAAgB;QACzB;QACAP,IAAIE,QAAQ,CAAC;YACXC,MAAMjB,EAAEkB,YAAY,CAACC,MAAM;YAC3BC,SAAS;YACTC,MAAM;gBAAC;aAAQ;QACjB;IACF;AACF,GAAG;AAEL,OAAO,MAAM6B,eAAelD,EAAEI,MAAM,CAAC;IACnC+C,MAAMnD,EAAEuC,OAAO,CAAC;IAChBa,UAAUlD;IACVmD,MAAMlD;AACR,GAAG;AAEH,OAAO,MAAMmD,qBAAqBtD,EAAEI,MAAM,CAAC;IACzC+C,MAAMnD,EAAEuC,OAAO,CAAC;IAChBa,UAAUnD;IACVoD,MAAMlD;AACR,GAAG;AAEH,OAAO,MAAMoD,sBAAsBvD,EAAEwD,kBAAkB,CAAC,QAAQ;IAACN;IAAcI;CAAmB,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/schema/user.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 { NativeProvider, OAuthProvider, UserResource, UserSpec } from '../model';\nimport { metadataSchema } from './metadata';\n\nexport const nativeProviderSchema: z.Schema<NativeProvider> = z.object({\n password: z.string().optional(),\n});\n\nexport const oauthProvidersSchema: z.ZodSchema<OAuthProvider> = z.object({\n issuer: z.string().optional(),\n email: z.string().optional(),\n subject: z.string().optional(),\n});\n\n// TODO: handle exclusion native / oauth?\nexport const userSpecSchema: z.ZodSchema<UserSpec> = z.object({\n firstName: z.string().optional(),\n lastName: z.string().optional(),\n nativeProvider: nativeProviderSchema.optional(),\n oauthProviders: z.array(oauthProvidersSchema).optional(),\n});\n\nexport const userSchema: z.ZodSchema<UserResource> = z.object({\n kind: z.literal('User'),\n metadata: metadataSchema,\n spec: userSpecSchema,\n});\n\nexport type UserEditorSchemaType = z.infer<typeof userSchema>;\n"],"names":["z","metadataSchema","nativeProviderSchema","object","password","string","optional","oauthProvidersSchema","issuer","email","subject","userSpecSchema","firstName","lastName","nativeProvider","oauthProviders","array","userSchema","kind","literal","metadata","spec"],"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;AAExB,SAASC,cAAc,QAAQ,aAAa;AAE5C,OAAO,MAAMC,uBAAiDF,EAAEG,MAAM,CAAC;IACrEC,UAAUJ,EAAEK,MAAM,GAAGC,QAAQ;AAC/B,GAAG;AAEH,OAAO,MAAMC,uBAAmDP,EAAEG,MAAM,CAAC;IACvEK,QAAQR,EAAEK,MAAM,GAAGC,QAAQ;IAC3BG,OAAOT,EAAEK,MAAM,GAAGC,QAAQ;IAC1BI,SAASV,EAAEK,MAAM,GAAGC,QAAQ;AAC9B,GAAG;AAEH,yCAAyC;AACzC,OAAO,MAAMK,iBAAwCX,EAAEG,MAAM,CAAC;IAC5DS,WAAWZ,EAAEK,MAAM,GAAGC,QAAQ;IAC9BO,UAAUb,EAAEK,MAAM,GAAGC,QAAQ;IAC7BQ,gBAAgBZ,qBAAqBI,QAAQ;IAC7CS,gBAAgBf,EAAEgB,KAAK,CAACT,sBAAsBD,QAAQ;AACxD,GAAG;AAEH,OAAO,MAAMW,aAAwCjB,EAAEG,MAAM,CAAC;IAC5De,MAAMlB,EAAEmB,OAAO,CAAC;IAChBC,UAAUnB;IACVoB,MAAMV;AACR,GAAG"}
|
|
@@ -0,0 +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(),\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,GA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|
1
|
+
{"version":3,"sources":["../../src/test/setup-tests.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\n// Add testing library assertions\nimport '@testing-library/jest-dom/extend-expect';\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,iCAAiC;AACjC,OAAO,0CAA0C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/event.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 { useRef, useLayoutEffect, useCallback } from 'react';\n\n/**\n * A (temporary) userland implementation of `useEvent` from this React RFC: https://github.com/reactjs/rfcs/pull/220.\n *\n * Typically useful for getting a stable reference to an \"event\" function (i.e. one that isn't called during render\n * but is called later in a useEffect or event handler) that accesses state or props.\n */\nexport function useEvent<T extends unknown[], U>(handler: (...args: T) => U): (...args: T) => U {\n const handlerRef = useRef(handler);\n useLayoutEffect(() => {\n handlerRef.current = handler;\n });\n\n return useCallback((...args) => handlerRef.current(...args), []);\n}\n"],"names":["useRef","useLayoutEffect","useCallback","useEvent","handler","handlerRef","current","args"],"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,MAAM,EAAEC,eAAe,EAAEC,WAAW,QAAQ,QAAQ;AAE7D;;;;;CAKC,GACD,OAAO,SAASC,SAAiCC,OAA0B;IACzE,MAAMC,aAAaL,OAAOI;IAC1BH,gBAAgB;QACdI,WAAWC,OAAO,GAAGF;IACvB;IAEA,OAAOF,YAAY,CAAC,GAAGK,OAASF,WAAWC,OAAO,IAAIC,OAAO,EAAE;AACjE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/fetch.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\n/**\n * Calls `global.fetch` and determines which type of error to show for non-200 responses.\n */\nexport async function fetch(...args: Parameters<typeof global.fetch>): Promise<Response> {\n const response = await global.fetch(...args);\n if (response.ok === false) {\n const contentType = response.headers.get('content-type');\n if (contentType?.includes('application/json')) {\n const json = await response.clone().json();\n if (json.error) {\n throw new UserFriendlyError(json.error, response.status);\n }\n if (json.message) {\n throw new UserFriendlyError(json.message, response.status);\n }\n }\n\n const text = await response.clone().text();\n if (text) {\n throw new UserFriendlyError(text, response.status);\n }\n throw new FetchError(response);\n }\n return response;\n}\n\n/**\n * Calls `global.fetch` and throws a `FetchError` on non-200 responses, but also\n * decodes the response body as JSON, casting it to type `T`. Returns the\n * decoded body.\n */\nexport async function fetchJson<T>(...args: Parameters<typeof global.fetch>): Promise<T> {\n const response = await fetch(...args);\n if (!response.ok) {\n throw new FetchError(response);\n }\n return await response.json();\n}\n\nexport interface StatusError extends Error {\n status: number;\n}\n\n/**\n * Error thrown when fetch returns a non-200 response.\n */\nexport class FetchError extends Error implements StatusError {\n status: number;\n constructor(response: Readonly<Response>) {\n super(`${response.status} ${response.statusText}`);\n this.status = response.status;\n Object.setPrototypeOf(this, FetchError.prototype);\n }\n}\n\n/**\n * General error type for an error that has a message that is OK to show to the end user.\n */\nexport class UserFriendlyError extends Error implements StatusError {\n status: number;\n constructor(message: string, status: number) {\n super(message);\n this.status = status;\n Object.setPrototypeOf(this, UserFriendlyError.prototype);\n }\n}\n"],"names":["fetch","args","response","global","ok","contentType","headers","get","includes","json","clone","error","UserFriendlyError","status","message","text","FetchError","fetchJson","Error","constructor","statusText","Object","setPrototypeOf","prototype"],"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;;CAEC,GACD,OAAO,eAAeA,MAAM,GAAGC,IAAqC;IAClE,MAAMC,WAAW,MAAMC,OAAOH,KAAK,IAAIC;IACvC,IAAIC,SAASE,EAAE,KAAK,OAAO;QACzB,MAAMC,cAAcH,SAASI,OAAO,CAACC,GAAG,CAAC;QACzC,IAAIF,aAAaG,SAAS,qBAAqB;YAC7C,MAAMC,OAAO,MAAMP,SAASQ,KAAK,GAAGD,IAAI;YACxC,IAAIA,KAAKE,KAAK,EAAE;gBACd,MAAM,IAAIC,kBAAkBH,KAAKE,KAAK,EAAET,SAASW,MAAM;YACzD;YACA,IAAIJ,KAAKK,OAAO,EAAE;gBAChB,MAAM,IAAIF,kBAAkBH,KAAKK,OAAO,EAAEZ,SAASW,MAAM;YAC3D;QACF;QAEA,MAAME,OAAO,MAAMb,SAASQ,KAAK,GAAGK,IAAI;QACxC,IAAIA,MAAM;YACR,MAAM,IAAIH,kBAAkBG,MAAMb,SAASW,MAAM;QACnD;QACA,MAAM,IAAIG,WAAWd;IACvB;IACA,OAAOA;AACT;AAEA;;;;CAIC,GACD,OAAO,eAAee,UAAa,GAAGhB,IAAqC;IACzE,MAAMC,WAAW,MAAMF,SAASC;IAChC,IAAI,CAACC,SAASE,EAAE,EAAE;QAChB,MAAM,IAAIY,WAAWd;IACvB;IACA,OAAO,MAAMA,SAASO,IAAI;AAC5B;AAMA;;CAEC,GACD,OAAO,MAAMO,mBAAmBE;IAC9BL,OAAe;IACfM,YAAYjB,QAA4B,CAAE;QACxC,KAAK,CAAC,GAAGA,SAASW,MAAM,CAAC,CAAC,EAAEX,SAASkB,UAAU,EAAE;QACjD,IAAI,CAACP,MAAM,GAAGX,SAASW,MAAM;QAC7BQ,OAAOC,cAAc,CAAC,IAAI,EAAEN,WAAWO,SAAS;IAClD;AACF;AAEA;;CAEC,GACD,OAAO,MAAMX,0BAA0BM;IACrCL,OAAe;IACfM,YAAYL,OAAe,EAAED,MAAc,CAAE;QAC3C,KAAK,CAACC;QACN,IAAI,CAACD,MAAM,GAAGA;QACdQ,OAAOC,cAAc,CAAC,IAAI,EAAEV,kBAAkBW,SAAS;IACzD;AACF"}
|
|
@@ -0,0 +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 './transform-data';\nexport * from './value-mapping';\nexport * from './types';\nexport * from './regexp';\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,kBAAkB;AAChC,cAAc,UAAU;AACxB,cAAc,WAAW"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/is-empty-object.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\n/**\n * Determines if an object is an empty object\n */\nexport function isEmptyObject(obj: object): boolean {\n return Object.getOwnPropertyNames(obj).length === 0;\n}\n"],"names":["isEmptyObject","obj","Object","getOwnPropertyNames","length"],"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;;CAEC,GACD,OAAO,SAASA,cAAcC,GAAW;IACvC,OAAOC,OAAOC,mBAAmB,CAACF,KAAKG,MAAM,KAAK;AACpD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/mathjs.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 { gcdDependencies, create } from 'mathjs';\n\n// This ensures we get a minimal mathjs bundle for just what we need (see https://mathjs.org/docs/custom_bundling.html)\nconst { gcd } = create({ gcdDependencies });\nexport { gcd };\n"],"names":["gcdDependencies","create","gcd"],"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,eAAe,EAAEC,MAAM,QAAQ,SAAS;AAEjD,uHAAuH;AACvH,MAAM,EAAEC,GAAG,EAAE,GAAGD,OAAO;IAAED;AAAgB;AACzC,SAASE,GAAG,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/memo.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 { useRef, DependencyList } from 'react';\nimport isEqual from 'lodash/isEqual';\n\ntype MemoRef<T> = {\n value: T;\n deps: DependencyList;\n};\n\n/**\n * Like React's useMemo, but guarantees the value will only be recalulated if\n * a dependency changes. Uses strict equality (===) for comparison. (React's\n * useMemo does not offer this guarantee, it's only a performance optimization).\n */\nexport function useMemoized<T>(factory: () => T, deps: DependencyList): T {\n const ref = useRef<MemoRef<T>>();\n\n let areEqual = true;\n for (let i = 0; i < deps.length; i++) {\n if (ref.current?.deps[i] !== deps[i]) {\n areEqual = false;\n break;\n }\n }\n\n if (ref.current === undefined || areEqual === false) {\n ref.current = { value: factory(), deps: deps };\n }\n\n return ref.current.value;\n}\n\n/**\n * Like React's useMemo, except it does a deep equality comparison with lodash's\n * isEqual on the dependency list.\n */\nexport function useDeepMemo<T>(factory: () => T, deps: DependencyList): T {\n const ref = useRef<MemoRef<T>>();\n if (ref.current === undefined || isEqual(deps, ref.current.deps) === false) {\n ref.current = { value: factory(), deps };\n }\n return ref.current.value;\n}\n"],"names":["useRef","isEqual","useMemoized","factory","deps","ref","areEqual","i","length","current","undefined","value","useDeepMemo"],"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,MAAM,QAAwB,QAAQ;AAC/C,OAAOC,aAAa,iBAAiB;AAOrC;;;;CAIC,GACD,OAAO,SAASC,YAAeC,OAAgB,EAAEC,IAAoB;IACnE,MAAMC,MAAML;IAEZ,IAAIM,WAAW;IACf,IAAK,IAAIC,IAAI,GAAGA,IAAIH,KAAKI,MAAM,EAAED,IAAK;QACpC,IAAIF,IAAII,OAAO,EAAEL,IAAI,CAACG,EAAE,KAAKH,IAAI,CAACG,EAAE,EAAE;YACpCD,WAAW;YACX;QACF;IACF;IAEA,IAAID,IAAII,OAAO,KAAKC,aAAaJ,aAAa,OAAO;QACnDD,IAAII,OAAO,GAAG;YAAEE,OAAOR;YAAWC,MAAMA;QAAK;IAC/C;IAEA,OAAOC,IAAII,OAAO,CAACE,KAAK;AAC1B;AAEA;;;CAGC,GACD,OAAO,SAASC,YAAeT,OAAgB,EAAEC,IAAoB;IACnE,MAAMC,MAAML;IACZ,IAAIK,IAAII,OAAO,KAAKC,aAAaT,QAAQG,MAAMC,IAAII,OAAO,CAACL,IAAI,MAAM,OAAO;QAC1EC,IAAII,OAAO,GAAG;YAAEE,OAAOR;YAAWC;QAAK;IACzC;IACA,OAAOC,IAAII,OAAO,CAACE,KAAK;AAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/panel-refs.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 { DashboardSpec, PanelDefinition, PanelRef } from '../model';\n\n/**\n * Resolve a PanelRef (JSON reference) against the provided DashboardSpec to\n * a PanelDefinition.\n */\nexport function resolvePanelRef(spec: DashboardSpec, panelRef: PanelRef): PanelDefinition {\n const panelsKey = getPanelKeyFromRef(panelRef);\n const panelDefinition = spec.panels[panelsKey];\n if (panelDefinition === undefined) {\n throw new Error(`Could not resolve panels reference ${panelRef.$ref}`);\n }\n return panelDefinition;\n}\n\n// Currently, panel refs are prefixed with `#/spec/panels/`. If that format changes, we'll definitely need to update\n// the code in here relying on it being that format.\nconst REF_PREFIX_LENGTH = 14;\n\n/**\n * Gets the unique key for a panel from a PanelRef.\n */\nexport function getPanelKeyFromRef(panelRef: PanelRef): string {\n return panelRef.$ref.substring(REF_PREFIX_LENGTH);\n}\n\n/**\n * Creates a PanelRef for a panel with the given key.\n */\nexport function createPanelRef(panelKey: string): PanelRef {\n return { $ref: `#/spec/panels/${panelKey}` };\n}\n"],"names":["resolvePanelRef","spec","panelRef","panelsKey","getPanelKeyFromRef","panelDefinition","panels","undefined","Error","$ref","REF_PREFIX_LENGTH","substring","createPanelRef","panelKey"],"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;AAIjC;;;CAGC,GACD,OAAO,SAASA,gBAAgBC,IAAmB,EAAEC,QAAkB;IACrE,MAAMC,YAAYC,mBAAmBF;IACrC,MAAMG,kBAAkBJ,KAAKK,MAAM,CAACH,UAAU;IAC9C,IAAIE,oBAAoBE,WAAW;QACjC,MAAM,IAAIC,MAAM,CAAC,mCAAmC,EAAEN,SAASO,IAAI,EAAE;IACvE;IACA,OAAOJ;AACT;AAEA,oHAAoH;AACpH,oDAAoD;AACpD,MAAMK,oBAAoB;AAE1B;;CAEC,GACD,OAAO,SAASN,mBAAmBF,QAAkB;IACnD,OAAOA,SAASO,IAAI,CAACE,SAAS,CAACD;AACjC;AAEA;;CAEC,GACD,OAAO,SAASE,eAAeC,QAAgB;IAC7C,OAAO;QAAEJ,MAAM,CAAC,cAAc,EAAEI,UAAU;IAAC;AAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/regexp.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\n/**\n * Checks if a string is a regex pattern.\n */\nexport function isRegexPattern(input: string | null | undefined): boolean {\n return Boolean(input?.startsWith('/'));\n}\n\n/**\n * Converts a string to RegExp. Handles both regular strings and regex patterns.\n * For regular strings, creates exact match regex.\n * For patterns like \"/pattern/flags\", creates corresponding RegExp.\n */\nexport function createRegexFromString(input: string): RegExp {\n if (!input) {\n throw new Error('Input string cannot be empty');\n }\n\n if (!isRegexPattern(input)) {\n return new RegExp(`^${input}$`);\n }\n\n const regexPattern = /^\\/(.+)\\/([gimy]*)$/;\n const matches = input.match(regexPattern);\n\n if (!matches) {\n throw new Error(`Invalid regular expression format: ${input}`);\n }\n\n const [, pattern = '', flags = ''] = matches;\n\n try {\n return new RegExp(pattern, flags);\n } catch (error) {\n throw new Error(`Failed to create RegExp ${error}`);\n }\n}\n"],"names":["isRegexPattern","input","Boolean","startsWith","createRegexFromString","Error","RegExp","regexPattern","matches","match","pattern","flags","error"],"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;;CAEC,GACD,OAAO,SAASA,eAAeC,KAAgC;IAC7D,OAAOC,QAAQD,OAAOE,WAAW;AACnC;AAEA;;;;CAIC,GACD,OAAO,SAASC,sBAAsBH,KAAa;IACjD,IAAI,CAACA,OAAO;QACV,MAAM,IAAII,MAAM;IAClB;IAEA,IAAI,CAACL,eAAeC,QAAQ;QAC1B,OAAO,IAAIK,OAAO,CAAC,CAAC,EAAEL,MAAM,CAAC,CAAC;IAChC;IAEA,MAAMM,eAAe;IACrB,MAAMC,UAAUP,MAAMQ,KAAK,CAACF;IAE5B,IAAI,CAACC,SAAS;QACZ,MAAM,IAAIH,MAAM,CAAC,mCAAmC,EAAEJ,OAAO;IAC/D;IAEA,MAAM,GAAGS,UAAU,EAAE,EAAEC,QAAQ,EAAE,CAAC,GAAGH;IAErC,IAAI;QACF,OAAO,IAAIF,OAAOI,SAASC;IAC7B,EAAE,OAAOC,OAAO;QACd,MAAM,IAAIP,MAAM,CAAC,wBAAwB,EAAEO,OAAO;IACpD;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/text.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 { Resource } from '../model';\n\n/**\n * If the resource has a display name, return the variable display name\n * Else, only return the resource metdata name\n */\nexport function getResourceDisplayName<T extends Resource>(resource: T): string {\n // Variables\n if (resource.spec.spec?.display?.name) {\n return resource.spec.spec.display.name;\n }\n\n // Other resources with display\n if (resource.spec.display?.name) {\n return resource.spec.display.name;\n }\n\n return resource.metadata.name;\n}\n\n/**\n * If the resource has a display name, return the resource display name with the resource name too\n * Else, only return the resource name\n */\nexport function getResourceExtendedDisplayName<T extends Resource>(resource: T): string {\n // Variables\n if (resource.spec.spec?.display?.name) {\n return `${resource.spec.spec.display.name} (ID: ${resource.metadata.name})`;\n }\n\n // Other resources with display\n if (resource.spec.display?.name) {\n return `${resource.spec.display.name} (ID: ${resource.metadata.name})`;\n }\n\n return resource.metadata.name;\n}\n"],"names":["getResourceDisplayName","resource","spec","display","name","metadata","getResourceExtendedDisplayName"],"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;AAIjC;;;CAGC,GACD,OAAO,SAASA,uBAA2CC,QAAW;IACpE,YAAY;IACZ,IAAIA,SAASC,IAAI,CAACA,IAAI,EAAEC,SAASC,MAAM;QACrC,OAAOH,SAASC,IAAI,CAACA,IAAI,CAACC,OAAO,CAACC,IAAI;IACxC;IAEA,+BAA+B;IAC/B,IAAIH,SAASC,IAAI,CAACC,OAAO,EAAEC,MAAM;QAC/B,OAAOH,SAASC,IAAI,CAACC,OAAO,CAACC,IAAI;IACnC;IAEA,OAAOH,SAASI,QAAQ,CAACD,IAAI;AAC/B;AAEA;;;CAGC,GACD,OAAO,SAASE,+BAAmDL,QAAW;IAC5E,YAAY;IACZ,IAAIA,SAASC,IAAI,CAACA,IAAI,EAAEC,SAASC,MAAM;QACrC,OAAO,GAAGH,SAASC,IAAI,CAACA,IAAI,CAACC,OAAO,CAACC,IAAI,CAAC,MAAM,EAAEH,SAASI,QAAQ,CAACD,IAAI,CAAC,CAAC,CAAC;IAC7E;IAEA,+BAA+B;IAC/B,IAAIH,SAASC,IAAI,CAACC,OAAO,EAAEC,MAAM;QAC/B,OAAO,GAAGH,SAASC,IAAI,CAACC,OAAO,CAACC,IAAI,CAAC,MAAM,EAAEH,SAASI,QAAQ,CAACD,IAAI,CAAC,CAAC,CAAC;IACxE;IAEA,OAAOH,SAASI,QAAQ,CAACD,IAAI;AAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/time-series-data.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 { AbsoluteTimeRange, TimeScale, TimeSeries, TimeSeriesData, TimeSeriesValueTuple } from '../model';\nimport { gcd } from './mathjs';\n\nexport const MIN_STEP_INTERVAL_MS = 10;\n\n/**\n * Given a TimeSeries from a query and a common time scale (see `getCommonTimeScale`),\n * processes the time series values, filling in any timestamps that are missing\n * from the time series data with `null` values.\n */\nexport function getTimeSeriesValues(series: TimeSeries, timeScale: TimeScale): TimeSeriesValueTuple[] {\n let timestamp = timeScale.startMs;\n\n const values = series.values;\n const processedValues: TimeSeriesValueTuple[] = [];\n\n for (const valueTuple of values) {\n // Fill in values up to the current series value timestamp with nulls\n while (timestamp < valueTuple[0]) {\n processedValues.push([timestamp, null]);\n timestamp += timeScale.stepMs;\n }\n\n // Now add the current value since timestamp should match\n processedValues.push([timestamp, valueTuple[1]]);\n timestamp += timeScale.stepMs;\n }\n\n // Add null values at the end of the series if necessary\n while (timestamp <= timeScale.endMs) {\n processedValues.push([timestamp, null]);\n timestamp += timeScale.stepMs;\n }\n\n return processedValues;\n}\n\n/**\n * Given a list of running queries, calculates a common time scale for use on\n * the x axis (i.e. start/end dates and a step that is divisible into all of\n * the queries' steps).\n */\nexport function getCommonTimeScale(\n seriesData: Array<TimeSeriesData | Pick<TimeSeries, 'values'> | undefined>\n): TimeScale | undefined {\n let timeRange: AbsoluteTimeRange | undefined = undefined;\n const steps: number[] = [];\n\n for (const data of seriesData) {\n if (data && 'timeRange' in data) {\n if (data === undefined || data.timeRange === undefined || data.stepMs === undefined) continue;\n\n // Keep track of query steps so we can calculate a common one for the graph\n steps.push(data.stepMs);\n\n // If we don't have an overall time range yet, just start with this one\n if (timeRange === undefined) {\n timeRange = data.timeRange;\n continue;\n }\n\n // Otherwise, see if this query has a start or end outside of the current\n // time range\n if (data.timeRange.start < timeRange.start) {\n timeRange.start = data.timeRange.start;\n }\n if (data.timeRange.end > timeRange.end) {\n timeRange.end = data.timeRange.end;\n }\n } else if (data && 'values' in data) {\n for (let i = 0; i < data.values.length; i++) {\n const values = data.values[i];\n if (values === undefined) {\n continue;\n }\n\n const [timestamp] = values;\n const start = new Date(timestamp);\n const end = new Date(timestamp);\n\n if (timeRange === undefined) {\n timeRange = {\n start,\n end,\n };\n continue;\n }\n\n if (start < timeRange.start) {\n timeRange.start = start;\n }\n\n if (end > timeRange.end) {\n timeRange.end = end;\n }\n }\n\n if (timeRange === undefined) return undefined;\n\n const startMs = timeRange.start.valueOf();\n const endMs = timeRange.end.valueOf();\n const rangeMs = endMs - startMs;\n\n return { startMs, endMs, rangeMs, stepMs: MIN_STEP_INTERVAL_MS };\n }\n }\n\n if (timeRange === undefined) return undefined;\n\n // Use the greatest common divisor of all step values as the overall step\n // for the x axis (or if only one query, just use that query's step value)\n let stepMs: number;\n if (steps.length === 1) {\n stepMs = steps[0] as number;\n } else {\n const calculatedStepMs = gcd(...steps);\n stepMs = calculatedStepMs < MIN_STEP_INTERVAL_MS ? MIN_STEP_INTERVAL_MS : calculatedStepMs;\n }\n\n const startMs = timeRange.start.valueOf();\n const endMs = timeRange.end.valueOf();\n const rangeMs = endMs - startMs;\n\n return { startMs, endMs, stepMs, rangeMs };\n}\n"],"names":["gcd","MIN_STEP_INTERVAL_MS","getTimeSeriesValues","series","timeScale","timestamp","startMs","values","processedValues","valueTuple","push","stepMs","endMs","getCommonTimeScale","seriesData","timeRange","undefined","steps","data","start","end","i","length","Date","valueOf","rangeMs","calculatedStepMs"],"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,GAAG,QAAQ,WAAW;AAE/B,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QAAOD;QAAQc;IAAQ;AAC3C"}
|
|
@@ -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): Array<Record<string, unknown>> {\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(\n data: Array<Record<string, unknown>>,\n column: string\n): Array<Record<string, unknown>> {\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,2EAA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AMuC,cAAcrC,MAAMsC,aAAa;QAACtC;QAAMsC;KAAW;AAC1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/types.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 type DispatchWithPromise<A> = (value: A) => Promise<void>;\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,WAAiE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/utils/value-mapping.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 { MappedValue, ValueMapping } from '../model';\nimport { createRegexFromString } from './regexp';\n\nexport function applyValueMapping(value: number | string, mappings: ValueMapping[] = []): MappedValue {\n if (!mappings.length) {\n return { value };\n }\n\n const mappedItem: MappedValue = { value };\n\n mappings.forEach((mapping) => {\n switch (mapping.kind) {\n case 'Value': {\n const valueOptions = mapping.spec;\n\n if (String(valueOptions.value) === String(value)) {\n mappedItem.value = valueOptions.result.value || mappedItem.value;\n mappedItem.color = valueOptions.result.color;\n }\n break;\n }\n case 'Range': {\n const rangeOptions = mapping.spec;\n const newValue = value as number;\n\n if (rangeOptions.from === undefined && rangeOptions.to === undefined) {\n break;\n }\n\n const from = rangeOptions.from !== undefined ? rangeOptions.from : -Infinity;\n const to = rangeOptions.to !== undefined ? rangeOptions.to : Infinity;\n if (newValue >= from && newValue <= to) {\n mappedItem.value = rangeOptions.result.value || mappedItem.value;\n mappedItem.color = rangeOptions.result.color;\n }\n break;\n }\n case 'Regex': {\n const regexOptions = mapping.spec;\n const stringValue = value.toString();\n\n if (!regexOptions.pattern) {\n break;\n }\n\n const regex = createRegexFromString(regexOptions.pattern);\n\n if (stringValue.match(regex)) {\n if (regexOptions.result.value !== null) {\n mappedItem.value =\n stringValue.replace(regex, regexOptions.result.value.toString() || '') || mappedItem.value;\n mappedItem.color = regexOptions.result.color;\n }\n }\n break;\n }\n case 'Misc': {\n const miscOptions = mapping.spec;\n if (isMiscValueMatch(miscOptions.value, value)) {\n mappedItem.value = miscOptions.result.value || mappedItem.value;\n mappedItem.color = miscOptions.result.color;\n }\n break;\n }\n default:\n break;\n }\n });\n return mappedItem;\n}\n\nfunction isMiscValueMatch(miscValue: string, value: number | string | boolean): boolean {\n switch (miscValue) {\n case 'empty':\n return value === '';\n case 'null':\n return value === null || value === undefined;\n case 'NaN':\n return Number.isNaN(value);\n case 'true':\n return value === true;\n case 'false':\n return value === false;\n default:\n return false;\n }\n}\n"],"names":["createRegexFromString","applyValueMapping","value","mappings","length","mappedItem","forEach","mapping","kind","valueOptions","spec","String","result","color","rangeOptions","newValue","from","undefined","to","Infinity","regexOptions","stringValue","toString","pattern","regex","match","replace","miscOptions","isMiscValueMatch","miscValue","Number","isNaN"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;A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,MAAMC,QAAQxB,sBAAsBoB,aAAaG,OAAO;oBAExD,IAAIF,YAAYI,KAAK,CAACD,QAAQ;wBAC5B,IAAIJ,aAAaR,MAAM,CAACV,KAAK,KAAK,MAAM;4BACtCG,WAAWH,KAAK,GACdmB,YAAYK,OAAO,CAACF,OAAOJ,aAAaR,MAAM,CAACV,KAAK,CAACoB,QAAQ,MAAM,OAAOjB,WAAWH,KAAK;4BAC5FG,WAAWQ,KAAK,GAAGO,aAAaR,MAAM,CAACC,KAAK;wBAC9C;oBACF;oBACA;gBACF;YACA,KAAK;gBAAQ;oBACX,MAAMc,cAAcpB,QAAQG,IAAI;oBAChC,IAAIkB,iBAAiBD,YAAYzB,KAAK,EAAEA,QAAQ;wBAC9CG,WAAWH,KAAK,GAAGyB,YAAYf,MAAM,CAACV,KAAK,IAAIG,WAAWH,KAAK;wBAC/DG,WAAWQ,KAAK,GAAGc,YAAYf,MAAM,CAACC,KAAK;oBAC7C;oBACA;gBACF;YACA;gBACE;QACJ;IACF;IACA,OAAOR;AACT;AAEA,SAASuB,iBAAiBC,SAAiB,EAAE3B,KAAgC;IAC3E,OAAQ2B;QACN,KAAK;YACH,OAAO3B,UAAU;QACnB,KAAK;YACH,OAAOA,UAAU,QAAQA,UAAUe;QACrC,KAAK;YACH,OAAOa,OAAOC,KAAK,CAAC7B;QACtB,KAAK;YACH,OAAOA,UAAU;QACnB,KAAK;YACH,OAAOA,UAAU;QACnB;YACE,OAAO;IACX;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/core",
|
|
3
|
-
"version": "0.52.0-beta.
|
|
3
|
+
"version": "0.52.0-beta.4",
|
|
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",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"scripts": {
|
|
19
19
|
"clean": "rimraf dist/",
|
|
20
20
|
"build": "concurrently \"npm:build:*\"",
|
|
21
|
-
"build:cjs": "swc ./src -d dist/cjs --config-file ../.cjs.swcrc",
|
|
22
|
-
"build:esm": "swc ./src -d dist --config-file ../.swcrc",
|
|
21
|
+
"build:cjs": "swc ./src -d dist/cjs --strip-leading-paths --config-file ../.cjs.swcrc",
|
|
22
|
+
"build:esm": "swc ./src -d dist --strip-leading-paths --config-file ../.swcrc",
|
|
23
23
|
"build:types": "tsc --project tsconfig.build.json",
|
|
24
24
|
"type-check": "tsc --noEmit",
|
|
25
25
|
"start": "concurrently -P \"npm:build:* -- {*}\" -- --watch",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/constants/dashboard-defaults.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 { DurationString } from '../model';\n\nexport const DEFAULT_DASHBOARD_DURATION: DurationString = '1h';\n\nexport const DEFAULT_REFRESH_INTERVAL: DurationString = '0s';\n"],"names":["DEFAULT_DASHBOARD_DURATION","DEFAULT_REFRESH_INTERVAL"],"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;AAIjC,OAAO,MAAMA,6BAA6C,KAAK;AAE/D,OAAO,MAAMC,2BAA2C,KAAK"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/constants/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 './dashboard-defaults';\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,uBAAuB"}
|
package/dist/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/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 './constants';\nexport * from './model';\nexport * from './schema';\nexport * from './utils';\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,cAAc;AAC5B,cAAc,UAAU;AACxB,cAAc,WAAW;AACzB,cAAc,UAAU"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/calculations.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 { TimeSeriesValueTuple } from './time-series-queries';\n\nexport const DEFAULT_CALCULATION: CalculationType = 'last'; // aligned with cue\n\nexport const CalculationsMap = {\n first: first,\n last: last,\n 'first-number': firstNumber,\n 'last-number': lastNumber,\n mean: mean,\n sum: sum,\n min: min,\n max: max,\n};\n\nexport type CalculationType = keyof typeof CalculationsMap;\n\nexport type CalculationConfig = {\n label: string;\n description: string;\n};\n\nexport const CALCULATIONS_CONFIG: Readonly<Record<CalculationType, CalculationConfig>> = {\n first: {\n label: 'First',\n description: 'First value',\n },\n last: {\n label: 'Last',\n description: 'Last value',\n },\n 'first-number': {\n label: 'First *',\n description: 'First numeric value',\n },\n 'last-number': {\n label: 'Last *',\n description: 'Last numeric value',\n },\n mean: {\n label: 'Avg',\n description: 'Average value excluding nulls',\n },\n sum: {\n label: 'Sum',\n description: 'The sum of all values',\n },\n min: {\n label: 'Min',\n description: 'Minimum value',\n },\n max: {\n label: 'Max',\n description: 'Maximum value',\n },\n} as const;\n\ntype CalculationValue = number | null | undefined;\n\n/**\n * Calculate a multiple values for a set of time series data.\n *\n * @param values - Array of time series data.\n * @param includeCalculations - Array of calculations to include.\n */\nexport function getCalculations<IncludeCalcs extends CalculationType[]>(\n values: TimeSeriesValueTuple[],\n includeCalculations: IncludeCalcs\n): Record<\n // This extract combined with the generics above keeps the key of the returned\n // record to *just* the specified calculations.\n Extract<CalculationType, IncludeCalcs[number]>,\n CalculationValue\n> {\n const calculations = includeCalculations.reduce(\n (initResult, calculation) => {\n initResult[calculation] = undefined;\n return initResult;\n },\n {} as Record<string, CalculationValue>\n );\n\n // We save these values as separate values instead of directly setting them\n // in the calculations because they are needed by multiple calculations.\n let nonNullCount = 0;\n let sum = 0;\n\n // We use this large function capable of performing one or more calculations\n // in a single iteration of the data to minimize the performance impact of\n // generating multiple calculations for large timeseries values. This is\n // less optimized for certain single calculations when done in isolation (e.g.\n // `last`), but will be more performant in the more expensive cases where\n // multiple values are being used (e.g. table legend).\n values.forEach((tuple, i) => {\n const value = tuple[1];\n\n if (i === 0 && 'first' in calculations) {\n calculations.first = value;\n }\n if (i === values.length - 1 && 'last' in calculations) {\n calculations.last = value;\n }\n\n // Handling specific to non-null values.\n if (typeof value === 'number') {\n nonNullCount += 1;\n sum += value;\n\n if ('first-number' in calculations && calculations['first-number'] === undefined) {\n // Save the first number we see.\n calculations['first-number'] = value;\n }\n\n if ('last-number' in calculations) {\n // Keep setting the numbers we see, which will eventually be set to the\n // last number when finished iterating.\n calculations['last-number'] = value;\n }\n\n if ('min' in calculations) {\n if (typeof calculations.min !== 'number') {\n // Init the first time we see a number\n calculations.min = value;\n } else {\n // Use lowest value once initialized\n calculations.min = Math.min(calculations.min, value);\n }\n }\n\n if ('max' in calculations) {\n if (typeof calculations.max !== 'number') {\n // Init the first time we see a number\n calculations.max = value;\n } else {\n // Use highest value once initialized\n calculations.max = Math.max(calculations.max, value);\n }\n }\n }\n });\n\n // Set calculations that require iterating over all values.\n if (nonNullCount > 0 && 'sum' in calculations) {\n calculations.sum = sum;\n }\n\n if (nonNullCount > 0 && 'mean' in calculations) {\n calculations.mean = sum / nonNullCount;\n }\n\n return calculations;\n}\n\n/**\n * Calculate a single value for a set of time series data.\n *\n * Use `getCalculations` instead if you need multiple calculations.\n *\n * @param values - Array of time series data.\n * @param calculation - Name of the calculation to calculate.\n */\nexport function getCalculation(values: TimeSeriesValueTuple[], calculation: CalculationType): CalculationValue {\n return getCalculations(values, [calculation])[calculation];\n}\n\nfunction first(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'first');\n}\n\nfunction last(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'last');\n}\n\nfunction firstNumber(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'first-number');\n}\n\nfunction lastNumber(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'last-number');\n}\n\nfunction mean(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'mean');\n}\n\nfunction sum(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'sum');\n}\n\nfunction min(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'min');\n}\n\nfunction max(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'max');\n}\n"],"names":["DEFAULT_CALCULATION","CalculationsMap","first","last","firstNumber","lastNumber","mean","sum","min","max","CALCULATIONS_CONFIG","label","description","getCalculations","values","includeCalculations","calculations","reduce","initResult","calculation","undefined","nonNullCount","forEach","tuple","i","value","length","Math","getCalculation"],"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;AAIjC,OAAO,MAAMA,sBAAuC,OAAO,CAAC,mBAAmB;AAE/E,OAAO,MAAMC,kBAAkB;IAC7BC,OAAOA;IACPC,MAAMA;IACN,gBAAgBC;IAChB,eAAeC;IACfC,MAAMA;IACNC,KAAKA;IACLC,KAAKA;IACLC,KAAKA;AACP,EAAE;AASF,OAAO,MAAMC,sBAA4E;IACvFR,OAAO;QACLS,OAAO;QACPC,aAAa;IACf;IACAT,MAAM;QACJQ,OAAO;QACPC,aAAa;IACf;IACA,gBAAgB;QACdD,OAAO;QACPC,aAAa;IACf;IACA,eAAe;QACbD,OAAO;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R,GAAG,GAAGmB,KAAKnB,GAAG,CAACQ,aAAaR,GAAG,EAAEiB;gBAChD;YACF;YAEA,IAAI,SAAST,cAAc;gBACzB,IAAI,OAAOA,aAAaP,GAAG,KAAK,UAAU;oBACxC,sCAAsC;oBACtCO,aAAaP,GAAG,GAAGgB;gBACrB,OAAO;oBACL,qCAAqC;oBACrCT,aAAaP,GAAG,GAAGkB,KAAKlB,GAAG,CAACO,aAAaP,GAAG,EAAEgB;gBAChD;YACF;QACF;IACF;IAEA,2DAA2D;IAC3D,IAAIJ,eAAe,KAAK,SAASL,cAAc;QAC7CA,aAAaT,GAAG,GAAGA;IACrB;IAEA,IAAIc,eAAe,KAAK,UAAUL,cAAc;QAC9CA,aAAaV,IAAI,GAAGC,MAAMc;IAC5B;IAEA,OAAOL;AACT;AAEA;;;;;;;CAOC,GACD,OAAO,SAASY,eAAed,MAA8B,EAAEK,WAA4B;IACzF,OAAON,gBAAgBC,QAAQ;QAACK;KAAY,CAAC,CAACA,YAAY;AAC5D;AAEA,SAASjB,MAAMY,MAA8B;IAC3C,OAAOc,eAAed,QAAQ;AAChC;AAEA,SAASX,KAAKW,MAA8B;IAC1C,OAAOc,eAAed,QAAQ;AAChC;AAEA,SAASV,YAAYU,MAA8B;IACjD,OAAOc,eAAed,QAAQ;AAChC;AAEA,SAAST,WAAWS,MAA8B;IAChD,OAAOc,eAAed,QAAQ;AAChC;AAEA,SAASR,KAAKQ,MAA8B;IAC1C,OAAOc,eAAed,QAAQ;AAChC;AAEA,SAASP,IAAIO,MAA8B;IACzC,OAAOc,eAAed,QAAQ;AAChC;AAEA,SAASN,IAAIM,MAA8B;IACzC,OAAOc,eAAed,QAAQ;AAChC;AAEA,SAASL,IAAIK,MAA8B;IACzC,OAAOc,eAAed,QAAQ;AAChC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/dashboard.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 { DatasourceSpec } from './datasource';\nimport { LayoutDefinition } from './layout';\nimport { PanelDefinition } from './panels';\nimport { ProjectMetadata } from './resource';\nimport { DurationString } from './time';\nimport { VariableDefinition } from './variables';\nimport { Display } from './display';\n\nexport interface DashboardResource {\n kind: 'Dashboard';\n metadata: ProjectMetadata;\n spec: DashboardSpec;\n}\n\nexport interface DashboardSpec {\n display?: Display;\n datasources?: Record<string, DatasourceSpec>;\n duration: DurationString;\n refreshInterval?: DurationString;\n variables: VariableDefinition[];\n layouts: LayoutDefinition[];\n panels: Record<string, PanelDefinition>;\n}\n\nexport interface DashboardSelector {\n project: string;\n dashboard: string;\n}\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;AA0BjC,WAGC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/datasource.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 { Metadata, ProjectMetadata } from './resource';\nimport { Display } from './display';\n\nexport interface DatasourceSpec<PluginSpec = UnknownSpec> {\n display?: Display;\n default: boolean;\n plugin: Definition<PluginSpec>;\n}\n\n/**\n * A Datasource that's available across all projects.\n */\nexport interface GlobalDatasourceResource {\n kind: 'GlobalDatasource';\n metadata: Metadata;\n spec: DatasourceSpec;\n}\n\n/**\n * A Datasource resource, that belongs to a project.\n */\nexport interface DatasourceResource {\n kind: 'Datasource';\n metadata: ProjectMetadata;\n spec: DatasourceSpec;\n}\n\nexport type Datasource = DatasourceResource | GlobalDatasourceResource;\n\n/**\n * A selector for pointing at a specific Datasource.\n */\nexport interface DatasourceSelector {\n /**\n * Kind of the datasource.\n */\n kind: string;\n\n /**\n * Name of the datasource.\n * If omitted, it's assumed that you target the default datasource for the specified kind (and group, if set)\n */\n name?: string;\n}\n\n/**\n * An intermediary type to regroup the name and the spec of a datasource.\n */\nexport interface DatasourceDefinition {\n name: string;\n spec: DatasourceSpec;\n}\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;AAgDjC;;CAEC,GACD,WAGC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/definitions.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\n/**\n * Base type for definitions in JSON config resources.\n */\nexport interface Definition<Spec> {\n kind: string;\n spec: Spec;\n}\n\n/**\n * Type to represent specs at runtime in framework code where we don't know the spec's real type, probably because it's\n * part of a plugin.\n */\nexport type UnknownSpec = Record<string, unknown>;\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;;CAEC,GAMD;;;CAGC,GACD,WAAkD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/ephemeraldashboard.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 { ProjectMetadata } from './resource';\nimport { DurationString } from './time';\nimport { DashboardSelector, DashboardSpec } from './dashboard';\n\nexport interface EphemeralDashboardResource {\n kind: 'EphemeralDashboard';\n metadata: ProjectMetadata;\n spec: EphemeralDashboardSpec;\n}\n\nexport interface EphemeralDashboardSpec extends DashboardSpec {\n ttl: DurationString;\n}\n\nexport interface EphemeralDashboardInfo extends DashboardSelector {\n ttl: DurationString;\n}\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;AAgBjC,WAEC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/http-proxy.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 { RequestHeaders } from './http';\n\nexport interface HTTPProxy {\n kind: 'HTTPProxy';\n spec: HTTPProxySpec;\n}\nexport interface HTTPProxySpec {\n // url is the url of the datasource. It is not the url of the proxy.\n // The Perses server is the proxy, so it needs to know where to redirect the request.\n url: string;\n // allowedEndpoints is a list of tuples of http methods and http endpoints that will be accessible.\n // Leave it empty if you don't want to restrict the access to the datasource.\n allowedEndpoints?: HTTPAllowedEndpoint[];\n // headers can be used to provide additional headers that need to be forwarded when requesting the datasource\n headers?: RequestHeaders;\n // secret is the name of the secret that should be used for the proxy or discovery configuration\n // It will contain any sensitive information such as password, token, certificate.\n secret?: string;\n}\n\nexport interface HTTPAllowedEndpoint {\n endpointPattern: string;\n method: string;\n}\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;AAsBjC,WAGC"}
|
|
@@ -1 +0,0 @@
|
|
|
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 './otlp';\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 './profile-data';\nexport * from './transforms';\nexport * from './units';\nexport * from './user';\nexport * from './variables';\nexport * from './value-mapping';\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,SAAS;AACvB,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,iBAAiB;AAC/B,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,cAAc;AAC5B,cAAc,kBAAkB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/kind.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 type Kind =\n | 'Dashboard'\n | 'Datasource'\n | 'EphemeralDashboard'\n | 'Folder'\n | 'GlobalDatasource'\n | 'GlobalRole'\n | 'GlobalRoleBinding'\n | 'GlobalSecret'\n | 'GlobalVariable'\n | 'Project'\n | 'Role'\n | 'RoleBinding'\n | 'Secret'\n | 'User'\n | 'Variable';\n\nexport const KINDS: Kind[] = [\n 'Dashboard',\n 'Datasource',\n 'EphemeralDashboard',\n 'Folder',\n 'GlobalDatasource',\n 'GlobalRole',\n 'GlobalRoleBinding',\n 'GlobalSecret',\n 'GlobalVariable',\n 'Project',\n 'Role',\n 'RoleBinding',\n 'Secret',\n 'User',\n 'Variable',\n];\n"],"names":["KINDS"],"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;AAmBjC,OAAO,MAAMA,QAAgB;IAC3B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/layout.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 { PanelRef } from './panels';\n\nexport type LayoutDefinition = GridDefinition;\n\nexport interface GridDefinition {\n kind: 'Grid';\n spec: {\n display?: {\n title: string;\n collapse?: {\n open: boolean;\n };\n };\n items: GridItemDefinition[];\n };\n}\n\nexport interface GridItemDefinition {\n x: number;\n y: number;\n width: number;\n height: number;\n content: PanelRef;\n}\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;AAmBjC,WAMC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/legend.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\n// This file contains common/shared legend model code.\n// See the `components` package for legend model code specific to the Legend\n// component and the `plugin-system` package for legend model code specific to\n// panel plugin specs.\n\nexport const legendPositions = ['bottom', 'right'] as const;\nexport type LegendPositions = (typeof legendPositions)[number];\n\nexport const legendModes = ['list', 'table'] as const;\nexport type LegendMode = (typeof legendModes)[number];\n\nexport const legendSizes = ['small', 'medium'] as const;\nexport type LegendSize = (typeof legendSizes)[number];\n\n// Common legend options used across some UI components and panel specifications\nexport interface LegendOptionsBase {\n position: LegendPositions;\n mode?: LegendMode;\n size?: LegendSize;\n}\n\nexport function isValidLegendPosition(position: LegendPositions): boolean {\n return (legendPositions as readonly string[]).includes(position);\n}\n\nexport function isValidLegendMode(mode: LegendMode): boolean {\n return (legendModes as readonly string[]).includes(mode);\n}\n\nexport function isValidLegendSize(size: LegendSize): boolean {\n return (legendSizes as readonly string[]).includes(size);\n}\n\nexport const DEFAULT_LEGEND: Required<LegendOptionsBase> = {\n position: 'bottom',\n mode: 'list',\n size: 'medium',\n};\n\nexport function getLegendPosition(position?: LegendPositions): 'bottom' | 'right' {\n if (position === undefined) {\n return DEFAULT_LEGEND.position;\n }\n if (isValidLegendPosition(position)) {\n return position;\n }\n return DEFAULT_LEGEND.position;\n}\n\nexport function getLegendMode(mode?: LegendMode): 'list' | 'table' {\n if (!mode || !isValidLegendMode(mode)) {\n return DEFAULT_LEGEND.mode;\n }\n\n return mode;\n}\n\nexport function getLegendSize(size?: LegendSize): 'small' | 'medium' {\n if (!size || !isValidLegendSize(size)) {\n return DEFAULT_LEGEND.size;\n }\n\n return size;\n}\n"],"names":["legendPositions","legendModes","legendSizes","isValidLegendPosition","position","includes","isValidLegendMode","mode","isValidLegendSize","size","DEFAULT_LEGEND","getLegendPosition","undefined","getLegendMode","getLegendSize"],"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,sDAAsD;AACtD,4EAA4E;AAC5E,+EAA+E;AAC/E,sBAAsB;AAEtB,OAAO,MAAMA,kBAAkB;IAAC;IAAU;CAAQ,CAAU;AAG5D,OAAO,MAAMC,cAAc;IAAC;IAAQ;CAAQ,CAAU;AAGtD,OAAO,MAAMC,cAAc;IAAC;IAAS;CAAS,CAAU;AAUxD,OAAO,SAASC,sBAAsBC,QAAyB;IAC7D,OAAO,AAACJ,gBAAsCK,QAAQ,CAACD;AACzD;AAEA,OAAO,SAASE,kBAAkBC,IAAgB;IAChD,OAAO,AAACN,YAAkCI,QAAQ,CAACE;AACrD;AAEA,OAAO,SAASC,kBAAkBC,IAAgB;IAChD,OAAO,AAACP,YAAkCG,QAAQ,CAACI;AACrD;AAEA,OAAO,MAAMC,iBAA8C;IACzDN,UAAU;IACVG,MAAM;IACNE,MAAM;AACR,EAAE;AAEF,OAAO,SAASE,kBAAkBP,QAA0B;IAC1D,IAAIA,aAAaQ,WAAW;QAC1B,OAAOF,eAAeN,QAAQ;IAChC;IACA,IAAID,sBAAsBC,WAAW;QACnC,OAAOA;IACT;IACA,OAAOM,eAAeN,QAAQ;AAChC;AAEA,OAAO,SAASS,cAAcN,IAAiB;IAC7C,IAAI,CAACA,QAAQ,CAACD,kBAAkBC,OAAO;QACrC,OAAOG,eAAeH,IAAI;IAC5B;IAEA,OAAOA;AACT;AAEA,OAAO,SAASO,cAAcL,IAAiB;IAC7C,IAAI,CAACA,QAAQ,CAACD,kBAAkBC,OAAO;QACrC,OAAOC,eAAeD,IAAI;IAC5B;IAEA,OAAOA;AACT"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/model/otlp/common/v1/common.ts"],"sourcesContent":["// Copyright 2025 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\n// https://github.com/open-telemetry/opentelemetry-proto/blob/v1.5.0/opentelemetry/proto/common/v1/common.proto\n\nexport interface KeyValue {\n key: string;\n value: AnyValue;\n}\n\nexport type AnyValue =\n | { stringValue: string }\n | { intValue: string }\n | { boolValue: boolean }\n | { arrayValue: { values: AnyValue[] } };\n\nexport interface InstrumentationScope {\n name?: string;\n}\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,+GAA+G;AAa/G,WAEC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/model/otlp/index.ts"],"sourcesContent":["// Copyright 2025 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 * as otlpcommonv1 from './common/v1/common';\nexport * as otlpresourcev1 from './resource/v1/resource';\nexport * as otlptracev1 from './trace/v1/trace';\n"],"names":["otlpcommonv1","otlpresourcev1","otlptracev1"],"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,KAAKA,YAAY,MAAM,qBAAqB;AACnD,OAAO,KAAKC,cAAc,MAAM,yBAAyB;AACzD,OAAO,KAAKC,WAAW,MAAM,mBAAmB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/model/otlp/resource/v1/resource.ts"],"sourcesContent":["// Copyright 2025 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 { KeyValue } from '../../common/v1/common';\n\n// https://github.com/open-telemetry/opentelemetry-proto/blob/v1.5.0/opentelemetry/proto/resource/v1/resource.proto\n\nexport interface Resource {\n attributes?: KeyValue[];\n}\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;AAIjC,mHAAmH;AAEnH,WAEC"}
|