Skip to content

Commit

Permalink
Fix internals type (#260)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-oloughlin authored Feb 7, 2025
1 parent 48b9972 commit 4466b4a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@olli/kvdex",
"version": "3.1.1",
"version": "3.1.2",
"exports": {
".": "./mod.ts",
"./zod": "./src/ext/zod/mod.ts",
Expand Down
15 changes: 2 additions & 13 deletions src/collection.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {
BuilderFn,
CheckKeyOf,
CollectionKeys,
CollectionInternals,
CollectionOptions,
CommitResult,
DenoKv,
Expand All @@ -10,14 +10,12 @@ import type {
DenoKvEntryMaybe,
DenoKvStrictKey,
EncodedEntry,
Encoder,
EnqueueOptions,
FindManyOptions,
FindOptions,
HandleOneOptions,
HistoryEntry,
IdempotentListener,
IdGenerator,
IdUpsert,
IndexDataEntry,
KvId,
Expand Down Expand Up @@ -155,16 +153,7 @@ export class Collection<
private idempotentListener: IdempotentListener;

/** Used for internal workings, do not manipulate or rely on these properties. */
readonly 一internal: {
readonly model: Model<TInput, TOutput>;
readonly primaryIndexList: string[];
readonly secondaryIndexList: string[];
readonly keys: CollectionKeys;
readonly idGenerator: IdGenerator<TOutput, ParseId<TOptions>>;
readonly encoder?: Encoder;
readonly isIndexable: boolean;
readonly keepsHistory: boolean;
};
readonly 一internal: CollectionInternals<TInput, TOutput, TOptions>;

constructor(
kv: DenoKv,
Expand Down
16 changes: 16 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,22 @@ export type AtomicSetOptions<T extends CollectionOptions<any>> =
/* */
/************************/

/** Used for internal workings, do not manipulate or rely on these properties. */
export type CollectionInternals<
TInput,
TOutput extends KvValue,
TOptions extends CollectionOptions<TOutput>,
> = {
readonly model: Model<TInput, TOutput>;
readonly primaryIndexList: string[];
readonly secondaryIndexList: string[];
readonly keys: CollectionKeys;
readonly idGenerator: IdGenerator<TOutput, ParseId<TOptions>>;
readonly encoder?: Encoder;
readonly isIndexable: boolean;
readonly keepsHistory: boolean;
};

/** Options for creating a new collection */
export type CollectionOptions<T extends KvValue> =
& {
Expand Down

0 comments on commit 4466b4a

Please sign in to comment.