@angeloashmore/prismic-cli-poc 0.0.0-pr.4.484acb8 → 0.0.0-pr.5.f8fb51a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +114 -95
- package/package.json +1 -1
- package/src/docs.ts +149 -0
- package/src/index.ts +5 -0
- package/src/status.ts +49 -12
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{parseArgs as e}from"node:util";import{access as t,mkdir as n,readFile as r,readdir as i,rename as a,rm as o,writeFile as s}from"node:fs/promises";import*as c from"node:crypto";import{homedir as l}from"node:os";import{pathToFileURL as u}from"node:url";import{exec as d}from"node:child_process";import{createServer as f}from"node:http";var p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.prototype.hasOwnProperty,_=(e,t)=>()=>(e&&(t=e(e=0)),t),v=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),y=(e,t)=>{let n={};for(var r in e)p(n,r,{get:e[r],enumerable:!0});return t&&p(n,Symbol.toStringTag,{value:`Module`}),n},b=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=h(t),a=0,o=i.length,s;a<o;a++)s=i[a],!g.call(e,s)&&s!==n&&p(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=m(t,s))||r.enumerable});return e},x=e=>g.call(e,`module.exports`)?e[`module.exports`]:b(p({},`__esModule`,{value:!0}),e),ee=`0.0.0-pr.
|
|
2
|
+
import{parseArgs as e}from"node:util";import{access as t,mkdir as n,readFile as r,readdir as i,rename as a,rm as o,writeFile as s}from"node:fs/promises";import*as c from"node:crypto";import{homedir as l}from"node:os";import{pathToFileURL as u}from"node:url";import{exec as d}from"node:child_process";import{createServer as f}from"node:http";var p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.prototype.hasOwnProperty,_=(e,t)=>()=>(e&&(t=e(e=0)),t),v=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),y=(e,t)=>{let n={};for(var r in e)p(n,r,{get:e[r],enumerable:!0});return t&&p(n,Symbol.toStringTag,{value:`Module`}),n},b=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=h(t),a=0,o=i.length,s;a<o;a++)s=i[a],!g.call(e,s)&&s!==n&&p(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=m(t,s))||r.enumerable});return e},x=e=>g.call(e,`module.exports`)?e[`module.exports`]:b(p({},`__esModule`,{value:!0}),e),ee=`0.0.0-pr.5.f8fb51a`,te=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),r=i([``,``],[``,``]);function i(e,t){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function(){function e(){var t=this,n=[...arguments];return a(this,e),this.tag=function(e){var n=[...arguments].slice(1);return typeof e==`function`?t.interimTag.bind(t,e):typeof e==`string`?t.transformEndResult(e):(e=e.map(t.transformString.bind(t)),t.transformEndResult(e.reduce(t.processSubstitutions.bind(t,n))))},n.length>0&&Array.isArray(n[0])&&(n=n[0]),this.transformers=n.map(function(e){return typeof e==`function`?e():e}),this.tag}return n(e,[{key:`interimTag`,value:function(e,t){var n=[...arguments].slice(2);return this.tag(r,e.apply(void 0,[t].concat(n)))}},{key:`processSubstitutions`,value:function(e,t,n){return`${t}${this.transformSubstitution(e.shift(),t)}${n}`}},{key:`transformString`,value:function(e){return this.transformers.reduce(function(e,t){return t.onString?t.onString(e):e},e)}},{key:`transformSubstitution`,value:function(e,t){return this.transformers.reduce(function(e,n){return n.onSubstitution?n.onSubstitution(e,t):e},e)}},{key:`transformEndResult`,value:function(e){return this.transformers.reduce(function(e,t){return t.onEndResult?t.onEndResult(e):e},e)}}]),e}(),t.exports=e.default})),S=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(te());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ne=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``;return{onEndResult:function(t){if(e===``)return t.trim();if(e=e.toLowerCase(),e===`start`||e===`left`)return t.replace(/^\s*/,``);if(e===`end`||e===`right`)return t.replace(/\s*$/,``);throw Error(`Side not supported: `+e)}}},t.exports=e.default})),C=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ne());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),re=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});function n(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}else return Array.from(e)}e.default=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`initial`;return{onEndResult:function(t){if(e===`initial`){var r=t.match(/^[^\S\n]*(?=\S)/gm),i=r&&Math.min.apply(Math,n(r.map(function(e){return e.length})));if(i){var a=RegExp(`^.{`+i+`}`,`gm`);return t.replace(a,``)}return t}if(e===`all`)return t.replace(/^[^\S\n]+/gm,``);throw Error(`Unknown type: `+e)}}},t.exports=e.default})),w=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(re());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),T=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e,t){return{onEndResult:function(n){if(e==null||t==null)throw Error(`replaceResultTransformer requires at least 2 arguments.`);return n.replace(e,t)}}},t.exports=e.default})),ie=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(T());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ae=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e,t){return{onSubstitution:function(n,r){if(e==null||t==null)throw Error(`replaceSubstitutionTransformer requires at least 2 arguments.`);return n==null?n:n.toString().replace(e,t)}}},t.exports=e.default})),oe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ae());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),se=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e,t){return{onString:function(n){if(e==null||t==null)throw Error(`replaceStringTransformer requires at least 2 arguments.`);return n.replace(e,t)}}},t.exports=e.default})),ce=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(se());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),le=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n={separator:``,conjunction:``,serial:!1};e.default=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:n;return{onSubstitution:function(t,n){if(Array.isArray(t)){var r=t.length,i=e.separator,a=e.conjunction,o=e.serial,s=n.match(/(\n?[^\S\n]+)$/);if(t=s?t.join(i+s[1]):t.join(i+` `),a&&r>1){var c=t.lastIndexOf(i);t=t.slice(0,c)+(o?i:``)+` `+a+t.slice(c+1)}}return t}}},t.exports=e.default})),E=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(le());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ue=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e){return{onSubstitution:function(t,n){if(e!=null&&typeof e==`string`)typeof t==`string`&&t.includes(e)&&(t=t.split(e));else throw Error(`You need to specify a string character to split by.`);return t}}},t.exports=e.default})),de=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ue());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),fe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=function(e){return e!=null&&!Number.isNaN(e)&&typeof e!=`boolean`};e.default=function(){return{onSubstitution:function(e){return Array.isArray(e)?e.filter(n):n(e)?e:``}}},t.exports=e.default})),pe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(fe());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),me=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(w()),i=o(E()),a=o(C());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)({separator:`,`}),r.default,a.default),t.exports=e.default})),he=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(me());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ge=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(w()),i=o(E()),a=o(C());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)({separator:`,`,conjunction:`and`}),r.default,a.default),t.exports=e.default})),_e=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ge());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ve=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(w()),i=o(E()),a=o(C());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)({separator:`,`,conjunction:`or`}),r.default,a.default),t.exports=e.default})),ye=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ve());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),be=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=c(S()),r=c(w()),i=c(E()),a=c(C()),o=c(de()),s=c(pe());function c(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,o.default)(`
|
|
3
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
4
|
`),i.default,r.default,a.default,(0,s.default)(/&/g,`&`),(0,s.default)(/</g,`<`),(0,s.default)(/>/g,`>`),(0,s.default)(/"/g,`"`),(0,s.default)(/'/g,`'`),(0,s.default)(/`/g,```)),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
5
|
`))&&!t?.force?e:e+`
|
|
@@ -722,7 +722,25 @@ FLAGS
|
|
|
722
722
|
-h, --help Show help for command
|
|
723
723
|
|
|
724
724
|
LEARN MORE
|
|
725
|
-
Use \`prismic custom-type <command> --help\` for more information about a command.`)}}const Ir=`
|
|
725
|
+
Use \`prismic custom-type <command> --help\` for more information about a command.`)}}const Ir=`Fetch and display documentation from Prismic's docs site.
|
|
726
|
+
|
|
727
|
+
USAGE
|
|
728
|
+
prismic docs <path> [flags]
|
|
729
|
+
|
|
730
|
+
ARGUMENTS
|
|
731
|
+
path Documentation path with optional anchor (e.g., "nextjs" or "nextjs#set-up-a-prismic-client")
|
|
732
|
+
|
|
733
|
+
FLAGS
|
|
734
|
+
-h, --help Show help for command
|
|
735
|
+
|
|
736
|
+
EXAMPLES
|
|
737
|
+
prismic docs nextjs
|
|
738
|
+
prismic docs nextjs#set-up-a-prismic-client
|
|
739
|
+
|
|
740
|
+
LEARN MORE
|
|
741
|
+
Visit https://prismic.io/docs for the full documentation.`;function Lr(e){let t=e.indexOf(`#`);return t===-1?{path:e}:{path:e.slice(0,t),anchor:e.slice(t+1)}}async function Rr(e){try{let t=await fetch(e);return t.status===404?{ok:!1,error:`Documentation not found: ${e}`}:t.ok?{ok:!0,content:await t.text()}:{ok:!1,error:`Failed to fetch documentation: ${t.status}`}}catch(e){return{ok:!1,error:`Network error: ${e instanceof Error?e.message:String(e)}`}}}function zr(e){let t=e.split(`-`).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`[\\s-]+`);return RegExp(`^(#{1,6})\\s+${t}\\s*$`,`im`)}function Br(e,t){let n=e.split(`
|
|
742
|
+
`),r=zr(t),i=-1,a=0;for(let e=0;e<n.length;e++){let t=n[e].match(r);if(t){i=e,a=t[1].length;break}}if(i===-1)return{ok:!1,error:`Anchor not found: #${t}`};let o=n.length;for(let e=i+1;e<n.length;e++){let t=n[e].match(/^(#{1,6})\s/);if(t&&t[1].length<=a){o=e;break}}return{ok:!0,content:n.slice(i,o).join(`
|
|
743
|
+
`).trim()}}async function Vr(){let{positionals:[t],values:{help:n}}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(n){console.info(Ir);return}if(!t){console.info(Ir);return}let{path:r,anchor:i}=Lr(t),a=await Rr(`https://prismic.io/docs/${r}.md`);if(!a.ok){console.error(a.error),process.exitCode=1;return}let o=a.content;if(i){let e=Br(o,i);if(!e.ok){console.error(e.error),process.exitCode=1;return}o=e.content}console.info(o)}const Hr=`prismic.config.json`,Ur=F({repositoryName:R(),apiEndpoint:I(gn(R(),ln())),localSliceMachineSimulatorURL:I(gn(R(),ln())),libraries:I(N(R())),adapter:I(R()),labs:I(F({legacySliceUpgrader:I(P())}))});async function Wr(e,t=u(process.cwd())){let n=await Yr(t);return n.ok?(await s(n.path,q(e)),{ok:!0,config:e}):n}async function Y(e=u(process.cwd())){let t=await Gr(e);if(t.ok)return t.config.repositoryName}async function Gr(e=u(process.cwd())){let t=await Jr(e);if(!t.ok)return t;try{let e=await r(t.path,`utf8`),n=B(Ur,JSON.parse(e));return n.success?{ok:!0,config:n.output}:{ok:!1,error:new Kr(n.issues)}}catch{return{ok:!1,error:new Kr}}}var Kr=class extends Error{issues;constructor(e=[]){super(`prismic.config.json is invalid.`),this.issues=e}};async function qr(e,t=u(process.cwd())){let n=await Jr(t);if(!n.ok)return n;let r=await Gr(t);if(!r.ok)return r;let i={...r.config,...e};return await s(n.path,q(i)),{ok:!0,config:i}}async function Jr(e=u(process.cwd())){let t=await W(Hr,{start:e,stop:`package.json`});return t?{ok:!0,path:t}:{ok:!1,error:new Xr}}async function Yr(e=u(process.cwd())){let t=await W(`package.json`,{start:e});return t?{ok:!0,path:new URL(Hr,t)}:{ok:!1,error:new Zr}}var Xr=class extends Error{message=`Could not find a prismic.config.json file.`},Zr=class extends Error{message=`Could not find a package.json file.`};async function Qr(){let{values:t}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`},repo:{type:`string`,short:`r`}}});if(t.help){console.info(`Initialize a Prismic project by creating a prismic.config.json file.
|
|
726
744
|
|
|
727
745
|
Use this command to connect an existing Prismic repository to your project.
|
|
728
746
|
To create a new repository, use \`prismic repo create\` instead.
|
|
@@ -735,7 +753,7 @@ FLAGS
|
|
|
735
753
|
-h, --help Show help for command
|
|
736
754
|
|
|
737
755
|
LEARN MORE
|
|
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
|
|
756
|
+
Use \`prismic <command> --help\` for more information about a command.`);return}if(!t.repo){console.error(`Missing required flag: --repo`),process.exitCode=1;return}if((await Gr()).ok){console.error(`A prismic.config.json file already exists.`),process.exitCode=1;return}let n=await Wr({repositoryName:t.repo});if(!n.ok){n.error instanceof Zr?console.error(`Could not find a package.json file. Run this command from a project directory.`):console.error(`Failed to create config file.`),process.exitCode=1;return}console.info(`Created prismic.config.json for repository "${t.repo}"`)}async function X(e,t={}){let{credentials:n=`include`}=t,r=new Headers(t.headers);if(r.set(`Accept`,`application/json`),n===`include`){let e=await U();e&&r.set(`Cookie`,`SESSION=fake_session; prismic-auth=${e}`)}!r.has(`Content-Type`)&&t.body&&r.set(`Content-Type`,`application/json`),t.body instanceof FormData&&r.delete(`Content-Type`);let i=r.get(`Content-Type`)===`application/json`?JSON.stringify(t.body):t.body,a=await fetch(e,{...t,body:i,headers:r}),o=await a.clone().json().catch(()=>a.clone().text());if(a.ok){if(!t?.schema)return{ok:!0,value:o};try{return{ok:!0,value:hn(t.schema,o)}}catch(e){if(M(e))return{ok:!1,value:o,error:e};throw e}}else if(a.status===401)return{ok:!1,value:o,error:new Q(a)};else if(a.status===403)return{ok:!1,value:o,error:new Z(a)};else return{ok:!1,value:o,error:new $r(a)}}var $r=class extends Error{name=`RequestError`;response;constructor(e){super(`fetch failed: ${e.url}`),this.response=e}async text(){return this.response.clone().text()}async json(){return this.response.clone().json()}get status(){return this.response.status}get statusText(){return this.response.statusText}},Z=class extends $r{},Q=class extends $r{};async function ei(){let{values:{help:t,name:n,repo:r=await Y()},positionals:[i]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a new locale to a Prismic repository.
|
|
739
757
|
|
|
740
758
|
By default, this command reads the repository from prismic.config.json at the
|
|
741
759
|
project root.
|
|
@@ -752,7 +770,7 @@ FLAGS
|
|
|
752
770
|
-h, --help Show help for command
|
|
753
771
|
|
|
754
772
|
LEARN MORE
|
|
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()){
|
|
773
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!i){console.error(`Missing required argument: <code>`),process.exitCode=1;return}if(!r){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ri();return}let a=n?await ni(r,i,n):await ti(r,i);if(!a.ok){if(typeof a.value==`string`&&a.value.includes(`already existing languages`))return;a.error instanceof Z?ri():(console.error(`Failed to add locale: ${q(a.value)}`),process.exitCode=1);return}console.info(`Locale added: ${i}`)}async function ti(e,t){return await X(new URL(`/app/settings/multilanguages`,await V(e)),{method:`POST`,body:{languages:[t]}})}async function ni(e,t,n){let[r,i]=t.split(`-`);return await X(new URL(`/app/settings/multilanguages/custom`,await V(e)),{method:`POST`,body:{lang:{label:n,id:r||t},region:{label:n,id:i||r||t}}})}function ri(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ii(){let{values:{help:t,repo:n=await Y(),json:r}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`List all locales in a Prismic repository.
|
|
756
774
|
|
|
757
775
|
By default, this command reads the repository from prismic.config.json at the
|
|
758
776
|
project root.
|
|
@@ -766,7 +784,7 @@ FLAGS
|
|
|
766
784
|
-h, --help Show help for command
|
|
767
785
|
|
|
768
786
|
LEARN MORE
|
|
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()){
|
|
787
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){si();return}let i=await oi(n);if(!i.ok){i.error instanceof Z?si():M(i.error)?(console.error(`Failed to list locales: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list locales: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.results;if(r)console.info(q(a));else for(let e of a){let t=e.isMaster?` (default)`:``;console.info(`${e.id} ${e.label}${t}`)}}const ai=F({results:N(F({id:R(),label:R(),customName:pn(R()),isMaster:P()}))});async function oi(e){let t=new URL(`/locale/repository/locales`,await _n());return t.searchParams.set(`repository`,e),await X(t,{schema:ai})}function si(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ci(){let{values:{repo:t=await Y(),help:n},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(n){console.info(`Remove a locale from a Prismic repository.
|
|
770
788
|
|
|
771
789
|
By default, this command reads the repository from prismic.config.json at the
|
|
772
790
|
project root.
|
|
@@ -782,7 +800,7 @@ FLAGS
|
|
|
782
800
|
-h, --help Show help for command
|
|
783
801
|
|
|
784
802
|
LEARN MORE
|
|
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()){
|
|
803
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <code>`),process.exitCode=1;return}if(!t){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ui();return}let i=await li(t,r);if(!i.ok){i.error instanceof Z?ui():(console.error(`Failed to remove locale: ${q(i.value)}`),process.exitCode=1);return}console.info(`Removed locale: ${r}`)}async function li(e,t){let n=new URL(`/locale/repository/locales/${t}`,await _n());return n.searchParams.set(`repository`,e),await X(n,{method:`DELETE`})}function ui(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function di(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set the default locale for a Prismic repository.
|
|
786
804
|
|
|
787
805
|
By default, this command reads the repository from prismic.config.json at the
|
|
788
806
|
project root.
|
|
@@ -798,7 +816,7 @@ FLAGS
|
|
|
798
816
|
-h, --help Show help for command
|
|
799
817
|
|
|
800
818
|
LEARN MORE
|
|
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()){
|
|
819
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <code>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){pi();return}let i=await oi(n);if(!i.ok){i.error instanceof Z?pi():M(i.error)?(console.error(`Failed to set default locale: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to set default locale: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.results,o=a.find(e=>e.id===r);if(!o){console.error(`Locale "${r}" not found in repository. Available locales: ${a.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}if(o.isMaster){console.error(`Locale "${r}" is already the default.`),process.exitCode=1;return}let s=await fi(n,o);if(!s.ok){s.error instanceof Z?pi():(console.error(`Failed to set default locale: ${q(s.value)}`),process.exitCode=1);return}console.info(`Default locale set: ${r}`)}async function fi(e,t){let n=new URL(`/locale/repository/locales`,await _n());return n.searchParams.set(`repository`,e),await X(n,{method:`POST`,body:{id:t.id,label:t.label,customName:t.customName,isMaster:!0}})}function pi(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function mi(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`add`:await ei();break;case`list`:await ii();break;case`remove`:await ci();break;case`set-default`:await di();break;default:t&&(console.error(`Unknown locale subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage locales in a Prismic repository.
|
|
802
820
|
|
|
803
821
|
USAGE
|
|
804
822
|
prismic locale <command> [flags]
|
|
@@ -813,7 +831,7 @@ FLAGS
|
|
|
813
831
|
-h, --help Show help for command
|
|
814
832
|
|
|
815
833
|
LEARN MORE
|
|
816
|
-
Use \`prismic locale <command> --help\` for more information about a command.`)}}const
|
|
834
|
+
Use \`prismic locale <command> --help\` for more information about a command.`)}}const hi=`https://prismic.io`;async function gi(){let{values:t}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}}});if(t.help){console.info(`Log in to Prismic via browser.
|
|
817
835
|
|
|
818
836
|
USAGE
|
|
819
837
|
prismic login [flags]
|
|
@@ -822,7 +840,7 @@ FLAGS
|
|
|
822
840
|
-h, --help Show help for command
|
|
823
841
|
|
|
824
842
|
LEARN MORE
|
|
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":
|
|
843
|
+
Use \`prismic <command> --help\` for more information about a command.`);return}return new Promise((e,t)=>{let n=f((t,i)=>{if(t.method===`OPTIONS`){i.writeHead(204,{"Access-Control-Allow-Origin":hi,"Access-Control-Allow-Methods":`POST, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type`}),i.end();return}if(t.method===`POST`){let a=``;t.on(`data`,e=>{a+=e.toString()}),t.on(`end`,async()=>{try{let{cookies:t,email:o}=JSON.parse(a),s=t.find(e=>e.startsWith(`prismic-auth=`))?.split(`;`)[0]?.replace(/^prismic-auth=/,``);if(!s){i.writeHead(400,{"Access-Control-Allow-Origin":hi,"Content-Type":`application/json`}),i.end(JSON.stringify({error:`Invalid request`}));return}await Sn(s),console.info(`Logged in to Prismic as ${o}`),i.writeHead(200,{"Access-Control-Allow-Origin":hi,"Content-Type":`application/json`}),i.end(JSON.stringify({success:!0})),clearTimeout(r),n.close(),e()}catch{i.writeHead(400,{"Access-Control-Allow-Origin":hi,"Content-Type":`application/json`}),i.end(JSON.stringify({error:`Invalid request`}))}});return}i.writeHead(404),i.end()}),r=setTimeout(()=>{n.close(),t(Error(`Login timed out. Please try again.`))},18e4),i=()=>{let e=n.address();if(!e||typeof e==`string`){clearTimeout(r),n.close(),t(Error(`Failed to start login server`));return}let i=e.port,a=_i(i);console.info(`Opening browser to complete login...`),console.info(`If the browser doesn't open, visit: ${a}`),vi(a)};n.on(`error`,e=>{e.code===`EADDRINUSE`&&n.listening===!1?n.listen(0,`0.0.0.0`,i):(clearTimeout(r),t(e))}),n.listen(5555,`0.0.0.0`,i)})}function _i(e){let t=new URL(`https://prismic.io/dashboard/cli/login`);return t.searchParams.set(`source`,`slice-machine`),t.searchParams.set(`port`,e.toString()),t}function vi(e){d(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e.toString()}"`)}async function yi(){let{values:t}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}}});if(t.help){console.info(`Log out of Prismic.
|
|
826
844
|
|
|
827
845
|
USAGE
|
|
828
846
|
prismic logout [flags]
|
|
@@ -831,7 +849,7 @@ FLAGS
|
|
|
831
849
|
-h, --help Show help for command
|
|
832
850
|
|
|
833
851
|
LEARN MORE
|
|
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
|
|
852
|
+
Use \`prismic <command> --help\` for more information about a command.`);return}await Tn()?console.info(`Logged out of Prismic`):(console.error(`Logout failed. You can log out manually by deleting the file.`),process.exitCode=1)}const bi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function xi(){let{values:{help:t,tab:n,label:i,default:a,"true-label":o,"false-label":c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},default:{type:`boolean`},"true-label":{type:`string`},"false-label":{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a boolean (toggle) field to an existing page type.
|
|
835
853
|
|
|
836
854
|
USAGE
|
|
837
855
|
prismic page-type add-field boolean <type-id> <field-id> [flags]
|
|
@@ -857,7 +875,7 @@ EXAMPLES
|
|
|
857
875
|
prismic page-type add-field boolean article published --default
|
|
858
876
|
prismic page-type add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!d){console.error(`Missing required argument: type-id
|
|
859
877
|
`),console.error(`Usage: prismic page-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
|
|
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(
|
|
878
|
+
`),console.error(`Usage: prismic page-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}let p=await W(`package.json`);if(!p){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let m=new URL(`customtypes/${d}/index.json`,p),h;try{let e=await r(m,`utf8`),t=B(bi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${m.href}`),process.exitCode=1;return}h=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${d}\n`),console.error(`Create it first with: prismic page-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let g=Object.keys(h.json),_=n??g[0]??`Main`;h.json[_]||(h.json[_]={});for(let[e,t]of Object.entries(h.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let v={type:`Boolean`,config:{label:i??J(f),...a&&{default_value:!0},...o&&{placeholder_true:o},...c&&{placeholder_false:c}}};h.json[_][f]=v;try{await s(m,q(h))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Boolean) to "${_}" tab in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Si=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ci(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing page type.
|
|
861
879
|
|
|
862
880
|
USAGE
|
|
863
881
|
prismic page-type add-field color <type-id> <field-id> [flags]
|
|
@@ -881,7 +899,7 @@ EXAMPLES
|
|
|
881
899
|
prismic page-type add-field color homepage accent --tab "Design"
|
|
882
900
|
prismic page-type add-field color homepage text_color --label "Text Color"`);return}if(!l){console.error(`Missing required argument: type-id
|
|
883
901
|
`),console.error(`Usage: prismic page-type add-field color <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
|
|
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(
|
|
902
|
+
`),console.error(`Usage: prismic page-type add-field color <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Si,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Color`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Color) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const wi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ti(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date field to an existing page type.
|
|
885
903
|
|
|
886
904
|
USAGE
|
|
887
905
|
prismic page-type add-field date <type-id> <field-id> [flags]
|
|
@@ -906,7 +924,7 @@ EXAMPLES
|
|
|
906
924
|
prismic page-type add-field date event start_date --tab "Schedule"
|
|
907
925
|
prismic page-type add-field date article date --label "Publication Date" --default "2024-01-01"`);return}if(!u){console.error(`Missing required argument: type-id
|
|
908
926
|
`),console.error(`Usage: prismic page-type add-field date <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
|
|
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(
|
|
927
|
+
`),console.error(`Usage: prismic page-type add-field date <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(wi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${u}\n`),console.error(`Create it first with: prismic page-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Date`,config:{label:i??J(d),...a&&{placeholder:a},...o&&{default:o}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Date) to "${g}" tab in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Ei=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Di(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed field to an existing page type.
|
|
910
928
|
|
|
911
929
|
USAGE
|
|
912
930
|
prismic page-type add-field embed <type-id> <field-id> [flags]
|
|
@@ -930,7 +948,7 @@ EXAMPLES
|
|
|
930
948
|
prismic page-type add-field embed homepage youtube --tab "Media"
|
|
931
949
|
prismic page-type add-field embed homepage media --label "Media Embed"`);return}if(!l){console.error(`Missing required argument: type-id
|
|
932
950
|
`),console.error(`Usage: prismic page-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
|
|
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(
|
|
951
|
+
`),console.error(`Usage: prismic page-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Ei,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Embed`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Embed) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Oi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function ki(){let{values:{help:t,tab:n,label:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geo-point (location) field to an existing page type.
|
|
934
952
|
|
|
935
953
|
USAGE
|
|
936
954
|
prismic page-type add-field geo-point <type-id> <field-id> [flags]
|
|
@@ -953,7 +971,7 @@ EXAMPLES
|
|
|
953
971
|
prismic page-type add-field geo-point store address --tab "Details"
|
|
954
972
|
prismic page-type add-field geo-point event venue --label "Event Venue"`);return}if(!c){console.error(`Missing required argument: type-id
|
|
955
973
|
`),console.error(`Usage: prismic page-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
|
|
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(
|
|
974
|
+
`),console.error(`Usage: prismic page-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(Oi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${c}\n`),console.error(`Create it first with: prismic page-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`GeoPoint`,config:{label:i??J(l)}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${l}" (GeoPoint) to "${m}" tab in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Ai=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function ji(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing page type.
|
|
957
975
|
|
|
958
976
|
USAGE
|
|
959
977
|
prismic page-type add-field image <type-id> <field-id> [flags]
|
|
@@ -977,7 +995,7 @@ EXAMPLES
|
|
|
977
995
|
prismic page-type add-field image article thumbnail --tab "Media"
|
|
978
996
|
prismic page-type add-field image product photo --label "Product Photo"`);return}if(!l){console.error(`Missing required argument: type-id
|
|
979
997
|
`),console.error(`Usage: prismic page-type add-field image <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
|
|
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(
|
|
998
|
+
`),console.error(`Usage: prismic page-type add-field image <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Ai,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Image`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Image) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Mi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ni(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing page type.
|
|
981
999
|
|
|
982
1000
|
USAGE
|
|
983
1001
|
prismic page-type add-field key-text <type-id> <field-id> [flags]
|
|
@@ -1001,7 +1019,7 @@ EXAMPLES
|
|
|
1001
1019
|
prismic page-type add-field key-text homepage meta_title --tab "SEO"
|
|
1002
1020
|
prismic page-type add-field key-text homepage subtitle --label "Subtitle" --placeholder "Enter subtitle"`);return}if(!l){console.error(`Missing required argument: type-id
|
|
1003
1021
|
`),console.error(`Usage: prismic page-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
|
|
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(
|
|
1022
|
+
`),console.error(`Usage: prismic page-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Mi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Text`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Text) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Pi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Fi(){let{values:{help:t,tab:n,label:i,placeholder:a,variation:o,"allow-text":c,"allow-target-blank":l,repeatable:u,types:d,"no-types":f},positionals:[p,m]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},variation:{type:`string`,multiple:!0},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing page type.
|
|
1005
1023
|
|
|
1006
1024
|
USAGE
|
|
1007
1025
|
prismic page-type add-field link <type-id> <field-id> [flags]
|
|
@@ -1030,7 +1048,7 @@ EXAMPLES
|
|
|
1030
1048
|
prismic page-type add-field link homepage cta --variation Primary --variation Secondary
|
|
1031
1049
|
prismic page-type add-field link homepage links --repeatable`);return}if(!p){console.error(`Missing required argument: type-id
|
|
1032
1050
|
`),console.error(`Usage: prismic page-type add-field link <type-id> <field-id>`),process.exitCode=1;return}if(!m){console.error(`Missing required argument: field-id
|
|
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(
|
|
1051
|
+
`),console.error(`Usage: prismic page-type add-field link <type-id> <field-id>`),process.exitCode=1;return}let h=await W(`package.json`);if(!h){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let g=new URL(`customtypes/${p}/index.json`,h),_;try{let e=await r(g,`utf8`),t=B(Pi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${g.href}`),process.exitCode=1;return}_=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${p}\n`),console.error(`Create it first with: prismic page-type create ${p}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let v=Object.keys(_.json),y=n??v[0]??`Main`;_.json[y]||(_.json[y]={});for(let[e,t]of Object.entries(_.json))if(t[m]){console.error(`Field "${m}" already exists in tab "${e}"`),process.exitCode=1;return}let b={type:`Link`,config:{label:i??J(m),...a&&{placeholder:a},...o&&o.length>0&&{variants:o},...c&&{allowText:!0},...l&&{allowTargetBlank:!0},...u&&{repeat:!0}}};_.json[y][m]=b;try{await s(g,q(_))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${m}" (Link) to "${y}" tab in ${p}`),!f)try{await K({output:d}),console.info(`Updated types in ${d??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Ii=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Li(){let{values:{help:t,tab:n,label:i,placeholder:a,min:o,max:c,step:l,types:u,"no-types":d},positionals:[f,p]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},min:{type:`string`},max:{type:`string`},step:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing page type.
|
|
1034
1052
|
|
|
1035
1053
|
USAGE
|
|
1036
1054
|
prismic page-type add-field number <type-id> <field-id> [flags]
|
|
@@ -1057,7 +1075,7 @@ EXAMPLES
|
|
|
1057
1075
|
prismic page-type add-field number product quantity --min 0 --max 100
|
|
1058
1076
|
prismic page-type add-field number settings rating --min 1 --max 5 --step 1`);return}if(!f){console.error(`Missing required argument: type-id
|
|
1059
1077
|
`),console.error(`Usage: prismic page-type add-field number <type-id> <field-id>`),process.exitCode=1;return}if(!p){console.error(`Missing required argument: field-id
|
|
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(
|
|
1078
|
+
`),console.error(`Usage: prismic page-type add-field number <type-id> <field-id>`),process.exitCode=1;return}let m=o===void 0?void 0:Number(o),h=c===void 0?void 0:Number(c),g=l===void 0?void 0:Number(l);if(o!==void 0&&Number.isNaN(m)){console.error(`Invalid --min value: must be a number`),process.exitCode=1;return}if(c!==void 0&&Number.isNaN(h)){console.error(`Invalid --max value: must be a number`),process.exitCode=1;return}if(l!==void 0&&Number.isNaN(g)){console.error(`Invalid --step value: must be a number`),process.exitCode=1;return}let _=await W(`package.json`);if(!_){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let v=new URL(`customtypes/${f}/index.json`,_),y;try{let e=await r(v,`utf8`),t=B(Ii,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${v.href}`),process.exitCode=1;return}y=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${f}\n`),console.error(`Create it first with: prismic page-type create ${f}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let b=Object.keys(y.json),x=n??b[0]??`Main`;y.json[x]||(y.json[x]={});for(let[e,t]of Object.entries(y.json))if(t[p]){console.error(`Field "${p}" already exists in tab "${e}"`),process.exitCode=1;return}let ee={type:`Number`,config:{label:i??J(p),...a&&{placeholder:a},...m!==void 0&&{min:m},...h!==void 0&&{max:h},...g!==void 0&&{step:g}}};y.json[x][p]=ee;try{await s(v,q(y))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${p}" (Number) to "${x}" tab in ${f}`),!d)try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Ri=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function zi(){let{values:{help:t,tab:n,label:i,placeholder:a,single:o,multi:c,"allow-target-blank":l,types:u,"no-types":d},positionals:[f,p]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing page type.
|
|
1061
1079
|
|
|
1062
1080
|
USAGE
|
|
1063
1081
|
prismic page-type add-field rich-text <type-id> <field-id> [flags]
|
|
@@ -1090,7 +1108,7 @@ EXAMPLES
|
|
|
1090
1108
|
prismic page-type add-field rich-text page tagline --single "heading1"
|
|
1091
1109
|
prismic page-type add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!f){console.error(`Missing required argument: type-id
|
|
1092
1110
|
`),console.error(`Usage: prismic page-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}if(!p){console.error(`Missing required argument: field-id
|
|
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(
|
|
1111
|
+
`),console.error(`Usage: prismic page-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}let m=await W(`package.json`);if(!m){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let h=new URL(`customtypes/${f}/index.json`,m),g;try{let e=await r(h,`utf8`),t=B(Ri,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${h.href}`),process.exitCode=1;return}g=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${f}\n`),console.error(`Create it first with: prismic page-type create ${f}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let _=Object.keys(g.json),v=n??_[0]??`Main`;g.json[v]||(g.json[v]={});for(let[e,t]of Object.entries(g.json))if(t[p]){console.error(`Field "${p}" already exists in tab "${e}"`),process.exitCode=1;return}let y={type:`StructuredText`,config:{label:i??J(p),...a&&{placeholder:a},...o&&{single:o},...c&&{multi:c},...l&&{allowTargetBlank:!0}}};g.json[v][p]=y;try{await s(h,q(g))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${p}" (StructuredText) to "${v}" tab in ${f}`),!d)try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Bi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Vi(){let{values:{help:t,tab:n,label:i,placeholder:a,option:o,default:c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing page type.
|
|
1094
1112
|
|
|
1095
1113
|
USAGE
|
|
1096
1114
|
prismic page-type add-field select <type-id> <field-id> [flags]
|
|
@@ -1116,7 +1134,7 @@ EXAMPLES
|
|
|
1116
1134
|
prismic page-type add-field select product size --option "small" --option "medium" --option "large" --default "medium"
|
|
1117
1135
|
prismic page-type add-field select article status --option "draft" --option "published" --label "Status"`);return}if(!d){console.error(`Missing required argument: type-id
|
|
1118
1136
|
`),console.error(`Usage: prismic page-type add-field select <type-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
|
|
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(
|
|
1137
|
+
`),console.error(`Usage: prismic page-type add-field select <type-id> <field-id>`),process.exitCode=1;return}let p=await W(`package.json`);if(!p){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let m=new URL(`customtypes/${d}/index.json`,p),h;try{let e=await r(m,`utf8`),t=B(Bi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${m.href}`),process.exitCode=1;return}h=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${d}\n`),console.error(`Create it first with: prismic page-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let g=Object.keys(h.json),_=n??g[0]??`Main`;h.json[_]||(h.json[_]={});for(let[e,t]of Object.entries(h.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let v={type:`Select`,config:{label:i??J(f),...a&&{placeholder:a},...o&&o.length>0&&{options:o},...c&&{default_value:c}}};h.json[_][f]=v;try{await s(m,q(h))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Select) to "${_}" tab in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Hi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ui(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a timestamp (date and time) field to an existing page type.
|
|
1120
1138
|
|
|
1121
1139
|
USAGE
|
|
1122
1140
|
prismic page-type add-field timestamp <type-id> <field-id> [flags]
|
|
@@ -1141,7 +1159,7 @@ EXAMPLES
|
|
|
1141
1159
|
prismic page-type add-field timestamp event start --tab "Schedule"
|
|
1142
1160
|
prismic page-type add-field timestamp article published_at --label "Published At"`);return}if(!u){console.error(`Missing required argument: type-id
|
|
1143
1161
|
`),console.error(`Usage: prismic page-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
|
|
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(
|
|
1162
|
+
`),console.error(`Usage: prismic page-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(Hi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${u}\n`),console.error(`Create it first with: prismic page-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Timestamp`,config:{label:i??J(d),...a&&{placeholder:a},...o&&{default:o}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Timestamp) to "${g}" tab in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Wi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Gi(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a UID (unique identifier) field to an existing page type.
|
|
1145
1163
|
|
|
1146
1164
|
USAGE
|
|
1147
1165
|
prismic page-type add-field uid <type-id> <field-id> [flags]
|
|
@@ -1165,7 +1183,7 @@ EXAMPLES
|
|
|
1165
1183
|
prismic page-type add-field uid article slug --label "URL Slug"
|
|
1166
1184
|
prismic page-type add-field uid product sku --placeholder "Enter unique SKU"`);return}if(!l){console.error(`Missing required argument: type-id
|
|
1167
1185
|
`),console.error(`Usage: prismic page-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
|
|
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(
|
|
1186
|
+
`),console.error(`Usage: prismic page-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Wi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`UID`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (UID) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function Ki(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await xi();break;case`color`:await Ci();break;case`date`:await Ti();break;case`embed`:await Di();break;case`geo-point`:await ki();break;case`image`:await ji();break;case`key-text`:await Ni();break;case`link`:await Fi();break;case`number`:await Li();break;case`rich-text`:await zi();break;case`select`:await Vi();break;case`timestamp`:await Ui();break;case`uid`:await Gi();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing page type.
|
|
1169
1187
|
|
|
1170
1188
|
USAGE
|
|
1171
1189
|
prismic page-type add-field <field-type> <type-id> <field-id> [flags]
|
|
@@ -1195,7 +1213,7 @@ EXAMPLES
|
|
|
1195
1213
|
prismic page-type add-field key-text homepage meta_title --tab "SEO"
|
|
1196
1214
|
prismic page-type add-field link homepage button --allow-text
|
|
1197
1215
|
prismic page-type add-field rich-text homepage body --multi "paragraph,heading2,strong,em"
|
|
1198
|
-
prismic page-type add-field select homepage layout --option "full" --option "sidebar"`)}}const
|
|
1216
|
+
prismic page-type add-field select homepage layout --option "full" --option "sidebar"`)}}const qi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ji(){let{values:{help:t,"slice-zone":n,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Connect a shared slice to a page type's slice zone.
|
|
1199
1217
|
|
|
1200
1218
|
USAGE
|
|
1201
1219
|
prismic page-type connect-slice <type-id> <slice-id> [flags]
|
|
@@ -1217,7 +1235,7 @@ EXAMPLES
|
|
|
1217
1235
|
prismic page-type connect-slice homepage CallToAction --slice-zone slices
|
|
1218
1236
|
prismic page-type connect-slice article HeroSection -z body`);return}if(!o){console.error(`Missing required argument: type-id
|
|
1219
1237
|
`),console.error(`Usage: prismic page-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: slice-id
|
|
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(
|
|
1238
|
+
`),console.error(`Usage: prismic page-type connect-slice <type-id> <slice-id>`),process.exitCode=1;return}let l=await G(c);if(!l.ok){console.error(l.error),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${o}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(qi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${o}\n`),console.error(`Create it first with: prismic page-type create ${o}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let p=n??`slices`,m,h;for(let[,e]of Object.entries(f.json)){for(let[t,n]of Object.entries(e))if(n.type===`Slices`&&t===p){m=n,h=t;break}if(m)break}if(!m){if(n){console.error(`Slice zone "${n}" not found in page type "${o}"`),process.exitCode=1;return}let e=Object.keys(f.json)[0]??`Main`;f.json[e]||(f.json[e]={});let t={type:`Slices`,fieldset:`Slice Zone`,config:{choices:{}}};f.json[e][p]=t,m=t,h=p}if(m.config||={choices:{}},m.config.choices||(m.config.choices={}),c in m.config.choices){console.info(`Slice "${c}" is already connected to slice zone "${h}" in ${o}`);return}let g={type:`SharedSlice`};m.config.choices[c]=g;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Connected slice "${c}" to slice zone "${h}" in ${o}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Yi(){let{values:{help:t,name:r,single:i,types:a,"no-types":o},positionals:[c]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},single:{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Create a new page type in a Prismic repository.
|
|
1221
1239
|
|
|
1222
1240
|
USAGE
|
|
1223
1241
|
prismic page-type create <id> [flags]
|
|
@@ -1235,7 +1253,7 @@ FLAGS
|
|
|
1235
1253
|
-h, --help Show help for command
|
|
1236
1254
|
|
|
1237
1255
|
LEARN MORE
|
|
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??
|
|
1256
|
+
Use \`prismic page-type <command> --help\` for more information about a command.`);return}if(!c){console.error(`Missing required argument: id`),process.exitCode=1;return}let l={id:c,label:r??Xi(c),repeatable:!i,status:!0,format:`page`,json:{Main:{},"SEO & Metadata":{}}},u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/`,u),f=new URL(c+`/`,d),p=new URL(`index.json`,f);try{await n(new URL(`.`,p),{recursive:!0}),await s(p,q(l))}catch(e){e instanceof Error?console.error(`Failed to create page type: ${e.message}`):console.error(`Failed to create page type`),process.exitCode=1;return}if(console.info(`Created page type at ${p.href}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add fields with `prismic page-type add-field`")}function Xi(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}const Zi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Qi(){let{values:{help:t,"slice-zone":n,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Disconnect a shared slice from a page type's slice zone.
|
|
1239
1257
|
|
|
1240
1258
|
USAGE
|
|
1241
1259
|
prismic page-type disconnect-slice <type-id> <slice-id> [flags]
|
|
@@ -1257,7 +1275,7 @@ EXAMPLES
|
|
|
1257
1275
|
prismic page-type disconnect-slice homepage CallToAction --slice-zone slices
|
|
1258
1276
|
prismic page-type disconnect-slice article HeroSection -z body`);return}if(!o){console.error(`Missing required argument: type-id
|
|
1259
1277
|
`),console.error(`Usage: prismic page-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: slice-id
|
|
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(
|
|
1278
|
+
`),console.error(`Usage: prismic page-type disconnect-slice <type-id> <slice-id>`),process.exitCode=1;return}let l=await W(`package.json`);if(!l){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let u=new URL(`customtypes/${o}/index.json`,l),d;try{let e=await r(u,`utf8`),t=B(Zi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${u.href}`),process.exitCode=1;return}d=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${o}\n`),console.error(`Create it first with: prismic page-type create ${o}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let f=n??`slices`,p,m;for(let[,e]of Object.entries(d.json)){for(let[t,n]of Object.entries(e))if(n.type===`Slices`&&t===f){p=n,m=t;break}if(p)break}if(!p){console.error(`Slice zone "${f}" not found in page type "${o}"`),process.exitCode=1;return}if(!p.config?.choices||!(c in p.config.choices)){console.error(`Slice "${c}" is not connected to slice zone "${m}" in ${o}`),process.exitCode=1;return}delete p.config.choices[c];try{await s(u,q(d))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Disconnected slice "${c}" from slice zone "${m}" in ${o}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const $i=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function ea(){let{values:{help:t,json:n}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`List all page types in a Prismic project.
|
|
1261
1279
|
|
|
1262
1280
|
USAGE
|
|
1263
1281
|
prismic page-type list [flags]
|
|
@@ -1268,7 +1286,7 @@ FLAGS
|
|
|
1268
1286
|
|
|
1269
1287
|
EXAMPLES
|
|
1270
1288
|
prismic page-type list
|
|
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(
|
|
1289
|
+
prismic page-type list --json`);return}let a=await W(`package.json`);if(!a){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let o=new URL(`customtypes/`,a),s;try{s=await i(o,{withFileTypes:!1})}catch{n?console.info(JSON.stringify([])):console.info(`No page types found.`);return}let c=[];for(let e of s){let t=new URL(`${e}/index.json`,o);try{let e=await r(t,`utf8`),n=B($i,JSON.parse(e));n.success&&n.output.format===`page`&&c.push({id:n.output.id,label:n.output.label,repeatable:n.output.repeatable})}catch{}}if(c.length===0){n?console.info(JSON.stringify([])):console.info(`No page types found.`);return}if(n)console.info(JSON.stringify(c,null,2));else{console.info(`ID LABEL TYPE`);for(let e of c){let t=e.repeatable?`repeatable`:`singleton`;console.info(`${e.id}\t${e.label}\t${t}`)}}}const ta=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function na(){let{values:{help:t,y:n,types:i,"no-types":a},positionals:[s]}=e({args:process.argv.slice(4),options:{y:{type:`boolean`,short:`y`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a page type from the project.
|
|
1272
1290
|
|
|
1273
1291
|
USAGE
|
|
1274
1292
|
prismic page-type remove <type-id> [flags]
|
|
@@ -1287,7 +1305,7 @@ FLAGS
|
|
|
1287
1305
|
EXAMPLES
|
|
1288
1306
|
prismic page-type remove homepage
|
|
1289
1307
|
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(
|
|
1308
|
+
`),console.error(`Usage: prismic page-type remove <type-id>`),process.exitCode=1;return}let c=await W(`package.json`);if(!c){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let l=new URL(`customtypes/${s}/`,c),u=new URL(`index.json`,l),d;try{let e=await r(u,`utf8`),t=B(ta,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${u.href}`),process.exitCode=1;return}d=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${s}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}if(d.format!==`page`){console.error(`"${s}" is not a page type (format: ${d.format??`custom`})`),process.exitCode=1;return}if(!n){console.error(`Refusing to remove page type "${s}" (this will delete the entire directory).`),console.error(`Re-run with -y to confirm.`),process.exitCode=1;return}try{await o(l,{recursive:!0})}catch(e){e instanceof Error?console.error(`Failed to remove page type: ${e.message}`):console.error(`Failed to remove page type`),process.exitCode=1;return}if(console.info(`Removed page type "${s}"`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const ra=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function ia(){let{values:{help:t,tab:n,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{tab:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a field from a page type.
|
|
1291
1309
|
|
|
1292
1310
|
USAGE
|
|
1293
1311
|
prismic page-type remove-field <type-id> <field-id> [flags]
|
|
@@ -1308,7 +1326,7 @@ EXAMPLES
|
|
|
1308
1326
|
prismic page-type remove-field homepage title
|
|
1309
1327
|
prismic page-type remove-field homepage meta_title --tab "SEO & Metadata"`);return}if(!o){console.error(`Missing required argument: type-id
|
|
1310
1328
|
`),console.error(`Usage: prismic page-type remove-field <type-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
|
|
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(
|
|
1329
|
+
`),console.error(`Usage: prismic page-type remove-field <type-id> <field-id>`),process.exitCode=1;return}let l=await W(`package.json`);if(!l){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let u=new URL(`customtypes/${o}/index.json`,l),d;try{let e=await r(u,`utf8`),t=B(ra,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${u.href}`),process.exitCode=1;return}d=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${o}\n`),console.error(`Create it first with: prismic page-type create ${o}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}if(d.format!==`page`){console.error(`"${o}" is not a page type (format: ${d.format??`custom`})`),process.exitCode=1;return}let f;if(n){if(!d.json[n]){console.error(`Tab "${n}" not found in page type "${o}"`),console.error(`Available tabs: ${Object.keys(d.json).join(`, `)}`),process.exitCode=1;return}if(!(c in d.json[n])){console.error(`Field "${c}" not found in tab "${n}"`),process.exitCode=1;return}delete d.json[n][c],f=n}else{for(let[e,t]of Object.entries(d.json))if(c in t){delete t[c],f=e;break}if(!f){console.error(`Field "${c}" not found in any tab of page type "${o}"`),process.exitCode=1;return}}try{await s(u,q(d))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Removed field "${c}" from tab "${f}" in page type "${o}"`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const aa=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function oa(){let{values:{help:t,types:n,"no-types":i},positionals:[a,o]}=e({args:process.argv.slice(4),options:{types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Change a page type's display name (label).
|
|
1312
1330
|
|
|
1313
1331
|
USAGE
|
|
1314
1332
|
prismic page-type set-name <type-id> <new-name> [flags]
|
|
@@ -1328,7 +1346,7 @@ EXAMPLES
|
|
|
1328
1346
|
prismic page-type set-name homepage "Home Page"
|
|
1329
1347
|
prismic page-type set-name blog_post "Blog Post"`);return}if(!a){console.error(`Missing required argument: type-id
|
|
1330
1348
|
`),console.error(`Usage: prismic page-type set-name <type-id> <new-name>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: new-name
|
|
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(
|
|
1349
|
+
`),console.error(`Usage: prismic page-type set-name <type-id> <new-name>`),process.exitCode=1;return}let c=await W(`package.json`);if(!c){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let l=new URL(`customtypes/${a}/index.json`,c),u;try{let e=await r(l,`utf8`),t=B(aa,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${l.href}`),process.exitCode=1;return}u=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${a}\n`),console.error(`Create it first with: prismic page-type create ${a}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}if(u.format!==`page`){console.error(`"${a}" is not a page type (format: ${u.format??`custom`})`),process.exitCode=1;return}u.label=o;try{await s(l,q(u))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Renamed page type "${a}" to "${o}"`),!i)try{await K({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const sa=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function ca(){let{values:{help:t,types:n,"no-types":i},positionals:[a,o]}=e({args:process.argv.slice(4),options:{types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set whether a page type is repeatable.
|
|
1332
1350
|
|
|
1333
1351
|
USAGE
|
|
1334
1352
|
prismic page-type set-repeatable <type-id> <true|false> [flags]
|
|
@@ -1348,7 +1366,7 @@ EXAMPLES
|
|
|
1348
1366
|
prismic page-type set-repeatable homepage true
|
|
1349
1367
|
prismic page-type set-repeatable settings false`);return}if(!a){console.error(`Missing required argument: type-id
|
|
1350
1368
|
`),console.error(`Usage: prismic page-type set-repeatable <type-id> <true|false>`),process.exitCode=1;return}if(!o){console.error(`Missing required argument: true|false
|
|
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(
|
|
1369
|
+
`),console.error(`Usage: prismic page-type set-repeatable <type-id> <true|false>`),process.exitCode=1;return}if(o!==`true`&&o!==`false`){console.error(`Invalid value: "${o}". Must be "true" or "false".`),process.exitCode=1;return}let c=o===`true`,l=await W(`package.json`);if(!l){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let u=new URL(`customtypes/${a}/index.json`,l),d;try{let e=await r(u,`utf8`),t=B(sa,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${u.href}`),process.exitCode=1;return}d=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${a}\n`),console.error(`Create it first with: prismic page-type create ${a}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}if(d.format!==`page`){console.error(`"${a}" is not a page type (format: ${d.format??`custom`})`),process.exitCode=1;return}d.repeatable=c;try{await s(u,q(d))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}let f=c?`repeatable`:`singleton`;if(console.info(`Set page type "${a}" to ${f}`),!i)try{await K({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const la=F({id:R(),label:R(),repeatable:P(),status:P(),format:I(R()),json:L(R(),L(R(),z()))});async function ua(){let{values:{help:t,json:n},positionals:[i]}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`View details of a specific page type.
|
|
1352
1370
|
|
|
1353
1371
|
USAGE
|
|
1354
1372
|
prismic page-type view <type-id> [flags]
|
|
@@ -1363,7 +1381,7 @@ FLAGS
|
|
|
1363
1381
|
EXAMPLES
|
|
1364
1382
|
prismic page-type view homepage
|
|
1365
1383
|
prismic page-type view homepage --json`);return}if(!i){console.error(`Missing required argument: type-id
|
|
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(
|
|
1384
|
+
`),console.error(`Usage: prismic page-type view <type-id>`),process.exitCode=1;return}let a=await W(`package.json`);if(!a){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let o=new URL(`customtypes/${i}/index.json`,a),s;try{let e=await r(o,`utf8`),t=B(la,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${o.href}`),process.exitCode=1;return}s=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${i}\n`),console.error(`Create it first with: prismic page-type create ${i}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}if(s.format!==`page`){console.error(`"${i}" is not a page type (format: ${s.format??`custom`})`),process.exitCode=1;return}if(n){console.info(JSON.stringify(s,null,2));return}console.info(`ID: ${s.id}`),console.info(`Label: ${s.label}`),console.info(`Repeatable: ${s.repeatable}`);let c=Object.entries(s.json);console.info(`\nTabs (${c.length}):`);for(let[e,t]of c){let n=Object.keys(t).length;console.info(` - ${e}: ${n} fields`)}}async function da(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`create`:await Yi();break;case`list`:await ea();break;case`view`:await ua();break;case`remove`:await na();break;case`set-name`:await oa();break;case`set-repeatable`:await ca();break;case`add-field`:await Ki();break;case`remove-field`:await ia();break;case`connect-slice`:await Ji();break;case`disconnect-slice`:await Qi();break;default:t&&(console.error(`Unknown page-type subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage page types in a Prismic repository.
|
|
1367
1385
|
|
|
1368
1386
|
USAGE
|
|
1369
1387
|
prismic page-type <command> [flags]
|
|
@@ -1384,7 +1402,7 @@ FLAGS
|
|
|
1384
1402
|
-h, --help Show help for command
|
|
1385
1403
|
|
|
1386
1404
|
LEARN MORE
|
|
1387
|
-
Use \`prismic page-type <command> --help\` for more information about a command.`)}}async function
|
|
1405
|
+
Use \`prismic page-type <command> --help\` for more information about a command.`)}}async function fa(){let{values:{help:t,name:n,repo:r=await Y()},positionals:[i]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a preview configuration to a Prismic repository.
|
|
1388
1406
|
|
|
1389
1407
|
By default, this command reads the repository from prismic.config.json at the
|
|
1390
1408
|
project root.
|
|
@@ -1401,7 +1419,7 @@ FLAGS
|
|
|
1401
1419
|
-h, --help Show help for command
|
|
1402
1420
|
|
|
1403
1421
|
LEARN MORE
|
|
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()){
|
|
1422
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!i){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!r){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ha();return}let a=pa(i);if(!a){console.error(`Invalid URL: ${i}`),process.exitCode=1;return}let o=await ma(r,{name:n||a.hostname,websiteURL:a.websiteURL,resolverPath:a.resolverPath});if(!o.ok){o.error instanceof Z?ha():(console.error(`Failed to add preview: ${q(o.value)}`),process.exitCode=1);return}console.info(`Preview added: ${i}`)}function pa(e){try{let t=new URL(e);return{websiteURL:`${t.protocol}//${t.host}`,resolverPath:t.pathname===`/`?void 0:t.pathname,hostname:t.hostname}}catch{return}}async function ma(e,t){return await X(new URL(`/previews/new`,await V(e)),{method:`POST`,body:{name:t.name,websiteURL:t.websiteURL,resolverPath:t.resolverPath}})}function ha(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ga(){let{values:{help:t,repo:n=await Y(),json:r}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Show the slice simulator URL for a Prismic repository.
|
|
1405
1423
|
|
|
1406
1424
|
By default, this command reads the repository from prismic.config.json at the
|
|
1407
1425
|
project root.
|
|
@@ -1415,7 +1433,7 @@ FLAGS
|
|
|
1415
1433
|
-h, --help Show help for command
|
|
1416
1434
|
|
|
1417
1435
|
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()){
|
|
1436
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ya();return}let i=await va(n);if(!i.ok){i.error instanceof Z?ya():M(i.error)?(console.error(`Failed to get simulator URL: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to get simulator URL: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.simulator_url;if(!a){r?console.info(q({simulator_url:null})):console.info(`No simulator URL configured.`);return}r?console.info(q({simulator_url:a})):console.info(a)}const _a=F({simulator_url:I(R())});async function va(e){return await X(new URL(`/core/repository`,await V(e)),{schema:_a})}function ya(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function ba(){let{values:{help:t,repo:n=await Y(),json:r}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`List all preview configurations in a Prismic repository.
|
|
1419
1437
|
|
|
1420
1438
|
By default, this command reads the repository from prismic.config.json at the
|
|
1421
1439
|
project root.
|
|
@@ -1429,7 +1447,7 @@ FLAGS
|
|
|
1429
1447
|
-h, --help Show help for command
|
|
1430
1448
|
|
|
1431
1449
|
LEARN MORE
|
|
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()){
|
|
1450
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ca();return}let i=await Sa(n);if(!i.ok){i.error instanceof Z?Ca():M(i.error)?(console.error(`Failed to list previews: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list previews: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.results;if(r)console.info(q(a));else for(let e of a)console.info(`${e.url} ${e.label}`)}const xa=F({results:N(F({id:R(),label:R(),url:R()}))});async function Sa(e){return await X(new URL(`/core/repository/preview_configs`,await V(e)),{schema:xa})}function Ca(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function wa(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a preview configuration from a Prismic repository.
|
|
1433
1451
|
|
|
1434
1452
|
By default, this command reads the repository from prismic.config.json at the
|
|
1435
1453
|
project root.
|
|
@@ -1445,7 +1463,7 @@ FLAGS
|
|
|
1445
1463
|
-h, --help Show help for command
|
|
1446
1464
|
|
|
1447
1465
|
LEARN MORE
|
|
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()){
|
|
1466
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ea();return}let i=await Sa(n);if(!i.ok){i.error instanceof Z?Ea():(console.error(`Failed to fetch previews: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.results.find(e=>e.url===r);if(!a){console.error(`Preview not found: ${r}`),process.exitCode=1;return}let o=await Ta(n,a.id);if(!o.ok){o.error instanceof Z?Ea():(console.error(`Failed to remove preview: ${q(o.value)}`),process.exitCode=1);return}console.info(`Preview removed: ${r}`)}async function Ta(e,t){return await X(new URL(`/previews/delete/${t}`,await V(e)),{method:`POST`,body:{}})}function Ea(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Da(){let{values:{help:t,repo:n=await Y()}}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Remove the slice simulator URL from a Prismic repository.
|
|
1449
1467
|
|
|
1450
1468
|
By default, this command reads the repository from prismic.config.json at the
|
|
1451
1469
|
project root.
|
|
@@ -1458,7 +1476,7 @@ FLAGS
|
|
|
1458
1476
|
-h, --help Show help for command
|
|
1459
1477
|
|
|
1460
1478
|
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()){
|
|
1479
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ka();return}let r=await Oa(n);if(!r.ok){r.error instanceof Z?ka():(console.error(`Failed to remove simulator URL: ${q(r.value)}`),process.exitCode=1);return}console.info(`Simulator URL removed.`)}async function Oa(e){return await X(new URL(`/core/repository`,await V(e)),{method:`PATCH`,body:{simulator_url:``}})}function ka(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Aa(){let{values:{help:t,repo:n=await Y()},positionals:[r,i]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Update the name of a preview configuration.
|
|
1462
1480
|
|
|
1463
1481
|
By default, this command reads the repository from prismic.config.json at the
|
|
1464
1482
|
project root.
|
|
@@ -1475,7 +1493,7 @@ FLAGS
|
|
|
1475
1493
|
-h, --help Show help for command
|
|
1476
1494
|
|
|
1477
1495
|
LEARN MORE
|
|
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()){
|
|
1496
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: <name>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ma();return}let a=pa(r);if(!a){console.error(`Invalid URL: ${r}`),process.exitCode=1;return}let o=await Sa(n);if(!o.ok){o.error instanceof Z?Ma():(console.error(`Failed to fetch previews: ${q(o.value)}`),process.exitCode=1);return}let s=o.value.results.find(e=>e.url===r);if(!s){console.error(`Preview not found: ${r}`),process.exitCode=1;return}let c=await ja(n,s.id,{name:i,websiteURL:a.websiteURL,resolverPath:a.resolverPath});if(!c.ok){c.error instanceof Z?Ma():(console.error(`Failed to update preview: ${q(c.value)}`),process.exitCode=1);return}console.info(`Preview updated: ${r}`)}async function ja(e,t,n){return await X(new URL(`/previews/save/${t}`,await V(e)),{method:`POST`,body:{name:n.name,websiteURL:n.websiteURL,resolverPath:n.resolverPath}})}function Ma(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Na(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set the slice simulator URL for a Prismic repository.
|
|
1479
1497
|
|
|
1480
1498
|
If the URL pathname does not end with /slice-simulator, it is appended
|
|
1481
1499
|
automatically.
|
|
@@ -1498,7 +1516,7 @@ EXAMPLES
|
|
|
1498
1516
|
prismic preview set-simulator http://localhost:3000/slice-simulator
|
|
1499
1517
|
|
|
1500
1518
|
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()){
|
|
1519
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ia();return}let i=Pa(r);if(!i){console.error(`Invalid URL: ${r}`),process.exitCode=1;return}let a=await Fa(n,i);if(!a.ok){a.error instanceof Z?Ia():(console.error(`Failed to set simulator URL: ${q(a.value)}`),process.exitCode=1);return}console.info(`Simulator URL set: ${i}`)}function Pa(e){try{let t=new URL(e);return t.pathname.endsWith(`/slice-simulator`)||(t.pathname=t.pathname.replace(/\/+$/,``)+`/slice-simulator`),t.toString()}catch{return}}async function Fa(e,t){return await X(new URL(`/core/repository`,await V(e)),{method:`PATCH`,body:{simulator_url:t}})}function Ia(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function La(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`add`:await fa();break;case`list`:await ba();break;case`remove`:await wa();break;case`set-name`:await Aa();break;case`set-simulator`:await Na();break;case`get-simulator`:await ga();break;case`remove-simulator`:await Da();break;default:t&&(console.error(`Unknown preview subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage preview configurations in a Prismic repository.
|
|
1502
1520
|
|
|
1503
1521
|
USAGE
|
|
1504
1522
|
prismic preview <command> [flags]
|
|
@@ -1516,7 +1534,7 @@ FLAGS
|
|
|
1516
1534
|
-h, --help Show help for command
|
|
1517
1535
|
|
|
1518
1536
|
LEARN MORE
|
|
1519
|
-
Use \`prismic preview <command> --help\` for more information about a command.`)}}async function
|
|
1537
|
+
Use \`prismic preview <command> --help\` for more information about a command.`)}}async function Ra(){let{values:{help:t,repo:r=await Y(),"dry-run":i,"types-only":a,"slices-only":o,json:c,types:l,"no-types":u}}=e({args:process.argv.slice(3),options:{repo:{type:`string`,short:`r`},"dry-run":{type:`boolean`},"types-only":{type:`boolean`},"slices-only":{type:`boolean`},json:{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Pull custom types and slices from Prismic to local files.
|
|
1520
1538
|
|
|
1521
1539
|
By default, this command reads the repository from prismic.config.json at the
|
|
1522
1540
|
project root.
|
|
@@ -1540,9 +1558,9 @@ EXAMPLES
|
|
|
1540
1558
|
prismic pull
|
|
1541
1559
|
prismic pull --repo my-repo
|
|
1542
1560
|
prismic pull --dry-run
|
|
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=
|
|
1561
|
+
prismic pull --types-only`);return}if(!r){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1;return}c||console.info(`Pulling from repository: ${r}\n`);let d=!o,f=!a,[p,m]=await Promise.all([d?Pn(r):Promise.resolve({ok:!0,value:[]}),f?Fn(r):Promise.resolve({ok:!0,value:[]})]);if(!p.ok){console.error(`Failed to fetch custom types: ${p.error}`),process.exitCode=1;return}if(!m.ok){console.error(`Failed to fetch slices: ${m.error}`),process.exitCode=1;return}let h=p.value,g=m.value;if(c||(d&&console.info(`Fetching custom types... ${h.length} types`),f&&console.info(`Fetching slices... ${g.length} slices`)),i){if(c)console.info(q({customTypes:h,slices:g}));else{if(console.info(``),d&&h.length>0){console.info(`Would write custom types:`);for(let e of h)console.info(` customtypes/${e.id}/index.json`)}if(f&&g.length>0){let e=za(await On());console.info(`Would write slices:`);for(let t of g)console.info(` ${e}${jn(t.name)}/model.json`)}console.info(`\nDry run complete: ${h.length} custom types, ${g.length} slices`)}return}let _=await W(`package.json`);if(!_){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let v=new URL(`.`,_),y=[],b=[];if(d&&h.length>0){c||console.info(`
|
|
1544
1562
|
Writing custom types:`);let e=new URL(`customtypes/`,v);for(let t of h){let r=new URL(`${t.id}/`,e),i=new URL(`index.json`,r);try{await n(r,{recursive:!0}),await s(i,q(t));let e=`customtypes/${t.id}/index.json`;y.push(e),c||console.info(` ${e}`)}catch(e){console.error(`Failed to write custom type ${t.id}: ${e instanceof Error?e.message:e}`),process.exitCode=1;return}}}if(f&&g.length>0){c||console.info(`
|
|
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=`${
|
|
1563
|
+
Writing slices:`);let e=await On();for(let t of g){let r=new URL(`${jn(t.name)}/`,e),i=new URL(`model.json`,r);try{await n(r,{recursive:!0}),await s(i,q(t));let a=`${za(e)}${jn(t.name)}/model.json`;b.push(a),c||console.info(` ${a}`)}catch(e){console.error(`Failed to write slice ${t.name}: ${e instanceof Error?e.message:e}`),process.exitCode=1;return}}}if(c?console.info(q({writtenTypes:y,writtenSlices:b})):console.info(`\nPull complete: ${y.length} custom types, ${b.length} slices`),!c&&!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}function za(e){let t=process.cwd(),n=e.pathname;return n.startsWith(t)?n.slice(t.length+1):n}function Ba(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map(t.map(e=>[e.id,e])),i=[],a=[],o=[];for(let t of e){let e=r.get(t.id);e?JSON.stringify(t)!==JSON.stringify(e)&&a.push(t):i.push(t)}for(let e of t)n.has(e.id)||o.push(e.id);return{toInsert:i,toUpdate:a,toDelete:o}}async function Va(){let{values:{help:t,repo:n=await Y(),"dry-run":r,"types-only":i,"slices-only":a,delete:o,json:s}}=e({args:process.argv.slice(3),options:{repo:{type:`string`,short:`r`},"dry-run":{type:`boolean`},"types-only":{type:`boolean`},"slices-only":{type:`boolean`},delete:{type:`boolean`},json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Push custom types and slices to Prismic from local files.
|
|
1546
1564
|
|
|
1547
1565
|
By default, this command reads the repository from prismic.config.json at the
|
|
1548
1566
|
project root.
|
|
@@ -1564,10 +1582,10 @@ EXAMPLES
|
|
|
1564
1582
|
prismic push --repo my-repo
|
|
1565
1583
|
prismic push --dry-run
|
|
1566
1584
|
prismic push --types-only
|
|
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?
|
|
1585
|
+
prismic push --delete`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1;return}s||console.info(`Pushing to repository: ${n}\n`);let c=!a,l=!i,[u,d,f,p]=await Promise.all([c?In():Promise.resolve({ok:!0,value:[]}),l?Ln():Promise.resolve({ok:!0,value:[]}),c?Pn(n):Promise.resolve({ok:!0,value:[]}),l?Fn(n):Promise.resolve({ok:!0,value:[]})]);if(!u.ok){console.error(`Failed to read local custom types: ${u.error}`),process.exitCode=1;return}if(!d.ok){console.error(`Failed to read local slices: ${d.error}`),process.exitCode=1;return}if(!f.ok){console.error(`Failed to fetch remote custom types: ${f.error}`),process.exitCode=1;return}if(!p.ok){console.error(`Failed to fetch remote slices: ${p.error}`),process.exitCode=1;return}let m=u.value,h=d.value,g=f.value,_=p.value;s||(c&&(console.info(`Local custom types: ${m.length}`),console.info(`Remote custom types: ${g.length}`)),l&&(console.info(`Local slices: ${h.length}`),console.info(`Remote slices: ${_.length}`)));let v=c?Ba([...m],[...g]):{toInsert:[],toUpdate:[],toDelete:[]},y=l?Ba([...h],[..._]):{toInsert:[],toUpdate:[],toDelete:[]};o||(v.toDelete=[],y.toDelete=[]);let b=v.toInsert.length+v.toUpdate.length+v.toDelete.length+y.toInsert.length+y.toUpdate.length+y.toDelete.length;if(b===0){s?console.info(q({customTypes:{inserted:[],updated:[],deleted:[]},slices:{inserted:[],updated:[],deleted:[]}})):console.info(`
|
|
1568
1586
|
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
1587
|
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
|
|
1588
|
+
Pushing slices:`);for(let e of y.toInsert){let t=await Vn(n,e);if(!t.ok){console.error(`Failed to insert slice ${e.id}: ${t.error}`),process.exitCode=1;return}x.slices.inserted.push(e.id),s||console.info(` + ${e.id}`)}for(let e of y.toUpdate){let t=await Hn(n,e);if(!t.ok){console.error(`Failed to update slice ${e.id}: ${t.error}`),process.exitCode=1;return}x.slices.updated.push(e.id),s||console.info(` ~ ${e.id}`)}for(let e of y.toDelete){let t=await Un(n,e);if(!t.ok){console.error(`Failed to delete slice ${e}: ${t.error}`),process.exitCode=1;return}x.slices.deleted.push(e),s||console.info(` - ${e}`)}}if(s)console.info(q(x));else{let e=x.customTypes.inserted.length+x.customTypes.updated.length+x.customTypes.deleted.length+x.slices.inserted.length+x.slices.updated.length+x.slices.deleted.length;console.info(`\nPush complete: ${e} changes`)}}const Ha=/^[a-zA-Z0-9][-a-zA-Z0-9]{2,}[a-zA-Z0-9]$/;async function Ua(){let{values:{help:t,name:n,"no-config":r,replace:i},positionals:[a]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`},name:{type:`string`,short:`n`},"no-config":{type:`boolean`},replace:{type:`boolean`}},allowPositionals:!0});if(t){console.info(`Create a new Prismic repository.
|
|
1571
1589
|
|
|
1572
1590
|
Creates prismic.config.json in the current directory. If a config file already
|
|
1573
1591
|
exists, use --replace to update it with the new repository.
|
|
@@ -1586,7 +1604,7 @@ FLAGS
|
|
|
1586
1604
|
-h, --help Show help for command
|
|
1587
1605
|
|
|
1588
1606
|
LEARN MORE
|
|
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(!
|
|
1607
|
+
Use \`prismic repo <command> --help\` for more information about a command.`);return}if(!a){console.error(`Missing required argument: domain`),process.exitCode=1;return}if(!Ha.test(a)){console.error(`Invalid domain format.`),console.error(`Must be at least 4 characters, start and end with alphanumeric, and contain only alphanumerics and hyphens.`),process.exitCode=1;return}if(!await H()){Ga();return}let o=await Gr();if(!r&&o.ok&&!i){console.error(`This project already has a repository: ${o.config.repositoryName}`),console.error(`Use --replace to replace it, or --no-config to skip config creation.`),process.exitCode=1;return}let s=await Wa(a,n);if(!s.ok){s.error instanceof Z?Ga():(console.error(`Failed to create repository: ${q(s.error)}`),process.exitCode=1);return}if(!r)if(o.ok){let e=await qr({repositoryName:a});e.ok?console.info(`Updated prismic.config.json`):console.warn(`Could not update prismic.config.json: `+e.error.message)}else{let e=await Wr({repositoryName:a});e.ok?console.info(`Created prismic.config.json`):console.warn(`Could not create prismic.config.json: `+e.error.message)}console.info(`Repository created: ${a}`),console.info(`URL: ${await V(a)}`)}async function Wa(e,t=e){return await X(new URL(`/app/dashboard/repositories`,await Cn()),{method:`POST`,body:{domain:e,name:t,framework:`next`,plan:`personal`,usageIntent:`Exploring Prismic's features for future projects.`,usageIntentIndex:0}})}function Ga(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const Ka=F({repository:F({api_access:R()})});async function qa(){let{values:{help:t,repo:n=await Y()}}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Get the Content API access level of a Prismic repository.
|
|
1590
1608
|
|
|
1591
1609
|
By default, this command reads the repository from prismic.config.json at the
|
|
1592
1610
|
project root.
|
|
@@ -1599,7 +1617,7 @@ FLAGS
|
|
|
1599
1617
|
-h, --help Show help for command
|
|
1600
1618
|
|
|
1601
1619
|
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()){
|
|
1620
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ya();return}let r=await Ja(n);if(!r.ok){r.error instanceof Z?Ya():(console.error(`Failed to get repository access: ${q(r.value)}`),process.exitCode=1);return}console.info(r.value.repository.api_access)}async function Ja(e){let t=await V(e);return await X(new URL(`syncState`,t),{schema:Ka})}function Ya(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const Xa=F({repositories:N(F({domain:R(),name:I(R()),role:R()}))});async function Za(){let{values:{help:t,json:n}}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`},json:{type:`boolean`}}});if(t){console.info(`List all Prismic repositories.
|
|
1603
1621
|
|
|
1604
1622
|
USAGE
|
|
1605
1623
|
prismic repo list [flags]
|
|
@@ -1609,7 +1627,7 @@ FLAGS
|
|
|
1609
1627
|
-h, --help Show help for command
|
|
1610
1628
|
|
|
1611
1629
|
LEARN MORE
|
|
1612
|
-
Use \`prismic repo <command> --help\` for more information about a command.`);return}if(!await H()){
|
|
1630
|
+
Use \`prismic repo <command> --help\` for more information about a command.`);return}if(!await H()){$a();return}let r=await Qa();if(!r.ok){r.error instanceof Z?$a():(console.error(`Failed to fetch repositories: ${q(r.value)}`),process.exitCode=1);return}let i=r.value.repositories;if(n){let e=await Promise.all(i.map(async e=>({domain:e.domain,name:e.name||null,role:e.role,url:(await V(e.domain)).toString()})));console.info(q(e));return}if(i.length===0){console.info(`No repositories found.`);return}for(let e of i){let t=e.name||`(no name)`;console.info(`${e.domain} ${t} ${e.role}`)}}async function Qa(){return await X(new URL(`profile`,await vn()),{schema:Xa})}function $a(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const eo=[`private`,`public`,`open`];async function to(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set the Content API access level of a Prismic repository.
|
|
1613
1631
|
|
|
1614
1632
|
By default, this command reads the repository from prismic.config.json at the
|
|
1615
1633
|
project root.
|
|
@@ -1625,7 +1643,7 @@ FLAGS
|
|
|
1625
1643
|
-h, --help Show help for command
|
|
1626
1644
|
|
|
1627
1645
|
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(!
|
|
1646
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <level>`),process.exitCode=1;return}if(!eo.includes(r)){console.error(`Invalid access level: ${r}. Must be one of: ${eo.join(`, `)}`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ro();return}let i=await no(n,r);if(!i.ok){i.error instanceof Z?ro():(console.error(`Failed to set repository access: ${q(i.value)}`),process.exitCode=1);return}console.info(`Repository access set to: ${r}`)}async function no(e,t){let n=await V(e);return await X(new URL(`settings/security/apiaccess`,n),{method:`POST`,body:{api_access:t}})}function ro(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function io(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set the display name of a Prismic repository.
|
|
1629
1647
|
|
|
1630
1648
|
By default, this command reads the repository from prismic.config.json at the
|
|
1631
1649
|
project root.
|
|
@@ -1641,7 +1659,7 @@ FLAGS
|
|
|
1641
1659
|
-h, --help Show help for command
|
|
1642
1660
|
|
|
1643
1661
|
LEARN MORE
|
|
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()){
|
|
1662
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <name>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){oo();return}let i=await ao(n,r);if(!i.ok){i.error instanceof Z?oo():M(i.error)?(console.error(`Failed to set repository name: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to set repository name: ${q(i.value)}`),process.exitCode=1);return}console.info(`Repository name set to: ${i.value.repository.name}`)}async function ao(e,t){let n=await V(e),r=new URL(`app/settings/repository`,n),i=new FormData;return i.set(`displayname`,t),await X(r,{method:`POST`,body:i,schema:F({repository:F({name:R()})})})}function oo(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const so=F({repositories:N(F({domain:R(),name:I(R())}))});async function co(){let{values:{help:t,repo:n=await Y(),web:r}}=e({args:process.argv.slice(4),options:{web:{type:`boolean`,short:`w`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}}});if(t){console.info(`View a Prismic repository.
|
|
1645
1663
|
|
|
1646
1664
|
By default, this command reads the repository from prismic.config.json at the
|
|
1647
1665
|
project root.
|
|
@@ -1655,7 +1673,7 @@ FLAGS
|
|
|
1655
1673
|
-h, --help Show help for command
|
|
1656
1674
|
|
|
1657
1675
|
LEARN MORE
|
|
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){
|
|
1676
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}let i=await V(n);if(r){uo(i.toString()),console.info(`Opening ${i}`);return}if(!await H()){fo();return}let a=await lo();if(!a.ok){a.error instanceof Z?fo():(console.error(`Failed to fetch repository info: ${q(a.value)}`),process.exitCode=1);return}let o=a.value.repositories.find(e=>e.domain===n);if(!o){console.error(`Repository not found: ${n}`),process.exitCode=1;return}let s=o.name||`(no name)`;console.info(`Name: ${s}`),console.info(`URL: ${i}`)}async function lo(){return await X(new URL(`profile`,await vn()),{schema:so})}function uo(e){d(`${process.platform===`darwin`?`open`:process.platform===`win32`?`start`:`xdg-open`} "${e}"`)}function fo(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function po(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`create`:await Ua();break;case`list`:await Za();break;case`view`:await co();break;case`get-access`:await qa();break;case`set-access`:await to();break;case`set-name`:await io();break;default:t&&(console.error(`Unknown repo subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage Prismic repositories.
|
|
1659
1677
|
|
|
1660
1678
|
USAGE
|
|
1661
1679
|
prismic repo <command> [flags]
|
|
@@ -1672,7 +1690,7 @@ FLAGS
|
|
|
1672
1690
|
-h, --help Show help for command
|
|
1673
1691
|
|
|
1674
1692
|
LEARN MORE
|
|
1675
|
-
Use \`prismic repo <command> --help\` for more information about a command.`)}}async function
|
|
1693
|
+
Use \`prismic repo <command> --help\` for more information about a command.`)}}async function mo(){let{values:{help:t,variation:n,label:r,default:i,"true-label":a,"false-label":o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},default:{type:`boolean`},"true-label":{type:`string`},"false-label":{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a boolean (toggle) field to an existing slice.
|
|
1676
1694
|
|
|
1677
1695
|
USAGE
|
|
1678
1696
|
prismic slice add-field boolean <slice-id> <field-id> [flags]
|
|
@@ -1698,7 +1716,7 @@ EXAMPLES
|
|
|
1698
1716
|
prismic slice add-field boolean hero show_overlay --default
|
|
1699
1717
|
prismic slice add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!u){console.error(`Missing required argument: slice-id
|
|
1700
1718
|
`),console.error(`Usage: prismic slice add-field boolean <slice-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
|
|
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
|
|
1719
|
+
`),console.error(`Usage: prismic slice add-field boolean <slice-id> <field-id>`),process.exitCode=1;return}let f=await G(u);if(!f.ok){console.error(f.error),process.exitCode=1;return}let{model:p,modelPath:m}=f;if(p.variations.length===0){console.error(`Slice "${u}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let h=n?p.variations.find(e=>e.id===n):p.variations[0];if(!h){console.error(`Variation "${n}" not found in slice "${u}"\n`),console.error(`Available variations: ${p.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}h.primary||={};for(let e of p.variations)if(e.primary?.[d]){console.error(`Field "${d}" already exists in variation "${e.id}"`),process.exitCode=1;return}let g={type:`Boolean`,config:{label:r??J(d),...i&&{default_value:!0},...a&&{placeholder_true:a},...o&&{placeholder_false:o}}};h.primary[d]=g;try{await s(m,q(p))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Boolean) to "${h.id}" variation in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function ho(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing slice.
|
|
1702
1720
|
|
|
1703
1721
|
USAGE
|
|
1704
1722
|
prismic slice add-field color <slice-id> <field-id> [flags]
|
|
@@ -1722,7 +1740,7 @@ EXAMPLES
|
|
|
1722
1740
|
prismic slice add-field color hero accent --label "Accent Color"
|
|
1723
1741
|
prismic slice add-field color banner theme_color --variation "dark"`);return}if(!c){console.error(`Missing required argument: slice-id
|
|
1724
1742
|
`),console.error(`Usage: prismic slice add-field color <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
|
|
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
|
|
1743
|
+
`),console.error(`Usage: prismic slice add-field color <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Color`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Color) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function go(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date picker field to an existing slice.
|
|
1726
1744
|
|
|
1727
1745
|
USAGE
|
|
1728
1746
|
prismic slice add-field date <slice-id> <field-id> [flags]
|
|
@@ -1746,7 +1764,7 @@ EXAMPLES
|
|
|
1746
1764
|
prismic slice add-field date event start_date --label "Start Date"
|
|
1747
1765
|
prismic slice add-field date promo end_date --variation "countdown"`);return}if(!c){console.error(`Missing required argument: slice-id
|
|
1748
1766
|
`),console.error(`Usage: prismic slice add-field date <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
|
|
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
|
|
1767
|
+
`),console.error(`Usage: prismic slice add-field date <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Date`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Date) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function _o(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed (oEmbed) field to an existing slice.
|
|
1750
1768
|
|
|
1751
1769
|
USAGE
|
|
1752
1770
|
prismic slice add-field embed <slice-id> <field-id> [flags]
|
|
@@ -1770,7 +1788,7 @@ EXAMPLES
|
|
|
1770
1788
|
prismic slice add-field embed gallery media --label "Media Embed"
|
|
1771
1789
|
prismic slice add-field embed social tweet --variation "twitter"`);return}if(!c){console.error(`Missing required argument: slice-id
|
|
1772
1790
|
`),console.error(`Usage: prismic slice add-field embed <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
|
|
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
|
|
1791
|
+
`),console.error(`Usage: prismic slice add-field embed <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Embed`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Embed) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function vo(){let{values:{help:t,variation:n,label:r,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geographic coordinates field to an existing slice.
|
|
1774
1792
|
|
|
1775
1793
|
USAGE
|
|
1776
1794
|
prismic slice add-field geo-point <slice-id> <field-id> [flags]
|
|
@@ -1793,7 +1811,7 @@ EXAMPLES
|
|
|
1793
1811
|
prismic slice add-field geo-point store coordinates --label "Store Location"
|
|
1794
1812
|
prismic slice add-field geo-point map marker --variation "interactive"`);return}if(!o){console.error(`Missing required argument: slice-id
|
|
1795
1813
|
`),console.error(`Usage: prismic slice add-field geo-point <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
|
|
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
|
|
1814
|
+
`),console.error(`Usage: prismic slice add-field geo-point <slice-id> <field-id>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;if(u.variations.length===0){console.error(`Slice "${o}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let f=n?u.variations.find(e=>e.id===n):u.variations[0];if(!f){console.error(`Variation "${n}" not found in slice "${o}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}f.primary||={};for(let e of u.variations)if(e.primary?.[c]){console.error(`Field "${c}" already exists in variation "${e.id}"`),process.exitCode=1;return}let p={type:`GeoPoint`,config:{label:r??J(c)}};f.primary[c]=p;try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${c}" (GeoPoint) to "${f.id}" variation in ${o}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function yo(){let{values:{help:t,variation:n,label:r,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing slice.
|
|
1797
1815
|
|
|
1798
1816
|
USAGE
|
|
1799
1817
|
prismic slice add-field image <slice-id> <field-id> [flags]
|
|
@@ -1816,7 +1834,7 @@ EXAMPLES
|
|
|
1816
1834
|
prismic slice add-field image hero banner --label "Hero Banner"
|
|
1817
1835
|
prismic slice add-field image gallery thumbnail --variation "grid"`);return}if(!o){console.error(`Missing required argument: slice-id
|
|
1818
1836
|
`),console.error(`Usage: prismic slice add-field image <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
|
|
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
|
|
1837
|
+
`),console.error(`Usage: prismic slice add-field image <slice-id> <field-id>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;if(u.variations.length===0){console.error(`Slice "${o}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let f=n?u.variations.find(e=>e.id===n):u.variations[0];if(!f){console.error(`Variation "${n}" not found in slice "${o}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}f.primary||={};for(let e of u.variations)if(e.primary?.[c]){console.error(`Field "${c}" already exists in variation "${e.id}"`),process.exitCode=1;return}let p={type:`Image`,config:{label:r??J(c)}};f.primary[c]=p;try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${c}" (Image) to "${f.id}" variation in ${o}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function bo(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing slice.
|
|
1820
1838
|
|
|
1821
1839
|
USAGE
|
|
1822
1840
|
prismic slice add-field key-text <slice-id> <field-id> [flags]
|
|
@@ -1840,7 +1858,7 @@ EXAMPLES
|
|
|
1840
1858
|
prismic slice add-field key-text hero heading --label "Heading"
|
|
1841
1859
|
prismic slice add-field key-text cta button_text --placeholder "Enter button text"`);return}if(!c){console.error(`Missing required argument: slice-id
|
|
1842
1860
|
`),console.error(`Usage: prismic slice add-field key-text <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
|
|
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
|
|
1861
|
+
`),console.error(`Usage: prismic slice add-field key-text <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Text`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Text) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function xo(){let{values:{help:t,variation:n,label:r,placeholder:i,"allow-text":a,"allow-target-blank":o,repeatable:c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing slice.
|
|
1844
1862
|
|
|
1845
1863
|
USAGE
|
|
1846
1864
|
prismic slice add-field link <slice-id> <field-id> [flags]
|
|
@@ -1868,7 +1886,7 @@ EXAMPLES
|
|
|
1868
1886
|
prismic slice add-field link navigation links --repeatable
|
|
1869
1887
|
prismic slice add-field link hero cta --allow-text --allow-target-blank`);return}if(!d){console.error(`Missing required argument: slice-id
|
|
1870
1888
|
`),console.error(`Usage: prismic slice add-field link <slice-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
|
|
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
|
|
1889
|
+
`),console.error(`Usage: prismic slice add-field link <slice-id> <field-id>`),process.exitCode=1;return}let p=await G(d);if(!p.ok){console.error(p.error),process.exitCode=1;return}let{model:m,modelPath:h}=p;if(m.variations.length===0){console.error(`Slice "${d}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let g=n?m.variations.find(e=>e.id===n):m.variations[0];if(!g){console.error(`Variation "${n}" not found in slice "${d}"\n`),console.error(`Available variations: ${m.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}g.primary||={};for(let e of m.variations)if(e.primary?.[f]){console.error(`Field "${f}" already exists in variation "${e.id}"`),process.exitCode=1;return}let _={type:`Link`,config:{label:r??J(f),...i&&{placeholder:i},...a&&{allowText:!0},...o&&{allowTargetBlank:!0},...c&&{repeat:!0}}};g.primary[f]=_;try{await s(h,q(m))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Link) to "${g.id}" variation in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function So(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing slice.
|
|
1872
1890
|
|
|
1873
1891
|
USAGE
|
|
1874
1892
|
prismic slice add-field number <slice-id> <field-id> [flags]
|
|
@@ -1892,7 +1910,7 @@ EXAMPLES
|
|
|
1892
1910
|
prismic slice add-field number product quantity --label "Quantity"
|
|
1893
1911
|
prismic slice add-field number stats count --variation "detailed"`);return}if(!c){console.error(`Missing required argument: slice-id
|
|
1894
1912
|
`),console.error(`Usage: prismic slice add-field number <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
|
|
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
|
|
1913
|
+
`),console.error(`Usage: prismic slice add-field number <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Number`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Number) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function Co(){let{values:{help:t,variation:n,label:r,placeholder:i,single:a,multi:o,"allow-target-blank":c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing slice.
|
|
1896
1914
|
|
|
1897
1915
|
USAGE
|
|
1898
1916
|
prismic slice add-field rich-text <slice-id> <field-id> [flags]
|
|
@@ -1925,7 +1943,7 @@ EXAMPLES
|
|
|
1925
1943
|
prismic slice add-field rich-text hero tagline --single "heading1"
|
|
1926
1944
|
prismic slice add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!d){console.error(`Missing required argument: slice-id
|
|
1927
1945
|
`),console.error(`Usage: prismic slice add-field rich-text <slice-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
|
|
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
|
|
1946
|
+
`),console.error(`Usage: prismic slice add-field rich-text <slice-id> <field-id>`),process.exitCode=1;return}let p=await G(d);if(!p.ok){console.error(p.error),process.exitCode=1;return}let{model:m,modelPath:h}=p;if(m.variations.length===0){console.error(`Slice "${d}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let g=n?m.variations.find(e=>e.id===n):m.variations[0];if(!g){console.error(`Variation "${n}" not found in slice "${d}"\n`),console.error(`Available variations: ${m.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}g.primary||={};for(let e of m.variations)if(e.primary?.[f]){console.error(`Field "${f}" already exists in variation "${e.id}"`),process.exitCode=1;return}let _={type:`StructuredText`,config:{label:r??J(f),...i&&{placeholder:i},...a&&{single:a},...o&&{multi:o},...c&&{allowTargetBlank:!0}}};g.primary[f]=_;try{await s(h,q(m))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${f}" (StructuredText) to "${g.id}" variation in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function wo(){let{values:{help:t,variation:n,label:r,placeholder:i,option:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing slice.
|
|
1929
1947
|
|
|
1930
1948
|
USAGE
|
|
1931
1949
|
prismic slice add-field select <slice-id> <field-id> [flags]
|
|
@@ -1951,7 +1969,7 @@ EXAMPLES
|
|
|
1951
1969
|
prismic slice add-field select hero style --option "light" --option "dark" --default "light"
|
|
1952
1970
|
prismic slice add-field select product size --option "small" --option "medium" --option "large" --label "Size"`);return}if(!u){console.error(`Missing required argument: slice-id
|
|
1953
1971
|
`),console.error(`Usage: prismic slice add-field select <slice-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
|
|
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
|
|
1972
|
+
`),console.error(`Usage: prismic slice add-field select <slice-id> <field-id>`),process.exitCode=1;return}let f=await G(u);if(!f.ok){console.error(f.error),process.exitCode=1;return}let{model:p,modelPath:m}=f;if(p.variations.length===0){console.error(`Slice "${u}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let h=n?p.variations.find(e=>e.id===n):p.variations[0];if(!h){console.error(`Variation "${n}" not found in slice "${u}"\n`),console.error(`Available variations: ${p.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}h.primary||={};for(let e of p.variations)if(e.primary?.[d]){console.error(`Field "${d}" already exists in variation "${e.id}"`),process.exitCode=1;return}let g={type:`Select`,config:{label:r??J(d),...i&&{placeholder:i},...a&&a.length>0&&{options:a},...o&&{default_value:o}}};h.primary[d]=g;try{await s(m,q(p))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Select) to "${h.id}" variation in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function To(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a timestamp (date and time) field to an existing slice.
|
|
1955
1973
|
|
|
1956
1974
|
USAGE
|
|
1957
1975
|
prismic slice add-field timestamp <slice-id> <field-id> [flags]
|
|
@@ -1975,7 +1993,7 @@ EXAMPLES
|
|
|
1975
1993
|
prismic slice add-field timestamp event start_time --label "Event Start"
|
|
1976
1994
|
prismic slice add-field timestamp schedule meeting_time --variation "detailed"`);return}if(!c){console.error(`Missing required argument: slice-id
|
|
1977
1995
|
`),console.error(`Usage: prismic slice add-field timestamp <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
|
|
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
|
|
1996
|
+
`),console.error(`Usage: prismic slice add-field timestamp <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Timestamp`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Timestamp) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function Eo(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await mo();break;case`color`:await ho();break;case`date`:await go();break;case`embed`:await _o();break;case`geo-point`:await vo();break;case`image`:await yo();break;case`key-text`:await bo();break;case`link`:await xo();break;case`number`:await So();break;case`rich-text`:await Co();break;case`select`:await wo();break;case`timestamp`:await To();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing slice.
|
|
1979
1997
|
|
|
1980
1998
|
USAGE
|
|
1981
1999
|
prismic slice add-field <field-type> <slice-id> <field-id> [flags]
|
|
@@ -2004,7 +2022,7 @@ EXAMPLES
|
|
|
2004
2022
|
prismic slice add-field key-text my_slice title --label "Title"
|
|
2005
2023
|
prismic slice add-field link my_slice cta --allow-text
|
|
2006
2024
|
prismic slice add-field rich-text my_slice body --multi "paragraph,heading2,strong,em"
|
|
2007
|
-
prismic slice add-field select my_slice layout --option "full" --option "sidebar"`)}}async function
|
|
2025
|
+
prismic slice add-field select my_slice layout --option "full" --option "sidebar"`)}}async function Do(){let{values:{help:t,name:n,"copy-from":r,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{name:{type:`string`},"copy-from":{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a new variation to a slice.
|
|
2008
2026
|
|
|
2009
2027
|
USAGE
|
|
2010
2028
|
prismic slice add-variation <slice-id> <variation-id> [flags]
|
|
@@ -2027,7 +2045,7 @@ EXAMPLES
|
|
|
2027
2045
|
prismic slice add-variation MySlice withImage --name "With Image"
|
|
2028
2046
|
prismic slice add-variation MySlice withImage --copy-from default`);return}if(!o){console.error(`Missing required argument: slice-id
|
|
2029
2047
|
`),console.error(`Usage: prismic slice add-variation <slice-id> <variation-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: variation-id
|
|
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
|
|
2048
|
+
`),console.error(`Usage: prismic slice add-variation <slice-id> <variation-id>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;if(u.variations.some(e=>e.id===c)){console.error(`Variation "${c}" already exists in slice "${o}"`),process.exitCode=1;return}let f;if(r){let e=u.variations.find(e=>e.id===r);if(!e){console.error(`Source variation not found: ${r}`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}f={...structuredClone(e),id:c,name:n??jn(c)}}else f={id:c,name:n??jn(c),description:c,imageUrl:``,docURL:``,version:`initial`,primary:{},items:{}};let p={...u,variations:[...u.variations,f]};try{await s(d,q(p))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added variation "${c}" to slice "${o}"`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Oo(){let{values:{help:t,name:r,types:i,"no-types":a},positionals:[o]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Create a new slice in a Prismic project.
|
|
2031
2049
|
|
|
2032
2050
|
USAGE
|
|
2033
2051
|
prismic slice create <id> [flags]
|
|
@@ -2044,7 +2062,7 @@ FLAGS
|
|
|
2044
2062
|
-h, --help Show help for command
|
|
2045
2063
|
|
|
2046
2064
|
LEARN MORE
|
|
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??
|
|
2065
|
+
Use \`prismic slice <command> --help\` for more information about a command.`);return}if(!o){console.error(`Missing required argument: id`),process.exitCode=1;return}let c={id:o,type:`SharedSlice`,name:r??Mo(o),description:``,variations:[{id:`default`,name:`Default`,description:`Default`,imageUrl:``,docURL:``,version:`initial`,primary:{},items:{}}]},l=await ko(),u=new URL(Mo(c.name)+`/`,l),d=new URL(`model.json`,u);try{await n(new URL(`.`,d),{recursive:!0}),await s(d,q(c))}catch(e){e instanceof Error?console.error(`Failed to create slice: ${e.message}`):console.error(`Failed to create slice`),process.exitCode=1;return}if(console.info(`Created slice at ${d.href}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add fields with `prismic slice add-field`")}async function ko(){let e=await jo(),t=await W(`package.json`);switch(e){case`next`:if(await En(new URL(`src`,t)))return new URL(`src/slices/`,t);case`nuxt`:if(await En(new URL(`app`,t)))return new URL(`app/slices/`,t);case`sveltekit`:return new URL(`src/slices/`,t)}return new URL(`slices/`,t)}const Ao=F({dependencies:I(L(R(),R()))});async function jo(){let e=await W(`package.json`);if(e)try{let t=await r(e,`utf8`),{dependencies:n={}}=hn(Ao,JSON.parse(t));if(`next`in n)return`next`;if(`nuxt`in n)return`nuxt`;if(`@sveltejs/kit`in n)return`sveltekit`}catch{}}function Mo(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}async function No(){let{values:{help:t,json:n}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`List all slices in a Prismic project.
|
|
2048
2066
|
|
|
2049
2067
|
USAGE
|
|
2050
2068
|
prismic slice list [flags]
|
|
@@ -2055,7 +2073,7 @@ FLAGS
|
|
|
2055
2073
|
|
|
2056
2074
|
EXAMPLES
|
|
2057
2075
|
prismic slice list
|
|
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
|
|
2076
|
+
prismic slice list --json`);return}let a=await On(),o;try{o=await i(a,{withFileTypes:!1})}catch{n?console.info(JSON.stringify([])):console.info(`No slices found.`);return}let s=[];for(let e of o){let t=new URL(`${e}/model.json`,a);try{let e=await r(t,`utf8`),n=B(Dn,JSON.parse(e));n.success&&s.push({id:n.output.id,name:n.output.name})}catch{}}if(s.length===0){n?console.info(JSON.stringify([])):console.info(`No slices found.`);return}if(n)console.info(JSON.stringify(s,null,2));else{console.info(`ID NAME`);for(let e of s)console.info(`${e.id}\t${e.name}`)}}async function Po(){let{values:{help:t,json:n},positionals:[r]}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`List all variations for a slice.
|
|
2059
2077
|
|
|
2060
2078
|
USAGE
|
|
2061
2079
|
prismic slice list-variations <slice-id> [flags]
|
|
@@ -2070,7 +2088,7 @@ FLAGS
|
|
|
2070
2088
|
EXAMPLES
|
|
2071
2089
|
prismic slice list-variations MySlice
|
|
2072
2090
|
prismic slice list-variations MySlice --json`);return}if(!r){console.error(`Missing required argument: slice-id
|
|
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
|
|
2091
|
+
`),console.error(`Usage: prismic slice list-variations <slice-id>`),process.exitCode=1;return}let i=await G(r);if(!i.ok){console.error(i.error),process.exitCode=1;return}let{model:a}=i,o=a.variations.map(e=>({id:e.id,name:e.name}));if(n){console.info(JSON.stringify(o,null,2));return}console.info(`ID NAME`);for(let e of o)console.info(`${e.id}\t${e.name}`)}async function Fo(){let{values:{help:t,y:n,types:r,"no-types":i},positionals:[a]}=e({args:process.argv.slice(4),options:{y:{type:`boolean`,short:`y`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a slice from the project.
|
|
2074
2092
|
|
|
2075
2093
|
USAGE
|
|
2076
2094
|
prismic slice remove <slice-id> [flags]
|
|
@@ -2089,7 +2107,7 @@ FLAGS
|
|
|
2089
2107
|
EXAMPLES
|
|
2090
2108
|
prismic slice remove MySlice
|
|
2091
2109
|
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
|
|
2110
|
+
`),console.error(`Usage: prismic slice remove <slice-id>`),process.exitCode=1;return}let s=await G(a);if(!s.ok){console.error(s.error),process.exitCode=1;return}let{modelPath:c}=s,l=new URL(`.`,c);if(!n){console.error(`Refusing to remove slice "${a}" (this will delete the entire directory).`),console.error(`Re-run with -y to confirm.`),process.exitCode=1;return}try{await o(l,{recursive:!0})}catch(e){e instanceof Error?console.error(`Failed to remove slice: ${e.message}`):console.error(`Failed to remove slice`),process.exitCode=1;return}if(console.info(`Removed slice "${a}"`),!i)try{await K({output:r}),console.info(`Updated types in ${r??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Io(){let{values:{help:t,variation:n,zone:r,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{variation:{type:`string`,default:`default`},zone:{type:`string`,default:`primary`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a field from a slice variation.
|
|
2093
2111
|
|
|
2094
2112
|
USAGE
|
|
2095
2113
|
prismic slice remove-field <slice-id> <field-id> [flags]
|
|
@@ -2112,7 +2130,7 @@ EXAMPLES
|
|
|
2112
2130
|
prismic slice remove-field MySlice title --variation withImage
|
|
2113
2131
|
prismic slice remove-field MySlice item_title --zone items`);return}if(!o){console.error(`Missing required argument: slice-id
|
|
2114
2132
|
`),console.error(`Usage: prismic slice remove-field <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
|
|
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
|
|
2133
|
+
`),console.error(`Usage: prismic slice remove-field <slice-id> <field-id>`),process.exitCode=1;return}if(r!==`primary`&&r!==`items`){console.error(`Invalid zone: ${r}. Must be "primary" or "items".`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l,f=u.variations.find(e=>e.id===n);if(!f){console.error(`Variation not found: ${n}`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}let p=r===`primary`?f.primary:f.items;if(!p||!(c in p)){console.error(`Field "${c}" not found in ${r} zone of variation "${n}"`),process.exitCode=1;return}delete p[c];try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Removed field "${c}" from ${r} zone in variation "${n}" of slice "${o}"`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Lo(){let{values:{help:t,types:n,"no-types":r},positionals:[i,a]}=e({args:process.argv.slice(4),options:{types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a variation from a slice.
|
|
2116
2134
|
|
|
2117
2135
|
USAGE
|
|
2118
2136
|
prismic slice remove-variation <slice-id> <variation-id> [flags]
|
|
@@ -2131,7 +2149,7 @@ FLAGS
|
|
|
2131
2149
|
EXAMPLES
|
|
2132
2150
|
prismic slice remove-variation MySlice withImage`);return}if(!i){console.error(`Missing required argument: slice-id
|
|
2133
2151
|
`),console.error(`Usage: prismic slice remove-variation <slice-id> <variation-id>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: variation-id
|
|
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
|
|
2152
|
+
`),console.error(`Usage: prismic slice remove-variation <slice-id> <variation-id>`),process.exitCode=1;return}let o=await G(i);if(!o.ok){console.error(o.error),process.exitCode=1;return}let{model:c,modelPath:l}=o;if(!c.variations.some(e=>e.id===a)){console.error(`Variation not found: ${a}`),console.error(`Available variations: ${c.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}if(c.variations.length===1){console.error(`Cannot remove the last variation from a slice.`),process.exitCode=1;return}let u={...c,variations:c.variations.filter(e=>e.id!==a)};try{await s(l,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Removed variation "${a}" from slice "${i}"`),!r)try{await K({output:n}),console.info(`Updated types in ${n??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Ro(){let{values:{help:t,id:n,types:r,"no-types":i},positionals:[o,c]}=e({args:process.argv.slice(4),options:{id:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Rename a slice (updates name field, optionally id and directory).
|
|
2135
2153
|
|
|
2136
2154
|
USAGE
|
|
2137
2155
|
prismic slice rename <slice-id> <new-name> [flags]
|
|
@@ -2152,7 +2170,7 @@ EXAMPLES
|
|
|
2152
2170
|
prismic slice rename MySlice "My New Name"
|
|
2153
2171
|
prismic slice rename MySlice "My New Name" --id NewSliceId`);return}if(!o){console.error(`Missing required argument: slice-id
|
|
2154
2172
|
`),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
|
|
2173
|
+
`),console.error(`Usage: prismic slice rename <slice-id> <new-name>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;u.name=c,n&&(u.id=n);try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(n){let e=await On(),t=new URL(`.`,d),r=new URL(jn(c)+`/`,e);if(t.href!==r.href)try{await a(t,r),console.info(`Renamed slice "${o}" to "${n}" (${c})`),console.info(`Moved directory to ${r.href}`)}catch(e){e instanceof Error?console.error(`Failed to rename directory: ${e.message}`):console.error(`Failed to rename directory`),process.exitCode=1;return}else console.info(`Renamed slice "${o}" to "${n}" (${c})`)}else console.info(`Renamed slice "${o}" to "${c}"`);if(!i)try{await K({output:r}),console.info(`Updated types in ${r??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function zo(){let{values:{help:t,json:n},positionals:[r]}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`View details of a specific slice.
|
|
2156
2174
|
|
|
2157
2175
|
USAGE
|
|
2158
2176
|
prismic slice view <slice-id> [flags]
|
|
@@ -2168,7 +2186,7 @@ EXAMPLES
|
|
|
2168
2186
|
prismic slice view MySlice
|
|
2169
2187
|
prismic slice view MySlice --json`);return}if(!r){console.error(`Missing required argument: slice-id
|
|
2170
2188
|
`),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
|
|
2189
|
+
Variations:`);for(let e of a.variations){let t=Object.keys(e.primary??{}).length,n=Object.keys(e.items??{}).length;console.info(` - ${e.id} (${e.name}): ${t} primary fields, ${n} items fields`)}}async function Bo(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`create`:await Oo();break;case`list`:await No();break;case`view`:await zo();break;case`rename`:await Ro();break;case`remove`:await Fo();break;case`add-field`:await Eo();break;case`remove-field`:await Io();break;case`add-variation`:await Do();break;case`remove-variation`:await Lo();break;case`list-variations`:await Po();break;default:t&&(console.error(`Unknown slice subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage slices in a Prismic project.
|
|
2172
2190
|
|
|
2173
2191
|
USAGE
|
|
2174
2192
|
prismic slice <command> [flags]
|
|
@@ -2189,7 +2207,7 @@ FLAGS
|
|
|
2189
2207
|
-h, --help Show help for command
|
|
2190
2208
|
|
|
2191
2209
|
LEARN MORE
|
|
2192
|
-
Use \`prismic slice <command> --help\` for more information about a command.`)}}const
|
|
2210
|
+
Use \`prismic slice <command> --help\` for more information about a command.`)}}const Vo=F({dependencies:I(L(R(),R())),devDependencies:I(L(R(),R()))});async function Ho(){let e=await W(`package.json`);if(!e)return;let t=new URL(`.`,e),n;try{let t=await r(e,`utf8`),{dependencies:i={},devDependencies:a={}}=hn(Vo,JSON.parse(t)),o={...i,...a};`next`in o?n=`next`:`nuxt`in o?n=`nuxt`:`@sveltejs/kit`in o&&(n=`sveltekit`)}catch{}let i=!1;return n===`next`||n===`sveltekit`?i=await En(new URL(`src/`,t)):n===`nuxt`&&(i=await En(new URL(`app/`,t))),{framework:n,hasSrcDir:i,projectRoot:t}}function Uo(e){switch(e){case`next`:return[`@prismicio/client`,`@prismicio/react`,`@prismicio/next`];case`nuxt`:return[`@nuxtjs/prismic`];case`sveltekit`:return[`@prismicio/client`,`@prismicio/svelte`];default:return[`@prismicio/client`]}}function Wo(e){switch(e.framework){case`next`:return e.hasSrcDir?`src/prismicio.ts`:`prismicio.ts`;case`nuxt`:return null;case`sveltekit`:return`src/lib/prismicio.ts`;default:return`prismicio.ts`}}function Go(e){switch(e.framework){case`next`:return e.hasSrcDir?`src/slices/`:`slices/`;case`nuxt`:return e.hasSrcDir?`app/slices/`:`slices/`;case`sveltekit`:return`src/lib/slices/`;default:return`slices/`}}function Ko(e){switch(e){case`next`:return[`.tsx`,`.ts`,`.jsx`,`.js`];case`nuxt`:return[`.vue`];case`sveltekit`:return[`.svelte`];default:return[`.tsx`,`.ts`,`.jsx`,`.js`]}}function qo(e,t){switch(e.framework){case`next`:{let n=e.hasSrcDir?`src/app`:`app`;return t===`/slice-simulator`?{path:`${n}/slice-simulator/page`,extensions:[`.tsx`,`.ts`,`.jsx`,`.js`]}:t===`/api/preview`?{path:`${n}/api/preview/route`,extensions:[`.ts`,`.js`]}:t===`/api/exit-preview`?{path:`${n}/api/exit-preview/route`,extensions:[`.ts`,`.js`]}:t===`/api/revalidate`?{path:`${n}/api/revalidate/route`,extensions:[`.ts`,`.js`]}:null}case`nuxt`:return t===`/slice-simulator`?{path:`pages/slice-simulator`,extensions:[`.vue`]}:null;case`sveltekit`:return t===`/slice-simulator`?{path:`src/routes/slice-simulator/+page`,extensions:[`.svelte`]}:t===`/api/preview`?{path:`src/routes/api/preview/+server`,extensions:[`.ts`,`.js`]}:null;default:return null}}const Jo={documentsPublished:`document.published`,documentsUnpublished:`document.unpublished`,releasesCreated:`release.created`,releasesUpdated:`release.updated`,tagsCreated:`tag.created`,tagsDeleted:`tag.deleted`};async function Yo(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`View details of a webhook in a Prismic repository.
|
|
2193
2211
|
|
|
2194
2212
|
By default, this command reads the repository from prismic.config.json at the
|
|
2195
2213
|
project root.
|
|
@@ -2205,7 +2223,7 @@ FLAGS
|
|
|
2205
2223
|
-h, --help Show help for command
|
|
2206
2224
|
|
|
2207
2225
|
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()){
|
|
2226
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Xo();return}let i=await $(n);if(!i.ok){i.error instanceof Z?Xo():(console.error(`Failed to view webhook: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let{config:o}=a;console.info(`URL: ${o.url}`),console.info(`Name: ${o.name||`(none)`}`),console.info(`Status: ${o.active?`enabled`:`disabled`}`),console.info(`Secret: ${o.secret?`(set)`:`(none)`}`);let s=[];for(let[e,t]of Object.entries(Jo))o[e]&&s.push(t);if(console.info(`Triggers: ${s.length>0?s.join(`, `):`(none)`}`),Object.keys(o.headers).length>0){console.info(`Headers:`);for(let[e,t]of Object.entries(o.headers))console.info(` ${e}: ${t}`)}else console.info(`Headers: (none)`)}function Xo(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const Zo=F({config:F({_id:R(),url:R(),active:P(),name:pn(R()),secret:pn(R()),headers:L(R(),R()),documentsPublished:P(),documentsUnpublished:P(),releasesCreated:P(),releasesUpdated:P(),tagsCreated:P(),tagsDeleted:P()})});async function $(e){return await X(new URL(`/app/settings/webhooks`,await V(e)),{schema:N(Zo)})}function Qo(e){switch(e){case`next`:return`nextjs/with-cli`;case`nuxt`:return`nuxt/with-cli`;case`sveltekit`:return`sveltekit/with-cli`;default:return``}}function $o(e,t){return e?` (run \`prismic docs ${t?`${e}${t}`:e}\`)`:``}function es(e){switch(e){case`nuxt`:return`#configure-the-modules-prismic-client`;default:return`#set-up-a-prismic-client`}}function ts(e){switch(e){case`next`:return`#set-up-previews-in-next-js`;case`sveltekit`:return`#set-up-previews-in-sveltekit`;default:return``}}function ns(e){switch(e){case`nuxt`:return`#write-vue-components`;case`sveltekit`:return`#write-svelte-components`;default:return`#write-react-components`}}function rs(e,t,n,r,i){let a=Qo(t.framework),o=e.find(e=>e.title===`Setup`),s=o?.items.filter(e=>!e.done&&e.hint===`not installed`);if(s&&s.length>0)return{message:`Install Prismic packages with 'npm install ${s.map(e=>e.label).join(` `)}'`};let c=o?.items.find(e=>!e.done&&e.hint?.includes(`client`));if(c)return{message:`Create a ${c.label} file${$o(a,es(t.framework))}`};let l=e.find(e=>e.title===`Preview`);if(l){if(l.items.find(e=>e.label===`/slice-simulator route`&&!e.done))return{message:`Create the /slice-simulator route${$o(a,`#set-up-live-previewing`)}`};if(l.items.find(e=>e.label===`/api/preview endpoint`&&!e.done))return{message:`Create the /api/preview route${$o(a,ts(t.framework))}`};if(l.items.find(e=>e.label===`/api/exit-preview endpoint`&&!e.done))return{message:`Create the /api/exit-preview route${$o(a,ts(t.framework))}`};if(l.items.find(e=>e.label===`Slice simulator URL`&&!e.done))return{message:`Configure the slice simulator URL with 'prismic preview set-simulator'`};if(l.items.find(e=>e.label===`Preview environment`&&!e.done))return{message:`Add a preview environment with 'prismic preview add'`}}if(n.some(e=>e.status===`to_pull`)||r.some(e=>e.status===`to_pull`))return{message:`Pull remote models with 'prismic pull'`};if(n.some(e=>e.status===`to_push`)||r.some(e=>e.status===`to_push`))return{message:`Push local models with 'prismic push'`};if(i.length>0){let e=[...i].sort()[0];return{message:`Implement the ${e} slice component at ${`${Go(t)}${e}/index${Ko(t.framework)[0]}`}${$o(a,ns(t.framework))}`}}let u=e.find(e=>e.title===`Deployment`);if(u){if(u.items.find(e=>e.label===`/api/revalidate endpoint`&&!e.done))return{message:`Create the /api/revalidate route for ISR${$o(a,`#handle-content-changes`)}`};if(u.items.find(e=>e.label===`Revalidation webhook`&&!e.done))return{message:`Create a revalidation webhook with 'prismic webhook create'`}}}async function is(){let{values:{help:t,repo:n=await Y()}}=e({args:process.argv.slice(3),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`Show the status of the current Prismic project.
|
|
2209
2227
|
|
|
2210
2228
|
Includes a "Next:" step showing the most important action to take based on
|
|
2211
2229
|
project state.
|
|
@@ -2221,7 +2239,7 @@ FLAGS
|
|
|
2221
2239
|
-h, --help Show help for command
|
|
2222
2240
|
|
|
2223
2241
|
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
|
|
2242
|
+
Use \`prismic <command> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1;return}let r=await Ho();if(!r){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let[i,a,o,s,c,l,u,d]=await Promise.all([ss(n),ls(n),$(n),In(),Pn(n),Ln(),Fn(n),ds(r)]),f=await V(n);console.info(`Repository: ${n}`),console.info(`URL: ${f.href}`),console.info(``);let p=[],m=[],h=[],g=[],_=await fs(r,d);if(p.push(_),s.ok&&c.ok){let{pageTypes:e,customTypes:t,allTypeStatuses:n}=hs(s.value,c.value);p.push(e),p.push(t),m=n}if(l.ok&&u.ok){let{section:e,statuses:t,missingComponents:n}=await _s(l.value,u.value,r);p.push(e),h=t,g=n}let v=await bs(r,a.ok?a.value:void 0,i.ok?i.value.simulator_url:void 0);if(p.push(v),r.framework===`next`){let e=await Ss(r,o.ok?o.value:[]);p.push(e)}for(let e of p)as(e);let y=rs(p,r,m,h,g);y&&console.info(`Next: ${y.message}`)}function as(e){let t=e.items.filter(e=>!e.done).length,n=t>0?`${e.title} (${t} remaining)`:e.title;console.info(n);let r=e.items.filter(e=>e.done),i=e.items.filter(e=>!e.done);if(r.length>0)if(r.length===1){let e=r[0],t=e.hint?` \u2014 ${e.hint}`:``;console.info(` ✓ ${e.label}${t}`)}else{let e=r.map(e=>e.label).join(`, `),t=r.every(e=>e.hint===r[0].hint)&&r[0].hint?` \u2014 ${r[0].hint}`:``;console.info(` ✓ ${e}${t}`)}for(let e of i){let t=e.hint?` \u2014 ${e.hint}`:``;console.info(` ○ ${e.label}${t}`)}console.info(``)}const os=F({simulator_url:I(R())});async function ss(e){let t=await X(new URL(`/core/repository`,await V(e)),{schema:os});return t.ok?{ok:!0,value:t.value}:{ok:!1}}const cs=F({results:N(F({id:R(),label:R(),url:R()}))});async function ls(e){let t=await X(new URL(`/core/repository/preview_configs`,await V(e)),{schema:cs});return t.ok?{ok:!0,value:t.value.results}:{ok:!1}}const us=F({dependencies:I(L(R(),R())),devDependencies:I(L(R(),R()))});async function ds(e){let t=new URL(`package.json`,e.projectRoot);try{let e=await r(t,`utf8`),{dependencies:n={},devDependencies:i={}}=hn(us,JSON.parse(e));return new Set([...Object.keys(n),...Object.keys(i)])}catch{return new Set}}async function fs(e,t){let n=[],r=Uo(e.framework);for(let e of r)n.push({done:t.has(e),label:e,hint:t.has(e)?`installed`:`not installed`});let i=Wo(e);if(i){let t=await En(new URL(i,e.projectRoot));n.push({done:t,label:i,hint:t?void 0:`create Prismic client file`})}else if(e.framework===`nuxt`){let t=await ps(e);n.push({done:t,label:`nuxt.config.ts`,hint:t?`prismic configured`:`add @nuxtjs/prismic to modules`})}return{title:`Setup`,items:n}}async function ps(e){let t=new URL(`nuxt.config.ts`,e.projectRoot);try{let e=await r(t,`utf8`);return e.includes(`@nuxtjs/prismic`)||e.includes(`prismic:`)}catch{return!1}}function ms(e,t){let n=new Map(e.map(e=>[e.id,e])),r=new Map(t.map(e=>[e.id,e])),i=[];for(let t of e){let e=t.label||t.id,n=r.get(t.id);n&&JSON.stringify(t)===JSON.stringify(n)?i.push({id:t.id,label:e,status:`in_sync`}):i.push({id:t.id,label:e,status:`to_push`})}for(let e of t)if(!n.has(e.id)){let t=e.label||e.id;i.push({id:e.id,label:t,status:`to_pull`})}return i}function hs(e,t){let n=ms(e,t),r=n.filter(n=>{let r=e.find(e=>e.id===n.id),i=t.find(e=>e.id===n.id),a=r||i;return a&&a.format===`page`}),i=n.filter(n=>{let r=e.find(e=>e.id===n.id),i=t.find(e=>e.id===n.id),a=r||i;return!a||a.format!==`page`}),a=r.map(e=>({done:e.status===`in_sync`,label:e.label,hint:gs(e.status)})),o=i.map(e=>({done:e.status===`in_sync`,label:e.label,hint:gs(e.status)}));return{pageTypes:{title:`Page Types`,items:a},customTypes:{title:`Custom Types`,items:o},allTypeStatuses:n}}function gs(e){switch(e){case`in_sync`:return`in sync`;case`to_push`:return`to push`;case`to_pull`:return`to pull`}}async function _s(e,t,n){let r=ms(e,t),i=[],a=[],o=Go(n),s=Ko(n.framework);for(let e of r){let t=await vs(n,o,e.id,s);e.status===`in_sync`&&t?i.push({done:!0,label:e.label,hint:`component implemented`}):e.status===`in_sync`&&!t?(i.push({done:!1,label:e.label,hint:`missing component`}),a.push(e.label)):i.push({done:!1,label:e.label,hint:gs(e.status)})}return{section:{title:`Slices`,items:i},statuses:r,missingComponents:a}}async function vs(e,t,n,r){let i=ys(n);for(let n of r)if(await En(new URL(`${t}${i}/index${n}`,e.projectRoot)))return!0;return!1}function ys(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}async function bs(e,t,n){let r=[];r.push({done:!!n,label:`Slice simulator URL`,hint:n?`configured`:"run `prismic preview set-simulator`"});let i=qo(e,`/slice-simulator`);if(i){let t=await xs(e,i);r.push({done:t,label:`/slice-simulator route`,hint:t?void 0:`create route for Page Builder`})}let a=t&&t.length>0;if(r.push({done:!!a,label:`Preview environment`,hint:a?void 0:"run `prismic preview add`"}),e.framework!==`nuxt`){let t=qo(e,`/api/preview`);if(t){let n=await xs(e,t);r.push({done:n,label:`/api/preview endpoint`,hint:n?void 0:`create preview endpoint`})}}if(e.framework===`next`){let t=qo(e,`/api/exit-preview`);if(t){let n=await xs(e,t);r.push({done:n,label:`/api/exit-preview endpoint`,hint:n?void 0:`create exit-preview endpoint`})}}return{title:`Preview`,items:r}}async function xs(e,t){for(let n of t.extensions)if(await En(new URL(`${t.path}${n}`,e.projectRoot)))return!0;return!1}async function Ss(e,t){let n=[],r=qo(e,`/api/revalidate`);if(r){let t=await xs(e,r);n.push({done:t,label:`/api/revalidate endpoint`,hint:t?void 0:`create for ISR`})}let i=t.some(e=>e.config.active&&e.config.url.toLowerCase().includes(`revalidate`));return n.push({done:i,label:`Revalidation webhook`,hint:i?`configured`:"run `prismic webhook create`"}),{title:`Deployment`,items:n}}async function Cs(){let{values:{help:t,repo:n=await Y(),json:r}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`List all API tokens for a Prismic repository.
|
|
2225
2243
|
|
|
2226
2244
|
By default, this command reads the repository from prismic.config.json at the
|
|
2227
2245
|
project root.
|
|
@@ -2235,7 +2253,7 @@ FLAGS
|
|
|
2235
2253
|
-h, --help Show help for command
|
|
2236
2254
|
|
|
2237
2255
|
LEARN MORE
|
|
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()){
|
|
2256
|
+
Use \`prismic token <command> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ps();return}let[i,a]=await Promise.all([As(n),js(n)]);if(!i.ok){i.error instanceof Z||i.error instanceof Q?Ps():M(i.error)?(console.error(`Failed to list access tokens: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list access tokens: ${q(i.value)}`),process.exitCode=1);return}if(!a.ok){a.error instanceof Z||a.error instanceof Q?Ps():M(a.error)?(console.error(`Failed to list write tokens: Invalid response: ${q(a.error.issues)}`),process.exitCode=1):(console.error(`Failed to list write tokens: ${q(a.value)}`),process.exitCode=1);return}let o=i.value.flatMap(e=>e.wroom_auths.map(t=>({name:e.name,appId:e.id,authId:t.id,scope:t.scope,token:t.token,createdAt:t.created_at.$date}))),s=a.value.tokens;if(r)console.info(q({accessTokens:o,writeTokens:s}));else{if(o.length>0){console.info(`ACCESS TOKENS`);for(let e of o){let t=Ms(e.token),n=Ns(e.createdAt);console.info(` ${e.name} ${e.scope} ${t} ${n}`)}}else console.info(`ACCESS TOKENS (none)`);if(console.info(``),s.length>0){console.info(`WRITE TOKENS`);for(let e of s){let t=Ms(e.token),n=Ns(e.timestamp);console.info(` ${e.app_name} ${t} ${n}`)}}else console.info(`WRITE TOKENS (none)`)}}const ws=F({$date:mn()}),Ts=F({id:R(),origin:R(),domain:R(),app:R(),scope:R(),expired_at:ws,created_at:ws,owner:pn(R()),token:R()}),Es=F({id:R(),secret:R(),name:R(),owner:R(),created_at:ws,authorized_domains:N(R()),wroom_auths:N(Ts)}),Ds=F({app_name:R(),token:R(),timestamp:mn()}),Os=F({max_tokens:mn(),tokens:N(Ds)}),ks=N(Es);async function As(e){return await X(new URL(`settings/security/contentapi`,await V(e)),{schema:ks})}async function js(e){return await X(new URL(`settings/security/customtypesapi`,await V(e)),{schema:Os})}function Ms(e){return e.length<=12?e:`${e.slice(0,8)}...${e.slice(-4)}`}function Ns(e){let t=typeof e==`number`?e*1e3:e.$date;return new Date(t).toISOString().split(`T`)[0]}function Ps(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Fs(){let{values:{help:t,repo:n=await Y(),json:r,write:i,name:a=`Prismic CLI`,"allow-releases":o}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`},write:{type:`boolean`,short:`w`},name:{type:`string`,short:`n`},"allow-releases":{type:`boolean`}},allowPositionals:!1});if(t){console.info(`Create a new API token for a Prismic repository.
|
|
2239
2257
|
|
|
2240
2258
|
By default, this command reads the repository from prismic.config.json at the
|
|
2241
2259
|
project root.
|
|
@@ -2252,7 +2270,7 @@ FLAGS
|
|
|
2252
2270
|
-h, --help Show help for command
|
|
2253
2271
|
|
|
2254
2272
|
LEARN MORE
|
|
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()){
|
|
2273
|
+
Use \`prismic token <command> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(i&&o){console.error(`--allow-releases is only valid for access tokens (not with --write)`),process.exitCode=1;return}if(!await H()){Rs();return}if(i){let e=await Is(n,a);if(!e.ok){e.error instanceof Z||e.error instanceof Q?Rs():M(e.error)?(console.error(`Failed to create write token: Invalid response: ${q(e.error.issues)}`),process.exitCode=1):(console.error(`Failed to create write token: ${q(e.value)}`),process.exitCode=1);return}r?console.info(q(e.value)):console.info(`Token created: ${e.value.token}`)}else{let e=await Ls(n,a,o?`master+releases`:`master`);if(!e.ok){e.error instanceof Z||e.error instanceof Q?Rs():M(e.error)?(console.error(`Failed to create access token: Invalid response: ${q(e.error.issues)}`),process.exitCode=1):(console.error(`Failed to create access token: ${q(e.value)}`),process.exitCode=1);return}r?console.info(q(e.value)):console.info(`Token created: ${e.value.token}`)}}async function Is(e,t){return await X(new URL(`settings/security/token`,await V(e)),{method:`POST`,body:{app_name:t},schema:Ds})}async function Ls(e,t,n){let r=await As(e);if(!r.ok)return r;let i=r.value.find(e=>e.name===t);if(!i){let n=await X(new URL(`settings/security/oauthapp`,await V(e)),{method:`POST`,body:{app_name:t},schema:Es});if(!n.ok)return n;i=n.value}return await X(new URL(`settings/security/authorizations`,await V(e)),{method:`POST`,body:{app:i.id,scope:n},schema:Ts})}function Rs(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function zs(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Delete a token from a Prismic repository.
|
|
2256
2274
|
|
|
2257
2275
|
By default, this command reads the repository from prismic.config.json at the
|
|
2258
2276
|
project root.
|
|
@@ -2268,7 +2286,7 @@ FLAGS
|
|
|
2268
2286
|
-h, --help Show help for command
|
|
2269
2287
|
|
|
2270
2288
|
LEARN MORE
|
|
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()){
|
|
2289
|
+
Use \`prismic token <command> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: token`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Bs();return}let[i,a]=await Promise.all([As(n),js(n)]);if(!i.ok){i.error instanceof Z||i.error instanceof Q?Bs():M(i.error)?(console.error(`Failed to list access tokens: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list access tokens: ${q(i.value)}`),process.exitCode=1);return}if(!a.ok){a.error instanceof Z||a.error instanceof Q?Bs():M(a.error)?(console.error(`Failed to list write tokens: Invalid response: ${q(a.error.issues)}`),process.exitCode=1):(console.error(`Failed to list write tokens: ${q(a.value)}`),process.exitCode=1);return}let o;for(let e of i.value){for(let t of e.wroom_auths)if(t.token===r||t.token.startsWith(r)||t.token.endsWith(r)){o=t;break}if(o)break}if(o){let e=await X(new URL(`settings/security/authorizations/${o.id}`,await V(n)),{method:`DELETE`});if(!e.ok){e.error instanceof Z||e.error instanceof Q?Bs():(console.error(`Failed to delete token: ${q(e.value)}`),process.exitCode=1);return}console.info(`Token deleted`);return}let s=a.value.tokens.find(e=>e.token===r||e.token.startsWith(r)||e.token.endsWith(r));if(s){let e=await X(new URL(`settings/security/token/${s.token}`,await V(n)),{method:`DELETE`});if(!e.ok){e.error instanceof Z||e.error instanceof Q?Bs():(console.error(`Failed to delete token: ${q(e.value)}`),process.exitCode=1);return}console.info(`Token deleted`);return}console.error(`Token not found: ${r}`),process.exitCode=1}function Bs(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Vs(){let{values:{help:t,repo:n=await Y()},positionals:[r,i]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Set the name of a token in a Prismic repository.
|
|
2272
2290
|
|
|
2273
2291
|
Note: Only access tokens can be renamed. Write tokens cannot be renamed without
|
|
2274
2292
|
changing the token value.
|
|
@@ -2288,7 +2306,7 @@ FLAGS
|
|
|
2288
2306
|
-h, --help Show help for command
|
|
2289
2307
|
|
|
2290
2308
|
LEARN MORE
|
|
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()){
|
|
2309
|
+
Use \`prismic token <command> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: token`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: name`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Hs();return}let[a,o]=await Promise.all([As(n),js(n)]);if(!a.ok){a.error instanceof Z||a.error instanceof Q?Hs():M(a.error)?(console.error(`Failed to list access tokens: Invalid response: ${q(a.error.issues)}`),process.exitCode=1):(console.error(`Failed to list access tokens: ${q(a.value)}`),process.exitCode=1);return}if(!o.ok){o.error instanceof Z||o.error instanceof Q?Hs():M(o.error)?(console.error(`Failed to list write tokens: Invalid response: ${q(o.error.issues)}`),process.exitCode=1):(console.error(`Failed to list write tokens: ${q(o.value)}`),process.exitCode=1);return}let s;for(let e of a.value){for(let t of e.wroom_auths)if(t.token===r||t.token.startsWith(r)||t.token.endsWith(r)){s=e;break}if(s)break}if(s){let e=await X(new URL(`settings/security/oauthapp/${s.id}`,await V(n)),{method:`POST`,body:{name:i},schema:Es});if(!e.ok){e.error instanceof Z||e.error instanceof Q?Hs():M(e.error)?(console.error(`Failed to rename token: Invalid response: ${q(e.error.issues)}`),process.exitCode=1):(console.error(`Failed to rename token: ${q(e.value)}`),process.exitCode=1);return}console.info(`Token renamed to: ${i}`);return}if(o.value.tokens.find(e=>e.token===r||e.token.startsWith(r)||e.token.endsWith(r))){console.error(`Write tokens cannot be renamed. Delete and create a new token with the desired name.`),process.exitCode=1;return}console.error(`Token not found: ${r}`),process.exitCode=1}function Hs(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function Us(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`list`:await Cs();break;case`create`:await Fs();break;case`set-name`:await Vs();break;case`delete`:await zs();break;default:t&&(console.error(`Unknown token subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage API tokens for a Prismic repository.
|
|
2292
2310
|
|
|
2293
2311
|
USAGE
|
|
2294
2312
|
prismic token <command> [flags]
|
|
@@ -2303,7 +2321,7 @@ FLAGS
|
|
|
2303
2321
|
-h, --help Show help for command
|
|
2304
2322
|
|
|
2305
2323
|
LEARN MORE
|
|
2306
|
-
Use \`prismic token <command> --help\` for more information about a command.`)}}async function
|
|
2324
|
+
Use \`prismic token <command> --help\` for more information about a command.`)}}async function Ws(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Enable a webhook in a Prismic repository.
|
|
2307
2325
|
|
|
2308
2326
|
By default, this command reads the repository from prismic.config.json at the
|
|
2309
2327
|
project root.
|
|
@@ -2319,7 +2337,7 @@ FLAGS
|
|
|
2319
2337
|
-h, --help Show help for command
|
|
2320
2338
|
|
|
2321
2339
|
LEARN MORE
|
|
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()){
|
|
2340
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Ks();return}let i=await $(n);if(!i.ok){i.error instanceof Z?Ks():(console.error(`Failed to enable webhook: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}if(a.config.active){console.info(`Webhook already enabled: ${r}`);return}let o=structuredClone(a.config);o.active=!0;let s=await Gs(n,a.config._id,o);if(!s.ok){s.error instanceof Z?Ks():(console.error(`Failed to enable webhook: ${q(s.value)}`),process.exitCode=1);return}console.info(`Webhook enabled: ${r}`)}async function Gs(e,t,n){let r=new URL(`/app/settings/webhooks/${t}`,await V(e)),i=new FormData;return i.set(`url`,n.url),i.set(`name`,n.name??``),i.set(`secret`,n.secret??``),i.set(`headers`,JSON.stringify(n.headers??{})),i.set(`active`,n.active?`on`:`off`),i.set(`documentsPublished`,n.documentsUnpublished.toString()),i.set(`documentsUnpublished`,n.documentsUnpublished.toString()),i.set(`releasesCreated`,n.documentsUnpublished.toString()),i.set(`releasesUpdated`,n.documentsUnpublished.toString()),i.set(`tagsCreated`,n.documentsUnpublished.toString()),i.set(`documentsPublished`,n.documentsUnpublished.toString()),await X(r,{method:`POST`,body:i})}function Ks(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function qs(){let{values:{help:t,repo:n=await Y()},positionals:[r,i,a]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a custom HTTP header to a webhook.
|
|
2323
2341
|
|
|
2324
2342
|
By default, this command reads the repository from prismic.config.json at the
|
|
2325
2343
|
project root.
|
|
@@ -2337,7 +2355,7 @@ FLAGS
|
|
|
2337
2355
|
-h, --help Show help for command
|
|
2338
2356
|
|
|
2339
2357
|
LEARN MORE
|
|
2340
|
-
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!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()){
|
|
2358
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: <key>`),process.exitCode=1;return}if(!a){console.error(`Missing required argument: <value>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){Js();return}let o=await $(n);if(!o.ok){o.error instanceof Z?Js():(console.error(`Failed to add header: ${q(o.value)}`),process.exitCode=1);return}let s=o.value.find(e=>e.config.url===r);if(!s){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let c=structuredClone(s.config);c.headers[i]=a;let l=await Gs(n,s.config._id,c);if(!l.ok){l.error instanceof Z?Js():(console.error(`Failed to add header: ${q(l.value)}`),process.exitCode=1);return}console.info(`Header added: ${i}`)}function Js(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const Ys=Object.values(Jo);async function Xs(){let{values:{help:t,repo:n=await Y(),name:r,secret:i,trigger:a=[]},positionals:[o]}=e({args:process.argv.slice(4),options:{name:{type:`string`,short:`n`},secret:{type:`string`,short:`s`},trigger:{type:`string`,multiple:!0,short:`t`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Create a new webhook in a Prismic repository.
|
|
2341
2359
|
|
|
2342
2360
|
By default, this command reads the repository from prismic.config.json at the
|
|
2343
2361
|
project root.
|
|
@@ -2366,7 +2384,7 @@ TRIGGERS
|
|
|
2366
2384
|
If no triggers specified, all are enabled.
|
|
2367
2385
|
|
|
2368
2386
|
LEARN MORE
|
|
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(!
|
|
2387
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!o){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}for(let e of a)if(!Ys.includes(e)){console.error(`Invalid trigger: ${e}`),console.error(`Valid triggers: ${Ys.join(`, `)}`),process.exitCode=1;return}if(!await H()){Qs();return}let s=!(a.length>0),c={documentsPublished:s,documentsUnpublished:s,releasesCreated:s,releasesUpdated:s,tagsCreated:s,tagsDeleted:s};for(let e of a){let[t]=Object.entries(Jo).find(([,t])=>e===t)??[];t&&(c[t]=!0)}let l=await Zs(n,{url:o,name:r??null,secret:i??null,...c});if(!l.ok){l.error instanceof Z?Qs():(console.error(`Failed to create webhook: ${q(l.value)}`),process.exitCode=1);return}console.info(`Webhook created: ${o}`)}async function Zs(e,t){let n=new URL(`/app/settings/webhooks/create`,await V(e)),r=new FormData;return r.set(`url`,t.url),r.set(`name`,t.name??``),r.set(`secret`,t.secret??``),r.set(`headers`,JSON.stringify({})),r.set(`active`,`on`),r.set(`documentsPublished`,t.documentsUnpublished.toString()),r.set(`documentsUnpublished`,t.documentsUnpublished.toString()),r.set(`releasesCreated`,t.documentsUnpublished.toString()),r.set(`releasesUpdated`,t.documentsUnpublished.toString()),r.set(`tagsCreated`,t.documentsUnpublished.toString()),r.set(`documentsPublished`,t.documentsUnpublished.toString()),await X(n,{method:`POST`,body:r})}function Qs(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function $s(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Disable a webhook in a Prismic repository.
|
|
2370
2388
|
|
|
2371
2389
|
By default, this command reads the repository from prismic.config.json at the
|
|
2372
2390
|
project root.
|
|
@@ -2382,7 +2400,7 @@ FLAGS
|
|
|
2382
2400
|
-h, --help Show help for command
|
|
2383
2401
|
|
|
2384
2402
|
LEARN MORE
|
|
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()){
|
|
2403
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ec();return}let i=await $(n);if(!i.ok){i.error instanceof Z?ec():(console.error(`Failed to disable webhook: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}if(!a.config.active){console.info(`Webhook already disabled: ${r}`);return}let o=structuredClone(a.config);o.active=!1;let s=await Gs(n,a.config._id,o);if(!s.ok){s.error instanceof Z?ec():(console.error(`Failed to disable webhook: ${q(s.value)}`),process.exitCode=1);return}console.info(`Webhook disabled: ${r}`)}function ec(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function tc(){let{values:{help:t,repo:n=await Y(),json:r}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!1});if(t){console.info(`List all webhooks in a Prismic repository.
|
|
2386
2404
|
|
|
2387
2405
|
By default, this command reads the repository from prismic.config.json at the
|
|
2388
2406
|
project root.
|
|
@@ -2396,7 +2414,7 @@ FLAGS
|
|
|
2396
2414
|
-h, --help Show help for command
|
|
2397
2415
|
|
|
2398
2416
|
LEARN MORE
|
|
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()){
|
|
2417
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){nc();return}let i=await $(n);if(!i.ok){i.error instanceof Z?nc():M(i.error)?(console.error(`Failed to list webhooks: Invalid response: ${q(i.error.issues)}`),process.exitCode=1):(console.error(`Failed to list webhooks: ${q(i.value)}`),process.exitCode=1);return}let a=i.value;if(r)console.info(q(a.map(e=>e.config)));else{if(a.length===0){console.info(`No webhooks configured.`);return}for(let e of a){let t=e.config.active?`enabled`:`disabled`,n=e.config.name?` (${e.config.name})`:``;console.info(`${e.config.url}${n} [${t}]`)}}}function nc(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function rc(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Delete a webhook from a Prismic repository.
|
|
2400
2418
|
|
|
2401
2419
|
By default, this command reads the repository from prismic.config.json at the
|
|
2402
2420
|
project root.
|
|
@@ -2412,7 +2430,7 @@ FLAGS
|
|
|
2412
2430
|
-h, --help Show help for command
|
|
2413
2431
|
|
|
2414
2432
|
LEARN MORE
|
|
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()){
|
|
2433
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){ac();return}let i=await $(n);if(!i.ok){i.error instanceof Z?ac():(console.error(`Failed to remove webhook: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let o=await ic(n,a.config._id);if(!o.ok){o.error instanceof Z?ac():(console.error(`Failed to remove webhook: ${q(o.value)}`),process.exitCode=1);return}console.info(`Webhook removed: ${r}`)}async function ic(e,t){return await X(new URL(`/app/settings/webhooks/${t}/delete`,await V(e)),{method:`POST`})}function ac(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function oc(){let{values:{help:t,repo:n=await Y()},positionals:[r,i]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Remove a custom HTTP header from a webhook.
|
|
2416
2434
|
|
|
2417
2435
|
By default, this command reads the repository from prismic.config.json at the
|
|
2418
2436
|
project root.
|
|
@@ -2429,7 +2447,7 @@ FLAGS
|
|
|
2429
2447
|
-h, --help Show help for command
|
|
2430
2448
|
|
|
2431
2449
|
LEARN MORE
|
|
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()){
|
|
2450
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!i){console.error(`Missing required argument: <key>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){sc();return}let a=await $(n);if(!a.ok){a.error instanceof Z?sc():(console.error(`Failed to remove header: ${q(a.value)}`),process.exitCode=1);return}let o=a.value.find(e=>e.config.url===r);if(!o){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}if(!(i in o.config.headers)){console.error(`Header not found: ${i}`),process.exitCode=1;return}let s=structuredClone(o.config);delete s.headers[i];let c=await Gs(n,o.config._id,s);if(!c.ok){c.error instanceof Z?sc():(console.error(`Failed to remove header: ${q(c.value)}`),process.exitCode=1);return}console.info(`Header removed: ${i}`)}function sc(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const cc=Object.values(Jo);async function lc(){let{values:{help:t,repo:n=await Y(),trigger:r},positionals:[i]}=e({args:process.argv.slice(4),options:{trigger:{type:`string`,multiple:!0,short:`t`},repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Update which events trigger a webhook.
|
|
2433
2451
|
|
|
2434
2452
|
By default, this command reads the repository from prismic.config.json at the
|
|
2435
2453
|
project root.
|
|
@@ -2454,7 +2472,7 @@ TRIGGERS
|
|
|
2454
2472
|
tag.deleted When a tag is deleted
|
|
2455
2473
|
|
|
2456
2474
|
LEARN MORE
|
|
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(!
|
|
2475
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!i){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!r||r.length===0){console.error(`Missing required option: --trigger`),process.exitCode=1;return}for(let e of r)if(!cc.includes(e)){console.error(`Invalid trigger: ${e}`),console.error(`Valid triggers: ${cc.join(`, `)}`),process.exitCode=1;return}if(!await H()){uc();return}let a=await $(n);if(!a.ok){a.error instanceof Z?uc():(console.error(`Failed to update webhook triggers: ${q(a.value)}`),process.exitCode=1);return}let o=a.value.find(e=>e.config.url===i);if(!o){console.error(`Webhook not found: ${i}`),process.exitCode=1;return}let s=!(r.length>0),c={documentsPublished:s,documentsUnpublished:s,releasesCreated:s,releasesUpdated:s,tagsCreated:s,tagsDeleted:s};for(let e of r){let[t]=Object.entries(Jo).find(([,t])=>e===t)??[];t&&(c[t]=!0)}let l=await Gs(n,o.config._id,{...o.config,...c});if(!l.ok){l.error instanceof Z?uc():(console.error(`Failed to update webhook triggers: ${q(l.value)}`),process.exitCode=1);return}console.info(`Webhook triggers updated: ${r.join(`, `)}`)}function uc(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function dc(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Show the enabled/disabled status of a webhook.
|
|
2458
2476
|
|
|
2459
2477
|
By default, this command reads the repository from prismic.config.json at the
|
|
2460
2478
|
project root.
|
|
@@ -2470,7 +2488,7 @@ FLAGS
|
|
|
2470
2488
|
-h, --help Show help for command
|
|
2471
2489
|
|
|
2472
2490
|
LEARN MORE
|
|
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()){
|
|
2491
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){fc();return}let i=await $(n);if(!i.ok){i.error instanceof Z?fc():(console.error(`Failed to get webhook status: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let o=a.config.active?`enabled`:`disabled`;console.info(o)}function fc(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function pc(){let{values:{help:t,repo:n=await Y()},positionals:[r]}=e({args:process.argv.slice(4),options:{repo:{type:`string`,short:`r`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Trigger a test webhook in a Prismic repository.
|
|
2474
2492
|
|
|
2475
2493
|
By default, this command reads the repository from prismic.config.json at the
|
|
2476
2494
|
project root.
|
|
@@ -2486,7 +2504,7 @@ FLAGS
|
|
|
2486
2504
|
-h, --help Show help for command
|
|
2487
2505
|
|
|
2488
2506
|
LEARN MORE
|
|
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()){
|
|
2507
|
+
Use \`prismic <command> <subcommand> --help\` for more information about a command.`);return}if(!r){console.error(`Missing required argument: <url>`),process.exitCode=1;return}if(!n){console.error(`Missing prismic.config.json or --repo option`),process.exitCode=1;return}if(!await H()){hc();return}let i=await $(n);if(!i.ok){i.error instanceof Z?hc():(console.error(`Failed to test webhook: ${q(i.value)}`),process.exitCode=1);return}let a=i.value.find(e=>e.config.url===r);if(!a){console.error(`Webhook not found: ${r}`),process.exitCode=1;return}let o=await mc(n,a.config._id);if(!o.ok){o.error instanceof Z?hc():(console.error(`Failed to test webhook: ${q(o.value)}`),process.exitCode=1);return}console.info(`Test webhook triggered: ${r}`)}async function mc(e,t){return await X(new URL(`/app/settings/webhooks/${t}/trigger`,await V(e)),{method:`POST`})}function hc(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}async function gc(){let{positionals:[t]}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`list`:await tc();break;case`create`:await Xs();break;case`view`:await Yo();break;case`remove`:await rc();break;case`test`:await pc();break;case`enable`:await Ws();break;case`disable`:await $s();break;case`status`:await dc();break;case`add-header`:await qs();break;case`remove-header`:await oc();break;case`set-triggers`:await lc();break;default:t&&(console.error(`Unknown webhook subcommand: ${t}\n`),process.exitCode=1),console.info(`Manage webhooks in a Prismic repository.
|
|
2490
2508
|
|
|
2491
2509
|
USAGE
|
|
2492
2510
|
prismic webhook <command> [flags]
|
|
@@ -2508,7 +2526,7 @@ FLAGS
|
|
|
2508
2526
|
-h, --help Show help for command
|
|
2509
2527
|
|
|
2510
2528
|
LEARN MORE
|
|
2511
|
-
Use \`prismic webhook <command> --help\` for more information about a command.`)}}async function
|
|
2529
|
+
Use \`prismic webhook <command> --help\` for more information about a command.`)}}async function _c(){let{values:{help:t}}=e({args:process.argv.slice(3),options:{help:{type:`boolean`,short:`h`}}});if(t){console.info(`Show the currently logged in user.
|
|
2512
2530
|
|
|
2513
2531
|
USAGE
|
|
2514
2532
|
prismic whoami [flags]
|
|
@@ -2517,7 +2535,7 @@ FLAGS
|
|
|
2517
2535
|
-h, --help Show help for command
|
|
2518
2536
|
|
|
2519
2537
|
LEARN MORE
|
|
2520
|
-
Use \`prismic <command> --help\` for more information about a command.`);return}if(!await H()){
|
|
2538
|
+
Use \`prismic <command> --help\` for more information about a command.`);return}if(!await H()){yc();return}let n=await vc();if(!n.ok){n.error instanceof Z?yc():console.error(`Failed to fetch user profile.`),process.exitCode=1;return}console.info(n.value.email)}async function vc(){return await X(new URL(`profile`,await vn()),{schema:F({email:R()})})}function yc(){console.error("Not logged in. Run `prismic login` first."),process.exitCode=1}const{positionals:bc,values:{version:xc}}=e({options:{help:{type:`boolean`,short:`h`},version:{type:`boolean`,short:`v`}},allowPositionals:!0,strict:!1});if(xc)console.info(ee);else switch(bc[0]){case`init`:await Qr();break;case`login`:await gi();break;case`logout`:await yi();break;case`whoami`:await _c();break;case`status`:await is();break;case`repo`:await po();break;case`locale`:await mi();break;case`page-type`:await da();break;case`custom-type`:await Fr();break;case`slice`:await Bo();break;case`pull`:await Ra();break;case`push`:await Va();break;case`codegen`:await Gn();break;case`docs`:await Vr();break;case`preview`:await La();break;case`token`:await Us();break;case`webhook`:await gc();break;default:bc[0]&&(console.error(`Unknown command: ${bc[0]}`),process.exitCode=1),console.info(`Prismic CLI for managing repositories and configurations.
|
|
2521
2539
|
|
|
2522
2540
|
USAGE
|
|
2523
2541
|
prismic <command> [flags]
|
|
@@ -2536,6 +2554,7 @@ COMMANDS
|
|
|
2536
2554
|
pull Pull types and slices from Prismic
|
|
2537
2555
|
push Push types and slices to Prismic
|
|
2538
2556
|
codegen Generate code from Prismic models
|
|
2557
|
+
docs Fetch documentation from Prismic
|
|
2539
2558
|
preview Manage preview configurations
|
|
2540
2559
|
token Manage API tokens in a repository
|
|
2541
2560
|
webhook Manage webhooks in a repository
|