@itwin/core-bentley 5.1.0-dev.60 → 5.1.0-dev.62
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.
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Utils
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* A type that recursively makes all properties of object `T` required, including all properties of nested objects.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export type DeepRequiredObject<T> = T extends object ? {
|
|
9
|
+
[K in keyof T]-?: DeepRequiredObject<T[K]>;
|
|
10
|
+
} : T;
|
|
11
|
+
/**
|
|
12
|
+
* A type that recursively makes all properties of object `T` readonly, including all properties of nested objects.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export type DeepReadonlyObject<T> = T extends object ? {
|
|
16
|
+
readonly [K in keyof T]: DeepReadonlyObject<T[K]>;
|
|
17
|
+
} : T;
|
|
4
18
|
/** The inverse of TypeScript's Readonly<T> type, producing a type that has all the properties of `T` with any `readonly` modifiers removed.
|
|
5
19
|
* @public
|
|
6
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UtilityTypes.d.ts","sourceRoot":"","sources":["../../src/UtilityTypes.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;IACvB,CAAC,UAAU,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC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ot":"","sources":["../../src/UtilityTypes.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;AA+CH,oCAEC;AAMD,oCAEC;AAgFD,oBAKC;AAnGD;;;GAGG;AACH,SAAgB,YAAY,CAAI,GAAQ,EAAE,WAA2B;IACnE,OAAO,QAAQ,KAAK,OAAO,GAAG,IAAI,GAAG,YAAY,WAAW,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAI,GAAQ,EAAE,WAA2B;IACnE,OAAO,YAAY,CAAI,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AAClE,CAAC;AAyED;;;;;;GAMG;AACH,SAAgB,IAAI,CAAmD,CAAI,EAAE,IAAO;IAClF,MAAM,KAAK,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IACvB,KAAK,MAAM,GAAG,IAAI,IAAI;QACpB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utils\n */\n\n/**\n * A type that recursively makes all properties of object `T` required, including all properties of nested objects.\n * @public\n */\nexport type DeepRequiredObject<T> = T extends object\n ? { [K in keyof T]-?: DeepRequiredObject<T[K]> }\n : T\n\n/**\n * A type that recursively makes all properties of object `T` readonly, including all properties of nested objects.\n * @public\n */\nexport type DeepReadonlyObject<T> = T extends object\n ? { readonly [K in keyof T]: DeepReadonlyObject<T[K]> } :\n T\n\n/** The inverse of TypeScript's Readonly<T> type, producing a type that has all the properties of `T` with any `readonly` modifiers removed.\n * @public\n */\nexport type Mutable<T> = {\n -readonly [K in keyof T]: T[K];\n};\n\n/** Make a new type from an existing type `T`, with set of required properties `K` optional.\n * @public\n */\nexport type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\n/** Make a new type from an existing type `T`, with set of optional properties `K` required.\n * @public\n */\nexport type MarkRequired<T, K extends keyof T> = Pick<Required<T>, K> & Omit<T, K>;\n\n/** Generically represents a class `T`, for use in type annotations.\n * @note A variable of type `Constructor<T>` matches a class `T` only if `T` has a **public** constructor.\n * @see [[asInstanceOf]] to attempt to cast an arbitrary value to class `T`.\n * @see [[isInstanceOf]] to determine if an arbitrary value is an instance of class `T`.\n * @public\n */\nexport type Constructor<T> = new (...args: any[]) => T;\n\n/** Returns true if `obj` is an object of class `T`.\n * @see [[asInstanceOf]] to cast `obj` to class `T`.\n * @public\n */\nexport function isInstanceOf<T>(obj: any, constructor: Constructor<T>): boolean {\n return \"object\" === typeof obj && obj instanceof constructor;\n}\n\n/** Cast `obj` to an instance of class `T`, or return undefined if `obj` is not an instance of class `T`.\n * @see [[isInstanceOf]] to query whether `obj` is of class `T`.\n * @public\n */\nexport function asInstanceOf<T>(obj: any, constructor: Constructor<T>): T | undefined {\n return isInstanceOf<T>(obj, constructor) ? obj as T : undefined;\n}\n\n/** Extracts the names of all public properties of `T` that are not of type `function`.\n * This includes properties defined using `get` syntax. Care should be used when using this type in conjunction with\n * the object spread (`...`) operator, because the spread operator omits properties defined using `get` syntax and, therefore,\n * so too does the type that TypeScript infers from that operator.\n * `get` syntax. For example:\n * ```ts\n * class Thing {\n * private _a = \"a\"; // a private variable\n * public b = \"b\"; // a public variable\n * public get c() { return \"c\"; } // a public property\n * public d() { return \"d\"; } // a public method\n * public e = () => \"e\"; // a public variable of type `function`\n * }\n *\n * // The following can have the values \"b\" or \"c\" - those are the public, non-function properties of Thing.\n * let nonFunctionProperty: NonFunctionPropertyNamesOf<Thing> = \"c\";\n *\n * // The following produces an error: \"Property 'c' is missing in type '{ b: string; e: () => string; }' but required in type 'NonFunctionPropertiesOf<Thing>'\"\n * const thing1 = new Thing();\n * const thing2: NonFunctionPropertiesOf<Thing> = { ...thing1 };\n * ```\n * @see [[NonFunctionPropertiesOf]] to obtain a type that includes only these properties.\n * @public\n */\nexport type NonFunctionPropertyNamesOf<T> = {\n [K in keyof T]: T[K] extends (...args: any) => any ? never : K;\n}[keyof T];\n\n/** Produces a type consisting of all of the public properties of `T` except for those of type `function`.\n * @see [[NonFunctionPropertyNamesOf]] for potential pitfalls when used in conjunction with the object spread operator.\n * @public\n */\nexport type NonFunctionPropertiesOf<T> = Pick<T, NonFunctionPropertyNamesOf<T>>;\n\n/** Any function returning a Promise.\n * @see [[AsyncMethodsOf]] to extract all async methods from a type.\n * @see [[PromiseReturnType]] to extract the type to which the Promise resolves.\n * @public\n */\nexport type AsyncFunction = (...args: any[]) => Promise<unknown>;\n\n/** The members of `T` that are async functions (functions that return a promise), and no other properties\n * @public\n */\nexport type PickAsyncMethods<T> = { [P in keyof T]: T[P] extends AsyncFunction ? T[P] : never; };\n\n/** Extracts the names of all function properties of `T` that return a Promise.\n * @public\n */\nexport type AsyncMethodsOf<T> = { [P in keyof T]: T[P] extends AsyncFunction ? P : never }[keyof T];\n\n/** A type that is either `T` or `Promise<T>`.\n * @public\n */\nexport type MaybePromise<T> = T | Promise<T>;\n\n/** Extracts the type to which the Promise returned by an async function resolves.\n * @public\n */\nexport type PromiseReturnType<T extends AsyncFunction> = T extends (...args: any) => Promise<infer R> ? R : any;\n\n/** The members of `T` that are functions and no other properties\n * @public\n */\nexport type PickMethods<T> = { [P in keyof T]: T[P] extends (...args: any) => any ? T[P] : never; };\n\n/** The members of `T` that are functions that do not return a Promise\n * @public\n */\nexport type PickSyncMethods<T> = Omit<PickMethods<T>, AsyncMethodsOf<T>>;\n\n/** A runtime property omitter, makes a shallow copy of the given object without the specified properties\n * Compatible with the typescript `Omit` mapped type:\n * ```js\n * const testvar: Omit<{x: string, y: object}, \"y\"> = omit({x: \"hello\", y: {}}, [\"y\"]);\n * ```\n * @public\n */\nexport function omit<T extends object, K extends readonly (keyof T)[]>(t: T, keys: K): Omit<T, K[number]> {\n const clone = { ...t };\n for (const key of keys)\n delete clone[key];\n return clone;\n}\n\n/** Defines a type wherein at least one of the properties of T is required to exist.\n * In the following example, paying for a coffee requires a customer to have either a credit card, some cash, or both in their wallet.\n * ```ts\n * interface Wallet {\n * cash?: number;\n * card?: CreditCard;\n * }\n *\n * function payForCoffee(wallet: RequireAtLeastOne<Wallet>) { ... }\n * ```\n * Source: [@azure/keyvault-certificates](https://learn.microsoft.com/en-us/javascript/api/@azure/keyvault-certificates/requireatleastone?view=azure-node-latest).\n * @public\n */\nexport type RequireAtLeastOne<T> = {\n [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;\n}[keyof T];\n"]}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
/** @packageDocumentation
|
|
2
2
|
* @module Utils
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* A type that recursively makes all properties of object `T` required, including all properties of nested objects.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export type DeepRequiredObject<T> = T extends object ? {
|
|
9
|
+
[K in keyof T]-?: DeepRequiredObject<T[K]>;
|
|
10
|
+
} : T;
|
|
11
|
+
/**
|
|
12
|
+
* A type that recursively makes all properties of object `T` readonly, including all properties of nested objects.
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
export type DeepReadonlyObject<T> = T extends object ? {
|
|
16
|
+
readonly [K in keyof T]: DeepReadonlyObject<T[K]>;
|
|
17
|
+
} : T;
|
|
4
18
|
/** The inverse of TypeScript's Readonly<T> type, producing a type that has all the properties of `T` with any `readonly` modifiers removed.
|
|
5
19
|
* @public
|
|
6
20
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UtilityTypes.d.ts","sourceRoot":"","sources":["../../src/UtilityTypes.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH;;GAEG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,IAAI;IACvB,CAAC,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GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CAC/E,CAAC,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UtilityTypes.js","sourceRoot":"","sources":["../../src/UtilityTypes.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;
|
|
1
|
+
{"version":3,"file":"UtilityTypes.js","sourceRoot":"","sources":["../../src/UtilityTypes.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AA2CH;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAI,GAAQ,EAAE,WAA2B;IACnE,OAAO,QAAQ,KAAK,OAAO,GAAG,IAAI,GAAG,YAAY,WAAW,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAI,GAAQ,EAAE,WAA2B;IACnE,OAAO,YAAY,CAAI,GAAG,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AAClE,CAAC;AAyED;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAAmD,CAAI,EAAE,IAAO;IAClF,MAAM,KAAK,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IACvB,KAAK,MAAM,GAAG,IAAI,IAAI;QACpB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;IACpB,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Utils\n */\n\n/**\n * A type that recursively makes all properties of object `T` required, including all properties of nested objects.\n * @public\n */\nexport type DeepRequiredObject<T> = T extends object\n ? { [K in keyof T]-?: DeepRequiredObject<T[K]> }\n : T\n\n/**\n * A type that recursively makes all properties of object `T` readonly, including all properties of nested objects.\n * @public\n */\nexport type DeepReadonlyObject<T> = T extends object\n ? { readonly [K in keyof T]: DeepReadonlyObject<T[K]> } :\n T\n\n/** The inverse of TypeScript's Readonly<T> type, producing a type that has all the properties of `T` with any `readonly` modifiers removed.\n * @public\n */\nexport type Mutable<T> = {\n -readonly [K in keyof T]: T[K];\n};\n\n/** Make a new type from an existing type `T`, with set of required properties `K` optional.\n * @public\n */\nexport type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\n/** Make a new type from an existing type `T`, with set of optional properties `K` required.\n * @public\n */\nexport type MarkRequired<T, K extends keyof T> = Pick<Required<T>, K> & Omit<T, K>;\n\n/** Generically represents a class `T`, for use in type annotations.\n * @note A variable of type `Constructor<T>` matches a class `T` only if `T` has a **public** constructor.\n * @see [[asInstanceOf]] to attempt to cast an arbitrary value to class `T`.\n * @see [[isInstanceOf]] to determine if an arbitrary value is an instance of class `T`.\n * @public\n */\nexport type Constructor<T> = new (...args: any[]) => T;\n\n/** Returns true if `obj` is an object of class `T`.\n * @see [[asInstanceOf]] to cast `obj` to class `T`.\n * @public\n */\nexport function isInstanceOf<T>(obj: any, constructor: Constructor<T>): boolean {\n return \"object\" === typeof obj && obj instanceof constructor;\n}\n\n/** Cast `obj` to an instance of class `T`, or return undefined if `obj` is not an instance of class `T`.\n * @see [[isInstanceOf]] to query whether `obj` is of class `T`.\n * @public\n */\nexport function asInstanceOf<T>(obj: any, constructor: Constructor<T>): T | undefined {\n return isInstanceOf<T>(obj, constructor) ? obj as T : undefined;\n}\n\n/** Extracts the names of all public properties of `T` that are not of type `function`.\n * This includes properties defined using `get` syntax. Care should be used when using this type in conjunction with\n * the object spread (`...`) operator, because the spread operator omits properties defined using `get` syntax and, therefore,\n * so too does the type that TypeScript infers from that operator.\n * `get` syntax. For example:\n * ```ts\n * class Thing {\n * private _a = \"a\"; // a private variable\n * public b = \"b\"; // a public variable\n * public get c() { return \"c\"; } // a public property\n * public d() { return \"d\"; } // a public method\n * public e = () => \"e\"; // a public variable of type `function`\n * }\n *\n * // The following can have the values \"b\" or \"c\" - those are the public, non-function properties of Thing.\n * let nonFunctionProperty: NonFunctionPropertyNamesOf<Thing> = \"c\";\n *\n * // The following produces an error: \"Property 'c' is missing in type '{ b: string; e: () => string; }' but required in type 'NonFunctionPropertiesOf<Thing>'\"\n * const thing1 = new Thing();\n * const thing2: NonFunctionPropertiesOf<Thing> = { ...thing1 };\n * ```\n * @see [[NonFunctionPropertiesOf]] to obtain a type that includes only these properties.\n * @public\n */\nexport type NonFunctionPropertyNamesOf<T> = {\n [K in keyof T]: T[K] extends (...args: any) => any ? never : K;\n}[keyof T];\n\n/** Produces a type consisting of all of the public properties of `T` except for those of type `function`.\n * @see [[NonFunctionPropertyNamesOf]] for potential pitfalls when used in conjunction with the object spread operator.\n * @public\n */\nexport type NonFunctionPropertiesOf<T> = Pick<T, NonFunctionPropertyNamesOf<T>>;\n\n/** Any function returning a Promise.\n * @see [[AsyncMethodsOf]] to extract all async methods from a type.\n * @see [[PromiseReturnType]] to extract the type to which the Promise resolves.\n * @public\n */\nexport type AsyncFunction = (...args: any[]) => Promise<unknown>;\n\n/** The members of `T` that are async functions (functions that return a promise), and no other properties\n * @public\n */\nexport type PickAsyncMethods<T> = { [P in keyof T]: T[P] extends AsyncFunction ? T[P] : never; };\n\n/** Extracts the names of all function properties of `T` that return a Promise.\n * @public\n */\nexport type AsyncMethodsOf<T> = { [P in keyof T]: T[P] extends AsyncFunction ? P : never }[keyof T];\n\n/** A type that is either `T` or `Promise<T>`.\n * @public\n */\nexport type MaybePromise<T> = T | Promise<T>;\n\n/** Extracts the type to which the Promise returned by an async function resolves.\n * @public\n */\nexport type PromiseReturnType<T extends AsyncFunction> = T extends (...args: any) => Promise<infer R> ? R : any;\n\n/** The members of `T` that are functions and no other properties\n * @public\n */\nexport type PickMethods<T> = { [P in keyof T]: T[P] extends (...args: any) => any ? T[P] : never; };\n\n/** The members of `T` that are functions that do not return a Promise\n * @public\n */\nexport type PickSyncMethods<T> = Omit<PickMethods<T>, AsyncMethodsOf<T>>;\n\n/** A runtime property omitter, makes a shallow copy of the given object without the specified properties\n * Compatible with the typescript `Omit` mapped type:\n * ```js\n * const testvar: Omit<{x: string, y: object}, \"y\"> = omit({x: \"hello\", y: {}}, [\"y\"]);\n * ```\n * @public\n */\nexport function omit<T extends object, K extends readonly (keyof T)[]>(t: T, keys: K): Omit<T, K[number]> {\n const clone = { ...t };\n for (const key of keys)\n delete clone[key];\n return clone;\n}\n\n/** Defines a type wherein at least one of the properties of T is required to exist.\n * In the following example, paying for a coffee requires a customer to have either a credit card, some cash, or both in their wallet.\n * ```ts\n * interface Wallet {\n * cash?: number;\n * card?: CreditCard;\n * }\n *\n * function payForCoffee(wallet: RequireAtLeastOne<Wallet>) { ... }\n * ```\n * Source: [@azure/keyvault-certificates](https://learn.microsoft.com/en-us/javascript/api/@azure/keyvault-certificates/requireatleastone?view=azure-node-latest).\n * @public\n */\nexport type RequireAtLeastOne<T> = {\n [K in keyof T]-?: Required<Pick<T, K>> & Partial<Pick<T, Exclude<keyof T, K>>>;\n}[keyof T];\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/core-bentley",
|
|
3
|
-
"version": "5.1.0-dev.
|
|
3
|
+
"version": "5.1.0-dev.62",
|
|
4
4
|
"description": "Bentley JavaScript core components",
|
|
5
5
|
"main": "lib/cjs/core-bentley.js",
|
|
6
6
|
"module": "lib/esm/core-bentley.js",
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"url": "http://www.bentley.com"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@itwin/eslint-plugin": "5.
|
|
25
|
+
"@itwin/eslint-plugin": "5.2.2-dev.2",
|
|
26
26
|
"@opentelemetry/api": "1.0.4",
|
|
27
27
|
"@types/node": "~20.17.0",
|
|
28
28
|
"@vitest/coverage-v8": "^3.0.6",
|
|
29
|
-
"eslint": "^9.
|
|
29
|
+
"eslint": "^9.31.0",
|
|
30
30
|
"rimraf": "^6.0.1",
|
|
31
31
|
"typescript": "~5.6.2",
|
|
32
32
|
"vitest": "^3.0.6",
|
|
33
|
-
"@itwin/build-tools": "5.1.0-dev.
|
|
33
|
+
"@itwin/build-tools": "5.1.0-dev.62"
|
|
34
34
|
},
|
|
35
35
|
"nyc": {
|
|
36
36
|
"extends": "./node_modules/@itwin/build-tools/.nycrc"
|
|
@@ -45,6 +45,7 @@
|
|
|
45
45
|
"docs": "betools docs --json=../../generated-docs/core/core-bentley/file.json --tsIndexFile=core-bentley.ts --onlyJson",
|
|
46
46
|
"cover": "vitest --run --coverage",
|
|
47
47
|
"lint": "eslint \"./src/**/*.ts\" 1>&2",
|
|
48
|
-
"lint-fix": "eslint --fix -f visualstudio \"./src/**/*.ts\" 1>&2"
|
|
48
|
+
"lint-fix": "eslint --fix -f visualstudio \"./src/**/*.ts\" 1>&2",
|
|
49
|
+
"lint-deprecation": "eslint --fix -f visualstudio --no-inline-config -c ../../common/config/eslint/eslint.config.deprecation-policy.js \"./src/**/*.ts\""
|
|
49
50
|
}
|
|
50
51
|
}
|