@nuskin/contentstack-lib 2.0.0-pa-954.2 → 2.1.0-pa-1117.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.releaserc +1 -1
- package/docs/CHANGELOG.md +1 -1
- package/package.json +1 -1
- package/src/api.js +31 -0
package/.releaserc
CHANGED
package/docs/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# [2.
|
|
1
|
+
# [2.1.0-pa-1117.1](https://code.tls.nuskin.io/ns-am/utility/npm/contentstack-lib/compare/v2.0.0...v2.1.0-pa-1117.1) (2026-04-06)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuskin/contentstack-lib",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0-pa-1117.1",
|
|
4
4
|
"description": "This project contains configuration and api code to access Contentstack, to be shared between the backend (AWS Lambda) and frontend (Vue, etc).",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"scripts": {
|
package/src/api.js
CHANGED
|
@@ -173,6 +173,35 @@ async function getSingletonEntries(options) {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
/**
|
|
177
|
+
* Gets all the specified entries for a multiple content type
|
|
178
|
+
* @param {string} contentType
|
|
179
|
+
* @param {string[]} values
|
|
180
|
+
* @return {Promise<{Object}>} config
|
|
181
|
+
*/
|
|
182
|
+
const _getMultiEntries = async (contentType, values) => {
|
|
183
|
+
try {
|
|
184
|
+
const [results] = await Stack
|
|
185
|
+
.ContentType(contentType)
|
|
186
|
+
.Query()
|
|
187
|
+
.containedIn('title', values)
|
|
188
|
+
.includeReference(['pre_address_fields', 'address_form', 'post_address_fields'])
|
|
189
|
+
.toJSON()
|
|
190
|
+
.find();
|
|
191
|
+
|
|
192
|
+
return results;
|
|
193
|
+
} catch(err) {
|
|
194
|
+
console.error(err);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
const getShippingAddressForms = async (countries) => {
|
|
200
|
+
const results = await _getMultiEntries(countries);
|
|
201
|
+
console.log(results);
|
|
202
|
+
|
|
203
|
+
}
|
|
204
|
+
|
|
176
205
|
/**
|
|
177
206
|
* Returns contentstack Stack object initialized with the api key, deliveryToken, and extended with custom functionality
|
|
178
207
|
* @param {'dev' | 'test' | 'stage' | 'prod'} envrnmnt
|
|
@@ -197,6 +226,8 @@ function getStack(envrnmnt) {
|
|
|
197
226
|
|
|
198
227
|
// extend the Stack with a custom function to get translations
|
|
199
228
|
Stack.getSingletonEntries = getSingletonEntries;
|
|
229
|
+
// extend the Stack with a custom function to get ShippingAddressForms
|
|
230
|
+
Stack.getShippingAddressForms = getShippingAddressForms;
|
|
200
231
|
|
|
201
232
|
return Stack;
|
|
202
233
|
}
|