Socket
Socket
Sign inDemoInstall

@volvo-cars/content-delivery-client

Package Overview
Dependencies
14
Maintainers
9
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.3 to 0.1.0

CHANGELOG.md

29

dist/ContentDeliveryClient.d.ts

@@ -6,3 +6,3 @@ /// <reference types="node" />

export declare type ContentEnvironment = 'live' | 'authoringPreview' | 'master';
declare type ContentDeliveryDataSource = 'dotcom-sitecore-test' | 'dotcom-sitecore-qa' | 'dotcom-sitecore-prod' | string;
export declare type ContentDeliveryDataSource = 'dotcom-sitecore-test' | 'dotcom-sitecore-qa' | 'dotcom-sitecore-prod' | string;
export declare type ClientConfig = {

@@ -18,6 +18,28 @@ /**

/**
* Default DataSource to fetch from.
* Default data source to fetch content from.
*/
defaultDataSource?: ContentDeliveryDataSource;
/**
* Default environment to fetch content from.
*
* @default 'live'
*/
defaultEnvironment?: ContentEnvironment;
/**
* Allowed values for `dataSource` when fetching content. Can be an array or a
* comma separated string.
*
* An operation with a `dataSource` not in the given list will throw an error.
* If no value is given, any value can be passed as `dataSource` to operations.
*/
allowedDataSources?: ContentDeliveryDataSource[] | string;
/**
* Allowed values for `environment` when fetching content. Can be an array or a
* comma separated string.
*
* An operation with an `environment` not in the given list will throw an error.
* If no value is given, any value can be passed as `environment` to operations.
*/
allowedEnvironments?: ContentEnvironment[] | string;
/**
* The API key for your product.

@@ -119,5 +141,4 @@ */

getEntry<T = unknown>(canonicalName: string, options: GetOptions): Promise<T>;
listEntries(contentType: ContentType, options: GetOptions): Promise<ListEntriesResponseData>;
listEntries<T extends ContentType>(contentType: T, options: GetOptions): Promise<ListEntriesResponseData<T>>;
}
export declare function createClient({ forceLocalData, fallbackToLocalData, ...config }: CreateClientOptions): ContentDeliveryClient;
export {};

2

dist/entries/listEntries.d.ts
import { ClientConfig, GetOptions } from '../ContentDeliveryClient';
import { ContentType, ListEntriesResponseData } from './types';
export declare function listEntries<T = ListEntriesResponseData>(contentType: ContentType, config: ClientConfig, options: GetOptions): Promise<T>;
export declare function listEntries<T extends ContentType>(contentType: T, config: ClientConfig, options: GetOptions): Promise<ListEntriesResponseData<T>>;

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

import type { ContentEnvironment } from './ContentDeliveryClient';
import { DictionaryItems, FlattenedDictionaries } from './dictionaries/types';
import { RequestDetails } from './utils/sendRequest';
import { DictionaryItems, FlattenedDictionaries } from './dictionaries/types';
import type { ContentEnvironment } from './ContentDeliveryClient';
export declare class RequestError extends Error {

@@ -10,2 +10,9 @@ name: string;

}
export declare class ContentDeliveryClientError extends Error {
name: string;
}
export declare class ContentDeliveryClientValidationError extends ContentDeliveryClientError {
name: string;
constructor(actual: string, allowed: string[], type: string);
}
export declare class TimeoutError extends Error {

@@ -12,0 +19,0 @@ name: string;

@@ -14,4 +14,4 @@ import type { ClientConfig, ContentDeliveryClient, GetOptions } from './ContentDeliveryClient';

getEntry<T>(_canonicalName: string, _options: GetOptions): Promise<T>;
listEntries(_contentType: ContentType, _options: GetOptions): Promise<ListEntriesResponseData>;
listEntries<T extends ContentType>(_contentType: T, _options: GetOptions): Promise<ListEntriesResponseData<T>>;
private flattenDictionaries;
}

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

