@angular-wave/angular.ts 0.15.0 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/@types/angular.d.ts +4 -1
  2. package/@types/core/compile/attributes.d.ts +28 -4
  3. package/@types/core/compile/inteface.d.ts +5 -1
  4. package/@types/core/di/inteface.d.ts +11 -0
  5. package/@types/core/parse/ast/ast-node.d.ts +2 -0
  6. package/@types/core/parse/parse.d.ts +4 -1
  7. package/@types/core/scope/interface.d.ts +26 -0
  8. package/@types/core/scope/scope.d.ts +16 -24
  9. package/@types/directive/bind/bind.d.ts +5 -7
  10. package/@types/directive/form/form.d.ts +12 -9
  11. package/@types/directive/init/init.d.ts +2 -2
  12. package/@types/directive/input/input.d.ts +8 -24
  13. package/@types/directive/listener/listener.d.ts +4 -0
  14. package/@types/directive/model/interface.d.ts +18 -0
  15. package/@types/directive/model/model.d.ts +20 -18
  16. package/@types/directive/non-bindable/non-bindable.d.ts +2 -2
  17. package/@types/directive/select/select.d.ts +2 -2
  18. package/@types/directive/setter/setter.d.ts +2 -2
  19. package/@types/directive/show-hide/show-hide.d.ts +3 -4
  20. package/@types/directive/switch/switch.d.ts +4 -4
  21. package/@types/interface.d.ts +22 -1
  22. package/@types/namespace.d.ts +16 -2
  23. package/@types/router/router.d.ts +5 -3
  24. package/@types/router/scroll/interface.d.ts +1 -1
  25. package/@types/router/state/interface.d.ts +5 -0
  26. package/@types/router/state/state-builder.d.ts +10 -6
  27. package/@types/router/state/state-matcher.d.ts +11 -3
  28. package/@types/router/state/state-object.d.ts +3 -5
  29. package/@types/router/state/state-queue-manager.d.ts +14 -8
  30. package/@types/router/state/state-registry.d.ts +12 -3
  31. package/@types/router/state/state-service.d.ts +8 -2
  32. package/@types/router/transition/hook-registry.d.ts +15 -5
  33. package/@types/router/transition/transition.d.ts +4 -2
  34. package/@types/router/url/url-rules.d.ts +3 -84
  35. package/@types/router/url/url-service.d.ts +9 -8
  36. package/@types/services/cookie/cookie.d.ts +3 -11
  37. package/@types/services/http/http.d.ts +6 -31
  38. package/@types/services/http/interface.d.ts +22 -7
  39. package/@types/services/location/location.d.ts +14 -13
  40. package/@types/services/sce/interface.d.ts +25 -0
  41. package/@types/services/sse/interface.d.ts +8 -1
  42. package/@types/services/sse/sse.d.ts +10 -18
  43. package/@types/services/storage/storage.d.ts +6 -6
  44. package/@types/services/stream/interface.d.ts +1 -1
  45. package/@types/services/stream/stream.d.ts +98 -0
  46. package/@types/services/template-request/interface.d.ts +2 -9
  47. package/@types/services/template-request/template-request.d.ts +7 -40
  48. package/@types/shared/common.d.ts +2 -2
  49. package/@types/shared/dom.d.ts +21 -42
  50. package/@types/shared/hof.d.ts +27 -37
  51. package/@types/shared/noderef.d.ts +2 -2
  52. package/@types/shared/strings.d.ts +13 -4
  53. package/@types/shared/utils.d.ts +123 -76
  54. package/@types/shared/validate.d.ts +7 -0
  55. package/dist/angular-ts.esm.js +1129 -1407
  56. package/dist/angular-ts.umd.js +1129 -1407
  57. package/dist/angular-ts.umd.min.js +1 -1
  58. package/dist/angular-ts.umd.min.js.gz +0 -0
  59. package/dist/angular-ts.umd.min.js.map +1 -1
  60. package/package.json +1 -1
  61. package/@types/router/state-filters.d.ts +0 -39
  62. package/@types/shared/cache.d.ts +0 -7
