iris-pex-embedded-python 3.1.6b2__py3-none-any.whl → 3.2.0b1__py3-none-any.whl
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.
Potentially problematic release.
This version of iris-pex-embedded-python might be problematic. Click here for more details.
- iop/_utils.py +38 -1
- iop/cls/IOP/Message/JSONSchema.cls +100 -0
- iop/cls/IOP/Message.cls +458 -1
- {iris_pex_embedded_python-3.1.6b2.dist-info → iris_pex_embedded_python-3.2.0b1.dist-info}/METADATA +2 -1
- {iris_pex_embedded_python-3.1.6b2.dist-info → iris_pex_embedded_python-3.2.0b1.dist-info}/RECORD +9 -8
- {iris_pex_embedded_python-3.1.6b2.dist-info → iris_pex_embedded_python-3.2.0b1.dist-info}/LICENSE +0 -0
- {iris_pex_embedded_python-3.1.6b2.dist-info → iris_pex_embedded_python-3.2.0b1.dist-info}/WHEEL +0 -0
- {iris_pex_embedded_python-3.1.6b2.dist-info → iris_pex_embedded_python-3.2.0b1.dist-info}/entry_points.txt +0 -0
- {iris_pex_embedded_python-3.1.6b2.dist-info → iris_pex_embedded_python-3.2.0b1.dist-info}/top_level.txt +0 -0
iop/_utils.py
CHANGED
|
@@ -6,6 +6,8 @@ import inspect
|
|
|
6
6
|
import xmltodict
|
|
7
7
|
import pkg_resources
|
|
8
8
|
import importlib
|
|
9
|
+
import json
|
|
10
|
+
from dc_schema import get_schema
|
|
9
11
|
|
|
10
12
|
class _Utils():
|
|
11
13
|
@staticmethod
|
|
@@ -33,6 +35,33 @@ class _Utils():
|
|
|
33
35
|
if path:
|
|
34
36
|
_Utils.raise_on_error(iris.cls('%SYSTEM.OBJ').LoadDir(path,'cubk',"*.cls",1))
|
|
35
37
|
|
|
38
|
+
@staticmethod
|
|
39
|
+
def register_message_schema(cls):
|
|
40
|
+
"""
|
|
41
|
+
It takes a class and registers the schema
|
|
42
|
+
|
|
43
|
+
:param cls: The class to register
|
|
44
|
+
"""
|
|
45
|
+
schema = get_schema(cls)
|
|
46
|
+
schema_name = cls.__module__ + '.' + cls.__name__
|
|
47
|
+
schema_str = json.dumps(schema)
|
|
48
|
+
categories = schema_name
|
|
49
|
+
_Utils.register_schema(schema_name,schema_str,categories)
|
|
50
|
+
|
|
51
|
+
@staticmethod
|
|
52
|
+
def register_schema(schema_name:str, schema_str:str,categories:str):
|
|
53
|
+
"""
|
|
54
|
+
It takes a schema name, a schema string, and a category string, and registers the schema
|
|
55
|
+
|
|
56
|
+
:param schema_name: The name of the schema
|
|
57
|
+
:type schema_name: str
|
|
58
|
+
:param schema_str: The schema as a string
|
|
59
|
+
:type schema_str: str
|
|
60
|
+
:param categories: The categories of the schema
|
|
61
|
+
:type categories: str
|
|
62
|
+
"""
|
|
63
|
+
_Utils.raise_on_error(iris.cls('IOP.Message.JSONSchema').Import(schema_str,categories,schema_name))
|
|
64
|
+
|
|
36
65
|
@staticmethod
|
|
37
66
|
def register_component(module:str,classname:str,path:str,overwrite:int=1,iris_classname:str='Python'):
|
|
38
67
|
"""
|
|
@@ -128,7 +157,7 @@ class _Utils():
|
|
|
128
157
|
extend = klass.bases[0].id
|
|
129
158
|
else:
|
|
130
159
|
extend = klass.bases[0].attr
|
|
131
|
-
if
|
|
160
|
+
if extend in ('BusinessOperation','BusinessProcess','BusinessService','DuplexService','DuplexProcess','DuplexOperation','InboundAdapter','OutboundAdapter'):
|
|
132
161
|
module = _Utils.filename_to_module(filename)
|
|
133
162
|
iris_class_name = f"{iris_package_name}.{module}.{klass.name}"
|
|
134
163
|
# strip "_" for iris class name
|
|
@@ -188,6 +217,8 @@ class _Utils():
|
|
|
188
217
|
list of dictionaries:
|
|
189
218
|
* key: the name of the production
|
|
190
219
|
* value: a dictionary containing the settings for the production
|
|
220
|
+
* SCHEMAS
|
|
221
|
+
List of classes
|
|
191
222
|
"""
|
|
192
223
|
path = None
|
|
193
224
|
# try to load the settings file
|
|
@@ -216,6 +247,12 @@ class _Utils():
|
|
|
216
247
|
_Utils.set_productions_settings(settings.PRODUCTIONS,path)
|
|
217
248
|
except AttributeError:
|
|
218
249
|
print("No productions to register")
|
|
250
|
+
try:
|
|
251
|
+
# set the schemas
|
|
252
|
+
for cls in settings.SCHEMAS:
|
|
253
|
+
_Utils.register_message_schema(cls)
|
|
254
|
+
except AttributeError:
|
|
255
|
+
print("No schemas to register")
|
|
219
256
|
try:
|
|
220
257
|
sys.path.remove(path)
|
|
221
258
|
except ValueError:
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
Class IOP.Message.JSONSchema Extends %Persistent
|
|
2
|
+
{
|
|
3
|
+
|
|
4
|
+
Property Name As %String;
|
|
5
|
+
|
|
6
|
+
Property Category As %String;
|
|
7
|
+
|
|
8
|
+
Property JSONSchema As %String(MAXLEN = "");
|
|
9
|
+
|
|
10
|
+
Index NameIndex On Name [ IdKey, Unique ];
|
|
11
|
+
|
|
12
|
+
/// Store the JSON Schema in this object
|
|
13
|
+
ClassMethod Import(
|
|
14
|
+
pSchema As %String,
|
|
15
|
+
pCategory As %String = "",
|
|
16
|
+
pName As %String) As %Status
|
|
17
|
+
{
|
|
18
|
+
Set pStatus = $$$OK
|
|
19
|
+
Try {
|
|
20
|
+
if ##class(IOP.Message.JSONSchema).%ExistsId(pName) {
|
|
21
|
+
Set tThis = ##class(IOP.Message.JSONSchema).%OpenId(pName)
|
|
22
|
+
Set tThis.Category = pCategory
|
|
23
|
+
Set tThis.JSONSchema = pSchema
|
|
24
|
+
$$$ThrowOnError(tThis.%Save())
|
|
25
|
+
} Else {
|
|
26
|
+
Set tThis = ##class(IOP.Message.JSONSchema).%New()
|
|
27
|
+
Set tThis.Name = pName
|
|
28
|
+
Set tThis.Category = pCategory
|
|
29
|
+
Set tThis.JSONSchema = pSchema
|
|
30
|
+
$$$ThrowOnError(tThis.%Save())
|
|
31
|
+
}
|
|
32
|
+
} Catch ex {
|
|
33
|
+
Set pStatus = ex.AsStatus()
|
|
34
|
+
}
|
|
35
|
+
Quit pStatus
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/// Get a stored schema by category and name
|
|
39
|
+
ClassMethod GetSchema(
|
|
40
|
+
pName As %String = "",
|
|
41
|
+
Output pSchema As %String) As %Status
|
|
42
|
+
{
|
|
43
|
+
Set pStatus = $$$OK
|
|
44
|
+
Try {
|
|
45
|
+
Set tSql = "SELECT JSONSchema FROM IOP_Message.JSONSchema WHERE Name = ?"
|
|
46
|
+
Set tStatement = ##class(%SQL.Statement).%New()
|
|
47
|
+
Do tStatement.%Prepare(tSql)
|
|
48
|
+
set rs = tStatement.%Execute(pName)
|
|
49
|
+
If rs.%Next() {
|
|
50
|
+
Set pSchema = rs.%Get("JSONSchema")
|
|
51
|
+
} Else {
|
|
52
|
+
Set pStatus = $$$ERROR($$$GeneralError, "Schema not found")
|
|
53
|
+
}
|
|
54
|
+
} Catch ex {
|
|
55
|
+
Set pStatus = ex.AsStatus()
|
|
56
|
+
}
|
|
57
|
+
Return pStatus
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/// Validate JSON data against a stored schema
|
|
61
|
+
ClassMethod ValidateJSONSchema(
|
|
62
|
+
pJSON As %String,
|
|
63
|
+
pName As %String) As %Status
|
|
64
|
+
{
|
|
65
|
+
Set tSC = $$$OK
|
|
66
|
+
Try {
|
|
67
|
+
Set tSchema = ""
|
|
68
|
+
Set tSC = ..GetSchema(pName, .tSchema)
|
|
69
|
+
If $$$ISERR(tSC) Return tSC
|
|
70
|
+
// Validate JSON data against schema
|
|
71
|
+
// To be implemented
|
|
72
|
+
Set tSC = $$$OK
|
|
73
|
+
} Catch ex {
|
|
74
|
+
Set tSC = ex.AsStatus()
|
|
75
|
+
}
|
|
76
|
+
Return tSC
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
Storage Default
|
|
80
|
+
{
|
|
81
|
+
<Data name="JSONSchemaDefaultData">
|
|
82
|
+
<Value name="1">
|
|
83
|
+
<Value>%%CLASSNAME</Value>
|
|
84
|
+
</Value>
|
|
85
|
+
<Value name="2">
|
|
86
|
+
<Value>JSONSchema</Value>
|
|
87
|
+
</Value>
|
|
88
|
+
<Value name="3">
|
|
89
|
+
<Value>Category</Value>
|
|
90
|
+
</Value>
|
|
91
|
+
</Data>
|
|
92
|
+
<DataLocation>^IOP.Message.JSONSchemaD</DataLocation>
|
|
93
|
+
<DefaultData>JSONSchemaDefaultData</DefaultData>
|
|
94
|
+
<IdLocation>^IOP.Message.JSONSchemaD</IdLocation>
|
|
95
|
+
<IndexLocation>^IOP.Message.JSONSchemaI</IndexLocation>
|
|
96
|
+
<StreamLocation>^IOP.Message.JSONSchemaS</StreamLocation>
|
|
97
|
+
<Type>%Storage.Persistent</Type>
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
}
|
iop/cls/IOP/Message.cls
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
Class IOP.Message Extends (Ens.MessageBody, %CSP.Page, %XML.Adaptor)
|
|
1
|
+
Class IOP.Message Extends (Ens.MessageBody, %CSP.Page, %XML.Adaptor, Ens.VDoc.Interface)
|
|
2
2
|
{
|
|
3
3
|
|
|
4
|
+
Parameter DOCCLASSNAME = "JSON Document";
|
|
5
|
+
|
|
6
|
+
Parameter DOCCLASSFULLNAME = "JSON Virtual Document";
|
|
7
|
+
|
|
8
|
+
Parameter DOCSHORTNAME = "JSON";
|
|
9
|
+
|
|
4
10
|
Parameter BUFFER = 1000000;
|
|
5
11
|
|
|
6
12
|
Property buffer As %String(MAXLEN = "") [ Calculated, Transient ];
|
|
@@ -21,6 +27,437 @@ Property jstr As %Stream.GlobalCharacter [ Internal, Private ];
|
|
|
21
27
|
|
|
22
28
|
Property type As %String(MAXLEN = 6) [ ReadOnly ];
|
|
23
29
|
|
|
30
|
+
Method GetValueAt(
|
|
31
|
+
pPropertyPath As %String = "",
|
|
32
|
+
pFormat As %String,
|
|
33
|
+
Output pStatus As %Status,
|
|
34
|
+
pDummy As %Boolean) As %String
|
|
35
|
+
{
|
|
36
|
+
Set pStatus = $$$OK
|
|
37
|
+
Try {
|
|
38
|
+
// Handle standard path queries
|
|
39
|
+
If pPropertyPath = "" Return ""
|
|
40
|
+
|
|
41
|
+
// pPropertyPath is formatted as :
|
|
42
|
+
// 1. "property1.property2.property3" for nested properties
|
|
43
|
+
// 2. "property1()" for all elements of an array or property1(*)
|
|
44
|
+
// 3. "property1(index).property2" for nested properties within an array
|
|
45
|
+
// 4. "property1(index)" for a specific element of an array
|
|
46
|
+
|
|
47
|
+
// Convert pPropertyPath to a a jsonpath
|
|
48
|
+
Set tPath = ..ConvertPath(pPropertyPath)
|
|
49
|
+
|
|
50
|
+
Set pyjson = ##class(%SYS.Python).Import("json")
|
|
51
|
+
Set jp = ##class(%SYS.Python).Import("jsonpath_ng")
|
|
52
|
+
Set builtins = ##class(%SYS.Python).Builtins()
|
|
53
|
+
|
|
54
|
+
Set tJSON = pyjson.loads(..json)
|
|
55
|
+
Set parser = jp.parse(tPath)
|
|
56
|
+
Set matches = parser.find(tJSON)
|
|
57
|
+
|
|
58
|
+
Set tResult = ""
|
|
59
|
+
// Return the first match
|
|
60
|
+
if matches."__len__"() = 1 {
|
|
61
|
+
Set match = matches."__getitem__"(0)
|
|
62
|
+
Set tResult = match."value"
|
|
63
|
+
}
|
|
64
|
+
ElseIf matches."__len__"() > 1 {
|
|
65
|
+
Set tResult = builtins.list()
|
|
66
|
+
For i=0:1:matches."__len__"()-1 {
|
|
67
|
+
Set match = matches."__getitem__"(i)
|
|
68
|
+
Do tResult.append(match."value")
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
Return tResult
|
|
73
|
+
|
|
74
|
+
} Catch ex {
|
|
75
|
+
Set pStatus = ex.AsStatus()
|
|
76
|
+
Return ""
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
ClassMethod ConvertPath(pPropertyPath As %String) As %String
|
|
81
|
+
{
|
|
82
|
+
// Convert pPropertyPath to a jsonpath just by replacing
|
|
83
|
+
// - '()' with '[*]'
|
|
84
|
+
// - '(index)' with '[index]'
|
|
85
|
+
// - '(' with '[' and ')' with ']'
|
|
86
|
+
// - if index is an integer, replace it with [index-1]
|
|
87
|
+
Set tPath = pPropertyPath
|
|
88
|
+
Set tPath = $Replace(tPath, "()", "[*]")
|
|
89
|
+
Set tPath = $Replace(tPath, "(", "[")
|
|
90
|
+
Set tPath = $Replace(tPath, ")", "]")
|
|
91
|
+
// Process each [] occurrence in the path
|
|
92
|
+
Set tPath = ..ProcessBrackets(tPath)
|
|
93
|
+
|
|
94
|
+
Return tPath
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
ClassMethod ProcessBrackets(pPath As %String) As %String
|
|
98
|
+
{
|
|
99
|
+
Set tPath = pPath
|
|
100
|
+
Set start = $Find(tPath, "[")
|
|
101
|
+
While start {
|
|
102
|
+
Set end = $Find(tPath, "]", start)
|
|
103
|
+
If 'end Quit // No matching closing bracket
|
|
104
|
+
|
|
105
|
+
// Extract the index between [ and ]
|
|
106
|
+
Set tIndex = $Extract(tPath, start, end-2)
|
|
107
|
+
|
|
108
|
+
// If index is numeric, decrease by 1 (0-based indexing)
|
|
109
|
+
If +tIndex {
|
|
110
|
+
Set newPath = $Extract(tPath, 1, start-1)
|
|
111
|
+
Set newPath = newPath _ (tIndex-1)
|
|
112
|
+
Set newPath = newPath _ $Extract(tPath, end-1, *)
|
|
113
|
+
Set tPath = newPath
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Move past this [] pair for next iteration
|
|
117
|
+
Set start = $Find(tPath, "[", end)
|
|
118
|
+
}
|
|
119
|
+
Return tPath
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
Method CopyValues(
|
|
123
|
+
pSource As Ens.VDoc.Interface,
|
|
124
|
+
pSourcePath As %String,
|
|
125
|
+
pTargetPath As %String,
|
|
126
|
+
pAction As %String,
|
|
127
|
+
pKey As %String,
|
|
128
|
+
pEmptyFieldAsNull As %Boolean = 0,
|
|
129
|
+
pIgnoreMissingSource As %Boolean = 0,
|
|
130
|
+
pGenerateEmptySegments As %Boolean = 0) As %Status
|
|
131
|
+
{
|
|
132
|
+
Set tSC = $$$OK
|
|
133
|
+
Try {
|
|
134
|
+
// Get source value
|
|
135
|
+
Set tValue = pSource.GetValueAt(pSourcePath, "String", .tSC, 0)
|
|
136
|
+
Return:$$$ISERR(tSC) tSC
|
|
137
|
+
|
|
138
|
+
// Set target value
|
|
139
|
+
Set tSC = ..SetValueAt(tValue, pTargetPath, pAction, pKey)
|
|
140
|
+
} Catch ex {
|
|
141
|
+
Set tSC = ex.AsStatus()
|
|
142
|
+
}
|
|
143
|
+
Return tSC
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
Method SetValueAt(
|
|
147
|
+
pValue As %String = "",
|
|
148
|
+
pPropertyPath As %String = "",
|
|
149
|
+
pAction As %String = "set",
|
|
150
|
+
pKey As %String = "") As %Status
|
|
151
|
+
{
|
|
152
|
+
Set tSC = $$$OK
|
|
153
|
+
// if pAction is set, use jsonpath to set the value
|
|
154
|
+
Try {
|
|
155
|
+
// Convert pPropertyPath to a a jsonpath
|
|
156
|
+
Set tPath = ..ConvertPath(pPropertyPath)
|
|
157
|
+
|
|
158
|
+
Set pyjson = ##class(%SYS.Python).Import("json")
|
|
159
|
+
Set jp = ##class(%SYS.Python).Import("jsonpath_ng")
|
|
160
|
+
Set builtins = ##class(%SYS.Python).Builtins()
|
|
161
|
+
|
|
162
|
+
if ..json = "" {
|
|
163
|
+
Set ..json = "{}"
|
|
164
|
+
}
|
|
165
|
+
Set tJSON = pyjson.loads(..json)
|
|
166
|
+
|
|
167
|
+
Set parser = jp.parse(tPath)
|
|
168
|
+
if pAction = "set" {
|
|
169
|
+
Set tJSON = parser."update_or_create"(tJSON, pValue)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
Set tResult = pyjson.dumps(tJSON)
|
|
173
|
+
Set ..json = tResult
|
|
174
|
+
Set ..classname = ..DocType
|
|
175
|
+
|
|
176
|
+
} Catch ex {
|
|
177
|
+
Set tSC = ex.AsStatus()
|
|
178
|
+
}
|
|
179
|
+
Return tSC
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
Method IsValid() As %Status
|
|
183
|
+
{
|
|
184
|
+
Return $$$OK
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
Method Validate(pValidationSpec As %String = "") As %Status
|
|
188
|
+
{
|
|
189
|
+
If ..DocType = "" Return $$$ERROR($$$GeneralError, "No DocType specified")
|
|
190
|
+
|
|
191
|
+
// Validate against stored schema
|
|
192
|
+
Return ##class(IOP.Message.JSONSchema).ValidateJSON(tJSON, ..DocTypeCategory, ..DocTypeName)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
Method ParentMany(Output pParentsList) As %Integer
|
|
196
|
+
{
|
|
197
|
+
Return 0
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/// Returns a list of available DocTypes by querying the JSONSchema storage.
|
|
201
|
+
Query EnumerateDocTypes(
|
|
202
|
+
Category As %String = "",
|
|
203
|
+
IncludeBase As %Boolean = 0) As %Query(CONTAINID = 0, ROWSPEC = "Type:%String")
|
|
204
|
+
{
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
ClassMethod EnumerateDocTypesExecute(
|
|
208
|
+
ByRef qHandle As %Binary,
|
|
209
|
+
pName As %String = "",
|
|
210
|
+
IncludeBase As %Boolean) As %Status
|
|
211
|
+
{
|
|
212
|
+
Kill qHandle
|
|
213
|
+
Set qHandle = 0
|
|
214
|
+
Set sql = "SELECT Name FROM IOP_Message.JSONSchema"
|
|
215
|
+
If pName '= "" {
|
|
216
|
+
Set sql = sql _ " WHERE Name = ?"
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
Set stmt = ##class(%SQL.Statement).%New()
|
|
220
|
+
Set tSC = stmt.%Prepare(sql)
|
|
221
|
+
Quit:$$$ISERR(tSC) tSC
|
|
222
|
+
|
|
223
|
+
If pName '= "" {
|
|
224
|
+
Set rs = stmt.%Execute(pName)
|
|
225
|
+
} Else {
|
|
226
|
+
Set rs = stmt.%Execute()
|
|
227
|
+
}
|
|
228
|
+
While rs.%Next() {
|
|
229
|
+
Set qHandle($I(qHandle)) = rs.%Get("Name")
|
|
230
|
+
}
|
|
231
|
+
set qHandle = 0
|
|
232
|
+
Quit $$$OK
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
ClassMethod EnumerateDocTypesFetch(
|
|
236
|
+
ByRef qHandle As %Binary,
|
|
237
|
+
ByRef qRow As %List,
|
|
238
|
+
ByRef AtEnd As %Integer = 0) As %Status
|
|
239
|
+
{
|
|
240
|
+
Set qHandle = $O(qHandle(qHandle))
|
|
241
|
+
If qHandle = "" {
|
|
242
|
+
Set qRow = "", AtEnd = 1
|
|
243
|
+
Quit $$$OK
|
|
244
|
+
}
|
|
245
|
+
Set qRow = $LB(qHandle(qHandle))
|
|
246
|
+
Quit $$$OK
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
ClassMethod EnumerateDocTypesClose(ByRef qHandle As %Binary) As %Status
|
|
250
|
+
{
|
|
251
|
+
Kill qHandle
|
|
252
|
+
Quit $$$OK
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/// Returns a list of schema categories from the JSONSchema storage.
|
|
256
|
+
Query EnumerateTypeCategories(Standard As %String = "") As %Query(CONTAINID = 0, ROWSPEC = "Category:%String,Description:%String,IsStandard:%Boolean,Base:%String")
|
|
257
|
+
{
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
ClassMethod EnumerateTypeCategoriesExecute(
|
|
261
|
+
ByRef qHandle As %Binary,
|
|
262
|
+
pStandard As %String = "") As %Status
|
|
263
|
+
{
|
|
264
|
+
Kill qHandle
|
|
265
|
+
Set qHandle = 0
|
|
266
|
+
Set sql = "SELECT Category, Name FROM IOP_Message.JSONSchema"
|
|
267
|
+
|
|
268
|
+
Set stmt = ##class(%SQL.Statement).%New()
|
|
269
|
+
Set tSC = stmt.%Prepare(sql)
|
|
270
|
+
Quit:$$$ISERR(tSC) tSC
|
|
271
|
+
|
|
272
|
+
Set rs = stmt.%Execute()
|
|
273
|
+
|
|
274
|
+
While rs.%Next() {
|
|
275
|
+
Set category = rs.%Get(1)
|
|
276
|
+
// Format: Category, Description, IsStandard, Base
|
|
277
|
+
Set qHandle($I(qHandle)) = $LB(category, "JSON Schema category", "IsStandard", "Base")
|
|
278
|
+
}
|
|
279
|
+
Set qHandle = 0
|
|
280
|
+
Quit $$$OK
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
ClassMethod EnumerateTypeCategoriesFetch(
|
|
284
|
+
ByRef qHandle As %Binary,
|
|
285
|
+
ByRef Row As %List,
|
|
286
|
+
ByRef AtEnd As %Integer = 0) As %Status
|
|
287
|
+
{
|
|
288
|
+
Set qHandle = $O(qHandle(qHandle))
|
|
289
|
+
If qHandle = "" {
|
|
290
|
+
Set Row = "", AtEnd = 1
|
|
291
|
+
Quit $$$OK
|
|
292
|
+
}
|
|
293
|
+
Set Row = qHandle(qHandle)
|
|
294
|
+
Quit $$$OK
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
ClassMethod EnumerateTypeCategoriesClose(ByRef qHandle As %Binary) As %Status
|
|
298
|
+
{
|
|
299
|
+
Kill qHandle
|
|
300
|
+
Quit $$$OK
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/// Returns array of properties that make up the <i>contents</i>
|
|
304
|
+
/// of this object.<br>
|
|
305
|
+
/// This method in implemented within the document class.<br>
|
|
306
|
+
/// The content array is in the form:<br>
|
|
307
|
+
/// pContents(n,"type")="%String"<br>
|
|
308
|
+
/// pContents(n,"name")="Field"<br>
|
|
309
|
+
/// pContents(n,"alias")=alias code<br>
|
|
310
|
+
/// If pContents(n) is non-zero then the property is a composite type with<br>
|
|
311
|
+
/// sub-properties. The sub-properties are indexed with a similar structure under<br>
|
|
312
|
+
/// pContents(n,m) where m is the index of the subtype property.<br>
|
|
313
|
+
ClassMethod GetContentArray(
|
|
314
|
+
Output pContents,
|
|
315
|
+
pMode As %String,
|
|
316
|
+
pDocType As %String = "MESSAGE",
|
|
317
|
+
pLevel As %Integer,
|
|
318
|
+
pIncludeBase As %Boolean = 0) As %Status
|
|
319
|
+
{
|
|
320
|
+
Set tSC = $$$OK
|
|
321
|
+
Try {
|
|
322
|
+
// Get schema structure
|
|
323
|
+
Set tName = pDocType
|
|
324
|
+
#; Set tName = $Piece(pDocType, ":", 2)
|
|
325
|
+
|
|
326
|
+
Set tSC = ##class(IOP.Message.JSONSchema).GetSchema(tName, .json)
|
|
327
|
+
If $$$ISERR(tSC) Return tSC
|
|
328
|
+
set schema = {}.%FromJSON(json)
|
|
329
|
+
|
|
330
|
+
$$$ThrowOnError(##class(IOP.Message.Document).SchemaToContents(schema, .tContents))
|
|
331
|
+
|
|
332
|
+
Merge @pContents = tContents
|
|
333
|
+
}
|
|
334
|
+
Catch ex {
|
|
335
|
+
Set tSC = ex.AsStatus()
|
|
336
|
+
}
|
|
337
|
+
Return $$$OK
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/// Convert a JSON schema structure into a contents array format
|
|
341
|
+
/// schema: Dynamic object containing the JSON schema
|
|
342
|
+
/// Output pContents: Array to store the contents structure
|
|
343
|
+
/// Returns: %Status
|
|
344
|
+
ClassMethod SchemaToContents(
|
|
345
|
+
schema As %DynamicObject,
|
|
346
|
+
Output pContents) As %Status
|
|
347
|
+
{
|
|
348
|
+
Set tSC = $$$OK
|
|
349
|
+
Try {
|
|
350
|
+
Set idx = 0
|
|
351
|
+
Do ..ProcessProperties(schema.properties, .idx, .pContents, schema)
|
|
352
|
+
}
|
|
353
|
+
Catch ex {
|
|
354
|
+
Set tSC = ex.AsStatus()
|
|
355
|
+
}
|
|
356
|
+
Return tSC
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
ClassMethod ProcessProperties(
|
|
360
|
+
properties As %DynamicObject,
|
|
361
|
+
ByRef idx As %Integer,
|
|
362
|
+
Output pContents,
|
|
363
|
+
schema As %DynamicObject) As %Status
|
|
364
|
+
{
|
|
365
|
+
Set iterator = properties.%GetIterator()
|
|
366
|
+
While iterator.%GetNext(.key, .value) {
|
|
367
|
+
Set idx = idx + 1
|
|
368
|
+
Do ..HandleProperty(value, .key, idx, .pContents, schema)
|
|
369
|
+
}
|
|
370
|
+
Return $$$OK
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
ClassMethod HandleProperty(
|
|
374
|
+
value As %DynamicObject,
|
|
375
|
+
ByRef key As %String,
|
|
376
|
+
idx As %Integer,
|
|
377
|
+
Output pContents,
|
|
378
|
+
schema As %DynamicObject)
|
|
379
|
+
{
|
|
380
|
+
Set type = value.type
|
|
381
|
+
|
|
382
|
+
If type = "string" || type = "number" || type = "boolean" {
|
|
383
|
+
Do ..HandlePrimitiveType(type, idx, .pContents)
|
|
384
|
+
}
|
|
385
|
+
ElseIf type = "array" {
|
|
386
|
+
Do ..HandleArrayType(value, .key, idx, .pContents, schema)
|
|
387
|
+
}
|
|
388
|
+
ElseIf type = "object" {
|
|
389
|
+
Do ..HandleObjectType(value, idx, .pContents)
|
|
390
|
+
}
|
|
391
|
+
ElseIf $IsObject(value.allOf) {
|
|
392
|
+
Do ..HandleAllOfType(value, key, idx, .pContents, schema)
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
If type = "array" Set key = key_"()"
|
|
396
|
+
Set pContents(idx,"name") = key
|
|
397
|
+
Set pContents(idx,"alias") = key
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
ClassMethod HandlePrimitiveType(
|
|
401
|
+
type As %String,
|
|
402
|
+
idx As %Integer,
|
|
403
|
+
Output pContents)
|
|
404
|
+
{
|
|
405
|
+
Set pContents(idx,"type") = $Case(type,
|
|
406
|
+
"string": "%String",
|
|
407
|
+
"number": "%Numeric",
|
|
408
|
+
"boolean": "%Boolean")
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
ClassMethod HandleArrayType(
|
|
412
|
+
value As %DynamicObject,
|
|
413
|
+
ByRef key As %String,
|
|
414
|
+
idx As %Integer,
|
|
415
|
+
Output pContents,
|
|
416
|
+
schema As %DynamicObject)
|
|
417
|
+
{
|
|
418
|
+
Set pContents(idx,"type") = "()"
|
|
419
|
+
If $IsObject(value.items) && $IsObject(value.items.allOf) {
|
|
420
|
+
Do ..HandleAllOfType(value.items, key, idx, .pContents, schema)
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
ClassMethod HandleObjectType(
|
|
425
|
+
value As %DynamicObject,
|
|
426
|
+
idx As %Integer,
|
|
427
|
+
Output pContents)
|
|
428
|
+
{
|
|
429
|
+
Set pContents(idx,"type") = "object"
|
|
430
|
+
If $IsObject(value.properties) {
|
|
431
|
+
Do ..SchemaToContents(value, .subContents)
|
|
432
|
+
Merge @pContents(idx) = subContents
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
ClassMethod HandleAllOfType(
|
|
437
|
+
value As %DynamicObject,
|
|
438
|
+
key As %String,
|
|
439
|
+
idx As %Integer,
|
|
440
|
+
Output pContents,
|
|
441
|
+
schema As %DynamicObject)
|
|
442
|
+
{
|
|
443
|
+
Set pContents(idx) = 1 //TODO size of subContents
|
|
444
|
+
Set pContents(idx,"type") = "object"
|
|
445
|
+
Set pContents(idx,"name") = key
|
|
446
|
+
Set pContents(idx,"alias") = key
|
|
447
|
+
|
|
448
|
+
Set allOfIterator = value.allOf.%GetIterator()
|
|
449
|
+
While allOfIterator.%GetNext(.allOfKey, .allOfValue) {
|
|
450
|
+
If $IsObject(allOfValue."$ref") {
|
|
451
|
+
Do ..SchemaToContents(allOfValue."$ref", .subContents)
|
|
452
|
+
}
|
|
453
|
+
Else {
|
|
454
|
+
Set tDef = schema."$defs".%Get($Piece(allOfValue."$ref","/",*))
|
|
455
|
+
Do ..SchemaToContents(tDef, .subContents)
|
|
456
|
+
}
|
|
457
|
+
Merge pContents(idx) = subContents
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
|
|
24
461
|
Method bufferGet()
|
|
25
462
|
{
|
|
26
463
|
Quit ..#BUFFER
|
|
@@ -185,6 +622,26 @@ Storage Default
|
|
|
185
622
|
<Value name="6">
|
|
186
623
|
<Value>jsonString</Value>
|
|
187
624
|
</Value>
|
|
625
|
+
<Value name="7">
|
|
626
|
+
<Value>DocType</Value>
|
|
627
|
+
</Value>
|
|
628
|
+
<Value name="8">
|
|
629
|
+
<Value>TimeCreated</Value>
|
|
630
|
+
</Value>
|
|
631
|
+
<Value name="9">
|
|
632
|
+
<Value>Source</Value>
|
|
633
|
+
</Value>
|
|
634
|
+
<Value name="10">
|
|
635
|
+
<Value>IsMutable</Value>
|
|
636
|
+
</Value>
|
|
637
|
+
<Value name="11">
|
|
638
|
+
<Value>OriginalDocId</Value>
|
|
639
|
+
</Value>
|
|
640
|
+
</Data>
|
|
641
|
+
<Data name="UserValues">
|
|
642
|
+
<Attribute>UserValues</Attribute>
|
|
643
|
+
<Structure>subnode</Structure>
|
|
644
|
+
<Subscript>"IOP.Message.UserValues"</Subscript>
|
|
188
645
|
</Data>
|
|
189
646
|
<Data name="jsonObject">
|
|
190
647
|
<Attribute>jsonObject</Attribute>
|
{iris_pex_embedded_python-3.1.6b2.dist-info → iris_pex_embedded_python-3.2.0b1.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: iris_pex_embedded_python
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.2.0b1
|
|
4
4
|
Summary: Iris Interoperability based on Embedded Python
|
|
5
5
|
Author-email: grongier <guillaume.rongier@intersystems.com>
|
|
6
6
|
License: MIT License
|
|
@@ -48,6 +48,7 @@ Requires-Dist: dacite>=1.6.0
|
|
|
48
48
|
Requires-Dist: xmltodict>=0.12.0
|
|
49
49
|
Requires-Dist: iris-embedded-python-wrapper>=0.0.6
|
|
50
50
|
Requires-Dist: setuptools>=40.8.0
|
|
51
|
+
Requires-Dist: dc-schema>=0.0.8
|
|
51
52
|
|
|
52
53
|
# IoP (Interoperability On Python)
|
|
53
54
|
|
{iris_pex_embedded_python-3.1.6b2.dist-info → iris_pex_embedded_python-3.2.0b1.dist-info}/RECORD
RENAMED
|
@@ -105,14 +105,14 @@ iop/_outbound_adapter.py,sha256=YTAhLrRf9chEAd53mV6KKbpaHOKNOKJHoGgj5wakRR0,726
|
|
|
105
105
|
iop/_pickle_message.py,sha256=noKfc2VkXufV3fqjKvNHN_oANQ1YN9ffCaSV0XSTAIE,331
|
|
106
106
|
iop/_private_session_duplex.py,sha256=36OwAGlasbPtfwq2KgMFcr3a33RsNSqohJx243XcDWI,5153
|
|
107
107
|
iop/_private_session_process.py,sha256=pGjWFOQhWpQxUVpTtvNKTPvDxgzjfw0VC4Aqj3KUq8w,1704
|
|
108
|
-
iop/_utils.py,sha256=
|
|
108
|
+
iop/_utils.py,sha256=c59QrgQgrk528V_n6RInnq_N6RzIGAAEmaTGRwanTSI,19404
|
|
109
109
|
iop/cls/IOP/BusinessOperation.cls,sha256=lrymqZ8wHl5kJjXwdjbQVs5sScV__yIWGh-oGbiB_X0,914
|
|
110
110
|
iop/cls/IOP/BusinessProcess.cls,sha256=s3t38w1ykHqM26ETcbCYLt0ocjZyVVahm-_USZkuJ1E,2855
|
|
111
111
|
iop/cls/IOP/BusinessService.cls,sha256=7ebn32J9PiZXUgXuh5Xxm_7X6zHBiqkJr9c_dWxbPO8,1021
|
|
112
112
|
iop/cls/IOP/Common.cls,sha256=4f4ZpLj8fsj8IKJDNb9pKoCokzo522JHWX0OqpAaC5g,11192
|
|
113
113
|
iop/cls/IOP/Director.cls,sha256=M43LoTb6lwSr0J81RFxi1YLW1mwda09wQ7Xqr3nBtxo,2008
|
|
114
114
|
iop/cls/IOP/InboundAdapter.cls,sha256=GeoCm6q5HcLJ5e4VxgqXiErJXqolBbpKwpunaNzpvjU,610
|
|
115
|
-
iop/cls/IOP/Message.cls,sha256=
|
|
115
|
+
iop/cls/IOP/Message.cls,sha256=er1TcG1UDKIpiStyXT0-zKHWxIrikmV6yzUTvFGYSB0,21932
|
|
116
116
|
iop/cls/IOP/OutboundAdapter.cls,sha256=9eOwy5ojwcTzwrHs6LNrFQvUD8aqcoNCZrILN1ycdDM,958
|
|
117
117
|
iop/cls/IOP/PickleMessage.cls,sha256=S3y7AClQ8mAILjxPuHdCjGosBZYzGbUQ5WTv4mYPNMQ,1673
|
|
118
118
|
iop/cls/IOP/Test.cls,sha256=gAC9PEfMZsvAEWIa241-ug2FWAhITbN1SOispZzJPnI,2094
|
|
@@ -120,6 +120,7 @@ iop/cls/IOP/Utils.cls,sha256=ZTBr02spm4ppxVBfhnUwb08BmhTjG5-ZbItRshYHs1I,13746
|
|
|
120
120
|
iop/cls/IOP/Duplex/Operation.cls,sha256=K_fmgeLjPZQbHgNrc0kd6DUQoW0fDn1VHQjJxHo95Zk,525
|
|
121
121
|
iop/cls/IOP/Duplex/Process.cls,sha256=xbefZ4z84a_IUhavWN6P_gZBzqkdJ5XRTXxro6iDvAg,6986
|
|
122
122
|
iop/cls/IOP/Duplex/Service.cls,sha256=sTMOQUCMBgVitmQkM8bbsrmrRtCdj91VlctJ3I7b8WU,161
|
|
123
|
+
iop/cls/IOP/Message/JSONSchema.cls,sha256=KLx7qYbfRehuvof1j3bBYiaVtqKPxuddrmDaKl5S_rE,2570
|
|
123
124
|
iop/cls/IOP/PrivateSession/Duplex.cls,sha256=8a_dO7E2RTzuxzoufryjlS41l-99NmTtOcmFXOnSwA8,7957
|
|
124
125
|
iop/cls/IOP/PrivateSession/Message/Ack.cls,sha256=y6-5uSVod36bxeQuT2ytPN4TUAfM1mvGGJuTbWbpNv4,941
|
|
125
126
|
iop/cls/IOP/PrivateSession/Message/Poll.cls,sha256=z3ALYmGYQasTcyYNyBeoHzJdNXI4nBO_N8Cqo9l4sQY,942
|
|
@@ -129,9 +130,9 @@ iop/cls/IOP/Service/WSGI.cls,sha256=VLNCXEwmHW9dBnE51uGE1nvGX6T4HjhqePT3LVhsjAE,
|
|
|
129
130
|
iop/wsgi/handlers.py,sha256=NrFLo_YbAh-x_PlWhAiWkQnUUN2Ss9HoEm63dDWCBpQ,2947
|
|
130
131
|
irisnative/_IRISNative.py,sha256=HQ4nBhc8t8_5OtxdMG-kx1aa-T1znf2I8obZOPLOPzg,665
|
|
131
132
|
irisnative/__init__.py,sha256=6YmvBLQSURsCPKaNg7LK-xpo4ipDjrlhKuwdfdNb3Kg,341
|
|
132
|
-
iris_pex_embedded_python-3.
|
|
133
|
-
iris_pex_embedded_python-3.
|
|
134
|
-
iris_pex_embedded_python-3.
|
|
135
|
-
iris_pex_embedded_python-3.
|
|
136
|
-
iris_pex_embedded_python-3.
|
|
137
|
-
iris_pex_embedded_python-3.
|
|
133
|
+
iris_pex_embedded_python-3.2.0b1.dist-info/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
|
|
134
|
+
iris_pex_embedded_python-3.2.0b1.dist-info/METADATA,sha256=EfLIlTJcv2YZAgp8jrL4hGJXyGPmcHAvrZqdjfqKS8Y,4393
|
|
135
|
+
iris_pex_embedded_python-3.2.0b1.dist-info/WHEEL,sha256=A3WOREP4zgxI0fKrHUG8DC8013e3dK3n7a6HDbcEIwE,91
|
|
136
|
+
iris_pex_embedded_python-3.2.0b1.dist-info/entry_points.txt,sha256=pj-i4LSDyiSP6xpHlVjMCbg1Pik7dC3_sdGY3Yp9Vhk,38
|
|
137
|
+
iris_pex_embedded_python-3.2.0b1.dist-info/top_level.txt,sha256=VWDlX4YF4qFVRGrG3-Gs0kgREol02i8gIpsHNbhfFPw,42
|
|
138
|
+
iris_pex_embedded_python-3.2.0b1.dist-info/RECORD,,
|
{iris_pex_embedded_python-3.1.6b2.dist-info → iris_pex_embedded_python-3.2.0b1.dist-info}/LICENSE
RENAMED
|
File without changes
|
{iris_pex_embedded_python-3.1.6b2.dist-info → iris_pex_embedded_python-3.2.0b1.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|