Skip to content

Commit

Permalink
Refactor imports and update project structure
Browse files Browse the repository at this point in the history
Refactor import paths across several files to improve project organization. Moved types from `src/types/contractValues.ts` to `src/contracts-api/contractValues.ts` to better align with their usage context. This change streamlines module imports and clarifies file responsibilities.
  • Loading branch information
outerlook committed Oct 23, 2024
1 parent c79be9e commit a0b7121
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 28 deletions.
File renamed without changes.
12 changes: 6 additions & 6 deletions src/contracts-api/deployStream.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { StreamType } from "../types/contractValues.js";
import { TxReceipt } from "@kwilteam/kwil-js/dist/core/tx.js";
import { Kwil } from "@kwilteam/kwil-js/dist/client/kwil.js";
import { CompiledKuneiform } from "@kwilteam/kwil-js/dist/core/payload.js";
import { StreamType } from "./contractValues";
import { TxReceipt } from "@kwilteam/kwil-js/dist/core/tx";
import { Kwil } from "@kwilteam/kwil-js/dist/client/kwil";
import { CompiledKuneiform } from "@kwilteam/kwil-js/dist/core/payload";
import {
composedStreamTemplate,
primitiveStreamTemplate,
} from "../contracts/contractsContent.js";
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq.js";
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq";
import { KwilSigner } from "@kwilteam/kwil-js";
import { StreamId } from "../util/StreamId.js";
import { StreamId } from "../util/StreamId";

export interface DeployStreamInput {
streamId: StreamId;
Expand Down
10 changes: 5 additions & 5 deletions src/contracts-api/destroyStream.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { StreamId } from "../util/StreamId.js";
import { Kwil } from "@kwilteam/kwil-js/dist/client/kwil.js";
import { StreamId } from "../util/StreamId";
import { Kwil } from "@kwilteam/kwil-js/dist/client/kwil";
import { KwilSigner } from "@kwilteam/kwil-js";
import { TxReceipt } from "@kwilteam/kwil-js/dist/core/tx.js";
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq.js";
import { generateDBID } from "@kwilteam/kwil-js/dist/utils/dbid.js";
import { TxReceipt } from "@kwilteam/kwil-js/dist/core/tx";
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq";
import { generateDBID } from "@kwilteam/kwil-js/dist/utils/dbid";

/**
* Input parameters for destroying a stream.
Expand Down
2 changes: 1 addition & 1 deletion src/contracts-api/primitiveStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { KwilSigner, NodeKwil, WebKwil } from "@kwilteam/kwil-js";
import { ActionInput } from "@kwilteam/kwil-js/dist/core/action";
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq";
import { TxReceipt } from "@kwilteam/kwil-js/dist/core/tx";
import { StreamType } from "../types/contractValues";
import { StreamType } from "./contractValues";
import { StreamLocator } from "../types/stream";
import { Stream } from "./stream";

Expand Down
45 changes: 29 additions & 16 deletions src/contracts-api/stream.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,40 @@
import { KwilSigner, NodeKwil, WebKwil } from "@kwilteam/kwil-js";
import { ActionInput } from "@kwilteam/kwil-js/dist/core/action";
import { Database } from "@kwilteam/kwil-js/dist/core/database";
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq";
import { TxReceipt } from "@kwilteam/kwil-js/dist/core/tx";
import {
GetFirstRecordInput,
GetRecordInput,
StreamLocator,
StreamRecord,
} from "../types/stream";
import { generateDBID } from "@kwilteam/kwil-js/dist/utils/dbid";
import { Either } from "monads-io";
import { DateString } from "../types/other";
import { StreamLocator } from "../types/stream";
import { EthereumAddress } from "../util/EthereumAddress";
import { head } from "../util/head";
import { StreamId } from "../util/StreamId";
import { toVisibilityEnum, VisibilityEnum } from "../util/visibility";
import {
MetadataKey,
MetadataKeyValueMap,
MetadataTableKey,
MetadataValueTypeForKey,
StreamType,
} from "../types/contractValues";
import { EthereumAddress } from "../util/EthereumAddress";
import { toVisibilityEnum, VisibilityEnum } from "../util/visibility";
import { KwilSigner, NodeKwil, WebKwil } from "@kwilteam/kwil-js";
import { Database } from "@kwilteam/kwil-js/dist/core/database";
import { generateDBID } from "@kwilteam/kwil-js/dist/utils/dbid";
import { ActionInput } from "@kwilteam/kwil-js/dist/core/action";
import { StreamId } from "../util/StreamId";
import { Either } from "monads-io";
import { head } from "../util/head";
} from "./contractValues";

export interface GetRecordInput {
dateFrom?: DateString;
dateTo?: DateString;
frozenAt?: number;
baseDate?: DateString;
}

export interface GetFirstRecordInput {
afterDate?: DateString;
frozenAt?: DateString;
}

export interface StreamRecord {
dateValue: DateString;
value: string;
}

export class Stream {
protected kwilClient: WebKwil | NodeKwil;
Expand Down

0 comments on commit a0b7121

Please sign in to comment.