Skip to content

Commit

Permalink
chore: updated copyrights, and optimized imports (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
aricart committed Aug 22, 2024
1 parent b0c929c commit fc82b3b
Show file tree
Hide file tree
Showing 17 changed files with 104 additions and 38 deletions.
4 changes: 2 additions & 2 deletions messagepipeline/deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"cover": "deno coverage ./coverage --lcov > ./coverage/out.lcov && genhtml -o ./coverage/html ./coverage/out.lcov && open ./coverage/html/index.html"
},
"imports": {
"@nats-io/nats-core": "jsr:@nats-io/nats-core@^3.0.0-19",
"@nats-io/services": "jsr:@nats-io/services@^3.0.0-2"
"@nats-io/nats-core": "jsr:@nats-io/nats-core@^3.0.0-25",
"@nats-io/services": "jsr:@nats-io/services@^3.0.0-5"
}
}
23 changes: 16 additions & 7 deletions messagepipeline/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion messagepipeline/examples/example.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright 2024 Synadia Communications, Inc
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { MutableMsg, Pipeline } from "../mod.ts";
import { connect, Empty, headers } from "jsr:@nats-io/[email protected]";
import type { Msg } from "jsr:@nats-io/[email protected]";
Expand Down Expand Up @@ -52,7 +66,7 @@ const nc2 = await connect({ servers: ["demo.nats.io"] });
let i = 0;
setInterval(() => {
nc2.request("hello", `hello ${++i}`)
.then((r) => {
.then((r: Msg) => {
console.log(r.string());
});
}, 1000);
2 changes: 1 addition & 1 deletion messagepipeline/mod.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 The Synadia-IO Authors
* Copyright 2024 Synadia Communications, Inc
* 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
Expand Down
16 changes: 15 additions & 1 deletion messagepipeline/mod_test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright 2024 Synadia Communications, Inc
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { connect } from "jsr:@nats-io/[email protected]";
import { headers } from "@nats-io/nats-core";
import type { Msg } from "./mod.ts";
Expand All @@ -13,7 +27,7 @@ Deno.test("mm - copies values", async () => {
const nc = await connect({ servers: "demo.nats.io" });
const subj = nuid.next();
const reply = subj.split("").reverse().join();
const sub = syncIterator(nc.subscribe(subj));
const sub = syncIterator<Msg>(nc.subscribe(subj));
const h = headers();
h.set("test", "a");
nc.publish(subj, JSON.stringify({ hello: "world" }), { reply, headers: h });
Expand Down
2 changes: 1 addition & 1 deletion nhgc/credentials.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 The Synadia Authors
* Copyright 2024 Synadia Communications, Inc
* 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
Expand Down
14 changes: 14 additions & 0 deletions nhgc/examples/nats.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
/*
* Copyright 2024 Synadia Communications, Inc
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { newNHG } from "../mod.ts";
import { getConnectionDetails } from "../credentials.ts";

Expand Down
9 changes: 5 additions & 4 deletions nhgc/kv.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 The Synadia Authors
* Copyright 2024 Synadia Communications, Inc
* 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
Expand All @@ -13,20 +13,21 @@
* limitations under the License.
*/

import {
import type {
Kv,
KvBucketInfo,
KvEntry,
KvOperation,
KvWatchFn,
KvWatchOpts,
ReviverFn,
toKvChangeEvent,
Value,
Watcher,
} from "./types.ts";
import { toKvChangeEvent } from "./types.ts";
import { HttpImpl } from "./nhgc.ts";
import { addEventSource, Deferred, deferred } from "./util.ts";
import { addEventSource, deferred } from "./util.ts";
import type { Deferred } from "./util.ts";

type KvE = {
bucket: string;
Expand Down
9 changes: 5 additions & 4 deletions nhgc/kv_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 The Synadia Authors
* Copyright 2024 Synadia Communications, Inc
* 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
Expand All @@ -12,18 +12,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import {
assert,
assertArrayIncludes,
assertEquals,
assertExists,
assertRejects,
fail,
} from "https://deno.land/[email protected]/assert/mod.ts";
} from "jsr:@std/assert";
import { newNHG } from "./mod.ts";
import { getConnectionDetails, randomKvName } from "./credentials.ts";
import { deferred } from "https://deno.land/[email protected]/async/deferred.ts";
import { KvChangeEvent } from "./types.ts";
import type { KvChangeEvent } from "./types.ts";
import { deferred } from "./util.ts";

Deno.test("kv - cleanup test buckets", async () => {
const nhg = newNHG(getConnectionDetails());
Expand Down
5 changes: 3 additions & 2 deletions nhgc/kvm.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 The Synadia Authors
* Copyright 2024 Synadia Communications, Inc
* 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
Expand All @@ -12,7 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Kv, KvBucketConfig, KvBucketInfo, Kvm } from "./types.ts";

import type { Kv, KvBucketConfig, KvBucketInfo, Kvm } from "./types.ts";
import { HttpImpl } from "./nhgc.ts";
import { KvImpl } from "./kv.ts";

Expand Down
5 changes: 3 additions & 2 deletions nhgc/kvm_test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 The Synadia Authors
* Copyright 2024 Synadia Communications, Inc
* 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
Expand All @@ -12,12 +12,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { newNHG } from "./mod.ts";
import {
assertArrayIncludes,
assertEquals,
assertRejects,
} from "https://deno.land/[email protected]/assert/mod.ts";
} from "jsr:@std/assert";
import { getConnectionDetails, randomKvName } from "./credentials.ts";

Deno.test("kvm - add", async () => {
Expand Down
5 changes: 3 additions & 2 deletions nhgc/mod.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 The Synadia Authors
* Copyright 2024 Synadia Communications, Inc
* 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
Expand All @@ -12,7 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Kvm, Nats } from "./types.ts";

import type { Kvm, Nats } from "./types.ts";
import { KvmImpl } from "./kvm.ts";
import { NatsImpl } from "./nats.ts";

Expand Down
2 changes: 1 addition & 1 deletion nhgc/nats.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HttpImpl } from "./nhgc.ts";
import {
import type {
Msg,
MsgCallback,
Nats,
Expand Down
24 changes: 17 additions & 7 deletions nhgc/nats_test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
/*
* Copyright 2024 Synadia Communications, Inc
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { newNHG } from "./mod.ts";
import { delay } from "https://deno.land/[email protected]/async/delay.ts";
import { delay } from "jsr:@std/async";
import { getConnectionDetails } from "./credentials.ts";
import {
assert,
assertEquals,
assertExists,
fail,
} from "https://deno.land/[email protected]/assert/mod.ts";
import { assert, assertEquals, assertExists, fail } from "jsr:@std/assert";

Deno.test("nats - pub", async () => {
const nhg = newNHG(getConnectionDetails());
Expand Down
2 changes: 1 addition & 1 deletion nhgc/nhgc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 The Synadia Authors
* Copyright 2024 Synadia Communications, Inc
* 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
Expand Down
2 changes: 1 addition & 1 deletion nhgc/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 The Synadia Authors
* Copyright 2024 Synadia Communications, Inc
* 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
Expand Down
2 changes: 1 addition & 1 deletion nhgc/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 The Synadia Authors
* Copyright 2024 Synadia Communications, Inc
* 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
Expand Down

0 comments on commit fc82b3b

Please sign in to comment.