@prismicio/client 5.1.0 → 5.1.1

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.
Files changed (41) hide show
  1. package/README.md +1 -1
  2. package/cjs/@prismicio/client.js +1200 -1200
  3. package/cjs/@prismicio/client.js.map +1 -1
  4. package/cjs/@prismicio/client.min.js.map +1 -1
  5. package/esm/@prismicio/client.min.mjs.map +1 -1
  6. package/esm/@prismicio/client.mjs +1200 -1200
  7. package/esm/@prismicio/client.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/types/Api.d.ts +27 -27
  10. package/types/ApiSearchResponse.d.ts +11 -11
  11. package/types/Cookies.d.ts +9 -9
  12. package/types/HttpClient.d.ts +16 -16
  13. package/types/LazySearchForm.d.ts +24 -24
  14. package/types/Predicates.d.ts +58 -58
  15. package/types/PreviewResolver.d.ts +9 -9
  16. package/types/ResolvedApi.d.ts +126 -126
  17. package/types/SearchForm.d.ts +47 -47
  18. package/types/TagsForm.d.ts +7 -7
  19. package/types/cache.d.ts +17 -17
  20. package/types/client.d.ts +34 -34
  21. package/types/documents.d.ts +20 -20
  22. package/types/experiments.d.ts +22 -22
  23. package/types/form.d.ts +25 -25
  24. package/types/index.d.ts +129 -129
  25. package/types/lru.d.ts +25 -25
  26. package/types/request.d.ts +13 -13
  27. package/umd/@prismicio/client.js +1200 -1200
  28. package/umd/@prismicio/client.js.map +1 -1
  29. package/umd/@prismicio/client.min.js.map +1 -1
  30. package/cjs/prismic-javascript.js +0 -1282
  31. package/cjs/prismic-javascript.js.map +0 -1
  32. package/cjs/prismic-javascript.min.js +0 -16
  33. package/cjs/prismic-javascript.min.js.map +0 -1
  34. package/esm/prismic-javascript.min.mjs +0 -16
  35. package/esm/prismic-javascript.min.mjs.map +0 -1
  36. package/esm/prismic-javascript.mjs +0 -1278
  37. package/esm/prismic-javascript.mjs.map +0 -1
  38. package/umd/prismic-javascript.js +0 -1286
  39. package/umd/prismic-javascript.js.map +0 -1
  40. package/umd/prismic-javascript.min.js +0 -17
  41. package/umd/prismic-javascript.min.js.map +0 -1
