@twin.org/api-models 0.0.2-next.9 → 0.0.3-next.1

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 (164) hide show
  1. package/dist/es/factories/authenticationGeneratorFactory.js +9 -0
  2. package/dist/es/factories/authenticationGeneratorFactory.js.map +1 -0
  3. package/dist/es/factories/mimeTypeProcessorFactory.js +9 -0
  4. package/dist/es/factories/mimeTypeProcessorFactory.js.map +1 -0
  5. package/dist/es/factories/restRouteProcessorFactory.js +9 -0
  6. package/dist/es/factories/restRouteProcessorFactory.js.map +1 -0
  7. package/dist/es/factories/socketRouteProcessorFactory.js +9 -0
  8. package/dist/es/factories/socketRouteProcessorFactory.js.map +1 -0
  9. package/dist/es/helpers/httpErrorHelper.js +60 -0
  10. package/dist/es/helpers/httpErrorHelper.js.map +1 -0
  11. package/dist/es/helpers/httpParameterHelper.js +41 -0
  12. package/dist/es/helpers/httpParameterHelper.js.map +1 -0
  13. package/dist/es/index.js +59 -0
  14. package/dist/es/index.js.map +1 -0
  15. package/dist/es/models/api/IServerFavIconResponse.js +2 -0
  16. package/dist/es/models/api/IServerFavIconResponse.js.map +1 -0
  17. package/dist/es/models/api/IServerHealthResponse.js +2 -0
  18. package/dist/es/models/api/IServerHealthResponse.js.map +1 -0
  19. package/dist/es/models/api/IServerInfoResponse.js +2 -0
  20. package/dist/es/models/api/IServerInfoResponse.js.map +1 -0
  21. package/dist/es/models/api/IServerRootResponse.js +4 -0
  22. package/dist/es/models/api/IServerRootResponse.js.map +1 -0
  23. package/dist/es/models/api/IServerSpecResponse.js +2 -0
  24. package/dist/es/models/api/IServerSpecResponse.js.map +1 -0
  25. package/dist/es/models/client/IAuthenticationGenerator.js +2 -0
  26. package/dist/es/models/client/IAuthenticationGenerator.js.map +1 -0
  27. package/dist/es/models/config/IBaseRestClientConfig.js +2 -0
  28. package/dist/es/models/config/IBaseRestClientConfig.js.map +1 -0
  29. package/dist/es/models/config/IBaseSocketClientConfig.js +2 -0
  30. package/dist/es/models/config/IBaseSocketClientConfig.js.map +1 -0
  31. package/dist/es/models/protocol/IHttpRequest.js +2 -0
  32. package/dist/es/models/protocol/IHttpRequest.js.map +1 -0
  33. package/dist/es/models/protocol/IHttpRequestContext.js +2 -0
  34. package/dist/es/models/protocol/IHttpRequestContext.js.map +1 -0
  35. package/dist/es/models/protocol/IHttpRequestPathParams.js +4 -0
  36. package/dist/es/models/protocol/IHttpRequestPathParams.js.map +1 -0
  37. package/dist/es/models/protocol/IHttpRequestQuery.js +4 -0
  38. package/dist/es/models/protocol/IHttpRequestQuery.js.map +1 -0
  39. package/dist/es/models/protocol/IHttpResponse.js +2 -0
  40. package/dist/es/models/protocol/IHttpResponse.js.map +1 -0
  41. package/dist/es/models/protocol/IHttpServerRequest.js +2 -0
  42. package/dist/es/models/protocol/IHttpServerRequest.js.map +1 -0
  43. package/dist/es/models/protocol/ISocketRequestContext.js +2 -0
  44. package/dist/es/models/protocol/ISocketRequestContext.js.map +1 -0
  45. package/dist/es/models/protocol/ISocketServerRequest.js +2 -0
  46. package/dist/es/models/protocol/ISocketServerRequest.js.map +1 -0
  47. package/dist/es/models/requests/INoContentRequest.js +2 -0
  48. package/dist/es/models/requests/INoContentRequest.js.map +1 -0
  49. package/dist/es/models/responses/errors/IBadRequestResponse.js +2 -0
  50. package/dist/es/models/responses/errors/IBadRequestResponse.js.map +1 -0
  51. package/dist/es/models/responses/errors/IConflictResponse.js +2 -0
  52. package/dist/es/models/responses/errors/IConflictResponse.js.map +1 -0
  53. package/dist/es/models/responses/errors/IForbiddenResponse.js +2 -0
  54. package/dist/es/models/responses/errors/IForbiddenResponse.js.map +1 -0
  55. package/dist/es/models/responses/errors/IInternalServerErrorResponse.js +2 -0
  56. package/dist/es/models/responses/errors/IInternalServerErrorResponse.js.map +1 -0
  57. package/dist/es/models/responses/errors/INotFoundResponse.js +2 -0
  58. package/dist/es/models/responses/errors/INotFoundResponse.js.map +1 -0
  59. package/dist/es/models/responses/errors/IUnauthorizedResponse.js +2 -0
  60. package/dist/es/models/responses/errors/IUnauthorizedResponse.js.map +1 -0
  61. package/dist/es/models/responses/errors/IUnprocessableEntityResponse.js +2 -0
  62. package/dist/es/models/responses/errors/IUnprocessableEntityResponse.js.map +1 -0
  63. package/dist/es/models/responses/success/IAcceptedResponse.js +2 -0
  64. package/dist/es/models/responses/success/IAcceptedResponse.js.map +1 -0
  65. package/dist/es/models/responses/success/ICreatedResponse.js +2 -0
  66. package/dist/es/models/responses/success/ICreatedResponse.js.map +1 -0
  67. package/dist/es/models/responses/success/INoContentResponse.js +2 -0
  68. package/dist/es/models/responses/success/INoContentResponse.js.map +1 -0
  69. package/dist/es/models/responses/success/IOkResponse.js +2 -0
  70. package/dist/es/models/responses/success/IOkResponse.js.map +1 -0
  71. package/dist/es/models/routes/IBaseRoute.js +4 -0
  72. package/dist/es/models/routes/IBaseRoute.js.map +1 -0
  73. package/dist/es/models/routes/IBaseRouteEntryPoint.js +2 -0
  74. package/dist/es/models/routes/IBaseRouteEntryPoint.js.map +1 -0
  75. package/dist/es/models/routes/IRestRoute.js +2 -0
  76. package/dist/es/models/routes/IRestRoute.js.map +1 -0
  77. package/dist/es/models/routes/IRestRouteEntryPoint.js +2 -0
  78. package/dist/es/models/routes/IRestRouteEntryPoint.js.map +1 -0
  79. package/dist/es/models/routes/IRestRouteExample.js +4 -0
  80. package/dist/es/models/routes/IRestRouteExample.js.map +1 -0
  81. package/dist/es/models/routes/IRestRouteRequestExample.js +2 -0
  82. package/dist/es/models/routes/IRestRouteRequestExample.js.map +1 -0
  83. package/dist/es/models/routes/IRestRouteResponseAttachmentOptions.js +4 -0
  84. package/dist/es/models/routes/IRestRouteResponseAttachmentOptions.js.map +1 -0
  85. package/dist/es/models/routes/IRestRouteResponseExample.js +2 -0
  86. package/dist/es/models/routes/IRestRouteResponseExample.js.map +1 -0
  87. package/dist/es/models/routes/IRestRouteResponseOptions.js +2 -0
  88. package/dist/es/models/routes/IRestRouteResponseOptions.js.map +1 -0
  89. package/dist/es/models/routes/ISocketRoute.js +2 -0
  90. package/dist/es/models/routes/ISocketRoute.js.map +1 -0
  91. package/dist/es/models/routes/ISocketRouteEntryPoint.js +2 -0
  92. package/dist/es/models/routes/ISocketRouteEntryPoint.js.map +1 -0
  93. package/dist/es/models/routes/ITag.js +4 -0
  94. package/dist/es/models/routes/ITag.js.map +1 -0
  95. package/dist/es/models/server/IBaseRouteProcessor.js +2 -0
  96. package/dist/es/models/server/IBaseRouteProcessor.js.map +1 -0
  97. package/dist/es/models/server/IMimeTypeProcessor.js +2 -0
  98. package/dist/es/models/server/IMimeTypeProcessor.js.map +1 -0
  99. package/dist/es/models/server/IRestRouteProcessor.js +2 -0
  100. package/dist/es/models/server/IRestRouteProcessor.js.map +1 -0
  101. package/dist/es/models/server/ISocketRouteProcessor.js +2 -0
  102. package/dist/es/models/server/ISocketRouteProcessor.js.map +1 -0
  103. package/dist/es/models/server/IWebServer.js +2 -0
  104. package/dist/es/models/server/IWebServer.js.map +1 -0
  105. package/dist/es/models/server/IWebServerOptions.js +2 -0
  106. package/dist/es/models/server/IWebServerOptions.js.map +1 -0
  107. package/dist/es/models/services/IHealthInfo.js +2 -0
  108. package/dist/es/models/services/IHealthInfo.js.map +1 -0
  109. package/dist/es/models/services/IInformationComponent.js +2 -0
  110. package/dist/es/models/services/IInformationComponent.js.map +1 -0
  111. package/dist/es/models/services/IServerInfo.js +4 -0
  112. package/dist/es/models/services/IServerInfo.js.map +1 -0
  113. package/dist/es/models/services/healthStatus.js +21 -0
  114. package/dist/es/models/services/healthStatus.js.map +1 -0
  115. package/dist/types/factories/authenticationGeneratorFactory.d.ts +6 -0
  116. package/dist/types/factories/mimeTypeProcessorFactory.d.ts +1 -1
  117. package/dist/types/factories/restRouteProcessorFactory.d.ts +1 -1
  118. package/dist/types/factories/socketRouteProcessorFactory.d.ts +1 -1
  119. package/dist/types/helpers/httpErrorHelper.d.ts +1 -1
  120. package/dist/types/index.d.ts +56 -55
  121. package/dist/types/models/api/IServerHealthResponse.d.ts +1 -1
  122. package/dist/types/models/api/IServerInfoResponse.d.ts +1 -1
  123. package/dist/types/models/client/IAuthenticationGenerator.d.ts +14 -0
  124. package/dist/types/models/protocol/IHttpRequest.d.ts +2 -2
  125. package/dist/types/models/protocol/IHttpRequestContext.d.ts +2 -3
  126. package/dist/types/models/protocol/IHttpServerRequest.d.ts +1 -1
  127. package/dist/types/models/protocol/ISocketRequestContext.d.ts +1 -1
  128. package/dist/types/models/protocol/ISocketServerRequest.d.ts +1 -1
  129. package/dist/types/models/requests/INoContentRequest.d.ts +1 -1
  130. package/dist/types/models/routes/IBaseRoute.d.ts +10 -0
  131. package/dist/types/models/routes/IBaseRouteEntryPoint.d.ts +1 -1
  132. package/dist/types/models/routes/IRestRoute.d.ts +7 -7
  133. package/dist/types/models/routes/IRestRouteEntryPoint.d.ts +2 -2
  134. package/dist/types/models/routes/IRestRouteRequestExample.d.ts +1 -1
  135. package/dist/types/models/routes/IRestRouteResponseExample.d.ts +1 -1
  136. package/dist/types/models/routes/IRestRouteResponseOptions.d.ts +1 -1
  137. package/dist/types/models/routes/ISocketRoute.d.ts +4 -4
  138. package/dist/types/models/routes/ISocketRouteEntryPoint.d.ts +2 -2
  139. package/dist/types/models/server/IBaseRouteProcessor.d.ts +15 -8
  140. package/dist/types/models/server/IRestRouteProcessor.d.ts +5 -7
  141. package/dist/types/models/server/ISocketRouteProcessor.d.ts +5 -7
  142. package/dist/types/models/server/IWebServer.d.ts +5 -5
  143. package/dist/types/models/services/IHealthInfo.d.ts +1 -1
  144. package/dist/types/models/services/IInformationComponent.d.ts +3 -3
  145. package/docs/changelog.md +47 -0
  146. package/docs/reference/classes/HttpParameterHelper.md +8 -8
  147. package/docs/reference/index.md +2 -1
  148. package/docs/reference/interfaces/IAuthenticationGenerator.md +35 -0
  149. package/docs/reference/interfaces/IBaseRoute.md +20 -0
  150. package/docs/reference/interfaces/IBaseRouteProcessor.md +26 -10
  151. package/docs/reference/interfaces/IHttpRequestContext.md +0 -28
  152. package/docs/reference/interfaces/IInformationComponent.md +2 -2
  153. package/docs/reference/interfaces/IRestRoute.md +28 -0
  154. package/docs/reference/interfaces/IRestRouteProcessor.md +32 -18
  155. package/docs/reference/interfaces/ISocketRequestContext.md +0 -24
  156. package/docs/reference/interfaces/ISocketRoute.md +28 -0
  157. package/docs/reference/interfaces/ISocketRouteProcessor.md +34 -20
  158. package/docs/reference/variables/AuthenticationGeneratorFactory.md +5 -0
  159. package/locales/en.json +1 -9
  160. package/package.json +23 -8
  161. package/dist/cjs/index.cjs +0 -154
  162. package/dist/esm/index.mjs +0 -147
  163. package/dist/types/models/protocol/IHttpRequestIdentity.d.ts +0 -13
  164. package/docs/reference/interfaces/IHttpRequestIdentity.md +0 -23
