@attlaz/client 1.121.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/Service/VendorProductEndpoint.js +9 -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
|
@@ -49,8 +49,10 @@ 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,
|
|
@@ -63,9 +65,9 @@ export class VendorProductEndpoint extends Endpoint {
|
|
|
63
65
|
url: product.url,
|
|
64
66
|
currency: product.currency,
|
|
65
67
|
price: product.price,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
original_price: product.originalPrice,
|
|
69
|
+
shipping_cost: product.shippingCost,
|
|
70
|
+
stock_status: product.stockStatus,
|
|
69
71
|
properties: product.properties,
|
|
70
72
|
};
|
|
71
73
|
const result = await this.requestObject(path('/pulse/vendors/:vendorId/products', { vendorId: product.vendorId }), body, VendorProduct.parse, 'POST');
|
|
@@ -86,9 +88,12 @@ export class VendorProductEndpoint extends Endpoint {
|
|
|
86
88
|
{ op: 'add', path: 'sku', value: product.sku },
|
|
87
89
|
{ op: 'add', path: 'manufacturer_part_number', value: product.manufacturerPartNumber },
|
|
88
90
|
{ op: 'add', path: 'variant_group', value: product.variantGroup },
|
|
91
|
+
{ op: 'add', path: 'variant_axes', value: product.variantAxes },
|
|
89
92
|
{ op: 'add', path: 'currency', value: product.currency },
|
|
90
93
|
{ op: 'add', path: 'properties', value: product.properties },
|
|
91
94
|
];
|
|
95
|
+
// Already in wire shape; see the note in save().
|
|
96
|
+
operations._formatted = true;
|
|
92
97
|
if (product.id === null) {
|
|
93
98
|
throw new Error('Unable to update vendor product: the product has no id. Save it first.');
|
|
94
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";
|