You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Figure out how to transpile .gql files so card fragments can be reused
Use Webpack's node module to produce chunks to in memory filesystem and then read strings out, like in this demo
I think this work goes into @cloak-app/utils as like loadGql(path)
Add option for setting the hook to use
Add CLI interface (useful for executing while dev-ing the package)
Include docs on expectation on where fragments live and what the files are named. And how you need one of query, fragmentPath, or records
Use dotenv in cli for use in like the indexName creation
Sync Craft records
Support mergeShopifyProducts
Test syncing from demo site
Make a demo showing results
Make a helper for prefixing index name
Example configuration option API:
exportdefault{cloak: {algolia: {sync: async({ $craft, $storefront })=>{// Most Craft-only indexes can be built using configuration strings// or objectsconstsimpleRules=[// If just a string, will query Craft for entries of this section name// using a fragment from ~/queries/fragments/articles.gql. Index// configuration is done through the dashboard.'articles',// If an object, lets you customize the sync options a bit. TBD what// the options are.{indexHandle: 'blogs',section: 'blogPosts',},]// You can also generate dynamic indices, like for collectionsconstcollections=await$craft.getEntries({query: ` query { entries(section: "collections") { ...collection } } `+collectionFragment})constproductsRules=awaitPromise.all(collections.map(async(collection)=>{constcraftProducts=await$craft.getEntries({query: ` query($collection:String) { entries(section: "products",) { ...product } } `+productFragment,})return{indexHandle: `collection-${collection.slug}`,settings: {},// Algolia settings objectrecords: await$storefront.mergeProducts(craftProducts)}}))return[ ...simpleRules, ...productsRules]}}}}
The text was updated successfully, but these errors were encountered:
I think both a function and a simple array should be allowed.
MVP will just be the array mode. Both string and objects are allowed.
It should support multiple cms, each supported cms would have a different default query to fetch records.
Full object shape is like:
name (used to build other defaults from, this is what the string form is)
query (the gql query that fetches records, there's a default for each cms)
fragmentPath (path to fragment to append to default query, should be same fragment used to render entries outside of Algolia, defaults to queries/fragments/name.gql) .. gets appended to the query during unpackaing
variables (the gql variables to apply to the query)
section (sugar for variables.section, defaults to name)
indexName (specify the full index name, defaults to env_site_name)
records (not used in mvp, but would be an alternative to specifying the query, this is used instead)
This roughly refactoring algolia-sync.coffee
.gql
files so card fragments can be reused@cloak-app/utils
as likeloadGql(path)
mergeShopifyProducts
Example configuration option API:
The text was updated successfully, but these errors were encountered: