@spotto/contract 0.1.2 → 0.1.4-alpha.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/types/organisations/[id]/patch/request.js.map +1 -1
- package/dist/types/organisations/constants.d.ts +4 -17
- package/dist/types/organisations/constants.js +4 -14
- package/dist/types/organisations/constants.js.map +1 -1
- package/dist/types/organisations/get/query.d.ts +1 -1
- package/dist/types/organisations/get/query.js +1 -1
- package/dist/types/organisations/get/query.js.map +1 -1
- package/dist/types/organisations/post/request.d.ts +2 -0
- package/dist/types/organisations/post/request.js +2 -0
- package/dist/types/organisations/post/request.js.map +1 -1
- package/dist/types/readers/[id]/get.d.ts +2 -2
- package/dist/types/readers/[id]/get.js +10 -4
- package/dist/types/readers/[id]/get.js.map +1 -1
- package/dist/types/readers/[id]/patch/request.d.ts +1 -1
- package/dist/types/readers/constants.d.ts +31 -3
- package/dist/types/readers/constants.js +122 -8
- package/dist/types/readers/constants.js.map +1 -1
- package/dist/types/readers/get/query.d.ts +3 -3
- package/dist/types/readers/get/query.js +2 -2
- package/dist/types/readers/get/query.js.map +1 -1
- package/dist/types/readers/post/request.d.ts +2 -2
- package/dist/types/readers/post/request.js +10 -4
- package/dist/types/readers/post/request.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../../src/types/organisations/[id]/patch/request.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,gDAAmE;AACnE,4CAA4E;AAC5E,+CAAiE;AAqBpD,QAAA,+BAA+B,
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../../src/types/organisations/[id]/patch/request.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,gDAAmE;AACnE,4CAA4E;AAC5E,+CAAiE;AAqBpD,QAAA,+BAA+B,GAC1C,YAAM,CAA4B;IAChC,IAAI,EAAE,gBAAO;IACb,QAAQ,EAAE,eAAM,CACd,wBAAa,EAA2B,CAAC,MAAM,CAAC;QAC9C,aAAa,EAAE,cAAK;KACrB,CAAC,EACF,MAAM,CACP,CAAC,GAAG,CAAC,CAAC,CAAC;IACR,WAAW,EAAE,6BAAiB;CAC/B,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEL,MAAM,iCAAiC,GAAG,CAAC,OAAY,EAAE,EAAE,CAChE,0BAAiB,CACf,uCAA+B,EAC/B,OAAO,CACR,CAAC;AAJS,QAAA,iCAAiC,qCAI1C"}
|
|
@@ -1,22 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface ReaderTypePreferences {
|
|
3
|
-
default?: ReaderType;
|
|
4
|
-
enabled: ReaderType[];
|
|
5
|
-
}
|
|
6
|
-
export interface ManufacturerPreferences {
|
|
7
|
-
default?: Manufacturer;
|
|
8
|
-
enabled: Manufacturer[];
|
|
9
|
-
}
|
|
1
|
+
import { DeviceType, ReaderType } from '../readers';
|
|
10
2
|
export interface ReaderPreferences {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
export interface TagPreferences {
|
|
15
|
-
ble: boolean;
|
|
16
|
-
rfid: boolean;
|
|
3
|
+
types: ReaderType[];
|
|
4
|
+
deviceTypes: DeviceType[];
|
|
17
5
|
}
|
|
18
6
|
export interface Preferences {
|
|
19
|
-
|
|
20
|
-
readers?: ReaderPreferences;
|
|
7
|
+
reader: ReaderPreferences;
|
|
21
8
|
}
|
|
22
9
|
export declare const preferencesSchema: import("joi").ObjectSchema<Preferences>;
|
|
@@ -5,19 +5,9 @@ const joi_1 = require("joi");
|
|
|
5
5
|
const shared_1 = require("../shared");
|
|
6
6
|
const readers_1 = require("../readers");
|
|
7
7
|
exports.preferencesSchema = joi_1.object({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}),
|
|
12
|
-
readers: joi_1.object({
|
|
13
|
-
type: joi_1.object({
|
|
14
|
-
default: shared_1.xStringIsOneOf(...readers_1.READER_TYPES),
|
|
15
|
-
enabled: shared_1.xArrayOfRequiredStrings(...readers_1.READER_TYPES).required(),
|
|
16
|
-
}),
|
|
17
|
-
manufacturer: joi_1.object({
|
|
18
|
-
default: shared_1.xStringIsOneOf(...readers_1.MANUFACTURERS),
|
|
19
|
-
enabled: shared_1.xArrayOfRequiredStrings(...readers_1.MANUFACTURERS).required(),
|
|
20
|
-
}),
|
|
21
|
-
}),
|
|
8
|
+
reader: joi_1.object({
|
|
9
|
+
types: shared_1.xArrayOfRequiredStrings(...readers_1.READER_TYPES).required(),
|
|
10
|
+
deviceTypes: shared_1.xArrayOfRequiredStrings(...readers_1.DEVICE_TYPES).required(),
|
|
11
|
+
}).required(),
|
|
22
12
|
});
|
|
23
13
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/types/organisations/constants.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/types/organisations/constants.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,sCAAoD;AACpD,wCAAgF;AAiBnE,QAAA,iBAAiB,GAAG,YAAM,CAAc;IACnD,MAAM,EAAE,YAAM,CAAoB;QAChC,KAAK,EAAE,gCAAuB,CAAC,GAAG,sBAAY,CAAC,CAAC,QAAQ,EAAE;QAC1D,WAAW,EAAE,gCAAuB,CAAC,GAAG,sBAAY,CAAC,CAAC,QAAQ,EAAE;KACjE,CAAC,CAAC,QAAQ,EAAE;CACd,CAAC,CAAC"}
|
|
@@ -10,7 +10,7 @@ exports.getOrganisationsQuerySchema = joi_1.object({
|
|
|
10
10
|
names: shared_1.xArrayOfStrings(true),
|
|
11
11
|
sort: shared_1.xStandardSortFields,
|
|
12
12
|
sortOrder: shared_1.xSortOrder,
|
|
13
|
-
embed: shared_1.xArrayOfRequiredStrings('meta'),
|
|
13
|
+
embed: shared_1.xArrayOfRequiredStrings('meta', 'preferences'),
|
|
14
14
|
});
|
|
15
15
|
const validateGetOrganisationsQuery = (payload) => shared_1.validateOptionalJoiSchema(exports.getOrganisationsQuerySchema, payload);
|
|
16
16
|
exports.validateGetOrganisationsQuery = validateGetOrganisationsQuery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../src/types/organisations/get/query.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAE7B,yCAUsB;
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../src/types/organisations/get/query.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAE7B,yCAUsB;AA6CT,QAAA,2BAA2B,GAAG,YAAM,CAAwB;IAEvE,IAAI,EAAE,aAAI;IACV,KAAK,EAAE,aAAI;IAGX,GAAG,EAAE,0BAAiB,CAAC,IAAI,CAAC;IAC5B,KAAK,EAAE,wBAAe,CAAC,IAAI,CAAC;IAG5B,IAAI,EAAE,4BAAmB;IACzB,SAAS,EAAE,mBAAU;IAGrB,KAAK,EAAE,gCAAuB,CAAC,MAAM,EAAE,aAAa,CAAC;CACtD,CAAC,CAAC;AAEI,MAAM,6BAA6B,GAAG,CAAC,OAAY,EAAE,EAAE,CAC5D,kCAAyB,CACvB,mCAA2B,EAC3B,OAAO,CACR,CAAC;AAJS,QAAA,6BAA6B,iCAItC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Preferences } from '../constants';
|
|
1
2
|
export interface PostOrganisationRequest {
|
|
2
3
|
name: string;
|
|
4
|
+
preferences?: Preferences;
|
|
3
5
|
}
|
|
4
6
|
export declare const postOrganisationRequestSchema: import("joi").ObjectSchema<PostOrganisationRequest>;
|
|
5
7
|
export declare const validatePostOrganisationRequest: (payload: any) => PostOrganisationRequest;
|
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.validatePostOrganisationRequest = exports.postOrganisationRequestSchema = void 0;
|
|
4
4
|
const joi_1 = require("joi");
|
|
5
5
|
const shared_1 = require("../../shared");
|
|
6
|
+
const constants_1 = require("../constants");
|
|
6
7
|
exports.postOrganisationRequestSchema = joi_1.object({
|
|
7
8
|
name: shared_1.xString.required(),
|
|
9
|
+
preferences: constants_1.preferencesSchema,
|
|
8
10
|
});
|
|
9
11
|
const validatePostOrganisationRequest = (payload) => shared_1.validateJoiSchema(exports.postOrganisationRequestSchema, payload);
|
|
10
12
|
exports.validatePostOrganisationRequest = validatePostOrganisationRequest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/types/organisations/post/request.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,yCAA0D;
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/types/organisations/post/request.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,yCAA0D;AAC1D,4CAA8D;AAajD,QAAA,6BAA6B,GAAG,YAAM,CAA0B;IAC3E,IAAI,EAAE,gBAAO,CAAC,QAAQ,EAAE;IACxB,WAAW,EAAE,6BAAiB;CAC/B,CAAC,CAAC;AAEI,MAAM,+BAA+B,GAAG,CAAC,OAAY,EAAE,EAAE,CAC9D,0BAAiB,CACf,qCAA6B,EAC7B,OAAO,CACR,CAAC;AAJS,QAAA,+BAA+B,mCAIxC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IEntityMeta, IEmbeddedEntity } from '../../shared';
|
|
2
|
-
import {
|
|
2
|
+
import { ReaderType, DeviceType } from '../constants';
|
|
3
3
|
export interface IReaderStatus {
|
|
4
4
|
online: boolean;
|
|
5
5
|
onlineTime: number;
|
|
@@ -18,7 +18,7 @@ export interface GetReaderResponse {
|
|
|
18
18
|
id: string;
|
|
19
19
|
name: string;
|
|
20
20
|
type: ReaderType;
|
|
21
|
-
|
|
21
|
+
deviceType: DeviceType;
|
|
22
22
|
deviceId?: string;
|
|
23
23
|
endpoint: string;
|
|
24
24
|
network?: string;
|
|
@@ -13,12 +13,18 @@ exports.getReaderResponseSchema = joi_1.object({
|
|
|
13
13
|
id: shared_1.xObjectId.required(),
|
|
14
14
|
name: shared_1.xString.required(),
|
|
15
15
|
type: shared_1.xStringIsOneOf(...constants_1.READER_TYPES).required(),
|
|
16
|
-
|
|
16
|
+
deviceType: shared_1.xStringIsOneOf(...constants_1.DEVICE_TYPES).required(),
|
|
17
17
|
endpoint: joi_1.string().uri().required(),
|
|
18
|
-
deviceId: joi_1.when('
|
|
18
|
+
deviceId: joi_1.when('deviceType', {
|
|
19
19
|
switch: [
|
|
20
|
-
{
|
|
21
|
-
|
|
20
|
+
{
|
|
21
|
+
is: shared_1.xStringIsOneOf(...constants_1.getDeviceTypesForFormat('mac')),
|
|
22
|
+
then: shared_1.xMacAddress,
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
is: shared_1.xStringIsOneOf(...constants_1.getDeviceTypesForFormat('string')),
|
|
26
|
+
then: shared_1.xString,
|
|
27
|
+
},
|
|
22
28
|
],
|
|
23
29
|
otherwise: joi_1.forbidden(),
|
|
24
30
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/types/readers/[id]/get.ts"],"names":[],"mappings":";;;AAAA,6BAAsD;AACtD,yCAYsB;AACtB,
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/types/readers/[id]/get.ts"],"names":[],"mappings":";;;AAAA,6BAAsD;AACtD,yCAYsB;AACtB,4CAMsB;AAyET,QAAA,kBAAkB,GAAG,YAAM,CAAgB;IACtD,MAAM,EAAE,cAAK,CAAC,QAAQ,EAAE;IACxB,UAAU,EAAE,cAAK,CAAC,QAAQ,EAAE;IAC5B,gBAAgB,EAAE,cAAK,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAEU,QAAA,uBAAuB,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B,+BAAuB,EAAE,OAAO,CAAC,CAAC;AAD5D,QAAA,yBAAyB,6BACmC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PostReaderRequest } from '../../post';
|
|
2
|
-
export declare type UpdateReaderRequest = Partial<Omit<PostReaderRequest, '
|
|
2
|
+
export declare type UpdateReaderRequest = Partial<Omit<PostReaderRequest, 'deviceType'>> & {
|
|
3
3
|
archived?: boolean;
|
|
4
4
|
};
|
|
5
5
|
export declare const updateReaderRequestSchema: import("joi").ObjectSchema<UpdateReaderRequest>;
|
|
@@ -1,4 +1,32 @@
|
|
|
1
|
-
export declare type ReaderType = 'FIXED' | 'ROVING' | 'VIRTUAL' | 'PORTAL'
|
|
1
|
+
export declare type ReaderType = 'FIXED' | 'ROVING' | 'VIRTUAL' | 'PORTAL';
|
|
2
2
|
export declare const READER_TYPES: ReaderType[];
|
|
3
|
-
export
|
|
4
|
-
|
|
3
|
+
export interface IReaderTypeDetail {
|
|
4
|
+
id: ReaderType;
|
|
5
|
+
name: string;
|
|
6
|
+
visible: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const READER_TYPE_DETAILS: IReaderTypeDetail[];
|
|
9
|
+
export declare type DeviceType = 'B1' | 'RF1A4' | 'RF1F' | 'HD1' | 'ZEBRA' | 'IMPINJ' | 'TURCK' | 'OTHER' | 'APPLICATION';
|
|
10
|
+
export declare const DEVICE_TYPES: DeviceType[];
|
|
11
|
+
export declare type DeviceTechnologyType = 'BLE' | 'RFID' | 'HID';
|
|
12
|
+
export declare type ConnectorEndpoint = 'iotx3' | 'zebra' | 'impinj' | 'turck' | 'detector' | 'other' | 'zebra';
|
|
13
|
+
export declare type ConnectorProtocol = 'http' | 'mqtt';
|
|
14
|
+
export declare type DeviceIdFormat = 'mac' | 'string';
|
|
15
|
+
export interface IDeviceTypeDetail {
|
|
16
|
+
id: DeviceType;
|
|
17
|
+
name: string;
|
|
18
|
+
technology: DeviceTechnologyType[];
|
|
19
|
+
endpoint: ConnectorEndpoint;
|
|
20
|
+
protocol: ConnectorProtocol;
|
|
21
|
+
deviceIdFormat?: DeviceIdFormat;
|
|
22
|
+
visible: boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare const DEVICE_TYPE_DETAILS: IDeviceTypeDetail[];
|
|
25
|
+
export declare const getDeviceTypeById: (id: DeviceType) => IDeviceTypeDetail;
|
|
26
|
+
declare type QuerySignature = {
|
|
27
|
+
[P in keyof IDeviceTypeDetail]?: IDeviceTypeDetail[P];
|
|
28
|
+
};
|
|
29
|
+
export declare const getDeviceTypes: (query: QuerySignature) => IDeviceTypeDetail[];
|
|
30
|
+
export declare const getDeviceTypesForFormat: (deviceIdFormat: DeviceIdFormat) => DeviceType[];
|
|
31
|
+
export declare const getDeviceTypesForEndpoint: (endpoint: ConnectorEndpoint) => DeviceType[];
|
|
32
|
+
export {};
|
|
@@ -1,22 +1,136 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getDeviceTypesForEndpoint = exports.getDeviceTypesForFormat = exports.getDeviceTypes = exports.getDeviceTypeById = exports.DEVICE_TYPE_DETAILS = exports.DEVICE_TYPES = exports.READER_TYPE_DETAILS = exports.READER_TYPES = void 0;
|
|
4
4
|
exports.READER_TYPES = [
|
|
5
5
|
'FIXED',
|
|
6
6
|
'ROVING',
|
|
7
7
|
'VIRTUAL',
|
|
8
8
|
'PORTAL',
|
|
9
|
-
'HANDSET',
|
|
10
9
|
];
|
|
11
|
-
exports.
|
|
10
|
+
exports.READER_TYPE_DETAILS = [
|
|
11
|
+
{
|
|
12
|
+
id: 'FIXED',
|
|
13
|
+
name: 'Zone Reporting',
|
|
14
|
+
visible: true,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: 'ROVING',
|
|
18
|
+
name: 'Mobile Reporting',
|
|
19
|
+
visible: true,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'VIRTUAL',
|
|
23
|
+
name: 'Virtual Multi-Antenna Reporting',
|
|
24
|
+
visible: false,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'PORTAL',
|
|
28
|
+
name: 'Portal Multi-Antenna Reporting',
|
|
29
|
+
visible: false,
|
|
30
|
+
},
|
|
31
|
+
];
|
|
32
|
+
exports.DEVICE_TYPES = [
|
|
33
|
+
'B1',
|
|
34
|
+
'RF1A4',
|
|
35
|
+
'RF1F',
|
|
36
|
+
'HD1',
|
|
12
37
|
'ZEBRA',
|
|
13
|
-
'ZEBRA_IOT_BRIDGE',
|
|
14
38
|
'IMPINJ',
|
|
15
|
-
'BLUECATS',
|
|
16
39
|
'TURCK',
|
|
17
|
-
'THING_MAGIC',
|
|
18
|
-
'IOTX3',
|
|
19
40
|
'OTHER',
|
|
20
|
-
'
|
|
41
|
+
'APPLICATION',
|
|
42
|
+
];
|
|
43
|
+
exports.DEVICE_TYPE_DETAILS = [
|
|
44
|
+
{
|
|
45
|
+
id: 'B1',
|
|
46
|
+
name: 'Spotto B1 Bluetooth Reader',
|
|
47
|
+
technology: ['BLE'],
|
|
48
|
+
endpoint: 'iotx3',
|
|
49
|
+
protocol: 'http',
|
|
50
|
+
deviceIdFormat: 'mac',
|
|
51
|
+
visible: true,
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: 'RF1A4',
|
|
55
|
+
name: 'Spotto RF1A4 RFID Reader',
|
|
56
|
+
technology: ['RFID'],
|
|
57
|
+
endpoint: 'iotx3',
|
|
58
|
+
protocol: 'http',
|
|
59
|
+
deviceIdFormat: 'mac',
|
|
60
|
+
visible: true,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'RF1F',
|
|
64
|
+
name: 'Spotto RF1F RFID Reader',
|
|
65
|
+
technology: ['RFID'],
|
|
66
|
+
endpoint: 'iotx3',
|
|
67
|
+
protocol: 'http',
|
|
68
|
+
deviceIdFormat: 'mac',
|
|
69
|
+
visible: true,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'HD1',
|
|
73
|
+
name: 'Spotto HD1 HID Reader',
|
|
74
|
+
technology: ['HID'],
|
|
75
|
+
endpoint: 'iotx3',
|
|
76
|
+
protocol: 'http',
|
|
77
|
+
deviceIdFormat: 'mac',
|
|
78
|
+
visible: true,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
id: 'ZEBRA',
|
|
82
|
+
name: 'Zebra RFID Reader',
|
|
83
|
+
technology: ['RFID'],
|
|
84
|
+
endpoint: 'zebra',
|
|
85
|
+
protocol: 'http',
|
|
86
|
+
visible: true,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'IMPINJ',
|
|
90
|
+
name: 'Impinj RFID Reader',
|
|
91
|
+
technology: ['RFID'],
|
|
92
|
+
endpoint: 'impinj',
|
|
93
|
+
protocol: 'http',
|
|
94
|
+
visible: true,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: 'TURCK',
|
|
98
|
+
name: 'Turck Handheld RFID Reader',
|
|
99
|
+
technology: ['RFID'],
|
|
100
|
+
endpoint: 'turck',
|
|
101
|
+
protocol: 'http',
|
|
102
|
+
visible: true,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
id: 'OTHER',
|
|
106
|
+
name: 'Custom Reader (BYO Device)',
|
|
107
|
+
technology: ['RFID', 'BLE', 'HID'],
|
|
108
|
+
endpoint: 'other',
|
|
109
|
+
protocol: 'http',
|
|
110
|
+
visible: true,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: 'APPLICATION',
|
|
114
|
+
name: 'Spotto Detector Application',
|
|
115
|
+
technology: ['BLE'],
|
|
116
|
+
endpoint: 'detector',
|
|
117
|
+
protocol: 'http',
|
|
118
|
+
deviceIdFormat: 'string',
|
|
119
|
+
visible: false,
|
|
120
|
+
},
|
|
21
121
|
];
|
|
122
|
+
const getDeviceTypeById = (id) => exports.DEVICE_TYPE_DETAILS.find(detail => detail.id === id);
|
|
123
|
+
exports.getDeviceTypeById = getDeviceTypeById;
|
|
124
|
+
const getDeviceTypes = (query) => exports.DEVICE_TYPE_DETAILS.filter(type => Object.keys(query).every(key => {
|
|
125
|
+
const testField = query[key];
|
|
126
|
+
const field = type[key];
|
|
127
|
+
return (testField === null || testField === void 0 ? void 0 : testField.constructor) === Array && (field === null || field === void 0 ? void 0 : field.constructor) === Array
|
|
128
|
+
? testField.every(item => field === null || field === void 0 ? void 0 : field.includes(item))
|
|
129
|
+
: testField === field;
|
|
130
|
+
}));
|
|
131
|
+
exports.getDeviceTypes = getDeviceTypes;
|
|
132
|
+
const getDeviceTypesForFormat = (deviceIdFormat) => exports.getDeviceTypes({ deviceIdFormat }).map(({ id }) => id);
|
|
133
|
+
exports.getDeviceTypesForFormat = getDeviceTypesForFormat;
|
|
134
|
+
const getDeviceTypesForEndpoint = (endpoint) => exports.getDeviceTypes({ endpoint }).map(({ id }) => id);
|
|
135
|
+
exports.getDeviceTypesForEndpoint = getDeviceTypesForEndpoint;
|
|
22
136
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/types/readers/constants.ts"],"names":[],"mappings":";;;AASa,QAAA,YAAY,GAAiB;IACxC,OAAO;IACP,QAAQ;IACR,SAAS;IACT,QAAQ;
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/types/readers/constants.ts"],"names":[],"mappings":";;;AASa,QAAA,YAAY,GAAiB;IACxC,OAAO;IACP,QAAQ;IACR,SAAS;IACT,QAAQ;CACT,CAAC;AASW,QAAA,mBAAmB,GAAwB;IACtD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,IAAI;KACd;IACD;QACE,EAAE,EAAE,QAAQ;QACZ,IAAI,EAAE,kBAAkB;QACxB,OAAO,EAAE,IAAI;KACd;IACD;QACE,EAAE,EA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AG,CAAC,CAAC;IAGxB,OAAO,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,WAAW,MAAK,KAAK,IAAI,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,WAAW,MAAK,KAAK;QACrE,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;QAChD,CAAC,CAAC,SAAS,KAAK,KAAK,CAAC;AAC1B,CAAC,CAAC,CACH,CAAC;AAXS,QAAA,cAAc,kBAWvB;AAEG,MAAM,uBAAuB,GAAG,CAAC,cAA8B,EAAE,EAAE,CACxE,sBAAc,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;AAD5C,QAAA,uBAAuB,2BACqB;AAElD,MAAM,yBAAyB,GAAG,CAAC,QAA2B,EAAE,EAAE,CACvE,sBAAc,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;AADtC,QAAA,yBAAyB,6BACa"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SearchableSortFields, SortOrders } from '../../shared';
|
|
2
|
-
import { ReaderType,
|
|
2
|
+
import { ReaderType, DeviceType } from '../constants';
|
|
3
3
|
export declare type ReaderSearchField = 'name' | 'deviceId';
|
|
4
4
|
export declare type ReaderEmbedField = 'meta' | 'status';
|
|
5
5
|
export interface GetReadersQuery {
|
|
@@ -8,8 +8,8 @@ export interface GetReadersQuery {
|
|
|
8
8
|
ids?: string[];
|
|
9
9
|
locationIds?: string[];
|
|
10
10
|
deviceIds?: string[];
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
types?: ReaderType[];
|
|
12
|
+
deviceTypes?: DeviceType[];
|
|
13
13
|
archived?: boolean;
|
|
14
14
|
sort?: SearchableSortFields;
|
|
15
15
|
sortOrder?: SortOrders;
|
|
@@ -10,8 +10,8 @@ exports.getReadersQuerySchema = joi_1.object({
|
|
|
10
10
|
locationIds: shared_1.xArrayOfObjectIds(true),
|
|
11
11
|
ids: shared_1.xArrayOfObjectIds(true),
|
|
12
12
|
deviceIds: shared_1.xArrayOfStrings(true),
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
types: shared_1.xStringIsOneOf(...constants_1.READER_TYPES),
|
|
14
|
+
deviceTypes: shared_1.xStringIsOneOf(...constants_1.DEVICE_TYPES),
|
|
15
15
|
archived: shared_1.xBool,
|
|
16
16
|
sort: shared_1.xSearchableSortFields,
|
|
17
17
|
sortOrder: shared_1.xSortOrder,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../src/types/readers/get/query.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,yCAasB;AACtB,4CAKsB;AAiFT,QAAA,qBAAqB,GAAG,YAAM,CAAkB;IAE3D,IAAI,EAAE,aAAI;IACV,KAAK,EAAE,aAAI;IAGX,WAAW,EAAE,0BAAiB,CAAC,IAAI,CAAC;IACpC,GAAG,EAAE,0BAAiB,CAAC,IAAI,CAAC;IAC5B,SAAS,EAAE,wBAAe,CAAC,IAAI,CAAC;IAChC,
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../../../src/types/readers/get/query.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,yCAasB;AACtB,4CAKsB;AAiFT,QAAA,qBAAqB,GAAG,YAAM,CAAkB;IAE3D,IAAI,EAAE,aAAI;IACV,KAAK,EAAE,aAAI;IAGX,WAAW,EAAE,0BAAiB,CAAC,IAAI,CAAC;IACpC,GAAG,EAAE,0BAAiB,CAAC,IAAI,CAAC;IAC5B,SAAS,EAAE,wBAAe,CAAC,IAAI,CAAC;IAChC,KAAK,EAAE,uBAAc,CAAC,GAAG,wBAAY,CAAC;IACtC,WAAW,EAAE,uBAAc,CAAC,GAAG,wBAAY,CAAC;IAC5C,QAAQ,EAAE,cAAK;IAGf,IAAI,EAAE,8BAAqB;IAC3B,SAAS,EAAE,mBAAU;IAGrB,MAAM,EAAE,gBAAO,CAAC,SAAS,EAAE;IAC3B,WAAW,EAAE,cAAK;IAClB,YAAY,EAAE,gCAAuB,CAAC,MAAM,EAAE,UAAU,CAAC;IAGzD,KAAK,EAAE,gCAAuB,CAAC,MAAM,EAAE,QAAQ,CAAC;CACjD,CAAC,CAAC;AAEI,MAAM,uBAAuB,GAAG,CAAC,OAAY,EAAE,EAAE,CACtD,kCAAyB,CAAkB,6BAAqB,EAAE,OAAO,CAAC,CAAC;AADhE,QAAA,uBAAuB,2BACyC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { INetworkRequest } from '../../networks';
|
|
2
|
-
import {
|
|
2
|
+
import { DeviceType, ReaderType } from '../constants';
|
|
3
3
|
export interface IUpsertedLocation {
|
|
4
4
|
name: string;
|
|
5
5
|
level?: string;
|
|
@@ -15,8 +15,8 @@ export interface IAntennaRequest {
|
|
|
15
15
|
}
|
|
16
16
|
export interface PostReaderRequest {
|
|
17
17
|
name: string;
|
|
18
|
-
manufacturer: Manufacturer;
|
|
19
18
|
type: ReaderType;
|
|
19
|
+
deviceType: DeviceType;
|
|
20
20
|
locationId?: string;
|
|
21
21
|
location?: IUpsertedLocation;
|
|
22
22
|
deviceId?: string;
|
|
@@ -22,11 +22,17 @@ exports.virtualAntennaSchema = shared_1.xArray(exports.antennaSchema.oxor('locat
|
|
|
22
22
|
exports.postReadersRequestSchema = shared_1.xArray(joi_1.object({
|
|
23
23
|
name: shared_1.xString.required(),
|
|
24
24
|
type: shared_1.xStringIsOneOf(...constants_1.READER_TYPES).required(),
|
|
25
|
-
|
|
26
|
-
deviceId: joi_1.when('
|
|
25
|
+
deviceType: shared_1.xStringIsOneOf(...constants_1.DEVICE_TYPES).required(),
|
|
26
|
+
deviceId: joi_1.when('deviceType', {
|
|
27
27
|
switch: [
|
|
28
|
-
{
|
|
29
|
-
|
|
28
|
+
{
|
|
29
|
+
is: shared_1.xStringIsOneOf(...constants_1.getDeviceTypesForFormat('mac')),
|
|
30
|
+
then: shared_1.xMacAddress,
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
is: shared_1.xStringIsOneOf(...constants_1.getDeviceTypesForFormat('string')),
|
|
34
|
+
then: shared_1.xString,
|
|
35
|
+
},
|
|
30
36
|
],
|
|
31
37
|
otherwise: joi_1.forbidden(),
|
|
32
38
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/types/readers/post/request.ts"],"names":[],"mappings":";;;AAAA,6BAAqD;AACrD,6CAAgE;AAChE,yCASsB;AACtB,
|
|
1
|
+
{"version":3,"file":"request.js","sourceRoot":"","sources":["../../../../src/types/readers/post/request.ts"],"names":[],"mappings":";;;AAAA,6BAAqD;AACrD,6CAAgE;AAChE,yCASsB;AACtB,4CAMsB;AAsDT,QAAA,sBAAsB,GAAG,YAAM,CAAoB;IAC9D,IAAI,EAAE,gBAAO;IACb,KAAK,EAAE,gBAAO;CACf,CAAC,CAAC;AAEU,QAAA,aAAa,GAAG,YAAM,CAAkB;IACnD,IAAI,EAAE,aAAI,CAAC,QAAQ,EAAE;IACrB,IAAI,EAAE,gBAAO;IACb,UAAU,EAAE,kBAAS;IACrB,QAAQ,EAAE,8BAAsB;CACjC,CAAC,CAAC;AAEU,QAAA,mBAAmB,GAAG,eAAM,CACvC,qBAAa,CAAC,GAAG,CAAC,UAAU,EAAE,YAAY,CAAC,EAE3C,MAAM,CACP;KACE,QAAQ,EAAE;KACV,GAAG,CAAC,CAAC,CAAC,CAAC;AAEG,QAAA,oBAAoB,GAAG,eAAM,CACxC,qBAAa,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,EAC5C,MAAM,CACP,CA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EAAE,EAAE,QAAQ;gBACZ,IAAI,EAAE,2BAAmB;aAC1B;YAGD;gBACE,EAAE,EAAE,SAAS;gBACb,IAAI,EAAE,4BAAoB;aAC3B;SACF;QACD,SAAS,EAAE,eAAS,EAAE;KACvB,CAAC;CACH,CAAC,CAAC,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,CAClC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAEF,MAAM,0BAA0B,GAAG,CAAC,OAAY,EAAE,EAAE,CACzD,0BAAiB,CAAqB,gCAAwB,EAAE,OAAO,CAAC,CAAC;AAD9D,QAAA,0BAA0B,8BACoC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spotto/contract",
|
|
3
3
|
"license": "ISC",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.4-alpha.0",
|
|
5
5
|
"description": "Spotto's API Contract",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"files": [
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"jest": "^26.6.3",
|
|
27
27
|
"ts-jest": "^26.5.3"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "67fc2ef1b8f9fc27cdbcb54dd09a243a3f7853bc"
|
|
30
30
|
}
|