@rage-against-the-pixel/app-store-connect-api 3.6.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/LICENSE +21 -0
- package/README.md +53 -0
- package/dist/app_store_connect_api/client/index.d.ts +4 -0
- package/dist/app_store_connect_api/client/index.js +121 -0
- package/dist/app_store_connect_api/client/types.d.ts +121 -0
- package/dist/app_store_connect_api/client/types.js +2 -0
- package/dist/app_store_connect_api/client/utils.d.ts +63 -0
- package/dist/app_store_connect_api/client/utils.js +396 -0
- package/dist/app_store_connect_api/index.d.ts +3 -0
- package/dist/app_store_connect_api/index.js +20 -0
- package/dist/app_store_connect_api/schemas.gen.d.ts +36642 -0
- package/dist/app_store_connect_api/schemas.gen.js +37280 -0
- package/dist/app_store_connect_api/services.gen.d.ts +870 -0
- package/dist/app_store_connect_api/services.gen.js +5406 -0
- package/dist/app_store_connect_api/types.gen.d.ts +28458 -0
- package/dist/app_store_connect_api/types.gen.js +3 -0
- package/dist/client.d.ts +45 -0
- package/dist/client.js +94 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -0
- package/package.json +49 -0
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createConfig = exports.urlSearchParamsBodySerializer = exports.jsonBodySerializer = exports.formDataBodySerializer = exports.createInterceptors = exports.mergeHeaders = exports.mergeConfigs = exports.getUrl = exports.getParseAs = exports.createQuerySerializer = void 0;
|
|
4
|
+
const PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
5
|
+
const serializePrimitiveParam = ({ allowReserved, name, value, }) => {
|
|
6
|
+
if (value === undefined || value === null) {
|
|
7
|
+
return '';
|
|
8
|
+
}
|
|
9
|
+
if (typeof value === 'object') {
|
|
10
|
+
throw new Error('Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.');
|
|
11
|
+
}
|
|
12
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
13
|
+
};
|
|
14
|
+
const separatorArrayExplode = (style) => {
|
|
15
|
+
switch (style) {
|
|
16
|
+
case 'label':
|
|
17
|
+
return '.';
|
|
18
|
+
case 'matrix':
|
|
19
|
+
return ';';
|
|
20
|
+
case 'simple':
|
|
21
|
+
return ',';
|
|
22
|
+
default:
|
|
23
|
+
return '&';
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const separatorArrayNoExplode = (style) => {
|
|
27
|
+
switch (style) {
|
|
28
|
+
case 'form':
|
|
29
|
+
return ',';
|
|
30
|
+
case 'pipeDelimited':
|
|
31
|
+
return '|';
|
|
32
|
+
case 'spaceDelimited':
|
|
33
|
+
return '%20';
|
|
34
|
+
default:
|
|
35
|
+
return ',';
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const separatorObjectExplode = (style) => {
|
|
39
|
+
switch (style) {
|
|
40
|
+
case 'label':
|
|
41
|
+
return '.';
|
|
42
|
+
case 'matrix':
|
|
43
|
+
return ';';
|
|
44
|
+
case 'simple':
|
|
45
|
+
return ',';
|
|
46
|
+
default:
|
|
47
|
+
return '&';
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const serializeArrayParam = ({ allowReserved, explode, name, style, value, }) => {
|
|
51
|
+
if (!explode) {
|
|
52
|
+
const joinedValues = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
53
|
+
switch (style) {
|
|
54
|
+
case 'label':
|
|
55
|
+
return `.${joinedValues}`;
|
|
56
|
+
case 'matrix':
|
|
57
|
+
return `;${name}=${joinedValues}`;
|
|
58
|
+
case 'simple':
|
|
59
|
+
return joinedValues;
|
|
60
|
+
default:
|
|
61
|
+
return `${name}=${joinedValues}`;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const separator = separatorArrayExplode(style);
|
|
65
|
+
const joinedValues = value
|
|
66
|
+
.map((v) => {
|
|
67
|
+
if (style === 'label' || style === 'simple') {
|
|
68
|
+
return allowReserved ? v : encodeURIComponent(v);
|
|
69
|
+
}
|
|
70
|
+
return serializePrimitiveParam({
|
|
71
|
+
allowReserved,
|
|
72
|
+
name,
|
|
73
|
+
value: v,
|
|
74
|
+
});
|
|
75
|
+
})
|
|
76
|
+
.join(separator);
|
|
77
|
+
return style === 'label' || style === 'matrix'
|
|
78
|
+
? separator + joinedValues
|
|
79
|
+
: joinedValues;
|
|
80
|
+
};
|
|
81
|
+
const serializeObjectParam = ({ allowReserved, explode, name, style, value, }) => {
|
|
82
|
+
if (value instanceof Date) {
|
|
83
|
+
return `${name}=${value.toISOString()}`;
|
|
84
|
+
}
|
|
85
|
+
if (style !== 'deepObject' && !explode) {
|
|
86
|
+
let values = [];
|
|
87
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
88
|
+
values = [
|
|
89
|
+
...values,
|
|
90
|
+
key,
|
|
91
|
+
allowReserved ? v : encodeURIComponent(v),
|
|
92
|
+
];
|
|
93
|
+
});
|
|
94
|
+
const joinedValues = values.join(',');
|
|
95
|
+
switch (style) {
|
|
96
|
+
case 'form':
|
|
97
|
+
return `${name}=${joinedValues}`;
|
|
98
|
+
case 'label':
|
|
99
|
+
return `.${joinedValues}`;
|
|
100
|
+
case 'matrix':
|
|
101
|
+
return `;${name}=${joinedValues}`;
|
|
102
|
+
default:
|
|
103
|
+
return joinedValues;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const separator = separatorObjectExplode(style);
|
|
107
|
+
const joinedValues = Object.entries(value)
|
|
108
|
+
.map(([key, v]) => serializePrimitiveParam({
|
|
109
|
+
allowReserved,
|
|
110
|
+
name: style === 'deepObject' ? `${name}[${key}]` : key,
|
|
111
|
+
value: v,
|
|
112
|
+
}))
|
|
113
|
+
.join(separator);
|
|
114
|
+
return style === 'label' || style === 'matrix'
|
|
115
|
+
? separator + joinedValues
|
|
116
|
+
: joinedValues;
|
|
117
|
+
};
|
|
118
|
+
const defaultPathSerializer = ({ path, url: _url }) => {
|
|
119
|
+
let url = _url;
|
|
120
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
121
|
+
if (matches) {
|
|
122
|
+
for (const match of matches) {
|
|
123
|
+
let explode = false;
|
|
124
|
+
let name = match.substring(1, match.length - 1);
|
|
125
|
+
let style = 'simple';
|
|
126
|
+
if (name.endsWith('*')) {
|
|
127
|
+
explode = true;
|
|
128
|
+
name = name.substring(0, name.length - 1);
|
|
129
|
+
}
|
|
130
|
+
if (name.startsWith('.')) {
|
|
131
|
+
name = name.substring(1);
|
|
132
|
+
style = 'label';
|
|
133
|
+
}
|
|
134
|
+
else if (name.startsWith(';')) {
|
|
135
|
+
name = name.substring(1);
|
|
136
|
+
style = 'matrix';
|
|
137
|
+
}
|
|
138
|
+
const value = path[name];
|
|
139
|
+
if (value === undefined || value === null) {
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
if (Array.isArray(value)) {
|
|
143
|
+
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
if (typeof value === 'object') {
|
|
147
|
+
url = url.replace(match, serializeObjectParam({
|
|
148
|
+
explode,
|
|
149
|
+
name,
|
|
150
|
+
style,
|
|
151
|
+
value: value,
|
|
152
|
+
}));
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if (style === 'matrix') {
|
|
156
|
+
url = url.replace(match, `;${serializePrimitiveParam({
|
|
157
|
+
name,
|
|
158
|
+
value: value,
|
|
159
|
+
})}`);
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
const replaceValue = encodeURIComponent(style === 'label' ? `.${value}` : value);
|
|
163
|
+
url = url.replace(match, replaceValue);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return url;
|
|
167
|
+
};
|
|
168
|
+
const createQuerySerializer = ({ allowReserved, array, object, } = {}) => {
|
|
169
|
+
const querySerializer = (queryParams) => {
|
|
170
|
+
let search = [];
|
|
171
|
+
if (queryParams && typeof queryParams === 'object') {
|
|
172
|
+
for (const name in queryParams) {
|
|
173
|
+
const value = queryParams[name];
|
|
174
|
+
if (value === undefined || value === null) {
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (Array.isArray(value)) {
|
|
178
|
+
search = [
|
|
179
|
+
...search,
|
|
180
|
+
serializeArrayParam({
|
|
181
|
+
allowReserved,
|
|
182
|
+
explode: true,
|
|
183
|
+
name,
|
|
184
|
+
style: 'form',
|
|
185
|
+
value,
|
|
186
|
+
...array,
|
|
187
|
+
}),
|
|
188
|
+
];
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
if (typeof value === 'object') {
|
|
192
|
+
search = [
|
|
193
|
+
...search,
|
|
194
|
+
serializeObjectParam({
|
|
195
|
+
allowReserved,
|
|
196
|
+
explode: true,
|
|
197
|
+
name,
|
|
198
|
+
style: 'deepObject',
|
|
199
|
+
value: value,
|
|
200
|
+
...object,
|
|
201
|
+
}),
|
|
202
|
+
];
|
|
203
|
+
continue;
|
|
204
|
+
}
|
|
205
|
+
search = [
|
|
206
|
+
...search,
|
|
207
|
+
serializePrimitiveParam({
|
|
208
|
+
allowReserved,
|
|
209
|
+
name,
|
|
210
|
+
value: value,
|
|
211
|
+
}),
|
|
212
|
+
];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return search.join('&');
|
|
216
|
+
};
|
|
217
|
+
return querySerializer;
|
|
218
|
+
};
|
|
219
|
+
exports.createQuerySerializer = createQuerySerializer;
|
|
220
|
+
/**
|
|
221
|
+
* Infers parseAs value from provided Content-Type header.
|
|
222
|
+
*/
|
|
223
|
+
const getParseAs = (content) => {
|
|
224
|
+
if (!content) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (content.startsWith('application/json') || content.endsWith('+json')) {
|
|
228
|
+
return 'json';
|
|
229
|
+
}
|
|
230
|
+
if (content === 'multipart/form-data') {
|
|
231
|
+
return 'formData';
|
|
232
|
+
}
|
|
233
|
+
if (['application/', 'audio/', 'image/', 'video/'].some((type) => content.startsWith(type))) {
|
|
234
|
+
return 'blob';
|
|
235
|
+
}
|
|
236
|
+
if (content.startsWith('text/')) {
|
|
237
|
+
return 'text';
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
exports.getParseAs = getParseAs;
|
|
241
|
+
const getUrl = ({ baseUrl, path, query, querySerializer, url: _url, }) => {
|
|
242
|
+
const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
|
|
243
|
+
let url = baseUrl + pathUrl;
|
|
244
|
+
if (path) {
|
|
245
|
+
url = defaultPathSerializer({ path, url });
|
|
246
|
+
}
|
|
247
|
+
let search = query ? querySerializer(query) : '';
|
|
248
|
+
if (search.startsWith('?')) {
|
|
249
|
+
search = search.substring(1);
|
|
250
|
+
}
|
|
251
|
+
if (search) {
|
|
252
|
+
url += `?${search}`;
|
|
253
|
+
}
|
|
254
|
+
return url;
|
|
255
|
+
};
|
|
256
|
+
exports.getUrl = getUrl;
|
|
257
|
+
const mergeConfigs = (a, b) => {
|
|
258
|
+
const config = { ...a, ...b };
|
|
259
|
+
if (config.baseUrl?.endsWith('/')) {
|
|
260
|
+
config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
261
|
+
}
|
|
262
|
+
config.headers = (0, exports.mergeHeaders)(a.headers, b.headers);
|
|
263
|
+
return config;
|
|
264
|
+
};
|
|
265
|
+
exports.mergeConfigs = mergeConfigs;
|
|
266
|
+
const mergeHeaders = (...headers) => {
|
|
267
|
+
const mergedHeaders = new Headers();
|
|
268
|
+
for (const header of headers) {
|
|
269
|
+
if (!header || typeof header !== 'object') {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
const iterator = header instanceof Headers ? header.entries() : Object.entries(header);
|
|
273
|
+
for (const [key, value] of iterator) {
|
|
274
|
+
if (value === null) {
|
|
275
|
+
mergedHeaders.delete(key);
|
|
276
|
+
}
|
|
277
|
+
else if (Array.isArray(value)) {
|
|
278
|
+
for (const v of value) {
|
|
279
|
+
mergedHeaders.append(key, v);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
else if (value !== undefined) {
|
|
283
|
+
// assume object headers are meant to be JSON stringified, i.e. their
|
|
284
|
+
// content value in OpenAPI specification is 'application/json'
|
|
285
|
+
mergedHeaders.set(key, typeof value === 'object' ? JSON.stringify(value) : value);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
return mergedHeaders;
|
|
290
|
+
};
|
|
291
|
+
exports.mergeHeaders = mergeHeaders;
|
|
292
|
+
class Interceptors {
|
|
293
|
+
_fns;
|
|
294
|
+
constructor() {
|
|
295
|
+
this._fns = [];
|
|
296
|
+
}
|
|
297
|
+
clear() {
|
|
298
|
+
this._fns = [];
|
|
299
|
+
}
|
|
300
|
+
exists(fn) {
|
|
301
|
+
return this._fns.indexOf(fn) !== -1;
|
|
302
|
+
}
|
|
303
|
+
eject(fn) {
|
|
304
|
+
const index = this._fns.indexOf(fn);
|
|
305
|
+
if (index !== -1) {
|
|
306
|
+
this._fns = [...this._fns.slice(0, index), ...this._fns.slice(index + 1)];
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
use(fn) {
|
|
310
|
+
this._fns = [...this._fns, fn];
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
// do not add `Middleware` as return type so we can use _fns internally
|
|
314
|
+
const createInterceptors = () => ({
|
|
315
|
+
error: new Interceptors(),
|
|
316
|
+
request: new Interceptors(),
|
|
317
|
+
response: new Interceptors(),
|
|
318
|
+
});
|
|
319
|
+
exports.createInterceptors = createInterceptors;
|
|
320
|
+
const serializeFormDataPair = (data, key, value) => {
|
|
321
|
+
if (typeof value === 'string' || value instanceof Blob) {
|
|
322
|
+
data.append(key, value);
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
data.append(key, JSON.stringify(value));
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
exports.formDataBodySerializer = {
|
|
329
|
+
bodySerializer: (body) => {
|
|
330
|
+
const data = new FormData();
|
|
331
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
332
|
+
if (value === undefined || value === null) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
if (Array.isArray(value)) {
|
|
336
|
+
value.forEach((v) => serializeFormDataPair(data, key, v));
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
serializeFormDataPair(data, key, value);
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
return data;
|
|
343
|
+
},
|
|
344
|
+
};
|
|
345
|
+
exports.jsonBodySerializer = {
|
|
346
|
+
bodySerializer: (body) => JSON.stringify(body),
|
|
347
|
+
};
|
|
348
|
+
const serializeUrlSearchParamsPair = (data, key, value) => {
|
|
349
|
+
if (typeof value === 'string') {
|
|
350
|
+
data.append(key, value);
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
data.append(key, JSON.stringify(value));
|
|
354
|
+
}
|
|
355
|
+
};
|
|
356
|
+
exports.urlSearchParamsBodySerializer = {
|
|
357
|
+
bodySerializer: (body) => {
|
|
358
|
+
const data = new URLSearchParams();
|
|
359
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
360
|
+
if (value === undefined || value === null) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
if (Array.isArray(value)) {
|
|
364
|
+
value.forEach((v) => serializeUrlSearchParamsPair(data, key, v));
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
serializeUrlSearchParamsPair(data, key, value);
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
return data;
|
|
371
|
+
},
|
|
372
|
+
};
|
|
373
|
+
const defaultQuerySerializer = (0, exports.createQuerySerializer)({
|
|
374
|
+
allowReserved: false,
|
|
375
|
+
array: {
|
|
376
|
+
explode: true,
|
|
377
|
+
style: 'form',
|
|
378
|
+
},
|
|
379
|
+
object: {
|
|
380
|
+
explode: true,
|
|
381
|
+
style: 'deepObject',
|
|
382
|
+
},
|
|
383
|
+
});
|
|
384
|
+
const defaultHeaders = {
|
|
385
|
+
'Content-Type': 'application/json',
|
|
386
|
+
};
|
|
387
|
+
const createConfig = (override = {}) => ({
|
|
388
|
+
...exports.jsonBodySerializer,
|
|
389
|
+
baseUrl: '',
|
|
390
|
+
fetch: globalThis.fetch,
|
|
391
|
+
headers: defaultHeaders,
|
|
392
|
+
parseAs: 'auto',
|
|
393
|
+
querySerializer: defaultQuerySerializer,
|
|
394
|
+
...override,
|
|
395
|
+
});
|
|
396
|
+
exports.createConfig = createConfig;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
18
|
+
__exportStar(require("./schemas.gen"), exports);
|
|
19
|
+
__exportStar(require("./services.gen"), exports);
|
|
20
|
+
__exportStar(require("./types.gen"), exports);
|