@nfdi4plants/arctrl 2.4.0 → 2.5.1
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/ARC.js +103 -12
- package/CWL/CWLTypes.js +2 -2
- package/CWL/Decode.js +2 -2
- package/CWL/Inputs.js +2 -2
- package/CWL/Outputs.js +2 -2
- package/CWL/Requirements.js +2 -2
- package/CWL/ToolDescription.js +1 -1
- package/CWL/WorkflowDescription.js +1 -1
- package/CWL/WorkflowSteps.js +1 -1
- package/ColumnIndex.js +258 -0
- package/Conversion.js +1679 -0
- package/Core/Data.js +28 -3
- package/Core/DataFile.js +19 -3
- package/Core/Helper/Collections.js +107 -4
- package/Core/Helper/DateTime.js +17 -0
- package/Core/Helper/ORCID.js +39 -0
- package/Json/Decode.js +3 -3
- package/Json/Encode.js +9 -0
- package/Json/OntologySourceReference.js +4 -4
- package/Json/ROCrate/LDContext.js +121 -0
- package/Json/ROCrate/LDGraph.js +87 -0
- package/Json/{LDObject.js → ROCrate/LDNode.js} +55 -46
- package/Json/ROCrate/LDRef.js +25 -0
- package/Json/ROCrate/LDValue.js +66 -0
- package/JsonIO/LDObject.js +30 -5
- package/ROCrate/ArcROCrateMetadata.js +14 -13
- package/ROCrate/Generic/Comment.js +115 -0
- package/ROCrate/Generic/Dataset.js +669 -0
- package/ROCrate/Generic/DefinedTerm.js +115 -0
- package/ROCrate/Generic/File.js +200 -0
- package/ROCrate/Generic/LabProcess.js +238 -0
- package/ROCrate/Generic/LabProtocol.js +275 -0
- package/ROCrate/Generic/Organization.js +71 -0
- package/ROCrate/Generic/Person.js +411 -0
- package/ROCrate/Generic/PostalAddress.js +159 -0
- package/ROCrate/Generic/PropertyValue.js +548 -0
- package/ROCrate/Generic/Sample.js +139 -0
- package/ROCrate/Generic/ScholarlyArticle.js +187 -0
- package/ROCrate/Helper.js +6 -0
- package/ROCrate/ISAProfile/Assay.js +3 -3
- package/ROCrate/ISAProfile/Data.js +7 -7
- package/ROCrate/ISAProfile/Dataset.js +7 -6
- package/ROCrate/ISAProfile/Investigation.js +3 -3
- package/ROCrate/ISAProfile/LabProcess.js +7 -7
- package/ROCrate/ISAProfile/LabProtocol.js +7 -7
- package/ROCrate/ISAProfile/Person.js +7 -7
- package/ROCrate/ISAProfile/PropertyValue.js +7 -7
- package/ROCrate/ISAProfile/Sample.js +7 -7
- package/ROCrate/ISAProfile/ScholarlyArticle.js +7 -7
- package/ROCrate/ISAProfile/Study.js +3 -3
- package/ROCrate/LDContext.js +283 -0
- package/ROCrate/LDObject.js +902 -36
- package/ROCrate/ROCrateContext.js +44 -0
- package/ROCrateIO.js +62 -0
- package/Spreadsheet/DataMapTable/DataMapHeader.js +3 -2
- package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/DynObj.fs +31 -1
- package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/DynObj.fs.js +30 -1
- package/fable_modules/DynamicObj.7.0.1/DynamicObj.fs +1025 -0
- package/fable_modules/DynamicObj.7.0.1/DynamicObj.fs.js +433 -0
- package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/FableJS.fs +16 -0
- package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/FablePy.fs +14 -0
- package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/HashCodes.fs +15 -0
- package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/HashCodes.fs.js +4 -0
- package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/obj/Debug/netstandard2.0/DynamicObj.AssemblyInfo.fs +1 -1
- package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/obj/Release/netstandard2.0/DynamicObj.AssemblyInfo.fs +3 -3
- package/fable_modules/project_cracked.json +1 -1
- package/package.json +1 -1
- package/Json/ARC.js +0 -31
- package/JsonIO/ARC.js +0 -31
- package/fable_modules/DynamicObj.4.0.3/DynamicObj.fs +0 -310
- package/fable_modules/DynamicObj.4.0.3/DynamicObj.fs.js +0 -166
- /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/DynamicObj.fableproj +0 -0
- /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/FableJS.fs.js +0 -0
- /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/PropertyHelper.fs +0 -0
- /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/PropertyHelper.fs.js +0 -0
- /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/ReflectionUtils.fs +0 -0
- /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/ReflectionUtils.fs.js +0 -0
- /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/obj/Debug/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
- /package/fable_modules/{DynamicObj.4.0.3 → DynamicObj.7.0.1}/obj/Release/netstandard2.0/.NETStandard,Version=v2.0.AssemblyAttributes.fs +0 -0
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
namespace DynamicObj
|
|
2
|
-
|
|
3
|
-
#if !FABLE_COMPILER
|
|
4
|
-
open System.Dynamic
|
|
5
|
-
#endif
|
|
6
|
-
|
|
7
|
-
open System.Collections.Generic
|
|
8
|
-
open Fable.Core
|
|
9
|
-
|
|
10
|
-
[<AttachMembers>]
|
|
11
|
-
type DynamicObj() =
|
|
12
|
-
|
|
13
|
-
#if !FABLE_COMPILER
|
|
14
|
-
inherit DynamicObject()
|
|
15
|
-
#endif
|
|
16
|
-
|
|
17
|
-
let mutable properties = new Dictionary<string, obj>()
|
|
18
|
-
|
|
19
|
-
/// <summary>
|
|
20
|
-
/// A dictionary of dynamic boxed properties
|
|
21
|
-
/// </summary>
|
|
22
|
-
member this.Properties
|
|
23
|
-
with get() = properties
|
|
24
|
-
and internal set(value) = properties <- value
|
|
25
|
-
|
|
26
|
-
/// <summary>
|
|
27
|
-
/// Creates a new DynamicObj from a Dictionary containing dynamic properties.
|
|
28
|
-
/// </summary>
|
|
29
|
-
/// <param name="dynamicProperties">The dictionary with the dynamic properties</param>
|
|
30
|
-
static member ofDict (dynamicProperties: Dictionary<string,obj>) =
|
|
31
|
-
let obj = DynamicObj()
|
|
32
|
-
obj.Properties <- dynamicProperties
|
|
33
|
-
obj
|
|
34
|
-
|
|
35
|
-
/// <summary>
|
|
36
|
-
/// Returns Some(PropertyHelper) if a static property with the given name exists, otherwise None.
|
|
37
|
-
/// </summary>
|
|
38
|
-
/// <param name="propertyName">The name of the property to get the PropertyHelper for</param>
|
|
39
|
-
member this.TryGetStaticPropertyHelper (propertyName: string) : PropertyHelper option =
|
|
40
|
-
ReflectionUtils.tryGetStaticPropertyInfo this propertyName
|
|
41
|
-
|
|
42
|
-
/// <summary>
|
|
43
|
-
/// Returns Some(PropertyHelper) if a dynamic property with the given name exists, otherwise None.
|
|
44
|
-
/// </summary>
|
|
45
|
-
/// <param name="propertyName">The name of the property to get the PropertyHelper for</param>
|
|
46
|
-
member this.TryGetDynamicPropertyHelper (propertyName: string) : PropertyHelper option =
|
|
47
|
-
#if FABLE_COMPILER_JAVASCRIPT || FABLE_COMPILER_TYPESCRIPT
|
|
48
|
-
FableJS.tryGetDynamicPropertyHelper this propertyName
|
|
49
|
-
#endif
|
|
50
|
-
#if FABLE_COMPILER_PYTHON
|
|
51
|
-
FablePy.tryGetDynamicPropertyHelper this propertyName
|
|
52
|
-
#endif
|
|
53
|
-
#if !FABLE_COMPILER
|
|
54
|
-
match properties.TryGetValue propertyName with
|
|
55
|
-
| true,_ ->
|
|
56
|
-
Some {
|
|
57
|
-
Name = propertyName
|
|
58
|
-
IsStatic = false
|
|
59
|
-
IsDynamic = true
|
|
60
|
-
IsMutable = true
|
|
61
|
-
IsImmutable = false
|
|
62
|
-
GetValue = fun o -> properties.[propertyName]
|
|
63
|
-
SetValue = fun o v -> properties.[propertyName] <- v
|
|
64
|
-
RemoveValue = fun o -> properties.Remove(propertyName) |> ignore
|
|
65
|
-
}
|
|
66
|
-
| _ -> None
|
|
67
|
-
#endif
|
|
68
|
-
|
|
69
|
-
/// <summary>
|
|
70
|
-
/// Returns Some(PropertyHelper) if a property (static or dynamic) with the given name exists, otherwise None.
|
|
71
|
-
/// </summary>
|
|
72
|
-
/// <param name="propertyName">The name of the property to get the PropertyHelper for</param>
|
|
73
|
-
member this.TryGetPropertyHelper (propertyName: string) : PropertyHelper option =
|
|
74
|
-
match this.TryGetStaticPropertyHelper propertyName with
|
|
75
|
-
| Some pi -> Some pi
|
|
76
|
-
| None -> this.TryGetDynamicPropertyHelper propertyName
|
|
77
|
-
|
|
78
|
-
/// <summary>
|
|
79
|
-
/// Returns Some(boxed property value) if a dynamic (or static) property with the given name exists, otherwise None.
|
|
80
|
-
/// </summary>
|
|
81
|
-
/// <param name="name">the name of the property to get</param>
|
|
82
|
-
member this.TryGetPropertyValue (propertyName: string) =
|
|
83
|
-
// first check the Properties collection for member
|
|
84
|
-
this.TryGetPropertyHelper(propertyName)
|
|
85
|
-
|> Option.map (fun pi -> pi.GetValue(this))
|
|
86
|
-
|
|
87
|
-
/// <summary>
|
|
88
|
-
/// Returns the boxed property value of the dynamic (or static) property with the given name.
|
|
89
|
-
/// </summary>
|
|
90
|
-
/// <param name="propertyName">the name of the property to get</param>
|
|
91
|
-
/// <exception cref="System.MissingMemberException">Thrown if no dynamic or static property with the given name exists</exception>
|
|
92
|
-
member this.GetPropertyValue (propertyName: string) =
|
|
93
|
-
match this.TryGetPropertyValue(propertyName) with
|
|
94
|
-
| Some value -> value
|
|
95
|
-
| None -> raise <| System.MissingMemberException($"No dynamic or static property \"{propertyName}\" does exist on object.")
|
|
96
|
-
|
|
97
|
-
#if !FABLE_COMPILER
|
|
98
|
-
|
|
99
|
-
/// <summary>
|
|
100
|
-
/// Returns Some('TPropertyValue) when a dynamic (or static) property with the given name and type exists, otherwise None.
|
|
101
|
-
///
|
|
102
|
-
/// This method is not Fable-compatible and can therefore not be used in code that will be transpiled.
|
|
103
|
-
/// </summary>
|
|
104
|
-
/// <param name="propertyName">the name of the property to get</param>
|
|
105
|
-
/// <remarks>This method is not Fable-compatible and can therefore not be used in code that will be transpiled.</remarks>
|
|
106
|
-
member this.TryGetTypedPropertyValue<'TPropertyValue> (propertyName: string) =
|
|
107
|
-
|
|
108
|
-
match (this.TryGetPropertyValue propertyName) with
|
|
109
|
-
| None -> None
|
|
110
|
-
| Some o ->
|
|
111
|
-
match o with
|
|
112
|
-
| :? 'TPropertyValue as o -> o |> Some
|
|
113
|
-
| _ -> None
|
|
114
|
-
#endif
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
/// <summary>
|
|
118
|
-
/// Sets the dynamic (or static) property value with the given name, creating a new dynamic property if none exists.
|
|
119
|
-
/// </summary>
|
|
120
|
-
/// <param name="propertyName">the name of the property to set</param>
|
|
121
|
-
/// <param name="propertyValue">the value of the property to set</param>
|
|
122
|
-
member this.SetProperty (
|
|
123
|
-
propertyName: string,
|
|
124
|
-
propertyValue: obj
|
|
125
|
-
) =
|
|
126
|
-
// first check to see if there's a native property to set
|
|
127
|
-
match this.TryGetStaticPropertyHelper propertyName with
|
|
128
|
-
| Some pi ->
|
|
129
|
-
if pi.IsMutable then
|
|
130
|
-
pi.SetValue this propertyValue
|
|
131
|
-
else
|
|
132
|
-
failwith $"Cannot set value for static, immutable property \"{propertyName}\""
|
|
133
|
-
| None ->
|
|
134
|
-
#if FABLE_COMPILER_JAVASCRIPT || FABLE_COMPILER_TYPESCRIPT
|
|
135
|
-
FableJS.setPropertyValue this propertyName propertyValue
|
|
136
|
-
#endif
|
|
137
|
-
#if FABLE_COMPILER_PYTHON
|
|
138
|
-
FablePy.setPropertyValue this propertyName propertyValue
|
|
139
|
-
#endif
|
|
140
|
-
#if !FABLE_COMPILER
|
|
141
|
-
// Next check the Properties collection for member
|
|
142
|
-
match properties.TryGetValue propertyName with
|
|
143
|
-
| true,_ -> properties.[propertyName] <- propertyValue
|
|
144
|
-
| _ -> properties.Add(propertyName,propertyValue)
|
|
145
|
-
#endif
|
|
146
|
-
|
|
147
|
-
/// <summary>
|
|
148
|
-
/// Removes any dynamic property with the given name from the input DynamicObj.
|
|
149
|
-
/// If the property is static and mutable, it will be set to null.
|
|
150
|
-
/// Static immutable properties cannot be removed.
|
|
151
|
-
/// </summary>
|
|
152
|
-
/// <param name="propertyName">the name of the property to remove</param>
|
|
153
|
-
/// <exception cref="System.MemberAccessException">Thrown if the dynamic property does not exist</exception>
|
|
154
|
-
member this.RemoveProperty (propertyName: string) =
|
|
155
|
-
match this.TryGetPropertyHelper propertyName with
|
|
156
|
-
| Some pi when pi.IsMutable ->
|
|
157
|
-
pi.RemoveValue this
|
|
158
|
-
true
|
|
159
|
-
| Some _ ->
|
|
160
|
-
raise <| System.MemberAccessException($"Cannot remove value for static, immutable property \"{propertyName}\"")
|
|
161
|
-
| None -> false
|
|
162
|
-
|
|
163
|
-
/// <summary>
|
|
164
|
-
/// Returns PropertyHelpers for all dynamic properties of the DynamicObj.
|
|
165
|
-
///
|
|
166
|
-
/// When includeInstanceProperties is set to true, instance properties (= 'static' properties on the class) are included in the result.
|
|
167
|
-
/// </summary>
|
|
168
|
-
/// <param name="includeInstanceProperties">whether to include instance properties (= 'static' properties on the class)</param>
|
|
169
|
-
member this.GetPropertyHelpers (includeInstanceProperties: bool) =
|
|
170
|
-
#if FABLE_COMPILER_JAVASCRIPT || FABLE_COMPILER_TYPESCRIPT
|
|
171
|
-
FableJS.getPropertyHelpers this
|
|
172
|
-
|> Seq.filter (fun pd ->
|
|
173
|
-
includeInstanceProperties || pd.IsDynamic
|
|
174
|
-
)
|
|
175
|
-
#endif
|
|
176
|
-
#if FABLE_COMPILER_PYTHON
|
|
177
|
-
FablePy.getPropertyHelpers this
|
|
178
|
-
|> Seq.filter (fun pd ->
|
|
179
|
-
includeInstanceProperties || pd.IsDynamic
|
|
180
|
-
)
|
|
181
|
-
#endif
|
|
182
|
-
#if !FABLE_COMPILER
|
|
183
|
-
seq [
|
|
184
|
-
if includeInstanceProperties then
|
|
185
|
-
yield! ReflectionUtils.getStaticProperties (this)
|
|
186
|
-
for key in properties.Keys ->
|
|
187
|
-
{
|
|
188
|
-
Name = key
|
|
189
|
-
IsStatic = false
|
|
190
|
-
IsDynamic = true
|
|
191
|
-
IsMutable = true
|
|
192
|
-
IsImmutable = false
|
|
193
|
-
GetValue = fun o -> properties.[key]
|
|
194
|
-
SetValue = fun o v -> properties.[key] <- v
|
|
195
|
-
RemoveValue = fun o -> properties.Remove(key) |> ignore
|
|
196
|
-
}
|
|
197
|
-
]
|
|
198
|
-
#endif
|
|
199
|
-
|> Seq.filter (fun p -> p.Name.ToLower() <> "properties")
|
|
200
|
-
|
|
201
|
-
/// <summary>
|
|
202
|
-
/// Returns a sequence of all dynamic properties as a key value pair of the property names and the boxed property values.
|
|
203
|
-
///
|
|
204
|
-
/// When includeInstanceProperties is set to true, instance properties (= 'static' properties on the class) are included in the result.
|
|
205
|
-
/// </summary>
|
|
206
|
-
/// <param name="includeInstanceProperties">whether to include instance properties (= 'static' properties on the class)</param>
|
|
207
|
-
member this.GetProperties includeInstanceProperties : seq<KeyValuePair<string,obj>> =
|
|
208
|
-
this.GetPropertyHelpers(includeInstanceProperties)
|
|
209
|
-
|> Seq.choose (fun kv ->
|
|
210
|
-
if kv.Name <> "properties" then
|
|
211
|
-
Some (KeyValuePair(kv.Name, kv.GetValue this))
|
|
212
|
-
else
|
|
213
|
-
None
|
|
214
|
-
)
|
|
215
|
-
|
|
216
|
-
/// <summary>
|
|
217
|
-
/// Returns a sequence of all dynamic property names.
|
|
218
|
-
///
|
|
219
|
-
/// When includeInstanceProperties is set to true, instance properties (= 'static' properties on the class) are included in the result.
|
|
220
|
-
/// </summary>
|
|
221
|
-
/// <param name="includeInstanceProperties"></param>
|
|
222
|
-
member this.GetPropertyNames(includeInstanceProperties) =
|
|
223
|
-
this.GetProperties(includeInstanceProperties)
|
|
224
|
-
|> Seq.map (fun kv -> kv.Key)
|
|
225
|
-
|
|
226
|
-
/// <summary>
|
|
227
|
-
/// Copies all dynamic members of the DynamicObj to the target DynamicObj.
|
|
228
|
-
///
|
|
229
|
-
/// If overWrite is set to true, existing properties on the target object will be overwritten.
|
|
230
|
-
///
|
|
231
|
-
/// Note that this method will not perform nested checks, e.g. if a property is a DynamicObj itself, it will not be copied recursively.
|
|
232
|
-
/// </summary>
|
|
233
|
-
/// <param name="target">The target object to copy dynamic members to</param>
|
|
234
|
-
/// <param name="overWrite">Whether existing properties on the target object will be overwritten</param>
|
|
235
|
-
member this.CopyDynamicPropertiesTo(target:#DynamicObj, ?overWrite) =
|
|
236
|
-
let overWrite = defaultArg overWrite false
|
|
237
|
-
this.GetProperties(false)
|
|
238
|
-
|> Seq.iter (fun kv ->
|
|
239
|
-
match target.TryGetPropertyHelper kv.Key with
|
|
240
|
-
| Some pi when overWrite -> pi.SetValue target kv.Value
|
|
241
|
-
| Some _ -> failwith $"Property \"{kv.Key}\" already exists on target object and overWrite was not set to true."
|
|
242
|
-
| None -> target.SetProperty(kv.Key,kv.Value)
|
|
243
|
-
)
|
|
244
|
-
|
|
245
|
-
/// <summary>
|
|
246
|
-
/// Returns a new DynamicObj with only the dynamic properties of the original DynamicObj (sans instance properties).
|
|
247
|
-
/// </summary>
|
|
248
|
-
member this.CopyDynamicProperties() =
|
|
249
|
-
let target = DynamicObj()
|
|
250
|
-
this.CopyDynamicPropertiesTo(target)
|
|
251
|
-
target
|
|
252
|
-
|
|
253
|
-
#if !FABLE_COMPILER
|
|
254
|
-
// Some necessary overrides for methods inherited from System.Dynamic.DynamicObject()
|
|
255
|
-
//
|
|
256
|
-
// Needed mainly for making Newtonsoft.Json Serialization work
|
|
257
|
-
override this.TryGetMember(binder:GetMemberBinder,result:obj byref ) =
|
|
258
|
-
match this.TryGetPropertyValue binder.Name with
|
|
259
|
-
| Some value -> result <- value; true
|
|
260
|
-
| None -> false
|
|
261
|
-
|
|
262
|
-
override this.TrySetMember(binder:SetMemberBinder, value:obj) =
|
|
263
|
-
this.SetProperty(binder.Name,value)
|
|
264
|
-
true
|
|
265
|
-
|
|
266
|
-
/// Returns both instance and dynamic member names.
|
|
267
|
-
/// Important to return both so JSON serialization with Json.NET works.
|
|
268
|
-
override this.GetDynamicMemberNames() = this.GetPropertyNames(true)
|
|
269
|
-
|
|
270
|
-
//// potential deserialization support
|
|
271
|
-
//[<JsonExtensionData>]
|
|
272
|
-
//member private this._additionalData : IDictionary<string, JToken> = new Dictionary<string, JToken>()
|
|
273
|
-
|
|
274
|
-
//[<OnDeserialized>]
|
|
275
|
-
//member private this.OnDeserialized(context:StreamingContext) = ()
|
|
276
|
-
// map over key value pairs in additional data, box the token values and set dynamic properties via SetProperty.
|
|
277
|
-
|
|
278
|
-
#endif
|
|
279
|
-
|
|
280
|
-
/// <summary>
|
|
281
|
-
/// Operator to access a property by name
|
|
282
|
-
///
|
|
283
|
-
/// This method is not Fable-compatible and can therefore not be used in code that will be transpiled.
|
|
284
|
-
/// </summary>
|
|
285
|
-
/// <remarks>This method is not Fable-compatible and can therefore not be used in code that will be transpiled.</remarks>
|
|
286
|
-
static member (?) (lookup:#DynamicObj,name:string) =
|
|
287
|
-
match lookup.TryGetPropertyValue name with
|
|
288
|
-
| Some(value) -> value
|
|
289
|
-
| None -> raise <| System.MemberAccessException()
|
|
290
|
-
|
|
291
|
-
/// <summary>
|
|
292
|
-
/// Operator to set a property value
|
|
293
|
-
///
|
|
294
|
-
/// This method is not Fable-compatible and can therefore not be used in code that will be transpiled.
|
|
295
|
-
/// </summary>
|
|
296
|
-
/// <remarks>This method is not Fable-compatible and can therefore not be used in code that will be transpiled.</remarks>
|
|
297
|
-
static member (?<-) (lookup:#DynamicObj,name:string,value:'v) =
|
|
298
|
-
lookup.SetProperty (name,value)
|
|
299
|
-
|
|
300
|
-
override this.GetHashCode () =
|
|
301
|
-
this.GetProperties(true)
|
|
302
|
-
|> Seq.sortBy (fun pair -> pair.Key)
|
|
303
|
-
|> HashCodes.boxHashKeyValSeq
|
|
304
|
-
|> fun x -> x :?> int
|
|
305
|
-
|
|
306
|
-
override this.Equals o =
|
|
307
|
-
match o with
|
|
308
|
-
| :? DynamicObj as other ->
|
|
309
|
-
this.GetHashCode() = other.GetHashCode()
|
|
310
|
-
| _ -> false
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { tryGetStaticPropertyInfo } from "./ReflectionUtils.fs.js";
|
|
2
|
-
import { getPropertyHelpers, tryGetDynamicPropertyHelper } from "./FableJS.fs.js";
|
|
3
|
-
import { defaultArg, value as value_1, map } from "../fable-library-js.4.24.0/Option.js";
|
|
4
|
-
import { sortBy, iterate, map as map_1, choose, filter } from "../fable-library-js.4.24.0/Seq.js";
|
|
5
|
-
import { boxHashKeyValSeq } from "./HashCodes.fs.js";
|
|
6
|
-
import { safeHash, comparePrimitives } from "../fable-library-js.4.24.0/Util.js";
|
|
7
|
-
import { class_type } from "../fable-library-js.4.24.0/Reflection.js";
|
|
8
|
-
|
|
9
|
-
export class DynamicObj {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.properties = (new Map([]));
|
|
12
|
-
}
|
|
13
|
-
get Properties() {
|
|
14
|
-
const this$ = this;
|
|
15
|
-
return this$.properties;
|
|
16
|
-
}
|
|
17
|
-
set Properties(value) {
|
|
18
|
-
const this$ = this;
|
|
19
|
-
this$.properties = value;
|
|
20
|
-
}
|
|
21
|
-
static ofDict(dynamicProperties) {
|
|
22
|
-
const obj = new DynamicObj();
|
|
23
|
-
obj.Properties = dynamicProperties;
|
|
24
|
-
return obj;
|
|
25
|
-
}
|
|
26
|
-
TryGetStaticPropertyHelper(propertyName) {
|
|
27
|
-
const this$ = this;
|
|
28
|
-
return tryGetStaticPropertyInfo(this$, propertyName);
|
|
29
|
-
}
|
|
30
|
-
TryGetDynamicPropertyHelper(propertyName) {
|
|
31
|
-
const this$ = this;
|
|
32
|
-
return tryGetDynamicPropertyHelper(this$, propertyName);
|
|
33
|
-
}
|
|
34
|
-
TryGetPropertyHelper(propertyName) {
|
|
35
|
-
const this$ = this;
|
|
36
|
-
const matchValue = this$.TryGetStaticPropertyHelper(propertyName);
|
|
37
|
-
return (matchValue == null) ? this$.TryGetDynamicPropertyHelper(propertyName) : matchValue;
|
|
38
|
-
}
|
|
39
|
-
TryGetPropertyValue(propertyName) {
|
|
40
|
-
const this$ = this;
|
|
41
|
-
return map((pi) => pi.GetValue(this$), this$.TryGetPropertyHelper(propertyName));
|
|
42
|
-
}
|
|
43
|
-
GetPropertyValue(propertyName) {
|
|
44
|
-
const this$ = this;
|
|
45
|
-
const matchValue = this$.TryGetPropertyValue(propertyName);
|
|
46
|
-
if (matchValue == null) {
|
|
47
|
-
throw new Error(`No dynamic or static property "${propertyName}" does exist on object.`);
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
return value_1(matchValue);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
SetProperty(propertyName, propertyValue) {
|
|
54
|
-
const this$ = this;
|
|
55
|
-
const matchValue = this$.TryGetStaticPropertyHelper(propertyName);
|
|
56
|
-
if (matchValue == null) {
|
|
57
|
-
this$[propertyName] = propertyValue;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
const pi = matchValue;
|
|
61
|
-
if (pi.IsMutable) {
|
|
62
|
-
pi.SetValue(this$, propertyValue);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
throw new Error(`Cannot set value for static, immutable property "${propertyName}"`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
RemoveProperty(propertyName) {
|
|
70
|
-
const this$ = this;
|
|
71
|
-
const matchValue = this$.TryGetPropertyHelper(propertyName);
|
|
72
|
-
if (matchValue == null) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
else if (matchValue.IsMutable) {
|
|
76
|
-
const pi_1 = matchValue;
|
|
77
|
-
pi_1.RemoveValue(this$);
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
throw new Error(`Cannot remove value for static, immutable property "${propertyName}"`);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
GetPropertyHelpers(includeInstanceProperties) {
|
|
85
|
-
const this$ = this;
|
|
86
|
-
return filter((p) => (p.Name.toLocaleLowerCase() !== "properties"), filter((pd) => {
|
|
87
|
-
if (includeInstanceProperties) {
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
return pd.IsDynamic;
|
|
92
|
-
}
|
|
93
|
-
}, getPropertyHelpers(this$)));
|
|
94
|
-
}
|
|
95
|
-
GetProperties(includeInstanceProperties) {
|
|
96
|
-
const this$ = this;
|
|
97
|
-
return choose((kv) => {
|
|
98
|
-
if (kv.Name !== "properties") {
|
|
99
|
-
return [kv.Name, kv.GetValue(this$)];
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
return undefined;
|
|
103
|
-
}
|
|
104
|
-
}, this$.GetPropertyHelpers(includeInstanceProperties));
|
|
105
|
-
}
|
|
106
|
-
GetPropertyNames(includeInstanceProperties) {
|
|
107
|
-
const this$ = this;
|
|
108
|
-
return map_1((kv) => kv[0], this$.GetProperties(includeInstanceProperties));
|
|
109
|
-
}
|
|
110
|
-
CopyDynamicPropertiesTo(target, overWrite) {
|
|
111
|
-
const this$ = this;
|
|
112
|
-
const overWrite_1 = defaultArg(overWrite, false);
|
|
113
|
-
iterate((kv) => {
|
|
114
|
-
let pi;
|
|
115
|
-
const matchValue = target.TryGetPropertyHelper(kv[0]);
|
|
116
|
-
if (matchValue == null) {
|
|
117
|
-
target.SetProperty(kv[0], kv[1]);
|
|
118
|
-
}
|
|
119
|
-
else if ((pi = matchValue, overWrite_1)) {
|
|
120
|
-
const pi_1 = matchValue;
|
|
121
|
-
pi_1.SetValue(target, kv[1]);
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
throw new Error(`Property "${kv[0]}" already exists on target object and overWrite was not set to true.`);
|
|
125
|
-
}
|
|
126
|
-
}, this$.GetProperties(false));
|
|
127
|
-
}
|
|
128
|
-
CopyDynamicProperties() {
|
|
129
|
-
const this$ = this;
|
|
130
|
-
const target = new DynamicObj();
|
|
131
|
-
this$.CopyDynamicPropertiesTo(target);
|
|
132
|
-
return target;
|
|
133
|
-
}
|
|
134
|
-
static op_Dynamic(lookup, name) {
|
|
135
|
-
const matchValue = lookup.TryGetPropertyValue(name);
|
|
136
|
-
if (matchValue == null) {
|
|
137
|
-
throw new Error();
|
|
138
|
-
}
|
|
139
|
-
else {
|
|
140
|
-
return value_1(matchValue);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
static op_DynamicAssignment(lookup, name, value) {
|
|
144
|
-
lookup.SetProperty(name, value);
|
|
145
|
-
}
|
|
146
|
-
GetHashCode() {
|
|
147
|
-
const this$ = this;
|
|
148
|
-
return boxHashKeyValSeq(sortBy((pair) => pair[0], this$.GetProperties(true), {
|
|
149
|
-
Compare: comparePrimitives,
|
|
150
|
-
})) | 0;
|
|
151
|
-
}
|
|
152
|
-
Equals(o) {
|
|
153
|
-
let other;
|
|
154
|
-
const this$ = this;
|
|
155
|
-
return (o instanceof DynamicObj) && ((other = o, safeHash(this$) === safeHash(other)));
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export function DynamicObj_$reflection() {
|
|
160
|
-
return class_type("DynamicObj.DynamicObj", undefined, DynamicObj);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export function DynamicObj_$ctor() {
|
|
164
|
-
return new DynamicObj();
|
|
165
|
-
}
|
|
166
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|