@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/esm/index.js CHANGED
@@ -140,10 +140,16 @@ class EntitySerializer {
140
140
  return {
141
141
  fileName,
142
142
  contentType: "text/csv",
143
- content: Buffer.from(csvBuild([{}], this.getDefinition().columns.map((c) => ({
144
- name: c.name,
145
- value: () => c.sampleValue ?? "",
146
- }))), "utf-8"),
143
+ content: Buffer.from(csvBuild([{}], [
144
+ {
145
+ name: "_type",
146
+ value: () => this.entityName,
147
+ },
148
+ ...this.getDefinition().columns.map((c) => ({
149
+ name: c.name,
150
+ value: () => c.sampleValue ?? "",
151
+ })),
152
+ ]), "utf-8"),
147
153
  };
148
154
  case EntitySerializationFormat.Xlsx:
149
155
  return {
@@ -152,11 +158,17 @@ class EntitySerializer {
152
158
  content: Buffer.from(excelBuild({
153
159
  data: [{}],
154
160
  sheetName: this.entityName,
155
- columns: this.getDefinition().columns.map((c) => ({
156
- header: c.name,
157
- value: () => c.sampleValue ?? "",
158
- headerSize: c.colSpan,
159
- })),
161
+ columns: [
162
+ {
163
+ header: "_type",
164
+ value: () => this.entityName,
165
+ },
166
+ ...this.getDefinition().columns.map((c) => ({
167
+ header: c.name,
168
+ value: () => c.sampleValue ?? "",
169
+ headerSize: c.colSpan,
170
+ })),
171
+ ],
160
172
  })),
161
173
  };
162
174
  case EntitySerializationFormat.Json:
@@ -176,10 +188,16 @@ class EntitySerializer {
176
188
  return {
177
189
  fileName,
178
190
  contentType: "text/csv",
179
- content: Buffer.from(csvBuild(data, this.getDefinition().columns.map((c) => ({
180
- name: c.name,
181
- value: (item) => this.getColumnValue(item, c),
182
- }))), "utf-8"),
191
+ content: Buffer.from(csvBuild(data, [
192
+ {
193
+ name: "_type",
194
+ value: () => this.entityName,
195
+ },
196
+ ...this.getDefinition().columns.map((c) => ({
197
+ name: c.name,
198
+ value: (item) => this.getColumnValue(item, c),
199
+ })),
200
+ ]), "utf-8"),
183
201
  };
184
202
  case EntitySerializationFormat.Xlsx:
185
203
  return {
@@ -188,11 +206,17 @@ class EntitySerializer {
188
206
  content: Buffer.from(excelBuild({
189
207
  data,
190
208
  sheetName: this.entityName,
191
- columns: this.getDefinition().columns.map((c) => ({
192
- header: c.name,
193
- value: (item) => this.getColumnValue(item, c),
194
- headerSize: c.colSpan,
195
- })),
209
+ columns: [
210
+ {
211
+ header: "_type",
212
+ value: () => this.entityName,
213
+ },
214
+ ...this.getDefinition().columns.map((c) => ({
215
+ header: c.name,
216
+ value: (item) => this.getColumnValue(item, c),
217
+ headerSize: c.colSpan,
218
+ })),
219
+ ],
196
220
  })),
197
221
  };
198
222
  case EntitySerializationFormat.Json: