@d19n/youfibre-odin-sdk 2.0.270 → 2.0.271
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 +8 -1
- package/dist/EntityRegistry.d.ts +2 -0
- package/dist/EntityRegistry.js +2 -0
- package/dist/OdinApiClient.d.ts +4 -0
- package/dist/OdinApiClient.js +8 -0
- package/dist/OdinDbClient.d.ts +4 -0
- package/dist/OdinDbClient.js +8 -0
- package/dist/accessors-v2/YfWifiSurveyAccessor.d.ts +111 -0
- package/dist/accessors-v2/YfWifiSurveyAccessor.js +190 -0
- package/dist/accessors-v2/index.d.ts +1 -0
- package/dist/accessors-v2/index.js +3 -1
- package/dist/actions-v2/CreateAppointmentDto.d.ts +8 -1
- package/dist/actions-v2/CreateCustomerDeviceBatteryDto.d.ts +103 -1
- package/dist/actions-v2/CreateCustomerDeviceBatteryDto.js +120 -1
- package/dist/actions-v2/CreateYfWifiSurveyDto.d.ts +118 -0
- package/dist/actions-v2/CreateYfWifiSurveyDto.js +54 -0
- package/dist/actions-v2/UpdateCustomerDeviceBatteryDto.d.ts +183 -0
- package/dist/actions-v2/UpdateCustomerDeviceBatteryDto.js +179 -0
- package/dist/db-accessors-v2/YfWifiSurveyDbAccessor.d.ts +149 -0
- package/dist/db-accessors-v2/YfWifiSurveyDbAccessor.js +227 -0
- package/dist/db-accessors-v2/index.d.ts +1 -0
- package/dist/db-accessors-v2/index.js +3 -1
- package/dist/records-v2/CustomerDeviceRecord.d.ts +34 -68
- package/dist/records-v2/CustomerDeviceRecord.js +38 -17
- package/dist/records-v2/FileRecord.d.ts +20 -0
- package/dist/records-v2/FileRecord.js +33 -0
- package/dist/records-v2/WorkOrderRecord.d.ts +20 -0
- package/dist/records-v2/WorkOrderRecord.js +33 -0
- package/dist/records-v2/YfWifiSurveyRecord.d.ts +225 -0
- package/dist/records-v2/YfWifiSurveyRecord.js +313 -0
- package/dist/records-v2/index.d.ts +1 -0
- package/dist/records-v2/index.js +5 -2
- package/package.json +1 -1
|
@@ -71,6 +71,7 @@ const ContactRecord_1 = require("./ContactRecord");
|
|
|
71
71
|
const MessageRecord_1 = require("./MessageRecord");
|
|
72
72
|
const EmailRecord_1 = require("./EmailRecord");
|
|
73
73
|
const PgDirectDebitFileRecord_1 = require("./PgDirectDebitFileRecord");
|
|
74
|
+
const YfWifiSurveyRecord_1 = require("./YfWifiSurveyRecord");
|
|
74
75
|
/**
|
|
75
76
|
* Builder for action execution with dryRun support
|
|
76
77
|
*
|
|
@@ -1514,6 +1515,36 @@ class FileRecord {
|
|
|
1514
1515
|
}
|
|
1515
1516
|
return this._pgDirectDebitFiles;
|
|
1516
1517
|
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Access linked YfWifiSurvey records
|
|
1520
|
+
* @remarks Available labels: YfWifiSurvey__File
|
|
1521
|
+
* @throws Error if called on a new (unsaved) record
|
|
1522
|
+
*
|
|
1523
|
+
* @example
|
|
1524
|
+
* ```typescript
|
|
1525
|
+
* // Get all linked YfWifiSurvey records
|
|
1526
|
+
* const items = await record.yfWifiSurveys.list();
|
|
1527
|
+
* const first = await record.yfWifiSurveys.first();
|
|
1528
|
+
*
|
|
1529
|
+
* // Filter by label
|
|
1530
|
+
* const specific = await record.yfWifiSurveys.first({ label: 'YfWifiSurvey__File' });
|
|
1531
|
+
* ```
|
|
1532
|
+
*/
|
|
1533
|
+
get yfWifiSurveys() {
|
|
1534
|
+
var _a;
|
|
1535
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
1536
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
1537
|
+
if (!this._yfWifiSurveys) {
|
|
1538
|
+
this._yfWifiSurveys = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
1539
|
+
sourceEntity: 'SchemaModule:File',
|
|
1540
|
+
targetEntity: 'FieldServiceModule:YfWifiSurvey',
|
|
1541
|
+
targetModuleName: 'FieldServiceModule',
|
|
1542
|
+
targetEntityName: 'YfWifiSurvey',
|
|
1543
|
+
labels: ['YfWifiSurvey__File'],
|
|
1544
|
+
}, YfWifiSurveyRecord_1.YfWifiSurveyRecord);
|
|
1545
|
+
}
|
|
1546
|
+
return this._yfWifiSurveys;
|
|
1547
|
+
}
|
|
1517
1548
|
// ============================================
|
|
1518
1549
|
// LINK MANAGEMENT
|
|
1519
1550
|
// ============================================
|
|
@@ -1671,6 +1702,8 @@ FileRecord.messagesLabels = ['Message_File'];
|
|
|
1671
1702
|
FileRecord.emailsLabels = ['Attachments'];
|
|
1672
1703
|
/** Valid labels for PgDirectDebitFile associations */
|
|
1673
1704
|
FileRecord.pgDirectDebitFilesLabels = ['PgDirectDebitFile__File'];
|
|
1705
|
+
/** Valid labels for YfWifiSurvey associations */
|
|
1706
|
+
FileRecord.yfWifiSurveysLabels = ['YfWifiSurvey__File'];
|
|
1674
1707
|
/** Type guard to check if an object is a FileRecord */
|
|
1675
1708
|
function isFileRecord(obj) {
|
|
1676
1709
|
return obj instanceof FileRecord;
|
|
@@ -129,6 +129,7 @@ import { WayleaveAuditRecord } from './WayleaveAuditRecord';
|
|
|
129
129
|
import { SiteSpecificRiskAssessmentOutcomeFormRecord } from './SiteSpecificRiskAssessmentOutcomeFormRecord';
|
|
130
130
|
import { DataIssueRecord } from './DataIssueRecord';
|
|
131
131
|
import { OrderRecord } from './OrderRecord';
|
|
132
|
+
import { YfWifiSurveyRecord } from './YfWifiSurveyRecord';
|
|
132
133
|
/** Valid entity types for WorkOrder */
|
|
133
134
|
export declare type WorkOrderType = 'COLLECTION' | 'COLLECTION_AMCO' | 'DISPATCH_AMCO' | 'FINANCE' | 'INSPECTION' | 'INSTALL' | 'INSTALL_BUSINESS' | 'INSTALL_SERVICE' | 'NETWORK_ADJUSTMENT' | 'PLANNING' | 'PRE_PULL' | 'REMEDIATION' | 'REPLACEMENT_AMCO' | 'SERVICE' | 'WAYLEAVE';
|
|
134
135
|
/**
|
|
@@ -2565,6 +2566,7 @@ export declare class WorkOrderRecord<TProps = WorkOrderProperties> {
|
|
|
2565
2566
|
private _siteSpecificRiskAssessmentOutcomeForms?;
|
|
2566
2567
|
private _dataIssues?;
|
|
2567
2568
|
private _orders?;
|
|
2569
|
+
private _yfWifiSurveys?;
|
|
2568
2570
|
/**
|
|
2569
2571
|
* Create a record wrapper.
|
|
2570
2572
|
* @param record - The underlying record, or null for create operations
|
|
@@ -3496,6 +3498,24 @@ export declare class WorkOrderRecord<TProps = WorkOrderProperties> {
|
|
|
3496
3498
|
* ```
|
|
3497
3499
|
*/
|
|
3498
3500
|
get orders(): RecordLinkManager<OrderRecord, typeof WorkOrderRecord['ordersLabels'][number]>;
|
|
3501
|
+
/** Valid labels for YfWifiSurvey associations */
|
|
3502
|
+
static readonly yfWifiSurveysLabels: readonly ["WorkOrder__YfWifiSurvey"];
|
|
3503
|
+
/**
|
|
3504
|
+
* Access linked YfWifiSurvey records
|
|
3505
|
+
* @remarks Available labels: WorkOrder__YfWifiSurvey
|
|
3506
|
+
* @throws Error if called on a new (unsaved) record
|
|
3507
|
+
*
|
|
3508
|
+
* @example
|
|
3509
|
+
* ```typescript
|
|
3510
|
+
* // Get all linked YfWifiSurvey records
|
|
3511
|
+
* const items = await record.yfWifiSurveys.list();
|
|
3512
|
+
* const first = await record.yfWifiSurveys.first();
|
|
3513
|
+
*
|
|
3514
|
+
* // Filter by label
|
|
3515
|
+
* const specific = await record.yfWifiSurveys.first({ label: 'WorkOrder__YfWifiSurvey' });
|
|
3516
|
+
* ```
|
|
3517
|
+
*/
|
|
3518
|
+
get yfWifiSurveys(): RecordLinkManager<YfWifiSurveyRecord, typeof WorkOrderRecord['yfWifiSurveysLabels'][number]>;
|
|
3499
3519
|
/**
|
|
3500
3520
|
* Queue a link to be created with the next action.
|
|
3501
3521
|
* Works for both create and update actions.
|
|
@@ -69,6 +69,7 @@ const WayleaveAuditRecord_1 = require("./WayleaveAuditRecord");
|
|
|
69
69
|
const SiteSpecificRiskAssessmentOutcomeFormRecord_1 = require("./SiteSpecificRiskAssessmentOutcomeFormRecord");
|
|
70
70
|
const DataIssueRecord_1 = require("./DataIssueRecord");
|
|
71
71
|
const OrderRecord_1 = require("./OrderRecord");
|
|
72
|
+
const YfWifiSurveyRecord_1 = require("./YfWifiSurveyRecord");
|
|
72
73
|
/**
|
|
73
74
|
* Builder for action execution with dryRun support
|
|
74
75
|
*
|
|
@@ -5619,6 +5620,36 @@ class WorkOrderRecord {
|
|
|
5619
5620
|
}
|
|
5620
5621
|
return this._orders;
|
|
5621
5622
|
}
|
|
5623
|
+
/**
|
|
5624
|
+
* Access linked YfWifiSurvey records
|
|
5625
|
+
* @remarks Available labels: WorkOrder__YfWifiSurvey
|
|
5626
|
+
* @throws Error if called on a new (unsaved) record
|
|
5627
|
+
*
|
|
5628
|
+
* @example
|
|
5629
|
+
* ```typescript
|
|
5630
|
+
* // Get all linked YfWifiSurvey records
|
|
5631
|
+
* const items = await record.yfWifiSurveys.list();
|
|
5632
|
+
* const first = await record.yfWifiSurveys.first();
|
|
5633
|
+
*
|
|
5634
|
+
* // Filter by label
|
|
5635
|
+
* const specific = await record.yfWifiSurveys.first({ label: 'WorkOrder__YfWifiSurvey' });
|
|
5636
|
+
* ```
|
|
5637
|
+
*/
|
|
5638
|
+
get yfWifiSurveys() {
|
|
5639
|
+
var _a;
|
|
5640
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
5641
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
5642
|
+
if (!this._yfWifiSurveys) {
|
|
5643
|
+
this._yfWifiSurveys = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
5644
|
+
sourceEntity: 'FieldServiceModule:WorkOrder',
|
|
5645
|
+
targetEntity: 'FieldServiceModule:YfWifiSurvey',
|
|
5646
|
+
targetModuleName: 'FieldServiceModule',
|
|
5647
|
+
targetEntityName: 'YfWifiSurvey',
|
|
5648
|
+
labels: ['WorkOrder__YfWifiSurvey'],
|
|
5649
|
+
}, YfWifiSurveyRecord_1.YfWifiSurveyRecord);
|
|
5650
|
+
}
|
|
5651
|
+
return this._yfWifiSurveys;
|
|
5652
|
+
}
|
|
5622
5653
|
// ============================================
|
|
5623
5654
|
// LINK MANAGEMENT
|
|
5624
5655
|
// ============================================
|
|
@@ -10944,6 +10975,8 @@ WorkOrderRecord.siteSpecificRiskAssessmentOutcomeFormsLabels = ['WorkOrder__Site
|
|
|
10944
10975
|
WorkOrderRecord.dataIssuesLabels = ['DataIssue__WorkOrder'];
|
|
10945
10976
|
/** Valid labels for Order associations */
|
|
10946
10977
|
WorkOrderRecord.ordersLabels = ['Order__WorkOrder'];
|
|
10978
|
+
/** Valid labels for YfWifiSurvey associations */
|
|
10979
|
+
WorkOrderRecord.yfWifiSurveysLabels = ['WorkOrder__YfWifiSurvey'];
|
|
10947
10980
|
/** Type guard to check if an object is a WorkOrderRecord */
|
|
10948
10981
|
function isWorkOrderRecord(obj) {
|
|
10949
10982
|
return obj instanceof WorkOrderRecord;
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* YfWifiSurvey 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.yfWifiSurveys.new();
|
|
13
|
+
* await record.createYfWifiSurvey({ ... }).execute();
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Entity Types: DEFAULT
|
|
17
|
+
*
|
|
18
|
+
* AUTO-GENERATED - DO NOT EDIT DIRECTLY
|
|
19
|
+
*/
|
|
20
|
+
import { OdinRecord, OdinRecordLinkDto } from '@d19n/odin-types/dist/core';
|
|
21
|
+
import { PipelineStageEntity } from '@d19n/odin-types/dist/core';
|
|
22
|
+
import { IDbRecordCreateUpdateRes } from '@d19n/odin-types/dist/core/interfaces/v1.db.interfaces';
|
|
23
|
+
import { IOdinProvider } from '@d19n/odin-sdk-generator/dist/odin-sdk-types';
|
|
24
|
+
import { RecordLinkManager } from '@d19n/odin-sdk-generator/dist/record-link-manager';
|
|
25
|
+
import { YfWifiSurveyProperties } from '../entities-v2/YfWifiSurvey';
|
|
26
|
+
import { CreateYfWifiSurveyProperties } from '../actions-v2/CreateYfWifiSurveyDto';
|
|
27
|
+
import { WorkOrderRecord } from './WorkOrderRecord';
|
|
28
|
+
import { FileRecord } from './FileRecord';
|
|
29
|
+
/** Valid entity types for YfWifiSurvey */
|
|
30
|
+
export declare type YfWifiSurveyType = 'DEFAULT';
|
|
31
|
+
/**
|
|
32
|
+
* Builder for action execution with dryRun support
|
|
33
|
+
*
|
|
34
|
+
* Provides a consistent API across all action types:
|
|
35
|
+
* - `.execute()` - Execute the action and return results
|
|
36
|
+
* - `.dryRun()` - Return the payload without executing (for debugging)
|
|
37
|
+
*/
|
|
38
|
+
declare class ActionBuilder<T = IDbRecordCreateUpdateRes[]> {
|
|
39
|
+
private _provider;
|
|
40
|
+
private _moduleName;
|
|
41
|
+
private _entityName;
|
|
42
|
+
private _payload;
|
|
43
|
+
private _clearPendingLinks;
|
|
44
|
+
constructor(provider: IOdinProvider, moduleName: string, entityName: string, payload: Record<string, any>, clearPendingLinks: () => void);
|
|
45
|
+
/**
|
|
46
|
+
* Set an external system identifier for this record.
|
|
47
|
+
* Links the record to a corresponding entry in an external application.
|
|
48
|
+
*
|
|
49
|
+
* @param externalId - The ID in the external system
|
|
50
|
+
* @param externalAppId - The external application identifier
|
|
51
|
+
* @returns this (for chaining)
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* await record.createOrder({ ... }).withExternalId('SF-123', 'salesforce').execute();
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
withExternalId(externalId: string, externalAppId: string): this;
|
|
59
|
+
/**
|
|
60
|
+
* Set security/access groups for this record.
|
|
61
|
+
* Controls which user groups can access the record.
|
|
62
|
+
*
|
|
63
|
+
* @param groups - Array of group names
|
|
64
|
+
* @returns this (for chaining)
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* await record.createOrder({ ... }).withGroups(['TenantA', 'BillingTeam']).execute();
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
withGroups(groups: string[]): this;
|
|
72
|
+
/**
|
|
73
|
+
* Execute the action
|
|
74
|
+
* @returns The result from the API
|
|
75
|
+
*/
|
|
76
|
+
execute(): Promise<T>;
|
|
77
|
+
/**
|
|
78
|
+
* Returns the request payload without executing (for debugging)
|
|
79
|
+
* @returns The request payload that would be sent to the API
|
|
80
|
+
*/
|
|
81
|
+
dryRun(): Record<string, any>;
|
|
82
|
+
/**
|
|
83
|
+
* Prevents accidental `await actionBuilder` without .execute()
|
|
84
|
+
* Forces developers to explicitly call .execute()
|
|
85
|
+
* @throws Error always - use .execute() or .dryRun() instead
|
|
86
|
+
*/
|
|
87
|
+
then(): never;
|
|
88
|
+
}
|
|
89
|
+
export declare class YfWifiSurveyRecord<TProps = YfWifiSurveyProperties> {
|
|
90
|
+
private _record;
|
|
91
|
+
private _provider;
|
|
92
|
+
private _pendingLinks;
|
|
93
|
+
private _preGeneratedId;
|
|
94
|
+
private _workOrders?;
|
|
95
|
+
private _files?;
|
|
96
|
+
/**
|
|
97
|
+
* Create a record wrapper.
|
|
98
|
+
* @param record - The underlying record, or null for create operations
|
|
99
|
+
* @param provider - The API or DB provider
|
|
100
|
+
* @param preGeneratedId - Optional pre-generated ID for new records (auto-generated if not provided)
|
|
101
|
+
*/
|
|
102
|
+
constructor(record: OdinRecord<TProps> | null, provider: IOdinProvider, preGeneratedId?: string);
|
|
103
|
+
/** Returns true if this is a new (unsaved) record */
|
|
104
|
+
get isNew(): boolean;
|
|
105
|
+
/** Record ID - always available (pre-generated for new records) */
|
|
106
|
+
get id(): string;
|
|
107
|
+
get entity(): string;
|
|
108
|
+
get type(): YfWifiSurveyType | undefined;
|
|
109
|
+
/** Record properties - empty object for new (unsaved) records */
|
|
110
|
+
get properties(): TProps;
|
|
111
|
+
get title(): string | undefined;
|
|
112
|
+
get recordNumber(): string | undefined;
|
|
113
|
+
get stage(): PipelineStageEntity | undefined;
|
|
114
|
+
get createdAt(): string | undefined;
|
|
115
|
+
get updatedAt(): string | undefined;
|
|
116
|
+
get externalId(): string | undefined;
|
|
117
|
+
get externalAppId(): string | undefined;
|
|
118
|
+
get groups(): string[];
|
|
119
|
+
/** Access the underlying OdinRecord (null for new records) */
|
|
120
|
+
get record(): OdinRecord<TProps> | null;
|
|
121
|
+
/**
|
|
122
|
+
* Type guard: check if this record is of type DEFAULT
|
|
123
|
+
*
|
|
124
|
+
* When this returns true, TypeScript automatically narrows the type,
|
|
125
|
+
* giving you access to DEFAULT-specific properties.
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* if (record.isDefault()) {
|
|
130
|
+
* // TypeScript knows record.properties is YfWifiSurveyProperties
|
|
131
|
+
* console.log(record.properties.SomeTypeSpecificField);
|
|
132
|
+
* }
|
|
133
|
+
* ```
|
|
134
|
+
* @remarks This is the default record type
|
|
135
|
+
*/
|
|
136
|
+
isDefault(): this is YfWifiSurveyRecord<YfWifiSurveyProperties>;
|
|
137
|
+
/** Valid labels for WorkOrder associations */
|
|
138
|
+
static readonly workOrdersLabels: readonly ["WorkOrder__YfWifiSurvey"];
|
|
139
|
+
/**
|
|
140
|
+
* Access linked WorkOrder records
|
|
141
|
+
* @remarks Available labels: WorkOrder__YfWifiSurvey
|
|
142
|
+
* @throws Error if called on a new (unsaved) record
|
|
143
|
+
*
|
|
144
|
+
* @example
|
|
145
|
+
* ```typescript
|
|
146
|
+
* // Get all linked WorkOrder records
|
|
147
|
+
* const items = await record.workOrders.list();
|
|
148
|
+
* const first = await record.workOrders.first();
|
|
149
|
+
*
|
|
150
|
+
* // Filter by label
|
|
151
|
+
* const specific = await record.workOrders.first({ label: 'WorkOrder__YfWifiSurvey' });
|
|
152
|
+
* ```
|
|
153
|
+
*/
|
|
154
|
+
get workOrders(): RecordLinkManager<WorkOrderRecord, typeof YfWifiSurveyRecord['workOrdersLabels'][number]>;
|
|
155
|
+
/** Valid labels for File associations */
|
|
156
|
+
static readonly filesLabels: readonly ["YfWifiSurvey__File"];
|
|
157
|
+
/**
|
|
158
|
+
* Access linked File records
|
|
159
|
+
* @remarks Available labels: YfWifiSurvey__File
|
|
160
|
+
* @throws Error if called on a new (unsaved) record
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```typescript
|
|
164
|
+
* // Get all linked File records
|
|
165
|
+
* const items = await record.files.list();
|
|
166
|
+
* const first = await record.files.first();
|
|
167
|
+
*
|
|
168
|
+
* // Filter by label
|
|
169
|
+
* const specific = await record.files.first({ label: 'YfWifiSurvey__File' });
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
get files(): RecordLinkManager<FileRecord, typeof YfWifiSurveyRecord['filesLabels'][number]>;
|
|
173
|
+
/**
|
|
174
|
+
* Queue a link to be created with the next action.
|
|
175
|
+
* Works for both create and update actions.
|
|
176
|
+
* @returns this (for chaining)
|
|
177
|
+
*/
|
|
178
|
+
link(target: OdinRecord<any> | {
|
|
179
|
+
id: string;
|
|
180
|
+
entity: string;
|
|
181
|
+
}): this;
|
|
182
|
+
/** Get the currently queued links */
|
|
183
|
+
get pendingLinks(): OdinRecordLinkDto[];
|
|
184
|
+
/** Clear pending links without executing an action */
|
|
185
|
+
clearPendingLinks(): this;
|
|
186
|
+
/**
|
|
187
|
+
* Immediately unlink a record (API call).
|
|
188
|
+
* Unlike link(), this executes immediately.
|
|
189
|
+
* @throws Error if called on a new (unsaved) record
|
|
190
|
+
*/
|
|
191
|
+
unlink(target: OdinRecord<any> | {
|
|
192
|
+
id: string;
|
|
193
|
+
} | string): Promise<void>;
|
|
194
|
+
/**
|
|
195
|
+
* CreateYfWifiSurvey
|
|
196
|
+
*
|
|
197
|
+
* Creates a new YfWifiSurvey record with the specified properties.
|
|
198
|
+
* Returns an ActionBuilder - call .execute() to create or .dryRun() for debugging.
|
|
199
|
+
*
|
|
200
|
+
* @param properties - The properties for the new record
|
|
201
|
+
* @param options - Optional settings
|
|
202
|
+
* @param options.type - Override the record type
|
|
203
|
+
* @param options.journeyId - Associate with a journey
|
|
204
|
+
* @param options.stageKey - Set initial pipeline stage
|
|
205
|
+
* @returns ActionBuilder - call .execute() to create or .dryRun() for payload
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* // Create with properties
|
|
210
|
+
* const record = odinClient.yfWifiSurveys.new();
|
|
211
|
+
* await record.createYfWifiSurvey({ ... }).execute();
|
|
212
|
+
*
|
|
213
|
+
* // Dry run (for debugging)
|
|
214
|
+
* const payload = record.createYfWifiSurvey({ ... }).dryRun();
|
|
215
|
+
* ```
|
|
216
|
+
*/
|
|
217
|
+
createYfWifiSurvey(properties: CreateYfWifiSurveyProperties, options?: {
|
|
218
|
+
type?: string;
|
|
219
|
+
journeyId?: string;
|
|
220
|
+
stageKey?: string;
|
|
221
|
+
}): ActionBuilder;
|
|
222
|
+
}
|
|
223
|
+
/** Type guard to check if an object is a YfWifiSurveyRecord */
|
|
224
|
+
export declare function isYfWifiSurveyRecord(obj: any): obj is YfWifiSurveyRecord;
|
|
225
|
+
export {};
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* YfWifiSurvey Record Wrapper
|
|
4
|
+
*
|
|
5
|
+
* Provides typed action methods and link management.
|
|
6
|
+
* Works with both ApiProvider and DbProvider.
|
|
7
|
+
*
|
|
8
|
+
* All action methods return an ActionBuilder or FlowBuilder.
|
|
9
|
+
* Call .execute() to run or .dryRun() to get the payload for debugging.
|
|
10
|
+
*
|
|
11
|
+
* Can be instantiated with null record for create operations:
|
|
12
|
+
* ```typescript
|
|
13
|
+
* const record = odinClient.yfWifiSurveys.new();
|
|
14
|
+
* await record.createYfWifiSurvey({ ... }).execute();
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Entity Types: DEFAULT
|
|
18
|
+
*
|
|
19
|
+
* AUTO-GENERATED - DO NOT EDIT DIRECTLY
|
|
20
|
+
*/
|
|
21
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
22
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
23
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
24
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
25
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
26
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
27
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.isYfWifiSurveyRecord = exports.YfWifiSurveyRecord = void 0;
|
|
32
|
+
const uuid_1 = require("uuid");
|
|
33
|
+
const core_1 = require("@d19n/odin-types/dist/core");
|
|
34
|
+
const record_link_manager_1 = require("@d19n/odin-sdk-generator/dist/record-link-manager");
|
|
35
|
+
const WorkOrderRecord_1 = require("./WorkOrderRecord");
|
|
36
|
+
const FileRecord_1 = require("./FileRecord");
|
|
37
|
+
/**
|
|
38
|
+
* Builder for action execution with dryRun support
|
|
39
|
+
*
|
|
40
|
+
* Provides a consistent API across all action types:
|
|
41
|
+
* - `.execute()` - Execute the action and return results
|
|
42
|
+
* - `.dryRun()` - Return the payload without executing (for debugging)
|
|
43
|
+
*/
|
|
44
|
+
class ActionBuilder {
|
|
45
|
+
constructor(provider, moduleName, entityName, payload, clearPendingLinks) {
|
|
46
|
+
this._provider = provider;
|
|
47
|
+
this._moduleName = moduleName;
|
|
48
|
+
this._entityName = entityName;
|
|
49
|
+
this._payload = payload;
|
|
50
|
+
this._clearPendingLinks = clearPendingLinks;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Set an external system identifier for this record.
|
|
54
|
+
* Links the record to a corresponding entry in an external application.
|
|
55
|
+
*
|
|
56
|
+
* @param externalId - The ID in the external system
|
|
57
|
+
* @param externalAppId - The external application identifier
|
|
58
|
+
* @returns this (for chaining)
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* await record.createOrder({ ... }).withExternalId('SF-123', 'salesforce').execute();
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
withExternalId(externalId, externalAppId) {
|
|
66
|
+
this._payload.externalId = externalId;
|
|
67
|
+
this._payload.externalAppId = externalAppId;
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Set security/access groups for this record.
|
|
72
|
+
* Controls which user groups can access the record.
|
|
73
|
+
*
|
|
74
|
+
* @param groups - Array of group names
|
|
75
|
+
* @returns this (for chaining)
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* await record.createOrder({ ... }).withGroups(['TenantA', 'BillingTeam']).execute();
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
82
|
+
withGroups(groups) {
|
|
83
|
+
this._payload.groups = groups;
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Execute the action
|
|
88
|
+
* @returns The result from the API
|
|
89
|
+
*/
|
|
90
|
+
execute() {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
const result = yield this._provider._applyAction(this._moduleName, this._entityName, this._payload);
|
|
93
|
+
this._clearPendingLinks();
|
|
94
|
+
return result;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Returns the request payload without executing (for debugging)
|
|
99
|
+
* @returns The request payload that would be sent to the API
|
|
100
|
+
*/
|
|
101
|
+
dryRun() {
|
|
102
|
+
return this._payload;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Prevents accidental `await actionBuilder` without .execute()
|
|
106
|
+
* Forces developers to explicitly call .execute()
|
|
107
|
+
* @throws Error always - use .execute() or .dryRun() instead
|
|
108
|
+
*/
|
|
109
|
+
then() {
|
|
110
|
+
throw new Error('ActionBuilder cannot be awaited directly. Call .execute() to run the action or .dryRun() to get the payload.');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
class YfWifiSurveyRecord {
|
|
114
|
+
/**
|
|
115
|
+
* Create a record wrapper.
|
|
116
|
+
* @param record - The underlying record, or null for create operations
|
|
117
|
+
* @param provider - The API or DB provider
|
|
118
|
+
* @param preGeneratedId - Optional pre-generated ID for new records (auto-generated if not provided)
|
|
119
|
+
*/
|
|
120
|
+
constructor(record, provider, preGeneratedId) {
|
|
121
|
+
this._pendingLinks = [];
|
|
122
|
+
this._record = record;
|
|
123
|
+
this._provider = provider;
|
|
124
|
+
this._preGeneratedId = preGeneratedId !== null && preGeneratedId !== void 0 ? preGeneratedId : (0, uuid_1.v4)();
|
|
125
|
+
}
|
|
126
|
+
// ============================================
|
|
127
|
+
// CORE PROPERTIES
|
|
128
|
+
// ============================================
|
|
129
|
+
/** Returns true if this is a new (unsaved) record */
|
|
130
|
+
get isNew() { var _a; return !((_a = this._record) === null || _a === void 0 ? void 0 : _a.id); }
|
|
131
|
+
/** Record ID - always available (pre-generated for new records) */
|
|
132
|
+
get id() { var _a, _b; return (_b = (_a = this._record) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : this._preGeneratedId; }
|
|
133
|
+
get entity() { var _a, _b; return (_b = (_a = this._record) === null || _a === void 0 ? void 0 : _a.entity) !== null && _b !== void 0 ? _b : 'FieldServiceModule:YfWifiSurvey'; }
|
|
134
|
+
get type() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.type; }
|
|
135
|
+
/** Record properties - empty object for new (unsaved) records */
|
|
136
|
+
get properties() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.properties) || {}; }
|
|
137
|
+
get title() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.title; }
|
|
138
|
+
get recordNumber() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.recordNumber; }
|
|
139
|
+
get stage() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.stage; }
|
|
140
|
+
get createdAt() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.createdAt; }
|
|
141
|
+
get updatedAt() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.updatedAt; }
|
|
142
|
+
get externalId() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.externalId; }
|
|
143
|
+
get externalAppId() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.externalAppId; }
|
|
144
|
+
get groups() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.groups) || []; }
|
|
145
|
+
/** Access the underlying OdinRecord (null for new records) */
|
|
146
|
+
get record() { return this._record; }
|
|
147
|
+
// ============================================
|
|
148
|
+
// TYPE GUARDS (with TypeScript type predicates)
|
|
149
|
+
// ============================================
|
|
150
|
+
/**
|
|
151
|
+
* Type guard: check if this record is of type DEFAULT
|
|
152
|
+
*
|
|
153
|
+
* When this returns true, TypeScript automatically narrows the type,
|
|
154
|
+
* giving you access to DEFAULT-specific properties.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* if (record.isDefault()) {
|
|
159
|
+
* // TypeScript knows record.properties is YfWifiSurveyProperties
|
|
160
|
+
* console.log(record.properties.SomeTypeSpecificField);
|
|
161
|
+
* }
|
|
162
|
+
* ```
|
|
163
|
+
* @remarks This is the default record type
|
|
164
|
+
*/
|
|
165
|
+
isDefault() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.type) === 'DEFAULT'; }
|
|
166
|
+
/**
|
|
167
|
+
* Access linked WorkOrder records
|
|
168
|
+
* @remarks Available labels: WorkOrder__YfWifiSurvey
|
|
169
|
+
* @throws Error if called on a new (unsaved) record
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* // Get all linked WorkOrder records
|
|
174
|
+
* const items = await record.workOrders.list();
|
|
175
|
+
* const first = await record.workOrders.first();
|
|
176
|
+
*
|
|
177
|
+
* // Filter by label
|
|
178
|
+
* const specific = await record.workOrders.first({ label: 'WorkOrder__YfWifiSurvey' });
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
get workOrders() {
|
|
182
|
+
var _a;
|
|
183
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
184
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
185
|
+
if (!this._workOrders) {
|
|
186
|
+
this._workOrders = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
187
|
+
sourceEntity: 'FieldServiceModule:YfWifiSurvey',
|
|
188
|
+
targetEntity: 'FieldServiceModule:WorkOrder',
|
|
189
|
+
targetModuleName: 'FieldServiceModule',
|
|
190
|
+
targetEntityName: 'WorkOrder',
|
|
191
|
+
labels: ['WorkOrder__YfWifiSurvey'],
|
|
192
|
+
}, WorkOrderRecord_1.WorkOrderRecord);
|
|
193
|
+
}
|
|
194
|
+
return this._workOrders;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Access linked File records
|
|
198
|
+
* @remarks Available labels: YfWifiSurvey__File
|
|
199
|
+
* @throws Error if called on a new (unsaved) record
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* // Get all linked File records
|
|
204
|
+
* const items = await record.files.list();
|
|
205
|
+
* const first = await record.files.first();
|
|
206
|
+
*
|
|
207
|
+
* // Filter by label
|
|
208
|
+
* const specific = await record.files.first({ label: 'YfWifiSurvey__File' });
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
get files() {
|
|
212
|
+
var _a;
|
|
213
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
214
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
215
|
+
if (!this._files) {
|
|
216
|
+
this._files = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
217
|
+
sourceEntity: 'FieldServiceModule:YfWifiSurvey',
|
|
218
|
+
targetEntity: 'SchemaModule:File',
|
|
219
|
+
targetModuleName: 'SchemaModule',
|
|
220
|
+
targetEntityName: 'File',
|
|
221
|
+
labels: ['YfWifiSurvey__File'],
|
|
222
|
+
}, FileRecord_1.FileRecord);
|
|
223
|
+
}
|
|
224
|
+
return this._files;
|
|
225
|
+
}
|
|
226
|
+
// ============================================
|
|
227
|
+
// LINK MANAGEMENT
|
|
228
|
+
// ============================================
|
|
229
|
+
/**
|
|
230
|
+
* Queue a link to be created with the next action.
|
|
231
|
+
* Works for both create and update actions.
|
|
232
|
+
* @returns this (for chaining)
|
|
233
|
+
*/
|
|
234
|
+
link(target) {
|
|
235
|
+
this._pendingLinks.push(new core_1.OdinRecordLinkDto({ id: target.id, entity: target.entity }));
|
|
236
|
+
return this;
|
|
237
|
+
}
|
|
238
|
+
/** Get the currently queued links */
|
|
239
|
+
get pendingLinks() {
|
|
240
|
+
return [...this._pendingLinks];
|
|
241
|
+
}
|
|
242
|
+
/** Clear pending links without executing an action */
|
|
243
|
+
clearPendingLinks() {
|
|
244
|
+
this._pendingLinks = [];
|
|
245
|
+
return this;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Immediately unlink a record (API call).
|
|
249
|
+
* Unlike link(), this executes immediately.
|
|
250
|
+
* @throws Error if called on a new (unsaved) record
|
|
251
|
+
*/
|
|
252
|
+
unlink(target) {
|
|
253
|
+
var _a;
|
|
254
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
255
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
256
|
+
throw new Error('Cannot unlink from a new (unsaved) record');
|
|
257
|
+
const targetId = typeof target === 'string' ? target : target.id;
|
|
258
|
+
yield this._provider._deleteLinks('FieldServiceModule', 'YfWifiSurvey', this._record.id, targetId);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
// ============================================
|
|
262
|
+
// CREATE ACTIONS (no existing record required)
|
|
263
|
+
// ============================================
|
|
264
|
+
/**
|
|
265
|
+
* CreateYfWifiSurvey
|
|
266
|
+
*
|
|
267
|
+
* Creates a new YfWifiSurvey record with the specified properties.
|
|
268
|
+
* Returns an ActionBuilder - call .execute() to create or .dryRun() for debugging.
|
|
269
|
+
*
|
|
270
|
+
* @param properties - The properties for the new record
|
|
271
|
+
* @param options - Optional settings
|
|
272
|
+
* @param options.type - Override the record type
|
|
273
|
+
* @param options.journeyId - Associate with a journey
|
|
274
|
+
* @param options.stageKey - Set initial pipeline stage
|
|
275
|
+
* @returns ActionBuilder - call .execute() to create or .dryRun() for payload
|
|
276
|
+
*
|
|
277
|
+
* @example
|
|
278
|
+
* ```typescript
|
|
279
|
+
* // Create with properties
|
|
280
|
+
* const record = odinClient.yfWifiSurveys.new();
|
|
281
|
+
* await record.createYfWifiSurvey({ ... }).execute();
|
|
282
|
+
*
|
|
283
|
+
* // Dry run (for debugging)
|
|
284
|
+
* const payload = record.createYfWifiSurvey({ ... }).dryRun();
|
|
285
|
+
* ```
|
|
286
|
+
*/
|
|
287
|
+
createYfWifiSurvey(properties, options) {
|
|
288
|
+
var _a, _b;
|
|
289
|
+
const payload = {
|
|
290
|
+
entity: 'FieldServiceModule:YfWifiSurvey',
|
|
291
|
+
type: (_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : (_b = this._record) === null || _b === void 0 ? void 0 : _b.type,
|
|
292
|
+
actionName: 'CreateYfWifiSurvey',
|
|
293
|
+
properties: properties || {},
|
|
294
|
+
associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined,
|
|
295
|
+
journeyId: options === null || options === void 0 ? void 0 : options.journeyId,
|
|
296
|
+
stageKey: options === null || options === void 0 ? void 0 : options.stageKey,
|
|
297
|
+
};
|
|
298
|
+
return new ActionBuilder(this._provider, 'FieldServiceModule', 'YfWifiSurvey', payload, () => { this._pendingLinks = []; });
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
exports.YfWifiSurveyRecord = YfWifiSurveyRecord;
|
|
302
|
+
// ============================================
|
|
303
|
+
// TYPED LINK ACCESSORS
|
|
304
|
+
// ============================================
|
|
305
|
+
/** Valid labels for WorkOrder associations */
|
|
306
|
+
YfWifiSurveyRecord.workOrdersLabels = ['WorkOrder__YfWifiSurvey'];
|
|
307
|
+
/** Valid labels for File associations */
|
|
308
|
+
YfWifiSurveyRecord.filesLabels = ['YfWifiSurvey__File'];
|
|
309
|
+
/** Type guard to check if an object is a YfWifiSurveyRecord */
|
|
310
|
+
function isYfWifiSurveyRecord(obj) {
|
|
311
|
+
return obj instanceof YfWifiSurveyRecord;
|
|
312
|
+
}
|
|
313
|
+
exports.isYfWifiSurveyRecord = isYfWifiSurveyRecord;
|