@attlaz/client 1.129.0 → 1.130.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/MarketPositionSummary.d.ts +18 -0
- package/dist/MarketPulse/Model/MarketPositionSummary.js +29 -0
- package/dist/MarketPulse/Model/PriceIndexSnapshotEntry.js +1 -1
- package/dist/MarketPulse/Service/PulseStatisticsEndpoint.d.ts +3 -0
- package/dist/MarketPulse/Service/PulseStatisticsEndpoint.js +6 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ApiRecord } from '../../Model/ApiRecord.js';
|
|
2
|
+
import { PositionBucket } from './PositionBucket.js';
|
|
3
|
+
/**
|
|
4
|
+
* The catalog against the market — `/pulse/catalogs/:catalogId/market-positions/summary`: how many
|
|
5
|
+
* products can be compared at all, where the compared ones stand, and how old the competitor prices
|
|
6
|
+
* behind it are.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MarketPositionSummary {
|
|
9
|
+
productCount: number;
|
|
10
|
+
/** Products with at least one counted competitor in the latest recompute. */
|
|
11
|
+
comparedCount: number;
|
|
12
|
+
bucketCounts: Record<PositionBucket, number>;
|
|
13
|
+
computedAt: Date | null;
|
|
14
|
+
/** When the counted competitor products were last seen by a crawl: the age of the prices compared. */
|
|
15
|
+
pricesSeenFrom: Date | null;
|
|
16
|
+
pricesSeenTo: Date | null;
|
|
17
|
+
static parse(raw: ApiRecord): MarketPositionSummary;
|
|
18
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { POSITION_BUCKETS } from './PositionBucket.js';
|
|
2
|
+
/**
|
|
3
|
+
* The catalog against the market — `/pulse/catalogs/:catalogId/market-positions/summary`: how many
|
|
4
|
+
* products can be compared at all, where the compared ones stand, and how old the competitor prices
|
|
5
|
+
* behind it are.
|
|
6
|
+
*/
|
|
7
|
+
export class MarketPositionSummary {
|
|
8
|
+
productCount = 0;
|
|
9
|
+
/** Products with at least one counted competitor in the latest recompute. */
|
|
10
|
+
comparedCount = 0;
|
|
11
|
+
bucketCounts = { very_sharp: 0, sharp: 0, market_rate: 0, expensive: 0, much_more_expensive: 0 };
|
|
12
|
+
computedAt = null;
|
|
13
|
+
/** When the counted competitor products were last seen by a crawl: the age of the prices compared. */
|
|
14
|
+
pricesSeenFrom = null;
|
|
15
|
+
pricesSeenTo = null;
|
|
16
|
+
static parse(raw) {
|
|
17
|
+
const summary = new MarketPositionSummary();
|
|
18
|
+
summary.productCount = Number(raw.product_count ?? 0);
|
|
19
|
+
summary.comparedCount = Number(raw.compared_count ?? 0);
|
|
20
|
+
const buckets = raw.bucket_counts ?? {};
|
|
21
|
+
for (const bucket of POSITION_BUCKETS) {
|
|
22
|
+
summary.bucketCounts[bucket] = Number(buckets[bucket] ?? 0);
|
|
23
|
+
}
|
|
24
|
+
summary.computedAt = raw.computed_at ? new Date(raw.computed_at) : null;
|
|
25
|
+
summary.pricesSeenFrom = raw.prices_seen_from ? new Date(raw.prices_seen_from) : null;
|
|
26
|
+
summary.pricesSeenTo = raw.prices_seen_to ? new Date(raw.prices_seen_to) : null;
|
|
27
|
+
return summary;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -15,7 +15,7 @@ export class PriceIndexSnapshotEntry {
|
|
|
15
15
|
this.competitorId = competitorId;
|
|
16
16
|
}
|
|
17
17
|
static parse(raw) {
|
|
18
|
-
const entry = new PriceIndexSnapshotEntry(raw.date, raw.
|
|
18
|
+
const entry = new PriceIndexSnapshotEntry(raw.date, raw.competitor);
|
|
19
19
|
entry.priceIndex = Number(raw.price_index ?? 0);
|
|
20
20
|
entry.matchCount = Number(raw.match_count ?? 0);
|
|
21
21
|
return entry;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CatalogId } from '../../Catalog/Model/CatalogId.js';
|
|
2
2
|
import { CollectionResult } from '../../Model/Result/CollectionResult.js';
|
|
3
3
|
import { Endpoint } from '../../Service/Endpoint.js';
|
|
4
|
+
import { MarketPositionSummary } from '../Model/MarketPositionSummary.js';
|
|
4
5
|
import { MarketSummaryEntry } from '../Model/MarketSummaryEntry.js';
|
|
5
6
|
import { PriceIndexSnapshotEntry } from '../Model/PriceIndexSnapshotEntry.js';
|
|
6
7
|
import { ProductSegmentType } from '../Model/ProductSegmentType.js';
|
|
@@ -11,6 +12,8 @@ import { TopCompetitor } from '../Model/TopCompetitor.js';
|
|
|
11
12
|
* These are precomputed server-side; `CatalogProductEndpoint.recomputeStatistics` refreshes them.
|
|
12
13
|
*/
|
|
13
14
|
export declare class PulseStatisticsEndpoint extends Endpoint {
|
|
15
|
+
/** The catalog against the market: coverage, where the compared products stand, and the price date. */
|
|
16
|
+
getMarketPositionSummary(catalogId: CatalogId | string): Promise<MarketPositionSummary>;
|
|
14
17
|
/** Headline figures (products tracked, matches, competitors …) against the previous period. */
|
|
15
18
|
getAccountSummary(catalogId: CatalogId | string): Promise<CollectionResult<MarketSummaryEntry>>;
|
|
16
19
|
/** Distribution of the catalog's products across price or profit segments. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { path } from '../../Http/Data/Path.js';
|
|
2
2
|
import { QueryString } from '../../Http/Data/QueryString.js';
|
|
3
3
|
import { Endpoint } from '../../Service/Endpoint.js';
|
|
4
|
+
import { MarketPositionSummary } from '../Model/MarketPositionSummary.js';
|
|
4
5
|
import { PriceIndexSnapshotEntry } from '../Model/PriceIndexSnapshotEntry.js';
|
|
5
6
|
import { TopCompetitor } from '../Model/TopCompetitor.js';
|
|
6
7
|
/**
|
|
@@ -8,6 +9,11 @@ import { TopCompetitor } from '../Model/TopCompetitor.js';
|
|
|
8
9
|
* These are precomputed server-side; `CatalogProductEndpoint.recomputeStatistics` refreshes them.
|
|
9
10
|
*/
|
|
10
11
|
export class PulseStatisticsEndpoint extends Endpoint {
|
|
12
|
+
/** The catalog against the market: coverage, where the compared products stand, and the price date. */
|
|
13
|
+
async getMarketPositionSummary(catalogId) {
|
|
14
|
+
const result = await this.requestObject(path('/pulse/catalogs/:catalogId/market-positions/summary', { catalogId: catalogId.toString() }), null, MarketPositionSummary.parse, 'GET');
|
|
15
|
+
return result.getData() ?? new MarketPositionSummary();
|
|
16
|
+
}
|
|
11
17
|
/** Headline figures (products tracked, matches, competitors …) against the previous period. */
|
|
12
18
|
async getAccountSummary(catalogId) {
|
|
13
19
|
return await this.requestCollection(path('/pulse/catalogs/:catalogId/statistics/account-summary', { catalogId: catalogId.toString() }), (raw) => ({
|
package/dist/index.d.ts
CHANGED
|
@@ -117,6 +117,7 @@ export { ProductMatchEndpoint } from './MarketPulse/Service/ProductMatchEndpoint
|
|
|
117
117
|
export { PulseCatalogProductFilterOptions } from './MarketPulse/Model/PulseCatalogProductFilterOptions.js';
|
|
118
118
|
export { PulseCatalogProductFilters } from './MarketPulse/Model/PulseCatalogProductFilters.js';
|
|
119
119
|
export { POSITION_BUCKETS, PositionBucket } from './MarketPulse/Model/PositionBucket.js';
|
|
120
|
+
export { MarketPositionSummary } from './MarketPulse/Model/MarketPositionSummary.js';
|
|
120
121
|
export { PulseCatalogProductEndpoint } from './MarketPulse/Service/PulseCatalogProductEndpoint.js';
|
|
121
122
|
export { PriceAlertConfig } from './MarketPulse/Model/PriceAlertConfig.js';
|
|
122
123
|
export { PriceAlertEvent } from './MarketPulse/Model/PriceAlertEvent.js';
|
package/dist/index.js
CHANGED
|
@@ -95,6 +95,7 @@ export { TopCompetitor } from './MarketPulse/Model/TopCompetitor.js';
|
|
|
95
95
|
export { PriceIndexSnapshotEntry } from './MarketPulse/Model/PriceIndexSnapshotEntry.js';
|
|
96
96
|
export { ProductMatchEndpoint } from './MarketPulse/Service/ProductMatchEndpoint.js';
|
|
97
97
|
export { POSITION_BUCKETS } from './MarketPulse/Model/PositionBucket.js';
|
|
98
|
+
export { MarketPositionSummary } from './MarketPulse/Model/MarketPositionSummary.js';
|
|
98
99
|
export { PulseCatalogProductEndpoint } from './MarketPulse/Service/PulseCatalogProductEndpoint.js';
|
|
99
100
|
export { PriceAlertConfig } from './MarketPulse/Model/PriceAlertConfig.js';
|
|
100
101
|
export { PriceAlertEvent } from './MarketPulse/Model/PriceAlertEvent.js';
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.129.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "1.
|
|
1
|
+
export const VERSION = "1.129.0";
|