apify-client 3.0.0-beta.12 → 3.0.0-beta.121

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +23 -2
  2. package/dist/apify_api_error.d.ts +14 -28
  3. package/dist/apify_api_error.js +33 -23
  4. package/dist/apify_client.d.ts +125 -10
  5. package/dist/apify_client.js +133 -48
  6. package/dist/apify_client_error.d.ts +10 -0
  7. package/dist/apify_client_error.js +10 -0
  8. package/dist/axios.d.ts +2 -0
  9. package/dist/axios.js +1 -0
  10. package/dist/base/api_client.d.ts +7 -7
  11. package/dist/base/api_client.js +36 -36
  12. package/dist/base/resource_client.d.ts +13 -8
  13. package/dist/base/resource_client.js +60 -34
  14. package/dist/base/resource_collection_client.d.ts +12 -4
  15. package/dist/base/resource_collection_client.js +34 -11
  16. package/dist/body_parser.d.ts +4 -5
  17. package/dist/body_parser.js +19 -26
  18. package/dist/bundle.js +41 -35
  19. package/dist/bundle.js.map +1 -1
  20. package/dist/generated/api.d.ts +3266 -1103
  21. package/dist/generated/schemas.d.ts +2608 -1079
  22. package/dist/generated/schemas.js +600 -239
  23. package/dist/http_clients/axios.d.ts +80 -0
  24. package/dist/http_clients/axios.js +165 -0
  25. package/dist/http_clients/base.d.ts +402 -0
  26. package/dist/http_clients/base.js +680 -0
  27. package/dist/http_clients/fetch.d.ts +53 -0
  28. package/dist/http_clients/fetch.js +219 -0
  29. package/dist/http_clients/index.d.ts +4 -0
  30. package/dist/http_clients/index.js +2 -0
  31. package/dist/http_compressors/base.d.ts +40 -0
  32. package/dist/http_compressors/base.js +9 -0
  33. package/dist/http_compressors/brotli.d.ts +33 -0
  34. package/dist/http_compressors/brotli.js +39 -0
  35. package/dist/http_compressors/gzip.d.ts +33 -0
  36. package/dist/http_compressors/gzip.js +39 -0
  37. package/dist/http_compressors/index.d.ts +8 -0
  38. package/dist/http_compressors/index.js +3 -0
  39. package/dist/http_compressors/resolve.d.ts +24 -0
  40. package/dist/http_compressors/resolve.js +30 -0
  41. package/dist/http_compressors/zstd.d.ts +34 -0
  42. package/dist/http_compressors/zstd.js +43 -0
  43. package/dist/index.d.ts +7 -2
  44. package/dist/index.js +5 -1
  45. package/dist/invalid_response_body_error.d.ts +14 -0
  46. package/dist/invalid_response_body_error.js +18 -0
  47. package/dist/models.d.ts +177 -240
  48. package/dist/models.js +6 -4
  49. package/dist/resource_clients/actor.d.ts +94 -23
  50. package/dist/resource_clients/actor.js +129 -43
  51. package/dist/resource_clients/actor_collection.d.ts +15 -11
  52. package/dist/resource_clients/actor_collection.js +9 -3
  53. package/dist/resource_clients/actor_env_var.d.ts +11 -4
  54. package/dist/resource_clients/actor_env_var.js +16 -6
  55. package/dist/resource_clients/actor_env_var_collection.d.ts +9 -4
  56. package/dist/resource_clients/actor_env_var_collection.js +11 -4
  57. package/dist/resource_clients/actor_server.d.ts +149 -0
  58. package/dist/resource_clients/actor_server.js +195 -0
  59. package/dist/resource_clients/actor_version.d.ts +19 -6
  60. package/dist/resource_clients/actor_version.js +19 -8
  61. package/dist/resource_clients/actor_version_collection.d.ts +10 -4
  62. package/dist/resource_clients/actor_version_collection.js +12 -4
  63. package/dist/resource_clients/build.d.ts +18 -7
  64. package/dist/resource_clients/build.js +33 -15
  65. package/dist/resource_clients/build_collection.d.ts +7 -5
  66. package/dist/resource_clients/build_collection.js +4 -1
  67. package/dist/resource_clients/dataset.d.ts +83 -37
  68. package/dist/resource_clients/dataset.js +99 -109
  69. package/dist/resource_clients/dataset_collection.d.ts +10 -6
  70. package/dist/resource_clients/dataset_collection.js +13 -2
  71. package/dist/resource_clients/key_value_store.d.ts +108 -33
  72. package/dist/resource_clients/key_value_store.js +134 -53
  73. package/dist/resource_clients/key_value_store_collection.d.ts +10 -6
  74. package/dist/resource_clients/key_value_store_collection.js +13 -2
  75. package/dist/resource_clients/log.d.ts +41 -25
  76. package/dist/resource_clients/log.js +142 -65
  77. package/dist/resource_clients/request_queue.d.ts +77 -31
  78. package/dist/resource_clients/request_queue.js +178 -93
  79. package/dist/resource_clients/request_queue_collection.d.ts +9 -5
  80. package/dist/resource_clients/request_queue_collection.js +9 -3
  81. package/dist/resource_clients/run.d.ts +119 -29
  82. package/dist/resource_clients/run.js +188 -49
  83. package/dist/resource_clients/run_collection.d.ts +5 -3
  84. package/dist/resource_clients/run_collection.js +4 -1
  85. package/dist/resource_clients/schedule.d.ts +15 -6
  86. package/dist/resource_clients/schedule.js +25 -10
  87. package/dist/resource_clients/schedule_collection.d.ts +6 -2
  88. package/dist/resource_clients/schedule_collection.js +9 -3
  89. package/dist/resource_clients/store_collection.d.ts +10 -4
  90. package/dist/resource_clients/store_collection.js +4 -1
  91. package/dist/resource_clients/task.d.ts +35 -12
  92. package/dist/resource_clients/task.js +75 -35
  93. package/dist/resource_clients/task_collection.d.ts +9 -5
  94. package/dist/resource_clients/task_collection.js +9 -3
  95. package/dist/resource_clients/user.d.ts +16 -7
  96. package/dist/resource_clients/user.js +34 -16
  97. package/dist/resource_clients/webhook.d.ts +16 -7
  98. package/dist/resource_clients/webhook.js +25 -10
  99. package/dist/resource_clients/webhook_collection.d.ts +8 -4
  100. package/dist/resource_clients/webhook_collection.js +9 -3
  101. package/dist/resource_clients/webhook_dispatch.d.ts +4 -1
  102. package/dist/resource_clients/webhook_dispatch.js +7 -2
  103. package/dist/resource_clients/webhook_dispatch_collection.d.ts +3 -1
  104. package/dist/resource_clients/webhook_dispatch_collection.js +4 -1
  105. package/dist/response_validation_error.d.ts +2 -1
  106. package/dist/response_validation_error.js +2 -1
  107. package/dist/runtime/node.d.ts +6 -0
  108. package/dist/runtime/node.js +111 -0
  109. package/dist/runtime/types.d.ts +82 -0
  110. package/dist/runtime/types.js +1 -0
  111. package/dist/runtime/web.d.ts +5 -0
  112. package/dist/runtime/web.js +60 -0
  113. package/dist/schemas.d.ts +372 -4
  114. package/dist/schemas.js +26 -4
  115. package/dist/statistics.d.ts +1 -6
  116. package/dist/statistics.js +2 -2
  117. package/dist/timeouts.d.ts +84 -0
  118. package/dist/timeouts.js +37 -0
  119. package/dist/timezones.d.ts +1 -1
  120. package/dist/utils.d.ts +115 -61
  121. package/dist/utils.js +220 -161
  122. package/dist/wait_for_resources.d.ts +8 -0
  123. package/dist/wait_for_resources.js +39 -0
  124. package/package.json +53 -38
  125. package/dist/http_client.d.ts +0 -88
  126. package/dist/http_client.js +0 -255
  127. package/dist/interceptors.d.ts +0 -19
  128. package/dist/interceptors.js +0 -105
