stocker-sdk 0.1.0 → 0.2.0
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/README.md +10 -1
- package/dist/index.d.mts +2410 -3549
- package/dist/index.mjs +36 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -5778,6 +5778,7 @@ var Brands = class {
|
|
|
5778
5778
|
return (options?.client ?? client).get({
|
|
5779
5779
|
querySerializer: { parameters: {
|
|
5780
5780
|
include: { array: { explode: false } },
|
|
5781
|
+
withCount: { array: { explode: false } },
|
|
5781
5782
|
"fields[adjustments]": { array: { explode: false } },
|
|
5782
5783
|
"fields[alternative-price-items]": { array: { explode: false } },
|
|
5783
5784
|
"fields[alternative-prices]": { array: { explode: false } },
|
|
@@ -5846,6 +5847,7 @@ var Brands = class {
|
|
|
5846
5847
|
return (options.client ?? client).post({
|
|
5847
5848
|
querySerializer: { parameters: {
|
|
5848
5849
|
include: { array: { explode: false } },
|
|
5850
|
+
withCount: { array: { explode: false } },
|
|
5849
5851
|
"fields[adjustments]": { array: { explode: false } },
|
|
5850
5852
|
"fields[alternative-price-items]": { array: { explode: false } },
|
|
5851
5853
|
"fields[alternative-prices]": { array: { explode: false } },
|
|
@@ -5930,6 +5932,7 @@ var Brands = class {
|
|
|
5930
5932
|
return (options.client ?? client).get({
|
|
5931
5933
|
querySerializer: { parameters: {
|
|
5932
5934
|
include: { array: { explode: false } },
|
|
5935
|
+
withCount: { array: { explode: false } },
|
|
5933
5936
|
"fields[adjustments]": { array: { explode: false } },
|
|
5934
5937
|
"fields[alternative-price-items]": { array: { explode: false } },
|
|
5935
5938
|
"fields[alternative-prices]": { array: { explode: false } },
|
|
@@ -5997,6 +6000,7 @@ var Brands = class {
|
|
|
5997
6000
|
return (options.client ?? client).patch({
|
|
5998
6001
|
querySerializer: { parameters: {
|
|
5999
6002
|
include: { array: { explode: false } },
|
|
6003
|
+
withCount: { array: { explode: false } },
|
|
6000
6004
|
"fields[adjustments]": { array: { explode: false } },
|
|
6001
6005
|
"fields[alternative-price-items]": { array: { explode: false } },
|
|
6002
6006
|
"fields[alternative-prices]": { array: { explode: false } },
|
|
@@ -9297,6 +9301,7 @@ var Categories = class {
|
|
|
9297
9301
|
return (options?.client ?? client).get({
|
|
9298
9302
|
querySerializer: { parameters: {
|
|
9299
9303
|
include: { array: { explode: false } },
|
|
9304
|
+
withCount: { array: { explode: false } },
|
|
9300
9305
|
"fields[adjustments]": { array: { explode: false } },
|
|
9301
9306
|
"fields[alternative-price-items]": { array: { explode: false } },
|
|
9302
9307
|
"fields[alternative-prices]": { array: { explode: false } },
|
|
@@ -9365,6 +9370,7 @@ var Categories = class {
|
|
|
9365
9370
|
return (options.client ?? client).post({
|
|
9366
9371
|
querySerializer: { parameters: {
|
|
9367
9372
|
include: { array: { explode: false } },
|
|
9373
|
+
withCount: { array: { explode: false } },
|
|
9368
9374
|
"fields[adjustments]": { array: { explode: false } },
|
|
9369
9375
|
"fields[alternative-price-items]": { array: { explode: false } },
|
|
9370
9376
|
"fields[alternative-prices]": { array: { explode: false } },
|
|
@@ -9449,6 +9455,7 @@ var Categories = class {
|
|
|
9449
9455
|
return (options.client ?? client).get({
|
|
9450
9456
|
querySerializer: { parameters: {
|
|
9451
9457
|
include: { array: { explode: false } },
|
|
9458
|
+
withCount: { array: { explode: false } },
|
|
9452
9459
|
"fields[adjustments]": { array: { explode: false } },
|
|
9453
9460
|
"fields[alternative-price-items]": { array: { explode: false } },
|
|
9454
9461
|
"fields[alternative-prices]": { array: { explode: false } },
|
|
@@ -9516,6 +9523,7 @@ var Categories = class {
|
|
|
9516
9523
|
return (options.client ?? client).patch({
|
|
9517
9524
|
querySerializer: { parameters: {
|
|
9518
9525
|
include: { array: { explode: false } },
|
|
9526
|
+
withCount: { array: { explode: false } },
|
|
9519
9527
|
"fields[adjustments]": { array: { explode: false } },
|
|
9520
9528
|
"fields[alternative-price-items]": { array: { explode: false } },
|
|
9521
9529
|
"fields[alternative-prices]": { array: { explode: false } },
|
|
@@ -18691,6 +18699,7 @@ var Products = class {
|
|
|
18691
18699
|
return (options.client ?? client).get({
|
|
18692
18700
|
querySerializer: { parameters: {
|
|
18693
18701
|
include: { array: { explode: false } },
|
|
18702
|
+
withCount: { array: { explode: false } },
|
|
18694
18703
|
"fields[adjustments]": { array: { explode: false } },
|
|
18695
18704
|
"fields[alternative-price-items]": { array: { explode: false } },
|
|
18696
18705
|
"fields[alternative-prices]": { array: { explode: false } },
|
|
@@ -18758,6 +18767,7 @@ var Products = class {
|
|
|
18758
18767
|
return (options.client ?? client).get({
|
|
18759
18768
|
querySerializer: { parameters: {
|
|
18760
18769
|
include: { array: { explode: false } },
|
|
18770
|
+
withCount: { array: { explode: false } },
|
|
18761
18771
|
"fields[adjustments]": { array: { explode: false } },
|
|
18762
18772
|
"fields[alternative-price-items]": { array: { explode: false } },
|
|
18763
18773
|
"fields[alternative-prices]": { array: { explode: false } },
|
|
@@ -19300,6 +19310,7 @@ var Products = class {
|
|
|
19300
19310
|
return (options.client ?? client).get({
|
|
19301
19311
|
querySerializer: { parameters: {
|
|
19302
19312
|
include: { array: { explode: false } },
|
|
19313
|
+
withCount: { array: { explode: false } },
|
|
19303
19314
|
"fields[adjustments]": { array: { explode: false } },
|
|
19304
19315
|
"fields[alternative-price-items]": { array: { explode: false } },
|
|
19305
19316
|
"fields[alternative-prices]": { array: { explode: false } },
|
|
@@ -19384,6 +19395,7 @@ var Products = class {
|
|
|
19384
19395
|
return (options.client ?? client).get({
|
|
19385
19396
|
querySerializer: { parameters: {
|
|
19386
19397
|
include: { array: { explode: false } },
|
|
19398
|
+
withCount: { array: { explode: false } },
|
|
19387
19399
|
"fields[adjustments]": { array: { explode: false } },
|
|
19388
19400
|
"fields[alternative-price-items]": { array: { explode: false } },
|
|
19389
19401
|
"fields[alternative-prices]": { array: { explode: false } },
|
|
@@ -34462,7 +34474,28 @@ function createStockerClient(options) {
|
|
|
34462
34474
|
}));
|
|
34463
34475
|
}
|
|
34464
34476
|
// src/jsonapi/deserialize.ts
|
|
34465
|
-
|
|
34477
|
+
var RelationshipMetaMapper = class extends SwitchCaseJsonMapper {
|
|
34478
|
+
setRelationshipMeta = (model, relationName, meta) => {
|
|
34479
|
+
const prefix = this.convertToCamelCaseString(relationName);
|
|
34480
|
+
for (const [key, value] of Object.entries(meta)) {
|
|
34481
|
+
const suffix = this.convertToCamelCaseString(key);
|
|
34482
|
+
const name = prefix + suffix.charAt(0).toUpperCase() + suffix.slice(1);
|
|
34483
|
+
if (![
|
|
34484
|
+
"id",
|
|
34485
|
+
"type",
|
|
34486
|
+
"links",
|
|
34487
|
+
"meta",
|
|
34488
|
+
"relationshipNames"
|
|
34489
|
+
].includes(name) && !(name in model)) Object.defineProperty(model, name, {
|
|
34490
|
+
value,
|
|
34491
|
+
enumerable: true,
|
|
34492
|
+
writable: true,
|
|
34493
|
+
configurable: true
|
|
34494
|
+
});
|
|
34495
|
+
}
|
|
34496
|
+
};
|
|
34497
|
+
};
|
|
34498
|
+
const formatter = new Jsona({ jsonPropertiesMapper: new RelationshipMetaMapper({
|
|
34466
34499
|
camelizeAttributes: true,
|
|
34467
34500
|
camelizeRelationships: true,
|
|
34468
34501
|
camelizeType: false,
|
|
@@ -34472,7 +34505,8 @@ const formatter = new Jsona({ jsonPropertiesMapper: new SwitchCaseJsonMapper({
|
|
|
34472
34505
|
/**
|
|
34473
34506
|
* Flattens a parsed JSON:API document and resolves relationships from included
|
|
34474
34507
|
* and primary data. Does not fetch missing resources or validate response schemas.
|
|
34475
|
-
*
|
|
34508
|
+
* Relationship metadata becomes prefixed properties (products.meta.count →
|
|
34509
|
+
* productsCount). Keep the original document for document metadata and links.
|
|
34476
34510
|
*/
|
|
34477
34511
|
function deserialize(document) {
|
|
34478
34512
|
let result;
|
package/package.json
CHANGED