streamby-core 0.24.16 → 0.24.17

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.
@@ -50,6 +50,7 @@ function exportRouter(config) {
50
50
  createdAt: rawData?.createdAt,
51
51
  updatedAt: rawData?.updatedAt,
52
52
  type: exportMetadata.type,
53
+ fields: exportMetadata.fields,
53
54
  description: rawData?.description,
54
55
  };
55
56
  }
@@ -75,8 +76,18 @@ function exportRouter(config) {
75
76
  }
76
77
  }
77
78
  const externalApiData = await fetch(exportMetadata.apiUrl, { headers });
78
- const rawData = await externalApiData.json();
79
+ const apiResponse = await externalApiData.json();
80
+ let rawData;
81
+ if (exportMetadata.fields && exportMetadata.fields.length > 0) {
82
+ rawData = apiResponse.map((item) => {
83
+ return exportMetadata.fields.reduce((filtered, field) => {
84
+ filtered[field.name] = item[field.name];
85
+ return filtered;
86
+ }, {});
87
+ });
88
+ }
79
89
  data = {
90
+ apiResponse: apiResponse,
80
91
  json: rawData || {},
81
92
  name: exportMetadata.name,
82
93
  createdAt: exportMetadata.createdAt,
@@ -85,6 +96,7 @@ function exportRouter(config) {
85
96
  apiUrl: exportMetadata.apiUrl,
86
97
  prefix: exportMetadata.prefix,
87
98
  collectionName: exportMetadata.collectionName,
99
+ fields: exportMetadata.fields,
88
100
  description: exportMetadata?.description,
89
101
  };
90
102
  }
@@ -100,6 +112,7 @@ function exportRouter(config) {
100
112
  type: exportMetadata.type,
101
113
  credentialId: exportMetadata.credentialId,
102
114
  description: rawData?.description,
115
+ fields: exportMetadata.fields,
103
116
  };
104
117
  }
105
118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "streamby-core",
3
- "version": "0.24.16",
3
+ "version": "0.24.17",
4
4
  "description": "StreamBy middleware framework for media storage management",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",