Skip to content

Commit

Permalink
Merge pull request #177 from oliver-oloughlin/patch/update-imports
Browse files Browse the repository at this point in the history
Patch/update imports
  • Loading branch information
oliver-oloughlin authored Feb 14, 2024
2 parents 4291560 + e512dfe commit e6026a6
Show file tree
Hide file tree
Showing 143 changed files with 649 additions and 590 deletions.
11 changes: 11 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
".": "./mod.ts",
"./ext/zod": "./ext/zod.ts"
},
"imports": {
"assert": "jsr:@std/[email protected]/assert",
"assert_equals": "jsr:@std/[email protected]/assert_equals",
"assert_not_equals": "jsr:@std/[email protected]/assert_not_equals",
"assert_throws": "jsr:@std/[email protected]/assert_throws",
"ulid": "jsr:@std/[email protected]",
"concat": "jsr:@std/[email protected]/concat",
"deep_merge": "jsr:@std/[email protected]/deep_merge",
"zlib": "node:zlib",
"zod": "npm:zod@3"
},
"tasks": {
"check": "deno check mod.ts src/*.ts ext/*.ts tests/*.ts tests/**/*.ts benchmarks/**/*ts",
"test": "deno test --allow-write --allow-read --unstable-kv --trace-ops",
Expand Down
110 changes: 82 additions & 28 deletions deno.lock

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

4 changes: 2 additions & 2 deletions ext/zod.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from "npm:zod@3.22.4"
import type { KvArray, KvId, KvObject, KvValue, Model } from "../mod.ts"
import { z } from "zod"
import type { KvArray, KvId, KvObject, KvValue, Model } from "../src/types.ts"

/*******************/
/* */
Expand Down
2 changes: 1 addition & 1 deletion src/atomic_builder.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Collection } from "./collection.ts"
import { ulid } from "./deps.ts"
import { ulid } from "ulid"
import { InvalidCollectionError } from "./errors.ts"
import type {
AtomicCheck,
Expand Down
6 changes: 4 additions & 2 deletions src/collection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type {
AtomicListOptions,
BuilderFn,
CheckKeyOf,
CollectionKeys,
CollectionOptions,
Expand Down Expand Up @@ -78,8 +79,9 @@ import { AtomicWrapper } from "./atomic_wrapper.ts"
import { AtomicPool } from "./atomic_pool.ts"
import { Document } from "./document.ts"
import { model } from "./model.ts"
import { concat, deepMerge, ulid } from "./deps.ts"
import { BuilderFn } from "./types.ts"
import { concat } from "concat"
import { deepMerge } from "deep_merge"
import { ulid } from "ulid"

/**
* Create a new collection within a database context.
Expand Down
7 changes: 0 additions & 7 deletions src/deps.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/kvdex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
EnqueueOptions,
FindOptions,
IntervalMessage,
IntervalSetter,
KvId,
KvKey,
KvValue,
Expand Down Expand Up @@ -36,7 +37,6 @@ import {
} from "./constants.ts"
import { model } from "./model.ts"
import { AtomicWrapper } from "./atomic_wrapper.ts"
import { IntervalSetter } from "./types.ts"

/**
* Create a new database instance.
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Collection } from "./collection.ts"
import type { DeepMergeOptions } from "./deps.ts"
import type { DeepMergeOptions } from "deep_merge"
import type { Document } from "./document.ts"

/*********************/
Expand Down
8 changes: 2 additions & 6 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@ import type {
PreparedEnqueue,
QueueMessage,
} from "./types.ts"
import {
brotliCompressSync,
brotliDecompressSync,
constants,
ulid,
} from "./deps.ts"
import { brotliCompressSync, brotliDecompressSync, constants } from "zlib"
import { ulid } from "ulid"

/*************************/
/* */
Expand Down
3 changes: 2 additions & 1 deletion tests/collection/add.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { mockUser1, mockUserInvalid } from "../mocks.ts"
import { useDb } from "../utils.ts"

Expand All @@ -22,6 +22,7 @@ Deno.test("collection - add", async (t) => {
assert(cr.ok)

const doc = await db.z_users.find(cr.id)

assert(doc !== null)
assert(doc.value.username === mockUser1.username)
})
Expand Down
2 changes: 1 addition & 1 deletion tests/collection/addMany.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { generateInvalidUsers, generateUsers, useDb } from "../utils.ts"

Deno.test("collection - addMany", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/collection/count.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { generateUsers } from "../utils.ts"
import { useDb } from "../utils.ts"

Expand Down
2 changes: 1 addition & 1 deletion tests/collection/delete.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { mockUser1 } from "../mocks.ts"
import { generateUsers, useDb } from "../utils.ts"

Expand Down
2 changes: 1 addition & 1 deletion tests/collection/deleteMany.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { generateUsers, useDb } from "../utils.ts"

Deno.test("collection - deleteMany", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/collection/enqueue.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { collection, kvdex, KvValue, model, QueueMessage } from "../../mod.ts"
import { createHandlerId } from "../../src/utils.ts"
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { createResolver, useDb, useKv } from "../utils.ts"

Deno.test("collection - enqueue", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/collection/find.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { mockUser1 } from "../mocks.ts"
import { useDb } from "../utils.ts"

Expand Down
2 changes: 1 addition & 1 deletion tests/collection/findMany.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { generateUsers, useDb } from "../utils.ts"

Deno.test("collection - findMany", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/collection/forEach.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Document } from "../../mod.ts"
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { User } from "../models.ts"
import { generateUsers } from "../utils.ts"
import { useDb } from "../utils.ts"
Expand Down
2 changes: 1 addition & 1 deletion tests/collection/getMany.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { generateUsers } from "../utils.ts"
import { useDb } from "../utils.ts"

Expand Down
2 changes: 1 addition & 1 deletion tests/collection/getOne.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { sleep, useDb } from "../utils.ts"
import { mockUser1, mockUser2 } from "../mocks.ts"

Expand Down
2 changes: 1 addition & 1 deletion tests/collection/history.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { collection, kvdex, model } from "../../mod.ts"
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { sleep, useKv } from "../utils.ts"
import { mockUser1, mockUser2, mockUser3 } from "../mocks.ts"
import type { User } from "../models.ts"
Expand Down
2 changes: 1 addition & 1 deletion tests/collection/listenQueue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
UNDELIVERED_KEY_PREFIX,
} from "../../src/constants.ts"
import { createHandlerId, extendKey } from "../../src/utils.ts"
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { createResolver, sleep, useKv } from "../utils.ts"

Deno.test("collection - listenQueue", async (t) => {
Expand Down
2 changes: 1 addition & 1 deletion tests/collection/map.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { generateUsers } from "../utils.ts"
import { useDb } from "../utils.ts"

Expand Down
2 changes: 1 addition & 1 deletion tests/collection/properties.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { collection, Document, kvdex, model } from "../../mod.ts"
import { ID_KEY_PREFIX, KVDEX_KEY_PREFIX } from "../../src/constants.ts"
import { extendKey, keyEq } from "../../src/utils.ts"
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { mockUser1 } from "../mocks.ts"
import { User } from "../models.ts"
import { generateUsers, useDb, useKv } from "../utils.ts"
Expand Down
2 changes: 1 addition & 1 deletion tests/collection/set.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { mockUser1, mockUser2, mockUserInvalid } from "../mocks.ts"
import { useDb } from "../utils.ts"

Expand Down
2 changes: 1 addition & 1 deletion tests/collection/types.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { collection, kvdex, model } from "../../mod.ts"
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { useKv } from "../utils.ts"

Deno.test("collection - types", async (t) => {
Expand Down
3 changes: 2 additions & 1 deletion tests/collection/update.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { collection, kvdex, model } from "../../mod.ts"
import { assert, assertEquals } from "../deps.ts"
import { assertEquals } from "assert_equals"
import { assert } from "jsr:@std/[email protected]/assert"
import { mockUser1, mockUser2, mockUserInvalid } from "../mocks.ts"
import { useDb, useKv } from "../utils.ts"

Expand Down
3 changes: 2 additions & 1 deletion tests/collection/updateMany.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { collection, kvdex, model } from "../../mod.ts"
import { assert, assertEquals } from "../deps.ts"
import { assertEquals } from "assert_equals"
import { assert } from "jsr:@std/[email protected]/assert"
import { mockUser1, mockUserInvalid } from "../mocks.ts"
import { generateNumbers, generateUsers, useDb, useKv } from "../utils.ts"

Expand Down
4 changes: 3 additions & 1 deletion tests/collection/updateOne.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { collection, kvdex, model } from "../../mod.ts"
import { assert, assertEquals, assertNotEquals } from "../deps.ts"
import { assertEquals } from "assert_equals"
import { assertNotEquals } from "assert_not_equals"
import { assert } from "jsr:@std/[email protected]/assert"
import { mockUser3 } from "../mocks.ts"
import { mockUser2 } from "../mocks.ts"
import { mockUser1, mockUserInvalid } from "../mocks.ts"
Expand Down
2 changes: 1 addition & 1 deletion tests/collection/upsert.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert } from "../deps.ts"
import { assert } from "jsr:@std/[email protected]/assert"
import { mockUser1, mockUser2, mockUser3 } from "../mocks.ts"
import { User } from "../models.ts"
import { useDb } from "../utils.ts"
Expand Down
Loading

0 comments on commit e6026a6

Please sign in to comment.