@perses-dev/core 0.41.0 → 0.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/model/http-proxy.js +16 -0
- package/dist/cjs/model/index.js +6 -0
- package/dist/cjs/model/kind.js +38 -0
- package/dist/cjs/model/rolebindings.js +16 -0
- package/dist/cjs/model/roles.js +59 -0
- package/dist/cjs/model/secrets.js +25 -0
- package/dist/cjs/model/trace-data.js +16 -0
- package/dist/cjs/model/units/throughput.js +113 -0
- package/dist/cjs/model/units/types.js +2 -1
- package/dist/cjs/model/units/units.js +14 -2
- package/dist/cjs/utils/fetch.js +20 -3
- package/dist/model/datasource.d.ts +0 -9
- package/dist/model/datasource.d.ts.map +1 -1
- package/dist/model/datasource.js.map +1 -1
- package/dist/model/http-proxy.d.ts +16 -0
- package/dist/model/http-proxy.d.ts.map +1 -0
- package/dist/model/http-proxy.js +15 -0
- package/dist/model/http-proxy.js.map +1 -0
- package/dist/model/index.d.ts +6 -0
- package/dist/model/index.d.ts.map +1 -1
- package/dist/model/index.js +6 -0
- package/dist/model/index.js.map +1 -1
- package/dist/model/kind.d.ts +3 -0
- package/dist/model/kind.d.ts.map +1 -0
- package/dist/model/kind.js +30 -0
- package/dist/model/kind.js.map +1 -0
- package/dist/model/query.d.ts +2 -0
- package/dist/model/query.d.ts.map +1 -1
- package/dist/model/query.js.map +1 -1
- 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/roles.d.ts +32 -0
- package/dist/model/roles.d.ts.map +1 -0
- package/dist/model/roles.js +40 -0
- package/dist/model/roles.js.map +1 -0
- package/dist/model/secrets.d.ts +45 -0
- package/dist/model/secrets.d.ts.map +1 -0
- package/dist/model/secrets.js +18 -0
- package/dist/model/secrets.js.map +1 -0
- package/dist/model/trace-data.d.ts +20 -0
- package/dist/model/trace-data.d.ts.map +1 -0
- package/dist/model/trace-data.js +15 -0
- package/dist/model/trace-data.js.map +1 -0
- package/dist/model/units/throughput.d.ts +13 -0
- package/dist/model/units/throughput.d.ts.map +1 -0
- package/dist/model/units/throughput.js +94 -0
- package/dist/model/units/throughput.js.map +1 -0
- package/dist/model/units/types.d.ts +1 -1
- package/dist/model/units/types.d.ts.map +1 -1
- package/dist/model/units/types.js +2 -1
- package/dist/model/units/types.js.map +1 -1
- package/dist/model/units/units.d.ts +13 -1
- package/dist/model/units/units.d.ts.map +1 -1
- package/dist/model/units/units.js +11 -2
- package/dist/model/units/units.js.map +1 -1
- package/dist/model/variables.d.ts +1 -0
- package/dist/model/variables.d.ts.map +1 -1
- package/dist/model/variables.js.map +1 -1
- package/dist/utils/fetch.d.ts +3 -1
- package/dist/utils/fetch.d.ts.map +1 -1
- package/dist/utils/fetch.js +21 -4
- package/dist/utils/fetch.js.map +1 -1
- package/package.json +1 -1
package/dist/model/query.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/model/query.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 { TimeSeriesData } from './time-series-data';\n\ninterface QuerySpec<PluginSpec> {\n plugin: Definition<PluginSpec>;\n}\n/**\n * A generic query definition interface that can be extended to support more than just TimeSeriesQuery\n */\n// Kind needs to be `any` because otherwise typescript will complain 'unknown' is not assignable to type '\"TimeSeriesQuery\"' in a few places\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface QueryDefinition<Kind = any, PluginSpec = UnknownSpec> {\n kind: Kind;\n spec: QuerySpec<PluginSpec>;\n}\n\n/**\n * Mapping the query plugin to the data type it returns\n */\nexport interface QueryType {\n TimeSeriesQuery: TimeSeriesData;\n // in the future we can add other query plugin and data types\n // for example: we can add something like `LogsQuery: LogsData;`\n}\n\n/**\n * Values of QueryType\n * ex: 'TimeSeriesData'\n */\nexport type QueryDataType = QueryType[keyof QueryType];\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,
|
|
1
|
+
{"version":3,"sources":["../../src/model/query.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 { TimeSeriesData } from './time-series-data';\nimport { TraceData } from './trace-data';\n\ninterface QuerySpec<PluginSpec> {\n plugin: Definition<PluginSpec>;\n}\n/**\n * A generic query definition interface that can be extended to support more than just TimeSeriesQuery\n */\n// Kind needs to be `any` because otherwise typescript will complain 'unknown' is not assignable to type '\"TimeSeriesQuery\"' in a few places\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface QueryDefinition<Kind = any, PluginSpec = UnknownSpec> {\n kind: Kind;\n spec: QuerySpec<PluginSpec>;\n}\n\n/**\n * Mapping the query plugin to the data type it returns\n */\nexport interface QueryType {\n TimeSeriesQuery: TimeSeriesData;\n TraceQuery: TraceData;\n // in the future we can add other query plugin and data types\n // for example: we can add something like `LogsQuery: LogsData;`\n}\n\n/**\n * Values of QueryType\n * ex: 'TimeSeriesData'\n */\nexport type QueryDataType = QueryType[keyof QueryType];\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,WA+BuD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Metadata, ProjectMetadata } from './resource';
|
|
2
|
+
export interface Subject {
|
|
3
|
+
kind: 'User';
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export interface RoleBindingSpec {
|
|
7
|
+
role: string;
|
|
8
|
+
subjects: Subject[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A role binding that belongs to a project.
|
|
12
|
+
*/
|
|
13
|
+
export interface RoleBindingResource {
|
|
14
|
+
kind: 'RoleBinding';
|
|
15
|
+
metadata: ProjectMetadata;
|
|
16
|
+
spec: RoleBindingSpec;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A global role binding that doesn´t belong to a project.
|
|
20
|
+
*/
|
|
21
|
+
export interface GlobalRoleBindingResource {
|
|
22
|
+
kind: 'GlobalRoleBinding';
|
|
23
|
+
metadata: Metadata;
|
|
24
|
+
spec: RoleBindingSpec;
|
|
25
|
+
}
|
|
26
|
+
export declare type RoleBinding = RoleBindingResource | GlobalRoleBindingResource;
|
|
27
|
+
//# sourceMappingURL=rolebindings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rolebindings.d.ts","sourceRoot":"","sources":["../../src/model/rolebindings.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEvD,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAE9B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,eAAe,CAAC;IAC1B,IAAI,EAAE,eAAe,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,eAAe,CAAC;CACvB;AAED,oBAAY,WAAW,GAAG,mBAAmB,GAAG,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export { };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=rolebindings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/rolebindings.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 { Metadata, ProjectMetadata } from './resource';\n\nexport interface Subject {\n kind: 'User';\n name: string;\n}\n\nexport interface RoleBindingSpec {\n // name of the role or global role (metadata.name)\n role: string;\n subjects: Subject[];\n}\n\n/**\n * A role binding that belongs to a project.\n */\nexport interface RoleBindingResource {\n kind: 'RoleBinding';\n metadata: ProjectMetadata;\n spec: RoleBindingSpec;\n}\n\n/**\n * A global role binding that doesn´t belong to a project.\n */\nexport interface GlobalRoleBindingResource {\n kind: 'GlobalRoleBinding';\n metadata: Metadata;\n spec: RoleBindingSpec;\n}\n\nexport type RoleBinding = RoleBindingResource | GlobalRoleBindingResource;\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,WA+B0E"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Metadata, ProjectMetadata } from './resource';
|
|
2
|
+
import { Kind } from './kind';
|
|
3
|
+
export declare type Action = 'create' | 'read' | 'update' | 'delete' | '*';
|
|
4
|
+
export declare const ACTIONS: string[];
|
|
5
|
+
export declare type Scope = Kind | '*';
|
|
6
|
+
export declare const PROJECT_SCOPES: string[];
|
|
7
|
+
export declare const GLOBAL_SCOPES: string[];
|
|
8
|
+
export interface Permission {
|
|
9
|
+
actions: Action[];
|
|
10
|
+
scopes: Scope[];
|
|
11
|
+
}
|
|
12
|
+
export interface RoleSpec {
|
|
13
|
+
permissions: Permission[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A role that belongs to a project.
|
|
17
|
+
*/
|
|
18
|
+
export interface RoleResource {
|
|
19
|
+
kind: 'Role';
|
|
20
|
+
metadata: ProjectMetadata;
|
|
21
|
+
spec: RoleSpec;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A global role that doesn´t belong to a project.
|
|
25
|
+
*/
|
|
26
|
+
export interface GlobalRoleResource {
|
|
27
|
+
kind: 'GlobalRole';
|
|
28
|
+
metadata: Metadata;
|
|
29
|
+
spec: RoleSpec;
|
|
30
|
+
}
|
|
31
|
+
export declare type Role = RoleResource | GlobalRoleResource;
|
|
32
|
+
//# sourceMappingURL=roles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roles.d.ts","sourceRoot":"","sources":["../../src/model/roles.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,oBAAY,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,GAAG,CAAC;AACnE,eAAO,MAAM,OAAO,UAA8C,CAAC;AACnE,oBAAY,KAAK,GAAG,IAAI,GAAG,GAAG,CAAC;AAC/B,eAAO,MAAM,cAAc,UAU1B,CAAC;AAEF,eAAO,MAAM,aAAa,UAOzB,CAAC;AAEF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,eAAe,CAAC;IAC1B,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,oBAAY,IAAI,GAAG,YAAY,GAAG,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
export const ACTIONS = [
|
|
14
|
+
'*',
|
|
15
|
+
'create',
|
|
16
|
+
'read',
|
|
17
|
+
'update',
|
|
18
|
+
'delete'
|
|
19
|
+
];
|
|
20
|
+
export const PROJECT_SCOPES = [
|
|
21
|
+
'*',
|
|
22
|
+
'Dashboard',
|
|
23
|
+
'Datasource',
|
|
24
|
+
'Folder',
|
|
25
|
+
'Project',
|
|
26
|
+
'Role',
|
|
27
|
+
'RoleBinding',
|
|
28
|
+
'Secret',
|
|
29
|
+
'Variable'
|
|
30
|
+
];
|
|
31
|
+
export const GLOBAL_SCOPES = [
|
|
32
|
+
'GlobalDatasource',
|
|
33
|
+
'GlobalRole',
|
|
34
|
+
'GlobalRoleBinding',
|
|
35
|
+
'GlobalSecret',
|
|
36
|
+
'GlobalVariable',
|
|
37
|
+
'User'
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=roles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/roles.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 { Metadata, ProjectMetadata } from './resource';\nimport { Kind } from './kind';\n\nexport type Action = 'create' | 'read' | 'update' | 'delete' | '*';\nexport const ACTIONS = ['*', 'create', 'read', 'update', 'delete'];\nexport type Scope = Kind | '*';\nexport const PROJECT_SCOPES = [\n '*',\n 'Dashboard',\n 'Datasource',\n 'Folder',\n 'Project',\n 'Role',\n 'RoleBinding',\n 'Secret',\n 'Variable',\n];\n\nexport const GLOBAL_SCOPES = [\n 'GlobalDatasource',\n 'GlobalRole',\n 'GlobalRoleBinding',\n 'GlobalSecret',\n 'GlobalVariable',\n 'User',\n];\n\nexport interface Permission {\n actions: Action[];\n scopes: Scope[];\n}\n\nexport interface RoleSpec {\n permissions: Permission[];\n}\n\n/**\n * A role that belongs to a project.\n */\nexport interface RoleResource {\n kind: 'Role';\n metadata: ProjectMetadata;\n spec: RoleSpec;\n}\n\n/**\n * A global role that doesn´t belong to a project.\n */\nexport interface GlobalRoleResource {\n kind: 'GlobalRole';\n metadata: Metadata;\n spec: RoleSpec;\n}\n\nexport type Role = RoleResource | GlobalRoleResource;\n"],"names":["ACTIONS","PROJECT_SCOPES","GLOBAL_SCOPES"],"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;AAMjC,OAAO,MAAMA,UAAU;IAAC;IAAK;IAAU;IAAQ;IAAU;CAAS,CAAC;AAEnE,OAAO,MAAMC,iBAAiB;IAC5B;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAC;AAEF,OAAO,MAAMC,gBAAgB;IAC3B;IACA;IACA;IACA;IACA;IACA;CACD,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Metadata, ProjectMetadata } from './resource';
|
|
2
|
+
export interface BasicAuth {
|
|
3
|
+
username: string;
|
|
4
|
+
password?: string;
|
|
5
|
+
passwordFile?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface Authorization {
|
|
8
|
+
type?: string;
|
|
9
|
+
credentials?: string;
|
|
10
|
+
credentialsFile?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface TLSConfig {
|
|
13
|
+
ca?: string;
|
|
14
|
+
cert?: string;
|
|
15
|
+
key?: string;
|
|
16
|
+
caFile?: string;
|
|
17
|
+
certFile?: string;
|
|
18
|
+
keyFile?: string;
|
|
19
|
+
serverName?: string;
|
|
20
|
+
insecureSkipVerify: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface SecretSpec {
|
|
23
|
+
basicAuth?: BasicAuth;
|
|
24
|
+
authorization?: Authorization;
|
|
25
|
+
tlsConfig?: TLSConfig;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A secret that belongs to a project.
|
|
29
|
+
*/
|
|
30
|
+
export interface SecretResource {
|
|
31
|
+
kind: 'Secret';
|
|
32
|
+
metadata: ProjectMetadata;
|
|
33
|
+
spec: SecretSpec;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A global secret that doesn´t belong to a project.
|
|
37
|
+
*/
|
|
38
|
+
export interface GlobalSecretResource {
|
|
39
|
+
kind: 'GlobalSecret';
|
|
40
|
+
metadata: Metadata;
|
|
41
|
+
spec: SecretSpec;
|
|
42
|
+
}
|
|
43
|
+
export declare type Secret = SecretResource | GlobalSecretResource;
|
|
44
|
+
export declare function getSecretProject(secret: Secret): string | undefined;
|
|
45
|
+
//# sourceMappingURL=secrets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.d.ts","sourceRoot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
|
|
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
|
+
// TODO: check
|
|
14
|
+
export function getSecretProject(secret) {
|
|
15
|
+
return 'project' in secret.metadata ? secret.metadata.project : undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=secrets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/secrets.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 { Metadata, ProjectMetadata } from './resource';\n\nexport interface BasicAuth {\n username: string;\n password?: string;\n passwordFile?: string;\n}\n\nexport interface Authorization {\n type?: string;\n credentials?: string;\n credentialsFile?: string;\n}\n\nexport interface TLSConfig {\n ca?: string;\n cert?: string;\n key?: string;\n caFile?: string;\n certFile?: string;\n keyFile?: string;\n serverName?: string;\n insecureSkipVerify: boolean;\n}\n\nexport interface SecretSpec {\n basicAuth?: BasicAuth;\n authorization?: Authorization;\n tlsConfig?: TLSConfig;\n}\n\n/**\n * A secret that belongs to a project.\n */\nexport interface SecretResource {\n kind: 'Secret';\n metadata: ProjectMetadata;\n spec: SecretSpec;\n}\n\n/**\n * A global secret that doesn´t belong to a project.\n */\nexport interface GlobalSecretResource {\n kind: 'GlobalSecret';\n metadata: Metadata;\n spec: SecretSpec;\n}\n\nexport type Secret = SecretResource | GlobalSecretResource;\n\n// TODO: check\nexport function getSecretProject(secret: Secret) {\n return 'project' in secret.metadata ? secret.metadata.project : undefined;\n}\n"],"names":["getSecretProject","secret","metadata","project","undefined"],"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;AAqDjC,cAAc;AACd,OAAO,SAASA,iBAAiBC,MAAc;IAC7C,OAAO,aAAaA,OAAOC,WAAWD,OAAOC,SAASC,UAAUC;AAClE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface TraceMetaData {
|
|
2
|
+
executedQueryString?: string;
|
|
3
|
+
}
|
|
4
|
+
export interface TraceValue {
|
|
5
|
+
startTimeUnixMs: number;
|
|
6
|
+
durationMs: number;
|
|
7
|
+
spanCount?: number;
|
|
8
|
+
errorCount?: number;
|
|
9
|
+
traceId?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A generalized data-model that will be used by Panel components
|
|
14
|
+
* to display traces.
|
|
15
|
+
*/
|
|
16
|
+
export interface TraceData {
|
|
17
|
+
traces: TraceValue[];
|
|
18
|
+
metadata?: TraceMetaData;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=trace-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trace-data.d.ts","sourceRoot":"","sources":["../../src/model/trace-data.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,aAAa;IAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
export { };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=trace-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/model/trace-data.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 interface TraceMetaData {\n executedQueryString?: string;\n}\n\nexport interface TraceValue {\n startTimeUnixMs: number;\n durationMs: number;\n spanCount?: number;\n errorCount?: number;\n traceId?: string;\n name?: string;\n}\n\n/**\n * A generalized data-model that will be used by Panel components\n * to display traces.\n */\nexport interface TraceData {\n traces: TraceValue[];\n metadata?: TraceMetaData;\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;AAEjC,WAoBC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { UnitGroupConfig, UnitConfig } from './types';
|
|
2
|
+
declare const throughputUnits: readonly ["counts/sec", "events/sec", "messages/sec", "ops/sec", "packets/sec", "reads/sec", "records/sec", "requests/sec", "rows/sec", "writes/sec"];
|
|
3
|
+
declare type ThroughputUnit = (typeof throughputUnits)[number];
|
|
4
|
+
export declare type ThroughputFormatOptions = {
|
|
5
|
+
unit: ThroughputUnit;
|
|
6
|
+
decimalPlaces?: number;
|
|
7
|
+
shortValues?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const THROUGHPUT_GROUP_CONFIG: UnitGroupConfig;
|
|
10
|
+
export declare const THROUGHPUT_UNIT_CONFIG: Readonly<Record<ThroughputUnit, UnitConfig>>;
|
|
11
|
+
export declare function formatThroughput(value: number, { unit, shortValues, decimalPlaces }: ThroughputFormatOptions): string;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=throughput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"throughput.d.ts","sourceRoot":"","sources":["../../../src/model/units/throughput.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGtD,QAAA,MAAM,eAAe,uJAWX,CAAC;AACX,aAAK,cAAc,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AACvD,oBAAY,uBAAuB,GAAG;IACpC,IAAI,EAAE,cAAc,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AACF,eAAO,MAAM,uBAAuB,EAAE,eAGrC,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,EAAE,UAAU,CAAC,CAyC/E,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,aAAa,EAAE,EAAE,uBAAuB,GAAG,MAAM,CAqBrH"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Copyright 2023 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { MAX_SIGNIFICANT_DIGITS } from './constants';
|
|
14
|
+
import { hasDecimalPlaces, limitDecimalPlaces, shouldShortenValues } from './utils';
|
|
15
|
+
const throughputUnits = [
|
|
16
|
+
'counts/sec',
|
|
17
|
+
'events/sec',
|
|
18
|
+
'messages/sec',
|
|
19
|
+
'ops/sec',
|
|
20
|
+
'packets/sec',
|
|
21
|
+
'reads/sec',
|
|
22
|
+
'records/sec',
|
|
23
|
+
'requests/sec',
|
|
24
|
+
'rows/sec',
|
|
25
|
+
'writes/sec'
|
|
26
|
+
];
|
|
27
|
+
export const THROUGHPUT_GROUP_CONFIG = {
|
|
28
|
+
label: 'Throughput',
|
|
29
|
+
decimalPlaces: true
|
|
30
|
+
};
|
|
31
|
+
const THROUGHPUT_GROUP = 'Throughput';
|
|
32
|
+
export const THROUGHPUT_UNIT_CONFIG = {
|
|
33
|
+
'counts/sec': {
|
|
34
|
+
group: THROUGHPUT_GROUP,
|
|
35
|
+
label: 'Counts/sec'
|
|
36
|
+
},
|
|
37
|
+
'events/sec': {
|
|
38
|
+
group: THROUGHPUT_GROUP,
|
|
39
|
+
label: 'Events/sec'
|
|
40
|
+
},
|
|
41
|
+
'messages/sec': {
|
|
42
|
+
group: THROUGHPUT_GROUP,
|
|
43
|
+
label: 'Messages/sec'
|
|
44
|
+
},
|
|
45
|
+
'ops/sec': {
|
|
46
|
+
group: THROUGHPUT_GROUP,
|
|
47
|
+
label: 'Ops/sec'
|
|
48
|
+
},
|
|
49
|
+
'packets/sec': {
|
|
50
|
+
group: THROUGHPUT_GROUP,
|
|
51
|
+
label: 'Packets/sec'
|
|
52
|
+
},
|
|
53
|
+
'reads/sec': {
|
|
54
|
+
group: THROUGHPUT_GROUP,
|
|
55
|
+
label: 'Reads/sec'
|
|
56
|
+
},
|
|
57
|
+
'requests/sec': {
|
|
58
|
+
group: THROUGHPUT_GROUP,
|
|
59
|
+
label: 'Requests/sec'
|
|
60
|
+
},
|
|
61
|
+
'records/sec': {
|
|
62
|
+
group: THROUGHPUT_GROUP,
|
|
63
|
+
label: 'Records/sec'
|
|
64
|
+
},
|
|
65
|
+
'rows/sec': {
|
|
66
|
+
group: THROUGHPUT_GROUP,
|
|
67
|
+
label: 'Rows/sec'
|
|
68
|
+
},
|
|
69
|
+
'writes/sec': {
|
|
70
|
+
group: THROUGHPUT_GROUP,
|
|
71
|
+
label: 'Writes/sec'
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
export function formatThroughput(value, { unit , shortValues , decimalPlaces }) {
|
|
75
|
+
const formatterOptions = {
|
|
76
|
+
style: 'decimal',
|
|
77
|
+
useGrouping: true
|
|
78
|
+
};
|
|
79
|
+
if (shouldShortenValues(shortValues)) {
|
|
80
|
+
formatterOptions.notation = 'compact';
|
|
81
|
+
}
|
|
82
|
+
if (hasDecimalPlaces(decimalPlaces)) {
|
|
83
|
+
formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimalPlaces);
|
|
84
|
+
formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimalPlaces);
|
|
85
|
+
} else {
|
|
86
|
+
if (shouldShortenValues(shortValues)) {
|
|
87
|
+
formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const formatter = Intl.NumberFormat('en-US', formatterOptions);
|
|
91
|
+
return formatter.format(value) + ' ' + unit;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=throughput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/throughput.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 { MAX_SIGNIFICANT_DIGITS } from './constants';\nimport { UnitGroupConfig, UnitConfig } from './types';\nimport { hasDecimalPlaces, limitDecimalPlaces, shouldShortenValues } from './utils';\n\nconst throughputUnits = [\n 'counts/sec',\n 'events/sec',\n 'messages/sec',\n 'ops/sec',\n 'packets/sec',\n 'reads/sec',\n 'records/sec',\n 'requests/sec',\n 'rows/sec',\n 'writes/sec',\n] as const;\ntype ThroughputUnit = (typeof throughputUnits)[number];\nexport type ThroughputFormatOptions = {\n unit: ThroughputUnit;\n decimalPlaces?: number;\n shortValues?: boolean;\n};\nexport const THROUGHPUT_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Throughput',\n decimalPlaces: true,\n};\nconst THROUGHPUT_GROUP = 'Throughput';\nexport const THROUGHPUT_UNIT_CONFIG: Readonly<Record<ThroughputUnit, UnitConfig>> = {\n 'counts/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Counts/sec',\n },\n 'events/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Events/sec',\n },\n 'messages/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Messages/sec',\n },\n 'ops/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Ops/sec',\n },\n 'packets/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Packets/sec',\n },\n 'reads/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Reads/sec',\n },\n 'requests/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Requests/sec',\n },\n 'records/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Records/sec',\n },\n 'rows/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Rows/sec',\n },\n 'writes/sec': {\n group: THROUGHPUT_GROUP,\n label: 'Writes/sec',\n },\n};\n\nexport function formatThroughput(value: number, { unit, shortValues, decimalPlaces }: ThroughputFormatOptions): string {\n const formatterOptions: Intl.NumberFormatOptions = {\n style: 'decimal',\n useGrouping: true,\n };\n\n if (shouldShortenValues(shortValues)) {\n formatterOptions.notation = 'compact';\n }\n\n if (hasDecimalPlaces(decimalPlaces)) {\n formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimalPlaces);\n formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimalPlaces);\n } else {\n if (shouldShortenValues(shortValues)) {\n formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;\n }\n }\n\n const formatter = Intl.NumberFormat('en-US', formatterOptions);\n return formatter.format(value) + ' ' + unit;\n}\n"],"names":["MAX_SIGNIFICANT_DIGITS","hasDecimalPlaces","limitDecimalPlaces","shouldShortenValues","throughputUnits","THROUGHPUT_GROUP_CONFIG","label","decimalPlaces","THROUGHPUT_GROUP","THROUGHPUT_UNIT_CONFIG","group","formatThroughput","value","unit","shortValues","formatterOptions","style","useGrouping","notation","minimumFractionDigits","maximumFractionDigits","maximumSignificantDigits","formatter","Intl","NumberFormat","format"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,sBAAsB,QAAQ,cAAc;AAErD,SAASC,gBAAgB,EAAEC,kBAAkB,EAAEC,mBAAmB,QAAQ,UAAU;AAEpF,MAAMC,kBAAkB;IACtB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAOD,OAAO,MAAMC,0BAA2C;IACtDC,OAAO;IACPC,eAAe;AACjB,EAAE;AACF,MAAMC,mBAAmB;AACzB,OAAO,MAAMC,yBAAuE;IAClF,cAAc;QACZC,OAAOF;QACPF,OAAO;IACT;IACA,cAAc;QACZI,OAAOF;QACPF,OAAO;IACT;IACA,gBAAgB;QACdI,OAAOF;QACPF,OAAO;IACT;IACA,WAAW;QACTI,OAAOF;QACPF,OAAO;IACT;IACA,eAAe;QACbI,OAAOF;QACPF,OAAO;IACT;IACA,aAAa;QACXI,OAAOF;QACPF,OAAO;IACT;IACA,gBAAgB;QACdI,OAAOF;QACPF,OAAO;IACT;IACA,eAAe;QACbI,OAAOF;QACPF,OAAO;IACT;IACA,YAAY;QACVI,OAAOF;QACPF,OAAO;IACT;IACA,cAAc;QACZI,OAAOF;QACPF,OAAO;IACT;AACF,EAAE;AAEF,OAAO,SAASK,iBAAiBC,KAAa,EAAE,EAAEC,KAAI,EAAEC,YAAW,EAAEP,cAAa,EAA2B;IAC3G,MAAMQ,mBAA6C;QACjDC,OAAO;QACPC,aAAa;IACf;IAEA,IAAId,oBAAoBW,cAAc;QACpCC,iBAAiBG,WAAW;IAC9B;IAEA,IAAIjB,iBAAiBM,gBAAgB;QACnCQ,iBAAiBI,wBAAwBjB,mBAAmBK;QAC5DQ,iBAAiBK,wBAAwBlB,mBAAmBK;IAC9D,OAAO;QACL,IAAIJ,oBAAoBW,cAAc;YACpCC,iBAAiBM,2BAA2BrB;QAC9C;IACF;IAEA,MAAMsB,YAAYC,KAAKC,aAAa,SAAST;IAC7C,OAAOO,UAAUG,OAAOb,SAAS,MAAMC;AACzC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbsoluteTimeRange, DurationString } from '../time';
|
|
2
2
|
import { FormatOptions } from './units';
|
|
3
|
-
export declare const UNIT_GROUPS: readonly ["Time", "Percent", "Decimal", "Bytes"];
|
|
3
|
+
export declare const UNIT_GROUPS: readonly ["Time", "Percent", "Decimal", "Bytes", "Throughput"];
|
|
4
4
|
export declare type UnitGroup = (typeof UNIT_GROUPS)[number];
|
|
5
5
|
/**
|
|
6
6
|
* Configuration for rendering units that are part of a group.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/model/units/types.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/model/units/types.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,eAAO,MAAM,WAAW,gEAAiE,CAAC;AAC1F,oBAAY,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD;;GAEG;AACH,oBAAY,eAAe,GAAG;IAC5B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF;;GAEG;AACH,oBAAY,UAAU,GAAG;IACvB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAEhC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,cAAc,CAAC;CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/units/types.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\n// Common types needed across individual unit groups and the overall combined\n// units.\n\nimport { AbsoluteTimeRange, DurationString } from '../time';\nimport { FormatOptions } from './units';\n\nexport const UNIT_GROUPS = ['Time', 'Percent', 'Decimal', 'Bytes'] as const;\nexport type UnitGroup = (typeof UNIT_GROUPS)[number];\n\n/**\n * Configuration for rendering units that are part of a group.\n */\nexport type UnitGroupConfig = {\n /**\n * The label that is shown in the UI.\n */\n label: string;\n /**\n * When true, the unit group supports setting decimal places.\n */\n decimalPlaces?: boolean;\n /**\n * When true, the unit group supports enabling shortValues.\n */\n shortValues?: boolean;\n};\n\n/**\n * Configuration for rendering a specific unit.\n */\nexport type UnitConfig = {\n /**\n * The group the unit is part of. This will inform common rendering behavior.\n */\n group: UnitGroup;\n\n /**\n * When true, this unit will not be displayed in the unit selector. This is\n * useful for units that are shorthand variants of other units.\n */\n disableSelectorOption?: boolean;\n\n /**\n * The label that is shown in the UI.\n */\n label: string;\n};\n\n/**\n * Used in the tests for each type of unit.\n */\nexport interface UnitTestCase {\n value: number;\n format: FormatOptions;\n expected: string;\n}\n\nexport interface IntervalTestCase {\n timeRange: AbsoluteTimeRange;\n expected: Duration;\n}\n\nexport interface FormatTestCase {\n duration: Duration;\n expected: DurationString;\n}\n"],"names":["UNIT_GROUPS"],"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,6EAA6E;AAC7E,SAAS;AAKT,OAAO,MAAMA,cAAc;IAAC;IAAQ;IAAW;IAAW;
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/types.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\n// Common types needed across individual unit groups and the overall combined\n// units.\n\nimport { AbsoluteTimeRange, DurationString } from '../time';\nimport { FormatOptions } from './units';\n\nexport const UNIT_GROUPS = ['Time', 'Percent', 'Decimal', 'Bytes', 'Throughput'] as const;\nexport type UnitGroup = (typeof UNIT_GROUPS)[number];\n\n/**\n * Configuration for rendering units that are part of a group.\n */\nexport type UnitGroupConfig = {\n /**\n * The label that is shown in the UI.\n */\n label: string;\n /**\n * When true, the unit group supports setting decimal places.\n */\n decimalPlaces?: boolean;\n /**\n * When true, the unit group supports enabling shortValues.\n */\n shortValues?: boolean;\n};\n\n/**\n * Configuration for rendering a specific unit.\n */\nexport type UnitConfig = {\n /**\n * The group the unit is part of. This will inform common rendering behavior.\n */\n group: UnitGroup;\n\n /**\n * When true, this unit will not be displayed in the unit selector. This is\n * useful for units that are shorthand variants of other units.\n */\n disableSelectorOption?: boolean;\n\n /**\n * The label that is shown in the UI.\n */\n label: string;\n};\n\n/**\n * Used in the tests for each type of unit.\n */\nexport interface UnitTestCase {\n value: number;\n format: FormatOptions;\n expected: string;\n}\n\nexport interface IntervalTestCase {\n timeRange: AbsoluteTimeRange;\n expected: Duration;\n}\n\nexport interface FormatTestCase {\n duration: Duration;\n expected: DurationString;\n}\n"],"names":["UNIT_GROUPS"],"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,6EAA6E;AAC7E,SAAS;AAKT,OAAO,MAAMA,cAAc;IAAC;IAAQ;IAAW;IAAW;IAAS;CAAa,CAAU"}
|
|
@@ -3,6 +3,7 @@ import { DecimalFormatOptions as DecimalFormatOptions } from './decimal';
|
|
|
3
3
|
import { PercentFormatOptions as PercentFormatOptions } from './percent';
|
|
4
4
|
import { TimeFormatOptions as TimeFormatOptions } from './time';
|
|
5
5
|
import { UnitGroup, UnitGroupConfig, UnitConfig } from './types';
|
|
6
|
+
import { ThroughputFormatOptions } from './throughput';
|
|
6
7
|
/**
|
|
7
8
|
* Most of the number formatting is based on Intl.NumberFormat, which is built into JavaScript.
|
|
8
9
|
* Prefer Intl.NumbeFormat because it covers most use cases and will continue to be supported with time.
|
|
@@ -12,6 +13,16 @@ import { UnitGroup, UnitGroupConfig, UnitConfig } from './types';
|
|
|
12
13
|
*/
|
|
13
14
|
export declare const UNIT_GROUP_CONFIG: Readonly<Record<UnitGroup, UnitGroupConfig>>;
|
|
14
15
|
export declare const UNIT_CONFIG: {
|
|
16
|
+
readonly "counts/sec": UnitConfig;
|
|
17
|
+
readonly "events/sec": UnitConfig;
|
|
18
|
+
readonly "messages/sec": UnitConfig;
|
|
19
|
+
readonly "ops/sec": UnitConfig;
|
|
20
|
+
readonly "packets/sec": UnitConfig;
|
|
21
|
+
readonly "reads/sec": UnitConfig;
|
|
22
|
+
readonly "records/sec": UnitConfig;
|
|
23
|
+
readonly "requests/sec": UnitConfig;
|
|
24
|
+
readonly "rows/sec": UnitConfig;
|
|
25
|
+
readonly "writes/sec": UnitConfig;
|
|
15
26
|
readonly bytes: UnitConfig;
|
|
16
27
|
readonly decimal: UnitConfig;
|
|
17
28
|
readonly percent: UnitConfig;
|
|
@@ -26,7 +37,7 @@ export declare const UNIT_CONFIG: {
|
|
|
26
37
|
readonly months: UnitConfig;
|
|
27
38
|
readonly years: UnitConfig;
|
|
28
39
|
};
|
|
29
|
-
export declare type FormatOptions = TimeFormatOptions | PercentFormatOptions | DecimalFormatOptions | BytesFormatOptions;
|
|
40
|
+
export declare type FormatOptions = TimeFormatOptions | PercentFormatOptions | DecimalFormatOptions | BytesFormatOptions | ThroughputFormatOptions;
|
|
30
41
|
declare type HasDecimalPlaces<UnitOpt> = UnitOpt extends {
|
|
31
42
|
decimalPlaces?: number;
|
|
32
43
|
} ? UnitOpt : never;
|
|
@@ -43,5 +54,6 @@ export declare function isDecimalUnit(formatOptions: FormatOptions): formatOptio
|
|
|
43
54
|
export declare function isBytesUnit(formatOptions: FormatOptions): formatOptions is BytesFormatOptions;
|
|
44
55
|
export declare function isUnitWithDecimalPlaces(formatOptions: FormatOptions): formatOptions is HasDecimalPlaces<FormatOptions>;
|
|
45
56
|
export declare function isUnitWithShortValues(formatOptions: FormatOptions): formatOptions is HasShortValues<FormatOptions>;
|
|
57
|
+
export declare function isThroughputUnit(formatOptions: FormatOptions): formatOptions is ThroughputFormatOptions;
|
|
46
58
|
export {};
|
|
47
59
|
//# sourceMappingURL=units.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../../src/model/units/units.ts"],"names":[],"mappings":"AAaA,OAAO,EAAe,kBAAkB,IAAI,kBAAkB,EAAyC,MAAM,SAAS,CAAC;AACvH,OAAO,EAEL,oBAAoB,IAAI,oBAAoB,EAG7C,MAAM,WAAW,CAAC;AACnB,OAAO,EAEL,oBAAoB,IAAI,oBAAoB,EAG7C,MAAM,WAAW,CAAC;AACnB,OAAO,EAAc,iBAAiB,IAAI,iBAAiB,EAAuC,MAAM,QAAQ,CAAC;AACjH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../../src/model/units/units.ts"],"names":[],"mappings":"AAaA,OAAO,EAAe,kBAAkB,IAAI,kBAAkB,EAAyC,MAAM,SAAS,CAAC;AACvH,OAAO,EAEL,oBAAoB,IAAI,oBAAoB,EAG7C,MAAM,WAAW,CAAC;AACnB,OAAO,EAEL,oBAAoB,IAAI,oBAAoB,EAG7C,MAAM,WAAW,CAAC;AACnB,OAAO,EAAc,iBAAiB,IAAI,iBAAiB,EAAuC,MAAM,QAAQ,CAAC;AACjH,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,UAAU,EA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,GAC3B,aAAa,IAAI,gBAAgB,CAAC,aAAa,CAAC,CAIlD;AAED,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,aAAa,GAAG,aAAa,IAAI,cAAc,CAAC,aAAa,CAAC,CAIlH;AAED,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,aAAa,GAAG,aAAa,IAAI,uBAAuB,CAEvG"}
|
|
@@ -14,6 +14,7 @@ import { formatBytes, BYTES_GROUP_CONFIG, BYTES_UNIT_CONFIG } from './bytes';
|
|
|
14
14
|
import { formatDecimal, DECIMAL_GROUP_CONFIG, DECIMAL_UNIT_CONFIG } from './decimal';
|
|
15
15
|
import { formatPercent, PERCENT_GROUP_CONFIG, PERCENT_UNIT_CONFIG } from './percent';
|
|
16
16
|
import { formatTime, TIME_GROUP_CONFIG, TIME_UNIT_CONFIG } from './time';
|
|
17
|
+
import { formatThroughput, THROUGHPUT_GROUP_CONFIG, THROUGHPUT_UNIT_CONFIG } from './throughput';
|
|
17
18
|
/**
|
|
18
19
|
* Most of the number formatting is based on Intl.NumberFormat, which is built into JavaScript.
|
|
19
20
|
* Prefer Intl.NumbeFormat because it covers most use cases and will continue to be supported with time.
|
|
@@ -24,13 +25,15 @@ import { formatTime, TIME_GROUP_CONFIG, TIME_UNIT_CONFIG } from './time';
|
|
|
24
25
|
Time: TIME_GROUP_CONFIG,
|
|
25
26
|
Percent: PERCENT_GROUP_CONFIG,
|
|
26
27
|
Decimal: DECIMAL_GROUP_CONFIG,
|
|
27
|
-
Bytes: BYTES_GROUP_CONFIG
|
|
28
|
+
Bytes: BYTES_GROUP_CONFIG,
|
|
29
|
+
Throughput: THROUGHPUT_GROUP_CONFIG
|
|
28
30
|
};
|
|
29
31
|
export const UNIT_CONFIG = {
|
|
30
32
|
...TIME_UNIT_CONFIG,
|
|
31
33
|
...PERCENT_UNIT_CONFIG,
|
|
32
34
|
...DECIMAL_UNIT_CONFIG,
|
|
33
|
-
...BYTES_UNIT_CONFIG
|
|
35
|
+
...BYTES_UNIT_CONFIG,
|
|
36
|
+
...THROUGHPUT_UNIT_CONFIG
|
|
34
37
|
};
|
|
35
38
|
export function formatValue(value, formatOptions) {
|
|
36
39
|
if (formatOptions === undefined) {
|
|
@@ -48,6 +51,9 @@ export function formatValue(value, formatOptions) {
|
|
|
48
51
|
if (isTimeUnit(formatOptions)) {
|
|
49
52
|
return formatTime(value, formatOptions);
|
|
50
53
|
}
|
|
54
|
+
if (isThroughputUnit(formatOptions)) {
|
|
55
|
+
return formatThroughput(value, formatOptions);
|
|
56
|
+
}
|
|
51
57
|
const exhaustive = formatOptions;
|
|
52
58
|
throw new Error(`Unknown unit options ${exhaustive}`);
|
|
53
59
|
}
|
|
@@ -82,5 +88,8 @@ export function isUnitWithShortValues(formatOptions) {
|
|
|
82
88
|
const groupConfig = getUnitGroupConfig(formatOptions);
|
|
83
89
|
return !!groupConfig.shortValues;
|
|
84
90
|
}
|
|
91
|
+
export function isThroughputUnit(formatOptions) {
|
|
92
|
+
return getUnitGroup(formatOptions) == 'Throughput';
|
|
93
|
+
}
|
|
85
94
|
|
|
86
95
|
//# sourceMappingURL=units.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/model/units/units.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 { formatBytes, BytesFormatOptions as BytesFormatOptions, BYTES_GROUP_CONFIG, BYTES_UNIT_CONFIG } from './bytes';\nimport {\n formatDecimal,\n DecimalFormatOptions as DecimalFormatOptions,\n DECIMAL_GROUP_CONFIG,\n DECIMAL_UNIT_CONFIG,\n} from './decimal';\nimport {\n formatPercent,\n PercentFormatOptions as PercentFormatOptions,\n PERCENT_GROUP_CONFIG,\n PERCENT_UNIT_CONFIG,\n} from './percent';\nimport { formatTime, TimeFormatOptions as TimeFormatOptions, TIME_GROUP_CONFIG, TIME_UNIT_CONFIG } from './time';\nimport { UnitGroup, UnitGroupConfig, UnitConfig } from './types';\n\n/**\n * Most of the number formatting is based on Intl.NumberFormat, which is built into JavaScript.\n * Prefer Intl.NumbeFormat because it covers most use cases and will continue to be supported with time.\n *\n * To format bytes, we also make use of the `numbro` package,\n * because it can handle adding units like KB, MB, GB, etc. correctly.\n */\n\nexport const UNIT_GROUP_CONFIG: Readonly<Record<UnitGroup, UnitGroupConfig>> = {\n Time: TIME_GROUP_CONFIG,\n Percent: PERCENT_GROUP_CONFIG,\n Decimal: DECIMAL_GROUP_CONFIG,\n Bytes: BYTES_GROUP_CONFIG,\n};\nexport const UNIT_CONFIG = {\n ...TIME_UNIT_CONFIG,\n ...PERCENT_UNIT_CONFIG,\n ...DECIMAL_UNIT_CONFIG,\n ...BYTES_UNIT_CONFIG,\n} as const;\n\nexport type FormatOptions
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/units.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 { formatBytes, BytesFormatOptions as BytesFormatOptions, BYTES_GROUP_CONFIG, BYTES_UNIT_CONFIG } from './bytes';\nimport {\n formatDecimal,\n DecimalFormatOptions as DecimalFormatOptions,\n DECIMAL_GROUP_CONFIG,\n DECIMAL_UNIT_CONFIG,\n} from './decimal';\nimport {\n formatPercent,\n PercentFormatOptions as PercentFormatOptions,\n PERCENT_GROUP_CONFIG,\n PERCENT_UNIT_CONFIG,\n} from './percent';\nimport { formatTime, TimeFormatOptions as TimeFormatOptions, TIME_GROUP_CONFIG, TIME_UNIT_CONFIG } from './time';\nimport { UnitGroup, UnitGroupConfig, UnitConfig } from './types';\nimport {\n formatThroughput,\n THROUGHPUT_GROUP_CONFIG,\n THROUGHPUT_UNIT_CONFIG,\n ThroughputFormatOptions,\n} from './throughput';\n\n/**\n * Most of the number formatting is based on Intl.NumberFormat, which is built into JavaScript.\n * Prefer Intl.NumbeFormat because it covers most use cases and will continue to be supported with time.\n *\n * To format bytes, we also make use of the `numbro` package,\n * because it can handle adding units like KB, MB, GB, etc. correctly.\n */\n\nexport const UNIT_GROUP_CONFIG: Readonly<Record<UnitGroup, UnitGroupConfig>> = {\n Time: TIME_GROUP_CONFIG,\n Percent: PERCENT_GROUP_CONFIG,\n Decimal: DECIMAL_GROUP_CONFIG,\n Bytes: BYTES_GROUP_CONFIG,\n Throughput: THROUGHPUT_GROUP_CONFIG,\n};\nexport const UNIT_CONFIG = {\n ...TIME_UNIT_CONFIG,\n ...PERCENT_UNIT_CONFIG,\n ...DECIMAL_UNIT_CONFIG,\n ...BYTES_UNIT_CONFIG,\n ...THROUGHPUT_UNIT_CONFIG,\n} as const;\n\nexport type FormatOptions =\n | TimeFormatOptions\n | PercentFormatOptions\n | DecimalFormatOptions\n | BytesFormatOptions\n | ThroughputFormatOptions;\n\ntype HasDecimalPlaces<UnitOpt> = UnitOpt extends { decimalPlaces?: number } ? UnitOpt : never;\ntype HasShortValues<UnitOpt> = UnitOpt extends { shortValues?: boolean } ? UnitOpt : never;\n\nexport function formatValue(value: number, formatOptions?: FormatOptions): string {\n if (formatOptions === undefined) {\n return value.toString();\n }\n\n if (isBytesUnit(formatOptions)) {\n return formatBytes(value, formatOptions);\n }\n\n if (isDecimalUnit(formatOptions)) {\n return formatDecimal(value, formatOptions);\n }\n\n if (isPercentUnit(formatOptions)) {\n return formatPercent(value, formatOptions);\n }\n\n if (isTimeUnit(formatOptions)) {\n return formatTime(value, formatOptions);\n }\n\n if (isThroughputUnit(formatOptions)) {\n return formatThroughput(value, formatOptions);\n }\n\n const exhaustive: never = formatOptions;\n throw new Error(`Unknown unit options ${exhaustive}`);\n}\n\nexport function getUnitConfig(formatOptions: FormatOptions): UnitConfig {\n return UNIT_CONFIG[formatOptions.unit];\n}\n\nexport function getUnitGroup(formatOptions: FormatOptions): UnitGroup {\n return getUnitConfig(formatOptions).group;\n}\n\nexport function getUnitGroupConfig(formatOptions: FormatOptions): UnitGroupConfig {\n const unitConfig = getUnitConfig(formatOptions);\n return UNIT_GROUP_CONFIG[unitConfig.group];\n}\n\n// Type guards\nexport function isTimeUnit(formatOptions: FormatOptions): formatOptions is TimeFormatOptions {\n return getUnitGroup(formatOptions) === 'Time';\n}\n\nexport function isPercentUnit(formatOptions: FormatOptions): formatOptions is PercentFormatOptions {\n return getUnitGroup(formatOptions) === 'Percent';\n}\n\nexport function isDecimalUnit(formatOptions: FormatOptions): formatOptions is DecimalFormatOptions {\n return getUnitGroup(formatOptions) === 'Decimal';\n}\n\nexport function isBytesUnit(formatOptions: FormatOptions): formatOptions is BytesFormatOptions {\n return getUnitGroup(formatOptions) === 'Bytes';\n}\n\nexport function isUnitWithDecimalPlaces(\n formatOptions: FormatOptions\n): formatOptions is HasDecimalPlaces<FormatOptions> {\n const groupConfig = getUnitGroupConfig(formatOptions);\n\n return !!groupConfig.decimalPlaces;\n}\n\nexport function isUnitWithShortValues(formatOptions: FormatOptions): formatOptions is HasShortValues<FormatOptions> {\n const groupConfig = getUnitGroupConfig(formatOptions);\n\n return !!groupConfig.shortValues;\n}\n\nexport function isThroughputUnit(formatOptions: FormatOptions): formatOptions is ThroughputFormatOptions {\n return getUnitGroup(formatOptions) == 'Throughput';\n}\n"],"names":["formatBytes","BYTES_GROUP_CONFIG","BYTES_UNIT_CONFIG","formatDecimal","DECIMAL_GROUP_CONFIG","DECIMAL_UNIT_CONFIG","formatPercent","PERCENT_GROUP_CONFIG","PERCENT_UNIT_CONFIG","formatTime","TIME_GROUP_CONFIG","TIME_UNIT_CONFIG","formatThroughput","THROUGHPUT_GROUP_CONFIG","THROUGHPUT_UNIT_CONFIG","UNIT_GROUP_CONFIG","Time","Percent","Decimal","Bytes","Throughput","UNIT_CONFIG","formatValue","value","formatOptions","undefined","toString","isBytesUnit","isDecimalUnit","isPercentUnit","isTimeUnit","isThroughputUnit","exhaustive","Error","getUnitConfig","unit","getUnitGroup","group","getUnitGroupConfig","unitConfig","isUnitWithDecimalPlaces","groupConfig","decimalPlaces","isUnitWithShortValues","shortValues"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,SAASA,WAAW,EAA4CC,kBAAkB,EAAEC,iBAAiB,QAAQ,UAAU;AACvH,SACEC,aAAa,EAEbC,oBAAoB,EACpBC,mBAAmB,QACd,YAAY;AACnB,SACEC,aAAa,EAEbC,oBAAoB,EACpBC,mBAAmB,QACd,YAAY;AACnB,SAASC,UAAU,EAA0CC,iBAAiB,EAAEC,gBAAgB,QAAQ,SAAS;AAEjH,SACEC,gBAAgB,EAChBC,uBAAuB,EACvBC,sBAAsB,QAEjB,eAAe;AAEtB;;;;;;CAMC,GAED,OAAO,MAAMC,oBAAkE;IAC7EC,MAAMN;IACNO,SAASV;IACTW,SAASd;IACTe,OAAOlB;IACPmB,YAAYP;AACd,EAAE;AACF,OAAO,MAAMQ,cAAc;IACzB,GAAGV,gBAAgB;IACnB,GAAGH,mBAAmB;IACtB,GAAGH,mBAAmB;IACtB,GAAGH,iBAAiB;IACpB,GAAGY,sBAAsB;AAC3B,EAAW;AAYX,OAAO,SAASQ,YAAYC,KAAa,EAAEC,aAA6B;IACtE,IAAIA,k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ASb,iBAAiBP,aAA4B;IAC3D,OAAOY,aAAaZ,kBAAkB;AACxC"}
|
|
@@ -25,6 +25,7 @@ export interface ListVariableSpec<PluginSpec> extends VariableSpec {
|
|
|
25
25
|
allowAllValue?: boolean;
|
|
26
26
|
customAllValue?: string;
|
|
27
27
|
capturingRegexp?: string;
|
|
28
|
+
sort?: string;
|
|
28
29
|
plugin: Definition<PluginSpec>;
|
|
29
30
|
}
|
|
30
31
|
export interface BuiltinVariableDefinition extends Definition<BuiltinVariableSpec> {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../../src/model/variables.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEvD,oBAAY,YAAY,GAAG,MAAM,CAAC;AAElC,oBAAY,aAAa,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC;AAErD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,GAAG;QAClB,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,sBAAuB,SAAQ,UAAU,CAAC,gBAAgB,CAAC;IAC1E,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,sBAAsB,CAAC,UAAU,GAAG,WAAW,CAAE,SAAQ,UAAU,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAChH,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB,CAAC,UAAU,CAA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