axauth 1.2.0 → 1.3.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.
- package/dist/auth/registry.d.ts +12 -2
- package/dist/auth/registry.js +6 -3
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/auth/registry.d.ts
CHANGED
|
@@ -119,6 +119,13 @@ declare function credentialsToEnvironment(creds: Credentials): Record<string, st
|
|
|
119
119
|
* Pattern: AX_<AGENT>_CREDENTIALS (e.g., AX_GEMINI_CREDENTIALS)
|
|
120
120
|
*/
|
|
121
121
|
declare function getCredentialsEnvironmentVariableName(agent: AgentCli): string;
|
|
122
|
+
/** Options for installing credentials from environment variable */
|
|
123
|
+
interface InstallFromEnvironmentOptions {
|
|
124
|
+
/** Custom config directory */
|
|
125
|
+
configDir?: string;
|
|
126
|
+
/** Custom data directory */
|
|
127
|
+
dataDir?: string;
|
|
128
|
+
}
|
|
122
129
|
/**
|
|
123
130
|
* Install credentials from environment variable.
|
|
124
131
|
*
|
|
@@ -132,15 +139,18 @@ declare function getCredentialsEnvironmentVariableName(agent: AgentCli): string;
|
|
|
132
139
|
*
|
|
133
140
|
* @example
|
|
134
141
|
* // In CI/CD, set: AX_GEMINI_CREDENTIALS=$(cat creds.json)
|
|
135
|
-
* const result = await installCredentialsFromEnvironmentVariable("gemini",
|
|
142
|
+
* const result = await installCredentialsFromEnvironmentVariable("gemini", {
|
|
143
|
+
* configDir: "/tmp/.gemini",
|
|
144
|
+
* });
|
|
136
145
|
* if (!result.ok) {
|
|
137
146
|
* console.error(result.error);
|
|
138
147
|
* }
|
|
139
148
|
*/
|
|
140
|
-
declare function installCredentialsFromEnvironmentVariable(agent: AgentCli,
|
|
149
|
+
declare function installCredentialsFromEnvironmentVariable(agent: AgentCli, options?: InstallFromEnvironmentOptions): Promise<{
|
|
141
150
|
ok: true;
|
|
142
151
|
} | {
|
|
143
152
|
ok: false;
|
|
144
153
|
error: string;
|
|
145
154
|
}>;
|
|
155
|
+
export type { InstallFromEnvironmentOptions };
|
|
146
156
|
export { checkAllAuth, checkAuth, credentialsToEnvironment, extractRawCredentials, getAccessToken, getAdapter, getAgentAccessToken, getAllAdapters, getCapabilities, getCredentialsEnvironmentVariableName, installCredentials, installCredentialsFromEnvironmentVariable, removeCredentials, };
|
package/dist/auth/registry.js
CHANGED
|
@@ -171,12 +171,14 @@ function getCredentialsEnvironmentVariableName(agent) {
|
|
|
171
171
|
*
|
|
172
172
|
* @example
|
|
173
173
|
* // In CI/CD, set: AX_GEMINI_CREDENTIALS=$(cat creds.json)
|
|
174
|
-
* const result = await installCredentialsFromEnvironmentVariable("gemini",
|
|
174
|
+
* const result = await installCredentialsFromEnvironmentVariable("gemini", {
|
|
175
|
+
* configDir: "/tmp/.gemini",
|
|
176
|
+
* });
|
|
175
177
|
* if (!result.ok) {
|
|
176
178
|
* console.error(result.error);
|
|
177
179
|
* }
|
|
178
180
|
*/
|
|
179
|
-
async function installCredentialsFromEnvironmentVariable(agent,
|
|
181
|
+
async function installCredentialsFromEnvironmentVariable(agent, options) {
|
|
180
182
|
const environmentVariableName = getCredentialsEnvironmentVariableName(agent);
|
|
181
183
|
const environmentValue = process.env[environmentVariableName];
|
|
182
184
|
if (!environmentValue) {
|
|
@@ -218,7 +220,8 @@ async function installCredentialsFromEnvironmentVariable(agent, configDirectory)
|
|
|
218
220
|
}
|
|
219
221
|
// Install credentials to config directory
|
|
220
222
|
const result = installCredentials(credentials, {
|
|
221
|
-
configDir:
|
|
223
|
+
configDir: options?.configDir,
|
|
224
|
+
dataDir: options?.dataDir,
|
|
222
225
|
});
|
|
223
226
|
if (!result.ok) {
|
|
224
227
|
return { ok: false, error: result.message };
|
package/dist/index.d.ts
CHANGED
|
@@ -34,4 +34,4 @@ export type { AgentCli } from "axshared";
|
|
|
34
34
|
export { AGENT_CLIS } from "axshared";
|
|
35
35
|
export type { AdapterCapabilities, AuthAdapter, InstallOptions, OperationResult, RemoveOptions, } from "./auth/adapter.js";
|
|
36
36
|
export type { AuthStatus, Credentials } from "./auth/types.js";
|
|
37
|
-
export { checkAllAuth, checkAuth, credentialsToEnvironment, extractRawCredentials, getAccessToken, getAgentAccessToken, getCredentialsEnvironmentVariableName, installCredentials, installCredentialsFromEnvironmentVariable, removeCredentials, getAdapter, getAllAdapters, getCapabilities, } from "./auth/registry.js";
|
|
37
|
+
export { checkAllAuth, checkAuth, credentialsToEnvironment, extractRawCredentials, getAccessToken, getAgentAccessToken, getCredentialsEnvironmentVariableName, installCredentials, installCredentialsFromEnvironmentVariable, removeCredentials, getAdapter, getAllAdapters, getCapabilities, type InstallFromEnvironmentOptions, } from "./auth/registry.js";
|