@types/sap__approuter 16.6.0 → 23.0.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.
sap__approuter/README.md CHANGED
@@ -8,8 +8,8 @@ This package contains type definitions for @sap/approuter (https://www.npmjs.com
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sap__approuter.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Fri, 02 Aug 2024 05:07:22 GMT
12
- * Dependencies: [@types/http-server](https://npmjs.com/package/@types/http-server), [@types/node](https://npmjs.com/package/@types/node)
11
+ * Last updated: Wed, 30 Sep 2026 20:04:57 GMT
12
+ * Dependencies: [@types/node](https://npmjs.com/package/@types/node)
13
13
 
14
14
  # Credits
15
- These definitions were written by [Nico Blum](https://github.com/nbblum), and [Laurens von Assel](https://github.com/biolauri).
15
+ These definitions were written by [Nico Blum](https://github.com/nbblum), [Laurens von Assel](https://github.com/biolauri), and [StenCalDabran](https://github.com/StenCalDabran).
sap__approuter/index.d.ts CHANGED
@@ -103,6 +103,10 @@ declare namespace approuter {
103
103
  beforeRequestHandler?: Array<MiddlewareHandler | { path: string; handler: MiddlewareHandler }>;
104
104
  /** A MiddlewareSlot before the standard application router error handling */
105
105
  beforeErrorHandler?: Array<MiddlewareHandler | { path: string; handler: MiddlewareHandler }>;
106
+ /** A MiddlewareSlot for WebSocket requests, before the first application router middleware. Requires HANDLE_WEBSOCKET_EXT environment variable to be enabled. */
107
+ firstWS?: Array<MiddlewareHandler | { path: string; handler: MiddlewareHandler }>;
108
+ /** A MiddlewareSlot for WebSocket requests, before the standard request handling. Requires HANDLE_WEBSOCKET_EXT environment variable to be enabled. */
109
+ beforeRequestHandlerWS?: Array<MiddlewareHandler | { path: string; handler: MiddlewareHandler }>;
106
110
  };
107
111
  }
108
112
 
@@ -287,6 +291,18 @@ declare namespace approuter {
287
291
  */
288
292
  beforeErrorHandler: MiddlewareSlot;
289
293
 
294
+ /**
295
+ * A {@link MiddlewareSlot} for WebSocket requests, before the first application router middleware.
296
+ * Requires the `HANDLE_WEBSOCKET_EXT` environment variable to be enabled.
297
+ */
298
+ firstWS: MiddlewareSlot;
299
+
300
+ /**
301
+ * A {@link MiddlewareSlot} for WebSocket requests, before the standard request handling.
302
+ * Requires the `HANDLE_WEBSOCKET_EXT` environment variable to be enabled.
303
+ */
304
+ beforeRequestHandlerWS: MiddlewareSlot;
305
+
290
306
  /**
291
307
  * **Note**: the cmdParser is currently not typed, feel free to create a pr and add the missing types
292
308
  *
@@ -358,6 +374,24 @@ declare namespace approuter {
358
374
  */
359
375
  getSessionStore(): SessionStore;
360
376
 
377
+ /**
378
+ * Resolves remote routing configuration from the HTML5 Application Repository for a given request.
379
+ * Derives the application key from the request URL and fetches the corresponding xs-app.json,
380
+ * destinations, and xsappname.
381
+ *
382
+ * **Note**: This method is exposed on the prototype but not documented in the official API reference.
383
+ *
384
+ * @param request - Node request object used to derive the application key from the URL
385
+ * @param callback - Called with the resolved configuration options, or null if no application key was found
386
+ */
387
+ getRemoteConfigurationOptions(
388
+ request: AppRouterIncomingMessage,
389
+ callback: (
390
+ error: Error | string | null,
391
+ options?: { xsappConfig: object; destinations: object | null; xsappname: string | null } | null,
392
+ ) => void,
393
+ ): void;
394
+
361
395
  /**
362
396
  * Emitted when a new user session is created.
363
397
  *
@@ -386,6 +420,12 @@ declare namespace approuter {
386
420
  }
387
421
  }
388
422
 
423
+ /**
424
+ * Creates a new instance of the application router.
425
+ *
426
+ * **Note**: The underlying implementation also supports `new approuter()` (constructor invocation),
427
+ * but the factory function pattern is the documented API.
428
+ */
389
429
  declare function approuter(): approuter.Approuter;
390
430
 
391
431
  export = approuter;
@@ -32,9 +32,3 @@ export function checkToken(req: IncomingMessage): checkTokenResult;
32
32
  * @param cb function cb(err, token)
33
33
  */
34
34
  export function getToken<T = void>(req: IncomingMessage, cb: (error: Error | null, xsrfToken?: string) => T): T;
35
-
36
- export function hasTokenFetchHeader(req: IncomingMessage): boolean;
37
-
38
- export function isGetRequest(req: IncomingMessage): boolean;
39
-
40
- export function isHeadRequest(req: IncomingMessage): boolean;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/sap__approuter",
3
- "version": "16.6.0",
3
+ "version": "23.0.0",
4
4
  "description": "TypeScript definitions for @sap/approuter",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/sap__approuter",
6
6
  "license": "MIT",
@@ -14,6 +14,11 @@
14
14
  "name": "Laurens von Assel",
15
15
  "githubUsername": "biolauri",
16
16
  "url": "https://github.com/biolauri"
17
+ },
18
+ {
19
+ "name": "StenCalDabran",
20
+ "githubUsername": "StenCalDabran",
21
+ "url": "https://github.com/StenCalDabran"
17
22
  }
18
23
  ],
19
24
  "main": "",
@@ -25,9 +30,9 @@
25
30
  },
26
31
  "scripts": {},
27
32
  "dependencies": {
28
- "@types/http-server": "*",
29
33
  "@types/node": "*"
30
34
  },
31
- "typesPublisherContentHash": "ba0377e8691012335b861275eb56e11f986c3fe6dc777f7a4f24b740093d7505",
32
- "typeScriptVersion": "4.8"
35
+ "peerDependencies": {},
36
+ "typesPublisherContentHash": "1c312819690b5f012b06129670b6cfa71abda7239dbf35c088fd3f8ddf49c6e7",
37
+ "typeScriptVersion": "5.6"
33
38
  }
@@ -29,28 +29,49 @@ export type ScopesSchema =
29
29
  };
