I can update a row!
This commit is contained in:
46
package-lock.json
generated
46
package-lock.json
generated
@ -10,6 +10,8 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/google-apps-script": "^1.0.85",
|
"@types/google-apps-script": "^1.0.85",
|
||||||
"gas-webpack-plugin": "^2.6.0",
|
"gas-webpack-plugin": "^2.6.0",
|
||||||
|
"graphql-tag": "^2.12.6",
|
||||||
|
"shopify-admin-api-typings": "^1.2.2",
|
||||||
"ts-loader": "^9.5.1",
|
"ts-loader": "^9.5.1",
|
||||||
"webpack": "^5.96.1",
|
"webpack": "^5.96.1",
|
||||||
"webpack-cli": "^5.1.4"
|
"webpack-cli": "^5.1.4"
|
||||||
@ -911,6 +913,33 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
"node_modules/graphql": {
|
||||||
|
"version": "16.9.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/graphql/-/graphql-16.9.0.tgz",
|
||||||
|
"integrity": "sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
|
"engines": {
|
||||||
|
"node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/graphql-tag": {
|
||||||
|
"version": "2.12.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/graphql-tag/-/graphql-tag-2.12.6.tgz",
|
||||||
|
"integrity": "sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "^2.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"graphql": "^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/has-flag": {
|
"node_modules/has-flag": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||||
@ -1444,6 +1473,16 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/shopify-admin-api-typings": {
|
||||||
|
"version": "1.2.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/shopify-admin-api-typings/-/shopify-admin-api-typings-1.2.2.tgz",
|
||||||
|
"integrity": "sha512-n9NSBPBKX+TSfAr8ibpXKoGdHCUCY6WBKV2FhD9xvjGG3DIqqUylqhC3OXKiWcrTQuyb3WnaRCvl16i3uhJMiQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"peerDependencies": {
|
||||||
|
"graphql": ">=14"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/slash": {
|
"node_modules/slash": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
|
||||||
@ -1609,6 +1648,13 @@
|
|||||||
"webpack": "^5.0.0"
|
"webpack": "^5.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/tslib": {
|
||||||
|
"version": "2.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||||
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "0BSD"
|
||||||
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "5.6.3",
|
"version": "5.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz",
|
||||||
|
|||||||
@ -12,8 +12,14 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/google-apps-script": "^1.0.85",
|
"@types/google-apps-script": "^1.0.85",
|
||||||
"gas-webpack-plugin": "^2.6.0",
|
"gas-webpack-plugin": "^2.6.0",
|
||||||
|
"graphql-tag": "^2.12.6",
|
||||||
|
"shopify-admin-api-typings": "^1.2.2",
|
||||||
"ts-loader": "^9.5.1",
|
"ts-loader": "^9.5.1",
|
||||||
"webpack": "^5.96.1",
|
"webpack": "^5.96.1",
|
||||||
"webpack-cli": "^5.1.4"
|
"webpack-cli": "^5.1.4"
|
||||||
|
},
|
||||||
|
"graphql": {
|
||||||
|
"schema": "https://localhost:3001/graphql",
|
||||||
|
"documents": "**/*.{graphql,js,ts,jsx,tsx}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -138,9 +138,7 @@ export class Product {
|
|||||||
variant.sku = this.sku
|
variant.sku = this.sku
|
||||||
variant.price = this.price
|
variant.price = this.price
|
||||||
sps.variants.push(variant)
|
sps.variants.push(variant)
|
||||||
let opt = new ShopifyVa
|
console.log("ToShopifyProductSet:\n" + JSON.stringify(sps, null, 2))
|
||||||
let options = new VariantOptionValueInput()
|
|
||||||
options.id = this.shopify_default_option_value_id
|
|
||||||
return sps
|
return sps
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,8 @@
|
|||||||
/// <reference types="@types/google-apps-script" />
|
/// <reference types="@types/google-apps-script" />
|
||||||
|
|
||||||
import { Config } from "./config"
|
import { Config } from "./config"
|
||||||
|
import * as shopify from "shopify-admin-api-typings"
|
||||||
|
import gql from 'graphql-tag'
|
||||||
|
|
||||||
const ss = SpreadsheetApp.getActive()
|
const ss = SpreadsheetApp.getActive()
|
||||||
|
|
||||||
@ -731,7 +733,13 @@ export class ShopifyVariant {
|
|||||||
barcode?: string
|
barcode?: string
|
||||||
position?: number
|
position?: number
|
||||||
nodes?: ShopifyProductVariant[]
|
nodes?: ShopifyProductVariant[]
|
||||||
optionValues?: VariantOptionValueInput[]
|
//TODO: support multiple options
|
||||||
|
optionValues: [{}] = [
|
||||||
|
{
|
||||||
|
optionName: "Title",
|
||||||
|
name: "Default Title"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
class PageInfo {
|
class PageInfo {
|
||||||
@ -802,7 +810,7 @@ export class ShopifyProductsResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ShopifyProductSetQuery {
|
export class ShopifyProductSetQuery {
|
||||||
GQL: string = `mutation setProduct($productSet: ProductSetInput!) {
|
GQL = `mutation setProduct($productSet: ProductSetInput!) {
|
||||||
productSet(input: $productSet) {
|
productSet(input: $productSet) {
|
||||||
product {
|
product {
|
||||||
id
|
id
|
||||||
@ -826,7 +834,7 @@ export class ShopifyProductSetQuery {
|
|||||||
JSON: JSON
|
JSON: JSON
|
||||||
constructor(product: ShopifyProductSetInput, synchronous: boolean = true) {
|
constructor(product: ShopifyProductSetInput, synchronous: boolean = true) {
|
||||||
let j = `{
|
let j = `{
|
||||||
"query": ${formatGqlForJSON(this.GQL)},
|
"query": ${formatGqlForJSON(String(this.GQL))},
|
||||||
"variables": {
|
"variables": {
|
||||||
"productSet": ${JSON.stringify(product)}
|
"productSet": ${JSON.stringify(product)}
|
||||||
}
|
}
|
||||||
@ -847,7 +855,15 @@ export class ShopifyProductSetInput {
|
|||||||
title: string
|
title: string
|
||||||
vendor: string
|
vendor: string
|
||||||
variants: ShopifyVariant[]
|
variants: ShopifyVariant[]
|
||||||
productOptions: ShopifyProductOption[]
|
//TODO: Support multiple product options
|
||||||
|
productOptions: [{}] = [
|
||||||
|
{
|
||||||
|
name: "Title",
|
||||||
|
values: {
|
||||||
|
name: "Default Title"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ProductVariantSetInput {
|
export class ProductVariantSetInput {
|
||||||
|
|||||||
Reference in New Issue
Block a user