@d19n/youfibre-odin-sdk 2.0.284 → 2.0.286

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 (40) hide show
  1. package/README.md +35 -23
  2. package/dist/EntityRegistry.d.ts +2 -0
  3. package/dist/EntityRegistry.js +2 -0
  4. package/dist/OdinApiClient.d.ts +4 -0
  5. package/dist/OdinApiClient.js +8 -0
  6. package/dist/OdinDbClient.d.ts +4 -0
  7. package/dist/OdinDbClient.js +8 -0
  8. package/dist/accessors-v2/RecontractAccessor.d.ts +111 -0
  9. package/dist/accessors-v2/RecontractAccessor.js +190 -0
  10. package/dist/accessors-v2/index.d.ts +1 -0
  11. package/dist/accessors-v2/index.js +4 -2
  12. package/dist/actions-v2/AddCaseAdditionalNotesDto.d.ts +73 -0
  13. package/dist/actions-v2/AddCaseAdditionalNotesDto.js +56 -0
  14. package/dist/actions-v2/CreateCustomerDeviceRouterFromDispatchDto.d.ts +74 -0
  15. package/dist/actions-v2/CreateCustomerDeviceRouterFromDispatchDto.js +54 -0
  16. package/dist/actions-v2/CreateRecontractDto.d.ts +63 -0
  17. package/dist/actions-v2/CreateRecontractDto.js +59 -0
  18. package/dist/actions-v2/FlagVulnerableCustomerDto.d.ts +73 -0
  19. package/dist/actions-v2/FlagVulnerableCustomerDto.js +56 -0
  20. package/dist/actions-v2/RecordAiTagsAccuracyDto.d.ts +73 -0
  21. package/dist/actions-v2/RecordAiTagsAccuracyDto.js +56 -0
  22. package/dist/actions-v2/UpdateCaseProvidersDto.d.ts +73 -0
  23. package/dist/actions-v2/UpdateCaseProvidersDto.js +56 -0
  24. package/dist/actions-v2/UpdateCaseSlaDto.d.ts +86 -0
  25. package/dist/actions-v2/UpdateCaseSlaDto.js +56 -0
  26. package/dist/db-accessors-v2/RecontractDbAccessor.d.ts +149 -0
  27. package/dist/db-accessors-v2/RecontractDbAccessor.js +227 -0
  28. package/dist/db-accessors-v2/index.d.ts +1 -0
  29. package/dist/db-accessors-v2/index.js +4 -2
  30. package/dist/records-v2/CaseRecord.d.ts +136 -0
  31. package/dist/records-v2/CaseRecord.js +153 -0
  32. package/dist/records-v2/CustomerDeviceRouterRecord.d.ts +29 -0
  33. package/dist/records-v2/CustomerDeviceRouterRecord.js +36 -0
  34. package/dist/records-v2/OrderRecord.d.ts +20 -0
  35. package/dist/records-v2/OrderRecord.js +33 -0
  36. package/dist/records-v2/RecontractRecord.d.ts +205 -0
  37. package/dist/records-v2/RecontractRecord.js +280 -0
  38. package/dist/records-v2/index.d.ts +3 -2
  39. package/dist/records-v2/index.js +14 -11
  40. package/package.json +1 -1
