@rxap/open-api 22.0.0-dev.0 → 22.0.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/README.md +5 -3
- package/compodoc/architecture.html +222 -0
- package/compodoc/changelog.html +90 -5
- package/compodoc/classes/OpenApiHttpResponseError.html +110 -39
- package/compodoc/classes/RxapOpenApiError.html +77 -10
- package/compodoc/classes/SchemaValidationMixin.html +100 -29
- package/compodoc/dependencies.html +128 -35
- package/compodoc/index.html +50 -8
- package/compodoc/injectables/OpenApiConfigService.html +112 -38
- package/compodoc/interfaces/OpenApiInitOptions.html +166 -111
- package/compodoc/interfaces/OpenApiMetaData.html +259 -175
- package/compodoc/interfaces/OperationObjectWithMetadata.html +165 -91
- package/compodoc/interfaces/SchemaValidationResponse.html +247 -182
- package/compodoc/js/architecture-graph.js +288 -0
- package/compodoc/js/libs/bootstrap-native.js +4 -2
- package/compodoc/js/libs/jszip.min.js +13 -0
- package/compodoc/js/libs/svg-pan-zoom.min.js +3 -3
- package/compodoc/js/libs/tablesort.min.js +3 -3
- package/compodoc/js/libs/tablesort.number.min.js +3 -3
- package/compodoc/js/libs/vis-network.min.js +78 -0
- package/compodoc/js/menu-wc.js +27 -14
- package/compodoc/js/menu.js +10 -11
- package/compodoc/js/routes/routes_index.js +1 -0
- package/compodoc/js/routes.js +142 -34
- package/compodoc/js/search/search-lunr.js +6 -8
- package/compodoc/js/search/search.js +118 -66
- package/compodoc/js/search/search_index.js +2 -2
- package/compodoc/js/tabs.js +98 -15
- package/compodoc/js/tree.js +44 -7
- package/compodoc/license.html +48 -6
- package/compodoc/llms.txt +156 -0
- package/compodoc/miscellaneous/functions.html +167 -19
- package/compodoc/miscellaneous/typealiases.html +46 -4
- package/compodoc/miscellaneous/variables.html +123 -16
- package/compodoc/modules.html +44 -3
- package/compodoc/overview.html +54 -3
- package/compodoc/properties.html +45 -4
- package/compodoc/routes.html +227 -0
- package/compodoc/styles/compodoc.css +365 -44
- package/compodoc/styles/dark.css +16 -0
- package/compodoc/template-playground/default-templates.json +192 -0
- package/compodoc/template-playground/hbs-render.service.ts +217 -0
- package/compodoc/template-playground/main.ts +9 -0
- package/compodoc/template-playground/template-editor.service.ts +173 -0
- package/compodoc/template-playground/template-playground.component.ts +614 -0
- package/compodoc/template-playground/template-playground.module.ts +29 -0
- package/compodoc/template-playground/zip-export.service.ts +86 -0
- package/compodoc/template-playground-app/app.js +1389 -0
- package/compodoc/template-playground-app/index.html +462 -0
- package/docs/documentation.json +1287 -1054
- package/docs/html/assets/highlight.css +1 -1
- package/docs/html/assets/icons.js +1 -1
- package/docs/html/assets/icons.svg +1 -1
- package/docs/html/assets/main.js +5 -5
- package/docs/html/assets/navigation.js +1 -1
- package/docs/html/assets/search.js +1 -1
- package/docs/html/assets/style.css +265 -228
- package/docs/html/classes/OpenApiConfigService.html +216 -14
- package/docs/html/classes/OpenApiHttpResponseError.html +215 -26
- package/docs/html/classes/RxapOpenApiError.html +242 -23
- package/docs/html/classes/SchemaValidationMixin.html +245 -16
- package/docs/html/functions/AssertOpenApiV3.html +42 -1
- package/docs/html/functions/IsOpenApiV3.html +42 -1
- package/docs/html/functions/IsReferenceObject.html +42 -1
- package/docs/html/functions/NotContainsReferenceObjects.html +46 -1
- package/docs/html/functions/OpenApiInit.html +43 -1
- package/docs/html/functions/getJsonContentSchema.html +42 -1
- package/docs/html/functions/getJsonSchema.html +42 -1
- package/docs/html/functions/hasJsonContentSchema.html +46 -1
- package/docs/html/functions/hasJsonSchema.html +42 -1
- package/docs/html/hierarchy.html +29 -0
- package/docs/html/index.html +44 -7
- package/docs/html/interfaces/OpenApiInitOptions.html +65 -5
- package/docs/html/interfaces/OpenApiMetaData.html +98 -9
- package/docs/html/interfaces/OperationObjectWithMetadata.html +151 -15
- package/docs/html/interfaces/SchemaValidationResponse.html +77 -5
- package/docs/html/modules.html +52 -1
- package/docs/html/types/OperationMap.html +33 -1
- package/docs/html/variables/DEFAULT_OPEN_API_DATA_SOURCE_META_DATA.html +33 -1
- package/docs/html/variables/DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA.html +33 -1
- package/docs/html/variables/DISABLE_SCHEMA_VALIDATION.html +33 -1
- package/docs/html/variables/DISABLE_VALIDATION.html +33 -1
- package/docs/html/variables/OPEN_API_OPERATION.html +33 -1
- package/docs/html/variables/OPEN_API_OPERATION_ID.html +33 -1
- package/docs/html/variables/OPEN_API_SERVER_ID.html +33 -1
- package/docs/html/variables/OPEN_API_SERVER_INDEX.html +33 -1
- package/docs/html/variables/RXAP_OPEN_API_CONFIG.html +33 -1
- package/docs/html/variables/RXAP_OPEN_API_STRICT_VALIDATOR.html +33 -1
- package/docs/html/variables/injectOpenApiBaseUrlHttpInterceptorFn.html +33 -0
- package/docs/markdown/README.md +6 -4
- package/docs/markdown/classes/OpenApiConfigService.md +27 -27
- package/docs/markdown/classes/OpenApiHttpResponseError.md +26 -26
- package/docs/markdown/classes/RxapOpenApiError.md +25 -25
- package/docs/markdown/classes/SchemaValidationMixin.md +36 -30
- package/docs/markdown/functions/AssertOpenApiV3.md +3 -3
- package/docs/markdown/functions/IsOpenApiV3.md +3 -3
- package/docs/markdown/functions/IsReferenceObject.md +3 -3
- package/docs/markdown/functions/NotContainsReferenceObjects.md +7 -5
- package/docs/markdown/functions/OpenApiInit.md +5 -5
- package/docs/markdown/functions/getJsonContentSchema.md +5 -5
- package/docs/markdown/functions/getJsonSchema.md +5 -5
- package/docs/markdown/functions/hasJsonContentSchema.md +8 -6
- package/docs/markdown/functions/hasJsonSchema.md +3 -3
- package/docs/markdown/globals.md +3 -3
- package/docs/markdown/interfaces/OpenApiInitOptions.md +6 -6
- package/docs/markdown/interfaces/OpenApiMetaData.md +12 -12
- package/docs/markdown/interfaces/OperationObjectWithMetadata.md +27 -27
- package/docs/markdown/interfaces/SchemaValidationResponse.md +11 -9
- package/docs/markdown/type-aliases/OperationMap.md +3 -3
- package/docs/markdown/variables/DEFAULT_OPEN_API_DATA_SOURCE_META_DATA.md +2 -2
- package/docs/markdown/variables/DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA.md +2 -2
- package/docs/markdown/variables/DISABLE_SCHEMA_VALIDATION.md +2 -2
- package/docs/markdown/variables/DISABLE_VALIDATION.md +2 -2
- package/docs/markdown/variables/OPEN_API_OPERATION.md +2 -2
- package/docs/markdown/variables/OPEN_API_OPERATION_ID.md +2 -2
- package/docs/markdown/variables/OPEN_API_SERVER_ID.md +3 -3
- package/docs/markdown/variables/OPEN_API_SERVER_INDEX.md +2 -2
- package/docs/markdown/variables/RXAP_OPEN_API_CONFIG.md +2 -2
- package/docs/markdown/variables/RXAP_OPEN_API_STRICT_VALIDATOR.md +2 -2
- package/docs/markdown/variables/injectOpenApiBaseUrlHttpInterceptorFn.md +11 -0
- package/docs/wiki/Class.OpenApiConfigService.md +26 -26
- package/docs/wiki/Class.OpenApiHttpResponseError.md +25 -25
- package/docs/wiki/Class.RxapOpenApiError.md +24 -24
- package/docs/wiki/Class.SchemaValidationMixin.md +35 -29
- package/docs/wiki/Function.AssertOpenApiV3.md +2 -2
- package/docs/wiki/Function.IsOpenApiV3.md +2 -2
- package/docs/wiki/Function.IsReferenceObject.md +2 -2
- package/docs/wiki/Function.NotContainsReferenceObjects.md +6 -4
- package/docs/wiki/Function.OpenApiInit.md +4 -4
- package/docs/wiki/Function.getJsonContentSchema.md +4 -4
- package/docs/wiki/Function.getJsonSchema.md +4 -4
- package/docs/wiki/Function.hasJsonContentSchema.md +7 -5
- package/docs/wiki/Function.hasJsonSchema.md +2 -2
- package/docs/wiki/Home.md +5 -3
- package/docs/wiki/Interface.OpenApiInitOptions.md +5 -5
- package/docs/wiki/Interface.OpenApiMetaData.md +11 -11
- package/docs/wiki/Interface.OperationObjectWithMetadata.md +26 -26
- package/docs/wiki/Interface.SchemaValidationResponse.md +10 -8
- package/docs/wiki/TypeAlias.OperationMap.md +2 -2
- package/docs/wiki/Variable.DEFAULT_OPEN_API_DATA_SOURCE_META_DATA.md +1 -1
- package/docs/wiki/Variable.DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA.md +1 -1
- package/docs/wiki/Variable.DISABLE_SCHEMA_VALIDATION.md +1 -1
- package/docs/wiki/Variable.DISABLE_VALIDATION.md +1 -1
- package/docs/wiki/Variable.OPEN_API_OPERATION.md +1 -1
- package/docs/wiki/Variable.OPEN_API_OPERATION_ID.md +1 -1
- package/docs/wiki/Variable.OPEN_API_SERVER_ID.md +2 -2
- package/docs/wiki/Variable.OPEN_API_SERVER_INDEX.md +1 -1
- package/docs/wiki/Variable.RXAP_OPEN_API_CONFIG.md +1 -1
- package/docs/wiki/Variable.RXAP_OPEN_API_STRICT_VALIDATOR.md +1 -1
- package/docs/wiki/Variable.injectOpenApiBaseUrlHttpInterceptorFn.md +7 -0
- package/docs/wiki/_Sidebar.md +1 -1
- package/docs/wiki/globals.md +2 -2
- package/fesm2022/rxap-open-api-data-source-table.mjs +1 -1
- package/fesm2022/rxap-open-api-data-source-table.mjs.map +1 -1
- package/fesm2022/rxap-open-api-data-source.mjs +1 -1
- package/fesm2022/rxap-open-api-data-source.mjs.map +1 -1
- package/fesm2022/rxap-open-api-remote-method.mjs +6 -2
- package/fesm2022/rxap-open-api-remote-method.mjs.map +1 -1
- package/generators.json +16 -0
- package/package.json +28 -29
- package/src/generators/init/generator.js +120 -0
- package/src/generators/init/index.js +6 -0
- package/src/generators/init/schema.json +8 -0
- package/src/generators/package.json +3 -0
- package/compodoc/js/libs/vis.min.js +0 -47
- package/compodoc/js/menu-wc_es5.js +0 -40
- package/docs/html/functions/injectOpenApiBaseUrlHttpInterceptorFn.html +0 -1
- package/docs/markdown/functions/injectOpenApiBaseUrlHttpInterceptorFn.md +0 -25
- package/docs/wiki/Function.injectOpenApiBaseUrlHttpInterceptorFn.md +0 -21
- package/theme.css +0 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: OperationObjectWithMetadata
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/angular/open-api/src/lib/open-api.ts:3](https://gitlab.com/rxap/packages/-/blob/
|
|
5
|
+
Defined in: [packages/angular/open-api/src/lib/open-api.ts:3](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/open-api.ts#L3)
|
|
6
6
|
|
|
7
7
|
## Extends
|
|
8
8
|
|
|
@@ -12,9 +12,9 @@ Defined in: [packages/angular/open-api/src/lib/open-api.ts:3](https://gitlab.com
|
|
|
12
12
|
|
|
13
13
|
### callbacks?
|
|
14
14
|
|
|
15
|
-
> `optional` **callbacks
|
|
15
|
+
> `optional` **callbacks?**: `object`
|
|
16
16
|
|
|
17
|
-
Defined in: node\_modules/openapi-types/dist/index.d.ts:224
|
|
17
|
+
Defined in: node\_modules/.pnpm/openapi-types@10.0.0/node\_modules/openapi-types/dist/index.d.ts:224
|
|
18
18
|
|
|
19
19
|
#### Index Signature
|
|
20
20
|
|
|
@@ -28,9 +28,9 @@ Defined in: node\_modules/openapi-types/dist/index.d.ts:224
|
|
|
28
28
|
|
|
29
29
|
### deprecated?
|
|
30
30
|
|
|
31
|
-
> `optional` **deprecated
|
|
31
|
+
> `optional` **deprecated?**: `boolean`
|
|
32
32
|
|
|
33
|
-
Defined in: node\_modules/openapi-types/dist/index.d.ts:227
|
|
33
|
+
Defined in: node\_modules/.pnpm/openapi-types@10.0.0/node\_modules/openapi-types/dist/index.d.ts:227
|
|
34
34
|
|
|
35
35
|
#### Inherited from
|
|
36
36
|
|
|
@@ -40,9 +40,9 @@ Defined in: node\_modules/openapi-types/dist/index.d.ts:227
|
|
|
40
40
|
|
|
41
41
|
### description?
|
|
42
42
|
|
|
43
|
-
> `optional` **description
|
|
43
|
+
> `optional` **description?**: `string`
|
|
44
44
|
|
|
45
|
-
Defined in: node\_modules/openapi-types/dist/index.d.ts:218
|
|
45
|
+
Defined in: node\_modules/.pnpm/openapi-types@10.0.0/node\_modules/openapi-types/dist/index.d.ts:218
|
|
46
46
|
|
|
47
47
|
#### Inherited from
|
|
48
48
|
|
|
@@ -52,9 +52,9 @@ Defined in: node\_modules/openapi-types/dist/index.d.ts:218
|
|
|
52
52
|
|
|
53
53
|
### externalDocs?
|
|
54
54
|
|
|
55
|
-
> `optional` **externalDocs
|
|
55
|
+
> `optional` **externalDocs?**: `ExternalDocumentationObject`
|
|
56
56
|
|
|
57
|
-
Defined in: node\_modules/openapi-types/dist/index.d.ts:219
|
|
57
|
+
Defined in: node\_modules/.pnpm/openapi-types@10.0.0/node\_modules/openapi-types/dist/index.d.ts:219
|
|
58
58
|
|
|
59
59
|
#### Inherited from
|
|
60
60
|
|
|
@@ -66,15 +66,15 @@ Defined in: node\_modules/openapi-types/dist/index.d.ts:219
|
|
|
66
66
|
|
|
67
67
|
> **method**: `string`
|
|
68
68
|
|
|
69
|
-
Defined in: [packages/angular/open-api/src/lib/open-api.ts:5](https://gitlab.com/rxap/packages/-/blob/
|
|
69
|
+
Defined in: [packages/angular/open-api/src/lib/open-api.ts:5](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/open-api.ts#L5)
|
|
70
70
|
|
|
71
71
|
***
|
|
72
72
|
|
|
73
73
|
### operationId?
|
|
74
74
|
|
|
75
|
-
> `optional` **operationId
|
|
75
|
+
> `optional` **operationId?**: `string`
|
|
76
76
|
|
|
77
|
-
Defined in: node\_modules/openapi-types/dist/index.d.ts:220
|
|
77
|
+
Defined in: node\_modules/.pnpm/openapi-types@10.0.0/node\_modules/openapi-types/dist/index.d.ts:220
|
|
78
78
|
|
|
79
79
|
#### Inherited from
|
|
80
80
|
|
|
@@ -84,9 +84,9 @@ Defined in: node\_modules/openapi-types/dist/index.d.ts:220
|
|
|
84
84
|
|
|
85
85
|
### parameters?
|
|
86
86
|
|
|
87
|
-
> `optional` **parameters
|
|
87
|
+
> `optional` **parameters?**: (`ReferenceObject` \| `ParameterObject`)[]
|
|
88
88
|
|
|
89
|
-
Defined in: node\_modules/openapi-types/dist/index.d.ts:221
|
|
89
|
+
Defined in: node\_modules/.pnpm/openapi-types@10.0.0/node\_modules/openapi-types/dist/index.d.ts:221
|
|
90
90
|
|
|
91
91
|
#### Inherited from
|
|
92
92
|
|
|
@@ -98,15 +98,15 @@ Defined in: node\_modules/openapi-types/dist/index.d.ts:221
|
|
|
98
98
|
|
|
99
99
|
> **path**: `string`
|
|
100
100
|
|
|
101
|
-
Defined in: [packages/angular/open-api/src/lib/open-api.ts:4](https://gitlab.com/rxap/packages/-/blob/
|
|
101
|
+
Defined in: [packages/angular/open-api/src/lib/open-api.ts:4](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/open-api.ts#L4)
|
|
102
102
|
|
|
103
103
|
***
|
|
104
104
|
|
|
105
105
|
### requestBody?
|
|
106
106
|
|
|
107
|
-
> `optional` **requestBody
|
|
107
|
+
> `optional` **requestBody?**: `ReferenceObject` \| `RequestBodyObject`
|
|
108
108
|
|
|
109
|
-
Defined in: node\_modules/openapi-types/dist/index.d.ts:222
|
|
109
|
+
Defined in: node\_modules/.pnpm/openapi-types@10.0.0/node\_modules/openapi-types/dist/index.d.ts:222
|
|
110
110
|
|
|
111
111
|
#### Inherited from
|
|
112
112
|
|
|
@@ -118,7 +118,7 @@ Defined in: node\_modules/openapi-types/dist/index.d.ts:222
|
|
|
118
118
|
|
|
119
119
|
> **responses**: `ResponsesObject`
|
|
120
120
|
|
|
121
|
-
Defined in: node\_modules/openapi-types/dist/index.d.ts:223
|
|
121
|
+
Defined in: node\_modules/.pnpm/openapi-types@10.0.0/node\_modules/openapi-types/dist/index.d.ts:223
|
|
122
122
|
|
|
123
123
|
#### Inherited from
|
|
124
124
|
|
|
@@ -128,9 +128,9 @@ Defined in: node\_modules/openapi-types/dist/index.d.ts:223
|
|
|
128
128
|
|
|
129
129
|
### security?
|
|
130
130
|
|
|
131
|
-
> `optional` **security
|
|
131
|
+
> `optional` **security?**: `SecurityRequirementObject`[]
|
|
132
132
|
|
|
133
|
-
Defined in: node\_modules/openapi-types/dist/index.d.ts:228
|
|
133
|
+
Defined in: node\_modules/.pnpm/openapi-types@10.0.0/node\_modules/openapi-types/dist/index.d.ts:228
|
|
134
134
|
|
|
135
135
|
#### Inherited from
|
|
136
136
|
|
|
@@ -140,9 +140,9 @@ Defined in: node\_modules/openapi-types/dist/index.d.ts:228
|
|
|
140
140
|
|
|
141
141
|
### servers?
|
|
142
142
|
|
|
143
|
-
> `optional` **servers
|
|
143
|
+
> `optional` **servers?**: `ServerObject`[]
|
|
144
144
|
|
|
145
|
-
Defined in: node\_modules/openapi-types/dist/index.d.ts:229
|
|
145
|
+
Defined in: node\_modules/.pnpm/openapi-types@10.0.0/node\_modules/openapi-types/dist/index.d.ts:229
|
|
146
146
|
|
|
147
147
|
#### Inherited from
|
|
148
148
|
|
|
@@ -152,9 +152,9 @@ Defined in: node\_modules/openapi-types/dist/index.d.ts:229
|
|
|
152
152
|
|
|
153
153
|
### summary?
|
|
154
154
|
|
|
155
|
-
> `optional` **summary
|
|
155
|
+
> `optional` **summary?**: `string`
|
|
156
156
|
|
|
157
|
-
Defined in: node\_modules/openapi-types/dist/index.d.ts:217
|
|
157
|
+
Defined in: node\_modules/.pnpm/openapi-types@10.0.0/node\_modules/openapi-types/dist/index.d.ts:217
|
|
158
158
|
|
|
159
159
|
#### Inherited from
|
|
160
160
|
|
|
@@ -164,9 +164,9 @@ Defined in: node\_modules/openapi-types/dist/index.d.ts:217
|
|
|
164
164
|
|
|
165
165
|
### tags?
|
|
166
166
|
|
|
167
|
-
> `optional` **tags
|
|
167
|
+
> `optional` **tags?**: `string`[]
|
|
168
168
|
|
|
169
|
-
Defined in: node\_modules/openapi-types/dist/index.d.ts:216
|
|
169
|
+
Defined in: node\_modules/.pnpm/openapi-types@10.0.0/node\_modules/openapi-types/dist/index.d.ts:216
|
|
170
170
|
|
|
171
171
|
#### Inherited from
|
|
172
172
|
|
|
@@ -2,27 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
# Interface: SchemaValidationResponse\<Data\>
|
|
4
4
|
|
|
5
|
-
Defined in: [packages/angular/open-api/src/lib/schema-validation.mixin.ts:24](https://gitlab.com/rxap/packages/-/blob/
|
|
5
|
+
Defined in: [packages/angular/open-api/src/lib/schema-validation.mixin.ts:24](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/schema-validation.mixin.ts#L24)
|
|
6
6
|
|
|
7
7
|
## Type Parameters
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### Data
|
|
10
|
+
|
|
11
|
+
`Data`
|
|
10
12
|
|
|
11
13
|
## Properties
|
|
12
14
|
|
|
13
15
|
### body?
|
|
14
16
|
|
|
15
|
-
> `optional` **body
|
|
17
|
+
> `optional` **body?**: `Data` \| `null`
|
|
16
18
|
|
|
17
|
-
Defined in: [packages/angular/open-api/src/lib/schema-validation.mixin.ts:27](https://gitlab.com/rxap/packages/-/blob/
|
|
19
|
+
Defined in: [packages/angular/open-api/src/lib/schema-validation.mixin.ts:27](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/schema-validation.mixin.ts#L27)
|
|
18
20
|
|
|
19
21
|
***
|
|
20
22
|
|
|
21
23
|
### data?
|
|
22
24
|
|
|
23
|
-
> `optional` **data
|
|
25
|
+
> `optional` **data?**: `Data`
|
|
24
26
|
|
|
25
|
-
Defined in: [packages/angular/open-api/src/lib/schema-validation.mixin.ts:28](https://gitlab.com/rxap/packages/-/blob/
|
|
27
|
+
Defined in: [packages/angular/open-api/src/lib/schema-validation.mixin.ts:28](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/schema-validation.mixin.ts#L28)
|
|
26
28
|
|
|
27
29
|
***
|
|
28
30
|
|
|
@@ -30,7 +32,7 @@ Defined in: [packages/angular/open-api/src/lib/schema-validation.mixin.ts:28](ht
|
|
|
30
32
|
|
|
31
33
|
> **headers**: `HttpHeaders`
|
|
32
34
|
|
|
33
|
-
Defined in: [packages/angular/open-api/src/lib/schema-validation.mixin.ts:25](https://gitlab.com/rxap/packages/-/blob/
|
|
35
|
+
Defined in: [packages/angular/open-api/src/lib/schema-validation.mixin.ts:25](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/schema-validation.mixin.ts#L25)
|
|
34
36
|
|
|
35
37
|
***
|
|
36
38
|
|
|
@@ -38,4 +40,4 @@ Defined in: [packages/angular/open-api/src/lib/schema-validation.mixin.ts:25](ht
|
|
|
38
40
|
|
|
39
41
|
> **status**: `number`
|
|
40
42
|
|
|
41
|
-
Defined in: [packages/angular/open-api/src/lib/schema-validation.mixin.ts:26](https://gitlab.com/rxap/packages/-/blob/
|
|
43
|
+
Defined in: [packages/angular/open-api/src/lib/schema-validation.mixin.ts:26](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/schema-validation.mixin.ts#L26)
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
# Type Alias: OperationMap
|
|
4
4
|
|
|
5
|
-
> **OperationMap
|
|
5
|
+
> **OperationMap** = `Map`\<`string`, [`OperationObjectWithMetadata`](../wiki/Interface.OperationObjectWithMetadata)\>
|
|
6
6
|
|
|
7
|
-
Defined in: [packages/angular/open-api/src/lib/open-api-config.service.ts:10](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [packages/angular/open-api/src/lib/open-api-config.service.ts:10](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/open-api-config.service.ts#L10)
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
> `const` **DEFAULT\_OPEN\_API\_DATA\_SOURCE\_META\_DATA**: `InjectionToken`\<`unknown`\>
|
|
6
6
|
|
|
7
|
-
Defined in: [packages/angular/open-api/src/lib/tokens.ts:7](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [packages/angular/open-api/src/lib/tokens.ts:7](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/tokens.ts#L7)
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
> `const` **DEFAULT\_OPEN\_API\_REMOTE\_METHOD\_META\_DATA**: `InjectionToken`\<`unknown`\>
|
|
6
6
|
|
|
7
|
-
Defined in: [packages/angular/open-api/src/lib/tokens.ts:5](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [packages/angular/open-api/src/lib/tokens.ts:5](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/tokens.ts#L5)
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
> `const` **DISABLE\_SCHEMA\_VALIDATION**: `InjectionToken`\<`boolean`\>
|
|
6
6
|
|
|
7
|
-
Defined in: [packages/angular/open-api/src/lib/tokens.ts:8](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [packages/angular/open-api/src/lib/tokens.ts:8](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/tokens.ts#L8)
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
> `const` **DISABLE\_VALIDATION**: `InjectionToken`\<`boolean`\>
|
|
6
6
|
|
|
7
|
-
Defined in: [packages/angular/open-api/src/lib/tokens.ts:12](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [packages/angular/open-api/src/lib/tokens.ts:12](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/tokens.ts#L12)
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
> `const` **OPEN\_API\_OPERATION**: `HttpContextToken`\<`string`\>
|
|
6
6
|
|
|
7
|
-
Defined in: [packages/angular/open-api/src/lib/http-context-tokens.ts:6](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [packages/angular/open-api/src/lib/http-context-tokens.ts:6](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/http-context-tokens.ts#L6)
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
> `const` **OPEN\_API\_OPERATION\_ID**: `HttpContextToken`\<`string`\>
|
|
6
6
|
|
|
7
|
-
Defined in: [packages/angular/open-api/src/lib/http-context-tokens.ts:3](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [packages/angular/open-api/src/lib/http-context-tokens.ts:3](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/http-context-tokens.ts#L3)
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
# Variable: OPEN\_API\_SERVER\_ID
|
|
4
4
|
|
|
5
|
-
> `const` **OPEN\_API\_SERVER\_ID**: `HttpContextToken`\<`
|
|
5
|
+
> `const` **OPEN\_API\_SERVER\_ID**: `HttpContextToken`\<`string` \| `null`\>
|
|
6
6
|
|
|
7
|
-
Defined in: [packages/angular/open-api/src/lib/http-context-tokens.ts:4](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [packages/angular/open-api/src/lib/http-context-tokens.ts:4](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/http-context-tokens.ts#L4)
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
> `const` **OPEN\_API\_SERVER\_INDEX**: `HttpContextToken`\<`number`\>
|
|
6
6
|
|
|
7
|
-
Defined in: [packages/angular/open-api/src/lib/http-context-tokens.ts:5](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [packages/angular/open-api/src/lib/http-context-tokens.ts:5](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/http-context-tokens.ts#L5)
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
> `const` **RXAP\_OPEN\_API\_CONFIG**: `InjectionToken`\<`unknown`\>
|
|
6
6
|
|
|
7
|
-
Defined in: [packages/angular/open-api/src/lib/tokens.ts:3](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [packages/angular/open-api/src/lib/tokens.ts:3](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/tokens.ts#L3)
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
> `const` **RXAP\_OPEN\_API\_STRICT\_VALIDATOR**: `InjectionToken`\<`unknown`\>
|
|
6
6
|
|
|
7
|
-
Defined in: [packages/angular/open-api/src/lib/tokens.ts:4](https://gitlab.com/rxap/packages/-/blob/
|
|
7
|
+
Defined in: [packages/angular/open-api/src/lib/tokens.ts:4](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/tokens.ts#L4)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
[@rxap/open-api](../wiki/globals) / injectOpenApiBaseUrlHttpInterceptorFn
|
|
2
|
+
|
|
3
|
+
# Variable: injectOpenApiBaseUrlHttpInterceptorFn
|
|
4
|
+
|
|
5
|
+
> `const` **injectOpenApiBaseUrlHttpInterceptorFn**: `HttpInterceptorFn`
|
|
6
|
+
|
|
7
|
+
Defined in: [packages/angular/open-api/src/lib/http-interceptors.ts:9](https://gitlab.com/rxap/packages/-/blob/73459044d95e79d1cc84f9d21f658812d63c3185/packages/angular/open-api/src/lib/http-interceptors.ts#L9)
|
package/docs/wiki/_Sidebar.md
CHANGED
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
- [DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA](../wiki/Variable.DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA)
|
|
25
25
|
- [DISABLE_SCHEMA_VALIDATION](../wiki/Variable.DISABLE_SCHEMA_VALIDATION)
|
|
26
26
|
- [DISABLE_VALIDATION](../wiki/Variable.DISABLE_VALIDATION)
|
|
27
|
+
- [injectOpenApiBaseUrlHttpInterceptorFn](../wiki/Variable.injectOpenApiBaseUrlHttpInterceptorFn)
|
|
27
28
|
- [OPEN_API_OPERATION](../wiki/Variable.OPEN_API_OPERATION)
|
|
28
29
|
- [OPEN_API_OPERATION_ID](../wiki/Variable.OPEN_API_OPERATION_ID)
|
|
29
30
|
- [OPEN_API_SERVER_ID](../wiki/Variable.OPEN_API_SERVER_ID)
|
|
@@ -38,7 +39,6 @@
|
|
|
38
39
|
- [getJsonSchema](../wiki/Function.getJsonSchema)
|
|
39
40
|
- [hasJsonContentSchema](../wiki/Function.hasJsonContentSchema)
|
|
40
41
|
- [hasJsonSchema](../wiki/Function.hasJsonSchema)
|
|
41
|
-
- [injectOpenApiBaseUrlHttpInterceptorFn](../wiki/Function.injectOpenApiBaseUrlHttpInterceptorFn)
|
|
42
42
|
- [IsOpenApiV3](../wiki/Function.IsOpenApiV3)
|
|
43
43
|
- [IsReferenceObject](../wiki/Function.IsReferenceObject)
|
|
44
44
|
- [NotContainsReferenceObjects](../wiki/Function.NotContainsReferenceObjects)
|
package/docs/wiki/globals.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @rxap/open-api v22.0.0-dev.
|
|
1
|
+
# @rxap/open-api v22.0.0-dev.2
|
|
2
2
|
|
|
3
3
|
## Classes
|
|
4
4
|
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
- [DEFAULT\_OPEN\_API\_REMOTE\_METHOD\_META\_DATA](../wiki/Variable.DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA)
|
|
25
25
|
- [DISABLE\_SCHEMA\_VALIDATION](../wiki/Variable.DISABLE_SCHEMA_VALIDATION)
|
|
26
26
|
- [DISABLE\_VALIDATION](../wiki/Variable.DISABLE_VALIDATION)
|
|
27
|
+
- [injectOpenApiBaseUrlHttpInterceptorFn](../wiki/Variable.injectOpenApiBaseUrlHttpInterceptorFn)
|
|
27
28
|
- [OPEN\_API\_OPERATION](../wiki/Variable.OPEN_API_OPERATION)
|
|
28
29
|
- [OPEN\_API\_OPERATION\_ID](../wiki/Variable.OPEN_API_OPERATION_ID)
|
|
29
30
|
- [OPEN\_API\_SERVER\_ID](../wiki/Variable.OPEN_API_SERVER_ID)
|
|
@@ -38,7 +39,6 @@
|
|
|
38
39
|
- [getJsonSchema](../wiki/Function.getJsonSchema)
|
|
39
40
|
- [hasJsonContentSchema](../wiki/Function.hasJsonContentSchema)
|
|
40
41
|
- [hasJsonSchema](../wiki/Function.hasJsonSchema)
|
|
41
|
-
- [injectOpenApiBaseUrlHttpInterceptorFn](../wiki/Function.injectOpenApiBaseUrlHttpInterceptorFn)
|
|
42
42
|
- [IsOpenApiV3](../wiki/Function.IsOpenApiV3)
|
|
43
43
|
- [IsReferenceObject](../wiki/Function.IsReferenceObject)
|
|
44
44
|
- [NotContainsReferenceObjects](../wiki/Function.NotContainsReferenceObjects)
|
|
@@ -16,7 +16,7 @@ var RxapOpenApiDataSourceTableError = class extends RxapOpenApiDataSourceError {
|
|
|
16
16
|
const RXAP_OPEN_API_TABLE_DATA_SOURCE_TO_PARAMETERS_FUNCTION = new InjectionToken("rxap/open-api/data-source/table/to-parameters-function");
|
|
17
17
|
var OpenApiTableDataSource = class OpenApiTableDataSource extends AbstractTableDataSource {
|
|
18
18
|
constructor(dataSource, paginator = null, tableEventToOpenApiParameters = null, sort = null, filter = null, parameters = null, metadata = dataSource.metadata) {
|
|
19
|
-
super(paginator, sort, filter, parameters, metadata);
|
|
19
|
+
super(paginator, sort, filter, parameters, metadata ?? dataSource.metadata);
|
|
20
20
|
this.dataSource = dataSource;
|
|
21
21
|
if (tableEventToOpenApiParameters) this.tableEventToOpenApiParameters = tableEventToOpenApiParameters;
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rxap-open-api-data-source-table.mjs","names":["rxjsFilter"],"sources":["../../../../../packages/angular/open-api/data-source/table/src/lib/error.ts","../../../../../packages/angular/open-api/data-source/table/src/lib/tokens.ts","../../../../../packages/angular/open-api/data-source/table/src/lib/open-api-table.data-source.ts","../../../../../packages/angular/open-api/data-source/table/src/lib/to-open-api-table-data-source.pipe.ts"],"sourcesContent":["import { RxapOpenApiDataSourceError } from '@rxap/open-api/data-source';\n\nexport class RxapOpenApiDataSourceTableError extends RxapOpenApiDataSourceError {\n\n constructor(message: string, code?: string, scope?: string) {\n super(message, code, scope);\n this.addSubPackageName('table');\n }\n\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const RXAP_OPEN_API_TABLE_DATA_SOURCE_TO_PARAMETERS_FUNCTION = new InjectionToken(\n 'rxap/open-api/data-source/table/to-parameters-function');\n","import {\n AbstractTableDataSource,\n AbstractTableDataSourceMetadata,\n FilterLike,\n RXAP_TABLE_DATA_SOURCE,\n RXAP_TABLE_DATA_SOURCE_FILTER,\n RXAP_TABLE_DATA_SOURCE_PAGINATOR,\n RXAP_TABLE_DATA_SOURCE_PARAMETERS,\n RXAP_TABLE_DATA_SOURCE_SORT,\n RxapAbstractTableDataSource,\n Sort,\n SortLike,\n} from '@rxap/data-source/table';\nimport { Inject, Injectable, Optional } from '@angular/core';\nimport {\n BaseDataSourceViewer,\n RXAP_DATA_SOURCE_METADATA,\n} from '@rxap/data-source';\nimport {\n PageEvent,\n PaginatorLike,\n} from '@rxap/data-source/pagination';\nimport { PaginationData } from '@rxap/data-source/http/pagination';\nimport {\n combineLatest,\n EMPTY,\n isObservable,\n Observable,\n of,\n TeardownLogic,\n} from 'rxjs';\nimport { RxapOpenApiDataSourceTableError } from './error';\nimport {\n filter as rxjsFilter,\n map,\n startWith,\n switchMap,\n tap,\n} from 'rxjs/operators';\nimport { RXAP_OPEN_API_TABLE_DATA_SOURCE_TO_PARAMETERS_FUNCTION } from './tokens';\nimport {\n Constructor,\n isPromise,\n} from '@rxap/utilities';\nimport type { OpenApiDataSource } from '@rxap/open-api/data-source';\nimport { OpenApiDataSourceViewer } from '@rxap/open-api/data-source';\n\nexport interface TableEvent {\n page: PageEvent;\n sort: Sort | null;\n filter: Record<string, any> | string | null;\n}\n\nexport interface OpenApiTableDataSourceViewer extends BaseDataSourceViewer {\n readonly viewChange: Observable<TableEvent>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface OpenApiTableDataSourceMetadata\n extends AbstractTableDataSourceMetadata {}\n\nexport type TableEventToOpenApiParametersFunction<\n Parameters extends Record<string, any>\n> = (\n event: TableEvent,\n) => Parameters | Observable<Parameters> | Promise<Parameters>;\n\n@Injectable()\nexport class OpenApiTableDataSource<\n Data extends object = any,\n Parameters extends Record<string, any> = any\n> extends AbstractTableDataSource<Data> {\n constructor(\n @Inject(RXAP_TABLE_DATA_SOURCE)\n private readonly dataSource: OpenApiDataSource<PaginationData<Data>>,\n @Optional()\n @Inject(RXAP_TABLE_DATA_SOURCE_PAGINATOR)\n paginator: PaginatorLike | null = null,\n @Optional()\n @Inject(RXAP_OPEN_API_TABLE_DATA_SOURCE_TO_PARAMETERS_FUNCTION)\n tableEventToOpenApiParameters: any | null = null,\n @Optional()\n @Inject(RXAP_TABLE_DATA_SOURCE_SORT)\n sort: SortLike | null = null,\n @Optional()\n @Inject(RXAP_TABLE_DATA_SOURCE_FILTER)\n filter: FilterLike | null = null,\n @Optional()\n @Inject(RXAP_TABLE_DATA_SOURCE_PARAMETERS)\n parameters: Observable<Parameters> | null = null,\n @Optional()\n @Inject(RXAP_DATA_SOURCE_METADATA)\n metadata: OpenApiTableDataSourceMetadata | null = dataSource.metadata,\n ) {\n super(paginator, sort, filter, parameters, metadata);\n\n if (tableEventToOpenApiParameters) {\n this.tableEventToOpenApiParameters = tableEventToOpenApiParameters;\n }\n }\n\n public tableEventToOpenApiParameters(\n event: TableEvent,\n ): Parameters | Observable<Parameters> | Promise<Parameters> {\n return {\n page: event.page.pageIndex,\n size: event.page.pageSize,\n sortBy: event.sort?.active,\n direction: event.sort?.direction,\n filter: event.filter,\n } as any;\n }\n\n protected override _connect(\n viewer: OpenApiDataSourceViewer,\n ): [ Observable<Data[]>, TeardownLogic ] {\n this.assertPaginator();\n\n if (viewer.viewChange && viewer.viewChange !== EMPTY) {\n console.warn('The viewChange property is readonly');\n }\n\n if (this.paginator === undefined || this.paginator.page === undefined) {\n throw new RxapOpenApiDataSourceTableError(\n 'The paginator instance has not a page property',\n '',\n );\n }\n\n viewer.viewChange = combineLatest([\n this.paginator.page.pipe(\n startWith({\n pageIndex: this.paginator.pageIndex,\n pageSize: this.paginator.pageSize,\n length: this.paginator.length,\n }),\n tap((page) => {\n if (typeof page.pageSize !== 'number') {\n console.warn('The page size is not defined!');\n }\n }),\n rxjsFilter((page) => typeof page.pageSize === 'number'),\n ),\n this.sort?.sortChange?.pipe(\n startWith({\n active: this.sort?.active,\n direction: this.sort?.direction,\n }),\n ) ?? of(null),\n this.filter?.change ?? of(null),\n ]).pipe(\n map(([ page, sort, filter ]) => ({\n page,\n sort,\n filter,\n })),\n switchMap((event) => {\n const options = this.tableEventToOpenApiParameters(event);\n if (isPromise(options) || isObservable(options)) {\n return options;\n }\n return of(options);\n }),\n );\n\n return [\n this.dataSource.connect(viewer).pipe(\n tap((paginationData) => {\n if (typeof paginationData !== 'object') {\n throw new RxapOpenApiDataSourceTableError(\n 'The open api data source does not return a PaginationData object. Value is not an object',\n '',\n );\n }\n if (!paginationData.hasOwnProperty('total')) {\n throw new RxapOpenApiDataSourceTableError(\n 'The open api data source does not return a PaginationData object. Object has not the property total',\n '',\n );\n }\n if (\n !paginationData.hasOwnProperty('data') &&\n !Array.isArray(paginationData.data)\n ) {\n throw new RxapOpenApiDataSourceTableError(\n 'The open api data source does not return a PaginationData object. Object has not the property data' +\n ' property of the value not an array',\n '',\n );\n }\n if (\n paginationData.size !== undefined &&\n paginationData.size !== this.paginator!.pageSize\n ) {\n console.warn(\n 'The selected page size from the paginator is not equal to the page size from the PaginationData object',\n );\n }\n if (\n paginationData.page !== undefined &&\n paginationData.page !== this.paginator!.pageIndex\n ) {\n console.warn(\n 'The selected page index from the paginator is not equal to the page index from the PaginationData object',\n );\n }\n }),\n tap((paginationData) => this.updateTotalLength(paginationData.total)),\n map((paginationData) => paginationData.data),\n ),\n () => this.dataSource.disconnect(viewer),\n ];\n }\n}\n\nexport function RxapOpenApiTableDataSource<\n Data extends object,\n Parameters extends Record<string, any>\n>(\n metadata: OpenApiTableDataSourceMetadata,\n className = 'OpenApiTableDataSource',\n packageName = '@rxap/open-api/data-source/table',\n) {\n return function (\n target: Constructor<OpenApiTableDataSource<Data, Parameters>>,\n ) {\n RxapAbstractTableDataSource(metadata, className, packageName)(target);\n };\n}\n","import {\n Pipe,\n PipeTransform,\n} from '@angular/core';\nimport { PaginationData } from '@rxap/data-source/http/pagination';\nimport { PaginatorLike } from '@rxap/data-source/pagination';\nimport {\n FilterLike,\n SortLike,\n} from '@rxap/data-source/table';\nimport { OpenApiDataSource } from '@rxap/open-api/data-source';\nimport {\n OpenApiTableDataSource,\n TableEventToOpenApiParametersFunction,\n} from './open-api-table.data-source';\n\n@Pipe({\n name: 'toOpenApiTableDataSource',\n standalone: true,\n})\nexport class ToOpenApiTableDataSourcePipe implements PipeTransform {\n\n public transform<Data extends object, Parameters extends Record<string, any>>(\n dataSource: OpenApiDataSource<PaginationData<Data>>,\n paginator: PaginatorLike,\n tableEventToOpenApiParameters?: TableEventToOpenApiParametersFunction<Parameters>,\n sort?: SortLike,\n filter?: FilterLike,\n ): OpenApiTableDataSource<Data> {\n return new OpenAp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A,UAAA;GAAA,MAAA;GAA4B,cAAA;GAAA,MAAA;EAAA,CAAA;CAAA;;AAA5B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAA4B,YAAA,CAAA;EAJxC,MAAA;EAAK,MAAA,CAAA;GACF,MAAM;GACN,YAAY;EACf,CAAA"}
|
|
1
|
+
{"version":3,"file":"rxap-open-api-data-source-table.mjs","names":["rxjsFilter"],"sources":["../../../../../packages/angular/open-api/data-source/table/src/lib/error.ts","../../../../../packages/angular/open-api/data-source/table/src/lib/tokens.ts","../../../../../packages/angular/open-api/data-source/table/src/lib/open-api-table.data-source.ts","../../../../../packages/angular/open-api/data-source/table/src/lib/to-open-api-table-data-source.pipe.ts"],"sourcesContent":["import { RxapOpenApiDataSourceError } from '@rxap/open-api/data-source';\n\nexport class RxapOpenApiDataSourceTableError extends RxapOpenApiDataSourceError {\n\n constructor(message: string, code?: string, scope?: string) {\n super(message, code, scope);\n this.addSubPackageName('table');\n }\n\n}\n","import { InjectionToken } from '@angular/core';\n\nexport const RXAP_OPEN_API_TABLE_DATA_SOURCE_TO_PARAMETERS_FUNCTION = new InjectionToken(\n 'rxap/open-api/data-source/table/to-parameters-function');\n","import {\n AbstractTableDataSource,\n AbstractTableDataSourceMetadata,\n FilterLike,\n RXAP_TABLE_DATA_SOURCE,\n RXAP_TABLE_DATA_SOURCE_FILTER,\n RXAP_TABLE_DATA_SOURCE_PAGINATOR,\n RXAP_TABLE_DATA_SOURCE_PARAMETERS,\n RXAP_TABLE_DATA_SOURCE_SORT,\n RxapAbstractTableDataSource,\n Sort,\n SortLike,\n} from '@rxap/data-source/table';\nimport { Inject, Injectable, Optional } from '@angular/core';\nimport {\n BaseDataSourceViewer,\n RXAP_DATA_SOURCE_METADATA,\n} from '@rxap/data-source';\nimport {\n PageEvent,\n PaginatorLike,\n} from '@rxap/data-source/pagination';\nimport { PaginationData } from '@rxap/data-source/http/pagination';\nimport {\n combineLatest,\n EMPTY,\n isObservable,\n Observable,\n of,\n TeardownLogic,\n} from 'rxjs';\nimport { RxapOpenApiDataSourceTableError } from './error';\nimport {\n filter as rxjsFilter,\n map,\n startWith,\n switchMap,\n tap,\n} from 'rxjs/operators';\nimport { RXAP_OPEN_API_TABLE_DATA_SOURCE_TO_PARAMETERS_FUNCTION } from './tokens';\nimport {\n Constructor,\n isPromise,\n} from '@rxap/utilities';\nimport type { OpenApiDataSource } from '@rxap/open-api/data-source';\nimport { OpenApiDataSourceViewer } from '@rxap/open-api/data-source';\n\nexport interface TableEvent {\n page: PageEvent;\n sort: Sort | null;\n filter: Record<string, any> | string | null;\n}\n\nexport interface OpenApiTableDataSourceViewer extends BaseDataSourceViewer {\n readonly viewChange: Observable<TableEvent>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface OpenApiTableDataSourceMetadata\n extends AbstractTableDataSourceMetadata {}\n\nexport type TableEventToOpenApiParametersFunction<\n Parameters extends Record<string, any>\n> = (\n event: TableEvent,\n) => Parameters | Observable<Parameters> | Promise<Parameters>;\n\n@Injectable()\nexport class OpenApiTableDataSource<\n Data extends object = any,\n Parameters extends Record<string, any> = any\n> extends AbstractTableDataSource<Data> {\n constructor(\n @Inject(RXAP_TABLE_DATA_SOURCE)\n private readonly dataSource: OpenApiDataSource<PaginationData<Data>>,\n @Optional()\n @Inject(RXAP_TABLE_DATA_SOURCE_PAGINATOR)\n paginator: PaginatorLike | null = null,\n @Optional()\n @Inject(RXAP_OPEN_API_TABLE_DATA_SOURCE_TO_PARAMETERS_FUNCTION)\n tableEventToOpenApiParameters: any | null = null,\n @Optional()\n @Inject(RXAP_TABLE_DATA_SOURCE_SORT)\n sort: SortLike | null = null,\n @Optional()\n @Inject(RXAP_TABLE_DATA_SOURCE_FILTER)\n filter: FilterLike | null = null,\n @Optional()\n @Inject(RXAP_TABLE_DATA_SOURCE_PARAMETERS)\n parameters: Observable<Parameters> | null = null,\n @Optional()\n @Inject(RXAP_DATA_SOURCE_METADATA)\n metadata: OpenApiTableDataSourceMetadata | null = dataSource.metadata,\n ) {\n // the injector provides null (not undefined) for a missing optional dependency, so the default value\n // of the parameter is not applied in that case\n super(paginator, sort, filter, parameters, metadata ?? dataSource.metadata);\n\n if (tableEventToOpenApiParameters) {\n this.tableEventToOpenApiParameters = tableEventToOpenApiParameters;\n }\n }\n\n public tableEventToOpenApiParameters(\n event: TableEvent,\n ): Parameters | Observable<Parameters> | Promise<Parameters> {\n return {\n page: event.page.pageIndex,\n size: event.page.pageSize,\n sortBy: event.sort?.active,\n direction: event.sort?.direction,\n filter: event.filter,\n } as any;\n }\n\n protected override _connect(\n viewer: OpenApiDataSourceViewer,\n ): [ Observable<Data[]>, TeardownLogic ] {\n this.assertPaginator();\n\n if (viewer.viewChange && viewer.viewChange !== EMPTY) {\n console.warn('The viewChange property is readonly');\n }\n\n if (this.paginator === undefined || this.paginator.page === undefined) {\n throw new RxapOpenApiDataSourceTableError(\n 'The paginator instance has not a page property',\n '',\n );\n }\n\n viewer.viewChange = combineLatest([\n this.paginator.page.pipe(\n startWith({\n pageIndex: this.paginator.pageIndex,\n pageSize: this.paginator.pageSize,\n length: this.paginator.length,\n }),\n tap((page) => {\n if (typeof page.pageSize !== 'number') {\n console.warn('The page size is not defined!');\n }\n }),\n rxjsFilter((page) => typeof page.pageSize === 'number'),\n ),\n this.sort?.sortChange?.pipe(\n startWith({\n active: this.sort?.active,\n direction: this.sort?.direction,\n }),\n ) ?? of(null),\n this.filter?.change ?? of(null),\n ]).pipe(\n map(([ page, sort, filter ]) => ({\n page,\n sort,\n filter,\n })),\n switchMap((event) => {\n const options = this.tableEventToOpenApiParameters(event);\n if (isPromise(options) || isObservable(options)) {\n return options;\n }\n return of(options);\n }),\n );\n\n return [\n this.dataSource.connect(viewer).pipe(\n tap((paginationData) => {\n if (typeof paginationData !== 'object') {\n throw new RxapOpenApiDataSourceTableError(\n 'The open api data source does not return a PaginationData object. Value is not an object',\n '',\n );\n }\n if (!paginationData.hasOwnProperty('total')) {\n throw new RxapOpenApiDataSourceTableError(\n 'The open api data source does not return a PaginationData object. Object has not the property total',\n '',\n );\n }\n if (\n !paginationData.hasOwnProperty('data') &&\n !Array.isArray(paginationData.data)\n ) {\n throw new RxapOpenApiDataSourceTableError(\n 'The open api data source does not return a PaginationData object. Object has not the property data' +\n ' property of the value not an array',\n '',\n );\n }\n if (\n paginationData.size !== undefined &&\n paginationData.size !== this.paginator!.pageSize\n ) {\n console.warn(\n 'The selected page size from the paginator is not equal to the page size from the PaginationData object',\n );\n }\n if (\n paginationData.page !== undefined &&\n paginationData.page !== this.paginator!.pageIndex\n ) {\n console.warn(\n 'The selected page index from the paginator is not equal to the page index from the PaginationData object',\n );\n }\n }),\n tap((paginationData) => this.updateTotalLength(paginationData.total)),\n map((paginationData) => paginationData.data),\n ),\n () => this.dataSource.disconnect(viewer),\n ];\n }\n}\n\nexport function RxapOpenApiTableDataSource<\n Data extends object,\n Parameters extends Record<string, any>\n>(\n metadata: OpenApiTableDataSourceMetadata,\n className = 'OpenApiTableDataSource',\n packageName = '@rxap/open-api/data-source/table',\n) {\n return function (\n target: Constructor<OpenApiTableDataSource<Data, Parameters>>,\n ) {\n RxapAbstractTableDataSource(metadata, className, packageName)(target);\n };\n}\n","import {\n Pipe,\n PipeTransform,\n} from '@angular/core';\nimport { PaginationData } from '@rxap/data-source/http/pagination';\nimport { PaginatorLike } from '@rxap/data-source/pagination';\nimport {\n FilterLike,\n SortLike,\n} from '@rxap/data-source/table';\nimport { OpenApiDataSource } from '@rxap/open-api/data-source';\nimport {\n OpenApiTableDataSource,\n TableEventToOpenApiParametersFunction,\n} from './open-api-table.data-source';\n\n@Pipe({\n name: 'toOpenApiTableDataSource',\n standalone: true,\n})\nexport class ToOpenApiTableDataSourcePipe implements PipeTransform {\n\n public transform<Data extends object, Parameters extends Record<string, any>>(\n dataSource: OpenApiDataSource<PaginationData<Data>>,\n paginator: PaginatorLike,\n tableEventToOpenApiParameters?: TableEventToOpenApiParametersFunction<Parameters>,\n sort?: SortLike,\n filter?: FilterLike,\n ): OpenApiTableDataSource<Data> {\n return new OpenApiTableDataSource(dataSource, paginator, tableEventToOpenApiParameters, sort, filter);\n }\n\n}\n"],"mappings":";;;;;;;;;AAEA,IAAa,kCAAb,cAAqD,2BAA0B;CAE7E,YAAY,SAAiB,MAAe,OAAc;EACxD,MAAM,SAAS,MAAM,KAAK;EAC1B,KAAK,kBAAkB,OAAO;CAChC;AAED;ACPD,MAAa,yDAAyD,IAAI,eACxE,wDAAwD;ACiE1D,IAAa,yBAAb,MAAa,+BAGH,wBAA6B;CACrC,YAEmB,YAGf,YAAkC,MAGlC,gCAA4C,MAG5C,OAAwB,MAGxB,SAA4B,MAG5B,aAA4C,MAG5C,WAAkD,WAAW,UAAQ;EAIvE,MAAM,WAAW,MAAM,QAAQ,YAAY,YAAY,WAAW,QAAQ;EAtBzD,KAAA,aAAA;EAwBjB,IAAI,+BACF,KAAK,gCAAgC;CAEzC;CAEO,8BACL,OAAiB;EAEjB,OAAO;GACL,MAAM,MAAM,KAAK;GACjB,MAAM,MAAM,KAAK;GACjB,QAAQ,MAAM,MAAM;GACpB,WAAW,MAAM,MAAM;GACvB,QAAQ,MAAM;EACR;CACV;CAEmB,SACjB,QAA+B;EAE/B,KAAK,gBAAe;EAEpB,IAAI,OAAO,cAAc,OAAO,eAAe,OAC7C,QAAQ,KAAK,qCAAqC;EAGpD,IAAI,KAAK,cAAc,UAAa,KAAK,UAAU,SAAS,QAC1D,MAAM,IAAI,gCACR,kDACA,EAAE;EAIN,OAAO,aAAa,cAAc;GAChC,KAAK,UAAU,KAAK,KAClB,UAAU;IACR,WAAW,KAAK,UAAU;IAC1B,UAAU,KAAK,UAAU;IACzB,QAAQ,KAAK,UAAU;GACxB,CAAA,GACD,KAAK,SAAQ;IACX,IAAI,OAAO,KAAK,aAAa,UAC3B,QAAQ,KAAK,+BAA+B;GAEhD,CAAC,GACDA,QAAY,SAAS,OAAO,KAAK,aAAa,QAAQ,C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;EAAA,CAAA;CAAA;CAA5B;EAAA,KAAA,QAAA,GAAA,gBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAA4B,cAAA;GAAA,MAAA;EAAA,CAAA;CAAA;;AAA5B,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAA4B,YAAA,CAAA;EAJxC,MAAA;EAAK,MAAA,CAAA;GACF,MAAM;GACN,YAAY;EACf,CAAA"}
|
|
@@ -34,7 +34,7 @@ let OpenApiDataSource = class OpenApiDataSource extends BaseHttpDataSource {
|
|
|
34
34
|
OpenApiDataSource_1 = this;
|
|
35
35
|
}
|
|
36
36
|
constructor(http, openApiConfigService, metadata = null, refresh$ = null, strict = null, disableSchemaValidation = null, disableValidation = null) {
|
|
37
|
-
super(http, metadata);
|
|
37
|
+
super(http, metadata, refresh$);
|
|
38
38
|
this.openApiConfigService = openApiConfigService;
|
|
39
39
|
this.strict = false;
|
|
40
40
|
this.disableSchemaValidation = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rxap-open-api-data-source.mjs","names":[],"sources":["../../../../../packages/angular/open-api/data-source/src/lib/error.ts","../../../../../packages/angular/open-api/data-source/src/lib/open-api.data-source.ts","../../../../../packages/angular/open-api/data-source/src/lib/open-api-data-source.loader.ts"],"sourcesContent":["import { RxapOpenApiError } from '@rxap/open-api';\n\nexport class RxapOpenApiDataSourceError extends RxapOpenApiError {\n\n constructor(message: string, code?: string, scope?: string) {\n super(message, code, scope);\n this.addSubPackageName('data-source');\n }\n\n}\n","import { Inject, Injectable, Optional } from '@angular/core';\nimport {\n DEFAULT_OPEN_API_DATA_SOURCE_META_DATA,\n DISABLE_SCHEMA_VALIDATION,\n DISABLE_VALIDATION,\n OpenApiConfigService,\n OperationObjectWithMetadata,\n RXAP_OPEN_API_STRICT_VALIDATOR,\n SchemaValidationMixin,\n} from '@rxap/open-api';\nimport { HttpClient, HttpErrorResponse, HttpEventType, HttpResponse } from '@angular/common/http';\nimport {\n deepMerge,\n KeyValue,\n} from '@rxap/utilities';\nimport {\n BaseHttpDataSource,\n HttpDataSourceMetadata,\n HttpDataSourceOptions,\n HttpDataSourceViewer,\n} from '@rxap/data-source/http';\nimport {\n RXAP_DATA_SOURCE_REFRESH,\n RxapDataSource,\n} from '@rxap/data-source';\nimport {\n EMPTY,\n Observable,\n Subject,\n throwError,\n} from 'rxjs';\nimport {\n catchError,\n filter,\n map,\n retry,\n take,\n tap,\n timeout,\n} from 'rxjs/operators';\nimport { Mixin } from '@rxap/mixin';\nimport { isDefined } from '@rxap/rxjs';\n\nexport interface OpenApiDataSourceMetadata<PathParams = KeyValue, Body = any | null>\n extends Partial<HttpDataSourceMetadata<PathParams, Body>> {\n\n /**\n * The operation object with path and method\n */\n operation?: OperationObjectWithMetadata;\n\n /**\n * The index of the server object in the servers array in the open api config\n */\n serverIndex?: number;\n\n /**\n * The operation id\n */\n id: string;\n\n strict?: boolean;\n\n}\n\nexport interface OpenApiDataSourceViewer<Parameters = any>\n extends HttpDataSourceViewer<any, any> {\n parameters?: Parameters;\n}\n\nexport function RxapOpenApiDataSource(operationIdOrMetadata: string | OpenApiDataSourceMetadata, serverIndex = 0) {\n const metadata = typeof operationIdOrMetadata === 'string' ?\n {\n id: operationIdOrMetadata,\n serverIndex,\n } :\n operationIdOrMetadata;\n return function (target: any) {\n RxapDataSource(metadata)(target);\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface OpenApiDataSource<Response = any, Parameters extends Record<string, any> | void = any>\n extends SchemaValidationMixin<Response, Parameters> {}\n\n@Mixin(SchemaValidationMixin)\n@Injectable()\nexport class OpenApiDataSource<Response = any, Parameters extends Record<string, any> | void = any>\n extends BaseHttpDataSource<Response> {\n protected readonly strict: boolean = false;\n protected readonly disableSchemaValidation: boolean = false;\n protected readonly disableValidation: boolean = false;\n\n constructor(\n @Inject(HttpClient)\n http: HttpClient,\n @Inject(OpenApiConfigService)\n private readonly openApiConfigService: OpenApiConfigService,\n @Optional()\n @Inject(DEFAULT_OPEN_API_DATA_SOURCE_META_DATA)\n metadata: OpenApiDataSourceMetadata | null = null,\n @Optional()\n @Inject(RXAP_DATA_SOURCE_REFRESH)\n refresh$: Subject<HttpDataSourceOptions> | null = null,\n @Optional()\n @Inject(RXAP_OPEN_API_STRICT_VALIDATOR)\n strict: boolean | null = null,\n @Optional()\n @Inject(DISABLE_SCHEMA_VALIDATION)\n disableSchemaValidation: boolean | null = null,\n @Optional()\n @Inject(DISABLE_VALIDATION)\n disableValidation: boolean | null = null,\n ) {\n super(http, metadata as any);\n\n let operation: OperationObjectWithMetadata;\n if (!this.metadata['operation']) {\n this.metadata['operation'] = operation = openApiConfigService.getOperation(this.metadata.id);\n } else {\n operation = this.metadata['operation'];\n }\n\n if (operation.method !== 'GET') {\n throw new Error('OpenApi DataSource only supports GET Operations!');\n }\n\n this.applyMetadata({\n id: operation.operationId,\n url: () => openApiConfigService.getBaseUrl(this.metadata['serverIndex']) + operation.path,\n method: 'GET',\n });\n\n this.strict = strict || this.metadata['strict'] || false;\n this.disableSchemaValidation = disableSchemaValidation || this.metadata['disableSchemaValidation'] || false;\n this.disableValidation = disableValidation || this.metadata['disableValidation'] || false;\n\n }\n\n public get operation(): OperationObjectWithMetadata {\n return this.metadata['operation'];\n }\n\n public override derive<D = Response>(\n id: string,\n metadata: Partial<OpenApiDataSourceMetadata> = this.metadata,\n isolated = false,\n ): OpenApiDataSource<D, Parameters> {\n return new OpenApiDataSource<D, Parameters>(\n this.http,\n this.openApiConfigService,\n {\n ...deepMerge(this.metadata, metadata),\n id,\n },\n isolated ? null : this.refresh$,\n );\n }\n\n public override connect(viewer: OpenApiDataSourceViewer<Parameters>): Observable<Response> {\n\n\n if (viewer.parameters) {\n if (!this.disableValidation) {\n this.validateParameters(this.operation, viewer.parameters as any, this.strict);\n }\n } else {\n if (viewer.viewChange === EMPTY || viewer.viewChange === undefined) {\n // set the viewer parameters to an empty parameter and test if that\n // is valid.\n viewer.parameters = {} as any;\n if (!this.disableValidation) {\n this.validateParameters(this.operation, viewer.parameters as any, this.strict);\n }\n }\n }\n\n return super.connect({\n ...viewer,\n ...this.buildHttpOptions(this.operation, viewer.parameters),\n // if the view change is an empty observable. Then dont apply the pipe logic\n // else the http request is never triggered\n viewChange: viewer.viewChange === EMPTY ? viewer.viewChange : viewer.viewChange?.pipe(\n tap(parameters => {\n if (!this.disableValidation) {\n this.validateParameters(this.operation, parameters as any, this.strict);\n }\n }),\n map(parameters => this.buildHttpOptions(this.operation, parameters as any)),\n ),\n });\n\n }\n\n protected override buildRequest(options: HttpDataSourceOptions): Observable<Response> {\n return this.http.request<Response>(this.buildHttpRequest(options)).pipe(\n retry(this.metadata.retry ?? 0),\n catchError((response: HttpErrorResponse) => {\n this.interceptors?.forEach(interceptor => interceptor\n .next({\n response,\n options,\n }),\n );\n return throwError(response);\n }),\n filter((event: any) => event.type === HttpEventType.Response),\n tap((response: HttpResponse<Response>) => {\n if (!this.disableValidation) {\n this.validateResponse(this.operation, response, this.strict);\n }\n }),\n tap((response: HttpResponse<Response>) => {\n this.interceptors?.forEach(interceptor => interceptor\n .next({\n response,\n options,\n }),\n );\n }),\n map((event: HttpResponse<Response>) => event.body),\n isDefined(),\n take(1),\n timeout(this.timeout),\n );\n }\n\n}\n","import { Injectable, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { OpenApiDataSource } from './open-api.data-source';\nimport { OpenApiConfigService } from '@rxap/open-api';\n\n@Injectable({ providedIn: 'root' })\nexport class OpenApiDataSourceLoader {\n readonly openApiConfig = inject<OpenApiConfigService>(OpenApiConfigService);\n readonly http = inject<HttpClient>(HttpClient);\n\n\n public load(definitionId: string): OpenApiDataSource | null {\n\n const operation = this.openApiConfig.getOperation(definitionId);\n\n if (operation) {\n return new OpenApiDataSource(\n this.http,\n this.openApiConfig,\n {\n id: definitionId,\n operation,\n },\n );\n }\n\n return null;\n }\n\n}\n"],"mappings":";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W,KAAA,gBAAgB,OAA6B,oBAAoB;EACjE,KAAA,OAAO,OAAmB,UAAU;CAqB9C;CAlBQ,KAAK,cAAoB;EAE9B,MAAM,YAAY,KAAK,cAAc,aAAa,YAAY;EAE9D,IAAI,WACF,OAAO,IAAI,kBACT,KAAK,MACL,KAAK,eACL;GACE,IAAI;GACJ;EACD,CAAA;EAIL,OAAO;CACT;CArBW;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAuB,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAvB;EAAA,KAAA,QAAA,GAAA,sBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAuB,YADV;EAAM,CAAA;CAAA;;AACnB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAuB,YAAA,CAAA;EADnC,MAAA;EAAW,MAAA,CAAA,EAAE,YAAY,OAAM,CAAE"}
|
|
1
|
+
{"version":3,"file":"rxap-open-api-data-source.mjs","names":[],"sources":["../../../../../packages/angular/open-api/data-source/src/lib/error.ts","../../../../../packages/angular/open-api/data-source/src/lib/open-api.data-source.ts","../../../../../packages/angular/open-api/data-source/src/lib/open-api-data-source.loader.ts"],"sourcesContent":["import { RxapOpenApiError } from '@rxap/open-api';\n\nexport class RxapOpenApiDataSourceError extends RxapOpenApiError {\n\n constructor(message: string, code?: string, scope?: string) {\n super(message, code, scope);\n this.addSubPackageName('data-source');\n }\n\n}\n","import { Inject, Injectable, Optional } from '@angular/core';\nimport {\n DEFAULT_OPEN_API_DATA_SOURCE_META_DATA,\n DISABLE_SCHEMA_VALIDATION,\n DISABLE_VALIDATION,\n OpenApiConfigService,\n OperationObjectWithMetadata,\n RXAP_OPEN_API_STRICT_VALIDATOR,\n SchemaValidationMixin,\n} from '@rxap/open-api';\nimport { HttpClient, HttpErrorResponse, HttpEventType, HttpResponse } from '@angular/common/http';\nimport {\n deepMerge,\n KeyValue,\n} from '@rxap/utilities';\nimport {\n BaseHttpDataSource,\n HttpDataSourceMetadata,\n HttpDataSourceOptions,\n HttpDataSourceViewer,\n} from '@rxap/data-source/http';\nimport {\n RXAP_DATA_SOURCE_REFRESH,\n RxapDataSource,\n} from '@rxap/data-source';\nimport {\n EMPTY,\n Observable,\n Subject,\n throwError,\n} from 'rxjs';\nimport {\n catchError,\n filter,\n map,\n retry,\n take,\n tap,\n timeout,\n} from 'rxjs/operators';\nimport { Mixin } from '@rxap/mixin';\nimport { isDefined } from '@rxap/rxjs';\n\nexport interface OpenApiDataSourceMetadata<PathParams = KeyValue, Body = any | null>\n extends Partial<HttpDataSourceMetadata<PathParams, Body>> {\n\n /**\n * The operation object with path and method\n */\n operation?: OperationObjectWithMetadata;\n\n /**\n * The index of the server object in the servers array in the open api config\n */\n serverIndex?: number;\n\n /**\n * The operation id\n */\n id: string;\n\n strict?: boolean;\n\n}\n\nexport interface OpenApiDataSourceViewer<Parameters = any>\n extends HttpDataSourceViewer<any, any> {\n parameters?: Parameters;\n}\n\nexport function RxapOpenApiDataSource(operationIdOrMetadata: string | OpenApiDataSourceMetadata, serverIndex = 0) {\n const metadata = typeof operationIdOrMetadata === 'string' ?\n {\n id: operationIdOrMetadata,\n serverIndex,\n } :\n operationIdOrMetadata;\n return function (target: any) {\n RxapDataSource(metadata)(target);\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface OpenApiDataSource<Response = any, Parameters extends Record<string, any> | void = any>\n extends SchemaValidationMixin<Response, Parameters> {}\n\n@Mixin(SchemaValidationMixin)\n@Injectable()\nexport class OpenApiDataSource<Response = any, Parameters extends Record<string, any> | void = any>\n extends BaseHttpDataSource<Response> {\n protected readonly strict: boolean = false;\n protected readonly disableSchemaValidation: boolean = false;\n protected readonly disableValidation: boolean = false;\n\n constructor(\n @Inject(HttpClient)\n http: HttpClient,\n @Inject(OpenApiConfigService)\n private readonly openApiConfigService: OpenApiConfigService,\n @Optional()\n @Inject(DEFAULT_OPEN_API_DATA_SOURCE_META_DATA)\n metadata: OpenApiDataSourceMetadata | null = null,\n @Optional()\n @Inject(RXAP_DATA_SOURCE_REFRESH)\n refresh$: Subject<HttpDataSourceOptions> | null = null,\n @Optional()\n @Inject(RXAP_OPEN_API_STRICT_VALIDATOR)\n strict: boolean | null = null,\n @Optional()\n @Inject(DISABLE_SCHEMA_VALIDATION)\n disableSchemaValidation: boolean | null = null,\n @Optional()\n @Inject(DISABLE_VALIDATION)\n disableValidation: boolean | null = null,\n ) {\n super(http, metadata as any, refresh$);\n\n let operation: OperationObjectWithMetadata;\n if (!this.metadata['operation']) {\n this.metadata['operation'] = operation = openApiConfigService.getOperation(this.metadata.id);\n } else {\n operation = this.metadata['operation'];\n }\n\n if (operation.method !== 'GET') {\n throw new Error('OpenApi DataSource only supports GET Operations!');\n }\n\n this.applyMetadata({\n id: operation.operationId,\n url: () => openApiConfigService.getBaseUrl(this.metadata['serverIndex']) + operation.path,\n method: 'GET',\n });\n\n this.strict = strict || this.metadata['strict'] || false;\n this.disableSchemaValidation = disableSchemaValidation || this.metadata['disableSchemaValidation'] || false;\n this.disableValidation = disableValidation || this.metadata['disableValidation'] || false;\n\n }\n\n public get operation(): OperationObjectWithMetadata {\n return this.metadata['operation'];\n }\n\n public override derive<D = Response>(\n id: string,\n metadata: Partial<OpenApiDataSourceMetadata> = this.metadata,\n isolated = false,\n ): OpenApiDataSource<D, Parameters> {\n return new OpenApiDataSource<D, Parameters>(\n this.http,\n this.openApiConfigService,\n {\n ...deepMerge(this.metadata, metadata),\n id,\n },\n isolated ? null : this.refresh$,\n );\n }\n\n public override connect(viewer: OpenApiDataSourceViewer<Parameters>): Observable<Response> {\n\n\n if (viewer.parameters) {\n if (!this.disableValidation) {\n this.validateParameters(this.operation, viewer.parameters as any, this.strict);\n }\n } else {\n if (viewer.viewChange === EMPTY || viewer.viewChange === undefined) {\n // set the viewer parameters to an empty parameter and test if that\n // is valid.\n viewer.parameters = {} as any;\n if (!this.disableValidation) {\n this.validateParameters(this.operation, viewer.parameters as any, this.strict);\n }\n }\n }\n\n return super.connect({\n ...viewer,\n ...this.buildHttpOptions(this.operation, viewer.parameters),\n // if the view change is an empty observable. Then dont apply the pipe logic\n // else the http request is never triggered\n viewChange: viewer.viewChange === EMPTY ? viewer.viewChange : viewer.viewChange?.pipe(\n tap(parameters => {\n if (!this.disableValidation) {\n this.validateParameters(this.operation, parameters as any, this.strict);\n }\n }),\n map(parameters => this.buildHttpOptions(this.operation, parameters as any)),\n ),\n });\n\n }\n\n protected override buildRequest(options: HttpDataSourceOptions): Observable<Response> {\n return this.http.request<Response>(this.buildHttpRequest(options)).pipe(\n retry(this.metadata.retry ?? 0),\n catchError((response: HttpErrorResponse) => {\n this.interceptors?.forEach(interceptor => interceptor\n .next({\n response,\n options,\n }),\n );\n return throwError(response);\n }),\n filter((event: any) => event.type === HttpEventType.Response),\n tap((response: HttpResponse<Response>) => {\n if (!this.disableValidation) {\n this.validateResponse(this.operation, response, this.strict);\n }\n }),\n tap((response: HttpResponse<Response>) => {\n this.interceptors?.forEach(interceptor => interceptor\n .next({\n response,\n options,\n }),\n );\n }),\n map((event: HttpResponse<Response>) => event.body),\n isDefined(),\n take(1),\n timeout(this.timeout),\n );\n }\n\n}\n","import { Injectable, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { OpenApiDataSource } from './open-api.data-source';\nimport { OpenApiConfigService } from '@rxap/open-api';\n\n@Injectable({ providedIn: 'root' })\nexport class OpenApiDataSourceLoader {\n readonly openApiConfig = inject<OpenApiConfigService>(OpenApiConfigService);\n readonly http = inject<HttpClient>(HttpClient);\n\n\n public load(definitionId: string): OpenApiDataSource | null {\n\n const operation = this.openApiConfig.getOperation(definitionId);\n\n if (operation) {\n return new OpenApiDataSource(\n this.http,\n this.openApiConfig,\n {\n id: definitionId,\n operation,\n },\n );\n }\n\n return null;\n }\n\n}\n"],"mappings":";;;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AA;EAEW,KAAA,gBAAgB,OAA6B,oBAAoB;EACjE,KAAA,OAAO,OAAmB,UAAU;CAqB9C;CAlBQ,KAAK,cAAoB;EAE9B,MAAM,YAAY,KAAK,cAAc,aAAa,YAAY;EAE9D,IAAI,WACF,OAAO,IAAI,kBACT,KAAK,MACL,KAAK,eACL;GACE,IAAI;GACJ;EACD,CAAA;EAIL,OAAO;CACT;CArBW;EAAA,KAAA,OAAA,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAuB,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAvB;EAAA,KAAA,QAAA,GAAA,sBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAuB,YADV;EAAM,CAAA;CAAA;;AACnB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAuB,YAAA,CAAA;EADnC,MAAA;EAAW,MAAA,CAAA,EAAE,YAAY,OAAM,CAAE"}
|
|
@@ -106,8 +106,12 @@ let OpenApiRemoteMethod = class OpenApiRemoteMethod extends BaseHttpRemoteMethod
|
|
|
106
106
|
async callWithResponse(args = {}) {
|
|
107
107
|
this.init();
|
|
108
108
|
this.executionsInProgress$.increase();
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
let result;
|
|
110
|
+
try {
|
|
111
|
+
result = await this._callWithResponse(args);
|
|
112
|
+
} finally {
|
|
113
|
+
this.executionsInProgress$.decrease();
|
|
114
|
+
}
|
|
111
115
|
if (result.body) {
|
|
112
116
|
this.executed$.next(result.body);
|
|
113
117
|
this.executed(result.body);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rxap-open-api-remote-method.mjs","names":[],"sources":["../../../../../packages/angular/open-api/remote-method/src/lib/error.ts","../../../../../packages/angular/open-api/remote-method/src/lib/get-page-adapter.factory.ts","../../../../../packages/angular/open-api/remote-method/src/lib/open-api.remote-method.ts","../../../../../packages/angular/open-api/remote-method/src/lib/open-api-remote-method.loader.ts"],"sourcesContent":["import { RxapOpenApiError } from '@rxap/open-api';\n\nexport class RxapOpenApiRemoteMethodError extends RxapOpenApiError {\n\n constructor(message: string, code?: string, scope?: string) {\n super(message, code, scope);\n this.addSubPackageName('remote-method');\n }\n\n}\n","import { BaseRemoteMethod } from '@rxap/remote-method';\nimport { TableEvent } from '@rxap/data-source/table';\nimport { coerceString } from '@rxap/utilities';\nimport type { OpenApiRemoteMethod } from './open-api.remote-method';\nimport { PaginatorLike } from '@rxap/data-source/pagination';\n\nexport interface GetPageRemoteMethodParameters {\n pageIndex: number;\n pageSize: number;\n sortBy?: string;\n sortDirection?: 'desc' | 'asc' | undefined | '' | string;\n filter: string[];\n}\n\nexport interface GetPageResponse<Data extends Record<string, any>> {\n total: number;\n rows: Data[];\n [key: string]: any;\n}\n\nexport interface GetPageAdapterDefaultOptions {\n sortBy?: string;\n sortDirection?: 'asc' | 'desc' | string;\n}\n\nexport class GetPageAdapterRemoteMethod<Data extends Record<string, any>>\n extends BaseRemoteMethod<Data[], TableEvent> {\n\n constructor(\n private readonly remoteMethod: OpenApiRemoteMethod<GetPageResponse<Data>, GetPageRemoteMethodParameters>,\n private readonly paginator?: PaginatorLike,\n private readonly options?: GetPageAdapterDefaultOptions,\n ) {\n super(null, remoteMethod.metadata);\n }\n\n public static BuildFilter(filterEvent?: string | Record<string, any> | null): string[] {\n const filter: string[] = [];\n if (filterEvent && typeof filterEvent !== 'string') {\n for (const [ key, value ] of Object.entries(filterEvent)) {\n if (value !== null && value !== undefined && `${ value }` !== '') {\n const valueString = coerceString(value);\n if (valueString) {\n filter.push([ key, valueString ].join('|'));\n }\n }\n }\n }\n return filter;\n }\n\n protected async _call(event: TableEvent): Promise<Data[]> {\n const parameters: GetPageRemoteMethodParameters = {\n pageIndex: event.page?.pageIndex ?? 0,\n pageSize: event.page?.pageSize ?? 10,\n sortBy: event.sort?.active ?? this.options?.sortBy ?? undefined,\n // use the || operator to set the default sort direction if the sort direction is undefined or an empty string\n sortDirection: event.sort?.direction ?? this.options?.sortDirection ?? undefined,\n filter: GetPageAdapterRemoteMethod.BuildFilter(event.filter),\n ...(event.parameters ?? {}),\n };\n const response = await this.remoteMethod.call({ parameters });\n\n if (event.setTotalLength) {\n event.setTotalLength(response.total);\n }\n\n if (this.paginator) {\n this.paginator.length = response.total;\n }\n\n return response.rows;\n }\n\n}\n\nexport function GetPageAdapterFactory(remoteMethod: OpenApiRemoteMethod, paginator?: PaginatorLike) {\n return new GetPageAdapterRemoteMethod(remoteMethod, paginator);\n}\n\nexport function GetPageAdapterFactoryWithOptions(options: GetPageAdapterDefaultOptions = {}) {\n return (remoteMethod: OpenApiRemoteMethod, paginator?: PaginatorLike) => {\n return new GetPageAdapterRemoteMethod(remoteMethod, paginator, options);\n };\n}\n","import {\n HttpClient,\n HttpContext,\n HttpErrorResponse,\n HttpEventType,\n HttpResponse,\n} from '@angular/common/http';\nimport { Inject, Injectable, Injector, isDevMode, Optional } from '@angular/core';\nimport { Mixin } from '@rxap/mixin';\nimport {\n DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA,\n DISABLE_SCHEMA_VALIDATION,\n DISABLE_VALIDATION,\n OPEN_API_SERVER_INDEX,\n OpenApiConfigService,\n OpenApiHttpResponseError,\n OpenApiMetaData,\n OperationObjectWithMetadata,\n RXAP_OPEN_API_STRICT_VALIDATOR,\n SchemaValidationMixin,\n} from '@rxap/open-api';\nimport {\n OPEN_API_OPERATION_ID,\n OPEN_API_SERVER_ID,\n} from '@rxap/open-api';\nimport { RxapRemoteMethod } from '@rxap/remote-method';\nimport { BaseHttpRemoteMethod } from '@rxap/remote-method/http';\nimport { firstValueFrom } from 'rxjs';\nimport {\n filter,\n retry,\n take,\n tap,\n timeout,\n} from 'rxjs/operators';\n\nexport interface OperationForMetadata {\n operation: OperationObjectWithMetadata;\n /**\n * used to specify the target server for the reset api operation\n */\n serverId?: string;\n /**\n * the fallback id used if the operation does not have a operationId\n */\n fallbackId?: string;\n}\n\nexport interface OperationFromMetadataInline {\n operationId: string;\n operation: string;\n /**\n * used to specify the target server for the reset api operation\n */\n serverId?: string;\n}\n\nexport function IsOperationFromMetadataInline(metadata: OperationForMetadata | OperationFromMetadataInline): metadata is OperationFromMetadataInline {\n return typeof metadata.operation === 'string';\n}\n\nexport function RxapOpenApiRemoteMethod(\n operationOrId: string | OperationForMetadata | OperationFromMetadataInline,\n serverIndex = 0,\n) {\n return function (target: any) {\n const id = typeof operationOrId === 'string' ?\n operationOrId :\n (IsOperationFromMetadataInline(operationOrId) ?\n operationOrId.operationId :\n operationOrId.operation.operationId ?? operationOrId.fallbackId);\n if (!id) {\n throw new Error('The operationId for the open api remote method is not defined');\n }\n const metadata: OpenApiRemoteMethodMetadata = {\n id,\n serverIndex,\n };\n if (typeof operationOrId !== 'string') {\n metadata.operation = operationOrId.operation;\n metadata.serverId = operationOrId.serverId;\n }\n RxapRemoteMethod(metadata)(target);\n };\n}\n\nexport type OpenApiRemoteMethodMetadata = OpenApiMetaData\n\nexport interface OpenApiRemoteMethodParameter<Parameters extends Record<string, any> | void = any, RequestBody = any> {\n parameters?: Parameters,\n requestBody?: RequestBody\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface OpenApiRemoteMethod<Response = any, Parameters extends Record<string, any> | void = any, RequestBody = any>\n extends SchemaValidationMixin<Response, Parameters, RequestBody> {\n}\n\n@Mixin(SchemaValidationMixin)\n@Injectable()\nexport class OpenApiRemoteMethod<Response = any, Parameters extends Record<string, any> | void = any, RequestBody = any>\n extends BaseHttpRemoteMethod<Response, any, OpenApiRemoteMethodParameter<Parameters, RequestBody>> {\n\n protected readonly disableSchemaValidation: boolean = false;\n protected readonly disableValidation: boolean = false;\n private readonly strict: boolean = false;\n\n constructor(\n @Inject(HttpClient) http: HttpClient,\n @Inject(Injector) injector: Injector,\n @Inject(OpenApiConfigService) openApiConfigService: OpenApiConfigService,\n @Optional()\n @Inject(DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA)\n metadata: OpenApiRemoteMethodMetadata | null = null,\n @Optional()\n @Inject(RXAP_OPEN_API_STRICT_VALIDATOR)\n strict: boolean | null = null,\n @Optional()\n @Inject(DISABLE_SCHEMA_VALIDATION)\n disableSchemaValidation: boolean | null = null,\n @Optional()\n @Inject(DISABLE_VALIDATION)\n disableValidation: boolean | null = null,\n ) {\n super(http, injector, metadata);\n this.metadata['operation'] ??= openApiConfigService.getOperation(this.metadata.id);\n if (typeof this.metadata['operation'] === 'string') {\n try {\n this.metadata['operation'] = JSON.parse(this.metadata['operation']);\n } catch (e: any) {\n throw new Error(`could not parse the remote method operation string into an object: ${ this.constructor.name }`);\n }\n }\n const operation: OperationObjectWithMetadata & { serverId?: string } = this.metadata['operation'];\n this.applyMetadata({\n id: operation.operationId,\n url: () => openApiConfigService.getBaseUrl(this.metadata['serverIndex'], this.metadata['serverId']) +\n operation.path,\n method: operation.method as any,\n withCredentials: this.metadata.withCredentials ?? true,\n ignoreUndefined: this.metadata['ignoreUndefined'] ?? true,\n context: new HttpContext()\n .set(OPEN_API_OPERATION_ID, operation.operationId)\n .set(OPEN_API_SERVER_ID, this.metadata['serverId'])\n .set(OPEN_API_SERVER_INDEX, this.metadata['serverIndex'])\n });\n this.strict = strict || this.metadata['strict'] || false;\n this.disableSchemaValidation = disableSchemaValidation || this.metadata['disableSchemaValidation'] || false;\n this.disableValidation = disableValidation || this.metadata['disableValidation'] || false;\n }\n\n public get operation(): OperationObjectWithMetadata {\n return this.metadata['operation'];\n }\n\n /**\n * Instead of returning the response body the full response object is returned\n */\n public async callWithResponse(args: OpenApiRemoteMethodParameter<Parameters, RequestBody> = {}): Promise<HttpResponse<Response>> {\n this.init();\n this.executionsInProgress$.increase();\n const result = await this._callWithResponse(args);\n this.executionsInProgress$.decrease();\n if (result.body) {\n this.executed$.next(result.body);\n this.executed(result.body);\n }\n return result;\n }\n\n // TODO : update to the new call method concept (the remove of the _call method concept)\n public _callWithResponse(args: OpenApiRemoteMethodParameter<Parameters, RequestBody> = {}): Promise<HttpResponse<Response>> {\n\n if (!this.disableValidation) {\n this.validateParameters(this.operation, args.parameters, this.strict);\n this.validateRequestBody(this.operation, args.requestBody, this.strict);\n }\n\n return firstValueFrom(this.http.request<Response>(this.updateRequest(this.buildHttpOptions(\n this.operation,\n args.parameters,\n args.requestBody,\n this.metadata['ignoreUndefined'],\n ))).pipe(\n retry(this.metadata.retry ?? 0),\n tap({\n error: (error) => {\n if (error instanceof HttpErrorResponse) {\n this.interceptors?.forEach(interceptor => interceptor\n .next({\n response: error,\n parameters: args.parameters,\n requestBody: args.requestBody,\n }),\n );\n }\n },\n }),\n filter((event: any) => event.type === HttpEventType.Response),\n tap((response: HttpResponse<Response>) => {\n if (!this.disableValidation) {\n this.validateResponse(this.operation, response, this.strict);\n }\n }),\n tap((response: HttpResponse<Response>) => {\n this.interceptors?.forEach(interceptor => interceptor\n .next({\n response,\n parameters: args.parameters,\n requestBody: args.requestBody,\n }),\n );\n }),\n take(1),\n timeout(this.timeout),\n ));\n\n }\n\n protected async _call(args: OpenApiRemoteMethodParameter<Parameters, RequestBody> = {}): Promise<Response> {\n\n if (!this.disableValidation) {\n this.validateParameters(this.operation, args.parameters, this.strict);\n this.validateRequestBody(this.operation, args.requestBody, this.strict);\n }\n\n let response: HttpResponse<Response>;\n\n try {\n response = await this._callWithResponse(args);\n } catch (error: any) {\n if (error instanceof HttpErrorResponse) {\n throw new OpenApiHttpResponseError(\n error,\n this.metadata,\n );\n } else {\n throw error;\n }\n }\n\n if (response.body) {\n return response.body;\n }\n\n if (isDevMode()) {\n console.warn('The response body is empty!');\n }\n return null as any;\n }\n\n}\n","import { Injectable, Injector, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { OpenApiRemoteMethod } from './open-api.remote-method';\nimport { OpenApiConfigService } from '@rxap/open-api';\n\n@Injectable({ providedIn: 'root' })\nexport class OpenApiRemoteMethodLoader {\n readonly openApiConfig = inject<OpenApiConfigService>(OpenApiConfigService);\n readonly http = inject<HttpClient>(HttpClient);\n readonly injector = inject(Injector);\n\n\n public load(definitionId: string): OpenApiRemoteMethod | null {\n const operation = this.openApiConfig.getOperation(definitionId);\n\n if (operation) {\n\n return new OpenApiRemoteMethod(\n this.http,\n this.injector,\n this.openApiConfig,\n {\n id: definitionId,\n operation,\n },\n );\n\n }\n\n return null;\n\n }\n\n}\n"],"mappings":";;;;;;;;;;;;;AAEA,IAAa,+BAAb,cAAkD,iBAAgB;CAEhE,YAAY,SAAiB,MAAe,OAAc;EACxD,MAAM,SAAS,MAAM,KAAK;EAC1B,KAAK,kBAAkB,eAAe;CACxC;AAED;ACgBD,IAAa,6BAAb,MAAa,mCACH,iBAAoC;CAE5C,YACmB,cACA,WACA,SAAsC;EAEvD,MAAM,MAAM,aAAa,QAAQ;EAJhB,KAAA,eAAA;EACA,KAAA,YAAA;EACA,KAAA,UAAA;CAGnB;CAEO,OAAO,YAAY,aAAiD;EACzE,MAAM,SAAmB,CAAA;EACzB,IAAI,eAAe,OAAO,gBAAgB,UACxC;QAAK,MAAM,CAAE,KAAK,UAAW,OAAO,QAAQ,WAAW,GACrD,IAAI,UAAU,QAAQ,UAAU,UAAa,GAAI,YAAa,IAAI;IAChE,MAAM,cAAc,aAAa,KAAK;IACtC,IAAI,aACF,OAAO,KAAK,CAAE,KAAK,WAAW,CAAE,CAAC,KAAK,GAAG,CAAC;GAE9C;EACF;EAEF,OAAO;CACT;CAEU,MAAM,MAAM,OAAiB;EACrC,MAAM,aAA4C;GAChD,WAAW,MAAM,MAAM,aAAa;GACpC,UAAU,MAAM,MAAM,YAAY;GAClC,QAAQ,MAAM,MAAM,UAAU,KAAK,SAAS,UAAU;GAEtD,eAAe,MAAM,MAAM,aAAa,KAAK,SAAS,iBAAiB;GACvE,QAAQ,2BAA2B,YAAY,MAAM,MAAM;GAC3D,GAAI,MAAM,cAAc,CAAA;EACzB;EACD,MAAM,WAAW,MAAM,KAAK,a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,GAAA,mBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAyB,MAAA,CAAA;GAAA,QAAA,GAAA,gBAAA;EAAA,CAAA;CAAA;CAAzB;EAAA,KAAA,QAAA,GAAA,sBAAA;GAAA,YAAA;GAAA,SAAA;GAAA,UAAA;GAAA,MAAA;GAAyB,YADZ;EAAM,CAAA;CAAA;;AACnB,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAyB,YAAA,CAAA;EADrC,MAAA;EAAW,MAAA,CAAA,EAAE,YAAY,OAAM,CAAE"}
|
|
1
|
+
{"version":3,"file":"rxap-open-api-remote-method.mjs","names":[],"sources":["../../../../../packages/angular/open-api/remote-method/src/lib/error.ts","../../../../../packages/angular/open-api/remote-method/src/lib/get-page-adapter.factory.ts","../../../../../packages/angular/open-api/remote-method/src/lib/open-api.remote-method.ts","../../../../../packages/angular/open-api/remote-method/src/lib/open-api-remote-method.loader.ts"],"sourcesContent":["import { RxapOpenApiError } from '@rxap/open-api';\n\nexport class RxapOpenApiRemoteMethodError extends RxapOpenApiError {\n\n constructor(message: string, code?: string, scope?: string) {\n super(message, code, scope);\n this.addSubPackageName('remote-method');\n }\n\n}\n","import { BaseRemoteMethod } from '@rxap/remote-method';\nimport { TableEvent } from '@rxap/data-source/table';\nimport { coerceString } from '@rxap/utilities';\nimport type { OpenApiRemoteMethod } from './open-api.remote-method';\nimport { PaginatorLike } from '@rxap/data-source/pagination';\n\nexport interface GetPageRemoteMethodParameters {\n pageIndex: number;\n pageSize: number;\n sortBy?: string;\n sortDirection?: 'desc' | 'asc' | undefined | '' | string;\n filter: string[];\n}\n\nexport interface GetPageResponse<Data extends Record<string, any>> {\n total: number;\n rows: Data[];\n [key: string]: any;\n}\n\nexport interface GetPageAdapterDefaultOptions {\n sortBy?: string;\n sortDirection?: 'asc' | 'desc' | string;\n}\n\nexport class GetPageAdapterRemoteMethod<Data extends Record<string, any>>\n extends BaseRemoteMethod<Data[], TableEvent> {\n\n constructor(\n private readonly remoteMethod: OpenApiRemoteMethod<GetPageResponse<Data>, GetPageRemoteMethodParameters>,\n private readonly paginator?: PaginatorLike,\n private readonly options?: GetPageAdapterDefaultOptions,\n ) {\n super(null, remoteMethod.metadata);\n }\n\n public static BuildFilter(filterEvent?: string | Record<string, any> | null): string[] {\n const filter: string[] = [];\n if (filterEvent && typeof filterEvent !== 'string') {\n for (const [ key, value ] of Object.entries(filterEvent)) {\n if (value !== null && value !== undefined && `${ value }` !== '') {\n const valueString = coerceString(value);\n if (valueString) {\n filter.push([ key, valueString ].join('|'));\n }\n }\n }\n }\n return filter;\n }\n\n protected async _call(event: TableEvent): Promise<Data[]> {\n const parameters: GetPageRemoteMethodParameters = {\n pageIndex: event.page?.pageIndex ?? 0,\n pageSize: event.page?.pageSize ?? 10,\n sortBy: event.sort?.active ?? this.options?.sortBy ?? undefined,\n // use the || operator to set the default sort direction if the sort direction is undefined or an empty string\n sortDirection: event.sort?.direction ?? this.options?.sortDirection ?? undefined,\n filter: GetPageAdapterRemoteMethod.BuildFilter(event.filter),\n ...(event.parameters ?? {}),\n };\n const response = await this.remoteMethod.call({ parameters });\n\n if (event.setTotalLength) {\n event.setTotalLength(response.total);\n }\n\n if (this.paginator) {\n this.paginator.length = response.total;\n }\n\n return response.rows;\n }\n\n}\n\nexport function GetPageAdapterFactory(remoteMethod: OpenApiRemoteMethod, paginator?: PaginatorLike) {\n return new GetPageAdapterRemoteMethod(remoteMethod, paginator);\n}\n\nexport function GetPageAdapterFactoryWithOptions(options: GetPageAdapterDefaultOptions = {}) {\n return (remoteMethod: OpenApiRemoteMethod, paginator?: PaginatorLike) => {\n return new GetPageAdapterRemoteMethod(remoteMethod, paginator, options);\n };\n}\n","import {\n HttpClient,\n HttpContext,\n HttpErrorResponse,\n HttpEventType,\n HttpResponse,\n} from '@angular/common/http';\nimport { Inject, Injectable, Injector, isDevMode, Optional } from '@angular/core';\nimport { Mixin } from '@rxap/mixin';\nimport {\n DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA,\n DISABLE_SCHEMA_VALIDATION,\n DISABLE_VALIDATION,\n OPEN_API_SERVER_INDEX,\n OpenApiConfigService,\n OpenApiHttpResponseError,\n OpenApiMetaData,\n OperationObjectWithMetadata,\n RXAP_OPEN_API_STRICT_VALIDATOR,\n SchemaValidationMixin,\n} from '@rxap/open-api';\nimport {\n OPEN_API_OPERATION_ID,\n OPEN_API_SERVER_ID,\n} from '@rxap/open-api';\nimport { RxapRemoteMethod } from '@rxap/remote-method';\nimport { BaseHttpRemoteMethod } from '@rxap/remote-method/http';\nimport { firstValueFrom } from 'rxjs';\nimport {\n filter,\n retry,\n take,\n tap,\n timeout,\n} from 'rxjs/operators';\n\nexport interface OperationForMetadata {\n operation: OperationObjectWithMetadata;\n /**\n * used to specify the target server for the reset api operation\n */\n serverId?: string;\n /**\n * the fallback id used if the operation does not have a operationId\n */\n fallbackId?: string;\n}\n\nexport interface OperationFromMetadataInline {\n operationId: string;\n operation: string;\n /**\n * used to specify the target server for the reset api operation\n */\n serverId?: string;\n}\n\nexport function IsOperationFromMetadataInline(metadata: OperationForMetadata | OperationFromMetadataInline): metadata is OperationFromMetadataInline {\n return typeof metadata.operation === 'string';\n}\n\nexport function RxapOpenApiRemoteMethod(\n operationOrId: string | OperationForMetadata | OperationFromMetadataInline,\n serverIndex = 0,\n) {\n return function (target: any) {\n const id = typeof operationOrId === 'string' ?\n operationOrId :\n (IsOperationFromMetadataInline(operationOrId) ?\n operationOrId.operationId :\n operationOrId.operation.operationId ?? operationOrId.fallbackId);\n if (!id) {\n throw new Error('The operationId for the open api remote method is not defined');\n }\n const metadata: OpenApiRemoteMethodMetadata = {\n id,\n serverIndex,\n };\n if (typeof operationOrId !== 'string') {\n metadata.operation = operationOrId.operation;\n metadata.serverId = operationOrId.serverId;\n }\n RxapRemoteMethod(metadata)(target);\n };\n}\n\nexport type OpenApiRemoteMethodMetadata = OpenApiMetaData\n\nexport interface OpenApiRemoteMethodParameter<Parameters extends Record<string, any> | void = any, RequestBody = any> {\n parameters?: Parameters,\n requestBody?: RequestBody\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface OpenApiRemoteMethod<Response = any, Parameters extends Record<string, any> | void = any, RequestBody = any>\n extends SchemaValidationMixin<Response, Parameters, RequestBody> {\n}\n\n@Mixin(SchemaValidationMixin)\n@Injectable()\nexport class OpenApiRemoteMethod<Response = any, Parameters extends Record<string, any> | void = any, RequestBody = any>\n extends BaseHttpRemoteMethod<Response, any, OpenApiRemoteMethodParameter<Parameters, RequestBody>> {\n\n protected readonly disableSchemaValidation: boolean = false;\n protected readonly disableValidation: boolean = false;\n private readonly strict: boolean = false;\n\n constructor(\n @Inject(HttpClient) http: HttpClient,\n @Inject(Injector) injector: Injector,\n @Inject(OpenApiConfigService) openApiConfigService: OpenApiConfigService,\n @Optional()\n @Inject(DEFAULT_OPEN_API_REMOTE_METHOD_META_DATA)\n metadata: OpenApiRemoteMethodMetadata | null = null,\n @Optional()\n @Inject(RXAP_OPEN_API_STRICT_VALIDATOR)\n strict: boolean | null = null,\n @Optional()\n @Inject(DISABLE_SCHEMA_VALIDATION)\n disableSchemaValidation: boolean | null = null,\n @Optional()\n @Inject(DISABLE_VALIDATION)\n disableValidation: boolean | null = null,\n ) {\n super(http, injector, metadata);\n this.metadata['operation'] ??= openApiConfigService.getOperation(this.metadata.id);\n if (typeof this.metadata['operation'] === 'string') {\n try {\n this.metadata['operation'] = JSON.parse(this.metadata['operation']);\n } catch (e: any) {\n throw new Error(`could not parse the remote method operation string into an object: ${ this.constructor.name }`);\n }\n }\n const operation: OperationObjectWithMetadata & { serverId?: string } = this.metadata['operation'];\n this.applyMetadata({\n id: operation.operationId,\n url: () => openApiConfigService.getBaseUrl(this.metadata['serverIndex'], this.metadata['serverId']) +\n operation.path,\n method: operation.method as any,\n withCredentials: this.metadata.withCredentials ?? true,\n ignoreUndefined: this.metadata['ignoreUndefined'] ?? true,\n context: new HttpContext()\n .set(OPEN_API_OPERATION_ID, operation.operationId)\n .set(OPEN_API_SERVER_ID, this.metadata['serverId'])\n .set(OPEN_API_SERVER_INDEX, this.metadata['serverIndex'])\n });\n this.strict = strict || this.metadata['strict'] || false;\n this.disableSchemaValidation = disableSchemaValidation || this.metadata['disableSchemaValidation'] || false;\n this.disableValidation = disableValidation || this.metadata['disableValidation'] || false;\n }\n\n public get operation(): OperationObjectWithMetadata {\n return this.metadata['operation'];\n }\n\n /**\n * Instead of returning the response body the full response object is returned\n */\n public async callWithResponse(args: OpenApiRemoteMethodParameter<Parameters, RequestBody> = {}): Promise<HttpResponse<Response>> {\n this.init();\n this.executionsInProgress$.increase();\n let result: HttpResponse<Response>;\n try {\n result = await this._callWithResponse(args);\n } finally {\n this.executionsInProgress$.decrease();\n }\n if (result.body) {\n this.executed$.next(result.body);\n this.executed(result.body);\n }\n return result;\n }\n\n // TODO : update to the new call method concept (the remove of the _call method concept)\n public _callWithResponse(args: OpenApiRemoteMethodParameter<Parameters, RequestBody> = {}): Promise<HttpResponse<Response>> {\n\n if (!this.disableValidation) {\n this.validateParameters(this.operation, args.parameters, this.strict);\n this.validateRequestBody(this.operation, args.requestBody, this.strict);\n }\n\n return firstValueFrom(this.http.request<Response>(this.updateRequest(this.buildHttpOptions(\n this.operation,\n args.parameters,\n args.requestBody,\n this.metadata['ignoreUndefined'],\n ))).pipe(\n retry(this.metadata.retry ?? 0),\n tap({\n error: (error) => {\n if (error instanceof HttpErrorResponse) {\n this.interceptors?.forEach(interceptor => interceptor\n .next({\n response: error,\n parameters: args.parameters,\n requestBody: args.requestBody,\n }),\n );\n }\n },\n }),\n filter((event: any) => event.type === HttpEventType.Response),\n tap((response: HttpResponse<Response>) => {\n if (!this.disableValidation) {\n this.validateResponse(this.operation, response, this.strict);\n }\n }),\n tap((response: HttpResponse<Response>) => {\n this.interceptors?.forEach(interceptor => interceptor\n .next({\n response,\n parameters: args.parameters,\n requestBody: args.requestBody,\n }),\n );\n }),\n take(1),\n timeout(this.timeout),\n ));\n\n }\n\n protected async _call(args: OpenApiRemoteMethodParameter<Parameters, RequestBody> = {}): Promise<Response> {\n\n if (!this.disableValidation) {\n this.validateParameters(this.operation, args.parameters, this.strict);\n this.validateRequestBody(this.operation, args.requestBody, this.strict);\n }\n\n let response: HttpResponse<Response>;\n\n try {\n response = await this._callWithResponse(args);\n } catch (error: any) {\n if (error instanceof HttpErrorResponse) {\n throw new OpenApiHttpResponseError(\n error,\n this.metadata,\n );\n } else {\n throw error;\n }\n }\n\n if (response.body) {\n return response.body;\n }\n\n if (isDevMode()) {\n console.warn('The response body is empty!');\n }\n return null as any;\n }\n\n}\n","import { Injectable, Injector, inject } from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { OpenApiRemoteMethod } from './open-api.remote-method';\nimport { OpenApiConfigService } from '@rxap/open-api';\n\n@Injectable({ providedIn: 'root' })\nexport class OpenApiRemoteMethodLoader {\n readonly openApiConfig = inject<OpenApiConfigService>(OpenApiConfigService);\n readonly http = inject<HttpClient>(HttpClient);\n readonly injector = inject(Injector);\n\n\n public load(definitionId: string): OpenApiRemoteMethod | null {\n const operation = this.openApiConfig.getOperation(definitionId);\n\n if (operation) {\n\n return new OpenApiRemoteMethod(\n this.http,\n this.injector,\n this.openApiConfig,\n {\n id: definitionId,\n operation,\n },\n );\n\n }\n\n return null;\n\n }\n\n}\n"],"mappings":";;;;;;;;;;;;;AAEA,IAAa,+BAAb,cAAkD,iBAAgB;CAEhE,YAAY,SAAiB,MAAe,OAAc;EACxD,MAAM,SAAS,MAAM,KAAK;EAC1B,KAAK,kBAAkB,eAAe;CACxC;AAED;ACgBD,IAAa,6BAAb,MAAa,mCACH,iBAAoC;CAE5C,YACmB,cACA,WACA,SAAsC;EAEvD,MAAM,MAAM,aAAa,QAAQ;EAJhB,KAAA,eAAA;EACA,KAAA,YAAA;EACA,KAAA,UAAA;CAGnB;CAEO,OAAO,YAAY,aAAiD;EACzE,MAAM,SAAmB,CA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