@perses-dev/core 0.52.0-beta.0 → 0.52.0-beta.1
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/units/currency.js +118 -0
- package/dist/cjs/model/units/units.js +14 -2
- package/dist/cjs/schema/secret.js +1 -1
- package/dist/model/units/currency.d.ts +11 -0
- package/dist/model/units/currency.d.ts.map +1 -0
- package/dist/model/units/currency.js +99 -0
- package/dist/model/units/currency.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.map +1 -1
- package/dist/model/units/units.d.ts +18 -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/schema/secret.d.ts +53 -53
- package/dist/schema/secret.js +1 -1
- package/dist/schema/secret.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// Copyright 2025 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
|
+
CURRENCY_GROUP_CONFIG: function() {
|
|
25
|
+
return CURRENCY_GROUP_CONFIG;
|
|
26
|
+
},
|
|
27
|
+
CURRENCY_UNIT_CONFIG: function() {
|
|
28
|
+
return CURRENCY_UNIT_CONFIG;
|
|
29
|
+
},
|
|
30
|
+
formatCurrency: function() {
|
|
31
|
+
return formatCurrency;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const _lodash = require("lodash");
|
|
35
|
+
const _constants = require("./constants");
|
|
36
|
+
const _utils = require("./utils");
|
|
37
|
+
const CURRENCY_GROUP = 'Currency';
|
|
38
|
+
const CURRENCY_GROUP_CONFIG = {
|
|
39
|
+
label: 'Currency',
|
|
40
|
+
decimalPlaces: true
|
|
41
|
+
};
|
|
42
|
+
const CURRENCY_UNIT_CONFIG = {
|
|
43
|
+
aud: {
|
|
44
|
+
group: CURRENCY_GROUP,
|
|
45
|
+
label: 'Australian Dollar (A$)'
|
|
46
|
+
},
|
|
47
|
+
cad: {
|
|
48
|
+
group: CURRENCY_GROUP,
|
|
49
|
+
label: 'Canadian Dollar (CA$)'
|
|
50
|
+
},
|
|
51
|
+
chf: {
|
|
52
|
+
group: CURRENCY_GROUP,
|
|
53
|
+
label: 'Swiss Franc (CHF)'
|
|
54
|
+
},
|
|
55
|
+
cny: {
|
|
56
|
+
group: CURRENCY_GROUP,
|
|
57
|
+
label: 'Renminbi (CN¥)'
|
|
58
|
+
},
|
|
59
|
+
eur: {
|
|
60
|
+
group: CURRENCY_GROUP,
|
|
61
|
+
label: 'Euro (€)'
|
|
62
|
+
},
|
|
63
|
+
gbp: {
|
|
64
|
+
group: CURRENCY_GROUP,
|
|
65
|
+
label: 'Pound (£)'
|
|
66
|
+
},
|
|
67
|
+
hkd: {
|
|
68
|
+
group: CURRENCY_GROUP,
|
|
69
|
+
label: 'Hong Kong Dollar (HK$)'
|
|
70
|
+
},
|
|
71
|
+
inr: {
|
|
72
|
+
group: CURRENCY_GROUP,
|
|
73
|
+
label: 'Indian Rupee (₹)'
|
|
74
|
+
},
|
|
75
|
+
jpy: {
|
|
76
|
+
group: CURRENCY_GROUP,
|
|
77
|
+
label: 'Yen (¥)'
|
|
78
|
+
},
|
|
79
|
+
krw: {
|
|
80
|
+
group: CURRENCY_GROUP,
|
|
81
|
+
label: 'South Korean Won (₩)'
|
|
82
|
+
},
|
|
83
|
+
nok: {
|
|
84
|
+
group: CURRENCY_GROUP,
|
|
85
|
+
label: 'Norwegian Krone (NOK)'
|
|
86
|
+
},
|
|
87
|
+
nzd: {
|
|
88
|
+
group: CURRENCY_GROUP,
|
|
89
|
+
label: 'New Zealand Dollar (NZ$)'
|
|
90
|
+
},
|
|
91
|
+
sek: {
|
|
92
|
+
group: CURRENCY_GROUP,
|
|
93
|
+
label: 'Swedish Krona (SEK)'
|
|
94
|
+
},
|
|
95
|
+
sgd: {
|
|
96
|
+
group: CURRENCY_GROUP,
|
|
97
|
+
label: 'Singapore Dollar (S$)'
|
|
98
|
+
},
|
|
99
|
+
usd: {
|
|
100
|
+
group: CURRENCY_GROUP,
|
|
101
|
+
label: 'US Dollar ($)'
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
function formatCurrency(value, { unit, decimalPlaces }) {
|
|
105
|
+
const formatterOptions = {
|
|
106
|
+
style: 'currency',
|
|
107
|
+
currency: (0, _lodash.toUpper)(unit),
|
|
108
|
+
currencyDisplay: 'symbol'
|
|
109
|
+
};
|
|
110
|
+
if ((0, _utils.hasDecimalPlaces)(decimalPlaces)) {
|
|
111
|
+
formatterOptions.minimumFractionDigits = (0, _utils.limitDecimalPlaces)(decimalPlaces);
|
|
112
|
+
formatterOptions.maximumFractionDigits = (0, _utils.limitDecimalPlaces)(decimalPlaces);
|
|
113
|
+
} else {
|
|
114
|
+
formatterOptions.maximumSignificantDigits = _constants.MAX_SIGNIFICANT_DIGITS;
|
|
115
|
+
}
|
|
116
|
+
const formatter = Intl.NumberFormat('en-US', formatterOptions);
|
|
117
|
+
return formatter.format(value);
|
|
118
|
+
}
|
|
@@ -42,6 +42,9 @@ _export(exports, {
|
|
|
42
42
|
isBytesUnit: function() {
|
|
43
43
|
return isBytesUnit;
|
|
44
44
|
},
|
|
45
|
+
isCurrencyUnit: function() {
|
|
46
|
+
return isCurrencyUnit;
|
|
47
|
+
},
|
|
45
48
|
isDecimalUnit: function() {
|
|
46
49
|
return isDecimalUnit;
|
|
47
50
|
},
|
|
@@ -66,19 +69,22 @@ const _decimal = require("./decimal");
|
|
|
66
69
|
const _percent = require("./percent");
|
|
67
70
|
const _time = require("./time");
|
|
68
71
|
const _throughput = require("./throughput");
|
|
72
|
+
const _currency = require("./currency");
|
|
69
73
|
const UNIT_GROUP_CONFIG = {
|
|
70
74
|
Time: _time.TIME_GROUP_CONFIG,
|
|
71
75
|
Percent: _percent.PERCENT_GROUP_CONFIG,
|
|
72
76
|
Decimal: _decimal.DECIMAL_GROUP_CONFIG,
|
|
73
77
|
Bytes: _bytes.BYTES_GROUP_CONFIG,
|
|
74
|
-
Throughput: _throughput.THROUGHPUT_GROUP_CONFIG
|
|
78
|
+
Throughput: _throughput.THROUGHPUT_GROUP_CONFIG,
|
|
79
|
+
Currency: _currency.CURRENCY_GROUP_CONFIG
|
|
75
80
|
};
|
|
76
81
|
const UNIT_CONFIG = {
|
|
77
82
|
..._time.TIME_UNIT_CONFIG,
|
|
78
83
|
..._percent.PERCENT_UNIT_CONFIG,
|
|
79
84
|
..._decimal.DECIMAL_UNIT_CONFIG,
|
|
80
85
|
..._bytes.BYTES_UNIT_CONFIG,
|
|
81
|
-
..._throughput.THROUGHPUT_UNIT_CONFIG
|
|
86
|
+
..._throughput.THROUGHPUT_UNIT_CONFIG,
|
|
87
|
+
..._currency.CURRENCY_UNIT_CONFIG
|
|
82
88
|
};
|
|
83
89
|
function formatValue(value, formatOptions) {
|
|
84
90
|
if (formatOptions === undefined) {
|
|
@@ -99,6 +105,9 @@ function formatValue(value, formatOptions) {
|
|
|
99
105
|
if (isThroughputUnit(formatOptions)) {
|
|
100
106
|
return (0, _throughput.formatThroughput)(value, formatOptions);
|
|
101
107
|
}
|
|
108
|
+
if (isCurrencyUnit(formatOptions)) {
|
|
109
|
+
return (0, _currency.formatCurrency)(value, formatOptions);
|
|
110
|
+
}
|
|
102
111
|
const exhaustive = formatOptions;
|
|
103
112
|
throw new Error(`Unknown unit options ${exhaustive}`);
|
|
104
113
|
}
|
|
@@ -136,3 +145,6 @@ function isUnitWithShortValues(formatOptions) {
|
|
|
136
145
|
function isThroughputUnit(formatOptions) {
|
|
137
146
|
return getUnitGroup(formatOptions) === 'Throughput';
|
|
138
147
|
}
|
|
148
|
+
function isCurrencyUnit(formatOptions) {
|
|
149
|
+
return getUnitGroup(formatOptions) === 'Currency';
|
|
150
|
+
}
|
|
@@ -119,7 +119,7 @@ const secretSpecSchema = _zod.z.object({
|
|
|
119
119
|
certFile: _zod.z.string().optional(),
|
|
120
120
|
keyFile: _zod.z.string().optional(),
|
|
121
121
|
serverName: _zod.z.string().optional(),
|
|
122
|
-
insecureSkipVerify: _zod.z.boolean()
|
|
122
|
+
insecureSkipVerify: _zod.z.boolean().optional()
|
|
123
123
|
}).superRefine((val, ctx)=>{
|
|
124
124
|
if (val.ca && val.ca.length > 0 && val.caFile && val.caFile.length > 0) {
|
|
125
125
|
ctx.addIssue({
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UnitConfig, UnitGroupConfig } from './types';
|
|
2
|
+
type CurrencyUnits = 'aud' | 'cad' | 'chf' | 'cny' | 'eur' | 'gbp' | 'hkd' | 'inr' | 'jpy' | 'krw' | 'nok' | 'nzd' | 'sek' | 'sgd' | 'usd';
|
|
3
|
+
export type CurrencyFormatOptions = {
|
|
4
|
+
unit: CurrencyUnits;
|
|
5
|
+
decimalPlaces?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const CURRENCY_GROUP_CONFIG: UnitGroupConfig;
|
|
8
|
+
export declare const CURRENCY_UNIT_CONFIG: Readonly<Record<CurrencyUnits, UnitConfig>>;
|
|
9
|
+
export declare function formatCurrency(value: number, { unit, decimalPlaces }: CurrencyFormatOptions): string;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=currency.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../src/model/units/currency.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAKtD,KAAK,aAAa,GACd,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,GACL,KAAK,CAAC;AACV,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,aAAa,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF,eAAO,MAAM,qBAAqB,EAAE,eAGnC,CAAC;AACF,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CA6D5E,CAAC;AAEF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,qBAAqB,GAAG,MAAM,CAgBpG"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Copyright 2025 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 { toUpper } from 'lodash';
|
|
14
|
+
import { MAX_SIGNIFICANT_DIGITS } from './constants';
|
|
15
|
+
import { hasDecimalPlaces, limitDecimalPlaces } from './utils';
|
|
16
|
+
const CURRENCY_GROUP = 'Currency';
|
|
17
|
+
export const CURRENCY_GROUP_CONFIG = {
|
|
18
|
+
label: 'Currency',
|
|
19
|
+
decimalPlaces: true
|
|
20
|
+
};
|
|
21
|
+
export const CURRENCY_UNIT_CONFIG = {
|
|
22
|
+
aud: {
|
|
23
|
+
group: CURRENCY_GROUP,
|
|
24
|
+
label: 'Australian Dollar (A$)'
|
|
25
|
+
},
|
|
26
|
+
cad: {
|
|
27
|
+
group: CURRENCY_GROUP,
|
|
28
|
+
label: 'Canadian Dollar (CA$)'
|
|
29
|
+
},
|
|
30
|
+
chf: {
|
|
31
|
+
group: CURRENCY_GROUP,
|
|
32
|
+
label: 'Swiss Franc (CHF)'
|
|
33
|
+
},
|
|
34
|
+
cny: {
|
|
35
|
+
group: CURRENCY_GROUP,
|
|
36
|
+
label: 'Renminbi (CN¥)'
|
|
37
|
+
},
|
|
38
|
+
eur: {
|
|
39
|
+
group: CURRENCY_GROUP,
|
|
40
|
+
label: 'Euro (€)'
|
|
41
|
+
},
|
|
42
|
+
gbp: {
|
|
43
|
+
group: CURRENCY_GROUP,
|
|
44
|
+
label: 'Pound (£)'
|
|
45
|
+
},
|
|
46
|
+
hkd: {
|
|
47
|
+
group: CURRENCY_GROUP,
|
|
48
|
+
label: 'Hong Kong Dollar (HK$)'
|
|
49
|
+
},
|
|
50
|
+
inr: {
|
|
51
|
+
group: CURRENCY_GROUP,
|
|
52
|
+
label: 'Indian Rupee (₹)'
|
|
53
|
+
},
|
|
54
|
+
jpy: {
|
|
55
|
+
group: CURRENCY_GROUP,
|
|
56
|
+
label: 'Yen (¥)'
|
|
57
|
+
},
|
|
58
|
+
krw: {
|
|
59
|
+
group: CURRENCY_GROUP,
|
|
60
|
+
label: 'South Korean Won (₩)'
|
|
61
|
+
},
|
|
62
|
+
nok: {
|
|
63
|
+
group: CURRENCY_GROUP,
|
|
64
|
+
label: 'Norwegian Krone (NOK)'
|
|
65
|
+
},
|
|
66
|
+
nzd: {
|
|
67
|
+
group: CURRENCY_GROUP,
|
|
68
|
+
label: 'New Zealand Dollar (NZ$)'
|
|
69
|
+
},
|
|
70
|
+
sek: {
|
|
71
|
+
group: CURRENCY_GROUP,
|
|
72
|
+
label: 'Swedish Krona (SEK)'
|
|
73
|
+
},
|
|
74
|
+
sgd: {
|
|
75
|
+
group: CURRENCY_GROUP,
|
|
76
|
+
label: 'Singapore Dollar (S$)'
|
|
77
|
+
},
|
|
78
|
+
usd: {
|
|
79
|
+
group: CURRENCY_GROUP,
|
|
80
|
+
label: 'US Dollar ($)'
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
export function formatCurrency(value, { unit, decimalPlaces }) {
|
|
84
|
+
const formatterOptions = {
|
|
85
|
+
style: 'currency',
|
|
86
|
+
currency: toUpper(unit),
|
|
87
|
+
currencyDisplay: 'symbol'
|
|
88
|
+
};
|
|
89
|
+
if (hasDecimalPlaces(decimalPlaces)) {
|
|
90
|
+
formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimalPlaces);
|
|
91
|
+
formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimalPlaces);
|
|
92
|
+
} else {
|
|
93
|
+
formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;
|
|
94
|
+
}
|
|
95
|
+
const formatter = Intl.NumberFormat('en-US', formatterOptions);
|
|
96
|
+
return formatter.format(value);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
//# sourceMappingURL=currency.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/model/units/currency.ts"],"sourcesContent":["// Copyright 2025 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 { toUpper } from 'lodash';\nimport { MAX_SIGNIFICANT_DIGITS } from './constants';\nimport { UnitConfig, UnitGroupConfig } from './types';\nimport { hasDecimalPlaces, limitDecimalPlaces } from './utils';\n\n// See Intl.supportedValuesOf(\"currency\") for valid options, key names will\n// be converted to uppercase to match the expectation of Intl.NumberFormat\ntype CurrencyUnits =\n | 'aud'\n | 'cad'\n | 'chf'\n | 'cny'\n | 'eur'\n | 'gbp'\n | 'hkd'\n | 'inr'\n | 'jpy'\n | 'krw'\n | 'nok'\n | 'nzd'\n | 'sek'\n | 'sgd'\n | 'usd';\nexport type CurrencyFormatOptions = {\n unit: CurrencyUnits;\n decimalPlaces?: number;\n};\n\nconst CURRENCY_GROUP = 'Currency';\nexport const CURRENCY_GROUP_CONFIG: UnitGroupConfig = {\n label: 'Currency',\n decimalPlaces: true,\n};\nexport const CURRENCY_UNIT_CONFIG: Readonly<Record<CurrencyUnits, UnitConfig>> = {\n aud: {\n group: CURRENCY_GROUP,\n label: 'Australian Dollar (A$)',\n },\n cad: {\n group: CURRENCY_GROUP,\n label: 'Canadian Dollar (CA$)',\n },\n chf: {\n group: CURRENCY_GROUP,\n label: 'Swiss Franc (CHF)',\n },\n cny: {\n group: CURRENCY_GROUP,\n label: 'Renminbi (CN¥)',\n },\n eur: {\n group: CURRENCY_GROUP,\n label: 'Euro (€)',\n },\n gbp: {\n group: CURRENCY_GROUP,\n label: 'Pound (£)',\n },\n hkd: {\n group: CURRENCY_GROUP,\n label: 'Hong Kong Dollar (HK$)',\n },\n inr: {\n group: CURRENCY_GROUP,\n label: 'Indian Rupee (₹)',\n },\n jpy: {\n group: CURRENCY_GROUP,\n label: 'Yen (¥)',\n },\n krw: {\n group: CURRENCY_GROUP,\n label: 'South Korean Won (₩)',\n },\n nok: {\n group: CURRENCY_GROUP,\n label: 'Norwegian Krone (NOK)',\n },\n nzd: {\n group: CURRENCY_GROUP,\n label: 'New Zealand Dollar (NZ$)',\n },\n sek: {\n group: CURRENCY_GROUP,\n label: 'Swedish Krona (SEK)',\n },\n sgd: {\n group: CURRENCY_GROUP,\n label: 'Singapore Dollar (S$)',\n },\n usd: {\n group: CURRENCY_GROUP,\n label: 'US Dollar ($)',\n },\n};\n\nexport function formatCurrency(value: number, { unit, decimalPlaces }: CurrencyFormatOptions): string {\n const formatterOptions: Intl.NumberFormatOptions = {\n style: 'currency',\n currency: toUpper(unit),\n currencyDisplay: 'symbol',\n };\n\n if (hasDecimalPlaces(decimalPlaces)) {\n formatterOptions.minimumFractionDigits = limitDecimalPlaces(decimalPlaces);\n formatterOptions.maximumFractionDigits = limitDecimalPlaces(decimalPlaces);\n } else {\n formatterOptions.maximumSignificantDigits = MAX_SIGNIFICANT_DIGITS;\n }\n\n const formatter = Intl.NumberFormat('en-US', formatterOptions);\n return formatter.format(value);\n}\n"],"names":["toUpper","MAX_SIGNIFICANT_DIGITS","hasDecimalPlaces","limitDecimalPlaces","CURRENCY_GROUP","CURRENCY_GROUP_CONFIG","label","decimalPlaces","CURRENCY_UNIT_CONFIG","aud","group","cad","chf","cny","eur","gbp","hkd","inr","jpy","krw","nok","nzd","sek","sgd","usd","formatCurrency","value","unit","formatterOptions","style","currency","currencyDisplay","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,OAAO,QAAQ,SAAS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UG,MAAM,CAACZ;AAC1B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Duration } from 'date-fns';
|
|
2
2
|
import { AbsoluteTimeRange, DurationString } from '../time';
|
|
3
3
|
import { FormatOptions } from './units';
|
|
4
|
-
export type UnitGroup = 'Time' | 'Percent' | 'Decimal' | 'Bytes' | 'Throughput';
|
|
4
|
+
export type UnitGroup = 'Time' | 'Percent' | 'Decimal' | 'Bytes' | 'Throughput' | 'Currency';
|
|
5
5
|
/**
|
|
6
6
|
* Configuration for rendering units that are part of a group.
|
|
7
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/model/units/types.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/model/units/types.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,YAAY,GAAG,UAAU,CAAC;AAE7F;;GAEG;AACH,MAAM,MAAM,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,MAAM,MAAM,UAAU,GAAG;IACvB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB;;;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 { Duration } from 'date-fns';\nimport { AbsoluteTimeRange, DurationString } from '../time';\nimport { FormatOptions } from './units';\n\nexport type UnitGroup = 'Time' | 'Percent' | 'Decimal' | 'Bytes' | 'Throughput';\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":[],"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;AA6DT,WAGC"}
|
|
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 { Duration } from 'date-fns';\nimport { AbsoluteTimeRange, DurationString } from '../time';\nimport { FormatOptions } from './units';\n\nexport type UnitGroup = 'Time' | 'Percent' | 'Decimal' | 'Bytes' | 'Throughput' | 'Currency';\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":[],"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;AA6DT,WAGC"}
|
|
@@ -4,6 +4,7 @@ import { PercentFormatOptions as PercentFormatOptions } from './percent';
|
|
|
4
4
|
import { TimeFormatOptions as TimeFormatOptions } from './time';
|
|
5
5
|
import { UnitGroup, UnitGroupConfig, UnitConfig } from './types';
|
|
6
6
|
import { ThroughputFormatOptions } from './throughput';
|
|
7
|
+
import { CurrencyFormatOptions } from './currency';
|
|
7
8
|
/**
|
|
8
9
|
* Most of the number formatting is based on Intl.NumberFormat, which is built into JavaScript.
|
|
9
10
|
* Prefer Intl.NumbeFormat because it covers most use cases and will continue to be supported with time.
|
|
@@ -13,6 +14,21 @@ import { ThroughputFormatOptions } from './throughput';
|
|
|
13
14
|
*/
|
|
14
15
|
export declare const UNIT_GROUP_CONFIG: Readonly<Record<UnitGroup, UnitGroupConfig>>;
|
|
15
16
|
export declare const UNIT_CONFIG: {
|
|
17
|
+
readonly aud: UnitConfig;
|
|
18
|
+
readonly cad: UnitConfig;
|
|
19
|
+
readonly chf: UnitConfig;
|
|
20
|
+
readonly cny: UnitConfig;
|
|
21
|
+
readonly eur: UnitConfig;
|
|
22
|
+
readonly gbp: UnitConfig;
|
|
23
|
+
readonly hkd: UnitConfig;
|
|
24
|
+
readonly inr: UnitConfig;
|
|
25
|
+
readonly jpy: UnitConfig;
|
|
26
|
+
readonly krw: UnitConfig;
|
|
27
|
+
readonly nok: UnitConfig;
|
|
28
|
+
readonly nzd: UnitConfig;
|
|
29
|
+
readonly sek: UnitConfig;
|
|
30
|
+
readonly sgd: UnitConfig;
|
|
31
|
+
readonly usd: UnitConfig;
|
|
16
32
|
readonly "bits/sec": UnitConfig;
|
|
17
33
|
readonly "bytes/sec": UnitConfig;
|
|
18
34
|
readonly "counts/sec": UnitConfig;
|
|
@@ -39,7 +55,7 @@ export declare const UNIT_CONFIG: {
|
|
|
39
55
|
readonly months: UnitConfig;
|
|
40
56
|
readonly years: UnitConfig;
|
|
41
57
|
};
|
|
42
|
-
export type FormatOptions = TimeFormatOptions | PercentFormatOptions | DecimalFormatOptions | BytesFormatOptions | ThroughputFormatOptions;
|
|
58
|
+
export type FormatOptions = TimeFormatOptions | PercentFormatOptions | DecimalFormatOptions | BytesFormatOptions | ThroughputFormatOptions | CurrencyFormatOptions;
|
|
43
59
|
type HasDecimalPlaces<UnitOpt> = UnitOpt extends {
|
|
44
60
|
decimalPlaces?: number;
|
|
45
61
|
} ? UnitOpt : never;
|
|
@@ -57,5 +73,6 @@ export declare function isBytesUnit(formatOptions: FormatOptions): formatOptions
|
|
|
57
73
|
export declare function isUnitWithDecimalPlaces(formatOptions: FormatOptions): formatOptions is HasDecimalPlaces<FormatOptions>;
|
|
58
74
|
export declare function isUnitWithShortValues(formatOptions: FormatOptions): formatOptions is HasShortValues<FormatOptions>;
|
|
59
75
|
export declare function isThroughputUnit(formatOptions: FormatOptions): formatOptions is ThroughputFormatOptions;
|
|
76
|
+
export declare function isCurrencyUnit(formatOptions: FormatOptions): formatOptions is CurrencyFormatOptions;
|
|
60
77
|
export {};
|
|
61
78
|
//# 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;AACjE,OAAO,EAIL,uBAAuB,EACxB,MAAM,cAAc,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,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAIL,uBAAuB,EACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EAA+D,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEhH;;;;;;GAMG;AAEH,eAAO,MAAM,iBAAiB,EAAE,QAAQ,CAAC,MAAM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AG,aAAa,IAAI,cAAc,CAAC,aAAa,CAAC,CAIlH;AAED,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,aAAa,GAAG,aAAa,IAAI,uBAAuB,CAEvG;AAED,wBAAgB,cAAc,CAAC,aAAa,EAAE,aAAa,GAAG,aAAa,IAAI,qBAAqB,CAEnG"}
|
|
@@ -15,6 +15,7 @@ import { formatDecimal, DECIMAL_GROUP_CONFIG, DECIMAL_UNIT_CONFIG } from './deci
|
|
|
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
17
|
import { formatThroughput, THROUGHPUT_GROUP_CONFIG, THROUGHPUT_UNIT_CONFIG } from './throughput';
|
|
18
|
+
import { formatCurrency, CURRENCY_GROUP_CONFIG, CURRENCY_UNIT_CONFIG } from './currency';
|
|
18
19
|
/**
|
|
19
20
|
* Most of the number formatting is based on Intl.NumberFormat, which is built into JavaScript.
|
|
20
21
|
* Prefer Intl.NumbeFormat because it covers most use cases and will continue to be supported with time.
|
|
@@ -26,14 +27,16 @@ import { formatThroughput, THROUGHPUT_GROUP_CONFIG, THROUGHPUT_UNIT_CONFIG } fro
|
|
|
26
27
|
Percent: PERCENT_GROUP_CONFIG,
|
|
27
28
|
Decimal: DECIMAL_GROUP_CONFIG,
|
|
28
29
|
Bytes: BYTES_GROUP_CONFIG,
|
|
29
|
-
Throughput: THROUGHPUT_GROUP_CONFIG
|
|
30
|
+
Throughput: THROUGHPUT_GROUP_CONFIG,
|
|
31
|
+
Currency: CURRENCY_GROUP_CONFIG
|
|
30
32
|
};
|
|
31
33
|
export const UNIT_CONFIG = {
|
|
32
34
|
...TIME_UNIT_CONFIG,
|
|
33
35
|
...PERCENT_UNIT_CONFIG,
|
|
34
36
|
...DECIMAL_UNIT_CONFIG,
|
|
35
37
|
...BYTES_UNIT_CONFIG,
|
|
36
|
-
...THROUGHPUT_UNIT_CONFIG
|
|
38
|
+
...THROUGHPUT_UNIT_CONFIG,
|
|
39
|
+
...CURRENCY_UNIT_CONFIG
|
|
37
40
|
};
|
|
38
41
|
export function formatValue(value, formatOptions) {
|
|
39
42
|
if (formatOptions === undefined) {
|
|
@@ -54,6 +57,9 @@ export function formatValue(value, formatOptions) {
|
|
|
54
57
|
if (isThroughputUnit(formatOptions)) {
|
|
55
58
|
return formatThroughput(value, formatOptions);
|
|
56
59
|
}
|
|
60
|
+
if (isCurrencyUnit(formatOptions)) {
|
|
61
|
+
return formatCurrency(value, formatOptions);
|
|
62
|
+
}
|
|
57
63
|
const exhaustive = formatOptions;
|
|
58
64
|
throw new Error(`Unknown unit options ${exhaustive}`);
|
|
59
65
|
}
|
|
@@ -92,5 +98,8 @@ export function isUnitWithShortValues(formatOptions) {
|
|
|
92
98
|
export function isThroughputUnit(formatOptions) {
|
|
93
99
|
return getUnitGroup(formatOptions) === 'Throughput';
|
|
94
100
|
}
|
|
101
|
+
export function isCurrencyUnit(formatOptions) {
|
|
102
|
+
return getUnitGroup(formatOptions) === 'Currency';
|
|
103
|
+
}
|
|
95
104
|
|
|
96
105
|
//# 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';\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 const unit = formatOptions.unit ?? 'decimal';\n return UNIT_CONFIG[unit];\n}\n\nexport function getUnitGroup(formatOptions: FormatOptions): UnitGroup {\n return getUnitConfig(formatOptions).group ?? 'Decimal';\n}\n\nexport function getUnitGroupConfig(formatOptions: FormatOptions): UnitGroupConfig {\n const unitConfig = getUnitConfig(formatOptions);\n return UNIT_GROUP_CONFIG[unitConfig.group ?? 'Decimal'];\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;
|
|
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';\nimport { formatCurrency, CURRENCY_GROUP_CONFIG, CURRENCY_UNIT_CONFIG, CurrencyFormatOptions } from './currency';\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 Currency: CURRENCY_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 ...CURRENCY_UNIT_CONFIG,\n} as const;\n\nexport type FormatOptions =\n | TimeFormatOptions\n | PercentFormatOptions\n | DecimalFormatOptions\n | BytesFormatOptions\n | ThroughputFormatOptions\n | CurrencyFormatOptions;\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 if (isCurrencyUnit(formatOptions)) {\n return formatCurrency(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 const unit = formatOptions.unit ?? 'decimal';\n return UNIT_CONFIG[unit];\n}\n\nexport function getUnitGroup(formatOptions: FormatOptions): UnitGroup {\n return getUnitConfig(formatOptions).group ?? 'Decimal';\n}\n\nexport function getUnitGroupConfig(formatOptions: FormatOptions): UnitGroupConfig {\n const unitConfig = getUnitConfig(formatOptions);\n return UNIT_GROUP_CONFIG[unitConfig.group ?? 'Decimal'];\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\nexport function isCurrencyUnit(formatOptions: FormatOptions): formatOptions is CurrencyFormatOptions {\n return getUnitGroup(formatOptions) === 'Currency';\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","formatCurrency","CURRENCY_GROUP_CONFIG","CURRENCY_UNIT_CONFIG","UNIT_GROUP_CONFIG","Time","Percent","Decimal","Bytes","Throughput","Currency","UNIT_CONFIG","formatValue","value","formatOptions","undefined","toString","isBytesUnit","isDecimalUnit","isPercentUnit","isTimeUnit","isThroughputUnit","isCurrencyUnit","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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gBAAgB;QACjC,OAAOb,eAAeY,OAAOC;IAC/B;IAEA,MAAMS,aAAoBT;IAC1B,MAAM,IAAIU,MAAM,CAAC,qBAAqB,EAAED,YAAY;AACtD;AAEA,OAAO,SAASE,cAAcX,aAA4B;IACxD,MAAMY,OAAOZ,cAAcY,IAAI,IAAI;IACnC,OAAOf,WAAW,CAACe,KAAK;AAC1B;AAEA,OAAO,SAASC,aAAab,aAA4B;IACvD,OAAOW,cAAcX,eAAec,KAAK,IAAI;AAC/C;AAEA,OAAO,SAASC,mBAAmBf,aAA4B;IAC7D,MAAMgB,aAAaL,cAAcX;IACjC,OAAOV,iBAAiB,CAAC0B,WAAWF,KAAK,IAAI,UAAU;AACzD;AAEA,cAAc;AACd,OAAO,SAASR,WAAWN,aAA4B;IACrD,OAAOa,aAAab,mBAAmB;AACzC;AAEA,OAAO,SAASK,cAAcL,aAA4B;IACxD,OAAOa,aAAab,mBAAmB;AACzC;AAEA,OAAO,SAASI,cAAcJ,aAA4B;IACxD,OAAOa,aAAab,mBAAmB;AACzC;AAEA,OAAO,SAASG,YAAYH,aAA4B;IACtD,OAAOa,aAAab,mBAAmB;AACzC;AAEA,OAAO,SAASiB,wBACdjB,aAA4B;IAE5B,MAAMkB,cAAcH,mBAAmBf;IAEvC,OAAO,CAAC,CAACkB,YAAYC,aAAa;AACpC;AAEA,OAAO,SAASC,sBAAsBpB,aAA4B;IAChE,MAAMkB,cAAcH,mBAAmBf;IAEvC,OAAO,CAAC,CAACkB,YAAYG,WAAW;AAClC;AAEA,OAAO,SAASd,iBAAiBP,aAA4B;IAC3D,OAAOa,aAAab,mBAAmB;AACzC;AAEA,OAAO,SAASQ,eAAeR,aAA4B;IACzD,OAAOa,aAAab,mBAAmB;AACzC"}
|
package/dist/schema/secret.d.ts
CHANGED
|
@@ -91,9 +91,8 @@ export declare const secretSpecSchema: z.ZodEffects<z.ZodObject<{
|
|
|
91
91
|
certFile: z.ZodOptional<z.ZodString>;
|
|
92
92
|
keyFile: z.ZodOptional<z.ZodString>;
|
|
93
93
|
serverName: z.ZodOptional<z.ZodString>;
|
|
94
|
-
insecureSkipVerify: z.ZodBoolean
|
|
94
|
+
insecureSkipVerify: z.ZodOptional<z.ZodBoolean>;
|
|
95
95
|
}, "strip", z.ZodTypeAny, {
|
|
96
|
-
insecureSkipVerify: boolean;
|
|
97
96
|
ca?: string | undefined;
|
|
98
97
|
cert?: string | undefined;
|
|
99
98
|
key?: string | undefined;
|
|
@@ -101,8 +100,8 @@ export declare const secretSpecSchema: z.ZodEffects<z.ZodObject<{
|
|
|
101
100
|
certFile?: string | undefined;
|
|
102
101
|
keyFile?: string | undefined;
|
|
103
102
|
serverName?: string | undefined;
|
|
103
|
+
insecureSkipVerify?: boolean | undefined;
|
|
104
104
|
}, {
|
|
105
|
-
insecureSkipVerify: boolean;
|
|
106
105
|
ca?: string | undefined;
|
|
107
106
|
cert?: string | undefined;
|
|
108
107
|
key?: string | undefined;
|
|
@@ -110,8 +109,8 @@ export declare const secretSpecSchema: z.ZodEffects<z.ZodObject<{
|
|
|
110
109
|
certFile?: string | undefined;
|
|
111
110
|
keyFile?: string | undefined;
|
|
112
111
|
serverName?: string | undefined;
|
|
112
|
+
insecureSkipVerify?: boolean | undefined;
|
|
113
113
|
}>, {
|
|
114
|
-
insecureSkipVerify: boolean;
|
|
115
114
|
ca?: string | undefined;
|
|
116
115
|
cert?: string | undefined;
|
|
117
116
|
key?: string | undefined;
|
|
@@ -119,8 +118,8 @@ export declare const secretSpecSchema: z.ZodEffects<z.ZodObject<{
|
|
|
119
118
|
certFile?: string | undefined;
|
|
120
119
|
keyFile?: string | undefined;
|
|
121
120
|
serverName?: string | undefined;
|
|
121
|
+
insecureSkipVerify?: boolean | undefined;
|
|
122
122
|
}, {
|
|
123
|
-
insecureSkipVerify: boolean;
|
|
124
123
|
ca?: string | undefined;
|
|
125
124
|
cert?: string | undefined;
|
|
126
125
|
key?: string | undefined;
|
|
@@ -128,6 +127,7 @@ export declare const secretSpecSchema: z.ZodEffects<z.ZodObject<{
|
|
|
128
127
|
certFile?: string | undefined;
|
|
129
128
|
keyFile?: string | undefined;
|
|
130
129
|
serverName?: string | undefined;
|
|
130
|
+
insecureSkipVerify?: boolean | undefined;
|
|
131
131
|
}>>;
|
|
132
132
|
}, "strip", z.ZodTypeAny, {
|
|
133
133
|
basicAuth?: {
|
|
@@ -150,7 +150,6 @@ export declare const secretSpecSchema: z.ZodEffects<z.ZodObject<{
|
|
|
150
150
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
151
151
|
} | undefined;
|
|
152
152
|
tlsConfig?: {
|
|
153
|
-
insecureSkipVerify: boolean;
|
|
154
153
|
ca?: string | undefined;
|
|
155
154
|
cert?: string | undefined;
|
|
156
155
|
key?: string | undefined;
|
|
@@ -158,6 +157,7 @@ export declare const secretSpecSchema: z.ZodEffects<z.ZodObject<{
|
|
|
158
157
|
certFile?: string | undefined;
|
|
159
158
|
keyFile?: string | undefined;
|
|
160
159
|
serverName?: string | undefined;
|
|
160
|
+
insecureSkipVerify?: boolean | undefined;
|
|
161
161
|
} | undefined;
|
|
162
162
|
}, {
|
|
163
163
|
basicAuth?: {
|
|
@@ -180,7 +180,6 @@ export declare const secretSpecSchema: z.ZodEffects<z.ZodObject<{
|
|
|
180
180
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
181
181
|
} | undefined;
|
|
182
182
|
tlsConfig?: {
|
|
183
|
-
insecureSkipVerify: boolean;
|
|
184
183
|
ca?: string | undefined;
|
|
185
184
|
cert?: string | undefined;
|
|
186
185
|
key?: string | undefined;
|
|
@@ -188,6 +187,7 @@ export declare const secretSpecSchema: z.ZodEffects<z.ZodObject<{
|
|
|
188
187
|
certFile?: string | undefined;
|
|
189
188
|
keyFile?: string | undefined;
|
|
190
189
|
serverName?: string | undefined;
|
|
190
|
+
insecureSkipVerify?: boolean | undefined;
|
|
191
191
|
} | undefined;
|
|
192
192
|
}>, {
|
|
193
193
|
basicAuth?: {
|
|
@@ -210,7 +210,6 @@ export declare const secretSpecSchema: z.ZodEffects<z.ZodObject<{
|
|
|
210
210
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
211
211
|
} | undefined;
|
|
212
212
|
tlsConfig?: {
|
|
213
|
-
insecureSkipVerify: boolean;
|
|
214
213
|
ca?: string | undefined;
|
|
215
214
|
cert?: string | undefined;
|
|
216
215
|
key?: string | undefined;
|
|
@@ -218,6 +217,7 @@ export declare const secretSpecSchema: z.ZodEffects<z.ZodObject<{
|
|
|
218
217
|
certFile?: string | undefined;
|
|
219
218
|
keyFile?: string | undefined;
|
|
220
219
|
serverName?: string | undefined;
|
|
220
|
+
insecureSkipVerify?: boolean | undefined;
|
|
221
221
|
} | undefined;
|
|
222
222
|
}, {
|
|
223
223
|
basicAuth?: {
|
|
@@ -240,7 +240,6 @@ export declare const secretSpecSchema: z.ZodEffects<z.ZodObject<{
|
|
|
240
240
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
241
241
|
} | undefined;
|
|
242
242
|
tlsConfig?: {
|
|
243
|
-
insecureSkipVerify: boolean;
|
|
244
243
|
ca?: string | undefined;
|
|
245
244
|
cert?: string | undefined;
|
|
246
245
|
key?: string | undefined;
|
|
@@ -248,6 +247,7 @@ export declare const secretSpecSchema: z.ZodEffects<z.ZodObject<{
|
|
|
248
247
|
certFile?: string | undefined;
|
|
249
248
|
keyFile?: string | undefined;
|
|
250
249
|
serverName?: string | undefined;
|
|
250
|
+
insecureSkipVerify?: boolean | undefined;
|
|
251
251
|
} | undefined;
|
|
252
252
|
}>;
|
|
253
253
|
export declare const secretSchema: z.ZodObject<{
|
|
@@ -355,9 +355,8 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
355
355
|
certFile: z.ZodOptional<z.ZodString>;
|
|
356
356
|
keyFile: z.ZodOptional<z.ZodString>;
|
|
357
357
|
serverName: z.ZodOptional<z.ZodString>;
|
|
358
|
-
insecureSkipVerify: z.ZodBoolean
|
|
358
|
+
insecureSkipVerify: z.ZodOptional<z.ZodBoolean>;
|
|
359
359
|
}, "strip", z.ZodTypeAny, {
|
|
360
|
-
insecureSkipVerify: boolean;
|
|
361
360
|
ca?: string | undefined;
|
|
362
361
|
cert?: string | undefined;
|
|
363
362
|
key?: string | undefined;
|
|
@@ -365,8 +364,8 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
365
364
|
certFile?: string | undefined;
|
|
366
365
|
keyFile?: string | undefined;
|
|
367
366
|
serverName?: string | undefined;
|
|
367
|
+
insecureSkipVerify?: boolean | undefined;
|
|
368
368
|
}, {
|
|
369
|
-
insecureSkipVerify: boolean;
|
|
370
369
|
ca?: string | undefined;
|
|
371
370
|
cert?: string | undefined;
|
|
372
371
|
key?: string | undefined;
|
|
@@ -374,8 +373,8 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
374
373
|
certFile?: string | undefined;
|
|
375
374
|
keyFile?: string | undefined;
|
|
376
375
|
serverName?: string | undefined;
|
|
376
|
+
insecureSkipVerify?: boolean | undefined;
|
|
377
377
|
}>, {
|
|
378
|
-
insecureSkipVerify: boolean;
|
|
379
378
|
ca?: string | undefined;
|
|
380
379
|
cert?: string | undefined;
|
|
381
380
|
key?: string | undefined;
|
|
@@ -383,8 +382,8 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
383
382
|
certFile?: string | undefined;
|
|
384
383
|
keyFile?: string | undefined;
|
|
385
384
|
serverName?: string | undefined;
|
|
385
|
+
insecureSkipVerify?: boolean | undefined;
|
|
386
386
|
}, {
|
|
387
|
-
insecureSkipVerify: boolean;
|
|
388
387
|
ca?: string | undefined;
|
|
389
388
|
cert?: string | undefined;
|
|
390
389
|
key?: string | undefined;
|
|
@@ -392,6 +391,7 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
392
391
|
certFile?: string | undefined;
|
|
393
392
|
keyFile?: string | undefined;
|
|
394
393
|
serverName?: string | undefined;
|
|
394
|
+
insecureSkipVerify?: boolean | undefined;
|
|
395
395
|
}>>;
|
|
396
396
|
}, "strip", z.ZodTypeAny, {
|
|
397
397
|
basicAuth?: {
|
|
@@ -414,7 +414,6 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
414
414
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
415
415
|
} | undefined;
|
|
416
416
|
tlsConfig?: {
|
|
417
|
-
insecureSkipVerify: boolean;
|
|
418
417
|
ca?: string | undefined;
|
|
419
418
|
cert?: string | undefined;
|
|
420
419
|
key?: string | undefined;
|
|
@@ -422,6 +421,7 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
422
421
|
certFile?: string | undefined;
|
|
423
422
|
keyFile?: string | undefined;
|
|
424
423
|
serverName?: string | undefined;
|
|
424
|
+
insecureSkipVerify?: boolean | undefined;
|
|
425
425
|
} | undefined;
|
|
426
426
|
}, {
|
|
427
427
|
basicAuth?: {
|
|
@@ -444,7 +444,6 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
444
444
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
445
445
|
} | undefined;
|
|
446
446
|
tlsConfig?: {
|
|
447
|
-
insecureSkipVerify: boolean;
|
|
448
447
|
ca?: string | undefined;
|
|
449
448
|
cert?: string | undefined;
|
|
450
449
|
key?: string | undefined;
|
|
@@ -452,6 +451,7 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
452
451
|
certFile?: string | undefined;
|
|
453
452
|
keyFile?: string | undefined;
|
|
454
453
|
serverName?: string | undefined;
|
|
454
|
+
insecureSkipVerify?: boolean | undefined;
|
|
455
455
|
} | undefined;
|
|
456
456
|
}>, {
|
|
457
457
|
basicAuth?: {
|
|
@@ -474,7 +474,6 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
474
474
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
475
475
|
} | undefined;
|
|
476
476
|
tlsConfig?: {
|
|
477
|
-
insecureSkipVerify: boolean;
|
|
478
477
|
ca?: string | undefined;
|
|
479
478
|
cert?: string | undefined;
|
|
480
479
|
key?: string | undefined;
|
|
@@ -482,6 +481,7 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
482
481
|
certFile?: string | undefined;
|
|
483
482
|
keyFile?: string | undefined;
|
|
484
483
|
serverName?: string | undefined;
|
|
484
|
+
insecureSkipVerify?: boolean | undefined;
|
|
485
485
|
} | undefined;
|
|
486
486
|
}, {
|
|
487
487
|
basicAuth?: {
|
|
@@ -504,7 +504,6 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
504
504
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
505
505
|
} | undefined;
|
|
506
506
|
tlsConfig?: {
|
|
507
|
-
insecureSkipVerify: boolean;
|
|
508
507
|
ca?: string | undefined;
|
|
509
508
|
cert?: string | undefined;
|
|
510
509
|
key?: string | undefined;
|
|
@@ -512,6 +511,7 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
512
511
|
certFile?: string | undefined;
|
|
513
512
|
keyFile?: string | undefined;
|
|
514
513
|
serverName?: string | undefined;
|
|
514
|
+
insecureSkipVerify?: boolean | undefined;
|
|
515
515
|
} | undefined;
|
|
516
516
|
}>;
|
|
517
517
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -537,7 +537,6 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
537
537
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
538
538
|
} | undefined;
|
|
539
539
|
tlsConfig?: {
|
|
540
|
-
insecureSkipVerify: boolean;
|
|
541
540
|
ca?: string | undefined;
|
|
542
541
|
cert?: string | undefined;
|
|
543
542
|
key?: string | undefined;
|
|
@@ -545,6 +544,7 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
545
544
|
certFile?: string | undefined;
|
|
546
545
|
keyFile?: string | undefined;
|
|
547
546
|
serverName?: string | undefined;
|
|
547
|
+
insecureSkipVerify?: boolean | undefined;
|
|
548
548
|
} | undefined;
|
|
549
549
|
};
|
|
550
550
|
metadata: {
|
|
@@ -574,7 +574,6 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
574
574
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
575
575
|
} | undefined;
|
|
576
576
|
tlsConfig?: {
|
|
577
|
-
insecureSkipVerify: boolean;
|
|
578
577
|
ca?: string | undefined;
|
|
579
578
|
cert?: string | undefined;
|
|
580
579
|
key?: string | undefined;
|
|
@@ -582,6 +581,7 @@ export declare const secretSchema: z.ZodObject<{
|
|
|
582
581
|
certFile?: string | undefined;
|
|
583
582
|
keyFile?: string | undefined;
|
|
584
583
|
serverName?: string | undefined;
|
|
584
|
+
insecureSkipVerify?: boolean | undefined;
|
|
585
585
|
} | undefined;
|
|
586
586
|
};
|
|
587
587
|
metadata: {
|
|
@@ -690,9 +690,8 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
690
690
|
certFile: z.ZodOptional<z.ZodString>;
|
|
691
691
|
keyFile: z.ZodOptional<z.ZodString>;
|
|
692
692
|
serverName: z.ZodOptional<z.ZodString>;
|
|
693
|
-
insecureSkipVerify: z.ZodBoolean
|
|
693
|
+
insecureSkipVerify: z.ZodOptional<z.ZodBoolean>;
|
|
694
694
|
}, "strip", z.ZodTypeAny, {
|
|
695
|
-
insecureSkipVerify: boolean;
|
|
696
695
|
ca?: string | undefined;
|
|
697
696
|
cert?: string | undefined;
|
|
698
697
|
key?: string | undefined;
|
|
@@ -700,8 +699,8 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
700
699
|
certFile?: string | undefined;
|
|
701
700
|
keyFile?: string | undefined;
|
|
702
701
|
serverName?: string | undefined;
|
|
702
|
+
insecureSkipVerify?: boolean | undefined;
|
|
703
703
|
}, {
|
|
704
|
-
insecureSkipVerify: boolean;
|
|
705
704
|
ca?: string | undefined;
|
|
706
705
|
cert?: string | undefined;
|
|
707
706
|
key?: string | undefined;
|
|
@@ -709,8 +708,8 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
709
708
|
certFile?: string | undefined;
|
|
710
709
|
keyFile?: string | undefined;
|
|
711
710
|
serverName?: string | undefined;
|
|
711
|
+
insecureSkipVerify?: boolean | undefined;
|
|
712
712
|
}>, {
|
|
713
|
-
insecureSkipVerify: boolean;
|
|
714
713
|
ca?: string | undefined;
|
|
715
714
|
cert?: string | undefined;
|
|
716
715
|
key?: string | undefined;
|
|
@@ -718,8 +717,8 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
718
717
|
certFile?: string | undefined;
|
|
719
718
|
keyFile?: string | undefined;
|
|
720
719
|
serverName?: string | undefined;
|
|
720
|
+
insecureSkipVerify?: boolean | undefined;
|
|
721
721
|
}, {
|
|
722
|
-
insecureSkipVerify: boolean;
|
|
723
722
|
ca?: string | undefined;
|
|
724
723
|
cert?: string | undefined;
|
|
725
724
|
key?: string | undefined;
|
|
@@ -727,6 +726,7 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
727
726
|
certFile?: string | undefined;
|
|
728
727
|
keyFile?: string | undefined;
|
|
729
728
|
serverName?: string | undefined;
|
|
729
|
+
insecureSkipVerify?: boolean | undefined;
|
|
730
730
|
}>>;
|
|
731
731
|
}, "strip", z.ZodTypeAny, {
|
|
732
732
|
basicAuth?: {
|
|
@@ -749,7 +749,6 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
749
749
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
750
750
|
} | undefined;
|
|
751
751
|
tlsConfig?: {
|
|
752
|
-
insecureSkipVerify: boolean;
|
|
753
752
|
ca?: string | undefined;
|
|
754
753
|
cert?: string | undefined;
|
|
755
754
|
key?: string | undefined;
|
|
@@ -757,6 +756,7 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
757
756
|
certFile?: string | undefined;
|
|
758
757
|
keyFile?: string | undefined;
|
|
759
758
|
serverName?: string | undefined;
|
|
759
|
+
insecureSkipVerify?: boolean | undefined;
|
|
760
760
|
} | undefined;
|
|
761
761
|
}, {
|
|
762
762
|
basicAuth?: {
|
|
@@ -779,7 +779,6 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
779
779
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
780
780
|
} | undefined;
|
|
781
781
|
tlsConfig?: {
|
|
782
|
-
insecureSkipVerify: boolean;
|
|
783
782
|
ca?: string | undefined;
|
|
784
783
|
cert?: string | undefined;
|
|
785
784
|
key?: string | undefined;
|
|
@@ -787,6 +786,7 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
787
786
|
certFile?: string | undefined;
|
|
788
787
|
keyFile?: string | undefined;
|
|
789
788
|
serverName?: string | undefined;
|
|
789
|
+
insecureSkipVerify?: boolean | undefined;
|
|
790
790
|
} | undefined;
|
|
791
791
|
}>, {
|
|
792
792
|
basicAuth?: {
|
|
@@ -809,7 +809,6 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
809
809
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
810
810
|
} | undefined;
|
|
811
811
|
tlsConfig?: {
|
|
812
|
-
insecureSkipVerify: boolean;
|
|
813
812
|
ca?: string | undefined;
|
|
814
813
|
cert?: string | undefined;
|
|
815
814
|
key?: string | undefined;
|
|
@@ -817,6 +816,7 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
817
816
|
certFile?: string | undefined;
|
|
818
817
|
keyFile?: string | undefined;
|
|
819
818
|
serverName?: string | undefined;
|
|
819
|
+
insecureSkipVerify?: boolean | undefined;
|
|
820
820
|
} | undefined;
|
|
821
821
|
}, {
|
|
822
822
|
basicAuth?: {
|
|
@@ -839,7 +839,6 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
839
839
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
840
840
|
} | undefined;
|
|
841
841
|
tlsConfig?: {
|
|
842
|
-
insecureSkipVerify: boolean;
|
|
843
842
|
ca?: string | undefined;
|
|
844
843
|
cert?: string | undefined;
|
|
845
844
|
key?: string | undefined;
|
|
@@ -847,6 +846,7 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
847
846
|
certFile?: string | undefined;
|
|
848
847
|
keyFile?: string | undefined;
|
|
849
848
|
serverName?: string | undefined;
|
|
849
|
+
insecureSkipVerify?: boolean | undefined;
|
|
850
850
|
} | undefined;
|
|
851
851
|
}>;
|
|
852
852
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -872,7 +872,6 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
872
872
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
873
873
|
} | undefined;
|
|
874
874
|
tlsConfig?: {
|
|
875
|
-
insecureSkipVerify: boolean;
|
|
876
875
|
ca?: string | undefined;
|
|
877
876
|
cert?: string | undefined;
|
|
878
877
|
key?: string | undefined;
|
|
@@ -880,6 +879,7 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
880
879
|
certFile?: string | undefined;
|
|
881
880
|
keyFile?: string | undefined;
|
|
882
881
|
serverName?: string | undefined;
|
|
882
|
+
insecureSkipVerify?: boolean | undefined;
|
|
883
883
|
} | undefined;
|
|
884
884
|
};
|
|
885
885
|
metadata: {
|
|
@@ -908,7 +908,6 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
908
908
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
909
909
|
} | undefined;
|
|
910
910
|
tlsConfig?: {
|
|
911
|
-
insecureSkipVerify: boolean;
|
|
912
911
|
ca?: string | undefined;
|
|
913
912
|
cert?: string | undefined;
|
|
914
913
|
key?: string | undefined;
|
|
@@ -916,6 +915,7 @@ export declare const globalSecretSchema: z.ZodObject<{
|
|
|
916
915
|
certFile?: string | undefined;
|
|
917
916
|
keyFile?: string | undefined;
|
|
918
917
|
serverName?: string | undefined;
|
|
918
|
+
insecureSkipVerify?: boolean | undefined;
|
|
919
919
|
} | undefined;
|
|
920
920
|
};
|
|
921
921
|
metadata: {
|
|
@@ -1027,9 +1027,8 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1027
1027
|
certFile: z.ZodOptional<z.ZodString>;
|
|
1028
1028
|
keyFile: z.ZodOptional<z.ZodString>;
|
|
1029
1029
|
serverName: z.ZodOptional<z.ZodString>;
|
|
1030
|
-
insecureSkipVerify: z.ZodBoolean
|
|
1030
|
+
insecureSkipVerify: z.ZodOptional<z.ZodBoolean>;
|
|
1031
1031
|
}, "strip", z.ZodTypeAny, {
|
|
1032
|
-
insecureSkipVerify: boolean;
|
|
1033
1032
|
ca?: string | undefined;
|
|
1034
1033
|
cert?: string | undefined;
|
|
1035
1034
|
key?: string | undefined;
|
|
@@ -1037,8 +1036,8 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1037
1036
|
certFile?: string | undefined;
|
|
1038
1037
|
keyFile?: string | undefined;
|
|
1039
1038
|
serverName?: string | undefined;
|
|
1039
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1040
1040
|
}, {
|
|
1041
|
-
insecureSkipVerify: boolean;
|
|
1042
1041
|
ca?: string | undefined;
|
|
1043
1042
|
cert?: string | undefined;
|
|
1044
1043
|
key?: string | undefined;
|
|
@@ -1046,8 +1045,8 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1046
1045
|
certFile?: string | undefined;
|
|
1047
1046
|
keyFile?: string | undefined;
|
|
1048
1047
|
serverName?: string | undefined;
|
|
1048
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1049
1049
|
}>, {
|
|
1050
|
-
insecureSkipVerify: boolean;
|
|
1051
1050
|
ca?: string | undefined;
|
|
1052
1051
|
cert?: string | undefined;
|
|
1053
1052
|
key?: string | undefined;
|
|
@@ -1055,8 +1054,8 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1055
1054
|
certFile?: string | undefined;
|
|
1056
1055
|
keyFile?: string | undefined;
|
|
1057
1056
|
serverName?: string | undefined;
|
|
1057
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1058
1058
|
}, {
|
|
1059
|
-
insecureSkipVerify: boolean;
|
|
1060
1059
|
ca?: string | undefined;
|
|
1061
1060
|
cert?: string | undefined;
|
|
1062
1061
|
key?: string | undefined;
|
|
@@ -1064,6 +1063,7 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1064
1063
|
certFile?: string | undefined;
|
|
1065
1064
|
keyFile?: string | undefined;
|
|
1066
1065
|
serverName?: string | undefined;
|
|
1066
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1067
1067
|
}>>;
|
|
1068
1068
|
}, "strip", z.ZodTypeAny, {
|
|
1069
1069
|
basicAuth?: {
|
|
@@ -1086,7 +1086,6 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1086
1086
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
1087
1087
|
} | undefined;
|
|
1088
1088
|
tlsConfig?: {
|
|
1089
|
-
insecureSkipVerify: boolean;
|
|
1090
1089
|
ca?: string | undefined;
|
|
1091
1090
|
cert?: string | undefined;
|
|
1092
1091
|
key?: string | undefined;
|
|
@@ -1094,6 +1093,7 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1094
1093
|
certFile?: string | undefined;
|
|
1095
1094
|
keyFile?: string | undefined;
|
|
1096
1095
|
serverName?: string | undefined;
|
|
1096
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1097
1097
|
} | undefined;
|
|
1098
1098
|
}, {
|
|
1099
1099
|
basicAuth?: {
|
|
@@ -1116,7 +1116,6 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1116
1116
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
1117
1117
|
} | undefined;
|
|
1118
1118
|
tlsConfig?: {
|
|
1119
|
-
insecureSkipVerify: boolean;
|
|
1120
1119
|
ca?: string | undefined;
|
|
1121
1120
|
cert?: string | undefined;
|
|
1122
1121
|
key?: string | undefined;
|
|
@@ -1124,6 +1123,7 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1124
1123
|
certFile?: string | undefined;
|
|
1125
1124
|
keyFile?: string | undefined;
|
|
1126
1125
|
serverName?: string | undefined;
|
|
1126
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1127
1127
|
} | undefined;
|
|
1128
1128
|
}>, {
|
|
1129
1129
|
basicAuth?: {
|
|
@@ -1146,7 +1146,6 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1146
1146
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
1147
1147
|
} | undefined;
|
|
1148
1148
|
tlsConfig?: {
|
|
1149
|
-
insecureSkipVerify: boolean;
|
|
1150
1149
|
ca?: string | undefined;
|
|
1151
1150
|
cert?: string | undefined;
|
|
1152
1151
|
key?: string | undefined;
|
|
@@ -1154,6 +1153,7 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1154
1153
|
certFile?: string | undefined;
|
|
1155
1154
|
keyFile?: string | undefined;
|
|
1156
1155
|
serverName?: string | undefined;
|
|
1156
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1157
1157
|
} | undefined;
|
|
1158
1158
|
}, {
|
|
1159
1159
|
basicAuth?: {
|
|
@@ -1176,7 +1176,6 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1176
1176
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
1177
1177
|
} | undefined;
|
|
1178
1178
|
tlsConfig?: {
|
|
1179
|
-
insecureSkipVerify: boolean;
|
|
1180
1179
|
ca?: string | undefined;
|
|
1181
1180
|
cert?: string | undefined;
|
|
1182
1181
|
key?: string | undefined;
|
|
@@ -1184,6 +1183,7 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1184
1183
|
certFile?: string | undefined;
|
|
1185
1184
|
keyFile?: string | undefined;
|
|
1186
1185
|
serverName?: string | undefined;
|
|
1186
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1187
1187
|
} | undefined;
|
|
1188
1188
|
}>;
|
|
1189
1189
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1209,7 +1209,6 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1209
1209
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
1210
1210
|
} | undefined;
|
|
1211
1211
|
tlsConfig?: {
|
|
1212
|
-
insecureSkipVerify: boolean;
|
|
1213
1212
|
ca?: string | undefined;
|
|
1214
1213
|
cert?: string | undefined;
|
|
1215
1214
|
key?: string | undefined;
|
|
@@ -1217,6 +1216,7 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1217
1216
|
certFile?: string | undefined;
|
|
1218
1217
|
keyFile?: string | undefined;
|
|
1219
1218
|
serverName?: string | undefined;
|
|
1219
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1220
1220
|
} | undefined;
|
|
1221
1221
|
};
|
|
1222
1222
|
metadata: {
|
|
@@ -1246,7 +1246,6 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1246
1246
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
1247
1247
|
} | undefined;
|
|
1248
1248
|
tlsConfig?: {
|
|
1249
|
-
insecureSkipVerify: boolean;
|
|
1250
1249
|
ca?: string | undefined;
|
|
1251
1250
|
cert?: string | undefined;
|
|
1252
1251
|
key?: string | undefined;
|
|
@@ -1254,6 +1253,7 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1254
1253
|
certFile?: string | undefined;
|
|
1255
1254
|
keyFile?: string | undefined;
|
|
1256
1255
|
serverName?: string | undefined;
|
|
1256
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1257
1257
|
} | undefined;
|
|
1258
1258
|
};
|
|
1259
1259
|
metadata: {
|
|
@@ -1361,9 +1361,8 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1361
1361
|
certFile: z.ZodOptional<z.ZodString>;
|
|
1362
1362
|
keyFile: z.ZodOptional<z.ZodString>;
|
|
1363
1363
|
serverName: z.ZodOptional<z.ZodString>;
|
|
1364
|
-
insecureSkipVerify: z.ZodBoolean
|
|
1364
|
+
insecureSkipVerify: z.ZodOptional<z.ZodBoolean>;
|
|
1365
1365
|
}, "strip", z.ZodTypeAny, {
|
|
1366
|
-
insecureSkipVerify: boolean;
|
|
1367
1366
|
ca?: string | undefined;
|
|
1368
1367
|
cert?: string | undefined;
|
|
1369
1368
|
key?: string | undefined;
|
|
@@ -1371,8 +1370,8 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1371
1370
|
certFile?: string | undefined;
|
|
1372
1371
|
keyFile?: string | undefined;
|
|
1373
1372
|
serverName?: string | undefined;
|
|
1373
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1374
1374
|
}, {
|
|
1375
|
-
insecureSkipVerify: boolean;
|
|
1376
1375
|
ca?: string | undefined;
|
|
1377
1376
|
cert?: string | undefined;
|
|
1378
1377
|
key?: string | undefined;
|
|
@@ -1380,8 +1379,8 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1380
1379
|
certFile?: string | undefined;
|
|
1381
1380
|
keyFile?: string | undefined;
|
|
1382
1381
|
serverName?: string | undefined;
|
|
1382
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1383
1383
|
}>, {
|
|
1384
|
-
insecureSkipVerify: boolean;
|
|
1385
1384
|
ca?: string | undefined;
|
|
1386
1385
|
cert?: string | undefined;
|
|
1387
1386
|
key?: string | undefined;
|
|
@@ -1389,8 +1388,8 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1389
1388
|
certFile?: string | undefined;
|
|
1390
1389
|
keyFile?: string | undefined;
|
|
1391
1390
|
serverName?: string | undefined;
|
|
1391
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1392
1392
|
}, {
|
|
1393
|
-
insecureSkipVerify: boolean;
|
|
1394
1393
|
ca?: string | undefined;
|
|
1395
1394
|
cert?: string | undefined;
|
|
1396
1395
|
key?: string | undefined;
|
|
@@ -1398,6 +1397,7 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1398
1397
|
certFile?: string | undefined;
|
|
1399
1398
|
keyFile?: string | undefined;
|
|
1400
1399
|
serverName?: string | undefined;
|
|
1400
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1401
1401
|
}>>;
|
|
1402
1402
|
}, "strip", z.ZodTypeAny, {
|
|
1403
1403
|
basicAuth?: {
|
|
@@ -1420,7 +1420,6 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1420
1420
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
1421
1421
|
} | undefined;
|
|
1422
1422
|
tlsConfig?: {
|
|
1423
|
-
insecureSkipVerify: boolean;
|
|
1424
1423
|
ca?: string | undefined;
|
|
1425
1424
|
cert?: string | undefined;
|
|
1426
1425
|
key?: string | undefined;
|
|
@@ -1428,6 +1427,7 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1428
1427
|
certFile?: string | undefined;
|
|
1429
1428
|
keyFile?: string | undefined;
|
|
1430
1429
|
serverName?: string | undefined;
|
|
1430
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1431
1431
|
} | undefined;
|
|
1432
1432
|
}, {
|
|
1433
1433
|
basicAuth?: {
|
|
@@ -1450,7 +1450,6 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1450
1450
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
1451
1451
|
} | undefined;
|
|
1452
1452
|
tlsConfig?: {
|
|
1453
|
-
insecureSkipVerify: boolean;
|
|
1454
1453
|
ca?: string | undefined;
|
|
1455
1454
|
cert?: string | undefined;
|
|
1456
1455
|
key?: string | undefined;
|
|
@@ -1458,6 +1457,7 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1458
1457
|
certFile?: string | undefined;
|
|
1459
1458
|
keyFile?: string | undefined;
|
|
1460
1459
|
serverName?: string | undefined;
|
|
1460
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1461
1461
|
} | undefined;
|
|
1462
1462
|
}>, {
|
|
1463
1463
|
basicAuth?: {
|
|
@@ -1480,7 +1480,6 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1480
1480
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
1481
1481
|
} | undefined;
|
|
1482
1482
|
tlsConfig?: {
|
|
1483
|
-
insecureSkipVerify: boolean;
|
|
1484
1483
|
ca?: string | undefined;
|
|
1485
1484
|
cert?: string | undefined;
|
|
1486
1485
|
key?: string | undefined;
|
|
@@ -1488,6 +1487,7 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1488
1487
|
certFile?: string | undefined;
|
|
1489
1488
|
keyFile?: string | undefined;
|
|
1490
1489
|
serverName?: string | undefined;
|
|
1490
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1491
1491
|
} | undefined;
|
|
1492
1492
|
}, {
|
|
1493
1493
|
basicAuth?: {
|
|
@@ -1510,7 +1510,6 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1510
1510
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
1511
1511
|
} | undefined;
|
|
1512
1512
|
tlsConfig?: {
|
|
1513
|
-
insecureSkipVerify: boolean;
|
|
1514
1513
|
ca?: string | undefined;
|
|
1515
1514
|
cert?: string | undefined;
|
|
1516
1515
|
key?: string | undefined;
|
|
@@ -1518,6 +1517,7 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1518
1517
|
certFile?: string | undefined;
|
|
1519
1518
|
keyFile?: string | undefined;
|
|
1520
1519
|
serverName?: string | undefined;
|
|
1520
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1521
1521
|
} | undefined;
|
|
1522
1522
|
}>;
|
|
1523
1523
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -1543,7 +1543,6 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1543
1543
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
1544
1544
|
} | undefined;
|
|
1545
1545
|
tlsConfig?: {
|
|
1546
|
-
insecureSkipVerify: boolean;
|
|
1547
1546
|
ca?: string | undefined;
|
|
1548
1547
|
cert?: string | undefined;
|
|
1549
1548
|
key?: string | undefined;
|
|
@@ -1551,6 +1550,7 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1551
1550
|
certFile?: string | undefined;
|
|
1552
1551
|
keyFile?: string | undefined;
|
|
1553
1552
|
serverName?: string | undefined;
|
|
1553
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1554
1554
|
} | undefined;
|
|
1555
1555
|
};
|
|
1556
1556
|
metadata: {
|
|
@@ -1579,7 +1579,6 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1579
1579
|
authStyle?: 0 | 1 | 2 | undefined;
|
|
1580
1580
|
} | undefined;
|
|
1581
1581
|
tlsConfig?: {
|
|
1582
|
-
insecureSkipVerify: boolean;
|
|
1583
1582
|
ca?: string | undefined;
|
|
1584
1583
|
cert?: string | undefined;
|
|
1585
1584
|
key?: string | undefined;
|
|
@@ -1587,6 +1586,7 @@ export declare const secretsEditorSchema: z.ZodDiscriminatedUnion<"kind", [z.Zod
|
|
|
1587
1586
|
certFile?: string | undefined;
|
|
1588
1587
|
keyFile?: string | undefined;
|
|
1589
1588
|
serverName?: string | undefined;
|
|
1589
|
+
insecureSkipVerify?: boolean | undefined;
|
|
1590
1590
|
} | undefined;
|
|
1591
1591
|
};
|
|
1592
1592
|
metadata: {
|
package/dist/schema/secret.js
CHANGED
|
@@ -95,7 +95,7 @@ export const secretSpecSchema = z.object({
|
|
|
95
95
|
certFile: z.string().optional(),
|
|
96
96
|
keyFile: z.string().optional(),
|
|
97
97
|
serverName: z.string().optional(),
|
|
98
|
-
insecureSkipVerify: z.boolean()
|
|
98
|
+
insecureSkipVerify: z.boolean().optional()
|
|
99
99
|
}).superRefine((val, ctx)=>{
|
|
100
100
|
if (val.ca && val.ca.length > 0 && val.caFile && val.caFile.length > 0) {
|
|
101
101
|
ctx.addIssue({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/schema/secret.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 { z } from 'zod';\nimport { metadataSchema, projectMetadataSchema } from './metadata';\n\nexport const secretSpecSchema = z\n .object({\n basicAuth: z\n .object({\n username: z.string().min(1),\n password: z.string().optional(),\n passwordFile: z.string().optional(),\n })\n .superRefine((val, ctx) => {\n if (val.password && val.password.length > 0 && val.passwordFile && val.passwordFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['password'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['passwordFile'],\n });\n }\n })\n .optional(),\n authorization: z\n .object({\n type: z.string().optional(),\n credentials: z.string().optional(),\n credentialsFile: z.string().optional(),\n })\n .superRefine((val, ctx) => {\n if (val.credentials && val.credentials.length > 0 && val.credentialsFile && val.credentialsFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['credentials'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['credentialsFile'],\n });\n }\n })\n .optional(),\n oauth: z\n .object({\n clientID: z.string().min(1),\n clientSecret: z.string().optional(),\n clientSecretFile: z.string().optional(),\n tokenURL: z.string().min(1),\n scopes: z.array(z.string().nonempty()).default([]),\n endpointParams: z.record(z.string().nonempty(), z.array(z.string())).default({}).optional(),\n authStyle: z.union([z.literal(0), z.literal(1), z.literal(2)]).optional(),\n })\n .superRefine((val, ctx) => {\n if (\n val.clientSecret &&\n val.clientSecret.length > 0 &&\n val.clientSecretFile &&\n val.clientSecretFile.length > 0\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['clientSecret'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['clientSecretFile'],\n });\n }\n })\n .optional(),\n tlsConfig: z\n .object({\n ca: z.string().optional(),\n cert: z.string().optional(),\n key: z.string().optional(),\n caFile: z.string().optional(),\n certFile: z.string().optional(),\n keyFile: z.string().optional(),\n serverName: z.string().optional(),\n insecureSkipVerify: z.boolean(),\n })\n .superRefine((val, ctx) => {\n if (val.ca && val.ca.length > 0 && val.caFile && val.caFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['ca'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['caFile'],\n });\n }\n\n if (val.cert && val.cert.length > 0 && val.certFile && val.certFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['cert'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['certFile'],\n });\n }\n\n if (val.key && val.key.length > 0 && val.keyFile && val.keyFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['key'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['keyFile'],\n });\n }\n })\n .optional(),\n })\n .superRefine((val, ctx) => {\n if (val.basicAuth && val.authorization && val.oauth) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['basicAuth'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['authorization'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['oauth'],\n });\n }\n });\n\nexport const secretSchema = z.object({\n kind: z.literal('Secret'),\n metadata: projectMetadataSchema,\n spec: secretSpecSchema,\n});\n\nexport const globalSecretSchema = z.object({\n kind: z.literal('GlobalSecret'),\n metadata: metadataSchema,\n spec: secretSpecSchema,\n});\n\nexport const secretsEditorSchema = z.discriminatedUnion('kind', [secretSchema, globalSecretSchema]);\n\nexport type SecretsEditorSchemaType = z.infer<typeof secretsEditorSchema>;\n"],"names":["z","metadataSchema","projectMetadataSchema","secretSpecSchema","object","basicAuth","username","string","min","password","optional","passwordFile","superRefine","val","ctx","length","addIssue","code","ZodIssueCode","custom","message","path","authorization","type","credentials","credentialsFile","oauth","clientID","clientSecret","clientSecretFile","tokenURL","scopes","array","nonempty","default","endpointParams","record","authStyle","union","literal","tlsConfig","ca","cert","key","caFile","certFile","keyFile","serverName","insecureSkipVerify","boolean","secretSchema","kind","metadata","spec","globalSecretSchema","secretsEditorSchema","discriminatedUnion"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EA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IAAIiC,OAAO,CAAC/B,MAAM,GAAG,GAAG;YAC1ED,IAAIE,QAAQ,CAAC;gBACXC,MAAMjB,EAAEkB,YAAY,CAACC,MAAM;gBAC3BC,SAAS;gBACTC,MAAM;oBAAC;iBAAM;YACf;YACAP,IAAIE,QAAQ,CAAC;gBACXC,MAAMjB,EAAEkB,YAAY,CAACC,MAAM;gBAC3BC,SAAS;gBACTC,MAAM;oBAAC;iBAAU;YACnB;QACF;IACF,GACCX,QAAQ;AACb,GACCE,WAAW,CAAC,CAACC,KAAKC;IACjB,IAAID,IAAIR,SAAS,IAAIQ,IAAIS,aAAa,IAAIT,IAAIa,KAAK,EAAE;QACnDZ,IAAIE,QAAQ,CAAC;YACXC,MAAMjB,EAAEkB,YAAY,CAACC,MAAM;YAC3BC,SAAS;YACTC,MAAM;gBAAC;aAAY;QACrB;QACAP,IAAIE,QAAQ,CAAC;YACXC,MAAMjB,EAAEkB,YAAY,CAACC,MAAM;YAC3BC,SAAS;YACTC,MAAM;gBAAC;aAAgB;QACzB;QACAP,IAAIE,QAAQ,CAAC;YACXC,MAAMjB,EAAEkB,YAAY,CAACC,MAAM;YAC3BC,SAAS;YACTC,MAAM;gBAAC;aAAQ;QACjB;IACF;AACF,GAAG;AAEL,OAAO,MAAM6B,eAAelD,EAAEI,MAAM,CAAC;IACnC+C,MAAMnD,EAAEuC,OAAO,CAAC;IAChBa,UAAUlD;IACVmD,MAAMlD;AACR,GAAG;AAEH,OAAO,MAAMmD,qBAAqBtD,EAAEI,MAAM,CAAC;IACzC+C,MAAMnD,EAAEuC,OAAO,CAAC;IAChBa,UAAUnD;IACVoD,MAAMlD;AACR,GAAG;AAEH,OAAO,MAAMoD,sBAAsBvD,EAAEwD,kBAAkB,CAAC,QAAQ;IAACN;IAAcI;CAAmB,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../src/schema/secret.ts"],"sourcesContent":["// Copyright 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 { z } from 'zod';\nimport { metadataSchema, projectMetadataSchema } from './metadata';\n\nexport const secretSpecSchema = z\n .object({\n basicAuth: z\n .object({\n username: z.string().min(1),\n password: z.string().optional(),\n passwordFile: z.string().optional(),\n })\n .superRefine((val, ctx) => {\n if (val.password && val.password.length > 0 && val.passwordFile && val.passwordFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['password'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['passwordFile'],\n });\n }\n })\n .optional(),\n authorization: z\n .object({\n type: z.string().optional(),\n credentials: z.string().optional(),\n credentialsFile: z.string().optional(),\n })\n .superRefine((val, ctx) => {\n if (val.credentials && val.credentials.length > 0 && val.credentialsFile && val.credentialsFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['credentials'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['credentialsFile'],\n });\n }\n })\n .optional(),\n oauth: z\n .object({\n clientID: z.string().min(1),\n clientSecret: z.string().optional(),\n clientSecretFile: z.string().optional(),\n tokenURL: z.string().min(1),\n scopes: z.array(z.string().nonempty()).default([]),\n endpointParams: z.record(z.string().nonempty(), z.array(z.string())).default({}).optional(),\n authStyle: z.union([z.literal(0), z.literal(1), z.literal(2)]).optional(),\n })\n .superRefine((val, ctx) => {\n if (\n val.clientSecret &&\n val.clientSecret.length > 0 &&\n val.clientSecretFile &&\n val.clientSecretFile.length > 0\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['clientSecret'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['clientSecretFile'],\n });\n }\n })\n .optional(),\n tlsConfig: z\n .object({\n ca: z.string().optional(),\n cert: z.string().optional(),\n key: z.string().optional(),\n caFile: z.string().optional(),\n certFile: z.string().optional(),\n keyFile: z.string().optional(),\n serverName: z.string().optional(),\n insecureSkipVerify: z.boolean().optional(),\n })\n .superRefine((val, ctx) => {\n if (val.ca && val.ca.length > 0 && val.caFile && val.caFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['ca'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['caFile'],\n });\n }\n\n if (val.cert && val.cert.length > 0 && val.certFile && val.certFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['cert'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['certFile'],\n });\n }\n\n if (val.key && val.key.length > 0 && val.keyFile && val.keyFile.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['key'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['keyFile'],\n });\n }\n })\n .optional(),\n })\n .superRefine((val, ctx) => {\n if (val.basicAuth && val.authorization && val.oauth) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['basicAuth'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['authorization'],\n });\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: 'Only one of the fields must be defined',\n path: ['oauth'],\n });\n }\n });\n\nexport const secretSchema = z.object({\n kind: z.literal('Secret'),\n metadata: projectMetadataSchema,\n spec: secretSpecSchema,\n});\n\nexport const globalSecretSchema = z.object({\n kind: z.literal('GlobalSecret'),\n metadata: metadataSchema,\n spec: secretSpecSchema,\n});\n\nexport const secretsEditorSchema = z.discriminatedUnion('kind', [secretSchema, globalSecretSchema]);\n\nexport type SecretsEditorSchemaType = z.infer<typeof secretsEditorSchema>;\n"],"names":["z","metadataSchema","projectMetadataSchema","secretSpecSchema","object","basicAuth","username","string","min","password","optional","passwordFile","superRefine","val","ctx","length","addIssue","code","ZodIssueCode","custom","message","path","authorization","type","credentials","credentialsFile","oauth","clientID","clientSecret","clientSecretFile","tokenURL","scopes","array","nonempty","default","endpointParams","record","authStyle","union","literal","tlsConfig","ca","cert","key","caFile","certFile","keyFile","serverName","insecureSkipVerify","boolean","secretSchema","kind","metadata","spec","globalSecretSchema","secretsEditorSchema","discriminatedUnion"],"mappings":"AAAA,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,CAAC,QAAQ,MAAM;AACxB,SAASC,cAAc,EAAEC,qBAAqB,QAAQ,aAAa;AAEnE,OAAO,MAAMC,mBAAmBH,EAC7BI,MAAM,CAAC;IACNC,WAAWL,EACRI,MAAM,CAAC;QACNE,UAAUN,EAAEO,MAAM,GAAGC,GAAG,CAAC;QACzBC,UAAUT,EAAEO,MAAM,GAAGG,QAAQ;QAC7BC,cAAcX,EAAEO,MAAM,GAAGG,QAAQ;IACnC,GACCE,WAAW,CAAC,CAACC,KAAKC;QACjB,IAAID,IAAIJ,QAAQ,IAAII,IAAIJ,QAAQ,CAACM,MAAM,GAAG,KAAKF,IAAIF,YAAY,IAAIE,IAAIF,YAAY,CAACI,MAAM,GAAG,GAAG;YAC9FD,IAAIE,QAAQ,CAAC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AC;aAAY;QACrB;QACAP,IAAIE,QAAQ,CAAC;YACXC,MAAMjB,EAAEkB,YAAY,CAACC,MAAM;YAC3BC,SAAS;YACTC,MAAM;gBAAC;aAAgB;QACzB;QACAP,IAAIE,QAAQ,CAAC;YACXC,MAAMjB,EAAEkB,YAAY,CAACC,MAAM;YAC3BC,SAAS;YACTC,MAAM;gBAAC;aAAQ;QACjB;IACF;AACF,GAAG;AAEL,OAAO,MAAM6B,eAAelD,EAAEI,MAAM,CAAC;IACnC+C,MAAMnD,EAAEuC,OAAO,CAAC;IAChBa,UAAUlD;IACVmD,MAAMlD;AACR,GAAG;AAEH,OAAO,MAAMmD,qBAAqBtD,EAAEI,MAAM,CAAC;IACzC+C,MAAMnD,EAAEuC,OAAO,CAAC;IAChBa,UAAUnD;IACVoD,MAAMlD;AACR,GAAG;AAEH,OAAO,MAAMoD,sBAAsBvD,EAAEwD,kBAAkB,CAAC,QAAQ;IAACN;IAAcI;CAAmB,EAAE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@perses-dev/core",
|
|
3
|
-
"version": "0.52.0-beta.
|
|
3
|
+
"version": "0.52.0-beta.1",
|
|
4
4
|
"description": "Core functionality consumed by both the Perses UI and plugins",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/perses/perses/blob/main/README.md",
|