@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.
Files changed (33) hide show
  1. package/README.md +8 -1
  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/YfWifiSurveyAccessor.d.ts +111 -0
  9. package/dist/accessors-v2/YfWifiSurveyAccessor.js +190 -0
  10. package/dist/accessors-v2/index.d.ts +1 -0
  11. package/dist/accessors-v2/index.js +3 -1
  12. package/dist/actions-v2/CreateAppointmentDto.d.ts +8 -1
  13. package/dist/actions-v2/CreateCustomerDeviceBatteryDto.d.ts +103 -1
  14. package/dist/actions-v2/CreateCustomerDeviceBatteryDto.js +120 -1
  15. package/dist/actions-v2/CreateYfWifiSurveyDto.d.ts +118 -0
  16. package/dist/actions-v2/CreateYfWifiSurveyDto.js +54 -0
  17. package/dist/actions-v2/UpdateCustomerDeviceBatteryDto.d.ts +183 -0
  18. package/dist/actions-v2/UpdateCustomerDeviceBatteryDto.js +179 -0
  19. package/dist/db-accessors-v2/YfWifiSurveyDbAccessor.d.ts +149 -0
  20. package/dist/db-accessors-v2/YfWifiSurveyDbAccessor.js +227 -0
  21. package/dist/db-accessors-v2/index.d.ts +1 -0
  22. package/dist/db-accessors-v2/index.js +3 -1
  23. package/dist/records-v2/CustomerDeviceRecord.d.ts +34 -68
  24. package/dist/records-v2/CustomerDeviceRecord.js +38 -17
  25. package/dist/records-v2/FileRecord.d.ts +20 -0
  26. package/dist/records-v2/FileRecord.js +33 -0
  27. package/dist/records-v2/WorkOrderRecord.d.ts +20 -0
  28. package/dist/records-v2/WorkOrderRecord.js +33 -0
  29. package/dist/records-v2/YfWifiSurveyRecord.d.ts +225 -0
  30. package/dist/records-v2/YfWifiSurveyRecord.js +313 -0
  31. package/dist/records-v2/index.d.ts +1 -0
  32. package/dist/records-v2/index.js +5 -2
  33. package/package.json +1 -1
@@ -12,9 +12,124 @@
12
12
  *
13
13
  * AUTO-GENERATED - DO NOT EDIT DIRECTLY
14
14
  */
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
15
24
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.CreateCustomerDeviceBatteryDto = void 0;
25
+ exports.CreateCustomerDeviceBatteryDto = exports.CreateCustomerDeviceBatteryBuilder = void 0;
17
26
  const core_1 = require("@d19n/odin-types/dist/core");
