@types/sap__approuter 14.3.3 → 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: Thu, 07 Mar 2024 17:35:52 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,14 +103,21 @@ 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
 
109
113
  type RouterConfig = unknown;
110
114
 
115
+ /**
116
+ * lib/configuration/schemas/options-schema.json
117
+ */
111
118
  interface StartOptions {
112
119
  /** A TCP port the application router will listen to */
113
- port?: string;
120
+ port?: string | number;
114
121
 
115
122
  /** The working directory for the application router, should contain the xs-app.json file */
116
123
  workingDir?: string;
@@ -119,13 +126,13 @@ declare namespace approuter {
119
126
  extensions?: Extensions[];
120
127
 
121
128
  /** An object representing the content which is usually put in xs-app.json file. If this property is present it will take precedence over the content of xs-app.json. */
122
- xsAppConfig?: ComSapXsappSchema_82;
129
+ xsappConfig?: ComSapXsappSchema_82;
123
130
 
124
131
  /**
125
132
  * Options similar to [https.createServer](https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener).
126
133
  * If this property is present, application router will be started as an https server.
127
134
  */
128
- httpsConfig?: ServerOptions;
135
+ httpsOptions?: ServerOptions;
129
136
 
130
137
  /**
131
138
  * Provide custom access token
@@ -284,6 +291,18 @@ declare namespace approuter {
284
291
  */
285
292
  beforeErrorHandler: MiddlewareSlot;
286
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
+
287
306
  /**
288
307
  * **Note**: the cmdParser is currently not typed, feel free to create a pr and add the missing types
289
308
  *
@@ -355,6 +374,24 @@ declare namespace approuter {
355
374
  */
356
375
  getSessionStore(): SessionStore;
357
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
+
358
395
  /**
359
396
  * Emitted when a new user session is created.
360
397
  *
@@ -383,6 +420,12 @@ declare namespace approuter {
383
420
  }
384
421
  }
385
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
+ */
386
429
  declare function approuter(): approuter.Approuter;
387
430
 
388
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": "14.3.3",
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": "b16894028d86512b2ffa88bda2060a3d6577b0108b2ec9fb2e1ecef3ca2656a3",
32
- "typeScriptVersion": "4.7"
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
  }