@spytecgps/nova-orm 0.0.4 → 0.0.6

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.
Files changed (80) hide show
  1. package/README.md +2 -0
  2. package/dist/entities/alert.d.ts +25 -0
  3. package/dist/entities/alertType.d.ts +14 -0
  4. package/dist/entities/assetCategory.d.ts +5 -0
  5. package/dist/entities/billing.d.ts +15 -0
  6. package/dist/entities/billingCustomerBraintree.d.ts +11 -0
  7. package/dist/entities/billingDeviceHistory.d.ts +11 -0
  8. package/dist/entities/billingStatusHistoryBraintree.d.ts +10 -0
  9. package/dist/entities/billingSubscriptionBraintree.d.ts +34 -0
  10. package/dist/entities/blacklist.d.ts +9 -0
  11. package/dist/entities/blacklistType.d.ts +5 -0
  12. package/dist/entities/cellTower.d.ts +12 -0
  13. package/dist/entities/client.d.ts +22 -0
  14. package/dist/entities/clientConfiguration.d.ts +7 -0
  15. package/dist/entities/clientDeviceSetting.d.ts +14 -0
  16. package/dist/entities/clientType.d.ts +6 -0
  17. package/dist/entities/country.d.ts +16 -0
  18. package/dist/entities/dataSourceType.d.ts +5 -0
  19. package/dist/entities/deactivation.d.ts +12 -0
  20. package/dist/entities/deactivationReason.d.ts +6 -0
  21. package/dist/entities/device.d.ts +31 -0
  22. package/dist/entities/deviceBehavior.d.ts +22 -0
  23. package/dist/entities/deviceHistory.d.ts +9 -0
  24. package/dist/entities/deviceModelListener.d.ts +8 -0
  25. package/dist/entities/deviceReplacement.d.ts +11 -0
  26. package/dist/entities/deviceType.d.ts +23 -0
  27. package/dist/entities/deviceTypeEvent.d.ts +5 -0
  28. package/dist/entities/deviceTypeFeature.d.ts +5 -0
  29. package/dist/entities/deviceTypeFirmware.d.ts +11 -0
  30. package/dist/entities/entityTag.d.ts +8 -0
  31. package/dist/entities/entityType.d.ts +5 -0
  32. package/dist/entities/event.d.ts +6 -0
  33. package/dist/entities/feature.d.ts +6 -0
  34. package/dist/entities/firmwareUpgradeTask.d.ts +12 -0
  35. package/dist/entities/geofence.d.ts +20 -0
  36. package/dist/entities/geofenceEvent.d.ts +19 -0
  37. package/dist/entities/imeiIccidCarrier.d.ts +16 -0
  38. package/dist/entities/imeiIccidHistory.d.ts +7 -0
  39. package/dist/entities/index.d.ts +68 -0
  40. package/dist/entities/industry.d.ts +8 -0
  41. package/dist/entities/mobileNetwork.d.ts +9 -0
  42. package/dist/entities/notificationRecipient.d.ts +14 -0
  43. package/dist/entities/organization.d.ts +9 -0
  44. package/dist/entities/plan.d.ts +16 -0
  45. package/dist/entities/position.d.ts +18 -0
  46. package/dist/entities/securityRole.d.ts +7 -0
  47. package/dist/entities/serviceProvider.d.ts +7 -0
  48. package/dist/entities/serviceProviderProduct.d.ts +9 -0
  49. package/dist/entities/serviceProviderProductNetwork.d.ts +5 -0
  50. package/dist/entities/serviceProviderProductType.d.ts +5 -0
  51. package/dist/entities/sim.d.ts +16 -0
  52. package/dist/entities/trip.d.ts +24 -0
  53. package/dist/entities/tripCompletionStatus.d.ts +6 -0
  54. package/dist/entities/tripPosition.d.ts +4 -0
  55. package/dist/entities/user.d.ts +25 -0
  56. package/dist/entities/userActivation.d.ts +9 -0
  57. package/dist/entities/userActivationDevice.d.ts +22 -0
  58. package/dist/entities/userActivationEvent.d.ts +12 -0
  59. package/dist/entities/userActivationMetric.d.ts +38 -0
  60. package/dist/entities/userAlertConfiguration.d.ts +13 -0
  61. package/dist/entities/userAppFeedback.d.ts +10 -0
  62. package/dist/entities/userAppIncident.d.ts +29 -0
  63. package/dist/entities/userConfiguration.d.ts +18 -0
  64. package/dist/entities/userDataDeletionRequest.d.ts +11 -0
  65. package/dist/entities/userDeviceBehaviorTask.d.ts +14 -0
  66. package/dist/entities/userInvitation.d.ts +17 -0
  67. package/dist/entities/userRatingRequest.d.ts +13 -0
  68. package/dist/entities/userRegistrationAttempt.d.ts +35 -0
  69. package/dist/entities/userSecurityRole.d.ts +6 -0
  70. package/dist/index.d.ts +5 -0
  71. package/dist/index.js +2 -0
  72. package/dist/index.js.LICENSE.txt +39 -0
  73. package/dist/novaDataSource.d.ts +56 -0
  74. package/dist/repositories/baseRepository.d.ts +5 -0
  75. package/dist/repositories/devicesRepository.d.ts +24 -0
  76. package/dist/repositories/index.d.ts +3 -0
  77. package/dist/repositories/securityRepository.d.ts +21 -0
  78. package/dist/types/enums.d.ts +9 -0
  79. package/dist/utils/uuidHelpers.d.ts +1 -0
  80. package/package.json +4 -4
