@perses-dev/plugin-system 0.51.0-rc.0 → 0.51.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/dist/cjs/components/DatasourceSelect.js +8 -10
- package/dist/cjs/components/HTTPSettingsEditor/HTTPSettingsEditor.js +5 -2
- package/dist/cjs/components/MultiQueryEditor/MultiQueryEditor.js +1 -1
- package/dist/cjs/components/PanelSpecEditor/PanelSpecEditor.js +2 -2
- package/dist/cjs/components/Variables/variable-model.js +4 -2
- package/dist/cjs/remote/PluginRuntime.js +18 -10
- package/dist/cjs/runtime/time-series-queries.js +2 -1
- package/dist/cjs/test/render-hook.js +31 -0
- package/dist/cjs/test/render.js +4 -21
- package/dist/cjs/test/utils.js +49 -0
- package/dist/components/DatasourceSelect.d.ts +13 -1
- package/dist/components/DatasourceSelect.d.ts.map +1 -1
- package/dist/components/DatasourceSelect.js +2 -2
- package/dist/components/DatasourceSelect.js.map +1 -1
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.d.ts.map +1 -1
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js +5 -2
- package/dist/components/HTTPSettingsEditor/HTTPSettingsEditor.js.map +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js +1 -1
- package/dist/components/MultiQueryEditor/MultiQueryEditor.js.map +1 -1
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js +2 -2
- package/dist/components/PanelSpecEditor/PanelSpecEditor.js.map +1 -1
- package/dist/components/Variables/variable-model.d.ts.map +1 -1
- package/dist/components/Variables/variable-model.js +4 -2
- package/dist/components/Variables/variable-model.js.map +1 -1
- package/dist/remote/PluginRuntime.d.ts.map +1 -1
- package/dist/remote/PluginRuntime.js +18 -10
- package/dist/remote/PluginRuntime.js.map +1 -1
- package/dist/runtime/time-series-queries.d.ts +1 -1
- package/dist/runtime/time-series-queries.d.ts.map +1 -1
- package/dist/runtime/time-series-queries.js +3 -2
- package/dist/runtime/time-series-queries.js.map +1 -1
- package/dist/test/render-hook.d.ts +8 -0
- package/dist/test/render-hook.d.ts.map +1 -0
- package/dist/test/render-hook.js +26 -0
- package/dist/test/render-hook.js.map +1 -0
- package/dist/test/render.d.ts +1 -5
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +4 -21
- package/dist/test/render.js.map +1 -1
- package/dist/test/utils.d.ts +9 -0
- package/dist/test/utils.d.ts.map +1 -0
- package/dist/test/utils.js +41 -0
- package/dist/test/utils.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { renderHook } from '@testing-library/react';
|
|
14
|
+
import { getTestContextWrapper } from './utils';
|
|
15
|
+
/**
|
|
16
|
+
* Test helper to render a React hook with common app-level providers, including the PluginRegistry,
|
|
17
|
+
* wrapped around it. Useful for testing hooks that rely on context such as QueryClientProvider or PluginRegistry.
|
|
18
|
+
*/ export function renderHookWithContext(callback, contextOptions, renderHookOptions) {
|
|
19
|
+
const wrapper = getTestContextWrapper(contextOptions);
|
|
20
|
+
return renderHook(callback, {
|
|
21
|
+
wrapper,
|
|
22
|
+
...renderHookOptions
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=render-hook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/test/render-hook.tsx"],"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 { renderHook, RenderHookOptions, RenderHookResult } from '@testing-library/react';\nimport { ContextOptions, getTestContextWrapper } from './utils';\n\n/**\n * Test helper to render a React hook with common app-level providers, including the PluginRegistry,\n * wrapped around it. Useful for testing hooks that rely on context such as QueryClientProvider or PluginRegistry.\n */\nexport function renderHookWithContext<TProps, TResult>(\n callback: (props: TProps) => TResult,\n contextOptions?: ContextOptions,\n renderHookOptions?: Omit<RenderHookOptions<TProps>, 'wrapper'>\n): RenderHookResult<TResult, TProps> {\n const wrapper = getTestContextWrapper(contextOptions);\n return renderHook(callback, { wrapper, ...renderHookOptions });\n}\n"],"names":["renderHook","getTestContextWrapper","renderHookWithContext","callback","contextOptions","renderHookOptions","wrapper"],"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,UAAU,QAA6C,yBAAyB;AACzF,SAAyBC,qBAAqB,QAAQ,UAAU;AAEhE;;;CAGC,GACD,OAAO,SAASC,sBACdC,QAAoC,EACpCC,cAA+B,EAC/BC,iBAA8D;IAE9D,MAAMC,UAAUL,sBAAsBG;IACtC,OAAOJ,WAAWG,UAAU;QAAEG;QAAS,GAAGD,iBAAiB;IAAC;AAC9D"}
|
package/dist/test/render.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { RenderOptions, RenderResult } from '@testing-library/react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
type ContextOptions = {
|
|
5
|
-
defaultPluginKinds?: DefaultPluginKinds;
|
|
6
|
-
};
|
|
3
|
+
import { ContextOptions } from './utils';
|
|
7
4
|
/**
|
|
8
5
|
* Test helper to render a React component with some common app-level providers, as well as the PluginRegistry
|
|
9
6
|
* wrapped around it.
|
|
10
7
|
*/
|
|
11
8
|
export declare function renderWithContext(ui: ReactNode, renderOptions?: Omit<RenderOptions, 'queries'>, contextOptions?: ContextOptions): RenderResult;
|
|
12
|
-
export {};
|
|
13
9
|
//# sourceMappingURL=render.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/test/render.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAU,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/test/render.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAU,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,cAAc,EAAyB,MAAM,SAAS,CAAC;AAEhE;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,SAAS,EACb,aAAa,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,EAC9C,cAAc,CAAC,EAAE,cAAc,GAC9B,YAAY,CAGd"}
|
package/dist/test/render.js
CHANGED
|
@@ -12,31 +12,14 @@
|
|
|
12
12
|
// limitations under the License.
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { render } from '@testing-library/react';
|
|
15
|
-
import {
|
|
16
|
-
import { PluginRegistry } from '../components/PluginRegistry';
|
|
17
|
-
import { testPluginLoader } from './test-plugins';
|
|
15
|
+
import { getTestContextWrapper } from './utils';
|
|
18
16
|
/**
|
|
19
17
|
* Test helper to render a React component with some common app-level providers, as well as the PluginRegistry
|
|
20
18
|
* wrapped around it.
|
|
21
19
|
*/ export function renderWithContext(ui, renderOptions, contextOptions) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
queries: {
|
|
26
|
-
refetchOnWindowFocus: false,
|
|
27
|
-
retry: false
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
return render(/*#__PURE__*/ _jsx(QueryClientProvider, {
|
|
32
|
-
client: queryClient,
|
|
33
|
-
children: /*#__PURE__*/ _jsx(PluginRegistry, {
|
|
34
|
-
pluginLoader: testPluginLoader,
|
|
35
|
-
defaultPluginKinds: contextOptions?.defaultPluginKinds ?? {
|
|
36
|
-
TimeSeriesQuery: 'PrometheusTimeSeriesQuery'
|
|
37
|
-
},
|
|
38
|
-
children: ui
|
|
39
|
-
})
|
|
20
|
+
const Wrapper = getTestContextWrapper(contextOptions);
|
|
21
|
+
return render(/*#__PURE__*/ _jsx(Wrapper, {
|
|
22
|
+
children: ui
|
|
40
23
|
}), renderOptions);
|
|
41
24
|
}
|
|
42
25
|
|
package/dist/test/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/test/render.tsx"],"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 { render, RenderOptions, RenderResult } from '@testing-library/react';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/test/render.tsx"],"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 { render, RenderOptions, RenderResult } from '@testing-library/react';\nimport { ReactNode } from 'react';\nimport { ContextOptions, getTestContextWrapper } from './utils';\n\n/**\n * Test helper to render a React component with some common app-level providers, as well as the PluginRegistry\n * wrapped around it.\n */\nexport function renderWithContext(\n ui: ReactNode,\n renderOptions?: Omit<RenderOptions, 'queries'>,\n contextOptions?: ContextOptions\n): RenderResult {\n const Wrapper = getTestContextWrapper(contextOptions);\n return render(<Wrapper>{ui}</Wrapper>, renderOptions);\n}\n"],"names":["render","getTestContextWrapper","renderWithContext","ui","renderOptions","contextOptions","Wrapper"],"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,QAAqC,yBAAyB;AAE7E,SAAyBC,qBAAqB,QAAQ,UAAU;AAEhE;;;CAGC,GACD,OAAO,SAASC,kBACdC,EAAa,EACbC,aAA8C,EAC9CC,cAA+B;IAE/B,MAAMC,UAAUL,sBAAsBI;IACtC,OAAOL,qBAAO,KAACM;kBAASH;QAAeC;AACzC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { DefaultPluginKinds } from '../model';
|
|
3
|
+
export type ContextOptions = {
|
|
4
|
+
defaultPluginKinds?: DefaultPluginKinds;
|
|
5
|
+
};
|
|
6
|
+
export declare function getTestContextWrapper(contextOptions?: ContextOptions): ({ children }: {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}) => ReactNode;
|
|
9
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/test/utils.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAG9C,MAAM,MAAM,cAAc,GAAG;IAC3B,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;CACzC,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,cAAc,CAAC,EAAE,cAAc,kBAM7B;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,KAAG,SAAS,CAgB1E"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
15
|
+
import { PluginRegistry } from '../components';
|
|
16
|
+
import { testPluginLoader } from './test-plugins';
|
|
17
|
+
export function getTestContextWrapper(contextOptions) {
|
|
18
|
+
// Create a new QueryClient for each test to avoid caching issues
|
|
19
|
+
const queryClient = new QueryClient({
|
|
20
|
+
defaultOptions: {
|
|
21
|
+
queries: {
|
|
22
|
+
refetchOnWindowFocus: false,
|
|
23
|
+
retry: false
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
return function Wrapper({ children }) {
|
|
28
|
+
return /*#__PURE__*/ _jsx(QueryClientProvider, {
|
|
29
|
+
client: queryClient,
|
|
30
|
+
children: /*#__PURE__*/ _jsx(PluginRegistry, {
|
|
31
|
+
pluginLoader: testPluginLoader,
|
|
32
|
+
defaultPluginKinds: contextOptions?.defaultPluginKinds ?? {
|
|
33
|
+
TimeSeriesQuery: 'PrometheusTimeSeriesQuery'
|
|
34
|
+
},
|
|
35
|
+
children: children
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/test/utils.tsx"],"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 { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ReactNode } from 'react';\nimport { PluginRegistry } from '../components';\nimport { DefaultPluginKinds } from '../model';\nimport { testPluginLoader } from './test-plugins';\n\nexport type ContextOptions = {\n defaultPluginKinds?: DefaultPluginKinds;\n};\n\nexport function getTestContextWrapper(contextOptions?: ContextOptions) {\n // Create a new QueryClient for each test to avoid caching issues\n const queryClient = new QueryClient({\n defaultOptions: { queries: { refetchOnWindowFocus: false, retry: false } },\n });\n\n return function Wrapper({ children }: { children: ReactNode }): ReactNode {\n return (\n <QueryClientProvider client={queryClient}>\n <PluginRegistry\n pluginLoader={testPluginLoader}\n defaultPluginKinds={\n contextOptions?.defaultPluginKinds ?? {\n TimeSeriesQuery: 'PrometheusTimeSeriesQuery',\n }\n }\n >\n {children}\n </PluginRegistry>\n </QueryClientProvider>\n );\n };\n}\n"],"names":["QueryClient","QueryClientProvider","PluginRegistry","testPluginLoader","getTestContextWrapper","contextOptions","queryClient","defaultOptions","queries","refetchOnWindowFocus","retry","Wrapper","children","client","pluginLoader","defaultPluginKinds","TimeSeriesQuery"],"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,EAAEC,mBAAmB,QAAQ,wBAAwB;AAEzE,SAASC,cAAc,QAAQ,gBAAgB;AAE/C,SAASC,gBAAgB,QAAQ,iBAAiB;AAMlD,OAAO,SAASC,sBAAsBC,cAA+B;IACnE,iEAAiE;IACjE,MAAMC,cAAc,IAAIN,YAAY;QAClCO,gBAAgB;YAAEC,SAAS;gBAAEC,sBAAsB;gBAAOC,OAAO;YAAM;QAAE;IAC3E;IAEA,OAAO,SAASC,QAAQ,EAAEC,QAAQ,EAA2B;QAC3D,qBACE,KAACX;YAAoBY,QAAQP;sBAC3B,cAAA,KAACJ;gBACCY,cAAcX;gBACdY,oBACEV,gBAAgBU,sBAAsB;oBACpCC,iBAAiB;gBACnB;0BAGDJ;;;IAIT;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/plugin-system",
|
|
3
|
-
"version": "0.51.0
|
|
3
|
+
"version": "0.51.0",
|
|
4
4
|
"description": "The plugin feature in Pereses",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/perses/perses/blob/main/README.md",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"lint:fix": "eslint --fix src --ext .ts,.tsx"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@module-federation/enhanced": "^0.
|
|
32
|
-
"@perses-dev/components": "0.51.0
|
|
33
|
-
"@perses-dev/core": "0.51.0
|
|
31
|
+
"@module-federation/enhanced": "^0.14.3",
|
|
32
|
+
"@perses-dev/components": "0.51.0",
|
|
33
|
+
"@perses-dev/core": "0.51.0",
|
|
34
34
|
"date-fns": "^4.1.0",
|
|
35
35
|
"date-fns-tz": "^3.2.0",
|
|
36
36
|
"immer": "^10.1.1",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@mui/material": "^6.1.10",
|
|
44
|
-
"@tanstack/react-query": "^
|
|
44
|
+
"@tanstack/react-query": "^4.39.1",
|
|
45
45
|
"react": "^17.0.2 || ^18.0.0",
|
|
46
46
|
"react-dom": "^17.0.2 || ^18.0.0"
|
|
47
47
|
},
|