@texturehq/device 1.17.1 → 2.0.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/common/constants.d.ts +1 -1
- package/dist/common/constants.d.ts.map +1 -1
- package/dist/common/constants.js +1 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/fetch.d.ts +10 -0
- package/dist/common/fetch.d.ts.map +1 -0
- package/dist/common/fetch.js +39 -0
- package/dist/common/fetch.js.map +1 -0
- package/dist/common/supportLevel.d.ts +1 -1
- package/dist/deviceModel/entities.d.ts +6 -6
- package/dist/deviceModel/getDeviceModel/index.d.ts +5 -10
- package/dist/deviceModel/getDeviceModel/index.d.ts.map +1 -1
- package/dist/deviceModel/getDeviceModel/index.js +29 -21
- package/dist/deviceModel/getDeviceModel/index.js.map +1 -1
- package/dist/deviceModel/getDeviceModel/response.interfaces.d.ts +5 -94
- package/dist/deviceModel/getDeviceModel/response.interfaces.d.ts.map +1 -1
- package/dist/deviceModel/getDeviceModel/response.interfaces.js +0 -249
- package/dist/deviceModel/getDeviceModel/response.interfaces.js.map +1 -1
- package/dist/deviceModel/getDeviceModelByManufacturerSlug/index.d.ts +6 -11
- package/dist/deviceModel/getDeviceModelByManufacturerSlug/index.d.ts.map +1 -1
- package/dist/deviceModel/getDeviceModelByManufacturerSlug/index.js +30 -29
- package/dist/deviceModel/getDeviceModelByManufacturerSlug/index.js.map +1 -1
- package/dist/deviceModel/getDeviceModelByManufacturerSlug/response.interfaces.d.ts +5 -52
- package/dist/deviceModel/getDeviceModelByManufacturerSlug/response.interfaces.d.ts.map +1 -1
- package/dist/deviceModel/getDeviceModelByManufacturerSlug/response.interfaces.js +0 -207
- package/dist/deviceModel/getDeviceModelByManufacturerSlug/response.interfaces.js.map +1 -1
- package/dist/deviceModel/getDeviceModels/index.d.ts +5 -10
- package/dist/deviceModel/getDeviceModels/index.d.ts.map +1 -1
- package/dist/deviceModel/getDeviceModels/index.js +40 -27
- package/dist/deviceModel/getDeviceModels/index.js.map +1 -1
- package/dist/deviceModel/getDeviceModels/response.interfaces.d.ts +15 -84
- package/dist/deviceModel/getDeviceModels/response.interfaces.d.ts.map +1 -1
- package/dist/deviceModel/getDeviceModels/response.interfaces.js +0 -249
- package/dist/deviceModel/getDeviceModels/response.interfaces.js.map +1 -1
- package/dist/deviceModel/getDeviceModels/test.success.js +0 -1
- package/dist/deviceModel/getDeviceModels/test.success.js.map +1 -1
- package/dist/deviceState/battery.d.ts +1 -1
- package/dist/deviceState/battery.d.ts.map +1 -1
- package/dist/deviceState/battery.js +12 -6
- package/dist/deviceState/battery.js.map +1 -1
- package/dist/deviceState/charger.js +1 -1
- package/dist/deviceState/charger.js.map +1 -1
- package/dist/deviceState/common.d.ts +2 -2
- package/dist/deviceState/common.d.ts.map +1 -1
- package/dist/deviceState/common.js +4 -1
- package/dist/deviceState/common.js.map +1 -1
- package/dist/deviceState/inverter.d.ts +1 -1
- package/dist/deviceState/inverter.d.ts.map +1 -1
- package/dist/deviceState/inverter.js.map +1 -1
- package/dist/deviceState/thermostat.d.ts +9 -9
- package/dist/deviceState/vehicle.js +1 -1
- package/dist/deviceState/vehicle.js.map +1 -1
- package/dist/deviceType/entities.d.ts +3 -3
- package/dist/manufacturer/entities.d.ts +1 -1
- package/dist/manufacturer/getManufacturer/index.d.ts +7 -16
- package/dist/manufacturer/getManufacturer/index.d.ts.map +1 -1
- package/dist/manufacturer/getManufacturer/index.js +17 -19
- package/dist/manufacturer/getManufacturer/index.js.map +1 -1
- package/dist/manufacturer/getManufacturer/response.interfaces.d.ts +6 -76
- package/dist/manufacturer/getManufacturer/response.interfaces.d.ts.map +1 -1
- package/dist/manufacturer/getManufacturer/response.interfaces.js +0 -231
- package/dist/manufacturer/getManufacturer/response.interfaces.js.map +1 -1
- package/dist/manufacturer/getManufacturers/index.d.ts +4 -10
- package/dist/manufacturer/getManufacturers/index.d.ts.map +1 -1
- package/dist/manufacturer/getManufacturers/index.js +29 -18
- package/dist/manufacturer/getManufacturers/index.js.map +1 -1
- package/dist/manufacturer/getManufacturers/response.interfaces.d.ts +12 -74
- package/dist/manufacturer/getManufacturers/response.interfaces.d.ts.map +1 -1
- package/dist/manufacturer/getManufacturers/response.interfaces.js +0 -239
- package/dist/manufacturer/getManufacturers/response.interfaces.js.map +1 -1
- package/dist/manufacturer/getManufacturers/test.success.js +1 -1
- package/dist/manufacturer/getManufacturers/test.success.js.map +1 -1
- package/dist/manufacturer/parseManufacturer/index.d.ts +5 -2
- package/dist/manufacturer/parseManufacturer/index.d.ts.map +1 -1
- package/dist/manufacturer/parseManufacturer/index.js +18 -23
- package/dist/manufacturer/parseManufacturer/index.js.map +1 -1
- package/dist/metrics/aggregations.d.ts +2 -2
- package/package.json +1 -7
- package/dist/common/axios.d.ts +0 -3
- package/dist/common/axios.d.ts.map +0 -1
- package/dist/common/axios.js +0 -29
- package/dist/common/axios.js.map +0 -1
|
@@ -55,7 +55,7 @@ exports.VehicleStateSchema = v4_1.z.object({
|
|
|
55
55
|
* The wattage of the charger in watts (W).
|
|
56
56
|
* @example 7200
|
|
57
57
|
*/
|
|
58
|
-
chargerWattage: v4_1.z.number().min(0).max(
|
|
58
|
+
chargerWattage: v4_1.z.number().min(0).max(1_000_000).optional().describe("The wattage of the charger in watts (W)."),
|
|
59
59
|
/**
|
|
60
60
|
* The current (estimated) range of the vehicle in miles (mi).
|
|
61
61
|
* @example 300
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vehicle.js","sourceRoot":"","sources":["../../src/deviceState/vehicle.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAC3B,qCAAoD;AAEvC,QAAA,kBAAkB,GAAG,MAAC,CAAC,MAAM,CAAC;IACzC;;;OAGG;IACH,aAAa,EAAE,iCAAwB,CAAC,QAAQ,CAC9C,4GAA4G,CAC7G;IACD;;;OAGG;IACH,gBAAgB,EAAE,MAAC;SAChB,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,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,CAAC,CAAC,QAAQ,CAAC,6DAA6D,CAAC;CAC7G,CAAC,CAAC;AAGU,QAAA,wBAAwB,GAAG,MAAC,CAAC,MAAM,CAAC;IAC/C;;OAEG;IACH,QAAQ,EAAE,MAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uEAAuE,CAAC;CACvG,CAAC,CAAC"}
|
|
@@ -2,14 +2,14 @@ import { z } from "zod/v4";
|
|
|
2
2
|
export declare const DeviceTypes: readonly ["battery", "charger", "inverter", "meter", "thermostat", "vehicle", "other", "unknown"];
|
|
3
3
|
export type DeviceType = (typeof DeviceTypes)[number];
|
|
4
4
|
export declare const DeviceTypeEnum: z.ZodEnum<{
|
|
5
|
-
other: "other";
|
|
6
|
-
unknown: "unknown";
|
|
7
|
-
meter: "meter";
|
|
8
5
|
battery: "battery";
|
|
9
6
|
charger: "charger";
|
|
10
7
|
inverter: "inverter";
|
|
8
|
+
meter: "meter";
|
|
11
9
|
thermostat: "thermostat";
|
|
12
10
|
vehicle: "vehicle";
|
|
11
|
+
other: "other";
|
|
12
|
+
unknown: "unknown";
|
|
13
13
|
}>;
|
|
14
14
|
export declare const DeviceTypeLabelMap: Record<DeviceType, string>;
|
|
15
15
|
//# sourceMappingURL=entities.d.ts.map
|
|
@@ -10,11 +10,11 @@ export declare const ManufacturerSchema: z.ZodObject<{
|
|
|
10
10
|
slug: z.ZodString;
|
|
11
11
|
name: z.ZodString;
|
|
12
12
|
supportLevel: z.ZodEnum<{
|
|
13
|
-
blocked: "blocked";
|
|
14
13
|
planned: "planned";
|
|
15
14
|
development: "development";
|
|
16
15
|
uat: "uat";
|
|
17
16
|
production: "production";
|
|
17
|
+
blocked: "blocked";
|
|
18
18
|
}>;
|
|
19
19
|
supportsGridServices: z.ZodOptional<z.ZodBoolean>;
|
|
20
20
|
logo: z.ZodObject<{
|
|
@@ -2,32 +2,23 @@ import { Logger } from "../../common/logger";
|
|
|
2
2
|
import { Manufacturer } from "../entities";
|
|
3
3
|
export interface GetManufacturerOptions {
|
|
4
4
|
/**
|
|
5
|
-
* The slug of the manufacturer to retrieve
|
|
5
|
+
* The slug of the manufacturer to retrieve.
|
|
6
6
|
*/
|
|
7
7
|
slug: string;
|
|
8
8
|
/**
|
|
9
|
-
* The base URL of the
|
|
10
|
-
* @default "https://
|
|
9
|
+
* The base URL of the Texture REST API.
|
|
10
|
+
* @default "https://api.texturehq.com"
|
|
11
11
|
*/
|
|
12
12
|
baseApiUrl?: string;
|
|
13
13
|
/**
|
|
14
|
-
* The
|
|
15
|
-
* @default "https://device.cms.texture.energy"
|
|
16
|
-
*/
|
|
17
|
-
baseImageUrl?: string;
|
|
18
|
-
/**
|
|
19
|
-
* The logger instance to use during the getManufacturers operation.
|
|
14
|
+
* The logger instance to use during the getManufacturer operation.
|
|
20
15
|
*/
|
|
21
16
|
logger?: Logger;
|
|
22
17
|
}
|
|
23
|
-
type CachedManufacturer = (Manufacturer & {
|
|
24
|
-
cached?: boolean;
|
|
25
|
-
}) | null;
|
|
26
18
|
/**
|
|
27
|
-
* Retrieves a manufacturer from the
|
|
19
|
+
* Retrieves a manufacturer from the Texture REST API.
|
|
28
20
|
* @param options The options to use during the getManufacturer operation.
|
|
29
|
-
* @returns {Promise<Manufacturer | null>} The manufacturer retrieved from the
|
|
21
|
+
* @returns {Promise<Manufacturer | null>} The manufacturer retrieved from the API or null if not found.
|
|
30
22
|
*/
|
|
31
|
-
export declare const getManufacturer: (options: GetManufacturerOptions) => Promise<
|
|
32
|
-
export {};
|
|
23
|
+
export declare const getManufacturer: (options: GetManufacturerOptions) => Promise<Manufacturer | null>;
|
|
33
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/manufacturer/getManufacturer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK3C,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/manufacturer/getManufacturer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK3C,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAU,SAAS,sBAAsB,KAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAoClG,CAAC"}
|
|
@@ -5,43 +5,41 @@ const logger_1 = require("../../common/logger");
|
|
|
5
5
|
const exceptions_1 = require("../../common/exceptions");
|
|
6
6
|
const constants_1 = require("../../common/constants");
|
|
7
7
|
const parseManufacturer_1 = require("../parseManufacturer");
|
|
8
|
-
const
|
|
8
|
+
const fetch_1 = require("../../common/fetch");
|
|
9
9
|
/**
|
|
10
|
-
* Retrieves a manufacturer from the
|
|
10
|
+
* Retrieves a manufacturer from the Texture REST API.
|
|
11
11
|
* @param options The options to use during the getManufacturer operation.
|
|
12
|
-
* @returns {Promise<Manufacturer | null>} The manufacturer retrieved from the
|
|
12
|
+
* @returns {Promise<Manufacturer | null>} The manufacturer retrieved from the API or null if not found.
|
|
13
13
|
*/
|
|
14
14
|
const getManufacturer = async (options) => {
|
|
15
15
|
const defaultLogger = logger_1.baseLogger.function("getManufacturer");
|
|
16
|
-
const { slug, baseApiUrl = constants_1.PRODUCTION_BASE_URL,
|
|
17
|
-
const operation = logger.operation("get manufacturer from
|
|
18
|
-
const axios = (0, axios_1.getAxios)();
|
|
16
|
+
const { slug, baseApiUrl = constants_1.PRODUCTION_BASE_URL, logger = defaultLogger } = options;
|
|
17
|
+
const operation = logger.operation("get manufacturer from Texture REST API");
|
|
19
18
|
try {
|
|
19
|
+
const url = `${baseApiUrl}/v1/public/manufacturers`;
|
|
20
20
|
operation.start({ options });
|
|
21
|
-
const response = await
|
|
22
|
-
if (response.
|
|
23
|
-
const errorMessage = `Request to ${
|
|
21
|
+
const response = await (0, fetch_1.fetchWithRetry)(url);
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
const errorMessage = `Request to ${url} failed with status ${response.status}`;
|
|
24
24
|
operation.fail(errorMessage);
|
|
25
25
|
throw new exceptions_1.NetworkError(errorMessage, response.status);
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const data = (await response.json());
|
|
28
|
+
const match = data.find((m) => m.slug === slug);
|
|
29
|
+
if (!match) {
|
|
30
|
+
operation.fail({ slug });
|
|
29
31
|
return null;
|
|
30
32
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (!result.support_level) {
|
|
34
|
-
operation.fail("support_level is missing in the response data.");
|
|
33
|
+
if (!match.supportLevel) {
|
|
34
|
+
operation.fail("supportLevel is missing in the response data.");
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
|
-
const manufacturer = (0, parseManufacturer_1.parseManufacturer)(
|
|
38
|
-
// @ts-expect-error Property 'cached' does not exist
|
|
39
|
-
manufacturer.cached = response?.cached;
|
|
37
|
+
const manufacturer = (0, parseManufacturer_1.parseManufacturer)(match);
|
|
40
38
|
operation.end({ manufacturer });
|
|
41
39
|
return manufacturer;
|
|
42
40
|
}
|
|
43
41
|
catch (error) {
|
|
44
|
-
operation.fail("Unknown error occurred while fetching
|
|
42
|
+
operation.fail("Unknown error occurred while fetching manufacturer from Texture REST API.");
|
|
45
43
|
throw error;
|
|
46
44
|
}
|
|
47
45
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/manufacturer/getManufacturer/index.ts"],"names":[],"mappings":";;;AAAA,gDAAyD;AAEzD,wDAAuD;AAEvD,sDAA6D;AAC7D,4DAAyD;AACzD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/manufacturer/getManufacturer/index.ts"],"names":[],"mappings":";;;AAAA,gDAAyD;AAEzD,wDAAuD;AAEvD,sDAA6D;AAC7D,4DAAyD;AACzD,8CAAoD;AAkBpD;;;;GAIG;AACI,MAAM,eAAe,GAAG,KAAK,EAAE,OAA+B,EAAgC,EAAE;IACrG,MAAM,aAAa,GAAG,mBAAU,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAC7D,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,+BAAmB,EAAE,MAAM,GAAG,aAAa,EAAE,GAAG,OAAO,CAAC;IACnF,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,wCAAwC,CAAC,CAAC;IAE7E,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,GAAG,UAAU,0BAA0B,CAAC;QACpD,SAAS,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;QAC7B,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAc,EAAC,GAAG,CAAC,CAAC;QAC3C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,YAAY,GAAG,cAAc,GAAG,uBAAuB,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC/E,SAAS,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC7B,MAAM,IAAI,yBAAY,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;QACxD,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAA8B,CAAC;QAClE,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QAEhD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,SAAS,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;YACxB,SAAS,CAAC,IAAI,CAAC,+CAA+C,CAAC,CAAC;YAChE,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,YAAY,GAAG,IAAA,qCAAiB,EAAC,KAAK,CAAC,CAAC;QAE9C,SAAS,CAAC,GAAG,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC;QAChC,OAAO,YAAY,CAAC;IACtB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,SAAS,CAAC,IAAI,CAAC,2EAA2E,CAAC,CAAC;QAC5F,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC,CAAC;AApCW,QAAA,eAAe,mBAoC1B"}
|
|
@@ -1,77 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
pagingCounter: number;
|
|
8
|
-
hasPrevPage: boolean;
|
|
9
|
-
hasNextPage: boolean;
|
|
10
|
-
prevPage: null;
|
|
11
|
-
nextPage: null;
|
|
12
|
-
}
|
|
13
|
-
export interface Doc {
|
|
14
|
-
id: string;
|
|
15
|
-
slug: string;
|
|
16
|
-
name: string;
|
|
17
|
-
logo: Logo;
|
|
18
|
-
createdAt: Date;
|
|
19
|
-
updatedAt: Date;
|
|
20
|
-
support_level: string;
|
|
21
|
-
icon: Icon;
|
|
22
|
-
vector_icon: Logo;
|
|
23
|
-
}
|
|
24
|
-
export interface Icon {
|
|
25
|
-
id: string;
|
|
26
|
-
alt: string;
|
|
27
|
-
filename: string;
|
|
28
|
-
mimeType: string;
|
|
29
|
-
filesize: number;
|
|
30
|
-
width: number;
|
|
31
|
-
height: number;
|
|
32
|
-
focalX: number;
|
|
33
|
-
focalY: number;
|
|
34
|
-
sizes: IconSizes;
|
|
35
|
-
createdAt: Date;
|
|
36
|
-
updatedAt: Date;
|
|
37
|
-
url: string;
|
|
38
|
-
}
|
|
39
|
-
export interface IconSizes {
|
|
40
|
-
thumbnail: PurpleCard;
|
|
41
|
-
card: PurpleCard;
|
|
42
|
-
tablet: PurpleCard;
|
|
43
|
-
}
|
|
44
|
-
export interface PurpleCard {
|
|
45
|
-
width: number;
|
|
46
|
-
height: number;
|
|
47
|
-
mimeType: string;
|
|
48
|
-
filesize: number;
|
|
49
|
-
filename: string;
|
|
50
|
-
url: string;
|
|
51
|
-
}
|
|
52
|
-
export interface Logo {
|
|
53
|
-
id: string;
|
|
54
|
-
filename: string;
|
|
55
|
-
mimeType: string;
|
|
56
|
-
filesize: number;
|
|
57
|
-
width: number;
|
|
58
|
-
height: number;
|
|
59
|
-
sizes: LogoSizes;
|
|
60
|
-
createdAt: Date;
|
|
61
|
-
updatedAt: Date;
|
|
62
|
-
url: string;
|
|
63
|
-
alt: string;
|
|
64
|
-
}
|
|
65
|
-
export interface LogoSizes {
|
|
66
|
-
thumbnail: FluffyCard;
|
|
67
|
-
card: FluffyCard;
|
|
68
|
-
tablet: FluffyCard;
|
|
69
|
-
}
|
|
70
|
-
export interface FluffyCard {
|
|
71
|
-
url: null;
|
|
72
|
-
}
|
|
73
|
-
export declare class Convert {
|
|
74
|
-
static toResponseInterfaces(json: string): ResponseInterfaces;
|
|
75
|
-
static responseInterfacesToJson(value: ResponseInterfaces): string;
|
|
76
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* REST API response shape for GET /v1/public/manufacturers.
|
|
3
|
+
* Returns a flat array of manufacturer objects (not paginated).
|
|
4
|
+
* Re-exported from the shared type for consistency.
|
|
5
|
+
*/
|
|
6
|
+
export { ManufacturerApiResponse } from "../getManufacturers/response.interfaces";
|
|
77
7
|
//# sourceMappingURL=response.interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.interfaces.d.ts","sourceRoot":"","sources":["../../../src/manufacturer/getManufacturer/response.interfaces.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"response.interfaces.d.ts","sourceRoot":"","sources":["../../../src/manufacturer/getManufacturer/response.interfaces.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC"}
|
|
@@ -1,234 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Convert = void 0;
|
|
4
|
-
// Converts JSON strings to/from your types
|
|
5
|
-
// and asserts the results of JSON.parse at runtime
|
|
6
|
-
class Convert {
|
|
7
|
-
static toResponseInterfaces(json) {
|
|
8
|
-
return cast(JSON.parse(json), r("ResponseInterfaces"));
|
|
9
|
-
}
|
|
10
|
-
static responseInterfacesToJson(value) {
|
|
11
|
-
return JSON.stringify(uncast(value, r("ResponseInterfaces")), null, 2);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.Convert = Convert;
|
|
15
|
-
function invalidValue(typ, val, key, parent = '') {
|
|
16
|
-
const prettyTyp = prettyTypeName(typ);
|
|
17
|
-
const parentText = parent ? ` on ${parent}` : '';
|
|
18
|
-
const keyText = key ? ` for key "${key}"` : '';
|
|
19
|
-
throw Error(`Invalid value${keyText}${parentText}. Expected ${prettyTyp} but got ${JSON.stringify(val)}`);
|
|
20
|
-
}
|
|
21
|
-
function prettyTypeName(typ) {
|
|
22
|
-
if (Array.isArray(typ)) {
|
|
23
|
-
if (typ.length === 2 && typ[0] === undefined) {
|
|
24
|
-
return `an optional ${prettyTypeName(typ[1])}`;
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
return `one of [${typ.map(a => { return prettyTypeName(a); }).join(", ")}]`;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
else if (typeof typ === "object" && typ.literal !== undefined) {
|
|
31
|
-
return typ.literal;
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
return typeof typ;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function jsonToJSProps(typ) {
|
|
38
|
-
if (typ.jsonToJS === undefined) {
|
|
39
|
-
const map = {};
|
|
40
|
-
typ.props.forEach((p) => map[p.json] = { key: p.js, typ: p.typ });
|
|
41
|
-
typ.jsonToJS = map;
|
|
42
|
-
}
|
|
43
|
-
return typ.jsonToJS;
|
|
44
|
-
}
|
|
45
|
-
function jsToJSONProps(typ) {
|
|
46
|
-
if (typ.jsToJSON === undefined) {
|
|
47
|
-
const map = {};
|
|
48
|
-
typ.props.forEach((p) => map[p.js] = { key: p.json, typ: p.typ });
|
|
49
|
-
typ.jsToJSON = map;
|
|
50
|
-
}
|
|
51
|
-
return typ.jsToJSON;
|
|
52
|
-
}
|
|
53
|
-
function transform(val, typ, getProps, key = '', parent = '') {
|
|
54
|
-
function transformPrimitive(typ, val) {
|
|
55
|
-
if (typeof typ === typeof val)
|
|
56
|
-
return val;
|
|
57
|
-
return invalidValue(typ, val, key, parent);
|
|
58
|
-
}
|
|
59
|
-
function transformUnion(typs, val) {
|
|
60
|
-
// val must validate against one typ in typs
|
|
61
|
-
const l = typs.length;
|
|
62
|
-
for (let i = 0; i < l; i++) {
|
|
63
|
-
const typ = typs[i];
|
|
64
|
-
try {
|
|
65
|
-
return transform(val, typ, getProps);
|
|
66
|
-
}
|
|
67
|
-
catch (_) { }
|
|
68
|
-
}
|
|
69
|
-
return invalidValue(typs, val, key, parent);
|
|
70
|
-
}
|
|
71
|
-
function transformEnum(cases, val) {
|
|
72
|
-
if (cases.indexOf(val) !== -1)
|
|
73
|
-
return val;
|
|
74
|
-
return invalidValue(cases.map(a => { return l(a); }), val, key, parent);
|
|
75
|
-
}
|
|
76
|
-
function transformArray(typ, val) {
|
|
77
|
-
// val must be an array with no invalid elements
|
|
78
|
-
if (!Array.isArray(val))
|
|
79
|
-
return invalidValue(l("array"), val, key, parent);
|
|
80
|
-
return val.map(el => transform(el, typ, getProps));
|
|
81
|
-
}
|
|
82
|
-
function transformDate(val) {
|
|
83
|
-
if (val === null) {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
const d = new Date(val);
|
|
87
|
-
if (isNaN(d.valueOf())) {
|
|
88
|
-
return invalidValue(l("Date"), val, key, parent);
|
|
89
|
-
}
|
|
90
|
-
return d;
|
|
91
|
-
}
|
|
92
|
-
function transformObject(props, additional, val) {
|
|
93
|
-
if (val === null || typeof val !== "object" || Array.isArray(val)) {
|
|
94
|
-
return invalidValue(l(ref || "object"), val, key, parent);
|
|
95
|
-
}
|
|
96
|
-
const result = {};
|
|
97
|
-
Object.getOwnPropertyNames(props).forEach(key => {
|
|
98
|
-
const prop = props[key];
|
|
99
|
-
const v = Object.prototype.hasOwnProperty.call(val, key) ? val[key] : undefined;
|
|
100
|
-
result[prop.key] = transform(v, prop.typ, getProps, key, ref);
|
|
101
|
-
});
|
|
102
|
-
Object.getOwnPropertyNames(val).forEach(key => {
|
|
103
|
-
if (!Object.prototype.hasOwnProperty.call(props, key)) {
|
|
104
|
-
result[key] = transform(val[key], additional, getProps, key, ref);
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
return result;
|
|
108
|
-
}
|
|
109
|
-
if (typ === "any")
|
|
110
|
-
return val;
|
|
111
|
-
if (typ === null) {
|
|
112
|
-
if (val === null)
|
|
113
|
-
return val;
|
|
114
|
-
return invalidValue(typ, val, key, parent);
|
|
115
|
-
}
|
|
116
|
-
if (typ === false)
|
|
117
|
-
return invalidValue(typ, val, key, parent);
|
|
118
|
-
let ref = undefined;
|
|
119
|
-
while (typeof typ === "object" && typ.ref !== undefined) {
|
|
120
|
-
ref = typ.ref;
|
|
121
|
-
typ = typeMap[typ.ref];
|
|
122
|
-
}
|
|
123
|
-
if (Array.isArray(typ))
|
|
124
|
-
return transformEnum(typ, val);
|
|
125
|
-
if (typeof typ === "object") {
|
|
126
|
-
return typ.hasOwnProperty("unionMembers") ? transformUnion(typ.unionMembers, val)
|
|
127
|
-
: typ.hasOwnProperty("arrayItems") ? transformArray(typ.arrayItems, val)
|
|
128
|
-
: typ.hasOwnProperty("props") ? transformObject(getProps(typ), typ.additional, val)
|
|
129
|
-
: invalidValue(typ, val, key, parent);
|
|
130
|
-
}
|
|
131
|
-
// Numbers can be parsed by Date but shouldn't be.
|
|
132
|
-
if (typ === Date && typeof val !== "number")
|
|
133
|
-
return transformDate(val);
|
|
134
|
-
return transformPrimitive(typ, val);
|
|
135
|
-
}
|
|
136
|
-
function cast(val, typ) {
|
|
137
|
-
return transform(val, typ, jsonToJSProps);
|
|
138
|
-
}
|
|
139
|
-
function uncast(val, typ) {
|
|
140
|
-
return transform(val, typ, jsToJSONProps);
|
|
141
|
-
}
|
|
142
|
-
function l(typ) {
|
|
143
|
-
return { literal: typ };
|
|
144
|
-
}
|
|
145
|
-
function a(typ) {
|
|
146
|
-
return { arrayItems: typ };
|
|
147
|
-
}
|
|
148
|
-
function u(...typs) {
|
|
149
|
-
return { unionMembers: typs };
|
|
150
|
-
}
|
|
151
|
-
function o(props, additional) {
|
|
152
|
-
return { props, additional };
|
|
153
|
-
}
|
|
154
|
-
function m(additional) {
|
|
155
|
-
return { props: [], additional };
|
|
156
|
-
}
|
|
157
|
-
function r(name) {
|
|
158
|
-
return { ref: name };
|
|
159
|
-
}
|
|
160
|
-
const typeMap = {
|
|
161
|
-
"ResponseInterfaces": o([
|
|
162
|
-
{ json: "docs", js: "docs", typ: a(r("Doc")) },
|
|
163
|
-
{ json: "totalDocs", js: "totalDocs", typ: 0 },
|
|
164
|
-
{ json: "limit", js: "limit", typ: 0 },
|
|
165
|
-
{ json: "totalPages", js: "totalPages", typ: 0 },
|
|
166
|
-
{ json: "page", js: "page", typ: 0 },
|
|
167
|
-
{ json: "pagingCounter", js: "pagingCounter", typ: 0 },
|
|
168
|
-
{ json: "hasPrevPage", js: "hasPrevPage", typ: true },
|
|
169
|
-
{ json: "hasNextPage", js: "hasNextPage", typ: true },
|
|
170
|
-
{ json: "prevPage", js: "prevPage", typ: null },
|
|
171
|
-
{ json: "nextPage", js: "nextPage", typ: null },
|
|
172
|
-
], false),
|
|
173
|
-
"Doc": o([
|
|
174
|
-
{ json: "id", js: "id", typ: "" },
|
|
175
|
-
{ json: "slug", js: "slug", typ: "" },
|
|
176
|
-
{ json: "name", js: "name", typ: "" },
|
|
177
|
-
{ json: "logo", js: "logo", typ: r("Logo") },
|
|
178
|
-
{ json: "createdAt", js: "createdAt", typ: Date },
|
|
179
|
-
{ json: "updatedAt", js: "updatedAt", typ: Date },
|
|
180
|
-
{ json: "support_level", js: "support_level", typ: "" },
|
|
181
|
-
{ json: "icon", js: "icon", typ: r("Icon") },
|
|
182
|
-
{ json: "vector_icon", js: "vector_icon", typ: r("Logo") },
|
|
183
|
-
], false),
|
|
184
|
-
"Icon": o([
|
|
185
|
-
{ json: "id", js: "id", typ: "" },
|
|
186
|
-
{ json: "alt", js: "alt", typ: "" },
|
|
187
|
-
{ json: "filename", js: "filename", typ: "" },
|
|
188
|
-
{ json: "mimeType", js: "mimeType", typ: "" },
|
|
189
|
-
{ json: "filesize", js: "filesize", typ: 0 },
|
|
190
|
-
{ json: "width", js: "width", typ: 0 },
|
|
191
|
-
{ json: "height", js: "height", typ: 0 },
|
|
192
|
-
{ json: "focalX", js: "focalX", typ: 0 },
|
|
193
|
-
{ json: "focalY", js: "focalY", typ: 0 },
|
|
194
|
-
{ json: "sizes", js: "sizes", typ: r("IconSizes") },
|
|
195
|
-
{ json: "createdAt", js: "createdAt", typ: Date },
|
|
196
|
-
{ json: "updatedAt", js: "updatedAt", typ: Date },
|
|
197
|
-
{ json: "url", js: "url", typ: "" },
|
|
198
|
-
], false),
|
|
199
|
-
"IconSizes": o([
|
|
200
|
-
{ json: "thumbnail", js: "thumbnail", typ: r("PurpleCard") },
|
|
201
|
-
{ json: "card", js: "card", typ: r("PurpleCard") },
|
|
202
|
-
{ json: "tablet", js: "tablet", typ: r("PurpleCard") },
|
|
203
|
-
], false),
|
|
204
|
-
"PurpleCard": o([
|
|
205
|
-
{ json: "width", js: "width", typ: 0 },
|
|
206
|
-
{ json: "height", js: "height", typ: 0 },
|
|
207
|
-
{ json: "mimeType", js: "mimeType", typ: "" },
|
|
208
|
-
{ json: "filesize", js: "filesize", typ: 0 },
|
|
209
|
-
{ json: "filename", js: "filename", typ: "" },
|
|
210
|
-
{ json: "url", js: "url", typ: "" },
|
|
211
|
-
], false),
|
|
212
|
-
"Logo": o([
|
|
213
|
-
{ json: "id", js: "id", typ: "" },
|
|
214
|
-
{ json: "filename", js: "filename", typ: "" },
|
|
215
|
-
{ json: "mimeType", js: "mimeType", typ: "" },
|
|
216
|
-
{ json: "filesize", js: "filesize", typ: 0 },
|
|
217
|
-
{ json: "width", js: "width", typ: 0 },
|
|
218
|
-
{ json: "height", js: "height", typ: 0 },
|
|
219
|
-
{ json: "sizes", js: "sizes", typ: r("LogoSizes") },
|
|
220
|
-
{ json: "createdAt", js: "createdAt", typ: Date },
|
|
221
|
-
{ json: "updatedAt", js: "updatedAt", typ: Date },
|
|
222
|
-
{ json: "url", js: "url", typ: "" },
|
|
223
|
-
{ json: "alt", js: "alt", typ: "" },
|
|
224
|
-
], false),
|
|
225
|
-
"LogoSizes": o([
|
|
226
|
-
{ json: "thumbnail", js: "thumbnail", typ: r("FluffyCard") },
|
|
227
|
-
{ json: "card", js: "card", typ: r("FluffyCard") },
|
|
228
|
-
{ json: "tablet", js: "tablet", typ: r("FluffyCard") },
|
|
229
|
-
], false),
|
|
230
|
-
"FluffyCard": o([
|
|
231
|
-
{ json: "url", js: "url", typ: null },
|
|
232
|
-
], false),
|
|
233
|
-
};
|
|
234
3
|
//# sourceMappingURL=response.interfaces.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"response.interfaces.js","sourceRoot":"","sources":["../../../src/manufacturer/get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AAE,IAAI,EAAE;QACjD,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,EAAE;QACjD,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE;QACnC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE;KACtC,EAAE,KAAK,CAAC;IACT,WAAW,EAAE,CAAC,CAAC;QACX,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE;QAC5D,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE;QAClD,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE;KACzD,EAAE,KAAK,CAAC;IACT,YAAY,EAAE,CAAC,CAAC;QACZ,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE;KACxC,EAAE,KAAK,CAAC;CACZ,CAAC"}
|
|
1
|
+
{"version":3,"file":"response.interfaces.js","sourceRoot":"","sources":["../../../src/manufacturer/getManufacturer/response.interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -3,15 +3,10 @@ import { Manufacturer } from "../entities";
|
|
|
3
3
|
import { SupportLevel } from "../../common/supportLevel";
|
|
4
4
|
export interface GetManufacturersOptions {
|
|
5
5
|
/**
|
|
6
|
-
* The base URL of the
|
|
7
|
-
* @default "https://
|
|
6
|
+
* The base URL of the Texture REST API.
|
|
7
|
+
* @default "https://api.texturehq.com"
|
|
8
8
|
*/
|
|
9
9
|
baseApiUrl?: string;
|
|
10
|
-
/**
|
|
11
|
-
* The base URL for images coming from Payload CMS.
|
|
12
|
-
* @default "https://device.cms.texture.energy"
|
|
13
|
-
*/
|
|
14
|
-
baseImageUrl?: string;
|
|
15
10
|
/**
|
|
16
11
|
* Limits the number of manufacturers returned.
|
|
17
12
|
* @default 10
|
|
@@ -41,12 +36,11 @@ export interface GetManufacturersResponse {
|
|
|
41
36
|
limit: number;
|
|
42
37
|
page: number;
|
|
43
38
|
pageCount: number;
|
|
44
|
-
cached?: boolean;
|
|
45
39
|
}
|
|
46
40
|
/**
|
|
47
|
-
* Retrieves a collection of
|
|
41
|
+
* Retrieves a collection of manufacturers from the Texture REST API.
|
|
48
42
|
* @param options The options to use during the getManufacturers operation.
|
|
49
|
-
* @returns {Promise<GetManufacturersResponse>} The collection of manufacturers retrieved from the
|
|
43
|
+
* @returns {Promise<GetManufacturersResponse>} The collection of manufacturers retrieved from the API.
|
|
50
44
|
*/
|
|
51
45
|
export declare const getManufacturers: (options?: GetManufacturersOptions) => Promise<GetManufacturersResponse>;
|
|
52
46
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/manufacturer/getManufacturers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/manufacturer/getManufacturers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,wBAAwB;IACvC,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAU,UAAS,uBAA4B,KAAG,OAAO,CAAC,wBAAwB,CAoD9G,CAAC"}
|
|
@@ -5,40 +5,51 @@ const logger_1 = require("../../common/logger");
|
|
|
5
5
|
const exceptions_1 = require("../../common/exceptions");
|
|
6
6
|
const constants_1 = require("../../common/constants");
|
|
7
7
|
const parseManufacturer_1 = require("../parseManufacturer");
|
|
8
|
-
const
|
|
8
|
+
const fetch_1 = require("../../common/fetch");
|
|
9
9
|
/**
|
|
10
|
-
* Retrieves a collection of
|
|
10
|
+
* Retrieves a collection of manufacturers from the Texture REST API.
|
|
11
11
|
* @param options The options to use during the getManufacturers operation.
|
|
12
|
-
* @returns {Promise<GetManufacturersResponse>} The collection of manufacturers retrieved from the
|
|
12
|
+
* @returns {Promise<GetManufacturersResponse>} The collection of manufacturers retrieved from the API.
|
|
13
13
|
*/
|
|
14
14
|
const getManufacturers = async (options = {}) => {
|
|
15
15
|
const defaultLogger = logger_1.baseLogger.function("getManufacturers");
|
|
16
|
-
const { limit = 10, page = 1, baseApiUrl = constants_1.PRODUCTION_BASE_URL,
|
|
17
|
-
const operation = logger.operation("get manufacturers from
|
|
18
|
-
const axios = (0, axios_1.getAxios)();
|
|
16
|
+
const { limit = 10, page = 1, baseApiUrl = constants_1.PRODUCTION_BASE_URL, logger = defaultLogger, slugs = [], supportLevel, } = options;
|
|
17
|
+
const operation = logger.operation("get manufacturers from Texture REST API");
|
|
19
18
|
try {
|
|
20
|
-
const
|
|
19
|
+
const url = `${baseApiUrl}/v1/public/manufacturers`;
|
|
21
20
|
operation.start({ options });
|
|
22
|
-
const response = await
|
|
23
|
-
if (response.
|
|
24
|
-
const errorMessage = `Request to ${
|
|
21
|
+
const response = await (0, fetch_1.fetchWithRetry)(url);
|
|
22
|
+
if (!response.ok) {
|
|
23
|
+
const errorMessage = `Request to ${url} failed with status ${response.status}`;
|
|
25
24
|
operation.fail(errorMessage);
|
|
26
25
|
throw new exceptions_1.NetworkError(errorMessage, response.status);
|
|
27
26
|
}
|
|
27
|
+
const data = (await response.json());
|
|
28
|
+
// Apply client-side filters
|
|
29
|
+
let filtered = data;
|
|
30
|
+
if (slugs.length > 0) {
|
|
31
|
+
filtered = filtered.filter((m) => slugs.includes(m.slug));
|
|
32
|
+
}
|
|
33
|
+
if (supportLevel && supportLevel.length > 0) {
|
|
34
|
+
filtered = filtered.filter((m) => supportLevel.includes(m.supportLevel));
|
|
35
|
+
}
|
|
36
|
+
// Apply client-side pagination
|
|
37
|
+
const totalCount = filtered.length;
|
|
38
|
+
const pageCount = Math.ceil(totalCount / limit);
|
|
39
|
+
const startIndex = (page - 1) * limit;
|
|
40
|
+
const paged = filtered.slice(startIndex, startIndex + limit);
|
|
28
41
|
const result = {
|
|
29
|
-
manufacturers:
|
|
30
|
-
count:
|
|
31
|
-
limit
|
|
32
|
-
page
|
|
33
|
-
pageCount
|
|
42
|
+
manufacturers: paged.map((doc) => (0, parseManufacturer_1.parseManufacturer)(doc)),
|
|
43
|
+
count: totalCount,
|
|
44
|
+
limit,
|
|
45
|
+
page,
|
|
46
|
+
pageCount,
|
|
34
47
|
};
|
|
35
|
-
// @ts-expect-error Property 'cached' does not exist
|
|
36
|
-
result.cached = response?.cached;
|
|
37
48
|
operation.end({ result });
|
|
38
49
|
return result;
|
|
39
50
|
}
|
|
40
51
|
catch (error) {
|
|
41
|
-
operation.fail("Unknown error occurred while fetching manufacturers from
|
|
52
|
+
operation.fail("Unknown error occurred while fetching manufacturers from Texture REST API.");
|
|
42
53
|
throw error;
|
|
43
54
|
}
|
|
44
55
|
};
|