@rxap/remote-method 16.0.3 → 17.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +1 -1
  3. package/directive/index.d.ts +2 -2
  4. package/esm2022/directive/index.mjs +5 -3
  5. package/esm2022/directive/lib/remote-method-template-collection.directive.mjs +6 -6
  6. package/esm2022/directive/lib/remote-method-template.directive.mjs +6 -6
  7. package/esm2022/directive/lib/remote-method.directive.mjs +6 -6
  8. package/esm2022/http/directive/index.mjs +4 -2
  9. package/esm2022/http/directive/lib/contenteditable.directive.mjs +6 -6
  10. package/esm2022/http/directive/lib/http-remote-method.directive.mjs +4 -4
  11. package/esm2022/http/index.mjs +5 -3
  12. package/esm2022/http/lib/base-http.remote-method.mjs +6 -6
  13. package/esm2022/http/lib/http-remote-method.loader.mjs +6 -6
  14. package/esm2022/http/lib/http.remote-method.mjs +4 -4
  15. package/esm2022/index.mjs +5 -3
  16. package/esm2022/lib/base.remote-method.mjs +6 -6
  17. package/esm2022/lib/proxy.remote-method.mjs +6 -6
  18. package/esm2022/lib/remote-method-loader.mjs +4 -4
  19. package/esm2022/testing/index.mjs +3 -1
  20. package/esm2022/testing/lib/remote-method-testing-loader.mjs +1 -1
  21. package/fesm2022/rxap-remote-method-directive.mjs +167 -164
  22. package/fesm2022/rxap-remote-method-directive.mjs.map +1 -1
  23. package/fesm2022/rxap-remote-method-http-directive.mjs +67 -64
  24. package/fesm2022/rxap-remote-method-http-directive.mjs.map +1 -1
  25. package/fesm2022/rxap-remote-method-http.mjs +17 -14
  26. package/fesm2022/rxap-remote-method-http.mjs.map +1 -1
  27. package/fesm2022/rxap-remote-method-testing.mjs +3 -0
  28. package/fesm2022/rxap-remote-method-testing.mjs.map +1 -1
  29. package/fesm2022/rxap-remote-method.mjs +27 -24
  30. package/fesm2022/rxap-remote-method.mjs.map +1 -1
  31. package/http/directive/index.d.ts +1 -1
  32. package/http/index.d.ts +2 -2
  33. package/index.d.ts +2 -2
  34. package/package.json +14 -15
@@ -1,10 +1,69 @@
1
- import * as i0 from '@angular/core';
2
- import { Directive, Input, Inject, HostBinding, HostListener } from '@angular/core';
3
- import { RemoteMethodDirective } from '@rxap/remote-method/directive';
4
1
  import { __decorate, __metadata } from 'tslib';
2
+ import * as i0 from '@angular/core';
3
+ import { Directive, Inject, HostBinding, Input, HostListener } from '@angular/core';
5
4
  import { DebounceCall } from '@rxap/utilities';
6
5
  import * as i1 from '@rxap/remote-method/http';
7
6
  import { HttpRemoteMethodLoader } from '@rxap/remote-method/http';
7
+ import { RemoteMethodDirective } from '@rxap/remote-method/directive';
8
+
9
+ class ContenteditableDirective {
10
+ constructor(httpRemoteMethodLoader) {
11
+ this.httpRemoteMethodLoader = httpRemoteMethodLoader;
12
+ this.contenteditable = true;
13
+ }
14
+ onClick($event) {
15
+ $event.stopPropagation();
16
+ }
17
+ onInput($event) {
18
+ const value = $event.target.textContent;
19
+ if (value && value.length > 3) {
20
+ return this.httpRemoteMethodLoader.request$(this.remoteMethodId, {
21
+ pathParams: { uuid: this.uuid },
22
+ body: { [this.property]: value },
23
+ });
24
+ }
25
+ return Promise.resolve();
26
+ }
27
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: ContenteditableDirective, deps: [{ token: HttpRemoteMethodLoader }], target: i0.ɵɵFactoryTarget.Directive }); }
28
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.3", type: ContenteditableDirective, isStandalone: true, selector: "[rxapContenteditable]", inputs: { remoteMethodId: ["rxapContenteditable", "remoteMethodId"], property: "property", uuid: "uuid" }, host: { listeners: { "click": "onClick($event)", "input": "onInput($event)" }, properties: { "attr.contenteditable": "this.contenteditable" } }, ngImport: i0 }); }
29
+ }
30
+ __decorate([
31
+ DebounceCall(1000),
32
+ __metadata("design:type", Function),
33
+ __metadata("design:paramtypes", [Object]),
34
+ __metadata("design:returntype", void 0)
35
+ ], ContenteditableDirective.prototype, "onInput", null);
36
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: ContenteditableDirective, decorators: [{
37
+ type: Directive,
38
+ args: [{
39
+ selector: '[rxapContenteditable]',
40
+ standalone: true,
41
+ }]
42
+ }], ctorParameters: () => [{ type: i1.HttpRemoteMethodLoader, decorators: [{
43
+ type: Inject,
44
+ args: [HttpRemoteMethodLoader]
45
+ }] }], propDecorators: { contenteditable: [{
46
+ type: HostBinding,
47
+ args: ['attr.contenteditable']
48
+ }], remoteMethodId: [{
49
+ type: Input,
50
+ args: [{
51
+ required: true,
52
+ alias: 'rxapContenteditable',
53
+ }]
54
+ }], property: [{
55
+ type: Input,
56
+ args: [{ required: true }]
57
+ }], uuid: [{
58
+ type: Input,
59
+ args: [{ required: true }]
60
+ }], onClick: [{
61
+ type: HostListener,
62
+ args: ['click', ['$event']]
63
+ }], onInput: [{
64
+ type: HostListener,
65
+ args: ['input', ['$event']]
66
+ }] } });
8
67
 
9
68
  class HttpRemoteMethodDirective extends RemoteMethodDirective {
10
69
  set headers(headers) {
@@ -39,10 +98,10 @@ class HttpRemoteMethodDirective extends RemoteMethodDirective {
39
98
  this._remoteMethodOrIdOrToken = value;
40
99
  }
41
100
  }
42
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HttpRemoteMethodDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
43
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: HttpRemoteMethodDirective, isStandalone: true, selector: "button[rxapHttpRemoteMethod]", inputs: { headers: "headers", reportProgress: "reportProgress", params: "params", responseType: "responseType", withCredentials: "withCredentials", body: "body", setHeaders: "setHeaders", setParams: "setParams", pathParams: "pathParams", remoteMethodOrIdOrToken: ["rxapHttpRemoteMethod", "remoteMethodOrIdOrToken"] }, usesInheritance: true, ngImport: i0 }); }
101
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: HttpRemoteMethodDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
102
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.1.3", type: HttpRemoteMethodDirective, isStandalone: true, selector: "button[rxapHttpRemoteMethod]", inputs: { headers: "headers", reportProgress: "reportProgress", params: "params", responseType: "responseType", withCredentials: "withCredentials", body: "body", setHeaders: "setHeaders", setParams: "setParams", pathParams: "pathParams", remoteMethodOrIdOrToken: ["rxapHttpRemoteMethod", "remoteMethodOrIdOrToken"] }, usesInheritance: true, ngImport: i0 }); }
44
103
  }
45
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HttpRemoteMethodDirective, decorators: [{
104
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: HttpRemoteMethodDirective, decorators: [{
46
105
  type: Directive,
47
106
  args: [{
48
107
  selector: 'button[rxapHttpRemoteMethod]',
@@ -71,64 +130,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
71
130
  args: ['rxapHttpRemoteMethod']
72
131
  }] } });
73
132
 
74
- class ContenteditableDirective {
75
- constructor(httpRemoteMethodLoader) {
76
- this.httpRemoteMethodLoader = httpRemoteMethodLoader;
77
- this.contenteditable = true;
78
- }
79
- onClick($event) {
80
- $event.stopPropagation();
81
- }
82
- onInput($event) {
83
- const value = $event.target.textContent;
84
- if (value && value.length > 3) {
85
- return this.httpRemoteMethodLoader.request$(this.remoteMethodId, {
86
- pathParams: { uuid: this.uuid },
87
- body: { [this.property]: value },
88
- });
89
- }
90
- return Promise.resolve();
91
- }
92
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ContenteditableDirective, deps: [{ token: HttpRemoteMethodLoader }], target: i0.ɵɵFactoryTarget.Directive }); }
93
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: ContenteditableDirective, isStandalone: true, selector: "[rxapContenteditable]", inputs: { remoteMethodId: ["rxapContenteditable", "remoteMethodId"], property: "property", uuid: "uuid" }, host: { listeners: { "click": "onClick($event)", "input": "onInput($event)" }, properties: { "attr.contenteditable": "this.contenteditable" } }, ngImport: i0 }); }
94
- }
95
- __decorate([
96
- DebounceCall(1000),
97
- __metadata("design:type", Function),
98
- __metadata("design:paramtypes", [Object]),
99
- __metadata("design:returntype", void 0)
100
- ], ContenteditableDirective.prototype, "onInput", null);
101
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ContenteditableDirective, decorators: [{
102
- type: Directive,
103
- args: [{
104
- selector: '[rxapContenteditable]',
105
- standalone: true,
106
- }]
107
- }], ctorParameters: function () { return [{ type: i1.HttpRemoteMethodLoader, decorators: [{
108
- type: Inject,
109
- args: [HttpRemoteMethodLoader]
110
- }] }]; }, propDecorators: { contenteditable: [{
111
- type: HostBinding,
112
- args: ['attr.contenteditable']
113
- }], remoteMethodId: [{
114
- type: Input,
115
- args: [{
116
- required: true,
117
- alias: 'rxapContenteditable',
118
- }]
119
- }], property: [{
120
- type: Input,
121
- args: [{ required: true }]
122
- }], uuid: [{
123
- type: Input,
124
- args: [{ required: true }]
125
- }], onClick: [{
126
- type: HostListener,
127
- args: ['click', ['$event']]
128
- }], onInput: [{
129
- type: HostListener,
130
- args: ['input', ['$event']]
131
- }] } });
133
+ // region
134
+ // endregion
132
135
 
