@angeloashmore/prismic-cli-poc 0.0.0-pr.5.f8fb51a → 0.0.0-pr.7.1e5b475

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 (63) hide show
  1. package/dist/index.mjs +258 -451
  2. package/package.json +1 -1
  3. package/src/custom-type-add-field-boolean.ts +5 -12
  4. package/src/custom-type-add-field-color.ts +6 -12
  5. package/src/custom-type-add-field-date.ts +6 -12
  6. package/src/custom-type-add-field-embed.ts +6 -12
  7. package/src/custom-type-add-field-geo-point.ts +6 -12
  8. package/src/custom-type-add-field-image.ts +6 -12
  9. package/src/custom-type-add-field-key-text.ts +6 -12
  10. package/src/custom-type-add-field-link.ts +5 -12
  11. package/src/custom-type-add-field-number.ts +6 -12
  12. package/src/custom-type-add-field-rich-text.ts +5 -12
  13. package/src/custom-type-add-field-select.ts +5 -12
  14. package/src/custom-type-add-field-timestamp.ts +6 -12
  15. package/src/custom-type-add-field-uid.ts +6 -12
  16. package/src/custom-type-connect-slice.ts +6 -12
  17. package/src/custom-type-create.ts +6 -12
  18. package/src/custom-type-disconnect-slice.ts +6 -12
  19. package/src/custom-type-remove-field.ts +6 -12
  20. package/src/custom-type-remove.ts +6 -12
  21. package/src/custom-type-set-name.ts +6 -12
  22. package/src/index.ts +0 -5
  23. package/src/page-type-add-field-boolean.ts +5 -12
  24. package/src/page-type-add-field-color.ts +6 -12
  25. package/src/page-type-add-field-date.ts +6 -12
  26. package/src/page-type-add-field-embed.ts +6 -12
  27. package/src/page-type-add-field-geo-point.ts +6 -12
  28. package/src/page-type-add-field-image.ts +6 -12
  29. package/src/page-type-add-field-key-text.ts +6 -12
  30. package/src/page-type-add-field-link.ts +5 -12
  31. package/src/page-type-add-field-number.ts +6 -12
  32. package/src/page-type-add-field-rich-text.ts +5 -12
  33. package/src/page-type-add-field-select.ts +5 -12
  34. package/src/page-type-add-field-timestamp.ts +6 -12
  35. package/src/page-type-add-field-uid.ts +6 -12
  36. package/src/page-type-connect-slice.ts +6 -12
  37. package/src/page-type-create.ts +6 -12
  38. package/src/page-type-disconnect-slice.ts +6 -12
  39. package/src/page-type-remove-field.ts +6 -12
  40. package/src/page-type-remove.ts +6 -12
  41. package/src/page-type-set-name.ts +6 -12
  42. package/src/page-type-set-repeatable.ts +6 -12
  43. package/src/pull.ts +1 -6
  44. package/src/slice-add-field-boolean.ts +5 -12
  45. package/src/slice-add-field-color.ts +6 -12
  46. package/src/slice-add-field-date.ts +6 -12
  47. package/src/slice-add-field-embed.ts +6 -12
  48. package/src/slice-add-field-geo-point.ts +6 -12
  49. package/src/slice-add-field-image.ts +6 -12
  50. package/src/slice-add-field-key-text.ts +6 -12
  51. package/src/slice-add-field-link.ts +5 -12
  52. package/src/slice-add-field-number.ts +6 -12
  53. package/src/slice-add-field-rich-text.ts +5 -12
  54. package/src/slice-add-field-select.ts +5 -12
  55. package/src/slice-add-field-timestamp.ts +6 -12
  56. package/src/slice-add-variation.ts +6 -12
  57. package/src/slice-create.ts +6 -12
  58. package/src/slice-remove-field.ts +6 -12
  59. package/src/slice-remove-variation.ts +6 -12
  60. package/src/slice-remove.ts +6 -12
  61. package/src/slice-rename.ts +6 -12
  62. package/src/status.ts +12 -49
  63. package/src/docs.ts +0 -149
package/dist/index.mjs CHANGED
@@ -1,47 +1,47 @@
1
1
  #!/usr/bin/env node
2
- import{parseArgs as e}from"node:util";import{access as t,mkdir as n,readFile as r,readdir as i,rename as a,rm as o,writeFile as s}from"node:fs/promises";import*as c from"node:crypto";import{homedir as l}from"node:os";import{pathToFileURL as u}from"node:url";import{exec as d}from"node:child_process";import{createServer as f}from"node:http";var p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.prototype.hasOwnProperty,_=(e,t)=>()=>(e&&(t=e(e=0)),t),v=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),y=(e,t)=>{let n={};for(var r in e)p(n,r,{get:e[r],enumerable:!0});return t&&p(n,Symbol.toStringTag,{value:`Module`}),n},b=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=h(t),a=0,o=i.length,s;a<o;a++)s=i[a],!g.call(e,s)&&s!==n&&p(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=m(t,s))||r.enumerable});return e},x=e=>g.call(e,`module.exports`)?e[`module.exports`]:b(p({},`__esModule`,{value:!0}),e),ee=`0.0.0-pr.5.f8fb51a`,te=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),r=i([``,``],[``,``]);function i(e,t){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function(){function e(){var t=this,n=[...arguments];return a(this,e),this.tag=function(e){var n=[...arguments].slice(1);return typeof e==`function`?t.interimTag.bind(t,e):typeof e==`string`?t.transformEndResult(e):(e=e.map(t.transformString.bind(t)),t.transformEndResult(e.reduce(t.processSubstitutions.bind(t,n))))},n.length>0&&Array.isArray(n[0])&&(n=n[0]),this.transformers=n.map(function(e){return typeof e==`function`?e():e}),this.tag}return n(e,[{key:`interimTag`,value:function(e,t){var n=[...arguments].slice(2);return this.tag(r,e.apply(void 0,[t].concat(n)))}},{key:`processSubstitutions`,value:function(e,t,n){return`${t}${this.transformSubstitution(e.shift(),t)}${n}`}},{key:`transformString`,value:function(e){return this.transformers.reduce(function(e,t){return t.onString?t.onString(e):e},e)}},{key:`transformSubstitution`,value:function(e,t){return this.transformers.reduce(function(e,n){return n.onSubstitution?n.onSubstitution(e,t):e},e)}},{key:`transformEndResult`,value:function(e){return this.transformers.reduce(function(e,t){return t.onEndResult?t.onEndResult(e):e},e)}}]),e}(),t.exports=e.default})),S=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(te());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ne=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``;return{onEndResult:function(t){if(e===``)return t.trim();if(e=e.toLowerCase(),e===`start`||e===`left`)return t.replace(/^\s*/,``);if(e===`end`||e===`right`)return t.replace(/\s*$/,``);throw Error(`Side not supported: `+e)}}},t.exports=e.default})),C=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ne());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),re=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});function n(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}else return Array.from(e)}e.default=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`initial`;return{onEndResult:function(t){if(e===`initial`){var r=t.match(/^[^\S\n]*(?=\S)/gm),i=r&&Math.min.apply(Math,n(r.map(function(e){return e.length})));if(i){var a=RegExp(`^.{`+i+`}`,`gm`);return t.replace(a,``)}return t}if(e===`all`)return t.replace(/^[^\S\n]+/gm,``);throw Error(`Unknown type: `+e)}}},t.exports=e.default})),w=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(re());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),T=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e,t){return{onEndResult:function(n){if(e==null||t==null)throw Error(`replaceResultTransformer requires at least 2 arguments.`);return n.replace(e,t)}}},t.exports=e.default})),ie=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(T());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ae=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e,t){return{onSubstitution:function(n,r){if(e==null||t==null)throw Error(`replaceSubstitutionTransformer requires at least 2 arguments.`);return n==null?n:n.toString().replace(e,t)}}},t.exports=e.default})),oe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ae());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),se=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e,t){return{onString:function(n){if(e==null||t==null)throw Error(`replaceStringTransformer requires at least 2 arguments.`);return n.replace(e,t)}}},t.exports=e.default})),ce=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(se());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),le=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n={separator:``,conjunction:``,serial:!1};e.default=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:n;return{onSubstitution:function(t,n){if(Array.isArray(t)){var r=t.length,i=e.separator,a=e.conjunction,o=e.serial,s=n.match(/(\n?[^\S\n]+)$/);if(t=s?t.join(i+s[1]):t.join(i+` `),a&&r>1){var c=t.lastIndexOf(i);t=t.slice(0,c)+(o?i:``)+` `+a+t.slice(c+1)}}return t}}},t.exports=e.default})),E=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(le());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ue=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e){return{onSubstitution:function(t,n){if(e!=null&&typeof e==`string`)typeof t==`string`&&t.includes(e)&&(t=t.split(e));else throw Error(`You need to specify a string character to split by.`);return t}}},t.exports=e.default})),de=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ue());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),fe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=function(e){return e!=null&&!Number.isNaN(e)&&typeof e!=`boolean`};e.default=function(){return{onSubstitution:function(e){return Array.isArray(e)?e.filter(n):n(e)?e:``}}},t.exports=e.default})),pe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(fe());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),me=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(w()),i=o(E()),a=o(C());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)({separator:`,`}),r.default,a.default),t.exports=e.default})),he=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(me());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ge=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(w()),i=o(E()),a=o(C());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)({separator:`,`,conjunction:`and`}),r.default,a.default),t.exports=e.default})),_e=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ge());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ve=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(w()),i=o(E()),a=o(C());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)({separator:`,`,conjunction:`or`}),r.default,a.default),t.exports=e.default})),ye=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ve());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),be=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=c(S()),r=c(w()),i=c(E()),a=c(C()),o=c(de()),s=c(pe());function c(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,o.default)(`
3
- `),s.default,i.default,r.default,a.default),t.exports=e.default})),xe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(be());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Se=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(xe());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Ce=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(xe());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),we=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=c(S()),r=c(w()),i=c(E()),a=c(C()),o=c(de()),s=c(oe());function c(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,o.default)(`
4
- `),i.default,r.default,a.default,(0,s.default)(/&/g,`&amp;`),(0,s.default)(/</g,`&lt;`),(0,s.default)(/>/g,`&gt;`),(0,s.default)(/"/g,`&quot;`),(0,s.default)(/'/g,`&#x27;`),(0,s.default)(/`/g,`&#x60;`)),t.exports=e.default})),Te=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(we());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Ee=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=a(S()),r=a(C()),i=a(ie());function a(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)(/(?:\n(?:\s*))+/g,` `),r.default),t.exports=e.default})),De=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Ee());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Oe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=a(S()),r=a(C()),i=a(ie());function a(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)(/(?:\n\s*)/g,``),r.default),t.exports=e.default})),ke=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Oe());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Ae=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(E()),i=o(C()),a=o(ie());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,r.default)({separator:`,`}),(0,a.default)(/(?:\s+)/g,` `),i.default),t.exports=e.default})),je=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Ae());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Me=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(E()),i=o(C()),a=o(ie());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,r.default)({separator:`,`,conjunction:`or`}),(0,a.default)(/(?:\s+)/g,` `),i.default),t.exports=e.default})),Ne=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Me());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Pe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(E()),i=o(C()),a=o(ie());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,r.default)({separator:`,`,conjunction:`and`}),(0,a.default)(/(?:\s+)/g,` `),i.default),t.exports=e.default})),Fe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Pe());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Ie=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(w()),i=o(E()),a=o(C());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default(i.default,r.default,a.default),t.exports=e.default})),Le=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Ie());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Re=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(E()),i=o(C()),a=o(ie());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default(r.default,(0,a.default)(/(?:\s+)/g,` `),i.default),t.exports=e.default})),ze=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Re());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Be=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=a(S()),r=a(w()),i=a(C());function a(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default(r.default,i.default),t.exports=e.default})),Ve=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Be());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),He=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=a(S()),r=a(w()),i=a(C());function a(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,r.default)(`all`),i.default),t.exports=e.default})),Ue=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(He());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),D=v((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.stripIndents=e.stripIndent=e.oneLineInlineLists=e.inlineLists=e.oneLineCommaListsAnd=e.oneLineCommaListsOr=e.oneLineCommaLists=e.oneLineTrim=e.oneLine=e.safeHtml=e.source=e.codeBlock=e.html=e.commaListsOr=e.commaListsAnd=e.commaLists=e.removeNonPrintingValuesTransformer=e.splitStringTransformer=e.inlineArrayTransformer=e.replaceStringTransformer=e.replaceSubstitutionTransformer=e.replaceResultTransformer=e.stripIndentTransformer=e.trimResultTransformer=e.TemplateTag=void 0;var t=T(S()),n=T(C()),r=T(w()),i=T(ie()),a=T(oe()),o=T(ce()),s=T(E()),c=T(de()),l=T(pe()),u=T(he()),d=T(_e()),f=T(ye()),p=T(xe()),m=T(Se()),h=T(Ce()),g=T(Te()),_=T(De()),v=T(ke()),y=T(je()),b=T(Ne()),x=T(Fe()),ee=T(Le()),te=T(ze()),ne=T(Ve()),re=T(Ue());function T(e){return e&&e.__esModule?e:{default:e}}e.TemplateTag=t.default,e.trimResultTransformer=n.default,e.stripIndentTransformer=r.default,e.replaceResultTransformer=i.default,e.replaceSubstitutionTransformer=a.default,e.replaceStringTransformer=o.default,e.inlineArrayTransformer=s.default,e.splitStringTransformer=c.default,e.removeNonPrintingValuesTransformer=l.default,e.commaLists=u.default,e.commaListsAnd=d.default,e.commaListsOr=f.default,e.html=p.default,e.codeBlock=m.default,e.source=h.default,e.safeHtml=g.default,e.oneLine=_.default,e.oneLineTrim=v.default,e.oneLineCommaLists=y.default,e.oneLineCommaListsOr=b.default,e.oneLineCommaListsAnd=x.default,e.inlineLists=ee.default,e.oneLineInlineLists=te.default,e.stripIndent=ne.default,e.stripIndents=re.default}))(),We=class extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw TypeError("`maxSize` must be a number greater than 0");if(typeof e.maxAge==`number`&&e.maxAge===0)throw TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||1/0,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if(typeof this.onEviction==`function`)for(let[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return typeof t.expiry==`number`&&t.expiry<=Date.now()?(typeof this.onEviction==`function`&&this.onEviction(e,t.value),this.delete(e)):!1}_getOrDeleteIfExpired(e,t){if(this._deleteIfExpired(e,t)===!1)return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){let n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(let e of this.oldCache){let[t,n]=e;this.cache.has(t)||this._deleteIfExpired(t,n)===!1&&(yield e)}for(let e of this.cache){let[t,n]=e;this._deleteIfExpired(t,n)===!1&&(yield e)}}get(e){if(this.cache.has(e)){let t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){let t=this.oldCache.get(e);if(this._deleteIfExpired(e,t)===!1)return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){let r=typeof n==`number`&&n!==1/0?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:r}):this._set(e,{value:t,expiry:r}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):this.oldCache.has(e)?!this._deleteIfExpired(e,this.oldCache.get(e)):!1}peek(e){if(this.cache.has(e))return this._peek(e,this.cache);if(this.oldCache.has(e))return this._peek(e,this.oldCache)}delete(e){let t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw TypeError("`maxSize` must be a number greater than 0");let t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}*[Symbol.iterator](){for(let e of this.cache){let[t,n]=e;this._deleteIfExpired(t,n)===!1&&(yield[t,n.value])}for(let e of this.oldCache){let[t,n]=e;this.cache.has(t)||this._deleteIfExpired(t,n)===!1&&(yield[t,n.value])}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){let[n,r]=e[t];this._deleteIfExpired(n,r)===!1&&(yield[n,r.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){let[n,r]=e[t];this.cache.has(n)||this._deleteIfExpired(n,r)===!1&&(yield[n,r.value])}}*entriesAscending(){for(let[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(let t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(let[n,r]of this.entriesAscending())e.call(t,r,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}};function Ge(e,t){return(!e||e.endsWith(`
2
+ import{parseArgs as e}from"node:util";import{access as t,mkdir as n,readFile as r,readdir as i,rename as a,rm as o,writeFile as s}from"node:fs/promises";import*as c from"node:crypto";import{homedir as l}from"node:os";import{pathToFileURL as u}from"node:url";import{exec as d}from"node:child_process";import{createServer as f}from"node:http";var p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.prototype.hasOwnProperty,_=(e,t)=>()=>(e&&(t=e(e=0)),t),v=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),y=(e,t)=>{let n={};for(var r in e)p(n,r,{get:e[r],enumerable:!0});return t&&p(n,Symbol.toStringTag,{value:`Module`}),n},b=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=h(t),a=0,o=i.length,s;a<o;a++)s=i[a],!g.call(e,s)&&s!==n&&p(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=m(t,s))||r.enumerable});return e},x=e=>g.call(e,`module.exports`)?e[`module.exports`]:b(p({},`__esModule`,{value:!0}),e),ee=`0.0.0-pr.7.1e5b475`,te=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),r=i([``,``],[``,``]);function i(e,t){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function(){function e(){var t=this,n=[...arguments];return a(this,e),this.tag=function(e){var n=[...arguments].slice(1);return typeof e==`function`?t.interimTag.bind(t,e):typeof e==`string`?t.transformEndResult(e):(e=e.map(t.transformString.bind(t)),t.transformEndResult(e.reduce(t.processSubstitutions.bind(t,n))))},n.length>0&&Array.isArray(n[0])&&(n=n[0]),this.transformers=n.map(function(e){return typeof e==`function`?e():e}),this.tag}return n(e,[{key:`interimTag`,value:function(e,t){var n=[...arguments].slice(2);return this.tag(r,e.apply(void 0,[t].concat(n)))}},{key:`processSubstitutions`,value:function(e,t,n){return`${t}${this.transformSubstitution(e.shift(),t)}${n}`}},{key:`transformString`,value:function(e){return this.transformers.reduce(function(e,t){return t.onString?t.onString(e):e},e)}},{key:`transformSubstitution`,value:function(e,t){return this.transformers.reduce(function(e,n){return n.onSubstitution?n.onSubstitution(e,t):e},e)}},{key:`transformEndResult`,value:function(e){return this.transformers.reduce(function(e,t){return t.onEndResult?t.onEndResult(e):e},e)}}]),e}(),t.exports=e.default})),S=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(te());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ne=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``;return{onEndResult:function(t){if(e===``)return t.trim();if(e=e.toLowerCase(),e===`start`||e===`left`)return t.replace(/^\s*/,``);if(e===`end`||e===`right`)return t.replace(/\s*$/,``);throw Error(`Side not supported: `+e)}}},t.exports=e.default})),C=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ne());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),re=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});function n(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}else return Array.from(e)}e.default=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`initial`;return{onEndResult:function(t){if(e===`initial`){var r=t.match(/^[^\S\n]*(?=\S)/gm),i=r&&Math.min.apply(Math,n(r.map(function(e){return e.length})));if(i){var a=RegExp(`^.{`+i+`}`,`gm`);return t.replace(a,``)}return t}if(e===`all`)return t.replace(/^[^\S\n]+/gm,``);throw Error(`Unknown type: `+e)}}},t.exports=e.default})),ie=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(re());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),w=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e,t){return{onEndResult:function(n){if(e==null||t==null)throw Error(`replaceResultTransformer requires at least 2 arguments.`);return n.replace(e,t)}}},t.exports=e.default})),ae=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(w());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),oe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e,t){return{onSubstitution:function(n,r){if(e==null||t==null)throw Error(`replaceSubstitutionTransformer requires at least 2 arguments.`);return n==null?n:n.toString().replace(e,t)}}},t.exports=e.default})),se=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(oe());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ce=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e,t){return{onString:function(n){if(e==null||t==null)throw Error(`replaceStringTransformer requires at least 2 arguments.`);return n.replace(e,t)}}},t.exports=e.default})),le=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ce());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ue=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n={separator:``,conjunction:``,serial:!1};e.default=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:n;return{onSubstitution:function(t,n){if(Array.isArray(t)){var r=t.length,i=e.separator,a=e.conjunction,o=e.serial,s=n.match(/(\n?[^\S\n]+)$/);if(t=s?t.join(i+s[1]):t.join(i+` `),a&&r>1){var c=t.lastIndexOf(i);t=t.slice(0,c)+(o?i:``)+` `+a+t.slice(c+1)}}return t}}},t.exports=e.default})),T=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ue());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),de=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e){return{onSubstitution:function(t,n){if(e!=null&&typeof e==`string`)typeof t==`string`&&t.includes(e)&&(t=t.split(e));else throw Error(`You need to specify a string character to split by.`);return t}}},t.exports=e.default})),fe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(de());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),pe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=function(e){return e!=null&&!Number.isNaN(e)&&typeof e!=`boolean`};e.default=function(){return{onSubstitution:function(e){return Array.isArray(e)?e.filter(n):n(e)?e:``}}},t.exports=e.default})),me=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(pe());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),he=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(ie()),i=o(T()),a=o(C());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)({separator:`,`}),r.default,a.default),t.exports=e.default})),ge=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(he());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),_e=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(ie()),i=o(T()),a=o(C());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)({separator:`,`,conjunction:`and`}),r.default,a.default),t.exports=e.default})),ve=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(_e());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ye=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(ie()),i=o(T()),a=o(C());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)({separator:`,`,conjunction:`or`}),r.default,a.default),t.exports=e.default})),be=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ye());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),xe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=c(S()),r=c(ie()),i=c(T()),a=c(C()),o=c(fe()),s=c(me());function c(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,o.default)(`
3
+ `),s.default,i.default,r.default,a.default),t.exports=e.default})),Se=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(xe());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Ce=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Se());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),we=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Se());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Te=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=c(S()),r=c(ie()),i=c(T()),a=c(C()),o=c(fe()),s=c(se());function c(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,o.default)(`
4
+ `),i.default,r.default,a.default,(0,s.default)(/&/g,`&amp;`),(0,s.default)(/</g,`&lt;`),(0,s.default)(/>/g,`&gt;`),(0,s.default)(/"/g,`&quot;`),(0,s.default)(/'/g,`&#x27;`),(0,s.default)(/`/g,`&#x60;`)),t.exports=e.default})),Ee=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Te());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),De=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=a(S()),r=a(C()),i=a(ae());function a(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)(/(?:\n(?:\s*))+/g,` `),r.default),t.exports=e.default})),Oe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(De());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ke=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=a(S()),r=a(C()),i=a(ae());function a(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)(/(?:\n\s*)/g,``),r.default),t.exports=e.default})),Ae=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ke());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),je=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(T()),i=o(C()),a=o(ae());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,r.default)({separator:`,`}),(0,a.default)(/(?:\s+)/g,` `),i.default),t.exports=e.default})),Me=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(je());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Ne=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(T()),i=o(C()),a=o(ae());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,r.default)({separator:`,`,conjunction:`or`}),(0,a.default)(/(?:\s+)/g,` `),i.default),t.exports=e.default})),Pe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Ne());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Fe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(T()),i=o(C()),a=o(ae());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,r.default)({separator:`,`,conjunction:`and`}),(0,a.default)(/(?:\s+)/g,` `),i.default),t.exports=e.default})),Ie=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Fe());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Le=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(ie()),i=o(T()),a=o(C());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default(i.default,r.default,a.default),t.exports=e.default})),Re=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Le());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ze=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(T()),i=o(C()),a=o(ae());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default(r.default,(0,a.default)(/(?:\s+)/g,` `),i.default),t.exports=e.default})),Be=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ze());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Ve=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=a(S()),r=a(ie()),i=a(C());function a(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default(r.default,i.default),t.exports=e.default})),He=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Ve());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Ue=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=a(S()),r=a(ie()),i=a(C());function a(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,r.default)(`all`),i.default),t.exports=e.default})),We=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Ue());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),E=v((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.stripIndents=e.stripIndent=e.oneLineInlineLists=e.inlineLists=e.oneLineCommaListsAnd=e.oneLineCommaListsOr=e.oneLineCommaLists=e.oneLineTrim=e.oneLine=e.safeHtml=e.source=e.codeBlock=e.html=e.commaListsOr=e.commaListsAnd=e.commaLists=e.removeNonPrintingValuesTransformer=e.splitStringTransformer=e.inlineArrayTransformer=e.replaceStringTransformer=e.replaceSubstitutionTransformer=e.replaceResultTransformer=e.stripIndentTransformer=e.trimResultTransformer=e.TemplateTag=void 0;var t=w(S()),n=w(C()),r=w(ie()),i=w(ae()),a=w(se()),o=w(le()),s=w(T()),c=w(fe()),l=w(me()),u=w(ge()),d=w(ve()),f=w(be()),p=w(Se()),m=w(Ce()),h=w(we()),g=w(Ee()),_=w(Oe()),v=w(Ae()),y=w(Me()),b=w(Pe()),x=w(Ie()),ee=w(Re()),te=w(Be()),ne=w(He()),re=w(We());function w(e){return e&&e.__esModule?e:{default:e}}e.TemplateTag=t.default,e.trimResultTransformer=n.default,e.stripIndentTransformer=r.default,e.replaceResultTransformer=i.default,e.replaceSubstitutionTransformer=a.default,e.replaceStringTransformer=o.default,e.inlineArrayTransformer=s.default,e.splitStringTransformer=c.default,e.removeNonPrintingValuesTransformer=l.default,e.commaLists=u.default,e.commaListsAnd=d.default,e.commaListsOr=f.default,e.html=p.default,e.codeBlock=m.default,e.source=h.default,e.safeHtml=g.default,e.oneLine=_.default,e.oneLineTrim=v.default,e.oneLineCommaLists=y.default,e.oneLineCommaListsOr=b.default,e.oneLineCommaListsAnd=x.default,e.inlineLists=ee.default,e.oneLineInlineLists=te.default,e.stripIndent=ne.default,e.stripIndents=re.default}))(),Ge=class extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw TypeError("`maxSize` must be a number greater than 0");if(typeof e.maxAge==`number`&&e.maxAge===0)throw TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||1/0,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if(typeof this.onEviction==`function`)for(let[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return typeof t.expiry==`number`&&t.expiry<=Date.now()?(typeof this.onEviction==`function`&&this.onEviction(e,t.value),this.delete(e)):!1}_getOrDeleteIfExpired(e,t){if(this._deleteIfExpired(e,t)===!1)return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){let n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(let e of this.oldCache){let[t,n]=e;this.cache.has(t)||this._deleteIfExpired(t,n)===!1&&(yield e)}for(let e of this.cache){let[t,n]=e;this._deleteIfExpired(t,n)===!1&&(yield e)}}get(e){if(this.cache.has(e)){let t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){let t=this.oldCache.get(e);if(this._deleteIfExpired(e,t)===!1)return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){let r=typeof n==`number`&&n!==1/0?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:r}):this._set(e,{value:t,expiry:r}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):this.oldCache.has(e)?!this._deleteIfExpired(e,this.oldCache.get(e)):!1}peek(e){if(this.cache.has(e))return this._peek(e,this.cache);if(this.oldCache.has(e))return this._peek(e,this.oldCache)}delete(e){let t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw TypeError("`maxSize` must be a number greater than 0");let t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}*[Symbol.iterator](){for(let e of this.cache){let[t,n]=e;this._deleteIfExpired(t,n)===!1&&(yield[t,n.value])}for(let e of this.oldCache){let[t,n]=e;this.cache.has(t)||this._deleteIfExpired(t,n)===!1&&(yield[t,n.value])}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){let[n,r]=e[t];this._deleteIfExpired(n,r)===!1&&(yield[n,r.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){let[n,r]=e[t];this.cache.has(n)||this._deleteIfExpired(n,r)===!1&&(yield[n,r.value])}}*entriesAscending(){for(let[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(let t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(let[n,r]of this.entriesAscending())e.call(t,r,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}};function Ke(e,t){return(!e||e.endsWith(`
5
5
  `))&&!t?.force?e:e+`
6
- `}function O(e,t){return Ge(t)+e}function Ke(e,t){return(!e||e.endsWith(`
6
+ `}function D(e,t){return Ke(t)+e}function qe(e,t){return(!e||e.endsWith(`
7
7
 
8
- `))&&!t?.force?e:Ge(e)+`
9
- `}function k(e,t){return Ke(t)+e}const qe=`https://prismic.io/docs/slices`,Je={UID:`https://prismic.io/docs/fields/uid`,Boolean:`https://prismic.io/docs/fields/boolean`,Color:`https://prismic.io/docs/fields/color`,Date:`https://prismic.io/docs/fields/date`,Timestamp:`https://prismic.io/docs/fields/timestamp`,Number:`https://prismic.io/docs/fields/number`,Text:`https://prismic.io/docs/fields/text`,Select:`https://prismic.io/docs/fields/select`,StructuredText:`https://prismic.io/docs/fields/rich-text`,Image:`https://prismic.io/docs/fields/image`,Link:{contentRelationship:`https://prismic.io/docs/fields/content-relationship`,link:`https://prismic.io/docs/fields/link`,linkToMedia:`https://prismic.io/docs/fields/link-to-media`},Embed:`https://prismic.io/docs/fields/embed`,GeoPoint:`https://prismic.io/docs/fields/geopoint`,Table:`https://prismic.io/docs/fields/table`,Group:`https://prismic.io/docs/fields/repeatable-group`,IntegrationFields:`https://prismic.io/docs/fields/integration`,Slices:`https://prismic.io/docs/slices`,Choice:`https://prismic.io/docs/slices`};var Ye=y({__addDisposableResource:()=>Ct,__assign:()=>Dt,__asyncDelegator:()=>ht,__asyncGenerator:()=>mt,__asyncValues:()=>gt,__await:()=>pt,__awaiter:()=>at,__classPrivateFieldGet:()=>bt,__classPrivateFieldIn:()=>St,__classPrivateFieldSet:()=>xt,__createBinding:()=>Ot,__decorate:()=>Qe,__disposeResources:()=>wt,__esDecorate:()=>et,__exportStar:()=>st,__extends:()=>Xe,__generator:()=>ot,__importDefault:()=>yt,__importStar:()=>vt,__makeTemplateObject:()=>_t,__metadata:()=>it,__param:()=>$e,__propKey:()=>nt,__read:()=>lt,__rest:()=>Ze,__rewriteRelativeImportExtension:()=>Tt,__runInitializers:()=>tt,__setFunctionName:()=>rt,__spread:()=>ut,__spreadArray:()=>ft,__spreadArrays:()=>dt,__values:()=>ct,default:()=>Mt});function Xe(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);Et(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function Ze(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Qe(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function $e(e,t){return function(n,r){t(n,r,e)}}function et(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else (d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0}function tt(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0}function nt(e){return typeof e==`symbol`?e:`${e}`}function rt(e,t,n){return typeof t==`symbol`&&(t=t.description?`[${t.description}]`:``),Object.defineProperty(e,`name`,{configurable:!0,value:n?`${n} ${t}`:t})}function it(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function at(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function ot(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function st(e,t){for(var n in e)n!==`default`&&!Object.prototype.hasOwnProperty.call(t,n)&&Ot(t,e,n)}function ct(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function lt(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function ut(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(lt(arguments[t]));return e}function dt(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function ft(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function pt(e){return this instanceof pt?(this.v=e,this):new pt(e)}function mt(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof pt?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function ht(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:pt(e[r](t)),done:!1}:i?i(t):t}:i}}function gt(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof ct==`function`?ct(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function _t(e,t){return Object.defineProperty?Object.defineProperty(e,`raw`,{value:t}):e.raw=t,e}function vt(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=At(e),r=0;r<n.length;r++)n[r]!==`default`&&Ot(t,e,n[r]);return kt(t,e),t}function yt(e){return e&&e.__esModule?e:{default:e}}function bt(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function xt(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function St(e,t){if(t===null||typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Cannot use 'in' operator on non-object`);return typeof e==`function`?t===e:e.has(t)}function Ct(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}function wt(e){function t(t){e.error=e.hasError?new jt(t,e.error,`An error was suppressed during disposal.`):t,e.hasError=!0}var n,r=0;function i(){for(;n=e.stack.pop();)try{if(!n.async&&r===1)return r=0,e.stack.push(n),Promise.resolve().then(i);if(n.dispose){var a=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(a).then(i,function(e){return t(e),i()})}else r|=1}catch(e){t(e)}if(r===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return i()}function Tt(e,t){return typeof e==`string`&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,n,r,i,a){return n?t?`.jsx`:`.js`:r&&(!i||!a)?e:r+i+`.`+a.toLowerCase()+`js`}):e}var Et,Dt,Ot,kt,At,jt,Mt,Nt=_((()=>{Et=function(e,t){return Et=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Et(e,t)},Dt=function(){return Dt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Dt.apply(this,arguments)},Ot=Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),kt=Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t},At=function(e){return At=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},At(e)},jt=typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r},Mt={__extends:Xe,__assign:Dt,__rest:Ze,__decorate:Qe,__param:$e,__esDecorate:et,__runInitializers:tt,__propKey:nt,__setFunctionName:rt,__metadata:it,__awaiter:at,__generator:ot,__createBinding:Ot,__exportStar:st,__values:ct,__read:lt,__spread:ut,__spreadArrays:dt,__spreadArray:ft,__await:pt,__asyncGenerator:mt,__asyncDelegator:ht,__asyncValues:gt,__makeTemplateObject:_t,__importStar:vt,__importDefault:yt,__classPrivateFieldGet:bt,__classPrivateFieldSet:xt,__classPrivateFieldIn:St,__addDisposableResource:Ct,__disposeResources:wt,__rewriteRelativeImportExtension:Tt}})),Pt=v((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.lowerCase=e.localeLowerCase=void 0;var t={tr:{regexp:/\u0130|\u0049|\u0049\u0307/g,map:{İ:`i`,I:`ı`,İ:`i`}},az:{regexp:/\u0130/g,map:{İ:`i`,I:`ı`,İ:`i`}},lt:{regexp:/\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,map:{I:`i̇`,J:`j̇`,Į:`į̇`,Ì:`i̇̀`,Í:`i̇́`,Ĩ:`i̇̃`}}};function n(e,n){var i=t[n.toLowerCase()];return r(i?e.replace(i.regexp,function(e){return i.map[e]}):e)}e.localeLowerCase=n;function r(e){return e.toLowerCase()}e.lowerCase=r})),Ft=v((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.noCase=void 0;var t=Pt(),n=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],r=/[^A-Z0-9]+/gi;function i(e,i){i===void 0&&(i={});for(var o=i.splitRegexp,s=o===void 0?n:o,c=i.stripRegexp,l=c===void 0?r:c,u=i.transform,d=u===void 0?t.lowerCase:u,f=i.delimiter,p=f===void 0?` `:f,m=a(a(e,s,`$1\0$2`),l,`\0`),h=0,g=m.length;m.charAt(h)===`\0`;)h++;for(;m.charAt(g-1)===`\0`;)g--;return m.slice(h,g).split(`\0`).map(d).join(p)}e.noCase=i;function a(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce(function(e,t){return e.replace(t,n)},e)}})),It=v((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.pascalCase=e.pascalCaseTransformMerge=e.pascalCaseTransform=void 0;var t=(Nt(),x(Ye)),n=Ft();function r(e,t){var n=e.charAt(0),r=e.substr(1).toLowerCase();return t>0&&n>=`0`&&n<=`9`?`_`+n+r:``+n.toUpperCase()+r}e.pascalCaseTransform=r;function i(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}e.pascalCaseTransformMerge=i;function a(e,i){return i===void 0&&(i={}),n.noCase(e,t.__assign({delimiter:``,transform:r},i))}e.pascalCase=a}))();const A=(...e)=>{let t=(0,It.pascalCase)(e.filter(Boolean).join(` `),{transform:It.pascalCaseTransformMerge});return/^[0-9]/.test(t)&&(t=`_${t}`),t},Lt={Boolean:`Boolean`,Color:`Color`,Date:`Date`,Embed:`Embed`,GeoPoint:`GeoPoint`,Group:`Group`,Image:`Image`,Integration:`IntegrationFields`,Link:`Link`,Number:`Number`,Select:`Select`,Slices:`Slices`,StructuredText:`StructuredText`,Table:`Table`,Text:`Text`,Timestamp:`Timestamp`,UID:`UID`,IntegrationFields:`IntegrationFields`,Range:`Range`,Separator:`Separator`,LegacySlices:`Choice`};function Rt(e){let t=``;for(let n=0;n<e.path.length;n++){n>0&&(t+=`.`);let r=e.path[n];if(r.model&&`type`in r.model&&(r.model.type===`Group`||r.model.type===`Slices`))t+=`${r.name}[]`;else{if(r.name===`items`){let i=e.path[n-1];if(i.model&&`json`in i.model||i.model&&`type`in i.model&&i.model.type===`SharedSlice`){t+=`${r.name}[]`;continue}}t+=r.name}}return t}const zt=e=>{if(`json`in e.model)return e.model.label||e.model.id;if(`type`in e.model&&e.model.type===`SharedSlice`)return e.model.name;if(`type`in e.model&&e.model.type===`Slice`)return e.model.fieldset||e.name;if(`type`in e.model){if(e.model.config&&`label`in e.model.config)return e.model.config.label||e.name;if(e.model.config&&`fieldset`in e.model)return e.model.fieldset||e.name}return`\`${e.name}\``};function Bt(e){return e.path.map(e=>e.label?e.label:e.model?zt({model:e.model,name:e.name}):e.name).join(` → `)}function Vt(e){switch(e.field.type){case`StructuredText`:return`Rich Text`;case`IntegrationFields`:{let t=e.field.config?.catalog;return`Integration Fields (Catalog: ${t?`\`${t}\``:`*unknown*`})`}case`Link`:switch(e.field.config?.select){case`document`:return`Content Relationship`;case`media`:return`Link to Media`;default:return`Link`}case`Slices`:return`Slice Zone`;default:return e.field.type}}function Ht(e){switch(e.field.type){case`Link`:{let t=Je.Link;switch(e.field.config?.select){case`document`:return t.contentRelationship;case`media`:return t.linkToMedia;default:return t.link}}default:{let t=Je[e.field.type];if(typeof t==`string`)return t}}}function Ut(e){let t=`/**`,n=zt({model:e.field,name:e.name}),r=Bt({path:e.path}),i=Vt({field:e.field});t=O(` * ${n} field in *${r}*`,t),t=O(` *`,t),t=O(` * - **Field Type**: ${i}`,t),t=O(` * - **Placeholder**: ${e.field.config&&`placeholder`in e.field.config&&e.field.config.placeholder||`*None*`}`,t);let a=e.field.config&&`default_value`in e.field.config?e.field.config.default_value:void 0;a!==void 0&&(t=O(` * - **Default Value**: ${typeof a==`boolean`?`${a}`:a}`,t)),t=O(` * - **API ID Path**: ${Rt({path:[...e.path,{name:e.name,model:e.field}]})}`,t),e.tabName&&(t=O(` * - **Tab**: ${e.tabName}`,t));let o=Ht({field:e.field});return o&&(t=O(` * - **Documentation**: ${o}`,t)),t=O(` */`,t),t}function Wt(e){return e.filter(Boolean).join(` | `)||`never`}function Gt(e){let t=Ut({name:e.name,field:e.field,path:e.path,tabName:e.tabName}),n=[],r=[],i=e.name.includes(`-`)||e.name.includes(`:`)||/^[0-9]/.test(e.name)?`"${e.name}"`:e.name;switch(e.field.type){case`UID`:break;case`Boolean`:t=O(`${i}: prismic.BooleanField;`,t);break;case`Color`:t=O(`${i}: prismic.ColorField;`,t);break;case`Date`:t=O(`${i}: prismic.DateField;`,t);break;case`Embed`:{let n=[];if(e.fieldConfigs.embed?.providerTypes)for(let t in e.fieldConfigs.embed?.providerTypes){let r=e.fieldConfigs.embed?.providerTypes[t];n.push(`({ provider_name: "${t}" } & ${r})`)}let r=Wt(n);t=n.length>0?O(`${i}: prismic.EmbedField<prismic.AnyOEmbed & prismic.OEmbedExtra & (${r})>`,t):O(`${i}: prismic.EmbedField`,t);break}case`GeoPoint`:t=O(`${i}: prismic.GeoPointField;`,t);break;case`Image`:t=e.field.config?.thumbnails&&e.field.config.thumbnails.length>0?O(`${i}: prismic.ImageField<${Wt(e.field.config.thumbnails.map(e=>`"${e.name}"`))}>;`,t):O(`${i}: prismic.ImageField<never>;`,t);break;case`IntegrationFields`:{let n=e.field.config?.catalog?e.fieldConfigs.integrationFields?.catalogTypes?.[e.field.config.catalog]:void 0;t=O(n?`${i}: prismic.IntegrationField<${n}>;`:`${i}: prismic.IntegrationField;`,t);break}case`Link`:{let n=e.field.config&&`variants`in e.field.config&&Array.isArray(e.field.config.variants)&&e.field.config.variants.length>0?e.field.config.variants.map(e=>`"${e.replace(/\"/g,`\\"`)}"`).join(` | `):`never`;switch(e.field.config?.select){case`document`:t=`customtypes`in e.field.config&&e.field.config.customtypes&&e.field.config.customtypes.length>0?O(`${i}: ${Wt(e.field.config.customtypes.map(e=>typeof e==`string`?`prismic.ContentRelationshipField<"${e}">`:`ContentRelationshipFieldWithData<${JSON.stringify([e])}>`))};`,t):O(`${i}: prismic.ContentRelationshipField;`,t);break;case`media`:t=O(`${i}: prismic.LinkToMediaField<prismic.FieldState, ${n}>;`,t);break;default:{let r=`prismic.LinkField<string, string, unknown, prismic.FieldState, ${n}>`;e.field.config?.repeat&&(r=`prismic.Repeatable<${r}>`),t=O(`${i}: ${r};`,t);break}}break}case`Number`:t=O(`${i}: prismic.NumberField;`,t);break;case`StructuredText`:t=O(`${i}: prismic.RichTextField;`,t);break;case`Select`:{let n=(e.field.config?.options)?.map(e=>`"${e}"`)||[],r=n.length?Wt(n):`string`;t=e.field.config?.default_value?O(`${i}: prismic.SelectField<${r}, "filled">;`,t):O(`${i}: prismic.SelectField${n.length>0?`<${r}>`:``};`,t);break}case`Table`:t=O(`${i}: prismic.TableField;`,t);break;case`Text`:t=O(`${i}: prismic.KeyTextField;`,t);break;case`Timestamp`:t=O(`${i}: prismic.TimestampField;`,t);break;case`Group`:{let a=e.path.filter(e=>e.model!==void 0&&`type`in e.model&&e.model.type===Lt.Group),o=a.length>0,s;if(e.path[0].model&&`type`in e.path[0].model&&e.path[0].model.type===`SharedSlice`){let[t,n,r]=e.path;s=A(t.name,`Slice`,n.name,r.name,...a.map(e=>e.name),e.name,`Item`)}else s=A(e.path[0].name,`Document`,`Data`,...a.map(e=>e.name),e.name,`Item`);let c=[...e.path,{name:i,model:e.field}],l=Bt({path:c}),u=Kt({fields:e.field.config?.fields||{},fieldConfigs:e.fieldConfigs,path:c});n.push(...u.auxiliaryTypes),r.push(...u.contentTypeNames),n.push({name:s,code:D.source`
8
+ `))&&!t?.force?e:Ke(e)+`
9
+ `}function O(e,t){return qe(t)+e}const Je=`https://prismic.io/docs/slices`,Ye={UID:`https://prismic.io/docs/fields/uid`,Boolean:`https://prismic.io/docs/fields/boolean`,Color:`https://prismic.io/docs/fields/color`,Date:`https://prismic.io/docs/fields/date`,Timestamp:`https://prismic.io/docs/fields/timestamp`,Number:`https://prismic.io/docs/fields/number`,Text:`https://prismic.io/docs/fields/text`,Select:`https://prismic.io/docs/fields/select`,StructuredText:`https://prismic.io/docs/fields/rich-text`,Image:`https://prismic.io/docs/fields/image`,Link:{contentRelationship:`https://prismic.io/docs/fields/content-relationship`,link:`https://prismic.io/docs/fields/link`,linkToMedia:`https://prismic.io/docs/fields/link-to-media`},Embed:`https://prismic.io/docs/fields/embed`,GeoPoint:`https://prismic.io/docs/fields/geopoint`,Table:`https://prismic.io/docs/fields/table`,Group:`https://prismic.io/docs/fields/repeatable-group`,IntegrationFields:`https://prismic.io/docs/fields/integration`,Slices:`https://prismic.io/docs/slices`,Choice:`https://prismic.io/docs/slices`};var Xe=y({__addDisposableResource:()=>wt,__assign:()=>Ot,__asyncDelegator:()=>gt,__asyncGenerator:()=>ht,__asyncValues:()=>_t,__await:()=>mt,__awaiter:()=>ot,__classPrivateFieldGet:()=>xt,__classPrivateFieldIn:()=>Ct,__classPrivateFieldSet:()=>St,__createBinding:()=>kt,__decorate:()=>$e,__disposeResources:()=>Tt,__esDecorate:()=>tt,__exportStar:()=>ct,__extends:()=>Ze,__generator:()=>st,__importDefault:()=>bt,__importStar:()=>yt,__makeTemplateObject:()=>vt,__metadata:()=>at,__param:()=>et,__propKey:()=>rt,__read:()=>ut,__rest:()=>Qe,__rewriteRelativeImportExtension:()=>Et,__runInitializers:()=>nt,__setFunctionName:()=>it,__spread:()=>dt,__spreadArray:()=>pt,__spreadArrays:()=>ft,__values:()=>lt,default:()=>Nt});function Ze(e,t){if(typeof t!=`function`&&t!==null)throw TypeError(`Class extends value `+String(t)+` is not a constructor or null`);Dt(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function Qe(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function $e(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function et(e,t){return function(n,r){t(n,r,e)}}function tt(e,t,n,r,i,a){function o(e){if(e!==void 0&&typeof e!=`function`)throw TypeError(`Function expected`);return e}for(var s=r.kind,c=s===`getter`?`get`:s===`setter`?`set`:`value`,l=!t&&e?r.static?e:e.prototype:null,u=t||(l?Object.getOwnPropertyDescriptor(l,r.name):{}),d,f=!1,p=n.length-1;p>=0;p--){var m={};for(var h in r)m[h]=h===`access`?{}:r[h];for(var h in r.access)m.access[h]=r.access[h];m.addInitializer=function(e){if(f)throw TypeError(`Cannot add initializers after decoration has completed`);a.push(o(e||null))};var g=(0,n[p])(s===`accessor`?{get:u.get,set:u.set}:u[c],m);if(s===`accessor`){if(g===void 0)continue;if(typeof g!=`object`||!g)throw TypeError(`Object expected`);(d=o(g.get))&&(u.get=d),(d=o(g.set))&&(u.set=d),(d=o(g.init))&&i.unshift(d)}else (d=o(g))&&(s===`field`?i.unshift(d):u[c]=d)}l&&Object.defineProperty(l,r.name,u),f=!0}function nt(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0}function rt(e){return typeof e==`symbol`?e:`${e}`}function it(e,t,n){return typeof t==`symbol`&&(t=t.description?`[${t.description}]`:``),Object.defineProperty(e,`name`,{configurable:!0,value:n?`${n} ${t}`:t})}function at(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function ot(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function st(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o=Object.create((typeof Iterator==`function`?Iterator:Object).prototype);return o.next=s(0),o.throw=s(1),o.return=s(2),typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function ct(e,t){for(var n in e)n!==`default`&&!Object.prototype.hasOwnProperty.call(t,n)&&kt(t,e,n)}function lt(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function ut(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function dt(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ut(arguments[t]));return e}function ft(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function pt(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}function mt(e){return this instanceof mt?(this.v=e,this):new mt(e)}function ht(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i=Object.create((typeof AsyncIterator==`function`?AsyncIterator:Object).prototype),s(`next`),s(`throw`),s(`return`,o),i[Symbol.asyncIterator]=function(){return this},i;function o(e){return function(t){return Promise.resolve(t).then(e,d)}}function s(e,t){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||c(e,t)})},t&&(i[e]=t(i[e])))}function c(e,t){try{l(r[e](t))}catch(e){f(a[0][3],e)}}function l(e){e.value instanceof mt?Promise.resolve(e.value.v).then(u,d):f(a[0][2],e)}function u(e){c(`next`,e)}function d(e){c(`throw`,e)}function f(e,t){e(t),a.shift(),a.length&&c(a[0][0],a[0][1])}}function gt(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:mt(e[r](t)),done:!1}:i?i(t):t}:i}}function _t(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof lt==`function`?lt(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function vt(e,t){return Object.defineProperty?Object.defineProperty(e,`raw`,{value:t}):e.raw=t,e}function yt(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=jt(e),r=0;r<n.length;r++)n[r]!==`default`&&kt(t,e,n[r]);return At(t,e),t}function bt(e){return e&&e.__esModule?e:{default:e}}function xt(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function St(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function Ct(e,t){if(t===null||typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Cannot use 'in' operator on non-object`);return typeof e==`function`?t===e:e.has(t)}function wt(e,t,n){if(t!=null){if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Object expected.`);var r,i;if(n){if(!Symbol.asyncDispose)throw TypeError(`Symbol.asyncDispose is not defined.`);r=t[Symbol.asyncDispose]}if(r===void 0){if(!Symbol.dispose)throw TypeError(`Symbol.dispose is not defined.`);r=t[Symbol.dispose],n&&(i=r)}if(typeof r!=`function`)throw TypeError(`Object not disposable.`);i&&(r=function(){try{i.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:r,async:n})}else n&&e.stack.push({async:!0});return t}function Tt(e){function t(t){e.error=e.hasError?new Mt(t,e.error,`An error was suppressed during disposal.`):t,e.hasError=!0}var n,r=0;function i(){for(;n=e.stack.pop();)try{if(!n.async&&r===1)return r=0,e.stack.push(n),Promise.resolve().then(i);if(n.dispose){var a=n.dispose.call(n.value);if(n.async)return r|=2,Promise.resolve(a).then(i,function(e){return t(e),i()})}else r|=1}catch(e){t(e)}if(r===1)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}return i()}function Et(e,t){return typeof e==`string`&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,n,r,i,a){return n?t?`.jsx`:`.js`:r&&(!i||!a)?e:r+i+`.`+a.toLowerCase()+`js`}):e}var Dt,Ot,kt,At,jt,Mt,Nt,Pt=_((()=>{Dt=function(e,t){return Dt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},Dt(e,t)},Ot=function(){return Ot=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ot.apply(this,arguments)},kt=Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}),At=Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t},jt=function(e){return jt=Object.getOwnPropertyNames||function(e){var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[t.length]=n);return t},jt(e)},Mt=typeof SuppressedError==`function`?SuppressedError:function(e,t,n){var r=Error(n);return r.name=`SuppressedError`,r.error=e,r.suppressed=t,r},Nt={__extends:Ze,__assign:Ot,__rest:Qe,__decorate:$e,__param:et,__esDecorate:tt,__runInitializers:nt,__propKey:rt,__setFunctionName:it,__metadata:at,__awaiter:ot,__generator:st,__createBinding:kt,__exportStar:ct,__values:lt,__read:ut,__spread:dt,__spreadArrays:ft,__spreadArray:pt,__await:mt,__asyncGenerator:ht,__asyncDelegator:gt,__asyncValues:_t,__makeTemplateObject:vt,__importStar:yt,__importDefault:bt,__classPrivateFieldGet:xt,__classPrivateFieldSet:St,__classPrivateFieldIn:Ct,__addDisposableResource:wt,__disposeResources:Tt,__rewriteRelativeImportExtension:Et}})),Ft=v((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.lowerCase=e.localeLowerCase=void 0;var t={tr:{regexp:/\u0130|\u0049|\u0049\u0307/g,map:{İ:`i`,I:`ı`,İ:`i`}},az:{regexp:/\u0130/g,map:{İ:`i`,I:`ı`,İ:`i`}},lt:{regexp:/\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,map:{I:`i̇`,J:`j̇`,Į:`į̇`,Ì:`i̇̀`,Í:`i̇́`,Ĩ:`i̇̃`}}};function n(e,n){var i=t[n.toLowerCase()];return r(i?e.replace(i.regexp,function(e){return i.map[e]}):e)}e.localeLowerCase=n;function r(e){return e.toLowerCase()}e.lowerCase=r})),It=v((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.noCase=void 0;var t=Ft(),n=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],r=/[^A-Z0-9]+/gi;function i(e,i){i===void 0&&(i={});for(var o=i.splitRegexp,s=o===void 0?n:o,c=i.stripRegexp,l=c===void 0?r:c,u=i.transform,d=u===void 0?t.lowerCase:u,f=i.delimiter,p=f===void 0?` `:f,m=a(a(e,s,`$1\0$2`),l,`\0`),h=0,g=m.length;m.charAt(h)===`\0`;)h++;for(;m.charAt(g-1)===`\0`;)g--;return m.slice(h,g).split(`\0`).map(d).join(p)}e.noCase=i;function a(e,t,n){return t instanceof RegExp?e.replace(t,n):t.reduce(function(e,t){return e.replace(t,n)},e)}})),Lt=v((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.pascalCase=e.pascalCaseTransformMerge=e.pascalCaseTransform=void 0;var t=(Pt(),x(Xe)),n=It();function r(e,t){var n=e.charAt(0),r=e.substr(1).toLowerCase();return t>0&&n>=`0`&&n<=`9`?`_`+n+r:``+n.toUpperCase()+r}e.pascalCaseTransform=r;function i(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}e.pascalCaseTransformMerge=i;function a(e,i){return i===void 0&&(i={}),n.noCase(e,t.__assign({delimiter:``,transform:r},i))}e.pascalCase=a}))();const k=(...e)=>{let t=(0,Lt.pascalCase)(e.filter(Boolean).join(` `),{transform:Lt.pascalCaseTransformMerge});return/^[0-9]/.test(t)&&(t=`_${t}`),t},Rt={Boolean:`Boolean`,Color:`Color`,Date:`Date`,Embed:`Embed`,GeoPoint:`GeoPoint`,Group:`Group`,Image:`Image`,Integration:`IntegrationFields`,Link:`Link`,Number:`Number`,Select:`Select`,Slices:`Slices`,StructuredText:`StructuredText`,Table:`Table`,Text:`Text`,Timestamp:`Timestamp`,UID:`UID`,IntegrationFields:`IntegrationFields`,Range:`Range`,Separator:`Separator`,LegacySlices:`Choice`};function zt(e){let t=``;for(let n=0;n<e.path.length;n++){n>0&&(t+=`.`);let r=e.path[n];if(r.model&&`type`in r.model&&(r.model.type===`Group`||r.model.type===`Slices`))t+=`${r.name}[]`;else{if(r.name===`items`){let i=e.path[n-1];if(i.model&&`json`in i.model||i.model&&`type`in i.model&&i.model.type===`SharedSlice`){t+=`${r.name}[]`;continue}}t+=r.name}}return t}const Bt=e=>{if(`json`in e.model)return e.model.label||e.model.id;if(`type`in e.model&&e.model.type===`SharedSlice`)return e.model.name;if(`type`in e.model&&e.model.type===`Slice`)return e.model.fieldset||e.name;if(`type`in e.model){if(e.model.config&&`label`in e.model.config)return e.model.config.label||e.name;if(e.model.config&&`fieldset`in e.model)return e.model.fieldset||e.name}return`\`${e.name}\``};function Vt(e){return e.path.map(e=>e.label?e.label:e.model?Bt({model:e.model,name:e.name}):e.name).join(` → `)}function Ht(e){switch(e.field.type){case`StructuredText`:return`Rich Text`;case`IntegrationFields`:{let t=e.field.config?.catalog;return`Integration Fields (Catalog: ${t?`\`${t}\``:`*unknown*`})`}case`Link`:switch(e.field.config?.select){case`document`:return`Content Relationship`;case`media`:return`Link to Media`;default:return`Link`}case`Slices`:return`Slice Zone`;default:return e.field.type}}function Ut(e){switch(e.field.type){case`Link`:{let t=Ye.Link;switch(e.field.config?.select){case`document`:return t.contentRelationship;case`media`:return t.linkToMedia;default:return t.link}}default:{let t=Ye[e.field.type];if(typeof t==`string`)return t}}}function Wt(e){let t=`/**`,n=Bt({model:e.field,name:e.name}),r=Vt({path:e.path}),i=Ht({field:e.field});t=D(` * ${n} field in *${r}*`,t),t=D(` *`,t),t=D(` * - **Field Type**: ${i}`,t),t=D(` * - **Placeholder**: ${e.field.config&&`placeholder`in e.field.config&&e.field.config.placeholder||`*None*`}`,t);let a=e.field.config&&`default_value`in e.field.config?e.field.config.default_value:void 0;a!==void 0&&(t=D(` * - **Default Value**: ${typeof a==`boolean`?`${a}`:a}`,t)),t=D(` * - **API ID Path**: ${zt({path:[...e.path,{name:e.name,model:e.field}]})}`,t),e.tabName&&(t=D(` * - **Tab**: ${e.tabName}`,t));let o=Ut({field:e.field});return o&&(t=D(` * - **Documentation**: ${o}`,t)),t=D(` */`,t),t}function Gt(e){return e.filter(Boolean).join(` | `)||`never`}function Kt(e){let t=Wt({name:e.name,field:e.field,path:e.path,tabName:e.tabName}),n=[],r=[],i=e.name.includes(`-`)||e.name.includes(`:`)||/^[0-9]/.test(e.name)?`"${e.name}"`:e.name;switch(e.field.type){case`UID`:break;case`Boolean`:t=D(`${i}: prismic.BooleanField;`,t);break;case`Color`:t=D(`${i}: prismic.ColorField;`,t);break;case`Date`:t=D(`${i}: prismic.DateField;`,t);break;case`Embed`:{let n=[];if(e.fieldConfigs.embed?.providerTypes)for(let t in e.fieldConfigs.embed?.providerTypes){let r=e.fieldConfigs.embed?.providerTypes[t];n.push(`({ provider_name: "${t}" } & ${r})`)}let r=Gt(n);t=n.length>0?D(`${i}: prismic.EmbedField<prismic.AnyOEmbed & prismic.OEmbedExtra & (${r})>`,t):D(`${i}: prismic.EmbedField`,t);break}case`GeoPoint`:t=D(`${i}: prismic.GeoPointField;`,t);break;case`Image`:t=e.field.config?.thumbnails&&e.field.config.thumbnails.length>0?D(`${i}: prismic.ImageField<${Gt(e.field.config.thumbnails.map(e=>`"${e.name}"`))}>;`,t):D(`${i}: prismic.ImageField<never>;`,t);break;case`IntegrationFields`:{let n=e.field.config?.catalog?e.fieldConfigs.integrationFields?.catalogTypes?.[e.field.config.catalog]:void 0;t=D(n?`${i}: prismic.IntegrationField<${n}>;`:`${i}: prismic.IntegrationField;`,t);break}case`Link`:{let n=e.field.config&&`variants`in e.field.config&&Array.isArray(e.field.config.variants)&&e.field.config.variants.length>0?e.field.config.variants.map(e=>`"${e.replace(/\"/g,`\\"`)}"`).join(` | `):`never`;switch(e.field.config?.select){case`document`:t=`customtypes`in e.field.config&&e.field.config.customtypes&&e.field.config.customtypes.length>0?D(`${i}: ${Gt(e.field.config.customtypes.map(e=>typeof e==`string`?`prismic.ContentRelationshipField<"${e}">`:`ContentRelationshipFieldWithData<${JSON.stringify([e])}>`))};`,t):D(`${i}: prismic.ContentRelationshipField;`,t);break;case`media`:t=D(`${i}: prismic.LinkToMediaField<prismic.FieldState, ${n}>;`,t);break;default:{let r=`prismic.LinkField<string, string, unknown, prismic.FieldState, ${n}>`;e.field.config?.repeat&&(r=`prismic.Repeatable<${r}>`),t=D(`${i}: ${r};`,t);break}}break}case`Number`:t=D(`${i}: prismic.NumberField;`,t);break;case`StructuredText`:t=D(`${i}: prismic.RichTextField;`,t);break;case`Select`:{let n=(e.field.config?.options)?.map(e=>`"${e}"`)||[],r=n.length?Gt(n):`string`;t=e.field.config?.default_value?D(`${i}: prismic.SelectField<${r}, "filled">;`,t):D(`${i}: prismic.SelectField${n.length>0?`<${r}>`:``};`,t);break}case`Table`:t=D(`${i}: prismic.TableField;`,t);break;case`Text`:t=D(`${i}: prismic.KeyTextField;`,t);break;case`Timestamp`:t=D(`${i}: prismic.TimestampField;`,t);break;case`Group`:{let a=e.path.filter(e=>e.model!==void 0&&`type`in e.model&&e.model.type===Rt.Group),o=a.length>0,s;if(e.path[0].model&&`type`in e.path[0].model&&e.path[0].model.type===`SharedSlice`){let[t,n,r]=e.path;s=k(t.name,`Slice`,n.name,r.name,...a.map(e=>e.name),e.name,`Item`)}else s=k(e.path[0].name,`Document`,`Data`,...a.map(e=>e.name),e.name,`Item`);let c=[...e.path,{name:i,model:e.field}],l=Vt({path:c}),u=qt({fields:e.field.config?.fields||{},fieldConfigs:e.fieldConfigs,path:c});n.push(...u.auxiliaryTypes),r.push(...u.contentTypeNames),n.push({name:s,code:E.source`
10
10
  /**
11
11
  * Item in *${l}*
12
12
  */
13
13
  export interface ${s} {
14
14
  ${u.code}
15
15
  }
16
- `}),r.push(s),t=O(o?`${i}: prismic.NestedGroupField<Simplify<${s}>>;`:`${i}: prismic.GroupField<Simplify<${s}>>;`,t);break}case`Slices`:{let a=[];if(e.field.config?.choices)for(let t in e.field.config.choices){let i=e.field.config.choices[t];if(i.type===`SharedSlice`)a.push(A(t,`Slice`));else if(i.type===`Slice`){let o=A(e.path[0].name,`Document`,`Data`,e.name,t,`Slice`),s;if(i[`non-repeat`]&&Object.keys(i[`non-repeat`]).length>0){s=A(o,`Primary`);let a=[...e.path,{name:e.name,model:e.field},{name:t,model:i},{name:`primary`,label:`Primary`}],c=Bt({path:a}),l=Kt({fields:i[`non-repeat`],fieldConfigs:e.fieldConfigs,path:a});n.push(...l.auxiliaryTypes),r.push(...l.contentTypeNames);let u=D.stripIndent`
16
+ `}),r.push(s),t=D(o?`${i}: prismic.NestedGroupField<Simplify<${s}>>;`:`${i}: prismic.GroupField<Simplify<${s}>>;`,t);break}case`Slices`:{let a=[];if(e.field.config?.choices)for(let t in e.field.config.choices){let i=e.field.config.choices[t];if(i.type===`SharedSlice`)a.push(k(t,`Slice`));else if(i.type===`Slice`){let o=k(e.path[0].name,`Document`,`Data`,e.name,t,`Slice`),s;if(i[`non-repeat`]&&Object.keys(i[`non-repeat`]).length>0){s=k(o,`Primary`);let a=[...e.path,{name:e.name,model:e.field},{name:t,model:i},{name:`primary`,label:`Primary`}],c=Vt({path:a}),l=qt({fields:i[`non-repeat`],fieldConfigs:e.fieldConfigs,path:a});n.push(...l.auxiliaryTypes),r.push(...l.contentTypeNames);let u=E.stripIndent`
17
17
  /**
18
18
  * Primary content in *${c}*
19
19
  */
20
- `;u=l.code?O(D.source`
20
+ `;u=l.code?D(E.source`
21
21
  export interface ${s} {
22
22
  ${l.code}
23
23
  }
24
- `,u):O(`export interface ${s} {}`,u),n.push({name:s,code:u}),r.push(s)}let c;if(i.repeat&&Object.keys(i.repeat).length>0){c=A(o,`Item`);let a=[...e.path,{name:e.name,model:e.field},{name:t,model:i},{name:`items`,label:`Items`}],s=Bt({path:a}),l=Kt({fields:i.repeat,fieldConfigs:e.fieldConfigs,path:a});n.push(...l.auxiliaryTypes),r.push(...l.contentTypeNames);let u=D.stripIndent`
24
+ `,u):D(`export interface ${s} {}`,u),n.push({name:s,code:u}),r.push(s)}let c;if(i.repeat&&Object.keys(i.repeat).length>0){c=k(o,`Item`);let a=[...e.path,{name:e.name,model:e.field},{name:t,model:i},{name:`items`,label:`Items`}],s=Vt({path:a}),l=qt({fields:i.repeat,fieldConfigs:e.fieldConfigs,path:a});n.push(...l.auxiliaryTypes),r.push(...l.contentTypeNames);let u=E.stripIndent`
25
25
  /**
26
26
  * Item content in *${s}*
27
27
  */
28
- `;u=l.code?O(D.source`
28
+ `;u=l.code?D(E.source`
29
29
  export interface ${c} {
30
30
  ${l.code}
31
31
  }
32
- `,u):O(`export interface ${c} {}`,u),n.push({name:c,code:u}),r.push(c)}n.push({name:o,code:D.stripIndent`
32
+ `,u):D(`export interface ${c} {}`,u),n.push({name:c,code:u}),r.push(c)}n.push({name:o,code:E.stripIndent`
33
33
  /**
34
- * Slice for *${Bt({path:[...e.path,{name:e.name,model:e.field}]})}*
34
+ * Slice for *${Vt({path:[...e.path,{name:e.name,model:e.field}]})}*
35
35
  */
36
36
  export type ${o} = prismic.Slice<"${t}", ${s?`Simplify<${s}>`:`Record<string, never>`}, ${c?`Simplify<${c}>`:`never`}>
37
- `}),a.push(o)}}let o=A(e.path[0].name,`Document`,`Data`,e.name,`Slice`),s=Wt(a);n.push({name:o,code:`type ${o} = ${s}`}),r.push(o),t=O(`${i}: prismic.SliceZone<${o}>;`,t);break}default:t=O(`${i}: unknown;`,t)}return{code:t,auxiliaryTypes:n,contentTypeNames:r}}function Kt(e){let t=``,n=[],r=[];for(let i in e.fields){let a=e.fields[i],o=Gt({name:i,field:a,path:e.path,fieldConfigs:e.fieldConfigs,tabName:e.tabName});t=k(o.code,t),n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames)}return{code:t,auxiliaryTypes:n,contentTypeNames:r}}function qt(e){let t=``,n=[],r=[],i=A(e.model.id,`Document`,`Data`),a=zt({name:e.model.id,model:e.model}),o=``;for(let t in e.model.json){let{uid:i,...a}=e.model.json[t],s=Kt({fields:a,fieldConfigs:e.fieldConfigs,path:[{name:e.model.id,model:e.model}],tabName:t});o+=s.code,n.push(...s.auxiliaryTypes),r.push(...s.contentTypeNames)}return t=o?D.source`
37
+ `}),a.push(o)}}let o=k(e.path[0].name,`Document`,`Data`,e.name,`Slice`),s=Gt(a);n.push({name:o,code:`type ${o} = ${s}`}),r.push(o),t=D(`${i}: prismic.SliceZone<${o}>;`,t);break}default:t=D(`${i}: unknown;`,t)}return{code:t,auxiliaryTypes:n,contentTypeNames:r}}function qt(e){let t=``,n=[],r=[];for(let i in e.fields){let a=e.fields[i],o=Kt({name:i,field:a,path:e.path,fieldConfigs:e.fieldConfigs,tabName:e.tabName});t=O(o.code,t),n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames)}return{code:t,auxiliaryTypes:n,contentTypeNames:r}}function Jt(e){let t=``,n=[],r=[],i=k(e.model.id,`Document`,`Data`),a=Bt({name:e.model.id,model:e.model}),o=``;for(let t in e.model.json){let{uid:i,...a}=e.model.json[t],s=qt({fields:a,fieldConfigs:e.fieldConfigs,path:[{name:e.model.id,model:e.model}],tabName:t});o+=s.code,n.push(...s.auxiliaryTypes),r.push(...s.contentTypeNames)}return t=o?E.source`
38
38
  /**
39
39
  * Content for ${a} documents
40
40
  */
41
41
  interface ${i} {
42
42
  ${o}
43
43
  }
44
- `:`interface ${i} {}`,{name:i,code:t,auxiliaryTypes:n,contentTypeNames:r}}function Jt(e){return`uid`in Object.assign({},...Object.values(e.json))}const Yt=e=>c.createHash(`sha1`).update(JSON.stringify(e)).digest(`hex`);function Xt(e){if(e.cache){let t=Yt(e.model),n=e.cache.get(t);if(n)return n}let t=``,n=[],r=[],i=A(e.model.id,`Document`),a=e.localeIDs&&e.localeIDs.length>0?Wt(e.localeIDs.map(e=>`"${e}"`)):`string`,o=Jt(e.model)?`PrismicDocumentWithUID`:`PrismicDocumentWithoutUID`,s=zt({name:e.model.id,model:e.model}),c=qt({model:e.model,fieldConfigs:e.fieldConfigs});n.push(...c.auxiliaryTypes),r.push(c.name),r.push(...c.contentTypeNames),t=k(c.code,t),t=k(D.source`
44
+ `:`interface ${i} {}`,{name:i,code:t,auxiliaryTypes:n,contentTypeNames:r}}function Yt(e){return`uid`in Object.assign({},...Object.values(e.json))}const Xt=e=>c.createHash(`sha1`).update(JSON.stringify(e)).digest(`hex`);function Zt(e){if(e.cache){let t=Xt(e.model),n=e.cache.get(t);if(n)return n}let t=``,n=[],r=[],i=k(e.model.id,`Document`),a=e.localeIDs&&e.localeIDs.length>0?Gt(e.localeIDs.map(e=>`"${e}"`)):`string`,o=Yt(e.model)?`PrismicDocumentWithUID`:`PrismicDocumentWithoutUID`,s=Bt({name:e.model.id,model:e.model}),c=Jt({model:e.model,fieldConfigs:e.fieldConfigs});n.push(...c.auxiliaryTypes),r.push(c.name),r.push(...c.contentTypeNames),t=O(c.code,t),t=O(E.source`
45
45
  /**
46
46
  * ${s} document from Prismic
47
47
  *
@@ -52,54 +52,54 @@ import{parseArgs as e}from"node:util";import{access as t,mkdir as n,readFile as
52
52
  * @typeParam Lang - Language API ID of the document.
53
53
  */
54
54
  export type ${i}<Lang extends string = ${a}> = prismic.${o}<Simplify<${c.name}>, "${e.model.id}", Lang>;
55
- `,t);let l={name:i,code:t,auxiliaryTypes:n,contentTypeNames:r};if(e.cache){let t=Yt(e.model);e.cache.set(t,l)}return l}function Zt(e){if(e.cache){let t=Yt([e.model,e.fieldConfigs]),n=e.cache.get(t);if(n)return n}let t=``,n=[],r=[],i=A(e.model.id,`Slice`),a=zt({name:e.model.id,model:e.model}),o=[];for(let s of e.model.variations){let c=A(i,s.id),l;if(s.primary&&Object.keys(s.primary).length>0){l=A(c,`Primary`);let i=[{name:e.model.id,model:e.model},{name:s.id,label:s.name},{name:`primary`,label:`Primary`}],a=Bt({path:i}),o=Kt({fields:s.primary,fieldConfigs:e.fieldConfigs,path:i});n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames),r.push(l);let u=D.stripIndent`
55
+ `,t);let l={name:i,code:t,auxiliaryTypes:n,contentTypeNames:r};if(e.cache){let t=Xt(e.model);e.cache.set(t,l)}return l}function Qt(e){if(e.cache){let t=Xt([e.model,e.fieldConfigs]),n=e.cache.get(t);if(n)return n}let t=``,n=[],r=[],i=k(e.model.id,`Slice`),a=Bt({name:e.model.id,model:e.model}),o=[];for(let s of e.model.variations){let c=k(i,s.id),l;if(s.primary&&Object.keys(s.primary).length>0){l=k(c,`Primary`);let i=[{name:e.model.id,model:e.model},{name:s.id,label:s.name},{name:`primary`,label:`Primary`}],a=Vt({path:i}),o=qt({fields:s.primary,fieldConfigs:e.fieldConfigs,path:i});n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames),r.push(l);let u=E.stripIndent`
56
56
  /**
57
57
  * Primary content in *${a}*
58
58
  */
59
- `;t=k(o.code?D.source`
59
+ `;t=O(o.code?E.source`
60
60
  ${u}
61
61
  export interface ${l} {
62
62
  ${o.code}
63
63
  }
64
- `:D.source`
64
+ `:E.source`
65
65
  ${u}
66
66
  export interface ${l} {}
67
- `,t)}let u;if(s.items&&Object.keys(s.items).length>0){u=A(c,`Item`);let i=[{name:e.model.id,model:e.model},{name:`items`,label:`Items`}],a=Bt({path:i}),o=Kt({fields:s.items,fieldConfigs:e.fieldConfigs,path:i});n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames),r.push(u);let l=D.stripIndent`
67
+ `,t)}let u;if(s.items&&Object.keys(s.items).length>0){u=k(c,`Item`);let i=[{name:e.model.id,model:e.model},{name:`items`,label:`Items`}],a=Vt({path:i}),o=qt({fields:s.items,fieldConfigs:e.fieldConfigs,path:i});n.push(...o.auxiliaryTypes),r.push(...o.contentTypeNames),r.push(u);let l=E.stripIndent`
68
68
  /**
69
69
  * Primary content in *${a}*
70
70
  */
71
- `;t=k(o.code?D.source`
71
+ `;t=O(o.code?E.source`
72
72
  ${l}
73
73
  export interface ${u} {
74
74
  ${o.code}
75
75
  }
76
- `:D.source`
76
+ `:E.source`
77
77
  ${l}
78
78
  export interface ${u} {}
79
- `,t)}t=k(D.source`
79
+ `,t)}t=O(E.source`
80
80
  /**
81
81
  * ${s.name} variation for ${a} Slice
82
82
  *
83
83
  * - **API ID**: \`${s.id}\`
84
84
  * - **Description**: ${s.description||`*None*`}
85
- * - **Documentation**: ${qe}
85
+ * - **Documentation**: ${Je}
86
86
  */
87
87
  export type ${c} = prismic.SharedSliceVariation<"${s.id}", ${l?`Simplify<${l}>`:`Record<string, never>`}, ${u?`Simplify<${u}>`:`never`}>;
88
- `,t),o.push(c)}let s=A(i,`Variation`),c=Wt(o);r.push(s),r.push(...o),t=k(D.source`
88
+ `,t),o.push(c)}let s=k(i,`Variation`),c=Gt(o);r.push(s),r.push(...o),t=O(E.source`
89
89
  /**
90
90
  * Slice variation for *${a}*
91
91
  */
92
92
  type ${s} = ${o.length>0?c:`never`}
93
- `,t),t=k(D.source`
93
+ `,t),t=O(E.source`
94
94
  /**
95
95
  * ${a} Shared Slice
96
96
  *
97
97
  * - **API ID**: \`${e.model.id}\`
98
98
  * - **Description**: ${e.model.description||`*None*`}
99
- * - **Documentation**: ${qe}
99
+ * - **Documentation**: ${Je}
100
100
  */
101
101
  export type ${i} = prismic.SharedSlice<"${e.model.id}", ${s}>;
102
- `,t);let l={name:i,variationNames:o,code:t,auxiliaryTypes:n,contentTypeNames:r};if(e.cache){let t=Yt([e.model,e.fieldConfigs]);e.cache.set(t,l)}return l}const Qt=new We({maxSize:1e3});function $t(e={}){let t=e.fieldConfigs||{},n=e.cache??!0,r=``,i=e.typesProvider||`@prismicio/types`,a=`prismic`;r=O(`import type * as prismic from "${i}";`,r),(e.clientIntegration?.includeCreateClientInterface||e.clientIntegration?.includeContentNamespace)&&i!==`@prismicio/client`&&(a=`prismicClient`,r=O(`import type * as ${a} from "@prismicio/client";`,r)),r=k(`type Simplify<T> = { [KeyType in keyof T]: T[KeyType] };`,r),r=k(`
102
+ `,t);let l={name:i,variationNames:o,code:t,auxiliaryTypes:n,contentTypeNames:r};if(e.cache){let t=Xt([e.model,e.fieldConfigs]);e.cache.set(t,l)}return l}const $t=new Ge({maxSize:1e3});function en(e={}){let t=e.fieldConfigs||{},n=e.cache??!0,r=``,i=e.typesProvider||`@prismicio/types`,a=`prismic`;r=D(`import type * as prismic from "${i}";`,r),(e.clientIntegration?.includeCreateClientInterface||e.clientIntegration?.includeContentNamespace)&&i!==`@prismicio/client`&&(a=`prismicClient`,r=D(`import type * as ${a} from "@prismicio/client";`,r)),r=O(`type Simplify<T> = { [KeyType in keyof T]: T[KeyType] };`,r),r=O(`
103
103
  type PickContentRelationshipFieldData<
104
104
  TRelationship extends prismic.CustomTypeModelFetchCustomTypeLevel1 | prismic.CustomTypeModelFetchCustomTypeLevel2 | prismic.CustomTypeModelFetchGroupLevel1 | prismic.CustomTypeModelFetchGroupLevel2,
105
105
  TData extends Record<string, prismic.AnyRegularField | prismic.GroupField | prismic.NestedGroupField | prismic.SliceZone>,
@@ -142,30 +142,30 @@ type ContentRelationshipFieldWithData<
142
142
  >
143
143
  >
144
144
  }[Exclude<TCustomType[number], string>["id"]];
145
- `,r);let o=[];if(e.customTypeModels){let i=[];for(let a of e.customTypeModels){let s=Xt({model:a,localeIDs:e.localeIDs,fieldConfigs:t,cache:n?Qt:void 0});for(let e of s.auxiliaryTypes)r=k(e.code,r);r=k(s.code,r),i.push(s.name),o.push(s.name),o.push(...s.contentTypeNames)}if(e.customTypeModels.length>0){let e=`AllDocumentTypes`;r=k(`export type ${e} = ${Wt(i)};`,r),o.push(e)}}if(e.sharedSliceModels)for(let i of e.sharedSliceModels){let e=Zt({model:i,fieldConfigs:t,cache:n?Qt:void 0});for(let t of e.auxiliaryTypes)r=k(t.code,r);r=k(e.code,r),o.push(e.name),o.push(...e.contentTypeNames)}if(e.clientIntegration?.includeCreateClientInterface||e.clientIntegration?.includeContentNamespace){let t=``;e.clientIntegration.includeCreateClientInterface&&((e.customTypeModels?.length||0)>0?(t=k(`interface CreateClient {
145
+ `,r);let o=[];if(e.customTypeModels){let i=[];for(let a of e.customTypeModels){let s=Zt({model:a,localeIDs:e.localeIDs,fieldConfigs:t,cache:n?$t:void 0});for(let e of s.auxiliaryTypes)r=O(e.code,r);r=O(s.code,r),i.push(s.name),o.push(s.name),o.push(...s.contentTypeNames)}if(e.customTypeModels.length>0){let e=`AllDocumentTypes`;r=O(`export type ${e} = ${Gt(i)};`,r),o.push(e)}}if(e.sharedSliceModels)for(let i of e.sharedSliceModels){let e=Qt({model:i,fieldConfigs:t,cache:n?$t:void 0});for(let t of e.auxiliaryTypes)r=O(t.code,r);r=O(e.code,r),o.push(e.name),o.push(...e.contentTypeNames)}if(e.clientIntegration?.includeCreateClientInterface||e.clientIntegration?.includeContentNamespace){let t=``;e.clientIntegration.includeCreateClientInterface&&((e.customTypeModels?.length||0)>0?(t=O(`interface CreateClient {
146
146
  (repositoryNameOrEndpoint: string, options?: ${a}.ClientConfig): ${a}.Client<AllDocumentTypes>;
147
- }`,t),t=k(`interface CreateWriteClient {
147
+ }`,t),t=O(`interface CreateWriteClient {
148
148
  (repositoryNameOrEndpoint: string, options: ${a}.WriteClientConfig): ${a}.WriteClient<AllDocumentTypes>;
149
- }`,t),t=k(`interface CreateMigration {
149
+ }`,t),t=O(`interface CreateMigration {
150
150
  (): ${a}.Migration<AllDocumentTypes>;
151
- }`,t)):(t=k(`interface CreateClient {
151
+ }`,t)):(t=O(`interface CreateClient {
152
152
  (repositoryNameOrEndpoint: string, options?: ${a}.ClientConfig): ${a}.Client;
153
- }`,t),t=k(`interface CreateWriteClient {
153
+ }`,t),t=O(`interface CreateWriteClient {
154
154
  (repositoryNameOrEndpoint: string, options?: ${a}.WriteClientConfig): ${a}.WriteClient;
155
- }`,t),t=k(`interface CreateMigration {
155
+ }`,t),t=O(`interface CreateMigration {
156
156
  (): ${a}.Migration;
157
- }`,t))),e.clientIntegration.includeContentNamespace&&(t=k(D.source`
157
+ }`,t))),e.clientIntegration.includeContentNamespace&&(t=O(E.source`
158
158
  namespace Content {
159
159
  export type {
160
160
  ${o.join(`,
161
161
  `)}
162
162
  }
163
163
  }
164
- `,t)),r=k(D.source`
164
+ `,t)),r=O(E.source`
165
165
  declare module "@prismicio/client" {
166
166
  ${t}
167
167
  }
168
- `,r)}return r}function en(e){return{lang:e?.lang??void 0,message:e?.message,abortEarly:e?.abortEarly??void 0,abortPipeEarly:e?.abortPipeEarly??void 0}}function tn(e){return(void 0)?.get(e)}function nn(e){return(void 0)?.get(e)}function rn(e,t){return(void 0)?.get(e)?.get(t)}function an(e){let t=typeof e;return t===`string`?`"${e}"`:t===`number`||t===`bigint`||t===`boolean`?`${e}`:t===`object`||t===`function`?(e&&Object.getPrototypeOf(e)?.constructor?.name)??`null`:t}function on(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??an(a),c={kind:e.kind,type:e.type,input:a,expected:o,received:s,message:`Invalid ${t}: ${o?`Expected ${o} but r`:`R`}eceived ${s}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},l=e.kind===`schema`,u=i?.message??e.message??rn(e.reference,c.lang)??(l?nn(c.lang):null)??r.message??tn(c.lang);u!==void 0&&(c.message=typeof u==`function`?u(c):u),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}function j(e){return{version:1,vendor:`valibot`,validate(t){return e[`~run`]({value:t},en())}}}function sn(e,t){return Object.hasOwn(e,t)&&t!==`__proto__`&&t!==`prototype`&&t!==`constructor`}function M(e){return e instanceof cn}var cn=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}};function ln(e){return{kind:`validation`,type:`url`,reference:ln,async:!1,expects:null,requirement(e){try{return new URL(e),!0}catch{return!1}},message:e,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&on(this,`URL`,e,t),e}}}function un(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function dn(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function N(e,t){return{kind:`schema`,type:`array`,reference:N,expects:`Array`,async:!1,item:e,message:t,get"~standard"(){return j(this)},"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<n.length;r++){let i=n[r],a=this.item[`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else on(this,`type`,e,t);return e}}}function P(e){return{kind:`schema`,type:`boolean`,reference:P,expects:`boolean`,async:!1,message:e,get"~standard"(){return j(this)},"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:on(this,`type`,e,t),e}}}function fn(e,t){return{kind:`schema`,type:`literal`,reference:fn,expects:an(e),async:!1,literal:e,message:t,get"~standard"(){return j(this)},"~run"(e,t){return e.value===this.literal?e.typed=!0:on(this,`type`,e,t),e}}}function pn(e,t){return{kind:`schema`,type:`nullable`,reference:pn,expects:`(${e.expects} | null)`,async:!1,wrapped:e,default:t,get"~standard"(){return j(this)},"~run"(e,t){return e.value===null&&(this.default!==void 0&&(e.value=dn(this,e,t)),e.value===null)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function mn(e){return{kind:`schema`,type:`number`,reference:mn,expects:`number`,async:!1,message:e,get"~standard"(){return j(this)},"~run"(e,t){return typeof e.value==`number`&&!isNaN(e.value)?e.typed=!0:on(this,`type`,e,t),e}}}function F(e,t){return{kind:`schema`,type:`object`,reference:F,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return j(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`)for(let r in e.typed=!0,e.value={},this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:dn(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=un(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(on(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}else on(this,`type`,e,t);return e}}}function I(e,t){return{kind:`schema`,type:`optional`,reference:I,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return j(this)},"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=dn(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function L(e,t,n){return{kind:`schema`,type:`record`,reference:L,expects:`Object`,async:!1,key:e,value:t,message:n,get"~standard"(){return j(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){for(let r in e.typed=!0,e.value={},n)if(sn(n,r)){let i=n[r],a=this.key[`~run`]({value:r},t);if(a.issues){let o={type:`object`,origin:`key`,input:n,key:r,value:i};for(let t of a.issues)t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}let o=this.value[`~run`]({value:i},t);if(o.issues){let a={type:`object`,origin:`value`,input:n,key:r,value:i};for(let t of o.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}(!a.typed||!o.typed)&&(e.typed=!1),a.typed&&(e.value[a.value]=o.value)}}else on(this,`type`,e,t);return e}}}function R(e){return{kind:`schema`,type:`string`,reference:R,expects:`string`,async:!1,message:e,get"~standard"(){return j(this)},"~run"(e,t){return typeof e.value==`string`?e.typed=!0:on(this,`type`,e,t),e}}}function z(){return{kind:`schema`,type:`unknown`,reference:z,expects:`unknown`,async:!1,get"~standard"(){return j(this)},"~run"(e){return e.typed=!0,e}}}function hn(e,t,n){let r=e[`~run`]({value:t},en(n));if(r.issues)throw new cn(r.issues);return r.value}function gn(...e){return{...e[0],pipe:e,get"~standard"(){return j(this)},"~run"(t,n){for(let r of e)if(r.kind!==`metadata`){if(t.issues&&(r.kind===`schema`||r.kind===`transformation`)){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=r[`~run`](t,n))}return t}}}function B(e,t,n){let r=e[`~run`]({value:t},en(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}async function V(e){let t=await Cn();return t.hostname=`${e}.${t.hostname}`,yn(t)}async function _n(){let e=await Cn();return e.hostname=`api.internal.${e.hostname}`,yn(e)}async function vn(){let e=await Cn();return e.hostname=`user-service.${e.hostname}`,yn(e)}function yn(e){let t=new URL(e);return t.pathname.endsWith(`/`)||(t.pathname+=`/`),t}const bn=new URL(`.prismic`,yn(u(l()))),xn=`https://prismic.io`;async function Sn(e,t){let n={token:e,host:t?.host};await s(bn,JSON.stringify(n,null,2))}async function H(){let e=await U();if(!e)return!1;try{let t=await Cn();t.hostname=`user-service.${t.hostname}`;let n=new URL(`profile`,t);return(await fetch(n,{headers:{Accept:`application/json`,Cookie:`SESSION=fake_session; prismic-auth=${e}`}})).ok?!0:(await Tn(),!1)}catch{return!1}}async function U(){return(await wn())?.token}async function Cn(){try{let e=await wn();return e?.host?new URL(e.host):new URL(xn)}catch{return new URL(xn)}}async function wn(){try{let e=await r(bn,`utf-8`);return JSON.parse(e)}catch{return}}async function Tn(){try{await t(bn)}catch{return!0}return await wn()?(await o(bn),!0):!1}async function W(e,n={}){let{start:r=u(process.cwd()),stop:i}=n,a=yn(r);for(;;){let n=new URL(e,a);try{return await t(n),n}catch{}if(typeof i==`string`){let e=new URL(i,a);try{await t(e);return}catch{}}else if(i instanceof URL&&i.href===a.href)return;let r=new URL(`..`,a);if(r.href===a.href)return;a=r}}async function En(e){try{return await t(e),!0}catch{return!1}}const Dn=F({id:R(),type:fn(`SharedSlice`),name:R(),description:I(R()),variations:N(F({id:R(),name:R(),description:I(R()),docURL:I(R()),version:I(R()),imageUrl:I(R()),primary:I(L(R(),z())),items:I(L(R(),z()))}))});async function G(e){if(!await W(`package.json`))return{ok:!1,error:`Could not find project root (no package.json found)`};let t=await On(),n;try{n=await i(t,{withFileTypes:!1})}catch{return{ok:!1,error:`No slices directory found at ${t.href}`}}for(let i of n){let n=new URL(`${i}/model.json`,t);try{let t=await r(n,`utf8`),i=JSON.parse(t);if(i.id===e){let e=B(Dn,i);return e.success?{ok:!0,model:e.output,modelPath:n}:{ok:!1,error:`Invalid slice model at ${n.href}`}}}catch{}}return{ok:!1,error:`Slice not found: ${e}\n\nCreate it first with: prismic slice create ${e}`}}async function On(){let e=await An(),t=await W(`package.json`);if(!t)throw Error(`Could not find project root (no package.json found)`);let n=new URL(`.`,t);switch(e){case`next`:if(await En(new URL(`src`,n)))return new URL(`src/slices/`,n);case`nuxt`:if(await En(new URL(`app`,n)))return new URL(`app/slices/`,n);case`sveltekit`:return new URL(`src/slices/`,n)}return new URL(`slices/`,n)}const kn=F({dependencies:I(L(R(),R()))});async function An(){let e=await W(`package.json`);if(e)try{let t=await r(e,`utf8`),{dependencies:n={}}=hn(kn,JSON.parse(t));if(`next`in n)return`next`;if(`nuxt`in n)return`nuxt`;if(`@sveltejs/kit`in n)return`sveltekit`}catch{}}function jn(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}const Mn=F({id:R(),label:I(R()),repeatable:P(),status:P(),format:I(R()),json:L(R(),z())});async function Nn(){let e=await Cn();return e.hostname=`customtypes.${e.hostname}`,e}async function Pn(e){let t=await U();if(!t)return{ok:!1,error:`Not authenticated`};let n=await Nn(),r=new URL(`customtypes`,n);try{let n=await fetch(r,{headers:{Authorization:`Bearer ${t}`,repository:e}});if(!n.ok)return n.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:n.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${n.status} ${n.statusText}`};let i=await n.json(),a=B(N(Mn),i);return a.success?{ok:!0,value:a.output}:{ok:!1,error:`Invalid response from Custom Types API`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Fn(e){let t=await U();if(!t)return{ok:!1,error:`Not authenticated`};let n=await Nn(),r=new URL(`slices`,n);try{let n=await fetch(r,{headers:{Authorization:`Bearer ${t}`,repository:e}});if(!n.ok)return n.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:n.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${n.status} ${n.statusText}`};let i=await n.json(),a=B(N(Dn),i);return a.success?{ok:!0,value:a.output}:{ok:!1,error:`Invalid response from Custom Types API`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function In(){let e=await W(`package.json`);if(!e)return{ok:!1,error:`Could not find project root (no package.json found)`};let t=new URL(`.`,e),n=new URL(`customtypes/`,t),a;try{a=await i(n,{withFileTypes:!1})}catch{return{ok:!0,value:[]}}let o=[];for(let e of a){let t=new URL(`${e}/index.json`,n);try{let e=await r(t,`utf8`),n=B(Mn,JSON.parse(e));n.success&&o.push(n.output)}catch{}}return{ok:!0,value:o}}async function Ln(){let e;try{e=await On()}catch{return{ok:!1,error:`Could not find project root (no package.json found)`}}let t;try{t=await i(e,{withFileTypes:!1})}catch{return{ok:!0,value:[]}}let n=[];for(let i of t){let t=new URL(`${i}/model.json`,e);try{let e=await r(t,`utf8`),i=B(Dn,JSON.parse(e));i.success&&n.push(i.output)}catch{}}return{ok:!0,value:n}}async function Rn(e,t){let n=await U();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Nn(),i=new URL(`customtypes/insert`,r);try{let r=await fetch(i,{method:`POST`,headers:{Authorization:`Bearer ${n}`,repository:e,"Content-Type":`application/json`},body:JSON.stringify(t)});return r.ok?{ok:!0,value:void 0}:r.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:r.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${r.status} ${r.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function zn(e,t){let n=await U();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Nn(),i=new URL(`customtypes/update`,r);try{let r=await fetch(i,{method:`POST`,headers:{Authorization:`Bearer ${n}`,repository:e,"Content-Type":`application/json`},body:JSON.stringify(t)});return r.ok?{ok:!0,value:void 0}:r.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:r.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${r.status} ${r.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Bn(e,t){let n=await U();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Nn(),i=new URL(`customtypes/${encodeURIComponent(t)}`,r);try{let t=await fetch(i,{method:`DELETE`,headers:{Authorization:`Bearer ${n}`,repository:e}});return t.ok?{ok:!0,value:void 0}:t.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:t.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${t.status} ${t.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Vn(e,t){let n=await U();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Nn(),i=new URL(`slices/insert`,r);try{let r=await fetch(i,{method:`POST`,headers:{Authorization:`Bearer ${n}`,repository:e,"Content-Type":`application/json`},body:JSON.stringify(t)});return r.ok?{ok:!0,value:void 0}:r.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:r.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${r.status} ${r.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Hn(e,t){let n=await U();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Nn(),i=new URL(`slices/update`,r);try{let r=await fetch(i,{method:`POST`,headers:{Authorization:`Bearer ${n}`,repository:e,"Content-Type":`application/json`},body:JSON.stringify(t)});return r.ok?{ok:!0,value:void 0}:r.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:r.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${r.status} ${r.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Un(e,t){let n=await U();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Nn(),i=new URL(`slices/${encodeURIComponent(t)}`,r);try{let t=await fetch(i,{method:`DELETE`,headers:{Authorization:`Bearer ${n}`,repository:e}});return t.ok?{ok:!0,value:void 0}:t.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:t.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${t.status} ${t.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Wn(){let{values:{help:t,output:n}}=e({args:process.argv.slice(4),options:{output:{type:`string`,short:`o`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Generate TypeScript types from local custom type and slice models.
168
+ `,r)}return r}function tn(e){return{lang:e?.lang??void 0,message:e?.message,abortEarly:e?.abortEarly??void 0,abortPipeEarly:e?.abortPipeEarly??void 0}}function nn(e){return(void 0)?.get(e)}function rn(e){return(void 0)?.get(e)}function an(e,t){return(void 0)?.get(e)?.get(t)}function on(e){let t=typeof e;return t===`string`?`"${e}"`:t===`number`||t===`bigint`||t===`boolean`?`${e}`:t===`object`||t===`function`?(e&&Object.getPrototypeOf(e)?.constructor?.name)??`null`:t}function A(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??on(a),c={kind:e.kind,type:e.type,input:a,expected:o,received:s,message:`Invalid ${t}: ${o?`Expected ${o} but r`:`R`}eceived ${s}`,requirement:e.requirement,path:i?.path,issues:i?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},l=e.kind===`schema`,u=i?.message??e.message??an(e.reference,c.lang)??(l?rn(c.lang):null)??r.message??nn(c.lang);u!==void 0&&(c.message=typeof u==`function`?u(c):u),l&&(n.typed=!1),n.issues?n.issues.push(c):n.issues=[c]}function j(e){return{version:1,vendor:`valibot`,validate(t){return e[`~run`]({value:t},tn())}}}function sn(e,t){return Object.hasOwn(e,t)&&t!==`__proto__`&&t!==`prototype`&&t!==`constructor`}function M(e){return e instanceof cn}var cn=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}};function ln(e){return{kind:`validation`,type:`url`,reference:ln,async:!1,expects:null,requirement(e){try{return new URL(e),!0}catch{return!1}},message:e,"~run"(e,t){return e.typed&&!this.requirement(e.value)&&A(this,`URL`,e,t),e}}}function un(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function dn(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function N(e,t){return{kind:`schema`,type:`array`,reference:N,expects:`Array`,async:!1,item:e,message:t,get"~standard"(){return j(this)},"~run"(e,t){let n=e.value;if(Array.isArray(n)){e.typed=!0,e.value=[];for(let r=0;r<n.length;r++){let i=n[r],a=this.item[`~run`]({value:i},t);if(a.issues){let o={type:`array`,origin:`value`,input:n,key:r,value:i};for(let t of a.issues)t.path?t.path.unshift(o):t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}a.typed||(e.typed=!1),e.value.push(a.value)}}else A(this,`type`,e,t);return e}}}function P(e){return{kind:`schema`,type:`boolean`,reference:P,expects:`boolean`,async:!1,message:e,get"~standard"(){return j(this)},"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:A(this,`type`,e,t),e}}}function fn(e,t){return{kind:`schema`,type:`literal`,reference:fn,expects:on(e),async:!1,literal:e,message:t,get"~standard"(){return j(this)},"~run"(e,t){return e.value===this.literal?e.typed=!0:A(this,`type`,e,t),e}}}function pn(e,t){return{kind:`schema`,type:`nullable`,reference:pn,expects:`(${e.expects} | null)`,async:!1,wrapped:e,default:t,get"~standard"(){return j(this)},"~run"(e,t){return e.value===null&&(this.default!==void 0&&(e.value=dn(this,e,t)),e.value===null)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function mn(e){return{kind:`schema`,type:`number`,reference:mn,expects:`number`,async:!1,message:e,get"~standard"(){return j(this)},"~run"(e,t){return typeof e.value==`number`&&!isNaN(e.value)?e.typed=!0:A(this,`type`,e,t),e}}}function F(e,t){return{kind:`schema`,type:`object`,reference:F,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return j(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`)for(let r in e.typed=!0,e.value={},this.entries){let i=this.entries[r];if(r in n||(i.type===`exact_optional`||i.type===`optional`||i.type===`nullish`)&&i.default!==void 0){let a=r in n?n[r]:dn(i),o=i[`~run`]({value:a},t);if(o.issues){let i={type:`object`,origin:`value`,input:n,key:r,value:a};for(let t of o.issues)t.path?t.path.unshift(i):t.path=[i],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}o.typed||(e.typed=!1),e.value[r]=o.value}else if(i.fallback!==void 0)e.value[r]=un(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(A(this,`key`,e,t,{input:void 0,expected:`"${r}"`,path:[{type:`object`,origin:`key`,input:n,key:r,value:n[r]}]}),t.abortEarly))break}else A(this,`type`,e,t);return e}}}function I(e,t){return{kind:`schema`,type:`optional`,reference:I,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return j(this)},"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=dn(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function L(e,t,n){return{kind:`schema`,type:`record`,reference:L,expects:`Object`,async:!1,key:e,value:t,message:n,get"~standard"(){return j(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){for(let r in e.typed=!0,e.value={},n)if(sn(n,r)){let i=n[r],a=this.key[`~run`]({value:r},t);if(a.issues){let o={type:`object`,origin:`key`,input:n,key:r,value:i};for(let t of a.issues)t.path=[o],e.issues?.push(t);if(e.issues||=a.issues,t.abortEarly){e.typed=!1;break}}let o=this.value[`~run`]({value:i},t);if(o.issues){let a={type:`object`,origin:`value`,input:n,key:r,value:i};for(let t of o.issues)t.path?t.path.unshift(a):t.path=[a],e.issues?.push(t);if(e.issues||=o.issues,t.abortEarly){e.typed=!1;break}}(!a.typed||!o.typed)&&(e.typed=!1),a.typed&&(e.value[a.value]=o.value)}}else A(this,`type`,e,t);return e}}}function R(e){return{kind:`schema`,type:`string`,reference:R,expects:`string`,async:!1,message:e,get"~standard"(){return j(this)},"~run"(e,t){return typeof e.value==`string`?e.typed=!0:A(this,`type`,e,t),e}}}function z(){return{kind:`schema`,type:`unknown`,reference:z,expects:`unknown`,async:!1,get"~standard"(){return j(this)},"~run"(e){return e.typed=!0,e}}}function hn(e,t,n){let r=e[`~run`]({value:t},tn(n));if(r.issues)throw new cn(r.issues);return r.value}function gn(...e){return{...e[0],pipe:e,get"~standard"(){return j(this)},"~run"(t,n){for(let r of e)if(r.kind!==`metadata`){if(t.issues&&(r.kind===`schema`||r.kind===`transformation`)){t.typed=!1;break}(!t.issues||!n.abortEarly&&!n.abortPipeEarly)&&(t=r[`~run`](t,n))}return t}}}function B(e,t,n){let r=e[`~run`]({value:t},tn(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}async function V(e){let t=await Cn();return t.hostname=`${e}.${t.hostname}`,yn(t)}async function _n(){let e=await Cn();return e.hostname=`api.internal.${e.hostname}`,yn(e)}async function vn(){let e=await Cn();return e.hostname=`user-service.${e.hostname}`,yn(e)}function yn(e){let t=new URL(e);return t.pathname.endsWith(`/`)||(t.pathname+=`/`),t}const bn=new URL(`.prismic`,yn(u(l()))),xn=`https://prismic.io`;async function Sn(e,t){let n={token:e,host:t?.host};await s(bn,JSON.stringify(n,null,2))}async function H(){let e=await U();if(!e)return!1;try{let t=await Cn();t.hostname=`user-service.${t.hostname}`;let n=new URL(`profile`,t);return(await fetch(n,{headers:{Accept:`application/json`,Cookie:`SESSION=fake_session; prismic-auth=${e}`}})).ok?!0:(await Tn(),!1)}catch{return!1}}async function U(){return(await wn())?.token}async function Cn(){try{let e=await wn();return e?.host?new URL(e.host):new URL(xn)}catch{return new URL(xn)}}async function wn(){try{let e=await r(bn,`utf-8`);return JSON.parse(e)}catch{return}}async function Tn(){try{await t(bn)}catch{return!0}return await wn()?(await o(bn),!0):!1}async function W(e,n={}){let{start:r=u(process.cwd()),stop:i}=n,a=yn(r);for(;;){let n=new URL(e,a);try{return await t(n),n}catch{}if(typeof i==`string`){let e=new URL(i,a);try{await t(e);return}catch{}}else if(i instanceof URL&&i.href===a.href)return;let r=new URL(`..`,a);if(r.href===a.href)return;a=r}}async function En(e){try{return await t(e),!0}catch{return!1}}const Dn=F({id:R(),type:fn(`SharedSlice`),name:R(),description:I(R()),variations:N(F({id:R(),name:R(),description:I(R()),docURL:I(R()),version:I(R()),imageUrl:I(R()),primary:I(L(R(),z())),items:I(L(R(),z()))}))});async function G(e){if(!await W(`package.json`))return{ok:!1,error:`Could not find project root (no package.json found)`};let t=await On(),n;try{n=await i(t,{withFileTypes:!1})}catch{return{ok:!1,error:`No slices directory found at ${t.href}`}}for(let i of n){let n=new URL(`${i}/model.json`,t);try{let t=await r(n,`utf8`),i=JSON.parse(t);if(i.id===e){let e=B(Dn,i);return e.success?{ok:!0,model:e.output,modelPath:n}:{ok:!1,error:`Invalid slice model at ${n.href}`}}}catch{}}return{ok:!1,error:`Slice not found: ${e}\n\nCreate it first with: prismic slice create ${e}`}}async function On(){let e=await An(),t=await W(`package.json`);if(!t)throw Error(`Could not find project root (no package.json found)`);let n=new URL(`.`,t);switch(e){case`next`:if(await En(new URL(`src`,n)))return new URL(`src/slices/`,n);case`nuxt`:if(await En(new URL(`app`,n)))return new URL(`app/slices/`,n);case`sveltekit`:return new URL(`src/slices/`,n)}return new URL(`slices/`,n)}const kn=F({dependencies:I(L(R(),R()))});async function An(){let e=await W(`package.json`);if(e)try{let t=await r(e,`utf8`),{dependencies:n={}}=hn(kn,JSON.parse(t));if(`next`in n)return`next`;if(`nuxt`in n)return`nuxt`;if(`@sveltejs/kit`in n)return`sveltekit`}catch{}}function jn(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}const Mn=F({id:R(),label:I(R()),repeatable:P(),status:P(),format:I(R()),json:L(R(),z())});async function Nn(){let e=await Cn();return e.hostname=`customtypes.${e.hostname}`,e}async function Pn(e){let t=await U();if(!t)return{ok:!1,error:`Not authenticated`};let n=await Nn(),r=new URL(`customtypes`,n);try{let n=await fetch(r,{headers:{Authorization:`Bearer ${t}`,repository:e}});if(!n.ok)return n.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:n.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${n.status} ${n.statusText}`};let i=await n.json(),a=B(N(Mn),i);return a.success?{ok:!0,value:a.output}:{ok:!1,error:`Invalid response from Custom Types API`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Fn(e){let t=await U();if(!t)return{ok:!1,error:`Not authenticated`};let n=await Nn(),r=new URL(`slices`,n);try{let n=await fetch(r,{headers:{Authorization:`Bearer ${t}`,repository:e}});if(!n.ok)return n.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:n.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${n.status} ${n.statusText}`};let i=await n.json(),a=B(N(Dn),i);return a.success?{ok:!0,value:a.output}:{ok:!1,error:`Invalid response from Custom Types API`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function In(){let e=await W(`package.json`);if(!e)return{ok:!1,error:`Could not find project root (no package.json found)`};let t=new URL(`.`,e),n=new URL(`customtypes/`,t),a;try{a=await i(n,{withFileTypes:!1})}catch{return{ok:!0,value:[]}}let o=[];for(let e of a){let t=new URL(`${e}/index.json`,n);try{let e=await r(t,`utf8`),n=B(Mn,JSON.parse(e));n.success&&o.push(n.output)}catch{}}return{ok:!0,value:o}}async function Ln(){let e;try{e=await On()}catch{return{ok:!1,error:`Could not find project root (no package.json found)`}}let t;try{t=await i(e,{withFileTypes:!1})}catch{return{ok:!0,value:[]}}let n=[];for(let i of t){let t=new URL(`${i}/model.json`,e);try{let e=await r(t,`utf8`),i=B(Dn,JSON.parse(e));i.success&&n.push(i.output)}catch{}}return{ok:!0,value:n}}async function Rn(e,t){let n=await U();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Nn(),i=new URL(`customtypes/insert`,r);try{let r=await fetch(i,{method:`POST`,headers:{Authorization:`Bearer ${n}`,repository:e,"Content-Type":`application/json`},body:JSON.stringify(t)});return r.ok?{ok:!0,value:void 0}:r.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:r.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${r.status} ${r.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function zn(e,t){let n=await U();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Nn(),i=new URL(`customtypes/update`,r);try{let r=await fetch(i,{method:`POST`,headers:{Authorization:`Bearer ${n}`,repository:e,"Content-Type":`application/json`},body:JSON.stringify(t)});return r.ok?{ok:!0,value:void 0}:r.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:r.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${r.status} ${r.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Bn(e,t){let n=await U();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Nn(),i=new URL(`customtypes/${encodeURIComponent(t)}`,r);try{let t=await fetch(i,{method:`DELETE`,headers:{Authorization:`Bearer ${n}`,repository:e}});return t.ok?{ok:!0,value:void 0}:t.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:t.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${t.status} ${t.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Vn(e,t){let n=await U();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Nn(),i=new URL(`slices/insert`,r);try{let r=await fetch(i,{method:`POST`,headers:{Authorization:`Bearer ${n}`,repository:e,"Content-Type":`application/json`},body:JSON.stringify(t)});return r.ok?{ok:!0,value:void 0}:r.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:r.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${r.status} ${r.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Hn(e,t){let n=await U();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Nn(),i=new URL(`slices/update`,r);try{let r=await fetch(i,{method:`POST`,headers:{Authorization:`Bearer ${n}`,repository:e,"Content-Type":`application/json`},body:JSON.stringify(t)});return r.ok?{ok:!0,value:void 0}:r.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:r.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${r.status} ${r.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Un(e,t){let n=await U();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Nn(),i=new URL(`slices/${encodeURIComponent(t)}`,r);try{let t=await fetch(i,{method:`DELETE`,headers:{Authorization:`Bearer ${n}`,repository:e}});return t.ok?{ok:!0,value:void 0}:t.status===401?{ok:!1,error:"Unauthorized. Your session may have expired. Run `prismic login` again."}:t.status===403?{ok:!1,error:`Access denied. You may not have access to repository "${e}".`}:{ok:!1,error:`API error: ${t.status} ${t.statusText}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:e}`}}}async function Wn(){let{values:{help:t,output:n}}=e({args:process.argv.slice(4),options:{output:{type:`string`,short:`o`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Generate TypeScript types from local custom type and slice models.
169
169
 
170
170
  USAGE
171
171
  prismic codegen types [flags]
@@ -178,7 +178,7 @@ EXAMPLES
178
178
  prismic codegen types
179
179
  prismic codegen types --output custom.d.ts`);return}try{await K({output:n}),console.info(`Generated types written to ${n??`prismicio-types.d.ts`}`)}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exitCode=1}}async function K(e){let t=e?.output??`prismicio-types.d.ts`,[n,r]=await Promise.all([In(),Ln()]);if(!n.ok)throw Error(`failed to read local custom types: ${n.error}`);if(!r.ok)throw Error(`failed to read local slices: ${r.error}`);let i=n.value,a=r.value;await s(t,`// Code generated by prismic-ts-codegen. DO NOT EDIT.
180
180
 
181
- `+$t({customTypeModels:i,sharedSliceModels:a,typesProvider:`@prismicio/client`,clientIntegration:{includeCreateClientInterface:i.length>0||a.length>0,includeContentNamespace:!0}}))}async function Gn(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`types`:await Wn();break;default:t&&(console.error(`Unknown codegen subcommand: ${t}\n`),process.exitCode=1),console.info(`Generate code from Prismic models.
181
+ `+en({customTypeModels:i,sharedSliceModels:a,typesProvider:`@prismicio/client`,clientIntegration:{includeCreateClientInterface:i.length>0||a.length>0,includeContentNamespace:!0}}))}async function Gn(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`types`:await Wn();break;default:t&&(console.error(`Unknown codegen subcommand: ${t}\n`),process.exitCode=1),console.info(`Generate code from Prismic models.
182
182
 
183
183
  USAGE
184
184
  prismic codegen <command> [flags]
@@ -190,7 +190,7 @@ FLAGS
190
190
  -h, --help Show help for command
191
191
 
192
192
  LEARN MORE
193
- Use \`prismic codegen <command> --help\` for more information about a command.`)}}function q(e){return JSON.stringify(e,null,2)}function J(e){return e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}const Kn=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function qn(){let{values:{help:t,tab:n,label:i,default:a,"true-label":o,"false-label":c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},default:{type:`boolean`},"true-label":{type:`string`},"false-label":{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a boolean (toggle) field to an existing custom type.
193
+ Use \`prismic codegen <command> --help\` for more information about a command.`)}}function q(e){return JSON.stringify(e,null,2)}function J(e){return e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}const Kn=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function qn(){let{values:{help:t,tab:n,label:i,default:a,"true-label":o,"false-label":c,types:l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},default:{type:`boolean`},"true-label":{type:`string`},"false-label":{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a boolean (toggle) field to an existing custom type.
194
194
 
195
195
  USAGE
196
196
  prismic custom-type add-field boolean <type-id> <field-id> [flags]
@@ -199,8 +199,6 @@ ARGUMENTS
199
199
  type-id Custom type identifier (required)
200
200
  field-id Field identifier (required)
201
201
 
202
- Types are generated by default after changes. Use --no-types to skip.
203
-
204
202
  FLAGS
205
203
  -t, --tab string Target tab (default: first existing tab, or "Main")
206
204
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -208,15 +206,14 @@ FLAGS
208
206
  --true-label string Label shown when toggle is on
209
207
  --false-label string Label shown when toggle is off
210
208
  --types string Output file for generated types (default: "prismicio-types.d.ts")
211
- --no-types Skip type generation
212
209
  -h, --help Show help for command
213
210
 
214
211
  EXAMPLES
215
212
  prismic custom-type add-field boolean homepage featured
216
213
  prismic custom-type add-field boolean article published --default
217
- prismic custom-type add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!d){console.error(`Missing required argument: type-id
218
- `),console.error(`Usage: prismic custom-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
219
- `),console.error(`Usage: prismic custom-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}let p=await W(`package.json`);if(!p){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let m=new URL(`customtypes/${d}/index.json`,p),h;try{let e=await r(m,`utf8`),t=B(Kn,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${m.href}`),process.exitCode=1;return}h=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${d}\n`),console.error(`Create it first with: prismic custom-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let g=Object.keys(h.json),_=n??g[0]??`Main`;h.json[_]||(h.json[_]={});for(let[e,t]of Object.entries(h.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let v={type:`Boolean`,config:{label:i??J(f),...a&&{default_value:!0},...o&&{placeholder_true:o},...c&&{placeholder_false:c}}};h.json[_][f]=v;try{await s(m,q(h))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Boolean) to "${_}" tab in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Jn=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Yn(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing custom type.
214
+ prismic custom-type add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!u){console.error(`Missing required argument: type-id
215
+ `),console.error(`Usage: prismic custom-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
216
+ `),console.error(`Usage: prismic custom-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(Kn,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${u}\n`),console.error(`Create it first with: prismic custom-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Boolean`,config:{label:i??J(d),...a&&{default_value:!0},...o&&{placeholder_true:o},...c&&{placeholder_false:c}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Added field "${d}" (Boolean) to "${g}" tab in ${u}`);try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Jn=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Yn(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing custom type.
220
217
 
221
218
  USAGE
222
219
  prismic custom-type add-field color <type-id> <field-id> [flags]
@@ -225,22 +222,19 @@ ARGUMENTS
225
222
  type-id Custom type identifier (required)
226
223
  field-id Field identifier (required)
227
224
 
228
- Types are generated by default after changes. Use --no-types to skip.
229
-
230
225
  FLAGS
231
226
  -t, --tab string Target tab (default: first existing tab, or "Main")
232
227
  -l, --label string Display label for the field (inferred from field-id if omitted)
233
228
  -p, --placeholder string Placeholder text
234
229
  --types string Output file for generated types (default: "prismicio-types.d.ts")
235
- --no-types Skip type generation
236
230
  -h, --help Show help for command
237
231
 
238
232
  EXAMPLES
239
233
  prismic custom-type add-field color homepage bg_color
240
234
  prismic custom-type add-field color homepage accent --tab "Design"
241
- prismic custom-type add-field color homepage text_color --label "Text Color"`);return}if(!l){console.error(`Missing required argument: type-id
242
- `),console.error(`Usage: prismic custom-type add-field color <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
243
- `),console.error(`Usage: prismic custom-type add-field color <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Jn,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Color`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Color) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Xn=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Zn(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date field to an existing custom type.
235
+ prismic custom-type add-field color homepage text_color --label "Text Color"`);return}if(!c){console.error(`Missing required argument: type-id
236
+ `),console.error(`Usage: prismic custom-type add-field color <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
237
+ `),console.error(`Usage: prismic custom-type add-field color <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(Jn,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${c}\n`),console.error(`Create it first with: prismic custom-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`Color`,config:{label:i??J(l),...a&&{placeholder:a}}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Added field "${l}" (Color) to "${m}" tab in ${c}`);try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Xn=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Zn(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date field to an existing custom type.
244
238
 
245
239
  USAGE
246
240
  prismic custom-type add-field date <type-id> <field-id> [flags]
@@ -249,23 +243,20 @@ ARGUMENTS
249
243
  type-id Custom type identifier (required)
250
244
  field-id Field identifier (required)
251
245
 
252
- Types are generated by default after changes. Use --no-types to skip.
253
-
254
246
  FLAGS
255
247
  -t, --tab string Target tab (default: first existing tab, or "Main")
256
248
  -l, --label string Display label for the field (inferred from field-id if omitted)
257
249
  -p, --placeholder string Placeholder text
258
250
  --default string Default date value (YYYY-MM-DD format)
259
251
  --types string Output file for generated types (default: "prismicio-types.d.ts")
260
- --no-types Skip type generation
261
252
  -h, --help Show help for command
262
253
 
263
254
  EXAMPLES
264
255
  prismic custom-type add-field date homepage publish_date
265
256
  prismic custom-type add-field date event start_date --tab "Schedule"
266
- prismic custom-type add-field date article date --label "Publication Date" --default "2024-01-01"`);return}if(!u){console.error(`Missing required argument: type-id
267
- `),console.error(`Usage: prismic custom-type add-field date <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
268
- `),console.error(`Usage: prismic custom-type add-field date <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(Xn,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${u}\n`),console.error(`Create it first with: prismic custom-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Date`,config:{label:i??J(d),...a&&{placeholder:a},...o&&{default:o}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Date) to "${g}" tab in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Qn=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function $n(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed field to an existing custom type.
257
+ prismic custom-type add-field date article date --label "Publication Date" --default "2024-01-01"`);return}if(!l){console.error(`Missing required argument: type-id
258
+ `),console.error(`Usage: prismic custom-type add-field date <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
259
+ `),console.error(`Usage: prismic custom-type add-field date <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Xn,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Date`,config:{label:i??J(u),...a&&{placeholder:a},...o&&{default:o}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Added field "${u}" (Date) to "${h}" tab in ${l}`);try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Qn=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function $n(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed field to an existing custom type.
269
260
 
270
261
  USAGE
271
262
  prismic custom-type add-field embed <type-id> <field-id> [flags]
@@ -274,22 +265,19 @@ ARGUMENTS
274
265
  type-id Custom type identifier (required)
275
266
  field-id Field identifier (required)
276
267
 
277
- Types are generated by default after changes. Use --no-types to skip.
278
-
279
268
  FLAGS
280
269
  -t, --tab string Target tab (default: first existing tab, or "Main")
281
270
  -l, --label string Display label for the field (inferred from field-id if omitted)
282
271
  -p, --placeholder string Placeholder text
283
272
  --types string Output file for generated types (default: "prismicio-types.d.ts")
284
- --no-types Skip type generation
285
273
  -h, --help Show help for command
286
274
 
287
275
  EXAMPLES
288
276
  prismic custom-type add-field embed homepage video
289
277
  prismic custom-type add-field embed homepage youtube --tab "Media"
290
- prismic custom-type add-field embed homepage media --label "Media Embed"`);return}if(!l){console.error(`Missing required argument: type-id
291
- `),console.error(`Usage: prismic custom-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
292
- `),console.error(`Usage: prismic custom-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Qn,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Embed`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Embed) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const er=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function tr(){let{values:{help:t,tab:n,label:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geo-point (location) field to an existing custom type.
278
+ prismic custom-type add-field embed homepage media --label "Media Embed"`);return}if(!c){console.error(`Missing required argument: type-id
279
+ `),console.error(`Usage: prismic custom-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
280
+ `),console.error(`Usage: prismic custom-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(Qn,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${c}\n`),console.error(`Create it first with: prismic custom-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`Embed`,config:{label:i??J(l),...a&&{placeholder:a}}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Added field "${l}" (Embed) to "${m}" tab in ${c}`);try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const er=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function tr(){let{values:{help:t,tab:n,label:i,types:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geo-point (location) field to an existing custom type.
293
281
 
294
282
  USAGE
295
283
  prismic custom-type add-field geo-point <type-id> <field-id> [flags]
@@ -298,21 +286,18 @@ ARGUMENTS
298
286
  type-id Custom type identifier (required)
299
287
  field-id Field identifier (required)
300
288
 
301
- Types are generated by default after changes. Use --no-types to skip.
302
-
303
289
  FLAGS
304
290
  -t, --tab string Target tab (default: first existing tab, or "Main")
305
291
  -l, --label string Display label for the field (inferred from field-id if omitted)
306
292
  --types string Output file for generated types (default: "prismicio-types.d.ts")
307
- --no-types Skip type generation
308
293
  -h, --help Show help for command
309
294
 
310
295
  EXAMPLES
311
296
  prismic custom-type add-field geo-point homepage location
312
297
  prismic custom-type add-field geo-point store address --tab "Details"
313
- prismic custom-type add-field geo-point event venue --label "Event Venue"`);return}if(!c){console.error(`Missing required argument: type-id
314
- `),console.error(`Usage: prismic custom-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
315
- `),console.error(`Usage: prismic custom-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(er,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${c}\n`),console.error(`Create it first with: prismic custom-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`GeoPoint`,config:{label:i??J(l)}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${l}" (GeoPoint) to "${m}" tab in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const nr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function rr(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing custom type.
298
+ prismic custom-type add-field geo-point event venue --label "Event Venue"`);return}if(!o){console.error(`Missing required argument: type-id
299
+ `),console.error(`Usage: prismic custom-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
300
+ `),console.error(`Usage: prismic custom-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}let l=await W(`package.json`);if(!l){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let u=new URL(`customtypes/${o}/index.json`,l),d;try{let e=await r(u,`utf8`),t=B(er,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${u.href}`),process.exitCode=1;return}d=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${o}\n`),console.error(`Create it first with: prismic custom-type create ${o}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let f=Object.keys(d.json),p=n??f[0]??`Main`;d.json[p]||(d.json[p]={});for(let[e,t]of Object.entries(d.json))if(t[c]){console.error(`Field "${c}" already exists in tab "${e}"`),process.exitCode=1;return}let m={type:`GeoPoint`,config:{label:i??J(c)}};d.json[p][c]=m;try{await s(u,q(d))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Added field "${c}" (GeoPoint) to "${p}" tab in ${o}`);try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const nr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function rr(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing custom type.
316
301
 
317
302
  USAGE
318
303
  prismic custom-type add-field image <type-id> <field-id> [flags]
@@ -321,22 +306,19 @@ ARGUMENTS
321
306
  type-id Custom type identifier (required)
322
307
  field-id Field identifier (required)
323
308
 
324
- Types are generated by default after changes. Use --no-types to skip.
325
-
326
309
  FLAGS
327
310
  -t, --tab string Target tab (default: first existing tab, or "Main")
328
311
  -l, --label string Display label for the field (inferred from field-id if omitted)
329
312
  -p, --placeholder string Placeholder text
330
313
  --types string Output file for generated types (default: "prismicio-types.d.ts")
331
- --no-types Skip type generation
332
314
  -h, --help Show help for command
333
315
 
334
316
  EXAMPLES
335
317
  prismic custom-type add-field image homepage hero
336
318
  prismic custom-type add-field image article thumbnail --tab "Media"
337
- prismic custom-type add-field image product photo --label "Product Photo"`);return}if(!l){console.error(`Missing required argument: type-id
338
- `),console.error(`Usage: prismic custom-type add-field image <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
339
- `),console.error(`Usage: prismic custom-type add-field image <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(nr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Image`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Image) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const ir=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function ar(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing custom type.
319
+ prismic custom-type add-field image product photo --label "Product Photo"`);return}if(!c){console.error(`Missing required argument: type-id
320
+ `),console.error(`Usage: prismic custom-type add-field image <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
321
+ `),console.error(`Usage: prismic custom-type add-field image <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(nr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${c}\n`),console.error(`Create it first with: prismic custom-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`Image`,config:{label:i??J(l),...a&&{placeholder:a}}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Added field "${l}" (Image) to "${m}" tab in ${c}`);try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const ir=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function ar(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing custom type.
340
322
 
341
323
  USAGE
342
324
  prismic custom-type add-field key-text <type-id> <field-id> [flags]
@@ -345,22 +327,19 @@ ARGUMENTS
345
327
  type-id Custom type identifier (required)
346
328
  field-id Field identifier (required)
347
329
 
348
- Types are generated by default after changes. Use --no-types to skip.
349
-
350
330
  FLAGS
351
331
  -t, --tab string Target tab (default: first existing tab, or "Main")
352
332
  -l, --label string Display label for the field (inferred from field-id if omitted)
353
333
  -p, --placeholder string Placeholder text
354
334
  --types string Output file for generated types (default: "prismicio-types.d.ts")
355
- --no-types Skip type generation
356
335
  -h, --help Show help for command
357
336
 
358
337
  EXAMPLES
359
338
  prismic custom-type add-field key-text homepage title
360
339
  prismic custom-type add-field key-text homepage meta_title --tab "SEO"
361
- prismic custom-type add-field key-text homepage subtitle --label "Subtitle" --placeholder "Enter subtitle"`);return}if(!l){console.error(`Missing required argument: type-id
362
- `),console.error(`Usage: prismic custom-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
363
- `),console.error(`Usage: prismic custom-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(ir,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Text`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Text) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const or=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function sr(){let{values:{help:t,tab:n,label:i,placeholder:a,variation:o,"allow-text":c,"allow-target-blank":l,repeatable:u,types:d,"no-types":f},positionals:[p,m]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},variation:{type:`string`,multiple:!0},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing custom type.
340
+ prismic custom-type add-field key-text homepage subtitle --label "Subtitle" --placeholder "Enter subtitle"`);return}if(!c){console.error(`Missing required argument: type-id
341
+ `),console.error(`Usage: prismic custom-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
342
+ `),console.error(`Usage: prismic custom-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(ir,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${c}\n`),console.error(`Create it first with: prismic custom-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`Text`,config:{label:i??J(l),...a&&{placeholder:a}}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Added field "${l}" (Text) to "${m}" tab in ${c}`);try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const or=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function sr(){let{values:{help:t,tab:n,label:i,placeholder:a,variation:o,"allow-text":c,"allow-target-blank":l,repeatable:u,types:d},positionals:[f,p]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},variation:{type:`string`,multiple:!0},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing custom type.
364
343
 
365
344
  USAGE
366
345
  prismic custom-type add-field link <type-id> <field-id> [flags]
@@ -369,8 +348,6 @@ ARGUMENTS
369
348
  type-id Custom type identifier (required)
370
349
  field-id Field identifier (required)
371
350
 
372
- Types are generated by default after changes. Use --no-types to skip.
373
-
374
351
  FLAGS
375
352
  -t, --tab string Target tab (default: first existing tab, or "Main")
376
353
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -380,16 +357,15 @@ FLAGS
380
357
  --allow-target-blank Allow opening link in new tab
381
358
  --repeatable Allow multiple links
382
359
  --types string Output file for generated types (default: "prismicio-types.d.ts")
383
- --no-types Skip type generation
384
360
  -h, --help Show help for command
385
361
 
386
362
  EXAMPLES
387
363
  prismic custom-type add-field link homepage button
388
364
  prismic custom-type add-field link homepage cta --allow-text
389
365
  prismic custom-type add-field link homepage cta --variation Primary --variation Secondary
390
- prismic custom-type add-field link homepage links --repeatable`);return}if(!p){console.error(`Missing required argument: type-id
391
- `),console.error(`Usage: prismic custom-type add-field link <type-id> <field-id>`),process.exitCode=1;return}if(!m){console.error(`Missing required argument: field-id
392
- `),console.error(`Usage: prismic custom-type add-field link <type-id> <field-id>`),process.exitCode=1;return}let h=await W(`package.json`);if(!h){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let g=new URL(`customtypes/${p}/index.json`,h),_;try{let e=await r(g,`utf8`),t=B(or,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${g.href}`),process.exitCode=1;return}_=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${p}\n`),console.error(`Create it first with: prismic custom-type create ${p}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let v=Object.keys(_.json),y=n??v[0]??`Main`;_.json[y]||(_.json[y]={});for(let[e,t]of Object.entries(_.json))if(t[m]){console.error(`Field "${m}" already exists in tab "${e}"`),process.exitCode=1;return}let b={type:`Link`,config:{label:i??J(m),...a&&{placeholder:a},...o&&o.length>0&&{variants:o},...c&&{allowText:!0},...l&&{allowTargetBlank:!0},...u&&{repeat:!0}}};_.json[y][m]=b;try{await s(g,q(_))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${m}" (Link) to "${y}" tab in ${p}`),!f)try{await K({output:d}),console.info(`Updated types in ${d??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const cr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function lr(){let{values:{help:t,tab:n,label:i,placeholder:a,min:o,max:c,step:l,types:u,"no-types":d},positionals:[f,p]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},min:{type:`string`},max:{type:`string`},step:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing custom type.
366
+ prismic custom-type add-field link homepage links --repeatable`);return}if(!f){console.error(`Missing required argument: type-id
367
+ `),console.error(`Usage: prismic custom-type add-field link <type-id> <field-id>`),process.exitCode=1;return}if(!p){console.error(`Missing required argument: field-id
368
+ `),console.error(`Usage: prismic custom-type add-field link <type-id> <field-id>`),process.exitCode=1;return}let m=await W(`package.json`);if(!m){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let h=new URL(`customtypes/${f}/index.json`,m),g;try{let e=await r(h,`utf8`),t=B(or,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${h.href}`),process.exitCode=1;return}g=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${f}\n`),console.error(`Create it first with: prismic custom-type create ${f}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let _=Object.keys(g.json),v=n??_[0]??`Main`;g.json[v]||(g.json[v]={});for(let[e,t]of Object.entries(g.json))if(t[p]){console.error(`Field "${p}" already exists in tab "${e}"`),process.exitCode=1;return}let y={type:`Link`,config:{label:i??J(p),...a&&{placeholder:a},...o&&o.length>0&&{variants:o},...c&&{allowText:!0},...l&&{allowTargetBlank:!0},...u&&{repeat:!0}}};g.json[v][p]=y;try{await s(h,q(g))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Added field "${p}" (Link) to "${v}" tab in ${f}`);try{await K({output:d}),console.info(`Updated types in ${d??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const cr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function lr(){let{values:{help:t,tab:n,label:i,placeholder:a,min:o,max:c,step:l,types:u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},min:{type:`string`},max:{type:`string`},step:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing custom type.
393
369
 
394
370
  USAGE
395
371
  prismic custom-type add-field number <type-id> <field-id> [flags]
@@ -398,8 +374,6 @@ ARGUMENTS
398
374
  type-id Custom type identifier (required)
399
375
  field-id Field identifier (required)
400
376
 
401
- Types are generated by default after changes. Use --no-types to skip.
402
-
403
377
  FLAGS
404
378
  -t, --tab string Target tab (default: first existing tab, or "Main")
405
379
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -408,15 +382,14 @@ FLAGS
408
382
  --max number Maximum value
409
383
  --step number Step increment
410
384
  --types string Output file for generated types (default: "prismicio-types.d.ts")
411
- --no-types Skip type generation
412
385
  -h, --help Show help for command
413
386
 
414
387
  EXAMPLES
415
388
  prismic custom-type add-field number homepage price
416
389
  prismic custom-type add-field number product quantity --min 0 --max 100
417
- prismic custom-type add-field number settings rating --min 1 --max 5 --step 1`);return}if(!f){console.error(`Missing required argument: type-id
418
- `),console.error(`Usage: prismic custom-type add-field number <type-id> <field-id>`),process.exitCode=1;return}if(!p){console.error(`Missing required argument: field-id
419
- `),console.error(`Usage: prismic custom-type add-field number <type-id> <field-id>`),process.exitCode=1;return}let m=o===void 0?void 0:Number(o),h=c===void 0?void 0:Number(c),g=l===void 0?void 0:Number(l);if(o!==void 0&&Number.isNaN(m)){console.error(`Invalid --min value: must be a number`),process.exitCode=1;return}if(c!==void 0&&Number.isNaN(h)){console.error(`Invalid --max value: must be a number`),process.exitCode=1;return}if(l!==void 0&&Number.isNaN(g)){console.error(`Invalid --step value: must be a number`),process.exitCode=1;return}let _=await W(`package.json`);if(!_){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let v=new URL(`customtypes/${f}/index.json`,_),y;try{let e=await r(v,`utf8`),t=B(cr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${v.href}`),process.exitCode=1;return}y=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${f}\n`),console.error(`Create it first with: prismic custom-type create ${f}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let b=Object.keys(y.json),x=n??b[0]??`Main`;y.json[x]||(y.json[x]={});for(let[e,t]of Object.entries(y.json))if(t[p]){console.error(`Field "${p}" already exists in tab "${e}"`),process.exitCode=1;return}let ee={type:`Number`,config:{label:i??J(p),...a&&{placeholder:a},...m!==void 0&&{min:m},...h!==void 0&&{max:h},...g!==void 0&&{step:g}}};y.json[x][p]=ee;try{await s(v,q(y))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${p}" (Number) to "${x}" tab in ${f}`),!d)try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const ur=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function dr(){let{values:{help:t,tab:n,label:i,placeholder:a,single:o,multi:c,"allow-target-blank":l,types:u,"no-types":d},positionals:[f,p]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing custom type.
390
+ prismic custom-type add-field number settings rating --min 1 --max 5 --step 1`);return}if(!d){console.error(`Missing required argument: type-id
391
+ `),console.error(`Usage: prismic custom-type add-field number <type-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
392
+ `),console.error(`Usage: prismic custom-type add-field number <type-id> <field-id>`),process.exitCode=1;return}let p=o===void 0?void 0:Number(o),m=c===void 0?void 0:Number(c),h=l===void 0?void 0:Number(l);if(o!==void 0&&Number.isNaN(p)){console.error(`Invalid --min value: must be a number`),process.exitCode=1;return}if(c!==void 0&&Number.isNaN(m)){console.error(`Invalid --max value: must be a number`),process.exitCode=1;return}if(l!==void 0&&Number.isNaN(h)){console.error(`Invalid --step value: must be a number`),process.exitCode=1;return}let g=await W(`package.json`);if(!g){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let _=new URL(`customtypes/${d}/index.json`,g),v;try{let e=await r(_,`utf8`),t=B(cr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${_.href}`),process.exitCode=1;return}v=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${d}\n`),console.error(`Create it first with: prismic custom-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let y=Object.keys(v.json),b=n??y[0]??`Main`;v.json[b]||(v.json[b]={});for(let[e,t]of Object.entries(v.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let x={type:`Number`,config:{label:i??J(f),...a&&{placeholder:a},...p!==void 0&&{min:p},...m!==void 0&&{max:m},...h!==void 0&&{step:h}}};v.json[b][f]=x;try{await s(_,q(v))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Added field "${f}" (Number) to "${b}" tab in ${d}`);try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const ur=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function dr(){let{values:{help:t,tab:n,label:i,placeholder:a,single:o,multi:c,"allow-target-blank":l,types:u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing custom type.
420
393
 
421
394
  USAGE
422
395
  prismic custom-type add-field rich-text <type-id> <field-id> [flags]
@@ -425,8 +398,6 @@ ARGUMENTS
425
398
  type-id Custom type identifier (required)
426
399
  field-id Field identifier (required)
427
400
 
428
- Types are generated by default after changes. Use --no-types to skip.
429
-
430
401
  FLAGS
431
402
  -t, --tab string Target tab (default: first existing tab, or "Main")
432
403
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -435,7 +406,6 @@ FLAGS
435
406
  --multi string Allowed block types for multi-line (comma-separated)
436
407
  --allow-target-blank Allow opening links in new tab
437
408
  --types string Output file for generated types (default: "prismicio-types.d.ts")
438
- --no-types Skip type generation
439
409
  -h, --help Show help for command
440
410
 
441
411
  BLOCK TYPES
@@ -447,9 +417,9 @@ EXAMPLES
447
417
  prismic custom-type add-field rich-text homepage body
448
418
  prismic custom-type add-field rich-text article content --multi "paragraph,heading2,heading3,strong,em,hyperlink"
449
419
  prismic custom-type add-field rich-text page tagline --single "heading1"
450
- prismic custom-type add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!f){console.error(`Missing required argument: type-id
451
- `),console.error(`Usage: prismic custom-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}if(!p){console.error(`Missing required argument: field-id
452
- `),console.error(`Usage: prismic custom-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}let m=await W(`package.json`);if(!m){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let h=new URL(`customtypes/${f}/index.json`,m),g;try{let e=await r(h,`utf8`),t=B(ur,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${h.href}`),process.exitCode=1;return}g=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${f}\n`),console.error(`Create it first with: prismic custom-type create ${f}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let _=Object.keys(g.json),v=n??_[0]??`Main`;g.json[v]||(g.json[v]={});for(let[e,t]of Object.entries(g.json))if(t[p]){console.error(`Field "${p}" already exists in tab "${e}"`),process.exitCode=1;return}let y={type:`StructuredText`,config:{label:i??J(p),...a&&{placeholder:a},...o&&{single:o},...c&&{multi:c},...l&&{allowTargetBlank:!0}}};g.json[v][p]=y;try{await s(h,q(g))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${p}" (StructuredText) to "${v}" tab in ${f}`),!d)try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const fr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function pr(){let{values:{help:t,tab:n,label:i,placeholder:a,option:o,default:c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing custom type.
420
+ prismic custom-type add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!d){console.error(`Missing required argument: type-id
421
+ `),console.error(`Usage: prismic custom-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
422
+ `),console.error(`Usage: prismic custom-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}let p=await W(`package.json`);if(!p){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let m=new URL(`customtypes/${d}/index.json`,p),h;try{let e=await r(m,`utf8`),t=B(ur,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${m.href}`),process.exitCode=1;return}h=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${d}\n`),console.error(`Create it first with: prismic custom-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let g=Object.keys(h.json),_=n??g[0]??`Main`;h.json[_]||(h.json[_]={});for(let[e,t]of Object.entries(h.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let v={type:`StructuredText`,config:{label:i??J(f),...a&&{placeholder:a},...o&&{single:o},...c&&{multi:c},...l&&{allowTargetBlank:!0}}};h.json[_][f]=v;try{await s(m,q(h))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Added field "${f}" (StructuredText) to "${_}" tab in ${d}`);try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const fr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function pr(){let{values:{help:t,tab:n,label:i,placeholder:a,option:o,default:c,types:l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing custom type.
453
423
 
454
424
  USAGE
455
425
  prismic custom-type add-field select <type-id> <field-id> [flags]
@@ -458,8 +428,6 @@ ARGUMENTS
458
428
  type-id Custom type identifier (required)
459
429
  field-id Field identifier (required)
460
430
 
461
- Types are generated by default after changes. Use --no-types to skip.
462
-
463
431
  FLAGS
464
432
  -t, --tab string Target tab (default: first existing tab, or "Main")
465
433
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -467,15 +435,14 @@ FLAGS
467
435
  --option string Add an option (can be used multiple times)
468
436
  --default string Default selected value
469
437
  --types string Output file for generated types (default: "prismicio-types.d.ts")
470
- --no-types Skip type generation
471
438
  -h, --help Show help for command
472
439
 
473
440
  EXAMPLES
474
441
  prismic custom-type add-field select homepage layout --option "full" --option "sidebar"
475
442
  prismic custom-type add-field select product size --option "small" --option "medium" --option "large" --default "medium"
476
- prismic custom-type add-field select article status --option "draft" --option "published" --label "Status"`);return}if(!d){console.error(`Missing required argument: type-id
477
- `),console.error(`Usage: prismic custom-type add-field select <type-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
478
- `),console.error(`Usage: prismic custom-type add-field select <type-id> <field-id>`),process.exitCode=1;return}let p=await W(`package.json`);if(!p){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let m=new URL(`customtypes/${d}/index.json`,p),h;try{let e=await r(m,`utf8`),t=B(fr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${m.href}`),process.exitCode=1;return}h=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${d}\n`),console.error(`Create it first with: prismic custom-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let g=Object.keys(h.json),_=n??g[0]??`Main`;h.json[_]||(h.json[_]={});for(let[e,t]of Object.entries(h.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let v={type:`Select`,config:{label:i??J(f),...a&&{placeholder:a},...o&&o.length>0&&{options:o},...c&&{default_value:c}}};h.json[_][f]=v;try{await s(m,q(h))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Select) to "${_}" tab in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const mr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function hr(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a timestamp (date and time) field to an existing custom type.
443
+ prismic custom-type add-field select article status --option "draft" --option "published" --label "Status"`);return}if(!u){console.error(`Missing required argument: type-id
444
+ `),console.error(`Usage: prismic custom-type add-field select <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
445
+ `),console.error(`Usage: prismic custom-type add-field select <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(fr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${u}\n`),console.error(`Create it first with: prismic custom-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Select`,config:{label:i??J(d),...a&&{placeholder:a},...o&&o.length>0&&{options:o},...c&&{default_value:c}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Added field "${d}" (Select) to "${g}" tab in ${u}`);try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const mr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function hr(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a timestamp (date and time) field to an existing custom type.
479
446
 
480
447
  USAGE
481
448
  prismic custom-type add-field timestamp <type-id> <field-id> [flags]
@@ -484,23 +451,20 @@ ARGUMENTS
484
451
  type-id Custom type identifier (required)
485
452
  field-id Field identifier (required)
486
453
 
487
- Types are generated by default after changes. Use --no-types to skip.
488
-
489
454
  FLAGS
490
455
  -t, --tab string Target tab (default: first existing tab, or "Main")
491
456
  -l, --label string Display label for the field (inferred from field-id if omitted)
492
457
  -p, --placeholder string Placeholder text
493
458
  --default string Default timestamp value (ISO 8601 format)
494
459
  --types string Output file for generated types (default: "prismicio-types.d.ts")
495
- --no-types Skip type generation
496
460
  -h, --help Show help for command
497
461
 
498
462
  EXAMPLES
499
463
  prismic custom-type add-field timestamp homepage event_time
500
464
  prismic custom-type add-field timestamp event start --tab "Schedule"
501
- prismic custom-type add-field timestamp article published_at --label "Published At"`);return}if(!u){console.error(`Missing required argument: type-id
502
- `),console.error(`Usage: prismic custom-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
503
- `),console.error(`Usage: prismic custom-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(mr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${u}\n`),console.error(`Create it first with: prismic custom-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Timestamp`,config:{label:i??J(d),...a&&{placeholder:a},...o&&{default:o}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Timestamp) to "${g}" tab in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const gr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function _r(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a UID (unique identifier) field to an existing custom type.
465
+ prismic custom-type add-field timestamp article published_at --label "Published At"`);return}if(!l){console.error(`Missing required argument: type-id
466
+ `),console.error(`Usage: prismic custom-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
467
+ `),console.error(`Usage: prismic custom-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(mr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Timestamp`,config:{label:i??J(u),...a&&{placeholder:a},...o&&{default:o}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Added field "${u}" (Timestamp) to "${h}" tab in ${l}`);try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const gr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function _r(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a UID (unique identifier) field to an existing custom type.
504
468
 
505
469
  USAGE
506
470
  prismic custom-type add-field uid <type-id> <field-id> [flags]
@@ -509,22 +473,19 @@ ARGUMENTS
509
473
  type-id Custom type identifier (required)
510
474
  field-id Field identifier (required)
511
475
 
512
- Types are generated by default after changes. Use --no-types to skip.
513
-
514
476
  FLAGS
515
477
  -t, --tab string Target tab (default: first existing tab, or "Main")
516
478
  -l, --label string Display label for the field (inferred from field-id if omitted)
517
479
  -p, --placeholder string Placeholder text
518
480
  --types string Output file for generated types (default: "prismicio-types.d.ts")
519
- --no-types Skip type generation
520
481
  -h, --help Show help for command
521
482
 
522
483
  EXAMPLES
523
484
  prismic custom-type add-field uid page uid
524
485
  prismic custom-type add-field uid article slug --label "URL Slug"
525
- prismic custom-type add-field uid product sku --placeholder "Enter unique SKU"`);return}if(!l){console.error(`Missing required argument: type-id
526
- `),console.error(`Usage: prismic custom-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
527
- `),console.error(`Usage: prismic custom-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(gr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`UID`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (UID) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function vr(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await qn();break;case`color`:await Yn();break;case`date`:await Zn();break;case`embed`:await $n();break;case`geo-point`:await tr();break;case`image`:await rr();break;case`key-text`:await ar();break;case`link`:await sr();break;case`number`:await lr();break;case`rich-text`:await dr();break;case`select`:await pr();break;case`timestamp`:await hr();break;case`uid`:await _r();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing custom type.
486
+ prismic custom-type add-field uid product sku --placeholder "Enter unique SKU"`);return}if(!c){console.error(`Missing required argument: type-id
487
+ `),console.error(`Usage: prismic custom-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
488
+ `),console.error(`Usage: prismic custom-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(gr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${c}\n`),console.error(`Create it first with: prismic custom-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`UID`,config:{label:i??J(l),...a&&{placeholder:a}}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Added field "${l}" (UID) to "${m}" tab in ${c}`);try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function vr(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await qn();break;case`color`:await Yn();break;case`date`:await Zn();break;case`embed`:await $n();break;case`geo-point`:await tr();break;case`image`:await rr();break;case`key-text`:await ar();break;case`link`:await sr();break;case`number`:await lr();break;case`rich-text`:await dr();break;case`select`:await pr();break;case`timestamp`:await hr();break;case`uid`:await _r();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing custom type.
528
489
 
529
490
  USAGE
530
491
  prismic custom-type add-field <field-type> <type-id> <field-id> [flags]
@@ -554,7 +515,7 @@ EXAMPLES
554
515
  prismic custom-type add-field key-text homepage meta_title --tab "SEO"
555
516
  prismic custom-type add-field link homepage button --allow-text
556
517
  prismic custom-type add-field rich-text homepage body --multi "paragraph,heading2,strong,em"
557
- prismic custom-type add-field select homepage layout --option "full" --option "sidebar"`)}}const yr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function br(){let{values:{help:t,"slice-zone":n,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Connect a shared slice to a custom type's slice zone.
518
+ prismic custom-type add-field select homepage layout --option "full" --option "sidebar"`)}}const yr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function br(){let{values:{help:t,"slice-zone":n,types:i},positionals:[a,o]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Connect a shared slice to a custom type's slice zone.
558
519
 
559
520
  USAGE
560
521
  prismic custom-type connect-slice <type-id> <slice-id> [flags]
@@ -563,20 +524,17 @@ ARGUMENTS
563
524
  type-id Custom type identifier (required)
564
525
  slice-id Slice identifier (required)
565
526
 
566
- Types are generated by default after changes. Use --no-types to skip.
567
-
568
527
  FLAGS
569
528
  -z, --slice-zone string Target slice zone field ID (default: "slices")
570
529
  --types string Output file for generated types (default: "prismicio-types.d.ts")
571
- --no-types Skip type generation
572
530
  -h, --help Show help for command
573
531
 
574
532
  EXAMPLES
575
533
  prismic custom-type connect-slice homepage CallToAction
576
534
  prismic custom-type connect-slice homepage CallToAction --slice-zone slices
577
- prismic custom-type connect-slice article HeroSection -z body`);return}if(!o){console.error(`Missing required argument: type-id
578
- `),console.error(`Usage: prismic custom-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: slice-id
579
- `),console.error(`Usage: prismic custom-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}let l=await G(c);if(!l.ok){console.error(l.error),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${o}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(yr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${o}\n`),console.error(`Create it first with: prismic custom-type create ${o}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let p=n??`slices`,m,h;for(let[,e]of Object.entries(f.json)){for(let[t,n]of Object.entries(e))if(n.type===`Slices`&&t===p){m=n,h=t;break}if(m)break}if(!m){if(n){console.error(`Slice zone "${n}" not found in custom type "${o}"`),process.exitCode=1;return}let e=Object.keys(f.json)[0]??`Main`;f.json[e]||(f.json[e]={});let t={type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}};f.json[e][p]=t,m=t,h=p}if(m.config||={choices:{}},m.config.choices||(m.config.choices={}),c in m.config.choices){console.info(`Slice "${c}" is already connected to slice zone "${h}" in ${o}`);return}let g={type:`SharedSlice`};m.config.choices[c]=g;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Connected slice "${c}" to slice zone "${h}" in ${o}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function xr(){let{values:{help:t,name:r,single:i,types:a,"no-types":o},positionals:[c]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},single:{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Create a new custom type in a Prismic repository.
535
+ prismic custom-type connect-slice article HeroSection -z body`);return}if(!a){console.error(`Missing required argument: type-id
536
+ `),console.error(`Usage: prismic custom-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: slice-id
537
+ `),console.error(`Usage: prismic custom-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}let c=await G(o);if(!c.ok){console.error(c.error),process.exitCode=1;return}let l=await W(`package.json`);if(!l){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let u=new URL(`customtypes/${a}/index.json`,l),d;try{let e=await r(u,`utf8`),t=B(yr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${u.href}`),process.exitCode=1;return}d=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${a}\n`),console.error(`Create it first with: prismic custom-type create ${a}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let f=n??`slices`,p,m;for(let[,e]of Object.entries(d.json)){for(let[t,n]of Object.entries(e))if(n.type===`Slices`&&t===f){p=n,m=t;break}if(p)break}if(!p){if(n){console.error(`Slice zone "${n}" not found in custom type "${a}"`),process.exitCode=1;return}let e=Object.keys(d.json)[0]??`Main`;d.json[e]||(d.json[e]={});let t={type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}};d.json[e][f]=t,p=t,m=f}if(p.config||={choices:{}},p.config.choices||(p.config.choices={}),o in p.config.choices){console.info(`Slice "${o}" is already connected to slice zone "${m}" in ${a}`);return}let h={type:`SharedSlice`};p.config.choices[o]=h;try{await s(u,q(d))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Connected slice "${o}" to slice zone "${m}" in ${a}`);try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function xr(){let{values:{help:t,name:r,single:i,types:a},positionals:[o]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},single:{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Create a new custom type in a Prismic repository.
580
538
 
581
539
  USAGE
582
540
  prismic custom-type create <id> [flags]
@@ -584,17 +542,14 @@ USAGE
584
542
  ARGUMENTS
585
543
  id Custom type identifier (required)
586
544
 
587
- Types are generated by default after changes. Use --no-types to skip.
588
-
589
545
  FLAGS
590
546
  -n, --name string Display name for the custom type
591
547
  --single Create as a singleton (non-repeatable) type
592
548
  --types string Output file for generated types (default: "prismicio-types.d.ts")
593
- --no-types Skip type generation
594
549
  -h, --help Show help for command
595
550
 
596
551
  LEARN MORE
597
- Use \`prismic custom-type <command> --help\` for more information about a command.`);return}if(!c){console.error(`Missing required argument: id`),process.exitCode=1;return}let l={id:c,label:r??Sr(c),repeatable:!i,status:!0,format:`custom`,json:{Main:{}}},u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/`,u),f=new URL(c+`/`,d),p=new URL(`index.json`,f);try{await n(new URL(`.`,p),{recursive:!0}),await s(p,q(l))}catch(e){e instanceof Error?console.error(`Failed to create custom type: ${e.message}`):console.error(`Failed to create custom type`),process.exitCode=1;return}if(console.info(`Created custom type at ${p.href}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add fields with `prismic custom-type add-field`")}function Sr(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}const Cr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function wr(){let{values:{help:t,"slice-zone":n,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Disconnect a shared slice from a custom type's slice zone.
552
+ Use \`prismic custom-type <command> --help\` for more information about a command.`);return}if(!o){console.error(`Missing required argument: id`),process.exitCode=1;return}let c={id:o,label:r??Sr(o),repeatable:!i,status:!0,format:`custom`,json:{Main:{}}},l=await W(`package.json`);if(!l){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let u=new URL(`customtypes/`,l),d=new URL(o+`/`,u),f=new URL(`index.json`,d);try{await n(new URL(`.`,f),{recursive:!0}),await s(f,q(c))}catch(e){e instanceof Error?console.error(`Failed to create custom type: ${e.message}`):console.error(`Failed to create custom type`),process.exitCode=1;return}console.info(`Created custom type at ${f.href}`);try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add fields with `prismic custom-type add-field`")}function Sr(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}const Cr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function wr(){let{values:{help:t,"slice-zone":n,types:i},positionals:[a,o]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Disconnect a shared slice from a custom type's slice zone.
598
553
 
599
554
  USAGE
600
555
  prismic custom-type disconnect-slice <type-id> <slice-id> [flags]
@@ -603,20 +558,17 @@ ARGUMENTS
603
558
  type-id Custom type identifier (required)
604
559
  slice-id Slice identifier (required)
605
560
 
606
- Types are generated by default after changes. Use --no-types to skip.
607
-
608
561
  FLAGS
609
562
  -z, --slice-zone string Target slice zone field ID (default: "slices")
610
563
  --types string Output file for generated types (default: "prismicio-types.d.ts")
611
- --no-types Skip type generation
612
564
  -h, --help Show help for command
613
565
 
614
566
  EXAMPLES
615
567
  prismic custom-type disconnect-slice homepage CallToAction
616
568
  prismic custom-type disconnect-slice homepage CallToAction --slice-zone slices
617
- prismic custom-type disconnect-slice article HeroSection -z body`);return}if(!o){console.error(`Missing required argument: type-id
618
- `),console.error(`Usage: prismic custom-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: slice-id
619
- `),console.error(`Usage: prismic custom-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}let l=await W(`package.json`);if(!l){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let u=new URL(`customtypes/${o}/index.json`,l),d;try{let e=await r(u,`utf8`),t=B(Cr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${u.href}`),process.exitCode=1;return}d=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${o}\n`),console.error(`Create it first with: prismic custom-type create ${o}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let f=n??`slices`,p,m;for(let[,e]of Object.entries(d.json)){for(let[t,n]of Object.entries(e))if(n.type===`Slices`&&t===f){p=n,m=t;break}if(p)break}if(!p){console.error(`Slice zone "${f}" not found in custom type "${o}"`),process.exitCode=1;return}if(!p.config?.choices||!(c in p.config.choices)){console.error(`Slice "${c}" is not connected to slice zone "${m}" in ${o}`),process.exitCode=1;return}delete p.config.choices[c];try{await s(u,q(d))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Disconnected slice "${c}" from slice zone "${m}" in ${o}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Tr=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function Er(){let{values:{help:t,json:n}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`List all custom types in a Prismic project.
569
+ prismic custom-type disconnect-slice article HeroSection -z body`);return}if(!a){console.error(`Missing required argument: type-id
570
+ `),console.error(`Usage: prismic custom-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: slice-id
571
+ `),console.error(`Usage: prismic custom-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}let c=await W(`package.json`);if(!c){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let l=new URL(`customtypes/${a}/index.json`,c),u;try{let e=await r(l,`utf8`),t=B(Cr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${l.href}`),process.exitCode=1;return}u=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${a}\n`),console.error(`Create it first with: prismic custom-type create ${a}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let d=n??`slices`,f,p;for(let[,e]of Object.entries(u.json)){for(let[t,n]of Object.entries(e))if(n.type===`Slices`&&t===d){f=n,p=t;break}if(f)break}if(!f){console.error(`Slice zone "${d}" not found in custom type "${a}"`),process.exitCode=1;return}if(!f.config?.choices||!(o in f.config.choices)){console.error(`Slice "${o}" is not connected to slice zone "${p}" in ${a}`),process.exitCode=1;return}delete f.config.choices[o];try{await s(l,q(u))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Disconnected slice "${o}" from slice zone "${p}" in ${a}`);try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Tr=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function Er(){let{values:{help:t,json:n}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`List all custom types in a Prismic project.
620
572
 
621
573
  USAGE
622
574
  prismic custom-type list [flags]
@@ -627,7 +579,7 @@ FLAGS
627
579
 
628
580
  EXAMPLES
629
581
  prismic custom-type list
630
- prismic custom-type list --json`);return}let a=await W(`package.json`);if(!a){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let o=new URL(`customtypes/`,a),s;try{s=await i(o,{withFileTypes:!1})}catch{n?console.info(JSON.stringify([])):console.info(`No custom types found.`);return}let c=[];for(let e of s){let t=new URL(`${e}/index.json`,o);try{let e=await r(t,`utf8`),n=B(Tr,JSON.parse(e));n.success&&n.output.format!==`page`&&c.push({id:n.output.id,label:n.output.label,repeatable:n.output.repeatable})}catch{}}if(c.length===0){n?console.info(JSON.stringify([])):console.info(`No custom types found.`);return}if(n)console.info(JSON.stringify(c,null,2));else{console.info(`ID LABEL TYPE`);for(let e of c){let t=e.repeatable?`repeatable`:`singleton`;console.info(`${e.id}\t${e.label}\t${t}`)}}}const Dr=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function Or(){let{values:{help:t,y:n,types:i,"no-types":a},positionals:[s]}=e({args:process.argv.slice(4),options:{y:{type:`boolean`,short:`y`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a custom type from the project.
582
+ prismic custom-type list --json`);return}let a=await W(`package.json`);if(!a){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let o=new URL(`customtypes/`,a),s;try{s=await i(o,{withFileTypes:!1})}catch{n?console.info(JSON.stringify([])):console.info(`No custom types found.`);return}let c=[];for(let e of s){let t=new URL(`${e}/index.json`,o);try{let e=await r(t,`utf8`),n=B(Tr,JSON.parse(e));n.success&&n.output.format!==`page`&&c.push({id:n.output.id,label:n.output.label,repeatable:n.output.repeatable})}catch{}}if(c.length===0){n?console.info(JSON.stringify([])):console.info(`No custom types found.`);return}if(n)console.info(JSON.stringify(c,null,2));else{console.info(`ID LABEL TYPE`);for(let e of c){let t=e.repeatable?`repeatable`:`singleton`;console.info(`${e.id}\t${e.label}\t${t}`)}}}const Dr=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function Or(){let{values:{help:t,y:n,types:i},positionals:[a]}=e({args:process.argv.slice(4),options:{y:{type:`boolean`,short:`y`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a custom type from the project.
631
583
 
632
584
  USAGE
633
585
  prismic custom-type remove <type-id> [flags]
@@ -635,18 +587,15 @@ USAGE
635
587
  ARGUMENTS
636
588
  type-id Custom type identifier (required)
637
589
 
638
- Types are generated by default after changes. Use --no-types to skip.
639
-
640
590
  FLAGS
641
591
  -y Confirm removal
642
592
  --types string Output file for generated types (default: "prismicio-types.d.ts")
643
- --no-types Skip type generation
644
593
  -h, --help Show help for command
645
594
 
646
595
  EXAMPLES
647
596
  prismic custom-type remove settings
648
- prismic custom-type remove settings -y`);return}if(!s){console.error(`Missing required argument: type-id
649
- `),console.error(`Usage: prismic custom-type remove <type-id>`),process.exitCode=1;return}let c=await W(`package.json`);if(!c){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let l=new URL(`customtypes/${s}/`,c),u=new URL(`index.json`,l),d;try{let e=await r(u,`utf8`),t=B(Dr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${u.href}`),process.exitCode=1;return}d=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${s}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}if(d.format===`page`){console.error(`"${s}" is not a custom type (format: page)`),process.exitCode=1;return}if(!n){console.error(`Refusing to remove custom type "${s}" (this will delete the entire directory).`),console.error(`Re-run with -y to confirm.`),process.exitCode=1;return}try{await o(l,{recursive:!0})}catch(e){e instanceof Error?console.error(`Failed to remove custom type: ${e.message}`):console.error(`Failed to remove custom type`),process.exitCode=1;return}if(console.info(`Removed custom type "${s}"`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const kr=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function Ar(){let{values:{help:t,tab:n,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{tab:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a field from a custom type.
597
+ prismic custom-type remove settings -y`);return}if(!a){console.error(`Missing required argument: type-id
598
+ `),console.error(`Usage: prismic custom-type remove <type-id>`),process.exitCode=1;return}let s=await W(`package.json`);if(!s){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let c=new URL(`customtypes/${a}/`,s),l=new URL(`index.json`,c),u;try{let e=await r(l,`utf8`),t=B(Dr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${l.href}`),process.exitCode=1;return}u=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${a}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}if(u.format===`page`){console.error(`"${a}" is not a custom type (format: page)`),process.exitCode=1;return}if(!n){console.error(`Refusing to remove custom type "${a}" (this will delete the entire directory).`),console.error(`Re-run with -y to confirm.`),process.exitCode=1;return}try{await o(c,{recursive:!0})}catch(e){e instanceof Error?console.error(`Failed to remove custom type: ${e.message}`):console.error(`Failed to remove custom type`),process.exitCode=1;return}console.info(`Removed custom type "${a}"`);try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const kr=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function Ar(){let{values:{help:t,tab:n,types:i},positionals:[a,o]}=e({args:process.argv.slice(4),options:{tab:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a field from a custom type.
650
599
 
651
600
  USAGE
652
601
  prismic custom-type remove-field <type-id> <field-id> [flags]
@@ -655,19 +604,16 @@ ARGUMENTS
655
604
  type-id Custom type identifier (required)
656
605
  field-id Field identifier (required)
657
606
 
658
- Types are generated by default after changes. Use --no-types to skip.
659
-
660
607
  FLAGS
661
608
  --tab string Specific tab (searches all tabs if not specified)
662
609
  --types string Output file for generated types (default: "prismicio-types.d.ts")
663
- --no-types Skip type generation
664
610
  -h, --help Show help for command
665
611
 
666
612
  EXAMPLES
667
613
  prismic custom-type remove-field settings title
668
- prismic custom-type remove-field settings description --tab "Content"`);return}if(!o){console.error(`Missing required argument: type-id
669
- `),console.error(`Usage: prismic custom-type remove-field <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
670
- `),console.error(`Usage: prismic custom-type remove-field <type-id> <field-id>`),process.exitCode=1;return}let l=await W(`package.json`);if(!l){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let u=new URL(`customtypes/${o}/index.json`,l),d;try{let e=await r(u,`utf8`),t=B(kr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${u.href}`),process.exitCode=1;return}d=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${o}\n`),console.error(`Create it first with: prismic custom-type create ${o}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}if(d.format===`page`){console.error(`"${o}" is not a custom type (format: page)`),process.exitCode=1;return}let f;if(n){if(!d.json[n]){console.error(`Tab "${n}" not found in custom type "${o}"`),console.error(`Available tabs: ${Object.keys(d.json).join(`, `)}`),process.exitCode=1;return}if(!(c in d.json[n])){console.error(`Field "${c}" not found in tab "${n}"`),process.exitCode=1;return}delete d.json[n][c],f=n}else{for(let[e,t]of Object.entries(d.json))if(c in t){delete t[c],f=e;break}if(!f){console.error(`Field "${c}" not found in any tab of custom type "${o}"`),process.exitCode=1;return}}try{await s(u,q(d))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Removed field "${c}" from tab "${f}" in custom type "${o}"`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const jr=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function Mr(){let{values:{help:t,types:n,"no-types":i},positionals:[a,o]}=e({args:process.argv.slice(4),options:{types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Change a custom type's display name (label).
614
+ prismic custom-type remove-field settings description --tab "Content"`);return}if(!a){console.error(`Missing required argument: type-id
615
+ `),console.error(`Usage: prismic custom-type remove-field <type-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
616
+ `),console.error(`Usage: prismic custom-type remove-field <type-id> <field-id>`),process.exitCode=1;return}let c=await W(`package.json`);if(!c){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let l=new URL(`customtypes/${a}/index.json`,c),u;try{let e=await r(l,`utf8`),t=B(kr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${l.href}`),process.exitCode=1;return}u=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${a}\n`),console.error(`Create it first with: prismic custom-type create ${a}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}if(u.format===`page`){console.error(`"${a}" is not a custom type (format: page)`),process.exitCode=1;return}let d;if(n){if(!u.json[n]){console.error(`Tab "${n}" not found in custom type "${a}"`),console.error(`Available tabs: ${Object.keys(u.json).join(`, `)}`),process.exitCode=1;return}if(!(o in u.json[n])){console.error(`Field "${o}" not found in tab "${n}"`),process.exitCode=1;return}delete u.json[n][o],d=n}else{for(let[e,t]of Object.entries(u.json))if(o in t){delete t[o],d=e;break}if(!d){console.error(`Field "${o}" not found in any tab of custom type "${a}"`),process.exitCode=1;return}}try{await s(l,q(u))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Removed field "${o}" from tab "${d}" in custom type "${a}"`);try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const jr=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function Mr(){let{values:{help:t,types:n},positionals:[i,a]}=e({args:process.argv.slice(4),options:{types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Change a custom type's display name (label).
671
617
 
672
618
  USAGE
673
619
  prismic custom-type set-name <type-id> <new-name> [flags]
@@ -676,18 +622,15 @@ ARGUMENTS
676
622
  type-id Custom type identifier (required)
677
623
  new-name New display name (required)
678
624
 
679
- Types are generated by default after changes. Use --no-types to skip.
680
-
681
625
  FLAGS
682
626
  --types string Output file for generated types (default: "prismicio-types.d.ts")
683
- --no-types Skip type generation
684
627
  -h, --help Show help for command
685
628
 
686
629
  EXAMPLES
687
630
  prismic custom-type set-name settings "Site Settings"
688
- prismic custom-type set-name menu "Navigation Menu"`);return}if(!a){console.error(`Missing required argument: type-id
689
- `),console.error(`Usage: prismic custom-type set-name <type-id> <new-name>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: new-name
690
- `),console.error(`Usage: prismic custom-type set-name <type-id> <new-name>`),process.exitCode=1;return}let c=await W(`package.json`);if(!c){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let l=new URL(`customtypes/${a}/index.json`,c),u;try{let e=await r(l,`utf8`),t=B(jr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${l.href}`),process.exitCode=1;return}u=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${a}\n`),console.error(`Create it first with: prismic custom-type create ${a}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}if(u.format===`page`){console.error(`"${a}" is not a custom type (format: page)`),process.exitCode=1;return}u.label=o;try{await s(l,q(u))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Renamed custom type "${a}" to "${o}"`),!i)try{await K({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Nr=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function Pr(){let{values:{help:t,json:n},positionals:[i]}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`View details of a specific custom type.
631
+ prismic custom-type set-name menu "Navigation Menu"`);return}if(!i){console.error(`Missing required argument: type-id
632
+ `),console.error(`Usage: prismic custom-type set-name <type-id> <new-name>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: new-name
633
+ `),console.error(`Usage: prismic custom-type set-name <type-id> <new-name>`),process.exitCode=1;return}let o=await W(`package.json`);if(!o){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let c=new URL(`customtypes/${i}/index.json`,o),l;try{let e=await r(c,`utf8`),t=B(jr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${c.href}`),process.exitCode=1;return}l=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${i}\n`),console.error(`Create it first with: prismic custom-type create ${i}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}if(l.format===`page`){console.error(`"${i}" is not a custom type (format: page)`),process.exitCode=1;return}l.label=a;try{await s(c,q(l))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}console.info(`Renamed custom type "${i}" to "${a}"`);try{await K({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Nr=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function Pr(){let{values:{help:t,json:n},positionals:[i]}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`View details of a specific custom type.
691
634
 
692
635
  USAGE
693
636
  prismic custom-type view <type-id> [flags]
@@ -722,25 +665,7 @@ FLAGS
722
665
  -h, --help Show help for command
723
666
 
724
667
  LEARN MORE
725
- Use \`prismic custom-type <command> --help\` for more information about a command.`)}}const Ir=`Fetch and display documentation from Prismic's docs site.
726
-
727
- USAGE
728
- prismic docs <path> [flags]
729
-
730
- ARGUMENTS
731
- path Documentation path with optional anchor (e.g., "nextjs" or "nextjs#set-up-a-prismic-client")
732
-
733
- FLAGS
734
- -h, --help Show help for command
735
-
736
- EXAMPLES
737
- prismic docs nextjs
738
- prismic docs nextjs#set-up-a-prismic-client
739
-
740
- LEARN MORE
741
- Visit https://prismic.io/docs for the full documentation.`;function Lr(e){let t=e.indexOf(`#`);return t===-1?{path:e}:{path:e.slice(0,t),anchor:e.slice(t+1)}}async function Rr(e){try{let t=await fetch(e);return t.status===404?{ok:!1,error:`Documentation not found: ${e}`}:t.ok?{ok:!0,content:await t.text()}:{ok:!1,error:`Failed to fetch documentation: ${t.status}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:String(e)}`}}}function zr(e){let t=e.split(`-`).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`[\\s-]+`);return RegExp(`^(#{1,6})\\s+${t}\\s*$`,`im`)}function Br(e,t){let n=e.split(`
742
- `),r=zr(t),i=-1,a=0;for(let e=0;e<n.length;e++){let t=n[e].match(r);if(t){i=e,a=t[1].length;break}}if(i===-1)return{ok:!1,error:`Anchor not found: #${t}`};let o=n.length;for(let e=i+1;e<n.length;e++){let t=n[e].match(/^(#{1,6})\s/);if(t&&t[1].length<=a){o=e;break}}return{ok:!0,content:n.slice(i,o).join(`
743
- `).trim()}}async function Vr(){let{positionals:[t],values:{help:n}}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(n){console.info(Ir);return}if(!t){console.info(Ir);return}let{path:r,anchor:i}=Lr(t),a=await Rr(`https://prismic.io/docs/${r}.md`);if(!a.ok){console.error(a.error),process.exitCode=1;return}let o=a.content;if(i){let e=Br(o,i);if(!e.ok){console.error(e.error),process.exitCode=1;return}o=e.content}console.info(o)}const Hr=`prismic.config.json`,Ur=F({repositoryName:R(),apiEndpoint:I(gn(R(),ln())),localSliceMachineSimulatorURL:I(gn(R(),ln())),libraries:I(N(R())),adapter:I(R()),labs:I(F({legacySliceUpgrader:I(P())}))});async function Wr(e,t=u(process.cwd())){let n=await Yr(t);return n.ok?(await s(n.path,q(e)),{ok:!0,config:e}):n}async function Y(e=u(process.cwd())){let t=await Gr(e);if(t.ok)return t.config.repositoryName}async function Gr(e=u(process.cwd())){let t=await Jr(e);if(!t.ok)return t;try{let e=await r(t.path,`utf8`),n=B(Ur,JSON.parse(e));return n.success?{ok:!0,config:n.output}:{ok:!1,error:new Kr(n.issues)}}catch{return{ok:!1,error:new Kr}}}var Kr=class extends Error{issues;constructor(e=[]){super(`prismic.config.json is invalid.`),this.issues=e}};async function qr(e,t=u(process.cwd())){let n=await Jr(t);if(!n.ok)return n;let r=await Gr(t);if(!r.ok)return r;let i={...r.config,...e};return await s(n.path,q(i)),{ok:!0,config:i}}async function Jr(e=u(process.cwd())){let t=await W(Hr,{start:e,stop:`package.json`});return t?{ok:!0,path:t}:{ok:!1,error:new Xr}}async function Yr(e=u(process.cwd())){let t=await W(`package.json`,{start:e});return t?{ok:!0,path:new URL(Hr,t)}:{ok:!1,error:new Zr}}var Xr=class extends Error{message=`Could not find a prismic.config.json file.`},Zr=class extends Error{message=`Could not find a package.json file.`};async function Qr(){let{values:t}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}}});if(t.help){console.info(`Initialize a Prismic project by creating a prismic.config.json file.
668
+ Use \`prismic custom-type <command> --help\` for more information about a command.`)}}const Ir=`prismic.config.json`,Lr=F({repositoryName:R(),apiEndpoint:I(gn(R(),ln())),localSliceMachineSimulatorURL:I(gn(R(),ln())),libraries:I(N(R())),adapter:I(R()),labs:I(F({legacySliceUpgrader:I(P())}))});async function Rr(e,t=u(process.cwd())){let n=await Ur(t);return n.ok?(await s(n.path,q(e)),{ok:!0,config:e}):n}async function Y(e=u(process.cwd())){let t=await zr(e);if(t.ok)return t.config.repositoryName}async function zr(e=u(process.cwd())){let t=await Hr(e);if(!t.ok)return t;try{let e=await r(t.path,`utf8`),n=B(Lr,JSON.parse(e));return n.success?{ok:!0,config:n.output}:{ok:!1,error:new Br(n.issues)}}catch{return{ok:!1,error:new Br}}}var Br=class extends Error{issues;constructor(e=[]){super(`prismic.config.json is invalid.`),this.issues=e}};async function Vr(e,t=u(process.cwd())){let n=await Hr(t);if(!n.ok)return n;let r=await zr(t);if(!r.ok)return r;let i={...r.config,...e};return await s(n.path,q(i)),{ok:!0,config:i}}async function Hr(e=u(process.cwd())){let t=await W(Ir,{start:e,stop:`package.json`});return t?{ok:!0,path:t}:{ok:!1,error:new Wr}}async function Ur(e=u(process.cwd())){let t=await W(`package.json`,{start:e});return t?{ok:!0,path:new URL(Ir,t)}:{ok:!1,error:new Gr}}var Wr=class extends Error{message=`Could not find a prismic.config.json file.`},Gr=class extends Error{message=`Could not find a package.json file.`};async function Kr(){let{values:t}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}}});if(t.help){console.info(`Initialize a Prismic project by creating a prismic.config.json file.
744
669
 
745
670
  Use this command to connect an existing Prismic repository to your project.
746
671
  To create a new repository, use \`prismic repo create\` instead.
@@ -753,7 +678,7 @@ FLAGS
753
678
  -h, --help Show help for command
754
679
 
755
680
  LEARN MORE
756
- Use \`prismic <command> --help\` for more information about a command.`);return}if(!t.repo){console.error(`Missing required flag: --repo`),process.exitCode=1;return}if((await Gr()).ok){console.error(`A prismic.config.json file already exists.`),process.exitCode=1;return}let n=await Wr({repositoryName:t.repo});if(!n.ok){n.error instanceof Zr?console.error(`Could not find a package.json file. Run this command from a project directory.`):console.error(`Failed to create config file.`),process.exitCode=1;return}console.info(`Created prismic.config.json for repository "${t.repo}"`)}async function X(e,t={}){let{credentials:n=`include`}=t,r=new Headers(t.headers);if(r.set(`Accept`,`application/json`),n===`include`){let e=await U();e&&r.set(`Cookie`,`SESSION=fake_session; prismic-auth=${e}`)}!r.has(`Content-Type`)&&t.body&&r.set(`Content-Type`,`application/json`),t.body instanceof FormData&&r.delete(`Content-Type`);let i=r.get(`Content-Type`)===`application/json`?JSON.stringify(t.body):t.body,a=await fetch(e,{...t,body:i,headers:r}),o=await a.clone().json().catch(()=>a.clone().text());if(a.ok){if(!t?.schema)return{ok:!0,value:o};try{return{ok:!0,value:hn(t.schema,o)}}catch(e){if(M(e))return{ok:!1,value:o,error:e};throw e}}else if(a.status===401)return{ok:!1,value:o,error:new Q(a)};else if(a.status===403)return{ok:!1,value:o,error:new Z(a)};else return{ok:!1,value:o,error:new $r(a)}}var $r=class extends Error{name=`RequestError`;response;constructor(e){super(`fetch failed: ${e.url}`),this.response=e}async text(){return this.response.clone().text()}async json(){return this.response.clone().json()}get status(){return this.response.status}get statusText(){return this.response.statusText}},Z=class extends $r{},Q=class extends $r{};async function ei(){let{values:{help:t,name:n,repo:r=await Y()},positionals:[i]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a new locale to a Prismic repository.
681
+ Use \`prismic <command> --help\` for more information about a command.`);return}if(!t.repo){console.error(`Missing required flag: --repo`),process.exitCode=1;return}if((await zr()).ok){console.error(`A prismic.config.json file already exists.`),process.exitCode=1;return}let n=await Rr({repositoryName:t.repo});if(!n.ok){n.error instanceof Gr?console.error(`Could not find a package.json file. Run this command from a project directory.`):console.error(`Failed to create config file.`),process.exitCode=1;return}console.info(`Created prismic.config.json for repository "${t.repo}"`)}async function X(e,t={}){let{credentials:n=`include`}=t,r=new Headers(t.headers);if(r.set(`Accept`,`application/json`),n===`include`){let e=await U();e&&r.set(`Cookie`,`SESSION=fake_session; prismic-auth=${e}`)}!r.has(`Content-Type`)&&t.body&&r.set(`Content-Type`,`application/json`),t.body instanceof FormData&&r.delete(`Content-Type`);let i=r.get(`Content-Type`)===`application/json`?JSON.stringify(t.body):t.body,a=await fetch(e,{...t,body:i,headers:r}),o=await a.clone().json().catch(()=>a.clone().text());if(a.ok){if(!t?.schema)return{ok:!0,value:o};try{return{ok:!0,value:hn(t.schema,o)}}catch(e){if(M(e))return{ok:!1,value:o,error:e};throw e}}else if(a.status===401)return{ok:!1,value:o,error:new Q(a)};else if(a.status===403)return{ok:!1,value:o,error:new Z(a)};else return{ok:!1,value:o,error:new qr(a)}}var qr=class extends Error{name=`RequestError`;response;constructor(e){super(`fetch failed: ${e.url}`),this.response=e}async text(){return this.response.clone().text()}async json(){return this.response.clone().json()}get status(){return this.response.status}get statusText(){return this.response.statusText}},Z=class extends qr{},Q=class extends qr{};async function Jr(){let{values:{help:t,name:n,repo:r=await Y()},positionals:[i]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a new locale to a Prismic repository.
757
682
 
758
683
  By default, this command reads the repository from prismic.config.json at the
759
684
  project root.
@@ -770,7 +695,7 @@ FLAGS
770
695
  -h, --help Show help for command
771
696
 
772
697
  LEARN MORE
773
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!i){console.error(`Missing required argument: <code>`),process.exitCode=1;return}if(!r){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ri();return}let a=n?await ni(r,i,n):await ti(r,i);if(!a.ok){if(typeof a.value==`string`&&a.value.includes(`already existing languages`))return;a.error instanceof Z?ri():(console.error(`Failed to add locale: ${q(a.value)}`),process.exitCode=1);return}console.info(`Locale added: ${i}`)}async function ti(e,t){return await X(new URL(`/app/settings/multilanguages`,await V(e)),{method:`POST`,body:{languages:[t]}})}async function ni(e,t,n){let[r,i]=t.split(`-`);return await X(new URL(`/app/settings/multilanguages/custom`,await V(e)),{method:`POST`,body:{lang:{label:n,id:r||t},region:{label:n,id:i||r||t}}})}function ri(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ii(){let{values:{help:t,repo:n=await Y(),json:r}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`List all locales in a Prismic repository.
698
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!i){console.error(`Missing required argument: <code>`),process.exitCode=1;return}if(!r){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Zr();return}let a=n?await Xr(r,i,n):await Yr(r,i);if(!a.ok){if(typeof a.value==`string`&&a.value.includes(`already existing languages`))return;a.error instanceof Z?Zr():(console.error(`Failed to add locale: ${q(a.value)}`),process.exitCode=1);return}console.info(`Locale added: ${i}`)}async function Yr(e,t){return await X(new URL(`/app/settings/multilanguages`,await V(e)),{method:`POST`,body:{languages:[t]}})}async function Xr(e,t,n){let[r,i]=t.split(`-`);return await X(new URL(`/app/settings/multilanguages/custom`,await V(e)),{method:`POST`,body:{lang:{label:n,id:r||t},region:{label:n,id:i||r||t}}})}function Zr(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Qr(){let{values:{help:t,repo:n=await Y(),json:r}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`List all locales in a Prismic repository.
774
699
 
775
700
  By default, this command reads the repository from prismic.config.json at the
776
701
  project root.
@@ -784,7 +709,7 @@ FLAGS
784
709
  -h, --help Show help for command
785
710
 
786
711
  LEARN MORE
787
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){si();return}let i=await oi(n);if(!i.ok){i.error instanceof Z?si():M(i.error)?(console.error(`Failed to list locales: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list locales: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.results;if(r)console.info(q(a));else for(let e of a){let t=e.isMaster?` (default)`:``;console.info(`${e.id} ${e.label}${t}`)}}const ai=F({results:N(F({id:R(),label:R(),customName:pn(R()),isMaster:P()}))});async function oi(e){let t=new URL(`/locale/repository/locales`,await _n());return t.searchParams.set(`repository`,e),await X(t,{schema:ai})}function si(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ci(){let{values:{repo:t=await Y(),help:n},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(n){console.info(`Remove a locale from a Prismic repository.
712
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ti();return}let i=await ei(n);if(!i.ok){i.error instanceof Z?ti():M(i.error)?(console.error(`Failed to list locales: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list locales: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.results;if(r)console.info(q(a));else for(let e of a){let t=e.isMaster?` (default)`:``;console.info(`${e.id} ${e.label}${t}`)}}const $r=F({results:N(F({id:R(),label:R(),customName:pn(R()),isMaster:P()}))});async function ei(e){let t=new URL(`/locale/repository/locales`,await _n());return t.searchParams.set(`repository`,e),await X(t,{schema:$r})}function ti(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ni(){let{values:{repo:t=await Y(),help:n},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(n){console.info(`Remove a locale from a Prismic repository.
788
713
 
789
714
  By default, this command reads the repository from prismic.config.json at the
790
715
  project root.
@@ -800,7 +725,7 @@ FLAGS
800
725
  -h, --help Show help for command
801
726
 
802
727
  LEARN MORE
803
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <code>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ui();return}let i=await li(t,r);if(!i.ok){i.error instanceof Z?ui():(console.error(`Failed to remove locale: ${q(i.value)}`),process.exitCode=1);return}console.info(`Removed locale: ${r}`)}async function li(e,t){let n=new URL(`/locale/repository/locales/${t}`,await _n());return n.searchParams.set(`repository`,e),await X(n,{method:`DELETE`})}function ui(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function di(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set the default locale for a Prismic repository.
728
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <code>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ii();return}let i=await ri(t,r);if(!i.ok){i.error instanceof Z?ii():(console.error(`Failed to remove locale: ${q(i.value)}`),process.exitCode=1);return}console.info(`Removed locale: ${r}`)}async function ri(e,t){let n=new URL(`/locale/repository/locales/${t}`,await _n());return n.searchParams.set(`repository`,e),await X(n,{method:`DELETE`})}function ii(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ai(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set the default locale for a Prismic repository.
804
729
 
805
730
  By default, this command reads the repository from prismic.config.json at the
806
731
  project root.
@@ -816,7 +741,7 @@ FLAGS
816
741
  -h, --help Show help for command
817
742
 
818
743
  LEARN MORE
819
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <code>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){pi();return}let i=await oi(n);if(!i.ok){i.error instanceof Z?pi():M(i.error)?(console.error(`Failed to set default locale: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to set default locale: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.results,o=a.find(e=>e.id===r);if(!o){console.error(`Locale "${r}" not found in repository. Available locales: ${a.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}if(o.isMaster){console.error(`Locale "${r}" is already the default.`),process.exitCode=1;return}let s=await fi(n,o);if(!s.ok){s.error instanceof Z?pi():(console.error(`Failed to set default locale: ${q(s.value)}`),process.exitCode=1);return}console.info(`Default locale set: ${r}`)}async function fi(e,t){let n=new URL(`/locale/repository/locales`,await _n());return n.searchParams.set(`repository`,e),await X(n,{method:`POST`,body:{id:t.id,label:t.label,customName:t.customName,isMaster:!0}})}function pi(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function mi(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`add`:await ei();break;case`list`:await ii();break;case`remove`:await ci();break;case`set-default`:await di();break;default:t&&(console.error(`Unknown locale subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage locales in a Prismic repository.
744
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <code>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){si();return}let i=await ei(n);if(!i.ok){i.error instanceof Z?si():M(i.error)?(console.error(`Failed to set default locale: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to set default locale: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.results,o=a.find(e=>e.id===r);if(!o){console.error(`Locale "${r}" not found in repository. Available locales: ${a.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}if(o.isMaster){console.error(`Locale "${r}" is already the default.`),process.exitCode=1;return}let s=await oi(n,o);if(!s.ok){s.error instanceof Z?si():(console.error(`Failed to set default locale: ${q(s.value)}`),process.exitCode=1);return}console.info(`Default locale set: ${r}`)}async function oi(e,t){let n=new URL(`/locale/repository/locales`,await _n());return n.searchParams.set(`repository`,e),await X(n,{method:`POST`,body:{id:t.id,label:t.label,customName:t.customName,isMaster:!0}})}function si(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ci(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`add`:await Jr();break;case`list`:await Qr();break;case`remove`:await ni();break;case`set-default`:await ai();break;default:t&&(console.error(`Unknown locale subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage locales in a Prismic repository.
820
745
 
821
746
  USAGE
822
747
  prismic locale <command> [flags]
@@ -831,7 +756,7 @@ FLAGS
831
756
  -h, --help Show help for command
832
757
 
833
758
  LEARN MORE
834
- Use \`prismic locale <command> --help\` for more information about a command.`)}}const hi=`https://prismic.io`;async function gi(){let{values:t}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}}});if(t.help){console.info(`Log in to Prismic via browser.
759
+ Use \`prismic locale <command> --help\` for more information about a command.`)}}const li=`https://prismic.io`;async function ui(){let{values:t}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}}});if(t.help){console.info(`Log in to Prismic via browser.
835
760
 
836
761
  USAGE
837
762
  prismic login [flags]
@@ -840,7 +765,7 @@ FLAGS
840
765
  -h, --help Show help for command
841
766
 
842
767
  LEARN MORE
843
- Use \`prismic <command> --help\` for more information about a command.`);return}return new Promise((e,t)=>{let n=f((t,i)=>{if(t.method===`OPTIONS`){i.writeHead(204,{"Access-Control-Allow-Origin":hi,"Access-Control-Allow-Methods":`POST, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type`}),i.end();return}if(t.method===`POST`){let a=``;t.on(`data`,e=>{a+=e.toString()}),t.on(`end`,async()=>{try{let{cookies:t,email:o}=JSON.parse(a),s=t.find(e=>e.startsWith(`prismic-auth=`))?.split(`;`)[0]?.replace(/^prismic-auth=/,``);if(!s){i.writeHead(400,{"Access-Control-Allow-Origin":hi,"Content-Type":`application/json`}),i.end(JSON.stringify({error:`Invalid request`}));return}await Sn(s),console.info(`Logged in to Prismic as ${o}`),i.writeHead(200,{"Access-Control-Allow-Origin":hi,"Content-Type":`application/json`}),i.end(JSON.stringify({success:!0})),clearTimeout(r),n.close(),e()}catch{i.writeHead(400,{"Access-Control-Allow-Origin":hi,"Content-Type":`application/json`}),i.end(JSON.stringify({error:`Invalid request`}))}});return}i.writeHead(404),i.end()}),r=setTimeout(()=>{n.close(),t(Error(`Login timed out. Please try again.`))},18e4),i=()=>{let e=n.address();if(!e||typeof e==`string`){clearTimeout(r),n.close(),t(Error(`Failed to start login server`));return}let i=e.port,a=_i(i);console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${a}`),vi(a)};n.on(`error`,e=>{e.code===`EADDRINUSE`&&n.listening===!1?n.listen(0,`0.0.0.0`,i):(clearTimeout(r),t(e))}),n.listen(5555,`0.0.0.0`,i)})}function _i(e){let t=new URL(`https://prismic.io/dashboard/cli/login`);return t.searchParams.set(`source`,`slice-machine`),t.searchParams.set(`port`,e.toString()),t}function vi(e){d(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}async function yi(){let{values:t}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}}});if(t.help){console.info(`Log out of Prismic.
768
+ Use \`prismic <command> --help\` for more information about a command.`);return}return new Promise((e,t)=>{let n=f((t,i)=>{if(t.method===`OPTIONS`){i.writeHead(204,{"Access-Control-Allow-Origin":li,"Access-Control-Allow-Methods":`POST, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type`}),i.end();return}if(t.method===`POST`){let a=``;t.on(`data`,e=>{a+=e.toString()}),t.on(`end`,async()=>{try{let{cookies:t,email:o}=JSON.parse(a),s=t.find(e=>e.startsWith(`prismic-auth=`))?.split(`;`)[0]?.replace(/^prismic-auth=/,``);if(!s){i.writeHead(400,{"Access-Control-Allow-Origin":li,"Content-Type":`application/json`}),i.end(JSON.stringify({error:`Invalid request`}));return}await Sn(s),console.info(`Logged in to Prismic as ${o}`),i.writeHead(200,{"Access-Control-Allow-Origin":li,"Content-Type":`application/json`}),i.end(JSON.stringify({success:!0})),clearTimeout(r),n.close(),e()}catch{i.writeHead(400,{"Access-Control-Allow-Origin":li,"Content-Type":`application/json`}),i.end(JSON.stringify({error:`Invalid request`}))}});return}i.writeHead(404),i.end()}),r=setTimeout(()=>{n.close(),t(Error(`Login timed out. Please try again.`))},18e4),i=()=>{let e=n.address();if(!e||typeof e==`string`){clearTimeout(r),n.close(),t(Error(`Failed to start login server`));return}let i=e.port,a=di(i);console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${a}`),fi(a)};n.on(`error`,e=>{e.code===`EADDRINUSE`&&n.listening===!1?n.listen(0,`0.0.0.0`,i):(clearTimeout(r),t(e))}),n.listen(5555,`0.0.0.0`,i)})}function di(e){let t=new URL(`https://prismic.io/dashboard/cli/login`);return t.searchParams.set(`source`,`slice-machine`),t.searchParams.set(`port`,e.toString()),t}function fi(e){d(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}async function pi(){let{values:t}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}}});if(t.help){console.info(`Log out of Prismic.
844
769
 
845
770
  USAGE
846
771
  prismic logout [flags]
@@ -849,7 +774,7 @@ FLAGS
849
774
  -h, --help Show help for command
850
775
 
851
776
  LEARN MORE
852
- Use \`prismic <command> --help\` for more information about a command.`);return}await Tn()?console.info(`Logged out of Prismic`):(console.error(`Logout failed. You can log out manually by deleting the file.`),process.exitCode=1)}const bi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function xi(){let{values:{help:t,tab:n,label:i,default:a,"true-label":o,"false-label":c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},default:{type:`boolean`},"true-label":{type:`string`},"false-label":{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a boolean (toggle) field to an existing page type.
777
+ Use \`prismic <command> --help\` for more information about a command.`);return}await Tn()?console.info(`Logged out of Prismic`):(console.error(`Logout failed. You can log out manually by deleting the file.`),process.exitCode=1)}const mi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function hi(){let{values:{help:t,tab:n,label:i,default:a,"true-label":o,"false-label":c,types:l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},default:{type:`boolean`},"true-label":{type:`string`},"false-label":{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a boolean (toggle) field to an existing page type.
853
778
 
854
779
  USAGE
855
780
  prismic page-type add-field boolean <type-id> <field-id> [flags]
@@ -858,8 +783,6 @@ ARGUMENTS
858
783
  type-id Page type identifier (required)
859
784
  field-id Field identifier (required)
860
785
 
861
- Types are generated by default after changes. Use --no-types to skip.
862
-
863
786
  FLAGS
864
787
  -t, --tab string Target tab (default: first existing tab, or "Main")
865
788
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -867,15 +790,14 @@ FLAGS
867
790
  --true-label string Label shown when toggle is on
868
791
  --false-label string Label shown when toggle is off
869
792
  --types string Output file for generated types (default: "prismicio-types.d.ts")
870
- --no-types Skip type generation
871
793
  -h, --help Show help for command
872
794
 
873
795
  EXAMPLES
874
796
  prismic page-type add-field boolean homepage featured
875
797
  prismic page-type add-field boolean article published --default
876
- prismic page-type add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!d){console.error(`Missing required argument: type-id
877
- `),console.error(`Usage: prismic page-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
878
- `),console.error(`Usage: prismic page-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}let p=await W(`package.json`);if(!p){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let m=new URL(`customtypes/${d}/index.json`,p),h;try{let e=await r(m,`utf8`),t=B(bi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${m.href}`),process.exitCode=1;return}h=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${d}\n`),console.error(`Create it first with: prismic page-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let g=Object.keys(h.json),_=n??g[0]??`Main`;h.json[_]||(h.json[_]={});for(let[e,t]of Object.entries(h.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let v={type:`Boolean`,config:{label:i??J(f),...a&&{default_value:!0},...o&&{placeholder_true:o},...c&&{placeholder_false:c}}};h.json[_][f]=v;try{await s(m,q(h))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Boolean) to "${_}" tab in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Si=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ci(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing page type.
798
+ prismic page-type add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!u){console.error(`Missing required argument: type-id
799
+ `),console.error(`Usage: prismic page-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
800
+ `),console.error(`Usage: prismic page-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(mi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${u}\n`),console.error(`Create it first with: prismic page-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Boolean`,config:{label:i??J(d),...a&&{default_value:!0},...o&&{placeholder_true:o},...c&&{placeholder_false:c}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Added field "${d}" (Boolean) to "${g}" tab in ${u}`);try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const gi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function _i(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing page type.
879
801
 
880
802
  USAGE
881
803
  prismic page-type add-field color <type-id> <field-id> [flags]
@@ -884,22 +806,19 @@ ARGUMENTS
884
806
  type-id Page type identifier (required)
885
807
  field-id Field identifier (required)
886
808
 
887
- Types are generated by default after changes. Use --no-types to skip.
888
-
889
809
  FLAGS
890
810
  -t, --tab string Target tab (default: first existing tab, or "Main")
891
811
  -l, --label string Display label for the field (inferred from field-id if omitted)
892
812
  -p, --placeholder string Placeholder text
893
813
  --types string Output file for generated types (default: "prismicio-types.d.ts")
894
- --no-types Skip type generation
895
814
  -h, --help Show help for command
896
815
 
897
816
  EXAMPLES
898
817
  prismic page-type add-field color homepage bg_color
899
818
  prismic page-type add-field color homepage accent --tab "Design"
900
- prismic page-type add-field color homepage text_color --label "Text Color"`);return}if(!l){console.error(`Missing required argument: type-id
901
- `),console.error(`Usage: prismic page-type add-field color <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
902
- `),console.error(`Usage: prismic page-type add-field color <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Si,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Color`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Color) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const wi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ti(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date field to an existing page type.
819
+ prismic page-type add-field color homepage text_color --label "Text Color"`);return}if(!c){console.error(`Missing required argument: type-id
820
+ `),console.error(`Usage: prismic page-type add-field color <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
821
+ `),console.error(`Usage: prismic page-type add-field color <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(gi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${c}\n`),console.error(`Create it first with: prismic page-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`Color`,config:{label:i??J(l),...a&&{placeholder:a}}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Added field "${l}" (Color) to "${m}" tab in ${c}`);try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const vi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function yi(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date field to an existing page type.
903
822
 
904
823
  USAGE
905
824
  prismic page-type add-field date <type-id> <field-id> [flags]
@@ -908,23 +827,20 @@ ARGUMENTS
908
827
  type-id Page type identifier (required)
909
828
  field-id Field identifier (required)
910
829
 
911
- Types are generated by default after changes. Use --no-types to skip.
912
-
913
830
  FLAGS
914
831
  -t, --tab string Target tab (default: first existing tab, or "Main")
915
832
  -l, --label string Display label for the field (inferred from field-id if omitted)
916
833
  -p, --placeholder string Placeholder text
917
834
  --default string Default date value (YYYY-MM-DD format)
918
835
  --types string Output file for generated types (default: "prismicio-types.d.ts")
919
- --no-types Skip type generation
920
836
  -h, --help Show help for command
921
837
 
922
838
  EXAMPLES
923
839
  prismic page-type add-field date homepage publish_date
924
840
  prismic page-type add-field date event start_date --tab "Schedule"
925
- prismic page-type add-field date article date --label "Publication Date" --default "2024-01-01"`);return}if(!u){console.error(`Missing required argument: type-id
926
- `),console.error(`Usage: prismic page-type add-field date <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
927
- `),console.error(`Usage: prismic page-type add-field date <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(wi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${u}\n`),console.error(`Create it first with: prismic page-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Date`,config:{label:i??J(d),...a&&{placeholder:a},...o&&{default:o}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Date) to "${g}" tab in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Ei=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Di(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed field to an existing page type.
841
+ prismic page-type add-field date article date --label "Publication Date" --default "2024-01-01"`);return}if(!l){console.error(`Missing required argument: type-id
842
+ `),console.error(`Usage: prismic page-type add-field date <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
843
+ `),console.error(`Usage: prismic page-type add-field date <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(vi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Date`,config:{label:i??J(u),...a&&{placeholder:a},...o&&{default:o}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Added field "${u}" (Date) to "${h}" tab in ${l}`);try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const bi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function xi(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed field to an existing page type.
928
844
 
929
845
  USAGE
930
846
  prismic page-type add-field embed <type-id> <field-id> [flags]
@@ -933,22 +849,19 @@ ARGUMENTS
933
849
  type-id Page type identifier (required)
934
850
  field-id Field identifier (required)
935
851
 
936
- Types are generated by default after changes. Use --no-types to skip.
937
-
938
852
  FLAGS
939
853
  -t, --tab string Target tab (default: first existing tab, or "Main")
940
854
  -l, --label string Display label for the field (inferred from field-id if omitted)
941
855
  -p, --placeholder string Placeholder text
942
856
  --types string Output file for generated types (default: "prismicio-types.d.ts")
943
- --no-types Skip type generation
944
857
  -h, --help Show help for command
945
858
 
946
859
  EXAMPLES
947
860
  prismic page-type add-field embed homepage video
948
861
  prismic page-type add-field embed homepage youtube --tab "Media"
949
- prismic page-type add-field embed homepage media --label "Media Embed"`);return}if(!l){console.error(`Missing required argument: type-id
950
- `),console.error(`Usage: prismic page-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
951
- `),console.error(`Usage: prismic page-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Ei,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Embed`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Embed) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Oi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function ki(){let{values:{help:t,tab:n,label:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geo-point (location) field to an existing page type.
862
+ prismic page-type add-field embed homepage media --label "Media Embed"`);return}if(!c){console.error(`Missing required argument: type-id
863
+ `),console.error(`Usage: prismic page-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
864
+ `),console.error(`Usage: prismic page-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(bi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${c}\n`),console.error(`Create it first with: prismic page-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`Embed`,config:{label:i??J(l),...a&&{placeholder:a}}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Added field "${l}" (Embed) to "${m}" tab in ${c}`);try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Si=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ci(){let{values:{help:t,tab:n,label:i,types:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geo-point (location) field to an existing page type.
952
865
 
953
866
  USAGE
954
867
  prismic page-type add-field geo-point <type-id> <field-id> [flags]
@@ -957,21 +870,18 @@ ARGUMENTS
957
870
  type-id Page type identifier (required)
958
871
  field-id Field identifier (required)
959
872
 
960
- Types are generated by default after changes. Use --no-types to skip.
961
-
962
873
  FLAGS
963
874
  -t, --tab string Target tab (default: first existing tab, or "Main")
964
875
  -l, --label string Display label for the field (inferred from field-id if omitted)
965
876
  --types string Output file for generated types (default: "prismicio-types.d.ts")
966
- --no-types Skip type generation
967
877
  -h, --help Show help for command
968
878
 
969
879
  EXAMPLES
970
880
  prismic page-type add-field geo-point homepage location
971
881
  prismic page-type add-field geo-point store address --tab "Details"
972
- prismic page-type add-field geo-point event venue --label "Event Venue"`);return}if(!c){console.error(`Missing required argument: type-id
973
- `),console.error(`Usage: prismic page-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
974
- `),console.error(`Usage: prismic page-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(Oi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${c}\n`),console.error(`Create it first with: prismic page-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`GeoPoint`,config:{label:i??J(l)}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${l}" (GeoPoint) to "${m}" tab in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Ai=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function ji(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing page type.
882
+ prismic page-type add-field geo-point event venue --label "Event Venue"`);return}if(!o){console.error(`Missing required argument: type-id
883
+ `),console.error(`Usage: prismic page-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
884
+ `),console.error(`Usage: prismic page-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}let l=await W(`package.json`);if(!l){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let u=new URL(`customtypes/${o}/index.json`,l),d;try{let e=await r(u,`utf8`),t=B(Si,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${u.href}`),process.exitCode=1;return}d=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${o}\n`),console.error(`Create it first with: prismic page-type create ${o}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let f=Object.keys(d.json),p=n??f[0]??`Main`;d.json[p]||(d.json[p]={});for(let[e,t]of Object.entries(d.json))if(t[c]){console.error(`Field "${c}" already exists in tab "${e}"`),process.exitCode=1;return}let m={type:`GeoPoint`,config:{label:i??J(c)}};d.json[p][c]=m;try{await s(u,q(d))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Added field "${c}" (GeoPoint) to "${p}" tab in ${o}`);try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const wi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ti(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing page type.
975
885
 
976
886
  USAGE
977
887
  prismic page-type add-field image <type-id> <field-id> [flags]
@@ -980,22 +890,19 @@ ARGUMENTS
980
890
  type-id Page type identifier (required)
981
891
  field-id Field identifier (required)
982
892
 
983
- Types are generated by default after changes. Use --no-types to skip.
984
-
985
893
  FLAGS
986
894
  -t, --tab string Target tab (default: first existing tab, or "Main")
987
895
  -l, --label string Display label for the field (inferred from field-id if omitted)
988
896
  -p, --placeholder string Placeholder text
989
897
  --types string Output file for generated types (default: "prismicio-types.d.ts")
990
- --no-types Skip type generation
991
898
  -h, --help Show help for command
992
899
 
993
900
  EXAMPLES
994
901
  prismic page-type add-field image homepage hero
995
902
  prismic page-type add-field image article thumbnail --tab "Media"
996
- prismic page-type add-field image product photo --label "Product Photo"`);return}if(!l){console.error(`Missing required argument: type-id
997
- `),console.error(`Usage: prismic page-type add-field image <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
998
- `),console.error(`Usage: prismic page-type add-field image <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Ai,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Image`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Image) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Mi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ni(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing page type.
903
+ prismic page-type add-field image product photo --label "Product Photo"`);return}if(!c){console.error(`Missing required argument: type-id
904
+ `),console.error(`Usage: prismic page-type add-field image <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
905
+ `),console.error(`Usage: prismic page-type add-field image <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(wi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${c}\n`),console.error(`Create it first with: prismic page-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`Image`,config:{label:i??J(l),...a&&{placeholder:a}}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Added field "${l}" (Image) to "${m}" tab in ${c}`);try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Ei=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Di(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing page type.
999
906
 
1000
907
  USAGE
1001
908
  prismic page-type add-field key-text <type-id> <field-id> [flags]
@@ -1004,22 +911,19 @@ ARGUMENTS
1004
911
  type-id Page type identifier (required)
1005
912
  field-id Field identifier (required)
1006
913
 
1007
- Types are generated by default after changes. Use --no-types to skip.
1008
-
1009
914
  FLAGS
1010
915
  -t, --tab string Target tab (default: first existing tab, or "Main")
1011
916
  -l, --label string Display label for the field (inferred from field-id if omitted)
1012
917
  -p, --placeholder string Placeholder text
1013
918
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1014
- --no-types Skip type generation
1015
919
  -h, --help Show help for command
1016
920
 
1017
921
  EXAMPLES
1018
922
  prismic page-type add-field key-text homepage title
1019
923
  prismic page-type add-field key-text homepage meta_title --tab "SEO"
1020
- prismic page-type add-field key-text homepage subtitle --label "Subtitle" --placeholder "Enter subtitle"`);return}if(!l){console.error(`Missing required argument: type-id
1021
- `),console.error(`Usage: prismic page-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
1022
- `),console.error(`Usage: prismic page-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Mi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Text`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Text) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Pi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Fi(){let{values:{help:t,tab:n,label:i,placeholder:a,variation:o,"allow-text":c,"allow-target-blank":l,repeatable:u,types:d,"no-types":f},positionals:[p,m]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},variation:{type:`string`,multiple:!0},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing page type.
924
+ prismic page-type add-field key-text homepage subtitle --label "Subtitle" --placeholder "Enter subtitle"`);return}if(!c){console.error(`Missing required argument: type-id
925
+ `),console.error(`Usage: prismic page-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
926
+ `),console.error(`Usage: prismic page-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(Ei,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${c}\n`),console.error(`Create it first with: prismic page-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`Text`,config:{label:i??J(l),...a&&{placeholder:a}}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Added field "${l}" (Text) to "${m}" tab in ${c}`);try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Oi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function ki(){let{values:{help:t,tab:n,label:i,placeholder:a,variation:o,"allow-text":c,"allow-target-blank":l,repeatable:u,types:d},positionals:[f,p]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},variation:{type:`string`,multiple:!0},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing page type.
1023
927
 
1024
928
  USAGE
1025
929
  prismic page-type add-field link <type-id> <field-id> [flags]
@@ -1028,8 +932,6 @@ ARGUMENTS
1028
932
  type-id Page type identifier (required)
1029
933
  field-id Field identifier (required)
1030
934
 
1031
- Types are generated by default after changes. Use --no-types to skip.
1032
-
1033
935
  FLAGS
1034
936
  -t, --tab string Target tab (default: first existing tab, or "Main")
1035
937
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -1039,16 +941,15 @@ FLAGS
1039
941
  --allow-target-blank Allow opening link in new tab
1040
942
  --repeatable Allow multiple links
1041
943
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1042
- --no-types Skip type generation
1043
944
  -h, --help Show help for command
1044
945
 
1045
946
  EXAMPLES
1046
947
  prismic page-type add-field link homepage button
1047
948
  prismic page-type add-field link homepage cta --allow-text
1048
949
  prismic page-type add-field link homepage cta --variation Primary --variation Secondary
1049
- prismic page-type add-field link homepage links --repeatable`);return}if(!p){console.error(`Missing required argument: type-id
1050
- `),console.error(`Usage: prismic page-type add-field link <type-id> <field-id>`),process.exitCode=1;return}if(!m){console.error(`Missing required argument: field-id
1051
- `),console.error(`Usage: prismic page-type add-field link <type-id> <field-id>`),process.exitCode=1;return}let h=await W(`package.json`);if(!h){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let g=new URL(`customtypes/${p}/index.json`,h),_;try{let e=await r(g,`utf8`),t=B(Pi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${g.href}`),process.exitCode=1;return}_=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${p}\n`),console.error(`Create it first with: prismic page-type create ${p}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let v=Object.keys(_.json),y=n??v[0]??`Main`;_.json[y]||(_.json[y]={});for(let[e,t]of Object.entries(_.json))if(t[m]){console.error(`Field "${m}" already exists in tab "${e}"`),process.exitCode=1;return}let b={type:`Link`,config:{label:i??J(m),...a&&{placeholder:a},...o&&o.length>0&&{variants:o},...c&&{allowText:!0},...l&&{allowTargetBlank:!0},...u&&{repeat:!0}}};_.json[y][m]=b;try{await s(g,q(_))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${m}" (Link) to "${y}" tab in ${p}`),!f)try{await K({output:d}),console.info(`Updated types in ${d??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Ii=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Li(){let{values:{help:t,tab:n,label:i,placeholder:a,min:o,max:c,step:l,types:u,"no-types":d},positionals:[f,p]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},min:{type:`string`},max:{type:`string`},step:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing page type.
950
+ prismic page-type add-field link homepage links --repeatable`);return}if(!f){console.error(`Missing required argument: type-id
951
+ `),console.error(`Usage: prismic page-type add-field link <type-id> <field-id>`),process.exitCode=1;return}if(!p){console.error(`Missing required argument: field-id
952
+ `),console.error(`Usage: prismic page-type add-field link <type-id> <field-id>`),process.exitCode=1;return}let m=await W(`package.json`);if(!m){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let h=new URL(`customtypes/${f}/index.json`,m),g;try{let e=await r(h,`utf8`),t=B(Oi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${h.href}`),process.exitCode=1;return}g=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${f}\n`),console.error(`Create it first with: prismic page-type create ${f}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let _=Object.keys(g.json),v=n??_[0]??`Main`;g.json[v]||(g.json[v]={});for(let[e,t]of Object.entries(g.json))if(t[p]){console.error(`Field "${p}" already exists in tab "${e}"`),process.exitCode=1;return}let y={type:`Link`,config:{label:i??J(p),...a&&{placeholder:a},...o&&o.length>0&&{variants:o},...c&&{allowText:!0},...l&&{allowTargetBlank:!0},...u&&{repeat:!0}}};g.json[v][p]=y;try{await s(h,q(g))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Added field "${p}" (Link) to "${v}" tab in ${f}`);try{await K({output:d}),console.info(`Updated types in ${d??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Ai=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function ji(){let{values:{help:t,tab:n,label:i,placeholder:a,min:o,max:c,step:l,types:u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},min:{type:`string`},max:{type:`string`},step:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing page type.
1052
953
 
1053
954
  USAGE
1054
955
  prismic page-type add-field number <type-id> <field-id> [flags]
@@ -1057,8 +958,6 @@ ARGUMENTS
1057
958
  type-id Page type identifier (required)
1058
959
  field-id Field identifier (required)
1059
960
 
1060
- Types are generated by default after changes. Use --no-types to skip.
1061
-
1062
961
  FLAGS
1063
962
  -t, --tab string Target tab (default: first existing tab, or "Main")
1064
963
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -1067,15 +966,14 @@ FLAGS
1067
966
  --max number Maximum value
1068
967
  --step number Step increment
1069
968
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1070
- --no-types Skip type generation
1071
969
  -h, --help Show help for command
1072
970
 
1073
971
  EXAMPLES
1074
972
  prismic page-type add-field number homepage price
1075
973
  prismic page-type add-field number product quantity --min 0 --max 100
1076
- prismic page-type add-field number settings rating --min 1 --max 5 --step 1`);return}if(!f){console.error(`Missing required argument: type-id
1077
- `),console.error(`Usage: prismic page-type add-field number <type-id> <field-id>`),process.exitCode=1;return}if(!p){console.error(`Missing required argument: field-id
1078
- `),console.error(`Usage: prismic page-type add-field number <type-id> <field-id>`),process.exitCode=1;return}let m=o===void 0?void 0:Number(o),h=c===void 0?void 0:Number(c),g=l===void 0?void 0:Number(l);if(o!==void 0&&Number.isNaN(m)){console.error(`Invalid --min value: must be a number`),process.exitCode=1;return}if(c!==void 0&&Number.isNaN(h)){console.error(`Invalid --max value: must be a number`),process.exitCode=1;return}if(l!==void 0&&Number.isNaN(g)){console.error(`Invalid --step value: must be a number`),process.exitCode=1;return}let _=await W(`package.json`);if(!_){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let v=new URL(`customtypes/${f}/index.json`,_),y;try{let e=await r(v,`utf8`),t=B(Ii,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${v.href}`),process.exitCode=1;return}y=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${f}\n`),console.error(`Create it first with: prismic page-type create ${f}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let b=Object.keys(y.json),x=n??b[0]??`Main`;y.json[x]||(y.json[x]={});for(let[e,t]of Object.entries(y.json))if(t[p]){console.error(`Field "${p}" already exists in tab "${e}"`),process.exitCode=1;return}let ee={type:`Number`,config:{label:i??J(p),...a&&{placeholder:a},...m!==void 0&&{min:m},...h!==void 0&&{max:h},...g!==void 0&&{step:g}}};y.json[x][p]=ee;try{await s(v,q(y))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${p}" (Number) to "${x}" tab in ${f}`),!d)try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Ri=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function zi(){let{values:{help:t,tab:n,label:i,placeholder:a,single:o,multi:c,"allow-target-blank":l,types:u,"no-types":d},positionals:[f,p]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing page type.
974
+ prismic page-type add-field number settings rating --min 1 --max 5 --step 1`);return}if(!d){console.error(`Missing required argument: type-id
975
+ `),console.error(`Usage: prismic page-type add-field number <type-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
976
+ `),console.error(`Usage: prismic page-type add-field number <type-id> <field-id>`),process.exitCode=1;return}let p=o===void 0?void 0:Number(o),m=c===void 0?void 0:Number(c),h=l===void 0?void 0:Number(l);if(o!==void 0&&Number.isNaN(p)){console.error(`Invalid --min value: must be a number`),process.exitCode=1;return}if(c!==void 0&&Number.isNaN(m)){console.error(`Invalid --max value: must be a number`),process.exitCode=1;return}if(l!==void 0&&Number.isNaN(h)){console.error(`Invalid --step value: must be a number`),process.exitCode=1;return}let g=await W(`package.json`);if(!g){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let _=new URL(`customtypes/${d}/index.json`,g),v;try{let e=await r(_,`utf8`),t=B(Ai,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${_.href}`),process.exitCode=1;return}v=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${d}\n`),console.error(`Create it first with: prismic page-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let y=Object.keys(v.json),b=n??y[0]??`Main`;v.json[b]||(v.json[b]={});for(let[e,t]of Object.entries(v.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let x={type:`Number`,config:{label:i??J(f),...a&&{placeholder:a},...p!==void 0&&{min:p},...m!==void 0&&{max:m},...h!==void 0&&{step:h}}};v.json[b][f]=x;try{await s(_,q(v))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Added field "${f}" (Number) to "${b}" tab in ${d}`);try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Mi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ni(){let{values:{help:t,tab:n,label:i,placeholder:a,single:o,multi:c,"allow-target-blank":l,types:u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing page type.
1079
977
 
1080
978
  USAGE
1081
979
  prismic page-type add-field rich-text <type-id> <field-id> [flags]
@@ -1084,8 +982,6 @@ ARGUMENTS
1084
982
  type-id Page type identifier (required)
1085
983
  field-id Field identifier (required)
1086
984
 
1087
- Types are generated by default after changes. Use --no-types to skip.
1088
-
1089
985
  FLAGS
1090
986
  -t, --tab string Target tab (default: first existing tab, or "Main")
1091
987
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -1094,7 +990,6 @@ FLAGS
1094
990
  --multi string Allowed block types for multi-line (comma-separated)
1095
991
  --allow-target-blank Allow opening links in new tab
1096
992
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1097
- --no-types Skip type generation
1098
993
  -h, --help Show help for command
1099
994
 
1100
995
  BLOCK TYPES
@@ -1106,9 +1001,9 @@ EXAMPLES
1106
1001
  prismic page-type add-field rich-text homepage body
1107
1002
  prismic page-type add-field rich-text article content --multi "paragraph,heading2,heading3,strong,em,hyperlink"
1108
1003
  prismic page-type add-field rich-text page tagline --single "heading1"
1109
- prismic page-type add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!f){console.error(`Missing required argument: type-id
1110
- `),console.error(`Usage: prismic page-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}if(!p){console.error(`Missing required argument: field-id
1111
- `),console.error(`Usage: prismic page-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}let m=await W(`package.json`);if(!m){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let h=new URL(`customtypes/${f}/index.json`,m),g;try{let e=await r(h,`utf8`),t=B(Ri,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${h.href}`),process.exitCode=1;return}g=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${f}\n`),console.error(`Create it first with: prismic page-type create ${f}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let _=Object.keys(g.json),v=n??_[0]??`Main`;g.json[v]||(g.json[v]={});for(let[e,t]of Object.entries(g.json))if(t[p]){console.error(`Field "${p}" already exists in tab "${e}"`),process.exitCode=1;return}let y={type:`StructuredText`,config:{label:i??J(p),...a&&{placeholder:a},...o&&{single:o},...c&&{multi:c},...l&&{allowTargetBlank:!0}}};g.json[v][p]=y;try{await s(h,q(g))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${p}" (StructuredText) to "${v}" tab in ${f}`),!d)try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Bi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Vi(){let{values:{help:t,tab:n,label:i,placeholder:a,option:o,default:c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing page type.
1004
+ prismic page-type add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!d){console.error(`Missing required argument: type-id
1005
+ `),console.error(`Usage: prismic page-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
1006
+ `),console.error(`Usage: prismic page-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}let p=await W(`package.json`);if(!p){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let m=new URL(`customtypes/${d}/index.json`,p),h;try{let e=await r(m,`utf8`),t=B(Mi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${m.href}`),process.exitCode=1;return}h=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${d}\n`),console.error(`Create it first with: prismic page-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let g=Object.keys(h.json),_=n??g[0]??`Main`;h.json[_]||(h.json[_]={});for(let[e,t]of Object.entries(h.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let v={type:`StructuredText`,config:{label:i??J(f),...a&&{placeholder:a},...o&&{single:o},...c&&{multi:c},...l&&{allowTargetBlank:!0}}};h.json[_][f]=v;try{await s(m,q(h))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Added field "${f}" (StructuredText) to "${_}" tab in ${d}`);try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Pi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Fi(){let{values:{help:t,tab:n,label:i,placeholder:a,option:o,default:c,types:l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing page type.
1112
1007
 
1113
1008
  USAGE
1114
1009
  prismic page-type add-field select <type-id> <field-id> [flags]
@@ -1117,8 +1012,6 @@ ARGUMENTS
1117
1012
  type-id Page type identifier (required)
1118
1013
  field-id Field identifier (required)
1119
1014
 
1120
- Types are generated by default after changes. Use --no-types to skip.
1121
-
1122
1015
  FLAGS
1123
1016
  -t, --tab string Target tab (default: first existing tab, or "Main")
1124
1017
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -1126,15 +1019,14 @@ FLAGS
1126
1019
  --option string Add an option (can be used multiple times)
1127
1020
  --default string Default selected value
1128
1021
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1129
- --no-types Skip type generation
1130
1022
  -h, --help Show help for command
1131
1023
 
1132
1024
  EXAMPLES
1133
1025
  prismic page-type add-field select homepage layout --option "full" --option "sidebar"
1134
1026
  prismic page-type add-field select product size --option "small" --option "medium" --option "large" --default "medium"
1135
- prismic page-type add-field select article status --option "draft" --option "published" --label "Status"`);return}if(!d){console.error(`Missing required argument: type-id
1136
- `),console.error(`Usage: prismic page-type add-field select <type-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
1137
- `),console.error(`Usage: prismic page-type add-field select <type-id> <field-id>`),process.exitCode=1;return}let p=await W(`package.json`);if(!p){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let m=new URL(`customtypes/${d}/index.json`,p),h;try{let e=await r(m,`utf8`),t=B(Bi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${m.href}`),process.exitCode=1;return}h=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${d}\n`),console.error(`Create it first with: prismic page-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let g=Object.keys(h.json),_=n??g[0]??`Main`;h.json[_]||(h.json[_]={});for(let[e,t]of Object.entries(h.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let v={type:`Select`,config:{label:i??J(f),...a&&{placeholder:a},...o&&o.length>0&&{options:o},...c&&{default_value:c}}};h.json[_][f]=v;try{await s(m,q(h))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Select) to "${_}" tab in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Hi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ui(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a timestamp (date and time) field to an existing page type.
1027
+ prismic page-type add-field select article status --option "draft" --option "published" --label "Status"`);return}if(!u){console.error(`Missing required argument: type-id
1028
+ `),console.error(`Usage: prismic page-type add-field select <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
1029
+ `),console.error(`Usage: prismic page-type add-field select <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(Pi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${u}\n`),console.error(`Create it first with: prismic page-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Select`,config:{label:i??J(d),...a&&{placeholder:a},...o&&o.length>0&&{options:o},...c&&{default_value:c}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Added field "${d}" (Select) to "${g}" tab in ${u}`);try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Ii=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Li(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a timestamp (date and time) field to an existing page type.
1138
1030
 
1139
1031
  USAGE
1140
1032
  prismic page-type add-field timestamp <type-id> <field-id> [flags]
@@ -1143,23 +1035,20 @@ ARGUMENTS
1143
1035
  type-id Page type identifier (required)
1144
1036
  field-id Field identifier (required)
1145
1037
 
1146
- Types are generated by default after changes. Use --no-types to skip.
1147
-
1148
1038
  FLAGS
1149
1039
  -t, --tab string Target tab (default: first existing tab, or "Main")
1150
1040
  -l, --label string Display label for the field (inferred from field-id if omitted)
1151
1041
  -p, --placeholder string Placeholder text
1152
1042
  --default string Default timestamp value (ISO 8601 format)
1153
1043
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1154
- --no-types Skip type generation
1155
1044
  -h, --help Show help for command
1156
1045
 
1157
1046
  EXAMPLES
1158
1047
  prismic page-type add-field timestamp homepage event_time
1159
1048
  prismic page-type add-field timestamp event start --tab "Schedule"
1160
- prismic page-type add-field timestamp article published_at --label "Published At"`);return}if(!u){console.error(`Missing required argument: type-id
1161
- `),console.error(`Usage: prismic page-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
1162
- `),console.error(`Usage: prismic page-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(Hi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${u}\n`),console.error(`Create it first with: prismic page-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Timestamp`,config:{label:i??J(d),...a&&{placeholder:a},...o&&{default:o}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Timestamp) to "${g}" tab in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Wi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Gi(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a UID (unique identifier) field to an existing page type.
1049
+ prismic page-type add-field timestamp article published_at --label "Published At"`);return}if(!l){console.error(`Missing required argument: type-id
1050
+ `),console.error(`Usage: prismic page-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
1051
+ `),console.error(`Usage: prismic page-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Ii,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Timestamp`,config:{label:i??J(u),...a&&{placeholder:a},...o&&{default:o}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Added field "${u}" (Timestamp) to "${h}" tab in ${l}`);try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Ri=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function zi(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a UID (unique identifier) field to an existing page type.
1163
1052
 
1164
1053
  USAGE
1165
1054
  prismic page-type add-field uid <type-id> <field-id> [flags]
@@ -1168,22 +1057,19 @@ ARGUMENTS
1168
1057
  type-id Page type identifier (required)
1169
1058
  field-id Field identifier (required)
1170
1059
 
1171
- Types are generated by default after changes. Use --no-types to skip.
1172
-
1173
1060
  FLAGS
1174
1061
  -t, --tab string Target tab (default: first existing tab, or "Main")
1175
1062
  -l, --label string Display label for the field (inferred from field-id if omitted)
1176
1063
  -p, --placeholder string Placeholder text
1177
1064
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1178
- --no-types Skip type generation
1179
1065
  -h, --help Show help for command
1180
1066
 
1181
1067
  EXAMPLES
1182
1068
  prismic page-type add-field uid page uid
1183
1069
  prismic page-type add-field uid article slug --label "URL Slug"
1184
- prismic page-type add-field uid product sku --placeholder "Enter unique SKU"`);return}if(!l){console.error(`Missing required argument: type-id
1185
- `),console.error(`Usage: prismic page-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
1186
- `),console.error(`Usage: prismic page-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Wi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`UID`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (UID) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function Ki(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await xi();break;case`color`:await Ci();break;case`date`:await Ti();break;case`embed`:await Di();break;case`geo-point`:await ki();break;case`image`:await ji();break;case`key-text`:await Ni();break;case`link`:await Fi();break;case`number`:await Li();break;case`rich-text`:await zi();break;case`select`:await Vi();break;case`timestamp`:await Ui();break;case`uid`:await Gi();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing page type.
1070
+ prismic page-type add-field uid product sku --placeholder "Enter unique SKU"`);return}if(!c){console.error(`Missing required argument: type-id
1071
+ `),console.error(`Usage: prismic page-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
1072
+ `),console.error(`Usage: prismic page-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(Ri,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${c}\n`),console.error(`Create it first with: prismic page-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`UID`,config:{label:i??J(l),...a&&{placeholder:a}}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Added field "${l}" (UID) to "${m}" tab in ${c}`);try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function Bi(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await hi();break;case`color`:await _i();break;case`date`:await yi();break;case`embed`:await xi();break;case`geo-point`:await Ci();break;case`image`:await Ti();break;case`key-text`:await Di();break;case`link`:await ki();break;case`number`:await ji();break;case`rich-text`:await Ni();break;case`select`:await Fi();break;case`timestamp`:await Li();break;case`uid`:await zi();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing page type.
1187
1073
 
1188
1074
  USAGE
1189
1075
  prismic page-type add-field <field-type> <type-id> <field-id> [flags]
@@ -1213,7 +1099,7 @@ EXAMPLES
1213
1099
  prismic page-type add-field key-text homepage meta_title --tab "SEO"
1214
1100
  prismic page-type add-field link homepage button --allow-text
1215
1101
  prismic page-type add-field rich-text homepage body --multi "paragraph,heading2,strong,em"
1216
- prismic page-type add-field select homepage layout --option "full" --option "sidebar"`)}}const qi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ji(){let{values:{help:t,"slice-zone":n,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Connect a shared slice to a page type's slice zone.
1102
+ prismic page-type add-field select homepage layout --option "full" --option "sidebar"`)}}const Vi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Hi(){let{values:{help:t,"slice-zone":n,types:i},positionals:[a,o]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Connect a shared slice to a page type's slice zone.
1217
1103
 
1218
1104
  USAGE
1219
1105
  prismic page-type connect-slice <type-id> <slice-id> [flags]
@@ -1222,20 +1108,17 @@ ARGUMENTS
1222
1108
  type-id Page type identifier (required)
1223
1109
  slice-id Slice identifier (required)
1224
1110
 
1225
- Types are generated by default after changes. Use --no-types to skip.
1226
-
1227
1111
  FLAGS
1228
1112
  -z, --slice-zone string Target slice zone field ID (default: "slices")
1229
1113
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1230
- --no-types Skip type generation
1231
1114
  -h, --help Show help for command
1232
1115
 
1233
1116
  EXAMPLES
1234
1117
  prismic page-type connect-slice homepage CallToAction
1235
1118
  prismic page-type connect-slice homepage CallToAction --slice-zone slices
1236
- prismic page-type connect-slice article HeroSection -z body`);return}if(!o){console.error(`Missing required argument: type-id
1237
- `),console.error(`Usage: prismic page-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: slice-id
1238
- `),console.error(`Usage: prismic page-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}let l=await G(c);if(!l.ok){console.error(l.error),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${o}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(qi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${o}\n`),console.error(`Create it first with: prismic page-type create ${o}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let p=n??`slices`,m,h;for(let[,e]of Object.entries(f.json)){for(let[t,n]of Object.entries(e))if(n.type===`Slices`&&t===p){m=n,h=t;break}if(m)break}if(!m){if(n){console.error(`Slice zone "${n}" not found in page type "${o}"`),process.exitCode=1;return}let e=Object.keys(f.json)[0]??`Main`;f.json[e]||(f.json[e]={});let t={type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}};f.json[e][p]=t,m=t,h=p}if(m.config||={choices:{}},m.config.choices||(m.config.choices={}),c in m.config.choices){console.info(`Slice "${c}" is already connected to slice zone "${h}" in ${o}`);return}let g={type:`SharedSlice`};m.config.choices[c]=g;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Connected slice "${c}" to slice zone "${h}" in ${o}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Yi(){let{values:{help:t,name:r,single:i,types:a,"no-types":o},positionals:[c]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},single:{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Create a new page type in a Prismic repository.
1119
+ prismic page-type connect-slice article HeroSection -z body`);return}if(!a){console.error(`Missing required argument: type-id
1120
+ `),console.error(`Usage: prismic page-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: slice-id
1121
+ `),console.error(`Usage: prismic page-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}let c=await G(o);if(!c.ok){console.error(c.error),process.exitCode=1;return}let l=await W(`package.json`);if(!l){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let u=new URL(`customtypes/${a}/index.json`,l),d;try{let e=await r(u,`utf8`),t=B(Vi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${u.href}`),process.exitCode=1;return}d=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${a}\n`),console.error(`Create it first with: prismic page-type create ${a}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let f=n??`slices`,p,m;for(let[,e]of Object.entries(d.json)){for(let[t,n]of Object.entries(e))if(n.type===`Slices`&&t===f){p=n,m=t;break}if(p)break}if(!p){if(n){console.error(`Slice zone "${n}" not found in page type "${a}"`),process.exitCode=1;return}let e=Object.keys(d.json)[0]??`Main`;d.json[e]||(d.json[e]={});let t={type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}};d.json[e][f]=t,p=t,m=f}if(p.config||={choices:{}},p.config.choices||(p.config.choices={}),o in p.config.choices){console.info(`Slice "${o}" is already connected to slice zone "${m}" in ${a}`);return}let h={type:`SharedSlice`};p.config.choices[o]=h;try{await s(u,q(d))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Connected slice "${o}" to slice zone "${m}" in ${a}`);try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Ui(){let{values:{help:t,name:r,single:i,types:a},positionals:[o]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},single:{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Create a new page type in a Prismic repository.
1239
1122
 
1240
1123
  USAGE
1241
1124
  prismic page-type create <id> [flags]
@@ -1243,17 +1126,14 @@ USAGE
1243
1126
  ARGUMENTS
1244
1127
  id Page type identifier (required)
1245
1128
 
1246
- Types are generated by default after changes. Use --no-types to skip.
1247
-
1248
1129
  FLAGS
1249
1130
  -n, --name string Display name for the page type
1250
1131
  --single Create as a singleton (non-repeatable) type
1251
1132
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1252
- --no-types Skip type generation
1253
1133
  -h, --help Show help for command
1254
1134
 
1255
1135
  LEARN MORE
1256
- Use \`prismic page-type <command> --help\` for more information about a command.`);return}if(!c){console.error(`Missing required argument: id`),process.exitCode=1;return}let l={id:c,label:r??Xi(c),repeatable:!i,status:!0,format:`page`,json:{Main:{},"SEO & Metadata":{}}},u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/`,u),f=new URL(c+`/`,d),p=new URL(`index.json`,f);try{await n(new URL(`.`,p),{recursive:!0}),await s(p,q(l))}catch(e){e instanceof Error?console.error(`Failed to create page type: ${e.message}`):console.error(`Failed to create page type`),process.exitCode=1;return}if(console.info(`Created page type at ${p.href}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add fields with `prismic page-type add-field`")}function Xi(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}const Zi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Qi(){let{values:{help:t,"slice-zone":n,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Disconnect a shared slice from a page type's slice zone.
1136
+ Use \`prismic page-type <command> --help\` for more information about a command.`);return}if(!o){console.error(`Missing required argument: id`),process.exitCode=1;return}let c={id:o,label:r??Wi(o),repeatable:!i,status:!0,format:`page`,json:{Main:{},"SEO & Metadata":{}}},l=await W(`package.json`);if(!l){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let u=new URL(`customtypes/`,l),d=new URL(o+`/`,u),f=new URL(`index.json`,d);try{await n(new URL(`.`,f),{recursive:!0}),await s(f,q(c))}catch(e){e instanceof Error?console.error(`Failed to create page type: ${e.message}`):console.error(`Failed to create page type`),process.exitCode=1;return}console.info(`Created page type at ${f.href}`);try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add fields with `prismic page-type add-field`")}function Wi(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}const Gi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ki(){let{values:{help:t,"slice-zone":n,types:i},positionals:[a,o]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Disconnect a shared slice from a page type's slice zone.
1257
1137
 
1258
1138
  USAGE
1259
1139
  prismic page-type disconnect-slice <type-id> <slice-id> [flags]
@@ -1262,20 +1142,17 @@ ARGUMENTS
1262
1142
  type-id Page type identifier (required)
1263
1143
  slice-id Slice identifier (required)
1264
1144
 
1265
- Types are generated by default after changes. Use --no-types to skip.
1266
-
1267
1145
  FLAGS
1268
1146
  -z, --slice-zone string Target slice zone field ID (default: "slices")
1269
1147
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1270
- --no-types Skip type generation
1271
1148
  -h, --help Show help for command
1272
1149
 
1273
1150
  EXAMPLES
1274
1151
  prismic page-type disconnect-slice homepage CallToAction
1275
1152
  prismic page-type disconnect-slice homepage CallToAction --slice-zone slices
1276
- prismic page-type disconnect-slice article HeroSection -z body`);return}if(!o){console.error(`Missing required argument: type-id
1277
- `),console.error(`Usage: prismic page-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: slice-id
1278
- `),console.error(`Usage: prismic page-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}let l=await W(`package.json`);if(!l){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let u=new URL(`customtypes/${o}/index.json`,l),d;try{let e=await r(u,`utf8`),t=B(Zi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${u.href}`),process.exitCode=1;return}d=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${o}\n`),console.error(`Create it first with: prismic page-type create ${o}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let f=n??`slices`,p,m;for(let[,e]of Object.entries(d.json)){for(let[t,n]of Object.entries(e))if(n.type===`Slices`&&t===f){p=n,m=t;break}if(p)break}if(!p){console.error(`Slice zone "${f}" not found in page type "${o}"`),process.exitCode=1;return}if(!p.config?.choices||!(c in p.config.choices)){console.error(`Slice "${c}" is not connected to slice zone "${m}" in ${o}`),process.exitCode=1;return}delete p.config.choices[c];try{await s(u,q(d))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Disconnected slice "${c}" from slice zone "${m}" in ${o}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const $i=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function ea(){let{values:{help:t,json:n}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`List all page types in a Prismic project.
1153
+ prismic page-type disconnect-slice article HeroSection -z body`);return}if(!a){console.error(`Missing required argument: type-id
1154
+ `),console.error(`Usage: prismic page-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: slice-id
1155
+ `),console.error(`Usage: prismic page-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}let c=await W(`package.json`);if(!c){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let l=new URL(`customtypes/${a}/index.json`,c),u;try{let e=await r(l,`utf8`),t=B(Gi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${l.href}`),process.exitCode=1;return}u=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${a}\n`),console.error(`Create it first with: prismic page-type create ${a}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let d=n??`slices`,f,p;for(let[,e]of Object.entries(u.json)){for(let[t,n]of Object.entries(e))if(n.type===`Slices`&&t===d){f=n,p=t;break}if(f)break}if(!f){console.error(`Slice zone "${d}" not found in page type "${a}"`),process.exitCode=1;return}if(!f.config?.choices||!(o in f.config.choices)){console.error(`Slice "${o}" is not connected to slice zone "${p}" in ${a}`),process.exitCode=1;return}delete f.config.choices[o];try{await s(l,q(u))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Disconnected slice "${o}" from slice zone "${p}" in ${a}`);try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const qi=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function Ji(){let{values:{help:t,json:n}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`List all page types in a Prismic project.
1279
1156
 
1280
1157
  USAGE
1281
1158
  prismic page-type list [flags]
@@ -1286,7 +1163,7 @@ FLAGS
1286
1163
 
1287
1164
  EXAMPLES
1288
1165
  prismic page-type list
1289
- prismic page-type list --json`);return}let a=await W(`package.json`);if(!a){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let o=new URL(`customtypes/`,a),s;try{s=await i(o,{withFileTypes:!1})}catch{n?console.info(JSON.stringify([])):console.info(`No page types found.`);return}let c=[];for(let e of s){let t=new URL(`${e}/index.json`,o);try{let e=await r(t,`utf8`),n=B($i,JSON.parse(e));n.success&&n.output.format===`page`&&c.push({id:n.output.id,label:n.output.label,repeatable:n.output.repeatable})}catch{}}if(c.length===0){n?console.info(JSON.stringify([])):console.info(`No page types found.`);return}if(n)console.info(JSON.stringify(c,null,2));else{console.info(`ID LABEL TYPE`);for(let e of c){let t=e.repeatable?`repeatable`:`singleton`;console.info(`${e.id}\t${e.label}\t${t}`)}}}const ta=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function na(){let{values:{help:t,y:n,types:i,"no-types":a},positionals:[s]}=e({args:process.argv.slice(4),options:{y:{type:`boolean`,short:`y`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a page type from the project.
1166
+ prismic page-type list --json`);return}let a=await W(`package.json`);if(!a){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let o=new URL(`customtypes/`,a),s;try{s=await i(o,{withFileTypes:!1})}catch{n?console.info(JSON.stringify([])):console.info(`No page types found.`);return}let c=[];for(let e of s){let t=new URL(`${e}/index.json`,o);try{let e=await r(t,`utf8`),n=B(qi,JSON.parse(e));n.success&&n.output.format===`page`&&c.push({id:n.output.id,label:n.output.label,repeatable:n.output.repeatable})}catch{}}if(c.length===0){n?console.info(JSON.stringify([])):console.info(`No page types found.`);return}if(n)console.info(JSON.stringify(c,null,2));else{console.info(`ID LABEL TYPE`);for(let e of c){let t=e.repeatable?`repeatable`:`singleton`;console.info(`${e.id}\t${e.label}\t${t}`)}}}const Yi=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function Xi(){let{values:{help:t,y:n,types:i},positionals:[a]}=e({args:process.argv.slice(4),options:{y:{type:`boolean`,short:`y`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a page type from the project.
1290
1167
 
1291
1168
  USAGE
1292
1169
  prismic page-type remove <type-id> [flags]
@@ -1294,18 +1171,15 @@ USAGE
1294
1171
  ARGUMENTS
1295
1172
  type-id Page type identifier (required)
1296
1173
 
1297
- Types are generated by default after changes. Use --no-types to skip.
1298
-
1299
1174
  FLAGS
1300
1175
  -y Confirm removal
1301
1176
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1302
- --no-types Skip type generation
1303
1177
  -h, --help Show help for command
1304
1178
 
1305
1179
  EXAMPLES
1306
1180
  prismic page-type remove homepage
1307
- prismic page-type remove homepage -y`);return}if(!s){console.error(`Missing required argument: type-id
1308
- `),console.error(`Usage: prismic page-type remove <type-id>`),process.exitCode=1;return}let c=await W(`package.json`);if(!c){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let l=new URL(`customtypes/${s}/`,c),u=new URL(`index.json`,l),d;try{let e=await r(u,`utf8`),t=B(ta,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${u.href}`),process.exitCode=1;return}d=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${s}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}if(d.format!==`page`){console.error(`"${s}" is not a page type (format: ${d.format??`custom`})`),process.exitCode=1;return}if(!n){console.error(`Refusing to remove page type "${s}" (this will delete the entire directory).`),console.error(`Re-run with -y to confirm.`),process.exitCode=1;return}try{await o(l,{recursive:!0})}catch(e){e instanceof Error?console.error(`Failed to remove page type: ${e.message}`):console.error(`Failed to remove page type`),process.exitCode=1;return}if(console.info(`Removed page type "${s}"`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const ra=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function ia(){let{values:{help:t,tab:n,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{tab:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a field from a page type.
1181
+ prismic page-type remove homepage -y`);return}if(!a){console.error(`Missing required argument: type-id
1182
+ `),console.error(`Usage: prismic page-type remove <type-id>`),process.exitCode=1;return}let s=await W(`package.json`);if(!s){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let c=new URL(`customtypes/${a}/`,s),l=new URL(`index.json`,c),u;try{let e=await r(l,`utf8`),t=B(Yi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${l.href}`),process.exitCode=1;return}u=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${a}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}if(u.format!==`page`){console.error(`"${a}" is not a page type (format: ${u.format??`custom`})`),process.exitCode=1;return}if(!n){console.error(`Refusing to remove page type "${a}" (this will delete the entire directory).`),console.error(`Re-run with -y to confirm.`),process.exitCode=1;return}try{await o(c,{recursive:!0})}catch(e){e instanceof Error?console.error(`Failed to remove page type: ${e.message}`):console.error(`Failed to remove page type`),process.exitCode=1;return}console.info(`Removed page type "${a}"`);try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Zi=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function Qi(){let{values:{help:t,tab:n,types:i},positionals:[a,o]}=e({args:process.argv.slice(4),options:{tab:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a field from a page type.
1309
1183
 
1310
1184
  USAGE
1311
1185
  prismic page-type remove-field <type-id> <field-id> [flags]
@@ -1314,19 +1188,16 @@ ARGUMENTS
1314
1188
  type-id Page type identifier (required)
1315
1189
  field-id Field identifier (required)
1316
1190
 
1317
- Types are generated by default after changes. Use --no-types to skip.
1318
-
1319
1191
  FLAGS
1320
1192
  --tab string Specific tab (searches all tabs if not specified)
1321
1193
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1322
- --no-types Skip type generation
1323
1194
  -h, --help Show help for command
1324
1195
 
1325
1196
  EXAMPLES
1326
1197
  prismic page-type remove-field homepage title
1327
- prismic page-type remove-field homepage meta_title --tab "SEO & Metadata"`);return}if(!o){console.error(`Missing required argument: type-id
1328
- `),console.error(`Usage: prismic page-type remove-field <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
1329
- `),console.error(`Usage: prismic page-type remove-field <type-id> <field-id>`),process.exitCode=1;return}let l=await W(`package.json`);if(!l){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let u=new URL(`customtypes/${o}/index.json`,l),d;try{let e=await r(u,`utf8`),t=B(ra,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${u.href}`),process.exitCode=1;return}d=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${o}\n`),console.error(`Create it first with: prismic page-type create ${o}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}if(d.format!==`page`){console.error(`"${o}" is not a page type (format: ${d.format??`custom`})`),process.exitCode=1;return}let f;if(n){if(!d.json[n]){console.error(`Tab "${n}" not found in page type "${o}"`),console.error(`Available tabs: ${Object.keys(d.json).join(`, `)}`),process.exitCode=1;return}if(!(c in d.json[n])){console.error(`Field "${c}" not found in tab "${n}"`),process.exitCode=1;return}delete d.json[n][c],f=n}else{for(let[e,t]of Object.entries(d.json))if(c in t){delete t[c],f=e;break}if(!f){console.error(`Field "${c}" not found in any tab of page type "${o}"`),process.exitCode=1;return}}try{await s(u,q(d))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Removed field "${c}" from tab "${f}" in page type "${o}"`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const aa=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function oa(){let{values:{help:t,types:n,"no-types":i},positionals:[a,o]}=e({args:process.argv.slice(4),options:{types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Change a page type's display name (label).
1198
+ prismic page-type remove-field homepage meta_title --tab "SEO & Metadata"`);return}if(!a){console.error(`Missing required argument: type-id
1199
+ `),console.error(`Usage: prismic page-type remove-field <type-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1200
+ `),console.error(`Usage: prismic page-type remove-field <type-id> <field-id>`),process.exitCode=1;return}let c=await W(`package.json`);if(!c){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let l=new URL(`customtypes/${a}/index.json`,c),u;try{let e=await r(l,`utf8`),t=B(Zi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${l.href}`),process.exitCode=1;return}u=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${a}\n`),console.error(`Create it first with: prismic page-type create ${a}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}if(u.format!==`page`){console.error(`"${a}" is not a page type (format: ${u.format??`custom`})`),process.exitCode=1;return}let d;if(n){if(!u.json[n]){console.error(`Tab "${n}" not found in page type "${a}"`),console.error(`Available tabs: ${Object.keys(u.json).join(`, `)}`),process.exitCode=1;return}if(!(o in u.json[n])){console.error(`Field "${o}" not found in tab "${n}"`),process.exitCode=1;return}delete u.json[n][o],d=n}else{for(let[e,t]of Object.entries(u.json))if(o in t){delete t[o],d=e;break}if(!d){console.error(`Field "${o}" not found in any tab of page type "${a}"`),process.exitCode=1;return}}try{await s(l,q(u))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Removed field "${o}" from tab "${d}" in page type "${a}"`);try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const $i=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function ea(){let{values:{help:t,types:n},positionals:[i,a]}=e({args:process.argv.slice(4),options:{types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Change a page type's display name (label).
1330
1201
 
1331
1202
  USAGE
1332
1203
  prismic page-type set-name <type-id> <new-name> [flags]
@@ -1335,18 +1206,15 @@ ARGUMENTS
1335
1206
  type-id Page type identifier (required)
1336
1207
  new-name New display name (required)
1337
1208
 
1338
- Types are generated by default after changes. Use --no-types to skip.
1339
-
1340
1209
  FLAGS
1341
1210
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1342
- --no-types Skip type generation
1343
1211
  -h, --help Show help for command
1344
1212
 
1345
1213
  EXAMPLES
1346
1214
  prismic page-type set-name homepage "Home Page"
1347
- prismic page-type set-name blog_post "Blog Post"`);return}if(!a){console.error(`Missing required argument: type-id
1348
- `),console.error(`Usage: prismic page-type set-name <type-id> <new-name>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: new-name
1349
- `),console.error(`Usage: prismic page-type set-name <type-id> <new-name>`),process.exitCode=1;return}let c=await W(`package.json`);if(!c){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let l=new URL(`customtypes/${a}/index.json`,c),u;try{let e=await r(l,`utf8`),t=B(aa,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${l.href}`),process.exitCode=1;return}u=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${a}\n`),console.error(`Create it first with: prismic page-type create ${a}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}if(u.format!==`page`){console.error(`"${a}" is not a page type (format: ${u.format??`custom`})`),process.exitCode=1;return}u.label=o;try{await s(l,q(u))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Renamed page type "${a}" to "${o}"`),!i)try{await K({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const sa=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function ca(){let{values:{help:t,types:n,"no-types":i},positionals:[a,o]}=e({args:process.argv.slice(4),options:{types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set whether a page type is repeatable.
1215
+ prismic page-type set-name blog_post "Blog Post"`);return}if(!i){console.error(`Missing required argument: type-id
1216
+ `),console.error(`Usage: prismic page-type set-name <type-id> <new-name>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: new-name
1217
+ `),console.error(`Usage: prismic page-type set-name <type-id> <new-name>`),process.exitCode=1;return}let o=await W(`package.json`);if(!o){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let c=new URL(`customtypes/${i}/index.json`,o),l;try{let e=await r(c,`utf8`),t=B($i,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${c.href}`),process.exitCode=1;return}l=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${i}\n`),console.error(`Create it first with: prismic page-type create ${i}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}if(l.format!==`page`){console.error(`"${i}" is not a page type (format: ${l.format??`custom`})`),process.exitCode=1;return}l.label=a;try{await s(c,q(l))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}console.info(`Renamed page type "${i}" to "${a}"`);try{await K({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const ta=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function na(){let{values:{help:t,types:n},positionals:[i,a]}=e({args:process.argv.slice(4),options:{types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set whether a page type is repeatable.
1350
1218
 
1351
1219
  USAGE
1352
1220
  prismic page-type set-repeatable <type-id> <true|false> [flags]
@@ -1355,18 +1223,15 @@ ARGUMENTS
1355
1223
  type-id Page type identifier (required)
1356
1224
  true|false Repeatable value (required)
1357
1225
 
1358
- Types are generated by default after changes. Use --no-types to skip.
1359
-
1360
1226
  FLAGS
1361
1227
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1362
- --no-types Skip type generation
1363
1228
  -h, --help Show help for command
1364
1229
 
1365
1230
  EXAMPLES
1366
1231
  prismic page-type set-repeatable homepage true
1367
- prismic page-type set-repeatable settings false`);return}if(!a){console.error(`Missing required argument: type-id
1368
- `),console.error(`Usage: prismic page-type set-repeatable <type-id> <true|false>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: true|false
1369
- `),console.error(`Usage: prismic page-type set-repeatable <type-id> <true|false>`),process.exitCode=1;return}if(o!==`true`&&o!==`false`){console.error(`Invalid value: "${o}". Must be "true" or "false".`),process.exitCode=1;return}let c=o===`true`,l=await W(`package.json`);if(!l){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let u=new URL(`customtypes/${a}/index.json`,l),d;try{let e=await r(u,`utf8`),t=B(sa,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${u.href}`),process.exitCode=1;return}d=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${a}\n`),console.error(`Create it first with: prismic page-type create ${a}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}if(d.format!==`page`){console.error(`"${a}" is not a page type (format: ${d.format??`custom`})`),process.exitCode=1;return}d.repeatable=c;try{await s(u,q(d))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}let f=c?`repeatable`:`singleton`;if(console.info(`Set page type "${a}" to ${f}`),!i)try{await K({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const la=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function ua(){let{values:{help:t,json:n},positionals:[i]}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`View details of a specific page type.
1232
+ prismic page-type set-repeatable settings false`);return}if(!i){console.error(`Missing required argument: type-id
1233
+ `),console.error(`Usage: prismic page-type set-repeatable <type-id> <true|false>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: true|false
1234
+ `),console.error(`Usage: prismic page-type set-repeatable <type-id> <true|false>`),process.exitCode=1;return}if(a!==`true`&&a!==`false`){console.error(`Invalid value: "${a}". Must be "true" or "false".`),process.exitCode=1;return}let o=a===`true`,c=await W(`package.json`);if(!c){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let l=new URL(`customtypes/${i}/index.json`,c),u;try{let e=await r(l,`utf8`),t=B(ta,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${l.href}`),process.exitCode=1;return}u=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${i}\n`),console.error(`Create it first with: prismic page-type create ${i}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}if(u.format!==`page`){console.error(`"${i}" is not a page type (format: ${u.format??`custom`})`),process.exitCode=1;return}u.repeatable=o;try{await s(l,q(u))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}let d=o?`repeatable`:`singleton`;console.info(`Set page type "${i}" to ${d}`);try{await K({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const ra=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function ia(){let{values:{help:t,json:n},positionals:[i]}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`View details of a specific page type.
1370
1235
 
1371
1236
  USAGE
1372
1237
  prismic page-type view <type-id> [flags]
@@ -1381,7 +1246,7 @@ FLAGS
1381
1246
  EXAMPLES
1382
1247
  prismic page-type view homepage
1383
1248
  prismic page-type view homepage --json`);return}if(!i){console.error(`Missing required argument: type-id
1384
- `),console.error(`Usage: prismic page-type view <type-id>`),process.exitCode=1;return}let a=await W(`package.json`);if(!a){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let o=new URL(`customtypes/${i}/index.json`,a),s;try{let e=await r(o,`utf8`),t=B(la,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${o.href}`),process.exitCode=1;return}s=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${i}\n`),console.error(`Create it first with: prismic page-type create ${i}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}if(s.format!==`page`){console.error(`"${i}" is not a page type (format: ${s.format??`custom`})`),process.exitCode=1;return}if(n){console.info(JSON.stringify(s,null,2));return}console.info(`ID: ${s.id}`),console.info(`Label: ${s.label}`),console.info(`Repeatable: ${s.repeatable}`);let c=Object.entries(s.json);console.info(`\nTabs (${c.length}):`);for(let[e,t]of c){let n=Object.keys(t).length;console.info(` - ${e}: ${n} fields`)}}async function da(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`create`:await Yi();break;case`list`:await ea();break;case`view`:await ua();break;case`remove`:await na();break;case`set-name`:await oa();break;case`set-repeatable`:await ca();break;case`add-field`:await Ki();break;case`remove-field`:await ia();break;case`connect-slice`:await Ji();break;case`disconnect-slice`:await Qi();break;default:t&&(console.error(`Unknown page-type subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage page types in a Prismic repository.
1249
+ `),console.error(`Usage: prismic page-type view <type-id>`),process.exitCode=1;return}let a=await W(`package.json`);if(!a){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let o=new URL(`customtypes/${i}/index.json`,a),s;try{let e=await r(o,`utf8`),t=B(ra,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${o.href}`),process.exitCode=1;return}s=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${i}\n`),console.error(`Create it first with: prismic page-type create ${i}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}if(s.format!==`page`){console.error(`"${i}" is not a page type (format: ${s.format??`custom`})`),process.exitCode=1;return}if(n){console.info(JSON.stringify(s,null,2));return}console.info(`ID: ${s.id}`),console.info(`Label: ${s.label}`),console.info(`Repeatable: ${s.repeatable}`);let c=Object.entries(s.json);console.info(`\nTabs (${c.length}):`);for(let[e,t]of c){let n=Object.keys(t).length;console.info(` - ${e}: ${n} fields`)}}async function aa(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`create`:await Ui();break;case`list`:await Ji();break;case`view`:await ia();break;case`remove`:await Xi();break;case`set-name`:await ea();break;case`set-repeatable`:await na();break;case`add-field`:await Bi();break;case`remove-field`:await Qi();break;case`connect-slice`:await Hi();break;case`disconnect-slice`:await Ki();break;default:t&&(console.error(`Unknown page-type subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage page types in a Prismic repository.
1385
1250
 
1386
1251
  USAGE
1387
1252
  prismic page-type <command> [flags]
@@ -1402,7 +1267,7 @@ FLAGS
1402
1267
  -h, --help Show help for command
1403
1268
 
1404
1269
  LEARN MORE
1405
- Use \`prismic page-type <command> --help\` for more information about a command.`)}}async function fa(){let{values:{help:t,name:n,repo:r=await Y()},positionals:[i]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a preview configuration to a Prismic repository.
1270
+ Use \`prismic page-type <command> --help\` for more information about a command.`)}}async function oa(){let{values:{help:t,name:n,repo:r=await Y()},positionals:[i]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a preview configuration to a Prismic repository.
1406
1271
 
1407
1272
  By default, this command reads the repository from prismic.config.json at the
1408
1273
  project root.
@@ -1419,7 +1284,7 @@ FLAGS
1419
1284
  -h, --help Show help for command
1420
1285
 
1421
1286
  LEARN MORE
1422
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!i){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!r){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ha();return}let a=pa(i);if(!a){console.error(`Invalid URL: ${i}`),process.exitCode=1;return}let o=await ma(r,{name:n||a.hostname,websiteURL:a.websiteURL,resolverPath:a.resolverPath});if(!o.ok){o.error instanceof Z?ha():(console.error(`Failed to add preview: ${q(o.value)}`),process.exitCode=1);return}console.info(`Preview added: ${i}`)}function pa(e){try{let t=new URL(e);return{websiteURL:`${t.protocol}//${t.host}`,resolverPath:t.pathname===`/`?void 0:t.pathname,hostname:t.hostname}}catch{return}}async function ma(e,t){return await X(new URL(`/previews/new`,await V(e)),{method:`POST`,body:{name:t.name,websiteURL:t.websiteURL,resolverPath:t.resolverPath}})}function ha(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ga(){let{values:{help:t,repo:n=await Y(),json:r}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Show the slice simulator URL for a Prismic repository.
1287
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!i){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!r){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){la();return}let a=sa(i);if(!a){console.error(`Invalid URL: ${i}`),process.exitCode=1;return}let o=await ca(r,{name:n||a.hostname,websiteURL:a.websiteURL,resolverPath:a.resolverPath});if(!o.ok){o.error instanceof Z?la():(console.error(`Failed to add preview: ${q(o.value)}`),process.exitCode=1);return}console.info(`Preview added: ${i}`)}function sa(e){try{let t=new URL(e);return{websiteURL:`${t.protocol}//${t.host}`,resolverPath:t.pathname===`/`?void 0:t.pathname,hostname:t.hostname}}catch{return}}async function ca(e,t){return await X(new URL(`/previews/new`,await V(e)),{method:`POST`,body:{name:t.name,websiteURL:t.websiteURL,resolverPath:t.resolverPath}})}function la(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ua(){let{values:{help:t,repo:n=await Y(),json:r}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Show the slice simulator URL for a Prismic repository.
1423
1288
 
1424
1289
  By default, this command reads the repository from prismic.config.json at the
1425
1290
  project root.
@@ -1433,7 +1298,7 @@ FLAGS
1433
1298
  -h, --help Show help for command
1434
1299
 
1435
1300
  LEARN MORE
1436
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ya();return}let i=await va(n);if(!i.ok){i.error instanceof Z?ya():M(i.error)?(console.error(`Failed to get simulator URL: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to get simulator URL: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.simulator_url;if(!a){r?console.info(q({simulator_url:null})):console.info(`No simulator URL configured.`);return}r?console.info(q({simulator_url:a})):console.info(a)}const _a=F({simulator_url:I(R())});async function va(e){return await X(new URL(`/core/repository`,await V(e)),{schema:_a})}function ya(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ba(){let{values:{help:t,repo:n=await Y(),json:r}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`List all preview configurations in a Prismic repository.
1301
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){pa();return}let i=await fa(n);if(!i.ok){i.error instanceof Z?pa():M(i.error)?(console.error(`Failed to get simulator URL: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to get simulator URL: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.simulator_url;if(!a){r?console.info(q({simulator_url:null})):console.info(`No simulator URL configured.`);return}r?console.info(q({simulator_url:a})):console.info(a)}const da=F({simulator_url:I(R())});async function fa(e){return await X(new URL(`/core/repository`,await V(e)),{schema:da})}function pa(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ma(){let{values:{help:t,repo:n=await Y(),json:r}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`List all preview configurations in a Prismic repository.
1437
1302
 
1438
1303
  By default, this command reads the repository from prismic.config.json at the
1439
1304
  project root.
@@ -1447,7 +1312,7 @@ FLAGS
1447
1312
  -h, --help Show help for command
1448
1313
 
1449
1314
  LEARN MORE
1450
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ca();return}let i=await Sa(n);if(!i.ok){i.error instanceof Z?Ca():M(i.error)?(console.error(`Failed to list previews: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list previews: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.results;if(r)console.info(q(a));else for(let e of a)console.info(`${e.url} ${e.label}`)}const xa=F({results:N(F({id:R(),label:R(),url:R()}))});async function Sa(e){return await X(new URL(`/core/repository/preview_configs`,await V(e)),{schema:xa})}function Ca(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function wa(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a preview configuration from a Prismic repository.
1315
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){_a();return}let i=await ga(n);if(!i.ok){i.error instanceof Z?_a():M(i.error)?(console.error(`Failed to list previews: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list previews: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.results;if(r)console.info(q(a));else for(let e of a)console.info(`${e.url} ${e.label}`)}const ha=F({results:N(F({id:R(),label:R(),url:R()}))});async function ga(e){return await X(new URL(`/core/repository/preview_configs`,await V(e)),{schema:ha})}function _a(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function va(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a preview configuration from a Prismic repository.
1451
1316
 
1452
1317
  By default, this command reads the repository from prismic.config.json at the
1453
1318
  project root.
@@ -1463,7 +1328,7 @@ FLAGS
1463
1328
  -h, --help Show help for command
1464
1329
 
1465
1330
  LEARN MORE
1466
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ea();return}let i=await Sa(n);if(!i.ok){i.error instanceof Z?Ea():(console.error(`Failed to fetch previews: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.results.find(e=>e.url===r);if(!a){console.error(`Preview not found: ${r}`),process.exitCode=1;return}let o=await Ta(n,a.id);if(!o.ok){o.error instanceof Z?Ea():(console.error(`Failed to remove preview: ${q(o.value)}`),process.exitCode=1);return}console.info(`Preview removed: ${r}`)}async function Ta(e,t){return await X(new URL(`/previews/delete/${t}`,await V(e)),{method:`POST`,body:{}})}function Ea(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Da(){let{values:{help:t,repo:n=await Y()}}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Remove the slice simulator URL from a Prismic repository.
1331
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ba();return}let i=await ga(n);if(!i.ok){i.error instanceof Z?ba():(console.error(`Failed to fetch previews: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.results.find(e=>e.url===r);if(!a){console.error(`Preview not found: ${r}`),process.exitCode=1;return}let o=await ya(n,a.id);if(!o.ok){o.error instanceof Z?ba():(console.error(`Failed to remove preview: ${q(o.value)}`),process.exitCode=1);return}console.info(`Preview removed: ${r}`)}async function ya(e,t){return await X(new URL(`/previews/delete/${t}`,await V(e)),{method:`POST`,body:{}})}function ba(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function xa(){let{values:{help:t,repo:n=await Y()}}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Remove the slice simulator URL from a Prismic repository.
1467
1332
 
1468
1333
  By default, this command reads the repository from prismic.config.json at the
1469
1334
  project root.
@@ -1476,7 +1341,7 @@ FLAGS
1476
1341
  -h, --help Show help for command
1477
1342
 
1478
1343
  LEARN MORE
1479
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ka();return}let r=await Oa(n);if(!r.ok){r.error instanceof Z?ka():(console.error(`Failed to remove simulator URL: ${q(r.value)}`),process.exitCode=1);return}console.info(`Simulator URL removed.`)}async function Oa(e){return await X(new URL(`/core/repository`,await V(e)),{method:`PATCH`,body:{simulator_url:``}})}function ka(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Aa(){let{values:{help:t,repo:n=await Y()},positionals:[r,i]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Update the name of a preview configuration.
1344
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ca();return}let r=await Sa(n);if(!r.ok){r.error instanceof Z?Ca():(console.error(`Failed to remove simulator URL: ${q(r.value)}`),process.exitCode=1);return}console.info(`Simulator URL removed.`)}async function Sa(e){return await X(new URL(`/core/repository`,await V(e)),{method:`PATCH`,body:{simulator_url:``}})}function Ca(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function wa(){let{values:{help:t,repo:n=await Y()},positionals:[r,i]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Update the name of a preview configuration.
1480
1345
 
1481
1346
  By default, this command reads the repository from prismic.config.json at the
1482
1347
  project root.
@@ -1493,7 +1358,7 @@ FLAGS
1493
1358
  -h, --help Show help for command
1494
1359
 
1495
1360
  LEARN MORE
1496
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: <name>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ma();return}let a=pa(r);if(!a){console.error(`Invalid URL: ${r}`),process.exitCode=1;return}let o=await Sa(n);if(!o.ok){o.error instanceof Z?Ma():(console.error(`Failed to fetch previews: ${q(o.value)}`),process.exitCode=1);return}let s=o.value.results.find(e=>e.url===r);if(!s){console.error(`Preview not found: ${r}`),process.exitCode=1;return}let c=await ja(n,s.id,{name:i,websiteURL:a.websiteURL,resolverPath:a.resolverPath});if(!c.ok){c.error instanceof Z?Ma():(console.error(`Failed to update preview: ${q(c.value)}`),process.exitCode=1);return}console.info(`Preview updated: ${r}`)}async function ja(e,t,n){return await X(new URL(`/previews/save/${t}`,await V(e)),{method:`POST`,body:{name:n.name,websiteURL:n.websiteURL,resolverPath:n.resolverPath}})}function Ma(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Na(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set the slice simulator URL for a Prismic repository.
1361
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: <name>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ea();return}let a=sa(r);if(!a){console.error(`Invalid URL: ${r}`),process.exitCode=1;return}let o=await ga(n);if(!o.ok){o.error instanceof Z?Ea():(console.error(`Failed to fetch previews: ${q(o.value)}`),process.exitCode=1);return}let s=o.value.results.find(e=>e.url===r);if(!s){console.error(`Preview not found: ${r}`),process.exitCode=1;return}let c=await Ta(n,s.id,{name:i,websiteURL:a.websiteURL,resolverPath:a.resolverPath});if(!c.ok){c.error instanceof Z?Ea():(console.error(`Failed to update preview: ${q(c.value)}`),process.exitCode=1);return}console.info(`Preview updated: ${r}`)}async function Ta(e,t,n){return await X(new URL(`/previews/save/${t}`,await V(e)),{method:`POST`,body:{name:n.name,websiteURL:n.websiteURL,resolverPath:n.resolverPath}})}function Ea(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Da(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set the slice simulator URL for a Prismic repository.
1497
1362
 
1498
1363
  If the URL pathname does not end with /slice-simulator, it is appended
1499
1364
  automatically.
@@ -1516,7 +1381,7 @@ EXAMPLES
1516
1381
  prismic preview set-simulator http://localhost:3000/slice-simulator
1517
1382
 
1518
1383
  LEARN MORE
1519
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ia();return}let i=Pa(r);if(!i){console.error(`Invalid URL: ${r}`),process.exitCode=1;return}let a=await Fa(n,i);if(!a.ok){a.error instanceof Z?Ia():(console.error(`Failed to set simulator URL: ${q(a.value)}`),process.exitCode=1);return}console.info(`Simulator URL set: ${i}`)}function Pa(e){try{let t=new URL(e);return t.pathname.endsWith(`/slice-simulator`)||(t.pathname=t.pathname.replace(/\/+$/,``)+`/slice-simulator`),t.toString()}catch{return}}async function Fa(e,t){return await X(new URL(`/core/repository`,await V(e)),{method:`PATCH`,body:{simulator_url:t}})}function Ia(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function La(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`add`:await fa();break;case`list`:await ba();break;case`remove`:await wa();break;case`set-name`:await Aa();break;case`set-simulator`:await Na();break;case`get-simulator`:await ga();break;case`remove-simulator`:await Da();break;default:t&&(console.error(`Unknown preview subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage preview configurations in a Prismic repository.
1384
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Aa();return}let i=Oa(r);if(!i){console.error(`Invalid URL: ${r}`),process.exitCode=1;return}let a=await ka(n,i);if(!a.ok){a.error instanceof Z?Aa():(console.error(`Failed to set simulator URL: ${q(a.value)}`),process.exitCode=1);return}console.info(`Simulator URL set: ${i}`)}function Oa(e){try{let t=new URL(e);return t.pathname.endsWith(`/slice-simulator`)||(t.pathname=t.pathname.replace(/\/+$/,``)+`/slice-simulator`),t.toString()}catch{return}}async function ka(e,t){return await X(new URL(`/core/repository`,await V(e)),{method:`PATCH`,body:{simulator_url:t}})}function Aa(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ja(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`add`:await oa();break;case`list`:await ma();break;case`remove`:await va();break;case`set-name`:await wa();break;case`set-simulator`:await Da();break;case`get-simulator`:await ua();break;case`remove-simulator`:await xa();break;default:t&&(console.error(`Unknown preview subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage preview configurations in a Prismic repository.
1520
1385
 
1521
1386
  USAGE
1522
1387
  prismic preview <command> [flags]
@@ -1534,7 +1399,7 @@ FLAGS
1534
1399
  -h, --help Show help for command
1535
1400
 
1536
1401
  LEARN MORE
1537
- Use \`prismic preview <command> --help\` for more information about a command.`)}}async function Ra(){let{values:{help:t,repo:r=await Y(),"dry-run":i,"types-only":a,"slices-only":o,json:c,types:l,"no-types":u}}=e({args:process.argv.slice(3),options:{repo:{type:`string`,short:`r`},"dry-run":{type:`boolean`},"types-only":{type:`boolean`},"slices-only":{type:`boolean`},json:{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Pull custom types and slices from Prismic to local files.
1402
+ Use \`prismic preview <command> --help\` for more information about a command.`)}}async function Ma(){let{values:{help:t,repo:r=await Y(),"dry-run":i,"types-only":a,"slices-only":o,json:c,types:l}}=e({args:process.argv.slice(3),options:{repo:{type:`string`,short:`r`},"dry-run":{type:`boolean`},"types-only":{type:`boolean`},"slices-only":{type:`boolean`},json:{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Pull custom types and slices from Prismic to local files.
1538
1403
 
1539
1404
  By default, this command reads the repository from prismic.config.json at the
1540
1405
  project root.
@@ -1542,8 +1407,6 @@ project root.
1542
1407
  USAGE
1543
1408
  prismic pull [flags]
1544
1409
 
1545
- Types are generated by default after changes. Use --no-types to skip.
1546
-
1547
1410
  FLAGS
1548
1411
  -r, --repo string Repository domain
1549
1412
  --dry-run Show what would be pulled without writing files
@@ -1551,16 +1414,15 @@ FLAGS
1551
1414
  --slices-only Only pull slices
1552
1415
  --json Output as JSON
1553
1416
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1554
- --no-types Skip type generation
1555
1417
  -h, --help Show help for command
1556
1418
 
1557
1419
  EXAMPLES
1558
1420
  prismic pull
1559
1421
  prismic pull --repo my-repo
1560
1422
  prismic pull --dry-run
1561
- prismic pull --types-only`);return}if(!r){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1;return}c||console.info(`Pulling from repository: ${r}\n`);let d=!o,f=!a,[p,m]=await Promise.all([d?Pn(r):Promise.resolve({ok:!0,value:[]}),f?Fn(r):Promise.resolve({ok:!0,value:[]})]);if(!p.ok){console.error(`Failed to fetch custom types: ${p.error}`),process.exitCode=1;return}if(!m.ok){console.error(`Failed to fetch slices: ${m.error}`),process.exitCode=1;return}let h=p.value,g=m.value;if(c||(d&&console.info(`Fetching custom types... ${h.length} types`),f&&console.info(`Fetching slices... ${g.length} slices`)),i){if(c)console.info(q({customTypes:h,slices:g}));else{if(console.info(``),d&&h.length>0){console.info(`Would write custom types:`);for(let e of h)console.info(` customtypes/${e.id}/index.json`)}if(f&&g.length>0){let e=za(await On());console.info(`Would write slices:`);for(let t of g)console.info(` ${e}${jn(t.name)}/model.json`)}console.info(`\nDry run complete: ${h.length} custom types, ${g.length} slices`)}return}let _=await W(`package.json`);if(!_){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let v=new URL(`.`,_),y=[],b=[];if(d&&h.length>0){c||console.info(`
1562
- Writing custom types:`);let e=new URL(`customtypes/`,v);for(let t of h){let r=new URL(`${t.id}/`,e),i=new URL(`index.json`,r);try{await n(r,{recursive:!0}),await s(i,q(t));let e=`customtypes/${t.id}/index.json`;y.push(e),c||console.info(` ${e}`)}catch(e){console.error(`Failed to write custom type ${t.id}: ${e instanceof Error?e.message:e}`),process.exitCode=1;return}}}if(f&&g.length>0){c||console.info(`
1563
- Writing slices:`);let e=await On();for(let t of g){let r=new URL(`${jn(t.name)}/`,e),i=new URL(`model.json`,r);try{await n(r,{recursive:!0}),await s(i,q(t));let a=`${za(e)}${jn(t.name)}/model.json`;b.push(a),c||console.info(` ${a}`)}catch(e){console.error(`Failed to write slice ${t.name}: ${e instanceof Error?e.message:e}`),process.exitCode=1;return}}}if(c?console.info(q({writtenTypes:y,writtenSlices:b})):console.info(`\nPull complete: ${y.length} custom types, ${b.length} slices`),!c&&!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}function za(e){let t=process.cwd(),n=e.pathname;return n.startsWith(t)?n.slice(t.length+1):n}function Ba(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map(t.map(e=>[e.id,e])),i=[],a=[],o=[];for(let t of e){let e=r.get(t.id);e?JSON.stringify(t)!==JSON.stringify(e)&&a.push(t):i.push(t)}for(let e of t)n.has(e.id)||o.push(e.id);return{toInsert:i,toUpdate:a,toDelete:o}}async function Va(){let{values:{help:t,repo:n=await Y(),"dry-run":r,"types-only":i,"slices-only":a,delete:o,json:s}}=e({args:process.argv.slice(3),options:{repo:{type:`string`,short:`r`},"dry-run":{type:`boolean`},"types-only":{type:`boolean`},"slices-only":{type:`boolean`},delete:{type:`boolean`},json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Push custom types and slices to Prismic from local files.
1423
+ prismic pull --types-only`);return}if(!r){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1;return}c||console.info(`Pulling from repository: ${r}\n`);let u=!o,d=!a,[f,p]=await Promise.all([u?Pn(r):Promise.resolve({ok:!0,value:[]}),d?Fn(r):Promise.resolve({ok:!0,value:[]})]);if(!f.ok){console.error(`Failed to fetch custom types: ${f.error}`),process.exitCode=1;return}if(!p.ok){console.error(`Failed to fetch slices: ${p.error}`),process.exitCode=1;return}let m=f.value,h=p.value;if(c||(u&&console.info(`Fetching custom types... ${m.length} types`),d&&console.info(`Fetching slices... ${h.length} slices`)),i){if(c)console.info(q({customTypes:m,slices:h}));else{if(console.info(``),u&&m.length>0){console.info(`Would write custom types:`);for(let e of m)console.info(` customtypes/${e.id}/index.json`)}if(d&&h.length>0){let e=Na(await On());console.info(`Would write slices:`);for(let t of h)console.info(` ${e}${jn(t.name)}/model.json`)}console.info(`\nDry run complete: ${m.length} custom types, ${h.length} slices`)}return}let g=await W(`package.json`);if(!g){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let _=new URL(`.`,g),v=[],y=[];if(u&&m.length>0){c||console.info(`
1424
+ Writing custom types:`);let e=new URL(`customtypes/`,_);for(let t of m){let r=new URL(`${t.id}/`,e),i=new URL(`index.json`,r);try{await n(r,{recursive:!0}),await s(i,q(t));let e=`customtypes/${t.id}/index.json`;v.push(e),c||console.info(` ${e}`)}catch(e){console.error(`Failed to write custom type ${t.id}: ${e instanceof Error?e.message:e}`),process.exitCode=1;return}}}if(d&&h.length>0){c||console.info(`
1425
+ Writing slices:`);let e=await On();for(let t of h){let r=new URL(`${jn(t.name)}/`,e),i=new URL(`model.json`,r);try{await n(r,{recursive:!0}),await s(i,q(t));let a=`${Na(e)}${jn(t.name)}/model.json`;y.push(a),c||console.info(` ${a}`)}catch(e){console.error(`Failed to write slice ${t.name}: ${e instanceof Error?e.message:e}`),process.exitCode=1;return}}}if(c?console.info(q({writtenTypes:v,writtenSlices:y})):console.info(`\nPull complete: ${v.length} custom types, ${y.length} slices`),!c)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}function Na(e){let t=process.cwd(),n=e.pathname;return n.startsWith(t)?n.slice(t.length+1):n}function Pa(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map(t.map(e=>[e.id,e])),i=[],a=[],o=[];for(let t of e){let e=r.get(t.id);e?JSON.stringify(t)!==JSON.stringify(e)&&a.push(t):i.push(t)}for(let e of t)n.has(e.id)||o.push(e.id);return{toInsert:i,toUpdate:a,toDelete:o}}async function Fa(){let{values:{help:t,repo:n=await Y(),"dry-run":r,"types-only":i,"slices-only":a,delete:o,json:s}}=e({args:process.argv.slice(3),options:{repo:{type:`string`,short:`r`},"dry-run":{type:`boolean`},"types-only":{type:`boolean`},"slices-only":{type:`boolean`},delete:{type:`boolean`},json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Push custom types and slices to Prismic from local files.
1564
1426
 
1565
1427
  By default, this command reads the repository from prismic.config.json at the
1566
1428
  project root.
@@ -1582,10 +1444,10 @@ EXAMPLES
1582
1444
  prismic push --repo my-repo
1583
1445
  prismic push --dry-run
1584
1446
  prismic push --types-only
1585
- prismic push --delete`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1;return}s||console.info(`Pushing to repository: ${n}\n`);let c=!a,l=!i,[u,d,f,p]=await Promise.all([c?In():Promise.resolve({ok:!0,value:[]}),l?Ln():Promise.resolve({ok:!0,value:[]}),c?Pn(n):Promise.resolve({ok:!0,value:[]}),l?Fn(n):Promise.resolve({ok:!0,value:[]})]);if(!u.ok){console.error(`Failed to read local custom types: ${u.error}`),process.exitCode=1;return}if(!d.ok){console.error(`Failed to read local slices: ${d.error}`),process.exitCode=1;return}if(!f.ok){console.error(`Failed to fetch remote custom types: ${f.error}`),process.exitCode=1;return}if(!p.ok){console.error(`Failed to fetch remote slices: ${p.error}`),process.exitCode=1;return}let m=u.value,h=d.value,g=f.value,_=p.value;s||(c&&(console.info(`Local custom types: ${m.length}`),console.info(`Remote custom types: ${g.length}`)),l&&(console.info(`Local slices: ${h.length}`),console.info(`Remote slices: ${_.length}`)));let v=c?Ba([...m],[...g]):{toInsert:[],toUpdate:[],toDelete:[]},y=l?Ba([...h],[..._]):{toInsert:[],toUpdate:[],toDelete:[]};o||(v.toDelete=[],y.toDelete=[]);let b=v.toInsert.length+v.toUpdate.length+v.toDelete.length+y.toInsert.length+y.toUpdate.length+y.toDelete.length;if(b===0){s?console.info(q({customTypes:{inserted:[],updated:[],deleted:[]},slices:{inserted:[],updated:[],deleted:[]}})):console.info(`
1447
+ prismic push --delete`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1;return}s||console.info(`Pushing to repository: ${n}\n`);let c=!a,l=!i,[u,d,f,p]=await Promise.all([c?In():Promise.resolve({ok:!0,value:[]}),l?Ln():Promise.resolve({ok:!0,value:[]}),c?Pn(n):Promise.resolve({ok:!0,value:[]}),l?Fn(n):Promise.resolve({ok:!0,value:[]})]);if(!u.ok){console.error(`Failed to read local custom types: ${u.error}`),process.exitCode=1;return}if(!d.ok){console.error(`Failed to read local slices: ${d.error}`),process.exitCode=1;return}if(!f.ok){console.error(`Failed to fetch remote custom types: ${f.error}`),process.exitCode=1;return}if(!p.ok){console.error(`Failed to fetch remote slices: ${p.error}`),process.exitCode=1;return}let m=u.value,h=d.value,g=f.value,_=p.value;s||(c&&(console.info(`Local custom types: ${m.length}`),console.info(`Remote custom types: ${g.length}`)),l&&(console.info(`Local slices: ${h.length}`),console.info(`Remote slices: ${_.length}`)));let v=c?Pa([...m],[...g]):{toInsert:[],toUpdate:[],toDelete:[]},y=l?Pa([...h],[..._]):{toInsert:[],toUpdate:[],toDelete:[]};o||(v.toDelete=[],y.toDelete=[]);let b=v.toInsert.length+v.toUpdate.length+v.toDelete.length+y.toInsert.length+y.toUpdate.length+y.toDelete.length;if(b===0){s?console.info(q({customTypes:{inserted:[],updated:[],deleted:[]},slices:{inserted:[],updated:[],deleted:[]}})):console.info(`
1586
1448
  No changes to push.`);return}if(r){if(s)console.info(q({customTypes:{toInsert:v.toInsert.map(e=>e.id),toUpdate:v.toUpdate.map(e=>e.id),toDelete:v.toDelete},slices:{toInsert:y.toInsert.map(e=>e.id),toUpdate:y.toUpdate.map(e=>e.id),toDelete:y.toDelete}}));else{if(console.info(``),c){if(v.toInsert.length>0){console.info(`Would insert custom types:`);for(let e of v.toInsert)console.info(` + ${e.id}`)}if(v.toUpdate.length>0){console.info(`Would update custom types:`);for(let e of v.toUpdate)console.info(` ~ ${e.id}`)}if(v.toDelete.length>0){console.info(`Would delete custom types:`);for(let e of v.toDelete)console.info(` - ${e}`)}}if(l){if(y.toInsert.length>0){console.info(`Would insert slices:`);for(let e of y.toInsert)console.info(` + ${e.id}`)}if(y.toUpdate.length>0){console.info(`Would update slices:`);for(let e of y.toUpdate)console.info(` ~ ${e.id}`)}if(y.toDelete.length>0){console.info(`Would delete slices:`);for(let e of y.toDelete)console.info(` - ${e}`)}}console.info(`\nDry run complete: ${b} changes would be made`)}return}let x={customTypes:{inserted:[],updated:[],deleted:[]},slices:{inserted:[],updated:[],deleted:[]}};if(c){!s&&(v.toInsert.length>0||v.toUpdate.length>0||v.toDelete.length>0)&&console.info(`
1587
1449
  Pushing custom types:`);for(let e of v.toInsert){let t=await Rn(n,e);if(!t.ok){console.error(`Failed to insert custom type ${e.id}: ${t.error}`),process.exitCode=1;return}x.customTypes.inserted.push(e.id),s||console.info(` + ${e.id}`)}for(let e of v.toUpdate){let t=await zn(n,e);if(!t.ok){console.error(`Failed to update custom type ${e.id}: ${t.error}`),process.exitCode=1;return}x.customTypes.updated.push(e.id),s||console.info(` ~ ${e.id}`)}for(let e of v.toDelete){let t=await Bn(n,e);if(!t.ok){console.error(`Failed to delete custom type ${e}: ${t.error}`),process.exitCode=1;return}x.customTypes.deleted.push(e),s||console.info(` - ${e}`)}}if(l){!s&&(y.toInsert.length>0||y.toUpdate.length>0||y.toDelete.length>0)&&console.info(`
1588
- Pushing slices:`);for(let e of y.toInsert){let t=await Vn(n,e);if(!t.ok){console.error(`Failed to insert slice ${e.id}: ${t.error}`),process.exitCode=1;return}x.slices.inserted.push(e.id),s||console.info(` + ${e.id}`)}for(let e of y.toUpdate){let t=await Hn(n,e);if(!t.ok){console.error(`Failed to update slice ${e.id}: ${t.error}`),process.exitCode=1;return}x.slices.updated.push(e.id),s||console.info(` ~ ${e.id}`)}for(let e of y.toDelete){let t=await Un(n,e);if(!t.ok){console.error(`Failed to delete slice ${e}: ${t.error}`),process.exitCode=1;return}x.slices.deleted.push(e),s||console.info(` - ${e}`)}}if(s)console.info(q(x));else{let e=x.customTypes.inserted.length+x.customTypes.updated.length+x.customTypes.deleted.length+x.slices.inserted.length+x.slices.updated.length+x.slices.deleted.length;console.info(`\nPush complete: ${e} changes`)}}const Ha=/^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$/;async function Ua(){let{values:{help:t,name:n,"no-config":r,replace:i},positionals:[a]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`},name:{type:`string`,short:`n`},"no-config":{type:`boolean`},replace:{type:`boolean`}},allowPositionals:!0});if(t){console.info(`Create a new Prismic repository.
1450
+ Pushing slices:`);for(let e of y.toInsert){let t=await Vn(n,e);if(!t.ok){console.error(`Failed to insert slice ${e.id}: ${t.error}`),process.exitCode=1;return}x.slices.inserted.push(e.id),s||console.info(` + ${e.id}`)}for(let e of y.toUpdate){let t=await Hn(n,e);if(!t.ok){console.error(`Failed to update slice ${e.id}: ${t.error}`),process.exitCode=1;return}x.slices.updated.push(e.id),s||console.info(` ~ ${e.id}`)}for(let e of y.toDelete){let t=await Un(n,e);if(!t.ok){console.error(`Failed to delete slice ${e}: ${t.error}`),process.exitCode=1;return}x.slices.deleted.push(e),s||console.info(` - ${e}`)}}if(s)console.info(q(x));else{let e=x.customTypes.inserted.length+x.customTypes.updated.length+x.customTypes.deleted.length+x.slices.inserted.length+x.slices.updated.length+x.slices.deleted.length;console.info(`\nPush complete: ${e} changes`)}}const Ia=/^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$/;async function La(){let{values:{help:t,name:n,"no-config":r,replace:i},positionals:[a]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`},name:{type:`string`,short:`n`},"no-config":{type:`boolean`},replace:{type:`boolean`}},allowPositionals:!0});if(t){console.info(`Create a new Prismic repository.
1589
1451
 
1590
1452
  Creates prismic.config.json in the current directory. If a config file already
1591
1453
  exists, use --replace to update it with the new repository.
@@ -1604,7 +1466,7 @@ FLAGS
1604
1466
  -h, --help Show help for command
1605
1467
 
1606
1468
  LEARN MORE
1607
- Use \`prismic repo <command> --help\` for more information about a command.`);return}if(!a){console.error(`Missing required argument: domain`),process.exitCode=1;return}if(!Ha.test(a)){console.error(`Invalid domain format.`),console.error(`Must be at least 4 characters, start and end with alphanumeric, and contain only alphanumerics and hyphens.`),process.exitCode=1;return}if(!await H()){Ga();return}let o=await Gr();if(!r&&o.ok&&!i){console.error(`This project already has a repository: ${o.config.repositoryName}`),console.error(`Use --replace to replace it, or --no-config to skip config creation.`),process.exitCode=1;return}let s=await Wa(a,n);if(!s.ok){s.error instanceof Z?Ga():(console.error(`Failed to create repository: ${q(s.error)}`),process.exitCode=1);return}if(!r)if(o.ok){let e=await qr({repositoryName:a});e.ok?console.info(`Updated prismic.config.json`):console.warn(`Could not update prismic.config.json: `+e.error.message)}else{let e=await Wr({repositoryName:a});e.ok?console.info(`Created prismic.config.json`):console.warn(`Could not create prismic.config.json: `+e.error.message)}console.info(`Repository created: ${a}`),console.info(`URL: ${await V(a)}`)}async function Wa(e,t=e){return await X(new URL(`/app/dashboard/repositories`,await Cn()),{method:`POST`,body:{domain:e,name:t,framework:`next`,plan:`personal`,usageIntent:`Exploring Prismic's features for future projects.`,usageIntentIndex:0}})}function Ga(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const Ka=F({repository:F({api_access:R()})});async function qa(){let{values:{help:t,repo:n=await Y()}}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Get the Content API access level of a Prismic repository.
1469
+ Use \`prismic repo <command> --help\` for more information about a command.`);return}if(!a){console.error(`Missing required argument: domain`),process.exitCode=1;return}if(!Ia.test(a)){console.error(`Invalid domain format.`),console.error(`Must be at least 4 characters, start and end with alphanumeric, and contain only alphanumerics and hyphens.`),process.exitCode=1;return}if(!await H()){za();return}let o=await zr();if(!r&&o.ok&&!i){console.error(`This project already has a repository: ${o.config.repositoryName}`),console.error(`Use --replace to replace it, or --no-config to skip config creation.`),process.exitCode=1;return}let s=await Ra(a,n);if(!s.ok){s.error instanceof Z?za():(console.error(`Failed to create repository: ${q(s.error)}`),process.exitCode=1);return}if(!r)if(o.ok){let e=await Vr({repositoryName:a});e.ok?console.info(`Updated prismic.config.json`):console.warn(`Could not update prismic.config.json: `+e.error.message)}else{let e=await Rr({repositoryName:a});e.ok?console.info(`Created prismic.config.json`):console.warn(`Could not create prismic.config.json: `+e.error.message)}console.info(`Repository created: ${a}`),console.info(`URL: ${await V(a)}`)}async function Ra(e,t=e){return await X(new URL(`/app/dashboard/repositories`,await Cn()),{method:`POST`,body:{domain:e,name:t,framework:`next`,plan:`personal`,usageIntent:`Exploring Prismic's features for future projects.`,usageIntentIndex:0}})}function za(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const Ba=F({repository:F({api_access:R()})});async function Va(){let{values:{help:t,repo:n=await Y()}}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Get the Content API access level of a Prismic repository.
1608
1470
 
1609
1471
  By default, this command reads the repository from prismic.config.json at the
1610
1472
  project root.
@@ -1617,7 +1479,7 @@ FLAGS
1617
1479
  -h, --help Show help for command
1618
1480
 
1619
1481
  LEARN MORE
1620
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ya();return}let r=await Ja(n);if(!r.ok){r.error instanceof Z?Ya():(console.error(`Failed to get repository access: ${q(r.value)}`),process.exitCode=1);return}console.info(r.value.repository.api_access)}async function Ja(e){let t=await V(e);return await X(new URL(`syncState`,t),{schema:Ka})}function Ya(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const Xa=F({repositories:N(F({domain:R(),name:I(R()),role:R()}))});async function Za(){let{values:{help:t,json:n}}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`},json:{type:`boolean`}}});if(t){console.info(`List all Prismic repositories.
1482
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ua();return}let r=await Ha(n);if(!r.ok){r.error instanceof Z?Ua():(console.error(`Failed to get repository access: ${q(r.value)}`),process.exitCode=1);return}console.info(r.value.repository.api_access)}async function Ha(e){let t=await V(e);return await X(new URL(`syncState`,t),{schema:Ba})}function Ua(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const Wa=F({repositories:N(F({domain:R(),name:I(R()),role:R()}))});async function Ga(){let{values:{help:t,json:n}}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`},json:{type:`boolean`}}});if(t){console.info(`List all Prismic repositories.
1621
1483
 
1622
1484
  USAGE
1623
1485
  prismic repo list [flags]
@@ -1627,7 +1489,7 @@ FLAGS
1627
1489
  -h, --help Show help for command
1628
1490
 
1629
1491
  LEARN MORE
1630
- Use \`prismic repo <command> --help\` for more information about a command.`);return}if(!await H()){$a();return}let r=await Qa();if(!r.ok){r.error instanceof Z?$a():(console.error(`Failed to fetch repositories: ${q(r.value)}`),process.exitCode=1);return}let i=r.value.repositories;if(n){let e=await Promise.all(i.map(async e=>({domain:e.domain,name:e.name||null,role:e.role,url:(await V(e.domain)).toString()})));console.info(q(e));return}if(i.length===0){console.info(`No repositories found.`);return}for(let e of i){let t=e.name||`(no name)`;console.info(`${e.domain} ${t} ${e.role}`)}}async function Qa(){return await X(new URL(`profile`,await vn()),{schema:Xa})}function $a(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const eo=[`private`,`public`,`open`];async function to(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set the Content API access level of a Prismic repository.
1492
+ Use \`prismic repo <command> --help\` for more information about a command.`);return}if(!await H()){qa();return}let r=await Ka();if(!r.ok){r.error instanceof Z?qa():(console.error(`Failed to fetch repositories: ${q(r.value)}`),process.exitCode=1);return}let i=r.value.repositories;if(n){let e=await Promise.all(i.map(async e=>({domain:e.domain,name:e.name||null,role:e.role,url:(await V(e.domain)).toString()})));console.info(q(e));return}if(i.length===0){console.info(`No repositories found.`);return}for(let e of i){let t=e.name||`(no name)`;console.info(`${e.domain} ${t} ${e.role}`)}}async function Ka(){return await X(new URL(`profile`,await vn()),{schema:Wa})}function qa(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const Ja=[`private`,`public`,`open`];async function Ya(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set the Content API access level of a Prismic repository.
1631
1493
 
1632
1494
  By default, this command reads the repository from prismic.config.json at the
1633
1495
  project root.
@@ -1643,7 +1505,7 @@ FLAGS
1643
1505
  -h, --help Show help for command
1644
1506
 
1645
1507
  LEARN MORE
1646
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <level>`),process.exitCode=1;return}if(!eo.includes(r)){console.error(`Invalid access level: ${r}. Must be one of: ${eo.join(`, `)}`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ro();return}let i=await no(n,r);if(!i.ok){i.error instanceof Z?ro():(console.error(`Failed to set repository access: ${q(i.value)}`),process.exitCode=1);return}console.info(`Repository access set to: ${r}`)}async function no(e,t){let n=await V(e);return await X(new URL(`settings/security/apiaccess`,n),{method:`POST`,body:{api_access:t}})}function ro(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function io(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set the display name of a Prismic repository.
1508
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <level>`),process.exitCode=1;return}if(!Ja.includes(r)){console.error(`Invalid access level: ${r}. Must be one of: ${Ja.join(`, `)}`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Za();return}let i=await Xa(n,r);if(!i.ok){i.error instanceof Z?Za():(console.error(`Failed to set repository access: ${q(i.value)}`),process.exitCode=1);return}console.info(`Repository access set to: ${r}`)}async function Xa(e,t){let n=await V(e);return await X(new URL(`settings/security/apiaccess`,n),{method:`POST`,body:{api_access:t}})}function Za(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Qa(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set the display name of a Prismic repository.
1647
1509
 
1648
1510
  By default, this command reads the repository from prismic.config.json at the
1649
1511
  project root.
@@ -1659,7 +1521,7 @@ FLAGS
1659
1521
  -h, --help Show help for command
1660
1522
 
1661
1523
  LEARN MORE
1662
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <name>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){oo();return}let i=await ao(n,r);if(!i.ok){i.error instanceof Z?oo():M(i.error)?(console.error(`Failed to set repository name: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to set repository name: ${q(i.value)}`),process.exitCode=1);return}console.info(`Repository name set to: ${i.value.repository.name}`)}async function ao(e,t){let n=await V(e),r=new URL(`app/settings/repository`,n),i=new FormData;return i.set(`displayname`,t),await X(r,{method:`POST`,body:i,schema:F({repository:F({name:R()})})})}function oo(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const so=F({repositories:N(F({domain:R(),name:I(R())}))});async function co(){let{values:{help:t,repo:n=await Y(),web:r}}=e({args:process.argv.slice(4),options:{web:{type:`boolean`,short:`w`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}}});if(t){console.info(`View a Prismic repository.
1524
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <name>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){eo();return}let i=await $a(n,r);if(!i.ok){i.error instanceof Z?eo():M(i.error)?(console.error(`Failed to set repository name: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to set repository name: ${q(i.value)}`),process.exitCode=1);return}console.info(`Repository name set to: ${i.value.repository.name}`)}async function $a(e,t){let n=await V(e),r=new URL(`app/settings/repository`,n),i=new FormData;return i.set(`displayname`,t),await X(r,{method:`POST`,body:i,schema:F({repository:F({name:R()})})})}function eo(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const to=F({repositories:N(F({domain:R(),name:I(R())}))});async function no(){let{values:{help:t,repo:n=await Y(),web:r}}=e({args:process.argv.slice(4),options:{web:{type:`boolean`,short:`w`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}}});if(t){console.info(`View a Prismic repository.
1663
1525
 
1664
1526
  By default, this command reads the repository from prismic.config.json at the
1665
1527
  project root.
@@ -1673,7 +1535,7 @@ FLAGS
1673
1535
  -h, --help Show help for command
1674
1536
 
1675
1537
  LEARN MORE
1676
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}let i=await V(n);if(r){uo(i.toString()),console.info(`Opening ${i}`);return}if(!await H()){fo();return}let a=await lo();if(!a.ok){a.error instanceof Z?fo():(console.error(`Failed to fetch repository info: ${q(a.value)}`),process.exitCode=1);return}let o=a.value.repositories.find(e=>e.domain===n);if(!o){console.error(`Repository not found: ${n}`),process.exitCode=1;return}let s=o.name||`(no name)`;console.info(`Name: ${s}`),console.info(`URL: ${i}`)}async function lo(){return await X(new URL(`profile`,await vn()),{schema:so})}function uo(e){d(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e}"`)}function fo(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function po(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`create`:await Ua();break;case`list`:await Za();break;case`view`:await co();break;case`get-access`:await qa();break;case`set-access`:await to();break;case`set-name`:await io();break;default:t&&(console.error(`Unknown repo subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage Prismic repositories.
1538
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}let i=await V(n);if(r){io(i.toString()),console.info(`Opening ${i}`);return}if(!await H()){ao();return}let a=await ro();if(!a.ok){a.error instanceof Z?ao():(console.error(`Failed to fetch repository info: ${q(a.value)}`),process.exitCode=1);return}let o=a.value.repositories.find(e=>e.domain===n);if(!o){console.error(`Repository not found: ${n}`),process.exitCode=1;return}let s=o.name||`(no name)`;console.info(`Name: ${s}`),console.info(`URL: ${i}`)}async function ro(){return await X(new URL(`profile`,await vn()),{schema:to})}function io(e){d(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e}"`)}function ao(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function oo(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`create`:await La();break;case`list`:await Ga();break;case`view`:await no();break;case`get-access`:await Va();break;case`set-access`:await Ya();break;case`set-name`:await Qa();break;default:t&&(console.error(`Unknown repo subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage Prismic repositories.
1677
1539
 
1678
1540
  USAGE
1679
1541
  prismic repo <command> [flags]
@@ -1690,7 +1552,7 @@ FLAGS
1690
1552
  -h, --help Show help for command
1691
1553
 
1692
1554
  LEARN MORE
1693
- Use \`prismic repo <command> --help\` for more information about a command.`)}}async function mo(){let{values:{help:t,variation:n,label:r,default:i,"true-label":a,"false-label":o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},default:{type:`boolean`},"true-label":{type:`string`},"false-label":{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a boolean (toggle) field to an existing slice.
1555
+ Use \`prismic repo <command> --help\` for more information about a command.`)}}async function so(){let{values:{help:t,variation:n,label:r,default:i,"true-label":a,"false-label":o,types:c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},default:{type:`boolean`},"true-label":{type:`string`},"false-label":{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a boolean (toggle) field to an existing slice.
1694
1556
 
1695
1557
  USAGE
1696
1558
  prismic slice add-field boolean <slice-id> <field-id> [flags]
@@ -1699,8 +1561,6 @@ ARGUMENTS
1699
1561
  slice-id Slice identifier (required)
1700
1562
  field-id Field identifier (required)
1701
1563
 
1702
- Types are generated by default after changes. Use --no-types to skip.
1703
-
1704
1564
  FLAGS
1705
1565
  -v, --variation string Target variation (default: first variation)
1706
1566
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -1708,15 +1568,14 @@ FLAGS
1708
1568
  --true-label string Label shown when toggle is on
1709
1569
  --false-label string Label shown when toggle is off
1710
1570
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1711
- --no-types Skip type generation
1712
1571
  -h, --help Show help for command
1713
1572
 
1714
1573
  EXAMPLES
1715
1574
  prismic slice add-field boolean my_slice featured
1716
1575
  prismic slice add-field boolean hero show_overlay --default
1717
- prismic slice add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!u){console.error(`Missing required argument: slice-id
1718
- `),console.error(`Usage: prismic slice add-field boolean <slice-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
1719
- `),console.error(`Usage: prismic slice add-field boolean <slice-id> <field-id>`),process.exitCode=1;return}let f=await G(u);if(!f.ok){console.error(f.error),process.exitCode=1;return}let{model:p,modelPath:m}=f;if(p.variations.length===0){console.error(`Slice "${u}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let h=n?p.variations.find(e=>e.id===n):p.variations[0];if(!h){console.error(`Variation "${n}" not found in slice "${u}"\n`),console.error(`Available variations: ${p.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}h.primary||={};for(let e of p.variations)if(e.primary?.[d]){console.error(`Field "${d}" already exists in variation "${e.id}"`),process.exitCode=1;return}let g={type:`Boolean`,config:{label:r??J(d),...i&&{default_value:!0},...a&&{placeholder_true:a},...o&&{placeholder_false:o}}};h.primary[d]=g;try{await s(m,q(p))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Boolean) to "${h.id}" variation in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function ho(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing slice.
1576
+ prismic slice add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!l){console.error(`Missing required argument: slice-id
1577
+ `),console.error(`Usage: prismic slice add-field boolean <slice-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
1578
+ `),console.error(`Usage: prismic slice add-field boolean <slice-id> <field-id>`),process.exitCode=1;return}let d=await G(l);if(!d.ok){console.error(d.error),process.exitCode=1;return}let{model:f,modelPath:p}=d;if(f.variations.length===0){console.error(`Slice "${l}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let m=n?f.variations.find(e=>e.id===n):f.variations[0];if(!m){console.error(`Variation "${n}" not found in slice "${l}"\n`),console.error(`Available variations: ${f.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}m.primary||={};for(let e of f.variations)if(e.primary?.[u]){console.error(`Field "${u}" already exists in variation "${e.id}"`),process.exitCode=1;return}let h={type:`Boolean`,config:{label:r??J(u),...i&&{default_value:!0},...a&&{placeholder_true:a},...o&&{placeholder_false:o}}};m.primary[u]=h;try{await s(p,q(f))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Added field "${u}" (Boolean) to "${m.id}" variation in ${l}`);try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function co(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing slice.
1720
1579
 
1721
1580
  USAGE
1722
1581
  prismic slice add-field color <slice-id> <field-id> [flags]
@@ -1725,22 +1584,19 @@ ARGUMENTS
1725
1584
  slice-id Slice identifier (required)
1726
1585
  field-id Field identifier (required)
1727
1586
 
1728
- Types are generated by default after changes. Use --no-types to skip.
1729
-
1730
1587
  FLAGS
1731
1588
  -v, --variation string Target variation (default: first variation)
1732
1589
  -l, --label string Display label for the field (inferred from field-id if omitted)
1733
1590
  -p, --placeholder string Placeholder text
1734
1591
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1735
- --no-types Skip type generation
1736
1592
  -h, --help Show help for command
1737
1593
 
1738
1594
  EXAMPLES
1739
1595
  prismic slice add-field color my_slice background_color
1740
1596
  prismic slice add-field color hero accent --label "Accent Color"
1741
- prismic slice add-field color banner theme_color --variation "dark"`);return}if(!c){console.error(`Missing required argument: slice-id
1742
- `),console.error(`Usage: prismic slice add-field color <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
1743
- `),console.error(`Usage: prismic slice add-field color <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Color`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Color) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function go(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date picker field to an existing slice.
1597
+ prismic slice add-field color banner theme_color --variation "dark"`);return}if(!o){console.error(`Missing required argument: slice-id
1598
+ `),console.error(`Usage: prismic slice add-field color <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
1599
+ `),console.error(`Usage: prismic slice add-field color <slice-id> <field-id>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;if(u.variations.length===0){console.error(`Slice "${o}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let f=n?u.variations.find(e=>e.id===n):u.variations[0];if(!f){console.error(`Variation "${n}" not found in slice "${o}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}f.primary||={};for(let e of u.variations)if(e.primary?.[c]){console.error(`Field "${c}" already exists in variation "${e.id}"`),process.exitCode=1;return}let p={type:`Color`,config:{label:r??J(c),...i&&{placeholder:i}}};f.primary[c]=p;try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Added field "${c}" (Color) to "${f.id}" variation in ${o}`);try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function lo(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date picker field to an existing slice.
1744
1600
 
1745
1601
  USAGE
1746
1602
  prismic slice add-field date <slice-id> <field-id> [flags]
@@ -1749,22 +1605,19 @@ ARGUMENTS
1749
1605
  slice-id Slice identifier (required)
1750
1606
  field-id Field identifier (required)
1751
1607
 
1752
- Types are generated by default after changes. Use --no-types to skip.
1753
-
1754
1608
  FLAGS
1755
1609
  -v, --variation string Target variation (default: first variation)
1756
1610
  -l, --label string Display label for the field (inferred from field-id if omitted)
1757
1611
  -p, --placeholder string Placeholder text
1758
1612
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1759
- --no-types Skip type generation
1760
1613
  -h, --help Show help for command
1761
1614
 
1762
1615
  EXAMPLES
1763
1616
  prismic slice add-field date my_slice publish_date
1764
1617
  prismic slice add-field date event start_date --label "Start Date"
1765
- prismic slice add-field date promo end_date --variation "countdown"`);return}if(!c){console.error(`Missing required argument: slice-id
1766
- `),console.error(`Usage: prismic slice add-field date <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
1767
- `),console.error(`Usage: prismic slice add-field date <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Date`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Date) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function _o(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed (oEmbed) field to an existing slice.
1618
+ prismic slice add-field date promo end_date --variation "countdown"`);return}if(!o){console.error(`Missing required argument: slice-id
1619
+ `),console.error(`Usage: prismic slice add-field date <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
1620
+ `),console.error(`Usage: prismic slice add-field date <slice-id> <field-id>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;if(u.variations.length===0){console.error(`Slice "${o}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let f=n?u.variations.find(e=>e.id===n):u.variations[0];if(!f){console.error(`Variation "${n}" not found in slice "${o}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}f.primary||={};for(let e of u.variations)if(e.primary?.[c]){console.error(`Field "${c}" already exists in variation "${e.id}"`),process.exitCode=1;return}let p={type:`Date`,config:{label:r??J(c),...i&&{placeholder:i}}};f.primary[c]=p;try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Added field "${c}" (Date) to "${f.id}" variation in ${o}`);try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function uo(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed (oEmbed) field to an existing slice.
1768
1621
 
1769
1622
  USAGE
1770
1623
  prismic slice add-field embed <slice-id> <field-id> [flags]
@@ -1773,22 +1626,19 @@ ARGUMENTS
1773
1626
  slice-id Slice identifier (required)
1774
1627
  field-id Field identifier (required)
1775
1628
 
1776
- Types are generated by default after changes. Use --no-types to skip.
1777
-
1778
1629
  FLAGS
1779
1630
  -v, --variation string Target variation (default: first variation)
1780
1631
  -l, --label string Display label for the field (inferred from field-id if omitted)
1781
1632
  -p, --placeholder string Placeholder text
1782
1633
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1783
- --no-types Skip type generation
1784
1634
  -h, --help Show help for command
1785
1635
 
1786
1636
  EXAMPLES
1787
1637
  prismic slice add-field embed my_slice video
1788
1638
  prismic slice add-field embed gallery media --label "Media Embed"
1789
- prismic slice add-field embed social tweet --variation "twitter"`);return}if(!c){console.error(`Missing required argument: slice-id
1790
- `),console.error(`Usage: prismic slice add-field embed <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
1791
- `),console.error(`Usage: prismic slice add-field embed <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Embed`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Embed) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function vo(){let{values:{help:t,variation:n,label:r,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geographic coordinates field to an existing slice.
1639
+ prismic slice add-field embed social tweet --variation "twitter"`);return}if(!o){console.error(`Missing required argument: slice-id
1640
+ `),console.error(`Usage: prismic slice add-field embed <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
1641
+ `),console.error(`Usage: prismic slice add-field embed <slice-id> <field-id>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;if(u.variations.length===0){console.error(`Slice "${o}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let f=n?u.variations.find(e=>e.id===n):u.variations[0];if(!f){console.error(`Variation "${n}" not found in slice "${o}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}f.primary||={};for(let e of u.variations)if(e.primary?.[c]){console.error(`Field "${c}" already exists in variation "${e.id}"`),process.exitCode=1;return}let p={type:`Embed`,config:{label:r??J(c),...i&&{placeholder:i}}};f.primary[c]=p;try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Added field "${c}" (Embed) to "${f.id}" variation in ${o}`);try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function fo(){let{values:{help:t,variation:n,label:r,types:i},positionals:[a,o]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geographic coordinates field to an existing slice.
1792
1642
 
1793
1643
  USAGE
1794
1644
  prismic slice add-field geo-point <slice-id> <field-id> [flags]
@@ -1797,21 +1647,18 @@ ARGUMENTS
1797
1647
  slice-id Slice identifier (required)
1798
1648
  field-id Field identifier (required)
1799
1649
 
1800
- Types are generated by default after changes. Use --no-types to skip.
1801
-
1802
1650
  FLAGS
1803
1651
  -v, --variation string Target variation (default: first variation)
1804
1652
  -l, --label string Display label for the field (inferred from field-id if omitted)
1805
1653
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1806
- --no-types Skip type generation
1807
1654
  -h, --help Show help for command
1808
1655
 
1809
1656
  EXAMPLES
1810
1657
  prismic slice add-field geo-point my_slice location
1811
1658
  prismic slice add-field geo-point store coordinates --label "Store Location"
1812
- prismic slice add-field geo-point map marker --variation "interactive"`);return}if(!o){console.error(`Missing required argument: slice-id
1813
- `),console.error(`Usage: prismic slice add-field geo-point <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
1814
- `),console.error(`Usage: prismic slice add-field geo-point <slice-id> <field-id>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;if(u.variations.length===0){console.error(`Slice "${o}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let f=n?u.variations.find(e=>e.id===n):u.variations[0];if(!f){console.error(`Variation "${n}" not found in slice "${o}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}f.primary||={};for(let e of u.variations)if(e.primary?.[c]){console.error(`Field "${c}" already exists in variation "${e.id}"`),process.exitCode=1;return}let p={type:`GeoPoint`,config:{label:r??J(c)}};f.primary[c]=p;try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${c}" (GeoPoint) to "${f.id}" variation in ${o}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function yo(){let{values:{help:t,variation:n,label:r,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing slice.
1659
+ prismic slice add-field geo-point map marker --variation "interactive"`);return}if(!a){console.error(`Missing required argument: slice-id
1660
+ `),console.error(`Usage: prismic slice add-field geo-point <slice-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1661
+ `),console.error(`Usage: prismic slice add-field geo-point <slice-id> <field-id>`),process.exitCode=1;return}let c=await G(a);if(!c.ok){console.error(c.error),process.exitCode=1;return}let{model:l,modelPath:u}=c;if(l.variations.length===0){console.error(`Slice "${a}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let d=n?l.variations.find(e=>e.id===n):l.variations[0];if(!d){console.error(`Variation "${n}" not found in slice "${a}"\n`),console.error(`Available variations: ${l.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}d.primary||={};for(let e of l.variations)if(e.primary?.[o]){console.error(`Field "${o}" already exists in variation "${e.id}"`),process.exitCode=1;return}let f={type:`GeoPoint`,config:{label:r??J(o)}};d.primary[o]=f;try{await s(u,q(l))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Added field "${o}" (GeoPoint) to "${d.id}" variation in ${a}`);try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function po(){let{values:{help:t,variation:n,label:r,types:i},positionals:[a,o]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing slice.
1815
1662
 
1816
1663
  USAGE
1817
1664
  prismic slice add-field image <slice-id> <field-id> [flags]
@@ -1820,21 +1667,18 @@ ARGUMENTS
1820
1667
  slice-id Slice identifier (required)
1821
1668
  field-id Field identifier (required)
1822
1669
 
1823
- Types are generated by default after changes. Use --no-types to skip.
1824
-
1825
1670
  FLAGS
1826
1671
  -v, --variation string Target variation (default: first variation)
1827
1672
  -l, --label string Display label for the field (inferred from field-id if omitted)
1828
1673
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1829
- --no-types Skip type generation
1830
1674
  -h, --help Show help for command
1831
1675
 
1832
1676
  EXAMPLES
1833
1677
  prismic slice add-field image my_slice background
1834
1678
  prismic slice add-field image hero banner --label "Hero Banner"
1835
- prismic slice add-field image gallery thumbnail --variation "grid"`);return}if(!o){console.error(`Missing required argument: slice-id
1836
- `),console.error(`Usage: prismic slice add-field image <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
1837
- `),console.error(`Usage: prismic slice add-field image <slice-id> <field-id>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;if(u.variations.length===0){console.error(`Slice "${o}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let f=n?u.variations.find(e=>e.id===n):u.variations[0];if(!f){console.error(`Variation "${n}" not found in slice "${o}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}f.primary||={};for(let e of u.variations)if(e.primary?.[c]){console.error(`Field "${c}" already exists in variation "${e.id}"`),process.exitCode=1;return}let p={type:`Image`,config:{label:r??J(c)}};f.primary[c]=p;try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${c}" (Image) to "${f.id}" variation in ${o}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function bo(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing slice.
1679
+ prismic slice add-field image gallery thumbnail --variation "grid"`);return}if(!a){console.error(`Missing required argument: slice-id
1680
+ `),console.error(`Usage: prismic slice add-field image <slice-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1681
+ `),console.error(`Usage: prismic slice add-field image <slice-id> <field-id>`),process.exitCode=1;return}let c=await G(a);if(!c.ok){console.error(c.error),process.exitCode=1;return}let{model:l,modelPath:u}=c;if(l.variations.length===0){console.error(`Slice "${a}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let d=n?l.variations.find(e=>e.id===n):l.variations[0];if(!d){console.error(`Variation "${n}" not found in slice "${a}"\n`),console.error(`Available variations: ${l.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}d.primary||={};for(let e of l.variations)if(e.primary?.[o]){console.error(`Field "${o}" already exists in variation "${e.id}"`),process.exitCode=1;return}let f={type:`Image`,config:{label:r??J(o)}};d.primary[o]=f;try{await s(u,q(l))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Added field "${o}" (Image) to "${d.id}" variation in ${a}`);try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function mo(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing slice.
1838
1682
 
1839
1683
  USAGE
1840
1684
  prismic slice add-field key-text <slice-id> <field-id> [flags]
@@ -1843,22 +1687,19 @@ ARGUMENTS
1843
1687
  slice-id Slice identifier (required)
1844
1688
  field-id Field identifier (required)
1845
1689
 
1846
- Types are generated by default after changes. Use --no-types to skip.
1847
-
1848
1690
  FLAGS
1849
1691
  -v, --variation string Target variation (default: first variation)
1850
1692
  -l, --label string Display label for the field (inferred from field-id if omitted)
1851
1693
  -p, --placeholder string Placeholder text
1852
1694
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1853
- --no-types Skip type generation
1854
1695
  -h, --help Show help for command
1855
1696
 
1856
1697
  EXAMPLES
1857
1698
  prismic slice add-field key-text my_slice title
1858
1699
  prismic slice add-field key-text hero heading --label "Heading"
1859
- prismic slice add-field key-text cta button_text --placeholder "Enter button text"`);return}if(!c){console.error(`Missing required argument: slice-id
1860
- `),console.error(`Usage: prismic slice add-field key-text <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
1861
- `),console.error(`Usage: prismic slice add-field key-text <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Text`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Text) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function xo(){let{values:{help:t,variation:n,label:r,placeholder:i,"allow-text":a,"allow-target-blank":o,repeatable:c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing slice.
1700
+ prismic slice add-field key-text cta button_text --placeholder "Enter button text"`);return}if(!o){console.error(`Missing required argument: slice-id
1701
+ `),console.error(`Usage: prismic slice add-field key-text <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
1702
+ `),console.error(`Usage: prismic slice add-field key-text <slice-id> <field-id>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;if(u.variations.length===0){console.error(`Slice "${o}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let f=n?u.variations.find(e=>e.id===n):u.variations[0];if(!f){console.error(`Variation "${n}" not found in slice "${o}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}f.primary||={};for(let e of u.variations)if(e.primary?.[c]){console.error(`Field "${c}" already exists in variation "${e.id}"`),process.exitCode=1;return}let p={type:`Text`,config:{label:r??J(c),...i&&{placeholder:i}}};f.primary[c]=p;try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Added field "${c}" (Text) to "${f.id}" variation in ${o}`);try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function ho(){let{values:{help:t,variation:n,label:r,placeholder:i,"allow-text":a,"allow-target-blank":o,repeatable:c,types:l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing slice.
1862
1703
 
1863
1704
  USAGE
1864
1705
  prismic slice add-field link <slice-id> <field-id> [flags]
@@ -1867,8 +1708,6 @@ ARGUMENTS
1867
1708
  slice-id Slice identifier (required)
1868
1709
  field-id Field identifier (required)
1869
1710
 
1870
- Types are generated by default after changes. Use --no-types to skip.
1871
-
1872
1711
  FLAGS
1873
1712
  -v, --variation string Target variation (default: first variation)
1874
1713
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -1877,16 +1716,15 @@ FLAGS
1877
1716
  --allow-target-blank Allow opening link in new tab
1878
1717
  --repeatable Allow multiple links
1879
1718
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1880
- --no-types Skip type generation
1881
1719
  -h, --help Show help for command
1882
1720
 
1883
1721
  EXAMPLES
1884
1722
  prismic slice add-field link my_slice button
1885
1723
  prismic slice add-field link cta primary_link --allow-text
1886
1724
  prismic slice add-field link navigation links --repeatable
1887
- prismic slice add-field link hero cta --allow-text --allow-target-blank`);return}if(!d){console.error(`Missing required argument: slice-id
1888
- `),console.error(`Usage: prismic slice add-field link <slice-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
1889
- `),console.error(`Usage: prismic slice add-field link <slice-id> <field-id>`),process.exitCode=1;return}let p=await G(d);if(!p.ok){console.error(p.error),process.exitCode=1;return}let{model:m,modelPath:h}=p;if(m.variations.length===0){console.error(`Slice "${d}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let g=n?m.variations.find(e=>e.id===n):m.variations[0];if(!g){console.error(`Variation "${n}" not found in slice "${d}"\n`),console.error(`Available variations: ${m.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}g.primary||={};for(let e of m.variations)if(e.primary?.[f]){console.error(`Field "${f}" already exists in variation "${e.id}"`),process.exitCode=1;return}let _={type:`Link`,config:{label:r??J(f),...i&&{placeholder:i},...a&&{allowText:!0},...o&&{allowTargetBlank:!0},...c&&{repeat:!0}}};g.primary[f]=_;try{await s(h,q(m))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Link) to "${g.id}" variation in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function So(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing slice.
1725
+ prismic slice add-field link hero cta --allow-text --allow-target-blank`);return}if(!u){console.error(`Missing required argument: slice-id
1726
+ `),console.error(`Usage: prismic slice add-field link <slice-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
1727
+ `),console.error(`Usage: prismic slice add-field link <slice-id> <field-id>`),process.exitCode=1;return}let f=await G(u);if(!f.ok){console.error(f.error),process.exitCode=1;return}let{model:p,modelPath:m}=f;if(p.variations.length===0){console.error(`Slice "${u}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let h=n?p.variations.find(e=>e.id===n):p.variations[0];if(!h){console.error(`Variation "${n}" not found in slice "${u}"\n`),console.error(`Available variations: ${p.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}h.primary||={};for(let e of p.variations)if(e.primary?.[d]){console.error(`Field "${d}" already exists in variation "${e.id}"`),process.exitCode=1;return}let g={type:`Link`,config:{label:r??J(d),...i&&{placeholder:i},...a&&{allowText:!0},...o&&{allowTargetBlank:!0},...c&&{repeat:!0}}};h.primary[d]=g;try{await s(m,q(p))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Added field "${d}" (Link) to "${h.id}" variation in ${u}`);try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function go(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing slice.
1890
1728
 
1891
1729
  USAGE
1892
1730
  prismic slice add-field number <slice-id> <field-id> [flags]
@@ -1895,22 +1733,19 @@ ARGUMENTS
1895
1733
  slice-id Slice identifier (required)
1896
1734
  field-id Field identifier (required)
1897
1735
 
1898
- Types are generated by default after changes. Use --no-types to skip.
1899
-
1900
1736
  FLAGS
1901
1737
  -v, --variation string Target variation (default: first variation)
1902
1738
  -l, --label string Display label for the field (inferred from field-id if omitted)
1903
1739
  -p, --placeholder string Placeholder text
1904
1740
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1905
- --no-types Skip type generation
1906
1741
  -h, --help Show help for command
1907
1742
 
1908
1743
  EXAMPLES
1909
1744
  prismic slice add-field number my_slice price
1910
1745
  prismic slice add-field number product quantity --label "Quantity"
1911
- prismic slice add-field number stats count --variation "detailed"`);return}if(!c){console.error(`Missing required argument: slice-id
1912
- `),console.error(`Usage: prismic slice add-field number <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
1913
- `),console.error(`Usage: prismic slice add-field number <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Number`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Number) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function Co(){let{values:{help:t,variation:n,label:r,placeholder:i,single:a,multi:o,"allow-target-blank":c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing slice.
1746
+ prismic slice add-field number stats count --variation "detailed"`);return}if(!o){console.error(`Missing required argument: slice-id
1747
+ `),console.error(`Usage: prismic slice add-field number <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
1748
+ `),console.error(`Usage: prismic slice add-field number <slice-id> <field-id>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;if(u.variations.length===0){console.error(`Slice "${o}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let f=n?u.variations.find(e=>e.id===n):u.variations[0];if(!f){console.error(`Variation "${n}" not found in slice "${o}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}f.primary||={};for(let e of u.variations)if(e.primary?.[c]){console.error(`Field "${c}" already exists in variation "${e.id}"`),process.exitCode=1;return}let p={type:`Number`,config:{label:r??J(c),...i&&{placeholder:i}}};f.primary[c]=p;try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Added field "${c}" (Number) to "${f.id}" variation in ${o}`);try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function _o(){let{values:{help:t,variation:n,label:r,placeholder:i,single:a,multi:o,"allow-target-blank":c,types:l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing slice.
1914
1749
 
1915
1750
  USAGE
1916
1751
  prismic slice add-field rich-text <slice-id> <field-id> [flags]
@@ -1919,8 +1754,6 @@ ARGUMENTS
1919
1754
  slice-id Slice identifier (required)
1920
1755
  field-id Field identifier (required)
1921
1756
 
1922
- Types are generated by default after changes. Use --no-types to skip.
1923
-
1924
1757
  FLAGS
1925
1758
  -v, --variation string Target variation (default: first variation)
1926
1759
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -1929,7 +1762,6 @@ FLAGS
1929
1762
  --multi string Allowed block types for multi-line (comma-separated)
1930
1763
  --allow-target-blank Allow opening links in new tab
1931
1764
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1932
- --no-types Skip type generation
1933
1765
  -h, --help Show help for command
1934
1766
 
1935
1767
  BLOCK TYPES
@@ -1941,9 +1773,9 @@ EXAMPLES
1941
1773
  prismic slice add-field rich-text my_slice body
1942
1774
  prismic slice add-field rich-text article content --multi "paragraph,heading2,heading3,strong,em,hyperlink"
1943
1775
  prismic slice add-field rich-text hero tagline --single "heading1"
1944
- prismic slice add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!d){console.error(`Missing required argument: slice-id
1945
- `),console.error(`Usage: prismic slice add-field rich-text <slice-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
1946
- `),console.error(`Usage: prismic slice add-field rich-text <slice-id> <field-id>`),process.exitCode=1;return}let p=await G(d);if(!p.ok){console.error(p.error),process.exitCode=1;return}let{model:m,modelPath:h}=p;if(m.variations.length===0){console.error(`Slice "${d}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let g=n?m.variations.find(e=>e.id===n):m.variations[0];if(!g){console.error(`Variation "${n}" not found in slice "${d}"\n`),console.error(`Available variations: ${m.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}g.primary||={};for(let e of m.variations)if(e.primary?.[f]){console.error(`Field "${f}" already exists in variation "${e.id}"`),process.exitCode=1;return}let _={type:`StructuredText`,config:{label:r??J(f),...i&&{placeholder:i},...a&&{single:a},...o&&{multi:o},...c&&{allowTargetBlank:!0}}};g.primary[f]=_;try{await s(h,q(m))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${f}" (StructuredText) to "${g.id}" variation in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function wo(){let{values:{help:t,variation:n,label:r,placeholder:i,option:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing slice.
1776
+ prismic slice add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!u){console.error(`Missing required argument: slice-id
1777
+ `),console.error(`Usage: prismic slice add-field rich-text <slice-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
1778
+ `),console.error(`Usage: prismic slice add-field rich-text <slice-id> <field-id>`),process.exitCode=1;return}let f=await G(u);if(!f.ok){console.error(f.error),process.exitCode=1;return}let{model:p,modelPath:m}=f;if(p.variations.length===0){console.error(`Slice "${u}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let h=n?p.variations.find(e=>e.id===n):p.variations[0];if(!h){console.error(`Variation "${n}" not found in slice "${u}"\n`),console.error(`Available variations: ${p.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}h.primary||={};for(let e of p.variations)if(e.primary?.[d]){console.error(`Field "${d}" already exists in variation "${e.id}"`),process.exitCode=1;return}let g={type:`StructuredText`,config:{label:r??J(d),...i&&{placeholder:i},...a&&{single:a},...o&&{multi:o},...c&&{allowTargetBlank:!0}}};h.primary[d]=g;try{await s(m,q(p))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Added field "${d}" (StructuredText) to "${h.id}" variation in ${u}`);try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function vo(){let{values:{help:t,variation:n,label:r,placeholder:i,option:a,default:o,types:c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing slice.
1947
1779
 
1948
1780
  USAGE
1949
1781
  prismic slice add-field select <slice-id> <field-id> [flags]
@@ -1952,8 +1784,6 @@ ARGUMENTS
1952
1784
  slice-id Slice identifier (required)
1953
1785
  field-id Field identifier (required)
1954
1786
 
1955
- Types are generated by default after changes. Use --no-types to skip.
1956
-
1957
1787
  FLAGS
1958
1788
  -v, --variation string Target variation (default: first variation)
1959
1789
  -l, --label string Display label for the field (inferred from field-id if omitted)
@@ -1961,15 +1791,14 @@ FLAGS
1961
1791
  --option string Add an option (can be used multiple times)
1962
1792
  --default string Default selected value
1963
1793
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1964
- --no-types Skip type generation
1965
1794
  -h, --help Show help for command
1966
1795
 
1967
1796
  EXAMPLES
1968
1797
  prismic slice add-field select my_slice layout --option "full" --option "sidebar"
1969
1798
  prismic slice add-field select hero style --option "light" --option "dark" --default "light"
1970
- prismic slice add-field select product size --option "small" --option "medium" --option "large" --label "Size"`);return}if(!u){console.error(`Missing required argument: slice-id
1971
- `),console.error(`Usage: prismic slice add-field select <slice-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
1972
- `),console.error(`Usage: prismic slice add-field select <slice-id> <field-id>`),process.exitCode=1;return}let f=await G(u);if(!f.ok){console.error(f.error),process.exitCode=1;return}let{model:p,modelPath:m}=f;if(p.variations.length===0){console.error(`Slice "${u}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let h=n?p.variations.find(e=>e.id===n):p.variations[0];if(!h){console.error(`Variation "${n}" not found in slice "${u}"\n`),console.error(`Available variations: ${p.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}h.primary||={};for(let e of p.variations)if(e.primary?.[d]){console.error(`Field "${d}" already exists in variation "${e.id}"`),process.exitCode=1;return}let g={type:`Select`,config:{label:r??J(d),...i&&{placeholder:i},...a&&a.length>0&&{options:a},...o&&{default_value:o}}};h.primary[d]=g;try{await s(m,q(p))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Select) to "${h.id}" variation in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function To(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a timestamp (date and time) field to an existing slice.
1799
+ prismic slice add-field select product size --option "small" --option "medium" --option "large" --label "Size"`);return}if(!l){console.error(`Missing required argument: slice-id
1800
+ `),console.error(`Usage: prismic slice add-field select <slice-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
1801
+ `),console.error(`Usage: prismic slice add-field select <slice-id> <field-id>`),process.exitCode=1;return}let d=await G(l);if(!d.ok){console.error(d.error),process.exitCode=1;return}let{model:f,modelPath:p}=d;if(f.variations.length===0){console.error(`Slice "${l}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let m=n?f.variations.find(e=>e.id===n):f.variations[0];if(!m){console.error(`Variation "${n}" not found in slice "${l}"\n`),console.error(`Available variations: ${f.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}m.primary||={};for(let e of f.variations)if(e.primary?.[u]){console.error(`Field "${u}" already exists in variation "${e.id}"`),process.exitCode=1;return}let h={type:`Select`,config:{label:r??J(u),...i&&{placeholder:i},...a&&a.length>0&&{options:a},...o&&{default_value:o}}};m.primary[u]=h;try{await s(p,q(f))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Added field "${u}" (Select) to "${m.id}" variation in ${l}`);try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function yo(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a timestamp (date and time) field to an existing slice.
1973
1802
 
1974
1803
  USAGE
1975
1804
  prismic slice add-field timestamp <slice-id> <field-id> [flags]
@@ -1978,22 +1807,19 @@ ARGUMENTS
1978
1807
  slice-id Slice identifier (required)
1979
1808
  field-id Field identifier (required)
1980
1809
 
1981
- Types are generated by default after changes. Use --no-types to skip.
1982
-
1983
1810
  FLAGS
1984
1811
  -v, --variation string Target variation (default: first variation)
1985
1812
  -l, --label string Display label for the field (inferred from field-id if omitted)
1986
1813
  -p, --placeholder string Placeholder text
1987
1814
  --types string Output file for generated types (default: "prismicio-types.d.ts")
1988
- --no-types Skip type generation
1989
1815
  -h, --help Show help for command
1990
1816
 
1991
1817
  EXAMPLES
1992
1818
  prismic slice add-field timestamp my_slice created_at
1993
1819
  prismic slice add-field timestamp event start_time --label "Event Start"
1994
- prismic slice add-field timestamp schedule meeting_time --variation "detailed"`);return}if(!c){console.error(`Missing required argument: slice-id
1995
- `),console.error(`Usage: prismic slice add-field timestamp <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
1996
- `),console.error(`Usage: prismic slice add-field timestamp <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Timestamp`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Timestamp) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function Eo(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await mo();break;case`color`:await ho();break;case`date`:await go();break;case`embed`:await _o();break;case`geo-point`:await vo();break;case`image`:await yo();break;case`key-text`:await bo();break;case`link`:await xo();break;case`number`:await So();break;case`rich-text`:await Co();break;case`select`:await wo();break;case`timestamp`:await To();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing slice.
1820
+ prismic slice add-field timestamp schedule meeting_time --variation "detailed"`);return}if(!o){console.error(`Missing required argument: slice-id
1821
+ `),console.error(`Usage: prismic slice add-field timestamp <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
1822
+ `),console.error(`Usage: prismic slice add-field timestamp <slice-id> <field-id>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;if(u.variations.length===0){console.error(`Slice "${o}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let f=n?u.variations.find(e=>e.id===n):u.variations[0];if(!f){console.error(`Variation "${n}" not found in slice "${o}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}f.primary||={};for(let e of u.variations)if(e.primary?.[c]){console.error(`Field "${c}" already exists in variation "${e.id}"`),process.exitCode=1;return}let p={type:`Timestamp`,config:{label:r??J(c),...i&&{placeholder:i}}};f.primary[c]=p;try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Added field "${c}" (Timestamp) to "${f.id}" variation in ${o}`);try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function bo(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await so();break;case`color`:await co();break;case`date`:await lo();break;case`embed`:await uo();break;case`geo-point`:await fo();break;case`image`:await po();break;case`key-text`:await mo();break;case`link`:await ho();break;case`number`:await go();break;case`rich-text`:await _o();break;case`select`:await vo();break;case`timestamp`:await yo();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing slice.
1997
1823
 
1998
1824
  USAGE
1999
1825
  prismic slice add-field <field-type> <slice-id> <field-id> [flags]
@@ -2022,7 +1848,7 @@ EXAMPLES
2022
1848
  prismic slice add-field key-text my_slice title --label "Title"
2023
1849
  prismic slice add-field link my_slice cta --allow-text
2024
1850
  prismic slice add-field rich-text my_slice body --multi "paragraph,heading2,strong,em"
2025
- prismic slice add-field select my_slice layout --option "full" --option "sidebar"`)}}async function Do(){let{values:{help:t,name:n,"copy-from":r,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{name:{type:`string`},"copy-from":{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a new variation to a slice.
1851
+ prismic slice add-field select my_slice layout --option "full" --option "sidebar"`)}}async function xo(){let{values:{help:t,name:n,"copy-from":r,types:i},positionals:[a,o]}=e({args:process.argv.slice(4),options:{name:{type:`string`},"copy-from":{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a new variation to a slice.
2026
1852
 
2027
1853
  USAGE
2028
1854
  prismic slice add-variation <slice-id> <variation-id> [flags]
@@ -2031,21 +1857,18 @@ ARGUMENTS
2031
1857
  slice-id Slice identifier (required)
2032
1858
  variation-id New variation identifier (required)
2033
1859
 
2034
- Types are generated by default after changes. Use --no-types to skip.
2035
-
2036
1860
  FLAGS
2037
1861
  --name string Display name for the variation
2038
1862
  --copy-from string Copy fields from an existing variation
2039
1863
  --types string Output file for generated types (default: "prismicio-types.d.ts")
2040
- --no-types Skip type generation
2041
1864
  -h, --help Show help for command
2042
1865
 
2043
1866
  EXAMPLES
2044
1867
  prismic slice add-variation MySlice withImage
2045
1868
  prismic slice add-variation MySlice withImage --name "With Image"
2046
- prismic slice add-variation MySlice withImage --copy-from default`);return}if(!o){console.error(`Missing required argument: slice-id
2047
- `),console.error(`Usage: prismic slice add-variation <slice-id> <variation-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: variation-id
2048
- `),console.error(`Usage: prismic slice add-variation <slice-id> <variation-id>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;if(u.variations.some(e=>e.id===c)){console.error(`Variation "${c}" already exists in slice "${o}"`),process.exitCode=1;return}let f;if(r){let e=u.variations.find(e=>e.id===r);if(!e){console.error(`Source variation not found: ${r}`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}f={...structuredClone(e),id:c,name:n??jn(c)}}else f={id:c,name:n??jn(c),description:c,imageUrl:``,docURL:``,version:`initial`,primary:{},items:{}};let p={...u,variations:[...u.variations,f]};try{await s(d,q(p))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added variation "${c}" to slice "${o}"`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Oo(){let{values:{help:t,name:r,types:i,"no-types":a},positionals:[o]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Create a new slice in a Prismic project.
1869
+ prismic slice add-variation MySlice withImage --copy-from default`);return}if(!a){console.error(`Missing required argument: slice-id
1870
+ `),console.error(`Usage: prismic slice add-variation <slice-id> <variation-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: variation-id
1871
+ `),console.error(`Usage: prismic slice add-variation <slice-id> <variation-id>`),process.exitCode=1;return}let c=await G(a);if(!c.ok){console.error(c.error),process.exitCode=1;return}let{model:l,modelPath:u}=c;if(l.variations.some(e=>e.id===o)){console.error(`Variation "${o}" already exists in slice "${a}"`),process.exitCode=1;return}let d;if(r){let e=l.variations.find(e=>e.id===r);if(!e){console.error(`Source variation not found: ${r}`),console.error(`Available variations: ${l.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}d={...structuredClone(e),id:o,name:n??jn(o)}}else d={id:o,name:n??jn(o),description:o,imageUrl:``,docURL:``,version:`initial`,primary:{},items:{}};let f={...l,variations:[...l.variations,d]};try{await s(u,q(f))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Added variation "${o}" to slice "${a}"`);try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function So(){let{values:{help:t,name:r,types:i},positionals:[a]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Create a new slice in a Prismic project.
2049
1872
 
2050
1873
  USAGE
2051
1874
  prismic slice create <id> [flags]
@@ -2053,16 +1876,13 @@ USAGE
2053
1876
  ARGUMENTS
2054
1877
  id Slice identifier (required)
2055
1878
 
2056
- Types are generated by default after changes. Use --no-types to skip.
2057
-
2058
1879
  FLAGS
2059
1880
  -n, --name string Display name for the slice
2060
1881
  --types string Output file for generated types (default: "prismicio-types.d.ts")
2061
- --no-types Skip type generation
2062
1882
  -h, --help Show help for command
2063
1883
 
2064
1884
  LEARN MORE
2065
- Use \`prismic slice <command> --help\` for more information about a command.`);return}if(!o){console.error(`Missing required argument: id`),process.exitCode=1;return}let c={id:o,type:`SharedSlice`,name:r??Mo(o),description:``,variations:[{id:`default`,name:`Default`,description:`Default`,imageUrl:``,docURL:``,version:`initial`,primary:{},items:{}}]},l=await ko(),u=new URL(Mo(c.name)+`/`,l),d=new URL(`model.json`,u);try{await n(new URL(`.`,d),{recursive:!0}),await s(d,q(c))}catch(e){e instanceof Error?console.error(`Failed to create slice: ${e.message}`):console.error(`Failed to create slice`),process.exitCode=1;return}if(console.info(`Created slice at ${d.href}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add fields with `prismic slice add-field`")}async function ko(){let e=await jo(),t=await W(`package.json`);switch(e){case`next`:if(await En(new URL(`src`,t)))return new URL(`src/slices/`,t);case`nuxt`:if(await En(new URL(`app`,t)))return new URL(`app/slices/`,t);case`sveltekit`:return new URL(`src/slices/`,t)}return new URL(`slices/`,t)}const Ao=F({dependencies:I(L(R(),R()))});async function jo(){let e=await W(`package.json`);if(e)try{let t=await r(e,`utf8`),{dependencies:n={}}=hn(Ao,JSON.parse(t));if(`next`in n)return`next`;if(`nuxt`in n)return`nuxt`;if(`@sveltejs/kit`in n)return`sveltekit`}catch{}}function Mo(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}async function No(){let{values:{help:t,json:n}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`List all slices in a Prismic project.
1885
+ Use \`prismic slice <command> --help\` for more information about a command.`);return}if(!a){console.error(`Missing required argument: id`),process.exitCode=1;return}let o={id:a,type:`SharedSlice`,name:r??Eo(a),description:``,variations:[{id:`default`,name:`Default`,description:`Default`,imageUrl:``,docURL:``,version:`initial`,primary:{},items:{}}]},c=await Co(),l=new URL(Eo(o.name)+`/`,c),u=new URL(`model.json`,l);try{await n(new URL(`.`,u),{recursive:!0}),await s(u,q(o))}catch(e){e instanceof Error?console.error(`Failed to create slice: ${e.message}`):console.error(`Failed to create slice`),process.exitCode=1;return}console.info(`Created slice at ${u.href}`);try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add fields with `prismic slice add-field`")}async function Co(){let e=await To(),t=await W(`package.json`);switch(e){case`next`:if(await En(new URL(`src`,t)))return new URL(`src/slices/`,t);case`nuxt`:if(await En(new URL(`app`,t)))return new URL(`app/slices/`,t);case`sveltekit`:return new URL(`src/slices/`,t)}return new URL(`slices/`,t)}const wo=F({dependencies:I(L(R(),R()))});async function To(){let e=await W(`package.json`);if(e)try{let t=await r(e,`utf8`),{dependencies:n={}}=hn(wo,JSON.parse(t));if(`next`in n)return`next`;if(`nuxt`in n)return`nuxt`;if(`@sveltejs/kit`in n)return`sveltekit`}catch{}}function Eo(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}async function Do(){let{values:{help:t,json:n}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`List all slices in a Prismic project.
2066
1886
 
2067
1887
  USAGE
2068
1888
  prismic slice list [flags]
@@ -2073,7 +1893,7 @@ FLAGS
2073
1893
 
2074
1894
  EXAMPLES
2075
1895
  prismic slice list
2076
- prismic slice list --json`);return}let a=await On(),o;try{o=await i(a,{withFileTypes:!1})}catch{n?console.info(JSON.stringify([])):console.info(`No slices found.`);return}let s=[];for(let e of o){let t=new URL(`${e}/model.json`,a);try{let e=await r(t,`utf8`),n=B(Dn,JSON.parse(e));n.success&&s.push({id:n.output.id,name:n.output.name})}catch{}}if(s.length===0){n?console.info(JSON.stringify([])):console.info(`No slices found.`);return}if(n)console.info(JSON.stringify(s,null,2));else{console.info(`ID NAME`);for(let e of s)console.info(`${e.id}\t${e.name}`)}}async function Po(){let{values:{help:t,json:n},positionals:[r]}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`List all variations for a slice.
1896
+ prismic slice list --json`);return}let a=await On(),o;try{o=await i(a,{withFileTypes:!1})}catch{n?console.info(JSON.stringify([])):console.info(`No slices found.`);return}let s=[];for(let e of o){let t=new URL(`${e}/model.json`,a);try{let e=await r(t,`utf8`),n=B(Dn,JSON.parse(e));n.success&&s.push({id:n.output.id,name:n.output.name})}catch{}}if(s.length===0){n?console.info(JSON.stringify([])):console.info(`No slices found.`);return}if(n)console.info(JSON.stringify(s,null,2));else{console.info(`ID NAME`);for(let e of s)console.info(`${e.id}\t${e.name}`)}}async function Oo(){let{values:{help:t,json:n},positionals:[r]}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`List all variations for a slice.
2077
1897
 
2078
1898
  USAGE
2079
1899
  prismic slice list-variations <slice-id> [flags]
@@ -2088,7 +1908,7 @@ FLAGS
2088
1908
  EXAMPLES
2089
1909
  prismic slice list-variations MySlice
2090
1910
  prismic slice list-variations MySlice --json`);return}if(!r){console.error(`Missing required argument: slice-id
2091
- `),console.error(`Usage: prismic slice list-variations <slice-id>`),process.exitCode=1;return}let i=await G(r);if(!i.ok){console.error(i.error),process.exitCode=1;return}let{model:a}=i,o=a.variations.map(e=>({id:e.id,name:e.name}));if(n){console.info(JSON.stringify(o,null,2));return}console.info(`ID NAME`);for(let e of o)console.info(`${e.id}\t${e.name}`)}async function Fo(){let{values:{help:t,y:n,types:r,"no-types":i},positionals:[a]}=e({args:process.argv.slice(4),options:{y:{type:`boolean`,short:`y`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a slice from the project.
1911
+ `),console.error(`Usage: prismic slice list-variations <slice-id>`),process.exitCode=1;return}let i=await G(r);if(!i.ok){console.error(i.error),process.exitCode=1;return}let{model:a}=i,o=a.variations.map(e=>({id:e.id,name:e.name}));if(n){console.info(JSON.stringify(o,null,2));return}console.info(`ID NAME`);for(let e of o)console.info(`${e.id}\t${e.name}`)}async function ko(){let{values:{help:t,y:n,types:r},positionals:[i]}=e({args:process.argv.slice(4),options:{y:{type:`boolean`,short:`y`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a slice from the project.
2092
1912
 
2093
1913
  USAGE
2094
1914
  prismic slice remove <slice-id> [flags]
@@ -2096,18 +1916,15 @@ USAGE
2096
1916
  ARGUMENTS
2097
1917
  slice-id Slice identifier (required)
2098
1918
 
2099
- Types are generated by default after changes. Use --no-types to skip.
2100
-
2101
1919
  FLAGS
2102
1920
  -y Confirm removal
2103
1921
  --types string Output file for generated types (default: "prismicio-types.d.ts")
2104
- --no-types Skip type generation
2105
1922
  -h, --help Show help for command
2106
1923
 
2107
1924
  EXAMPLES
2108
1925
  prismic slice remove MySlice
2109
- prismic slice remove MySlice -y`);return}if(!a){console.error(`Missing required argument: slice-id
2110
- `),console.error(`Usage: prismic slice remove <slice-id>`),process.exitCode=1;return}let s=await G(a);if(!s.ok){console.error(s.error),process.exitCode=1;return}let{modelPath:c}=s,l=new URL(`.`,c);if(!n){console.error(`Refusing to remove slice "${a}" (this will delete the entire directory).`),console.error(`Re-run with -y to confirm.`),process.exitCode=1;return}try{await o(l,{recursive:!0})}catch(e){e instanceof Error?console.error(`Failed to remove slice: ${e.message}`):console.error(`Failed to remove slice`),process.exitCode=1;return}if(console.info(`Removed slice "${a}"`),!i)try{await K({output:r}),console.info(`Updated types in ${r??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Io(){let{values:{help:t,variation:n,zone:r,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{variation:{type:`string`,default:`default`},zone:{type:`string`,default:`primary`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a field from a slice variation.
1926
+ prismic slice remove MySlice -y`);return}if(!i){console.error(`Missing required argument: slice-id
1927
+ `),console.error(`Usage: prismic slice remove <slice-id>`),process.exitCode=1;return}let a=await G(i);if(!a.ok){console.error(a.error),process.exitCode=1;return}let{modelPath:s}=a,c=new URL(`.`,s);if(!n){console.error(`Refusing to remove slice "${i}" (this will delete the entire directory).`),console.error(`Re-run with -y to confirm.`),process.exitCode=1;return}try{await o(c,{recursive:!0})}catch(e){e instanceof Error?console.error(`Failed to remove slice: ${e.message}`):console.error(`Failed to remove slice`),process.exitCode=1;return}console.info(`Removed slice "${i}"`);try{await K({output:r}),console.info(`Updated types in ${r??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Ao(){let{values:{help:t,variation:n,zone:r,types:i},positionals:[a,o]}=e({args:process.argv.slice(4),options:{variation:{type:`string`,default:`default`},zone:{type:`string`,default:`primary`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a field from a slice variation.
2111
1928
 
2112
1929
  USAGE
2113
1930
  prismic slice remove-field <slice-id> <field-id> [flags]
@@ -2116,21 +1933,18 @@ ARGUMENTS
2116
1933
  slice-id Slice identifier (required)
2117
1934
  field-id Field identifier (required)
2118
1935
 
2119
- Types are generated by default after changes. Use --no-types to skip.
2120
-
2121
1936
  FLAGS
2122
1937
  --variation string Target variation (default: "default")
2123
1938
  --zone string Field zone: "primary" or "items" (default: "primary")
2124
1939
  --types string Output file for generated types (default: "prismicio-types.d.ts")
2125
- --no-types Skip type generation
2126
1940
  -h, --help Show help for command
2127
1941
 
2128
1942
  EXAMPLES
2129
1943
  prismic slice remove-field MySlice title
2130
1944
  prismic slice remove-field MySlice title --variation withImage
2131
- prismic slice remove-field MySlice item_title --zone items`);return}if(!o){console.error(`Missing required argument: slice-id
2132
- `),console.error(`Usage: prismic slice remove-field <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
2133
- `),console.error(`Usage: prismic slice remove-field <slice-id> <field-id>`),process.exitCode=1;return}if(r!==`primary`&&r!==`items`){console.error(`Invalid zone: ${r}. Must be "primary" or "items".`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l,f=u.variations.find(e=>e.id===n);if(!f){console.error(`Variation not found: ${n}`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}let p=r===`primary`?f.primary:f.items;if(!p||!(c in p)){console.error(`Field "${c}" not found in ${r} zone of variation "${n}"`),process.exitCode=1;return}delete p[c];try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Removed field "${c}" from ${r} zone in variation "${n}" of slice "${o}"`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Lo(){let{values:{help:t,types:n,"no-types":r},positionals:[i,a]}=e({args:process.argv.slice(4),options:{types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a variation from a slice.
1945
+ prismic slice remove-field MySlice item_title --zone items`);return}if(!a){console.error(`Missing required argument: slice-id
1946
+ `),console.error(`Usage: prismic slice remove-field <slice-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1947
+ `),console.error(`Usage: prismic slice remove-field <slice-id> <field-id>`),process.exitCode=1;return}if(r!==`primary`&&r!==`items`){console.error(`Invalid zone: ${r}. Must be "primary" or "items".`),process.exitCode=1;return}let c=await G(a);if(!c.ok){console.error(c.error),process.exitCode=1;return}let{model:l,modelPath:u}=c,d=l.variations.find(e=>e.id===n);if(!d){console.error(`Variation not found: ${n}`),console.error(`Available variations: ${l.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}let f=r===`primary`?d.primary:d.items;if(!f||!(o in f)){console.error(`Field "${o}" not found in ${r} zone of variation "${n}"`),process.exitCode=1;return}delete f[o];try{await s(u,q(l))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Removed field "${o}" from ${r} zone in variation "${n}" of slice "${a}"`);try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function jo(){let{values:{help:t,types:n},positionals:[r,i]}=e({args:process.argv.slice(4),options:{types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a variation from a slice.
2134
1948
 
2135
1949
  USAGE
2136
1950
  prismic slice remove-variation <slice-id> <variation-id> [flags]
@@ -2139,17 +1953,14 @@ ARGUMENTS
2139
1953
  slice-id Slice identifier (required)
2140
1954
  variation-id Variation to remove (required)
2141
1955
 
2142
- Types are generated by default after changes. Use --no-types to skip.
2143
-
2144
1956
  FLAGS
2145
1957
  --types string Output file for generated types (default: "prismicio-types.d.ts")
2146
- --no-types Skip type generation
2147
1958
  -h, --help Show help for command
2148
1959
 
2149
1960
  EXAMPLES
2150
- prismic slice remove-variation MySlice withImage`);return}if(!i){console.error(`Missing required argument: slice-id
2151
- `),console.error(`Usage: prismic slice remove-variation <slice-id> <variation-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: variation-id
2152
- `),console.error(`Usage: prismic slice remove-variation <slice-id> <variation-id>`),process.exitCode=1;return}let o=await G(i);if(!o.ok){console.error(o.error),process.exitCode=1;return}let{model:c,modelPath:l}=o;if(!c.variations.some(e=>e.id===a)){console.error(`Variation not found: ${a}`),console.error(`Available variations: ${c.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}if(c.variations.length===1){console.error(`Cannot remove the last variation from a slice.`),process.exitCode=1;return}let u={...c,variations:c.variations.filter(e=>e.id!==a)};try{await s(l,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Removed variation "${a}" from slice "${i}"`),!r)try{await K({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Ro(){let{values:{help:t,id:n,types:r,"no-types":i},positionals:[o,c]}=e({args:process.argv.slice(4),options:{id:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Rename a slice (updates name field, optionally id and directory).
1961
+ prismic slice remove-variation MySlice withImage`);return}if(!r){console.error(`Missing required argument: slice-id
1962
+ `),console.error(`Usage: prismic slice remove-variation <slice-id> <variation-id>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: variation-id
1963
+ `),console.error(`Usage: prismic slice remove-variation <slice-id> <variation-id>`),process.exitCode=1;return}let a=await G(r);if(!a.ok){console.error(a.error),process.exitCode=1;return}let{model:o,modelPath:c}=a;if(!o.variations.some(e=>e.id===i)){console.error(`Variation not found: ${i}`),console.error(`Available variations: ${o.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}if(o.variations.length===1){console.error(`Cannot remove the last variation from a slice.`),process.exitCode=1;return}let l={...o,variations:o.variations.filter(e=>e.id!==i)};try{await s(c,q(l))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}console.info(`Removed variation "${i}" from slice "${r}"`);try{await K({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Mo(){let{values:{help:t,id:n,types:r},positionals:[i,o]}=e({args:process.argv.slice(4),options:{id:{type:`string`},types:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Rename a slice (updates name field, optionally id and directory).
2153
1964
 
2154
1965
  USAGE
2155
1966
  prismic slice rename <slice-id> <new-name> [flags]
@@ -2158,19 +1969,16 @@ ARGUMENTS
2158
1969
  slice-id Current slice identifier (required)
2159
1970
  new-name New display name (required)
2160
1971
 
2161
- Types are generated by default after changes. Use --no-types to skip.
2162
-
2163
1972
  FLAGS
2164
1973
  --id string Also change the slice ID (renames directory)
2165
1974
  --types string Output file for generated types (default: "prismicio-types.d.ts")
2166
- --no-types Skip type generation
2167
1975
  -h, --help Show help for command
2168
1976
 
2169
1977
  EXAMPLES
2170
1978
  prismic slice rename MySlice "My New Name"
2171
- prismic slice rename MySlice "My New Name" --id NewSliceId`);return}if(!o){console.error(`Missing required argument: slice-id
2172
- `),console.error(`Usage: prismic slice rename <slice-id> <new-name>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: new-name
2173
- `),console.error(`Usage: prismic slice rename <slice-id> <new-name>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;u.name=c,n&&(u.id=n);try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(n){let e=await On(),t=new URL(`.`,d),r=new URL(jn(c)+`/`,e);if(t.href!==r.href)try{await a(t,r),console.info(`Renamed slice "${o}" to "${n}" (${c})`),console.info(`Moved directory to ${r.href}`)}catch(e){e instanceof Error?console.error(`Failed to rename directory: ${e.message}`):console.error(`Failed to rename directory`),process.exitCode=1;return}else console.info(`Renamed slice "${o}" to "${n}" (${c})`)}else console.info(`Renamed slice "${o}" to "${c}"`);if(!i)try{await K({output:r}),console.info(`Updated types in ${r??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function zo(){let{values:{help:t,json:n},positionals:[r]}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`View details of a specific slice.
1979
+ prismic slice rename MySlice "My New Name" --id NewSliceId`);return}if(!i){console.error(`Missing required argument: slice-id
1980
+ `),console.error(`Usage: prismic slice rename <slice-id> <new-name>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: new-name
1981
+ `),console.error(`Usage: prismic slice rename <slice-id> <new-name>`),process.exitCode=1;return}let c=await G(i);if(!c.ok){console.error(c.error),process.exitCode=1;return}let{model:l,modelPath:u}=c;l.name=o,n&&(l.id=n);try{await s(u,q(l))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(n){let e=await On(),t=new URL(`.`,u),r=new URL(jn(o)+`/`,e);if(t.href!==r.href)try{await a(t,r),console.info(`Renamed slice "${i}" to "${n}" (${o})`),console.info(`Moved directory to ${r.href}`)}catch(e){e instanceof Error?console.error(`Failed to rename directory: ${e.message}`):console.error(`Failed to rename directory`),process.exitCode=1;return}else console.info(`Renamed slice "${i}" to "${n}" (${o})`)}else console.info(`Renamed slice "${i}" to "${o}"`);try{await K({output:r}),console.info(`Updated types in ${r??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function No(){let{values:{help:t,json:n},positionals:[r]}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`View details of a specific slice.
2174
1982
 
2175
1983
  USAGE
2176
1984
  prismic slice view <slice-id> [flags]
@@ -2186,7 +1994,7 @@ EXAMPLES
2186
1994
  prismic slice view MySlice
2187
1995
  prismic slice view MySlice --json`);return}if(!r){console.error(`Missing required argument: slice-id
2188
1996
  `),console.error(`Usage: prismic slice view <slice-id>`),process.exitCode=1;return}let i=await G(r);if(!i.ok){console.error(i.error),process.exitCode=1;return}let{model:a}=i;if(n){console.info(JSON.stringify(a,null,2));return}console.info(`ID: ${a.id}`),console.info(`Name: ${a.name}`),a.description&&console.info(`Description: ${a.description}`),console.info(`Variations: ${a.variations.length}`),console.info(`
2189
- Variations:`);for(let e of a.variations){let t=Object.keys(e.primary??{}).length,n=Object.keys(e.items??{}).length;console.info(` - ${e.id} (${e.name}): ${t} primary fields, ${n} items fields`)}}async function Bo(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`create`:await Oo();break;case`list`:await No();break;case`view`:await zo();break;case`rename`:await Ro();break;case`remove`:await Fo();break;case`add-field`:await Eo();break;case`remove-field`:await Io();break;case`add-variation`:await Do();break;case`remove-variation`:await Lo();break;case`list-variations`:await Po();break;default:t&&(console.error(`Unknown slice subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage slices in a Prismic project.
1997
+ Variations:`);for(let e of a.variations){let t=Object.keys(e.primary??{}).length,n=Object.keys(e.items??{}).length;console.info(` - ${e.id} (${e.name}): ${t} primary fields, ${n} items fields`)}}async function Po(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`create`:await So();break;case`list`:await Do();break;case`view`:await No();break;case`rename`:await Mo();break;case`remove`:await ko();break;case`add-field`:await bo();break;case`remove-field`:await Ao();break;case`add-variation`:await xo();break;case`remove-variation`:await jo();break;case`list-variations`:await Oo();break;default:t&&(console.error(`Unknown slice subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage slices in a Prismic project.
2190
1998
 
2191
1999
  USAGE
2192
2000
  prismic slice <command> [flags]
@@ -2207,7 +2015,7 @@ FLAGS
2207
2015
  -h, --help Show help for command
2208
2016
 
2209
2017
  LEARN MORE
2210
- Use \`prismic slice <command> --help\` for more information about a command.`)}}const Vo=F({dependencies:I(L(R(),R())),devDependencies:I(L(R(),R()))});async function Ho(){let e=await W(`package.json`);if(!e)return;let t=new URL(`.`,e),n;try{let t=await r(e,`utf8`),{dependencies:i={},devDependencies:a={}}=hn(Vo,JSON.parse(t)),o={...i,...a};`next`in o?n=`next`:`nuxt`in o?n=`nuxt`:`@sveltejs/kit`in o&&(n=`sveltekit`)}catch{}let i=!1;return n===`next`||n===`sveltekit`?i=await En(new URL(`src/`,t)):n===`nuxt`&&(i=await En(new URL(`app/`,t))),{framework:n,hasSrcDir:i,projectRoot:t}}function Uo(e){switch(e){case`next`:return[`@prismicio/client`,`@prismicio/react`,`@prismicio/next`];case`nuxt`:return[`@nuxtjs/prismic`];case`sveltekit`:return[`@prismicio/client`,`@prismicio/svelte`];default:return[`@prismicio/client`]}}function Wo(e){switch(e.framework){case`next`:return e.hasSrcDir?`src/prismicio.ts`:`prismicio.ts`;case`nuxt`:return null;case`sveltekit`:return`src/lib/prismicio.ts`;default:return`prismicio.ts`}}function Go(e){switch(e.framework){case`next`:return e.hasSrcDir?`src/slices/`:`slices/`;case`nuxt`:return e.hasSrcDir?`app/slices/`:`slices/`;case`sveltekit`:return`src/lib/slices/`;default:return`slices/`}}function Ko(e){switch(e){case`next`:return[`.tsx`,`.ts`,`.jsx`,`.js`];case`nuxt`:return[`.vue`];case`sveltekit`:return[`.svelte`];default:return[`.tsx`,`.ts`,`.jsx`,`.js`]}}function qo(e,t){switch(e.framework){case`next`:{let n=e.hasSrcDir?`src/app`:`app`;return t===`/slice-simulator`?{path:`${n}/slice-simulator/page`,extensions:[`.tsx`,`.ts`,`.jsx`,`.js`]}:t===`/api/preview`?{path:`${n}/api/preview/route`,extensions:[`.ts`,`.js`]}:t===`/api/exit-preview`?{path:`${n}/api/exit-preview/route`,extensions:[`.ts`,`.js`]}:t===`/api/revalidate`?{path:`${n}/api/revalidate/route`,extensions:[`.ts`,`.js`]}:null}case`nuxt`:return t===`/slice-simulator`?{path:`pages/slice-simulator`,extensions:[`.vue`]}:null;case`sveltekit`:return t===`/slice-simulator`?{path:`src/routes/slice-simulator/+page`,extensions:[`.svelte`]}:t===`/api/preview`?{path:`src/routes/api/preview/+server`,extensions:[`.ts`,`.js`]}:null;default:return null}}const Jo={documentsPublished:`document.published`,documentsUnpublished:`document.unpublished`,releasesCreated:`release.created`,releasesUpdated:`release.updated`,tagsCreated:`tag.created`,tagsDeleted:`tag.deleted`};async function Yo(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`View details of a webhook in a Prismic repository.
2018
+ Use \`prismic slice <command> --help\` for more information about a command.`)}}const Fo=F({dependencies:I(L(R(),R())),devDependencies:I(L(R(),R()))});async function Io(){let e=await W(`package.json`);if(!e)return;let t=new URL(`.`,e),n;try{let t=await r(e,`utf8`),{dependencies:i={},devDependencies:a={}}=hn(Fo,JSON.parse(t)),o={...i,...a};`next`in o?n=`next`:`nuxt`in o?n=`nuxt`:`@sveltejs/kit`in o&&(n=`sveltekit`)}catch{}let i=!1;return n===`next`||n===`sveltekit`?i=await En(new URL(`src/`,t)):n===`nuxt`&&(i=await En(new URL(`app/`,t))),{framework:n,hasSrcDir:i,projectRoot:t}}function Lo(e){switch(e){case`next`:return[`@prismicio/client`,`@prismicio/react`,`@prismicio/next`];case`nuxt`:return[`@nuxtjs/prismic`];case`sveltekit`:return[`@prismicio/client`,`@prismicio/svelte`];default:return[`@prismicio/client`]}}function Ro(e){switch(e.framework){case`next`:return e.hasSrcDir?`src/prismicio.ts`:`prismicio.ts`;case`nuxt`:return null;case`sveltekit`:return`src/lib/prismicio.ts`;default:return`prismicio.ts`}}function zo(e){switch(e.framework){case`next`:return e.hasSrcDir?`src/slices/`:`slices/`;case`nuxt`:return e.hasSrcDir?`app/slices/`:`slices/`;case`sveltekit`:return`src/lib/slices/`;default:return`slices/`}}function Bo(e){switch(e){case`next`:return[`.tsx`,`.ts`,`.jsx`,`.js`];case`nuxt`:return[`.vue`];case`sveltekit`:return[`.svelte`];default:return[`.tsx`,`.ts`,`.jsx`,`.js`]}}function Vo(e,t){switch(e.framework){case`next`:{let n=e.hasSrcDir?`src/app`:`app`;return t===`/slice-simulator`?{path:`${n}/slice-simulator/page`,extensions:[`.tsx`,`.ts`,`.jsx`,`.js`]}:t===`/api/preview`?{path:`${n}/api/preview/route`,extensions:[`.ts`,`.js`]}:t===`/api/exit-preview`?{path:`${n}/api/exit-preview/route`,extensions:[`.ts`,`.js`]}:t===`/api/revalidate`?{path:`${n}/api/revalidate/route`,extensions:[`.ts`,`.js`]}:null}case`nuxt`:return t===`/slice-simulator`?{path:`pages/slice-simulator`,extensions:[`.vue`]}:null;case`sveltekit`:return t===`/slice-simulator`?{path:`src/routes/slice-simulator/+page`,extensions:[`.svelte`]}:t===`/api/preview`?{path:`src/routes/api/preview/+server`,extensions:[`.ts`,`.js`]}:null;default:return null}}const Ho={documentsPublished:`document.published`,documentsUnpublished:`document.unpublished`,releasesCreated:`release.created`,releasesUpdated:`release.updated`,tagsCreated:`tag.created`,tagsDeleted:`tag.deleted`};async function Uo(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`View details of a webhook in a Prismic repository.
2211
2019
 
2212
2020
  By default, this command reads the repository from prismic.config.json at the
2213
2021
  project root.
@@ -2223,7 +2031,7 @@ FLAGS
2223
2031
  -h, --help Show help for command
2224
2032
 
2225
2033
  LEARN MORE
2226
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Xo();return}let i=await $(n);if(!i.ok){i.error instanceof Z?Xo():(console.error(`Failed to view webhook: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let{config:o}=a;console.info(`URL: ${o.url}`),console.info(`Name: ${o.name||`(none)`}`),console.info(`Status: ${o.active?`enabled`:`disabled`}`),console.info(`Secret: ${o.secret?`(set)`:`(none)`}`);let s=[];for(let[e,t]of Object.entries(Jo))o[e]&&s.push(t);if(console.info(`Triggers: ${s.length>0?s.join(`, `):`(none)`}`),Object.keys(o.headers).length>0){console.info(`Headers:`);for(let[e,t]of Object.entries(o.headers))console.info(` ${e}: ${t}`)}else console.info(`Headers: (none)`)}function Xo(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const Zo=F({config:F({_id:R(),url:R(),active:P(),name:pn(R()),secret:pn(R()),headers:L(R(),R()),documentsPublished:P(),documentsUnpublished:P(),releasesCreated:P(),releasesUpdated:P(),tagsCreated:P(),tagsDeleted:P()})});async function $(e){return await X(new URL(`/app/settings/webhooks`,await V(e)),{schema:N(Zo)})}function Qo(e){switch(e){case`next`:return`nextjs/with-cli`;case`nuxt`:return`nuxt/with-cli`;case`sveltekit`:return`sveltekit/with-cli`;default:return``}}function $o(e,t){return e?` (run \`prismic docs ${t?`${e}${t}`:e}\`)`:``}function es(e){switch(e){case`nuxt`:return`#configure-the-modules-prismic-client`;default:return`#set-up-a-prismic-client`}}function ts(e){switch(e){case`next`:return`#set-up-previews-in-next-js`;case`sveltekit`:return`#set-up-previews-in-sveltekit`;default:return``}}function ns(e){switch(e){case`nuxt`:return`#write-vue-components`;case`sveltekit`:return`#write-svelte-components`;default:return`#write-react-components`}}function rs(e,t,n,r,i){let a=Qo(t.framework),o=e.find(e=>e.title===`Setup`),s=o?.items.filter(e=>!e.done&&e.hint===`not installed`);if(s&&s.length>0)return{message:`Install Prismic packages with 'npm install ${s.map(e=>e.label).join(` `)}'`};let c=o?.items.find(e=>!e.done&&e.hint?.includes(`client`));if(c)return{message:`Create a ${c.label} file${$o(a,es(t.framework))}`};let l=e.find(e=>e.title===`Preview`);if(l){if(l.items.find(e=>e.label===`/slice-simulator route`&&!e.done))return{message:`Create the /slice-simulator route${$o(a,`#set-up-live-previewing`)}`};if(l.items.find(e=>e.label===`/api/preview endpoint`&&!e.done))return{message:`Create the /api/preview route${$o(a,ts(t.framework))}`};if(l.items.find(e=>e.label===`/api/exit-preview endpoint`&&!e.done))return{message:`Create the /api/exit-preview route${$o(a,ts(t.framework))}`};if(l.items.find(e=>e.label===`Slice simulator URL`&&!e.done))return{message:`Configure the slice simulator URL with 'prismic preview set-simulator'`};if(l.items.find(e=>e.label===`Preview environment`&&!e.done))return{message:`Add a preview environment with 'prismic preview add'`}}if(n.some(e=>e.status===`to_pull`)||r.some(e=>e.status===`to_pull`))return{message:`Pull remote models with 'prismic pull'`};if(n.some(e=>e.status===`to_push`)||r.some(e=>e.status===`to_push`))return{message:`Push local models with 'prismic push'`};if(i.length>0){let e=[...i].sort()[0];return{message:`Implement the ${e} slice component at ${`${Go(t)}${e}/index${Ko(t.framework)[0]}`}${$o(a,ns(t.framework))}`}}let u=e.find(e=>e.title===`Deployment`);if(u){if(u.items.find(e=>e.label===`/api/revalidate endpoint`&&!e.done))return{message:`Create the /api/revalidate route for ISR${$o(a,`#handle-content-changes`)}`};if(u.items.find(e=>e.label===`Revalidation webhook`&&!e.done))return{message:`Create a revalidation webhook with 'prismic webhook create'`}}}async function is(){let{values:{help:t,repo:n=await Y()}}=e({args:process.argv.slice(3),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Show the status of the current Prismic project.
2034
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Wo();return}let i=await $(n);if(!i.ok){i.error instanceof Z?Wo():(console.error(`Failed to view webhook: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let{config:o}=a;console.info(`URL: ${o.url}`),console.info(`Name: ${o.name||`(none)`}`),console.info(`Status: ${o.active?`enabled`:`disabled`}`),console.info(`Secret: ${o.secret?`(set)`:`(none)`}`);let s=[];for(let[e,t]of Object.entries(Ho))o[e]&&s.push(t);if(console.info(`Triggers: ${s.length>0?s.join(`, `):`(none)`}`),Object.keys(o.headers).length>0){console.info(`Headers:`);for(let[e,t]of Object.entries(o.headers))console.info(` ${e}: ${t}`)}else console.info(`Headers: (none)`)}function Wo(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const Go=F({config:F({_id:R(),url:R(),active:P(),name:pn(R()),secret:pn(R()),headers:L(R(),R()),documentsPublished:P(),documentsUnpublished:P(),releasesCreated:P(),releasesUpdated:P(),tagsCreated:P(),tagsDeleted:P()})});async function $(e){return await X(new URL(`/app/settings/webhooks`,await V(e)),{schema:N(Go)})}function Ko(e){switch(e){case`next`:return`https://prismic.io/docs/nextjs/with-cli`;case`nuxt`:return`https://prismic.io/docs/nuxt/with-cli`;case`sveltekit`:return`https://prismic.io/docs/sveltekit/with-cli`;default:return`https://prismic.io/docs`}}function qo(e,t,n,r,i){let a=Ko(t.framework),o=e.find(e=>e.title===`Setup`),s=o?.items.filter(e=>!e.done&&e.hint===`not installed`);if(s&&s.length>0)return{message:`Install Prismic packages with 'npm install ${s.map(e=>e.label).join(` `)}'`};let c=o?.items.find(e=>!e.done&&e.hint?.includes(`client`));if(c)return{message:`Create a ${c.label} file (see ${a})`};let l=e.find(e=>e.title===`Preview`);if(l){if(l.items.find(e=>e.label===`/slice-simulator route`&&!e.done))return{message:`Create the /slice-simulator route (see ${a})`};if(l.items.find(e=>e.label===`/api/preview endpoint`&&!e.done))return{message:`Create the /api/preview route (see ${a})`};if(l.items.find(e=>e.label===`/api/exit-preview endpoint`&&!e.done))return{message:`Create the /api/exit-preview route (see ${a})`};if(l.items.find(e=>e.label===`Slice simulator URL`&&!e.done))return{message:`Configure the slice simulator URL with 'prismic preview set-simulator'`};if(l.items.find(e=>e.label===`Preview environment`&&!e.done))return{message:`Add a preview environment with 'prismic preview add'`}}if(n.some(e=>e.status===`to_pull`)||r.some(e=>e.status===`to_pull`))return{message:`Pull remote models with 'prismic pull'`};if(n.some(e=>e.status===`to_push`)||r.some(e=>e.status===`to_push`))return{message:`Push local models with 'prismic push'`};if(i.length>0){let e=[...i].sort()[0];return{message:`Implement the ${e} slice component at ${`${zo(t)}${e}/index${Bo(t.framework)[0]}`} (see ${a})`}}let u=e.find(e=>e.title===`Deployment`);if(u){if(u.items.find(e=>e.label===`/api/revalidate endpoint`&&!e.done))return{message:`Create the /api/revalidate route for ISR (see ${a})`};if(u.items.find(e=>e.label===`Revalidation webhook`&&!e.done))return{message:`Create a revalidation webhook with 'prismic webhook create'`}}}async function Jo(){let{values:{help:t,repo:n=await Y()}}=e({args:process.argv.slice(3),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Show the status of the current Prismic project.
2227
2035
 
2228
2036
  Includes a "Next:" step showing the most important action to take based on
2229
2037
  project state.
@@ -2239,7 +2047,7 @@ FLAGS
2239
2047
  -h, --help Show help for command
2240
2048
 
2241
2049
  LEARN MORE
2242
- Use \`prismic <command> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1;return}let r=await Ho();if(!r){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let[i,a,o,s,c,l,u,d]=await Promise.all([ss(n),ls(n),$(n),In(),Pn(n),Ln(),Fn(n),ds(r)]),f=await V(n);console.info(`Repository: ${n}`),console.info(`URL: ${f.href}`),console.info(``);let p=[],m=[],h=[],g=[],_=await fs(r,d);if(p.push(_),s.ok&&c.ok){let{pageTypes:e,customTypes:t,allTypeStatuses:n}=hs(s.value,c.value);p.push(e),p.push(t),m=n}if(l.ok&&u.ok){let{section:e,statuses:t,missingComponents:n}=await _s(l.value,u.value,r);p.push(e),h=t,g=n}let v=await bs(r,a.ok?a.value:void 0,i.ok?i.value.simulator_url:void 0);if(p.push(v),r.framework===`next`){let e=await Ss(r,o.ok?o.value:[]);p.push(e)}for(let e of p)as(e);let y=rs(p,r,m,h,g);y&&console.info(`Next: ${y.message}`)}function as(e){let t=e.items.filter(e=>!e.done).length,n=t>0?`${e.title} (${t} remaining)`:e.title;console.info(n);let r=e.items.filter(e=>e.done),i=e.items.filter(e=>!e.done);if(r.length>0)if(r.length===1){let e=r[0],t=e.hint?` \u2014 ${e.hint}`:``;console.info(` ✓ ${e.label}${t}`)}else{let e=r.map(e=>e.label).join(`, `),t=r.every(e=>e.hint===r[0].hint)&&r[0].hint?` \u2014 ${r[0].hint}`:``;console.info(` ✓ ${e}${t}`)}for(let e of i){let t=e.hint?` \u2014 ${e.hint}`:``;console.info(` ○ ${e.label}${t}`)}console.info(``)}const os=F({simulator_url:I(R())});async function ss(e){let t=await X(new URL(`/core/repository`,await V(e)),{schema:os});return t.ok?{ok:!0,value:t.value}:{ok:!1}}const cs=F({results:N(F({id:R(),label:R(),url:R()}))});async function ls(e){let t=await X(new URL(`/core/repository/preview_configs`,await V(e)),{schema:cs});return t.ok?{ok:!0,value:t.value.results}:{ok:!1}}const us=F({dependencies:I(L(R(),R())),devDependencies:I(L(R(),R()))});async function ds(e){let t=new URL(`package.json`,e.projectRoot);try{let e=await r(t,`utf8`),{dependencies:n={},devDependencies:i={}}=hn(us,JSON.parse(e));return new Set([...Object.keys(n),...Object.keys(i)])}catch{return new Set}}async function fs(e,t){let n=[],r=Uo(e.framework);for(let e of r)n.push({done:t.has(e),label:e,hint:t.has(e)?`installed`:`not installed`});let i=Wo(e);if(i){let t=await En(new URL(i,e.projectRoot));n.push({done:t,label:i,hint:t?void 0:`create Prismic client file`})}else if(e.framework===`nuxt`){let t=await ps(e);n.push({done:t,label:`nuxt.config.ts`,hint:t?`prismic configured`:`add @nuxtjs/prismic to modules`})}return{title:`Setup`,items:n}}async function ps(e){let t=new URL(`nuxt.config.ts`,e.projectRoot);try{let e=await r(t,`utf8`);return e.includes(`@nuxtjs/prismic`)||e.includes(`prismic:`)}catch{return!1}}function ms(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map(t.map(e=>[e.id,e])),i=[];for(let t of e){let e=t.label||t.id,n=r.get(t.id);n&&JSON.stringify(t)===JSON.stringify(n)?i.push({id:t.id,label:e,status:`in_sync`}):i.push({id:t.id,label:e,status:`to_push`})}for(let e of t)if(!n.has(e.id)){let t=e.label||e.id;i.push({id:e.id,label:t,status:`to_pull`})}return i}function hs(e,t){let n=ms(e,t),r=n.filter(n=>{let r=e.find(e=>e.id===n.id),i=t.find(e=>e.id===n.id),a=r||i;return a&&a.format===`page`}),i=n.filter(n=>{let r=e.find(e=>e.id===n.id),i=t.find(e=>e.id===n.id),a=r||i;return!a||a.format!==`page`}),a=r.map(e=>({done:e.status===`in_sync`,label:e.label,hint:gs(e.status)})),o=i.map(e=>({done:e.status===`in_sync`,label:e.label,hint:gs(e.status)}));return{pageTypes:{title:`Page Types`,items:a},customTypes:{title:`Custom Types`,items:o},allTypeStatuses:n}}function gs(e){switch(e){case`in_sync`:return`in sync`;case`to_push`:return`to push`;case`to_pull`:return`to pull`}}async function _s(e,t,n){let r=ms(e,t),i=[],a=[],o=Go(n),s=Ko(n.framework);for(let e of r){let t=await vs(n,o,e.id,s);e.status===`in_sync`&&t?i.push({done:!0,label:e.label,hint:`component implemented`}):e.status===`in_sync`&&!t?(i.push({done:!1,label:e.label,hint:`missing component`}),a.push(e.label)):i.push({done:!1,label:e.label,hint:gs(e.status)})}return{section:{title:`Slices`,items:i},statuses:r,missingComponents:a}}async function vs(e,t,n,r){let i=ys(n);for(let n of r)if(await En(new URL(`${t}${i}/index${n}`,e.projectRoot)))return!0;return!1}function ys(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}async function bs(e,t,n){let r=[];r.push({done:!!n,label:`Slice simulator URL`,hint:n?`configured`:"run `prismic preview set-simulator`"});let i=qo(e,`/slice-simulator`);if(i){let t=await xs(e,i);r.push({done:t,label:`/slice-simulator route`,hint:t?void 0:`create route for Page Builder`})}let a=t&&t.length>0;if(r.push({done:!!a,label:`Preview environment`,hint:a?void 0:"run `prismic preview add`"}),e.framework!==`nuxt`){let t=qo(e,`/api/preview`);if(t){let n=await xs(e,t);r.push({done:n,label:`/api/preview endpoint`,hint:n?void 0:`create preview endpoint`})}}if(e.framework===`next`){let t=qo(e,`/api/exit-preview`);if(t){let n=await xs(e,t);r.push({done:n,label:`/api/exit-preview endpoint`,hint:n?void 0:`create exit-preview endpoint`})}}return{title:`Preview`,items:r}}async function xs(e,t){for(let n of t.extensions)if(await En(new URL(`${t.path}${n}`,e.projectRoot)))return!0;return!1}async function Ss(e,t){let n=[],r=qo(e,`/api/revalidate`);if(r){let t=await xs(e,r);n.push({done:t,label:`/api/revalidate endpoint`,hint:t?void 0:`create for ISR`})}let i=t.some(e=>e.config.active&&e.config.url.toLowerCase().includes(`revalidate`));return n.push({done:i,label:`Revalidation webhook`,hint:i?`configured`:"run `prismic webhook create`"}),{title:`Deployment`,items:n}}async function Cs(){let{values:{help:t,repo:n=await Y(),json:r}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`List all API tokens for a Prismic repository.
2050
+ Use \`prismic <command> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1;return}let r=await Io();if(!r){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let[i,a,o,s,c,l,u,d]=await Promise.all([Zo(n),$o(n),$(n),In(),Pn(n),Ln(),Fn(n),ts(r)]),f=await V(n);console.info(`Repository: ${n}`),console.info(`URL: ${f.href}`),console.info(``);let p=[],m=[],h=[],g=[],_=await ns(r,d);if(p.push(_),s.ok&&c.ok){let{pageTypes:e,customTypes:t,allTypeStatuses:n}=as(s.value,c.value);p.push(e),p.push(t),m=n}if(l.ok&&u.ok){let{section:e,statuses:t,missingComponents:n}=await ss(l.value,u.value,r);p.push(e),h=t,g=n}let v=await us(r,a.ok?a.value:void 0,i.ok?i.value.simulator_url:void 0);if(p.push(v),r.framework===`next`){let e=await fs(r,o.ok?o.value:[]);p.push(e)}for(let e of p)Yo(e);let y=qo(p,r,m,h,g);y&&console.info(`Next: ${y.message}`)}function Yo(e){let t=e.items.filter(e=>!e.done).length,n=t>0?`${e.title} (${t} remaining)`:e.title;console.info(n);let r=e.items.filter(e=>e.done),i=e.items.filter(e=>!e.done);if(r.length>0)if(r.length===1){let e=r[0],t=e.hint?` \u2014 ${e.hint}`:``;console.info(` ✓ ${e.label}${t}`)}else{let e=r.map(e=>e.label).join(`, `),t=r.every(e=>e.hint===r[0].hint)&&r[0].hint?` \u2014 ${r[0].hint}`:``;console.info(` ✓ ${e}${t}`)}for(let e of i){let t=e.hint?` \u2014 ${e.hint}`:``;console.info(` ○ ${e.label}${t}`)}console.info(``)}const Xo=F({simulator_url:I(R())});async function Zo(e){let t=await X(new URL(`/core/repository`,await V(e)),{schema:Xo});return t.ok?{ok:!0,value:t.value}:{ok:!1}}const Qo=F({results:N(F({id:R(),label:R(),url:R()}))});async function $o(e){let t=await X(new URL(`/core/repository/preview_configs`,await V(e)),{schema:Qo});return t.ok?{ok:!0,value:t.value.results}:{ok:!1}}const es=F({dependencies:I(L(R(),R())),devDependencies:I(L(R(),R()))});async function ts(e){let t=new URL(`package.json`,e.projectRoot);try{let e=await r(t,`utf8`),{dependencies:n={},devDependencies:i={}}=hn(es,JSON.parse(e));return new Set([...Object.keys(n),...Object.keys(i)])}catch{return new Set}}async function ns(e,t){let n=[],r=Lo(e.framework);for(let e of r)n.push({done:t.has(e),label:e,hint:t.has(e)?`installed`:`not installed`});let i=Ro(e);if(i){let t=await En(new URL(i,e.projectRoot));n.push({done:t,label:i,hint:t?void 0:`create Prismic client file`})}else if(e.framework===`nuxt`){let t=await rs(e);n.push({done:t,label:`nuxt.config.ts`,hint:t?`prismic configured`:`add @nuxtjs/prismic to modules`})}return{title:`Setup`,items:n}}async function rs(e){let t=new URL(`nuxt.config.ts`,e.projectRoot);try{let e=await r(t,`utf8`);return e.includes(`@nuxtjs/prismic`)||e.includes(`prismic:`)}catch{return!1}}function is(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map(t.map(e=>[e.id,e])),i=[];for(let t of e){let e=t.label||t.id,n=r.get(t.id);n&&JSON.stringify(t)===JSON.stringify(n)?i.push({id:t.id,label:e,status:`in_sync`}):i.push({id:t.id,label:e,status:`to_push`})}for(let e of t)if(!n.has(e.id)){let t=e.label||e.id;i.push({id:e.id,label:t,status:`to_pull`})}return i}function as(e,t){let n=is(e,t),r=n.filter(n=>{let r=e.find(e=>e.id===n.id),i=t.find(e=>e.id===n.id),a=r||i;return a&&a.format===`page`}),i=n.filter(n=>{let r=e.find(e=>e.id===n.id),i=t.find(e=>e.id===n.id),a=r||i;return!a||a.format!==`page`}),a=r.map(e=>({done:e.status===`in_sync`,label:e.label,hint:os(e.status)})),o=i.map(e=>({done:e.status===`in_sync`,label:e.label,hint:os(e.status)}));return{pageTypes:{title:`Page Types`,items:a},customTypes:{title:`Custom Types`,items:o},allTypeStatuses:n}}function os(e){switch(e){case`in_sync`:return`in sync`;case`to_push`:return`to push`;case`to_pull`:return`to pull`}}async function ss(e,t,n){let r=is(e,t),i=[],a=[],o=zo(n),s=Bo(n.framework);for(let e of r){let t=await cs(n,o,e.id,s);e.status===`in_sync`&&t?i.push({done:!0,label:e.label,hint:`component implemented`}):e.status===`in_sync`&&!t?(i.push({done:!1,label:e.label,hint:`missing component`}),a.push(e.label)):i.push({done:!1,label:e.label,hint:os(e.status)})}return{section:{title:`Slices`,items:i},statuses:r,missingComponents:a}}async function cs(e,t,n,r){let i=ls(n);for(let n of r)if(await En(new URL(`${t}${i}/index${n}`,e.projectRoot)))return!0;return!1}function ls(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}async function us(e,t,n){let r=[];r.push({done:!!n,label:`Slice simulator URL`,hint:n?`configured`:"run `prismic preview set-simulator`"});let i=Vo(e,`/slice-simulator`);if(i){let t=await ds(e,i);r.push({done:t,label:`/slice-simulator route`,hint:t?void 0:`create route for Page Builder`})}let a=t&&t.length>0;if(r.push({done:!!a,label:`Preview environment`,hint:a?void 0:"run `prismic preview add`"}),e.framework!==`nuxt`){let t=Vo(e,`/api/preview`);if(t){let n=await ds(e,t);r.push({done:n,label:`/api/preview endpoint`,hint:n?void 0:`create preview endpoint`})}}if(e.framework===`next`){let t=Vo(e,`/api/exit-preview`);if(t){let n=await ds(e,t);r.push({done:n,label:`/api/exit-preview endpoint`,hint:n?void 0:`create exit-preview endpoint`})}}return{title:`Preview`,items:r}}async function ds(e,t){for(let n of t.extensions)if(await En(new URL(`${t.path}${n}`,e.projectRoot)))return!0;return!1}async function fs(e,t){let n=[],r=Vo(e,`/api/revalidate`);if(r){let t=await ds(e,r);n.push({done:t,label:`/api/revalidate endpoint`,hint:t?void 0:`create for ISR`})}let i=t.some(e=>e.config.active&&e.config.url.toLowerCase().includes(`revalidate`));return n.push({done:i,label:`Revalidation webhook`,hint:i?`configured`:"run `prismic webhook create`"}),{title:`Deployment`,items:n}}async function ps(){let{values:{help:t,repo:n=await Y(),json:r}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`List all API tokens for a Prismic repository.
2243
2051
 
2244
2052
  By default, this command reads the repository from prismic.config.json at the
2245
2053
  project root.
@@ -2253,7 +2061,7 @@ FLAGS
2253
2061
  -h, --help Show help for command
2254
2062
 
2255
2063
  LEARN MORE
2256
- Use \`prismic token <command> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ps();return}let[i,a]=await Promise.all([As(n),js(n)]);if(!i.ok){i.error instanceof Z||i.error instanceof Q?Ps():M(i.error)?(console.error(`Failed to list access tokens: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list access tokens: ${q(i.value)}`),process.exitCode=1);return}if(!a.ok){a.error instanceof Z||a.error instanceof Q?Ps():M(a.error)?(console.error(`Failed to list write tokens: Invalid response: ${q(a.error.issues)}`),process.exitCode=1):(console.error(`Failed to list write tokens: ${q(a.value)}`),process.exitCode=1);return}let o=i.value.flatMap(e=>e.wroom_auths.map(t=>({name:e.name,appId:e.id,authId:t.id,scope:t.scope,token:t.token,createdAt:t.created_at.$date}))),s=a.value.tokens;if(r)console.info(q({accessTokens:o,writeTokens:s}));else{if(o.length>0){console.info(`ACCESS TOKENS`);for(let e of o){let t=Ms(e.token),n=Ns(e.createdAt);console.info(` ${e.name} ${e.scope} ${t} ${n}`)}}else console.info(`ACCESS TOKENS (none)`);if(console.info(``),s.length>0){console.info(`WRITE TOKENS`);for(let e of s){let t=Ms(e.token),n=Ns(e.timestamp);console.info(` ${e.app_name} ${t} ${n}`)}}else console.info(`WRITE TOKENS (none)`)}}const ws=F({$date:mn()}),Ts=F({id:R(),origin:R(),domain:R(),app:R(),scope:R(),expired_at:ws,created_at:ws,owner:pn(R()),token:R()}),Es=F({id:R(),secret:R(),name:R(),owner:R(),created_at:ws,authorized_domains:N(R()),wroom_auths:N(Ts)}),Ds=F({app_name:R(),token:R(),timestamp:mn()}),Os=F({max_tokens:mn(),tokens:N(Ds)}),ks=N(Es);async function As(e){return await X(new URL(`settings/security/contentapi`,await V(e)),{schema:ks})}async function js(e){return await X(new URL(`settings/security/customtypesapi`,await V(e)),{schema:Os})}function Ms(e){return e.length<=12?e:`${e.slice(0,8)}...${e.slice(-4)}`}function Ns(e){let t=typeof e==`number`?e*1e3:e.$date;return new Date(t).toISOString().split(`T`)[0]}function Ps(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Fs(){let{values:{help:t,repo:n=await Y(),json:r,write:i,name:a=`Prismic CLI`,"allow-releases":o}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`},write:{type:`boolean`,short:`w`},name:{type:`string`,short:`n`},"allow-releases":{type:`boolean`}},allowPositionals:!1});if(t){console.info(`Create a new API token for a Prismic repository.
2064
+ Use \`prismic token <command> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ws();return}let[i,a]=await Promise.all([bs(n),xs(n)]);if(!i.ok){i.error instanceof Z||i.error instanceof Q?ws():M(i.error)?(console.error(`Failed to list access tokens: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list access tokens: ${q(i.value)}`),process.exitCode=1);return}if(!a.ok){a.error instanceof Z||a.error instanceof Q?ws():M(a.error)?(console.error(`Failed to list write tokens: Invalid response: ${q(a.error.issues)}`),process.exitCode=1):(console.error(`Failed to list write tokens: ${q(a.value)}`),process.exitCode=1);return}let o=i.value.flatMap(e=>e.wroom_auths.map(t=>({name:e.name,appId:e.id,authId:t.id,scope:t.scope,token:t.token,createdAt:t.created_at.$date}))),s=a.value.tokens;if(r)console.info(q({accessTokens:o,writeTokens:s}));else{if(o.length>0){console.info(`ACCESS TOKENS`);for(let e of o){let t=Ss(e.token),n=Cs(e.createdAt);console.info(` ${e.name} ${e.scope} ${t} ${n}`)}}else console.info(`ACCESS TOKENS (none)`);if(console.info(``),s.length>0){console.info(`WRITE TOKENS`);for(let e of s){let t=Ss(e.token),n=Cs(e.timestamp);console.info(` ${e.app_name} ${t} ${n}`)}}else console.info(`WRITE TOKENS (none)`)}}const ms=F({$date:mn()}),hs=F({id:R(),origin:R(),domain:R(),app:R(),scope:R(),expired_at:ms,created_at:ms,owner:pn(R()),token:R()}),gs=F({id:R(),secret:R(),name:R(),owner:R(),created_at:ms,authorized_domains:N(R()),wroom_auths:N(hs)}),_s=F({app_name:R(),token:R(),timestamp:mn()}),vs=F({max_tokens:mn(),tokens:N(_s)}),ys=N(gs);async function bs(e){return await X(new URL(`settings/security/contentapi`,await V(e)),{schema:ys})}async function xs(e){return await X(new URL(`settings/security/customtypesapi`,await V(e)),{schema:vs})}function Ss(e){return e.length<=12?e:`${e.slice(0,8)}...${e.slice(-4)}`}function Cs(e){let t=typeof e==`number`?e*1e3:e.$date;return new Date(t).toISOString().split(`T`)[0]}function ws(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Ts(){let{values:{help:t,repo:n=await Y(),json:r,write:i,name:a=`Prismic CLI`,"allow-releases":o}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`},write:{type:`boolean`,short:`w`},name:{type:`string`,short:`n`},"allow-releases":{type:`boolean`}},allowPositionals:!1});if(t){console.info(`Create a new API token for a Prismic repository.
2257
2065
 
2258
2066
  By default, this command reads the repository from prismic.config.json at the
2259
2067
  project root.
@@ -2270,7 +2078,7 @@ FLAGS
2270
2078
  -h, --help Show help for command
2271
2079
 
2272
2080
  LEARN MORE
2273
- Use \`prismic token <command> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(i&&o){console.error(`--allow-releases is only valid for access tokens (not with --write)`),process.exitCode=1;return}if(!await H()){Rs();return}if(i){let e=await Is(n,a);if(!e.ok){e.error instanceof Z||e.error instanceof Q?Rs():M(e.error)?(console.error(`Failed to create write token: Invalid response: ${q(e.error.issues)}`),process.exitCode=1):(console.error(`Failed to create write token: ${q(e.value)}`),process.exitCode=1);return}r?console.info(q(e.value)):console.info(`Token created: ${e.value.token}`)}else{let e=await Ls(n,a,o?`master+releases`:`master`);if(!e.ok){e.error instanceof Z||e.error instanceof Q?Rs():M(e.error)?(console.error(`Failed to create access token: Invalid response: ${q(e.error.issues)}`),process.exitCode=1):(console.error(`Failed to create access token: ${q(e.value)}`),process.exitCode=1);return}r?console.info(q(e.value)):console.info(`Token created: ${e.value.token}`)}}async function Is(e,t){return await X(new URL(`settings/security/token`,await V(e)),{method:`POST`,body:{app_name:t},schema:Ds})}async function Ls(e,t,n){let r=await As(e);if(!r.ok)return r;let i=r.value.find(e=>e.name===t);if(!i){let n=await X(new URL(`settings/security/oauthapp`,await V(e)),{method:`POST`,body:{app_name:t},schema:Es});if(!n.ok)return n;i=n.value}return await X(new URL(`settings/security/authorizations`,await V(e)),{method:`POST`,body:{app:i.id,scope:n},schema:Ts})}function Rs(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function zs(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Delete a token from a Prismic repository.
2081
+ Use \`prismic token <command> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(i&&o){console.error(`--allow-releases is only valid for access tokens (not with --write)`),process.exitCode=1;return}if(!await H()){Os();return}if(i){let e=await Es(n,a);if(!e.ok){e.error instanceof Z||e.error instanceof Q?Os():M(e.error)?(console.error(`Failed to create write token: Invalid response: ${q(e.error.issues)}`),process.exitCode=1):(console.error(`Failed to create write token: ${q(e.value)}`),process.exitCode=1);return}r?console.info(q(e.value)):console.info(`Token created: ${e.value.token}`)}else{let e=await Ds(n,a,o?`master+releases`:`master`);if(!e.ok){e.error instanceof Z||e.error instanceof Q?Os():M(e.error)?(console.error(`Failed to create access token: Invalid response: ${q(e.error.issues)}`),process.exitCode=1):(console.error(`Failed to create access token: ${q(e.value)}`),process.exitCode=1);return}r?console.info(q(e.value)):console.info(`Token created: ${e.value.token}`)}}async function Es(e,t){return await X(new URL(`settings/security/token`,await V(e)),{method:`POST`,body:{app_name:t},schema:_s})}async function Ds(e,t,n){let r=await bs(e);if(!r.ok)return r;let i=r.value.find(e=>e.name===t);if(!i){let n=await X(new URL(`settings/security/oauthapp`,await V(e)),{method:`POST`,body:{app_name:t},schema:gs});if(!n.ok)return n;i=n.value}return await X(new URL(`settings/security/authorizations`,await V(e)),{method:`POST`,body:{app:i.id,scope:n},schema:hs})}function Os(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ks(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Delete a token from a Prismic repository.
2274
2082
 
2275
2083
  By default, this command reads the repository from prismic.config.json at the
2276
2084
  project root.
@@ -2286,7 +2094,7 @@ FLAGS
2286
2094
  -h, --help Show help for command
2287
2095
 
2288
2096
  LEARN MORE
2289
- Use \`prismic token <command> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: token`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Bs();return}let[i,a]=await Promise.all([As(n),js(n)]);if(!i.ok){i.error instanceof Z||i.error instanceof Q?Bs():M(i.error)?(console.error(`Failed to list access tokens: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list access tokens: ${q(i.value)}`),process.exitCode=1);return}if(!a.ok){a.error instanceof Z||a.error instanceof Q?Bs():M(a.error)?(console.error(`Failed to list write tokens: Invalid response: ${q(a.error.issues)}`),process.exitCode=1):(console.error(`Failed to list write tokens: ${q(a.value)}`),process.exitCode=1);return}let o;for(let e of i.value){for(let t of e.wroom_auths)if(t.token===r||t.token.startsWith(r)||t.token.endsWith(r)){o=t;break}if(o)break}if(o){let e=await X(new URL(`settings/security/authorizations/${o.id}`,await V(n)),{method:`DELETE`});if(!e.ok){e.error instanceof Z||e.error instanceof Q?Bs():(console.error(`Failed to delete token: ${q(e.value)}`),process.exitCode=1);return}console.info(`Token deleted`);return}let s=a.value.tokens.find(e=>e.token===r||e.token.startsWith(r)||e.token.endsWith(r));if(s){let e=await X(new URL(`settings/security/token/${s.token}`,await V(n)),{method:`DELETE`});if(!e.ok){e.error instanceof Z||e.error instanceof Q?Bs():(console.error(`Failed to delete token: ${q(e.value)}`),process.exitCode=1);return}console.info(`Token deleted`);return}console.error(`Token not found: ${r}`),process.exitCode=1}function Bs(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Vs(){let{values:{help:t,repo:n=await Y()},positionals:[r,i]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set the name of a token in a Prismic repository.
2097
+ Use \`prismic token <command> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: token`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){As();return}let[i,a]=await Promise.all([bs(n),xs(n)]);if(!i.ok){i.error instanceof Z||i.error instanceof Q?As():M(i.error)?(console.error(`Failed to list access tokens: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list access tokens: ${q(i.value)}`),process.exitCode=1);return}if(!a.ok){a.error instanceof Z||a.error instanceof Q?As():M(a.error)?(console.error(`Failed to list write tokens: Invalid response: ${q(a.error.issues)}`),process.exitCode=1):(console.error(`Failed to list write tokens: ${q(a.value)}`),process.exitCode=1);return}let o;for(let e of i.value){for(let t of e.wroom_auths)if(t.token===r||t.token.startsWith(r)||t.token.endsWith(r)){o=t;break}if(o)break}if(o){let e=await X(new URL(`settings/security/authorizations/${o.id}`,await V(n)),{method:`DELETE`});if(!e.ok){e.error instanceof Z||e.error instanceof Q?As():(console.error(`Failed to delete token: ${q(e.value)}`),process.exitCode=1);return}console.info(`Token deleted`);return}let s=a.value.tokens.find(e=>e.token===r||e.token.startsWith(r)||e.token.endsWith(r));if(s){let e=await X(new URL(`settings/security/token/${s.token}`,await V(n)),{method:`DELETE`});if(!e.ok){e.error instanceof Z||e.error instanceof Q?As():(console.error(`Failed to delete token: ${q(e.value)}`),process.exitCode=1);return}console.info(`Token deleted`);return}console.error(`Token not found: ${r}`),process.exitCode=1}function As(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function js(){let{values:{help:t,repo:n=await Y()},positionals:[r,i]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set the name of a token in a Prismic repository.
2290
2098
 
2291
2099
  Note: Only access tokens can be renamed. Write tokens cannot be renamed without
2292
2100
  changing the token value.
@@ -2306,7 +2114,7 @@ FLAGS
2306
2114
  -h, --help Show help for command
2307
2115
 
2308
2116
  LEARN MORE
2309
- Use \`prismic token <command> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: token`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: name`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Hs();return}let[a,o]=await Promise.all([As(n),js(n)]);if(!a.ok){a.error instanceof Z||a.error instanceof Q?Hs():M(a.error)?(console.error(`Failed to list access tokens: Invalid response: ${q(a.error.issues)}`),process.exitCode=1):(console.error(`Failed to list access tokens: ${q(a.value)}`),process.exitCode=1);return}if(!o.ok){o.error instanceof Z||o.error instanceof Q?Hs():M(o.error)?(console.error(`Failed to list write tokens: Invalid response: ${q(o.error.issues)}`),process.exitCode=1):(console.error(`Failed to list write tokens: ${q(o.value)}`),process.exitCode=1);return}let s;for(let e of a.value){for(let t of e.wroom_auths)if(t.token===r||t.token.startsWith(r)||t.token.endsWith(r)){s=e;break}if(s)break}if(s){let e=await X(new URL(`settings/security/oauthapp/${s.id}`,await V(n)),{method:`POST`,body:{name:i},schema:Es});if(!e.ok){e.error instanceof Z||e.error instanceof Q?Hs():M(e.error)?(console.error(`Failed to rename token: Invalid response: ${q(e.error.issues)}`),process.exitCode=1):(console.error(`Failed to rename token: ${q(e.value)}`),process.exitCode=1);return}console.info(`Token renamed to: ${i}`);return}if(o.value.tokens.find(e=>e.token===r||e.token.startsWith(r)||e.token.endsWith(r))){console.error(`Write tokens cannot be renamed. Delete and create a new token with the desired name.`),process.exitCode=1;return}console.error(`Token not found: ${r}`),process.exitCode=1}function Hs(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Us(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`list`:await Cs();break;case`create`:await Fs();break;case`set-name`:await Vs();break;case`delete`:await zs();break;default:t&&(console.error(`Unknown token subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage API tokens for a Prismic repository.
2117
+ Use \`prismic token <command> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: token`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: name`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ms();return}let[a,o]=await Promise.all([bs(n),xs(n)]);if(!a.ok){a.error instanceof Z||a.error instanceof Q?Ms():M(a.error)?(console.error(`Failed to list access tokens: Invalid response: ${q(a.error.issues)}`),process.exitCode=1):(console.error(`Failed to list access tokens: ${q(a.value)}`),process.exitCode=1);return}if(!o.ok){o.error instanceof Z||o.error instanceof Q?Ms():M(o.error)?(console.error(`Failed to list write tokens: Invalid response: ${q(o.error.issues)}`),process.exitCode=1):(console.error(`Failed to list write tokens: ${q(o.value)}`),process.exitCode=1);return}let s;for(let e of a.value){for(let t of e.wroom_auths)if(t.token===r||t.token.startsWith(r)||t.token.endsWith(r)){s=e;break}if(s)break}if(s){let e=await X(new URL(`settings/security/oauthapp/${s.id}`,await V(n)),{method:`POST`,body:{name:i},schema:gs});if(!e.ok){e.error instanceof Z||e.error instanceof Q?Ms():M(e.error)?(console.error(`Failed to rename token: Invalid response: ${q(e.error.issues)}`),process.exitCode=1):(console.error(`Failed to rename token: ${q(e.value)}`),process.exitCode=1);return}console.info(`Token renamed to: ${i}`);return}if(o.value.tokens.find(e=>e.token===r||e.token.startsWith(r)||e.token.endsWith(r))){console.error(`Write tokens cannot be renamed. Delete and create a new token with the desired name.`),process.exitCode=1;return}console.error(`Token not found: ${r}`),process.exitCode=1}function Ms(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Ns(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`list`:await ps();break;case`create`:await Ts();break;case`set-name`:await js();break;case`delete`:await ks();break;default:t&&(console.error(`Unknown token subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage API tokens for a Prismic repository.
2310
2118
 
2311
2119
  USAGE
2312
2120
  prismic token <command> [flags]
@@ -2321,7 +2129,7 @@ FLAGS
2321
2129
  -h, --help Show help for command
2322
2130
 
2323
2131
  LEARN MORE
2324
- Use \`prismic token <command> --help\` for more information about a command.`)}}async function Ws(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Enable a webhook in a Prismic repository.
2132
+ Use \`prismic token <command> --help\` for more information about a command.`)}}async function Ps(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Enable a webhook in a Prismic repository.
2325
2133
 
2326
2134
  By default, this command reads the repository from prismic.config.json at the
2327
2135
  project root.
@@ -2337,7 +2145,7 @@ FLAGS
2337
2145
  -h, --help Show help for command
2338
2146
 
2339
2147
  LEARN MORE
2340
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ks();return}let i=await $(n);if(!i.ok){i.error instanceof Z?Ks():(console.error(`Failed to enable webhook: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}if(a.config.active){console.info(`Webhook already enabled: ${r}`);return}let o=structuredClone(a.config);o.active=!0;let s=await Gs(n,a.config._id,o);if(!s.ok){s.error instanceof Z?Ks():(console.error(`Failed to enable webhook: ${q(s.value)}`),process.exitCode=1);return}console.info(`Webhook enabled: ${r}`)}async function Gs(e,t,n){let r=new URL(`/app/settings/webhooks/${t}`,await V(e)),i=new FormData;return i.set(`url`,n.url),i.set(`name`,n.name??``),i.set(`secret`,n.secret??``),i.set(`headers`,JSON.stringify(n.headers??{})),i.set(`active`,n.active?`on`:`off`),i.set(`documentsPublished`,n.documentsUnpublished.toString()),i.set(`documentsUnpublished`,n.documentsUnpublished.toString()),i.set(`releasesCreated`,n.documentsUnpublished.toString()),i.set(`releasesUpdated`,n.documentsUnpublished.toString()),i.set(`tagsCreated`,n.documentsUnpublished.toString()),i.set(`documentsPublished`,n.documentsUnpublished.toString()),await X(r,{method:`POST`,body:i})}function Ks(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function qs(){let{values:{help:t,repo:n=await Y()},positionals:[r,i,a]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a custom HTTP header to a webhook.
2148
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Is();return}let i=await $(n);if(!i.ok){i.error instanceof Z?Is():(console.error(`Failed to enable webhook: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}if(a.config.active){console.info(`Webhook already enabled: ${r}`);return}let o=structuredClone(a.config);o.active=!0;let s=await Fs(n,a.config._id,o);if(!s.ok){s.error instanceof Z?Is():(console.error(`Failed to enable webhook: ${q(s.value)}`),process.exitCode=1);return}console.info(`Webhook enabled: ${r}`)}async function Fs(e,t,n){let r=new URL(`/app/settings/webhooks/${t}`,await V(e)),i=new FormData;return i.set(`url`,n.url),i.set(`name`,n.name??``),i.set(`secret`,n.secret??``),i.set(`headers`,JSON.stringify(n.headers??{})),i.set(`active`,n.active?`on`:`off`),i.set(`documentsPublished`,n.documentsUnpublished.toString()),i.set(`documentsUnpublished`,n.documentsUnpublished.toString()),i.set(`releasesCreated`,n.documentsUnpublished.toString()),i.set(`releasesUpdated`,n.documentsUnpublished.toString()),i.set(`tagsCreated`,n.documentsUnpublished.toString()),i.set(`documentsPublished`,n.documentsUnpublished.toString()),await X(r,{method:`POST`,body:i})}function Is(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Ls(){let{values:{help:t,repo:n=await Y()},positionals:[r,i,a]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a custom HTTP header to a webhook.
2341
2149
 
2342
2150
  By default, this command reads the repository from prismic.config.json at the
2343
2151
  project root.
@@ -2355,7 +2163,7 @@ FLAGS
2355
2163
  -h, --help Show help for command
2356
2164
 
2357
2165
  LEARN MORE
2358
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: <key>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: <value>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Js();return}let o=await $(n);if(!o.ok){o.error instanceof Z?Js():(console.error(`Failed to add header: ${q(o.value)}`),process.exitCode=1);return}let s=o.value.find(e=>e.config.url===r);if(!s){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let c=structuredClone(s.config);c.headers[i]=a;let l=await Gs(n,s.config._id,c);if(!l.ok){l.error instanceof Z?Js():(console.error(`Failed to add header: ${q(l.value)}`),process.exitCode=1);return}console.info(`Header added: ${i}`)}function Js(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const Ys=Object.values(Jo);async function Xs(){let{values:{help:t,repo:n=await Y(),name:r,secret:i,trigger:a=[]},positionals:[o]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},secret:{type:`string`,short:`s`},trigger:{type:`string`,multiple:!0,short:`t`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Create a new webhook in a Prismic repository.
2166
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: <key>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: <value>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Rs();return}let o=await $(n);if(!o.ok){o.error instanceof Z?Rs():(console.error(`Failed to add header: ${q(o.value)}`),process.exitCode=1);return}let s=o.value.find(e=>e.config.url===r);if(!s){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let c=structuredClone(s.config);c.headers[i]=a;let l=await Fs(n,s.config._id,c);if(!l.ok){l.error instanceof Z?Rs():(console.error(`Failed to add header: ${q(l.value)}`),process.exitCode=1);return}console.info(`Header added: ${i}`)}function Rs(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const zs=Object.values(Ho);async function Bs(){let{values:{help:t,repo:n=await Y(),name:r,secret:i,trigger:a=[]},positionals:[o]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},secret:{type:`string`,short:`s`},trigger:{type:`string`,multiple:!0,short:`t`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Create a new webhook in a Prismic repository.
2359
2167
 
2360
2168
  By default, this command reads the repository from prismic.config.json at the
2361
2169
  project root.
@@ -2384,7 +2192,7 @@ TRIGGERS
2384
2192
  If no triggers specified, all are enabled.
2385
2193
 
2386
2194
  LEARN MORE
2387
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!o){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}for(let e of a)if(!Ys.includes(e)){console.error(`Invalid trigger: ${e}`),console.error(`Valid triggers: ${Ys.join(`, `)}`),process.exitCode=1;return}if(!await H()){Qs();return}let s=!(a.length>0),c={documentsPublished:s,documentsUnpublished:s,releasesCreated:s,releasesUpdated:s,tagsCreated:s,tagsDeleted:s};for(let e of a){let[t]=Object.entries(Jo).find(([,t])=>e===t)??[];t&&(c[t]=!0)}let l=await Zs(n,{url:o,name:r??null,secret:i??null,...c});if(!l.ok){l.error instanceof Z?Qs():(console.error(`Failed to create webhook: ${q(l.value)}`),process.exitCode=1);return}console.info(`Webhook created: ${o}`)}async function Zs(e,t){let n=new URL(`/app/settings/webhooks/create`,await V(e)),r=new FormData;return r.set(`url`,t.url),r.set(`name`,t.name??``),r.set(`secret`,t.secret??``),r.set(`headers`,JSON.stringify({})),r.set(`active`,`on`),r.set(`documentsPublished`,t.documentsUnpublished.toString()),r.set(`documentsUnpublished`,t.documentsUnpublished.toString()),r.set(`releasesCreated`,t.documentsUnpublished.toString()),r.set(`releasesUpdated`,t.documentsUnpublished.toString()),r.set(`tagsCreated`,t.documentsUnpublished.toString()),r.set(`documentsPublished`,t.documentsUnpublished.toString()),await X(n,{method:`POST`,body:r})}function Qs(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function $s(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Disable a webhook in a Prismic repository.
2195
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!o){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}for(let e of a)if(!zs.includes(e)){console.error(`Invalid trigger: ${e}`),console.error(`Valid triggers: ${zs.join(`, `)}`),process.exitCode=1;return}if(!await H()){Hs();return}let s=!(a.length>0),c={documentsPublished:s,documentsUnpublished:s,releasesCreated:s,releasesUpdated:s,tagsCreated:s,tagsDeleted:s};for(let e of a){let[t]=Object.entries(Ho).find(([,t])=>e===t)??[];t&&(c[t]=!0)}let l=await Vs(n,{url:o,name:r??null,secret:i??null,...c});if(!l.ok){l.error instanceof Z?Hs():(console.error(`Failed to create webhook: ${q(l.value)}`),process.exitCode=1);return}console.info(`Webhook created: ${o}`)}async function Vs(e,t){let n=new URL(`/app/settings/webhooks/create`,await V(e)),r=new FormData;return r.set(`url`,t.url),r.set(`name`,t.name??``),r.set(`secret`,t.secret??``),r.set(`headers`,JSON.stringify({})),r.set(`active`,`on`),r.set(`documentsPublished`,t.documentsUnpublished.toString()),r.set(`documentsUnpublished`,t.documentsUnpublished.toString()),r.set(`releasesCreated`,t.documentsUnpublished.toString()),r.set(`releasesUpdated`,t.documentsUnpublished.toString()),r.set(`tagsCreated`,t.documentsUnpublished.toString()),r.set(`documentsPublished`,t.documentsUnpublished.toString()),await X(n,{method:`POST`,body:r})}function Hs(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Us(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Disable a webhook in a Prismic repository.
2388
2196
 
2389
2197
  By default, this command reads the repository from prismic.config.json at the
2390
2198
  project root.
@@ -2400,7 +2208,7 @@ FLAGS
2400
2208
  -h, --help Show help for command
2401
2209
 
2402
2210
  LEARN MORE
2403
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ec();return}let i=await $(n);if(!i.ok){i.error instanceof Z?ec():(console.error(`Failed to disable webhook: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}if(!a.config.active){console.info(`Webhook already disabled: ${r}`);return}let o=structuredClone(a.config);o.active=!1;let s=await Gs(n,a.config._id,o);if(!s.ok){s.error instanceof Z?ec():(console.error(`Failed to disable webhook: ${q(s.value)}`),process.exitCode=1);return}console.info(`Webhook disabled: ${r}`)}function ec(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function tc(){let{values:{help:t,repo:n=await Y(),json:r}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`List all webhooks in a Prismic repository.
2211
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ws();return}let i=await $(n);if(!i.ok){i.error instanceof Z?Ws():(console.error(`Failed to disable webhook: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}if(!a.config.active){console.info(`Webhook already disabled: ${r}`);return}let o=structuredClone(a.config);o.active=!1;let s=await Fs(n,a.config._id,o);if(!s.ok){s.error instanceof Z?Ws():(console.error(`Failed to disable webhook: ${q(s.value)}`),process.exitCode=1);return}console.info(`Webhook disabled: ${r}`)}function Ws(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Gs(){let{values:{help:t,repo:n=await Y(),json:r}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`List all webhooks in a Prismic repository.
2404
2212
 
2405
2213
  By default, this command reads the repository from prismic.config.json at the
2406
2214
  project root.
@@ -2414,7 +2222,7 @@ FLAGS
2414
2222
  -h, --help Show help for command
2415
2223
 
2416
2224
  LEARN MORE
2417
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){nc();return}let i=await $(n);if(!i.ok){i.error instanceof Z?nc():M(i.error)?(console.error(`Failed to list webhooks: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list webhooks: ${q(i.value)}`),process.exitCode=1);return}let a=i.value;if(r)console.info(q(a.map(e=>e.config)));else{if(a.length===0){console.info(`No webhooks configured.`);return}for(let e of a){let t=e.config.active?`enabled`:`disabled`,n=e.config.name?` (${e.config.name})`:``;console.info(`${e.config.url}${n} [${t}]`)}}}function nc(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function rc(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Delete a webhook from a Prismic repository.
2225
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ks();return}let i=await $(n);if(!i.ok){i.error instanceof Z?Ks():M(i.error)?(console.error(`Failed to list webhooks: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list webhooks: ${q(i.value)}`),process.exitCode=1);return}let a=i.value;if(r)console.info(q(a.map(e=>e.config)));else{if(a.length===0){console.info(`No webhooks configured.`);return}for(let e of a){let t=e.config.active?`enabled`:`disabled`,n=e.config.name?` (${e.config.name})`:``;console.info(`${e.config.url}${n} [${t}]`)}}}function Ks(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function qs(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Delete a webhook from a Prismic repository.
2418
2226
 
2419
2227
  By default, this command reads the repository from prismic.config.json at the
2420
2228
  project root.
@@ -2430,7 +2238,7 @@ FLAGS
2430
2238
  -h, --help Show help for command
2431
2239
 
2432
2240
  LEARN MORE
2433
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ac();return}let i=await $(n);if(!i.ok){i.error instanceof Z?ac():(console.error(`Failed to remove webhook: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let o=await ic(n,a.config._id);if(!o.ok){o.error instanceof Z?ac():(console.error(`Failed to remove webhook: ${q(o.value)}`),process.exitCode=1);return}console.info(`Webhook removed: ${r}`)}async function ic(e,t){return await X(new URL(`/app/settings/webhooks/${t}/delete`,await V(e)),{method:`POST`})}function ac(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function oc(){let{values:{help:t,repo:n=await Y()},positionals:[r,i]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a custom HTTP header from a webhook.
2241
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ys();return}let i=await $(n);if(!i.ok){i.error instanceof Z?Ys():(console.error(`Failed to remove webhook: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let o=await Js(n,a.config._id);if(!o.ok){o.error instanceof Z?Ys():(console.error(`Failed to remove webhook: ${q(o.value)}`),process.exitCode=1);return}console.info(`Webhook removed: ${r}`)}async function Js(e,t){return await X(new URL(`/app/settings/webhooks/${t}/delete`,await V(e)),{method:`POST`})}function Ys(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Xs(){let{values:{help:t,repo:n=await Y()},positionals:[r,i]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a custom HTTP header from a webhook.
2434
2242
 
2435
2243
  By default, this command reads the repository from prismic.config.json at the
2436
2244
  project root.
@@ -2447,7 +2255,7 @@ FLAGS
2447
2255
  -h, --help Show help for command
2448
2256
 
2449
2257
  LEARN MORE
2450
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: <key>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){sc();return}let a=await $(n);if(!a.ok){a.error instanceof Z?sc():(console.error(`Failed to remove header: ${q(a.value)}`),process.exitCode=1);return}let o=a.value.find(e=>e.config.url===r);if(!o){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}if(!(i in o.config.headers)){console.error(`Header not found: ${i}`),process.exitCode=1;return}let s=structuredClone(o.config);delete s.headers[i];let c=await Gs(n,o.config._id,s);if(!c.ok){c.error instanceof Z?sc():(console.error(`Failed to remove header: ${q(c.value)}`),process.exitCode=1);return}console.info(`Header removed: ${i}`)}function sc(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const cc=Object.values(Jo);async function lc(){let{values:{help:t,repo:n=await Y(),trigger:r},positionals:[i]}=e({args:process.argv.slice(4),options:{trigger:{type:`string`,multiple:!0,short:`t`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Update which events trigger a webhook.
2258
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: <key>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Zs();return}let a=await $(n);if(!a.ok){a.error instanceof Z?Zs():(console.error(`Failed to remove header: ${q(a.value)}`),process.exitCode=1);return}let o=a.value.find(e=>e.config.url===r);if(!o){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}if(!(i in o.config.headers)){console.error(`Header not found: ${i}`),process.exitCode=1;return}let s=structuredClone(o.config);delete s.headers[i];let c=await Fs(n,o.config._id,s);if(!c.ok){c.error instanceof Z?Zs():(console.error(`Failed to remove header: ${q(c.value)}`),process.exitCode=1);return}console.info(`Header removed: ${i}`)}function Zs(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const Qs=Object.values(Ho);async function $s(){let{values:{help:t,repo:n=await Y(),trigger:r},positionals:[i]}=e({args:process.argv.slice(4),options:{trigger:{type:`string`,multiple:!0,short:`t`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Update which events trigger a webhook.
2451
2259
 
2452
2260
  By default, this command reads the repository from prismic.config.json at the
2453
2261
  project root.
@@ -2472,7 +2280,7 @@ TRIGGERS
2472
2280
  tag.deleted When a tag is deleted
2473
2281
 
2474
2282
  LEARN MORE
2475
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!i){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!r||r.length===0){console.error(`Missing required option: --trigger`),process.exitCode=1;return}for(let e of r)if(!cc.includes(e)){console.error(`Invalid trigger: ${e}`),console.error(`Valid triggers: ${cc.join(`, `)}`),process.exitCode=1;return}if(!await H()){uc();return}let a=await $(n);if(!a.ok){a.error instanceof Z?uc():(console.error(`Failed to update webhook triggers: ${q(a.value)}`),process.exitCode=1);return}let o=a.value.find(e=>e.config.url===i);if(!o){console.error(`Webhook not found: ${i}`),process.exitCode=1;return}let s=!(r.length>0),c={documentsPublished:s,documentsUnpublished:s,releasesCreated:s,releasesUpdated:s,tagsCreated:s,tagsDeleted:s};for(let e of r){let[t]=Object.entries(Jo).find(([,t])=>e===t)??[];t&&(c[t]=!0)}let l=await Gs(n,o.config._id,{...o.config,...c});if(!l.ok){l.error instanceof Z?uc():(console.error(`Failed to update webhook triggers: ${q(l.value)}`),process.exitCode=1);return}console.info(`Webhook triggers updated: ${r.join(`, `)}`)}function uc(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function dc(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Show the enabled/disabled status of a webhook.
2283
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!i){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!r||r.length===0){console.error(`Missing required option: --trigger`),process.exitCode=1;return}for(let e of r)if(!Qs.includes(e)){console.error(`Invalid trigger: ${e}`),console.error(`Valid triggers: ${Qs.join(`, `)}`),process.exitCode=1;return}if(!await H()){ec();return}let a=await $(n);if(!a.ok){a.error instanceof Z?ec():(console.error(`Failed to update webhook triggers: ${q(a.value)}`),process.exitCode=1);return}let o=a.value.find(e=>e.config.url===i);if(!o){console.error(`Webhook not found: ${i}`),process.exitCode=1;return}let s=!(r.length>0),c={documentsPublished:s,documentsUnpublished:s,releasesCreated:s,releasesUpdated:s,tagsCreated:s,tagsDeleted:s};for(let e of r){let[t]=Object.entries(Ho).find(([,t])=>e===t)??[];t&&(c[t]=!0)}let l=await Fs(n,o.config._id,{...o.config,...c});if(!l.ok){l.error instanceof Z?ec():(console.error(`Failed to update webhook triggers: ${q(l.value)}`),process.exitCode=1);return}console.info(`Webhook triggers updated: ${r.join(`, `)}`)}function ec(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function tc(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Show the enabled/disabled status of a webhook.
2476
2284
 
2477
2285
  By default, this command reads the repository from prismic.config.json at the
2478
2286
  project root.
@@ -2488,7 +2296,7 @@ FLAGS
2488
2296
  -h, --help Show help for command
2489
2297
 
2490
2298
  LEARN MORE
2491
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){fc();return}let i=await $(n);if(!i.ok){i.error instanceof Z?fc():(console.error(`Failed to get webhook status: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let o=a.config.active?`enabled`:`disabled`;console.info(o)}function fc(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function pc(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Trigger a test webhook in a Prismic repository.
2299
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){nc();return}let i=await $(n);if(!i.ok){i.error instanceof Z?nc():(console.error(`Failed to get webhook status: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let o=a.config.active?`enabled`:`disabled`;console.info(o)}function nc(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function rc(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Trigger a test webhook in a Prismic repository.
2492
2300
 
2493
2301
  By default, this command reads the repository from prismic.config.json at the
2494
2302
  project root.
@@ -2504,7 +2312,7 @@ FLAGS
2504
2312
  -h, --help Show help for command
2505
2313
 
2506
2314
  LEARN MORE
2507
- Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){hc();return}let i=await $(n);if(!i.ok){i.error instanceof Z?hc():(console.error(`Failed to test webhook: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let o=await mc(n,a.config._id);if(!o.ok){o.error instanceof Z?hc():(console.error(`Failed to test webhook: ${q(o.value)}`),process.exitCode=1);return}console.info(`Test webhook triggered: ${r}`)}async function mc(e,t){return await X(new URL(`/app/settings/webhooks/${t}/trigger`,await V(e)),{method:`POST`})}function hc(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function gc(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`list`:await tc();break;case`create`:await Xs();break;case`view`:await Yo();break;case`remove`:await rc();break;case`test`:await pc();break;case`enable`:await Ws();break;case`disable`:await $s();break;case`status`:await dc();break;case`add-header`:await qs();break;case`remove-header`:await oc();break;case`set-triggers`:await lc();break;default:t&&(console.error(`Unknown webhook subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage webhooks in a Prismic repository.
2315
+ Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ac();return}let i=await $(n);if(!i.ok){i.error instanceof Z?ac():(console.error(`Failed to test webhook: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let o=await ic(n,a.config._id);if(!o.ok){o.error instanceof Z?ac():(console.error(`Failed to test webhook: ${q(o.value)}`),process.exitCode=1);return}console.info(`Test webhook triggered: ${r}`)}async function ic(e,t){return await X(new URL(`/app/settings/webhooks/${t}/trigger`,await V(e)),{method:`POST`})}function ac(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function oc(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`list`:await Gs();break;case`create`:await Bs();break;case`view`:await Uo();break;case`remove`:await qs();break;case`test`:await rc();break;case`enable`:await Ps();break;case`disable`:await Us();break;case`status`:await tc();break;case`add-header`:await Ls();break;case`remove-header`:await Xs();break;case`set-triggers`:await $s();break;default:t&&(console.error(`Unknown webhook subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage webhooks in a Prismic repository.
2508
2316
 
2509
2317
  USAGE
2510
2318
  prismic webhook <command> [flags]
@@ -2526,7 +2334,7 @@ FLAGS
2526
2334
  -h, --help Show help for command
2527
2335
 
2528
2336
  LEARN MORE
2529
- Use \`prismic webhook <command> --help\` for more information about a command.`)}}async function _c(){let{values:{help:t}}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}}});if(t){console.info(`Show the currently logged in user.
2337
+ Use \`prismic webhook <command> --help\` for more information about a command.`)}}async function sc(){let{values:{help:t}}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}}});if(t){console.info(`Show the currently logged in user.
2530
2338
 
2531
2339
  USAGE
2532
2340
  prismic whoami [flags]
@@ -2535,7 +2343,7 @@ FLAGS
2535
2343
  -h, --help Show help for command
2536
2344
 
2537
2345
  LEARN MORE
2538
- Use \`prismic <command> --help\` for more information about a command.`);return}if(!await H()){yc();return}let n=await vc();if(!n.ok){n.error instanceof Z?yc():console.error(`Failed to fetch user profile.`),process.exitCode=1;return}console.info(n.value.email)}async function vc(){return await X(new URL(`profile`,await vn()),{schema:F({email:R()})})}function yc(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const{positionals:bc,values:{version:xc}}=e({options:{help:{type:`boolean`,short:`h`},version:{type:`boolean`,short:`v`}},allowPositionals:!0,strict:!1});if(xc)console.info(ee);else switch(bc[0]){case`init`:await Qr();break;case`login`:await gi();break;case`logout`:await yi();break;case`whoami`:await _c();break;case`status`:await is();break;case`repo`:await po();break;case`locale`:await mi();break;case`page-type`:await da();break;case`custom-type`:await Fr();break;case`slice`:await Bo();break;case`pull`:await Ra();break;case`push`:await Va();break;case`codegen`:await Gn();break;case`docs`:await Vr();break;case`preview`:await La();break;case`token`:await Us();break;case`webhook`:await gc();break;default:bc[0]&&(console.error(`Unknown command: ${bc[0]}`),process.exitCode=1),console.info(`Prismic CLI for managing repositories and configurations.
2346
+ Use \`prismic <command> --help\` for more information about a command.`);return}if(!await H()){lc();return}let n=await cc();if(!n.ok){n.error instanceof Z?lc():console.error(`Failed to fetch user profile.`),process.exitCode=1;return}console.info(n.value.email)}async function cc(){return await X(new URL(`profile`,await vn()),{schema:F({email:R()})})}function lc(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const{positionals:uc,values:{version:dc}}=e({options:{help:{type:`boolean`,short:`h`},version:{type:`boolean`,short:`v`}},allowPositionals:!0,strict:!1});if(dc)console.info(ee);else switch(uc[0]){case`init`:await Kr();break;case`login`:await ui();break;case`logout`:await pi();break;case`whoami`:await sc();break;case`status`:await Jo();break;case`repo`:await oo();break;case`locale`:await ci();break;case`page-type`:await aa();break;case`custom-type`:await Fr();break;case`slice`:await Po();break;case`pull`:await Ma();break;case`push`:await Fa();break;case`codegen`:await Gn();break;case`preview`:await ja();break;case`token`:await Ns();break;case`webhook`:await oc();break;default:uc[0]&&(console.error(`Unknown command: ${uc[0]}`),process.exitCode=1),console.info(`Prismic CLI for managing repositories and configurations.
2539
2347
 
2540
2348
  USAGE
2541
2349
  prismic <command> [flags]
@@ -2554,7 +2362,6 @@ COMMANDS
2554
2362
  pull Pull types and slices from Prismic
2555
2363
  push Push types and slices to Prismic
2556
2364
  codegen Generate code from Prismic models
2557
- docs Fetch documentation from Prismic
2558
2365
  preview Manage preview configurations
2559
2366
  token Manage API tokens in a repository
2560
2367
  webhook Manage webhooks in a repository