@orion-studios/payload-studio 0.6.0-beta.185 → 0.6.0-beta.186

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.
Files changed (40) hide show
  1. package/README.md +6 -1
  2. package/bin/init.js +329 -0
  3. package/dist/admin/index.d.mts +1 -1
  4. package/dist/admin/index.d.ts +1 -1
  5. package/dist/admin/index.js +61 -20
  6. package/dist/admin/index.mjs +1 -1
  7. package/dist/blocks/index.mjs +1 -2
  8. package/dist/{chunk-NGLIA2OE.mjs → chunk-DTHBPJXU.mjs} +193 -23
  9. package/dist/{chunk-JQAHXYAM.mjs → chunk-KMYMSR7W.mjs} +163 -3
  10. package/dist/{chunk-KHK6RTGC.mjs → chunk-MMJNHBOF.mjs} +61 -20
  11. package/dist/{chunk-ZADL33R6.mjs → chunk-OF6BATTO.mjs} +56 -111
  12. package/dist/chunk-VA545CHJ.mjs +202 -0
  13. package/dist/forms/index.d.mts +25 -0
  14. package/dist/forms/index.d.ts +25 -0
  15. package/dist/forms/index.js +237 -0
  16. package/dist/forms/index.mjs +25 -0
  17. package/dist/forms/server.d.mts +35 -0
  18. package/dist/forms/server.d.ts +35 -0
  19. package/dist/forms/server.js +442 -0
  20. package/dist/forms/server.mjs +228 -0
  21. package/dist/{index-Dv-Alx4h.d.ts → index-0xXWuOuz.d.ts} +35 -5
  22. package/dist/{index-D5zrOdyv.d.mts → index-BU82akSL.d.mts} +35 -5
  23. package/dist/{index-DLfPOqYA.d.mts → index-BbTcimgH.d.mts} +1 -0
  24. package/dist/{index-D8BNfUJb.d.mts → index-Cen-9wcc.d.mts} +17 -5
  25. package/dist/{index-BV0vEGl6.d.ts → index-DV-nW43e.d.ts} +1 -0
  26. package/dist/{index-DD_E2UfJ.d.ts → index-gxcMPpm-.d.ts} +17 -5
  27. package/dist/index.d.mts +3 -3
  28. package/dist/index.d.ts +3 -3
  29. package/dist/index.js +302 -151
  30. package/dist/index.mjs +11 -12
  31. package/dist/nextjs/index.d.mts +1 -1
  32. package/dist/nextjs/index.d.ts +1 -1
  33. package/dist/nextjs/index.js +56 -111
  34. package/dist/nextjs/index.mjs +1 -1
  35. package/dist/studio-pages/index.d.mts +1 -1
  36. package/dist/studio-pages/index.d.ts +1 -1
  37. package/dist/studio-pages/index.js +1802 -20
  38. package/dist/studio-pages/index.mjs +10 -2
  39. package/package.json +18 -2
  40. package/dist/chunk-OQSEJXC4.mjs +0 -166
@@ -1,3 +1,3 @@
1
- export { F as FooterData, H as HeaderData, R as ResolvedSocialMediaLink, S as SiteNavItem, a as SiteSettingsData, W as WEBSITE_CONTENT_TAG, c as createPageQueries, b as createPayloadClient, d as createSiteQueries, r as resolveMedia, e as resolveSocialMediaLinks } from '../index-D8BNfUJb.mjs';
1
+ export { F as FooterData, H as HeaderData, R as ResolvedSocialMediaLink, S as SiteNavItem, a as SiteSettingsData, W as WEBSITE_CONTENT_TAG, c as createPageQueries, b as createPayloadClient, d as createSiteQueries, r as resolveMedia, e as resolveSocialMediaLinks } from '../index-Cen-9wcc.mjs';
2
2
  export { S as SocialMediaGlobalData } from '../socialMedia-C05Iy-SV.mjs';
3
3
  import 'payload';
@@ -1,3 +1,3 @@
1
- export { F as FooterData, H as HeaderData, R as ResolvedSocialMediaLink, S as SiteNavItem, a as SiteSettingsData, W as WEBSITE_CONTENT_TAG, c as createPageQueries, b as createPayloadClient, d as createSiteQueries, r as resolveMedia, e as resolveSocialMediaLinks } from '../index-DD_E2UfJ.js';
1
+ export { F as FooterData, H as HeaderData, R as ResolvedSocialMediaLink, S as SiteNavItem, a as SiteSettingsData, W as WEBSITE_CONTENT_TAG, c as createPageQueries, b as createPayloadClient, d as createSiteQueries, r as resolveMedia, e as resolveSocialMediaLinks } from '../index-gxcMPpm-.js';
2
2
  export { S as SocialMediaGlobalData } from '../socialMedia-C05Iy-SV.js';
3
3
  import 'payload';
@@ -31,12 +31,15 @@ module.exports = __toCommonJS(nextjs_exports);
31
31
 
32
32
  // src/nextjs/client/payload.ts
33
33
  var import_payload = require("payload");
34
- var payloadPromise = null;
35
34
  var WEBSITE_CONTENT_TAG = "website-content";
36
35
  function createPayloadClient(config) {
36
+ let payloadPromise = null;
37
37
  return function getPayloadClient() {
38
38
  if (!payloadPromise) {
39
- payloadPromise = (0, import_payload.getPayload)({ config });
39
+ payloadPromise = Promise.resolve(config).then((resolvedConfig) => (0, import_payload.getPayload)({ config: resolvedConfig })).catch((error) => {
40
+ payloadPromise = null;
41
+ throw error;
42
+ });
40
43
  }
41
44
  return payloadPromise;
42
45
  };
@@ -414,7 +417,7 @@ function normalizePath(segments) {
414
417
  const cleaned = segments.map((segment) => segment.trim()).filter(Boolean).join("/");
415
418
  return cleaned.length > 0 ? `/${cleaned}` : "/";
416
419
  }
417
- async function queryPageByPath(payload, path, draft) {
420
+ async function queryPageByPath(payload, path, draft, collectionSlug, homeSlug) {
418
421
  const pathWhere = {
419
422
  path: {
420
423
  equals: path
@@ -426,7 +429,7 @@ async function queryPageByPath(payload, path, draft) {
426
429
  }
427
430
  };
428
431
  const result = await payload.find({
429
- collection: "pages",
432
+ collection: collectionSlug,
430
433
  depth: 2,
431
434
  draft,
432
435
  limit: 1,
@@ -439,11 +442,11 @@ async function queryPageByPath(payload, path, draft) {
439
442
  if (path === "/") {
440
443
  const homeWhere = {
441
444
  slug: {
442
- equals: "home"
445
+ equals: homeSlug
443
446
  }
444
447
  };
445
448
  const homeResult = await payload.find({
446
- collection: "pages",
449
+ collection: collectionSlug,
447
450
  depth: 2,
448
451
  draft,
449
452
  limit: 1,
@@ -454,27 +457,31 @@ async function queryPageByPath(payload, path, draft) {
454
457
  }
455
458
  return null;
456
459
  }
457
- function createPageQueries(getPayloadClient, contentTag = "website-content") {
460
+ function createPageQueries(getPayloadClient, contentTagOrOptions = "website-content") {
461
+ const options = typeof contentTagOrOptions === "string" ? { contentTag: contentTagOrOptions } : contentTagOrOptions;
462
+ const contentTag = options.contentTag || "website-content";
463
+ const pagesCollectionSlug = options.pagesCollectionSlug || "pages";
464
+ const homeSlug = options.homeSlug || "home";
458
465
  const getPublishedPageByPathCached = (0, import_cache.unstable_cache)(
459
466
  async (path) => {
460
467
  const payload = await getPayloadClient();
461
- return queryPageByPath(payload, path, false);
468
+ return queryPageByPath(payload, path, false, pagesCollectionSlug, homeSlug);
462
469
  },
463
- ["page-by-path", PAGE_QUERY_CACHE_VERSION],
470
+ ["page-by-path", PAGE_QUERY_CACHE_VERSION, pagesCollectionSlug, homeSlug, contentTag],
464
471
  { tags: [contentTag] }
465
472
  );
466
473
  async function getPageBySegments(segments, draft = false) {
467
474
  const path = normalizePath(segments);
468
475
  const payload = await getPayloadClient();
469
476
  if (draft) {
470
- return queryPageByPath(payload, path, true);
477
+ return queryPageByPath(payload, path, true, pagesCollectionSlug, homeSlug);
471
478
  }
472
479
  return getPublishedPageByPathCached(path);
473
480
  }
474
481
  async function listPublishedPagePaths() {
475
482
  const payload = await getPayloadClient();
476
483
  const pages = await payload.find({
477
- collection: "pages",
484
+ collection: pagesCollectionSlug,
478
485
  depth: 0,
479
486
  draft: false,
480
487
  limit: 1e3,
@@ -503,108 +510,46 @@ function createPageQueries(getPayloadClient, contentTag = "website-content") {
503
510
 
504
511
  // src/nextjs/queries/site.ts
505
512
  var import_cache2 = require("next/cache");
506
- function createSiteQueries(getPayloadClient, contentTag = "website-content") {
507
- const getSiteSettingsCached = (0, import_cache2.unstable_cache)(
508
- async () => {
509
- const payload = await getPayloadClient();
510
- const settings = await payload.findGlobal({
511
- slug: "site-settings",
512
- depth: 1
513
- });
514
- return settings;
515
- },
516
- ["site-settings-global"],
517
- { tags: [contentTag] }
518
- );
519
- const getHeaderCached = (0, import_cache2.unstable_cache)(
520
- async () => {
521
- const payload = await getPayloadClient();
522
- const header = await payload.findGlobal({
523
- slug: "header",
524
- depth: 1
525
- });
526
- return header;
527
- },
528
- ["header-global"],
529
- { tags: [contentTag] }
530
- );
531
- const getFooterCached = (0, import_cache2.unstable_cache)(
532
- async () => {
533
- const payload = await getPayloadClient();
534
- const footer = await payload.findGlobal({
535
- slug: "footer",
536
- depth: 1
537
- });
538
- return footer;
539
- },
540
- ["footer-global"],
541
- { tags: [contentTag] }
542
- );
543
- const getSocialMediaCached = (0, import_cache2.unstable_cache)(
544
- async () => {
545
- const payload = await getPayloadClient();
546
- const socialMedia = await payload.findGlobal({
547
- slug: "social-media",
548
- depth: 1
549
- });
550
- return socialMedia;
551
- },
552
- ["social-media-global"],
553
- { tags: [contentTag] }
554
- );
555
- async function getSiteSettings(draft = false) {
556
- if (draft) {
557
- const payload = await getPayloadClient();
558
- const settings = await payload.findGlobal({
559
- slug: "site-settings",
560
- depth: 1,
561
- draft: true
562
- });
563
- return settings;
564
- }
565
- return getSiteSettingsCached();
566
- }
567
- async function getHeader(draft = false) {
568
- if (draft) {
569
- const payload = await getPayloadClient();
570
- const header = await payload.findGlobal({
571
- slug: "header",
572
- depth: 1,
573
- draft: true
574
- });
575
- return header;
576
- }
577
- return getHeaderCached();
578
- }
579
- async function getFooter(draft = false) {
580
- if (draft) {
581
- const payload = await getPayloadClient();
582
- const footer = await payload.findGlobal({
583
- slug: "footer",
584
- depth: 1,
585
- draft: true
586
- });
587
- return footer;
588
- }
589
- return getFooterCached();
590
- }
591
- async function getSocialMedia(draft = false) {
592
- if (draft) {
593
- const payload = await getPayloadClient();
594
- const socialMedia = await payload.findGlobal({
595
- slug: "social-media",
596
- depth: 1,
597
- draft: true
598
- });
599
- return socialMedia;
600
- }
601
- return getSocialMediaCached();
513
+ function createSiteQueries(getPayloadClient, contentTagOrOptions = "website-content") {
514
+ const options = typeof contentTagOrOptions === "string" ? { contentTag: contentTagOrOptions } : contentTagOrOptions;
515
+ const contentTag = options.contentTag || "website-content";
516
+ const siteSettingsSlug = options.siteSettingsSlug || "site-settings";
517
+ const headerSlug = options.headerSlug || "header";
518
+ const footerSlug = options.footerSlug || "footer";
519
+ const socialMediaSlug = options.socialMediaSlug || "social-media";
520
+ function createGlobalQuery(slug, cacheKey) {
521
+ const getCached = (0, import_cache2.unstable_cache)(
522
+ async () => {
523
+ const payload = await getPayloadClient();
524
+ const data = await payload.findGlobal({
525
+ slug,
526
+ depth: 1,
527
+ overrideAccess: false
528
+ });
529
+ return data;
530
+ },
531
+ [cacheKey, slug, contentTag],
532
+ { tags: [contentTag] }
533
+ );
534
+ return async function getGlobal(draft = false) {
535
+ if (draft) {
536
+ const payload = await getPayloadClient();
537
+ const data = await payload.findGlobal({
538
+ slug,
539
+ depth: 1,
540
+ draft: true,
541
+ overrideAccess: false
542
+ });
543
+ return data;
544
+ }
545
+ return getCached();
546
+ };
602
547
  }
603
548
  return {
604
- getSiteSettings,
605
- getHeader,
606
- getFooter,
607
- getSocialMedia
549
+ getSiteSettings: createGlobalQuery(siteSettingsSlug, "site-settings-global"),
550
+ getHeader: createGlobalQuery(headerSlug, "header-global"),
551
+ getFooter: createGlobalQuery(footerSlug, "footer-global"),
552
+ getSocialMedia: createGlobalQuery(socialMediaSlug, "social-media-global")
608
553
  };
609
554
  }
610
555
 
@@ -5,7 +5,7 @@ import {
5
5
  createSiteQueries,
6
6
  resolveMedia,
7
7
  resolveSocialMediaLinks
8
- } from "../chunk-ZADL33R6.mjs";
8
+ } from "../chunk-OF6BATTO.mjs";
9
9
  import "../chunk-ZTXJG4K5.mjs";
10
10
  import "../chunk-7ZMXZRBP.mjs";
11
11
  import "../chunk-ADIIWIYL.mjs";
@@ -1,4 +1,4 @@
1
- export { B as BuilderBlock, a as BuilderBlockPreviewRenderArgs, b as BuilderBlockPreviewRenderer, c as BuilderBlockSettingsV2, d as BuilderInlineTextComponentProps, e as BuilderPreviewEditingHelpers, f as BuilderPreviewTextFieldOptions, g as BuilderRenderWithSectionShell, h as BuilderSettingsPanelMode, j as BuilderThemeTokenOverrides, k as BuilderThemeTokens, S as SectionPreset, l as createDefaultStudioDocument, m as createStudioPageService, n as defaultBuilderThemeTokens, o as getStudioDocumentFromPage, p as layoutToStudioDocument, q as pageInspectorPanels, r as pageNodeTypes, s as pagePaletteGroups, t as pageStudioModuleManifest, u as resolveBuilderThemeTokens, v as studioDocumentToLayout, w as toEditorInitialDoc } from '../index-D5zrOdyv.mjs';
1
+ export { B as BuilderBlock, a as BuilderBlockPreviewRenderArgs, b as BuilderBlockPreviewRenderer, c as BuilderBlockSettingsV2, d as BuilderInlineTextComponentProps, e as BuilderPreviewEditingHelpers, f as BuilderPreviewTextFieldOptions, g as BuilderRenderWithSectionShell, h as BuilderSettingsPanelMode, j as BuilderThemeTokenOverrides, k as BuilderThemeTokens, C as CreateStudioPageFieldsOptions, l as CreateStudioPagesCollectionOptions, D as DEFAULT_LEGACY_HERO_BACKGROUND_COLORS, S as SectionPreset, m as StudioRelationshipHydrationMap, n as StudioRelationshipHydrationRule, o as createDefaultStudioDocument, p as createStudioPageFields, q as createStudioPageService, r as createStudioPagesCollection, s as defaultBuilderThemeTokens, t as defaultRelationshipHydrationMap, u as getStudioDocumentFromPage, v as layoutToStudioDocument, w as pageInspectorPanels, x as pageNodeTypes, y as pagePaletteGroups, z as pageStudioModuleManifest, A as resolveBuilderThemeTokens, E as studioDocumentToLayout, F as toEditorInitialDoc } from '../index-BU82akSL.mjs';
2
2
  import '../index-DWmudwDm.mjs';
3
3
  import 'payload';
4
4
  import 'react';
@@ -1,4 +1,4 @@
1
- export { B as BuilderBlock, a as BuilderBlockPreviewRenderArgs, b as BuilderBlockPreviewRenderer, c as BuilderBlockSettingsV2, d as BuilderInlineTextComponentProps, e as BuilderPreviewEditingHelpers, f as BuilderPreviewTextFieldOptions, g as BuilderRenderWithSectionShell, h as BuilderSettingsPanelMode, j as BuilderThemeTokenOverrides, k as BuilderThemeTokens, S as SectionPreset, l as createDefaultStudioDocument, m as createStudioPageService, n as defaultBuilderThemeTokens, o as getStudioDocumentFromPage, p as layoutToStudioDocument, q as pageInspectorPanels, r as pageNodeTypes, s as pagePaletteGroups, t as pageStudioModuleManifest, u as resolveBuilderThemeTokens, v as studioDocumentToLayout, w as toEditorInitialDoc } from '../index-Dv-Alx4h.js';
1
+ export { B as BuilderBlock, a as BuilderBlockPreviewRenderArgs, b as BuilderBlockPreviewRenderer, c as BuilderBlockSettingsV2, d as BuilderInlineTextComponentProps, e as BuilderPreviewEditingHelpers, f as BuilderPreviewTextFieldOptions, g as BuilderRenderWithSectionShell, h as BuilderSettingsPanelMode, j as BuilderThemeTokenOverrides, k as BuilderThemeTokens, C as CreateStudioPageFieldsOptions, l as CreateStudioPagesCollectionOptions, D as DEFAULT_LEGACY_HERO_BACKGROUND_COLORS, S as SectionPreset, m as StudioRelationshipHydrationMap, n as StudioRelationshipHydrationRule, o as createDefaultStudioDocument, p as createStudioPageFields, q as createStudioPageService, r as createStudioPagesCollection, s as defaultBuilderThemeTokens, t as defaultRelationshipHydrationMap, u as getStudioDocumentFromPage, v as layoutToStudioDocument, w as pageInspectorPanels, x as pageNodeTypes, y as pagePaletteGroups, z as pageStudioModuleManifest, A as resolveBuilderThemeTokens, E as studioDocumentToLayout, F as toEditorInitialDoc } from '../index-0xXWuOuz.js';
2
2
  import '../index-DWmudwDm.js';
3
3
  import 'payload';
4
4
  import 'react';