@flyo/nitro-astro 2.1.0 → 2.1.2
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/README.md +2 -2
- package/dist/nitro-astro.js +3 -3
- package/dist/nitro-astro.mjs +21 -20
- package/dist/types/index.d.ts +2 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -126,13 +126,13 @@ Block Component Example (which are mostly located in `src/components/flyo`):
|
|
|
126
126
|
```astro
|
|
127
127
|
---
|
|
128
128
|
import { Image } from "astro:assets";
|
|
129
|
-
import {
|
|
129
|
+
import { editable } from "@flyo/nitro-astro";
|
|
130
130
|
import BlockSlot from "@flyo/nitro-astro/BlockSlot.astro";
|
|
131
131
|
const { block } = Astro.props;
|
|
132
132
|
---
|
|
133
133
|
|
|
134
134
|
<!-- Make the block editable if necessary -->
|
|
135
|
-
<div {...
|
|
135
|
+
<div {...editable(block)}>
|
|
136
136
|
<!-- Content variable -->
|
|
137
137
|
<div set:html={block.content.content.html} />
|
|
138
138
|
|
package/dist/nitro-astro.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(u,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(u=typeof globalThis<"u"?globalThis:u||self,h(u.flyoNitroIntegration={}))})(this,function(u){"use strict";const h="https://api.flyo.cloud/nitro/v1".replace(/\/+$/,"");class F{constructor(n={}){this.configuration=n}set config(n){this.configuration=n}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:h}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||_}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const n=this.configuration.apiKey;if(n)return typeof n=="function"?n:()=>n}get accessToken(){const n=this.configuration.accessToken;if(n)return typeof n=="function"?n:async()=>n}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const x=new F,w=class P{constructor(n=x){this.configuration=n,this.fetchApi=async(t,i)=>{let r={url:t,init:i};for(const a of this.middleware)a.pre&&(r=await a.pre({fetch:this.fetchApi,...r})||r);let o;try{o=await(this.configuration.fetchApi||fetch)(r.url,r.init)}catch(a){for(const l of this.middleware)l.onError&&(o=await l.onError({fetch:this.fetchApi,url:r.url,init:r.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new N(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:r.url,init:r.init,response:o.clone()})||o);return o},this.middleware=n.middleware}withMiddleware(...n){const t=this.clone();return t.middleware=t.middleware.concat(...n),t}withPreMiddleware(...n){const t=n.map(i=>({pre:i}));return this.withMiddleware(...t)}withPostMiddleware(...n){const t=n.map(i=>({post:i}));return this.withMiddleware(...t)}isJsonMime(n){return n?P.jsonRegex.test(n):!1}async request(n,t){const{url:i,init:r}=await this.createFetchParams(n,t),o=await this.fetchApi(i,r);if(o&&o.status>=200&&o.status<300)return o;throw new M(o,"Response returned an error code")}async createFetchParams(n,t){let i=this.configuration.basePath+n.path;n.query!==void 0&&Object.keys(n.query).length!==0&&(i+="?"+this.configuration.queryParamsStringify(n.query));const r=Object.assign({},this.configuration.headers,n.headers);Object.keys(r).forEach(p=>r[p]===void 0?delete r[p]:{});const o=typeof t=="function"?t:async()=>t,a={method:n.method,headers:r,body:n.body,credentials:this.configuration.credentials},l={...a,...await o({init:a,context:n})};let s;K(l.body)||l.body instanceof URLSearchParams||$(l.body)?s=l.body:this.isJsonMime(r["Content-Type"])?s=JSON.stringify(l.body):s=l.body;const c={...l,body:s};return{url:i,init:c}}clone(){const n=this.constructor,t=new n(this.configuration);return t.middleware=this.middleware.slice(),t}};w.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let g=w;function $(e){return typeof Blob<"u"&&e instanceof Blob}function K(e){return typeof FormData<"u"&&e instanceof FormData}class M extends Error{constructor(n,t){super(t),this.response=n,this.name="ResponseError"}}class N extends Error{constructor(n,t){super(t),this.cause=n,this.name="FetchError"}}class y extends Error{constructor(n,t){super(t),this.field=n,this.name="RequiredError"}}function _(e,n=""){return Object.keys(e).map(t=>b(t,e[t],n)).filter(t=>t.length>0).join("&")}function b(e,n,t=""){const i=t+(t.length?`[${e}]`:e);if(n instanceof Array){const r=n.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(i)}=`);return`${encodeURIComponent(i)}=${r}`}if(n instanceof Set){const r=Array.from(n);return b(e,r,t)}return n instanceof Date?`${encodeURIComponent(i)}=${encodeURIComponent(n.toISOString())}`:n instanceof Object?_(n,i):`${encodeURIComponent(i)}=${encodeURIComponent(String(n))}`}function v(e,n){return Object.keys(e).reduce((t,i)=>({...t,[i]:n(e[i])}),{})}class d{constructor(n,t=i=>i){this.raw=n,this.transformer=t}async value(){return this.transformer(await this.raw.json())}}function O(e){return B(e)}function B(e,n){return e==null?e:{identifier:e.identifier==null?void 0:e.identifier,content:e.content==null?void 0:e.content.map(C)}}function C(e){return D(e)}function D(e,n){return e==null?e:{items:e.items==null?void 0:e.items,content:e.content==null?void 0:e.content,config:e.config==null?void 0:e.config,identifier:e.identifier==null?void 0:e.identifier,uid:e.uid==null?void 0:e.uid,component:e.component==null?void 0:e.component,slots:e.slots==null?void 0:v(e.slots,O)}}function E(e){return G(e)}function G(e,n){return e==null?e:{slug:e.slug==null?void 0:e.slug,title:e.title==null?void 0:e.title,href:e.href==null?void 0:e.href}}function q(e){return H(e)}function H(e,n){return e==null?e:{type:e.type==null?void 0:e.type,target:e.target==null?void 0:e.target,label:e.label==null?void 0:e.label,href:e.href==null?void 0:e.href,slug:e.slug==null?void 0:e.slug,properties:e.properties==null?void 0:e.properties,children:e.children==null?void 0:e.children.map(q)}}function z(e){return V(e)}function V(e,n){return e==null?e:{items:e.items==null?void 0:e.items.map(q),uid:e.uid==null?void 0:e.uid,identifier:e.identifier==null?void 0:e.identifier,label:e.label==null?void 0:e.label}}function W(e){return J(e)}function J(e,n){return e==null?e:{domain:e.domain==null?void 0:e.domain,slug:e.slug==null?void 0:e.slug,version:e.version==null?void 0:e.version,updated_at:e.updated_at==null?void 0:e.updated_at,language:e.language==null?void 0:e.language,primary_language:e.primary_language==null?void 0:e.primary_language}}function Q(e){return X(e)}function X(e,n){return e==null?e:{nitro:e.nitro==null?void 0:W(e.nitro),pages:e.pages==null?void 0:e.pages,containers:e.containers==null?void 0:v(e.containers,z),globals:e.globals==null?void 0:e.globals}}function Y(e){return Z(e)}function Z(e,n){return e==null?e:{api:e.api==null?void 0:e.api,image:e.image==null?void 0:e.image}}function ee(e){return ne(e)}function ne(e,n){return e==null?e:{_version:e._version==null?void 0:e._version,entity_metric:e.entity_metric==null?void 0:Y(e.entity_metric),entity_unique_id:e.entity_unique_id==null?void 0:e.entity_unique_id,entity_id:e.entity_id==null?void 0:e.entity_id,entity_image:e.entity_image==null?void 0:e.entity_image,entity_slug:e.entity_slug==null?void 0:e.entity_slug,entity_teaser:e.entity_teaser==null?void 0:e.entity_teaser,entity_time_end:e.entity_time_end==null?void 0:e.entity_time_end,entity_time_start:e.entity_time_start==null?void 0:e.entity_time_start,entity_title:e.entity_title==null?void 0:e.entity_title,entity_type:e.entity_type==null?void 0:e.entity_type,entity_type_id:e.entity_type_id==null?void 0:e.entity_type_id,updated_at:e.updated_at==null?void 0:e.updated_at,routes:e.routes==null?void 0:e.routes}}function te(e){return ie(e)}function ie(e,n){return e==null?e:{shortcode:e.shortcode==null?void 0:e.shortcode,name:e.name==null?void 0:e.name}}function R(e){return oe(e)}function oe(e,n){return e==null?e:{language:e.language==null?void 0:te(e.language),slug:e.slug==null?void 0:e.slug,title:e.title==null?void 0:e.title,href:e.href==null?void 0:e.href}}function A(e){return re(e)}function re(e,n){return e==null?e:{entity:e.entity==null?void 0:ee(e.entity),model:e.model==null?void 0:e.model,language:e.language==null?void 0:e.language,jsonld:e.jsonld==null?void 0:e.jsonld,translation:e.translation==null?void 0:e.translation.map(R),breadcrumb:e.breadcrumb==null?void 0:e.breadcrumb.map(E)}}function I(e){return ae(e)}function ae(e,n){return e==null?e:{entity_unique_id:e.entity_unique_id==null?void 0:e.entity_unique_id,entity_title:e.entity_title==null?void 0:e.entity_title,entity_teaser:e.entity_teaser==null?void 0:e.entity_teaser,entity_slug:e.entity_slug==null?void 0:e.entity_slug,entity_time_start:e.entity_time_start==null?void 0:e.entity_time_start,entity_type:e.entity_type==null?void 0:e.entity_type,entity_type_id:e.entity_type_id==null?void 0:e.entity_type_id,entity_image:e.entity_image==null?void 0:e.entity_image,routes:e.routes==null?void 0:e.routes}}function le(e){return se(e)}function se(e,n){return e==null?e:{description:e.description==null?void 0:e.description,image:e.image==null?void 0:e.image,title:e.title==null?void 0:e.title}}function ue(e){return ce(e)}function ce(e,n){return e==null?e:{value:e.value==null?void 0:e.value,navigation:e.navigation==null?void 0:e.navigation,propagate:e.propagate==null?void 0:e.propagate}}function T(e){return de(e)}function de(e,n){return e==null?e:{id:e.id==null?void 0:e.id,title:e.title==null?void 0:e.title,href:e.href==null?void 0:e.href,slug:e.slug==null?void 0:e.slug,json:e.json==null?void 0:e.json.map(C),depth:e.depth==null?void 0:e.depth,is_home:e.is_home==null?void 0:e.is_home,created_at:e.created_at==null?void 0:e.created_at,updated_at:e.updated_at==null?void 0:e.updated_at,is_visible:e.is_visible==null?void 0:e.is_visible,meta_json:e.meta_json==null?void 0:le(e.meta_json),properties:e.properties==null?void 0:v(e.properties,ue),uid:e.uid==null?void 0:e.uid,type:e.type==null?void 0:e.type,target:e.target==null?void 0:e.target,container:e.container==null?void 0:e.container,breadcrumb:e.breadcrumb==null?void 0:e.breadcrumb.map(E),translation:e.translation==null?void 0:e.translation.map(R)}}function fe(e){return ge(e)}function ge(e,n){return e==null?e:{version:e.version==null?void 0:e.version,updated_at:e.updated_at==null?void 0:e.updated_at}}class he extends g{async configRaw(n,t){const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/config",method:"GET",headers:r,query:i},t);return new d(o,a=>Q(a))}async config(n={},t){return await(await this.configRaw(n,t)).value()}}class pe extends g{async entityBySlugRaw(n,t){if(n.slug==null)throw new y("slug",'Required parameter "slug" was null or undefined when calling entityBySlug().');const i={};n.typeId!=null&&(i.typeId=n.typeId),n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/entities/slug/{slug}".replace("{slug}",encodeURIComponent(String(n.slug))),method:"GET",headers:r,query:i},t);return new d(o,a=>A(a))}async entityBySlug(n,t){return await(await this.entityBySlugRaw(n,t)).value()}async entityByUniqueidRaw(n,t){if(n.uniqueid==null)throw new y("uniqueid",'Required parameter "uniqueid" was null or undefined when calling entityByUniqueid().');const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/entities/uniqueid/{uniqueid}".replace("{uniqueid}",encodeURIComponent(String(n.uniqueid))),method:"GET",headers:r,query:i},t);return new d(o,a=>A(a))}async entityByUniqueid(n,t){return await(await this.entityByUniqueidRaw(n,t)).value()}}class ye extends g{async homeRaw(n,t){const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/pages/home",method:"GET",headers:r,query:i},t);return new d(o,a=>T(a))}async home(n={},t){return await(await this.homeRaw(n,t)).value()}async pageRaw(n,t){const i={};n.slug!=null&&(i.slug=n.slug),n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/pages",method:"GET",headers:r,query:i},t);return new d(o,a=>T(a))}async page(n={},t){return await(await this.pageRaw(n,t)).value()}}class ve extends g{async searchRaw(n,t){if(n.query==null)throw new y("query",'Required parameter "query" was null or undefined when calling search().');const i={};n.query!=null&&(i.query=n.query),n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/search",method:"GET",headers:r,query:i},t);return new d(o,a=>a.map(I))}async search(n,t){return await(await this.searchRaw(n,t)).value()}}class me extends g{async sitemapRaw(n,t){const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/sitemap",method:"GET",headers:r,query:i},t);return new d(o,a=>a.map(I))}async sitemap(n={},t){return await(await this.sitemapRaw(n,t)).value()}}class we extends g{async versionRaw(n,t){const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/version",method:"GET",headers:r,query:i},t);return new d(o,a=>fe(a))}async version(n={},t){return await(await this.versionRaw(n,t)).value()}}const _e=/[\p{Lu}]/u,be=/[\p{Ll}]/u,k=/^[\p{Lu}](?![\p{Lu}])/gu,S=/([\p{Alpha}\p{N}_]|$)/u,m=/[_.\- ]+/,Ce=new RegExp("^"+m.source),j=new RegExp(m.source+S.source,"gu"),L=new RegExp("\\d+"+S.source,"gu"),Ee=(e,n,t,i)=>{let r=!1,o=!1,a=!1,l=!1;for(let s=0;s<e.length;s++){const c=e[s];l=s>2?e[s-3]==="-":!0,r&&_e.test(c)?(e=e.slice(0,s)+"-"+e.slice(s),r=!1,a=o,o=!0,s++):o&&a&&be.test(c)&&(!l||i)?(e=e.slice(0,s-1)+"-"+e.slice(s-1),a=o,o=!1,r=!0):(r=n(c)===c&&t(c)!==c,a=o,o=t(c)===c&&n(c)!==c)}return e},qe=(e,n)=>(k.lastIndex=0,e.replaceAll(k,t=>n(t))),Re=(e,n)=>(j.lastIndex=0,L.lastIndex=0,e.replaceAll(L,(t,i,r)=>["_","-"].includes(e.charAt(r+t.length))?t:n(t)).replaceAll(j,(t,i)=>n(i)));function Ae(e,n){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");if(n={pascalCase:!1,preserveConsecutiveUppercase:!1,...n},Array.isArray(e)?e=e.map(o=>o.trim()).filter(o=>o.length).join("-"):e=e.trim(),e.length===0)return"";const t=n.locale===!1?o=>o.toLowerCase():o=>o.toLocaleLowerCase(n.locale),i=n.locale===!1?o=>o.toUpperCase():o=>o.toLocaleUpperCase(n.locale);return e.length===1?m.test(e)?"":n.pascalCase?i(e):t(e):(e!==t(e)&&(e=Ee(e,t,i,n.preserveConsecutiveUppercase)),e=e.replace(Ce,""),e=n.preserveConsecutiveUppercase?qe(e,t):t(e),n.pascalCase&&(e=i(e.charAt(0))+e.slice(1)),Re(e,i))}function Ie(e,n,t){const i="virtual:flyo-components",r="\0"+i;return{name:"vite-plugin-flyo-components",async resolveId(o){if(o===i)return r},async load(o){if(o===r){const a=[];for(const[s,c]of Object.entries(n)){const p=await this.resolve("/"+e+"/"+c+".astro");p&&a.push(`export { default as ${Ae(s)} } from "${p.id}"`)}let l=null;return t&&(l=await this.resolve("/"+e+"/"+t+".astro")),l?a.push(`export { default as fallback } from "${l.id}"`):a.push('export { default as fallback } from "@flyo/nitro-astro/FallbackComponent.astro"'),a.join(";")}}}}function U(){return globalThis.flyoNitroInstance||console.error("The Flyo Typescript Configuration has not been initialized correctly"),globalThis.flyoNitroInstance}function f(){return U().config}async function Te(e){return await e.locals.config}function ke(){return new he(f())}function Se(){return new pe(f())}function je(){return new ye(f())}function Le(){return new ve(f())}function Ue(){return new me(f())}function Pe(){return new we(f())}function Fe(e){return{"data-flyo-uid":e.uid}}const xe=`
|
|
1
|
+
(function(l,h){typeof exports=="object"&&typeof module<"u"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(l=typeof globalThis<"u"?globalThis:l||self,h(l.flyoNitroIntegration={}))})(this,function(l){"use strict";const h="https://api.flyo.cloud/nitro/v1".replace(/\/+$/,"");class x{constructor(n={}){this.configuration=n}set config(n){this.configuration=n}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:h}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||_}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const n=this.configuration.apiKey;if(n)return typeof n=="function"?n:()=>n}get accessToken(){const n=this.configuration.accessToken;if(n)return typeof n=="function"?n:async()=>n}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const $=new x,w=class F{constructor(n=$){this.configuration=n,this.fetchApi=async(t,i)=>{let r={url:t,init:i};for(const a of this.middleware)a.pre&&(r=await a.pre({fetch:this.fetchApi,...r})||r);let o;try{o=await(this.configuration.fetchApi||fetch)(r.url,r.init)}catch(a){for(const s of this.middleware)s.onError&&(o=await s.onError({fetch:this.fetchApi,url:r.url,init:r.init,error:a,response:o?o.clone():void 0})||o);if(o===void 0)throw a instanceof Error?new O(a,"The request failed and the interceptors did not return an alternative response"):a}for(const a of this.middleware)a.post&&(o=await a.post({fetch:this.fetchApi,url:r.url,init:r.init,response:o.clone()})||o);return o},this.middleware=n.middleware}withMiddleware(...n){const t=this.clone();return t.middleware=t.middleware.concat(...n),t}withPreMiddleware(...n){const t=n.map(i=>({pre:i}));return this.withMiddleware(...t)}withPostMiddleware(...n){const t=n.map(i=>({post:i}));return this.withMiddleware(...t)}isJsonMime(n){return n?F.jsonRegex.test(n):!1}async request(n,t){const{url:i,init:r}=await this.createFetchParams(n,t),o=await this.fetchApi(i,r);if(o&&o.status>=200&&o.status<300)return o;throw new N(o,"Response returned an error code")}async createFetchParams(n,t){let i=this.configuration.basePath+n.path;n.query!==void 0&&Object.keys(n.query).length!==0&&(i+="?"+this.configuration.queryParamsStringify(n.query));const r=Object.assign({},this.configuration.headers,n.headers);Object.keys(r).forEach(p=>r[p]===void 0?delete r[p]:{});const o=typeof t=="function"?t:async()=>t,a={method:n.method,headers:r,body:n.body,credentials:this.configuration.credentials},s={...a,...await o({init:a,context:n})};let u;M(s.body)||s.body instanceof URLSearchParams||K(s.body)?u=s.body:this.isJsonMime(r["Content-Type"])?u=JSON.stringify(s.body):u=s.body;const c={...s,body:u};return{url:i,init:c}}clone(){const n=this.constructor,t=new n(this.configuration);return t.middleware=this.middleware.slice(),t}};w.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let g=w;function K(e){return typeof Blob<"u"&&e instanceof Blob}function M(e){return typeof FormData<"u"&&e instanceof FormData}class N extends Error{constructor(n,t){super(t),this.response=n,this.name="ResponseError"}}class O extends Error{constructor(n,t){super(t),this.cause=n,this.name="FetchError"}}class y extends Error{constructor(n,t){super(t),this.field=n,this.name="RequiredError"}}function _(e,n=""){return Object.keys(e).map(t=>b(t,e[t],n)).filter(t=>t.length>0).join("&")}function b(e,n,t=""){const i=t+(t.length?`[${e}]`:e);if(n instanceof Array){const r=n.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(i)}=`);return`${encodeURIComponent(i)}=${r}`}if(n instanceof Set){const r=Array.from(n);return b(e,r,t)}return n instanceof Date?`${encodeURIComponent(i)}=${encodeURIComponent(n.toISOString())}`:n instanceof Object?_(n,i):`${encodeURIComponent(i)}=${encodeURIComponent(String(n))}`}function v(e,n){return Object.keys(e).reduce((t,i)=>({...t,[i]:n(e[i])}),{})}class d{constructor(n,t=i=>i){this.raw=n,this.transformer=t}async value(){return this.transformer(await this.raw.json())}}function B(e){return D(e)}function D(e,n){return e==null?e:{identifier:e.identifier==null?void 0:e.identifier,content:e.content==null?void 0:e.content.map(C)}}function C(e){return G(e)}function G(e,n){return e==null?e:{items:e.items==null?void 0:e.items,content:e.content==null?void 0:e.content,config:e.config==null?void 0:e.config,identifier:e.identifier==null?void 0:e.identifier,uid:e.uid==null?void 0:e.uid,component:e.component==null?void 0:e.component,slots:e.slots==null?void 0:v(e.slots,B)}}function E(e){return H(e)}function H(e,n){return e==null?e:{slug:e.slug==null?void 0:e.slug,title:e.title==null?void 0:e.title,href:e.href==null?void 0:e.href}}function q(e){return z(e)}function z(e,n){return e==null?e:{type:e.type==null?void 0:e.type,target:e.target==null?void 0:e.target,label:e.label==null?void 0:e.label,href:e.href==null?void 0:e.href,slug:e.slug==null?void 0:e.slug,properties:e.properties==null?void 0:e.properties,children:e.children==null?void 0:e.children.map(q)}}function V(e){return W(e)}function W(e,n){return e==null?e:{items:e.items==null?void 0:e.items.map(q),uid:e.uid==null?void 0:e.uid,identifier:e.identifier==null?void 0:e.identifier,label:e.label==null?void 0:e.label}}function J(e){return Q(e)}function Q(e,n){return e==null?e:{domain:e.domain==null?void 0:e.domain,slug:e.slug==null?void 0:e.slug,version:e.version==null?void 0:e.version,updated_at:e.updated_at==null?void 0:e.updated_at,language:e.language==null?void 0:e.language,primary_language:e.primary_language==null?void 0:e.primary_language}}function X(e){return Y(e)}function Y(e,n){return e==null?e:{nitro:e.nitro==null?void 0:J(e.nitro),pages:e.pages==null?void 0:e.pages,containers:e.containers==null?void 0:v(e.containers,V),globals:e.globals==null?void 0:e.globals}}function Z(e){return ee(e)}function ee(e,n){return e==null?e:{api:e.api==null?void 0:e.api,image:e.image==null?void 0:e.image}}function ne(e){return te(e)}function te(e,n){return e==null?e:{_version:e._version==null?void 0:e._version,entity_metric:e.entity_metric==null?void 0:Z(e.entity_metric),entity_unique_id:e.entity_unique_id==null?void 0:e.entity_unique_id,entity_id:e.entity_id==null?void 0:e.entity_id,entity_image:e.entity_image==null?void 0:e.entity_image,entity_slug:e.entity_slug==null?void 0:e.entity_slug,entity_teaser:e.entity_teaser==null?void 0:e.entity_teaser,entity_time_end:e.entity_time_end==null?void 0:e.entity_time_end,entity_time_start:e.entity_time_start==null?void 0:e.entity_time_start,entity_title:e.entity_title==null?void 0:e.entity_title,entity_type:e.entity_type==null?void 0:e.entity_type,entity_type_id:e.entity_type_id==null?void 0:e.entity_type_id,updated_at:e.updated_at==null?void 0:e.updated_at,routes:e.routes==null?void 0:e.routes}}function ie(e){return oe(e)}function oe(e,n){return e==null?e:{shortcode:e.shortcode==null?void 0:e.shortcode,name:e.name==null?void 0:e.name}}function R(e){return re(e)}function re(e,n){return e==null?e:{language:e.language==null?void 0:ie(e.language),slug:e.slug==null?void 0:e.slug,title:e.title==null?void 0:e.title,href:e.href==null?void 0:e.href}}function A(e){return ae(e)}function ae(e,n){return e==null?e:{entity:e.entity==null?void 0:ne(e.entity),model:e.model==null?void 0:e.model,language:e.language==null?void 0:e.language,jsonld:e.jsonld==null?void 0:e.jsonld,translation:e.translation==null?void 0:e.translation.map(R),breadcrumb:e.breadcrumb==null?void 0:e.breadcrumb.map(E)}}function I(e){return le(e)}function le(e,n){return e==null?e:{entity_unique_id:e.entity_unique_id==null?void 0:e.entity_unique_id,entity_title:e.entity_title==null?void 0:e.entity_title,entity_teaser:e.entity_teaser==null?void 0:e.entity_teaser,entity_slug:e.entity_slug==null?void 0:e.entity_slug,entity_time_start:e.entity_time_start==null?void 0:e.entity_time_start,entity_type:e.entity_type==null?void 0:e.entity_type,entity_type_id:e.entity_type_id==null?void 0:e.entity_type_id,entity_image:e.entity_image==null?void 0:e.entity_image,routes:e.routes==null?void 0:e.routes}}function se(e){return ue(e)}function ue(e,n){return e==null?e:{description:e.description==null?void 0:e.description,image:e.image==null?void 0:e.image,title:e.title==null?void 0:e.title}}function ce(e){return de(e)}function de(e,n){return e==null?e:{value:e.value==null?void 0:e.value,navigation:e.navigation==null?void 0:e.navigation,propagate:e.propagate==null?void 0:e.propagate}}function T(e){return fe(e)}function fe(e,n){return e==null?e:{id:e.id==null?void 0:e.id,title:e.title==null?void 0:e.title,href:e.href==null?void 0:e.href,slug:e.slug==null?void 0:e.slug,json:e.json==null?void 0:e.json.map(C),depth:e.depth==null?void 0:e.depth,is_home:e.is_home==null?void 0:e.is_home,created_at:e.created_at==null?void 0:e.created_at,updated_at:e.updated_at==null?void 0:e.updated_at,is_visible:e.is_visible==null?void 0:e.is_visible,meta_json:e.meta_json==null?void 0:se(e.meta_json),properties:e.properties==null?void 0:v(e.properties,ce),uid:e.uid==null?void 0:e.uid,type:e.type==null?void 0:e.type,target:e.target==null?void 0:e.target,container:e.container==null?void 0:e.container,breadcrumb:e.breadcrumb==null?void 0:e.breadcrumb.map(E),translation:e.translation==null?void 0:e.translation.map(R)}}function ge(e){return he(e)}function he(e,n){return e==null?e:{version:e.version==null?void 0:e.version,updated_at:e.updated_at==null?void 0:e.updated_at}}class pe extends g{async configRaw(n,t){const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/config",method:"GET",headers:r,query:i},t);return new d(o,a=>X(a))}async config(n={},t){return await(await this.configRaw(n,t)).value()}}class ye extends g{async entityBySlugRaw(n,t){if(n.slug==null)throw new y("slug",'Required parameter "slug" was null or undefined when calling entityBySlug().');const i={};n.typeId!=null&&(i.typeId=n.typeId),n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/entities/slug/{slug}".replace("{slug}",encodeURIComponent(String(n.slug))),method:"GET",headers:r,query:i},t);return new d(o,a=>A(a))}async entityBySlug(n,t){return await(await this.entityBySlugRaw(n,t)).value()}async entityByUniqueidRaw(n,t){if(n.uniqueid==null)throw new y("uniqueid",'Required parameter "uniqueid" was null or undefined when calling entityByUniqueid().');const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/entities/uniqueid/{uniqueid}".replace("{uniqueid}",encodeURIComponent(String(n.uniqueid))),method:"GET",headers:r,query:i},t);return new d(o,a=>A(a))}async entityByUniqueid(n,t){return await(await this.entityByUniqueidRaw(n,t)).value()}}class ve extends g{async homeRaw(n,t){const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/pages/home",method:"GET",headers:r,query:i},t);return new d(o,a=>T(a))}async home(n={},t){return await(await this.homeRaw(n,t)).value()}async pageRaw(n,t){const i={};n.slug!=null&&(i.slug=n.slug),n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/pages",method:"GET",headers:r,query:i},t);return new d(o,a=>T(a))}async page(n={},t){return await(await this.pageRaw(n,t)).value()}}class me extends g{async searchRaw(n,t){if(n.query==null)throw new y("query",'Required parameter "query" was null or undefined when calling search().');const i={};n.query!=null&&(i.query=n.query),n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/search",method:"GET",headers:r,query:i},t);return new d(o,a=>a.map(I))}async search(n,t){return await(await this.searchRaw(n,t)).value()}}class we extends g{async sitemapRaw(n,t){const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/sitemap",method:"GET",headers:r,query:i},t);return new d(o,a=>a.map(I))}async sitemap(n={},t){return await(await this.sitemapRaw(n,t)).value()}}class _e extends g{async versionRaw(n,t){const i={};n.lang!=null&&(i.lang=n.lang);const r={};this.configuration&&this.configuration.apiKey&&(i.token=await this.configuration.apiKey("token"));const o=await this.request({path:"/version",method:"GET",headers:r,query:i},t);return new d(o,a=>ge(a))}async version(n={},t){return await(await this.versionRaw(n,t)).value()}}const be=/[\p{Lu}]/u,Ce=/[\p{Ll}]/u,k=/^[\p{Lu}](?![\p{Lu}])/gu,S=/([\p{Alpha}\p{N}_]|$)/u,m=/[_.\- ]+/,Ee=new RegExp("^"+m.source),j=new RegExp(m.source+S.source,"gu"),L=new RegExp("\\d+"+S.source,"gu"),qe=(e,n,t,i)=>{let r=!1,o=!1,a=!1,s=!1;for(let u=0;u<e.length;u++){const c=e[u];s=u>2?e[u-3]==="-":!0,r&&be.test(c)?(e=e.slice(0,u)+"-"+e.slice(u),r=!1,a=o,o=!0,u++):o&&a&&Ce.test(c)&&(!s||i)?(e=e.slice(0,u-1)+"-"+e.slice(u-1),a=o,o=!1,r=!0):(r=n(c)===c&&t(c)!==c,a=o,o=t(c)===c&&n(c)!==c)}return e},Re=(e,n)=>(k.lastIndex=0,e.replaceAll(k,t=>n(t))),Ae=(e,n)=>(j.lastIndex=0,L.lastIndex=0,e.replaceAll(L,(t,i,r)=>["_","-"].includes(e.charAt(r+t.length))?t:n(t)).replaceAll(j,(t,i)=>n(i)));function Ie(e,n){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");if(n={pascalCase:!1,preserveConsecutiveUppercase:!1,...n},Array.isArray(e)?e=e.map(o=>o.trim()).filter(o=>o.length).join("-"):e=e.trim(),e.length===0)return"";const t=n.locale===!1?o=>o.toLowerCase():o=>o.toLocaleLowerCase(n.locale),i=n.locale===!1?o=>o.toUpperCase():o=>o.toLocaleUpperCase(n.locale);return e.length===1?m.test(e)?"":n.pascalCase?i(e):t(e):(e!==t(e)&&(e=qe(e,t,i,n.preserveConsecutiveUppercase)),e=e.replace(Ee,""),e=n.preserveConsecutiveUppercase?Re(e,t):t(e),n.pascalCase&&(e=i(e.charAt(0))+e.slice(1)),Ae(e,i))}function Te(e,n,t){const i="virtual:flyo-components",r="\0"+i;return{name:"vite-plugin-flyo-components",async resolveId(o){if(o===i)return r},async load(o){if(o===r){const a=[];for(const[u,c]of Object.entries(n)){const p=await this.resolve("/"+e+"/"+c+".astro");p&&a.push(`export { default as ${Ie(u)} } from "${p.id}"`)}let s=null;return t&&(s=await this.resolve("/"+e+"/"+t+".astro")),s?a.push(`export { default as fallback } from "${s.id}"`):a.push('export { default as fallback } from "@flyo/nitro-astro/FallbackComponent.astro"'),a.join(";")}}}}function U(){return globalThis.flyoNitroInstance||console.error("The Flyo Typescript Configuration has not been initialized correctly"),globalThis.flyoNitroInstance}function f(){return U().config}async function ke(e){return await e.locals.config}function Se(){return new pe(f())}function je(){return new ye(f())}function Le(){return new ve(f())}function Ue(){return new me(f())}function Pe(){return new we(f())}function Fe(){return new _e(f())}function P(e){return{"data-flyo-uid":e.uid}}const xe=P,$e=`
|
|
2
2
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 163.4 88.5">
|
|
3
3
|
<style type="text/css">
|
|
4
4
|
.st8{fill:#FFFFFF;}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
</g>
|
|
30
30
|
</g>
|
|
31
31
|
</svg>
|
|
32
|
-
`;function
|
|
32
|
+
`;function Ke(e){const n={accessToken:!1,liveEdit:!1,fallbackComponent:null,componentsDir:"src/components/flyo",serverCacheHeaderTtl:1200,clientCacheHeaderTtl:900,...e};return n.liveEdit==="true"?n.liveEdit=!0:n.liveEdit==="false"&&(n.liveEdit=!1),{name:"@flyo/nitro-astro",hooks:{"astro:config:setup":({injectScript:t,updateConfig:i,injectRoute:r,addMiddleware:o,addDevToolbarApp:a})=>{if(!n.accessToken||n.accessToken.length==0)throw new Error("The Flyo Nitro Integration requires an accessToken");a({id:"flyo-nitro",name:"Flyo Nitro",icon:$e,entrypoint:"@flyo/nitro-astro/toolbar.ts"}),r({pattern:"sitemap.xml",entrypoint:"@flyo/nitro-astro/sitemap.ts"}),o({entrypoint:"@flyo/nitro-astro/middleware.ts",order:"post"}),i({image:{service:{entrypoint:"@flyo/nitro-astro/cdn.ts"}},vite:{plugins:[Te(n.componentsDir,n.components||{},n.fallbackComponent)]}}),t("page-ssr",`
|
|
33
33
|
import { Configuration } from '@flyo/nitro-typescript'
|
|
34
34
|
|
|
35
35
|
var defaultConfig = new Configuration({
|
|
@@ -67,4 +67,4 @@
|
|
|
67
67
|
} else {
|
|
68
68
|
wire();
|
|
69
69
|
}
|
|
70
|
-
`)}}}}
|
|
70
|
+
`)}}}}l.default=Ke,l.editable=P,l.editableBlock=xe,l.useConfig=ke,l.useConfigApi=Se,l.useConfiguration=f,l.useEntitiesApi=je,l.useFlyoIntegration=U,l.usePagesApi=Le,l.useSearchApi=Ue,l.useSitemapApi=Pe,l.useVersionApi=Fe,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/nitro-astro.mjs
CHANGED
|
@@ -687,33 +687,33 @@ function Ae() {
|
|
|
687
687
|
function f() {
|
|
688
688
|
return Ae().config;
|
|
689
689
|
}
|
|
690
|
-
async function
|
|
690
|
+
async function ke(e) {
|
|
691
691
|
return await e.locals.config;
|
|
692
692
|
}
|
|
693
|
-
function
|
|
693
|
+
function xe() {
|
|
694
694
|
return new fe(f());
|
|
695
695
|
}
|
|
696
|
-
function
|
|
696
|
+
function Se() {
|
|
697
697
|
return new he(f());
|
|
698
698
|
}
|
|
699
|
-
function
|
|
699
|
+
function je() {
|
|
700
700
|
return new ge(f());
|
|
701
701
|
}
|
|
702
|
-
function
|
|
702
|
+
function Le() {
|
|
703
703
|
return new pe(f());
|
|
704
704
|
}
|
|
705
|
-
function
|
|
705
|
+
function Ue() {
|
|
706
706
|
return new ye(f());
|
|
707
707
|
}
|
|
708
|
-
function
|
|
708
|
+
function Pe() {
|
|
709
709
|
return new ve(f());
|
|
710
710
|
}
|
|
711
|
-
function
|
|
711
|
+
function Ie(e) {
|
|
712
712
|
return {
|
|
713
713
|
"data-flyo-uid": e.uid
|
|
714
714
|
};
|
|
715
715
|
}
|
|
716
|
-
const Ie = `
|
|
716
|
+
const Fe = Ie, Te = `
|
|
717
717
|
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 163.4 88.5">
|
|
718
718
|
<style type="text/css">
|
|
719
719
|
.st8{fill:#FFFFFF;}
|
|
@@ -745,7 +745,7 @@ const Ie = `
|
|
|
745
745
|
</g>
|
|
746
746
|
</svg>
|
|
747
747
|
`;
|
|
748
|
-
function
|
|
748
|
+
function $e(e) {
|
|
749
749
|
const n = {
|
|
750
750
|
accessToken: !1,
|
|
751
751
|
liveEdit: !1,
|
|
@@ -773,7 +773,7 @@ function Fe(e) {
|
|
|
773
773
|
id: "flyo-nitro",
|
|
774
774
|
name: "Flyo Nitro",
|
|
775
775
|
//icon: 'lightbulb',
|
|
776
|
-
icon:
|
|
776
|
+
icon: Te,
|
|
777
777
|
//icon: '<svg width="200" height="200" viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><ellipse cx="100" cy="60" rx="90" ry="50" fill="#F4A460" /><circle cx="70" cy="45" r="5" fill="white" /><circle cx="90" cy="30" r="5" fill="white" /><circle cx="110" cy="45" r="5" fill="white" /><circle cx="130" cy="30" r="5" fill="white" /><circle cx="150" cy="45" r="5" fill="white" /><path d="M30 90 Q60 75, 90 90 T150 90 Q160 80, 180 90" fill="#228B22" /><rect x="30" y="90" width="140" height="15" fill="#FF6347" /><rect x="30" y="105" width="140" height="15" fill="#FFD700" /><rect x="30" y="120" width="140" height="25" fill="#8B4513" /><ellipse cx="100" cy="160" rx="90" ry="30" fill="#F4A460" /></svg>',
|
|
778
778
|
entrypoint: "@flyo/nitro-astro/toolbar.ts"
|
|
779
779
|
}), r({
|
|
@@ -847,15 +847,16 @@ function Fe(e) {
|
|
|
847
847
|
};
|
|
848
848
|
}
|
|
849
849
|
export {
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
ke as
|
|
850
|
+
$e as default,
|
|
851
|
+
Ie as editable,
|
|
852
|
+
Fe as editableBlock,
|
|
853
|
+
ke as useConfig,
|
|
854
|
+
xe as useConfigApi,
|
|
854
855
|
f as useConfiguration,
|
|
855
|
-
|
|
856
|
+
Se as useEntitiesApi,
|
|
856
857
|
Ae as useFlyoIntegration,
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
858
|
+
je as usePagesApi,
|
|
859
|
+
Le as useSearchApi,
|
|
860
|
+
Ue as useSitemapApi,
|
|
861
|
+
Pe as useVersionApi
|
|
861
862
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -77,5 +77,6 @@ export declare function usePagesApi(): PagesApi;
|
|
|
77
77
|
export declare function useSearchApi(): SearchApi;
|
|
78
78
|
export declare function useSitemapApi(): SitemapApi;
|
|
79
79
|
export declare function useVersionApi(): VersionApi;
|
|
80
|
-
export declare function
|
|
80
|
+
export declare function editable(block: Block): object;
|
|
81
|
+
export declare const editableBlock: typeof editable;
|
|
81
82
|
export default function flyoNitroIntegration(options: IntegrationOptions): AstroIntegration;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flyo/nitro-astro",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Connecting Flyo Headless Content Hub into your Astro project.",
|
|
5
5
|
"homepage": "https://dev.flyo.cloud/nitro",
|
|
6
6
|
"keywords": [
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
"build": "vite build"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@flyo/nitro-typescript": "^1.1.0"
|
|
17
|
+
"@flyo/nitro-typescript": "^1.1.0",
|
|
18
|
+
"@flyo/nitro-js-bridge": "^1.1.2"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|
|
20
21
|
"astro": "^4.16.7",
|