@perses-dev/loki-plugin 0.5.0-rc.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mf/js/{Loki.21b585d6.js → Loki.2bd94c1e.js} +3 -3
- package/__mf/js/async/1728.326f0c08.js +1 -0
- package/__mf/js/async/1750.eba509e1.js +1 -0
- package/__mf/js/async/392.2c7c202d.js +2 -0
- package/__mf/js/async/54.b3492a7a.js +22 -0
- package/__mf/js/async/5440.995ad0c5.js +2 -0
- package/__mf/js/async/{5440.3fedd5ea.js.LICENSE.txt → 5440.995ad0c5.js.LICENSE.txt} +3 -3
- package/__mf/js/async/6710.a94fd362.js +2 -0
- package/__mf/js/async/7958.f25f7332.js +7 -0
- package/__mf/js/async/9010.44bf2927.js +2 -0
- package/__mf/js/async/{1238.71fd7843.js → 9249.d90da2ad.js} +1 -1
- package/__mf/js/async/9389.29616aa6.js +2 -0
- package/__mf/js/async/9877.b76d1711.js +38 -0
- package/__mf/js/async/{__federation_expose_LokiDatasource.44ac1fa6.js → __federation_expose_LokiDatasource.3fe6141d.js} +2 -2
- package/__mf/js/async/{__federation_expose_LokiLogQuery.22f7c517.js → __federation_expose_LokiLogQuery.6591d0db.js} +1 -1
- package/__mf/js/async/{__federation_expose_LokiTimeSeriesQuery.4909566f.js → __federation_expose_LokiTimeSeriesQuery.2a9b451a.js} +1 -1
- package/__mf/js/{main.59f3d316.js → main.4d84b446.js} +3 -3
- package/lib/bootstrap.js +12 -0
- package/lib/bootstrap.js.map +1 -1
- package/lib/cjs/bootstrap.js +12 -0
- package/lib/cjs/components/complete.js +260 -34
- package/lib/cjs/components/index.js +1 -1
- package/lib/cjs/components/logql-editor.js +1 -1
- package/lib/cjs/components/logql-extension.js +1 -1
- package/lib/cjs/components/logql-highlight.js +1 -1
- package/lib/cjs/datasources/index.js +1 -1
- package/lib/cjs/datasources/loki-datasource/LokiDatasource.js +1 -1
- package/lib/cjs/datasources/loki-datasource/LokiDatasourceEditor.js +1 -1
- package/lib/cjs/datasources/loki-datasource/index.js +1 -1
- package/lib/cjs/datasources/loki-datasource/loki-datasource-types.js +1 -1
- package/lib/cjs/env.d.js +12 -0
- package/lib/cjs/getPluginModule.js +12 -0
- package/lib/cjs/index-federation.js +12 -0
- package/lib/cjs/index.js +12 -0
- package/lib/cjs/model/index.js +1 -1
- package/lib/cjs/model/loki-client-types.js +1 -1
- package/lib/cjs/model/loki-client.js +1 -1
- package/lib/cjs/model/loki-data-types.js +1 -1
- package/lib/cjs/model/loki-selectors.js +1 -1
- package/lib/cjs/queries/constants.js +12 -0
- package/lib/cjs/queries/index.js +1 -1
- package/lib/cjs/queries/loki-log-query/LokiLogQuery.js +12 -0
- package/lib/cjs/queries/loki-log-query/LokiLogQueryEditor.js +1 -1
- package/lib/cjs/queries/loki-log-query/get-loki-log-data.js +12 -0
- package/lib/cjs/queries/loki-log-query/index.js +12 -0
- package/lib/cjs/queries/loki-log-query/log-query-plugin-interface.js +12 -0
- package/lib/cjs/queries/loki-log-query/loki-log-query-types.js +12 -0
- package/lib/cjs/queries/loki-time-series-query/LokiTimeSeriesQuery.js +1 -1
- package/lib/cjs/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.js +1 -1
- package/lib/cjs/queries/loki-time-series-query/get-loki-time-series-data.js +1 -1
- package/lib/cjs/queries/loki-time-series-query/index.js +1 -1
- package/lib/cjs/queries/loki-time-series-query/loki-time-series-query-types.js +1 -1
- package/lib/cjs/queries/query-editor-model.js +1 -1
- package/lib/cjs/setup-tests.js +12 -0
- package/lib/components/complete.d.ts +5 -0
- package/lib/components/complete.d.ts.map +1 -1
- package/lib/components/complete.js +259 -33
- package/lib/components/complete.js.map +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/index.js.map +1 -1
- package/lib/components/logql-editor.js +1 -1
- package/lib/components/logql-editor.js.map +1 -1
- package/lib/components/logql-extension.js +1 -1
- package/lib/components/logql-extension.js.map +1 -1
- package/lib/components/logql-highlight.js +1 -1
- package/lib/components/logql-highlight.js.map +1 -1
- package/lib/datasources/index.js +1 -1
- package/lib/datasources/index.js.map +1 -1
- package/lib/datasources/loki-datasource/LokiDatasource.js +1 -1
- package/lib/datasources/loki-datasource/LokiDatasource.js.map +1 -1
- package/lib/datasources/loki-datasource/LokiDatasourceEditor.js +1 -1
- package/lib/datasources/loki-datasource/LokiDatasourceEditor.js.map +1 -1
- package/lib/datasources/loki-datasource/index.js +1 -1
- package/lib/datasources/loki-datasource/index.js.map +1 -1
- package/lib/datasources/loki-datasource/loki-datasource-types.js +1 -1
- package/lib/datasources/loki-datasource/loki-datasource-types.js.map +1 -1
- package/lib/env.d.js +12 -0
- package/lib/env.d.js.map +1 -1
- package/lib/getPluginModule.d.ts.map +1 -1
- package/lib/getPluginModule.js +12 -0
- package/lib/getPluginModule.js.map +1 -1
- package/lib/index-federation.js +12 -0
- package/lib/index-federation.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +12 -0
- package/lib/index.js.map +1 -1
- package/lib/model/index.js +1 -1
- package/lib/model/index.js.map +1 -1
- package/lib/model/loki-client-types.js +1 -1
- package/lib/model/loki-client-types.js.map +1 -1
- package/lib/model/loki-client.js +1 -1
- package/lib/model/loki-client.js.map +1 -1
- package/lib/model/loki-data-types.js +1 -1
- package/lib/model/loki-data-types.js.map +1 -1
- package/lib/model/loki-selectors.js +1 -1
- package/lib/model/loki-selectors.js.map +1 -1
- package/lib/queries/constants.d.ts.map +1 -1
- package/lib/queries/constants.js +12 -0
- package/lib/queries/constants.js.map +1 -1
- package/lib/queries/index.js +1 -1
- package/lib/queries/index.js.map +1 -1
- package/lib/queries/loki-log-query/LokiLogQuery.d.ts.map +1 -1
- package/lib/queries/loki-log-query/LokiLogQuery.js +12 -0
- package/lib/queries/loki-log-query/LokiLogQuery.js.map +1 -1
- package/lib/queries/loki-log-query/LokiLogQueryEditor.js +1 -1
- package/lib/queries/loki-log-query/LokiLogQueryEditor.js.map +1 -1
- package/lib/queries/loki-log-query/get-loki-log-data.d.ts.map +1 -1
- package/lib/queries/loki-log-query/get-loki-log-data.js +12 -0
- package/lib/queries/loki-log-query/get-loki-log-data.js.map +1 -1
- package/lib/queries/loki-log-query/index.d.ts.map +1 -1
- package/lib/queries/loki-log-query/index.js +12 -0
- package/lib/queries/loki-log-query/index.js.map +1 -1
- package/lib/queries/loki-log-query/log-query-plugin-interface.d.ts.map +1 -1
- package/lib/queries/loki-log-query/log-query-plugin-interface.js +12 -0
- package/lib/queries/loki-log-query/log-query-plugin-interface.js.map +1 -1
- package/lib/queries/loki-log-query/loki-log-query-types.d.ts.map +1 -1
- package/lib/queries/loki-log-query/loki-log-query-types.js +12 -0
- package/lib/queries/loki-log-query/loki-log-query-types.js.map +1 -1
- package/lib/queries/loki-time-series-query/LokiTimeSeriesQuery.js +1 -1
- package/lib/queries/loki-time-series-query/LokiTimeSeriesQuery.js.map +1 -1
- package/lib/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.js +1 -1
- package/lib/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.js.map +1 -1
- package/lib/queries/loki-time-series-query/get-loki-time-series-data.js +1 -1
- package/lib/queries/loki-time-series-query/get-loki-time-series-data.js.map +1 -1
- package/lib/queries/loki-time-series-query/index.js +1 -1
- package/lib/queries/loki-time-series-query/index.js.map +1 -1
- package/lib/queries/loki-time-series-query/loki-time-series-query-types.js +1 -1
- package/lib/queries/loki-time-series-query/loki-time-series-query-types.js.map +1 -1
- package/lib/queries/query-editor-model.js +1 -1
- package/lib/queries/query-editor-model.js.map +1 -1
- package/lib/setup-tests.d.ts.map +1 -1
- package/lib/setup-tests.js +12 -0
- package/lib/setup-tests.js.map +1 -1
- package/mf-manifest.json +46 -46
- package/mf-stats.json +46 -46
- package/package.json +6 -6
- package/__mf/js/async/1490.5aa6cbcc.js +0 -22
- package/__mf/js/async/1501.f1011a16.js +0 -1
- package/__mf/js/async/1728.516fcaaf.js +0 -1
- package/__mf/js/async/3849.89f86737.js +0 -7
- package/__mf/js/async/392.c0f9d49a.js +0 -2
- package/__mf/js/async/5440.3fedd5ea.js +0 -2
- package/__mf/js/async/5501.929e6257.js +0 -2
- package/__mf/js/async/6498.903f2a94.js +0 -2
- package/__mf/js/async/8035.8dab4893.js +0 -38
- package/__mf/js/async/9389.a8ea42a0.js +0 -2
- /package/__mf/js/async/{392.c0f9d49a.js.LICENSE.txt → 392.2c7c202d.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{1490.5aa6cbcc.js.LICENSE.txt → 54.b3492a7a.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{6498.903f2a94.js.LICENSE.txt → 6710.a94fd362.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{3849.89f86737.js.LICENSE.txt → 7958.f25f7332.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{5501.929e6257.js.LICENSE.txt → 9010.44bf2927.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{9389.a8ea42a0.js.LICENSE.txt → 9389.29616aa6.js.LICENSE.txt} +0 -0
- /package/__mf/js/async/{__federation_expose_LokiDatasource.44ac1fa6.js.LICENSE.txt → __federation_expose_LokiDatasource.3fe6141d.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-log-query/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-log-query/index.ts"],"names":[],"mappings":"AAaA,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the \"License\");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an \"AS IS\" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
1
13
|
export * from './get-loki-log-data';
|
|
2
14
|
export * from './LokiLogQuery';
|
|
3
15
|
export * from './LokiLogQueryEditor';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-log-query/index.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-log-query/index.ts"],"sourcesContent":["// Copyright 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 './get-loki-log-data';\nexport * from './LokiLogQuery';\nexport * from './LokiLogQueryEditor';\nexport * from './loki-log-query-types';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,sBAAsB;AACpC,cAAc,iBAAiB;AAC/B,cAAc,uBAAuB;AACrC,cAAc,yBAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"log-query-plugin-interface.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-log-query/log-query-plugin-interface.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"log-query-plugin-interface.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-log-query/log-query-plugin-interface.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAEtF,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,CAAC,EAAE;QACT,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,aAAa,EAAE,gBAAgB,CAAC;IAChC,eAAe,EAAE,eAAe,CAAC;CAClC;AAED,KAAK,0BAA0B,GAAG;IAChC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,MAAM,WAAW,cAAc,CAAC,IAAI,GAAG,WAAW,CAAE,SAAQ,MAAM,CAAC,IAAI,CAAC;IACtE,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IAC1E,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,KAAK,0BAA0B,CAAC;CAC9E"}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the \"License\");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an \"AS IS\" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
1
13
|
export { };
|
|
2
14
|
|
|
3
15
|
//# sourceMappingURL=log-query-plugin-interface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-log-query/log-query-plugin-interface.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-log-query/log-query-plugin-interface.ts"],"sourcesContent":["// Copyright 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 { LogData, AbsoluteTimeRange, UnknownSpec } from '@perses-dev/core';\nimport { DatasourceStore, Plugin, VariableStateMap } from '@perses-dev/plugin-system';\n\nexport interface LogQueryResult {\n logs: LogData;\n timeRange: AbsoluteTimeRange;\n metadata?: {\n executedQueryString: string;\n };\n}\n\nexport interface LogQueryContext {\n timeRange: AbsoluteTimeRange;\n variableState: VariableStateMap;\n datasourceStore: DatasourceStore;\n}\n\ntype LogQueryPluginDependencies = {\n variables?: string[];\n};\n\nexport interface LogQueryPlugin<Spec = UnknownSpec> extends Plugin<Spec> {\n getLogData: (spec: Spec, ctx: LogQueryContext) => Promise<LogQueryResult>;\n dependsOn?: (spec: Spec, ctx: LogQueryContext) => LogQueryPluginDependencies;\n}\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAuBjC,WAGC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loki-log-query-types.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-log-query/loki-log-query-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"loki-log-query-types.d.ts","sourceRoot":"","sources":["../../../../src/queries/loki-log-query/loki-log-query-types.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAE9E,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,SAAS,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CACpC;AAED,MAAM,MAAM,oBAAoB,GAAG,6BAA6B,CAAC"}
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the \"License\");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an \"AS IS\" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
1
13
|
export { };
|
|
2
14
|
|
|
3
15
|
//# sourceMappingURL=loki-log-query-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-log-query/loki-log-query-types.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-log-query/loki-log-query-types.ts"],"sourcesContent":["// Copyright 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 { DatasourceSelector } from '@perses-dev/core';\nimport { LokiQueryRangeStreamsResponse } from '../../model/loki-client-types';\n\nexport interface LokiLogQuerySpec {\n query: string;\n datasource?: DatasourceSelector;\n direction?: 'backward' | 'forward';\n}\n\nexport type LokiLogQueryResponse = LokiQueryRangeStreamsResponse;\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAWjC,WAAiE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/LokiTimeSeriesQuery.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/LokiTimeSeriesQuery.tsx"],"sourcesContent":["// Copyright 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 { TimeSeriesQueryPlugin, parseVariables } from '@perses-dev/plugin-system';\nimport { getLokiTimeSeriesData } from './get-loki-time-series-data';\nimport { LokiQueryEditor } from './LokiTimeSeriesQueryEditor';\nimport { LokiTimeSeriesQuerySpec } from './loki-time-series-query-types';\n\nexport const LokiTimeSeriesQuery: TimeSeriesQueryPlugin<LokiTimeSeriesQuerySpec> = {\n getTimeSeriesData: getLokiTimeSeriesData,\n OptionsEditorComponent: LokiQueryEditor,\n createInitialOptions: () => ({ query: '' }),\n dependsOn: (spec) => {\n const queryVariables = parseVariables(spec.query);\n const allVariables = [...new Set([...queryVariables])];\n return {\n variables: allVariables,\n };\n },\n};\n"],"names":["parseVariables","getLokiTimeSeriesData","LokiQueryEditor","LokiTimeSeriesQuery","getTimeSeriesData","OptionsEditorComponent","createInitialOptions","query","dependsOn","spec","queryVariables","allVariables","Set","variables"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAAgCA,cAAc,QAAQ,4BAA4B;AAClF,SAASC,qBAAqB,QAAQ,8BAA8B;AACpE,SAASC,eAAe,QAAQ,8BAA8B;AAG9D,OAAO,MAAMC,sBAAsE;IACjFC,mBAAmBH;IACnBI,wBAAwBH;IACxBI,sBAAsB,IAAO,CAAA;YAAEC,OAAO;QAAG,CAAA;IACzCC,WAAW,CAACC;QACV,MAAMC,iBAAiBV,eAAeS,KAAKF,KAAK;QAChD,MAAMI,eAAe;eAAI,IAAIC,IAAI;mBAAIF;aAAe;SAAE;QACtD,OAAO;YACLG,WAAWF;QACb;IACF;AACF,EAAE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright The Perses Authors
|
|
3
3
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
// you may not use this file except in compliance with the License.
|
|
5
5
|
// You may obtain a copy of the License at
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.tsx"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/LokiTimeSeriesQueryEditor.tsx"],"sourcesContent":["// Copyright 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 {\n DatasourceSelect,\n DatasourceSelectProps,\n isVariableDatasource,\n OptionsEditorProps,\n useDatasourceSelectValueToSelector,\n} from '@perses-dev/plugin-system';\nimport { InputLabel, Stack } from '@mui/material';\nimport { ReactElement, useCallback } from 'react';\nimport { produce } from 'immer';\nimport { LogQLEditor } from '../../components';\nimport { LOKI_DATASOURCE_KIND, LokiDatasourceSelector } from '../../model';\nimport { DATASOURCE_KIND, DEFAULT_DATASOURCE } from '../constants';\nimport { useQueryState } from '../query-editor-model';\nimport { LokiTimeSeriesQuerySpec } from './loki-time-series-query-types';\n\ntype LokiQueryEditorProps = OptionsEditorProps<LokiTimeSeriesQuerySpec>;\n\nexport function LokiQueryEditor(props: LokiQueryEditorProps): ReactElement {\n const { onChange, value } = props;\n const { datasource } = value;\n const datasourceSelectValue = datasource ?? DEFAULT_DATASOURCE;\n const selectedDatasource = useDatasourceSelectValueToSelector(\n datasourceSelectValue,\n LOKI_DATASOURCE_KIND\n ) as LokiDatasourceSelector;\n const { query, handleQueryChange, handleQueryBlur } = useQueryState(props);\n\n const handleDatasourceChange: DatasourceSelectProps['onChange'] = (newDatasourceSelection) => {\n if (!isVariableDatasource(newDatasourceSelection) && newDatasourceSelection.kind === DATASOURCE_KIND) {\n onChange(\n produce(value, (draft) => {\n draft.datasource = newDatasourceSelection;\n })\n );\n return;\n }\n\n throw new Error('Got unexpected non LokiQuery datasource selection');\n };\n\n // Immediate query execution on Enter or blur\n const handleQueryExecute = (query: string) => {\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n })\n );\n };\n\n const handleLogsQueryChange = useCallback(\n (e: string) => {\n handleQueryChange(e);\n },\n [handleQueryChange]\n );\n\n return (\n <Stack spacing={1.5} paddingBottom={1}>\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n Datasource\n </InputLabel>\n <DatasourceSelect\n datasourcePluginKind={DATASOURCE_KIND}\n value={selectedDatasource}\n onChange={handleDatasourceChange}\n label=\"Loki Datasource\"\n notched\n />\n </div>\n\n <div>\n <InputLabel\n sx={{\n display: 'block',\n marginBottom: '4px',\n fontWeight: 500,\n }}\n >\n LogQL Query\n </InputLabel>\n <LogQLEditor\n value={query}\n onChange={handleLogsQueryChange}\n onBlur={handleQueryBlur}\n onKeyDown={(event) => {\n if (event.key === 'Enter' && (event.ctrlKey || event.metaKey)) {\n event.preventDefault();\n handleQueryExecute(query);\n }\n }}\n placeholder='Enter LogQL query (e.g. {job=\"mysql\"} |= \"error\")'\n // height=\"120px\"\n />\n </div>\n </Stack>\n );\n}\n"],"names":["DatasourceSelect","isVariableDatasource","useDatasourceSelectValueToSelector","InputLabel","Stack","useCallback","produce","LogQLEditor","LOKI_DATASOURCE_KIND","DATASOURCE_KIND","DEFAULT_DATASOURCE","useQueryState","LokiQueryEditor","props","onChange","value","datasource","datasourceSelectValue","selectedDatasource","query","handleQueryChange","handleQueryBlur","handleDatasourceChange","newDatasourceSelection","kind","draft","Error","handleQueryExecute","handleLogsQueryChange","e","spacing","paddingBottom","div","sx","display","marginBottom","fontWeight","datasourcePluginKind","label","notched","onBlur","on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GrB,qBACE,MAAChB;QAAM0B,SAAS;QAAKC,eAAe;;0BAClC,MAACC;;kCACC,KAAC7B;wBACC8B,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAACpC;wBACCqC,sBAAsB5B;wBACtBM,OAAOG;wBACPJ,UAAUQ;wBACVgB,OAAM;wBACNC,OAAO;;;;0BAIX,MAACP;;kCACC,KAAC7B;wBACC8B,IAAI;4BACFC,SAAS;4BACTC,cAAc;4BACdC,YAAY;wBACd;kCACD;;kCAGD,KAAC7B;wBACCQ,OAAOI;wBACPL,UAAUc;wBACVY,QAAQnB;wBACRoB,WAAW,CAACC;4BACV,IAAIA,MAAMC,GAAG,KAAK,WAAYD,CAAAA,MAAME,OAAO,IAAIF,MAAMG,OAAO,AAAD,GAAI;gCAC7DH,MAAMI,cAAc;gCACpBnB,mBAAmBR;4BACrB;wBACF;wBACA4B,aAAY;;;;;;AAMtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/get-loki-time-series-data.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/get-loki-time-series-data.ts"],"sourcesContent":["// Copyright 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 { TimeSeries, DurationString, parseDurationString } from '@perses-dev/core';\nimport { TimeSeriesQueryPlugin, replaceVariables } from '@perses-dev/plugin-system';\nimport { milliseconds } from 'date-fns';\nimport { LokiClient } from '../../model/loki-client';\nimport { LokiMatrixResult } from '../../model/loki-client-types';\nimport { DEFAULT_DATASOURCE } from '../constants';\nimport { LokiTimeSeriesQuerySpec, LokiTimeSeriesQueryResponse } from './loki-time-series-query-types';\n\nexport type LokiMatrixResponse = {\n resultType: 'matrix';\n result: LokiMatrixResult[];\n};\n\n// Constants for Loki step calculation\nconst MAX_LOKI_DATA_POINTS = 10000; // Similar to Prometheus\nconst DEFAULT_MIN_STEP_SECONDS = 15; // 15 seconds default minimum\n\n/**\n * Converts a duration string (like \"15s\", \"1m\") to seconds\n */\nfunction getDurationStringSeconds(durationString?: DurationString): number | undefined {\n if (!durationString) return undefined;\n\n const duration = parseDurationString(durationString);\n const ms = milliseconds(duration);\n return Math.floor(ms / 1000);\n}\n\n/**\n * Calculates appropriate step for Loki range queries\n */\nfunction getLokiRangeStep(\n startMs: number,\n endMs: number,\n minStepSeconds = DEFAULT_MIN_STEP_SECONDS,\n suggestedStepMs = 0\n): number {\n const suggestedStepSeconds = suggestedStepMs / 1000;\n const queryRangeSeconds = (endMs - startMs) / 1000;\n\n let safeStep = queryRangeSeconds / MAX_LOKI_DATA_POINTS;\n if (safeStep > 1) {\n safeStep = Math.ceil(safeStep);\n }\n\n return Math.max(suggestedStepSeconds, minStepSeconds, safeStep);\n}\n\n/**\n * Formats step in seconds as a duration string for Loki API\n */\nfunction formatStepForLoki(stepSeconds: number): string {\n if (stepSeconds < 60) {\n return `${Math.round(stepSeconds)}s`;\n } else if (stepSeconds < 3600) {\n return `${Math.round(stepSeconds / 60)}m`;\n } else {\n return `${Math.round(stepSeconds / 3600)}h`;\n }\n}\n\nfunction convertMatrixToTimeSeries(matrix: LokiMatrixResult[]): TimeSeries[] {\n return matrix.map((series) => {\n const name = Object.entries(series.metric)\n .map(([k, v]) => `${k}=${v}`)\n .join(', ');\n return {\n name,\n values: series.values.map(([timestamp, value]) => [\n Number(timestamp) * 1000, // Convert seconds to milliseconds\n Number(value),\n ]),\n labels: series.metric,\n };\n });\n}\n\nexport const getLokiTimeSeriesData: TimeSeriesQueryPlugin<LokiTimeSeriesQuerySpec>['getTimeSeriesData'] = async (\n spec,\n context\n) => {\n if (!spec.query) {\n return {\n series: [],\n timeRange: { start: context.timeRange.start, end: context.timeRange.end },\n stepMs: DEFAULT_MIN_STEP_SECONDS * 1000,\n };\n }\n\n const query = replaceVariables(spec.query, context.variableState);\n const client = (await context.datasourceStore.getDatasourceClient<LokiClient>(\n spec.datasource ?? DEFAULT_DATASOURCE\n )) as LokiClient;\n\n const { start, end } = context.timeRange;\n\n // Calculate proper step using similar logic to Prometheus\n const minStepSeconds = spec.step\n ? (getDurationStringSeconds(spec.step as DurationString) ?? DEFAULT_MIN_STEP_SECONDS)\n : DEFAULT_MIN_STEP_SECONDS;\n const stepSeconds = getLokiRangeStep(start.getTime(), end.getTime(), minStepSeconds, context.suggestedStepMs);\n const stepString = formatStepForLoki(stepSeconds);\n const stepMs = stepSeconds * 1000;\n\n const response: LokiTimeSeriesQueryResponse = await client.queryRange({\n query,\n start: start.getTime().toString(),\n end: end.getTime().toString(),\n step: stepString,\n });\n\n if (response.data.resultType === 'matrix') {\n const convertedSeries = convertMatrixToTimeSeries(response.data.result as LokiMatrixResult[]);\n\n return {\n series: convertedSeries,\n timeRange: { start, end },\n stepMs,\n metadata: {\n executedQueryString: query,\n },\n };\n }\n\n return {\n series: [],\n timeRange: { start, end },\n stepMs,\n };\n};\n"],"names":["parseDurationString","replaceVariables","milliseconds","DEFAULT_DATASOURCE","MAX_LOKI_DATA_POINTS","DEFAULT_MIN_STEP_SECONDS","getDurationStringSeconds","durationString","undefined","duration","ms","Math","floor","getLokiRangeStep","startMs","endMs","minStepSeconds","suggestedStepMs","suggestedStepSeconds","queryRangeSeconds","safeStep","ceil","max","formatStepForLoki","stepSeconds","round","convertMatrixToTimeSeries","matrix","map","series","name","Object","entries","metric","k","v","join","values","timestamp","value","Number","labels","getLokiTimeSeriesData","spec","context","query","timeRange","start","end","stepMs","variableState","client","datasourceStore","getDatasourceClient","datasource","step","getTime","stepString","response","queryRange","toString","data","resultType","convertedSeries","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,MAAMS,OAAO,GAAGI,QAAQ;QAC/BZ,KAAKA,IAAIQ,OAAO,GAAGI,QAAQ;QAC3BL,MAAME;IACR;IAEA,IAAIC,SAASG,IAAI,CAACC,UAAU,KAAK,UAAU;QACzC,MAAMC,kBAAkBrC,0BAA0BgC,SAASG,IAAI,CAACG,MAAM;QAEtE,OAAO;YACLnC,QAAQkC;YACRjB,WAAW;gBAAEC;gBAAOC;YAAI;YACxBC;YACAgB,UAAU;gBACRC,qBAAqBrB;YACvB;QACF;IACF;IAEA,OAAO;QACLhB,QAAQ,EAAE;QACViB,WAAW;YAAEC;YAAOC;QAAI;QACxBC;IACF;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/index.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/index.ts"],"sourcesContent":["// Copyright 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 './get-loki-time-series-data';\nexport * from './LokiTimeSeriesQuery';\nexport * from './LokiTimeSeriesQueryEditor';\nexport * from './loki-time-series-query-types';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,8BAA8B;AAC5C,cAAc,wBAAwB;AACtC,cAAc,8BAA8B;AAC5C,cAAc,iCAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/loki-time-series-query-types.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../../src/queries/loki-time-series-query/loki-time-series-query-types.ts"],"sourcesContent":["// Copyright 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 { DatasourceSelector } from '@perses-dev/core';\nimport { LokiQueryRangeMatrixResponse } from '../../model/loki-client-types';\n\nexport interface LokiTimeSeriesQuerySpec {\n query: string;\n datasource?: DatasourceSelector;\n step?: string;\n}\n\nexport type LokiTimeSeriesQueryResponse = LokiQueryRangeMatrixResponse;\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAWjC,WAAuE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/queries/query-editor-model.ts"],"sourcesContent":["// Copyright
|
|
1
|
+
{"version":3,"sources":["../../../src/queries/query-editor-model.ts"],"sourcesContent":["// Copyright 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 { useState } from 'react';\nimport { produce } from 'immer';\nimport { OptionsEditorProps } from '@perses-dev/plugin-system';\n\n/**\n * Generic type for any Loki query spec that has a query field\n */\ntype LokiQuerySpec = {\n query: string;\n};\n\n/**\n * A hook for managing the `query` state in Loki query specs. Returns the `query` value, along with\n * `onChange` and `onBlur` event handlers to the input. Keeps a local copy of the user's input and only syncs those\n * changes with the overall spec value once the input is blurred to prevent re-running queries in the panel's preview\n * every time the user types.\n */\nexport function useQueryState<T extends LokiQuerySpec>(\n props: OptionsEditorProps<T>\n): {\n query: string;\n handleQueryChange: (e: string) => void;\n handleQueryBlur: () => void;\n} {\n const { onChange, value } = props;\n\n // Local copy of the query's value\n const [query, setQuery] = useState(value.query);\n\n // This is basically \"getDerivedStateFromProps\" to make sure if spec's value changes external to this component,\n // we render with the latest value\n const [lastSyncedQuery, setLastSyncedQuery] = useState(value.query);\n if (value.query !== lastSyncedQuery) {\n setQuery(value.query);\n setLastSyncedQuery(value.query);\n }\n\n // Update our local state's copy as the user types\n const handleQueryChange = (e: string): void => {\n setQuery(e);\n };\n\n // Propagate changes to the query's value when the input is blurred to avoid constantly re-running queries in the\n // PanelPreview\n const handleQueryBlur = (): void => {\n setLastSyncedQuery(query);\n onChange(\n produce(value, (draft) => {\n draft.query = query;\n })\n );\n };\n\n return { query, handleQueryChange, handleQueryBlur };\n}\n"],"names":["useState","produce","useQueryState","props","onChange","value","query","setQuery","lastSyncedQuery","setLastSyncedQuery","handleQueryChange","e","handleQueryBlur","draft"],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,QAAQ,QAAQ,QAAQ;AACjC,SAASC,OAAO,QAAQ,QAAQ;AAUhC;;;;;CAKC,GACD,OAAO,SAASC,cACdC,KAA4B;IAM5B,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAE5B,kCAAkC;IAClC,MAAM,CAACG,OAAOC,SAAS,GAAGP,SAASK,MAAMC,KAAK;IAE9C,gHAAgH;IAChH,kCAAkC;IAClC,MAAM,CAACE,iBAAiBC,mBAAmB,GAAGT,SAASK,MAAMC,KAAK;IAClE,IAAID,MAAMC,KAAK,KAAKE,iBAAiB;QACnCD,SAASF,MAAMC,KAAK;QACpBG,mBAAmBJ,MAAMC,KAAK;IAChC;IAEA,kDAAkD;IAClD,MAAMI,oBAAoB,CAACC;QACzBJ,SAASI;IACX;IAEA,iHAAiH;IACjH,eAAe;IACf,MAAMC,kBAAkB;QACtBH,mBAAmBH;QACnBF,SACEH,QAAQI,OAAO,CAACQ;YACdA,MAAMP,KAAK,GAAGA;QAChB;IAEJ;IAEA,OAAO;QAAEA;QAAOI;QAAmBE;IAAgB;AACrD"}
|
package/lib/setup-tests.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-tests.d.ts","sourceRoot":"","sources":["../../src/setup-tests.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup-tests.d.ts","sourceRoot":"","sources":["../../src/setup-tests.ts"],"names":[],"mappings":"AAaA,OAAO,2BAA2B,CAAC"}
|
package/lib/setup-tests.js
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
// Copyright The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the \"License\");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an \"AS IS\" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
1
13
|
import '@testing-library/jest-dom';
|
|
2
14
|
// Always mock e-charts during tests since we don't have a proper canvas in jsdom
|
|
3
15
|
jest.mock('echarts/core');
|
package/lib/setup-tests.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/setup-tests.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/setup-tests.ts"],"sourcesContent":["// Copyright 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 '@testing-library/jest-dom';\n\n// Always mock e-charts during tests since we don't have a proper canvas in jsdom\njest.mock('echarts/core');\n"],"names":["jest","mock"],"mappings":"AAAA,+BAA+B;AAC/B,oEAAoE;AACpE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,sEAAsE;AACtE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,4BAA4B;AAEnC,iFAAiF;AACjFA,KAAKC,IAAI,CAAC"}
|
package/mf-manifest.json
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
"name": "Loki",
|
|
6
6
|
"type": "app",
|
|
7
7
|
"buildInfo": {
|
|
8
|
-
"buildVersion": "0.5.0
|
|
8
|
+
"buildVersion": "0.5.0",
|
|
9
9
|
"buildName": "@perses-dev/loki-plugin"
|
|
10
10
|
},
|
|
11
11
|
"remoteEntry": {
|
|
12
|
-
"name": "__mf/js/Loki.
|
|
12
|
+
"name": "__mf/js/Loki.2bd94c1e.js",
|
|
13
13
|
"path": "",
|
|
14
14
|
"type": "global"
|
|
15
15
|
},
|
|
@@ -87,14 +87,14 @@
|
|
|
87
87
|
{
|
|
88
88
|
"id": "Loki:@perses-dev/components",
|
|
89
89
|
"name": "@perses-dev/components",
|
|
90
|
-
"version": "0.53.0
|
|
90
|
+
"version": "0.53.0",
|
|
91
91
|
"singleton": true,
|
|
92
|
-
"requiredVersion": "^0.53.0
|
|
92
|
+
"requiredVersion": "^0.53.0",
|
|
93
93
|
"assets": {
|
|
94
94
|
"js": {
|
|
95
95
|
"async": [],
|
|
96
96
|
"sync": [
|
|
97
|
-
"__mf/js/async/
|
|
97
|
+
"__mf/js/async/7958.f25f7332.js"
|
|
98
98
|
]
|
|
99
99
|
},
|
|
100
100
|
"css": {
|
|
@@ -106,14 +106,14 @@
|
|
|
106
106
|
{
|
|
107
107
|
"id": "Loki:@perses-dev/dashboards",
|
|
108
108
|
"name": "@perses-dev/dashboards",
|
|
109
|
-
"version": "0.53.0
|
|
109
|
+
"version": "0.53.0",
|
|
110
110
|
"singleton": true,
|
|
111
|
-
"requiredVersion": "^0.53.0
|
|
111
|
+
"requiredVersion": "^0.53.0",
|
|
112
112
|
"assets": {
|
|
113
113
|
"js": {
|
|
114
114
|
"async": [],
|
|
115
115
|
"sync": [
|
|
116
|
-
"__mf/js/async/
|
|
116
|
+
"__mf/js/async/54.b3492a7a.js"
|
|
117
117
|
]
|
|
118
118
|
},
|
|
119
119
|
"css": {
|
|
@@ -125,14 +125,14 @@
|
|
|
125
125
|
{
|
|
126
126
|
"id": "Loki:@perses-dev/explore",
|
|
127
127
|
"name": "@perses-dev/explore",
|
|
128
|
-
"version": "0.53.0
|
|
128
|
+
"version": "0.53.0",
|
|
129
129
|
"singleton": true,
|
|
130
|
-
"requiredVersion": "^0.53.0
|
|
130
|
+
"requiredVersion": "^0.53.0",
|
|
131
131
|
"assets": {
|
|
132
132
|
"js": {
|
|
133
133
|
"async": [],
|
|
134
134
|
"sync": [
|
|
135
|
-
"__mf/js/async/1728.
|
|
135
|
+
"__mf/js/async/1728.326f0c08.js"
|
|
136
136
|
]
|
|
137
137
|
},
|
|
138
138
|
"css": {
|
|
@@ -144,14 +144,14 @@
|
|
|
144
144
|
{
|
|
145
145
|
"id": "Loki:@perses-dev/plugin-system",
|
|
146
146
|
"name": "@perses-dev/plugin-system",
|
|
147
|
-
"version": "0.53.0
|
|
147
|
+
"version": "0.53.0",
|
|
148
148
|
"singleton": true,
|
|
149
|
-
"requiredVersion": "^0.53.0
|
|
149
|
+
"requiredVersion": "^0.53.0",
|
|
150
150
|
"assets": {
|
|
151
151
|
"js": {
|
|
152
152
|
"async": [],
|
|
153
153
|
"sync": [
|
|
154
|
-
"__mf/js/async/
|
|
154
|
+
"__mf/js/async/9010.44bf2927.js"
|
|
155
155
|
]
|
|
156
156
|
},
|
|
157
157
|
"css": {
|
|
@@ -220,14 +220,14 @@
|
|
|
220
220
|
{
|
|
221
221
|
"id": "Loki:lodash",
|
|
222
222
|
"name": "lodash",
|
|
223
|
-
"version": "4.17.
|
|
223
|
+
"version": "4.17.23",
|
|
224
224
|
"singleton": true,
|
|
225
|
-
"requiredVersion": "^4.17.
|
|
225
|
+
"requiredVersion": "^4.17.23",
|
|
226
226
|
"assets": {
|
|
227
227
|
"js": {
|
|
228
228
|
"async": [],
|
|
229
229
|
"sync": [
|
|
230
|
-
"__mf/js/async/392.
|
|
230
|
+
"__mf/js/async/392.2c7c202d.js"
|
|
231
231
|
]
|
|
232
232
|
},
|
|
233
233
|
"css": {
|
|
@@ -277,14 +277,14 @@
|
|
|
277
277
|
{
|
|
278
278
|
"id": "Loki:react-router-dom",
|
|
279
279
|
"name": "react-router-dom",
|
|
280
|
-
"version": "6.30.
|
|
280
|
+
"version": "6.30.3",
|
|
281
281
|
"singleton": true,
|
|
282
|
-
"requiredVersion": "^6.30.
|
|
282
|
+
"requiredVersion": "^6.30.3",
|
|
283
283
|
"assets": {
|
|
284
284
|
"js": {
|
|
285
285
|
"async": [],
|
|
286
286
|
"sync": [
|
|
287
|
-
"__mf/js/async/5440.
|
|
287
|
+
"__mf/js/async/5440.995ad0c5.js"
|
|
288
288
|
]
|
|
289
289
|
},
|
|
290
290
|
"css": {
|
|
@@ -340,24 +340,24 @@
|
|
|
340
340
|
"assets": {
|
|
341
341
|
"js": {
|
|
342
342
|
"sync": [
|
|
343
|
-
"__mf/js/async/__federation_expose_LokiDatasource.
|
|
343
|
+
"__mf/js/async/__federation_expose_LokiDatasource.3fe6141d.js"
|
|
344
344
|
],
|
|
345
345
|
"async": [
|
|
346
346
|
"__mf/js/async/1825.5005b3af.js",
|
|
347
347
|
"__mf/js/async/9754.5d7b21c2.js",
|
|
348
348
|
"__mf/js/async/8988.1c565f12.js",
|
|
349
|
-
"__mf/js/async/9389.
|
|
350
|
-
"__mf/js/async/
|
|
351
|
-
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.
|
|
349
|
+
"__mf/js/async/9389.29616aa6.js",
|
|
350
|
+
"__mf/js/async/1750.eba509e1.js",
|
|
351
|
+
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.2a9b451a.js",
|
|
352
352
|
"__mf/js/async/4466.21ddc88c.js",
|
|
353
353
|
"__mf/js/async/6100.e2898f9c.js",
|
|
354
|
-
"__mf/js/async/__federation_expose_LokiLogQuery.
|
|
355
|
-
"__mf/js/async/
|
|
354
|
+
"__mf/js/async/__federation_expose_LokiLogQuery.6591d0db.js",
|
|
355
|
+
"__mf/js/async/9249.d90da2ad.js",
|
|
356
356
|
"__mf/js/async/9836.de786d07.js",
|
|
357
|
-
"__mf/js/async/
|
|
357
|
+
"__mf/js/async/6710.a94fd362.js",
|
|
358
358
|
"__mf/js/async/1811.a291a38b.js",
|
|
359
359
|
"__mf/js/async/3059.cb101ca2.js",
|
|
360
|
-
"__mf/js/async/
|
|
360
|
+
"__mf/js/async/9877.b76d1711.js",
|
|
361
361
|
"__mf/js/async/9588.2d82f477.js",
|
|
362
362
|
"__mf/js/async/5071.a03a64fd.js",
|
|
363
363
|
"__mf/js/async/2043.eb7e1c61.js",
|
|
@@ -384,27 +384,27 @@
|
|
|
384
384
|
"__mf/js/async/1825.5005b3af.js",
|
|
385
385
|
"__mf/js/async/9754.5d7b21c2.js",
|
|
386
386
|
"__mf/js/async/8988.1c565f12.js",
|
|
387
|
-
"__mf/js/async/9389.
|
|
388
|
-
"__mf/js/async/
|
|
389
|
-
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.
|
|
387
|
+
"__mf/js/async/9389.29616aa6.js",
|
|
388
|
+
"__mf/js/async/1750.eba509e1.js",
|
|
389
|
+
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.2a9b451a.js"
|
|
390
390
|
],
|
|
391
391
|
"async": [
|
|
392
392
|
"__mf/js/async/9588.2d82f477.js",
|
|
393
393
|
"__mf/js/async/5071.a03a64fd.js",
|
|
394
|
-
"__mf/js/async/
|
|
394
|
+
"__mf/js/async/9249.d90da2ad.js",
|
|
395
395
|
"__mf/js/async/9836.de786d07.js",
|
|
396
|
-
"__mf/js/async/
|
|
396
|
+
"__mf/js/async/6710.a94fd362.js",
|
|
397
397
|
"__mf/js/async/1811.a291a38b.js",
|
|
398
398
|
"__mf/js/async/4466.21ddc88c.js",
|
|
399
399
|
"__mf/js/async/1825.5005b3af.js",
|
|
400
400
|
"__mf/js/async/9754.5d7b21c2.js",
|
|
401
401
|
"__mf/js/async/6100.e2898f9c.js",
|
|
402
402
|
"__mf/js/async/8988.1c565f12.js",
|
|
403
|
-
"__mf/js/async/9389.
|
|
404
|
-
"__mf/js/async/
|
|
405
|
-
"__mf/js/async/__federation_expose_LokiLogQuery.
|
|
403
|
+
"__mf/js/async/9389.29616aa6.js",
|
|
404
|
+
"__mf/js/async/1750.eba509e1.js",
|
|
405
|
+
"__mf/js/async/__federation_expose_LokiLogQuery.6591d0db.js",
|
|
406
406
|
"__mf/js/async/3059.cb101ca2.js",
|
|
407
|
-
"__mf/js/async/
|
|
407
|
+
"__mf/js/async/9877.b76d1711.js",
|
|
408
408
|
"__mf/js/async/2043.eb7e1c61.js",
|
|
409
409
|
"__mf/js/async/7177.b50a1c64.js",
|
|
410
410
|
"__mf/js/async/1969.53d223ca.js",
|
|
@@ -431,23 +431,23 @@
|
|
|
431
431
|
"__mf/js/async/4466.21ddc88c.js",
|
|
432
432
|
"__mf/js/async/6100.e2898f9c.js",
|
|
433
433
|
"__mf/js/async/8988.1c565f12.js",
|
|
434
|
-
"__mf/js/async/9389.
|
|
435
|
-
"__mf/js/async/
|
|
436
|
-
"__mf/js/async/__federation_expose_LokiLogQuery.
|
|
434
|
+
"__mf/js/async/9389.29616aa6.js",
|
|
435
|
+
"__mf/js/async/1750.eba509e1.js",
|
|
436
|
+
"__mf/js/async/__federation_expose_LokiLogQuery.6591d0db.js"
|
|
437
437
|
],
|
|
438
438
|
"async": [
|
|
439
|
-
"__mf/js/async/
|
|
439
|
+
"__mf/js/async/9249.d90da2ad.js",
|
|
440
440
|
"__mf/js/async/9836.de786d07.js",
|
|
441
|
-
"__mf/js/async/
|
|
441
|
+
"__mf/js/async/6710.a94fd362.js",
|
|
442
442
|
"__mf/js/async/1811.a291a38b.js",
|
|
443
443
|
"__mf/js/async/3059.cb101ca2.js",
|
|
444
444
|
"__mf/js/async/1825.5005b3af.js",
|
|
445
445
|
"__mf/js/async/9754.5d7b21c2.js",
|
|
446
446
|
"__mf/js/async/8988.1c565f12.js",
|
|
447
|
-
"__mf/js/async/9389.
|
|
448
|
-
"__mf/js/async/
|
|
449
|
-
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.
|
|
450
|
-
"__mf/js/async/
|
|
447
|
+
"__mf/js/async/9389.29616aa6.js",
|
|
448
|
+
"__mf/js/async/1750.eba509e1.js",
|
|
449
|
+
"__mf/js/async/__federation_expose_LokiTimeSeriesQuery.2a9b451a.js",
|
|
450
|
+
"__mf/js/async/9877.b76d1711.js",
|
|
451
451
|
"__mf/js/async/9588.2d82f477.js",
|
|
452
452
|
"__mf/js/async/5071.a03a64fd.js",
|
|
453
453
|
"__mf/js/async/2043.eb7e1c61.js",
|