@jeraldj/client-services 8.1.4

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 (161) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +330 -0
  3. package/__test__/setup.d.ts +2 -0
  4. package/blocs/group-addable/cs-group-addable-bloc.d.ts +20 -0
  5. package/blocs/index.d.ts +1 -0
  6. package/blocs/index.js +2 -0
  7. package/blocs/index.js.LICENSE.txt +14 -0
  8. package/core/cs-client-storage.d.ts +5 -0
  9. package/core/cs-error.d.ts +5 -0
  10. package/core/http-service/errors/cs-http-client-error.d.ts +8 -0
  11. package/core/http-service/errors/cs-http-server-error.d.ts +8 -0
  12. package/core/http-service/errors/cs-network-error.d.ts +6 -0
  13. package/core/http-service/errors/cs-request-builder-error.d.ts +4 -0
  14. package/core/http-service/errors/index.d.ts +5 -0
  15. package/core/http-service/implementation/http-client-adapters/http-client-browser-adapter.d.ts +20 -0
  16. package/core/http-service/implementation/http-client-adapters/http-client-cordova-adapter.d.ts +21 -0
  17. package/core/http-service/implementation/http-client-adapters/http-client.d.ts +14 -0
  18. package/core/http-service/implementation/http-service-impl.d.ts +36 -0
  19. package/core/http-service/implementation/interceptors/bearer-token-inject-request-interceptor.d.ts +8 -0
  20. package/core/http-service/implementation/interceptors/user-token-inject-request-interceptor.d.ts +8 -0
  21. package/core/http-service/index.d.ts +2 -0
  22. package/core/http-service/index.js +1 -0
  23. package/core/http-service/interface/cs-http-interceptor.d.ts +4 -0
  24. package/core/http-service/interface/cs-http-service.d.ts +11 -0
  25. package/core/http-service/interface/cs-request-interceptor.d.ts +5 -0
  26. package/core/http-service/interface/cs-request.d.ts +77 -0
  27. package/core/http-service/interface/cs-response-interceptor.d.ts +6 -0
  28. package/core/http-service/interface/cs-response.d.ts +23 -0
  29. package/core/http-service/interface/index.d.ts +6 -0
  30. package/core/http-service/utilities/interceptors/cs-request-logger-interceptor.d.ts +6 -0
  31. package/core/http-service/utilities/interceptors/cs-response-logger-Interceptor.d.ts +7 -0
  32. package/core/http-service/utilities/interceptors/index.d.ts +2 -0
  33. package/core/http-service/utilities/interceptors/index.js +2 -0
  34. package/core/http-service/utilities/interceptors/index.js.LICENSE.txt +14 -0
  35. package/core/index.d.ts +2 -0
  36. package/core/index.js +1 -0
  37. package/cs-module.d.ts +124 -0
  38. package/index.d.ts +3 -0
  39. package/index.js +2 -0
  40. package/index.js.LICENSE.txt +60 -0
  41. package/injection-tokens.d.ts +76 -0
  42. package/models/certificate/index.d.ts +68 -0
  43. package/models/channel/index.d.ts +57 -0
  44. package/models/channel/index.js +1 -0
  45. package/models/content/index.d.ts +122 -0
  46. package/models/content/index.js +1 -0
  47. package/models/course/index.d.ts +68 -0
  48. package/models/course/index.js +1 -0
  49. package/models/device/index.d.ts +10 -0
  50. package/models/device/index.js +1 -0
  51. package/models/faq/index.d.ts +7 -0
  52. package/models/faq/index.js +1 -0
  53. package/models/form/index.d.ts +15 -0
  54. package/models/form/index.js +1 -0
  55. package/models/group/index.d.ts +96 -0
  56. package/models/group/index.js +1 -0
  57. package/models/index.d.ts +12 -0
  58. package/models/index.js +1 -0
  59. package/models/location/index.d.ts +6 -0
  60. package/models/location/index.js +1 -0
  61. package/models/notification/index.d.ts +33 -0
  62. package/models/organisation/index.d.ts +17 -0
  63. package/models/organisation/index.js +1 -0
  64. package/models/page/index.d.ts +23 -0
  65. package/models/page/index.js +1 -0
  66. package/models/user/index.d.ts +109 -0
  67. package/models/user/index.js +1 -0
  68. package/package.json +100 -0
  69. package/services/certificate/implementation/certificate-service-impl.d.ts +29 -0
  70. package/services/certificate/index.d.ts +1 -0
  71. package/services/certificate/interface/cs-certificate-service.d.ts +81 -0
  72. package/services/certificate/interface/index.d.ts +1 -0
  73. package/services/content/implementation/content-service-impl.d.ts +13 -0
  74. package/services/content/index.d.ts +1 -0
  75. package/services/content/index.js +1 -0
  76. package/services/content/interface/cs-content-filter-criteria.d.ts +11 -0
  77. package/services/content/interface/cs-content-mime-type.d.ts +17 -0
  78. package/services/content/interface/cs-content-service.d.ts +13 -0
  79. package/services/content/interface/cs-content-sort-criteria.d.ts +17 -0
  80. package/services/content/interface/cs-content-type.d.ts +35 -0
  81. package/services/content/interface/cs-primary-category.d.ts +17 -0
  82. package/services/content/interface/cs-resource-type.d.ts +10 -0
  83. package/services/content/interface/index.d.ts +7 -0
  84. package/services/content/utilities/content-group-generator/cs-contents-group-generator.d.ts +44 -0
  85. package/services/content/utilities/content-group-generator/index.d.ts +1 -0
  86. package/services/content/utilities/content-group-generator/index.js +1 -0
  87. package/services/content/utilities/content-progress-calculator/cs-content-progress-calculator.d.ts +8 -0
  88. package/services/content/utilities/content-progress-calculator/index.d.ts +1 -0
  89. package/services/content/utilities/content-progress-calculator/index.js +1 -0
  90. package/services/content/utilities/mime-type-facet-to-mime-type-category-aggregator/cs-mime-type-facet-to-mime-type-category-aggregator.d.ts +15 -0
  91. package/services/content/utilities/mime-type-facet-to-mime-type-category-aggregator/index.d.ts +1 -0
  92. package/services/content/utilities/mime-type-facet-to-mime-type-category-aggregator/index.js +1 -0
  93. package/services/content/utilities/primary-category-mapper/cs-primary-category-mapper.d.ts +5 -0
  94. package/services/content/utilities/primary-category-mapper/index.d.ts +1 -0
  95. package/services/content/utilities/primary-category-mapper/index.js +1 -0
  96. package/services/course/implementation/course-service-impl.d.ts +15 -0
  97. package/services/course/index.d.ts +1 -0
  98. package/services/course/index.js +1 -0
  99. package/services/course/interface/cs-course-service.d.ts +68 -0
  100. package/services/course/interface/index.d.ts +1 -0
  101. package/services/discussion/implementation/discussion-service-impl.d.ts +108 -0
  102. package/services/discussion/index.d.ts +1 -0
  103. package/services/discussion/interface/cs-discussion-service.d.ts +82 -0
  104. package/services/discussion/interface/index.d.ts +1 -0
  105. package/services/form/implementation/form-service-impl.d.ts +11 -0
  106. package/services/form/index.d.ts +0 -0
  107. package/services/form/interface/cs-form-service.d.ts +14 -0
  108. package/services/framework/implementation/cs-framework-config-bloc.d.ts +11 -0
  109. package/services/framework/implementation/framework-service-impl.d.ts +21 -0
  110. package/services/framework/index.d.ts +1 -0
  111. package/services/framework/index.js +1 -0
  112. package/services/framework/interface/cs-framework-service.d.ts +21 -0
  113. package/services/framework/interface/index.d.ts +1 -0
  114. package/services/group/activity/implementation/group-activity-service-impl.d.ts +16 -0
  115. package/services/group/activity/index.d.ts +1 -0
  116. package/services/group/activity/index.js +1 -0
  117. package/services/group/activity/interface/cs-group-activity-service.d.ts +38 -0
  118. package/services/group/activity/interface/index.d.ts +1 -0
  119. package/services/group/implementation/group-service-impl.d.ts +43 -0
  120. package/services/group/index.d.ts +1 -0
  121. package/services/group/index.js +1 -0
  122. package/services/group/interface/cs-group-service.d.ts +175 -0
  123. package/services/group/interface/index.d.ts +1 -0
  124. package/services/location/implementation/location-service-impl.d.ts +11 -0
  125. package/services/location/index.d.ts +1 -0
  126. package/services/location/index.js +1 -0
  127. package/services/location/interface/cs-location-service.d.ts +16 -0
  128. package/services/location/interface/index.d.ts +1 -0
  129. package/services/notification/implementation/notification-service-impl.d.ts +12 -0
  130. package/services/notification/index.d.ts +1 -0
  131. package/services/notification/interface/cs-notification-service.d.ts +22 -0
  132. package/services/notification/interface/index.d.ts +1 -0
  133. package/services/system-settings/implementation/system-settings-service-impl.d.ts +10 -0
  134. package/services/system-settings/index.d.ts +1 -0
  135. package/services/system-settings/index.js +1 -0
  136. package/services/system-settings/interface/cs-system-settings-service.d.ts +5 -0
  137. package/services/system-settings/interface/index.d.ts +1 -0
  138. package/services/user/implementation/user-service-impl.d.ts +25 -0
  139. package/services/user/index.d.ts +1 -0
  140. package/services/user/index.js +1 -0
  141. package/services/user/interface/cs-user-service.d.ts +83 -0
  142. package/services/user/interface/index.d.ts +1 -0
  143. package/telemetry/cs-telemetry-module.d.ts +30 -0
  144. package/telemetry/errors/cs-telemetry-validation-error.d.ts +6 -0
  145. package/telemetry/errors/index.d.ts +1 -0
  146. package/telemetry/implementation/pdf-player-telemetry-service-impl.d.ts +6 -0
  147. package/telemetry/implementation/player-telemetry-service-impl.d.ts +9 -0
  148. package/telemetry/implementation/telemetry-service-Impl.d.ts +38 -0
  149. package/telemetry/index.d.ts +4 -0
  150. package/telemetry/index.js +2 -0
  151. package/telemetry/index.js.LICENSE.txt +14 -0
  152. package/telemetry/injection-tokens.d.ts +9 -0
  153. package/telemetry/interface/cs-player-telemetry-service.d.ts +6 -0
  154. package/telemetry/interface/cs-telemetry-request.d.ts +69 -0
  155. package/telemetry/interface/cs-telemetry-service.d.ts +27 -0
  156. package/telemetry/interface/index.d.ts +3 -0
  157. package/utilities/aggregator/aggregator.d.ts +23 -0
  158. package/utilities/aggregator/index.d.ts +1 -0
  159. package/utilities/aggregator/index.js +1 -0
  160. package/utilities/certificate/certificate-verifier.d.ts +11 -0
  161. package/utilities/certificate/credentials.d.ts +343 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Sunbird
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,330 @@
1
+ # @project-sunbird/client-services
2
+
3
+ ## Table of Contents
4
+
5
+ 1. [Development](#development-setup)
6
+ 1. [Continuous Integration](#continuous-integration)
7
+ 1. [Overview](#overview)
8
+ 1. [Installation](#installation)
9
+ 1. [Getting Started](#getting-started)
10
+ 1. [Adapters](#adapters)
11
+ 1. [Update Configuration](#update-configuration)
12
+ 1. [Services](#services)
13
+ 1. [CsGroupService](#csgroupservice)
14
+
15
+ ## Development setup
16
+
17
+ ### Prerequisites
18
+
19
+ NodeJS 22.15
20
+
21
+ ### Local Development
22
+
23
+ 1. Fork the repository on GitHub
24
+
25
+ 2. Clone your fork:
26
+
27
+ ```
28
+ git clone https://github.com/your-username/sunbird-client-service.git
29
+
30
+ cd sunbird-client-service
31
+ ```
32
+ 3. Install dependencies:
33
+
34
+ ```
35
+ npm i
36
+ ```
37
+ 4. To run the project
38
+ ```
39
+ npm run build
40
+ ```
41
+ ## Continuous Integration
42
+
43
+ This project uses GitHub Actions for automated testing, building, and publishing. Below are details of the CI processes:
44
+
45
+ ### Pull Request Workflow
46
+
47
+ When a pull request is opened or updated, the following automated checks are performed:
48
+
49
+ 1. **Code checkout**: The repository code is checked out
50
+ 2. **Environment setup**: Node.js 22.15 is installed and configured
51
+ 4. **Test execution**: All tests are run with coverage reporting
52
+ 5. **Code linting**: ESLint is run to check code style and quality
53
+ 6. **Static code analysis**: SonarQube scan is performed to evaluate code quality
54
+ 6. **Build verification**: The project is built using webpack to ensure it compiles correctly. Ensure ```SONAR_TOKEN``` is configured in your repository.
55
+
56
+ This ensures that all changes in pull requests meet quality standards before merging.
57
+
58
+ ### Release Workflow
59
+
60
+ When a new tag is pushed to the repository, the following automated steps are executed:
61
+
62
+ 1. **Code checkout**: The tagged version of code is checked out
63
+ 2. **Environment setup**: Node.js 22.15 is installed and configured with NPM registry access
64
+ 3. **Dependency installation**: Project dependencies are installed via `npm i`
65
+ 4. **Build process**: The project is built for production
66
+ 5. **Package creation**: The build output is packaged for distribution
67
+ 6. **NPM publication**: The package is published to the NPM registry after setting ```NPM_TOKEN```
68
+
69
+ This allows for simple, reliable releases by simply pushing a new tag.
70
+
71
+ ### Manual Release Process
72
+
73
+ To manually trigger a new release:
74
+
75
+ 1. Update the version in `package.json`
76
+ 2. Commit the change: `git commit -m "Increase version to x.y.z"`
77
+ 3. Create and push a tag: `git tag v{x.y.z} && git push origin v{x.y.z}`
78
+
79
+ The GitHub Actions workflow will automatically build and publish the new version.
80
+
81
+
82
+ ## Overview
83
+
84
+ The library is grouped into Modules and SubModules as shown below -
85
+
86
+ ```
87
+ @project-sunbird/client-services
88
+ ├── blocs
89
+ │   └── group-addable
90
+ ├── core
91
+ │   └── http-service
92
+ ├── models
93
+ │   ├── certificate
94
+ │   ├── channel
95
+ │   ├── content
96
+ │   ├── course
97
+ │   ├── device
98
+ │   ├── faq
99
+ │   ├── form
100
+ │   ├── group
101
+ │   ├── location
102
+ │   ├── notification
103
+ │   ├── organisation
104
+ │   ├── page
105
+ │   └── user
106
+ ├── services
107
+ │   ├── certificate
108
+ │   ├── content
109
+ │   ├── course
110
+ │   ├── discussion
111
+ │   ├── form
112
+ │   ├── framework
113
+ │   ├── group
114
+ │   ├── location
115
+ │   ├── notification
116
+ │   ├── system-settings
117
+ │   └── user
118
+ ├── telemetry
119
+ │   ├── errors
120
+ │   ├── implementation
121
+ │   └── interface
122
+ └── utilities
123
+ ├── aggregator
124
+ └── certificate
125
+ ```
126
+
127
+ The public facing API is prefixed with 'Cs' namespace, as in -
128
+ - CsModule
129
+ - CsConfig
130
+ - CsGroupService
131
+ - ...
132
+
133
+ For instance,
134
+ - CsModule is part of the root module
135
+ - CsContentsGroupGenerator is a utlility within content service
136
+
137
+ Their respective imports would be -
138
+
139
+ ```
140
+ import {CsModule} from "@project-sunbird/client-services";
141
+ import {CsContentsGroupGenerator} from "@project-sunbird/client-services/services/content/utilities/content-group-generator";
142
+ ```
143
+
144
+ ## Installation
145
+
146
+ To install the package
147
+
148
+ ```
149
+ npm i @project-sunbird/client-services@3.x.x
150
+ ```
151
+
152
+ The package requires the consumer to have rxjs@6.x.x installed as the only peerDependency
153
+
154
+ ## Getting Started
155
+
156
+ To use the library CsModule, it needs to be initialised with basic configuration.
157
+ CsModule is a singleton and it would be best to check if it has already been initialised before attempting to initialise -
158
+
159
+ ```
160
+ if (!CsModule.instance.isInitialised) { // Singleton initialised or not
161
+ await CsModule.instance.init({
162
+ core: {
163
+ httpAdapter: 'HttpClientBrowserAdapter', // optional - HttpClientBrowserAdapter or HttpClientCordovaAdapter, default - HttpClientBrowserAdapter
164
+ global: {
165
+ channelId: 'some_channel_id', // required
166
+ producerId: 'some_producer_id', // required
167
+ deviceId: 'some_random_device_id' // required
168
+ },
169
+ api: {
170
+ host: 'https://staging.ntp.net.in', // default host
171
+ authentication: {
172
+ // userToken: string; // optional
173
+ // bearerToken: string; // optional
174
+ }
175
+ }
176
+ },
177
+ services: {
178
+ // groupServiceConfig: CsGroupServiceConfig // optional
179
+ }
180
+ );
181
+ }
182
+ ```
183
+
184
+ ### Adapters
185
+
186
+ If the client for the library is a cordova project, use the 'HttpClientCordovaAdapter' adapter
187
+ or use 'HttpClientBrowserAdapter'. 'HttpClientBrowserAdapter' is the default if not specified.
188
+
189
+ ### Update Configuration
190
+
191
+ The configuration can be dynamically reset after initialisation
192
+
193
+ ```
194
+ const newConfig = {...CsModule.instance.config}; // copy existing config
195
+
196
+ newConfig.core.api.authentication = {
197
+ bearerToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV.eyJpc3MiOiJzdGFnaW5nLmRpa3NoYS5hcHAtYTMzM2YzZjExZDM0YzlkNWYwZTE2MjUyYWMwZDVhYTZmMTBjYSIsImlhdCI6MTU4ODkxNDc1NX0.dEmjK6LStoenL_pRX1KwEtU4-opuUOUGI05ecex',
198
+ };
199
+
200
+ CsModule.instance.updateConfig(CsModule.instance.config);
201
+
202
+ // after login
203
+
204
+ newConfig.core.api.authentication = {
205
+ userToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXV.eyJpc3MiOiJzdGFnaW5nLmRpa3NoYS5hcHAtYTMzM2YzZjExZDM0YzlkNWYwZTE2MjUyYWMwZDVhYTZmMTBjYSIsImlhdCI6MTU4ODkxNDc1NX0.dEmjK6LStoenL_pRX1KwEtU4-opuUOUGI05ecex',
206
+ };
207
+
208
+ CsModule.instance.updateConfig(CsModule.instance.config);
209
+ ```
210
+
211
+ ### Accessing a service
212
+
213
+ The CsModule being a singleton, every service within would also be a singleton, To access any service -
214
+
215
+ ```
216
+ const httpService = CsModule.instance.httpService; // handles API calls, interceptors (tokens, logging)
217
+ const groupService = CsModule.instance.groupService; // internally uses httpService
218
+ ```
219
+
220
+ ## Services
221
+
222
+ Every service by default will utilise the optional configuration declared during init() or updateConfig()
223
+
224
+ ```
225
+ CsModule.instance.init({
226
+ ...
227
+ services: {
228
+ groupServiceConfig: { // optional
229
+ apiPath: '/api/v1/group'
230
+ }
231
+ }
232
+ );
233
+ ```
234
+
235
+ Additionally, methods of the service may have an optional argument that can override the global configuration explicitly
236
+ just for that method call
237
+
238
+ ```
239
+ const group = await groupService.getById(
240
+ group1.identifier,
241
+ { apiPath: '/api/v2/group' } // optional
242
+ ).toPromise();
243
+ ```
244
+
245
+ ### CsGroupService
246
+
247
+ This service deals with user group management and has the following interface -
248
+
249
+ ```
250
+ CsModule.instance.init({
251
+ ...
252
+ services: {
253
+ groupServiceConfig: { // optional
254
+ apiPath: '/api/v1/group'
255
+ }
256
+ }
257
+ );
258
+
259
+ interface CsGroupService {
260
+ create(
261
+ name: string,
262
+ board: string,
263
+ medium: string | string[],
264
+ gradeLevel: string | string[],
265
+ subject: string | string[],
266
+ config?: CsGroupServiceConfig
267
+ ): Observable<Group>;
268
+
269
+ deleteById(id: string, config?: CsGroupServiceConfig): Observable<void>;
270
+
271
+ getAll(config?: CsGroupServiceConfig): Observable<Group[]>;
272
+
273
+ getById(id: string, config?: CsGroupServiceConfig): Observable<Group>;
274
+
275
+ addMemberById(memberId: string, groupId: string, config?: CsGroupServiceConfig): Observable<Group>;
276
+
277
+ removeMemberById(memberId: string, groupId: string, config?: CsGroupServiceConfig): Observable<void>;
278
+ }
279
+ ```
280
+
281
+ ### CsFrameworkService
282
+
283
+ ```
284
+ CsModule.instance.init({
285
+ ...
286
+ services: {
287
+ frameworkServiceConfig: { // optional
288
+ apiPath: '<path>'
289
+ }
290
+ }
291
+ );
292
+
293
+ export interface CsFrameworkService {
294
+ getFramework(id: string, options?: GetFrameworkOptions, config?: CsFrameworkServiceConfig): Observable<Framework>;
295
+ }
296
+ ```
297
+
298
+ ### CsLocationService
299
+
300
+ ```
301
+ CsModule.instance.init({
302
+ ...
303
+ services: {
304
+ locationServiceConfig: { // optional
305
+ apiPath: '<path>'
306
+ }
307
+ }
308
+ );
309
+
310
+ export interface CsLocationService {
311
+ searchLocations(request?: SearchLocationRequests, config?: CsLocationServiceConfig): Observable<Location[]>;
312
+ }
313
+ ```
314
+
315
+ ### CsLocationService
316
+
317
+ ```
318
+ CsModule.instance.init({
319
+ ...
320
+ services: {
321
+ courseServiceConfig: { // optional
322
+ apiPath: '<path>'
323
+ }
324
+ }
325
+ );
326
+
327
+ export interface CsCourseService {
328
+ getUserEnrollmentList(request: GetUserEnrollmentListRequests, additionalParams?: { [key: string]: string }, config?: CsCourseServiceConfig): Observable<Course[]>;
329
+ }
330
+ ```
@@ -0,0 +1,2 @@
1
+ import 'reflect-metadata';
2
+ import 'whatwg-fetch';
@@ -0,0 +1,20 @@
1
+ import { Observable } from 'rxjs';
2
+ export interface CsGroupAddableState {
3
+ pageIds: string[];
4
+ groupId: string;
5
+ params?: {
6
+ [key: string]: any;
7
+ };
8
+ }
9
+ export declare class CsGroupAddableBloc {
10
+ private static _instance;
11
+ static get instance(): CsGroupAddableBloc;
12
+ get state(): CsGroupAddableState | undefined;
13
+ private _state$?;
14
+ get state$(): Observable<CsGroupAddableState | undefined>;
15
+ private _initialised;
16
+ get initialised(): boolean;
17
+ init(): void;
18
+ updateState(state: CsGroupAddableState): void;
19
+ dispose(): void;
20
+ }
@@ -0,0 +1 @@
1
+ export * from './group-addable/cs-group-addable-bloc';
package/blocs/index.js ADDED
@@ -0,0 +1,2 @@
1
+ /*! For license information please see index.js.LICENSE.txt */
2
+ !function t(r,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var o in n)("object"==typeof exports?exports:r)[o]=n[o]}}(window,function(){return function(t){var r={};function e(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=t,e.c=r,e.d=function(t,r,n){e.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:n})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,r){if(1&r&&(t=e(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(e.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)e.d(n,o,function(r){return t[r]}.bind(null,o));return n},e.n=function(t){var r=t&&t.__esModule?function r(){return t.default}:function r(){return t};return e.d(r,"a",r),r},e.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},e.p="",e(e.s=218)}({10:function(t,r,e){"use strict";e.d(r,"a",function(){return c});var n=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}(),o=e(34),i=e(20),s,u=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(t,r){return r+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}(),c=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._ctorUnsubscribe=!0,this._unsubscribe=t)}var r;return t.prototype.unsubscribe=function(){var r;if(!this.closed){var e=this,s=e._parentOrParents,c=e._ctorUnsubscribe,f=e._unsubscribe,l=e._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,s instanceof t)s.remove(this);else if(null!==s)for(var h=0;h<s.length;++h){var p;s[h].remove(this)}if(Object(i.a)(f)){c&&(this._unsubscribe=void 0);try{f.call(this)}catch(t){r=t instanceof u?a(t.errors):[t]}}if(n(l))for(var h=-1,b=l.length;++h<b;){var y=l[h];if(Object(o.a)(y))try{y.unsubscribe()}catch(t){r=r||[],t instanceof u?r=r.concat(a(t.errors)):r.push(t)}}if(r)throw new u(r)}},t.prototype.add=function(r){var e=r;if(!r)return t.EMPTY;switch(typeof r){case"function":e=new t(r);case"object":if(e===this||e.closed||"function"!=typeof e.unsubscribe)return e;if(this.closed)return e.unsubscribe(),e;if(!(e instanceof t)){var n=e;(e=new t)._subscriptions=[n]}break;default:throw new Error("unrecognized teardown "+r+" added to Subscription.")}var o=e._parentOrParents;if(null===o)e._parentOrParents=this;else if(o instanceof t){if(o===this)return e;e._parentOrParents=[o,this]}else{if(-1!==o.indexOf(this))return e;o.push(this)}var i=this._subscriptions;return null===i?this._subscriptions=[e]:i.push(e),e},t.prototype.remove=function(t){var r=this._subscriptions;if(r){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}},t.EMPTY=((r=new t).closed=!0,r),t}();function a(t){return t.reduce(function(t,r){return t.concat(r instanceof u?r.errors:r)},[])}},125:function(t,r,e){"use strict";e.d(r,"a",function(){return l});var n=e(6),o=e(5),i=e(9),s=e(10),u=e(25),c=function(t){function r(r,e){var n=t.call(this)||this;return n.subject=r,n.subscriber=e,n.closed=!1,n}return n.a(r,t),r.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,r=t.observers;if(this.subject=null,r&&0!==r.length&&!t.isStopped&&!t.closed){var e=r.indexOf(this.subscriber);-1!==e&&r.splice(e,1)}}},r}(s.a),a=e(15),f=function(t){function r(r){var e=t.call(this,r)||this;return e.destination=r,e}return n.a(r,t),r}(i.a),l=function(t){function r(){var r=t.call(this)||this;return r.observers=[],r.closed=!1,r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return n.a(r,t),r.prototype[a.a]=function(){return new f(this)},r.prototype.lift=function(t){var r=new h(this,this);return r.operator=t,r},r.prototype.next=function(t){if(this.closed)throw new u.a;if(!this.isStopped)for(var r=this.observers,e=r.length,n=r.slice(),o=0;o<e;o++)n[o].next(t)},r.prototype.error=function(t){if(this.closed)throw new u.a;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var r=this.observers,e=r.length,n=r.slice(),o=0;o<e;o++)n[o].error(t);this.observers.length=0},r.prototype.complete=function(){if(this.closed)throw new u.a;this.isStopped=!0;for(var t=this.observers,r=t.length,e=t.slice(),n=0;n<r;n++)e[n].complete();this.observers.length=0},r.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},r.prototype._trySubscribe=function(r){if(this.closed)throw new u.a;return t.prototype._trySubscribe.call(this,r)},r.prototype._subscribe=function(t){if(this.closed)throw new u.a;return this.hasError?(t.error(this.thrownError),s.a.EMPTY):this.isStopped?(t.complete(),s.a.EMPTY):(this.observers.push(t),new c(this,t))},r.prototype.asObservable=function(){var t=new o.a;return t.source=this,t},r.create=function(t,r){return new h(t,r)},r}(o.a),h=function(t){function r(r,e){var n=t.call(this)||this;return n.destination=r,n.source=e,n}return n.a(r,t),r.prototype.next=function(t){var r=this.destination;r&&r.next&&r.next(t)},r.prototype.error=function(t){var r=this.destination;r&&r.error&&this.destination.error(t)},r.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},r.prototype._subscribe=function(t){var r;return this.source?this.source.subscribe(t):s.a.EMPTY},r}(l)},13:function(t,r,e){"use strict";function n(t){setTimeout(function(){throw t},0)}e.d(r,"a",function(){return n})},15:function(t,r,e){"use strict";e.d(r,"a",function(){return n});var n=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}(),o=n},169:function(t,r,e){"use strict";function n(t){return t&&"function"==typeof t.schedule}e.d(r,"a",function(){return c});var o=e(5),i=e(35),s=e(22);function u(t,r){return r?Object(s.a)(t,r):new o.a(Object(i.a)(t))}function c(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var e=t[t.length-1];return n(e)?(t.pop(),Object(s.a)(t,e)):u(t)}},17:function(t,r,e){"use strict";e.d(r,"a",function(){return i});var n=e(3),o=e(13),i={closed:!0,next:function(t){},error:function(t){if(n.a.useDeprecatedSynchronousErrorHandling)throw t;Object(o.a)(t)},complete:function(){}}},20:function(t,r,e){"use strict";function n(t){return"function"==typeof t}e.d(r,"a",function(){return n})},21:function(t,r,e){"use strict";e.d(r,"a",function(){return n});var n=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}()},218:function(t,r,e){"use strict";e.r(r),e.d(r,"CsGroupAddableBloc",function(){return h});var n=e(169),o=e(6),i=e(125),s=e(25),u=function(t){function r(r){var e=t.call(this)||this;return e._value=r,e}return o.a(r,t),Object.defineProperty(r.prototype,"value",{get:function(){return this.getValue()},enumerable:!0,configurable:!0}),r.prototype._subscribe=function(r){var e=t.prototype._subscribe.call(this,r);return e&&!e.closed&&r.next(this._value),e},r.prototype.getValue=function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new s.a;return this._value},r.prototype.next=function(r){t.prototype.next.call(this,this._value=r)},r}(i.a),c=e(9);function a(t,r){return function(e){return e.lift(new f(t,r))}}var f=function(){function t(t,r){this.compare=t,this.keySelector=r}return t.prototype.call=function(t,r){return r.subscribe(new l(t,this.compare,this.keySelector))},t}(),l=function(t){function r(r,e,n){var o=t.call(this,r)||this;return o.keySelector=n,o.hasKey=!1,"function"==typeof e&&(o.compare=e),o}return o.a(r,t),r.prototype.compare=function(t,r){return t===r},r.prototype._next=function(t){var r;try{var e=this.keySelector;r=e?e(t):t}catch(t){return this.destination.error(t)}var n=!1;if(this.hasKey)try{var o;n=(0,this.compare)(this.key,r)}catch(t){return this.destination.error(t)}else this.hasKey=!0;n||(this.key=r,this.destination.next(t))},r}(c.a),h=function(){function t(){this._initialised=!1}return Object.defineProperty(t,"instance",{get:function(){return this._instance||(this._instance=new t),this._instance},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state",{get:function(){return this._state$?this._state$.getValue():void 0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"state$",{get:function(){return this._state$?this._state$.asObservable().pipe(a()):Object(n.a)(void 0)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"initialised",{get:function(){return this._initialised},enumerable:!1,configurable:!0}),t.prototype.init=function(){this._state$=new u(void 0),this._initialised=!0},t.prototype.updateState=function(t){this._state$&&this._state$.next(t)},t.prototype.dispose=function(){this._state$&&(this._state$.next(void 0),this._state$.complete(),this._state$=void 0),this._initialised=!1},t}()},22:function(t,r,e){"use strict";e.d(r,"a",function(){return i});var n=e(5),o=e(10);function i(t,r){return new n.a(function(e){var n=new o.a,i=0;return n.add(r.schedule(function(){i!==t.length?(e.next(t[i++]),e.closed||n.add(this.schedule())):e.complete()})),n})}},25:function(t,r,e){"use strict";e.d(r,"a",function(){return o});var n,o=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}()},3:function(t,r,e){"use strict";e.d(r,"a",function(){return o});var n=!1,o={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){var r;t&&(new Error).stack;n=t},get useDeprecatedSynchronousErrorHandling(){return n}}},34:function(t,r,e){"use strict";function n(t){return null!==t&&"object"==typeof t}e.d(r,"a",function(){return n})},35:function(t,r,e){"use strict";e.d(r,"a",function(){return n});var n=function(t){return function(r){for(var e=0,n=t.length;e<n&&!r.closed;e++)r.next(t[e]);r.complete()}}},5:function(t,r,e){"use strict";e.d(r,"a",function(){return p});var n=e(9);function o(t){for(;t;){var r=t,e=r.closed,o=r.destination,i=r.isStopped;if(e||i)return!1;t=o&&o instanceof n.a?o:null}return!0}var i=e(15),s=e(17);function u(t,r,e){if(t){if(t instanceof n.a)return t;if(t[i.a])return t[i.a]()}return t||r||e?new n.a(t,r,e):new n.a(s.a)}var c=e(21);function a(t){return t}function f(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return l(t)}function l(t){return 0===t.length?a:1===t.length?t[0]:function r(e){return t.reduce(function(t,r){return r(t)},e)}}var h=e(3),p=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(r){var e=new t;return e.source=this,e.operator=r,e},t.prototype.subscribe=function(t,r,e){var n=this.operator,o=u(t,r,e);if(n?o.add(n.call(o,this.source)):o.add(this.source||h.a.useDeprecatedSynchronousErrorHandling&&!o.syncErrorThrowable?this._subscribe(o):this._trySubscribe(o)),h.a.useDeprecatedSynchronousErrorHandling&&o.syncErrorThrowable&&(o.syncErrorThrowable=!1,o.syncErrorThrown))throw o.syncErrorValue;return o},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){h.a.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=r),o(t)?t.error(r):console.warn(r)}},t.prototype.forEach=function(t,r){var e=this;return new(r=b(r))(function(r,n){var o;o=e.subscribe(function(r){try{t(r)}catch(t){n(t),o&&o.unsubscribe()}},n,r)})},t.prototype._subscribe=function(t){var r=this.source;return r&&r.subscribe(t)},t.prototype[c.a]=function(){return this},t.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return 0===t.length?this:l(t)(this)},t.prototype.toPromise=function(t){var r=this;return new(t=b(t))(function(t,e){var n;r.subscribe(function(t){return n=t},function(t){return e(t)},function(){return t(n)})})},t.create=function(r){return new t(r)},t}();function b(t){if(t||(t=h.a.Promise||Promise),!t)throw new Error("no Promise impl found");return t}},6:function(t,r,e){"use strict";e.d(r,"a",function(){return o});var n=function(t,r){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])},n(t,r)};function o(t,r){function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var i=function(){return i=Object.assign||function t(r){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=e[i]);return r},i.apply(this,arguments)};function s(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(t);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(t,n[o])&&(e[n[o]]=t[n[o]]);return e}function u(t,r,e,n){var o=arguments.length,i=o<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,e):n,s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,r,e,n);else for(var u=t.length-1;u>=0;u--)(s=t[u])&&(i=(o<3?s(i):o>3?s(r,e,i):s(r,e))||i);return o>3&&i&&Object.defineProperty(r,e,i),i}function c(t,r){return function(e,n){r(e,n,t)}}function a(t,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,r)}function f(t,r,e,n){function o(t){return t instanceof e?t:new e(function(r){r(t)})}return new(e||(e=Promise))(function(e,i){function s(t){try{c(n.next(t))}catch(t){i(t)}}function u(t){try{c(n.throw(t))}catch(t){i(t)}}function c(t){t.done?e(t.value):o(t.value).then(s,u)}c((n=n.apply(t,r||[])).next())})}function l(t,r){var e={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},n,o,i,s;return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(t){return function(r){return c([t,r])}}function c(s){if(n)throw new TypeError("Generator is already executing.");for(;e;)try{if(n=1,o&&(i=2&s[0]?o.return:s[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,s[1])).done)return i;switch(o=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return e.label++,{value:s[1],done:!1};case 5:e.label++,o=s[1],s=[0];continue;case 7:s=e.ops.pop(),e.trys.pop();continue;default:if(!(i=e.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){e=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){e.label=s[1];break}if(6===s[0]&&e.label<i[1]){e.label=i[1],i=s;break}if(i&&e.label<i[2]){e.label=i[2],e.ops.push(s);break}i[2]&&e.ops.pop(),e.trys.pop();continue}s=r.call(t,e)}catch(t){s=[6,t],o=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}function h(t,r,e,n){void 0===n&&(n=e),t[n]=r[e]}function p(t,r){for(var e in t)"default"===e||r.hasOwnProperty(e)||(r[e]=t[e])}function b(t){var r="function"==typeof Symbol&&Symbol.iterator,e=r&&t[r],n=0;if(e)return e.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var n=e.call(t),o,i=[],s;try{for(;(void 0===r||r-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(t){s={error:t}}finally{try{o&&!o.done&&(e=n.return)&&e.call(n)}finally{if(s)throw s.error}}return i}function d(){for(var t=[],r=0;r<arguments.length;r++)t=t.concat(y(arguments[r]));return t}function v(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;for(var n=Array(t),o=0,r=0;r<e;r++)for(var i=arguments[r],s=0,u=i.length;s<u;s++,o++)n[o]=i[s];return n}function _(t){return this instanceof _?(this.v=t,this):new _(t)}function w(t,r,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(t,r||[]),o,i=[];return o={},s("next"),s("throw"),s("return"),o[Symbol.asyncIterator]=function(){return this},o;function s(t){n[t]&&(o[t]=function(r){return new Promise(function(e,n){i.push([t,r,e,n])>1||u(t,r)})})}function u(t,r){try{c(n[t](r))}catch(t){l(i[0][3],t)}}function c(t){t.value instanceof _?Promise.resolve(t.value.v).then(a,f):l(i[0][2],t)}function a(t){u("next",t)}function f(t){u("throw",t)}function l(t,r){t(r),i.shift(),i.length&&u(i[0][0],i[0][1])}}function m(t){var r,e;return r={},n("next"),n("throw",function(t){throw t}),n("return"),r[Symbol.iterator]=function(){return this},r;function n(n,o){r[n]=t[n]?function(r){return(e=!e)?{value:_(t[n](r)),done:"return"===n}:o?o(r):r}:o}}function S(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=t[Symbol.asyncIterator],e;return r?r.call(t):(t=b(t),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=t[r]&&function(e){return new Promise(function(n,i){o(n,i,(e=t[r](e)).done,e.value)})}}function o(t,r,e,n){Promise.resolve(n).then(function(r){t({value:r,done:e})},r)}}function g(t,r){return Object.defineProperty?Object.defineProperty(t,"raw",{value:r}):t.raw=r,t}function O(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)Object.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r.default=t,r}function E(t){return t&&t.__esModule?t:{default:t}}function x(t,r){if(!r.has(t))throw new TypeError("attempted to get private field on non-instance");return r.get(t)}function j(t,r,e){if(!r.has(t))throw new TypeError("attempted to set private field on non-instance");return r.set(t,e),e}},9:function(t,r,e){"use strict";e.d(r,"a",function(){return f});var n=e(6),o=e(20),i=e(17),s=e(10),u=e(15),c=e(3),a=e(13),f=function(t){function r(e,n,o){var s=t.call(this)||this;switch(s.syncErrorValue=null,s.syncErrorThrown=!1,s.syncErrorThrowable=!1,s.isStopped=!1,arguments.length){case 0:s.destination=i.a;break;case 1:if(!e){s.destination=i.a;break}if("object"==typeof e){e instanceof r?(s.syncErrorThrowable=e.syncErrorThrowable,s.destination=e,e.add(s)):(s.syncErrorThrowable=!0,s.destination=new l(s,e));break}default:s.syncErrorThrowable=!0,s.destination=new l(s,e,n,o)}return s}return n.a(r,t),r.prototype[u.a]=function(){return this},r.create=function(t,e,n){var o=new r(t,e,n);return o.syncErrorThrowable=!1,o},r.prototype.next=function(t){this.isStopped||this._next(t)},r.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},r.prototype._next=function(t){this.destination.next(t)},r.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},r.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},r.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},r}(s.a),l=function(t){function r(r,e,n,s){var u=t.call(this)||this,c;u._parentSubscriber=r;var a=u;return Object(o.a)(e)?c=e:e&&(c=e.next,n=e.error,s=e.complete,e!==i.a&&(a=Object.create(e),Object(o.a)(a.unsubscribe)&&u.add(a.unsubscribe.bind(a)),a.unsubscribe=u.unsubscribe.bind(u))),u._context=a,u._next=c,u._error=n,u._complete=s,u}return n.a(r,t),r.prototype.next=function(t){if(!this.isStopped&&this._next){var r=this._parentSubscriber;c.a.useDeprecatedSynchronousErrorHandling&&r.syncErrorThrowable?this.__tryOrSetError(r,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},r.prototype.error=function(t){if(!this.isStopped){var r=this._parentSubscriber,e=c.a.useDeprecatedSynchronousErrorHandling;if(this._error)e&&r.syncErrorThrowable?(this.__tryOrSetError(r,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(r.syncErrorThrowable)e?(r.syncErrorValue=t,r.syncErrorThrown=!0):Object(a.a)(t),this.unsubscribe();else{if(this.unsubscribe(),e)throw t;Object(a.a)(t)}}},r.prototype.complete=function(){var t=this;if(!this.isStopped){var r=this._parentSubscriber;if(this._complete){var e=function(){return t._complete.call(t._context)};c.a.useDeprecatedSynchronousErrorHandling&&r.syncErrorThrowable?(this.__tryOrSetError(r,e),this.unsubscribe()):(this.__tryOrUnsub(e),this.unsubscribe())}else this.unsubscribe()}},r.prototype.__tryOrUnsub=function(t,r){try{t.call(this._context,r)}catch(t){if(this.unsubscribe(),c.a.useDeprecatedSynchronousErrorHandling)throw t;Object(a.a)(t)}},r.prototype.__tryOrSetError=function(t,r,e){if(!c.a.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{r.call(this._context,e)}catch(r){return c.a.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=r,t.syncErrorThrown=!0,!0):(Object(a.a)(r),!0)}return!1},r.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},r}(f)}})});
@@ -0,0 +1,14 @@
1
+ /*! *****************************************************************************
2
+ Copyright (c) Microsoft Corporation.
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
+ PERFORMANCE OF THIS SOFTWARE.
14
+ ***************************************************************************** */
@@ -0,0 +1,5 @@
1
+ export declare abstract class CsClientStorage {
2
+ static readonly TRACE_ID: string;
3
+ abstract setItem(key: string, value: string): Promise<void>;
4
+ abstract getItem(key: string): Promise<string | undefined>;
5
+ }
@@ -0,0 +1,5 @@
1
+ export declare abstract class CsError {
2
+ private readonly _code;
3
+ protected constructor(message: string, code: string);
4
+ get code(): string;
5
+ }
@@ -0,0 +1,8 @@
1
+ import { CsResponse } from '../interface';
2
+ import { CsError } from '../../cs-error';
3
+ export declare class CsHttpClientError extends CsError {
4
+ readonly response: CsResponse;
5
+ private static code;
6
+ constructor(message: string, response: CsResponse);
7
+ static isInstance(obj: any): boolean;
8
+ }
@@ -0,0 +1,8 @@
1
+ import { CsResponse } from '../interface';
2
+ import { CsError } from '../../cs-error';
3
+ export declare class CsHttpServerError extends CsError {
4
+ readonly response: CsResponse;
5
+ private static code;
6
+ constructor(message: string, response: CsResponse);
7
+ static isInstance(obj: any): boolean;
8
+ }
@@ -0,0 +1,6 @@
1
+ import { CsError } from '../../cs-error';
2
+ export declare class CsNetworkError extends CsError {
3
+ private static code;
4
+ constructor(message: string);
5
+ static isInstance(obj: any): boolean;
6
+ }
@@ -0,0 +1,4 @@
1
+ import { CsError } from '../../cs-error';
2
+ export declare class CsRequestBuilderError extends CsError {
3
+ constructor(message: string);
4
+ }
@@ -0,0 +1,5 @@
1
+ export * from './cs-http-client-error';
2
+ export * from './cs-http-server-error';
3
+ export * from './cs-network-error';
4
+ export * from './cs-request-builder-error';
5
+ export * from '../../cs-error';
@@ -0,0 +1,20 @@
1
+ import { Observable } from 'rxjs';
2
+ import { HttpClient } from './http-client';
3
+ import { CsHttpSerializer, CsResponse } from '../../interface';
4
+ export declare class HttpClientBrowserAdapter implements HttpClient {
5
+ private headers;
6
+ private serializer?;
7
+ private static mapError;
8
+ private static mapResponse;
9
+ constructor();
10
+ setSerializer(httpSerializer: CsHttpSerializer): void;
11
+ addHeader(key: string, value: string): void;
12
+ addHeaders(headers: {
13
+ [p: string]: string;
14
+ }): void;
15
+ get(baseUrl: string, path: string, headers: any, parameters: any, httpSerializer: CsHttpSerializer): Observable<CsResponse>;
16
+ delete(baseUrl: string, path: string, headers: any, parameters: any, httpSerializer: CsHttpSerializer): Observable<CsResponse>;
17
+ patch(baseUrl: string, path: string, headers: any, body: any, httpSerializer: CsHttpSerializer): Observable<CsResponse>;
18
+ post(baseUrl: string, path: string, headers: any, body: any, httpSerializer: CsHttpSerializer): Observable<CsResponse>;
19
+ private invokeRequest;
20
+ }
@@ -0,0 +1,21 @@
1
+ import { Observable } from 'rxjs';
2
+ import { HttpClient } from './http-client';
3
+ import { CsHttpSerializer, CsResponse } from '../../interface';
4
+ export declare class HttpClientCordovaAdapter implements HttpClient {
5
+ private http;
6
+ constructor();
7
+ setSerializer(httpSerializer: CsHttpSerializer): void;
8
+ addHeaders(headers: {
9
+ [key: string]: string;
10
+ }): void;
11
+ addHeader(key: string, value: string): void;
12
+ get(baseUrl: string, path: string, headers: any, parameters: {
13
+ [key: string]: string;
14
+ }, httpSerializer: CsHttpSerializer): Observable<CsResponse>;
15
+ delete(baseUrl: string, path: string, headers: any, parameters: {
16
+ [key: string]: string;
17
+ }, httpSerializer: CsHttpSerializer): Observable<CsResponse>;
18
+ patch(baseUrl: string, path: string, headers: any, body: {}, httpSerializer: CsHttpSerializer): Observable<CsResponse>;
19
+ post(baseUrl: string, path: string, headers: any, body: {}, httpSerializer: CsHttpSerializer): Observable<CsResponse>;
20
+ private invokeRequest;
21
+ }
@@ -0,0 +1,14 @@
1
+ import { CsResponse } from '../../interface/cs-response';
2
+ import { Observable } from 'rxjs';
3
+ import { CsHttpSerializer } from '../../interface/cs-request';
4
+ export declare abstract class HttpClient {
5
+ abstract setSerializer(httpSerializer: CsHttpSerializer): any;
6
+ abstract addHeaders(headers: {
7
+ [key: string]: string;
8
+ }): any;
9
+ abstract addHeader(key: string, value: string): any;
10
+ abstract get(baseUrl: string, path: string, headers: any, parameters: any, httpSerializer: CsHttpSerializer): Observable<CsResponse>;
11
+ abstract post(baseUrl: string, path: string, headers: any, body: any, httpSerializer: CsHttpSerializer): Observable<CsResponse>;
12
+ abstract patch(baseUrl: string, path: string, headers: any, body: any, httpSerializer: CsHttpSerializer): Observable<CsResponse>;
13
+ abstract delete(baseUrl: string, path: string, headers: any, parameters: any, httpSerializer: CsHttpSerializer): Observable<CsResponse>;
14
+ }
@@ -0,0 +1,36 @@
1
+ import { CsHttpService, CsRequest, CsRequestInterceptor, CsResponse, CsResponseInterceptor } from '../interface';
2
+ import { Observable } from 'rxjs';
3
+ import { Container } from 'inversify';
4
+ import { HttpClient } from './http-client-adapters/http-client';
5
+ import { BearerTokenInjectRequestInterceptor } from './interceptors/bearer-token-inject-request-interceptor';
6
+ import { UserTokenInjectRequestInterceptor } from './interceptors/user-token-inject-request-interceptor';
7
+ import { CsClientStorage } from '../../cs-client-storage';
8
+ export declare class HttpServiceImpl implements CsHttpService {
9
+ private container;
10
+ private http;
11
+ private clientStorage?;
12
+ private _requestInterceptors;
13
+ private _responseInterceptors;
14
+ private _traceId?;
15
+ private _bearerTokenInjectRequestInterceptor?;
16
+ get bearerTokenInjectRequestInterceptor(): BearerTokenInjectRequestInterceptor;
17
+ private _userTokenInjectRequestInterceptor?;
18
+ get userTokenInjectRequestInterceptor(): UserTokenInjectRequestInterceptor;
19
+ get host(): string;
20
+ get channelId(): string;
21
+ get deviceId(): string;
22
+ get producerId(): string;
23
+ get sessionId(): string;
24
+ get appVersion(): string;
25
+ constructor(container: Container, http: HttpClient, clientStorage?: CsClientStorage | undefined);
26
+ init(): void;
27
+ get requestInterceptors(): CsRequestInterceptor[];
28
+ set requestInterceptors(value: CsRequestInterceptor[]);
29
+ get responseInterceptors(): CsResponseInterceptor[];
30
+ set responseInterceptors(value: CsResponseInterceptor[]);
31
+ fetch<T = any>(request: CsRequest): Observable<CsResponse<T>>;
32
+ private addGlobalHeader;
33
+ private interceptRequest;
34
+ private interceptResponse;
35
+ private buildInterceptorsFromRequest;
36
+ }
@@ -0,0 +1,8 @@
1
+ import { CsRequest, CsRequestInterceptor } from '../../interface';
2
+ import { Observable } from 'rxjs';
3
+ import { Container } from 'inversify';
4
+ export declare class BearerTokenInjectRequestInterceptor implements CsRequestInterceptor {
5
+ private container;
6
+ constructor(container: Container);
7
+ interceptRequest(request: CsRequest): Observable<CsRequest>;
8
+ }
@@ -0,0 +1,8 @@
1
+ import { CsRequest, CsRequestInterceptor } from '../../interface';
2
+ import { Observable } from 'rxjs';
3
+ import { Container } from 'inversify';
4
+ export declare class UserTokenInjectRequestInterceptor implements CsRequestInterceptor {
5
+ private container;
6
+ constructor(container: Container);
7
+ interceptRequest(request: CsRequest): Observable<CsRequest>;
8
+ }
@@ -0,0 +1,2 @@
1
+ export * from './errors';
2
+ export * from './interface';
@@ -0,0 +1 @@
1
+ !function t(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var n=r();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(window,function(){return function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function e(){return t.default}:function e(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=206)}({0:function(t,e,r){"use strict";r.r(e);var n=r(60),o=r.n(n);for(var i in n)["default"].indexOf(i)<0&&function(t){r.d(e,t,function(){return n[t]})}(i);var u=r(61),s=r.n(u);for(var i in u)["default"].indexOf(i)<0&&function(t){r.d(e,t,function(){return u[t]})}(i);var c=r(62);r.d(e,"CsHttpSerializer",function(){return c.b}),r.d(e,"CsHttpRequestType",function(){return c.a}),r.d(e,"CsRequest",function(){return c.c});var f=r(63),p=r.n(f);for(var i in f)["default","CsHttpSerializer","CsHttpRequestType","CsRequest"].indexOf(i)<0&&function(t){r.d(e,t,function(){return f[t]})}(i);var a=r(64);r.d(e,"CsHttpResponseCode",function(){return a.a}),r.d(e,"CsResponse",function(){return a.b});var h=r(65),d=r.n(h);for(var i in h)["default","CsHttpSerializer","CsHttpRequestType","CsRequest","CsHttpResponseCode","CsResponse"].indexOf(i)<0&&function(t){r.d(e,t,function(){return h[t]})}(i)},12:function(t,e,r){"use strict";r.d(e,"a",function(){return n});var n=function(){function t(t,e){this._code=e}return Object.defineProperty(t.prototype,"code",{get:function(){return this._code},enumerable:!1,configurable:!0}),t}()},16:function(t,e,r){"use strict";r.d(e,"b",function(){return u}),r.d(e,"c",function(){return c}),r.d(e,"d",function(){return p}),r.d(e,"e",function(){return a.a}),r.d(e,"a",function(){return n.a});var n=r(12),o=(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},i(t,e)},function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i,u=function(t){function e(r,n){var o=t.call(this,r,e.code)||this;return o.response=n,Object.setPrototypeOf(o,e.prototype),o}return o(e,t),e.isInstance=function(t){return t.code&&t.code===e.code},e.code="HTTP_CLIENT_ERROR",e}(n.a),s=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},t(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),c=function(t){function e(r,n){var o=t.call(this,r,e.code)||this;return o.response=n,Object.setPrototypeOf(o,e.prototype),o}return s(e,t),e.isInstance=function(t){return t.code&&t.code===e.code},e.code="HTTP_SERVER_ERROR",e}(n.a),f=function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},t(e,r)};return function(e,r){function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),p=function(t){function e(r){var n=t.call(this,r,e.code)||this;return Object.setPrototypeOf(n,e.prototype),n}return f(e,t),e.isInstance=function(t){return t.code&&t.code===e.code},e.code="NETWORK_ERROR",e}(n.a),a=r(32)},206:function(t,e,r){"use strict";r.r(e);var n=r(16);r.d(e,"CsHttpClientError",function(){return n.b}),r.d(e,"CsHttpServerError",function(){return n.c}),r.d(e,"CsNetworkError",function(){return n.d}),r.d(e,"CsRequestBuilderError",function(){return n.e}),r.d(e,"CsError",function(){return n.a});var o=r(0);for(var i in o)["default","CsHttpClientError","CsHttpServerError","CsNetworkError","CsRequestBuilderError","CsError"].indexOf(i)<0&&function(t){r.d(e,t,function(){return o[t]})}(i)},32:function(t,e,r){"use strict";r.d(e,"a",function(){return u});var n=r(12),o=(i=function(t,e){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},i(t,e)},function(t,e){function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),i,u=function(t){function e(r){var n=t.call(this,r,"REQUEST_BUILD_ERROR")||this;return Object.setPrototypeOf(n,e.prototype),n}return o(e,t),e}(n.a)},60:function(t,e){},61:function(t,e){},62:function(t,e,r){"use strict";r.d(e,"b",function(){return o}),r.d(e,"a",function(){return i}),r.d(e,"c",function(){return u});var n=r(32),o,i;!function(t){t.JSON="json",t.URLENCODED="urlencoded",t.UTF8="utf8",t.RAW="raw"}(o||(o={})),function(t){t.GET="GET",t.POST="POST",t.PATCH="PATCH",t.DELETE="DELETE",t.PUT="PUT"}(i||(i={}));var u=function(){function t(){this._serializer=o.JSON,this._responseInterceptors=[],this._withBearerToken=!1,this._headers={},this._body={},this._parameters={},this._withUserToken=!1,this._requestInterceptors=[]}return t.fromJSON=function(e){var r=new t.Builder;return e.body&&r.withBody(e.body),e.type&&r.withType(e.type),e.host&&r.withHost(e.host),e.path&&r.withPath(e.path),e.serializer&&r.withSerializer(e.serializer),e.withBearerToken&&r.withBearerToken(e.withBearerToken),e.withUserToken&&r.withUserToken(e.withUserToken),e.headers&&r.headers(e.headers),e.parameters&&r.withParameters(e.parameters),r.build()},Object.defineProperty(t.prototype,"serializer",{get:function(){return this._serializer},set:function(t){this._serializer=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"withBearerToken",{get:function(){return this._withBearerToken},set:function(t){this._withBearerToken=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"body",{get:function(){return this._body},set:function(t){this._body=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return this._path},set:function(t){this._path=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"type",{get:function(){return this._type},set:function(t){this._type=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"responseInterceptors",{get:function(){return this._responseInterceptors},set:function(t){this._responseInterceptors=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"headers",{get:function(){return this._headers},set:function(t){this._headers=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"parameters",{get:function(){return this._parameters},set:function(t){this._parameters=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"withUserToken",{get:function(){return this._withUserToken},set:function(t){this._withUserToken=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"requestInterceptors",{get:function(){return this._requestInterceptors},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"host",{get:function(){return this._host},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return JSON.stringify({body:this._body,type:this._type,host:this._host,path:this._path,serializer:this._serializer,withBearerToken:this._withBearerToken,withUserToken:this._withUserToken,headers:this._headers,parameters:this._parameters})},t.Builder=function(){function e(){this.request=new t}return e.prototype.withHost=function(t){return this.request._host=t,this},e.prototype.withPath=function(t){return this.request._path=t,this},e.prototype.withType=function(t){return this.request._type=t,this},e.prototype.withResponseInterceptor=function(t){return this.request._responseInterceptors.push(t),this},e.prototype.withRequestInterceptor=function(t){return this.request._requestInterceptors.push(t),this},e.prototype.withHeaders=function(t){return this.request._headers=t,this},e.prototype.withBody=function(t){return this.request._body=t,this},e.prototype.withParameters=function(t){return this.request._parameters=t,this},e.prototype.withBearerToken=function(t){return this.request.withBearerToken=t,this},e.prototype.withUserToken=function(t){return this.request.withUserToken=t,this},e.prototype.withSerializer=function(t){return this.request._serializer=t,this},e.prototype.build=function(){if(!this.request._path)throw new n.a("withPath() is required");if(!this.request._type)throw new n.a("withType() is required");return this.request},e}(),t}()},63:function(t,e){},64:function(t,e,r){"use strict";var n;r.d(e,"a",function(){return n}),r.d(e,"b",function(){return o}),function(t){t[t.HTTP_UNAUTHORISED=401]="HTTP_UNAUTHORISED",t[t.HTTP_FORBIDDEN=403]="HTTP_FORBIDDEN",t[t.HTTP_SUCCESS=200]="HTTP_SUCCESS",t[t.HTTP_BAD_REQUEST=400]="HTTP_BAD_REQUEST",t[t.HTTP_KONG_FAILURE=447]="HTTP_KONG_FAILURE",t[t.HTTP_INTERNAL_SERVER_ERROR=500]="HTTP_INTERNAL_SERVER_ERROR"}(n||(n={}));var o=function(){function t(){}return Object.defineProperty(t.prototype,"responseCode",{get:function(){return this._responseCode},set:function(t){this._responseCode=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"errorMesg",{get:function(){return this._errorMesg},set:function(t){this._errorMesg=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"body",{get:function(){return this._body},set:function(t){this._body=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"headers",{get:function(){return this._headers},set:function(t){this._headers=t},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return JSON.stringify({responseCode:this._responseCode,errorMesg:this._errorMesg,body:this._body,headers:this._headers})},t}()},65:function(t,e){}})});
@@ -0,0 +1,4 @@
1
+ import { CsRequestInterceptor } from './cs-request-interceptor';
2
+ import { CsResponseInterceptor } from './cs-response-interceptor';
3
+ export interface CsHttpInterceptor extends CsRequestInterceptor, CsResponseInterceptor {
4
+ }