contentful 9.2.17 → 9.2.19

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.
@@ -63,7 +63,7 @@ export function createClient(params) {
63
63
  environment: 'master'
64
64
  };
65
65
  const config = _objectSpread(_objectSpread({}, defaultConfig), params);
66
- const userAgentHeader = getUserAgentHeader(`contentful.js/${"9.2.17"}`, config.application, config.integration);
66
+ const userAgentHeader = getUserAgentHeader(`contentful.js/${"9.2.19"}`, config.application, config.integration);
67
67
  config.headers = _objectSpread(_objectSpread({}, config.headers), {}, {
68
68
  'Content-Type': 'application/vnd.contentful.delivery.v1+json',
69
69
  'X-Contentful-User-Agent': userAgentHeader
@@ -16,7 +16,7 @@ export default function normalizeSelect(query) {
16
16
 
17
17
  // The selection of fields for the query is limited
18
18
  // Get the different parts that are listed for selection
19
- const allSelects = Array.isArray(query.select) ? query.select : query.select.split(',');
19
+ const allSelects = Array.isArray(query.select) ? query.select : query.select.split(',').map(q => q.trim());
20
20
  // Move the parts into a set for easy access and deduplication
21
21
  const selectedSet = new Set(allSelects);
22
22
 
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  // Type definitions for contentful
2
2
  // Definitions by: Miika Hänninen <https://github.com/googol>
3
+ import type { BLOCKS, INLINES } from '@contentful/rich-text-types';
3
4
 
4
5
  export interface AxiosProxyConfig {
5
6
  host: string;
@@ -79,7 +80,7 @@ export interface ContentfulCollection<T> {
79
80
  toPlainObject(): object;
80
81
  }
81
82
 
82
- export type AssetCollection = ContentfulCollection<Asset>
83
+ export type AssetCollection = ContentfulCollection<Asset>;
83
84
 
84
85
  export interface Entry<T> {
85
86
  sys: Sys;
@@ -114,27 +115,27 @@ export interface Space {
114
115
  }
115
116
 
116
117
  export interface Locale {
117
- code: string
118
- name: string
119
- default: boolean
120
- fallbackCode: string | null
121
- sys: {
122
- id: string
123
- type: 'Locale'
124
- version: number
125
- }
118
+ code: string;
119
+ name: string;
120
+ default: boolean;
121
+ fallbackCode: string | null;
122
+ sys: {
123
+ id: string;
124
+ type: 'Locale';
125
+ version: number;
126
+ };
126
127
  }
127
128
 
128
129
  export type LocaleCollection = ContentfulCollection<Locale>;
129
130
 
130
131
  export interface Tag {
131
- name: string
132
+ name: string;
132
133
  sys: {
133
- id: string
134
- type: 'Tag'
135
- version: number
136
- visibility: 'public'
137
- }
134
+ id: string;
135
+ type: 'Tag';
136
+ version: number;
137
+ visibility: 'public';
138
+ };
138
139
  }
139
140
 
140
141
  export type TagCollection = ContentfulCollection<Tag>;
@@ -167,17 +168,17 @@ export interface Sys {
167
168
  };
168
169
  }
169
170
 
170
- export type LinkType = 'Space' | 'ContentType' | 'Environment'
171
+ export type LinkType = 'Space' | 'ContentType' | 'Environment';
171
172
 
172
173
  export interface Link<T extends LinkType> {
173
- type: 'Link'
174
- linkType: T
175
- id: string
174
+ type: 'Link';
175
+ linkType: T;
176
+ id: string;
176
177
  }
177
178
 
178
- export type SpaceLink = Link<'Space'>
179
- export type EnvironmentLink = Link<'Environment'>
180
- export type ContentTypeLink = Link<'ContentType'>
179
+ export type SpaceLink = Link<'Space'>;
180
+ export type EnvironmentLink = Link<'Environment'>;
181
+ export type ContentTypeLink = Link<'ContentType'>;
181
182
 
182
183
  export interface Field {
183
184
  disabled: boolean;
@@ -192,7 +193,18 @@ export interface Field {
192
193
  items?: FieldItem;
193
194
  }
194
195
 
195
- export type FieldType = 'Symbol' | 'Text' | 'Integer' | 'Number' | 'Date' | 'Boolean' | 'Location' | 'Link' | 'Array' | 'Object' | 'RichText';
196
+ export type FieldType =
197
+ | 'Symbol'
198
+ | 'Text'
199
+ | 'Integer'
200
+ | 'Number'
201
+ | 'Date'
202
+ | 'Boolean'
203
+ | 'Location'
204
+ | 'Link'
205
+ | 'Array'
206
+ | 'Object'
207
+ | 'RichText';
196
208
 
197
209
  export interface FieldValidation {
198
210
  unique?: boolean;
@@ -241,7 +253,7 @@ export namespace EntryFields {
241
253
  export type Array<T = any> = Symbol[] | Entry<T>[] | Asset[];
242
254
  export type Object<T = any> = T;
243
255
  export interface RichText {
244
- data:{};
256
+ data: {};
245
257
  content: RichTextContent[];
246
258
  nodeType: 'document';
247
259
  }
@@ -250,8 +262,8 @@ export namespace EntryFields {
250
262
  interface RichTextDataTarget {
251
263
  sys: {
252
264
  id: string;
253
- type: "Link";
254
- "linkType": 'Entry' | 'Asset';
265
+ type: 'Link';
266
+ linkType: 'Entry' | 'Asset';
255
267
  };
256
268
  }
257
269
 
@@ -260,27 +272,25 @@ interface RichTextData {
260
272
  target?: RichTextDataTarget;
261
273
  }
262
274
 
263
- type RichTextNodeType = 'text' | 'heading-1' | 'heading-2' | 'heading-3' | 'heading-4' | 'heading-5'
264
- | 'heading-6' | 'paragraph' | 'hyperlink' | 'entry-hyperlink' | 'asset-hyperlink'
265
- | 'unordered-list' | 'ordered-list' | 'list-item' | 'blockquote' | 'hr' | 'embedded-entry-block'
266
- | 'embedded-entry-inline';
275
+ // Requires TypeScript v4.1+
276
+ type RichTextNodeType = `${BLOCKS}` | `${INLINES}` | 'text';
267
277
 
268
278
  interface RichTextContent {
269
279
  data: RichTextData;
270
- content?: RichTextContent[]
271
- marks: {type: ('bold' | 'underline' | 'code' | 'italic')}[];
280
+ content?: RichTextContent[];
281
+ marks: { type: 'bold' | 'underline' | 'code' | 'italic' }[];
272
282
  value?: string;
273
283
  nodeType: RichTextNodeType;
274
284
  }
275
285
 
276
286
  interface TagLink {
277
- sys: {
278
- type: 'Link';
279
- linkType: 'Tag';
280
- id: string;
281
- }
287
+ sys: {
288
+ type: 'Link';
289
+ linkType: 'Tag';
290
+ id: string;
291
+ };
282
292
  }
283
293
 
284
294
  interface Metadata {
285
- tags: TagLink[];
295
+ tags: TagLink[];
286
296
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "contentful",
3
3
  "description": "Client for Contentful's Content Delivery API",
4
- "version": "9.2.17",
4
+ "version": "9.2.19",
5
5
  "homepage": "https://www.contentful.com/developers/documentation/content-delivery-api/",
6
6
  "main": "./dist/contentful.node.js",
7
7
  "module": "./dist/es-modules/contentful.js",
@@ -64,9 +64,10 @@
64
64
  "dependencies": {
65
65
  "axios": "^0.27.0",
66
66
  "contentful-resolve-response": "^1.3.12",
67
- "contentful-sdk-core": "^7.0.4",
67
+ "contentful-sdk-core": "^7.0.5",
68
68
  "fast-copy": "^2.1.7",
69
- "json-stringify-safe": "^5.0.1"
69
+ "json-stringify-safe": "^5.0.1",
70
+ "@contentful/rich-text-types": "^16.0.2"
70
71
  },
71
72
  "devDependencies": {
72
73
  "@babel/cli": "^7.6.2",
@@ -93,7 +94,7 @@
93
94
  "eslint-config-standard": "^16.0.0",
94
95
  "eslint-plugin-import": "^2.9.0",
95
96
  "eslint-plugin-node": "^11.1.0",
96
- "eslint-plugin-promise": "^6.0.0",
97
+ "eslint-plugin-promise": "^5.2.0",
97
98
  "eslint-plugin-standard": "^5.0.0",
98
99
  "express": "^4.15.4",
99
100
  "husky": "^4.3.8",
@@ -107,7 +108,7 @@
107
108
  "karma-sauce-launcher": "^4.1.2",
108
109
  "karma-tap": "^4.1.3",
109
110
  "karma-webpack": "^4.0.2",
110
- "mkdirp": "^1.0.3",
111
+ "mkdirp": "^2.0.0",
111
112
  "nodemon": "^2.0.2",
112
113
  "regenerator-runtime": "^0.13.7",
113
114
  "require-all": "^3.0.0",