@orion-studios/payload-studio 0.5.0-beta.76 → 0.5.0-beta.77

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,6 @@
1
1
  import {
2
2
  sectionStyleDefaults
3
3
  } from "./chunk-SIL2J5MF.mjs";
4
- import {
5
- assertStudioDocumentV1
6
- } from "./chunk-ADIIWIYL.mjs";
7
4
  import {
8
5
  __export
9
6
  } from "./chunk-6BWS3CLP.mjs";
@@ -749,6 +746,44 @@ var inspectorDefinitionByBlockType = {
749
746
  import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
750
747
 
751
748
  // src/studio-pages/migrations.ts
749
+ var isRecord3 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
750
+ var assertPageStudioDocumentV1 = (value) => {
751
+ if (!isRecord3(value)) {
752
+ throw new Error("Studio document must be an object");
753
+ }
754
+ if (value.schemaVersion !== 1) {
755
+ throw new Error("Unsupported studio schemaVersion");
756
+ }
757
+ if (!Array.isArray(value.nodes)) {
758
+ throw new Error("Studio document nodes must be an array");
759
+ }
760
+ const nodes = value.nodes.map((node, index) => {
761
+ if (!isRecord3(node)) {
762
+ throw new Error(`Node at index ${index} must be an object`);
763
+ }
764
+ if (typeof node.id !== "string" || node.id.length === 0) {
765
+ throw new Error(`Node at index ${index} has invalid id`);
766
+ }
767
+ if (typeof node.type !== "string" || node.type.length === 0) {
768
+ throw new Error(`Node at index ${index} has invalid type`);
769
+ }
770
+ if (!isRecord3(node.data)) {
771
+ throw new Error(`Node at index ${index} has invalid data`);
772
+ }
773
+ return {
774
+ data: node.data,
775
+ id: node.id,
776
+ type: node.type
777
+ };
778
+ });
779
+ return {
780
+ metadata: isRecord3(value.metadata) ? value.metadata : void 0,
781
+ nodes,
782
+ schemaVersion: 1,
783
+ title: typeof value.title === "string" ? value.title : void 0,
784
+ updatedAt: typeof value.updatedAt === "string" ? value.updatedAt : void 0
785
+ };
786
+ };
752
787
  var migratePageNodeToSettingsV2 = (node) => {
753
788
  const normalized = migrateBlockToSettingsV2({
754
789
  blockType: node.type,
@@ -761,7 +796,7 @@ var migratePageNodeToSettingsV2 = (node) => {
761
796
  };
762
797
  };
763
798
  var migratePageDocumentSettingsToV2 = (value) => {
764
- const current = assertStudioDocumentV1(value);
799
+ const current = assertPageStudioDocumentV1(value);
765
800
  return {
766
801
  ...current,
767
802
  nodes: current.nodes.map(migratePageNodeToSettingsV2)
@@ -1,9 +1,9 @@
1
- import {
2
- studioDocumentToLayout
3
- } from "./chunk-C2NV4VHU.mjs";
4
1
  import {
5
2
  assertStudioDocumentV1
6
3
  } from "./chunk-ADIIWIYL.mjs";
4
+ import {
5
+ studioDocumentToLayout
6
+ } from "./chunk-YSH3KLUU.mjs";
7
7
  import {
8
8
  __export
9
9
  } from "./chunk-6BWS3CLP.mjs";
package/dist/index.js CHANGED
@@ -3436,6 +3436,44 @@ var inspectorDefinitionByBlockType = {
3436
3436
  var import_jsx_runtime6 = require("react/jsx-runtime");
3437
3437
 
3438
3438
  // src/studio-pages/migrations.ts
3439
+ var isRecord4 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
3440
+ var assertPageStudioDocumentV1 = (value) => {
3441
+ if (!isRecord4(value)) {
3442
+ throw new Error("Studio document must be an object");
3443
+ }
3444
+ if (value.schemaVersion !== 1) {
3445
+ throw new Error("Unsupported studio schemaVersion");
3446
+ }
3447
+ if (!Array.isArray(value.nodes)) {
3448
+ throw new Error("Studio document nodes must be an array");
3449
+ }
3450
+ const nodes = value.nodes.map((node, index) => {
3451
+ if (!isRecord4(node)) {
3452
+ throw new Error(`Node at index ${index} must be an object`);
3453
+ }
3454
+ if (typeof node.id !== "string" || node.id.length === 0) {
3455
+ throw new Error(`Node at index ${index} has invalid id`);
3456
+ }
3457
+ if (typeof node.type !== "string" || node.type.length === 0) {
3458
+ throw new Error(`Node at index ${index} has invalid type`);
3459
+ }
3460
+ if (!isRecord4(node.data)) {
3461
+ throw new Error(`Node at index ${index} has invalid data`);
3462
+ }
3463
+ return {
3464
+ data: node.data,
3465
+ id: node.id,
3466
+ type: node.type
3467
+ };
3468
+ });
3469
+ return {
3470
+ metadata: isRecord4(value.metadata) ? value.metadata : void 0,
3471
+ nodes,
3472
+ schemaVersion: 1,
3473
+ title: typeof value.title === "string" ? value.title : void 0,
3474
+ updatedAt: typeof value.updatedAt === "string" ? value.updatedAt : void 0
3475
+ };
3476
+ };
3439
3477
  var migratePageNodeToSettingsV2 = (node) => {
3440
3478
  const normalized = migrateBlockToSettingsV2({
3441
3479
  blockType: node.type,
@@ -3448,7 +3486,7 @@ var migratePageNodeToSettingsV2 = (node) => {
3448
3486
  };
3449
3487
  };
3450
3488
  var migratePageDocumentSettingsToV2 = (value) => {
3451
- const current = assertStudioDocumentV1(value);
3489
+ const current = assertPageStudioDocumentV1(value);
3452
3490
  return {
3453
3491
  ...current,
3454
3492
  nodes: current.nodes.map(migratePageNodeToSettingsV2)
package/dist/index.mjs CHANGED
@@ -9,14 +9,14 @@ import {
9
9
  } from "./chunk-XK3K5GRP.mjs";
10
10
  import {
11
11
  nextjs_exports
12
- } from "./chunk-J25NGORF.mjs";
13
- import {
14
- studio_pages_exports
15
- } from "./chunk-C2NV4VHU.mjs";
16
- import "./chunk-SIL2J5MF.mjs";
12
+ } from "./chunk-ZYKHJFXY.mjs";
17
13
  import {
18
14
  studio_exports
19
15
  } from "./chunk-ADIIWIYL.mjs";
16
+ import {
17
+ studio_pages_exports
18
+ } from "./chunk-YSH3KLUU.mjs";
19
+ import "./chunk-SIL2J5MF.mjs";
20
20
  import "./chunk-6BWS3CLP.mjs";
21
21
  export {
22
22
  admin_exports as admin,
@@ -4,10 +4,10 @@ import {
4
4
  createPayloadClient,
5
5
  createSiteQueries,
6
6
  resolveMedia
7
- } from "../chunk-J25NGORF.mjs";
8
- import "../chunk-C2NV4VHU.mjs";
9
- import "../chunk-SIL2J5MF.mjs";
7
+ } from "../chunk-ZYKHJFXY.mjs";
10
8
  import "../chunk-ADIIWIYL.mjs";
9
+ import "../chunk-YSH3KLUU.mjs";
10
+ import "../chunk-SIL2J5MF.mjs";
11
11
  import "../chunk-6BWS3CLP.mjs";
12
12
  export {
13
13
  WEBSITE_CONTENT_TAG,
@@ -1203,21 +1203,6 @@ function BlockInspectorRenderer({
1203
1203
  ] });
1204
1204
  }
1205
1205
 
1206
- // src/studio/imageUploadOptimization.ts
1207
- var import_promises = require("fs/promises");
1208
- var DEFAULT_OPTIONS = {
1209
- avifQuality: 50,
1210
- enforceSmallerForLossy: true,
1211
- jpegQuality: 78,
1212
- minBytes: 48 * 1024,
1213
- minQualityFloor: 42,
1214
- onlyIfSmaller: true,
1215
- pngCompressionLevel: 9,
1216
- skipAnimated: true,
1217
- tiffQuality: 75,
1218
- webpQuality: 78
1219
- };
1220
-
1221
1206
  // src/studio-pages/index.ts
1222
1207
  var withSectionStyleDefaults = (value) => ({
1223
1208
  ...sectionStyleDefaults,
@@ -1177,21 +1177,6 @@ function BlockInspectorRenderer({
1177
1177
  ] });
1178
1178
  }
1179
1179
 
1180
- // src/studio/imageUploadOptimization.ts
1181
- import { readFile, unlink } from "fs/promises";
1182
- var DEFAULT_OPTIONS = {
1183
- avifQuality: 50,
1184
- enforceSmallerForLossy: true,
1185
- jpegQuality: 78,
1186
- minBytes: 48 * 1024,
1187
- minQualityFloor: 42,
1188
- onlyIfSmaller: true,
1189
- pngCompressionLevel: 9,
1190
- skipAnimated: true,
1191
- tiffQuality: 75,
1192
- webpQuality: 78
1193
- };
1194
-
1195
1180
  // src/studio-pages/index.ts
1196
1181
  var withSectionStyleDefaults = (value) => ({
1197
1182
  ...sectionStyleDefaults,
@@ -778,34 +778,19 @@ var inspectorDefinitionByBlockType = {
778
778
  // src/studio-pages/builder/settings-v2/BlockInspectorRenderer.tsx
779
779
  var import_jsx_runtime3 = require("react/jsx-runtime");
780
780
 
781
- // src/studio/imageUploadOptimization.ts
782
- var import_promises = require("fs/promises");
783
- var DEFAULT_OPTIONS = {
784
- avifQuality: 50,
785
- enforceSmallerForLossy: true,
786
- jpegQuality: 78,
787
- minBytes: 48 * 1024,
788
- minQualityFloor: 42,
789
- onlyIfSmaller: true,
790
- pngCompressionLevel: 9,
791
- skipAnimated: true,
792
- tiffQuality: 75,
793
- webpQuality: 78
794
- };
795
-
796
- // src/studio/index.ts
781
+ // src/studio-pages/migrations.ts
797
782
  var isRecord3 = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
798
- function assertStudioDocumentV1(input) {
799
- if (!isRecord3(input)) {
783
+ var assertPageStudioDocumentV1 = (value) => {
784
+ if (!isRecord3(value)) {
800
785
  throw new Error("Studio document must be an object");
801
786
  }
802
- if (input.schemaVersion !== 1) {
787
+ if (value.schemaVersion !== 1) {
803
788
  throw new Error("Unsupported studio schemaVersion");
804
789
  }
805
- if (!Array.isArray(input.nodes)) {
790
+ if (!Array.isArray(value.nodes)) {
806
791
  throw new Error("Studio document nodes must be an array");
807
792
  }
808
- const nodes = input.nodes.map((node, index) => {
793
+ const nodes = value.nodes.map((node, index) => {
809
794
  if (!isRecord3(node)) {
810
795
  throw new Error(`Node at index ${index} must be an object`);
811
796
  }
@@ -819,21 +804,19 @@ function assertStudioDocumentV1(input) {
819
804
  throw new Error(`Node at index ${index} has invalid data`);
820
805
  }
821
806
  return {
807
+ data: node.data,
822
808
  id: node.id,
823
- type: node.type,
824
- data: node.data
809
+ type: node.type
825
810
  };
826
811
  });
827
812
  return {
828
- metadata: isRecord3(input.metadata) ? input.metadata : void 0,
829
- schemaVersion: 1,
830
- title: typeof input.title === "string" ? input.title : void 0,
813
+ metadata: isRecord3(value.metadata) ? value.metadata : void 0,
831
814
  nodes,
832
- updatedAt: typeof input.updatedAt === "string" ? input.updatedAt : void 0
815
+ schemaVersion: 1,
816
+ title: typeof value.title === "string" ? value.title : void 0,
817
+ updatedAt: typeof value.updatedAt === "string" ? value.updatedAt : void 0
833
818
  };
834
- }
835
-
836
- // src/studio-pages/migrations.ts
819
+ };
837
820
  var migratePageNodeToSettingsV2 = (node) => {
838
821
  const normalized = migrateBlockToSettingsV2({
839
822
  blockType: node.type,
@@ -846,7 +829,7 @@ var migratePageNodeToSettingsV2 = (node) => {
846
829
  };
847
830
  };
848
831
  var migratePageDocumentSettingsToV2 = (value) => {
849
- const current = assertStudioDocumentV1(value);
832
+ const current = assertPageStudioDocumentV1(value);
850
833
  return {
851
834
  ...current,
852
835
  nodes: current.nodes.map(migratePageNodeToSettingsV2)
@@ -8,9 +8,8 @@ import {
8
8
  pageStudioModuleManifest,
9
9
  resolveBuilderThemeTokens,
10
10
  studioDocumentToLayout
11
- } from "../chunk-C2NV4VHU.mjs";
11
+ } from "../chunk-YSH3KLUU.mjs";
12
12
  import "../chunk-SIL2J5MF.mjs";
13
- import "../chunk-ADIIWIYL.mjs";
14
13
  import "../chunk-6BWS3CLP.mjs";
15
14
  export {
16
15
  createDefaultStudioDocument,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-studios/payload-studio",
3
- "version": "0.5.0-beta.76",
3
+ "version": "0.5.0-beta.77",
4
4
  "description": "Unified Payload CMS toolkit for Orion Studios",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",