@@ -0,0 +1,9 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { Factory } from "@twin.org/core";
4
+ /**
5
+ * Factory for creating implementation of authentication generator types.
6
+ */
7
+ // eslint-disable-next-line @typescript-eslint/naming-convention
8
+ export const AuthenticationGeneratorFactory = Factory.createFactory("authentication-generator");
9
+ //# sourceMappingURL=authenticationGeneratorFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticationGeneratorFactory.js","sourceRoot":"","sources":["../../../src/factories/authenticationGeneratorFactory.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,8BAA8B,GAAG,OAAO,CAAC,aAAa,CAClE,0BAA0B,CAC1B,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Factory } from \"@twin.org/core\";\nimport type { IAuthenticationGenerator } from \"../models/client/IAuthenticationGenerator.js\";\n\n/**\n * Factory for creating implementation of authentication generator types.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const AuthenticationGeneratorFactory = Factory.createFactory<IAuthenticationGenerator>(\n\t\"authentication-generator\"\n);\n"]}
@@ -0,0 +1,9 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { Factory } from "@twin.org/core";
4
+ /**
5
+ * Factory for creating implementation of mime type processor types.
6
+ */
7
+ // eslint-disable-next-line @typescript-eslint/naming-convention
8
+ export const MimeTypeProcessorFactory = Factory.createFactory("mime-type-processor");
9
+ //# sourceMappingURL=mimeTypeProcessorFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mimeTypeProcessorFactory.js","sourceRoot":"","sources":["../../../src/factories/mimeTypeProcessorFactory.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,wBAAwB,GACpC,OAAO,CAAC,aAAa,CAAqB,qBAAqB,CAAC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Factory } from \"@twin.org/core\";\nimport type { IMimeTypeProcessor } from \"../models/server/IMimeTypeProcessor.js\";\n\n/**\n * Factory for creating implementation of mime type processor types.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const MimeTypeProcessorFactory =\n\tFactory.createFactory<IMimeTypeProcessor>(\"mime-type-processor\");\n"]}
@@ -0,0 +1,9 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { Factory } from "@twin.org/core";
4
+ /**
5
+ * Factory for creating implementation of REST route processor types.
6
+ */
7
+ // eslint-disable-next-line @typescript-eslint/naming-convention
8
+ export const RestRouteProcessorFactory = Factory.createFactory("rest-route-processor");
9
+ //# sourceMappingURL=restRouteProcessorFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restRouteProcessorFactory.js","sourceRoot":"","sources":["../../../src/factories/restRouteProcessorFactory.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,yBAAyB,GACrC,OAAO,CAAC,aAAa,CAAsB,sBAAsB,CAAC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Factory } from \"@twin.org/core\";\nimport type { IRestRouteProcessor } from \"../models/server/IRestRouteProcessor.js\";\n\n/**\n * Factory for creating implementation of REST route processor types.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const RestRouteProcessorFactory =\n\tFactory.createFactory<IRestRouteProcessor>(\"rest-route-processor\");\n"]}
@@ -0,0 +1,9 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { Factory } from "@twin.org/core";
4
+ /**
5
+ * Factory for creating implementation of socket route processor types.
6
+ */
7
+ // eslint-disable-next-line @typescript-eslint/naming-convention
8
+ export const SocketRouteProcessorFactory = Factory.createFactory("socket-route-processor");
9
+ //# sourceMappingURL=socketRouteProcessorFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"socketRouteProcessorFactory.js","sourceRoot":"","sources":["../../../src/factories/socketRouteProcessorFactory.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC;;GAEG;AACH,gEAAgE;AAChE,MAAM,CAAC,MAAM,2BAA2B,GACvC,OAAO,CAAC,aAAa,CAAwB,wBAAwB,CAAC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Factory } from \"@twin.org/core\";\nimport type { ISocketRouteProcessor } from \"../models/server/ISocketRouteProcessor.js\";\n\n/**\n * Factory for creating implementation of socket route processor types.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport const SocketRouteProcessorFactory =\n\tFactory.createFactory<ISocketRouteProcessor>(\"socket-route-processor\");\n"]}
@@ -0,0 +1,60 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { AlreadyExistsError, BaseError, ConflictError, GuardError, NotFoundError, NotImplementedError, UnauthorizedError, UnprocessableError, ValidationError } from "@twin.org/core";
4
+ import { HeaderTypes, HttpStatusCode, MimeTypes } from "@twin.org/web";
5
+ /**
6
+ * Class to help with processing http errors.
7
+ */
8
+ export class HttpErrorHelper {
9
+ /**
10
+ * Process the errors from the routes.
11
+ * @param err The error to process.
12
+ * @param includeStack Should the stack be included in the error.
13
+ * @returns The status code and additional error data.
14
+ */
15
+ static processError(err, includeStack) {
16
+ const error = BaseError.fromError(err);
17
+ // If the error or any of its sub errors are of the specific
18
+ // types then set the http response code accordingly
19
+ const flattened = BaseError.flatten(error);
20
+ let httpStatusCode = HttpStatusCode.internalServerError;
21
+ if (flattened.some(e => BaseError.isErrorName(e, GuardError.CLASS_NAME)) ||
22
+ flattened.some(e => BaseError.isErrorName(e, ValidationError.CLASS_NAME))) {
23
+ httpStatusCode = HttpStatusCode.badRequest;
24
+ }
25
+ else if (flattened.some(e => BaseError.isErrorName(e, ConflictError.CLASS_NAME)) ||
26
+ flattened.some(e => BaseError.isErrorName(e, AlreadyExistsError.CLASS_NAME))) {
27
+ httpStatusCode = HttpStatusCode.conflict;
28
+ }
29
+ else if (flattened.some(e => BaseError.isErrorName(e, NotFoundError.CLASS_NAME))) {
30
+ httpStatusCode = HttpStatusCode.notFound;
31
+ }
32
+ else if (flattened.some(e => BaseError.isErrorName(e, UnauthorizedError.CLASS_NAME))) {
33
+ httpStatusCode = HttpStatusCode.unauthorized;
34
+ }
35
+ else if (flattened.some(e => BaseError.isErrorName(e, NotImplementedError.CLASS_NAME))) {
36
+ httpStatusCode = HttpStatusCode.forbidden;
37
+ }
38
+ else if (flattened.some(e => BaseError.isErrorName(e, UnprocessableError.CLASS_NAME))) {
39
+ httpStatusCode = HttpStatusCode.unprocessableEntity;
40
+ }
41
+ const returnError = error.toJsonObject(includeStack);
42
+ return {
43
+ error: returnError,
44
+ httpStatusCode
45
+ };
46
+ }
47
+ /**
48
+ * Build an error response.
49
+ * @param response The response to build the error into.
50
+ * @param error The error to build the response for.
51
+ * @param statusCode The status code to use for the error.
52
+ */
53
+ static buildResponse(response, error, statusCode) {
54
+ response.headers ??= {};
55
+ response.headers[HeaderTypes.ContentType] = `${MimeTypes.Json}; charset=utf-8`;
56
+ response.body = error;
57
+ response.statusCode = statusCode;
58
+ }
59
+ }
60
+ //# sourceMappingURL=httpErrorHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpErrorHelper.js","sourceRoot":"","sources":["../../../src/helpers/httpErrorHelper.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EACN,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,UAAU,EAEV,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGvE;;GAEG;AACH,MAAM,OAAO,eAAe;IAC3B;;;;;OAKG;IACI,MAAM,CAAC,YAAY,CACzB,GAAY,EACZ,YAAsB;QAKtB,MAAM,KAAK,GAAc,SAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAElD,4DAA4D;QAC5D,oDAAoD;QACpD,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAE3C,IAAI,cAAc,GAAmB,cAAc,CAAC,mBAAmB,CAAC;QACxE,IACC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;YACpE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC,EACxE,CAAC;YACF,cAAc,GAAG,cAAc,CAAC,UAAU,CAAC;QAC5C,CAAC;aAAM,IACN,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;YACvE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC,EAC3E,CAAC;YACF,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC;QAC1C,CAAC;aAAM,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;YACpF,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC;QAC1C,CAAC;aAAM,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;YACxF,cAAc,GAAG,cAAc,CAAC,YAAY,CAAC;QAC9C,CAAC;aAAM,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;YAC1F,cAAc,GAAG,cAAc,CAAC,SAAS,CAAC;QAC3C,CAAC;aAAM,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;YACzF,cAAc,GAAG,cAAc,CAAC,mBAAmB,CAAC;QACrD,CAAC;QAED,MAAM,WAAW,GAAG,KAAK,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QAErD,OAAO;YACN,KAAK,EAAE,WAAW;YAClB,cAAc;SACd,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,aAAa,CAC1B,QAAuB,EACvB,KAAa,EACb,UAA0B;QAE1B,QAAQ,CAAC,OAAO,KAAK,EAAE,CAAC;QACxB,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,GAAG,SAAS,CAAC,IAAI,iBAAiB,CAAC;QAC/E,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC;QACtB,QAAQ,CAAC,UAAU,GAAG,UAAU,CAAC;IAClC,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport {\n\tAlreadyExistsError,\n\tBaseError,\n\tConflictError,\n\tGuardError,\n\ttype IError,\n\tNotFoundError,\n\tNotImplementedError,\n\tUnauthorizedError,\n\tUnprocessableError,\n\tValidationError\n} from \"@twin.org/core\";\nimport { HeaderTypes, HttpStatusCode, MimeTypes } from \"@twin.org/web\";\nimport type { IHttpResponse } from \"../models/protocol/IHttpResponse.js\";\n\n/**\n * Class to help with processing http errors.\n */\nexport class HttpErrorHelper {\n\t/**\n\t * Process the errors from the routes.\n\t * @param err The error to process.\n\t * @param includeStack Should the stack be included in the error.\n\t * @returns The status code and additional error data.\n\t */\n\tpublic static processError(\n\t\terr: unknown,\n\t\tincludeStack?: boolean\n\t): {\n\t\terror: IError;\n\t\thttpStatusCode: HttpStatusCode;\n\t} {\n\t\tconst error: BaseError = BaseError.fromError(err);\n\n\t\t// If the error or any of its sub errors are of the specific\n\t\t// types then set the http response code accordingly\n\t\tconst flattened = BaseError.flatten(error);\n\n\t\tlet httpStatusCode: HttpStatusCode = HttpStatusCode.internalServerError;\n\t\tif (\n\t\t\tflattened.some(e => BaseError.isErrorName(e, GuardError.CLASS_NAME)) ||\n\t\t\tflattened.some(e => BaseError.isErrorName(e, ValidationError.CLASS_NAME))\n\t\t) {\n\t\t\thttpStatusCode = HttpStatusCode.badRequest;\n\t\t} else if (\n\t\t\tflattened.some(e => BaseError.isErrorName(e, ConflictError.CLASS_NAME)) ||\n\t\t\tflattened.some(e => BaseError.isErrorName(e, AlreadyExistsError.CLASS_NAME))\n\t\t) {\n\t\t\thttpStatusCode = HttpStatusCode.conflict;\n\t\t} else if (flattened.some(e => BaseError.isErrorName(e, NotFoundError.CLASS_NAME))) {\n\t\t\thttpStatusCode = HttpStatusCode.notFound;\n\t\t} else if (flattened.some(e => BaseError.isErrorName(e, UnauthorizedError.CLASS_NAME))) {\n\t\t\thttpStatusCode = HttpStatusCode.unauthorized;\n\t\t} else if (flattened.some(e => BaseError.isErrorName(e, NotImplementedError.CLASS_NAME))) {\n\t\t\thttpStatusCode = HttpStatusCode.forbidden;\n\t\t} else if (flattened.some(e => BaseError.isErrorName(e, UnprocessableError.CLASS_NAME))) {\n\t\t\thttpStatusCode = HttpStatusCode.unprocessableEntity;\n\t\t}\n\n\t\tconst returnError = error.toJsonObject(includeStack);\n\n\t\treturn {\n\t\t\terror: returnError,\n\t\t\thttpStatusCode\n\t\t};\n\t}\n\n\t/**\n\t * Build an error response.\n\t * @param response The response to build the error into.\n\t * @param error The error to build the response for.\n\t * @param statusCode The status code to use for the error.\n\t */\n\tpublic static buildResponse(\n\t\tresponse: IHttpResponse,\n\t\terror: IError,\n\t\tstatusCode: HttpStatusCode\n\t): void {\n\t\tresponse.headers ??= {};\n\t\tresponse.headers[HeaderTypes.ContentType] = `${MimeTypes.Json}; charset=utf-8`;\n\t\tresponse.body = error;\n\t\tresponse.statusCode = statusCode;\n\t}\n}\n"]}
@@ -0,0 +1,41 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import { Is } from "@twin.org/core";
4
+ /**
5
+ * Class to help with handling http parameters.
6
+ */
7
+ export class HttpParameterHelper {
8
+ /**
9
+ * Convert list query to array.
10
+ * @param values The values query string.
11
+ * @returns The array of values.
12
+ */
13
+ static arrayFromString(values) {
14
+ return values?.split(",");
15
+ }
16
+ /**
17
+ * Convert array of values to query string.
18
+ * @param values The values to combine string.
19
+ * @returns The combined.
20
+ */
21
+ static arrayToString(values) {
22
+ return values?.join(",");
23
+ }
24
+ /**
25
+ * Convert object string to object.
26
+ * @param value The value query string.
27
+ * @returns The object.
28
+ */
29
+ static objectFromString(value) {
30
+ return Is.json(value) ? JSON.parse(value) : undefined;
31
+ }
32
+ /**
33
+ * Convert object to query string.
34
+ * @param value The value to convert to a string.
35
+ * @returns The converted object.
36
+ */
37
+ static objectToString(value) {
38
+ return Is.empty(value) ? undefined : JSON.stringify(value);
39
+ }
40
+ }
41
+ //# sourceMappingURL=httpParameterHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpParameterHelper.js","sourceRoot":"","sources":["../../../src/helpers/httpParameterHelper.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAC/B;;;;OAIG;IACI,MAAM,CAAC,eAAe,CAAa,MAAe;QACxD,OAAO,MAAM,EAAE,KAAK,CAAC,GAAG,CAAQ,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,aAAa,CAAa,MAAY;QACnD,OAAO,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,gBAAgB,CAAc,KAAc;QACzD,OAAO,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAO,CAAC,CAAC,CAAC,SAAS,CAAC;IAC9D,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,cAAc,CAAc,KAAS;QAClD,OAAO,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC5D,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { Is } from \"@twin.org/core\";\n\n/**\n * Class to help with handling http parameters.\n */\nexport class HttpParameterHelper {\n\t/**\n\t * Convert list query to array.\n\t * @param values The values query string.\n\t * @returns The array of values.\n\t */\n\tpublic static arrayFromString<T = string>(values?: string): T[] | undefined {\n\t\treturn values?.split(\",\") as T[];\n\t}\n\n\t/**\n\t * Convert array of values to query string.\n\t * @param values The values to combine string.\n\t * @returns The combined.\n\t */\n\tpublic static arrayToString<T = string>(values?: T[]): string | undefined {\n\t\treturn values?.join(\",\");\n\t}\n\n\t/**\n\t * Convert object string to object.\n\t * @param value The value query string.\n\t * @returns The object.\n\t */\n\tpublic static objectFromString<T = unknown>(value?: string): T | undefined {\n\t\treturn Is.json(value) ? (JSON.parse(value) as T) : undefined;\n\t}\n\n\t/**\n\t * Convert object to query string.\n\t * @param value The value to convert to a string.\n\t * @returns The converted object.\n\t */\n\tpublic static objectToString<T = unknown>(value?: T): string | undefined {\n\t\treturn Is.empty(value) ? undefined : JSON.stringify(value);\n\t}\n}\n"]}
@@ -0,0 +1,59 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export * from "./factories/authenticationGeneratorFactory.js";
4
+ export * from "./factories/mimeTypeProcessorFactory.js";
5
+ export * from "./factories/restRouteProcessorFactory.js";
6
+ export * from "./factories/socketRouteProcessorFactory.js";
7
+ export * from "./helpers/httpErrorHelper.js";
8
+ export * from "./helpers/httpParameterHelper.js";
9
+ export * from "./models/api/IServerFavIconResponse.js";
10
+ export * from "./models/api/IServerHealthResponse.js";
11
+ export * from "./models/api/IServerInfoResponse.js";
12
+ export * from "./models/api/IServerRootResponse.js";
13
+ export * from "./models/api/IServerSpecResponse.js";
14
+ export * from "./models/client/IAuthenticationGenerator.js";
15
+ export * from "./models/config/IBaseRestClientConfig.js";
16
+ export * from "./models/config/IBaseSocketClientConfig.js";
17
+ export * from "./models/protocol/IHttpRequest.js";
18
+ export * from "./models/protocol/IHttpRequestContext.js";
19
+ export * from "./models/protocol/IHttpRequestPathParams.js";
20
+ export * from "./models/protocol/IHttpRequestQuery.js";
21
+ export * from "./models/protocol/IHttpResponse.js";
22
+ export * from "./models/protocol/IHttpServerRequest.js";
23
+ export * from "./models/protocol/ISocketRequestContext.js";
24
+ export * from "./models/protocol/ISocketServerRequest.js";
25
+ export * from "./models/requests/INoContentRequest.js";
26
+ export * from "./models/responses/errors/IBadRequestResponse.js";
27
+ export * from "./models/responses/errors/IConflictResponse.js";
28
+ export * from "./models/responses/errors/IForbiddenResponse.js";
29
+ export * from "./models/responses/errors/IInternalServerErrorResponse.js";
30
+ export * from "./models/responses/errors/INotFoundResponse.js";
31
+ export * from "./models/responses/errors/IUnauthorizedResponse.js";
32
+ export * from "./models/responses/errors/IUnprocessableEntityResponse.js";
33
+ export * from "./models/responses/success/IAcceptedResponse.js";
34
+ export * from "./models/responses/success/ICreatedResponse.js";
35
+ export * from "./models/responses/success/INoContentResponse.js";
36
+ export * from "./models/responses/success/IOkResponse.js";
37
+ export * from "./models/routes/IBaseRoute.js";
38
+ export * from "./models/routes/IBaseRouteEntryPoint.js";
39
+ export * from "./models/routes/IRestRoute.js";
40
+ export * from "./models/routes/IRestRouteEntryPoint.js";
41
+ export * from "./models/routes/IRestRouteExample.js";
42
+ export * from "./models/routes/IRestRouteRequestExample.js";
43
+ export * from "./models/routes/IRestRouteResponseAttachmentOptions.js";
44
+ export * from "./models/routes/IRestRouteResponseExample.js";
45
+ export * from "./models/routes/IRestRouteResponseOptions.js";
46
+ export * from "./models/routes/ISocketRoute.js";
47
+ export * from "./models/routes/ISocketRouteEntryPoint.js";
48
+ export * from "./models/routes/ITag.js";
49
+ export * from "./models/server/IBaseRouteProcessor.js";
50
+ export * from "./models/server/IMimeTypeProcessor.js";
51
+ export * from "./models/server/IRestRouteProcessor.js";
52
+ export * from "./models/server/ISocketRouteProcessor.js";
53
+ export * from "./models/server/IWebServer.js";
54
+ export * from "./models/server/IWebServerOptions.js";
55
+ export * from "./models/services/healthStatus.js";
56
+ export * from "./models/services/IHealthInfo.js";
57
+ export * from "./models/services/IInformationComponent.js";
58
+ export * from "./models/services/IServerInfo.js";
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,+CAA+C,CAAC;AAC9D,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC;AACtD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,mCAAmC,CAAC;AAClD,cAAc,0CAA0C,CAAC;AACzD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wCAAwC,CAAC;AACvD,cAAc,oCAAoC,CAAC;AACnD,cAAc,yCAAyC,CAAC;AACxD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,wCAAwC,CAAC;AACvD,cAAc,kDAAkD,CAAC;AACjE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,iDAAiD,CAAC;AAChE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,gDAAgD,CAAC;AAC/D,cAAc,oDAAoD,CAAC;AACnE,cAAc,2DAA2D,CAAC;AAC1E,cAAc,iDAAiD,CAAC;AAChE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,kDAAkD,CAAC;AACjE,cAAc,2CAA2C,CAAC;AAC1D,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yCAAyC,CAAC;AACxD,cAAc,sCAAsC,CAAC;AACrD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,wDAAwD,CAAC;AACvE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,iCAAiC,CAAC;AAChD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,yBAAyB,CAAC;AACxC,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,0CAA0C,CAAC;AACzD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,kCAAkC,CAAC;AACjD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,kCAAkC,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./factories/authenticationGeneratorFactory.js\";\nexport * from \"./factories/mimeTypeProcessorFactory.js\";\nexport * from \"./factories/restRouteProcessorFactory.js\";\nexport * from \"./factories/socketRouteProcessorFactory.js\";\nexport * from \"./helpers/httpErrorHelper.js\";\nexport * from \"./helpers/httpParameterHelper.js\";\nexport * from \"./models/api/IServerFavIconResponse.js\";\nexport * from \"./models/api/IServerHealthResponse.js\";\nexport * from \"./models/api/IServerInfoResponse.js\";\nexport * from \"./models/api/IServerRootResponse.js\";\nexport * from \"./models/api/IServerSpecResponse.js\";\nexport * from \"./models/client/IAuthenticationGenerator.js\";\nexport * from \"./models/config/IBaseRestClientConfig.js\";\nexport * from \"./models/config/IBaseSocketClientConfig.js\";\nexport * from \"./models/protocol/IHttpRequest.js\";\nexport * from \"./models/protocol/IHttpRequestContext.js\";\nexport * from \"./models/protocol/IHttpRequestPathParams.js\";\nexport * from \"./models/protocol/IHttpRequestQuery.js\";\nexport * from \"./models/protocol/IHttpResponse.js\";\nexport * from \"./models/protocol/IHttpServerRequest.js\";\nexport * from \"./models/protocol/ISocketRequestContext.js\";\nexport * from \"./models/protocol/ISocketServerRequest.js\";\nexport * from \"./models/requests/INoContentRequest.js\";\nexport * from \"./models/responses/errors/IBadRequestResponse.js\";\nexport * from \"./models/responses/errors/IConflictResponse.js\";\nexport * from \"./models/responses/errors/IForbiddenResponse.js\";\nexport * from \"./models/responses/errors/IInternalServerErrorResponse.js\";\nexport * from \"./models/responses/errors/INotFoundResponse.js\";\nexport * from \"./models/responses/errors/IUnauthorizedResponse.js\";\nexport * from \"./models/responses/errors/IUnprocessableEntityResponse.js\";\nexport * from \"./models/responses/success/IAcceptedResponse.js\";\nexport * from \"./models/responses/success/ICreatedResponse.js\";\nexport * from \"./models/responses/success/INoContentResponse.js\";\nexport * from \"./models/responses/success/IOkResponse.js\";\nexport * from \"./models/routes/IBaseRoute.js\";\nexport * from \"./models/routes/IBaseRouteEntryPoint.js\";\nexport * from \"./models/routes/IRestRoute.js\";\nexport * from \"./models/routes/IRestRouteEntryPoint.js\";\nexport * from \"./models/routes/IRestRouteExample.js\";\nexport * from \"./models/routes/IRestRouteRequestExample.js\";\nexport * from \"./models/routes/IRestRouteResponseAttachmentOptions.js\";\nexport * from \"./models/routes/IRestRouteResponseExample.js\";\nexport * from \"./models/routes/IRestRouteResponseOptions.js\";\nexport * from \"./models/routes/ISocketRoute.js\";\nexport * from \"./models/routes/ISocketRouteEntryPoint.js\";\nexport * from \"./models/routes/ITag.js\";\nexport * from \"./models/server/IBaseRouteProcessor.js\";\nexport * from \"./models/server/IMimeTypeProcessor.js\";\nexport * from \"./models/server/IRestRouteProcessor.js\";\nexport * from \"./models/server/ISocketRouteProcessor.js\";\nexport * from \"./models/server/IWebServer.js\";\nexport * from \"./models/server/IWebServerOptions.js\";\nexport * from \"./models/services/healthStatus.js\";\nexport * from \"./models/services/IHealthInfo.js\";\nexport * from \"./models/services/IInformationComponent.js\";\nexport * from \"./models/services/IServerInfo.js\";\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IServerFavIconResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IServerFavIconResponse.js","sourceRoot":"","sources":["../../../../src/models/api/IServerFavIconResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HeaderTypes, HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The favicon for the server.\n */\nexport interface IServerFavIconResponse {\n\t/**\n\t * Additional response headers.\n\t */\n\theaders?: {\n\t\t/**\n\t\t * The content type for the response.\n\t\t */\n\t\t[HeaderTypes.ContentType]?: string;\n\t};\n\n\t/**\n\t * Response status code.\n\t */\n\tstatusCode?: HttpStatusCode;\n\n\t/**\n\t * The favicon for the server.\n\t */\n\tbody?: Uint8Array;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IServerHealthResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IServerHealthResponse.js","sourceRoot":"","sources":["../../../../src/models/api/IServerHealthResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IHealthInfo } from \"../services/IHealthInfo.js\";\n\n/**\n * The health of the server.\n */\nexport interface IServerHealthResponse {\n\t/**\n\t * The information for the server.\n\t */\n\tbody: IHealthInfo;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IServerInfoResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IServerInfoResponse.js","sourceRoot":"","sources":["../../../../src/models/api/IServerInfoResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IServerInfo } from \"../services/IServerInfo.js\";\n\n/**\n * The information about the server.\n */\nexport interface IServerInfoResponse {\n\t/**\n\t * The information for the server.\n\t */\n\tbody: IServerInfo;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IServerRootResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IServerRootResponse.js","sourceRoot":"","sources":["../../../../src/models/api/IServerRootResponse.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * The root text for the server.\n */\nexport interface IServerRootResponse {\n\t/**\n\t * The root text for the server.\n\t */\n\tbody: string;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IServerSpecResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IServerSpecResponse.js","sourceRoot":"","sources":["../../../../src/models/api/IServerSpecResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The OpenAPI spec for the endpoints.\n */\nexport interface IServerSpecResponse {\n\t/**\n\t * Response status code.\n\t */\n\tstatusCode?: HttpStatusCode;\n\n\t/**\n\t * The spec for the server.\n\t */\n\tbody?: unknown;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAuthenticationGenerator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAuthenticationGenerator.js","sourceRoot":"","sources":["../../../../src/models/client/IAuthenticationGenerator.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IComponent } from \"@twin.org/core\";\nimport type { IHttpHeaders } from \"@twin.org/web\";\n\n/**\n * Definition for the authentication generator component.\n */\nexport interface IAuthenticationGenerator extends IComponent {\n\t/**\n\t * Adds authentication information to the request headers.\n\t * @param requestHeaders The request headers to add authentication information to.\n\t * @param authData Optional authentication data passed from the request.\n\t * @returns A promise that resolves when the authentication information has been added.\n\t */\n\taddAuthentication(requestHeaders: IHttpHeaders, authData?: unknown): Promise<void>;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IBaseRestClientConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IBaseRestClientConfig.js","sourceRoot":"","sources":["../../../../src/models/config/IBaseRestClientConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IHttpHeaders } from \"@twin.org/web\";\n\n/**\n * Definition for the configuration of a rest client.\n */\nexport interface IBaseRestClientConfig {\n\t/**\n\t * The endpoint where the api is hosted.\n\t */\n\tendpoint: string;\n\n\t/**\n\t * The prefix to the routes.\n\t */\n\tpathPrefix?: string;\n\n\t/**\n\t * The headers to include in requests.\n\t */\n\theaders?: IHttpHeaders;\n\n\t/**\n\t * Timeout for requests in ms.\n\t */\n\ttimeout?: number;\n\n\t/**\n\t * Include credentials in the request, defaults to true.\n\t */\n\tincludeCredentials?: boolean;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IBaseSocketClientConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IBaseSocketClientConfig.js","sourceRoot":"","sources":["../../../../src/models/config/IBaseSocketClientConfig.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IHttpHeaders } from \"@twin.org/web\";\n\n/**\n * Definition for the configuration of a socket service.\n */\nexport interface IBaseSocketClientConfig {\n\t/**\n\t * Base path for the socket service, defaults to /socket.\n\t */\n\tbasePath?: string;\n\n\t/**\n\t * The endpoint where the api is hosted.\n\t */\n\tendpoint: string;\n\n\t/**\n\t * The prefix to the routes.\n\t */\n\tpathPrefix?: string;\n\n\t/**\n\t * The headers to include in requests.\n\t */\n\theaders?: IHttpHeaders;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IHttpRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IHttpRequest.js","sourceRoot":"","sources":["../../../../src/models/protocol/IHttpRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IHttpHeaders } from \"@twin.org/web\";\nimport type { IHttpRequestPathParams } from \"./IHttpRequestPathParams.js\";\nimport type { IHttpRequestQuery } from \"./IHttpRequestQuery.js\";\n\n/**\n * Model for the standard parameters for an http request.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface IHttpRequest<T = any> {\n\t/**\n\t * Incoming Http Headers.\n\t */\n\theaders?: IHttpHeaders;\n\n\t/**\n\t * The path parameters.\n\t */\n\tpathParams?: IHttpRequestPathParams;\n\n\t/**\n\t * The query parameters.\n\t */\n\tquery?: IHttpRequestQuery;\n\n\t/**\n\t * Data to return send as the body.\n\t */\n\tbody?: T;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IHttpRequestContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IHttpRequestContext.js","sourceRoot":"","sources":["../../../../src/models/protocol/IHttpRequestContext.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IHttpServerRequest } from \"./IHttpServerRequest.js\";\n\n/**\n * Context data from the HTTP request.\n */\nexport interface IHttpRequestContext {\n\t/**\n\t * The raw HTTP request.\n\t */\n\tserverRequest: IHttpServerRequest;\n\n\t/**\n\t * The state handed through the processors.\n\t */\n\tprocessorState: { [id: string]: unknown };\n\n\t/**\n\t * Logging component type for the request.\n\t */\n\tloggingComponentType?: string;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IHttpRequestPathParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IHttpRequestPathParams.js","sourceRoot":"","sources":["../../../../src/models/protocol/IHttpRequestPathParams.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Model for the standard parameters for an http request.\n */\nexport interface IHttpRequestPathParams {\n\t[id: string]: string | number | boolean;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IHttpRequestQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IHttpRequestQuery.js","sourceRoot":"","sources":["../../../../src/models/protocol/IHttpRequestQuery.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Model used for Http request query parameters.\n */\nexport interface IHttpRequestQuery {\n\t[id: string]: string | number | boolean;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IHttpResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IHttpResponse.js","sourceRoot":"","sources":["../../../../src/models/protocol/IHttpResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HttpStatusCode, IHttpHeaders } from \"@twin.org/web\";\n\n/**\n * Model for the standard parameters for an http response.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface IHttpResponse<T = any> {\n\t/**\n\t * Response status code.\n\t */\n\tstatusCode?: HttpStatusCode;\n\n\t/**\n\t * Response headers.\n\t */\n\theaders?: IHttpHeaders;\n\n\t/**\n\t * Data to return as the main payload.\n\t */\n\tbody?: T;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IHttpServerRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IHttpServerRequest.js","sourceRoot":"","sources":["../../../../src/models/protocol/IHttpServerRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HttpMethod } from \"@twin.org/web\";\nimport type { IHttpRequest } from \"./IHttpRequest.js\";\n\n/**\n * Model for the standard parameters for an http request.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface IHttpServerRequest<T = any> extends IHttpRequest<T> {\n\t/**\n\t * The request method.\n\t */\n\tmethod?: HttpMethod;\n\n\t/**\n\t * The request url.\n\t */\n\turl?: string;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ISocketRequestContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ISocketRequestContext.js","sourceRoot":"","sources":["../../../../src/models/protocol/ISocketRequestContext.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IHttpRequestContext } from \"./IHttpRequestContext.js\";\n\n/**\n * Context data from the socket request.\n */\nexport interface ISocketRequestContext extends IHttpRequestContext {\n\t/**\n\t * The id of the socket.\n\t */\n\tsocketId: string;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ISocketServerRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ISocketServerRequest.js","sourceRoot":"","sources":["../../../../src/models/protocol/ISocketServerRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IHttpServerRequest } from \"./IHttpServerRequest.js\";\n\n/**\n * Model for the standard parameters for an http request.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface ISocketServerRequest<T = any> extends IHttpServerRequest<T> {\n\t/**\n\t * The socket id.\n\t */\n\tsocketId: string;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=INoContentRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"INoContentRequest.js","sourceRoot":"","sources":["../../../../src/models/requests/INoContentRequest.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IHttpRequest } from \"../protocol/IHttpRequest.js\";\n\n/**\n * A REST request with no input parameters.\n */\nexport interface INoContentRequest extends IHttpRequest {\n\t/**\n\t * Incoming Http Headers.\n\t */\n\theaders?: never;\n\n\t/**\n\t * The path parameters.\n\t */\n\tpathParams?: never;\n\n\t/**\n\t * The query parameters.\n\t */\n\tquery?: never;\n\n\t/**\n\t * Data to return send as the body.\n\t */\n\tbody?: never;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IBadRequestResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IBadRequestResponse.js","sourceRoot":"","sources":["../../../../../src/models/responses/errors/IBadRequestResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IError } from \"@twin.org/core\";\nimport type { HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The server cannot process the request, see the content for more details.\n */\nexport interface IBadRequestResponse {\n\t/**\n\t * Response status code.\n\t */\n\tstatusCode: typeof HttpStatusCode.badRequest;\n\n\t/**\n\t * The body which contains the error.\n\t */\n\tbody: IError;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IConflictResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IConflictResponse.js","sourceRoot":"","sources":["../../../../../src/models/responses/errors/IConflictResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IError } from \"@twin.org/core\";\nimport type { HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The request resulted in a conflicting operation, see the content for more details.\n */\nexport interface IConflictResponse {\n\t/**\n\t * Response status code.\n\t */\n\tstatusCode: typeof HttpStatusCode.conflict;\n\n\t/**\n\t * The body which contains the error.\n\t */\n\tbody: IError & {\n\t\t/**\n\t\t * The conflicting items.\n\t\t */\n\t\tconflicts: string[];\n\t};\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IForbiddenResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IForbiddenResponse.js","sourceRoot":"","sources":["../../../../../src/models/responses/errors/IForbiddenResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IError } from \"@twin.org/core\";\nimport type { HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The operation that you tried to perform is not possible, see the content for more details.\n */\nexport interface IForbiddenResponse {\n\t/**\n\t * Response status code.\n\t */\n\tstatusCode: typeof HttpStatusCode.forbidden;\n\n\t/**\n\t * The body which contains the error.\n\t */\n\tbody: IError;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IInternalServerErrorResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IInternalServerErrorResponse.js","sourceRoot":"","sources":["../../../../../src/models/responses/errors/IInternalServerErrorResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IError } from \"@twin.org/core\";\nimport type { HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The server has encountered a situation it does not know how to handle, see the content for more details.\n */\nexport interface IInternalServerErrorResponse {\n\t/**\n\t * Response status code.\n\t */\n\tstatusCode: typeof HttpStatusCode.internalServerError;\n\n\t/**\n\t * The body which contains the error.\n\t */\n\tbody: IError;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=INotFoundResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"INotFoundResponse.js","sourceRoot":"","sources":["../../../../../src/models/responses/errors/INotFoundResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IError } from \"@twin.org/core\";\nimport type { HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The resource you tried to access does not exist, see the content for more details.\n */\nexport interface INotFoundResponse {\n\t/**\n\t * Response status code.\n\t */\n\tstatusCode: typeof HttpStatusCode.notFound;\n\n\t/**\n\t * The body which contains the error.\n\t */\n\tbody: IError & {\n\t\t/**\n\t\t * The id if the item that was not found.\n\t\t */\n\t\tnotFoundId?: string;\n\t};\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IUnauthorizedResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IUnauthorizedResponse.js","sourceRoot":"","sources":["../../../../../src/models/responses/errors/IUnauthorizedResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IError } from \"@twin.org/core\";\nimport type { HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * You are not authorized to use the API or no credentials were supplied, see the content for more details.\n */\nexport interface IUnauthorizedResponse {\n\t/**\n\t * Response status code.\n\t */\n\tstatusCode: typeof HttpStatusCode.unauthorized;\n\n\t/**\n\t * The body which contains the error.\n\t */\n\tbody: IError;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IUnprocessableEntityResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IUnprocessableEntityResponse.js","sourceRoot":"","sources":["../../../../../src/models/responses/errors/IUnprocessableEntityResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IError } from \"@twin.org/core\";\nimport type { HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The server cannot process the request, see the content for more details.\n */\nexport interface IUnprocessableEntityResponse {\n\t/**\n\t * Response status code.\n\t */\n\tstatusCode: typeof HttpStatusCode.unprocessableEntity;\n\n\t/**\n\t * The body which contains the error.\n\t */\n\tbody: IError;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IAcceptedResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IAcceptedResponse.js","sourceRoot":"","sources":["../../../../../src/models/responses/success/IAcceptedResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The rest request ended in accepted response.\n */\nexport interface IAcceptedResponse {\n\t/**\n\t * Response status code.\n\t */\n\tstatusCode: typeof HttpStatusCode.accepted;\n\n\t/**\n\t * Additional response headers.\n\t */\n\theaders: {\n\t\t/**\n\t\t * The location where the resource was accepted.\n\t\t */\n\t\tlocation: string;\n\t};\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ICreatedResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ICreatedResponse.js","sourceRoot":"","sources":["../../../../../src/models/responses/success/ICreatedResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HeaderTypes, HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The rest request ended in created response.\n */\nexport interface ICreatedResponse {\n\t/**\n\t * Response status code.\n\t */\n\tstatusCode: typeof HttpStatusCode.created;\n\n\t/**\n\t * Additional response headers.\n\t */\n\theaders: {\n\t\t/**\n\t\t * The location where the resource was created.\n\t\t */\n\t\t[HeaderTypes.Location]: string;\n\t};\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=INoContentResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"INoContentResponse.js","sourceRoot":"","sources":["../../../../../src/models/responses/success/INoContentResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The rest request ended in success with no data.\n */\nexport interface INoContentResponse {\n\t/**\n\t * Response status code.\n\t */\n\tstatusCode: typeof HttpStatusCode.noContent;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IOkResponse.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IOkResponse.js","sourceRoot":"","sources":["../../../../../src/models/responses/success/IOkResponse.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HttpStatusCode } from \"@twin.org/web\";\n\n/**\n * The rest request ended in success with no data.\n */\nexport interface IOkResponse {\n\t/**\n\t * Response status code.\n\t */\n\tstatusCode: typeof HttpStatusCode.ok;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IBaseRoute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IBaseRoute.js","sourceRoot":"","sources":["../../../../src/models/routes/IBaseRoute.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Interface which defines a route.\n */\nexport interface IBaseRoute {\n\t/**\n\t * The id of the operation.\n\t */\n\toperationId: string;\n\n\t/**\n\t * The path to use for routing.\n\t */\n\tpath: string;\n\n\t/**\n\t * Skips the authentication for this route.\n\t */\n\tskipAuth?: boolean;\n\n\t/**\n\t * The features supported by additional processors to run for this route.\n\t */\n\tprocessorFeatures?: string[];\n\n\t/**\n\t * The data for additional processors to run for this route.\n\t */\n\tprocessorData?: {\n\t\t[key: string]: unknown;\n\t};\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IBaseRouteEntryPoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IBaseRouteEntryPoint.js","sourceRoot":"","sources":["../../../../src/models/routes/IBaseRouteEntryPoint.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { ITag } from \"./ITag.js\";\n\n/**\n * Route entry points are used for exposing the routes from a package.\n */\nexport interface IBaseRouteEntryPoint<T> {\n\t/**\n\t * The name of the routes.\n\t */\n\tname: string;\n\n\t/**\n\t * The default base route name for the routes.\n\t */\n\tdefaultBaseRoute: string;\n\n\t/**\n\t * The tags for the routes.\n\t */\n\ttags: ITag[];\n\n\t/**\n\t * The method to generate the routes.\n\t */\n\tgenerateRoutes: (baseRouteName: string, componentName: string) => T[];\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IRestRoute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IRestRoute.js","sourceRoot":"","sources":["../../../../src/models/routes/IRestRoute.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { HttpMethod } from \"@twin.org/web\";\nimport type { IBaseRoute } from \"./IBaseRoute.js\";\nimport type { IRestRouteRequestExample } from \"./IRestRouteRequestExample.js\";\nimport type { IRestRouteResponseExample } from \"./IRestRouteResponseExample.js\";\nimport type { IRestRouteResponseOptions } from \"./IRestRouteResponseOptions.js\";\nimport type { IHttpRequest } from \"../protocol/IHttpRequest.js\";\nimport type { IHttpRequestContext } from \"../protocol/IHttpRequestContext.js\";\nimport type { IHttpResponse } from \"../protocol/IHttpResponse.js\";\n\n/**\n * Interface which defines a REST route.\n */\nexport interface IRestRoute<\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tT extends IHttpRequest = any,\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tU extends IHttpResponse & IRestRouteResponseOptions = any\n> extends IBaseRoute {\n\t/**\n\t * Summary of what task the operation performs.\n\t */\n\tsummary: string;\n\n\t/**\n\t * Tag for the operation.\n\t */\n\ttag: string;\n\n\t/**\n\t * The http method.\n\t */\n\tmethod: HttpMethod;\n\n\t/**\n\t * The handler module.\n\t */\n\thandler: (\n\t\t/**\n\t\t * The http request context.\n\t\t */\n\t\thttpRequestContext: IHttpRequestContext,\n\n\t\t/**\n\t\t * The request object, combined query param, path params and body.\n\t\t */\n\t\trequest: T\n\t) => Promise<U>;\n\n\t/**\n\t * The type of the request object.\n\t */\n\trequestType?: {\n\t\t/**\n\t\t * The object type for the request.\n\t\t */\n\t\ttype: string;\n\n\t\t/**\n\t\t * The mime type of the request, defaults to \"application/json\" if there is a body.\n\t\t */\n\t\tmimeType?: string;\n\n\t\t/**\n\t\t * Example objects for the request.\n\t\t */\n\t\texamples?: IRestRouteRequestExample<T>[];\n\t};\n\n\t/**\n\t * The type of the response object.\n\t */\n\tresponseType?: {\n\t\t/**\n\t\t * The object type of the response.\n\t\t */\n\t\ttype: string;\n\n\t\t/**\n\t\t * The mime type of the response, defaults to \"application/json\" if there is a body.\n\t\t */\n\t\tmimeType?: string;\n\n\t\t/**\n\t\t * Example objects of the response.\n\t\t */\n\t\texamples?: IRestRouteResponseExample<U>[];\n\t}[];\n\n\t/**\n\t * Exclude the route from being included in the spec file.\n\t */\n\texcludeFromSpec?: boolean;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IRestRouteEntryPoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IRestRouteEntryPoint.js","sourceRoot":"","sources":["../../../../src/models/routes/IRestRouteEntryPoint.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport type { IBaseRouteEntryPoint } from \"./IBaseRouteEntryPoint.js\";\nimport type { IRestRoute } from \"./IRestRoute.js\";\n\n/**\n * Route entry points are used for exposing the REST routes from a package.\n */\nexport type IRestRouteEntryPoint = IBaseRouteEntryPoint<IRestRoute>;\n"]}
@@ -0,0 +1,4 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ export {};
4
+ //# sourceMappingURL=IRestRouteExample.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IRestRouteExample.js","sourceRoot":"","sources":["../../../../src/models/routes/IRestRouteExample.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\n\n/**\n * Interface which defines a REST route example.\n */\nexport interface IRestRouteExample {\n\t/**\n\t * Example objects for the request.\n\t */\n\tid: string;\n\n\t/**\n\t * Description of the example.\n\t */\n\tdescription?: string;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IRestRouteRequestExample.js.map