cdk-common 2.0.1253 → 2.0.1255
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/.jsii +14 -44
- package/API.md +12 -42
- package/lib/main.js +1 -1
- package/lib/managed-policies.d.ts +3 -8
- package/lib/managed-policies.js +3 -8
- package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/child_process.d.ts +25 -121
- package/node_modules/@types/concat-stream/node_modules/@types/node/fs/promises.d.ts +19 -26
- package/node_modules/@types/concat-stream/node_modules/@types/node/fs.d.ts +19 -35
- package/node_modules/@types/concat-stream/node_modules/@types/node/inspector.d.ts +56 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/test.d.ts +104 -0
- package/node_modules/@types/concat-stream/node_modules/@types/node/url.d.ts +11 -0
- package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/child_process.d.ts +25 -121
- package/node_modules/@types/form-data/node_modules/@types/node/fs/promises.d.ts +19 -26
- package/node_modules/@types/form-data/node_modules/@types/node/fs.d.ts +19 -35
- package/node_modules/@types/form-data/node_modules/@types/node/inspector.d.ts +56 -0
- package/node_modules/@types/form-data/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/test.d.ts +104 -0
- package/node_modules/@types/form-data/node_modules/@types/node/url.d.ts +11 -0
- package/package.json +1 -1
|
@@ -1707,6 +1707,46 @@ declare module "node:test" {
|
|
|
1707
1707
|
* @param options Optional configuration options for the mock module.
|
|
1708
1708
|
*/
|
|
1709
1709
|
module(specifier: string, options?: MockModuleOptions): MockModuleContext;
|
|
1710
|
+
/**
|
|
1711
|
+
* Creates a mock for a property value on an object. This allows you to track and control access to a specific property,
|
|
1712
|
+
* including how many times it is read (getter) or written (setter), and to restore the original value after mocking.
|
|
1713
|
+
*
|
|
1714
|
+
* ```js
|
|
1715
|
+
* test('mocks a property value', (t) => {
|
|
1716
|
+
* const obj = { foo: 42 };
|
|
1717
|
+
* const prop = t.mock.property(obj, 'foo', 100);
|
|
1718
|
+
*
|
|
1719
|
+
* assert.strictEqual(obj.foo, 100);
|
|
1720
|
+
* assert.strictEqual(prop.mock.accessCount(), 1);
|
|
1721
|
+
* assert.strictEqual(prop.mock.accesses[0].type, 'get');
|
|
1722
|
+
* assert.strictEqual(prop.mock.accesses[0].value, 100);
|
|
1723
|
+
*
|
|
1724
|
+
* obj.foo = 200;
|
|
1725
|
+
* assert.strictEqual(prop.mock.accessCount(), 2);
|
|
1726
|
+
* assert.strictEqual(prop.mock.accesses[1].type, 'set');
|
|
1727
|
+
* assert.strictEqual(prop.mock.accesses[1].value, 200);
|
|
1728
|
+
*
|
|
1729
|
+
* prop.mock.restore();
|
|
1730
|
+
* assert.strictEqual(obj.foo, 42);
|
|
1731
|
+
* });
|
|
1732
|
+
* ```
|
|
1733
|
+
* @since v24.3.0
|
|
1734
|
+
* @param object The object whose value is being mocked.
|
|
1735
|
+
* @param propertyName The identifier of the property on `object` to mock.
|
|
1736
|
+
* @param value An optional value used as the mock value
|
|
1737
|
+
* for `object[propertyName]`. **Default:** The original property value.
|
|
1738
|
+
* @returns A proxy to the mocked object. The mocked object contains a
|
|
1739
|
+
* special `mock` property, which is an instance of [`MockPropertyContext`][], and
|
|
1740
|
+
* can be used for inspecting and changing the behavior of the mocked property.
|
|
1741
|
+
*/
|
|
1742
|
+
property<
|
|
1743
|
+
MockedObject extends object,
|
|
1744
|
+
PropertyName extends keyof MockedObject,
|
|
1745
|
+
>(
|
|
1746
|
+
object: MockedObject,
|
|
1747
|
+
property: PropertyName,
|
|
1748
|
+
value?: MockedObject[PropertyName],
|
|
1749
|
+
): MockedObject & { mock: MockPropertyContext<MockedObject[PropertyName]> };
|
|
1710
1750
|
/**
|
|
1711
1751
|
* This function restores the default behavior of all mocks that were previously
|
|
1712
1752
|
* created by this `MockTracker` and disassociates the mocks from the `MockTracker` instance. Once disassociated, the mocks can still be used, but the `MockTracker` instance can no longer be
|
|
@@ -1876,6 +1916,70 @@ declare module "node:test" {
|
|
|
1876
1916
|
*/
|
|
1877
1917
|
restore(): void;
|
|
1878
1918
|
}
|
|
1919
|
+
/**
|
|
1920
|
+
* @since v24.3.0
|
|
1921
|
+
*/
|
|
1922
|
+
class MockPropertyContext<PropertyType = any> {
|
|
1923
|
+
/**
|
|
1924
|
+
* A getter that returns a copy of the internal array used to track accesses (get/set) to
|
|
1925
|
+
* the mocked property. Each entry in the array is an object with the following properties:
|
|
1926
|
+
*/
|
|
1927
|
+
readonly accesses: Array<{
|
|
1928
|
+
type: "get" | "set";
|
|
1929
|
+
value: PropertyType;
|
|
1930
|
+
stack: Error;
|
|
1931
|
+
}>;
|
|
1932
|
+
/**
|
|
1933
|
+
* This function returns the number of times that the property was accessed.
|
|
1934
|
+
* This function is more efficient than checking `ctx.accesses.length` because
|
|
1935
|
+
* `ctx.accesses` is a getter that creates a copy of the internal access tracking array.
|
|
1936
|
+
* @returns The number of times that the property was accessed (read or written).
|
|
1937
|
+
*/
|
|
1938
|
+
accessCount(): number;
|
|
1939
|
+
/**
|
|
1940
|
+
* This function is used to change the value returned by the mocked property getter.
|
|
1941
|
+
* @param value The new value to be set as the mocked property value.
|
|
1942
|
+
*/
|
|
1943
|
+
mockImplementation(value: PropertyType): void;
|
|
1944
|
+
/**
|
|
1945
|
+
* This function is used to change the behavior of an existing mock for a single
|
|
1946
|
+
* invocation. Once invocation `onAccess` has occurred, the mock will revert to
|
|
1947
|
+
* whatever behavior it would have used had `mockImplementationOnce()` not been
|
|
1948
|
+
* called.
|
|
1949
|
+
*
|
|
1950
|
+
* The following example creates a mock function using `t.mock.property()`, calls the
|
|
1951
|
+
* mock property, changes the mock implementation to a different value for the
|
|
1952
|
+
* next invocation, and then resumes its previous behavior.
|
|
1953
|
+
*
|
|
1954
|
+
* ```js
|
|
1955
|
+
* test('changes a mock behavior once', (t) => {
|
|
1956
|
+
* const obj = { foo: 1 };
|
|
1957
|
+
*
|
|
1958
|
+
* const prop = t.mock.property(obj, 'foo', 5);
|
|
1959
|
+
*
|
|
1960
|
+
* assert.strictEqual(obj.foo, 5);
|
|
1961
|
+
* prop.mock.mockImplementationOnce(25);
|
|
1962
|
+
* assert.strictEqual(obj.foo, 25);
|
|
1963
|
+
* assert.strictEqual(obj.foo, 5);
|
|
1964
|
+
* });
|
|
1965
|
+
* ```
|
|
1966
|
+
* @param value The value to be used as the mock's
|
|
1967
|
+
* implementation for the invocation number specified by `onAccess`.
|
|
1968
|
+
* @param onAccess The invocation number that will use `value`. If
|
|
1969
|
+
* the specified invocation has already occurred then an exception is thrown.
|
|
1970
|
+
* **Default:** The number of the next invocation.
|
|
1971
|
+
*/
|
|
1972
|
+
mockImplementationOnce(value: PropertyType, onAccess?: number): void;
|
|
1973
|
+
/**
|
|
1974
|
+
* Resets the access history of the mocked property.
|
|
1975
|
+
*/
|
|
1976
|
+
resetAccesses(): void;
|
|
1977
|
+
/**
|
|
1978
|
+
* Resets the implementation of the mock property to its original behavior. The
|
|
1979
|
+
* mock can still be used after calling this function.
|
|
1980
|
+
*/
|
|
1981
|
+
restore(): void;
|
|
1982
|
+
}
|
|
1879
1983
|
interface MockTimersOptions {
|
|
1880
1984
|
apis: ReadonlyArray<"setInterval" | "setTimeout" | "setImmediate" | "Date">;
|
|
1881
1985
|
now?: number | Date | undefined;
|
|
@@ -315,6 +315,17 @@ declare module "url" {
|
|
|
315
315
|
* @return The fully-resolved platform-specific Node.js file path.
|
|
316
316
|
*/
|
|
317
317
|
function fileURLToPath(url: string | URL, options?: FileUrlToPathOptions): string;
|
|
318
|
+
/**
|
|
319
|
+
* Like `url.fileURLToPath(...)` except that instead of returning a string
|
|
320
|
+
* representation of the path, a `Buffer` is returned. This conversion is
|
|
321
|
+
* helpful when the input URL contains percent-encoded segments that are
|
|
322
|
+
* not valid UTF-8 / Unicode sequences.
|
|
323
|
+
* @since v24.3.0
|
|
324
|
+
* @param url The file URL string or URL object to convert to a path.
|
|
325
|
+
* @returns The fully-resolved platform-specific Node.js file path
|
|
326
|
+
* as a `Buffer`.
|
|
327
|
+
*/
|
|
328
|
+
function fileURLToPathBuffer(url: string | URL, options?: FileUrlToPathOptions): Buffer;
|
|
318
329
|
/**
|
|
319
330
|
* This function ensures that `path` is resolved absolutely, and that the URL
|
|
320
331
|
* control characters are correctly encoded when converting into a File URL.
|