@flyo/nitro-astro 1.0.16 → 1.0.18
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.
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
import * as components from 'virtual:flyo-components'
|
|
3
3
|
import type { AstroComponentFactory } from "astro/dist/runtime/server"
|
|
4
4
|
import camelcase from "camelcase"
|
|
5
|
+
import { Block } from '@flyo/nitro-typescript';
|
|
5
6
|
|
|
6
7
|
interface Props {
|
|
7
|
-
block:
|
|
8
|
+
block: Block;
|
|
8
9
|
[prop: string]: unknown;
|
|
9
10
|
}
|
|
10
11
|
|
|
@@ -13,7 +14,7 @@ const { block, ...props } = Astro.props;
|
|
|
13
14
|
/* @vite-ignore */
|
|
14
15
|
let Component: AstroComponentFactory | null = null
|
|
15
16
|
|
|
16
|
-
const key
|
|
17
|
+
const key: string = camelcase(block.component as string);
|
|
17
18
|
const componentFound : boolean = key in components
|
|
18
19
|
|
|
19
20
|
if (componentFound) {
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
---
|
|
2
|
+
import { Page } from '@flyo/nitro-typescript';
|
|
2
3
|
import FlyoNitroBlock from './FlyoNitroBlock.astro';
|
|
3
4
|
|
|
4
5
|
interface Props {
|
|
5
|
-
page:
|
|
6
|
+
page: Page;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
const { page } = Astro.props
|
|
9
10
|
|
|
10
11
|
---
|
|
11
12
|
|
|
12
|
-
{page
|
|
13
|
+
{page?.json?.map((block: object) => (
|
|
13
14
|
<FlyoNitroBlock block={block} />
|
|
14
15
|
))}
|
package/dist/nitro-astro.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(l,y){typeof exports=="object"&&typeof module<"u"?y(exports):typeof define=="function"&&define.amd?define(["exports"],y):(l=typeof globalThis<"u"?globalThis:l||self,y(l.flyoNitroIntegration={}))})(this,function(l){"use strict";const y="https://api.flyo.cloud/nitro/v1".replace(/\/+$/,"");class j{constructor(i={}){this.configuration=i}set config(i){this.configuration=i}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:y}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||q}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const i=this.configuration.apiKey;if(i)return typeof i=="function"?i:()=>i}get accessToken(){const i=this.configuration.accessToken;if(i)return typeof i=="function"?i:async()=>i}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const L=new j,_=class P{constructor(i=L){this.configuration=i,this.fetchApi=async(t,r)=>{let a={url:t,init:r};for(const s of this.middleware)s.pre&&(a=await s.pre({fetch:this.fetchApi,...a})||a);let o;try{o=await(this.configuration.fetchApi||fetch)(a.url,a.init)}catch(s){for(const u of this.middleware)u.onError&&(o=await u.onError({fetch:this.fetchApi,url:a.url,init:a.init,error:s,response:o?o.clone():void 0})||o);if(o===void 0)throw s instanceof Error?new O(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(o=await s.post({fetch:this.fetchApi,url:a.url,init:a.init,response:o.clone()})||o);return o},this.middleware=i.middleware}withMiddleware(...i){const t=this.clone();return t.middleware=t.middleware.concat(...i),t}withPreMiddleware(...i){const t=i.map(r=>({pre:r}));return this.withMiddleware(...t)}withPostMiddleware(...i){const t=i.map(r=>({post:r}));return this.withMiddleware(...t)}isJsonMime(i){return i?P.jsonRegex.test(i):!1}async request(i,t){const{url:r,init:a}=await this.createFetchParams(i,t),o=await this.fetchApi(r,a);if(o&&o.status>=200&&o.status<300)return o;throw new N(o,"Response returned an error code")}async createFetchParams(i,t){let r=this.configuration.basePath+i.path;i.query!==void 0&&Object.keys(i.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(i.query));const a=Object.assign({},this.configuration.headers,i.headers);Object.keys(a).forEach(g=>a[g]===void 0?delete a[g]:{});const o=typeof t=="function"?t:async()=>t,s={method:i.method,headers:a,body:i.body,credentials:this.configuration.credentials},u={...s,...await o({init:s,context:i})};let c;x(u.body)||u.body instanceof URLSearchParams||K(u.body)?c=u.body:this.isJsonMime(a["Content-Type"])?c=JSON.stringify(u.body):c=u.body;const d={...u,body:c};return{url:r,init:d}}clone(){const i=this.constructor,t=new i(this.configuration);return t.middleware=this.middleware.slice(),t}};_.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let h=_;function K(e){return typeof Blob<"u"&&e instanceof Blob}function x(e){return typeof FormData<"u"&&e instanceof FormData}class N extends Error{constructor(i,t){super(t),this.response=i,this.name="ResponseError"}}class O extends Error{constructor(i,t){super(t),this.cause=i,this.name="FetchError"}}class v extends Error{constructor(i,t){super(t),this.field=i,this.name="RequiredError"}}function n(e,i){return e[i]!=null}function q(e,i=""){return Object.keys(e).map(t=>b(t,e[t],i)).filter(t=>t.length>0).join("&")}function b(e,i,t=""){const r=t+(t.length?`[${e}]`:e);if(i instanceof Array){const a=i.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${a}`}if(i instanceof Set){const a=Array.from(i);return b(e,a,t)}return i instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(i.toISOString())}`:i instanceof Object?q(i,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(i))}`}function m(e,i){return Object.keys(e).reduce((t,r)=>({...t,[r]:i(e[r])}),{})}class f{constructor(i,t=r=>r){this.raw=i,this.transformer=t}async value(){return this.transformer(await this.raw.json())}}function $(e){return M(e)}function M(e,i){return e==null?e:{identifier:n(e,"identifier")?e.identifier:void 0,content:n(e,"content")?e.content.map(R):void 0}}function R(e){return F(e)}function F(e,i){return e==null?e:{items:n(e,"items")?e.items:void 0,content:n(e,"content")?e.content:void 0,config:n(e,"config")?e.config:void 0,identifier:n(e,"identifier")?e.identifier:void 0,uid:n(e,"uid")?e.uid:void 0,component:n(e,"component")?e.component:void 0,slots:n(e,"slots")?m(e.slots,$):void 0}}function A(e){return B(e)}function B(e,i){return e==null?e:{type:n(e,"type")?e.type:void 0,target:n(e,"target")?e.target:void 0,label:n(e,"label")?e.label:void 0,href:n(e,"href")?e.href:void 0,slug:n(e,"slug")?e.slug:void 0,properties:n(e,"properties")?e.properties:void 0,children:n(e,"children")?e.children.map(A):void 0}}function D(e){return G(e)}function G(e,i){return e==null?e:{items:n(e,"items")?e.items.map(A):void 0,uid:n(e,"uid")?e.uid:void 0,identifier:n(e,"identifier")?e.identifier:void 0,label:n(e,"label")?e.label:void 0}}function J(e){return V(e)}function V(e,i){return e==null?e:{domain:n(e,"domain")?e.domain:void 0,slug:n(e,"slug")?e.slug:void 0,version:n(e,"version")?e.version:void 0,updatedAt:n(e,"updated_at")?e.updated_at:void 0,language:n(e,"language")?e.language:void 0}}function W(e){return z(e)}function z(e,i){return e==null?e:{nitro:n(e,"nitro")?J(e.nitro):void 0,pages:n(e,"pages")?e.pages:void 0,containers:n(e,"containers")?m(e.containers,D):void 0,globals:n(e,"globals")?e.globals:void 0}}function H(e){return X(e)}function X(e,i){return e==null?e:{api:n(e,"api")?e.api:void 0,image:n(e,"image")?e.image:void 0}}function Z(e){return Q(e)}function Q(e,i){return e==null?e:{version:n(e,"_version")?e._version:void 0,entityMetric:n(e,"entity_metric")?H(e.entity_metric):void 0,entityUniqueId:n(e,"entity_unique_id")?e.entity_unique_id:void 0,entityId:n(e,"entity_id")?e.entity_id:void 0,entityImage:n(e,"entity_image")?e.entity_image:void 0,entitySlug:n(e,"entity_slug")?e.entity_slug:void 0,entityTeaser:n(e,"entity_teaser")?e.entity_teaser:void 0,entityTimeEnd:n(e,"entity_time_end")?e.entity_time_end:void 0,entityTimeStart:n(e,"entity_time_start")?e.entity_time_start:void 0,entityTitle:n(e,"entity_title")?e.entity_title:void 0,entityType:n(e,"entity_type")?e.entity_type:void 0,entityTypeId:n(e,"entity_type_id")?e.entity_type_id:void 0,updatedAt:n(e,"updated_at")?e.updated_at:void 0,routes:n(e,"routes")?e.routes:void 0}}function E(e){return Y(e)}function Y(e,i){return e==null?e:{entity:n(e,"entity")?Z(e.entity):void 0,model:n(e,"model")?e.model:void 0,language:n(e,"language")?e.language:void 0,jsonld:n(e,"jsonld")?e.jsonld:void 0}}function I(e){return ee(e)}function ee(e,i){return e==null?e:{entityUniqueId:n(e,"entity_unique_id")?e.entity_unique_id:void 0,entityTitle:n(e,"entity_title")?e.entity_title:void 0,entityTeaser:n(e,"entity_teaser")?e.entity_teaser:void 0,entitySlug:n(e,"entity_slug")?e.entity_slug:void 0,entityTimeStart:n(e,"entity_time_start")?e.entity_time_start:void 0,entityType:n(e,"entity_type")?e.entity_type:void 0,entityTypeId:n(e,"entity_type_id")?e.entity_type_id:void 0,entityImage:n(e,"entity_image")?e.entity_image:void 0,routes:n(e,"routes")?e.routes:void 0}}function ie(e){return te(e)}function te(e,i){return e==null?e:{description:n(e,"description")?e.description:void 0,image:n(e,"image")?e.image:void 0,title:n(e,"title")?e.title:void 0}}function ne(e){return oe(e)}function oe(e,i){return e==null?e:{slug:n(e,"slug")?e.slug:void 0,title:n(e,"title")?e.title:void 0}}function re(e){return ae(e)}function ae(e,i){return e==null?e:{value:n(e,"value")?e.value:void 0,navigation:n(e,"navigation")?e.navigation:void 0,propagate:n(e,"propagate")?e.propagate:void 0}}function C(e){return se(e)}function se(e,i){return e==null?e:{id:n(e,"id")?e.id:void 0,title:n(e,"title")?e.title:void 0,href:n(e,"href")?e.href:void 0,slug:n(e,"slug")?e.slug:void 0,json:n(e,"json")?e.json.map(R):void 0,depth:n(e,"depth")?e.depth:void 0,isHome:n(e,"is_home")?e.is_home:void 0,createdAt:n(e,"created_at")?e.created_at:void 0,updatedAt:n(e,"updated_at")?e.updated_at:void 0,isVisible:n(e,"is_visible")?e.is_visible:void 0,metaJson:n(e,"meta_json")?ie(e.meta_json):void 0,properties:n(e,"properties")?m(e.properties,re):void 0,uid:n(e,"uid")?e.uid:void 0,type:n(e,"type")?e.type:void 0,target:n(e,"target")?e.target:void 0,container:n(e,"container")?e.container:void 0,breadcrumb:n(e,"breadcrumb")?e.breadcrumb.map(ne):void 0}}function ue(e){return ce(e)}function ce(e,i){return e==null?e:{version:n(e,"version")?e.version:void 0,updatedAt:n(e,"updated_at")?e.updated_at:void 0}}class de extends h{async configRaw(i){const t={},r={};this.configuration&&this.configuration.apiKey&&(t.token=this.configuration.apiKey("token"));const a=await this.request({path:"/config",method:"GET",headers:r,query:t},i);return new f(a,o=>W(o))}async config(i){return await(await this.configRaw(i)).value()}}class le extends h{async entityBySlugRaw(i,t){if(i.slug===null||i.slug===void 0)throw new v("slug","Required parameter requestParameters.slug was null or undefined when calling entityBySlug.");const r={};i.typeId!==void 0&&(r.typeId=i.typeId);const a={};this.configuration&&this.configuration.apiKey&&(r.token=this.configuration.apiKey("token"));const o=await this.request({path:"/entities/slug/{slug}".replace("{slug}",encodeURIComponent(String(i.slug))),method:"GET",headers:a,query:r},t);return new f(o,s=>E(s))}async entityBySlug(i,t){return await(await this.entityBySlugRaw(i,t)).value()}async entityByUniqueidRaw(i,t){if(i.uniqueid===null||i.uniqueid===void 0)throw new v("uniqueid","Required parameter requestParameters.uniqueid was null or undefined when calling entityByUniqueid.");const r={},a={};this.configuration&&this.configuration.apiKey&&(r.token=this.configuration.apiKey("token"));const o=await this.request({path:"/entities/uniqueid/{uniqueid}".replace("{uniqueid}",encodeURIComponent(String(i.uniqueid))),method:"GET",headers:a,query:r},t);return new f(o,s=>E(s))}async entityByUniqueid(i,t){return await(await this.entityByUniqueidRaw(i,t)).value()}}class fe extends h{async homeRaw(i){const t={},r={};this.configuration&&this.configuration.apiKey&&(t.token=this.configuration.apiKey("token"));const a=await this.request({path:"/pages/home",method:"GET",headers:r,query:t},i);return new f(a,o=>C(o))}async home(i){return await(await this.homeRaw(i)).value()}async pageRaw(i,t){const r={};i.slug!==void 0&&(r.slug=i.slug);const a={};this.configuration&&this.configuration.apiKey&&(r.token=this.configuration.apiKey("token"));const o=await this.request({path:"/pages",method:"GET",headers:a,query:r},t);return new f(o,s=>C(s))}async page(i={},t){return await(await this.pageRaw(i,t)).value()}}class pe extends h{async searchRaw(i,t){if(i.query===null||i.query===void 0)throw new v("query","Required parameter requestParameters.query was null or undefined when calling search.");const r={};i.query!==void 0&&(r.query=i.query);const a={};this.configuration&&this.configuration.apiKey&&(r.token=this.configuration.apiKey("token"));const o=await this.request({path:"/search",method:"GET",headers:a,query:r},t);return new f(o,s=>s.map(I))}async search(i,t){return await(await this.searchRaw(i,t)).value()}}class he extends h{async sitemapRaw(i){const t={},r={};this.configuration&&this.configuration.apiKey&&(t.token=this.configuration.apiKey("token"));const a=await this.request({path:"/sitemap",method:"GET",headers:r,query:t},i);return new f(a,o=>o.map(I))}async sitemap(i){return await(await this.sitemapRaw(i)).value()}}class ye extends h{async versionRaw(i){const t={},r={};this.configuration&&this.configuration.apiKey&&(t.token=this.configuration.apiKey("token"));const a=await this.request({path:"/version",method:"GET",headers:r,query:t},i);return new f(a,o=>ue(o))}async version(i){return await(await this.versionRaw(i)).value()}}const ge=/[\p{Lu}]/u,ve=/[\p{Ll}]/u,T=/^[\p{Lu}](?![\p{Lu}])/gu,S=/([\p{Alpha}\p{N}_]|$)/u,w=/[_.\- ]+/,me=new RegExp("^"+w.source),k=new RegExp(w.source+S.source,"gu"),U=new RegExp("\\d+"+S.source,"gu"),we=(e,i,t,r)=>{let a=!1,o=!1,s=!1,u=!1;for(let c=0;c<e.length;c++){const d=e[c];u=c>2?e[c-3]==="-":!0,a&&ge.test(d)?(e=e.slice(0,c)+"-"+e.slice(c),a=!1,s=o,o=!0,c++):o&&s&&ve.test(d)&&(!u||r)?(e=e.slice(0,c-1)+"-"+e.slice(c-1),s=o,o=!1,a=!0):(a=i(d)===d&&t(d)!==d,s=o,o=t(d)===d&&i(d)!==d)}return e},_e=(e,i)=>(T.lastIndex=0,e.replace(T,t=>i(t))),qe=(e,i)=>(k.lastIndex=0,U.lastIndex=0,e.replace(k,(t,r)=>i(r)).replace(U,t=>i(t)));function be(e,i){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");if(i={pascalCase:!1,preserveConsecutiveUppercase:!1,...i},Array.isArray(e)?e=e.map(o=>o.trim()).filter(o=>o.length).join("-"):e=e.trim(),e.length===0)return"";const t=i.locale===!1?o=>o.toLowerCase():o=>o.toLocaleLowerCase(i.locale),r=i.locale===!1?o=>o.toUpperCase():o=>o.toLocaleUpperCase(i.locale);return e.length===1?w.test(e)?"":i.pascalCase?r(e):t(e):(e!==t(e)&&(e=we(e,t,r,i.preserveConsecutiveUppercase)),e=e.replace(me,""),e=i.preserveConsecutiveUppercase?_e(e,t):t(e),i.pascalCase&&(e=r(e.charAt(0))+e.slice(1)),qe(e,r))}function Re(e,i,t){const r="virtual:flyo-components",a="\0"+r;return{name:"vite-plugin-flyo-components",async resolveId(o){if(o===r)return a},async load(o){if(o===a){const s=[];for(const[c,d]of Object.entries(i)){const g=await this.resolve("/"+e+"/"+d+".astro");g&&s.push(`export { default as ${be(c)} } from "${g.id}"`)}let u=null;return t&&(u=await this.resolve("/"+e+"/"+t+".astro")),u?s.push(`export { default as fallback } from "${u.id}"`):s.push('export { default as fallback } from "@flyo/nitro-astro/FallbackComponent.astro"'),s.join(";")}}}}function p(){return globalThis.flyoNitroInstance||console.error("The Flyo Typescript Configuration has not been initialized correctly"),globalThis.flyoNitroInstance}function Ae(){return new de(p())}function Ee(){return new le(p())}function Ie(){return new fe(p())}function Ce(){return new pe(p())}function Te(){return new he(p())}function Se(){return new ye(p())}function ke(e){const i={accessToken:!1,liveEdit:!1,fallbackComponent:null,...e};return{name:"@flyo/nitro-astro",hooks:{"astro:config:setup":({injectScript:t,updateConfig:r})=>{r({vite:{plugins:[Re(e.componentsDir,e.components,e.fallbackComponent)]}}),t("page-ssr",`
|
|
1
|
+
(function(l,y){typeof exports=="object"&&typeof module<"u"?y(exports):typeof define=="function"&&define.amd?define(["exports"],y):(l=typeof globalThis<"u"?globalThis:l||self,y(l.flyoNitroIntegration={}))})(this,function(l){"use strict";const y="https://api.flyo.cloud/nitro/v1".replace(/\/+$/,"");class j{constructor(i={}){this.configuration=i}set config(i){this.configuration=i}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:y}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||q}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const i=this.configuration.apiKey;if(i)return typeof i=="function"?i:()=>i}get accessToken(){const i=this.configuration.accessToken;if(i)return typeof i=="function"?i:async()=>i}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const L=new j,_=class U{constructor(i=L){this.configuration=i,this.fetchApi=async(t,r)=>{let a={url:t,init:r};for(const s of this.middleware)s.pre&&(a=await s.pre({fetch:this.fetchApi,...a})||a);let o;try{o=await(this.configuration.fetchApi||fetch)(a.url,a.init)}catch(s){for(const u of this.middleware)u.onError&&(o=await u.onError({fetch:this.fetchApi,url:a.url,init:a.init,error:s,response:o?o.clone():void 0})||o);if(o===void 0)throw s instanceof Error?new O(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(o=await s.post({fetch:this.fetchApi,url:a.url,init:a.init,response:o.clone()})||o);return o},this.middleware=i.middleware}withMiddleware(...i){const t=this.clone();return t.middleware=t.middleware.concat(...i),t}withPreMiddleware(...i){const t=i.map(r=>({pre:r}));return this.withMiddleware(...t)}withPostMiddleware(...i){const t=i.map(r=>({post:r}));return this.withMiddleware(...t)}isJsonMime(i){return i?U.jsonRegex.test(i):!1}async request(i,t){const{url:r,init:a}=await this.createFetchParams(i,t),o=await this.fetchApi(r,a);if(o&&o.status>=200&&o.status<300)return o;throw new N(o,"Response returned an error code")}async createFetchParams(i,t){let r=this.configuration.basePath+i.path;i.query!==void 0&&Object.keys(i.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(i.query));const a=Object.assign({},this.configuration.headers,i.headers);Object.keys(a).forEach(g=>a[g]===void 0?delete a[g]:{});const o=typeof t=="function"?t:async()=>t,s={method:i.method,headers:a,body:i.body,credentials:this.configuration.credentials},u={...s,...await o({init:s,context:i})};let c;x(u.body)||u.body instanceof URLSearchParams||K(u.body)?c=u.body:this.isJsonMime(a["Content-Type"])?c=JSON.stringify(u.body):c=u.body;const d={...u,body:c};return{url:r,init:d}}clone(){const i=this.constructor,t=new i(this.configuration);return t.middleware=this.middleware.slice(),t}};_.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let h=_;function K(e){return typeof Blob<"u"&&e instanceof Blob}function x(e){return typeof FormData<"u"&&e instanceof FormData}class N extends Error{constructor(i,t){super(t),this.response=i,this.name="ResponseError"}}class O extends Error{constructor(i,t){super(t),this.cause=i,this.name="FetchError"}}class v extends Error{constructor(i,t){super(t),this.field=i,this.name="RequiredError"}}function n(e,i){return e[i]!=null}function q(e,i=""){return Object.keys(e).map(t=>b(t,e[t],i)).filter(t=>t.length>0).join("&")}function b(e,i,t=""){const r=t+(t.length?`[${e}]`:e);if(i instanceof Array){const a=i.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${a}`}if(i instanceof Set){const a=Array.from(i);return b(e,a,t)}return i instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(i.toISOString())}`:i instanceof Object?q(i,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(i))}`}function m(e,i){return Object.keys(e).reduce((t,r)=>({...t,[r]:i(e[r])}),{})}class f{constructor(i,t=r=>r){this.raw=i,this.transformer=t}async value(){return this.transformer(await this.raw.json())}}function $(e){return M(e)}function M(e,i){return e==null?e:{identifier:n(e,"identifier")?e.identifier:void 0,content:n(e,"content")?e.content.map(R):void 0}}function R(e){return F(e)}function F(e,i){return e==null?e:{items:n(e,"items")?e.items:void 0,content:n(e,"content")?e.content:void 0,config:n(e,"config")?e.config:void 0,identifier:n(e,"identifier")?e.identifier:void 0,uid:n(e,"uid")?e.uid:void 0,component:n(e,"component")?e.component:void 0,slots:n(e,"slots")?m(e.slots,$):void 0}}function E(e){return B(e)}function B(e,i){return e==null?e:{type:n(e,"type")?e.type:void 0,target:n(e,"target")?e.target:void 0,label:n(e,"label")?e.label:void 0,href:n(e,"href")?e.href:void 0,slug:n(e,"slug")?e.slug:void 0,properties:n(e,"properties")?e.properties:void 0,children:n(e,"children")?e.children.map(E):void 0}}function D(e){return G(e)}function G(e,i){return e==null?e:{items:n(e,"items")?e.items.map(E):void 0,uid:n(e,"uid")?e.uid:void 0,identifier:n(e,"identifier")?e.identifier:void 0,label:n(e,"label")?e.label:void 0}}function J(e){return V(e)}function V(e,i){return e==null?e:{domain:n(e,"domain")?e.domain:void 0,slug:n(e,"slug")?e.slug:void 0,version:n(e,"version")?e.version:void 0,updated_at:n(e,"updated_at")?e.updated_at:void 0,language:n(e,"language")?e.language:void 0}}function W(e){return z(e)}function z(e,i){return e==null?e:{nitro:n(e,"nitro")?J(e.nitro):void 0,pages:n(e,"pages")?e.pages:void 0,containers:n(e,"containers")?m(e.containers,D):void 0,globals:n(e,"globals")?e.globals:void 0}}function H(e){return X(e)}function X(e,i){return e==null?e:{api:n(e,"api")?e.api:void 0,image:n(e,"image")?e.image:void 0}}function Z(e){return Q(e)}function Q(e,i){return e==null?e:{_version:n(e,"_version")?e._version:void 0,entity_metric:n(e,"entity_metric")?H(e.entity_metric):void 0,entity_unique_id:n(e,"entity_unique_id")?e.entity_unique_id:void 0,entity_id:n(e,"entity_id")?e.entity_id:void 0,entity_image:n(e,"entity_image")?e.entity_image:void 0,entity_slug:n(e,"entity_slug")?e.entity_slug:void 0,entity_teaser:n(e,"entity_teaser")?e.entity_teaser:void 0,entity_time_end:n(e,"entity_time_end")?e.entity_time_end:void 0,entity_time_start:n(e,"entity_time_start")?e.entity_time_start:void 0,entity_title:n(e,"entity_title")?e.entity_title:void 0,entity_type:n(e,"entity_type")?e.entity_type:void 0,entity_type_id:n(e,"entity_type_id")?e.entity_type_id:void 0,updated_at:n(e,"updated_at")?e.updated_at:void 0,routes:n(e,"routes")?e.routes:void 0}}function C(e){return Y(e)}function Y(e,i){return e==null?e:{entity:n(e,"entity")?Z(e.entity):void 0,model:n(e,"model")?e.model:void 0,language:n(e,"language")?e.language:void 0,jsonld:n(e,"jsonld")?e.jsonld:void 0}}function A(e){return ee(e)}function ee(e,i){return e==null?e:{entity_unique_id:n(e,"entity_unique_id")?e.entity_unique_id:void 0,entity_title:n(e,"entity_title")?e.entity_title:void 0,entity_teaser:n(e,"entity_teaser")?e.entity_teaser:void 0,entity_slug:n(e,"entity_slug")?e.entity_slug:void 0,entity_time_start:n(e,"entity_time_start")?e.entity_time_start:void 0,entity_type:n(e,"entity_type")?e.entity_type:void 0,entity_type_id:n(e,"entity_type_id")?e.entity_type_id:void 0,entity_image:n(e,"entity_image")?e.entity_image:void 0,routes:n(e,"routes")?e.routes:void 0}}function ie(e){return te(e)}function te(e,i){return e==null?e:{description:n(e,"description")?e.description:void 0,image:n(e,"image")?e.image:void 0,title:n(e,"title")?e.title:void 0}}function ne(e){return oe(e)}function oe(e,i){return e==null?e:{slug:n(e,"slug")?e.slug:void 0,title:n(e,"title")?e.title:void 0}}function re(e){return ae(e)}function ae(e,i){return e==null?e:{value:n(e,"value")?e.value:void 0,navigation:n(e,"navigation")?e.navigation:void 0,propagate:n(e,"propagate")?e.propagate:void 0}}function I(e){return se(e)}function se(e,i){return e==null?e:{id:n(e,"id")?e.id:void 0,title:n(e,"title")?e.title:void 0,href:n(e,"href")?e.href:void 0,slug:n(e,"slug")?e.slug:void 0,json:n(e,"json")?e.json.map(R):void 0,depth:n(e,"depth")?e.depth:void 0,is_home:n(e,"is_home")?e.is_home:void 0,created_at:n(e,"created_at")?e.created_at:void 0,updated_at:n(e,"updated_at")?e.updated_at:void 0,is_visible:n(e,"is_visible")?e.is_visible:void 0,meta_json:n(e,"meta_json")?ie(e.meta_json):void 0,properties:n(e,"properties")?m(e.properties,re):void 0,uid:n(e,"uid")?e.uid:void 0,type:n(e,"type")?e.type:void 0,target:n(e,"target")?e.target:void 0,container:n(e,"container")?e.container:void 0,breadcrumb:n(e,"breadcrumb")?e.breadcrumb.map(ne):void 0}}function ue(e){return ce(e)}function ce(e,i){return e==null?e:{version:n(e,"version")?e.version:void 0,updated_at:n(e,"updated_at")?e.updated_at:void 0}}class de extends h{async configRaw(i){const t={},r={};this.configuration&&this.configuration.apiKey&&(t.token=this.configuration.apiKey("token"));const a=await this.request({path:"/config",method:"GET",headers:r,query:t},i);return new f(a,o=>W(o))}async config(i){return await(await this.configRaw(i)).value()}}class le extends h{async entityBySlugRaw(i,t){if(i.slug===null||i.slug===void 0)throw new v("slug","Required parameter requestParameters.slug was null or undefined when calling entityBySlug.");const r={};i.typeId!==void 0&&(r.typeId=i.typeId);const a={};this.configuration&&this.configuration.apiKey&&(r.token=this.configuration.apiKey("token"));const o=await this.request({path:"/entities/slug/{slug}".replace("{slug}",encodeURIComponent(String(i.slug))),method:"GET",headers:a,query:r},t);return new f(o,s=>C(s))}async entityBySlug(i,t){return await(await this.entityBySlugRaw(i,t)).value()}async entityByUniqueidRaw(i,t){if(i.uniqueid===null||i.uniqueid===void 0)throw new v("uniqueid","Required parameter requestParameters.uniqueid was null or undefined when calling entityByUniqueid.");const r={},a={};this.configuration&&this.configuration.apiKey&&(r.token=this.configuration.apiKey("token"));const o=await this.request({path:"/entities/uniqueid/{uniqueid}".replace("{uniqueid}",encodeURIComponent(String(i.uniqueid))),method:"GET",headers:a,query:r},t);return new f(o,s=>C(s))}async entityByUniqueid(i,t){return await(await this.entityByUniqueidRaw(i,t)).value()}}class fe extends h{async homeRaw(i){const t={},r={};this.configuration&&this.configuration.apiKey&&(t.token=this.configuration.apiKey("token"));const a=await this.request({path:"/pages/home",method:"GET",headers:r,query:t},i);return new f(a,o=>I(o))}async home(i){return await(await this.homeRaw(i)).value()}async pageRaw(i,t){const r={};i.slug!==void 0&&(r.slug=i.slug);const a={};this.configuration&&this.configuration.apiKey&&(r.token=this.configuration.apiKey("token"));const o=await this.request({path:"/pages",method:"GET",headers:a,query:r},t);return new f(o,s=>I(s))}async page(i={},t){return await(await this.pageRaw(i,t)).value()}}class pe extends h{async searchRaw(i,t){if(i.query===null||i.query===void 0)throw new v("query","Required parameter requestParameters.query was null or undefined when calling search.");const r={};i.query!==void 0&&(r.query=i.query);const a={};this.configuration&&this.configuration.apiKey&&(r.token=this.configuration.apiKey("token"));const o=await this.request({path:"/search",method:"GET",headers:a,query:r},t);return new f(o,s=>s.map(A))}async search(i,t){return await(await this.searchRaw(i,t)).value()}}class he extends h{async sitemapRaw(i){const t={},r={};this.configuration&&this.configuration.apiKey&&(t.token=this.configuration.apiKey("token"));const a=await this.request({path:"/sitemap",method:"GET",headers:r,query:t},i);return new f(a,o=>o.map(A))}async sitemap(i){return await(await this.sitemapRaw(i)).value()}}class ye extends h{async versionRaw(i){const t={},r={};this.configuration&&this.configuration.apiKey&&(t.token=this.configuration.apiKey("token"));const a=await this.request({path:"/version",method:"GET",headers:r,query:t},i);return new f(a,o=>ue(o))}async version(i){return await(await this.versionRaw(i)).value()}}const ge=/[\p{Lu}]/u,ve=/[\p{Ll}]/u,k=/^[\p{Lu}](?![\p{Lu}])/gu,S=/([\p{Alpha}\p{N}_]|$)/u,w=/[_.\- ]+/,me=new RegExp("^"+w.source),T=new RegExp(w.source+S.source,"gu"),P=new RegExp("\\d+"+S.source,"gu"),we=(e,i,t,r)=>{let a=!1,o=!1,s=!1,u=!1;for(let c=0;c<e.length;c++){const d=e[c];u=c>2?e[c-3]==="-":!0,a&&ge.test(d)?(e=e.slice(0,c)+"-"+e.slice(c),a=!1,s=o,o=!0,c++):o&&s&&ve.test(d)&&(!u||r)?(e=e.slice(0,c-1)+"-"+e.slice(c-1),s=o,o=!1,a=!0):(a=i(d)===d&&t(d)!==d,s=o,o=t(d)===d&&i(d)!==d)}return e},_e=(e,i)=>(k.lastIndex=0,e.replace(k,t=>i(t))),qe=(e,i)=>(T.lastIndex=0,P.lastIndex=0,e.replace(T,(t,r)=>i(r)).replace(P,t=>i(t)));function be(e,i){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");if(i={pascalCase:!1,preserveConsecutiveUppercase:!1,...i},Array.isArray(e)?e=e.map(o=>o.trim()).filter(o=>o.length).join("-"):e=e.trim(),e.length===0)return"";const t=i.locale===!1?o=>o.toLowerCase():o=>o.toLocaleLowerCase(i.locale),r=i.locale===!1?o=>o.toUpperCase():o=>o.toLocaleUpperCase(i.locale);return e.length===1?w.test(e)?"":i.pascalCase?r(e):t(e):(e!==t(e)&&(e=we(e,t,r,i.preserveConsecutiveUppercase)),e=e.replace(me,""),e=i.preserveConsecutiveUppercase?_e(e,t):t(e),i.pascalCase&&(e=r(e.charAt(0))+e.slice(1)),qe(e,r))}function Re(e,i,t){const r="virtual:flyo-components",a="\0"+r;return{name:"vite-plugin-flyo-components",async resolveId(o){if(o===r)return a},async load(o){if(o===a){const s=[];for(const[c,d]of Object.entries(i)){const g=await this.resolve("/"+e+"/"+d+".astro");g&&s.push(`export { default as ${be(c)} } from "${g.id}"`)}let u=null;return t&&(u=await this.resolve("/"+e+"/"+t+".astro")),u?s.push(`export { default as fallback } from "${u.id}"`):s.push('export { default as fallback } from "@flyo/nitro-astro/FallbackComponent.astro"'),s.join(";")}}}}function p(){return globalThis.flyoNitroInstance||console.error("The Flyo Typescript Configuration has not been initialized correctly"),globalThis.flyoNitroInstance}function Ee(){return new de(p())}function Ce(){return new le(p())}function Ae(){return new fe(p())}function Ie(){return new pe(p())}function ke(){return new he(p())}function Se(){return new ye(p())}function Te(e){const i={accessToken:!1,liveEdit:!1,fallbackComponent:null,...e};return{name:"@flyo/nitro-astro",hooks:{"astro:config:setup":({injectScript:t,updateConfig:r})=>{r({vite:{plugins:[Re(e.componentsDir,e.components,e.fallbackComponent)]}}),t("page-ssr",`
|
|
2
2
|
import { Configuration } from '@flyo/nitro-typescript'
|
|
3
3
|
|
|
4
4
|
var defaultConfig = new Configuration({
|
|
@@ -28,4 +28,4 @@
|
|
|
28
28
|
data: JSON.parse(JSON.stringify({item:{uid: blockUid}}))
|
|
29
29
|
}, 'https://flyo.cloud')
|
|
30
30
|
}
|
|
31
|
-
`)}}}}l.default=
|
|
31
|
+
`)}}}}l.default=Te,l.useConfigApi=Ee,l.useConfiguration=p,l.useEntitiesApi=Ce,l.usePagesApi=Ae,l.useSearchApi=Ie,l.useSitemapApi=ke,l.useVersionApi=Se,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/nitro-astro.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const U = "https://api.flyo.cloud/nitro/v1".replace(/\/+$/, "");
|
|
2
2
|
class x {
|
|
3
|
-
constructor(
|
|
4
|
-
this.configuration =
|
|
3
|
+
constructor(t = {}) {
|
|
4
|
+
this.configuration = t;
|
|
5
5
|
}
|
|
6
|
-
set config(
|
|
7
|
-
this.configuration =
|
|
6
|
+
set config(t) {
|
|
7
|
+
this.configuration = t;
|
|
8
8
|
}
|
|
9
9
|
get basePath() {
|
|
10
10
|
return this.configuration.basePath != null ? this.configuration.basePath : U;
|
|
@@ -16,7 +16,7 @@ class x {
|
|
|
16
16
|
return this.configuration.middleware || [];
|
|
17
17
|
}
|
|
18
18
|
get queryParamsStringify() {
|
|
19
|
-
return this.configuration.queryParamsStringify ||
|
|
19
|
+
return this.configuration.queryParamsStringify || C;
|
|
20
20
|
}
|
|
21
21
|
get username() {
|
|
22
22
|
return this.configuration.username;
|
|
@@ -25,14 +25,14 @@ class x {
|
|
|
25
25
|
return this.configuration.password;
|
|
26
26
|
}
|
|
27
27
|
get apiKey() {
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
return typeof
|
|
28
|
+
const t = this.configuration.apiKey;
|
|
29
|
+
if (t)
|
|
30
|
+
return typeof t == "function" ? t : () => t;
|
|
31
31
|
}
|
|
32
32
|
get accessToken() {
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
return typeof
|
|
33
|
+
const t = this.configuration.accessToken;
|
|
34
|
+
if (t)
|
|
35
|
+
return typeof t == "function" ? t : async () => t;
|
|
36
36
|
}
|
|
37
37
|
get headers() {
|
|
38
38
|
return this.configuration.headers;
|
|
@@ -41,10 +41,10 @@ class x {
|
|
|
41
41
|
return this.configuration.credentials;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
const P = new x(),
|
|
45
|
-
constructor(
|
|
46
|
-
this.configuration =
|
|
47
|
-
let a = { url:
|
|
44
|
+
const P = new x(), b = class E {
|
|
45
|
+
constructor(t = P) {
|
|
46
|
+
this.configuration = t, this.fetchApi = async (i, r) => {
|
|
47
|
+
let a = { url: i, init: r };
|
|
48
48
|
for (const s of this.middleware)
|
|
49
49
|
s.pre && (a = await s.pre({
|
|
50
50
|
fetch: this.fetchApi,
|
|
@@ -73,19 +73,19 @@ const P = new x(), R = class E {
|
|
|
73
73
|
response: o.clone()
|
|
74
74
|
}) || o);
|
|
75
75
|
return o;
|
|
76
|
-
}, this.middleware =
|
|
76
|
+
}, this.middleware = t.middleware;
|
|
77
77
|
}
|
|
78
|
-
withMiddleware(...
|
|
79
|
-
const
|
|
80
|
-
return
|
|
78
|
+
withMiddleware(...t) {
|
|
79
|
+
const i = this.clone();
|
|
80
|
+
return i.middleware = i.middleware.concat(...t), i;
|
|
81
81
|
}
|
|
82
|
-
withPreMiddleware(...
|
|
83
|
-
const
|
|
84
|
-
return this.withMiddleware(...
|
|
82
|
+
withPreMiddleware(...t) {
|
|
83
|
+
const i = t.map((r) => ({ pre: r }));
|
|
84
|
+
return this.withMiddleware(...i);
|
|
85
85
|
}
|
|
86
|
-
withPostMiddleware(...
|
|
87
|
-
const
|
|
88
|
-
return this.withMiddleware(...
|
|
86
|
+
withPostMiddleware(...t) {
|
|
87
|
+
const i = t.map((r) => ({ post: r }));
|
|
88
|
+
return this.withMiddleware(...i);
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* Check if the given MIME is a JSON MIME.
|
|
@@ -97,30 +97,30 @@ const P = new x(), R = class E {
|
|
|
97
97
|
* @param mime - MIME (Multipurpose Internet Mail Extensions)
|
|
98
98
|
* @return True if the given MIME is JSON, false otherwise.
|
|
99
99
|
*/
|
|
100
|
-
isJsonMime(
|
|
101
|
-
return
|
|
100
|
+
isJsonMime(t) {
|
|
101
|
+
return t ? E.jsonRegex.test(t) : !1;
|
|
102
102
|
}
|
|
103
|
-
async request(
|
|
104
|
-
const { url: r, init: a } = await this.createFetchParams(
|
|
103
|
+
async request(t, i) {
|
|
104
|
+
const { url: r, init: a } = await this.createFetchParams(t, i), o = await this.fetchApi(r, a);
|
|
105
105
|
if (o && o.status >= 200 && o.status < 300)
|
|
106
106
|
return o;
|
|
107
107
|
throw new K(o, "Response returned an error code");
|
|
108
108
|
}
|
|
109
|
-
async createFetchParams(
|
|
110
|
-
let r = this.configuration.basePath +
|
|
111
|
-
|
|
112
|
-
const a = Object.assign({}, this.configuration.headers,
|
|
109
|
+
async createFetchParams(t, i) {
|
|
110
|
+
let r = this.configuration.basePath + t.path;
|
|
111
|
+
t.query !== void 0 && Object.keys(t.query).length !== 0 && (r += "?" + this.configuration.queryParamsStringify(t.query));
|
|
112
|
+
const a = Object.assign({}, this.configuration.headers, t.headers);
|
|
113
113
|
Object.keys(a).forEach((h) => a[h] === void 0 ? delete a[h] : {});
|
|
114
|
-
const o = typeof
|
|
115
|
-
method:
|
|
114
|
+
const o = typeof i == "function" ? i : async () => i, s = {
|
|
115
|
+
method: t.method,
|
|
116
116
|
headers: a,
|
|
117
|
-
body:
|
|
117
|
+
body: t.body,
|
|
118
118
|
credentials: this.configuration.credentials
|
|
119
119
|
}, u = {
|
|
120
120
|
...s,
|
|
121
121
|
...await o({
|
|
122
122
|
init: s,
|
|
123
|
-
context:
|
|
123
|
+
context: t
|
|
124
124
|
})
|
|
125
125
|
};
|
|
126
126
|
let c;
|
|
@@ -136,12 +136,12 @@ const P = new x(), R = class E {
|
|
|
136
136
|
* and then shallow cloning data members.
|
|
137
137
|
*/
|
|
138
138
|
clone() {
|
|
139
|
-
const
|
|
140
|
-
return
|
|
139
|
+
const t = this.constructor, i = new t(this.configuration);
|
|
140
|
+
return i.middleware = this.middleware.slice(), i;
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
|
-
|
|
144
|
-
let f =
|
|
143
|
+
b.jsonRegex = new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$", "i");
|
|
144
|
+
let f = b;
|
|
145
145
|
function j(e) {
|
|
146
146
|
return typeof Blob < "u" && e instanceof Blob;
|
|
147
147
|
}
|
|
@@ -149,47 +149,47 @@ function L(e) {
|
|
|
149
149
|
return typeof FormData < "u" && e instanceof FormData;
|
|
150
150
|
}
|
|
151
151
|
class K extends Error {
|
|
152
|
-
constructor(
|
|
153
|
-
super(
|
|
152
|
+
constructor(t, i) {
|
|
153
|
+
super(i), this.response = t, this.name = "ResponseError";
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
class N extends Error {
|
|
157
|
-
constructor(
|
|
158
|
-
super(
|
|
157
|
+
constructor(t, i) {
|
|
158
|
+
super(i), this.cause = t, this.name = "FetchError";
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
class y extends Error {
|
|
162
|
-
constructor(
|
|
163
|
-
super(
|
|
162
|
+
constructor(t, i) {
|
|
163
|
+
super(i), this.field = t, this.name = "RequiredError";
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
function n(e,
|
|
167
|
-
return e[
|
|
166
|
+
function n(e, t) {
|
|
167
|
+
return e[t] != null;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
170
|
-
return Object.keys(e).map((
|
|
169
|
+
function C(e, t = "") {
|
|
170
|
+
return Object.keys(e).map((i) => I(i, e[i], t)).filter((i) => i.length > 0).join("&");
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
const r =
|
|
174
|
-
if (
|
|
175
|
-
const a =
|
|
172
|
+
function I(e, t, i = "") {
|
|
173
|
+
const r = i + (i.length ? `[${e}]` : e);
|
|
174
|
+
if (t instanceof Array) {
|
|
175
|
+
const a = t.map((o) => encodeURIComponent(String(o))).join(`&${encodeURIComponent(r)}=`);
|
|
176
176
|
return `${encodeURIComponent(r)}=${a}`;
|
|
177
177
|
}
|
|
178
|
-
if (
|
|
179
|
-
const a = Array.from(
|
|
180
|
-
return
|
|
178
|
+
if (t instanceof Set) {
|
|
179
|
+
const a = Array.from(t);
|
|
180
|
+
return I(e, a, i);
|
|
181
181
|
}
|
|
182
|
-
return
|
|
182
|
+
return t instanceof Date ? `${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}` : t instanceof Object ? C(t, r) : `${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`;
|
|
183
183
|
}
|
|
184
|
-
function g(e,
|
|
184
|
+
function g(e, t) {
|
|
185
185
|
return Object.keys(e).reduce(
|
|
186
|
-
(
|
|
186
|
+
(i, r) => ({ ...i, [r]: t(e[r]) }),
|
|
187
187
|
{}
|
|
188
188
|
);
|
|
189
189
|
}
|
|
190
190
|
class l {
|
|
191
|
-
constructor(
|
|
192
|
-
this.raw =
|
|
191
|
+
constructor(t, i = (r) => r) {
|
|
192
|
+
this.raw = t, this.transformer = i;
|
|
193
193
|
}
|
|
194
194
|
async value() {
|
|
195
195
|
return this.transformer(await this.raw.json());
|
|
@@ -198,16 +198,16 @@ class l {
|
|
|
198
198
|
function $(e) {
|
|
199
199
|
return O(e);
|
|
200
200
|
}
|
|
201
|
-
function O(e,
|
|
201
|
+
function O(e, t) {
|
|
202
202
|
return e == null ? e : {
|
|
203
203
|
identifier: n(e, "identifier") ? e.identifier : void 0,
|
|
204
|
-
content: n(e, "content") ? e.content.map(
|
|
204
|
+
content: n(e, "content") ? e.content.map(A) : void 0
|
|
205
205
|
};
|
|
206
206
|
}
|
|
207
|
-
function
|
|
207
|
+
function A(e) {
|
|
208
208
|
return F(e);
|
|
209
209
|
}
|
|
210
|
-
function F(e,
|
|
210
|
+
function F(e, t) {
|
|
211
211
|
return e == null ? e : {
|
|
212
212
|
items: n(e, "items") ? e.items : void 0,
|
|
213
213
|
content: n(e, "content") ? e.content : void 0,
|
|
@@ -218,10 +218,10 @@ function F(e, i) {
|
|
|
218
218
|
slots: n(e, "slots") ? g(e.slots, $) : void 0
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
|
-
function
|
|
222
|
-
return
|
|
221
|
+
function k(e) {
|
|
222
|
+
return B(e);
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function B(e, t) {
|
|
225
225
|
return e == null ? e : {
|
|
226
226
|
type: n(e, "type") ? e.type : void 0,
|
|
227
227
|
target: n(e, "target") ? e.target : void 0,
|
|
@@ -229,15 +229,15 @@ function M(e, i) {
|
|
|
229
229
|
href: n(e, "href") ? e.href : void 0,
|
|
230
230
|
slug: n(e, "slug") ? e.slug : void 0,
|
|
231
231
|
properties: n(e, "properties") ? e.properties : void 0,
|
|
232
|
-
children: n(e, "children") ? e.children.map(
|
|
232
|
+
children: n(e, "children") ? e.children.map(k) : void 0
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function M(e) {
|
|
236
236
|
return D(e);
|
|
237
237
|
}
|
|
238
|
-
function D(e,
|
|
238
|
+
function D(e, t) {
|
|
239
239
|
return e == null ? e : {
|
|
240
|
-
items: n(e, "items") ? e.items.map(
|
|
240
|
+
items: n(e, "items") ? e.items.map(k) : void 0,
|
|
241
241
|
uid: n(e, "uid") ? e.uid : void 0,
|
|
242
242
|
identifier: n(e, "identifier") ? e.identifier : void 0,
|
|
243
243
|
label: n(e, "label") ? e.label : void 0
|
|
@@ -246,30 +246,30 @@ function D(e, i) {
|
|
|
246
246
|
function G(e) {
|
|
247
247
|
return J(e);
|
|
248
248
|
}
|
|
249
|
-
function J(e,
|
|
249
|
+
function J(e, t) {
|
|
250
250
|
return e == null ? e : {
|
|
251
251
|
domain: n(e, "domain") ? e.domain : void 0,
|
|
252
252
|
slug: n(e, "slug") ? e.slug : void 0,
|
|
253
253
|
version: n(e, "version") ? e.version : void 0,
|
|
254
|
-
|
|
254
|
+
updated_at: n(e, "updated_at") ? e.updated_at : void 0,
|
|
255
255
|
language: n(e, "language") ? e.language : void 0
|
|
256
256
|
};
|
|
257
257
|
}
|
|
258
258
|
function V(e) {
|
|
259
259
|
return W(e);
|
|
260
260
|
}
|
|
261
|
-
function W(e,
|
|
261
|
+
function W(e, t) {
|
|
262
262
|
return e == null ? e : {
|
|
263
263
|
nitro: n(e, "nitro") ? G(e.nitro) : void 0,
|
|
264
264
|
pages: n(e, "pages") ? e.pages : void 0,
|
|
265
|
-
containers: n(e, "containers") ? g(e.containers,
|
|
265
|
+
containers: n(e, "containers") ? g(e.containers, M) : void 0,
|
|
266
266
|
globals: n(e, "globals") ? e.globals : void 0
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
269
|
function z(e) {
|
|
270
270
|
return H(e);
|
|
271
271
|
}
|
|
272
|
-
function H(e,
|
|
272
|
+
function H(e, t) {
|
|
273
273
|
return e == null ? e : {
|
|
274
274
|
api: n(e, "api") ? e.api : void 0,
|
|
275
275
|
image: n(e, "image") ? e.image : void 0
|
|
@@ -278,28 +278,28 @@ function H(e, i) {
|
|
|
278
278
|
function X(e) {
|
|
279
279
|
return Z(e);
|
|
280
280
|
}
|
|
281
|
-
function Z(e,
|
|
281
|
+
function Z(e, t) {
|
|
282
282
|
return e == null ? e : {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
283
|
+
_version: n(e, "_version") ? e._version : void 0,
|
|
284
|
+
entity_metric: n(e, "entity_metric") ? z(e.entity_metric) : void 0,
|
|
285
|
+
entity_unique_id: n(e, "entity_unique_id") ? e.entity_unique_id : void 0,
|
|
286
|
+
entity_id: n(e, "entity_id") ? e.entity_id : void 0,
|
|
287
|
+
entity_image: n(e, "entity_image") ? e.entity_image : void 0,
|
|
288
|
+
entity_slug: n(e, "entity_slug") ? e.entity_slug : void 0,
|
|
289
|
+
entity_teaser: n(e, "entity_teaser") ? e.entity_teaser : void 0,
|
|
290
|
+
entity_time_end: n(e, "entity_time_end") ? e.entity_time_end : void 0,
|
|
291
|
+
entity_time_start: n(e, "entity_time_start") ? e.entity_time_start : void 0,
|
|
292
|
+
entity_title: n(e, "entity_title") ? e.entity_title : void 0,
|
|
293
|
+
entity_type: n(e, "entity_type") ? e.entity_type : void 0,
|
|
294
|
+
entity_type_id: n(e, "entity_type_id") ? e.entity_type_id : void 0,
|
|
295
|
+
updated_at: n(e, "updated_at") ? e.updated_at : void 0,
|
|
296
296
|
routes: n(e, "routes") ? e.routes : void 0
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
299
|
function m(e) {
|
|
300
300
|
return Q(e);
|
|
301
301
|
}
|
|
302
|
-
function Q(e,
|
|
302
|
+
function Q(e, t) {
|
|
303
303
|
return e == null ? e : {
|
|
304
304
|
entity: n(e, "entity") ? X(e.entity) : void 0,
|
|
305
305
|
model: n(e, "model") ? e.model : void 0,
|
|
@@ -307,36 +307,36 @@ function Q(e, i) {
|
|
|
307
307
|
jsonld: n(e, "jsonld") ? e.jsonld : void 0
|
|
308
308
|
};
|
|
309
309
|
}
|
|
310
|
-
function
|
|
310
|
+
function S(e) {
|
|
311
311
|
return Y(e);
|
|
312
312
|
}
|
|
313
|
-
function Y(e,
|
|
313
|
+
function Y(e, t) {
|
|
314
314
|
return e == null ? e : {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
315
|
+
entity_unique_id: n(e, "entity_unique_id") ? e.entity_unique_id : void 0,
|
|
316
|
+
entity_title: n(e, "entity_title") ? e.entity_title : void 0,
|
|
317
|
+
entity_teaser: n(e, "entity_teaser") ? e.entity_teaser : void 0,
|
|
318
|
+
entity_slug: n(e, "entity_slug") ? e.entity_slug : void 0,
|
|
319
|
+
entity_time_start: n(e, "entity_time_start") ? e.entity_time_start : void 0,
|
|
320
|
+
entity_type: n(e, "entity_type") ? e.entity_type : void 0,
|
|
321
|
+
entity_type_id: n(e, "entity_type_id") ? e.entity_type_id : void 0,
|
|
322
|
+
entity_image: n(e, "entity_image") ? e.entity_image : void 0,
|
|
323
323
|
routes: n(e, "routes") ? e.routes : void 0
|
|
324
324
|
};
|
|
325
325
|
}
|
|
326
326
|
function ee(e) {
|
|
327
|
-
return
|
|
327
|
+
return te(e);
|
|
328
328
|
}
|
|
329
|
-
function
|
|
329
|
+
function te(e, t) {
|
|
330
330
|
return e == null ? e : {
|
|
331
331
|
description: n(e, "description") ? e.description : void 0,
|
|
332
332
|
image: n(e, "image") ? e.image : void 0,
|
|
333
333
|
title: n(e, "title") ? e.title : void 0
|
|
334
334
|
};
|
|
335
335
|
}
|
|
336
|
-
function
|
|
336
|
+
function ie(e) {
|
|
337
337
|
return ne(e);
|
|
338
338
|
}
|
|
339
|
-
function ne(e,
|
|
339
|
+
function ne(e, t) {
|
|
340
340
|
return e == null ? e : {
|
|
341
341
|
slug: n(e, "slug") ? e.slug : void 0,
|
|
342
342
|
title: n(e, "title") ? e.title : void 0
|
|
@@ -345,7 +345,7 @@ function ne(e, i) {
|
|
|
345
345
|
function oe(e) {
|
|
346
346
|
return re(e);
|
|
347
347
|
}
|
|
348
|
-
function re(e,
|
|
348
|
+
function re(e, t) {
|
|
349
349
|
return e == null ? e : {
|
|
350
350
|
value: n(e, "value") ? e.value : void 0,
|
|
351
351
|
navigation: n(e, "navigation") ? e.navigation : void 0,
|
|
@@ -355,34 +355,34 @@ function re(e, i) {
|
|
|
355
355
|
function w(e) {
|
|
356
356
|
return ae(e);
|
|
357
357
|
}
|
|
358
|
-
function ae(e,
|
|
358
|
+
function ae(e, t) {
|
|
359
359
|
return e == null ? e : {
|
|
360
360
|
id: n(e, "id") ? e.id : void 0,
|
|
361
361
|
title: n(e, "title") ? e.title : void 0,
|
|
362
362
|
href: n(e, "href") ? e.href : void 0,
|
|
363
363
|
slug: n(e, "slug") ? e.slug : void 0,
|
|
364
|
-
json: n(e, "json") ? e.json.map(
|
|
364
|
+
json: n(e, "json") ? e.json.map(A) : void 0,
|
|
365
365
|
depth: n(e, "depth") ? e.depth : void 0,
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
366
|
+
is_home: n(e, "is_home") ? e.is_home : void 0,
|
|
367
|
+
created_at: n(e, "created_at") ? e.created_at : void 0,
|
|
368
|
+
updated_at: n(e, "updated_at") ? e.updated_at : void 0,
|
|
369
|
+
is_visible: n(e, "is_visible") ? e.is_visible : void 0,
|
|
370
|
+
meta_json: n(e, "meta_json") ? ee(e.meta_json) : void 0,
|
|
371
371
|
properties: n(e, "properties") ? g(e.properties, oe) : void 0,
|
|
372
372
|
uid: n(e, "uid") ? e.uid : void 0,
|
|
373
373
|
type: n(e, "type") ? e.type : void 0,
|
|
374
374
|
target: n(e, "target") ? e.target : void 0,
|
|
375
375
|
container: n(e, "container") ? e.container : void 0,
|
|
376
|
-
breadcrumb: n(e, "breadcrumb") ? e.breadcrumb.map(
|
|
376
|
+
breadcrumb: n(e, "breadcrumb") ? e.breadcrumb.map(ie) : void 0
|
|
377
377
|
};
|
|
378
378
|
}
|
|
379
379
|
function se(e) {
|
|
380
380
|
return ue(e);
|
|
381
381
|
}
|
|
382
|
-
function ue(e,
|
|
382
|
+
function ue(e, t) {
|
|
383
383
|
return e == null ? e : {
|
|
384
384
|
version: n(e, "version") ? e.version : void 0,
|
|
385
|
-
|
|
385
|
+
updated_at: n(e, "updated_at") ? e.updated_at : void 0
|
|
386
386
|
};
|
|
387
387
|
}
|
|
388
388
|
class ce extends f {
|
|
@@ -390,23 +390,23 @@ class ce extends f {
|
|
|
390
390
|
* The config API endpoint provides comprehensive information required for configuring the layout of websites. It encompasses various essential elements, including containers with pages, an extensive list of available slugs, globals containing content pool data, and crucial details about the Nitro configuration itself. By accessing this endpoint, developers can gather all the necessary data to effectively design and structure their websites. The endpoint offers a holistic view of the website\'s layout, empowering developers to tailor the user experience and optimize the overall design.
|
|
391
391
|
* Get Config
|
|
392
392
|
*/
|
|
393
|
-
async configRaw(
|
|
394
|
-
const
|
|
395
|
-
this.configuration && this.configuration.apiKey && (
|
|
393
|
+
async configRaw(t) {
|
|
394
|
+
const i = {}, r = {};
|
|
395
|
+
this.configuration && this.configuration.apiKey && (i.token = this.configuration.apiKey("token"));
|
|
396
396
|
const a = await this.request({
|
|
397
397
|
path: "/config",
|
|
398
398
|
method: "GET",
|
|
399
399
|
headers: r,
|
|
400
|
-
query:
|
|
401
|
-
},
|
|
400
|
+
query: i
|
|
401
|
+
}, t);
|
|
402
402
|
return new l(a, (o) => V(o));
|
|
403
403
|
}
|
|
404
404
|
/**
|
|
405
405
|
* The config API endpoint provides comprehensive information required for configuring the layout of websites. It encompasses various essential elements, including containers with pages, an extensive list of available slugs, globals containing content pool data, and crucial details about the Nitro configuration itself. By accessing this endpoint, developers can gather all the necessary data to effectively design and structure their websites. The endpoint offers a holistic view of the website\'s layout, empowering developers to tailor the user experience and optimize the overall design.
|
|
406
406
|
* Get Config
|
|
407
407
|
*/
|
|
408
|
-
async config(
|
|
409
|
-
return await (await this.configRaw(
|
|
408
|
+
async config(t) {
|
|
409
|
+
return await (await this.configRaw(t)).value();
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
412
|
class de extends f {
|
|
@@ -414,51 +414,51 @@ class de extends f {
|
|
|
414
414
|
*
|
|
415
415
|
* Find entity by slug and optional Type-ID
|
|
416
416
|
*/
|
|
417
|
-
async entityBySlugRaw(
|
|
418
|
-
if (
|
|
417
|
+
async entityBySlugRaw(t, i) {
|
|
418
|
+
if (t.slug === null || t.slug === void 0)
|
|
419
419
|
throw new y("slug", "Required parameter requestParameters.slug was null or undefined when calling entityBySlug.");
|
|
420
420
|
const r = {};
|
|
421
|
-
|
|
421
|
+
t.typeId !== void 0 && (r.typeId = t.typeId);
|
|
422
422
|
const a = {};
|
|
423
423
|
this.configuration && this.configuration.apiKey && (r.token = this.configuration.apiKey("token"));
|
|
424
424
|
const o = await this.request({
|
|
425
|
-
path: "/entities/slug/{slug}".replace("{slug}", encodeURIComponent(String(
|
|
425
|
+
path: "/entities/slug/{slug}".replace("{slug}", encodeURIComponent(String(t.slug))),
|
|
426
426
|
method: "GET",
|
|
427
427
|
headers: a,
|
|
428
428
|
query: r
|
|
429
|
-
},
|
|
429
|
+
}, i);
|
|
430
430
|
return new l(o, (s) => m(s));
|
|
431
431
|
}
|
|
432
432
|
/**
|
|
433
433
|
*
|
|
434
434
|
* Find entity by slug and optional Type-ID
|
|
435
435
|
*/
|
|
436
|
-
async entityBySlug(
|
|
437
|
-
return await (await this.entityBySlugRaw(
|
|
436
|
+
async entityBySlug(t, i) {
|
|
437
|
+
return await (await this.entityBySlugRaw(t, i)).value();
|
|
438
438
|
}
|
|
439
439
|
/**
|
|
440
440
|
* The endpoint provides comprehensive information about a specified entity. An entity represents a collection of information pertaining to a specific data type and is defined by a key-value pair. You can use various data types such as blogs, events, or any other relevant data. However, in order to access an entity, it must be properly configured within the nitro config.
|
|
441
441
|
* Find entity by uniqueid
|
|
442
442
|
*/
|
|
443
|
-
async entityByUniqueidRaw(
|
|
444
|
-
if (
|
|
443
|
+
async entityByUniqueidRaw(t, i) {
|
|
444
|
+
if (t.uniqueid === null || t.uniqueid === void 0)
|
|
445
445
|
throw new y("uniqueid", "Required parameter requestParameters.uniqueid was null or undefined when calling entityByUniqueid.");
|
|
446
446
|
const r = {}, a = {};
|
|
447
447
|
this.configuration && this.configuration.apiKey && (r.token = this.configuration.apiKey("token"));
|
|
448
448
|
const o = await this.request({
|
|
449
|
-
path: "/entities/uniqueid/{uniqueid}".replace("{uniqueid}", encodeURIComponent(String(
|
|
449
|
+
path: "/entities/uniqueid/{uniqueid}".replace("{uniqueid}", encodeURIComponent(String(t.uniqueid))),
|
|
450
450
|
method: "GET",
|
|
451
451
|
headers: a,
|
|
452
452
|
query: r
|
|
453
|
-
},
|
|
453
|
+
}, i);
|
|
454
454
|
return new l(o, (s) => m(s));
|
|
455
455
|
}
|
|
456
456
|
/**
|
|
457
457
|
* The endpoint provides comprehensive information about a specified entity. An entity represents a collection of information pertaining to a specific data type and is defined by a key-value pair. You can use various data types such as blogs, events, or any other relevant data. However, in order to access an entity, it must be properly configured within the nitro config.
|
|
458
458
|
* Find entity by uniqueid
|
|
459
459
|
*/
|
|
460
|
-
async entityByUniqueid(
|
|
461
|
-
return await (await this.entityByUniqueidRaw(
|
|
460
|
+
async entityByUniqueid(t, i) {
|
|
461
|
+
return await (await this.entityByUniqueidRaw(t, i)).value();
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
464
|
class le extends f {
|
|
@@ -466,31 +466,31 @@ class le extends f {
|
|
|
466
466
|
* This endpoint allows you to retrieve the designated homepage of a website. Alternatively, you can utilize the pages endpoint by specifying an empty slug parameter to achieve the same result. By using either of these methods, you can effectively access the desired homepage of the website.
|
|
467
467
|
* Get Home
|
|
468
468
|
*/
|
|
469
|
-
async homeRaw(
|
|
470
|
-
const
|
|
471
|
-
this.configuration && this.configuration.apiKey && (
|
|
469
|
+
async homeRaw(t) {
|
|
470
|
+
const i = {}, r = {};
|
|
471
|
+
this.configuration && this.configuration.apiKey && (i.token = this.configuration.apiKey("token"));
|
|
472
472
|
const a = await this.request({
|
|
473
473
|
path: "/pages/home",
|
|
474
474
|
method: "GET",
|
|
475
475
|
headers: r,
|
|
476
|
-
query:
|
|
477
|
-
},
|
|
476
|
+
query: i
|
|
477
|
+
}, t);
|
|
478
478
|
return new l(a, (o) => w(o));
|
|
479
479
|
}
|
|
480
480
|
/**
|
|
481
481
|
* This endpoint allows you to retrieve the designated homepage of a website. Alternatively, you can utilize the pages endpoint by specifying an empty slug parameter to achieve the same result. By using either of these methods, you can effectively access the desired homepage of the website.
|
|
482
482
|
* Get Home
|
|
483
483
|
*/
|
|
484
|
-
async home(
|
|
485
|
-
return await (await this.homeRaw(
|
|
484
|
+
async home(t) {
|
|
485
|
+
return await (await this.homeRaw(t)).value();
|
|
486
486
|
}
|
|
487
487
|
/**
|
|
488
488
|
* This endpoint retrieves comprehensive information from a specified page using either a slug or a path. The slug refers to a unique identifier for the page, while the path is the slug with a leading slash. By providing either the slug or the path as input, the function will gather all the relevant details associated with the page.
|
|
489
489
|
* Get Page by slug
|
|
490
490
|
*/
|
|
491
|
-
async pageRaw(
|
|
491
|
+
async pageRaw(t, i) {
|
|
492
492
|
const r = {};
|
|
493
|
-
|
|
493
|
+
t.slug !== void 0 && (r.slug = t.slug);
|
|
494
494
|
const a = {};
|
|
495
495
|
this.configuration && this.configuration.apiKey && (r.token = this.configuration.apiKey("token"));
|
|
496
496
|
const o = await this.request({
|
|
@@ -498,15 +498,15 @@ class le extends f {
|
|
|
498
498
|
method: "GET",
|
|
499
499
|
headers: a,
|
|
500
500
|
query: r
|
|
501
|
-
},
|
|
501
|
+
}, i);
|
|
502
502
|
return new l(o, (s) => w(s));
|
|
503
503
|
}
|
|
504
504
|
/**
|
|
505
505
|
* This endpoint retrieves comprehensive information from a specified page using either a slug or a path. The slug refers to a unique identifier for the page, while the path is the slug with a leading slash. By providing either the slug or the path as input, the function will gather all the relevant details associated with the page.
|
|
506
506
|
* Get Page by slug
|
|
507
507
|
*/
|
|
508
|
-
async page(
|
|
509
|
-
return await (await this.pageRaw(
|
|
508
|
+
async page(t = {}, i) {
|
|
509
|
+
return await (await this.pageRaw(t, i)).value();
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
512
|
class fe extends f {
|
|
@@ -514,11 +514,11 @@ class fe extends f {
|
|
|
514
514
|
* This endpoint offers a powerful capability to search through the websites sitemap, encompassing both pages and entities. With this endpoint, users can efficiently explore and retrieve information from your sitemap by creating a paginated search experience.
|
|
515
515
|
* Get Search by query
|
|
516
516
|
*/
|
|
517
|
-
async searchRaw(
|
|
518
|
-
if (
|
|
517
|
+
async searchRaw(t, i) {
|
|
518
|
+
if (t.query === null || t.query === void 0)
|
|
519
519
|
throw new y("query", "Required parameter requestParameters.query was null or undefined when calling search.");
|
|
520
520
|
const r = {};
|
|
521
|
-
|
|
521
|
+
t.query !== void 0 && (r.query = t.query);
|
|
522
522
|
const a = {};
|
|
523
523
|
this.configuration && this.configuration.apiKey && (r.token = this.configuration.apiKey("token"));
|
|
524
524
|
const o = await this.request({
|
|
@@ -526,15 +526,15 @@ class fe extends f {
|
|
|
526
526
|
method: "GET",
|
|
527
527
|
headers: a,
|
|
528
528
|
query: r
|
|
529
|
-
},
|
|
530
|
-
return new l(o, (s) => s.map(
|
|
529
|
+
}, i);
|
|
530
|
+
return new l(o, (s) => s.map(S));
|
|
531
531
|
}
|
|
532
532
|
/**
|
|
533
533
|
* This endpoint offers a powerful capability to search through the websites sitemap, encompassing both pages and entities. With this endpoint, users can efficiently explore and retrieve information from your sitemap by creating a paginated search experience.
|
|
534
534
|
* Get Search by query
|
|
535
535
|
*/
|
|
536
|
-
async search(
|
|
537
|
-
return await (await this.searchRaw(
|
|
536
|
+
async search(t, i) {
|
|
537
|
+
return await (await this.searchRaw(t, i)).value();
|
|
538
538
|
}
|
|
539
539
|
}
|
|
540
540
|
class pe extends f {
|
|
@@ -542,23 +542,23 @@ class pe extends f {
|
|
|
542
542
|
* This endpoint provides comprehensive data for generating the sitemap. It encompasses all the necessary information, including pages from containers, as well as all entities that have been mapped.
|
|
543
543
|
* Get Sitemap
|
|
544
544
|
*/
|
|
545
|
-
async sitemapRaw(
|
|
546
|
-
const
|
|
547
|
-
this.configuration && this.configuration.apiKey && (
|
|
545
|
+
async sitemapRaw(t) {
|
|
546
|
+
const i = {}, r = {};
|
|
547
|
+
this.configuration && this.configuration.apiKey && (i.token = this.configuration.apiKey("token"));
|
|
548
548
|
const a = await this.request({
|
|
549
549
|
path: "/sitemap",
|
|
550
550
|
method: "GET",
|
|
551
551
|
headers: r,
|
|
552
|
-
query:
|
|
553
|
-
},
|
|
554
|
-
return new l(a, (o) => o.map(
|
|
552
|
+
query: i
|
|
553
|
+
}, t);
|
|
554
|
+
return new l(a, (o) => o.map(S));
|
|
555
555
|
}
|
|
556
556
|
/**
|
|
557
557
|
* This endpoint provides comprehensive data for generating the sitemap. It encompasses all the necessary information, including pages from containers, as well as all entities that have been mapped.
|
|
558
558
|
* Get Sitemap
|
|
559
559
|
*/
|
|
560
|
-
async sitemap(
|
|
561
|
-
return await (await this.sitemapRaw(
|
|
560
|
+
async sitemap(t) {
|
|
561
|
+
return await (await this.sitemapRaw(t)).value();
|
|
562
562
|
}
|
|
563
563
|
}
|
|
564
564
|
class he extends f {
|
|
@@ -566,46 +566,46 @@ class he extends f {
|
|
|
566
566
|
* The Version API endpoint offers a highly efficient solution for evaluating the current caching status of your application\'s caching mechanism. This functionality allows you to cache the entire application configuration and page responses indefinitely. However, utilizing this endpoint enables you to assess the validity of the cache by sending a request to determine its current status. This caching endpoint is specifically designed for optimal performance when compared to the configuration endpoint, which requires more thorough evaluation and encompasses a substantial response body.
|
|
567
567
|
* Get Version Information
|
|
568
568
|
*/
|
|
569
|
-
async versionRaw(
|
|
570
|
-
const
|
|
571
|
-
this.configuration && this.configuration.apiKey && (
|
|
569
|
+
async versionRaw(t) {
|
|
570
|
+
const i = {}, r = {};
|
|
571
|
+
this.configuration && this.configuration.apiKey && (i.token = this.configuration.apiKey("token"));
|
|
572
572
|
const a = await this.request({
|
|
573
573
|
path: "/version",
|
|
574
574
|
method: "GET",
|
|
575
575
|
headers: r,
|
|
576
|
-
query:
|
|
577
|
-
},
|
|
576
|
+
query: i
|
|
577
|
+
}, t);
|
|
578
578
|
return new l(a, (o) => se(o));
|
|
579
579
|
}
|
|
580
580
|
/**
|
|
581
581
|
* The Version API endpoint offers a highly efficient solution for evaluating the current caching status of your application\'s caching mechanism. This functionality allows you to cache the entire application configuration and page responses indefinitely. However, utilizing this endpoint enables you to assess the validity of the cache by sending a request to determine its current status. This caching endpoint is specifically designed for optimal performance when compared to the configuration endpoint, which requires more thorough evaluation and encompasses a substantial response body.
|
|
582
582
|
* Get Version Information
|
|
583
583
|
*/
|
|
584
|
-
async version(
|
|
585
|
-
return await (await this.versionRaw(
|
|
584
|
+
async version(t) {
|
|
585
|
+
return await (await this.versionRaw(t)).value();
|
|
586
586
|
}
|
|
587
587
|
}
|
|
588
|
-
const ye = /[\p{Lu}]/u, ge = /[\p{Ll}]/u, _ = /^[\p{Lu}](?![\p{Lu}])/gu,
|
|
588
|
+
const ye = /[\p{Lu}]/u, ge = /[\p{Ll}]/u, _ = /^[\p{Lu}](?![\p{Lu}])/gu, T = /([\p{Alpha}\p{N}_]|$)/u, v = /[_.\- ]+/, ve = new RegExp("^" + v.source), q = new RegExp(v.source + T.source, "gu"), R = new RegExp("\\d+" + T.source, "gu"), me = (e, t, i, r) => {
|
|
589
589
|
let a = !1, o = !1, s = !1, u = !1;
|
|
590
590
|
for (let c = 0; c < e.length; c++) {
|
|
591
591
|
const d = e[c];
|
|
592
|
-
u = c > 2 ? e[c - 3] === "-" : !0, a && ye.test(d) ? (e = e.slice(0, c) + "-" + e.slice(c), a = !1, s = o, o = !0, c++) : o && s && ge.test(d) && (!u || r) ? (e = e.slice(0, c - 1) + "-" + e.slice(c - 1), s = o, o = !1, a = !0) : (a =
|
|
592
|
+
u = c > 2 ? e[c - 3] === "-" : !0, a && ye.test(d) ? (e = e.slice(0, c) + "-" + e.slice(c), a = !1, s = o, o = !0, c++) : o && s && ge.test(d) && (!u || r) ? (e = e.slice(0, c - 1) + "-" + e.slice(c - 1), s = o, o = !1, a = !0) : (a = t(d) === d && i(d) !== d, s = o, o = i(d) === d && t(d) !== d);
|
|
593
593
|
}
|
|
594
594
|
return e;
|
|
595
|
-
}, we = (e,
|
|
596
|
-
function qe(e,
|
|
595
|
+
}, we = (e, t) => (_.lastIndex = 0, e.replace(_, (i) => t(i))), _e = (e, t) => (q.lastIndex = 0, R.lastIndex = 0, e.replace(q, (i, r) => t(r)).replace(R, (i) => t(i)));
|
|
596
|
+
function qe(e, t) {
|
|
597
597
|
if (!(typeof e == "string" || Array.isArray(e)))
|
|
598
598
|
throw new TypeError("Expected the input to be `string | string[]`");
|
|
599
|
-
if (
|
|
599
|
+
if (t = {
|
|
600
600
|
pascalCase: !1,
|
|
601
601
|
preserveConsecutiveUppercase: !1,
|
|
602
|
-
...
|
|
602
|
+
...t
|
|
603
603
|
}, Array.isArray(e) ? e = e.map((o) => o.trim()).filter((o) => o.length).join("-") : e = e.trim(), e.length === 0)
|
|
604
604
|
return "";
|
|
605
|
-
const
|
|
606
|
-
return e.length === 1 ? v.test(e) ? "" :
|
|
605
|
+
const i = t.locale === !1 ? (o) => o.toLowerCase() : (o) => o.toLocaleLowerCase(t.locale), r = t.locale === !1 ? (o) => o.toUpperCase() : (o) => o.toLocaleUpperCase(t.locale);
|
|
606
|
+
return e.length === 1 ? v.test(e) ? "" : t.pascalCase ? r(e) : i(e) : (e !== i(e) && (e = me(e, i, r, t.preserveConsecutiveUppercase)), e = e.replace(ve, ""), e = t.preserveConsecutiveUppercase ? we(e, i) : i(e), t.pascalCase && (e = r(e.charAt(0)) + e.slice(1)), _e(e, r));
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function Re(e, t, i) {
|
|
609
609
|
const r = "virtual:flyo-components", a = "\0" + r;
|
|
610
610
|
return {
|
|
611
611
|
name: "vite-plugin-flyo-components",
|
|
@@ -616,15 +616,15 @@ function be(e, i, t) {
|
|
|
616
616
|
async load(o) {
|
|
617
617
|
if (o === a) {
|
|
618
618
|
const s = [];
|
|
619
|
-
for (const [c, d] of Object.entries(
|
|
619
|
+
for (const [c, d] of Object.entries(t)) {
|
|
620
620
|
const h = await this.resolve(
|
|
621
621
|
"/" + e + "/" + d + ".astro"
|
|
622
622
|
);
|
|
623
623
|
h && s.push(`export { default as ${qe(c)} } from "${h.id}"`);
|
|
624
624
|
}
|
|
625
625
|
let u = null;
|
|
626
|
-
return
|
|
627
|
-
"/" + e + "/" +
|
|
626
|
+
return i && (u = await this.resolve(
|
|
627
|
+
"/" + e + "/" + i + ".astro"
|
|
628
628
|
)), u ? s.push(`export { default as fallback } from "${u.id}"`) : s.push('export { default as fallback } from "@flyo/nitro-astro/FallbackComponent.astro"'), s.join(";");
|
|
629
629
|
}
|
|
630
630
|
}
|
|
@@ -633,26 +633,26 @@ function be(e, i, t) {
|
|
|
633
633
|
function p() {
|
|
634
634
|
return globalThis.flyoNitroInstance || console.error("The Flyo Typescript Configuration has not been initialized correctly"), globalThis.flyoNitroInstance;
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function be() {
|
|
637
637
|
return new ce(p());
|
|
638
638
|
}
|
|
639
639
|
function Ee() {
|
|
640
640
|
return new de(p());
|
|
641
641
|
}
|
|
642
|
-
function
|
|
642
|
+
function Ce() {
|
|
643
643
|
return new le(p());
|
|
644
644
|
}
|
|
645
|
-
function
|
|
645
|
+
function Ie() {
|
|
646
646
|
return new fe(p());
|
|
647
647
|
}
|
|
648
|
-
function
|
|
648
|
+
function Ae() {
|
|
649
649
|
return new pe(p());
|
|
650
650
|
}
|
|
651
|
-
function
|
|
651
|
+
function ke() {
|
|
652
652
|
return new he(p());
|
|
653
653
|
}
|
|
654
|
-
function
|
|
655
|
-
const
|
|
654
|
+
function Se(e) {
|
|
655
|
+
const t = {
|
|
656
656
|
accessToken: !1,
|
|
657
657
|
liveEdit: !1,
|
|
658
658
|
fallbackComponent: null,
|
|
@@ -661,29 +661,29 @@ function ke(e) {
|
|
|
661
661
|
return {
|
|
662
662
|
name: "@flyo/nitro-astro",
|
|
663
663
|
hooks: {
|
|
664
|
-
"astro:config:setup": ({ injectScript:
|
|
664
|
+
"astro:config:setup": ({ injectScript: i, updateConfig: r }) => {
|
|
665
665
|
r({
|
|
666
666
|
vite: {
|
|
667
667
|
plugins: [
|
|
668
|
-
|
|
668
|
+
Re(
|
|
669
669
|
e.componentsDir,
|
|
670
670
|
e.components,
|
|
671
671
|
e.fallbackComponent
|
|
672
672
|
)
|
|
673
673
|
]
|
|
674
674
|
}
|
|
675
|
-
}),
|
|
675
|
+
}), i(
|
|
676
676
|
"page-ssr",
|
|
677
677
|
`
|
|
678
678
|
import { Configuration } from '@flyo/nitro-typescript'
|
|
679
679
|
|
|
680
680
|
var defaultConfig = new Configuration({
|
|
681
|
-
apiKey: '${
|
|
681
|
+
apiKey: '${t.accessToken}'
|
|
682
682
|
})
|
|
683
683
|
|
|
684
684
|
globalThis.flyoNitroInstance = defaultConfig;
|
|
685
685
|
`
|
|
686
|
-
),
|
|
686
|
+
), t.liveEdit && i(
|
|
687
687
|
"page",
|
|
688
688
|
`
|
|
689
689
|
window.addEventListener("message", (event) => {
|
|
@@ -714,12 +714,12 @@ function ke(e) {
|
|
|
714
714
|
};
|
|
715
715
|
}
|
|
716
716
|
export {
|
|
717
|
-
|
|
718
|
-
|
|
717
|
+
Se as default,
|
|
718
|
+
be as useConfigApi,
|
|
719
719
|
p as useConfiguration,
|
|
720
720
|
Ee as useEntitiesApi,
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
721
|
+
Ce as usePagesApi,
|
|
722
|
+
Ie as useSearchApi,
|
|
723
|
+
Ae as useSitemapApi,
|
|
724
|
+
ke as useVersionApi
|
|
725
725
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flyo/nitro-astro",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"description": "Astro Framework",
|
|
5
5
|
"main": "./dist/nitro-astro.js",
|
|
6
6
|
"module": "./dist/nitro-astro.mjs",
|
|
@@ -49,6 +49,6 @@
|
|
|
49
49
|
"url": "https://github.com/flyocloud/nitro-astro"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@flyo/nitro-typescript": "^1.0.
|
|
52
|
+
"@flyo/nitro-typescript": "^1.0.7"
|
|
53
53
|
}
|
|
54
54
|
}
|