From d3756273249927139a23a71a4b28a46f0552e415 Mon Sep 17 00:00:00 2001 From: Alberto Ricart Date: Thu, 9 May 2024 16:45:29 -0500 Subject: [PATCH] import nuid from jsr fix import type issues --- nats-base-client/nuid.ts | 2 +- service/mod.ts | 3 +-- service/service.ts | 3 ++- service/serviceclient.ts | 17 ++++++++++------- service/tests/service-check.ts | 18 +++++++----------- service/tests/service_test.ts | 21 +++++++++++++-------- 6 files changed, 34 insertions(+), 30 deletions(-) diff --git a/nats-base-client/nuid.ts b/nats-base-client/nuid.ts index 1030261f..57b91d21 100644 --- a/nats-base-client/nuid.ts +++ b/nats-base-client/nuid.ts @@ -13,4 +13,4 @@ * limitations under the License. */ -export { Nuid, nuid } from "../nuid/src/mod.ts"; +export { Nuid, nuid } from "jsr:@nats-io/nuid@2.0.0-1"; diff --git a/service/mod.ts b/service/mod.ts index fd844740..3b858835 100644 --- a/service/mod.ts +++ b/service/mod.ts @@ -22,6 +22,5 @@ export { ServiceErrorHeader, ServiceResponseType, ServiceVerb, + Svc, } from "./internal_mod.ts"; - -export { Svc } from "./internal_mod.ts"; diff --git a/service/service.ts b/service/service.ts index b7ec10f7..83024635 100644 --- a/service/service.ts +++ b/service/service.ts @@ -12,7 +12,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Deferred, deferred, nanos } from "../nats-base-client/util.ts"; +import { deferred, nanos } from "../nats-base-client/util.ts"; +import type { Deferred } from "../nats-base-client/util.ts"; import { headers } from "../nats-base-client/headers.ts"; import { JSONCodec } from "../nats-base-client/codec.ts"; import { nuid } from "../nats-base-client/nuid.ts"; diff --git a/service/serviceclient.ts b/service/serviceclient.ts index ee5df2bb..ea9df7ed 100644 --- a/service/serviceclient.ts +++ b/service/serviceclient.ts @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 The NATS Authors + * Copyright 2022-2024 The NATS Authors * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,20 +15,23 @@ import { Empty } from "../nats-base-client/encoders.ts"; import { JSONCodec } from "../nats-base-client/codec.ts"; import { QueuedIteratorImpl } from "../nats-base-client/queued_iterator.ts"; -import { +import { RequestStrategy } from "../nats-base-client/core.ts"; + +import type { NatsConnection, + QueuedIterator, RequestManyOptions, - RequestStrategy, -} from "../nats-base-client/core.ts"; +} from "../nats-base-client/mod.ts"; + import { ServiceImpl } from "./service.ts"; -import { QueuedIterator } from "../nats-base-client/core.ts"; -import { +import { ServiceVerb } from "./types.ts"; + +import type { ServiceClient, ServiceIdentity, ServiceInfo, ServiceStats, - ServiceVerb, } from "./types.ts"; export class ServiceClientImpl implements ServiceClient { diff --git a/service/tests/service-check.ts b/service/tests/service-check.ts index 99dc8efb..11b39d21 100644 --- a/service/tests/service-check.ts +++ b/service/tests/service-check.ts @@ -14,21 +14,17 @@ */ import { cli } from "https://deno.land/x/cobra@v0.0.9/mod.ts"; -import { connect, NatsConnection, StringCodec } from "../../src/mod.ts"; +import { connect, StringCodec } from "../../src/mod.ts"; +import type { NatsConnection } from "../../src/mod.ts"; -import { - ServiceError, - ServiceIdentity, - ServiceInfo, - ServiceResponseType, - ServiceStats, - ServiceVerb, - Svc, -} from "../mod.ts"; +import type { ServiceIdentity, ServiceInfo, ServiceStats } from "../mod.ts"; + +import { ServiceError, ServiceResponseType, ServiceVerb, Svc } from "../mod.ts"; import { collect } from "../../nats-base-client/util.ts"; import { ServiceClientImpl } from "../serviceclient.ts"; -import Ajv, { JSONSchemaType, ValidateFunction } from "npm:ajv"; +import Ajv from "npm:ajv"; +import type { JSONSchemaType, ValidateFunction } from "npm:ajv"; import { parseSemVer } from "../../nats-base-client/semver.ts"; diff --git a/service/tests/service_test.ts b/service/tests/service_test.ts index 040a0a4e..2e6c2d0e 100644 --- a/service/tests/service_test.ts +++ b/service/tests/service_test.ts @@ -1,5 +1,5 @@ /* - * Copyright 2022-2023 The NATS Authors + * Copyright 2022-2024 The NATS Authors * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -26,31 +26,36 @@ import { import { collect, delay } from "../../nats-base-client/util.ts"; import { NatsConnectionImpl } from "../../nats-base-client/nats.ts"; -import { +import type { EndpointInfo, Service, ServiceConfig, + ServiceIdentity, + ServiceInfo, + ServiceStats, +} from "../mod.ts"; +import { ServiceError, ServiceErrorCodeHeader, ServiceErrorHeader, - ServiceIdentity, - ServiceInfo, ServiceResponseType, - ServiceStats, ServiceVerb, Svc, -} from "../types.ts"; +} from "../mod.ts"; import { connect, createInbox, ErrorCode, JSONCodec, + nuid, + StringCodec, +} from "../../src/mod.ts"; + +import type { Msg, NatsConnection, NatsError, - nuid, QueuedIterator, - StringCodec, } from "../../src/mod.ts"; import { SubscriptionImpl } from "../../nats-base-client/protocol.ts";