@@ -1,126 +1,126 @@
1
- import { Document } from './documents';
2
- import { RequestCallback } from './request';
3
- import { Experiment, Experiments } from './experiments';
4
- import { FormData, Form } from './form';
5
- import SearchForm from './SearchForm';
6
- import TagsForm from './TagsForm';
7
- import ApiSearchResponse from './ApiSearchResponse';
8
- import HttpClient from './HttpClient';
9
- import { Client } from './client';
10
- import { PreviewResolver } from './PreviewResolver';
11
- export declare const PREVIEW_COOKIE = "io.prismic.preview";
12
- export declare const EXPERIMENT_COOKIE = "io.prismic.experiment";
13
- export interface Ref {
14
- ref: string;
15
- label: string;
16
- isMasterRef: boolean;
17
- scheduledAt: string;
18
- id: string;
19
- }
20
- export interface Language {
21
- id: string;
22
- name: string;
23
- }
24
- export interface ApiData {
25
- refs: Ref[];
26
- bookmarks: {
27
- [key: string]: string;
28
- };
29
- languages: Language[];
30
- types: {
31
- [key: string]: string;
32
- };
33
- tags: string[];
34
- forms: {
35
- [key: string]: FormData;
36
- };
37
- experiments: any;
38
- oauth_initiate: string;
39
- oauth_token: string;
40
- version: string;
41
- licence: string;
42
- }
43
- export interface PreviewResponse {
44
- mainDocument?: string;
45
- }
46
- export interface QueryOptions {
47
- [key: string]: string | number | string[];
48
- }
49
- export interface ResolvedApiOptions {
50
- req?: any;
51
- }
52
- export default class ResolvedApi implements Client {
53
- data: ApiData;
54
- masterRef: Ref;
55
- experiments: Experiments;
56
- options: ResolvedApiOptions;
57
- httpClient: HttpClient;
58
- bookmarks: {
59
- [key: string]: string;
60
- };
61
- refs: Ref[];
62
- tags: string[];
63
- types: {
64
- [key: string]: string;
65
- };
66
- languages: Language[];
67
- constructor(data: ApiData, httpClient: HttpClient, options: ResolvedApiOptions);
68
- /**
69
- * Returns a useable form from its id, as described in the RESTful description of the API.
70
- * For instance: api.form("everything") works on every repository (as "everything" exists by default)
71
- * You can then chain the calls: api.form("everything").query('[[:d = at(document.id, "UkL0gMuvzYUANCpf")]]').ref(ref).submit()
72
- */
73
- form(formId: string): Form | null;
74
- searchForm(formId: string): SearchForm | null;
75
- tagsForm(): TagsForm;
76
- everything(): SearchForm;
77
- /**
78
- * The ID of the master ref on this prismic.io API.
79
- * Do not use like this: searchForm.ref(api.master()).
80
- * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page.
81
- */
82
- master(): string;
83
- /**
84
- * Returns the ref ID for a given ref's label.
85
- * Do not use like this: searchForm.ref(api.ref("Future release label")).
86
- * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page.
87
- */
88
- ref(label: string): string | null;
89
- currentExperiment(): Experiment | null;
90
- /**
91
- * Query the repository
92
- */
93
- query(q: string | string[], optionsOrCallback?: QueryOptions | RequestCallback<ApiSearchResponse>, cb?: RequestCallback<ApiSearchResponse>): Promise<ApiSearchResponse>;
94
- /**
95
- * Retrieve the document returned by the given query
96
- * @param {string|array|Predicate} the query
97
- * @param {object} additional parameters. In NodeJS, pass the request as 'req'.
98
- * @param {function} callback(err, doc)
99
- */
100
- queryFirst(q: string | string[], optionsOrCallback?: QueryOptions | RequestCallback<Document>, cb?: RequestCallback<Document>): Promise<Document>;
101
- /**
102
- * Retrieve the document with the given id
103
- */
104
- getByID(id: string, maybeOptions?: QueryOptions, cb?: RequestCallback<Document>): Promise<Document>;
105
- /**
106
- * Retrieve multiple documents from an array of id
107
- */
108
- getByIDs(ids: string[], maybeOptions?: QueryOptions, cb?: RequestCallback<ApiSearchResponse>): Promise<ApiSearchResponse>;
109
- /**
110
- * Retrieve the document with the given uid
111
- */
112
- getByUID(type: string, uid: string, maybeOptions?: QueryOptions, cb?: RequestCallback<Document>): Promise<Document>;
113
- /**
114
- * Retrieve the singleton document with the given type
115
- */
116
- getSingle(type: string, maybeOptions?: QueryOptions, cb?: RequestCallback<Document>): Promise<Document>;
117
- /**
118
- * Retrieve the document with the given bookmark
119
- */
120
- getBookmark(bookmark: string, maybeOptions?: QueryOptions, cb?: RequestCallback<Document>): Promise<Document>;
121
- /**
122
- * Return all tags of your repository
123
- */
124
- getTags(cb?: RequestCallback<string[]>): Promise<string[]>;
125
- getPreviewResolver(token: string, documentId?: string): PreviewResolver;
126
- }
1
+ import { Document } from './documents';
2
+ import { RequestCallback } from './request';
3
+ import { Experiment, Experiments } from './experiments';
4
+ import { FormData, Form } from './form';
5
+ import SearchForm from './SearchForm';
6
+ import TagsForm from './TagsForm';
7
+ import ApiSearchResponse from './ApiSearchResponse';
8
+ import HttpClient from './HttpClient';
9
+ import { Client } from './client';
10
+ import { PreviewResolver } from './PreviewResolver';
11
+ export declare const PREVIEW_COOKIE = "io.prismic.preview";
12
+ export declare const EXPERIMENT_COOKIE = "io.prismic.experiment";
13
+ export interface Ref {
14
+ ref: string;
15
+ label: string;
16
+ isMasterRef: boolean;
17
+ scheduledAt: string;
18
+ id: string;
19
+ }
20
+ export interface Language {
21
+ id: string;
22
+ name: string;
23
+ }
24
+ export interface ApiData {
25
+ refs: Ref[];
26
+ bookmarks: {
27
+ [key: string]: string;
28
+ };
29
+ languages: Language[];
30
+ types: {
31
+ [key: string]: string;
32
+ };
33
+ tags: string[];
34
+ forms: {
35
+ [key: string]: FormData;
36
+ };
37
+ experiments: any;
38
+ oauth_initiate: string;
39
+ oauth_token: string;
40
+ version: string;
41
+ licence: string;
42
+ }
43
+ export interface PreviewResponse {
44
+ mainDocument?: string;
45
+ }
46
+ export interface QueryOptions {
47
+ [key: string]: string | number | string[];
48
+ }
49
+ export interface ResolvedApiOptions {
50
+ req?: any;
51
+ }
52
+ export default class ResolvedApi implements Client {
53
+ data: ApiData;
54
+ masterRef: Ref;
55
+ experiments: Experiments;
56
+ options: ResolvedApiOptions;
57
+ httpClient: HttpClient;
58
+ bookmarks: {
59
+ [key: string]: string;
60
+ };
61
+ refs: Ref[];
62
+ tags: string[];
63
+ types: {
64
+ [key: string]: string;
65
+ };
66
+ languages: Language[];
67
+ constructor(data: ApiData, httpClient: HttpClient, options: ResolvedApiOptions);
68
+ /**
69
+ * Returns a useable form from its id, as described in the RESTful description of the API.
70
+ * For instance: api.form("everything") works on every repository (as "everything" exists by default)
71
+ * You can then chain the calls: api.form("everything").query('[[:d = at(document.id, "UkL0gMuvzYUANCpf")]]').ref(ref).submit()
72
+ */
73
+ form(formId: string): Form | null;
74
+ searchForm(formId: string): SearchForm | null;
75
+ tagsForm(): TagsForm;
76
+ everything(): SearchForm;
77
+ /**
78
+ * The ID of the master ref on this prismic.io API.
79
+ * Do not use like this: searchForm.ref(api.master()).
80
+ * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page.
81
+ */
82
+ master(): string;
83
+ /**
84
+ * Returns the ref ID for a given ref's label.
85
+ * Do not use like this: searchForm.ref(api.ref("Future release label")).
86
+ * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page.
87
+ */
88
+ ref(label: string): string | null;
89
+ currentExperiment(): Experiment | null;
90
+ /**
91
+ * Query the repository
92
+ */
93
+ query(q: string | string[], optionsOrCallback?: QueryOptions | RequestCallback<ApiSearchResponse>, cb?: RequestCallback<ApiSearchResponse>): Promise<ApiSearchResponse>;
94
+ /**
95
+ * Retrieve the document returned by the given query
96
+ * @param {string|array|Predicate} the query
97
+ * @param {object} additional parameters. In NodeJS, pass the request as 'req'.
98
+ * @param {function} callback(err, doc)
99
+ */
100
+ queryFirst(q: string | string[], optionsOrCallback?: QueryOptions | RequestCallback<Document>, cb?: RequestCallback<Document>): Promise<Document>;
101
+ /**
102
+ * Retrieve the document with the given id
103
+ */
104
+ getByID(id: string, maybeOptions?: QueryOptions, cb?: RequestCallback<Document>): Promise<Document>;
105
+ /**
106
+ * Retrieve multiple documents from an array of id
107
+ */
108
+ getByIDs(ids: string[], maybeOptions?: QueryOptions, cb?: RequestCallback<ApiSearchResponse>): Promise<ApiSearchResponse>;
109
+ /**
110
+ * Retrieve the document with the given uid
111
+ */
112
+ getByUID(type: string, uid: string, maybeOptions?: QueryOptions, cb?: RequestCallback<Document>): Promise<Document>;
113
+ /**
114
+ * Retrieve the singleton document with the given type
115
+ */
116
+ getSingle(type: string, maybeOptions?: QueryOptions, cb?: RequestCallback<Document>): Promise<Document>;
117
+ /**
118
+ * Retrieve the document with the given bookmark
119
+ */
120
+ getBookmark(bookmark: string, maybeOptions?: QueryOptions, cb?: RequestCallback<Document>): Promise<Document>;
121
+ /**
122
+ * Return all tags of your repository
123
+ */
124
+ getTags(cb?: RequestCallback<string[]>): Promise<string[]>;
125
+ getPreviewResolver(token: string, documentId?: string): PreviewResolver;
126
+ }
@@ -1,47 +1,47 @@
1
- import { FormData, Form } from './form';
2
- import HttpClient from './HttpClient';
3
- export default class SearchForm extends Form {
4
- httpClient: HttpClient;
5
- form: FormData;
6
- data: any;
7
- constructor(form: FormData, httpClient: HttpClient);
8
- set(field: string, value: any): SearchForm;
9
- /**
10
- * Sets a ref to query on for this SearchForm. This is a mandatory
11
- * method to call before calling submit(), and api.form('everything').submit()
12
- * will not work.
13
- */
14
- ref(ref: string): SearchForm;
15
- /**
16
- * Sets a predicate-based query for this SearchForm. This is where you
17
- * paste what you compose in your prismic.io API browser.
18
- */
19
- query(query: string | string[]): SearchForm;
20
- /**
21
- * Sets a page size to query for this SearchForm. This is an optional method.
22
- *
23
- * @param {number} size - The page size
24
- * @returns {SearchForm} - The SearchForm itself
25
- */
26
- pageSize(size: number): SearchForm;
27
- /**
28
- * Sets the graphquery to query for this SearchForm. This is an optional method.
29
- */
30
- graphQuery(query: string): SearchForm;
31
- /**
32
- * Sets the language to query for this SearchForm. This is an optional method.
33
- */
34
- lang(langCode: string): SearchForm;
35
- /**
36
- * Sets the page number to query for this SearchForm. This is an optional method.
37
- */
38
- page(p: number): SearchForm;
39
- /**
40
- * Remove all the documents except for those after the specified document in the list. This is an optional method.
41
- */
42
- after(documentId: string): SearchForm;
43
- /**
44
- * Sets the orderings to query for this SearchForm. This is an optional method.
45
- */
46
- orderings(orderings?: string[]): SearchForm;
47
- }
1
+ import { FormData, Form } from './form';
2
+ import HttpClient from './HttpClient';
3
+ export default class SearchForm extends Form {
4
+ httpClient: HttpClient;
5
+ form: FormData;
6
+ data: any;
7
+ constructor(form: FormData, httpClient: HttpClient);
8
+ set(field: string, value: any): SearchForm;
9
+ /**
10
+ * Sets a ref to query on for this SearchForm. This is a mandatory
11
+ * method to call before calling submit(), and api.form('everything').submit()
12
+ * will not work.
13
+ */
14
+ ref(ref: string): SearchForm;
15
+ /**
16
+ * Sets a predicate-based query for this SearchForm. This is where you
17
+ * paste what you compose in your prismic.io API browser.
18
+ */
19
+ query(query: string | string[]): SearchForm;
20
+ /**
21
+ * Sets a page size to query for this SearchForm. This is an optional method.
22
+ *
23
+ * @param {number} size - The page size
24
+ * @returns {SearchForm} - The SearchForm itself
25
+ */
26
+ pageSize(size: number): SearchForm;
27
+ /**
28
+ * Sets the graphquery to query for this SearchForm. This is an optional method.
29
+ */
30
+ graphQuery(query: string): SearchForm;
31
+ /**
32
+ * Sets the language to query for this SearchForm. This is an optional method.
33
+ */
34
+ lang(langCode: string): SearchForm;
35
+ /**
36
+ * Sets the page number to query for this SearchForm. This is an optional method.
37
+ */
38
+ page(p: number): SearchForm;
39
+ /**
40
+ * Remove all the documents except for those after the specified document in the list. This is an optional method.
41
+ */
42
+ after(documentId: string): SearchForm;
43
+ /**
44
+ * Sets the orderings to query for this SearchForm. This is an optional method.
45
+ */
46
+ orderings(orderings?: string[]): SearchForm;
47
+ }
@@ -1,7 +1,7 @@
1
- import { FormData, Form } from './form';
2
- import HttpClient from './HttpClient';
3
- export default class TagsForm extends Form {
4
- httpClient: HttpClient;
5
- form: FormData;
6
- constructor(form: FormData, httpClient: HttpClient);
7
- }
1
+ import { FormData, Form } from './form';
2
+ import HttpClient from './HttpClient';
3
+ export default class TagsForm extends Form {
4
+ httpClient: HttpClient;
5
+ form: FormData;
6
+ constructor(form: FormData, httpClient: HttpClient);
7
+ }
package/types/cache.d.ts CHANGED
@@ -1,17 +1,17 @@
1
- import { ILRUCache } from './lru';
2
- export interface ApiCache {
3
- isExpired(key: string): boolean;
4
- get<T>(key: string, cb: (error: Error | null, entry?: T) => void): void;
5
- set<T>(key: string, value: T, ttl: number, cb?: (error: Error | null) => void): void;
6
- remove(key: string, cb?: (error: Error | null) => void): void;
7
- clear(cb?: (error: Error | null) => void): void;
8
- }
9
- export declare class DefaultApiCache implements ApiCache {
10
- lru: ILRUCache;
11
- constructor(limit?: number);
12
- isExpired(key: string): boolean;
13
- get<T>(key: string, cb: (error: Error | null, entry?: T) => void): void;
14
- set<T>(key: string, value: T, ttl: number, cb?: (error: Error | null) => void): void;
15
- remove(key: string, cb?: (error: Error | null) => void): void;
16
- clear(cb?: (error: Error | null) => void): void;
17
- }
1
+ import { ILRUCache } from './lru';
2
+ export interface ApiCache {
3
+ isExpired(key: string): boolean;
4
+ get<T>(key: string, cb: (error: Error | null, entry?: T) => void): void;
5
+ set<T>(key: string, value: T, ttl: number, cb?: (error: Error | null) => void): void;
6
+ remove(key: string, cb?: (error: Error | null) => void): void;
7
+ clear(cb?: (error: Error | null) => void): void;
8
+ }
9
+ export declare class DefaultApiCache implements ApiCache {
10
+ lru: ILRUCache;
11
+ constructor(limit?: number);
12
+ isExpired(key: string): boolean;
13
+ get<T>(key: string, cb: (error: Error | null, entry?: T) => void): void;
14
+ set<T>(key: string, value: T, ttl: number, cb?: (error: Error | null) => void): void;
15
+ remove(key: string, cb?: (error: Error | null) => void): void;
16
+ clear(cb?: (error: Error | null) => void): void;
17
+ }
package/types/client.d.ts CHANGED
@@ -1,34 +1,34 @@
1
- import { Document } from "./documents";
2
- import ResolvedApi, { QueryOptions } from './ResolvedApi';
3
- import ApiSearchResponse from './ApiSearchResponse';
4
- import LazySearchForm from './LazySearchForm';
5
- import { RequestCallback } from './request';
6
- import Api, { ApiOptions } from './Api';
7
- import { PreviewResolver } from './PreviewResolver';
8
- export interface Client {
9
- query(q: string | string[], optionsOrCallback?: QueryOptions | RequestCallback<ApiSearchResponse>, cb?: RequestCallback<ApiSearchResponse>): Promise<ApiSearchResponse>;
10
- queryFirst(q: string | string[], optionsOrCallback?: QueryOptions | RequestCallback<Document>, cb?: RequestCallback<Document>): Promise<Document>;
11
- getByID(id: string, options: QueryOptions, cb: RequestCallback<Document>): Promise<Document>;
12
- getByIDs(ids: string[], options: QueryOptions, cb: RequestCallback<ApiSearchResponse>): Promise<ApiSearchResponse>;
13
- getByUID(type: string, uid: string, options: QueryOptions, cb: RequestCallback<Document>): Promise<Document>;
14
- getSingle(type: string, options: QueryOptions, cb: RequestCallback<Document>): Promise<Document>;
15
- getBookmark(bookmark: string, options: QueryOptions, cb: RequestCallback<Document>): Promise<Document>;
16
- getPreviewResolver(token: string, documentId?: string): PreviewResolver;
17
- }
18
- export declare class DefaultClient implements Client {
19
- api: Api;
20
- constructor(url: string, options?: ApiOptions);
21
- getApi(): Promise<ResolvedApi>;
22
- everything(): LazySearchForm;
23
- form(formId: string): LazySearchForm;
24
- query(q: string | string[], optionsOrCallback?: QueryOptions | RequestCallback<ApiSearchResponse>, cb?: RequestCallback<ApiSearchResponse>): Promise<ApiSearchResponse>;
25
- queryFirst(q: string | string[], optionsOrCallback?: QueryOptions | RequestCallback<Document>, cb?: RequestCallback<Document>): Promise<Document>;
26
- getByID(id: string, options: QueryOptions, cb?: RequestCallback<Document>): Promise<Document>;
27
- getByIDs(ids: string[], options: QueryOptions, cb?: RequestCallback<ApiSearchResponse>): Promise<ApiSearchResponse>;
28
- getByUID(type: string, uid: string, options: QueryOptions, cb?: RequestCallback<Document>): Promise<Document>;
29
- getSingle(type: string, options: QueryOptions, cb?: RequestCallback<Document>): Promise<Document>;
30
- getBookmark(bookmark: string, options: QueryOptions, cb?: RequestCallback<Document>): Promise<Document>;
31
- getTags(): Promise<string[]>;
32
- getPreviewResolver(token: string, documentId?: string): PreviewResolver;
33
- static getApi(url: string, options?: ApiOptions): Promise<ResolvedApi>;
34
- }
1
+ import { Document } from "./documents";
2
+ import ResolvedApi, { QueryOptions } from './ResolvedApi';
3
+ import ApiSearchResponse from './ApiSearchResponse';
4
+ import LazySearchForm from './LazySearchForm';
5
+ import { RequestCallback } from './request';
6
+ import Api, { ApiOptions } from './Api';
7
+ import { PreviewResolver } from './PreviewResolver';
8
+ export interface Client {
9
+ query<T>(q: string | string[], optionsOrCallback?: QueryOptions | RequestCallback<ApiSearchResponse<T>>, cb?: RequestCallback<ApiSearchResponse<T>>): Promise<ApiSearchResponse<T>>;
10
+ queryFirst<T>(q: string | string[], optionsOrCallback?: QueryOptions | RequestCallback<Document<T>>, cb?: RequestCallback<Document<T>>): Promise<Document<T>>;
11
+ getByID<T>(id: string, options: QueryOptions, cb: RequestCallback<Document<T>>): Promise<Document<T>>;
12
+ getByIDs<T>(ids: string[], options: QueryOptions, cb: RequestCallback<ApiSearchResponse<T>>): Promise<ApiSearchResponse<T>>;
13
+ getByUID<T>(type: string, uid: string, options: QueryOptions, cb: RequestCallback<Document<T>>): Promise<Document<T>>;
14
+ getSingle<T>(type: string, options: QueryOptions, cb: RequestCallback<Document<T>>): Promise<Document<T>>;
15
+ getBookmark<T>(bookmark: string, options: QueryOptions, cb: RequestCallback<Document<T>>): Promise<Document<T>>;
16
+ getPreviewResolver(token: string, documentId?: string): PreviewResolver;
17
+ }
18
+ export declare class DefaultClient implements Client {
19
+ api: Api;
20
+ constructor(url: string, options?: ApiOptions);
21
+ getApi(): Promise<ResolvedApi>;
22
+ everything(): LazySearchForm;
23
+ form(formId: string): LazySearchForm;
24
+ query<T>(q: string | string[], optionsOrCallback?: QueryOptions | RequestCallback<ApiSearchResponse<T>>, cb?: RequestCallback<ApiSearchResponse<T>>): Promise<ApiSearchResponse<T>>;
25
+ queryFirst<T>(q: string | string[], optionsOrCallback?: QueryOptions | RequestCallback<Document<T>>, cb?: RequestCallback<Document<T>>): Promise<Document<T>>;
26
+ getByID<T>(id: string, options: QueryOptions, cb?: RequestCallback<Document<T>>): Promise<Document<T>>;
27
+ getByIDs<T>(ids: string[], options: QueryOptions, cb?: RequestCallback<ApiSearchResponse<T>>): Promise<ApiSearchResponse<T>>;
28
+ getByUID<T>(type: string, uid: string, options: QueryOptions, cb?: RequestCallback<Document<T>>): Promise<Document<T>>;
29
+ getSingle<T>(type: string, options: QueryOptions, cb?: RequestCallback<Document<T>>): Promise<Document<T>>;
30
+ getBookmark<T>(bookmark: string, options: QueryOptions, cb?: RequestCallback<Document<T>>): Promise<Document<T>>;
31
+ getTags(): Promise<string[]>;
32
+ getPreviewResolver(token: string, documentId?: string): PreviewResolver;
33
+ static getApi(url: string, options?: ApiOptions): Promise<ResolvedApi>;
34
+ }
@@ -1,20 +1,20 @@
1
- export interface AlternateLanguage {
2
- id: string;
3
- uid?: string;
4
- type: string;
5
- lang: string;
6
- }
7
- export interface Document {
8
- id: string;
9
- uid?: string;
10
- url?: string;
11
- type: string;
12
- href: string;
13
- tags: string[];
14
- slugs: string[];
15
- lang?: string;
16
- alternate_languages: AlternateLanguage[];
17
- first_publication_date: string | null;
18
- last_publication_date: string | null;
19
- data: any;
20
- }
1
+ export interface AlternateLanguage {
2
+ id: string;
3
+ uid?: string;
4
+ type: string;
5
+ lang: string;
6
+ }
7
+ export interface Document<T = any> {
8
+ id: string;
9
+ uid?: string;
10
+ url?: string;
11
+ type: string;
12
+ href: string;
13
+ tags: string[];
14
+ slugs: string[];
15
+ lang?: string;
16
+ alternate_languages: AlternateLanguage[];
17
+ first_publication_date: string | null;
18
+ last_publication_date: string | null;
19
+ data: T;
20
+ }
@@ -1,22 +1,22 @@
1
- export declare class Variation {
2
- data: any;
3
- constructor(data: any);
4
- id(): string;
5
- ref(): string;
6
- label(): string;
7
- }
8
- export declare class Experiment {
9
- variations: Variation[];
10
- data: any;
11
- constructor(data: any);
12
- id(): string;
13
- googleId(): string;
14
- name(): string;
15
- }
16
- export declare class Experiments {
17
- drafts: Experiment[];
18
- running: Experiment[];
19
- constructor(data: any);
20
- current(): Experiment | null;
21
- refFromCookie(cookie: string): string | null;
22
- }
1
+ export declare class Variation {
2
+ data: any;
3
+ constructor(data: any);
4
+ id(): string;
5
+ ref(): string;
6
+ label(): string;
7
+ }
8
+ export declare class Experiment {
9
+ variations: Variation[];
10
+ data: any;
11
+ constructor(data: any);
12
+ id(): string;
13
+ googleId(): string;
14
+ name(): string;
15
+ }
16
+ export declare class Experiments {
17
+ drafts: Experiment[];
18
+ running: Experiment[];
19
+ constructor(data: any);
20
+ current(): Experiment | null;
21
+ refFromCookie(cookie: string): string | null;
22
+ }
package/types/form.d.ts CHANGED
@@ -1,25 +1,25 @@
1
- import HttpClient from './HttpClient';
2
- import { RequestCallback } from './request';
3
- export declare type Fields = {
4
- [key: string]: any;
5
- };
6
- export interface FormData {
7
- fields: Fields;
8
- action: string;
9
- name: string;
10
- rel: string;
11
- form_method: string;
12
- enctype: string;
13
- }
14
- export declare abstract class Form {
15
- httpClient: HttpClient;
16
- form: FormData;
17
- data: any;
18
- constructor(form: FormData, httpClient: HttpClient);
19
- protected set(field: string, value: any): void;
20
- url(): string;
21
- /**
22
- * Submits the query, and calls the callback function.
23
- */
24
- submit<T>(cb?: RequestCallback<T>): Promise<T>;
25
- }
1
+ import HttpClient from './HttpClient';
2
+ import { RequestCallback } from './request';
3
+ export declare type Fields = {
4
+ [key: string]: any;
5
+ };
6
+ export interface FormData {
7
+ fields: Fields;
8
+ action: string;
9
+ name: string;
10
+ rel: string;
11
+ form_method: string;
12
+ enctype: string;
13
+ }
14
+ export declare abstract class Form {
15
+ httpClient: HttpClient;
16
+ form: FormData;
17
+ data: any;
18
+ constructor(form: FormData, httpClient: HttpClient);
19
+ protected set(field: string, value: any): void;
20
+ url(): string;
21
+ /**
22
+ * Submits the query, and calls the callback function.
23
+ */
24
+ submit<T>(cb?: RequestCallback<T>): Promise<T>;
25
+ }