microcms-js-sdk 2.5.0 → 2.6.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.
@@ -1,120 +0,0 @@
1
- export declare type Fetch = typeof fetch;
2
- /**
3
- * microCMS createClient params
4
- */
5
- export interface MicroCMSClient {
6
- serviceDomain: string;
7
- apiKey: string;
8
- customFetch?: Fetch;
9
- retry?: boolean;
10
- }
11
- declare type depthNumber = 1 | 2 | 3;
12
- /**
13
- * microCMS queries
14
- * https://document.microcms.io/content-api/get-list-contents#h9ce528688c
15
- * https://document.microcms.io/content-api/get-content#h9ce528688c
16
- */
17
- export interface MicroCMSQueries {
18
- draftKey?: string;
19
- limit?: number;
20
- offset?: number;
21
- orders?: string;
22
- fields?: string | string[];
23
- q?: string;
24
- depth?: depthNumber;
25
- ids?: string | string[];
26
- filters?: string;
27
- richEditorFormat?: 'html' | 'object';
28
- }
29
- /**
30
- * microCMS contentId
31
- * https://document.microcms.io/manual/content-id-setting
32
- */
33
- export interface MicroCMSContentId {
34
- id: string;
35
- }
36
- /**
37
- * microCMS content common date
38
- */
39
- export interface MicroCMSDate {
40
- createdAt: string;
41
- updatedAt: string;
42
- publishedAt?: string;
43
- revisedAt?: string;
44
- }
45
- /**
46
- * microCMS image
47
- */
48
- export interface MicroCMSImage {
49
- url: string;
50
- width?: number;
51
- height?: number;
52
- }
53
- /**
54
- * microCMS list api Response
55
- */
56
- export interface MicroCMSListResponse<T> {
57
- contents: (T & MicroCMSListContent)[];
58
- totalCount: number;
59
- limit: number;
60
- offset: number;
61
- }
62
- /**
63
- * microCMS list content common types
64
- */
65
- export declare type MicroCMSListContent = MicroCMSContentId & MicroCMSDate;
66
- /**
67
- * microCMS object content common types
68
- */
69
- export declare type MicroCMSObjectContent = MicroCMSDate;
70
- export interface MakeRequest {
71
- endpoint: string;
72
- contentId?: string;
73
- queries?: MicroCMSQueries & Record<string, any>;
74
- requestInit?: RequestInit;
75
- }
76
- export declare type CustomRequestInit = Omit<RequestInit, 'method' | 'headers' | 'body'>;
77
- export interface GetRequest {
78
- endpoint: string;
79
- contentId?: string;
80
- queries?: MicroCMSQueries;
81
- customRequestInit?: CustomRequestInit;
82
- }
83
- export interface GetListDetailRequest {
84
- endpoint: string;
85
- contentId: string;
86
- queries?: MicroCMSQueries;
87
- customRequestInit?: CustomRequestInit;
88
- }
89
- export interface GetListRequest {
90
- endpoint: string;
91
- queries?: MicroCMSQueries;
92
- customRequestInit?: CustomRequestInit;
93
- }
94
- export interface GetObjectRequest {
95
- endpoint: string;
96
- queries?: MicroCMSQueries;
97
- customRequestInit?: CustomRequestInit;
98
- }
99
- export interface WriteApiRequestResult {
100
- id: string;
101
- }
102
- export interface CreateRequest<T> {
103
- endpoint: string;
104
- contentId?: string;
105
- content: T;
106
- isDraft?: boolean;
107
- customRequestInit?: CustomRequestInit;
108
- }
109
- export interface UpdateRequest<T> {
110
- endpoint: string;
111
- contentId?: string;
112
- content: Partial<T>;
113
- customRequestInit?: CustomRequestInit;
114
- }
115
- export interface DeleteRequest {
116
- endpoint: string;
117
- contentId: string;
118
- customRequestInit?: CustomRequestInit;
119
- }
120
- export {};
@@ -1,4 +0,0 @@
1
- export declare const BASE_DOMAIN = "microcms.io";
2
- export declare const API_VERSION = "v1";
3
- export declare const MAX_RETRY_COUNT = 2;
4
- export declare const MIN_TIMEOUT_MS = 5000;
@@ -1,14 +0,0 @@
1
- /**
2
- * Check object
3
- *
4
- * @param {unknown} value
5
- * @returns {boolean}
6
- */
7
- export declare const isObject: (value: unknown) => value is Record<string, unknown>;
8
- /**
9
- * Check string
10
- *
11
- * @param {unknown} value
12
- * @returns {boolean}
13
- */
14
- export declare const isString: (value: unknown) => value is string;
@@ -1,2 +0,0 @@
1
- import { MicroCMSQueries } from '../types';
2
- export declare const parseQuery: (queries: MicroCMSQueries) => string;
@@ -1,13 +0,0 @@
1
- import { MicroCMSClient, GetRequest, GetListRequest, GetListDetailRequest, GetObjectRequest, WriteApiRequestResult, CreateRequest, MicroCMSListResponse, MicroCMSListContent, MicroCMSObjectContent, UpdateRequest, DeleteRequest } from './types';
2
- /**
3
- * Initialize SDK Client
4
- */
5
- export declare const createClient: ({ serviceDomain, apiKey, customFetch, retry: retryOption, }: MicroCMSClient) => {
6
- get: <T = any>({ endpoint, contentId, queries, customRequestInit, }: GetRequest) => Promise<T>;
7
- getList: <T_1 = any>({ endpoint, queries, customRequestInit, }: GetListRequest) => Promise<MicroCMSListResponse<T_1>>;
8
- getListDetail: <T_2 = any>({ endpoint, contentId, queries, customRequestInit, }: GetListDetailRequest) => Promise<T_2 & import("./types").MicroCMSContentId & import("./types").MicroCMSDate>;
9
- getObject: <T_3 = any>({ endpoint, queries, customRequestInit, }: GetObjectRequest) => Promise<T_3 & import("./types").MicroCMSDate>;
10
- create: <T_4 extends Record<string | number, any>>({ endpoint, contentId, content, isDraft, customRequestInit, }: CreateRequest<T_4>) => Promise<WriteApiRequestResult>;
11
- update: <T_5 extends Record<string | number, any>>({ endpoint, contentId, content, customRequestInit, }: UpdateRequest<T_5>) => Promise<WriteApiRequestResult>;
12
- delete: ({ endpoint, contentId, customRequestInit, }: DeleteRequest) => Promise<void>;
13
- };
@@ -1,2 +0,0 @@
1
- export { createClient } from './createClient';
2
- export * from './types';
@@ -1,7 +0,0 @@
1
- import { Fetch } from 'src/types';
2
- export declare const resolveFetch: (customFetch?: Fetch) => Fetch;
3
- export declare const resolveHeadersConstructor: () => {
4
- new (init?: HeadersInit | undefined): Headers;
5
- prototype: Headers;
6
- };
7
- export declare const generateFetchClient: (apiKey: string, customFetch?: Fetch) => Fetch;
@@ -1,120 +0,0 @@
1
- export declare type Fetch = typeof fetch;
2
- /**
3
- * microCMS createClient params
4
- */
5
- export interface MicroCMSClient {
6
- serviceDomain: string;
7
- apiKey: string;
8
- customFetch?: Fetch;
9
- retry?: boolean;
10
- }
11
- declare type depthNumber = 1 | 2 | 3;
12
- /**
13
- * microCMS queries
14
- * https://document.microcms.io/content-api/get-list-contents#h9ce528688c
15
- * https://document.microcms.io/content-api/get-content#h9ce528688c
16
- */
17
- export interface MicroCMSQueries {
18
- draftKey?: string;
19
- limit?: number;
20
- offset?: number;
21
- orders?: string;
22
- fields?: string | string[];
23
- q?: string;
24
- depth?: depthNumber;
25
- ids?: string | string[];
26
- filters?: string;
27
- richEditorFormat?: 'html' | 'object';
28
- }
29
- /**
30
- * microCMS contentId
31
- * https://document.microcms.io/manual/content-id-setting
32
- */
33
- export interface MicroCMSContentId {
34
- id: string;
35
- }
36
- /**
37
- * microCMS content common date
38
- */
39
- export interface MicroCMSDate {
40
- createdAt: string;
41
- updatedAt: string;
42
- publishedAt?: string;
43
- revisedAt?: string;
44
- }
45
- /**
46
- * microCMS image
47
- */
48
- export interface MicroCMSImage {
49
- url: string;
50
- width?: number;
51
- height?: number;
52
- }
53
- /**
54
- * microCMS list api Response
55
- */
56
- export interface MicroCMSListResponse<T> {
57
- contents: (T & MicroCMSListContent)[];
58
- totalCount: number;
59
- limit: number;
60
- offset: number;
61
- }
62
- /**
63
- * microCMS list content common types
64
- */
65
- export declare type MicroCMSListContent = MicroCMSContentId & MicroCMSDate;
66
- /**
67
- * microCMS object content common types
68
- */
69
- export declare type MicroCMSObjectContent = MicroCMSDate;
70
- export interface MakeRequest {
71
- endpoint: string;
72
- contentId?: string;
73
- queries?: MicroCMSQueries & Record<string, any>;
74
- requestInit?: RequestInit;
75
- }
76
- export declare type CustomRequestInit = Omit<RequestInit, 'method' | 'headers' | 'body'>;
77
- export interface GetRequest {
78
- endpoint: string;
79
- contentId?: string;
80
- queries?: MicroCMSQueries;
81
- customRequestInit?: CustomRequestInit;
82
- }
83
- export interface GetListDetailRequest {
84
- endpoint: string;
85
- contentId: string;
86
- queries?: MicroCMSQueries;
87
- customRequestInit?: CustomRequestInit;
88
- }
89
- export interface GetListRequest {
90
- endpoint: string;
91
- queries?: MicroCMSQueries;
92
- customRequestInit?: CustomRequestInit;
93
- }
94
- export interface GetObjectRequest {
95
- endpoint: string;
96
- queries?: MicroCMSQueries;
97
- customRequestInit?: CustomRequestInit;
98
- }
99
- export interface WriteApiRequestResult {
100
- id: string;
101
- }
102
- export interface CreateRequest<T> {
103
- endpoint: string;
104
- contentId?: string;
105
- content: T;
106
- isDraft?: boolean;
107
- customRequestInit?: CustomRequestInit;
108
- }
109
- export interface UpdateRequest<T> {
110
- endpoint: string;
111
- contentId?: string;
112
- content: Partial<T>;
113
- customRequestInit?: CustomRequestInit;
114
- }
115
- export interface DeleteRequest {
116
- endpoint: string;
117
- contentId: string;
118
- customRequestInit?: CustomRequestInit;
119
- }
120
- export {};
@@ -1,4 +0,0 @@
1
- export declare const BASE_DOMAIN = "microcms.io";
2
- export declare const API_VERSION = "v1";
3
- export declare const MAX_RETRY_COUNT = 2;
4
- export declare const MIN_TIMEOUT_MS = 5000;
@@ -1,14 +0,0 @@
1
- /**
2
- * Check object
3
- *
4
- * @param {unknown} value
5
- * @returns {boolean}
6
- */
7
- export declare const isObject: (value: unknown) => value is Record<string, unknown>;
8
- /**
9
- * Check string
10
- *
11
- * @param {unknown} value
12
- * @returns {boolean}
13
- */
14
- export declare const isString: (value: unknown) => value is string;
@@ -1,2 +0,0 @@
1
- import { MicroCMSQueries } from '../types';
2
- export declare const parseQuery: (queries: MicroCMSQueries) => string;
@@ -1,13 +0,0 @@
1
- import { MicroCMSClient, GetRequest, GetListRequest, GetListDetailRequest, GetObjectRequest, WriteApiRequestResult, CreateRequest, MicroCMSListResponse, MicroCMSListContent, MicroCMSObjectContent, UpdateRequest, DeleteRequest } from './types';
2
- /**
3
- * Initialize SDK Client
4
- */
5
- export declare const createClient: ({ serviceDomain, apiKey, customFetch, retry: retryOption, }: MicroCMSClient) => {
6
- get: <T = any>({ endpoint, contentId, queries, customRequestInit, }: GetRequest) => Promise<T>;
7
- getList: <T_1 = any>({ endpoint, queries, customRequestInit, }: GetListRequest) => Promise<MicroCMSListResponse<T_1>>;
8
- getListDetail: <T_2 = any>({ endpoint, contentId, queries, customRequestInit, }: GetListDetailRequest) => Promise<T_2 & import("./types").MicroCMSContentId & import("./types").MicroCMSDate>;
9
- getObject: <T_3 = any>({ endpoint, queries, customRequestInit, }: GetObjectRequest) => Promise<T_3 & import("./types").MicroCMSDate>;
10
- create: <T_4 extends Record<string | number, any>>({ endpoint, contentId, content, isDraft, customRequestInit, }: CreateRequest<T_4>) => Promise<WriteApiRequestResult>;
11
- update: <T_5 extends Record<string | number, any>>({ endpoint, contentId, content, customRequestInit, }: UpdateRequest<T_5>) => Promise<WriteApiRequestResult>;
12
- delete: ({ endpoint, contentId, customRequestInit, }: DeleteRequest) => Promise<void>;
13
- };
@@ -1,2 +0,0 @@
1
- export { createClient } from './createClient';
2
- export * from './types';
@@ -1,7 +0,0 @@
1
- import { Fetch } from 'src/types';
2
- export declare const resolveFetch: (customFetch?: Fetch) => Fetch;
3
- export declare const resolveHeadersConstructor: () => {
4
- new (init?: HeadersInit | undefined): Headers;
5
- prototype: Headers;
6
- };
7
- export declare const generateFetchClient: (apiKey: string, customFetch?: Fetch) => Fetch;
@@ -1,120 +0,0 @@
1
- export declare type Fetch = typeof fetch;
2
- /**
3
- * microCMS createClient params
4
- */
5
- export interface MicroCMSClient {
6
- serviceDomain: string;
7
- apiKey: string;
8
- customFetch?: Fetch;
9
- retry?: boolean;
10
- }
11
- declare type depthNumber = 1 | 2 | 3;
12
- /**
13
- * microCMS queries
14
- * https://document.microcms.io/content-api/get-list-contents#h9ce528688c
15
- * https://document.microcms.io/content-api/get-content#h9ce528688c
16
- */
17
- export interface MicroCMSQueries {
18
- draftKey?: string;
19
- limit?: number;
20
- offset?: number;
21
- orders?: string;
22
- fields?: string | string[];
23
- q?: string;
24
- depth?: depthNumber;
25
- ids?: string | string[];
26
- filters?: string;
27
- richEditorFormat?: 'html' | 'object';
28
- }
29
- /**
30
- * microCMS contentId
31
- * https://document.microcms.io/manual/content-id-setting
32
- */
33
- export interface MicroCMSContentId {
34
- id: string;
35
- }
36
- /**
37
- * microCMS content common date
38
- */
39
- export interface MicroCMSDate {
40
- createdAt: string;
41
- updatedAt: string;
42
- publishedAt?: string;
43
- revisedAt?: string;
44
- }
45
- /**
46
- * microCMS image
47
- */
48
- export interface MicroCMSImage {
49
- url: string;
50
- width?: number;
51
- height?: number;
52
- }
53
- /**
54
- * microCMS list api Response
55
- */
56
- export interface MicroCMSListResponse<T> {
57
- contents: (T & MicroCMSListContent)[];
58
- totalCount: number;
59
- limit: number;
60
- offset: number;
61
- }
62
- /**
63
- * microCMS list content common types
64
- */
65
- export declare type MicroCMSListContent = MicroCMSContentId & MicroCMSDate;
66
- /**
67
- * microCMS object content common types
68
- */
69
- export declare type MicroCMSObjectContent = MicroCMSDate;
70
- export interface MakeRequest {
71
- endpoint: string;
72
- contentId?: string;
73
- queries?: MicroCMSQueries & Record<string, any>;
74
- requestInit?: RequestInit;
75
- }
76
- export declare type CustomRequestInit = Omit<RequestInit, 'method' | 'headers' | 'body'>;
77
- export interface GetRequest {
78
- endpoint: string;
79
- contentId?: string;
80
- queries?: MicroCMSQueries;
81
- customRequestInit?: CustomRequestInit;
82
- }
83
- export interface GetListDetailRequest {
84
- endpoint: string;
85
- contentId: string;
86
- queries?: MicroCMSQueries;
87
- customRequestInit?: CustomRequestInit;
88
- }
89
- export interface GetListRequest {
90
- endpoint: string;
91
- queries?: MicroCMSQueries;
92
- customRequestInit?: CustomRequestInit;
93
- }
94
- export interface GetObjectRequest {
95
- endpoint: string;
96
- queries?: MicroCMSQueries;
97
- customRequestInit?: CustomRequestInit;
98
- }
99
- export interface WriteApiRequestResult {
100
- id: string;
101
- }
102
- export interface CreateRequest<T> {
103
- endpoint: string;
104
- contentId?: string;
105
- content: T;
106
- isDraft?: boolean;
107
- customRequestInit?: CustomRequestInit;
108
- }
109
- export interface UpdateRequest<T> {
110
- endpoint: string;
111
- contentId?: string;
112
- content: Partial<T>;
113
- customRequestInit?: CustomRequestInit;
114
- }
115
- export interface DeleteRequest {
116
- endpoint: string;
117
- contentId: string;
118
- customRequestInit?: CustomRequestInit;
119
- }
120
- export {};
@@ -1,4 +0,0 @@
1
- export declare const BASE_DOMAIN = "microcms.io";
2
- export declare const API_VERSION = "v1";
3
- export declare const MAX_RETRY_COUNT = 2;
4
- export declare const MIN_TIMEOUT_MS = 5000;
@@ -1,14 +0,0 @@
1
- /**
2
- * Check object
3
- *
4
- * @param {unknown} value
5
- * @returns {boolean}
6
- */
7
- export declare const isObject: (value: unknown) => value is Record<string, unknown>;
8
- /**
9
- * Check string
10
- *
11
- * @param {unknown} value
12
- * @returns {boolean}
13
- */
14
- export declare const isString: (value: unknown) => value is string;
@@ -1,2 +0,0 @@
1
- import { MicroCMSQueries } from '../types';
2
- export declare const parseQuery: (queries: MicroCMSQueries) => string;