@angeloashmore/prismic-cli-poc 0.0.0-canary.e58e691 → 0.0.0-pr.4.484acb8

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 (83) hide show
  1. package/dist/index.mjs +804 -278
  2. package/package.json +2 -1
  3. package/src/codegen-types.ts +82 -0
  4. package/src/codegen.ts +45 -0
  5. package/src/custom-type-add-field-boolean.ts +26 -5
  6. package/src/custom-type-add-field-color.ts +25 -6
  7. package/src/custom-type-add-field-date.ts +25 -6
  8. package/src/custom-type-add-field-embed.ts +25 -6
  9. package/src/custom-type-add-field-geo-point.ts +25 -6
  10. package/src/custom-type-add-field-image.ts +25 -6
  11. package/src/custom-type-add-field-key-text.ts +25 -6
  12. package/src/custom-type-add-field-link.ts +26 -5
  13. package/src/custom-type-add-field-number.ts +25 -6
  14. package/src/custom-type-add-field-rich-text.ts +26 -5
  15. package/src/custom-type-add-field-select.ts +34 -6
  16. package/src/custom-type-add-field-timestamp.ts +25 -6
  17. package/src/custom-type-add-field-uid.ts +25 -6
  18. package/src/custom-type-connect-slice.ts +24 -25
  19. package/src/custom-type-create.ts +20 -1
  20. package/src/custom-type-disconnect-slice.ts +24 -26
  21. package/src/custom-type-remove-field.ts +17 -1
  22. package/src/custom-type-remove.ts +20 -2
  23. package/src/custom-type-set-name.ts +17 -1
  24. package/src/index.ts +73 -51
  25. package/src/init.ts +3 -1
  26. package/src/lib/auth.ts +24 -1
  27. package/src/lib/custom-types-api.ts +74 -20
  28. package/src/lib/framework.ts +143 -0
  29. package/src/lib/slice.ts +5 -2
  30. package/src/lib/string.ts +6 -0
  31. package/src/login.ts +18 -9
  32. package/src/page-type-add-field-boolean.ts +26 -5
  33. package/src/page-type-add-field-color.ts +25 -6
  34. package/src/page-type-add-field-date.ts +25 -6
  35. package/src/page-type-add-field-embed.ts +25 -6
  36. package/src/page-type-add-field-geo-point.ts +25 -6
  37. package/src/page-type-add-field-image.ts +25 -6
  38. package/src/page-type-add-field-key-text.ts +25 -6
  39. package/src/page-type-add-field-link.ts +26 -5
  40. package/src/page-type-add-field-number.ts +25 -6
  41. package/src/page-type-add-field-rich-text.ts +26 -5
  42. package/src/page-type-add-field-select.ts +34 -6
  43. package/src/page-type-add-field-timestamp.ts +25 -6
  44. package/src/page-type-add-field-uid.ts +25 -6
  45. package/src/page-type-connect-slice.ts +24 -25
  46. package/src/page-type-create.ts +20 -1
  47. package/src/page-type-disconnect-slice.ts +24 -26
  48. package/src/page-type-remove-field.ts +17 -1
  49. package/src/page-type-remove.ts +20 -2
  50. package/src/page-type-set-name.ts +17 -1
  51. package/src/page-type-set-repeatable.ts +17 -1
  52. package/src/preview-get-simulator.ts +104 -0
  53. package/src/preview-remove-simulator.ts +80 -0
  54. package/src/preview-set-simulator.ts +116 -0
  55. package/src/preview.ts +19 -4
  56. package/src/pull.ts +41 -6
  57. package/src/push.ts +35 -11
  58. package/src/repo-get-access.ts +86 -0
  59. package/src/repo-set-access.ts +100 -0
  60. package/src/repo.ts +10 -0
  61. package/src/slice-add-field-boolean.ts +25 -2
  62. package/src/slice-add-field-color.ts +24 -3
  63. package/src/slice-add-field-date.ts +24 -3
  64. package/src/slice-add-field-embed.ts +24 -3
  65. package/src/slice-add-field-geo-point.ts +24 -3
  66. package/src/slice-add-field-image.ts +24 -3
  67. package/src/slice-add-field-key-text.ts +24 -3
  68. package/src/slice-add-field-link.ts +25 -2
  69. package/src/slice-add-field-number.ts +24 -3
  70. package/src/slice-add-field-rich-text.ts +25 -2
  71. package/src/slice-add-field-select.ts +33 -3
  72. package/src/slice-add-field-timestamp.ts +24 -3
  73. package/src/slice-add-variation.ts +21 -13
  74. package/src/slice-create.ts +20 -1
  75. package/src/slice-remove-field.ts +20 -9
  76. package/src/slice-remove-variation.ts +20 -10
  77. package/src/slice-remove.ts +17 -1
  78. package/src/slice-rename.ts +17 -1
  79. package/src/status.ts +733 -0
  80. package/src/token-create.ts +23 -5
  81. package/src/token-delete.ts +29 -8
  82. package/src/token-list.ts +14 -3
  83. package/src/token-set-name.ts +38 -10