package/dist/schemas.js CHANGED
@@ -1,15 +1,37 @@
1
1
  /**
2
2
  * The schemas the resource clients validate API responses with.
3
3
  *
4
- * Today these are exactly the generated ones. The module still exists as the one place where a generated
5
- * schema is widened when the API is known to return something the specification does not describe, so a
6
- * documented deviation never sends a resource client reaching into `./generated` directly. An override
4
+ * Most of these are the generated ones. This module is the one place where a generated schema is widened
5
+ * when the API is known to return something the specification does not describe, so a documented deviation
6
+ * never sends a resource client reaching into `./generated` directly. An override
7
7
  * declared here shadows the generated export of the same name and takes the same form, a `lazySchema()` thunk
8
8
  * built on the generated schema it replaces. Every schema that embeds an overridden one has to be rebuilt on
9
- * top of it, and `spec_guards.ts` checks that each override still accepts what the specification describes,
9
+ * top of it, and `spec_guards.ts` checks that each override still produces what the specification describes,
10
10
  * so one cannot narrow by accident.
11
11
  *
12
12
  * Spec gaps need no override: the generated objects are loose, so a field the specification omits passes
13
13
  * through. Neither do client narrowings: a schema only ever accepts more than the published type.
14
14
  */
15
+ import { z } from 'zod';
16
+ import * as generated from './generated/schemas.js';
17
+ import { lazySchema } from './lazy_schema.js';
15
18
  export * from './generated/schemas.js';
