/** @type { ActionRun } */
export const run = async ({ logger, api, connections }) => {
try {
const allLocations = [];
let locations = await api.shopifyLocation.findMany({
first: 250,
select: {
id: true,
name: true
}
});
allLocations.push(...locations);
while (locations.hasNextPage) {
locations = await locations.nextPage();
allLocations.push(...locations);
}
return allLocations;
} catch (error) {
logger.error('Error fetching locations:', error);
return [];
}
};
/** @type { ActionRun } */
export const run = async ({ logger, api, connections }) => {
try {
const allLocations = [];
let locations = await api.shopifyLocation.findMany({
first: 250,
select: {
id: true,
name: true
}
});
allLocations.push(...locations);
while (locations.hasNextPage) {
locations = await locations.nextPage();
allLocations.push(...locations);
}
return allLocations;
} catch (error) {
logger.error('Error fetching locations:', error);
return [];
}
};