@d19n/youfibre-odin-sdk 1.0.275 → 1.0.276

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 (29) hide show
  1. package/dist/actions-v2/CaseDefaultStageSolvedDto.d.ts +3 -1
  2. package/dist/actions-v2/CreateCollectionAmcoWorkOrderDto.d.ts +1 -1
  3. package/dist/actions-v2/CreateCollectionAmcoWorkOrderFromOrderDto.d.ts +1 -1
  4. package/dist/actions-v2/CreateOverrideCollectionAmcoWorkOrderDto.d.ts +2 -20
  5. package/dist/actions-v2/SetPendingAmcoWorkOrderDto.d.ts +72 -0
  6. package/dist/actions-v2/SetPendingAmcoWorkOrderDto.js +56 -0
  7. package/dist/api-sdk-v2/CampaignApi.d.ts +45 -0
  8. package/dist/api-sdk-v2/CampaignApi.js +151 -0
  9. package/dist/db-sdk-v2/CampaignDb.d.ts +34 -0
  10. package/dist/db-sdk-v2/CampaignDb.js +129 -0
  11. package/dist/entities-v2/Campaign.d.ts +69 -0
  12. package/dist/entities-v2/Campaign.js +57 -0
  13. package/dist/entities-v2/Order.d.ts +7 -0
  14. package/dist/entities-v2/Order.js +2 -0
  15. package/dist/entities-v2/OrderCampaign.d.ts +58 -0
  16. package/dist/entities-v2/OrderCampaign.js +44 -0
  17. package/dist/records-v2/AddressRecord.d.ts +70 -14
  18. package/dist/records-v2/AddressRecord.js +14 -26
  19. package/dist/records-v2/CaseRecord.d.ts +147 -28
  20. package/dist/records-v2/CaseRecord.js +29 -52
  21. package/dist/records-v2/ContactRecord.d.ts +61 -14
  22. package/dist/records-v2/ContactRecord.js +13 -26
  23. package/dist/records-v2/CustomerDeviceOntRecord.d.ts +61 -14
  24. package/dist/records-v2/CustomerDeviceOntRecord.js +13 -26
  25. package/dist/records-v2/OrderRecord.d.ts +205 -42
  26. package/dist/records-v2/OrderRecord.js +75 -78
  27. package/dist/records-v2/WorkOrderRecord.d.ts +840 -182
  28. package/dist/records-v2/WorkOrderRecord.js +177 -338
  29. package/package.json +2 -2
@@ -12,6 +12,7 @@
12
12
  * AUTO-GENERATED - DO NOT EDIT DIRECTLY
13
13
  */
14
14
  import { OdinRecord, OdinRecordUpdateDto, OdinRecordUpdatedEvent } from '@d19n/odin-types/dist/core';
15
+ declare type StepClassMap = {};
15
16
  /**
16
17
  * RabbitMQ message payload for CaseDefaultStageSolved step flow events
17
18
  *
@@ -64,7 +65,7 @@ export declare class CaseDefaultStageSolvedDto extends OdinRecordUpdateDto<Recor
64
65
  });
65
66
  /** Step classes that can be used with this action */
66
67
  static readonly stepClasses: readonly [];
67
- steps: [];
68
+ steps: StepClassMap[(typeof CaseDefaultStageSolvedDto.stepClasses)[number]][];
68
69
  }
69
70
  /**
70
71
  * RabbitMQ routing key for CaseDefaultStageSolved events
@@ -73,3 +74,4 @@ export declare class CaseDefaultStageSolvedDto extends OdinRecordUpdateDto<Recor
73
74
  * @event CaseDefaultStageSolved
74
75
  */
75
76
  export declare const ROUTING_KEY_CASE_DEFAULT_STAGE_SOLVED = "CaseDefaultStageSolved";
77
+ export {};
@@ -16,7 +16,7 @@ import { OdinRecordCreateDto, OdinRecordCreatedEvent } from '@d19n/odin-types/di
16
16
  * Properties for CreateCollectionAmcoWorkOrder action
17
17
  *
18
18
  * @property Required fields: 0
19
- * @property Optional fields: 14
19
+ * @property Optional fields: 15
20
20
  */
21
21
  export interface CreateCollectionAmcoWorkOrderProperties {
22
22
  /**
@@ -15,7 +15,7 @@ import { OdinRecord, OdinRecordCreateDto, OdinRecordUpdateDto, OdinRecordUpdated
15
15
  * Properties for CreateCollectionAmcoWorkOrder action
16
16
  *
17
17
  * @property Required fields: 0
18
- * @property Optional fields: 14
18
+ * @property Optional fields: 15
19
19
  */
20
20
  export interface CreateCollectionAmcoWorkOrderProperties {
21
21
  /**
@@ -16,7 +16,7 @@ import { OdinRecordCreateDto, OdinRecordCreatedEvent } from '@d19n/odin-types/di
16
16
  * Properties for CreateOverrideCollectionAmcoWorkOrder action
17
17
  *
18
18
  * @property Required fields: 0
19
- * @property Optional fields: 15
19
+ * @property Optional fields: 13
20
20
  */
21
21
  export interface CreateOverrideCollectionAmcoWorkOrderProperties {
22
22
  /**
@@ -40,28 +40,10 @@ export interface CreateOverrideCollectionAmcoWorkOrderProperties {
40
40
  *
41
41
  * Reference identifier for WorkOrder relationships. Used for data integrity.
42
42
  * @type {LOOKUP}
43
- * @default Dynamic: {source_record_id}
43
+ * @default Dynamic: {source_record_properties_OrderId}
44
44
  * @hidden This field is not visible in the UI
45
45
  */
46
46
  OrderId?: string;
47
- /**
48
- * ContactId
49
- *
50
- * Associated contact ID (Field Operations - WorkOrder)
51
- * @type {LOOKUP}
52
- * @default Dynamic: {source_record_Contact_id}
53
- * @hidden This field is not visible in the UI
54
- */
55
- ContactId?: string;
56
- /**
57
- * AddressId
58
- *
59
- * Reference identifier for WorkOrder relationships. Used for data integrity.
60
- * @type {LOOKUP}
61
- * @default Dynamic: {source_record_Address_id}
62
- * @hidden This field is not visible in the UI
63
- */
64
- AddressId?: string;
65
47
  /**
66
48
  * UseAlternativeAddress
67
49
  *
@@ -0,0 +1,72 @@
1
+ /**
2
+ * SetPendingAmcoWorkOrder Action DTO
3
+ *
4
+ * SetPendingAmcoWorkOrder
5
+ *
6
+ * @module OrderModule
7
+ * @entity Order
8
+ * @actionKey SetPendingAmcoWorkOrder
9
+ * @event SetPendingAmcoWorkOrder
10
+ *
11
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
12
+ */
13
+ import { OdinRecord, OdinRecordUpdateDto, OdinRecordUpdatedEvent } from '@d19n/odin-types/dist/core';
14
+ /**
15
+ * Properties for SetPendingAmcoWorkOrder action
16
+ *
17
+ * @property Required fields: 0
18
+ * @property Optional fields: 1
19
+ */
20
+ export interface SetPendingAmcoWorkOrderProperties {
21
+ /**
22
+ * PendingAmcoWorkOrder
23
+ *
24
+ * PendingAmcoWorkOrder
25
+ * @type {BOOLEAN}
26
+ */
27
+ PendingAmcoWorkOrder?: boolean;
28
+ }
29
+ /**
30
+ * SetPendingAmcoWorkOrder
31
+ *
32
+ * @actionType UPDATE - Updates an existing Order record
33
+ * @module OrderModule
34
+ * @entity Order
35
+ * @event SetPendingAmcoWorkOrder
36
+ * @permission schema.action.setpendingamcoworkorder.trigger
37
+ * @benchmark This action is tracked for performance benchmarks
38
+ */
39
+ export declare class SetPendingAmcoWorkOrderDto extends OdinRecordUpdateDto<SetPendingAmcoWorkOrderProperties> {
40
+ /** Used by SDK generators to identify action type */
41
+ static readonly ACTION_TYPE = "UPDATE";
42
+ static readonly ACTION_KEY = "SetPendingAmcoWorkOrder";
43
+ static readonly MODULE_NAME = "OrderModule";
44
+ static readonly ENTITIES: string[];
45
+ static readonly EVENT_NAME = "SetPendingAmcoWorkOrder";
46
+ static readonly PERMISSION = "schema.action.setpendingamcoworkorder.trigger";
47
+ readonly actionName: string;
48
+ readonly schemaActionId: string;
49
+ readonly entity: string;
50
+ constructor(record: OdinRecord<any> | {
51
+ id: string;
52
+ entity: string;
53
+ type?: string;
54
+ }, properties: SetPendingAmcoWorkOrderProperties, options?: {
55
+ journeyId?: string;
56
+ stageKey?: string;
57
+ });
58
+ }
59
+ /**
60
+ * RabbitMQ message payload for SetPendingAmcoWorkOrder updated events
61
+ *
62
+ * @event SetPendingAmcoWorkOrder
63
+ */
64
+ export interface SetPendingAmcoWorkOrderMessage extends OdinRecordUpdatedEvent<SetPendingAmcoWorkOrderDto, SetPendingAmcoWorkOrderProperties> {
65
+ }
66
+ /**
67
+ * RabbitMQ routing key for SetPendingAmcoWorkOrder events
68
+ *
69
+ * Subscribe to this key to receive notifications when this action completes.
70
+ * @event SetPendingAmcoWorkOrder
71
+ */
72
+ export declare const ROUTING_KEY_SET_PENDING_AMCO_WORK_ORDER = "SetPendingAmcoWorkOrder";
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /**
3
+ * SetPendingAmcoWorkOrder Action DTO
4
+ *
5
+ * SetPendingAmcoWorkOrder
6
+ *
7
+ * @module OrderModule
8
+ * @entity Order
9
+ * @actionKey SetPendingAmcoWorkOrder
10
+ * @event SetPendingAmcoWorkOrder
11
+ *
12
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ROUTING_KEY_SET_PENDING_AMCO_WORK_ORDER = exports.SetPendingAmcoWorkOrderDto = void 0;
16
+ const core_1 = require("@d19n/odin-types/dist/core");
17
+ /**
18
+ * SetPendingAmcoWorkOrder
19
+ *
20
+ * @actionType UPDATE - Updates an existing Order record
21
+ * @module OrderModule
22
+ * @entity Order
23
+ * @event SetPendingAmcoWorkOrder
24
+ * @permission schema.action.setpendingamcoworkorder.trigger
25
+ * @benchmark This action is tracked for performance benchmarks
26
+ */
27
+ class SetPendingAmcoWorkOrderDto extends core_1.OdinRecordUpdateDto {
28
+ constructor(record, properties, options) {
29
+ super({
30
+ id: record.id,
31
+ entity: record.entity,
32
+ type: record.type,
33
+ properties,
34
+ journeyId: options === null || options === void 0 ? void 0 : options.journeyId,
35
+ stageKey: options === null || options === void 0 ? void 0 : options.stageKey,
36
+ });
37
+ this.actionName = 'SetPendingAmcoWorkOrder';
38
+ this.schemaActionId = '36da260f-603c-4fa8-b81d-25a4b200af46';
39
+ this.entity = 'OrderModule:Order';
40
+ }
41
+ }
42
+ exports.SetPendingAmcoWorkOrderDto = SetPendingAmcoWorkOrderDto;
43
+ /** Used by SDK generators to identify action type */
44
+ SetPendingAmcoWorkOrderDto.ACTION_TYPE = 'UPDATE';
45
+ SetPendingAmcoWorkOrderDto.ACTION_KEY = 'SetPendingAmcoWorkOrder';
46
+ SetPendingAmcoWorkOrderDto.MODULE_NAME = 'OrderModule';
47
+ SetPendingAmcoWorkOrderDto.ENTITIES = ['Order'];
48
+ SetPendingAmcoWorkOrderDto.EVENT_NAME = 'SetPendingAmcoWorkOrder';
49
+ SetPendingAmcoWorkOrderDto.PERMISSION = 'schema.action.setpendingamcoworkorder.trigger';
50
+ /**
51
+ * RabbitMQ routing key for SetPendingAmcoWorkOrder events
52
+ *
53
+ * Subscribe to this key to receive notifications when this action completes.
54
+ * @event SetPendingAmcoWorkOrder
55
+ */
56
+ exports.ROUTING_KEY_SET_PENDING_AMCO_WORK_ORDER = 'SetPendingAmcoWorkOrder';
@@ -0,0 +1,45 @@
1
+ import { OauthParams } from '@d19n/odin-sdk-generator/dist/odin-sdk-types';
2
+ import { ApiProvider } from '@d19n/odin-sdk-generator/dist/api.provider';
3
+ import { OdinSearchV2, OdinRecordCreateDto, OdinRecordUpdateDto } from '@d19n/odin-types/dist/core';
4
+ import { CampaignProperties } from '../entities-v2/Campaign';
5
+ /**
6
+ * @deprecated Use OdinApiClient.
7
+ *
8
+ * Migration:
9
+ * - Old: new CampaignApi(authParams).get(id)
10
+ * - New: new odin.campaign.get(id)
11
+ *
12
+ * The new OdinApiClient returns typed record wrappers with action methods.
13
+ */
14
+ export declare class CampaignApi extends ApiProvider {
15
+ protected readonly authToken?: string;
16
+ private readonly moduleName;
17
+ private readonly entityName;
18
+ private sourceRecord;
19
+ constructor(authParams?: OauthParams, authToken?: string);
20
+ setRecord(sourceRecord: any): void;
21
+ schema(): Promise<import("@d19n/odin-types/dist/core").OdinSchema>;
22
+ search(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").OdinSearchResponse<import("@d19n/odin-types/dist/core").OdinRecord<CampaignProperties>>>;
23
+ searchAndPaginate(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").OdinSearchResponse<import("@d19n/odin-types/dist/core").OdinRecord<CampaignProperties>>>;
24
+ reIndex(body: {
25
+ id: string;
26
+ schemaId: string;
27
+ }[]): Promise<any>;
28
+ get(campaignId: string): Promise<import("@d19n/odin-types/dist/core").OdinRecord<CampaignProperties>>;
29
+ getMany(campaignIds: string[]): Promise<import("@d19n/odin-types/dist/core").OdinRecord<CampaignProperties>[]>;
30
+ upsert(upsertDto: OdinRecordCreateDto): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").IDbRecordCreateUpdateRes>;
31
+ upsertMany(upsertDtos: OdinRecordCreateDto[]): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").IDbRecordCreateUpdateRes[]>;
32
+ update(updateDto: OdinRecordUpdateDto): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").IDbRecordCreateUpdateRes>;
33
+ updateMany(updateDtos: OdinRecordUpdateDto[]): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").IDbRecordCreateUpdateRes[]>;
34
+ delete(campaignId: string): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").OdinDeleteResponse[]>;
35
+ deleteMany(campaignIds: string[]): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").OdinDeleteResponse[]>;
36
+ restore(campaignIds: string[]): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").OdinRestoreResponse[]>;
37
+ applyAction(dto: any): Promise<any[]>;
38
+ bulkApplyActions(dtos: any[]): Promise<any[]>;
39
+ getVersions(): Promise<{
40
+ [key: string]: Record<string, any>;
41
+ }>;
42
+ getRevisionTimeline(): Promise<{
43
+ [key: string]: Record<string, any>[];
44
+ }>;
45
+ }
@@ -0,0 +1,151 @@
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.CampaignApi = void 0;
13
+ const api_provider_1 = require("@d19n/odin-sdk-generator/dist/api.provider");
14
+ /**
15
+ * @deprecated Use OdinApiClient.
16
+ *
17
+ * Migration:
18
+ * - Old: new CampaignApi(authParams).get(id)
19
+ * - New: new odin.campaign.get(id)
20
+ *
21
+ * The new OdinApiClient returns typed record wrappers with action methods.
22
+ */
23
+ class CampaignApi extends api_provider_1.ApiProvider {
24
+ // ============================================
25
+ // PRIVATE BACKING FIELDS (Lazy Loading)
26
+ // ============================================
27
+ constructor(authParams, authToken) {
28
+ super(authParams, authToken);
29
+ this.authToken = authToken;
30
+ this.moduleName = 'CrmModule';
31
+ this.entityName = 'Campaign';
32
+ // Link managers are lazy-loaded on first access
33
+ }
34
+ // ============================================
35
+ // LAZY-LOADED LINK MANAGERS (Public Getters)
36
+ // ============================================
37
+ // Usage remains identical: api.address.list(recordId)
38
+ // ============================================
39
+ // STANDARD METHODS (Unchanged API)
40
+ // ============================================
41
+ setRecord(sourceRecord) {
42
+ this.sourceRecord = sourceRecord;
43
+ }
44
+ schema() {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ return yield this.getSchema(this.moduleName, this.entityName);
47
+ });
48
+ }
49
+ // Use this function when you want to search and handle all pagination on your own
50
+ search(params) {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ return yield this._searchRecords(this.moduleName, this.entityName, params);
53
+ });
54
+ }
55
+ // Use this function when you want paginating through the results to be handled
56
+ searchAndPaginate(params) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ return yield this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params);
59
+ });
60
+ }
61
+ // Use this function to re-index records in elastic search
62
+ reIndex(body) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ return yield this._reIndexRecords(body);
65
+ });
66
+ }
67
+ // Use this function when you want to return a single record
68
+ get(campaignId) {
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ const res = yield this._getByPrimaryKey(this.moduleName, this.entityName, campaignId);
71
+ if (res)
72
+ this.setRecord(res);
73
+ return res;
74
+ });
75
+ }
76
+ // Use this function when you want to return many records by primaryKeys
77
+ getMany(campaignIds) {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ return yield this._getManyByPrimaryKey(this.moduleName, this.entityName, campaignIds);
80
+ });
81
+ }
82
+ // Use this function when you want to upsert one record
83
+ upsert(upsertDto) {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ const res = yield this._upsert(this.moduleName, this.entityName, [upsertDto]);
86
+ return res[0];
87
+ });
88
+ }
89
+ // Use this function when you want to upsert many records
90
+ upsertMany(upsertDtos) {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ return yield this._upsert(this.moduleName, this.entityName, upsertDtos);
93
+ });
94
+ }
95
+ // Use this function when you want to update one record
96
+ update(updateDto) {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ const res = yield this._update(this.moduleName, this.entityName, [updateDto]);
99
+ return res[0];
100
+ });
101
+ }
102
+ // Use this function when you want to update many records
103
+ updateMany(updateDtos) {
104
+ return __awaiter(this, void 0, void 0, function* () {
105
+ return yield this._update(this.moduleName, this.entityName, updateDtos);
106
+ });
107
+ }
108
+ // Use this function when you want to delete one record
109
+ delete(campaignId) {
110
+ return __awaiter(this, void 0, void 0, function* () {
111
+ return yield this._delete(this.moduleName, this.entityName, [campaignId]);
112
+ });
113
+ }
114
+ // Use this function when you want to delete many records
115
+ deleteMany(campaignIds) {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ return yield this._delete(this.moduleName, this.entityName, campaignIds);
118
+ });
119
+ }
120
+ // Use this function when you want to restore one or many records
121
+ restore(campaignIds) {
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ return yield this._restore(this.moduleName, this.entityName, campaignIds);
124
+ });
125
+ }
126
+ // Use this function when you want to apply a single action
127
+ applyAction(dto) {
128
+ return __awaiter(this, void 0, void 0, function* () {
129
+ return yield this._applyAction(this.moduleName, this.entityName, dto);
130
+ });
131
+ }
132
+ // Use this function when you want to bulk apply actions
133
+ bulkApplyActions(dtos) {
134
+ return __awaiter(this, void 0, void 0, function* () {
135
+ return yield this._bulkApplyActions(this.moduleName, this.entityName, dtos);
136
+ });
137
+ }
138
+ // Use this function when you want to return the versions for a single record
139
+ getVersions() {
140
+ return __awaiter(this, void 0, void 0, function* () {
141
+ return yield this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id);
142
+ });
143
+ }
144
+ // Use this function when you want to return the change history for a single record
145
+ getRevisionTimeline() {
146
+ return __awaiter(this, void 0, void 0, function* () {
147
+ return yield this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id);
148
+ });
149
+ }
150
+ }
151
+ exports.CampaignApi = CampaignApi;
@@ -0,0 +1,34 @@
1
+ import { DbProvider } from '@d19n/odin-sdk-generator/dist/db.provider';
2
+ import { OdinSearchV2, OdinRecordCreateDto, OdinRecordUpdateDto } from '@d19n/odin-types/dist/core';
3
+ import { CampaignProperties } from '../entities-v2/Campaign';
4
+ /**
5
+ * @deprecated Use OdinDbClient.
6
+ *
7
+ * Migration:
8
+ * - Old: new CampaignApi(authParams).get(id)
9
+ * - New: new odin.campaign.get(id)
10
+ *
11
+ * The new OdinDbClient returns typed record wrappers with action methods.
12
+ */
13
+ export declare class CampaignDb extends DbProvider {
14
+ protected readonly principal: any;
15
+ protected readonly dbService: any;
16
+ private readonly moduleName;
17
+ private readonly entityName;
18
+ private sourceRecord;
19
+ constructor(principal: any, dbService: any);
20
+ setRecord(sourceRecord: any): void;
21
+ searchRecords(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-types/dist/core/interfaces/v2.db.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/core").OdinRecord<CampaignProperties>>>;
22
+ searchAllRecordsAndPaginate(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-types/dist/core/interfaces/v2.db.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/core").OdinRecord<CampaignProperties>>>;
23
+ getByPrimaryKey(campaignId: string): Promise<import("@d19n/odin-types/dist/core").OdinRecord<CampaignProperties>>;
24
+ getManyByPrimaryKey(campaignIds: string[]): Promise<import("@d19n/odin-types/dist/core").OdinRecord<CampaignProperties>[]>;
25
+ upsert(upsertDto: OdinRecordCreateDto): Promise<import("@d19n/odin-sdk-generator").IDbRecordCreateUpdateRes>;
26
+ upsertMany(upsertDtos: OdinRecordCreateDto[]): Promise<import("@d19n/odin-sdk-generator").IDbRecordCreateUpdateRes[]>;
27
+ update(updateDto: OdinRecordUpdateDto): Promise<import("@d19n/odin-sdk-generator").IDbRecordCreateUpdateRes>;
28
+ updateMany(updateDtos: OdinRecordUpdateDto[]): Promise<import("@d19n/odin-sdk-generator").IDbRecordCreateUpdateRes[]>;
29
+ delete(campaignIds: string[]): Promise<import("@d19n/odin-sdk-generator").DbRecordDeleted[]>;
30
+ restore(campaignIds: string[]): Promise<import("@d19n/odin-sdk-generator").DbRecordRestored[]>;
31
+ applyAction(actionName: string, dto: any): Promise<import("@d19n/odin-sdk-generator").IDbRecordCreateUpdateRes[]>;
32
+ getVersions(): Promise<any>;
33
+ getRevisionTimeline(): Promise<any>;
34
+ }
@@ -0,0 +1,129 @@
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.CampaignDb = void 0;
13
+ const db_provider_1 = require("@d19n/odin-sdk-generator/dist/db.provider");
14
+ /**
15
+ * @deprecated Use OdinDbClient.
16
+ *
17
+ * Migration:
18
+ * - Old: new CampaignApi(authParams).get(id)
19
+ * - New: new odin.campaign.get(id)
20
+ *
21
+ * The new OdinDbClient returns typed record wrappers with action methods.
22
+ */
23
+ class CampaignDb extends db_provider_1.DbProvider {
24
+ // ============================================
25
+ // PRIVATE BACKING FIELDS (Lazy Loading)
26
+ // ============================================
27
+ constructor(principal, dbService) {
28
+ super(principal, dbService);
29
+ this.moduleName = 'CrmModule';
30
+ this.entityName = 'Campaign';
31
+ this.principal = principal;
32
+ this.dbService = dbService;
33
+ // Link managers are lazy-loaded on first access
34
+ }
35
+ // ============================================
36
+ // LAZY-LOADED LINK MANAGERS (Public Getters)
37
+ // ============================================
38
+ // Usage remains identical: db.address.list(recordId)
39
+ // ============================================
40
+ // STANDARD METHODS (Unchanged API)
41
+ // ============================================
42
+ setRecord(sourceRecord) {
43
+ this.sourceRecord = sourceRecord;
44
+ }
45
+ // Use this function when you want to search and handle all pagination on your own
46
+ searchRecords(params) {
47
+ return __awaiter(this, void 0, void 0, function* () {
48
+ return yield this._searchRecords(this.moduleName, this.entityName, params);
49
+ });
50
+ }
51
+ // Use this function when you want paginating through the results to be handled
52
+ searchAllRecordsAndPaginate(params) {
53
+ return __awaiter(this, void 0, void 0, function* () {
54
+ return yield this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params);
55
+ });
56
+ }
57
+ // Use this function when you want to return a single record
58
+ getByPrimaryKey(campaignId) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ const res = yield this._getByPrimaryKey(this.moduleName, this.entityName, campaignId);
61
+ if (res)
62
+ this.setRecord(res);
63
+ return res;
64
+ });
65
+ }
66
+ // Use this function when you want to return many records by primaryKeys
67
+ getManyByPrimaryKey(campaignIds) {
68
+ return __awaiter(this, void 0, void 0, function* () {
69
+ return yield this._getManyByPrimaryKey(this.moduleName, this.entityName, campaignIds);
70
+ });
71
+ }
72
+ // Use this function when you want to upsert one record
73
+ upsert(upsertDto) {
74
+ return __awaiter(this, void 0, void 0, function* () {
75
+ const res = yield 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
+ upsertMany(upsertDtos) {
81
+ return __awaiter(this, void 0, void 0, function* () {
82
+ return yield this._upsert(this.moduleName, this.entityName, upsertDtos);
83
+ });
84
+ }
85
+ // Use this function when you want to update one record
86
+ update(updateDto) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ const res = yield this._update(this.moduleName, this.entityName, [updateDto]);
89
+ return res[0];
90
+ });
91
+ }
92
+ // Use this function when you want to update many records
93
+ updateMany(updateDtos) {
94
+ return __awaiter(this, void 0, void 0, function* () {
95
+ return yield this._update(this.moduleName, this.entityName, updateDtos);
96
+ });
97
+ }
98
+ // Use this function when you want to delete one or many records
99
+ delete(campaignIds) {
100
+ return __awaiter(this, void 0, void 0, function* () {
101
+ return yield this._delete(this.moduleName, this.entityName, campaignIds);
102
+ });
103
+ }
104
+ // Use this function when you want to restore one or many records
105
+ restore(campaignIds) {
106
+ return __awaiter(this, void 0, void 0, function* () {
107
+ return yield this._restore(this.moduleName, this.entityName, campaignIds);
108
+ });
109
+ }
110
+ // Use this function when you want to apply actions
111
+ applyAction(actionName, dto) {
112
+ return __awaiter(this, void 0, void 0, function* () {
113
+ return yield this._applyAction(this.moduleName, this.entityName, dto);
114
+ });
115
+ }
116
+ // Use this function when you want to return the versions for a single record
117
+ getVersions() {
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ return yield this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id);
120
+ });
121
+ }
122
+ // Use this function when you want to return the change history for a single record
123
+ getRevisionTimeline() {
124
+ return __awaiter(this, void 0, void 0, function* () {
125
+ return yield this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id);
126
+ });
127
+ }
128
+ }
129
+ exports.CampaignDb = CampaignDb;
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Campaign Entity Definition
3
+ *
4
+ * Marketing campaign with payout rules defining referral rewards
5
+ *
6
+ * @module CrmModule
7
+ * @entity Campaign
8
+ * @schemaId 8715d88d-bd48-41d7-9f00-786eb18f216c
9
+ *
10
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
11
+ * Generated from Odin schema definition
12
+ */
13
+ import { OdinRecord } from '@d19n/odin-types/dist/core';
14
+ /**
15
+ * Available types for Campaign records
16
+ */
17
+ export declare enum CampaignEntityTypes {
18
+ /** Campaign definition designed for order flow */
19
+ ORDER = "ORDER"
20
+ }
21
+ /**
22
+ * Property keys for Campaign
23
+ * Use these constants instead of string literals for type safety
24
+ */
25
+ export declare enum CampaignPropertyKeys {
26
+ /** Definition of reward rules and conditions */
27
+ PayoutPolicy = "PayoutPolicy",
28
+ /** Campaign name */
29
+ Name = "Name"
30
+ }
31
+ /**
32
+ * Properties for Campaign records
33
+ *
34
+ * @see CrmModule:Campaign
35
+ */
36
+ export interface CampaignProperties {
37
+ /** Definition of reward rules and conditions
38
+ *
39
+ * @type {JSON}
40
+ */
41
+ PayoutPolicy: string;
42
+ /** Campaign name
43
+ *
44
+ * @type {TEXT}
45
+ */
46
+ Name: string;
47
+ }
48
+ /**
49
+ * Campaign entity from CrmModule
50
+ *
51
+ * Marketing campaign with payout rules defining referral rewards
52
+ *
53
+ * @module CrmModule
54
+ * @entity Campaign
55
+ * @schemaId 8715d88d-bd48-41d7-9f00-786eb18f216c
56
+ * @capabilities searchable, updateable, undeletable, triggerable
57
+ */
58
+ export declare class Campaign extends OdinRecord<CampaignProperties> {
59
+ entity: 'CrmModule:Campaign';
60
+ type: CampaignEntityTypes;
61
+ schemaId: '8715d88d-bd48-41d7-9f00-786eb18f216c';
62
+ properties: CampaignProperties;
63
+ }
64
+ /**
65
+ * RabbitMQ routing keys for Campaign events
66
+ */
67
+ export declare const ROUTING_KEY_CAMPAIGN_CREATED = "CrmModule.Campaign.SubDbRecordCreated";
68
+ export declare const ROUTING_KEY_CAMPAIGN_UPDATED = "CrmModule.Campaign.SubDbRecordUpdated";
69
+ export declare const ROUTING_KEY_CAMPAIGN_DELETED = "CrmModule.Campaign.SubDbRecordDeleted";