@camunda/ccma-shared-types 10.4.0 → 10.6.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/approvals/edit-generation.d.ts +72 -0
- package/dist/approvals/edit-generation.js +11 -0
- package/dist/approvals/edit-generation.js.map +7 -0
- package/dist/approvals/use-cases.const.d.ts +2 -0
- package/dist/approvals/use-cases.const.js +8 -1
- package/dist/approvals/use-cases.const.js.map +2 -2
- package/dist/dtos/CommonCluster.dto.d.ts +13 -0
- package/dist/enums/AuditEntity.enum.d.ts +1 -0
- package/dist/enums/AuditEntity.enum.js +1 -0
- package/dist/enums/AuditEntity.enum.js.map +2 -2
- package/dist/index.d.ts +7 -3
- package/dist/index.js +19 -1
- package/dist/index.js.map +2 -2
- package/dist/permissions/combo.js +3 -0
- package/dist/permissions/combo.js.map +2 -2
- package/dist/permissions/combo.zeebeRebalancing.spec.d.ts +1 -0
- package/dist/permissions/console.permissions.d.ts +2 -0
- package/dist/permissions/console.permissions.js +11 -2
- package/dist/permissions/console.permissions.js.map +2 -2
- package/dist/types/C8ClusterComponentVersions.type.d.ts +12 -3
- package/dist/types/C8ClusterComponentVersions.type.js +11 -0
- package/dist/types/C8ClusterComponentVersions.type.js.map +2 -2
- package/dist/types/C8ClusterComponentVersions.type.spec.d.ts +1 -0
- package/dist/utils/zeebeRebalancing.utils.d.ts +32 -0
- package/dist/utils/zeebeRebalancing.utils.js +79 -0
- package/dist/utils/zeebeRebalancing.utils.js.map +7 -0
- package/dist/utils/zeebeRebalancing.utils.spec.d.ts +1 -0
- package/package.json +1 -1
|
@@ -25,11 +25,20 @@ export interface MutableZeebeClusterVersionsDto {
|
|
|
25
25
|
* The mutable versions that are image references.
|
|
26
26
|
*
|
|
27
27
|
* The approval use case `change-generation-versions` writes these two and
|
|
28
|
-
* never an env var field.
|
|
29
|
-
*
|
|
30
|
-
* The env var fields change on the direct Edit, as before.
|
|
28
|
+
* never an env var field. The env var fields go through `edit-generation`
|
|
29
|
+
* (see `GENERATION_ENV_VARS_KEYS`).
|
|
31
30
|
*/
|
|
32
31
|
export declare const GENERATION_IMAGE_VERSION_KEYS: readonly ["zeebeAnalytics", "elasticSearchCurator"];
|
|
33
32
|
export type GenerationImageVersionsDto = Pick<MutableZeebeClusterVersionsDto, (typeof GENERATION_IMAGE_VERSION_KEYS)[number]>;
|
|
33
|
+
/**
|
|
34
|
+
* The mutable versions that are env var text, one field for each component.
|
|
35
|
+
*
|
|
36
|
+
* The approval use case `edit-generation` writes these and the name. An env
|
|
37
|
+
* var text can hold a secret. Thus a request shows the text on its detail
|
|
38
|
+
* page only, and never in a row of the list, a log line or the result.
|
|
39
|
+
*/
|
|
40
|
+
export declare const GENERATION_ENV_VARS_KEYS: readonly ["operateEnvVars", "zeebeBrokerEnvVars", "zeebeGatewayEnvVars", "tasklistEnvVars", "optimizeEnvVars", "zeebeAnalyticsEnvVars", "connectorBridgeEnvVars", "gatewayEnvVars"];
|
|
41
|
+
export type GenerationEnvVarsKey = (typeof GENERATION_ENV_VARS_KEYS)[number];
|
|
42
|
+
export type GenerationEnvVarsDto = Pick<MutableZeebeClusterVersionsDto, GenerationEnvVarsKey>;
|
|
34
43
|
export declare const MutableThings: string[];
|
|
35
44
|
export declare const AllThings: string[];
|
|
@@ -10,6 +10,16 @@ const GENERATION_IMAGE_VERSION_KEYS = [
|
|
|
10
10
|
"zeebeAnalytics",
|
|
11
11
|
"elasticSearchCurator"
|
|
12
12
|
];
|
|
13
|
+
const GENERATION_ENV_VARS_KEYS = [
|
|
14
|
+
"operateEnvVars",
|
|
15
|
+
"zeebeBrokerEnvVars",
|
|
16
|
+
"zeebeGatewayEnvVars",
|
|
17
|
+
"tasklistEnvVars",
|
|
18
|
+
"optimizeEnvVars",
|
|
19
|
+
"zeebeAnalyticsEnvVars",
|
|
20
|
+
"connectorBridgeEnvVars",
|
|
21
|
+
"gatewayEnvVars"
|
|
22
|
+
];
|
|
13
23
|
const MutableThings = [
|
|
14
24
|
"zeebeAnalytics",
|
|
15
25
|
"elasticSearchCurator",
|
|
@@ -25,6 +35,7 @@ const MutableThings = [
|
|
|
25
35
|
const AllThings = ImmutableThings.concat(MutableThings);
|
|
26
36
|
export {
|
|
27
37
|
AllThings,
|
|
38
|
+
GENERATION_ENV_VARS_KEYS,
|
|
28
39
|
GENERATION_IMAGE_VERSION_KEYS,
|
|
29
40
|
ImmutableThings,
|
|
30
41
|
MutableThings
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/types/C8ClusterComponentVersions.type.ts"],
|
|
4
|
-
"sourcesContent": ["/*\n * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH\n * under one or more contributor license agreements. Licensed under a commercial license.\n * You may not use this file except in compliance with the commercial license.\n */\n\nexport interface ZeebeClusterVersionsDto\n extends MutableZeebeClusterVersionsDto,\n ImmutableZeebeClusterVersionsDto {}\n\nexport interface ImmutableZeebeClusterVersionsDto {\n // make sure if you modify something here to also modify ImmutableThings\n elasticSearchOss: string\n // Optional on 8.9+ generations where tasklist + operate run inside the\n // zeebe gateway pod and no longer ship as standalone images.\n operate?: string\n zeebe: string\n // Optional on 8.9+ generations \u2014 see operate above.\n tasklist?: string\n optimize: string\n connectorBridge?: string\n}\nexport const ImmutableThings: string[] = [\n 'elasticSearchOss',\n 'operate',\n 'zeebe',\n 'tasklist',\n 'optimize',\n 'connectorBridge',\n]\n\nexport interface MutableZeebeClusterVersionsDto {\n // make sure if you modify something here to also modify MutableThings\n zeebeAnalytics?: string\n elasticSearchCurator?: string\n operateEnvVars?: string\n zeebeBrokerEnvVars?: string\n zeebeGatewayEnvVars?: string\n tasklistEnvVars?: string\n optimizeEnvVars?: string\n zeebeAnalyticsEnvVars?: string\n connectorBridgeEnvVars?: string\n gatewayEnvVars?: string\n}\n/**\n * The mutable versions that are image references.\n *\n * The approval use case `change-generation-versions` writes these two and\n * never an env var field.
|
|
5
|
-
"mappings": "AAsBO,MAAM,kBAA4B;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;
|
|
4
|
+
"sourcesContent": ["/*\n * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH\n * under one or more contributor license agreements. Licensed under a commercial license.\n * You may not use this file except in compliance with the commercial license.\n */\n\nexport interface ZeebeClusterVersionsDto\n extends MutableZeebeClusterVersionsDto,\n ImmutableZeebeClusterVersionsDto {}\n\nexport interface ImmutableZeebeClusterVersionsDto {\n // make sure if you modify something here to also modify ImmutableThings\n elasticSearchOss: string\n // Optional on 8.9+ generations where tasklist + operate run inside the\n // zeebe gateway pod and no longer ship as standalone images.\n operate?: string\n zeebe: string\n // Optional on 8.9+ generations \u2014 see operate above.\n tasklist?: string\n optimize: string\n connectorBridge?: string\n}\nexport const ImmutableThings: string[] = [\n 'elasticSearchOss',\n 'operate',\n 'zeebe',\n 'tasklist',\n 'optimize',\n 'connectorBridge',\n]\n\nexport interface MutableZeebeClusterVersionsDto {\n // make sure if you modify something here to also modify MutableThings\n zeebeAnalytics?: string\n elasticSearchCurator?: string\n operateEnvVars?: string\n zeebeBrokerEnvVars?: string\n zeebeGatewayEnvVars?: string\n tasklistEnvVars?: string\n optimizeEnvVars?: string\n zeebeAnalyticsEnvVars?: string\n connectorBridgeEnvVars?: string\n gatewayEnvVars?: string\n}\n/**\n * The mutable versions that are image references.\n *\n * The approval use case `change-generation-versions` writes these two and\n * never an env var field. The env var fields go through `edit-generation`\n * (see `GENERATION_ENV_VARS_KEYS`).\n */\nexport const GENERATION_IMAGE_VERSION_KEYS = [\n 'zeebeAnalytics',\n 'elasticSearchCurator',\n] as const\n\nexport type GenerationImageVersionsDto = Pick<\n MutableZeebeClusterVersionsDto,\n (typeof GENERATION_IMAGE_VERSION_KEYS)[number]\n>\n\n/**\n * The mutable versions that are env var text, one field for each component.\n *\n * The approval use case `edit-generation` writes these and the name. An env\n * var text can hold a secret. Thus a request shows the text on its detail\n * page only, and never in a row of the list, a log line or the result.\n */\nexport const GENERATION_ENV_VARS_KEYS = [\n 'operateEnvVars',\n 'zeebeBrokerEnvVars',\n 'zeebeGatewayEnvVars',\n 'tasklistEnvVars',\n 'optimizeEnvVars',\n 'zeebeAnalyticsEnvVars',\n 'connectorBridgeEnvVars',\n 'gatewayEnvVars',\n] as const\n\nexport type GenerationEnvVarsKey = (typeof GENERATION_ENV_VARS_KEYS)[number]\n\nexport type GenerationEnvVarsDto = Pick<\n MutableZeebeClusterVersionsDto,\n GenerationEnvVarsKey\n>\n\nexport const MutableThings: string[] = [\n 'zeebeAnalytics',\n 'elasticSearchCurator',\n 'operateEnvVars',\n 'zeebeBrokerEnvVars',\n 'zeebeGatewayEnvVars',\n 'tasklistEnvVars',\n 'optimizeEnvVars',\n 'zeebeAnalyticsEnvVars',\n 'connectorBridgeEnvVars',\n 'gatewayEnvVars',\n]\nexport const AllThings: string[] = ImmutableThings.concat(MutableThings)\n"],
|
|
5
|
+
"mappings": "AAsBO,MAAM,kBAA4B;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAsBO,MAAM,gCAAgC;AAAA,EAC3C;AAAA,EACA;AACF;AAcO,MAAM,2BAA2B;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AASO,MAAM,gBAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AACO,MAAM,YAAsB,gBAAgB,OAAO,aAAa;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns scheduled leader rebalancing on for a stage: the Control row in the
|
|
3
|
+
* Settings & flags card, the admin route, and `spec.zeebe.rebalancing` in the
|
|
4
|
+
* generated spec. Turn it on for a whole stage only, where the operator
|
|
5
|
+
* carries camunda-operator#6128 and #6130. console-backend reads it with no
|
|
6
|
+
* org or email. An older operator prunes the field, so the setting would do
|
|
7
|
+
* nothing.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ZEEBE_REBALANCING_FEATURE_FLAG = "console.zeebeRebalancing";
|
|
10
|
+
export interface ZeebeRebalancingValidationErrors {
|
|
11
|
+
enabled?: string;
|
|
12
|
+
schedule?: string;
|
|
13
|
+
timeZone?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Checks a rebalancing setting before Console writes it to
|
|
17
|
+
* `spec.zeebe.rebalancing`. The operator webhook is the final check. This one
|
|
18
|
+
* gives a field message before the write, and Control and the route use it
|
|
19
|
+
* both, so they give the same answer.
|
|
20
|
+
*
|
|
21
|
+
* The webhook checks the schedule and the time zone also when rebalancing is
|
|
22
|
+
* off, because a later enable keeps them. Thus this check does the same.
|
|
23
|
+
*
|
|
24
|
+
* This check never accepts a value that the webhook refuses, because such a
|
|
25
|
+
* value blocks the resume of a sleeping cluster. It refuses a few values that
|
|
26
|
+
* the webhook takes: `?` in a cron field (write `*`), and a time zone alias
|
|
27
|
+
* such as `Etc/UTC` (write `UTC`). A stricter check is safe, and the Control
|
|
28
|
+
* editor offers neither.
|
|
29
|
+
*
|
|
30
|
+
* Returns `undefined` when the setting is valid.
|
|
31
|
+
*/
|
|
32
|
+
export declare function validateZeebeRebalancing(setting: unknown): ZeebeRebalancingValidationErrors | undefined;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { validateCronSchedule } from "./cronSchedule.utils.js";
|
|
2
|
+
const ZEEBE_REBALANCING_FEATURE_FLAG = "console.zeebeRebalancing";
|
|
3
|
+
function validateZeebeRebalancing(setting) {
|
|
4
|
+
if (typeof setting !== "object" || setting === null) {
|
|
5
|
+
return { enabled: "Send an object with enabled, schedule and timeZone" };
|
|
6
|
+
}
|
|
7
|
+
const { enabled, schedule, timeZone } = setting;
|
|
8
|
+
const errors = {};
|
|
9
|
+
if (typeof enabled !== "boolean") {
|
|
10
|
+
errors.enabled = "enabled must be true or false";
|
|
11
|
+
}
|
|
12
|
+
const scheduleText = typeof schedule === "string" ? schedule.trim() : "";
|
|
13
|
+
if (schedule !== void 0 && typeof schedule !== "string") {
|
|
14
|
+
errors.schedule = "schedule must be a string";
|
|
15
|
+
} else if (enabled === true && scheduleText === "") {
|
|
16
|
+
errors.schedule = "Enter a schedule to turn rebalancing on";
|
|
17
|
+
} else if (typeof schedule === "string" && scheduleText !== "") {
|
|
18
|
+
const result = validateCronSchedule(schedule, { minIntervalMinutes: 0 });
|
|
19
|
+
if (result.valid === false) {
|
|
20
|
+
errors.schedule = result.reason;
|
|
21
|
+
} else if (usesSundayAsSeven(scheduleText)) {
|
|
22
|
+
errors.schedule = "Write Sunday as 0 in the day of week field. The operator refuses 7";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (timeZone !== void 0) {
|
|
26
|
+
if (typeof timeZone !== "string" || !isIanaTimeZone(timeZone)) {
|
|
27
|
+
errors.timeZone = "Choose an IANA time zone, for example Europe/Berlin";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return Object.keys(errors).length > 0 ? errors : void 0;
|
|
31
|
+
}
|
|
32
|
+
function usesSundayAsSeven(schedule) {
|
|
33
|
+
const dayOfWeek = schedule.split(/\s+/u)[4] ?? "";
|
|
34
|
+
return dayOfWeek.split(",").some(
|
|
35
|
+
(item) => (item.split("/")[0] ?? "").split("-").some((endpoint) => /^\d+$/u.test(endpoint) && Number(endpoint) === 7)
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
const TIME_ZONES_THAT_INTL_RENAMES = /* @__PURE__ */ new Set([
|
|
39
|
+
"Africa/Asmara",
|
|
40
|
+
"America/Argentina/Buenos_Aires",
|
|
41
|
+
"America/Argentina/Catamarca",
|
|
42
|
+
"America/Argentina/Cordoba",
|
|
43
|
+
"America/Argentina/Jujuy",
|
|
44
|
+
"America/Argentina/Mendoza",
|
|
45
|
+
"America/Atikokan",
|
|
46
|
+
"America/Indiana/Indianapolis",
|
|
47
|
+
"America/Kentucky/Louisville",
|
|
48
|
+
"America/Nuuk",
|
|
49
|
+
"Asia/Ho_Chi_Minh",
|
|
50
|
+
"Asia/Kathmandu",
|
|
51
|
+
"Asia/Kolkata",
|
|
52
|
+
"Asia/Yangon",
|
|
53
|
+
"Atlantic/Faroe",
|
|
54
|
+
"Europe/Kyiv",
|
|
55
|
+
"Pacific/Chuuk",
|
|
56
|
+
"Pacific/Kanton",
|
|
57
|
+
"Pacific/Pohnpei"
|
|
58
|
+
]);
|
|
59
|
+
function isIanaTimeZone(timeZone) {
|
|
60
|
+
if (!/^[A-Za-z][A-Za-z0-9_+-]*(\/[A-Za-z0-9_+-]+)*$/u.test(timeZone)) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
if (timeZone.toLowerCase() === "local") {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
if (TIME_ZONES_THAT_INTL_RENAMES.has(timeZone)) {
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
try {
|
|
70
|
+
return new Intl.DateTimeFormat("en-US", { timeZone }).resolvedOptions().timeZone === timeZone;
|
|
71
|
+
} catch {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
ZEEBE_REBALANCING_FEATURE_FLAG,
|
|
77
|
+
validateZeebeRebalancing
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=zeebeRebalancing.utils.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/utils/zeebeRebalancing.utils.ts"],
|
|
4
|
+
"sourcesContent": ["/*\n * Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH\n * under one or more contributor license agreements. Licensed under a commercial license.\n * You may not use this file except in compliance with the commercial license.\n */\n\nimport { validateCronSchedule } from './cronSchedule.utils.js'\n\n/**\n * Turns scheduled leader rebalancing on for a stage: the Control row in the\n * Settings & flags card, the admin route, and `spec.zeebe.rebalancing` in the\n * generated spec. Turn it on for a whole stage only, where the operator\n * carries camunda-operator#6128 and #6130. console-backend reads it with no\n * org or email. An older operator prunes the field, so the setting would do\n * nothing.\n */\nexport const ZEEBE_REBALANCING_FEATURE_FLAG = 'console.zeebeRebalancing'\n\nexport interface ZeebeRebalancingValidationErrors {\n enabled?: string\n schedule?: string\n timeZone?: string\n}\n\n/**\n * Checks a rebalancing setting before Console writes it to\n * `spec.zeebe.rebalancing`. The operator webhook is the final check. This one\n * gives a field message before the write, and Control and the route use it\n * both, so they give the same answer.\n *\n * The webhook checks the schedule and the time zone also when rebalancing is\n * off, because a later enable keeps them. Thus this check does the same.\n *\n * This check never accepts a value that the webhook refuses, because such a\n * value blocks the resume of a sleeping cluster. It refuses a few values that\n * the webhook takes: `?` in a cron field (write `*`), and a time zone alias\n * such as `Etc/UTC` (write `UTC`). A stricter check is safe, and the Control\n * editor offers neither.\n *\n * Returns `undefined` when the setting is valid.\n */\nexport function validateZeebeRebalancing(\n setting: unknown,\n): ZeebeRebalancingValidationErrors | undefined {\n if (typeof setting !== 'object' || setting === null) {\n return { enabled: 'Send an object with enabled, schedule and timeZone' }\n }\n const { enabled, schedule, timeZone } = setting as Record<string, unknown>\n const errors: ZeebeRebalancingValidationErrors = {}\n\n if (typeof enabled !== 'boolean') {\n errors.enabled = 'enabled must be true or false'\n }\n\n const scheduleText = typeof schedule === 'string' ? schedule.trim() : ''\n if (schedule !== undefined && typeof schedule !== 'string') {\n errors.schedule = 'schedule must be a string'\n } else if (enabled === true && scheduleText === '') {\n errors.schedule = 'Enter a schedule to turn rebalancing on'\n } else if (typeof schedule === 'string' && scheduleText !== '') {\n // A five-field count rejects `@daily` and `@every`, and a field check\n // rejects a `TZ=` or `CRON_TZ=` prefix. Rebalancing has no minimum gap.\n const result = validateCronSchedule(schedule, { minIntervalMinutes: 0 })\n if (result.valid === false) {\n // The reason of the parser names the field and the value. Rebalancing\n // passes no minimum gap, so the reason is never about backups.\n errors.schedule = result.reason\n } else if (usesSundayAsSeven(scheduleText)) {\n errors.schedule =\n 'Write Sunday as 0 in the day of week field. The operator refuses 7'\n }\n }\n\n if (timeZone !== undefined) {\n if (typeof timeZone !== 'string' || !isIanaTimeZone(timeZone)) {\n errors.timeZone = 'Choose an IANA time zone, for example Europe/Berlin'\n }\n }\n\n return Object.keys(errors).length > 0 ? errors : undefined\n}\n\n/**\n * `validateCronSchedule` takes `7` for Sunday, as cron does. The parser of the\n * operator webhook (robfig/cron) takes day of week 0 to 6 only, so `7` in a\n * value or a range of that field is refused here, also with a leading zero\n * (`07`). A step value is not a day, so it stays.\n */\nfunction usesSundayAsSeven(schedule: string): boolean {\n const dayOfWeek = schedule.split(/\\s+/u)[4] ?? ''\n return dayOfWeek\n .split(',')\n .some((item) =>\n (item.split('/')[0] ?? '')\n .split('-')\n .some((endpoint) => /^\\d+$/u.test(endpoint) && Number(endpoint) === 7),\n )\n}\n\n/**\n * Current IANA names that `Intl` of Node gives back as an older alias, for\n * example `Asia/Kolkata` as `Asia/Calcutta`. Go knows both names. A browser\n * can offer either name in the Control select: Chrome gives the old one,\n * Firefox the current one. The list comes from tzdata 2026c and Node 24.\n */\nconst TIME_ZONES_THAT_INTL_RENAMES = new Set([\n 'Africa/Asmara',\n 'America/Argentina/Buenos_Aires',\n 'America/Argentina/Catamarca',\n 'America/Argentina/Cordoba',\n 'America/Argentina/Jujuy',\n 'America/Argentina/Mendoza',\n 'America/Atikokan',\n 'America/Indiana/Indianapolis',\n 'America/Kentucky/Louisville',\n 'America/Nuuk',\n 'Asia/Ho_Chi_Minh',\n 'Asia/Kathmandu',\n 'Asia/Kolkata',\n 'Asia/Yangon',\n 'Atlantic/Faroe',\n 'Europe/Kyiv',\n 'Pacific/Chuuk',\n 'Pacific/Kanton',\n 'Pacific/Pohnpei',\n])\n\n/**\n * The webhook loads the name with Go's `time.LoadLocation`, which is exact:\n * it refuses another case (`europe/berlin`), an offset (`+01:00`), `Local`,\n * and an empty string. `Intl` takes all of these but the last two, so a name\n * counts only when it is a region name and `Intl` gives it back unchanged, or\n * when it is in `TIME_ZONES_THAT_INTL_RENAMES` with the same case. `Intl`\n * ignores case, so a name in another case is never in the list or unchanged.\n * This refuses some aliases that Go takes, such as `Etc/UTC` (write `UTC`).\n * A stricter check is safe.\n */\nfunction isIanaTimeZone(timeZone: string): boolean {\n if (!/^[A-Za-z][A-Za-z0-9_+-]*(\\/[A-Za-z0-9_+-]+)*$/u.test(timeZone)) {\n return false\n }\n if (timeZone.toLowerCase() === 'local') {\n return false\n }\n if (TIME_ZONES_THAT_INTL_RENAMES.has(timeZone)) {\n return true\n }\n try {\n return (\n new Intl.DateTimeFormat('en-US', { timeZone }).resolvedOptions()\n .timeZone === timeZone\n )\n } catch {\n return false\n }\n}\n"],
|
|
5
|
+
"mappings": "AAMA,SAAS,4BAA4B;AAU9B,MAAM,iCAAiC;AAyBvC,SAAS,yBACd,SAC8C;AAC9C,MAAI,OAAO,YAAY,YAAY,YAAY,MAAM;AACnD,WAAO,EAAE,SAAS,qDAAqD;AAAA,EACzE;AACA,QAAM,EAAE,SAAS,UAAU,SAAS,IAAI;AACxC,QAAM,SAA2C,CAAC;AAElD,MAAI,OAAO,YAAY,WAAW;AAChC,WAAO,UAAU;AAAA,EACnB;AAEA,QAAM,eAAe,OAAO,aAAa,WAAW,SAAS,KAAK,IAAI;AACtE,MAAI,aAAa,UAAa,OAAO,aAAa,UAAU;AAC1D,WAAO,WAAW;AAAA,EACpB,WAAW,YAAY,QAAQ,iBAAiB,IAAI;AAClD,WAAO,WAAW;AAAA,EACpB,WAAW,OAAO,aAAa,YAAY,iBAAiB,IAAI;AAG9D,UAAM,SAAS,qBAAqB,UAAU,EAAE,oBAAoB,EAAE,CAAC;AACvE,QAAI,OAAO,UAAU,OAAO;AAG1B,aAAO,WAAW,OAAO;AAAA,IAC3B,WAAW,kBAAkB,YAAY,GAAG;AAC1C,aAAO,WACL;AAAA,IACJ;AAAA,EACF;AAEA,MAAI,aAAa,QAAW;AAC1B,QAAI,OAAO,aAAa,YAAY,CAAC,eAAe,QAAQ,GAAG;AAC7D,aAAO,WAAW;AAAA,IACpB;AAAA,EACF;AAEA,SAAO,OAAO,KAAK,MAAM,EAAE,SAAS,IAAI,SAAS;AACnD;AAQA,SAAS,kBAAkB,UAA2B;AACpD,QAAM,YAAY,SAAS,MAAM,MAAM,EAAE,CAAC,KAAK;AAC/C,SAAO,UACJ,MAAM,GAAG,EACT;AAAA,IAAK,CAAC,UACJ,KAAK,MAAM,GAAG,EAAE,CAAC,KAAK,IACpB,MAAM,GAAG,EACT,KAAK,CAAC,aAAa,SAAS,KAAK,QAAQ,KAAK,OAAO,QAAQ,MAAM,CAAC;AAAA,EACzE;AACJ;AAQA,MAAM,+BAA+B,oBAAI,IAAI;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAYD,SAAS,eAAe,UAA2B;AACjD,MAAI,CAAC,iDAAiD,KAAK,QAAQ,GAAG;AACpE,WAAO;AAAA,EACT;AACA,MAAI,SAAS,YAAY,MAAM,SAAS;AACtC,WAAO;AAAA,EACT;AACA,MAAI,6BAA6B,IAAI,QAAQ,GAAG;AAC9C,WAAO;AAAA,EACT;AACA,MAAI;AACF,WACE,IAAI,KAAK,eAAe,SAAS,EAAE,SAAS,CAAC,EAAE,gBAAgB,EAC5D,aAAa;AAAA,EAEpB,QAAQ;AACN,WAAO;AAAA,EACT;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED