@angeloashmore/prismic-cli-poc 0.0.0-pr.3.219652e → 0.0.0-pr.4.d609497
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 +42 -42
- package/package.json +1 -1
- package/src/custom-type-add-field-boolean.ts +4 -0
- package/src/custom-type-add-field-color.ts +4 -0
- package/src/custom-type-add-field-date.ts +4 -0
- package/src/custom-type-add-field-embed.ts +4 -0
- package/src/custom-type-add-field-geo-point.ts +4 -0
- package/src/custom-type-add-field-image.ts +4 -0
- package/src/custom-type-add-field-key-text.ts +4 -0
- package/src/custom-type-add-field-link.ts +4 -0
- package/src/custom-type-add-field-number.ts +4 -0
- package/src/custom-type-add-field-rich-text.ts +4 -0
- package/src/custom-type-add-field-select.ts +4 -0
- package/src/custom-type-add-field-timestamp.ts +4 -0
- package/src/custom-type-add-field-uid.ts +4 -0
- package/src/custom-type-create.ts +3 -0
- package/src/page-type-add-field-boolean.ts +4 -0
- package/src/page-type-add-field-color.ts +4 -0
- package/src/page-type-add-field-date.ts +4 -0
- package/src/page-type-add-field-embed.ts +4 -0
- package/src/page-type-add-field-geo-point.ts +4 -0
- package/src/page-type-add-field-image.ts +4 -0
- package/src/page-type-add-field-key-text.ts +4 -0
- package/src/page-type-add-field-link.ts +4 -0
- package/src/page-type-add-field-number.ts +4 -0
- package/src/page-type-add-field-rich-text.ts +4 -0
- package/src/page-type-add-field-select.ts +4 -0
- package/src/page-type-add-field-timestamp.ts +4 -0
- package/src/page-type-add-field-uid.ts +4 -0
- package/src/page-type-create.ts +3 -0
- package/src/slice-add-field-boolean.ts +4 -0
- package/src/slice-add-field-color.ts +4 -0
- package/src/slice-add-field-date.ts +4 -0
- package/src/slice-add-field-embed.ts +4 -0
- package/src/slice-add-field-geo-point.ts +4 -0
- package/src/slice-add-field-image.ts +4 -0
- package/src/slice-add-field-key-text.ts +4 -0
- package/src/slice-add-field-link.ts +4 -0
- package/src/slice-add-field-number.ts +4 -0
- package/src/slice-add-field-rich-text.ts +4 -0
- package/src/slice-add-field-select.ts +4 -0
- package/src/slice-add-field-timestamp.ts +4 -0
- package/src/slice-create.ts +3 -0
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.4.d609497`,te=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),r=i([``,``],[``,``]);function i(e,t){return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function a(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.default=function(){function e(){var t=this,n=[...arguments];return a(this,e),this.tag=function(e){var n=[...arguments].slice(1);return typeof e==`function`?t.interimTag.bind(t,e):typeof e==`string`?t.transformEndResult(e):(e=e.map(t.transformString.bind(t)),t.transformEndResult(e.reduce(t.processSubstitutions.bind(t,n))))},n.length>0&&Array.isArray(n[0])&&(n=n[0]),this.transformers=n.map(function(e){return typeof e==`function`?e():e}),this.tag}return n(e,[{key:`interimTag`,value:function(e,t){var n=[...arguments].slice(2);return this.tag(r,e.apply(void 0,[t].concat(n)))}},{key:`processSubstitutions`,value:function(e,t,n){return`${t}${this.transformSubstitution(e.shift(),t)}${n}`}},{key:`transformString`,value:function(e){return this.transformers.reduce(function(e,t){return t.onString?t.onString(e):e},e)}},{key:`transformSubstitution`,value:function(e,t){return this.transformers.reduce(function(e,n){return n.onSubstitution?n.onSubstitution(e,t):e},e)}},{key:`transformEndResult`,value:function(e){return this.transformers.reduce(function(e,t){return t.onEndResult?t.onEndResult(e):e},e)}}]),e}(),t.exports=e.default})),S=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(te());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ne=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:``;return{onEndResult:function(t){if(e===``)return t.trim();if(e=e.toLowerCase(),e===`start`||e===`left`)return t.replace(/^\s*/,``);if(e===`end`||e===`right`)return t.replace(/\s*$/,``);throw Error(`Side not supported: `+e)}}},t.exports=e.default})),C=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ne());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),re=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});function n(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}else return Array.from(e)}e.default=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:`initial`;return{onEndResult:function(t){if(e===`initial`){var r=t.match(/^[^\S\n]*(?=\S)/gm),i=r&&Math.min.apply(Math,n(r.map(function(e){return e.length})));if(i){var a=RegExp(`^.{`+i+`}`,`gm`);return t.replace(a,``)}return t}if(e===`all`)return t.replace(/^[^\S\n]+/gm,``);throw Error(`Unknown type: `+e)}}},t.exports=e.default})),ie=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(re());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),w=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e,t){return{onEndResult:function(n){if(e==null||t==null)throw Error(`replaceResultTransformer requires at least 2 arguments.`);return n.replace(e,t)}}},t.exports=e.default})),ae=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(w());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),oe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e,t){return{onSubstitution:function(n,r){if(e==null||t==null)throw Error(`replaceSubstitutionTransformer requires at least 2 arguments.`);return n==null?n:n.toString().replace(e,t)}}},t.exports=e.default})),se=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(oe());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ce=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e,t){return{onString:function(n){if(e==null||t==null)throw Error(`replaceStringTransformer requires at least 2 arguments.`);return n.replace(e,t)}}},t.exports=e.default})),le=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ce());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ue=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n={separator:``,conjunction:``,serial:!1};e.default=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:n;return{onSubstitution:function(t,n){if(Array.isArray(t)){var r=t.length,i=e.separator,a=e.conjunction,o=e.serial,s=n.match(/(\n?[^\S\n]+)$/);if(t=s?t.join(i+s[1]):t.join(i+` `),a&&r>1){var c=t.lastIndexOf(i);t=t.slice(0,c)+(o?i:``)+` `+a+t.slice(c+1)}}return t}}},t.exports=e.default})),T=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ue());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),de=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=function(e){return{onSubstitution:function(t,n){if(e!=null&&typeof e==`string`)typeof t==`string`&&t.includes(e)&&(t=t.split(e));else throw Error(`You need to specify a string character to split by.`);return t}}},t.exports=e.default})),fe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(de());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),pe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=function(e){return e!=null&&!Number.isNaN(e)&&typeof e!=`boolean`};e.default=function(){return{onSubstitution:function(e){return Array.isArray(e)?e.filter(n):n(e)?e:``}}},t.exports=e.default})),me=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(pe());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),he=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(ie()),i=o(T()),a=o(C());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)({separator:`,`}),r.default,a.default),t.exports=e.default})),ge=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(he());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),_e=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(ie()),i=o(T()),a=o(C());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)({separator:`,`,conjunction:`and`}),r.default,a.default),t.exports=e.default})),ve=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(_e());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ye=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(ie()),i=o(T()),a=o(C());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)({separator:`,`,conjunction:`or`}),r.default,a.default),t.exports=e.default})),be=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ye());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),xe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=c(S()),r=c(ie()),i=c(T()),a=c(C()),o=c(fe()),s=c(me());function c(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,o.default)(`
|
|
3
3
|
`),s.default,i.default,r.default,a.default),t.exports=e.default})),Se=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(xe());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Ce=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Se());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),we=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Se());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Te=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=c(S()),r=c(ie()),i=c(T()),a=c(C()),o=c(fe()),s=c(se());function c(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,o.default)(`
|
|
4
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})),Ee=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Te());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),De=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=a(S()),r=a(C()),i=a(ae());function a(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)(/(?:\n(?:\s*))+/g,` `),r.default),t.exports=e.default})),Oe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(De());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ke=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=a(S()),r=a(C()),i=a(ae());function a(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,i.default)(/(?:\n\s*)/g,``),r.default),t.exports=e.default})),Ae=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ke());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),je=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(T()),i=o(C()),a=o(ae());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,r.default)({separator:`,`}),(0,a.default)(/(?:\s+)/g,` `),i.default),t.exports=e.default})),Me=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(je());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Ne=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(T()),i=o(C()),a=o(ae());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,r.default)({separator:`,`,conjunction:`or`}),(0,a.default)(/(?:\s+)/g,` `),i.default),t.exports=e.default})),Pe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Ne());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Fe=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(T()),i=o(C()),a=o(ae());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,r.default)({separator:`,`,conjunction:`and`}),(0,a.default)(/(?:\s+)/g,` `),i.default),t.exports=e.default})),Ie=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Fe());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Le=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(ie()),i=o(T()),a=o(C());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default(i.default,r.default,a.default),t.exports=e.default})),Re=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Le());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),ze=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=o(S()),r=o(T()),i=o(C()),a=o(ae());function o(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default(r.default,(0,a.default)(/(?:\s+)/g,` `),i.default),t.exports=e.default})),Be=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(ze());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Ve=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=a(S()),r=a(ie()),i=a(C());function a(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default(r.default,i.default),t.exports=e.default})),He=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Ve());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),Ue=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=a(S()),r=a(ie()),i=a(C());function a(e){return e&&e.__esModule?e:{default:e}}e.default=new n.default((0,r.default)(`all`),i.default),t.exports=e.default})),We=v(((e,t)=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.default=void 0;var n=r(Ue());function r(e){return e&&e.__esModule?e:{default:e}}e.default=n.default,t.exports=e.default})),E=v((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.stripIndents=e.stripIndent=e.oneLineInlineLists=e.inlineLists=e.oneLineCommaListsAnd=e.oneLineCommaListsOr=e.oneLineCommaLists=e.oneLineTrim=e.oneLine=e.safeHtml=e.source=e.codeBlock=e.html=e.commaListsOr=e.commaListsAnd=e.commaLists=e.removeNonPrintingValuesTransformer=e.splitStringTransformer=e.inlineArrayTransformer=e.replaceStringTransformer=e.replaceSubstitutionTransformer=e.replaceResultTransformer=e.stripIndentTransformer=e.trimResultTransformer=e.TemplateTag=void 0;var t=w(S()),n=w(C()),r=w(ie()),i=w(ae()),a=w(se()),o=w(le()),s=w(T()),c=w(fe()),l=w(me()),u=w(ge()),d=w(ve()),f=w(be()),p=w(Se()),m=w(Ce()),h=w(we()),g=w(Ee()),_=w(Oe()),v=w(Ae()),y=w(Me()),b=w(Pe()),x=w(Ie()),ee=w(Re()),te=w(Be()),ne=w(He()),re=w(We());function w(e){return e&&e.__esModule?e:{default:e}}e.TemplateTag=t.default,e.trimResultTransformer=n.default,e.stripIndentTransformer=r.default,e.replaceResultTransformer=i.default,e.replaceSubstitutionTransformer=a.default,e.replaceStringTransformer=o.default,e.inlineArrayTransformer=s.default,e.splitStringTransformer=c.default,e.removeNonPrintingValuesTransformer=l.default,e.commaLists=u.default,e.commaListsAnd=d.default,e.commaListsOr=f.default,e.html=p.default,e.codeBlock=m.default,e.source=h.default,e.safeHtml=g.default,e.oneLine=_.default,e.oneLineTrim=v.default,e.oneLineCommaLists=y.default,e.oneLineCommaListsOr=b.default,e.oneLineCommaListsAnd=x.default,e.inlineLists=ee.default,e.oneLineInlineLists=te.default,e.stripIndent=ne.default,e.stripIndents=re.default}))(),Ge=class extends Map{constructor(e={}){if(super(),!(e.maxSize&&e.maxSize>0))throw TypeError("`maxSize` must be a number greater than 0");if(typeof e.maxAge==`number`&&e.maxAge===0)throw TypeError("`maxAge` must be a number greater than 0");this.maxSize=e.maxSize,this.maxAge=e.maxAge||1/0,this.onEviction=e.onEviction,this.cache=new Map,this.oldCache=new Map,this._size=0}_emitEvictions(e){if(typeof this.onEviction==`function`)for(let[t,n]of e)this.onEviction(t,n.value)}_deleteIfExpired(e,t){return typeof t.expiry==`number`&&t.expiry<=Date.now()?(typeof this.onEviction==`function`&&this.onEviction(e,t.value),this.delete(e)):!1}_getOrDeleteIfExpired(e,t){if(this._deleteIfExpired(e,t)===!1)return t.value}_getItemValue(e,t){return t.expiry?this._getOrDeleteIfExpired(e,t):t.value}_peek(e,t){let n=t.get(e);return this._getItemValue(e,n)}_set(e,t){this.cache.set(e,t),this._size++,this._size>=this.maxSize&&(this._size=0,this._emitEvictions(this.oldCache),this.oldCache=this.cache,this.cache=new Map)}_moveToRecent(e,t){this.oldCache.delete(e),this._set(e,t)}*_entriesAscending(){for(let e of this.oldCache){let[t,n]=e;this.cache.has(t)||this._deleteIfExpired(t,n)===!1&&(yield e)}for(let e of this.cache){let[t,n]=e;this._deleteIfExpired(t,n)===!1&&(yield e)}}get(e){if(this.cache.has(e)){let t=this.cache.get(e);return this._getItemValue(e,t)}if(this.oldCache.has(e)){let t=this.oldCache.get(e);if(this._deleteIfExpired(e,t)===!1)return this._moveToRecent(e,t),t.value}}set(e,t,{maxAge:n=this.maxAge}={}){let r=typeof n==`number`&&n!==1/0?Date.now()+n:void 0;return this.cache.has(e)?this.cache.set(e,{value:t,expiry:r}):this._set(e,{value:t,expiry:r}),this}has(e){return this.cache.has(e)?!this._deleteIfExpired(e,this.cache.get(e)):this.oldCache.has(e)?!this._deleteIfExpired(e,this.oldCache.get(e)):!1}peek(e){if(this.cache.has(e))return this._peek(e,this.cache);if(this.oldCache.has(e))return this._peek(e,this.oldCache)}delete(e){let t=this.cache.delete(e);return t&&this._size--,this.oldCache.delete(e)||t}clear(){this.cache.clear(),this.oldCache.clear(),this._size=0}resize(e){if(!(e&&e>0))throw TypeError("`maxSize` must be a number greater than 0");let t=[...this._entriesAscending()],n=t.length-e;n<0?(this.cache=new Map(t),this.oldCache=new Map,this._size=t.length):(n>0&&this._emitEvictions(t.slice(0,n)),this.oldCache=new Map(t.slice(n)),this.cache=new Map,this._size=0),this.maxSize=e}*keys(){for(let[e]of this)yield e}*values(){for(let[,e]of this)yield e}*[Symbol.iterator](){for(let e of this.cache){let[t,n]=e;this._deleteIfExpired(t,n)===!1&&(yield[t,n.value])}for(let e of this.oldCache){let[t,n]=e;this.cache.has(t)||this._deleteIfExpired(t,n)===!1&&(yield[t,n.value])}}*entriesDescending(){let e=[...this.cache];for(let t=e.length-1;t>=0;--t){let[n,r]=e[t];this._deleteIfExpired(n,r)===!1&&(yield[n,r.value])}e=[...this.oldCache];for(let t=e.length-1;t>=0;--t){let[n,r]=e[t];this.cache.has(n)||this._deleteIfExpired(n,r)===!1&&(yield[n,r.value])}}*entriesAscending(){for(let[e,t]of this._entriesAscending())yield[e,t.value]}get size(){if(!this._size)return this.oldCache.size;let e=0;for(let t of this.oldCache.keys())this.cache.has(t)||e++;return Math.min(this._size+e,this.maxSize)}entries(){return this.entriesAscending()}forEach(e,t=this){for(let[n,r]of this.entriesAscending())e.call(t,r,n,this)}get[Symbol.toStringTag](){return JSON.stringify([...this.entriesAscending()])}};function Ke(e,t){return(!e||e.endsWith(`
|
|
5
5
|
`))&&!t?.force?e:e+`
|
|
@@ -216,7 +216,7 @@ EXAMPLES
|
|
|
216
216
|
prismic custom-type add-field boolean article published --default
|
|
217
217
|
prismic custom-type add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!d){console.error(`Missing required argument: type-id
|
|
218
218
|
`),console.error(`Usage: prismic custom-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
|
|
219
|
-
`),console.error(`Usage: prismic custom-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}let p=await W(`package.json`);if(!p){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let m=new URL(`customtypes/${d}/index.json`,p),h;try{let e=await r(m,`utf8`),t=B(Kn,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${m.href}`),process.exitCode=1;return}h=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${d}\n`),console.error(`Create it first with: prismic custom-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let g=Object.keys(h.json),_=n??g[0]??`Main`;h.json[_]||(h.json[_]={});for(let[e,t]of Object.entries(h.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let v={type:`Boolean`,config:{label:i??J(f),...a&&{default_value:!0},...o&&{placeholder_true:o},...c&&{placeholder_false:c}}};h.json[_][f]=v;try{await s(m,q(h))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Boolean) to "${_}" tab in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Jn=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Yn(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing custom type.
|
|
219
|
+
`),console.error(`Usage: prismic custom-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}let p=await W(`package.json`);if(!p){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let m=new URL(`customtypes/${d}/index.json`,p),h;try{let e=await r(m,`utf8`),t=B(Kn,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${m.href}`),process.exitCode=1;return}h=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${d}\n`),console.error(`Create it first with: prismic custom-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let g=Object.keys(h.json),_=n??g[0]??`Main`;h.json[_]||(h.json[_]={});for(let[e,t]of Object.entries(h.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let v={type:`Boolean`,config:{label:i??J(f),...a&&{default_value:!0},...o&&{placeholder_true:o},...c&&{placeholder_false:c}}};h.json[_][f]=v;try{await s(m,q(h))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Boolean) to "${_}" tab in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Jn=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Yn(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing custom type.
|
|
220
220
|
|
|
221
221
|
USAGE
|
|
222
222
|
prismic custom-type add-field color <type-id> <field-id> [flags]
|
|
@@ -240,7 +240,7 @@ EXAMPLES
|
|
|
240
240
|
prismic custom-type add-field color homepage accent --tab "Design"
|
|
241
241
|
prismic custom-type add-field color homepage text_color --label "Text Color"`);return}if(!l){console.error(`Missing required argument: type-id
|
|
242
242
|
`),console.error(`Usage: prismic custom-type add-field color <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
|
|
243
|
-
`),console.error(`Usage: prismic custom-type add-field color <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Jn,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Color`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Color) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Xn=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Zn(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date field to an existing custom type.
|
|
243
|
+
`),console.error(`Usage: prismic custom-type add-field color <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Jn,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Color`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Color) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Xn=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Zn(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date field to an existing custom type.
|
|
244
244
|
|
|
245
245
|
USAGE
|
|
246
246
|
prismic custom-type add-field date <type-id> <field-id> [flags]
|
|
@@ -265,7 +265,7 @@ EXAMPLES
|
|
|
265
265
|
prismic custom-type add-field date event start_date --tab "Schedule"
|
|
266
266
|
prismic custom-type add-field date article date --label "Publication Date" --default "2024-01-01"`);return}if(!u){console.error(`Missing required argument: type-id
|
|
267
267
|
`),console.error(`Usage: prismic custom-type add-field date <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
|
|
268
|
-
`),console.error(`Usage: prismic custom-type add-field date <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(Xn,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${u}\n`),console.error(`Create it first with: prismic custom-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Date`,config:{label:i??J(d),...a&&{placeholder:a},...o&&{default:o}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Date) to "${g}" tab in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Qn=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function $n(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed field to an existing custom type.
|
|
268
|
+
`),console.error(`Usage: prismic custom-type add-field date <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(Xn,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${u}\n`),console.error(`Create it first with: prismic custom-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Date`,config:{label:i??J(d),...a&&{placeholder:a},...o&&{default:o}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Date) to "${g}" tab in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Qn=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function $n(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed field to an existing custom type.
|
|
269
269
|
|
|
270
270
|
USAGE
|
|
271
271
|
prismic custom-type add-field embed <type-id> <field-id> [flags]
|
|
@@ -289,7 +289,7 @@ EXAMPLES
|
|
|
289
289
|
prismic custom-type add-field embed homepage youtube --tab "Media"
|
|
290
290
|
prismic custom-type add-field embed homepage media --label "Media Embed"`);return}if(!l){console.error(`Missing required argument: type-id
|
|
291
291
|
`),console.error(`Usage: prismic custom-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
|
|
292
|
-
`),console.error(`Usage: prismic custom-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Qn,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Embed`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Embed) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const er=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function tr(){let{values:{help:t,tab:n,label:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geo-point (location) field to an existing custom type.
|
|
292
|
+
`),console.error(`Usage: prismic custom-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Qn,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Embed`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Embed) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const er=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function tr(){let{values:{help:t,tab:n,label:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geo-point (location) field to an existing custom type.
|
|
293
293
|
|
|
294
294
|
USAGE
|
|
295
295
|
prismic custom-type add-field geo-point <type-id> <field-id> [flags]
|
|
@@ -312,7 +312,7 @@ EXAMPLES
|
|
|
312
312
|
prismic custom-type add-field geo-point store address --tab "Details"
|
|
313
313
|
prismic custom-type add-field geo-point event venue --label "Event Venue"`);return}if(!c){console.error(`Missing required argument: type-id
|
|
314
314
|
`),console.error(`Usage: prismic custom-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
|
|
315
|
-
`),console.error(`Usage: prismic custom-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(er,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${c}\n`),console.error(`Create it first with: prismic custom-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`GeoPoint`,config:{label:i??J(l)}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${l}" (GeoPoint) to "${m}" tab in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const nr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function rr(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing custom type.
|
|
315
|
+
`),console.error(`Usage: prismic custom-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(er,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${c}\n`),console.error(`Create it first with: prismic custom-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`GeoPoint`,config:{label:i??J(l)}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${l}" (GeoPoint) to "${m}" tab in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const nr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function rr(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing custom type.
|
|
316
316
|
|
|
317
317
|
USAGE
|
|
318
318
|
prismic custom-type add-field image <type-id> <field-id> [flags]
|
|
@@ -336,7 +336,7 @@ EXAMPLES
|
|
|
336
336
|
prismic custom-type add-field image article thumbnail --tab "Media"
|
|
337
337
|
prismic custom-type add-field image product photo --label "Product Photo"`);return}if(!l){console.error(`Missing required argument: type-id
|
|
338
338
|
`),console.error(`Usage: prismic custom-type add-field image <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
|
|
339
|
-
`),console.error(`Usage: prismic custom-type add-field image <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(nr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Image`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Image) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const ir=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function ar(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing custom type.
|
|
339
|
+
`),console.error(`Usage: prismic custom-type add-field image <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(nr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Image`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Image) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const ir=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function ar(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing custom type.
|
|
340
340
|
|
|
341
341
|
USAGE
|
|
342
342
|
prismic custom-type add-field key-text <type-id> <field-id> [flags]
|
|
@@ -360,7 +360,7 @@ EXAMPLES
|
|
|
360
360
|
prismic custom-type add-field key-text homepage meta_title --tab "SEO"
|
|
361
361
|
prismic custom-type add-field key-text homepage subtitle --label "Subtitle" --placeholder "Enter subtitle"`);return}if(!l){console.error(`Missing required argument: type-id
|
|
362
362
|
`),console.error(`Usage: prismic custom-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
|
|
363
|
-
`),console.error(`Usage: prismic custom-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(ir,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Text`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Text) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const or=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function sr(){let{values:{help:t,tab:n,label:i,placeholder:a,variation:o,"allow-text":c,"allow-target-blank":l,repeatable:u,types:d,"no-types":f},positionals:[p,m]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},variation:{type:`string`,multiple:!0},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing custom type.
|
|
363
|
+
`),console.error(`Usage: prismic custom-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(ir,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Text`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Text) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const or=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function sr(){let{values:{help:t,tab:n,label:i,placeholder:a,variation:o,"allow-text":c,"allow-target-blank":l,repeatable:u,types:d,"no-types":f},positionals:[p,m]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},variation:{type:`string`,multiple:!0},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing custom type.
|
|
364
364
|
|
|
365
365
|
USAGE
|
|
366
366
|
prismic custom-type add-field link <type-id> <field-id> [flags]
|
|
@@ -389,7 +389,7 @@ EXAMPLES
|
|
|
389
389
|
prismic custom-type add-field link homepage cta --variation Primary --variation Secondary
|
|
390
390
|
prismic custom-type add-field link homepage links --repeatable`);return}if(!p){console.error(`Missing required argument: type-id
|
|
391
391
|
`),console.error(`Usage: prismic custom-type add-field link <type-id> <field-id>`),process.exitCode=1;return}if(!m){console.error(`Missing required argument: field-id
|
|
392
|
-
`),console.error(`Usage: prismic custom-type add-field link <type-id> <field-id>`),process.exitCode=1;return}let h=await W(`package.json`);if(!h){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let g=new URL(`customtypes/${p}/index.json`,h),_;try{let e=await r(g,`utf8`),t=B(or,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${g.href}`),process.exitCode=1;return}_=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${p}\n`),console.error(`Create it first with: prismic custom-type create ${p}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let v=Object.keys(_.json),y=n??v[0]??`Main`;_.json[y]||(_.json[y]={});for(let[e,t]of Object.entries(_.json))if(t[m]){console.error(`Field "${m}" already exists in tab "${e}"`),process.exitCode=1;return}let b={type:`Link`,config:{label:i??J(m),...a&&{placeholder:a},...o&&o.length>0&&{variants:o},...c&&{allowText:!0},...l&&{allowTargetBlank:!0},...u&&{repeat:!0}}};_.json[y][m]=b;try{await s(g,q(_))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${m}" (Link) to "${y}" tab in ${p}`),!f)try{await K({output:d}),console.info(`Updated types in ${d??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const cr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function lr(){let{values:{help:t,tab:n,label:i,placeholder:a,min:o,max:c,step:l,types:u,"no-types":d},positionals:[f,p]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},min:{type:`string`},max:{type:`string`},step:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing custom type.
|
|
392
|
+
`),console.error(`Usage: prismic custom-type add-field link <type-id> <field-id>`),process.exitCode=1;return}let h=await W(`package.json`);if(!h){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let g=new URL(`customtypes/${p}/index.json`,h),_;try{let e=await r(g,`utf8`),t=B(or,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${g.href}`),process.exitCode=1;return}_=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${p}\n`),console.error(`Create it first with: prismic custom-type create ${p}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let v=Object.keys(_.json),y=n??v[0]??`Main`;_.json[y]||(_.json[y]={});for(let[e,t]of Object.entries(_.json))if(t[m]){console.error(`Field "${m}" already exists in tab "${e}"`),process.exitCode=1;return}let b={type:`Link`,config:{label:i??J(m),...a&&{placeholder:a},...o&&o.length>0&&{variants:o},...c&&{allowText:!0},...l&&{allowTargetBlank:!0},...u&&{repeat:!0}}};_.json[y][m]=b;try{await s(g,q(_))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${m}" (Link) to "${y}" tab in ${p}`),!f)try{await K({output:d}),console.info(`Updated types in ${d??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const cr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function lr(){let{values:{help:t,tab:n,label:i,placeholder:a,min:o,max:c,step:l,types:u,"no-types":d},positionals:[f,p]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},min:{type:`string`},max:{type:`string`},step:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing custom type.
|
|
393
393
|
|
|
394
394
|
USAGE
|
|
395
395
|
prismic custom-type add-field number <type-id> <field-id> [flags]
|
|
@@ -416,7 +416,7 @@ EXAMPLES
|
|
|
416
416
|
prismic custom-type add-field number product quantity --min 0 --max 100
|
|
417
417
|
prismic custom-type add-field number settings rating --min 1 --max 5 --step 1`);return}if(!f){console.error(`Missing required argument: type-id
|
|
418
418
|
`),console.error(`Usage: prismic custom-type add-field number <type-id> <field-id>`),process.exitCode=1;return}if(!p){console.error(`Missing required argument: field-id
|
|
419
|
-
`),console.error(`Usage: prismic custom-type add-field number <type-id> <field-id>`),process.exitCode=1;return}let m=o===void 0?void 0:Number(o),h=c===void 0?void 0:Number(c),g=l===void 0?void 0:Number(l);if(o!==void 0&&Number.isNaN(m)){console.error(`Invalid --min value: must be a number`),process.exitCode=1;return}if(c!==void 0&&Number.isNaN(h)){console.error(`Invalid --max value: must be a number`),process.exitCode=1;return}if(l!==void 0&&Number.isNaN(g)){console.error(`Invalid --step value: must be a number`),process.exitCode=1;return}let _=await W(`package.json`);if(!_){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let v=new URL(`customtypes/${f}/index.json`,_),y;try{let e=await r(v,`utf8`),t=B(cr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${v.href}`),process.exitCode=1;return}y=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${f}\n`),console.error(`Create it first with: prismic custom-type create ${f}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let b=Object.keys(y.json),x=n??b[0]??`Main`;y.json[x]||(y.json[x]={});for(let[e,t]of Object.entries(y.json))if(t[p]){console.error(`Field "${p}" already exists in tab "${e}"`),process.exitCode=1;return}let ee={type:`Number`,config:{label:i??J(p),...a&&{placeholder:a},...m!==void 0&&{min:m},...h!==void 0&&{max:h},...g!==void 0&&{step:g}}};y.json[x][p]=ee;try{await s(v,q(y))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${p}" (Number) to "${x}" tab in ${f}`),!d)try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const ur=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function dr(){let{values:{help:t,tab:n,label:i,placeholder:a,single:o,multi:c,"allow-target-blank":l,types:u,"no-types":d},positionals:[f,p]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing custom type.
|
|
419
|
+
`),console.error(`Usage: prismic custom-type add-field number <type-id> <field-id>`),process.exitCode=1;return}let m=o===void 0?void 0:Number(o),h=c===void 0?void 0:Number(c),g=l===void 0?void 0:Number(l);if(o!==void 0&&Number.isNaN(m)){console.error(`Invalid --min value: must be a number`),process.exitCode=1;return}if(c!==void 0&&Number.isNaN(h)){console.error(`Invalid --max value: must be a number`),process.exitCode=1;return}if(l!==void 0&&Number.isNaN(g)){console.error(`Invalid --step value: must be a number`),process.exitCode=1;return}let _=await W(`package.json`);if(!_){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let v=new URL(`customtypes/${f}/index.json`,_),y;try{let e=await r(v,`utf8`),t=B(cr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${v.href}`),process.exitCode=1;return}y=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${f}\n`),console.error(`Create it first with: prismic custom-type create ${f}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let b=Object.keys(y.json),x=n??b[0]??`Main`;y.json[x]||(y.json[x]={});for(let[e,t]of Object.entries(y.json))if(t[p]){console.error(`Field "${p}" already exists in tab "${e}"`),process.exitCode=1;return}let ee={type:`Number`,config:{label:i??J(p),...a&&{placeholder:a},...m!==void 0&&{min:m},...h!==void 0&&{max:h},...g!==void 0&&{step:g}}};y.json[x][p]=ee;try{await s(v,q(y))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${p}" (Number) to "${x}" tab in ${f}`),!d)try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const ur=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function dr(){let{values:{help:t,tab:n,label:i,placeholder:a,single:o,multi:c,"allow-target-blank":l,types:u,"no-types":d},positionals:[f,p]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing custom type.
|
|
420
420
|
|
|
421
421
|
USAGE
|
|
422
422
|
prismic custom-type add-field rich-text <type-id> <field-id> [flags]
|
|
@@ -449,7 +449,7 @@ EXAMPLES
|
|
|
449
449
|
prismic custom-type add-field rich-text page tagline --single "heading1"
|
|
450
450
|
prismic custom-type add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!f){console.error(`Missing required argument: type-id
|
|
451
451
|
`),console.error(`Usage: prismic custom-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}if(!p){console.error(`Missing required argument: field-id
|
|
452
|
-
`),console.error(`Usage: prismic custom-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}let m=await W(`package.json`);if(!m){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let h=new URL(`customtypes/${f}/index.json`,m),g;try{let e=await r(h,`utf8`),t=B(ur,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${h.href}`),process.exitCode=1;return}g=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${f}\n`),console.error(`Create it first with: prismic custom-type create ${f}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let _=Object.keys(g.json),v=n??_[0]??`Main`;g.json[v]||(g.json[v]={});for(let[e,t]of Object.entries(g.json))if(t[p]){console.error(`Field "${p}" already exists in tab "${e}"`),process.exitCode=1;return}let y={type:`StructuredText`,config:{label:i??J(p),...a&&{placeholder:a},...o&&{single:o},...c&&{multi:c},...l&&{allowTargetBlank:!0}}};g.json[v][p]=y;try{await s(h,q(g))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${p}" (StructuredText) to "${v}" tab in ${f}`),!d)try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const fr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function pr(){let{values:{help:t,tab:n,label:i,placeholder:a,option:o,default:c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing custom type.
|
|
452
|
+
`),console.error(`Usage: prismic custom-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}let m=await W(`package.json`);if(!m){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let h=new URL(`customtypes/${f}/index.json`,m),g;try{let e=await r(h,`utf8`),t=B(ur,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${h.href}`),process.exitCode=1;return}g=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${f}\n`),console.error(`Create it first with: prismic custom-type create ${f}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let _=Object.keys(g.json),v=n??_[0]??`Main`;g.json[v]||(g.json[v]={});for(let[e,t]of Object.entries(g.json))if(t[p]){console.error(`Field "${p}" already exists in tab "${e}"`),process.exitCode=1;return}let y={type:`StructuredText`,config:{label:i??J(p),...a&&{placeholder:a},...o&&{single:o},...c&&{multi:c},...l&&{allowTargetBlank:!0}}};g.json[v][p]=y;try{await s(h,q(g))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${p}" (StructuredText) to "${v}" tab in ${f}`),!d)try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const fr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function pr(){let{values:{help:t,tab:n,label:i,placeholder:a,option:o,default:c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing custom type.
|
|
453
453
|
|
|
454
454
|
USAGE
|
|
455
455
|
prismic custom-type add-field select <type-id> <field-id> [flags]
|
|
@@ -475,7 +475,7 @@ EXAMPLES
|
|
|
475
475
|
prismic custom-type add-field select product size --option "small" --option "medium" --option "large" --default "medium"
|
|
476
476
|
prismic custom-type add-field select article status --option "draft" --option "published" --label "Status"`);return}if(!d){console.error(`Missing required argument: type-id
|
|
477
477
|
`),console.error(`Usage: prismic custom-type add-field select <type-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
|
|
478
|
-
`),console.error(`Usage: prismic custom-type add-field select <type-id> <field-id>`),process.exitCode=1;return}let p=await W(`package.json`);if(!p){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let m=new URL(`customtypes/${d}/index.json`,p),h;try{let e=await r(m,`utf8`),t=B(fr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${m.href}`),process.exitCode=1;return}h=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${d}\n`),console.error(`Create it first with: prismic custom-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let g=Object.keys(h.json),_=n??g[0]??`Main`;h.json[_]||(h.json[_]={});for(let[e,t]of Object.entries(h.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let v={type:`Select`,config:{label:i??J(f),...a&&{placeholder:a},...o&&o.length>0&&{options:o},...c&&{default_value:c}}};h.json[_][f]=v;try{await s(m,q(h))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Select) to "${_}" tab in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const mr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function hr(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a timestamp (date and time) field to an existing custom type.
|
|
478
|
+
`),console.error(`Usage: prismic custom-type add-field select <type-id> <field-id>`),process.exitCode=1;return}let p=await W(`package.json`);if(!p){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let m=new URL(`customtypes/${d}/index.json`,p),h;try{let e=await r(m,`utf8`),t=B(fr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${m.href}`),process.exitCode=1;return}h=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${d}\n`),console.error(`Create it first with: prismic custom-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let g=Object.keys(h.json),_=n??g[0]??`Main`;h.json[_]||(h.json[_]={});for(let[e,t]of Object.entries(h.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let v={type:`Select`,config:{label:i??J(f),...a&&{placeholder:a},...o&&o.length>0&&{options:o},...c&&{default_value:c}}};h.json[_][f]=v;try{await s(m,q(h))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Select) to "${_}" tab in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const mr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function hr(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a timestamp (date and time) field to an existing custom type.
|
|
479
479
|
|
|
480
480
|
USAGE
|
|
481
481
|
prismic custom-type add-field timestamp <type-id> <field-id> [flags]
|
|
@@ -500,7 +500,7 @@ EXAMPLES
|
|
|
500
500
|
prismic custom-type add-field timestamp event start --tab "Schedule"
|
|
501
501
|
prismic custom-type add-field timestamp article published_at --label "Published At"`);return}if(!u){console.error(`Missing required argument: type-id
|
|
502
502
|
`),console.error(`Usage: prismic custom-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
|
|
503
|
-
`),console.error(`Usage: prismic custom-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(mr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${u}\n`),console.error(`Create it first with: prismic custom-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Timestamp`,config:{label:i??J(d),...a&&{placeholder:a},...o&&{default:o}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Timestamp) to "${g}" tab in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const gr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function _r(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a UID (unique identifier) field to an existing custom type.
|
|
503
|
+
`),console.error(`Usage: prismic custom-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(mr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${u}\n`),console.error(`Create it first with: prismic custom-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Timestamp`,config:{label:i??J(d),...a&&{placeholder:a},...o&&{default:o}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Timestamp) to "${g}" tab in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const gr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function _r(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a UID (unique identifier) field to an existing custom type.
|
|
504
504
|
|
|
505
505
|
USAGE
|
|
506
506
|
prismic custom-type add-field uid <type-id> <field-id> [flags]
|
|
@@ -524,7 +524,7 @@ EXAMPLES
|
|
|
524
524
|
prismic custom-type add-field uid article slug --label "URL Slug"
|
|
525
525
|
prismic custom-type add-field uid product sku --placeholder "Enter unique SKU"`);return}if(!l){console.error(`Missing required argument: type-id
|
|
526
526
|
`),console.error(`Usage: prismic custom-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
|
|
527
|
-
`),console.error(`Usage: prismic custom-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(gr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`UID`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (UID) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function vr(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await qn();break;case`color`:await Yn();break;case`date`:await Zn();break;case`embed`:await $n();break;case`geo-point`:await tr();break;case`image`:await rr();break;case`key-text`:await ar();break;case`link`:await sr();break;case`number`:await lr();break;case`rich-text`:await dr();break;case`select`:await pr();break;case`timestamp`:await hr();break;case`uid`:await _r();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing custom type.
|
|
527
|
+
`),console.error(`Usage: prismic custom-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(gr,JSON.parse(e));if(!t.success){console.error(`Invalid custom type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Custom type not found: ${l}\n`),console.error(`Create it first with: prismic custom-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read custom type: ${e.message}`):console.error(`Failed to read custom type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`UID`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update custom type: ${e.message}`):console.error(`Failed to update custom type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (UID) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic custom-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function vr(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await qn();break;case`color`:await Yn();break;case`date`:await Zn();break;case`embed`:await $n();break;case`geo-point`:await tr();break;case`image`:await rr();break;case`key-text`:await ar();break;case`link`:await sr();break;case`number`:await lr();break;case`rich-text`:await dr();break;case`select`:await pr();break;case`timestamp`:await hr();break;case`uid`:await _r();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing custom type.
|
|
528
528
|
|
|
529
529
|
USAGE
|
|
530
530
|
prismic custom-type add-field <field-type> <type-id> <field-id> [flags]
|
|
@@ -594,7 +594,7 @@ FLAGS
|
|
|
594
594
|
-h, --help Show help for command
|
|
595
595
|
|
|
596
596
|
LEARN MORE
|
|
597
|
-
Use \`prismic custom-type <command> --help\` for more information about a command.`);return}if(!c){console.error(`Missing required argument: id`),process.exitCode=1;return}let l={id:c,label:r??Sr(c),repeatable:!i,status:!0,format:`custom`,json:{Main:{}}},u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/`,u),f=new URL(c+`/`,d),p=new URL(`index.json`,f);try{await n(new URL(`.`,p),{recursive:!0}),await s(p,q(l))}catch(e){e instanceof Error?console.error(`Failed to create custom type: ${e.message}`):console.error(`Failed to create custom type`),process.exitCode=1;return}if(console.info(`Created custom type at ${p.href}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}function Sr(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}const Cr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function wr(){let{values:{help:t,"slice-zone":n,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Disconnect a shared slice from a custom type's slice zone.
|
|
597
|
+
Use \`prismic custom-type <command> --help\` for more information about a command.`);return}if(!c){console.error(`Missing required argument: id`),process.exitCode=1;return}let l={id:c,label:r??Sr(c),repeatable:!i,status:!0,format:`custom`,json:{Main:{}}},u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/`,u),f=new URL(c+`/`,d),p=new URL(`index.json`,f);try{await n(new URL(`.`,p),{recursive:!0}),await s(p,q(l))}catch(e){e instanceof Error?console.error(`Failed to create custom type: ${e.message}`):console.error(`Failed to create custom type`),process.exitCode=1;return}if(console.info(`Created custom type at ${p.href}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add fields with `prismic custom-type add-field`")}function Sr(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}const Cr=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function wr(){let{values:{help:t,"slice-zone":n,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Disconnect a shared slice from a custom type's slice zone.
|
|
598
598
|
|
|
599
599
|
USAGE
|
|
600
600
|
prismic custom-type disconnect-slice <type-id> <slice-id> [flags]
|
|
@@ -857,7 +857,7 @@ EXAMPLES
|
|
|
857
857
|
prismic page-type add-field boolean article published --default
|
|
858
858
|
prismic page-type add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!d){console.error(`Missing required argument: type-id
|
|
859
859
|
`),console.error(`Usage: prismic page-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
|
|
860
|
-
`),console.error(`Usage: prismic page-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}let p=await W(`package.json`);if(!p){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let m=new URL(`customtypes/${d}/index.json`,p),h;try{let e=await r(m,`utf8`),t=B(mi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${m.href}`),process.exitCode=1;return}h=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${d}\n`),console.error(`Create it first with: prismic page-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let g=Object.keys(h.json),_=n??g[0]??`Main`;h.json[_]||(h.json[_]={});for(let[e,t]of Object.entries(h.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let v={type:`Boolean`,config:{label:i??J(f),...a&&{default_value:!0},...o&&{placeholder_true:o},...c&&{placeholder_false:c}}};h.json[_][f]=v;try{await s(m,q(h))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Boolean) to "${_}" tab in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const gi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function _i(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing page type.
|
|
860
|
+
`),console.error(`Usage: prismic page-type add-field boolean <type-id> <field-id>`),process.exitCode=1;return}let p=await W(`package.json`);if(!p){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let m=new URL(`customtypes/${d}/index.json`,p),h;try{let e=await r(m,`utf8`),t=B(mi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${m.href}`),process.exitCode=1;return}h=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${d}\n`),console.error(`Create it first with: prismic page-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let g=Object.keys(h.json),_=n??g[0]??`Main`;h.json[_]||(h.json[_]={});for(let[e,t]of Object.entries(h.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let v={type:`Boolean`,config:{label:i??J(f),...a&&{default_value:!0},...o&&{placeholder_true:o},...c&&{placeholder_false:c}}};h.json[_][f]=v;try{await s(m,q(h))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Boolean) to "${_}" tab in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const gi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function _i(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing page type.
|
|
861
861
|
|
|
862
862
|
USAGE
|
|
863
863
|
prismic page-type add-field color <type-id> <field-id> [flags]
|
|
@@ -881,7 +881,7 @@ EXAMPLES
|
|
|
881
881
|
prismic page-type add-field color homepage accent --tab "Design"
|
|
882
882
|
prismic page-type add-field color homepage text_color --label "Text Color"`);return}if(!l){console.error(`Missing required argument: type-id
|
|
883
883
|
`),console.error(`Usage: prismic page-type add-field color <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
|
|
884
|
-
`),console.error(`Usage: prismic page-type add-field color <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(gi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Color`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Color) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const vi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function yi(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date field to an existing page type.
|
|
884
|
+
`),console.error(`Usage: prismic page-type add-field color <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(gi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Color`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Color) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const vi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function yi(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date field to an existing page type.
|
|
885
885
|
|
|
886
886
|
USAGE
|
|
887
887
|
prismic page-type add-field date <type-id> <field-id> [flags]
|
|
@@ -906,7 +906,7 @@ EXAMPLES
|
|
|
906
906
|
prismic page-type add-field date event start_date --tab "Schedule"
|
|
907
907
|
prismic page-type add-field date article date --label "Publication Date" --default "2024-01-01"`);return}if(!u){console.error(`Missing required argument: type-id
|
|
908
908
|
`),console.error(`Usage: prismic page-type add-field date <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
|
|
909
|
-
`),console.error(`Usage: prismic page-type add-field date <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(vi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${u}\n`),console.error(`Create it first with: prismic page-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Date`,config:{label:i??J(d),...a&&{placeholder:a},...o&&{default:o}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Date) to "${g}" tab in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const bi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function xi(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed field to an existing page type.
|
|
909
|
+
`),console.error(`Usage: prismic page-type add-field date <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(vi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${u}\n`),console.error(`Create it first with: prismic page-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Date`,config:{label:i??J(d),...a&&{placeholder:a},...o&&{default:o}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Date) to "${g}" tab in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const bi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function xi(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed field to an existing page type.
|
|
910
910
|
|
|
911
911
|
USAGE
|
|
912
912
|
prismic page-type add-field embed <type-id> <field-id> [flags]
|
|
@@ -930,7 +930,7 @@ EXAMPLES
|
|
|
930
930
|
prismic page-type add-field embed homepage youtube --tab "Media"
|
|
931
931
|
prismic page-type add-field embed homepage media --label "Media Embed"`);return}if(!l){console.error(`Missing required argument: type-id
|
|
932
932
|
`),console.error(`Usage: prismic page-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
|
|
933
|
-
`),console.error(`Usage: prismic page-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(bi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Embed`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Embed) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Si=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ci(){let{values:{help:t,tab:n,label:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geo-point (location) field to an existing page type.
|
|
933
|
+
`),console.error(`Usage: prismic page-type add-field embed <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(bi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Embed`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Embed) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Si=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ci(){let{values:{help:t,tab:n,label:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geo-point (location) field to an existing page type.
|
|
934
934
|
|
|
935
935
|
USAGE
|
|
936
936
|
prismic page-type add-field geo-point <type-id> <field-id> [flags]
|
|
@@ -953,7 +953,7 @@ EXAMPLES
|
|
|
953
953
|
prismic page-type add-field geo-point store address --tab "Details"
|
|
954
954
|
prismic page-type add-field geo-point event venue --label "Event Venue"`);return}if(!c){console.error(`Missing required argument: type-id
|
|
955
955
|
`),console.error(`Usage: prismic page-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
|
|
956
|
-
`),console.error(`Usage: prismic page-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(Si,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${c}\n`),console.error(`Create it first with: prismic page-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`GeoPoint`,config:{label:i??J(l)}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${l}" (GeoPoint) to "${m}" tab in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const wi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ti(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing page type.
|
|
956
|
+
`),console.error(`Usage: prismic page-type add-field geo-point <type-id> <field-id>`),process.exitCode=1;return}let u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/${c}/index.json`,u),f;try{let e=await r(d,`utf8`),t=B(Si,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${d.href}`),process.exitCode=1;return}f=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${c}\n`),console.error(`Create it first with: prismic page-type create ${c}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let p=Object.keys(f.json),m=n??p[0]??`Main`;f.json[m]||(f.json[m]={});for(let[e,t]of Object.entries(f.json))if(t[l]){console.error(`Field "${l}" already exists in tab "${e}"`),process.exitCode=1;return}let h={type:`GeoPoint`,config:{label:i??J(l)}};f.json[m][l]=h;try{await s(d,q(f))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${l}" (GeoPoint) to "${m}" tab in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const wi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ti(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing page type.
|
|
957
957
|
|
|
958
958
|
USAGE
|
|
959
959
|
prismic page-type add-field image <type-id> <field-id> [flags]
|
|
@@ -977,7 +977,7 @@ EXAMPLES
|
|
|
977
977
|
prismic page-type add-field image article thumbnail --tab "Media"
|
|
978
978
|
prismic page-type add-field image product photo --label "Product Photo"`);return}if(!l){console.error(`Missing required argument: type-id
|
|
979
979
|
`),console.error(`Usage: prismic page-type add-field image <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
|
|
980
|
-
`),console.error(`Usage: prismic page-type add-field image <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(wi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Image`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Image) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Ei=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Di(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing page type.
|
|
980
|
+
`),console.error(`Usage: prismic page-type add-field image <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(wi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Image`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Image) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Ei=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Di(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing page type.
|
|
981
981
|
|
|
982
982
|
USAGE
|
|
983
983
|
prismic page-type add-field key-text <type-id> <field-id> [flags]
|
|
@@ -1001,7 +1001,7 @@ EXAMPLES
|
|
|
1001
1001
|
prismic page-type add-field key-text homepage meta_title --tab "SEO"
|
|
1002
1002
|
prismic page-type add-field key-text homepage subtitle --label "Subtitle" --placeholder "Enter subtitle"`);return}if(!l){console.error(`Missing required argument: type-id
|
|
1003
1003
|
`),console.error(`Usage: prismic page-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
|
|
1004
|
-
`),console.error(`Usage: prismic page-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Ei,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Text`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Text) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Oi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function ki(){let{values:{help:t,tab:n,label:i,placeholder:a,variation:o,"allow-text":c,"allow-target-blank":l,repeatable:u,types:d,"no-types":f},positionals:[p,m]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},variation:{type:`string`,multiple:!0},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing page type.
|
|
1004
|
+
`),console.error(`Usage: prismic page-type add-field key-text <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Ei,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`Text`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (Text) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Oi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function ki(){let{values:{help:t,tab:n,label:i,placeholder:a,variation:o,"allow-text":c,"allow-target-blank":l,repeatable:u,types:d,"no-types":f},positionals:[p,m]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},variation:{type:`string`,multiple:!0},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing page type.
|
|
1005
1005
|
|
|
1006
1006
|
USAGE
|
|
1007
1007
|
prismic page-type add-field link <type-id> <field-id> [flags]
|
|
@@ -1030,7 +1030,7 @@ EXAMPLES
|
|
|
1030
1030
|
prismic page-type add-field link homepage cta --variation Primary --variation Secondary
|
|
1031
1031
|
prismic page-type add-field link homepage links --repeatable`);return}if(!p){console.error(`Missing required argument: type-id
|
|
1032
1032
|
`),console.error(`Usage: prismic page-type add-field link <type-id> <field-id>`),process.exitCode=1;return}if(!m){console.error(`Missing required argument: field-id
|
|
1033
|
-
`),console.error(`Usage: prismic page-type add-field link <type-id> <field-id>`),process.exitCode=1;return}let h=await W(`package.json`);if(!h){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let g=new URL(`customtypes/${p}/index.json`,h),_;try{let e=await r(g,`utf8`),t=B(Oi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${g.href}`),process.exitCode=1;return}_=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${p}\n`),console.error(`Create it first with: prismic page-type create ${p}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let v=Object.keys(_.json),y=n??v[0]??`Main`;_.json[y]||(_.json[y]={});for(let[e,t]of Object.entries(_.json))if(t[m]){console.error(`Field "${m}" already exists in tab "${e}"`),process.exitCode=1;return}let b={type:`Link`,config:{label:i??J(m),...a&&{placeholder:a},...o&&o.length>0&&{variants:o},...c&&{allowText:!0},...l&&{allowTargetBlank:!0},...u&&{repeat:!0}}};_.json[y][m]=b;try{await s(g,q(_))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${m}" (Link) to "${y}" tab in ${p}`),!f)try{await K({output:d}),console.info(`Updated types in ${d??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Ai=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function ji(){let{values:{help:t,tab:n,label:i,placeholder:a,min:o,max:c,step:l,types:u,"no-types":d},positionals:[f,p]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},min:{type:`string`},max:{type:`string`},step:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing page type.
|
|
1033
|
+
`),console.error(`Usage: prismic page-type add-field link <type-id> <field-id>`),process.exitCode=1;return}let h=await W(`package.json`);if(!h){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let g=new URL(`customtypes/${p}/index.json`,h),_;try{let e=await r(g,`utf8`),t=B(Oi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${g.href}`),process.exitCode=1;return}_=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${p}\n`),console.error(`Create it first with: prismic page-type create ${p}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let v=Object.keys(_.json),y=n??v[0]??`Main`;_.json[y]||(_.json[y]={});for(let[e,t]of Object.entries(_.json))if(t[m]){console.error(`Field "${m}" already exists in tab "${e}"`),process.exitCode=1;return}let b={type:`Link`,config:{label:i??J(m),...a&&{placeholder:a},...o&&o.length>0&&{variants:o},...c&&{allowText:!0},...l&&{allowTargetBlank:!0},...u&&{repeat:!0}}};_.json[y][m]=b;try{await s(g,q(_))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${m}" (Link) to "${y}" tab in ${p}`),!f)try{await K({output:d}),console.info(`Updated types in ${d??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Ai=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function ji(){let{values:{help:t,tab:n,label:i,placeholder:a,min:o,max:c,step:l,types:u,"no-types":d},positionals:[f,p]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},min:{type:`string`},max:{type:`string`},step:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing page type.
|
|
1034
1034
|
|
|
1035
1035
|
USAGE
|
|
1036
1036
|
prismic page-type add-field number <type-id> <field-id> [flags]
|
|
@@ -1057,7 +1057,7 @@ EXAMPLES
|
|
|
1057
1057
|
prismic page-type add-field number product quantity --min 0 --max 100
|
|
1058
1058
|
prismic page-type add-field number settings rating --min 1 --max 5 --step 1`);return}if(!f){console.error(`Missing required argument: type-id
|
|
1059
1059
|
`),console.error(`Usage: prismic page-type add-field number <type-id> <field-id>`),process.exitCode=1;return}if(!p){console.error(`Missing required argument: field-id
|
|
1060
|
-
`),console.error(`Usage: prismic page-type add-field number <type-id> <field-id>`),process.exitCode=1;return}let m=o===void 0?void 0:Number(o),h=c===void 0?void 0:Number(c),g=l===void 0?void 0:Number(l);if(o!==void 0&&Number.isNaN(m)){console.error(`Invalid --min value: must be a number`),process.exitCode=1;return}if(c!==void 0&&Number.isNaN(h)){console.error(`Invalid --max value: must be a number`),process.exitCode=1;return}if(l!==void 0&&Number.isNaN(g)){console.error(`Invalid --step value: must be a number`),process.exitCode=1;return}let _=await W(`package.json`);if(!_){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let v=new URL(`customtypes/${f}/index.json`,_),y;try{let e=await r(v,`utf8`),t=B(Ai,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${v.href}`),process.exitCode=1;return}y=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${f}\n`),console.error(`Create it first with: prismic page-type create ${f}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let b=Object.keys(y.json),x=n??b[0]??`Main`;y.json[x]||(y.json[x]={});for(let[e,t]of Object.entries(y.json))if(t[p]){console.error(`Field "${p}" already exists in tab "${e}"`),process.exitCode=1;return}let ee={type:`Number`,config:{label:i??J(p),...a&&{placeholder:a},...m!==void 0&&{min:m},...h!==void 0&&{max:h},...g!==void 0&&{step:g}}};y.json[x][p]=ee;try{await s(v,q(y))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${p}" (Number) to "${x}" tab in ${f}`),!d)try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Mi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ni(){let{values:{help:t,tab:n,label:i,placeholder:a,single:o,multi:c,"allow-target-blank":l,types:u,"no-types":d},positionals:[f,p]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing page type.
|
|
1060
|
+
`),console.error(`Usage: prismic page-type add-field number <type-id> <field-id>`),process.exitCode=1;return}let m=o===void 0?void 0:Number(o),h=c===void 0?void 0:Number(c),g=l===void 0?void 0:Number(l);if(o!==void 0&&Number.isNaN(m)){console.error(`Invalid --min value: must be a number`),process.exitCode=1;return}if(c!==void 0&&Number.isNaN(h)){console.error(`Invalid --max value: must be a number`),process.exitCode=1;return}if(l!==void 0&&Number.isNaN(g)){console.error(`Invalid --step value: must be a number`),process.exitCode=1;return}let _=await W(`package.json`);if(!_){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let v=new URL(`customtypes/${f}/index.json`,_),y;try{let e=await r(v,`utf8`),t=B(Ai,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${v.href}`),process.exitCode=1;return}y=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${f}\n`),console.error(`Create it first with: prismic page-type create ${f}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let b=Object.keys(y.json),x=n??b[0]??`Main`;y.json[x]||(y.json[x]={});for(let[e,t]of Object.entries(y.json))if(t[p]){console.error(`Field "${p}" already exists in tab "${e}"`),process.exitCode=1;return}let ee={type:`Number`,config:{label:i??J(p),...a&&{placeholder:a},...m!==void 0&&{min:m},...h!==void 0&&{max:h},...g!==void 0&&{step:g}}};y.json[x][p]=ee;try{await s(v,q(y))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${p}" (Number) to "${x}" tab in ${f}`),!d)try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Mi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ni(){let{values:{help:t,tab:n,label:i,placeholder:a,single:o,multi:c,"allow-target-blank":l,types:u,"no-types":d},positionals:[f,p]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing page type.
|
|
1061
1061
|
|
|
1062
1062
|
USAGE
|
|
1063
1063
|
prismic page-type add-field rich-text <type-id> <field-id> [flags]
|
|
@@ -1090,7 +1090,7 @@ EXAMPLES
|
|
|
1090
1090
|
prismic page-type add-field rich-text page tagline --single "heading1"
|
|
1091
1091
|
prismic page-type add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!f){console.error(`Missing required argument: type-id
|
|
1092
1092
|
`),console.error(`Usage: prismic page-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}if(!p){console.error(`Missing required argument: field-id
|
|
1093
|
-
`),console.error(`Usage: prismic page-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}let m=await W(`package.json`);if(!m){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let h=new URL(`customtypes/${f}/index.json`,m),g;try{let e=await r(h,`utf8`),t=B(Mi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${h.href}`),process.exitCode=1;return}g=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${f}\n`),console.error(`Create it first with: prismic page-type create ${f}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let _=Object.keys(g.json),v=n??_[0]??`Main`;g.json[v]||(g.json[v]={});for(let[e,t]of Object.entries(g.json))if(t[p]){console.error(`Field "${p}" already exists in tab "${e}"`),process.exitCode=1;return}let y={type:`StructuredText`,config:{label:i??J(p),...a&&{placeholder:a},...o&&{single:o},...c&&{multi:c},...l&&{allowTargetBlank:!0}}};g.json[v][p]=y;try{await s(h,q(g))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${p}" (StructuredText) to "${v}" tab in ${f}`),!d)try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Pi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Fi(){let{values:{help:t,tab:n,label:i,placeholder:a,option:o,default:c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing page type.
|
|
1093
|
+
`),console.error(`Usage: prismic page-type add-field rich-text <type-id> <field-id>`),process.exitCode=1;return}let m=await W(`package.json`);if(!m){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let h=new URL(`customtypes/${f}/index.json`,m),g;try{let e=await r(h,`utf8`),t=B(Mi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${h.href}`),process.exitCode=1;return}g=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${f}\n`),console.error(`Create it first with: prismic page-type create ${f}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let _=Object.keys(g.json),v=n??_[0]??`Main`;g.json[v]||(g.json[v]={});for(let[e,t]of Object.entries(g.json))if(t[p]){console.error(`Field "${p}" already exists in tab "${e}"`),process.exitCode=1;return}let y={type:`StructuredText`,config:{label:i??J(p),...a&&{placeholder:a},...o&&{single:o},...c&&{multi:c},...l&&{allowTargetBlank:!0}}};g.json[v][p]=y;try{await s(h,q(g))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${p}" (StructuredText) to "${v}" tab in ${f}`),!d)try{await K({output:u}),console.info(`Updated types in ${u??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Pi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Fi(){let{values:{help:t,tab:n,label:i,placeholder:a,option:o,default:c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing page type.
|
|
1094
1094
|
|
|
1095
1095
|
USAGE
|
|
1096
1096
|
prismic page-type add-field select <type-id> <field-id> [flags]
|
|
@@ -1116,7 +1116,7 @@ EXAMPLES
|
|
|
1116
1116
|
prismic page-type add-field select product size --option "small" --option "medium" --option "large" --default "medium"
|
|
1117
1117
|
prismic page-type add-field select article status --option "draft" --option "published" --label "Status"`);return}if(!d){console.error(`Missing required argument: type-id
|
|
1118
1118
|
`),console.error(`Usage: prismic page-type add-field select <type-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
|
|
1119
|
-
`),console.error(`Usage: prismic page-type add-field select <type-id> <field-id>`),process.exitCode=1;return}let p=await W(`package.json`);if(!p){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let m=new URL(`customtypes/${d}/index.json`,p),h;try{let e=await r(m,`utf8`),t=B(Pi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${m.href}`),process.exitCode=1;return}h=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${d}\n`),console.error(`Create it first with: prismic page-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let g=Object.keys(h.json),_=n??g[0]??`Main`;h.json[_]||(h.json[_]={});for(let[e,t]of Object.entries(h.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let v={type:`Select`,config:{label:i??J(f),...a&&{placeholder:a},...o&&o.length>0&&{options:o},...c&&{default_value:c}}};h.json[_][f]=v;try{await s(m,q(h))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Select) to "${_}" tab in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Ii=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Li(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a timestamp (date and time) field to an existing page type.
|
|
1119
|
+
`),console.error(`Usage: prismic page-type add-field select <type-id> <field-id>`),process.exitCode=1;return}let p=await W(`package.json`);if(!p){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let m=new URL(`customtypes/${d}/index.json`,p),h;try{let e=await r(m,`utf8`),t=B(Pi,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${m.href}`),process.exitCode=1;return}h=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${d}\n`),console.error(`Create it first with: prismic page-type create ${d}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let g=Object.keys(h.json),_=n??g[0]??`Main`;h.json[_]||(h.json[_]={});for(let[e,t]of Object.entries(h.json))if(t[f]){console.error(`Field "${f}" already exists in tab "${e}"`),process.exitCode=1;return}let v={type:`Select`,config:{label:i??J(f),...a&&{placeholder:a},...o&&o.length>0&&{options:o},...c&&{default_value:c}}};h.json[_][f]=v;try{await s(m,q(h))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Select) to "${_}" tab in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Ii=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Li(){let{values:{help:t,tab:n,label:i,placeholder:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a timestamp (date and time) field to an existing page type.
|
|
1120
1120
|
|
|
1121
1121
|
USAGE
|
|
1122
1122
|
prismic page-type add-field timestamp <type-id> <field-id> [flags]
|
|
@@ -1141,7 +1141,7 @@ EXAMPLES
|
|
|
1141
1141
|
prismic page-type add-field timestamp event start --tab "Schedule"
|
|
1142
1142
|
prismic page-type add-field timestamp article published_at --label "Published At"`);return}if(!u){console.error(`Missing required argument: type-id
|
|
1143
1143
|
`),console.error(`Usage: prismic page-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
|
|
1144
|
-
`),console.error(`Usage: prismic page-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(Ii,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${u}\n`),console.error(`Create it first with: prismic page-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Timestamp`,config:{label:i??J(d),...a&&{placeholder:a},...o&&{default:o}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Timestamp) to "${g}" tab in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}const Ri=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function zi(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a UID (unique identifier) field to an existing page type.
|
|
1144
|
+
`),console.error(`Usage: prismic page-type add-field timestamp <type-id> <field-id>`),process.exitCode=1;return}let f=await W(`package.json`);if(!f){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let p=new URL(`customtypes/${u}/index.json`,f),m;try{let e=await r(p,`utf8`),t=B(Ii,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${p.href}`),process.exitCode=1;return}m=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${u}\n`),console.error(`Create it first with: prismic page-type create ${u}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let h=Object.keys(m.json),g=n??h[0]??`Main`;m.json[g]||(m.json[g]={});for(let[e,t]of Object.entries(m.json))if(t[d]){console.error(`Field "${d}" already exists in tab "${e}"`),process.exitCode=1;return}let _={type:`Timestamp`,config:{label:i??J(d),...a&&{placeholder:a},...o&&{default:o}}};m.json[g][d]=_;try{await s(p,q(m))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Timestamp) to "${g}" tab in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}const Ri=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function zi(){let{values:{help:t,tab:n,label:i,placeholder:a,types:o,"no-types":c},positionals:[l,u]}=e({args:process.argv.slice(5),options:{tab:{type:`string`,short:`t`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a UID (unique identifier) field to an existing page type.
|
|
1145
1145
|
|
|
1146
1146
|
USAGE
|
|
1147
1147
|
prismic page-type add-field uid <type-id> <field-id> [flags]
|
|
@@ -1165,7 +1165,7 @@ EXAMPLES
|
|
|
1165
1165
|
prismic page-type add-field uid article slug --label "URL Slug"
|
|
1166
1166
|
prismic page-type add-field uid product sku --placeholder "Enter unique SKU"`);return}if(!l){console.error(`Missing required argument: type-id
|
|
1167
1167
|
`),console.error(`Usage: prismic page-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}if(!u){console.error(`Missing required argument: field-id
|
|
1168
|
-
`),console.error(`Usage: prismic page-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Ri,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`UID`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (UID) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Bi(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await hi();break;case`color`:await _i();break;case`date`:await yi();break;case`embed`:await xi();break;case`geo-point`:await Ci();break;case`image`:await Ti();break;case`key-text`:await Di();break;case`link`:await ki();break;case`number`:await ji();break;case`rich-text`:await Ni();break;case`select`:await Fi();break;case`timestamp`:await Li();break;case`uid`:await zi();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing page type.
|
|
1168
|
+
`),console.error(`Usage: prismic page-type add-field uid <type-id> <field-id>`),process.exitCode=1;return}let d=await W(`package.json`);if(!d){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let f=new URL(`customtypes/${l}/index.json`,d),p;try{let e=await r(f,`utf8`),t=B(Ri,JSON.parse(e));if(!t.success){console.error(`Invalid page type model: ${f.href}`),process.exitCode=1;return}p=t.output}catch(e){if(e instanceof Error&&`code`in e&&e.code===`ENOENT`){console.error(`Page type not found: ${l}\n`),console.error(`Create it first with: prismic page-type create ${l}`),process.exitCode=1;return}e instanceof Error?console.error(`Failed to read page type: ${e.message}`):console.error(`Failed to read page type`),process.exitCode=1;return}let m=Object.keys(p.json),h=n??m[0]??`Main`;p.json[h]||(p.json[h]={});for(let[e,t]of Object.entries(p.json))if(t[u]){console.error(`Field "${u}" already exists in tab "${e}"`),process.exitCode=1;return}let g={type:`UID`,config:{label:i??J(u),...a&&{placeholder:a}}};p.json[h][u]=g;try{await s(f,q(p))}catch(e){e instanceof Error?console.error(`Failed to update page type: ${e.message}`):console.error(`Failed to update page type`),process.exitCode=1;return}if(console.info(`Added field "${u}" (UID) to "${h}" tab in ${l}`),!c)try{await K({output:o}),console.info(`Updated types in ${o??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic page-type add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function Bi(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await hi();break;case`color`:await _i();break;case`date`:await yi();break;case`embed`:await xi();break;case`geo-point`:await Ci();break;case`image`:await Ti();break;case`key-text`:await Di();break;case`link`:await ki();break;case`number`:await ji();break;case`rich-text`:await Ni();break;case`select`:await Fi();break;case`timestamp`:await Li();break;case`uid`:await zi();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing page type.
|
|
1169
1169
|
|
|
1170
1170
|
USAGE
|
|
1171
1171
|
prismic page-type add-field <field-type> <type-id> <field-id> [flags]
|
|
@@ -1235,7 +1235,7 @@ FLAGS
|
|
|
1235
1235
|
-h, --help Show help for command
|
|
1236
1236
|
|
|
1237
1237
|
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??Wi(c),repeatable:!i,status:!0,format:`page`,json:{Main:{},"SEO & Metadata":{}}},u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/`,u),f=new URL(c+`/`,d),p=new URL(`index.json`,f);try{await n(new URL(`.`,p),{recursive:!0}),await s(p,q(l))}catch(e){e instanceof Error?console.error(`Failed to create page type: ${e.message}`):console.error(`Failed to create page type`),process.exitCode=1;return}if(console.info(`Created page type at ${p.href}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}function Wi(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}const Gi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ki(){let{values:{help:t,"slice-zone":n,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Disconnect a shared slice from a page type's slice zone.
|
|
1238
|
+
Use \`prismic page-type <command> --help\` for more information about a command.`);return}if(!c){console.error(`Missing required argument: id`),process.exitCode=1;return}let l={id:c,label:r??Wi(c),repeatable:!i,status:!0,format:`page`,json:{Main:{},"SEO & Metadata":{}}},u=await W(`package.json`);if(!u){console.error(`Could not find project root (no package.json found)`),process.exitCode=1;return}let d=new URL(`customtypes/`,u),f=new URL(c+`/`,d),p=new URL(`index.json`,f);try{await n(new URL(`.`,p),{recursive:!0}),await s(p,q(l))}catch(e){e instanceof Error?console.error(`Failed to create page type: ${e.message}`):console.error(`Failed to create page type`),process.exitCode=1;return}if(console.info(`Created page type at ${p.href}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add fields with `prismic page-type add-field`")}function Wi(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}const Gi=F({id:R(),label:R(),repeatable:P(),status:P(),format:R(),json:L(R(),L(R(),z()))});async function Ki(){let{values:{help:t,"slice-zone":n,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(4),options:{"slice-zone":{type:`string`,short:`z`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Disconnect a shared slice from a page type's slice zone.
|
|
1239
1239
|
|
|
1240
1240
|
USAGE
|
|
1241
1241
|
prismic page-type disconnect-slice <type-id> <slice-id> [flags]
|
|
@@ -1698,7 +1698,7 @@ EXAMPLES
|
|
|
1698
1698
|
prismic slice add-field boolean hero show_overlay --default
|
|
1699
1699
|
prismic slice add-field boolean product available --true-label "In Stock" --false-label "Out of Stock"`);return}if(!u){console.error(`Missing required argument: slice-id
|
|
1700
1700
|
`),console.error(`Usage: prismic slice add-field boolean <slice-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
|
|
1701
|
-
`),console.error(`Usage: prismic slice add-field boolean <slice-id> <field-id>`),process.exitCode=1;return}let f=await G(u);if(!f.ok){console.error(f.error),process.exitCode=1;return}let{model:p,modelPath:m}=f;if(p.variations.length===0){console.error(`Slice "${u}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let h=n?p.variations.find(e=>e.id===n):p.variations[0];if(!h){console.error(`Variation "${n}" not found in slice "${u}"\n`),console.error(`Available variations: ${p.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}h.primary||={};for(let e of p.variations)if(e.primary?.[d]){console.error(`Field "${d}" already exists in variation "${e.id}"`),process.exitCode=1;return}let g={type:`Boolean`,config:{label:r??J(d),...i&&{default_value:!0},...a&&{placeholder_true:a},...o&&{placeholder_false:o}}};h.primary[d]=g;try{await s(m,q(p))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Boolean) to "${h.id}" variation in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function co(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing slice.
|
|
1701
|
+
`),console.error(`Usage: prismic slice add-field boolean <slice-id> <field-id>`),process.exitCode=1;return}let f=await G(u);if(!f.ok){console.error(f.error),process.exitCode=1;return}let{model:p,modelPath:m}=f;if(p.variations.length===0){console.error(`Slice "${u}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let h=n?p.variations.find(e=>e.id===n):p.variations[0];if(!h){console.error(`Variation "${n}" not found in slice "${u}"\n`),console.error(`Available variations: ${p.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}h.primary||={};for(let e of p.variations)if(e.primary?.[d]){console.error(`Field "${d}" already exists in variation "${e.id}"`),process.exitCode=1;return}let g={type:`Boolean`,config:{label:r??J(d),...i&&{default_value:!0},...a&&{placeholder_true:a},...o&&{placeholder_false:o}}};h.primary[d]=g;try{await s(m,q(p))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Boolean) to "${h.id}" variation in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function co(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a color picker field to an existing slice.
|
|
1702
1702
|
|
|
1703
1703
|
USAGE
|
|
1704
1704
|
prismic slice add-field color <slice-id> <field-id> [flags]
|
|
@@ -1722,7 +1722,7 @@ EXAMPLES
|
|
|
1722
1722
|
prismic slice add-field color hero accent --label "Accent Color"
|
|
1723
1723
|
prismic slice add-field color banner theme_color --variation "dark"`);return}if(!c){console.error(`Missing required argument: slice-id
|
|
1724
1724
|
`),console.error(`Usage: prismic slice add-field color <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
|
|
1725
|
-
`),console.error(`Usage: prismic slice add-field color <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Color`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Color) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function lo(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date picker field to an existing slice.
|
|
1725
|
+
`),console.error(`Usage: prismic slice add-field color <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Color`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Color) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function lo(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a date picker field to an existing slice.
|
|
1726
1726
|
|
|
1727
1727
|
USAGE
|
|
1728
1728
|
prismic slice add-field date <slice-id> <field-id> [flags]
|
|
@@ -1746,7 +1746,7 @@ EXAMPLES
|
|
|
1746
1746
|
prismic slice add-field date event start_date --label "Start Date"
|
|
1747
1747
|
prismic slice add-field date promo end_date --variation "countdown"`);return}if(!c){console.error(`Missing required argument: slice-id
|
|
1748
1748
|
`),console.error(`Usage: prismic slice add-field date <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
|
|
1749
|
-
`),console.error(`Usage: prismic slice add-field date <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Date`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Date) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function uo(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed (oEmbed) field to an existing slice.
|
|
1749
|
+
`),console.error(`Usage: prismic slice add-field date <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Date`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Date) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function uo(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an embed (oEmbed) field to an existing slice.
|
|
1750
1750
|
|
|
1751
1751
|
USAGE
|
|
1752
1752
|
prismic slice add-field embed <slice-id> <field-id> [flags]
|
|
@@ -1770,7 +1770,7 @@ EXAMPLES
|
|
|
1770
1770
|
prismic slice add-field embed gallery media --label "Media Embed"
|
|
1771
1771
|
prismic slice add-field embed social tweet --variation "twitter"`);return}if(!c){console.error(`Missing required argument: slice-id
|
|
1772
1772
|
`),console.error(`Usage: prismic slice add-field embed <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
|
|
1773
|
-
`),console.error(`Usage: prismic slice add-field embed <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Embed`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Embed) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function fo(){let{values:{help:t,variation:n,label:r,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geographic coordinates field to an existing slice.
|
|
1773
|
+
`),console.error(`Usage: prismic slice add-field embed <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Embed`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Embed) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function fo(){let{values:{help:t,variation:n,label:r,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a geographic coordinates field to an existing slice.
|
|
1774
1774
|
|
|
1775
1775
|
USAGE
|
|
1776
1776
|
prismic slice add-field geo-point <slice-id> <field-id> [flags]
|
|
@@ -1793,7 +1793,7 @@ EXAMPLES
|
|
|
1793
1793
|
prismic slice add-field geo-point store coordinates --label "Store Location"
|
|
1794
1794
|
prismic slice add-field geo-point map marker --variation "interactive"`);return}if(!o){console.error(`Missing required argument: slice-id
|
|
1795
1795
|
`),console.error(`Usage: prismic slice add-field geo-point <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
|
|
1796
|
-
`),console.error(`Usage: prismic slice add-field geo-point <slice-id> <field-id>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;if(u.variations.length===0){console.error(`Slice "${o}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let f=n?u.variations.find(e=>e.id===n):u.variations[0];if(!f){console.error(`Variation "${n}" not found in slice "${o}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}f.primary||={};for(let e of u.variations)if(e.primary?.[c]){console.error(`Field "${c}" already exists in variation "${e.id}"`),process.exitCode=1;return}let p={type:`GeoPoint`,config:{label:r??J(c)}};f.primary[c]=p;try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${c}" (GeoPoint) to "${f.id}" variation in ${o}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function po(){let{values:{help:t,variation:n,label:r,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing slice.
|
|
1796
|
+
`),console.error(`Usage: prismic slice add-field geo-point <slice-id> <field-id>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;if(u.variations.length===0){console.error(`Slice "${o}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let f=n?u.variations.find(e=>e.id===n):u.variations[0];if(!f){console.error(`Variation "${n}" not found in slice "${o}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}f.primary||={};for(let e of u.variations)if(e.primary?.[c]){console.error(`Field "${c}" already exists in variation "${e.id}"`),process.exitCode=1;return}let p={type:`GeoPoint`,config:{label:r??J(c)}};f.primary[c]=p;try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${c}" (GeoPoint) to "${f.id}" variation in ${o}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function po(){let{values:{help:t,variation:n,label:r,types:i,"no-types":a},positionals:[o,c]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add an image field to an existing slice.
|
|
1797
1797
|
|
|
1798
1798
|
USAGE
|
|
1799
1799
|
prismic slice add-field image <slice-id> <field-id> [flags]
|
|
@@ -1816,7 +1816,7 @@ EXAMPLES
|
|
|
1816
1816
|
prismic slice add-field image hero banner --label "Hero Banner"
|
|
1817
1817
|
prismic slice add-field image gallery thumbnail --variation "grid"`);return}if(!o){console.error(`Missing required argument: slice-id
|
|
1818
1818
|
`),console.error(`Usage: prismic slice add-field image <slice-id> <field-id>`),process.exitCode=1;return}if(!c){console.error(`Missing required argument: field-id
|
|
1819
|
-
`),console.error(`Usage: prismic slice add-field image <slice-id> <field-id>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;if(u.variations.length===0){console.error(`Slice "${o}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let f=n?u.variations.find(e=>e.id===n):u.variations[0];if(!f){console.error(`Variation "${n}" not found in slice "${o}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}f.primary||={};for(let e of u.variations)if(e.primary?.[c]){console.error(`Field "${c}" already exists in variation "${e.id}"`),process.exitCode=1;return}let p={type:`Image`,config:{label:r??J(c)}};f.primary[c]=p;try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${c}" (Image) to "${f.id}" variation in ${o}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function mo(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing slice.
|
|
1819
|
+
`),console.error(`Usage: prismic slice add-field image <slice-id> <field-id>`),process.exitCode=1;return}let l=await G(o);if(!l.ok){console.error(l.error),process.exitCode=1;return}let{model:u,modelPath:d}=l;if(u.variations.length===0){console.error(`Slice "${o}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let f=n?u.variations.find(e=>e.id===n):u.variations[0];if(!f){console.error(`Variation "${n}" not found in slice "${o}"\n`),console.error(`Available variations: ${u.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}f.primary||={};for(let e of u.variations)if(e.primary?.[c]){console.error(`Field "${c}" already exists in variation "${e.id}"`),process.exitCode=1;return}let p={type:`Image`,config:{label:r??J(c)}};f.primary[c]=p;try{await s(d,q(u))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${c}" (Image) to "${f.id}" variation in ${o}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function mo(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a key-text (single-line text) field to an existing slice.
|
|
1820
1820
|
|
|
1821
1821
|
USAGE
|
|
1822
1822
|
prismic slice add-field key-text <slice-id> <field-id> [flags]
|
|
@@ -1840,7 +1840,7 @@ EXAMPLES
|
|
|
1840
1840
|
prismic slice add-field key-text hero heading --label "Heading"
|
|
1841
1841
|
prismic slice add-field key-text cta button_text --placeholder "Enter button text"`);return}if(!c){console.error(`Missing required argument: slice-id
|
|
1842
1842
|
`),console.error(`Usage: prismic slice add-field key-text <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
|
|
1843
|
-
`),console.error(`Usage: prismic slice add-field key-text <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Text`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Text) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function ho(){let{values:{help:t,variation:n,label:r,placeholder:i,"allow-text":a,"allow-target-blank":o,repeatable:c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing slice.
|
|
1843
|
+
`),console.error(`Usage: prismic slice add-field key-text <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Text`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Text) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function ho(){let{values:{help:t,variation:n,label:r,placeholder:i,"allow-text":a,"allow-target-blank":o,repeatable:c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},"allow-text":{type:`boolean`},"allow-target-blank":{type:`boolean`},repeatable:{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a link field to an existing slice.
|
|
1844
1844
|
|
|
1845
1845
|
USAGE
|
|
1846
1846
|
prismic slice add-field link <slice-id> <field-id> [flags]
|
|
@@ -1868,7 +1868,7 @@ EXAMPLES
|
|
|
1868
1868
|
prismic slice add-field link navigation links --repeatable
|
|
1869
1869
|
prismic slice add-field link hero cta --allow-text --allow-target-blank`);return}if(!d){console.error(`Missing required argument: slice-id
|
|
1870
1870
|
`),console.error(`Usage: prismic slice add-field link <slice-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
|
|
1871
|
-
`),console.error(`Usage: prismic slice add-field link <slice-id> <field-id>`),process.exitCode=1;return}let p=await G(d);if(!p.ok){console.error(p.error),process.exitCode=1;return}let{model:m,modelPath:h}=p;if(m.variations.length===0){console.error(`Slice "${d}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let g=n?m.variations.find(e=>e.id===n):m.variations[0];if(!g){console.error(`Variation "${n}" not found in slice "${d}"\n`),console.error(`Available variations: ${m.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}g.primary||={};for(let e of m.variations)if(e.primary?.[f]){console.error(`Field "${f}" already exists in variation "${e.id}"`),process.exitCode=1;return}let _={type:`Link`,config:{label:r??J(f),...i&&{placeholder:i},...a&&{allowText:!0},...o&&{allowTargetBlank:!0},...c&&{repeat:!0}}};g.primary[f]=_;try{await s(h,q(m))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Link) to "${g.id}" variation in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function go(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing slice.
|
|
1871
|
+
`),console.error(`Usage: prismic slice add-field link <slice-id> <field-id>`),process.exitCode=1;return}let p=await G(d);if(!p.ok){console.error(p.error),process.exitCode=1;return}let{model:m,modelPath:h}=p;if(m.variations.length===0){console.error(`Slice "${d}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let g=n?m.variations.find(e=>e.id===n):m.variations[0];if(!g){console.error(`Variation "${n}" not found in slice "${d}"\n`),console.error(`Available variations: ${m.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}g.primary||={};for(let e of m.variations)if(e.primary?.[f]){console.error(`Field "${f}" already exists in variation "${e.id}"`),process.exitCode=1;return}let _={type:`Link`,config:{label:r??J(f),...i&&{placeholder:i},...a&&{allowText:!0},...o&&{allowTargetBlank:!0},...c&&{repeat:!0}}};g.primary[f]=_;try{await s(h,q(m))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${f}" (Link) to "${g.id}" variation in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function go(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a number field to an existing slice.
|
|
1872
1872
|
|
|
1873
1873
|
USAGE
|
|
1874
1874
|
prismic slice add-field number <slice-id> <field-id> [flags]
|
|
@@ -1892,7 +1892,7 @@ EXAMPLES
|
|
|
1892
1892
|
prismic slice add-field number product quantity --label "Quantity"
|
|
1893
1893
|
prismic slice add-field number stats count --variation "detailed"`);return}if(!c){console.error(`Missing required argument: slice-id
|
|
1894
1894
|
`),console.error(`Usage: prismic slice add-field number <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
|
|
1895
|
-
`),console.error(`Usage: prismic slice add-field number <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Number`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Number) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function _o(){let{values:{help:t,variation:n,label:r,placeholder:i,single:a,multi:o,"allow-target-blank":c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing slice.
|
|
1895
|
+
`),console.error(`Usage: prismic slice add-field number <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Number`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Number) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function _o(){let{values:{help:t,variation:n,label:r,placeholder:i,single:a,multi:o,"allow-target-blank":c,types:l,"no-types":u},positionals:[d,f]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},single:{type:`string`},multi:{type:`string`},"allow-target-blank":{type:`boolean`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a rich text field to an existing slice.
|
|
1896
1896
|
|
|
1897
1897
|
USAGE
|
|
1898
1898
|
prismic slice add-field rich-text <slice-id> <field-id> [flags]
|
|
@@ -1925,7 +1925,7 @@ EXAMPLES
|
|
|
1925
1925
|
prismic slice add-field rich-text hero tagline --single "heading1"
|
|
1926
1926
|
prismic slice add-field rich-text blog post --multi "paragraph,strong,em,hyperlink" --allow-target-blank`);return}if(!d){console.error(`Missing required argument: slice-id
|
|
1927
1927
|
`),console.error(`Usage: prismic slice add-field rich-text <slice-id> <field-id>`),process.exitCode=1;return}if(!f){console.error(`Missing required argument: field-id
|
|
1928
|
-
`),console.error(`Usage: prismic slice add-field rich-text <slice-id> <field-id>`),process.exitCode=1;return}let p=await G(d);if(!p.ok){console.error(p.error),process.exitCode=1;return}let{model:m,modelPath:h}=p;if(m.variations.length===0){console.error(`Slice "${d}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let g=n?m.variations.find(e=>e.id===n):m.variations[0];if(!g){console.error(`Variation "${n}" not found in slice "${d}"\n`),console.error(`Available variations: ${m.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}g.primary||={};for(let e of m.variations)if(e.primary?.[f]){console.error(`Field "${f}" already exists in variation "${e.id}"`),process.exitCode=1;return}let _={type:`StructuredText`,config:{label:r??J(f),...i&&{placeholder:i},...a&&{single:a},...o&&{multi:o},...c&&{allowTargetBlank:!0}}};g.primary[f]=_;try{await s(h,q(m))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${f}" (StructuredText) to "${g.id}" variation in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function vo(){let{values:{help:t,variation:n,label:r,placeholder:i,option:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing slice.
|
|
1928
|
+
`),console.error(`Usage: prismic slice add-field rich-text <slice-id> <field-id>`),process.exitCode=1;return}let p=await G(d);if(!p.ok){console.error(p.error),process.exitCode=1;return}let{model:m,modelPath:h}=p;if(m.variations.length===0){console.error(`Slice "${d}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let g=n?m.variations.find(e=>e.id===n):m.variations[0];if(!g){console.error(`Variation "${n}" not found in slice "${d}"\n`),console.error(`Available variations: ${m.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}g.primary||={};for(let e of m.variations)if(e.primary?.[f]){console.error(`Field "${f}" already exists in variation "${e.id}"`),process.exitCode=1;return}let _={type:`StructuredText`,config:{label:r??J(f),...i&&{placeholder:i},...a&&{single:a},...o&&{multi:o},...c&&{allowTargetBlank:!0}}};g.primary[f]=_;try{await s(h,q(m))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${f}" (StructuredText) to "${g.id}" variation in ${d}`),!u)try{await K({output:l}),console.info(`Updated types in ${l??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function vo(){let{values:{help:t,variation:n,label:r,placeholder:i,option:a,default:o,types:c,"no-types":l},positionals:[u,d]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},option:{type:`string`,multiple:!0},default:{type:`string`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a select (dropdown) field to an existing slice.
|
|
1929
1929
|
|
|
1930
1930
|
USAGE
|
|
1931
1931
|
prismic slice add-field select <slice-id> <field-id> [flags]
|
|
@@ -1951,7 +1951,7 @@ EXAMPLES
|
|
|
1951
1951
|
prismic slice add-field select hero style --option "light" --option "dark" --default "light"
|
|
1952
1952
|
prismic slice add-field select product size --option "small" --option "medium" --option "large" --label "Size"`);return}if(!u){console.error(`Missing required argument: slice-id
|
|
1953
1953
|
`),console.error(`Usage: prismic slice add-field select <slice-id> <field-id>`),process.exitCode=1;return}if(!d){console.error(`Missing required argument: field-id
|
|
1954
|
-
`),console.error(`Usage: prismic slice add-field select <slice-id> <field-id>`),process.exitCode=1;return}let f=await G(u);if(!f.ok){console.error(f.error),process.exitCode=1;return}let{model:p,modelPath:m}=f;if(p.variations.length===0){console.error(`Slice "${u}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let h=n?p.variations.find(e=>e.id===n):p.variations[0];if(!h){console.error(`Variation "${n}" not found in slice "${u}"\n`),console.error(`Available variations: ${p.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}h.primary||={};for(let e of p.variations)if(e.primary?.[d]){console.error(`Field "${d}" already exists in variation "${e.id}"`),process.exitCode=1;return}let g={type:`Select`,config:{label:r??J(d),...i&&{placeholder:i},...a&&a.length>0&&{options:a},...o&&{default_value:o}}};h.primary[d]=g;try{await s(m,q(p))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Select) to "${h.id}" variation in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function yo(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a timestamp (date and time) field to an existing slice.
|
|
1954
|
+
`),console.error(`Usage: prismic slice add-field select <slice-id> <field-id>`),process.exitCode=1;return}let f=await G(u);if(!f.ok){console.error(f.error),process.exitCode=1;return}let{model:p,modelPath:m}=f;if(p.variations.length===0){console.error(`Slice "${u}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let h=n?p.variations.find(e=>e.id===n):p.variations[0];if(!h){console.error(`Variation "${n}" not found in slice "${u}"\n`),console.error(`Available variations: ${p.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}h.primary||={};for(let e of p.variations)if(e.primary?.[d]){console.error(`Field "${d}" already exists in variation "${e.id}"`),process.exitCode=1;return}let g={type:`Select`,config:{label:r??J(d),...i&&{placeholder:i},...a&&a.length>0&&{options:a},...o&&{default_value:o}}};h.primary[d]=g;try{await s(m,q(p))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${d}" (Select) to "${h.id}" variation in ${u}`),!l)try{await K({output:c}),console.info(`Updated types in ${c??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function yo(){let{values:{help:t,variation:n,label:r,placeholder:i,types:a,"no-types":o},positionals:[c,l]}=e({args:process.argv.slice(5),options:{variation:{type:`string`,short:`v`},label:{type:`string`,short:`l`},placeholder:{type:`string`,short:`p`},types:{type:`string`},"no-types":{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`Add a timestamp (date and time) field to an existing slice.
|
|
1955
1955
|
|
|
1956
1956
|
USAGE
|
|
1957
1957
|
prismic slice add-field timestamp <slice-id> <field-id> [flags]
|
|
@@ -1975,7 +1975,7 @@ EXAMPLES
|
|
|
1975
1975
|
prismic slice add-field timestamp event start_time --label "Event Start"
|
|
1976
1976
|
prismic slice add-field timestamp schedule meeting_time --variation "detailed"`);return}if(!c){console.error(`Missing required argument: slice-id
|
|
1977
1977
|
`),console.error(`Usage: prismic slice add-field timestamp <slice-id> <field-id>`),process.exitCode=1;return}if(!l){console.error(`Missing required argument: field-id
|
|
1978
|
-
`),console.error(`Usage: prismic slice add-field timestamp <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Timestamp`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Timestamp) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function bo(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await so();break;case`color`:await co();break;case`date`:await lo();break;case`embed`:await uo();break;case`geo-point`:await fo();break;case`image`:await po();break;case`key-text`:await mo();break;case`link`:await ho();break;case`number`:await go();break;case`rich-text`:await _o();break;case`select`:await vo();break;case`timestamp`:await yo();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing slice.
|
|
1978
|
+
`),console.error(`Usage: prismic slice add-field timestamp <slice-id> <field-id>`),process.exitCode=1;return}let u=await G(c);if(!u.ok){console.error(u.error),process.exitCode=1;return}let{model:d,modelPath:f}=u;if(d.variations.length===0){console.error(`Slice "${c}" has no variations.\n`),console.error(`Add a variation first before adding fields.`),process.exitCode=1;return}let p=n?d.variations.find(e=>e.id===n):d.variations[0];if(!p){console.error(`Variation "${n}" not found in slice "${c}"\n`),console.error(`Available variations: ${d.variations.map(e=>e.id).join(`, `)}`),process.exitCode=1;return}p.primary||={};for(let e of d.variations)if(e.primary?.[l]){console.error(`Field "${l}" already exists in variation "${e.id}"`),process.exitCode=1;return}let m={type:`Timestamp`,config:{label:r??J(l),...i&&{placeholder:i}}};p.primary[l]=m;try{await s(f,q(d))}catch(e){e instanceof Error?console.error(`Failed to update slice: ${e.message}`):console.error(`Failed to update slice`),process.exitCode=1;return}if(console.info(`Added field "${l}" (Timestamp) to "${p.id}" variation in ${c}`),!o)try{await K({output:a}),console.info(`Updated types in ${a??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add more fields with `prismic slice add-field`"),console.info(" Run `prismic status` when done to find next steps")}async function bo(){let{positionals:[t]}=e({args:process.argv.slice(4),options:{help:{type:`boolean`,short:`h`}},allowPositionals:!0,strict:!1});switch(t){case`boolean`:await so();break;case`color`:await co();break;case`date`:await lo();break;case`embed`:await uo();break;case`geo-point`:await fo();break;case`image`:await po();break;case`key-text`:await mo();break;case`link`:await ho();break;case`number`:await go();break;case`rich-text`:await _o();break;case`select`:await vo();break;case`timestamp`:await yo();break;default:t&&(console.error(`Unknown field type: ${t}\n`),process.exitCode=1),console.info(`Add a field to an existing slice.
|
|
1979
1979
|
|
|
1980
1980
|
USAGE
|
|
1981
1981
|
prismic slice add-field <field-type> <slice-id> <field-id> [flags]
|
|
@@ -2044,7 +2044,7 @@ FLAGS
|
|
|
2044
2044
|
-h, --help Show help for command
|
|
2045
2045
|
|
|
2046
2046
|
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??Eo(o),description:``,variations:[{id:`default`,name:`Default`,description:`Default`,imageUrl:``,docURL:``,version:`initial`,primary:{},items:{}}]},l=await Co(),u=new URL(Eo(c.name)+`/`,l),d=new URL(`model.json`,u);try{await n(new URL(`.`,d),{recursive:!0}),await s(d,q(c))}catch(e){e instanceof Error?console.error(`Failed to create slice: ${e.message}`):console.error(`Failed to create slice`),process.exitCode=1;return}if(console.info(`Created slice at ${d.href}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}}async function Co(){let e=await To(),t=await W(`package.json`);switch(e){case`next`:if(await En(new URL(`src`,t)))return new URL(`src/slices/`,t);case`nuxt`:if(await En(new URL(`app`,t)))return new URL(`app/slices/`,t);case`sveltekit`:return new URL(`src/slices/`,t)}return new URL(`slices/`,t)}const wo=F({dependencies:I(L(R(),R()))});async function To(){let e=await W(`package.json`);if(e)try{let t=await r(e,`utf8`),{dependencies:n={}}=hn(wo,JSON.parse(t));if(`next`in n)return`next`;if(`nuxt`in n)return`nuxt`;if(`@sveltejs/kit`in n)return`sveltekit`}catch{}}function Eo(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}async function Do(){let{values:{help:t,json:n}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`List all slices in a Prismic project.
|
|
2047
|
+
Use \`prismic slice <command> --help\` for more information about a command.`);return}if(!o){console.error(`Missing required argument: id`),process.exitCode=1;return}let c={id:o,type:`SharedSlice`,name:r??Eo(o),description:``,variations:[{id:`default`,name:`Default`,description:`Default`,imageUrl:``,docURL:``,version:`initial`,primary:{},items:{}}]},l=await Co(),u=new URL(Eo(c.name)+`/`,l),d=new URL(`model.json`,u);try{await n(new URL(`.`,d),{recursive:!0}),await s(d,q(c))}catch(e){e instanceof Error?console.error(`Failed to create slice: ${e.message}`):console.error(`Failed to create slice`),process.exitCode=1;return}if(console.info(`Created slice at ${d.href}`),!a)try{await K({output:i}),console.info(`Updated types in ${i??`prismicio-types.d.ts`}`)}catch(e){console.warn(`Could not generate types: ${e instanceof Error?e.message:e}`)}console.info(),console.info("Next: Add fields with `prismic slice add-field`")}async function Co(){let e=await To(),t=await W(`package.json`);switch(e){case`next`:if(await En(new URL(`src`,t)))return new URL(`src/slices/`,t);case`nuxt`:if(await En(new URL(`app`,t)))return new URL(`app/slices/`,t);case`sveltekit`:return new URL(`src/slices/`,t)}return new URL(`slices/`,t)}const wo=F({dependencies:I(L(R(),R()))});async function To(){let e=await W(`package.json`);if(e)try{let t=await r(e,`utf8`),{dependencies:n={}}=hn(wo,JSON.parse(t));if(`next`in n)return`next`;if(`nuxt`in n)return`nuxt`;if(`@sveltejs/kit`in n)return`sveltekit`}catch{}}function Eo(e){return e.toLowerCase().replace(/(^|[-_\s]+)(.)?/g,(e,t,n)=>n?.toUpperCase()??``)}async function Do(){let{values:{help:t,json:n}}=e({args:process.argv.slice(4),options:{json:{type:`boolean`},help:{type:`boolean`,short:`h`}},allowPositionals:!0});if(t){console.info(`List all slices in a Prismic project.
|
|
2048
2048
|
|
|
2049
2049
|
USAGE
|
|
2050
2050
|
prismic slice list [flags]
|