Methods
checkSession()
checks request for the session presence
- Source:
Throws:
CPBWare(req, res)
[/cpb:${shopNameOrShopID] middleware
Parameters:
Name | Type | Description |
---|---|---|
req |
Request | |
res |
Response |
- Source:
get(shopNameOrShopID, productIdOrHandle, generationnullable, exclusionsnullable) → {Promise.<{products}>}
Get all shop instance data
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
shopNameOrShopID |
string | number | ||
productIdOrHandle |
string | number | ||
generation |
number |
<nullable> |
|
exclusions |
object |
<nullable> |
- Source:
Returns:
- Type
- Promise.<{products}>
get(filteropt, nullable, fetchopt, nullable) → {Promise.<(Object|{maps: {names: {}, ids: {}}, data: {}})>}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
filter |
object |
<optional> <nullable> |
|
fetch |
boolean | number | string | undefined |
<optional> <nullable> |
- Source:
Returns:
- Type
- Promise.<(Object|{maps: {names: {}, ids: {}}, data: {}})>
Example
js
{
multi_location_enabled: true,
shopID: 13878489,
email: 'Chloe@slateplate.com',
enabled_presentment_currencies: [ 'USD' ],
visitor_tracking_consent_preference: 'allow_all',
pre_launch_enabled: false,
longitude: -75.251347,
weight_unit: 'lb',
myshopify_domain: 'slateplate.myshopify.com',
created_at: '2016-07-15T21:43:09-04:00',
finances: true,
iana_timezone: 'America/New_York',
country: 'US',
setup_required: false,
eligible_for_card_reader_giveaway: true,
tax_shipping: null,
google_apps_domain: null,
address1: '251 Irving Street',
datastore_inserted_at: 2021-12-30T08:18:22.412Z,
force_ssl: true,
plan_name: 'basic',
city: 'Honesdale',
zip: '18431',
province: 'Pennsylvania',
county_taxes: true,
country_code: 'US',
customer_email: 'info@slateplate.com',
requires_extra_payments_agreement: false,
shopName: 'slateplate',
updated_at: '2021-12-12T19:25:12-05:00',
google_apps_login_enabled: null,
source: null,
currency: 'USD',
money_with_currency_in_emails_format: '${{amount}} USD',
plan_display_name: 'Basic Shopify',
shop_owner: 'Chloe Nicolini',
country_name: 'United States',
has_discounts: true,
money_in_emails_format: '${{amount}}',
checkout_api_supported: true,
primary_location_id: 61838622917,
auto_configure_tax_inclusivity: null,
eligible_for_payments: true,
password_enabled: false,
money_format: '${{amount}}',
has_storefront: true,
timezone: '(GMT-05:00) America/New_York',
province_code: 'PA',
latitude: 41.5741673,
phone: '570-493-9063',
primary_locale: 'en',
taxes_included: false,
id: 13878489,
has_gift_cards: false,
money_with_currency_format: '${{amount}} USD',
name: 'Slateplate',
address2: '',
cookie_consent_level: 'implicit',
domain: 'www.slateplate.com'
},
(async) list(bucket, delimiternullable, prefixnullable, versionsopt, nullable) → {Promise.<DirectoryListing>}
Recursively get top-level directory listing for the given storage bucket.
Due to the Google nodejs api limitations there is no native way to get this data.
We have to manually iterate the apiResponse object and fill the prefixes.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
bucket |
string | gce storage bucket name |
||
delimiter |
string |
<nullable> |
The delimiter argument can be used to restrict the results to only the |
|
prefix |
string |
<nullable> |
directory prefix. This can be used to list all blobs in a "folder", e.g. |
|
versions |
boolean |
<optional> <nullable> |
false | include previous file versions |
- Source:
Returns:
- Type
- Promise.<DirectoryListing>
Example
For example, given these blobs:
/a/1.txt
/a/b/2.txt
If you just specify prefix = 'a/', you'll get back:
/a/1.txt
/a/b/2.txt
However, if you specify prefix='a/' and delimiter='/', you'll get back:
/a/1.txt
(async) module:cpb-storage/file/restore(bucketopt, nullable, pathnon-null, generationnon-null, destinationBucketopt, nullable, destinationPathopt, nullable) → {Promise.<void>}
Restore non-current file version as current
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
bucket |
string |
<optional> <nullable> |
process.env.BUCKET || 'custom-product-builder' | source storage bucket |
path |
string | source file path |
||
generation |
number | source file generation to restore |
||
destinationBucket |
string |
<optional> <nullable> |
bucket | destination storage bucket |
destinationPath |
string |
<optional> <nullable> |
path | destination file path for the restored version |
- Source:
Returns:
- Type
- Promise.<void>
(async) ProductIdService.() → {Promise.<ProductIdService>}
load datastore data and populate maps
- Source:
Returns:
- Type
- Promise.<ProductIdService>
(async) ProductIdService.(id, fetchopt) → {Promise.<(string|undefined|Map.<number, string>)>}
get shopName from its shopID
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
number | string | shopID |
|
fetch |
boolean | undefined |
<optional> |
load data from datastore |
- Source:
Returns:
name - shopName
- Type
- Promise.<(string|undefined|Map.<number, string>)>
(async) ProductIdService.(name, fetchopt) → {Promise.<(Map.<string, number>|number|undefined)>}
get shopID from the shopName. If name is not given the entire map is returned
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | shopName |
|
fetch |
boolean | undefined |
<optional> |
fetch datastore data |
- Source:
Returns:
shopID
- Type
- Promise.<(Map.<string, number>|number|undefined)>
(async) ShopIdService.() → {Promise.<ShopIdService>}
load datastore data and populate maps
- Source:
Returns:
- Type
- Promise.<ShopIdService>
(async) ShopIdService.(id, fetchopt) → {Promise.<(string|undefined|Map.<number, string>)>}
get shopName from its shopID
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
id |
number | string | shopID |
|
fetch |
boolean | undefined |
<optional> |
load data from datastore |
- Source:
Returns:
name - shopName
- Type
- Promise.<(string|undefined|Map.<number, string>)>
(async) ShopIdService.(name, fetchopt) → {Promise.<(Map.<string, number>|number|undefined)>}
get shopID from the shopName. If name is not given the entire map is returned
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string | shopName |
|
fetch |
boolean | undefined |
<optional> |
fetch datastore data |
- Source:
Returns:
shopID
- Type
- Promise.<(Map.<string, number>|number|undefined)>
Type Definitions
BucketStorageStats
gce storage bucket/dir computed stats for the shopify shop
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
files |
number |
<optional> <nullable> |
number of files if the |
deletedFiles |
number |
<optional> <nullable> |
number of deleted files; absent if previous versions are not requested |
products |
number | number of products in the bucket directory |
|
deletedProducts |
number |
<optional> <nullable> |
number of deleted products; absent if previous versions are not requested |
size |
number | total file size in bytes |
|
deletedFilesSize |
number |
<optional> <nullable> |
size of deleted files in bytes; absent if previous versions are not |
currentFileSize |
number | current generation file size in bytes |
|
previousFileVersionsSize |
number |
<optional> <nullable> |
size of the previous file versions in bytes; absent if versions are |
previousFileVersionsCount |
number |
<nullable> |
number of the previous file versions; absent if versions are |
- Source:
CACHE
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
tokens |
Map.<any, any> | shopify auth tokens |
uninstalledStores |
Map.<any, any> | |
installedStores |
Map.<any, any> | |
shopData |
Map.<any, any> | shopify shop info |
connect |
Map.<any, any> | shopify store api instances |
- Source:
DatastoreQuerySettings
Type:
- object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
kind |
string | datastore kind |
||
selector |
Array.<string> | string |
<optional> <nullable> |
query selector |
|
groupBy |
Array.<string> | string |
<optional> <nullable> |
fields to group by |
|
order |
Array.<string> | string |
<optional> <nullable> |
result order |
|
useEmulator |
boolean |
<optional> <nullable> |
process.env.USE_EMULATOR_DATASTORE | use datastore emulator |
- Source:
DirectoryListing
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
bucket |
string | gce storage bucket |
files |
Array.<object> | files in the bucket |
dirs |
Array.<object> | directories within the bucket |
- Source:
FileVersion
Type:
- object
Properties:
Name | Type | Description | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id |
string | ||||||||||||||||||||||
url |
string | ||||||||||||||||||||||
generation |
number | ||||||||||||||||||||||
size |
number | ||||||||||||||||||||||
metadata |
object |
Properties
|
|||||||||||||||||||||
isDeleted |
boolean | ||||||||||||||||||||||
isCurrent |
boolean |
- Source:
GroupedFiles
Type:
- Array
Properties:
Name | Type | Description |
---|---|---|
products |
Array.<number> | |
deletedProducts |
Array.<number> | |
productConfigs |
ProductConfigEntry |
- Source:
MagentoSubscriptionList
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
bucket |
string | gce storage bucket |
active |
Array.<string> | active subscriptions |
inactive |
Array.<string> | inactive subscriptions |
files |
Array.<object> | all files in bucket |
deletedFiles |
Array.<object> | deleted files in bucket |
debug |
object | debug object |
- Source:
ProductConfigEntry
Properties:
Name | Type | Description |
---|---|---|
name |
string | |
path |
string | |
versions |
Array.<FileVersion> |
- Source:
ProductList
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
shop_id |
number | Shopify Store ID |
products |
Array.<number> | list of provisioned product ids |
deletedProducts |
Array.<number> | ids of products that have been setup but later deleted from Shopify |
files |
Array.<object> | |
stats |
BucketStorageStats |
- Source:
ShopifyCharge
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
activated_on |
string | ||
api_client_id |
number | ||
balance_remaining |
number | ||
balance_used |
number | ||
billing_on |
string | ||
cancelled_on |
string |
<nullable> |
|
capped_amount |
string | ||
datastore_updated_at |
DateTime | ||
decorated_return_url |
string | ||
id |
number | ||
name |
string | ||
price |
string | ||
return_url |
string | ||
risk_level |
number | ||
shopID |
number | ||
shopName |
string | ||
status |
string | ||
test |
boolean | ||
trial_days |
number | ||
trial_ends_on |
string | ||
updated_at |
string |
- Source:
ShopifyCharges
Type:
- Array.<ShopifyCharge>
- Source:
ShopifyProduct
Properties:
Name | Type | Description |
---|---|---|
admin_graphql_api_id |
string | |
body_html |
string | |
config |
ProductConfigEntry | |
created_at |
Timestamp | |
datastore_updated_at |
string | |
handle |
string | |
id |
number | |
image |
ShopifyProductImage | |
images |
Array.<ShopifyProductImage> | |
options |
Array.<object> | |
product_type |
string | |
published_at |
Timestamp | |
shopID |
number | |
shopName |
string | |
status |
string | |
tags |
string | |
title |
string | |
updated_at |
Timestamp | |
vendor |
string | |
variants |
Array.<ShopifyProductVariant> |
- Source:
ShopifyProductImage
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
admin_graphql_api_id |
string | ||
alt |
string |
<nullable> |
|
created_at |
Timestamp | ||
height |
number | ||
id |
number | ||
position |
number | ||
product_id |
number | ||
src |
string | ||
updated_at |
Timestamp | ||
variant_ids |
Array.<number> | ||
width |
number |
- Source:
ShopifyProductImages
Type:
- Array.<ShopifyProductImage>
- Source:
ShopifyProductVariant
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
admin_graphql_api_id |
string | ||
barcode |
string |
<nullable> |
|
compare_at_price |
string |
<nullable> |
|
created_at |
Timestamp | ||
fulfillment_service |
string | ||
grams |
number | ||
id |
number | ||
image_id |
string |
<nullable> |
|
inventory_item_id |
number | ||
inventory_management |
string |
<nullable> |
|
inventory_policy |
string | ||
inventory_quantity |
number | ||
old_inventory_quantity |
number | ||
option1 |
string |
<nullable> |
|
option2 |
string |
<nullable> |
|
option3 |
string |
<nullable> |
|
position |
number | ||
price |
string | ||
product_id |
number | ||
requires_shipping |
boolean | ||
sku |
string | ||
taxable |
boolean | ||
title |
string | ||
updated_at |
Timestamp | ||
weight |
number | ||
weight_unit |
string |
- Source:
ShopifyShop
Type:
- object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
id |
number | ||
name |
string | ||
email |
string | ||
domain |
string | ||
province |
string | ||
country |
string | ||
address1 |
string | ||
zip: |
string | ||
city: |
string | ||
source |
string | ||
phone |
string | ||
latitude |
number | ||
longitude |
number | ||
primary_locale |
string | ||
address2 |
string | ||
created_at |
timestamp | ||
updated_at |
timestamp | ||
country_code |
string | ||
country_name |
string | ||
currency |
string | ||
customer_email |
string | ||
timezone |
string | ||
iana_timezone |
string | ||
shop_owner |
string | ||
money_format |
string | ||
money_with_currency_format |
string | ||
weight_unit |
string | ||
province_code |
string | ||
taxes_included |
boolean | ||
auto_configure_tax_inclusivity |
boolean | ||
tax_shipping |
boolean | ||
county_taxes |
boolean | ||
plan_display_name |
string | ||
plan_name |
string | ||
has_discounts |
boolean | ||
has_gift_cards |
boolean | ||
myshopify_domain |
string | ||
google_apps_domain |
string |
<optional> <nullable> |
|
google_apps_login_enabled |
string |
<optional> <nullable> |
|
money_in_emails_format |
string | ||
money_with_currency_in_emails_format |
string | ||
eligible_for_payments |
boolean | ||
requires_extra_payments_agreement |
boolean | ||
password_enabled |
boolean | ||
has_storefront |
boolean | ||
eligible_for_card_reader_giveaway |
boolean | ||
finances |
boolean | ||
primary_location_id |
number | ||
cookie_consent_level |
string | ||
visitor_tracking_consent_preference |
string | ||
checkout_api_supported |
boolean | ||
multi_location_enabled |
boolean | ||
setup_required |
boolean | ||
pre_launch_enabled |
boolean | ||
enabled_presentment_currencies: |
Array.<string> | ||
force_ssl |
boolean | ||
shopName |
string | ||
shopID |
number |
- Source:
Example
{
id: 55028482214,
name: 'Zap Moto',
email: 'sales@zapmoto.com.au',
domain: 'zapmoto.com.au',
province: 'Queensland',
country: 'AU',
address1: '40 Waterloo Street',
zip: '4006',
city: 'Newstead',
source: 'buildify',
phone: '0424977731',
latitude: -27.4481248,
longitude: 153.0444463,
primary_locale: 'en',
address2: '',
created_at: '2021-03-02T20:16:39+10:00',
updated_at: '2021-12-08T21:21:17+10:00',
country_code: 'AU',
country_name: 'Australia',
currency: 'AUD',
customer_email: 'Sales@zapmoto.com.au',
timezone: '(GMT+10:00) Australia/Brisbane',
iana_timezone: 'Australia/Brisbane',
shop_owner: 'Paul Halhead',
money_format: '${{amount}}',
money_with_currency_format: '${{amount}} AUD',
weight_unit: 'kg',
province_code: 'QLD',
taxes_included: true,
auto_configure_tax_inclusivity: false,
tax_shipping: false,
county_taxes: true,
plan_display_name: 'Basic Shopify',
plan_name: 'basic',
has_discounts: false,
has_gift_cards: false,
myshopify_domain: 'zap-moto.myshopify.com',
google_apps_domain: null,
google_apps_login_enabled: null,
money_in_emails_format: '${{amount}}',
money_with_currency_in_emails_format: '${{amount}} AUD',
eligible_for_payments: true,
requires_extra_payments_agreement: false,
password_enabled: false,
has_storefront: true,
eligible_for_card_reader_giveaway: false,
finances: true,
primary_location_id: 61045997734,
cookie_consent_level: 'implicit',
visitor_tracking_consent_preference: 'allow_all',
checkout_api_supported: true,
multi_location_enabled: true,
setup_required: false,
pre_launch_enabled: false,
enabled_presentment_currencies: [ 'AUD' ],
force_ssl: true,
shopName: 'zap-moto',
shopID: 55028482214
}
ShopifyStoreNameMap
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
name |
string | |
id |
number |
- Source:
ShopifyStoreTuple
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
name |
string | |
id |
number |
- Source:
Store
File Storage Shopify Store Object. Represents bucket directory contents
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
id |
string | number | filestore id |
shopifyStoreId |
number | filestore id |
dir |
string | directory within the bucket |
bucket |
string | gce storage bucket |
files |
Array.<string> | array of files belonging to the bucket |
deletedFiles |
Array.<string> | array of deleted files belonging to the bucket |
products |
Array.<number> | shopify custom product ids for the filestore |
deletedProducts |
Array.<number> | deleted shopify custom product ids for the filestore (empty if the file versions |
stats |
BucketStorageStats | filestore storage stats |
- Source:
StoreList
Type:
- Object
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
bucket |
string | gce storage bucket |
|
ids |
Array.<number> | shopify filestore ids |
|
misc |
Array.<string> | misc dirs |
|
legacy |
Array.<string> | legacy shopify filestore domains |
|
files |
Array.<string> |
<nullable> |
loose files |
deletedFiles |
Array.<string> |
<nullable> |
deleted loose files |
stats |
BucketStorageStats | storage stats |
- Source:
StoreSubscriptionData
Type:
- object
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
status |
string |
<optional> |
'active'|'inactive | subscription status |
domain |
string | filestore domain |
||
fileName |
string | subscription file name |
||
permissions |
Array.<string> |
<nullable> |
- Source: