@attlaz/client 1.120.0 → 1.122.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/dist/MarketPulse/Model/VendorProduct.d.ts +12 -1
- package/dist/MarketPulse/Model/VendorProduct.js +9 -1
- package/dist/MarketPulse/Service/VendorProductEndpoint.js +14 -4
- package/dist/Model/Deployment/SourcesAccountRepository.d.ts +4 -0
- package/dist/Model/Deployment/SourcesAccountRepository.js +7 -0
- package/dist/Service/Endpoint.d.ts +1 -0
- package/dist/Service/Endpoint.js +4 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,9 @@ import { StockStatus } from './StockStatus.js';
|
|
|
2
2
|
import { ApiRecord } from '../../Model/ApiRecord.js';
|
|
3
3
|
/**
|
|
4
4
|
* A competitor's product as tracked by Market Pulse — the `/pulse/vendors/:vendorId/products`
|
|
5
|
-
* resource. `identifier` is the product's stable id on the competitor's site (the upsert key)
|
|
5
|
+
* resource. `identifier` is the product's stable id on the competitor's site (the upsert key);
|
|
6
|
+
* `variantGroup` is shared by siblings and is not an id of its own. Axis names and values are the
|
|
7
|
+
* vendor's own words, unnormalised.
|
|
6
8
|
*/
|
|
7
9
|
export declare class VendorProduct {
|
|
8
10
|
id: string | null;
|
|
@@ -14,6 +16,15 @@ export declare class VendorProduct {
|
|
|
14
16
|
brand: string | null;
|
|
15
17
|
url: string | null;
|
|
16
18
|
sku: string | null;
|
|
19
|
+
manufacturerPartNumber: string | null;
|
|
20
|
+
variantGroup: string | null;
|
|
21
|
+
variantAxes: {
|
|
22
|
+
name: string;
|
|
23
|
+
value: string;
|
|
24
|
+
code?: string | null;
|
|
25
|
+
unit?: string | null;
|
|
26
|
+
numericValue?: number | null;
|
|
27
|
+
}[] | null;
|
|
17
28
|
currency: string | null;
|
|
18
29
|
price: number | null;
|
|
19
30
|
originalPrice: number | null;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { parseStockStatus } from './StockStatus.js';
|
|
2
2
|
/**
|
|
3
3
|
* A competitor's product as tracked by Market Pulse — the `/pulse/vendors/:vendorId/products`
|
|
4
|
-
* resource. `identifier` is the product's stable id on the competitor's site (the upsert key)
|
|
4
|
+
* resource. `identifier` is the product's stable id on the competitor's site (the upsert key);
|
|
5
|
+
* `variantGroup` is shared by siblings and is not an id of its own. Axis names and values are the
|
|
6
|
+
* vendor's own words, unnormalised.
|
|
5
7
|
*/
|
|
6
8
|
export class VendorProduct {
|
|
7
9
|
id = null;
|
|
@@ -13,6 +15,9 @@ export class VendorProduct {
|
|
|
13
15
|
brand = null;
|
|
14
16
|
url = null;
|
|
15
17
|
sku = null;
|
|
18
|
+
manufacturerPartNumber = null;
|
|
19
|
+
variantGroup = null;
|
|
20
|
+
variantAxes = null;
|
|
16
21
|
currency = null;
|
|
17
22
|
price = null;
|
|
18
23
|
originalPrice = null;
|
|
@@ -43,6 +48,9 @@ export class VendorProduct {
|
|
|
43
48
|
product.brand = raw.brand ?? null;
|
|
44
49
|
product.url = raw.url ?? null;
|
|
45
50
|
product.sku = raw.sku ?? null;
|
|
51
|
+
product.manufacturerPartNumber = raw.manufacturer_part_number ?? null;
|
|
52
|
+
product.variantGroup = raw.variant_group ?? null;
|
|
53
|
+
product.variantAxes = raw.variant_axes ?? null;
|
|
46
54
|
product.currency = raw.currency ?? null;
|
|
47
55
|
product.price = toNumber(raw.price);
|
|
48
56
|
product.originalPrice = toNumber(raw.original_price);
|
|
@@ -49,20 +49,25 @@ export class VendorProductEndpoint extends Endpoint {
|
|
|
49
49
|
}
|
|
50
50
|
/** Create a new vendor product. */
|
|
51
51
|
async save(product) {
|
|
52
|
-
//
|
|
52
|
+
// Sent verbatim: the formatter recurses into `properties` and `variant_axes`, and its
|
|
53
|
+
// snake_caser treats every capital as a word boundary (`EAN` -> `_e_a_n`).
|
|
53
54
|
const body = {
|
|
55
|
+
_formatted: true,
|
|
54
56
|
name: product.name,
|
|
55
57
|
image: product.image,
|
|
56
58
|
identifier: product.identifier,
|
|
57
59
|
gtin: product.gtin,
|
|
58
60
|
sku: product.sku,
|
|
61
|
+
manufacturer_part_number: product.manufacturerPartNumber,
|
|
62
|
+
variant_group: product.variantGroup,
|
|
63
|
+
variant_axes: product.variantAxes,
|
|
59
64
|
brand: product.brand,
|
|
60
65
|
url: product.url,
|
|
61
66
|
currency: product.currency,
|
|
62
67
|
price: product.price,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
original_price: product.originalPrice,
|
|
69
|
+
shipping_cost: product.shippingCost,
|
|
70
|
+
stock_status: product.stockStatus,
|
|
66
71
|
properties: product.properties,
|
|
67
72
|
};
|
|
68
73
|
const result = await this.requestObject(path('/pulse/vendors/:vendorId/products', { vendorId: product.vendorId }), body, VendorProduct.parse, 'POST');
|
|
@@ -81,9 +86,14 @@ export class VendorProductEndpoint extends Endpoint {
|
|
|
81
86
|
{ op: 'add', path: 'gtin', value: product.gtin },
|
|
82
87
|
{ op: 'add', path: 'image', value: product.image },
|
|
83
88
|
{ op: 'add', path: 'sku', value: product.sku },
|
|
89
|
+
{ op: 'add', path: 'manufacturer_part_number', value: product.manufacturerPartNumber },
|
|
90
|
+
{ op: 'add', path: 'variant_group', value: product.variantGroup },
|
|
91
|
+
{ op: 'add', path: 'variant_axes', value: product.variantAxes },
|
|
84
92
|
{ op: 'add', path: 'currency', value: product.currency },
|
|
85
93
|
{ op: 'add', path: 'properties', value: product.properties },
|
|
86
94
|
];
|
|
95
|
+
// Already in wire shape; see the note in save().
|
|
96
|
+
operations._formatted = true;
|
|
87
97
|
if (product.id === null) {
|
|
88
98
|
throw new Error('Unable to update vendor product: the product has no id. Save it first.');
|
|
89
99
|
}
|
|
@@ -4,5 +4,9 @@ export declare class SourcesAccountRepository {
|
|
|
4
4
|
name: string;
|
|
5
5
|
url: string;
|
|
6
6
|
description: string;
|
|
7
|
+
/** Last push/commit, as the code host reports it. Null where the host gives none. */
|
|
8
|
+
lastActivityAt: Date | null;
|
|
9
|
+
/** The code host's default branch. */
|
|
10
|
+
defaultBranch: string | null;
|
|
7
11
|
static parse(rawSourcesAccountRepository: ApiRecord): SourcesAccountRepository;
|
|
8
12
|
}
|
|
@@ -1,14 +1,21 @@
|
|
|
1
|
+
import { Utils } from '../../Utils.js';
|
|
1
2
|
export class SourcesAccountRepository {
|
|
2
3
|
key;
|
|
3
4
|
name;
|
|
4
5
|
url;
|
|
5
6
|
description;
|
|
7
|
+
/** Last push/commit, as the code host reports it. Null where the host gives none. */
|
|
8
|
+
lastActivityAt = null;
|
|
9
|
+
/** The code host's default branch. */
|
|
10
|
+
defaultBranch = null;
|
|
6
11
|
static parse(rawSourcesAccountRepository) {
|
|
7
12
|
const sourcesAccountRepository = new SourcesAccountRepository();
|
|
8
13
|
sourcesAccountRepository.key = rawSourcesAccountRepository.key;
|
|
9
14
|
sourcesAccountRepository.name = rawSourcesAccountRepository.name;
|
|
10
15
|
sourcesAccountRepository.url = rawSourcesAccountRepository.url;
|
|
11
16
|
sourcesAccountRepository.description = rawSourcesAccountRepository.description;
|
|
17
|
+
sourcesAccountRepository.lastActivityAt = (rawSourcesAccountRepository.last_activity_at === null || rawSourcesAccountRepository.last_activity_at === undefined) ? null : Utils.parseRawDate(rawSourcesAccountRepository.last_activity_at);
|
|
18
|
+
sourcesAccountRepository.defaultBranch = rawSourcesAccountRepository.default_branch ?? null;
|
|
12
19
|
return sourcesAccountRepository;
|
|
13
20
|
}
|
|
14
21
|
}
|
|
@@ -11,6 +11,7 @@ export declare abstract class Endpoint {
|
|
|
11
11
|
* id-stripped convention (see {@link formatParameters}). A caller that has already shaped the
|
|
12
12
|
* body — or that carries an opaque payload whose keys must NOT be rewritten, such as a flow
|
|
13
13
|
* run's `arguments` — sets `_formatted: true`; then the body is sent verbatim (minus the marker).
|
|
14
|
+
* A JSON-patch body is an array, so it carries the marker as a property rather than a key.
|
|
14
15
|
*/
|
|
15
16
|
private prepareParameters;
|
|
16
17
|
private formatParameters;
|
package/dist/Service/Endpoint.js
CHANGED
|
@@ -17,9 +17,13 @@ export class Endpoint {
|
|
|
17
17
|
* id-stripped convention (see {@link formatParameters}). A caller that has already shaped the
|
|
18
18
|
* body — or that carries an opaque payload whose keys must NOT be rewritten, such as a flow
|
|
19
19
|
* run's `arguments` — sets `_formatted: true`; then the body is sent verbatim (minus the marker).
|
|
20
|
+
* A JSON-patch body is an array, so it carries the marker as a property rather than a key.
|
|
20
21
|
*/
|
|
21
22
|
prepareParameters(parameters) {
|
|
22
23
|
if (parameters !== null && typeof parameters === 'object' && parameters._formatted === true) {
|
|
24
|
+
if (Array.isArray(parameters)) {
|
|
25
|
+
return [...parameters];
|
|
26
|
+
}
|
|
23
27
|
const { _formatted, ...rest } = parameters;
|
|
24
28
|
return rest;
|
|
25
29
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.121.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "1.
|
|
1
|
+
export const VERSION = "1.121.0";
|