@punks/backend-entity-manager 0.0.90 → 0.0.92
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/cjs/index.js +42 -18
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +42 -18
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -148,10 +148,16 @@ class EntitySerializer {
|
|
|
148
148
|
return {
|
|
149
149
|
fileName,
|
|
150
150
|
contentType: "text/csv",
|
|
151
|
-
content: Buffer.from(backendCore.csvBuild([{}],
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
content: Buffer.from(backendCore.csvBuild([{}], [
|
|
152
|
+
{
|
|
153
|
+
name: "_type",
|
|
154
|
+
value: () => this.entityName,
|
|
155
|
+
},
|
|
156
|
+
...this.getDefinition().columns.map((c) => ({
|
|
157
|
+
name: c.name,
|
|
158
|
+
value: () => c.sampleValue ?? "",
|
|
159
|
+
})),
|
|
160
|
+
]), "utf-8"),
|
|
155
161
|
};
|
|
156
162
|
case exports.EntitySerializationFormat.Xlsx:
|
|
157
163
|
return {
|
|
@@ -160,11 +166,17 @@ class EntitySerializer {
|
|
|
160
166
|
content: Buffer.from(backendCore.excelBuild({
|
|
161
167
|
data: [{}],
|
|
162
168
|
sheetName: this.entityName,
|
|
163
|
-
columns:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
169
|
+
columns: [
|
|
170
|
+
{
|
|
171
|
+
header: "_type",
|
|
172
|
+
value: () => this.entityName,
|
|
173
|
+
},
|
|
174
|
+
...this.getDefinition().columns.map((c) => ({
|
|
175
|
+
header: c.name,
|
|
176
|
+
value: () => c.sampleValue ?? "",
|
|
177
|
+
headerSize: c.colSpan,
|
|
178
|
+
})),
|
|
179
|
+
],
|
|
168
180
|
})),
|
|
169
181
|
};
|
|
170
182
|
case exports.EntitySerializationFormat.Json:
|
|
@@ -184,10 +196,16 @@ class EntitySerializer {
|
|
|
184
196
|
return {
|
|
185
197
|
fileName,
|
|
186
198
|
contentType: "text/csv",
|
|
187
|
-
content: Buffer.from(backendCore.csvBuild(data,
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
199
|
+
content: Buffer.from(backendCore.csvBuild(data, [
|
|
200
|
+
{
|
|
201
|
+
name: "_type",
|
|
202
|
+
value: () => this.entityName,
|
|
203
|
+
},
|
|
204
|
+
...this.getDefinition().columns.map((c) => ({
|
|
205
|
+
name: c.name,
|
|
206
|
+
value: (item) => this.getColumnValue(item, c),
|
|
207
|
+
})),
|
|
208
|
+
]), "utf-8"),
|
|
191
209
|
};
|
|
192
210
|
case exports.EntitySerializationFormat.Xlsx:
|
|
193
211
|
return {
|
|
@@ -196,11 +214,17 @@ class EntitySerializer {
|
|
|
196
214
|
content: Buffer.from(backendCore.excelBuild({
|
|
197
215
|
data,
|
|
198
216
|
sheetName: this.entityName,
|
|
199
|
-
columns:
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
217
|
+
columns: [
|
|
218
|
+
{
|
|
219
|
+
header: "_type",
|
|
220
|
+
value: () => this.entityName,
|
|
221
|
+
},
|
|
222
|
+
...this.getDefinition().columns.map((c) => ({
|
|
223
|
+
header: c.name,
|
|
224
|
+
value: (item) => this.getColumnValue(item, c),
|
|
225
|
+
headerSize: c.colSpan,
|
|
226
|
+
})),
|
|
227
|
+
],
|
|
204
228
|
})),
|
|
205
229
|
};
|
|
206
230
|
case exports.EntitySerializationFormat.Json:
|