Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cognite/sdk-core

Package Overview
Dependencies
Maintainers
0
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cognite/sdk-core - npm Package Compare versions

Comparing version 4.10.3 to 4.10.4

4

dist/src/__tests__/testUtils.d.ts

@@ -35,4 +35,4 @@ import BaseCogniteClient from '../baseCogniteClient';

export declare function getSortedPropInArray<T extends {
[key: string]: any;
}>(arr: T[], propName: string): any[];
[key: string]: unknown;
}>(arr: T[], propName: string): unknown[];
export declare function createErrorResponse(status: number, message: string, extra?: object): {

@@ -39,0 +39,0 @@ error: {

@@ -0,6 +1,6 @@

import { IdInfo } from '../../authFlows/legacy';
import { BaseResourceAPI } from '../../baseResourceApi';
import { CDFHttpClient } from '../../httpClient/cdfHttpClient';
import { IdInfo } from '../../authFlows/legacy';
import { MetadataMap } from '../../metadata';
export declare class LoginAPI extends BaseResourceAPI<any> {
import type { CDFHttpClient } from '../../httpClient/cdfHttpClient';
import type { MetadataMap } from '../../metadata';
export declare class LoginAPI extends BaseResourceAPI<unknown> {
/** @hidden */

@@ -7,0 +7,0 @@ constructor(httpClient: CDFHttpClient, map: MetadataMap);

import { BaseResourceAPI } from '../../baseResourceApi';
import { CDFHttpClient } from '../../httpClient/cdfHttpClient';
import { MetadataMap } from '../../metadata';
export declare class LogoutApi extends BaseResourceAPI<any> {
import type { CDFHttpClient } from '../../httpClient/cdfHttpClient';
import type { MetadataMap } from '../../metadata';
export declare class LogoutApi extends BaseResourceAPI<unknown> {
/** @hidden */

@@ -6,0 +6,0 @@ constructor(httpClient: CDFHttpClient, map: MetadataMap);

@@ -28,3 +28,3 @@ export interface ADFSConfig {

constructor({ authority, requestParams }: ADFSConfig);
login(): Promise<string | void>;
login(): Promise<string | undefined>;
handleLoginRedirect(): ADFSToken | null;

@@ -31,0 +31,0 @@ getCDFToken(): Promise<string | null>;

@@ -1,3 +0,3 @@

import { CogniteAsyncIterator, ListResponse } from './types';
import type { CogniteAsyncIterator, ListResponse } from './types';
/** @hidden */
export declare function makeAutoPaginationMethods<T>(firstPagePromise: Promise<ListResponse<T[]>>): CogniteAsyncIterator<T>;
import { LoginAPI } from './api/login/loginApi';
import { LogoutApi } from './api/logout/logoutApi';
import { HttpResponse } from './httpClient/basicHttpClient';
import { HttpHeaders } from './httpClient/httpHeaders';
import { ClientCredentials } from './credentialsAuth';
import type { HttpResponse } from './httpClient/basicHttpClient';
import { CDFHttpClient } from './httpClient/cdfHttpClient';
import type { HttpHeaders } from './httpClient/httpHeaders';
import { RetryValidator } from './httpClient/retryValidator';
import type { RetryableHttpRequestOptions } from './httpClient/retryableHttpClient';
import { MetadataMap } from './metadata';
import { CogniteAPIVersion } from './utils';
import { RetryValidator } from './httpClient/retryValidator';
import { ClientCredentials } from './credentialsAuth';
import { RetryableHttpRequestOptions } from './httpClient/retryableHttpClient';
export interface ClientOptions {

@@ -27,3 +27,3 @@ /** App identifier (ex: 'FileExtractor') */

/** Provider to do the auth job, recommended: @cognite/auth-wrapper */
provider?: any;
provider?: unknown;
/** IdP Credentials */

@@ -110,3 +110,3 @@ credentials?: ClientCredentials;

*/
getMetadata: (value: any) => import("./metadata").Metadata | undefined;
getMetadata: (value: object) => import("./metadata").Metadata | undefined;
/**

@@ -122,3 +122,3 @@ * Basic HTTP method for GET

*/
get: <T = any>(path: string, options?: RetryableHttpRequestOptions | undefined) => Promise<HttpResponse<T>>;
get: <T = unknown>(path: string, options?: RetryableHttpRequestOptions | undefined) => Promise<HttpResponse<T>>;
/**

@@ -134,3 +134,3 @@ * Basic HTTP method for PUT

*/
put: <T = any>(path: string, options?: RetryableHttpRequestOptions | undefined) => Promise<HttpResponse<T>>;
put: <T = unknown>(path: string, options?: RetryableHttpRequestOptions | undefined) => Promise<HttpResponse<T>>;
/**

@@ -147,3 +147,3 @@ * Basic HTTP method for POST

*/
post: <T = any>(path: string, options?: RetryableHttpRequestOptions | undefined) => Promise<HttpResponse<T>>;
post: <T = unknown>(path: string, options?: RetryableHttpRequestOptions | undefined) => Promise<HttpResponse<T>>;
/**

@@ -158,3 +158,3 @@ * Basic HTTP method for DELETE

*/
delete: <T = any>(path: string, options?: RetryableHttpRequestOptions | undefined) => Promise<HttpResponse<T>>;
delete: <T = unknown>(path: string, options?: RetryableHttpRequestOptions | undefined) => Promise<HttpResponse<T>>;
/**

@@ -169,3 +169,3 @@ * Basic HTTP method for PATCH

*/
patch: <T = any>(path: string, options?: RetryableHttpRequestOptions | undefined) => Promise<HttpResponse<T>>;
patch: <T = unknown>(path: string, options?: RetryableHttpRequestOptions | undefined) => Promise<HttpResponse<T>>;
protected initAPIs(): void;

@@ -184,2 +184,2 @@ /**

export declare type BaseRequestOptions = RetryableHttpRequestOptions;
export declare type Response = HttpResponse<any>;
export declare type Response = HttpResponse<unknown>;

@@ -1,6 +0,6 @@

import { HttpResponse, HttpRequestOptions, HttpQueryParams } from './httpClient/basicHttpClient';
import { CDFHttpClient } from './httpClient/cdfHttpClient';
import { MetadataMap } from './metadata';
import { CursorAndAsyncIterator, CursorResponse, FilterQuery, IdEither, ItemsWrapper, ListResponse } from './types';
import DateParser from './dateParser';
import type { HttpQueryParams, HttpRequestOptions, HttpResponse } from './httpClient/basicHttpClient';
import type { CDFHttpClient } from './httpClient/cdfHttpClient';
import type { MetadataMap } from './metadata';
import type { CursorAndAsyncIterator, CursorResponse, FilterQuery, IdEither, ItemsWrapper, ListResponse } from './types';
/** @hidden */

@@ -46,15 +46,15 @@ export declare abstract class BaseResourceAPI<ResponseType> {

protected listEndpoint<QueryType extends FilterQuery>(endpointCaller: ListEndpoint<QueryType, ResponseType[]>, scope?: QueryType): CursorAndAsyncIterator<ResponseType>;
protected retrieveEndpoint<RequestParams extends object, T = IdEither>(ids: T[], params?: RequestParams, path?: string, queryParams?: RequestParams): Promise<ResponseType[]>;
protected retrieveEndpoint<RequestParams extends HttpQueryParams, T = IdEither>(ids: T[], params?: RequestParams, path?: string, queryParams?: RequestParams): Promise<ResponseType[]>;
protected updateEndpoint<ChangeType>(changes: ChangeType[], path?: string): Promise<ResponseType[]>;
protected searchEndpoint<FilterType>(query: FilterType, path?: string, queryParams?: HttpQueryParams): Promise<ResponseType[]>;
protected deleteEndpoint<RequestParams extends object, T = IdEither>(ids: T[], params?: RequestParams, path?: string): Promise<{}>;
protected deleteEndpoint<RequestParams extends HttpQueryParams, T = IdEither>(ids: T[], params?: RequestParams, path?: string): Promise<{}>;
protected aggregateEndpoint<QueryType, AggregateResponse>(query: QueryType, path?: string): Promise<AggregateResponse[]>;
protected callListEndpointWithGet: <QueryType extends FilterQuery>(scope?: QueryType | undefined) => Promise<HttpResponse<CursorResponse<ResponseType[]>>>;
protected callListEndpointWithPost: <QueryType extends FilterQuery>(scope?: QueryType | undefined) => Promise<HttpResponse<CursorResponse<ResponseType[]>>>;
protected callRetrieveEndpoint<RequestParams extends object, T = IdEither>(items: T[], path?: string, params?: RequestParams, queryParams?: RequestParams): Promise<HttpResponse<ItemsWrapper<ResponseType[]>>[]>;
protected callRetrieveEndpoint<RequestParams extends HttpQueryParams, T = IdEither>(items: T[], path?: string, params?: RequestParams, queryParams?: RequestParams): Promise<HttpResponse<ItemsWrapper<ResponseType[]>>[]>;
protected callUpdateEndpoint<ChangeType>(changes: ChangeType[], path?: string): Promise<HttpResponse<ItemsWrapper<ResponseType[]>>[]>;
protected callSearchEndpoint<QueryType, Response>(query: QueryType, path?: string, queryParams?: HttpQueryParams): Promise<HttpResponse<Response>>;
protected callDeleteEndpoint<ParamsType extends object, T = IdEither>(ids: T[], params?: ParamsType, path?: string): Promise<HttpResponse<ItemsWrapper<ResponseType[]>>[]>;
protected callDeleteEndpoint<ParamsType extends HttpQueryParams, T = IdEither>(ids: T[], params?: ParamsType, path?: string): Promise<HttpResponse<ItemsWrapper<ResponseType[]>>[]>;
protected callAggregateEndpoint<QueryType, AggregateResponse>(query: QueryType, path?: string): Promise<HttpResponse<ItemsWrapper<AggregateResponse[]>>>;
protected addToMapAndReturn<T, R>(response: T, metadata: HttpResponse<R>): T;
protected addToMapAndReturn<T extends object, R>(response: T, metadata: HttpResponse<R>): T;
protected callEndpointWithMergeAndTransform<RequestType>(query: RequestType, requester: (request: RequestType) => Promise<HttpResponse<ItemsWrapper<ResponseType[]>>[]>, preRequestModifier?: (items: RequestType) => RequestType, postRequestModifier?: (items: ResponseType[]) => ResponseType[]): Promise<ResponseType[]>;

@@ -64,3 +64,3 @@ protected callEndpointWithTransform<RequestType>(query: RequestType, requester: (request: RequestType) => Promise<HttpResponse<ItemsWrapper<ResponseType[]>>>): Promise<ResponseType[]>;

protected addNextPageFunction<QueryType extends FilterQuery, Item>(endpoint: ListEndpoint<QueryType, Item[]>, cursorResponse: CursorResponse<Item[]>, query?: QueryType): ListResponse<Item[]>;
protected postInParallelWithAutomaticChunking<RequestType, ParamsType extends object = {}>({ path, items, params, queryParams, chunkSize, }: PostInParallelWithAutomaticChunkingParams<RequestType, ParamsType>): Promise<HttpResponse<ItemsWrapper<ResponseType[]>>[]>;
protected postInParallelWithAutomaticChunking<RequestType, ParamsType extends HttpQueryParams>({ path, items, params, queryParams, chunkSize, }: PostInParallelWithAutomaticChunkingParams<RequestType, ParamsType>): Promise<HttpResponse<ItemsWrapper<ResponseType[]>>[]>;
private callCreateEndpoint;

@@ -81,3 +81,3 @@ private callUpsertEndpoint;

}[keyof T];
declare type NoInfer<T> = [T][T extends any ? 0 : never];
declare type NoInfer<T> = [T][T extends unknown ? 0 : never];
export {};

@@ -1,2 +0,2 @@

import { HttpError } from './httpClient/httpError';
import type { HttpError } from './httpClient/httpError';
export declare class CogniteError extends Error {

@@ -7,8 +7,12 @@ status: number;

missing?: object[];
duplicated?: any[];
extra?: any;
duplicated?: unknown[];
extra?: unknown;
/** @hidden */
constructor(errorMessage: string, status: number, requestId?: string, otherFields?: any);
constructor(errorMessage: string, status: number, requestId?: string, otherFields?: {
missing?: object[];
duplicated?: unknown[];
extra?: unknown;
});
toJSON(): {
[key: string]: any;
[key: string]: unknown;
};

@@ -15,0 +19,0 @@ }

@@ -1,2 +0,2 @@

import { HttpHeaders } from './httpHeaders';
import type { HttpHeaders } from './httpHeaders';
export declare class BasicHttpClient {

@@ -38,4 +38,3 @@ protected baseUrl: string;

protected preRequest(request: HttpRequest): Promise<HttpRequest>;
protected postRequest<T>(response: HttpResponse<T>, _: HttpRequest, // eslint-disable-line
__: HttpRequest): Promise<HttpResponse<T>>;
protected postRequest<T>(response: HttpResponse<T>, _: HttpRequest, __: HttpRequest): Promise<HttpResponse<T>>;
protected populateDefaultHeaders(headers?: HttpHeaders): {

@@ -48,3 +47,3 @@ [x: string]: string;

}
export declare function headersWithDefaultField(headers: HttpHeaders | undefined, fieldName: string, fieldValue: string): HttpHeaders;
export declare function headersWithDefaultField(headers: HttpHeaders, fieldName: string, fieldValue: string): HttpHeaders;
export interface HttpRequest extends HttpRequestOptions {

@@ -55,3 +54,3 @@ path: string;

export interface HttpRequestOptions {
data?: any;
data?: unknown | null | undefined;
params?: HttpQueryParams;

@@ -77,3 +76,3 @@ headers?: HttpHeaders;

}
export declare type HttpResponseType = 'json' | 'arraybuffer' | 'text';
declare type HttpResponseType = 'json' | 'arraybuffer' | 'text';
export declare const HttpResponseType: {

@@ -84,5 +83,4 @@ Json: HttpResponseType;

};
export interface HttpQueryParams {
[key: string]: any;
}
export declare type HttpQueryParams = object;
export declare type HttpCall = <ResponseType>(path: string, options?: HttpRequestOptions) => Promise<HttpResponse<ResponseType>>;
export {};

@@ -1,5 +0,4 @@

import { HttpResponse } from './basicHttpClient';
import type { HttpResponse } from './basicHttpClient';
import { HttpError } from './httpError';
import { RetryableHttpClient, RetryableHttpRequest } from './retryableHttpClient';
import { RetryValidator } from './retryValidator';
export declare class CDFHttpClient extends RetryableHttpClient {

@@ -11,3 +10,2 @@ private static serializeQueryParameters;

private oneTimeHeaders;
constructor(baseUrl: string, retryValidator: RetryValidator);
addOneTimeHeader(name: string, value: string): this;

@@ -14,0 +12,0 @@ setBearerToken: (token: string) => void;

@@ -1,8 +0,19 @@

import { HttpHeaders } from './httpHeaders';
import type { HttpHeaders } from './httpHeaders';
export interface HttpErrorData {
error: {
code: number;
message: string;
isAutoRetryable?: boolean;
missing?: object[];
duplicated?: object[];
forbidden?: object[];
extra?: unknown;
};
}
export declare class HttpError extends Error {
status: number;
data: any;
data: HttpErrorData;
headers: HttpHeaders;
/** @hidden */
constructor(status: number, data: any, headers: HttpHeaders);
constructor(status: number, data: HttpErrorData, headers: HttpHeaders);
}

@@ -1,5 +0,5 @@

import { HttpMethod, HttpResponse } from './basicHttpClient';
import { RetryableHttpRequest } from './retryableHttpClient';
import type { HttpMethod, HttpResponse } from './basicHttpClient';
import type { RetryableHttpRequest } from './retryableHttpClient';
/** @hidden */
export declare type RetryValidator = (request: RetryableHttpRequest, response: HttpResponse<any>, retryCount: number) => boolean;
export declare type RetryValidator = (request: RetryableHttpRequest, response: HttpResponse<unknown>, retryCount: number) => boolean;
/** @hidden */

@@ -6,0 +6,0 @@ export declare type EndpointList = {

@@ -1,4 +0,4 @@

import { HttpCall, HttpQueryParams } from './httpClient/basicHttpClient';
import { ClientOptions } from './baseCogniteClient';
import { ClientCredentials } from './credentialsAuth';
import type { ClientOptions } from './baseCogniteClient';
import type { ClientCredentials } from './credentialsAuth';
import type { HttpCall, HttpQueryParams } from './httpClient/basicHttpClient';
export declare const ACCESS_TOKEN_PARAM = "access_token";

@@ -40,3 +40,3 @@ export declare const ID_TOKEN_PARAM = "id_token";

*/
export declare function verifyCredentialsRequiredFields(credentials: ClientCredentials): Error | void;
export declare function verifyCredentialsRequiredFields(credentials: ClientCredentials): void;
/**

@@ -46,2 +46,2 @@ * It verify if options contain require fields .

*/
export declare function verifyOptionsRequiredFields(options: ClientOptions): Error | void;
export declare function verifyOptionsRequiredFields(options: ClientOptions): void;

@@ -1,2 +0,2 @@

import { HttpResponse } from './httpClient/basicHttpClient';
import type { HttpResponse } from './httpClient/basicHttpClient';
export interface Metadata {

@@ -12,4 +12,4 @@ status: number;

constructor();
addAndReturn<T, V>(value: T, metadata: HttpResponse<V>): T;
get(value: any): undefined | Metadata;
addAndReturn<T extends object, V>(value: T, metadata: HttpResponse<V>): T;
get(value: object): undefined | Metadata;
}
import { CogniteError } from './error';
import { HttpResponse } from './httpClient/basicHttpClient';
import type { HttpResponse } from './httpClient/basicHttpClient';
/** @hidden */

@@ -16,3 +16,3 @@ export interface MultiErrorRawSummary<RequestType, ResponseType> {

missing: object[];
duplicated: any[];
duplicated: unknown[];
statuses: number[];

@@ -19,0 +19,0 @@ requestIds: string[];

@@ -83,3 +83,3 @@ export interface ListResponse<T> extends CursorResponse<T> {

}
export declare type AutoPagingEachHandler<T> = (item: T) => (void | boolean) | Promise<void | boolean>;
export declare type AutoPagingEachHandler<T> = (item: T) => (undefined | boolean) | Promise<undefined | boolean>;
export declare type AutoPagingEach<T> = (handler: AutoPagingEachHandler<T>) => Promise<void>;

@@ -86,0 +86,0 @@ export interface AutoPagingToArrayOptions {

@@ -19,3 +19,3 @@ /** @hidden */

/** @hidden */
export declare function isJson(data: any): boolean;
export declare function isJson(data: unknown): boolean;
/** @hidden */

@@ -22,0 +22,0 @@ export declare function sleepPromise(durationInMs: number): Promise<unknown>;

@@ -8,8 +8,8 @@ {

"types": "dist/src/index.d.js",
"version": "4.10.3",
"version": "4.10.4",
"scripts": {
"clean": "rm -rf dist/ docs/",
"test": "yarn g:vitest run",
"lint": "eslint 'src/**/*.{js,ts}'",
"lint:fix": "yarn lint --fix",
"lint": "yarn g:biome ci",
"lint:fix": "yarn g:biome lint --fix && yarn g:biome format --fix && yarn g:biome check --fix",
"prepublishOnly": "yarn build",

@@ -37,3 +37,3 @@ "build": "yarn clean && yarn g:rollup -c && yarn esCheck",

},
"gitHead": "50446496eae832b7c49ea52001bbd47439acdf6a"
"gitHead": "4edc3c6de861a9ec5e5c4b416e746573ab393cc3"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc