@d19n/youfibre-odin-sdk 2.0.342 → 2.0.343

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 (88) hide show
  1. package/README.md +25 -2
  2. package/dist/EntityRegistry.d.ts +4 -0
  3. package/dist/EntityRegistry.js +4 -0
  4. package/dist/OdinApiClient.d.ts +8 -0
  5. package/dist/OdinApiClient.js +16 -0
  6. package/dist/OdinDbClient.d.ts +8 -0
  7. package/dist/OdinDbClient.js +16 -0
  8. package/dist/accessors-v2/DocumentAccessor.d.ts +112 -0
  9. package/dist/accessors-v2/DocumentAccessor.js +191 -0
  10. package/dist/accessors-v2/DocumentProcessingAccessor.d.ts +112 -0
  11. package/dist/accessors-v2/DocumentProcessingAccessor.js +191 -0
  12. package/dist/accessors-v2/index.d.ts +2 -0
  13. package/dist/accessors-v2/index.js +7 -3
  14. package/dist/actions-v2/CreateAiRouteRequestDto.d.ts +1 -1
  15. package/dist/actions-v2/CreateChurnRequestDto.d.ts +2 -0
  16. package/dist/actions-v2/CreateChurnRequestDto.js +2 -0
  17. package/dist/actions-v2/CreateDocumentDto.d.ts +235 -0
  18. package/dist/actions-v2/CreateDocumentDto.js +57 -0
  19. package/dist/actions-v2/CreateDocumentProcessingDto.d.ts +192 -0
  20. package/dist/actions-v2/CreateDocumentProcessingDto.js +57 -0
  21. package/dist/actions-v2/CreateLeadSalesAppDto.d.ts +9 -17
  22. package/dist/actions-v2/UpdateDocumentDto.d.ts +236 -0
  23. package/dist/actions-v2/UpdateDocumentDto.js +59 -0
  24. package/dist/actions-v2/UpdateMessageReadByCustomerDto.d.ts +72 -0
  25. package/dist/actions-v2/UpdateMessageReadByCustomerDto.js +56 -0
  26. package/dist/api-sdk-v2/ContractBuyOutApi.d.ts +2 -0
  27. package/dist/api-sdk-v2/ContractBuyOutApi.js +6 -0
  28. package/dist/api-sdk-v2/DocumentApi.d.ts +52 -0
  29. package/dist/api-sdk-v2/DocumentApi.js +167 -0
  30. package/dist/api-sdk-v2/DocumentProcessingApi.d.ts +50 -0
  31. package/dist/api-sdk-v2/DocumentProcessingApi.js +161 -0
  32. package/dist/api-sdk-v2/EquipmentReturnApi.d.ts +45 -0
  33. package/dist/api-sdk-v2/EquipmentReturnApi.js +151 -0
  34. package/dist/api-sdk-v2/EquipmentReturnItemApi.d.ts +45 -0
  35. package/dist/api-sdk-v2/EquipmentReturnItemApi.js +151 -0
  36. package/dist/api-sdk-v2/FileApi.d.ts +4 -0
  37. package/dist/api-sdk-v2/FileApi.js +12 -0
  38. package/dist/db-accessors-v2/DocumentDbAccessor.d.ts +180 -0
  39. package/dist/db-accessors-v2/DocumentDbAccessor.js +265 -0
  40. package/dist/db-accessors-v2/DocumentProcessingDbAccessor.d.ts +180 -0
  41. package/dist/db-accessors-v2/DocumentProcessingDbAccessor.js +265 -0
  42. package/dist/db-accessors-v2/index.d.ts +2 -0
  43. package/dist/db-accessors-v2/index.js +7 -3
  44. package/dist/db-sdk-v2/ContractBuyOutDb.d.ts +2 -0
  45. package/dist/db-sdk-v2/ContractBuyOutDb.js +6 -0
  46. package/dist/db-sdk-v2/DocumentDb.d.ts +124 -0
  47. package/dist/db-sdk-v2/DocumentDb.js +216 -0
  48. package/dist/db-sdk-v2/DocumentProcessingDb.d.ts +122 -0
  49. package/dist/db-sdk-v2/DocumentProcessingDb.js +210 -0
  50. package/dist/db-sdk-v2/EquipmentReturnDb.d.ts +117 -0
  51. package/dist/db-sdk-v2/EquipmentReturnDb.js +200 -0
  52. package/dist/db-sdk-v2/EquipmentReturnItemDb.d.ts +117 -0
  53. package/dist/db-sdk-v2/EquipmentReturnItemDb.js +200 -0
  54. package/dist/db-sdk-v2/FileDb.d.ts +4 -0
  55. package/dist/db-sdk-v2/FileDb.js +12 -0
  56. package/dist/entities-v2/AiRouteRequest.d.ts +23 -11
  57. package/dist/entities-v2/AiRouteRequest.js +15 -3
  58. package/dist/entities-v2/ContractBuyOut.d.ts +7 -0
  59. package/dist/entities-v2/ContractBuyOut.js +5 -1
  60. package/dist/entities-v2/Document.d.ts +1145 -0
  61. package/dist/entities-v2/Document.js +220 -0
  62. package/dist/entities-v2/DocumentProcessing.d.ts +272 -0
  63. package/dist/entities-v2/DocumentProcessing.js +156 -0
  64. package/dist/entities-v2/EquipmentReturn.d.ts +66 -0
  65. package/dist/entities-v2/EquipmentReturn.js +64 -0
  66. package/dist/entities-v2/EquipmentReturnItem.d.ts +66 -0
  67. package/dist/entities-v2/EquipmentReturnItem.js +64 -0
  68. package/dist/entities-v2/File.d.ts +81 -1
  69. package/dist/entities-v2/File.js +9 -1
  70. package/dist/entities-v2/Message.d.ts +27 -1
  71. package/dist/entities-v2/Message.js +2 -0
  72. package/dist/entities-v2/Order.d.ts +8 -8
  73. package/dist/entities-v2/Order.js +2 -2
  74. package/dist/entities-v2/YfStockCount.d.ts +197 -1
  75. package/dist/entities-v2/YfStockCount.js +28 -0
  76. package/dist/records-v2/ContractBuyOutRecord.d.ts +20 -0
  77. package/dist/records-v2/ContractBuyOutRecord.js +33 -0
  78. package/dist/records-v2/DocumentProcessingRecord.d.ts +227 -0
  79. package/dist/records-v2/DocumentProcessingRecord.js +315 -0
  80. package/dist/records-v2/DocumentRecord.d.ts +355 -0
  81. package/dist/records-v2/DocumentRecord.js +468 -0
  82. package/dist/records-v2/FileRecord.d.ts +59 -3
  83. package/dist/records-v2/FileRecord.js +83 -1
  84. package/dist/records-v2/MessageRecord.d.ts +28 -0
  85. package/dist/records-v2/MessageRecord.js +37 -0
  86. package/dist/records-v2/index.d.ts +2 -0
  87. package/dist/records-v2/index.js +10 -4
  88. package/package.json +1 -1
