@meta-cms/core
Advanced tools
Comparing version 1.0.14 to 1.0.15
@@ -291,3 +291,3 @@ import { Get } from 'type-fest'; | ||
itemType: T; | ||
itemScope: string; | ||
itemProp: string; | ||
}; | ||
@@ -294,0 +294,0 @@ |
@@ -1,2 +0,2 @@ | ||
"use strict";var F=Object.create;var p=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var P=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty;var k=(n,t)=>{for(var r in t)p(n,r,{get:t[r],enumerable:!0})},S=(n,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of _(t))!T.call(n,s)&&s!==r&&p(n,s,{get:()=>t[s],enumerable:!(o=x(t,s))||o.enumerable});return n};var v=(n,t,r)=>(r=n!=null?F(P(n)):{},S(t||!n||!n.__esModule?p(r,"default",{value:n,enumerable:!0}):r,n)),b=n=>S(p({},"__esModule",{value:!0}),n);var w={};k(w,{MetaCms:()=>g,config:()=>O,contentQuery:()=>u,getMetaCMSConfigQuery:()=>N,getOwnerIdQuery:()=>m,setMetaCMSConfigMutation:()=>f,syncConfig:()=>$});module.exports=b(w);var C=require("graphql-request");var f=` | ||
"use strict";var F=Object.create;var p=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var _=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty;var k=(n,t)=>{for(var s in t)p(n,s,{get:t[s],enumerable:!0})},S=(n,t,s,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of P(t))!T.call(n,r)&&r!==s&&p(n,r,{get:()=>t[r],enumerable:!(o=x(t,r))||o.enumerable});return n};var v=(n,t,s)=>(s=n!=null?F(_(n)):{},S(t||!n||!n.__esModule?p(s,"default",{value:n,enumerable:!0}):s,n)),b=n=>S(p({},"__esModule",{value:!0}),n);var w={};k(w,{MetaCms:()=>g,config:()=>O,contentQuery:()=>u,getMetaCMSConfigQuery:()=>N,getOwnerIdQuery:()=>m,setMetaCMSConfigMutation:()=>f,syncConfig:()=>$});module.exports=b(w);var C=require("graphql-request");var f=` | ||
mutation ($ownerId: ID!, $value: String!) { | ||
@@ -160,2 +160,2 @@ metafieldsSet( | ||
} | ||
`;var I=v(require("just-safe-get")),g=class{constructor(t,{storefrontName:r,storefrontAccessToken:o,defaultNameSpaces:s}){this.getContentForNamespaces=async(t,r="fra")=>{let{shop:{content:o}}=await this.client.request(u,{identifiers:this.buildIdentifiers(t.concat(this.defaultNameSpaces),r)});return console.log({content:o}),o.reduce((s,e)=>{if(!e)return s;let a=e.namespace.replace(`_${r}`,"");s[a]||Object.assign(s,{[a]:{}});let c={itemID:e.id,itemType:e.type,itemScope:`${e.namespace}:${e.key}`},i;switch(e.type){case"collection_reference":{i={attributes:c,collection:{...e.collection,products:l(e.collection.products)}};break}case"file_reference":{i={attributes:c,image:e.image.image};break}case"product_reference":{i={attributes:c,product:{...e.product,variants:l(e.product.variants)}};break}case"list.collection_reference":{i={attributes:c,collections:l(e.values).map(d=>({...d,products:l(d.products)}))};break}case"list.file_reference":{i={attributes:c,images:l(e.values).map(d=>d.image)};break}case"list.product_reference":{i={attributes:c,items:l(e.values).map(d=>({...d,variants:l(d.variants)}))};break}case"list.multi_line_text_field":case"list.single_line_text_field":{i={attributes:c,texts:JSON.parse(e.value)};break}case"multi_line_text_field":case"single_line_text_field":{i={attributes:c,text:e.value};break}}return Object.assign(s[a],{[e.key]:i}),s},{})};this.t=(t,r="fr",o)=>{let[s,...e]=t.split("."),a=()=>(0,I.default)(this.config[s],e).default;return o&&o[s][e.join(".")]||a()};this.buildIdentifiers=(t,r="fra")=>t.reduce((s,e)=>{let a=this.config[e];return Object.entries(a).reduce((i,[d,y])=>(y.config?Object.keys(y.config).forEach(M=>{i.push(`${d}.${M}`)}):i.push(d),i),[]).forEach(i=>{s.push({namespace:`${e}_${r}`,key:i})}),s},[]);this.config=t,this.defaultNameSpaces=s||[],this.client=new C.GraphQLClient(`https://${r}.myshopify.com/api/2022-10/graphql.json`,{headers:{"X-SHOPIFY-STOREFRONT-ACCESS-TOKEN":o}})}},l=n=>n.edges.reduce((t,{node:r})=>(t.push(r),t),[]),O=n=>n;var h=require("graphql-request");var $=async(n,{storefrontName:t,storefrontAccessToken:r,adminAccessToken:o})=>{let s=new h.GraphQLClient(`https://${t}.myshopify.com/api/2022-10/graphql.json`,{headers:{"X-SHOPIFY-STOREFRONT-ACCESS-TOKEN":r}}),e=new h.GraphQLClient(`https://${t}.myshopify.com/admin/api/2022-10/graphql.json`,{headers:{"X-Shopify-Access-Token":o}}),{shop:{id:a}}=await s.request(m);return await e.request(f,{value:JSON.stringify(n),ownerId:a})};0&&(module.exports={MetaCms,config,contentQuery,getMetaCMSConfigQuery,getOwnerIdQuery,setMetaCMSConfigMutation,syncConfig}); | ||
`;var I=v(require("just-safe-get")),g=class{constructor(t,{storefrontName:s,storefrontAccessToken:o,defaultNameSpaces:r}){this.getContentForNamespaces=async(t,s="fra")=>{let{shop:{content:o}}=await this.client.request(u,{identifiers:this.buildIdentifiers(t.concat(this.defaultNameSpaces),s)});return console.log({content:o}),o.reduce((r,e)=>{if(!e)return r;let a=e.namespace.replace(`_${s}`,"");r[a]||Object.assign(r,{[a]:{}});let c={itemID:e.id,itemType:e.type,itemProp:`${e.namespace}:${e.key}`},i;switch(e.type){case"collection_reference":{i={attributes:c,collection:{...e.collection,products:l(e.collection.products)}};break}case"file_reference":{i={attributes:c,image:e.image.image};break}case"product_reference":{i={attributes:c,product:{...e.product,variants:l(e.product.variants)}};break}case"list.collection_reference":{i={attributes:c,collections:l(e.values).map(d=>({...d,products:l(d.products)}))};break}case"list.file_reference":{i={attributes:c,images:l(e.values).map(d=>d.image)};break}case"list.product_reference":{i={attributes:c,items:l(e.values).map(d=>({...d,variants:l(d.variants)}))};break}case"list.multi_line_text_field":case"list.single_line_text_field":{i={attributes:c,texts:JSON.parse(e.value)};break}case"multi_line_text_field":case"single_line_text_field":{i={attributes:c,text:e.value};break}}return Object.assign(r[a],{[e.key]:i}),r},{})};this.t=(t,s="fr",o)=>{let[r,...e]=t.split("."),a=()=>(0,I.default)(this.config[r],e).default;return o&&o[r][e.join(".")]||a()};this.buildIdentifiers=(t,s="fra")=>t.reduce((r,e)=>{let a=this.config[e];return Object.entries(a).reduce((i,[d,y])=>(y.config?Object.keys(y.config).forEach(M=>{i.push(`${d}.${M}`)}):i.push(d),i),[]).forEach(i=>{r.push({namespace:`${e}_${s}`,key:i})}),r},[]);this.config=t,this.defaultNameSpaces=r||[],this.client=new C.GraphQLClient(`https://${s}.myshopify.com/api/2022-10/graphql.json`,{headers:{"X-SHOPIFY-STOREFRONT-ACCESS-TOKEN":o}})}},l=n=>n.edges.reduce((t,{node:s})=>(t.push(s),t),[]),O=n=>n;var h=require("graphql-request");var $=async(n,{storefrontName:t,storefrontAccessToken:s,adminAccessToken:o})=>{let r=new h.GraphQLClient(`https://${t}.myshopify.com/api/2022-10/graphql.json`,{headers:{"X-SHOPIFY-STOREFRONT-ACCESS-TOKEN":s}}),e=new h.GraphQLClient(`https://${t}.myshopify.com/admin/api/2022-10/graphql.json`,{headers:{"X-Shopify-Access-Token":o}}),{shop:{id:a}}=await r.request(m);return await e.request(f,{value:JSON.stringify(n),ownerId:a})};0&&(module.exports={MetaCms,config,contentQuery,getMetaCMSConfigQuery,getOwnerIdQuery,setMetaCMSConfigMutation,syncConfig}); |
{ | ||
"name": "@meta-cms/core", | ||
"version": "1.0.14", | ||
"version": "1.0.15", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.mjs", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26328