@datocms/rest-client-utils
Advanced tools
Comparing version 3.1.7-alpha.2 to 3.1.7
@@ -17,4 +17,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./deserialize"), exports); | ||
__exportStar(require("./errors"), exports); | ||
__exportStar(require("./deserialize"), exports); | ||
__exportStar(require("./makeCancelablePromise"), exports); | ||
__exportStar(require("./pollJobResult"), exports); | ||
@@ -24,5 +25,5 @@ __exportStar(require("./rawPageIterator"), exports); | ||
__exportStar(require("./serialize"), exports); | ||
__exportStar(require("./makeCancelablePromise"), exports); | ||
__exportStar(require("./toId"), exports); | ||
__exportStar(require("./types"), exports); | ||
__exportStar(require("./wait"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -42,3 +42,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.rawPageIterator = void 0; | ||
exports.warnOnPageQueryParam = exports.rawPageIterator = void 0; | ||
var async_scheduler_1 = require("async-scheduler"); | ||
@@ -113,2 +113,8 @@ function rawPageIterator(pagination, callPerformer, iteratorOptions) { | ||
exports.rawPageIterator = rawPageIterator; | ||
function warnOnPageQueryParam(queryParams) { | ||
if (queryParams && 'page' in queryParams) { | ||
console.warn('Passing a `page` query param on paged iterators has no effect: use the `perPage` option instead.'); | ||
} | ||
} | ||
exports.warnOnPageQueryParam = warnOnPageQueryParam; | ||
//# sourceMappingURL=rawPageIterator.js.map |
@@ -196,3 +196,3 @@ "use strict"; | ||
waitTimeInSecs = response.headers.has('X-RateLimit-Reset') | ||
? parseInt(response.headers.get('X-RateLimit-Reset'), 10) | ||
? Number.parseInt(response.headers.get('X-RateLimit-Reset'), 10) | ||
: retryCount; | ||
@@ -199,0 +199,0 @@ if (logLevel >= LogLevel.BASIC) { |
@@ -40,4 +40,4 @@ "use strict"; | ||
if (options.attributes === '*') { | ||
Object.entries(otherProperties).forEach(function (_a) { | ||
var key = _a[0], value = _a[1]; | ||
for (var _i = 0, _b = Object.entries(otherProperties); _i < _b.length; _i++) { | ||
var _c = _b[_i], key = _c[0], value = _c[1]; | ||
if (options.relationships.includes(key)) { | ||
@@ -65,7 +65,7 @@ if (isRel(value)) { | ||
} | ||
}); | ||
} | ||
} | ||
else if (options.relationships === '*') { | ||
Object.entries(otherProperties).forEach(function (_a) { | ||
var key = _a[0], value = _a[1]; | ||
for (var _d = 0, _e = Object.entries(otherProperties); _d < _e.length; _d++) { | ||
var _f = _e[_d], key = _f[0], value = _f[1]; | ||
if (options.attributes.includes(key)) { | ||
@@ -93,7 +93,7 @@ attributes[key] = value; | ||
} | ||
}); | ||
} | ||
} | ||
else { | ||
Object.entries(otherProperties).forEach(function (_a) { | ||
var key = _a[0], value = _a[1]; | ||
for (var _g = 0, _h = Object.entries(otherProperties); _g < _h.length; _g++) { | ||
var _j = _h[_g], key = _j[0], value = _j[1]; | ||
if (options.attributes.includes(key)) { | ||
@@ -121,3 +121,3 @@ attributes[key] = value; | ||
} | ||
}); | ||
} | ||
} | ||
@@ -124,0 +124,0 @@ return { |
@@ -0,3 +1,4 @@ | ||
export * from './deserialize'; | ||
export * from './errors'; | ||
export * from './deserialize'; | ||
export * from './makeCancelablePromise'; | ||
export * from './pollJobResult'; | ||
@@ -7,4 +8,4 @@ export * from './rawPageIterator'; | ||
export * from './serialize'; | ||
export * from './makeCancelablePromise'; | ||
export * from './toId'; | ||
export * from './types'; | ||
export * from './wait'; |
@@ -0,3 +1,4 @@ | ||
export * from './deserialize'; | ||
export * from './errors'; | ||
export * from './deserialize'; | ||
export * from './makeCancelablePromise'; | ||
export * from './pollJobResult'; | ||
@@ -7,5 +8,5 @@ export * from './rawPageIterator'; | ||
export * from './serialize'; | ||
export * from './makeCancelablePromise'; | ||
export * from './toId'; | ||
export * from './types'; | ||
export * from './wait'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { JobResult } from './internalTypes'; | ||
import type { JobResult } from './internalTypes'; | ||
export declare function pollJobResult(fetcher: () => Promise<JobResult>): Promise<JobResult>; |
@@ -19,2 +19,3 @@ export type IteratorOptions = { | ||
}) => Promise<JsonApiPage<T>>, iteratorOptions?: IteratorOptions): AsyncGenerator<Awaited<T>, void, unknown>; | ||
export declare function warnOnPageQueryParam(queryParams: Record<string, unknown> | undefined): void; | ||
export {}; |
@@ -108,2 +108,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { | ||
} | ||
export function warnOnPageQueryParam(queryParams) { | ||
if (queryParams && 'page' in queryParams) { | ||
console.warn('Passing a `page` query param on paged iterators has no effect: use the `perPage` option instead.'); | ||
} | ||
} | ||
//# sourceMappingURL=rawPageIterator.js.map |
/// <reference lib="dom" /> | ||
import { JobResult } from './internalTypes'; | ||
import type { JobResult } from './internalTypes'; | ||
export declare enum LogLevel { | ||
@@ -4,0 +4,0 @@ /** No logging */ |
@@ -193,3 +193,3 @@ /// <reference lib="dom" /> | ||
waitTimeInSecs = response.headers.has('X-RateLimit-Reset') | ||
? parseInt(response.headers.get('X-RateLimit-Reset'), 10) | ||
? Number.parseInt(response.headers.get('X-RateLimit-Reset'), 10) | ||
: retryCount; | ||
@@ -196,0 +196,0 @@ if (logLevel >= LogLevel.BASIC) { |
@@ -37,4 +37,4 @@ var __assign = (this && this.__assign) || function () { | ||
if (options.attributes === '*') { | ||
Object.entries(otherProperties).forEach(function (_a) { | ||
var key = _a[0], value = _a[1]; | ||
for (var _i = 0, _b = Object.entries(otherProperties); _i < _b.length; _i++) { | ||
var _c = _b[_i], key = _c[0], value = _c[1]; | ||
if (options.relationships.includes(key)) { | ||
@@ -62,7 +62,7 @@ if (isRel(value)) { | ||
} | ||
}); | ||
} | ||
} | ||
else if (options.relationships === '*') { | ||
Object.entries(otherProperties).forEach(function (_a) { | ||
var key = _a[0], value = _a[1]; | ||
for (var _d = 0, _e = Object.entries(otherProperties); _d < _e.length; _d++) { | ||
var _f = _e[_d], key = _f[0], value = _f[1]; | ||
if (options.attributes.includes(key)) { | ||
@@ -90,7 +90,7 @@ attributes[key] = value; | ||
} | ||
}); | ||
} | ||
} | ||
else { | ||
Object.entries(otherProperties).forEach(function (_a) { | ||
var key = _a[0], value = _a[1]; | ||
for (var _g = 0, _h = Object.entries(otherProperties); _g < _h.length; _g++) { | ||
var _j = _h[_g], key = _j[0], value = _j[1]; | ||
if (options.attributes.includes(key)) { | ||
@@ -118,3 +118,3 @@ attributes[key] = value; | ||
} | ||
}); | ||
} | ||
} | ||
@@ -121,0 +121,0 @@ return { |
@@ -0,3 +1,4 @@ | ||
export * from './deserialize'; | ||
export * from './errors'; | ||
export * from './deserialize'; | ||
export * from './makeCancelablePromise'; | ||
export * from './pollJobResult'; | ||
@@ -7,4 +8,4 @@ export * from './rawPageIterator'; | ||
export * from './serialize'; | ||
export * from './makeCancelablePromise'; | ||
export * from './toId'; | ||
export * from './types'; | ||
export * from './wait'; |
@@ -1,2 +0,2 @@ | ||
import { JobResult } from './internalTypes'; | ||
import type { JobResult } from './internalTypes'; | ||
export declare function pollJobResult(fetcher: () => Promise<JobResult>): Promise<JobResult>; |
@@ -19,2 +19,3 @@ export type IteratorOptions = { | ||
}) => Promise<JsonApiPage<T>>, iteratorOptions?: IteratorOptions): AsyncGenerator<Awaited<T>, void, unknown>; | ||
export declare function warnOnPageQueryParam(queryParams: Record<string, unknown> | undefined): void; | ||
export {}; |
/// <reference lib="dom" /> | ||
import { JobResult } from './internalTypes'; | ||
import type { JobResult } from './internalTypes'; | ||
export declare enum LogLevel { | ||
@@ -4,0 +4,0 @@ /** No logging */ |
{ | ||
"name": "@datocms/rest-client-utils", | ||
"version": "3.1.7-alpha.2", | ||
"version": "3.1.7", | ||
"description": "Utilities for DatoCMS REST API clients", | ||
"keywords": [ | ||
"datocms", | ||
"client" | ||
], | ||
"keywords": ["datocms", "client"], | ||
"author": "Stefano Verna <s.verna@datocms.com>", | ||
@@ -20,6 +17,3 @@ "homepage": "https://github.com/datocms/js-rest-api-clients/tree/main/packages/rest-client-utils#readme", | ||
}, | ||
"files": [ | ||
"dist", | ||
"src" | ||
], | ||
"files": ["dist", "src"], | ||
"publishConfig": { | ||
@@ -42,3 +36,3 @@ "access": "public" | ||
}, | ||
"gitHead": "d3211c7e244f11cf2eef4146cf96c7d7d47f9559", | ||
"gitHead": "4d992438454b9a8f30235ef0577b2911c55c88ef", | ||
"devDependencies": { | ||
@@ -45,0 +39,0 @@ "@types/qs": "^6.9.7" |
@@ -9,4 +9,4 @@ const ARRAY_INDEX = '__ARRAY_INDEX__'; | ||
: chunk === ARRAY_INDEX | ||
? `${result}[]` | ||
: `${result}[${chunk}]`, | ||
? `${result}[]` | ||
: `${result}[${chunk}]`, | ||
'', | ||
@@ -13,0 +13,0 @@ ); |
@@ -0,3 +1,4 @@ | ||
export * from './deserialize'; | ||
export * from './errors'; | ||
export * from './deserialize'; | ||
export * from './makeCancelablePromise'; | ||
export * from './pollJobResult'; | ||
@@ -7,4 +8,4 @@ export * from './rawPageIterator'; | ||
export * from './serialize'; | ||
export * from './makeCancelablePromise'; | ||
export * from './toId'; | ||
export * from './types'; | ||
export * from './wait'; |
import { ApiError } from './errors'; | ||
import { JobResult } from './internalTypes'; | ||
import type { JobResult } from './internalTypes'; | ||
import { wait } from './wait'; | ||
@@ -4,0 +4,0 @@ |
@@ -66,1 +66,11 @@ import { Scheduler } from 'async-scheduler'; | ||
} | ||
export function warnOnPageQueryParam( | ||
queryParams: Record<string, unknown> | undefined, | ||
) { | ||
if (queryParams && 'page' in queryParams) { | ||
console.warn( | ||
'Passing a `page` query param on paged iterators has no effect: use the `perPage` option instead.', | ||
); | ||
} | ||
} |
@@ -6,7 +6,7 @@ /// <reference lib="dom" /> | ||
ApiError, | ||
ApiErrorInitObject, | ||
type ApiErrorInitObject, | ||
TimeoutError, | ||
TimeoutErrorInitObject, | ||
type TimeoutErrorInitObject, | ||
} from './errors'; | ||
import { JobResult } from './internalTypes'; | ||
import type { JobResult } from './internalTypes'; | ||
import { | ||
@@ -250,3 +250,3 @@ CanceledPromiseError, | ||
const waitTimeInSecs = response.headers.has('X-RateLimit-Reset') | ||
? parseInt(response.headers.get('X-RateLimit-Reset')!, 10) | ||
? Number.parseInt(response.headers.get('X-RateLimit-Reset')!, 10) | ||
: retryCount; | ||
@@ -253,0 +253,0 @@ |
@@ -47,3 +47,3 @@ type Options = | ||
if (options.attributes === '*') { | ||
Object.entries(otherProperties).forEach(([key, value]) => { | ||
for (const [key, value] of Object.entries(otherProperties)) { | ||
if (options.relationships.includes(key)) { | ||
@@ -65,5 +65,5 @@ if (isRel(value)) { | ||
} | ||
}); | ||
} | ||
} else if (options.relationships === '*') { | ||
Object.entries(otherProperties).forEach(([key, value]) => { | ||
for (const [key, value] of Object.entries(otherProperties)) { | ||
if (options.attributes.includes(key)) { | ||
@@ -85,5 +85,5 @@ attributes[key] = value; | ||
} | ||
}); | ||
} | ||
} else { | ||
Object.entries(otherProperties).forEach(([key, value]) => { | ||
for (const [key, value] of Object.entries(otherProperties)) { | ||
if (options.attributes.includes(key)) { | ||
@@ -105,3 +105,3 @@ attributes[key] = value; | ||
} | ||
}); | ||
} | ||
} | ||
@@ -108,0 +108,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
195354
101
3330
0
4