@cognite/sdk-core
Advanced tools
Comparing version 1.0.0-rc.0 to 1.0.0
@@ -48,2 +48,32 @@ export interface ListResponse<T> extends CursorResponse<T> { | ||
} | ||
/** | ||
* A Promise to a response that can be awaited like normal, | ||
* but at the risk of not getting all results due to API limits. | ||
* In which case a nextCursor field is returned to request the next page. | ||
* Helper methods are provided to abstract away the pagination. | ||
* | ||
* Example using `client.timeseries.list` with a per-request limit of 1000: | ||
* ```js | ||
* const response = client.timeseries.list({ filter: { assetIds: [ASSET_ID] }, limit: 1000 }); | ||
* ``` | ||
* | ||
* You can get up to 1000 elements with normal await: | ||
* ```js | ||
* const { items, nextCursor } = await response; | ||
* ``` | ||
* | ||
* You can use `autoPagingToArray` to get more items than the per-request limit. | ||
* E.g. an array of up to 5000 items: | ||
* ```js | ||
* const timeseries = await response.autoPagingToArray({ limit: 5000 }); | ||
* ``` | ||
* You may also specify `{ limit: Infinity }` to get all results. | ||
* | ||
* You can also iterate through all items (unless you break out of the loop) like so: | ||
* ```js | ||
* for await (const value of response) { | ||
* // do something to value | ||
* } | ||
* ``` | ||
*/ | ||
export declare type CursorAndAsyncIterator<T> = Promise<ListResponse<T[]>> & CogniteAsyncIterator<T>; | ||
@@ -50,0 +80,0 @@ export interface CogniteAsyncIterator<T> extends AsyncIterableIterator<T> { |
@@ -9,3 +9,3 @@ { | ||
"types": "dist/src/index.d.js", | ||
"version": "1.0.0-rc.0", | ||
"version": "1.0.0", | ||
"scripts": { | ||
@@ -29,3 +29,4 @@ "clean": "rm -rf dist", | ||
"access": "public" | ||
} | ||
}, | ||
"gitHead": "e04804beedf85025df40d0e57519bbb103b66717" | ||
} |
@@ -1,3 +0,3 @@ | ||
A core library used by cognite Javascript SDKs, published as `@cognite/sdk-core`. | ||
It can be used to create custom sdks and alphas, and is used in the official stable and beta SDK. | ||
A core library used by Cognite Javascript SDKs, published as `@cognite/sdk-core`. | ||
It is used in the official stable and beta SDK and can also be used to create custom SDKs and alpha builds. | ||
@@ -4,0 +4,0 @@ See the repository README [here](https://github.com/cognitedata/cognite-sdk-js#readme). |
@@ -45,3 +45,5 @@ // Copyright 2020 Cognite AS | ||
spiedAppendChild.mockImplementation(iframe => { | ||
// @ts-ignore-next-line | ||
iframe.onload(); | ||
return iframe; | ||
}); | ||
@@ -80,3 +82,3 @@ const spiedRemoveChild = jest.spyOn(document.body, 'removeChild'); | ||
}, | ||
}; | ||
} as HTMLIFrameElement; | ||
} | ||
@@ -83,0 +85,0 @@ test('silent login', async () => { |
@@ -61,2 +61,32 @@ // Copyright 2020 Cognite AS | ||
/** | ||
* A Promise to a response that can be awaited like normal, | ||
* but at the risk of not getting all results due to API limits. | ||
* In which case a nextCursor field is returned to request the next page. | ||
* Helper methods are provided to abstract away the pagination. | ||
* | ||
* Example using `client.timeseries.list` with a per-request limit of 1000: | ||
* ```js | ||
* const response = client.timeseries.list({ filter: { assetIds: [ASSET_ID] }, limit: 1000 }); | ||
* ``` | ||
* | ||
* You can get up to 1000 elements with normal await: | ||
* ```js | ||
* const { items, nextCursor } = await response; | ||
* ``` | ||
* | ||
* You can use `autoPagingToArray` to get more items than the per-request limit. | ||
* E.g. an array of up to 5000 items: | ||
* ```js | ||
* const timeseries = await response.autoPagingToArray({ limit: 5000 }); | ||
* ``` | ||
* You may also specify `{ limit: Infinity }` to get all results. | ||
* | ||
* You can also iterate through all items (unless you break out of the loop) like so: | ||
* ```js | ||
* for await (const value of response) { | ||
* // do something to value | ||
* } | ||
* ``` | ||
*/ | ||
export type CursorAndAsyncIterator<T> = Promise<ListResponse<T[]>> & | ||
@@ -63,0 +93,0 @@ CogniteAsyncIterator<T>; |
@@ -6,3 +6,4 @@ { | ||
"outDir": "dist" | ||
} | ||
}, | ||
"include": ["src/"] | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
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
332903
76
7241
0
3