-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…#169) fix(obj): changed test references to jsr bundles pointing wrong transport bundle Signed-off-by: Alberto Ricart <[email protected]>
- Loading branch information
Showing
10 changed files
with
51 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,15 +13,13 @@ | |
* limitations under the License. | ||
*/ | ||
|
||
import { connect } from "jsr:@nats-io/[email protected]"; | ||
|
||
import type { QueuedIterator } from "jsr:@nats-io/[email protected]"; | ||
import { connect, type QueuedIterator } from "jsr:@nats-io/transport-deno"; | ||
|
||
import { | ||
ServiceError, | ||
ServiceErrorCodeHeader, | ||
ServiceErrorHeader, | ||
Svc, | ||
Svcm, | ||
} from "../src/mod.ts"; | ||
import type { ServiceMsg, ServiceStats } from "../src/mod.ts"; | ||
import { assertEquals } from "jsr:@std/assert"; | ||
|
@@ -42,7 +40,7 @@ const statsHandler = (): Promise<unknown> => { | |
}; | ||
|
||
// create a service - using the statsHandler | ||
const svc = new Svc(nc); | ||
const svc = new Svcm(nc); | ||
const service = await svc.add({ | ||
name: "max", | ||
version: "0.0.1", | ||
|
@@ -139,13 +137,13 @@ function decoder(r: ServiceMsg): Promise<number[]> { | |
// Now we switch gears and look at a client making a request: | ||
|
||
// we call the service without any payload and expect some errors | ||
await nc.request("max").then((r) => { | ||
await nc.request("max").then((r: ServiceMsg) => { | ||
// errors are really these two headers set on the message | ||
assertEquals(r.headers?.get(ServiceErrorHeader), "Bad JSON"); | ||
assertEquals(r.headers?.get(ServiceErrorCodeHeader), "400"); | ||
}); | ||
// call it with an empty array also expecting an error response | ||
await nc.request("max", JSON.stringify([])).then((r) => { | ||
await nc.request("max", JSON.stringify([])).then((r: ServiceMsg) => { | ||
// Here's an alternative way of checking if the response is an error response | ||
assertEquals(ServiceError.isServiceError(r), true); | ||
const se = ServiceError.toServiceError(r); | ||
|
@@ -154,7 +152,7 @@ await nc.request("max", JSON.stringify([])).then((r) => { | |
}); | ||
|
||
// call it with valid arguments | ||
await nc.request("max", JSON.stringify([1, 10, 100])).then((r) => { | ||
await nc.request("max", JSON.stringify([1, 10, 100])).then((r: ServiceMsg) => { | ||
// no error headers | ||
assertEquals(ServiceError.isServiceError(r), false); | ||
// and the response is on the payload, so we process the JSON we | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,14 +14,14 @@ | |
*/ | ||
|
||
import { connect } from "jsr:@nats-io/[email protected]"; | ||
import { ServiceError, Svc } from "../src/mod.ts"; | ||
import { ServiceError, Svcm } from "../src/mod.ts"; | ||
import type { ServiceMsg } from "../src/mod.ts"; | ||
|
||
// connect to NATS on demo.nats.io | ||
const nc = await connect({ servers: ["demo.nats.io"] }); | ||
|
||
// create a service - using the statsHandler and decoder | ||
const svc = new Svc(nc); | ||
const svc = new Svcm(nc); | ||
const calc = await svc.add({ | ||
name: "calc", | ||
version: "0.0.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,12 +14,12 @@ | |
*/ | ||
|
||
import { connect } from "jsr:@nats-io/[email protected]"; | ||
import { Svc } from "../src/mod.ts"; | ||
import { Svcm } from "../src/mod.ts"; | ||
import { humanizeBytes } from "./03_util.ts"; | ||
import type { DataRequest } from "./03_util.ts"; | ||
|
||
const nc = await connect({ servers: "demo.nats.io" }); | ||
const svc = new Svc(nc); | ||
const svc = new Svcm(nc); | ||
const srv = await svc.add({ | ||
name: "big-data", | ||
version: "0.0.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@nats-io/services", | ||
"version": "3.0.0-21", | ||
"version": "3.0.0-22", | ||
"files": [ | ||
"lib/", | ||
"LICENSE", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,5 +23,5 @@ export { | |
ServiceErrorHeader, | ||
ServiceResponseType, | ||
ServiceVerb, | ||
Svc, | ||
Svcm, | ||
} from "./internal_mod.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,8 @@ | |
* limitations under the License. | ||
*/ | ||
|
||
import { cli } from "https://deno.land/x/[email protected]/mod.ts"; | ||
import { connect } from "jsr:@nats-io/nats-transport-deno@3.0.0-4"; | ||
import { cli } from "jsr:@aricart/cobra"; | ||
import { connect } from "@nats-io/transport-deno"; | ||
import { collect, parseSemVer } from "@nats-io/nats-core/internal"; | ||
|
||
import type { NatsConnection } from "@nats-io/nats-core/internal"; | ||
|
@@ -24,7 +24,7 @@ import { | |
ServiceError, | ||
ServiceResponseType, | ||
ServiceVerb, | ||
Svc, | ||
Svcm, | ||
} from "../src/mod.ts"; | ||
|
||
import type { ServiceClientImpl } from "../src/serviceclient.ts"; | ||
|
@@ -136,7 +136,7 @@ async function checkPing(nc: NatsConnection, name: string) { | |
} | ||
|
||
async function invoke(nc: NatsConnection, name: string): Promise<void> { | ||
const svc = new Svc(nc); | ||
const svc = new Svcm(nc); | ||
const sc = svc.client(); | ||
const infos = await collect(await sc.info(name)); | ||
|
||
|
@@ -199,7 +199,7 @@ async function check<T extends ServiceIdentity>( | |
} | ||
}; | ||
|
||
const svc = new Svc(nc); | ||
const svc = new Svcm(nc); | ||
const sc = svc.client() as ServiceClientImpl; | ||
// all | ||
let responses = filter( | ||
|
Oops, something went wrong.