@angular-wave/angular.ts 0.15.1 → 0.16.0

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 (66) hide show
  1. package/@types/angular.d.ts +3 -0
  2. package/@types/animations/interface.d.ts +4 -0
  3. package/@types/animations/runner/animate-runner.d.ts +2 -1
  4. package/@types/animations/shared.d.ts +100 -44
  5. package/@types/core/compile/attributes.d.ts +34 -18
  6. package/@types/core/compile/compile.d.ts +4 -5
  7. package/@types/core/controller/interface.d.ts +1 -1
  8. package/@types/core/di/di.d.ts +0 -10
  9. package/@types/core/di/interface.d.ts +28 -0
  10. package/@types/core/di/internal-injector.d.ts +28 -19
  11. package/@types/core/di/ng-module/ng-module.d.ts +35 -4
  12. package/@types/core/interpolate/interpolate.d.ts +1 -1
  13. package/@types/core/parse/ast/ast.d.ts +6 -12
  14. package/@types/core/parse/ast-type.d.ts +1 -1
  15. package/@types/core/parse/interface.d.ts +8 -40
  16. package/@types/core/parse/interpreter.d.ts +4 -3
  17. package/@types/core/parse/lexer/lexer.d.ts +2 -30
  18. package/@types/core/parse/parse.d.ts +1 -34
  19. package/@types/core/parse/parser/parser.d.ts +2 -13
  20. package/@types/core/sanitize/sanitize-uri.d.ts +2 -2
  21. package/@types/core/scope/interface.d.ts +1 -0
  22. package/@types/core/scope/scope.d.ts +25 -28
  23. package/@types/directive/form/form.d.ts +8 -40
  24. package/@types/directive/input/input.d.ts +8 -40
  25. package/@types/directive/model/model.d.ts +34 -30
  26. package/@types/directive/model-options/model-options.d.ts +1 -2
  27. package/@types/directive/show-hide/show-hide.d.ts +2 -1
  28. package/@types/directive/validators/validators.d.ts +5 -7
  29. package/@types/filters/order-by.d.ts +2 -1
  30. package/@types/interface.d.ts +3 -2
  31. package/@types/namespace.d.ts +25 -3
  32. package/@types/router/state/state-object.d.ts +2 -2
  33. package/@types/router/state/state-service.d.ts +1 -0
  34. package/@types/router/template-factory.d.ts +4 -5
  35. package/@types/router/transition/reject-factory.d.ts +32 -9
  36. package/@types/router/transition/transition-event-type.d.ts +2 -2
  37. package/@types/router/transition/transition-hook.d.ts +5 -2
  38. package/@types/router/transition/transition-service.d.ts +2 -2
  39. package/@types/router/transition/transition.d.ts +2 -2
  40. package/@types/router/view/view.d.ts +4 -4
  41. package/@types/services/http/http.d.ts +1 -1
  42. package/@types/services/http/interface.d.ts +0 -7
  43. package/@types/services/pubsub/pubsub.d.ts +2 -2
  44. package/@types/services/sce/interface.d.ts +8 -0
  45. package/@types/services/sce/sce.d.ts +10 -7
  46. package/@types/services/sse/interface.d.ts +5 -20
  47. package/@types/services/storage/storage.d.ts +2 -2
  48. package/@types/services/stream/interface.d.ts +1 -0
  49. package/@types/services/stream/stream.d.ts +1 -1
  50. package/@types/services/template-request/interface.d.ts +2 -9
  51. package/@types/services/template-request/template-request.d.ts +6 -40
  52. package/@types/services/websocket/interface.d.ts +16 -0
  53. package/@types/services/websocket/websocket.d.ts +20 -0
  54. package/@types/shared/common.d.ts +48 -27
  55. package/@types/shared/constants.d.ts +2 -8
  56. package/@types/shared/dom.d.ts +33 -19
  57. package/@types/shared/utils.d.ts +8 -18
  58. package/README.md +15 -7
  59. package/dist/angular-ts.esm.js +4336 -4850
  60. package/dist/angular-ts.umd.js +4336 -4850
  61. package/dist/angular-ts.umd.min.js +1 -1
  62. package/dist/angular-ts.umd.min.js.gz +0 -0
  63. package/dist/angular-ts.umd.min.js.map +1 -1
  64. package/package.json +1 -1
  65. package/@types/core/di/inteface.d.ts +0 -11
  66. /package/@types/core/compile/{inteface.d.ts → interface.d.ts} +0 -0
@@ -32,7 +32,7 @@ export const requiredDirective: (
32
32
  * parsable into a `RegExp`, or a `RegExp` literal. See above for
33
33
  * more details.
34
34
  *
35
- * @description
35
+ *
36
36
  *
37
37
  * ngPattern adds the pattern {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
38
38
  * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.
@@ -68,16 +68,14 @@ export const requiredDirective: (
68
68
  */
69
69
  export const patternDirective: (
70
70
  | string
71
- | ((
72
- $parse: import("../../core/parse/interface.ts").ParseService,
73
- ) => ng.Directive)
71
+ | (($parse: ng.ParseService) => ng.Directive)
74
72
  )[];
75
73
  /**
76
74
  * @param {string} ngMaxlength AngularTS expression that must evaluate to a `Number` or `String`
77
75
  * parsable into a `Number`. Used as value for the `maxlength`
78
76
  * {@link ngModel.NgModelController#$validators validator}.
79
77
  *
80
- * @description
78
+ *
81
79
  *
82
80
  * ngMaxlength adds the maxlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
83
81
  * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.
@@ -112,7 +110,7 @@ export const maxlengthDirective: (
112
110
  * parsable into a `Number`. Used as value for the `minlength`
113
111
  * {@link ngModel.NgModelController#$validators validator}.
114
112
  *
115
- * @description
113
+ *
116
114
  *
117
115
  * ngMinlength adds the minlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
118
116
  * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.
@@ -139,7 +137,7 @@ export const maxlengthDirective: (
139
137
  */
140
138
  export const minlengthDirective: (
141
139
  | string
142
- | (($parse: any) => {
140
+ | (($parse: ng.ParseService) => {
143
141
  restrict: string;
144
142
  require: string;
145
143
  link(scope: any, elm: any, attr: any, ctrl: any): void;
@@ -1,7 +1,8 @@
1
1
  /**
2
+ * @param {ng.ParseService} $parse
2
3
  * @returns {ng.FilterFn}
3
4
  */
4
- export function orderByFilter($parse: any): ng.FilterFn;
5
+ export function orderByFilter($parse: ng.ParseService): ng.FilterFn;
5
6
  export namespace orderByFilter {
6
7
  let $inject: string[];
7
8
  }
@@ -44,6 +44,7 @@ export declare const PublicInjectionTokens: {
44
44
  readonly $url: "$url";
45
45
  readonly $view: "$view";
46
46
  readonly $window: "$window";
47
+ readonly $websocket: "$websocket";
47
48
  readonly $provide: "$provide";
48
49
  readonly $injector: "$injector";
49
50
  readonly $compileProvider: "$compileProvider";
@@ -429,9 +430,9 @@ export interface Directive<TController = any> {
429
430
  templateUrl?: string | ((element: Element, attrs: Attributes) => string);
430
431
  /** Enables transclusion or configures named slots */
431
432
  transclude?: boolean | string | Record<string, string>;
432
- /** Internal hook for directive compilation state */
433
- $$addStateInfo?: (...args: any[]) => any;
434
433
  count?: number;
434
+ /** Internal hook for directive compilation state */
435
+ _addStateInfo?: (...args: any[]) => any;
435
436
  }
436
437
  export type DirectiveFactoryFn = (
437
438
  ...args: any[]
@@ -2,6 +2,7 @@ export { angular } from "./index.js";
2
2
  import { Angular as TAngular } from "./angular.js";
3
3
  import { Attributes as TAttributes } from "./core/compile/attributes.js";
4
4
  import { Scope as TScope } from "./core/scope/scope.js";
5
+ import { ProviderCache as TProviderCache } from "./core/di/interface.ts";
5
6
  import {
6
7
  ListenerFn as TListenerFn,
7
8
  Listener as TListener,
@@ -20,7 +21,11 @@ import { ExceptionHandler as TExceptionHandler } from "./services/exception/inte
20
21
  import { ExceptionHandlerProvider as TExceptionHandlerProvider } from "./services/exception/exception.js";
21
22
  import { ParseService as TParseService } from "./core/parse/interface.ts";
22
23
  import { TemplateRequestService as TTemplateRequestService } from "./services/template-request/interface.ts";
23
- import { HttpParamSerializer as THttpParamSerializer } from "./services/http/interface.ts";
24
+ import {
25
+ HttpParamSerializer as THttpParamSerializer,
26
+ HttpProviderDefaults as THttpProviderDefaults,
27
+ RequestShortcutConfig as TRequestShortcutConfig,
28
+ } from "./services/http/interface.ts";
24
29
  import { HttpParamSerializerProvider as THttpParamSerializerProvider } from "./services/http/http.js";
25
30
  import {
26
31
  FilterFactory as TFilterFactory,
@@ -42,6 +47,7 @@ import {
42
47
  PubSub as TPubSub,
43
48
  } from "./services/pubsub/pubsub.js";
44
49
  import {
50
+ AnnotatedFactory as TAnnotatedFactory,
45
51
  Directive as TDirective,
46
52
  DirectiveFactory as TDirectiveFactory,
47
53
  AnnotatedDirectiveFactory as TAnnotatedDirectiveFactory,
@@ -69,14 +75,17 @@ import {
69
75
  TranscludeFn as TTranscludeFn,
70
76
  LinkFnMapping as TLinkFnMapping,
71
77
  CompositeLinkFn as TCompositeLinkFn,
72
- } from "./core/compile/inteface.ts";
78
+ } from "./core/compile/interface.ts";
73
79
  import {
74
80
  WorkerConnection as TWorkerConnection,
75
81
  WorkerConfig as TWorkerConfig,
76
82
  } from "./directive/worker/interface.ts";
77
83
  import { Provider as TProvideService } from "./interface.ts";
78
84
  import { Location as TLocationService } from "./services/location/location.js";
79
- import { AnimateService as TAnimateService } from "./animations/interface.ts";
85
+ import {
86
+ AnimateService as TAnimateService,
87
+ AnimationOptions as TAnimationOptions,
88
+ } from "./animations/interface.ts";
80
89
  import {
81
90
  StorageBackend as TStorageBackend,
82
91
  StorageType as TStorageType,
@@ -112,9 +121,14 @@ import {
112
121
  SCEService as TSCEService,
113
122
  SCEDelegateService as TSCEDelegateService,
114
123
  } from "./services/sce/interface.ts";
124
+ import {
125
+ WebSocketConfig as TWebSocketConfig,
126
+ WebSocketService as TWebSocketService,
127
+ } from "./services/websocket/interface.ts";
115
128
  declare global {
116
129
  interface Function {
117
130
  $inject?: readonly string[] | undefined;
131
+ $nonscope?: readonly string[] | boolean | undefined;
118
132
  }
119
133
  interface Window {
120
134
  angular: TAngular;
@@ -181,6 +195,7 @@ declare global {
181
195
  type UrlService = TUrlService;
182
196
  type ViewService = TViewService;
183
197
  type ViewScrollService = TViewScrollService;
198
+ type AnimationOptions = TAnimationOptions;
184
199
  type ErrorHandlingConfig = TErrorHandlingConfig;
185
200
  type ListenerFn = TListenerFn;
186
201
  type Listener = TListener;
@@ -194,6 +209,8 @@ declare global {
194
209
  | ((...args: any[]) => any)
195
210
  | (abstract new (...args: any[]) => any),
196
211
  > = TInjectable<T>;
212
+ type AnnotatedFactory<T extends (...args: any[]) => any> =
213
+ TAnnotatedFactory<T>;
197
214
  type StorageBackend = TStorageBackend;
198
215
  type StorageType = TStorageType;
199
216
  type StreamConnectionConfig = TStreamConnectionConfig;
@@ -214,5 +231,10 @@ declare global {
214
231
  type AnchorScrollObject = TAnchorScrollObject;
215
232
  type InjectionTokens = typeof PublicInjectionTokens;
216
233
  type ScopeEvent = TScopeEvent;
234
+ type RequestShortcutConfig = TRequestShortcutConfig;
235
+ type HttpProviderDefaults = THttpProviderDefaults;
236
+ type ProviderCache = TProviderCache;
237
+ type WebSocketConfig = TWebSocketConfig;
238
+ type WebSocketService = TWebSocketService;
217
239
  }
218
240
  }
@@ -7,9 +7,9 @@
7
7
  *
8
8
  * This class prototypally inherits from the corresponding [[StateDeclaration]].
9
9
  * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]].
10
- * @implements {ng.StateDeclaration}
10
+ * @extends {ng.StateDeclaration}
11
11
  */
12
- export class StateObject implements ng.StateDeclaration {
12
+ export class StateObject {
13
13
  /**
14
14
  * @param {import('./interface.ts').StateDeclaration} config
15
15
  */
@@ -1,3 +1,4 @@
1
+ export function silentRejection<E = unknown>(error: E): Promise<never>;
1
2
  /**
2
3
  * Provides services related to ng-router states.
3
4
  *
@@ -14,11 +14,11 @@ export class TemplateFactoryProvider {
14
14
  | ((
15
15
  $http: ng.HttpService,
16
16
  $templateCache: ng.TemplateCacheService,
17
- $templateRequest: any,
17
+ $templateRequest: ng.TemplateRequestService,
18
18
  $injector: import("../core/di/internal-injector.js").InjectorService,
19
19
  ) => this)
20
20
  )[];
21
- $templateRequest: any;
21
+ $templateRequest: import("../services/template-request/interface.ts").TemplateRequestService;
22
22
  $http: import("../services/http/interface.ts").HttpService;
23
23
  $templateCache: ng.TemplateCacheService;
24
24
  $injector: import("../core/di/internal-injector.js").InjectorService;
@@ -62,10 +62,9 @@ export class TemplateFactoryProvider {
62
62
  * @param {string|Function} url url of the template to load, or a function
63
63
  * that returns a url.
64
64
  * @param {Object} params Parameters to pass to the url function.
65
- * @return {string|Promise.<string>} The template html as a string, or a promise
66
- * for that string.
65
+ * @return {Promise<string>}
67
66
  */
68
- fromUrl(url: string | Function, params: any): string | Promise<string>;
67
+ fromUrl(url: string | Function, params: any): Promise<string>;
69
68
  /**
70
69
  * Creates a template by invoking an injectable provider function.
71
70
  *
@@ -12,15 +12,26 @@ export namespace RejectType {
12
12
  export class Rejection {
13
13
  /** Returns a Rejection due to transition superseded */
14
14
  static superseded(detail: any, options: any): Rejection;
15
- /** Returns a Rejection due to redirected transition */
15
+ /** Returns a Rejection due to redirected transition
16
+ * @param {any} detail @returns {Rejection}
17
+ */
16
18
  static redirected(detail: any): Rejection;
17
- /** Returns a Rejection due to invalid transition */
19
+ /** Returns a Rejection due to invalid transition
20
+ * @param {any} detail @returns {Rejection}
21
+ */
18
22
  static invalid(detail: any): Rejection;
19
- /** Returns a Rejection due to ignored transition */
23
+ /** Returns a Rejection due to ignored transition
24
+ * @param {any} detail @returns {Rejection}
25
+ */
20
26
  static ignored(detail: any): Rejection;
21
- /** Returns a Rejection due to aborted transition */
27
+ /** Returns a Rejection due to aborted transition
28
+ * @param {any} detail @returns {Rejection}
29
+ */
22
30
  static aborted(detail: any): Rejection;
23
- /** Returns a Rejection due to aborted transition */
31
+ /** Returns a Rejection due to aborted transition
32
+ * @param detail
33
+ * @returns {Rejection}
34
+ */
24
35
  static errored(detail: any): Rejection;
25
36
  /**
26
37
  * Returns a Rejection
@@ -32,12 +43,24 @@ export class Rejection {
32
43
  * @returns `detail` if it is already a `Rejection`, else returns an ERROR Rejection.
33
44
  */
34
45
  static normalize(detail: any): any;
35
- constructor(type: any, message: any, detail: any);
46
+ /**
47
+ * @param {number} type
48
+ * @param {string} message
49
+ * @param {any} detail
50
+ */
51
+ constructor(type: number, message: string, detail: any);
52
+ /** @type {number} */
36
53
  $id: number;
37
- type: any;
38
- message: any;
54
+ type: number;
55
+ message: string;
39
56
  detail: any;
40
57
  redirected: boolean;
58
+ /** @returns {string} */
41
59
  toString(): string;
42
- toPromise(): any;
60
+ /**
61
+ * @returns {Promise<any> & {_transitionRejection: Rejection}}
62
+ */
63
+ toPromise(): Promise<any> & {
64
+ _transitionRejection: Rejection;
65
+ };
43
66
  }
@@ -10,7 +10,7 @@ export class TransitionEventType {
10
10
  criteriaMatchPath: any,
11
11
  reverseSort?: boolean,
12
12
  getResultHandler?: (hook: any) => (result: any) => any,
13
- getErrorHandler?: () => (error: any) => any,
13
+ getErrorHandler?: () => (error: any) => Promise<never>,
14
14
  synchronous?: boolean,
15
15
  );
16
16
  name: any;
@@ -19,6 +19,6 @@ export class TransitionEventType {
19
19
  criteriaMatchPath: any;
20
20
  reverseSort: boolean;
21
21
  getResultHandler: (hook: any) => (result: any) => any;
22
- getErrorHandler: () => (error: any) => any;
22
+ getErrorHandler: () => (error: any) => Promise<never>;
23
23
  synchronous: boolean;
24
24
  }
@@ -92,7 +92,9 @@ export class TransitionHook {
92
92
  * Return a Rejection promise if the transition is no longer current due
93
93
  * a new transition has started and superseded this one.
94
94
  */
95
- getNotCurrentRejection(): any;
95
+ getNotCurrentRejection(): Promise<any> & {
96
+ _transitionRejection: Rejection;
97
+ };
96
98
  toString(): string;
97
99
  }
98
100
  export namespace TransitionHook {
@@ -111,6 +113,7 @@ export namespace TransitionHook {
111
113
  * Each HookType chooses a GetErrorHandler (See: [[TransitionService._defineCoreEvents]])
112
114
  */
113
115
  function LOG_ERROR(hook: any): (error: any) => any;
114
- function REJECT_ERROR(): (error: any) => any;
116
+ function REJECT_ERROR(): (error: any) => Promise<never>;
115
117
  function THROW_ERROR(): (error: any) => never;
116
118
  }
119
+ import { Rejection } from "./reject-factory.js";
@@ -43,7 +43,7 @@ export class TransitionProvider {
43
43
  $view: import("../view/view.js").ViewService;
44
44
  _deregisterHookFns: {};
45
45
  /** @type {ng.ExceptionHandlerService} */
46
- _$exceptionHandler: ng.ExceptionHandlerService;
46
+ _exceptionHandler: ng.ExceptionHandlerService;
47
47
  $get: (
48
48
  | string
49
49
  | ((
@@ -97,7 +97,7 @@ export class TransitionProvider {
97
97
  criteriaMatchPath: any,
98
98
  reverseSort?: boolean,
99
99
  getResultHandler?: (hook: any) => (result: any) => any,
100
- getErrorHandler?: () => (error: any) => any,
100
+ getErrorHandler?: () => (error: any) => Promise<never>,
101
101
  synchronous?: boolean,
102
102
  ): void;
103
103
  /**
@@ -5,9 +5,9 @@
5
5
  *
6
6
  * This object contains all contextual information about the to/from states, parameters, resolves.
7
7
  * It has information about all states being entered and exited as a result of the transition.
8
- * @implements {HookRegistry}
8
+ * @extends {HookRegistry}
9
9
  */
10
- export class Transition implements HookRegistry {
10
+ export class Transition {
11
11
  /**
12
12
  * Creates a new Transition object.
13
13
  *
@@ -51,15 +51,15 @@ export class ViewService {
51
51
  /**
52
52
  * Returns the list of views currently available on the page, by fully-qualified name.
53
53
  *
54
- * @return {Array} Returns an array of fully-qualified view names.
54
+ * @return {Array<any>} Returns an array of fully-qualified view names.
55
55
  */
56
- available(): any[];
56
+ available(): Array<any>;
57
57
  /**
58
58
  * Returns the list of views on the page containing loaded content.
59
59
  *
60
- * @return {Array} Returns an array of fully-qualified view names.
60
+ * @return {Array<any>} Returns an array of fully-qualified view names.
61
61
  */
62
- active(): any[];
62
+ active(): Array<any>;
63
63
  }
64
64
  export namespace ViewService {
65
65
  /**
@@ -96,7 +96,7 @@ export class HttpProvider {
96
96
  | string
97
97
  | ((
98
98
  $injector: ng.InjectorService,
99
- $sce: any,
99
+ $sce: ng.SCEService,
100
100
  $cookie: ng.CookieService,
101
101
  ) => {
102
102
  (requestConfig: any): Promise<any>;
@@ -176,13 +176,6 @@ export interface HttpService {
176
176
  * @param config Optional configuration object
177
177
  */
178
178
  head<T>(url: string, config?: RequestShortcutConfig): HttpPromise<T>;
179
- /**
180
- * Shortcut method to perform JSONP request.
181
- *
182
- * @param url Relative or absolute URL specifying the destination of the request
183
- * @param config Optional configuration object
184
- */
185
- jsonp<T>(url: string, config?: RequestShortcutConfig): HttpPromise<T>;
186
179
  /**
187
180
  * Shortcut method to perform POST request.
188
181
  *
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Configurable provider for an injectable event bus
3
- * @implements {ng.ServiceProvider}
3
+ * @extends {ng.ServiceProvider}
4
4
  */
5
- export class PubSubProvider implements ng.ServiceProvider {
5
+ export class PubSubProvider {
6
6
  static $inject: string[];
7
7
  /**
8
8
  * @param {ng.ExceptionHandlerProvider} $exceptionHandler
@@ -1,10 +1,17 @@
1
1
  export interface SCEService {
2
+ HTML: string;
3
+ CSS: string;
4
+ JS: string;
5
+ URL: string;
6
+ RESOURCE_URL: string;
7
+ MEDIA_URL: string;
2
8
  getTrusted(type: string, mayBeTrusted: any): any;
3
9
  getTrustedCss(value: any): any;
4
10
  getTrustedHtml(value: any): any;
5
11
  getTrustedJs(value: any): any;
6
12
  getTrustedResourceUrl(value: any): any;
7
13
  getTrustedUrl(value: any): any;
14
+ getTrustedMediaUrl(value: any): any;
8
15
  parse(type: string, expression: string): (context: any, locals: any) => any;
9
16
  parseAsCss(expression: string): (context: any, locals: any) => any;
10
17
  parseAsHtml(expression: string): (context: any, locals: any) => any;
@@ -17,6 +24,7 @@ export interface SCEService {
17
24
  trustAsResourceUrl(value: any): any;
18
25
  trustAsUrl(value: any): any;
19
26
  isEnabled(): boolean;
27
+ valueOf(value?: any): any;
20
28
  }
21
29
  export interface SCEDelegateService {
22
30
  getTrusted(type: string, mayBeTrusted: any): any;
@@ -14,7 +14,7 @@ export class SceProvider {
14
14
  * @param {boolean=} value If provided, then enables/disables SCE application-wide.
15
15
  * @return {boolean} True if SCE is enabled, false otherwise.
16
16
  *
17
- * @description
17
+ *
18
18
  * Enables/disables SCE and returns the current value.
19
19
  */
20
20
  enabled: (value?: boolean | undefined, ...args: any[]) => boolean;
@@ -115,9 +115,9 @@ export class SceDelegateProvider {
115
115
  * Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
116
116
  * allowed in this array.
117
117
  *
118
- * @return {Array} The currently set trusted resource URL array.
118
+ * @return {Array<any>} The currently set trusted resource URL array.
119
+ *
119
120
  *
120
- * @description
121
121
  * Sets/Gets the list trusted of resource URLs.
122
122
  *
123
123
  * The **default value** when no `trustedResourceUrlList` has been explicitly set is `['self']`
@@ -128,7 +128,10 @@ export class SceDelegateProvider {
128
128
  * its origin with other apps! It is a good idea to limit it to only your application's directory.
129
129
  * </div>
130
130
  */
131
- trustedResourceUrlList: (value?: any[] | undefined, ...args: any[]) => any[];
131
+ trustedResourceUrlList: (
132
+ value?: any[] | undefined,
133
+ ...args: any[]
134
+ ) => Array<any>;
132
135
  /**
133
136
  *
134
137
  * @param {Array=} bannedResourceUrlList When provided, replaces the `bannedResourceUrlList` with
@@ -143,15 +146,15 @@ export class SceDelegateProvider {
143
146
  * Finally, **the banned resource URL list overrides the trusted resource URL list** and has
144
147
  * the final say.
145
148
  *
146
- * @return {Array} The currently set `bannedResourceUrlList` array.
149
+ * @return {Array<any>} The currently set `bannedResourceUrlList` array.
150
+ *
147
151
  *
148
- * @description
149
152
  * Sets/Gets the `bannedResourceUrlList` of trusted resource URLs.
150
153
  *
151
154
  * The **default value** when no trusted resource URL list has been explicitly set is the empty
152
155
  * array (i.e. there is no `bannedResourceUrlList`.)
153
156
  */
154
- bannedResourceUrlList: (value: any, ...args: any[]) => any[];
157
+ bannedResourceUrlList: (value: any, ...args: any[]) => Array<any>;
155
158
  $get: (
156
159
  | string
157
160
  | ((
@@ -1,29 +1,14 @@
1
+ import { StreamConnectionConfig } from "../stream/interface.ts";
1
2
  /**
2
- * Configuration object for SSE
3
+ * SSE-specific configuration
3
4
  */
4
- export interface SseConfig {
5
+ export interface SseConfig extends StreamConnectionConfig {
5
6
  /** Include cookies/credentials when connecting */
6
7
  withCredentials?: boolean;
7
- /** Custom headers (Note: EventSource doesn't natively support headers; handled at app level if needed) */
8
- headers?: Record<string, string>;
9
- /** Called when the connection is successfully opened */
10
- onOpen?: (event: Event) => void;
11
- /** Called when a message event is received */
12
- onMessage?: (data: any, event: MessageEvent) => void;
13
- /** Called on connection error */
14
- onError?: (err: Event) => void;
15
- /** Transform raw SSE message data (default: JSON.parse if possible) */
16
- transformMessage?: (data: string) => any;
17
8
  /** Optional query parameters appended to the URL */
18
9
  params?: Record<string, any>;
19
- /** Called when the connection is being re-established */
20
- onReconnect?: (attempt: number) => void;
21
- /** Delay in milliseconds before attempting to reconnect (default: 1000ms) */
22
- retryDelay?: number;
23
- /** Maximum number of reconnect attempts (default: Infinity) */
24
- maxRetries?: number;
25
- /** Heartbeat timeout in milliseconds; reconnect if no message within this time */
26
- heartbeatTimeout?: number;
10
+ /** Custom headers (EventSource doesn't natively support headers) */
11
+ headers?: Record<string, string>;
27
12
  }
28
13
  /**
29
14
  * Managed SSE connection object returned by $sse.
@@ -4,14 +4,14 @@
4
4
  *
5
5
  * @param {Record<PropertyKey, any>} target - The object to wrap
6
6
  * @param {string} key - The storage key
7
- * @param {import("../../core/di/inteface").StorageLike & import("../../core/di/inteface").PersistentStoreConfig} storage - Any storage-like object with getItem/setItem/removeItem
7
+ * @param {import("../../core/di/interface.ts").StorageLike & import("../../core/di/interface").PersistentStoreConfig} storage - Any storage-like object with getItem/setItem/removeItem
8
8
  * @param {{serialize?: function, deserialize?: function}} [options] - Optional custom (de)serialization
9
9
  * @returns {Record<PropertyKey, any>}
10
10
  */
11
11
  export function createPersistentProxy(
12
12
  target: Record<PropertyKey, any>,
13
13
  key: string,
14
- storage: any & any,
14
+ storage: import("../../core/di/interface.ts").StorageLike & any,
15
15
  options?: {
16
16
  serialize?: Function;
17
17
  deserialize?: Function;
@@ -15,4 +15,5 @@ export interface StreamConnectionConfig {
15
15
  heartbeatTimeout?: number;
16
16
  /** Function to transform incoming messages */
17
17
  transformMessage?: (data: any) => any;
18
+ [key: string]: any;
18
19
  }
@@ -23,7 +23,7 @@ export class StreamConnection {
23
23
  retryDelay: number;
24
24
  maxRetries: number;
25
25
  heartbeatTimeout: number;
26
- transformMessage: (data: string) => any;
26
+ transformMessage: (data: any) => any;
27
27
  };
28
28
  _log: import("../log/interface.ts").LogService;
29
29
  _retryCount: number;
@@ -7,16 +7,9 @@ export interface TemplateRequestService {
7
7
  * empty then a $compile error will be thrown (unless
8
8
  * {ignoreRequestError} is set to true).
9
9
  *
10
- * @param tpl The template URL.
11
- * @param ignoreRequestError Whether or not to ignore the exception
12
- * when the request fails or the template is
13
- * empty.
10
+ * @param templateUrl The template URL.
14
11
  *
15
12
  * @return A promise whose value is the template content.
16
13
  */
17
- (tpl: string, ignoreRequestError?: boolean): Promise<string>;
18
- /**
19
- * total amount of pending template requests being downloaded.
20
- */
21
- totalPendingRequests: number;
14
+ (templateUrl: string): Promise<string>;
22
15
  }
@@ -1,52 +1,18 @@
1
1
  /**
2
- * Used to configure the options passed to the {@link $http} service when making a template request.
2
+ * Provider for the `$templateRequest` service.
3
3
  *
4
- * For example, it can be used for specifying the "Accept" header that is sent to the server, when
5
- * requesting a template.
4
+ * Fetches templates via HTTP and caches them in `$templateCache`.
5
+ * Templates are assumed trusted. This provider allows configuring
6
+ * per-request `$http` options such as headers, timeout, or transform functions.
6
7
  */
7
- export function TemplateRequestProvider(): void;
8
8
  export class TemplateRequestProvider {
9
- /**
10
- * The options to be passed to the {@link $http} service when making the request.
11
- * You can use this to override options such as the "Accept" header for template requests.
12
- * The {@link $templateRequest} will set the `cache` and the `transformResponse` properties of the
13
- * options if not overridden here.
14
- *
15
- * @param {string=} val new value for the {@link $http} options.
16
- * @returns {string|TemplateRequestProvider} Returns the {@link $http} options when used as getter and self if used as setter.
17
- */
18
- httpOptions: (val?: string | undefined) => string | TemplateRequestProvider;
19
- /**
20
- * The `$templateRequest` service runs security checks then downloads the provided template using
21
- * `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request
22
- * fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the
23
- * exception can be thwarted by setting the 2nd parameter of the function to true). Note that the
24
- * contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted
25
- * when `tpl` is of type string and `$templateCache` has the matching entry.
26
- *
27
- * If you want to pass custom options to the `$http` service, such as setting the Accept header you
28
- * can configure this via {@link $templateRequestProvider#httpOptions}.
29
- *
30
- * `$templateRequest` is used internally by {@link $compile}, {@link ngRoute.$route}, and directives such
31
- * as {@link ngInclude} to download and cache templates.
32
- *
33
- * 3rd party modules should use `$templateRequest` if their services or directives are loading
34
- * templates.
35
- *
36
- * @param {string} tpl The HTTP request template URL
37
- * @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty
38
- *
39
- * @return {Promise} a promise for the HTTP response data of the given URL.
40
- *
41
- * @property {number} totalPendingRequests total amount of pending template requests being downloaded.
42
- */
9
+ /** @type {ng.RequestShortcutConfig|undefined} */
10
+ httpOptions: ng.RequestShortcutConfig | undefined;
43
11
  $get: (
44
12
  | string
45
13
  | ((
46
- $exceptionHandler: ng.ExceptionHandlerService,
47
14
  $templateCache: ng.TemplateCacheService,
48
15
  $http: ng.HttpService,
49
- $sce: any,
50
16
  ) => ng.TemplateRequestService)
51
17
  )[];
52
18
  }
@@ -0,0 +1,16 @@
1
+ import { StreamConnectionConfig } from "../stream/interface.ts";
2
+ import { StreamConnection } from "../stream/stream.js";
3
+ /**
4
+ * WebSocket-specific configuration
5
+ */
6
+ export interface WebSocketConfig extends StreamConnectionConfig {
7
+ /** Optional WebSocket subprotocols */
8
+ protocols?: string[];
9
+ /** Called when the WebSocket connection closes */
10
+ onClose?: (event: CloseEvent) => void;
11
+ }
12
+ export type WebSocketService = (
13
+ url: string,
14
+ protocols?: string[],
15
+ config?: WebSocketConfig,
16
+ ) => StreamConnection;