19
+ /** The API returns `actVersion.buildTag` as `null` for some builds, which the specification types as a string. */
20
+ export const Build = lazySchema(() => {
21
+ const generatedBuild = generated.Build();
22
+ return generatedBuild.extend({
23
+ actVersion: generatedBuild.shape.actVersion
24
+ .unwrap()
25
+ .extend({ buildTag: z.string().nullable().optional() })
26
+ .optional(),
27
+ });
28
+ });
29
+ /** Response containing Actor build data. */
30
+ export const BuildResponse = lazySchema(() => generated.BuildResponse().extend({ data: Build() }));
31
+ /**
32
+ * The API returns `uiState` as `null` once an API update has changed the schedule's `cronExpression` or `timezone`,
33
+ * which the specification types as an object.
34
+ */
35
+ export const Schedule = lazySchema(() => generated.Schedule().extend({ uiState: generated.ScheduleUiState().nullable().optional() }));
36
+ /** Response containing schedule data. */
37
+ export const ScheduleResponse = lazySchema(() => generated.ScheduleResponse().extend({ data: Schedule() }));
@@ -1,4 +1,5 @@
1
1
  export declare class Statistics {
2
+ #private;
2
3
  /**
3
4
  * Number of Apify client function calls
4
5
  */
@@ -13,10 +14,4 @@ export declare class Statistics {
13
14
  */
14
15
  rateLimitErrors: number[];
15
16
  addRateLimitError(attempt: number): void;
16
- /**
17
- * Removes the necessity to pre-initialize array with correct
18
- * number of zeroes by dynamically filling the empty indexes
19
- * when necessary.
20
- */
21
- private _fillBlanksWithZeroes;
22
17
  }
@@ -20,7 +20,7 @@ export class Statistics {
20
20
  // attempt is never 0,
21
21
  // but we don't want index 0 empty
22
22
  const index = attempt - 1;
23
- this._fillBlanksWithZeroes(index);
23
+ this.#fillBlanksWithZeroes(index);
24
24
  this.rateLimitErrors[index]++;
25
25
  }
26
26
  /**
@@ -28,7 +28,7 @@ export class Statistics {
28
28
  * number of zeroes by dynamically filling the empty indexes
29
29
  * when necessary.
30
30
  */
31
- _fillBlanksWithZeroes(inclusiveIndex) {
31
+ #fillBlanksWithZeroes(inclusiveIndex) {
32
32
  if (this.rateLimitErrors.length <= inclusiveIndex) {
33
33
  for (let k = 0; k <= inclusiveIndex; k++) {
34
34
  if (typeof this.rateLimitErrors[k] !== 'number') {
@@ -0,0 +1,84 @@
1
+ import { z } from 'zod';
2
+ /** Default duration of the `short` timeout tier, in seconds. */
3
+ export declare const DEFAULT_TIMEOUT_SHORT_SECS = 5;
4
+ /** Default duration of the `medium` timeout tier, in seconds. */
5
+ export declare const DEFAULT_TIMEOUT_MEDIUM_SECS = 30;
6
+ /** Default duration of the `long` timeout tier, in seconds. */
7
+ export declare const DEFAULT_TIMEOUT_LONG_SECS = 360;
8
+ /** Default cap on the timeout of a single request attempt, in seconds. */
9
+ export declare const DEFAULT_TIMEOUT_MAX_SECS = 360;
10
+ /**
11
+ * Preconfigured timeout tiers. Every client method picks the tier that fits the expected duration of its
12
+ * request: `short` for simple metadata reads and writes, `medium` for listing, batch and trigger operations,
13
+ * `long` for downloads, uploads and streaming. The duration of each tier is set on the {@link ApifyClient}
14
+ * constructor.
15
+ */
16
+ export type TimeoutTier = 'short' | 'medium' | 'long';
17
+ /**
18
+ * Timeout of a single API request.
19
+ *
20
+ * A tier name picks the duration configured for that tier on the {@link ApifyClient} constructor, a number is
21
+ * an exact duration in seconds, and `'noTimeout'` lets the request run for as long as it takes. A tier or an
22
+ * explicit duration above `timeoutMaxSecs` is capped at it, and the client logs a warning when that happens.
23
+ * The timeout applies to each attempt separately, and doubles with every retry up to the same cap.
24
+ *
25
+ * With `'noTimeout'` the client never aborts the request, so a connection that stalls is not retried either.
26
+ */
27
+ export type Timeout = TimeoutTier | 'noTimeout' | number;
28
+ /**
29
+ * Options shared by every method that sends a request to the API.
30
+ */
31
+ export interface TimeoutOptions {
32
+ /**
33
+ * Timeout for the API request: a tier name (`'short'`, `'medium'`, `'long'`), a number of seconds, or
34
+ * `'noTimeout'`. Defaults to the tier the method is assigned, which its documentation names.
35
+ */
36
+ timeoutSecs?: Timeout;
37
+ /**
38
+ * Aborts the method. Once the signal aborts, the request in flight is ended, no retry or further poll
39
+ * follows, and the method rejects with the signal's `reason`.
40
+ */
41
+ signal?: AbortSignal;
42
+ }
43
+ /**
44
+ * Schema of {@link Timeout}, optional, for the methods that validate `timeoutSecs` on its own.
45
+ * @internal
46
+ */
47
+ export declare const optionalTimeoutSchema: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
48
+ long: "long";
49
+ medium: "medium";
50
+ noTimeout: "noTimeout";
51
+ short: "short";
52
+ }>, z.ZodNumber]>>;
53
+ /**
54
+ * Schema of {@link TimeoutOptions.signal}, for the methods that validate `signal` on its own.
55
+ * @internal
56
+ */
57
+ export declare const optionalSignalSchema: z.ZodOptional<z.ZodInstanceOf<AbortSignal>>;
58
+ /**
59
+ * Schema shape of {@link TimeoutOptions}, to spread into the option schema of every method that sends a
60
+ * request. One copy stops it drifting from the interface.
61
+ * @internal
62
+ */
63
+ export declare const timeoutOptionsShape: {
64
+ timeoutSecs: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
65
+ long: "long";
66
+ medium: "medium";
67
+ noTimeout: "noTimeout";
68
+ short: "short";
69
+ }>, z.ZodNumber]>>;
70
+ signal: z.ZodOptional<z.ZodInstanceOf<AbortSignal>>;
71
+ };
72
+ /**
73
+ * Schema of {@link TimeoutOptions}, for the methods that take no other option.
74
+ * @internal
75
+ */
76
+ export declare const timeoutOptionsSchema: z.ZodObject<{
77
+ timeoutSecs: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
78
+ long: "long";
79
+ medium: "medium";
80
+ noTimeout: "noTimeout";
81
+ short: "short";
82
+ }>, z.ZodNumber]>>;
83
+ signal: z.ZodOptional<z.ZodInstanceOf<AbortSignal>>;
84
+ }, z.core.$strict>;
@@ -0,0 +1,37 @@
1
+ import { z } from 'zod';
2
+ /** Default duration of the `short` timeout tier, in seconds. */
3
+ export const DEFAULT_TIMEOUT_SHORT_SECS = 5;
4
+ /** Default duration of the `medium` timeout tier, in seconds. */
5
+ export const DEFAULT_TIMEOUT_MEDIUM_SECS = 30;
6
+ /** Default duration of the `long` timeout tier, in seconds. */
7
+ export const DEFAULT_TIMEOUT_LONG_SECS = 360;
8
+ /** Default cap on the timeout of a single request attempt, in seconds. */
9
+ export const DEFAULT_TIMEOUT_MAX_SECS = 360;
10
+ /**
11
+ * Schema of {@link Timeout}. Zero is rejected on purpose - `'noTimeout'` is the explicit way to run without one.
12
+ */
13
+ const timeoutSchema = z.union([z.enum(['short', 'medium', 'long', 'noTimeout']), z.number().positive()]);
14
+ /**
15
+ * Schema of {@link Timeout}, optional, for the methods that validate `timeoutSecs` on its own.
16
+ * @internal
17
+ */
18
+ export const optionalTimeoutSchema = timeoutSchema.optional();
19
+ /**
20
+ * Schema of {@link TimeoutOptions.signal}, for the methods that validate `signal` on its own.
21
+ * @internal
22
+ */
23
+ export const optionalSignalSchema = z.instanceof(AbortSignal).optional();
24
+ /**
25
+ * Schema shape of {@link TimeoutOptions}, to spread into the option schema of every method that sends a
26
+ * request. One copy stops it drifting from the interface.
27
+ * @internal
28
+ */
29
+ export const timeoutOptionsShape = {
30
+ timeoutSecs: optionalTimeoutSchema,
31
+ signal: optionalSignalSchema,
32
+ };
33
+ /**
34
+ * Schema of {@link TimeoutOptions}, for the methods that take no other option.
35
+ * @internal
36
+ */
37
+ export const timeoutOptionsSchema = z.strictObject(timeoutOptionsShape);
@@ -1,3 +1,3 @@
1
- declare const timezones: readonly ["Africa/Abidjan", "Africa/Accra", "Africa/Addis_Ababa", "Africa/Algiers", "Africa/Asmara", "Africa/Asmera", "Africa/Bamako", "Africa/Bangui", "Africa/Banjul", "Africa/Bissau", "Africa/Blantyre", "Africa/Brazzaville", "Africa/Bujumbura", "Africa/Cairo", "Africa/Casablanca", "Africa/Ceuta", "Africa/Conakry", "Africa/Dakar", "Africa/Dar_es_Salaam", "Africa/Djibouti", "Africa/Douala", "Africa/El_Aaiun", "Africa/Freetown", "Africa/Gaborone", "Africa/Harare", "Africa/Johannesburg", "Africa/Juba", "Africa/Kampala", "Africa/Khartoum", "Africa/Kigali", "Africa/Kinshasa", "Africa/Lagos", "Africa/Libreville", "Africa/Lome", "Africa/Luanda", "Africa/Lubumbashi", "Africa/Lusaka", "Africa/Malabo", "Africa/Maputo", "Africa/Maseru", "Africa/Mbabane", "Africa/Mogadishu", "Africa/Monrovia", "Africa/Nairobi", "Africa/Ndjamena", "Africa/Niamey", "Africa/Nouakchott", "Africa/Ouagadougou", "Africa/Porto-Novo", "Africa/Sao_Tome", "Africa/Timbuktu", "Africa/Tripoli", "Africa/Tunis", "Africa/Windhoek", "America/Adak", "America/Anchorage", "America/Anguilla", "America/Antigua", "America/Araguaina", "America/Argentina/Buenos_Aires", "America/Argentina/Catamarca", "America/Argentina/ComodRivadavia", "America/Argentina/Cordoba", "America/Argentina/Jujuy", "America/Argentina/La_Rioja", "America/Argentina/Mendoza", "America/Argentina/Rio_Gallegos", "America/Argentina/Salta", "America/Argentina/San_Juan", "America/Argentina/San_Luis", "America/Argentina/Tucuman", "America/Argentina/Ushuaia", "America/Aruba", "America/Asuncion", "America/Atikokan", "America/Atka", "America/Bahia", "America/Bahia_Banderas", "America/Barbados", "America/Belem", "America/Belize", "America/Blanc-Sablon", "America/Boa_Vista", "America/Bogota", "America/Boise", "America/Buenos_Aires", "America/Cambridge_Bay", "America/Campo_Grande", "America/Cancun", "America/Caracas", "America/Catamarca", "America/Cayenne", "America/Cayman", "America/Chicago", "America/Chihuahua", "America/Coral_Harbour", "America/Cordoba", "America/Costa_Rica", "America/Creston", "America/Cuiaba", "America/Curacao", "America/Danmarkshavn", "America/Dawson", "America/Dawson_Creek", "America/Denver", "America/Detroit", "America/Dominica", "America/Edmonton", "America/Eirunepe", "America/El_Salvador", "America/Ensenada", "America/Fort_Nelson", "America/Fort_Wayne", "America/Fortaleza", "America/Glace_Bay", "America/Godthab", "America/Goose_Bay", "America/Grand_Turk", "America/Grenada", "America/Guadeloupe", "America/Guatemala", "America/Guayaquil", "America/Guyana", "America/Halifax", "America/Havana", "America/Hermosillo", "America/Indiana/Indianapolis", "America/Indiana/Knox", "America/Indiana/Marengo", "America/Indiana/Petersburg", "America/Indiana/Tell_City", "America/Indiana/Vevay", "America/Indiana/Vincennes", "America/Indiana/Winamac", "America/Indianapolis", "America/Inuvik", "America/Iqaluit", "America/Jamaica", "America/Jujuy", "America/Juneau", "America/Kentucky/Louisville", "America/Kentucky/Monticello", "America/Knox_IN", "America/Kralendijk", "America/La_Paz", "America/Lima", "America/Los_Angeles", "America/Louisville", "America/Lower_Princes", "America/Maceio", "America/Managua", "America/Manaus", "America/Marigot", "America/Martinique", "America/Matamoros", "America/Mazatlan", "America/Mendoza", "America/Menominee", "America/Merida", "America/Metlakatla", "America/Mexico_City", "America/Miquelon", "America/Moncton", "America/Monterrey", "America/Montevideo", "America/Montreal", "America/Montserrat", "America/Nassau", "America/New_York", "America/Nipigon", "America/Nome", "America/Noronha", "America/North_Dakota/Beulah", "America/North_Dakota/Center", "America/North_Dakota/New_Salem", "America/Nuuk", "America/Ojinaga", "America/Panama", "America/Pangnirtung", "America/Paramaribo", "America/Phoenix", "America/Port-au-Prince", "America/Port_of_Spain", "America/Porto_Acre", "America/Porto_Velho", "America/Puerto_Rico", "America/Punta_Arenas", "America/Rainy_River", "America/Rankin_Inlet", "America/Recife", "America/Regina", "America/Resolute", "America/Rio_Branco", "America/Rosario", "America/Santa_Isabel", "America/Santarem", "America/Santiago", "America/Santo_Domingo", "America/Sao_Paulo", "America/Scoresbysund", "America/Shiprock", "America/Sitka", "America/St_Barthelemy", "America/St_Johns", "America/St_Kitts", "America/St_Lucia", "America/St_Thomas", "America/St_Vincent", "America/Swift_Current", "America/Tegucigalpa", "America/Thule", "America/Thunder_Bay", "America/Tijuana", "America/Toronto", "America/Tortola", "America/Vancouver", "America/Virgin", "America/Whitehorse", "America/Winnipeg", "America/Yakutat", "America/Yellowknife", "Antarctica/Casey", "Antarctica/Davis", "Antarctica/DumontDUrville", "Antarctica/Macquarie", "Antarctica/Mawson", "Antarctica/McMurdo", "Antarctica/Palmer", "Antarctica/Rothera", "Antarctica/South_Pole", "Antarctica/Syowa", "Antarctica/Troll", "Antarctica/Vostok", "Arctic/Longyearbyen", "Asia/Aden", "Asia/Almaty", "Asia/Amman", "Asia/Anadyr", "Asia/Aqtau", "Asia/Aqtobe", "Asia/Ashgabat", "Asia/Ashkhabad", "Asia/Atyrau", "Asia/Baghdad", "Asia/Bahrain", "Asia/Baku", "Asia/Bangkok", "Asia/Barnaul", "Asia/Beirut", "Asia/Bishkek", "Asia/Brunei", "Asia/Calcutta", "Asia/Chita", "Asia/Choibalsan", "Asia/Chongqing", "Asia/Chungking", "Asia/Colombo", "Asia/Dacca", "Asia/Damascus", "Asia/Dhaka", "Asia/Dili", "Asia/Dubai", "Asia/Dushanbe", "Asia/Famagusta", "Asia/Gaza", "Asia/Harbin", "Asia/Hebron", "Asia/Ho_Chi_Minh", "Asia/Hong_Kong", "Asia/Hovd", "Asia/Irkutsk", "Asia/Istanbul", "Asia/Jakarta", "Asia/Jayapura", "Asia/Jerusalem", "Asia/Kabul", "Asia/Kamchatka", "Asia/Karachi", "Asia/Kashgar", "Asia/Kathmandu", "Asia/Katmandu", "Asia/Khandyga", "Asia/Kolkata", "Asia/Krasnoyarsk", "Asia/Kuala_Lumpur", "Asia/Kuching", "Asia/Kuwait", "Asia/Macao", "Asia/Macau", "Asia/Magadan", "Asia/Makassar", "Asia/Manila", "Asia/Muscat", "Asia/Nicosia", "Asia/Novokuznetsk", "Asia/Novosibirsk", "Asia/Omsk", "Asia/Oral", "Asia/Phnom_Penh", "Asia/Pontianak", "Asia/Pyongyang", "Asia/Qatar", "Asia/Qostanay", "Asia/Qyzylorda", "Asia/Rangoon", "Asia/Riyadh", "Asia/Saigon", "Asia/Sakhalin", "Asia/Samarkand", "Asia/Seoul", "Asia/Shanghai", "Asia/Singapore", "Asia/Srednekolymsk", "Asia/Taipei", "Asia/Tashkent", "Asia/Tbilisi", "Asia/Tehran", "Asia/Tel_Aviv", "Asia/Thimbu", "Asia/Thimphu", "Asia/Tokyo", "Asia/Tomsk", "Asia/Ujung_Pandang", "Asia/Ulaanbaatar", "Asia/Ulan_Bator", "Asia/Urumqi", "Asia/Ust-Nera", "Asia/Vientiane", "Asia/Vladivostok", "Asia/Yakutsk", "Asia/Yangon", "Asia/Yekaterinburg", "Asia/Yerevan", "Atlantic/Azores", "Atlantic/Bermuda", "Atlantic/Canary", "Atlantic/Cape_Verde", "Atlantic/Faeroe", "Atlantic/Faroe", "Atlantic/Jan_Mayen", "Atlantic/Madeira", "Atlantic/Reykjavik", "Atlantic/South_Georgia", "Atlantic/St_Helena", "Atlantic/Stanley", "Australia/ACT", "Australia/Adelaide", "Australia/Brisbane", "Australia/Broken_Hill", "Australia/Canberra", "Australia/Currie", "Australia/Darwin", "Australia/Eucla", "Australia/Hobart", "Australia/LHI", "Australia/Lindeman", "Australia/Lord_Howe", "Australia/Melbourne", "Australia/NSW", "Australia/North", "Australia/Perth", "Australia/Queensland", "Australia/South", "Australia/Sydney", "Australia/Tasmania", "Australia/Victoria", "Australia/West", "Australia/Yancowinna", "Brazil/Acre", "Brazil/DeNoronha", "Brazil/East", "Brazil/West", "CET", "CST6CDT", "Canada/Atlantic", "Canada/Central", "Canada/Eastern", "Canada/Mountain", "Canada/Newfoundland", "Canada/Pacific", "Canada/Saskatchewan", "Canada/Yukon", "Chile/Continental", "Chile/EasterIsland", "Cuba", "EET", "EST", "EST5EDT", "Egypt", "Eire", "Etc/GMT", "Etc/GMT+0", "Etc/GMT+1", "Etc/GMT+10", "Etc/GMT+11", "Etc/GMT+12", "Etc/GMT+2", "Etc/GMT+3", "Etc/GMT+4", "Etc/GMT+5", "Etc/GMT+6", "Etc/GMT+7", "Etc/GMT+8", "Etc/GMT+9", "Etc/GMT-0", "Etc/GMT-1", "Etc/GMT-10", "Etc/GMT-11", "Etc/GMT-12", "Etc/GMT-13", "Etc/GMT-14", "Etc/GMT-2", "Etc/GMT-3", "Etc/GMT-4", "Etc/GMT-5", "Etc/GMT-6", "Etc/GMT-7", "Etc/GMT-8", "Etc/GMT-9", "Etc/GMT0", "Etc/Greenwich", "Etc/UCT", "Etc/UTC", "Etc/Universal", "Etc/Zulu", "Europe/Amsterdam", "Europe/Andorra", "Europe/Astrakhan", "Europe/Athens", "Europe/Belfast", "Europe/Belgrade", "Europe/Berlin", "Europe/Bratislava", "Europe/Brussels", "Europe/Bucharest", "Europe/Budapest", "Europe/Busingen", "Europe/Chisinau", "Europe/Copenhagen", "Europe/Dublin", "Europe/Gibraltar", "Europe/Guernsey", "Europe/Helsinki", "Europe/Isle_of_Man", "Europe/Istanbul", "Europe/Jersey", "Europe/Kaliningrad", "Europe/Kiev", "Europe/Kirov", "Europe/Lisbon", "Europe/Ljubljana", "Europe/London", "Europe/Luxembourg", "Europe/Madrid", "Europe/Malta", "Europe/Mariehamn", "Europe/Minsk", "Europe/Monaco", "Europe/Moscow", "Europe/Nicosia", "Europe/Oslo", "Europe/Paris", "Europe/Podgorica", "Europe/Prague", "Europe/Riga", "Europe/Rome", "Europe/Samara", "Europe/San_Marino", "Europe/Sarajevo", "Europe/Saratov", "Europe/Simferopol", "Europe/Skopje", "Europe/Sofia", "Europe/Stockholm", "Europe/Tallinn", "Europe/Tirane", "Europe/Tiraspol", "Europe/Ulyanovsk", "Europe/Uzhgorod", "Europe/Vaduz", "Europe/Vatican", "Europe/Vienna", "Europe/Vilnius", "Europe/Volgograd", "Europe/Warsaw", "Europe/Zagreb", "Europe/Zaporozhye", "Europe/Zurich", "GB", "GB-Eire", "GMT", "GMT+0", "GMT-0", "GMT0", "Greenwich", "HST", "Hongkong", "Iceland", "Indian/Antananarivo", "Indian/Chagos", "Indian/Christmas", "Indian/Cocos", "Indian/Comoro", "Indian/Kerguelen", "Indian/Mahe", "Indian/Maldives", "Indian/Mauritius", "Indian/Mayotte", "Indian/Reunion", "Iran", "Israel", "Jamaica", "Japan", "Kwajalein", "Libya", "MET", "MST", "MST7MDT", "Mexico/BajaNorte", "Mexico/BajaSur", "Mexico/General", "NZ", "NZ-CHAT", "Navajo", "PRC", "PST8PDT", "Pacific/Apia", "Pacific/Auckland", "Pacific/Bougainville", "Pacific/Chatham", "Pacific/Chuuk", "Pacific/Easter", "Pacific/Efate", "Pacific/Enderbury", "Pacific/Fakaofo", "Pacific/Fiji", "Pacific/Funafuti", "Pacific/Galapagos", "Pacific/Gambier", "Pacific/Guadalcanal", "Pacific/Guam", "Pacific/Honolulu", "Pacific/Johnston", "Pacific/Kiritimati", "Pacific/Kosrae", "Pacific/Kwajalein", "Pacific/Majuro", "Pacific/Marquesas", "Pacific/Midway", "Pacific/Nauru", "Pacific/Niue", "Pacific/Norfolk", "Pacific/Noumea", "Pacific/Pago_Pago", "Pacific/Palau", "Pacific/Pitcairn", "Pacific/Pohnpei", "Pacific/Ponape", "Pacific/Port_Moresby", "Pacific/Rarotonga", "Pacific/Saipan", "Pacific/Samoa", "Pacific/Tahiti", "Pacific/Tarawa", "Pacific/Tongatapu", "Pacific/Truk", "Pacific/Wake", "Pacific/Wallis", "Pacific/Yap", "Poland", "Portugal", "ROC", "ROK", "Singapore", "Turkey", "UCT", "US/Alaska", "US/Aleutian", "US/Arizona", "US/Central", "US/East-Indiana", "US/Eastern", "US/Hawaii", "US/Indiana-Starke", "US/Michigan", "US/Mountain", "US/Pacific", "US/Samoa", "UTC", "Universal", "W-SU", "WET", "Zulu"];
1
+ declare const timezones: readonly ['Africa/Abidjan', 'Africa/Accra', 'Africa/Addis_Ababa', 'Africa/Algiers', 'Africa/Asmara', 'Africa/Asmera', 'Africa/Bamako', 'Africa/Bangui', 'Africa/Banjul', 'Africa/Bissau', 'Africa/Blantyre', 'Africa/Brazzaville', 'Africa/Bujumbura', 'Africa/Cairo', 'Africa/Casablanca', 'Africa/Ceuta', 'Africa/Conakry', 'Africa/Dakar', 'Africa/Dar_es_Salaam', 'Africa/Djibouti', 'Africa/Douala', 'Africa/El_Aaiun', 'Africa/Freetown', 'Africa/Gaborone', 'Africa/Harare', 'Africa/Johannesburg', 'Africa/Juba', 'Africa/Kampala', 'Africa/Khartoum', 'Africa/Kigali', 'Africa/Kinshasa', 'Africa/Lagos', 'Africa/Libreville', 'Africa/Lome', 'Africa/Luanda', 'Africa/Lubumbashi', 'Africa/Lusaka', 'Africa/Malabo', 'Africa/Maputo', 'Africa/Maseru', 'Africa/Mbabane', 'Africa/Mogadishu', 'Africa/Monrovia', 'Africa/Nairobi', 'Africa/Ndjamena', 'Africa/Niamey', 'Africa/Nouakchott', 'Africa/Ouagadougou', 'Africa/Porto-Novo', 'Africa/Sao_Tome', 'Africa/Timbuktu', 'Africa/Tripoli', 'Africa/Tunis', 'Africa/Windhoek', 'America/Adak', 'America/Anchorage', 'America/Anguilla', 'America/Antigua', 'America/Araguaina', 'America/Argentina/Buenos_Aires', 'America/Argentina/Catamarca', 'America/Argentina/ComodRivadavia', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/La_Rioja', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Salta', 'America/Argentina/San_Juan', 'America/Argentina/San_Luis', 'America/Argentina/Tucuman', 'America/Argentina/Ushuaia', 'America/Aruba', 'America/Asuncion', 'America/Atikokan', 'America/Atka', 'America/Bahia', 'America/Bahia_Banderas', 'America/Barbados', 'America/Belem', 'America/Belize', 'America/Blanc-Sablon', 'America/Boa_Vista', 'America/Bogota', 'America/Boise', 'America/Buenos_Aires', 'America/Cambridge_Bay', 'America/Campo_Grande', 'America/Cancun', 'America/Caracas', 'America/Catamarca', 'America/Cayenne', 'America/Cayman', 'America/Chicago', 'America/Chihuahua', 'America/Coral_Harbour', 'America/Cordoba', 'America/Costa_Rica', 'America/Creston', 'America/Cuiaba', 'America/Curacao', 'America/Danmarkshavn', 'America/Dawson', 'America/Dawson_Creek', 'America/Denver', 'America/Detroit', 'America/Dominica', 'America/Edmonton', 'America/Eirunepe', 'America/El_Salvador', 'America/Ensenada', 'America/Fort_Nelson', 'America/Fort_Wayne', 'America/Fortaleza', 'America/Glace_Bay', 'America/Godthab', 'America/Goose_Bay', 'America/Grand_Turk', 'America/Grenada', 'America/Guadeloupe', 'America/Guatemala', 'America/Guayaquil', 'America/Guyana', 'America/Halifax', 'America/Havana', 'America/Hermosillo', 'America/Indiana/Indianapolis', 'America/Indiana/Knox', 'America/Indiana/Marengo', 'America/Indiana/Petersburg', 'America/Indiana/Tell_City', 'America/Indiana/Vevay', 'America/Indiana/Vincennes', 'America/Indiana/Winamac', 'America/Indianapolis', 'America/Inuvik', 'America/Iqaluit', 'America/Jamaica', 'America/Jujuy', 'America/Juneau', 'America/Kentucky/Louisville', 'America/Kentucky/Monticello', 'America/Knox_IN', 'America/Kralendijk', 'America/La_Paz', 'America/Lima', 'America/Los_Angeles', 'America/Louisville', 'America/Lower_Princes', 'America/Maceio', 'America/Managua', 'America/Manaus', 'America/Marigot', 'America/Martinique', 'America/Matamoros', 'America/Mazatlan', 'America/Mendoza', 'America/Menominee', 'America/Merida', 'America/Metlakatla', 'America/Mexico_City', 'America/Miquelon', 'America/Moncton', 'America/Monterrey', 'America/Montevideo', 'America/Montreal', 'America/Montserrat', 'America/Nassau', 'America/New_York', 'America/Nipigon', 'America/Nome', 'America/Noronha', 'America/North_Dakota/Beulah', 'America/North_Dakota/Center', 'America/North_Dakota/New_Salem', 'America/Nuuk', 'America/Ojinaga', 'America/Panama', 'America/Pangnirtung', 'America/Paramaribo', 'America/Phoenix', 'America/Port-au-Prince', 'America/Port_of_Spain', 'America/Porto_Acre', 'America/Porto_Velho', 'America/Puerto_Rico', 'America/Punta_Arenas', 'America/Rainy_River', 'America/Rankin_Inlet', 'America/Recife', 'America/Regina', 'America/Resolute', 'America/Rio_Branco', 'America/Rosario', 'America/Santa_Isabel', 'America/Santarem', 'America/Santiago', 'America/Santo_Domingo', 'America/Sao_Paulo', 'America/Scoresbysund', 'America/Shiprock', 'America/Sitka', 'America/St_Barthelemy', 'America/St_Johns', 'America/St_Kitts', 'America/St_Lucia', 'America/St_Thomas', 'America/St_Vincent', 'America/Swift_Current', 'America/Tegucigalpa', 'America/Thule', 'America/Thunder_Bay', 'America/Tijuana', 'America/Toronto', 'America/Tortola', 'America/Vancouver', 'America/Virgin', 'America/Whitehorse', 'America/Winnipeg', 'America/Yakutat', 'America/Yellowknife', 'Antarctica/Casey', 'Antarctica/Davis', 'Antarctica/DumontDUrville', 'Antarctica/Macquarie', 'Antarctica/Mawson', 'Antarctica/McMurdo', 'Antarctica/Palmer', 'Antarctica/Rothera', 'Antarctica/South_Pole', 'Antarctica/Syowa', 'Antarctica/Troll', 'Antarctica/Vostok', 'Arctic/Longyearbyen', 'Asia/Aden', 'Asia/Almaty', 'Asia/Amman', 'Asia/Anadyr', 'Asia/Aqtau', 'Asia/Aqtobe', 'Asia/Ashgabat', 'Asia/Ashkhabad', 'Asia/Atyrau', 'Asia/Baghdad', 'Asia/Bahrain', 'Asia/Baku', 'Asia/Bangkok', 'Asia/Barnaul', 'Asia/Beirut', 'Asia/Bishkek', 'Asia/Brunei', 'Asia/Calcutta', 'Asia/Chita', 'Asia/Choibalsan', 'Asia/Chongqing', 'Asia/Chungking', 'Asia/Colombo', 'Asia/Dacca', 'Asia/Damascus', 'Asia/Dhaka', 'Asia/Dili', 'Asia/Dubai', 'Asia/Dushanbe', 'Asia/Famagusta', 'Asia/Gaza', 'Asia/Harbin', 'Asia/Hebron', 'Asia/Ho_Chi_Minh', 'Asia/Hong_Kong', 'Asia/Hovd', 'Asia/Irkutsk', 'Asia/Istanbul', 'Asia/Jakarta', 'Asia/Jayapura', 'Asia/Jerusalem', 'Asia/Kabul', 'Asia/Kamchatka', 'Asia/Karachi', 'Asia/Kashgar', 'Asia/Kathmandu', 'Asia/Katmandu', 'Asia/Khandyga', 'Asia/Kolkata', 'Asia/Krasnoyarsk', 'Asia/Kuala_Lumpur', 'Asia/Kuching', 'Asia/Kuwait', 'Asia/Macao', 'Asia/Macau', 'Asia/Magadan', 'Asia/Makassar', 'Asia/Manila', 'Asia/Muscat', 'Asia/Nicosia', 'Asia/Novokuznetsk', 'Asia/Novosibirsk', 'Asia/Omsk', 'Asia/Oral', 'Asia/Phnom_Penh', 'Asia/Pontianak', 'Asia/Pyongyang', 'Asia/Qatar', 'Asia/Qostanay', 'Asia/Qyzylorda', 'Asia/Rangoon', 'Asia/Riyadh', 'Asia/Saigon', 'Asia/Sakhalin', 'Asia/Samarkand', 'Asia/Seoul', 'Asia/Shanghai', 'Asia/Singapore', 'Asia/Srednekolymsk', 'Asia/Taipei', 'Asia/Tashkent', 'Asia/Tbilisi', 'Asia/Tehran', 'Asia/Tel_Aviv', 'Asia/Thimbu', 'Asia/Thimphu', 'Asia/Tokyo', 'Asia/Tomsk', 'Asia/Ujung_Pandang', 'Asia/Ulaanbaatar', 'Asia/Ulan_Bator', 'Asia/Urumqi', 'Asia/Ust-Nera', 'Asia/Vientiane', 'Asia/Vladivostok', 'Asia/Yakutsk', 'Asia/Yangon', 'Asia/Yekaterinburg', 'Asia/Yerevan', 'Atlantic/Azores', 'Atlantic/Bermuda', 'Atlantic/Canary', 'Atlantic/Cape_Verde', 'Atlantic/Faeroe', 'Atlantic/Faroe', 'Atlantic/Jan_Mayen', 'Atlantic/Madeira', 'Atlantic/Reykjavik', 'Atlantic/South_Georgia', 'Atlantic/St_Helena', 'Atlantic/Stanley', 'Australia/ACT', 'Australia/Adelaide', 'Australia/Brisbane', 'Australia/Broken_Hill', 'Australia/Canberra', 'Australia/Currie', 'Australia/Darwin', 'Australia/Eucla', 'Australia/Hobart', 'Australia/LHI', 'Australia/Lindeman', 'Australia/Lord_Howe', 'Australia/Melbourne', 'Australia/NSW', 'Australia/North', 'Australia/Perth', 'Australia/Queensland', 'Australia/South', 'Australia/Sydney', 'Australia/Tasmania', 'Australia/Victoria', 'Australia/West', 'Australia/Yancowinna', 'Brazil/Acre', 'Brazil/DeNoronha', 'Brazil/East', 'Brazil/West', 'CET', 'CST6CDT', 'Canada/Atlantic', 'Canada/Central', 'Canada/Eastern', 'Canada/Mountain', 'Canada/Newfoundland', 'Canada/Pacific', 'Canada/Saskatchewan', 'Canada/Yukon', 'Chile/Continental', 'Chile/EasterIsland', 'Cuba', 'EET', 'EST', 'EST5EDT', 'Egypt', 'Eire', 'Etc/GMT', 'Etc/GMT+0', 'Etc/GMT+1', 'Etc/GMT+10', 'Etc/GMT+11', 'Etc/GMT+12', 'Etc/GMT+2', 'Etc/GMT+3', 'Etc/GMT+4', 'Etc/GMT+5', 'Etc/GMT+6', 'Etc/GMT+7', 'Etc/GMT+8', 'Etc/GMT+9', 'Etc/GMT-0', 'Etc/GMT-1', 'Etc/GMT-10', 'Etc/GMT-11', 'Etc/GMT-12', 'Etc/GMT-13', 'Etc/GMT-14', 'Etc/GMT-2', 'Etc/GMT-3', 'Etc/GMT-4', 'Etc/GMT-5', 'Etc/GMT-6', 'Etc/GMT-7', 'Etc/GMT-8', 'Etc/GMT-9', 'Etc/GMT0', 'Etc/Greenwich', 'Etc/UCT', 'Etc/UTC', 'Etc/Universal', 'Etc/Zulu', 'Europe/Amsterdam', 'Europe/Andorra', 'Europe/Astrakhan', 'Europe/Athens', 'Europe/Belfast', 'Europe/Belgrade', 'Europe/Berlin', 'Europe/Bratislava', 'Europe/Brussels', 'Europe/Bucharest', 'Europe/Budapest', 'Europe/Busingen', 'Europe/Chisinau', 'Europe/Copenhagen', 'Europe/Dublin', 'Europe/Gibraltar', 'Europe/Guernsey', 'Europe/Helsinki', 'Europe/Isle_of_Man', 'Europe/Istanbul', 'Europe/Jersey', 'Europe/Kaliningrad', 'Europe/Kiev', 'Europe/Kirov', 'Europe/Lisbon', 'Europe/Ljubljana', 'Europe/London', 'Europe/Luxembourg', 'Europe/Madrid', 'Europe/Malta', 'Europe/Mariehamn', 'Europe/Minsk', 'Europe/Monaco', 'Europe/Moscow', 'Europe/Nicosia', 'Europe/Oslo', 'Europe/Paris', 'Europe/Podgorica', 'Europe/Prague', 'Europe/Riga', 'Europe/Rome', 'Europe/Samara', 'Europe/San_Marino', 'Europe/Sarajevo', 'Europe/Saratov', 'Europe/Simferopol', 'Europe/Skopje', 'Europe/Sofia', 'Europe/Stockholm', 'Europe/Tallinn', 'Europe/Tirane', 'Europe/Tiraspol', 'Europe/Ulyanovsk', 'Europe/Uzhgorod', 'Europe/Vaduz', 'Europe/Vatican', 'Europe/Vienna', 'Europe/Vilnius', 'Europe/Volgograd', 'Europe/Warsaw', 'Europe/Zagreb', 'Europe/Zaporozhye', 'Europe/Zurich', 'GB', 'GB-Eire', 'GMT', 'GMT+0', 'GMT-0', 'GMT0', 'Greenwich', 'HST', 'Hongkong', 'Iceland', 'Indian/Antananarivo', 'Indian/Chagos', 'Indian/Christmas', 'Indian/Cocos', 'Indian/Comoro', 'Indian/Kerguelen', 'Indian/Mahe', 'Indian/Maldives', 'Indian/Mauritius', 'Indian/Mayotte', 'Indian/Reunion', 'Iran', 'Israel', 'Jamaica', 'Japan', 'Kwajalein', 'Libya', 'MET', 'MST', 'MST7MDT', 'Mexico/BajaNorte', 'Mexico/BajaSur', 'Mexico/General', 'NZ', 'NZ-CHAT', 'Navajo', 'PRC', 'PST8PDT', 'Pacific/Apia', 'Pacific/Auckland', 'Pacific/Bougainville', 'Pacific/Chatham', 'Pacific/Chuuk', 'Pacific/Easter', 'Pacific/Efate', 'Pacific/Enderbury', 'Pacific/Fakaofo', 'Pacific/Fiji', 'Pacific/Funafuti', 'Pacific/Galapagos', 'Pacific/Gambier', 'Pacific/Guadalcanal', 'Pacific/Guam', 'Pacific/Honolulu', 'Pacific/Johnston', 'Pacific/Kiritimati', 'Pacific/Kosrae', 'Pacific/Kwajalein', 'Pacific/Majuro', 'Pacific/Marquesas', 'Pacific/Midway', 'Pacific/Nauru', 'Pacific/Niue', 'Pacific/Norfolk', 'Pacific/Noumea', 'Pacific/Pago_Pago', 'Pacific/Palau', 'Pacific/Pitcairn', 'Pacific/Pohnpei', 'Pacific/Ponape', 'Pacific/Port_Moresby', 'Pacific/Rarotonga', 'Pacific/Saipan', 'Pacific/Samoa', 'Pacific/Tahiti', 'Pacific/Tarawa', 'Pacific/Tongatapu', 'Pacific/Truk', 'Pacific/Wake', 'Pacific/Wallis', 'Pacific/Yap', 'Poland', 'Portugal', 'ROC', 'ROK', 'Singapore', 'Turkey', 'UCT', 'US/Alaska', 'US/Aleutian', 'US/Arizona', 'US/Central', 'US/East-Indiana', 'US/Eastern', 'US/Hawaii', 'US/Indiana-Starke', 'US/Michigan', 'US/Mountain', 'US/Pacific', 'US/Samoa', 'UTC', 'Universal', 'W-SU', 'WET', 'Zulu'];
2
2
  export type Timezone = (typeof timezones)[number];
