@btst/stack 5.0.0 → 5.1.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/dist/api/index.d.cts +2 -2
- package/dist/api/index.d.mts +2 -2
- package/dist/api/index.d.ts +2 -2
- package/dist/client/index.d.cts +2 -2
- package/dist/client/index.d.mts +2 -2
- package/dist/client/index.d.ts +2 -2
- package/dist/context/index.d.cts +1 -1
- package/dist/context/index.d.mts +1 -1
- package/dist/context/index.d.ts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/packages/stack/src/plugins/cms/api/getters.cjs +142 -6
- package/dist/packages/stack/src/plugins/cms/api/getters.mjs +139 -8
- package/dist/packages/stack/src/plugins/cms/api/operations.cjs +67 -61
- package/dist/packages/stack/src/plugins/cms/api/operations.mjs +69 -63
- package/dist/packages/stack/src/plugins/cms/api/plugin.cjs +26 -8
- package/dist/packages/stack/src/plugins/cms/api/plugin.mjs +27 -9
- package/dist/packages/stack/src/plugins/cms/api/query-key-defs.cjs +15 -1
- package/dist/packages/stack/src/plugins/cms/api/query-key-defs.mjs +14 -2
- package/dist/packages/stack/src/plugins/cms/client/hooks/cms-hooks.cjs +45 -24
- package/dist/packages/stack/src/plugins/cms/client/hooks/cms-hooks.mjs +45 -24
- package/dist/packages/stack/src/plugins/cms/schemas.cjs +22 -0
- package/dist/packages/stack/src/plugins/cms/schemas.mjs +20 -1
- package/dist/plugins/api/index.d.cts +2 -2
- package/dist/plugins/api/index.d.mts +2 -2
- package/dist/plugins/api/index.d.ts +2 -2
- package/dist/plugins/blog/api/index.d.cts +2 -2
- package/dist/plugins/blog/api/index.d.mts +2 -2
- package/dist/plugins/blog/api/index.d.ts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
- package/dist/plugins/blog/client/index.d.cts +2 -2
- package/dist/plugins/blog/client/index.d.mts +2 -2
- package/dist/plugins/blog/client/index.d.ts +2 -2
- package/dist/plugins/blog/query-keys.d.cts +2 -2
- package/dist/plugins/blog/query-keys.d.mts +2 -2
- package/dist/plugins/blog/query-keys.d.ts +2 -2
- package/dist/plugins/client/index.d.cts +2 -2
- package/dist/plugins/client/index.d.mts +2 -2
- package/dist/plugins/client/index.d.ts +2 -2
- package/dist/plugins/cms/api/index.cjs +1 -0
- package/dist/plugins/cms/api/index.d.cts +43 -11
- package/dist/plugins/cms/api/index.d.mts +43 -11
- package/dist/plugins/cms/api/index.d.ts +43 -11
- package/dist/plugins/cms/api/index.mjs +1 -1
- package/dist/plugins/cms/client/hooks/index.d.cts +90 -45
- package/dist/plugins/cms/client/hooks/index.d.mts +90 -45
- package/dist/plugins/cms/client/hooks/index.d.ts +90 -45
- package/dist/plugins/cms/client/index.d.cts +2 -1
- package/dist/plugins/cms/client/index.d.mts +2 -1
- package/dist/plugins/cms/client/index.d.ts +2 -1
- package/dist/plugins/cms/query-keys.cjs +69 -13
- package/dist/plugins/cms/query-keys.d.cts +89 -212
- package/dist/plugins/cms/query-keys.d.mts +89 -212
- package/dist/plugins/cms/query-keys.d.ts +89 -212
- package/dist/plugins/cms/query-keys.mjs +70 -14
- package/dist/plugins/kanban/client/index.d.cts +1 -1
- package/dist/plugins/kanban/client/index.d.mts +1 -1
- package/dist/plugins/kanban/client/index.d.ts +1 -1
- package/dist/plugins/route-docs/client/index.d.cts +1 -1
- package/dist/plugins/route-docs/client/index.d.mts +1 -1
- package/dist/plugins/route-docs/client/index.d.ts +1 -1
- package/dist/plugins/ui-builder/client/hooks/index.d.cts +3 -3
- package/dist/plugins/ui-builder/client/hooks/index.d.mts +3 -3
- package/dist/plugins/ui-builder/client/hooks/index.d.ts +3 -3
- package/dist/plugins/ui-builder/client/index.d.cts +3 -3
- package/dist/plugins/ui-builder/client/index.d.mts +3 -3
- package/dist/plugins/ui-builder/client/index.d.ts +3 -3
- package/dist/plugins/ui-builder/query-keys.d.cts +4 -3
- package/dist/plugins/ui-builder/query-keys.d.mts +4 -3
- package/dist/plugins/ui-builder/query-keys.d.ts +4 -3
- package/dist/shared/{stack.DMj68qY0.d.mts → stack.B2jlVVhD.d.mts} +5 -5
- package/dist/shared/{stack.Cvnj99cs.d.ts → stack.BB9tubJJ.d.ts} +9 -3
- package/dist/shared/{stack.Bt3WG2yb.d.cts → stack.BWduIMKG.d.cts} +35 -35
- package/dist/shared/stack.Bw09Lg2z.d.ts +1420 -0
- package/dist/shared/{stack.CkEz7vSt.d.mts → stack.C2Pvl-RS.d.mts} +9 -3
- package/dist/shared/{stack.C2l2wd_X.d.ts → stack.Ch9-ppmQ.d.ts} +35 -35
- package/dist/shared/{stack.Ht8mhDj5.d.cts → stack.D17yFglU.d.cts} +5 -5
- package/dist/shared/{stack.CiD115Ov.d.mts → stack.D6fPBfYe.d.mts} +35 -35
- package/dist/shared/stack.DFGj0gb7.d.mts +1420 -0
- package/dist/shared/{stack.pi0FxoEa.d.ts → stack.Dcfg4GNN.d.ts} +5 -5
- package/dist/shared/{stack.3rxARhgS.d.cts → stack.DrB3L7Ih.d.cts} +52 -3
- package/dist/shared/{stack.3rxARhgS.d.mts → stack.DrB3L7Ih.d.mts} +52 -3
- package/dist/shared/{stack.3rxARhgS.d.ts → stack.DrB3L7Ih.d.ts} +52 -3
- package/dist/shared/stack.NNrBKBkM.d.cts +1420 -0
- package/dist/shared/{stack.mRRyZBUg.d.cts → stack.Rb87lHqK.d.cts} +9 -3
- package/package.json +1 -1
- package/src/__tests__/cms-query-keys.test.ts +57 -0
- package/src/plugins/api/index.ts +1 -0
- package/src/plugins/api/operation.ts +16 -3
- package/src/plugins/cms/__tests__/authorization.test.ts +652 -187
- package/src/plugins/cms/__tests__/client-runtime.browser.test.tsx +655 -0
- package/src/plugins/cms/__tests__/content-read.typecheck.ts +351 -0
- package/src/plugins/cms/__tests__/getters.test.ts +286 -0
- package/src/plugins/cms/api/getters.ts +270 -12
- package/src/plugins/cms/api/index.ts +10 -0
- package/src/plugins/cms/api/operations.ts +163 -75
- package/src/plugins/cms/api/plugin.ts +50 -12
- package/src/plugins/cms/api/query-key-defs.ts +29 -2
- package/src/plugins/cms/client/hooks/cms-hooks.tsx +400 -91
- package/src/plugins/cms/client/index.ts +9 -0
- package/src/plugins/cms/query-keys.ts +171 -16
- package/src/plugins/cms/schemas.ts +30 -0
- package/src/plugins/cms/types.ts +49 -2
- package/src/plugins/media/__tests__/identity-partition.test.tsx +26 -16
- package/dist/shared/stack.CAmVUwjV.d.cts +0 -764
- package/dist/shared/stack.CQK02ujt.d.ts +0 -764
- package/dist/shared/stack.D9x1fR5a.d.mts +0 -764
- package/dist/shared/{stack.CKc_Bais.d.cts → stack.Csi-4Mgz.d.cts} +7 -7
- package/dist/shared/{stack.CKc_Bais.d.mts → stack.Csi-4Mgz.d.mts} +7 -7
- package/dist/shared/{stack.CKc_Bais.d.ts → stack.Csi-4Mgz.d.ts} +7 -7
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createApiClient } from '@btst/stack/plugins/client';
|
|
3
|
-
import { a as ContentListDiscriminator } from '../../shared/stack.D9x1fR5a.mjs';
|
|
1
|
+
import { a as ContentListDiscriminator } from '../../shared/stack.DFGj0gb7.mjs';
|
|
4
2
|
import { CMSApiRouter } from './api/index.mjs';
|
|
5
|
-
import {
|
|
6
|
-
import '
|
|
3
|
+
import { createApiClient, createResourceQueryKeys } from '@btst/stack/plugins/client';
|
|
4
|
+
import { S as SerializedContentType, I as InverseRelation, b as SerializedContentItemWithType } from '../../shared/stack.DrB3L7Ih.mjs';
|
|
5
|
+
import { CMSReadOptions, CMSReadView, PaginatedContentItems, CMSContentFields, CMSContentItemResult } from './api/index.mjs';
|
|
7
6
|
import '../../authorization/index.mjs';
|
|
8
7
|
import 'zod';
|
|
8
|
+
import '@btst/stack/plugins/api';
|
|
9
9
|
import 'better-call';
|
|
10
10
|
import '@tanstack/react-query';
|
|
11
11
|
|
|
12
12
|
/** Params for the paginated content list (one page per `limit`). */
|
|
13
|
-
interface ContentListParams {
|
|
13
|
+
interface ContentListParams extends CMSReadOptions {
|
|
14
14
|
typeSlug: string;
|
|
15
15
|
limit?: number;
|
|
16
16
|
/**
|
|
@@ -22,12 +22,12 @@ interface ContentListParams {
|
|
|
22
22
|
/** Free-text search across item slugs and data values */
|
|
23
23
|
search?: string;
|
|
24
24
|
}
|
|
25
|
-
interface ContentOptionsParams {
|
|
25
|
+
interface ContentOptionsParams extends CMSReadOptions {
|
|
26
26
|
typeSlug: string;
|
|
27
27
|
search?: string;
|
|
28
28
|
limit?: number;
|
|
29
29
|
}
|
|
30
|
-
interface ContentByRelationParams {
|
|
30
|
+
interface ContentByRelationParams extends CMSReadOptions {
|
|
31
31
|
typeSlug: string;
|
|
32
32
|
field: string;
|
|
33
33
|
targetId: string;
|
|
@@ -37,11 +37,13 @@ interface InverseRelationsParams {
|
|
|
37
37
|
slug: string;
|
|
38
38
|
itemId: string;
|
|
39
39
|
}
|
|
40
|
-
interface InverseRelationItemsParams {
|
|
40
|
+
interface InverseRelationItemsParams extends CMSReadOptions {
|
|
41
41
|
slug: string;
|
|
42
42
|
sourceType: string;
|
|
43
43
|
itemId: string;
|
|
44
44
|
fieldName: string;
|
|
45
|
+
limit?: number;
|
|
46
|
+
offset?: number;
|
|
45
47
|
}
|
|
46
48
|
/**
|
|
47
49
|
* CMS resource declaration — the single source of truth for query keys,
|
|
@@ -92,8 +94,17 @@ declare const cmsResources: {
|
|
|
92
94
|
query: (p: InverseRelationItemsParams) => {
|
|
93
95
|
itemId: string;
|
|
94
96
|
fieldName: string;
|
|
97
|
+
limit: number;
|
|
98
|
+
offset: number;
|
|
99
|
+
view: CMSReadView;
|
|
100
|
+
fields: string | undefined;
|
|
95
101
|
};
|
|
96
|
-
key: (p: InverseRelationItemsParams) => string
|
|
102
|
+
key: (p: InverseRelationItemsParams) => (string | {
|
|
103
|
+
fields?: string[] | undefined;
|
|
104
|
+
view?: "content" | undefined;
|
|
105
|
+
limit: number;
|
|
106
|
+
offset: number;
|
|
107
|
+
})[];
|
|
97
108
|
select: (data: any) => {
|
|
98
109
|
items: SerializedContentItemWithType[];
|
|
99
110
|
total: number;
|
|
@@ -111,6 +122,8 @@ declare const cmsResources: {
|
|
|
111
122
|
query: (p: ContentListParams) => {
|
|
112
123
|
limit: number;
|
|
113
124
|
search: string | undefined;
|
|
125
|
+
view: CMSReadView;
|
|
126
|
+
fields: string | undefined;
|
|
114
127
|
};
|
|
115
128
|
key: (p: ContentListParams) => ContentListDiscriminator[];
|
|
116
129
|
select: (data: any, _p: ContentListParams) => PaginatedContentItems;
|
|
@@ -120,24 +133,36 @@ declare const cmsResources: {
|
|
|
120
133
|
};
|
|
121
134
|
detail: {
|
|
122
135
|
path: string;
|
|
123
|
-
params: (typeSlug: string, id: string) => {
|
|
136
|
+
params: (typeSlug: string, id: string, _options?: CMSReadOptions) => {
|
|
124
137
|
typeSlug: string;
|
|
125
138
|
id: string;
|
|
126
139
|
};
|
|
127
|
-
|
|
128
|
-
|
|
140
|
+
query: (_typeSlug: string, _id: string, options?: CMSReadOptions) => {
|
|
141
|
+
view: CMSReadView;
|
|
142
|
+
fields: string | undefined;
|
|
143
|
+
};
|
|
144
|
+
key: (typeSlug: string, id: string, options?: CMSReadOptions) => (string | {
|
|
145
|
+
fields?: string[] | undefined;
|
|
146
|
+
view?: "content" | undefined;
|
|
147
|
+
})[];
|
|
148
|
+
select: (data: any, _typeSlug: string, _id: string, _options?: CMSReadOptions) => SerializedContentItemWithType | null;
|
|
129
149
|
skip: (typeSlug: string, id: string) => boolean;
|
|
130
150
|
};
|
|
131
151
|
bySlug: {
|
|
132
152
|
path: string;
|
|
133
|
-
params: (typeSlug: string, _slug: string) => {
|
|
153
|
+
params: (typeSlug: string, _slug: string, _options?: CMSReadOptions) => {
|
|
134
154
|
typeSlug: string;
|
|
135
155
|
};
|
|
136
|
-
query: (_typeSlug: string, slug: string) => {
|
|
156
|
+
query: (_typeSlug: string, slug: string, options?: CMSReadOptions) => {
|
|
157
|
+
view: CMSReadView;
|
|
158
|
+
fields: string | undefined;
|
|
137
159
|
slug: string;
|
|
138
160
|
limit: number;
|
|
139
161
|
};
|
|
140
|
-
key: (typeSlug: string, slug: string) => string
|
|
162
|
+
key: (typeSlug: string, slug: string, options?: CMSReadOptions) => (string | {
|
|
163
|
+
fields?: string[] | undefined;
|
|
164
|
+
view?: "content" | undefined;
|
|
165
|
+
})[];
|
|
141
166
|
select: (data: any) => SerializedContentItemWithType | null;
|
|
142
167
|
skip: (typeSlug: string, slug: string) => boolean;
|
|
143
168
|
};
|
|
@@ -160,8 +185,15 @@ declare const cmsResources: {
|
|
|
160
185
|
field: string;
|
|
161
186
|
targetId: string;
|
|
162
187
|
limit: number;
|
|
188
|
+
view: CMSReadView;
|
|
189
|
+
fields: string | undefined;
|
|
163
190
|
};
|
|
164
|
-
key: (p: ContentByRelationParams) => string
|
|
191
|
+
key: (p: ContentByRelationParams) => (string | {
|
|
192
|
+
fields?: string[] | undefined;
|
|
193
|
+
view?: "content" | undefined;
|
|
194
|
+
limit: number;
|
|
195
|
+
offset: number;
|
|
196
|
+
})[];
|
|
165
197
|
select: (data: any, _p: ContentByRelationParams) => PaginatedContentItems;
|
|
166
198
|
infinite: true;
|
|
167
199
|
pageSize: (p: ContentByRelationParams) => number;
|
|
@@ -175,8 +207,13 @@ declare const cmsResources: {
|
|
|
175
207
|
query: (p: ContentOptionsParams) => {
|
|
176
208
|
search: string | undefined;
|
|
177
209
|
limit: number;
|
|
210
|
+
view: CMSReadView;
|
|
211
|
+
fields: string | undefined;
|
|
178
212
|
};
|
|
179
|
-
key: (p: ContentOptionsParams) => (string | number |
|
|
213
|
+
key: (p: ContentOptionsParams) => (string | number | {
|
|
214
|
+
fields?: string[] | undefined;
|
|
215
|
+
view?: "content" | undefined;
|
|
216
|
+
} | undefined)[];
|
|
180
217
|
select: (data: any, _p: ContentOptionsParams) => SerializedContentItemWithType[];
|
|
181
218
|
};
|
|
182
219
|
};
|
|
@@ -247,204 +284,44 @@ declare const cmsResources: {
|
|
|
247
284
|
};
|
|
248
285
|
};
|
|
249
286
|
};
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
};
|
|
269
|
-
key: (slug: string) => string[];
|
|
270
|
-
select: (data: any, _slug: string) => SerializedContentType | null;
|
|
271
|
-
skip: (slug: string) => boolean;
|
|
272
|
-
};
|
|
273
|
-
inverseRelations: {
|
|
274
|
-
path: string;
|
|
275
|
-
params: (p: InverseRelationsParams) => {
|
|
276
|
-
slug: string;
|
|
277
|
-
};
|
|
278
|
-
query: (p: InverseRelationsParams) => {
|
|
279
|
-
itemId: string;
|
|
280
|
-
};
|
|
281
|
-
key: (p: InverseRelationsParams) => string[];
|
|
282
|
-
select: (data: any) => InverseRelation[];
|
|
283
|
-
};
|
|
284
|
-
inverseRelationItems: {
|
|
285
|
-
path: string;
|
|
286
|
-
params: (p: InverseRelationItemsParams) => {
|
|
287
|
-
slug: string;
|
|
288
|
-
sourceType: string;
|
|
289
|
-
};
|
|
290
|
-
query: (p: InverseRelationItemsParams) => {
|
|
291
|
-
itemId: string;
|
|
292
|
-
fieldName: string;
|
|
293
|
-
};
|
|
294
|
-
key: (p: InverseRelationItemsParams) => string[];
|
|
295
|
-
select: (data: any) => {
|
|
296
|
-
items: SerializedContentItemWithType[];
|
|
297
|
-
total: number;
|
|
298
|
-
};
|
|
299
|
-
};
|
|
300
|
-
};
|
|
287
|
+
type CMSResourceQueryKeys = ReturnType<typeof createResourceQueryKeys<typeof cmsResources>>;
|
|
288
|
+
type ContentQueryResult<TData> = {
|
|
289
|
+
queryKey: readonly unknown[];
|
|
290
|
+
queryFn: (context?: {
|
|
291
|
+
pageParam?: unknown;
|
|
292
|
+
}) => Promise<TData>;
|
|
293
|
+
};
|
|
294
|
+
type CMSItemQueryEntry = {
|
|
295
|
+
<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(typeSlug: string, identity: string, options?: CMSReadOptions<TView, TFields>): ContentQueryResult<CMSContentItemResult<Record<string, unknown>, TView, TFields> | null>;
|
|
296
|
+
_def: readonly [string, string];
|
|
297
|
+
};
|
|
298
|
+
type CMSRelationQueryEntry<TParams> = {
|
|
299
|
+
<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(params: Omit<TParams, "view" | "fields"> & CMSReadOptions<TView, TFields>): ContentQueryResult<PaginatedContentItems<Record<string, unknown>, TView, TFields>>;
|
|
300
|
+
_def: readonly [string, string];
|
|
301
|
+
};
|
|
302
|
+
type CMSQueryKeys = Omit<CMSResourceQueryKeys, "cmsContent" | "cmsTypes"> & {
|
|
303
|
+
cmsTypes: Omit<CMSResourceQueryKeys["cmsTypes"], "inverseRelationItems"> & {
|
|
304
|
+
inverseRelationItems: CMSRelationQueryEntry<InverseRelationItemsParams>;
|
|
301
305
|
};
|
|
302
|
-
cmsContent: {
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
params: (p: ContentListParams) => {
|
|
307
|
-
typeSlug: string;
|
|
308
|
-
};
|
|
309
|
-
query: (p: ContentListParams) => {
|
|
310
|
-
limit: number;
|
|
311
|
-
search: string | undefined;
|
|
312
|
-
};
|
|
313
|
-
key: (p: ContentListParams) => ContentListDiscriminator[];
|
|
314
|
-
select: (data: any, _p: ContentListParams) => PaginatedContentItems;
|
|
315
|
-
infinite: true;
|
|
316
|
-
pageSize: (p: ContentListParams) => number;
|
|
317
|
-
nextPageParam: (lastPage: PaginatedContentItems, allPages: PaginatedContentItems[], p: ContentListParams) => number | undefined;
|
|
318
|
-
};
|
|
319
|
-
detail: {
|
|
320
|
-
path: string;
|
|
321
|
-
params: (typeSlug: string, id: string) => {
|
|
322
|
-
typeSlug: string;
|
|
323
|
-
id: string;
|
|
324
|
-
};
|
|
325
|
-
key: (typeSlug: string, id: string) => string[];
|
|
326
|
-
select: (data: any, _typeSlug: string, _id: string) => SerializedContentItemWithType | null;
|
|
327
|
-
skip: (typeSlug: string, id: string) => boolean;
|
|
328
|
-
};
|
|
329
|
-
bySlug: {
|
|
330
|
-
path: string;
|
|
331
|
-
params: (typeSlug: string, _slug: string) => {
|
|
332
|
-
typeSlug: string;
|
|
333
|
-
};
|
|
334
|
-
query: (_typeSlug: string, slug: string) => {
|
|
335
|
-
slug: string;
|
|
336
|
-
limit: number;
|
|
337
|
-
};
|
|
338
|
-
key: (typeSlug: string, slug: string) => string[];
|
|
339
|
-
select: (data: any) => SerializedContentItemWithType | null;
|
|
340
|
-
skip: (typeSlug: string, slug: string) => boolean;
|
|
341
|
-
};
|
|
342
|
-
populated: {
|
|
343
|
-
path: string;
|
|
344
|
-
params: (typeSlug: string, id: string) => {
|
|
345
|
-
typeSlug: string;
|
|
346
|
-
id: string;
|
|
347
|
-
};
|
|
348
|
-
key: (typeSlug: string, id: string) => string[];
|
|
349
|
-
select: (data: any) => SerializedContentItemWithType | null;
|
|
350
|
-
skip: (typeSlug: string, id: string) => boolean;
|
|
351
|
-
};
|
|
352
|
-
byRelation: {
|
|
353
|
-
path: string;
|
|
354
|
-
params: (p: ContentByRelationParams) => {
|
|
355
|
-
typeSlug: string;
|
|
356
|
-
};
|
|
357
|
-
query: (p: ContentByRelationParams) => {
|
|
358
|
-
field: string;
|
|
359
|
-
targetId: string;
|
|
360
|
-
limit: number;
|
|
361
|
-
};
|
|
362
|
-
key: (p: ContentByRelationParams) => string[];
|
|
363
|
-
select: (data: any, _p: ContentByRelationParams) => PaginatedContentItems;
|
|
364
|
-
infinite: true;
|
|
365
|
-
pageSize: (p: ContentByRelationParams) => number;
|
|
366
|
-
nextPageParam: (lastPage: PaginatedContentItems, allPages: PaginatedContentItems[], p: ContentByRelationParams) => number | undefined;
|
|
367
|
-
};
|
|
368
|
-
options: {
|
|
369
|
-
path: string;
|
|
370
|
-
params: (p: ContentOptionsParams) => {
|
|
371
|
-
typeSlug: string;
|
|
372
|
-
};
|
|
373
|
-
query: (p: ContentOptionsParams) => {
|
|
374
|
-
search: string | undefined;
|
|
375
|
-
limit: number;
|
|
376
|
-
};
|
|
377
|
-
key: (p: ContentOptionsParams) => (string | number | undefined)[];
|
|
378
|
-
select: (data: any, _p: ContentOptionsParams) => SerializedContentItemWithType[];
|
|
379
|
-
};
|
|
306
|
+
cmsContent: Omit<CMSResourceQueryKeys["cmsContent"], "list" | "detail" | "bySlug" | "byRelation" | "options"> & {
|
|
307
|
+
list: {
|
|
308
|
+
<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(params: Omit<ContentListParams, "view" | "fields"> & CMSReadOptions<TView, TFields>): ContentQueryResult<PaginatedContentItems<Record<string, unknown>, TView, TFields>>;
|
|
309
|
+
_def: readonly [string, string];
|
|
380
310
|
};
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
method: "POST";
|
|
385
|
-
input: (vars: {
|
|
386
|
-
typeSlug: string;
|
|
387
|
-
slug: string;
|
|
388
|
-
data: Record<string, unknown>;
|
|
389
|
-
}) => {
|
|
390
|
-
params: {
|
|
391
|
-
typeSlug: string;
|
|
392
|
-
};
|
|
393
|
-
body: {
|
|
394
|
-
slug: string;
|
|
395
|
-
data: Record<string, unknown>;
|
|
396
|
-
};
|
|
397
|
-
};
|
|
398
|
-
select: (data: any) => SerializedContentItemWithType | null;
|
|
399
|
-
invalidates: string[];
|
|
400
|
-
};
|
|
401
|
-
update: {
|
|
402
|
-
path: string;
|
|
403
|
-
method: "PUT";
|
|
404
|
-
input: (vars: {
|
|
405
|
-
typeSlug: string;
|
|
406
|
-
id: string;
|
|
407
|
-
data: {
|
|
408
|
-
slug?: string;
|
|
409
|
-
data?: Record<string, unknown>;
|
|
410
|
-
};
|
|
411
|
-
}) => {
|
|
412
|
-
params: {
|
|
413
|
-
typeSlug: string;
|
|
414
|
-
id: string;
|
|
415
|
-
};
|
|
416
|
-
body: {
|
|
417
|
-
slug?: string;
|
|
418
|
-
data?: Record<string, unknown>;
|
|
419
|
-
};
|
|
420
|
-
};
|
|
421
|
-
select: (data: any) => SerializedContentItemWithType | null;
|
|
422
|
-
invalidates: string[];
|
|
423
|
-
setData: {
|
|
424
|
-
query: string;
|
|
425
|
-
args: (updated: SerializedContentItemWithType | null) => string[] | null;
|
|
426
|
-
};
|
|
427
|
-
};
|
|
428
|
-
delete: {
|
|
429
|
-
path: string;
|
|
430
|
-
method: "DELETE";
|
|
431
|
-
input: (vars: {
|
|
432
|
-
typeSlug: string;
|
|
433
|
-
id: string;
|
|
434
|
-
}) => {
|
|
435
|
-
params: {
|
|
436
|
-
typeSlug: string;
|
|
437
|
-
id: string;
|
|
438
|
-
};
|
|
439
|
-
};
|
|
440
|
-
select: (data: any) => {
|
|
441
|
-
success: boolean;
|
|
442
|
-
};
|
|
443
|
-
invalidates: string[];
|
|
444
|
-
};
|
|
311
|
+
options: {
|
|
312
|
+
<TView extends CMSReadView = undefined, const TFields extends CMSContentFields = undefined>(params: Omit<ContentOptionsParams, "view" | "fields"> & CMSReadOptions<TView, TFields>): ContentQueryResult<CMSContentItemResult<Record<string, unknown>, TView, TFields>[]>;
|
|
313
|
+
_def: readonly [string, string];
|
|
445
314
|
};
|
|
315
|
+
detail: CMSItemQueryEntry;
|
|
316
|
+
bySlug: CMSItemQueryEntry;
|
|
317
|
+
byRelation: CMSRelationQueryEntry<ContentByRelationParams>;
|
|
446
318
|
};
|
|
447
|
-
}
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* Create CMS query keys for React Query
|
|
322
|
+
* Used by consumers and SSR loaders to fetch content types and content items
|
|
323
|
+
*/
|
|
324
|
+
declare function createCMSQueryKeys(client: ReturnType<typeof createApiClient<CMSApiRouter>>, headers?: HeadersInit): CMSQueryKeys;
|
|
448
325
|
|
|
449
326
|
export { cmsResources, createCMSQueryKeys };
|
|
450
327
|
export type { ContentListParams };
|