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