@aouda/client 0.0.1 → 0.0.3
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 +2 -0
- package/dist/cli/index.cjs +201 -8
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +201 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/{client-DXT2ZAeO.d.cts → client-Bvs1yerF.d.cts} +122 -1
- package/dist/{client-DXT2ZAeO.d.ts → client-Bvs1yerF.d.ts} +122 -1
- package/dist/index.cjs +223 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +35 -4
- package/dist/index.d.ts +35 -4
- package/dist/index.js +219 -9
- package/dist/index.js.map +1 -1
- package/package.json +16 -2
|
@@ -1862,6 +1862,126 @@ declare class NodeAdminApi {
|
|
|
1862
1862
|
private buildLogsPath;
|
|
1863
1863
|
}
|
|
1864
1864
|
|
|
1865
|
+
/**
|
|
1866
|
+
* Notification provider settings types.
|
|
1867
|
+
* Mirrors Aouda server JSON payloads under /admin/notifications.
|
|
1868
|
+
*/
|
|
1869
|
+
/** Where the current provider config comes from. */
|
|
1870
|
+
type NotificationProviderSource = "db" | "env" | "none";
|
|
1871
|
+
/** Information about one configured notification provider (email or SMS). */
|
|
1872
|
+
interface NotificationProviderInfo {
|
|
1873
|
+
/** Provider identifier, e.g. "sendgrid", "gatewayapi", "console", "none". */
|
|
1874
|
+
provider: string;
|
|
1875
|
+
/**
|
|
1876
|
+
* Where the provider config was loaded from.
|
|
1877
|
+
* "db" = persisted in _settings DB; "env" = appsettings/env var; "none" = no provider.
|
|
1878
|
+
*/
|
|
1879
|
+
source: NotificationProviderSource;
|
|
1880
|
+
/** Masked API key: "****" + last 4 chars, or null if not set. */
|
|
1881
|
+
apiKeyMasked: string | null;
|
|
1882
|
+
/** From address (email only). */
|
|
1883
|
+
fromAddress?: string | null;
|
|
1884
|
+
/** From display name (email only). */
|
|
1885
|
+
fromName?: string | null;
|
|
1886
|
+
/** Invite URL template (email only). */
|
|
1887
|
+
inviteUrl?: string | null;
|
|
1888
|
+
/** Password reset URL template (email only). */
|
|
1889
|
+
passwordResetUrl?: string | null;
|
|
1890
|
+
/** Sender name / short-code (SMS only). */
|
|
1891
|
+
sender?: string | null;
|
|
1892
|
+
/** SMS gateway base URL override (SMS only). */
|
|
1893
|
+
baseUrl?: string | null;
|
|
1894
|
+
}
|
|
1895
|
+
/** Response from GET /admin/notifications. */
|
|
1896
|
+
interface NotificationSettingsResponse {
|
|
1897
|
+
email: NotificationProviderInfo;
|
|
1898
|
+
sms: NotificationProviderInfo;
|
|
1899
|
+
availableEmailProviders: string[];
|
|
1900
|
+
availableSmsProviders: string[];
|
|
1901
|
+
}
|
|
1902
|
+
/** Request body for PUT /admin/notifications/email. */
|
|
1903
|
+
interface PutEmailProviderRequest {
|
|
1904
|
+
provider: string;
|
|
1905
|
+
/**
|
|
1906
|
+
* New API key. Omit or set to undefined/null to keep the existing stored key.
|
|
1907
|
+
* Empty string "" is rejected with 400.
|
|
1908
|
+
*/
|
|
1909
|
+
apiKey?: string | null;
|
|
1910
|
+
fromAddress?: string | null;
|
|
1911
|
+
fromName?: string | null;
|
|
1912
|
+
inviteUrl?: string | null;
|
|
1913
|
+
passwordResetUrl?: string | null;
|
|
1914
|
+
}
|
|
1915
|
+
/** Request body for PUT /admin/notifications/sms. */
|
|
1916
|
+
interface PutSmsProviderRequest {
|
|
1917
|
+
provider: string;
|
|
1918
|
+
/** New API key. Omit or null to keep the existing stored key. Empty string "" is rejected. */
|
|
1919
|
+
apiKey?: string | null;
|
|
1920
|
+
sender?: string | null;
|
|
1921
|
+
baseUrl?: string | null;
|
|
1922
|
+
}
|
|
1923
|
+
/** Request body for POST /admin/notifications/email/test. */
|
|
1924
|
+
interface TestEmailRequest {
|
|
1925
|
+
/** Recipient address for the test message. */
|
|
1926
|
+
to: string;
|
|
1927
|
+
}
|
|
1928
|
+
/** Request body for POST /admin/notifications/sms/test. */
|
|
1929
|
+
interface TestSmsRequest {
|
|
1930
|
+
/** Recipient phone number in E.164 format. */
|
|
1931
|
+
to: string;
|
|
1932
|
+
}
|
|
1933
|
+
/** Response from POST /admin/notifications/{email|sms}/test. */
|
|
1934
|
+
interface TestSendResult {
|
|
1935
|
+
success: boolean;
|
|
1936
|
+
/** Error message if success is false. */
|
|
1937
|
+
error?: string | null;
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
/**
|
|
1941
|
+
* Admin notification provider settings API.
|
|
1942
|
+
* Access via client.admin.notifications.
|
|
1943
|
+
*/
|
|
1944
|
+
|
|
1945
|
+
declare class NotificationsAdminApi {
|
|
1946
|
+
private readonly transport;
|
|
1947
|
+
constructor(transport: Transport);
|
|
1948
|
+
/**
|
|
1949
|
+
* Get current notification provider state.
|
|
1950
|
+
* GET /admin/notifications
|
|
1951
|
+
*/
|
|
1952
|
+
get(): Promise<NotificationSettingsResponse>;
|
|
1953
|
+
/**
|
|
1954
|
+
* Set or update the email notification provider.
|
|
1955
|
+
* PUT /admin/notifications/email
|
|
1956
|
+
*/
|
|
1957
|
+
putEmail(request: PutEmailProviderRequest): Promise<NotificationSettingsResponse>;
|
|
1958
|
+
/**
|
|
1959
|
+
* Remove the email notification provider (reverts to env/appsettings).
|
|
1960
|
+
* DELETE /admin/notifications/email
|
|
1961
|
+
*/
|
|
1962
|
+
deleteEmail(): Promise<NotificationSettingsResponse>;
|
|
1963
|
+
/**
|
|
1964
|
+
* Set or update the SMS notification provider.
|
|
1965
|
+
* PUT /admin/notifications/sms
|
|
1966
|
+
*/
|
|
1967
|
+
putSms(request: PutSmsProviderRequest): Promise<NotificationSettingsResponse>;
|
|
1968
|
+
/**
|
|
1969
|
+
* Remove the SMS notification provider (reverts to env/appsettings).
|
|
1970
|
+
* DELETE /admin/notifications/sms
|
|
1971
|
+
*/
|
|
1972
|
+
deleteSms(): Promise<NotificationSettingsResponse>;
|
|
1973
|
+
/**
|
|
1974
|
+
* Send a test email via the currently configured provider.
|
|
1975
|
+
* POST /admin/notifications/email/test
|
|
1976
|
+
*/
|
|
1977
|
+
testEmail(request: TestEmailRequest): Promise<TestSendResult>;
|
|
1978
|
+
/**
|
|
1979
|
+
* Send a test SMS via the currently configured provider.
|
|
1980
|
+
* POST /admin/notifications/sms/test
|
|
1981
|
+
*/
|
|
1982
|
+
testSms(request: TestSmsRequest): Promise<TestSendResult>;
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1865
1985
|
/**
|
|
1866
1986
|
* Admin API: server info, memory, metrics, health, replication.
|
|
1867
1987
|
* Access via client.admin.
|
|
@@ -1877,6 +1997,7 @@ declare class AdminApi {
|
|
|
1877
1997
|
readonly backup: BackupAdminApi;
|
|
1878
1998
|
readonly config: ConfigAdminApi;
|
|
1879
1999
|
readonly node: NodeAdminApi;
|
|
2000
|
+
readonly notifications: NotificationsAdminApi;
|
|
1880
2001
|
constructor(transport: Transport);
|
|
1881
2002
|
}
|
|
1882
2003
|
|
|
@@ -1887,7 +2008,7 @@ declare class AdminApi {
|
|
|
1887
2008
|
* Two-layer auth model: clients connect via API key (Layer 1); user sign-in is performed
|
|
1888
2009
|
* explicitly via AuthClient.signIn() (Layer 2). There is no auto-authentication on first request.
|
|
1889
2010
|
*
|
|
1890
|
-
* All auth endpoint calls use direct
|
|
2011
|
+
* All auth endpoint calls use direct fetch (with LNA hints) to avoid
|
|
1891
2012
|
* circular refresh through the transport pipeline.
|
|
1892
2013
|
*
|
|
1893
2014
|
* @internal
|
|
@@ -1862,6 +1862,126 @@ declare class NodeAdminApi {
|
|
|
1862
1862
|
private buildLogsPath;
|
|
1863
1863
|
}
|
|
1864
1864
|
|
|
1865
|
+
/**
|
|
1866
|
+
* Notification provider settings types.
|
|
1867
|
+
* Mirrors Aouda server JSON payloads under /admin/notifications.
|
|
1868
|
+
*/
|
|
1869
|
+
/** Where the current provider config comes from. */
|
|
1870
|
+
type NotificationProviderSource = "db" | "env" | "none";
|
|
1871
|
+
/** Information about one configured notification provider (email or SMS). */
|
|
1872
|
+
interface NotificationProviderInfo {
|
|
1873
|
+
/** Provider identifier, e.g. "sendgrid", "gatewayapi", "console", "none". */
|
|
1874
|
+
provider: string;
|
|
1875
|
+
/**
|
|
1876
|
+
* Where the provider config was loaded from.
|
|
1877
|
+
* "db" = persisted in _settings DB; "env" = appsettings/env var; "none" = no provider.
|
|
1878
|
+
*/
|
|
1879
|
+
source: NotificationProviderSource;
|
|
1880
|
+
/** Masked API key: "****" + last 4 chars, or null if not set. */
|
|
1881
|
+
apiKeyMasked: string | null;
|
|
1882
|
+
/** From address (email only). */
|
|
1883
|
+
fromAddress?: string | null;
|
|
1884
|
+
/** From display name (email only). */
|
|
1885
|
+
fromName?: string | null;
|
|
1886
|
+
/** Invite URL template (email only). */
|
|
1887
|
+
inviteUrl?: string | null;
|
|
1888
|
+
/** Password reset URL template (email only). */
|
|
1889
|
+
passwordResetUrl?: string | null;
|
|
1890
|
+
/** Sender name / short-code (SMS only). */
|
|
1891
|
+
sender?: string | null;
|
|
1892
|
+
/** SMS gateway base URL override (SMS only). */
|
|
1893
|
+
baseUrl?: string | null;
|
|
1894
|
+
}
|
|
1895
|
+
/** Response from GET /admin/notifications. */
|
|
1896
|
+
interface NotificationSettingsResponse {
|
|
1897
|
+
email: NotificationProviderInfo;
|
|
1898
|
+
sms: NotificationProviderInfo;
|
|
1899
|
+
availableEmailProviders: string[];
|
|
1900
|
+
availableSmsProviders: string[];
|
|
1901
|
+
}
|
|
1902
|
+
/** Request body for PUT /admin/notifications/email. */
|
|
1903
|
+
interface PutEmailProviderRequest {
|
|
1904
|
+
provider: string;
|
|
1905
|
+
/**
|
|
1906
|
+
* New API key. Omit or set to undefined/null to keep the existing stored key.
|
|
1907
|
+
* Empty string "" is rejected with 400.
|
|
1908
|
+
*/
|
|
1909
|
+
apiKey?: string | null;
|
|
1910
|
+
fromAddress?: string | null;
|
|
1911
|
+
fromName?: string | null;
|
|
1912
|
+
inviteUrl?: string | null;
|
|
1913
|
+
passwordResetUrl?: string | null;
|
|
1914
|
+
}
|
|
1915
|
+
/** Request body for PUT /admin/notifications/sms. */
|
|
1916
|
+
interface PutSmsProviderRequest {
|
|
1917
|
+
provider: string;
|
|
1918
|
+
/** New API key. Omit or null to keep the existing stored key. Empty string "" is rejected. */
|
|
1919
|
+
apiKey?: string | null;
|
|
1920
|
+
sender?: string | null;
|
|
1921
|
+
baseUrl?: string | null;
|
|
1922
|
+
}
|
|
1923
|
+
/** Request body for POST /admin/notifications/email/test. */
|
|
1924
|
+
interface TestEmailRequest {
|
|
1925
|
+
/** Recipient address for the test message. */
|
|
1926
|
+
to: string;
|
|
1927
|
+
}
|
|
1928
|
+
/** Request body for POST /admin/notifications/sms/test. */
|
|
1929
|
+
interface TestSmsRequest {
|
|
1930
|
+
/** Recipient phone number in E.164 format. */
|
|
1931
|
+
to: string;
|
|
1932
|
+
}
|
|
1933
|
+
/** Response from POST /admin/notifications/{email|sms}/test. */
|
|
1934
|
+
interface TestSendResult {
|
|
1935
|
+
success: boolean;
|
|
1936
|
+
/** Error message if success is false. */
|
|
1937
|
+
error?: string | null;
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
/**
|
|
1941
|
+
* Admin notification provider settings API.
|
|
1942
|
+
* Access via client.admin.notifications.
|
|
1943
|
+
*/
|
|
1944
|
+
|
|
1945
|
+
declare class NotificationsAdminApi {
|
|
1946
|
+
private readonly transport;
|
|
1947
|
+
constructor(transport: Transport);
|
|
1948
|
+
/**
|
|
1949
|
+
* Get current notification provider state.
|
|
1950
|
+
* GET /admin/notifications
|
|
1951
|
+
*/
|
|
1952
|
+
get(): Promise<NotificationSettingsResponse>;
|
|
1953
|
+
/**
|
|
1954
|
+
* Set or update the email notification provider.
|
|
1955
|
+
* PUT /admin/notifications/email
|
|
1956
|
+
*/
|
|
1957
|
+
putEmail(request: PutEmailProviderRequest): Promise<NotificationSettingsResponse>;
|
|
1958
|
+
/**
|
|
1959
|
+
* Remove the email notification provider (reverts to env/appsettings).
|
|
1960
|
+
* DELETE /admin/notifications/email
|
|
1961
|
+
*/
|
|
1962
|
+
deleteEmail(): Promise<NotificationSettingsResponse>;
|
|
1963
|
+
/**
|
|
1964
|
+
* Set or update the SMS notification provider.
|
|
1965
|
+
* PUT /admin/notifications/sms
|
|
1966
|
+
*/
|
|
1967
|
+
putSms(request: PutSmsProviderRequest): Promise<NotificationSettingsResponse>;
|
|
1968
|
+
/**
|
|
1969
|
+
* Remove the SMS notification provider (reverts to env/appsettings).
|
|
1970
|
+
* DELETE /admin/notifications/sms
|
|
1971
|
+
*/
|
|
1972
|
+
deleteSms(): Promise<NotificationSettingsResponse>;
|
|
1973
|
+
/**
|
|
1974
|
+
* Send a test email via the currently configured provider.
|
|
1975
|
+
* POST /admin/notifications/email/test
|
|
1976
|
+
*/
|
|
1977
|
+
testEmail(request: TestEmailRequest): Promise<TestSendResult>;
|
|
1978
|
+
/**
|
|
1979
|
+
* Send a test SMS via the currently configured provider.
|
|
1980
|
+
* POST /admin/notifications/sms/test
|
|
1981
|
+
*/
|
|
1982
|
+
testSms(request: TestSmsRequest): Promise<TestSendResult>;
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1865
1985
|
/**
|
|
1866
1986
|
* Admin API: server info, memory, metrics, health, replication.
|
|
1867
1987
|
* Access via client.admin.
|
|
@@ -1877,6 +1997,7 @@ declare class AdminApi {
|
|
|
1877
1997
|
readonly backup: BackupAdminApi;
|
|
1878
1998
|
readonly config: ConfigAdminApi;
|
|
1879
1999
|
readonly node: NodeAdminApi;
|
|
2000
|
+
readonly notifications: NotificationsAdminApi;
|
|
1880
2001
|
constructor(transport: Transport);
|
|
1881
2002
|
}
|
|
1882
2003
|
|
|
@@ -1887,7 +2008,7 @@ declare class AdminApi {
|
|
|
1887
2008
|
* Two-layer auth model: clients connect via API key (Layer 1); user sign-in is performed
|
|
1888
2009
|
* explicitly via AuthClient.signIn() (Layer 2). There is no auto-authentication on first request.
|
|
1889
2010
|
*
|
|
1890
|
-
* All auth endpoint calls use direct
|
|
2011
|
+
* All auth endpoint calls use direct fetch (with LNA hints) to avoid
|
|
1891
2012
|
* circular refresh through the transport pipeline.
|
|
1892
2013
|
*
|
|
1893
2014
|
* @internal
|
package/dist/index.cjs
CHANGED
|
@@ -65,13 +65,85 @@ __export(index_exports, {
|
|
|
65
65
|
TableQuery: () => TableQuery,
|
|
66
66
|
TablesApi: () => TablesApi,
|
|
67
67
|
WhereGroupBuilder: () => WhereGroupBuilder,
|
|
68
|
+
applyLocalNetworkAccess: () => applyLocalNetworkAccess,
|
|
68
69
|
coerceColumnarValue: () => coerceColumnarValue,
|
|
69
70
|
createAoudaClient: () => createAoudaClient,
|
|
70
71
|
createAoudaClusterMcpToolSet: () => createAoudaClusterMcpToolSet,
|
|
72
|
+
installLocalNetworkFetch: () => installLocalNetworkFetch,
|
|
73
|
+
localNetworkFetch: () => localNetworkFetch,
|
|
74
|
+
resolveTargetAddressSpace: () => resolveTargetAddressSpace,
|
|
71
75
|
version: () => version
|
|
72
76
|
});
|
|
73
77
|
module.exports = __toCommonJS(index_exports);
|
|
74
78
|
|
|
79
|
+
// package.json
|
|
80
|
+
var package_default = {
|
|
81
|
+
name: "@aouda/client",
|
|
82
|
+
version: "0.0.3",
|
|
83
|
+
description: "Official TypeScript/JavaScript client library for Aouda",
|
|
84
|
+
type: "module",
|
|
85
|
+
main: "./dist/index.cjs",
|
|
86
|
+
module: "./dist/index.js",
|
|
87
|
+
types: "./dist/index.d.ts",
|
|
88
|
+
bin: "./dist/cli/index.js",
|
|
89
|
+
exports: {
|
|
90
|
+
".": {
|
|
91
|
+
types: "./dist/index.d.ts",
|
|
92
|
+
import: "./dist/index.js",
|
|
93
|
+
require: "./dist/index.cjs"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
license: "MIT",
|
|
97
|
+
repository: {
|
|
98
|
+
type: "git",
|
|
99
|
+
url: "https://github.com/aoudadb/aouda-client-ts.git"
|
|
100
|
+
},
|
|
101
|
+
publishConfig: {
|
|
102
|
+
access: "public"
|
|
103
|
+
},
|
|
104
|
+
files: [
|
|
105
|
+
"dist",
|
|
106
|
+
"README.md",
|
|
107
|
+
"LICENSE"
|
|
108
|
+
],
|
|
109
|
+
scripts: {
|
|
110
|
+
changeset: "changeset",
|
|
111
|
+
"version-packages": "changeset version",
|
|
112
|
+
release: "changeset publish",
|
|
113
|
+
prepublishOnly: "npm run build",
|
|
114
|
+
build: "tsup",
|
|
115
|
+
dev: "tsup --watch",
|
|
116
|
+
test: "vitest run",
|
|
117
|
+
"test:watch": "vitest",
|
|
118
|
+
"test:coverage": "vitest run --coverage",
|
|
119
|
+
lint: "eslint src tests",
|
|
120
|
+
"lint:fix": "eslint src tests --fix",
|
|
121
|
+
format: 'prettier --write "src/**/*.ts" "tests/**/*.ts"',
|
|
122
|
+
typecheck: "tsc --noEmit && tsc -p tsconfig.typecheck.json --noEmit",
|
|
123
|
+
"generate-types": "node dist/cli/index.js generate --server http://localhost:5000 --output ./types/schema.ts"
|
|
124
|
+
},
|
|
125
|
+
engines: {
|
|
126
|
+
node: ">=20"
|
|
127
|
+
},
|
|
128
|
+
devDependencies: {
|
|
129
|
+
"@changesets/cli": "^2.29.8",
|
|
130
|
+
"@eslint/js": "^9.15.0",
|
|
131
|
+
"@types/node": "^25.2.1",
|
|
132
|
+
"@types/ws": "^8.18.1",
|
|
133
|
+
eslint: "^9.15.0",
|
|
134
|
+
"eslint-config-prettier": "^9.1.0",
|
|
135
|
+
prettier: "^3.3.3",
|
|
136
|
+
tsup: "^8.3.5",
|
|
137
|
+
typescript: "^5.6.3",
|
|
138
|
+
"typescript-eslint": "^8.15.0",
|
|
139
|
+
vitest: "^2.1.4"
|
|
140
|
+
},
|
|
141
|
+
dependencies: {
|
|
142
|
+
"@msgpack/msgpack": "^3.1.3",
|
|
143
|
+
ws: "^8.20.0"
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
75
147
|
// src/types.ts
|
|
76
148
|
var RetryPolicy;
|
|
77
149
|
((RetryPolicy2) => {
|
|
@@ -188,6 +260,70 @@ var AoudaCircuitBreakerOpenError = class extends AoudaError {
|
|
|
188
260
|
}
|
|
189
261
|
};
|
|
190
262
|
|
|
263
|
+
// src/local-network-fetch.ts
|
|
264
|
+
function resolveTargetAddressSpace(url) {
|
|
265
|
+
let parsed;
|
|
266
|
+
try {
|
|
267
|
+
parsed = new URL(url);
|
|
268
|
+
} catch {
|
|
269
|
+
return void 0;
|
|
270
|
+
}
|
|
271
|
+
const hostname = parsed.hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
272
|
+
if (hostname === "localhost" || hostname === "::1") {
|
|
273
|
+
return "loopback";
|
|
274
|
+
}
|
|
275
|
+
const ipv4 = hostname.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
|
|
276
|
+
if (ipv4) {
|
|
277
|
+
const [first, second] = [Number(ipv4[1]), Number(ipv4[2])];
|
|
278
|
+
if (first === 127) return "loopback";
|
|
279
|
+
if (first === 10) return "local";
|
|
280
|
+
if (first === 172 && second >= 16 && second <= 31) return "local";
|
|
281
|
+
if (first === 192 && second === 168) return "local";
|
|
282
|
+
if (first === 169 && second === 254) return "local";
|
|
283
|
+
}
|
|
284
|
+
if (hostname.endsWith(".local")) {
|
|
285
|
+
return "local";
|
|
286
|
+
}
|
|
287
|
+
return void 0;
|
|
288
|
+
}
|
|
289
|
+
function applyLocalNetworkAccess(url, init) {
|
|
290
|
+
const space = resolveTargetAddressSpace(url);
|
|
291
|
+
if (!space) {
|
|
292
|
+
return init ?? {};
|
|
293
|
+
}
|
|
294
|
+
return { ...init, targetAddressSpace: space };
|
|
295
|
+
}
|
|
296
|
+
function resolveFetchUrl(input) {
|
|
297
|
+
if (typeof input === "string") {
|
|
298
|
+
return input;
|
|
299
|
+
}
|
|
300
|
+
if (input instanceof URL) {
|
|
301
|
+
return input.href;
|
|
302
|
+
}
|
|
303
|
+
return input.url;
|
|
304
|
+
}
|
|
305
|
+
function localNetworkFetch(input, init) {
|
|
306
|
+
const url = resolveFetchUrl(input);
|
|
307
|
+
const merged = applyLocalNetworkAccess(url, init);
|
|
308
|
+
return globalThis.fetch(input, merged);
|
|
309
|
+
}
|
|
310
|
+
var installed = false;
|
|
311
|
+
function installLocalNetworkFetch() {
|
|
312
|
+
if (installed || typeof globalThis.window === "undefined") {
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
installed = true;
|
|
316
|
+
const nativeFetch = globalThis.fetch.bind(globalThis);
|
|
317
|
+
globalThis.fetch = (input, init) => {
|
|
318
|
+
const url = resolveFetchUrl(input);
|
|
319
|
+
const space = resolveTargetAddressSpace(url);
|
|
320
|
+
if (!space) {
|
|
321
|
+
return nativeFetch(input, init);
|
|
322
|
+
}
|
|
323
|
+
return nativeFetch(input, applyLocalNetworkAccess(url, init));
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
191
327
|
// src/auth/auth-handler.ts
|
|
192
328
|
var DEFAULT_REFRESH_THRESHOLD_MS = 12e4;
|
|
193
329
|
var CONTENT_TYPE_JSON = "application/json";
|
|
@@ -378,7 +514,7 @@ var AuthHandler = class {
|
|
|
378
514
|
headers["Authorization"] = `Bearer ${this._accessToken}`;
|
|
379
515
|
}
|
|
380
516
|
try {
|
|
381
|
-
await
|
|
517
|
+
await localNetworkFetch(url, {
|
|
382
518
|
method: "POST",
|
|
383
519
|
headers,
|
|
384
520
|
signal: AbortSignal.timeout(this._timeout)
|
|
@@ -411,7 +547,7 @@ var AuthHandler = class {
|
|
|
411
547
|
if (token) {
|
|
412
548
|
headers["Authorization"] = `Bearer ${token}`;
|
|
413
549
|
}
|
|
414
|
-
const response = await
|
|
550
|
+
const response = await localNetworkFetch(url, {
|
|
415
551
|
method: "GET",
|
|
416
552
|
headers,
|
|
417
553
|
signal: AbortSignal.timeout(this._timeout)
|
|
@@ -438,7 +574,7 @@ var AuthHandler = class {
|
|
|
438
574
|
if (token) {
|
|
439
575
|
headers["Authorization"] = `Bearer ${token}`;
|
|
440
576
|
}
|
|
441
|
-
const response = await
|
|
577
|
+
const response = await localNetworkFetch(url, {
|
|
442
578
|
method: "PUT",
|
|
443
579
|
headers,
|
|
444
580
|
body: JSON.stringify({ currentPassword, newPassword }),
|
|
@@ -478,7 +614,7 @@ var AuthHandler = class {
|
|
|
478
614
|
if (this._accessToken) {
|
|
479
615
|
headers["Authorization"] = `Bearer ${this._accessToken}`;
|
|
480
616
|
}
|
|
481
|
-
return
|
|
617
|
+
return localNetworkFetch(url, {
|
|
482
618
|
method,
|
|
483
619
|
headers,
|
|
484
620
|
body: JSON.stringify(body),
|
|
@@ -831,7 +967,7 @@ var AuthClient = class {
|
|
|
831
967
|
if (token) {
|
|
832
968
|
headers["Authorization"] = `Bearer ${token}`;
|
|
833
969
|
}
|
|
834
|
-
const response = await
|
|
970
|
+
const response = await localNetworkFetch(endpoint, {
|
|
835
971
|
method,
|
|
836
972
|
headers,
|
|
837
973
|
body: body !== void 0 && method !== "GET" && method !== "DELETE" ? JSON.stringify(body) : void 0,
|
|
@@ -1154,7 +1290,7 @@ var HttpTransport = class {
|
|
|
1154
1290
|
init.body = JSON.stringify(config.body);
|
|
1155
1291
|
}
|
|
1156
1292
|
try {
|
|
1157
|
-
const response = await
|
|
1293
|
+
const response = await localNetworkFetch(url, init);
|
|
1158
1294
|
if (!response.ok) {
|
|
1159
1295
|
const text = await response.text();
|
|
1160
1296
|
if (config.allowStatuses?.includes(response.status) && text) {
|
|
@@ -1268,7 +1404,7 @@ var HttpTransport = class {
|
|
|
1268
1404
|
init.body = JSON.stringify(config.body);
|
|
1269
1405
|
}
|
|
1270
1406
|
try {
|
|
1271
|
-
const response = await
|
|
1407
|
+
const response = await localNetworkFetch(url, init);
|
|
1272
1408
|
if (response.ok || config.allowStatuses?.includes(response.status)) {
|
|
1273
1409
|
return response;
|
|
1274
1410
|
}
|
|
@@ -4112,6 +4248,79 @@ function parseSseLogEvent(rawEvent) {
|
|
|
4112
4248
|
return null;
|
|
4113
4249
|
}
|
|
4114
4250
|
|
|
4251
|
+
// src/admin/notifications.ts
|
|
4252
|
+
var BASE_PATH7 = "/admin/notifications";
|
|
4253
|
+
var NotificationsAdminApi = class {
|
|
4254
|
+
constructor(transport) {
|
|
4255
|
+
this.transport = transport;
|
|
4256
|
+
}
|
|
4257
|
+
/**
|
|
4258
|
+
* Get current notification provider state.
|
|
4259
|
+
* GET /admin/notifications
|
|
4260
|
+
*/
|
|
4261
|
+
async get() {
|
|
4262
|
+
return this.transport.get(BASE_PATH7);
|
|
4263
|
+
}
|
|
4264
|
+
/**
|
|
4265
|
+
* Set or update the email notification provider.
|
|
4266
|
+
* PUT /admin/notifications/email
|
|
4267
|
+
*/
|
|
4268
|
+
async putEmail(request) {
|
|
4269
|
+
return this.transport.put(
|
|
4270
|
+
`${BASE_PATH7}/email`,
|
|
4271
|
+
request
|
|
4272
|
+
);
|
|
4273
|
+
}
|
|
4274
|
+
/**
|
|
4275
|
+
* Remove the email notification provider (reverts to env/appsettings).
|
|
4276
|
+
* DELETE /admin/notifications/email
|
|
4277
|
+
*/
|
|
4278
|
+
async deleteEmail() {
|
|
4279
|
+
return this.transport.delete(
|
|
4280
|
+
`${BASE_PATH7}/email`
|
|
4281
|
+
);
|
|
4282
|
+
}
|
|
4283
|
+
/**
|
|
4284
|
+
* Set or update the SMS notification provider.
|
|
4285
|
+
* PUT /admin/notifications/sms
|
|
4286
|
+
*/
|
|
4287
|
+
async putSms(request) {
|
|
4288
|
+
return this.transport.put(
|
|
4289
|
+
`${BASE_PATH7}/sms`,
|
|
4290
|
+
request
|
|
4291
|
+
);
|
|
4292
|
+
}
|
|
4293
|
+
/**
|
|
4294
|
+
* Remove the SMS notification provider (reverts to env/appsettings).
|
|
4295
|
+
* DELETE /admin/notifications/sms
|
|
4296
|
+
*/
|
|
4297
|
+
async deleteSms() {
|
|
4298
|
+
return this.transport.delete(
|
|
4299
|
+
`${BASE_PATH7}/sms`
|
|
4300
|
+
);
|
|
4301
|
+
}
|
|
4302
|
+
/**
|
|
4303
|
+
* Send a test email via the currently configured provider.
|
|
4304
|
+
* POST /admin/notifications/email/test
|
|
4305
|
+
*/
|
|
4306
|
+
async testEmail(request) {
|
|
4307
|
+
return this.transport.post(
|
|
4308
|
+
`${BASE_PATH7}/email/test`,
|
|
4309
|
+
request
|
|
4310
|
+
);
|
|
4311
|
+
}
|
|
4312
|
+
/**
|
|
4313
|
+
* Send a test SMS via the currently configured provider.
|
|
4314
|
+
* POST /admin/notifications/sms/test
|
|
4315
|
+
*/
|
|
4316
|
+
async testSms(request) {
|
|
4317
|
+
return this.transport.post(
|
|
4318
|
+
`${BASE_PATH7}/sms/test`,
|
|
4319
|
+
request
|
|
4320
|
+
);
|
|
4321
|
+
}
|
|
4322
|
+
};
|
|
4323
|
+
|
|
4115
4324
|
// src/admin/index.ts
|
|
4116
4325
|
var AdminApi = class {
|
|
4117
4326
|
constructor(transport) {
|
|
@@ -4123,6 +4332,7 @@ var AdminApi = class {
|
|
|
4123
4332
|
this.backup = new BackupAdminApi(transport);
|
|
4124
4333
|
this.config = new ConfigAdminApi(transport);
|
|
4125
4334
|
this.node = new NodeAdminApi(transport);
|
|
4335
|
+
this.notifications = new NotificationsAdminApi(transport);
|
|
4126
4336
|
}
|
|
4127
4337
|
};
|
|
4128
4338
|
|
|
@@ -4596,7 +4806,7 @@ var LongPollTransport = class {
|
|
|
4596
4806
|
this._authHandler = options.authHandler;
|
|
4597
4807
|
this._onReconnected = options.onReconnected;
|
|
4598
4808
|
this._waitMs = Math.max(1, options.waitMs ?? DEFAULT_WAIT_MS);
|
|
4599
|
-
this._fetch = options.fetchImpl ??
|
|
4809
|
+
this._fetch = options.fetchImpl ?? localNetworkFetch;
|
|
4600
4810
|
}
|
|
4601
4811
|
get lastVersion() {
|
|
4602
4812
|
return this._lastVersion;
|
|
@@ -5489,7 +5699,7 @@ function createAoudaClusterMcpToolSet(client) {
|
|
|
5489
5699
|
}
|
|
5490
5700
|
|
|
5491
5701
|
// src/index.ts
|
|
5492
|
-
var version =
|
|
5702
|
+
var version = package_default.version;
|
|
5493
5703
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5494
5704
|
0 && (module.exports = {
|
|
5495
5705
|
AOUDA_DATA_TYPES,
|
|
@@ -5527,9 +5737,13 @@ var version = "0.0.1";
|
|
|
5527
5737
|
TableQuery,
|
|
5528
5738
|
TablesApi,
|
|
5529
5739
|
WhereGroupBuilder,
|
|
5740
|
+
applyLocalNetworkAccess,
|
|
5530
5741
|
coerceColumnarValue,
|
|
5531
5742
|
createAoudaClient,
|
|
5532
5743
|
createAoudaClusterMcpToolSet,
|
|
5744
|
+
installLocalNetworkFetch,
|
|
5745
|
+
localNetworkFetch,
|
|
5746
|
+
resolveTargetAddressSpace,
|
|
5533
5747
|
version
|
|
5534
5748
|
});
|
|
5535
5749
|
//# sourceMappingURL=index.cjs.map
|