@zowe/db2-for-zowe-cli 6.1.18 → 6.1.19
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/node_modules/adm-zip/adm-zip.js +32 -6
- package/node_modules/adm-zip/headers/entryHeader.js +13 -1
- package/node_modules/adm-zip/methods/inflater.js +33 -3
- package/node_modules/adm-zip/package.json +2 -2
- package/node_modules/adm-zip/util/errors.js +3 -0
- package/node_modules/adm-zip/util/utils.js +102 -14
- package/node_modules/adm-zip/zipEntry.js +43 -18
- package/node_modules/adm-zip/zipFile.js +10 -0
- package/node_modules/axios/README.md +41 -106
- package/node_modules/axios/dist/axios.js +931 -278
- package/node_modules/axios/dist/axios.min.js +2 -2
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +948 -268
- package/node_modules/axios/dist/esm/axios.js +948 -268
- package/node_modules/axios/dist/esm/axios.min.js +2 -2
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +925 -242
- package/node_modules/axios/index.d.cts +20 -1
- package/node_modules/axios/index.d.ts +18 -1
- package/node_modules/axios/lib/adapters/fetch.js +73 -20
- package/node_modules/axios/lib/adapters/http.js +145 -26
- package/node_modules/axios/lib/adapters/xhr.js +120 -13
- package/node_modules/axios/lib/core/Axios.js +67 -12
- package/node_modules/axios/lib/core/AxiosError.js +59 -0
- package/node_modules/axios/lib/core/AxiosHeaders.js +17 -4
- package/node_modules/axios/lib/core/InterceptorManager.js +13 -2
- package/node_modules/axios/lib/core/assertParamsAcyclic.js +49 -0
- package/node_modules/axios/lib/core/createMultipartBody.js +37 -0
- package/node_modules/axios/lib/core/dispatchRequest.js +20 -0
- package/node_modules/axios/lib/core/mergeConfig.js +183 -120
- package/node_modules/axios/lib/defaults/transitional.js +1 -0
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/AxiosTransformStream.js +11 -2
- package/node_modules/axios/lib/helpers/Http2Sessions.js +2 -1
- package/node_modules/axios/lib/helpers/composeSignals.js +6 -3
- package/node_modules/axios/lib/helpers/cookies.js +30 -6
- package/node_modules/axios/lib/helpers/estimateDataURLDecodedBytes.js +34 -7
- package/node_modules/axios/lib/helpers/formDataToBlob.js +113 -0
- package/node_modules/axios/lib/helpers/formDataToJSON.js +25 -1
- package/node_modules/axios/lib/helpers/fromDataURI.js +8 -2
- package/node_modules/axios/lib/helpers/isURLSameOrigin.js +4 -9
- package/node_modules/axios/lib/helpers/parseHeaders.js +2 -1
- package/node_modules/axios/lib/helpers/parseProtocol.js +1 -1
- package/node_modules/axios/lib/helpers/resolveConfig.js +16 -3
- package/node_modules/axios/lib/helpers/shouldBypassProxy.js +16 -1
- package/node_modules/axios/lib/utils.js +61 -10
- package/node_modules/axios/package.json +1 -2
- package/node_modules/follow-redirects/README.md +27 -1
- package/node_modules/follow-redirects/index.js +11 -6
- package/node_modules/follow-redirects/package.json +1 -1
- package/node_modules/fs-extra/README.md +0 -1
- package/node_modules/fs-extra/lib/empty/index.js +4 -2
- package/node_modules/fs-extra/lib/util/stat.js +12 -2
- package/node_modules/fs-extra/package.json +1 -1
- package/node_modules/string_decoder/node_modules/safe-buffer/LICENSE +21 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/README.md +584 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/index.d.ts +187 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/index.js +62 -0
- package/node_modules/string_decoder/node_modules/safe-buffer/package.json +37 -0
- package/node_modules/which-typed-array/CHANGELOG.md +14 -0
- package/node_modules/which-typed-array/README.md +0 -2
- package/node_modules/which-typed-array/index.d.ts +288 -11
- package/node_modules/which-typed-array/index.js +6 -7
- package/node_modules/which-typed-array/package.json +12 -11
- package/package.json +1 -6
- package/node_modules/which-typed-array/eslint.config.mjs +0 -12
- package/node_modules/which-typed-array/test/index.js +0 -105
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/LICENSE +0 -0
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/README.md +0 -0
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/chownr.js +0 -0
- /package/node_modules/{tar-fs/node_modules/chownr → chownr}/package.json +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/.travis.yml +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/LICENSE +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/README.md +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/lib/string_decoder.js +0 -0
- /package/node_modules/{tar-stream/node_modules/string_decoder → string_decoder}/package.json +0 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
declare module "safe-buffer" {
|
|
2
|
+
export class Buffer {
|
|
3
|
+
length: number
|
|
4
|
+
write(string: string, offset?: number, length?: number, encoding?: string): number;
|
|
5
|
+
toString(encoding?: string, start?: number, end?: number): string;
|
|
6
|
+
toJSON(): { type: 'Buffer', data: any[] };
|
|
7
|
+
equals(otherBuffer: Buffer): boolean;
|
|
8
|
+
compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
|
|
9
|
+
copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
|
10
|
+
slice(start?: number, end?: number): Buffer;
|
|
11
|
+
writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
|
12
|
+
writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
|
13
|
+
writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
|
14
|
+
writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
|
15
|
+
readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
|
16
|
+
readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
|
17
|
+
readIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
|
18
|
+
readIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
|
19
|
+
readUInt8(offset: number, noAssert?: boolean): number;
|
|
20
|
+
readUInt16LE(offset: number, noAssert?: boolean): number;
|
|
21
|
+
readUInt16BE(offset: number, noAssert?: boolean): number;
|
|
22
|
+
readUInt32LE(offset: number, noAssert?: boolean): number;
|
|
23
|
+
readUInt32BE(offset: number, noAssert?: boolean): number;
|
|
24
|
+
readInt8(offset: number, noAssert?: boolean): number;
|
|
25
|
+
readInt16LE(offset: number, noAssert?: boolean): number;
|
|
26
|
+
readInt16BE(offset: number, noAssert?: boolean): number;
|
|
27
|
+
readInt32LE(offset: number, noAssert?: boolean): number;
|
|
28
|
+
readInt32BE(offset: number, noAssert?: boolean): number;
|
|
29
|
+
readFloatLE(offset: number, noAssert?: boolean): number;
|
|
30
|
+
readFloatBE(offset: number, noAssert?: boolean): number;
|
|
31
|
+
readDoubleLE(offset: number, noAssert?: boolean): number;
|
|
32
|
+
readDoubleBE(offset: number, noAssert?: boolean): number;
|
|
33
|
+
swap16(): Buffer;
|
|
34
|
+
swap32(): Buffer;
|
|
35
|
+
swap64(): Buffer;
|
|
36
|
+
writeUInt8(value: number, offset: number, noAssert?: boolean): number;
|
|
37
|
+
writeUInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
|
38
|
+
writeUInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
|
39
|
+
writeUInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
|
40
|
+
writeUInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
|
41
|
+
writeInt8(value: number, offset: number, noAssert?: boolean): number;
|
|
42
|
+
writeInt16LE(value: number, offset: number, noAssert?: boolean): number;
|
|
43
|
+
writeInt16BE(value: number, offset: number, noAssert?: boolean): number;
|
|
44
|
+
writeInt32LE(value: number, offset: number, noAssert?: boolean): number;
|
|
45
|
+
writeInt32BE(value: number, offset: number, noAssert?: boolean): number;
|
|
46
|
+
writeFloatLE(value: number, offset: number, noAssert?: boolean): number;
|
|
47
|
+
writeFloatBE(value: number, offset: number, noAssert?: boolean): number;
|
|
48
|
+
writeDoubleLE(value: number, offset: number, noAssert?: boolean): number;
|
|
49
|
+
writeDoubleBE(value: number, offset: number, noAssert?: boolean): number;
|
|
50
|
+
fill(value: any, offset?: number, end?: number): this;
|
|
51
|
+
indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
|
52
|
+
lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number;
|
|
53
|
+
includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Allocates a new buffer containing the given {str}.
|
|
57
|
+
*
|
|
58
|
+
* @param str String to store in buffer.
|
|
59
|
+
* @param encoding encoding to use, optional. Default is 'utf8'
|
|
60
|
+
*/
|
|
61
|
+
constructor (str: string, encoding?: string);
|
|
62
|
+
/**
|
|
63
|
+
* Allocates a new buffer of {size} octets.
|
|
64
|
+
*
|
|
65
|
+
* @param size count of octets to allocate.
|
|
66
|
+
*/
|
|
67
|
+
constructor (size: number);
|
|
68
|
+
/**
|
|
69
|
+
* Allocates a new buffer containing the given {array} of octets.
|
|
70
|
+
*
|
|
71
|
+
* @param array The octets to store.
|
|
72
|
+
*/
|
|
73
|
+
constructor (array: Uint8Array);
|
|
74
|
+
/**
|
|
75
|
+
* Produces a Buffer backed by the same allocated memory as
|
|
76
|
+
* the given {ArrayBuffer}.
|
|
77
|
+
*
|
|
78
|
+
*
|
|
79
|
+
* @param arrayBuffer The ArrayBuffer with which to share memory.
|
|
80
|
+
*/
|
|
81
|
+
constructor (arrayBuffer: ArrayBuffer);
|
|
82
|
+
/**
|
|
83
|
+
* Allocates a new buffer containing the given {array} of octets.
|
|
84
|
+
*
|
|
85
|
+
* @param array The octets to store.
|
|
86
|
+
*/
|
|
87
|
+
constructor (array: any[]);
|
|
88
|
+
/**
|
|
89
|
+
* Copies the passed {buffer} data onto a new {Buffer} instance.
|
|
90
|
+
*
|
|
91
|
+
* @param buffer The buffer to copy.
|
|
92
|
+
*/
|
|
93
|
+
constructor (buffer: Buffer);
|
|
94
|
+
prototype: Buffer;
|
|
95
|
+
/**
|
|
96
|
+
* Allocates a new Buffer using an {array} of octets.
|
|
97
|
+
*
|
|
98
|
+
* @param array
|
|
99
|
+
*/
|
|
100
|
+
static from(array: any[]): Buffer;
|
|
101
|
+
/**
|
|
102
|
+
* When passed a reference to the .buffer property of a TypedArray instance,
|
|
103
|
+
* the newly created Buffer will share the same allocated memory as the TypedArray.
|
|
104
|
+
* The optional {byteOffset} and {length} arguments specify a memory range
|
|
105
|
+
* within the {arrayBuffer} that will be shared by the Buffer.
|
|
106
|
+
*
|
|
107
|
+
* @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer()
|
|
108
|
+
* @param byteOffset
|
|
109
|
+
* @param length
|
|
110
|
+
*/
|
|
111
|
+
static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer;
|
|
112
|
+
/**
|
|
113
|
+
* Copies the passed {buffer} data onto a new Buffer instance.
|
|
114
|
+
*
|
|
115
|
+
* @param buffer
|
|
116
|
+
*/
|
|
117
|
+
static from(buffer: Buffer): Buffer;
|
|
118
|
+
/**
|
|
119
|
+
* Creates a new Buffer containing the given JavaScript string {str}.
|
|
120
|
+
* If provided, the {encoding} parameter identifies the character encoding.
|
|
121
|
+
* If not provided, {encoding} defaults to 'utf8'.
|
|
122
|
+
*
|
|
123
|
+
* @param str
|
|
124
|
+
*/
|
|
125
|
+
static from(str: string, encoding?: string): Buffer;
|
|
126
|
+
/**
|
|
127
|
+
* Returns true if {obj} is a Buffer
|
|
128
|
+
*
|
|
129
|
+
* @param obj object to test.
|
|
130
|
+
*/
|
|
131
|
+
static isBuffer(obj: any): obj is Buffer;
|
|
132
|
+
/**
|
|
133
|
+
* Returns true if {encoding} is a valid encoding argument.
|
|
134
|
+
* Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'
|
|
135
|
+
*
|
|
136
|
+
* @param encoding string to test.
|
|
137
|
+
*/
|
|
138
|
+
static isEncoding(encoding: string): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Gives the actual byte length of a string. encoding defaults to 'utf8'.
|
|
141
|
+
* This is not the same as String.prototype.length since that returns the number of characters in a string.
|
|
142
|
+
*
|
|
143
|
+
* @param string string to test.
|
|
144
|
+
* @param encoding encoding used to evaluate (defaults to 'utf8')
|
|
145
|
+
*/
|
|
146
|
+
static byteLength(string: string, encoding?: string): number;
|
|
147
|
+
/**
|
|
148
|
+
* Returns a buffer which is the result of concatenating all the buffers in the list together.
|
|
149
|
+
*
|
|
150
|
+
* If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer.
|
|
151
|
+
* If the list has exactly one item, then the first item of the list is returned.
|
|
152
|
+
* If the list has more than one item, then a new Buffer is created.
|
|
153
|
+
*
|
|
154
|
+
* @param list An array of Buffer objects to concatenate
|
|
155
|
+
* @param totalLength Total length of the buffers when concatenated.
|
|
156
|
+
* If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly.
|
|
157
|
+
*/
|
|
158
|
+
static concat(list: Buffer[], totalLength?: number): Buffer;
|
|
159
|
+
/**
|
|
160
|
+
* The same as buf1.compare(buf2).
|
|
161
|
+
*/
|
|
162
|
+
static compare(buf1: Buffer, buf2: Buffer): number;
|
|
163
|
+
/**
|
|
164
|
+
* Allocates a new buffer of {size} octets.
|
|
165
|
+
*
|
|
166
|
+
* @param size count of octets to allocate.
|
|
167
|
+
* @param fill if specified, buffer will be initialized by calling buf.fill(fill).
|
|
168
|
+
* If parameter is omitted, buffer will be filled with zeros.
|
|
169
|
+
* @param encoding encoding used for call to buf.fill while initalizing
|
|
170
|
+
*/
|
|
171
|
+
static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer;
|
|
172
|
+
/**
|
|
173
|
+
* Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents
|
|
174
|
+
* of the newly created Buffer are unknown and may contain sensitive data.
|
|
175
|
+
*
|
|
176
|
+
* @param size count of octets to allocate
|
|
177
|
+
*/
|
|
178
|
+
static allocUnsafe(size: number): Buffer;
|
|
179
|
+
/**
|
|
180
|
+
* Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents
|
|
181
|
+
* of the newly created Buffer are unknown and may contain sensitive data.
|
|
182
|
+
*
|
|
183
|
+
* @param size count of octets to allocate
|
|
184
|
+
*/
|
|
185
|
+
static allocUnsafeSlow(size: number): Buffer;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/* eslint-disable node/no-deprecated-api */
|
|
2
|
+
var buffer = require('buffer')
|
|
3
|
+
var Buffer = buffer.Buffer
|
|
4
|
+
|
|
5
|
+
// alternative to using Object.keys for old browsers
|
|
6
|
+
function copyProps (src, dst) {
|
|
7
|
+
for (var key in src) {
|
|
8
|
+
dst[key] = src[key]
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
|
|
12
|
+
module.exports = buffer
|
|
13
|
+
} else {
|
|
14
|
+
// Copy properties from require('buffer')
|
|
15
|
+
copyProps(buffer, exports)
|
|
16
|
+
exports.Buffer = SafeBuffer
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function SafeBuffer (arg, encodingOrOffset, length) {
|
|
20
|
+
return Buffer(arg, encodingOrOffset, length)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Copy static methods from Buffer
|
|
24
|
+
copyProps(Buffer, SafeBuffer)
|
|
25
|
+
|
|
26
|
+
SafeBuffer.from = function (arg, encodingOrOffset, length) {
|
|
27
|
+
if (typeof arg === 'number') {
|
|
28
|
+
throw new TypeError('Argument must not be a number')
|
|
29
|
+
}
|
|
30
|
+
return Buffer(arg, encodingOrOffset, length)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
SafeBuffer.alloc = function (size, fill, encoding) {
|
|
34
|
+
if (typeof size !== 'number') {
|
|
35
|
+
throw new TypeError('Argument must be a number')
|
|
36
|
+
}
|
|
37
|
+
var buf = Buffer(size)
|
|
38
|
+
if (fill !== undefined) {
|
|
39
|
+
if (typeof encoding === 'string') {
|
|
40
|
+
buf.fill(fill, encoding)
|
|
41
|
+
} else {
|
|
42
|
+
buf.fill(fill)
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
buf.fill(0)
|
|
46
|
+
}
|
|
47
|
+
return buf
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
SafeBuffer.allocUnsafe = function (size) {
|
|
51
|
+
if (typeof size !== 'number') {
|
|
52
|
+
throw new TypeError('Argument must be a number')
|
|
53
|
+
}
|
|
54
|
+
return Buffer(size)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
SafeBuffer.allocUnsafeSlow = function (size) {
|
|
58
|
+
if (typeof size !== 'number') {
|
|
59
|
+
throw new TypeError('Argument must be a number')
|
|
60
|
+
}
|
|
61
|
+
return buffer.SlowBuffer(size)
|
|
62
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "safe-buffer",
|
|
3
|
+
"description": "Safer Node.js Buffer API",
|
|
4
|
+
"version": "5.1.2",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Feross Aboukhadijeh",
|
|
7
|
+
"email": "feross@feross.org",
|
|
8
|
+
"url": "http://feross.org"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/feross/safe-buffer/issues"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"standard": "*",
|
|
15
|
+
"tape": "^4.0.0"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/feross/safe-buffer",
|
|
18
|
+
"keywords": [
|
|
19
|
+
"buffer",
|
|
20
|
+
"buffer allocate",
|
|
21
|
+
"node security",
|
|
22
|
+
"safe",
|
|
23
|
+
"safe-buffer",
|
|
24
|
+
"security",
|
|
25
|
+
"uninitialized"
|
|
26
|
+
],
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"main": "index.js",
|
|
29
|
+
"types": "index.d.ts",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git://github.com/feross/safe-buffer.git"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"test": "standard && tape test/*.js"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [v1.1.24](https://github.com/inspect-js/which-typed-array/compare/v1.1.23...v1.1.24) - 2026-09-18
|
|
9
|
+
|
|
10
|
+
### Commits
|
|
11
|
+
|
|
12
|
+
- [types] fix the types for good, hopefully [`d746946`](https://github.com/inspect-js/which-typed-array/commit/d746946a8a76dc6e58302de53856aff304dbdb98)
|
|
13
|
+
|
|
14
|
+
## [v1.1.23](https://github.com/inspect-js/which-typed-array/compare/v1.1.22...v1.1.23) - 2026-09-16
|
|
15
|
+
|
|
16
|
+
### Commits
|
|
17
|
+
|
|
18
|
+
- [types] handle a consumer `lib` that lacks `Float16Array` [`7fd78fb`](https://github.com/inspect-js/which-typed-array/commit/7fd78fb1f90d00d1e340457c7e6a00492c1c5e79)
|
|
19
|
+
- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/eslint-config`, `auto-changelog`, `eslint`, `tape` [`885ae7d`](https://github.com/inspect-js/which-typed-array/commit/885ae7d6888b21bcacaae883f86861258196888d)
|
|
20
|
+
- [readme] remove dead badges [`67844dd`](https://github.com/inspect-js/which-typed-array/commit/67844dd30a89dddfc98172672af6372ae2e74d13)
|
|
21
|
+
|
|
8
22
|
## [v1.1.22](https://github.com/inspect-js/which-typed-array/compare/v1.1.21...v1.1.22) - 2026-06-05
|
|
9
23
|
|
|
10
24
|
### Commits
|
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
[![github actions][actions-image]][actions-url]
|
|
4
4
|
[![coverage][codecov-image]][codecov-url]
|
|
5
|
-
[![dependency status][deps-svg]][deps-url]
|
|
6
|
-
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
|
7
5
|
[![License][license-image]][license-url]
|
|
8
6
|
[![Downloads][downloads-image]][downloads-url]
|
|
9
7
|
|
|
@@ -4,32 +4,309 @@
|
|
|
4
4
|
* @param {unknown} value The potential collection
|
|
5
5
|
* @returns {TypedArrayName | false | null} 'Int8Array' | 'Uint8Array' | 'Uint8ClampedArray' | 'Int16Array' | 'Uint16Array' | 'Int32Array' | 'Uint32Array' | 'Float32Array' | 'Float64Array' | 'BigInt64Array' | 'BigUint64Array' | false | null
|
|
6
6
|
*/
|
|
7
|
-
declare function whichTypedArray<T>(
|
|
8
|
-
|
|
7
|
+
declare function whichTypedArray<T>(
|
|
8
|
+
value: T & whichTypedArray.TypedArray,
|
|
9
|
+
): whichTypedArray.WhichTypedArray<T>;
|
|
10
|
+
declare function whichTypedArray<T>(
|
|
11
|
+
value: unknown,
|
|
12
|
+
): false | null | whichTypedArray.TypedArrayName;
|
|
9
13
|
|
|
10
14
|
import TAs from 'available-typed-arrays';
|
|
11
15
|
|
|
16
|
+
/** the names the consumer's `lib` declares a global for, so there is a type to compare against */
|
|
17
|
+
type DeclaredName = whichTypedArray.TypedArrayName & keyof typeof globalThis;
|
|
18
|
+
|
|
19
|
+
/** the names it does not (eg, `Float16Array` under `lib: es2020`), which are still possible at runtime */
|
|
20
|
+
type UndeclaredName = Exclude<whichTypedArray.TypedArrayName, keyof typeof globalThis>;
|
|
21
|
+
|
|
22
|
+
type Instance<Name extends DeclaredName> = typeof globalThis[Name]['prototype'];
|
|
23
|
+
|
|
24
|
+
type IsAny<T> = 0 extends (1 & T) ? true : false;
|
|
25
|
+
|
|
26
|
+
type RequiredKeys<T> = {
|
|
27
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? never : K
|
|
28
|
+
}[keyof T];
|
|
29
|
+
|
|
30
|
+
/** the key types of `T`'s index signatures, found by `{}` having them covered already */
|
|
31
|
+
type IndexKeys<T> = {
|
|
32
|
+
[K in keyof T]-?: {} extends Record<K, never> ? K : never
|
|
33
|
+
}[keyof T];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The keys of `T` that can be read off a value by name. An index signature is not a
|
|
37
|
+
* named member, but a `string`-keyed one cannot be told apart here from the named
|
|
38
|
+
* string members beside it, so it is left in and they are taken at face value.
|
|
39
|
+
*/
|
|
40
|
+
type NamedKeys<T> = Exclude<keyof T, Exclude<IndexKeys<T>, string>>;
|
|
41
|
+
|
|
42
|
+
/** `Object`'s members are on every object type, even though `keyof` does not list them */
|
|
43
|
+
type Apparent<T, K> = K extends keyof T
|
|
44
|
+
? T[K]
|
|
45
|
+
: K extends keyof Object
|
|
46
|
+
? Object[K]
|
|
47
|
+
: unknown;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The typed arrays' symbol-keyed member whose value is a string, which is
|
|
51
|
+
* `Symbol.toStringTag` in a `lib` that declares symbols and `never` in one that
|
|
52
|
+
* does not (`lib: es5`). Deriving it this way leaves the tag comparisons below
|
|
53
|
+
* with no information to go on, rather than naming `Symbol` in a `lib` without it.
|
|
54
|
+
*/
|
|
55
|
+
type TagKey = {
|
|
56
|
+
[K in keyof whichTypedArray.TypedArray & symbol]: whichTypedArray.TypedArray[K] extends string ? K : never
|
|
57
|
+
}[keyof whichTypedArray.TypedArray & symbol];
|
|
58
|
+
|
|
59
|
+
/** `unknown` when `T` says nothing about its own tag, which rules no name out */
|
|
60
|
+
type TagOf<T> = [TagKey] extends [never]
|
|
61
|
+
? unknown
|
|
62
|
+
: TagKey extends keyof T
|
|
63
|
+
? T[TagKey & keyof T]
|
|
64
|
+
: unknown;
|
|
65
|
+
|
|
66
|
+
/** one value can carry both tags when either is assignable to the other */
|
|
67
|
+
type TagsMeet<A, B> = IsAny<A> extends true
|
|
68
|
+
? true
|
|
69
|
+
: IsAny<B> extends true
|
|
70
|
+
? true
|
|
71
|
+
: [Extract<A, B>] extends [never]
|
|
72
|
+
? ([Extract<B, A>] extends [never] ? false : true)
|
|
73
|
+
: true;
|
|
74
|
+
|
|
75
|
+
/** how many levels of members `Related` walks before it stops looking for a conflict */
|
|
76
|
+
type Prev = [
|
|
77
|
+
never,
|
|
78
|
+
0,
|
|
79
|
+
1,
|
|
80
|
+
2,
|
|
81
|
+
3,
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
type Depth = 0 | 1 | 2 | 3 | 4;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* A rough stand-in for the comparability check TypeScript itself runs to decide
|
|
88
|
+
* whether `x === someTypedArray` is worth allowing. One value can be a `Source` and
|
|
89
|
+
* a `Target` at once if the two already share a constituent, or if neither is an
|
|
90
|
+
* object type and one is assignable to the other; failing that, `D` more levels of
|
|
91
|
+
* members and signatures are compared, in this direction only - `Meets` runs both.
|
|
92
|
+
*
|
|
93
|
+
* It is a heuristic, not that check, and it leans towards saying the two can meet.
|
|
94
|
+
* A conflict further down than `D` levels is not looked for, so a name can be left
|
|
95
|
+
* in that no value could produce. It also drops names TypeScript would have allowed:
|
|
96
|
+
* a `Source` that carries a call signature, or a member declared with its own type
|
|
97
|
+
* parameters, meets nothing, and only the last signature of an overloaded member is
|
|
98
|
+
* compared.
|
|
99
|
+
*
|
|
100
|
+
* `Stale` marks a comparison standing in for a name this `lib` has no type for, where
|
|
101
|
+
* a member the `lib` has never heard of is weaker evidence (see `GatedOn`).
|
|
102
|
+
*/
|
|
103
|
+
type Related<Source, Target, D extends Depth, Stale extends boolean> = IsAny<Source> extends true
|
|
104
|
+
? true
|
|
105
|
+
: IsAny<Target> extends true
|
|
106
|
+
? true
|
|
107
|
+
: [Extract<Source, Target>] extends [never]
|
|
108
|
+
? (Widens<Source, Target> extends true ? true : Deeply<Source, Target, D, Stale>)
|
|
109
|
+
: true;
|
|
110
|
+
|
|
111
|
+
/** neither side being an object type, one value fits both when either is assignable to the other */
|
|
112
|
+
type Widens<Source, Target> = [Source] extends [object]
|
|
113
|
+
? false
|
|
114
|
+
: [Target] extends [object]
|
|
115
|
+
? false
|
|
116
|
+
: ([Extract<Target, Source>] extends [never] ? false : true);
|
|
117
|
+
|
|
118
|
+
/** a union on either side only needs one part that can meet one part of the other */
|
|
119
|
+
type Deeply<Source, Target, D extends Depth, Stale extends boolean> = [D] extends [0]
|
|
120
|
+
? true
|
|
121
|
+
: true extends (Source extends unknown
|
|
122
|
+
? (Target extends unknown ? Structurally<Source, Target, D, Stale> : never)
|
|
123
|
+
: never)
|
|
124
|
+
? true
|
|
125
|
+
: false;
|
|
126
|
+
|
|
127
|
+
type Structurally<Source, Target, D extends Depth, Stale extends boolean> = [Source] extends [(...args: infer SP) => infer SR]
|
|
128
|
+
? ([Target] extends [(...args: infer TP) => infer TR]
|
|
129
|
+
? (Related<SR, TR, Prev[D], Stale> extends true ? ParamsRelated<SP, TP, Prev[D], Stale> : false)
|
|
130
|
+
: false)
|
|
131
|
+
: [Target] extends [Function]
|
|
132
|
+
? false
|
|
133
|
+
: [Source] extends [object]
|
|
134
|
+
? ([Target] extends [object] ? Membered<Source, Target, D, Stale> : false)
|
|
135
|
+
: false;
|
|
136
|
+
|
|
137
|
+
/** each pair of parameters only has to meet, in either direction, as with an overridden method */
|
|
138
|
+
type ParamsRelated<SP extends readonly unknown[], TP extends readonly unknown[], D extends Depth, Stale extends boolean> = false extends {
|
|
139
|
+
[K in keyof SP]: K extends keyof TP ? Related<SP[K], TP[K & keyof TP], D, Stale> : true
|
|
140
|
+
}[number]
|
|
141
|
+
? false
|
|
142
|
+
: true;
|
|
143
|
+
|
|
144
|
+
type Membered<Source, Target, D extends Depth, Stale extends boolean> = GatedOn<Source, Target, D, Stale> extends true
|
|
145
|
+
? (TagsMeet<TagOf<Source>, TagOf<Target>> extends true ? EachMember<Source, Target, D, Stale> : false)
|
|
146
|
+
: false;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Whether a member `Target` requires but `Source` lacks counts against the two
|
|
150
|
+
* meeting. At the top of a comparison it does. Below that, in a comparison standing
|
|
151
|
+
* in for a name this `lib` has no type for, one side is the `lib`'s own type for a
|
|
152
|
+
* typed array or one of its members, and a member missing from that is as easily an
|
|
153
|
+
* older `lib`'s gap as a real conflict, so it is not counted - which is how such a
|
|
154
|
+
* name survives an input written in terms of a newer member, as
|
|
155
|
+
* `{ buffer: { byteLength: number } & { resizable: boolean } }` is.
|
|
156
|
+
*/
|
|
157
|
+
type GatedOn<Source, Target, D extends Depth, Stale extends boolean> = [Stale, D] extends [true, 0 | 1 | 2 | 3]
|
|
158
|
+
? true
|
|
159
|
+
: Compatible<Source, Target, Stale>;
|
|
160
|
+
|
|
161
|
+
/** the members of `Target` that `Source`, or `Object` behind it, also has */
|
|
162
|
+
type SharedKeys<Source, Target> = keyof Target & (keyof Source | keyof Object);
|
|
163
|
+
|
|
164
|
+
type EachMember<Source, Target, D extends Depth, Stale extends boolean> = false extends {
|
|
165
|
+
[K in SharedKeys<Source, Target>]: Related<Apparent<Source, K>, Target[K], Prev[D], Stale>
|
|
166
|
+
}[SharedKeys<Source, Target>]
|
|
167
|
+
? false
|
|
168
|
+
: true;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* `Source` has something to offer for every member `Target` requires. `Target`'s
|
|
172
|
+
* optional members are left out on purpose: one value can be a `Source` and a
|
|
173
|
+
* `Target` at once while having none of them.
|
|
174
|
+
*/
|
|
175
|
+
type Compatible<Source, Target, Stale extends boolean> = [Exclude<RequiredKeys<Target>, NamedKeys<Source> | keyof Object>] extends [never]
|
|
176
|
+
? IndexesCovered<Source, Target, Stale>
|
|
177
|
+
: false;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Each index signature `Target` has needs one on `Source` with the same keys, or a
|
|
181
|
+
* value type of `any`, which anything satisfies. Numeric-string keys are the
|
|
182
|
+
* exception: they reach a `number` index signature, so `Source` having one of those
|
|
183
|
+
* covers them, as long as what it holds can be what `Target` asks for.
|
|
184
|
+
*/
|
|
185
|
+
type IndexesCovered<Source, Target, Stale extends boolean> = [{
|
|
186
|
+
[K in IndexKeys<Target>]: IsAny<Target[K & keyof Target]> extends true
|
|
187
|
+
? never
|
|
188
|
+
: (K extends IndexKeys<Source>
|
|
189
|
+
? never
|
|
190
|
+
: (string extends K
|
|
191
|
+
? K
|
|
192
|
+
: (`${number}` extends K
|
|
193
|
+
? (Related<Source[number & keyof Source], Target[K & keyof Target], 1, Stale> extends true ? never : K)
|
|
194
|
+
: K)))
|
|
195
|
+
}[IndexKeys<Target>]] extends [never]
|
|
196
|
+
? true
|
|
197
|
+
: false;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* `T` is not assignable to a plain copy of its own members, which is what a
|
|
201
|
+
* `private`, `protected` or `#private` member does to a class, and what a call or
|
|
202
|
+
* construct signature does to any type - none of which a typed array has, so nothing
|
|
203
|
+
* outside that class can be one.
|
|
204
|
+
*/
|
|
205
|
+
type IsNominal<T> = {
|
|
206
|
+
[K in keyof T]: T[K]
|
|
207
|
+
} extends T
|
|
208
|
+
? false
|
|
209
|
+
: true;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Whether a `T` and an `I` look like they could be one value. A nominal `T` only
|
|
213
|
+
* gets the one direction: nothing outside its class can be a `T`, but a `T` whose
|
|
214
|
+
* members are all there can still be a typed array.
|
|
215
|
+
*/
|
|
216
|
+
type Meets<T, I, Nominal, Stale extends boolean> = Related<T, I, 4, Stale> extends true
|
|
217
|
+
? true
|
|
218
|
+
: (Nominal extends true ? false : Related<I, T, 4, Stale>);
|
|
219
|
+
|
|
220
|
+
type MayBe<T, Name extends DeclaredName> = TagsMeet<TagOf<Instance<Name>>, TagOf<T>> extends true
|
|
221
|
+
? Meets<T, Instance<Name>, IsNominal<T>, false>
|
|
222
|
+
: false;
|
|
223
|
+
|
|
224
|
+
type PossibleNames<T> = {
|
|
225
|
+
[Name in DeclaredName]: MayBe<T, Name> extends true ? Name : never
|
|
226
|
+
}[DeclaredName];
|
|
227
|
+
|
|
228
|
+
/** the members the typed arrays this `lib` declares actually have */
|
|
229
|
+
type KnownKey = keyof Object | {
|
|
230
|
+
[Name in DeclaredName]: keyof Instance<Name>
|
|
231
|
+
}[DeclaredName];
|
|
232
|
+
|
|
233
|
+
type UnknownKeys<T> = Exclude<RequiredKeys<T>, KnownKey>;
|
|
234
|
+
|
|
235
|
+
type WithoutUnknown<T> = Pick<T, Exclude<keyof T, UnknownKeys<T>>>;
|
|
236
|
+
|
|
237
|
+
/** of those, the ones holding data rather than a method */
|
|
238
|
+
type UnknownDataKeys<T> = {
|
|
239
|
+
[K in UnknownKeys<T>]: T[K & keyof T] extends Function ? never : K
|
|
240
|
+
}[UnknownKeys<T>];
|
|
241
|
+
|
|
242
|
+
type MeetsAny<T, Nominal> = true extends {
|
|
243
|
+
[Name in DeclaredName]: Meets<T, Instance<Name>, Nominal, true>
|
|
244
|
+
}[DeclaredName]
|
|
245
|
+
? true
|
|
246
|
+
: false;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* An undeclared name has no type in this `lib`, so there is nothing to compare `T`
|
|
250
|
+
* to: the declared typed arrays stand in for it, with the members `T` requires that
|
|
251
|
+
* none of them has set aside, so that a `T` asking for a member only a newer `lib`
|
|
252
|
+
* knows about - `at` under `lib: es2020` - can still be the name that `lib` lacks.
|
|
253
|
+
*
|
|
254
|
+
* Setting a member aside loses whatever it said, and a member the `lib` has not heard
|
|
255
|
+
* of further down is not counted either (see `GatedOn`), so this is looser than the
|
|
256
|
+
* test for a declared name. A member that is data rather than a method is kept as
|
|
257
|
+
* evidence, on the guess that a newer `lib` mostly adds methods; that guess, and the
|
|
258
|
+
* stand-in itself, are why an undeclared name is the one that survives most often -
|
|
259
|
+
* `DataView`, whose own methods are all set aside, keeps one.
|
|
260
|
+
*/
|
|
261
|
+
type MayBeUndeclared<T> = IsAny<T> extends true
|
|
262
|
+
? true
|
|
263
|
+
: [unknown] extends [T]
|
|
264
|
+
? true
|
|
265
|
+
: [T] extends [Function]
|
|
266
|
+
? false
|
|
267
|
+
: [T] extends [object]
|
|
268
|
+
? ([UnknownDataKeys<T>] extends [never] ? MeetsAny<WithoutUnknown<T>, IsNominal<T>> : false)
|
|
269
|
+
: false;
|
|
270
|
+
|
|
271
|
+
/** a specific tag names the typed array outright; a `string` tag leaves it to the members */
|
|
272
|
+
type PossibleUndeclaredNames<T> = [UndeclaredName] extends [never]
|
|
273
|
+
? never
|
|
274
|
+
: string extends TagOf<T>
|
|
275
|
+
? (MayBeUndeclared<T> extends true ? UndeclaredName : never)
|
|
276
|
+
: Extract<UndeclaredName, TagOf<T>>;
|
|
277
|
+
|
|
12
278
|
declare namespace whichTypedArray {
|
|
13
279
|
export type TypedArrayName = ReturnType<typeof TAs>[number];
|
|
14
280
|
|
|
15
|
-
|
|
281
|
+
// a consumer's `lib` may not declare every name (eg, `Float16Array`), so only look up the globals it has
|
|
282
|
+
export type TypedArrayConstructor = typeof globalThis[TypedArrayName & keyof typeof globalThis];
|
|
16
283
|
|
|
17
284
|
export type TypedArray = TypedArrayConstructor['prototype'];
|
|
18
285
|
|
|
19
286
|
/**
|
|
20
287
|
* Distributes over `T`, so a subset of typed arrays maps to the matching
|
|
21
288
|
* subset of names (`Int8Array | Uint8Array` -> `'Int8Array' | 'Uint8Array'`,
|
|
22
|
-
* never a float16 or bigint name)
|
|
289
|
+
* never a float16 or bigint name), and a `T` that is not definitely a typed
|
|
290
|
+
* array also gets `false | null`.
|
|
291
|
+
*
|
|
292
|
+
* For everything else - `object`, `ArrayBufferView`, `{ length: 0 }`, a
|
|
293
|
+
* duck-typed stand-in - it keeps the names that `T`'s own members do not rule
|
|
294
|
+
* out, so comparing the result to one of those names is usually not reported as a
|
|
295
|
+
* comparison that can never be true. The rule behind that is a heuristic (see
|
|
296
|
+
* `Related`), so it can keep a name no value of `T` could produce, and a `T` whose
|
|
297
|
+
* conflict with a name is buried deeply enough will keep that name too. A name
|
|
298
|
+
* this `lib` has no type for (see `MayBeUndeclared`) is kept more readily still.
|
|
23
299
|
*
|
|
24
300
|
* Derived entirely from `TypedArrayName`, so a new entry in `available-typed-arrays` flows through with no other change here.
|
|
25
301
|
*/
|
|
26
|
-
export type WhichTypedArray<T> =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
302
|
+
export type WhichTypedArray<T> = T extends unknown
|
|
303
|
+
?
|
|
304
|
+
| PossibleNames<T>
|
|
305
|
+
| PossibleUndeclaredNames<T>
|
|
306
|
+
| ([T] extends [TypedArray]
|
|
307
|
+
? (IsAny<T> extends true ? false | null : never)
|
|
308
|
+
: false | null)
|
|
309
|
+
: never;
|
|
33
310
|
}
|
|
34
311
|
|
|
35
312
|
export = whichTypedArray;
|
|
@@ -56,7 +56,7 @@ if (hasToStringTag && gOPD && getProto) {
|
|
|
56
56
|
var arr = new g[typedArray]();
|
|
57
57
|
var fn = arr.slice || arr.set;
|
|
58
58
|
if (fn) {
|
|
59
|
-
var bound = /** @type {BoundSlice | BoundSet} */ (
|
|
59
|
+
var bound = /** @type {typeof BoundSlice | typeof BoundSet} */ (
|
|
60
60
|
// @ts-expect-error TODO FIXME
|
|
61
61
|
callBind(fn)
|
|
62
62
|
);
|
|
@@ -111,11 +111,8 @@ function isTATag(tag) {
|
|
|
111
111
|
return $indexOf(typedArrays, tag) > -1;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
/**
|
|
115
|
-
|
|
116
|
-
* @param {unknown} value
|
|
117
|
-
*/
|
|
118
|
-
module.exports = function whichTypedArray(value) {
|
|
114
|
+
/** @type {(value: unknown) => ReturnType<typeof import('.')>} */
|
|
115
|
+
function whichTypedArray(value) {
|
|
119
116
|
if (!value || typeof value !== 'object') {
|
|
120
117
|
return false;
|
|
121
118
|
}
|
|
@@ -132,4 +129,6 @@ module.exports = function whichTypedArray(value) {
|
|
|
132
129
|
}
|
|
133
130
|
if (!gOPD) { return null; } // unknown engine
|
|
134
131
|
return tryTypedArrays(value);
|
|
135
|
-
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
module.exports = whichTypedArray;
|