3
3
  export {};
package/dist/utils.d.ts CHANGED
@@ -1,11 +1,18 @@
1
1
  import type { Readable } from 'node:stream';
2
- import type { JsonValue, TypedArray } from 'type-fest';
3
2
  import { z } from 'zod';
4
3
  import type { ApifyApiError } from './apify_api_error.js';
5
4
  import { parseArgument } from '@apify/validations';
6
- import type { ApifyResponse } from './http_client.js';
7
- import type { RequestQueueClientListRequestsOptions, RequestQueueClientListRequestsResult } from './resource_clients/request_queue.js';
5
+ import type { ApifyResponse } from './http_clients/index.js';
6
+ import type { ListOfRequests, RequestQueueClientListRequestsOptions } from './resource_clients/request_queue.js';
8
7
  import type { WebhookUpdateData } from './resource_clients/webhook.js';
8
+ /**
9
+ * Smallest request body, in bytes, that is worth compressing. A smaller body already fits in a single network
10
+ * packet, so compressing it costs CPU time without saving a round trip, and the compression format itself can
11
+ * make it larger.
12
+ * @internal
13
+ */
14
+ export declare const MIN_COMPRESS_BYTES = 1024;
15
+ export declare const version: any;
9
16
  export { parseArgument };
10
17
  /**
11
18
  * Accepts any non-null, non-array object as a predicate for `z.custom()`.
@@ -20,29 +27,16 @@ export declare function isNonArrayObject(value: unknown): value is Record<string
20
27
  */