30
30
  export type ScopeTemplate = string | [string, ...string[]];
31
31
 
32
+ export type HttpMethod = "DELETE" | "GET" | "HEAD" | "OPTIONS" | "POST" | "PUT" | "TRACE" | "PATCH";
33
+
34
+ export type ErrorPageEntry =
35
+ | { status: number | [number, ...number[]]; file: string; path?: never }
36
+ | { status: number | [number, ...number[]]; path: string; file?: never };
37
+
38
+ export interface CorsConfig {
39
+ uriPattern: SourceSchema;
40
+ hostPattern?: string;
41
+ allowedOrigin: Array<{ host: string; protocol?: string; port?: number }>;
42
+ allowedMethods?: HttpMethod[];
43
+ allowedHeaders?: string[];
44
+ allowedCredentials?: boolean;
45
+ exposeHeaders?: string[];
46
+ maxAge?: number;
47
+ }
48
+
32
49
  /**
33
50
  * Application Router Configuration Schema
34
51
  */
35
52
  export interface ComSapXsappSchema_82 {
36
53
  welcomeFile?: string;
37
54
  authenticationMethod?: "none" | "route";
55
+ stateProtection?: boolean;
38
56
  sessionTimeout?: number;
39
57
  pluginMetadataEndpoint?: string;
40
58
  routes?: Array<{
41
59
  source: SourceSchema;
42
60
  httpMethods?: [
43
- "DELETE" | "GET" | "HEAD" | "OPTIONS" | "POST" | "PUT" | "TRACE" | "PATCH",
44
- ...Array<"DELETE" | "GET" | "HEAD" | "OPTIONS" | "POST" | "PUT" | "TRACE" | "PATCH">,
61
+ HttpMethod,
62
+ ...HttpMethod[],
45
63
  ];
46
64
  target?: string;
47
65
  destination?: string;
66
+ setBackendSessionCookies?: boolean;
48
67
  localDir?: string;
49
68
  csrfProtection?: boolean;
69
+ preferLocal?: boolean;
50
70
  service?: string;
51
71
  endpoint?: string;
52
- authenticationType?: "xsuaa" | "basic" | "none";
72
+ authenticationType?: "xsuaa" | "ias" | "basic" | "none";
53
73
  identityProvider?: string;
74
+ dynamicIdentityProvider?: boolean;
54
75
  scope?: ScopesSchema;
55
76
  replace?: {
56
77
  pathSuffixes: string[];
@@ -61,6 +82,10 @@ export interface ComSapXsappSchema_82 {
61
82
  };
62
83
  cacheControl?: string;
63
84
  }>;
85
+ responseHeaders?: Array<{
86
+ name: string;
87
+ value: string;
88
+ }>;
64
89
  destinations?: {
65
90
  [k: string]: {
66
91
  logoutPath?: string;
@@ -75,8 +100,11 @@ export interface ComSapXsappSchema_82 {
75
100
  };
76
101
  };
77
102
  logout?: {
103
+ backChannelLogoutEndpoint?: string;
78
104
  logoutEndpoint?: string;
79
105
  logoutPage?: string;
106
+ logoutMethod?: "POST" | "GET";
107
+ csrfProtection?: boolean;
80
108
  };
81
109
  login?: {
82
110
  callbackEndpoint: string;
@@ -87,14 +115,11 @@ export interface ComSapXsappSchema_82 {
87
115
  compression?: {
88
116
  enabled?: boolean;
89
117
  minSize?: number;
118
+ compressResponseMixedTypeContent?: boolean;
90
119
  };
91
120
  websockets?: {
92
121
  enabled: boolean;
93
122
  };
94
- errorPage?: Array<{
95
- status: number | [number, ...number[]];
96
- file: string;
97
- [k: string]: unknown;
98
- }>;
99
- [k: string]: unknown;
123
+ errorPage?: ErrorPageEntry[];
124
+ cors?: CorsConfig[];
100
125
  }