@mcp-abap-adt/core 18.0.0 → 19.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.
Files changed (131) hide show
  1. package/README.md +26 -5
  2. package/bin/mcp-abap-adt.js +15 -15
  3. package/dist/StdioServer.d.ts +68 -14
  4. package/dist/StdioServer.d.ts.map +1 -1
  5. package/dist/StdioServer.js +101 -31
  6. package/dist/StdioServer.js.map +1 -1
  7. package/dist/auth/IAuthBrokerFactory.d.ts +62 -0
  8. package/dist/auth/IAuthBrokerFactory.d.ts.map +1 -0
  9. package/dist/auth/IAuthBrokerFactory.js +8 -0
  10. package/dist/auth/IAuthBrokerFactory.js.map +1 -0
  11. package/dist/auth/IAuthBrokerFactoryConfig.d.ts +90 -0
  12. package/dist/auth/IAuthBrokerFactoryConfig.d.ts.map +1 -0
  13. package/dist/auth/IAuthBrokerFactoryConfig.js +8 -0
  14. package/dist/auth/IAuthBrokerFactoryConfig.js.map +1 -0
  15. package/dist/auth/brokerFactory.d.ts +93 -0
  16. package/dist/auth/brokerFactory.d.ts.map +1 -0
  17. package/dist/auth/brokerFactory.js +341 -0
  18. package/dist/auth/brokerFactory.js.map +1 -0
  19. package/dist/auth/browser.d.ts +60 -0
  20. package/dist/auth/browser.d.ts.map +1 -0
  21. package/dist/auth/browser.js +116 -0
  22. package/dist/auth/browser.js.map +1 -0
  23. package/dist/auth/countedProvider.d.ts +43 -0
  24. package/dist/auth/countedProvider.d.ts.map +1 -0
  25. package/dist/auth/countedProvider.js +105 -0
  26. package/dist/auth/countedProvider.js.map +1 -0
  27. package/dist/auth/destinationFailure.d.ts +69 -0
  28. package/dist/auth/destinationFailure.d.ts.map +1 -0
  29. package/dist/auth/destinationFailure.js +183 -0
  30. package/dist/auth/destinationFailure.js.map +1 -0
  31. package/dist/auth/destinationStores.d.ts +55 -0
  32. package/dist/auth/destinationStores.d.ts.map +1 -0
  33. package/dist/auth/destinationStores.js +158 -0
  34. package/dist/auth/destinationStores.js.map +1 -0
  35. package/dist/auth/handlers/basic.d.ts +3 -0
  36. package/dist/auth/handlers/basic.d.ts.map +1 -0
  37. package/dist/auth/handlers/basic.js +8 -0
  38. package/dist/auth/handlers/basic.js.map +1 -0
  39. package/dist/auth/handlers/index.d.ts +15 -0
  40. package/dist/auth/handlers/index.d.ts.map +1 -0
  41. package/dist/auth/handlers/index.js +32 -0
  42. package/dist/auth/handlers/index.js.map +1 -0
  43. package/dist/auth/handlers/jwtAuthorizationCode.d.ts +8 -0
  44. package/dist/auth/handlers/jwtAuthorizationCode.d.ts.map +1 -0
  45. package/dist/auth/handlers/jwtAuthorizationCode.js +32 -0
  46. package/dist/auth/handlers/jwtAuthorizationCode.js.map +1 -0
  47. package/dist/auth/handlers/snc.d.ts +3 -0
  48. package/dist/auth/handlers/snc.d.ts.map +1 -0
  49. package/dist/auth/handlers/snc.js +14 -0
  50. package/dist/auth/handlers/snc.js.map +1 -0
  51. package/dist/auth/handlers/types.d.ts +30 -0
  52. package/dist/auth/handlers/types.d.ts.map +1 -0
  53. package/dist/auth/handlers/types.js +3 -0
  54. package/dist/auth/handlers/types.js.map +1 -0
  55. package/dist/auth/index.d.ts +15 -0
  56. package/dist/auth/index.d.ts.map +1 -0
  57. package/dist/auth/index.js +38 -0
  58. package/dist/auth/index.js.map +1 -0
  59. package/dist/auth/serverLogin.d.ts +75 -0
  60. package/dist/auth/serverLogin.d.ts.map +1 -0
  61. package/dist/auth/serverLogin.js +138 -0
  62. package/dist/auth/serverLogin.js.map +1 -0
  63. package/dist/auth/serverSentences.d.ts +39 -0
  64. package/dist/auth/serverSentences.d.ts.map +1 -0
  65. package/dist/auth/serverSentences.js +49 -0
  66. package/dist/auth/serverSentences.js.map +1 -0
  67. package/dist/auth/vocabulary.d.ts +28 -0
  68. package/dist/auth/vocabulary.d.ts.map +1 -0
  69. package/dist/auth/vocabulary.js +67 -0
  70. package/dist/auth/vocabulary.js.map +1 -0
  71. package/dist/config/coreParameters.d.ts +125 -0
  72. package/dist/config/coreParameters.d.ts.map +1 -0
  73. package/dist/config/coreParameters.js +331 -0
  74. package/dist/config/coreParameters.js.map +1 -0
  75. package/dist/config/envFileContext.d.ts +26 -0
  76. package/dist/config/envFileContext.d.ts.map +1 -0
  77. package/dist/config/envFileContext.js +90 -0
  78. package/dist/config/envFileContext.js.map +1 -0
  79. package/dist/config/envResolver.d.ts +6 -0
  80. package/dist/config/envResolver.d.ts.map +1 -0
  81. package/dist/config/envResolver.js +81 -0
  82. package/dist/config/envResolver.js.map +1 -0
  83. package/dist/config/platformPaths.d.ts +28 -0
  84. package/dist/config/platformPaths.d.ts.map +1 -0
  85. package/dist/config/platformPaths.js +152 -0
  86. package/dist/config/platformPaths.js.map +1 -0
  87. package/dist/destinationSource.d.ts +26 -0
  88. package/dist/destinationSource.d.ts.map +1 -0
  89. package/dist/destinationSource.js +43 -0
  90. package/dist/destinationSource.js.map +1 -0
  91. package/dist/index.d.ts +9 -5
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +16 -11
  94. package/dist/index.js.map +1 -1
  95. package/dist/launcher.d.ts +102 -59
  96. package/dist/launcher.d.ts.map +1 -1
  97. package/dist/launcher.js +419 -286
  98. package/dist/launcher.js.map +1 -1
  99. package/dist/shutdown.d.ts +76 -24
  100. package/dist/shutdown.d.ts.map +1 -1
  101. package/dist/shutdown.js +114 -57
  102. package/dist/shutdown.js.map +1 -1
  103. package/package.json +22 -39
  104. package/dist/InstancePool.d.ts +0 -87
  105. package/dist/InstancePool.d.ts.map +0 -1
  106. package/dist/InstancePool.js +0 -240
  107. package/dist/InstancePool.js.map +0 -1
  108. package/dist/SseServer.d.ts +0 -144
  109. package/dist/SseServer.d.ts.map +0 -1
  110. package/dist/SseServer.js +0 -359
  111. package/dist/SseServer.js.map +0 -1
  112. package/dist/StreamableHttpServer.d.ts +0 -143
  113. package/dist/StreamableHttpServer.d.ts.map +0 -1
  114. package/dist/StreamableHttpServer.js +0 -349
  115. package/dist/StreamableHttpServer.js.map +0 -1
  116. package/dist/destinationRequest.d.ts +0 -38
  117. package/dist/destinationRequest.d.ts.map +0 -1
  118. package/dist/destinationRequest.js +0 -85
  119. package/dist/destinationRequest.js.map +0 -1
  120. package/dist/dnsRebindingProtection.d.ts +0 -21
  121. package/dist/dnsRebindingProtection.d.ts.map +0 -1
  122. package/dist/dnsRebindingProtection.js +0 -45
  123. package/dist/dnsRebindingProtection.js.map +0 -1
  124. package/dist/stateClose.d.ts +0 -8
  125. package/dist/stateClose.d.ts.map +0 -1
  126. package/dist/stateClose.js +0 -14
  127. package/dist/stateClose.js.map +0 -1
  128. package/dist/tlsUtils.d.ts +0 -19
  129. package/dist/tlsUtils.d.ts.map +0 -1
  130. package/dist/tlsUtils.js +0 -77
  131. package/dist/tlsUtils.js.map +0 -1
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ /**
3
+ * The vocabulary of authentication broker 4 accepts, held in code.
4
+ *
5
+ * A key store answers `authType` and `grantType` as the strings its file
6
+ * holds, unchecked. `vetMeans` checks them before anything is built; an
7
+ * unknown string is refused without being quoted (H4).
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.GRANTS = exports.AUTH_TYPES = void 0;
11
+ exports.vetMeans = vetMeans;
12
+ const auth_broker_1 = require("@mcp-abap-adt/auth-broker");
13
+ /**
14
+ * `certificate` and `kerberos` are known and unsupported: vetted, so the
15
+ * refusal can name them (`UnsupportedAuthenticationError`) instead of calling
16
+ * them an unknown type. Neither reads a grant.
17
+ */
18
+ exports.AUTH_TYPES = [
19
+ 'basic',
20
+ 'jwt',
21
+ 'saml',
22
+ 'snc',
23
+ 'certificate',
24
+ 'kerberos',
25
+ ];
26
+ /**
27
+ * Every `DestinationGrant`. `satisfies` stops a name the contract lacks; the
28
+ * exhaustiveness check against the type (a member the contract adds) is the
29
+ * test file's, so a contract change breaks `test:check`.
30
+ */
31
+ exports.GRANTS = [
32
+ 'authorization_code',
33
+ 'client_credentials',
34
+ 'passcode',
35
+ 'oidc_authorization_code',
36
+ 'device_code',
37
+ 'password',
38
+ 'token_exchange',
39
+ 'saml2_pure',
40
+ 'saml2_bearer',
41
+ 'none',
42
+ ];
43
+ const AUTH_TYPE_REASON = 'authType is missing or not one of: basic, jwt, saml, snc, certificate, kerberos.';
44
+ const GRANT_REASON = 'grantType is missing or not a known grant.';
45
+ function isAuthType(value) {
46
+ return (typeof value === 'string' &&
47
+ exports.AUTH_TYPES.includes(value));
48
+ }
49
+ function isGrant(value) {
50
+ return (typeof value === 'string' && exports.GRANTS.includes(value));
51
+ }
52
+ /** Checks what a destination states against the vocabulary; throws `DestinationConfigError`. */
53
+ function vetMeans(destination, means) {
54
+ const authType = means?.authType;
55
+ if (!isAuthType(authType)) {
56
+ throw new auth_broker_1.DestinationConfigError(destination, ['authType'], AUTH_TYPE_REASON);
57
+ }
58
+ // The broker reads a grant for `jwt` and `saml` only.
59
+ if (authType !== 'jwt' && authType !== 'saml')
60
+ return { authType };
61
+ const grantType = means?.grantType;
62
+ if (!isGrant(grantType)) {
63
+ throw new auth_broker_1.DestinationConfigError(destination, ['grantType'], GRANT_REASON);
64
+ }
65
+ return { authType, grantType };
66
+ }
67
+ //# sourceMappingURL=vocabulary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vocabulary.js","sourceRoot":"","sources":["../../src/auth/vocabulary.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAgEH,4BAmBC;AAjFD,2DAAmE;AAMnE;;;;GAIG;AACU,QAAA,UAAU,GAAG;IACxB,OAAO;IACP,KAAK;IACL,MAAM;IACN,KAAK;IACL,aAAa;IACb,UAAU;CACF,CAAC;AAGX;;;;GAIG;AACU,QAAA,MAAM,GAAG;IACpB,oBAAoB;IACpB,oBAAoB;IACpB,UAAU;IACV,yBAAyB;IACzB,aAAa;IACb,UAAU;IACV,gBAAgB;IAChB,YAAY;IACZ,cAAc;IACd,MAAM;CACwC,CAAC;AAEjD,MAAM,gBAAgB,GACpB,kFAAkF,CAAC;AACrF,MAAM,YAAY,GAAG,4CAA4C,CAAC;AAElE,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACxB,kBAAgC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAClD,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ,IAAK,cAA4B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAC3E,CAAC;AACJ,CAAC;AAOD,gGAAgG;AAChG,SAAgB,QAAQ,CACtB,WAAmB,EACnB,KAA+B;IAE/B,MAAM,QAAQ,GAAY,KAAK,EAAE,QAAQ,CAAC;IAC1C,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,oCAAsB,CAC9B,WAAW,EACX,CAAC,UAAU,CAAC,EACZ,gBAAgB,CACjB,CAAC;IACJ,CAAC;IACD,sDAAsD;IACtD,IAAI,QAAQ,KAAK,KAAK,IAAI,QAAQ,KAAK,MAAM;QAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;IACnE,MAAM,SAAS,GAAY,KAAK,EAAE,SAAS,CAAC;IAC5C,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,oCAAsB,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AACjC,CAAC"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * `mcp-abap-adt`'s parameter table: the destination, the
3
+ * browser and the login, beside lib's shared rows. Nothing of the HTTP or SSE
4
+ * binaries is here; the CLI or YAML form of one of their options — or any
5
+ * form of `--transport`, which is gone — stops the start naming the binary
6
+ * that serves it. Their environment variables are not read.
7
+ */
8
+ import { type IServerConfig, type MessageServerField, type Parameter, type ParameterTable, type YamlConfig } from '@mcp-abap-adt/lib/config';
9
+ import { type ToolSet } from '@mcp-abap-adt/lib/tool-set';
10
+ /** The destination, browser and login rows: core's own. */
11
+ export declare const CORE_ROWS: readonly Parameter[];
12
+ export declare const MESSAGE_SERVER_ROWS: readonly Parameter[];
13
+ /** The longest login bound: a day. */
14
+ export declare const MAX_LOGIN_TIMEOUT_SECONDS = 86400;
15
+ /**
16
+ * `--login-timeout`'s value: a whole number of seconds from 1 to 86 400,
17
+ * read by plain code — digits only, as a string or a YAML number.
18
+ */
19
+ export declare function parseLoginTimeout(raw: unknown, name: string): number;
20
+ /**
21
+ * `--login-timeout` / `MCP_LOGIN_TIMEOUT` / `login-timeout`: the bound
22
+ * on each login, opt-in. No default: without it a login ends on its result,
23
+ * the user's refusal or its request's end.
24
+ */
25
+ export declare const LOGIN_TIMEOUT_ROW: Parameter;
26
+ /**
27
+ * `--auth-debug` / `auth-debug`: the token providers' debug line names
28
+ * a refused request's secrets by their first and last four characters. The
29
+ * command line and the configuration file only — no environment variable
30
+ * turns it on.
31
+ */
32
+ export declare const AUTH_DEBUG_ROW: Parameter;
33
+ /**
34
+ * The login bound as the user set it, for the login-bound sentence: the form it came
35
+ * from (`parameterSource`) with its value — `` `--login-timeout=300` ``,
36
+ * `` `MCP_LOGIN_TIMEOUT=300` ``, or `` `login-timeout: 300` in the
37
+ * configuration file ``.
38
+ */
39
+ export declare function statedLoginTimeout(seconds: number, source?: string): string;
40
+ /**
41
+ * core's table for a tool set: its rows, the shared rows, and what it
42
+ * refuses — the set's removed `--exposition` among them, naming the stdio
43
+ * binary its words asked for. `mcp-abap-adt-ro`, `mcp-abap-adt-compact` and
44
+ * `mcp-abap-adt-compact-ro` are this table with their own set, nothing else
45
+ *.
46
+ */
47
+ export declare function coreParameters(toolSet: ToolSet, program?: string): ParameterTable;
48
+ /** `mcp-abap-adt`'s table: core's, with the full tool set. */
49
+ export declare const CORE_PARAMETERS: ParameterTable;
50
+ /** What `mcp-abap-adt` reads: the shared values and the destination's. */
51
+ export interface CoreConfig extends IServerConfig {
52
+ /** The env file, resolved (`--env` / `--env-path` / `MCP_ENV_PATH`). */
53
+ envFile?: string;
54
+ /** Alias of `envFile`, kept for configs made by hand. */
55
+ envFilePath?: string;
56
+ /** `--env` / `env` as the user gave it: a destination name or a path */
57
+ envDestination?: string;
58
+ /** `--env-path` / `MCP_ENV_PATH` / `env-path` as the user gave it */
59
+ envPath?: string;
60
+ /**
61
+ * The parameter `envFile` came from, as the user gave it: `--env`,
62
+ * `--env-path`, `MCP_ENV_PATH`, `env (config file)`, or
63
+ * `env-path (config file)`.
64
+ */
65
+ envFileSource?: string;
66
+ /** The stores' base directory */
67
+ authBrokerPath?: string;
68
+ /** Default MCP destination from --mcp parameter */
69
+ mcpDestination?: string;
70
+ /** Write named sessions to disk (`--unsafe`) */
71
+ unsafe?: boolean;
72
+ /**
73
+ * The browser of a login (`--browser`): system (default), auto, chrome,
74
+ * edge, firefox, none, headless — mapped by the platform to one of
75
+ * auth-providers' browsers.
76
+ */
77
+ browser?: string;
78
+ /** The program that opens the login URL (`--browser-program`); excludes `browser`. */
79
+ browserProgram?: string;
80
+ /** How an expired session is renewed (`--renewal`); default `refresh-then-login`. */
81
+ renewal?: 'refresh-then-login' | 'refresh-only';
82
+ /** Port for the login's callback (`--browser-auth-port`) */
83
+ browserAuthPort?: number;
84
+ /** `--login-timeout` in seconds: the bound on each login; absent: none. */
85
+ loginTimeout?: number;
86
+ /**
87
+ * The form `loginTimeout` came from: `--login-timeout`,
88
+ * `MCP_LOGIN_TIMEOUT`, or `login-timeout (config file)`.
89
+ */
90
+ loginTimeoutSource?: string;
91
+ /** `--auth-debug`: the providers' debug lines on stderr, secrets in their prepared form. */
92
+ authDebug?: boolean;
93
+ /** SAP connection type: http (default) or rfc */
94
+ connectionType?: 'http' | 'rfc';
95
+ /**
96
+ * The form `connectionType` came from: `--connection-type`,
97
+ * `SAP_CONNECTION_TYPE`, or `connection-type (config file)`. Only the CLI
98
+ * form beats an `SAP_CONNECTION_TYPE` the env file brings (as in 15.x).
99
+ */
100
+ connectionTypeSource?: string;
101
+ /** RFC: the message server host (`--mshost`, `SAP_MSHOST`, `mshost`). */
102
+ mshost?: string;
103
+ /** RFC: the message server service (`--msserv`, `SAP_MSSERV`, `msserv`). */
104
+ msserv?: string;
105
+ /** RFC: the system id (`--sysid`, `SAP_SYSID`, `sysid`). */
106
+ sysid?: string;
107
+ /** RFC: the logon group (`--group`, `SAP_GROUP`, `group`). */
108
+ group?: string;
109
+ /** RFC: the SAProuter string (`--saprouter`, `SAP_SAPROUTER`, `saprouter`). */
110
+ saprouter?: string;
111
+ /**
112
+ * The form each message-server field came from, as `connectionTypeSource`:
113
+ * only the CLI form beats what the env file brings.
114
+ */
115
+ messageServerSource?: Partial<Record<MessageServerField, string>>;
116
+ }
117
+ /**
118
+ * core's configuration from the arguments (without the program's own two),
119
+ * the environment and the loaded config file, read by core's table for
120
+ * `toolSet` (the full set unless a sibling command passes its own). A removed
121
+ * parameter (`--exposition` among them) or an invalid value throws a
122
+ * `ParameterRefusal` in its words.
123
+ */
124
+ export declare function readCoreConfig(argv: readonly string[], env: NodeJS.ProcessEnv, yaml?: YamlConfig | null, toolSet?: ToolSet): CoreConfig;
125
+ //# sourceMappingURL=coreParameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coreParameters.d.ts","sourceRoot":"","sources":["../../src/config/coreParameters.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAIL,KAAK,aAAa,EAGlB,KAAK,kBAAkB,EACvB,KAAK,SAAS,EAEd,KAAK,cAAc,EASnB,KAAK,UAAU,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAe,KAAK,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAMvE,2DAA2D;AAC3D,eAAO,MAAM,SAAS,EAAE,SAAS,SAAS,EA2FzC,CAAC;AAiBF,eAAO,MAAM,mBAAmB,EAAE,SAAS,SAAS,EAS/C,CAA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ACzB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,4FAA4F;IAC5F,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAChC;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAC;CACnE;AAKD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,IAAI,GAAE,UAAU,GAAG,IAAW,EAC9B,OAAO,GAAE,OAAqB,GAC7B,UAAU,CAqDZ"}
@@ -0,0 +1,331 @@
1
+ "use strict";
2
+ /**
3
+ * `mcp-abap-adt`'s parameter table: the destination, the
4
+ * browser and the login, beside lib's shared rows. Nothing of the HTTP or SSE
5
+ * binaries is here; the CLI or YAML form of one of their options — or any
6
+ * form of `--transport`, which is gone — stops the start naming the binary
7
+ * that serves it. Their environment variables are not read.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.CORE_PARAMETERS = exports.AUTH_DEBUG_ROW = exports.LOGIN_TIMEOUT_ROW = exports.MAX_LOGIN_TIMEOUT_SECONDS = exports.MESSAGE_SERVER_ROWS = exports.CORE_ROWS = void 0;
11
+ exports.parseLoginTimeout = parseLoginTimeout;
12
+ exports.statedLoginTimeout = statedLoginTimeout;
13
+ exports.coreParameters = coreParameters;
14
+ exports.readCoreConfig = readCoreConfig;
15
+ const config_1 = require("@mcp-abap-adt/lib/config");
16
+ const tool_set_1 = require("@mcp-abap-adt/lib/tool-set");
17
+ const responsible_rules_1 = require("@mcp-abap-adt/responsible-rules");
18
+ const envResolver_1 = require("./envResolver");
19
+ const DESTINATION = 'DESTINATION AND LOGIN';
20
+ /** The destination, browser and login rows: core's own. */
21
+ exports.CORE_ROWS = [
22
+ {
23
+ key: 'mcpDestination',
24
+ cli: '--mcp',
25
+ yaml: 'mcp',
26
+ kind: 'string',
27
+ section: DESTINATION,
28
+ help: 'Default destination name (stores under the auth-broker path). Example: TRIAL',
29
+ },
30
+ {
31
+ key: 'envDestination',
32
+ cli: '--env',
33
+ yaml: 'env',
34
+ kind: 'string',
35
+ section: DESTINATION,
36
+ help: 'Env file by destination name (resolved to sessions/<name>.env)',
37
+ },
38
+ {
39
+ key: 'envPath',
40
+ cli: '--env-path',
41
+ env: 'MCP_ENV_PATH',
42
+ yaml: 'env-path',
43
+ kind: 'string',
44
+ section: DESTINATION,
45
+ help: 'Env file by explicit path (or a file name relative to the working directory)',
46
+ },
47
+ {
48
+ key: 'authBrokerPath',
49
+ cli: '--auth-broker-path',
50
+ env: 'AUTH_BROKER_PATH',
51
+ yaml: 'auth-broker-path',
52
+ kind: 'string',
53
+ section: DESTINATION,
54
+ help: "The stores' base directory (default: the platform paths)",
55
+ },
56
+ {
57
+ key: 'unsafe',
58
+ cli: '--unsafe',
59
+ env: 'MCP_UNSAFE',
60
+ yaml: 'unsafe',
61
+ kind: 'flag',
62
+ section: DESTINATION,
63
+ help: 'Write named sessions to disk instead of keeping them in memory',
64
+ },
65
+ {
66
+ key: 'browser',
67
+ cli: '--browser',
68
+ env: 'MCP_BROWSER',
69
+ yaml: 'browser',
70
+ kind: 'string',
71
+ section: DESTINATION,
72
+ help: 'Browser for a login: system (default), auto, chrome, edge, firefox, none, headless (none and headless: the URL on stderr). Excludes --browser-program',
73
+ },
74
+ {
75
+ key: 'browserProgram',
76
+ cli: '--browser-program',
77
+ env: 'MCP_BROWSER_PROGRAM',
78
+ yaml: 'browser-program',
79
+ kind: 'string',
80
+ section: DESTINATION,
81
+ help: 'The program that opens the login URL instead of a --browser name (Linux: an executable, macOS: an application, Windows: a program). Excludes --browser',
82
+ },
83
+ {
84
+ key: 'renewal',
85
+ cli: '--renewal',
86
+ env: 'MCP_RENEWAL',
87
+ yaml: 'renewal',
88
+ kind: 'enum',
89
+ values: ['refresh-then-login', 'refresh-only'],
90
+ section: DESTINATION,
91
+ help: 'How an expired session is renewed: refresh, then log in (default); or refresh only, never a login',
92
+ },
93
+ {
94
+ key: 'browserAuthPort',
95
+ cli: '--browser-auth-port',
96
+ env: 'MCP_BROWSER_AUTH_PORT',
97
+ yaml: 'browser-auth-port',
98
+ kind: 'port',
99
+ section: DESTINATION,
100
+ help: 'Login callback port, 1-65535 (default: 61001)',
101
+ },
102
+ {
103
+ key: 'connectionType',
104
+ cli: '--connection-type',
105
+ env: 'SAP_CONNECTION_TYPE',
106
+ yaml: 'connection-type',
107
+ kind: 'enum',
108
+ values: ['http', 'rfc'],
109
+ section: DESTINATION,
110
+ help: 'SAP connection type (default: http). rfc needs the SAP NW RFC SDK',
111
+ },
112
+ ];
113
+ /**
114
+ * RFC through a message server and a logon group (connection 18), in
115
+ * `--connection-type`'s form: `SAP_X` → `--x` → `x`. Carried as configured;
116
+ * no default here (`group`'s `PUBLIC` is connection's), no check (connection
117
+ * refuses `mshost` with neither `msserv` nor `sysid`).
118
+ */
119
+ const MESSAGE_SERVER_HELP = {
120
+ mshost: 'RFC: the message server host. With it, RFC logs on through the message server and takes no host or system number from the URL; needs --msserv or --sysid',
121
+ msserv: 'RFC: the message server service (name or port)',
122
+ sysid: 'RFC: the system id, which names the message server service',
123
+ group: 'RFC: the logon group (connection default: PUBLIC)',
124
+ saprouter: 'RFC: the SAProuter string, with or without a message server',
125
+ };
126
+ exports.MESSAGE_SERVER_ROWS = config_1.MESSAGE_SERVER_FIELDS.map((field) => ({
127
+ key: field,
128
+ cli: `--${field}`,
129
+ env: config_1.MESSAGE_SERVER_ENV[field],
130
+ yaml: field,
131
+ kind: 'string',
132
+ section: DESTINATION,
133
+ help: MESSAGE_SERVER_HELP[field],
134
+ }));
135
+ /** The longest login bound: a day. */
136
+ exports.MAX_LOGIN_TIMEOUT_SECONDS = 86_400;
137
+ /** Whether `text` is one or more ASCII digits. Plain code. */
138
+ function isDigits(text) {
139
+ if (text.length === 0)
140
+ return false;
141
+ for (let i = 0; i < text.length; i += 1) {
142
+ const c = text.charCodeAt(i);
143
+ if (c < 48 || c > 57)
144
+ return false;
145
+ }
146
+ return true;
147
+ }
148
+ /**
149
+ * `--login-timeout`'s value: a whole number of seconds from 1 to 86 400,
150
+ * read by plain code — digits only, as a string or a YAML number.
151
+ */
152
+ function parseLoginTimeout(raw, name) {
153
+ const text = typeof raw === 'string' ? raw.trim() : String(raw);
154
+ const value = typeof raw === 'number'
155
+ ? raw
156
+ : isDigits(text)
157
+ ? Number.parseInt(text, 10)
158
+ : Number.NaN;
159
+ if (!Number.isInteger(value) ||
160
+ value < 1 ||
161
+ value > exports.MAX_LOGIN_TIMEOUT_SECONDS) {
162
+ throw new config_1.ParameterRefusal(`Invalid ${name}: "${text}". Must be a whole number of seconds from 1 to ${exports.MAX_LOGIN_TIMEOUT_SECONDS}`);
163
+ }
164
+ return value;
165
+ }
166
+ /**
167
+ * `--login-timeout` / `MCP_LOGIN_TIMEOUT` / `login-timeout`: the bound
168
+ * on each login, opt-in. No default: without it a login ends on its result,
169
+ * the user's refusal or its request's end.
170
+ */
171
+ exports.LOGIN_TIMEOUT_ROW = {
172
+ key: 'loginTimeout',
173
+ cli: '--login-timeout',
174
+ env: 'MCP_LOGIN_TIMEOUT',
175
+ yaml: 'login-timeout',
176
+ kind: 'custom',
177
+ parse: parseLoginTimeout,
178
+ valueHint: '=<seconds>',
179
+ section: DESTINATION,
180
+ help: `Ends a browser login that has not finished after this many seconds (1-${exports.MAX_LOGIN_TIMEOUT_SECONDS}). Default: none — a login ends when it finishes, the user refuses it, or its request ends`,
181
+ };
182
+ /**
183
+ * `--auth-debug` / `auth-debug`: the token providers' debug line names
184
+ * a refused request's secrets by their first and last four characters. The
185
+ * command line and the configuration file only — no environment variable
186
+ * turns it on.
187
+ */
188
+ exports.AUTH_DEBUG_ROW = {
189
+ key: 'authDebug',
190
+ cli: '--auth-debug',
191
+ yaml: 'auth-debug',
192
+ kind: 'flag',
193
+ section: DESTINATION,
194
+ help: "Auth debugging: the token providers' debug lines go to stderr, and a refused token request's line names the first and last four characters of each secret it sent. No environment variable. Off by default",
195
+ };
196
+ /**
197
+ * The login bound as the user set it, for the login-bound sentence: the form it came
198
+ * from (`parameterSource`) with its value — `` `--login-timeout=300` ``,
199
+ * `` `MCP_LOGIN_TIMEOUT=300` ``, or `` `login-timeout: 300` in the
200
+ * configuration file ``.
201
+ */
202
+ function statedLoginTimeout(seconds, source) {
203
+ if (source === exports.LOGIN_TIMEOUT_ROW.env) {
204
+ return `\`${exports.LOGIN_TIMEOUT_ROW.env}=${seconds}\``;
205
+ }
206
+ if (source !== undefined && !source.startsWith('--')) {
207
+ return `\`${exports.LOGIN_TIMEOUT_ROW.yaml}: ${seconds}\` in the configuration file`;
208
+ }
209
+ return `\`${exports.LOGIN_TIMEOUT_ROW.cli}=${seconds}\``;
210
+ }
211
+ /** `--allow-destination-header`: there is no header to allow any more. */
212
+ const ALLOW_DESTINATION_HEADER_REMOVED = {
213
+ cli: ['--allow-destination-header'],
214
+ yaml: ['allow-destination-header'],
215
+ words: (form) => `${form} is gone: \`mcp-abap-adt\` serves the destination it is started with (--mcp, --env, --env-path); the HTTP and SSE binaries take credentials only from \`x-sap-*\` headers`,
216
+ };
217
+ /** Removed in 16.0.0: its only purpose was to switch off the working directory's .env. */
218
+ const AUTH_BROKER_REMOVED = {
219
+ cli: ['--auth-broker'],
220
+ env: ['MCP_USE_AUTH_BROKER'],
221
+ yaml: ['auth-broker'],
222
+ words: (form) => `${form} was removed in 16.0.0 — remove it from the configuration`,
223
+ };
224
+ /**
225
+ * core's table for a tool set: its rows, the shared rows, and what it
226
+ * refuses — the set's removed `--exposition` among them, naming the stdio
227
+ * binary its words asked for. `mcp-abap-adt-ro`, `mcp-abap-adt-compact` and
228
+ * `mcp-abap-adt-compact-ro` are this table with their own set, nothing else
229
+ *.
230
+ */
231
+ function coreParameters(toolSet, program = 'mcp-abap-adt') {
232
+ return {
233
+ program,
234
+ rows: [
235
+ config_1.CONF_ROW,
236
+ responsible_rules_1.SYSTEM_TYPE_ROW,
237
+ ...exports.CORE_ROWS,
238
+ ...exports.MESSAGE_SERVER_ROWS,
239
+ exports.LOGIN_TIMEOUT_ROW,
240
+ exports.AUTH_DEBUG_ROW,
241
+ config_1.STATE_IDLE_ROW,
242
+ config_1.BATCH_KEEP_RAW_PARTS_ROW,
243
+ config_1.SHUTDOWN_TIMEOUT_ROW,
244
+ ],
245
+ removed: [
246
+ toolSet.expositionRemoved('stdio'),
247
+ (0, config_1.transportRemoved)('stdio'),
248
+ ALLOW_DESTINATION_HEADER_REMOVED,
249
+ AUTH_BROKER_REMOVED,
250
+ config_1.SSE_OPTIONS_REMOVED,
251
+ config_1.HTTP_OPTIONS_REMOVED,
252
+ config_1.TLS_OPTIONS_REMOVED,
253
+ ],
254
+ };
255
+ }
256
+ /** `mcp-abap-adt`'s table: core's, with the full tool set. */
257
+ exports.CORE_PARAMETERS = coreParameters(tool_set_1.fullToolSet);
258
+ const str = (v) => typeof v === 'string' ? v : undefined;
259
+ /**
260
+ * core's configuration from the arguments (without the program's own two),
261
+ * the environment and the loaded config file, read by core's table for
262
+ * `toolSet` (the full set unless a sibling command passes its own). A removed
263
+ * parameter (`--exposition` among them) or an invalid value throws a
264
+ * `ParameterRefusal` in its words.
265
+ */
266
+ function readCoreConfig(argv, env, yaml = null, toolSet = tool_set_1.fullToolSet) {
267
+ const table = coreParameters(toolSet);
268
+ const values = (0, config_1.readParameters)(table, argv, env, yaml);
269
+ const source = (key) => (0, config_1.parameterSource)(table, key, argv, env, yaml);
270
+ const envDestination = str(values.envDestination);
271
+ const envPath = str(values.envPath);
272
+ const authBrokerPath = str(values.authBrokerPath);
273
+ // --env: a destination name (sessions/<name>.env under the platform paths);
274
+ // --env-path: an explicit path. Nothing is looked up in the working
275
+ // directory: a .env there is read only when named (--env-path=./.env).
276
+ const envFile = (0, envResolver_1.resolveEnvFilePath)({
277
+ envDestination,
278
+ envPath,
279
+ authBrokerPath,
280
+ });
281
+ return {
282
+ configFile: str(values.configFile),
283
+ systemType: values.systemType,
284
+ // Not written to process.env here: the env file's SAP_SYSTEM_TYPE joins
285
+ // the environment later, and the launcher resolves the precedence then
286
+ // (effectiveSystemType), as for the connection type.
287
+ systemTypeSource: source('systemType'),
288
+ stateIdleMinutes: values.stateIdleMinutes,
289
+ batchKeepRawParts: values.batchKeepRawParts === true,
290
+ shutdownTimeout: values.shutdownTimeout,
291
+ mcpDestination: str(values.mcpDestination),
292
+ envDestination,
293
+ envPath,
294
+ envFile,
295
+ envFilePath: envFile,
296
+ // The resolver prefers the path over the name; so does the source.
297
+ envFileSource: envFile === undefined
298
+ ? undefined
299
+ : envPath
300
+ ? source('envPath')
301
+ : source('envDestination'),
302
+ authBrokerPath,
303
+ unsafe: values.unsafe ?? false,
304
+ browser: str(values.browser),
305
+ browserProgram: str(values.browserProgram),
306
+ renewal: values.renewal,
307
+ browserAuthPort: values.browserAuthPort,
308
+ loginTimeout: values.loginTimeout,
309
+ authDebug: values.authDebug === true,
310
+ loginTimeoutSource: values.loginTimeout === undefined ? undefined : source('loginTimeout'),
311
+ connectionType: values.connectionType,
312
+ connectionTypeSource: source('connectionType'),
313
+ ...messageServerOf(values, source),
314
+ };
315
+ }
316
+ /** The message-server fields set, each with its source; an unset one has no key. */
317
+ function messageServerOf(values, source) {
318
+ const out = {};
319
+ const sources = {};
320
+ for (const field of config_1.MESSAGE_SERVER_FIELDS) {
321
+ const value = str(values[field]);
322
+ if (value === undefined)
323
+ continue;
324
+ out[field] = value;
325
+ const from = source(field);
326
+ if (from !== undefined)
327
+ sources[field] = from;
328
+ }
329
+ return { ...out, messageServerSource: sources };
330
+ }
331
+ //# sourceMappingURL=coreParameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coreParameters.js","sourceRoot":"","sources":["../../src/config/coreParameters.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAsKH,8CAkBC;AAwCD,gDAQC;AA0BD,wCA2BC;AAmFD,wCA0DC;AAxaD,qDAoBkC;AAClC,yDAAuE;AACvE,uEAAkE;AAClE,+CAAmD;AAEnD,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAE5C,2DAA2D;AAC9C,QAAA,SAAS,GAAyB;IAC7C;QACE,GAAG,EAAE,gBAAgB;QACrB,GAAG,EAAE,OAAO;QACZ,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE,8EAA8E;KACrF;IACD;QACE,GAAG,EAAE,gBAAgB;QACrB,GAAG,EAAE,OAAO;QACZ,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE,gEAAgE;KACvE;IACD;QACE,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,YAAY;QACjB,GAAG,EAAE,cAAc;QACnB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE,8EAA8E;KACrF;IACD;QACE,GAAG,EAAE,gBAAgB;QACrB,GAAG,EAAE,oBAAoB;QACzB,GAAG,EAAE,kBAAkB;QACvB,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,WAAW;QACpB,IAAI,EAAE,0DAA0D;KACjE;IAC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AAG,EAAE,mBAAmB,EAAE,OAAO,EAAE,CAAC;AAClD,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The keys of an `--env` file the process reads from `process.env`: the
3
+ * client, the connection and system type, the language, and the RFC message
4
+ * server's address (`SAP_MSHOST`, `SAP_MSSERV`, `SAP_SYSID`, `SAP_GROUP`,
5
+ * `SAP_SAPROUTER`), which the launcher reads after the file as it reads the
6
+ * connection type.
7
+ *
8
+ * `--env-path` hands the file to the auth broker's session store, which
9
+ * connects with it but never touches `process.env`, so these are bridged
10
+ * here. `SAP_LANGUAGE` was missing from the list, and every object created
11
+ * through a session from `--env-path` took the library's default language
12
+ * instead of the file's (#182).
13
+ *
14
+ * `SAP_RESPONSIBLE`, `SAP_MASTER_SYSTEM` and `SAP_USERNAME` are not bridged
15
+ * (16.0.0): they are the file's destination's own, read per destination
16
+ * (`IDestinations.systemContextFor`). In the process environment they would
17
+ * become every other destination's fallback.
18
+ */
19
+ export declare const ENV_FILE_CONTEXT_KEYS: readonly ["SAP_CLIENT", "SAP_CONNECTION_TYPE", "SAP_SYSTEM_TYPE", "SAP_LANGUAGE", "SAP_MSHOST", "SAP_MSSERV", "SAP_SYSID", "SAP_GROUP", "SAP_SAPROUTER"];
20
+ /**
21
+ * Copies {@link ENV_FILE_CONTEXT_KEYS} from an env file into `env`, never
22
+ * over a value already set there: the process environment wins over the file.
23
+ * A missing or unreadable file changes nothing — the broker validates it.
24
+ */
25
+ export declare function hydrateSystemContextFromEnvFile(envFilePath?: string, env?: NodeJS.ProcessEnv): void;
26
+ //# sourceMappingURL=envFileContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envFileContext.d.ts","sourceRoot":"","sources":["../../src/config/envFileContext.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,qBAAqB,0JAUxB,CAAC;AAEX;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,WAAW,CAAC,EAAE,MAAM,EACpB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,IAAI,CAaN"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ENV_FILE_CONTEXT_KEYS = void 0;
37
+ exports.hydrateSystemContextFromEnvFile = hydrateSystemContextFromEnvFile;
38
+ const fs = __importStar(require("node:fs"));
39
+ const dotenv = __importStar(require("dotenv"));
40
+ /**
41
+ * The keys of an `--env` file the process reads from `process.env`: the
42
+ * client, the connection and system type, the language, and the RFC message
43
+ * server's address (`SAP_MSHOST`, `SAP_MSSERV`, `SAP_SYSID`, `SAP_GROUP`,
44
+ * `SAP_SAPROUTER`), which the launcher reads after the file as it reads the
45
+ * connection type.
46
+ *
47
+ * `--env-path` hands the file to the auth broker's session store, which
48
+ * connects with it but never touches `process.env`, so these are bridged
49
+ * here. `SAP_LANGUAGE` was missing from the list, and every object created
50
+ * through a session from `--env-path` took the library's default language
51
+ * instead of the file's (#182).
52
+ *
53
+ * `SAP_RESPONSIBLE`, `SAP_MASTER_SYSTEM` and `SAP_USERNAME` are not bridged
54
+ * (16.0.0): they are the file's destination's own, read per destination
55
+ * (`IDestinations.systemContextFor`). In the process environment they would
56
+ * become every other destination's fallback.
57
+ */
58
+ exports.ENV_FILE_CONTEXT_KEYS = [
59
+ 'SAP_CLIENT',
60
+ 'SAP_CONNECTION_TYPE',
61
+ 'SAP_SYSTEM_TYPE',
62
+ 'SAP_LANGUAGE',
63
+ 'SAP_MSHOST',
64
+ 'SAP_MSSERV',
65
+ 'SAP_SYSID',
66
+ 'SAP_GROUP',
67
+ 'SAP_SAPROUTER',
68
+ ];
69
+ /**
70
+ * Copies {@link ENV_FILE_CONTEXT_KEYS} from an env file into `env`, never
71
+ * over a value already set there: the process environment wins over the file.
72
+ * A missing or unreadable file changes nothing — the broker validates it.
73
+ */
74
+ function hydrateSystemContextFromEnvFile(envFilePath, env = process.env) {
75
+ if (!envFilePath || !fs.existsSync(envFilePath))
76
+ return;
77
+ let parsed;
78
+ try {
79
+ parsed = dotenv.parse(fs.readFileSync(envFilePath, 'utf8'));
80
+ }
81
+ catch {
82
+ return;
83
+ }
84
+ for (const key of exports.ENV_FILE_CONTEXT_KEYS) {
85
+ const value = parsed[key];
86
+ if (!env[key] && value)
87
+ env[key] = value;
88
+ }
89
+ }
90
+ //# sourceMappingURL=envFileContext.js.map