@next2d/net 1.14.20

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Next2D
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ @next2d/net
2
+ =============
3
+
4
+ ## Installation
5
+
6
+ ```
7
+ npm install @next2d/net
8
+ ```
9
+
10
+ ## License
11
+ This project is licensed under the [MIT License](https://opensource.org/licenses/MIT) - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,142 @@
1
+ import { URLRequestHeader } from "./URLRequestHeader";
2
+ import { URLRequestMethodImpl, URLLoaderDataFormatImpl } from "@next2d/interface";
3
+ /**
4
+ * URLRequestクラスは、外部へのリクエストを管理するクラスです
5
+ * The URLRequest class is a class that manages external requests
6
+ *
7
+ * @class
8
+ * @memberOf next2d.net
9
+ */
10
+ export declare class URLRequest {
11
+ private _$url;
12
+ private _$contentType;
13
+ private _$data;
14
+ private _$method;
15
+ private readonly _$requestHeaders;
16
+ private _$responseDataFormat;
17
+ private _$withCredentials;
18
+ /**
19
+ * @param {string} [url=""]
20
+ *
21
+ * @constructor
22
+ * @public
23
+ */
24
+ constructor(url?: string);
25
+ /**
26
+ * @description 指定されたクラスのストリングを返します。
27
+ * Returns the string representation of the specified class.
28
+ *
29
+ * @return {string}
30
+ * @default [class URLRequest]
31
+ * @method
32
+ * @static
33
+ */
34
+ static toString(): string;
35
+ /**
36
+ * @description 指定されたクラスの空間名を返します。
37
+ * Returns the space name of the specified class.
38
+ *
39
+ * @return {string}
40
+ * @default next2d.net.URLRequest
41
+ * @const
42
+ * @static
43
+ */
44
+ static get namespace(): string;
45
+ /**
46
+ * @description 指定されたオブジェクトのストリングを返します。
47
+ * Returns the string representation of the specified object.
48
+ *
49
+ * @return {string}
50
+ * @default [object URLRequest]
51
+ * @method
52
+ * @public
53
+ */
54
+ toString(): string;
55
+ /**
56
+ * @description 指定されたオブジェクトの空間名を返します。
57
+ * Returns the space name of the specified object.
58
+ *
59
+ * @return {string}
60
+ * @default next2d.net.URLRequest
61
+ * @const
62
+ * @public
63
+ */
64
+ get namespace(): string;
65
+ /**
66
+ * @description data プロパティのコンテンツの MIME コンテンツタイプです。
67
+ * The MIME content type of the content in the the data property.
68
+ *
69
+ * @member {string}
70
+ * @default application/json
71
+ * @public
72
+ */
73
+ get contentType(): string;
74
+ set contentType(content_type: string);
75
+ /**
76
+ * @description URL リクエストで送信されるデータを含むオブジェクトです。
77
+ * An object containing data to be transmitted with the URL request.
78
+ *
79
+ * @member {string}
80
+ * @public
81
+ */
82
+ get data(): any;
83
+ set data(data: any);
84
+ /**
85
+ * @description HTTP フォーム送信メソッドを制御します。
86
+ * Controls the HTTP form submission method.
87
+ *
88
+ * @member {string}
89
+ * @default "GET"
90
+ * @public
91
+ */
92
+ get method(): URLRequestMethodImpl;
93
+ set method(method: URLRequestMethodImpl);
94
+ /**
95
+ * @description HTTP リクエストヘッダーの配列が HTTP リクエストに追加されます。
96
+ * The array of HTTP request headers to be appended to the HTTP request.
97
+ *
98
+ * @member {URLRequestHeader[]}
99
+ * @public
100
+ */
101
+ get requestHeaders(): URLRequestHeader[];
102
+ set requestHeaders(request_headers: URLRequestHeader[]);
103
+ /**
104
+ * @description リクエストされる URL です。
105
+ * The URL to be requested.
106
+ *
107
+ * @member {string}
108
+ * @public
109
+ */
110
+ get url(): string;
111
+ set url(url: string);
112
+ /**
113
+ * @description レスポンスのデータフォーマットを指定します。
114
+ * Specifies the data format of the response.
115
+ *
116
+ * @member {string}
117
+ * @default "json"
118
+ * @public
119
+ */
120
+ get responseDataFormat(): URLLoaderDataFormatImpl;
121
+ set responseDataFormat(format: URLLoaderDataFormatImpl);
122
+ /**
123
+ * @description HTTP 要求で使用されるユーザーエージェントストリングを指定します。
124
+ * Specifies the user-agent string to be used in the HTTP request.
125
+ *
126
+ * @member {boolean}
127
+ * @default false
128
+ * @readonly
129
+ * @public
130
+ */
131
+ get withCredentials(): boolean;
132
+ set withCredentials(with_credentials: boolean);
133
+ /**
134
+ * @description リクエストされる URLRequestHeader Object
135
+ * URLRequestHeader Object to be requested.
136
+ *
137
+ * @member {array}
138
+ * @readonly
139
+ * @public
140
+ */
141
+ get headers(): URLRequestHeader[];
142
+ }
@@ -0,0 +1,232 @@
1
+ import { URLRequestHeader } from "./URLRequestHeader";
2
+ import { $currentPlayer } from "@next2d/util";
3
+ import { $getArray } from "@next2d/share";
4
+ /**
5
+ * URLRequestクラスは、外部へのリクエストを管理するクラスです
6
+ * The URLRequest class is a class that manages external requests
7
+ *
8
+ * @class
9
+ * @memberOf next2d.net
10
+ */
11
+ export class URLRequest {
12
+ /**
13
+ * @param {string} [url=""]
14
+ *
15
+ * @constructor
16
+ * @public
17
+ */
18
+ constructor(url = "") {
19
+ /**
20
+ * @type {string}
21
+ * @default ""
22
+ * @private
23
+ */
24
+ this._$url = `${url}`;
25
+ /**
26
+ * @type {string}
27
+ * @default application/json
28
+ * @private
29
+ */
30
+ this._$contentType = "application/json";
31
+ /**
32
+ * @type {string}
33
+ * @default ""
34
+ * @private
35
+ */
36
+ this._$data = "";
37
+ /**
38
+ * @type {string}
39
+ * @default "GET"
40
+ * @private
41
+ */
42
+ this._$method = "GET";
43
+ /**
44
+ * @type {array}
45
+ * @private
46
+ */
47
+ this._$requestHeaders = $getArray();
48
+ /**
49
+ * @type {string}
50
+ * @default "json"
51
+ * @private
52
+ */
53
+ this._$responseDataFormat = "json";
54
+ /**
55
+ * @type {boolean}
56
+ * @default false
57
+ * @private
58
+ */
59
+ this._$withCredentials = false;
60
+ }
61
+ /**
62
+ * @description 指定されたクラスのストリングを返します。
63
+ * Returns the string representation of the specified class.
64
+ *
65
+ * @return {string}
66
+ * @default [class URLRequest]
67
+ * @method
68
+ * @static
69
+ */
70
+ static toString() {
71
+ return "[class URLRequest]";
72
+ }
73
+ /**
74
+ * @description 指定されたクラスの空間名を返します。
75
+ * Returns the space name of the specified class.
76
+ *
77
+ * @return {string}
78
+ * @default next2d.net.URLRequest
79
+ * @const
80
+ * @static
81
+ */
82
+ static get namespace() {
83
+ return "next2d.net.URLRequest";
84
+ }
85
+ /**
86
+ * @description 指定されたオブジェクトのストリングを返します。
87
+ * Returns the string representation of the specified object.
88
+ *
89
+ * @return {string}
90
+ * @default [object URLRequest]
91
+ * @method
92
+ * @public
93
+ */
94
+ toString() {
95
+ return "[object URLRequest]";
96
+ }
97
+ /**
98
+ * @description 指定されたオブジェクトの空間名を返します。
99
+ * Returns the space name of the specified object.
100
+ *
101
+ * @return {string}
102
+ * @default next2d.net.URLRequest
103
+ * @const
104
+ * @public
105
+ */
106
+ get namespace() {
107
+ return "next2d.net.URLRequest";
108
+ }
109
+ /**
110
+ * @description data プロパティのコンテンツの MIME コンテンツタイプです。
111
+ * The MIME content type of the content in the the data property.
112
+ *
113
+ * @member {string}
114
+ * @default application/json
115
+ * @public
116
+ */
117
+ get contentType() {
118
+ return this._$contentType;
119
+ }
120
+ set contentType(content_type) {
121
+ this._$contentType = `${content_type}`;
122
+ }
123
+ /**
124
+ * @description URL リクエストで送信されるデータを含むオブジェクトです。
125
+ * An object containing data to be transmitted with the URL request.
126
+ *
127
+ * @member {string}
128
+ * @public
129
+ */
130
+ get data() {
131
+ return this._$data;
132
+ }
133
+ set data(data) {
134
+ this._$data = data;
135
+ }
136
+ /**
137
+ * @description HTTP フォーム送信メソッドを制御します。
138
+ * Controls the HTTP form submission method.
139
+ *
140
+ * @member {string}
141
+ * @default "GET"
142
+ * @public
143
+ */
144
+ get method() {
145
+ return this._$method;
146
+ }
147
+ set method(method) {
148
+ this._$method = `${method}`;
149
+ }
150
+ /**
151
+ * @description HTTP リクエストヘッダーの配列が HTTP リクエストに追加されます。
152
+ * The array of HTTP request headers to be appended to the HTTP request.
153
+ *
154
+ * @member {URLRequestHeader[]}
155
+ * @public
156
+ */
157
+ get requestHeaders() {
158
+ return this._$requestHeaders;
159
+ }
160
+ set requestHeaders(request_headers) {
161
+ this._$requestHeaders.length = 0;
162
+ this._$requestHeaders.push(...request_headers);
163
+ }
164
+ /**
165
+ * @description リクエストされる URL です。
166
+ * The URL to be requested.
167
+ *
168
+ * @member {string}
169
+ * @public
170
+ */
171
+ get url() {
172
+ if (this._$url && this._$url.indexOf("//") === -1) {
173
+ const urls = this._$url.split("/");
174
+ if (urls[0] === "" || urls[0] === ".") {
175
+ urls.shift();
176
+ }
177
+ const player = $currentPlayer();
178
+ if (player) {
179
+ return `${player.base}${urls.join("/")}`;
180
+ }
181
+ }
182
+ return this._$url;
183
+ }
184
+ set url(url) {
185
+ this._$url = `${url}`;
186
+ }
187
+ /**
188
+ * @description レスポンスのデータフォーマットを指定します。
189
+ * Specifies the data format of the response.
190
+ *
191
+ * @member {string}
192
+ * @default "json"
193
+ * @public
194
+ */
195
+ get responseDataFormat() {
196
+ return this._$responseDataFormat;
197
+ }
198
+ set responseDataFormat(format) {
199
+ this._$responseDataFormat = `${format}`;
200
+ }
201
+ /**
202
+ * @description HTTP 要求で使用されるユーザーエージェントストリングを指定します。
203
+ * Specifies the user-agent string to be used in the HTTP request.
204
+ *
205
+ * @member {boolean}
206
+ * @default false
207
+ * @readonly
208
+ * @public
209
+ */
210
+ get withCredentials() {
211
+ return this._$withCredentials;
212
+ }
213
+ set withCredentials(with_credentials) {
214
+ this._$withCredentials = with_credentials;
215
+ }
216
+ /**
217
+ * @description リクエストされる URLRequestHeader Object
218
+ * URLRequestHeader Object to be requested.
219
+ *
220
+ * @member {array}
221
+ * @readonly
222
+ * @public
223
+ */
224
+ get headers() {
225
+ const headers = $getArray();
226
+ headers.push(new URLRequestHeader("Content-Type", `${this._$contentType}`));
227
+ if (this._$requestHeaders.length) {
228
+ headers.push(...this._$requestHeaders);
229
+ }
230
+ return headers;
231
+ }
232
+ }
@@ -0,0 +1,82 @@
1
+ /**
2
+ * URLRequestHeader オブジェクトは 1 つの HTTP のリクエストヘッダーをカプセル化し、名前と値のペアを構成します。
3
+ * URLRequestHeader オブジェクトは URLRequest クラスの requestHeaders プロパティで使用されます。
4
+ *
5
+ * A URLRequestHeader object encapsulates a single HTTP request header and consists of a name/value pair.
6
+ * URLRequestHeader objects are used in the requestHeaders property of the URLRequest class.
7
+ *
8
+ * @class
9
+ * @memberOf next2d.net
10
+ */
11
+ export declare class URLRequestHeader {
12
+ private readonly _$name;
13
+ private readonly _$value;
14
+ /**
15
+ * @param {string} [name=""]
16
+ * @param {string} [value=""]
17
+ *
18
+ * @constructor
19
+ * @public
20
+ */
21
+ constructor(name?: string, value?: string);
22
+ /**
23
+ * @description 指定されたクラスのストリングを返します。
24
+ * Returns the string representation of the specified class.
25
+ *
26
+ * @return {string}
27
+ * @default [class URLRequestHeader]
28
+ * @method
29
+ * @static
30
+ */
31
+ static toString(): string;
32
+ /**
33
+ * @description 指定されたクラスの空間名を返します。
34
+ * Returns the space name of the specified class.
35
+ *
36
+ * @return {string}
37
+ * @default next2d.net.URLRequestHeader
38
+ * @const
39
+ * @static
40
+ */
41
+ static get namespace(): string;
42
+ /**
43
+ * @description 指定されたオブジェクトのストリングを返します。
44
+ * Returns the string representation of the specified object.
45
+ *
46
+ * @return {string}
47
+ * @default [object URLRequestHeader]
48
+ * @method
49
+ * @public
50
+ */
51
+ toString(): string;
52
+ /**
53
+ * @description 指定されたオブジェクトの空間名を返します。
54
+ * Returns the space name of the specified object.
55
+ *
56
+ * @return {string}
57
+ * @default next2d.net.URLRequestHeader
58
+ * @const
59
+ * @public
60
+ */
61
+ get namespace(): string;
62
+ /**
63
+ * @description HTTP リクエストヘッダー名(Content-Type や SOAPAction など)です。
64
+ * An HTTP request header name (such as Content-Type or SOAPAction).
65
+ *
66
+ * @member {string}
67
+ * @default ""
68
+ * @readonly
69
+ * @public
70
+ */
71
+ get name(): string;
72
+ /**
73
+ * @description name プロパティに関連付けられた値(text/plain など)です。
74
+ * The value associated with the name property (such as text/plain).
75
+ *
76
+ * @member {string}
77
+ * @default ""
78
+ * @readonly
79
+ * @public
80
+ */
81
+ get value(): string;
82
+ }
@@ -0,0 +1,105 @@
1
+ /**
2
+ * URLRequestHeader オブジェクトは 1 つの HTTP のリクエストヘッダーをカプセル化し、名前と値のペアを構成します。
3
+ * URLRequestHeader オブジェクトは URLRequest クラスの requestHeaders プロパティで使用されます。
4
+ *
5
+ * A URLRequestHeader object encapsulates a single HTTP request header and consists of a name/value pair.
6
+ * URLRequestHeader objects are used in the requestHeaders property of the URLRequest class.
7
+ *
8
+ * @class
9
+ * @memberOf next2d.net
10
+ */
11
+ export class URLRequestHeader {
12
+ /**
13
+ * @param {string} [name=""]
14
+ * @param {string} [value=""]
15
+ *
16
+ * @constructor
17
+ * @public
18
+ */
19
+ constructor(name = "", value = "") {
20
+ /**
21
+ * @type {string}
22
+ * @default ""
23
+ * @private
24
+ */
25
+ this._$name = `${name}`;
26
+ /**
27
+ * @type {string}
28
+ * @default ""
29
+ * @private
30
+ */
31
+ this._$value = `${value}`;
32
+ }
33
+ /**
34
+ * @description 指定されたクラスのストリングを返します。
35
+ * Returns the string representation of the specified class.
36
+ *
37
+ * @return {string}
38
+ * @default [class URLRequestHeader]
39
+ * @method
40
+ * @static
41
+ */
42
+ static toString() {
43
+ return "[class URLRequestHeader]";
44
+ }
45
+ /**
46
+ * @description 指定されたクラスの空間名を返します。
47
+ * Returns the space name of the specified class.
48
+ *
49
+ * @return {string}
50
+ * @default next2d.net.URLRequestHeader
51
+ * @const
52
+ * @static
53
+ */
54
+ static get namespace() {
55
+ return "next2d.net.URLRequestHeader";
56
+ }
57
+ /**
58
+ * @description 指定されたオブジェクトのストリングを返します。
59
+ * Returns the string representation of the specified object.
60
+ *
61
+ * @return {string}
62
+ * @default [object URLRequestHeader]
63
+ * @method
64
+ * @public
65
+ */
66
+ toString() {
67
+ return "[object URLRequestHeader]";
68
+ }
69
+ /**
70
+ * @description 指定されたオブジェクトの空間名を返します。
71
+ * Returns the space name of the specified object.
72
+ *
73
+ * @return {string}
74
+ * @default next2d.net.URLRequestHeader
75
+ * @const
76
+ * @public
77
+ */
78
+ get namespace() {
79
+ return "next2d.net.URLRequestHeader";
80
+ }
81
+ /**
82
+ * @description HTTP リクエストヘッダー名(Content-Type や SOAPAction など)です。
83
+ * An HTTP request header name (such as Content-Type or SOAPAction).
84
+ *
85
+ * @member {string}
86
+ * @default ""
87
+ * @readonly
88
+ * @public
89
+ */
90
+ get name() {
91
+ return this._$name;
92
+ }
93
+ /**
94
+ * @description name プロパティに関連付けられた値(text/plain など)です。
95
+ * The value associated with the name property (such as text/plain).
96
+ *
97
+ * @member {string}
98
+ * @default ""
99
+ * @readonly
100
+ * @public
101
+ */
102
+ get value() {
103
+ return this._$value;
104
+ }
105
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./URLRequest";
2
+ export * from "./URLRequestHeader";
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./URLRequest";
2
+ export * from "./URLRequestHeader";
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@next2d/net",
3
+ "version": "1.14.20",
4
+ "description": "Next2D Net Packages",
5
+ "author": "Toshiyuki Ienaga<ienaga@tvon.jp> (https://github.com/ienaga/)",
6
+ "license": "MIT",
7
+ "homepage": "https://next2d.app",
8
+ "bugs": "https://github.com/Next2D/Player/issues",
9
+ "main": "dist/index.js",
10
+ "types": "dist/index.d.ts",
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "import": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ },
20
+ "require": {
21
+ "types": "./dist/index.d.ts",
22
+ "default": "./dist/index.js"
23
+ }
24
+ }
25
+ },
26
+ "keywords": [
27
+ "Next2D",
28
+ "Next2D Net"
29
+ ],
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/Next2D/Player.git"
33
+ },
34
+ "peerDependencies": {
35
+ "@next2d/interface": "1.14.20",
36
+ "@next2d/core": "1.14.20",
37
+ "@next2d/util": "1.14.20",
38
+ "@next2d/share": "1.14.20"
39
+ }
40
+ }