@attlaz/client 1.96.0 → 1.98.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/Catalog/Service/CatalogEndpoint.js +2 -1
- package/dist/Catalog/Service/CatalogProductEndpoint.js +3 -2
- package/dist/Client.d.ts +16 -12
- package/dist/Client.js +22 -12
- package/dist/{EnhanceData → DataEnrichment}/Service/GenerateContentEndpoint.js +3 -2
- package/dist/DataQuality/Model/QualityReportEntity.d.ts +31 -0
- package/dist/DataQuality/Model/QualityReportEntity.js +44 -0
- package/dist/DataQuality/Model/QualityReportProblem.d.ts +22 -0
- package/dist/DataQuality/Model/QualityReportProblem.js +35 -0
- package/dist/DataQuality/Model/QualityReportResult.d.ts +9 -0
- package/dist/DataQuality/Model/QualityReportResult.js +14 -0
- package/dist/DataQuality/Model/QualityScan.d.ts +19 -0
- package/dist/DataQuality/Model/QualityScan.js +28 -0
- package/dist/DataQuality/Service/QualityEndpoint.d.ts +57 -0
- package/dist/DataQuality/Service/QualityEndpoint.js +107 -21
- package/dist/FeedManagement/Service/CatalogFeedEndpoint.js +2 -1
- package/dist/Flow/Service/FlowEndpoint.js +6 -5
- package/dist/Flow/Service/FlowRunEndpoint.js +8 -7
- package/dist/Flow/Service/FlowRunRequestEndpoint.js +2 -1
- package/dist/Flow/Service/FlowRunStatsEndpoint.js +2 -1
- package/dist/Helper/LoadAllHelper.js +7 -1
- package/dist/Http/Data/Path.d.ts +11 -0
- package/dist/Http/Data/Path.js +31 -0
- package/dist/Http/HttpClient.d.ts +8 -1
- package/dist/Http/HttpClient.js +21 -1
- package/dist/Http/OAuthClientOptions.d.ts +2 -0
- package/dist/Http/OAuthClientOptions.js +3 -0
- package/dist/Http/Transport/OAuthClient.d.ts +7 -0
- package/dist/Http/Transport/OAuthClient.js +31 -4
- package/dist/Logging/Service/LogEndpoint.d.ts +5 -1
- package/dist/Logging/Service/LogEndpoint.js +14 -8
- package/dist/{Pulse → MarketPulse}/Model/Competitor.d.ts +4 -3
- package/dist/{Pulse → MarketPulse}/Model/Competitor.js +6 -5
- package/dist/{Pulse → MarketPulse}/Model/MatchedVendorProduct.d.ts +6 -0
- package/dist/{Pulse → MarketPulse}/Model/MatchedVendorProduct.js +12 -0
- package/dist/{Pulse → MarketPulse}/Model/ReviewMatch.d.ts +8 -0
- package/dist/{Pulse → MarketPulse}/Model/ReviewMatch.js +5 -0
- package/dist/{Pulse → MarketPulse}/Model/TopCompetitor.d.ts +1 -1
- package/dist/{Pulse → MarketPulse}/Model/TopCompetitor.js +2 -2
- package/dist/MarketPulse/Model/Vendor.d.ts +21 -0
- package/dist/MarketPulse/Model/Vendor.js +30 -0
- package/dist/MarketPulse/Service/CompetitorEndpoint.d.ts +37 -0
- package/dist/MarketPulse/Service/CompetitorEndpoint.js +49 -0
- package/dist/{Pulse → MarketPulse}/Service/CrawlJobEndpoint.d.ts +1 -0
- package/dist/{Pulse → MarketPulse}/Service/CrawlJobEndpoint.js +8 -6
- package/dist/{Pulse → MarketPulse}/Service/IndexJobEndpoint.js +5 -4
- package/dist/{Pulse → MarketPulse}/Service/PriceAlertEndpoint.js +8 -7
- package/dist/{Pulse → MarketPulse}/Service/PricingEndpoint.js +9 -8
- package/dist/{Pulse → MarketPulse}/Service/ProductGroupEndpoint.js +4 -3
- package/dist/{Pulse → MarketPulse}/Service/ProductMatchEndpoint.js +6 -5
- package/dist/{Pulse → MarketPulse}/Service/ProductMatchJobEndpoint.js +5 -4
- package/dist/{Pulse → MarketPulse}/Service/PulseCatalogProductEndpoint.js +4 -3
- package/dist/{Pulse → MarketPulse}/Service/PulseStatisticsEndpoint.js +5 -4
- package/dist/MarketPulse/Service/VendorEndpoint.d.ts +26 -0
- package/dist/MarketPulse/Service/VendorEndpoint.js +33 -0
- package/dist/{Pulse → MarketPulse}/Service/VendorProductEndpoint.js +15 -7
- package/dist/Model/Component/Component.d.ts +18 -0
- package/dist/Model/Component/Component.js +16 -0
- package/dist/Model/Component/ComponentKind.d.ts +8 -0
- package/dist/Model/Component/ComponentKind.js +18 -0
- package/dist/Model/Component/ComponentStatus.d.ts +31 -0
- package/dist/Model/Component/ComponentStatus.js +31 -0
- package/dist/Model/Component/ComponentVersion.d.ts +16 -0
- package/dist/Model/Component/ComponentVersion.js +15 -0
- package/dist/Service/AccessTokenEndpoint.js +3 -2
- package/dist/Service/AdapterConnectionEndpoint.js +9 -8
- package/dist/Service/AdapterEndpoint.js +3 -2
- package/dist/Service/ChannelEndpoint.js +5 -4
- package/dist/Service/CodeDeployEndpoint.js +5 -4
- package/dist/Service/CodeSourceStrategiesEndpoint.js +3 -2
- package/dist/Service/CollectionsEndpoint.js +5 -4
- package/dist/Service/CommandExecutionEndpoint.js +2 -1
- package/dist/Service/ComponentEndpoint.d.ts +26 -0
- package/dist/Service/ComponentEndpoint.js +77 -0
- package/dist/Service/ConfigEndpoint.d.ts +6 -1
- package/dist/Service/ConfigEndpoint.js +9 -3
- package/dist/Service/ConfigurationEndpoint.js +5 -4
- package/dist/Service/HealthAlertEndpoint.js +3 -2
- package/dist/Service/PlatformEndpoint.js +3 -2
- package/dist/Service/PlatformLanguageEndpoint.js +2 -1
- package/dist/Service/ProjectEndpoint.js +3 -2
- package/dist/Service/ProjectEnvironmentEndpoint.js +3 -2
- package/dist/Service/ProviderTokenEndpoint.js +4 -3
- package/dist/Service/RunnerPoolEndpoint.js +5 -4
- package/dist/Service/SourcesAccountEndpoint.js +6 -5
- package/dist/Service/StorageEndpoint.js +8 -7
- package/dist/Service/SubscriberEndpoint.js +4 -3
- package/dist/Service/TriggerEndpoint.js +5 -4
- package/dist/Service/UserActionEndpoint.js +4 -3
- package/dist/Service/UserEndpoint.js +3 -2
- package/dist/Service/WorkspaceEndpoint.js +2 -1
- package/dist/Service/WorkspaceMemberEndpoint.js +5 -4
- package/dist/index.d.ts +55 -46
- package/dist/index.js +42 -33
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -2
- package/dist/Pulse/Model/Vendor.d.ts +0 -12
- package/dist/Pulse/Model/Vendor.js +0 -18
- package/dist/Pulse/Service/CompetitorEndpoint.d.ts +0 -15
- package/dist/Pulse/Service/CompetitorEndpoint.js +0 -23
- /package/dist/{EnhanceData → DataEnrichment}/Model/GenerateContentBatch.d.ts +0 -0
- /package/dist/{EnhanceData → DataEnrichment}/Model/GenerateContentBatch.js +0 -0
- /package/dist/{EnhanceData → DataEnrichment}/Model/GenerateContentBatchData.d.ts +0 -0
- /package/dist/{EnhanceData → DataEnrichment}/Model/GenerateContentBatchData.js +0 -0
- /package/dist/{EnhanceData → DataEnrichment}/Service/GenerateContentEndpoint.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/CatalogProductWithMatches.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/CatalogProductWithMatches.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/CompetingVendorProduct.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/CompetingVendorProduct.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/CrawlJob.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/CrawlJob.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/IndexJob.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/IndexJob.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/MarketSummaryEntry.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/MarketSummaryEntry.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/MatchHistory.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/MatchHistory.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/MatchHistoryBucket.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/MatchHistoryBucket.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/MatchHistoryInterval.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/MatchHistoryInterval.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PriceAlertConfig.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PriceAlertConfig.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PriceAlertConfigData.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PriceAlertConfigData.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PriceAlertEvent.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PriceAlertEvent.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PriceIndexSnapshotEntry.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PriceIndexSnapshotEntry.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PriceSuggestion.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PriceSuggestion.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PricingRule.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PricingRule.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PricingRuleData.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PricingRuleData.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/ProductGroup.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/ProductGroup.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/ProductGroupData.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/ProductGroupData.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/ProductMatch.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/ProductMatch.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/ProductMatchJob.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/ProductMatchJob.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/ProductSegmentType.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/ProductSegmentType.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/ProductsSegment.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/ProductsSegment.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PulseCatalogProductFilterOptions.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PulseCatalogProductFilterOptions.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PulseCatalogProductFilters.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/PulseCatalogProductFilters.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/ReviewMatchFilters.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/ReviewMatchFilters.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/VendorProduct.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/VendorProduct.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/VendorProductPriceHistoryEntry.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/VendorProductPriceHistoryEntry.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/VendorStatus.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Model/VendorStatus.js +0 -0
- /package/dist/{Pulse → MarketPulse}/Service/IndexJobEndpoint.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Service/PriceAlertEndpoint.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Service/PricingEndpoint.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Service/ProductGroupEndpoint.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Service/ProductMatchEndpoint.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Service/ProductMatchJobEndpoint.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Service/PulseCatalogProductEndpoint.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Service/PulseStatisticsEndpoint.d.ts +0 -0
- /package/dist/{Pulse → MarketPulse}/Service/VendorProductEndpoint.d.ts +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { path } from '../../Http/Data/Path.js';
|
|
1
2
|
import { QueryString } from '../../Http/Data/QueryString.js';
|
|
2
3
|
import { Log } from '../Model/Log.js';
|
|
3
4
|
import { LogStream } from '../Model/LogStream.js';
|
|
@@ -36,12 +37,13 @@ export class LogEndpoint extends Endpoint {
|
|
|
36
37
|
const strTags = arrTags.join(',');
|
|
37
38
|
arrQuery.push('tags=' + strTags);
|
|
38
39
|
}
|
|
39
|
-
const cmd = '/logstreams/'
|
|
40
|
+
const cmd = path('/logstreams/:logStreamId/logs/', { logStreamId: logQuery.logStreamId.toString() })
|
|
41
|
+
+ '?' + arrQuery.join('&');
|
|
40
42
|
const result = await this.requestCollection(cmd, Log.parse);
|
|
41
43
|
return result;
|
|
42
44
|
}
|
|
43
45
|
async getCursoredLogEntries(logStreamId, pagination, filter) {
|
|
44
|
-
const queryString = new QueryString('/logstreams/'
|
|
46
|
+
const queryString = new QueryString(path('/logstreams/:logStreamId/logs', { logStreamId: logStreamId.toString() }));
|
|
45
47
|
queryString.addPagination(pagination);
|
|
46
48
|
if (filter !== null && filter !== undefined) {
|
|
47
49
|
queryString.set('filter', JSON.stringify(filter));
|
|
@@ -51,7 +53,7 @@ export class LogEndpoint extends Endpoint {
|
|
|
51
53
|
}
|
|
52
54
|
async save(log) {
|
|
53
55
|
try {
|
|
54
|
-
const cmd = '/logstreams/'
|
|
56
|
+
const cmd = path('/logstreams/:logStream/logs', { logStream: log.logStream.toString() });
|
|
55
57
|
const result = await this.requestObject(cmd, log, Log.parse, 'POST');
|
|
56
58
|
const updatedLogEntry = result.getData();
|
|
57
59
|
if (updatedLogEntry === null) {
|
|
@@ -66,8 +68,12 @@ export class LogEndpoint extends Endpoint {
|
|
|
66
68
|
throw error;
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
/**
|
|
72
|
+
* The stream id was missing here: the path was built with the literal text `:streamId`, so every
|
|
73
|
+
* call requested `/logstreams/:streamId/logs/<id>` and could never have matched the route.
|
|
74
|
+
*/
|
|
75
|
+
async delete(logStreamId, logId) {
|
|
76
|
+
const cmd = path('/logstreams/:logStreamId/logs/:logId', { logStreamId, logId });
|
|
71
77
|
try {
|
|
72
78
|
const parser = (raw) => ({ deleted: raw.deleted });
|
|
73
79
|
const result = await this.requestObject(cmd, null, parser, 'DELETE');
|
|
@@ -86,7 +92,7 @@ export class LogEndpoint extends Endpoint {
|
|
|
86
92
|
}
|
|
87
93
|
}
|
|
88
94
|
async clear(logStreamId) {
|
|
89
|
-
const cmd = '/logstreams/'
|
|
95
|
+
const cmd = path('/logstreams/:logStreamId/clear', { logStreamId: logStreamId.toString() });
|
|
90
96
|
try {
|
|
91
97
|
const parser = (raw) => ({ cleared: raw.cleared });
|
|
92
98
|
const result = await this.requestObject(cmd, null, parser, 'POST');
|
|
@@ -106,7 +112,7 @@ export class LogEndpoint extends Endpoint {
|
|
|
106
112
|
}
|
|
107
113
|
async getInformation(logStreamId) {
|
|
108
114
|
try {
|
|
109
|
-
const url = '/logstreams/'
|
|
115
|
+
const url = path('/logstreams/:logStreamId/info', { logStreamId: logStreamId.toString() });
|
|
110
116
|
const result = await this.requestObject(url, null, LogStreamInformation.parse);
|
|
111
117
|
return result.getData();
|
|
112
118
|
}
|
|
@@ -118,7 +124,7 @@ export class LogEndpoint extends Endpoint {
|
|
|
118
124
|
}
|
|
119
125
|
}
|
|
120
126
|
async getByProject(projectId, pagination = null) {
|
|
121
|
-
const queryString = new QueryString('projects/'
|
|
127
|
+
const queryString = new QueryString(path('projects/:projectId/logstreams', { projectId }));
|
|
122
128
|
queryString.addPagination(pagination);
|
|
123
129
|
const parser = (raw) => new LogStream(new LogStreamId(raw.id), raw.name);
|
|
124
130
|
const result = await this.requestCollection(queryString, parser);
|
|
@@ -11,11 +11,12 @@ export declare class Competitor {
|
|
|
11
11
|
id: string;
|
|
12
12
|
vendorId: string;
|
|
13
13
|
name: string;
|
|
14
|
-
|
|
14
|
+
/** The competitor's storefront root, scheme included — e.g. `https://shop.com/nl`. */
|
|
15
|
+
url: string;
|
|
15
16
|
icon: string | null;
|
|
16
17
|
type: string | null;
|
|
17
|
-
/**
|
|
18
|
-
|
|
18
|
+
/** ISO 4217 code this storefront quotes prices in. */
|
|
19
|
+
currency: string | null;
|
|
19
20
|
matchCount: number;
|
|
20
21
|
productCount: number;
|
|
21
22
|
priceIndex: number;
|
|
@@ -10,11 +10,12 @@ export class Competitor {
|
|
|
10
10
|
id;
|
|
11
11
|
vendorId;
|
|
12
12
|
name;
|
|
13
|
-
|
|
13
|
+
/** The competitor's storefront root, scheme included — e.g. `https://shop.com/nl`. */
|
|
14
|
+
url = '';
|
|
14
15
|
icon = null;
|
|
15
16
|
type = null;
|
|
16
|
-
/**
|
|
17
|
-
|
|
17
|
+
/** ISO 4217 code this storefront quotes prices in. */
|
|
18
|
+
currency = null;
|
|
18
19
|
matchCount = 0;
|
|
19
20
|
productCount = 0;
|
|
20
21
|
priceIndex = 0;
|
|
@@ -28,10 +29,10 @@ export class Competitor {
|
|
|
28
29
|
}
|
|
29
30
|
static parse(raw) {
|
|
30
31
|
const competitor = new Competitor(raw.id, raw.vendor, raw.name ?? '');
|
|
31
|
-
competitor.
|
|
32
|
+
competitor.url = raw.url ?? '';
|
|
32
33
|
competitor.icon = raw.icon ?? null;
|
|
33
34
|
competitor.type = raw.type ?? null;
|
|
34
|
-
competitor.
|
|
35
|
+
competitor.currency = raw.currency ?? null;
|
|
35
36
|
competitor.matchCount = Number(raw.match_count ?? 0);
|
|
36
37
|
competitor.productCount = Number(raw.product_count ?? 0);
|
|
37
38
|
competitor.priceIndex = Number(raw.price_index ?? 0);
|
|
@@ -19,10 +19,16 @@ export declare class MatchedVendorProduct {
|
|
|
19
19
|
image: string | null;
|
|
20
20
|
brand: string | null;
|
|
21
21
|
gtin: string | null;
|
|
22
|
+
sku: string | null;
|
|
22
23
|
url: string | null;
|
|
23
24
|
price: number;
|
|
25
|
+
originalPrice: number | null;
|
|
26
|
+
/** ISO 4217. Null falls back to the vendor's currency — never assume EUR when rendering. */
|
|
27
|
+
currency: string | null;
|
|
24
28
|
shippingCost: number;
|
|
25
29
|
inStock: boolean | null;
|
|
30
|
+
/** The scraped attribute bag (category, tags, variant options). Keys are data, not schema. */
|
|
31
|
+
properties: Record<string, unknown> | null;
|
|
26
32
|
updatedAt: Date | null;
|
|
27
33
|
constructor(id: string);
|
|
28
34
|
static parse(raw: ApiRecord): MatchedVendorProduct;
|
|
@@ -18,10 +18,16 @@ export class MatchedVendorProduct {
|
|
|
18
18
|
image = null;
|
|
19
19
|
brand = null;
|
|
20
20
|
gtin = null;
|
|
21
|
+
sku = null;
|
|
21
22
|
url = null;
|
|
22
23
|
price = 0;
|
|
24
|
+
originalPrice = null;
|
|
25
|
+
/** ISO 4217. Null falls back to the vendor's currency — never assume EUR when rendering. */
|
|
26
|
+
currency = null;
|
|
23
27
|
shippingCost = 0;
|
|
24
28
|
inStock = null;
|
|
29
|
+
/** The scraped attribute bag (category, tags, variant options). Keys are data, not schema. */
|
|
30
|
+
properties = null;
|
|
25
31
|
updatedAt = null;
|
|
26
32
|
constructor(id) {
|
|
27
33
|
this.id = id;
|
|
@@ -38,10 +44,16 @@ export class MatchedVendorProduct {
|
|
|
38
44
|
product.image = raw.image ?? null;
|
|
39
45
|
product.brand = raw.brand ?? null;
|
|
40
46
|
product.gtin = raw.gtin ?? null;
|
|
47
|
+
product.sku = raw.sku ?? null;
|
|
41
48
|
product.url = raw.url ?? null;
|
|
42
49
|
product.price = parseFloat(raw.price) || 0;
|
|
50
|
+
product.originalPrice = raw.original_price === null || raw.original_price === undefined
|
|
51
|
+
? null
|
|
52
|
+
: parseFloat(raw.original_price);
|
|
53
|
+
product.currency = raw.currency ?? null;
|
|
43
54
|
product.shippingCost = parseFloat(raw.shipping_cost) || 0;
|
|
44
55
|
product.inStock = typeof raw.in_stock === 'boolean' ? raw.in_stock : null;
|
|
56
|
+
product.properties = raw.properties ?? null;
|
|
45
57
|
product.updatedAt = raw.updated ? new Date(raw.updated) : null;
|
|
46
58
|
return product;
|
|
47
59
|
}
|
|
@@ -6,11 +6,19 @@ export type ReviewProduct = {
|
|
|
6
6
|
name: string;
|
|
7
7
|
brand: string | null;
|
|
8
8
|
gtin: string | null;
|
|
9
|
+
sku: string | null;
|
|
9
10
|
price: number | null;
|
|
11
|
+
originalPrice: number | null;
|
|
12
|
+
/** ISO 4217. Null falls back to the vendor's currency — never assume EUR when rendering. */
|
|
13
|
+
currency: string | null;
|
|
14
|
+
shippingCost: number | null;
|
|
10
15
|
url: string | null;
|
|
11
16
|
image: string | null;
|
|
17
|
+
/** Lifted out of {@link properties} because the matcher scores against it. */
|
|
12
18
|
category: string | null;
|
|
13
19
|
inStock: boolean | null;
|
|
20
|
+
/** The scraped attribute bag (tags, variant options, …). Keys are data, not schema. */
|
|
21
|
+
properties: Record<string, unknown> | null;
|
|
14
22
|
};
|
|
15
23
|
/** The competitor side additionally names the vendor it came from. */
|
|
16
24
|
export type ReviewCompetitorProduct = ReviewProduct & {
|
|
@@ -45,11 +45,16 @@ export class ReviewMatch {
|
|
|
45
45
|
name: raw.name,
|
|
46
46
|
brand: raw.brand ?? null,
|
|
47
47
|
gtin: raw.gtin ?? null,
|
|
48
|
+
sku: raw.sku ?? null,
|
|
48
49
|
price: raw.price ?? null,
|
|
50
|
+
originalPrice: raw.original_price ?? null,
|
|
51
|
+
currency: raw.currency ?? null,
|
|
52
|
+
shippingCost: raw.shipping_cost ?? null,
|
|
49
53
|
url: raw.url ?? null,
|
|
50
54
|
image: raw.image ?? null,
|
|
51
55
|
category: raw.category ?? null,
|
|
52
56
|
inStock: typeof raw.in_stock === 'boolean' ? raw.in_stock : null,
|
|
57
|
+
properties: raw.properties ?? null,
|
|
53
58
|
};
|
|
54
59
|
}
|
|
55
60
|
}
|
|
@@ -9,7 +9,7 @@ export class TopCompetitor {
|
|
|
9
9
|
competitorId;
|
|
10
10
|
vendorId;
|
|
11
11
|
vendorName = '';
|
|
12
|
-
|
|
12
|
+
vendorUrl = '';
|
|
13
13
|
vendorIcon = null;
|
|
14
14
|
matchCount = 0;
|
|
15
15
|
productCount = 0;
|
|
@@ -26,7 +26,7 @@ export class TopCompetitor {
|
|
|
26
26
|
static parse(raw) {
|
|
27
27
|
const competitor = new TopCompetitor(raw.competitor, raw.vendor);
|
|
28
28
|
competitor.vendorName = raw.vendor_name ?? '';
|
|
29
|
-
competitor.
|
|
29
|
+
competitor.vendorUrl = raw.vendor_url ?? '';
|
|
30
30
|
competitor.vendorIcon = raw.vendor_icon ?? null;
|
|
31
31
|
competitor.matchCount = Number(raw.match_count ?? 0);
|
|
32
32
|
competitor.productCount = Number(raw.product_count ?? 0);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ApiRecord } from '../../Model/ApiRecord.js';
|
|
2
|
+
/**
|
|
3
|
+
* A shop whose products Market Pulse tracks — your own or a competitor's. It is the same entity in
|
|
4
|
+
* both roles; a {@link Competitor} is a vendor as one catalog watches it.
|
|
5
|
+
*
|
|
6
|
+
* One vendor is one storefront view: a single `url`, a single `currency`. A merchant selling in
|
|
7
|
+
* several markets is several vendors.
|
|
8
|
+
*/
|
|
9
|
+
export declare class Vendor {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
/** Storefront root, scheme included, no trailing slash — e.g. `https://shop.com/nl`. */
|
|
13
|
+
url: string;
|
|
14
|
+
icon: string | null;
|
|
15
|
+
/** ISO 4217 code this storefront quotes prices in. */
|
|
16
|
+
currency: string | null;
|
|
17
|
+
/** Platform hint used to pick a scrape strategy, e.g. `shopify`. */
|
|
18
|
+
type: string | null;
|
|
19
|
+
constructor(id: string, name: string);
|
|
20
|
+
static parse(raw: ApiRecord): Vendor;
|
|
21
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A shop whose products Market Pulse tracks — your own or a competitor's. It is the same entity in
|
|
3
|
+
* both roles; a {@link Competitor} is a vendor as one catalog watches it.
|
|
4
|
+
*
|
|
5
|
+
* One vendor is one storefront view: a single `url`, a single `currency`. A merchant selling in
|
|
6
|
+
* several markets is several vendors.
|
|
7
|
+
*/
|
|
8
|
+
export class Vendor {
|
|
9
|
+
id;
|
|
10
|
+
name;
|
|
11
|
+
/** Storefront root, scheme included, no trailing slash — e.g. `https://shop.com/nl`. */
|
|
12
|
+
url = '';
|
|
13
|
+
icon = null;
|
|
14
|
+
/** ISO 4217 code this storefront quotes prices in. */
|
|
15
|
+
currency = null;
|
|
16
|
+
/** Platform hint used to pick a scrape strategy, e.g. `shopify`. */
|
|
17
|
+
type = null;
|
|
18
|
+
constructor(id, name) {
|
|
19
|
+
this.id = id;
|
|
20
|
+
this.name = name;
|
|
21
|
+
}
|
|
22
|
+
static parse(raw) {
|
|
23
|
+
const vendor = new Vendor(raw.id, raw.name ?? '');
|
|
24
|
+
vendor.url = raw.url ?? '';
|
|
25
|
+
vendor.icon = raw.icon ?? null;
|
|
26
|
+
vendor.currency = raw.currency ?? null;
|
|
27
|
+
vendor.type = raw.type ?? null;
|
|
28
|
+
return vendor;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { CatalogId } from '../../Catalog/Model/CatalogId.js';
|
|
2
|
+
import { CursorPagination } from '../../Model/Pagination/CursorPagination.js';
|
|
3
|
+
import { CollectionResult } from '../../Model/Result/CollectionResult.js';
|
|
4
|
+
import { Endpoint } from '../../Service/Endpoint.js';
|
|
5
|
+
import { Competitor } from '../Model/Competitor.js';
|
|
6
|
+
/**
|
|
7
|
+
* The competitors a catalog is watched against — `/pulse/catalogs/:catalogId/competing-vendors`
|
|
8
|
+
* for the catalog's list, `/pulse/competing-vendors/:competitorId` for one.
|
|
9
|
+
*/
|
|
10
|
+
export declare class CompetitorEndpoint extends Endpoint {
|
|
11
|
+
getByCatalog(catalogId: CatalogId | string, pagination?: CursorPagination | null): Promise<CollectionResult<Competitor>>;
|
|
12
|
+
getById(competitorId: string): Promise<Competitor | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Start watching an existing vendor as a competitor of this catalog.
|
|
15
|
+
*
|
|
16
|
+
* The vendor must already exist — create it with {@link VendorEndpoint.create} first. Re-adding
|
|
17
|
+
* a previously removed competitor reactivates the original link, so its matches and price
|
|
18
|
+
* history survive.
|
|
19
|
+
*
|
|
20
|
+
* Returns the link itself (`id`, `catalog`, `vendor`), not the populated competitor; read it
|
|
21
|
+
* back with {@link getById} if you need the counts and timestamps.
|
|
22
|
+
*/
|
|
23
|
+
add(catalogId: CatalogId | string, vendorId: string): Promise<CompetitorLink | null>;
|
|
24
|
+
/**
|
|
25
|
+
* Stop watching a competitor.
|
|
26
|
+
*
|
|
27
|
+
* The vendor, its products and their price history are kept — only the catalog↔vendor link is
|
|
28
|
+
* retired, so {@link add} can resume it later.
|
|
29
|
+
*/
|
|
30
|
+
remove(catalogId: CatalogId | string, competitorId: string): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
/** The catalog↔vendor link row returned by {@link CompetitorEndpoint.add}. */
|
|
33
|
+
export type CompetitorLink = {
|
|
34
|
+
id: string;
|
|
35
|
+
catalogId: string;
|
|
36
|
+
vendorId: string;
|
|
37
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { path } from '../../Http/Data/Path.js';
|
|
2
|
+
import { QueryString } from '../../Http/Data/QueryString.js';
|
|
3
|
+
import { Endpoint } from '../../Service/Endpoint.js';
|
|
4
|
+
import { Competitor } from '../Model/Competitor.js';
|
|
5
|
+
/**
|
|
6
|
+
* The competitors a catalog is watched against — `/pulse/catalogs/:catalogId/competing-vendors`
|
|
7
|
+
* for the catalog's list, `/pulse/competing-vendors/:competitorId` for one.
|
|
8
|
+
*/
|
|
9
|
+
export class CompetitorEndpoint extends Endpoint {
|
|
10
|
+
async getByCatalog(catalogId, pagination = null) {
|
|
11
|
+
const queryString = new QueryString(path('/pulse/catalogs/:catalogId/competing-vendors', { catalogId: catalogId.toString() }));
|
|
12
|
+
queryString.addPagination(pagination);
|
|
13
|
+
return await this.requestCollection(queryString, Competitor.parse);
|
|
14
|
+
}
|
|
15
|
+
async getById(competitorId) {
|
|
16
|
+
const result = await this.requestObject(path('/pulse/competing-vendors/:competitorId', { competitorId }), null, Competitor.parse, 'GET');
|
|
17
|
+
return result.getData();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Start watching an existing vendor as a competitor of this catalog.
|
|
21
|
+
*
|
|
22
|
+
* The vendor must already exist — create it with {@link VendorEndpoint.create} first. Re-adding
|
|
23
|
+
* a previously removed competitor reactivates the original link, so its matches and price
|
|
24
|
+
* history survive.
|
|
25
|
+
*
|
|
26
|
+
* Returns the link itself (`id`, `catalog`, `vendor`), not the populated competitor; read it
|
|
27
|
+
* back with {@link getById} if you need the counts and timestamps.
|
|
28
|
+
*/
|
|
29
|
+
async add(catalogId, vendorId) {
|
|
30
|
+
const result = await this.requestObject(path('/pulse/catalogs/:catalogId/competing-vendors', { catalogId: catalogId.toString() }), { vendor: vendorId }, (raw) => ({
|
|
31
|
+
id: raw.id,
|
|
32
|
+
catalogId: raw.catalog,
|
|
33
|
+
vendorId: raw.vendor,
|
|
34
|
+
}), 'POST');
|
|
35
|
+
return result.getData();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Stop watching a competitor.
|
|
39
|
+
*
|
|
40
|
+
* The vendor, its products and their price history are kept — only the catalog↔vendor link is
|
|
41
|
+
* retired, so {@link add} can resume it later.
|
|
42
|
+
*/
|
|
43
|
+
async remove(catalogId, competitorId) {
|
|
44
|
+
await this.requestObject(path('/pulse/catalogs/:catalogId/competing-vendors/:competitorId', {
|
|
45
|
+
catalogId: catalogId.toString(),
|
|
46
|
+
competitorId,
|
|
47
|
+
}), null, (raw) => raw, 'DELETE');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -32,5 +32,6 @@ export declare class CrawlJobEndpoint extends Endpoint {
|
|
|
32
32
|
markPagesParsed(crawlJobId: string, urls: string[]): Promise<void>;
|
|
33
33
|
/** Mark pages as failed (terminal, e.g. blocked/unfetchable). */
|
|
34
34
|
markPagesFailed(crawlJobId: string, urls: string[]): Promise<void>;
|
|
35
|
+
/** @param suffix a literal trailing segment, e.g. `/pages/crawled` — not caller data. */
|
|
35
36
|
private postUrls;
|
|
36
37
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { path } from '../../Http/Data/Path.js';
|
|
1
2
|
import { QueryString } from '../../Http/Data/QueryString.js';
|
|
2
3
|
import { CrawlJob } from '../Model/CrawlJob.js';
|
|
3
4
|
import { Endpoint } from '../../Service/Endpoint.js';
|
|
@@ -18,7 +19,7 @@ export class CrawlJobEndpoint extends Endpoint {
|
|
|
18
19
|
}
|
|
19
20
|
/** Update a crawl job's status ('started', 'finished', 'cancelled'). */
|
|
20
21
|
async updateStatus(crawlJobId, status) {
|
|
21
|
-
const result = await this.requestObject('/pulse/crawl-jobs
|
|
22
|
+
const result = await this.requestObject(path('/pulse/crawl-jobs/:crawlJobId', { crawlJobId }), { status }, CrawlJob.parse, 'PATCH');
|
|
22
23
|
const job = result.getData();
|
|
23
24
|
if (job === null) {
|
|
24
25
|
throw new Error('Unable to update crawl job: empty response');
|
|
@@ -27,7 +28,7 @@ export class CrawlJobEndpoint extends Endpoint {
|
|
|
27
28
|
}
|
|
28
29
|
/** A vendor's crawl jobs (newest first), each with progress (`total` / `processed`). */
|
|
29
30
|
async getByVendor(vendorId, pagination = null) {
|
|
30
|
-
const queryString = new QueryString('/pulse/vendors/'
|
|
31
|
+
const queryString = new QueryString(path('/pulse/vendors/:vendorId/crawl-jobs', { vendorId }));
|
|
31
32
|
queryString.addPagination(pagination);
|
|
32
33
|
return await this.requestCollection(queryString, CrawlJob.parse);
|
|
33
34
|
}
|
|
@@ -38,13 +39,13 @@ export class CrawlJobEndpoint extends Endpoint {
|
|
|
38
39
|
* and returns the jobs of their vendors.
|
|
39
40
|
*/
|
|
40
41
|
async getByCatalog(catalogId, pagination = null) {
|
|
41
|
-
const queryString = new QueryString('/pulse/catalogs/'
|
|
42
|
+
const queryString = new QueryString(path('/pulse/catalogs/:catalogId/crawl-jobs', { catalogId: catalogId.toString() }));
|
|
42
43
|
queryString.addPagination(pagination);
|
|
43
44
|
return await this.requestCollection(queryString, CrawlJob.parse);
|
|
44
45
|
}
|
|
45
46
|
/** The crawl job with this id, or null. */
|
|
46
47
|
async getById(crawlJobId) {
|
|
47
|
-
const result = await this.requestObject('/pulse/crawl-jobs
|
|
48
|
+
const result = await this.requestObject(path('/pulse/crawl-jobs/:crawlJobId', { crawlJobId }), null, CrawlJob.parse, 'GET');
|
|
48
49
|
return result.getData();
|
|
49
50
|
}
|
|
50
51
|
/** Register the pages this crawl will process (idempotent server-side). */
|
|
@@ -63,10 +64,11 @@ export class CrawlJobEndpoint extends Endpoint {
|
|
|
63
64
|
async markPagesFailed(crawlJobId, urls) {
|
|
64
65
|
await this.postUrls(crawlJobId, '/pages/failed', urls);
|
|
65
66
|
}
|
|
66
|
-
|
|
67
|
+
/** @param suffix a literal trailing segment, e.g. `/pages/crawled` — not caller data. */
|
|
68
|
+
async postUrls(crawlJobId, suffix, urls) {
|
|
67
69
|
if (urls.length === 0) {
|
|
68
70
|
return;
|
|
69
71
|
}
|
|
70
|
-
await this.requestObject('/pulse/crawl-jobs
|
|
72
|
+
await this.requestObject(path('/pulse/crawl-jobs/:crawlJobId', { crawlJobId }) + suffix, { urls }, (raw) => raw, 'POST');
|
|
71
73
|
}
|
|
72
74
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { path } from '../../Http/Data/Path.js';
|
|
1
2
|
import { QueryString } from '../../Http/Data/QueryString.js';
|
|
2
3
|
import { Endpoint } from '../../Service/Endpoint.js';
|
|
3
4
|
import { IndexJob } from '../Model/IndexJob.js';
|
|
@@ -9,23 +10,23 @@ import { VendorStatus } from '../Model/VendorStatus.js';
|
|
|
9
10
|
export class IndexJobEndpoint extends Endpoint {
|
|
10
11
|
/** Index jobs across every competitor of a catalog, newest first. */
|
|
11
12
|
async getByCatalog(catalogId, pagination = null) {
|
|
12
|
-
const queryString = new QueryString('/pulse/catalogs/'
|
|
13
|
+
const queryString = new QueryString(path('/pulse/catalogs/:catalogId/index-jobs', { catalogId: catalogId.toString() }));
|
|
13
14
|
queryString.addPagination(pagination);
|
|
14
15
|
return await this.requestCollection(queryString, IndexJob.parse);
|
|
15
16
|
}
|
|
16
17
|
/** Index jobs of one competitor. */
|
|
17
18
|
async getByVendor(catalogId, vendorId, pagination = null) {
|
|
18
|
-
const queryString = new QueryString('/pulse/catalogs/'
|
|
19
|
+
const queryString = new QueryString(path('/pulse/catalogs/:catalogId/vendors/:vendorId/index-jobs', { catalogId: catalogId.toString(), vendorId }));
|
|
19
20
|
queryString.addPagination(pagination);
|
|
20
21
|
return await this.requestCollection(queryString, IndexJob.parse);
|
|
21
22
|
}
|
|
22
23
|
/** Queue a re-index of a competitor's products, so later matching sees current data. */
|
|
23
24
|
async requestReindex(catalogId, vendorId) {
|
|
24
|
-
await this.requestObject('/pulse/catalogs/'
|
|
25
|
+
await this.requestObject(path('/pulse/catalogs/:catalogId/vendors/:vendorId/reindex', { catalogId: catalogId.toString(), vendorId }), {}, (raw) => raw, 'POST');
|
|
25
26
|
}
|
|
26
27
|
/** How fresh a competitor's index and matches are, plus any match job running right now. */
|
|
27
28
|
async getVendorStatus(catalogId, vendorId) {
|
|
28
|
-
const result = await this.requestObject('/pulse/catalogs/'
|
|
29
|
+
const result = await this.requestObject(path('/pulse/catalogs/:catalogId/vendors/:vendorId/status', { catalogId: catalogId.toString(), vendorId }), null, VendorStatus.parse, 'GET');
|
|
29
30
|
return result.getData();
|
|
30
31
|
}
|
|
31
32
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { path } from '../../Http/Data/Path.js';
|
|
1
2
|
import { QueryString } from '../../Http/Data/QueryString.js';
|
|
2
3
|
import { Endpoint } from '../../Service/Endpoint.js';
|
|
3
4
|
import { PriceAlertConfig } from '../Model/PriceAlertConfig.js';
|
|
@@ -7,27 +8,27 @@ import { PriceAlertEvent } from '../Model/PriceAlertEvent.js';
|
|
|
7
8
|
*/
|
|
8
9
|
export class PriceAlertEndpoint extends Endpoint {
|
|
9
10
|
async getConfigs(catalogId, pagination = null) {
|
|
10
|
-
const queryString = new QueryString('/pulse/catalogs/'
|
|
11
|
+
const queryString = new QueryString(path('/pulse/catalogs/:catalogId/price-alert-configs', { catalogId: catalogId.toString() }));
|
|
11
12
|
queryString.addPagination(pagination);
|
|
12
13
|
return await this.requestCollection(queryString, PriceAlertConfig.parse);
|
|
13
14
|
}
|
|
14
15
|
async getConfig(alertConfigId) {
|
|
15
|
-
const result = await this.requestObject('/pulse/price-alert-configs
|
|
16
|
+
const result = await this.requestObject(path('/pulse/price-alert-configs/:alertConfigId', { alertConfigId }), null, PriceAlertConfig.parse, 'GET');
|
|
16
17
|
return result.getData();
|
|
17
18
|
}
|
|
18
19
|
async createConfig(catalogId, data) {
|
|
19
|
-
const result = await this.requestObject('/pulse/catalogs/'
|
|
20
|
+
const result = await this.requestObject(path('/pulse/catalogs/:catalogId/price-alert-configs', { catalogId: catalogId.toString() }), data, PriceAlertConfig.parse, 'POST');
|
|
20
21
|
return result.getData();
|
|
21
22
|
}
|
|
22
23
|
async updateConfig(alertConfigId, data) {
|
|
23
|
-
const result = await this.requestObject('/pulse/price-alert-configs
|
|
24
|
+
const result = await this.requestObject(path('/pulse/price-alert-configs/:alertConfigId', { alertConfigId }), data, PriceAlertConfig.parse, 'PATCH');
|
|
24
25
|
return result.getData();
|
|
25
26
|
}
|
|
26
27
|
async deleteConfig(alertConfigId) {
|
|
27
|
-
await this.requestObject('/pulse/price-alert-configs
|
|
28
|
+
await this.requestObject(path('/pulse/price-alert-configs/:alertConfigId', { alertConfigId }), null, (raw) => raw, 'DELETE');
|
|
28
29
|
}
|
|
29
30
|
async getEvents(alertConfigId, pagination = null) {
|
|
30
|
-
const queryString = new QueryString('/pulse/price-alert-configs/'
|
|
31
|
+
const queryString = new QueryString(path('/pulse/price-alert-configs/:alertConfigId/events', { alertConfigId }));
|
|
31
32
|
queryString.addPagination(pagination);
|
|
32
33
|
return await this.requestCollection(queryString, PriceAlertEvent.parse);
|
|
33
34
|
}
|
|
@@ -36,7 +37,7 @@ export class PriceAlertEndpoint extends Endpoint {
|
|
|
36
37
|
* when from the session, so the request carries no body.
|
|
37
38
|
*/
|
|
38
39
|
async acknowledgeEvent(alertEventId) {
|
|
39
|
-
const result = await this.requestObject('/pulse/price-alert-events
|
|
40
|
+
const result = await this.requestObject(path('/pulse/price-alert-events/:alertEventId', { alertEventId }), {}, PriceAlertEvent.parse, 'PATCH');
|
|
40
41
|
return result.getData();
|
|
41
42
|
}
|
|
42
43
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { path } from '../../Http/Data/Path.js';
|
|
1
2
|
import { QueryString } from '../../Http/Data/QueryString.js';
|
|
2
3
|
import { Endpoint } from '../../Service/Endpoint.js';
|
|
3
4
|
import { PriceSuggestion } from '../Model/PriceSuggestion.js';
|
|
@@ -8,28 +9,28 @@ import { PricingRule } from '../Model/PricingRule.js';
|
|
|
8
9
|
*/
|
|
9
10
|
export class PricingEndpoint extends Endpoint {
|
|
10
11
|
async getRules(catalogId, pagination = null) {
|
|
11
|
-
const queryString = new QueryString('/pulse/catalogs/'
|
|
12
|
+
const queryString = new QueryString(path('/pulse/catalogs/:catalogId/pricing-rules', { catalogId: catalogId.toString() }));
|
|
12
13
|
queryString.addPagination(pagination);
|
|
13
14
|
return await this.requestCollection(queryString, PricingRule.parse);
|
|
14
15
|
}
|
|
15
16
|
async getRule(pricingRuleId) {
|
|
16
|
-
const result = await this.requestObject('/pulse/pricing-rules
|
|
17
|
+
const result = await this.requestObject(path('/pulse/pricing-rules/:pricingRuleId', { pricingRuleId }), null, PricingRule.parse, 'GET');
|
|
17
18
|
return result.getData();
|
|
18
19
|
}
|
|
19
20
|
async createRule(catalogId, data) {
|
|
20
|
-
const result = await this.requestObject('/pulse/catalogs/'
|
|
21
|
+
const result = await this.requestObject(path('/pulse/catalogs/:catalogId/pricing-rules', { catalogId: catalogId.toString() }), data, PricingRule.parse, 'POST');
|
|
21
22
|
return result.getData();
|
|
22
23
|
}
|
|
23
24
|
async updateRule(pricingRuleId, data) {
|
|
24
|
-
const result = await this.requestObject('/pulse/pricing-rules
|
|
25
|
+
const result = await this.requestObject(path('/pulse/pricing-rules/:pricingRuleId', { pricingRuleId }), data, PricingRule.parse, 'PATCH');
|
|
25
26
|
return result.getData();
|
|
26
27
|
}
|
|
27
28
|
async deleteRule(pricingRuleId) {
|
|
28
|
-
await this.requestObject('/pulse/pricing-rules
|
|
29
|
+
await this.requestObject(path('/pulse/pricing-rules/:pricingRuleId', { pricingRuleId }), null, (raw) => raw, 'DELETE');
|
|
29
30
|
}
|
|
30
31
|
/** Price suggestions of a catalog, optionally only those in one status. */
|
|
31
32
|
async getSuggestions(catalogId, pagination = null, status = null) {
|
|
32
|
-
const queryString = new QueryString('/pulse/catalogs/'
|
|
33
|
+
const queryString = new QueryString(path('/pulse/catalogs/:catalogId/price-suggestions', { catalogId: catalogId.toString() }));
|
|
33
34
|
if (status !== null) {
|
|
34
35
|
queryString.set('status', status);
|
|
35
36
|
}
|
|
@@ -37,7 +38,7 @@ export class PricingEndpoint extends Endpoint {
|
|
|
37
38
|
return await this.requestCollection(queryString, PriceSuggestion.parse);
|
|
38
39
|
}
|
|
39
40
|
async getSuggestion(priceSuggestionId) {
|
|
40
|
-
const result = await this.requestObject('/pulse/price-suggestions
|
|
41
|
+
const result = await this.requestObject(path('/pulse/price-suggestions/:priceSuggestionId', { priceSuggestionId }), null, PriceSuggestion.parse, 'GET');
|
|
41
42
|
return result.getData();
|
|
42
43
|
}
|
|
43
44
|
/**
|
|
@@ -45,7 +46,7 @@ export class PricingEndpoint extends Endpoint {
|
|
|
45
46
|
* itself is done by a flow, which sets `appliedAt`.
|
|
46
47
|
*/
|
|
47
48
|
async reviewSuggestion(priceSuggestionId, status) {
|
|
48
|
-
const result = await this.requestObject('/pulse/price-suggestions
|
|
49
|
+
const result = await this.requestObject(path('/pulse/price-suggestions/:priceSuggestionId', { priceSuggestionId }), { status }, PriceSuggestion.parse, 'PATCH');
|
|
49
50
|
return result.getData();
|
|
50
51
|
}
|
|
51
52
|
}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
+
import { path } from '../../Http/Data/Path.js';
|
|
1
2
|
import { QueryString } from '../../Http/Data/QueryString.js';
|
|
2
3
|
import { Endpoint } from '../../Service/Endpoint.js';
|
|
3
4
|
import { ProductGroup } from '../Model/ProductGroup.js';
|
|
4
5
|
/** Product groups — `/pulse/catalogs/:catalogId/product-groups`. */
|
|
5
6
|
export class ProductGroupEndpoint extends Endpoint {
|
|
6
7
|
async getByCatalog(catalogId, pagination = null) {
|
|
7
|
-
const queryString = new QueryString('/pulse/catalogs/'
|
|
8
|
+
const queryString = new QueryString(path('/pulse/catalogs/:catalogId/product-groups', { catalogId: catalogId.toString() }));
|
|
8
9
|
queryString.addPagination(pagination);
|
|
9
10
|
return await this.requestCollection(queryString, ProductGroup.parse);
|
|
10
11
|
}
|
|
11
12
|
async getById(productGroupId) {
|
|
12
|
-
const result = await this.requestObject('/pulse/product-groups
|
|
13
|
+
const result = await this.requestObject(path('/pulse/product-groups/:productGroupId', { productGroupId }), null, ProductGroup.parse, 'GET');
|
|
13
14
|
return result.getData();
|
|
14
15
|
}
|
|
15
16
|
async create(catalogId, data) {
|
|
16
|
-
const result = await this.requestObject('/pulse/catalogs/'
|
|
17
|
+
const result = await this.requestObject(path('/pulse/catalogs/:catalogId/product-groups', { catalogId: catalogId.toString() }), data, ProductGroup.parse, 'POST');
|
|
17
18
|
return result.getData();
|
|
18
19
|
}
|
|
19
20
|
}
|