Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@meta-cms/core

Package Overview
Dependencies
Maintainers
2
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@meta-cms/core - npm Package Compare versions

Comparing version 1.0.33 to 1.0.34

6

index.js

@@ -1,2 +0,2 @@

"use strict";var p=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var F=(s,e)=>{for(var r in e)p(s,r,{get:e[r],enumerable:!0})},P=(s,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of x(e))!M.call(s,n)&&n!==r&&p(s,n,{get:()=>e[n],enumerable:!(i=I(e,n))||i.enumerable});return s};var T=s=>P(p({},"__esModule",{value:!0}),s);var O={};F(O,{GraphqlClient:()=>f,MetaCms:()=>y,config:()=>v,contentQuery:()=>g,getMetaCMSConfigQuery:()=>_,getOwnerIdQuery:()=>u,setMetaCMSConfigMutation:()=>m,syncConfig:()=>k});module.exports=T(O);var m=`
"use strict";var p=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var F=(s,e)=>{for(var r in e)p(s,r,{get:e[r],enumerable:!0})},P=(s,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of x(e))!M.call(s,n)&&n!==r&&p(s,n,{get:()=>e[n],enumerable:!(i=I(e,n))||i.enumerable});return s};var T=s=>P(p({},"__esModule",{value:!0}),s);var N={};F(N,{GraphqlClient:()=>f,MetaCms:()=>y,config:()=>v,contentQuery:()=>m,getMetaCMSConfigQuery:()=>_,getOwnerIdQuery:()=>u,setMetaCMSConfigMutation:()=>g,syncConfig:()=>O});module.exports=T(N);var g=`
mutation ($ownerId: ID!, $value: String!) {

@@ -24,3 +24,3 @@ metafieldsSet(metafields: [{ key: $key, namespace: "meta-cms", ownerId: $ownerId, value: $value, type: "json" }]) {

}
`;var g=`
`;var m=`
query getContentF($identifiers: [HasMetafieldsIdentifier!]!) {

@@ -157,2 +157,2 @@ shop {

}
`;function S(s,e,r){if(!s)return r;var i,n;if(Array.isArray(e)&&(i=e.slice(0)),typeof e=="string"&&(i=e.split(".")),typeof e=="symbol"&&(i=[e]),!Array.isArray(i))throw new Error("props arg must be an array, a string or a symbol");for(;i.length;)if(n=i.shift(),!s||(s=s[n],s===void 0))return r;return s}var f=class{constructor(e,r){this.request=async(e,r)=>(await(await fetch(this.url,{method:"POST",body:JSON.stringify({query:e,variables:r||{}}),headers:{...this.headers||{},"Content-Type":"application/json"}})).json()).data;this.url=e,this.headers=r}},y=class{constructor(e,{storefrontName:r,storefrontAccessToken:i,defaultNameSpaces:n}){this.getContentForNamespaces=async(e,r="fra")=>{let{shop:{content:i}}=await this.client.request(g,{identifiers:this.buildIdentifiers(e.concat(this.defaultNameSpaces),r)});return console.log({content:i}),i.reduce((n,t)=>{if(!t)return n;let c=t.namespace.replace(`_${r}`,"");n[c]||Object.assign(n,{[c]:{}});let o={itemID:t.id,itemType:t.type,itemProp:`${t.namespace}:${t.key}`},a;switch(t.type){case"collection_reference":{a={attributes:o,collection:{...t.collection,products:d(t.collection.products)}};break}case"file_reference":{t.image.image.alt||(t.image.image.alt=""),a={attributes:o,image:t.image.image};break}case"product_reference":{a={attributes:o,product:{...t.product,variants:d(t.product.variants)}};break}case"list.collection_reference":{a={attributes:o,collections:d(t.values).map(l=>({...l,products:d(l.products)}))};break}case"list.file_reference":{a={attributes:o,images:d(t.values).map(l=>l.image)};break}case"list.product_reference":{a={attributes:o,products:d(t.values).map(l=>({...l,variants:d(l.variants)}))};break}case"json":{a={attributes:o,[t.key]:JSON.parse(t.value)};break}case"list.multi_line_text_field":case"list.single_line_text_field":{a={attributes:o,texts:JSON.parse(t.value)};break}case"multi_line_text_field":case"single_line_text_field":{a={attributes:o,text:t.value};break}}return Object.assign(n[c],{[t.key]:a}),n},{})};this.t=(e,r="fr",i)=>{let[n,...t]=e.split("."),c=()=>S(this.config[n],t).default;return i&&i[n][t.join(".")]||c()};this.buildIdentifiers=(e,r="fra")=>e.reduce((n,t)=>{let c=this.config[t];return Object.entries(c).reduce((a,[l,h])=>(h.config?Object.keys(h.config).forEach(C=>{a.push(`${l}.${C}`)}):a.push(l),a),[]).forEach(a=>{n.push({namespace:`${t}_${r}`,key:a})}),n},[]);this.config=e,this.defaultNameSpaces=n||[],this.client=new f(`https://${r}.myshopify.com/api/2022-10/graphql.json`,{"X-SHOPIFY-STOREFRONT-ACCESS-TOKEN":i})}},d=s=>s.edges.reduce((e,{node:r})=>(e.push(r),e),[]),v=s=>s;var k=async(s,{storefrontName:e,storefrontAccessToken:r,adminAccessToken:i},n)=>{console.log(n);let t=new f(`https://${e}.myshopify.com/api/2022-10/graphql.json`,{"X-SHOPIFY-STOREFRONT-ACCESS-TOKEN":r}),c=new f(`https://${e}.myshopify.com/admin/api/2022-10/graphql.json`,{"X-Shopify-Access-Token":i}),{shop:{id:o}}=await t.request(u);return console.log({key:n}),await c.request(m,{value:JSON.stringify(s),key:n,ownerId:o})};0&&(module.exports={GraphqlClient,MetaCms,config,contentQuery,getMetaCMSConfigQuery,getOwnerIdQuery,setMetaCMSConfigMutation,syncConfig});
`;function S(s,e,r){if(!s)return r;var i,n;if(Array.isArray(e)&&(i=e.slice(0)),typeof e=="string"&&(i=e.split(".")),typeof e=="symbol"&&(i=[e]),!Array.isArray(i))throw new Error("props arg must be an array, a string or a symbol");for(;i.length;)if(n=i.shift(),!s||(s=s[n],s===void 0))return r;return s}var f=class{constructor(e,r){this.request=async(e,r)=>(await(await fetch(this.url,{method:"POST",body:JSON.stringify({query:e,variables:r||{}}),headers:{...this.headers||{},"Content-Type":"application/json"}})).json()).data;this.url=e,this.headers=r}},y=class{constructor(e,{storefrontName:r,storefrontAccessToken:i,defaultNameSpaces:n}){this.getContentForNamespaces=async(e,r="fra")=>{let{shop:{content:i}}=await this.client.request(m,{identifiers:this.buildIdentifiers(e.concat(this.defaultNameSpaces),r)});return console.log({content:i}),i.reduce((n,t)=>{if(!t)return n;let c=t.namespace.replace(`_${r}`,"");n[c]||Object.assign(n,{[c]:{}});let o={itemID:t.id,itemType:t.type,itemProp:`${t.namespace}:${t.key}`},a;switch(t.type){case"collection_reference":{a={attributes:o,collection:{...t.collection,products:d(t.collection.products)}};break}case"file_reference":{t.image.image.alt||(t.image.image.alt=""),a={attributes:o,image:t.image.image};break}case"product_reference":{a={attributes:o,product:{...t.product,variants:d(t.product.variants)}};break}case"list.collection_reference":{a={attributes:o,collections:d(t.values).map(l=>({...l,products:d(l.products)}))};break}case"list.file_reference":{a={attributes:o,images:d(t.values).map(l=>l.image)};break}case"list.product_reference":{a={attributes:o,products:d(t.values).map(l=>({...l,variants:d(l.variants)}))};break}case"json":{a={attributes:o,[t.key]:JSON.parse(t.value)};break}case"list.multi_line_text_field":case"list.single_line_text_field":{a={attributes:o,texts:JSON.parse(t.value)};break}case"multi_line_text_field":case"single_line_text_field":{a={attributes:o,text:t.value};break}}return Object.assign(n[c],{[t.key]:a}),n},{})};this.t=(e,r="fr",i)=>{let[n,...t]=e.split("."),c=()=>S(this.config[n],t).default;return i&&i[n][t.join(".")]||c()};this.buildIdentifiers=(e,r="fra")=>e.reduce((n,t)=>{let c=this.config[t];return Object.entries(c).reduce((a,[l,h])=>(h.config?Object.keys(h.config).forEach(C=>{a.push(`${l}.${C}`)}):a.push(l),a),[]).forEach(a=>{n.push({namespace:`${t}_${r}`,key:a})}),n},[]);this.config=e,this.defaultNameSpaces=n||[],this.client=new f(`https://${r}.myshopify.com/api/2022-10/graphql.json`,{"X-SHOPIFY-STOREFRONT-ACCESS-TOKEN":i})}},d=s=>s.edges.reduce((e,{node:r})=>(e.push(r),e),[]),v=s=>s;var O=async(s,{storefrontName:e,storefrontAccessToken:r,adminAccessToken:i},n)=>{console.log(n);let t=new f(`https://${e}.myshopify.com/api/2022-10/graphql.json`,{"X-SHOPIFY-STOREFRONT-ACCESS-TOKEN":r}),c=new f(`https://${e}.myshopify.com/admin/api/2022-10/graphql.json`,{"X-Shopify-Access-Token":i}),{shop:{id:o}}=await t.request(u);console.log({key:n,id:o}),console.log(JSON.stringify(s));let a=await c.request(g,{value:JSON.stringify(s),key:n,ownerId:o});return console.log({data:a}),console.log({key:n}),a};0&&(module.exports={GraphqlClient,MetaCms,config,contentQuery,getMetaCMSConfigQuery,getOwnerIdQuery,setMetaCMSConfigMutation,syncConfig});
{
"name": "@meta-cms/core",
"version": "1.0.33",
"version": "1.0.34",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc