cdk-common 2.0.1306 → 2.0.1308

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 (88) hide show
  1. package/.jsii +14 -2
  2. package/API.md +12 -0
  3. package/lib/main.js +1 -1
  4. package/lib/managed-policies.d.ts +3 -1
  5. package/lib/managed-policies.js +3 -1
  6. package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
  7. package/node_modules/@types/concat-stream/node_modules/@types/node/assert.d.ts +36 -1
  8. package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.buffer.d.ts +9 -0
  9. package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.d.ts +8 -4
  10. package/node_modules/@types/concat-stream/node_modules/@types/node/child_process.d.ts +50 -33
  11. package/node_modules/@types/concat-stream/node_modules/@types/node/cluster.d.ts +1 -1
  12. package/node_modules/@types/concat-stream/node_modules/@types/node/crypto.d.ts +554 -189
  13. package/node_modules/@types/concat-stream/node_modules/@types/node/dgram.d.ts +9 -8
  14. package/node_modules/@types/concat-stream/node_modules/@types/node/diagnostics_channel.d.ts +0 -2
  15. package/node_modules/@types/concat-stream/node_modules/@types/node/fs/promises.d.ts +39 -21
  16. package/node_modules/@types/concat-stream/node_modules/@types/node/fs.d.ts +89 -76
  17. package/node_modules/@types/concat-stream/node_modules/@types/node/globals.typedarray.d.ts +19 -0
  18. package/node_modules/@types/concat-stream/node_modules/@types/node/http.d.ts +52 -22
  19. package/node_modules/@types/concat-stream/node_modules/@types/node/http2.d.ts +173 -48
  20. package/node_modules/@types/concat-stream/node_modules/@types/node/https.d.ts +82 -50
  21. package/node_modules/@types/concat-stream/node_modules/@types/node/net.d.ts +7 -6
  22. package/node_modules/@types/concat-stream/node_modules/@types/node/os.d.ts +3 -2
  23. package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +3 -3
  24. package/node_modules/@types/concat-stream/node_modules/@types/node/process.d.ts +2 -1
  25. package/node_modules/@types/concat-stream/node_modules/@types/node/sea.d.ts +9 -0
  26. package/node_modules/@types/concat-stream/node_modules/@types/node/sqlite.d.ts +114 -7
  27. package/node_modules/@types/concat-stream/node_modules/@types/node/stream/consumers.d.ts +2 -2
  28. package/node_modules/@types/concat-stream/node_modules/@types/node/stream.d.ts +9 -1
  29. package/node_modules/@types/concat-stream/node_modules/@types/node/string_decoder.d.ts +2 -2
  30. package/node_modules/@types/concat-stream/node_modules/@types/node/tls.d.ts +88 -64
  31. package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +10 -2
  32. package/node_modules/@types/concat-stream/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +16 -0
  33. package/node_modules/@types/concat-stream/node_modules/@types/node/url.d.ts +2 -2
  34. package/node_modules/@types/concat-stream/node_modules/@types/node/util.d.ts +12 -3
  35. package/node_modules/@types/concat-stream/node_modules/@types/node/v8.d.ts +36 -3
  36. package/node_modules/@types/concat-stream/node_modules/@types/node/vm.d.ts +152 -41
  37. package/node_modules/@types/concat-stream/node_modules/@types/node/wasi.d.ts +1 -1
  38. package/node_modules/@types/concat-stream/node_modules/@types/node/worker_threads.d.ts +76 -1
  39. package/node_modules/@types/concat-stream/node_modules/@types/node/zlib.d.ts +25 -24
  40. package/node_modules/@types/concat-stream/node_modules/undici-types/agent.d.ts +1 -0
  41. package/node_modules/@types/concat-stream/node_modules/undici-types/diagnostics-channel.d.ts +0 -1
  42. package/node_modules/@types/concat-stream/node_modules/undici-types/errors.d.ts +5 -15
  43. package/node_modules/@types/concat-stream/node_modules/undici-types/interceptors.d.ts +5 -0
  44. package/node_modules/@types/concat-stream/node_modules/undici-types/package.json +1 -1
  45. package/node_modules/@types/concat-stream/node_modules/undici-types/snapshot-agent.d.ts +5 -3
  46. package/node_modules/@types/concat-stream/node_modules/undici-types/webidl.d.ts +82 -21
  47. package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
  48. package/node_modules/@types/form-data/node_modules/@types/node/assert.d.ts +36 -1
  49. package/node_modules/@types/form-data/node_modules/@types/node/buffer.buffer.d.ts +9 -0
  50. package/node_modules/@types/form-data/node_modules/@types/node/buffer.d.ts +8 -4
  51. package/node_modules/@types/form-data/node_modules/@types/node/child_process.d.ts +50 -33
  52. package/node_modules/@types/form-data/node_modules/@types/node/cluster.d.ts +1 -1
  53. package/node_modules/@types/form-data/node_modules/@types/node/crypto.d.ts +554 -189
  54. package/node_modules/@types/form-data/node_modules/@types/node/dgram.d.ts +9 -8
  55. package/node_modules/@types/form-data/node_modules/@types/node/diagnostics_channel.d.ts +0 -2
  56. package/node_modules/@types/form-data/node_modules/@types/node/fs/promises.d.ts +39 -21
  57. package/node_modules/@types/form-data/node_modules/@types/node/fs.d.ts +89 -76
  58. package/node_modules/@types/form-data/node_modules/@types/node/globals.typedarray.d.ts +19 -0
  59. package/node_modules/@types/form-data/node_modules/@types/node/http.d.ts +52 -22
  60. package/node_modules/@types/form-data/node_modules/@types/node/http2.d.ts +173 -48
  61. package/node_modules/@types/form-data/node_modules/@types/node/https.d.ts +82 -50
  62. package/node_modules/@types/form-data/node_modules/@types/node/net.d.ts +7 -6
  63. package/node_modules/@types/form-data/node_modules/@types/node/os.d.ts +3 -2
  64. package/node_modules/@types/form-data/node_modules/@types/node/package.json +3 -3
  65. package/node_modules/@types/form-data/node_modules/@types/node/process.d.ts +2 -1
  66. package/node_modules/@types/form-data/node_modules/@types/node/sea.d.ts +9 -0
  67. package/node_modules/@types/form-data/node_modules/@types/node/sqlite.d.ts +114 -7
  68. package/node_modules/@types/form-data/node_modules/@types/node/stream/consumers.d.ts +2 -2
  69. package/node_modules/@types/form-data/node_modules/@types/node/stream.d.ts +9 -1
  70. package/node_modules/@types/form-data/node_modules/@types/node/string_decoder.d.ts +2 -2
  71. package/node_modules/@types/form-data/node_modules/@types/node/tls.d.ts +88 -64
  72. package/node_modules/@types/form-data/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +10 -2
  73. package/node_modules/@types/form-data/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +16 -0
  74. package/node_modules/@types/form-data/node_modules/@types/node/url.d.ts +2 -2
  75. package/node_modules/@types/form-data/node_modules/@types/node/util.d.ts +12 -3
  76. package/node_modules/@types/form-data/node_modules/@types/node/v8.d.ts +36 -3
  77. package/node_modules/@types/form-data/node_modules/@types/node/vm.d.ts +152 -41
  78. package/node_modules/@types/form-data/node_modules/@types/node/wasi.d.ts +1 -1
  79. package/node_modules/@types/form-data/node_modules/@types/node/worker_threads.d.ts +76 -1
  80. package/node_modules/@types/form-data/node_modules/@types/node/zlib.d.ts +25 -24
  81. package/node_modules/@types/form-data/node_modules/undici-types/agent.d.ts +1 -0
  82. package/node_modules/@types/form-data/node_modules/undici-types/diagnostics-channel.d.ts +0 -1
  83. package/node_modules/@types/form-data/node_modules/undici-types/errors.d.ts +5 -15
  84. package/node_modules/@types/form-data/node_modules/undici-types/interceptors.d.ts +5 -0
  85. package/node_modules/@types/form-data/node_modules/undici-types/package.json +1 -1
  86. package/node_modules/@types/form-data/node_modules/undici-types/snapshot-agent.d.ts +5 -3
  87. package/node_modules/@types/form-data/node_modules/undici-types/webidl.d.ts +82 -21
  88. package/package.json +2 -2