@@ -5,6 +5,7 @@ import { Scope as TScope } from "./core/scope/scope.js";
5
5
  import {
6
6
  ListenerFn as TListenerFn,
7
7
  Listener as TListener,
8
+ ScopeEvent as TScopeEvent,
8
9
  } from "./core/scope/interface.ts";
9
10
  import { NgModule as TNgModule } from "./core/di/ng-module/ng-module.js";
10
11
  import { InjectorService as TInjectorService } from "./core/di/internal-injector.js";
@@ -19,7 +20,11 @@ import { ExceptionHandler as TExceptionHandler } from "./services/exception/inte
19
20
  import { ExceptionHandlerProvider as TExceptionHandlerProvider } from "./services/exception/exception.js";
20
21
  import { ParseService as TParseService } from "./core/parse/interface.ts";
21
22
  import { TemplateRequestService as TTemplateRequestService } from "./services/template-request/interface.ts";
22
- import { HttpParamSerializer as THttpParamSerializer } from "./services/http/interface.ts";
23
+ import {
24
+ HttpParamSerializer as THttpParamSerializer,
25
+ HttpProviderDefaults as THttpProviderDefaults,
26
+ RequestShortcutConfig as TRequestShortcutConfig,
27
+ } from "./services/http/interface.ts";
23
28
  import { HttpParamSerializerProvider as THttpParamSerializerProvider } from "./services/http/http.js";
