admin-lib-cms 1.2.15 → 1.2.17
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/index.js +383 -314
- package/dist/index.mjs +383 -314
- package/dist/storage.js +10 -2
- package/dist/storage.mjs +10 -2
- package/dist/types.d.mts +13 -0
- package/dist/types.d.ts +13 -0
- package/package.json +1 -1
package/dist/storage.js
CHANGED
|
@@ -174,7 +174,15 @@ function createWriteClient(config) {
|
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
176
|
async function apiRequest(apiBase, path, init) {
|
|
177
|
-
const res = await fetch(`${apiBase}${path}`,
|
|
177
|
+
const res = await fetch(`${apiBase}${path}`, {
|
|
178
|
+
cache: "no-store",
|
|
179
|
+
...init,
|
|
180
|
+
headers: {
|
|
181
|
+
"Cache-Control": "no-cache",
|
|
182
|
+
Pragma: "no-cache",
|
|
183
|
+
...init?.headers
|
|
184
|
+
}
|
|
185
|
+
});
|
|
178
186
|
if (!res.ok) {
|
|
179
187
|
const text = await res.text();
|
|
180
188
|
throw new Error(text || `API error ${res.status}`);
|
|
@@ -268,7 +276,7 @@ function createSanityAdapter(config) {
|
|
|
268
276
|
if (canUseApi()) {
|
|
269
277
|
return await apiRequest(
|
|
270
278
|
apiBase,
|
|
271
|
-
`/entries?collectionId=${encodeURIComponent(collectionId)}`
|
|
279
|
+
`/entries?collectionId=${encodeURIComponent(collectionId)}&_t=${Date.now()}`
|
|
272
280
|
);
|
|
273
281
|
}
|
|
274
282
|
const query = `*[_type == "cms_entry" && collectionId == $collectionId]`;
|
package/dist/storage.mjs
CHANGED
|
@@ -146,7 +146,15 @@ function createWriteClient(config) {
|
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
async function apiRequest(apiBase, path, init) {
|
|
149
|
-
const res = await fetch(`${apiBase}${path}`,
|
|
149
|
+
const res = await fetch(`${apiBase}${path}`, {
|
|
150
|
+
cache: "no-store",
|
|
151
|
+
...init,
|
|
152
|
+
headers: {
|
|
153
|
+
"Cache-Control": "no-cache",
|
|
154
|
+
Pragma: "no-cache",
|
|
155
|
+
...init?.headers
|
|
156
|
+
}
|
|
157
|
+
});
|
|
150
158
|
if (!res.ok) {
|
|
151
159
|
const text = await res.text();
|
|
152
160
|
throw new Error(text || `API error ${res.status}`);
|
|
@@ -240,7 +248,7 @@ function createSanityAdapter(config) {
|
|
|
240
248
|
if (canUseApi()) {
|
|
241
249
|
return await apiRequest(
|
|
242
250
|
apiBase,
|
|
243
|
-
`/entries?collectionId=${encodeURIComponent(collectionId)}`
|
|
251
|
+
`/entries?collectionId=${encodeURIComponent(collectionId)}&_t=${Date.now()}`
|
|
244
252
|
);
|
|
245
253
|
}
|
|
246
254
|
const query = `*[_type == "cms_entry" && collectionId == $collectionId]`;
|
package/dist/types.d.mts
CHANGED
|
@@ -61,13 +61,19 @@ interface CollectionField {
|
|
|
61
61
|
})[]>;
|
|
62
62
|
colSpan?: 1 | 2 | 6 | 12;
|
|
63
63
|
readOnly?: boolean;
|
|
64
|
+
required?: boolean;
|
|
64
65
|
unique?: boolean;
|
|
65
66
|
customRender?: (props: {
|
|
66
67
|
value: any;
|
|
67
68
|
record: any;
|
|
68
69
|
onChange?: (val: any) => void;
|
|
69
70
|
isCreatingEntry?: boolean;
|
|
71
|
+
isViewingDetail?: boolean;
|
|
72
|
+
readOnly?: boolean;
|
|
70
73
|
}) => React.ReactNode;
|
|
74
|
+
onCellClick?: (value: any, record: any) => void;
|
|
75
|
+
renderCell?: (value: any, record: any) => React.ReactNode;
|
|
76
|
+
onSelectRecord?: (record: any, currentValues: any) => Record<string, any>;
|
|
71
77
|
}
|
|
72
78
|
interface CollectionDef {
|
|
73
79
|
id: string;
|
|
@@ -83,10 +89,17 @@ interface CollectionDef {
|
|
|
83
89
|
saveLabel?: string;
|
|
84
90
|
isSeparator?: boolean;
|
|
85
91
|
enableDetailView?: boolean;
|
|
92
|
+
enableQuickCreate?: boolean;
|
|
93
|
+
onViewRecord?: (record: any) => void;
|
|
94
|
+
viewRecordTitle?: string;
|
|
86
95
|
disableEdit?: boolean;
|
|
87
96
|
disableDelete?: boolean;
|
|
88
97
|
onDownloadPdf?: (record: any) => void;
|
|
89
98
|
canDownloadPdf?: (record: any) => boolean;
|
|
99
|
+
defaultSort?: {
|
|
100
|
+
field: string;
|
|
101
|
+
direction: "asc" | "desc";
|
|
102
|
+
} | ((a: any, b: any) => number);
|
|
90
103
|
customRowActions?: (props: {
|
|
91
104
|
record: any;
|
|
92
105
|
openDetail: () => void;
|
package/dist/types.d.ts
CHANGED
|
@@ -61,13 +61,19 @@ interface CollectionField {
|
|
|
61
61
|
})[]>;
|
|
62
62
|
colSpan?: 1 | 2 | 6 | 12;
|
|
63
63
|
readOnly?: boolean;
|
|
64
|
+
required?: boolean;
|
|
64
65
|
unique?: boolean;
|
|
65
66
|
customRender?: (props: {
|
|
66
67
|
value: any;
|
|
67
68
|
record: any;
|
|
68
69
|
onChange?: (val: any) => void;
|
|
69
70
|
isCreatingEntry?: boolean;
|
|
71
|
+
isViewingDetail?: boolean;
|
|
72
|
+
readOnly?: boolean;
|
|
70
73
|
}) => React.ReactNode;
|
|
74
|
+
onCellClick?: (value: any, record: any) => void;
|
|
75
|
+
renderCell?: (value: any, record: any) => React.ReactNode;
|
|
76
|
+
onSelectRecord?: (record: any, currentValues: any) => Record<string, any>;
|
|
71
77
|
}
|
|
72
78
|
interface CollectionDef {
|
|
73
79
|
id: string;
|
|
@@ -83,10 +89,17 @@ interface CollectionDef {
|
|
|
83
89
|
saveLabel?: string;
|
|
84
90
|
isSeparator?: boolean;
|
|
85
91
|
enableDetailView?: boolean;
|
|
92
|
+
enableQuickCreate?: boolean;
|
|
93
|
+
onViewRecord?: (record: any) => void;
|
|
94
|
+
viewRecordTitle?: string;
|
|
86
95
|
disableEdit?: boolean;
|
|
87
96
|
disableDelete?: boolean;
|
|
88
97
|
onDownloadPdf?: (record: any) => void;
|
|
89
98
|
canDownloadPdf?: (record: any) => boolean;
|
|
99
|
+
defaultSort?: {
|
|
100
|
+
field: string;
|
|
101
|
+
direction: "asc" | "desc";
|
|
102
|
+
} | ((a: any, b: any) => number);
|
|
90
103
|
customRowActions?: (props: {
|
|
91
104
|
record: any;
|
|
92
105
|
openDetail: () => void;
|