@@ -37,6 +37,7 @@
37
37
  * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/vm.js)
38
38
  */
39
39
  declare module "vm" {
40
+ import { NonSharedBuffer } from "node:buffer";
40
41
  import { ImportAttributes, ImportPhase } from "node:module";
41
42
  interface Context extends NodeJS.Dict<any> {}
42
43
  interface BaseOptions {
@@ -66,7 +67,7 @@ declare module "vm" {
66
67
  /**
67
68
  * Provides an optional data with V8's code cache data for the supplied source.
68
69
  */
69
- cachedData?: Buffer | NodeJS.ArrayBufferView | undefined;
70
+ cachedData?: NodeJS.ArrayBufferView | undefined;
70
71
  /** @deprecated in favor of `script.createCachedData()` */
71
72
  produceCachedData?: boolean | undefined;
72
73
  /**
@@ -367,7 +368,7 @@ declare module "vm" {
367
368
  * ```
368
369
  * @since v10.6.0
369
370
  */
370
- createCachedData(): Buffer;
371
+ createCachedData(): NonSharedBuffer;
371
372
  /** @deprecated in favor of `script.createCachedData()` */
372
373
  cachedDataProduced?: boolean;
373
374
  /**
@@ -377,7 +378,7 @@ declare module "vm" {
377
378
  * @since v5.7.0
378
379
  */
379
380
  cachedDataRejected?: boolean;
380
- cachedData?: Buffer;
381
+ cachedData?: NonSharedBuffer;
381
382
  /**
382
383
  * When the script is compiled from a source that contains a source map magic
383
384
  * comment, this property will be set to the URL of the source map.
@@ -676,14 +677,12 @@ declare module "vm" {
676
677
  * flag enabled.
677
678
  *
678
679
  * The `vm.Module` class provides a low-level interface for using
679
- * ECMAScript modules in VM contexts. It is the counterpart of the `vm.Script` class that closely mirrors [Module Record](https://262.ecma-international.org/14.0/#sec-abstract-module-records) s as
680
- * defined in the ECMAScript
680
+ * ECMAScript modules in VM contexts. It is the counterpart of the `vm.Script`
681
+ * class that closely mirrors [Module Record](https://tc39.es/ecma262/#sec-abstract-module-records)s as defined in the ECMAScript
681
682
  * specification.
682
683
  *
683
684
  * Unlike `vm.Script` however, every `vm.Module` object is bound to a context from
684
- * its creation. Operations on `vm.Module` objects are intrinsically asynchronous,
685
- * in contrast with the synchronous nature of `vm.Script` objects. The use of
686
- * 'async' functions can help with manipulating `vm.Module` objects.
685
+ * its creation.
687
686
  *
688
687
  * Using a `vm.Module` object requires three distinct steps: creation/parsing,
689
688
  * linking, and evaluation. These three steps are illustrated in the following
@@ -711,7 +710,7 @@ declare module "vm" {
711
710
  * // Here, we attempt to obtain the default export from the module "foo", and
712
711
  * // put it into local binding "secret".
713
712
  *
714
- * const bar = new vm.SourceTextModule(`
713
+ * const rootModule = new vm.SourceTextModule(`
715
714
  * import s from 'foo';
716
715
  * s;
717
716
  * print(s);
@@ -721,39 +720,48 @@ declare module "vm" {
721
720
  * //
722
721
  * // "Link" the imported dependencies of this Module to it.
723
722
  * //
724
- * // The provided linking callback (the "linker") accepts two arguments: the
725
- * // parent module (`bar` in this case) and the string that is the specifier of
726
- * // the imported module. The callback is expected to return a Module that
727
- * // corresponds to the provided specifier, with certain requirements documented
728
- * // in `module.link()`.
729
- * //
730
- * // If linking has not started for the returned Module, the same linker
731
- * // callback will be called on the returned Module.
723
+ * // Obtain the requested dependencies of a SourceTextModule by
724
+ * // `sourceTextModule.moduleRequests` and resolve them.
732
725
  * //
733
726
  * // Even top-level Modules without dependencies must be explicitly linked. The
734
- * // callback provided would never be called, however.
735
- * //
736
- * // The link() method returns a Promise that will be resolved when all the
737
- * // Promises returned by the linker resolve.
727
+ * // array passed to `sourceTextModule.linkRequests(modules)` can be
728
+ * // empty, however.
738
729
  * //
739
- * // Note: This is a contrived example in that the linker function creates a new
740
- * // "foo" module every time it is called. In a full-fledged module system, a
741
- * // cache would probably be used to avoid duplicated modules.
730
+ * // Note: This is a contrived example in that the resolveAndLinkDependencies
731
+ * // creates a new "foo" module every time it is called. In a full-fledged
732
+ * // module system, a cache would probably be used to avoid duplicated modules.
733
+ *
734
+ * const moduleMap = new Map([
735
+ * ['root', rootModule],
736
+ * ]);
742
737
  *
743
- * async function linker(specifier, referencingModule) {
744
- * if (specifier === 'foo') {
745
- * return new vm.SourceTextModule(`
746
- * // The "secret" variable refers to the global variable we added to
747
- * // "contextifiedObject" when creating the context.
748
- * export default secret;
749
- * `, { context: referencingModule.context });
738
+ * function resolveAndLinkDependencies(module) {
739
+ * const requestedModules = module.moduleRequests.map((request) => {
740
+ * // In a full-fledged module system, the resolveAndLinkDependencies would
741
+ * // resolve the module with the module cache key `[specifier, attributes]`.
742
+ * // In this example, we just use the specifier as the key.
743
+ * const specifier = request.specifier;
744
+ *
745
+ * let requestedModule = moduleMap.get(specifier);
746
+ * if (requestedModule === undefined) {
747
+ * requestedModule = new vm.SourceTextModule(`
748
+ * // The "secret" variable refers to the global variable we added to
749
+ * // "contextifiedObject" when creating the context.
750
+ * export default secret;
751
+ * `, { context: referencingModule.context });
752
+ * moduleMap.set(specifier, linkedModule);
753
+ * // Resolve the dependencies of the new module as well.
754
+ * resolveAndLinkDependencies(requestedModule);
755
+ * }
756
+ *
757
+ * return requestedModule;
758
+ * });
750
759
  *
751
- * // Using `contextifiedObject` instead of `referencingModule.context`
752
- * // here would work as well.
753
- * }
754
- * throw new Error(`Unable to resolve dependency: ${specifier}`);
760
+ * module.linkRequests(requestedModules);
755
761
  * }
756
- * await bar.link(linker);
762
+ *
763
+ * resolveAndLinkDependencies(rootModule);
764
+ * rootModule.instantiate();
757
765
  *
758
766
  * // Step 3
759
767
  * //
@@ -761,7 +769,7 @@ declare module "vm" {
761
769
  * // resolve after the module has finished evaluating.
762
770
  *
763
771
  * // Prints 42.
764
- * await bar.evaluate();
772
+ * await rootModule.evaluate();
765
773
  * ```
766
774
  * @since v13.0.0, v12.16.0
767
775
  * @experimental
@@ -831,6 +839,10 @@ declare module "vm" {
831
839
  * Link module dependencies. This method must be called before evaluation, and
832
840
  * can only be called once per module.
833
841
  *
842
+ * Use `sourceTextModule.linkRequests(modules)` and
843
+ * `sourceTextModule.instantiate()` to link modules either synchronously or
844
+ * asynchronously.
845
+ *
834
846
  * The function is expected to return a `Module` object or a `Promise` that
835
847
  * eventually resolves to a `Module` object. The returned `Module` must satisfy the
836
848
  * following two invariants:
@@ -911,6 +923,39 @@ declare module "vm" {
911
923
  class SourceTextModule extends Module {
912
924
  /**
913
925
  * Creates a new `SourceTextModule` instance.
926
+ *
927
+ * Properties assigned to the `import.meta` object that are objects may
928
+ * allow the module to access information outside the specified `context`. Use
929
+ * `vm.runInContext()` to create objects in a specific context.
930
+ *
931
+ * ```js
932
+ * import vm from 'node:vm';
933
+ *
934
+ * const contextifiedObject = vm.createContext({ secret: 42 });
935
+ *
936
+ * const module = new vm.SourceTextModule(
937
+ * 'Object.getPrototypeOf(import.meta.prop).secret = secret;',
938
+ * {
939
+ * initializeImportMeta(meta) {
940
+ * // Note: this object is created in the top context. As such,
941
+ * // Object.getPrototypeOf(import.meta.prop) points to the
942
+ * // Object.prototype in the top context rather than that in
943
+ * // the contextified object.
944
+ * meta.prop = {};
945
+ * },
946
+ * });
947
+ * // The module has an empty `moduleRequests` array.
948
+ * module.linkRequests([]);
949
+ * module.instantiate();
950
+ * await module.evaluate();
951
+ *
952
+ * // Now, Object.prototype.secret will be equal to 42.
953
+ * //
954
+ * // To fix this problem, replace
955
+ * // meta.prop = {};
956
+ * // above with
957
+ * // meta.prop = vm.runInContext('{}', contextifiedObject);
958
+ * ```
914
959
  * @param code JavaScript Module code to parse
915
960
  */
916
961
  constructor(code: string, options?: SourceTextModuleOptions);
@@ -918,6 +963,75 @@ declare module "vm" {
918
963
  * @deprecated Use `sourceTextModule.moduleRequests` instead.
919
964
  */
920
965
  readonly dependencySpecifiers: readonly string[];
966
+ /**
967
+ * Iterates over the dependency graph and returns `true` if any module in its
968
+ * dependencies or this module itself contains top-level `await` expressions,
969
+ * otherwise returns `false`.
970
+ *
971
+ * The search may be slow if the graph is big enough.
972
+ *
973
+ * This requires the module to be instantiated first. If the module is not
974
+ * instantiated yet, an error will be thrown.
975
+ * @since v24.9.0
976
+ */
977
+ hasAsyncGraph(): boolean;
978
+ /**
979
+ * Returns whether the module itself contains any top-level `await` expressions.
980
+ *
981
+ * This corresponds to the field `[[HasTLA]]` in [Cyclic Module Record](https://tc39.es/ecma262/#sec-cyclic-module-records) in the
982
+ * ECMAScript specification.
983
+ * @since v24.9.0
984
+ */
985
+ hasTopLevelAwait(): boolean;
986
+ /**
987
+ * Instantiate the module with the linked requested modules.
988
+ *
989
+ * This resolves the imported bindings of the module, including re-exported
990
+ * binding names. When there are any bindings that cannot be resolved,
991
+ * an error would be thrown synchronously.
992
+ *
993
+ * If the requested modules include cyclic dependencies, the
994
+ * `sourceTextModule.linkRequests(modules)` method must be called on all
995
+ * modules in the cycle before calling this method.
996
+ * @since v24.8.0
997
+ */
998
+ instantiate(): void;
999
+ /**
1000
+ * Link module dependencies. This method must be called before evaluation, and
1001
+ * can only be called once per module.
1002
+ *
1003
+ * The order of the module instances in the `modules` array should correspond to the order of
1004
+ * `sourceTextModule.moduleRequests` being resolved. If two module requests have the same
1005
+ * specifier and import attributes, they must be resolved with the same module instance or an
1006
+ * `ERR_MODULE_LINK_MISMATCH` would be thrown. For example, when linking requests for this
1007
+ * module:
1008
+ *
1009
+ * ```js
1010
+ * import foo from 'foo';
1011
+ * import source Foo from 'foo';
1012
+ * ```
1013
+ *
1014
+ * The `modules` array must contain two references to the same instance, because the two
1015
+ * module requests are identical but in two phases.
1016
+ *
1017
+ * If the module has no dependencies, the `modules` array can be empty.
1018
+ *
1019
+ * Users can use `sourceTextModule.moduleRequests` to implement the host-defined
1020
+ * [HostLoadImportedModule](https://tc39.es/ecma262/#sec-HostLoadImportedModule) abstract operation in the ECMAScript specification,
1021
+ * and using `sourceTextModule.linkRequests()` to invoke specification defined
1022
+ * [FinishLoadingImportedModule](https://tc39.es/ecma262/#sec-FinishLoadingImportedModule), on the module with all dependencies in a batch.
1023
+ *
1024
+ * It's up to the creator of the `SourceTextModule` to determine if the resolution
1025
+ * of the dependencies is synchronous or asynchronous.
1026
+ *
1027
+ * After each module in the `modules` array is linked, call
1028
+ * `sourceTextModule.instantiate()`.
1029
+ * @since v24.8.0
1030
+ * @param modules Array of `vm.Module` objects that this module depends on.
1031
+ * The order of the modules in the array is the order of
1032
+ * `sourceTextModule.moduleRequests`.
1033
+ */
1034
+ linkRequests(modules: readonly Module[]): void;
921
1035
  /**
922
1036
  * The requested import dependencies of this module. The returned array is frozen
923
1037
  * to disallow any changes to it.
@@ -1013,9 +1127,7 @@ declare module "vm" {
1013
1127
  options?: SyntheticModuleOptions,
1014
1128
  );
1015
1129
  /**
1016
- * This method is used after the module is linked to set the values of exports. If
1017
- * it is called before the module is linked, an `ERR_VM_MODULE_STATUS` error
1018
- * will be thrown.
1130
+ * This method sets the module export binding slots with the given value.
1019
1131
  *
1020
1132
  * ```js
1021
1133
  * import vm from 'node:vm';
@@ -1024,7 +1136,6 @@ declare module "vm" {
1024
1136
  * m.setExport('x', 1);
1025
1137
  * });
1026
1138
  *
1027
- * await m.link(() => {});
1028
1139
  * await m.evaluate();
1029
1140
  *
1030
1141
  * assert.strictEqual(m.namespace.x, 1);
@@ -77,7 +77,7 @@ declare module "wasi" {
77
77
  * WASI command itself.
78
78
  * @default []
79
79
  */
80
- args?: string[] | undefined;
80
+ args?: readonly string[] | undefined;
81
81
  /**
82
82
  * An object similar to `process.env` that the WebAssembly
83
83
  * application will see as its environment.
@@ -62,7 +62,7 @@ declare module "worker_threads" {
62
62
  import { Readable, Writable } from "node:stream";
63
63
  import { ReadableStream, TransformStream, WritableStream } from "node:stream/web";
64
64
  import { URL } from "node:url";
65
- import { HeapInfo } from "node:v8";
65
+ import { CPUProfileHandle, HeapInfo, HeapProfileHandle } from "node:v8";
66
66
  import { MessageEvent } from "undici-types";
67
67
  const isInternalThread: boolean;
68
68
  const isMainThread: boolean;
@@ -469,6 +469,81 @@ declare module "worker_threads" {
469
469
  * @since v24.0.0
470
470
  */
471
471
  getHeapStatistics(): Promise<HeapInfo>;
472
+ /**
473
+ * Starting a CPU profile then return a Promise that fulfills with an error
474
+ * or an `CPUProfileHandle` object. This API supports `await using` syntax.
475
+ *
476
+ * ```js
477
+ * const { Worker } = require('node:worker_threads');
478
+ *
479
+ * const worker = new Worker(`
480
+ * const { parentPort } = require('worker_threads');
481
+ * parentPort.on('message', () => {});
482
+ * `, { eval: true });
483
+ *
484
+ * worker.on('online', async () => {
485
+ * const handle = await worker.startCpuProfile();
486
+ * const profile = await handle.stop();
487
+ * console.log(profile);
488
+ * worker.terminate();
489
+ * });
490
+ * ```
491
+ *
492
+ * `await using` example.
493
+ *
494
+ * ```js
495
+ * const { Worker } = require('node:worker_threads');
496
+ *
497
+ * const w = new Worker(`
498
+ * const { parentPort } = require('node:worker_threads');
499
+ * parentPort.on('message', () => {});
500
+ * `, { eval: true });
501
+ *
502
+ * w.on('online', async () => {
503
+ * // Stop profile automatically when return and profile will be discarded
504
+ * await using handle = await w.startCpuProfile();
505
+ * });
506
+ * ```
507
+ * @since v24.8.0
508
+ */
509
+ startCpuProfile(): Promise<CPUProfileHandle>;
510
+ /**
511
+ * Starting a Heap profile then return a Promise that fulfills with an error
512
+ * or an `HeapProfileHandle` object. This API supports `await using` syntax.
513
+ *
514
+ * ```js
515
+ * const { Worker } = require('node:worker_threads');
516
+ *
517
+ * const worker = new Worker(`
518
+ * const { parentPort } = require('worker_threads');
519
+ * parentPort.on('message', () => {});
520
+ * `, { eval: true });
521
+ *
522
+ * worker.on('online', async () => {
523
+ * const handle = await worker.startHeapProfile();
524
+ * const profile = await handle.stop();
525
+ * console.log(profile);
526
+ * worker.terminate();
527
+ * });
528
+ * ```
529
+ *
530
+ * `await using` example.
531
+ *
532
+ * ```js
533
+ * const { Worker } = require('node:worker_threads');
534
+ *
535
+ * const w = new Worker(`
536
+ * const { parentPort } = require('node:worker_threads');
537
+ * parentPort.on('message', () => {});
538
+ * `, { eval: true });
539
+ *
540
+ * w.on('online', async () => {
541
+ * // Stop profile automatically when return and profile will be discarded
542
+ * await using handle = await w.startHeapProfile();
543
+ * });
544
+ * ```
545
+ */
546
+ startHeapProfile(): Promise<HeapProfileHandle>;
472
547
  /**
473
548
  * Calls `worker.terminate()` when the dispose scope is exited.
474
549
  *
@@ -92,6 +92,7 @@
92
92
  * @see [source](https://github.com/nodejs/node/blob/v24.x/lib/zlib.js)
93
93
  */
94
94
  declare module "zlib" {
95
+ import { NonSharedBuffer } from "node:buffer";
95
96
  import * as stream from "node:stream";
96
97
  interface ZlibOptions {
97
98
  /**
@@ -227,7 +228,7 @@ declare module "zlib" {
227
228
  * @returns A 32-bit unsigned integer containing the checksum.
228
229
  * @since v22.2.0
229
230
  */
230
- function crc32(data: string | Buffer | NodeJS.ArrayBufferView, value?: number): number;
231
+ function crc32(data: string | NodeJS.ArrayBufferView, value?: number): number;
231
232
  /**
232
233
  * Creates and returns a new `BrotliCompress` object.
233
234
  * @since v11.7.0, v10.16.0
@@ -291,124 +292,124 @@ declare module "zlib" {
291
292
  */
292
293
  function createZstdDecompress(options?: ZstdOptions): ZstdDecompress;
293
294
  type InputType = string | ArrayBuffer | NodeJS.ArrayBufferView;
294
- type CompressCallback = (error: Error | null, result: Buffer) => void;
295
+ type CompressCallback = (error: Error | null, result: NonSharedBuffer) => void;
295
296
  /**
296
297
  * @since v11.7.0, v10.16.0
297
298
  */
298
299
  function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
299
300
  function brotliCompress(buf: InputType, callback: CompressCallback): void;
300
301
  namespace brotliCompress {
301
- function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<Buffer>;
302
+ function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<NonSharedBuffer>;
302
303
  }
303
304
  /**
304
305
  * Compress a chunk of data with `BrotliCompress`.
305
306
  * @since v11.7.0, v10.16.0
306
307
  */
307
- function brotliCompressSync(buf: InputType, options?: BrotliOptions): Buffer;
308
+ function brotliCompressSync(buf: InputType, options?: BrotliOptions): NonSharedBuffer;
308
309
  /**
309
310
  * @since v11.7.0, v10.16.0
310
311
  */
311
312
  function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
312
313
  function brotliDecompress(buf: InputType, callback: CompressCallback): void;
313
314
  namespace brotliDecompress {
314
- function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<Buffer>;
315
+ function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<NonSharedBuffer>;
315
316
  }
316
317
  /**
317
318
  * Decompress a chunk of data with `BrotliDecompress`.
318
319
  * @since v11.7.0, v10.16.0
319
320
  */
320
- function brotliDecompressSync(buf: InputType, options?: BrotliOptions): Buffer;
321
+ function brotliDecompressSync(buf: InputType, options?: BrotliOptions): NonSharedBuffer;
321
322
  /**
322
323
  * @since v0.6.0
323
324
  */
324
325
  function deflate(buf: InputType, callback: CompressCallback): void;
325
326
  function deflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
326
327
  namespace deflate {
327
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
328
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
328
329
  }
329
330
  /**
330
331
  * Compress a chunk of data with `Deflate`.
331
332
  * @since v0.11.12
332
333
  */
333
- function deflateSync(buf: InputType, options?: ZlibOptions): Buffer;
334
+ function deflateSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
334
335
  /**
335
336
  * @since v0.6.0
336
337
  */
337
338
  function deflateRaw(buf: InputType, callback: CompressCallback): void;
338
339
  function deflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
339
340
  namespace deflateRaw {
340
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
341
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
341
342
  }
342
343
  /**
343
344
  * Compress a chunk of data with `DeflateRaw`.
344
345
  * @since v0.11.12
345
346
  */
346
- function deflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
347
+ function deflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
347
348
  /**
348
349
  * @since v0.6.0
349
350
  */
350
351
  function gzip(buf: InputType, callback: CompressCallback): void;
351
352
  function gzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
352
353
  namespace gzip {
353
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
354
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
354
355
  }
355
356
  /**
356
357
  * Compress a chunk of data with `Gzip`.
357
358
  * @since v0.11.12
358
359
  */
359
- function gzipSync(buf: InputType, options?: ZlibOptions): Buffer;
360
+ function gzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
360
361
  /**
361
362
  * @since v0.6.0
362
363
  */
363
364
  function gunzip(buf: InputType, callback: CompressCallback): void;
364
365
  function gunzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
365
366
  namespace gunzip {
366
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
367
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
367
368
  }
368
369
  /**
369
370
  * Decompress a chunk of data with `Gunzip`.
370
371
  * @since v0.11.12
371
372
  */
372
- function gunzipSync(buf: InputType, options?: ZlibOptions): Buffer;
373
+ function gunzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
373
374
  /**
374
375
  * @since v0.6.0
375
376
  */
376
377
  function inflate(buf: InputType, callback: CompressCallback): void;
377
378
  function inflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
378
379
  namespace inflate {
379
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
380
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
380
381
  }
381
382
  /**
382
383
  * Decompress a chunk of data with `Inflate`.
383
384
  * @since v0.11.12
384
385
  */
385
- function inflateSync(buf: InputType, options?: ZlibOptions): Buffer;
386
+ function inflateSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
386
387
  /**
387
388
  * @since v0.6.0
388
389
  */
389
390
  function inflateRaw(buf: InputType, callback: CompressCallback): void;
390
391
  function inflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
391
392
  namespace inflateRaw {
392
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
393
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
393
394
  }
394
395
  /**
395
396
  * Decompress a chunk of data with `InflateRaw`.
396
397
  * @since v0.11.12
397
398
  */
398
- function inflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
399
+ function inflateRawSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
399
400
  /**
400
401
  * @since v0.6.0
401
402
  */
402
403
  function unzip(buf: InputType, callback: CompressCallback): void;
403
404
  function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
404
405
  namespace unzip {
405
- function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
406
+ function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<NonSharedBuffer>;
406
407
  }
407
408
  /**
408
409
  * Decompress a chunk of data with `Unzip`.
409
410
  * @since v0.11.12
410
411
  */
411
- function unzipSync(buf: InputType, options?: ZlibOptions): Buffer;
412
+ function unzipSync(buf: InputType, options?: ZlibOptions): NonSharedBuffer;
412
413
  /**
413
414
  * @since v22.15.0
414
415
  * @experimental
@@ -416,14 +417,14 @@ declare module "zlib" {
416
417
  function zstdCompress(buf: InputType, callback: CompressCallback): void;
417
418
  function zstdCompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void;
418
419
  namespace zstdCompress {
419
- function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<Buffer>;
420
+ function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<NonSharedBuffer>;
420
421
  }
421
422
  /**
422
423
  * Compress a chunk of data with `ZstdCompress`.
423
424
  * @since v22.15.0
424
425
  * @experimental
425
426
  */
426
- function zstdCompressSync(buf: InputType, options?: ZstdOptions): Buffer;
427
+ function zstdCompressSync(buf: InputType, options?: ZstdOptions): NonSharedBuffer;
427
428
  /**
428
429
  * @since v22.15.0
429
430
  * @experimental
@@ -431,14 +432,14 @@ declare module "zlib" {
431
432
  function zstdDecompress(buf: InputType, callback: CompressCallback): void;
432
433
  function zstdDecompress(buf: InputType, options: ZstdOptions, callback: CompressCallback): void;
433
434
  namespace zstdDecompress {
434
- function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<Buffer>;
435
+ function __promisify__(buffer: InputType, options?: ZstdOptions): Promise<NonSharedBuffer>;
435
436
  }
436
437
  /**
437
438
  * Decompress a chunk of data with `ZstdDecompress`.
438
439
  * @since v22.15.0
439
440
  * @experimental
440
441
  */
441
- function zstdDecompressSync(buf: InputType, options?: ZstdOptions): Buffer;
442
+ function zstdDecompressSync(buf: InputType, options?: ZstdOptions): NonSharedBuffer;
442
443
  namespace constants {
443
444
  const BROTLI_DECODE: number;
444
445
  const BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number;
@@ -24,6 +24,7 @@ declare namespace Agent {
24
24
  factory?(origin: string | URL, opts: Object): Dispatcher;
25
25
 
26
26
  interceptors?: { Agent?: readonly Dispatcher.DispatchInterceptor[] } & Pool.Options['interceptors']
27
+ maxOrigins?: number
27
28
  }
28
29
 
29
30
  export interface DispatchOptions extends Dispatcher.DispatchOptions {
@@ -16,7 +16,6 @@ declare namespace DiagnosticsChannel {
16
16
  statusText: string;
17
17
  headers: Array<Buffer>;
18
18
  }
19
- type Error = unknown
20
19
  interface ConnectParams {
21
20
  host: URL['host'];
22
21
  hostname: URL['hostname'];
@@ -49,21 +49,6 @@ declare namespace Errors {
49
49
  headers: IncomingHttpHeaders | string[] | null
50
50
  }
51
51
 
52
- export class ResponseStatusCodeError extends UndiciError {
53
- constructor (
54
- message?: string,
55
- statusCode?: number,
56
- headers?: IncomingHttpHeaders | string[] | null,
57
- body?: null | Record<string, any> | string
58
- )
59
- name: 'ResponseStatusCodeError'
60
- code: 'UND_ERR_RESPONSE_STATUS_CODE'
61
- body: null | Record<string, any> | string
62
- status: number
63
- statusCode: number
64
- headers: IncomingHttpHeaders | string[] | null
65
- }
66
-
67
52
  /** Passed an invalid argument. */
68
53
  export class InvalidArgumentError extends UndiciError {
69
54
  name: 'InvalidArgumentError'
@@ -168,4 +153,9 @@ declare namespace Errors {
168
153
  name: 'SecureProxyConnectionError'
169
154
  code: 'UND_ERR_PRX_TLS'
170
155
  }
156
+
157
+ class MaxOriginsReachedError extends UndiciError {
158
+ name: 'MaxOriginsReachedError'
159
+ code: 'UND_ERR_MAX_ORIGINS_REACHED'
160
+ }
171
161
  }
@@ -9,6 +9,10 @@ declare namespace Interceptors {
9
9
  export type DumpInterceptorOpts = { maxSize?: number }
10
10
  export type RetryInterceptorOpts = RetryHandler.RetryOptions
11
11
  export type RedirectInterceptorOpts = { maxRedirections?: number }
12
+ export type DecompressInterceptorOpts = {
13
+ skipErrorResponses?: boolean
14
+ skipStatusCodes?: number[]
15
+ }
12
16
 
13
17
  export type ResponseErrorInterceptorOpts = { throwOnError: boolean }
14
18
  export type CacheInterceptorOpts = CacheHandler.CacheOptions
@@ -28,6 +32,7 @@ declare namespace Interceptors {
28
32
  export function dump (opts?: DumpInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
29
33
  export function retry (opts?: RetryInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
30
34
  export function redirect (opts?: RedirectInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
35
+ export function decompress (opts?: DecompressInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
31
36
  export function responseError (opts?: ResponseErrorInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
32
37
  export function dns (opts?: DNSInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
33
38
  export function cache (opts?: CacheInterceptorOpts): Dispatcher.DispatcherComposeInterceptor
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undici-types",
3
- "version": "7.14.0",
3
+ "version": "7.16.0",
4
4
  "description": "A stand-alone types package for Undici",
5
5
  "homepage": "https://undici.nodejs.org",
6
6
  "bugs": {