21
28
  export declare const anyObjectSchema: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>;
22
29
  /**
23
- * Generic interface for objects that may contain a data property.
24
- *
25
- * @template R - The type of the data property
26
- */
27
- export interface MaybeData<R> {
28
- data?: R;
29
- }
30
- /**
31
- * Turns a JSON API response into the value a resource method returns: unwraps the `data` envelope, converts the
32
- * date fields and validates the result against `schema`, one of the schemas generated from the OpenAPI
33
- * specification. The validated copy is what callers get, so it is the schema's output -- unknown fields and unknown
34
- * enum values included, since the schemas let both through, and URL fields normalized, since `z.url()` hands back
35
- * the parsed URL's serialization.
30
+ * Turns a JSON API response into the value a resource method returns: unwraps the `data` envelope and validates the
31
+ * result against `schema`, one of the schemas generated from the OpenAPI specification. The validated copy is what
32
+ * callers get, so it is the schema's output -- unknown fields and unknown enum values included, since the schemas let
33
+ * both through, date-time fields turned into `Date` objects, and URL fields normalized, since `z.url()` hands back the
34
+ * parsed URL's serialization.
36
35
  *
37
36
  * Throws {@link ResponseValidationError} when the response does not match the specification.
38
37
  * @internal
39
38
  */