@@ -0,0 +1,216 @@
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.DocumentDb = 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 DocumentApi(authParams).get(id)
20
+ * - New: new odin.document.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 DocumentDb(principal, dbService, { omitPermissionsCheck: true })
26
+ * - Method level: await db.getByPrimaryKey(id, { entities: [] }, { omitPermissionsCheck: true })
27
+ */
28
+ class DocumentDb extends db_provider_1.DbProvider {
29
+ constructor(principal, dbService, defaultOptions) {
30
+ super(principal, dbService, defaultOptions);
31
+ this.moduleName = 'AiModule';
32
+ this.entityName = 'Document';
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 file() {
42
+ if (!this._file) {
43
+ this._file = new db_record_link_manager_1.DbRecordLinkManager(this.principal, this.dbService, 'AiModule:Document', 'SchemaModule:File', 'Document__File');
44
+ }
45
+ return this._file;
46
+ }
47
+ get documentprocessing() {
48
+ if (!this._documentprocessing) {
49
+ this._documentprocessing = new db_record_link_manager_1.DbRecordLinkManager(this.principal, this.dbService, 'AiModule:Document', 'AiModule:DocumentProcessing', 'Document__DocumentProcessing');
50
+ }
51
+ return this._documentprocessing;
52
+ }
53
+ get contractbuyout() {
54
+ if (!this._contractbuyout) {
55
+ this._contractbuyout = new db_record_link_manager_1.DbRecordLinkManager(this.principal, this.dbService, 'AiModule:Document', 'OrderModule:ContractBuyOut', 'ContractBuyOut__Document');
56
+ }
57
+ return this._contractbuyout;
58
+ }
59
+ // ============================================
60
+ // STANDARD METHODS
61
+ // ============================================
62
+ // Methods support separate query options and provider options for clean API
63
+ setRecord(sourceRecord) {
64
+ this.sourceRecord = sourceRecord;
65
+ }
66
+ /**
67
+ * Search records with manual pagination control
68
+ * @param params - Search parameters
69
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
70
+ */
71
+ searchRecords(params, providerOptions) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ return yield this._searchRecords(this.moduleName, this.entityName, params, providerOptions);
74
+ });
75
+ }
76
+ /**
77
+ * Search all records with automatic pagination
78
+ * @param params - Search parameters
79
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
80
+ */
81
+ searchAllRecordsAndPaginate(params, providerOptions) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ return yield this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params, 0, providerOptions);
84
+ });
85
+ }
86
+ /**
87
+ * Get a single record by primary key
88
+ * @param documentId - Record ID
89
+ * @param queryOptions - Query options (WHAT: entities to include)
90
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
91
+ *
92
+ * @example
93
+ * // Simple get
94
+ * const record = await db.getByPrimaryKey(id);
95
+ *
96
+ * // With related entities
97
+ * const record = await db.getByPrimaryKey(id, { entities: ['InvoiceItem', 'Transaction'] });
98
+ *
99
+ * // With permissions bypass
100
+ * const record = await db.getByPrimaryKey(id, {}, { omitPermissionsCheck: true });
101
+ *
102
+ * // Both options
103
+ * const record = await db.getByPrimaryKey(id, { entities: ['Invoice'] }, { omitPermissionsCheck: true });
104
+ */
105
+ getByPrimaryKey(documentId, queryOptions, providerOptions) {
106
+ return __awaiter(this, void 0, void 0, function* () {
107
+ const res = yield this._getByPrimaryKey(this.moduleName, this.entityName, documentId, queryOptions, providerOptions);
108
+ if (res)
109
+ this.setRecord(res);
110
+ return res;
111
+ });
112
+ }
113
+ /**
114
+ * Get multiple records by primary keys
115
+ * @param documentIds - Array of record IDs
116
+ * @param queryOptions - Query options (WHAT: entities to include)
117
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
118
+ */
119
+ getManyByPrimaryKey(documentIds, queryOptions, providerOptions) {
120
+ return __awaiter(this, void 0, void 0, function* () {
121
+ return yield this._getManyByPrimaryKey(this.moduleName, this.entityName, documentIds, queryOptions, providerOptions);
122
+ });
123
+ }
124
+ /**
125
+ * Upsert a single record
126
+ * @param upsertDto - Record to upsert
127
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
128
+ */
129
+ upsert(upsertDto, providerOptions) {
130
+ return __awaiter(this, void 0, void 0, function* () {
131
+ const res = yield this._upsert(this.moduleName, this.entityName, [upsertDto], providerOptions);
132
+ return res[0];
133
+ });
134
+ }
135
+ /**
136
+ * Upsert multiple records
137
+ * @param upsertDtos - Records to upsert
138
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
139
+ */
140
+ upsertMany(upsertDtos, providerOptions) {
141
+ return __awaiter(this, void 0, void 0, function* () {
142
+ return yield this._upsert(this.moduleName, this.entityName, upsertDtos, providerOptions);
143
+ });
144
+ }
145
+ /**
146
+ * Update a single record
147
+ * @param updateDto - Record to update
148
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
149
+ */
150
+ update(updateDto, providerOptions) {
151
+ return __awaiter(this, void 0, void 0, function* () {
152
+ const res = yield this._update(this.moduleName, this.entityName, [updateDto], providerOptions);
153
+ return res[0];
154
+ });
155
+ }
156
+ /**
157
+ * Update multiple records
158
+ * @param updateDtos - Records to update
159
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
160
+ */
161
+ updateMany(updateDtos, providerOptions) {
162
+ return __awaiter(this, void 0, void 0, function* () {
163
+ return yield this._update(this.moduleName, this.entityName, updateDtos, providerOptions);
164
+ });
165
+ }
166
+ /**
167
+ * Delete one or many records
168
+ * @param documentIds - Record IDs to delete
169
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
170
+ */
171
+ delete(documentIds, providerOptions) {
172
+ return __awaiter(this, void 0, void 0, function* () {
173
+ return yield this._delete(this.moduleName, this.entityName, documentIds, providerOptions);
174
+ });
175
+ }
176
+ /**
177
+ * Restore one or many deleted records
178
+ * @param documentIds - Record IDs to restore
179
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
180
+ */
181
+ restore(documentIds, providerOptions) {
182
+ return __awaiter(this, void 0, void 0, function* () {
183
+ return yield this._restore(this.moduleName, this.entityName, documentIds, providerOptions);
184
+ });
185
+ }
186
+ /**
187
+ * Apply an action to a record
188
+ * @param actionName - The action key
189
+ * @param dto - The action DTO
190
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
191
+ */
192
+ applyAction(actionName, dto, providerOptions) {
193
+ return __awaiter(this, void 0, void 0, function* () {
194
+ return yield this._applyAction(this.moduleName, this.entityName, dto, providerOptions);
195
+ });
196
+ }
197
+ /**
198
+ * Get version history for the current source record
199
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
200
+ */
201
+ getVersions(providerOptions) {
202
+ return __awaiter(this, void 0, void 0, function* () {
203
+ return yield this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id, providerOptions);
204
+ });
205
+ }
206
+ /**
207
+ * Get revision timeline for the current source record
208
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
209
+ */
210
+ getRevisionTimeline(providerOptions) {
211
+ return __awaiter(this, void 0, void 0, function* () {
212
+ return yield this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id, providerOptions);
213
+ });
214
+ }
215
+ }
216
+ exports.DocumentDb = DocumentDb;
@@ -0,0 +1,122 @@
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 { DocumentProcessingProperties } from '../entities-v2/DocumentProcessing';
5
+ /**
6
+ * @deprecated Use OdinDbClient.
7
+ *
8
+ * Migration:
9
+ * - Old: new DocumentProcessingApi(authParams).get(id)
10
+ * - New: new odin.documentprocessing.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 DocumentProcessingDb(principal, dbService, { omitPermissionsCheck: true })
16
+ * - Method level: await db.getByPrimaryKey(id, { entities: [] }, { omitPermissionsCheck: true })
17
+ */
18
+ export declare class DocumentProcessingDb 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 _document?;
25
+ private _file?;
26
+ constructor(principal: any, dbService: any, defaultOptions?: DbProviderOptions);
27
+ get document(): DbRecordLinkManager;
28
+ get file(): DbRecordLinkManager;
29
+ setRecord(sourceRecord: any): void;
30
+ /**
31
+ * Search records with manual pagination control
32
+ * @param params - Search parameters
33
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
34
+ */
35
+ 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<DocumentProcessingProperties>>>;
36
+ /**
37
+ * Search all records with automatic pagination
38
+ * @param params - Search parameters
39
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
40
+ */
41
+ 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<DocumentProcessingProperties>>>;
42
+ /**
43
+ * Get a single record by primary key
44
+ * @param documentProcessingId - Record ID
45
+ * @param queryOptions - Query options (WHAT: entities to include)
46
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
47
+ *
48
+ * @example
49
+ * // Simple get
50
+ * const record = await db.getByPrimaryKey(id);
51
+ *
52
+ * // With related entities
53
+ * const record = await db.getByPrimaryKey(id, { entities: ['InvoiceItem', 'Transaction'] });
54
+ *
55
+ * // With permissions bypass
56
+ * const record = await db.getByPrimaryKey(id, {}, { omitPermissionsCheck: true });
57
+ *
58
+ * // Both options
59
+ * const record = await db.getByPrimaryKey(id, { entities: ['Invoice'] }, { omitPermissionsCheck: true });
60
+ */
61
+ getByPrimaryKey(documentProcessingId: string, queryOptions?: DbGetQueryOptions, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").OdinRecord<DocumentProcessingProperties>>;
62
+ /**
63
+ * Get multiple records by primary keys
64
+ * @param documentProcessingIds - Array of record IDs
65
+ * @param queryOptions - Query options (WHAT: entities to include)
66
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
67
+ */
68
+ getManyByPrimaryKey(documentProcessingIds: string[], queryOptions?: DbGetQueryOptions, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").OdinRecord<DocumentProcessingProperties>[]>;
69
+ /**
70
+ * Upsert a single record
71
+ * @param upsertDto - Record to upsert
72
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
73
+ */
74
+ upsert(upsertDto: OdinRecordCreateDto, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes>;
75
+ /**
76
+ * Upsert multiple records
77
+ * @param upsertDtos - Records to upsert
78
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
79
+ */
80
+ upsertMany(upsertDtos: OdinRecordCreateDto[], providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes[]>;
81
+ /**
82
+ * Update a single record
83
+ * @param updateDto - Record to update
84
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
85
+ */
86
+ update(updateDto: OdinRecordUpdateDto, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes>;
87
+ /**
88
+ * Update multiple records
89
+ * @param updateDtos - Records to update
90
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
91
+ */
92
+ updateMany(updateDtos: OdinRecordUpdateDto[], providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes[]>;
93
+ /**
94
+ * Delete one or many records
95
+ * @param documentProcessingIds - Record IDs to delete
96
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
97
+ */
98
+ delete(documentProcessingIds: string[], providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-sdk-generator").DbRecordDeleted[]>;
99
+ /**
100
+ * Restore one or many deleted records
101
+ * @param documentProcessingIds - Record IDs to restore
102
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
103
+ */
104
+ restore(documentProcessingIds: string[], providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-sdk-generator").DbRecordRestored[]>;
105
+ /**
106
+ * Apply an action to a record
107
+ * @param actionName - The action key
108
+ * @param dto - The action DTO
109
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
110
+ */
111
+ applyAction(actionName: string, dto: any, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes[]>;
112
+ /**
113
+ * Get version history for the current source record
114
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
115
+ */
116
+ getVersions(providerOptions?: DbProviderOptions): Promise<any>;
117
+ /**
118
+ * Get revision timeline for the current source record
119
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
120
+ */
121
+ getRevisionTimeline(providerOptions?: DbProviderOptions): Promise<any>;
122
+ }
@@ -0,0 +1,210 @@
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.DocumentProcessingDb = 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 DocumentProcessingApi(authParams).get(id)
20
+ * - New: new odin.documentprocessing.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 DocumentProcessingDb(principal, dbService, { omitPermissionsCheck: true })
26
+ * - Method level: await db.getByPrimaryKey(id, { entities: [] }, { omitPermissionsCheck: true })
27
+ */
28
+ class DocumentProcessingDb extends db_provider_1.DbProvider {
29
+ constructor(principal, dbService, defaultOptions) {
30
+ super(principal, dbService, defaultOptions);
31
+ this.moduleName = 'AiModule';
32
+ this.entityName = 'DocumentProcessing';
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 document() {
42
+ if (!this._document) {
43
+ this._document = new db_record_link_manager_1.DbRecordLinkManager(this.principal, this.dbService, 'AiModule:DocumentProcessing', 'AiModule:Document', 'Document__DocumentProcessing');
44
+ }
45
+ return this._document;
46
+ }
47
+ get file() {
48
+ if (!this._file) {
49
+ this._file = new db_record_link_manager_1.DbRecordLinkManager(this.principal, this.dbService, 'AiModule:DocumentProcessing', 'SchemaModule:File', 'DocumentProcessing__File');
50
+ }
51
+ return this._file;
52
+ }
53
+ // ============================================
54
+ // STANDARD METHODS
55
+ // ============================================
56
+ // Methods support separate query options and provider options for clean API
57
+ setRecord(sourceRecord) {
58
+ this.sourceRecord = sourceRecord;
59
+ }
60
+ /**
61
+ * Search records with manual pagination control
62
+ * @param params - Search parameters
63
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
64
+ */
65
+ searchRecords(params, providerOptions) {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ return yield this._searchRecords(this.moduleName, this.entityName, params, providerOptions);
68
+ });
69
+ }
70
+ /**
71
+ * Search all records with automatic pagination
72
+ * @param params - Search parameters
73
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
74
+ */
75
+ searchAllRecordsAndPaginate(params, providerOptions) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ return yield this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params, 0, providerOptions);
78
+ });
79
+ }
80
+ /**
81
+ * Get a single record by primary key
82
+ * @param documentProcessingId - Record ID
83
+ * @param queryOptions - Query options (WHAT: entities to include)
84
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
85
+ *
86
+ * @example
87
+ * // Simple get
88
+ * const record = await db.getByPrimaryKey(id);
89
+ *
90
+ * // With related entities
91
+ * const record = await db.getByPrimaryKey(id, { entities: ['InvoiceItem', 'Transaction'] });
92
+ *
93
+ * // With permissions bypass
94
+ * const record = await db.getByPrimaryKey(id, {}, { omitPermissionsCheck: true });
95
+ *
96
+ * // Both options
97
+ * const record = await db.getByPrimaryKey(id, { entities: ['Invoice'] }, { omitPermissionsCheck: true });
98
+ */
99
+ getByPrimaryKey(documentProcessingId, queryOptions, providerOptions) {
100
+ return __awaiter(this, void 0, void 0, function* () {
101
+ const res = yield this._getByPrimaryKey(this.moduleName, this.entityName, documentProcessingId, queryOptions, providerOptions);
102
+ if (res)
103
+ this.setRecord(res);
104
+ return res;
105
+ });
106
+ }
107
+ /**
108
+ * Get multiple records by primary keys
109
+ * @param documentProcessingIds - Array of record IDs
110
+ * @param queryOptions - Query options (WHAT: entities to include)
111
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
112
+ */
113
+ getManyByPrimaryKey(documentProcessingIds, queryOptions, providerOptions) {
114
+ return __awaiter(this, void 0, void 0, function* () {
115
+ return yield this._getManyByPrimaryKey(this.moduleName, this.entityName, documentProcessingIds, queryOptions, providerOptions);
116
+ });
117
+ }
118
+ /**
119
+ * Upsert a single record
120
+ * @param upsertDto - Record to upsert
121
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
122
+ */
123
+ upsert(upsertDto, providerOptions) {
124
+ return __awaiter(this, void 0, void 0, function* () {
125
+ const res = yield this._upsert(this.moduleName, this.entityName, [upsertDto], providerOptions);
126
+ return res[0];
127
+ });
128
+ }
129
+ /**
130
+ * Upsert multiple records
131
+ * @param upsertDtos - Records to upsert
132
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
133
+ */
134
+ upsertMany(upsertDtos, providerOptions) {
135
+ return __awaiter(this, void 0, void 0, function* () {
136
+ return yield this._upsert(this.moduleName, this.entityName, upsertDtos, providerOptions);
137
+ });
138
+ }
139
+ /**
140
+ * Update a single record
141
+ * @param updateDto - Record to update
142
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
143
+ */
144
+ update(updateDto, providerOptions) {
145
+ return __awaiter(this, void 0, void 0, function* () {
146
+ const res = yield this._update(this.moduleName, this.entityName, [updateDto], providerOptions);
147
+ return res[0];
148
+ });
149
+ }
150
+ /**
151
+ * Update multiple records
152
+ * @param updateDtos - Records to update
153
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
154
+ */
155
+ updateMany(updateDtos, providerOptions) {
156
+ return __awaiter(this, void 0, void 0, function* () {
157
+ return yield this._update(this.moduleName, this.entityName, updateDtos, providerOptions);
158
+ });
159
+ }
160
+ /**
161
+ * Delete one or many records
162
+ * @param documentProcessingIds - Record IDs to delete
163
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
164
+ */
165
+ delete(documentProcessingIds, providerOptions) {
166
+ return __awaiter(this, void 0, void 0, function* () {
167
+ return yield this._delete(this.moduleName, this.entityName, documentProcessingIds, providerOptions);
168
+ });
169
+ }
170
+ /**
171
+ * Restore one or many deleted records
172
+ * @param documentProcessingIds - Record IDs to restore
173
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
174
+ */
175
+ restore(documentProcessingIds, providerOptions) {
176
+ return __awaiter(this, void 0, void 0, function* () {
177
+ return yield this._restore(this.moduleName, this.entityName, documentProcessingIds, providerOptions);
178
+ });
179
+ }
180
+ /**
181
+ * Apply an action to a record
182
+ * @param actionName - The action key
183
+ * @param dto - The action DTO
184
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
185
+ */
186
+ applyAction(actionName, dto, providerOptions) {
187
+ return __awaiter(this, void 0, void 0, function* () {
188
+ return yield this._applyAction(this.moduleName, this.entityName, dto, providerOptions);
189
+ });
190
+ }
191
+ /**
192
+ * Get version history for the current source record
193
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
194
+ */
195
+ getVersions(providerOptions) {
196
+ return __awaiter(this, void 0, void 0, function* () {
197
+ return yield this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id, providerOptions);
198
+ });
199
+ }
200
+ /**
201
+ * Get revision timeline for the current source record
202
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
203
+ */
204
+ getRevisionTimeline(providerOptions) {
205
+ return __awaiter(this, void 0, void 0, function* () {
206
+ return yield this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id, providerOptions);
207
+ });
208
+ }
209
+ }
210
+ exports.DocumentProcessingDb = DocumentProcessingDb;
@@ -0,0 +1,117 @@
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 { EquipmentReturnProperties } from '../entities-v2/EquipmentReturn';
4
+ /**
5
+ * @deprecated Use OdinDbClient.
6
+ *
7
+ * Migration:
8
+ * - Old: new EquipmentReturnApi(authParams).get(id)
9
+ * - New: new odin.equipmentreturn.get(id)
10
+ *
11
+ * The new OdinDbClient returns typed record wrappers with action methods.
12
+ *
13
+ * Supports separate query options and provider options:
14
+ * - Constructor level: new EquipmentReturnDb(principal, dbService, { omitPermissionsCheck: true })
15
+ * - Method level: await db.getByPrimaryKey(id, { entities: [] }, { omitPermissionsCheck: true })
16
+ */
17
+ export declare class EquipmentReturnDb extends DbProvider {
18
+ protected readonly principal: any;
19
+ protected readonly dbService: any;
20
+ private readonly moduleName;
21
+ private readonly entityName;
22
+ private sourceRecord;
23
+ constructor(principal: any, dbService: any, defaultOptions?: DbProviderOptions);
24
+ setRecord(sourceRecord: any): void;
25
+ /**
26
+ * Search records with manual pagination control
27
+ * @param params - Search parameters
28
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
29
+ */
30
+ 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<EquipmentReturnProperties>>>;
31
+ /**
32
+ * Search all records with automatic pagination
33
+ * @param params - Search parameters
34
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
35
+ */
36
+ 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<EquipmentReturnProperties>>>;
37
+ /**
38
+ * Get a single record by primary key
39
+ * @param equipmentReturnId - Record ID
40
+ * @param queryOptions - Query options (WHAT: entities to include)
41
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
42
+ *
43
+ * @example
44
+ * // Simple get
45
+ * const record = await db.getByPrimaryKey(id);
46
+ *
47
+ * // With related entities
48
+ * const record = await db.getByPrimaryKey(id, { entities: ['InvoiceItem', 'Transaction'] });
49
+ *
50
+ * // With permissions bypass
51
+ * const record = await db.getByPrimaryKey(id, {}, { omitPermissionsCheck: true });
52
+ *
53
+ * // Both options
54
+ * const record = await db.getByPrimaryKey(id, { entities: ['Invoice'] }, { omitPermissionsCheck: true });
55
+ */
56
+ getByPrimaryKey(equipmentReturnId: string, queryOptions?: DbGetQueryOptions, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").OdinRecord<EquipmentReturnProperties>>;
57
+ /**
58
+ * Get multiple records by primary keys
59
+ * @param equipmentReturnIds - Array of record IDs
60
+ * @param queryOptions - Query options (WHAT: entities to include)
61
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
62
+ */
63
+ getManyByPrimaryKey(equipmentReturnIds: string[], queryOptions?: DbGetQueryOptions, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").OdinRecord<EquipmentReturnProperties>[]>;
64
+ /**
65
+ * Upsert a single record
66
+ * @param upsertDto - Record to upsert
67
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
68
+ */
69
+ upsert(upsertDto: OdinRecordCreateDto, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes>;
70
+ /**
71
+ * Upsert multiple records
72
+ * @param upsertDtos - Records to upsert
73
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
74
+ */
75
+ upsertMany(upsertDtos: OdinRecordCreateDto[], providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes[]>;
76
+ /**
77
+ * Update a single record
78
+ * @param updateDto - Record to update
79
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
80
+ */
81
+ update(updateDto: OdinRecordUpdateDto, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes>;
82
+ /**
83
+ * Update multiple records
84
+ * @param updateDtos - Records to update
85
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
86
+ */
87
+ updateMany(updateDtos: OdinRecordUpdateDto[], providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes[]>;
88
+ /**
89
+ * Delete one or many records
90
+ * @param equipmentReturnIds - Record IDs to delete
91
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
92
+ */
93
+ delete(equipmentReturnIds: string[], providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-sdk-generator").DbRecordDeleted[]>;
94
+ /**
95
+ * Restore one or many deleted records
96
+ * @param equipmentReturnIds - Record IDs to restore
97
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
98
+ */
99
+ restore(equipmentReturnIds: string[], providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-sdk-generator").DbRecordRestored[]>;
100
+ /**
101
+ * Apply an action to a record
102
+ * @param actionName - The action key
103
+ * @param dto - The action DTO
104
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
105
+ */
106
+ applyAction(actionName: string, dto: any, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes[]>;
107
+ /**
108
+ * Get version history for the current source record
109
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
110
+ */
111
+ getVersions(providerOptions?: DbProviderOptions): Promise<any>;
112
+ /**
113
+ * Get revision timeline for the current source record
114
+ * @param providerOptions - Provider options (HOW: omitPermissionsCheck)
115
+ */
116
+ getRevisionTimeline(providerOptions?: DbProviderOptions): Promise<any>;
117
+ }