@things-factory/dataset 6.1.64 → 6.1.67

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/dataset",
3
- "version": "6.1.64",
3
+ "version": "6.1.67",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "things-factory": true,
@@ -36,19 +36,19 @@
36
36
  "@operato/shell": "^1.0.1",
37
37
  "@operato/styles": "^1.0.0",
38
38
  "@operato/utils": "^1.0.1",
39
- "@things-factory/auth-base": "^6.1.48",
40
- "@things-factory/aws-base": "^6.1.48",
41
- "@things-factory/board-service": "^6.1.55",
42
- "@things-factory/env": "^6.1.48",
43
- "@things-factory/organization": "^6.1.64",
44
- "@things-factory/scheduler-client": "^6.1.48",
45
- "@things-factory/shell": "^6.1.48",
46
- "@things-factory/work-shift": "^6.1.48",
47
- "@things-factory/worklist": "^6.1.64",
39
+ "@things-factory/auth-base": "^6.1.66",
40
+ "@things-factory/aws-base": "^6.1.66",
41
+ "@things-factory/board-service": "^6.1.66",
42
+ "@things-factory/env": "^6.1.66",
43
+ "@things-factory/organization": "^6.1.67",
44
+ "@things-factory/scheduler-client": "^6.1.66",
45
+ "@things-factory/shell": "^6.1.66",
46
+ "@things-factory/work-shift": "^6.1.66",
47
+ "@things-factory/worklist": "^6.1.67",
48
48
  "cron-parser": "^4.3.0",
49
49
  "moment-timezone": "^0.5.40",
50
50
  "simple-statistics": "^7.8.3",
51
51
  "statistics": "^3.3.0"
52
52
  },
53
- "gitHead": "781186386f8e235f165f2bfe5f66ef9fa00aec6e"
53
+ "gitHead": "8c200f0b657dc3bb429325d2ae41fecc2bd840a8"
54
54
  }
@@ -124,33 +124,35 @@ export async function createDataSample(dataSample: NewDataSample, context: Resol
124
124
  for (let files of filesArray) {
125
125
  let paths = []
126
126
 
127
- for (let file of files) {
128
- if (file) {
129
- const attachment = await createAttachment(
130
- null,
131
- {
132
- attachment: {
133
- file: file.file,
134
- refType: DataSample.name
135
- }
136
- },
137
- context
138
- )
139
-
140
- const fetched = await tx.getRepository(Attachment).findOneBy({ id: attachment.id })
141
- if (fetched) {
142
- attachments.push(fetched)
143
- paths.push({
144
- id: fetched.id,
145
- mimetype: fetched.mimetype,
146
- name: fetched.name,
147
- fullpath: fetched.fullpath
148
- })
127
+ if (files instanceof Array) {
128
+ for (let file of files) {
129
+ if (file) {
130
+ const attachment = await createAttachment(
131
+ null,
132
+ {
133
+ attachment: {
134
+ file: file.file,
135
+ refType: DataSample.name
136
+ }
137
+ },
138
+ context
139
+ )
140
+
141
+ const fetched = await tx.getRepository(Attachment).findOneBy({ id: attachment.id })
142
+ if (fetched) {
143
+ attachments.push(fetched)
144
+ paths.push({
145
+ id: fetched.id,
146
+ mimetype: fetched.mimetype,
147
+ name: fetched.name,
148
+ fullpath: fetched.fullpath
149
+ })
150
+ } else {
151
+ throw `Failed to save file(${attachment.name})`
152
+ }
149
153
  } else {
150
- throw `Failed to save file(${attachment.name})`
154
+ paths.push(null)
151
155
  }
152
- } else {
153
- paths.push(null)
154
156
  }
155
157
  }
156
158