@d19n/youfibre-odin-sdk 2.0.343 → 2.0.344

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/README.md CHANGED
@@ -124,7 +124,7 @@ await workOrder.completeWorkOrder({ ... });
124
124
 
125
125
  ## Entities
126
126
 
127
- This SDK includes **196** entities across **13** modules.
127
+ This SDK includes **197** entities across **13** modules.
128
128
 
129
129
  ### CrmModule
130
130
 
@@ -238,6 +238,7 @@ This SDK includes **196** entities across **13** modules.
238
238
  |--------|-------------|-------|
239
239
  | **BillingAdjustment** | BillingAdjustment Entity Definition | DEFAULT |
240
240
  | **ChurnRequest** | ChurnRequest Entity Definition | DEFAULT |
241
+ | **Commitment** | Commitment Entity Definition | DEFAULT |
241
242
  | **ContractBuyOut** | ContractBuyOut Entity Definition | DEFAULT |
242
243
  | **DeactivationApproval** | DeactivationApproval Entity Definition | DEFAULT |
243
244
  | **OneTouchSwitch** | OneTouchSwitch Entity Definition | GAINING, LOSING |
@@ -0,0 +1,48 @@
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 { ApiRecordLinkManager } from '@d19n/odin-sdk-generator/dist/api.record.link.manager';
5
+ import { CommitmentProperties } from '../entities-v2/Commitment';
6
+ /**
7
+ * @deprecated Use OdinApiClient.
8
+ *
9
+ * Migration:
10
+ * - Old: new CommitmentApi(authParams).get(id)
11
+ * - New: new odin.commitment.get(id)
12
+ *
13
+ * The new OdinApiClient returns typed record wrappers with action methods.
14
+ */
15
+ export declare class CommitmentApi extends ApiProvider {
16
+ protected readonly authToken?: string;
17
+ private readonly moduleName;
18
+ private readonly entityName;
19
+ private sourceRecord;
20
+ private _order?;
21
+ constructor(authParams?: OauthParams, authToken?: string);
22
+ get order(): ApiRecordLinkManager;
23
+ setRecord(sourceRecord: any): void;
24
+ schema(): Promise<import("@d19n/odin-types/dist/core").OdinSchema>;
25
+ search(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").OdinSearchResponse<import("@d19n/odin-types/dist/core").OdinRecord<CommitmentProperties>>>;
26
+ searchAndPaginate(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").OdinSearchResponse<import("@d19n/odin-types/dist/core").OdinRecord<CommitmentProperties>>>;
27
+ reIndex(body: {
28
+ id: string;
29
+ schemaId: string;
30
+ }[]): Promise<any>;
31
+ get(commitmentId: string): Promise<import("@d19n/odin-types/dist/core").OdinRecord<CommitmentProperties>>;
32
+ getMany(commitmentIds: string[]): Promise<import("@d19n/odin-types/dist/core").OdinRecord<CommitmentProperties>[]>;
33
+ upsert(upsertDto: OdinRecordCreateDto): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").IDbRecordCreateUpdateRes>;
34
+ upsertMany(upsertDtos: OdinRecordCreateDto[]): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").IDbRecordCreateUpdateRes[]>;
35
+ update(updateDto: OdinRecordUpdateDto): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").IDbRecordCreateUpdateRes>;
36
+ updateMany(updateDtos: OdinRecordUpdateDto[]): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").IDbRecordCreateUpdateRes[]>;
37
+ delete(commitmentId: string): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").OdinDeleteResponse[]>;
38
+ deleteMany(commitmentIds: string[]): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").OdinDeleteResponse[]>;
39
+ restore(commitmentIds: string[]): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").OdinRestoreResponse[]>;
40
+ applyAction(dto: any): Promise<any[]>;
41
+ bulkApplyActions(dtos: any[]): Promise<any[]>;
42
+ getVersions(): Promise<{
43
+ [key: string]: Record<string, any>;
44
+ }>;
45
+ getRevisionTimeline(): Promise<{
46
+ [key: string]: Record<string, any>[];
47
+ }>;
48
+ }
@@ -0,0 +1,155 @@
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.CommitmentApi = 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
+ /**
16
+ * @deprecated Use OdinApiClient.
17
+ *
18
+ * Migration:
19
+ * - Old: new CommitmentApi(authParams).get(id)
20
+ * - New: new odin.commitment.get(id)
21
+ *
22
+ * The new OdinApiClient returns typed record wrappers with action methods.
23
+ */
24
+ class CommitmentApi extends api_provider_1.ApiProvider {
25
+ constructor(authParams, authToken) {
26
+ super(authParams, authToken);
27
+ this.authToken = authToken;
28
+ this.moduleName = 'OrderModule';
29
+ this.entityName = 'Commitment';
30
+ // Link managers are lazy-loaded on first access
31
+ }
32
+ // ============================================
33
+ // LAZY-LOADED LINK MANAGERS (Public Getters)
34
+ // ============================================
35
+ // Usage remains identical: api.address.list(recordId)
36
+ get order() {
37
+ if (!this._order) {
38
+ this._order = new api_record_link_manager_1.ApiRecordLinkManager(this.authParams, 'OrderModule:Commitment', 'OrderModule:Order', 'Commitment__Order');
39
+ }
40
+ return this._order;
41
+ }
42
+ // ============================================
43
+ // STANDARD METHODS (Unchanged API)
44
+ // ============================================
45
+ setRecord(sourceRecord) {
46
+ this.sourceRecord = sourceRecord;
47
+ }
48
+ schema() {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ return yield this.getSchema(this.moduleName, this.entityName);
51
+ });
52
+ }
53
+ // Use this function when you want to search and handle all pagination on your own
54
+ search(params) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ return yield this._searchRecords(this.moduleName, this.entityName, params);
57
+ });
58
+ }
59
+ // Use this function when you want paginating through the results to be handled
60
+ searchAndPaginate(params) {
61
+ return __awaiter(this, void 0, void 0, function* () {
62
+ return yield this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params);
63
+ });
64
+ }
65
+ // Use this function to re-index records in elastic search
66
+ reIndex(body) {
67
+ return __awaiter(this, void 0, void 0, function* () {
68
+ return yield this._reIndexRecords(body);
69
+ });
70
+ }
71
+ // Use this function when you want to return a single record
72
+ get(commitmentId) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ const res = yield this._getByPrimaryKey(this.moduleName, this.entityName, commitmentId);
75
+ if (res)
76
+ this.setRecord(res);
77
+ return res;
78
+ });
79
+ }
80
+ // Use this function when you want to return many records by primaryKeys
81
+ getMany(commitmentIds) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ return yield this._getManyByPrimaryKey(this.moduleName, this.entityName, commitmentIds);
84
+ });
85
+ }
86
+ // Use this function when you want to upsert one record
87
+ upsert(upsertDto) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ const res = yield this._upsert(this.moduleName, this.entityName, [upsertDto]);
90
+ return res[0];
91
+ });
92
+ }
93
+ // Use this function when you want to upsert many records
94
+ upsertMany(upsertDtos) {
95
+ return __awaiter(this, void 0, void 0, function* () {
96
+ return yield this._upsert(this.moduleName, this.entityName, upsertDtos);
97
+ });
98
+ }
99
+ // Use this function when you want to update one record
100
+ update(updateDto) {
101
+ return __awaiter(this, void 0, void 0, function* () {
102
+ const res = yield this._update(this.moduleName, this.entityName, [updateDto]);
103
+ return res[0];
104
+ });
105
+ }
106
+ // Use this function when you want to update many records
107
+ updateMany(updateDtos) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ return yield this._update(this.moduleName, this.entityName, updateDtos);
110
+ });
111
+ }
112
+ // Use this function when you want to delete one record
113
+ delete(commitmentId) {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ return yield this._delete(this.moduleName, this.entityName, [commitmentId]);
116
+ });
117
+ }
118
+ // Use this function when you want to delete many records
119
+ deleteMany(commitmentIds) {
120
+ return __awaiter(this, void 0, void 0, function* () {
121
+ return yield this._delete(this.moduleName, this.entityName, commitmentIds);
122
+ });
123
+ }
124
+ // Use this function when you want to restore one or many records
125
+ restore(commitmentIds) {
126
+ return __awaiter(this, void 0, void 0, function* () {
127
+ return yield this._restore(this.moduleName, this.entityName, commitmentIds);
128
+ });
129
+ }
130
+ // Use this function when you want to apply a single action
131
+ applyAction(dto) {
132
+ return __awaiter(this, void 0, void 0, function* () {
133
+ return yield this._applyAction(this.moduleName, this.entityName, dto);
134
+ });
135
+ }
136
+ // Use this function when you want to bulk apply actions
137
+ bulkApplyActions(dtos) {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ return yield this._bulkApplyActions(this.moduleName, this.entityName, dtos);
140
+ });
141
+ }
142
+ // Use this function when you want to return the versions for a single record
143
+ getVersions() {
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ return yield this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id);
146
+ });
147
+ }
148
+ // Use this function when you want to return the change history for a single record
149
+ getRevisionTimeline() {
150
+ return __awaiter(this, void 0, void 0, function* () {
151
+ return yield this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id);
152
+ });
153
+ }
154
+ }
155
+ exports.CommitmentApi = CommitmentApi;
@@ -59,6 +59,7 @@ export declare class OrderApi extends ApiProvider {
59
59
  private _dataissue?;
60
60
  private _workorder?;
61
61
  private _email?;
62
+ private _commitment?;
62
63
  constructor(authParams?: OauthParams, authToken?: string);
63
64
  get note(): ApiRecordLinkManager;
64
65
  get lead(): ApiRecordLinkManager;
@@ -102,6 +103,7 @@ export declare class OrderApi extends ApiProvider {
102
103
  get dataissue(): ApiRecordLinkManager;
103
104
  get workorder(): ApiRecordLinkManager;
104
105
  get email(): ApiRecordLinkManager;
106
+ get commitment(): ApiRecordLinkManager;
105
107
  setRecord(sourceRecord: any): void;
106
108
  schema(): Promise<import("@d19n/odin-types/dist/core").OdinSchema>;
107
109
  search(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").OdinSearchResponse<import("@d19n/odin-types/dist/core").OdinRecord<OrderProperties>>>;
@@ -285,6 +285,12 @@ class OrderApi extends api_provider_1.ApiProvider {
285
285
  }
286
286
  return this._email;
287
287
  }
288
+ get commitment() {
289
+ if (!this._commitment) {
290
+ this._commitment = new api_record_link_manager_1.ApiRecordLinkManager(this.authParams, 'OrderModule:Order', 'OrderModule:Commitment', 'Commitment__Order');
291
+ }
292
+ return this._commitment;
293
+ }
288
294
  // ============================================
289
295
  // STANDARD METHODS (Unchanged API)
290
296
  // ============================================
@@ -0,0 +1,120 @@
1
+ import { DbProvider, DbProviderOptions, DbGetQueryOptions } from '@d19n/odin-sdk-generator/dist/db.provider';
2
+ import { OdinSearchV2, OdinRecordCreateDto, OdinRecordUpdateDto } from '@d19n/odin-types/dist/core';
3
+ import { DbRecordLinkManager } from '@d19n/odin-sdk-generator/dist/db.record.link.manager';
4
+ import { CommitmentProperties } from '../entities-v2/Commitment';
5
+ /**
6
+ * @deprecated Use OdinDbClient.
7
+ *
8
+ * Migration:
9
+ * - Old: new CommitmentApi(authParams).get(id)
10
+ * - New: new odin.commitment.get(id)
11
+ *
12
+ * The new OdinDbClient returns typed record wrappers with action methods.
13
+ *
14
+ * Supports separate query options and provider options:
15
+ * - Constructor level: new CommitmentDb(principal, dbService, { omitPermissionsCheck: true })
16
+ * - Method level: await db.getByPrimaryKey(id, { entities: [] }, { omitPermissionsCheck: true })
17
+ */
18
+ export declare class CommitmentDb extends DbProvider {
19
+ protected readonly principal: any;
20
+ protected readonly dbService: any;
21
+ private readonly moduleName;
22
+ private readonly entityName;
23
+ private sourceRecord;
24
+ private _order?;
25
+ constructor(principal: any, dbService: any, defaultOptions?: DbProviderOptions);
26
+ get order(): DbRecordLinkManager;
27
+ setRecord(sourceRecord: any): void;
28
+ /**
29
+ * Search records with manual pagination control
30
+ * @param params - Search parameters
31
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
32
+ */
33
+ searchRecords(params: Partial<OdinSearchV2>, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core/interfaces/v2.db.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/core").OdinRecord<CommitmentProperties>>>;
34
+ /**
35
+ * Search all records with automatic pagination
36
+ * @param params - Search parameters
37
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
38
+ */
39
+ searchAllRecordsAndPaginate(params: Partial<OdinSearchV2>, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core/interfaces/v2.db.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/core").OdinRecord<CommitmentProperties>>>;
40
+ /**
41
+ * Get a single record by primary key
42
+ * @param commitmentId - Record ID
43
+ * @param queryOptions - Query options (WHAT: entities to include)
44
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
45
+ *
46
+ * @example
47
+ * // Simple get
48
+ * const record = await db.getByPrimaryKey(id);
49
+ *
50
+ * // With related entities
51
+ * const record = await db.getByPrimaryKey(id, { entities: ['InvoiceItem', 'Transaction'] });
52
+ *
53
+ * // With permissions bypass
54
+ * const record = await db.getByPrimaryKey(id, {}, { omitPermissionsCheck: true });
55
+ *
56
+ * // Both options
57
+ * const record = await db.getByPrimaryKey(id, { entities: ['Invoice'] }, { omitPermissionsCheck: true });
58
+ */
59
+ getByPrimaryKey(commitmentId: string, queryOptions?: DbGetQueryOptions, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").OdinRecord<CommitmentProperties>>;
60
+ /**
61
+ * Get multiple records by primary keys
62
+ * @param commitmentIds - Array of record IDs
63
+ * @param queryOptions - Query options (WHAT: entities to include)
64
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
65
+ */
66
+ getManyByPrimaryKey(commitmentIds: string[], queryOptions?: DbGetQueryOptions, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").OdinRecord<CommitmentProperties>[]>;
67
+ /**
68
+ * Upsert a single record
69
+ * @param upsertDto - Record to upsert
70
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
71
+ */
72
+ upsert(upsertDto: OdinRecordCreateDto, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes>;
73
+ /**
74
+ * Upsert multiple records
75
+ * @param upsertDtos - Records to upsert
76
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
77
+ */
78
+ upsertMany(upsertDtos: OdinRecordCreateDto[], providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes[]>;
79
+ /**
80
+ * Update a single record
81
+ * @param updateDto - Record to update
82
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
83
+ */
84
+ update(updateDto: OdinRecordUpdateDto, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes>;
85
+ /**
86
+ * Update multiple records
87
+ * @param updateDtos - Records to update
88
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
89
+ */
90
+ updateMany(updateDtos: OdinRecordUpdateDto[], providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes[]>;
91
+ /**
92
+ * Delete one or many records
93
+ * @param commitmentIds - Record IDs to delete
94
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
95
+ */
96
+ delete(commitmentIds: string[], providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-sdk-generator").DbRecordDeleted[]>;
97
+ /**
98
+ * Restore one or many deleted records
99
+ * @param commitmentIds - Record IDs to restore
100
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
101
+ */
102
+ restore(commitmentIds: string[], providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-sdk-generator").DbRecordRestored[]>;
103
+ /**
104
+ * Apply an action to a record
105
+ * @param actionName - The action key
106
+ * @param dto - The action DTO
107
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
108
+ */
109
+ applyAction(actionName: string, dto: any, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes[]>;
110
+ /**
111
+ * Get version history for the current source record
112
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
113
+ */
114
+ getVersions(providerOptions?: DbProviderOptions): Promise<any>;
115
+ /**
116
+ * Get revision timeline for the current source record
117
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
118
+ */
119
+ getRevisionTimeline(providerOptions?: DbProviderOptions): Promise<any>;
120
+ }
@@ -0,0 +1,204 @@
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.CommitmentDb = 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
+ /**
16
+ * @deprecated Use OdinDbClient.
17
+ *
18
+ * Migration:
19
+ * - Old: new CommitmentApi(authParams).get(id)
20
+ * - New: new odin.commitment.get(id)
21
+ *
22
+ * The new OdinDbClient returns typed record wrappers with action methods.
23
+ *
24
+ * Supports separate query options and provider options:
25
+ * - Constructor level: new CommitmentDb(principal, dbService, { omitPermissionsCheck: true })
26
+ * - Method level: await db.getByPrimaryKey(id, { entities: [] }, { omitPermissionsCheck: true })
27
+ */
28
+ class CommitmentDb extends db_provider_1.DbProvider {
29
+ constructor(principal, dbService, defaultOptions) {
30
+ super(principal, dbService, defaultOptions);
31
+ this.moduleName = 'OrderModule';
32
+ this.entityName = 'Commitment';
33
+ this.principal = principal;
34
+ this.dbService = dbService;
35
+ // Link managers are lazy-loaded on first access
36
+ }
37
+ // ============================================
38
+ // LAZY-LOADED LINK MANAGERS (Public Getters)
39
+ // ============================================
40
+ // Usage remains identical: db.address.list(recordId)
41
+ get order() {
42
+ if (!this._order) {
43
+ this._order = new db_record_link_manager_1.DbRecordLinkManager(this.principal, this.dbService, 'OrderModule:Commitment', 'OrderModule:Order', 'Commitment__Order');
44
+ }
45
+ return this._order;
46
+ }
47
+ // ============================================
48
+ // STANDARD METHODS
49
+ // ============================================
50
+ // Methods support separate query options and provider options for clean API
51
+ setRecord(sourceRecord) {
52
+ this.sourceRecord = sourceRecord;
53
+ }
54
+ /**
55
+ * Search records with manual pagination control
56
+ * @param params - Search parameters
57
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
58
+ */
59
+ searchRecords(params, providerOptions) {
60
+ return __awaiter(this, void 0, void 0, function* () {
61
+ return yield this._searchRecords(this.moduleName, this.entityName, params, providerOptions);
62
+ });
63
+ }
64
+ /**
65
+ * Search all records with automatic pagination
66
+ * @param params - Search parameters
67
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
68
+ */
69
+ searchAllRecordsAndPaginate(params, providerOptions) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ return yield this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params, 0, providerOptions);
72
+ });
73
+ }
74
+ /**
75
+ * Get a single record by primary key
76
+ * @param commitmentId - Record ID
77
+ * @param queryOptions - Query options (WHAT: entities to include)
78
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
79
+ *
80
+ * @example
81
+ * // Simple get
82
+ * const record = await db.getByPrimaryKey(id);
83
+ *
84
+ * // With related entities
85
+ * const record = await db.getByPrimaryKey(id, { entities: ['InvoiceItem', 'Transaction'] });
86
+ *
87
+ * // With permissions bypass
88
+ * const record = await db.getByPrimaryKey(id, {}, { omitPermissionsCheck: true });
89
+ *
90
+ * // Both options
91
+ * const record = await db.getByPrimaryKey(id, { entities: ['Invoice'] }, { omitPermissionsCheck: true });
92
+ */
93
+ getByPrimaryKey(commitmentId, queryOptions, providerOptions) {
94
+ return __awaiter(this, void 0, void 0, function* () {
95
+ const res = yield this._getByPrimaryKey(this.moduleName, this.entityName, commitmentId, queryOptions, providerOptions);
96
+ if (res)
97
+ this.setRecord(res);
98
+ return res;
99
+ });
100
+ }
101
+ /**
102
+ * Get multiple records by primary keys
103
+ * @param commitmentIds - Array of record IDs
104
+ * @param queryOptions - Query options (WHAT: entities to include)
105
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
106
+ */
107
+ getManyByPrimaryKey(commitmentIds, queryOptions, providerOptions) {
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ return yield this._getManyByPrimaryKey(this.moduleName, this.entityName, commitmentIds, queryOptions, providerOptions);
110
+ });
111
+ }
112
+ /**
113
+ * Upsert a single record
114
+ * @param upsertDto - Record to upsert
115
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
116
+ */
117
+ upsert(upsertDto, providerOptions) {
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ const res = yield this._upsert(this.moduleName, this.entityName, [upsertDto], providerOptions);
120
+ return res[0];
121
+ });
122
+ }
123
+ /**
124
+ * Upsert multiple records
125
+ * @param upsertDtos - Records to upsert
126
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
127
+ */
128
+ upsertMany(upsertDtos, providerOptions) {
129
+ return __awaiter(this, void 0, void 0, function* () {
130
+ return yield this._upsert(this.moduleName, this.entityName, upsertDtos, providerOptions);
131
+ });
132
+ }
133
+ /**
134
+ * Update a single record
135
+ * @param updateDto - Record to update
136
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
137
+ */
138
+ update(updateDto, providerOptions) {
139
+ return __awaiter(this, void 0, void 0, function* () {
140
+ const res = yield this._update(this.moduleName, this.entityName, [updateDto], providerOptions);
141
+ return res[0];
142
+ });
143
+ }
144
+ /**
145
+ * Update multiple records
146
+ * @param updateDtos - Records to update
147
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
148
+ */
149
+ updateMany(updateDtos, providerOptions) {
150
+ return __awaiter(this, void 0, void 0, function* () {
151
+ return yield this._update(this.moduleName, this.entityName, updateDtos, providerOptions);
152
+ });
153
+ }
154
+ /**
155
+ * Delete one or many records
156
+ * @param commitmentIds - Record IDs to delete
157
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
158
+ */
159
+ delete(commitmentIds, providerOptions) {
160
+ return __awaiter(this, void 0, void 0, function* () {
161
+ return yield this._delete(this.moduleName, this.entityName, commitmentIds, providerOptions);
162
+ });
163
+ }
164
+ /**
165
+ * Restore one or many deleted records
166
+ * @param commitmentIds - Record IDs to restore
167
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
168
+ */
169
+ restore(commitmentIds, providerOptions) {
170
+ return __awaiter(this, void 0, void 0, function* () {
171
+ return yield this._restore(this.moduleName, this.entityName, commitmentIds, providerOptions);
172
+ });
173
+ }
174
+ /**
175
+ * Apply an action to a record
176
+ * @param actionName - The action key
177
+ * @param dto - The action DTO
178
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
179
+ */
180
+ applyAction(actionName, dto, providerOptions) {
181
+ return __awaiter(this, void 0, void 0, function* () {
182
+ return yield this._applyAction(this.moduleName, this.entityName, dto, providerOptions);
183
+ });
184
+ }
185
+ /**
186
+ * Get version history for the current source record
187
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
188
+ */
189
+ getVersions(providerOptions) {
190
+ return __awaiter(this, void 0, void 0, function* () {
191
+ return yield this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id, providerOptions);
192
+ });
193
+ }
194
+ /**
195
+ * Get revision timeline for the current source record
196
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
197
+ */
198
+ getRevisionTimeline(providerOptions) {
199
+ return __awaiter(this, void 0, void 0, function* () {
200
+ return yield this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id, providerOptions);
201
+ });
202
+ }
203
+ }
204
+ exports.CommitmentDb = CommitmentDb;
@@ -63,6 +63,7 @@ export declare class OrderDb extends DbProvider {
63
63
  private _dataissue?;
64
64
  private _workorder?;
65
65
  private _email?;
66
+ private _commitment?;
66
67
  constructor(principal: any, dbService: any, defaultOptions?: DbProviderOptions);
67
68
  get note(): DbRecordLinkManager;
68
69
  get lead(): DbRecordLinkManager;
@@ -106,6 +107,7 @@ export declare class OrderDb extends DbProvider {
106
107
  get dataissue(): DbRecordLinkManager;
107
108
  get workorder(): DbRecordLinkManager;
108
109
  get email(): DbRecordLinkManager;
110
+ get commitment(): DbRecordLinkManager;
109
111
  setRecord(sourceRecord: any): void;
110
112
  /**
111
113
  * Search records with manual pagination control
@@ -290,6 +290,12 @@ class OrderDb extends db_provider_1.DbProvider {
290
290
  }
291
291
  return this._email;
292
292
  }
293
+ get commitment() {
294
+ if (!this._commitment) {
295
+ this._commitment = new db_record_link_manager_1.DbRecordLinkManager(this.principal, this.dbService, 'OrderModule:Order', 'OrderModule:Commitment', 'Commitment__Order');
296
+ }
297
+ return this._commitment;
298
+ }
293
299
  // ============================================
294
300
  // STANDARD METHODS
295
301
  // ============================================
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Commitment Entity Definition
3
+ *
4
+ * One thing an order still owes, and when it falls due: the type, the deadline, what discharged it, and where it stands (Not Yet Due / Pending / Breached / Discharged / Not Required). An order is finished when it has no open commitments.
5
+ *
6
+ * @module OrderModule
7
+ * @entity Commitment
8
+ * @schemaId 6961f6fc-9d4b-4913-9677-065e0b67a1ce
9
+ *
10
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
11
+ * Generated from Odin schema definition
12
+ */
13
+ import { OdinRecord, OdinLink, LinkedOdinRecord } from '@d19n/odin-types/dist/core';
14
+ import { OrderProperties } from './Order';
15
+ /**
16
+ * Available types for Commitment records
17
+ */
18
+ export declare enum CommitmentEntityTypes {
19
+ /** This is the default record type */
20
+ DEFAULT = "DEFAULT"
21
+ }
22
+ /**
23
+ * Pipeline stage names for DEFAULT Commitment
24
+ * Pipeline: Commitment
25
+ * What an order owes, from not-yet-owed through to settled.
26
+ */
27
+ export declare enum DefaultCommitmentStageNames {
28
+ /** The precondition has not happened, so there is no clock — not a clock still running. A Supply order before its CommittedDate sits here. (default) */
29
+ NotYetDue = "Not Yet Due",
30
+ /** Owed, and the clock is running — ExpectedBy is in the future. */
31
+ Pending = "Pending",
32
+ /** Owed, ExpectedBy has passed, nothing discharged it. Still open work — it ages. Can still be discharged late, which is how lateness gets measured. */
33
+ Breached = "Breached",
34
+ /** The thing that was owed happened. CompletedBy names the record that did it — a COMPLETED OrderKci, a switch at TRIGGER_CONFIRMED. */
35
+ Complete = "Complete",
36
+ /** Resolved as never owed, with the reason — an order with no switch to trigger. A distinct terminal state from Discharged: nothing happened, rather than the thing happening. */
37
+ NotRequired = "Not Required"
38
+ }
39
+ /**
40
+ * Pipeline stage keys for DEFAULT Commitment
41
+ * Use these keys when transitioning between stages
42
+ */
43
+ export declare enum DefaultCommitmentStageKeys {
44
+ /** The precondition has not happened, so there is no clock — not a clock still running. A Supply order before its CommittedDate sits here. */
45
+ CommitmentStageNotYetDue = "CommitmentStageNotYetDue",
46
+ /** Owed, and the clock is running — ExpectedBy is in the future. */
47
+ CommitmentStagePending = "CommitmentStagePending",
48
+ /** Owed, ExpectedBy has passed, nothing discharged it. Still open work — it ages. Can still be discharged late, which is how lateness gets measured. */
49
+ CommitmentStageBreached = "CommitmentStageBreached",
50
+ /** The thing that was owed happened. CompletedBy names the record that did it — a COMPLETED OrderKci, a switch at TRIGGER_CONFIRMED. */
51
+ CommitmentStageComplete = "CommitmentStageComplete",
52
+ /** Resolved as never owed, with the reason — an order with no switch to trigger. A distinct terminal state from Discharged: nothing happened, rather than the thing happening. */
53
+ CommitmentStageNotRequired = "CommitmentStageNotRequired"
54
+ }
55
+ /**
56
+ * Property keys for Commitment
57
+ * Use these constants instead of string literals for type safety
58
+ */
59
+ export declare enum CommitmentPropertyKeys {
60
+ /** orderId::type — the natural key. UNIQUE, and what upsertOnCreate hashes, so the reconciler cannot create a second commitment for something already owed. */
61
+ Fingerprint = "Fingerprint",
62
+ /** The invariant's stableId, e.g. yf/ORDER/OrderStageSupply/supply-completed-kci-must-arrive-by-committed-date. Generated into COMMITMENT-CATALOG.json from the BP, so this is an address the rest of the estate already uses rather than a new vocabulary. */
63
+ Type = "Type",
64
+ /** When it falls due. Empty only while NOT_YET_DUE — a BREACHED commitment without one would be past a deadline that does not exist, which is a fault in whatever created it. */
65
+ ExpectedBy = "ExpectedBy",
66
+ /** The record that settled it, as entity and id — e.g. OrderModule:OrderKci/<id>. Text rather than a typed association per dischargeable entity, so a new commitment type needs no schema change. */
67
+ CompletedBy = "CompletedBy",
68
+ /** When it was settled. Together with ExpectedBy this says whether it was late. */
69
+ CompletedAt = "CompletedAt",
70
+ /** Why it was never owed, when it resolves that way — e.g. NO_CURRENT_PROVIDER for an order with no switch to trigger. Without this, "not required" is indistinguishable from "nobody looked". */
71
+ NotRequiredReason = "NotRequiredReason"
72
+ }
73
+ /**
74
+ * Properties for Commitment records
75
+ *
76
+ * @see OrderModule:Commitment
77
+ */
78
+ export interface CommitmentProperties {
79
+ /** orderId::type — the natural key. UNIQUE, and what upsertOnCreate hashes, so the reconciler cannot create a second commitment for something already owed.
80
+ *
81
+ * @type {TEXT}
82
+ * @default
83
+ */
84
+ Fingerprint: string;
85
+ /** The invariant's stableId, e.g. yf/ORDER/OrderStageSupply/supply-completed-kci-must-arrive-by-committed-date. Generated into COMMITMENT-CATALOG.json from the BP, so this is an address the rest of the estate already uses rather than a new vocabulary.
86
+ *
87
+ * @type {TEXT}
88
+ * @default
89
+ */
90
+ Type: string;
91
+ /** When it falls due. Empty only while NOT_YET_DUE — a BREACHED commitment without one would be past a deadline that does not exist, which is a fault in whatever created it.
92
+ *
93
+ * @type {DATE_TIME}
94
+ * @default
95
+ */
96
+ ExpectedBy: string;
97
+ /** The record that settled it, as entity and id — e.g. OrderModule:OrderKci/<id>. Text rather than a typed association per dischargeable entity, so a new commitment type needs no schema change.
98
+ *
99
+ * @type {TEXT}
100
+ * @default
101
+ */
102
+ CompletedBy: string;
103
+ /** When it was settled. Together with ExpectedBy this says whether it was late.
104
+ *
105
+ * @type {DATE_TIME}
106
+ * @default
107
+ */
108
+ CompletedAt: string;
109
+ /** Why it was never owed, when it resolves that way — e.g. NO_CURRENT_PROVIDER for an order with no switch to trigger. Without this, "not required" is indistinguishable from "nobody looked".
110
+ *
111
+ * @type {TEXT}
112
+ * @default
113
+ */
114
+ NotRequiredReason: string;
115
+ }
116
+ /**
117
+ * Commitment entity from OrderModule
118
+ *
119
+ * One thing an order still owes, and when it falls due: the type, the deadline, what discharged it, and where it stands (Not Yet Due / Pending / Breached / Discharged / Not Required). An order is finished when it has no open commitments.
120
+ *
121
+ * @module OrderModule
122
+ * @entity Commitment
123
+ * @schemaId 6961f6fc-9d4b-4913-9677-065e0b67a1ce
124
+ * @recordPrefix CMT
125
+ * @capabilities searchable, updateable, undeletable, triggerable
126
+ */
127
+ export declare class Commitment extends OdinRecord<CommitmentProperties> {
128
+ entity: 'OrderModule:Commitment';
129
+ type: CommitmentEntityTypes;
130
+ schemaId: '6961f6fc-9d4b-4913-9677-065e0b67a1ce';
131
+ properties: CommitmentProperties;
132
+ /** Linked Order records (Commitment__Order) */
133
+ Order: OdinLink<LinkedOdinRecord<OrderProperties>>;
134
+ }
135
+ /**
136
+ * RabbitMQ routing keys for Commitment events
137
+ */
138
+ export declare const ROUTING_KEY_COMMITMENT_CREATED = "OrderModule.Commitment.SubDbRecordCreated";
139
+ export declare const ROUTING_KEY_COMMITMENT_UPDATED = "OrderModule.Commitment.SubDbRecordUpdated";
140
+ export declare const ROUTING_KEY_COMMITMENT_DELETED = "OrderModule.Commitment.SubDbRecordDeleted";
141
+ /**
142
+ * Type-specific routing keys for Commitment events
143
+ * Subscribe to these for events on specific entity types only
144
+ */
145
+ /** This is the default record type created */
146
+ export declare const ROUTING_KEY_COMMITMENT_DEFAULT_CREATED = "OrderModule.Commitment.DEFAULT.SubDbRecordCreated";
147
+ /** This is the default record type updated */
148
+ export declare const ROUTING_KEY_COMMITMENT_DEFAULT_UPDATED = "OrderModule.Commitment.DEFAULT.SubDbRecordUpdated";
149
+ /** This is the default record type deleted */
150
+ export declare const ROUTING_KEY_COMMITMENT_DEFAULT_DELETED = "OrderModule.Commitment.DEFAULT.SubDbRecordDeleted";
151
+ /** Event: Commitment__Order link created */
152
+ export declare const ROUTING_KEY_LINK_COMMITMENT_ORDER_CREATED = "OrderModule.Commitment.Order.SubDbRecordAssociationCreated";
153
+ /** Event: Commitment__Order link deleted */
154
+ export declare const ROUTING_KEY_LINK_COMMITMENT_ORDER_DELETED = "OrderModule.Commitment.Order.SubDbRecordAssociationDeleted";
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ /**
3
+ * Commitment Entity Definition
4
+ *
5
+ * One thing an order still owes, and when it falls due: the type, the deadline, what discharged it, and where it stands (Not Yet Due / Pending / Breached / Discharged / Not Required). An order is finished when it has no open commitments.
6
+ *
7
+ * @module OrderModule
8
+ * @entity Commitment
9
+ * @schemaId 6961f6fc-9d4b-4913-9677-065e0b67a1ce
10
+ *
11
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
12
+ * Generated from Odin schema definition
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ROUTING_KEY_LINK_COMMITMENT_ORDER_DELETED = exports.ROUTING_KEY_LINK_COMMITMENT_ORDER_CREATED = exports.ROUTING_KEY_COMMITMENT_DEFAULT_DELETED = exports.ROUTING_KEY_COMMITMENT_DEFAULT_UPDATED = exports.ROUTING_KEY_COMMITMENT_DEFAULT_CREATED = exports.ROUTING_KEY_COMMITMENT_DELETED = exports.ROUTING_KEY_COMMITMENT_UPDATED = exports.ROUTING_KEY_COMMITMENT_CREATED = exports.Commitment = exports.CommitmentPropertyKeys = exports.DefaultCommitmentStageKeys = exports.DefaultCommitmentStageNames = exports.CommitmentEntityTypes = void 0;
16
+ const core_1 = require("@d19n/odin-types/dist/core");
17
+ /**
18
+ * Available types for Commitment records
19
+ */
20
+ var CommitmentEntityTypes;
21
+ (function (CommitmentEntityTypes) {
22
+ /** This is the default record type */
23
+ CommitmentEntityTypes["DEFAULT"] = "DEFAULT";
24
+ })(CommitmentEntityTypes = exports.CommitmentEntityTypes || (exports.CommitmentEntityTypes = {}));
25
+ /**
26
+ * Pipeline stage names for DEFAULT Commitment
27
+ * Pipeline: Commitment
28
+ * What an order owes, from not-yet-owed through to settled.
29
+ */
30
+ var DefaultCommitmentStageNames;
31
+ (function (DefaultCommitmentStageNames) {
32
+ /** The precondition has not happened, so there is no clock — not a clock still running. A Supply order before its CommittedDate sits here. (default) */
33
+ DefaultCommitmentStageNames["NotYetDue"] = "Not Yet Due";
34
+ /** Owed, and the clock is running — ExpectedBy is in the future. */
35
+ DefaultCommitmentStageNames["Pending"] = "Pending";
36
+ /** Owed, ExpectedBy has passed, nothing discharged it. Still open work — it ages. Can still be discharged late, which is how lateness gets measured. */
37
+ DefaultCommitmentStageNames["Breached"] = "Breached";
38
+ /** The thing that was owed happened. CompletedBy names the record that did it — a COMPLETED OrderKci, a switch at TRIGGER_CONFIRMED. */
39
+ DefaultCommitmentStageNames["Complete"] = "Complete";
40
+ /** Resolved as never owed, with the reason — an order with no switch to trigger. A distinct terminal state from Discharged: nothing happened, rather than the thing happening. */
41
+ DefaultCommitmentStageNames["NotRequired"] = "Not Required";
42
+ })(DefaultCommitmentStageNames = exports.DefaultCommitmentStageNames || (exports.DefaultCommitmentStageNames = {}));
43
+ /**
44
+ * Pipeline stage keys for DEFAULT Commitment
45
+ * Use these keys when transitioning between stages
46
+ */
47
+ var DefaultCommitmentStageKeys;
48
+ (function (DefaultCommitmentStageKeys) {
49
+ /** The precondition has not happened, so there is no clock — not a clock still running. A Supply order before its CommittedDate sits here. */
50
+ DefaultCommitmentStageKeys["CommitmentStageNotYetDue"] = "CommitmentStageNotYetDue";
51
+ /** Owed, and the clock is running — ExpectedBy is in the future. */
52
+ DefaultCommitmentStageKeys["CommitmentStagePending"] = "CommitmentStagePending";
53
+ /** Owed, ExpectedBy has passed, nothing discharged it. Still open work — it ages. Can still be discharged late, which is how lateness gets measured. */
54
+ DefaultCommitmentStageKeys["CommitmentStageBreached"] = "CommitmentStageBreached";
55
+ /** The thing that was owed happened. CompletedBy names the record that did it — a COMPLETED OrderKci, a switch at TRIGGER_CONFIRMED. */
56
+ DefaultCommitmentStageKeys["CommitmentStageComplete"] = "CommitmentStageComplete";
57
+ /** Resolved as never owed, with the reason — an order with no switch to trigger. A distinct terminal state from Discharged: nothing happened, rather than the thing happening. */
58
+ DefaultCommitmentStageKeys["CommitmentStageNotRequired"] = "CommitmentStageNotRequired";
59
+ })(DefaultCommitmentStageKeys = exports.DefaultCommitmentStageKeys || (exports.DefaultCommitmentStageKeys = {}));
60
+ /**
61
+ * Property keys for Commitment
62
+ * Use these constants instead of string literals for type safety
63
+ */
64
+ var CommitmentPropertyKeys;
65
+ (function (CommitmentPropertyKeys) {
66
+ /** orderId::type — the natural key. UNIQUE, and what upsertOnCreate hashes, so the reconciler cannot create a second commitment for something already owed. */
67
+ CommitmentPropertyKeys["Fingerprint"] = "Fingerprint";
68
+ /** The invariant's stableId, e.g. yf/ORDER/OrderStageSupply/supply-completed-kci-must-arrive-by-committed-date. Generated into COMMITMENT-CATALOG.json from the BP, so this is an address the rest of the estate already uses rather than a new vocabulary. */
69
+ CommitmentPropertyKeys["Type"] = "Type";
70
+ /** When it falls due. Empty only while NOT_YET_DUE — a BREACHED commitment without one would be past a deadline that does not exist, which is a fault in whatever created it. */
71
+ CommitmentPropertyKeys["ExpectedBy"] = "ExpectedBy";
72
+ /** The record that settled it, as entity and id — e.g. OrderModule:OrderKci/<id>. Text rather than a typed association per dischargeable entity, so a new commitment type needs no schema change. */
73
+ CommitmentPropertyKeys["CompletedBy"] = "CompletedBy";
74
+ /** When it was settled. Together with ExpectedBy this says whether it was late. */
75
+ CommitmentPropertyKeys["CompletedAt"] = "CompletedAt";
76
+ /** Why it was never owed, when it resolves that way — e.g. NO_CURRENT_PROVIDER for an order with no switch to trigger. Without this, "not required" is indistinguishable from "nobody looked". */
77
+ CommitmentPropertyKeys["NotRequiredReason"] = "NotRequiredReason";
78
+ })(CommitmentPropertyKeys = exports.CommitmentPropertyKeys || (exports.CommitmentPropertyKeys = {}));
79
+ /**
80
+ * Commitment entity from OrderModule
81
+ *
82
+ * One thing an order still owes, and when it falls due: the type, the deadline, what discharged it, and where it stands (Not Yet Due / Pending / Breached / Discharged / Not Required). An order is finished when it has no open commitments.
83
+ *
84
+ * @module OrderModule
85
+ * @entity Commitment
86
+ * @schemaId 6961f6fc-9d4b-4913-9677-065e0b67a1ce
87
+ * @recordPrefix CMT
88
+ * @capabilities searchable, updateable, undeletable, triggerable
89
+ */
90
+ class Commitment extends core_1.OdinRecord {
91
+ }
92
+ exports.Commitment = Commitment;
93
+ // ============================================
94
+ // RABBITMQ EVENT ROUTING KEYS
95
+ // ============================================
96
+ /**
97
+ * RabbitMQ routing keys for Commitment events
98
+ */
99
+ exports.ROUTING_KEY_COMMITMENT_CREATED = 'OrderModule.Commitment.SubDbRecordCreated';
100
+ exports.ROUTING_KEY_COMMITMENT_UPDATED = 'OrderModule.Commitment.SubDbRecordUpdated';
101
+ exports.ROUTING_KEY_COMMITMENT_DELETED = 'OrderModule.Commitment.SubDbRecordDeleted';
102
+ /**
103
+ * Type-specific routing keys for Commitment events
104
+ * Subscribe to these for events on specific entity types only
105
+ */
106
+ /** This is the default record type created */
107
+ exports.ROUTING_KEY_COMMITMENT_DEFAULT_CREATED = 'OrderModule.Commitment.DEFAULT.SubDbRecordCreated';
108
+ /** This is the default record type updated */
109
+ exports.ROUTING_KEY_COMMITMENT_DEFAULT_UPDATED = 'OrderModule.Commitment.DEFAULT.SubDbRecordUpdated';
110
+ /** This is the default record type deleted */
111
+ exports.ROUTING_KEY_COMMITMENT_DEFAULT_DELETED = 'OrderModule.Commitment.DEFAULT.SubDbRecordDeleted';
112
+ /** Event: Commitment__Order link created */
113
+ exports.ROUTING_KEY_LINK_COMMITMENT_ORDER_CREATED = 'OrderModule.Commitment.Order.SubDbRecordAssociationCreated';
114
+ /** Event: Commitment__Order link deleted */
115
+ exports.ROUTING_KEY_LINK_COMMITMENT_ORDER_DELETED = 'OrderModule.Commitment.Order.SubDbRecordAssociationDeleted';
@@ -51,6 +51,7 @@ import { RecontractProperties } from './Recontract';
51
51
  import { DataIssueProperties } from './DataIssue';
52
52
  import { WorkOrderProperties } from './WorkOrder';
53
53
  import { EmailProperties } from './Email';
54
+ import { CommitmentProperties } from './Commitment';
54
55
  /**
55
56
  * Available types for Order records
56
57
  */
@@ -377,6 +378,19 @@ export declare enum OrderBatteryBackupAnswersSource {
377
378
  CUSTOMER_APP = "CUSTOMER_APP",
378
379
  CUSTOMER_PORTAL = "CUSTOMER_PORTAL"
379
380
  }
381
+ /**
382
+ * Valid values for Order.FulfillmentState
383
+ *
384
+ * Derived from the commitment set: OPEN while any commitment is Pending or Breached, SETTLED when none is. Written only by the commitment lifecycle.
385
+ *
386
+ * @remarks Available options:
387
+ * - `OPEN` - Open
388
+ * - `SETTLED` - Settled
389
+ */
390
+ export declare enum OrderFulfillmentState {
391
+ OPEN = "OPEN",
392
+ SETTLED = "SETTLED"
393
+ }
380
394
  /**
381
395
  * Property keys for Order
382
396
  * Use these constants instead of string literals for type safety
@@ -593,7 +607,13 @@ export declare enum OrderPropertyKeys {
593
607
  /** The day this order was deactivated. Cleared when the order goes back to Active, and kept when it goes on to Cancelled. Empty means the order is not deactivated. Not to be confused with DeactivateOnDate, which is a scheduled instruction and is cleared once it is acted on. */
594
608
  DeactivationDate = "DeactivationDate",
595
609
  /** Used when restarting an existing service, allows the customer to specify what date is used for the RequestedCompletionDate on the supplier-side START order. Used for when a customer is technically able to start receiving service. */
596
- RequestedActivationDate = "RequestedActivationDate"
610
+ RequestedActivationDate = "RequestedActivationDate",
611
+ /** Derived from the commitment set: OPEN while any commitment is Pending or Breached, SETTLED when none is. Written only by the commitment lifecycle. */
612
+ FulfillmentState = "FulfillmentState",
613
+ /** How many commitments are Pending or Breached. Written only by the lifecycle. */
614
+ OpenCommitmentCount = "OpenCommitmentCount",
615
+ /** The next commitment to fall due. What a "what is about to breach" query sorts on, without walking every commitment. Written only by the lifecycle. */
616
+ EarliestDueAt = "EarliestDueAt"
597
617
  }
598
618
  /**
599
619
  * Properties for Order records
@@ -1257,6 +1277,25 @@ export interface OrderProperties {
1257
1277
  * @type {DATE}
1258
1278
  */
1259
1279
  RequestedActivationDate: string;
1280
+ /** Derived from the commitment set: OPEN while any commitment is Pending or Breached, SETTLED when none is. Written only by the commitment lifecycle.
1281
+ *
1282
+ * @type {ENUM}
1283
+ * @default
1284
+ * @enum {OrderFulfillmentState}
1285
+ */
1286
+ FulfillmentState: OrderFulfillmentState;
1287
+ /** How many commitments are Pending or Breached. Written only by the lifecycle.
1288
+ *
1289
+ * @type {NUMBER}
1290
+ * @default
1291
+ */
1292
+ OpenCommitmentCount: number;
1293
+ /** The next commitment to fall due. What a "what is about to breach" query sorts on, without walking every commitment. Written only by the lifecycle.
1294
+ *
1295
+ * @type {DATE_TIME}
1296
+ * @default
1297
+ */
1298
+ EarliestDueAt: string;
1260
1299
  }
1261
1300
  /**
1262
1301
  * Order entity from OrderModule
@@ -1357,6 +1396,8 @@ export declare class Order extends OdinRecord<OrderProperties> {
1357
1396
  WorkOrder: OdinLink<LinkedOdinRecord<WorkOrderProperties>>;
1358
1397
  /** Linked Email records (Order__Email) */
1359
1398
  Email: OdinLink<LinkedOdinRecord<EmailProperties>>;
1399
+ /** Linked Commitment records (Commitment__Order) */
1400
+ Commitment: OdinLink<LinkedOdinRecord<CommitmentProperties>>;
1360
1401
  }
1361
1402
  /**
1362
1403
  * RabbitMQ routing keys for Order events
@@ -12,8 +12,8 @@
12
12
  * Generated from Odin schema definition
13
13
  */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.ROUTING_KEY_LINK_ORDER_APPOINTMENT_CREATED = exports.ROUTING_KEY_LINK_ORDER_CUSTOMER_DEVICE_ROUTER_DELETED = exports.ROUTING_KEY_LINK_ORDER_CUSTOMER_DEVICE_ROUTER_CREATED = exports.ROUTING_KEY_LINK_ORDER_SMS_MESSAGE_DELETED = exports.ROUTING_KEY_LINK_ORDER_SMS_MESSAGE_CREATED = exports.ROUTING_KEY_LINK_ORDER_ORDER_DELETED = exports.ROUTING_KEY_LINK_ORDER_ORDER_CREATED = exports.ROUTING_KEY_LINK_ORDER_FILE_DELETED = exports.ROUTING_KEY_LINK_ORDER_FILE_CREATED = exports.ROUTING_KEY_LINK_ORDER_ORDER_ITEM_DELETED = exports.ROUTING_KEY_LINK_ORDER_ORDER_ITEM_CREATED = exports.ROUTING_KEY_LINK_ORDER_BILLING_ADJUSTMENT_DELETED = exports.ROUTING_KEY_LINK_ORDER_BILLING_ADJUSTMENT_CREATED = exports.ROUTING_KEY_LINK_ORDER_PUSH_NOTIFICATION_DELETED = exports.ROUTING_KEY_LINK_ORDER_PUSH_NOTIFICATION_CREATED = exports.ROUTING_KEY_LINK_ORDER_DISCOUNT_DELETED = exports.ROUTING_KEY_LINK_ORDER_DISCOUNT_CREATED = exports.ROUTING_KEY_LINK_ORDER_ADDRESS_DELETED = exports.ROUTING_KEY_LINK_ORDER_ADDRESS_CREATED = exports.ROUTING_KEY_LINK_ORDER_PHONE_NUMBER_DELETED = exports.ROUTING_KEY_LINK_ORDER_PHONE_NUMBER_CREATED = exports.ROUTING_KEY_LINK_ORDER_NOTE_DELETED = exports.ROUTING_KEY_LINK_ORDER_NOTE_CREATED = exports.ROUTING_KEY_ORDER_DEFAULT_DELETED = exports.ROUTING_KEY_ORDER_DEFAULT_UPDATED = exports.ROUTING_KEY_ORDER_DEFAULT_CREATED = exports.ROUTING_KEY_ORDER_DELETED = exports.ROUTING_KEY_ORDER_UPDATED = exports.ROUTING_KEY_ORDER_CREATED = exports.Order = exports.OrderPropertyKeys = exports.OrderBatteryBackupAnswersSource = exports.OrderActivationStatus = exports.OrderSupplierOrderType = exports.OrderOtsNotRequiredReason = exports.OrderBatteryPackRequired = exports.OrderMobileCoverage = exports.OrderAltContactMethod = exports.OrderProvider = exports.OrderBillingTerms = exports.OrderDeactivationReason = exports.OrderDiscountType = exports.OrderWithholdCommissionReason = exports.OrderDiscountUnit = exports.OrderTrialUnit = exports.OrderContractType = exports.OrderCurrencyCode = exports.DefaultOrderStageKeys = exports.DefaultOrderStageNames = exports.OrderEntityTypes = void 0;
16
- exports.ROUTING_KEY_LINK_ORDER_EMAIL_DELETED = exports.ROUTING_KEY_LINK_ORDER_EMAIL_CREATED = exports.ROUTING_KEY_LINK_ORDER_WORK_ORDER_DELETED = exports.ROUTING_KEY_LINK_ORDER_WORK_ORDER_CREATED = exports.ROUTING_KEY_LINK_ORDER_CONTACT_DELETED = exports.ROUTING_KEY_LINK_ORDER_CONTACT_CREATED = exports.ROUTING_KEY_LINK_ORDER_INVOICE_DELETED = exports.ROUTING_KEY_LINK_ORDER_INVOICE_CREATED = exports.ROUTING_KEY_LINK_ORDER_ACTIVITY_LOG_DELETED = exports.ROUTING_KEY_LINK_ORDER_ACTIVITY_LOG_CREATED = exports.ROUTING_KEY_LINK_ORDER_ACTIVITY_DELETED = exports.ROUTING_KEY_LINK_ORDER_ACTIVITY_CREATED = exports.ROUTING_KEY_LINK_ORDER_ORDER_CHECK_DELETED = exports.ROUTING_KEY_LINK_ORDER_ORDER_CHECK_CREATED = exports.ROUTING_KEY_LINK_ORDER_CUSTOMER_DEVICE_ONT_DELETED = exports.ROUTING_KEY_LINK_ORDER_CUSTOMER_DEVICE_ONT_CREATED = exports.ROUTING_KEY_LINK_ORDER_VISIT_DELETED = exports.ROUTING_KEY_LINK_ORDER_VISIT_CREATED = exports.ROUTING_KEY_LINK_ORDER_COMMISSION_DELETED = exports.ROUTING_KEY_LINK_ORDER_COMMISSION_CREATED = exports.ROUTING_KEY_LINK_ORDER_ORDER_KCI_DELETED = exports.ROUTING_KEY_LINK_ORDER_ORDER_KCI_CREATED = exports.ROUTING_KEY_LINK_ORDER_REFERRAL_DELETED = exports.ROUTING_KEY_LINK_ORDER_REFERRAL_CREATED = exports.ROUTING_KEY_LINK_ORDER_CONTRACT_BUY_OUT_DELETED = exports.ROUTING_KEY_LINK_ORDER_CONTRACT_BUY_OUT_CREATED = exports.ROUTING_KEY_LINK_ORDER_CONTACT_IDENTITY_DELETED = exports.ROUTING_KEY_LINK_ORDER_CONTACT_IDENTITY_CREATED = exports.ROUTING_KEY_LINK_ORDER_APPOINTMENT_DELETED = void 0;
15
+ exports.ROUTING_KEY_LINK_ORDER_CUSTOMER_DEVICE_ROUTER_DELETED = exports.ROUTING_KEY_LINK_ORDER_CUSTOMER_DEVICE_ROUTER_CREATED = exports.ROUTING_KEY_LINK_ORDER_SMS_MESSAGE_DELETED = exports.ROUTING_KEY_LINK_ORDER_SMS_MESSAGE_CREATED = exports.ROUTING_KEY_LINK_ORDER_ORDER_DELETED = exports.ROUTING_KEY_LINK_ORDER_ORDER_CREATED = exports.ROUTING_KEY_LINK_ORDER_FILE_DELETED = exports.ROUTING_KEY_LINK_ORDER_FILE_CREATED = exports.ROUTING_KEY_LINK_ORDER_ORDER_ITEM_DELETED = exports.ROUTING_KEY_LINK_ORDER_ORDER_ITEM_CREATED = exports.ROUTING_KEY_LINK_ORDER_BILLING_ADJUSTMENT_DELETED = exports.ROUTING_KEY_LINK_ORDER_BILLING_ADJUSTMENT_CREATED = exports.ROUTING_KEY_LINK_ORDER_PUSH_NOTIFICATION_DELETED = exports.ROUTING_KEY_LINK_ORDER_PUSH_NOTIFICATION_CREATED = exports.ROUTING_KEY_LINK_ORDER_DISCOUNT_DELETED = exports.ROUTING_KEY_LINK_ORDER_DISCOUNT_CREATED = exports.ROUTING_KEY_LINK_ORDER_ADDRESS_DELETED = exports.ROUTING_KEY_LINK_ORDER_ADDRESS_CREATED = exports.ROUTING_KEY_LINK_ORDER_PHONE_NUMBER_DELETED = exports.ROUTING_KEY_LINK_ORDER_PHONE_NUMBER_CREATED = exports.ROUTING_KEY_LINK_ORDER_NOTE_DELETED = exports.ROUTING_KEY_LINK_ORDER_NOTE_CREATED = exports.ROUTING_KEY_ORDER_DEFAULT_DELETED = exports.ROUTING_KEY_ORDER_DEFAULT_UPDATED = exports.ROUTING_KEY_ORDER_DEFAULT_CREATED = exports.ROUTING_KEY_ORDER_DELETED = exports.ROUTING_KEY_ORDER_UPDATED = exports.ROUTING_KEY_ORDER_CREATED = exports.Order = exports.OrderPropertyKeys = exports.OrderFulfillmentState = exports.OrderBatteryBackupAnswersSource = exports.OrderActivationStatus = exports.OrderSupplierOrderType = exports.OrderOtsNotRequiredReason = exports.OrderBatteryPackRequired = exports.OrderMobileCoverage = exports.OrderAltContactMethod = exports.OrderProvider = exports.OrderBillingTerms = exports.OrderDeactivationReason = exports.OrderDiscountType = exports.OrderWithholdCommissionReason = exports.OrderDiscountUnit = exports.OrderTrialUnit = exports.OrderContractType = exports.OrderCurrencyCode = exports.DefaultOrderStageKeys = exports.DefaultOrderStageNames = exports.OrderEntityTypes = void 0;
16
+ exports.ROUTING_KEY_LINK_ORDER_EMAIL_DELETED = exports.ROUTING_KEY_LINK_ORDER_EMAIL_CREATED = exports.ROUTING_KEY_LINK_ORDER_WORK_ORDER_DELETED = exports.ROUTING_KEY_LINK_ORDER_WORK_ORDER_CREATED = exports.ROUTING_KEY_LINK_ORDER_CONTACT_DELETED = exports.ROUTING_KEY_LINK_ORDER_CONTACT_CREATED = exports.ROUTING_KEY_LINK_ORDER_INVOICE_DELETED = exports.ROUTING_KEY_LINK_ORDER_INVOICE_CREATED = exports.ROUTING_KEY_LINK_ORDER_ACTIVITY_LOG_DELETED = exports.ROUTING_KEY_LINK_ORDER_ACTIVITY_LOG_CREATED = exports.ROUTING_KEY_LINK_ORDER_ACTIVITY_DELETED = exports.ROUTING_KEY_LINK_ORDER_ACTIVITY_CREATED = exports.ROUTING_KEY_LINK_ORDER_ORDER_CHECK_DELETED = exports.ROUTING_KEY_LINK_ORDER_ORDER_CHECK_CREATED = exports.ROUTING_KEY_LINK_ORDER_CUSTOMER_DEVICE_ONT_DELETED = exports.ROUTING_KEY_LINK_ORDER_CUSTOMER_DEVICE_ONT_CREATED = exports.ROUTING_KEY_LINK_ORDER_VISIT_DELETED = exports.ROUTING_KEY_LINK_ORDER_VISIT_CREATED = exports.ROUTING_KEY_LINK_ORDER_COMMISSION_DELETED = exports.ROUTING_KEY_LINK_ORDER_COMMISSION_CREATED = exports.ROUTING_KEY_LINK_ORDER_ORDER_KCI_DELETED = exports.ROUTING_KEY_LINK_ORDER_ORDER_KCI_CREATED = exports.ROUTING_KEY_LINK_ORDER_REFERRAL_DELETED = exports.ROUTING_KEY_LINK_ORDER_REFERRAL_CREATED = exports.ROUTING_KEY_LINK_ORDER_CONTRACT_BUY_OUT_DELETED = exports.ROUTING_KEY_LINK_ORDER_CONTRACT_BUY_OUT_CREATED = exports.ROUTING_KEY_LINK_ORDER_CONTACT_IDENTITY_DELETED = exports.ROUTING_KEY_LINK_ORDER_CONTACT_IDENTITY_CREATED = exports.ROUTING_KEY_LINK_ORDER_APPOINTMENT_DELETED = exports.ROUTING_KEY_LINK_ORDER_APPOINTMENT_CREATED = void 0;
17
17
  const core_1 = require("@d19n/odin-types/dist/core");
18
18
  /**
19
19
  * Available types for Order records
@@ -360,6 +360,20 @@ var OrderBatteryBackupAnswersSource;
360
360
  OrderBatteryBackupAnswersSource["CUSTOMER_APP"] = "CUSTOMER_APP";
361
361
  OrderBatteryBackupAnswersSource["CUSTOMER_PORTAL"] = "CUSTOMER_PORTAL";
362
362
  })(OrderBatteryBackupAnswersSource = exports.OrderBatteryBackupAnswersSource || (exports.OrderBatteryBackupAnswersSource = {}));
363
+ /**
364
+ * Valid values for Order.FulfillmentState
365
+ *
366
+ * Derived from the commitment set: OPEN while any commitment is Pending or Breached, SETTLED when none is. Written only by the commitment lifecycle.
367
+ *
368
+ * @remarks Available options:
369
+ * - `OPEN` - Open
370
+ * - `SETTLED` - Settled
371
+ */
372
+ var OrderFulfillmentState;
373
+ (function (OrderFulfillmentState) {
374
+ OrderFulfillmentState["OPEN"] = "OPEN";
375
+ OrderFulfillmentState["SETTLED"] = "SETTLED";
376
+ })(OrderFulfillmentState = exports.OrderFulfillmentState || (exports.OrderFulfillmentState = {}));
363
377
  /**
364
378
  * Property keys for Order
365
379
  * Use these constants instead of string literals for type safety
@@ -578,6 +592,12 @@ var OrderPropertyKeys;
578
592
  OrderPropertyKeys["DeactivationDate"] = "DeactivationDate";
579
593
  /** Used when restarting an existing service, allows the customer to specify what date is used for the RequestedCompletionDate on the supplier-side START order. Used for when a customer is technically able to start receiving service. */
580
594
  OrderPropertyKeys["RequestedActivationDate"] = "RequestedActivationDate";
595
+ /** Derived from the commitment set: OPEN while any commitment is Pending or Breached, SETTLED when none is. Written only by the commitment lifecycle. */
596
+ OrderPropertyKeys["FulfillmentState"] = "FulfillmentState";
597
+ /** How many commitments are Pending or Breached. Written only by the lifecycle. */
598
+ OrderPropertyKeys["OpenCommitmentCount"] = "OpenCommitmentCount";
599
+ /** The next commitment to fall due. What a "what is about to breach" query sorts on, without walking every commitment. Written only by the lifecycle. */
600
+ OrderPropertyKeys["EarliestDueAt"] = "EarliestDueAt";
581
601
  })(OrderPropertyKeys = exports.OrderPropertyKeys || (exports.OrderPropertyKeys = {}));
582
602
  /**
583
603
  * Order entity from OrderModule
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d19n/youfibre-odin-sdk",
3
- "version": "2.0.343",
3
+ "version": "2.0.344",
4
4
  "description": "",
5
5
  "author": "@d19n",
6
6
  "license": "UNLICENSED",