parallel-web 0.4.1 → 0.5.0
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/CHANGELOG.md +26 -0
- package/client.d.mts +29 -8
- package/client.d.mts.map +1 -1
- package/client.d.ts +29 -8
- package/client.d.ts.map +1 -1
- package/client.js +34 -4
- package/client.js.map +1 -1
- package/client.mjs +34 -4
- package/client.mjs.map +1 -1
- package/internal/qs/formats.d.mts +7 -0
- package/internal/qs/formats.d.mts.map +1 -0
- package/internal/qs/formats.d.ts +7 -0
- package/internal/qs/formats.d.ts.map +1 -0
- package/internal/qs/formats.js +13 -0
- package/internal/qs/formats.js.map +1 -0
- package/internal/qs/formats.mjs +9 -0
- package/internal/qs/formats.mjs.map +1 -0
- package/internal/qs/index.d.mts +10 -0
- package/internal/qs/index.d.mts.map +1 -0
- package/internal/qs/index.d.ts +10 -0
- package/internal/qs/index.d.ts.map +1 -0
- package/internal/qs/index.js +14 -0
- package/internal/qs/index.js.map +1 -0
- package/internal/qs/index.mjs +10 -0
- package/internal/qs/index.mjs.map +1 -0
- package/internal/qs/stringify.d.mts +3 -0
- package/internal/qs/stringify.d.mts.map +1 -0
- package/internal/qs/stringify.d.ts +3 -0
- package/internal/qs/stringify.d.ts.map +1 -0
- package/internal/qs/stringify.js +277 -0
- package/internal/qs/stringify.js.map +1 -0
- package/internal/qs/stringify.mjs +274 -0
- package/internal/qs/stringify.mjs.map +1 -0
- package/internal/qs/types.d.mts +57 -0
- package/internal/qs/types.d.mts.map +1 -0
- package/internal/qs/types.d.ts +57 -0
- package/internal/qs/types.d.ts.map +1 -0
- package/internal/qs/types.js +3 -0
- package/internal/qs/types.js.map +1 -0
- package/internal/qs/types.mjs +2 -0
- package/internal/qs/types.mjs.map +1 -0
- package/internal/qs/utils.d.mts +15 -0
- package/internal/qs/utils.d.mts.map +1 -0
- package/internal/qs/utils.d.ts +15 -0
- package/internal/qs/utils.d.ts.map +1 -0
- package/internal/qs/utils.js +230 -0
- package/internal/qs/utils.js.map +1 -0
- package/internal/qs/utils.mjs +217 -0
- package/internal/qs/utils.mjs.map +1 -0
- package/internal/types.d.mts +6 -6
- package/internal/types.d.mts.map +1 -1
- package/internal/types.d.ts +6 -6
- package/internal/types.d.ts.map +1 -1
- package/internal/utils/query.d.mts +0 -3
- package/internal/utils/query.d.mts.map +1 -1
- package/internal/utils/query.d.ts +0 -3
- package/internal/utils/query.d.ts.map +1 -1
- package/internal/utils/query.js +3 -16
- package/internal/utils/query.js.map +1 -1
- package/internal/utils/query.mjs +2 -16
- package/internal/utils/query.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/beta/beta.d.mts +11 -19
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +11 -19
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +2 -0
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +2 -0
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/findall.d.mts +127 -177
- package/resources/beta/findall.d.mts.map +1 -1
- package/resources/beta/findall.d.ts +127 -177
- package/resources/beta/findall.d.ts.map +1 -1
- package/resources/beta/findall.js +2 -4
- package/resources/beta/findall.js.map +1 -1
- package/resources/beta/findall.mjs +2 -4
- package/resources/beta/findall.mjs.map +1 -1
- package/resources/beta/index.d.mts +2 -2
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +2 -2
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/task-group.d.mts +22 -143
- package/resources/beta/task-group.d.mts.map +1 -1
- package/resources/beta/task-group.d.ts +22 -143
- package/resources/beta/task-group.d.ts.map +1 -1
- package/resources/beta/task-group.js +7 -42
- package/resources/beta/task-group.js.map +1 -1
- package/resources/beta/task-group.mjs +7 -42
- package/resources/beta/task-group.mjs.map +1 -1
- package/resources/beta/task-run.d.mts +22 -70
- package/resources/beta/task-run.d.mts.map +1 -1
- package/resources/beta/task-run.d.ts +22 -70
- package/resources/beta/task-run.d.ts.map +1 -1
- package/resources/beta/task-run.js +1 -1
- package/resources/beta/task-run.mjs +1 -1
- package/resources/index.d.mts +4 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +4 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -0
- package/resources/index.mjs.map +1 -1
- package/resources/monitor.d.mts +625 -0
- package/resources/monitor.d.mts.map +1 -0
- package/resources/monitor.d.ts +625 -0
- package/resources/monitor.d.ts.map +1 -0
- package/resources/monitor.js +140 -0
- package/resources/monitor.js.map +1 -0
- package/resources/monitor.mjs +136 -0
- package/resources/monitor.mjs.map +1 -0
- package/resources/task-group.d.mts +213 -0
- package/resources/task-group.d.mts.map +1 -0
- package/resources/task-group.d.ts +213 -0
- package/resources/task-group.d.ts.map +1 -0
- package/resources/task-group.js +95 -0
- package/resources/task-group.js.map +1 -0
- package/resources/task-group.mjs +91 -0
- package/resources/task-group.mjs.map +1 -0
- package/resources/task-run.d.mts +97 -80
- package/resources/task-run.d.mts.map +1 -1
- package/resources/task-run.d.ts +97 -80
- package/resources/task-run.d.ts.map +1 -1
- package/resources/task-run.js +14 -1
- package/resources/task-run.js.map +1 -1
- package/resources/task-run.mjs +14 -1
- package/resources/task-run.mjs.map +1 -1
- package/resources/top-level.d.mts +19 -15
- package/resources/top-level.d.mts.map +1 -1
- package/resources/top-level.d.ts +19 -15
- package/resources/top-level.d.ts.map +1 -1
- package/src/client.ts +120 -4
- package/src/internal/qs/LICENSE.md +13 -0
- package/src/internal/qs/README.md +3 -0
- package/src/internal/qs/formats.ts +10 -0
- package/src/internal/qs/index.ts +13 -0
- package/src/internal/qs/stringify.ts +385 -0
- package/src/internal/qs/types.ts +71 -0
- package/src/internal/qs/utils.ts +265 -0
- package/src/internal/types.ts +6 -8
- package/src/internal/utils/query.ts +2 -18
- package/src/resources/beta/api.md +9 -5
- package/src/resources/beta/beta.ts +26 -20
- package/src/resources/beta/findall.ts +153 -202
- package/src/resources/beta/index.ts +7 -4
- package/src/resources/beta/task-group.ts +30 -157
- package/src/resources/beta/task-run.ts +26 -86
- package/src/resources/index.ts +42 -0
- package/src/resources/monitor.ts +752 -0
- package/src/resources/task-group.ts +315 -0
- package/src/resources/task-run.ts +122 -95
- package/src/resources/top-level.ts +23 -15
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export type Format = 'RFC1738' | 'RFC3986';
|
|
2
|
+
|
|
3
|
+
export type DefaultEncoder = (str: any, defaultEncoder?: any, charset?: string) => string;
|
|
4
|
+
export type DefaultDecoder = (str: string, decoder?: any, charset?: string) => string;
|
|
5
|
+
|
|
6
|
+
export type BooleanOptional = boolean | undefined;
|
|
7
|
+
|
|
8
|
+
export type StringifyBaseOptions = {
|
|
9
|
+
delimiter?: string;
|
|
10
|
+
allowDots?: boolean;
|
|
11
|
+
encodeDotInKeys?: boolean;
|
|
12
|
+
strictNullHandling?: boolean;
|
|
13
|
+
skipNulls?: boolean;
|
|
14
|
+
encode?: boolean;
|
|
15
|
+
encoder?: (
|
|
16
|
+
str: any,
|
|
17
|
+
defaultEncoder: DefaultEncoder,
|
|
18
|
+
charset: string,
|
|
19
|
+
type: 'key' | 'value',
|
|
20
|
+
format?: Format,
|
|
21
|
+
) => string;
|
|
22
|
+
filter?: Array<PropertyKey> | ((prefix: PropertyKey, value: any) => any);
|
|
23
|
+
arrayFormat?: 'indices' | 'brackets' | 'repeat' | 'comma';
|
|
24
|
+
indices?: boolean;
|
|
25
|
+
sort?: ((a: PropertyKey, b: PropertyKey) => number) | null;
|
|
26
|
+
serializeDate?: (d: Date) => string;
|
|
27
|
+
format?: 'RFC1738' | 'RFC3986';
|
|
28
|
+
formatter?: (str: PropertyKey) => string;
|
|
29
|
+
encodeValuesOnly?: boolean;
|
|
30
|
+
addQueryPrefix?: boolean;
|
|
31
|
+
charset?: 'utf-8' | 'iso-8859-1';
|
|
32
|
+
charsetSentinel?: boolean;
|
|
33
|
+
allowEmptyArrays?: boolean;
|
|
34
|
+
commaRoundTrip?: boolean;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type StringifyOptions = StringifyBaseOptions;
|
|
38
|
+
|
|
39
|
+
export type ParseBaseOptions = {
|
|
40
|
+
comma?: boolean;
|
|
41
|
+
delimiter?: string | RegExp;
|
|
42
|
+
depth?: number | false;
|
|
43
|
+
decoder?: (str: string, defaultDecoder: DefaultDecoder, charset: string, type: 'key' | 'value') => any;
|
|
44
|
+
arrayLimit?: number;
|
|
45
|
+
parseArrays?: boolean;
|
|
46
|
+
plainObjects?: boolean;
|
|
47
|
+
allowPrototypes?: boolean;
|
|
48
|
+
allowSparse?: boolean;
|
|
49
|
+
parameterLimit?: number;
|
|
50
|
+
strictDepth?: boolean;
|
|
51
|
+
strictNullHandling?: boolean;
|
|
52
|
+
ignoreQueryPrefix?: boolean;
|
|
53
|
+
charset?: 'utf-8' | 'iso-8859-1';
|
|
54
|
+
charsetSentinel?: boolean;
|
|
55
|
+
interpretNumericEntities?: boolean;
|
|
56
|
+
allowEmptyArrays?: boolean;
|
|
57
|
+
duplicates?: 'combine' | 'first' | 'last';
|
|
58
|
+
allowDots?: boolean;
|
|
59
|
+
decodeDotInKeys?: boolean;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export type ParseOptions = ParseBaseOptions;
|
|
63
|
+
|
|
64
|
+
export type ParsedQs = {
|
|
65
|
+
[key: string]: undefined | string | string[] | ParsedQs | ParsedQs[];
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// Type to remove null or undefined union from each property
|
|
69
|
+
export type NonNullableProperties<T> = {
|
|
70
|
+
[K in keyof T]-?: Exclude<T[K], undefined | null>;
|
|
71
|
+
};
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { RFC1738 } from './formats';
|
|
2
|
+
import type { DefaultEncoder, Format } from './types';
|
|
3
|
+
import { isArray } from '../utils/values';
|
|
4
|
+
|
|
5
|
+
export let has = (obj: object, key: PropertyKey): boolean => (
|
|
6
|
+
(has = (Object as any).hasOwn ?? Function.prototype.call.bind(Object.prototype.hasOwnProperty)),
|
|
7
|
+
has(obj, key)
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
const hex_table = /* @__PURE__ */ (() => {
|
|
11
|
+
const array = [];
|
|
12
|
+
for (let i = 0; i < 256; ++i) {
|
|
13
|
+
array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return array;
|
|
17
|
+
})();
|
|
18
|
+
|
|
19
|
+
function compact_queue<T extends Record<string, any>>(queue: Array<{ obj: T; prop: string }>) {
|
|
20
|
+
while (queue.length > 1) {
|
|
21
|
+
const item = queue.pop();
|
|
22
|
+
if (!item) continue;
|
|
23
|
+
|
|
24
|
+
const obj = item.obj[item.prop];
|
|
25
|
+
|
|
26
|
+
if (isArray(obj)) {
|
|
27
|
+
const compacted: unknown[] = [];
|
|
28
|
+
|
|
29
|
+
for (let j = 0; j < obj.length; ++j) {
|
|
30
|
+
if (typeof obj[j] !== 'undefined') {
|
|
31
|
+
compacted.push(obj[j]);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
item.obj[item.prop] = compacted;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function array_to_object(source: any[], options: { plainObjects: boolean }) {
|
|
42
|
+
const obj = options && options.plainObjects ? Object.create(null) : {};
|
|
43
|
+
for (let i = 0; i < source.length; ++i) {
|
|
44
|
+
if (typeof source[i] !== 'undefined') {
|
|
45
|
+
obj[i] = source[i];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return obj;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function merge(
|
|
53
|
+
target: any,
|
|
54
|
+
source: any,
|
|
55
|
+
options: { plainObjects?: boolean; allowPrototypes?: boolean } = {},
|
|
56
|
+
) {
|
|
57
|
+
if (!source) {
|
|
58
|
+
return target;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (typeof source !== 'object') {
|
|
62
|
+
if (isArray(target)) {
|
|
63
|
+
target.push(source);
|
|
64
|
+
} else if (target && typeof target === 'object') {
|
|
65
|
+
if ((options && (options.plainObjects || options.allowPrototypes)) || !has(Object.prototype, source)) {
|
|
66
|
+
target[source] = true;
|
|
67
|
+
}
|
|
68
|
+
} else {
|
|
69
|
+
return [target, source];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return target;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!target || typeof target !== 'object') {
|
|
76
|
+
return [target].concat(source);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let mergeTarget = target;
|
|
80
|
+
if (isArray(target) && !isArray(source)) {
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
mergeTarget = array_to_object(target, options);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (isArray(target) && isArray(source)) {
|
|
86
|
+
source.forEach(function (item, i) {
|
|
87
|
+
if (has(target, i)) {
|
|
88
|
+
const targetItem = target[i];
|
|
89
|
+
if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
|
|
90
|
+
target[i] = merge(targetItem, item, options);
|
|
91
|
+
} else {
|
|
92
|
+
target.push(item);
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
target[i] = item;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return target;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return Object.keys(source).reduce(function (acc, key) {
|
|
102
|
+
const value = source[key];
|
|
103
|
+
|
|
104
|
+
if (has(acc, key)) {
|
|
105
|
+
acc[key] = merge(acc[key], value, options);
|
|
106
|
+
} else {
|
|
107
|
+
acc[key] = value;
|
|
108
|
+
}
|
|
109
|
+
return acc;
|
|
110
|
+
}, mergeTarget);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export function assign_single_source(target: any, source: any) {
|
|
114
|
+
return Object.keys(source).reduce(function (acc, key) {
|
|
115
|
+
acc[key] = source[key];
|
|
116
|
+
return acc;
|
|
117
|
+
}, target);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function decode(str: string, _: any, charset: string) {
|
|
121
|
+
const strWithoutPlus = str.replace(/\+/g, ' ');
|
|
122
|
+
if (charset === 'iso-8859-1') {
|
|
123
|
+
// unescape never throws, no try...catch needed:
|
|
124
|
+
return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
|
|
125
|
+
}
|
|
126
|
+
// utf-8
|
|
127
|
+
try {
|
|
128
|
+
return decodeURIComponent(strWithoutPlus);
|
|
129
|
+
} catch (e) {
|
|
130
|
+
return strWithoutPlus;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const limit = 1024;
|
|
135
|
+
|
|
136
|
+
export const encode: (
|
|
137
|
+
str: any,
|
|
138
|
+
defaultEncoder: DefaultEncoder,
|
|
139
|
+
charset: string,
|
|
140
|
+
type: 'key' | 'value',
|
|
141
|
+
format: Format,
|
|
142
|
+
) => string = (str, _defaultEncoder, charset, _kind, format: Format) => {
|
|
143
|
+
// This code was originally written by Brian White for the io.js core querystring library.
|
|
144
|
+
// It has been adapted here for stricter adherence to RFC 3986
|
|
145
|
+
if (str.length === 0) {
|
|
146
|
+
return str;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
let string = str;
|
|
150
|
+
if (typeof str === 'symbol') {
|
|
151
|
+
string = Symbol.prototype.toString.call(str);
|
|
152
|
+
} else if (typeof str !== 'string') {
|
|
153
|
+
string = String(str);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (charset === 'iso-8859-1') {
|
|
157
|
+
return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
|
|
158
|
+
return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
let out = '';
|
|
163
|
+
for (let j = 0; j < string.length; j += limit) {
|
|
164
|
+
const segment = string.length >= limit ? string.slice(j, j + limit) : string;
|
|
165
|
+
const arr = [];
|
|
166
|
+
|
|
167
|
+
for (let i = 0; i < segment.length; ++i) {
|
|
168
|
+
let c = segment.charCodeAt(i);
|
|
169
|
+
if (
|
|
170
|
+
c === 0x2d || // -
|
|
171
|
+
c === 0x2e || // .
|
|
172
|
+
c === 0x5f || // _
|
|
173
|
+
c === 0x7e || // ~
|
|
174
|
+
(c >= 0x30 && c <= 0x39) || // 0-9
|
|
175
|
+
(c >= 0x41 && c <= 0x5a) || // a-z
|
|
176
|
+
(c >= 0x61 && c <= 0x7a) || // A-Z
|
|
177
|
+
(format === RFC1738 && (c === 0x28 || c === 0x29)) // ( )
|
|
178
|
+
) {
|
|
179
|
+
arr[arr.length] = segment.charAt(i);
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (c < 0x80) {
|
|
184
|
+
arr[arr.length] = hex_table[c];
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (c < 0x800) {
|
|
189
|
+
arr[arr.length] = hex_table[0xc0 | (c >> 6)]! + hex_table[0x80 | (c & 0x3f)];
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (c < 0xd800 || c >= 0xe000) {
|
|
194
|
+
arr[arr.length] =
|
|
195
|
+
hex_table[0xe0 | (c >> 12)]! + hex_table[0x80 | ((c >> 6) & 0x3f)] + hex_table[0x80 | (c & 0x3f)];
|
|
196
|
+
continue;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
i += 1;
|
|
200
|
+
c = 0x10000 + (((c & 0x3ff) << 10) | (segment.charCodeAt(i) & 0x3ff));
|
|
201
|
+
|
|
202
|
+
arr[arr.length] =
|
|
203
|
+
hex_table[0xf0 | (c >> 18)]! +
|
|
204
|
+
hex_table[0x80 | ((c >> 12) & 0x3f)] +
|
|
205
|
+
hex_table[0x80 | ((c >> 6) & 0x3f)] +
|
|
206
|
+
hex_table[0x80 | (c & 0x3f)];
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
out += arr.join('');
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return out;
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
export function compact(value: any) {
|
|
216
|
+
const queue = [{ obj: { o: value }, prop: 'o' }];
|
|
217
|
+
const refs = [];
|
|
218
|
+
|
|
219
|
+
for (let i = 0; i < queue.length; ++i) {
|
|
220
|
+
const item = queue[i];
|
|
221
|
+
// @ts-ignore
|
|
222
|
+
const obj = item.obj[item.prop];
|
|
223
|
+
|
|
224
|
+
const keys = Object.keys(obj);
|
|
225
|
+
for (let j = 0; j < keys.length; ++j) {
|
|
226
|
+
const key = keys[j]!;
|
|
227
|
+
const val = obj[key];
|
|
228
|
+
if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
|
|
229
|
+
queue.push({ obj: obj, prop: key });
|
|
230
|
+
refs.push(val);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
compact_queue(queue);
|
|
236
|
+
|
|
237
|
+
return value;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export function is_regexp(obj: any) {
|
|
241
|
+
return Object.prototype.toString.call(obj) === '[object RegExp]';
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
export function is_buffer(obj: any) {
|
|
245
|
+
if (!obj || typeof obj !== 'object') {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export function combine(a: any, b: any) {
|
|
253
|
+
return [].concat(a, b);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export function maybe_map<T>(val: T[], fn: (v: T) => T) {
|
|
257
|
+
if (isArray(val)) {
|
|
258
|
+
const mapped = [];
|
|
259
|
+
for (let i = 0; i < val.length; i += 1) {
|
|
260
|
+
mapped.push(fn(val[i]!));
|
|
261
|
+
}
|
|
262
|
+
return mapped;
|
|
263
|
+
}
|
|
264
|
+
return fn(val);
|
|
265
|
+
}
|
package/src/internal/types.ts
CHANGED
|
@@ -40,7 +40,6 @@ type OverloadedParameters<T> =
|
|
|
40
40
|
: T extends (...args: infer A) => unknown ? A
|
|
41
41
|
: never;
|
|
42
42
|
|
|
43
|
-
/* eslint-disable */
|
|
44
43
|
/**
|
|
45
44
|
* These imports attempt to get types from a parent package's dependencies.
|
|
46
45
|
* Unresolved bare specifiers can trigger [automatic type acquisition][1] in some projects, which
|
|
@@ -63,19 +62,18 @@ type OverloadedParameters<T> =
|
|
|
63
62
|
*
|
|
64
63
|
* [1]: https://www.typescriptlang.org/tsconfig/#typeAcquisition
|
|
65
64
|
*/
|
|
66
|
-
/** @ts-ignore For users with \@types/node */
|
|
65
|
+
/** @ts-ignore For users with \@types/node */ /* prettier-ignore */
|
|
67
66
|
type UndiciTypesRequestInit = NotAny<import('../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici-types/index.d.ts').RequestInit>;
|
|
68
|
-
/** @ts-ignore For users with undici */
|
|
67
|
+
/** @ts-ignore For users with undici */ /* prettier-ignore */
|
|
69
68
|
type UndiciRequestInit = NotAny<import('../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/undici/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/undici/index.d.ts').RequestInit>;
|
|
70
|
-
/** @ts-ignore For users with \@types/bun */
|
|
69
|
+
/** @ts-ignore For users with \@types/bun */ /* prettier-ignore */
|
|
71
70
|
type BunRequestInit = globalThis.FetchRequestInit;
|
|
72
|
-
/** @ts-ignore For users with node-fetch@2 */
|
|
71
|
+
/** @ts-ignore For users with node-fetch@2 */ /* prettier-ignore */
|
|
73
72
|
type NodeFetch2RequestInit = NotAny<import('../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/@types/node-fetch/index.d.ts').RequestInit>;
|
|
74
|
-
/** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */
|
|
73
|
+
/** @ts-ignore For users with node-fetch@3, doesn't need file extension because types are at ./@types/index.d.ts */ /* prettier-ignore */
|
|
75
74
|
type NodeFetch3RequestInit = NotAny<import('../node_modules/node-fetch').RequestInit> | NotAny<import('../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../node_modules/node-fetch').RequestInit> | NotAny<import('../../../../../../../../../../node_modules/node-fetch').RequestInit>;
|
|
76
|
-
/** @ts-ignore For users who use Deno */
|
|
75
|
+
/** @ts-ignore For users who use Deno */ /* prettier-ignore */
|
|
77
76
|
type FetchRequestInit = NonNullable<OverloadedParameters<typeof fetch>[1]>;
|
|
78
|
-
/* eslint-enable */
|
|
79
77
|
|
|
80
78
|
type RequestInits =
|
|
81
79
|
| NotAny<UndiciTypesRequestInit>
|
|
@@ -1,23 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import * as qs from '../qs/stringify';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Basic re-implementation of `qs.stringify` for primitive types.
|
|
7
|
-
*/
|
|
8
5
|
export function stringifyQuery(query: object | Record<string, unknown>) {
|
|
9
|
-
return
|
|
10
|
-
.filter(([_, value]) => typeof value !== 'undefined')
|
|
11
|
-
.map(([key, value]) => {
|
|
12
|
-
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
13
|
-
return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
|
|
14
|
-
}
|
|
15
|
-
if (value === null) {
|
|
16
|
-
return `${encodeURIComponent(key)}=`;
|
|
17
|
-
}
|
|
18
|
-
throw new ParallelError(
|
|
19
|
-
`Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
|
|
20
|
-
);
|
|
21
|
-
})
|
|
22
|
-
.join('&');
|
|
6
|
+
return qs.stringify(query, { arrayFormat: 'comma' });
|
|
23
7
|
}
|
|
@@ -9,6 +9,7 @@ Types:
|
|
|
9
9
|
- <code><a href="./src/resources/beta/beta.ts">WebSearchResult</a></code>
|
|
10
10
|
- <code><a href="./src/resources/beta/beta.ts">ExtractError</a></code>
|
|
11
11
|
- <code><a href="./src/resources/beta/beta.ts">FetchPolicy</a></code>
|
|
12
|
+
- <code><a href="./src/resources/beta/beta.ts">FullContentSettings</a></code>
|
|
12
13
|
- <code><a href="./src/resources/beta/beta.ts">UsageItem</a></code>
|
|
13
14
|
|
|
14
15
|
Methods:
|
|
@@ -40,11 +41,11 @@ Methods:
|
|
|
40
41
|
|
|
41
42
|
Types:
|
|
42
43
|
|
|
43
|
-
- <code><a href="./src/resources/beta/task-group.ts">TaskGroup</a></code>
|
|
44
|
-
- <code><a href="./src/resources/beta/task-group.ts">TaskGroupRunResponse</a></code>
|
|
45
|
-
- <code><a href="./src/resources/beta/task-group.ts">TaskGroupStatus</a></code>
|
|
46
44
|
- <code><a href="./src/resources/beta/task-group.ts">TaskGroupEventsResponse</a></code>
|
|
47
45
|
- <code><a href="./src/resources/beta/task-group.ts">TaskGroupGetRunsResponse</a></code>
|
|
46
|
+
- <code><a href="./src/resources/beta/task-group.ts">TaskGroupStatus</a></code>
|
|
47
|
+
- <code><a href="./src/resources/beta/task-group.ts">TaskGroupStatusEvent</a></code>
|
|
48
|
+
- <code><a href="./src/resources/beta/task-group.ts">TaskGroupRunResponse</a></code>
|
|
48
49
|
|
|
49
50
|
Methods:
|
|
50
51
|
|
|
@@ -58,7 +59,9 @@ Methods:
|
|
|
58
59
|
|
|
59
60
|
Types:
|
|
60
61
|
|
|
62
|
+
- <code><a href="./src/resources/beta/findall.ts">FindAllCandidate</a></code>
|
|
61
63
|
- <code><a href="./src/resources/beta/findall.ts">FindAllCandidateMatchStatusEvent</a></code>
|
|
64
|
+
- <code><a href="./src/resources/beta/findall.ts">FindAllCandidateMetrics</a></code>
|
|
62
65
|
- <code><a href="./src/resources/beta/findall.ts">FindAllCandidatesRequest</a></code>
|
|
63
66
|
- <code><a href="./src/resources/beta/findall.ts">FindAllCandidatesResponse</a></code>
|
|
64
67
|
- <code><a href="./src/resources/beta/findall.ts">FindAllEnrichInput</a></code>
|
|
@@ -66,18 +69,19 @@ Types:
|
|
|
66
69
|
- <code><a href="./src/resources/beta/findall.ts">FindAllRun</a></code>
|
|
67
70
|
- <code><a href="./src/resources/beta/findall.ts">FindAllRunInput</a></code>
|
|
68
71
|
- <code><a href="./src/resources/beta/findall.ts">FindAllRunResult</a></code>
|
|
72
|
+
- <code><a href="./src/resources/beta/findall.ts">FindAllRunStatus</a></code>
|
|
69
73
|
- <code><a href="./src/resources/beta/findall.ts">FindAllRunStatusEvent</a></code>
|
|
70
74
|
- <code><a href="./src/resources/beta/findall.ts">FindAllSchema</a></code>
|
|
71
75
|
- <code><a href="./src/resources/beta/findall.ts">FindAllSchemaUpdatedEvent</a></code>
|
|
72
76
|
- <code><a href="./src/resources/beta/findall.ts">IngestInput</a></code>
|
|
73
|
-
- <code><a href="./src/resources/beta/findall.ts">
|
|
77
|
+
- <code><a href="./src/resources/beta/findall.ts">MatchCondition</a></code>
|
|
74
78
|
- <code><a href="./src/resources/beta/findall.ts">FindAllEventsResponse</a></code>
|
|
75
79
|
|
|
76
80
|
Methods:
|
|
77
81
|
|
|
78
82
|
- <code title="post /v1beta/findall/runs">client.beta.findall.<a href="./src/resources/beta/findall.ts">create</a>({ ...params }) -> FindAllRun</code>
|
|
79
83
|
- <code title="get /v1beta/findall/runs/{findall_id}">client.beta.findall.<a href="./src/resources/beta/findall.ts">retrieve</a>(findallID, { ...params }) -> FindAllRun</code>
|
|
80
|
-
- <code title="post /v1beta/findall/runs/{findall_id}/cancel">client.beta.findall.<a href="./src/resources/beta/findall.ts">cancel</a>(findallID, { ...params }) ->
|
|
84
|
+
- <code title="post /v1beta/findall/runs/{findall_id}/cancel">client.beta.findall.<a href="./src/resources/beta/findall.ts">cancel</a>(findallID, { ...params }) -> void</code>
|
|
81
85
|
- <code title="post /v1beta/findall/candidates">client.beta.findall.<a href="./src/resources/beta/findall.ts">candidates</a>({ ...params }) -> FindAllCandidatesResponse</code>
|
|
82
86
|
- <code title="post /v1beta/findall/runs/{findall_id}/enrich">client.beta.findall.<a href="./src/resources/beta/findall.ts">enrich</a>(findallID, { ...params }) -> FindAllSchema</code>
|
|
83
87
|
- <code title="get /v1beta/findall/runs/{findall_id}/events">client.beta.findall.<a href="./src/resources/beta/findall.ts">events</a>(findallID, { ...params }) -> FindAllEventsResponse</code>
|
|
@@ -7,8 +7,9 @@ import * as FindAllAPI from './findall';
|
|
|
7
7
|
import {
|
|
8
8
|
FindAll,
|
|
9
9
|
FindAllCancelParams,
|
|
10
|
-
|
|
10
|
+
FindAllCandidate,
|
|
11
11
|
FindAllCandidateMatchStatusEvent,
|
|
12
|
+
FindAllCandidateMetrics,
|
|
12
13
|
FindAllCandidatesParams,
|
|
13
14
|
FindAllCandidatesRequest,
|
|
14
15
|
FindAllCandidatesResponse,
|
|
@@ -25,11 +26,13 @@ import {
|
|
|
25
26
|
FindAllRun,
|
|
26
27
|
FindAllRunInput,
|
|
27
28
|
FindAllRunResult,
|
|
29
|
+
FindAllRunStatus,
|
|
28
30
|
FindAllRunStatusEvent,
|
|
29
31
|
FindAllSchema,
|
|
30
32
|
FindAllSchemaParams,
|
|
31
33
|
FindAllSchemaUpdatedEvent,
|
|
32
34
|
IngestInput,
|
|
35
|
+
MatchCondition,
|
|
33
36
|
} from './findall';
|
|
34
37
|
import * as TaskGroupAPI from './task-group';
|
|
35
38
|
import {
|
|
@@ -42,6 +45,7 @@ import {
|
|
|
42
45
|
TaskGroupGetRunsResponse,
|
|
43
46
|
TaskGroupRunResponse,
|
|
44
47
|
TaskGroupStatus,
|
|
48
|
+
TaskGroupStatusEvent,
|
|
45
49
|
} from './task-group';
|
|
46
50
|
import * as TaskRunAPI from './task-run';
|
|
47
51
|
import {
|
|
@@ -236,6 +240,8 @@ export type ExtractError = TopLevelAPI.ExtractError;
|
|
|
236
240
|
|
|
237
241
|
export type FetchPolicy = TopLevelAPI.FetchPolicy;
|
|
238
242
|
|
|
243
|
+
export type FullContentSettings = TopLevelAPI.FullContentSettings;
|
|
244
|
+
|
|
239
245
|
export type UsageItem = TopLevelAPI.UsageItem;
|
|
240
246
|
|
|
241
247
|
export interface BetaExtractParams {
|
|
@@ -266,7 +272,7 @@ export interface BetaExtractParams {
|
|
|
266
272
|
* Body param: Include full content from each URL. Note that if neither objective
|
|
267
273
|
* nor search_queries is provided, excerpts are redundant with full content.
|
|
268
274
|
*/
|
|
269
|
-
full_content?: boolean |
|
|
275
|
+
full_content?: boolean | TopLevelAPI.FullContentSettings;
|
|
270
276
|
|
|
271
277
|
/**
|
|
272
278
|
* Body param: If provided, focuses extracted content on the specified search
|
|
@@ -293,20 +299,6 @@ export interface BetaExtractParams {
|
|
|
293
299
|
betas?: Array<TaskRunAPI.ParallelBeta>;
|
|
294
300
|
}
|
|
295
301
|
|
|
296
|
-
export namespace BetaExtractParams {
|
|
297
|
-
/**
|
|
298
|
-
* Optional settings for returning full content.
|
|
299
|
-
*/
|
|
300
|
-
export interface FullContentSettings {
|
|
301
|
-
/**
|
|
302
|
-
* Optional limit on the number of characters to include in the full content for
|
|
303
|
-
* each url. Full content always starts at the beginning of the page and is
|
|
304
|
-
* truncated at the limit if necessary.
|
|
305
|
-
*/
|
|
306
|
-
max_chars_per_result?: number | null;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
302
|
export interface BetaSearchParams {
|
|
311
303
|
/**
|
|
312
304
|
* Body param: The model generating this request and consuming the results. Enables
|
|
@@ -392,6 +384,7 @@ export interface BetaSearchParams {
|
|
|
392
384
|
}
|
|
393
385
|
|
|
394
386
|
Beta.TaskRun = TaskRun;
|
|
387
|
+
Beta.TaskGroup = TaskGroup;
|
|
395
388
|
Beta.FindAll = FindAll;
|
|
396
389
|
|
|
397
390
|
export declare namespace Beta {
|
|
@@ -403,6 +396,7 @@ export declare namespace Beta {
|
|
|
403
396
|
type WebSearchResult as WebSearchResult,
|
|
404
397
|
type ExtractError as ExtractError,
|
|
405
398
|
type FetchPolicy as FetchPolicy,
|
|
399
|
+
type FullContentSettings as FullContentSettings,
|
|
406
400
|
type UsageItem as UsageItem,
|
|
407
401
|
type BetaExtractParams as BetaExtractParams,
|
|
408
402
|
type BetaSearchParams as BetaSearchParams,
|
|
@@ -424,11 +418,12 @@ export declare namespace Beta {
|
|
|
424
418
|
};
|
|
425
419
|
|
|
426
420
|
export {
|
|
427
|
-
|
|
428
|
-
type TaskGroupRunResponse as TaskGroupRunResponse,
|
|
429
|
-
type TaskGroupStatus as TaskGroupStatus,
|
|
421
|
+
TaskGroup as TaskGroup,
|
|
430
422
|
type TaskGroupEventsResponse as TaskGroupEventsResponse,
|
|
431
423
|
type TaskGroupGetRunsResponse as TaskGroupGetRunsResponse,
|
|
424
|
+
type TaskGroupStatus as TaskGroupStatus,
|
|
425
|
+
type TaskGroupStatusEvent as TaskGroupStatusEvent,
|
|
426
|
+
type TaskGroupRunResponse as TaskGroupRunResponse,
|
|
432
427
|
type TaskGroupCreateParams as TaskGroupCreateParams,
|
|
433
428
|
type TaskGroupAddRunsParams as TaskGroupAddRunsParams,
|
|
434
429
|
type TaskGroupEventsParams as TaskGroupEventsParams,
|
|
@@ -437,7 +432,9 @@ export declare namespace Beta {
|
|
|
437
432
|
|
|
438
433
|
export {
|
|
439
434
|
FindAll as FindAll,
|
|
435
|
+
type FindAllCandidate as FindAllCandidate,
|
|
440
436
|
type FindAllCandidateMatchStatusEvent as FindAllCandidateMatchStatusEvent,
|
|
437
|
+
type FindAllCandidateMetrics as FindAllCandidateMetrics,
|
|
441
438
|
type FindAllCandidatesRequest as FindAllCandidatesRequest,
|
|
442
439
|
type FindAllCandidatesResponse as FindAllCandidatesResponse,
|
|
443
440
|
type FindAllEnrichInput as FindAllEnrichInput,
|
|
@@ -445,11 +442,12 @@ export declare namespace Beta {
|
|
|
445
442
|
type FindAllRun as FindAllRun,
|
|
446
443
|
type FindAllRunInput as FindAllRunInput,
|
|
447
444
|
type FindAllRunResult as FindAllRunResult,
|
|
445
|
+
type FindAllRunStatus as FindAllRunStatus,
|
|
448
446
|
type FindAllRunStatusEvent as FindAllRunStatusEvent,
|
|
449
447
|
type FindAllSchema as FindAllSchema,
|
|
450
448
|
type FindAllSchemaUpdatedEvent as FindAllSchemaUpdatedEvent,
|
|
451
449
|
type IngestInput as IngestInput,
|
|
452
|
-
type
|
|
450
|
+
type MatchCondition as MatchCondition,
|
|
453
451
|
type FindAllEventsResponse as FindAllEventsResponse,
|
|
454
452
|
type FindAllCreateParams as FindAllCreateParams,
|
|
455
453
|
type FindAllRetrieveParams as FindAllRetrieveParams,
|
|
@@ -463,3 +461,11 @@ export declare namespace Beta {
|
|
|
463
461
|
type FindAllSchemaParams as FindAllSchemaParams,
|
|
464
462
|
};
|
|
465
463
|
}
|
|
464
|
+
|
|
465
|
+
// Backwards-compat namespace member (deprecated). `BetaExtractParams.FullContentSettings`
|
|
466
|
+
// was previously a nested interface; the shape now lives as the top-level
|
|
467
|
+
// `FullContentSettings` model.
|
|
468
|
+
export namespace BetaExtractParams {
|
|
469
|
+
/** @deprecated Use `Parallel.FullContentSettings` instead. */
|
|
470
|
+
export type FullContentSettings = TopLevelAPI.FullContentSettings;
|
|
471
|
+
}
|