@d19n/youfibre-odin-sdk 1.0.141 → 1.0.143

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.
@@ -0,0 +1,38 @@
1
+ import { OauthParams } from '@d19n/odin-sdk-generator/dist/api.interfaces';
2
+ import { ApiProvider } from '@d19n/odin-sdk-generator/dist/api.provider';
3
+ import { OdinSearchV2 } from '@d19n/odin-types/dist/interfaces/v2.db.interfaces';
4
+ import { OdinRecordCreateDto, OdinRecordUpdateDto } from '@d19n/odin-types/dist/dtos/odin.dtos';
5
+ import { ApiRecordLinkManager } from '@d19n/odin-sdk-generator/dist/api.record.link.manager';
6
+ import { ExchangeProperties } from '../entities-v2/Exchange';
7
+ export declare class ExchangeApi extends ApiProvider {
8
+ protected readonly authToken?: string;
9
+ private readonly moduleName;
10
+ private readonly entityName;
11
+ private sourceRecord;
12
+ readonly region: ApiRecordLinkManager;
13
+ constructor(authParams?: OauthParams, authToken?: string);
14
+ setRecord(sourceRecord: any): void;
15
+ schema(): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinSchema>;
16
+ search(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/api.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<ExchangeProperties>>>;
17
+ searchAndPaginate(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/api.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<ExchangeProperties>>>;
18
+ reIndex(body: {
19
+ id: string;
20
+ schemaId: string;
21
+ }[]): Promise<any>;
22
+ get(exchangeId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<ExchangeProperties>>;
23
+ getMany(exchangeIds: string[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<ExchangeProperties>[]>;
24
+ upsert(upsertDto: OdinRecordCreateDto): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes>;
25
+ upsertMany(upsertDtos: OdinRecordCreateDto[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
26
+ update(updateDto: OdinRecordUpdateDto): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes>;
27
+ updateMany(updateDtos: OdinRecordUpdateDto[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
28
+ delete(exchangeId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinDeleteResponse>;
29
+ deleteMany(exchangeIds: string[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinDeleteResponse[]>;
30
+ restore(exchangeIds: string[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinRestoreResponse[]>;
31
+ applyAction(dto: any): Promise<any[]>;
32
+ getVersions(): Promise<{
33
+ [key: string]: Record<string, any>;
34
+ }>;
35
+ getRevisionTimeline(): Promise<{
36
+ [key: string]: Record<string, any>[];
37
+ }>;
38
+ }
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ExchangeApi = void 0;
13
+ const api_provider_1 = require("@d19n/odin-sdk-generator/dist/api.provider");
14
+ const api_record_link_manager_1 = require("@d19n/odin-sdk-generator/dist/api.record.link.manager");
15
+ class ExchangeApi extends api_provider_1.ApiProvider {
16
+ constructor(authParams, authToken) {
17
+ super(authParams, authToken);
18
+ this.authToken = authToken;
19
+ this.moduleName = 'FieldServiceModule';
20
+ this.entityName = 'Exchange';
21
+ this.region = new api_record_link_manager_1.ApiRecordLinkManager(authParams, 'FieldServiceModule:Exchange', 'FieldServiceModule:Region', 'Region__Exchange');
22
+ }
23
+ setRecord(sourceRecord) {
24
+ this.sourceRecord = sourceRecord;
25
+ }
26
+ schema() {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ return yield this.getSchema(this.moduleName, this.entityName);
29
+ });
30
+ }
31
+ // Use this function when you want to search and handle all pagination on your own
32
+ search(params) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ return yield this._searchRecords(this.moduleName, this.entityName, params);
35
+ });
36
+ }
37
+ // Use this function when you want paginating through the results to be handled
38
+ searchAndPaginate(params) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ return yield this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params);
41
+ });
42
+ }
43
+ // Use this function to re-index records in elastic search
44
+ reIndex(body) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ return yield this._reIndexRecords(body);
47
+ });
48
+ }
49
+ // Use this function when you want to return a single record
50
+ get(exchangeId) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ const res = yield this._getByPrimaryKey(this.moduleName, this.entityName, exchangeId);
53
+ this.setRecord(res);
54
+ return res;
55
+ });
56
+ }
57
+ // Use this function when you want to return many records by primaryKeys
58
+ getMany(exchangeIds) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ return yield this._getManyByPrimaryKey(this.moduleName, this.entityName, exchangeIds);
61
+ });
62
+ }
63
+ // Use this function when you want to upsert one record
64
+ upsert(upsertDto) {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ const res = yield this._upsert(this.moduleName, this.entityName, [upsertDto]);
67
+ return res[0];
68
+ });
69
+ }
70
+ // Use this function when you want to upsert many records
71
+ upsertMany(upsertDtos) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ return yield this._upsert(this.moduleName, this.entityName, upsertDtos);
74
+ });
75
+ }
76
+ // Use this function when you want to update one record
77
+ update(updateDto) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ const res = yield this._update(this.moduleName, this.entityName, [updateDto]);
80
+ return res[0];
81
+ });
82
+ }
83
+ // Use this function when you want to update many records
84
+ updateMany(updateDtos) {
85
+ return __awaiter(this, void 0, void 0, function* () {
86
+ return yield this._update(this.moduleName, this.entityName, updateDtos);
87
+ });
88
+ }
89
+ // Use this function when you want to delete one record
90
+ delete(exchangeId) {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ const res = yield this._delete(this.moduleName, this.entityName, [exchangeId]);
93
+ return res[0];
94
+ });
95
+ }
96
+ // Use this function when you want to delete many records
97
+ deleteMany(exchangeIds) {
98
+ return __awaiter(this, void 0, void 0, function* () {
99
+ return yield this._delete(this.moduleName, this.entityName, exchangeIds);
100
+ });
101
+ }
102
+ // Use this function when you want to restore one or many records
103
+ restore(exchangeIds) {
104
+ return __awaiter(this, void 0, void 0, function* () {
105
+ return yield this._restore(this.moduleName, this.entityName, exchangeIds);
106
+ });
107
+ }
108
+ // Use this function when you want to apply actions
109
+ applyAction(dto) {
110
+ return __awaiter(this, void 0, void 0, function* () {
111
+ return yield this._applyAction(this.moduleName, this.entityName, dto);
112
+ });
113
+ }
114
+ // Use this function when you want to return the versions for a single record
115
+ getVersions() {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ return yield this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id);
118
+ });
119
+ }
120
+ // Use this function when you want to return the change history for a single record
121
+ getRevisionTimeline() {
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ return yield this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id);
124
+ });
125
+ }
126
+ }
127
+ exports.ExchangeApi = ExchangeApi;
@@ -9,6 +9,7 @@ export declare class RegionApi extends ApiProvider {
9
9
  private readonly moduleName;
10
10
  private readonly entityName;
11
11
  private sourceRecord;
12
+ readonly exchange: ApiRecordLinkManager;
12
13
  readonly serviceappointmentconfig: ApiRecordLinkManager;
13
14
  constructor(authParams?: OauthParams, authToken?: string);
14
15
  setRecord(sourceRecord: any): void;
@@ -18,6 +18,7 @@ class RegionApi extends api_provider_1.ApiProvider {
18
18
  this.authToken = authToken;
19
19
  this.moduleName = 'FieldServiceModule';
20
20
  this.entityName = 'Region';
21
+ this.exchange = new api_record_link_manager_1.ApiRecordLinkManager(authParams, 'FieldServiceModule:Region', 'FieldServiceModule:Exchange', 'Region__Exchange');
21
22
  this.serviceappointmentconfig = new api_record_link_manager_1.ApiRecordLinkManager(authParams, 'FieldServiceModule:Region', 'FieldServiceModule:ServiceAppointmentConfig', 'ServiceAppointmentConfig_Region');
22
23
  }
23
24
  setRecord(sourceRecord) {
@@ -0,0 +1,28 @@
1
+ import { DbProvider } from '@d19n/odin-sdk-generator/dist/db.provider';
2
+ import { OdinSearchV2 } from '@d19n/odin-types/dist/interfaces/v2.db.interfaces';
3
+ import { OdinRecordCreateDto, OdinRecordUpdateDto } from '@d19n/odin-types/dist/dtos/odin.dtos';
4
+ import { DbRecordLinkManager } from '@d19n/odin-sdk-generator/dist/db.record.link.manager';
5
+ import { ExchangeProperties } from '../entities-v2/Exchange';
6
+ export declare class ExchangeDb extends DbProvider {
7
+ protected readonly principal: any;
8
+ protected readonly dbService: any;
9
+ private readonly moduleName;
10
+ private readonly entityName;
11
+ private sourceRecord;
12
+ readonly region: DbRecordLinkManager;
13
+ constructor(principal: any, dbService: any);
14
+ setRecord(sourceRecord: any): void;
15
+ searchRecords(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-types/dist/interfaces/v2.db.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<ExchangeProperties>>>;
16
+ searchAllRecordsAndPaginate(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-types/dist/interfaces/v2.db.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<ExchangeProperties>>>;
17
+ getByPrimaryKey(exchangeId: string): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<ExchangeProperties>>;
18
+ getManyByPrimaryKey(exchangeIds: string[]): Promise<import("@d19n/odin-types/dist/types/odin.types").OdinRecord<ExchangeProperties>[]>;
19
+ upsert(upsertDto: OdinRecordCreateDto): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes>;
20
+ upsertMany(upsertDtos: OdinRecordCreateDto[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
21
+ update(updateDto: OdinRecordUpdateDto): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes>;
22
+ updateMany(updateDtos: OdinRecordUpdateDto[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
23
+ delete(exchangeIds: string[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").DbRecordDeleted[]>;
24
+ restore(exchangeIds: string[]): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").DbRecordRestored[]>;
25
+ applyAction(actionName: string, dto: any): Promise<import("@d19n/odin-types/dist/interfaces/v1.db.interfaces").IDbRecordCreateUpdateRes[]>;
26
+ getVersions(): Promise<any>;
27
+ getRevisionTimeline(): Promise<any>;
28
+ }
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ExchangeDb = void 0;
13
+ const db_provider_1 = require("@d19n/odin-sdk-generator/dist/db.provider");
14
+ const db_record_link_manager_1 = require("@d19n/odin-sdk-generator/dist/db.record.link.manager");
15
+ class ExchangeDb extends db_provider_1.DbProvider {
16
+ constructor(principal, dbService) {
17
+ super(principal, dbService);
18
+ this.moduleName = 'FieldServiceModule';
19
+ this.entityName = 'Exchange';
20
+ this.principal = principal;
21
+ this.dbService = dbService;
22
+ this.region = new db_record_link_manager_1.DbRecordLinkManager(this.principal, this.dbService, 'FieldServiceModule:Exchange', 'FieldServiceModule:Region', 'Region__Exchange');
23
+ }
24
+ setRecord(sourceRecord) {
25
+ this.sourceRecord = sourceRecord;
26
+ }
27
+ // Use this function when you want to search and handle all pagination on your own
28
+ searchRecords(params) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ return yield this._searchRecords(this.moduleName, this.entityName, params);
31
+ });
32
+ }
33
+ // Use this function when you want paginating through the results to be handled
34
+ searchAllRecordsAndPaginate(params) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ return yield this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params);
37
+ });
38
+ }
39
+ // Use this function when you want to return a single record
40
+ getByPrimaryKey(exchangeId) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ const res = yield this._getByPrimaryKey(this.moduleName, this.entityName, exchangeId);
43
+ this.setRecord(res);
44
+ return res;
45
+ });
46
+ }
47
+ // Use this function when you want to return many records by primaryKeys
48
+ getManyByPrimaryKey(exchangeIds) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ return yield this._getManyByPrimaryKey(this.moduleName, this.entityName, exchangeIds);
51
+ });
52
+ }
53
+ // Use this function when you want to upsert one record
54
+ upsert(upsertDto) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ const res = yield this._upsert(this.moduleName, this.entityName, [upsertDto]);
57
+ return res[0];
58
+ });
59
+ }
60
+ // Use this function when you want to upsert many records
61
+ upsertMany(upsertDtos) {
62
+ return __awaiter(this, void 0, void 0, function* () {
63
+ return yield this._upsert(this.moduleName, this.entityName, upsertDtos);
64
+ });
65
+ }
66
+ // Use this function when you want to update one record
67
+ update(updateDto) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ const res = yield this._update(this.moduleName, this.entityName, [updateDto]);
70
+ return res[0];
71
+ });
72
+ }
73
+ // Use this function when you want to update many records
74
+ updateMany(updateDtos) {
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ return yield this._update(this.moduleName, this.entityName, updateDtos);
77
+ });
78
+ }
79
+ // Use this function when you want to delete one or many records
80
+ delete(exchangeIds) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ return yield this._delete(this.moduleName, this.entityName, exchangeIds);
83
+ });
84
+ }
85
+ // Use this function when you want to restore one or many records
86
+ restore(exchangeIds) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ return yield this._restore(this.moduleName, this.entityName, exchangeIds);
89
+ });
90
+ }
91
+ // Use this function when you want to apply actions
92
+ applyAction(actionName, dto) {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ return yield this._applyAction(this.moduleName, this.entityName, dto);
95
+ });
96
+ }
97
+ // Use this function when you want to return the versions for a single record
98
+ getVersions() {
99
+ return __awaiter(this, void 0, void 0, function* () {
100
+ return yield this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id);
101
+ });
102
+ }
103
+ // Use this function when you want to return the change history for a single record
104
+ getRevisionTimeline() {
105
+ return __awaiter(this, void 0, void 0, function* () {
106
+ return yield this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id);
107
+ });
108
+ }
109
+ }
110
+ exports.ExchangeDb = ExchangeDb;
@@ -9,6 +9,7 @@ export declare class RegionDb extends DbProvider {
9
9
  private readonly moduleName;
10
10
  private readonly entityName;
11
11
  private sourceRecord;
12
+ readonly exchange: DbRecordLinkManager;
12
13
  readonly serviceappointmentconfig: DbRecordLinkManager;
13
14
  constructor(principal: any, dbService: any);
14
15
  setRecord(sourceRecord: any): void;
@@ -19,6 +19,7 @@ class RegionDb extends db_provider_1.DbProvider {
19
19
  this.entityName = 'Region';
20
20
  this.principal = principal;
21
21
  this.dbService = dbService;
22
+ this.exchange = new db_record_link_manager_1.DbRecordLinkManager(this.principal, this.dbService, 'FieldServiceModule:Region', 'FieldServiceModule:Exchange', 'Region__Exchange');
22
23
  this.serviceappointmentconfig = new db_record_link_manager_1.DbRecordLinkManager(this.principal, this.dbService, 'FieldServiceModule:Region', 'FieldServiceModule:ServiceAppointmentConfig', 'ServiceAppointmentConfig_Region');
23
24
  }
24
25
  setRecord(sourceRecord) {
@@ -0,0 +1,27 @@
1
+ import { OdinRecord, OdinLink, LinkedOdinRecord } from '@d19n/odin-types/dist/types/odin.types';
2
+ import { RegionProperties } from './Region';
3
+ export declare enum ExchangeEntityTypes {
4
+ DEFAULT = "DEFAULT"
5
+ }
6
+ export declare enum ExchangePropertyKeys {
7
+ Name = "Name",
8
+ ExPolygonId = "ExPolygonId",
9
+ Borough = "Borough",
10
+ ExternalRef = "ExternalRef"
11
+ }
12
+ export interface ExchangeProperties {
13
+ Name: string;
14
+ ExPolygonId: number;
15
+ Borough: string;
16
+ ExternalRef: number;
17
+ }
18
+ export declare class Exchange extends OdinRecord<ExchangeProperties> {
19
+ entity: 'FieldServiceModule:Exchange';
20
+ type: ExchangeEntityTypes;
21
+ schemaId: 'dc379fc8-514d-4938-9d6f-a26b305dafd2';
22
+ properties: ExchangeProperties;
23
+ Region: OdinLink<LinkedOdinRecord<RegionProperties>>;
24
+ }
25
+ export declare const ROUTING_KEY_EXCHANGE_CREATED = "FieldServiceModule.Exchange.SubDbRecordCreated";
26
+ export declare const ROUTING_KEY_EXCHANGE_UPDATED = "FieldServiceModule.Exchange.SubDbRecordUpdated";
27
+ export declare const ROUTING_KEY_EXCHANGE_DELETED = "FieldServiceModule.Exchange.SubDbRecordDeleted";
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ROUTING_KEY_EXCHANGE_DELETED = exports.ROUTING_KEY_EXCHANGE_UPDATED = exports.ROUTING_KEY_EXCHANGE_CREATED = exports.Exchange = exports.ExchangePropertyKeys = exports.ExchangeEntityTypes = void 0;
4
+ const odin_types_1 = require("@d19n/odin-types/dist/types/odin.types");
5
+ var ExchangeEntityTypes;
6
+ (function (ExchangeEntityTypes) {
7
+ ExchangeEntityTypes["DEFAULT"] = "DEFAULT";
8
+ })(ExchangeEntityTypes = exports.ExchangeEntityTypes || (exports.ExchangeEntityTypes = {}));
9
+ var ExchangePropertyKeys;
10
+ (function (ExchangePropertyKeys) {
11
+ ExchangePropertyKeys["Name"] = "Name";
12
+ ExchangePropertyKeys["ExPolygonId"] = "ExPolygonId";
13
+ ExchangePropertyKeys["Borough"] = "Borough";
14
+ ExchangePropertyKeys["ExternalRef"] = "ExternalRef";
15
+ })(ExchangePropertyKeys = exports.ExchangePropertyKeys || (exports.ExchangePropertyKeys = {}));
16
+ class Exchange extends odin_types_1.OdinRecord {
17
+ }
18
+ exports.Exchange = Exchange;
19
+ // Rabbitmq event routing keys
20
+ exports.ROUTING_KEY_EXCHANGE_CREATED = 'FieldServiceModule.Exchange.SubDbRecordCreated';
21
+ exports.ROUTING_KEY_EXCHANGE_UPDATED = 'FieldServiceModule.Exchange.SubDbRecordUpdated';
22
+ exports.ROUTING_KEY_EXCHANGE_DELETED = 'FieldServiceModule.Exchange.SubDbRecordDeleted';
@@ -1,4 +1,5 @@
1
1
  import { OdinRecord, OdinLink, LinkedOdinRecord } from '@d19n/odin-types/dist/types/odin.types';
2
+ import { ExchangeProperties } from './Exchange';
2
3
  import { ServiceAppointmentConfigProperties } from './ServiceAppointmentConfig';
3
4
  export declare enum RegionEntityTypes {
4
5
  DEFAULT = "DEFAULT"
@@ -14,8 +15,11 @@ export declare class Region extends OdinRecord<RegionProperties> {
14
15
  type: RegionEntityTypes;
15
16
  schemaId: '6b5f803b-a80b-4d50-a1d6-de88fa3f68d0';
16
17
  properties: RegionProperties;
18
+ Exchange: OdinLink<LinkedOdinRecord<ExchangeProperties>>;
17
19
  ServiceAppointmentConfig: OdinLink<LinkedOdinRecord<ServiceAppointmentConfigProperties>>;
18
20
  }
19
21
  export declare const ROUTING_KEY_REGION_CREATED = "FieldServiceModule.Region.SubDbRecordCreated";
20
22
  export declare const ROUTING_KEY_REGION_UPDATED = "FieldServiceModule.Region.SubDbRecordUpdated";
21
23
  export declare const ROUTING_KEY_REGION_DELETED = "FieldServiceModule.Region.SubDbRecordDeleted";
24
+ export declare const ROUTING_KEY_LINK_REGION_EXCHANGE_CREATED = "FieldServiceModule.Region.Exchange.SubDbRecordAssociationCreated";
25
+ export declare const ROUTING_KEY_LINK_REGION_EXCHANGE_DELETED = "FieldServiceModule.Region.Exchange.SubDbRecordAssociationDeleted";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ROUTING_KEY_REGION_DELETED = exports.ROUTING_KEY_REGION_UPDATED = exports.ROUTING_KEY_REGION_CREATED = exports.Region = exports.RegionPropertyKeys = exports.RegionEntityTypes = void 0;
3
+ exports.ROUTING_KEY_LINK_REGION_EXCHANGE_DELETED = exports.ROUTING_KEY_LINK_REGION_EXCHANGE_CREATED = exports.ROUTING_KEY_REGION_DELETED = exports.ROUTING_KEY_REGION_UPDATED = exports.ROUTING_KEY_REGION_CREATED = exports.Region = exports.RegionPropertyKeys = exports.RegionEntityTypes = void 0;
4
4
  const odin_types_1 = require("@d19n/odin-types/dist/types/odin.types");
5
5
  var RegionEntityTypes;
6
6
  (function (RegionEntityTypes) {
@@ -17,3 +17,5 @@ exports.Region = Region;
17
17
  exports.ROUTING_KEY_REGION_CREATED = 'FieldServiceModule.Region.SubDbRecordCreated';
18
18
  exports.ROUTING_KEY_REGION_UPDATED = 'FieldServiceModule.Region.SubDbRecordUpdated';
19
19
  exports.ROUTING_KEY_REGION_DELETED = 'FieldServiceModule.Region.SubDbRecordDeleted';
20
+ exports.ROUTING_KEY_LINK_REGION_EXCHANGE_CREATED = 'FieldServiceModule.Region.Exchange.SubDbRecordAssociationCreated';
21
+ exports.ROUTING_KEY_LINK_REGION_EXCHANGE_DELETED = 'FieldServiceModule.Region.Exchange.SubDbRecordAssociationDeleted';
@@ -108,6 +108,7 @@ export declare enum OdinEntities {
108
108
  OFFER = "ProductModule:Offer",
109
109
  FIELD_SERVICE_PRODUCT = "FieldServiceModule:FieldServiceProduct",
110
110
  SITE_SPECIFIC_RISK_ASSESSMENT_OUTCOME_FORM = "FieldServiceModule:SiteSpecificRiskAssessmentOutcomeForm",
111
+ EXCHANGE = "FieldServiceModule:Exchange",
111
112
  NOTIFICATION_TEMPLATE = "NotificationModule:NotificationTemplate",
112
113
  VOICE_CONFIGURATION = "ServiceModule:VoiceConfiguration",
113
114
  DASHBOARD = "SupportModule:Dashboard",
@@ -112,6 +112,7 @@ var OdinEntities;
112
112
  OdinEntities["OFFER"] = "ProductModule:Offer";
113
113
  OdinEntities["FIELD_SERVICE_PRODUCT"] = "FieldServiceModule:FieldServiceProduct";
114
114
  OdinEntities["SITE_SPECIFIC_RISK_ASSESSMENT_OUTCOME_FORM"] = "FieldServiceModule:SiteSpecificRiskAssessmentOutcomeForm";
115
+ OdinEntities["EXCHANGE"] = "FieldServiceModule:Exchange";
115
116
  OdinEntities["NOTIFICATION_TEMPLATE"] = "NotificationModule:NotificationTemplate";
116
117
  OdinEntities["VOICE_CONFIGURATION"] = "ServiceModule:VoiceConfiguration";
117
118
  OdinEntities["DASHBOARD"] = "SupportModule:Dashboard";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d19n/youfibre-odin-sdk",
3
- "version": "1.0.141",
3
+ "version": "1.0.143",
4
4
  "description": "",
5
5
  "author": "@d19n",
6
6
  "license": "UNLICENSED",
@@ -0,0 +1,140 @@
1
+
2
+ import { OauthParams } from '@d19n/odin-sdk-generator/dist/api.interfaces';
3
+ import { ApiProvider } from '@d19n/odin-sdk-generator/dist/api.provider';
4
+ import { OdinSearchV2 } from '@d19n/odin-types/dist/interfaces/v2.db.interfaces';
5
+ import { BatchDeleteParam, BatchRestoreParam, OdinRecordCreateDto, OdinRecordUpdateDto } from '@d19n/odin-types/dist/dtos/odin.dtos';
6
+ import { ApiRecordLinkManager } from '@d19n/odin-sdk-generator/dist/api.record.link.manager';
7
+ import { ExchangeProperties } from '../entities-v2/Exchange';
8
+
9
+ export class ExchangeApi extends ApiProvider {
10
+
11
+ private readonly moduleName: string = 'FieldServiceModule';
12
+ private readonly entityName: string = 'Exchange';
13
+
14
+ private sourceRecord: any;
15
+
16
+ public readonly region: ApiRecordLinkManager;
17
+ constructor(authParams?: OauthParams, protected readonly authToken?: string) {
18
+ super(authParams, authToken);
19
+
20
+ this.region = new ApiRecordLinkManager(
21
+ authParams,
22
+ 'FieldServiceModule:Exchange',
23
+ 'FieldServiceModule:Region',
24
+ 'Region__Exchange'
25
+ );
26
+ }
27
+
28
+
29
+ public setRecord(sourceRecord: any) {
30
+ this.sourceRecord = sourceRecord
31
+ }
32
+
33
+ public async schema() {
34
+ return await this.getSchema(this.moduleName, this.entityName);
35
+ }
36
+
37
+ // Use this function when you want to search and handle all pagination on your own
38
+ public async search(params: Partial<OdinSearchV2>) {
39
+ return await this._searchRecords<ExchangeProperties>(this.moduleName, this.entityName, params);
40
+ }
41
+
42
+ // Use this function when you want paginating through the results to be handled
43
+ public async searchAndPaginate(params: Partial<OdinSearchV2>) {
44
+ return await this._searchAllRecordsAndPaginate<ExchangeProperties>(this.moduleName, this.entityName, params);
45
+ }
46
+
47
+ // Use this function to re-index records in elastic search
48
+ public async reIndex(body: { id: string, schemaId: string }[]) {
49
+ return await this._reIndexRecords(body);
50
+ }
51
+
52
+ // Use this function when you want to return a single record
53
+ public async get(exchangeId: string) {
54
+ const res = await this._getByPrimaryKey<ExchangeProperties>(
55
+ this.moduleName,
56
+ this.entityName,
57
+ exchangeId
58
+ );
59
+ this.setRecord(res);
60
+
61
+ return res;
62
+ }
63
+
64
+ // Use this function when you want to return many records by primaryKeys
65
+ public async getMany(exchangeIds: string[]) {
66
+ return await this._getManyByPrimaryKey<ExchangeProperties>(
67
+ this.moduleName,
68
+ this.entityName,
69
+ exchangeIds
70
+ );
71
+ }
72
+
73
+ // Use this function when you want to upsert one record
74
+ public async upsert(upsertDto: OdinRecordCreateDto) {
75
+ const res = await this._upsert(this.moduleName, this.entityName, [upsertDto]);
76
+ return res[0];
77
+ }
78
+
79
+ // Use this function when you want to upsert many records
80
+ public async upsertMany(upsertDtos: OdinRecordCreateDto[]) {
81
+ return await this._upsert(this.moduleName, this.entityName, upsertDtos);
82
+ }
83
+
84
+ // Use this function when you want to update one record
85
+ public async update(updateDto: OdinRecordUpdateDto) {
86
+ const res = await this._update(this.moduleName, this.entityName, [updateDto]);
87
+ return res[0];
88
+ }
89
+
90
+ // Use this function when you want to update many records
91
+ public async updateMany(updateDtos: OdinRecordUpdateDto[]) {
92
+ return await this._update(this.moduleName, this.entityName, updateDtos);
93
+ }
94
+
95
+ // Use this function when you want to delete one record
96
+ public async delete(exchangeId: string) {
97
+ const res = await this._delete(
98
+ this.moduleName,
99
+ this.entityName,
100
+ [exchangeId]
101
+ );
102
+ return res[0];
103
+ }
104
+
105
+ // Use this function when you want to delete many records
106
+ public async deleteMany(exchangeIds: string[]) {
107
+ return await this._delete(
108
+ this.moduleName,
109
+ this.entityName,
110
+ exchangeIds
111
+ );
112
+ }
113
+
114
+ // Use this function when you want to restore one or many records
115
+ public async restore(exchangeIds: string[]) {
116
+ return await this._restore(
117
+ this.moduleName,
118
+ this.entityName,
119
+ exchangeIds
120
+ );
121
+ }
122
+
123
+ // Use this function when you want to apply actions
124
+ public async applyAction(dto: any) {
125
+ return await this._applyAction(this.moduleName, this.entityName, dto);
126
+ }
127
+
128
+ // Use this function when you want to return the versions for a single record
129
+ public async getVersions() {
130
+ return await this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id);
131
+ }
132
+
133
+ // Use this function when you want to return the change history for a single record
134
+ public async getRevisionTimeline() {
135
+ return await this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id);
136
+ }
137
+
138
+
139
+ }
140
+
@@ -13,10 +13,17 @@
13
13
 
14
14
  private sourceRecord: any;
15
15
 
16
+ public readonly exchange: ApiRecordLinkManager;
16
17
  public readonly serviceappointmentconfig: ApiRecordLinkManager;
17
18
  constructor(authParams?: OauthParams, protected readonly authToken?: string) {
18
19
  super(authParams, authToken);
19
20
 
21
+ this.exchange = new ApiRecordLinkManager(
22
+ authParams,
23
+ 'FieldServiceModule:Region',
24
+ 'FieldServiceModule:Exchange',
25
+ 'Region__Exchange'
26
+ );
20
27
  this.serviceappointmentconfig = new ApiRecordLinkManager(
21
28
  authParams,
22
29
  'FieldServiceModule:Region',
@@ -0,0 +1,127 @@
1
+
2
+ import { DbProvider } from '@d19n/odin-sdk-generator/dist/db.provider';
3
+ import { OdinSearchV2 } from '@d19n/odin-types/dist/interfaces/v2.db.interfaces';
4
+ import { BatchDeleteParam, BatchRestoreParam, OdinRecordCreateDto, OdinRecordUpdateDto } from '@d19n/odin-types/dist/dtos/odin.dtos';
5
+ import { DbRecordLinkManager } from '@d19n/odin-sdk-generator/dist/db.record.link.manager';
6
+ import { ExchangeProperties } from '../entities-v2/Exchange';
7
+
8
+ export class ExchangeDb extends DbProvider {
9
+ protected readonly principal: any;
10
+ protected readonly dbService: any;
11
+
12
+
13
+ private readonly moduleName: string = 'FieldServiceModule';
14
+ private readonly entityName: string = 'Exchange';
15
+
16
+ private sourceRecord: any;
17
+
18
+ public readonly region: DbRecordLinkManager;
19
+ constructor(principal: any, dbService: any) {
20
+ super(principal, dbService);
21
+
22
+ this.principal = principal;
23
+ this.dbService = dbService;
24
+
25
+ this.region = new DbRecordLinkManager(
26
+ this.principal,
27
+ this.dbService,
28
+ 'FieldServiceModule:Exchange',
29
+ 'FieldServiceModule:Region',
30
+ 'Region__Exchange'
31
+ );
32
+ }
33
+
34
+
35
+ public setRecord(sourceRecord: any) {
36
+ this.sourceRecord = sourceRecord
37
+ }
38
+
39
+ // Use this function when you want to search and handle all pagination on your own
40
+ public async searchRecords(params: Partial<OdinSearchV2>) {
41
+ return await this._searchRecords<ExchangeProperties>(this.moduleName, this.entityName, params);
42
+ }
43
+
44
+ // Use this function when you want paginating through the results to be handled
45
+ public async searchAllRecordsAndPaginate(params: Partial<OdinSearchV2>) {
46
+ return await this._searchAllRecordsAndPaginate<ExchangeProperties>(this.moduleName, this.entityName, params);
47
+ }
48
+
49
+ // Use this function when you want to return a single record
50
+ public async getByPrimaryKey(exchangeId: string) {
51
+ const res = await this._getByPrimaryKey<ExchangeProperties>(
52
+ this.moduleName,
53
+ this.entityName,
54
+ exchangeId
55
+ );
56
+ this.setRecord(res);
57
+
58
+ return res;
59
+ }
60
+
61
+ // Use this function when you want to return many records by primaryKeys
62
+ public async getManyByPrimaryKey(exchangeIds: string[]) {
63
+ return await this._getManyByPrimaryKey<ExchangeProperties>(
64
+ this.moduleName,
65
+ this.entityName,
66
+ exchangeIds
67
+ );
68
+ }
69
+
70
+ // Use this function when you want to upsert one record
71
+ public async upsert(upsertDto: OdinRecordCreateDto) {
72
+ const res = await this._upsert(this.moduleName, this.entityName, [upsertDto]);
73
+ return res[0];
74
+ }
75
+
76
+ // Use this function when you want to upsert many records
77
+ public async upsertMany(upsertDtos: OdinRecordCreateDto[]) {
78
+ return await this._upsert(this.moduleName, this.entityName, upsertDtos);
79
+ }
80
+
81
+ // Use this function when you want to update one record
82
+ public async update(updateDto: OdinRecordUpdateDto) {
83
+ const res = await this._update(this.moduleName, this.entityName, [updateDto]);
84
+ return res[0];
85
+ }
86
+
87
+ // Use this function when you want to update many records
88
+ public async updateMany(updateDtos: OdinRecordUpdateDto[]) {
89
+ return await this._update(this.moduleName, this.entityName, updateDtos);
90
+ }
91
+
92
+ // Use this function when you want to delete one or many records
93
+ public async delete(exchangeIds: string[]) {
94
+ return await this._delete(
95
+ this.moduleName,
96
+ this.entityName,
97
+ exchangeIds
98
+ );
99
+ }
100
+
101
+ // Use this function when you want to restore one or many records
102
+ public async restore(exchangeIds: string[]) {
103
+ return await this._restore(
104
+ this.moduleName,
105
+ this.entityName,
106
+ exchangeIds
107
+ );
108
+ }
109
+
110
+ // Use this function when you want to apply actions
111
+ public async applyAction(actionName: string, dto: any) {
112
+ return await this._applyAction(this.moduleName, this.entityName, dto);
113
+ }
114
+
115
+ // Use this function when you want to return the versions for a single record
116
+ public async getVersions() {
117
+ return await this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id);
118
+ }
119
+
120
+ // Use this function when you want to return the change history for a single record
121
+ public async getRevisionTimeline() {
122
+ return await this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id);
123
+ }
124
+
125
+
126
+ }
127
+
@@ -15,6 +15,7 @@
15
15
 
16
16
  private sourceRecord: any;
17
17
 
18
+ public readonly exchange: DbRecordLinkManager;
18
19
  public readonly serviceappointmentconfig: DbRecordLinkManager;
19
20
  constructor(principal: any, dbService: any) {
20
21
  super(principal, dbService);
@@ -22,6 +23,13 @@
22
23
  this.principal = principal;
23
24
  this.dbService = dbService;
24
25
 
26
+ this.exchange = new DbRecordLinkManager(
27
+ this.principal,
28
+ this.dbService,
29
+ 'FieldServiceModule:Region',
30
+ 'FieldServiceModule:Exchange',
31
+ 'Region__Exchange'
32
+ );
25
33
  this.serviceappointmentconfig = new DbRecordLinkManager(
26
34
  this.principal,
27
35
  this.dbService,
@@ -0,0 +1,51 @@
1
+
2
+ import { OdinPipelineStage, OdinGroup, OdinRecord, OdinLink, LinkedOdinRecord } from '@d19n/odin-types/dist/types/odin.types';
3
+ import { OdinRecordCreateDto, OdinRecordUpdateDto } from '@d19n/odin-types/dist/dtos/odin.dtos';
4
+
5
+
6
+ import { RegionProperties } from './Region';
7
+
8
+
9
+ export enum ExchangeEntityTypes {
10
+ DEFAULT = 'DEFAULT',
11
+ }
12
+
13
+
14
+
15
+ export enum ExchangePropertyKeys {
16
+ Name = 'Name',
17
+ ExPolygonId = 'ExPolygonId',
18
+ Borough = 'Borough',
19
+ ExternalRef = 'ExternalRef',
20
+ }
21
+
22
+
23
+ export interface ExchangeProperties {
24
+ //name
25
+ Name: string
26
+ //ExPolygonId
27
+ ExPolygonId: number
28
+ //Borough
29
+ Borough: string
30
+ //ExternalRef
31
+ ExternalRef: number
32
+ }
33
+
34
+
35
+ export class Exchange extends OdinRecord<ExchangeProperties> {
36
+ entity: 'FieldServiceModule:Exchange';
37
+ type: ExchangeEntityTypes;
38
+ schemaId: 'dc379fc8-514d-4938-9d6f-a26b305dafd2';
39
+ properties: ExchangeProperties;
40
+ Region: OdinLink<LinkedOdinRecord<RegionProperties>>;
41
+ }
42
+
43
+ // Rabbitmq event routing keys
44
+
45
+
46
+ export const ROUTING_KEY_EXCHANGE_CREATED = 'FieldServiceModule.Exchange.SubDbRecordCreated';
47
+ export const ROUTING_KEY_EXCHANGE_UPDATED = 'FieldServiceModule.Exchange.SubDbRecordUpdated';
48
+ export const ROUTING_KEY_EXCHANGE_DELETED = 'FieldServiceModule.Exchange.SubDbRecordDeleted';
49
+
50
+
51
+
@@ -3,6 +3,7 @@ import { OdinPipelineStage, OdinGroup, OdinRecord, OdinLink, LinkedOdinRecord }
3
3
  import { OdinRecordCreateDto, OdinRecordUpdateDto } from '@d19n/odin-types/dist/dtos/odin.dtos';
4
4
 
5
5
 
6
+ import { ExchangeProperties } from './Exchange';
6
7
  import { ServiceAppointmentConfigProperties } from './ServiceAppointmentConfig';
7
8
 
8
9
 
@@ -28,6 +29,7 @@ export class Region extends OdinRecord<RegionProperties> {
28
29
  type: RegionEntityTypes;
29
30
  schemaId: '6b5f803b-a80b-4d50-a1d6-de88fa3f68d0';
30
31
  properties: RegionProperties;
32
+ Exchange: OdinLink<LinkedOdinRecord<ExchangeProperties>>;
31
33
  ServiceAppointmentConfig: OdinLink<LinkedOdinRecord<ServiceAppointmentConfigProperties>>;
32
34
  }
33
35
 
@@ -38,5 +40,7 @@ export class Region extends OdinRecord<RegionProperties> {
38
40
  export const ROUTING_KEY_REGION_UPDATED = 'FieldServiceModule.Region.SubDbRecordUpdated';
39
41
  export const ROUTING_KEY_REGION_DELETED = 'FieldServiceModule.Region.SubDbRecordDeleted';
40
42
 
43
+ export const ROUTING_KEY_LINK_REGION_EXCHANGE_CREATED = 'FieldServiceModule.Region.Exchange.SubDbRecordAssociationCreated'
44
+ export const ROUTING_KEY_LINK_REGION_EXCHANGE_DELETED = 'FieldServiceModule.Region.Exchange.SubDbRecordAssociationDeleted'
41
45
 
42
46
 
@@ -110,6 +110,7 @@ export enum OdinEntities {
110
110
  OFFER = 'ProductModule:Offer',
111
111
  FIELD_SERVICE_PRODUCT = 'FieldServiceModule:FieldServiceProduct',
112
112
  SITE_SPECIFIC_RISK_ASSESSMENT_OUTCOME_FORM = 'FieldServiceModule:SiteSpecificRiskAssessmentOutcomeForm',
113
+ EXCHANGE = 'FieldServiceModule:Exchange',
113
114
  NOTIFICATION_TEMPLATE = 'NotificationModule:NotificationTemplate',
114
115
  VOICE_CONFIGURATION = 'ServiceModule:VoiceConfiguration',
115
116
  DASHBOARD = 'SupportModule:Dashboard',