Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix internals type #260

Merged
merged 5 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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