27
+ /**
28
+ * Builder for CreateCustomerDeviceBattery action
29
+ *
30
+ * Provides fluent API for adding associations before executing the action.
31
+ * Use .link*() methods to add associations, then call .execute() to run.
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * await record.createCustomerDeviceBattery({ ...properties })
36
+ * .linkAssociation_1786439410918({ id: '...', entity: '...' })
37
+ * .execute();
38
+ * ```
39
+ */
40
+ class CreateCustomerDeviceBatteryBuilder {
41
+ constructor(properties, pendingLinks, options) {
42
+ this._associations = [];
43
+ this._properties = properties;
44
+ this._pendingLinks = pendingLinks;
45
+ this._options = options;
46
+ }
47
+ /**
48
+ * Link CustomerDevice__OrderItem
49
+ * @schemaAssociationId 29737305-924f-4e32-9dbc-8aab3de2e777
50
+ * @param target - The record to link
51
+ * @returns this (for method chaining)
52
+ */
53
+ linkAssociation_1786439410918(target) {
54
+ this._associations.push(new core_1.OdinRecordLinkDto({
55
+ id: target.id,
56
+ entity: 'entity' in target ? target.entity : target.entity,
57
+ }));
58
+ return this;
59
+ }
60
+ /**
61
+ * Set an external system identifier for this record.
62
+ * Links the record to a corresponding entry in an external application.
63
+ * @param externalId - The ID in the external system
64
+ * @param externalAppId - The external application identifier
65
+ * @returns this (for chaining)
66
+ */
67
+ withExternalId(externalId, externalAppId) {
68
+ this._externalId = externalId;
69
+ this._externalAppId = externalAppId;
70
+ return this;
71
+ }
72
+ /**
73
+ * Set security/access groups for this record.
74
+ * @param groups - Array of group names
75
+ * @returns this (for chaining)
76
+ */
77
+ withGroups(groups) {
78
+ this._groups = groups;
79
+ return this;
80
+ }
81
+ /**
82
+ * Get the action payload without executing
83
+ * @returns The action data that would be sent
84
+ */
85
+ getData() {
86
+ var _a, _b;
87
+ const allAssociations = [...this._associations, ...this._pendingLinks];
88
+ return Object.assign(Object.assign({ entity: 'ServiceModule:CustomerDevice', type: 'BATTERY', actionName: 'CreateCustomerDeviceBattery', properties: this._properties, associations: allAssociations.length > 0 ? allAssociations : undefined, journeyId: (_a = this._options) === null || _a === void 0 ? void 0 : _a.journeyId, stageKey: (_b = this._options) === null || _b === void 0 ? void 0 : _b.stageKey }, (this._externalId && { externalId: this._externalId, externalAppId: this._externalAppId })), (this._groups && { groups: this._groups }));
89
+ }
90
+ /**
91
+ * Inject execution context (called by record wrapper)
92
+ * @internal
93
+ */
94
+ withProvider(provider, moduleName, entityName, clearPendingLinks) {
95
+ this._provider = provider;
96
+ this._moduleName = moduleName;
97
+ this._entityName = entityName;
98
+ this._clearPendingLinks = clearPendingLinks;
99
+ return this;
100
+ }
101
+ /**
102
+ * Execute the action
103
+ * @returns The result from the API
104
+ * @throws Error if withProvider() has not been called
105
+ */
106
+ execute() {
107
+ var _a;
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ if (!this._provider || !this._moduleName || !this._entityName) {
110
+ throw new Error('Builder not connected to provider. Use the record wrapper API to get an executable builder.');
111
+ }
112
+ const result = yield this._provider._applyAction(this._moduleName, this._entityName, this.getData());
113
+ (_a = this._clearPendingLinks) === null || _a === void 0 ? void 0 : _a.call(this);
114
+ return result;
115
+ });
116
+ }
117
+ /**
118
+ * Returns the request payload without executing (for debugging)
119
+ * @returns The request payload that would be sent to the API
120
+ */
121
+ dryRun() {
122
+ return this.getData();
123
+ }
124
+ /**
125
+ * Prevents accidental `await builder` without .execute()
126
+ * @throws Error always - use .execute() or .dryRun() instead
127
+ */
128
+ then() {
129
+ throw new Error('Builder cannot be awaited directly. Call .execute() to run the action or .dryRun() to get the payload.');
130
+ }
131
+ }
132
+ exports.CreateCustomerDeviceBatteryBuilder = CreateCustomerDeviceBatteryBuilder;
18
133
  /**
19
134
  * CreateCustomerDeviceBattery
20
135
  *
@@ -55,3 +170,7 @@ CreateCustomerDeviceBatteryDto.STEP_SCHEMA_ACTION_ID = 'b339f484-877f-4db5-ac17-
55
170
  CreateCustomerDeviceBatteryDto.STEP_SCHEMA_TYPE_ID = 'bddbd043-c985-4eaf-9202-eb9dbe18c5e3';
56
171
  CreateCustomerDeviceBatteryDto.STEP_TYPE = 'BATTERY';
57
172
  CreateCustomerDeviceBatteryDto.AUTO_LINK_PARENT = true;
173
+ CreateCustomerDeviceBatteryDto.HAS_ASSOCIATIONS = true;
174
+ CreateCustomerDeviceBatteryDto.HAS_REQUIRED_ASSOCIATIONS = false;
175
+ CreateCustomerDeviceBatteryDto.BUILDER_CLASS = 'CreateCustomerDeviceBatteryBuilder';
176
+ CreateCustomerDeviceBatteryDto.ASSOCIATION_FIELDS = [{ "name": "Association_1786439410918", "methodName": "linkAssociation_1786439410918", "required": false, "schemaAssociationId": "29737305-924f-4e32-9dbc-8aab3de2e777" }];
@@ -0,0 +1,118 @@
1
+ /**
2
+ * CreateYfWifiSurvey Action DTO
3
+ *
4
+ * Create (or upsert by WorkOrderId) the WiFi survey for a work order
5
+ *
6
+ * @module FieldServiceModule
7
+ * @entity YfWifiSurvey
8
+ * @actionKey CreateYfWifiSurvey
9
+ * @event k1.t-hEOJjsDb.FieldServiceModule.YfWifiSurvey.Create.CreateYfWifiSurvey
10
+ *
11
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
12
+ */
13
+ import { OdinRecordCreateDto, OdinRecordCreatedEvent } from '@d19n/odin-types/dist/core';
14
+ /**
15
+ * RabbitMQ message payload for CreateYfWifiSurvey created events
16
+ *
17
+ * @event k1.t-hEOJjsDb.FieldServiceModule.YfWifiSurvey.Create.CreateYfWifiSurvey
18
+ */
19
+ export interface CreateYfWifiSurveyMessage extends OdinRecordCreatedEvent<CreateYfWifiSurveyDto, CreateYfWifiSurveyProperties> {
20
+ }
21
+ /**
22
+ * Properties for CreateYfWifiSurvey action
23
+ *
24
+ * @property Required fields: 2
25
+ * @property Optional fields: 6
26
+ */
27
+ export interface CreateYfWifiSurveyProperties {
28
+ /**
29
+ * Work Order Id
30
+ *
31
+ * The work order uuid. UNIQUE, so with upsertOnCreate a resubmit for the same work order updates the existing survey instead of creating a duplicate.
32
+ * @type {TEXT}
33
+ * @required
34
+ */
35
+ WorkOrderId: string;
36
+ /**
37
+ * Measurement Source
38
+ *
39
+ * How the readings were measured: DEVICE (Android RSSI), GATEWAY (iOS router probe) or NONE (survey refused).
40
+ * @type {ENUM}
41
+ * @required
42
+ */
43
+ Source: string;
44
+ /**
45
+ * Customer Consent
46
+ *
47
+ * False means the customer refused the survey — the record still exists so the refusal is auditable on the work order, with Source=NONE, LocationCount=0 and no Readings.
48
+ * @type {BOOLEAN}
49
+ */
50
+ CustomerConsentGiven?: boolean | null;
51
+ /**
52
+ * SSID
53
+ *
54
+ * Network name the readings were taken on. Nullable: Android redacts it before the location permission grant, and a refused survey has none.
55
+ * @type {TEXT}
56
+ */
57
+ Ssid?: string | null;
58
+ /**
59
+ * Tested At
60
+ *
61
+ * When the survey finished (or the refusal was recorded). Refreshed on resubmit.
62
+ * @type {DATE_TIME}
63
+ */
64
+ TestedAt?: string | null;
65
+ /**
66
+ * Location Count
67
+ *
68
+ * Number of locations recorded in Readings. 0 on a refused survey.
69
+ * @type {NUMBER}
70
+ */
71
+ LocationCount?: number | null;
72
+ /**
73
+ * Payload Schema Version
74
+ *
75
+ * Queryable mirror of Readings.schemaVersion, so consumers can filter by contract version without parsing JSON.
76
+ * @type {NUMBER}
77
+ */
78
+ PayloadSchemaVersion?: number | null;
79
+ /**
80
+ * Readings JSON
81
+ *
82
+ * Full survey payload: floors, locations, positions and per-location measurements with raw sample series. Contract v1 lives in spec 2026-08-07-wifi-survey-fields.ts. Null on a refused survey.
83
+ * @type {JSON}
84
+ */
85
+ Readings?: string | null;
86
+ }
87
+ /**
88
+ * Create WiFi Survey
89
+ *
90
+ * Create (or upsert by WorkOrderId) the WiFi survey for a work order
91
+ *
92
+ * @actionType CREATE - Creates a new YfWifiSurvey record
93
+ * @module FieldServiceModule
94
+ * @entity YfWifiSurvey
95
+ * @event k1.t-hEOJjsDb.FieldServiceModule.YfWifiSurvey.Create.CreateYfWifiSurvey
96
+ * @permission schema.action.createyfwifisurvey.trigger
97
+ * @benchmark This action is tracked for performance benchmarks
98
+ */
99
+ export declare class CreateYfWifiSurveyDto extends OdinRecordCreateDto<CreateYfWifiSurveyProperties> {
100
+ /** Used by SDK generators to identify action type */
101
+ static readonly ACTION_TYPE = "CREATE";
102
+ static readonly ACTION_KEY = "CreateYfWifiSurvey";
103
+ static readonly MODULE_NAME = "FieldServiceModule";
104
+ static readonly ENTITIES: string[];
105
+ static readonly EVENT_NAME = "k1.t-hEOJjsDb.FieldServiceModule.YfWifiSurvey.Create.CreateYfWifiSurvey";
106
+ static readonly PERMISSION = "schema.action.createyfwifisurvey.trigger";
107
+ /** Step metadata - entity this action targets */
108
+ static readonly STEP_ENTITY = "FieldServiceModule:YfWifiSurvey";
109
+ static readonly STEP_SCHEMA_ID = "b50b088f-a1d2-4f66-83b5-7e2a7638dc9d";
110
+ static readonly STEP_SCHEMA_ACTION_ID = "cdcab202-5fa3-4219-b162-f8232e064a6b";
111
+ static readonly AUTO_LINK_PARENT = true;
112
+ readonly actionName: string;
113
+ readonly schemaActionId: string;
114
+ readonly entity: string;
115
+ constructor(properties: CreateYfWifiSurveyProperties, options?: {
116
+ journeyId?: string;
117
+ });
118
+ }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ /**
3
+ * CreateYfWifiSurvey Action DTO
4
+ *
5
+ * Create (or upsert by WorkOrderId) the WiFi survey for a work order
6
+ *
7
+ * @module FieldServiceModule
8
+ * @entity YfWifiSurvey
9
+ * @actionKey CreateYfWifiSurvey
10
+ * @event k1.t-hEOJjsDb.FieldServiceModule.YfWifiSurvey.Create.CreateYfWifiSurvey
11
+ *
12
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.CreateYfWifiSurveyDto = void 0;
16
+ const core_1 = require("@d19n/odin-types/dist/core");
17
+ /**
18
+ * Create WiFi Survey
19
+ *
20
+ * Create (or upsert by WorkOrderId) the WiFi survey for a work order
21
+ *
22
+ * @actionType CREATE - Creates a new YfWifiSurvey record
23
+ * @module FieldServiceModule
24
+ * @entity YfWifiSurvey
25
+ * @event k1.t-hEOJjsDb.FieldServiceModule.YfWifiSurvey.Create.CreateYfWifiSurvey
26
+ * @permission schema.action.createyfwifisurvey.trigger
27
+ * @benchmark This action is tracked for performance benchmarks
28
+ */
29
+ class CreateYfWifiSurveyDto extends core_1.OdinRecordCreateDto {
30
+ constructor(properties, options) {
31
+ super({
32
+ entity: 'FieldServiceModule:YfWifiSurvey',
33
+ type: undefined,
34
+ properties,
35
+ journeyId: options === null || options === void 0 ? void 0 : options.journeyId,
36
+ });
37
+ this.actionName = 'CreateYfWifiSurvey';
38
+ this.schemaActionId = 'cdcab202-5fa3-4219-b162-f8232e064a6b';
39
+ this.entity = 'FieldServiceModule:YfWifiSurvey';
40
+ }
41
+ }
42
+ exports.CreateYfWifiSurveyDto = CreateYfWifiSurveyDto;
43
+ /** Used by SDK generators to identify action type */
44
+ CreateYfWifiSurveyDto.ACTION_TYPE = 'CREATE';
45
+ CreateYfWifiSurveyDto.ACTION_KEY = 'CreateYfWifiSurvey';
46
+ CreateYfWifiSurveyDto.MODULE_NAME = 'FieldServiceModule';
47
+ CreateYfWifiSurveyDto.ENTITIES = ['YfWifiSurvey'];
48
+ CreateYfWifiSurveyDto.EVENT_NAME = 'k1.t-hEOJjsDb.FieldServiceModule.YfWifiSurvey.Create.CreateYfWifiSurvey';
49
+ CreateYfWifiSurveyDto.PERMISSION = 'schema.action.createyfwifisurvey.trigger';
50
+ /** Step metadata - entity this action targets */
51
+ CreateYfWifiSurveyDto.STEP_ENTITY = 'FieldServiceModule:YfWifiSurvey';
52
+ CreateYfWifiSurveyDto.STEP_SCHEMA_ID = 'b50b088f-a1d2-4f66-83b5-7e2a7638dc9d';
53
+ CreateYfWifiSurveyDto.STEP_SCHEMA_ACTION_ID = 'cdcab202-5fa3-4219-b162-f8232e064a6b';
54
+ CreateYfWifiSurveyDto.AUTO_LINK_PARENT = true;
@@ -0,0 +1,183 @@
1
+ /**
2
+ * UpdateCustomerDeviceBattery Action DTO
3
+ *
4
+ * UpdateCustomerDeviceBattery
5
+ *
6
+ * @module ServiceModule
7
+ * @entity CustomerDevice
8
+ * @entityType BATTERY
9
+ * @actionKey UpdateCustomerDeviceBattery
10
+ * @event k1.t-hEOJjsDb.ServiceModule.CustomerDevice.Update.UpdateCustomerDeviceBattery
11
+ *
12
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
13
+ */
14
+ import { OdinRecord, OdinRecordUpdateDto, OdinRecordUpdatedEvent, OdinRecordLinkDto } from '@d19n/odin-types/dist/core';
15
+ /**
16
+ * RabbitMQ message payload for UpdateCustomerDeviceBattery updated events
17
+ *
18
+ * @event k1.t-hEOJjsDb.ServiceModule.CustomerDevice.Update.UpdateCustomerDeviceBattery
19
+ */
20
+ export interface UpdateCustomerDeviceBatteryMessage extends OdinRecordUpdatedEvent<UpdateCustomerDeviceBatteryDto, UpdateCustomerDeviceBatteryProperties> {
21
+ }
22
+ /**
23
+ * Properties for UpdateCustomerDeviceBattery action
24
+ *
25
+ * @property Required fields: 0
26
+ * @property Optional fields: 1
27
+ */
28
+ export interface UpdateCustomerDeviceBatteryProperties {
29
+ /**
30
+ * Serial Number
31
+ *
32
+ * Serial Number
33
+ * @type {TEXT}
34
+ */
35
+ SerialNumber?: string | null;
36
+ }
37
+ /**
38
+ * Builder for UpdateCustomerDeviceBattery action
39
+ *
40
+ * Provides fluent API for adding associations before executing the action.
41
+ * Use .link*() methods to add associations, then call .execute() to run.
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * await record.updateCustomerDeviceBattery({ ...properties })
46
+ * .linkAssociation_1786439643569({ id: '...', entity: '...' })
47
+ * .execute();
48
+ * ```
49
+ */
50
+ export declare class UpdateCustomerDeviceBatteryBuilder {
51
+ private _associations;
52
+ private _properties;
53
+ private _pendingLinks;
54
+ private _options?;
55
+ private _record;
56
+ private _provider?;
57
+ private _moduleName?;
58
+ private _entityName?;
59
+ private _clearPendingLinks?;
60
+ private _externalId?;
61
+ private _externalAppId?;
62
+ private _groups?;
63
+ constructor(record: {
64
+ id: string;
65
+ entity: string;
66
+ type?: string;
67
+ }, properties: UpdateCustomerDeviceBatteryProperties, pendingLinks: OdinRecordLinkDto[], options?: {
68
+ journeyId?: string;
69
+ stageKey?: string;
70
+ });
71
+ /**
72
+ * Link CustomerDevice__OrderItem
73
+ * @schemaAssociationId 29737305-924f-4e32-9dbc-8aab3de2e777
74
+ * @param target - The record to link
75
+ * @returns this (for method chaining)
76
+ */
77
+ linkAssociation_1786439643569(target: OdinRecord<any> | {
78
+ id: string;
79
+ entity: string;
80
+ }): this;
81
+ /**
82
+ * Set an external system identifier for this record.
83
+ * Links the record to a corresponding entry in an external application.
84
+ * @param externalId - The ID in the external system
85
+ * @param externalAppId - The external application identifier
86
+ * @returns this (for chaining)
87
+ */
88
+ withExternalId(externalId: string, externalAppId: string): this;
89
+ /**
90
+ * Set security/access groups for this record.
91
+ * @param groups - Array of group names
92
+ * @returns this (for chaining)
93
+ */
94
+ withGroups(groups: string[]): this;
95
+ /**
96
+ * Get the action payload without executing
97
+ * @returns The action data that would be sent
98
+ */
99
+ getData(): {
100
+ id: string;
101
+ entity: string;
102
+ type?: string;
103
+ actionName: string;
104
+ properties: UpdateCustomerDeviceBatteryProperties;
105
+ associations?: OdinRecordLinkDto[];
106
+ journeyId?: string;
107
+ stageKey?: string;
108
+ externalId?: string;
109
+ externalAppId?: string;
110
+ groups?: string[];
111
+ };
112
+ /**
113
+ * Inject execution context (called by record wrapper)
114
+ * @internal
115
+ */
116
+ withProvider(provider: {
117
+ _applyAction(moduleName: string, entityName: string, payload: any): Promise<any>;
118
+ }, moduleName: string, entityName: string, clearPendingLinks: () => void): this;
119
+ /**
120
+ * Execute the action
121
+ * @returns The result from the API
122
+ * @throws Error if withProvider() has not been called
123
+ */
124
+ execute(): Promise<any>;
125
+ /**
126
+ * Returns the request payload without executing (for debugging)
127
+ * @returns The request payload that would be sent to the API
128
+ */
129
+ dryRun(): Record<string, any>;
130
+ /**
131
+ * Prevents accidental `await builder` without .execute()
132
+ * @throws Error always - use .execute() or .dryRun() instead
133
+ */
134
+ then(): never;
135
+ }
136
+ /**
137
+ * UpdateCustomerDeviceBattery
138
+ *
139
+ * @actionType UPDATE - Updates an existing CustomerDevice record
140
+ * @module ServiceModule
141
+ * @entity CustomerDevice
142
+ * @entityType BATTERY (Battery Backup)
143
+ * @event k1.t-hEOJjsDb.ServiceModule.CustomerDevice.Update.UpdateCustomerDeviceBattery
144
+ * @permission schema.action.updatecustomerdevicebattery.trigger
145
+ * @benchmark This action is tracked for performance benchmarks
146
+ */
147
+ export declare class UpdateCustomerDeviceBatteryDto extends OdinRecordUpdateDto<UpdateCustomerDeviceBatteryProperties> {
148
+ /** Used by SDK generators to identify action type */
149
+ static readonly ACTION_TYPE = "UPDATE";
150
+ static readonly ACTION_KEY = "UpdateCustomerDeviceBattery";
151
+ static readonly MODULE_NAME = "ServiceModule";
152
+ static readonly ENTITIES: string[];
153
+ static readonly ENTITY_TYPE = "BATTERY";
154
+ static readonly EVENT_NAME = "k1.t-hEOJjsDb.ServiceModule.CustomerDevice.Update.UpdateCustomerDeviceBattery";
155
+ static readonly PERMISSION = "schema.action.updatecustomerdevicebattery.trigger";
156
+ /** Step metadata - entity this action targets */
157
+ static readonly STEP_ENTITY = "ServiceModule:CustomerDevice";
158
+ static readonly STEP_SCHEMA_ID = "a72ffce5-0294-4038-8fb1-45fad5e4e473";
159
+ static readonly STEP_SCHEMA_ACTION_ID = "558ed6c2-7162-4131-9508-fdd7932f2b63";
160
+ static readonly STEP_SCHEMA_TYPE_ID = "bddbd043-c985-4eaf-9202-eb9dbe18c5e3";
161
+ static readonly STEP_TYPE = "BATTERY";
162
+ static readonly AUTO_LINK_PARENT = false;
163
+ static readonly HAS_ASSOCIATIONS = true;
164
+ static readonly HAS_REQUIRED_ASSOCIATIONS = false;
165
+ static readonly BUILDER_CLASS = "UpdateCustomerDeviceBatteryBuilder";
166
+ static readonly ASSOCIATION_FIELDS: readonly [{
167
+ readonly name: "Association_1786439643569";
168
+ readonly methodName: "linkAssociation_1786439643569";
169
+ readonly required: false;
170
+ readonly schemaAssociationId: "29737305-924f-4e32-9dbc-8aab3de2e777";
171
+ }];
172
+ readonly actionName: string;
173
+ readonly schemaActionId: string;
174
+ readonly entity: string;
175
+ constructor(record: OdinRecord<any> | {
176
+ id: string;
177
+ entity: string;
178
+ type?: string;
179
+ }, properties: UpdateCustomerDeviceBatteryProperties, options?: {
180
+ journeyId?: string;
181
+ stageKey?: string;
182
+ });
183
+ }
@@ -0,0 +1,179 @@
1
+ "use strict";
2
+ /**
3
+ * UpdateCustomerDeviceBattery Action DTO
4
+ *
5
+ * UpdateCustomerDeviceBattery
6
+ *
7
+ * @module ServiceModule
8
+ * @entity CustomerDevice
9
+ * @entityType BATTERY
10
+ * @actionKey UpdateCustomerDeviceBattery
11
+ * @event k1.t-hEOJjsDb.ServiceModule.CustomerDevice.Update.UpdateCustomerDeviceBattery
12
+ *
13
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
14
+ */
15
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
17
+ return new (P || (P = Promise))(function (resolve, reject) {
18
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
19
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
20
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
21
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
22
+ });
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.UpdateCustomerDeviceBatteryDto = exports.UpdateCustomerDeviceBatteryBuilder = void 0;
26
+ const core_1 = require("@d19n/odin-types/dist/core");
27
+ /**
28
+ * Builder for UpdateCustomerDeviceBattery action
29
+ *
30
+ * Provides fluent API for adding associations before executing the action.
31
+ * Use .link*() methods to add associations, then call .execute() to run.
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * await record.updateCustomerDeviceBattery({ ...properties })
36
+ * .linkAssociation_1786439643569({ id: '...', entity: '...' })
37
+ * .execute();
38
+ * ```
39
+ */
40
+ class UpdateCustomerDeviceBatteryBuilder {
41
+ constructor(record, properties, pendingLinks, options) {
42
+ this._associations = [];
43
+ this._record = record;
44
+ this._properties = properties;
45
+ this._pendingLinks = pendingLinks;
46
+ this._options = options;
47
+ }
48
+ /**
49
+ * Link CustomerDevice__OrderItem
50
+ * @schemaAssociationId 29737305-924f-4e32-9dbc-8aab3de2e777
51
+ * @param target - The record to link
52
+ * @returns this (for method chaining)
53
+ */
54
+ linkAssociation_1786439643569(target) {
55
+ this._associations.push(new core_1.OdinRecordLinkDto({
56
+ id: target.id,
57
+ entity: 'entity' in target ? target.entity : target.entity,
58
+ }));
59
+ return this;
60
+ }
61
+ /**
62
+ * Set an external system identifier for this record.
63
+ * Links the record to a corresponding entry in an external application.
64
+ * @param externalId - The ID in the external system
65
+ * @param externalAppId - The external application identifier
66
+ * @returns this (for chaining)
67
+ */
68
+ withExternalId(externalId, externalAppId) {
69
+ this._externalId = externalId;
70
+ this._externalAppId = externalAppId;
71
+ return this;
72
+ }
73
+ /**
74
+ * Set security/access groups for this record.
75
+ * @param groups - Array of group names
76
+ * @returns this (for chaining)
77
+ */
78
+ withGroups(groups) {
79
+ this._groups = groups;
80
+ return this;
81
+ }
82
+ /**
83
+ * Get the action payload without executing
84
+ * @returns The action data that would be sent
85
+ */
86
+ getData() {
87
+ var _a, _b;
88
+ const allAssociations = [...this._associations, ...this._pendingLinks];
89
+ return Object.assign(Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'UpdateCustomerDeviceBattery', properties: this._properties, associations: allAssociations.length > 0 ? allAssociations : undefined, journeyId: (_a = this._options) === null || _a === void 0 ? void 0 : _a.journeyId, stageKey: (_b = this._options) === null || _b === void 0 ? void 0 : _b.stageKey }, (this._externalId && { externalId: this._externalId, externalAppId: this._externalAppId })), (this._groups && { groups: this._groups }));
90
+ }
91
+ /**
92
+ * Inject execution context (called by record wrapper)
93
+ * @internal
94
+ */
95
+ withProvider(provider, moduleName, entityName, clearPendingLinks) {
96
+ this._provider = provider;
97
+ this._moduleName = moduleName;
98
+ this._entityName = entityName;
99
+ this._clearPendingLinks = clearPendingLinks;
100
+ return this;
101
+ }
102
+ /**
103
+ * Execute the action
104
+ * @returns The result from the API
105
+ * @throws Error if withProvider() has not been called
106
+ */
107
+ execute() {
108
+ var _a;
109
+ return __awaiter(this, void 0, void 0, function* () {
110
+ if (!this._provider || !this._moduleName || !this._entityName) {
111
+ throw new Error('Builder not connected to provider. Use the record wrapper API to get an executable builder.');
112
+ }
113
+ const result = yield this._provider._applyAction(this._moduleName, this._entityName, this.getData());
114
+ (_a = this._clearPendingLinks) === null || _a === void 0 ? void 0 : _a.call(this);
115
+ return result;
116
+ });
117
+ }
118
+ /**
119
+ * Returns the request payload without executing (for debugging)
120
+ * @returns The request payload that would be sent to the API
121
+ */
122
+ dryRun() {
123
+ return this.getData();
124
+ }
125
+ /**
126
+ * Prevents accidental `await builder` without .execute()
127
+ * @throws Error always - use .execute() or .dryRun() instead
128
+ */
129
+ then() {
130
+ throw new Error('Builder cannot be awaited directly. Call .execute() to run the action or .dryRun() to get the payload.');
131
+ }
132
+ }
133
+ exports.UpdateCustomerDeviceBatteryBuilder = UpdateCustomerDeviceBatteryBuilder;
134
+ /**
135
+ * UpdateCustomerDeviceBattery
136
+ *
137
+ * @actionType UPDATE - Updates an existing CustomerDevice record
138
+ * @module ServiceModule
139
+ * @entity CustomerDevice
140
+ * @entityType BATTERY (Battery Backup)
141
+ * @event k1.t-hEOJjsDb.ServiceModule.CustomerDevice.Update.UpdateCustomerDeviceBattery
142
+ * @permission schema.action.updatecustomerdevicebattery.trigger
143
+ * @benchmark This action is tracked for performance benchmarks
144
+ */
145
+ class UpdateCustomerDeviceBatteryDto extends core_1.OdinRecordUpdateDto {
146
+ constructor(record, properties, options) {
147
+ super({
148
+ id: record.id,
149
+ entity: record.entity,
150
+ type: record.type,
151
+ properties,
152
+ journeyId: options === null || options === void 0 ? void 0 : options.journeyId,
153
+ stageKey: options === null || options === void 0 ? void 0 : options.stageKey,
154
+ });
155
+ this.actionName = 'UpdateCustomerDeviceBattery';
156
+ this.schemaActionId = '558ed6c2-7162-4131-9508-fdd7932f2b63';
157
+ this.entity = 'ServiceModule:CustomerDevice';
158
+ }
159
+ }
160
+ exports.UpdateCustomerDeviceBatteryDto = UpdateCustomerDeviceBatteryDto;
161
+ /** Used by SDK generators to identify action type */
162
+ UpdateCustomerDeviceBatteryDto.ACTION_TYPE = 'UPDATE';
163
+ UpdateCustomerDeviceBatteryDto.ACTION_KEY = 'UpdateCustomerDeviceBattery';
164
+ UpdateCustomerDeviceBatteryDto.MODULE_NAME = 'ServiceModule';
165
+ UpdateCustomerDeviceBatteryDto.ENTITIES = ['CustomerDevice'];
166
+ UpdateCustomerDeviceBatteryDto.ENTITY_TYPE = 'BATTERY';
167
+ UpdateCustomerDeviceBatteryDto.EVENT_NAME = 'k1.t-hEOJjsDb.ServiceModule.CustomerDevice.Update.UpdateCustomerDeviceBattery';
168
+ UpdateCustomerDeviceBatteryDto.PERMISSION = 'schema.action.updatecustomerdevicebattery.trigger';
169
+ /** Step metadata - entity this action targets */
170
+ UpdateCustomerDeviceBatteryDto.STEP_ENTITY = 'ServiceModule:CustomerDevice';
171
+ UpdateCustomerDeviceBatteryDto.STEP_SCHEMA_ID = 'a72ffce5-0294-4038-8fb1-45fad5e4e473';
172
+ UpdateCustomerDeviceBatteryDto.STEP_SCHEMA_ACTION_ID = '558ed6c2-7162-4131-9508-fdd7932f2b63';
173
+ UpdateCustomerDeviceBatteryDto.STEP_SCHEMA_TYPE_ID = 'bddbd043-c985-4eaf-9202-eb9dbe18c5e3';
174
+ UpdateCustomerDeviceBatteryDto.STEP_TYPE = 'BATTERY';
175
+ UpdateCustomerDeviceBatteryDto.AUTO_LINK_PARENT = false;
176
+ UpdateCustomerDeviceBatteryDto.HAS_ASSOCIATIONS = true;
177
+ UpdateCustomerDeviceBatteryDto.HAS_REQUIRED_ASSOCIATIONS = false;
178
+ UpdateCustomerDeviceBatteryDto.BUILDER_CLASS = 'UpdateCustomerDeviceBatteryBuilder';
179
+ UpdateCustomerDeviceBatteryDto.ASSOCIATION_FIELDS = [{ "name": "Association_1786439643569", "methodName": "linkAssociation_1786439643569", "required": false, "schemaAssociationId": "29737305-924f-4e32-9dbc-8aab3de2e777" }];