133
136
  /**
134
137
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"rxap-remote-method-http-directive.mjs","sources":["../../../../../packages/angular/remote-method/http/directive/src/lib/http-remote-method.directive.ts","../../../../../packages/angular/remote-method/http/directive/src/lib/contenteditable.directive.ts","../../../../../packages/angular/remote-method/http/directive/src/rxap-remote-method-http-directive.ts"],"sourcesContent":["import {\n Directive,\n Input,\n} from '@angular/core';\nimport { RemoteMethodDirective } from '@rxap/remote-method/directive';\nimport {\n HttpRemoteMethodMetadata,\n HttpRemoteMethodParameter,\n} from '@rxap/remote-method/http';\nimport { BaseRemoteMethod } from '@rxap/remote-method';\nimport { IdOrInstanceOrToken } from '@rxap/definition';\n\n@Directive({\n selector: 'button[rxapHttpRemoteMethod]',\n standalone: true,\n})\nexport class HttpRemoteMethodDirective<ReturnType = any, Metadata extends HttpRemoteMethodMetadata = HttpRemoteMethodMetadata>\n extends RemoteMethodDirective<ReturnType, HttpRemoteMethodParameter, Metadata> {\n\n @Input()\n public set headers(headers: HttpRemoteMethodParameter['headers']) {\n this.updateParameters({ headers });\n }\n\n @Input()\n public set reportProgress(reportProgress: HttpRemoteMethodParameter['reportProgress']) {\n this.updateParameters({ reportProgress });\n }\n\n @Input()\n public set params(params: HttpRemoteMethodParameter['params']) {\n this.updateParameters({ params });\n }\n\n @Input()\n public set responseType(responseType: HttpRemoteMethodParameter['responseType']) {\n this.updateParameters({ responseType });\n }\n\n @Input()\n public set withCredentials(withCredentials: HttpRemoteMethodParameter['withCredentials']) {\n this.updateParameters({ withCredentials });\n }\n\n @Input()\n public set body(body: HttpRemoteMethodParameter['body']) {\n this.updateParameters({ body });\n }\n\n @Input()\n public set setHeaders(setHeaders: HttpRemoteMethodParameter['setHeaders']) {\n this.updateParameters({ setHeaders });\n }\n\n @Input()\n public set setParams(setParams: HttpRemoteMethodParameter['setParams']) {\n this.updateParameters({ setParams });\n }\n\n @Input()\n public set pathParams(pathParams: HttpRemoteMethodParameter['pathParams']) {\n this.updateParameters({ pathParams });\n }\n\n @Input('rxapHttpRemoteMethod')\n public override set remoteMethodOrIdOrToken(value: IdOrInstanceOrToken<BaseRemoteMethod<ReturnType, HttpRemoteMethodParameter, Metadata>>) {\n if (value) {\n this._remoteMethodOrIdOrToken = value;\n }\n }\n\n}\n\n\n","import {\n Directive,\n HostBinding,\n HostListener,\n Inject,\n Input,\n} from '@angular/core';\nimport {\n DebounceCall,\n Required,\n} from '@rxap/utilities';\nimport { HttpRemoteMethodLoader } from '@rxap/remote-method/http';\n\n@Directive({\n selector: '[rxapContenteditable]',\n standalone: true,\n})\nexport class ContenteditableDirective {\n @HostBinding('attr.contenteditable')\n public contenteditable = true;\n\n @Input({\n required: true,\n alias: 'rxapContenteditable',\n })\n public remoteMethodId!: string;\n\n @Input({ required: true })\n public property!: string;\n\n @Input({ required: true })\n public uuid!: string;\n\n constructor(\n @Inject(HttpRemoteMethodLoader)\n private readonly httpRemoteMethodLoader: HttpRemoteMethodLoader,\n ) {\n }\n\n @HostListener('click', [ '$event' ])\n public onClick($event: Event) {\n $event.stopPropagation();\n }\n\n @HostListener('input', [ '$event' ])\n @DebounceCall(1000)\n public onInput($event: any) {\n const value = ($event.target as HTMLElement).textContent;\n if (value && value.length > 3) {\n return this.httpRemoteMethodLoader.request$(this.remoteMethodId, {\n pathParams: { uuid: this.uuid },\n body: { [this.property]: value },\n });\n }\n return Promise.resolve();\n }\n}\n\n/**\n * @deprecated removed\n */\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;AAgBM,MAAO,yBACX,SAAQ,qBAAsE,CAAA;IAE9E,IACW,OAAO,CAAC,OAA6C,EAAA;AAC9D,QAAA,IAAI,CAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;KACpC;IAED,IACW,cAAc,CAAC,cAA2D,EAAA;AACnF,QAAA,IAAI,CAAC,gBAAgB,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC;KAC3C;IAED,IACW,MAAM,CAAC,MAA2C,EAAA;AAC3D,QAAA,IAAI,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;KACnC;IAED,IACW,YAAY,CAAC,YAAuD,EAAA;AAC7E,Q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;AAAC,gBAAA,IAAA,EAAA,CAAA;AACL,wBAAA,QAAQ,EAAE,IAAI;AACd,wBAAA,KAAK,EAAE,qBAAqB;AAC7B,qBAAA,CAAA;gBAIM,QAAQ,EAAA,CAAA;sBADd,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;gBAIlB,IAAI,EAAA,CAAA;sBADV,KAAK;uBAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAA;gBAUlB,OAAO,EAAA,CAAA;sBADb,YAAY;uBAAC,OAAO,EAAE,CAAE,QAAQ,CAAE,CAAA;gBAO5B,OAAO,EAAA,CAAA;sBAFb,YAAY;uBAAC,OAAO,EAAE,CAAE,QAAQ,CAAE,CAAA;;;AC5CrC;;AAEG;;;;"}
1
+ {"version":3,"file":"rxap-remote-method-http-directive.mjs","sources":["../../../../../packages/angular/remote-method/http/directive/src/lib/contenteditable.directive.ts","../../../../../packages/angular/remote-method/http/directive/src/lib/http-remote-method.directive.ts","../../../../../packages/angular/remote-method/http/directive/src/index.ts","../../../../../packages/angular/remote-method/http/directive/src/rxap-remote-method-http-directive.ts"],"sourcesContent":["import {\n Directive,\n HostBinding,\n HostListener,\n Inject,\n Input,\n} from '@angular/core';\nimport {\n DebounceCall,\n Required,\n} from '@rxap/utilities';\nimport { HttpRemoteMethodLoader } from '@rxap/remote-method/http';\n\n@Directive({\n selector: '[rxapContenteditable]',\n standalone: true,\n})\nexport class ContenteditableDirective {\n @HostBinding('attr.contenteditable')\n public contenteditable = true;\n\n @Input({\n required: true,\n alias: 'rxapContenteditable',\n })\n public remoteMethodId!: string;\n\n @Input({ required: true })\n public property!: string;\n\n @Input({ required: true })\n public uuid!: string;\n\n constructor(\n @Inject(HttpRemoteMethodLoader)\n private readonly httpRemoteMethodLoader: HttpRemoteMethodLoader,\n ) {\n }\n\n @HostListener('click', [ '$event' ])\n public onClick($event: Event) {\n $event.stopPropagation();\n }\n\n @HostListener('input', [ '$event' ])\n @DebounceCall(1000)\n public onInput($event: any) {\n const value = ($event.target as HTMLElement).textContent;\n if (value && value.length > 3) {\n return this.httpRemoteMethodLoader.request$(this.remoteMethodId, {\n pathParams: { uuid: this.uuid },\n body: { [this.property]: value },\n });\n }\n return Promise.resolve();\n }\n}\n\n/**\n * @deprecated removed\n */\n\n","import {\n Directive,\n Input,\n} from '@angular/core';\nimport { RemoteMethodDirective } from '@rxap/remote-method/directive';\nimport {\n HttpRemoteMethodMetadata,\n HttpRemoteMethodParameter,\n} from '@rxap/remote-method/http';\nimport { BaseRemoteMethod } from '@rxap/remote-method';\nimport { IdOrInstanceOrToken } from '@rxap/definition';\n\n@Directive({\n selector: 'button[rxapHttpRemoteMethod]',\n standalone: true,\n})\nexport class HttpRemoteMethodDirective<ReturnType = any, Metadata extends HttpRemoteMethodMetadata = HttpRemoteMethodMetadata>\n extends RemoteMethodDirective<ReturnType, HttpRemoteMethodParameter, Metadata> {\n\n @Input()\n public set headers(headers: HttpRemoteMethodParameter['headers']) {\n this.updateParameters({ headers });\n }\n\n @Input()\n public set reportProgress(reportProgress: HttpRemoteMethodParameter['reportProgress']) {\n this.updateParameters({ reportProgress });\n }\n\n @Input()\n public set params(params: HttpRemoteMethodParameter['params']) {\n this.updateParameters({ params });\n }\n\n @Input()\n public set responseType(responseType: HttpRemoteMethodParameter['responseType']) {\n this.updateParameters({ responseType });\n }\n\n @Input()\n public set withCredentials(withCredentials: HttpRemoteMethodParameter['withCredentials']) {\n this.updateParameters({ withCredentials });\n }\n\n @Input()\n public set body(body: HttpRemoteMethodParameter['body']) {\n this.updateParameters({ body });\n }\n\n @Input()\n public set setHeaders(setHeaders: HttpRemoteMethodParameter['setHeaders']) {\n this.updateParameters({ setHeaders });\n }\n\n @Input()\n public set setParams(setParams: HttpRemoteMethodParameter['setParams']) {\n this.updateParameters({ setParams });\n }\n\n @Input()\n public set pathParams(pathParams: HttpRemoteMethodParameter['pathParams']) {\n this.updateParameters({ pathParams });\n }\n\n @Input('rxapHttpRemoteMethod')\n public override set remoteMethodOrIdOrToken(value: IdOrInstanceOrToken<BaseRemoteMethod<ReturnType, HttpRemoteMethodParameter, Metadata>>) {\n if (value) {\n this._remoteMethodOrIdOrToken = value;\n }\n }\n\n}\n\n\n","// region \nexport * from './lib/contenteditable.directive';\nexport * from './lib/http-remote-method.directive';\n// endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;MAiBa,wBAAwB,CAAA;AAgBnC,IAAA,WAAA,CAEmB,sBAA8C,EAAA;QAA9C,IAAsB,CAAA,sBAAA,GAAtB,sBAAsB,CAAwB;QAhB1D,IAAe,CAAA,eAAA,GAAG,IAAI,CAAC;KAkB7B;AAGM,IAAA,OAAO,CAAC,MAAa,EAAA;QAC1B,MAAM,CAAC,eAAe,EAAE,CAAC;KAC1B;AAIM,IAAA,OAAO,CAAC,MAAW,EAAA;AACxB,QAAA,MAAM,KAAK,GAAI,MAAM,CAAC,MAAsB,CAAC,WAAW,CAAC;QACzD,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;YAC7B,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,EAAE;AAC/D,gBAAA,UAAU,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;gBAC/B,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,GAAG,KAAK,EAAE;AACjC,aAAA,CAAC,CAAC;SACJ;AACD,QAAA,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;KAC1B;AAtCU,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,wBAAwB,kBAiBzB,sBAAsB,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,SAAA,EAAA,CAA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* as i1 from '@angular/common/http';
4
4
  import { HttpClient, HttpRequest, HttpEventType, HttpResponse } from '@angular/common/http';
5
- import { retry, tap, filter, map, timeout } from 'rxjs/operators';
6
5
  import * as i1$1 from '@rxap/remote-method';
7
6
  import { BaseRemoteMethod, RxapRemoteMethodError, REMOTE_METHOD_META_DATA, RemoteMethodLoader } from '@rxap/remote-method';
8
7
  import { hasIndexSignature } from '@rxap/utilities';
8
+ import { retry, tap, filter, map, timeout } from 'rxjs/operators';
9
9
  import { firstValueFrom } from 'rxjs';
10
10
 
11
11
  class BaseHttpRemoteMethod extends BaseRemoteMethod {
@@ -66,12 +66,12 @@ class BaseHttpRemoteMethod extends BaseRemoteMethod {
66
66
  }
67
67
  return this.metadata.url;
68
68
  }
69
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseHttpRemoteMethod, deps: [{ token: HttpClient }, { token: Injector }, { token: REMOTE_METHOD_META_DATA, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
70
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseHttpRemoteMethod }); }
69
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: BaseHttpRemoteMethod, deps: [{ token: HttpClient }, { token: Injector }, { token: REMOTE_METHOD_META_DATA, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
70
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: BaseHttpRemoteMethod }); }
71
71
  }
72
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseHttpRemoteMethod, decorators: [{
72
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: BaseHttpRemoteMethod, decorators: [{
73
73
  type: Injectable
74
- }], ctorParameters: function () { return [{ type: i1.HttpClient, decorators: [{
74
+ }], ctorParameters: () => [{ type: i1.HttpClient, decorators: [{
75
75
  type: Inject,
76
76
  args: [HttpClient]
77
77
  }] }, { type: i0.Injector, decorators: [{
@@ -82,7 +82,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
82
82
  }, {
83
83
  type: Inject,
84
84
  args: [REMOTE_METHOD_META_DATA]
85
- }] }]; } });
85
+ }] }] });
86
86
 
87
87
  class HttpRemoteMethod extends BaseHttpRemoteMethod {
88
88
  // eslint-disable-next-line @typescript-eslint/no-empty-function
@@ -126,10 +126,10 @@ class HttpRemoteMethod extends BaseHttpRemoteMethod {
126
126
  }
127
127
  }), filter((event) => event instanceof HttpResponse), map((event) => event.body), map(body => this.transformer(body)), timeout(this.timeout)));
128
128
  }
129
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HttpRemoteMethod, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
130
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HttpRemoteMethod }); }
129
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: HttpRemoteMethod, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
130
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: HttpRemoteMethod }); }
131
131
  }
132
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HttpRemoteMethod, decorators: [{
132
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: HttpRemoteMethod, decorators: [{
133
133
  type: Injectable
134
134
  }] });
135
135
 
@@ -147,16 +147,19 @@ class HttpRemoteMethodLoader {
147
147
  }
148
148
  return remoteMethod.call(parameters);
149
149
  }
150
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HttpRemoteMethodLoader, deps: [{ token: RemoteMethodLoader }], target: i0.ɵɵFactoryTarget.Injectable }); }
151
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HttpRemoteMethodLoader, providedIn: 'root' }); }
150
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: HttpRemoteMethodLoader, deps: [{ token: RemoteMethodLoader }], target: i0.ɵɵFactoryTarget.Injectable }); }
151
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: HttpRemoteMethodLoader, providedIn: 'root' }); }
152
152
  }
153
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: HttpRemoteMethodLoader, decorators: [{
153
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: HttpRemoteMethodLoader, decorators: [{
154
154
  type: Injectable,
155
155
  args: [{ providedIn: 'root' }]
156
- }], ctorParameters: function () { return [{ type: i1$1.RemoteMethodLoader, decorators: [{
156
+ }], ctorParameters: () => [{ type: i1$1.RemoteMethodLoader, decorators: [{
157
157
  type: Inject,
158
158
  args: [RemoteMethodLoader]
159
- }] }]; } });
159
+ }] }] });
160
+
161
+ // region
162
+ // endregion
160
163
 
161
164
  /**
162
165
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"rxap-remote-method-http.mjs","sources":["../../../../../packages/angular/remote-method/http/src/lib/base-http.remote-method.ts","../../../../../packages/angular/remote-method/http/src/lib/http.remote-method.ts","../../../../../packages/angular/remote-method/http/src/lib/http-remote-method.loader.ts","../../../../../packages/angular/remote-method/http/src/rxap-remote-method-http.ts"],"sourcesContent":["import {\n Inject,\n Injectable,\n Injector,\n Optional,\n} from '@angular/core';\nimport {\n HttpClient,\n HttpHeaders,\n HttpParams,\n HttpRequest,\n} from '@angular/common/http';\nimport {\n BaseRemoteMethod,\n BaseRemoteMethodMetadata,\n REMOTE_METHOD_META_DATA,\n RxapRemoteMethodError,\n} from '@rxap/remote-method';\nimport { hasIndexSignature } from '@rxap/utilities';\n\nexport interface HttpRemoteMethodMetadata extends BaseRemoteMethodMetadata {\n url: string | (() => string);\n method: 'DELETE' | 'GET' | 'HEAD' | 'JSONP' | 'OPTIONS' | 'POST' | 'PUT' | 'PATCH';\n headers?: HttpHeaders;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n timeout?: number;\n retry?: number;\n}\n\nexport interface HttpRemoteMethodParameter<PathParams = any> {\n headers?: HttpHeaders;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n body?: any | null;\n setHeaders?: {\n [name: string]: string | string[];\n };\n setParams?: {\n [param: string]: string;\n };\n pathParams?: PathParams;\n}\n\n@Injectable()\nexport abstract class BaseHttpRemoteMethod<ReturnType = any,\n PathParams = any,\n Parameter extends object = HttpRemoteMethodParameter<PathParams>,\n MetaData extends HttpRemoteMethodMetadata = HttpRemoteMethodMetadata>\n extends BaseRemoteMethod<ReturnType, Parameter, MetaData> {\n\n public timeout = 60 * 1000;\n protected _httpRequest!: HttpRequest<ReturnType>;\n\n constructor(\n @Inject(HttpClient) public readonly http: HttpClient,\n @Inject(Injector) injector: Injector,\n @Optional() @Inject(REMOTE_METHOD_META_DATA) metaData: any | null = null,\n ) {\n super(injector, metaData);\n this.timeout = this.metadata.timeout ?? this.timeout;\n if (http === undefined) {\n throw new RxapRemoteMethodError(\n 'HttpClient is undefined. Ensure that the HttpClient is added to the deps property!',\n '',\n this.constructor.name,\n );\n }\n if (!(http instanceof HttpClient)) {\n throw new RxapRemoteMethodError(\n 'The property http is not an instance of HttpClinent. Check the deps property!',\n '',\n this.constructor.name,\n );\n }\n }\n\n public override init() {\n super.init();\n this._httpRequest = new HttpRequest<ReturnType>(\n this.metadata.method,\n this.getRequestUrl(),\n null,\n {\n headers: this.metadata.headers,\n reportProgress: this.metadata.reportProgress,\n params: this.metadata.params,\n responseType: this.metadata.responseType || 'json',\n withCredentials: this.metadata.withCredentials,\n },\n );\n }\n\n public updateRequest(parameters: Partial<HttpRemoteMethodParameter>): HttpRequest<ReturnType> {\n let url = this._httpRequest.url;\n\n if (parameters && parameters['pathParams']) {\n url = this.buildUrlWithParams(url, (parameters as any).pathParams);\n }\n\n return this._httpRequest.clone({\n withCredentials: this.metadata.withCredentials,\n ...parameters,\n url,\n });\n }\n\n public buildUrlWithParams(url: string, pathParams?: PathParams): string {\n if (pathParams) {\n\n if (!hasIndexSignature(pathParams)) {\n throw new RxapRemoteMethodError(\n `Path params for remote method '${ this.id }' has not an index signature`,\n '',\n this.constructor.name,\n );\n }\n\n const matches = url.match(/\\{[^}]+\\}/g);\n\n if (matches) {\n for (const match of matches) {\n const param = match.substr(1, match.length - 2);\n if (pathParams[param] === undefined) {\n throw new RxapRemoteMethodError(\n `Path params for remote method '${ this.id }' has not a defined value for '${ param }'`,\n '',\n this.constructor.name,\n );\n }\n url = url.replace(match, encodeURIComponent(pathParams[param]));\n }\n }\n }\n\n return url;\n }\n\n protected getRequestUrl(): string {\n if (typeof this.metadata.url === 'function') {\n return this.metadata.url();\n }\n return this.metadata.url;\n }\n\n}\n\nexport interface HttpRemoteMethodMetadata extends BaseRemoteMethodMetadata {\n url: string | (() => string);\n method: 'DELETE' | 'GET' | 'HEAD' | 'JSONP' | 'OPTIONS' | 'POST' | 'PUT' | 'PATCH';\n headers?: HttpHeaders;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n}\n\nexport interface HttpRemoteMethodParameter<PathParams = any> {\n headers?: HttpHeaders;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n body?: any | null;\n setHeaders?: {\n [name: string]: string | string[];\n };\n setParams?: {\n [param: string]: string;\n };\n pathParams?: PathParams;\n}\n","import { Injectable } from '@angular/core';\nimport {\n HttpEventType,\n HttpHeaderResponse,\n HttpProgressEvent,\n HttpResponse,\n HttpSentEvent,\n} from '@angular/common/http';\nimport {\n filter,\n map,\n retry,\n tap,\n timeout,\n} from 'rxjs/operators';\nimport {\n BaseHttpRemoteMethod,\n HttpRemoteMethodMetadata,\n HttpRemoteMethodParameter,\n} from './base-http.remote-method';\nimport { firstValueFrom } from 'rxjs';\n\n@Injectable()\nexport class HttpRemoteMethod<ReturnType = any,\n PathParams = any,\n Parameter extends object = HttpRemoteMethodParameter<PathParams>,\n MetaData extends HttpRemoteMethodMetadata = HttpRemoteMethodMetadata>\n extends BaseHttpRemoteMethod<ReturnType, PathParams, Parameter, MetaData> {\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n public onSentEvent(event: HttpSentEvent): void {\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n public onHeaderResponse(event: HttpHeaderResponse): void {\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n public onResponse(event: HttpResponse<ReturnType>): void {\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n public onProgressEvent(event: HttpProgressEvent): void {\n }\n\n // TODO : make abstract to force implementation to handel parameter transformation\n public createHttpRequestParameters(parameters?: Parameter): Partial<HttpRemoteMethodParameter> {\n return parameters ?? {} as any;\n }\n\n public transformer(response: any): ReturnType {\n return response;\n }\n\n protected _call(parameters?: Parameter): Promise<ReturnType> {\n return firstValueFrom(this.http.request<ReturnType>(this.updateRequest(this.createHttpRequestParameters(parameters)))\n .pipe(\n retry(this.metadata.retry ?? 0),\n tap(event => {\n switch (event.type) {\n\n case HttpEventType.Sent:\n this.onSentEvent(event);\n break;\n\n case HttpEventType.Response:\n this.onResponse(event);\n break;\n\n case HttpEventType.DownloadProgress:\n this.onProgressEvent(event);\n break;\n\n case HttpEventType.UploadProgress:\n this.onProgressEvent(event);\n break;\n\n case HttpEventType.ResponseHeader:\n this.onHeaderResponse(event);\n break;\n\n }\n }),\n filter((event: any) => event instanceof HttpResponse),\n map((event: HttpResponse<ReturnType>) => event.body),\n map(body => this.transformer(body)),\n timeout(this.timeout),\n ));\n }\n\n}\n","import {\n BaseRemoteMethod,\n BaseRemoteMethodMetadata,\n RemoteMethodLoader,\n RxapRemoteMethodError,\n} from '@rxap/remote-method';\nimport { HttpRemoteMethod } from './http.remote-method';\nimport {\n Inject,\n Injectable,\n InjectFlags,\n Injector,\n} from '@angular/core';\nimport { IdOrInstanceOrToken } from '@rxap/definition';\n\n@Injectable({ providedIn: 'root' })\nexport class HttpRemoteMethodLoader {\n\n // Instead of extanding the RemoteMethodLoader class the RemoteMethodLoader instance\n // will be injected, else there could be multiple instance of RemoteMethodLoader's. Then\n // the RefreshService will not trigger a refresh for HttpRemoteMethod's\n constructor(@Inject(RemoteMethodLoader) private readonly remoteMethodLoader: RemoteMethodLoader) {\n }\n\n public request$<ReturnType = any, Parameters = any, Metadata extends BaseRemoteMethodMetadata = BaseRemoteMethodMetadata>(\n remoteMethodIdOrInstanceOrToken: IdOrInstanceOrToken<BaseRemoteMethod<ReturnType, Parameters, Metadata>>,\n parameters: Parameters,\n metadata?: Partial<BaseRemoteMethodMetadata>,\n injector?: Injector,\n notFoundValue?: BaseRemoteMethod<ReturnType, Parameters, Metadata>,\n flags?: InjectFlags,\n ) {\n\n const remoteMethod = this.remoteMethodLoader.load(\n remoteMethodIdOrInstanceOrToken,\n metadata,\n injector,\n notFoundValue,\n flags,\n );\n\n if (!(remoteMethod instanceof HttpRemoteMethod)) {\n throw new RxapRemoteMethodError(`The remote method is not a HttpRemoteMethod`, '', 'HttpRemoteMethodLoader');\n }\n\n return remoteMethod.call(parameters);\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAiDM,MAAgB,oBAIpB,SAAQ,gBAAiD,CAAA;AAKzD,IAAA,WAAA,CACsC,IAAgB,EAClC,QAAkB,EACS,WAAuB,IAAI,EAAA;AAExE,QAAA,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAJU,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY;AAJ/C,QAAA,IAAA,CAAA,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC;AASzB,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;QACrD,IAAI,IAAI,KAAK,SAAS,EAAE;AACtB,YAAA,MAAM,IAAI,qBAAqB,CAC7B,oFAAoF,EACpF,EAAE,EACF,IAAI,CAAC,WAAW,CAAC,IAAI,CACtB,CAAC;AACH,SAAA;AACD,QAAA,IAAI,EAAE,IAAI,YAAY,UAAU,CAAC,EAAE;AACjC,YAAA,MAAM,IAAI,qBAAqB,CAC7B,+EAA+E,EAC/E,EAAE,EACF,IAAI,CAAC,WAAW,CAAC,IAAI,CACtB,CAAC;AACH,SAAA;KACF;IAEe,IAAI,GAAA;QAClB,KAAK,CAAC,IAAI,EAAE,CAAC;AACb,QAAA,IAAI,CAAC,YAAY,GAAG,IAAI,WAAW,CACjC,IAAI,CAAC,QAAQ,CAAC,MAAM,EACpB,IAAI,CAAC,aAAa,EAAE,EACpB,IAAI,EACJ;AACE,YAAA,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO;AAC9B,YAAA,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,cAAc;AAC5C,YAAA,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM;AAC5B,YAAA,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY,IAAI,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,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,sBAAsB,cADT,MAAM,EAAA,CAAA,CAAA,EAAA;;4FACnB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBADlC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;;0BAMnB,MAAM;2BAAC,kBAAkB,CAAA;;;ACrBxC;;AAEG;;;;"}
1
+ {"version":3,"file":"rxap-remote-method-http.mjs","sources":["../../../../../packages/angular/remote-method/http/src/lib/base-http.remote-method.ts","../../../../../packages/angular/remote-method/http/src/lib/http.remote-method.ts","../../../../../packages/angular/remote-method/http/src/lib/http-remote-method.loader.ts","../../../../../packages/angular/remote-method/http/src/index.ts","../../../../../packages/angular/remote-method/http/src/rxap-remote-method-http.ts"],"sourcesContent":["import {\n Inject,\n Injectable,\n Injector,\n Optional,\n} from '@angular/core';\nimport {\n HttpClient,\n HttpHeaders,\n HttpParams,\n HttpRequest,\n} from '@angular/common/http';\nimport {\n BaseRemoteMethod,\n BaseRemoteMethodMetadata,\n REMOTE_METHOD_META_DATA,\n RxapRemoteMethodError,\n} from '@rxap/remote-method';\nimport { hasIndexSignature } from '@rxap/utilities';\n\nexport interface HttpRemoteMethodMetadata extends BaseRemoteMethodMetadata {\n url: string | (() => string);\n method: 'DELETE' | 'GET' | 'HEAD' | 'JSONP' | 'OPTIONS' | 'POST' | 'PUT' | 'PATCH';\n headers?: HttpHeaders;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n timeout?: number;\n retry?: number;\n}\n\nexport interface HttpRemoteMethodParameter<PathParams = any> {\n headers?: HttpHeaders;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n body?: any | null;\n setHeaders?: {\n [name: string]: string | string[];\n };\n setParams?: {\n [param: string]: string;\n };\n pathParams?: PathParams;\n}\n\n@Injectable()\nexport abstract class BaseHttpRemoteMethod<ReturnType = any,\n PathParams = any,\n Parameter extends object = HttpRemoteMethodParameter<PathParams>,\n MetaData extends HttpRemoteMethodMetadata = HttpRemoteMethodMetadata>\n extends BaseRemoteMethod<ReturnType, Parameter, MetaData> {\n\n public timeout = 60 * 1000;\n protected _httpRequest!: HttpRequest<ReturnType>;\n\n constructor(\n @Inject(HttpClient) public readonly http: HttpClient,\n @Inject(Injector) injector: Injector,\n @Optional() @Inject(REMOTE_METHOD_META_DATA) metaData: any | null = null,\n ) {\n super(injector, metaData);\n this.timeout = this.metadata.timeout ?? this.timeout;\n if (http === undefined) {\n throw new RxapRemoteMethodError(\n 'HttpClient is undefined. Ensure that the HttpClient is added to the deps property!',\n '',\n this.constructor.name,\n );\n }\n if (!(http instanceof HttpClient)) {\n throw new RxapRemoteMethodError(\n 'The property http is not an instance of HttpClinent. Check the deps property!',\n '',\n this.constructor.name,\n );\n }\n }\n\n public override init() {\n super.init();\n this._httpRequest = new HttpRequest<ReturnType>(\n this.metadata.method,\n this.getRequestUrl(),\n null,\n {\n headers: this.metadata.headers,\n reportProgress: this.metadata.reportProgress,\n params: this.metadata.params,\n responseType: this.metadata.responseType || 'json',\n withCredentials: this.metadata.withCredentials,\n },\n );\n }\n\n public updateRequest(parameters: Partial<HttpRemoteMethodParameter>): HttpRequest<ReturnType> {\n let url = this._httpRequest.url;\n\n if (parameters && parameters['pathParams']) {\n url = this.buildUrlWithParams(url, (parameters as any).pathParams);\n }\n\n return this._httpRequest.clone({\n withCredentials: this.metadata.withCredentials,\n ...parameters,\n url,\n });\n }\n\n public buildUrlWithParams(url: string, pathParams?: PathParams): string {\n if (pathParams) {\n\n if (!hasIndexSignature(pathParams)) {\n throw new RxapRemoteMethodError(\n `Path params for remote method '${ this.id }' has not an index signature`,\n '',\n this.constructor.name,\n );\n }\n\n const matches = url.match(/\\{[^}]+\\}/g);\n\n if (matches) {\n for (const match of matches) {\n const param = match.substr(1, match.length - 2);\n if (pathParams[param] === undefined) {\n throw new RxapRemoteMethodError(\n `Path params for remote method '${ this.id }' has not a defined value for '${ param }'`,\n '',\n this.constructor.name,\n );\n }\n url = url.replace(match, encodeURIComponent(pathParams[param]));\n }\n }\n }\n\n return url;\n }\n\n protected getRequestUrl(): string {\n if (typeof this.metadata.url === 'function') {\n return this.metadata.url();\n }\n return this.metadata.url;\n }\n\n}\n\nexport interface HttpRemoteMethodMetadata extends BaseRemoteMethodMetadata {\n url: string | (() => string);\n method: 'DELETE' | 'GET' | 'HEAD' | 'JSONP' | 'OPTIONS' | 'POST' | 'PUT' | 'PATCH';\n headers?: HttpHeaders;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n}\n\nexport interface HttpRemoteMethodParameter<PathParams = any> {\n headers?: HttpHeaders;\n reportProgress?: boolean;\n params?: HttpParams;\n responseType?: 'arraybuffer' | 'blob' | 'json' | 'text';\n withCredentials?: boolean;\n body?: any | null;\n setHeaders?: {\n [name: string]: string | string[];\n };\n setParams?: {\n [param: string]: string;\n };\n pathParams?: PathParams;\n}\n","import { Injectable } from '@angular/core';\nimport {\n HttpEventType,\n HttpHeaderResponse,\n HttpProgressEvent,\n HttpResponse,\n HttpSentEvent,\n} from '@angular/common/http';\nimport {\n filter,\n map,\n retry,\n tap,\n timeout,\n} from 'rxjs/operators';\nimport {\n BaseHttpRemoteMethod,\n HttpRemoteMethodMetadata,\n HttpRemoteMethodParameter,\n} from './base-http.remote-method';\nimport { firstValueFrom } from 'rxjs';\n\n@Injectable()\nexport class HttpRemoteMethod<ReturnType = any,\n PathParams = any,\n Parameter extends object = HttpRemoteMethodParameter<PathParams>,\n MetaData extends HttpRemoteMethodMetadata = HttpRemoteMethodMetadata>\n extends BaseHttpRemoteMethod<ReturnType, PathParams, Parameter, MetaData> {\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n public onSentEvent(event: HttpSentEvent): void {\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n public onHeaderResponse(event: HttpHeaderResponse): void {\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n public onResponse(event: HttpResponse<ReturnType>): void {\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n public onProgressEvent(event: HttpProgressEvent): void {\n }\n\n // TODO : make abstract to force implementation to handel parameter transformation\n public createHttpRequestParameters(parameters?: Parameter): Partial<HttpRemoteMethodParameter> {\n return parameters ?? {} as any;\n }\n\n public transformer(response: any): ReturnType {\n return response;\n }\n\n protected _call(parameters?: Parameter): Promise<ReturnType> {\n return firstValueFrom(this.http.request<ReturnType>(this.updateRequest(this.createHttpRequestParameters(parameters)))\n .pipe(\n retry(this.metadata.retry ?? 0),\n tap(event => {\n switch (event.type) {\n\n case HttpEventType.Sent:\n this.onSentEvent(event);\n break;\n\n case HttpEventType.Response:\n this.onResponse(event);\n break;\n\n case HttpEventType.DownloadProgress:\n this.onProgressEvent(event);\n break;\n\n case HttpEventType.UploadProgress:\n this.onProgressEvent(event);\n break;\n\n case HttpEventType.ResponseHeader:\n this.onHeaderResponse(event);\n break;\n\n }\n }),\n filter((event: any) => event instanceof HttpResponse),\n map((event: HttpResponse<ReturnType>) => event.body),\n map(body => this.transformer(body)),\n timeout(this.timeout),\n ));\n }\n\n}\n","import {\n BaseRemoteMethod,\n BaseRemoteMethodMetadata,\n RemoteMethodLoader,\n RxapRemoteMethodError,\n} from '@rxap/remote-method';\nimport { HttpRemoteMethod } from './http.remote-method';\nimport {\n Inject,\n Injectable,\n InjectFlags,\n Injector,\n} from '@angular/core';\nimport { IdOrInstanceOrToken } from '@rxap/definition';\n\n@Injectable({ providedIn: 'root' })\nexport class HttpRemoteMethodLoader {\n\n // Instead of extanding the RemoteMethodLoader class the RemoteMethodLoader instance\n // will be injected, else there could be multiple instance of RemoteMethodLoader's. Then\n // the RefreshService will not trigger a refresh for HttpRemoteMethod's\n constructor(@Inject(RemoteMethodLoader) private readonly remoteMethodLoader: RemoteMethodLoader) {\n }\n\n public request$<ReturnType = any, Parameters = any, Metadata extends BaseRemoteMethodMetadata = BaseRemoteMethodMetadata>(\n remoteMethodIdOrInstanceOrToken: IdOrInstanceOrToken<BaseRemoteMethod<ReturnType, Parameters, Metadata>>,\n parameters: Parameters,\n metadata?: Partial<BaseRemoteMethodMetadata>,\n injector?: Injector,\n notFoundValue?: BaseRemoteMethod<ReturnType, Parameters, Metadata>,\n flags?: InjectFlags,\n ) {\n\n const remoteMethod = this.remoteMethodLoader.load(\n remoteMethodIdOrInstanceOrToken,\n metadata,\n injector,\n notFoundValue,\n flags,\n );\n\n if (!(remoteMethod instanceof HttpRemoteMethod)) {\n throw new RxapRemoteMethodError(`The remote method is not a HttpRemoteMethod`, '', 'HttpRemoteMethodLoader');\n }\n\n return remoteMethod.call(parameters);\n }\n\n}\n","// region \nexport * from './lib/base-http.remote-method';\nexport * from './lib/http-remote-method.loader';\nexport * from './lib/http.remote-method';\n// endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAiDM,MAAgB,oBAIpB,SAAQ,gBAAiD,CAAA;AAKzD,IAAA,WAAA,CACsC,IAAgB,EAClC,QAAkB,EACS,WAAuB,IAAI,EAAA;AAExE,QAAA,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAJU,IAAI,CAAA,IAAA,GAAJ,IAAI,CAAY;AAJ/C,QAAA,IAAA,CAAA,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC;AASzB,QAAA,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC;AACrD,QAAA,IAAI,IAAI,KAAK,SAAS,EAAE;AACtB,YAAA,MAAM,IAAI,qBAAqB,CAC7B,oFAAoF,EACpF,EAAE,EACF,IAAI,CAAC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EACR,aAAa,EACb,KAAK,CACN,CAAC;AAEF,QAAA,IAAI,EAAE,YAAY,YAAY,gBAAgB,CAAC,EAAE;YAC/C,MAAM,IAAI,qBAAqB,CAAC,CAAA,2CAAA,CAA6C,EAAE,EAAE,EAAE,wBAAwB,CAAC,CAAC;SAC9G;AAED,QAAA,OAAO,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;KACtC;AA9BU,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,sBAAsB,kBAKb,kBAAkB,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;AAL3B,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,sBAAsB,cADT,MAAM,EAAA,CAAA,CAAA,EAAA;;2FACnB,sBAAsB,EAAA,UAAA,EAAA,CAAA;kBADlC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;;0BAMnB,MAAM;2BAAC,kBAAkB,CAAA;;;ACrBxC;AAIA;;ACJA;;AAEG;;;;"}
@@ -46,6 +46,9 @@ const REMOTE_METHOD_TESTING_LOADER_PROVIDER = {
46
46
  useClass: RemoteMethodTestingLoader,
47
47
  };
48
48
 
49
+ // region
50
+ // endregion
51
+
49
52
  /**
50
53
  * Generated bundle index. Do not edit.
51
54
  */
