@microsoft/agents-hosting 1.9.0-beta.8.gf58e66b2ee → 1.9.1
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.
- package/README.md +182 -4
- package/dist/package.json +3 -3
- package/dist/src/app/agentApplication.d.ts +4 -3
- package/dist/src/app/agentApplication.js +24 -21
- package/dist/src/app/agentApplication.js.map +1 -1
- package/dist/src/app/agentApplicationBuilder.d.ts +9 -2
- package/dist/src/app/agentApplicationBuilder.js +9 -0
- package/dist/src/app/agentApplicationBuilder.js.map +1 -1
- package/dist/src/app/agentApplicationOptions.d.ts +16 -4
- package/dist/src/app/auth/authorizationManager.d.ts +0 -8
- package/dist/src/app/auth/authorizationManager.js +104 -178
- package/dist/src/app/auth/authorizationManager.js.map +1 -1
- package/dist/src/app/auth/handlerStorage.d.ts +5 -3
- package/dist/src/app/auth/handlerStorage.js +36 -10
- package/dist/src/app/auth/handlerStorage.js.map +1 -1
- package/dist/src/app/auth/types.d.ts +2 -2
- package/dist/src/app/index.d.ts +1 -0
- package/dist/src/app/proactive/proactive.js +10 -6
- package/dist/src/app/proactive/proactive.js.map +1 -1
- package/dist/src/app/proactive/proactiveOptions.d.ts +2 -2
- package/dist/src/app/rateLimit.d.ts +315 -0
- package/dist/src/app/rateLimit.js +333 -0
- package/dist/src/app/rateLimit.js.map +1 -0
- package/dist/src/app/turnState.d.ts +6 -3
- package/dist/src/app/turnState.js +43 -4
- package/dist/src/app/turnState.js.map +1 -1
- package/dist/src/auth/authConfiguration.d.ts +10 -3
- package/dist/src/auth/authConfiguration.js +292 -259
- package/dist/src/auth/authConfiguration.js.map +1 -1
- package/dist/src/auth/settings.d.ts +8 -70
- package/dist/src/auth/settings.js +5 -67
- package/dist/src/auth/settings.js.map +1 -1
- package/dist/src/cloudAdapter.d.ts +5 -0
- package/dist/src/cloudAdapter.js +13 -103
- package/dist/src/cloudAdapter.js.map +1 -1
- package/dist/src/configuration/botFrameworkEnvironmentCompatibility.d.ts +23 -0
- package/dist/src/configuration/botFrameworkEnvironmentCompatibility.js +183 -0
- package/dist/src/configuration/botFrameworkEnvironmentCompatibility.js.map +1 -0
- package/dist/src/configuration/configuration.d.ts +83 -0
- package/dist/src/configuration/configuration.js +836 -0
- package/dist/src/configuration/configuration.js.map +1 -0
- package/dist/src/configuration/configurationSource.d.ts +57 -0
- package/dist/src/configuration/configurationSource.js +7 -0
- package/dist/src/configuration/configurationSource.js.map +1 -0
- package/dist/src/configuration/environmentConfiguration.d.ts +14 -0
- package/dist/src/configuration/environmentConfiguration.js +271 -0
- package/dist/src/configuration/environmentConfiguration.js.map +1 -0
- package/dist/src/configuration/index.d.ts +7 -0
- package/dist/src/configuration/index.js +14 -0
- package/dist/src/configuration/index.js.map +1 -0
- package/dist/src/configuration/jsonFileConfigurationSource.d.ts +15 -0
- package/dist/src/configuration/jsonFileConfigurationSource.js +58 -0
- package/dist/src/configuration/jsonFileConfigurationSource.js.map +1 -0
- package/dist/src/createCloudAdapter.d.ts +30 -5
- package/dist/src/createCloudAdapter.js +17 -10
- package/dist/src/createCloudAdapter.js.map +1 -1
- package/dist/src/errorHelper.js +117 -5
- package/dist/src/errorHelper.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/observability/traces.d.ts +6 -4
- package/dist/src/observability/traces.js +10 -9
- package/dist/src/observability/traces.js.map +1 -1
- package/dist/src/outboundHostValidator.d.ts +4 -1
- package/dist/src/outboundHostValidator.js +25 -48
- package/dist/src/outboundHostValidator.js.map +1 -1
- package/dist/src/state/agentState.d.ts +8 -3
- package/dist/src/state/agentState.js +26 -8
- package/dist/src/state/agentState.js.map +1 -1
- package/dist/src/state/conversationState.d.ts +2 -2
- package/dist/src/state/conversationState.js.map +1 -1
- package/dist/src/state/userState.d.ts +2 -2
- package/dist/src/state/userState.js.map +1 -1
- package/dist/src/statusCodes.d.ts +5 -0
- package/dist/src/statusCodes.js +5 -0
- package/dist/src/statusCodes.js.map +1 -1
- package/dist/src/storage/fileStorage.d.ts +83 -68
- package/dist/src/storage/fileStorage.js +279 -105
- package/dist/src/storage/fileStorage.js.map +1 -1
- package/dist/src/storage/index.d.ts +1 -0
- package/dist/src/storage/index.js +1 -0
- package/dist/src/storage/index.js.map +1 -1
- package/dist/src/storage/memoryStorage.d.ts +85 -60
- package/dist/src/storage/memoryStorage.js +244 -87
- package/dist/src/storage/memoryStorage.js.map +1 -1
- package/dist/src/storage/storage.d.ts +100 -2
- package/dist/src/storage/storage.js +25 -0
- package/dist/src/storage/storage.js.map +1 -1
- package/dist/src/storage/storageCompatibility.d.ts +17 -0
- package/dist/src/storage/storageCompatibility.js +157 -0
- package/dist/src/storage/storageCompatibility.js.map +1 -0
- package/dist/src/storage/storageExpiry.d.ts +6 -0
- package/dist/src/storage/storageExpiry.js +20 -0
- package/dist/src/storage/storageExpiry.js.map +1 -0
- package/dist/src/utils/env.d.ts +43 -0
- package/dist/src/utils/env.js +42 -6
- package/dist/src/utils/env.js.map +1 -1
- package/dist/src/utils.d.ts +1 -0
- package/dist/src/utils.js +10 -1
- package/dist/src/utils.js.map +1 -1
- package/package.json +3 -3
- package/src/app/agentApplication.ts +27 -14
- package/src/app/agentApplicationBuilder.ts +13 -2
- package/src/app/agentApplicationOptions.ts +18 -4
- package/src/app/auth/authorizationManager.ts +126 -204
- package/src/app/auth/handlerStorage.ts +51 -7
- package/src/app/auth/types.ts +2 -2
- package/src/app/index.ts +7 -0
- package/src/app/proactive/proactive.ts +19 -9
- package/src/app/proactive/proactiveOptions.ts +2 -2
- package/src/app/rateLimit.ts +659 -0
- package/src/app/turnState.ts +50 -7
- package/src/auth/authConfiguration.ts +415 -260
- package/src/auth/settings.ts +5 -82
- package/src/cloudAdapter.ts +38 -113
- package/src/configuration/botFrameworkEnvironmentCompatibility.ts +245 -0
- package/src/configuration/configuration.ts +1076 -0
- package/src/configuration/configurationSource.ts +76 -0
- package/src/configuration/environmentConfiguration.ts +377 -0
- package/src/configuration/index.ts +19 -0
- package/src/configuration/jsonFileConfigurationSource.ts +74 -0
- package/src/createCloudAdapter.ts +52 -9
- package/src/errorHelper.ts +143 -5
- package/src/index.ts +1 -0
- package/src/observability/traces.ts +8 -7
- package/src/outboundHostValidator.ts +37 -44
- package/src/state/agentState.ts +39 -13
- package/src/state/conversationState.ts +2 -2
- package/src/state/userState.ts +2 -2
- package/src/statusCodes.ts +6 -0
- package/src/storage/fileStorage.ts +299 -106
- package/src/storage/index.ts +1 -0
- package/src/storage/memoryStorage.ts +268 -85
- package/src/storage/storage.ts +114 -2
- package/src/storage/storageCompatibility.ts +185 -0
- package/src/storage/storageExpiry.ts +21 -0
- package/src/utils/env.ts +63 -0
- package/src/utils.ts +10 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.loadBotFrameworkEnvironmentConfiguration = loadBotFrameworkEnvironmentConfiguration;
|
|
8
|
+
exports.loadBotFrameworkPrefixedEnvironmentConfiguration = loadBotFrameworkPrefixedEnvironmentConfiguration;
|
|
9
|
+
exports.loadBotFrameworkAuthorizationEnvironmentConfiguration = loadBotFrameworkAuthorizationEnvironmentConfiguration;
|
|
10
|
+
const configuration_1 = require("./configuration");
|
|
11
|
+
const env_1 = require("../utils/env");
|
|
12
|
+
const DEFAULT_CONNECTION_ID = 'serviceConnection';
|
|
13
|
+
const flatConnectionProperties = {
|
|
14
|
+
MicrosoftAppTenantId: 'tenantId',
|
|
15
|
+
MicrosoftAppId: 'clientId',
|
|
16
|
+
MicrosoftAppPassword: 'clientSecret',
|
|
17
|
+
certPemFile: 'certPemFile',
|
|
18
|
+
certKeyFile: 'certKeyFile',
|
|
19
|
+
connectionName: 'connectionName',
|
|
20
|
+
MicrosoftAppClientId: 'federatedClientId',
|
|
21
|
+
authorityEndpoint: 'authorityEndpoint',
|
|
22
|
+
scope: 'scopes',
|
|
23
|
+
altBlueprintConnectionName: 'altBlueprintConnectionName',
|
|
24
|
+
alternateBlueprintConnectionName: 'altBlueprintConnectionName',
|
|
25
|
+
WIDAssertionFile: 'WIDAssertionFile',
|
|
26
|
+
azureRegion: 'azureRegion',
|
|
27
|
+
sendX5C: 'sendX5C',
|
|
28
|
+
msalRetryCount: 'msalRetryCount',
|
|
29
|
+
authType: 'authType',
|
|
30
|
+
federatedTokenFile: 'federatedTokenFile',
|
|
31
|
+
idpmResource: 'idpmResource',
|
|
32
|
+
sidecarBaseUrl: 'sidecarBaseUrl',
|
|
33
|
+
serviceName: 'serviceName',
|
|
34
|
+
blueprintServiceName: 'blueprintServiceName',
|
|
35
|
+
bypassLocalNetworkRestriction: 'bypassLocalNetworkRestriction',
|
|
36
|
+
requestTimeout: 'requestTimeout',
|
|
37
|
+
retryCount: 'retryCount',
|
|
38
|
+
validateIssuer: 'validateIssuer'
|
|
39
|
+
};
|
|
40
|
+
const prefixedConnectionProperties = {
|
|
41
|
+
tenantId: 'tenantId',
|
|
42
|
+
clientId: 'clientId',
|
|
43
|
+
clientSecret: 'clientSecret',
|
|
44
|
+
certPemFile: 'certPemFile',
|
|
45
|
+
certKeyFile: 'certKeyFile',
|
|
46
|
+
connectionName: 'connectionName',
|
|
47
|
+
FICClientId: 'federatedClientId',
|
|
48
|
+
authorityEndpoint: 'authorityEndpoint',
|
|
49
|
+
scope: 'scopes',
|
|
50
|
+
altBlueprintConnectionName: 'altBlueprintConnectionName',
|
|
51
|
+
alternateBlueprintConnectionName: 'altBlueprintConnectionName',
|
|
52
|
+
WIDAssertionFile: 'WIDAssertionFile',
|
|
53
|
+
azureRegion: 'azureRegion',
|
|
54
|
+
sendX5C: 'sendX5C',
|
|
55
|
+
msalRetryCount: 'msalRetryCount',
|
|
56
|
+
authType: 'authType',
|
|
57
|
+
federatedTokenFile: 'federatedTokenFile',
|
|
58
|
+
idpmResource: 'idpmResource',
|
|
59
|
+
sidecarBaseUrl: 'sidecarBaseUrl',
|
|
60
|
+
serviceName: 'serviceName',
|
|
61
|
+
blueprintServiceName: 'blueprintServiceName',
|
|
62
|
+
bypassLocalNetworkRestriction: 'bypassLocalNetworkRestriction',
|
|
63
|
+
requestTimeout: 'requestTimeout',
|
|
64
|
+
retryCount: 'retryCount',
|
|
65
|
+
validateIssuer: 'validateIssuer'
|
|
66
|
+
};
|
|
67
|
+
const legacyAuthorizationProperties = {
|
|
68
|
+
type: 'type',
|
|
69
|
+
connectionName: 'azureBotOAuthConnectionName',
|
|
70
|
+
connectionTitle: 'title',
|
|
71
|
+
connectionText: 'text',
|
|
72
|
+
maxAttempts: 'invalidSignInRetryMax',
|
|
73
|
+
messages_invalidCode: 'invalidSignInRetryMessage',
|
|
74
|
+
messages_invalidCodeFormat: 'invalidSignInRetryMessageFormat',
|
|
75
|
+
messages_maxAttemptsExceeded: 'invalidSignInRetryMaxExceededMessage',
|
|
76
|
+
obo_connection: 'oboConnectionName',
|
|
77
|
+
obo_scopes: 'oboScopes',
|
|
78
|
+
enableSso: 'enableSso',
|
|
79
|
+
scopes: 'scopes',
|
|
80
|
+
altBlueprintConnectionName: 'altBlueprintConnectionName'
|
|
81
|
+
};
|
|
82
|
+
/** Binds the flat Bot Framework single-connection environment variables. */
|
|
83
|
+
function loadBotFrameworkEnvironmentConfiguration(env = process.env) {
|
|
84
|
+
return bindConnectionCompatibility(env, undefined, flatConnectionProperties);
|
|
85
|
+
}
|
|
86
|
+
/** Binds the Bot Framework `<connectionName>_<property>` environment form. */
|
|
87
|
+
function loadBotFrameworkPrefixedEnvironmentConfiguration(connectionName, env = process.env) {
|
|
88
|
+
return bindConnectionCompatibility(env, connectionName, prefixedConnectionProperties);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Binds Bot Framework-era `<handlerId>_<property>` authorization variables.
|
|
92
|
+
* Only known runtime/external handler IDs participate, matching existing
|
|
93
|
+
* compatibility behavior.
|
|
94
|
+
*/
|
|
95
|
+
function loadBotFrameworkAuthorizationEnvironmentConfiguration(handlerIds, env = process.env) {
|
|
96
|
+
const layer = (0, configuration_1.createConfigurationLayer)();
|
|
97
|
+
const replacements = [];
|
|
98
|
+
const longestHandlerIdsFirst = [...handlerIds].sort((left, right) => right.length - left.length);
|
|
99
|
+
for (const [legacyKey, rawValue] of Object.entries(env)) {
|
|
100
|
+
if (!(rawValue === null || rawValue === void 0 ? void 0 : rawValue.trim())) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const id = longestHandlerIdsFirst.find(candidate => legacyKey.toLowerCase().startsWith(`${candidate.toLowerCase()}_`));
|
|
104
|
+
if (!id) {
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
const legacyProperty = legacyKey.substring(id.length + 1);
|
|
108
|
+
const property = findProperty(legacyAuthorizationProperties, legacyProperty);
|
|
109
|
+
if (!property) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
const value = normalizeAuthorizationValue(property, rawValue);
|
|
113
|
+
if (!trySet(layer, `agentApplication.userAuthorization.handlers.${id}.settings.${property}`, value, legacyKey)) {
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
116
|
+
replacements.push({
|
|
117
|
+
legacyKey,
|
|
118
|
+
modernKey: `AgentApplication__UserAuthorization__Handlers__${id}__Settings__${property}`
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
layer: (0, configuration_1.freezeConfigurationLayer)(layer),
|
|
123
|
+
replacements: Object.freeze(replacements.map(replacement => Object.freeze(replacement)))
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function bindConnectionCompatibility(env, connectionName, properties) {
|
|
127
|
+
const layer = (0, configuration_1.createConfigurationLayer)();
|
|
128
|
+
const id = connectionName || DEFAULT_CONNECTION_ID;
|
|
129
|
+
const indexedEnvironment = (0, env_1.loadEnvSettings)(() => { }, env);
|
|
130
|
+
for (const [legacyProperty, property] of Object.entries(properties)) {
|
|
131
|
+
const key = connectionName ? `${connectionName}_${legacyProperty}` : legacyProperty;
|
|
132
|
+
const value = findEnvironmentValue(indexedEnvironment, key);
|
|
133
|
+
if (!(value === null || value === void 0 ? void 0 : value.trim())) {
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
trySet(layer, `connections.${id}.settings.${property}`, normalizeConnectionValue(property, value), key, property === 'validateIssuer');
|
|
137
|
+
}
|
|
138
|
+
return (0, configuration_1.freezeConfigurationLayer)(layer);
|
|
139
|
+
}
|
|
140
|
+
function findEnvironmentValue(env, key) {
|
|
141
|
+
var _a;
|
|
142
|
+
return (_a = env[key.toUpperCase()]) === null || _a === void 0 ? void 0 : _a.value;
|
|
143
|
+
}
|
|
144
|
+
function findProperty(properties, input) {
|
|
145
|
+
const key = Object.keys(properties).find(candidate => candidate.toLowerCase() === input.toLowerCase());
|
|
146
|
+
return key ? properties[key] : undefined;
|
|
147
|
+
}
|
|
148
|
+
function normalizeConnectionValue(property, value) {
|
|
149
|
+
if (property === 'sendX5C' || property === 'bypassLocalNetworkRestriction') {
|
|
150
|
+
return String(value === 'true');
|
|
151
|
+
}
|
|
152
|
+
if (property === 'msalRetryCount' || property === 'requestTimeout' || property === 'retryCount') {
|
|
153
|
+
const parsed = Number.parseInt(value, 10);
|
|
154
|
+
return Number.isFinite(parsed) ? String(parsed) : value;
|
|
155
|
+
}
|
|
156
|
+
return value;
|
|
157
|
+
}
|
|
158
|
+
function normalizeAuthorizationValue(property, value) {
|
|
159
|
+
if (property === 'enableSso') {
|
|
160
|
+
return String(value !== 'false');
|
|
161
|
+
}
|
|
162
|
+
if (property === 'invalidSignInRetryMax') {
|
|
163
|
+
const parsed = Number.parseInt(value);
|
|
164
|
+
return Number.isFinite(parsed) ? String(parsed) : value;
|
|
165
|
+
}
|
|
166
|
+
return value;
|
|
167
|
+
}
|
|
168
|
+
function trySet(layer, path, value, sourceName, throwOnInvalidValue = false) {
|
|
169
|
+
try {
|
|
170
|
+
(0, configuration_1.setConfigurationValue)(layer, path, value, sourceName, 'environment');
|
|
171
|
+
return true;
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
if (!(0, configuration_1.isConfigurationInputError)(error)) {
|
|
175
|
+
throw error;
|
|
176
|
+
}
|
|
177
|
+
if (throwOnInvalidValue && (0, configuration_1.isInvalidConfigurationValueError)(error)) {
|
|
178
|
+
throw error;
|
|
179
|
+
}
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=botFrameworkEnvironmentCompatibility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"botFrameworkEnvironmentCompatibility.js","sourceRoot":"","sources":["../../../src/configuration/botFrameworkEnvironmentCompatibility.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;AAEH,mDAOwB;AACxB,sCAAuD;AAEvD,MAAM,qBAAqB,GAAG,mBAAmB,CAAA;AAEjD,MAAM,wBAAwB,GAAG;IAC/B,oBAAoB,EAAE,UAAU;IAChC,cAAc,EAAE,UAAU;IAC1B,oBAAoB,EAAE,cAAc;IACpC,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,aAAa;IAC1B,cAAc,EAAE,gBAAgB;IAChC,oBAAoB,EAAE,mBAAmB;IACzC,iBAAiB,EAAE,mBAAmB;IACtC,KAAK,EAAE,QAAQ;IACf,0BAA0B,EAAE,4BAA4B;IACxD,gCAAgC,EAAE,4BAA4B;IAC9D,gBAAgB,EAAE,kBAAkB;IACpC,WAAW,EAAE,aAAa;IAC1B,OAAO,EAAE,SAAS;IAClB,cAAc,EAAE,gBAAgB;IAChC,QAAQ,EAAE,UAAU;IACpB,kBAAkB,EAAE,oBAAoB;IACxC,YAAY,EAAE,cAAc;IAC5B,cAAc,EAAE,gBAAgB;IAChC,WAAW,EAAE,aAAa;IAC1B,oBAAoB,E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A2B,CAAE,QAAgB,EAAE,KAAa;IACnE,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;QAC7B,OAAO,MAAM,CAAC,KAAK,KAAK,OAAO,CAAC,CAAA;IAClC,CAAC;IACD,IAAI,QAAQ,KAAK,uBAAuB,EAAE,CAAC;QACzC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QACrC,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;IACzD,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,MAAM,CACb,KAAyB,EACzB,IAAY,EACZ,KAAa,EACb,UAAkB,EAClB,mBAAmB,GAAG,KAAK;IAE3B,IAAI,CAAC;QACH,IAAA,qCAAqB,EAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,aAAa,CAAC,CAAA;QACpE,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,IAAA,yCAAyB,EAAC,KAAK,CAAC,EAAE,CAAC;YACtC,MAAM,KAAK,CAAA;QACb,CAAC;QACD,IAAI,mBAAmB,IAAI,IAAA,gDAAgC,EAAC,KAAK,CAAC,EAAE,CAAC;YACnE,MAAM,KAAK,CAAA;QACb,CAAC;QACD,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { ConfigurationSourceMode, ConfigurationSourceRegistration, ConfigurationSourceResult } from './configurationSource';
|
|
6
|
+
export type AuthConnectionPatch = Record<string, unknown>;
|
|
7
|
+
export type AuthConnectionMapPatch = Partial<{
|
|
8
|
+
serviceUrl: string;
|
|
9
|
+
audience: string;
|
|
10
|
+
connection: string;
|
|
11
|
+
}>;
|
|
12
|
+
export type CloudAdapterConfigurationPatch = Partial<{
|
|
13
|
+
emitStackTrace: boolean;
|
|
14
|
+
validateServiceUrl: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
export type OutboundHostValidatorConfigurationPatch = Partial<{
|
|
17
|
+
enabled: boolean;
|
|
18
|
+
includeDefaultMicrosoftHosts: boolean;
|
|
19
|
+
hosts: readonly string[];
|
|
20
|
+
}>;
|
|
21
|
+
export type AuthorizationHandlerPatch = Record<string, unknown>;
|
|
22
|
+
export interface ConfigurationLayer {
|
|
23
|
+
readonly connections: ReadonlyMap<string, Readonly<{
|
|
24
|
+
id: string;
|
|
25
|
+
settings: Readonly<AuthConnectionPatch>;
|
|
26
|
+
}>>;
|
|
27
|
+
readonly connectionsMap: ReadonlyMap<number, Readonly<AuthConnectionMapPatch>>;
|
|
28
|
+
readonly cloudAdapterOptions: Readonly<CloudAdapterConfigurationPatch>;
|
|
29
|
+
readonly outboundHostValidator: Readonly<OutboundHostValidatorConfigurationPatch>;
|
|
30
|
+
readonly agentApplication: Readonly<{
|
|
31
|
+
userAuthorization: Readonly<{
|
|
32
|
+
handlers: ReadonlyMap<string, Readonly<{
|
|
33
|
+
id: string;
|
|
34
|
+
settings: Readonly<AuthorizationHandlerPatch>;
|
|
35
|
+
}>>;
|
|
36
|
+
}>;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
type ConfigurationSnapshot = Readonly<Record<ConfigurationSourceMode, ConfigurationLayer>>;
|
|
40
|
+
type ConfigurationInputFormat = ConfigurationSourceResult['format'] | 'environment';
|
|
41
|
+
/**
|
|
42
|
+
* An immutable, host-scoped set of resolved external configuration sources.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* Create instances with {@link createConfigurationContext}. The context is
|
|
46
|
+
* intentionally opaque; consumers pass it through their named options.
|
|
47
|
+
*/
|
|
48
|
+
export declare class ConfigurationContext {
|
|
49
|
+
private readonly configurationContextBrand;
|
|
50
|
+
private constructor();
|
|
51
|
+
}
|
|
52
|
+
export declare function createConfigurationLayer(): ConfigurationLayer;
|
|
53
|
+
export declare function freezeConfigurationLayer(layer: ConfigurationLayer): ConfigurationLayer;
|
|
54
|
+
export declare function mergeConfigurationLayers(...layers: readonly ConfigurationLayer[]): ConfigurationLayer;
|
|
55
|
+
/**
|
|
56
|
+
* Suggests a canonical path by correcting only fixed schema segments.
|
|
57
|
+
* Dynamic connection/handler IDs and route indexes are preserved verbatim.
|
|
58
|
+
*/
|
|
59
|
+
export declare function suggestConfigurationPath(path: string): string | undefined;
|
|
60
|
+
export declare function setConfigurationValue(target: ConfigurationLayer, path: string, rawValue: unknown, sourceName: string, format: ConfigurationInputFormat): void;
|
|
61
|
+
export declare function isConfigurationInputError(error: unknown): boolean;
|
|
62
|
+
export declare function isInvalidConfigurationValueError(error: unknown): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Loads configuration sources into a new immutable, host-scoped context.
|
|
65
|
+
*
|
|
66
|
+
* @param registrations Configuration sources and their explicit resolution modes.
|
|
67
|
+
* @returns A context that can be shared by consumers belonging to one host.
|
|
68
|
+
*/
|
|
69
|
+
export declare function createConfigurationContext(registrations: readonly ConfigurationSourceRegistration[]): Promise<ConfigurationContext>;
|
|
70
|
+
/**
|
|
71
|
+
* Preloads external configuration sources into an immutable process-level snapshot.
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* Call this function once, before constructing configuration consumers such as
|
|
75
|
+
* `CloudAdapter` or `AgentApplication`. Sources in the same mode are applied in
|
|
76
|
+
* registration order, with later values winning.
|
|
77
|
+
*
|
|
78
|
+
* @param registrations Configuration sources and their explicit resolution modes.
|
|
79
|
+
*/
|
|
80
|
+
export declare function preloadConfigurationSources(registrations: readonly ConfigurationSourceRegistration[]): Promise<void>;
|
|
81
|
+
export declare function getConfigurationSnapshot(context?: ConfigurationContext): ConfigurationSnapshot;
|
|
82
|
+
export declare function resetConfigurationSourcesForTest(): void;
|
|
83
|
+
export {};
|