@perses-dev/core 0.46.0 → 0.47.0-rc0

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.
Files changed (106) hide show
  1. package/dist/cjs/index.js +1 -0
  2. package/dist/cjs/model/index.js +1 -0
  3. package/dist/cjs/model/resource.js +14 -3
  4. package/dist/cjs/model/time.js +2 -2
  5. package/dist/cjs/model/trace-data.js +29 -1
  6. package/dist/cjs/model/user.js +16 -0
  7. package/dist/cjs/schema/datasource.js +85 -0
  8. package/dist/cjs/schema/display.js +27 -0
  9. package/dist/cjs/schema/duration.js +25 -0
  10. package/dist/cjs/schema/index.js +40 -0
  11. package/dist/cjs/schema/metadata.js +41 -0
  12. package/dist/cjs/schema/panel.js +104 -0
  13. package/dist/cjs/schema/plugin.js +27 -0
  14. package/dist/cjs/schema/role.js +86 -0
  15. package/dist/cjs/schema/rolebinding.js +65 -0
  16. package/dist/cjs/schema/secret.js +174 -0
  17. package/dist/cjs/schema/user.js +57 -0
  18. package/dist/cjs/schema/variable.js +171 -0
  19. package/dist/cjs/utils/fetch.js +12 -5
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +1 -0
  23. package/dist/index.js.map +1 -1
  24. package/dist/model/calculations.d.ts +1 -1
  25. package/dist/model/calculations.d.ts.map +1 -1
  26. package/dist/model/calculations.js.map +1 -1
  27. package/dist/model/datasource.d.ts +8 -8
  28. package/dist/model/datasource.d.ts.map +1 -1
  29. package/dist/model/datasource.js.map +1 -1
  30. package/dist/model/index.d.ts +1 -0
  31. package/dist/model/index.d.ts.map +1 -1
  32. package/dist/model/index.js +1 -0
  33. package/dist/model/index.js.map +1 -1
  34. package/dist/model/panels.d.ts +9 -1
  35. package/dist/model/panels.d.ts.map +1 -1
  36. package/dist/model/panels.js +1 -1
  37. package/dist/model/panels.js.map +1 -1
  38. package/dist/model/resource.d.ts +1 -0
  39. package/dist/model/resource.d.ts.map +1 -1
  40. package/dist/model/resource.js +3 -0
  41. package/dist/model/resource.js.map +1 -1
  42. package/dist/model/time.js +2 -2
  43. package/dist/model/time.js.map +1 -1
  44. package/dist/model/trace-data.d.ts +80 -7
  45. package/dist/model/trace-data.d.ts.map +1 -1
  46. package/dist/model/trace-data.js +7 -3
  47. package/dist/model/trace-data.js.map +1 -1
  48. package/dist/model/user.d.ts +21 -0
  49. package/dist/model/user.d.ts.map +1 -0
  50. package/dist/model/user.js +15 -0
  51. package/dist/model/user.js.map +1 -0
  52. package/dist/model/variables.d.ts +9 -8
  53. package/dist/model/variables.d.ts.map +1 -1
  54. package/dist/model/variables.js.map +1 -1
  55. package/dist/schema/datasource.d.ts +60 -0
  56. package/dist/schema/datasource.d.ts.map +1 -0
  57. package/dist/schema/datasource.js +54 -0
  58. package/dist/schema/datasource.js.map +1 -0
  59. package/dist/schema/display.d.ts +12 -0
  60. package/dist/schema/display.d.ts.map +1 -0
  61. package/dist/schema/display.js +19 -0
  62. package/dist/schema/display.js.map +1 -0
  63. package/dist/schema/duration.d.ts +3 -0
  64. package/dist/schema/duration.d.ts.map +1 -0
  65. package/dist/schema/duration.js +17 -0
  66. package/dist/schema/duration.js.map +1 -0
  67. package/dist/schema/index.d.ts +12 -0
  68. package/dist/schema/index.d.ts.map +1 -0
  69. package/dist/schema/index.js +25 -0
  70. package/dist/schema/index.js.map +1 -0
  71. package/dist/schema/metadata.d.ts +20 -0
  72. package/dist/schema/metadata.d.ts.map +1 -0
  73. package/dist/schema/metadata.js +22 -0
  74. package/dist/schema/metadata.js.map +1 -0
  75. package/dist/schema/panel.d.ts +13 -0
  76. package/dist/schema/panel.d.ts.map +1 -0
  77. package/dist/schema/panel.js +67 -0
  78. package/dist/schema/panel.js.map +1 -0
  79. package/dist/schema/plugin.d.ts +14 -0
  80. package/dist/schema/plugin.d.ts.map +1 -0
  81. package/dist/schema/plugin.js +19 -0
  82. package/dist/schema/plugin.js.map +1 -0
  83. package/dist/schema/role.d.ts +57 -0
  84. package/dist/schema/role.d.ts.map +1 -0
  85. package/dist/schema/role.js +61 -0
  86. package/dist/schema/role.js.map +1 -0
  87. package/dist/schema/rolebinding.d.ts +57 -0
  88. package/dist/schema/rolebinding.d.ts.map +1 -0
  89. package/dist/schema/rolebinding.js +40 -0
  90. package/dist/schema/rolebinding.js.map +1 -0
  91. package/dist/schema/secret.d.ts +1138 -0
  92. package/dist/schema/secret.d.ts.map +1 -0
  93. package/dist/schema/secret.js +152 -0
  94. package/dist/schema/secret.js.map +1 -0
  95. package/dist/schema/user.d.ts +8 -0
  96. package/dist/schema/user.d.ts.map +1 -0
  97. package/dist/schema/user.js +36 -0
  98. package/dist/schema/user.js.map +1 -0
  99. package/dist/schema/variable.d.ts +90 -0
  100. package/dist/schema/variable.d.ts.map +1 -0
  101. package/dist/schema/variable.js +119 -0
  102. package/dist/schema/variable.js.map +1 -0
  103. package/dist/utils/fetch.d.ts.map +1 -1
  104. package/dist/utils/fetch.js +12 -5
  105. package/dist/utils/fetch.js.map +1 -1
  106. package/package.json +1 -1
