@nuasite/collections-admin 0.43.0-beta.2 → 0.43.0-beta.4
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/types/entry-create.d.ts +1 -1
- package/dist/types/entry-create.d.ts.map +1 -1
- package/dist/types/entry-editor.d.ts +1 -1
- package/dist/types/entry-editor.d.ts.map +1 -1
- package/dist/types/field-editor.d.ts +1 -1
- package/dist/types/field-editor.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/media-picker.d.ts +1 -1
- package/dist/types/media-picker.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/src/app.tsx +1 -1
- package/src/entry-create.tsx +1 -2
- package/src/entry-editor.tsx +9 -3
- package/src/field-editor.tsx +1 -2
- package/src/index.ts +4 -2
- package/src/media-picker.tsx +1 -1
- package/src/tsconfig.json +1 -0
- package/src/client.ts +0 -405
- package/src/form-model.ts +0 -182
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* native draft model as the editor.
|
|
8
8
|
*/
|
|
9
9
|
import type { CollectionDefinition } from '@nuasite/cms-types';
|
|
10
|
-
import { type CmsClient } from '
|
|
10
|
+
import { type CmsClient } from '@nuasite/cms-client';
|
|
11
11
|
export declare function EntryCreate({ client, definition, collection, onCreated, onCancel }: {
|
|
12
12
|
client: CmsClient;
|
|
13
13
|
definition: CollectionDefinition | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-create.d.ts","sourceRoot":"","sources":["../../src/entry-create.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAmB,MAAM,oBAAoB,CAAA;AAE/E,OAAO,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"entry-create.d.ts","sourceRoot":"","sources":["../../src/entry-create.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAmB,MAAM,oBAAoB,CAAA;AAE/E,OAAO,EAAE,KAAK,SAAS,EAAkE,MAAM,qBAAqB,CAAA;AAOpH,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE;IACpF,MAAM,EAAE,SAAS,CAAA;IACjB,UAAU,EAAE,oBAAoB,GAAG,SAAS,CAAA;IAC5C,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,QAAQ,EAAE,MAAM,IAAI,CAAA;CACpB,+BA0FA"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* + `serverHash`; "use ours" re-PATCHes with `baseHash = serverHash` (force-over).
|
|
19
19
|
*/
|
|
20
20
|
import type { CollectionDefinition } from '@nuasite/cms-types';
|
|
21
|
-
import type
|
|
21
|
+
import { type CmsClient } from '@nuasite/cms-client';
|
|
22
22
|
export declare function EntryEditor({ client, definition, collection, slug, onDeleted, onRenamed }: {
|
|
23
23
|
client: CmsClient;
|
|
24
24
|
definition: CollectionDefinition | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry-editor.d.ts","sourceRoot":"","sources":["../../src/entry-editor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAmB,MAAM,oBAAoB,CAAA;AAE/E,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"entry-editor.d.ts","sourceRoot":"","sources":["../../src/entry-editor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAmB,MAAM,oBAAoB,CAAA;AAE/E,OAAO,EAAE,KAAK,SAAS,EAAgH,MAAM,qBAAqB,CAAA;AA8GlK,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE;IAC3F,MAAM,EAAE,SAAS,CAAA;IACjB,UAAU,EAAE,oBAAoB,GAAG,SAAS,CAAA;IAC5C,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,IAAI,CAAA;IACrB,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACpC,+BA4MA"}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* widgets reach the sidecar through the injected `EditorContext`.
|
|
9
9
|
*/
|
|
10
10
|
import type { FieldDefinition } from '@nuasite/cms-types';
|
|
11
|
-
import type
|
|
11
|
+
import { type CmsClient } from '@nuasite/cms-client';
|
|
12
12
|
/** Cross-cutting services a widget may need (media uploads, reference lookups). */
|
|
13
13
|
export interface EditorContext {
|
|
14
14
|
client: CmsClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-editor.d.ts","sourceRoot":"","sources":["../../src/field-editor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAa,MAAM,oBAAoB,CAAA;AAEpE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"field-editor.d.ts","sourceRoot":"","sources":["../../src/field-editor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAa,MAAM,oBAAoB,CAAA;AAEpE,OAAO,EAAE,KAAK,SAAS,EAAsF,MAAM,qBAAqB,CAAA;AAGxI,mFAAmF;AACnF,MAAM,WAAW,aAAa;IAC7B,MAAM,EAAE,SAAS,CAAA;IACjB,4EAA4E;IAC5E,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;CACb;AAED,UAAU,gBAAgB;IACzB,KAAK,EAAE,eAAe,CAAA;IACtB,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;IAClC,GAAG,EAAE,aAAa,CAAA;CAClB;AAwQD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,gBAAgB,+BA2C5E"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7,6 +7,5 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { CollectionsAdminApp, type CollectionsAdminAppProps } from './app';
|
|
9
9
|
export { FIELD_TYPES, isFieldType } from '@nuasite/cms-types';
|
|
10
|
-
export { type CmsApiError, type CmsCapabilities, type CmsClient, CmsClientError, type CmsConflict, type CmsEntriesListResult, type CmsErrorCode, type CmsPageEntry, type CmsProjectModel, createClient, type CreateEntryInput, type GetEntriesOptions, isMediaUnavailable, type MediaContext, type UpdateEntryInput, type UpdateEntryResult, } from '
|
|
11
|
-
export type { EntryDraft } from './form-model';
|
|
10
|
+
export { type CmsApiError, type CmsCapabilities, type CmsClient, CmsClientError, type CmsConflict, type CmsEntriesListResult, type CmsErrorCode, type CmsPageEntry, type CmsProjectModel, createClient, type CreateEntryInput, type EntryDraft, type GetEntriesOptions, isMediaUnavailable, type MediaContext, type UpdateEntryInput, type UpdateEntryResult, } from '@nuasite/cms-client';
|
|
12
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,mBAAmB,EAAE,KAAK,wBAAwB,EAAE,MAAM,OAAO,CAAA;AAI1E,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,mBAAmB,EAAE,KAAK,wBAAwB,EAAE,MAAM,OAAO,CAAA;AAI1E,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAG7D,OAAO,EACN,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,SAAS,EACd,cAAc,EACd,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,YAAY,EACZ,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,GACtB,MAAM,qBAAqB,CAAA"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* `listMedia`; on `unsupported`/`501` it disables upload and shows a hint while
|
|
10
10
|
* keeping the manual URL field fully usable — the editor is never blocked on media.
|
|
11
11
|
*/
|
|
12
|
-
import { type CmsClient } from '
|
|
12
|
+
import { type CmsClient } from '@nuasite/cms-client';
|
|
13
13
|
interface MediaPickerProps {
|
|
14
14
|
client: CmsClient;
|
|
15
15
|
value: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-picker.d.ts","sourceRoot":"","sources":["../../src/media-picker.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,KAAK,SAAS,EAAsB,MAAM,
|
|
1
|
+
{"version":3,"file":"media-picker.d.ts","sourceRoot":"","sources":["../../src/media-picker.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,KAAK,SAAS,EAAsB,MAAM,qBAAqB,CAAA;AAExE,UAAU,gBAAgB;IACzB,MAAM,EAAE,SAAS,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B;AASD,wBAAgB,WAAW,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,gBAAgB,+BAiG1G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"fileNames":["../../../../node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/typescript/lib/lib.es2021.d.ts","../../../../node_modules/typescript/lib/lib.es2022.d.ts","../../../../node_modules/typescript/lib/lib.es2023.d.ts","../../../../node_modules/typescript/lib/lib.es2024.d.ts","../../../../node_modules/typescript/lib/lib.es2025.d.ts","../../../../node_modules/typescript/lib/lib.esnext.d.ts","../../../../node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../../../node_modules/typescript/lib/lib.es2023.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2023.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","../../../../node_modules/typescript/lib/lib.es2024.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2024.object.d.ts","../../../../node_modules/typescript/lib/lib.es2024.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2024.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2024.string.d.ts","../../../../node_modules/typescript/lib/lib.es2025.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2025.float16.d.ts","../../../../node_modules/typescript/lib/lib.es2025.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2025.iterator.d.ts","../../../../node_modules/typescript/lib/lib.es2025.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2025.regexp.d.ts","../../../../node_modules/typescript/lib/lib.esnext.array.d.ts","../../../../node_modules/typescript/lib/lib.esnext.collection.d.ts","../../../../node_modules/typescript/lib/lib.esnext.date.d.ts","../../../../node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../../../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../../../node_modules/typescript/lib/lib.esnext.error.d.ts","../../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../../node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.esnext.temporal.d.ts","../../../../node_modules/typescript/lib/lib.esnext.typedarrays.d.ts","../../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../../node_modules/@types/react/global.d.ts","../../../../node_modules/csstype/index.d.ts","../../../../node_modules/@types/react/index.d.ts","../../../../node_modules/@types/react/jsx-runtime.d.ts","../../../cms-types/dist/types/index.d.ts","../../src/client.ts","../../src/form-model.ts","../../src/media-picker.tsx","../../src/field-editor.tsx","../../src/entry-create.tsx","../../src/entry-editor.tsx","../../src/app.tsx","../../src/css.d.ts","../../src/index.ts"],"fileIdsList":[[90,91],[92],[92,93,94,95,99,100,102],[93,94],[92,93,94,95,96,98],[92,93,94,95,96,97],[93,94,95,96,101],[92,93,95]],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","impliedFormat":1},{"version":"1e9332c23e9a907175e0ffc6a49e236f97b48838cc8aec9ce7e4cec21e544b65","impliedFormat":1},{"version":"3753fbc1113dc511214802a2342280a8b284ab9094f6420e7aa171e868679f91","impliedFormat":1},{"version":"999ca32883495a866aa5737fe1babc764a469e4cde6ee6b136a4b9ae68853e4b","impliedFormat":1},{"version":"17f13ecb98cbc39243f2eee1f16d45cd8ec4706b03ee314f1915f1a8b42f6984","impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","affectsGlobalScope":true,"impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","affectsGlobalScope":true,"impliedFormat":1},{"version":"0bd714129fca875f7d4c477a1a392200b0bcd13fb2e80928cd334b63830ea047","affectsGlobalScope":true,"impliedFormat":1},{"version":"e2c9037ae6cd2c52d80ceef0b3c5ffdb488627d71529cf4f63776daf11161c9a","affectsGlobalScope":true,"impliedFormat":1},{"version":"135d5cf4d345f59f1a9caadfafcd858d3d9cc68290db616cc85797224448cccc","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc238c3f81c2984751932b6aab223cd5b830e0ac6cad76389e5e9d2ffc03287d","affectsGlobalScope":true,"impliedFormat":1},{"version":"4a07f9b76d361f572620927e5735b77d6d2101c23cdd94383eb5b706e7b36357","affectsGlobalScope":true,"impliedFormat":1},{"version":"7c4e8dc6ab834cc6baa0227e030606d29e3e8449a9f67cdf5605ea5493c4db29","affectsGlobalScope":true,"impliedFormat":1},{"version":"de7ba0fd02e06cd9a5bd4ab441ed0e122735786e67dde1e849cced1cd8b46b78","affectsGlobalScope":true,"impliedFormat":1},{"version":"6148e4e88d720a06855071c3db02069434142a8332cf9c182cda551adedf3156","affectsGlobalScope":true,"impliedFormat":1},{"version":"d63dba625b108316a40c95a4425f8d4294e0deeccfd6c7e59d819efa19e23409","affectsGlobalScope":true,"impliedFormat":1},{"version":"0568d6befee03dd435bed4fc25c4e46865b24bdcb8c563fdc21f580a2c301904","affectsGlobalScope":true,"impliedFormat":1},{"version":"30d62269b05b584741f19a5369852d5d34895aa2ac4fd948956f886d15f9cc0d","affectsGlobalScope":true,"impliedFormat":1},{"version":"f128dae7c44d8f35ee42e0a437000a57c9f06cc04f8b4fb42eebf44954d53dc8","affectsGlobalScope":true,"impliedFormat":1},{"version":"ffbe6d7b295306b2ba88030f65b74c107d8d99bdcf596ea99c62a02f606108b0","affectsGlobalScope":true,"impliedFormat":1},{"version":"996fb27b15277369c68a4ba46ed138b4e9e839a02fb4ec756f7997629242fd9f","affectsGlobalScope":true,"impliedFormat":1},{"version":"79b712591b270d4778c89706ca2cfc56ddb8c3f895840e477388f1710dc5eda9","affectsGlobalScope":true,"impliedFormat":1},{"version":"20884846cef428b992b9bd032e70a4ef88e349263f63aeddf04dda837a7dba26","affectsGlobalScope":true,"impliedFormat":1},{"version":"5fcab789c73a97cd43828ee3cc94a61264cf24d4c44472ce64ced0e0f148bdb2","affectsGlobalScope":true,"impliedFormat":1},{"version":"db59a81f070c1880ad645b2c0275022baa6a0c4f0acdc58d29d349c6efcf0903","affectsGlobalScope":true,"impliedFormat":1},{"version":"673294292640f5722b700e7d814e17aaf7d93f83a48a2c9b38f33cbc940ad8b0","affectsGlobalScope":true,"impliedFormat":1},{"version":"d786b48f934cbca483b3c6d0a798cb43bbb4ada283e76fb22c28e53ae05b9e69","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ecb8e347cb6b2a8927c09b86263663289418df375f5e68e11a0ae683776978f","affectsGlobalScope":true,"impliedFormat":1},{"version":"142efd4ce210576f777dc34df121777be89eda476942d6d6663b03dcb53be3ff","affectsGlobalScope":true,"impliedFormat":1},{"version":"379bc41580c2d774f82e828c70308f24a005b490c25ba34d679d84bcf05c3d9d","affectsGlobalScope":true,"impliedFormat":1},{"version":"ed484fb2aa8a1a23d0277056ec3336e0a0b52f9b8d6a961f338a642faf43235d","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ffedae1d1c2d53fdbca1c96d3c7dda544281f7d262f99b6880634f8fd8d9820","affectsGlobalScope":true,"impliedFormat":1},{"version":"83a730b125d477dd264df8ba479afab27a3dae7152b005c214ab94dc7ee44fd3","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","affectsGlobalScope":true,"impliedFormat":1},{"version":"7e29f41b158de217f94cb9676bf9cbd0cd9b5a46e1985141ed36e075c52bf6ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac51dd7d31333793807a6abaa5ae168512b6131bd41d9c5b98477fc3b7800f9f","impliedFormat":1},{"version":"2577e7e800bdece2956ca027cb5c17aa359abd968eb9355760110c853f4fb9da","impliedFormat":1},{"version":"b838d4c72740eb0afd284bf7575b74c624b105eff2e8c7b4aeead57e7ac320ff","impliedFormat":1},"c43c2a0107a2a099fe50bcc754e90b50aa6b265ce57e464a2489798b38e4dc53",{"version":"5d9827861b2f5c138f2a474a28362869e527b0f41701c6a1c0b0e6df268833dc","signature":"18be101c2011a0c364fc7e5ee231d6a9397808e9a095b4bb25c171adf4f23ff5"},{"version":"5df26b293a5a1aca81be7bab8da2f2e5bb11cfece195a469a20f1ac383f1a854","signature":"35ac5e9e25a23b55393daa079c3e7b85817598eed090c2b6b92d156fbde16c6b"},{"version":"4c29e99746a19ad8ba43fc98b147e35b0a7221a02be62e28fea58aaa7930fd5d","signature":"f3335d6a624bfccc5d9559058f37938d6d867240eabfcb13a954c63b94ee57d6"},{"version":"242204d506b77f15c5dd37ad6e591769dea26c7aedc610350bed480254fa7e16","signature":"cf1a65650cc0743fbbaac14df9d54e86c9d06345b9b2abfbde8bdc6bc5e7fbbb"},{"version":"a5890d90c83539a984535f6b7125db4086177c1eef8d26ad3e3498789b0f96bc","signature":"96d5602833a0b49a441c7b5f90f3b5ebe05d3982d66df3770faebbc2f63cbb60"},{"version":"71a4c5e97b6adb3f70daee8eab22666567edfe0bd45e040c0bbbdca03cca5950","signature":"38cdc57d10d91681ce41226a81f274020b7b1e29023cc42fed60bd0113ecea9a"},{"version":"f12f26e609aa359030bfc0676ede38114e23197cfe6a8f4f883905321d6091d5","signature":"af732cf34bfa338fff320258775aa469d8bc3e0f25b5c82e231046ae5dccabf7"},"35d32b2f157a4e27bfae13e57e73d458fb71335af717f590532c77e2b323d530",{"version":"fb80cd2197a848807343c4d4db0d6c4aa7dfb5bc78eaf73edf0fbf313e28f8f5","signature":"d1a6a20b9ba01e597090d73d614ea6e39dc0a5424261f6980280f189c05b36b1"}],"root":[[95,103]],"options":{"allowImportingTsExtensions":true,"allowJs":true,"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"jsx":4,"module":200,"noEmitOnError":true,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noPropertyAccessFromIndexSignature":false,"noUncheckedIndexedAccess":true,"noUnusedLocals":false,"noUnusedParameters":false,"outDir":"./","skipLibCheck":true,"strict":true,"target":99,"verbatimModuleSyntax":true},"referencedMap":[[92,1],[93,2],[101,3],[95,4],[99,5],[100,5],[98,6],[96,4],[103,7],[97,8]],"latestChangedDtsFile":"./index.d.ts","version":"6.0.2"}
|
|
1
|
+
{"fileNames":["../../../../node_modules/typescript/lib/lib.es5.d.ts","../../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../../node_modules/typescript/lib/lib.es2021.d.ts","../../../../node_modules/typescript/lib/lib.es2022.d.ts","../../../../node_modules/typescript/lib/lib.es2023.d.ts","../../../../node_modules/typescript/lib/lib.es2024.d.ts","../../../../node_modules/typescript/lib/lib.es2025.d.ts","../../../../node_modules/typescript/lib/lib.esnext.d.ts","../../../../node_modules/typescript/lib/lib.dom.d.ts","../../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2023.array.d.ts","../../../../node_modules/typescript/lib/lib.es2023.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2023.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts","../../../../node_modules/typescript/lib/lib.es2024.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2024.object.d.ts","../../../../node_modules/typescript/lib/lib.es2024.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2024.regexp.d.ts","../../../../node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.es2024.string.d.ts","../../../../node_modules/typescript/lib/lib.es2025.collection.d.ts","../../../../node_modules/typescript/lib/lib.es2025.float16.d.ts","../../../../node_modules/typescript/lib/lib.es2025.intl.d.ts","../../../../node_modules/typescript/lib/lib.es2025.iterator.d.ts","../../../../node_modules/typescript/lib/lib.es2025.promise.d.ts","../../../../node_modules/typescript/lib/lib.es2025.regexp.d.ts","../../../../node_modules/typescript/lib/lib.esnext.array.d.ts","../../../../node_modules/typescript/lib/lib.esnext.collection.d.ts","../../../../node_modules/typescript/lib/lib.esnext.date.d.ts","../../../../node_modules/typescript/lib/lib.esnext.decorators.d.ts","../../../../node_modules/typescript/lib/lib.esnext.disposable.d.ts","../../../../node_modules/typescript/lib/lib.esnext.error.d.ts","../../../../node_modules/typescript/lib/lib.esnext.intl.d.ts","../../../../node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts","../../../../node_modules/typescript/lib/lib.esnext.temporal.d.ts","../../../../node_modules/typescript/lib/lib.esnext.typedarrays.d.ts","../../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../../node_modules/@types/react/global.d.ts","../../../../node_modules/csstype/index.d.ts","../../../../node_modules/@types/react/index.d.ts","../../../../node_modules/@types/react/jsx-runtime.d.ts","../../../cms-types/dist/types/index.d.ts","../../../cms-client/dist/types/client.d.ts","../../../cms-client/dist/types/form-model.d.ts","../../../cms-client/dist/types/index.d.ts","../../src/media-picker.tsx","../../src/field-editor.tsx","../../src/entry-create.tsx","../../src/entry-editor.tsx","../../src/app.tsx","../../src/css.d.ts","../../src/index.ts"],"fileIdsList":[[90,91],[92],[94],[94,95,96],[92,93,94,97,100,101,103],[92,93,94,97,99],[92,93,94,97,98],[93,94,97,102],[92,93,97]],"fileInfos":[{"version":"bcd24271a113971ba9eb71ff8cb01bc6b0f872a85c23fdbe5d93065b375933cd","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f88bedbeb09c6f5a6645cb24c7c55f1aa22d19ae96c8e6959cbd8b85a707bc6","impliedFormat":1},{"version":"7fe93b39b810eadd916be8db880dd7f0f7012a5cc6ffb62de8f62a2117fa6f1f","impliedFormat":1},{"version":"bb0074cc08b84a2374af33d8bf044b80851ccc9e719a5e202eacf40db2c31600","impliedFormat":1},{"version":"1a7daebe4f45fb03d9ec53d60008fbf9ac45a697fdc89e4ce218bc94b94f94d6","impliedFormat":1},{"version":"f94b133a3cb14a288803be545ac2683e0d0ff6661bcd37e31aaaec54fc382aed","impliedFormat":1},{"version":"f59d0650799f8782fd74cf73c19223730c6d1b9198671b1c5b3a38e1188b5953","impliedFormat":1},{"version":"8a15b4607d9a499e2dbeed9ec0d3c0d7372c850b2d5f1fb259e8f6d41d468a84","impliedFormat":1},{"version":"26e0fe14baee4e127f4365d1ae0b276f400562e45e19e35fd2d4c296684715e6","impliedFormat":1},{"version":"1e9332c23e9a907175e0ffc6a49e236f97b48838cc8aec9ce7e4cec21e544b65","impliedFormat":1},{"version":"3753fbc1113dc511214802a2342280a8b284ab9094f6420e7aa171e868679f91","impliedFormat":1},{"version":"999ca32883495a866aa5737fe1babc764a469e4cde6ee6b136a4b9ae68853e4b","impliedFormat":1},{"version":"17f13ecb98cbc39243f2eee1f16d45cd8ec4706b03ee314f1915f1a8b42f6984","impliedFormat":1},{"version":"d6b1eba8496bdd0eed6fc8a685768fe01b2da4a0388b5fe7df558290bffcf32f","affectsGlobalScope":true,"impliedFormat":1},{"version":"7f57fc4404ff020bc45b9c620aff2b40f700b95fe31164024c453a5e3c163c54","impliedFormat":1},{"version":"eadcffda2aa84802c73938e589b9e58248d74c59cb7fcbca6474e3435ac15504","affectsGlobalScope":true,"impliedFormat":1},{"version":"105ba8ff7ba746404fe1a2e189d1d3d2e0eb29a08c18dded791af02f29fb4711","affectsGlobalScope":true,"impliedFormat":1},{"version":"00343ca5b2e3d48fa5df1db6e32ea2a59afab09590274a6cccb1dbae82e60c7c","affectsGlobalScope":true,"impliedFormat":1},{"version":"ebd9f816d4002697cb2864bea1f0b70a103124e18a8cd9645eeccc09bdf80ab4","affectsGlobalScope":true,"impliedFormat":1},{"version":"2c1afac30a01772cd2a9a298a7ce7706b5892e447bb46bdbeef720f7b5da77ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"7b0225f483e4fa685625ebe43dd584bb7973bbd84e66a6ba7bbe175ee1048b4f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c0a4b8ac6ce74679c1da2b3795296f5896e31c38e888469a8e0f99dc3305de60","affectsGlobalScope":true,"impliedFormat":1},{"version":"3084a7b5f569088e0146533a00830e206565de65cae2239509168b11434cd84f","affectsGlobalScope":true,"impliedFormat":1},{"version":"c5079c53f0f141a0698faa903e76cb41cd664e3efb01cc17a5c46ec2eb0bef42","affectsGlobalScope":true,"impliedFormat":1},{"version":"32cafbc484dea6b0ab62cf8473182bbcb23020d70845b406f80b7526f38ae862","affectsGlobalScope":true,"impliedFormat":1},{"version":"fca4cdcb6d6c5ef18a869003d02c9f0fd95df8cfaf6eb431cd3376bc034cad36","affectsGlobalScope":true,"impliedFormat":1},{"version":"b93ec88115de9a9dc1b602291b85baf825c85666bf25985cc5f698073892b467","affectsGlobalScope":true,"impliedFormat":1},{"version":"f5c06dcc3fe849fcb297c247865a161f995cc29de7aa823afdd75aaaddc1419b","affectsGlobalScope":true,"impliedFormat":1},{"version":"b77e16112127a4b169ef0b8c3a4d730edf459c5f25fe52d5e436a6919206c4d7","affectsGlobalScope":true,"impliedFormat":1},{"version":"fbffd9337146eff822c7c00acbb78b01ea7ea23987f6c961eba689349e744f8c","affectsGlobalScope":true,"impliedFormat":1},{"version":"a995c0e49b721312f74fdfb89e4ba29bd9824c770bbb4021d74d2bf560e4c6bd","affectsGlobalScope":true,"impliedFormat":1},{"version":"c7b3542146734342e440a84b213384bfa188835537ddbda50d30766f0593aff9","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce6180fa19b1cccd07ee7f7dbb9a367ac19c0ed160573e4686425060b6df7f57","affectsGlobalScope":true,"impliedFormat":1},{"version":"3f02e2476bccb9dbe21280d6090f0df17d2f66b74711489415a8aa4df73c9675","affectsGlobalScope":true,"impliedFormat":1},{"version":"45e3ab34c1c013c8ab2dc1ba4c80c780744b13b5676800ae2e3be27ae862c40c","affectsGlobalScope":true,"impliedFormat":1},{"version":"805c86f6cca8d7702a62a844856dbaa2a3fd2abef0536e65d48732441dde5b5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"e42e397f1a5a77994f0185fd1466520691456c772d06bf843e5084ceb879a0ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"f4c2b41f90c95b1c532ecc874bd3c111865793b23aebcc1c3cbbabcd5d76ffb0","affectsGlobalScope":true,"impliedFormat":1},{"version":"ab26191cfad5b66afa11b8bf935ef1cd88fabfcb28d30b2dfa6fad877d050332","affectsGlobalScope":true,"impliedFormat":1},{"version":"2088bc26531e38fb05eedac2951480db5309f6be3fa4a08d2221abb0f5b4200d","affectsGlobalScope":true,"impliedFormat":1},{"version":"cb9d366c425fea79716a8fb3af0d78e6b22ebbab3bd64d25063b42dc9f531c1e","affectsGlobalScope":true,"impliedFormat":1},{"version":"500934a8089c26d57ebdb688fc9757389bb6207a3c8f0674d68efa900d2abb34","affectsGlobalScope":true,"impliedFormat":1},{"version":"689da16f46e647cef0d64b0def88910e818a5877ca5379ede156ca3afb780ac3","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc21cc8b6fee4f4c2440d08035b7ea3c06b3511314c8bab6bef7a92de58a2593","affectsGlobalScope":true,"impliedFormat":1},{"version":"7ca53d13d2957003abb47922a71866ba7cb2068f8d154877c596d63c359fed25","affectsGlobalScope":true,"impliedFormat":1},{"version":"54725f8c4df3d900cb4dac84b64689ce29548da0b4e9b7c2de61d41c79293611","affectsGlobalScope":true,"impliedFormat":1},{"version":"e5594bc3076ac29e6c1ebda77939bc4c8833de72f654b6e376862c0473199323","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f3eb332c2d73e729f3364fcc0c2b375e72a121e8157d25a82d67a138c83a95c","affectsGlobalScope":true,"impliedFormat":1},{"version":"6f4427f9642ce8d500970e4e69d1397f64072ab73b97e476b4002a646ac743b1","affectsGlobalScope":true,"impliedFormat":1},{"version":"48915f327cd1dea4d7bd358d9dc7732f58f9e1626a29cc0c05c8c692419d9bb7","affectsGlobalScope":true,"impliedFormat":1},{"version":"b7bf9377723203b5a6a4b920164df22d56a43f593269ba6ae1fdc97774b68855","affectsGlobalScope":true,"impliedFormat":1},{"version":"db9709688f82c9e5f65a119c64d835f906efe5f559d08b11642d56eb85b79357","affectsGlobalScope":true,"impliedFormat":1},{"version":"4b25b8c874acd1a4cf8444c3617e037d444d19080ac9f634b405583fd10ce1f7","affectsGlobalScope":true,"impliedFormat":1},{"version":"37be57d7c90cf1f8112ee2636a068d8fd181289f82b744160ec56a7dc158a9f5","affectsGlobalScope":true,"impliedFormat":1},{"version":"a917a49ac94cd26b754ab84e113369a75d1a47a710661d7cd25e961cc797065f","affectsGlobalScope":true,"impliedFormat":1},{"version":"6d3261badeb7843d157ef3e6f5d1427d0eeb0af0cf9df84a62cfd29fd47ac86e","affectsGlobalScope":true,"impliedFormat":1},{"version":"195daca651dde22f2167ac0d0a05e215308119a3100f5e6268e8317d05a92526","affectsGlobalScope":true,"impliedFormat":1},{"version":"8b11e4285cd2bb164a4dc09248bdec69e9842517db4ca47c1ba913011e44ff2f","affectsGlobalScope":true,"impliedFormat":1},{"version":"0508571a52475e245b02bc50fa1394065a0a3d05277fbf5120c3784b85651799","affectsGlobalScope":true,"impliedFormat":1},{"version":"8f9af488f510c3015af3cc8c267a9e9d96c4dd38a1fdff0e11dc5a544711415b","affectsGlobalScope":true,"impliedFormat":1},{"version":"fc611fea8d30ea72c6bbfb599c9b4d393ce22e2f5bfef2172534781e7d138104","affectsGlobalScope":true,"impliedFormat":1},{"version":"0bd714129fca875f7d4c477a1a392200b0bcd13fb2e80928cd334b63830ea047","affectsGlobalScope":true,"impliedFormat":1},{"version":"e2c9037ae6cd2c52d80ceef0b3c5ffdb488627d71529cf4f63776daf11161c9a","affectsGlobalScope":true,"impliedFormat":1},{"version":"135d5cf4d345f59f1a9caadfafcd858d3d9cc68290db616cc85797224448cccc","affectsGlobalScope":true,"impliedFormat":1},{"version":"bc238c3f81c2984751932b6aab223cd5b830e0ac6cad76389e5e9d2ffc03287d","affectsGlobalScope":true,"impliedFormat":1},{"version":"4a07f9b76d361f572620927e5735b77d6d2101c23cdd94383eb5b706e7b36357","affectsGlobalScope":true,"impliedFormat":1},{"version":"7c4e8dc6ab834cc6baa0227e030606d29e3e8449a9f67cdf5605ea5493c4db29","affectsGlobalScope":true,"impliedFormat":1},{"version":"de7ba0fd02e06cd9a5bd4ab441ed0e122735786e67dde1e849cced1cd8b46b78","affectsGlobalScope":true,"impliedFormat":1},{"version":"6148e4e88d720a06855071c3db02069434142a8332cf9c182cda551adedf3156","affectsGlobalScope":true,"impliedFormat":1},{"version":"d63dba625b108316a40c95a4425f8d4294e0deeccfd6c7e59d819efa19e23409","affectsGlobalScope":true,"impliedFormat":1},{"version":"0568d6befee03dd435bed4fc25c4e46865b24bdcb8c563fdc21f580a2c301904","affectsGlobalScope":true,"impliedFormat":1},{"version":"30d62269b05b584741f19a5369852d5d34895aa2ac4fd948956f886d15f9cc0d","affectsGlobalScope":true,"impliedFormat":1},{"version":"f128dae7c44d8f35ee42e0a437000a57c9f06cc04f8b4fb42eebf44954d53dc8","affectsGlobalScope":true,"impliedFormat":1},{"version":"ffbe6d7b295306b2ba88030f65b74c107d8d99bdcf596ea99c62a02f606108b0","affectsGlobalScope":true,"impliedFormat":1},{"version":"996fb27b15277369c68a4ba46ed138b4e9e839a02fb4ec756f7997629242fd9f","affectsGlobalScope":true,"impliedFormat":1},{"version":"79b712591b270d4778c89706ca2cfc56ddb8c3f895840e477388f1710dc5eda9","affectsGlobalScope":true,"impliedFormat":1},{"version":"20884846cef428b992b9bd032e70a4ef88e349263f63aeddf04dda837a7dba26","affectsGlobalScope":true,"impliedFormat":1},{"version":"5fcab789c73a97cd43828ee3cc94a61264cf24d4c44472ce64ced0e0f148bdb2","affectsGlobalScope":true,"impliedFormat":1},{"version":"db59a81f070c1880ad645b2c0275022baa6a0c4f0acdc58d29d349c6efcf0903","affectsGlobalScope":true,"impliedFormat":1},{"version":"673294292640f5722b700e7d814e17aaf7d93f83a48a2c9b38f33cbc940ad8b0","affectsGlobalScope":true,"impliedFormat":1},{"version":"d786b48f934cbca483b3c6d0a798cb43bbb4ada283e76fb22c28e53ae05b9e69","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ecb8e347cb6b2a8927c09b86263663289418df375f5e68e11a0ae683776978f","affectsGlobalScope":true,"impliedFormat":1},{"version":"142efd4ce210576f777dc34df121777be89eda476942d6d6663b03dcb53be3ff","affectsGlobalScope":true,"impliedFormat":1},{"version":"379bc41580c2d774f82e828c70308f24a005b490c25ba34d679d84bcf05c3d9d","affectsGlobalScope":true,"impliedFormat":1},{"version":"ed484fb2aa8a1a23d0277056ec3336e0a0b52f9b8d6a961f338a642faf43235d","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ffedae1d1c2d53fdbca1c96d3c7dda544281f7d262f99b6880634f8fd8d9820","affectsGlobalScope":true,"impliedFormat":1},{"version":"83a730b125d477dd264df8ba479afab27a3dae7152b005c214ab94dc7ee44fd3","affectsGlobalScope":true,"impliedFormat":1},{"version":"1ce14b81c5cc821994aa8ec1d42b220dd41b27fcc06373bce3958af7421b77d4","affectsGlobalScope":true,"impliedFormat":1},{"version":"b3a048b3e9302ef9a34ef4ebb9aecfb28b66abb3bce577206a79fee559c230da","affectsGlobalScope":true,"impliedFormat":1},{"version":"7e29f41b158de217f94cb9676bf9cbd0cd9b5a46e1985141ed36e075c52bf6ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac51dd7d31333793807a6abaa5ae168512b6131bd41d9c5b98477fc3b7800f9f","impliedFormat":1},{"version":"2577e7e800bdece2956ca027cb5c17aa359abd968eb9355760110c853f4fb9da","impliedFormat":1},{"version":"b838d4c72740eb0afd284bf7575b74c624b105eff2e8c7b4aeead57e7ac320ff","impliedFormat":1},"c43c2a0107a2a099fe50bcc754e90b50aa6b265ce57e464a2489798b38e4dc53","18be101c2011a0c364fc7e5ee231d6a9397808e9a095b4bb25c171adf4f23ff5","35ac5e9e25a23b55393daa079c3e7b85817598eed090c2b6b92d156fbde16c6b","3e03795c405f900bc9283d1ade119adc8e71928febe60b69b868401fea33cdc6",{"version":"a35cd7b7a0004e267d2f3b60eaf8f1c76ebea203a87bccc6da74123b8b49693d","signature":"2576d6a2af13cba5109b4fb11572c110d7bef8619c802938b521f25412b2fb89"},{"version":"65b947697bd7a6f7b944b6afa45dec28a482313b4c8ed863741c32f7fdcace64","signature":"5e8c4d4328c58e2f216bb1cbff536242ab982922493524f20cfec5f319d0b1df"},{"version":"04ed78c177c6b4bda6db145af92ad0e71311124bb40c4014b5bbe8eb0bf3bb48","signature":"f1a8429205215ff90fb4284095842d127b01092c8c198bdf25818cad6d019c59"},{"version":"ed7cc73079c7e0151eb2de626ce553be8a7199f6af2d1bfb85e76aa801404cae","signature":"7afe0d02f0a96e914879d4105e445812dce18fcee25e00ff3634b746fe6f7bf9"},{"version":"bc071e2728236d4e17a14526397c72d4f3c17d3e947ea2f2b792d45038b62146","signature":"af732cf34bfa338fff320258775aa469d8bc3e0f25b5c82e231046ae5dccabf7"},"35d32b2f157a4e27bfae13e57e73d458fb71335af717f590532c77e2b323d530",{"version":"ba8dae66524c0167ac291e7fd759570f4fd695010d8a18a62bb654acd3b868f9","signature":"74f118607ada5747ed64529a15e4e908982ba157f6b9eef873c90fea72b29e0f"}],"root":[[98,104]],"options":{"allowImportingTsExtensions":true,"allowJs":true,"composite":true,"declaration":true,"declarationMap":true,"emitDeclarationOnly":true,"jsx":4,"module":200,"noEmitOnError":true,"noFallthroughCasesInSwitch":true,"noImplicitOverride":true,"noPropertyAccessFromIndexSignature":false,"noUncheckedIndexedAccess":true,"noUnusedLocals":false,"noUnusedParameters":false,"outDir":"./","skipLibCheck":true,"strict":true,"target":99,"verbatimModuleSyntax":true},"referencedMap":[[92,1],[93,2],[95,3],[96,3],[97,4],[102,5],[100,6],[101,6],[99,7],[104,8],[98,9]],"latestChangedDtsFile":"./media-picker.d.ts","version":"6.0.2"}
|
package/package.json
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"directory": "packages/collections-admin"
|
|
15
15
|
},
|
|
16
16
|
"license": "Apache-2.0",
|
|
17
|
-
"version": "0.43.0-beta.
|
|
17
|
+
"version": "0.43.0-beta.4",
|
|
18
18
|
"module": "src/index.ts",
|
|
19
19
|
"types": "src/index.ts",
|
|
20
20
|
"type": "module",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"./styles.css": "./src/styles.css"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@nuasite/cms-
|
|
30
|
+
"@nuasite/cms-client": "0.43.0-beta.4",
|
|
31
|
+
"@nuasite/cms-types": "0.43.0-beta.4"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
34
|
"@types/react": "^19.2.7",
|
package/src/app.tsx
CHANGED
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
* optimistic save and `409` conflict resolution, plus create/delete/rename flows.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
+
import { type CmsClient, CmsClientError, createClient } from '@nuasite/cms-client'
|
|
14
15
|
import type { CollectionDefinition, CollectionEntryInfo } from '@nuasite/cms-types'
|
|
15
16
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
16
|
-
import { type CmsClient, CmsClientError, createClient } from './client'
|
|
17
17
|
import { EntryCreate } from './entry-create'
|
|
18
18
|
import { EntryEditor } from './entry-editor'
|
|
19
19
|
import './styles.css'
|
package/src/entry-create.tsx
CHANGED
|
@@ -7,11 +7,10 @@
|
|
|
7
7
|
* native draft model as the editor.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import { type CmsClient, CmsClientError, draftForCreate, type EntryDraft, setDraftField } from '@nuasite/cms-client'
|
|
10
11
|
import type { CollectionDefinition, FieldDefinition } from '@nuasite/cms-types'
|
|
11
12
|
import { useCallback, useMemo, useState } from 'react'
|
|
12
|
-
import { type CmsClient, CmsClientError } from './client'
|
|
13
13
|
import { type EditorContext, FieldEditor } from './field-editor'
|
|
14
|
-
import { draftForCreate, type EntryDraft, setDraftField } from './form-model'
|
|
15
14
|
|
|
16
15
|
function visibleFields(fields: FieldDefinition[]): FieldDefinition[] {
|
|
17
16
|
return fields.filter(f => !f.hidden)
|
package/src/entry-editor.tsx
CHANGED
|
@@ -18,12 +18,18 @@
|
|
|
18
18
|
* + `serverHash`; "use ours" re-PATCHes with `baseHash = serverHash` (force-over).
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
import {
|
|
22
|
+
type CmsClient,
|
|
23
|
+
CmsClientError,
|
|
24
|
+
type CmsConflict,
|
|
25
|
+
draftFromEntry,
|
|
26
|
+
draftFromServerFrontmatter,
|
|
27
|
+
type EntryDraft,
|
|
28
|
+
setDraftField,
|
|
29
|
+
} from '@nuasite/cms-client'
|
|
21
30
|
import type { CollectionDefinition, FieldDefinition } from '@nuasite/cms-types'
|
|
22
31
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
|
23
|
-
import type { CmsClient, CmsConflict } from './client'
|
|
24
|
-
import { CmsClientError } from './client'
|
|
25
32
|
import { type EditorContext, FieldEditor } from './field-editor'
|
|
26
|
-
import { draftFromEntry, draftFromServerFrontmatter, type EntryDraft, setDraftField } from './form-model'
|
|
27
33
|
|
|
28
34
|
const SAVE_DEBOUNCE_MS = 700
|
|
29
35
|
|
package/src/field-editor.tsx
CHANGED
|
@@ -8,10 +8,9 @@
|
|
|
8
8
|
* widgets reach the sidecar through the injected `EditorContext`.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
import { blankValue, type CmsClient, coerceInput, valueToArray, valueToBoolean, valueToInput, valueToObject } from '@nuasite/cms-client'
|
|
11
12
|
import type { FieldDefinition, FieldType } from '@nuasite/cms-types'
|
|
12
13
|
import { useCallback, useEffect, useState } from 'react'
|
|
13
|
-
import type { CmsClient } from './client'
|
|
14
|
-
import { blankValue, coerceInput, valueToArray, valueToBoolean, valueToInput, valueToObject } from './form-model'
|
|
15
14
|
import { MediaPicker } from './media-picker'
|
|
16
15
|
|
|
17
16
|
/** Cross-cutting services a widget may need (media uploads, reference lookups). */
|
package/src/index.ts
CHANGED
|
@@ -11,6 +11,8 @@ export { CollectionsAdminApp, type CollectionsAdminAppProps } from './app'
|
|
|
11
11
|
// the same source of truth — and so `@nuasite/cms-types` is a genuine runtime
|
|
12
12
|
// dependency (not type-only), matching the shared-contract intent.
|
|
13
13
|
export { FIELD_TYPES, isFieldType } from '@nuasite/cms-types'
|
|
14
|
+
// The headless SDK (client + form model) now lives in `@nuasite/cms-client`; the
|
|
15
|
+
// default UI surfaces it verbatim so a single import covers UI + client.
|
|
14
16
|
export {
|
|
15
17
|
type CmsApiError,
|
|
16
18
|
type CmsCapabilities,
|
|
@@ -23,10 +25,10 @@ export {
|
|
|
23
25
|
type CmsProjectModel,
|
|
24
26
|
createClient,
|
|
25
27
|
type CreateEntryInput,
|
|
28
|
+
type EntryDraft,
|
|
26
29
|
type GetEntriesOptions,
|
|
27
30
|
isMediaUnavailable,
|
|
28
31
|
type MediaContext,
|
|
29
32
|
type UpdateEntryInput,
|
|
30
33
|
type UpdateEntryResult,
|
|
31
|
-
} from '
|
|
32
|
-
export type { EntryDraft } from './form-model'
|
|
34
|
+
} from '@nuasite/cms-client'
|
package/src/media-picker.tsx
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
* keeping the manual URL field fully usable — the editor is never blocked on media.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
+
import { type CmsClient, isMediaUnavailable } from '@nuasite/cms-client'
|
|
13
14
|
import { useEffect, useRef, useState } from 'react'
|
|
14
|
-
import { type CmsClient, isMediaUnavailable } from './client'
|
|
15
15
|
|
|
16
16
|
interface MediaPickerProps {
|
|
17
17
|
client: CmsClient
|
package/src/tsconfig.json
CHANGED
package/src/client.ts
DELETED
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Typed client over the cms-sidecar `/cms/v1` HTTP contract (reads + mutations).
|
|
3
|
-
*
|
|
4
|
-
* The host (webmaster BFF, or a local dev proxy in F7) mounts the sidecar under
|
|
5
|
-
* an `apiBase` and adds the `/cms/v1` prefix itself — so this client requests
|
|
6
|
-
* `${apiBase}/project`, `${apiBase}/collections`, etc. (never `/cms/v1/...`).
|
|
7
|
-
*
|
|
8
|
-
* The structural model (collections/entries/fields) is reused 1:1 from
|
|
9
|
-
* `@nuasite/cms-types`. The thin HTTP envelope (project model, sparse entries
|
|
10
|
-
* list, error codes, mutation bodies, conflict response) mirrors the sidecar's
|
|
11
|
-
* wire types; it is declared here because those types are not part of the
|
|
12
|
-
* `@nuasite/cms-types` contract surface.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import type {
|
|
16
|
-
CollectionDefinition,
|
|
17
|
-
CollectionEntry,
|
|
18
|
-
CollectionEntryInfo,
|
|
19
|
-
MediaListResult,
|
|
20
|
-
MediaUploadResult,
|
|
21
|
-
MutationResult,
|
|
22
|
-
} from '@nuasite/cms-types'
|
|
23
|
-
|
|
24
|
-
/** HTTP status the sidecar uses for an optimistic-concurrency conflict. */
|
|
25
|
-
const STATUS_CONFLICT = 409
|
|
26
|
-
|
|
27
|
-
// ============================================================================
|
|
28
|
-
// Wire envelope (mirrors @nuasite/cms-sidecar's `/cms/v1` contract)
|
|
29
|
-
// ============================================================================
|
|
30
|
-
|
|
31
|
-
/** Stable error codes the sidecar exposes, each mapped to an HTTP status. */
|
|
32
|
-
export type CmsErrorCode =
|
|
33
|
-
| 'not_found'
|
|
34
|
-
| 'conflict'
|
|
35
|
-
| 'validation'
|
|
36
|
-
| 'parse_error'
|
|
37
|
-
| 'io_error'
|
|
38
|
-
| 'unsupported'
|
|
39
|
-
| 'unauthorized'
|
|
40
|
-
|
|
41
|
-
/** JSON body returned for every non-2xx response that is not a conflict. */
|
|
42
|
-
export interface CmsApiError {
|
|
43
|
-
error: string
|
|
44
|
-
code: CmsErrorCode
|
|
45
|
-
sourcePath?: string
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/** A static page route discovered under `src/pages` (pathname-only). */
|
|
49
|
-
export interface CmsPageEntry {
|
|
50
|
-
pathname: string
|
|
51
|
-
title?: string
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/** Features the sidecar advertises so the UI can degrade gracefully. */
|
|
55
|
-
export interface CmsCapabilities {
|
|
56
|
-
coreVersion: string
|
|
57
|
-
features: string[]
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** `GET /project` — the whole structural model in one call. */
|
|
61
|
-
export interface CmsProjectModel {
|
|
62
|
-
collections: CollectionDefinition[]
|
|
63
|
-
pages: CmsPageEntry[]
|
|
64
|
-
capabilities: CmsCapabilities
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/** `GET …/entries` — projected entries plus an opaque continuation cursor. */
|
|
68
|
-
export interface CmsEntriesListResult {
|
|
69
|
-
entries: CollectionEntryInfo[]
|
|
70
|
-
cursor?: string
|
|
71
|
-
hasMore: boolean
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* `409` body for a `PATCH` whose `baseHash` no longer matches disk (an agent or a
|
|
76
|
-
* human wrote in between). Carries the current server version so the UI can offer
|
|
77
|
-
* "use server" vs "use ours". Mirrors the sidecar `ConflictResponse`.
|
|
78
|
-
*/
|
|
79
|
-
export interface CmsConflict {
|
|
80
|
-
code: 'conflict'
|
|
81
|
-
serverHash: string
|
|
82
|
-
/** Raw (non-stringified) server frontmatter — unlike the line-keyed GET-detail shape. */
|
|
83
|
-
serverFrontmatter: Record<string, unknown>
|
|
84
|
-
serverBody?: string
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/** `PATCH …/entries/:slug` — frontmatter keys are merged (not replaced). */
|
|
88
|
-
export interface UpdateEntryInput {
|
|
89
|
-
frontmatter?: Record<string, unknown>
|
|
90
|
-
body?: string
|
|
91
|
-
/** Hash of the source the client edited; drives optimistic concurrency. */
|
|
92
|
-
baseHash?: string
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export interface CreateEntryInput {
|
|
96
|
-
slug: string
|
|
97
|
-
frontmatter: Record<string, unknown>
|
|
98
|
-
body?: string
|
|
99
|
-
/** File extension override for data collections (e.g. 'json', 'yaml'). */
|
|
100
|
-
fileExtension?: string
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/** Context passed to media operations so uploads can be filed against an entry/field. */
|
|
104
|
-
export interface MediaContext {
|
|
105
|
-
collection?: string
|
|
106
|
-
entry?: string
|
|
107
|
-
field?: string
|
|
108
|
-
/** Subfolder under the media root. */
|
|
109
|
-
folder?: string
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Either a successful `MutationResult` or a `409` conflict the caller must
|
|
114
|
-
* resolve. Returned (not thrown) by `updateEntry` so the editor can branch
|
|
115
|
-
* without exception flow.
|
|
116
|
-
*/
|
|
117
|
-
export type UpdateEntryResult =
|
|
118
|
-
| { status: 'ok'; result: MutationResult }
|
|
119
|
-
| { status: 'conflict'; conflict: CmsConflict }
|
|
120
|
-
|
|
121
|
-
// ============================================================================
|
|
122
|
-
// Client error
|
|
123
|
-
// ============================================================================
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Thrown for any non-2xx response. Carries the parsed sidecar error code so the
|
|
127
|
-
* UI can distinguish auth failures (`unauthorized`/`forbidden`) from a missing
|
|
128
|
-
* collection/entry (`not_found`) or a generic failure.
|
|
129
|
-
*/
|
|
130
|
-
export class CmsClientError extends Error {
|
|
131
|
-
constructor(
|
|
132
|
-
readonly status: number,
|
|
133
|
-
readonly code: CmsErrorCode | 'forbidden' | 'unknown',
|
|
134
|
-
message: string,
|
|
135
|
-
) {
|
|
136
|
-
super(message)
|
|
137
|
-
this.name = 'CmsClientError'
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/** Session cookie missing/expired upstream — the user must re-authenticate. */
|
|
141
|
-
get isUnauthorized(): boolean {
|
|
142
|
-
return this.code === 'unauthorized' || this.status === 401
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/** Authenticated but lacks access to this project. */
|
|
146
|
-
get isForbidden(): boolean {
|
|
147
|
-
return this.code === 'forbidden' || this.status === 403
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
get isNotFound(): boolean {
|
|
151
|
-
return this.code === 'not_found' || this.status === 404
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// ============================================================================
|
|
156
|
-
// Query options
|
|
157
|
-
// ============================================================================
|
|
158
|
-
|
|
159
|
-
export interface GetEntriesOptions {
|
|
160
|
-
/** "slug,title" | "*" ; absent = light header (slug/title/draft/pathname). */
|
|
161
|
-
fields?: string
|
|
162
|
-
/** Draft filter — defaults to `'false'` (published only) on the sidecar. */
|
|
163
|
-
draft?: 'true' | 'false' | 'all'
|
|
164
|
-
/** Opaque continuation cursor from a previous page's `cursor`. */
|
|
165
|
-
cursor?: string
|
|
166
|
-
limit?: number
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// ============================================================================
|
|
170
|
-
// Client
|
|
171
|
-
// ============================================================================
|
|
172
|
-
|
|
173
|
-
function isApiError(value: unknown): value is CmsApiError {
|
|
174
|
-
return isRecord(value)
|
|
175
|
-
&& typeof value.error === 'string'
|
|
176
|
-
&& typeof value.code === 'string'
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/** Narrow `unknown` to a record so property reads typecheck without casts. */
|
|
180
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
181
|
-
return typeof value === 'object' && value !== null
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function isConflict(value: unknown): value is CmsConflict {
|
|
185
|
-
if (!isRecord(value)) return false
|
|
186
|
-
return value.code === 'conflict'
|
|
187
|
-
&& typeof value.serverHash === 'string'
|
|
188
|
-
&& isRecord(value.serverFrontmatter)
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
const KNOWN_ERROR_CODES: readonly CmsErrorCode[] = [
|
|
192
|
-
'not_found',
|
|
193
|
-
'conflict',
|
|
194
|
-
'validation',
|
|
195
|
-
'parse_error',
|
|
196
|
-
'io_error',
|
|
197
|
-
'unsupported',
|
|
198
|
-
'unauthorized',
|
|
199
|
-
]
|
|
200
|
-
|
|
201
|
-
function isErrorCode(value: string): value is CmsErrorCode {
|
|
202
|
-
return (KNOWN_ERROR_CODES as readonly string[]).includes(value)
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
export interface CmsClient {
|
|
206
|
-
getProject(): Promise<CmsProjectModel>
|
|
207
|
-
getCollections(): Promise<CollectionDefinition[]>
|
|
208
|
-
getEntries(collection: string, options?: GetEntriesOptions): Promise<CmsEntriesListResult>
|
|
209
|
-
getEntry(collection: string, slug: string): Promise<CollectionEntry>
|
|
210
|
-
|
|
211
|
-
// --- Mutations ---
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Merge-patch an entry's frontmatter/body. Returns a discriminated result: a
|
|
215
|
-
* `409` is surfaced as `{ status: 'conflict' }` (not thrown) so the editor can
|
|
216
|
-
* open the conflict dialog. The new `baseHash` is on `result.sourceHash`.
|
|
217
|
-
*/
|
|
218
|
-
updateEntry(collection: string, slug: string, input: UpdateEntryInput): Promise<UpdateEntryResult>
|
|
219
|
-
createEntry(collection: string, input: CreateEntryInput): Promise<MutationResult>
|
|
220
|
-
deleteEntry(collection: string, slug: string): Promise<MutationResult>
|
|
221
|
-
renameEntry(collection: string, slug: string, to: string): Promise<MutationResult>
|
|
222
|
-
addArrayItem(collection: string, slug: string, field: string, value: unknown, index?: number): Promise<MutationResult>
|
|
223
|
-
removeArrayItem(collection: string, slug: string, field: string, index: number): Promise<MutationResult>
|
|
224
|
-
|
|
225
|
-
// --- Media (degrades gracefully when the sidecar has no adapter wired: 501). ---
|
|
226
|
-
|
|
227
|
-
listMedia(options?: { folder?: string; cursor?: string; limit?: number }): Promise<MediaListResult>
|
|
228
|
-
uploadMedia(file: File, context?: MediaContext): Promise<MediaUploadResult>
|
|
229
|
-
deleteMedia(id: string): Promise<{ success: boolean; error?: string }>
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* Whether a thrown `CmsClientError` means "media is not available" — the deployed
|
|
234
|
-
* sidecar may have no media adapter wired (`501 unsupported`). The picker uses
|
|
235
|
-
* this to degrade gracefully instead of surfacing a hard error.
|
|
236
|
-
*/
|
|
237
|
-
export function isMediaUnavailable(error: unknown): boolean {
|
|
238
|
-
return error instanceof CmsClientError && (error.status === 501 || error.code === 'unsupported')
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export function createClient(apiBase: string): CmsClient {
|
|
242
|
-
// Normalise: drop a trailing slash so `${base}${path}` joins cleanly.
|
|
243
|
-
const base = apiBase.endsWith('/') ? apiBase.slice(0, -1) : apiBase
|
|
244
|
-
|
|
245
|
-
async function request<T>(path: string): Promise<T> {
|
|
246
|
-
const response = await fetch(`${base}${path}`, {
|
|
247
|
-
method: 'GET',
|
|
248
|
-
credentials: 'include',
|
|
249
|
-
headers: { accept: 'application/json' },
|
|
250
|
-
})
|
|
251
|
-
|
|
252
|
-
if (!response.ok) {
|
|
253
|
-
throw await toError(response)
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// Successful responses are always JSON in the read-only surface.
|
|
257
|
-
const value: T = await response.json()
|
|
258
|
-
return value
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
async function toError(response: Response): Promise<CmsClientError> {
|
|
262
|
-
// 403 is produced by the BFF (project scope), not the sidecar, so it has no
|
|
263
|
-
// sidecar `code`; `errorFromBody` surfaces it as a distinct `forbidden`.
|
|
264
|
-
const body: unknown = await response.json().catch(() => null)
|
|
265
|
-
return errorFromBody(response.status, body)
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
function errorMessageFromBody(body: unknown, fallback: string): string {
|
|
269
|
-
if (isApiError(body)) return body.error
|
|
270
|
-
if (isRecord(body)) {
|
|
271
|
-
const err = body.error
|
|
272
|
-
if (isRecord(err) && typeof err.message === 'string') return err.message
|
|
273
|
-
}
|
|
274
|
-
return fallback
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
/** Build a `CmsClientError` from an already-parsed body (no re-read of the stream). */
|
|
278
|
-
function errorFromBody(status: number, body: unknown): CmsClientError {
|
|
279
|
-
if (status === 403) {
|
|
280
|
-
return new CmsClientError(403, 'forbidden', errorMessageFromBody(body, 'You do not have access to this project.'))
|
|
281
|
-
}
|
|
282
|
-
if (isApiError(body) && isErrorCode(body.code)) {
|
|
283
|
-
return new CmsClientError(status, body.code, body.error)
|
|
284
|
-
}
|
|
285
|
-
if (status === 401) {
|
|
286
|
-
return new CmsClientError(401, 'unauthorized', 'Your session has expired. Please reload.')
|
|
287
|
-
}
|
|
288
|
-
return new CmsClientError(status, 'unknown', errorMessageFromBody(body, `Request failed (${status})`))
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function mutationInit(method: string, body?: unknown): RequestInit {
|
|
292
|
-
const init: RequestInit = {
|
|
293
|
-
method,
|
|
294
|
-
credentials: 'include',
|
|
295
|
-
headers: { accept: 'application/json' },
|
|
296
|
-
}
|
|
297
|
-
if (body !== undefined) {
|
|
298
|
-
init.body = JSON.stringify(body)
|
|
299
|
-
init.headers = { accept: 'application/json', 'content-type': 'application/json' }
|
|
300
|
-
}
|
|
301
|
-
return init
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/**
|
|
305
|
-
* Send a JSON-body mutation (POST/PATCH/DELETE). Throws `CmsClientError` on any
|
|
306
|
-
* non-2xx — used by the mutations that have no conflict branch. The
|
|
307
|
-
* conflict-aware update has its own path below.
|
|
308
|
-
*/
|
|
309
|
-
async function mutate<T>(path: string, method: string, body?: unknown): Promise<T> {
|
|
310
|
-
const response = await fetch(`${base}${path}`, mutationInit(method, body))
|
|
311
|
-
if (!response.ok) throw await toError(response)
|
|
312
|
-
// Mutation responses are documented JSON; the asserted shape is trusted
|
|
313
|
-
// (`response.json()` widens to the declared `T`, mirroring `request`).
|
|
314
|
-
const value: T = await response.json()
|
|
315
|
-
return value
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function entryPath(collection: string, slug: string): string {
|
|
319
|
-
return `/collections/${encodeURIComponent(collection)}/entries/${encodeURIComponent(slug)}`
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
return {
|
|
323
|
-
getProject() {
|
|
324
|
-
return request<CmsProjectModel>('/project')
|
|
325
|
-
},
|
|
326
|
-
getCollections() {
|
|
327
|
-
return request<CollectionDefinition[]>('/collections')
|
|
328
|
-
},
|
|
329
|
-
getEntries(collection, options = {}) {
|
|
330
|
-
const params = new URLSearchParams()
|
|
331
|
-
if (options.fields !== undefined) params.set('fields', options.fields)
|
|
332
|
-
if (options.draft !== undefined) params.set('draft', options.draft)
|
|
333
|
-
if (options.cursor !== undefined) params.set('cursor', options.cursor)
|
|
334
|
-
if (options.limit !== undefined) params.set('limit', String(options.limit))
|
|
335
|
-
const query = params.toString()
|
|
336
|
-
const suffix = query === '' ? '' : `?${query}`
|
|
337
|
-
return request<CmsEntriesListResult>(`/collections/${encodeURIComponent(collection)}/entries${suffix}`)
|
|
338
|
-
},
|
|
339
|
-
getEntry(collection, slug) {
|
|
340
|
-
return request<CollectionEntry>(entryPath(collection, slug))
|
|
341
|
-
},
|
|
342
|
-
|
|
343
|
-
async updateEntry(collection, slug, input) {
|
|
344
|
-
const response = await fetch(`${base}${entryPath(collection, slug)}`, mutationInit('PATCH', input))
|
|
345
|
-
// A `409` carries the server version; parse and return it for the dialog.
|
|
346
|
-
if (response.status === STATUS_CONFLICT) {
|
|
347
|
-
const body: unknown = await response.json().catch(() => null)
|
|
348
|
-
if (isConflict(body)) return { status: 'conflict', conflict: body }
|
|
349
|
-
throw errorFromBody(response.status, body)
|
|
350
|
-
}
|
|
351
|
-
if (!response.ok) throw await toError(response)
|
|
352
|
-
const result: MutationResult = await response.json()
|
|
353
|
-
return { status: 'ok', result }
|
|
354
|
-
},
|
|
355
|
-
createEntry(collection, input) {
|
|
356
|
-
return mutate<MutationResult>(`/collections/${encodeURIComponent(collection)}/entries`, 'POST', input)
|
|
357
|
-
},
|
|
358
|
-
deleteEntry(collection, slug) {
|
|
359
|
-
return mutate<MutationResult>(entryPath(collection, slug), 'DELETE')
|
|
360
|
-
},
|
|
361
|
-
renameEntry(collection, slug, to) {
|
|
362
|
-
return mutate<MutationResult>(`${entryPath(collection, slug)}/rename`, 'POST', { to })
|
|
363
|
-
},
|
|
364
|
-
addArrayItem(collection, slug, field, value, index) {
|
|
365
|
-
const body = index === undefined ? { field, value } : { field, value, index }
|
|
366
|
-
return mutate<MutationResult>(`${entryPath(collection, slug)}/array`, 'POST', body)
|
|
367
|
-
},
|
|
368
|
-
removeArrayItem(collection, slug, field, index) {
|
|
369
|
-
return mutate<MutationResult>(`${entryPath(collection, slug)}/array`, 'DELETE', { field, index })
|
|
370
|
-
},
|
|
371
|
-
|
|
372
|
-
listMedia(options = {}) {
|
|
373
|
-
const params = new URLSearchParams()
|
|
374
|
-
if (options.folder !== undefined) params.set('folder', options.folder)
|
|
375
|
-
if (options.cursor !== undefined) params.set('cursor', options.cursor)
|
|
376
|
-
if (options.limit !== undefined) params.set('limit', String(options.limit))
|
|
377
|
-
const query = params.toString()
|
|
378
|
-
return request<MediaListResult>(`/media${query === '' ? '' : `?${query}`}`)
|
|
379
|
-
},
|
|
380
|
-
async uploadMedia(file, context = {}) {
|
|
381
|
-
// The sidecar reads upload context (collection/entry/field/folder) from the
|
|
382
|
-
// query string; the file rides in multipart form data under `file`.
|
|
383
|
-
const params = new URLSearchParams()
|
|
384
|
-
if (context.collection !== undefined) params.set('collection', context.collection)
|
|
385
|
-
if (context.entry !== undefined) params.set('entry', context.entry)
|
|
386
|
-
if (context.field !== undefined) params.set('field', context.field)
|
|
387
|
-
if (context.folder !== undefined) params.set('folder', context.folder)
|
|
388
|
-
const query = params.toString()
|
|
389
|
-
const form = new FormData()
|
|
390
|
-
form.append('file', file)
|
|
391
|
-
const response = await fetch(`${base}/media${query === '' ? '' : `?${query}`}`, {
|
|
392
|
-
method: 'POST',
|
|
393
|
-
credentials: 'include',
|
|
394
|
-
headers: { accept: 'application/json' },
|
|
395
|
-
body: form,
|
|
396
|
-
})
|
|
397
|
-
if (!response.ok) throw await toError(response)
|
|
398
|
-
const result: MediaUploadResult = await response.json()
|
|
399
|
-
return result
|
|
400
|
-
},
|
|
401
|
-
deleteMedia(id) {
|
|
402
|
-
return mutate<{ success: boolean; error?: string }>(`/media/${encodeURIComponent(id)}`, 'DELETE')
|
|
403
|
-
},
|
|
404
|
-
}
|
|
405
|
-
}
|
package/src/form-model.ts
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure draft model + field coercion for the entry editor (cms-headless F3.2).
|
|
3
|
-
*
|
|
4
|
-
* The sidecar speaks two slightly different frontmatter shapes:
|
|
5
|
-
* - `GET …/entries/:slug` returns `frontmatter: Record<string, { value: string; line: number }>`,
|
|
6
|
-
* where `value` is already stringified (objects/arrays are JSON).
|
|
7
|
-
* - `PATCH …` accepts `frontmatter?: Record<string, unknown>` of *native* values (merged), and a
|
|
8
|
-
* `409` `serverFrontmatter` is likewise native (not stringified).
|
|
9
|
-
*
|
|
10
|
-
* The editor works on a single native draft (`EntryDraft`): `frontmatter` is a
|
|
11
|
-
* `Record<string, unknown>` of native JS values keyed by field name, plus the
|
|
12
|
-
* markdown `body`. This module converts to/from the wire and coerces raw input
|
|
13
|
-
* (form strings) into the native value a `FieldType` expects. Keeping it pure
|
|
14
|
-
* (no React/DOM) makes the mapping unit-testable.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import type { CollectionEntry, FieldDefinition, FieldType } from '@nuasite/cms-types'
|
|
18
|
-
|
|
19
|
-
/** The editor's in-memory state: native frontmatter values + the markdown body. */
|
|
20
|
-
export interface EntryDraft {
|
|
21
|
-
frontmatter: Record<string, unknown>
|
|
22
|
-
body: string
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
26
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Parse one stringified frontmatter `value` (from `GET …/entries/:slug`) into the
|
|
31
|
-
* native value a field of `type` expects. Structural types (object/array) and
|
|
32
|
-
* unknowns fall back to a best-effort `JSON.parse`; scalars are coerced per type.
|
|
33
|
-
*/
|
|
34
|
-
export function parseWireValue(type: FieldType, raw: string): unknown {
|
|
35
|
-
switch (type) {
|
|
36
|
-
case 'boolean':
|
|
37
|
-
return raw === 'true' || raw === '1' || raw.toLowerCase() === 'yes'
|
|
38
|
-
case 'number':
|
|
39
|
-
case 'year':
|
|
40
|
-
case 'month': {
|
|
41
|
-
const n = Number(raw)
|
|
42
|
-
return raw.trim() === '' || Number.isNaN(n) ? raw : n
|
|
43
|
-
}
|
|
44
|
-
case 'array':
|
|
45
|
-
case 'object':
|
|
46
|
-
return parseJsonLoose(raw)
|
|
47
|
-
default:
|
|
48
|
-
return raw
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** `JSON.parse` for structural values, falling back to the raw string when invalid. */
|
|
53
|
-
function parseJsonLoose(raw: string): unknown {
|
|
54
|
-
const trimmed = raw.trim()
|
|
55
|
-
if (trimmed === '') return undefined
|
|
56
|
-
if (!(trimmed.startsWith('{') || trimmed.startsWith('[') || trimmed.startsWith('"'))) return raw
|
|
57
|
-
try {
|
|
58
|
-
return JSON.parse(trimmed)
|
|
59
|
-
} catch {
|
|
60
|
-
return raw
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Build a native draft from a loaded entry, driven by the collection's fields.
|
|
66
|
-
* Frontmatter keys present on the entry but absent from the inferred schema are
|
|
67
|
-
* preserved verbatim (as raw strings) so a save never silently drops them.
|
|
68
|
-
*/
|
|
69
|
-
export function draftFromEntry(entry: CollectionEntry, fields: FieldDefinition[]): EntryDraft {
|
|
70
|
-
const byName = new Map(fields.map(f => [f.name, f] as const))
|
|
71
|
-
const frontmatter: Record<string, unknown> = {}
|
|
72
|
-
for (const [key, cell] of Object.entries(entry.frontmatter)) {
|
|
73
|
-
const field = byName.get(key)
|
|
74
|
-
frontmatter[key] = field ? parseWireValue(field.type, cell.value) : cell.value
|
|
75
|
-
}
|
|
76
|
-
return { frontmatter, body: entry.body }
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Build a fresh draft for a create form from the collection's fields, seeding
|
|
81
|
-
* each field with its `defaultValue` (when present) or a type-appropriate blank.
|
|
82
|
-
*/
|
|
83
|
-
export function draftForCreate(fields: FieldDefinition[]): EntryDraft {
|
|
84
|
-
const frontmatter: Record<string, unknown> = {}
|
|
85
|
-
for (const field of fields) {
|
|
86
|
-
if (field.hidden) continue
|
|
87
|
-
if (field.defaultValue !== undefined) {
|
|
88
|
-
frontmatter[field.name] = field.defaultValue
|
|
89
|
-
continue
|
|
90
|
-
}
|
|
91
|
-
frontmatter[field.name] = blankValue(field.type)
|
|
92
|
-
}
|
|
93
|
-
return { frontmatter, body: '' }
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/** A type-appropriate empty value used to seed create forms. */
|
|
97
|
-
export function blankValue(type: FieldType): unknown {
|
|
98
|
-
switch (type) {
|
|
99
|
-
case 'boolean':
|
|
100
|
-
return false
|
|
101
|
-
case 'array':
|
|
102
|
-
return []
|
|
103
|
-
case 'object':
|
|
104
|
-
return {}
|
|
105
|
-
default:
|
|
106
|
-
return ''
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Adopt a server-provided native frontmatter map (from a `409` `serverFrontmatter`)
|
|
112
|
-
* into a draft, re-coercing per field where a definition exists.
|
|
113
|
-
*/
|
|
114
|
-
export function draftFromServerFrontmatter(
|
|
115
|
-
serverFrontmatter: Record<string, unknown>,
|
|
116
|
-
serverBody: string | undefined,
|
|
117
|
-
fields: FieldDefinition[],
|
|
118
|
-
): EntryDraft {
|
|
119
|
-
const byName = new Map(fields.map(f => [f.name, f] as const))
|
|
120
|
-
const frontmatter: Record<string, unknown> = {}
|
|
121
|
-
for (const [key, value] of Object.entries(serverFrontmatter)) {
|
|
122
|
-
const field = byName.get(key)
|
|
123
|
-
// Server values are already native; only re-coerce when the value arrived as
|
|
124
|
-
// a string for a numeric/boolean field (e.g. YAML quirks).
|
|
125
|
-
frontmatter[key] = field && typeof value === 'string' ? parseWireValue(field.type, value) : value
|
|
126
|
-
}
|
|
127
|
-
return { frontmatter, body: serverBody ?? '' }
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Coerce a raw form-control string into the native value a field expects. Used by
|
|
132
|
-
* the widgets, whose `<input>` values are always strings.
|
|
133
|
-
*/
|
|
134
|
-
export function coerceInput(type: FieldType, raw: string): unknown {
|
|
135
|
-
switch (type) {
|
|
136
|
-
case 'boolean':
|
|
137
|
-
return raw === 'true'
|
|
138
|
-
case 'number': {
|
|
139
|
-
if (raw.trim() === '') return undefined
|
|
140
|
-
const n = Number(raw)
|
|
141
|
-
return Number.isNaN(n) ? raw : n
|
|
142
|
-
}
|
|
143
|
-
case 'year':
|
|
144
|
-
case 'month': {
|
|
145
|
-
if (raw.trim() === '') return undefined
|
|
146
|
-
const n = Number(raw)
|
|
147
|
-
return Number.isNaN(n) ? raw : n
|
|
148
|
-
}
|
|
149
|
-
default:
|
|
150
|
-
return raw
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/** Render a native value back to a string for a text/number/date/select control. */
|
|
155
|
-
export function valueToInput(value: unknown): string {
|
|
156
|
-
if (value === undefined || value === null) return ''
|
|
157
|
-
if (typeof value === 'string') return value
|
|
158
|
-
if (typeof value === 'number' || typeof value === 'boolean') return String(value)
|
|
159
|
-
return JSON.stringify(value)
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
/** Read a value as a boolean for toggle widgets, tolerating string encodings. */
|
|
163
|
-
export function valueToBoolean(value: unknown): boolean {
|
|
164
|
-
if (typeof value === 'boolean') return value
|
|
165
|
-
if (typeof value === 'string') return value === 'true' || value === '1' || value.toLowerCase() === 'yes'
|
|
166
|
-
return Boolean(value)
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/** Read a value as an array of items for repeater widgets. */
|
|
170
|
-
export function valueToArray(value: unknown): unknown[] {
|
|
171
|
-
return Array.isArray(value) ? value : []
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/** Read a value as an object for nested-group widgets. */
|
|
175
|
-
export function valueToObject(value: unknown): Record<string, unknown> {
|
|
176
|
-
return isRecord(value) ? value : {}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/** Immutably set a top-level frontmatter key in a draft. */
|
|
180
|
-
export function setDraftField(draft: EntryDraft, name: string, value: unknown): EntryDraft {
|
|
181
|
-
return { ...draft, frontmatter: { ...draft.frontmatter, [name]: value } }
|
|
182
|
-
}
|