@depup/contentful 11.10.7-depup.0
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.
- package/ADVANCED.md +283 -0
- package/CONTRIBUTING.md +109 -0
- package/LICENSE +21 -0
- package/MIGRATION.md +364 -0
- package/README.md +36 -0
- package/TYPESCRIPT.md +329 -0
- package/changes.json +30 -0
- package/dist/contentful.browser.js +10886 -0
- package/dist/contentful.browser.min.js +1 -0
- package/dist/contentful.cjs +23983 -0
- package/dist/esm/contentful.js +60 -0
- package/dist/esm/create-contentful-api.js +463 -0
- package/dist/esm/create-global-options.js +21 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/make-client.js +52 -0
- package/dist/esm/mixins/stringify-safe.js +23 -0
- package/dist/esm/paged-sync.js +118 -0
- package/dist/esm/utils/normalize-cursor-pagination-parameters.js +9 -0
- package/dist/esm/utils/normalize-cursor-pagination-response.js +23 -0
- package/dist/esm/utils/normalize-search-parameters.js +18 -0
- package/dist/esm/utils/normalize-select.js +25 -0
- package/dist/esm/utils/query-selection-set.js +14 -0
- package/dist/esm/utils/resolve-circular.js +15 -0
- package/dist/esm/utils/timeline-preview-helpers.js +33 -0
- package/dist/esm/utils/validate-params.js +65 -0
- package/dist/esm/utils/validate-search-parameters.js +11 -0
- package/dist/esm/utils/validate-timestamp.js +16 -0
- package/dist/esm/utils/validation-error.js +8 -0
- package/dist/stats-browser-min.html +4949 -0
- package/dist/types/contentful.d.ts +150 -0
- package/dist/types/create-contentful-api.d.ts +13 -0
- package/dist/types/create-global-options.d.ts +19 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/make-client.d.ts +3 -0
- package/dist/types/mixins/stringify-safe.d.ts +1 -0
- package/dist/types/paged-sync.d.ts +7 -0
- package/dist/types/types/asset-key.d.ts +7 -0
- package/dist/types/types/asset.d.ts +79 -0
- package/dist/types/types/client.d.ts +477 -0
- package/dist/types/types/collection.d.ts +42 -0
- package/dist/types/types/concept-scheme.d.ts +26 -0
- package/dist/types/types/concept.d.ts +51 -0
- package/dist/types/types/content-type.d.ts +105 -0
- package/dist/types/types/entry.d.ts +246 -0
- package/dist/types/types/index.d.ts +17 -0
- package/dist/types/types/link.d.ts +61 -0
- package/dist/types/types/locale.d.ts +30 -0
- package/dist/types/types/metadata.d.ts +13 -0
- package/dist/types/types/query/equality.d.ts +29 -0
- package/dist/types/types/query/existence.d.ts +15 -0
- package/dist/types/types/query/index.d.ts +12 -0
- package/dist/types/types/query/location.d.ts +29 -0
- package/dist/types/types/query/order.d.ts +44 -0
- package/dist/types/types/query/query.d.ts +155 -0
- package/dist/types/types/query/range.d.ts +18 -0
- package/dist/types/types/query/reference.d.ts +12 -0
- package/dist/types/types/query/search.d.ts +17 -0
- package/dist/types/types/query/select.d.ts +29 -0
- package/dist/types/types/query/set.d.ts +10 -0
- package/dist/types/types/query/subset.d.ts +20 -0
- package/dist/types/types/query/util.d.ts +32 -0
- package/dist/types/types/resource-link.d.ts +9 -0
- package/dist/types/types/space.d.ts +20 -0
- package/dist/types/types/sync.d.ts +84 -0
- package/dist/types/types/sys.d.ts +30 -0
- package/dist/types/types/tag.d.ts +32 -0
- package/dist/types/types/timeline-preview.d.ts +16 -0
- package/dist/types/utils/client-helpers.d.ts +9 -0
- package/dist/types/utils/normalize-cursor-pagination-parameters.d.ts +5 -0
- package/dist/types/utils/normalize-cursor-pagination-response.d.ts +2 -0
- package/dist/types/utils/normalize-search-parameters.d.ts +1 -0
- package/dist/types/utils/normalize-select.d.ts +1 -0
- package/dist/types/utils/query-selection-set.d.ts +1 -0
- package/dist/types/utils/resolve-circular.d.ts +4 -0
- package/dist/types/utils/timeline-preview-helpers.d.ts +7 -0
- package/dist/types/utils/validate-params.d.ts +6 -0
- package/dist/types/utils/validate-search-parameters.d.ts +1 -0
- package/dist/types/utils/validate-timestamp.d.ts +6 -0
- package/dist/types/utils/validation-error.d.ts +3 -0
- package/images/contentful-icon.png +0 -0
- package/images/dynamic-query-keys.png +0 -0
- package/images/static-query-keys.png +0 -0
- package/package.json +221 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import type { AssetDetails, AssetFile, AssetMimeType, AssetSys } from '../asset.js';
|
|
2
|
+
import type { ChainModifiers } from '../client.js';
|
|
3
|
+
import type { EntrySys } from '../entry.js';
|
|
4
|
+
import type { ContentTypeLink, TagLink, TaxonomyConceptLink } from '../link.js';
|
|
5
|
+
import type { Metadata } from '../metadata.js';
|
|
6
|
+
import type { TagSys } from '../tag.js';
|
|
7
|
+
import type { EntryFieldsEqualityFilter, EntryFieldsInequalityFilter, EqualityFilter, InequalityFilter } from './equality.js';
|
|
8
|
+
import type { EntryFieldsExistenceFilter, ExistenceFilter } from './existence.js';
|
|
9
|
+
import type { LocationSearchFilters } from './location.js';
|
|
10
|
+
import type { AssetOrderFilter, TaxonomyOrderFilter, EntryOrderFilter, EntryOrderFilterWithFields, TagOrderFilter } from './order.js';
|
|
11
|
+
import type { EntryFieldsRangeFilters, RangeFilters } from './range.js';
|
|
12
|
+
import type { ReferenceSearchFilters } from './reference.js';
|
|
13
|
+
import type { EntryFieldsFullTextSearchFilters, FullTextSearchFilters } from './search.js';
|
|
14
|
+
import type { AssetSelectFilter, EntrySelectFilter, EntrySelectFilterWithFields } from './select.js';
|
|
15
|
+
import type { EntryFieldsSetFilter } from './set.js';
|
|
16
|
+
import type { EntryFieldsSubsetFilters, SubsetFilters } from './subset.js';
|
|
17
|
+
import type { ConditionalFixedQueries, ConditionalListQueries, EntrySkeletonType, FieldsType } from './util.js';
|
|
18
|
+
export type CursorPaginationOptions = ({
|
|
19
|
+
pagePrev?: string;
|
|
20
|
+
pageNext?: never;
|
|
21
|
+
} | {
|
|
22
|
+
pageNext?: string;
|
|
23
|
+
pagePrev?: never;
|
|
24
|
+
}) & {
|
|
25
|
+
limit?: number;
|
|
26
|
+
skip?: never;
|
|
27
|
+
};
|
|
28
|
+
export type FixedPagedOptions = {
|
|
29
|
+
skip?: number;
|
|
30
|
+
limit?: number;
|
|
31
|
+
};
|
|
32
|
+
export type FixedQueryOptions = {
|
|
33
|
+
include?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
|
|
34
|
+
query?: string;
|
|
35
|
+
};
|
|
36
|
+
export type FixedLinkOptions = {
|
|
37
|
+
links_to_asset?: string;
|
|
38
|
+
links_to_entry?: string;
|
|
39
|
+
};
|
|
40
|
+
export type LocaleOption = {
|
|
41
|
+
locale?: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* All queries applicable to sys fields
|
|
45
|
+
*/
|
|
46
|
+
export type SysQueries<Sys extends FieldsType> = ExistenceFilter<Sys, 'sys'> & EqualityFilter<Sys, 'sys'> & InequalityFilter<Sys, 'sys'> & SubsetFilters<Sys, 'sys'> & RangeFilters<Sys, 'sys'>;
|
|
47
|
+
/**
|
|
48
|
+
* All queries applicable to sys contentType field
|
|
49
|
+
*/
|
|
50
|
+
export type SysContentTypeQueries = ConditionalListQueries<Pick<ContentTypeLink, 'id'>, any, 'sys.contentType.sys', '[in]'> | ConditionalListQueries<Pick<ContentTypeLink, 'id'>, any, 'sys.contentType.sys', '[nin]'>;
|
|
51
|
+
/**
|
|
52
|
+
* All queries applicable to metadata tags fields
|
|
53
|
+
*/
|
|
54
|
+
export type MetadataTagsQueries = ConditionalFixedQueries<Pick<Metadata, 'tags'>, any, boolean, 'metadata', '[exists]'> | ConditionalListQueries<Pick<TagLink, 'id'>, any, 'metadata.tags.sys', '[all]'> | ConditionalListQueries<Pick<TagLink, 'id'>, any, 'metadata.tags.sys', '[in]'> | ConditionalListQueries<Pick<TagLink, 'id'>, any, 'metadata.tags.sys', '[nin]'>;
|
|
55
|
+
/**
|
|
56
|
+
* All queries applicable to metadata concepts fields
|
|
57
|
+
*/
|
|
58
|
+
export type MetadataConceptsQueries = ConditionalFixedQueries<Pick<Metadata, 'concepts'>, any, boolean, 'metadata', '[exists]'> | ConditionalListQueries<Pick<TaxonomyConceptLink, 'id'>, any, 'metadata.concepts.sys', '[all]'> | ConditionalListQueries<Pick<TaxonomyConceptLink, 'id'>, any, 'metadata.concepts.sys', '[in]'> | ConditionalListQueries<Pick<TaxonomyConceptLink, 'id'>, any, 'metadata.concepts.sys', '[nin]'> | ConditionalListQueries<{
|
|
59
|
+
descendants: string;
|
|
60
|
+
}, any, 'metadata.concepts', '[in]'>;
|
|
61
|
+
/**
|
|
62
|
+
* All queries applicable to entry fields
|
|
63
|
+
* @typeParam Fields - Shape of entry fields used to calculate dynamic keys
|
|
64
|
+
*/
|
|
65
|
+
export type EntryFieldsQueries<Fields extends FieldsType> = EntrySelectFilterWithFields<Fields> | EntryOrderFilterWithFields<Fields> | EntryFieldsExistenceFilter<Fields, 'fields'> | EntryFieldsEqualityFilter<Fields, 'fields'> | EntryFieldsInequalityFilter<Fields, 'fields'> | EntryFieldsFullTextSearchFilters<Fields, 'fields'> | EntryFieldsSubsetFilters<Fields, 'fields'> | EntryFieldsSetFilter<Fields, 'fields'> | LocationSearchFilters<Fields, 'fields'> | EntryFieldsRangeFilters<Fields, 'fields'> | ReferenceSearchFilters<Fields, 'fields'>;
|
|
66
|
+
export type EntryContentTypeQuery<T extends string> = {
|
|
67
|
+
content_type: T;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Search parameters for entry collection methods
|
|
71
|
+
* @typeParam EntrySkeleton - Shape of an entry used to calculate dynamic keys
|
|
72
|
+
* @typeParam Modifiers - The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
|
|
73
|
+
* @category Query
|
|
74
|
+
*/
|
|
75
|
+
export type EntriesQueries<EntrySkeleton extends EntrySkeletonType, Modifiers extends ChainModifiers> = (EntryFieldsQueries<EntrySkeleton['fields']> & EntryContentTypeQuery<EntrySkeleton['contentTypeId']>) | ((SysQueries<Pick<EntrySys, 'createdAt' | 'updatedAt' | 'revision' | 'id' | 'type'>> & SysContentTypeQueries & MetadataTagsQueries & MetadataConceptsQueries & EntrySelectFilter & EntryOrderFilter & FixedQueryOptions & FixedPagedOptions & FixedLinkOptions) & ('WITH_ALL_LOCALES' extends Modifiers ? {} : LocaleOption));
|
|
76
|
+
/**
|
|
77
|
+
* Search parameters for entry cursor paginated collection
|
|
78
|
+
* @typeParam EntrySkeleton - Shape of an entry used to calculate dynamic keys
|
|
79
|
+
* @typeParam Modifiers - The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
|
|
80
|
+
* @category Query
|
|
81
|
+
*/
|
|
82
|
+
export type EntriesQueriesWithCursor<EntrySkeleton extends EntrySkeletonType, Modifiers extends ChainModifiers> = EntriesQueries<EntrySkeleton, Modifiers> & CursorPaginationOptions;
|
|
83
|
+
/**
|
|
84
|
+
* Search parameters for a single entry methods
|
|
85
|
+
* @typeParam Modifiers - The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
|
|
86
|
+
* @category Query
|
|
87
|
+
*/
|
|
88
|
+
export type EntryQueries<Modifiers extends ChainModifiers> = Omit<FixedQueryOptions, 'query'> & ('WITH_ALL_LOCALES' extends Modifiers ? {} : LocaleOption);
|
|
89
|
+
/**
|
|
90
|
+
* All queries appliable to asset fields
|
|
91
|
+
* @typeParam Fields - Shape of asset fields used to calculate dynamic keys
|
|
92
|
+
* @category Query
|
|
93
|
+
*/
|
|
94
|
+
export type AssetFieldsQueries<Fields extends FieldsType> = ExistenceFilter<Fields, 'fields'> & EqualityFilter<Fields, 'fields'> & InequalityFilter<Fields, 'fields'> & FullTextSearchFilters<Fields, 'fields'> & AssetSelectFilter<Fields> & AssetOrderFilter & RangeFilters<Fields, 'fields'> & SubsetFilters<Fields, 'fields'>;
|
|
95
|
+
/**
|
|
96
|
+
* All queries appliable to asset file fields
|
|
97
|
+
* @typeParam Fields - Shape of asset fields used to calculate dynamic keys
|
|
98
|
+
* @category Query
|
|
99
|
+
*/
|
|
100
|
+
export type AssetFieldsFileQueries = ExistenceFilter<AssetFile, 'fields.file'> & EqualityFilter<AssetFile, 'fields.file'> & InequalityFilter<AssetFile, 'fields.file'> & FullTextSearchFilters<AssetFile, 'fields.file'> & RangeFilters<AssetFile, 'fields.file'> & SubsetFilters<AssetFile, 'fields.file'>;
|
|
101
|
+
/**
|
|
102
|
+
* All queries appliable to asset file details fields
|
|
103
|
+
* @typeParam Fields - Shape of asset fields used to calculate dynamic keys
|
|
104
|
+
* @category Query
|
|
105
|
+
*/
|
|
106
|
+
export type AssetFieldsFileDetailsQueries = ExistenceFilter<Pick<AssetDetails, 'size'>, 'fields.file.details'> & EqualityFilter<Pick<AssetDetails, 'size'>, 'fields.file.details'> & InequalityFilter<Pick<AssetDetails, 'size'>, 'fields.file.details'> & RangeFilters<Pick<AssetDetails, 'size'>, 'fields.file.details'> & SubsetFilters<Pick<AssetDetails, 'size'>, 'fields.file.details'>;
|
|
107
|
+
/**
|
|
108
|
+
* Search parameters for asset collection methods
|
|
109
|
+
* @typeParam EntrySkeleton Shape of an asset used to calculate dynamic keys
|
|
110
|
+
* @typeParam Modifiers The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
|
|
111
|
+
* @category Query
|
|
112
|
+
*/
|
|
113
|
+
export type AssetsQueries<Fields extends FieldsType, Modifiers extends ChainModifiers> = AssetFieldsQueries<Fields> & AssetFieldsFileQueries & AssetFieldsFileDetailsQueries & MetadataConceptsQueries & SysQueries<Pick<AssetSys, 'createdAt' | 'updatedAt' | 'revision' | 'id' | 'type'>> & MetadataTagsQueries & FixedQueryOptions & FixedPagedOptions & {
|
|
114
|
+
mimetype_group?: AssetMimeType;
|
|
115
|
+
} & ('WITH_ALL_LOCALES' extends Modifiers ? {} : LocaleOption);
|
|
116
|
+
/**
|
|
117
|
+
* Search parameters for asset cursor paginated collection
|
|
118
|
+
* @typeParam EntrySkeleton Shape of an asset used to calculate dynamic keys
|
|
119
|
+
* @typeParam Modifiers The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
|
|
120
|
+
* @category Query
|
|
121
|
+
*/
|
|
122
|
+
export type AssetsQueriesWithCursor<Fields extends FieldsType, Modifiers extends ChainModifiers> = AssetsQueries<Fields, Modifiers> & CursorPaginationOptions;
|
|
123
|
+
/**
|
|
124
|
+
* Search parameters for a single asset methods
|
|
125
|
+
* @typeParam Modifiers The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
|
|
126
|
+
* @category Query
|
|
127
|
+
*/
|
|
128
|
+
export type AssetQueries<Modifiers extends ChainModifiers> = 'WITH_ALL_LOCALES' extends Modifiers ? never : LocaleOption;
|
|
129
|
+
export type TagNameFilters = {
|
|
130
|
+
'name[exists]'?: boolean;
|
|
131
|
+
name?: string;
|
|
132
|
+
'name[ne]'?: string;
|
|
133
|
+
'name[match]'?: string;
|
|
134
|
+
'name[in]'?: string[];
|
|
135
|
+
'name[nin]'?: string[];
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Search parameters for a tag methods
|
|
139
|
+
* @typeParam Modifiers The chain modifiers used to configure the client. They’re set automatically when using the client chain modifiers.
|
|
140
|
+
* @category Query
|
|
141
|
+
*/
|
|
142
|
+
export type TagQueries = TagNameFilters & SysQueries<Pick<TagSys, 'createdAt' | 'updatedAt' | 'visibility' | 'id' | 'type'>> & TagOrderFilter & FixedPagedOptions;
|
|
143
|
+
type ConceptsCursorPaginationOptions = {
|
|
144
|
+
limit?: number;
|
|
145
|
+
prevPage?: string;
|
|
146
|
+
nextPage?: string;
|
|
147
|
+
};
|
|
148
|
+
export type ConceptsQueries = ConceptsCursorPaginationOptions & TaxonomyOrderFilter & {
|
|
149
|
+
conceptScheme?: string;
|
|
150
|
+
};
|
|
151
|
+
export type ConceptSchemesQueries = ConceptsCursorPaginationOptions & TaxonomyOrderFilter;
|
|
152
|
+
export type ConceptAncestorsDescendantsQueries = ConceptsCursorPaginationOptions & TaxonomyOrderFilter & {
|
|
153
|
+
depth?: number;
|
|
154
|
+
};
|
|
155
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { EntryFields, EntryFieldType, EntryFieldTypes } from '../entry.js';
|
|
2
|
+
import type { ConditionalQueries, EntryFieldsConditionalQueries, EntrySkeletonType } from './util.js';
|
|
3
|
+
type RangeFilterTypes = 'lt' | 'lte' | 'gt' | 'gte';
|
|
4
|
+
type SupportedTypes = EntryFields.Date | EntryFields.Number | EntryFields.Integer | undefined;
|
|
5
|
+
type SupportedEntryFieldTypes = EntryFieldTypes.Date | EntryFieldTypes.Number | EntryFieldTypes.Integer | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Range operators appliable to date and number fields
|
|
8
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/ranges | Documentation}
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export type RangeFilters<Fields, Prefix extends string> = ConditionalQueries<Fields, SupportedTypes, Prefix, `[${RangeFilterTypes}]`>;
|
|
12
|
+
/**
|
|
13
|
+
* Range operators appliable to date and number fields in an entry
|
|
14
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/ranges | Documentation}
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export type EntryFieldsRangeFilters<Fields extends Record<string, EntryFieldType<EntrySkeletonType>>, Prefix extends string> = EntryFieldsConditionalQueries<Fields, SupportedEntryFieldTypes, Prefix, `[${RangeFilterTypes}]`>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EntryFieldTypes } from '../entry.js';
|
|
2
|
+
import type { ConditionalPick } from 'type-fest';
|
|
3
|
+
type SupportedTypes = EntryFieldTypes.Array<EntryFieldTypes.EntryLink<any>> | EntryFieldTypes.EntryLink<any> | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Search on references in provided fields
|
|
6
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/search-on-references | Documentation}
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export type ReferenceSearchFilters<Fields, Prefix extends string> = {
|
|
10
|
+
[FieldName in keyof ConditionalPick<Fields, SupportedTypes> as `${Prefix}.${string & FieldName}.${string}`]?: any;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { EntryFields, EntryFieldTypes } from '../entry.js';
|
|
2
|
+
import type { ConditionalFixedQueries, FieldsType } from './util.js';
|
|
3
|
+
type SupportedTypes = EntryFields.Text | EntryFields.RichText | EntryFields.Symbol | EntryFields.Symbol[] | undefined;
|
|
4
|
+
type SupportedEntryFieldTypes = EntryFieldTypes.Text | EntryFieldTypes.RichText | EntryFieldTypes.Symbol | EntryFieldTypes.Array<EntryFieldTypes.Symbol> | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* match - full text search in provided fields
|
|
7
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/full-text-search | Documentation}
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export type FullTextSearchFilters<Fields extends FieldsType, Prefix extends string> = ConditionalFixedQueries<Fields, SupportedTypes, string, Prefix, '[match]'>;
|
|
11
|
+
/**
|
|
12
|
+
* match - full text search in provided fields of an entry
|
|
13
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/full-text-search | Documentation}
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export type EntryFieldsFullTextSearchFilters<Fields extends FieldsType, Prefix extends string> = ConditionalFixedQueries<Fields, SupportedEntryFieldTypes, string, Prefix, '[match]'>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { FieldsType } from './util.js';
|
|
2
|
+
import type { EntrySys } from '../entry.js';
|
|
3
|
+
import type { AssetSys } from '../asset.js';
|
|
4
|
+
import type { Metadata } from '../metadata.js';
|
|
5
|
+
export type SelectFilterPaths<Fields extends FieldsType, Prefix extends string> = `${Prefix}.${keyof Fields & string}`;
|
|
6
|
+
/**
|
|
7
|
+
* Select fields from provided fields in an entry
|
|
8
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/select-operator | Documentation}
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export type EntrySelectFilterWithFields<Fields extends FieldsType> = {
|
|
12
|
+
select?: ('sys' | 'fields' | 'metadata' | SelectFilterPaths<EntrySys, 'sys'> | SelectFilterPaths<Fields, 'fields'> | SelectFilterPaths<Metadata, 'metadata'>)[];
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Select fields in an entry
|
|
16
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/select-operator | Documentation}
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export type EntrySelectFilter = {
|
|
20
|
+
select?: ('sys' | 'fields' | 'metadata' | SelectFilterPaths<EntrySys, 'sys'> | SelectFilterPaths<Metadata, 'metadata'>)[];
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Select fields in an asset
|
|
24
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/select-operator | Documentation}
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export type AssetSelectFilter<Fields extends FieldsType> = {
|
|
28
|
+
select?: ('sys' | SelectFilterPaths<AssetSys, 'sys'> | 'fields' | SelectFilterPaths<Fields, 'fields'> | 'metadata' | SelectFilterPaths<Metadata, 'metadata'>)[];
|
|
29
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { EntryFieldType, EntryFieldTypes } from '../index.js';
|
|
2
|
+
import type { EntryFieldsConditionalListQueries } from './util.js';
|
|
3
|
+
type SupportedTypes = EntryFieldTypes.Symbol | EntryFieldTypes.Array<EntryFieldTypes.Symbol> | EntryFieldTypes.Text | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* Match multiple values in provided fields of an entry
|
|
6
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/array-with-multiple-values | Documentation}
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export type EntryFieldsSetFilter<Fields extends Record<string, EntryFieldType<any>>, Prefix extends string> = EntryFieldsConditionalListQueries<Fields, SupportedTypes, Prefix, `[all]`>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { EntryFields, EntryFieldType, EntryFieldTypes } from '../index.js';
|
|
2
|
+
import type { ConditionalListQueries, EntryFieldsConditionalListQueries } from './util.js';
|
|
3
|
+
type SubsetFilterTypes = 'in' | 'nin';
|
|
4
|
+
type SupportedTypes = EntryFields.Symbol | EntryFields.Symbol[] | EntryFields.Text | EntryFields.Integer | EntryFields.Number | EntryFields.Date | EntryFields.Boolean | undefined;
|
|
5
|
+
type SupportedEntryFieldTypes = EntryFieldTypes.Symbol | EntryFieldTypes.Array<EntryFieldTypes.Symbol> | EntryFieldTypes.Text | EntryFieldTypes.Integer | EntryFieldTypes.Number | EntryFieldTypes.Date | EntryFieldTypes.Boolean | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Subset filters for inclusion & exclusion in provided fields
|
|
8
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/inclusion | Inclusion documentation}
|
|
9
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/exclusion | Exclusion documentation}
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export type SubsetFilters<Fields, Prefix extends string> = ConditionalListQueries<Fields, SupportedTypes, Prefix, `[${SubsetFilterTypes}]`>;
|
|
13
|
+
/**
|
|
14
|
+
* Subset filters for inclusion & exclusion in provided fields of an entry
|
|
15
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/inclusion | Inclusion documentation}
|
|
16
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/exclusion | Exclusion documentation}
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export type EntryFieldsSubsetFilters<Fields extends Record<string, EntryFieldType<any>>, Prefix extends string> = EntryFieldsConditionalListQueries<Fields, SupportedEntryFieldTypes, Prefix, `[${SubsetFilterTypes}]`>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ConditionalPick } from 'type-fest';
|
|
2
|
+
import type { BaseFieldMap, EntryFieldType, EntryFieldTypes } from '../entry.js';
|
|
3
|
+
/**
|
|
4
|
+
* @category Entity
|
|
5
|
+
*/
|
|
6
|
+
export type FieldsType = Record<string, any>;
|
|
7
|
+
/**
|
|
8
|
+
* @category Entry
|
|
9
|
+
*/
|
|
10
|
+
export type EntrySkeletonType<Fields extends FieldsType = FieldsType, Id = string> = {
|
|
11
|
+
fields: Fields;
|
|
12
|
+
contentTypeId: Id;
|
|
13
|
+
};
|
|
14
|
+
type BaseOrArrayType<T> = T extends Array<infer U> ? U : T;
|
|
15
|
+
type EntryFieldBaseOrArrayType<T> = T extends EntryFieldTypes.Array<infer U> ? U : T;
|
|
16
|
+
export type NonEmpty<T> = T extends Record<string, never> ? never : T;
|
|
17
|
+
export type ConditionalFixedQueries<Fields extends FieldsType, SupportedTypes, ValueType, Prefix extends string, QueryFilter extends string = ''> = {
|
|
18
|
+
[FieldName in keyof ConditionalPick<Fields, SupportedTypes> as `${Prefix}.${string & FieldName}${QueryFilter}`]?: ValueType;
|
|
19
|
+
};
|
|
20
|
+
export type ConditionalListQueries<Fields, SupportedTypes, Prefix extends string, QueryFilter extends string = ''> = {
|
|
21
|
+
[FieldName in keyof ConditionalPick<Fields, SupportedTypes> as `${Prefix}.${string & FieldName}${QueryFilter}`]?: NonNullable<BaseOrArrayType<Fields[FieldName]>>[];
|
|
22
|
+
};
|
|
23
|
+
export type EntryFieldsConditionalListQueries<Fields extends Record<string, EntryFieldType<any>>, SupportedTypes, Prefix extends string, QueryFilter extends string = ''> = {
|
|
24
|
+
[FieldName in keyof ConditionalPick<Fields, SupportedTypes> as `${Prefix}.${string & FieldName}${QueryFilter}`]?: NonNullable<BaseFieldMap<EntryFieldBaseOrArrayType<Fields[FieldName]>>>[];
|
|
25
|
+
};
|
|
26
|
+
export type ConditionalQueries<Fields, SupportedTypes, Prefix extends string, QueryFilter extends string = ''> = {
|
|
27
|
+
[FieldName in keyof ConditionalPick<Fields, SupportedTypes> as `${Prefix}.${string & FieldName}${QueryFilter}`]?: Fields[FieldName] extends Array<infer T> ? T : Fields[FieldName];
|
|
28
|
+
};
|
|
29
|
+
export type EntryFieldsConditionalQueries<Fields extends Record<string, EntryFieldType<EntrySkeletonType>>, SupportedTypes extends EntryFieldType<EntrySkeletonType> | undefined, Prefix extends string, QueryFilter extends string = ''> = {
|
|
30
|
+
[FieldName in keyof ConditionalPick<Fields, SupportedTypes> as `${Prefix}.${string & FieldName}${QueryFilter}`]?: BaseFieldMap<EntryFieldBaseOrArrayType<Fields[FieldName]>>;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Locale } from './locale.js';
|
|
2
|
+
import type { BaseSys } from './sys.js';
|
|
3
|
+
/**
|
|
4
|
+
* System managed metadata for spaces
|
|
5
|
+
* @category Entity
|
|
6
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/introduction/common-resource-attributes | CDA documentation on common attributes}
|
|
7
|
+
*/
|
|
8
|
+
export interface SpaceSys extends BaseSys {
|
|
9
|
+
type: 'Space';
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Properties of a space
|
|
13
|
+
* @category Entity
|
|
14
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/spaces | CDA documentation on Spaces}
|
|
15
|
+
*/
|
|
16
|
+
export interface Space {
|
|
17
|
+
sys: SpaceSys;
|
|
18
|
+
name: string;
|
|
19
|
+
locales: Array<Omit<Locale, 'sys'>>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type { Asset } from './asset.js';
|
|
2
|
+
import type { Entry } from './entry.js';
|
|
3
|
+
import type { EntitySys } from './sys.js';
|
|
4
|
+
import type { EntrySkeletonType } from './query/index.js';
|
|
5
|
+
import type { LocaleCode } from './locale.js';
|
|
6
|
+
import type { ChainModifiers } from './client.js';
|
|
7
|
+
/**
|
|
8
|
+
* @category Sync
|
|
9
|
+
*/
|
|
10
|
+
export type SyncOptions = {
|
|
11
|
+
/**
|
|
12
|
+
* @defaultValue true
|
|
13
|
+
*/
|
|
14
|
+
paginate?: boolean;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* @category Sync
|
|
18
|
+
*/
|
|
19
|
+
export type SyncQuery = {
|
|
20
|
+
initial?: true;
|
|
21
|
+
limit?: number;
|
|
22
|
+
nextSyncToken?: string;
|
|
23
|
+
nextPageToken?: string;
|
|
24
|
+
} & ({
|
|
25
|
+
type: 'Entry';
|
|
26
|
+
content_type: string;
|
|
27
|
+
} | {
|
|
28
|
+
type?: 'Asset' | 'Entry' | 'Deletion' | 'DeletedAsset' | 'DeletedEntry';
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* @category Sync
|
|
32
|
+
*/
|
|
33
|
+
export type SyncPageQuery = SyncQuery & {
|
|
34
|
+
sync_token?: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @category Sync
|
|
38
|
+
*/
|
|
39
|
+
export type SyncResponse = {
|
|
40
|
+
nextPageUrl?: string;
|
|
41
|
+
nextSyncUrl?: string;
|
|
42
|
+
items: SyncEntities[];
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* @category Sync
|
|
46
|
+
*/
|
|
47
|
+
export type SyncPageResponse = {
|
|
48
|
+
nextPageToken?: string;
|
|
49
|
+
nextSyncToken?: string;
|
|
50
|
+
items: SyncEntities[];
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* System managed metadata for deleted entries
|
|
54
|
+
* @category Sync
|
|
55
|
+
*/
|
|
56
|
+
export type DeletedEntry = {
|
|
57
|
+
sys: EntitySys & {
|
|
58
|
+
type: 'DeletedEntry';
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* System managed metadata for deleted assets
|
|
63
|
+
* @category Sync
|
|
64
|
+
*/
|
|
65
|
+
export type DeletedAsset = {
|
|
66
|
+
sys: EntitySys & {
|
|
67
|
+
type: 'DeletedAsset';
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* @category Sync
|
|
72
|
+
*/
|
|
73
|
+
export type SyncEntities = Entry<EntrySkeletonType> | Asset | DeletedEntry | DeletedAsset;
|
|
74
|
+
/**
|
|
75
|
+
* @category Sync
|
|
76
|
+
*/
|
|
77
|
+
export interface SyncCollection<EntrySkeleton extends EntrySkeletonType, Modifiers extends ChainModifiers = ChainModifiers, Locales extends LocaleCode = LocaleCode> {
|
|
78
|
+
entries: Array<Entry<EntrySkeleton, ChainModifiers extends Modifiers ? ChainModifiers : Exclude<Modifiers, undefined> | 'WITH_ALL_LOCALES', Locales>>;
|
|
79
|
+
assets: Array<Asset<ChainModifiers extends Modifiers ? ChainModifiers : Exclude<Modifiers, undefined> | 'WITH_ALL_LOCALES', Locales>>;
|
|
80
|
+
deletedEntries: Array<DeletedEntry>;
|
|
81
|
+
deletedAssets: Array<DeletedAsset>;
|
|
82
|
+
nextSyncToken?: string;
|
|
83
|
+
nextPageToken?: string;
|
|
84
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ContentSourceMapsLookup, CPAContentSourceMaps } from '@contentful/content-source-maps';
|
|
2
|
+
import type { EntryFields } from './entry.js';
|
|
3
|
+
import type { EnvironmentLink, SpaceLink } from './link.js';
|
|
4
|
+
/**
|
|
5
|
+
* Definition of common part of system managed metadata
|
|
6
|
+
*/
|
|
7
|
+
export interface BaseSys {
|
|
8
|
+
type: string;
|
|
9
|
+
id: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* System managed metadata for entities
|
|
13
|
+
* @category Entity
|
|
14
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/introduction/common-resource-attributes | CDA documentation on common attributes}
|
|
15
|
+
*/
|
|
16
|
+
export interface EntitySys extends BaseSys {
|
|
17
|
+
createdAt: EntryFields.Date;
|
|
18
|
+
updatedAt: EntryFields.Date;
|
|
19
|
+
revision: number;
|
|
20
|
+
space: {
|
|
21
|
+
sys: SpaceLink;
|
|
22
|
+
};
|
|
23
|
+
environment: {
|
|
24
|
+
sys: EnvironmentLink;
|
|
25
|
+
};
|
|
26
|
+
locale?: string;
|
|
27
|
+
contentSourceMaps?: CPAContentSourceMaps;
|
|
28
|
+
contentSourceMapsLookup?: ContentSourceMapsLookup;
|
|
29
|
+
publishedVersion: number;
|
|
30
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { EntitySys } from './sys.js';
|
|
2
|
+
import type { ContentfulCollection } from './collection.js';
|
|
3
|
+
import type { UserLink } from './link.js';
|
|
4
|
+
/**
|
|
5
|
+
* System managed metadata for tags
|
|
6
|
+
* @category Tag
|
|
7
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/introduction/common-resource-attributes | CDA documentation on common attributes}
|
|
8
|
+
*/
|
|
9
|
+
export interface TagSys extends Omit<EntitySys, 'locale' | 'revision'> {
|
|
10
|
+
version: number;
|
|
11
|
+
visibility: string;
|
|
12
|
+
createdBy: {
|
|
13
|
+
sys: UserLink;
|
|
14
|
+
};
|
|
15
|
+
updatedBy: {
|
|
16
|
+
sys: UserLink;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Properties for a single content tag definition
|
|
21
|
+
* @category Tag
|
|
22
|
+
* @see {@link https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/content-tags | CDA documentation on Content Tags}
|
|
23
|
+
*/
|
|
24
|
+
export type Tag = {
|
|
25
|
+
name: string;
|
|
26
|
+
sys: TagSys;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Collection of tags
|
|
30
|
+
* @category Tag
|
|
31
|
+
*/
|
|
32
|
+
export type TagCollection = ContentfulCollection<Tag>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ChainModifiers } from '../types/client.js';
|
|
2
|
+
export type ChainOption<Modifiers extends ChainModifiers = ChainModifiers> = {
|
|
3
|
+
withoutLinkResolution: ChainModifiers extends Modifiers ? boolean : 'WITHOUT_LINK_RESOLUTION' extends Modifiers ? true : false;
|
|
4
|
+
withAllLocales: ChainModifiers extends Modifiers ? boolean : 'WITH_ALL_LOCALES' extends Modifiers ? true : false;
|
|
5
|
+
withoutUnresolvableLinks: ChainModifiers extends Modifiers ? boolean : 'WITHOUT_UNRESOLVABLE_LINKS' extends Modifiers ? true : false;
|
|
6
|
+
};
|
|
7
|
+
export type DefaultChainOption = ChainOption<undefined>;
|
|
8
|
+
export type ChainOptions = ChainOption;
|
|
9
|
+
export type ModifiersFromOptions<Options extends ChainOption> = Options extends ChainOption<infer Modifiers> ? Modifiers : never;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
type NormalizedCursorPaginationParams<Query extends Record<string, unknown>> = Omit<Query, 'cursor' | 'skip'> & {
|
|
2
|
+
cursor: true;
|
|
3
|
+
};
|
|
4
|
+
export declare function normalizeCursorPaginationParameters<Query extends Record<string, unknown>>(query: Query): NormalizedCursorPaginationParams<Query>;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function normalizeSearchParameters(query: Record<string, any>): Record<string, any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function normalizeSelect(query: any): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getQuerySelectionSet(query: Record<string, any>): Set<string>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CreateClientParams } from '../contentful';
|
|
2
|
+
import type { TimelinePreview } from '../types/timeline-preview';
|
|
3
|
+
export declare const isValidTimelinePreviewConfig: (timelinePreview: TimelinePreview) => boolean;
|
|
4
|
+
export declare const getTimelinePreviewParams: (params: CreateClientParams) => {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
timelinePreview: TimelinePreview;
|
|
7
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TimelinePreview } from '../types/timeline-preview.js';
|
|
2
|
+
export declare function validateLocaleParam(query: any, isWithAllLocalesClient: boolean): void;
|
|
3
|
+
export declare function validateResolveLinksParam(query: any): void;
|
|
4
|
+
export declare function validateRemoveUnresolvedParam(query: any): void;
|
|
5
|
+
export declare function checkIncludeContentSourceMapsParamIsAllowed(host?: string, includeContentSourceMaps?: boolean): boolean;
|
|
6
|
+
export declare function checkEnableTimelinePreviewIsAllowed(host: string, timelinePreview?: TimelinePreview): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function validateSearchParameters(query: Record<string, any>): void;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|