@@ -0,0 +1,174 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "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: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ globalSecretSchema: function() {
25
+ return globalSecretSchema;
26
+ },
27
+ secretSchema: function() {
28
+ return secretSchema;
29
+ },
30
+ secretSpecSchema: function() {
31
+ return secretSpecSchema;
32
+ },
33
+ secretsEditorSchema: function() {
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
+ tlsConfig: _zod.z.object({
85
+ ca: _zod.z.string().optional(),
86
+ cert: _zod.z.string().optional(),
87
+ key: _zod.z.string().optional(),
88
+ caFile: _zod.z.string().optional(),
89
+ certFile: _zod.z.string().optional(),
90
+ keyFile: _zod.z.string().optional(),
91
+ serverName: _zod.z.string().optional(),
92
+ insecureSkipVerify: _zod.z.boolean()
93
+ }).superRefine((val, ctx)=>{
94
+ if (val.ca && val.ca.length > 0 && val.caFile && val.caFile.length > 0) {
95
+ ctx.addIssue({
96
+ code: _zod.z.ZodIssueCode.custom,
97
+ message: 'Only one of the fields must be defined',
98
+ path: [
99
+ 'ca'
100
+ ]
101
+ });
102
+ ctx.addIssue({
103
+ code: _zod.z.ZodIssueCode.custom,
104
+ message: 'Only one of the fields must be defined',
105
+ path: [
106
+ 'caFile'
107
+ ]
108
+ });
109
+ }
110
+ if (val.cert && val.cert.length > 0 && val.certFile && val.certFile.length > 0) {
111
+ ctx.addIssue({
112
+ code: _zod.z.ZodIssueCode.custom,
113
+ message: 'Only one of the fields must be defined',
114
+ path: [
115
+ 'cert'
116
+ ]
117
+ });
118
+ ctx.addIssue({
119
+ code: _zod.z.ZodIssueCode.custom,
120
+ message: 'Only one of the fields must be defined',
121
+ path: [
122
+ 'certFile'
123
+ ]
124
+ });
125
+ }
126
+ if (val.key && val.key.length > 0 && val.keyFile && val.keyFile.length > 0) {
127
+ ctx.addIssue({
128
+ code: _zod.z.ZodIssueCode.custom,
129
+ message: 'Only one of the fields must be defined',
130
+ path: [
131
+ 'key'
132
+ ]
133
+ });
134
+ ctx.addIssue({
135
+ code: _zod.z.ZodIssueCode.custom,
136
+ message: 'Only one of the fields must be defined',
137
+ path: [
138
+ 'keyFile'
139
+ ]
140
+ });
141
+ }
142
+ }).optional()
143
+ }).superRefine((val, ctx)=>{
144
+ if (val.basicAuth && val.authorization) {
145
+ ctx.addIssue({
146
+ code: _zod.z.ZodIssueCode.custom,
147
+ message: 'Only one of the fields must be defined',
148
+ path: [
149
+ 'basicAuth'
150
+ ]
151
+ });
152
+ ctx.addIssue({
153
+ code: _zod.z.ZodIssueCode.custom,
154
+ message: 'Only one of the fields must be defined',
155
+ path: [
156
+ 'authorization'
157
+ ]
158
+ });
159
+ }
160
+ });
161
+ const secretSchema = _zod.z.object({
162
+ kind: _zod.z.literal('Secret'),
163
+ metadata: _metadata.projectMetadataSchema,
164
+ spec: secretSpecSchema
165
+ });
166
+ const globalSecretSchema = _zod.z.object({
167
+ kind: _zod.z.literal('GlobalSecret'),
168
+ metadata: _metadata.metadataSchema,
169
+ spec: secretSpecSchema
170
+ });
171
+ const secretsEditorSchema = _zod.z.discriminatedUnion('kind', [
172
+ secretSchema,
173
+ globalSecretSchema
174
+ ]);
@@ -0,0 +1,57 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "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: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ nativeProviderSchema: function() {
25
+ return nativeProviderSchema;
26
+ },
27
+ oauthProvidersSchema: function() {
28
+ return oauthProvidersSchema;
29
+ },
30
+ userSchema: function() {
31
+ return userSchema;
32
+ },
33
+ userSpecSchema: function() {
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,171 @@
1
+ // Copyright 2023 The Perses Authors
2
+ // Licensed under the Apache License, Version 2.0 (the "License");
3
+ // you may not use this file except in compliance with the License.
4
+ // You may obtain a copy of the License at
5
+ //
6
+ // http://www.apache.org/licenses/LICENSE-2.0
7
+ //
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
13
+ "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: all[name]
21
+ });
22
+ }
23
+ _export(exports, {
24
+ buildVariableDefinitionSchema: function() {
25
+ return buildVariableDefinitionSchema;
26
+ },
27
+ buildVariableListSchema: function() {
28
+ return buildVariableListSchema;
29
+ },
30
+ buildVariableListSpecSchema: function() {
31
+ return buildVariableListSpecSchema;
32
+ },
33
+ buildVariableSpecSchema: function() {
34
+ return buildVariableSpecSchema;
35
+ },
36
+ globalVariableSchema: function() {
37
+ return globalVariableSchema;
38
+ },
39
+ variableDefinitionSchema: function() {
40
+ return variableDefinitionSchema;
41
+ },
42
+ variableDisplaySchema: function() {
43
+ return variableDisplaySchema;
44
+ },
45
+ variableListSchema: function() {
46
+ return variableListSchema;
47
+ },
48
+ variableListSpecSchema: function() {
49
+ return variableListSpecSchema;
50
+ },
51
+ variableSchema: function() {
52
+ return variableSchema;
53
+ },
54
+ variableSpecSchema: function() {
55
+ return variableSpecSchema;
56
+ },
57
+ variableTextSchema: function() {
58
+ return variableTextSchema;
59
+ },
60
+ variableTextSpecSchema: function() {
61
+ return variableTextSpecSchema;
62
+ },
63
+ variablesSchema: function() {
64
+ return variablesSchema;
65
+ }
66
+ });
67
+ const _zod = require("zod");
68
+ const _metadata = require("./metadata");
69
+ const _plugin = require("./plugin");
70
+ const variableDisplaySchema = _zod.z.object({
71
+ name: _zod.z.string().optional(),
72
+ description: _zod.z.string().optional(),
73
+ hidden: _zod.z.boolean().optional()
74
+ });
75
+ const variableListSpecSchema = _zod.z.object({
76
+ name: _zod.z.string().min(1),
77
+ display: variableDisplaySchema.optional(),
78
+ defaultValue: _zod.z.string().or(_zod.z.array(_zod.z.string())).optional(),
79
+ allowAllValue: _zod.z.boolean(),
80
+ allowMultiple: _zod.z.boolean(),
81
+ customAllValue: _zod.z.string().optional(),
82
+ capturingRegexp: _zod.z.string().optional(),
83
+ sort: _zod.z.enum([
84
+ 'none',
85
+ 'alphabetical-asc',
86
+ 'alphabetical-desc',
87
+ 'numerical-asc',
88
+ 'numerical-desc',
89
+ 'alphabetical-ci-asc',
90
+ 'alphabetical-ci-desc'
91
+ ]).optional(),
92
+ plugin: _plugin.pluginSchema
93
+ });
94
+ function buildVariableListSpecSchema(pluginSchema) {
95
+ return _zod.z.object({
96
+ name: _zod.z.string().min(1),
97
+ display: variableDisplaySchema.optional(),
98
+ defaultValue: _zod.z.string().or(_zod.z.array(_zod.z.string())).optional(),
99
+ allowAllValue: _zod.z.boolean(),
100
+ allowMultiple: _zod.z.boolean(),
101
+ customAllValue: _zod.z.string().optional(),
102
+ capturingRegexp: _zod.z.string().optional(),
103
+ sort: _zod.z.enum([
104
+ 'none',
105
+ 'alphabetical-asc',
106
+ 'alphabetical-desc',
107
+ 'numerical-asc',
108
+ 'numerical-desc',
109
+ 'alphabetical-ci-asc',
110
+ 'alphabetical-ci-desc'
111
+ ]).optional(),
112
+ plugin: pluginSchema
113
+ });
114
+ }
115
+ const variableListSchema = _zod.z.object({
116
+ kind: _zod.z.literal('ListVariable'),
117
+ spec: variableListSpecSchema
118
+ });
119
+ function buildVariableListSchema(pluginSchema) {
120
+ return _zod.z.object({
121
+ kind: _zod.z.literal('ListVariable'),
122
+ spec: buildVariableListSpecSchema(pluginSchema)
123
+ });
124
+ }
125
+ const variableTextSpecSchema = _zod.z.object({
126
+ name: _zod.z.string().min(1),
127
+ display: variableDisplaySchema.optional(),
128
+ value: _zod.z.string().min(1),
129
+ constant: _zod.z.boolean().optional()
130
+ });
131
+ const variableTextSchema = _zod.z.object({
132
+ kind: _zod.z.literal('TextVariable'),
133
+ spec: variableTextSpecSchema
134
+ });
135
+ const variableSpecSchema = _zod.z.discriminatedUnion('kind', [
136
+ variableTextSchema,
137
+ variableListSchema
138
+ ]);
139
+ function buildVariableSpecSchema(pluginSchema) {
140
+ return _zod.z.union([
141
+ variableTextSchema,
142
+ buildVariableListSchema(pluginSchema)
143
+ ]);
144
+ }
145
+ const variableSchema = _zod.z.object({
146
+ kind: _zod.z.literal('Variable'),
147
+ metadata: _metadata.projectMetadataSchema,
148
+ spec: variableSpecSchema
149
+ });
150
+ const globalVariableSchema = _zod.z.object({
151
+ kind: _zod.z.literal('GlobalVariable'),
152
+ metadata: _metadata.projectMetadataSchema,
153
+ spec: variableSpecSchema
154
+ });
155
+ const variablesSchema = _zod.z.discriminatedUnion('kind', [
156
+ variableSchema,
157
+ globalVariableSchema
158
+ ]);
159
+ const variableDefinitionSchema = variableSpecSchema;
160
+ function buildVariableDefinitionSchema(pluginSchema) {
161
+ return _zod.z.discriminatedUnion('kind', [
162
+ _zod.z.object({
163
+ kind: _zod.z.literal('ListVariable'),
164
+ spec: buildVariableListSpecSchema(pluginSchema)
165
+ }),
166
+ _zod.z.object({
167
+ kind: _zod.z.literal('TextVariable'),
168
+ spec: variableTextSpecSchema
169
+ })
170
+ ]);
171
+ }
@@ -52,12 +52,19 @@ function _define_property(obj, key, value) {
52
52
  async function fetch(...args) {
53
53
  const response = await global.fetch(...args);
54
54
  if (response.ok === false) {
55
- const json = await response.json();
56
- if (json.error) {
57
- throw new UserFriendlyError(json.error, response.status);
55
+ const contentType = response.headers.get('content-type');
56
+ if (contentType === null || contentType === void 0 ? void 0 : contentType.includes('application/json')) {
57
+ const json = await response.json();
58
+ if (json.error) {
59
+ throw new UserFriendlyError(json.error, response.status);
60
+ }
61
+ if (json.message) {
62
+ throw new UserFriendlyError(json.message, response.status);
63
+ }
58
64
  }
59
- if (json.message) {
60
- throw new UserFriendlyError(json.message, response.status);
65
+ const text = await response.text();
66
+ if (text) {
67
+ throw new UserFriendlyError(text, response.status);
61
68
  }
62
69
  throw new FetchError(response);
63
70
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './constants';
2
2
  export * from './model';
3
+ export * from './schema';
3
4
  export * from './utils';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@
12
12
  // limitations under the License.
13
13
  export * from './constants';
14
14
  export * from './model';
15
+ export * from './schema';
15
16
  export * from './utils';
16
17
 
17
18
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './constants';\nexport * from './model';\nexport * from './utils';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,cAAc;AAC5B,cAAc,UAAU;AACxB,cAAc,UAAU"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './constants';\nexport * from './model';\nexport * from './schema';\nexport * from './utils';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,cAAc;AAC5B,cAAc,UAAU;AACxB,cAAc,WAAW;AACzB,cAAc,UAAU"}
@@ -1,4 +1,4 @@
1
- import { TimeSeriesValueTuple } from '@perses-dev/core';
1
+ import { TimeSeriesValueTuple } from './time-series-queries';
2
2
  export declare const DEFAULT_CALCULATION: CalculationType;
3
3
  export declare const CalculationsMap: {
4
4
  first: typeof first;
@@ -1 +1 @@
1
- {"version":3,"file":"calculations.d.ts","sourceRoot":"","sources":["../../src/model/calculations.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBA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EAAE,GAAG,gBAAgB,CAEpE;AAED,iBAAS,IAAI,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,gBAAgB,CAE9D;AAED,iBAAS,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,gBAAgB,CAE7D;AAED,iBAAS,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,gBAAgB,CAE7D;AAED,iBAAS,GAAG,CAAC,MAAM,EAAE,oBAAoB,EAAE,GAAG,gBAAgB,CAE7D"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/calculations.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TimeSeriesValueTuple } from '@perses-dev/core';\n\nexport const DEFAULT_CALCULATION: CalculationType = 'last-number';\n\nexport const CalculationsMap = {\n first: first,\n last: last,\n 'first-number': firstNumber,\n 'last-number': lastNumber,\n mean: mean,\n sum: sum,\n min: min,\n max: max,\n};\n\nexport type CalculationType = keyof typeof CalculationsMap;\n\nexport type CalculationConfig = {\n label: string;\n description: string;\n};\n\nexport const CALCULATIONS_CONFIG: Readonly<Record<CalculationType, CalculationConfig>> = {\n first: {\n label: 'First',\n description: 'First value',\n },\n last: {\n label: 'Last',\n description: 'Last value',\n },\n 'first-number': {\n label: 'First *',\n description: 'First numeric value',\n },\n 'last-number': {\n label: 'Last *',\n description: 'Last numeric value',\n },\n mean: {\n label: 'Avg',\n description: 'Average value excluding nulls',\n },\n sum: {\n label: 'Sum',\n description: 'The sum of all values',\n },\n min: {\n label: 'Min',\n description: 'Minimum value',\n },\n max: {\n label: 'Max',\n description: 'Maximum value',\n },\n} as const;\n\ntype CalculationValue = number | null | undefined;\n\n/**\n * Calculate a multiple values for a set of time series data.\n *\n * @param values - Array of time series data.\n * @param includeCalculations - Array of calculations to include.\n */\nexport function getCalculations<IncludeCalcs extends CalculationType[]>(\n values: TimeSeriesValueTuple[],\n includeCalculations: IncludeCalcs\n): Record<\n // This extract combined with the generics above keeps the key of the returned\n // record to *just* the specified calculations.\n Extract<CalculationType, IncludeCalcs[number]>,\n CalculationValue\n> {\n const calculations = includeCalculations.reduce(\n (initResult, calculation) => {\n initResult[calculation] = undefined;\n return initResult;\n },\n {} as Record<string, CalculationValue>\n );\n\n // We save these values as separate values instead of directly setting them\n // in the calculations because they are needed by multiple calculations.\n let nonNullCount = 0;\n let sum = 0;\n\n // We use this large function capable of performing one or more calculations\n // in a single iteration of the data to minimize the performance impact of\n // generating multiple calculations for large timeseries values. This is\n // less optimized for certain single calculations when done in isolation (e.g.\n // `last`), but will be more performant in the more expensive cases where\n // multiple values are being used (e.g. table legend).\n values.forEach((tuple, i) => {\n const value = tuple[1];\n\n if (i === 0 && 'first' in calculations) {\n calculations.first = value;\n }\n if (i === values.length - 1 && 'last' in calculations) {\n calculations.last = value;\n }\n\n // Handling specific to non-null values.\n if (typeof value === 'number') {\n nonNullCount += 1;\n sum += value;\n\n if ('first-number' in calculations && calculations['first-number'] === undefined) {\n // Save the first number we see.\n calculations['first-number'] = value;\n }\n\n if ('last-number' in calculations) {\n // Keep setting the numbers we see, which will eventually be set to the\n // last number when finished iterating.\n calculations['last-number'] = value;\n }\n\n if ('min' in calculations) {\n if (typeof calculations.min !== 'number') {\n // Init the first time we see a number\n calculations.min = value;\n } else {\n // Use lowest value once initialized\n calculations.min = Math.min(calculations.min, value);\n }\n }\n\n if ('max' in calculations) {\n if (typeof calculations.max !== 'number') {\n // Init the first time we see a number\n calculations.max = value;\n } else {\n // Use highest value once initialized\n calculations.max = Math.max(calculations.max, value);\n }\n }\n }\n });\n\n // Set calculations that require iterating over all values.\n if (nonNullCount > 0 && 'sum' in calculations) {\n calculations.sum = sum;\n }\n\n if (nonNullCount > 0 && 'mean' in calculations) {\n calculations.mean = sum / nonNullCount;\n }\n\n return calculations;\n}\n\n/**\n * Calculate a single value for a set of time series data.\n *\n * Use `getCalculations` instead if you need multiple calculations.\n *\n * @param values - Array of time series data.\n * @param calculation - Name of the calculation to calculate.\n */\nexport function getCalculation(values: TimeSeriesValueTuple[], calculation: CalculationType) {\n return getCalculations(values, [calculation])[calculation];\n}\n\nfunction first(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'first');\n}\n\nfunction last(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'last');\n}\n\nfunction firstNumber(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'first-number');\n}\n\nfunction lastNumber(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'last-number');\n}\n\nfunction mean(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'mean');\n}\n\nfunction sum(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'sum');\n}\n\nfunction min(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'min');\n}\n\nfunction max(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'max');\n}\n"],"names":["DEFAULT_CALCULATION","CalculationsMap","first","last","firstNumber","lastNumber","mean","sum","min","max","CALCULATIONS_CONFIG","label","description","getCalculations","values","includeCalculations","calculations","reduce","initResult","calculation","undefined","nonNullCount","forEach","tuple","i","value","length","Math","getCalculation"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,sBAAuC,cAAc;AAElE,OAAO,MAAMC,kBAAkB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SAASP,IAAIO,MAA8B;IACzC,OAAOc,eAAed,QAAQ;AAChC;AAEA,SAASN,IAAIM,MAA8B;IACzC,OAAOc,eAAed,QAAQ;AAChC;AAEA,SAASL,IAAIK,MAA8B;IACzC,OAAOc,eAAed,QAAQ;AAChC"}
1
+ {"version":3,"sources":["../../src/model/calculations.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { TimeSeriesValueTuple } from './time-series-queries';\n\nexport const DEFAULT_CALCULATION: CalculationType = 'last-number';\n\nexport const CalculationsMap = {\n first: first,\n last: last,\n 'first-number': firstNumber,\n 'last-number': lastNumber,\n mean: mean,\n sum: sum,\n min: min,\n max: max,\n};\n\nexport type CalculationType = keyof typeof CalculationsMap;\n\nexport type CalculationConfig = {\n label: string;\n description: string;\n};\n\nexport const CALCULATIONS_CONFIG: Readonly<Record<CalculationType, CalculationConfig>> = {\n first: {\n label: 'First',\n description: 'First value',\n },\n last: {\n label: 'Last',\n description: 'Last value',\n },\n 'first-number': {\n label: 'First *',\n description: 'First numeric value',\n },\n 'last-number': {\n label: 'Last *',\n description: 'Last numeric value',\n },\n mean: {\n label: 'Avg',\n description: 'Average value excluding nulls',\n },\n sum: {\n label: 'Sum',\n description: 'The sum of all values',\n },\n min: {\n label: 'Min',\n description: 'Minimum value',\n },\n max: {\n label: 'Max',\n description: 'Maximum value',\n },\n} as const;\n\ntype CalculationValue = number | null | undefined;\n\n/**\n * Calculate a multiple values for a set of time series data.\n *\n * @param values - Array of time series data.\n * @param includeCalculations - Array of calculations to include.\n */\nexport function getCalculations<IncludeCalcs extends CalculationType[]>(\n values: TimeSeriesValueTuple[],\n includeCalculations: IncludeCalcs\n): Record<\n // This extract combined with the generics above keeps the key of the returned\n // record to *just* the specified calculations.\n Extract<CalculationType, IncludeCalcs[number]>,\n CalculationValue\n> {\n const calculations = includeCalculations.reduce(\n (initResult, calculation) => {\n initResult[calculation] = undefined;\n return initResult;\n },\n {} as Record<string, CalculationValue>\n );\n\n // We save these values as separate values instead of directly setting them\n // in the calculations because they are needed by multiple calculations.\n let nonNullCount = 0;\n let sum = 0;\n\n // We use this large function capable of performing one or more calculations\n // in a single iteration of the data to minimize the performance impact of\n // generating multiple calculations for large timeseries values. This is\n // less optimized for certain single calculations when done in isolation (e.g.\n // `last`), but will be more performant in the more expensive cases where\n // multiple values are being used (e.g. table legend).\n values.forEach((tuple, i) => {\n const value = tuple[1];\n\n if (i === 0 && 'first' in calculations) {\n calculations.first = value;\n }\n if (i === values.length - 1 && 'last' in calculations) {\n calculations.last = value;\n }\n\n // Handling specific to non-null values.\n if (typeof value === 'number') {\n nonNullCount += 1;\n sum += value;\n\n if ('first-number' in calculations && calculations['first-number'] === undefined) {\n // Save the first number we see.\n calculations['first-number'] = value;\n }\n\n if ('last-number' in calculations) {\n // Keep setting the numbers we see, which will eventually be set to the\n // last number when finished iterating.\n calculations['last-number'] = value;\n }\n\n if ('min' in calculations) {\n if (typeof calculations.min !== 'number') {\n // Init the first time we see a number\n calculations.min = value;\n } else {\n // Use lowest value once initialized\n calculations.min = Math.min(calculations.min, value);\n }\n }\n\n if ('max' in calculations) {\n if (typeof calculations.max !== 'number') {\n // Init the first time we see a number\n calculations.max = value;\n } else {\n // Use highest value once initialized\n calculations.max = Math.max(calculations.max, value);\n }\n }\n }\n });\n\n // Set calculations that require iterating over all values.\n if (nonNullCount > 0 && 'sum' in calculations) {\n calculations.sum = sum;\n }\n\n if (nonNullCount > 0 && 'mean' in calculations) {\n calculations.mean = sum / nonNullCount;\n }\n\n return calculations;\n}\n\n/**\n * Calculate a single value for a set of time series data.\n *\n * Use `getCalculations` instead if you need multiple calculations.\n *\n * @param values - Array of time series data.\n * @param calculation - Name of the calculation to calculate.\n */\nexport function getCalculation(values: TimeSeriesValueTuple[], calculation: CalculationType) {\n return getCalculations(values, [calculation])[calculation];\n}\n\nfunction first(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'first');\n}\n\nfunction last(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'last');\n}\n\nfunction firstNumber(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'first-number');\n}\n\nfunction lastNumber(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'last-number');\n}\n\nfunction mean(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'mean');\n}\n\nfunction sum(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'sum');\n}\n\nfunction min(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'min');\n}\n\nfunction max(values: TimeSeriesValueTuple[]): CalculationValue {\n return getCalculation(values, 'max');\n}\n"],"names":["DEFAULT_CALCULATION","CalculationsMap","first","last","firstNumber","lastNumber","mean","sum","min","max","CALCULATIONS_CONFIG","label","description","getCalculations","values","includeCalculations","calculations","reduce","initResult","calculation","undefined","nonNullCount","forEach","tuple","i","value","length","Math","getCalculation"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAIjC,OAAO,MAAMA,sBAAuC,cAAc;AAElE,OAAO,MAAMC,kBAAkB;IAC7BC,OAAOA;IACPC,MAAMA;IACN,gBAAgBC;IAChB,eAAeC;IACfC,MAAMA;IACNC,KAAKA;IACLC,KAAKA;IACLC,KAAKA;AACP,EAAE;AASF,OAAO,MAAMC,sBAA4E;IACvFR,OAAO;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Q;AAChC"}
@@ -1,10 +1,15 @@
1
1
  import { Definition, UnknownSpec } from './definitions';
2
2
  import { Metadata, ProjectMetadata } from './resource';
3
3
  import { Display } from './display';
4
+ export interface DatasourceSpec<PluginSpec = UnknownSpec> {
5
+ display?: Display;
6
+ default: boolean;
7
+ plugin: Definition<PluginSpec>;
8
+ }
4
9
  /**
5
10
  * A Datasource that's available across all projects.
6
11
  */
7
- export interface GlobalDatasource {
12
+ export interface GlobalDatasourceResource {
8
13
  kind: 'GlobalDatasource';
9
14
  metadata: Metadata;
10
15
  spec: DatasourceSpec;
@@ -12,17 +17,12 @@ export interface GlobalDatasource {
12
17
  /**
13
18
  * A Datasource resource, that belongs to a project.
14
19
  */
15
- export interface ProjectDatasource {
20
+ export interface DatasourceResource {
16
21
  kind: 'Datasource';
17
22
  metadata: ProjectMetadata;
18
23
  spec: DatasourceSpec;
19
24
  }
20
- export type Datasource = ProjectDatasource | GlobalDatasource;
21
- export interface DatasourceSpec<PluginSpec = UnknownSpec> {
22
- display?: Display;
23
- default: boolean;
24
- plugin: Definition<PluginSpec>;
25
- }
25
+ export type Datasource = DatasourceResource | GlobalDatasourceResource;
26
26
  /**
27
27
  * A selector for pointing at a specific Datasource.
28
28
  */
@@ -1 +1 @@
1
- {"version":3,"file":"datasource.d.ts","sourceRoot":"","sources":["../../src/model/datasource.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,kBAAkB,CAAC;IACzB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,cAAc,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,YAAY,CAAC;IAC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AM,UAAU,GAAG,kBAAkB,GAAG,wBAAwB,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,cAAc,CAAC;CACtB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/datasource.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Definition, UnknownSpec } from './definitions';\nimport { Metadata, ProjectMetadata } from './resource';\nimport { Display } from './display';\n\n/**\n * A Datasource that's available across all projects.\n */\nexport interface GlobalDatasource {\n kind: 'GlobalDatasource';\n metadata: Metadata;\n spec: DatasourceSpec;\n}\n\n/**\n * A Datasource resource, that belongs to a project.\n */\nexport interface ProjectDatasource {\n kind: 'Datasource';\n metadata: ProjectMetadata;\n spec: DatasourceSpec;\n}\n\nexport type Datasource = ProjectDatasource | GlobalDatasource;\n\nexport interface DatasourceSpec<PluginSpec = UnknownSpec> {\n display?: Display;\n default: boolean;\n plugin: Definition<PluginSpec>;\n}\n\n/**\n * A selector for pointing at a specific Datasource.\n */\nexport interface DatasourceSelector {\n /**\n * Kind of the datasource.\n */\n kind: string;\n\n /**\n * Name of the datasource.\n * If omitted, it's assumed that you target the default datasource for the specified kind (and group, if set)\n */\n name?: string;\n}\n\n/**\n * An intermediary type to regroup the name and the spec of a datasource.\n */\nexport interface DatasourceDefinition {\n name: string;\n spec: DatasourceSpec;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAgDjC;;CAEC,GACD,WAGC"}
1
+ {"version":3,"sources":["../../src/model/datasource.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Definition, UnknownSpec } from './definitions';\nimport { Metadata, ProjectMetadata } from './resource';\nimport { Display } from './display';\n\nexport interface DatasourceSpec<PluginSpec = UnknownSpec> {\n display?: Display;\n default: boolean;\n plugin: Definition<PluginSpec>;\n}\n\n/**\n * A Datasource that's available across all projects.\n */\nexport interface GlobalDatasourceResource {\n kind: 'GlobalDatasource';\n metadata: Metadata;\n spec: DatasourceSpec;\n}\n\n/**\n * A Datasource resource, that belongs to a project.\n */\nexport interface DatasourceResource {\n kind: 'Datasource';\n metadata: ProjectMetadata;\n spec: DatasourceSpec;\n}\n\nexport type Datasource = DatasourceResource | GlobalDatasourceResource;\n\n/**\n * A selector for pointing at a specific Datasource.\n */\nexport interface DatasourceSelector {\n /**\n * Kind of the datasource.\n */\n kind: string;\n\n /**\n * Name of the datasource.\n * If omitted, it's assumed that you target the default datasource for the specified kind (and group, if set)\n */\n name?: string;\n}\n\n/**\n * An intermediary type to regroup the name and the spec of a datasource.\n */\nexport interface DatasourceDefinition {\n name: string;\n spec: DatasourceSpec;\n}\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAgDjC;;CAEC,GACD,WAGC"}
@@ -23,5 +23,6 @@ export * from './time-series-data';
23
23
  export * from './time-series-queries';
24
24
  export * from './trace-data';
25
25
  export * from './units';
26
+ export * from './user';
26
27
  export * from './variables';
27
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/model/index.ts"],"names":[],"mappings":"AAaA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC"}
@@ -35,6 +35,7 @@ export * from './time-series-data';
35
35
  export * from './time-series-queries';
36
36
  export * from './trace-data';
37
37
  export * from './units';
38
+ export * from './user';
38
39
  export * from './variables';
39
40
 
40
41
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './calculations';\nexport * from './dashboard';\nexport * from './datasource';\nexport * from './definitions';\nexport * from './display';\nexport * from './ephemeraldashboard';\nexport * from './http';\nexport * from './http-proxy';\nexport * from './kind';\nexport * from './layout';\nexport * from './legend';\nexport * from './notice';\nexport * from './panels';\nexport * from './project';\nexport * from './query';\nexport * from './resource';\nexport * from './roles';\nexport * from './rolebindings';\nexport * from './secrets';\nexport * from './thresholds';\nexport * from './time';\nexport * from './time-series-data';\nexport * from './time-series-queries';\nexport * from './trace-data';\nexport * from './units';\nexport * from './variables';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,iBAAiB;AAC/B,cAAc,cAAc;AAC5B,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,YAAY;AAC1B,cAAc,uBAAuB;AACrC,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,UAAU;AACxB,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,iBAAiB;AAC/B,cAAc,YAAY;AAC1B,cAAc,eAAe;AAC7B,cAAc,SAAS;AACvB,cAAc,qBAAqB;AACnC,cAAc,wBAAwB;AACtC,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,cAAc"}
1
+ {"version":3,"sources":["../../src/model/index.ts"],"sourcesContent":["// Copyright 2023 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport * from './calculations';\nexport * from './dashboard';\nexport * from './datasource';\nexport * from './definitions';\nexport * from './display';\nexport * from './ephemeraldashboard';\nexport * from './http';\nexport * from './http-proxy';\nexport * from './kind';\nexport * from './layout';\nexport * from './legend';\nexport * from './notice';\nexport * from './panels';\nexport * from './project';\nexport * from './query';\nexport * from './resource';\nexport * from './roles';\nexport * from './rolebindings';\nexport * from './secrets';\nexport * from './thresholds';\nexport * from './time';\nexport * from './time-series-data';\nexport * from './time-series-queries';\nexport * from './trace-data';\nexport * from './units';\nexport * from './user';\nexport * from './variables';\n"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,cAAc,iBAAiB;AAC/B,cAAc,cAAc;AAC5B,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,YAAY;AAC1B,cAAc,uBAAuB;AACrC,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,YAAY;AAC1B,cAAc,UAAU;AACxB,cAAc,aAAa;AAC3B,cAAc,UAAU;AACxB,cAAc,iBAAiB;AAC/B,cAAc,YAAY;AAC1B,cAAc,eAAe;AAC7B,cAAc,SAAS;AACvB,cAAc,qBAAqB;AACnC,cAAc,wBAAwB;AACtC,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,SAAS;AACvB,cAAc,cAAc"}
@@ -14,7 +14,7 @@ export interface PanelDisplay {
14
14
  export interface PanelDefinition<PluginSpec = UnknownSpec> extends Definition<PanelSpec<PluginSpec>> {
15
15
  kind: 'Panel';
16
16
  }
17
- export interface PanelSpec<PluginSpec> {
17
+ export interface PanelSpec<PluginSpec = UnknownSpec> {
18
18
  display: PanelDisplay;
19
19
  plugin: Definition<PluginSpec>;
20
20
  queries?: QueryDefinition[];
@@ -26,4 +26,12 @@ export interface PanelSpec<PluginSpec> {
26
26
  export interface PanelRef {
27
27
  $ref: `#/spec/panels/${string}`;
28
28
  }
29
+ export type PanelGroupId = number;
30
+ /**
31
+ * Panel values that can be edited in the panel editor.
32
+ */
33
+ export interface PanelEditorValues {
34
+ groupId: PanelGroupId;
35
+ panelDefinition: PanelDefinition;
36
+ }
29
37
  //# sourceMappingURL=panels.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"panels.d.ts","sourceRoot":"","sources":["../../src/model/panels.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE1C,MAAM,WAAW,IAAI;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,eAAe,CAAC,UAAU,GAAG,WAAW,CAAE,SAAQ,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAClG,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,SAAS,CAAC,UAAU;IACnC,OAAO,EAAE,YAAY,CAAC;IACtB,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;IAC5B,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,iBAAiB,MAAM,EAAE,CAAC;C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