@@ -0,0 +1,73 @@
1
+ /**
2
+ * UpdateCaseProviders Action DTO
3
+ *
4
+ * Copies the network provider from the linked address onto the case. Case.Providers is an ENUM while Address.Providers is free text, so the caller filters values the column rejects before firing this.
5
+ *
6
+ * @module SupportModule
7
+ * @entity Case
8
+ * @actionKey UpdateCaseProviders
9
+ * @event k1.t-hEOJjsDb.SupportModule.Case.Update.UpdateCaseProviders
10
+ *
11
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
12
+ */
13
+ import { OdinRecord, OdinRecordUpdateDto, OdinRecordUpdatedEvent } from '@d19n/odin-types/dist/core';
14
+ /**
15
+ * RabbitMQ message payload for UpdateCaseProviders updated events
16
+ *
17
+ * @event k1.t-hEOJjsDb.SupportModule.Case.Update.UpdateCaseProviders
18
+ */
19
+ export interface UpdateCaseProvidersMessage extends OdinRecordUpdatedEvent<UpdateCaseProvidersDto, UpdateCaseProvidersProperties> {
20
+ }
21
+ /**
22
+ * Properties for UpdateCaseProviders action
23
+ *
24
+ * @property Required fields: 1
25
+ * @property Optional fields: 0
26
+ */
27
+ export interface UpdateCaseProvidersProperties {
28
+ /**
29
+ * Providers
30
+ *
31
+ * Providers
32
+ * @type {ENUM}
33
+ * @required
34
+ */
35
+ Providers: string;
36
+ }
37
+ /**
38
+ * Set the network providers on the case
39
+ *
40
+ * Copies the network provider from the linked address onto the case. Case.Providers is an ENUM while Address.Providers is free text, so the caller filters values the column rejects before firing this.
41
+ *
42
+ * @actionType UPDATE - Updates an existing Case record
43
+ * @module SupportModule
44
+ * @entity Case
45
+ * @event k1.t-hEOJjsDb.SupportModule.Case.Update.UpdateCaseProviders
46
+ * @permission schema.action.updatecaseproviders.trigger
47
+ * @benchmark This action is tracked for performance benchmarks
48
+ */
49
+ export declare class UpdateCaseProvidersDto extends OdinRecordUpdateDto<UpdateCaseProvidersProperties> {
50
+ /** Used by SDK generators to identify action type */
51
+ static readonly ACTION_TYPE = "UPDATE";
52
+ static readonly ACTION_KEY = "UpdateCaseProviders";
53
+ static readonly MODULE_NAME = "SupportModule";
54
+ static readonly ENTITIES: string[];
55
+ static readonly EVENT_NAME = "k1.t-hEOJjsDb.SupportModule.Case.Update.UpdateCaseProviders";
56
+ static readonly PERMISSION = "schema.action.updatecaseproviders.trigger";
57
+ /** Step metadata - entity this action targets */
58
+ static readonly STEP_ENTITY = "SupportModule:Case";
59
+ static readonly STEP_SCHEMA_ID = "bb540d25-53bf-491b-9d03-f3d42f755b3a";
60
+ static readonly STEP_SCHEMA_ACTION_ID = "108c9f2a-28ed-48bc-a448-837108c49423";
61
+ static readonly AUTO_LINK_PARENT = false;
62
+ readonly actionName: string;
63
+ readonly schemaActionId: string;
64
+ readonly entity: string;
65
+ constructor(record: OdinRecord<any> | {
66
+ id: string;
67
+ entity: string;
68
+ type?: string;
69
+ }, properties: UpdateCaseProvidersProperties, options?: {
70
+ journeyId?: string;
71
+ stageKey?: string;
72
+ });
73
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /**
3
+ * UpdateCaseProviders Action DTO
4
+ *
5
+ * Copies the network provider from the linked address onto the case. Case.Providers is an ENUM while Address.Providers is free text, so the caller filters values the column rejects before firing this.
6
+ *
7
+ * @module SupportModule
8
+ * @entity Case
9
+ * @actionKey UpdateCaseProviders
10
+ * @event k1.t-hEOJjsDb.SupportModule.Case.Update.UpdateCaseProviders
11
+ *
12
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.UpdateCaseProvidersDto = void 0;
16
+ const core_1 = require("@d19n/odin-types/dist/core");
17
+ /**
18
+ * Set the network providers on the case
19
+ *
20
+ * Copies the network provider from the linked address onto the case. Case.Providers is an ENUM while Address.Providers is free text, so the caller filters values the column rejects before firing this.
21
+ *
22
+ * @actionType UPDATE - Updates an existing Case record
23
+ * @module SupportModule
24
+ * @entity Case
25
+ * @event k1.t-hEOJjsDb.SupportModule.Case.Update.UpdateCaseProviders
26
+ * @permission schema.action.updatecaseproviders.trigger
27
+ * @benchmark This action is tracked for performance benchmarks
28
+ */
29
+ class UpdateCaseProvidersDto extends core_1.OdinRecordUpdateDto {
30
+ constructor(record, properties, options) {
31
+ super({
32
+ id: record.id,
33
+ entity: record.entity,
34
+ type: record.type,
35
+ properties,
36
+ journeyId: options === null || options === void 0 ? void 0 : options.journeyId,
37
+ stageKey: options === null || options === void 0 ? void 0 : options.stageKey,
38
+ });
39
+ this.actionName = 'UpdateCaseProviders';
40
+ this.schemaActionId = '108c9f2a-28ed-48bc-a448-837108c49423';
41
+ this.entity = 'SupportModule:Case';
42
+ }
43
+ }
44
+ exports.UpdateCaseProvidersDto = UpdateCaseProvidersDto;
45
+ /** Used by SDK generators to identify action type */
46
+ UpdateCaseProvidersDto.ACTION_TYPE = 'UPDATE';
47
+ UpdateCaseProvidersDto.ACTION_KEY = 'UpdateCaseProviders';
48
+ UpdateCaseProvidersDto.MODULE_NAME = 'SupportModule';
49
+ UpdateCaseProvidersDto.ENTITIES = ['Case'];
50
+ UpdateCaseProvidersDto.EVENT_NAME = 'k1.t-hEOJjsDb.SupportModule.Case.Update.UpdateCaseProviders';
51
+ UpdateCaseProvidersDto.PERMISSION = 'schema.action.updatecaseproviders.trigger';
52
+ /** Step metadata - entity this action targets */
53
+ UpdateCaseProvidersDto.STEP_ENTITY = 'SupportModule:Case';
54
+ UpdateCaseProvidersDto.STEP_SCHEMA_ID = 'bb540d25-53bf-491b-9d03-f3d42f755b3a';
55
+ UpdateCaseProvidersDto.STEP_SCHEMA_ACTION_ID = '108c9f2a-28ed-48bc-a448-837108c49423';
56
+ UpdateCaseProvidersDto.AUTO_LINK_PARENT = false;
@@ -0,0 +1,86 @@
1
+ /**
2
+ * UpdateCaseSla Action DTO
3
+ *
4
+ * Applies the SLA band and its start/end dates, resolved from the org's category mapping when a case is created or re-categorised. All three fields are optional because a case with no mapping and no existing SLA has nothing to set — writing a null Sla is a 422 (CORE-994).
5
+ *
6
+ * @module SupportModule
7
+ * @entity Case
8
+ * @actionKey UpdateCaseSla
9
+ * @event k1.t-hEOJjsDb.SupportModule.Case.Update.UpdateCaseSla
10
+ *
11
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
12
+ */
13
+ import { OdinRecord, OdinRecordUpdateDto, OdinRecordUpdatedEvent } from '@d19n/odin-types/dist/core';
14
+ /**
15
+ * RabbitMQ message payload for UpdateCaseSla updated events
16
+ *
17
+ * @event k1.t-hEOJjsDb.SupportModule.Case.Update.UpdateCaseSla
18
+ */
19
+ export interface UpdateCaseSlaMessage extends OdinRecordUpdatedEvent<UpdateCaseSlaDto, UpdateCaseSlaProperties> {
20
+ }
21
+ /**
22
+ * Properties for UpdateCaseSla action
23
+ *
24
+ * @property Required fields: 0
25
+ * @property Optional fields: 3
26
+ */
27
+ export interface UpdateCaseSlaProperties {
28
+ /**
29
+ * SLA
30
+ *
31
+ * Data field for Case records. Used by Customer Service team.
32
+ * @type {ENUM}
33
+ */
34
+ Sla?: string | null;
35
+ /**
36
+ * SLA start date
37
+ *
38
+ * The date used to generate the SLA date (defaults to case created and then is updated when the case goes to Pending Agent" (Customer Service - Case)
39
+ * @type {DATE_TIME}
40
+ */
41
+ SlaStartDate?: string | null;
42
+ /**
43
+ * SLA end date
44
+ *
45
+ * The sla end date (Customer Service - Case)
46
+ * @type {DATE_TIME}
47
+ */
48
+ SlaEndDate?: string | null;
49
+ }
50
+ /**
51
+ * Set the case SLA and its window
52
+ *
53
+ * Applies the SLA band and its start/end dates, resolved from the org's category mapping when a case is created or re-categorised. All three fields are optional because a case with no mapping and no existing SLA has nothing to set — writing a null Sla is a 422 (CORE-994).
54
+ *
55
+ * @actionType UPDATE - Updates an existing Case record
56
+ * @module SupportModule
57
+ * @entity Case
58
+ * @event k1.t-hEOJjsDb.SupportModule.Case.Update.UpdateCaseSla
59
+ * @permission schema.action.updatecasesla.trigger
60
+ * @benchmark This action is tracked for performance benchmarks
61
+ */
62
+ export declare class UpdateCaseSlaDto extends OdinRecordUpdateDto<UpdateCaseSlaProperties> {
63
+ /** Used by SDK generators to identify action type */
64
+ static readonly ACTION_TYPE = "UPDATE";
65
+ static readonly ACTION_KEY = "UpdateCaseSla";
66
+ static readonly MODULE_NAME = "SupportModule";
67
+ static readonly ENTITIES: string[];
68
+ static readonly EVENT_NAME = "k1.t-hEOJjsDb.SupportModule.Case.Update.UpdateCaseSla";
69
+ static readonly PERMISSION = "schema.action.updatecasesla.trigger";
70
+ /** Step metadata - entity this action targets */
71
+ static readonly STEP_ENTITY = "SupportModule:Case";
72
+ static readonly STEP_SCHEMA_ID = "bb540d25-53bf-491b-9d03-f3d42f755b3a";
73
+ static readonly STEP_SCHEMA_ACTION_ID = "9cce1c02-dd78-40b6-a919-5b6422ebf3c9";
74
+ static readonly AUTO_LINK_PARENT = false;
75
+ readonly actionName: string;
76
+ readonly schemaActionId: string;
77
+ readonly entity: string;
78
+ constructor(record: OdinRecord<any> | {
79
+ id: string;
80
+ entity: string;
81
+ type?: string;
82
+ }, properties: UpdateCaseSlaProperties, options?: {
83
+ journeyId?: string;
84
+ stageKey?: string;
85
+ });
86
+ }
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /**
3
+ * UpdateCaseSla Action DTO
4
+ *
5
+ * Applies the SLA band and its start/end dates, resolved from the org's category mapping when a case is created or re-categorised. All three fields are optional because a case with no mapping and no existing SLA has nothing to set — writing a null Sla is a 422 (CORE-994).
6
+ *
7
+ * @module SupportModule
8
+ * @entity Case
9
+ * @actionKey UpdateCaseSla
10
+ * @event k1.t-hEOJjsDb.SupportModule.Case.Update.UpdateCaseSla
11
+ *
12
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.UpdateCaseSlaDto = void 0;
16
+ const core_1 = require("@d19n/odin-types/dist/core");
17
+ /**
18
+ * Set the case SLA and its window
19
+ *
20
+ * Applies the SLA band and its start/end dates, resolved from the org's category mapping when a case is created or re-categorised. All three fields are optional because a case with no mapping and no existing SLA has nothing to set — writing a null Sla is a 422 (CORE-994).
21
+ *
22
+ * @actionType UPDATE - Updates an existing Case record
23
+ * @module SupportModule
24
+ * @entity Case
25
+ * @event k1.t-hEOJjsDb.SupportModule.Case.Update.UpdateCaseSla
26
+ * @permission schema.action.updatecasesla.trigger
27
+ * @benchmark This action is tracked for performance benchmarks
28
+ */
29
+ class UpdateCaseSlaDto extends core_1.OdinRecordUpdateDto {
30
+ constructor(record, properties, options) {
31
+ super({
32
+ id: record.id,
33
+ entity: record.entity,
34
+ type: record.type,
35
+ properties,
36
+ journeyId: options === null || options === void 0 ? void 0 : options.journeyId,
37
+ stageKey: options === null || options === void 0 ? void 0 : options.stageKey,
38
+ });
39
+ this.actionName = 'UpdateCaseSla';
40
+ this.schemaActionId = '9cce1c02-dd78-40b6-a919-5b6422ebf3c9';
41
+ this.entity = 'SupportModule:Case';
42
+ }
43
+ }
44
+ exports.UpdateCaseSlaDto = UpdateCaseSlaDto;
45
+ /** Used by SDK generators to identify action type */
46
+ UpdateCaseSlaDto.ACTION_TYPE = 'UPDATE';
47
+ UpdateCaseSlaDto.ACTION_KEY = 'UpdateCaseSla';
48
+ UpdateCaseSlaDto.MODULE_NAME = 'SupportModule';
49
+ UpdateCaseSlaDto.ENTITIES = ['Case'];
50
+ UpdateCaseSlaDto.EVENT_NAME = 'k1.t-hEOJjsDb.SupportModule.Case.Update.UpdateCaseSla';
51
+ UpdateCaseSlaDto.PERMISSION = 'schema.action.updatecasesla.trigger';
52
+ /** Step metadata - entity this action targets */
53
+ UpdateCaseSlaDto.STEP_ENTITY = 'SupportModule:Case';
54
+ UpdateCaseSlaDto.STEP_SCHEMA_ID = 'bb540d25-53bf-491b-9d03-f3d42f755b3a';
55
+ UpdateCaseSlaDto.STEP_SCHEMA_ACTION_ID = '9cce1c02-dd78-40b6-a919-5b6422ebf3c9';
56
+ UpdateCaseSlaDto.AUTO_LINK_PARENT = false;
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Recontract DB Accessor
3
+ *
4
+ * Provides typed access to Recontract records via direct database access.
5
+ * For use in backend services with principal + dbService.
6
+ * Returns wrapped records with typed action methods.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // Simple get
11
+ * const record = await accessor.get(id);
12
+ *
13
+ * // With related entities
14
+ * const record = await accessor.get(id, { entities: ["Contact", "Address"] });
15
+ *
16
+ * // With permissions bypass (separate options)
17
+ * const record = await accessor.get(id, {}, { omitPermissionsCheck: true });
18
+ *
19
+ * // Silent write (no RabbitMQ events)
20
+ * const result = await accessor.upsert([dto], { omitWriteEvents: true });
21
+ *
22
+ * // Constructor-level default (applies to all calls)
23
+ * const accessor = new RecontractDbAccessor(principal, dbService, { omitPermissionsCheck: true });
24
+ * ```
25
+ *
26
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
27
+ */
28
+ import { OdinSearchV2 } from '@d19n/odin-types/dist/core';
29
+ import { DbProvider, DbProviderOptions, DbGetQueryOptions } from '@d19n/odin-sdk-generator/dist/db.provider';
30
+ import { QueryBuilder } from '@d19n/odin-sdk-generator/dist/query-builder';
31
+ import { RecontractProperties } from '../entities-v2/Recontract';
32
+ import { RecontractRecord } from '../records-v2/RecontractRecord';
33
+ /** Search response with wrapped records */
34
+ export interface RecontractDbSearchResponse {
35
+ records: RecontractRecord[];
36
+ totalRecords: number;
37
+ hasMore: boolean;
38
+ }
39
+ export declare class RecontractDbAccessor {
40
+ private readonly _provider;
41
+ private readonly _moduleName;
42
+ private readonly _entityName;
43
+ private readonly _defaultOptions?;
44
+ /**
45
+ * Create a new RecontractDbAccessor
46
+ * @param principal - The authenticated principal
47
+ * @param dbService - The database service instance
48
+ * @param defaultOptions - Default provider options applied to all operations
49
+ */
50
+ constructor(principal: any, dbService: any, defaultOptions?: DbProviderOptions);
51
+ get moduleName(): string;
52
+ get entityName(): string;
53
+ /**
54
+ * Create a new empty Recontract record instance for create operations.
55
+ * Pre-generates an ID that can be referenced before the record is saved.
56
+ *
57
+ * @param id - Optional ID to use (auto-generated UUID if not provided)
58
+ * @returns A new record wrapper with pre-generated ID
59
+ *
60
+ * @example
61
+ * ```typescript
62
+ * // Auto-generated ID
63
+ * const note = odinDb.notes.new();
64
+ * console.log(note.id); // UUID available immediately
65
+ *
66
+ * // Custom ID
67
+ * const order = odinDb.orders.new("custom-id-123");
68
+ *
69
+ * // Reference ID before save
70
+ * const account = odinDb.accounts.new();
71
+ * const contact = odinDb.contacts.new();
72
+ * await contact
73
+ * .link({ id: account.id, entity: "CrmModule:Account" })
74
+ * .createContact({ FirstName: "John" });
75
+ * ```
76
+ */
77
+ new(id?: string): RecontractRecord;
78
+ /**
79
+ * Get a single Recontract record by ID
80
+ *
81
+ * @param id - The record ID
82
+ * @param queryOptions - Query options (WHAT to fetch: entities to include)
83
+ * @param providerOptions - Provider options (HOW to fetch: omitPermissionsCheck)
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * // Simple get
88
+ * const record = await accessor.get(id);
89
+ *
90
+ * // With related entities
91
+ * const record = await accessor.get(id, { entities: ["Contact", "Address"] });
92
+ *
93
+ * // With permissions bypass
94
+ * const record = await accessor.get(id, {}, { omitPermissionsCheck: true });
95
+ *
96
+ * // Both options
97
+ * const record = await accessor.get(id, { entities: ["Invoice"] }, { omitPermissionsCheck: true });
98
+ * ```
99
+ */
100
+ get(id: string, queryOptions?: DbGetQueryOptions, providerOptions?: DbProviderOptions): Promise<RecontractRecord>;
101
+ /**
102
+ * Get multiple Recontract records by IDs
103
+ *
104
+ * @param ids - Array of record IDs
105
+ * @param queryOptions - Query options (WHAT to fetch: entities to include)
106
+ * @param providerOptions - Provider options (HOW to fetch: omitPermissionsCheck)
107
+ */
108
+ getMany(ids: string[], queryOptions?: DbGetQueryOptions, providerOptions?: DbProviderOptions): Promise<RecontractRecord[]>;
109
+ /**
110
+ * Search Recontract records
111
+ *
112
+ * @param params - Search parameters
113
+ * @param providerOptions - Provider options (HOW to fetch: omitPermissionsCheck)
114
+ */
115
+ search(params: Partial<OdinSearchV2>, providerOptions?: DbProviderOptions): Promise<RecontractDbSearchResponse>;
116
+ /**
117
+ * Search all Recontract records with automatic pagination
118
+ *
119
+ * @param params - Search parameters
120
+ * @param providerOptions - Provider options (HOW to fetch: omitPermissionsCheck)
121
+ */
122
+ searchAll(params: Partial<OdinSearchV2>, providerOptions?: DbProviderOptions): Promise<RecontractRecord[]>;
123
+ /**
124
+ * Async generator for paginating through all matching records.
125
+ * Yields batches of wrapped records.
126
+ *
127
+ * @param params - Search parameters
128
+ * @param providerOptions - Provider options (HOW to fetch: omitPermissionsCheck)
129
+ */
130
+ paginate(params: Partial<OdinSearchV2>, providerOptions?: DbProviderOptions): AsyncGenerator<RecontractRecord[]>;
131
+ /**
132
+ * Create a fluent query builder for Recontract records
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * const results = await accessor
137
+ * .query()
138
+ * .where('Status', 'in', ['Active', 'Pending'])
139
+ * .where('CreatedAt', 'gte', '2025-01-01')
140
+ * .select('id', 'title', 'properties.*')
141
+ * .sortBy('createdAt', 'desc')
142
+ * .limit(100)
143
+ * .execute();
144
+ * ```
145
+ */
146
+ query(): QueryBuilder<RecontractProperties, RecontractRecord>;
147
+ /** Access the underlying DbProvider */
148
+ get provider(): DbProvider;
149
+ }
@@ -0,0 +1,227 @@
1
+ "use strict";
2
+ /**
3
+ * Recontract DB Accessor
4
+ *
5
+ * Provides typed access to Recontract records via direct database access.
6
+ * For use in backend services with principal + dbService.
7
+ * Returns wrapped records with typed action methods.
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * // Simple get
12
+ * const record = await accessor.get(id);
13
+ *
14
+ * // With related entities
15
+ * const record = await accessor.get(id, { entities: ["Contact", "Address"] });
16
+ *
17
+ * // With permissions bypass (separate options)
18
+ * const record = await accessor.get(id, {}, { omitPermissionsCheck: true });
19
+ *
20
+ * // Silent write (no RabbitMQ events)
21
+ * const result = await accessor.upsert([dto], { omitWriteEvents: true });
22
+ *
23
+ * // Constructor-level default (applies to all calls)
24
+ * const accessor = new RecontractDbAccessor(principal, dbService, { omitPermissionsCheck: true });
25
+ * ```
26
+ *
27
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
28
+ */
29
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
30
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
31
+ return new (P || (P = Promise))(function (resolve, reject) {
32
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
33
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
34
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
35
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
36
+ });
37
+ };
38
+ var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
39
+ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
40
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
41
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
42
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
43
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
44
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
45
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
46
+ function fulfill(value) { resume("next", value); }
47
+ function reject(value) { resume("throw", value); }
48
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
49
+ };
50
+ Object.defineProperty(exports, "__esModule", { value: true });
51
+ exports.RecontractDbAccessor = void 0;
52
+ const db_provider_1 = require("@d19n/odin-sdk-generator/dist/db.provider");
53
+ const query_builder_1 = require("@d19n/odin-sdk-generator/dist/query-builder");
54
+ const RecontractRecord_1 = require("../records-v2/RecontractRecord");
55
+ class RecontractDbAccessor {
56
+ /**
57
+ * Create a new RecontractDbAccessor
58
+ * @param principal - The authenticated principal
59
+ * @param dbService - The database service instance
60
+ * @param defaultOptions - Default provider options applied to all operations
61
+ */
62
+ constructor(principal, dbService, defaultOptions) {
63
+ this._moduleName = 'OrderModule';
64
+ this._entityName = 'Recontract';
65
+ this._provider = new db_provider_1.DbProvider(principal, dbService, defaultOptions);
66
+ this._defaultOptions = defaultOptions;
67
+ }
68
+ get moduleName() { return this._moduleName; }
69
+ get entityName() { return this._entityName; }
70
+ // ============================================
71
+ // RECORD CREATION
72
+ // ============================================
73
+ /**
74
+ * Create a new empty Recontract record instance for create operations.
75
+ * Pre-generates an ID that can be referenced before the record is saved.
76
+ *
77
+ * @param id - Optional ID to use (auto-generated UUID if not provided)
78
+ * @returns A new record wrapper with pre-generated ID
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * // Auto-generated ID
83
+ * const note = odinDb.notes.new();
84
+ * console.log(note.id); // UUID available immediately
85
+ *
86
+ * // Custom ID
87
+ * const order = odinDb.orders.new("custom-id-123");
88
+ *
89
+ * // Reference ID before save
90
+ * const account = odinDb.accounts.new();
91
+ * const contact = odinDb.contacts.new();
92
+ * await contact
93
+ * .link({ id: account.id, entity: "CrmModule:Account" })
94
+ * .createContact({ FirstName: "John" });
95
+ * ```
96
+ */
97
+ new(id) {
98
+ return new RecontractRecord_1.RecontractRecord(null, this._provider, id);
99
+ }
100
+ // ============================================
101
+ // RECORD RETRIEVAL
102
+ // ============================================
103
+ /**
104
+ * Get a single Recontract record by ID
105
+ *
106
+ * @param id - The record ID
107
+ * @param queryOptions - Query options (WHAT to fetch: entities to include)
108
+ * @param providerOptions - Provider options (HOW to fetch: omitPermissionsCheck)
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * // Simple get
113
+ * const record = await accessor.get(id);
114
+ *
115
+ * // With related entities
116
+ * const record = await accessor.get(id, { entities: ["Contact", "Address"] });
117
+ *
118
+ * // With permissions bypass
119
+ * const record = await accessor.get(id, {}, { omitPermissionsCheck: true });
120
+ *
121
+ * // Both options
122
+ * const record = await accessor.get(id, { entities: ["Invoice"] }, { omitPermissionsCheck: true });
123
+ * ```
124
+ */
125
+ get(id, queryOptions, providerOptions) {
126
+ return __awaiter(this, void 0, void 0, function* () {
127
+ const record = yield this._provider._getByPrimaryKey(this._moduleName, this._entityName, id, queryOptions, providerOptions);
128
+ return new RecontractRecord_1.RecontractRecord(record, this._provider);
129
+ });
130
+ }
131
+ /**
132
+ * Get multiple Recontract records by IDs
133
+ *
134
+ * @param ids - Array of record IDs
135
+ * @param queryOptions - Query options (WHAT to fetch: entities to include)
136
+ * @param providerOptions - Provider options (HOW to fetch: omitPermissionsCheck)
137
+ */
138
+ getMany(ids, queryOptions, providerOptions) {
139
+ return __awaiter(this, void 0, void 0, function* () {
140
+ if (ids.length === 0)
141
+ return [];
142
+ const records = yield this._provider._getManyByPrimaryKey(this._moduleName, this._entityName, ids, queryOptions, providerOptions);
143
+ return records.map((r) => new RecontractRecord_1.RecontractRecord(r, this._provider));
144
+ });
145
+ }
146
+ // ============================================
147
+ // SEARCH OPERATIONS
148
+ // ============================================
149
+ /**
150
+ * Search Recontract records
151
+ *
152
+ * @param params - Search parameters
153
+ * @param providerOptions - Provider options (HOW to fetch: omitPermissionsCheck)
154
+ */
155
+ search(params, providerOptions) {
156
+ return __awaiter(this, void 0, void 0, function* () {
157
+ const result = yield this._provider._searchRecords(this._moduleName, this._entityName, params, providerOptions);
158
+ return {
159
+ records: result.records.map((r) => new RecontractRecord_1.RecontractRecord(r, this._provider)),
160
+ totalRecords: result.totalRecords,
161
+ hasMore: result.hasMore,
162
+ };
163
+ });
164
+ }
165
+ /**
166
+ * Search all Recontract records with automatic pagination
167
+ *
168
+ * @param params - Search parameters
169
+ * @param providerOptions - Provider options (HOW to fetch: omitPermissionsCheck)
170
+ */
171
+ searchAll(params, providerOptions) {
172
+ return __awaiter(this, void 0, void 0, function* () {
173
+ const result = yield this._provider._searchAllRecordsAndPaginate(this._moduleName, this._entityName, params, 0, providerOptions);
174
+ return result.records.map((r) => new RecontractRecord_1.RecontractRecord(r, this._provider));
175
+ });
176
+ }
177
+ /**
178
+ * Async generator for paginating through all matching records.
179
+ * Yields batches of wrapped records.
180
+ *
181
+ * @param params - Search parameters
182
+ * @param providerOptions - Provider options (HOW to fetch: omitPermissionsCheck)
183
+ */
184
+ paginate(params, providerOptions) {
185
+ var _a;
186
+ return __asyncGenerator(this, arguments, function* paginate_1() {
187
+ let hasMore = true;
188
+ let searchAfter;
189
+ const query = Object.assign(Object.assign({}, params.query), { pageSize: ((_a = params.query) === null || _a === void 0 ? void 0 : _a.pageSize) || 500 });
190
+ while (hasMore) {
191
+ const result = yield __await(this._provider._searchRecords(this._moduleName, this._entityName, Object.assign(Object.assign({}, params), { query: Object.assign(Object.assign({}, query), { searchAfter }) }), providerOptions));
192
+ if (result.records.length > 0) {
193
+ yield yield __await(result.records.map((r) => new RecontractRecord_1.RecontractRecord(r, this._provider)));
194
+ const lastRecord = result.records[result.records.length - 1];
195
+ searchAfter = lastRecord === null || lastRecord === void 0 ? void 0 : lastRecord.sort;
196
+ }
197
+ hasMore = result.hasMore && result.records.length >= query.pageSize;
198
+ }
199
+ });
200
+ }
201
+ // ============================================
202
+ // QUERY BUILDER
203
+ // ============================================
204
+ /**
205
+ * Create a fluent query builder for Recontract records
206
+ *
207
+ * @example
208
+ * ```typescript
209
+ * const results = await accessor
210
+ * .query()
211
+ * .where('Status', 'in', ['Active', 'Pending'])
212
+ * .where('CreatedAt', 'gte', '2025-01-01')
213
+ * .select('id', 'title', 'properties.*')
214
+ * .sortBy('createdAt', 'desc')
215
+ * .limit(100)
216
+ * .execute();
217
+ * ```
218
+ */
219
+ query() {
220
+ return (0, query_builder_1.createQueryBuilder)(this);
221
+ }
222
+ /** Access the underlying DbProvider */
223
+ get provider() {
224
+ return this._provider;
225
+ }
226
+ }
227
+ exports.RecontractDbAccessor = RecontractDbAccessor;
@@ -93,6 +93,7 @@ export { PgWebhookDbAccessor, PgWebhookDbSearchResponse } from './PgWebhookDbAcc
93
93
  export { PriceBookDbAccessor, PriceBookDbSearchResponse } from './PriceBookDbAccessor';
94
94
  export { ProductDbAccessor, ProductDbSearchResponse } from './ProductDbAccessor';
95
95
  export { PushNotificationDbAccessor, PushNotificationDbSearchResponse } from './PushNotificationDbAccessor';
96
+ export { RecontractDbAccessor, RecontractDbSearchResponse } from './RecontractDbAccessor';
96
97
  export { ReferralDbAccessor, ReferralDbSearchResponse } from './ReferralDbAccessor';
97
98
  export { RegionDbAccessor, RegionDbSearchResponse } from './RegionDbAccessor';
98
99
  export { RemediationOutcomeFormDbAccessor, RemediationOutcomeFormDbSearchResponse } from './RemediationOutcomeFormDbAccessor';