40
- export declare function parseResponse<R>(response: ApifyResponse, schema: z.ZodType, shouldParseField?: ((key: string) => boolean) | null): R;
41
- /**
42
- * Returns object's 'data' property or throws if parameter is not an object,
43
- * or an object without a 'data' property.
44
- */
45
- export declare function pluckData<R>(obj: MaybeData<R>): R;
39
+ export declare function parseResponse<R>(response: ApifyResponse, schema: z.ZodType): R;
46
40
  /**
47
41
  * Swallows a 404 Not Found API error and rethrows anything else.
48
42
  */
@@ -55,66 +49,86 @@ export declare function catchNotFoundOrThrow(err: ApifyApiError): void;
55
49
  * @internal
56
50
  */
57
51
  export declare function catchNotFoundForResourceOrThrow(err: ApifyApiError, resourceId: string | undefined): void;
58
- type ReturnJsonValue = string | number | boolean | null | Date | ReturnJsonObject | ReturnJsonArray;
59
- type ReturnJsonObject = {
60
- [Key in string]?: ReturnJsonValue;
61
- };
62
- type ReturnJsonArray = ReturnJsonValue[];
63
52
  /**
64
- * Traverses JSON structure and converts fields that end with "At" to a Date object (fields such as "modifiedAt" or
65
- * "createdAt").
66
- *
67
- * If you want parse other fields as well, you can provide a custom matcher function shouldParseField(). This
68
- * admittedly awkward approach allows this function to be reused for various purposes without introducing potential
69
- * breaking changes.
53
+ * Helper function that converts array of webhooks to base64 string
54
+ */
55
+ export declare function stringifyWebhooksToBase64(webhooks?: readonly WebhookUpdateData[]): string | undefined;
56
+ /**
57
+ * Encodes bytes as base64. `btoa()` takes a binary string, and the bytes are turned into one in slices,
58
+ * because spreading them all into a single `String.fromCharCode()` call overflows the argument limit on
59
+ * inputs of a few tens of kilobytes.
60
+ */
61
+ export declare function bytesToBase64(bytes: Uint8Array): string;
62
+ /**
63
+ * Concatenates byte chunks into one array.
64
+ */
65
+ export declare function concatBytes(chunks: Uint8Array[]): Uint8Array;
66
+ /**
67
+ * Views a request body as bytes: a string is UTF-8 encoded, binary values are viewed in place. Anything else
68
+ * - a stream, a `Blob`, form data - is `undefined`.
69
+ * @internal
70
+ */
71
+ export declare function toBytes(value: unknown): Uint8Array | undefined;
72
+ /**
73
+ * Decides whether a request body with the given content type is worth compressing.
70
74
  *
71
- * If the field cannot be converted to Date, it is left as is.
75
+ * Images, audio, video and archives already carry their own compression. Running them through brotli, gzip or
76
+ * zstd burns CPU, holds a second full copy of the body in memory, and usually produces output slightly larger than
77
+ * the input. Formats that are raw despite such a media type, for example `image/bmp` or `audio/wav`, are still
78
+ * compressed. A body with no content type is assumed to be compressible.
79
+ * @internal
72
80
  */