24
29
  import {
25
30
  FilterFactory as TFilterFactory,
@@ -107,6 +112,10 @@ import { StateObject as TStateObject } from "./router/state/state-object.js";
107
112
  import { StateRegistryProvider as TStateRegistryProvider } from "./router/state/state-registry.js";
108
113
  import { ViewScrollService as TViewScrollService } from "./router/scroll/interface.ts";
109
114
  import { HookRegistry } from "./router/transition/interface.ts";
115
+ import {
116
+ SCEService as TSCEService,
117
+ SCEDelegateService as TSCEDelegateService,
118
+ } from "./services/sce/interface.ts";
110
119
  declare global {
111
120
  interface Function {
112
121
  $inject?: readonly string[] | undefined;
@@ -166,6 +175,8 @@ declare global {
166
175
  type RouterService = TRouterProvider;
167
176
  type StateService = TStateProvider;
168
177
  type StateRegistryService = TStateRegistryProvider;
178
+ type SCEService = TSCEService;
179
+ type SCEDelegateService = TSCEDelegateService;
169
180
  type SseService = TSseService;
170
181
  type SseConfig = TSseConfig;
171
182
  type TransitionService = TransitionProvider & HookRegistry;
@@ -179,7 +190,7 @@ declare global {
179
190
  type Listener = TListener;
180
191
  type DocumentService = Document;
181
192
  type WindowService = Window;
182
- type AngularServie = Angular;
193
+ type AngularService = Angular;
183
194
  type WorkerConfig = TWorkerConfig;
184
195
  type WorkerConnection = TWorkerConnection;
185
196
  type Injectable<
@@ -206,5 +217,8 @@ declare global {
206
217
  type AnchorScrollFunction = TAnchorScrollFunction;
207
218
  type AnchorScrollObject = TAnchorScrollObject;
208
219
  type InjectionTokens = typeof PublicInjectionTokens;
220
+ type ScopeEvent = TScopeEvent;
221
+ type RequestShortcutConfig = TRequestShortcutConfig;
222
+ type HttpProviderDefaults = THttpProviderDefaults;
209
223
  }
210
224
  }
@@ -16,15 +16,17 @@ export class RouterProvider {
16
16
  /**
17
17
  * @type {number}
18
18
  */
19
- lastStartedTransitionId: number;
19
+ _lastStartedTransitionId: number;
20
20
  /**
21
21
  * @type {Queue<import("./transition/transition.js").Transition>}
22
22
  */
23
- transitionHistory: Queue<import("./transition/transition.js").Transition>;
23
+ _transitionHistory: Queue<import("./transition/transition.js").Transition>;
24
24
  /**
25
25
  * @type {Queue<import("./transition/transition.js").Transition>}
26
26
  */
27
- successfulTransitions: Queue<import("./transition/transition.js").Transition>;
27
+ _successfulTransitions: Queue<
28
+ import("./transition/transition.js").Transition
29
+ >;
28
30
  /**
29
31
  * @type {import("./state/interface.ts").StateDeclaration|undefined}
30
32
  */
@@ -1,3 +1,3 @@
1
1
  export type ViewScrollService =
2
2
  | ng.AnchorScrollService
3
- | ((el: Element) => void | Promise<void>);
3
+ | ((element: Element) => void);
@@ -14,7 +14,9 @@ import {
14
14
  } from "../resolve/interface.ts";
15
15
  import { Resolvable } from "../resolve/resolvable.js";
16
16
  import { TargetState } from "./target-state.js";
17
+ import { Glob } from "../glob/glob.js";
17
18
  export type StateOrName = string | StateDeclaration | StateObject;
19
+ export type StateStore = Record<string, StateObject | BuiltStateDeclaration>;
18
20
  export interface TransitionPromise extends Promise<StateObject> {
19
21
  transition: Transition;
20
22
  }
@@ -826,6 +828,9 @@ export type BuiltStateDeclaration = StateDeclaration & {
826
828
  parent?: BuiltStateDeclaration | null;
827
829
  /** Optional inherited data */
828
830
  data?: any;
831
+ _stateObjectCache?: {
832
+ nameGlob: Glob;
833
+ } | null;
829
834
  };
830
835
  /**
831
836
  * The return type of a [[StateDeclaration.lazyLoad]] function
@@ -58,18 +58,22 @@ export function resolvablesBuilder(
58
58
  export class StateBuilder {
59
59
  /**
60
60
  * @param {import('./state-matcher.js').StateMatcher} matcher
61
- * @param urlService
61
+ * @param {ng.UrlService} urlService
62
62
  */
63
63
  constructor(
64
64
  matcher: import("./state-matcher.js").StateMatcher,
65
- urlService: any,
65
+ urlService: ng.UrlService,
66
66
  );
67
- matcher: import("./state-matcher.js").StateMatcher;
68
- $injector: any;
69
- builders: {
67
+ _matcher: import("./state-matcher.js").StateMatcher;
68
+ _$injector: any;
69
+ _builders: {
70
70
  name: ((state: any) => any)[];
71
71
  self: (typeof selfBuilder)[];
72
- parent: ((state: any) => any)[];
72
+ parent: ((
73
+ state: any,
74
+ ) =>
75
+ | import("./state-object.js").StateObject
76
+ | import("./interface.ts").BuiltStateDeclaration)[];
73
77
  data: (typeof dataBuilder)[];
74
78
  url: ((stateObject: any) => any)[];
75
79
  navigable: ((state: any) => any)[];
@@ -1,7 +1,15 @@
1
1
  export class StateMatcher {
2
- constructor(_states: any);
3
- _states: any;
2
+ /** @param {import("./interface.ts").StateStore} states */
3
+ constructor(states: import("./interface.ts").StateStore);
4
+ /** @type {import("./interface.ts").StateStore} */
5
+ _states: import("./interface.ts").StateStore;
4
6
  isRelative(stateName: any): boolean;
5
- find(stateOrName: any, base: any, matchGlob?: boolean): any;
7
+ find(
8
+ stateOrName: any,
9
+ base: any,
10
+ matchGlob?: boolean,
11
+ ):
12
+ | import("./state-object.js").StateObject
13
+ | import("./interface.ts").BuiltStateDeclaration;
6
14
  resolvePath(name: any, base: any): string;
7
15
  }
@@ -1,4 +1,3 @@
1
- /** @typedef {import('./interface.ts').StateDeclaration} StateDeclaration */
2
1
  /**
3
2
  * Internal representation of a ng-router state.
4
3
  *
@@ -8,9 +7,9 @@
8
7
  *
9
8
  * This class prototypally inherits from the corresponding [[StateDeclaration]].
10
9
  * Each of its own properties (i.e., `hasOwnProperty`) are built using builders from the [[StateBuilder]].
11
- * @implements {StateDeclaration}
10
+ * @implements {ng.StateDeclaration}
12
11
  */
13
- export class StateObject implements StateDeclaration {
12
+ export class StateObject implements ng.StateDeclaration {
14
13
  /**
15
14
  * @param {import('./interface.ts').StateDeclaration} config
16
15
  */
@@ -27,7 +26,7 @@ export class StateObject implements StateDeclaration {
27
26
  * @type {ng.StateDeclaration|ng.BuiltStateDeclaration}
28
27
  */
29
28
  self: ng.StateDeclaration | ng.BuiltStateDeclaration;
30
- __stateObjectCache: {
29
+ _stateObjectCache: {
31
30
  nameGlob: Glob;
32
31
  };
33
32
  /**
@@ -79,5 +78,4 @@ export namespace StateObject {
79
78
  /** Predicate which returns true if the object is an internal [[StateObject]] object */
80
79
  function isState(obj: any): boolean;
81
80
  }
82
- export type StateDeclaration = import("./interface.ts").StateDeclaration;
83
81
  import { Glob } from "../glob/glob.js";
@@ -1,21 +1,22 @@
1
1
  export class StateQueueManager {
2
2
  /**
3
3
  * @param {import("./state-registry.js").StateRegistryProvider} stateRegistry
4
- * @param {*} urlServiceRules
5
- * @param {Record<string, ng.StateObject>} states
4
+ * @param {import("../url/url-rules.js").UrlRules} urlServiceRules
5
+ * @param {import("./interface.ts").StateStore} states
6
6
  * @param {*} builder
7
7
  * @param {*} listeners
8
8
  */
9
9
  constructor(
10
10
  stateRegistry: import("./state-registry.js").StateRegistryProvider,
11
- urlServiceRules: any,
12
- states: Record<string, ng.StateObject>,
11
+ urlServiceRules: import("../url/url-rules.js").UrlRules,
12
+ states: import("./interface.ts").StateStore,
13
13
  builder: any,
14
14
  listeners: any,
15
15
  );
16
16
  stateRegistry: import("./state-registry.js").StateRegistryProvider;
17
- urlServiceRules: any;
18
- states: Record<string, StateObject>;
17
+ /** @type {import("../url/url-rules.js").UrlRules} */
18
+ urlServiceRules: import("../url/url-rules.js").UrlRules;
19
+ states: import("./interface.ts").StateStore;
19
20
  builder: any;
20
21
  listeners: any;
21
22
  /**
@@ -23,7 +24,12 @@ export class StateQueueManager {
23
24
  */
24
25
  queue: Array<StateObject>;
25
26
  register(stateDecl: any): StateObject;
26
- flush(): Record<string, StateObject>;
27
- attachRoute(state: any): void;
27
+ flush(): import("./interface.ts").StateStore;
28
+ /**
29
+ *
30
+ * @param {ng.StateDeclaration} state
31
+ * @returns {() => void} a function that deregisters the rule
32
+ */
33
+ attachRoute(state: ng.StateDeclaration): () => void;
28
34
  }
29
35
  import { StateObject } from "./state-object.js";
@@ -19,8 +19,8 @@ export class StateRegistryProvider {
19
19
  globals: ng.RouterService,
20
20
  viewService: ng.ViewService,
21
21
  );
22
- /** @type {Record<string, import("./state-object.js").StateObject>} */
23
- states: Record<string, import("./state-object.js").StateObject>;
22
+ /** @type {import("./interface.ts").StateStore} */
23
+ states: import("./interface.ts").StateStore;
24
24
  urlService: import("../url/url-service.js").UrlService;
25
25
  urlServiceRules: import("../url/url-rules.js").UrlRules;
26
26
  $injector: any;
@@ -115,7 +115,16 @@ export class StateRegistryProvider {
115
115
  * @return {ng.BuiltStateDeclaration[]}
116
116
  */
117
117
  getAll(): ng.BuiltStateDeclaration[];
118
- get(stateOrName: any, base: any, ...args: any[]): any;
118
+ get(
119
+ stateOrName: any,
120
+ base: any,
121
+ ...args: any[]
122
+ ):
123
+ | import("./interface.ts").StateDeclaration
124
+ | (
125
+ | import("./interface.ts").StateDeclaration
126
+ | import("./interface.ts").BuiltStateDeclaration
127
+ )[];
119
128
  /**
120
129
  * Registers a [[BuilderFunction]] for a specific [[StateObject]] property (e.g., `parent`, `url`, or `path`).
121
130
  * More than one BuilderFunction can be registered for a given property.
@@ -34,8 +34,14 @@ export class StateProvider {
34
34
  * @deprecated This is a passthrough through to [[Router.$current]]
35
35
  */
36
36
  get $current(): import("./state-object.js").StateObject;
37
- globals: import("../router.js").RouterProvider;
38
- transitionService: import("../transition/transition-service.js").TransitionProvider;
37
+ /**
38
+ * @type {ng.RouterProvider}
39
+ */
40
+ globals: ng.RouterProvider;
41
+ /**
42
+ * @type {ng.TransitionProvider}
43
+ */
44
+ transitionService: ng.TransitionProvider;
39
45
  stateRegistry: any;
40
46
  /** @type {ng.UrlService} */
41
47
  urlService: ng.UrlService;
@@ -16,12 +16,22 @@ export function matchState(
16
16
  criterion: any,
17
17
  transition: any,
18
18
  ): boolean;
19
- /** Return a registration function of the requested type. */
19
+ /**
20
+ * Return a registration function of the requested type.
21
+ * @param {ng.TransitionProvider| import("./transition.js").Transition} hookSource
22
+ * @param {ng.TransitionProvider} transitionService
23
+ * @param {import("./transition-event-type.js").TransitionEventType} eventType
24
+ * @returns {( matchObject: any, callback: Function, options?: Record<string, any> ) => () => void }
25
+ */
20
26
  export function makeEvent(
21
- registry: any,
22
- transitionService: any,
23
- eventType: any,
24
- ): (matchObject: any, callback: any, options?: {}) => any;
27
+ hookSource: ng.TransitionProvider | import("./transition.js").Transition,
28
+ transitionService: ng.TransitionProvider,
29
+ eventType: import("./transition-event-type.js").TransitionEventType,
30
+ ): (
31
+ matchObject: any,
32
+ callback: Function,
33
+ options?: Record<string, any>,
34
+ ) => () => void;
25
35
  /**
26
36
  * The registration data for a registered transition hook
27
37
  */
@@ -29,8 +29,10 @@ export class Transition implements HookRegistry {
29
29
  * @type {import('../router.js').RouterProvider}
30
30
  */
31
31
  _globals: import("../router.js").RouterProvider;
32
- _transitionService: import("./transition-service.js").TransitionProvider;
33
- _deferred: any;
32
+ /** @type {ng.TransitionProvider} */
33
+ _transitionProvider: ng.TransitionProvider;
34
+ /** @type {PromiseWithResolvers<any>} */
35
+ _deferred: PromiseWithResolvers<any>;
34
36
  /**
35
37
  * This promise is resolved or rejected based on the outcome of the Transition.
36
38
  *
@@ -14,89 +14,7 @@ export class UrlRules {
14
14
  _sortFn: typeof defaultRuleSortFn;
15
15
  _rules: any[];
16
16
  _id: number;
17
- urlRuleFactory: UrlRuleFactory;
18
- /**
19
- * Defines the initial state, path, or behavior to use when the app starts.
20
- *
21
- * This rule defines the initial/starting state for the application.
22
- *
23
- * This rule is triggered the first time the URL is checked (when the app initially loads).
24
- * The rule is triggered only when the url matches either `""` or `"/"`.
25
- *
26
- * Note: The rule is intended to be used when the root of the application is directly linked to.
27
- * When the URL is *not* `""` or `"/"` and doesn't match other rules, the [[otherwise]] rule is triggered.
28
- * This allows 404-like behavior when an unknown URL is deep-linked.
29
- *
30
- * #### Example:
31
- * Start app at `home` state.
32
- * ```js
33
- * .initial({ state: 'home' });
34
- * ```
35
- *
36
- * #### Example:
37
- * Start app at `/home` (by url)
38
- * ```js
39
- * .initial('/home');
40
- * ```
41
- *
42
- * #### Example:
43
- * When no other url rule matches, go to `home` state
44
- * ```js
45
- * .initial((matchValue, url, router) => {
46
- * console.log('initial state');
47
- * return { state: 'home' };
48
- * })
49
- * ```
50
- *
51
- * @param handler The initial state or url path, or a function which returns the state or url path (or performs custom logic).
52
- */
53
- initial(handler: any): void;
54
- /**
55
- * Defines the state, url, or behavior to use when no other rule matches the URL.
56
- *
57
- * This rule is matched when *no other rule* matches.
58
- * It is generally used to handle unknown URLs (similar to "404" behavior, but on the client side).
59
- *
60
- * - If `handler` a string, it is treated as a url redirect
61
- *
62
- * #### Example:
63
- * When no other url rule matches, redirect to `/index`
64
- * ```js
65
- * .otherwise('/index');
66
- * ```
67
- *
68
- * - If `handler` is an object with a `state` property, the state is activated.
69
- *
70
- * #### Example:
71
- * When no other url rule matches, redirect to `home` and provide a `dashboard` parameter value.
72
- * ```js
73
- * .otherwise({ state: 'home', params: { dashboard: 'default' } });
74
- * ```
75
- *
76
- * - If `handler` is a function, the function receives the current url ([[UrlParts]]) and the [[UIRouter]] object.
77
- * The function can perform actions, and/or return a value.
78
- *
79
- * #### Example:
80
- * When no other url rule matches, manually trigger a transition to the `home` state
81
- * ```js
82
- * .otherwise((matchValue, urlParts, router) => {
83
- * router.stateService.go('home');
84
- * });
85
- * ```
86
- *
87
- * #### Example:
88
- * When no other url rule matches, go to `home` state
89
- * ```js
90
- * .otherwise((matchValue, urlParts, router) => {
91
- * return { state: 'home' };
92
- * });
93
- * ```
94
- *
95
- * @param handler The url path to redirect to, or a function which returns the url path (or performs custom logic).
96
- */
97
- otherwise(handler: any): void;
98
- _otherwiseFn: import("./url-rule.js").BaseUrlRule;
99
- _sorted: boolean;
17
+ _urlRuleFactory: UrlRuleFactory;
100
18
  /**
101
19
  * Remove a rule previously registered
102
20
  *
@@ -113,9 +31,10 @@ export class UrlRules {
113
31
  * A rule should have a `match` function which returns truthy if the rule matched.
114
32
  * It should also have a `handler` function which is invoked if the rule is the best match.
115
33
  *
116
- * @return a function that deregisters the rule
34
+ * @returns {() => void } a function that deregisters the rule
117
35
  */
118
36
  rule(rule: any): () => void;
37
+ _sorted: boolean;
119
38
  /**
120
39
  * Gets all registered rules
121
40
  *
@@ -5,13 +5,13 @@ export class UrlService {
5
5
  static $inject: string[];
6
6
  /**
7
7
  * @param {ng.LocationProvider} $locationProvider
8
- * @param {import("../../router/state/state-service.js").StateProvider} stateService
8
+ * @param {import("../../router/state/state-service.js").StateProvider} stateProvider
9
9
  * @param {import("../router.js").RouterProvider} globals
10
10
  * @param {import("../../router/url/url-config.js").UrlConfigProvider} urlConfigProvider
11
11
  */
12
12
  constructor(
13
13
  $locationProvider: ng.LocationProvider,
14
- stateService: import("../../router/state/state-service.js").StateProvider,
14
+ stateProvider: import("../../router/state/state-service.js").StateProvider,
15
15
  globals: import("../router.js").RouterProvider,
16
16
  urlConfigProvider: import("../../router/url/url-config.js").UrlConfigProvider,
17
17
  );
@@ -20,20 +20,21 @@ export class UrlService {
20
20
  /** @private */
21
21
  private _locationProvider;
22
22
  stateService: import("../../router/state/state-service.js").StateProvider;
23
- /** Provides services related to the URL */
24
- urlRuleFactory: UrlRuleFactory;
23
+ /** @type {UrlRuleFactory} Provides services related to the URL */
24
+ _urlRuleFactory: UrlRuleFactory;
25
25
  /**
26
26
  * The nested [[UrlRules]] API for managing URL rules and rewrites
27
+ * @ignore
27
28
  * @type {UrlRules}
28
29
  */
29
- rules: UrlRules;
30
+ _rules: UrlRules;
30
31
  /**
31
32
  * The nested [[UrlConfig]] API to configure the URL and retrieve URL information
32
33
  * @type {import("./url-config.js").UrlConfigProvider}
33
34
  */
34
- config: import("./url-config.js").UrlConfigProvider;
35
- /** Creates a new [[Param]] for a given location (DefType) */
36
- paramFactory: ParamFactory;
35
+ _config: import("./url-config.js").UrlConfigProvider;
36
+ /** @type {ParamFactory} Creates a new [[Param]] for a given location (DefType) */
37
+ _paramFactory: ParamFactory;
37
38
  _urlListeners: any[];
38
39
  /**
39
40
  * Gets the path part of the current url
@@ -5,10 +5,7 @@
5
5
  export class CookieProvider {
6
6
  /** @type {ng.CookieOptions} */
7
7
  defaults: ng.CookieOptions;
8
- $get: (
9
- | string
10
- | (($exceptionHandler: ng.ExceptionHandlerService) => CookieService)
11
- )[];
8
+ $get: () => CookieService;
12
9
  }
13
10
  /**
14
11
  *
@@ -21,16 +18,10 @@ export class CookieService {
21
18
  /**
22
19
  * @param {ng.CookieOptions} defaults
23
20
  * Default cookie attributes defined by `$cookiesProvider.defaults`.
24
- * @param {ng.ExceptionHandlerService} $exceptionHandler
25
21
  */
26
- constructor(
27
- defaults: ng.CookieOptions,
28
- $exceptionHandler: ng.ExceptionHandlerService,
29
- );
22
+ constructor(defaults: ng.CookieOptions);
30
23
  /** @private @type {ng.CookieOptions} */
31
24
  private _defaults;
32
- /** @private @type {ng.ExceptionHandlerService} */
33
- private _$exceptionHandler;
34
25
  /**
35
26
  * Retrieves a raw cookie value.
36
27
  *
@@ -61,6 +52,7 @@ export class CookieService {
61
52
  * @param {string} key
62
53
  * @param {string} value
63
54
  * @param {ng.CookieOptions} [options]
55
+ * @throws {URIError} if key or value cannot be encoded
64
56
  */
65
57
  put(key: string, value: string, options?: ng.CookieOptions): void;
66
58
  /**
@@ -23,21 +23,7 @@ export function defaultHttpResponseTransform(data: any, headers: any): any;
23
23
  */
24
24
  export function HttpProvider(): void;
25
25
  export class HttpProvider {
26
- defaults: {
27
- transformResponse: (typeof defaultHttpResponseTransform)[];
28
- transformRequest: ((data: any) => any)[];
29
- headers: {
30
- common: {
31
- Accept: string;
32
- };
33
- post: any;
34
- put: any;
35
- patch: any;
36
- };
37
- xsrfCookieName: string;
38
- xsrfHeaderName: string;
39
- paramSerializer: string;
40
- };
26
+ defaults: import("./interface.ts").HttpProviderDefaults;
41
27
  /**
42
28
  * Configure $http service to combine processing of multiple http responses received at around
43
29
  * the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in
@@ -62,8 +48,11 @@ export class HttpProvider {
62
48
  * array, on request, but reverse order, on response.
63
49
  *
64
50
  * {@link ng.$http#interceptors Interceptors detailed info}
51
+ * @type {Array<string | ng.Injectable<import("./interface.ts").HttpInterceptorFactory>>}
65
52
  */
66
- interceptors: any[];
53
+ interceptors: Array<
54
+ string | ng.Injectable<import("./interface.ts").HttpInterceptorFactory>
55
+ >;
67
56
  /**
68
57
  * Array containing URLs whose origins are trusted to receive the XSRF token. See the
69
58
  * {@link ng.$http#security-considerations Security Considerations} sections for more details on
@@ -118,21 +107,7 @@ export class HttpProvider {
118
107
  *
119
108
  * See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above.
120
109
  */
121
- defaults: {
122
- transformResponse: (typeof defaultHttpResponseTransform)[];
123
- transformRequest: ((data: any) => any)[];
124
- headers: {
125
- common: {
126
- Accept: string;
127
- };
128
- post: any;
129
- put: any;
130
- patch: any;
131
- };
132
- xsrfCookieName: string;
133
- xsrfHeaderName: string;
134
- paramSerializer: string;
135
- };
110
+ defaults: import("./interface.ts").HttpProviderDefaults;
136
111
  })
137
112
  )[];
138
113
  }
@@ -4,6 +4,14 @@ export interface HttpHeadersGetter {
4
4
  };
5
5
  (headerName: string): string;
6
6
  }
7
+ export interface HttpPromiseCallback<T> {
8
+ (
9
+ data: T,
10
+ status: number,
11
+ headers: HttpHeadersGetter,
12
+ config: RequestConfig,
13
+ ): void;
14
+ }
7
15
  export interface HttpRequestConfigHeaders {
8
16
  [requestType: string]: any;
9
17
  common?: any;
@@ -18,6 +26,9 @@ export interface HttpRequestTransformer {
18
26
  export interface HttpResponseTransformer {
19
27
  (data: any, headersGetter: HttpHeadersGetter, status: number): any;
20
28
  }
29
+ export interface HttpHeaderType {
30
+ [requestType: string]: string | ((config: RequestConfig) => string);
31
+ }
21
32
  /**
22
33
  * Object that controls the defaults for $http provider. Not all fields of RequestShortcutConfig can be configured
23
34
  * via defaults and the docs do not say which. The following is based on the inspection of the source code.
@@ -165,13 +176,6 @@ export interface HttpService {
165
176
  * @param config Optional configuration object
166
177
  */
167
178
  head<T>(url: string, config?: RequestShortcutConfig): HttpPromise<T>;
168
- /**
169
- * Shortcut method to perform JSONP request.
170
- *
171
- * @param url Relative or absolute URL specifying the destination of the request
172
- * @param config Optional configuration object
173
- */
174
- jsonp<T>(url: string, config?: RequestShortcutConfig): HttpPromise<T>;
175
179
  /**
176
180
  * Shortcut method to perform POST request.
177
181
  *
@@ -228,3 +232,14 @@ export type HttpParams = Record<
228
232
  * A function that serializes an object into a URL-encoded query string.
229
233
  */
230
234
  export type HttpParamSerializer = (params?: HttpParams) => string;
235
+ export interface HttpInterceptor {
236
+ request?(config: RequestConfig): RequestConfig | Promise<RequestConfig>;
237
+ requestError?(rejection: any): RequestConfig | Promise<RequestConfig>;
238
+ response?<T>(
239
+ response: HttpResponse<T>,
240
+ ): Promise<HttpResponse<T>> | HttpResponse<T>;
241
+ responseError?<T>(rejection: any): Promise<HttpResponse<T>> | HttpResponse<T>;
242
+ }
243
+ export interface HttpInterceptorFactory {
244
+ (...args: any[]): HttpInterceptor;
245
+ }