@perses-dev/client 0.54.0-beta.10
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/README.md +3 -0
- package/dist/cjs/index.js +32 -0
- package/dist/cjs/model/dashboard.js +16 -0
- package/dist/cjs/model/datasource-api.js +16 -0
- package/dist/cjs/model/datasource.js +16 -0
- package/dist/cjs/model/ephemeralDashboard.js +16 -0
- package/dist/cjs/model/folder.js +16 -0
- package/dist/cjs/model/http.js +16 -0
- package/dist/cjs/model/index.js +42 -0
- package/dist/cjs/model/kind.js +39 -0
- package/dist/cjs/model/resource.js +36 -0
- package/dist/cjs/model/role.js +60 -0
- package/dist/cjs/model/roleBindings.js +16 -0
- package/dist/cjs/model/secret.js +16 -0
- package/dist/cjs/model/user.js +16 -0
- package/dist/cjs/model/variable.js +34 -0
- package/dist/cjs/schema/datasource.js +66 -0
- package/dist/cjs/schema/index.js +35 -0
- package/dist/cjs/schema/metadata.js +41 -0
- package/dist/cjs/schema/role.js +86 -0
- package/dist/cjs/schema/rolebinding.js +65 -0
- package/dist/cjs/schema/secret.js +211 -0
- package/dist/cjs/schema/user.js +57 -0
- package/dist/cjs/test/index.js +30 -0
- package/dist/cjs/test/render.js +38 -0
- package/dist/cjs/test/setup-tests.js +18 -0
- package/dist/cjs/util/fetch.js +82 -0
- package/dist/cjs/util/index.js +30 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/model/dashboard.d.ts +9 -0
- package/dist/model/dashboard.d.ts.map +1 -0
- package/dist/model/dashboard.js +15 -0
- package/dist/model/dashboard.js.map +1 -0
- package/dist/model/datasource-api.d.ts +41 -0
- package/dist/model/datasource-api.d.ts.map +1 -0
- package/dist/model/datasource-api.js +19 -0
- package/dist/model/datasource-api.js.map +1 -0
- package/dist/model/datasource.d.ts +28 -0
- package/dist/model/datasource.d.ts.map +1 -0
- package/dist/model/datasource.js +15 -0
- package/dist/model/datasource.js.map +1 -0
- package/dist/model/ephemeralDashboard.d.ts +14 -0
- package/dist/model/ephemeralDashboard.d.ts.map +1 -0
- package/dist/model/ephemeralDashboard.js +15 -0
- package/dist/model/ephemeralDashboard.js.map +1 -0
- package/dist/model/folder.d.ts +19 -0
- package/dist/model/folder.d.ts.map +1 -0
- package/dist/model/folder.js +15 -0
- package/dist/model/folder.js.map +1 -0
- package/dist/model/http.d.ts +2 -0
- package/dist/model/http.d.ts.map +1 -0
- package/dist/model/http.js +15 -0
- package/dist/model/http.js.map +1 -0
- package/dist/model/index.d.ts +14 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/index.js +27 -0
- package/dist/model/index.js.map +1 -0
- package/dist/model/kind.d.ts +3 -0
- package/dist/model/kind.d.ts.map +1 -0
- package/dist/model/kind.js +31 -0
- package/dist/model/kind.js.map +1 -0
- package/dist/model/resource.d.ts +28 -0
- package/dist/model/resource.d.ts.map +1 -0
- package/dist/model/resource.js +20 -0
- package/dist/model/resource.js.map +1 -0
- package/dist/model/role.d.ts +31 -0
- package/dist/model/role.d.ts.map +1 -0
- package/dist/model/role.js +41 -0
- package/dist/model/role.js.map +1 -0
- package/dist/model/roleBindings.d.ts +27 -0
- package/dist/model/roleBindings.d.ts.map +1 -0
- package/dist/model/roleBindings.js +15 -0
- package/dist/model/roleBindings.js.map +1 -0
- package/dist/model/secret.d.ts +54 -0
- package/dist/model/secret.d.ts.map +1 -0
- package/dist/model/secret.js +15 -0
- package/dist/model/secret.js.map +1 -0
- package/dist/model/user.d.ts +21 -0
- package/dist/model/user.d.ts.map +1 -0
- package/dist/model/user.js +15 -0
- package/dist/model/user.js.map +1 -0
- package/dist/model/variable.d.ts +58 -0
- package/dist/model/variable.d.ts.map +1 -0
- package/dist/model/variable.js +18 -0
- package/dist/model/variable.js.map +1 -0
- package/dist/schema/datasource.d.ts +59 -0
- package/dist/schema/datasource.d.ts.map +1 -0
- package/dist/schema/datasource.js +41 -0
- package/dist/schema/datasource.js.map +1 -0
- package/dist/schema/index.d.ts +7 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +20 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/metadata.d.ts +21 -0
- package/dist/schema/metadata.d.ts.map +1 -0
- package/dist/schema/metadata.js +22 -0
- package/dist/schema/metadata.js.map +1 -0
- package/dist/schema/role.d.ts +58 -0
- package/dist/schema/role.d.ts.map +1 -0
- package/dist/schema/role.js +61 -0
- package/dist/schema/role.js.map +1 -0
- package/dist/schema/rolebinding.d.ts +58 -0
- package/dist/schema/rolebinding.d.ts.map +1 -0
- package/dist/schema/rolebinding.js +40 -0
- package/dist/schema/rolebinding.js.map +1 -0
- package/dist/schema/secret.d.ts +1597 -0
- package/dist/schema/secret.d.ts.map +1 -0
- package/dist/schema/secret.js +189 -0
- package/dist/schema/secret.js.map +1 -0
- package/dist/schema/user.d.ts +8 -0
- package/dist/schema/user.d.ts.map +1 -0
- package/dist/schema/user.js +36 -0
- package/dist/schema/user.js.map +1 -0
- package/dist/test/index.d.ts +2 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +15 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/render.d.ts +7 -0
- package/dist/test/render.d.ts.map +1 -0
- package/dist/test/render.js +32 -0
- package/dist/test/render.js.map +1 -0
- package/dist/test/setup-tests.d.ts +2 -0
- package/dist/test/setup-tests.d.ts.map +1 -0
- package/dist/test/setup-tests.js +16 -0
- package/dist/test/setup-tests.js.map +1 -0
- package/dist/util/fetch.d.ts +28 -0
- package/dist/util/fetch.d.ts.map +1 -0
- package/dist/util/fetch.js +68 -0
- package/dist/util/fetch.js.map +1 -0
- package/dist/util/index.d.ts +2 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/index.js +15 -0
- package/dist/util/index.js.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
});
|
|
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 globalRoleBindingSchema () {
|
|
25
|
+
return globalRoleBindingSchema;
|
|
26
|
+
},
|
|
27
|
+
get roleBindingSchema () {
|
|
28
|
+
return roleBindingSchema;
|
|
29
|
+
},
|
|
30
|
+
get roleBindingSpecSchema () {
|
|
31
|
+
return roleBindingSpecSchema;
|
|
32
|
+
},
|
|
33
|
+
get roleBindingsEditorSchema () {
|
|
34
|
+
return roleBindingsEditorSchema;
|
|
35
|
+
},
|
|
36
|
+
get subjectSchema () {
|
|
37
|
+
return subjectSchema;
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
const _zod = require("zod");
|
|
41
|
+
const _metadata = require("./metadata");
|
|
42
|
+
const subjectSchema = _zod.z.object({
|
|
43
|
+
kind: _zod.z.enum([
|
|
44
|
+
'User'
|
|
45
|
+
]),
|
|
46
|
+
name: _metadata.nameSchema
|
|
47
|
+
});
|
|
48
|
+
const roleBindingSpecSchema = _zod.z.object({
|
|
49
|
+
role: _metadata.nameSchema,
|
|
50
|
+
subjects: _zod.z.array(subjectSchema).nonempty()
|
|
51
|
+
});
|
|
52
|
+
const roleBindingSchema = _zod.z.object({
|
|
53
|
+
kind: _zod.z.literal('RoleBinding'),
|
|
54
|
+
metadata: _metadata.projectMetadataSchema,
|
|
55
|
+
spec: roleBindingSpecSchema
|
|
56
|
+
});
|
|
57
|
+
const globalRoleBindingSchema = _zod.z.object({
|
|
58
|
+
kind: _zod.z.literal('GlobalRoleBinding'),
|
|
59
|
+
metadata: _metadata.metadataSchema,
|
|
60
|
+
spec: roleBindingSpecSchema
|
|
61
|
+
});
|
|
62
|
+
const roleBindingsEditorSchema = _zod.z.discriminatedUnion('kind', [
|
|
63
|
+
roleBindingSchema,
|
|
64
|
+
globalRoleBindingSchema
|
|
65
|
+
]);
|
|
@@ -0,0 +1,211 @@
|
|
|
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
|
+
});
|
|
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 globalSecretSchema () {
|
|
25
|
+
return globalSecretSchema;
|
|
26
|
+
},
|
|
27
|
+
get secretSchema () {
|
|
28
|
+
return secretSchema;
|
|
29
|
+
},
|
|
30
|
+
get secretSpecSchema () {
|
|
31
|
+
return secretSpecSchema;
|
|
32
|
+
},
|
|
33
|
+
get secretsEditorSchema () {
|
|
34
|
+
return secretsEditorSchema;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const _zod = require("zod");
|
|
38
|
+
const _metadata = require("./metadata");
|
|
39
|
+
const secretSpecSchema = _zod.z.object({
|
|
40
|
+
basicAuth: _zod.z.object({
|
|
41
|
+
username: _zod.z.string().min(1),
|
|
42
|
+
password: _zod.z.string().optional(),
|
|
43
|
+
passwordFile: _zod.z.string().optional()
|
|
44
|
+
}).superRefine((val, ctx)=>{
|
|
45
|
+
if (val.password && val.password.length > 0 && val.passwordFile && val.passwordFile.length > 0) {
|
|
46
|
+
ctx.addIssue({
|
|
47
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
48
|
+
message: 'Only one of the fields must be defined',
|
|
49
|
+
path: [
|
|
50
|
+
'password'
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
ctx.addIssue({
|
|
54
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
55
|
+
message: 'Only one of the fields must be defined',
|
|
56
|
+
path: [
|
|
57
|
+
'passwordFile'
|
|
58
|
+
]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}).optional(),
|
|
62
|
+
authorization: _zod.z.object({
|
|
63
|
+
type: _zod.z.string().optional(),
|
|
64
|
+
credentials: _zod.z.string().optional(),
|
|
65
|
+
credentialsFile: _zod.z.string().optional()
|
|
66
|
+
}).superRefine((val, ctx)=>{
|
|
67
|
+
if (val.credentials && val.credentials.length > 0 && val.credentialsFile && val.credentialsFile.length > 0) {
|
|
68
|
+
ctx.addIssue({
|
|
69
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
70
|
+
message: 'Only one of the fields must be defined',
|
|
71
|
+
path: [
|
|
72
|
+
'credentials'
|
|
73
|
+
]
|
|
74
|
+
});
|
|
75
|
+
ctx.addIssue({
|
|
76
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
77
|
+
message: 'Only one of the fields must be defined',
|
|
78
|
+
path: [
|
|
79
|
+
'credentialsFile'
|
|
80
|
+
]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}).optional(),
|
|
84
|
+
oauth: _zod.z.object({
|
|
85
|
+
clientID: _zod.z.string().min(1),
|
|
86
|
+
clientSecret: _zod.z.string().optional(),
|
|
87
|
+
clientSecretFile: _zod.z.string().optional(),
|
|
88
|
+
tokenURL: _zod.z.string().min(1),
|
|
89
|
+
scopes: _zod.z.array(_zod.z.string().nonempty()).default([]),
|
|
90
|
+
endpointParams: _zod.z.record(_zod.z.string().nonempty(), _zod.z.array(_zod.z.string())).default({}).optional(),
|
|
91
|
+
authStyle: _zod.z.union([
|
|
92
|
+
_zod.z.literal(0),
|
|
93
|
+
_zod.z.literal(1),
|
|
94
|
+
_zod.z.literal(2)
|
|
95
|
+
]).optional()
|
|
96
|
+
}).superRefine((val, ctx)=>{
|
|
97
|
+
if (val.clientSecret && val.clientSecret.length > 0 && val.clientSecretFile && val.clientSecretFile.length > 0) {
|
|
98
|
+
ctx.addIssue({
|
|
99
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
100
|
+
message: 'Only one of the fields must be defined',
|
|
101
|
+
path: [
|
|
102
|
+
'clientSecret'
|
|
103
|
+
]
|
|
104
|
+
});
|
|
105
|
+
ctx.addIssue({
|
|
106
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
107
|
+
message: 'Only one of the fields must be defined',
|
|
108
|
+
path: [
|
|
109
|
+
'clientSecretFile'
|
|
110
|
+
]
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}).optional(),
|
|
114
|
+
tlsConfig: _zod.z.object({
|
|
115
|
+
ca: _zod.z.string().optional(),
|
|
116
|
+
cert: _zod.z.string().optional(),
|
|
117
|
+
key: _zod.z.string().optional(),
|
|
118
|
+
caFile: _zod.z.string().optional(),
|
|
119
|
+
certFile: _zod.z.string().optional(),
|
|
120
|
+
keyFile: _zod.z.string().optional(),
|
|
121
|
+
serverName: _zod.z.string().optional(),
|
|
122
|
+
insecureSkipVerify: _zod.z.boolean().optional()
|
|
123
|
+
}).superRefine((val, ctx)=>{
|
|
124
|
+
if (val.ca && val.ca.length > 0 && val.caFile && val.caFile.length > 0) {
|
|
125
|
+
ctx.addIssue({
|
|
126
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
127
|
+
message: 'Only one of the fields must be defined',
|
|
128
|
+
path: [
|
|
129
|
+
'ca'
|
|
130
|
+
]
|
|
131
|
+
});
|
|
132
|
+
ctx.addIssue({
|
|
133
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
134
|
+
message: 'Only one of the fields must be defined',
|
|
135
|
+
path: [
|
|
136
|
+
'caFile'
|
|
137
|
+
]
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
if (val.cert && val.cert.length > 0 && val.certFile && val.certFile.length > 0) {
|
|
141
|
+
ctx.addIssue({
|
|
142
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
143
|
+
message: 'Only one of the fields must be defined',
|
|
144
|
+
path: [
|
|
145
|
+
'cert'
|
|
146
|
+
]
|
|
147
|
+
});
|
|
148
|
+
ctx.addIssue({
|
|
149
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
150
|
+
message: 'Only one of the fields must be defined',
|
|
151
|
+
path: [
|
|
152
|
+
'certFile'
|
|
153
|
+
]
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
if (val.key && val.key.length > 0 && val.keyFile && val.keyFile.length > 0) {
|
|
157
|
+
ctx.addIssue({
|
|
158
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
159
|
+
message: 'Only one of the fields must be defined',
|
|
160
|
+
path: [
|
|
161
|
+
'key'
|
|
162
|
+
]
|
|
163
|
+
});
|
|
164
|
+
ctx.addIssue({
|
|
165
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
166
|
+
message: 'Only one of the fields must be defined',
|
|
167
|
+
path: [
|
|
168
|
+
'keyFile'
|
|
169
|
+
]
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
}).optional()
|
|
173
|
+
}).superRefine((val, ctx)=>{
|
|
174
|
+
if (val.basicAuth && val.authorization && val.oauth) {
|
|
175
|
+
ctx.addIssue({
|
|
176
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
177
|
+
message: 'Only one of the fields must be defined',
|
|
178
|
+
path: [
|
|
179
|
+
'basicAuth'
|
|
180
|
+
]
|
|
181
|
+
});
|
|
182
|
+
ctx.addIssue({
|
|
183
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
184
|
+
message: 'Only one of the fields must be defined',
|
|
185
|
+
path: [
|
|
186
|
+
'authorization'
|
|
187
|
+
]
|
|
188
|
+
});
|
|
189
|
+
ctx.addIssue({
|
|
190
|
+
code: _zod.z.ZodIssueCode.custom,
|
|
191
|
+
message: 'Only one of the fields must be defined',
|
|
192
|
+
path: [
|
|
193
|
+
'oauth'
|
|
194
|
+
]
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
const secretSchema = _zod.z.object({
|
|
199
|
+
kind: _zod.z.literal('Secret'),
|
|
200
|
+
metadata: _metadata.projectMetadataSchema,
|
|
201
|
+
spec: secretSpecSchema
|
|
202
|
+
});
|
|
203
|
+
const globalSecretSchema = _zod.z.object({
|
|
204
|
+
kind: _zod.z.literal('GlobalSecret'),
|
|
205
|
+
metadata: _metadata.metadataSchema,
|
|
206
|
+
spec: secretSpecSchema
|
|
207
|
+
});
|
|
208
|
+
const secretsEditorSchema = _zod.z.discriminatedUnion('kind', [
|
|
209
|
+
secretSchema,
|
|
210
|
+
globalSecretSchema
|
|
211
|
+
]);
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
});
|
|
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 nativeProviderSchema () {
|
|
25
|
+
return nativeProviderSchema;
|
|
26
|
+
},
|
|
27
|
+
get oauthProvidersSchema () {
|
|
28
|
+
return oauthProvidersSchema;
|
|
29
|
+
},
|
|
30
|
+
get userSchema () {
|
|
31
|
+
return userSchema;
|
|
32
|
+
},
|
|
33
|
+
get userSpecSchema () {
|
|
34
|
+
return userSpecSchema;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const _zod = require("zod");
|
|
38
|
+
const _metadata = require("./metadata");
|
|
39
|
+
const nativeProviderSchema = _zod.z.object({
|
|
40
|
+
password: _zod.z.string().optional()
|
|
41
|
+
});
|
|
42
|
+
const oauthProvidersSchema = _zod.z.object({
|
|
43
|
+
issuer: _zod.z.string().optional(),
|
|
44
|
+
email: _zod.z.string().optional(),
|
|
45
|
+
subject: _zod.z.string().optional()
|
|
46
|
+
});
|
|
47
|
+
const userSpecSchema = _zod.z.object({
|
|
48
|
+
firstName: _zod.z.string().optional(),
|
|
49
|
+
lastName: _zod.z.string().optional(),
|
|
50
|
+
nativeProvider: nativeProviderSchema.optional(),
|
|
51
|
+
oauthProviders: _zod.z.array(oauthProvidersSchema).optional()
|
|
52
|
+
});
|
|
53
|
+
const userSchema = _zod.z.object({
|
|
54
|
+
kind: _zod.z.literal('User'),
|
|
55
|
+
metadata: _metadata.metadataSchema,
|
|
56
|
+
spec: userSpecSchema
|
|
57
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
});
|
|
17
|
+
_export_star(require("./render"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return from;
|
|
30
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "renderWithContext", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return renderWithContext;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _jsxruntime = require("react/jsx-runtime");
|
|
24
|
+
const _react = require("@testing-library/react");
|
|
25
|
+
const _reactquery = require("@tanstack/react-query");
|
|
26
|
+
const queryClient = new _reactquery.QueryClient({
|
|
27
|
+
defaultOptions: {
|
|
28
|
+
queries: {
|
|
29
|
+
refetchOnWindowFocus: false
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
function renderWithContext(ui, options) {
|
|
34
|
+
return (0, _react.render)(/*#__PURE__*/ (0, _jsxruntime.jsx)(_reactquery.QueryClientProvider, {
|
|
35
|
+
client: queryClient,
|
|
36
|
+
children: ui
|
|
37
|
+
}), options);
|
|
38
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
// Add testing library assertions
|
|
14
|
+
"use strict";
|
|
15
|
+
Object.defineProperty(exports, "__esModule", {
|
|
16
|
+
value: true
|
|
17
|
+
});
|
|
18
|
+
require("@testing-library/jest-dom/extend-expect");
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
/**
|
|
14
|
+
* Calls `globalThis.fetch` and determines which type of error to show for non-200 responses.
|
|
15
|
+
*/ "use strict";
|
|
16
|
+
Object.defineProperty(exports, "__esModule", {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
19
|
+
function _export(target, all) {
|
|
20
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
_export(exports, {
|
|
26
|
+
get FetchError () {
|
|
27
|
+
return FetchError;
|
|
28
|
+
},
|
|
29
|
+
get UserFriendlyError () {
|
|
30
|
+
return UserFriendlyError;
|
|
31
|
+
},
|
|
32
|
+
get fetch () {
|
|
33
|
+
return fetch;
|
|
34
|
+
},
|
|
35
|
+
get fetchJson () {
|
|
36
|
+
return fetchJson;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
async function fetch(...args) {
|
|
40
|
+
const response = await globalThis.fetch(...args);
|
|
41
|
+
if (response.ok === false) {
|
|
42
|
+
const contentType = response.headers.get('content-type');
|
|
43
|
+
if (contentType?.includes('application/json')) {
|
|
44
|
+
const json = await response.clone().json();
|
|
45
|
+
if (json.error) {
|
|
46
|
+
throw new UserFriendlyError(json.error, response.status);
|
|
47
|
+
}
|
|
48
|
+
if (json.message) {
|
|
49
|
+
throw new UserFriendlyError(json.message, response.status);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const text = await response.clone().text();
|
|
53
|
+
if (text) {
|
|
54
|
+
throw new UserFriendlyError(text, response.status);
|
|
55
|
+
}
|
|
56
|
+
throw new FetchError(response);
|
|
57
|
+
}
|
|
58
|
+
return response;
|
|
59
|
+
}
|
|
60
|
+
async function fetchJson(...args) {
|
|
61
|
+
const response = await fetch(...args);
|
|
62
|
+
if (!response.ok) {
|
|
63
|
+
throw new FetchError(response);
|
|
64
|
+
}
|
|
65
|
+
return await response.json();
|
|
66
|
+
}
|
|
67
|
+
class FetchError extends Error {
|
|
68
|
+
status;
|
|
69
|
+
constructor(response){
|
|
70
|
+
super(`${response.status} ${response.statusText}`);
|
|
71
|
+
this.status = response.status;
|
|
72
|
+
Object.setPrototypeOf(this, FetchError.prototype);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
class UserFriendlyError extends Error {
|
|
76
|
+
status;
|
|
77
|
+
constructor(message, status){
|
|
78
|
+
super(message);
|
|
79
|
+
this.status = status;
|
|
80
|
+
Object.setPrototypeOf(this, UserFriendlyError.prototype);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
});
|
|
17
|
+
_export_star(require("./fetch"), exports);
|
|
18
|
+
function _export_star(from, to) {
|
|
19
|
+
Object.keys(from).forEach(function(k) {
|
|
20
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
21
|
+
Object.defineProperty(to, k, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return from[k];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return from;
|
|
30
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
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 * from './util';
|
|
14
|
+
export * from './model';
|
|
15
|
+
export * from './schema';
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './util';\nexport * from './model';\nexport * from './schema';\n"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,WAAW"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ProjectMetadata } from '@perses-dev/client';
|
|
2
|
+
import { DashboardSpec } from '@perses-dev/spec';
|
|
3
|
+
export type DashboardKind = 'Dashboard' | 'EphemeralDashboard';
|
|
4
|
+
export interface DashboardResource {
|
|
5
|
+
kind: DashboardKind;
|
|
6
|
+
spec: DashboardSpec;
|
|
7
|
+
metadata: ProjectMetadata;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=dashboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.d.ts","sourceRoot":"","sources":["../../src/model/dashboard.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,oBAAoB,CAAC;AAE/D,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;CAC3B"}
|
|
@@ -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=dashboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/dashboard.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 { ProjectMetadata } from '@perses-dev/client';\nimport { DashboardSpec } from '@perses-dev/spec';\n\nexport type DashboardKind = 'Dashboard' | 'EphemeralDashboard';\n\nexport interface DashboardResource {\n kind: DashboardKind;\n spec: DashboardSpec;\n metadata: ProjectMetadata;\n}\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;AAOjC,WAIC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { DatasourceResource, DatasourceSelector, GlobalDatasourceResource } from './datasource';
|
|
2
|
+
/**
|
|
3
|
+
* Parameters for building a datasource proxy URL
|
|
4
|
+
*/
|
|
5
|
+
export interface BuildDatasourceProxyUrlParams {
|
|
6
|
+
project?: string;
|
|
7
|
+
dashboard?: string;
|
|
8
|
+
name: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Function type for building datasource proxy URLs
|
|
12
|
+
*/
|
|
13
|
+
export type BuildDatasourceProxyUrlFunc = (params: BuildDatasourceProxyUrlParams) => string;
|
|
14
|
+
/**
|
|
15
|
+
* The external API contract for fetching datasource resources.
|
|
16
|
+
* This defines the interface that must be implemented to provide
|
|
17
|
+
* datasource functionality to the dashboard.
|
|
18
|
+
*/
|
|
19
|
+
export interface DatasourceApi {
|
|
20
|
+
/**
|
|
21
|
+
* Optional function to build proxy URLs for datasources
|
|
22
|
+
*/
|
|
23
|
+
buildProxyUrl?: BuildDatasourceProxyUrlFunc;
|
|
24
|
+
/**
|
|
25
|
+
* Get a datasource resource for a specific project
|
|
26
|
+
*/
|
|
27
|
+
getDatasource: (project: string, selector: DatasourceSelector) => Promise<DatasourceResource | undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* Get a global datasource resource
|
|
30
|
+
*/
|
|
31
|
+
getGlobalDatasource: (selector: DatasourceSelector) => Promise<GlobalDatasourceResource | undefined>;
|
|
32
|
+
/**
|
|
33
|
+
* List all datasources for a project, optionally filtered by plugin kind
|
|
34
|
+
*/
|
|
35
|
+
listDatasources: (project: string, pluginKind?: string) => Promise<DatasourceResource[]>;
|
|
36
|
+
/**
|
|
37
|
+
* List all global datasources, optionally filtered by plugin kind
|
|
38
|
+
*/
|
|
39
|
+
listGlobalDatasources: (pluginKind?: string) => Promise<GlobalDatasourceResource[]>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=datasource-api.d.ts.map
|
|
@@ -0,0 +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;CACd;AAED;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,CAAC,MAAM,EAAE,6BAA6B,KAAK,MAAM,CAAC;AAE5F;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,aAAa,CAAC,EAAE,2BAA2B,CAAC;IAC5C;;OAEG;IACH,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,KAAK,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAAC;IAC1G;;OAEG;IACH,mBAAmB,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC,CAAC;IACrG;;OAEG;IACH,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACzF;;OAEG;IACH,qBAAqB,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,wBAAwB,EAAE,CAAC,CAAC;CACrF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
/**
|
|
14
|
+
* The external API contract for fetching datasource resources.
|
|
15
|
+
* This defines the interface that must be implemented to provide
|
|
16
|
+
* datasource functionality to the dashboard.
|
|
17
|
+
*/ export { };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=datasource-api.js.map
|