@d19n/youfibre-odin-sdk 2.0.40 → 2.0.41
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 +11 -28
- package/dist/EntityRegistry.d.ts +0 -2
- package/dist/EntityRegistry.js +0 -2
- package/dist/OdinApiClient.d.ts +0 -4
- package/dist/OdinApiClient.js +0 -8
- package/dist/OdinDbClient.d.ts +0 -4
- package/dist/OdinDbClient.js +0 -8
- package/dist/accessors-v2/index.d.ts +0 -1
- package/dist/accessors-v2/index.js +2 -4
- package/dist/actions-v2/AssignCaseDto.d.ts +4 -4
- package/dist/actions-v2/AssignCaseWithNoteFlowDto.d.ts +4 -4
- package/dist/actions-v2/CreateAddressCrmDatasetDto.d.ts +116 -0
- package/dist/actions-v2/CreateAddressCrmDatasetDto.js +59 -0
- package/dist/actions-v2/CreateCaseFromContactDto.d.ts +4 -4
- package/dist/db-accessors-v2/index.d.ts +0 -1
- package/dist/db-accessors-v2/index.js +2 -4
- package/dist/entities-v2/Lead.d.ts +0 -7
- package/dist/entities-v2/Lead.js +0 -2
- package/dist/entities-v2/WorkOrder.d.ts +3 -1
- package/dist/entities-v2/WorkOrder.js +2 -0
- package/dist/records-v2/AccountRecord.d.ts +0 -29
- package/dist/records-v2/AccountRecord.js +0 -36
- package/dist/records-v2/AddressRecord.d.ts +0 -28
- package/dist/records-v2/AddressRecord.js +1 -45
- package/dist/records-v2/CaseRecord.js +8 -62
- package/dist/records-v2/ChurnRequestRecord.js +1 -7
- package/dist/records-v2/ContactRecord.d.ts +0 -49
- package/dist/records-v2/ContactRecord.js +1 -79
- package/dist/records-v2/ContractBuyOutRecord.js +2 -14
- package/dist/records-v2/CrmDatasetRecord.d.ts +29 -0
- package/dist/records-v2/CrmDatasetRecord.js +36 -0
- package/dist/records-v2/CustomerDeviceOntRecord.js +1 -7
- package/dist/records-v2/LeadRecord.d.ts +0 -29
- package/dist/records-v2/LeadRecord.js +0 -36
- package/dist/records-v2/OrderItemRecord.d.ts +0 -29
- package/dist/records-v2/OrderItemRecord.js +0 -36
- package/dist/records-v2/OrderRecord.d.ts +0 -99
- package/dist/records-v2/OrderRecord.js +8 -182
- package/dist/records-v2/PICRequestRecord.js +1 -7
- package/dist/records-v2/PaymentMethodRefundRecord.js +1 -6
- package/dist/records-v2/TestEntityForVisualBuilderRecord.js +1 -6
- package/dist/records-v2/WorkOrderRecord.js +41 -364
- package/dist/records-v2/index.d.ts +1 -2
- package/dist/records-v2/index.js +6 -9
- package/package.json +2 -2
- package/dist/accessors-v2/PhoneNumberAccessor.d.ts +0 -111
- package/dist/accessors-v2/PhoneNumberAccessor.js +0 -190
- package/dist/actions-v2/CreateAccountFromBrskDto.d.ts +0 -102
- package/dist/actions-v2/CreateAccountFromBrskDto.js +0 -54
- package/dist/actions-v2/CreateContactFromBrskDto.d.ts +0 -107
- package/dist/actions-v2/CreateContactFromBrskDto.js +0 -52
- package/dist/actions-v2/CreateLeadFromBrskDto.d.ts +0 -118
- package/dist/actions-v2/CreateLeadFromBrskDto.js +0 -52
- package/dist/actions-v2/CreateOrderFromBrskDto.d.ts +0 -138
- package/dist/actions-v2/CreateOrderFromBrskDto.js +0 -52
- package/dist/actions-v2/CreateOrderItemFromBrskDto.d.ts +0 -198
- package/dist/actions-v2/CreateOrderItemFromBrskDto.js +0 -52
- package/dist/actions-v2/CreatePhoneNumberFromBrskDto.d.ts +0 -67
- package/dist/actions-v2/CreatePhoneNumberFromBrskDto.js +0 -54
- package/dist/actions-v2/MoveOrderFromSupplyToActiveDto.d.ts +0 -112
- package/dist/actions-v2/MoveOrderFromSupplyToActiveDto.js +0 -77
- package/dist/actions-v2/MoveOrderFromSupplyToCancelledDto.d.ts +0 -112
- package/dist/actions-v2/MoveOrderFromSupplyToCancelledDto.js +0 -77
- package/dist/actions-v2/UpdateAddressFromBrskDto.d.ts +0 -61
- package/dist/actions-v2/UpdateAddressFromBrskDto.js +0 -54
- package/dist/db-accessors-v2/PhoneNumberDbAccessor.d.ts +0 -149
- package/dist/db-accessors-v2/PhoneNumberDbAccessor.js +0 -227
- package/dist/records-v2/PhoneNumberRecord.d.ts +0 -205
- package/dist/records-v2/PhoneNumberRecord.js +0 -292
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PhoneNumber DB Accessor
|
|
3
|
-
*
|
|
4
|
-
* Provides typed access to PhoneNumber 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 PhoneNumberDbAccessor(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 { PhoneNumberProperties } from '../entities-v2/PhoneNumber';
|
|
32
|
-
import { PhoneNumberRecord } from '../records-v2/PhoneNumberRecord';
|
|
33
|
-
/** Search response with wrapped records */
|
|
34
|
-
export interface PhoneNumberDbSearchResponse {
|
|
35
|
-
records: PhoneNumberRecord[];
|
|
36
|
-
totalRecords: number;
|
|
37
|
-
hasMore: boolean;
|
|
38
|
-
}
|
|
39
|
-
export declare class PhoneNumberDbAccessor {
|
|
40
|
-
private readonly _provider;
|
|
41
|
-
private readonly _moduleName;
|
|
42
|
-
private readonly _entityName;
|
|
43
|
-
private readonly _defaultOptions?;
|
|
44
|
-
/**
|
|
45
|
-
* Create a new PhoneNumberDbAccessor
|
|
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 PhoneNumber 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): PhoneNumberRecord;
|
|
78
|
-
/**
|
|
79
|
-
* Get a single PhoneNumber 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<PhoneNumberRecord>;
|
|
101
|
-
/**
|
|
102
|
-
* Get multiple PhoneNumber 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<PhoneNumberRecord[]>;
|
|
109
|
-
/**
|
|
110
|
-
* Search PhoneNumber 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<PhoneNumberDbSearchResponse>;
|
|
116
|
-
/**
|
|
117
|
-
* Search all PhoneNumber 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<PhoneNumberRecord[]>;
|
|
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<PhoneNumberRecord[]>;
|
|
131
|
-
/**
|
|
132
|
-
* Create a fluent query builder for PhoneNumber 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<PhoneNumberProperties, PhoneNumberRecord>;
|
|
147
|
-
/** Access the underlying DbProvider */
|
|
148
|
-
get provider(): DbProvider;
|
|
149
|
-
}
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* PhoneNumber DB Accessor
|
|
4
|
-
*
|
|
5
|
-
* Provides typed access to PhoneNumber 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 PhoneNumberDbAccessor(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.PhoneNumberDbAccessor = 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 PhoneNumberRecord_1 = require("../records-v2/PhoneNumberRecord");
|
|
55
|
-
class PhoneNumberDbAccessor {
|
|
56
|
-
/**
|
|
57
|
-
* Create a new PhoneNumberDbAccessor
|
|
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 = 'CrmModule';
|
|
64
|
-
this._entityName = 'PhoneNumber';
|
|
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 PhoneNumber 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 PhoneNumberRecord_1.PhoneNumberRecord(null, this._provider, id);
|
|
99
|
-
}
|
|
100
|
-
// ============================================
|
|
101
|
-
// RECORD RETRIEVAL
|
|
102
|
-
// ============================================
|
|
103
|
-
/**
|
|
104
|
-
* Get a single PhoneNumber 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 PhoneNumberRecord_1.PhoneNumberRecord(record, this._provider);
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Get multiple PhoneNumber 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 PhoneNumberRecord_1.PhoneNumberRecord(r, this._provider));
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
// ============================================
|
|
147
|
-
// SEARCH OPERATIONS
|
|
148
|
-
// ============================================
|
|
149
|
-
/**
|
|
150
|
-
* Search PhoneNumber 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 PhoneNumberRecord_1.PhoneNumberRecord(r, this._provider)),
|
|
160
|
-
totalRecords: result.totalRecords,
|
|
161
|
-
hasMore: result.hasMore,
|
|
162
|
-
};
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Search all PhoneNumber 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 PhoneNumberRecord_1.PhoneNumberRecord(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 PhoneNumberRecord_1.PhoneNumberRecord(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 PhoneNumber 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.PhoneNumberDbAccessor = PhoneNumberDbAccessor;
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PhoneNumber Record Wrapper
|
|
3
|
-
*
|
|
4
|
-
* Provides typed action methods and link management.
|
|
5
|
-
* Works with both ApiProvider and DbProvider.
|
|
6
|
-
*
|
|
7
|
-
* All action methods return an ActionBuilder or FlowBuilder.
|
|
8
|
-
* Call .execute() to run or .dryRun() to get the payload for debugging.
|
|
9
|
-
*
|
|
10
|
-
* Can be instantiated with null record for create operations:
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const record = odinClient.phoneNumbers.new();
|
|
13
|
-
* await record.createPhoneNumber({ ... }).execute();
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* AUTO-GENERATED - DO NOT EDIT DIRECTLY
|
|
17
|
-
*/
|
|
18
|
-
import { OdinRecord, OdinRecordLinkDto } from '@d19n/odin-types/dist/core';
|
|
19
|
-
import { PipelineStageEntity } from '@d19n/odin-types/dist/core';
|
|
20
|
-
import { IDbRecordCreateUpdateRes } from '@d19n/odin-types/dist/core/interfaces/v1.db.interfaces';
|
|
21
|
-
import { IOdinProvider } from '@d19n/odin-sdk-generator/dist/odin-sdk-types';
|
|
22
|
-
import { RecordLinkManager } from '@d19n/odin-sdk-generator/dist/record-link-manager';
|
|
23
|
-
import { PhoneNumberProperties } from '../entities-v2/PhoneNumber';
|
|
24
|
-
import { CreatePhoneNumberFromBrskProperties } from '../actions-v2/CreatePhoneNumberFromBrskDto';
|
|
25
|
-
import { OrderRecord } from './OrderRecord';
|
|
26
|
-
import { ContactRecord } from './ContactRecord';
|
|
27
|
-
/**
|
|
28
|
-
* Builder for action execution with dryRun support
|
|
29
|
-
*
|
|
30
|
-
* Provides a consistent API across all action types:
|
|
31
|
-
* - `.execute()` - Execute the action and return results
|
|
32
|
-
* - `.dryRun()` - Return the payload without executing (for debugging)
|
|
33
|
-
*/
|
|
34
|
-
declare class ActionBuilder<T = IDbRecordCreateUpdateRes[]> {
|
|
35
|
-
private _provider;
|
|
36
|
-
private _moduleName;
|
|
37
|
-
private _entityName;
|
|
38
|
-
private _payload;
|
|
39
|
-
private _clearPendingLinks;
|
|
40
|
-
constructor(provider: IOdinProvider, moduleName: string, entityName: string, payload: Record<string, any>, clearPendingLinks: () => void);
|
|
41
|
-
/**
|
|
42
|
-
* Set an external system identifier for this record.
|
|
43
|
-
* Links the record to a corresponding entry in an external application.
|
|
44
|
-
*
|
|
45
|
-
* @param externalId - The ID in the external system
|
|
46
|
-
* @param externalAppId - The external application identifier
|
|
47
|
-
* @returns this (for chaining)
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```typescript
|
|
51
|
-
* await record.createOrder({ ... }).withExternalId('SF-123', 'salesforce').execute();
|
|
52
|
-
* ```
|
|
53
|
-
*/
|
|
54
|
-
withExternalId(externalId: string, externalAppId: string): this;
|
|
55
|
-
/**
|
|
56
|
-
* Set security/access groups for this record.
|
|
57
|
-
* Controls which user groups can access the record.
|
|
58
|
-
*
|
|
59
|
-
* @param groups - Array of group names
|
|
60
|
-
* @returns this (for chaining)
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```typescript
|
|
64
|
-
* await record.createOrder({ ... }).withGroups(['TenantA', 'BillingTeam']).execute();
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
withGroups(groups: string[]): this;
|
|
68
|
-
/**
|
|
69
|
-
* Execute the action
|
|
70
|
-
* @returns The result from the API
|
|
71
|
-
*/
|
|
72
|
-
execute(): Promise<T>;
|
|
73
|
-
/**
|
|
74
|
-
* Returns the request payload without executing (for debugging)
|
|
75
|
-
* @returns The request payload that would be sent to the API
|
|
76
|
-
*/
|
|
77
|
-
dryRun(): Record<string, any>;
|
|
78
|
-
/**
|
|
79
|
-
* Prevents accidental `await actionBuilder` without .execute()
|
|
80
|
-
* Forces developers to explicitly call .execute()
|
|
81
|
-
* @throws Error always - use .execute() or .dryRun() instead
|
|
82
|
-
*/
|
|
83
|
-
then(): never;
|
|
84
|
-
}
|
|
85
|
-
export declare class PhoneNumberRecord<TProps = PhoneNumberProperties> {
|
|
86
|
-
private _record;
|
|
87
|
-
private _provider;
|
|
88
|
-
private _pendingLinks;
|
|
89
|
-
private _preGeneratedId;
|
|
90
|
-
private _orders?;
|
|
91
|
-
private _contacts?;
|
|
92
|
-
/**
|
|
93
|
-
* Create a record wrapper.
|
|
94
|
-
* @param record - The underlying record, or null for create operations
|
|
95
|
-
* @param provider - The API or DB provider
|
|
96
|
-
* @param preGeneratedId - Optional pre-generated ID for new records (auto-generated if not provided)
|
|
97
|
-
*/
|
|
98
|
-
constructor(record: OdinRecord<TProps> | null, provider: IOdinProvider, preGeneratedId?: string);
|
|
99
|
-
/** Returns true if this is a new (unsaved) record */
|
|
100
|
-
get isNew(): boolean;
|
|
101
|
-
/** Record ID - always available (pre-generated for new records) */
|
|
102
|
-
get id(): string;
|
|
103
|
-
get entity(): string;
|
|
104
|
-
get type(): string | undefined;
|
|
105
|
-
/** Record properties - empty object for new (unsaved) records */
|
|
106
|
-
get properties(): TProps;
|
|
107
|
-
get title(): string | undefined;
|
|
108
|
-
get recordNumber(): string | undefined;
|
|
109
|
-
get stage(): PipelineStageEntity | undefined;
|
|
110
|
-
get createdAt(): string | undefined;
|
|
111
|
-
get updatedAt(): string | undefined;
|
|
112
|
-
get externalId(): string | undefined;
|
|
113
|
-
get externalAppId(): string | undefined;
|
|
114
|
-
get groups(): string[];
|
|
115
|
-
/** Access the underlying OdinRecord (null for new records) */
|
|
116
|
-
get record(): OdinRecord<TProps> | null;
|
|
117
|
-
/** Valid labels for Order associations */
|
|
118
|
-
static readonly ordersLabels: readonly ["Order__PhoneNumber"];
|
|
119
|
-
/**
|
|
120
|
-
* Access linked Order records
|
|
121
|
-
* @remarks Available labels: Order__PhoneNumber
|
|
122
|
-
* @throws Error if called on a new (unsaved) record
|
|
123
|
-
*
|
|
124
|
-
* @example
|
|
125
|
-
* ```typescript
|
|
126
|
-
* // Get all linked Order records
|
|
127
|
-
* const items = await record.orders.list();
|
|
128
|
-
* const first = await record.orders.first();
|
|
129
|
-
*
|
|
130
|
-
* // Filter by label
|
|
131
|
-
* const specific = await record.orders.first({ label: 'Order__PhoneNumber' });
|
|
132
|
-
* ```
|
|
133
|
-
*/
|
|
134
|
-
get orders(): RecordLinkManager<OrderRecord, typeof PhoneNumberRecord['ordersLabels'][number]>;
|
|
135
|
-
/** Valid labels for Contact associations */
|
|
136
|
-
static readonly contactsLabels: readonly ["Contact__PhoneNumber"];
|
|
137
|
-
/**
|
|
138
|
-
* Access linked Contact records
|
|
139
|
-
* @remarks Available labels: Contact__PhoneNumber
|
|
140
|
-
* @throws Error if called on a new (unsaved) record
|
|
141
|
-
*
|
|
142
|
-
* @example
|
|
143
|
-
* ```typescript
|
|
144
|
-
* // Get all linked Contact records
|
|
145
|
-
* const items = await record.contacts.list();
|
|
146
|
-
* const first = await record.contacts.first();
|
|
147
|
-
*
|
|
148
|
-
* // Filter by label
|
|
149
|
-
* const specific = await record.contacts.first({ label: 'Contact__PhoneNumber' });
|
|
150
|
-
* ```
|
|
151
|
-
*/
|
|
152
|
-
get contacts(): RecordLinkManager<ContactRecord, typeof PhoneNumberRecord['contactsLabels'][number]>;
|
|
153
|
-
/**
|
|
154
|
-
* Queue a link to be created with the next action.
|
|
155
|
-
* Works for both create and update actions.
|
|
156
|
-
* @returns this (for chaining)
|
|
157
|
-
*/
|
|
158
|
-
link(target: OdinRecord<any> | {
|
|
159
|
-
id: string;
|
|
160
|
-
entity: string;
|
|
161
|
-
}): this;
|
|
162
|
-
/** Get the currently queued links */
|
|
163
|
-
get pendingLinks(): OdinRecordLinkDto[];
|
|
164
|
-
/** Clear pending links without executing an action */
|
|
165
|
-
clearPendingLinks(): this;
|
|
166
|
-
/**
|
|
167
|
-
* Immediately unlink a record (API call).
|
|
168
|
-
* Unlike link(), this executes immediately.
|
|
169
|
-
* @throws Error if called on a new (unsaved) record
|
|
170
|
-
*/
|
|
171
|
-
unlink(target: OdinRecord<any> | {
|
|
172
|
-
id: string;
|
|
173
|
-
} | string): Promise<void>;
|
|
174
|
-
/**
|
|
175
|
-
* CreatePhoneNumberFromBrsk
|
|
176
|
-
*
|
|
177
|
-
* Creates a new PhoneNumber record with the specified properties.
|
|
178
|
-
* Returns an ActionBuilder - call .execute() to create or .dryRun() for debugging.
|
|
179
|
-
*
|
|
180
|
-
* @param properties - The properties for the new record
|
|
181
|
-
* @param options - Optional settings
|
|
182
|
-
* @param options.type - Override the record type
|
|
183
|
-
* @param options.journeyId - Associate with a journey
|
|
184
|
-
* @param options.stageKey - Set initial pipeline stage
|
|
185
|
-
* @returns ActionBuilder - call .execute() to create or .dryRun() for payload
|
|
186
|
-
*
|
|
187
|
-
* @example
|
|
188
|
-
* ```typescript
|
|
189
|
-
* // Create with properties
|
|
190
|
-
* const record = odinClient.phoneNumbers.new();
|
|
191
|
-
* await record.createPhoneNumberFromBrsk({ ... }).execute();
|
|
192
|
-
*
|
|
193
|
-
* // Dry run (for debugging)
|
|
194
|
-
* const payload = record.createPhoneNumberFromBrsk({ ... }).dryRun();
|
|
195
|
-
* ```
|
|
196
|
-
*/
|
|
197
|
-
createPhoneNumberFromBrsk(properties?: CreatePhoneNumberFromBrskProperties, options?: {
|
|
198
|
-
type?: string;
|
|
199
|
-
journeyId?: string;
|
|
200
|
-
stageKey?: string;
|
|
201
|
-
}): ActionBuilder;
|
|
202
|
-
}
|
|
203
|
-
/** Type guard to check if an object is a PhoneNumberRecord */
|
|
204
|
-
export declare function isPhoneNumberRecord(obj: any): obj is PhoneNumberRecord;
|
|
205
|
-
export {};
|