@perses-dev/client 0.55.0-beta.1 → 0.55.0-beta.3
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/model/datasource-api.js +68 -0
- package/dist/cjs/test/render.js +1 -1
- package/dist/cjs/test/setup-tests.js +8 -2
- package/dist/cjs/types/globals.d.js +16 -0
- package/dist/context/FetchContext.d.ts.map +1 -1
- package/dist/context/FetchContext.js.map +1 -1
- package/dist/model/datasource-api.d.ts +21 -1
- package/dist/model/datasource-api.d.ts.map +1 -1
- package/dist/model/datasource-api.js +58 -4
- package/dist/model/datasource-api.js.map +1 -1
- package/dist/model/datasource.d.ts.map +1 -1
- package/dist/model/datasource.js.map +1 -1
- package/dist/model/resource.d.ts.map +1 -1
- package/dist/model/resource.js.map +1 -1
- package/dist/model/variable.d.ts.map +1 -1
- package/dist/schema/datasource.d.ts +4 -4
- package/dist/schema/datasource.d.ts.map +1 -1
- package/dist/schema/datasource.js.map +1 -1
- package/dist/schema/role.d.ts +4 -4
- package/dist/schema/role.d.ts.map +1 -1
- package/dist/schema/role.js.map +1 -1
- package/dist/schema/rolebinding.d.ts +4 -4
- package/dist/schema/rolebinding.d.ts.map +1 -1
- package/dist/schema/rolebinding.js.map +1 -1
- package/dist/schema/secret.d.ts +22 -22
- package/dist/schema/secret.d.ts.map +1 -1
- package/dist/schema/secret.js.map +1 -1
- package/dist/schema/user.d.ts.map +1 -1
- package/dist/schema/user.js.map +1 -1
- package/dist/test/render.d.ts.map +1 -1
- package/dist/test/render.js +1 -1
- package/dist/test/render.js.map +1 -1
- package/dist/test/setup-tests.d.ts +1 -1
- package/dist/test/setup-tests.d.ts.map +1 -1
- package/dist/test/setup-tests.js +2 -1
- package/dist/test/setup-tests.js.map +1 -1
- package/dist/types/globals.d.js +15 -0
- package/dist/types/globals.d.js.map +1 -0
- package/package.json +6 -6
|
@@ -14,3 +14,71 @@
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", {
|
|
15
15
|
value: true
|
|
16
16
|
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
get buildProxyUrl () {
|
|
25
|
+
return buildProxyUrl;
|
|
26
|
+
},
|
|
27
|
+
get createTestDatasourceConnection () {
|
|
28
|
+
return createTestDatasourceConnection;
|
|
29
|
+
},
|
|
30
|
+
get hasHTTPProxy () {
|
|
31
|
+
return hasHTTPProxy;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const _util = require("../util");
|
|
35
|
+
function buildProxyUrl({ project, dashboard, name }) {
|
|
36
|
+
const apiPrefix = typeof window !== 'undefined' && window.PERSES_APP_CONFIG?.api_prefix || '';
|
|
37
|
+
let url = `${!project && !dashboard ? 'globaldatasources' : 'datasources'}`;
|
|
38
|
+
if (dashboard) url = `dashboards/${encodeURIComponent(dashboard)}/${url}`;
|
|
39
|
+
if (project) url = `projects/${encodeURIComponent(project)}/${url}`;
|
|
40
|
+
url = name === undefined ? `unsaved/${url}` : `${url}/${encodeURIComponent(name)}`;
|
|
41
|
+
return `${apiPrefix}/proxy/${url}`;
|
|
42
|
+
}
|
|
43
|
+
function hasDirectUrl(pluginSpec) {
|
|
44
|
+
return typeof pluginSpec === 'object' && pluginSpec !== null && typeof pluginSpec['directUrl'] === 'string';
|
|
45
|
+
}
|
|
46
|
+
function isRecord(value) {
|
|
47
|
+
return typeof value === 'object' && value !== null;
|
|
48
|
+
}
|
|
49
|
+
function hasHTTPProxy(spec) {
|
|
50
|
+
return isRecord(spec) && isRecord(spec['proxy']) && spec['proxy']['kind'] === 'HTTPProxy' && isRecord(spec['proxy']['spec']) && typeof spec['proxy']['spec']['url'] === 'string';
|
|
51
|
+
}
|
|
52
|
+
function createTestDatasourceConnection({ project, dashboard } = {}) {
|
|
53
|
+
return async (spec, healthCheckPath)=>{
|
|
54
|
+
const normalizedPath = healthCheckPath.startsWith('/') ? healthCheckPath : `/${healthCheckPath}`;
|
|
55
|
+
const pluginSpec = spec.plugin.spec;
|
|
56
|
+
if (hasDirectUrl(pluginSpec)) {
|
|
57
|
+
await (0, _util.fetch)(new URL(normalizedPath, pluginSpec.directUrl).toString(), {
|
|
58
|
+
method: 'GET',
|
|
59
|
+
headers: {
|
|
60
|
+
'Content-Type': 'application/json'
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
} else if (hasHTTPProxy(pluginSpec)) {
|
|
64
|
+
const proxyUrl = buildProxyUrl({
|
|
65
|
+
project,
|
|
66
|
+
dashboard
|
|
67
|
+
});
|
|
68
|
+
const body = {
|
|
69
|
+
method: 'GET',
|
|
70
|
+
spec,
|
|
71
|
+
body: null
|
|
72
|
+
};
|
|
73
|
+
await (0, _util.fetch)(`${proxyUrl}${normalizedPath}`, {
|
|
74
|
+
method: 'POST',
|
|
75
|
+
headers: {
|
|
76
|
+
'Content-Type': 'application/json'
|
|
77
|
+
},
|
|
78
|
+
body: JSON.stringify(body)
|
|
79
|
+
});
|
|
80
|
+
} else {
|
|
81
|
+
throw new Error(`Unsupported datasource spec type for plugin kind '${spec.plugin.kind}'`);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
package/dist/cjs/test/render.js
CHANGED
|
@@ -21,8 +21,8 @@ Object.defineProperty(exports, "renderWithContext", {
|
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
-
const _react = require("@testing-library/react");
|
|
25
24
|
const _reactquery = require("@tanstack/react-query");
|
|
25
|
+
const _react = require("@testing-library/react");
|
|
26
26
|
const queryClient = new _reactquery.QueryClient({
|
|
27
27
|
defaultOptions: {
|
|
28
28
|
queries: {
|
|
@@ -10,9 +10,15 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
-
// Add testing library assertions
|
|
14
13
|
"use strict";
|
|
15
14
|
Object.defineProperty(exports, "__esModule", {
|
|
16
15
|
value: true
|
|
17
16
|
});
|
|
18
|
-
require("@testing-library/jest-dom/
|
|
17
|
+
const _matchers = /*#__PURE__*/ _interop_require_default(require("@testing-library/jest-dom/matchers"));
|
|
18
|
+
function _interop_require_default(obj) {
|
|
19
|
+
return obj && obj.__esModule ? obj : {
|
|
20
|
+
default: obj
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
// Add testing library assertions
|
|
24
|
+
expect.extend(_matchers.default);
|
|
@@ -0,0 +1,16 @@
|
|
|
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.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchContext.d.ts","sourceRoot":"","sources":["../../src/context/FetchContext.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAiB,YAAY,EAAE,SAAS,EAA2B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FetchContext.d.ts","sourceRoot":"","sources":["../../src/context/FetchContext.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAiB,YAAY,EAAE,SAAS,EAA2B,MAAM,OAAO,CAAC;AAIxF,MAAM,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAI1F,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,kBAAkB,GAAG,YAAY,CAErF;AAED,wBAAgB,QAAQ,IAAI;IAC1B,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;CAC5E,CAYA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/context/FetchContext.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 { createContext, ReactElement, ReactNode, useCallback, useContext } from 'react';\nimport { fetch as defaultFetch } from '../util/fetch';\n\nexport type FetchFn = (...args: Parameters<typeof globalThis.fetch>) => Promise<Response>;\n\nconst FetchContext = createContext<FetchFn>(defaultFetch);\n\nexport interface FetchProviderProps {\n fetchFn: FetchFn;\n children: ReactNode;\n}\n\nexport function FetchProvider({ fetchFn, children }: FetchProviderProps): ReactElement {\n return <FetchContext.Provider value={fetchFn}>{children}</FetchContext.Provider>;\n}\n\nexport function useFetch(): {\n fetch: FetchFn;\n fetchJson: <T>(...args: Parameters<typeof globalThis.fetch>) => Promise<T>;\n} {\n const fetch = useContext(FetchContext);\n\n const fetchJson = useCallback(\n async <T,>(...args: Parameters<typeof globalThis.fetch>): Promise<T> => {\n const response = await fetch(...args);\n return await response.json();\n },\n [fetch]
|
|
1
|
+
{"version":3,"sources":["../../src/context/FetchContext.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 { createContext, ReactElement, ReactNode, useCallback, useContext } from 'react';\n\nimport { fetch as defaultFetch } from '../util/fetch';\n\nexport type FetchFn = (...args: Parameters<typeof globalThis.fetch>) => Promise<Response>;\n\nconst FetchContext = createContext<FetchFn>(defaultFetch);\n\nexport interface FetchProviderProps {\n fetchFn: FetchFn;\n children: ReactNode;\n}\n\nexport function FetchProvider({ fetchFn, children }: FetchProviderProps): ReactElement {\n return <FetchContext.Provider value={fetchFn}>{children}</FetchContext.Provider>;\n}\n\nexport function useFetch(): {\n fetch: FetchFn;\n fetchJson: <T>(...args: Parameters<typeof globalThis.fetch>) => Promise<T>;\n} {\n const fetch = useContext(FetchContext);\n\n const fetchJson = useCallback(\n async <T,>(...args: Parameters<typeof globalThis.fetch>): Promise<T> => {\n const response = await fetch(...args);\n return await response.json();\n },\n [fetch],\n );\n\n return { fetch, fetchJson };\n}\n"],"names":["createContext","useCallback","useContext","fetch","defaultFetch","FetchContext","FetchProvider","fetchFn","children","Provider","value","useFetch","fetchJson","args","response","json"],"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,aAAa,EAA2BC,WAAW,EAAEC,UAAU,QAAQ,QAAQ;AAExF,SAASC,SAASC,YAAY,QAAQ,gBAAgB;AAItD,MAAMC,6BAAeL,cAAuBI;AAO5C,OAAO,SAASE,cAAc,EAAEC,OAAO,EAAEC,QAAQ,EAAsB;IACrE,qBAAO,KAACH,aAAaI,QAAQ;QAACC,OAAOH;kBAAUC;;AACjD;AAEA,OAAO,SAASG;IAId,MAAMR,QAAQD,WAAWG;IAEzB,MAAMO,YAAYX,YAChB,OAAW,GAAGY;QACZ,MAAMC,WAAW,MAAMX,SAASU;QAChC,OAAO,MAAMC,SAASC,IAAI;IAC5B,GACA;QAACZ;KAAM;IAGT,OAAO;QAAEA;QAAOS;IAAU;AAC5B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DatasourceSpec, HTTPProxy, UnknownSpec } from '@perses-dev/spec';
|
|
1
2
|
import { DatasourceResource, DatasourceSelector, GlobalDatasourceResource } from './datasource';
|
|
2
3
|
/**
|
|
3
4
|
* Parameters for building a datasource proxy URL
|
|
@@ -5,12 +6,31 @@ import { DatasourceResource, DatasourceSelector, GlobalDatasourceResource } from
|
|
|
5
6
|
export interface BuildDatasourceProxyUrlParams {
|
|
6
7
|
project?: string;
|
|
7
8
|
dashboard?: string;
|
|
8
|
-
|
|
9
|
+
/** Omit to generate an unsaved-datasource proxy URL */
|
|
10
|
+
name?: string;
|
|
9
11
|
}
|
|
10
12
|
/**
|
|
11
13
|
* Function type for building datasource proxy URLs
|
|
12
14
|
*/
|
|
13
15
|
export type BuildDatasourceProxyUrlFunc = (params: BuildDatasourceProxyUrlParams) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Builds a proxy URL for a datasource. When name is omitted the URL targets the
|
|
18
|
+
* unsaved-datasource proxy endpoint (used for testing connectivity before saving).
|
|
19
|
+
* Reads api_prefix from window.PERSES_APP_CONFIG if available.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildProxyUrl({ project, dashboard, name }: BuildDatasourceProxyUrlParams): string;
|
|
22
|
+
export declare function hasHTTPProxy(spec: UnknownSpec): spec is {
|
|
23
|
+
proxy: HTTPProxy;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Creates a function that tests connectivity for an unsaved datasource.
|
|
27
|
+
* Supports directUrl (direct mode) and HTTPProxy (proxy mode).
|
|
28
|
+
* Throws for any spec that does not match either shape.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createTestDatasourceConnection({ project, dashboard }?: {
|
|
31
|
+
project?: string;
|
|
32
|
+
dashboard?: string;
|
|
33
|
+
}): (spec: DatasourceSpec, healthCheckPath: string) => Promise<void>;
|
|
14
34
|
/**
|
|
15
35
|
* The external API contract for fetching datasource resources.
|
|
16
36
|
* This defines the interface that must be implemented to provide
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datasource-api.d.ts","sourceRoot":"","sources":["../../src/model/datasource-api.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAEhG;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"datasource-api.d.ts","sourceRoot":"","sources":["../../src/model/datasource-api.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAG1E,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAEhG;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,OAAO,CAAC,EAA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,CAAC;CACrF"}
|
|
@@ -10,10 +10,64 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
+
import { fetch } from '../util';
|
|
13
14
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*/ export { }
|
|
15
|
+
* Builds a proxy URL for a datasource. When name is omitted the URL targets the
|
|
16
|
+
* unsaved-datasource proxy endpoint (used for testing connectivity before saving).
|
|
17
|
+
* Reads api_prefix from window.PERSES_APP_CONFIG if available.
|
|
18
|
+
*/ export function buildProxyUrl({ project, dashboard, name }) {
|
|
19
|
+
const apiPrefix = typeof window !== 'undefined' && window.PERSES_APP_CONFIG?.api_prefix || '';
|
|
20
|
+
let url = `${!project && !dashboard ? 'globaldatasources' : 'datasources'}`;
|
|
21
|
+
if (dashboard) url = `dashboards/${encodeURIComponent(dashboard)}/${url}`;
|
|
22
|
+
if (project) url = `projects/${encodeURIComponent(project)}/${url}`;
|
|
23
|
+
url = name === undefined ? `unsaved/${url}` : `${url}/${encodeURIComponent(name)}`;
|
|
24
|
+
return `${apiPrefix}/proxy/${url}`;
|
|
25
|
+
}
|
|
26
|
+
function hasDirectUrl(pluginSpec) {
|
|
27
|
+
return typeof pluginSpec === 'object' && pluginSpec !== null && typeof pluginSpec['directUrl'] === 'string';
|
|
28
|
+
}
|
|
29
|
+
function isRecord(value) {
|
|
30
|
+
return typeof value === 'object' && value !== null;
|
|
31
|
+
}
|
|
32
|
+
export function hasHTTPProxy(spec) {
|
|
33
|
+
return isRecord(spec) && isRecord(spec['proxy']) && spec['proxy']['kind'] === 'HTTPProxy' && isRecord(spec['proxy']['spec']) && typeof spec['proxy']['spec']['url'] === 'string';
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates a function that tests connectivity for an unsaved datasource.
|
|
37
|
+
* Supports directUrl (direct mode) and HTTPProxy (proxy mode).
|
|
38
|
+
* Throws for any spec that does not match either shape.
|
|
39
|
+
*/ export function createTestDatasourceConnection({ project, dashboard } = {}) {
|
|
40
|
+
return async (spec, healthCheckPath)=>{
|
|
41
|
+
const normalizedPath = healthCheckPath.startsWith('/') ? healthCheckPath : `/${healthCheckPath}`;
|
|
42
|
+
const pluginSpec = spec.plugin.spec;
|
|
43
|
+
if (hasDirectUrl(pluginSpec)) {
|
|
44
|
+
await fetch(new URL(normalizedPath, pluginSpec.directUrl).toString(), {
|
|
45
|
+
method: 'GET',
|
|
46
|
+
headers: {
|
|
47
|
+
'Content-Type': 'application/json'
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
} else if (hasHTTPProxy(pluginSpec)) {
|
|
51
|
+
const proxyUrl = buildProxyUrl({
|
|
52
|
+
project,
|
|
53
|
+
dashboard
|
|
54
|
+
});
|
|
55
|
+
const body = {
|
|
56
|
+
method: 'GET',
|
|
57
|
+
spec,
|
|
58
|
+
body: null
|
|
59
|
+
};
|
|
60
|
+
await fetch(`${proxyUrl}${normalizedPath}`, {
|
|
61
|
+
method: 'POST',
|
|
62
|
+
headers: {
|
|
63
|
+
'Content-Type': 'application/json'
|
|
64
|
+
},
|
|
65
|
+
body: JSON.stringify(body)
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
throw new Error(`Unsupported datasource spec type for plugin kind '${spec.plugin.kind}'`);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
18
72
|
|
|
19
73
|
//# sourceMappingURL=datasource-api.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/datasource-api.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 { DatasourceResource, DatasourceSelector, GlobalDatasourceResource } from './datasource';\n\n/**\n * Parameters for building a datasource proxy URL\n */\nexport interface BuildDatasourceProxyUrlParams {\n project?: string;\n dashboard?: string;\n name
|
|
1
|
+
{"version":3,"sources":["../../src/model/datasource-api.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 { DatasourceSpec, HTTPProxy, UnknownSpec } from '@perses-dev/spec';\n\nimport { fetch } from '../util';\nimport { DatasourceResource, DatasourceSelector, GlobalDatasourceResource } from './datasource';\n\n/**\n * Parameters for building a datasource proxy URL\n */\nexport interface BuildDatasourceProxyUrlParams {\n project?: string;\n dashboard?: string;\n /** Omit to generate an unsaved-datasource proxy URL */\n name?: string;\n}\n\n/**\n * Function type for building datasource proxy URLs\n */\nexport type BuildDatasourceProxyUrlFunc = (params: BuildDatasourceProxyUrlParams) => string;\n\n/**\n * Builds a proxy URL for a datasource. When name is omitted the URL targets the\n * unsaved-datasource proxy endpoint (used for testing connectivity before saving).\n * Reads api_prefix from window.PERSES_APP_CONFIG if available.\n */\nexport function buildProxyUrl({ project, dashboard, name }: BuildDatasourceProxyUrlParams): string {\n const apiPrefix = (typeof window !== 'undefined' && window.PERSES_APP_CONFIG?.api_prefix) || '';\n let url = `${!project && !dashboard ? 'globaldatasources' : 'datasources'}`;\n if (dashboard) url = `dashboards/${encodeURIComponent(dashboard)}/${url}`;\n if (project) url = `projects/${encodeURIComponent(project)}/${url}`;\n url = name === undefined ? `unsaved/${url}` : `${url}/${encodeURIComponent(name)}`;\n return `${apiPrefix}/proxy/${url}`;\n}\n\ninterface UnsavedDatasourceProxyBody {\n method: string;\n body?: Uint8Array | null;\n spec: DatasourceSpec;\n}\n\nfunction hasDirectUrl(pluginSpec: UnknownSpec): pluginSpec is { directUrl: string } {\n return (\n typeof pluginSpec === 'object' &&\n pluginSpec !== null &&\n typeof (pluginSpec as Record<string, unknown>)['directUrl'] === 'string'\n );\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\nexport function hasHTTPProxy(spec: UnknownSpec): spec is { proxy: HTTPProxy } {\n return (\n isRecord(spec) &&\n isRecord(spec['proxy']) &&\n spec['proxy']['kind'] === 'HTTPProxy' &&\n isRecord(spec['proxy']['spec']) &&\n typeof spec['proxy']['spec']['url'] === 'string'\n );\n}\n/**\n * Creates a function that tests connectivity for an unsaved datasource.\n * Supports directUrl (direct mode) and HTTPProxy (proxy mode).\n * Throws for any spec that does not match either shape.\n */\nexport function createTestDatasourceConnection({ project, dashboard }: { project?: string; dashboard?: string } = {}): (\n spec: DatasourceSpec,\n healthCheckPath: string,\n) => Promise<void> {\n return async (spec: DatasourceSpec, healthCheckPath: string): Promise<void> => {\n const normalizedPath = healthCheckPath.startsWith('/') ? healthCheckPath : `/${healthCheckPath}`;\n const pluginSpec = spec.plugin.spec;\n\n if (hasDirectUrl(pluginSpec)) {\n await fetch(new URL(normalizedPath, pluginSpec.directUrl).toString(), {\n method: 'GET',\n headers: { 'Content-Type': 'application/json' },\n });\n } else if (hasHTTPProxy(pluginSpec)) {\n const proxyUrl = buildProxyUrl({ project, dashboard });\n const body: UnsavedDatasourceProxyBody = { method: 'GET', spec, body: null };\n await fetch(`${proxyUrl}${normalizedPath}`, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(body),\n });\n } else {\n throw new Error(`Unsupported datasource spec type for plugin kind '${spec.plugin.kind}'`);\n }\n };\n}\n\n/**\n * The external API contract for fetching datasource resources.\n * This defines the interface that must be implemented to provide\n * datasource functionality to the dashboard.\n */\nexport interface DatasourceApi {\n /**\n * Optional function to build proxy URLs for datasources\n */\n buildProxyUrl?: BuildDatasourceProxyUrlFunc;\n /**\n * Get a datasource resource for a specific project\n */\n getDatasource: (project: string, selector: DatasourceSelector) => Promise<DatasourceResource | undefined>;\n /**\n * Get a global datasource resource\n */\n getGlobalDatasource: (selector: DatasourceSelector) => Promise<GlobalDatasourceResource | undefined>;\n /**\n * List all datasources for a project, optionally filtered by plugin kind\n */\n listDatasources: (project: string, pluginKind?: string) => Promise<DatasourceResource[]>;\n /**\n * List all global datasources, optionally filtered by plugin kind\n */\n listGlobalDatasources: (pluginKind?: string) => Promise<GlobalDatasourceResource[]>;\n}\n"],"names":["fetch","buildProxyUrl","project","dashboard","name","apiPrefix","window","PERSES_APP_CONFIG","api_prefix","url","encodeURIComponent","undefined","hasDirectUrl","pluginSpec","isRecord","value","hasHTTPProxy","spec","createTestDatasourceConnection","healthCheckPath","normalizedPath","startsWith","plugin","URL","directUrl","toString","method","headers","proxyUrl","body","JSON","stringify","Error","kind"],"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;AAIjC,SAASA,KAAK,QAAQ,UAAU;AAkBhC;;;;CAIC,GACD,OAAO,SAASC,cAAc,EAAEC,OAAO,EAAEC,SAAS,EAAEC,IAAI,EAAiC;IACvF,MAAMC,YAAY,AAAC,OAAOC,WAAW,eAAeA,OAAOC,iBAAiB,EAAEC,cAAe;IAC7F,IAAIC,MAAM,GAAG,CAACP,WAAW,CAACC,YAAY,sBAAsB,eAAe;IAC3E,IAAIA,WAAWM,MAAM,CAAC,WAAW,EAAEC,mBAAmBP,WAAW,CAAC,E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YAAK;YAC3E,MAAM7B,MAAM,GAAG4B,WAAWR,gBAAgB,EAAE;gBAC1CM,QAAQ;gBACRC,SAAS;oBAAE,gBAAgB;gBAAmB;gBAC9CE,MAAMC,KAAKC,SAAS,CAACF;YACvB;QACF,OAAO;YACL,MAAM,IAAIG,MAAM,CAAC,kDAAkD,EAAEf,KAAKK,MAAM,CAACW,IAAI,CAAC,CAAC,CAAC;QAC1F;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../src/model/datasource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../src/model/datasource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACvD,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,kBAAkB,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,cAAc,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,eAAe,CAAC;IAC1B,IAAI,EAAE,cAAc,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,MAAM,MAAM,UAAU,GAAG,kBAAkB,GAAG,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/datasource.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 { DatasourceSpec, DatasourceSelector } from '@perses-dev/spec';\nimport { Metadata, ProjectMetadata } from './resource';\nexport type { DatasourceSelector, DatasourceSpec };\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\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\nexport type Datasource = DatasourceResource | GlobalDatasourceResource;\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;
|
|
1
|
+
{"version":3,"sources":["../../src/model/datasource.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 { DatasourceSpec, DatasourceSelector } from '@perses-dev/spec';\n\nimport { Metadata, ProjectMetadata } from './resource';\nexport type { DatasourceSelector, DatasourceSpec };\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\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\nexport type Datasource = DatasourceResource | GlobalDatasourceResource;\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;AAiCjC,WAAuE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/model/resource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/model/resource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,GAAG,eAAe,GAAG,QAAQ,IAAI,eAAe,CAEnG;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,QAAQ,GAAG,eAAe,CAAC;IAErC,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,CAAC;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,eAAe,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAE3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/resource.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 { Display } from '@perses-dev/spec';\nimport { Kind } from './kind';\n\nexport function isProjectMetadata(metadata: Metadata | ProjectMetadata): metadata is ProjectMetadata {\n return 'project' in metadata;\n}\n\nexport interface Metadata {\n name: string;\n createdAt?: string;\n updatedAt?: string;\n version?: number;\n tags?: string[];\n}\n\nexport interface ProjectMetadata extends Metadata {\n project: string;\n}\n\nexport interface Resource {\n kind: Kind;\n metadata: Metadata | ProjectMetadata;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n spec?: any;\n}\n\nexport interface ProjectResource {\n kind: 'Project';\n metadata: Metadata;\n spec?: ProjectSpec;\n}\n\nexport interface ProjectSpec {\n display?: Display;\n}\n\nexport function getMetadataProject(metadata: ProjectMetadata | Metadata): string | undefined {\n return 'project' in metadata ? metadata.project : undefined;\n}\n"],"names":["isProjectMetadata","metadata","getMetadataProject","project","undefined"],"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;
|
|
1
|
+
{"version":3,"sources":["../../src/model/resource.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 { Display } from '@perses-dev/spec';\n\nimport { Kind } from './kind';\n\nexport function isProjectMetadata(metadata: Metadata | ProjectMetadata): metadata is ProjectMetadata {\n return 'project' in metadata;\n}\n\nexport interface Metadata {\n name: string;\n createdAt?: string;\n updatedAt?: string;\n version?: number;\n tags?: string[];\n}\n\nexport interface ProjectMetadata extends Metadata {\n project: string;\n}\n\nexport interface Resource {\n kind: Kind;\n metadata: Metadata | ProjectMetadata;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n spec?: any;\n}\n\nexport interface ProjectResource {\n kind: 'Project';\n metadata: Metadata;\n spec?: ProjectSpec;\n}\n\nexport interface ProjectSpec {\n display?: Display;\n}\n\nexport function getMetadataProject(metadata: ProjectMetadata | Metadata): string | undefined {\n return 'project' in metadata ? metadata.project : undefined;\n}\n"],"names":["isProjectMetadata","metadata","getMetadataProject","project","undefined"],"mappings":"AAAA,+BAA+B;AAC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EAAE,eAAe,CAAC;IAC1B,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,gBAAgB,CAAC;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,sBAAsB,CAAC;AAErE,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAE7E;AAED,eAAO,MAAM,iBAAiB,EAAG,QAAiB,CAAC"}
|
|
@@ -17,18 +17,18 @@ export declare const datasourceSchema: z.ZodObject<{
|
|
|
17
17
|
spec: z.ZodType<import("@perses-dev/spec").DatasourceSpec<import("@perses-dev/spec").UnknownSpec>, z.ZodTypeDef, import("@perses-dev/spec").DatasourceSpec<import("@perses-dev/spec").UnknownSpec>>;
|
|
18
18
|
}, "strip", z.ZodTypeAny, {
|
|
19
19
|
kind: "Datasource";
|
|
20
|
+
spec: import("@perses-dev/spec").DatasourceSpec<import("@perses-dev/spec").UnknownSpec>;
|
|
20
21
|
metadata: {
|
|
21
22
|
project: string;
|
|
22
23
|
name: string;
|
|
23
24
|
};
|
|
24
|
-
spec: import("@perses-dev/spec").DatasourceSpec<import("@perses-dev/spec").UnknownSpec>;
|
|
25
25
|
}, {
|
|
26
26
|
kind: "Datasource";
|
|
27
|
+
spec: import("@perses-dev/spec").DatasourceSpec<import("@perses-dev/spec").UnknownSpec>;
|
|
27
28
|
metadata: {
|
|
28
29
|
project: string;
|
|
29
30
|
name: string;
|
|
30
31
|
};
|
|
31
|
-
spec: import("@perses-dev/spec").DatasourceSpec<import("@perses-dev/spec").UnknownSpec>;
|
|
32
32
|
}>;
|
|
33
33
|
export declare const globalDatasourceSchema: z.ZodObject<{
|
|
34
34
|
kind: z.ZodLiteral<"GlobalDatasource">;
|
|
@@ -42,16 +42,16 @@ export declare const globalDatasourceSchema: z.ZodObject<{
|
|
|
42
42
|
spec: z.ZodType<import("@perses-dev/spec").DatasourceSpec<import("@perses-dev/spec").UnknownSpec>, z.ZodTypeDef, import("@perses-dev/spec").DatasourceSpec<import("@perses-dev/spec").UnknownSpec>>;
|
|
43
43
|
}, "strip", z.ZodTypeAny, {
|
|
44
44
|
kind: "GlobalDatasource";
|
|
45
|
+
spec: import("@perses-dev/spec").DatasourceSpec<import("@perses-dev/spec").UnknownSpec>;
|
|
45
46
|
metadata: {
|
|
46
47
|
name: string;
|
|
47
48
|
};
|
|
48
|
-
spec: import("@perses-dev/spec").DatasourceSpec<import("@perses-dev/spec").UnknownSpec>;
|
|
49
49
|
}, {
|
|
50
50
|
kind: "GlobalDatasource";
|
|
51
|
+
spec: import("@perses-dev/spec").DatasourceSpec<import("@perses-dev/spec").UnknownSpec>;
|
|
51
52
|
metadata: {
|
|
52
53
|
name: string;
|
|
53
54
|
};
|
|
54
|
-
spec: import("@perses-dev/spec").DatasourceSpec<import("@perses-dev/spec").UnknownSpec>;
|
|
55
55
|
}>;
|
|
56
56
|
export declare const datasourcesSchema: z.Schema<Datasource>;
|
|
57
57
|
export declare const datasourceDefinitionSchema: z.Schema<DatasourceDefinition>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../src/schema/datasource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAmD,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../src/schema/datasource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAmD,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAG5D,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI3B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;EAIjC,CAAC;AAEH,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU,CAGjD,CAAC;AAEH,eAAO,MAAM,0BAA0B,EAAE,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAGpE,CAAC;AAEH,wBAAgB,+BAA+B,CAAC,YAAY,EAAE,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAK1G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/datasource.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 { buildDatasourceSpecSchema, datasourceSpecSchema, PluginSchema } from '@perses-dev/spec';\nimport { z } from 'zod';\nimport { Datasource, DatasourceDefinition } from '../model';\nimport { metadataSchema, projectMetadataSchema } from './metadata';\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":["buildDatasourceSpecSchema","datasourceSpecSchema","z","metadataSchema","projectMetadataSchema","datasourceSchema","object","kind","literal","metadata","spec","globalDatasourceSchema","datasourcesSchema","discriminatedUnion","datasourceDefinitionSchema","name","string","min","buildDatasourceDefinitionSchema","pluginSchema"],"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,yBAAyB,EAAEC,oBAAoB,QAAsB,mBAAmB;AACjG,SAASC,CAAC,QAAQ,MAAM;
|
|
1
|
+
{"version":3,"sources":["../../src/schema/datasource.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 { buildDatasourceSpecSchema, datasourceSpecSchema, PluginSchema } from '@perses-dev/spec';\nimport { z } from 'zod';\n\nimport { Datasource, DatasourceDefinition } from '../model';\nimport { metadataSchema, projectMetadataSchema } from './metadata';\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":["buildDatasourceSpecSchema","datasourceSpecSchema","z","metadataSchema","projectMetadataSchema","datasourceSchema","object","kind","literal","metadata","spec","globalDatasourceSchema","datasourcesSchema","discriminatedUnion","datasourceDefinitionSchema","name","string","min","buildDatasourceDefinitionSchema","pluginSchema"],"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,yBAAyB,EAAEC,oBAAoB,QAAsB,mBAAmB;AACjG,SAASC,CAAC,QAAQ,MAAM;AAGxB,SAASC,cAAc,EAAEC,qBAAqB,QAAQ,aAAa;AAEnE,OAAO,MAAMC,mBAAmBH,EAAEI,MAAM,CAAC;IACvCC,MAAML,EAAEM,OAAO,CAAC;IAChBC,UAAUL;IACVM,MAAMT;AACR,GAAG;AAEH,OAAO,MAAMU,yBAAyBT,EAAEI,MAAM,CAAC;IAC7CC,MAAML,EAAEM,OAAO,CAAC;IAChBC,UAAUN;IACVO,MAAMT;AACR,GAAG;AAEH,OAAO,MAAMW,oBAA0CV,EAAEW,kBAAkB,CAAC,QAAQ;IAClFR;IACAM;CACD,EAAE;AAEH,OAAO,MAAMG,6BAA6DZ,EAAEI,MAAM,CAAC;IACjFS,MAAMb,EAAEc,MAAM,GAAGC,GAAG,CAAC;IACrBP,MAAMT;AACR,GAAG;AAEH,OAAO,SAASiB,gCAAgCC,YAA0B;IACxE,OAAOjB,EAAEI,MAAM,CAAC;QACdS,MAAMb,EAAEc,MAAM,GAAGC,GAAG,CAAC;QACrBP,MAAMV,0BAA0BmB;IAClC;AACF"}
|
package/dist/schema/role.d.ts
CHANGED
|
@@ -18,18 +18,18 @@ export declare const roleSchema: z.ZodObject<{
|
|
|
18
18
|
spec: z.ZodType<RoleSpec, z.ZodTypeDef, RoleSpec>;
|
|
19
19
|
}, "strip", z.ZodTypeAny, {
|
|
20
20
|
kind: "Role";
|
|
21
|
+
spec: RoleSpec;
|
|
21
22
|
metadata: {
|
|
22
23
|
project: string;
|
|
23
24
|
name: string;
|
|
24
25
|
};
|
|
25
|
-
spec: RoleSpec;
|
|
26
26
|
}, {
|
|
27
27
|
kind: "Role";
|
|
28
|
+
spec: RoleSpec;
|
|
28
29
|
metadata: {
|
|
29
30
|
project: string;
|
|
30
31
|
name: string;
|
|
31
32
|
};
|
|
32
|
-
spec: RoleSpec;
|
|
33
33
|
}>;
|
|
34
34
|
export declare const globalRoleSchema: z.ZodObject<{
|
|
35
35
|
kind: z.ZodLiteral<"GlobalRole">;
|
|
@@ -43,16 +43,16 @@ export declare const globalRoleSchema: z.ZodObject<{
|
|
|
43
43
|
spec: z.ZodType<RoleSpec, z.ZodTypeDef, RoleSpec>;
|
|
44
44
|
}, "strip", z.ZodTypeAny, {
|
|
45
45
|
kind: "GlobalRole";
|
|
46
|
+
spec: RoleSpec;
|
|
46
47
|
metadata: {
|
|
47
48
|
name: string;
|
|
48
49
|
};
|
|
49
|
-
spec: RoleSpec;
|
|
50
50
|
}, {
|
|
51
51
|
kind: "GlobalRole";
|
|
52
|
+
spec: RoleSpec;
|
|
52
53
|
metadata: {
|
|
53
54
|
name: string;
|
|
54
55
|
};
|
|
55
|
-
spec: RoleSpec;
|
|
56
56
|
}>;
|
|
57
57
|
export declare const rolesEditorSchema: z.ZodSchema<Role>;
|
|
58
58
|
//# sourceMappingURL=role.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../src/schema/role.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../src/schema/role.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGtD,eAAO,MAAM,gBAAgB,EAAE,CAAC,CAAC,SAAS,CAAC,UAAU,CAyBnD,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,CAE/C,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIrB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;EAI3B,CAAC;AAEH,eAAO,MAAM,iBAAiB,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,CAAgE,CAAC"}
|
package/dist/schema/role.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/role.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 { 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 ])
|
|
1
|
+
{"version":3,"sources":["../../src/schema/role.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 { z } from 'zod';\n\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,+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,CAAC,QAAQ,MAAM;AAGxB,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"}
|
|
@@ -18,18 +18,18 @@ export declare const roleBindingSchema: z.ZodObject<{
|
|
|
18
18
|
spec: z.ZodType<RoleBindingSpec, z.ZodTypeDef, RoleBindingSpec>;
|
|
19
19
|
}, "strip", z.ZodTypeAny, {
|
|
20
20
|
kind: "RoleBinding";
|
|
21
|
+
spec: RoleBindingSpec;
|
|
21
22
|
metadata: {
|
|
22
23
|
project: string;
|
|
23
24
|
name: string;
|
|
24
25
|
};
|
|
25
|
-
spec: RoleBindingSpec;
|
|
26
26
|
}, {
|
|
27
27
|
kind: "RoleBinding";
|
|
28
|
+
spec: RoleBindingSpec;
|
|
28
29
|
metadata: {
|
|
29
30
|
project: string;
|
|
30
31
|
name: string;
|
|
31
32
|
};
|
|
32
|
-
spec: RoleBindingSpec;
|
|
33
33
|
}>;
|
|
34
34
|
export declare const globalRoleBindingSchema: z.ZodObject<{
|
|
35
35
|
kind: z.ZodLiteral<"GlobalRoleBinding">;
|
|
@@ -43,16 +43,16 @@ export declare const globalRoleBindingSchema: z.ZodObject<{
|
|
|
43
43
|
spec: z.ZodType<RoleBindingSpec, z.ZodTypeDef, RoleBindingSpec>;
|
|
44
44
|
}, "strip", z.ZodTypeAny, {
|
|
45
45
|
kind: "GlobalRoleBinding";
|
|
46
|
+
spec: RoleBindingSpec;
|
|
46
47
|
metadata: {
|
|
47
48
|
name: string;
|
|
48
49
|
};
|
|
49
|
-
spec: RoleBindingSpec;
|
|
50
50
|
}, {
|
|
51
51
|
kind: "GlobalRoleBinding";
|
|
52
|
+
spec: RoleBindingSpec;
|
|
52
53
|
metadata: {
|
|
53
54
|
name: string;
|
|
54
55
|
};
|
|
55
|
-
spec: RoleBindingSpec;
|
|
56
56
|
}>;
|
|
57
57
|
export declare const roleBindingsEditorSchema: z.ZodSchema<RoleBinding>;
|
|
58
58
|
//# sourceMappingURL=rolebinding.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rolebinding.d.ts","sourceRoot":"","sources":["../../src/schema/rolebinding.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"rolebinding.d.ts","sourceRoot":"","sources":["../../src/schema/rolebinding.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGjE,eAAO,MAAM,aAAa,EAAE,CAAC,CAAC,SAAS,CAAC,OAAO,CAG7C,CAAC;AAEH,eAAO,MAAM,qBAAqB,EAAE,CAAC,CAAC,SAAS,CAAC,eAAe,CAG7D,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI5B,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;EAIlC,CAAC;AAEH,eAAO,MAAM,wBAAwB,EAAE,CAAC,CAAC,SAAS,CAAC,WAAW,CAG5D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/rolebinding.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 { 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,+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,CAAC,QAAQ,MAAM;
|
|
1
|
+
{"version":3,"sources":["../../src/schema/rolebinding.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 { z } from 'zod';\n\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,+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,CAAC,QAAQ,MAAM;AAGxB,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"}
|
package/dist/schema/secret.d.ts
CHANGED
|
@@ -516,10 +516,6 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
516
516
|
}>;
|
|
517
517
|
}, "strip", z.ZodTypeAny, {
|
|
518
518
|
kind: "Secret";
|
|
519
|
-
metadata: {
|
|
520
|
-
project: string;
|
|
521
|
-
name: string;
|
|
522
|
-
};
|
|
523
519
|
spec: {
|
|
524
520
|
basicAuth?: {
|
|
525
521
|
username: string;
|
|
@@ -551,12 +547,12 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
551
547
|
insecureSkipVerify?: boolean | undefined;
|
|
552
548
|
} | undefined;
|
|
553
549
|
};
|
|
554
|
-
}, {
|
|
555
|
-
kind: "Secret";
|
|
556
550
|
metadata: {
|
|
557
551
|
project: string;
|
|
558
552
|
name: string;
|
|
559
553
|
};
|
|
554
|
+
}, {
|
|
555
|
+
kind: "Secret";
|
|
560
556
|
spec: {
|
|
561
557
|
basicAuth?: {
|
|
562
558
|
username: string;
|
|
@@ -588,6 +584,10 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
588
584
|
insecureSkipVerify?: boolean | undefined;
|
|
589
585
|
} | undefined;
|
|
590
586
|
};
|
|
587
|
+
metadata: {
|
|
588
|
+
project: string;
|
|
589
|
+
name: string;
|
|
590
|
+
};
|
|
591
591
|
}>;
|
|
592
592
|
export declare const globalSecretSchema: z.ZodObject<{
|
|
593
593
|
kind: z.ZodLiteral<"GlobalSecret">;
|
|
@@ -851,9 +851,6 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
851
851
|
}>;
|
|
852
852
|
}, "strip", z.ZodTypeAny, {
|
|
853
853
|
kind: "GlobalSecret";
|
|
854
|
-
metadata: {
|
|
855
|
-
name: string;
|
|
856
|
-
};
|
|
857
854
|
spec: {
|
|
858
855
|
basicAuth?: {
|
|
859
856
|
username: string;
|
|
@@ -885,11 +882,11 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
885
882
|
insecureSkipVerify?: boolean | undefined;
|
|
886
883
|
} | undefined;
|
|
887
884
|
};
|
|
888
|
-
}, {
|
|
889
|
-
kind: "GlobalSecret";
|
|
890
885
|
metadata: {
|
|
891
886
|
name: string;
|
|
892
887
|
};
|
|
888
|
+
}, {
|
|
889
|
+
kind: "GlobalSecret";
|
|
893
890
|
spec: {
|
|
894
891
|
basicAuth?: {
|
|
895
892
|
username: string;
|
|
@@ -921,6 +918,9 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
921
918
|
insecureSkipVerify?: boolean | undefined;
|
|
922
919
|
} | undefined;
|
|
923
920
|
};
|
|
921
|
+
metadata: {
|
|
922
|
+
name: string;
|
|
923
|
+
};
|
|
924
924
|
}>;
|
|
925
925
|
export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
926
926
|
kind: z.ZodLiteral<"Secret">;
|
|
@@ -1188,10 +1188,6 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1188
1188
|
}>;
|
|
1189
1189
|
}, "strip", z.ZodTypeAny, {
|
|
1190
1190
|
kind: "Secret";
|
|
1191
|
-
metadata: {
|
|
1192
|
-
project: string;
|
|
1193
|
-
name: string;
|
|
1194
|
-
};
|
|
1195
1191
|
spec: {
|
|
1196
1192
|
basicAuth?: {
|
|
1197
1193
|
username: string;
|
|
@@ -1223,12 +1219,12 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1223
1219
|
insecureSkipVerify?: boolean | undefined;
|
|
1224
1220
|
} | undefined;
|
|
1225
1221
|
};
|
|
1226
|
-
}, {
|
|
1227
|
-
kind: "Secret";
|
|
1228
1222
|
metadata: {
|
|
1229
1223
|
project: string;
|
|
1230
1224
|
name: string;
|
|
1231
1225
|
};
|
|
1226
|
+
}, {
|
|
1227
|
+
kind: "Secret";
|
|
1232
1228
|
spec: {
|
|
1233
1229
|
basicAuth?: {
|
|
1234
1230
|
username: string;
|
|
@@ -1260,6 +1256,10 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1260
1256
|
insecureSkipVerify?: boolean | undefined;
|
|
1261
1257
|
} | undefined;
|
|
1262
1258
|
};
|
|
1259
|
+
metadata: {
|
|
1260
|
+
project: string;
|
|
1261
|
+
name: string;
|
|
1262
|
+
};
|
|
1263
1263
|
}>, z.ZodObject<{
|
|
1264
1264
|
kind: z.ZodLiteral<"GlobalSecret">;
|
|
1265
1265
|
metadata: z.ZodObject<{
|
|
@@ -1522,9 +1522,6 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1522
1522
|
}>;
|
|
1523
1523
|
}, "strip", z.ZodTypeAny, {
|
|
1524
1524
|
kind: "GlobalSecret";
|
|
1525
|
-
metadata: {
|
|
1526
|
-
name: string;
|
|
1527
|
-
};
|
|
1528
1525
|
spec: {
|
|
1529
1526
|
basicAuth?: {
|
|
1530
1527
|
username: string;
|
|
@@ -1556,11 +1553,11 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1556
1553
|
insecureSkipVerify?: boolean | undefined;
|
|
1557
1554
|
} | undefined;
|
|
1558
1555
|
};
|
|
1559
|
-
}, {
|
|
1560
|
-
kind: "GlobalSecret";
|
|
1561
1556
|
metadata: {
|
|
1562
1557
|
name: string;
|
|
1563
1558
|
};
|
|
1559
|
+
}, {
|
|
1560
|
+
kind: "GlobalSecret";
|
|
1564
1561
|
spec: {
|
|
1565
1562
|
basicAuth?: {
|
|
1566
1563
|
username: string;
|
|
@@ -1592,6 +1589,9 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1592
1589
|
insecureSkipVerify?: boolean | undefined;
|
|
1593
1590
|
} | undefined;
|
|
1594
1591
|
};
|
|
1592
|
+
metadata: {
|
|
1593
|
+
name: string;
|
|
1594
|
+
};
|
|
1595
1595
|
}>]>;
|
|
1596
1596
|
export type SecretsEditorSchemaType = z.infer<typeof secretsEditorSchema>;
|
|
1597
1597
|
//# sourceMappingURL=secret.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secret.d.ts","sourceRoot":"","sources":["../../src/schema/secret.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"secret.d.ts","sourceRoot":"","sources":["../../src/schema/secret.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiJzB,CAAC;AAEL,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIvB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;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;;;;;;;;IAAmE,CAAC;AAEpG,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/secret.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 { 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,+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,CAAC,QAAQ,MAAM;AACxB,SAASC,cAAc,EAAEC,qBAAqB,QAAQ,aAAa;AAEnE,OAAO,MAAMC,mBAAmBH,EAC7BI,MAAM,CAAC;IACNC,WAAWL,EACRI,MAAM,CAAC;QACNE,UAAUN,EAAEO,MAAM,GAAGC,GAAG,CAAC;QACzBC,UAAUT,EAAEO,MAAM,GAAGG,QAAQ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AAU;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"}
|
|
1
|
+
{"version":3,"sources":["../../src/schema/secret.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 { z } from 'zod';\n\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,+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,CAAC,QAAQ,MAAM;AAExB,SAASC,cAAc,EAAEC,qBAAqB,QAAQ,aAAa;AAEnE,OAAO,MAAMC,mBAAmBH,EAC7BI,MAAM,CAAC;IACNC,WAAWL,EACRI,MAAM,CAAC;QACNE,UAAUN,EAAEO,MAAM,GAAGC,GAAG,CAAC;QACzBC,UAAUT,EAAEO,MAAM,GAAGG,QAAQ;QAC7BC,cAAcX,EAAEO,MAAM,GAAGG,QAAQ;IACnC,GACCE,WAAW,CAAC,CAACC,KAAKC;QACjB,IAAID,IAAIJ,QAAQ,IAAII,IAAIJ,QAAQ,CAACM,MAAM,GAAG,KAAKF,IAAIF,YAAY,IAAIE,IAAIF,YAAY,CAACI,MAAM,GAAG,GAAG;YAC9FD,IAAIE,QAAQ,CAAC;gBACXC,MAAMjB,EAAEkB,YAAY,CAACC,MAAM;gBAC3BC,SAAS;gBACTC,MAAM;oBAAC;iBAAW;YACpB;YACAP,IAAIE,QAAQ,CAAC;gBACXC,MAAMjB,EAAEkB,YAAY,CAACC,MAAM;gBAC3BC,SAAS;gBACTC,MAAM;oBAAC;iBAAe;YACxB;QACF;IACF,GACCX,QAAQ;IACXY,eAAetB,EACZI,MAAM,CAAC;QACN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AO,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/schema/user.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/schema/user.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGjF,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc,CAExD,CAAC;AAEH,eAAO,MAAM,oBAAoB,EAAE,CAAC,CAAC,SAAS,CAAC,aAAa,CAI1D,CAAC;AAGH,eAAO,MAAM,cAAc,EAAE,CAAC,CAAC,SAAS,CAAC,QAAQ,CAK/C,CAAC;AAEH,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,SAAS,CAAC,YAAY,CAI/C,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
package/dist/schema/user.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/user.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 { 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,+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,CAAC,QAAQ,MAAM;
|
|
1
|
+
{"version":3,"sources":["../../src/schema/user.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 { z } from 'zod';\n\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,+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,CAAC,QAAQ,MAAM;AAGxB,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/test/render.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/test/render.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAU,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAIrC;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,GAAG,YAAY,CAE1G"}
|
package/dist/test/render.js
CHANGED
|
@@ -11,8 +11,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
// See the License for the specific language governing permissions and
|
|
13
13
|
// limitations under the License.
|
|
14
|
-
import { render } from '@testing-library/react';
|
|
15
14
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
15
|
+
import { render } from '@testing-library/react';
|
|
16
16
|
const queryClient = new QueryClient({
|
|
17
17
|
defaultOptions: {
|
|
18
18
|
queries: {
|
package/dist/test/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/test/render.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 {
|
|
1
|
+
{"version":3,"sources":["../../src/test/render.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 { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { render, RenderOptions, RenderResult } from '@testing-library/react';\nimport { ReactElement } from 'react';\n\nconst queryClient = new QueryClient({ defaultOptions: { queries: { refetchOnWindowFocus: false } } });\n\n/**\n * Test helper to render a React component with some common app-level providers wrapped around it.\n */\nexport function renderWithContext(ui: ReactElement, options?: Omit<RenderOptions, 'queries'>): RenderResult {\n return render(<QueryClientProvider client={queryClient}>{ui}</QueryClientProvider>, options);\n}\n"],"names":["QueryClient","QueryClientProvider","render","queryClient","defaultOptions","queries","refetchOnWindowFocus","renderWithContext","ui","options","client"],"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,WAAW,EAAEC,mBAAmB,QAAQ,wBAAwB;AACzE,SAASC,MAAM,QAAqC,yBAAyB;AAG7E,MAAMC,cAAc,IAAIH,YAAY;IAAEI,gBAAgB;QAAEC,SAAS;YAAEC,sBAAsB;QAAM;IAAE;AAAE;AAEnG;;CAEC,GACD,OAAO,SAASC,kBAAkBC,EAAgB,EAAEC,OAAwC;IAC1F,OAAOP,qBAAO,KAACD;QAAoBS,QAAQP;kBAAcK;QAA2BC;AACtF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=setup-tests.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-tests.d.ts","sourceRoot":"","sources":["../../src/test/setup-tests.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setup-tests.d.ts","sourceRoot":"","sources":["../../src/test/setup-tests.ts"],"names":[],"mappings":""}
|
package/dist/test/setup-tests.js
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
11
|
// See the License for the specific language governing permissions and
|
|
12
12
|
// limitations under the License.
|
|
13
|
+
import matchers from '@testing-library/jest-dom/matchers';
|
|
13
14
|
// Add testing library assertions
|
|
14
|
-
|
|
15
|
+
expect.extend(matchers);
|
|
15
16
|
|
|
16
17
|
//# sourceMappingURL=setup-tests.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/test/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\
|
|
1
|
+
{"version":3,"sources":["../../src/test/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 matchers from '@testing-library/jest-dom/matchers';\n\n// Add testing library assertions\nexpect.extend(matchers);\n"],"names":["matchers","expect","extend"],"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,OAAOA,cAAc,qCAAqC;AAE1D,iCAAiC;AACjCC,OAAOC,MAAM,CAACF"}
|
|
@@ -0,0 +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.
|
|
13
|
+
export { };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=globals.d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/types/globals.d.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\ndeclare global {\n interface Window {\n PERSES_APP_CONFIG?: { api_prefix?: string };\n }\n}\n\nexport {};\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;AAQjC,WAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/client",
|
|
3
|
-
"version": "0.55.0-beta.
|
|
3
|
+
"version": "0.55.0-beta.3",
|
|
4
4
|
"description": "Functions as an API client or Data fetching Layer for interacting with a backend service",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/perses/perses/blob/main/README.md",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"main": "dist/cjs/index.js",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@perses-dev/spec": "0.3.0-beta.
|
|
18
|
+
"@perses-dev/spec": "0.3.0-beta.4",
|
|
19
19
|
"zod": "^3.21.4"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"build:types": "tsc --project tsconfig.build.json",
|
|
30
30
|
"type-check": "tsc --noEmit",
|
|
31
31
|
"start": "concurrently -P \"npm:build:* -- {*}\" -- --watch",
|
|
32
|
-
"test": "cross-env TZ=UTC
|
|
33
|
-
"test:watch": "cross-env TZ=UTC
|
|
34
|
-
"lint": "
|
|
35
|
-
"lint:fix": "
|
|
32
|
+
"test": "cross-env TZ=UTC vitest run",
|
|
33
|
+
"test:watch": "cross-env TZ=UTC vitest",
|
|
34
|
+
"lint": "oxlint src",
|
|
35
|
+
"lint:fix": "oxlint --fix src"
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"dist"
|