73
- export declare function parseDateFields(input: JsonValue, shouldParseField?: ((key: string) => boolean) | null, depth?: number): ReturnJsonValue;
81
+ export declare function isCompressibleContentType(contentType?: string): boolean;
74
82
  /**
75
- * Helper function that converts array of webhooks to base64 string
83
+ * Reads an environment variable, on runtimes that have them.
76
84
  */
77
- export declare function stringifyWebhooksToBase64(webhooks?: readonly WebhookUpdateData[]): string | undefined;
78
- export interface CompressedValue {
79
- data: Buffer;
80
- encoding: 'br' | 'gzip';
81
- }
85
+ export declare function getEnv(name: string): string | undefined;
82
86
  /**
83
- * Compress the passed value using brotli, falling back to gzip. Returns undefined if the data is
84
- * too small / wrong type, or if neither algorithm is available.
87
+ * Returns the UTF-8 byte length of a string.
85
88
  */
86
- export declare function maybeCompressValue(value: unknown): Promise<CompressedValue | undefined>;
89
+ export declare function utf8ByteLength(value: string): number;
87
90
  /**
88
- * Helper function slice the items from array to fit the max byte length.
91
+ * Splits JSON-serialized items into consecutive batches of at most `maxCount` items, each of which fits into a JSON
92
+ * array body - the items joined by commas between brackets - of at most `maxByteLength` bytes. The `byteLength` of an
93
+ * item is the UTF-8 byte length of its serialization. An item too large for a body of its own still gets one, so a
94
+ * caller that cannot send such an item has to reject it beforehand.
89
95
  */
