@avs/go 0.13.71891 → 0.14.72000

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,197 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2018 Advanced Visual Systems Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- *
17
- * This product includes software developed at
18
- * Advanced Visual Systems Inc. (http://www.avs.com)
19
- */
20
-
21
- import {dedupingMixin} from '@polymer/polymer/lib/utils/mixin.js';
22
- import {VERSION} from './constants.js';
23
-
24
- /**
25
- * Mixin to provide client-server communication using `XMLHttpRequest`
26
- *
27
- * @polymer
28
- * @mixinFunction
29
- */
30
- export const AvsHttpMixin = dedupingMixin((superClass) => class extends superClass {
31
-
32
- /**
33
- * Generate a HTTP request.
34
- * @param url URL to an instance of AVS/Go server or file to get.
35
- * @param model Model content to POST to the server (or undefined to generate a GET request).
36
- */
37
- _httpRequest(url, onLoad, onProgress, onError, model) {
38
-
39
- if ( url === undefined ) {
40
-
41
- this.dispatchEvent(new CustomEvent('avs-error', {detail: "\'url\' property must point to an instance of AVS/Go server."} ));
42
-
43
- return;
44
-
45
- }
46
-
47
- // Cancel previous xhr
48
- if ( this.xhr !== undefined ) {
49
-
50
- this.xhr.cancel = true;
51
-
52
- }
53
-
54
- var xhr = new XMLHttpRequest();
55
- var scope = this;
56
-
57
- xhr.onload = function ( event ) {
58
-
59
- if ( xhr.status === 200 ) {
60
-
61
- var response = JSON.parse( xhr.responseText );
62
-
63
- if ( response == undefined || response == null ) {
64
-
65
- scope.dispatchEvent(new CustomEvent('avs-error', {detail: "Empty response received from AVS/Go server."} ));
66
-
67
- if ( onError !== undefined ) {
68
-
69
- onError( event );
70
-
71
- }
72
-
73
- } else {
74
-
75
- if ( response.error !== undefined ) {
76
-
77
- scope._logError( response.error );
78
-
79
- if ( onError !== undefined ) {
80
-
81
- onError( event );
82
-
83
- }
84
-
85
- } else if ( xhr.cancel === undefined && onLoad !== undefined ) {
86
-
87
- onLoad( response );
88
-
89
- }
90
-
91
- }
92
-
93
- } else {
94
-
95
- scope.dispatchEvent(new CustomEvent('avs-error', {detail: "Network error connecting to AVS/Go server, status code " + xhr.status} ));
96
-
97
- if ( onError !== undefined ) {
98
-
99
- onError( event );
100
-
101
- }
102
-
103
- }
104
-
105
- };
106
-
107
- xhr.onprogress = onProgress;
108
-
109
- xhr.onerror = function( event ) {
110
-
111
- scope.dispatchEvent(new CustomEvent('avs-error', {detail: "Network error connecting to AVS/Go server."} ));
112
-
113
- if ( onError !== undefined ) {
114
-
115
- onError( event );
116
-
117
- }
118
-
119
- };
120
-
121
- if ( model === undefined ) {
122
-
123
- xhr.open( 'GET', url, true );
124
-
125
- xhr.send();
126
-
127
- } else {
128
-
129
- var verArray = VERSION.split('.');
130
- var version = [ parseInt(verArray[0]), parseInt(verArray[1]), parseInt(verArray[2]) ];
131
- var body = {source: this.localName, model: model, version: version};
132
-
133
- xhr.open( 'POST', url, true );
134
- xhr.setRequestHeader( 'Content-type', 'application/json' );
135
-
136
- xhr.send( JSON.stringify( body ) );
137
-
138
- }
139
-
140
- this.xhr = xhr;
141
-
142
- }
143
-
144
- /**
145
- * @param error
146
- */
147
- _logError(error) {
148
- var output;
149
- if (error == undefined || error == null) {
150
- output = "An unknown error occurred on the AVS/Go server.";
151
- }
152
- else {
153
- var goException = JSON.parse(decodeURIComponent(error.replace(/\+/g, '%20')));
154
-
155
- var output = "An error occurred on the AVS/Go server";
156
-
157
- for (var key in goException) {
158
- if (goException.hasOwnProperty(key)) {
159
- if (output != "") {
160
- output = output + "\n ";
161
- }
162
- output = output + key + " : ";
163
- var child = goException[key];
164
- if (child === Object(child)) {
165
- output = output + JSON.stringify(child);
166
- }
167
- else {
168
- output = output + goException[key];
169
- }
170
- }
171
- }
172
- }
173
- /*
174
- if (goException.GoType != undefined) {
175
- if (goException.GoType == 0 || goException.GoType == 3) {
176
- console.log(output);
177
- }
178
- else if (goException.GoType == 1) {
179
- console.warn(output);
180
- }
181
- else if (goException.GoType == 2) {
182
- console.error(output);
183
- }
184
- }
185
- else {
186
- console.log(output);
187
- }
188
- }
189
- */
190
-
191
- /**
192
- * Error message from AVS/Go Web Component or Server.
193
- * @event avs-error
194
- */
195
- this.dispatchEvent(new CustomEvent('avs-error', {detail: output} ));
196
- }
197
- });
@@ -1,65 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2018 Advanced Visual Systems Inc.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- *
17
- * This product includes software developed at
18
- * Advanced Visual Systems Inc. (http://www.avs.com)
19
- */
20
-
21
- import {dedupingMixin} from '@polymer/polymer/lib/utils/mixin.js';
22
-
23
- /**
24
- * Mixin to add stream properties functionality.
25
- *
26
- * @polymer
27
- * @mixinFunction
28
- */
29
- export const AvsStreamMixin = dedupingMixin((superClass) => class extends superClass {
30
-
31
- static get properties() {
32
- return {
33
- /**
34
- * Enables streaming of objects from the server.
35
- */
36
- streamEnable: {
37
- type: Boolean
38
- },
39
- /**
40
- * The number of objects streamed for the first chunk.
41
- */
42
- streamChunkSizeFirst: {
43
- type: Number
44
- },
45
- /**
46
- * The number of objects streamed per chunk.
47
- */
48
- streamChunkSize: {
49
- type: Number
50
- }
51
- }
52
- }
53
-
54
- /**
55
- * Add stream properties to renderer properties.
56
- * @param rendererProperties Property structure to add to.
57
- */
58
- _addStreamProperties(rendererProperties) {
59
- if (this.streamEnable) {
60
- rendererProperties.streamProperties = {};
61
- if (this.streamChunkSizeFirst !== undefined) rendererProperties.streamProperties.chunkSizeFirst = this.streamChunkSizeFirst;
62
- if (this.streamChunkSize !== undefined) rendererProperties.streamProperties.chunkSize = this.streamChunkSize;
63
- }
64
- }
65
- });
package/webpack.config.js DELETED
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = {
4
- entry: [
5
- "@babel/polyfill",
6
- "@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js",
7
- "@webcomponents/webcomponentsjs/webcomponents-bundle.js",
8
- "./src/avs-go-dataviz.js",
9
- "./src/avs-go-dynamic-html.js",
10
- "./src/avs-go-info.js"
11
- ],
12
- output: {
13
- filename: "avs-go.min.js"
14
- },
15
- module: {
16
- rules: [
17
- {
18
- test: /\.js$/,
19
- use: {
20
- loader: 'babel-loader',
21
- options: {
22
- presets: ["@babel/preset-env"],
23
- plugins: ["@babel/plugin-transform-classes"]
24
- }
25
- }
26
- }
27
- ]
28
- }
29
- };