@@ -0,0 +1,39 @@
1
+ /*!
2
+ */
3
+
4
+ /*! *****************************************************************************
5
+ Copyright (C) Microsoft. All rights reserved.
6
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
7
+ this file except in compliance with the License. You may obtain a copy of the
8
+ License at http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
12
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
13
+ MERCHANTABLITY OR NON-INFRINGEMENT.
14
+
15
+ See the Apache Version 2.0 License for specific language governing permissions
16
+ and limitations under the License.
17
+ ***************************************************************************** */
18
+
19
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
20
+
21
+ /**
22
+ * @license
23
+ * Copyright 2009 The Closure Library Authors
24
+ * Copyright 2020 Daniel Wirtz / The long.js Authors.
25
+ *
26
+ * Licensed under the Apache License, Version 2.0 (the "License");
27
+ * you may not use this file except in compliance with the License.
28
+ * You may obtain a copy of the License at
29
+ *
30
+ * http://www.apache.org/licenses/LICENSE-2.0
31
+ *
32
+ * Unless required by applicable law or agreed to in writing, software
33
+ * distributed under the License is distributed on an "AS IS" BASIS,
34
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
35
+ * See the License for the specific language governing permissions and
36
+ * limitations under the License.
37
+ *
38
+ * SPDX-License-Identifier: Apache-2.0
39
+ */
@@ -0,0 +1,56 @@
1
+ import { DataSource, EntityTarget, LoggerOptions, ObjectLiteral, Repository, SelectQueryBuilder } from 'typeorm';
2
+ export interface NovaDataSourceConfig {
3
+ /**
4
+ * Database username.
5
+ */
6
+ username: string;
7
+ /**
8
+ * Database password.
9
+ */
10
+ password: string;
11
+ /**
12
+ * Database host.
13
+ */
14
+ host?: string;
15
+ /**
16
+ * Database host port.
17
+ */
18
+ port?: number;
19
+ /**
20
+ * Database name to connect to.
21
+ */
22
+ database?: string;
23
+ /**
24
+ * Object with ssl parameters or a string containing name of ssl profile.
25
+ */
26
+ ssl?: any;
27
+ /**
28
+ * Logging options.
29
+ */
30
+ logging?: LoggerOptions;
31
+ }
32
+ export declare class NovaDataSource {
33
+ protected readonly dataSource: DataSource;
34
+ constructor(config: NovaDataSourceConfig);
35
+ /**
36
+ * Performs connection to the database.
37
+ */
38
+ connect(): Promise<void>;
39
+ /**
40
+ * Closes connection with the database.
41
+ * Once connection is closed, you cannot use repositories or perform any operations except opening connection again.
42
+ */
43
+ disconnect(): Promise<void>;
44
+ /**
45
+ * Gets repository for the given entity.
46
+ */
47
+ getRepository<Entity extends ObjectLiteral>(target: EntityTarget<Entity>): Repository<Entity>;
48
+ /**
49
+ * Executes raw SQL query and returns raw database results.
50
+ */
51
+ query(query: string, parameters?: any[]): Promise<any>;
52
+ /**
53
+ * Creates a new query builder that can be used to build a SQL query.
54
+ */
55
+ createQueryBuilder<Entity extends ObjectLiteral>(entityClass: EntityTarget<Entity>, alias: string): Promise<SelectQueryBuilder<Entity>>;
56
+ }
@@ -0,0 +1,5 @@
1
+ import { NovaDataSourceConfig } from '../novaDataSource';
2
+ export declare class BaseRepository {
3
+ protected readonly novaDataSourceConfig: NovaDataSourceConfig;
4
+ constructor(config: NovaDataSourceConfig);
5
+ }
@@ -0,0 +1,24 @@
1
+ import { Device, DeviceType } from '../entities';
2
+ import { BaseRepository } from './baseRepository';
3
+ export interface GetDevicesOptions {
4
+ withDeviceType: boolean;
5
+ withIccidCarrier: boolean;
6
+ }
7
+ export declare class DevicesRepository extends BaseRepository {
8
+ /**
9
+ * Get device by imei
10
+ * @param {string} imei The imei of the device
11
+ */
12
+ getDeviceByImei(imei: string, options: GetDevicesOptions): Promise<Device>;
13
+ /**
14
+ * Get devices by type id
15
+ * @param {number} deviceTypeId The device type id
16
+ * @param {boolean} onlyActiveDevices Whether to get only active devices
17
+ */
18
+ getDevicesByDeviceTypeId(deviceTypeId: number, onlyActiveDevices: boolean, options: GetDevicesOptions): Promise<Device[]>;
19
+ /**
20
+ * Get device types
21
+ * @param {boolean} onlyWithRelatedIccidCarrier Whether to get only device types with iccid carrier
22
+ */
23
+ getDeviceTypes(onlyWithRelatedIccidCarrier: boolean): Promise<DeviceType[]>;
24
+ }
@@ -0,0 +1,3 @@
1
+ import { DevicesRepository } from './devicesRepository';
2
+ import { SecurityRepository } from './securityRepository';
3
+ export { SecurityRepository, DevicesRepository };
@@ -0,0 +1,21 @@
1
+ import { SecurityRole, UserSecurityRole } from '../entities';
2
+ import { HapnSecurityRole } from '../types/enums';
3
+ import { BaseRepository } from './baseRepository';
4
+ export declare class SecurityRepository extends BaseRepository {
5
+ /**
6
+ * Get all security roles
7
+ */
8
+ getAllRoles(): Promise<SecurityRole[]>;
9
+ /**
10
+ * Get roles of the user
11
+ */
12
+ getUserRoles(userId: string): Promise<UserSecurityRole[]>;
13
+ /**
14
+ * Get user roles by clientId
15
+ */
16
+ getUserRolesByClientId(clientId: number, filterRole?: HapnSecurityRole): Promise<UserSecurityRole[]>;
17
+ /**
18
+ * Whether the user is in role
19
+ */
20
+ isInRole(userId: string, role: HapnSecurityRole): Promise<boolean>;
21
+ }
@@ -0,0 +1,9 @@
1
+ export declare enum HapnSecurityRole {
2
+ Admin = 1,
3
+ Collaborator = 2,
4
+ Owner = 3
5
+ }
6
+ export declare enum DeviceStatus {
7
+ Active = "A",
8
+ Deleted = "D"
9
+ }
@@ -0,0 +1 @@
1
+ export declare const uuidStringToBinaryBuffer: (uuidString: string) => Buffer;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@spytecgps/nova-orm",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "ORM with PlanetScale",
5
- "main": "dist/index.js",
5
+ "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
7
  "devDependencies": {
8
8
  "@types/jest": "^29.5.1",
@@ -10,6 +10,7 @@
10
10
  "@typescript-eslint/eslint-plugin": "^5.59.0",
11
11
  "@typescript-eslint/parser": "^5.59.0",
12
12
  "aws-sdk": "^2.877.0",
13
+ "axios": "^1.4.0",
13
14
  "eslint": "^8.38.0",
14
15
  "eslint-config-prettier": "^6.15.0",
15
16
  "eslint-plugin-import": "^2.27.5",
@@ -26,14 +27,13 @@
26
27
  "webpack-cli": "^4.9.2"
27
28
  },
28
29
  "dependencies": {
29
- "@spytecgps/sdk": "^0.5.97",
30
30
  "mysql2": "^3.2.3",
31
31
  "reflect-metadata": "^0.1.13",
32
32
  "typeorm": "0.3.15"
33
33
  },
34
34
  "scripts": {
35
+ "prepare": "npm run build",
35
36
  "test": "yarn jest --ci --runInBand --reporters=default --reporters=jest-junit --collectCoverage=true",
36
- "start": "ts-node src/index.ts",
37
37
  "typeorm": "typeorm-ts-node-commonjs",
38
38
  "lint": "eslint \"./src/**\"",
39
39
  "lint-fix": "eslint \"./src/**\" --fix",