een-api-toolkit 0.3.63 → 0.3.69

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 (34) hide show
  1. package/CHANGELOG.md +68 -86
  2. package/dist/index.cjs +3 -3
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.ts +68 -0
  5. package/dist/index.js +136 -118
  6. package/dist/index.js.map +1 -1
  7. package/docs/AI-CONTEXT.md +1 -1
  8. package/docs/ai-reference/AI-AUTH.md +1 -1
  9. package/docs/ai-reference/AI-AUTOMATIONS.md +1 -1
  10. package/docs/ai-reference/AI-DEVICES.md +1 -1
  11. package/docs/ai-reference/AI-EVENT-DATA-SCHEMAS.md +76 -74
  12. package/docs/ai-reference/AI-EVENTS.md +2 -1
  13. package/docs/ai-reference/AI-GROUPING.md +1 -1
  14. package/docs/ai-reference/AI-JOBS.md +1 -1
  15. package/docs/ai-reference/AI-MEDIA.md +1 -1
  16. package/docs/ai-reference/AI-SETUP.md +1 -1
  17. package/docs/ai-reference/AI-USERS.md +1 -1
  18. package/examples/vue-alerts-metrics/README.md +10 -0
  19. package/examples/vue-automations/README.md +4 -0
  20. package/examples/vue-bridges/README.md +6 -0
  21. package/examples/vue-cameras/README.md +7 -0
  22. package/examples/vue-event-subscriptions/README.md +10 -0
  23. package/examples/vue-events/README.md +12 -0
  24. package/examples/vue-events/src/components/EventsModal.vue +1 -0
  25. package/examples/vue-feeds/README.md +5 -0
  26. package/examples/vue-feeds/src/App.vue +5 -4
  27. package/examples/vue-feeds/src/views/Home.vue +3 -1
  28. package/examples/vue-jobs/README.md +7 -0
  29. package/examples/vue-layouts/README.md +3 -1
  30. package/examples/vue-media/README.md +5 -0
  31. package/examples/vue-users/README.md +3 -0
  32. package/examples/vue-users/package-lock.json +2 -2
  33. package/examples/vue-users/package.json +1 -1
  34. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -3028,6 +3028,36 @@ export declare interface GetCameraSettingsParams {
3028
3028
  include?: CameraSettingsInclude[];
3029
3029
  }
3030
3030
 
3031
+ /**
3032
+ * Extract the status string from a Camera's status field.
3033
+ *
3034
+ * @remarks
3035
+ * The EEN API may return camera status as either:
3036
+ * - A string directly: `"online"`
3037
+ * - An object with connectionStatus: `{ connectionStatus: "online" }`
3038
+ *
3039
+ * This depends on the `include` parameters used in the API request.
3040
+ * This utility safely extracts the status string from either format.
3041
+ *
3042
+ * @param status - The camera status field value
3043
+ * @returns The status string, or undefined if no status is present
3044
+ *
3045
+ * @example
3046
+ * ```typescript
3047
+ * import { getCameraStatusString, type Camera } from 'een-api-toolkit'
3048
+ *
3049
+ * function displayCameraStatus(camera: Camera) {
3050
+ * const status = getCameraStatusString(camera.status)
3051
+ * console.log(`Camera ${camera.name} is ${status || 'unknown'}`)
3052
+ * }
3053
+ * ```
3054
+ *
3055
+ * @category Utilities
3056
+ */
3057
+ export declare function getCameraStatusString(status?: CameraStatus | {
3058
+ connectionStatus?: CameraStatus;
3059
+ }): CameraStatus | undefined;
3060
+
3031
3061
  /**
3032
3062
  * Get the client ID
3033
3063
  */
@@ -4155,6 +4185,44 @@ export declare function initEenToolkit(options?: EenToolkitConfig): void;
4155
4185
  */
4156
4186
  export declare function initMediaSession(): Promise<Result<MediaSessionResult>>;
4157
4187
 
4188
+ /**
4189
+ * TypeScript type guard to check if a status value is an object with connectionStatus.
4190
+ *
4191
+ * @remarks
4192
+ * Use this type guard to help TypeScript narrow the camera status type when
4193
+ * you need to handle both string and object formats differently.
4194
+ *
4195
+ * **Implementation Note:** This function returns true for ANY non-null object to match
4196
+ * the EEN API's flexible response format. The API may return different object structures
4197
+ * depending on the `include` parameters, so we intentionally use a broad check rather than
4198
+ * validating specific properties like `'connectionStatus' in status`.
4199
+ *
4200
+ * @param status - The camera status field value
4201
+ * @returns True if status is an object (not a string), false otherwise
4202
+ *
4203
+ * @example
4204
+ * ```typescript
4205
+ * import { isStatusObject, type Camera } from 'een-api-toolkit'
4206
+ *
4207
+ * function processCameraStatus(camera: Camera) {
4208
+ * if (isStatusObject(camera.status)) {
4209
+ * // TypeScript knows camera.status is { connectionStatus?: CameraStatus }
4210
+ * console.log('Status object:', camera.status.connectionStatus)
4211
+ * } else {
4212
+ * // TypeScript knows camera.status is CameraStatus | undefined
4213
+ * console.log('Status string:', camera.status)
4214
+ * }
4215
+ * }
4216
+ * ```
4217
+ *
4218
+ * @category Utilities
4219
+ */
4220
+ export declare function isStatusObject(status?: CameraStatus | {
4221
+ connectionStatus?: CameraStatus;
4222
+ }): status is {
4223
+ connectionStatus?: CameraStatus;
4224
+ };
4225
+
4158
4226
  /**
4159
4227
  * Job entity from EEN API v3.0.
4160
4228
  *