import { ContentDeliveryClient, GetOptions } from './ContentDeliveryClient';
import { ClientConfig } from '.';
import { ContentDeliveryClient, ContentDeliveryDataSource, ContentEnvironment, GetOptions } from './ContentDeliveryClient';
import { FlattenedDictionaries } from './dictionaries/types';
import { ContentType, ListEntriesResponseData } from './entries/types';
import { LocalDataClient } from './LocalDataClient';
import { ContentType, ListEntriesResponseData } from './entries/types';
import { FlattenedDictionaries } from './dictionaries/types';
import { ClientConfig } from '.';
export declare type FinalClientConfig = Omit<ClientConfig, 'dataSource'> & {
defaultEnvironment: ContentEnvironment;
allowedDataSources: ContentDeliveryDataSource[];
allowedEnvironments: ContentEnvironment[];
revalidate: {
dictionaries: number;
entries: number;
listEntries: number;
};
};
export declare class RemoteDataClient implements ContentDeliveryClient {

@@ -16,14 +26,11 @@ applicationId: string;

private pendingRevalidations;
private dictionariesRevalidate;
private entriesRevalidate;
private listEntriesRevalidate;
constructor(config: ClientConfig, localDataClient?: LocalDataClient);
get isValidating(): boolean;
getDictionary(canonicalDictionaryName: string, options: GetOptions): Promise<FlattenedDictionaries>;
getDictionaries(canonicalDictionaryNames: string[], options: GetOptions): Promise<FlattenedDictionaries>;
getAllDictionaries(options: GetOptions): Promise<FlattenedDictionaries>;
getEntry<T>(canonicalName: string, options: GetOptions): Promise<T>;
listEntries(contentType: ContentType, options: GetOptions): Promise<ListEntriesResponseData>;
getDictionary(canonicalDictionaryName: string, rawOptions: GetOptions): Promise<FlattenedDictionaries>;
getDictionaries(canonicalDictionaryNames: string[], rawOptions: GetOptions): Promise<FlattenedDictionaries>;
getAllDictionaries(rawOptions: GetOptions): Promise<FlattenedDictionaries>;
getEntry<T>(canonicalName: string, rawOptions: GetOptions): Promise<T>;
listEntries<T extends ContentType>(contentType: T, rawOptions: GetOptions): Promise<ListEntriesResponseData<T>>;
private logError;
private logFallback;
}

@@ -9,2 +9,6 @@ import type { ContentEnvironment } from '../ContentDeliveryClient';

};
declare type Now = typeof Date.now;
interface CacheOptions {
now?: Now;
}
export declare class Cache<Value = unknown> {

@@ -14,2 +18,3 @@ lastUpdated: Map<string, number>;

revalidateMs: number;
now: Now;
/**

@@ -20,3 +25,3 @@ *

*/
constructor(revalidate: number);
constructor(revalidate: number, { now }?: CacheOptions);
set(keyConfig: CacheKeyConfig, value: Value): void;

@@ -29,2 +34,5 @@ has(keyConfig: CacheKeyConfig): boolean;

isStale(keyConfig: CacheKeyConfig): boolean;
delete(keyConfig: CacheKeyConfig): void;
}
export declare function getCacheKey(config: CacheKeyConfig): string;
export {};

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

import type { ClientConfig, ContentEnvironment } from '../ContentDeliveryClient';
import type { ContentType } from '../entries/types';
import type { ContentEnvironment, ClientConfig } from '../ContentDeliveryClient';
export declare type RequestDetails = {
applicationId: string;
locale: string;
environment: ContentEnvironment;
dataSource?: string;
environment?: ContentEnvironment;
operationId?: string;

@@ -18,3 +18,5 @@ market?: boolean;

};
export declare function sendRequest<Results>({ applicationId, dataSource, path, market, locale, accept, environment, operationId, contentType, timeout, config, }: RequestDetails & SendRequestOptions): Promise<Results>;
export declare function sendRequest<Results>({ applicationId, dataSource, path, market, locale, accept, environment, operationId, contentType, timeout, config, }: RequestDetails & SendRequestOptions, { retry }?: {
retry?: boolean | undefined;
}): Promise<Results>;
export {};
{
"name": "@volvo-cars/content-delivery-client",
"version": "0.1.0",
"license": "UNLICENSED",
"source": "index.ts",
"main": "dist/index.js",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts",
"license": "UNLICENSED",
"name": "@volvo-cars/content-delivery-client",
"version": "0.0.3",
"publishConfig": {
"access": "public"
"access": "public",
"directory": "./package",
"main": "dist/index.js",
"module": "dist/index.esm.js",
"types": "dist/index.d.ts"
},
"files": [
"dist/**"
],
"repository": {
"type": "git",
"url": "https://github.com/volvo-cars/cdls-mono-volvocars.git",
"directory": "packages/content-delivery-client"
},
"scripts": {
"build": "microbundle -f es,cjs --target node",
"dev": "microbundle -f es,cjs --target node",
"check-types": "tsc -b",
"pack-unpack": "rm -rf package && yarn pack && tar zxf package.tgz",
"pre-publish": "rm -rf dist && yarn build && yarn pack-unpack"
},
"dependencies": {

@@ -16,3 +34,12 @@ "@types/flat": "^5.0.1",

"glob": "^7.0.0"
}
}
},
"devDependencies": {
"@vcc-www/testing": "0.0.0",
"@vcc-www/utils": "0.0.0",
"@volvo-cars/content-management-client": "0.9.2",
"microbundle": "^0.14.2",
"nock": "^13.0.5",
"typescript": "*"
},
"module": "dist/index.esm.js"
}
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc