@eide/foir-cli 0.1.15 → 0.1.16
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swift-field-types.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/swift-field-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,2BAA2B,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"swift-field-types.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/swift-field-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,2BAA2B,IAAI,MAAM,CAmJpD"}
|
|
@@ -20,22 +20,28 @@ struct ImageValue {
|
|
|
20
20
|
var alt: String?
|
|
21
21
|
var width: Int?
|
|
22
22
|
var height: Int?
|
|
23
|
+
var dominantColor: String?
|
|
24
|
+
var blurhash: String?
|
|
23
25
|
|
|
24
26
|
func toSyncData() -> [String: Any] {
|
|
25
|
-
var data: [String: Any] = ["
|
|
26
|
-
if let alt { data["
|
|
27
|
+
var data: [String: Any] = ["fileId": id, "source": "internal"]
|
|
28
|
+
if let alt { data["altText"] = alt }
|
|
27
29
|
if let width { data["width"] = width }
|
|
28
30
|
if let height { data["height"] = height }
|
|
31
|
+
if let dominantColor { data["dominantColor"] = dominantColor }
|
|
32
|
+
if let blurhash { data["blurhash"] = blurhash }
|
|
29
33
|
return data
|
|
30
34
|
}
|
|
31
35
|
|
|
32
36
|
static func fromSyncData(_ data: [String: Any]) -> ImageValue {
|
|
33
37
|
ImageValue(
|
|
34
|
-
id: data["id"] as? String ?? "",
|
|
38
|
+
id: data["fileId"] as? String ?? data["id"] as? String ?? "",
|
|
35
39
|
url: data["url"] as? String ?? "",
|
|
36
|
-
alt: data["alt"] as? String,
|
|
40
|
+
alt: data["altText"] as? String ?? data["alt"] as? String,
|
|
37
41
|
width: data["width"] as? Int,
|
|
38
|
-
height: data["height"] as? Int
|
|
42
|
+
height: data["height"] as? Int,
|
|
43
|
+
dominantColor: data["dominantColor"] as? String,
|
|
44
|
+
blurhash: data["blurhash"] as? String
|
|
39
45
|
)
|
|
40
46
|
}
|
|
41
47
|
}
|
|
@@ -49,17 +55,17 @@ struct VideoValue {
|
|
|
49
55
|
var duration: Double?
|
|
50
56
|
|
|
51
57
|
func toSyncData() -> [String: Any] {
|
|
52
|
-
var data: [String: Any] = ["
|
|
53
|
-
if let thumbnail { data["
|
|
58
|
+
var data: [String: Any] = ["fileId": id, "source": "internal"]
|
|
59
|
+
if let thumbnail { data["thumbnailUrl"] = thumbnail }
|
|
54
60
|
if let duration { data["duration"] = duration }
|
|
55
61
|
return data
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
static func fromSyncData(_ data: [String: Any]) -> VideoValue {
|
|
59
65
|
VideoValue(
|
|
60
|
-
id: data["id"] as? String ?? "",
|
|
66
|
+
id: data["fileId"] as? String ?? data["id"] as? String ?? "",
|
|
61
67
|
url: data["url"] as? String ?? "",
|
|
62
|
-
thumbnail: data["thumbnail"] as? String,
|
|
68
|
+
thumbnail: data["thumbnailUrl"] as? String ?? data["thumbnail"] as? String,
|
|
63
69
|
duration: data["duration"] as? Double
|
|
64
70
|
)
|
|
65
71
|
}
|
|
@@ -76,20 +82,20 @@ struct FileValue {
|
|
|
76
82
|
|
|
77
83
|
func toSyncData() -> [String: Any] {
|
|
78
84
|
[
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
85
|
+
"fileId": id,
|
|
86
|
+
"source": "internal",
|
|
87
|
+
"filename": name,
|
|
88
|
+
"fileSize": size,
|
|
83
89
|
"mimeType": mimeType,
|
|
84
90
|
]
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
static func fromSyncData(_ data: [String: Any]) -> FileValue {
|
|
88
94
|
FileValue(
|
|
89
|
-
id: data["id"] as? String ?? "",
|
|
95
|
+
id: data["fileId"] as? String ?? data["id"] as? String ?? "",
|
|
90
96
|
url: data["url"] as? String ?? "",
|
|
91
|
-
name: data["name"] as? String ?? "",
|
|
92
|
-
size: data["size"] as? Int ?? 0,
|
|
97
|
+
name: data["filename"] as? String ?? data["name"] as? String ?? "",
|
|
98
|
+
size: data["fileSize"] as? Int ?? data["size"] as? Int ?? 0,
|
|
93
99
|
mimeType: data["mimeType"] as? String ?? ""
|
|
94
100
|
)
|
|
95
101
|
}
|
|
@@ -70,7 +70,7 @@ export const SWIFT_FIELD_TYPE_MAPPING = {
|
|
|
70
70
|
file: {
|
|
71
71
|
type: 'FileValue',
|
|
72
72
|
alwaysOptional: true,
|
|
73
|
-
defaultValue: 'FileValue(id: "", url: "", name: "", size: 0, mimeType: "")',
|
|
73
|
+
defaultValue: 'FileValue(id: "", url: "", name: "", size: 0, mimeType: "")', // fromSyncData handles fileId→id mapping
|
|
74
74
|
castExpression: 'as? [String: Any]',
|
|
75
75
|
needsSharedType: true,
|
|
76
76
|
},
|