@@ -1 +1 @@
1
- {"version":3,"file":"rxap-remote-method-testing.mjs","sources":["../../../../../packages/angular/remote-method/testing/src/lib/remote-method-testing-loader.ts","../../../../../packages/angular/remote-method/testing/src/rxap-remote-method-testing.ts"],"sourcesContent":["import {\n BaseRemoteMethod,\n BaseRemoteMethodMetadata,\n RemoteMethodLoader,\n} from '@rxap/remote-method';\nimport {\n AbstractType,\n InjectionToken,\n Provider,\n Type,\n} from '@angular/core';\n\nexport type MockRemoteMethod = (parameters?: any, metadata?: any) => any;\n\nexport class RemoteMethodTestingLoader extends RemoteMethodLoader {\n\n private mockedRemoteMethods = new Map<string, MockRemoteMethod>();\n\n public mock(remoteMethodId: string, resultOrFunction: any | MockRemoteMethod): void {\n let resultFunction: MockRemoteMethod;\n if (typeof resultOrFunction !== 'function') {\n resultFunction = () => resultOrFunction;\n } else {\n resultFunction = resultOrFunction;\n }\n this.mockedRemoteMethods.set(remoteMethodId, resultFunction);\n }\n\n public clearMocks(): void {\n this.mockedRemoteMethods.clear();\n }\n\n public deleteMock(remoteMethodId: string): boolean {\n return this.mockedRemoteMethods.delete(remoteMethodId);\n }\n\n public hasMock(remoteMethodId: string): boolean {\n return this.mockedRemoteMethods.has(remoteMethodId);\n }\n\n public getMock(remoteMethodId: string): MockRemoteMethod {\n if (!this.hasMock(remoteMethodId)) {\n throw new Error(`A remote method mock with the id '${ remoteMethodId }' is not registered`);\n }\n return this.mockedRemoteMethods.get(remoteMethodId)!;\n }\n\n public override async call$<ReturnType = any, Parameters = any, Metadata extends BaseRemoteMethodMetadata = BaseRemoteMethodMetadata>(\n remoteMethodOrIdOrToken: string | BaseRemoteMethod<ReturnType, Parameters, Metadata> | Type<BaseRemoteMethod<ReturnType, Parameters, Metadata>> | InjectionToken<BaseRemoteMethod<ReturnType, Parameters, Metadata>> | AbstractType<BaseRemoteMethod<ReturnType, Parameters, Metadata>>,\n parameters?: Parameters,\n metadata?: Metadata,\n ): Promise<ReturnType> {\n\n if (typeof remoteMethodOrIdOrToken === 'string') {\n\n if (this.hasMock(remoteMethodOrIdOrToken)) {\n const resultFunction = this.getMock(remoteMethodOrIdOrToken)!;\n return await resultFunction(parameters, metadata);\n }\n return super.call$(remoteMethodOrIdOrToken, parameters, metadata);\n\n }\n\n return super.call$(remoteMethodOrIdOrToken, parameters, metadata);\n }\n\n}\n\nexport const REMOTE_METHOD_TESTING_LOADER_PROVIDER: Provider = {\n provide: RemoteMethodLoader,\n useClass: RemoteMethodTestingLoader,\n};\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAcM,MAAO,yBAA0B,SAAQ,kBAAkB,CAAA;AAAjE,IAAA,WAAA,GAAA;;AAEU,QAAA,IAAA,CAAA,mBAAmB,GAAG,IAAI,GAAG,EAA4B,CAAC;KAkDnE;IAhDQ,IAAI,CAAC,cAAsB,EAAE,gBAAwC,EAAA;AAC1E,QAAA,IAAI,cAAgC,CAAC;AACrC,QAAA,IAAI,OAAO,gBAAgB,KAAK,UAAU,EAAE;AAC1C,YAAA,cAAc,GAAG,MAAM,gBAAgB,CAAC;AACzC,SAAA;AAAM,aAAA;YACL,cAAc,GAAG,gBAAgB,CAAC;AACnC,SAAA;QACD,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;KAC9D;IAEM,UAAU,GAAA;AACf,QAAA,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,CAAC;KAClC;AAEM,IAAA,UAAU,CAAC,cAAsB,EAAA;QACtC,OAAO,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;KACxD;AAEM,IAAA,OAAO,CAAC,cAAsB,EAAA;QACnC,OAAO,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;KACrD;AAEM,IAAA,OAAO,CAAC,cAAsB,EAAA;AACnC,QAAA,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE;AACjC,YAAA,MAAM,IAAI,KAAK,CAAC,qCAAsC,cAAe,CAAA,mBAAA,CAAqB,CAAC,CAAC;AAC7F,SAAA;QACD,OAAO,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,cAAc,CAAE,CAAC;KACtD;AAEe,IAAA,MAAM,KAAK,CACzB,uBAAuR,EACvR,UAAuB,EACvB,QAAmB,EAAA;AAGnB,QAAA,IAAI,OAAO,uBAAuB,KAAK,QAAQ,EAAE;AAE/C,YAAA,IAAI,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC,EAAE;gBACzC,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAE,CAAC;AAC9D,gBAAA,OAAO,MAAM,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AACnD,aAAA;YACD,OAAO,KAAK,CAAC,KAAK,CAAC,uBAAuB,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAEnE,SAAA;QAED,OAAO,KAAK,CAAC,KAAK,CAAC,uBAAuB,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;KACnE;AAEF,CAAA;AAEY,MAAA,qCAAqC,GAAa;AAC7D,IAAA,OAAO,EAAE,kBAAkB;AAC3B,IAAA,QAAQ,EAAE,yBAAyB;;;ACtErC;;AAEG;;;;"}
1
+ {"version":3,"file":"rxap-remote-method-testing.mjs","sources":["../../../../../packages/angular/remote-method/testing/src/lib/remote-method-testing-loader.ts","../../../../../packages/angular/remote-method/testing/src/index.ts","../../../../../packages/angular/remote-method/testing/src/rxap-remote-method-testing.ts"],"sourcesContent":["import {\n BaseRemoteMethod,\n BaseRemoteMethodMetadata,\n RemoteMethodLoader,\n} from '@rxap/remote-method';\nimport {\n AbstractType,\n InjectionToken,\n Provider,\n Type,\n} from '@angular/core';\n\nexport type MockRemoteMethod = (parameters?: any, metadata?: any) => any;\n\nexport class RemoteMethodTestingLoader extends RemoteMethodLoader {\n\n private mockedRemoteMethods = new Map<string, MockRemoteMethod>();\n\n public mock(remoteMethodId: string, resultOrFunction: any | MockRemoteMethod): void {\n let resultFunction: MockRemoteMethod;\n if (typeof resultOrFunction !== 'function') {\n resultFunction = () => resultOrFunction;\n } else {\n resultFunction = resultOrFunction;\n }\n this.mockedRemoteMethods.set(remoteMethodId, resultFunction);\n }\n\n public clearMocks(): void {\n this.mockedRemoteMethods.clear();\n }\n\n public deleteMock(remoteMethodId: string): boolean {\n return this.mockedRemoteMethods.delete(remoteMethodId);\n }\n\n public hasMock(remoteMethodId: string): boolean {\n return this.mockedRemoteMethods.has(remoteMethodId);\n }\n\n public getMock(remoteMethodId: string): MockRemoteMethod {\n if (!this.hasMock(remoteMethodId)) {\n throw new Error(`A remote method mock with the id '${ remoteMethodId }' is not registered`);\n }\n return this.mockedRemoteMethods.get(remoteMethodId)!;\n }\n\n public override async call$<ReturnType = any, Parameters = any, Metadata extends BaseRemoteMethodMetadata = BaseRemoteMethodMetadata>(\n remoteMethodOrIdOrToken: string | BaseRemoteMethod<ReturnType, Parameters, Metadata> | Type<BaseRemoteMethod<ReturnType, Parameters, Metadata>> | InjectionToken<BaseRemoteMethod<ReturnType, Parameters, Metadata>> | AbstractType<BaseRemoteMethod<ReturnType, Parameters, Metadata>>,\n parameters?: Parameters,\n metadata?: Metadata,\n ): Promise<ReturnType> {\n\n if (typeof remoteMethodOrIdOrToken === 'string') {\n\n if (this.hasMock(remoteMethodOrIdOrToken)) {\n const resultFunction = this.getMock(remoteMethodOrIdOrToken)!;\n return await resultFunction(parameters, metadata);\n }\n return super.call$(remoteMethodOrIdOrToken, parameters, metadata);\n\n }\n\n return super.call$(remoteMethodOrIdOrToken, parameters, metadata);\n }\n\n}\n\nexport const REMOTE_METHOD_TESTING_LOADER_PROVIDER: Provider = {\n provide: RemoteMethodLoader,\n useClass: RemoteMethodTestingLoader,\n};\n","// region \nexport * from './lib/remote-method-testing-loader';\n// endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAcM,MAAO,yBAA0B,SAAQ,kBAAkB,CAAA;AAAjE,IAAA,WAAA,GAAA;;AAEU,QAAA,IAAA,CAAA,mBAAmB,GAAG,IAAI,GAAG,EAA4B,CAAC;KAkDnE;IAhDQ,IAAI,CA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AAE,UAAU,EAAE,QAAQ,CAAC,CAAC;SAEnE;QAED,OAAO,KAAK,CAAC,KAAK,CAAC,uBAAuB,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;KACnE;AAEF,CAAA;AAEY,MAAA,qCAAqC,GAAa;AAC7D,IAAA,OAAO,EAAE,kBAAkB;AAC3B,IAAA,QAAQ,EAAE,yBAAyB;;;ACtErC;AAEA;;ACFA;;AAEG;;;;"}
@@ -63,12 +63,12 @@ class BaseRemoteMethod extends BaseDefinition {
63
63
  }
64
64
  }
65
65
  }
66
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseRemoteMethod, deps: [{ token: INJECTOR, optional: true }, { token: REMOTE_METHOD_META_DATA, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
67
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseRemoteMethod }); }
66
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: BaseRemoteMethod, deps: [{ token: INJECTOR, optional: true }, { token: REMOTE_METHOD_META_DATA, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
67
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: BaseRemoteMethod }); }
68
68
  }
69
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: BaseRemoteMethod, decorators: [{
69
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: BaseRemoteMethod, decorators: [{
70
70
  type: Injectable
71
- }], ctorParameters: function () { return [{ type: i0.Injector, decorators: [{
71
+ }], ctorParameters: () => [{ type: i0.Injector, decorators: [{
72
72
  type: Optional
73
73
  }, {
74
74
  type: Inject,
@@ -78,21 +78,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
78
78
  }, {
79
79
  type: Inject,
80
80
  args: [REMOTE_METHOD_META_DATA]
81
- }] }]; } });
82
-
83
- class RemoteMethodLoader extends DefinitionLoader {
84
- async call$(remoteMethodIdOrInstanceOrToken, parameters, metadata, injector, notFoundValue, flags) {
85
- return this
86
- .load(remoteMethodIdOrInstanceOrToken, metadata, injector, notFoundValue, flags)
87
- .call(parameters);
88
- }
89
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RemoteMethodLoader, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
90
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RemoteMethodLoader, providedIn: 'root' }); }
91
- }
92
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: RemoteMethodLoader, decorators: [{
93
- type: Injectable,
94
- args: [{ providedIn: 'root' }]
95
- }] });
81
+ }] }] });
96
82
 
97
83
  class ProxyRemoteMethod extends BaseRemoteMethod {
98
84
  constructor(remoteMethod, injector = null, metadata = remoteMethod.metadata) {
@@ -102,12 +88,12 @@ class ProxyRemoteMethod extends BaseRemoteMethod {
102
88
  async _call(parameters) {
103
89
  return this.remoteMethod.call(await this.transformParameters(parameters));
104
90
  }
105
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ProxyRemoteMethod, deps: [{ token: RXAP_PROXY_REMOTE_METHOD_TARGET }, { token: INJECTOR }, { token: REMOTE_METHOD_META_DATA }], target: i0.ɵɵFactoryTarget.Injectable }); }
106
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ProxyRemoteMethod }); }
91
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: ProxyRemoteMethod, deps: [{ token: RXAP_PROXY_REMOTE_METHOD_TARGET }, { token: INJECTOR }, { token: REMOTE_METHOD_META_DATA }], target: i0.ɵɵFactoryTarget.Injectable }); }
92
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: ProxyRemoteMethod }); }
107
93
  }
108
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: ProxyRemoteMethod, decorators: [{
94
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: ProxyRemoteMethod, decorators: [{
109
95
  type: Injectable
110
- }], ctorParameters: function () { return [{ type: BaseRemoteMethod, decorators: [{
96
+ }], ctorParameters: () => [{ type: BaseRemoteMethod, decorators: [{
111
97
  type: Inject,
112
98
  args: [RXAP_PROXY_REMOTE_METHOD_TARGET]
113
99
  }] }, { type: i0.Injector, decorators: [{
@@ -116,7 +102,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
116
102
  }] }, { type: undefined, decorators: [{
117
103
  type: Inject,
118
104
  args: [REMOTE_METHOD_META_DATA]
119
- }] }]; } });
105
+ }] }] });
106
+
107
+ class RemoteMethodLoader extends DefinitionLoader {
108
+ async call$(remoteMethodIdOrInstanceOrToken, parameters, metadata, injector, notFoundValue, flags) {
109
+ return this
110
+ .load(remoteMethodIdOrInstanceOrToken, metadata, injector, notFoundValue, flags)
111
+ .call(parameters);
112
+ }
113
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: RemoteMethodLoader, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
114
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: RemoteMethodLoader, providedIn: 'root' }); }
115
+ }
116
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.1.3", ngImport: i0, type: RemoteMethodLoader, decorators: [{
117
+ type: Injectable,
118
+ args: [{ providedIn: 'root' }]
119
+ }] });
120
+
121
+ // region
122
+ // endregion
120
123
 
121
124
  /**
122
125
  * Generated bundle index. Do not edit.
@@ -1 +1 @@
1
- {"version":3,"file":"rxap-remote-method.mjs","sources":["../../../../../packages/angular/remote-method/src/lib/tokens.ts","../../../../../packages/angular/remote-method/src/lib/error.ts","../../../../../packages/angular/remote-method/src/lib/base.remote-method.ts","../../../../../packages/angular/remote-method/src/lib/remote-method-loader.ts","../../../../../packages/angular/remote-method/src/lib/proxy.remote-method.ts","../../../../../packages/angular/remote-method/src/rxap-remote-method.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const REMOTE_METHOD_META_DATA = new InjectionToken('rxap/remote-method/REMOTE_METHOD_META_DATA');\nexport const RXAP_PROXY_REMOTE_METHOD_TARGET = new InjectionToken('rxap/remote-method/proxy/target');\n","import { RxapError } from '@rxap/utilities';\n\nexport class RxapRemoteMethodError extends RxapError {\n\n constructor(message: string, code: string, className?: string) {\n super('@rxap/remote-method', message, code, className);\n }\n\n}\n\n","import {\n AbstractType,\n Inject,\n Injectable,\n InjectFlags,\n InjectionToken,\n Injector,\n INJECTOR,\n Optional,\n Type,\n} from '@angular/core';\nimport { REMOTE_METHOD_META_DATA } from './tokens';\nimport {\n BaseDefinition,\n BaseDefinitionMetadata,\n DefinitionMetadata,\n} from '@rxap/definition';\nimport { Subject } from 'rxjs';\nimport { RxapRemoteMethodError } from './error';\nimport { Refreshable } from '@rxap/utilities';\nimport { CounterSubject } from '@rxap/rxjs';\n\nexport interface BaseRemoteMethodMetadata extends BaseDefinitionMetadata {\n refresh?: Array<Type<Refreshable> | InjectionToken<Refreshable> | AbstractType<Refreshable>>;\n}\n\nexport function RxapRemoteMethod<MetaData extends BaseDefinitionMetadata = BaseDefinitionMetadata>(\n metadataOrId: MetaData | string,\n className = 'BaseRemoteMethod',\n packageName = '@rxap/remote-method',\n) {\n return function (target: any) {\n DefinitionMetadata(metadataOrId, className, packageName)(target);\n };\n}\n\n@Injectable()\nexport abstract class BaseRemoteMethod<ReturnType = any,\n Parameter = any,\n Metadata extends BaseRemoteMethodMetadata = BaseRemoteMethodMetadata> extends BaseDefinition<Metadata> {\n\n public executed$: Subject<ReturnType> = new Subject<ReturnType>();\n\n public executionsInProgress$: CounterSubject = new CounterSubject();\n\n public readonly injector: Injector;\n\n private _pauseRefresh = false;\n\n constructor(\n @Optional()\n @Inject(INJECTOR)\n injector: Injector | null = null,\n @Optional()\n @Inject(REMOTE_METHOD_META_DATA)\n metaData: any | null = null,\n ) {\n super(metaData);\n if (injector === undefined) {\n throw new RxapRemoteMethodError(\n 'Injector is undefined. Ensure that the Injector is added to the deps property!',\n '',\n this.constructor.name,\n );\n }\n this.injector = injector ?? Injector.NULL;\n if (typeof this.injector.get !== 'function') {\n throw new RxapRemoteMethodError(\n 'The property injector is not Injector like. Check the deps property!',\n '',\n this.constructor.name,\n );\n }\n }\n\n public async call(parameters?: Parameter): Promise<ReturnType> {\n this.init();\n this.executionsInProgress$.increase();\n const result = await this._call(parameters);\n this.executionsInProgress$.decrease();\n this.executed$.next(result);\n this.executed(result);\n return result;\n }\n\n public executed(result: ReturnType): void {\n if (!this._pauseRefresh) {\n this.refresh();\n }\n }\n\n public pauseRefresh(): void {\n this._pauseRefresh = true;\n }\n\n public resumeRefresh(): void {\n this._pauseRefresh = false;\n }\n\n public refresh(): void {\n if (this.metadata.refresh) {\n for (const refresh of this.metadata.refresh) {\n const canRefresh = this.injector.get(refresh, null, InjectFlags.Optional);\n if (canRefresh) {\n canRefresh.refresh();\n }\n }\n }\n }\n\n protected abstract _call(parameters?: Parameter): Promise<ReturnType> | ReturnType;\n\n}\n\n\n","import {\n Injectable,\n InjectFlags,\n Injector,\n} from '@angular/core';\nimport {\n BaseRemoteMethod,\n BaseRemoteMethodMetadata,\n} from './base.remote-method';\nimport {\n DefinitionLoader,\n IdOrInstanceOrToken,\n} from '@rxap/definition';\n\n@Injectable({ providedIn: 'root' })\nexport class RemoteMethodLoader extends DefinitionLoader {\n\n public async call$<ReturnType = any, Parameters = any, Metadata extends BaseRemoteMethodMetadata = BaseRemoteMethodMetadata>(\n remoteMethodIdOrInstanceOrToken: IdOrInstanceOrToken<BaseRemoteMethod<ReturnType, Parameters, Metadata>>,\n parameters: Parameters,\n metadata?: Partial<BaseRemoteMethodMetadata>,\n injector?: Injector,\n notFoundValue?: BaseRemoteMethod<ReturnType, Parameters, Metadata>,\n flags?: InjectFlags,\n ): Promise<ReturnType> {\n return this\n .load(\n remoteMethodIdOrInstanceOrToken,\n metadata,\n injector,\n notFoundValue,\n flags,\n )\n .call(parameters);\n }\n\n}\n","import {\n Inject,\n Injectable,\n INJECTOR,\n Injector,\n} from '@angular/core';\nimport {\n BaseRemoteMethod,\n BaseRemoteMethodMetadata,\n} from './base.remote-method';\nimport {\n REMOTE_METHOD_META_DATA,\n RXAP_PROXY_REMOTE_METHOD_TARGET,\n} from './tokens';\n\n@Injectable()\nexport abstract class ProxyRemoteMethod<ReturnType = any, SourceParameter = any, TargetParameter = SourceParameter>\n extends BaseRemoteMethod<ReturnType, SourceParameter> {\n\n constructor(\n @Inject(RXAP_PROXY_REMOTE_METHOD_TARGET)\n private readonly remoteMethod: BaseRemoteMethod,\n @Inject(INJECTOR)\n injector: Injector | null = null,\n @Inject(REMOTE_METHOD_META_DATA)\n metadata: BaseRemoteMethodMetadata = remoteMethod.metadata,\n ) {\n super(injector, metadata);\n }\n\n public abstract transformParameters(parameters?: SourceParameter): TargetParameter | Promise<TargetParameter>;\n\n protected async _call(parameters?: SourceParameter): Promise<any> {\n return this.remoteMethod.call(await this.transformParameters(parameters));\n }\n\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAEa,uBAAuB,GAAG,IAAI,cAAc,CAAC,4CAA4C,EAAE;MA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,YAAY,CAAkB;KAOhD;IAIS,MAAM,KAAK,CAAC,UAA4B,EAAA;AAChD,QAAA,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC,CAAC;KAC3E;AAlBmB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,iBAAiB,EAI3B,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,+BAA+B,EAE/B,EAAA,EAAA,KAAA,EAAA,QAAQ,aAER,uBAAuB,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA,EAAA;mHARb,iBAAiB,EAAA,CAAA,CAAA,EAAA;;4FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBADtC,UAAU;;0BAKN,MAAM;2BAAC,+BAA+B,CAAA;;0BAEtC,MAAM;2BAAC,QAAQ,CAAA;;0BAEf,MAAM;2BAAC,uBAAuB,CAAA;;;ACxBnC;;AAEG;;;;"}
1
+ {"version":3,"file":"rxap-remote-method.mjs","sources":["../../../../../packages/angular/remote-method/src/lib/tokens.ts","../../../../../packages/angular/remote-method/src/lib/error.ts","../../../../../packages/angular/remote-method/src/lib/base.remote-method.ts","../../../../../packages/angular/remote-method/src/lib/proxy.remote-method.ts","../../../../../packages/angular/remote-method/src/lib/remote-method-loader.ts","../../../../../packages/angular/remote-method/src/index.ts","../../../../../packages/angular/remote-method/src/rxap-remote-method.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const REMOTE_METHOD_META_DATA = new InjectionToken('rxap/remote-method/REMOTE_METHOD_META_DATA');\nexport const RXAP_PROXY_REMOTE_METHOD_TARGET = new InjectionToken('rxap/remote-method/proxy/target');\n","import { RxapError } from '@rxap/utilities';\n\nexport class RxapRemoteMethodError extends RxapError {\n\n constructor(message: string, code: string, className?: string) {\n super('@rxap/remote-method', message, code, className);\n }\n\n}\n\n","import {\n AbstractType,\n Inject,\n Injectable,\n InjectFlags,\n InjectionToken,\n Injector,\n INJECTOR,\n Optional,\n Type,\n} from '@angular/core';\nimport { REMOTE_METHOD_META_DATA } from './tokens';\nimport {\n BaseDefinition,\n BaseDefinitionMetadata,\n DefinitionMetadata,\n} from '@rxap/definition';\nimport { Subject } from 'rxjs';\nimport { RxapRemoteMethodError } from './error';\nimport { Refreshable } from '@rxap/utilities';\nimport { CounterSubject } from '@rxap/rxjs';\n\nexport interface BaseRemoteMethodMetadata extends BaseDefinitionMetadata {\n refresh?: Array<Type<Refreshable> | InjectionToken<Refreshable> | AbstractType<Refreshable>>;\n}\n\nexport function RxapRemoteMethod<MetaData extends BaseDefinitionMetadata = BaseDefinitionMetadata>(\n metadataOrId: MetaData | string,\n className = 'BaseRemoteMethod',\n packageName = '@rxap/remote-method',\n) {\n return function (target: any) {\n DefinitionMetadata(metadataOrId, className, packageName)(target);\n };\n}\n\n@Injectable()\nexport abstract class BaseRemoteMethod<ReturnType = any,\n Parameter = any,\n Metadata extends BaseRemoteMethodMetadata = BaseRemoteMethodMetadata> extends BaseDefinition<Metadata> {\n\n public executed$: Subject<ReturnType> = new Subject<ReturnType>();\n\n public executionsInProgress$: CounterSubject = new CounterSubject();\n\n public readonly injector: Injector;\n\n private _pauseRefresh = false;\n\n constructor(\n @Optional()\n @Inject(INJECTOR)\n injector: Injector | null = null,\n @Optional()\n @Inject(REMOTE_METHOD_META_DATA)\n metaData: any | null = null,\n ) {\n super(metaData);\n if (injector === undefined) {\n throw new RxapRemoteMethodError(\n 'Injector is undefined. Ensure that the Injector is added to the deps property!',\n '',\n this.constructor.name,\n );\n }\n this.injector = injector ?? Injector.NULL;\n if (typeof this.injector.get !== 'function') {\n throw new RxapRemoteMethodError(\n 'The property injector is not Injector like. Check the deps property!',\n '',\n this.constructor.name,\n );\n }\n }\n\n public async call(parameters?: Parameter): Promise<ReturnType> {\n this.init();\n this.executionsInProgress$.increase();\n const result = await this._call(parameters);\n this.executionsInProgress$.decrease();\n this.executed$.next(result);\n this.executed(result);\n return result;\n }\n\n public executed(result: ReturnType): void {\n if (!this._pauseRefresh) {\n this.refresh();\n }\n }\n\n public pauseRefresh(): void {\n this._pauseRefresh = true;\n }\n\n public resumeRefresh(): void {\n this._pauseRefresh = false;\n }\n\n public refresh(): void {\n if (this.metadata.refresh) {\n for (const refresh of this.metadata.refresh) {\n const canRefresh = this.injector.get(refresh, null, InjectFlags.Optional);\n if (canRefresh) {\n canRefresh.refresh();\n }\n }\n }\n }\n\n protected abstract _call(parameters?: Parameter): Promise<ReturnType> | ReturnType;\n\n}\n\n\n","import {\n Inject,\n Injectable,\n INJECTOR,\n Injector,\n} from '@angular/core';\nimport {\n BaseRemoteMethod,\n BaseRemoteMethodMetadata,\n} from './base.remote-method';\nimport {\n REMOTE_METHOD_META_DATA,\n RXAP_PROXY_REMOTE_METHOD_TARGET,\n} from './tokens';\n\n@Injectable()\nexport abstract class ProxyRemoteMethod<ReturnType = any, SourceParameter = any, TargetParameter = SourceParameter>\n extends BaseRemoteMethod<ReturnType, SourceParameter> {\n\n constructor(\n @Inject(RXAP_PROXY_REMOTE_METHOD_TARGET)\n private readonly remoteMethod: BaseRemoteMethod,\n @Inject(INJECTOR)\n injector: Injector | null = null,\n @Inject(REMOTE_METHOD_META_DATA)\n metadata: BaseRemoteMethodMetadata = remoteMethod.metadata,\n ) {\n super(injector, metadata);\n }\n\n public abstract transformParameters(parameters?: SourceParameter): TargetParameter | Promise<TargetParameter>;\n\n protected async _call(parameters?: SourceParameter): Promise<any> {\n return this.remoteMethod.call(await this.transformParameters(parameters));\n }\n\n}\n","import {\n Injectable,\n InjectFlags,\n Injector,\n} from '@angular/core';\nimport {\n BaseRemoteMethod,\n BaseRemoteMethodMetadata,\n} from './base.remote-method';\nimport {\n DefinitionLoader,\n IdOrInstanceOrToken,\n} from '@rxap/definition';\n\n@Injectable({ providedIn: 'root' })\nexport class RemoteMethodLoader extends DefinitionLoader {\n\n public async call$<ReturnType = any, Parameters = any, Metadata extends BaseRemoteMethodMetadata = BaseRemoteMethodMetadata>(\n remoteMethodIdOrInstanceOrToken: IdOrInstanceOrToken<BaseRemoteMethod<ReturnType, Parameters, Metadata>>,\n parameters: Parameters,\n metadata?: Partial<BaseRemoteMethodMetadata>,\n injector?: Injector,\n notFoundValue?: BaseRemoteMethod<ReturnType, Parameters, Metadata>,\n flags?: InjectFlags,\n ): Promise<ReturnType> {\n return this\n .load(\n remoteMethodIdOrInstanceOrToken,\n metadata,\n injector,\n notFoundValue,\n flags,\n )\n .call(parameters);\n }\n\n}\n","// region \nexport * from './lib/base.remote-method';\nexport * from './lib/error';\nexport * from './lib/proxy.remote-method';\nexport * from './lib/remote-method-loader';\nexport * from './lib/tokens';\n// endregion\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;MAEa,uBAAuB,GAAG,IAAI,cAAc,CAAC,4CAA4C,EAAE;MAC3F,+BAA+B,GAAG,IAAI,cAAc,CAAC,iCAAiC;;ACD7F,MAAO,qBAAsB,SAAQ,SAAS,CAAA;AAElD,IAAA,WAAA,CAAY,OAAe,EAAE,IAAY,EAAE,SAAkB,EAAA;QAC3D,KAAK,CAAC,qBAAqB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;KACxD;AAEF;;ACkBK,SAAU,gBAAgB,CAC9B,YAA+B,EAC/B,SAAS,GAAG,kBAAkB,EAC9B,WAAW,GAAG,qBAAqB,EAAA;AAEnC,IAAA,OAAO,UAAU,MAAW,EAAA;QAC1B,kBAAkB,CAAC,YAAY,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AACnE,KAAC,CAAC;AACJ,CAAC;AAGK,MAAgB,gBAEkD,SAAQ,cAAwB,CAAA;AAUtG,IAA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,EAAA,IAAA,EAAA,kBAAkB,cADL,MAAM,EAAA,CAAA,CAAA,EAAA;;2FACnB,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAD9B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAA;;;ACdlC;AAMA;;ACNA;;AAEG;;;;"}
@@ -1,2 +1,2 @@
1
- export * from './lib/http-remote-method.directive';
2
1
  export * from './lib/contenteditable.directive';
2
+ export * from './lib/http-remote-method.directive';
package/http/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from './lib/http.remote-method';
2
- export * from './lib/http-remote-method.loader';
3
1
  export * from './lib/base-http.remote-method';
2
+ export * from './lib/http-remote-method.loader';
3
+ export * from './lib/http.remote-method';
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './lib/base.remote-method';
2
- export * from './lib/remote-method-loader';
3
- export * from './lib/tokens';
4
2
  export * from './lib/error';
5
3
  export * from './lib/proxy.remote-method';
4
+ export * from './lib/remote-method-loader';
5
+ export * from './lib/tokens';