@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
package/README.md
CHANGED
|
@@ -146,6 +146,8 @@ npm run lint # Lint code
|
|
|
146
146
|
|
|
147
147
|
See [AGENTS.md](./AGENTS.md) for development workflow.
|
|
148
148
|
|
|
149
|
+
Maintainers: see [Release Process](./docs/dev/Release-Process.md) for Changesets and npm publish. After publish, follow **`Cross-Repo-Release-And-Version-Bump.md`** in the shared docs repo (`D:\GitHub\docs\` or `C:\Data\GitHub\docs\`) to bump Studio and update the compatibility matrix.
|
|
150
|
+
|
|
149
151
|
## License
|
|
150
152
|
|
|
151
153
|
MIT
|
package/dist/cli/index.cjs
CHANGED
|
@@ -418,6 +418,74 @@ var fs3 = __toESM(require("fs"), 1);
|
|
|
418
418
|
var path3 = __toESM(require("path"), 1);
|
|
419
419
|
var import_node_url = require("url");
|
|
420
420
|
|
|
421
|
+
// package.json
|
|
422
|
+
var package_default = {
|
|
423
|
+
name: "@aouda/client",
|
|
424
|
+
version: "0.0.3",
|
|
425
|
+
description: "Official TypeScript/JavaScript client library for Aouda",
|
|
426
|
+
type: "module",
|
|
427
|
+
main: "./dist/index.cjs",
|
|
428
|
+
module: "./dist/index.js",
|
|
429
|
+
types: "./dist/index.d.ts",
|
|
430
|
+
bin: "./dist/cli/index.js",
|
|
431
|
+
exports: {
|
|
432
|
+
".": {
|
|
433
|
+
types: "./dist/index.d.ts",
|
|
434
|
+
import: "./dist/index.js",
|
|
435
|
+
require: "./dist/index.cjs"
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
license: "MIT",
|
|
439
|
+
repository: {
|
|
440
|
+
type: "git",
|
|
441
|
+
url: "https://github.com/aoudadb/aouda-client-ts.git"
|
|
442
|
+
},
|
|
443
|
+
publishConfig: {
|
|
444
|
+
access: "public"
|
|
445
|
+
},
|
|
446
|
+
files: [
|
|
447
|
+
"dist",
|
|
448
|
+
"README.md",
|
|
449
|
+
"LICENSE"
|
|
450
|
+
],
|
|
451
|
+
scripts: {
|
|
452
|
+
changeset: "changeset",
|
|
453
|
+
"version-packages": "changeset version",
|
|
454
|
+
release: "changeset publish",
|
|
455
|
+
prepublishOnly: "npm run build",
|
|
456
|
+
build: "tsup",
|
|
457
|
+
dev: "tsup --watch",
|
|
458
|
+
test: "vitest run",
|
|
459
|
+
"test:watch": "vitest",
|
|
460
|
+
"test:coverage": "vitest run --coverage",
|
|
461
|
+
lint: "eslint src tests",
|
|
462
|
+
"lint:fix": "eslint src tests --fix",
|
|
463
|
+
format: 'prettier --write "src/**/*.ts" "tests/**/*.ts"',
|
|
464
|
+
typecheck: "tsc --noEmit && tsc -p tsconfig.typecheck.json --noEmit",
|
|
465
|
+
"generate-types": "node dist/cli/index.js generate --server http://localhost:5000 --output ./types/schema.ts"
|
|
466
|
+
},
|
|
467
|
+
engines: {
|
|
468
|
+
node: ">=20"
|
|
469
|
+
},
|
|
470
|
+
devDependencies: {
|
|
471
|
+
"@changesets/cli": "^2.29.8",
|
|
472
|
+
"@eslint/js": "^9.15.0",
|
|
473
|
+
"@types/node": "^25.2.1",
|
|
474
|
+
"@types/ws": "^8.18.1",
|
|
475
|
+
eslint: "^9.15.0",
|
|
476
|
+
"eslint-config-prettier": "^9.1.0",
|
|
477
|
+
prettier: "^3.3.3",
|
|
478
|
+
tsup: "^8.3.5",
|
|
479
|
+
typescript: "^5.6.3",
|
|
480
|
+
"typescript-eslint": "^8.15.0",
|
|
481
|
+
vitest: "^2.1.4"
|
|
482
|
+
},
|
|
483
|
+
dependencies: {
|
|
484
|
+
"@msgpack/msgpack": "^3.1.3",
|
|
485
|
+
ws: "^8.20.0"
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
|
|
421
489
|
// src/types.ts
|
|
422
490
|
var RetryPolicy;
|
|
423
491
|
((RetryPolicy2) => {
|
|
@@ -517,6 +585,54 @@ var AoudaCircuitBreakerOpenError = class extends AoudaError {
|
|
|
517
585
|
}
|
|
518
586
|
};
|
|
519
587
|
|
|
588
|
+
// src/local-network-fetch.ts
|
|
589
|
+
function resolveTargetAddressSpace(url) {
|
|
590
|
+
let parsed;
|
|
591
|
+
try {
|
|
592
|
+
parsed = new URL(url);
|
|
593
|
+
} catch {
|
|
594
|
+
return void 0;
|
|
595
|
+
}
|
|
596
|
+
const hostname = parsed.hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
597
|
+
if (hostname === "localhost" || hostname === "::1") {
|
|
598
|
+
return "loopback";
|
|
599
|
+
}
|
|
600
|
+
const ipv4 = hostname.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
|
|
601
|
+
if (ipv4) {
|
|
602
|
+
const [first, second] = [Number(ipv4[1]), Number(ipv4[2])];
|
|
603
|
+
if (first === 127) return "loopback";
|
|
604
|
+
if (first === 10) return "local";
|
|
605
|
+
if (first === 172 && second >= 16 && second <= 31) return "local";
|
|
606
|
+
if (first === 192 && second === 168) return "local";
|
|
607
|
+
if (first === 169 && second === 254) return "local";
|
|
608
|
+
}
|
|
609
|
+
if (hostname.endsWith(".local")) {
|
|
610
|
+
return "local";
|
|
611
|
+
}
|
|
612
|
+
return void 0;
|
|
613
|
+
}
|
|
614
|
+
function applyLocalNetworkAccess(url, init) {
|
|
615
|
+
const space = resolveTargetAddressSpace(url);
|
|
616
|
+
if (!space) {
|
|
617
|
+
return init ?? {};
|
|
618
|
+
}
|
|
619
|
+
return { ...init, targetAddressSpace: space };
|
|
620
|
+
}
|
|
621
|
+
function resolveFetchUrl(input) {
|
|
622
|
+
if (typeof input === "string") {
|
|
623
|
+
return input;
|
|
624
|
+
}
|
|
625
|
+
if (input instanceof URL) {
|
|
626
|
+
return input.href;
|
|
627
|
+
}
|
|
628
|
+
return input.url;
|
|
629
|
+
}
|
|
630
|
+
function localNetworkFetch(input, init) {
|
|
631
|
+
const url = resolveFetchUrl(input);
|
|
632
|
+
const merged = applyLocalNetworkAccess(url, init);
|
|
633
|
+
return globalThis.fetch(input, merged);
|
|
634
|
+
}
|
|
635
|
+
|
|
520
636
|
// src/auth/auth-handler.ts
|
|
521
637
|
var DEFAULT_REFRESH_THRESHOLD_MS = 12e4;
|
|
522
638
|
var CONTENT_TYPE_JSON = "application/json";
|
|
@@ -707,7 +823,7 @@ var AuthHandler = class {
|
|
|
707
823
|
headers["Authorization"] = `Bearer ${this._accessToken}`;
|
|
708
824
|
}
|
|
709
825
|
try {
|
|
710
|
-
await
|
|
826
|
+
await localNetworkFetch(url, {
|
|
711
827
|
method: "POST",
|
|
712
828
|
headers,
|
|
713
829
|
signal: AbortSignal.timeout(this._timeout)
|
|
@@ -740,7 +856,7 @@ var AuthHandler = class {
|
|
|
740
856
|
if (token) {
|
|
741
857
|
headers["Authorization"] = `Bearer ${token}`;
|
|
742
858
|
}
|
|
743
|
-
const response = await
|
|
859
|
+
const response = await localNetworkFetch(url, {
|
|
744
860
|
method: "GET",
|
|
745
861
|
headers,
|
|
746
862
|
signal: AbortSignal.timeout(this._timeout)
|
|
@@ -767,7 +883,7 @@ var AuthHandler = class {
|
|
|
767
883
|
if (token) {
|
|
768
884
|
headers["Authorization"] = `Bearer ${token}`;
|
|
769
885
|
}
|
|
770
|
-
const response = await
|
|
886
|
+
const response = await localNetworkFetch(url, {
|
|
771
887
|
method: "PUT",
|
|
772
888
|
headers,
|
|
773
889
|
body: JSON.stringify({ currentPassword, newPassword }),
|
|
@@ -807,7 +923,7 @@ var AuthHandler = class {
|
|
|
807
923
|
if (this._accessToken) {
|
|
808
924
|
headers["Authorization"] = `Bearer ${this._accessToken}`;
|
|
809
925
|
}
|
|
810
|
-
return
|
|
926
|
+
return localNetworkFetch(url, {
|
|
811
927
|
method,
|
|
812
928
|
headers,
|
|
813
929
|
body: JSON.stringify(body),
|
|
@@ -1160,7 +1276,7 @@ var AuthClient = class {
|
|
|
1160
1276
|
if (token) {
|
|
1161
1277
|
headers["Authorization"] = `Bearer ${token}`;
|
|
1162
1278
|
}
|
|
1163
|
-
const response = await
|
|
1279
|
+
const response = await localNetworkFetch(endpoint, {
|
|
1164
1280
|
method,
|
|
1165
1281
|
headers,
|
|
1166
1282
|
body: body !== void 0 && method !== "GET" && method !== "DELETE" ? JSON.stringify(body) : void 0,
|
|
@@ -1483,7 +1599,7 @@ var HttpTransport = class {
|
|
|
1483
1599
|
init.body = JSON.stringify(config.body);
|
|
1484
1600
|
}
|
|
1485
1601
|
try {
|
|
1486
|
-
const response = await
|
|
1602
|
+
const response = await localNetworkFetch(url, init);
|
|
1487
1603
|
if (!response.ok) {
|
|
1488
1604
|
const text = await response.text();
|
|
1489
1605
|
if (config.allowStatuses?.includes(response.status) && text) {
|
|
@@ -1597,7 +1713,7 @@ var HttpTransport = class {
|
|
|
1597
1713
|
init.body = JSON.stringify(config.body);
|
|
1598
1714
|
}
|
|
1599
1715
|
try {
|
|
1600
|
-
const response = await
|
|
1716
|
+
const response = await localNetworkFetch(url, init);
|
|
1601
1717
|
if (response.ok || config.allowStatuses?.includes(response.status)) {
|
|
1602
1718
|
return response;
|
|
1603
1719
|
}
|
|
@@ -4441,6 +4557,79 @@ function parseSseLogEvent(rawEvent) {
|
|
|
4441
4557
|
return null;
|
|
4442
4558
|
}
|
|
4443
4559
|
|
|
4560
|
+
// src/admin/notifications.ts
|
|
4561
|
+
var BASE_PATH7 = "/admin/notifications";
|
|
4562
|
+
var NotificationsAdminApi = class {
|
|
4563
|
+
constructor(transport) {
|
|
4564
|
+
this.transport = transport;
|
|
4565
|
+
}
|
|
4566
|
+
/**
|
|
4567
|
+
* Get current notification provider state.
|
|
4568
|
+
* GET /admin/notifications
|
|
4569
|
+
*/
|
|
4570
|
+
async get() {
|
|
4571
|
+
return this.transport.get(BASE_PATH7);
|
|
4572
|
+
}
|
|
4573
|
+
/**
|
|
4574
|
+
* Set or update the email notification provider.
|
|
4575
|
+
* PUT /admin/notifications/email
|
|
4576
|
+
*/
|
|
4577
|
+
async putEmail(request) {
|
|
4578
|
+
return this.transport.put(
|
|
4579
|
+
`${BASE_PATH7}/email`,
|
|
4580
|
+
request
|
|
4581
|
+
);
|
|
4582
|
+
}
|
|
4583
|
+
/**
|
|
4584
|
+
* Remove the email notification provider (reverts to env/appsettings).
|
|
4585
|
+
* DELETE /admin/notifications/email
|
|
4586
|
+
*/
|
|
4587
|
+
async deleteEmail() {
|
|
4588
|
+
return this.transport.delete(
|
|
4589
|
+
`${BASE_PATH7}/email`
|
|
4590
|
+
);
|
|
4591
|
+
}
|
|
4592
|
+
/**
|
|
4593
|
+
* Set or update the SMS notification provider.
|
|
4594
|
+
* PUT /admin/notifications/sms
|
|
4595
|
+
*/
|
|
4596
|
+
async putSms(request) {
|
|
4597
|
+
return this.transport.put(
|
|
4598
|
+
`${BASE_PATH7}/sms`,
|
|
4599
|
+
request
|
|
4600
|
+
);
|
|
4601
|
+
}
|
|
4602
|
+
/**
|
|
4603
|
+
* Remove the SMS notification provider (reverts to env/appsettings).
|
|
4604
|
+
* DELETE /admin/notifications/sms
|
|
4605
|
+
*/
|
|
4606
|
+
async deleteSms() {
|
|
4607
|
+
return this.transport.delete(
|
|
4608
|
+
`${BASE_PATH7}/sms`
|
|
4609
|
+
);
|
|
4610
|
+
}
|
|
4611
|
+
/**
|
|
4612
|
+
* Send a test email via the currently configured provider.
|
|
4613
|
+
* POST /admin/notifications/email/test
|
|
4614
|
+
*/
|
|
4615
|
+
async testEmail(request) {
|
|
4616
|
+
return this.transport.post(
|
|
4617
|
+
`${BASE_PATH7}/email/test`,
|
|
4618
|
+
request
|
|
4619
|
+
);
|
|
4620
|
+
}
|
|
4621
|
+
/**
|
|
4622
|
+
* Send a test SMS via the currently configured provider.
|
|
4623
|
+
* POST /admin/notifications/sms/test
|
|
4624
|
+
*/
|
|
4625
|
+
async testSms(request) {
|
|
4626
|
+
return this.transport.post(
|
|
4627
|
+
`${BASE_PATH7}/sms/test`,
|
|
4628
|
+
request
|
|
4629
|
+
);
|
|
4630
|
+
}
|
|
4631
|
+
};
|
|
4632
|
+
|
|
4444
4633
|
// src/admin/index.ts
|
|
4445
4634
|
var AdminApi = class {
|
|
4446
4635
|
constructor(transport) {
|
|
@@ -4452,6 +4641,7 @@ var AdminApi = class {
|
|
|
4452
4641
|
this.backup = new BackupAdminApi(transport);
|
|
4453
4642
|
this.config = new ConfigAdminApi(transport);
|
|
4454
4643
|
this.node = new NodeAdminApi(transport);
|
|
4644
|
+
this.notifications = new NotificationsAdminApi(transport);
|
|
4455
4645
|
}
|
|
4456
4646
|
};
|
|
4457
4647
|
|
|
@@ -4912,7 +5102,7 @@ var LongPollTransport = class {
|
|
|
4912
5102
|
this._authHandler = options.authHandler;
|
|
4913
5103
|
this._onReconnected = options.onReconnected;
|
|
4914
5104
|
this._waitMs = Math.max(1, options.waitMs ?? DEFAULT_WAIT_MS);
|
|
4915
|
-
this._fetch = options.fetchImpl ??
|
|
5105
|
+
this._fetch = options.fetchImpl ?? localNetworkFetch;
|
|
4916
5106
|
}
|
|
4917
5107
|
get lastVersion() {
|
|
4918
5108
|
return this._lastVersion;
|
|
@@ -5554,6 +5744,9 @@ function createAoudaClient(options) {
|
|
|
5554
5744
|
return new AoudaClient(options);
|
|
5555
5745
|
}
|
|
5556
5746
|
|
|
5747
|
+
// src/index.ts
|
|
5748
|
+
var version = package_default.version;
|
|
5749
|
+
|
|
5557
5750
|
// src/cli/index.ts
|
|
5558
5751
|
var import_meta = {};
|
|
5559
5752
|
var HELP = `Aouda TypeScript client CLI
|