package/dist/index.mjs CHANGED
@@ -1,5 +1,196 @@
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{pathToFileURL as c}from"node:url";import{homedir as l}from"node:os";import{exec as u}from"node:child_process";import{createServer as d}from"node:http";function f(e){return{lang:e?.lang??void 0,message:e?.message,abortEarly:e?.abortEarly??void 0,abortPipeEarly:e?.abortPipeEarly??void 0}}function p(e){return(void 0)?.get(e)}function m(e){return(void 0)?.get(e)}function h(e,t){return(void 0)?.get(e)?.get(t)}function g(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 _(e,t,n,r,i){let a=i&&`input`in i?i.input:n.value,o=i?.expected??e.expects??null,s=i?.received??g(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??h(e.reference,c.lang)??(l?m(c.lang):null)??r.message??p(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 v(e){return{version:1,vendor:`valibot`,validate(t){return e[`~run`]({value:t},f())}}}function y(e,t){return Object.hasOwn(e,t)&&t!==`__proto__`&&t!==`prototype`&&t!==`constructor`}function b(e){return e instanceof x}var x=class extends Error{constructor(e){super(e[0].message),this.name=`ValiError`,this.issues=e}};function ee(e){return{kind:`validation`,type:`url`,reference:ee,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)&&_(this,`URL`,e,t),e}}}function te(e,t,n){return typeof e.fallback==`function`?e.fallback(t,n):e.fallback}function ne(e,t,n){return typeof e.default==`function`?e.default(t,n):e.default}function S(e,t){return{kind:`schema`,type:`array`,reference:S,expects:`Array`,async:!1,item:e,message:t,get"~standard"(){return v(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 _(this,`type`,e,t);return e}}}function C(e){return{kind:`schema`,type:`boolean`,reference:C,expects:`boolean`,async:!1,message:e,get"~standard"(){return v(this)},"~run"(e,t){return typeof e.value==`boolean`?e.typed=!0:_(this,`type`,e,t),e}}}function re(e,t){return{kind:`schema`,type:`literal`,reference:re,expects:g(e),async:!1,literal:e,message:t,get"~standard"(){return v(this)},"~run"(e,t){return e.value===this.literal?e.typed=!0:_(this,`type`,e,t),e}}}function w(e,t){return{kind:`schema`,type:`nullable`,reference:w,expects:`(${e.expects} | null)`,async:!1,wrapped:e,default:t,get"~standard"(){return v(this)},"~run"(e,t){return e.value===null&&(this.default!==void 0&&(e.value=ne(this,e,t)),e.value===null)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function T(e){return{kind:`schema`,type:`number`,reference:T,expects:`number`,async:!1,message:e,get"~standard"(){return v(this)},"~run"(e,t){return typeof e.value==`number`&&!isNaN(e.value)?e.typed=!0:_(this,`type`,e,t),e}}}function E(e,t){return{kind:`schema`,type:`object`,reference:E,expects:`Object`,async:!1,entries:e,message:t,get"~standard"(){return v(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]:ne(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]=te(i);else if(i.type!==`exact_optional`&&i.type!==`optional`&&i.type!==`nullish`&&(_(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 _(this,`type`,e,t);return e}}}function D(e,t){return{kind:`schema`,type:`optional`,reference:D,expects:`(${e.expects} | undefined)`,async:!1,wrapped:e,default:t,get"~standard"(){return v(this)},"~run"(e,t){return e.value===void 0&&(this.default!==void 0&&(e.value=ne(this,e,t)),e.value===void 0)?(e.typed=!0,e):this.wrapped[`~run`](e,t)}}}function O(e,t,n){return{kind:`schema`,type:`record`,reference:O,expects:`Object`,async:!1,key:e,value:t,message:n,get"~standard"(){return v(this)},"~run"(e,t){let n=e.value;if(n&&typeof n==`object`){for(let r in e.typed=!0,e.value={},n)if(y(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 _(this,`type`,e,t);return e}}}function k(e){return{kind:`schema`,type:`string`,reference:k,expects:`string`,async:!1,message:e,get"~standard"(){return v(this)},"~run"(e,t){return typeof e.value==`string`?e.typed=!0:_(this,`type`,e,t),e}}}function A(){return{kind:`schema`,type:`unknown`,reference:A,expects:`unknown`,async:!1,get"~standard"(){return v(this)},"~run"(e){return e.typed=!0,e}}}function ie(e,t,n){let r=e[`~run`]({value:t},f(n));if(r.issues)throw new x(r.issues);return r.value}function ae(...e){return{...e[0],pipe:e,get"~standard"(){return v(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 j(e,t,n){let r=e[`~run`]({value:t},f(n));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}const oe=new URL(`.prismic`,I(c(l()))),se=`https://prismic.io`;async function ce(e,t){let n={token:e,host:t?.host};await s(oe,JSON.stringify(n,null,2))}async function M(){return!!await N()}async function N(){return(await le())?.token}async function P(){try{let e=await le();return e?.host?new URL(e.host):new URL(se)}catch{return new URL(se)}}async function le(){try{let e=await r(oe,`utf-8`);return JSON.parse(e)}catch{return}}async function ue(){try{await t(oe)}catch{return!0}return await le()?(await o(oe),!0):!1}async function F(e){let t=await P();return t.hostname=`${e}.${t.hostname}`,I(t)}async function de(){let e=await P();return e.hostname=`api.internal.${e.hostname}`,I(e)}async function fe(){let e=await P();return e.hostname=`user-service.${e.hostname}`,I(e)}function I(e){let t=new URL(e);return t.pathname.endsWith(`/`)||(t.pathname+=`/`),t}async function L(e,n={}){let{start:r=c(process.cwd()),stop:i}=n,a=I(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 R(e){try{return await t(e),!0}catch{return!1}}function z(e){return JSON.stringify(e,null,2)}const pe=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function me(){let{values:{help:t,tab:n,label:i,default:a,"true-label":o,"false-label":c},positionals:[l,u]}=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`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a boolean (toggle) field to an existing custom type.
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.4.484acb8`,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(`
5
+ `))&&!t?.force?e:e+`
6
+ `}function O(e,t){return Ge(t)+e}function Ke(e,t){return(!e||e.endsWith(`
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`
10
+ /**
11
+ * Item in *${l}*
12
+ */
13
+ export interface ${s} {
14
+ ${u.code}
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`
17
+ /**
18
+ * Primary content in *${c}*
19
+ */
20
+ `;u=l.code?O(D.source`
21
+ export interface ${s} {
22
+ ${l.code}
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`
25
+ /**
26
+ * Item content in *${s}*
27
+ */
28
+ `;u=l.code?O(D.source`
29
+ export interface ${c} {
30
+ ${l.code}
31
+ }
32
+ `,u):O(`export interface ${c} {}`,u),n.push({name:c,code:u}),r.push(c)}n.push({name:o,code:D.stripIndent`
33
+ /**
34
+ * Slice for *${Bt({path:[...e.path,{name:e.name,model:e.field}]})}*
35
+ */
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`
38
+ /**
39
+ * Content for ${a} documents
40
+ */
41
+ interface ${i} {
42
+ ${o}
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`
45
+ /**
46
+ * ${s} document from Prismic
47
+ *
48
+ * - **API ID**: \`${e.model.id}\`
49
+ * - **Repeatable**: \`${e.model.repeatable.toString()}\`
50
+ * - **Documentation**: ${`https://prismic.io/docs/content-modeling`}
51
+ *
52
+ * @typeParam Lang - Language API ID of the document.
53
+ */
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`
56
+ /**
57
+ * Primary content in *${a}*
58
+ */
59
+ `;t=k(o.code?D.source`
60
+ ${u}
61
+ export interface ${l} {
62
+ ${o.code}
63
+ }
64
+ `:D.source`
65
+ ${u}
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`
68
+ /**
69
+ * Primary content in *${a}*
70
+ */
71
+ `;t=k(o.code?D.source`
72
+ ${l}
73
+ export interface ${u} {
74
+ ${o.code}
75
+ }
76
+ `:D.source`
77
+ ${l}
78
+ export interface ${u} {}
79
+ `,t)}t=k(D.source`
80
+ /**
81
+ * ${s.name} variation for ${a} Slice
82
+ *
83
+ * - **API ID**: \`${s.id}\`
84
+ * - **Description**: ${s.description||`*None*`}
85
+ * - **Documentation**: ${qe}
86
+ */
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`
89
+ /**
90
+ * Slice variation for *${a}*
91
+ */
92
+ type ${s} = ${o.length>0?c:`never`}
93
+ `,t),t=k(D.source`
94
+ /**
95
+ * ${a} Shared Slice
96
+ *
97
+ * - **API ID**: \`${e.model.id}\`
98
+ * - **Description**: ${e.model.description||`*None*`}
99
+ * - **Documentation**: ${qe}
100
+ */
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(`
103
+ type PickContentRelationshipFieldData<
104
+ TRelationship extends prismic.CustomTypeModelFetchCustomTypeLevel1 | prismic.CustomTypeModelFetchCustomTypeLevel2 | prismic.CustomTypeModelFetchGroupLevel1 | prismic.CustomTypeModelFetchGroupLevel2,
105
+ TData extends Record<string, prismic.AnyRegularField | prismic.GroupField | prismic.NestedGroupField | prismic.SliceZone>,
106
+ TLang extends string
107
+ > = |
108
+ // Content relationship fields
109
+ {
110
+ [TSubRelationship in Extract<
111
+ TRelationship["fields"][number], prismic.CustomTypeModelFetchContentRelationshipLevel1
112
+ > as TSubRelationship["id"]]:
113
+ ContentRelationshipFieldWithData<TSubRelationship["customtypes"], TLang>;
114
+ } &
115
+ // Group
116
+ {
117
+ [TGroup in Extract<
118
+ TRelationship["fields"][number], prismic.CustomTypeModelFetchGroupLevel1 | prismic.CustomTypeModelFetchGroupLevel2
119
+ > as TGroup["id"]]:
120
+ TData[TGroup["id"]] extends prismic.GroupField<infer TGroupData>
121
+ ? prismic.GroupField<PickContentRelationshipFieldData<TGroup, TGroupData, TLang>>
122
+ : never
123
+ } &
124
+ // Other fields
125
+ {
126
+ [TFieldKey in Extract<TRelationship["fields"][number], string>]:
127
+ TFieldKey extends keyof TData ? TData[TFieldKey] : never;
128
+ };
129
+
130
+ type ContentRelationshipFieldWithData<
131
+ TCustomType extends readonly (prismic.CustomTypeModelFetchCustomTypeLevel1 | string)[] | readonly (prismic.CustomTypeModelFetchCustomTypeLevel2 | string)[],
132
+ TLang extends string = string
133
+ > = {
134
+ [ID in Exclude<TCustomType[number], string>["id"]]:
135
+ prismic.ContentRelationshipField<
136
+ ID,
137
+ TLang,
138
+ PickContentRelationshipFieldData<
139
+ Extract<TCustomType[number], { id: ID }>,
140
+ Extract<prismic.Content.AllDocumentTypes, { type: ID }>["data"],
141
+ TLang
142
+ >
143
+ >
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 {
146
+ (repositoryNameOrEndpoint: string, options?: ${a}.ClientConfig): ${a}.Client<AllDocumentTypes>;
147
+ }`,t),t=k(`interface CreateWriteClient {
148
+ (repositoryNameOrEndpoint: string, options: ${a}.WriteClientConfig): ${a}.WriteClient<AllDocumentTypes>;
149
+ }`,t),t=k(`interface CreateMigration {
150
+ (): ${a}.Migration<AllDocumentTypes>;
151
+ }`,t)):(t=k(`interface CreateClient {
152
+ (repositoryNameOrEndpoint: string, options?: ${a}.ClientConfig): ${a}.Client;
153
+ }`,t),t=k(`interface CreateWriteClient {
154
+ (repositoryNameOrEndpoint: string, options?: ${a}.WriteClientConfig): ${a}.WriteClient;
155
+ }`,t),t=k(`interface CreateMigration {
156
+ (): ${a}.Migration;
157
+ }`,t))),e.clientIntegration.includeContentNamespace&&(t=k(D.source`
158
+ namespace Content {
159
+ export type {
160
+ ${o.join(`,
161
+ `)}
162
+ }
163
+ }
164
+ `,t)),r=k(D.source`
165
+ declare module "@prismicio/client" {
166
+ ${t}
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.
169
+
170
+ USAGE
171
+ prismic codegen types [flags]
172
+
173
+ FLAGS
174
+ -o, --output string Output file path (default: "prismicio-types.d.ts")
175
+ -h, --help Show help for command
176
+
177
+ EXAMPLES
178
+ prismic codegen types
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
+
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.
182
+
183
+ USAGE
184
+ prismic codegen <command> [flags]
185
+
186
+ COMMANDS
187
+ types Generate TypeScript types from models pushed to Prismic
188
+
189
+ FLAGS
190
+ -h, --help Show help for command
191
+
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.
3
194
 
4
195
  USAGE
5
196
  prismic custom-type add-field boolean <type-id> <field-id> [flags]
@@ -8,20 +199,24 @@ ARGUMENTS
8
199
  type-id Custom type identifier (required)
9
200
  field-id Field identifier (required)
10
201
 
202
+ Types are generated by default after changes. Use --no-types to skip.
203
+
11
204
  FLAGS
12
205
  -t, --tab string Target tab (default: first existing tab, or "Main")
13
- -l, --label string Display label for the field
206
+ -l, --label string Display label for the field (inferred from field-id if omitted)
14
207
  --default Set default value to true
15
208
  --true-label string Label shown when toggle is on
16
209
  --false-label string Label shown when toggle is off
210
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
211
+ --no-types Skip type generation
17
212
  -h, --help Show help for command
18
213
 
19
214
  EXAMPLES
20
215
  prismic custom-type add-field boolean homepage featured
21
216
  prismic custom-type add-field boolean article published --default
22
- prismic custom-type add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!l){console.error(`Missing required argument: type-id
23
- `),console.error(`Usage: prismic custom-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
24
- `),console.error(`Usage: prismic custom-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}let d=await L(`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=j(pe,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:`Boolean`,config:{...i&&{label:i},...a&&{default_value:!0},...o&&{placeholder_true:o},...c&&{placeholder_false:c}}};p.json[h][u]=g;try{await s(f,z(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}" (Boolean) to "${h}" tab in ${l}`)}const he=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function ge(){let{values:{help:t,tab:n,label:i,placeholder:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing custom type.
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.
25
220
 
26
221
  USAGE
27
222
  prismic custom-type add-field color <type-id> <field-id> [flags]
@@ -30,18 +225,22 @@ ARGUMENTS
30
225
  type-id Custom type identifier (required)
31
226
  field-id Field identifier (required)
32
227
 
228
+ Types are generated by default after changes. Use --no-types to skip.
229
+
33
230
  FLAGS
34
231
  -t, --tab string Target tab (default: first existing tab, or "Main")
35
- -l, --label string Display label for the field
232
+ -l, --label string Display label for the field (inferred from field-id if omitted)
36
233
  -p, --placeholder string Placeholder text
234
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
235
+ --no-types Skip type generation
37
236
  -h, --help Show help for command
38
237
 
39
238
  EXAMPLES
40
239
  prismic custom-type add-field color homepage bg_color
41
240
  prismic custom-type add-field color homepage accent --tab "Design"
42
- prismic custom-type add-field color homepage text_color --label "Text Color"`);return}if(!o){console.error(`Missing required argument: type-id
43
- `),console.error(`Usage: prismic custom-type add-field color <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
44
- `),console.error(`Usage: prismic custom-type add-field color <type-id> <field-id>`),process.exitCode=1;return}let l=await L(`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=j(he,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:`Color`,config:{...i&&{label:i},...a&&{placeholder:a}}};d.json[p][c]=m;try{await s(u,z(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}" (Color) to "${p}" tab in ${o}`)}const _e=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function ve(){let{values:{help:t,tab:n,label:i,placeholder:a,default: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`},default:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date field to an existing custom type.
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.
45
244
 
46
245
  USAGE
47
246
  prismic custom-type add-field date <type-id> <field-id> [flags]
@@ -50,19 +249,23 @@ ARGUMENTS
50
249
  type-id Custom type identifier (required)
51
250
  field-id Field identifier (required)
52
251
 
252
+ Types are generated by default after changes. Use --no-types to skip.
253
+
53
254
  FLAGS
54
255
  -t, --tab string Target tab (default: first existing tab, or "Main")
55
- -l, --label string Display label for the field
256
+ -l, --label string Display label for the field (inferred from field-id if omitted)
56
257
  -p, --placeholder string Placeholder text
57
258
  --default string Default date value (YYYY-MM-DD format)
259
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
260
+ --no-types Skip type generation
58
261
  -h, --help Show help for command
59
262
 
60
263
  EXAMPLES
61
264
  prismic custom-type add-field date homepage publish_date
62
265
  prismic custom-type add-field date event start_date --tab "Schedule"
63
- prismic custom-type add-field date article date --label "Publication Date" --default "2024-01-01"`);return}if(!c){console.error(`Missing required argument: type-id
64
- `),console.error(`Usage: prismic custom-type add-field date <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
65
- `),console.error(`Usage: prismic custom-type add-field date <type-id> <field-id>`),process.exitCode=1;return}let u=await L(`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=j(_e,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:`Date`,config:{...i&&{label:i},...a&&{placeholder:a},...o&&{default:o}}};f.json[m][l]=h;try{await s(d,z(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}" (Date) to "${m}" tab in ${c}`)}const ye=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function be(){let{values:{help:t,tab:n,label:i,placeholder:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed field to an existing custom type.
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.
66
269
 
67
270
  USAGE
68
271
  prismic custom-type add-field embed <type-id> <field-id> [flags]
@@ -71,18 +274,22 @@ ARGUMENTS
71
274
  type-id Custom type identifier (required)
72
275
  field-id Field identifier (required)
73
276
 
277
+ Types are generated by default after changes. Use --no-types to skip.
278
+
74
279
  FLAGS
75
280
  -t, --tab string Target tab (default: first existing tab, or "Main")
76
- -l, --label string Display label for the field
281
+ -l, --label string Display label for the field (inferred from field-id if omitted)
77
282
  -p, --placeholder string Placeholder text
283
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
284
+ --no-types Skip type generation
78
285
  -h, --help Show help for command
79
286
 
80
287
  EXAMPLES
81
288
  prismic custom-type add-field embed homepage video
82
289
  prismic custom-type add-field embed homepage youtube --tab "Media"
83
- prismic custom-type add-field embed homepage media --label "Media Embed"`);return}if(!o){console.error(`Missing required argument: type-id
84
- `),console.error(`Usage: prismic custom-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
85
- `),console.error(`Usage: prismic custom-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}let l=await L(`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=j(ye,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:`Embed`,config:{...i&&{label:i},...a&&{placeholder:a}}};d.json[p][c]=m;try{await s(u,z(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}" (Embed) to "${p}" tab in ${o}`)}const xe=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Se(){let{values:{help:t,tab:n,label:i},positionals:[a,o]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geo-point (location) field to an existing custom type.
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.
86
293
 
87
294
  USAGE
88
295
  prismic custom-type add-field geo-point <type-id> <field-id> [flags]
@@ -91,17 +298,21 @@ ARGUMENTS
91
298
  type-id Custom type identifier (required)
92
299
  field-id Field identifier (required)
93
300
 
301
+ Types are generated by default after changes. Use --no-types to skip.
302
+
94
303
  FLAGS
95
304
  -t, --tab string Target tab (default: first existing tab, or "Main")
96
- -l, --label string Display label for the field
305
+ -l, --label string Display label for the field (inferred from field-id if omitted)
306
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
307
+ --no-types Skip type generation
97
308
  -h, --help Show help for command
98
309
 
99
310
  EXAMPLES
100
311
  prismic custom-type add-field geo-point homepage location
101
312
  prismic custom-type add-field geo-point store address --tab "Details"
102
- prismic custom-type add-field geo-point event venue --label "Event Venue"`);return}if(!a){console.error(`Missing required argument: type-id
103
- `),console.error(`Usage: prismic custom-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
104
- `),console.error(`Usage: prismic custom-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}let c=await L(`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=j(xe,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=Object.keys(u.json),f=n??d[0]??`Main`;u.json[f]||(u.json[f]={});for(let[e,t]of Object.entries(u.json))if(t[o]){console.error(`Field "${o}" already exists in tab "${e}"`),process.exitCode=1;return}let p={type:`GeoPoint`,config:{...i&&{label:i}}};u.json[f][o]=p;try{await s(l,z(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(`Added field "${o}" (GeoPoint) to "${f}" tab in ${a}`)}const Ce=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function we(){let{values:{help:t,tab:n,label:i,placeholder:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing custom type.
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.
105
316
 
106
317
  USAGE
107
318
  prismic custom-type add-field image <type-id> <field-id> [flags]
@@ -110,18 +321,22 @@ ARGUMENTS
110
321
  type-id Custom type identifier (required)
111
322
  field-id Field identifier (required)
112
323
 
324
+ Types are generated by default after changes. Use --no-types to skip.
325
+
113
326
  FLAGS
114
327
  -t, --tab string Target tab (default: first existing tab, or "Main")
115
- -l, --label string Display label for the field
328
+ -l, --label string Display label for the field (inferred from field-id if omitted)
116
329
  -p, --placeholder string Placeholder text
330
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
331
+ --no-types Skip type generation
117
332
  -h, --help Show help for command
118
333
 
119
334
  EXAMPLES
120
335
  prismic custom-type add-field image homepage hero
121
336
  prismic custom-type add-field image article thumbnail --tab "Media"
122
- prismic custom-type add-field image product photo --label "Product Photo"`);return}if(!o){console.error(`Missing required argument: type-id
123
- `),console.error(`Usage: prismic custom-type add-field image <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
124
- `),console.error(`Usage: prismic custom-type add-field image <type-id> <field-id>`),process.exitCode=1;return}let l=await L(`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=j(Ce,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:`Image`,config:{...i&&{label:i},...a&&{placeholder:a}}};d.json[p][c]=m;try{await s(u,z(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}" (Image) to "${p}" tab in ${o}`)}const Te=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Ee(){let{values:{help:t,tab:n,label:i,placeholder:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing custom type.
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.
125
340
 
126
341
  USAGE
127
342
  prismic custom-type add-field key-text <type-id> <field-id> [flags]
@@ -130,18 +345,22 @@ ARGUMENTS
130
345
  type-id Custom type identifier (required)
131
346
  field-id Field identifier (required)
132
347
 
348
+ Types are generated by default after changes. Use --no-types to skip.
349
+
133
350
  FLAGS
134
351
  -t, --tab string Target tab (default: first existing tab, or "Main")
135
- -l, --label string Display label for the field
352
+ -l, --label string Display label for the field (inferred from field-id if omitted)
136
353
  -p, --placeholder string Placeholder text
354
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
355
+ --no-types Skip type generation
137
356
  -h, --help Show help for command
138
357
 
139
358
  EXAMPLES
140
359
  prismic custom-type add-field key-text homepage title
141
360
  prismic custom-type add-field key-text homepage meta_title --tab "SEO"
142
- prismic custom-type add-field key-text homepage subtitle --label "Subtitle" --placeholder "Enter subtitle"`);return}if(!o){console.error(`Missing required argument: type-id
143
- `),console.error(`Usage: prismic custom-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
144
- `),console.error(`Usage: prismic custom-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}let l=await L(`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=j(Te,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:`Text`,config:{...i&&{label:i},...a&&{placeholder:a}}};d.json[p][c]=m;try{await s(u,z(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}" (Text) to "${p}" tab in ${o}`)}const De=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Oe(){let{values:{help:t,tab:n,label:i,placeholder:a,variation:o,"allow-text":c,"allow-target-blank":l,repeatable: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`},variation:{type:`string`,multiple:!0},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing custom type.
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.
145
364
 
146
365
  USAGE
147
366
  prismic custom-type add-field link <type-id> <field-id> [flags]
@@ -150,23 +369,27 @@ ARGUMENTS
150
369
  type-id Custom type identifier (required)
151
370
  field-id Field identifier (required)
152
371
 
372
+ Types are generated by default after changes. Use --no-types to skip.
373
+
153
374
  FLAGS
154
375
  -t, --tab string Target tab (default: first existing tab, or "Main")
155
- -l, --label string Display label for the field
376
+ -l, --label string Display label for the field (inferred from field-id if omitted)
156
377
  -p, --placeholder string Placeholder text
157
378
  --variation string Slice variations (can be used multiple times)
158
379
  --allow-text Allow text with link
159
380
  --allow-target-blank Allow opening link in new tab
160
381
  --repeatable Allow multiple links
382
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
383
+ --no-types Skip type generation
161
384
  -h, --help Show help for command
162
385
 
163
386
  EXAMPLES
164
387
  prismic custom-type add-field link homepage button
165
388
  prismic custom-type add-field link homepage cta --allow-text
166
389
  prismic custom-type add-field link homepage cta --variation Primary --variation Secondary
167
- prismic custom-type add-field link homepage links --repeatable`);return}if(!d){console.error(`Missing required argument: type-id
168
- `),console.error(`Usage: prismic custom-type add-field link <type-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
169
- `),console.error(`Usage: prismic custom-type add-field link <type-id> <field-id>`),process.exitCode=1;return}let p=await L(`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=j(De,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:`Link`,config:{...i&&{label:i},...a&&{placeholder:a},...o&&o.length>0&&{variants:o},...c&&{allowText:!0},...l&&{allowTargetBlank:!0},...u&&{repeat:!0}}};h.json[_][f]=v;try{await s(m,z(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}" (Link) to "${_}" tab in ${d}`)}const ke=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Ae(){let{values:{help:t,tab:n,label:i,placeholder:a,min:o,max:c,step: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`},min:{type:`string`},max:{type:`string`},step:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing custom type.
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.
170
393
 
171
394
  USAGE
172
395
  prismic custom-type add-field number <type-id> <field-id> [flags]
@@ -175,21 +398,25 @@ ARGUMENTS
175
398
  type-id Custom type identifier (required)
176
399
  field-id Field identifier (required)
177
400
 
401
+ Types are generated by default after changes. Use --no-types to skip.
402
+
178
403
  FLAGS
179
404
  -t, --tab string Target tab (default: first existing tab, or "Main")
180
- -l, --label string Display label for the field
405
+ -l, --label string Display label for the field (inferred from field-id if omitted)
181
406
  -p, --placeholder string Placeholder text
182
407
  --min number Minimum value
183
408
  --max number Maximum value
184
409
  --step number Step increment
410
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
411
+ --no-types Skip type generation
185
412
  -h, --help Show help for command
186
413
 
187
414
  EXAMPLES
188
415
  prismic custom-type add-field number homepage price
189
416
  prismic custom-type add-field number product quantity --min 0 --max 100
190
- prismic custom-type add-field number settings rating --min 1 --max 5 --step 1`);return}if(!u){console.error(`Missing required argument: type-id
191
- `),console.error(`Usage: prismic custom-type add-field number <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
192
- `),console.error(`Usage: prismic custom-type add-field number <type-id> <field-id>`),process.exitCode=1;return}let f=o===void 0?void 0:Number(o),p=c===void 0?void 0:Number(c),m=l===void 0?void 0:Number(l);if(o!==void 0&&Number.isNaN(f)){console.error(`Invalid --min value: must be a number`),process.exitCode=1;return}if(c!==void 0&&Number.isNaN(p)){console.error(`Invalid --max value: must be a number`),process.exitCode=1;return}if(l!==void 0&&Number.isNaN(m)){console.error(`Invalid --step value: must be a number`),process.exitCode=1;return}let h=await L(`package.json`);if(!h){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let g=new URL(`customtypes/${u}/index.json`,h),_;try{let e=await r(g,`utf8`),t=j(ke,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: ${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 v=Object.keys(_.json),y=n??v[0]??`Main`;_.json[y]||(_.json[y]={});for(let[e,t]of Object.entries(_.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let b={type:`Number`,config:{...i&&{label:i},...a&&{placeholder:a},...f!==void 0&&{min:f},...p!==void 0&&{max:p},...m!==void 0&&{step:m}}};_.json[y][d]=b;try{await s(g,z(_))}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}" (Number) to "${y}" tab in ${u}`)}const je=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Me(){let{values:{help:t,tab:n,label:i,placeholder:a,single:o,multi:c,"allow-target-blank":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`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing custom type.
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.
193
420
 
194
421
  USAGE
195
422
  prismic custom-type add-field rich-text <type-id> <field-id> [flags]
@@ -198,13 +425,17 @@ ARGUMENTS
198
425
  type-id Custom type identifier (required)
199
426
  field-id Field identifier (required)
200
427
 
428
+ Types are generated by default after changes. Use --no-types to skip.
429
+
201
430
  FLAGS
202
431
  -t, --tab string Target tab (default: first existing tab, or "Main")
203
- -l, --label string Display label for the field
432
+ -l, --label string Display label for the field (inferred from field-id if omitted)
204
433
  -p, --placeholder string Placeholder text
205
434
  --single string Allowed block types for single-line (comma-separated)
206
435
  --multi string Allowed block types for multi-line (comma-separated)
207
436
  --allow-target-blank Allow opening links in new tab
437
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
438
+ --no-types Skip type generation
208
439
  -h, --help Show help for command
209
440
 
210
441
  BLOCK TYPES
@@ -216,9 +447,9 @@ EXAMPLES
216
447
  prismic custom-type add-field rich-text homepage body
217
448
  prismic custom-type add-field rich-text article content --multi "paragraph,heading2,heading3,strong,em,hyperlink"
218
449
  prismic custom-type add-field rich-text page tagline --single "heading1"
219
- prismic custom-type add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!u){console.error(`Missing required argument: type-id
220
- `),console.error(`Usage: prismic custom-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
221
- `),console.error(`Usage: prismic custom-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}let f=await L(`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=j(je,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:`StructuredText`,config:{...i&&{label:i},...a&&{placeholder:a},...o&&{single:o},...c&&{multi:c},...l&&{allowTargetBlank:!0}}};m.json[g][d]=_;try{await s(p,z(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}" (StructuredText) to "${g}" tab in ${u}`)}const Ne=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Pe(){let{values:{help:t,tab:n,label:i,placeholder:a,option:o,default: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`},option:{type:`string`,multiple:!0},default:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing custom type.
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.
222
453
 
223
454
  USAGE
224
455
  prismic custom-type add-field select <type-id> <field-id> [flags]
@@ -227,20 +458,24 @@ ARGUMENTS
227
458
  type-id Custom type identifier (required)
228
459
  field-id Field identifier (required)
229
460
 
461
+ Types are generated by default after changes. Use --no-types to skip.
462
+
230
463
  FLAGS
231
464
  -t, --tab string Target tab (default: first existing tab, or "Main")
232
- -l, --label string Display label for the field
465
+ -l, --label string Display label for the field (inferred from field-id if omitted)
233
466
  -p, --placeholder string Placeholder text
234
467
  --option string Add an option (can be used multiple times)
235
468
  --default string Default selected value
469
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
470
+ --no-types Skip type generation
236
471
  -h, --help Show help for command
237
472
 
238
473
  EXAMPLES
239
474
  prismic custom-type add-field select homepage layout --option "full" --option "sidebar"
240
475
  prismic custom-type add-field select product size --option "small" --option "medium" --option "large" --default "medium"
241
- prismic custom-type add-field select article status --option "draft" --option "published" --label "Status"`);return}if(!l){console.error(`Missing required argument: type-id
242
- `),console.error(`Usage: prismic custom-type add-field select <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 select <type-id> <field-id>`),process.exitCode=1;return}let d=await L(`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=j(Ne,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:`Select`,config:{...i&&{label:i},...a&&{placeholder:a},...o&&o.length>0&&{options:o},...c&&{default_value:c}}};p.json[h][u]=g;try{await s(f,z(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}" (Select) to "${h}" tab in ${l}`)}const Fe=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Ie(){let{values:{help:t,tab:n,label:i,placeholder:a,default: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`},default:{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.
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.
244
479
 
245
480
  USAGE
246
481
  prismic custom-type add-field timestamp <type-id> <field-id> [flags]
@@ -249,19 +484,23 @@ ARGUMENTS
249
484
  type-id Custom type identifier (required)
250
485
  field-id Field identifier (required)
251
486
 
487
+ Types are generated by default after changes. Use --no-types to skip.
488
+
252
489
  FLAGS
253
490
  -t, --tab string Target tab (default: first existing tab, or "Main")
254
- -l, --label string Display label for the field
491
+ -l, --label string Display label for the field (inferred from field-id if omitted)
255
492
  -p, --placeholder string Placeholder text
256
493
  --default string Default timestamp value (ISO 8601 format)
494
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
495
+ --no-types Skip type generation
257
496
  -h, --help Show help for command
258
497
 
259
498
  EXAMPLES
260
499
  prismic custom-type add-field timestamp homepage event_time
261
500
  prismic custom-type add-field timestamp event start --tab "Schedule"
262
- prismic custom-type add-field timestamp article published_at --label "Published At"`);return}if(!c){console.error(`Missing required argument: type-id
263
- `),console.error(`Usage: prismic custom-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
264
- `),console.error(`Usage: prismic custom-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}let u=await L(`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=j(Fe,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:`Timestamp`,config:{...i&&{label:i},...a&&{placeholder:a},...o&&{default:o}}};f.json[m][l]=h;try{await s(d,z(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}" (Timestamp) to "${m}" tab in ${c}`)}const Le=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Re(){let{values:{help:t,tab:n,label:i,placeholder:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a UID (unique identifier) field to an existing custom type.
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.
265
504
 
266
505
  USAGE
267
506
  prismic custom-type add-field uid <type-id> <field-id> [flags]
@@ -270,18 +509,22 @@ ARGUMENTS
270
509
  type-id Custom type identifier (required)
271
510
  field-id Field identifier (required)
272
511
 
512
+ Types are generated by default after changes. Use --no-types to skip.
513
+
273
514
  FLAGS
274
515
  -t, --tab string Target tab (default: first existing tab, or "Main")
275
- -l, --label string Display label for the field
516
+ -l, --label string Display label for the field (inferred from field-id if omitted)
276
517
  -p, --placeholder string Placeholder text
518
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
519
+ --no-types Skip type generation
277
520
  -h, --help Show help for command
278
521
 
279
522
  EXAMPLES
280
523
  prismic custom-type add-field uid page uid
281
524
  prismic custom-type add-field uid article slug --label "URL Slug"
282
- prismic custom-type add-field uid product sku --placeholder "Enter unique SKU"`);return}if(!o){console.error(`Missing required argument: type-id
283
- `),console.error(`Usage: prismic custom-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
284
- `),console.error(`Usage: prismic custom-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}let l=await L(`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=j(Le,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:`UID`,config:{...i&&{label:i},...a&&{placeholder:a}}};d.json[p][c]=m;try{await s(u,z(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}" (UID) to "${p}" tab in ${o}`)}async function ze(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await me();break;case`color`:await ge();break;case`date`:await ve();break;case`embed`:await be();break;case`geo-point`:await Se();break;case`image`:await we();break;case`key-text`:await Ee();break;case`link`:await Oe();break;case`number`:await Ae();break;case`rich-text`:await Me();break;case`select`:await Pe();break;case`timestamp`:await Ie();break;case`uid`:await Re();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing custom type.
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.
285
528
 
286
529
  USAGE
287
530
  prismic custom-type add-field <field-type> <type-id> <field-id> [flags]
@@ -311,7 +554,7 @@ EXAMPLES
311
554
  prismic custom-type add-field key-text homepage meta_title --tab "SEO"
312
555
  prismic custom-type add-field link homepage button --allow-text
313
556
  prismic custom-type add-field rich-text homepage body --multi "paragraph,heading2,strong,em"
314
- prismic custom-type add-field select homepage layout --option "full" --option "sidebar"`)}}const B=E({id:k(),type:re(`SharedSlice`),name:k(),description:D(k()),variations:S(E({id:k(),name:k(),description:D(k()),docURL:D(k()),version:D(k()),imageUrl:D(k()),primary:D(O(k(),A())),items:D(O(k(),A()))}))});async function V(e){if(!await L(`package.json`))return{ok:!1,error:`Could not find project root (no package.json found)`};let t=await H(),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=j(B,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 H(){let e=await Ve(),t=await L(`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 R(new URL(`src`,n)))return new URL(`src/slices/`,n);case`nuxt`:if(await R(new URL(`app`,n)))return new URL(`app/slices/`,n);case`sveltekit`:return new URL(`src/slices/`,n)}return new URL(`slices/`,n)}const Be=E({dependencies:D(O(k(),k()))});async function Ve(){let e=await L(`package.json`);if(e)try{let t=await r(e,`utf8`),{dependencies:n={}}=ie(Be,JSON.parse(t));if(`next`in n)return`next`;if(`nuxt`in n)return`nuxt`;if(`@sveltejs/kit`in n)return`sveltekit`}catch{}}function U(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}const He=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Ue(){let{values:{help:t,"slice-zone":n},positionals:[i,a]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Connect a shared slice to a custom type's slice zone.
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.
315
558
 
316
559
  USAGE
317
560
  prismic custom-type connect-slice <type-id> <slice-id> [flags]
@@ -320,16 +563,20 @@ ARGUMENTS
320
563
  type-id Custom type identifier (required)
321
564
  slice-id Slice identifier (required)
322
565
 
566
+ Types are generated by default after changes. Use --no-types to skip.
567
+
323
568
  FLAGS
324
569
  -z, --slice-zone string Target slice zone field ID (default: "slices")
570
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
571
+ --no-types Skip type generation
325
572
  -h, --help Show help for command
326
573
 
327
574
  EXAMPLES
328
575
  prismic custom-type connect-slice homepage CallToAction
329
576
  prismic custom-type connect-slice homepage CallToAction --slice-zone slices
330
- prismic custom-type connect-slice article HeroSection -z body`);return}if(!i){console.error(`Missing required argument: type-id
331
- `),console.error(`Usage: prismic custom-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: slice-id
332
- `),console.error(`Usage: prismic custom-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}let o=await V(a);if(!o.ok){console.error(o.error),process.exitCode=1;return}let c=await L(`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=j(He,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: ${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}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){if(n){console.error(`Slice zone "${n}" not found in custom type "${i}"`),process.exitCode=1;return}let e=Object.keys(u.json)[0]??`Main`;u.json[e]||(u.json[e]={});let t={type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}};u.json[e][d]=t,f=t,p=d}if(f.config||={choices:{}},f.config.choices||(f.config.choices={}),a in f.config.choices){console.info(`Slice "${a}" is already connected to slice zone "${p}" in ${i}`);return}let m={type:`SharedSlice`};f.config.choices[a]=m;try{await s(l,z(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(`Connected slice "${a}" to slice zone "${p}" in ${i}`)}async function We(){let{values:{help:t,name:r,single:i},positionals:[a]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},single:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Create a new custom type in a Prismic repository.
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.
333
580
 
334
581
  USAGE
335
582
  prismic custom-type create <id> [flags]
@@ -337,13 +584,17 @@ USAGE
337
584
  ARGUMENTS
338
585
  id Custom type identifier (required)
339
586
 
587
+ Types are generated by default after changes. Use --no-types to skip.
588
+
340
589
  FLAGS
341
590
  -n, --name string Display name for the custom type
342
591
  --single Create as a singleton (non-repeatable) type
592
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
593
+ --no-types Skip type generation
343
594
  -h, --help Show help for command
344
595
 
345
596
  LEARN MORE
346
- Use \`prismic custom-type <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,label:r??Ge(a),repeatable:!i,status:!0,format:`custom`,json:{Main:{}}},c=await L(`package.json`);if(!c){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let l=new URL(`customtypes/`,c),u=new URL(a+`/`,l),d=new URL(`index.json`,u);try{await n(new URL(`.`,d),{recursive:!0}),await s(d,z(o))}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 ${d.href}`)}function Ge(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}const Ke=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function qe(){let{values:{help:t,"slice-zone":n},positionals:[i,a]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Disconnect a shared slice from a custom type's slice zone.
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.
347
598
 
348
599
  USAGE
349
600
  prismic custom-type disconnect-slice <type-id> <slice-id> [flags]
@@ -352,16 +603,20 @@ ARGUMENTS
352
603
  type-id Custom type identifier (required)
353
604
  slice-id Slice identifier (required)
354
605
 
606
+ Types are generated by default after changes. Use --no-types to skip.
607
+
355
608
  FLAGS
356
609
  -z, --slice-zone string Target slice zone field ID (default: "slices")
610
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
611
+ --no-types Skip type generation
357
612
  -h, --help Show help for command
358
613
 
359
614
  EXAMPLES
360
615
  prismic custom-type disconnect-slice homepage CallToAction
361
616
  prismic custom-type disconnect-slice homepage CallToAction --slice-zone slices
362
- prismic custom-type disconnect-slice article HeroSection -z body`);return}if(!i){console.error(`Missing required argument: type-id
363
- `),console.error(`Usage: prismic custom-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: slice-id
364
- `),console.error(`Usage: prismic custom-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}let o=await L(`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=j(Ke,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}let u=n??`slices`,d,f;for(let[,e]of Object.entries(l.json)){for(let[t,n]of Object.entries(e))if(n.type===`Slices`&&t===u){d=n,f=t;break}if(d)break}if(!d){console.error(`Slice zone "${u}" not found in custom type "${i}"`),process.exitCode=1;return}if(!d.config?.choices||!(a in d.config.choices)){console.error(`Slice "${a}" is not connected to slice zone "${f}" in ${i}`),process.exitCode=1;return}delete d.config.choices[a];try{await s(c,z(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(`Disconnected slice "${a}" from slice zone "${f}" in ${i}`)}const Je=E({id:k(),label:k(),repeatable:C(),status:C(),format:D(k()),json:O(k(),O(k(),A()))});async function Ye(){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.
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.
365
620
 
366
621
  USAGE
367
622
  prismic custom-type list [flags]
@@ -372,7 +627,7 @@ FLAGS
372
627
 
373
628
  EXAMPLES
374
629
  prismic custom-type list
375
- prismic custom-type list --json`);return}let a=await L(`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=j(Je,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 Xe=E({id:k(),label:k(),repeatable:C(),status:C(),format:D(k()),json:O(k(),O(k(),A()))});async function Ze(){let{values:{help:t,y:n},positionals:[i]}=e({args:process.argv.slice(4),options:{y:{type:`boolean`,short:`y`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a custom type from the project.
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.
376
631
 
377
632
  USAGE
378
633
  prismic custom-type remove <type-id> [flags]
@@ -380,14 +635,18 @@ USAGE
380
635
  ARGUMENTS
381
636
  type-id Custom type identifier (required)
382
637
 
638
+ Types are generated by default after changes. Use --no-types to skip.
639
+
383
640
  FLAGS
384
641
  -y Confirm removal
642
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
643
+ --no-types Skip type generation
385
644
  -h, --help Show help for command
386
645
 
387
646
  EXAMPLES
388
647
  prismic custom-type remove settings
389
- prismic custom-type remove settings -y`);return}if(!i){console.error(`Missing required argument: type-id
390
- `),console.error(`Usage: prismic custom-type remove <type-id>`),process.exitCode=1;return}let a=await L(`package.json`);if(!a){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let s=new URL(`customtypes/${i}/`,a),c=new URL(`index.json`,s),l;try{let e=await r(c,`utf8`),t=j(Xe,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}`),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}if(!n){console.error(`Refusing to remove custom type "${i}" (this will delete the entire directory).`),console.error(`Re-run with -y to confirm.`),process.exitCode=1;return}try{await o(s,{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 "${i}"`)}const Qe=E({id:k(),label:k(),repeatable:C(),status:C(),format:D(k()),json:O(k(),O(k(),A()))});async function $e(){let{values:{help:t,tab:n},positionals:[i,a]}=e({args:process.argv.slice(4),options:{tab:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a field from a custom type.
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.
391
650
 
392
651
  USAGE
393
652
  prismic custom-type remove-field <type-id> <field-id> [flags]
@@ -396,15 +655,19 @@ ARGUMENTS
396
655
  type-id Custom type identifier (required)
397
656
  field-id Field identifier (required)
398
657
 
658
+ Types are generated by default after changes. Use --no-types to skip.
659
+
399
660
  FLAGS
400
661
  --tab string Specific tab (searches all tabs if not specified)
662
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
663
+ --no-types Skip type generation
401
664
  -h, --help Show help for command
402
665
 
403
666
  EXAMPLES
404
667
  prismic custom-type remove-field settings title
405
- prismic custom-type remove-field settings description --tab "Content"`);return}if(!i){console.error(`Missing required argument: type-id
406
- `),console.error(`Usage: prismic custom-type remove-field <type-id> <field-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: field-id
407
- `),console.error(`Usage: prismic custom-type remove-field <type-id> <field-id>`),process.exitCode=1;return}let o=await L(`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=j(Qe,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}let u;if(n){if(!l.json[n]){console.error(`Tab "${n}" not found in custom type "${i}"`),console.error(`Available tabs: ${Object.keys(l.json).join(`, `)}`),process.exitCode=1;return}if(!(a in l.json[n])){console.error(`Field "${a}" not found in tab "${n}"`),process.exitCode=1;return}delete l.json[n][a],u=n}else{for(let[e,t]of Object.entries(l.json))if(a in t){delete t[a],u=e;break}if(!u){console.error(`Field "${a}" not found in any tab of custom type "${i}"`),process.exitCode=1;return}}try{await s(c,z(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(`Removed field "${a}" from tab "${u}" in custom type "${i}"`)}const et=E({id:k(),label:k(),repeatable:C(),status:C(),format:D(k()),json:O(k(),O(k(),A()))});async function tt(){let{values:{help:t},positionals:[n,i]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Change a custom type's display name (label).
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).
408
671
 
409
672
  USAGE
410
673
  prismic custom-type set-name <type-id> <new-name> [flags]
@@ -413,14 +676,18 @@ ARGUMENTS
413
676
  type-id Custom type identifier (required)
414
677
  new-name New display name (required)
415
678
 
679
+ Types are generated by default after changes. Use --no-types to skip.
680
+
416
681
  FLAGS
682
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
683
+ --no-types Skip type generation
417
684
  -h, --help Show help for command
418
685
 
419
686
  EXAMPLES
420
687
  prismic custom-type set-name settings "Site Settings"
421
- prismic custom-type set-name menu "Navigation Menu"`);return}if(!n){console.error(`Missing required argument: type-id
422
- `),console.error(`Usage: prismic custom-type set-name <type-id> <new-name>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: new-name
423
- `),console.error(`Usage: prismic custom-type set-name <type-id> <new-name>`),process.exitCode=1;return}let a=await L(`package.json`);if(!a){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let o=new URL(`customtypes/${n}/index.json`,a),c;try{let e=await r(o,`utf8`),t=j(et,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${o.href}`),process.exitCode=1;return}c=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${n}\n`),console.error(`Create it first with: prismic custom-type create ${n}`),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(c.format===`page`){console.error(`"${n}" is not a custom type (format: page)`),process.exitCode=1;return}c.label=i;try{await s(o,z(c))}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 "${n}" to "${i}"`)}const nt=E({id:k(),label:k(),repeatable:C(),status:C(),format:D(k()),json:O(k(),O(k(),A()))});async function rt(){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.
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.
424
691
 
425
692
  USAGE
426
693
  prismic custom-type view <type-id> [flags]
@@ -435,7 +702,7 @@ FLAGS
435
702
  EXAMPLES
436
703
  prismic custom-type view settings
437
704
  prismic custom-type view settings --json`);return}if(!i){console.error(`Missing required argument: type-id
438
- `),console.error(`Usage: prismic custom-type view <type-id>`),process.exitCode=1;return}let a=await L(`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=j(nt,JSON.parse(e));if(!t.success){console.error(`Invalid custom 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(`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(s.format===`page`){console.error(`"${i}" is not a custom type (format: page)`),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 it(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`create`:await We();break;case`list`:await Ye();break;case`view`:await rt();break;case`remove`:await Ze();break;case`set-name`:await tt();break;case`add-field`:await ze();break;case`remove-field`:await $e();break;case`connect-slice`:await Ue();break;case`disconnect-slice`:await qe();break;default:t&&(console.error(`Unknown custom-type subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage custom types in a Prismic repository.
705
+ `),console.error(`Usage: prismic custom-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(Nr,JSON.parse(e));if(!t.success){console.error(`Invalid custom 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(`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(s.format===`page`){console.error(`"${i}" is not a custom type (format: page)`),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 Fr(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`create`:await xr();break;case`list`:await Er();break;case`view`:await Pr();break;case`remove`:await Or();break;case`set-name`:await Mr();break;case`add-field`:await vr();break;case`remove-field`:await Ar();break;case`connect-slice`:await br();break;case`disconnect-slice`:await wr();break;default:t&&(console.error(`Unknown custom-type subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage custom types in a Prismic repository.
439
706
 
440
707
  USAGE
441
708
  prismic custom-type <command> [flags]
@@ -455,7 +722,7 @@ FLAGS
455
722
  -h, --help Show help for command
456
723
 
457
724
  LEARN MORE
458
- Use \`prismic custom-type <command> --help\` for more information about a command.`)}}const at=`prismic.config.json`,ot=E({repositoryName:k(),apiEndpoint:D(ae(k(),ee())),localSliceMachineSimulatorURL:D(ae(k(),ee())),libraries:D(S(k())),adapter:D(k()),labs:D(E({legacySliceUpgrader:D(C())}))});async function st(e,t=c(process.cwd())){let n=await dt(t);return n.ok?(await s(n.path,z(e)),{ok:!0,config:e}):n}async function W(e=c(process.cwd())){let t=await G(e);if(t.ok)return t.config.repositoryName}async function G(e=c(process.cwd())){let t=await ut(e);if(!t.ok)return t;try{let e=await r(t.path,`utf8`),n=j(ot,JSON.parse(e));return n.success?{ok:!0,config:n.output}:{ok:!1,error:new ct(n.issues)}}catch{return{ok:!1,error:new ct}}}var ct=class extends Error{issues;constructor(e=[]){super(`prismic.config.json is invalid.`),this.issues=e}};async function lt(e,t=c(process.cwd())){let n=await ut(t);if(!n.ok)return n;let r=await G(t);if(!r.ok)return r;let i={...r.config,...e};return await s(n.path,z(i)),{ok:!0,config:i}}async function ut(e=c(process.cwd())){let t=await L(at,{start:e,stop:`package.json`});return t?{ok:!0,path:t}:{ok:!1,error:new ft}}async function dt(e=c(process.cwd())){let t=await L(`package.json`,{start:e});return t?{ok:!0,path:new URL(at,t)}:{ok:!1,error:new pt}}var ft=class extends Error{message=`Could not find a prismic.config.json file.`},pt=class extends Error{message=`Could not find a package.json file.`};async function mt(){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.
725
+ 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.
459
726
 
460
727
  Use this command to connect an existing Prismic repository to your project.
461
728
  To create a new repository, use \`prismic repo create\` instead.
@@ -468,7 +735,7 @@ FLAGS
468
735
  -h, --help Show help for command
469
736
 
470
737
  LEARN MORE
471
- 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 G()).ok){console.error(`A prismic.config.json file already exists.`),process.exitCode=1;return}let n=await st({repositoryName:t.repo});if(!n.ok){n.error instanceof pt?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 K(e,t={}){let{credentials:n=`include`}=t,r=new Headers(t.headers);if(r.set(`Accept`,`application/json`),n===`include`){let e=await N();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:ie(t.schema,o)}}catch(e){if(b(e))return{ok:!1,value:o,error:e};throw e}}else if(a.status===401)return{ok:!1,value:o,error:new J(a)};else if(a.status===403)return{ok:!1,value:o,error:new q(a)};else return{ok:!1,value:o,error:new ht(a)}}var ht=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}},q=class extends ht{},J=class extends ht{};async function gt(){let{values:{help:t,name:n,repo:r=await W()},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.
738
+ 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.
472
739
 
473
740
  By default, this command reads the repository from prismic.config.json at the
474
741
  project root.
@@ -485,7 +752,7 @@ FLAGS
485
752
  -h, --help Show help for command
486
753
 
487
754
  LEARN MORE
488
- 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 M()){yt();return}let a=n?await vt(r,i,n):await _t(r,i);if(!a.ok){if(typeof a.value==`string`&&a.value.includes(`already existing languages`))return;a.error instanceof q?yt():(console.error(`Failed to add locale: ${z(a.value)}`),process.exitCode=1);return}console.info(`Locale added: ${i}`)}async function _t(e,t){return await K(new URL(`/app/settings/multilanguages`,await F(e)),{method:`POST`,body:{languages:[t]}})}async function vt(e,t,n){let[r,i]=t.split(`-`);return await K(new URL(`/app/settings/multilanguages/custom`,await F(e)),{method:`POST`,body:{lang:{label:n,id:r||t},region:{label:n,id:i||r||t}}})}function yt(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function bt(){let{values:{help:t,repo:n=await W(),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.
755
+ 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.
489
756
 
490
757
  By default, this command reads the repository from prismic.config.json at the
491
758
  project root.
@@ -499,7 +766,7 @@ FLAGS
499
766
  -h, --help Show help for command
500
767
 
501
768
  LEARN MORE
502
- 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 M()){Ct();return}let i=await St(n);if(!i.ok){i.error instanceof q?Ct():b(i.error)?(console.error(`Failed to list locales: Invalid response: ${z(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list locales: ${z(i.value)}`),process.exitCode=1);return}let a=i.value.results;if(r)console.info(z(a));else for(let e of a){let t=e.isMaster?` (default)`:``;console.info(`${e.id} ${e.label}${t}`)}}const xt=E({results:S(E({id:k(),label:k(),customName:w(k()),isMaster:C()}))});async function St(e){let t=new URL(`/locale/repository/locales`,await de());return t.searchParams.set(`repository`,e),await K(t,{schema:xt})}function Ct(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function wt(){let{values:{repo:t=await W(),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.
769
+ 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.
503
770
 
504
771
  By default, this command reads the repository from prismic.config.json at the
505
772
  project root.
@@ -515,7 +782,7 @@ FLAGS
515
782
  -h, --help Show help for command
516
783
 
517
784
  LEARN MORE
518
- 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 M()){Et();return}let i=await Tt(t,r);if(!i.ok){i.error instanceof q?Et():(console.error(`Failed to remove locale: ${z(i.value)}`),process.exitCode=1);return}console.info(`Removed locale: ${r}`)}async function Tt(e,t){let n=new URL(`/locale/repository/locales/${t}`,await de());return n.searchParams.set(`repository`,e),await K(n,{method:`DELETE`})}function Et(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Dt(){let{values:{help:t,repo:n=await W()},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.
785
+ 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.
519
786
 
520
787
  By default, this command reads the repository from prismic.config.json at the
521
788
  project root.
@@ -531,7 +798,7 @@ FLAGS
531
798
  -h, --help Show help for command
532
799
 
533
800
  LEARN MORE
534
- 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 M()){kt();return}let i=await St(n);if(!i.ok){i.error instanceof q?kt():b(i.error)?(console.error(`Failed to set default locale: Invalid response: ${z(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to set default locale: ${z(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 Ot(n,o);if(!s.ok){s.error instanceof q?kt():(console.error(`Failed to set default locale: ${z(s.value)}`),process.exitCode=1);return}console.info(`Default locale set: ${r}`)}async function Ot(e,t){let n=new URL(`/locale/repository/locales`,await de());return n.searchParams.set(`repository`,e),await K(n,{method:`POST`,body:{id:t.id,label:t.label,customName:t.customName,isMaster:!0}})}function kt(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function At(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`add`:await gt();break;case`list`:await bt();break;case`remove`:await wt();break;case`set-default`:await Dt();break;default:t&&(console.error(`Unknown locale subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage locales in a Prismic repository.
801
+ 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.
535
802
 
536
803
  USAGE
537
804
  prismic locale <command> [flags]
@@ -546,7 +813,7 @@ FLAGS
546
813
  -h, --help Show help for command
547
814
 
548
815
  LEARN MORE
549
- Use \`prismic locale <command> --help\` for more information about a command.`)}}async function jt(){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.
816
+ 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.
550
817
 
551
818
  USAGE
552
819
  prismic login [flags]
@@ -555,7 +822,7 @@ FLAGS
555
822
  -h, --help Show help for command
556
823
 
557
824
  LEARN MORE
558
- Use \`prismic <command> --help\` for more information about a command.`);return}return new Promise((e,t)=>{let n=d((t,i)=>{if(t.method===`OPTIONS`){i.writeHead(204,{"Access-Control-Allow-Origin":`*`,"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":`*`,"Content-Type":`application/json`}),i.end(JSON.stringify({error:`Invalid request`}));return}await ce(s),console.info(`Logged in to Prismic as ${o}`),i.writeHead(200,{"Access-Control-Allow-Origin":`*`,"Content-Type":`application/json`}),i.end(JSON.stringify({success:!0})),clearTimeout(r),n.close(),e()}catch{i.writeHead(400,{"Access-Control-Allow-Origin":`*`,"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);n.listen(0,`127.0.0.1`,()=>{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=Mt(i);console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${a}`),Nt(a)}),n.on(`error`,e=>{clearTimeout(r),t(e)})})}function Mt(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 Nt(e){u(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}async function Pt(){let{values:t}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}}});if(t.help){console.info(`Log out of Prismic.
825
+ 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.
559
826
 
560
827
  USAGE
561
828
  prismic logout [flags]
@@ -564,7 +831,7 @@ FLAGS
564
831
  -h, --help Show help for command
565
832
 
566
833
  LEARN MORE
567
- Use \`prismic <command> --help\` for more information about a command.`);return}await ue()?console.info(`Logged out of Prismic`):(console.error(`Logout failed. You can log out manually by deleting the file.`),process.exitCode=1)}const Ft=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function It(){let{values:{help:t,tab:n,label:i,default:a,"true-label":o,"false-label":c},positionals:[l,u]}=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`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a boolean (toggle) field to an existing page type.
834
+ 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,"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.
568
835
 
569
836
  USAGE
570
837
  prismic page-type add-field boolean <type-id> <field-id> [flags]
@@ -573,20 +840,24 @@ ARGUMENTS
573
840
  type-id Page type identifier (required)
574
841
  field-id Field identifier (required)
575
842
 
843
+ Types are generated by default after changes. Use --no-types to skip.
844
+
576
845
  FLAGS
577
846
  -t, --tab string Target tab (default: first existing tab, or "Main")
578
- -l, --label string Display label for the field
847
+ -l, --label string Display label for the field (inferred from field-id if omitted)
579
848
  --default Set default value to true
580
849
  --true-label string Label shown when toggle is on
581
850
  --false-label string Label shown when toggle is off
851
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
852
+ --no-types Skip type generation
582
853
  -h, --help Show help for command
583
854
 
584
855
  EXAMPLES
585
856
  prismic page-type add-field boolean homepage featured
586
857
  prismic page-type add-field boolean article published --default
587
- prismic page-type add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!l){console.error(`Missing required argument: type-id
588
- `),console.error(`Usage: prismic page-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
589
- `),console.error(`Usage: prismic page-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}let d=await L(`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=j(Ft,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:`Boolean`,config:{...i&&{label:i},...a&&{default_value:!0},...o&&{placeholder_true:o},...c&&{placeholder_false:c}}};p.json[h][u]=g;try{await s(f,z(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}" (Boolean) to "${h}" tab in ${l}`)}const Lt=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Rt(){let{values:{help:t,tab:n,label:i,placeholder:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing page type.
858
+ 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
859
+ `),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
860
+ `),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(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:`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 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,"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.
590
861
 
591
862
  USAGE
592
863
  prismic page-type add-field color <type-id> <field-id> [flags]
@@ -595,18 +866,22 @@ ARGUMENTS
595
866
  type-id Page type identifier (required)
596
867
  field-id Field identifier (required)
597
868
 
869
+ Types are generated by default after changes. Use --no-types to skip.
870
+
598
871
  FLAGS
599
872
  -t, --tab string Target tab (default: first existing tab, or "Main")
600
- -l, --label string Display label for the field
873
+ -l, --label string Display label for the field (inferred from field-id if omitted)
601
874
  -p, --placeholder string Placeholder text
875
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
876
+ --no-types Skip type generation
602
877
  -h, --help Show help for command
603
878
 
604
879
  EXAMPLES
605
880
  prismic page-type add-field color homepage bg_color
606
881
  prismic page-type add-field color homepage accent --tab "Design"
607
- prismic page-type add-field color homepage text_color --label "Text Color"`);return}if(!o){console.error(`Missing required argument: type-id
608
- `),console.error(`Usage: prismic page-type add-field color <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
609
- `),console.error(`Usage: prismic page-type add-field color <type-id> <field-id>`),process.exitCode=1;return}let l=await L(`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=j(Lt,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:`Color`,config:{...i&&{label:i},...a&&{placeholder:a}}};d.json[p][c]=m;try{await s(u,z(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}" (Color) to "${p}" tab in ${o}`)}const zt=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Bt(){let{values:{help:t,tab:n,label:i,placeholder:a,default: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`},default:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date field to an existing page type.
882
+ prismic page-type add-field color homepage text_color --label "Text Color"`);return}if(!l){console.error(`Missing required argument: type-id
883
+ `),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
884
+ `),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(gi,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 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,"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.
610
885
 
611
886
  USAGE
612
887
  prismic page-type add-field date <type-id> <field-id> [flags]
@@ -615,19 +890,23 @@ ARGUMENTS
615
890
  type-id Page type identifier (required)
616
891
  field-id Field identifier (required)
617
892
 
893
+ Types are generated by default after changes. Use --no-types to skip.
894
+
618
895
  FLAGS
619
896
  -t, --tab string Target tab (default: first existing tab, or "Main")
620
- -l, --label string Display label for the field
897
+ -l, --label string Display label for the field (inferred from field-id if omitted)
621
898
  -p, --placeholder string Placeholder text
622
899
  --default string Default date value (YYYY-MM-DD format)
900
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
901
+ --no-types Skip type generation
623
902
  -h, --help Show help for command
624
903
 
625
904
  EXAMPLES
626
905
  prismic page-type add-field date homepage publish_date
627
906
  prismic page-type add-field date event start_date --tab "Schedule"
628
- prismic page-type add-field date article date --label "Publication Date" --default "2024-01-01"`);return}if(!c){console.error(`Missing required argument: type-id
629
- `),console.error(`Usage: prismic page-type add-field date <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
630
- `),console.error(`Usage: prismic page-type add-field date <type-id> <field-id>`),process.exitCode=1;return}let u=await L(`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=j(zt,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:`Date`,config:{...i&&{label:i},...a&&{placeholder:a},...o&&{default:o}}};f.json[m][l]=h;try{await s(d,z(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}" (Date) to "${m}" tab in ${c}`)}const Vt=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Ht(){let{values:{help:t,tab:n,label:i,placeholder:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed field to an existing page type.
907
+ 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
908
+ `),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
909
+ `),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(vi,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 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,"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.
631
910
 
632
911
  USAGE
633
912
  prismic page-type add-field embed <type-id> <field-id> [flags]
@@ -636,18 +915,22 @@ ARGUMENTS
636
915
  type-id Page type identifier (required)
637
916
  field-id Field identifier (required)
638
917
 
918
+ Types are generated by default after changes. Use --no-types to skip.
919
+
639
920
  FLAGS
640
921
  -t, --tab string Target tab (default: first existing tab, or "Main")
641
- -l, --label string Display label for the field
922
+ -l, --label string Display label for the field (inferred from field-id if omitted)
642
923
  -p, --placeholder string Placeholder text
924
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
925
+ --no-types Skip type generation
643
926
  -h, --help Show help for command
644
927
 
645
928
  EXAMPLES
646
929
  prismic page-type add-field embed homepage video
647
930
  prismic page-type add-field embed homepage youtube --tab "Media"
648
- prismic page-type add-field embed homepage media --label "Media Embed"`);return}if(!o){console.error(`Missing required argument: type-id
649
- `),console.error(`Usage: prismic page-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
650
- `),console.error(`Usage: prismic page-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}let l=await L(`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=j(Vt,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:`Embed`,config:{...i&&{label:i},...a&&{placeholder:a}}};d.json[p][c]=m;try{await s(u,z(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}" (Embed) to "${p}" tab in ${o}`)}const Ut=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Wt(){let{values:{help:t,tab:n,label:i},positionals:[a,o]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geo-point (location) field to an existing page type.
931
+ prismic page-type add-field embed homepage media --label "Media Embed"`);return}if(!l){console.error(`Missing required argument: type-id
932
+ `),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
933
+ `),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(bi,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 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,"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.
651
934
 
652
935
  USAGE
653
936
  prismic page-type add-field geo-point <type-id> <field-id> [flags]
@@ -656,17 +939,21 @@ ARGUMENTS
656
939
  type-id Page type identifier (required)
657
940
  field-id Field identifier (required)
658
941
 
942
+ Types are generated by default after changes. Use --no-types to skip.
943
+
659
944
  FLAGS
660
945
  -t, --tab string Target tab (default: first existing tab, or "Main")
661
- -l, --label string Display label for the field
946
+ -l, --label string Display label for the field (inferred from field-id if omitted)
947
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
948
+ --no-types Skip type generation
662
949
  -h, --help Show help for command
663
950
 
664
951
  EXAMPLES
665
952
  prismic page-type add-field geo-point homepage location
666
953
  prismic page-type add-field geo-point store address --tab "Details"
667
- prismic page-type add-field geo-point event venue --label "Event Venue"`);return}if(!a){console.error(`Missing required argument: type-id
668
- `),console.error(`Usage: prismic page-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
669
- `),console.error(`Usage: prismic page-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}let c=await L(`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=j(Ut,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=Object.keys(u.json),f=n??d[0]??`Main`;u.json[f]||(u.json[f]={});for(let[e,t]of Object.entries(u.json))if(t[o]){console.error(`Field "${o}" already exists in tab "${e}"`),process.exitCode=1;return}let p={type:`GeoPoint`,config:{...i&&{label:i}}};u.json[f][o]=p;try{await s(l,z(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(`Added field "${o}" (GeoPoint) to "${f}" tab in ${a}`)}const Gt=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Kt(){let{values:{help:t,tab:n,label:i,placeholder:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing page type.
954
+ prismic page-type add-field geo-point event venue --label "Event Venue"`);return}if(!c){console.error(`Missing required argument: type-id
955
+ `),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
956
+ `),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(Si,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 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,"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.
670
957
 
671
958
  USAGE
672
959
  prismic page-type add-field image <type-id> <field-id> [flags]
@@ -675,18 +962,22 @@ ARGUMENTS
675
962
  type-id Page type identifier (required)
676
963
  field-id Field identifier (required)
677
964
 
965
+ Types are generated by default after changes. Use --no-types to skip.
966
+
678
967
  FLAGS
679
968
  -t, --tab string Target tab (default: first existing tab, or "Main")
680
- -l, --label string Display label for the field
969
+ -l, --label string Display label for the field (inferred from field-id if omitted)
681
970
  -p, --placeholder string Placeholder text
971
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
972
+ --no-types Skip type generation
682
973
  -h, --help Show help for command
683
974
 
684
975
  EXAMPLES
685
976
  prismic page-type add-field image homepage hero
686
977
  prismic page-type add-field image article thumbnail --tab "Media"
687
- prismic page-type add-field image product photo --label "Product Photo"`);return}if(!o){console.error(`Missing required argument: type-id
688
- `),console.error(`Usage: prismic page-type add-field image <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
689
- `),console.error(`Usage: prismic page-type add-field image <type-id> <field-id>`),process.exitCode=1;return}let l=await L(`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=j(Gt,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:`Image`,config:{...i&&{label:i},...a&&{placeholder:a}}};d.json[p][c]=m;try{await s(u,z(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}" (Image) to "${p}" tab in ${o}`)}const qt=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Jt(){let{values:{help:t,tab:n,label:i,placeholder:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing page type.
978
+ prismic page-type add-field image product photo --label "Product Photo"`);return}if(!l){console.error(`Missing required argument: type-id
979
+ `),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
980
+ `),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(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:`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 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 a key-text (single-line text) field to an existing page type.
690
981
 
691
982
  USAGE
692
983
  prismic page-type add-field key-text <type-id> <field-id> [flags]
@@ -695,18 +986,22 @@ ARGUMENTS
695
986
  type-id Page type identifier (required)
696
987
  field-id Field identifier (required)
697
988
 
989
+ Types are generated by default after changes. Use --no-types to skip.
990
+
698
991
  FLAGS
699
992
  -t, --tab string Target tab (default: first existing tab, or "Main")
700
- -l, --label string Display label for the field
993
+ -l, --label string Display label for the field (inferred from field-id if omitted)
701
994
  -p, --placeholder string Placeholder text
995
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
996
+ --no-types Skip type generation
702
997
  -h, --help Show help for command
703
998
 
704
999
  EXAMPLES
705
1000
  prismic page-type add-field key-text homepage title
706
1001
  prismic page-type add-field key-text homepage meta_title --tab "SEO"
707
- prismic page-type add-field key-text homepage subtitle --label "Subtitle" --placeholder "Enter subtitle"`);return}if(!o){console.error(`Missing required argument: type-id
708
- `),console.error(`Usage: prismic page-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
709
- `),console.error(`Usage: prismic page-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}let l=await L(`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=j(qt,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:`Text`,config:{...i&&{label:i},...a&&{placeholder:a}}};d.json[p][c]=m;try{await s(u,z(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}" (Text) to "${p}" tab in ${o}`)}const Yt=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Xt(){let{values:{help:t,tab:n,label:i,placeholder:a,variation:o,"allow-text":c,"allow-target-blank":l,repeatable: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`},variation:{type:`string`,multiple:!0},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing page type.
1002
+ prismic page-type add-field key-text homepage subtitle --label "Subtitle" --placeholder "Enter subtitle"`);return}if(!l){console.error(`Missing required argument: type-id
1003
+ `),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
1004
+ `),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(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:`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 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,"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.
710
1005
 
711
1006
  USAGE
712
1007
  prismic page-type add-field link <type-id> <field-id> [flags]
@@ -715,23 +1010,27 @@ ARGUMENTS
715
1010
  type-id Page type identifier (required)
716
1011
  field-id Field identifier (required)
717
1012
 
1013
+ Types are generated by default after changes. Use --no-types to skip.
1014
+
718
1015
  FLAGS
719
1016
  -t, --tab string Target tab (default: first existing tab, or "Main")
720
- -l, --label string Display label for the field
1017
+ -l, --label string Display label for the field (inferred from field-id if omitted)
721
1018
  -p, --placeholder string Placeholder text
722
1019
  --variation string Slice variations (can be used multiple times)
723
1020
  --allow-text Allow text with link
724
1021
  --allow-target-blank Allow opening link in new tab
725
1022
  --repeatable Allow multiple links
1023
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1024
+ --no-types Skip type generation
726
1025
  -h, --help Show help for command
727
1026
 
728
1027
  EXAMPLES
729
1028
  prismic page-type add-field link homepage button
730
1029
  prismic page-type add-field link homepage cta --allow-text
731
1030
  prismic page-type add-field link homepage cta --variation Primary --variation Secondary
732
- prismic page-type add-field link homepage links --repeatable`);return}if(!d){console.error(`Missing required argument: type-id
733
- `),console.error(`Usage: prismic page-type add-field link <type-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
734
- `),console.error(`Usage: prismic page-type add-field link <type-id> <field-id>`),process.exitCode=1;return}let p=await L(`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=j(Yt,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:`Link`,config:{...i&&{label:i},...a&&{placeholder:a},...o&&o.length>0&&{variants:o},...c&&{allowText:!0},...l&&{allowTargetBlank:!0},...u&&{repeat:!0}}};h.json[_][f]=v;try{await s(m,z(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}" (Link) to "${_}" tab in ${d}`)}const Zt=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function Qt(){let{values:{help:t,tab:n,label:i,placeholder:a,min:o,max:c,step: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`},min:{type:`string`},max:{type:`string`},step:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing page type.
1031
+ prismic page-type add-field link homepage links --repeatable`);return}if(!p){console.error(`Missing required argument: type-id
1032
+ `),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
1033
+ `),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(Oi,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 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,"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.
735
1034
 
736
1035
  USAGE
737
1036
  prismic page-type add-field number <type-id> <field-id> [flags]
@@ -740,21 +1039,25 @@ ARGUMENTS
740
1039
  type-id Page type identifier (required)
741
1040
  field-id Field identifier (required)
742
1041
 
1042
+ Types are generated by default after changes. Use --no-types to skip.
1043
+
743
1044
  FLAGS
744
1045
  -t, --tab string Target tab (default: first existing tab, or "Main")
745
- -l, --label string Display label for the field
1046
+ -l, --label string Display label for the field (inferred from field-id if omitted)
746
1047
  -p, --placeholder string Placeholder text
747
1048
  --min number Minimum value
748
1049
  --max number Maximum value
749
1050
  --step number Step increment
1051
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1052
+ --no-types Skip type generation
750
1053
  -h, --help Show help for command
751
1054
 
752
1055
  EXAMPLES
753
1056
  prismic page-type add-field number homepage price
754
1057
  prismic page-type add-field number product quantity --min 0 --max 100
755
- prismic page-type add-field number settings rating --min 1 --max 5 --step 1`);return}if(!u){console.error(`Missing required argument: type-id
756
- `),console.error(`Usage: prismic page-type add-field number <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
757
- `),console.error(`Usage: prismic page-type add-field number <type-id> <field-id>`),process.exitCode=1;return}let f=o===void 0?void 0:Number(o),p=c===void 0?void 0:Number(c),m=l===void 0?void 0:Number(l);if(o!==void 0&&Number.isNaN(f)){console.error(`Invalid --min value: must be a number`),process.exitCode=1;return}if(c!==void 0&&Number.isNaN(p)){console.error(`Invalid --max value: must be a number`),process.exitCode=1;return}if(l!==void 0&&Number.isNaN(m)){console.error(`Invalid --step value: must be a number`),process.exitCode=1;return}let h=await L(`package.json`);if(!h){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let g=new URL(`customtypes/${u}/index.json`,h),_;try{let e=await r(g,`utf8`),t=j(Zt,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: ${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 v=Object.keys(_.json),y=n??v[0]??`Main`;_.json[y]||(_.json[y]={});for(let[e,t]of Object.entries(_.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let b={type:`Number`,config:{...i&&{label:i},...a&&{placeholder:a},...f!==void 0&&{min:f},...p!==void 0&&{max:p},...m!==void 0&&{step:m}}};_.json[y][d]=b;try{await s(g,z(_))}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}" (Number) to "${y}" tab in ${u}`)}const $t=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function en(){let{values:{help:t,tab:n,label:i,placeholder:a,single:o,multi:c,"allow-target-blank":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`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing page type.
1058
+ prismic page-type add-field number settings rating --min 1 --max 5 --step 1`);return}if(!f){console.error(`Missing required argument: type-id
1059
+ `),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
1060
+ `),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(Ai,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 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,"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.
758
1061
 
759
1062
  USAGE
760
1063
  prismic page-type add-field rich-text <type-id> <field-id> [flags]
@@ -763,13 +1066,17 @@ ARGUMENTS
763
1066
  type-id Page type identifier (required)
764
1067
  field-id Field identifier (required)
765
1068
 
1069
+ Types are generated by default after changes. Use --no-types to skip.
1070
+
766
1071
  FLAGS
767
1072
  -t, --tab string Target tab (default: first existing tab, or "Main")
768
- -l, --label string Display label for the field
1073
+ -l, --label string Display label for the field (inferred from field-id if omitted)
769
1074
  -p, --placeholder string Placeholder text
770
1075
  --single string Allowed block types for single-line (comma-separated)
771
1076
  --multi string Allowed block types for multi-line (comma-separated)
772
1077
  --allow-target-blank Allow opening links in new tab
1078
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1079
+ --no-types Skip type generation
773
1080
  -h, --help Show help for command
774
1081
 
775
1082
  BLOCK TYPES
@@ -781,9 +1088,9 @@ EXAMPLES
781
1088
  prismic page-type add-field rich-text homepage body
782
1089
  prismic page-type add-field rich-text article content --multi "paragraph,heading2,heading3,strong,em,hyperlink"
783
1090
  prismic page-type add-field rich-text page tagline --single "heading1"
784
- prismic page-type add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!u){console.error(`Missing required argument: type-id
785
- `),console.error(`Usage: prismic page-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
786
- `),console.error(`Usage: prismic page-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}let f=await L(`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=j($t,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:`StructuredText`,config:{...i&&{label:i},...a&&{placeholder:a},...o&&{single:o},...c&&{multi:c},...l&&{allowTargetBlank:!0}}};m.json[g][d]=_;try{await s(p,z(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}" (StructuredText) to "${g}" tab in ${u}`)}const tn=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function nn(){let{values:{help:t,tab:n,label:i,placeholder:a,option:o,default: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`},option:{type:`string`,multiple:!0},default:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing page type.
1091
+ 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
1092
+ `),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
1093
+ `),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(Mi,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 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,"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.
787
1094
 
788
1095
  USAGE
789
1096
  prismic page-type add-field select <type-id> <field-id> [flags]
@@ -792,20 +1099,24 @@ ARGUMENTS
792
1099
  type-id Page type identifier (required)
793
1100
  field-id Field identifier (required)
794
1101
 
1102
+ Types are generated by default after changes. Use --no-types to skip.
1103
+
795
1104
  FLAGS
796
1105
  -t, --tab string Target tab (default: first existing tab, or "Main")
797
- -l, --label string Display label for the field
1106
+ -l, --label string Display label for the field (inferred from field-id if omitted)
798
1107
  -p, --placeholder string Placeholder text
799
1108
  --option string Add an option (can be used multiple times)
800
1109
  --default string Default selected value
1110
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1111
+ --no-types Skip type generation
801
1112
  -h, --help Show help for command
802
1113
 
803
1114
  EXAMPLES
804
1115
  prismic page-type add-field select homepage layout --option "full" --option "sidebar"
805
1116
  prismic page-type add-field select product size --option "small" --option "medium" --option "large" --default "medium"
806
- prismic page-type add-field select article status --option "draft" --option "published" --label "Status"`);return}if(!l){console.error(`Missing required argument: type-id
807
- `),console.error(`Usage: prismic page-type add-field select <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
808
- `),console.error(`Usage: prismic page-type add-field select <type-id> <field-id>`),process.exitCode=1;return}let d=await L(`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=j(tn,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:`Select`,config:{...i&&{label:i},...a&&{placeholder:a},...o&&o.length>0&&{options:o},...c&&{default_value:c}}};p.json[h][u]=g;try{await s(f,z(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}" (Select) to "${h}" tab in ${l}`)}const rn=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function an(){let{values:{help:t,tab:n,label:i,placeholder:a,default: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`},default:{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.
1117
+ prismic page-type add-field select article status --option "draft" --option "published" --label "Status"`);return}if(!d){console.error(`Missing required argument: type-id
1118
+ `),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
1119
+ `),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(Pi,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 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,"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.
809
1120
 
810
1121
  USAGE
811
1122
  prismic page-type add-field timestamp <type-id> <field-id> [flags]
@@ -814,19 +1125,23 @@ ARGUMENTS
814
1125
  type-id Page type identifier (required)
815
1126
  field-id Field identifier (required)
816
1127
 
1128
+ Types are generated by default after changes. Use --no-types to skip.
1129
+
817
1130
  FLAGS
818
1131
  -t, --tab string Target tab (default: first existing tab, or "Main")
819
- -l, --label string Display label for the field
1132
+ -l, --label string Display label for the field (inferred from field-id if omitted)
820
1133
  -p, --placeholder string Placeholder text
821
1134
  --default string Default timestamp value (ISO 8601 format)
1135
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1136
+ --no-types Skip type generation
822
1137
  -h, --help Show help for command
823
1138
 
824
1139
  EXAMPLES
825
1140
  prismic page-type add-field timestamp homepage event_time
826
1141
  prismic page-type add-field timestamp event start --tab "Schedule"
827
- prismic page-type add-field timestamp article published_at --label "Published At"`);return}if(!c){console.error(`Missing required argument: type-id
828
- `),console.error(`Usage: prismic page-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
829
- `),console.error(`Usage: prismic page-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}let u=await L(`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=j(rn,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:`Timestamp`,config:{...i&&{label:i},...a&&{placeholder:a},...o&&{default:o}}};f.json[m][l]=h;try{await s(d,z(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}" (Timestamp) to "${m}" tab in ${c}`)}const on=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function sn(){let{values:{help:t,tab:n,label:i,placeholder:a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a UID (unique identifier) field to an existing page type.
1142
+ prismic page-type add-field timestamp article published_at --label "Published At"`);return}if(!u){console.error(`Missing required argument: type-id
1143
+ `),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
1144
+ `),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(Ii,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 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,"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.
830
1145
 
831
1146
  USAGE
832
1147
  prismic page-type add-field uid <type-id> <field-id> [flags]
@@ -835,18 +1150,22 @@ ARGUMENTS
835
1150
  type-id Page type identifier (required)
836
1151
  field-id Field identifier (required)
837
1152
 
1153
+ Types are generated by default after changes. Use --no-types to skip.
1154
+
838
1155
  FLAGS
839
1156
  -t, --tab string Target tab (default: first existing tab, or "Main")
840
- -l, --label string Display label for the field
1157
+ -l, --label string Display label for the field (inferred from field-id if omitted)
841
1158
  -p, --placeholder string Placeholder text
1159
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1160
+ --no-types Skip type generation
842
1161
  -h, --help Show help for command
843
1162
 
844
1163
  EXAMPLES
845
1164
  prismic page-type add-field uid page uid
846
1165
  prismic page-type add-field uid article slug --label "URL Slug"
847
- prismic page-type add-field uid product sku --placeholder "Enter unique SKU"`);return}if(!o){console.error(`Missing required argument: type-id
848
- `),console.error(`Usage: prismic page-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
849
- `),console.error(`Usage: prismic page-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}let l=await L(`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=j(on,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:`UID`,config:{...i&&{label:i},...a&&{placeholder:a}}};d.json[p][c]=m;try{await s(u,z(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}" (UID) to "${p}" tab in ${o}`)}async function cn(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await It();break;case`color`:await Rt();break;case`date`:await Bt();break;case`embed`:await Ht();break;case`geo-point`:await Wt();break;case`image`:await Kt();break;case`key-text`:await Jt();break;case`link`:await Xt();break;case`number`:await Qt();break;case`rich-text`:await en();break;case`select`:await nn();break;case`timestamp`:await an();break;case`uid`:await sn();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing page type.
1166
+ prismic page-type add-field uid product sku --placeholder "Enter unique SKU"`);return}if(!l){console.error(`Missing required argument: type-id
1167
+ `),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
1168
+ `),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(Ri,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 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.
850
1169
 
851
1170
  USAGE
852
1171
  prismic page-type add-field <field-type> <type-id> <field-id> [flags]
@@ -876,7 +1195,7 @@ EXAMPLES
876
1195
  prismic page-type add-field key-text homepage meta_title --tab "SEO"
877
1196
  prismic page-type add-field link homepage button --allow-text
878
1197
  prismic page-type add-field rich-text homepage body --multi "paragraph,heading2,strong,em"
879
- prismic page-type add-field select homepage layout --option "full" --option "sidebar"`)}}const ln=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function un(){let{values:{help:t,"slice-zone":n},positionals:[i,a]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Connect a shared slice to a page type's slice zone.
1198
+ 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,"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.
880
1199
 
881
1200
  USAGE
882
1201
  prismic page-type connect-slice <type-id> <slice-id> [flags]
@@ -885,16 +1204,20 @@ ARGUMENTS
885
1204
  type-id Page type identifier (required)
886
1205
  slice-id Slice identifier (required)
887
1206
 
1207
+ Types are generated by default after changes. Use --no-types to skip.
1208
+
888
1209
  FLAGS
889
1210
  -z, --slice-zone string Target slice zone field ID (default: "slices")
1211
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1212
+ --no-types Skip type generation
890
1213
  -h, --help Show help for command
891
1214
 
892
1215
  EXAMPLES
893
1216
  prismic page-type connect-slice homepage CallToAction
894
1217
  prismic page-type connect-slice homepage CallToAction --slice-zone slices
895
- prismic page-type connect-slice article HeroSection -z body`);return}if(!i){console.error(`Missing required argument: type-id
896
- `),console.error(`Usage: prismic page-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: slice-id
897
- `),console.error(`Usage: prismic page-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}let o=await V(a);if(!o.ok){console.error(o.error),process.exitCode=1;return}let c=await L(`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=j(ln,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}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){if(n){console.error(`Slice zone "${n}" not found in page type "${i}"`),process.exitCode=1;return}let e=Object.keys(u.json)[0]??`Main`;u.json[e]||(u.json[e]={});let t={type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}};u.json[e][d]=t,f=t,p=d}if(f.config||={choices:{}},f.config.choices||(f.config.choices={}),a in f.config.choices){console.info(`Slice "${a}" is already connected to slice zone "${p}" in ${i}`);return}let m={type:`SharedSlice`};f.config.choices[a]=m;try{await s(l,z(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(`Connected slice "${a}" to slice zone "${p}" in ${i}`)}async function dn(){let{values:{help:t,name:r,single:i},positionals:[a]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},single:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Create a new page type in a Prismic repository.
1218
+ prismic page-type connect-slice article HeroSection -z body`);return}if(!o){console.error(`Missing required argument: type-id
1219
+ `),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
1220
+ `),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(Vi,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 Ui(){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.
898
1221
 
899
1222
  USAGE
900
1223
  prismic page-type create <id> [flags]
@@ -902,13 +1225,17 @@ USAGE
902
1225
  ARGUMENTS
903
1226
  id Page type identifier (required)
904
1227
 
1228
+ Types are generated by default after changes. Use --no-types to skip.
1229
+
905
1230
  FLAGS
906
1231
  -n, --name string Display name for the page type
907
1232
  --single Create as a singleton (non-repeatable) type
1233
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1234
+ --no-types Skip type generation
908
1235
  -h, --help Show help for command
909
1236
 
910
1237
  LEARN MORE
911
- Use \`prismic page-type <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,label:r??fn(a),repeatable:!i,status:!0,format:`page`,json:{Main:{},"SEO & Metadata":{}}},c=await L(`package.json`);if(!c){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let l=new URL(`customtypes/`,c),u=new URL(a+`/`,l),d=new URL(`index.json`,u);try{await n(new URL(`.`,d),{recursive:!0}),await s(d,z(o))}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 ${d.href}`)}function fn(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}const pn=E({id:k(),label:k(),repeatable:C(),status:C(),format:k(),json:O(k(),O(k(),A()))});async function mn(){let{values:{help:t,"slice-zone":n},positionals:[i,a]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Disconnect a shared slice from a page type's slice zone.
1238
+ 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??Wi(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 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,"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.
912
1239
 
913
1240
  USAGE
914
1241
  prismic page-type disconnect-slice <type-id> <slice-id> [flags]
@@ -917,16 +1244,20 @@ ARGUMENTS
917
1244
  type-id Page type identifier (required)
918
1245
  slice-id Slice identifier (required)
919
1246
 
1247
+ Types are generated by default after changes. Use --no-types to skip.
1248
+
920
1249
  FLAGS
921
1250
  -z, --slice-zone string Target slice zone field ID (default: "slices")
1251
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1252
+ --no-types Skip type generation
922
1253
  -h, --help Show help for command
923
1254
 
924
1255
  EXAMPLES
925
1256
  prismic page-type disconnect-slice homepage CallToAction
926
1257
  prismic page-type disconnect-slice homepage CallToAction --slice-zone slices
927
- prismic page-type disconnect-slice article HeroSection -z body`);return}if(!i){console.error(`Missing required argument: type-id
928
- `),console.error(`Usage: prismic page-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: slice-id
929
- `),console.error(`Usage: prismic page-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}let o=await L(`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=j(pn,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}let u=n??`slices`,d,f;for(let[,e]of Object.entries(l.json)){for(let[t,n]of Object.entries(e))if(n.type===`Slices`&&t===u){d=n,f=t;break}if(d)break}if(!d){console.error(`Slice zone "${u}" not found in page type "${i}"`),process.exitCode=1;return}if(!d.config?.choices||!(a in d.config.choices)){console.error(`Slice "${a}" is not connected to slice zone "${f}" in ${i}`),process.exitCode=1;return}delete d.config.choices[a];try{await s(c,z(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(`Disconnected slice "${a}" from slice zone "${f}" in ${i}`)}const hn=E({id:k(),label:k(),repeatable:C(),status:C(),format:D(k()),json:O(k(),O(k(),A()))});async function gn(){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.
1258
+ prismic page-type disconnect-slice article HeroSection -z body`);return}if(!o){console.error(`Missing required argument: type-id
1259
+ `),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
1260
+ `),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(Gi,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 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.
930
1261
 
931
1262
  USAGE
932
1263
  prismic page-type list [flags]
@@ -937,7 +1268,7 @@ FLAGS
937
1268
 
938
1269
  EXAMPLES
939
1270
  prismic page-type list
940
- prismic page-type list --json`);return}let a=await L(`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=j(hn,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 _n=E({id:k(),label:k(),repeatable:C(),status:C(),format:D(k()),json:O(k(),O(k(),A()))});async function vn(){let{values:{help:t,y:n},positionals:[i]}=e({args:process.argv.slice(4),options:{y:{type:`boolean`,short:`y`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a page type from the project.
1271
+ 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,"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.
941
1272
 
942
1273
  USAGE
943
1274
  prismic page-type remove <type-id> [flags]
@@ -945,14 +1276,18 @@ USAGE
945
1276
  ARGUMENTS
946
1277
  type-id Page type identifier (required)
947
1278
 
1279
+ Types are generated by default after changes. Use --no-types to skip.
1280
+
948
1281
  FLAGS
949
1282
  -y Confirm removal
1283
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1284
+ --no-types Skip type generation
950
1285
  -h, --help Show help for command
951
1286
 
952
1287
  EXAMPLES
953
1288
  prismic page-type remove homepage
954
- prismic page-type remove homepage -y`);return}if(!i){console.error(`Missing required argument: type-id
955
- `),console.error(`Usage: prismic page-type remove <type-id>`),process.exitCode=1;return}let a=await L(`package.json`);if(!a){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let s=new URL(`customtypes/${i}/`,a),c=new URL(`index.json`,s),l;try{let e=await r(c,`utf8`),t=j(_n,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}`),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}if(!n){console.error(`Refusing to remove page type "${i}" (this will delete the entire directory).`),console.error(`Re-run with -y to confirm.`),process.exitCode=1;return}try{await o(s,{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 "${i}"`)}const yn=E({id:k(),label:k(),repeatable:C(),status:C(),format:D(k()),json:O(k(),O(k(),A()))});async function bn(){let{values:{help:t,tab:n},positionals:[i,a]}=e({args:process.argv.slice(4),options:{tab:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a field from a page type.
1289
+ prismic page-type remove homepage -y`);return}if(!s){console.error(`Missing required argument: type-id
1290
+ `),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(Yi,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 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,"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.
956
1291
 
957
1292
  USAGE
958
1293
  prismic page-type remove-field <type-id> <field-id> [flags]
@@ -961,15 +1296,19 @@ ARGUMENTS
961
1296
  type-id Page type identifier (required)
962
1297
  field-id Field identifier (required)
963
1298
 
1299
+ Types are generated by default after changes. Use --no-types to skip.
1300
+
964
1301
  FLAGS
965
1302
  --tab string Specific tab (searches all tabs if not specified)
1303
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1304
+ --no-types Skip type generation
966
1305
  -h, --help Show help for command
967
1306
 
968
1307
  EXAMPLES
969
1308
  prismic page-type remove-field homepage title
970
- prismic page-type remove-field homepage meta_title --tab "SEO & Metadata"`);return}if(!i){console.error(`Missing required argument: type-id
971
- `),console.error(`Usage: prismic page-type remove-field <type-id> <field-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: field-id
972
- `),console.error(`Usage: prismic page-type remove-field <type-id> <field-id>`),process.exitCode=1;return}let o=await L(`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=j(yn,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}let u;if(n){if(!l.json[n]){console.error(`Tab "${n}" not found in page type "${i}"`),console.error(`Available tabs: ${Object.keys(l.json).join(`, `)}`),process.exitCode=1;return}if(!(a in l.json[n])){console.error(`Field "${a}" not found in tab "${n}"`),process.exitCode=1;return}delete l.json[n][a],u=n}else{for(let[e,t]of Object.entries(l.json))if(a in t){delete t[a],u=e;break}if(!u){console.error(`Field "${a}" not found in any tab of page type "${i}"`),process.exitCode=1;return}}try{await s(c,z(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(`Removed field "${a}" from tab "${u}" in page type "${i}"`)}const xn=E({id:k(),label:k(),repeatable:C(),status:C(),format:D(k()),json:O(k(),O(k(),A()))});async function Sn(){let{values:{help:t},positionals:[n,i]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Change a page type's display name (label).
1309
+ prismic page-type remove-field homepage meta_title --tab "SEO & Metadata"`);return}if(!o){console.error(`Missing required argument: type-id
1310
+ `),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
1311
+ `),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(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}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 $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,"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).
973
1312
 
974
1313
  USAGE
975
1314
  prismic page-type set-name <type-id> <new-name> [flags]
@@ -978,14 +1317,18 @@ ARGUMENTS
978
1317
  type-id Page type identifier (required)
979
1318
  new-name New display name (required)
980
1319
 
1320
+ Types are generated by default after changes. Use --no-types to skip.
1321
+
981
1322
  FLAGS
1323
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1324
+ --no-types Skip type generation
982
1325
  -h, --help Show help for command
983
1326
 
984
1327
  EXAMPLES
985
1328
  prismic page-type set-name homepage "Home Page"
986
- prismic page-type set-name blog_post "Blog Post"`);return}if(!n){console.error(`Missing required argument: type-id
987
- `),console.error(`Usage: prismic page-type set-name <type-id> <new-name>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: new-name
988
- `),console.error(`Usage: prismic page-type set-name <type-id> <new-name>`),process.exitCode=1;return}let a=await L(`package.json`);if(!a){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let o=new URL(`customtypes/${n}/index.json`,a),c;try{let e=await r(o,`utf8`),t=j(xn,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${o.href}`),process.exitCode=1;return}c=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${n}\n`),console.error(`Create it first with: prismic page-type create ${n}`),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(c.format!==`page`){console.error(`"${n}" is not a page type (format: ${c.format??`custom`})`),process.exitCode=1;return}c.label=i;try{await s(o,z(c))}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 "${n}" to "${i}"`)}const Cn=E({id:k(),label:k(),repeatable:C(),status:C(),format:D(k()),json:O(k(),O(k(),A()))});async function wn(){let{values:{help:t},positionals:[n,i]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set whether a page type is repeatable.
1329
+ prismic page-type set-name blog_post "Blog Post"`);return}if(!a){console.error(`Missing required argument: type-id
1330
+ `),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
1331
+ `),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($i,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 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,"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.
989
1332
 
990
1333
  USAGE
991
1334
  prismic page-type set-repeatable <type-id> <true|false> [flags]
@@ -994,14 +1337,18 @@ ARGUMENTS
994
1337
  type-id Page type identifier (required)
995
1338
  true|false Repeatable value (required)
996
1339
 
1340
+ Types are generated by default after changes. Use --no-types to skip.
1341
+
997
1342
  FLAGS
1343
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1344
+ --no-types Skip type generation
998
1345
  -h, --help Show help for command
999
1346
 
1000
1347
  EXAMPLES
1001
1348
  prismic page-type set-repeatable homepage true
1002
- prismic page-type set-repeatable settings false`);return}if(!n){console.error(`Missing required argument: type-id
1003
- `),console.error(`Usage: prismic page-type set-repeatable <type-id> <true|false>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: true|false
1004
- `),console.error(`Usage: prismic page-type set-repeatable <type-id> <true|false>`),process.exitCode=1;return}if(i!==`true`&&i!==`false`){console.error(`Invalid value: "${i}". Must be "true" or "false".`),process.exitCode=1;return}let a=i===`true`,o=await L(`package.json`);if(!o){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let c=new URL(`customtypes/${n}/index.json`,o),l;try{let e=await r(c,`utf8`),t=j(Cn,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: ${n}\n`),console.error(`Create it first with: prismic page-type create ${n}`),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(`"${n}" is not a page type (format: ${l.format??`custom`})`),process.exitCode=1;return}l.repeatable=a;try{await s(c,z(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}let u=a?`repeatable`:`singleton`;console.info(`Set page type "${n}" to ${u}`)}const Tn=E({id:k(),label:k(),repeatable:C(),status:C(),format:D(k()),json:O(k(),O(k(),A()))});async function En(){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.
1349
+ prismic page-type set-repeatable settings false`);return}if(!a){console.error(`Missing required argument: type-id
1350
+ `),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
1351
+ `),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(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: ${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 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.
1005
1352
 
1006
1353
  USAGE
1007
1354
  prismic page-type view <type-id> [flags]
@@ -1016,7 +1363,7 @@ FLAGS
1016
1363
  EXAMPLES
1017
1364
  prismic page-type view homepage
1018
1365
  prismic page-type view homepage --json`);return}if(!i){console.error(`Missing required argument: type-id
1019
- `),console.error(`Usage: prismic page-type view <type-id>`),process.exitCode=1;return}let a=await L(`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=j(Tn,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 Dn(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`create`:await dn();break;case`list`:await gn();break;case`view`:await En();break;case`remove`:await vn();break;case`set-name`:await Sn();break;case`set-repeatable`:await wn();break;case`add-field`:await cn();break;case`remove-field`:await bn();break;case`connect-slice`:await un();break;case`disconnect-slice`:await mn();break;default:t&&(console.error(`Unknown page-type subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage page types in a Prismic repository.
1366
+ `),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.
1020
1367
 
1021
1368
  USAGE
1022
1369
  prismic page-type <command> [flags]
@@ -1037,7 +1384,7 @@ FLAGS
1037
1384
  -h, --help Show help for command
1038
1385
 
1039
1386
  LEARN MORE
1040
- Use \`prismic page-type <command> --help\` for more information about a command.`)}}async function On(){let{values:{help:t,name:n,repo:r=await W()},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.
1387
+ 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.
1041
1388
 
1042
1389
  By default, this command reads the repository from prismic.config.json at the
1043
1390
  project root.
@@ -1054,7 +1401,21 @@ FLAGS
1054
1401
  -h, --help Show help for command
1055
1402
 
1056
1403
  LEARN MORE
1057
- 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 M()){jn();return}let a=kn(i);if(!a){console.error(`Invalid URL: ${i}`),process.exitCode=1;return}let o=await An(r,{name:n||a.hostname,websiteURL:a.websiteURL,resolverPath:a.resolverPath});if(!o.ok){o.error instanceof q?jn():(console.error(`Failed to add preview: ${z(o.value)}`),process.exitCode=1);return}console.info(`Preview added: ${i}`)}function kn(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 An(e,t){return await K(new URL(`/previews/new`,await F(e)),{method:`POST`,body:{name:t.name,websiteURL:t.websiteURL,resolverPath:t.resolverPath}})}function jn(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Mn(){let{values:{help:t,repo:n=await W(),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.
1404
+ 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.
1405
+
1406
+ By default, this command reads the repository from prismic.config.json at the
1407
+ project root.
1408
+
1409
+ USAGE
1410
+ prismic preview get-simulator [flags]
1411
+
1412
+ FLAGS
1413
+ --json Output as JSON
1414
+ -r, --repo string Repository domain
1415
+ -h, --help Show help for command
1416
+
1417
+ LEARN MORE
1418
+ 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.
1058
1419
 
1059
1420
  By default, this command reads the repository from prismic.config.json at the
1060
1421
  project root.
@@ -1068,7 +1429,7 @@ FLAGS
1068
1429
  -h, --help Show help for command
1069
1430
 
1070
1431
  LEARN MORE
1071
- 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 M()){Fn();return}let i=await Pn(n);if(!i.ok){i.error instanceof q?Fn():b(i.error)?(console.error(`Failed to list previews: Invalid response: ${z(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list previews: ${z(i.value)}`),process.exitCode=1);return}let a=i.value.results;if(r)console.info(z(a));else for(let e of a)console.info(`${e.url} ${e.label}`)}const Nn=E({results:S(E({id:k(),label:k(),url:k()}))});async function Pn(e){return await K(new URL(`/core/repository/preview_configs`,await F(e)),{schema:Nn})}function Fn(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function In(){let{values:{help:t,repo:n=await W()},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.
1432
+ 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.
1072
1433
 
1073
1434
  By default, this command reads the repository from prismic.config.json at the
1074
1435
  project root.
@@ -1084,7 +1445,20 @@ FLAGS
1084
1445
  -h, --help Show help for command
1085
1446
 
1086
1447
  LEARN MORE
1087
- 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 M()){Rn();return}let i=await Pn(n);if(!i.ok){i.error instanceof q?Rn():(console.error(`Failed to fetch previews: ${z(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 Ln(n,a.id);if(!o.ok){o.error instanceof q?Rn():(console.error(`Failed to remove preview: ${z(o.value)}`),process.exitCode=1);return}console.info(`Preview removed: ${r}`)}async function Ln(e,t){return await K(new URL(`/previews/delete/${t}`,await F(e)),{method:`POST`,body:{}})}function Rn(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function zn(){let{values:{help:t,repo:n=await W()},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.
1448
+ 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.
1449
+
1450
+ By default, this command reads the repository from prismic.config.json at the
1451
+ project root.
1452
+
1453
+ USAGE
1454
+ prismic preview remove-simulator [flags]
1455
+
1456
+ FLAGS
1457
+ -r, --repo string Repository domain
1458
+ -h, --help Show help for command
1459
+
1460
+ LEARN MORE
1461
+ 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.
1088
1462
 
1089
1463
  By default, this command reads the repository from prismic.config.json at the
1090
1464
  project root.
@@ -1101,22 +1475,48 @@ FLAGS
1101
1475
  -h, --help Show help for command
1102
1476
 
1103
1477
  LEARN MORE
1104
- 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 M()){Vn();return}let a=kn(r);if(!a){console.error(`Invalid URL: ${r}`),process.exitCode=1;return}let o=await Pn(n);if(!o.ok){o.error instanceof q?Vn():(console.error(`Failed to fetch previews: ${z(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 Bn(n,s.id,{name:i,websiteURL:a.websiteURL,resolverPath:a.resolverPath});if(!c.ok){c.error instanceof q?Vn():(console.error(`Failed to update preview: ${z(c.value)}`),process.exitCode=1);return}console.info(`Preview updated: ${r}`)}async function Bn(e,t,n){return await K(new URL(`/previews/save/${t}`,await F(e)),{method:`POST`,body:{name:n.name,websiteURL:n.websiteURL,resolverPath:n.resolverPath}})}function Vn(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Hn(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`add`:await On();break;case`list`:await Mn();break;case`remove`:await In();break;case`set-name`:await zn();break;default:t&&(console.error(`Unknown preview subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage preview configurations in a Prismic repository.
1478
+ 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.
1479
+
1480
+ If the URL pathname does not end with /slice-simulator, it is appended
1481
+ automatically.
1482
+
1483
+ By default, this command reads the repository from prismic.config.json at the
1484
+ project root.
1485
+
1486
+ USAGE
1487
+ prismic preview set-simulator <url> [flags]
1488
+
1489
+ ARGUMENTS
1490
+ <url> Simulator URL (e.g. https://example.com/slice-simulator)
1491
+
1492
+ FLAGS
1493
+ -r, --repo string Repository domain
1494
+ -h, --help Show help for command
1495
+
1496
+ EXAMPLES
1497
+ prismic preview set-simulator https://my-site.com
1498
+ prismic preview set-simulator http://localhost:3000/slice-simulator
1499
+
1500
+ LEARN MORE
1501
+ 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.
1105
1502
 
1106
1503
  USAGE
1107
1504
  prismic preview <command> [flags]
1108
1505
 
1109
1506
  COMMANDS
1110
- add Add a preview configuration
1111
- list List preview configurations
1112
- remove Remove a preview configuration
1113
- set-name Update a preview's name
1507
+ add Add a preview configuration
1508
+ list List preview configurations
1509
+ remove Remove a preview configuration
1510
+ set-name Update a preview's name
1511
+ set-simulator Set the slice simulator URL
1512
+ get-simulator Show the slice simulator URL
1513
+ remove-simulator Remove the slice simulator URL
1114
1514
 
1115
1515
  FLAGS
1116
1516
  -h, --help Show help for command
1117
1517
 
1118
1518
  LEARN MORE
1119
- Use \`prismic preview <command> --help\` for more information about a command.`)}}const Un=E({id:k(),label:D(k()),repeatable:C(),status:C(),format:D(k()),json:O(k(),A())});async function Y(){let e=await P();return e.hostname=`customtypes.${e.hostname}`,e}async function Wn(e){let t=await N();if(!t)return{ok:!1,error:`Not authenticated`};let n=await Y(),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=j(S(Un),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 Gn(e){let t=await N();if(!t)return{ok:!1,error:`Not authenticated`};let n=await Y(),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=j(S(B),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 Kn(){let e=await L(`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=j(Un,JSON.parse(e));n.success&&o.push(n.output)}catch{}}return{ok:!0,value:o}}async function qn(){let e;try{e=await H()}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=j(B,JSON.parse(e));i.success&&n.push(i.output)}catch{}}return{ok:!0,value:n}}async function Jn(e,t){let n=await N();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Y(),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 Yn(e,t){let n=await N();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Y(),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 Xn(e,t){let n=await N();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Y(),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 Zn(e,t){let n=await N();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Y(),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 Qn(e,t){let n=await N();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Y(),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 $n(e,t){let n=await N();if(!n)return{ok:!1,error:`Not authenticated`};let r=await Y(),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 er(){let{values:{help:t,repo:r=await W(),"dry-run":i,"types-only":a,"slices-only":o,json:c}}=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`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Pull custom types and slices from Prismic to local files.
1519
+ 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,"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.
1120
1520
 
1121
1521
  By default, this command reads the repository from prismic.config.json at the
1122
1522
  project root.
@@ -1124,21 +1524,25 @@ project root.
1124
1524
  USAGE
1125
1525
  prismic pull [flags]
1126
1526
 
1527
+ Types are generated by default after changes. Use --no-types to skip.
1528
+
1127
1529
  FLAGS
1128
1530
  -r, --repo string Repository domain
1129
1531
  --dry-run Show what would be pulled without writing files
1130
1532
  --types-only Only pull custom types
1131
1533
  --slices-only Only pull slices
1132
1534
  --json Output as JSON
1535
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1536
+ --no-types Skip type generation
1133
1537
  -h, --help Show help for command
1134
1538
 
1135
1539
  EXAMPLES
1136
1540
  prismic pull
1137
1541
  prismic pull --repo my-repo
1138
1542
  prismic pull --dry-run
1139
- prismic pull --types-only`);return}if(!r){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await M()){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1;return}c||console.info(`Pulling from repository: ${r}\n`);let l=!o,u=!a,[d,f]=await Promise.all([l?Wn(r):Promise.resolve({ok:!0,value:[]}),u?Gn(r):Promise.resolve({ok:!0,value:[]})]);if(!d.ok){console.error(`Failed to fetch custom types: ${d.error}`),process.exitCode=1;return}if(!f.ok){console.error(`Failed to fetch slices: ${f.error}`),process.exitCode=1;return}let p=d.value,m=f.value;if(c||(l&&console.info(`Fetching custom types... ${p.length} types`),u&&console.info(`Fetching slices... ${m.length} slices`)),i){if(c)console.info(z({customTypes:p,slices:m}));else{if(console.info(``),l&&p.length>0){console.info(`Would write custom types:`);for(let e of p)console.info(` customtypes/${e.id}/index.json`)}if(u&&m.length>0){let e=tr(await H());console.info(`Would write slices:`);for(let t of m)console.info(` ${e}${U(t.name)}/model.json`)}console.info(`\nDry run complete: ${p.length} custom types, ${m.length} slices`)}return}let h=await L(`package.json`);if(!h){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let g=new URL(`.`,h),_=[],v=[];if(l&&p.length>0){c||console.info(`
1140
- Writing custom types:`);let e=new URL(`customtypes/`,g);for(let t of p){let r=new URL(`${t.id}/`,e),i=new URL(`index.json`,r);try{await n(r,{recursive:!0}),await s(i,z(t));let e=`customtypes/${t.id}/index.json`;_.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(u&&m.length>0){c||console.info(`
1141
- Writing slices:`);let e=await H();for(let t of m){let r=new URL(`${U(t.name)}/`,e),i=new URL(`model.json`,r);try{await n(r,{recursive:!0}),await s(i,z(t));let a=`${tr(e)}${U(t.name)}/model.json`;v.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}}}c?console.info(z({writtenTypes:_,writtenSlices:v})):console.info(`\nPull complete: ${_.length} custom types, ${v.length} slices`)}function tr(e){let t=process.cwd(),n=e.pathname;return n.startsWith(t)?n.slice(t.length+1):n}function nr(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 rr(){let{values:{help:t,repo:n=await W(),"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.
1543
+ 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=Na(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(`
1544
+ 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(`
1545
+ 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=`${Na(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 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.
1142
1546
 
1143
1547
  By default, this command reads the repository from prismic.config.json at the
1144
1548
  project root.
@@ -1160,10 +1564,10 @@ EXAMPLES
1160
1564
  prismic push --repo my-repo
1161
1565
  prismic push --dry-run
1162
1566
  prismic push --types-only
1163
- prismic push --delete`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await M()){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?Kn():Promise.resolve({ok:!0,value:[]}),l?qn():Promise.resolve({ok:!0,value:[]}),c?Wn(n):Promise.resolve({ok:!0,value:[]}),l?Gn(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?nr([...m],[...g]):{toInsert:[],toUpdate:[],toDelete:[]},y=l?nr([...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(z({customTypes:{inserted:[],updated:[],deleted:[]},slices:{inserted:[],updated:[],deleted:[]}})):console.info(`
1164
- No changes to push.`);return}if(r){if(s)console.info(z({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(`
1165
- Pushing custom types:`);for(let e of v.toInsert){let t=await Jn(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 Yn(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 Xn(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(`
1166
- Pushing slices:`);for(let e of y.toInsert){let t=await Zn(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 Qn(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 $n(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(z(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 ir=/^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$/;async function ar(){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.
1567
+ 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(`
1568
+ 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(`
1569
+ 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(`
1570
+ 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.
1167
1571
 
1168
1572
  Creates prismic.config.json in the current directory. If a config file already
1169
1573
  exists, use --replace to update it with the new repository.
@@ -1182,7 +1586,20 @@ FLAGS
1182
1586
  -h, --help Show help for command
1183
1587
 
1184
1588
  LEARN MORE
1185
- 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(!ir.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 M()){sr();return}let o=await G();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 or(a,n);if(!s.ok){s.error instanceof q?sr():(console.error(`Failed to create repository: ${z(s.error)}`),process.exitCode=1);return}if(!r)if(o.ok){let e=await lt({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 st({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 F(a)}`)}async function or(e,t=e){return await K(new URL(`/app/dashboard/repositories`,await P()),{method:`POST`,body:{domain:e,name:t,framework:`next`,plan:`personal`,usageIntent:`Exploring Prismic's features for future projects.`,usageIntentIndex:0}})}function sr(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const cr=E({repositories:S(E({domain:k(),name:D(k()),role:k()}))});async function lr(){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.
1589
+ 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.
1590
+
1591
+ By default, this command reads the repository from prismic.config.json at the
1592
+ project root.
1593
+
1594
+ USAGE
1595
+ prismic repo get-access [flags]
1596
+
1597
+ FLAGS
1598
+ -r, --repo string Repository domain
1599
+ -h, --help Show help for command
1600
+
1601
+ LEARN MORE
1602
+ 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.
1186
1603
 
1187
1604
  USAGE
1188
1605
  prismic repo list [flags]
@@ -1192,7 +1609,23 @@ FLAGS
1192
1609
  -h, --help Show help for command
1193
1610
 
1194
1611
  LEARN MORE
1195
- Use \`prismic repo <command> --help\` for more information about a command.`);return}if(!await M()){dr();return}let r=await ur();if(!r.ok){r.error instanceof q?dr():(console.error(`Failed to fetch repositories: ${z(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 F(e.domain)).toString()})));console.info(z(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 ur(){return await K(new URL(`profile`,await fe()),{schema:cr})}function dr(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function fr(){let{values:{help:t,repo:n=await W()},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.
1612
+ 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.
1613
+
1614
+ By default, this command reads the repository from prismic.config.json at the
1615
+ project root.
1616
+
1617
+ USAGE
1618
+ prismic repo set-access <level> [flags]
1619
+
1620
+ ARGUMENTS
1621
+ <level> The access level to set (private, public, open)
1622
+
1623
+ FLAGS
1624
+ -r, --repo string Repository domain
1625
+ -h, --help Show help for command
1626
+
1627
+ LEARN MORE
1628
+ 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.
1196
1629
 
1197
1630
  By default, this command reads the repository from prismic.config.json at the
1198
1631
  project root.
@@ -1208,7 +1641,7 @@ FLAGS
1208
1641
  -h, --help Show help for command
1209
1642
 
1210
1643
  LEARN MORE
1211
- 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 M()){mr();return}let i=await pr(n,r);if(!i.ok){i.error instanceof q?mr():b(i.error)?(console.error(`Failed to set repository name: Invalid response: ${z(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to set repository name: ${z(i.value)}`),process.exitCode=1);return}console.info(`Repository name set to: ${i.value.repository.name}`)}async function pr(e,t){let n=await F(e),r=new URL(`app/settings/repository`,n),i=new FormData;return i.set(`displayname`,t),await K(r,{method:`POST`,body:i,schema:E({repository:E({name:k()})})})}function mr(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const hr=E({repositories:S(E({domain:k(),name:D(k())}))});async function gr(){let{values:{help:t,repo:n=await W(),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.
1644
+ 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.
1212
1645
 
1213
1646
  By default, this command reads the repository from prismic.config.json at the
1214
1647
  project root.
@@ -1222,7 +1655,7 @@ FLAGS
1222
1655
  -h, --help Show help for command
1223
1656
 
1224
1657
  LEARN MORE
1225
- 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 F(n);if(r){vr(i.toString()),console.info(`Opening ${i}`);return}if(!await M()){yr();return}let a=await _r();if(!a.ok){a.error instanceof q?yr():(console.error(`Failed to fetch repository info: ${z(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 _r(){return await K(new URL(`profile`,await fe()),{schema:hr})}function vr(e){u(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e}"`)}function yr(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function br(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`create`:await ar();break;case`list`:await lr();break;case`view`:await gr();break;case`set-name`:await fr();break;default:t&&(console.error(`Unknown repo subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage Prismic repositories.
1658
+ 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.
1226
1659
 
1227
1660
  USAGE
1228
1661
  prismic repo <command> [flags]
@@ -1231,13 +1664,15 @@ COMMANDS
1231
1664
  create Create a new Prismic repository
1232
1665
  list List all repositories
1233
1666
  view View repository details
1667
+ get-access Get Content API access level
1668
+ set-access Set Content API access level
1234
1669
  set-name Set repository display name
1235
1670
 
1236
1671
  FLAGS
1237
1672
  -h, --help Show help for command
1238
1673
 
1239
1674
  LEARN MORE
1240
- Use \`prismic repo <command> --help\` for more information about a command.`)}}async function xr(){let{values:{help:t,variation:n,label:r,default:i,"true-label":a,"false-label":o},positionals:[c,l]}=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`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a boolean (toggle) field to an existing slice.
1675
+ 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,"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.
1241
1676
 
1242
1677
  USAGE
1243
1678
  prismic slice add-field boolean <slice-id> <field-id> [flags]
@@ -1246,20 +1681,24 @@ ARGUMENTS
1246
1681
  slice-id Slice identifier (required)
1247
1682
  field-id Field identifier (required)
1248
1683
 
1684
+ Types are generated by default after changes. Use --no-types to skip.
1685
+
1249
1686
  FLAGS
1250
1687
  -v, --variation string Target variation (default: first variation)
1251
- -l, --label string Display label for the field
1688
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1252
1689
  --default Set default value to true
1253
1690
  --true-label string Label shown when toggle is on
1254
1691
  --false-label string Label shown when toggle is off
1692
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1693
+ --no-types Skip type generation
1255
1694
  -h, --help Show help for command
1256
1695
 
1257
1696
  EXAMPLES
1258
1697
  prismic slice add-field boolean my_slice featured
1259
1698
  prismic slice add-field boolean hero show_overlay --default
1260
- prismic slice add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!c){console.error(`Missing required argument: slice-id
1261
- `),console.error(`Usage: prismic slice add-field boolean <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
1262
- `),console.error(`Usage: prismic slice add-field boolean <slice-id> <field-id>`),process.exitCode=1;return}let u=await V(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:`Boolean`,config:{...r&&{label:r},...i&&{default_value:!0},...a&&{placeholder_true:a},...o&&{placeholder_false:o}}};p.primary[l]=m;try{await s(f,z(d))}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 "${l}" (Boolean) to "${p.id}" variation in ${c}`)}async function Sr(){let{values:{help:t,variation:n,label:r,placeholder:i},positionals:[a,o]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing slice.
1699
+ 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
1700
+ `),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
1701
+ `),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 co(){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.
1263
1702
 
1264
1703
  USAGE
1265
1704
  prismic slice add-field color <slice-id> <field-id> [flags]
@@ -1268,18 +1707,22 @@ ARGUMENTS
1268
1707
  slice-id Slice identifier (required)
1269
1708
  field-id Field identifier (required)
1270
1709
 
1710
+ Types are generated by default after changes. Use --no-types to skip.
1711
+
1271
1712
  FLAGS
1272
1713
  -v, --variation string Target variation (default: first variation)
1273
- -l, --label string Display label for the field
1714
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1274
1715
  -p, --placeholder string Placeholder text
1716
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1717
+ --no-types Skip type generation
1275
1718
  -h, --help Show help for command
1276
1719
 
1277
1720
  EXAMPLES
1278
1721
  prismic slice add-field color my_slice background_color
1279
1722
  prismic slice add-field color hero accent --label "Accent Color"
1280
- prismic slice add-field color banner theme_color --variation "dark"`);return}if(!a){console.error(`Missing required argument: slice-id
1281
- `),console.error(`Usage: prismic slice add-field color <slice-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1282
- `),console.error(`Usage: prismic slice add-field color <slice-id> <field-id>`),process.exitCode=1;return}let c=await V(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:`Color`,config:{...r&&{label:r},...i&&{placeholder:i}}};d.primary[o]=f;try{await s(u,z(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}" (Color) to "${d.id}" variation in ${a}`)}async function Cr(){let{values:{help:t,variation:n,label:r,placeholder:i},positionals:[a,o]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date picker field to an existing slice.
1723
+ prismic slice add-field color banner theme_color --variation "dark"`);return}if(!c){console.error(`Missing required argument: slice-id
1724
+ `),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
1725
+ `),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 lo(){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.
1283
1726
 
1284
1727
  USAGE
1285
1728
  prismic slice add-field date <slice-id> <field-id> [flags]
@@ -1288,18 +1731,22 @@ ARGUMENTS
1288
1731
  slice-id Slice identifier (required)
1289
1732
  field-id Field identifier (required)
1290
1733
 
1734
+ Types are generated by default after changes. Use --no-types to skip.
1735
+
1291
1736
  FLAGS
1292
1737
  -v, --variation string Target variation (default: first variation)
1293
- -l, --label string Display label for the field
1738
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1294
1739
  -p, --placeholder string Placeholder text
1740
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1741
+ --no-types Skip type generation
1295
1742
  -h, --help Show help for command
1296
1743
 
1297
1744
  EXAMPLES
1298
1745
  prismic slice add-field date my_slice publish_date
1299
1746
  prismic slice add-field date event start_date --label "Start Date"
1300
- prismic slice add-field date promo end_date --variation "countdown"`);return}if(!a){console.error(`Missing required argument: slice-id
1301
- `),console.error(`Usage: prismic slice add-field date <slice-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1302
- `),console.error(`Usage: prismic slice add-field date <slice-id> <field-id>`),process.exitCode=1;return}let c=await V(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:`Date`,config:{...r&&{label:r},...i&&{placeholder:i}}};d.primary[o]=f;try{await s(u,z(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}" (Date) to "${d.id}" variation in ${a}`)}async function wr(){let{values:{help:t,variation:n,label:r,placeholder:i},positionals:[a,o]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed (oEmbed) field to an existing slice.
1747
+ prismic slice add-field date promo end_date --variation "countdown"`);return}if(!c){console.error(`Missing required argument: slice-id
1748
+ `),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
1749
+ `),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 uo(){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.
1303
1750
 
1304
1751
  USAGE
1305
1752
  prismic slice add-field embed <slice-id> <field-id> [flags]
@@ -1308,18 +1755,22 @@ ARGUMENTS
1308
1755
  slice-id Slice identifier (required)
1309
1756
  field-id Field identifier (required)
1310
1757
 
1758
+ Types are generated by default after changes. Use --no-types to skip.
1759
+
1311
1760
  FLAGS
1312
1761
  -v, --variation string Target variation (default: first variation)
1313
- -l, --label string Display label for the field
1762
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1314
1763
  -p, --placeholder string Placeholder text
1764
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1765
+ --no-types Skip type generation
1315
1766
  -h, --help Show help for command
1316
1767
 
1317
1768
  EXAMPLES
1318
1769
  prismic slice add-field embed my_slice video
1319
1770
  prismic slice add-field embed gallery media --label "Media Embed"
1320
- prismic slice add-field embed social tweet --variation "twitter"`);return}if(!a){console.error(`Missing required argument: slice-id
1321
- `),console.error(`Usage: prismic slice add-field embed <slice-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1322
- `),console.error(`Usage: prismic slice add-field embed <slice-id> <field-id>`),process.exitCode=1;return}let c=await V(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:`Embed`,config:{...r&&{label:r},...i&&{placeholder:i}}};d.primary[o]=f;try{await s(u,z(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}" (Embed) to "${d.id}" variation in ${a}`)}async function Tr(){let{values:{help:t,variation:n,label:r},positionals:[i,a]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geographic coordinates field to an existing slice.
1771
+ prismic slice add-field embed social tweet --variation "twitter"`);return}if(!c){console.error(`Missing required argument: slice-id
1772
+ `),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
1773
+ `),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 fo(){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.
1323
1774
 
1324
1775
  USAGE
1325
1776
  prismic slice add-field geo-point <slice-id> <field-id> [flags]
@@ -1328,17 +1779,21 @@ ARGUMENTS
1328
1779
  slice-id Slice identifier (required)
1329
1780
  field-id Field identifier (required)
1330
1781
 
1782
+ Types are generated by default after changes. Use --no-types to skip.
1783
+
1331
1784
  FLAGS
1332
1785
  -v, --variation string Target variation (default: first variation)
1333
- -l, --label string Display label for the field
1786
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1787
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1788
+ --no-types Skip type generation
1334
1789
  -h, --help Show help for command
1335
1790
 
1336
1791
  EXAMPLES
1337
1792
  prismic slice add-field geo-point my_slice location
1338
1793
  prismic slice add-field geo-point store coordinates --label "Store Location"
1339
- prismic slice add-field geo-point map marker --variation "interactive"`);return}if(!i){console.error(`Missing required argument: slice-id
1340
- `),console.error(`Usage: prismic slice add-field geo-point <slice-id> <field-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: field-id
1341
- `),console.error(`Usage: prismic slice add-field geo-point <slice-id> <field-id>`),process.exitCode=1;return}let o=await V(i);if(!o.ok){console.error(o.error),process.exitCode=1;return}let{model:c,modelPath:l}=o;if(c.variations.length===0){console.error(`Slice "${i}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let u=n?c.variations.find(e=>e.id===n):c.variations[0];if(!u){console.error(`Variation "${n}" not found in slice "${i}"\n`),console.error(`Available variations: ${c.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}u.primary||={};for(let e of c.variations)if(e.primary?.[a]){console.error(`Field "${a}" already exists in variation "${e.id}"`),process.exitCode=1;return}let d={type:`GeoPoint`,config:{...r&&{label:r}}};u.primary[a]=d;try{await s(l,z(c))}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 "${a}" (GeoPoint) to "${u.id}" variation in ${i}`)}async function Er(){let{values:{help:t,variation:n,label:r},positionals:[i,a]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing slice.
1794
+ prismic slice add-field geo-point map marker --variation "interactive"`);return}if(!o){console.error(`Missing required argument: slice-id
1795
+ `),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
1796
+ `),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 po(){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.
1342
1797
 
1343
1798
  USAGE
1344
1799
  prismic slice add-field image <slice-id> <field-id> [flags]
@@ -1347,17 +1802,21 @@ ARGUMENTS
1347
1802
  slice-id Slice identifier (required)
1348
1803
  field-id Field identifier (required)
1349
1804
 
1805
+ Types are generated by default after changes. Use --no-types to skip.
1806
+
1350
1807
  FLAGS
1351
1808
  -v, --variation string Target variation (default: first variation)
1352
- -l, --label string Display label for the field
1809
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1810
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1811
+ --no-types Skip type generation
1353
1812
  -h, --help Show help for command
1354
1813
 
1355
1814
  EXAMPLES
1356
1815
  prismic slice add-field image my_slice background
1357
1816
  prismic slice add-field image hero banner --label "Hero Banner"
1358
- prismic slice add-field image gallery thumbnail --variation "grid"`);return}if(!i){console.error(`Missing required argument: slice-id
1359
- `),console.error(`Usage: prismic slice add-field image <slice-id> <field-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: field-id
1360
- `),console.error(`Usage: prismic slice add-field image <slice-id> <field-id>`),process.exitCode=1;return}let o=await V(i);if(!o.ok){console.error(o.error),process.exitCode=1;return}let{model:c,modelPath:l}=o;if(c.variations.length===0){console.error(`Slice "${i}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let u=n?c.variations.find(e=>e.id===n):c.variations[0];if(!u){console.error(`Variation "${n}" not found in slice "${i}"\n`),console.error(`Available variations: ${c.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}u.primary||={};for(let e of c.variations)if(e.primary?.[a]){console.error(`Field "${a}" already exists in variation "${e.id}"`),process.exitCode=1;return}let d={type:`Image`,config:{...r&&{label:r}}};u.primary[a]=d;try{await s(l,z(c))}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 "${a}" (Image) to "${u.id}" variation in ${i}`)}async function Dr(){let{values:{help:t,variation:n,label:r,placeholder:i},positionals:[a,o]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing slice.
1817
+ prismic slice add-field image gallery thumbnail --variation "grid"`);return}if(!o){console.error(`Missing required argument: slice-id
1818
+ `),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
1819
+ `),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 mo(){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.
1361
1820
 
1362
1821
  USAGE
1363
1822
  prismic slice add-field key-text <slice-id> <field-id> [flags]
@@ -1366,18 +1825,22 @@ ARGUMENTS
1366
1825
  slice-id Slice identifier (required)
1367
1826
  field-id Field identifier (required)
1368
1827
 
1828
+ Types are generated by default after changes. Use --no-types to skip.
1829
+
1369
1830
  FLAGS
1370
1831
  -v, --variation string Target variation (default: first variation)
1371
- -l, --label string Display label for the field
1832
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1372
1833
  -p, --placeholder string Placeholder text
1834
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1835
+ --no-types Skip type generation
1373
1836
  -h, --help Show help for command
1374
1837
 
1375
1838
  EXAMPLES
1376
1839
  prismic slice add-field key-text my_slice title
1377
1840
  prismic slice add-field key-text hero heading --label "Heading"
1378
- prismic slice add-field key-text cta button_text --placeholder "Enter button text"`);return}if(!a){console.error(`Missing required argument: slice-id
1379
- `),console.error(`Usage: prismic slice add-field key-text <slice-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1380
- `),console.error(`Usage: prismic slice add-field key-text <slice-id> <field-id>`),process.exitCode=1;return}let c=await V(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:`Text`,config:{...r&&{label:r},...i&&{placeholder:i}}};d.primary[o]=f;try{await s(u,z(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}" (Text) to "${d.id}" variation in ${a}`)}async function Or(){let{values:{help:t,variation:n,label:r,placeholder:i,"allow-text":a,"allow-target-blank":o,repeatable: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`},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing slice.
1841
+ prismic slice add-field key-text cta button_text --placeholder "Enter button text"`);return}if(!c){console.error(`Missing required argument: slice-id
1842
+ `),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
1843
+ `),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 ho(){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.
1381
1844
 
1382
1845
  USAGE
1383
1846
  prismic slice add-field link <slice-id> <field-id> [flags]
@@ -1386,22 +1849,26 @@ ARGUMENTS
1386
1849
  slice-id Slice identifier (required)
1387
1850
  field-id Field identifier (required)
1388
1851
 
1852
+ Types are generated by default after changes. Use --no-types to skip.
1853
+
1389
1854
  FLAGS
1390
1855
  -v, --variation string Target variation (default: first variation)
1391
- -l, --label string Display label for the field
1856
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1392
1857
  -p, --placeholder string Placeholder text
1393
1858
  --allow-text Allow text with link
1394
1859
  --allow-target-blank Allow opening link in new tab
1395
1860
  --repeatable Allow multiple links
1861
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1862
+ --no-types Skip type generation
1396
1863
  -h, --help Show help for command
1397
1864
 
1398
1865
  EXAMPLES
1399
1866
  prismic slice add-field link my_slice button
1400
1867
  prismic slice add-field link cta primary_link --allow-text
1401
1868
  prismic slice add-field link navigation links --repeatable
1402
- prismic slice add-field link hero cta --allow-text --allow-target-blank`);return}if(!l){console.error(`Missing required argument: slice-id
1403
- `),console.error(`Usage: prismic slice add-field link <slice-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
1404
- `),console.error(`Usage: prismic slice add-field link <slice-id> <field-id>`),process.exitCode=1;return}let d=await V(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:`Link`,config:{...r&&{label:r},...i&&{placeholder:i},...a&&{allowText:!0},...o&&{allowTargetBlank:!0},...c&&{repeat:!0}}};m.primary[u]=h;try{await s(p,z(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}" (Link) to "${m.id}" variation in ${l}`)}async function kr(){let{values:{help:t,variation:n,label:r,placeholder:i},positionals:[a,o]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing slice.
1869
+ prismic slice add-field link hero cta --allow-text --allow-target-blank`);return}if(!d){console.error(`Missing required argument: slice-id
1870
+ `),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
1871
+ `),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 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 number field to an existing slice.
1405
1872
 
1406
1873
  USAGE
1407
1874
  prismic slice add-field number <slice-id> <field-id> [flags]
@@ -1410,18 +1877,22 @@ ARGUMENTS
1410
1877
  slice-id Slice identifier (required)
1411
1878
  field-id Field identifier (required)
1412
1879
 
1880
+ Types are generated by default after changes. Use --no-types to skip.
1881
+
1413
1882
  FLAGS
1414
1883
  -v, --variation string Target variation (default: first variation)
1415
- -l, --label string Display label for the field
1884
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1416
1885
  -p, --placeholder string Placeholder text
1886
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1887
+ --no-types Skip type generation
1417
1888
  -h, --help Show help for command
1418
1889
 
1419
1890
  EXAMPLES
1420
1891
  prismic slice add-field number my_slice price
1421
1892
  prismic slice add-field number product quantity --label "Quantity"
1422
- prismic slice add-field number stats count --variation "detailed"`);return}if(!a){console.error(`Missing required argument: slice-id
1423
- `),console.error(`Usage: prismic slice add-field number <slice-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1424
- `),console.error(`Usage: prismic slice add-field number <slice-id> <field-id>`),process.exitCode=1;return}let c=await V(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:`Number`,config:{...r&&{label:r},...i&&{placeholder:i}}};d.primary[o]=f;try{await s(u,z(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}" (Number) to "${d.id}" variation in ${a}`)}async function Ar(){let{values:{help:t,variation:n,label:r,placeholder:i,single:a,multi:o,"allow-target-blank":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`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing slice.
1893
+ prismic slice add-field number stats count --variation "detailed"`);return}if(!c){console.error(`Missing required argument: slice-id
1894
+ `),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
1895
+ `),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 _o(){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.
1425
1896
 
1426
1897
  USAGE
1427
1898
  prismic slice add-field rich-text <slice-id> <field-id> [flags]
@@ -1430,13 +1901,17 @@ ARGUMENTS
1430
1901
  slice-id Slice identifier (required)
1431
1902
  field-id Field identifier (required)
1432
1903
 
1904
+ Types are generated by default after changes. Use --no-types to skip.
1905
+
1433
1906
  FLAGS
1434
1907
  -v, --variation string Target variation (default: first variation)
1435
- -l, --label string Display label for the field
1908
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1436
1909
  -p, --placeholder string Placeholder text
1437
1910
  --single string Allowed block types for single-line (comma-separated)
1438
1911
  --multi string Allowed block types for multi-line (comma-separated)
1439
1912
  --allow-target-blank Allow opening links in new tab
1913
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1914
+ --no-types Skip type generation
1440
1915
  -h, --help Show help for command
1441
1916
 
1442
1917
  BLOCK TYPES
@@ -1448,9 +1923,9 @@ EXAMPLES
1448
1923
  prismic slice add-field rich-text my_slice body
1449
1924
  prismic slice add-field rich-text article content --multi "paragraph,heading2,heading3,strong,em,hyperlink"
1450
1925
  prismic slice add-field rich-text hero tagline --single "heading1"
1451
- prismic slice add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!l){console.error(`Missing required argument: slice-id
1452
- `),console.error(`Usage: prismic slice add-field rich-text <slice-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
1453
- `),console.error(`Usage: prismic slice add-field rich-text <slice-id> <field-id>`),process.exitCode=1;return}let d=await V(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:`StructuredText`,config:{...r&&{label:r},...i&&{placeholder:i},...a&&{single:a},...o&&{multi:o},...c&&{allowTargetBlank:!0}}};m.primary[u]=h;try{await s(p,z(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}" (StructuredText) to "${m.id}" variation in ${l}`)}async function jr(){let{values:{help:t,variation:n,label:r,placeholder:i,option:a,default: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`},option:{type:`string`,multiple:!0},default:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing slice.
1926
+ 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
1927
+ `),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
1928
+ `),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 vo(){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.
1454
1929
 
1455
1930
  USAGE
1456
1931
  prismic slice add-field select <slice-id> <field-id> [flags]
@@ -1459,20 +1934,24 @@ ARGUMENTS
1459
1934
  slice-id Slice identifier (required)
1460
1935
  field-id Field identifier (required)
1461
1936
 
1937
+ Types are generated by default after changes. Use --no-types to skip.
1938
+
1462
1939
  FLAGS
1463
1940
  -v, --variation string Target variation (default: first variation)
1464
- -l, --label string Display label for the field
1941
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1465
1942
  -p, --placeholder string Placeholder text
1466
1943
  --option string Add an option (can be used multiple times)
1467
1944
  --default string Default selected value
1945
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1946
+ --no-types Skip type generation
1468
1947
  -h, --help Show help for command
1469
1948
 
1470
1949
  EXAMPLES
1471
1950
  prismic slice add-field select my_slice layout --option "full" --option "sidebar"
1472
1951
  prismic slice add-field select hero style --option "light" --option "dark" --default "light"
1473
- prismic slice add-field select product size --option "small" --option "medium" --option "large" --label "Size"`);return}if(!c){console.error(`Missing required argument: slice-id
1474
- `),console.error(`Usage: prismic slice add-field select <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
1475
- `),console.error(`Usage: prismic slice add-field select <slice-id> <field-id>`),process.exitCode=1;return}let u=await V(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:`Select`,config:{...r&&{label:r},...i&&{placeholder:i},...a&&a.length>0&&{options:a},...o&&{default_value:o}}};p.primary[l]=m;try{await s(f,z(d))}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 "${l}" (Select) to "${p.id}" variation in ${c}`)}async function Mr(){let{values:{help:t,variation:n,label:r,placeholder:i},positionals:[a,o]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a timestamp (date and time) field to an existing slice.
1952
+ 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
1953
+ `),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
1954
+ `),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 yo(){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.
1476
1955
 
1477
1956
  USAGE
1478
1957
  prismic slice add-field timestamp <slice-id> <field-id> [flags]
@@ -1481,18 +1960,22 @@ ARGUMENTS
1481
1960
  slice-id Slice identifier (required)
1482
1961
  field-id Field identifier (required)
1483
1962
 
1963
+ Types are generated by default after changes. Use --no-types to skip.
1964
+
1484
1965
  FLAGS
1485
1966
  -v, --variation string Target variation (default: first variation)
1486
- -l, --label string Display label for the field
1967
+ -l, --label string Display label for the field (inferred from field-id if omitted)
1487
1968
  -p, --placeholder string Placeholder text
1969
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
1970
+ --no-types Skip type generation
1488
1971
  -h, --help Show help for command
1489
1972
 
1490
1973
  EXAMPLES
1491
1974
  prismic slice add-field timestamp my_slice created_at
1492
1975
  prismic slice add-field timestamp event start_time --label "Event Start"
1493
- prismic slice add-field timestamp schedule meeting_time --variation "detailed"`);return}if(!a){console.error(`Missing required argument: slice-id
1494
- `),console.error(`Usage: prismic slice add-field timestamp <slice-id> <field-id>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: field-id
1495
- `),console.error(`Usage: prismic slice add-field timestamp <slice-id> <field-id>`),process.exitCode=1;return}let c=await V(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:`Timestamp`,config:{...r&&{label:r},...i&&{placeholder:i}}};d.primary[o]=f;try{await s(u,z(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}" (Timestamp) to "${d.id}" variation in ${a}`)}async function Nr(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await xr();break;case`color`:await Sr();break;case`date`:await Cr();break;case`embed`:await wr();break;case`geo-point`:await Tr();break;case`image`:await Er();break;case`key-text`:await Dr();break;case`link`:await Or();break;case`number`:await kr();break;case`rich-text`:await Ar();break;case`select`:await jr();break;case`timestamp`:await Mr();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing slice.
1976
+ prismic slice add-field timestamp schedule meeting_time --variation "detailed"`);return}if(!c){console.error(`Missing required argument: slice-id
1977
+ `),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
1978
+ `),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 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.
1496
1979
 
1497
1980
  USAGE
1498
1981
  prismic slice add-field <field-type> <slice-id> <field-id> [flags]
@@ -1521,7 +2004,7 @@ EXAMPLES
1521
2004
  prismic slice add-field key-text my_slice title --label "Title"
1522
2005
  prismic slice add-field link my_slice cta --allow-text
1523
2006
  prismic slice add-field rich-text my_slice body --multi "paragraph,heading2,strong,em"
1524
- prismic slice add-field select my_slice layout --option "full" --option "sidebar"`)}}async function Pr(){let{values:{help:t,name:n,"copy-from":r},positionals:[i,a]}=e({args:process.argv.slice(4),options:{name:{type:`string`},"copy-from":{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a new variation to a slice.
2007
+ 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,"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.
1525
2008
 
1526
2009
  USAGE
1527
2010
  prismic slice add-variation <slice-id> <variation-id> [flags]
@@ -1530,17 +2013,21 @@ ARGUMENTS
1530
2013
  slice-id Slice identifier (required)
1531
2014
  variation-id New variation identifier (required)
1532
2015
 
2016
+ Types are generated by default after changes. Use --no-types to skip.
2017
+
1533
2018
  FLAGS
1534
2019
  --name string Display name for the variation
1535
2020
  --copy-from string Copy fields from an existing variation
2021
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
2022
+ --no-types Skip type generation
1536
2023
  -h, --help Show help for command
1537
2024
 
1538
2025
  EXAMPLES
1539
2026
  prismic slice add-variation MySlice withImage
1540
2027
  prismic slice add-variation MySlice withImage --name "With Image"
1541
- prismic slice add-variation MySlice withImage --copy-from default`);return}if(!i){console.error(`Missing required argument: slice-id
1542
- `),console.error(`Usage: prismic slice add-variation <slice-id> <variation-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: variation-id
1543
- `),console.error(`Usage: prismic slice add-variation <slice-id> <variation-id>`),process.exitCode=1;return}let o=await V(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 "${a}" already exists in slice "${i}"`),process.exitCode=1;return}let u;if(r){let e=c.variations.find(e=>e.id===r);if(!e){console.error(`Source variation not found: ${r}`),console.error(`Available variations: ${c.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}u={...structuredClone(e),id:a,name:n??U(a)}}else u={id:a,name:n??U(a),description:a,imageUrl:``,docURL:``,version:`initial`,primary:{},items:{}};let d={...c,variations:[...c.variations,u]};try{await s(l,z(d))}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 "${a}" to slice "${i}"`)}async function Fr(){let{values:{help:t,name:r},positionals:[i]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Create a new slice in a Prismic project.
2028
+ prismic slice add-variation MySlice withImage --copy-from default`);return}if(!o){console.error(`Missing required argument: slice-id
2029
+ `),console.error(`Usage: prismic slice add-variation <slice-id> <variation-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: variation-id
2030
+ `),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 So(){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.
1544
2031
 
1545
2032
  USAGE
1546
2033
  prismic slice create <id> [flags]
@@ -1548,12 +2035,16 @@ USAGE
1548
2035
  ARGUMENTS
1549
2036
  id Slice identifier (required)
1550
2037
 
2038
+ Types are generated by default after changes. Use --no-types to skip.
2039
+
1551
2040
  FLAGS
1552
2041
  -n, --name string Display name for the slice
2042
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
2043
+ --no-types Skip type generation
1553
2044
  -h, --help Show help for command
1554
2045
 
1555
2046
  LEARN MORE
1556
- Use \`prismic slice <command> --help\` for more information about a command.`);return}if(!i){console.error(`Missing required argument: id`),process.exitCode=1;return}let a={id:i,type:`SharedSlice`,name:r??zr(i),description:``,variations:[{id:`default`,name:`Default`,description:`Default`,imageUrl:``,docURL:``,version:`initial`,primary:{},items:{}}]},o=await Ir(),c=new URL(zr(a.name)+`/`,o),l=new URL(`model.json`,c);try{await n(new URL(`.`,l),{recursive:!0}),await s(l,z(a))}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 ${l.href}`)}async function Ir(){let e=await Rr(),t=await L(`package.json`);switch(e){case`next`:if(await R(new URL(`src`,t)))return new URL(`src/slices/`,t);case`nuxt`:if(await R(new URL(`app`,t)))return new URL(`app/slices/`,t);case`sveltekit`:return new URL(`src/slices/`,t)}return new URL(`slices/`,t)}const Lr=E({dependencies:D(O(k(),k()))});async function Rr(){let e=await L(`package.json`);if(e)try{let t=await r(e,`utf8`),{dependencies:n={}}=ie(Lr,JSON.parse(t));if(`next`in n)return`next`;if(`nuxt`in n)return`nuxt`;if(`@sveltejs/kit`in n)return`sveltekit`}catch{}}function zr(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}async function Br(){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.
2047
+ 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??Eo(o),description:``,variations:[{id:`default`,name:`Default`,description:`Default`,imageUrl:``,docURL:``,version:`initial`,primary:{},items:{}}]},l=await Co(),u=new URL(Eo(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 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.
1557
2048
 
1558
2049
  USAGE
1559
2050
  prismic slice list [flags]
@@ -1564,7 +2055,7 @@ FLAGS
1564
2055
 
1565
2056
  EXAMPLES
1566
2057
  prismic slice list
1567
- prismic slice list --json`);return}let a=await H(),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=j(B,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 Vr(){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.
2058
+ 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.
1568
2059
 
1569
2060
  USAGE
1570
2061
  prismic slice list-variations <slice-id> [flags]
@@ -1579,7 +2070,7 @@ FLAGS
1579
2070
  EXAMPLES
1580
2071
  prismic slice list-variations MySlice
1581
2072
  prismic slice list-variations MySlice --json`);return}if(!r){console.error(`Missing required argument: slice-id
1582
- `),console.error(`Usage: prismic slice list-variations <slice-id>`),process.exitCode=1;return}let i=await V(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 Hr(){let{values:{help:t,y:n},positionals:[r]}=e({args:process.argv.slice(4),options:{y:{type:`boolean`,short:`y`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a slice from the project.
2073
+ `),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,"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.
1583
2074
 
1584
2075
  USAGE
1585
2076
  prismic slice remove <slice-id> [flags]
@@ -1587,14 +2078,18 @@ USAGE
1587
2078
  ARGUMENTS
1588
2079
  slice-id Slice identifier (required)
1589
2080
 
2081
+ Types are generated by default after changes. Use --no-types to skip.
2082
+
1590
2083
  FLAGS
1591
2084
  -y Confirm removal
2085
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
2086
+ --no-types Skip type generation
1592
2087
  -h, --help Show help for command
1593
2088
 
1594
2089
  EXAMPLES
1595
2090
  prismic slice remove MySlice
1596
- prismic slice remove MySlice -y`);return}if(!r){console.error(`Missing required argument: slice-id
1597
- `),console.error(`Usage: prismic slice remove <slice-id>`),process.exitCode=1;return}let i=await V(r);if(!i.ok){console.error(i.error),process.exitCode=1;return}let{modelPath:a}=i,s=new URL(`.`,a);if(!n){console.error(`Refusing to remove slice "${r}" (this will delete the entire directory).`),console.error(`Re-run with -y to confirm.`),process.exitCode=1;return}try{await o(s,{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 "${r}"`)}async function Ur(){let{values:{help:t,variation:n,zone:r},positionals:[i,a]}=e({args:process.argv.slice(4),options:{variation:{type:`string`,default:`default`},zone:{type:`string`,default:`primary`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a field from a slice variation.
2091
+ prismic slice remove MySlice -y`);return}if(!a){console.error(`Missing required argument: slice-id
2092
+ `),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 Ao(){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.
1598
2093
 
1599
2094
  USAGE
1600
2095
  prismic slice remove-field <slice-id> <field-id> [flags]
@@ -1603,17 +2098,21 @@ ARGUMENTS
1603
2098
  slice-id Slice identifier (required)
1604
2099
  field-id Field identifier (required)
1605
2100
 
2101
+ Types are generated by default after changes. Use --no-types to skip.
2102
+
1606
2103
  FLAGS
1607
2104
  --variation string Target variation (default: "default")
1608
2105
  --zone string Field zone: "primary" or "items" (default: "primary")
2106
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
2107
+ --no-types Skip type generation
1609
2108
  -h, --help Show help for command
1610
2109
 
1611
2110
  EXAMPLES
1612
2111
  prismic slice remove-field MySlice title
1613
2112
  prismic slice remove-field MySlice title --variation withImage
1614
- prismic slice remove-field MySlice item_title --zone items`);return}if(!i){console.error(`Missing required argument: slice-id
1615
- `),console.error(`Usage: prismic slice remove-field <slice-id> <field-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: field-id
1616
- `),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 o=await V(i);if(!o.ok){console.error(o.error),process.exitCode=1;return}let{model:c,modelPath:l}=o,u=c.variations.find(e=>e.id===n);if(!u){console.error(`Variation not found: ${n}`),console.error(`Available variations: ${c.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}let d=r===`primary`?u.primary:u.items;if(!d||!(a in d)){console.error(`Field "${a}" not found in ${r} zone of variation "${n}"`),process.exitCode=1;return}delete d[a];try{await s(l,z(c))}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 "${a}" from ${r} zone in variation "${n}" of slice "${i}"`)}async function Wr(){let{values:{help:t},positionals:[n,r]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a variation from a slice.
2113
+ prismic slice remove-field MySlice item_title --zone items`);return}if(!o){console.error(`Missing required argument: slice-id
2114
+ `),console.error(`Usage: prismic slice remove-field <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
2115
+ `),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 jo(){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.
1617
2116
 
1618
2117
  USAGE
1619
2118
  prismic slice remove-variation <slice-id> <variation-id> [flags]
@@ -1622,13 +2121,17 @@ ARGUMENTS
1622
2121
  slice-id Slice identifier (required)
1623
2122
  variation-id Variation to remove (required)
1624
2123
 
2124
+ Types are generated by default after changes. Use --no-types to skip.
2125
+
1625
2126
  FLAGS
2127
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
2128
+ --no-types Skip type generation
1626
2129
  -h, --help Show help for command
1627
2130
 
1628
2131
  EXAMPLES
1629
- prismic slice remove-variation MySlice withImage`);return}if(!n){console.error(`Missing required argument: slice-id
1630
- `),console.error(`Usage: prismic slice remove-variation <slice-id> <variation-id>`),process.exitCode=1;return}if(!r){console.error(`Missing required argument: variation-id
1631
- `),console.error(`Usage: prismic slice remove-variation <slice-id> <variation-id>`),process.exitCode=1;return}let i=await V(n);if(!i.ok){console.error(i.error),process.exitCode=1;return}let{model:a,modelPath:o}=i;if(!a.variations.some(e=>e.id===r)){console.error(`Variation not found: ${r}`),console.error(`Available variations: ${a.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}if(a.variations.length===1){console.error(`Cannot remove the last variation from a slice.`),process.exitCode=1;return}let c={...a,variations:a.variations.filter(e=>e.id!==r)};try{await s(o,z(c))}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 "${r}" from slice "${n}"`)}async function Gr(){let{values:{help:t,id:n},positionals:[r,i]}=e({args:process.argv.slice(4),options:{id:{type:`string`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Rename a slice (updates name field, optionally id and directory).
2132
+ prismic slice remove-variation MySlice withImage`);return}if(!i){console.error(`Missing required argument: slice-id
2133
+ `),console.error(`Usage: prismic slice remove-variation <slice-id> <variation-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: variation-id
2134
+ `),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 Mo(){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).
1632
2135
 
1633
2136
  USAGE
1634
2137
  prismic slice rename <slice-id> <new-name> [flags]
@@ -1637,15 +2140,19 @@ ARGUMENTS
1637
2140
  slice-id Current slice identifier (required)
1638
2141
  new-name New display name (required)
1639
2142
 
2143
+ Types are generated by default after changes. Use --no-types to skip.
2144
+
1640
2145
  FLAGS
1641
2146
  --id string Also change the slice ID (renames directory)
2147
+ --types string Output file for generated types (default: "prismicio-types.d.ts")
2148
+ --no-types Skip type generation
1642
2149
  -h, --help Show help for command
1643
2150
 
1644
2151
  EXAMPLES
1645
2152
  prismic slice rename MySlice "My New Name"
1646
- prismic slice rename MySlice "My New Name" --id NewSliceId`);return}if(!r){console.error(`Missing required argument: slice-id
1647
- `),console.error(`Usage: prismic slice rename <slice-id> <new-name>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: new-name
1648
- `),console.error(`Usage: prismic slice rename <slice-id> <new-name>`),process.exitCode=1;return}let o=await V(r);if(!o.ok){console.error(o.error),process.exitCode=1;return}let{model:c,modelPath:l}=o;c.name=i,n&&(c.id=n);try{await s(l,z(c))}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 H(),t=new URL(`.`,l),o=new URL(U(i)+`/`,e);if(t.href!==o.href)try{await a(t,o),console.info(`Renamed slice "${r}" to "${n}" (${i})`),console.info(`Moved directory to ${o.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 "${r}" to "${n}" (${i})`)}else console.info(`Renamed slice "${r}" to "${i}"`)}async function Kr(){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.
2153
+ prismic slice rename MySlice "My New Name" --id NewSliceId`);return}if(!o){console.error(`Missing required argument: slice-id
2154
+ `),console.error(`Usage: prismic slice rename <slice-id> <new-name>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: new-name
2155
+ `),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 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.
1649
2156
 
1650
2157
  USAGE
1651
2158
  prismic slice view <slice-id> [flags]
@@ -1660,8 +2167,8 @@ FLAGS
1660
2167
  EXAMPLES
1661
2168
  prismic slice view MySlice
1662
2169
  prismic slice view MySlice --json`);return}if(!r){console.error(`Missing required argument: slice-id
1663
- `),console.error(`Usage: prismic slice view <slice-id>`),process.exitCode=1;return}let i=await V(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(`
1664
- 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 qr(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`create`:await Fr();break;case`list`:await Br();break;case`view`:await Kr();break;case`rename`:await Gr();break;case`remove`:await Hr();break;case`add-field`:await Nr();break;case`remove-field`:await Ur();break;case`add-variation`:await Pr();break;case`remove-variation`:await Wr();break;case`list-variations`:await Vr();break;default:t&&(console.error(`Unknown slice subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage slices in a Prismic project.
2170
+ `),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(`
2171
+ 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.
1665
2172
 
1666
2173
  USAGE
1667
2174
  prismic slice <command> [flags]
@@ -1682,7 +2189,39 @@ FLAGS
1682
2189
  -h, --help Show help for command
1683
2190
 
1684
2191
  LEARN MORE
1685
- Use \`prismic slice <command> --help\` for more information about a command.`)}}async function Jr(){let{values:{help:t,repo:n=await W(),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.
2192
+ 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.
2193
+
2194
+ By default, this command reads the repository from prismic.config.json at the
2195
+ project root.
2196
+
2197
+ USAGE
2198
+ prismic webhook view <url> [flags]
2199
+
2200
+ ARGUMENTS
2201
+ <url> Webhook URL
2202
+
2203
+ FLAGS
2204
+ -r, --repo string Repository domain
2205
+ -h, --help Show help for command
2206
+
2207
+ LEARN MORE
2208
+ 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.
2209
+
2210
+ Includes a "Next:" step showing the most important action to take based on
2211
+ project state.
2212
+
2213
+ By default, this command reads the repository from prismic.config.json at the
2214
+ project root.
2215
+
2216
+ USAGE
2217
+ prismic status [flags]
2218
+
2219
+ FLAGS
2220
+ -r, --repo string Repository domain
2221
+ -h, --help Show help for command
2222
+
2223
+ LEARN MORE
2224
+ 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.
1686
2225
 
1687
2226
  By default, this command reads the repository from prismic.config.json at the
1688
2227
  project root.
@@ -1696,7 +2235,7 @@ FLAGS
1696
2235
  -h, --help Show help for command
1697
2236
 
1698
2237
  LEARN MORE
1699
- 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 M()){ai();return}let[i,a]=await Promise.all([ti(n),ni(n)]);if(!i.ok){i.error instanceof q||i.error instanceof J?ai():b(i.error)?(console.error(`Failed to list access tokens: Invalid response: ${z(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list access tokens: ${z(i.value)}`),process.exitCode=1);return}if(!a.ok){a.error instanceof q||a.error instanceof J?ai():b(a.error)?(console.error(`Failed to list write tokens: Invalid response: ${z(a.error.issues)}`),process.exitCode=1):(console.error(`Failed to list write tokens: ${z(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(z({accessTokens:o,writeTokens:s}));else{if(o.length>0){console.info(`ACCESS TOKENS`);for(let e of o){let t=ri(e.token),n=ii(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=ri(e.token),n=ii(e.timestamp);console.info(` ${e.app_name} ${t} ${n}`)}}else console.info(`WRITE TOKENS (none)`)}}const Yr=E({$date:T()}),Xr=E({id:k(),origin:k(),domain:k(),app:k(),scope:k(),expired_at:Yr,created_at:Yr,owner:w(k()),token:k()}),Zr=E({id:k(),secret:k(),name:k(),owner:k(),created_at:Yr,authorized_domains:S(k()),wroom_auths:S(Xr)}),Qr=E({app_name:k(),token:k(),timestamp:T()}),$r=E({max_tokens:T(),tokens:S(Qr)}),ei=S(Zr);async function ti(e){return await K(new URL(`settings/security/contentapi`,await F(e)),{schema:ei})}async function ni(e){return await K(new URL(`settings/security/customtypesapi`,await F(e)),{schema:$r})}function ri(e){return e.length<=12?e:`${e.slice(0,8)}...${e.slice(-4)}`}function ii(e){let t=typeof e==`number`?e*1e3:e.$date;return new Date(t).toISOString().split(`T`)[0]}function ai(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function oi(){let{values:{help:t,repo:n=await W(),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.
2238
+ 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.
1700
2239
 
1701
2240
  By default, this command reads the repository from prismic.config.json at the
1702
2241
  project root.
@@ -1713,7 +2252,7 @@ FLAGS
1713
2252
  -h, --help Show help for command
1714
2253
 
1715
2254
  LEARN MORE
1716
- 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 M()){li();return}if(i){let e=await si(n,a);if(!e.ok){e.error instanceof q||e.error instanceof J?li():b(e.error)?(console.error(`Failed to create write token: Invalid response: ${z(e.error.issues)}`),process.exitCode=1):(console.error(`Failed to create write token: ${z(e.value)}`),process.exitCode=1);return}r?console.info(z(e.value)):console.info(`Token created: ${e.value.token}`)}else{let e=await ci(n,a,o?`master+releases`:`master`);if(!e.ok){e.error instanceof q||e.error instanceof J?li():b(e.error)?(console.error(`Failed to create access token: Invalid response: ${z(e.error.issues)}`),process.exitCode=1):(console.error(`Failed to create access token: ${z(e.value)}`),process.exitCode=1);return}r?console.info(z(e.value)):console.info(`Token created: ${e.value.token}`)}}async function si(e,t){return await K(new URL(`settings/security/token`,await F(e)),{method:`POST`,body:{app_name:t},schema:Qr})}async function ci(e,t,n){let r=await ti(e);if(!r.ok)return r;let i=r.value.find(e=>e.name===t);if(!i){let n=await K(new URL(`settings/security/oauthapp`,await F(e)),{method:`POST`,body:{app_name:t},schema:Zr});if(!n.ok)return n;i=n.value}return await K(new URL(`settings/security/authorizations`,await F(e)),{method:`POST`,body:{app:i.id,scope:n},schema:Xr})}function li(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ui(){let{values:{help:t,repo:n=await W()},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.
2255
+ 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.
1717
2256
 
1718
2257
  By default, this command reads the repository from prismic.config.json at the
1719
2258
  project root.
@@ -1729,7 +2268,7 @@ FLAGS
1729
2268
  -h, --help Show help for command
1730
2269
 
1731
2270
  LEARN MORE
1732
- 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 M()){X();return}let[i,a]=await Promise.all([ti(n),ni(n)]);if(!i.ok){i.error instanceof q||i.error instanceof J?X():b(i.error)?(console.error(`Failed to list access tokens: Invalid response: ${z(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list access tokens: ${z(i.value)}`),process.exitCode=1);return}if(!a.ok){a.error instanceof q||a.error instanceof J?X():b(a.error)?(console.error(`Failed to list write tokens: Invalid response: ${z(a.error.issues)}`),process.exitCode=1):(console.error(`Failed to list write tokens: ${z(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 K(new URL(`settings/security/authorizations/${o.id}`,await F(n)),{method:`DELETE`});if(!e.ok){e.error instanceof q||e.error instanceof J?X():(console.error(`Failed to delete token: ${z(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 K(new URL(`settings/security/token/${s.token}`,await F(n)),{method:`DELETE`});if(!e.ok){e.error instanceof q||e.error instanceof J?X():(console.error(`Failed to delete token: ${z(e.value)}`),process.exitCode=1);return}console.info(`Token deleted`);return}console.error(`Token not found: ${r}`),process.exitCode=1}function X(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function di(){let{values:{help:t,repo:n=await W()},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.
2271
+ 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.
1733
2272
 
1734
2273
  Note: Only access tokens can be renamed. Write tokens cannot be renamed without
1735
2274
  changing the token value.
@@ -1749,7 +2288,7 @@ FLAGS
1749
2288
  -h, --help Show help for command
1750
2289
 
1751
2290
  LEARN MORE
1752
- 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 M()){fi();return}let[a,o]=await Promise.all([ti(n),ni(n)]);if(!a.ok){a.error instanceof q||a.error instanceof J?fi():b(a.error)?(console.error(`Failed to list access tokens: Invalid response: ${z(a.error.issues)}`),process.exitCode=1):(console.error(`Failed to list access tokens: ${z(a.value)}`),process.exitCode=1);return}if(!o.ok){o.error instanceof q||o.error instanceof J?fi():b(o.error)?(console.error(`Failed to list write tokens: Invalid response: ${z(o.error.issues)}`),process.exitCode=1):(console.error(`Failed to list write tokens: ${z(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 K(new URL(`settings/security/oauthapp/${s.id}`,await F(n)),{method:`POST`,body:{name:i},schema:Zr});if(!e.ok){e.error instanceof q||e.error instanceof J?fi():b(e.error)?(console.error(`Failed to rename token: Invalid response: ${z(e.error.issues)}`),process.exitCode=1):(console.error(`Failed to rename token: ${z(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 fi(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function pi(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`list`:await Jr();break;case`create`:await oi();break;case`set-name`:await di();break;case`delete`:await ui();break;default:t&&(console.error(`Unknown token subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage API tokens for a Prismic repository.
2291
+ 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.
1753
2292
 
1754
2293
  USAGE
1755
2294
  prismic token <command> [flags]
@@ -1764,23 +2303,7 @@ FLAGS
1764
2303
  -h, --help Show help for command
1765
2304
 
1766
2305
  LEARN MORE
1767
- Use \`prismic token <command> --help\` for more information about a command.`)}}const Z={documentsPublished:`document.published`,documentsUnpublished:`document.unpublished`,releasesCreated:`release.created`,releasesUpdated:`release.updated`,tagsCreated:`tag.created`,tagsDeleted:`tag.deleted`};async function mi(){let{values:{help:t,repo:n=await W()},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.
1768
-
1769
- By default, this command reads the repository from prismic.config.json at the
1770
- project root.
1771
-
1772
- USAGE
1773
- prismic webhook view <url> [flags]
1774
-
1775
- ARGUMENTS
1776
- <url> Webhook URL
1777
-
1778
- FLAGS
1779
- -r, --repo string Repository domain
1780
- -h, --help Show help for command
1781
-
1782
- LEARN MORE
1783
- 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 M()){hi();return}let i=await Q(n);if(!i.ok){i.error instanceof q?hi():(console.error(`Failed to view webhook: ${z(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(Z))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 hi(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const gi=E({config:E({_id:k(),url:k(),active:C(),name:w(k()),secret:w(k()),headers:O(k(),k()),documentsPublished:C(),documentsUnpublished:C(),releasesCreated:C(),releasesUpdated:C(),tagsCreated:C(),tagsDeleted:C()})});async function Q(e){return await K(new URL(`/app/settings/webhooks`,await F(e)),{schema:S(gi)})}async function _i(){let{values:{help:t,repo:n=await W()},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.
2306
+ 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.
1784
2307
 
1785
2308
  By default, this command reads the repository from prismic.config.json at the
1786
2309
  project root.
@@ -1796,7 +2319,7 @@ FLAGS
1796
2319
  -h, --help Show help for command
1797
2320
 
1798
2321
  LEARN MORE
1799
- 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 M()){vi();return}let i=await Q(n);if(!i.ok){i.error instanceof q?vi():(console.error(`Failed to enable webhook: ${z(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 $(n,a.config._id,o);if(!s.ok){s.error instanceof q?vi():(console.error(`Failed to enable webhook: ${z(s.value)}`),process.exitCode=1);return}console.info(`Webhook enabled: ${r}`)}async function $(e,t,n){let r=new URL(`/app/settings/webhooks/${t}`,await F(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 K(r,{method:`POST`,body:i})}function vi(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function yi(){let{values:{help:t,repo:n=await W()},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.
2322
+ 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.
1800
2323
 
1801
2324
  By default, this command reads the repository from prismic.config.json at the
1802
2325
  project root.
@@ -1814,7 +2337,7 @@ FLAGS
1814
2337
  -h, --help Show help for command
1815
2338
 
1816
2339
  LEARN MORE
1817
- 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 M()){bi();return}let o=await Q(n);if(!o.ok){o.error instanceof q?bi():(console.error(`Failed to add header: ${z(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 $(n,s.config._id,c);if(!l.ok){l.error instanceof q?bi():(console.error(`Failed to add header: ${z(l.value)}`),process.exitCode=1);return}console.info(`Header added: ${i}`)}function bi(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const xi=Object.values(Z);async function Si(){let{values:{help:t,repo:n=await W(),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.
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(!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.
1818
2341
 
1819
2342
  By default, this command reads the repository from prismic.config.json at the
1820
2343
  project root.
@@ -1843,7 +2366,7 @@ TRIGGERS
1843
2366
  If no triggers specified, all are enabled.
1844
2367
 
1845
2368
  LEARN MORE
1846
- 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(!xi.includes(e)){console.error(`Invalid trigger: ${e}`),console.error(`Valid triggers: ${xi.join(`, `)}`),process.exitCode=1;return}if(!await M()){wi();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(Z).find(([,t])=>e===t)??[];t&&(c[t]=!0)}let l=await Ci(n,{url:o,name:r??null,secret:i??null,...c});if(!l.ok){l.error instanceof q?wi():(console.error(`Failed to create webhook: ${z(l.value)}`),process.exitCode=1);return}console.info(`Webhook created: ${o}`)}async function Ci(e,t){let n=new URL(`/app/settings/webhooks/create`,await F(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 K(n,{method:`POST`,body:r})}function wi(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Ti(){let{values:{help:t,repo:n=await W()},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.
2369
+ 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.
1847
2370
 
1848
2371
  By default, this command reads the repository from prismic.config.json at the
1849
2372
  project root.
@@ -1859,7 +2382,7 @@ FLAGS
1859
2382
  -h, --help Show help for command
1860
2383
 
1861
2384
  LEARN MORE
1862
- 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 M()){Ei();return}let i=await Q(n);if(!i.ok){i.error instanceof q?Ei():(console.error(`Failed to disable webhook: ${z(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 $(n,a.config._id,o);if(!s.ok){s.error instanceof q?Ei():(console.error(`Failed to disable webhook: ${z(s.value)}`),process.exitCode=1);return}console.info(`Webhook disabled: ${r}`)}function Ei(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Di(){let{values:{help:t,repo:n=await W(),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.
2385
+ 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.
1863
2386
 
1864
2387
  By default, this command reads the repository from prismic.config.json at the
1865
2388
  project root.
@@ -1873,7 +2396,7 @@ FLAGS
1873
2396
  -h, --help Show help for command
1874
2397
 
1875
2398
  LEARN MORE
1876
- 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 M()){Oi();return}let i=await Q(n);if(!i.ok){i.error instanceof q?Oi():b(i.error)?(console.error(`Failed to list webhooks: Invalid response: ${z(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list webhooks: ${z(i.value)}`),process.exitCode=1);return}let a=i.value;if(r)console.info(z(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 Oi(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ki(){let{values:{help:t,repo:n=await W()},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.
2399
+ 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.
1877
2400
 
1878
2401
  By default, this command reads the repository from prismic.config.json at the
1879
2402
  project root.
@@ -1889,7 +2412,7 @@ FLAGS
1889
2412
  -h, --help Show help for command
1890
2413
 
1891
2414
  LEARN MORE
1892
- 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 M()){ji();return}let i=await Q(n);if(!i.ok){i.error instanceof q?ji():(console.error(`Failed to remove webhook: ${z(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 Ai(n,a.config._id);if(!o.ok){o.error instanceof q?ji():(console.error(`Failed to remove webhook: ${z(o.value)}`),process.exitCode=1);return}console.info(`Webhook removed: ${r}`)}async function Ai(e,t){return await K(new URL(`/app/settings/webhooks/${t}/delete`,await F(e)),{method:`POST`})}function ji(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Mi(){let{values:{help:t,repo:n=await W()},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.
2415
+ 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.
1893
2416
 
1894
2417
  By default, this command reads the repository from prismic.config.json at the
1895
2418
  project root.
@@ -1906,7 +2429,7 @@ FLAGS
1906
2429
  -h, --help Show help for command
1907
2430
 
1908
2431
  LEARN MORE
1909
- 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 M()){Ni();return}let a=await Q(n);if(!a.ok){a.error instanceof q?Ni():(console.error(`Failed to remove header: ${z(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 $(n,o.config._id,s);if(!c.ok){c.error instanceof q?Ni():(console.error(`Failed to remove header: ${z(c.value)}`),process.exitCode=1);return}console.info(`Header removed: ${i}`)}function Ni(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const Pi=Object.values(Z);async function Fi(){let{values:{help:t,repo:n=await W(),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.
2432
+ 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.
1910
2433
 
1911
2434
  By default, this command reads the repository from prismic.config.json at the
1912
2435
  project root.
@@ -1931,7 +2454,7 @@ TRIGGERS
1931
2454
  tag.deleted When a tag is deleted
1932
2455
 
1933
2456
  LEARN MORE
1934
- 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(!Pi.includes(e)){console.error(`Invalid trigger: ${e}`),console.error(`Valid triggers: ${Pi.join(`, `)}`),process.exitCode=1;return}if(!await M()){Ii();return}let a=await Q(n);if(!a.ok){a.error instanceof q?Ii():(console.error(`Failed to update webhook triggers: ${z(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(Z).find(([,t])=>e===t)??[];t&&(c[t]=!0)}let l=await $(n,o.config._id,{...o.config,...c});if(!l.ok){l.error instanceof q?Ii():(console.error(`Failed to update webhook triggers: ${z(l.value)}`),process.exitCode=1);return}console.info(`Webhook triggers updated: ${r.join(`, `)}`)}function Ii(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Li(){let{values:{help:t,repo:n=await W()},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.
2457
+ 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.
1935
2458
 
1936
2459
  By default, this command reads the repository from prismic.config.json at the
1937
2460
  project root.
@@ -1947,7 +2470,7 @@ FLAGS
1947
2470
  -h, --help Show help for command
1948
2471
 
1949
2472
  LEARN MORE
1950
- 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 M()){Ri();return}let i=await Q(n);if(!i.ok){i.error instanceof q?Ri():(console.error(`Failed to get webhook status: ${z(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 Ri(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function zi(){let{values:{help:t,repo:n=await W()},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.
2473
+ 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.
1951
2474
 
1952
2475
  By default, this command reads the repository from prismic.config.json at the
1953
2476
  project root.
@@ -1963,7 +2486,7 @@ FLAGS
1963
2486
  -h, --help Show help for command
1964
2487
 
1965
2488
  LEARN MORE
1966
- 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 M()){Vi();return}let i=await Q(n);if(!i.ok){i.error instanceof q?Vi():(console.error(`Failed to test webhook: ${z(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 Bi(n,a.config._id);if(!o.ok){o.error instanceof q?Vi():(console.error(`Failed to test webhook: ${z(o.value)}`),process.exitCode=1);return}console.info(`Test webhook triggered: ${r}`)}async function Bi(e,t){return await K(new URL(`/app/settings/webhooks/${t}/trigger`,await F(e)),{method:`POST`})}function Vi(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Hi(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`list`:await Di();break;case`create`:await Si();break;case`view`:await mi();break;case`remove`:await ki();break;case`test`:await zi();break;case`enable`:await _i();break;case`disable`:await Ti();break;case`status`:await Li();break;case`add-header`:await yi();break;case`remove-header`:await Mi();break;case`set-triggers`:await Fi();break;default:t&&(console.error(`Unknown webhook subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage webhooks in a Prismic repository.
2489
+ 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.
1967
2490
 
1968
2491
  USAGE
1969
2492
  prismic webhook <command> [flags]
@@ -1985,7 +2508,7 @@ FLAGS
1985
2508
  -h, --help Show help for command
1986
2509
 
1987
2510
  LEARN MORE
1988
- Use \`prismic webhook <command> --help\` for more information about a command.`)}}async function Ui(){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.
2511
+ 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.
1989
2512
 
1990
2513
  USAGE
1991
2514
  prismic whoami [flags]
@@ -1994,7 +2517,7 @@ FLAGS
1994
2517
  -h, --help Show help for command
1995
2518
 
1996
2519
  LEARN MORE
1997
- Use \`prismic <command> --help\` for more information about a command.`);return}if(!await M()){Gi();return}let n=await Wi();if(!n.ok){n.error instanceof q?Gi():console.error(`Failed to fetch user profile.`),process.exitCode=1;return}console.info(n.value.email)}async function Wi(){return await K(new URL(`profile`,await fe()),{schema:E({email:k()})})}function Gi(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const{positionals:Ki}=e({options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(Ki[0]){case`init`:await mt();break;case`login`:await jt();break;case`logout`:await Pt();break;case`whoami`:await Ui();break;case`repo`:await br();break;case`locale`:await At();break;case`page-type`:await Dn();break;case`custom-type`:await it();break;case`slice`:await qr();break;case`pull`:await er();break;case`push`:await rr();break;case`preview`:await Hn();break;case`token`:await pi();break;case`webhook`:await Hi();break;default:Ki[0]&&(console.error(`Unknown command: ${Ki[0]}`),process.exitCode=1),console.info(`Prismic CLI for managing repositories and configurations.
2520
+ 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.
1998
2521
 
1999
2522
  USAGE
2000
2523
  prismic <command> [flags]
@@ -2004,6 +2527,7 @@ COMMANDS
2004
2527
  login Log in to Prismic
2005
2528
  logout Log out of Prismic
2006
2529
  whoami Show the currently logged in user
2530
+ status Show the status of the current project
2007
2531
  repo Manage Prismic repositories
2008
2532
  locale Manage locales in a repository
2009
2533
  page-type Manage page types in a repository
@@ -2011,12 +2535,14 @@ COMMANDS
2011
2535
  slice Manage slices in a project
2012
2536
  pull Pull types and slices from Prismic
2013
2537
  push Push types and slices to Prismic
2538
+ codegen Generate code from Prismic models
2014
2539
  preview Manage preview configurations
2015
2540
  token Manage API tokens in a repository
2016
2541
  webhook Manage webhooks in a repository
2017
2542
 
2018
2543
  FLAGS
2019
- -h, --help Show help for command
2544
+ -v, --version Show CLI version
2545
+ -h, --help Show help for command
2020
2546
 
2021
2547
  LEARN MORE
2022
2548
  Use \`prismic <command> --help\` for more information about a command.`)}export{};