@optifye/dashboard-core 6.10.52 → 6.10.53

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/dist/index.d.mts CHANGED
@@ -1298,6 +1298,7 @@ interface S3ListObjectsParams {
1298
1298
  interface VideoMetadata {
1299
1299
  camera_id?: string;
1300
1300
  workspace_id?: string;
1301
+ cycle_time?: number;
1301
1302
  sop_name?: string;
1302
1303
  violation_start_frame?: number;
1303
1304
  violation_end_frame?: number;
package/dist/index.d.ts CHANGED
@@ -1298,6 +1298,7 @@ interface S3ListObjectsParams {
1298
1298
  interface VideoMetadata {
1299
1299
  camera_id?: string;
1300
1300
  workspace_id?: string;
1301
+ cycle_time?: number;
1301
1302
  sop_name?: string;
1302
1303
  violation_start_frame?: number;
1303
1304
  violation_end_frame?: number;
package/dist/index.js CHANGED
@@ -5590,6 +5590,25 @@ var CLIP_COUNTS_CACHE_TTL = 30 * 1e3;
5590
5590
  var CLIP_BY_ID_CACHE_TTL = 2 * 60 * 1e3;
5591
5591
  var CLIP_BY_ID_CACHE_MAX = 200;
5592
5592
  var CLIPS_INIT_CACHE_TTL = 30 * 1e3;
5593
+ var parseFiniteNumber = (value) => {
5594
+ if (typeof value === "number" && Number.isFinite(value)) {
5595
+ return value;
5596
+ }
5597
+ if (typeof value === "string" && value.trim().length > 0) {
5598
+ const parsed = Number(value);
5599
+ if (Number.isFinite(parsed)) {
5600
+ return parsed;
5601
+ }
5602
+ }
5603
+ return void 0;
5604
+ };
5605
+ var getClipCycleTimeFrames = (metadata) => {
5606
+ const flattenedCycleTime = parseFiniteNumber(metadata?.cycle_time);
5607
+ if (flattenedCycleTime !== void 0) {
5608
+ return flattenedCycleTime;
5609
+ }
5610
+ return parseFiniteNumber(metadata?.request?.metadata?.cycle_time);
5611
+ };
5593
5612
  var getSupabaseClient = () => {
5594
5613
  const existing = _getSupabaseInstanceOptional();
5595
5614
  if (existing) {
@@ -6099,20 +6118,31 @@ var S3ClipsSupabaseService = class {
6099
6118
  limit
6100
6119
  });
6101
6120
  console.log(`[S3ClipsSupabase] Fetched ${response.clips?.length || 0} ${type} clips`);
6102
- const transformedClips = (response.clips || []).map((clip) => ({
6103
- id: clip.clip_id,
6104
- src: clip.playlist,
6105
- // Raw playlist content
6106
- timestamp: clip.timestamp,
6107
- // Use pre-formatted timestamp from API (already in 12-hour format with seconds)
6108
- severity: this.getSeverityFromClipType(clip.clip_type_name),
6109
- description: this.getDescriptionFromClipType(clip.clip_type_name),
6110
- type: clip.clip_type_name,
6111
- originalUri: `clips:${clip.clip_id}`,
6112
- cycle_time_seconds: clip.metadata?.request?.metadata?.cycle_time ? clip.metadata.request.metadata.cycle_time / (clip.metadata?.playlist?.fps || 20) : void 0,
6113
- creation_timestamp: clip.created_at,
6114
- percentile: clip.cycle_time_percentile || clip.idle_time_percentile
6115
- }));
6121
+ const transformedClips = (response.clips || []).map((clip) => {
6122
+ const clipId = clip.id ?? clip.clip_id;
6123
+ const clipType = clip.type ?? clip.clip_type_name;
6124
+ const cycleTimeSeconds = parseFiniteNumber(clip.cycle_time_seconds) ?? (() => {
6125
+ const cycleTimeFrames = getClipCycleTimeFrames(clip.metadata);
6126
+ return cycleTimeFrames !== void 0 ? cycleTimeFrames / (clip.metadata?.playlist?.fps || 20) : void 0;
6127
+ })();
6128
+ return {
6129
+ id: clipId,
6130
+ src: clip.src ?? clip.playlist,
6131
+ // Current API returns src; keep playlist fallback for legacy responses
6132
+ timestamp: clip.timestamp,
6133
+ // Use pre-formatted timestamp from API (already in 12-hour format with seconds)
6134
+ severity: clip.severity ?? this.getSeverityFromClipType(clipType),
6135
+ description: clip.description ?? this.getDescriptionFromClipType(clipType),
6136
+ type: clipType,
6137
+ originalUri: clip.originalUri ?? `clips:${clipId}`,
6138
+ cycle_time_seconds: cycleTimeSeconds,
6139
+ creation_timestamp: clip.creation_timestamp ?? clip.created_at,
6140
+ percentile: clip.percentile ?? clip.cycle_time_percentile ?? clip.idle_time_percentile,
6141
+ duration: clip.duration,
6142
+ idle_start_time: clip.idle_start_time,
6143
+ idle_end_time: clip.idle_end_time
6144
+ };
6145
+ });
6116
6146
  return {
6117
6147
  clips: transformedClips,
6118
6148
  total: response.total || transformedClips.length,
@@ -6142,10 +6172,13 @@ var S3ClipsSupabaseService = class {
6142
6172
  */
6143
6173
  getSeverityFromClipType(clipType) {
6144
6174
  switch (clipType) {
6175
+ case "long_cycle_time":
6176
+ case "worst_cycle_time":
6145
6177
  case "sop_deviations":
6146
6178
  return "high";
6147
6179
  case "idle_time":
6148
6180
  return "medium";
6181
+ case "best_cycle_time":
6149
6182
  case "cycle_completion":
6150
6183
  default:
6151
6184
  return "low";
@@ -6157,11 +6190,14 @@ var S3ClipsSupabaseService = class {
6157
6190
  */
6158
6191
  getDescriptionFromClipType(clipType) {
6159
6192
  const descriptions = {
6193
+ "long_cycle_time": "Long Cycle Time Detected",
6160
6194
  "idle_time": "Idle Time Detected",
6195
+ "best_cycle_time": "Best Cycle Time Performance",
6196
+ "worst_cycle_time": "Worst Cycle Time Performance",
6161
6197
  "sop_deviations": "SOP Deviations",
6162
6198
  "cycle_completion": "Cycle Completion"
6163
6199
  };
6164
- return descriptions[clipType] || "Analysis Clip";
6200
+ return clipType ? descriptions[clipType] || "Analysis Clip" : "Analysis Clip";
6165
6201
  }
6166
6202
  };
6167
6203
 
package/dist/index.mjs CHANGED
@@ -5561,6 +5561,25 @@ var CLIP_COUNTS_CACHE_TTL = 30 * 1e3;
5561
5561
  var CLIP_BY_ID_CACHE_TTL = 2 * 60 * 1e3;
5562
5562
  var CLIP_BY_ID_CACHE_MAX = 200;
5563
5563
  var CLIPS_INIT_CACHE_TTL = 30 * 1e3;
5564
+ var parseFiniteNumber = (value) => {
5565
+ if (typeof value === "number" && Number.isFinite(value)) {
5566
+ return value;
5567
+ }
5568
+ if (typeof value === "string" && value.trim().length > 0) {
5569
+ const parsed = Number(value);
5570
+ if (Number.isFinite(parsed)) {
5571
+ return parsed;
5572
+ }
5573
+ }
5574
+ return void 0;
5575
+ };
5576
+ var getClipCycleTimeFrames = (metadata) => {
5577
+ const flattenedCycleTime = parseFiniteNumber(metadata?.cycle_time);
5578
+ if (flattenedCycleTime !== void 0) {
5579
+ return flattenedCycleTime;
5580
+ }
5581
+ return parseFiniteNumber(metadata?.request?.metadata?.cycle_time);
5582
+ };
5564
5583
  var getSupabaseClient = () => {
5565
5584
  const existing = _getSupabaseInstanceOptional();
5566
5585
  if (existing) {
@@ -6070,20 +6089,31 @@ var S3ClipsSupabaseService = class {
6070
6089
  limit
6071
6090
  });
6072
6091
  console.log(`[S3ClipsSupabase] Fetched ${response.clips?.length || 0} ${type} clips`);
6073
- const transformedClips = (response.clips || []).map((clip) => ({
6074
- id: clip.clip_id,
6075
- src: clip.playlist,
6076
- // Raw playlist content
6077
- timestamp: clip.timestamp,
6078
- // Use pre-formatted timestamp from API (already in 12-hour format with seconds)
6079
- severity: this.getSeverityFromClipType(clip.clip_type_name),
6080
- description: this.getDescriptionFromClipType(clip.clip_type_name),
6081
- type: clip.clip_type_name,
6082
- originalUri: `clips:${clip.clip_id}`,
6083
- cycle_time_seconds: clip.metadata?.request?.metadata?.cycle_time ? clip.metadata.request.metadata.cycle_time / (clip.metadata?.playlist?.fps || 20) : void 0,
6084
- creation_timestamp: clip.created_at,
6085
- percentile: clip.cycle_time_percentile || clip.idle_time_percentile
6086
- }));
6092
+ const transformedClips = (response.clips || []).map((clip) => {
6093
+ const clipId = clip.id ?? clip.clip_id;
6094
+ const clipType = clip.type ?? clip.clip_type_name;
6095
+ const cycleTimeSeconds = parseFiniteNumber(clip.cycle_time_seconds) ?? (() => {
6096
+ const cycleTimeFrames = getClipCycleTimeFrames(clip.metadata);
6097
+ return cycleTimeFrames !== void 0 ? cycleTimeFrames / (clip.metadata?.playlist?.fps || 20) : void 0;
6098
+ })();
6099
+ return {
6100
+ id: clipId,
6101
+ src: clip.src ?? clip.playlist,
6102
+ // Current API returns src; keep playlist fallback for legacy responses
6103
+ timestamp: clip.timestamp,
6104
+ // Use pre-formatted timestamp from API (already in 12-hour format with seconds)
6105
+ severity: clip.severity ?? this.getSeverityFromClipType(clipType),
6106
+ description: clip.description ?? this.getDescriptionFromClipType(clipType),
6107
+ type: clipType,
6108
+ originalUri: clip.originalUri ?? `clips:${clipId}`,
6109
+ cycle_time_seconds: cycleTimeSeconds,
6110
+ creation_timestamp: clip.creation_timestamp ?? clip.created_at,
6111
+ percentile: clip.percentile ?? clip.cycle_time_percentile ?? clip.idle_time_percentile,
6112
+ duration: clip.duration,
6113
+ idle_start_time: clip.idle_start_time,
6114
+ idle_end_time: clip.idle_end_time
6115
+ };
6116
+ });
6087
6117
  return {
6088
6118
  clips: transformedClips,
6089
6119
  total: response.total || transformedClips.length,
@@ -6113,10 +6143,13 @@ var S3ClipsSupabaseService = class {
6113
6143
  */
6114
6144
  getSeverityFromClipType(clipType) {
6115
6145
  switch (clipType) {
6146
+ case "long_cycle_time":
6147
+ case "worst_cycle_time":
6116
6148
  case "sop_deviations":
6117
6149
  return "high";
6118
6150
  case "idle_time":
6119
6151
  return "medium";
6152
+ case "best_cycle_time":
6120
6153
  case "cycle_completion":
6121
6154
  default:
6122
6155
  return "low";
@@ -6128,11 +6161,14 @@ var S3ClipsSupabaseService = class {
6128
6161
  */
6129
6162
  getDescriptionFromClipType(clipType) {
6130
6163
  const descriptions = {
6164
+ "long_cycle_time": "Long Cycle Time Detected",
6131
6165
  "idle_time": "Idle Time Detected",
6166
+ "best_cycle_time": "Best Cycle Time Performance",
6167
+ "worst_cycle_time": "Worst Cycle Time Performance",
6132
6168
  "sop_deviations": "SOP Deviations",
6133
6169
  "cycle_completion": "Cycle Completion"
6134
6170
  };
6135
- return descriptions[clipType] || "Analysis Clip";
6171
+ return clipType ? descriptions[clipType] || "Analysis Clip" : "Analysis Clip";
6136
6172
  }
6137
6173
  };
6138
6174
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optifye/dashboard-core",
3
- "version": "6.10.52",
3
+ "version": "6.10.53",
4
4
  "description": "Reusable UI & logic for Optifye dashboard",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",