@opra/core 0.0.5

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.
Files changed (139) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -0
  3. package/cjs/constants.js +5 -0
  4. package/cjs/decorators/entity-resource.decorator.js +24 -0
  5. package/cjs/enums/http-headers.enum.js +393 -0
  6. package/cjs/enums/http-status.enum.js +300 -0
  7. package/cjs/enums/index.js +5 -0
  8. package/cjs/enums/issue-severity.enum.js +2 -0
  9. package/cjs/exception/api-exception.js +63 -0
  10. package/cjs/exception/errors/bad-request.error.js +22 -0
  11. package/cjs/exception/errors/failed-dependency.error.js +21 -0
  12. package/cjs/exception/errors/forbidden.error.js +23 -0
  13. package/cjs/exception/errors/internal-server.error.js +21 -0
  14. package/cjs/exception/errors/method-not-allowed.error.js +22 -0
  15. package/cjs/exception/errors/not-found.error.js +25 -0
  16. package/cjs/exception/errors/unauthorized.error.js +22 -0
  17. package/cjs/exception/errors/unprocessable-entity.error.js +21 -0
  18. package/cjs/exception/index.js +11 -0
  19. package/cjs/implementation/adapter/adapter.js +72 -0
  20. package/cjs/implementation/adapter/express-adapter.js +93 -0
  21. package/cjs/implementation/adapter/http-adapter.js +262 -0
  22. package/cjs/implementation/data-type/complex-type.js +39 -0
  23. package/cjs/implementation/data-type/data-type.js +35 -0
  24. package/cjs/implementation/data-type/entity-type.js +33 -0
  25. package/cjs/implementation/data-type/simple-type.js +30 -0
  26. package/cjs/implementation/execution-context.js +49 -0
  27. package/cjs/implementation/opra-document.js +116 -0
  28. package/cjs/implementation/opra-service.js +59 -0
  29. package/cjs/implementation/resource/container-resource-controller.js +26 -0
  30. package/cjs/implementation/resource/entity-resource-info.js +68 -0
  31. package/cjs/implementation/resource/resource-info.js +24 -0
  32. package/cjs/implementation/schema-generator.js +173 -0
  33. package/cjs/index.js +25 -0
  34. package/cjs/interfaces/entity-resource.interface.js +2 -0
  35. package/cjs/interfaces/execution-query.interface.js +190 -0
  36. package/cjs/interfaces/http-context.interface.js +2 -0
  37. package/cjs/interfaces/opra-schema.metadata.js +2 -0
  38. package/cjs/interfaces/resource-container.interface.js +2 -0
  39. package/cjs/package.json +3 -0
  40. package/cjs/services/data-service.js +9 -0
  41. package/cjs/services/json-data-service.js +15 -0
  42. package/cjs/types.js +2 -0
  43. package/cjs/utils/class-utils.js +37 -0
  44. package/cjs/utils/headers.js +58 -0
  45. package/cjs/utils/internal-data-types.js +44 -0
  46. package/cjs/utils/responsive-object.js +49 -0
  47. package/cjs/utils/string-path-to-object-tree.js +26 -0
  48. package/cjs/utils/terminal-utils.js +7 -0
  49. package/esm/constants.d.ts +2 -0
  50. package/esm/constants.js +2 -0
  51. package/esm/decorators/entity-resource.decorator.d.ts +5 -0
  52. package/esm/decorators/entity-resource.decorator.js +19 -0
  53. package/esm/enums/http-headers.enum.d.ts +368 -0
  54. package/esm/enums/http-headers.enum.js +390 -0
  55. package/esm/enums/http-status.enum.d.ts +290 -0
  56. package/esm/enums/http-status.enum.js +297 -0
  57. package/esm/enums/index.d.ts +2 -0
  58. package/esm/enums/index.js +2 -0
  59. package/esm/enums/issue-severity.enum.d.ts +1 -0
  60. package/esm/enums/issue-severity.enum.js +1 -0
  61. package/esm/exception/api-exception.d.ts +38 -0
  62. package/esm/exception/api-exception.js +59 -0
  63. package/esm/exception/errors/bad-request.error.d.ts +9 -0
  64. package/esm/exception/errors/bad-request.error.js +18 -0
  65. package/esm/exception/errors/failed-dependency.error.d.ts +8 -0
  66. package/esm/exception/errors/failed-dependency.error.js +17 -0
  67. package/esm/exception/errors/forbidden.error.d.ts +10 -0
  68. package/esm/exception/errors/forbidden.error.js +19 -0
  69. package/esm/exception/errors/internal-server.error.d.ts +8 -0
  70. package/esm/exception/errors/internal-server.error.js +17 -0
  71. package/esm/exception/errors/method-not-allowed.error.d.ts +9 -0
  72. package/esm/exception/errors/method-not-allowed.error.js +18 -0
  73. package/esm/exception/errors/not-found.error.d.ts +12 -0
  74. package/esm/exception/errors/not-found.error.js +21 -0
  75. package/esm/exception/errors/unauthorized.error.d.ts +9 -0
  76. package/esm/exception/errors/unauthorized.error.js +18 -0
  77. package/esm/exception/errors/unprocessable-entity.error.d.ts +8 -0
  78. package/esm/exception/errors/unprocessable-entity.error.js +17 -0
  79. package/esm/exception/index.d.ts +8 -0
  80. package/esm/exception/index.js +8 -0
  81. package/esm/implementation/adapter/adapter.d.ts +18 -0
  82. package/esm/implementation/adapter/adapter.js +68 -0
  83. package/esm/implementation/adapter/express-adapter.d.ts +12 -0
  84. package/esm/implementation/adapter/express-adapter.js +89 -0
  85. package/esm/implementation/adapter/http-adapter.d.ts +27 -0
  86. package/esm/implementation/adapter/http-adapter.js +258 -0
  87. package/esm/implementation/data-type/complex-type.d.ts +18 -0
  88. package/esm/implementation/data-type/complex-type.js +35 -0
  89. package/esm/implementation/data-type/data-type.d.ts +15 -0
  90. package/esm/implementation/data-type/data-type.js +31 -0
  91. package/esm/implementation/data-type/entity-type.d.ts +10 -0
  92. package/esm/implementation/data-type/entity-type.js +29 -0
  93. package/esm/implementation/data-type/simple-type.d.ts +15 -0
  94. package/esm/implementation/data-type/simple-type.js +26 -0
  95. package/esm/implementation/execution-context.d.ts +42 -0
  96. package/esm/implementation/execution-context.js +43 -0
  97. package/esm/implementation/opra-document.d.ts +26 -0
  98. package/esm/implementation/opra-document.js +111 -0
  99. package/esm/implementation/opra-service.d.ts +19 -0
  100. package/esm/implementation/opra-service.js +55 -0
  101. package/esm/implementation/resource/container-resource-controller.d.ts +12 -0
  102. package/esm/implementation/resource/container-resource-controller.js +22 -0
  103. package/esm/implementation/resource/entity-resource-info.d.ts +24 -0
  104. package/esm/implementation/resource/entity-resource-info.js +63 -0
  105. package/esm/implementation/resource/resource-info.d.ts +10 -0
  106. package/esm/implementation/resource/resource-info.js +20 -0
  107. package/esm/implementation/schema-generator.d.ts +21 -0
  108. package/esm/implementation/schema-generator.js +169 -0
  109. package/esm/index.d.ts +22 -0
  110. package/esm/index.js +22 -0
  111. package/esm/interfaces/entity-resource.interface.d.ts +9 -0
  112. package/esm/interfaces/entity-resource.interface.js +1 -0
  113. package/esm/interfaces/execution-query.interface.d.ts +102 -0
  114. package/esm/interfaces/execution-query.interface.js +186 -0
  115. package/esm/interfaces/http-context.interface.d.ts +23 -0
  116. package/esm/interfaces/http-context.interface.js +1 -0
  117. package/esm/interfaces/opra-schema.metadata.d.ts +14 -0
  118. package/esm/interfaces/opra-schema.metadata.js +1 -0
  119. package/esm/interfaces/resource-container.interface.d.ts +6 -0
  120. package/esm/interfaces/resource-container.interface.js +1 -0
  121. package/esm/services/data-service.d.ts +2 -0
  122. package/esm/services/data-service.js +5 -0
  123. package/esm/services/json-data-service.d.ts +9 -0
  124. package/esm/services/json-data-service.js +10 -0
  125. package/esm/types.d.ts +11 -0
  126. package/esm/types.js +1 -0
  127. package/esm/utils/class-utils.d.ts +6 -0
  128. package/esm/utils/class-utils.js +30 -0
  129. package/esm/utils/headers.d.ts +9 -0
  130. package/esm/utils/headers.js +55 -0
  131. package/esm/utils/internal-data-types.d.ts +4 -0
  132. package/esm/utils/internal-data-types.js +41 -0
  133. package/esm/utils/responsive-object.d.ts +3 -0
  134. package/esm/utils/responsive-object.js +45 -0
  135. package/esm/utils/string-path-to-object-tree.d.ts +4 -0
  136. package/esm/utils/string-path-to-object-tree.js +22 -0
  137. package/esm/utils/terminal-utils.d.ts +4 -0
  138. package/esm/utils/terminal-utils.js +4 -0
  139. package/package.json +77 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Panates
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,3 @@
1
+ # @opra/core
2
+
3
+ OPRA schema package.
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RESOURCE_METADATA = exports.OpraVersion = void 0;
4
+ exports.OpraVersion = '1.0';
5
+ exports.RESOURCE_METADATA = 'opra:resource.metadata';
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiEntityResource = void 0;
4
+ const tslib_1 = require("tslib");
5
+ require("reflect-metadata");
6
+ const lodash_1 = tslib_1.__importDefault(require("lodash"));
7
+ const constants_js_1 = require("../constants.js");
8
+ const NESTJS_INJECTABLE_WATERMARK = '__injectable__';
9
+ const NAME_PATTERN = /^(.*)Resource$/;
10
+ function ApiEntityResource(entityFunc, options) {
11
+ return function (target) {
12
+ const name = options?.name || target.name.match(NAME_PATTERN)?.[1] || target.name;
13
+ const meta = {
14
+ kind: 'EntityResource',
15
+ type: entityFunc,
16
+ name
17
+ };
18
+ Object.assign(meta, lodash_1.default.omit(options, Object.keys(meta)));
19
+ Reflect.defineMetadata(constants_js_1.RESOURCE_METADATA, meta, target);
20
+ /* Define Injectable metadata for NestJS support*/
21
+ Reflect.defineMetadata(NESTJS_INJECTABLE_WATERMARK, true, target);
22
+ };
23
+ }
24
+ exports.ApiEntityResource = ApiEntityResource;
@@ -0,0 +1,393 @@
1
+ "use strict";
2
+ // noinspection JSUnusedGlobalSymbols
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.HttpHeaders = void 0;
5
+ /**
6
+ * https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers#controls
7
+ */
8
+ var HttpHeaders;
9
+ (function (HttpHeaders) {
10
+ /* *** Custom Headers *** */
11
+ HttpHeaders["X_Opra_Version"] = "X-Opra-Version";
12
+ /* *** Authentication *** */
13
+ /**
14
+ * Defines the authentication method that should be used to access a resource.
15
+ */
16
+ HttpHeaders["WWW_Authenticate"] = "WWW-Authenticate";
17
+ /**
18
+ * Contains the credentials to authenticate a user-agent with a server.
19
+ */
20
+ HttpHeaders["Authorization"] = "Authorization";
21
+ /**
22
+ * Defines the authentication method that should be used to access a resource behind a proxy server.
23
+ */
24
+ HttpHeaders["Proxy_Authenticate"] = "Proxy-Authenticate";
25
+ /**
26
+ * Contains the credentials to authenticate a user agent with a proxy server.
27
+ */
28
+ HttpHeaders["Proxy_Authorization"] = "Proxy-Authorization";
29
+ /* *** Caching *** */
30
+ /**
31
+ * The time, in seconds, that the object has been in a proxy cache.
32
+ */
33
+ HttpHeaders["Age"] = "Age";
34
+ /**
35
+ * Directives for caching mechanisms in both requests and responses.
36
+ */
37
+ HttpHeaders["Cache_Control"] = "Cache-Control";
38
+ /**
39
+ * Clears browsing data (e.g. cookies, storage, cache) associated with the requesting website.
40
+ */
41
+ HttpHeaders["Clear_Site_Data"] = "Clear-Site-Data";
42
+ /**
43
+ * The date/time after which the response is considered stale.
44
+ */
45
+ HttpHeaders["Expires"] = "Expires";
46
+ /**
47
+ * Implementation-specific header that may have various effects anywhere along the request-response chain.
48
+ * Used for backwards compatibility with HTTP/1.0 caches where the Cache-Control header is not yet present.
49
+ */
50
+ HttpHeaders["Pragma"] = "Pragma";
51
+ /* *** Conditionals *** */
52
+ /**
53
+ * The last modification date of the resource, used to compare several versions of the same resource.
54
+ * It is less accurate than ETag, but easier to calculate in some environments.
55
+ * Conditional requests using If-Modified-Since and If-Unmodified-Since
56
+ * use this value to change the behavior of the request.
57
+ */
58
+ HttpHeaders["Last_Modified"] = "Last-Modified";
59
+ /**
60
+ * A unique string identifying the version of the resource.
61
+ * Conditional requests using If-Match and If-None-Match use this value to change the behavior of the request.
62
+ */
63
+ HttpHeaders["ETag"] = "ETag";
64
+ /**
65
+ * Makes the request conditional, and applies the method only if the stored resource matches one of the given ETags.
66
+ */
67
+ HttpHeaders["If_Match"] = "If-Match";
68
+ /**
69
+ * Makes the request conditional, and applies the method only if the stored resource doesn't match
70
+ * any of the given ETags. This is used to update caches (for safe requests), or to prevent uploading
71
+ * a new resource when one already exists.
72
+ */
73
+ HttpHeaders["If_None_Match"] = "If-None-Match";
74
+ /**
75
+ * Makes the request conditional, and expects the resource to be transmitted only if it has been modified
76
+ * after the given date. This is used to transmit data only when the cache is out of date.
77
+ */
78
+ HttpHeaders["If_Modified_Since"] = "If-Modified-Since";
79
+ /**
80
+ * Makes the request conditional, and expects the resource to be transmitted only if
81
+ * it has not been modified after the given date. This ensures the coherence of a new
82
+ * fragment of a specific range with previous ones, or to implement an optimistic
83
+ * concurrency control system when modifying existing documents.
84
+ */
85
+ HttpHeaders["If_Unmodified_Since"] = "If-Unmodified-Since";
86
+ /**
87
+ * Determines how to match request headers to decide whether a cached response can be used
88
+ * rather than requesting a fresh one from the origin server.
89
+ */
90
+ HttpHeaders["Vary"] = "Vary";
91
+ /* *** Connection management *** */
92
+ /**
93
+ * Controls whether the network connection stays open after the current transaction finishes.
94
+ */
95
+ HttpHeaders["Connection"] = "Connection";
96
+ /**
97
+ * Controls how long a persistent connection should stay open.
98
+ */
99
+ HttpHeaders["Keep_Alive"] = "Keep-Alive";
100
+ // Content negotiation
101
+ /**
102
+ * Informs the server about the types of data that can be sent back.
103
+ */
104
+ HttpHeaders["Accept"] = "Accept";
105
+ /**
106
+ * The encoding algorithm, usually a compression algorithm, that can be used on the resource sent back.
107
+ */
108
+ HttpHeaders["Accept_Encoding"] = "Accept-Encoding";
109
+ /**
110
+ * Informs the server about the human language the server is expected to send back.
111
+ * This is a hint and is not necessarily under the full control of the user:
112
+ * the server should always pay attention not to override an explicit user choice
113
+ * (like selecting a language from a dropdown).
114
+ */
115
+ HttpHeaders["Accept_Language"] = "Accept-Language";
116
+ /* *** Controls *** */
117
+ /**
118
+ * Indicates expectations that need to be fulfilled by the server to properly handle the request.
119
+ */
120
+ HttpHeaders["Expect"] = "Expect";
121
+ /* *** Cookies *** */
122
+ /**
123
+ * Contains stored HTTP cookies previously sent by the server with the Set-Cookie header.
124
+ */
125
+ HttpHeaders["Cookie"] = "Cookie";
126
+ /**
127
+ * Send cookies from the server to the user-agent.
128
+ */
129
+ HttpHeaders["Set_Cookie"] = "Set-Cookie";
130
+ /* *** CORS *** */
131
+ /**
132
+ * Indicates whether the response can be shared.
133
+ */
134
+ HttpHeaders["Access_Control_Allow_Origin"] = "Access-Control-Allow-Origin";
135
+ /**
136
+ * Indicates whether the response to the request can be exposed when the credentials flag is true.
137
+ */
138
+ HttpHeaders["Access_Control_Allow_Credentials"] = "Access-Control-Allow-Credentials";
139
+ /**
140
+ * Used in response to a preflight request to indicate which HTTP headers can be used when making the actual request.
141
+ */
142
+ HttpHeaders["Access_Control_Allow_Headers"] = "Access-Control-Allow-Headers";
143
+ /**
144
+ * Specifies the methods allowed when accessing the resource in response to a preflight request.
145
+ */
146
+ HttpHeaders["Access_Control_Allow_Methods"] = "Access-Control-Allow-Methods";
147
+ /**
148
+ * Indicates which headers can be exposed as part of the response by listing their names.
149
+ */
150
+ HttpHeaders["Access_Control_Expose_Headers"] = "Access-Control-Expose-Headers";
151
+ /**
152
+ * Indicates how long the results of a preflight request can be cached.
153
+ */
154
+ HttpHeaders["Access_Control_Max_Age"] = "Access-Control-Max-Age";
155
+ /**
156
+ * Used when issuing a preflight request to let the server know which HTTP headers will be
157
+ * used when the actual request is made.
158
+ */
159
+ HttpHeaders["Access_Control_Request_Headers"] = "Access-Control-Request-Headers";
160
+ /**
161
+ * Used when issuing a preflight request to let the server know which HTTP method
162
+ * will be used when the actual request is made.
163
+ */
164
+ HttpHeaders["Access_Control_Request_Method"] = "Access-Control-Request-Method";
165
+ /**
166
+ * Indicates where a fetch originates from.
167
+ */
168
+ HttpHeaders["Origin"] = "Origin";
169
+ /**
170
+ * Specifies origins that are allowed to see values of attributes retrieved via features of the Resource Timing API,
171
+ * which would otherwise be reported as zero due to cross-origin restrictions.
172
+ */
173
+ HttpHeaders["Timing_Allow_Origin"] = "Timing-Allow-Origin";
174
+ /* *** Downloads *** */
175
+ /**
176
+ * Indicates if the resource transmitted should be displayed inline (default behavior without the header),
177
+ * or if it should be handled like a download and the browser should present a "Save As" dialog.
178
+ */
179
+ HttpHeaders["Content_Disposition"] = "Content-Disposition";
180
+ /* *** Message body information *** */
181
+ /**
182
+ * The size of the resource, in decimal number of bytes.
183
+ */
184
+ HttpHeaders["Content_Length"] = "Content-Length";
185
+ /**
186
+ * Indicates the media type of the resource.
187
+ */
188
+ HttpHeaders["Content_Type"] = "Content-Type";
189
+ /**
190
+ * Used to specify the compression algorithm.
191
+ */
192
+ HttpHeaders["Content_Encoding"] = "Content-Encoding";
193
+ /**
194
+ * Describes the human language(s) intended for the audience, so that it allows a user to
195
+ * differentiate according to the users' own preferred language.
196
+ */
197
+ HttpHeaders["Content_Language"] = "Content-Language";
198
+ /**
199
+ * Indicates an alternate location for the returned data.
200
+ */
201
+ HttpHeaders["Content_Location"] = "Content-Location";
202
+ // Proxies
203
+ /**
204
+ * Contains information from the client-facing side of proxy servers that is altered or
205
+ * lost when a proxy is involved in the path of the request.
206
+ */
207
+ HttpHeaders["Forwarded"] = "Forwarded";
208
+ /**
209
+ * Identifies the originating IP addresses of a client connecting to a web server
210
+ * through an HTTP proxy or a load balancer.
211
+ */
212
+ HttpHeaders["X_Forwarded_For"] = "X-Forwarded-For";
213
+ /**
214
+ * Identifies the original host requested that a client used to connect to your proxy or load balancer.
215
+ */
216
+ HttpHeaders["X_Forwarded_Host"] = "X-Forwarded-Host";
217
+ /**
218
+ * Identifies the protocol (HTTP or HTTPS) that a client used to connect to your proxy or load balancer.
219
+ */
220
+ HttpHeaders["X_Forwarded_Proto"] = "X-Forwarded-Proto";
221
+ /**
222
+ * Added by proxies, both forward and reverse proxies, and can appear in the request headers and the response headers.
223
+ */
224
+ HttpHeaders["Via"] = "Via";
225
+ /* *** Redirects *** */
226
+ /**
227
+ * Indicates the URL to redirect a page to.
228
+ */
229
+ HttpHeaders["Location"] = "Location";
230
+ /* *** Request context *** */
231
+ /**
232
+ * Contains an Internet email address for a human user who controls the requesting user agent.
233
+ */
234
+ HttpHeaders["From"] = "From";
235
+ /**
236
+ * Specifies the domain name of the server (for virtual hosting), and (optionally)
237
+ * the TCP port number on which the server is listening.
238
+ */
239
+ HttpHeaders["Host"] = "Host";
240
+ /**
241
+ * The address of the previous web page from which a link to the currently requested page was followed.
242
+ */
243
+ HttpHeaders["Referer"] = "Referer";
244
+ /**
245
+ * Governs which referrer information sent in the Referer header should be included with requests made.
246
+ */
247
+ HttpHeaders["Referrer_Policy"] = "Referrer-Policy";
248
+ /**
249
+ * Contains a characteristic string that allows the network protocol peers to identify the application type,
250
+ * operating system, software vendor or software version of the requesting software user agent.
251
+ */
252
+ HttpHeaders["User_Agent"] = "User-Agent";
253
+ /* *** Response context *** */
254
+ /**
255
+ * Lists the set of HTTP request methods supported by a resource.
256
+ */
257
+ HttpHeaders["Allow"] = "Allow";
258
+ /**
259
+ * Contains information about the software used by the origin server to handle the request.
260
+ */
261
+ HttpHeaders["Server"] = "Server";
262
+ /* *** Range requests *** */
263
+ /**
264
+ * Indicates if the server supports range requests, and if so in which unit the range can be expressed.
265
+ */
266
+ HttpHeaders["Accept_Ranges"] = "Accept-Ranges";
267
+ /**
268
+ * Indicates the part of a document that the server should return.
269
+ */
270
+ HttpHeaders["Range"] = "Range";
271
+ /**
272
+ * Creates a conditional range request that is only fulfilled if the given etag or date matches
273
+ * the remote resource. Used to prevent downloading two ranges from incompatible version of the resource.
274
+ */
275
+ HttpHeaders["If_Range"] = "If-Range";
276
+ /**
277
+ * Indicates where in a full body message a partial message belongs.
278
+ */
279
+ HttpHeaders["Content_Range"] = "Content-Range";
280
+ /* *** Security *** */
281
+ /**
282
+ * Allows a server to declare an embedder policy for a given document.
283
+ */
284
+ HttpHeaders["Cross_Origin_Embedder_Policy"] = "Cross-Origin-Embedder-Policy";
285
+ /**
286
+ * Prevents other domains from opening/controlling a window.
287
+ */
288
+ HttpHeaders["Cross_Origin_Opener_Policy"] = "Cross-Origin-Opener-Policy";
289
+ /**
290
+ * Prevents other domains from reading the response of the resources to which this header is applied.
291
+ */
292
+ HttpHeaders["Cross_Origin_Resource_Policy"] = "Cross-Origin-Resource-Policy";
293
+ /**
294
+ * Controls resources the user agent is allowed to load for a given page.
295
+ */
296
+ HttpHeaders["Content_Security_Policy"] = "Content-Security-Policy";
297
+ /**
298
+ * Allows web developers to experiment with policies by monitoring, but not enforcing, their effects.
299
+ * These violation reports consist of JSON documents sent via an HTTP POST request to the specified URI.
300
+ */
301
+ HttpHeaders["Content_Security_Policy_Report_Only"] = "Content-Security-Policy-Report-Only";
302
+ /**
303
+ * Allows sites to opt in to reporting and/or enforcement of Certificate Transparency requirements,
304
+ * which prevents the use of misissued certificates for that site from going unnoticed.
305
+ * When a site enables the Expect-CT header, they are requesting that Chrome check that
306
+ * any certificate for that site appears in public CT logs.
307
+ */
308
+ HttpHeaders["Expect_CT"] = "Expect-CT";
309
+ /**
310
+ * Provides a mechanism to allow and deny the use of browser features in its own frame,
311
+ * and in iframes that it embeds.
312
+ */
313
+ HttpHeaders["Feature_Policy"] = "Feature-Policy";
314
+ /**
315
+ * Force communication using HTTPS instead of HTTP.
316
+ */
317
+ HttpHeaders["Strict_Transport_Security"] = "Strict-Transport-Security";
318
+ /**
319
+ * Sends a signal to the server expressing the client's preference for an encrypted and authenticated response,
320
+ * and that it can successfully handle the upgrade-insecure-requests directive.
321
+ */
322
+ HttpHeaders["Upgrade_Insecure_Requests"] = "Upgrade-Insecure-Requests";
323
+ /**
324
+ * Disables MIME sniffing and forces browser to use the type given in Content-Type.
325
+ */
326
+ HttpHeaders["X_Content_Type_Options"] = "X-Content-Type-Options";
327
+ /**
328
+ * The X-Download-Options HTTP header indicates that the browser (Internet Explorer)
329
+ * should not display the option to "Open" a file that has been downloaded from an application,
330
+ * to prevent phishing attacks as the file otherwise would gain access to execute in the context of the application.
331
+ */
332
+ HttpHeaders["X_Download_Options"] = "X-Download-Options";
333
+ /**
334
+ * Indicates whether a browser should be allowed to render a page in a <frame>, <iframe>, <embed> or <object>.
335
+ */
336
+ HttpHeaders["X_Frame_Options"] = "X-Frame-Options";
337
+ /**
338
+ * Specifies if a cross-domain policy file (crossdomain.xml) is allowed.
339
+ * The file may define a policy to grant clients, such as Adobe's Flash Player (now obsolete),
340
+ * Adobe Acrobat, Microsoft Silverlight (now obsolete), or Apache Flex,
341
+ * permission to handle data across domains that would otherwise be restricted
342
+ * due to the Same-Origin Policy. See the Cross-domain Policy File Specification for more information.
343
+ */
344
+ HttpHeaders["X_Permitted_Cross_Domain_Policies"] = "X-Permitted-Cross-Domain-Policies";
345
+ /**
346
+ * May be set by hosting environments or other frameworks and contains information about
347
+ * them while not providing any usefulness to the application or its visitors.
348
+ * Unset this header to avoid exposing potential vulnerabilities.
349
+ */
350
+ HttpHeaders["X_Powered_By"] = "X-Powered-By";
351
+ /**
352
+ * Enables cross-site scripting filtering.
353
+ */
354
+ HttpHeaders["X_XSS_Protection"] = "X-XSS-Protection";
355
+ /* *** Transfer coding *** */
356
+ /**
357
+ * Specifies the form of encoding used to safely transfer the resource to the user.
358
+ */
359
+ HttpHeaders["Transfer_Encoding"] = "Transfer-Encoding";
360
+ /**
361
+ * Specifies the transfer encodings the user agent is willing to accept.
362
+ */
363
+ HttpHeaders["TE"] = "TE";
364
+ /**
365
+ * Allows the sender to include additional fields at the end of chunked message.
366
+ */
367
+ HttpHeaders["Trailer"] = "Trailer";
368
+ /* *** WebSockets *** */
369
+ HttpHeaders["Sec_WebSocket_Key"] = "Sec-WebSocket-Key";
370
+ HttpHeaders["Sec_WebSocket_Extensions"] = "Sec-WebSocket-Extensions";
371
+ HttpHeaders["Sec_WebSocket_Accept"] = "Sec-WebSocket-Accept";
372
+ HttpHeaders["Sec_WebSocket_Protocol"] = "Sec-WebSocket-Protocol";
373
+ HttpHeaders["Sec_WebSocket_Version"] = "Sec-WebSocket-Version";
374
+ /* *** Other *** */
375
+ /**
376
+ * Contains the date and time at which the message was originated.
377
+ */
378
+ HttpHeaders["Date"] = "Date";
379
+ /**
380
+ * Indicates how long the user agent should wait before making a follow-up request.
381
+ */
382
+ HttpHeaders["Retry_After"] = "Retry-After";
383
+ /**
384
+ * Communicates one or more metrics and descriptions for the given request-response cycle.
385
+ */
386
+ HttpHeaders["Server_Timing"] = "Server-Timing";
387
+ /**
388
+ * Controls DNS prefetching, a feature by which browsers proactively perform domain name
389
+ * resolution on both links that the user may choose to follow as well as URLs for items
390
+ * referenced by the document, including images, CSS, JavaScript, and so forth.
391
+ */
392
+ HttpHeaders["X_DNS_Prefetch_Control"] = "X-DNS-Prefetch-Control";
393
+ })(HttpHeaders = exports.HttpHeaders || (exports.HttpHeaders = {}));