90
- export declare function sliceArrayByByteLength<T>(array: T[], maxByteLength: number, startIndex: number): T[];
91
- export declare function isNode(): boolean;
96
+ export declare function splitIntoJsonArrayBatches<T extends {
97
+ byteLength: number;
98
+ }>(items: readonly T[], { maxCount, maxByteLength }: {
99
+ maxCount: number;
100
+ maxByteLength: number;
101
+ }): T[][];
92
102
  export declare function isBuffer(value: unknown): value is Buffer | ArrayBuffer | TypedArray;
103
+ /**
104
+ * Whether a value is a `Blob`, a `File` included. Unlike a stream, a blob can be read again for every attempt of a
105
+ * request, so a request with a blob body can be retried.
106
+ */
107
+ export declare function isBlob(value: unknown): value is Blob;
108
+ /**
109
+ * Whether a value is a web `ReadableStream`, which is what the callers get for a streamed response and may pass
110
+ * on as a request body.
111
+ */
112
+ export declare function isWebStream(value: unknown): value is ReadableStream<Uint8Array>;
93
113
  export declare function isStream(value: unknown): value is Readable;
94
- export declare function getVersionData(): {
95
- version: string;
96
- };
114
+ /**
115
+ * Whether a value is a stream of either kind, which a request can send only once.
116
+ */
117
+ export declare function isAnyStream(value: unknown): value is Readable | ReadableStream<Uint8Array>;
97
118
  /**
98
119
  * Helper class to create async iterators from paginated list endpoints.
99
120
  */
100
121
  export declare class RequestQueuePaginationIterator {
101
- private readonly maxPageLimit;
102
- private readonly getPage;
103
- private readonly limit?;
104
- private readonly cursor?;
122
+ #private;
105
123
  constructor(options: RequestQueuePaginationIteratorOptions);
106
- [Symbol.asyncIterator](): AsyncIterator<RequestQueueClientListRequestsResult>;
107
- }
108
- declare global {
109
- export const BROWSER_BUILD: boolean | undefined;
110
- export const VERSION: string | undefined;
124
+ [Symbol.asyncIterator](): AsyncIterator<ListOfRequests>;
111
125
  }
112
126
  /**
113
127
  * Options for creating a pagination iterator.
114
128
  */
115
129
  export interface RequestQueuePaginationIteratorOptions {
116
130
  maxPageLimit: number;
117
- getPage: (opts: RequestQueueClientListRequestsOptions) => Promise<RequestQueueClientListRequestsResult>;
131
+ getPage: (opts: RequestQueueClientListRequestsOptions) => Promise<ListOfRequests>;
118
132
  limit?: number;
119
133
  cursor?: string;
120
134
  }
@@ -131,10 +145,20 @@ export interface PaginationOptions {
131
145
  * limit is reached or once all items from API have been fetched.
132
146
  *
133
147
  * Chunk size is usually limited by API. Minimum of those two limits will be used.
148
+ *
149
+ * Without `chunkSize`, each request gets the API's default page size, capped by the remaining `limit`. Dataset
150
+ * items have no default limit, so iterating `DatasetClient.listItems()` without `chunkSize` loads the whole
151
+ * dataset, or all `limit` items, in one response. Pass `chunkSize` to iterate a large dataset.
134
152
  * @since Added in 2.21.0
135
153
  * */
136
154
  chunkSize?: number;
137
155
  }
156
+ /**
157
+ * The smaller of two page limits, for the `limit` query parameter. The API treats a `limit` of 0 as unset, so 0 here
158
+ * means no limit and loses to any other value.
159
+ * @internal
160
+ */
161
+ export declare function minForLimitParam(a: number | undefined, b: number | undefined): number | undefined;
138
162
  /**
139
163
  * Schema shape of {@link PaginationOptions}, to spread into every paginating client's list schema. One
140
164
  * copy stops it drifting from the interface.
@@ -165,7 +189,12 @@ export interface PaginatedResponse<Data> {
165
189
  * @template Data - The type of items in the list
166
190
  */
167
191
  export interface PaginatedList<Data> extends PaginatedResponse<Data> {
168
- /** Count of dataset entries returned in this set. */
192
+ /**
193
+ * Number of entries on this page. On a page from {@link DatasetClient.listItems}, the number of dataset rows the
194
+ * API scanned for it, or the number of items returned when that is larger. Filters (`clean`, `skipEmpty`) can
195
+ * leave it above `items.length`. The next page starts at `offset + Math.min(count, limit)`; the cap matters only
196
+ * with `unwind`, which can return more items than the rows scanned.
197
+ */
169
198
  count: number;
170
199
  /** Position of the first returned entry in the dataset. */
171
200
  offset: number;
@@ -214,3 +243,28 @@ export declare function toPathSegment(value: string): string;
214
243
  * `requests/batch` keep their separators; an array has each of its segments encoded individually.
215
244
  */
216
245
  export declare function toPath(path: string | string[]): string;
246
+ /**
247
+ * Resolves after `millis`, or right away once `signal` aborts.
248
+ * @internal
249
+ */
250
+ export declare function sleep(millis: number, signal?: AbortSignal): Promise<void>;
251
+ /** Any string, written so that a union with string literals keeps suggesting the literals. */
252
+ export type AnyString = string & {};
253
+ /** Any valid JSON value. */
254
+ export type JsonValue = string | number | boolean | null | {
255
+ [Key in string]: JsonValue;
256
+ } | JsonValue[] | readonly JsonValue[];
257
+ /**
258
+ * Any JSON object.
259
+ * @internal
260
+ */
261
+ export type JsonObject = {
262
+ [Key in string]: JsonValue;
263
+ };
264
+ /**
265
+ * Any JSON array.
266
+ * @internal
267
+ */
268
+ export type JsonArray = JsonValue[] | readonly JsonValue[];
269
+ /** Any typed array, such as `Uint8Array` or `Float64Array`. */
270
+ export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array | BigInt64Array | BigUint64Array;