@qooxdoo/framework 7.0.0-beta.2 → 7.0.0-beta.6
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/CHANGELOG.md +12 -0
- package/Manifest.json +2 -3
- package/README.md +7 -3
- package/bin/deploy/qx +0 -0
- package/lib/compiler/compile-info.json +44 -45
- package/lib/compiler/index.js +1971 -8371
- package/lib/resource/qx/tool/cli/templates/loader/loader-node.tmpl.js +3 -1
- package/lib/resource/qx/tool/cli/templates/skeleton/mobile/source/theme/custom/css/custom.css +1 -1
- package/lib/resource/qx/tool/cli/templates/skeleton/mobile/source/theme/custom/css/custom.css.map +1 -1
- package/lib/resource/qx/tool/cli/templates/template_vars.js +1 -1
- package/lib/resource/qx/tool/loadsass.js +6 -12
- package/lib/resource/qx/tool/schema/Manifest-1-0-0.json +1 -2
- package/lib/resource/qx/tool/schema/Manifest-2-0-0.json +1 -2
- package/lib/resource/qx/tool/schema/compile-1-0-0.json +3 -7
- package/package.json +25 -12
- package/source/class/qx/io/__init__.js +5 -3
- package/source/class/qx/io/exception/Cancel.js +34 -0
- package/source/class/qx/io/exception/Exception.js +38 -0
- package/source/class/qx/{tool/compiler/Version.js → io/exception/Protocol.js} +13 -7
- package/source/class/qx/io/exception/Transport.js +39 -0
- package/source/class/qx/io/exception/__init__.js +4 -0
- package/source/class/qx/io/graphql/Client.js +112 -0
- package/source/class/qx/io/graphql/__init__.js +9 -0
- package/source/class/qx/io/graphql/protocol/Message.js +65 -0
- package/source/class/qx/io/graphql/protocol/Request.js +95 -0
- package/source/class/qx/io/graphql/protocol/Response.js +61 -0
- package/source/class/qx/io/graphql/protocol/__init__.js +6 -0
- package/source/class/qx/io/jsonrpc/Client.js +323 -0
- package/source/class/qx/io/jsonrpc/__init__.js +15 -0
- package/source/class/qx/io/jsonrpc/protocol/Batch.js +97 -0
- package/source/class/qx/io/jsonrpc/protocol/Error.js +63 -0
- package/source/class/qx/io/jsonrpc/protocol/Message.js +48 -0
- package/source/class/qx/io/jsonrpc/protocol/Notification.js +45 -0
- package/source/class/qx/io/jsonrpc/protocol/Parser.js +81 -0
- package/source/class/qx/io/jsonrpc/protocol/Request.js +93 -0
- package/source/class/qx/io/jsonrpc/protocol/Result.js +48 -0
- package/source/class/qx/io/jsonrpc/protocol/__init__.js +5 -0
- package/source/class/qx/io/request/authentication/Bearer.js +52 -0
- package/source/class/qx/io/transport/AbstractClient.js +100 -0
- package/source/class/qx/io/transport/AbstractTransport.js +41 -0
- package/source/class/qx/io/transport/Fetch.js +95 -0
- package/source/class/qx/io/transport/ITransport.js +40 -0
- package/source/class/qx/io/transport/PostMessage.js +55 -0
- package/source/class/qx/io/transport/Websocket.js +97 -0
- package/source/class/qx/io/transport/Xhr.js +139 -0
- package/source/class/qx/io/transport/__init__.js +18 -0
- package/source/class/qx/test/io/MAssert.js +46 -0
- package/source/class/qx/test/io/graphql/Client.js +169 -0
- package/source/class/qx/test/io/graphql/ClientFetch.js +34 -0
- package/source/class/qx/test/io/graphql/Request.js +42 -0
- package/source/class/qx/test/io/jsonrpc/Client.js +267 -0
- package/source/class/qx/test/io/jsonrpc/Protocol.js +80 -0
- package/source/class/qx/test/io/transport/PostMessage.js +56 -0
- package/source/class/qx/test/io/transport/Websocket.js +63 -0
- package/source/class/qx/test/ui/embed/Iframe.js +1 -0
- package/source/class/qx/test/ui/form/ComboBox.js +0 -42
- package/source/class/qx/test/util/DateFormat.js +45 -6
- package/source/class/qx/theme/manager/Decoration.js +0 -0
- package/source/class/qx/theme/tangible/ColorDark.js +0 -0
- package/source/class/qx/tool/cli/Cli.js +5 -3
- package/source/class/qx/tool/cli/api/CompilerApi.js +15 -5
- package/source/class/qx/tool/cli/commands/Command.js +7 -0
- package/source/class/qx/tool/cli/commands/Compile.js +4 -4
- package/source/class/qx/tool/cli/commands/Lint.js +30 -11
- package/source/class/qx/tool/cli/commands/Package.js +1 -2
- package/source/class/qx/tool/cli/commands/package/Publish.js +33 -10
- package/source/class/qx/tool/compiler/Analyser.js +21 -22
- package/source/class/qx/tool/compiler/app/WebFont.js +1 -1
- package/source/class/qx/tool/compiler/makers/AppMaker.js +15 -14
- package/source/class/qx/tool/compiler/targets/Target.js +2 -1
- package/source/class/qx/tool/compiler/targets/TypeScriptWriter.js +1 -2
- package/source/class/qx/tool/compiler/targets/meta/PolyfillJs.js +17 -9
- package/source/class/qx/tool/config/Abstract.js +3 -3
- package/source/class/qx/tool/config/Utils.js +10 -1
- package/source/class/qx/tool/utils/Json.js +1 -1
- package/source/class/qx/ui/container/SlideBar.js +3 -0
- package/source/class/qx/ui/core/Widget.js +70 -0
- package/source/class/qx/ui/core/scroll/NativeScrollBar.js +3 -0
- package/source/class/qx/ui/core/scroll/ScrollBar.js +3 -0
- package/source/class/qx/ui/form/AbstractSelectBox.js +38 -6
- package/source/class/qx/ui/form/Button.js +3 -0
- package/source/class/qx/ui/form/CheckBox.js +25 -1
- package/source/class/qx/ui/form/ComboBox.js +41 -27
- package/source/class/qx/ui/form/DateField.js +16 -1
- package/source/class/qx/ui/form/List.js +3 -0
- package/source/class/qx/ui/form/MenuButton.js +28 -2
- package/source/class/qx/ui/form/RadioButton.js +7 -0
- package/source/class/qx/ui/form/RadioButtonGroup.js +3 -0
- package/source/class/qx/ui/form/RadioGroup.js +19 -0
- package/source/class/qx/ui/form/SelectBox.js +28 -1
- package/source/class/qx/ui/form/Slider.js +15 -0
- package/source/class/qx/ui/form/SplitButton.js +3 -0
- package/source/class/qx/ui/form/ToggleButton.js +8 -0
- package/source/class/qx/ui/menu/AbstractButton.js +28 -0
- package/source/class/qx/ui/menu/Button.js +3 -0
- package/source/class/qx/ui/menu/CheckBox.js +8 -0
- package/source/class/qx/ui/menu/Manager.js +2 -0
- package/source/class/qx/ui/menu/Menu.js +74 -2
- package/source/class/qx/ui/menu/RadioButton.js +10 -1
- package/source/class/qx/ui/menubar/Button.js +0 -27
- package/source/class/qx/ui/menubar/MenuBar.js +12 -0
- package/source/class/qx/ui/splitpane/Blocker.js +3 -0
- package/source/class/qx/ui/splitpane/Pane.js +3 -0
- package/source/class/qx/ui/table/Table.js +24 -2
- package/source/class/qx/ui/table/cellrenderer/Abstract.js +3 -1
- package/source/class/qx/ui/table/cellrenderer/AbstractImage.js +7 -3
- package/source/class/qx/ui/table/headerrenderer/HeaderCell.js +3 -0
- package/source/class/qx/ui/table/pane/Header.js +3 -0
- package/source/class/qx/ui/table/pane/Model.js +10 -4
- package/source/class/qx/ui/table/pane/Scroller.js +3 -7
- package/source/class/qx/ui/table/rowrenderer/Default.js +1 -1
- package/source/class/qx/ui/tabview/Page.js +26 -0
- package/source/class/qx/ui/tabview/TabView.js +3 -0
- package/source/class/qx/ui/toolbar/Button.js +2 -27
- package/source/class/qx/ui/toolbar/CheckBox.js +0 -27
- package/source/class/qx/ui/toolbar/RadioButton.js +21 -0
- package/source/class/qx/ui/toolbar/SplitButton.js +0 -28
- package/source/class/qx/ui/toolbar/ToolBar.js +3 -0
- package/source/class/qx/ui/window/Window.js +8 -0
- package/source/class/qx/util/format/DateFormat.js +44 -17
- package/source/class/qxWeb.js +2 -0
- package/source/resource/qx/decoration/Indigo/font/JosefinSlab-SemiBold.ttf +0 -0
- package/source/resource/qx/decoration/Indigo/font/SIL Open Font License 1.1.txt +0 -0
- package/source/resource/qx/iconfont/MaterialIcons/fetch-fonts.sh +0 -0
- package/source/resource/qx/tool/bin/build-devtools +0 -0
- package/source/resource/qx/tool/bin/build-website +0 -0
- package/source/resource/qx/tool/bin/download-assets +0 -0
- package/source/resource/qx/tool/cli/templates/loader/loader-node.tmpl.js +3 -1
- package/source/resource/qx/tool/cli/templates/template_vars.js +1 -1
- package/source/resource/qx/tool/loadsass.js +6 -12
- package/source/resource/qx/tool/schema/Manifest-1-0-0.json +1 -2
- package/source/resource/qx/tool/schema/Manifest-2-0-0.json +1 -2
- package/source/resource/qx/tool/schema/compile-1-0-0.json +3 -7
- package/source/translation/hr.po +297 -0
- package/lib/resource/qx/tool/website/.gitignore +0 -2
- package/source/class/qx/io/request/auth/.gitignore +0 -0
- package/source/class/qx/test/bom/client/.gitignore +0 -0
- package/source/class/qx/test/ui/control/.gitignore +0 -0
- package/source/resource/qx/decoration/Modern/treevirtual/.gitignore +0 -0
- package/source/resource/qx/mobile/css/.gitignore +0 -3
- package/source/resource/qx/tool/website/.gitignore +0 -2
- package/source/resource/qx/website/.gitignore +0 -1
- package/source/resource/qx/website/scss/.gitignore +0 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* ************************************************************************
|
|
2
|
+
|
|
3
|
+
qooxdoo - the new era of web development
|
|
4
|
+
|
|
5
|
+
http://qooxdoo.org
|
|
6
|
+
|
|
7
|
+
Copyright:
|
|
8
|
+
2020 Christian Boulanger
|
|
9
|
+
|
|
10
|
+
License:
|
|
11
|
+
MIT: https://opensource.org/licenses/MIT
|
|
12
|
+
See the LICENSE file in the project's top-level directory for details.
|
|
13
|
+
|
|
14
|
+
Authors:
|
|
15
|
+
* Christian Boulanger (cboulanger)
|
|
16
|
+
|
|
17
|
+
************************************************************************ */
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A generic class for representing exceptions that occur during io operations.
|
|
21
|
+
*/
|
|
22
|
+
qx.Class.define("qx.io.exception.Exception",
|
|
23
|
+
{
|
|
24
|
+
extend : qx.type.BaseError,
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Constructor
|
|
28
|
+
* @param message {String}
|
|
29
|
+
* @param code {Number}
|
|
30
|
+
* @param data {*|null}
|
|
31
|
+
*/
|
|
32
|
+
construct: function(message, code, data) {
|
|
33
|
+
this.base(arguments, "", message);
|
|
34
|
+
this.code = code;
|
|
35
|
+
this.data = data;
|
|
36
|
+
this.name = this.classname;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
@@ -4,17 +4,23 @@
|
|
|
4
4
|
|
|
5
5
|
http://qooxdoo.org
|
|
6
6
|
|
|
7
|
+
Copyright:
|
|
8
|
+
2020 Christian Boulanger
|
|
9
|
+
|
|
7
10
|
License:
|
|
8
11
|
MIT: https://opensource.org/licenses/MIT
|
|
9
12
|
See the LICENSE file in the project's top-level directory for details.
|
|
10
13
|
|
|
14
|
+
Authors:
|
|
15
|
+
* Christian Boulanger (cboulanger)
|
|
16
|
+
|
|
11
17
|
************************************************************************ */
|
|
18
|
+
|
|
12
19
|
/**
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
+
* A class for representing errors that occurred on server and are handled
|
|
21
|
+
* according to the service protocol (JSON-RPC, GraphQL, etc.)
|
|
22
|
+
*/
|
|
23
|
+
qx.Class.define("qx.io.exception.Protocol",
|
|
24
|
+
{
|
|
25
|
+
extend : qx.io.exception.Exception
|
|
20
26
|
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* ************************************************************************
|
|
2
|
+
|
|
3
|
+
qooxdoo - the new era of web development
|
|
4
|
+
|
|
5
|
+
http://qooxdoo.org
|
|
6
|
+
|
|
7
|
+
Copyright:
|
|
8
|
+
2020 Christian Boulanger
|
|
9
|
+
|
|
10
|
+
License:
|
|
11
|
+
MIT: https://opensource.org/licenses/MIT
|
|
12
|
+
See the LICENSE file in the project's top-level directory for details.
|
|
13
|
+
|
|
14
|
+
Authors:
|
|
15
|
+
* Christian Boulanger (cboulanger)
|
|
16
|
+
|
|
17
|
+
************************************************************************ */
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A class for representing errors that occurred during the request transport.
|
|
21
|
+
* In the context of HTTP requests, the error code is the HTTP error code.
|
|
22
|
+
*/
|
|
23
|
+
qx.Class.define("qx.io.exception.Transport",
|
|
24
|
+
{
|
|
25
|
+
extend : qx.io.exception.Exception,
|
|
26
|
+
statics: {
|
|
27
|
+
TIMEOUT : 1,
|
|
28
|
+
ABORTED : 2,
|
|
29
|
+
NO_DATA : 3,
|
|
30
|
+
INVALID_MSG_DATA : 4,
|
|
31
|
+
CANCELLED : 5,
|
|
32
|
+
INVALID_URI : 6,
|
|
33
|
+
FAILED : 7,
|
|
34
|
+
INVALID_ID : 8, // JSON-RPC
|
|
35
|
+
INVALID_JSON : 9, // JSON-RPC
|
|
36
|
+
DUPLICATE_ID : 10, // JSON-RPC
|
|
37
|
+
UNKNOWN_ID : 11 // JSON-RPC
|
|
38
|
+
}
|
|
39
|
+
});
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/* ************************************************************************
|
|
2
|
+
|
|
3
|
+
qooxdoo - the new era of web development
|
|
4
|
+
|
|
5
|
+
http://qooxdoo.org
|
|
6
|
+
|
|
7
|
+
Copyright:
|
|
8
|
+
2020 Christian Boulanger
|
|
9
|
+
|
|
10
|
+
License:
|
|
11
|
+
MIT: https://opensource.org/licenses/MIT
|
|
12
|
+
See the LICENSE file in the project's top-level directory for details.
|
|
13
|
+
|
|
14
|
+
Authors:
|
|
15
|
+
* Christian Boulanger (cboulanger)
|
|
16
|
+
|
|
17
|
+
************************************************************************ */
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* This class provides a simple GraphQl client (https://graphql.org/).
|
|
21
|
+
* For transport, it is based on internally on the fetch API
|
|
22
|
+
* (https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch)
|
|
23
|
+
* which, if needed, must be directly configured via the `init` parameter of the
|
|
24
|
+
* constructor, until a more generalized qx.io API has been developed.
|
|
25
|
+
* @experimental The API might change. Feedback is appreciated.
|
|
26
|
+
*/
|
|
27
|
+
qx.Class.define("qx.io.graphql.Client", {
|
|
28
|
+
|
|
29
|
+
extend: qx.io.transport.AbstractClient,
|
|
30
|
+
|
|
31
|
+
statics: {
|
|
32
|
+
registerTransport : qx.io.transport.AbstractClient.registerTransport
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
events: {
|
|
36
|
+
/**
|
|
37
|
+
* Event fired when a request results in an error. Event data is an instance of
|
|
38
|
+
* {@link qx.io.exception.Transport}, {@link qx.io.exception.Protocol},
|
|
39
|
+
* or {@link qx.io.exception.Cancel}.
|
|
40
|
+
*/
|
|
41
|
+
"error" : "qx.event.type.Data"
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {qx.io.transport.ITransport|String} transportOrUri
|
|
46
|
+
* Transport object, which must implement {@link qx.io.transport.ITransport}
|
|
47
|
+
* or a string URI, which will trigger auto-detection of transport, as long as an
|
|
48
|
+
* appropriate transport has been registered with the static `registerTransport()` function.
|
|
49
|
+
*/
|
|
50
|
+
construct: function (transportOrUri) {
|
|
51
|
+
this.base(arguments);
|
|
52
|
+
this.selectTransport(transportOrUri);
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
members: {
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Send the given GraphQl query. See https://graphql.org/learn/queries/
|
|
59
|
+
*
|
|
60
|
+
* @param {qx.io.graphql.protocol.Request} request The GraphQl request object.
|
|
61
|
+
* @return {qx.Promise} Promise that resolves with the data
|
|
62
|
+
*/
|
|
63
|
+
async send(request) {
|
|
64
|
+
let transport = this.getTransport();
|
|
65
|
+
return new qx.Promise((resolve, reject) => {
|
|
66
|
+
transport.addListenerOnce("message", evt => {
|
|
67
|
+
try{
|
|
68
|
+
if (qx.core.Environment.get("qx.io.graphql.debug")) {
|
|
69
|
+
this.debug( "<<< Received: " + evt.getData());
|
|
70
|
+
}
|
|
71
|
+
let responseData = qx.lang.Json.parse(evt.getData());
|
|
72
|
+
let graphQlResponse = new qx.io.graphql.protocol.Response(responseData);
|
|
73
|
+
if (graphQlResponse.getErrors()) {
|
|
74
|
+
return reject(this._handleErrors(graphQlResponse));
|
|
75
|
+
}
|
|
76
|
+
return resolve(graphQlResponse.getData());
|
|
77
|
+
} catch (e) {
|
|
78
|
+
this.error(e);
|
|
79
|
+
return reject(new qx.io.exception.Transport(e.message));
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
if (qx.core.Environment.get("qx.io.graphql.debug")) {
|
|
83
|
+
this.debug(">>>> Sending " + request.toString());
|
|
84
|
+
}
|
|
85
|
+
transport.send(request.toString()).catch(reject);
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Handle the errors reported by the GraphQL endpoint. The response
|
|
91
|
+
* can contain several errors, but we can only throw one of them.
|
|
92
|
+
* However, we can fire an event for each error, which might be useful
|
|
93
|
+
* if they are to be logged. The errors that are thrown or fired as
|
|
94
|
+
* event data contain the original response object in the `data` property
|
|
95
|
+
*
|
|
96
|
+
* @param {qx.io.graphql.protocol.Response} response The response object
|
|
97
|
+
* @return {qx.io.exception.Protocol}
|
|
98
|
+
*/
|
|
99
|
+
_handleErrors(response) {
|
|
100
|
+
let errors = response.getErrors();
|
|
101
|
+
errors.forEach(error => {
|
|
102
|
+
let exception = new qx.io.exception.Protocol(error.message, null, response.toObject());
|
|
103
|
+
this.fireDataEvent("error", exception);
|
|
104
|
+
});
|
|
105
|
+
return new qx.io.exception.Protocol(errors[0].message, null, response.toObject());
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
environment: {
|
|
110
|
+
"qx.io.graphql.debug" : false
|
|
111
|
+
}
|
|
112
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This namespace provides a simple GraphQL client.
|
|
3
|
+
*
|
|
4
|
+
* Not implemented:
|
|
5
|
+
* - batched requests (https://www.apollographql.com/blog/batching-client-graphql-queries-a685f5bcd41b/)
|
|
6
|
+
* - subscriptions (http://spec.graphql.org/draft/#sec-Subscription)
|
|
7
|
+
*
|
|
8
|
+
* @experimental The API might change. Feedback is appreciated.
|
|
9
|
+
*/
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/* ************************************************************************
|
|
2
|
+
|
|
3
|
+
qooxdoo - the new era of web development
|
|
4
|
+
|
|
5
|
+
http://qooxdoo.org
|
|
6
|
+
|
|
7
|
+
Copyright:
|
|
8
|
+
2020 Christian Boulanger
|
|
9
|
+
|
|
10
|
+
License:
|
|
11
|
+
MIT: https://opensource.org/licenses/MIT
|
|
12
|
+
See the LICENSE file in the project's top-level directory for details.
|
|
13
|
+
|
|
14
|
+
Authors:
|
|
15
|
+
* Christian Boulanger (cboulanger)
|
|
16
|
+
|
|
17
|
+
************************************************************************ */
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Abstract parent class for GraphQL messages and responses
|
|
21
|
+
* @experimental The API might change. Feedback is appreciated.
|
|
22
|
+
*/
|
|
23
|
+
qx.Class.define("qx.io.graphql.protocol.Message", {
|
|
24
|
+
extend: qx.core.Object,
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Constructor
|
|
28
|
+
* @param {Object} data
|
|
29
|
+
*/
|
|
30
|
+
construct: function(data) {
|
|
31
|
+
this.base(arguments);
|
|
32
|
+
qx.core.Assert.assertObject(data);
|
|
33
|
+
this.set(data);
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
members : {
|
|
37
|
+
/**
|
|
38
|
+
* Return the message data in a spec-conformant native object
|
|
39
|
+
*/
|
|
40
|
+
toNormalizedObject() {
|
|
41
|
+
let data = this.toObject();
|
|
42
|
+
if (!data.errors) {
|
|
43
|
+
delete data.errors;
|
|
44
|
+
}
|
|
45
|
+
return data;
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Serialize to a spec-conformant JSON string
|
|
50
|
+
* @return {String}
|
|
51
|
+
*/
|
|
52
|
+
toString() {
|
|
53
|
+
return qx.lang.Json.stringify(this.toNormalizedObject());
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Serialize to a native javascript object. If you need a normalized object
|
|
58
|
+
* that conforms to the spec, use {@link #toNormalizedObject}
|
|
59
|
+
* @return {Object}
|
|
60
|
+
*/
|
|
61
|
+
toObject() {
|
|
62
|
+
return qx.util.Serializer.toNativeObject(this);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/* ************************************************************************
|
|
2
|
+
|
|
3
|
+
qooxdoo - the new era of web development
|
|
4
|
+
|
|
5
|
+
http://qooxdoo.org
|
|
6
|
+
|
|
7
|
+
Copyright:
|
|
8
|
+
2020 Christian Boulanger
|
|
9
|
+
|
|
10
|
+
License:
|
|
11
|
+
MIT: https://opensource.org/licenses/MIT
|
|
12
|
+
See the LICENSE file in the project's top-level directory for details.
|
|
13
|
+
|
|
14
|
+
Authors:
|
|
15
|
+
* Christian Boulanger (cboulanger)
|
|
16
|
+
|
|
17
|
+
************************************************************************ */
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* An Object modelling a GraphQL request based on the GraphQL language
|
|
21
|
+
* (see http://spec.graphql.org/draft/#sec-Language) usually sent as JSON via
|
|
22
|
+
* a HTTP request (https://graphql.org/learn/serving-over-http)
|
|
23
|
+
* @experimental The API might change. Feedback is appreciated.
|
|
24
|
+
*/
|
|
25
|
+
qx.Class.define("qx.io.graphql.protocol.Request",{
|
|
26
|
+
extend: qx.io.graphql.protocol.Message,
|
|
27
|
+
properties: {
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* An optional field that only needs to be provided if multiple operations are present in the query
|
|
31
|
+
*/
|
|
32
|
+
operationName: {
|
|
33
|
+
check:"String",
|
|
34
|
+
nullable: true,
|
|
35
|
+
event: "changeOperationName"
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The query as a string which will be parsed and executed on the server
|
|
40
|
+
*/
|
|
41
|
+
query : {
|
|
42
|
+
check: "String",
|
|
43
|
+
nullable: false,
|
|
44
|
+
init: "",
|
|
45
|
+
event: "changeQuery"
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* A qooxdoo object that maps variable names to variable values
|
|
50
|
+
*/
|
|
51
|
+
variables : {
|
|
52
|
+
check: "qx.core.Object",
|
|
53
|
+
nullable: true,
|
|
54
|
+
event: "changeVariables",
|
|
55
|
+
transform: "_transformVariables",
|
|
56
|
+
validate: "_validateVariables"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
members: {
|
|
61
|
+
// overriden
|
|
62
|
+
toString() {
|
|
63
|
+
return qx.lang.Json.stringify(this.toObject(), this._jsonReplacer);
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
_jsonReplacer: function(key, value) {
|
|
67
|
+
if (key === "variables" || key === "operationName") {
|
|
68
|
+
return value !== null ? value : undefined;
|
|
69
|
+
}
|
|
70
|
+
// everything else is returned as it is
|
|
71
|
+
return value;
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Transforms the variables object to a qooxdoo model. Called automaticaly
|
|
77
|
+
* when the variables property is set.
|
|
78
|
+
*/
|
|
79
|
+
_transformVariables: function(val) {
|
|
80
|
+
let model = null;
|
|
81
|
+
if (![null, undefined].includes(val)) {
|
|
82
|
+
model = qx.data.marshal.Json.createModel(val);
|
|
83
|
+
}
|
|
84
|
+
return model;
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
_validateVariables: function(val) {
|
|
88
|
+
if (!qx.lang.Type.isObject(val) && (val !== null)) {
|
|
89
|
+
throw new qx.core.ValidationError(
|
|
90
|
+
"Validation Error: " + val + " is not an object or null."
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/* ************************************************************************
|
|
2
|
+
|
|
3
|
+
qooxdoo - the new era of web development
|
|
4
|
+
|
|
5
|
+
http://qooxdoo.org
|
|
6
|
+
|
|
7
|
+
Copyright:
|
|
8
|
+
2020 Christian Boulanger
|
|
9
|
+
|
|
10
|
+
License:
|
|
11
|
+
MIT: https://opensource.org/licenses/MIT
|
|
12
|
+
See the LICENSE file in the project's top-level directory for details.
|
|
13
|
+
|
|
14
|
+
Authors:
|
|
15
|
+
* Christian Boulanger (cboulanger)
|
|
16
|
+
|
|
17
|
+
************************************************************************ */
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* An Object modelling a GraphQL response (see http://spec.graphql.org/draft/#sec-Response-Format)
|
|
21
|
+
* @experimental The API might change. Feedback is appreciated.
|
|
22
|
+
*/
|
|
23
|
+
qx.Class.define("qx.io.graphql.protocol.Response",{
|
|
24
|
+
extend: qx.io.graphql.protocol.Message,
|
|
25
|
+
|
|
26
|
+
properties: {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* "The data entry in the response will be the result of the execution
|
|
30
|
+
* of the requested operation. If the operation was a query, this
|
|
31
|
+
* output will be an object of the schema’s query root type; if the
|
|
32
|
+
* operation was a mutation, this output will be an object of the
|
|
33
|
+
* schema’s mutation root type. If an error was encountered before
|
|
34
|
+
* execution begins, the data entry should not be present in the result.
|
|
35
|
+
* If an error was encountered during the execution that prevented
|
|
36
|
+
* a valid response, the data entry in the response should be null"
|
|
37
|
+
*/
|
|
38
|
+
data : {
|
|
39
|
+
check: "Object",
|
|
40
|
+
nullable: true,
|
|
41
|
+
init: null
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* "The errors entry in the response is a non‐empty list of errors,
|
|
46
|
+
* where each error is a map. If no errors were encountered during
|
|
47
|
+
* the requested operation, the errors entry should not be present in
|
|
48
|
+
* the result. If the data entry in the response is not present, the
|
|
49
|
+
* errors entry in the response must not be empty. It must contain
|
|
50
|
+
* at least one error. The errors it contains should indicate why no
|
|
51
|
+
* data was able to be returned. If the data entry in the response is
|
|
52
|
+
* present (including if it is the value null), the errors entry in the
|
|
53
|
+
* response may contain any errors that occurred during execution. If
|
|
54
|
+
* errors occurred during execution, it should contain those errors."
|
|
55
|
+
*/
|
|
56
|
+
errors : {
|
|
57
|
+
check: value => qx.lang.Type.isArray(value) && value.length && value.every(item => Boolean(item.message)),
|
|
58
|
+
nullable: true
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|