@trufnetwork/sdk-js 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -12
- package/dist/cjs/client/client.cjs +41 -32
- package/dist/cjs/client/client.cjs.map +2 -2
- package/dist/cjs/client/getLastTransactions.cjs +67 -0
- package/dist/cjs/client/getLastTransactions.cjs.map +7 -0
- package/dist/cjs/client/listStreams.cjs +46 -0
- package/dist/cjs/client/listStreams.cjs.map +7 -0
- package/dist/cjs/contracts-api/{stream.cjs → action.cjs} +121 -163
- package/dist/cjs/contracts-api/action.cjs.map +7 -0
- package/dist/cjs/contracts-api/composedAction.cjs +183 -0
- package/dist/cjs/contracts-api/composedAction.cjs.map +7 -0
- package/dist/cjs/contracts-api/{destroyStream.cjs → deleteStream.cjs} +16 -16
- package/dist/cjs/contracts-api/deleteStream.cjs.map +7 -0
- package/dist/cjs/contracts-api/deployStream.cjs +33 -16
- package/dist/cjs/contracts-api/deployStream.cjs.map +3 -3
- package/dist/cjs/contracts-api/primitiveAction.cjs +92 -0
- package/dist/cjs/contracts-api/primitiveAction.cjs.map +7 -0
- package/dist/cjs/index.common.cjs +6 -6
- package/dist/cjs/index.common.cjs.map +1 -1
- package/dist/cjs/types/transaction.cjs +19 -0
- package/dist/cjs/types/transaction.cjs.map +7 -0
- package/dist/cjs/util/EthereumAddress.cjs +0 -1
- package/dist/cjs/util/EthereumAddress.cjs.map +2 -2
- package/dist/cjs/util/StreamId.cjs +7 -2
- package/dist/cjs/util/StreamId.cjs.map +2 -2
- package/dist/esm/client/client.mjs +41 -32
- package/dist/esm/client/client.mjs.map +2 -2
- package/dist/esm/client/getLastTransactions.mjs +46 -0
- package/dist/esm/client/getLastTransactions.mjs.map +7 -0
- package/dist/esm/client/listStreams.mjs +25 -0
- package/dist/esm/client/listStreams.mjs.map +7 -0
- package/dist/esm/contracts-api/{stream.mjs → action.mjs} +118 -160
- package/dist/esm/contracts-api/action.mjs.map +7 -0
- package/dist/esm/contracts-api/composedAction.mjs +156 -0
- package/dist/esm/contracts-api/composedAction.mjs.map +7 -0
- package/dist/esm/contracts-api/deleteStream.mjs +24 -0
- package/dist/esm/contracts-api/deleteStream.mjs.map +7 -0
- package/dist/esm/contracts-api/deployStream.mjs +23 -21
- package/dist/esm/contracts-api/deployStream.mjs.map +2 -2
- package/dist/esm/contracts-api/primitiveAction.mjs +71 -0
- package/dist/esm/contracts-api/primitiveAction.mjs.map +7 -0
- package/dist/esm/index.common.mjs +6 -6
- package/dist/esm/index.common.mjs.map +1 -1
- package/dist/esm/types/transaction.mjs +1 -0
- package/dist/esm/types/transaction.mjs.map +7 -0
- package/dist/esm/util/EthereumAddress.mjs +0 -1
- package/dist/esm/util/EthereumAddress.mjs.map +2 -2
- package/dist/esm/util/StreamId.mjs +7 -2
- package/dist/esm/util/StreamId.mjs.map +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/client/client.d.ts +38 -15
- package/dist/types/client/client.d.ts.map +1 -1
- package/dist/types/client/getLastTransactions.d.ts +5 -0
- package/dist/types/client/getLastTransactions.d.ts.map +1 -0
- package/dist/types/client/listStreams.d.ts +12 -0
- package/dist/types/client/listStreams.d.ts.map +1 -0
- package/dist/types/contracts-api/{stream.d.ts → action.d.ts} +35 -54
- package/dist/types/contracts-api/action.d.ts.map +1 -0
- package/dist/types/contracts-api/{composedStream.d.ts → composedAction.d.ts} +11 -22
- package/dist/types/contracts-api/composedAction.d.ts.map +1 -0
- package/dist/types/contracts-api/{destroyStream.d.ts → deleteStream.d.ts} +7 -7
- package/dist/types/contracts-api/deleteStream.d.ts.map +1 -0
- package/dist/types/contracts-api/deployStream.d.ts +2 -2
- package/dist/types/contracts-api/deployStream.d.ts.map +1 -1
- package/dist/types/contracts-api/primitiveAction.d.ts +33 -0
- package/dist/types/contracts-api/primitiveAction.d.ts.map +1 -0
- package/dist/types/index.common.d.ts +7 -7
- package/dist/types/types/transaction.d.ts +11 -0
- package/dist/types/types/transaction.d.ts.map +1 -0
- package/dist/types/util/EthereumAddress.d.ts.map +1 -1
- package/dist/types/util/StreamId.d.ts +2 -0
- package/dist/types/util/StreamId.d.ts.map +1 -1
- package/package.json +10 -6
- package/dist/cjs/client/listAllStreams.cjs +0 -51
- package/dist/cjs/client/listAllStreams.cjs.map +0 -7
- package/dist/cjs/contracts/composed_stream_template.json +0 -1638
- package/dist/cjs/contracts/composed_stream_template_unix.json +0 -2122
- package/dist/cjs/contracts/contractsContent.cjs +0 -65
- package/dist/cjs/contracts/contractsContent.cjs.map +0 -7
- package/dist/cjs/contracts/primitive_stream_template.json +0 -952
- package/dist/cjs/contracts/primitive_stream_template_unix.json +0 -1173
- package/dist/cjs/contracts-api/composedStream.cjs +0 -137
- package/dist/cjs/contracts-api/composedStream.cjs.map +0 -7
- package/dist/cjs/contracts-api/destroyStream.cjs.map +0 -7
- package/dist/cjs/contracts-api/primitiveStream.cjs +0 -86
- package/dist/cjs/contracts-api/primitiveStream.cjs.map +0 -7
- package/dist/cjs/contracts-api/stream.cjs.map +0 -7
- package/dist/esm/client/listAllStreams.mjs +0 -30
- package/dist/esm/client/listAllStreams.mjs.map +0 -7
- package/dist/esm/contracts/composed_stream_template.json +0 -1638
- package/dist/esm/contracts/composed_stream_template_unix.json +0 -2122
- package/dist/esm/contracts/contractsContent.mjs +0 -33
- package/dist/esm/contracts/contractsContent.mjs.map +0 -7
- package/dist/esm/contracts/primitive_stream_template.json +0 -952
- package/dist/esm/contracts/primitive_stream_template_unix.json +0 -1173
- package/dist/esm/contracts-api/composedStream.mjs +0 -116
- package/dist/esm/contracts-api/composedStream.mjs.map +0 -7
- package/dist/esm/contracts-api/destroyStream.mjs +0 -24
- package/dist/esm/contracts-api/destroyStream.mjs.map +0 -7
- package/dist/esm/contracts-api/primitiveStream.mjs +0 -65
- package/dist/esm/contracts-api/primitiveStream.mjs.map +0 -7
- package/dist/esm/contracts-api/stream.mjs.map +0 -7
- package/dist/types/client/listAllStreams.d.ts +0 -14
- package/dist/types/client/listAllStreams.d.ts.map +0 -1
- package/dist/types/contracts/contractsContent.d.ts +0 -6
- package/dist/types/contracts/contractsContent.d.ts.map +0 -1
- package/dist/types/contracts-api/composedStream.d.ts.map +0 -1
- package/dist/types/contracts-api/destroyStream.d.ts.map +0 -1
- package/dist/types/contracts-api/primitiveStream.d.ts +0 -39
- package/dist/types/contracts-api/primitiveStream.d.ts.map +0 -1
- package/dist/types/contracts-api/stream.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { KwilSigner, NodeKwil, WebKwil } from "@kwilteam/kwil-js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { ActionBody } from '@kwilteam/kwil-js/dist/core/action';
|
|
3
|
+
import { NamedParams } from "@kwilteam/kwil-js/dist/core/action";
|
|
4
4
|
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq";
|
|
5
5
|
import { TxReceipt } from "@kwilteam/kwil-js/dist/core/tx";
|
|
6
6
|
import { Either } from "monads-io";
|
|
@@ -9,61 +9,42 @@ import { StreamLocator } from "../types/stream";
|
|
|
9
9
|
import { EthereumAddress } from "../util/EthereumAddress";
|
|
10
10
|
import { VisibilityEnum } from "../util/visibility";
|
|
11
11
|
import { MetadataKey, MetadataValueTypeForKey, StreamType } from "./contractValues";
|
|
12
|
+
import { ValueType } from "@kwilteam/kwil-js/dist/utils/types";
|
|
12
13
|
export interface GetRecordInput {
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
stream: StreamLocator;
|
|
15
|
+
from?: number;
|
|
16
|
+
to?: number;
|
|
15
17
|
frozenAt?: number;
|
|
16
|
-
|
|
18
|
+
baseTime?: DateString | number;
|
|
17
19
|
}
|
|
18
20
|
export interface GetFirstRecordInput {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
stream: StreamLocator;
|
|
22
|
+
after?: number;
|
|
23
|
+
frozenAt?: number;
|
|
21
24
|
}
|
|
22
25
|
export interface StreamRecord {
|
|
23
|
-
|
|
26
|
+
eventTime: number;
|
|
24
27
|
value: string;
|
|
25
28
|
}
|
|
26
29
|
export interface GetIndexChangeInput extends GetRecordInput {
|
|
27
|
-
|
|
30
|
+
timeInterval: number;
|
|
28
31
|
}
|
|
29
|
-
export declare class
|
|
32
|
+
export declare class Action {
|
|
30
33
|
protected kwilClient: WebKwil | NodeKwil;
|
|
31
34
|
protected kwilSigner: KwilSigner;
|
|
32
|
-
|
|
33
|
-
protected dbid: string;
|
|
34
|
-
protected schema?: Database;
|
|
35
|
-
protected deployed: boolean;
|
|
36
|
-
protected initialized: boolean;
|
|
37
|
-
constructor(kwilClient: WebKwil | NodeKwil, kwilSigner: KwilSigner, locator: StreamLocator);
|
|
38
|
-
/**
|
|
39
|
-
* Loads the schema for this stream from the network.
|
|
40
|
-
* Throws if the stream is not deployed.
|
|
41
|
-
*/
|
|
42
|
-
loadSchema(): Promise<void>;
|
|
35
|
+
constructor(kwilClient: WebKwil | NodeKwil, kwilSigner: KwilSigner);
|
|
43
36
|
/**
|
|
44
37
|
* Executes a method on the stream
|
|
45
38
|
*/
|
|
46
|
-
protected
|
|
39
|
+
protected executeWithNamedParams(method: string, inputs: NamedParams[]): Promise<GenericResponse<TxReceipt>>;
|
|
47
40
|
/**
|
|
48
|
-
* Executes a method on the stream
|
|
41
|
+
* Executes a method on the stream
|
|
49
42
|
*/
|
|
50
|
-
protected
|
|
43
|
+
protected executeWithActionBody(inputs: ActionBody, synchronous?: boolean): Promise<GenericResponse<TxReceipt>>;
|
|
51
44
|
/**
|
|
52
45
|
* Calls a method on the stream
|
|
53
46
|
*/
|
|
54
|
-
protected call<T>(method: string, inputs:
|
|
55
|
-
/**
|
|
56
|
-
* Checks if the stream is initialized
|
|
57
|
-
*/
|
|
58
|
-
protected checkInitialized(expectedType?: StreamType): Promise<void>;
|
|
59
|
-
/**
|
|
60
|
-
* Checks if the stream is deployed
|
|
61
|
-
*/
|
|
62
|
-
protected checkDeployed(): Promise<void>;
|
|
63
|
-
/**
|
|
64
|
-
* Initializes the stream
|
|
65
|
-
*/
|
|
66
|
-
initializeStream(): Promise<GenericResponse<TxReceipt>>;
|
|
47
|
+
protected call<T>(method: string, inputs: NamedParams): Promise<Either<number, T>>;
|
|
67
48
|
/**
|
|
68
49
|
* Returns the records of the stream within the given date range
|
|
69
50
|
*/
|
|
@@ -75,13 +56,13 @@ export declare class Stream {
|
|
|
75
56
|
/**
|
|
76
57
|
* Returns the type of the stream
|
|
77
58
|
*/
|
|
78
|
-
getType(): Promise<StreamType>;
|
|
59
|
+
getType(stream: StreamLocator): Promise<StreamType>;
|
|
79
60
|
/**
|
|
80
61
|
* Returns the first record of the stream
|
|
81
62
|
*/
|
|
82
63
|
getFirstRecord(input: GetFirstRecordInput): Promise<StreamRecord | null>;
|
|
83
|
-
protected setMetadata<K extends MetadataKey>(key: K, value: MetadataValueTypeForKey<K>): Promise<GenericResponse<TxReceipt>>;
|
|
84
|
-
protected getMetadata<K extends MetadataKey>(key: K,
|
|
64
|
+
protected setMetadata<K extends MetadataKey>(stream: StreamLocator, key: K, value: MetadataValueTypeForKey<K>): Promise<GenericResponse<TxReceipt>>;
|
|
65
|
+
protected getMetadata<K extends MetadataKey>(stream: StreamLocator, key: K, filteredRef?: string, limit?: number, offset?: number, orderBy?: string): Promise<{
|
|
85
66
|
rowId: string;
|
|
86
67
|
value: MetadataValueTypeForKey<K>;
|
|
87
68
|
createdAt: number;
|
|
@@ -89,44 +70,44 @@ export declare class Stream {
|
|
|
89
70
|
/**
|
|
90
71
|
* Sets the read visibility of the stream
|
|
91
72
|
*/
|
|
92
|
-
setReadVisibility(visibility: VisibilityEnum): Promise<GenericResponse<TxReceipt>>;
|
|
73
|
+
setReadVisibility(stream: StreamLocator, visibility: VisibilityEnum): Promise<GenericResponse<TxReceipt>>;
|
|
93
74
|
/**
|
|
94
75
|
* Returns the read visibility of the stream
|
|
95
76
|
*/
|
|
96
|
-
getReadVisibility(): Promise<VisibilityEnum | null>;
|
|
77
|
+
getReadVisibility(stream: StreamLocator): Promise<VisibilityEnum | null>;
|
|
97
78
|
/**
|
|
98
79
|
* Sets the compose visibility of the stream
|
|
99
80
|
*/
|
|
100
|
-
setComposeVisibility(visibility: VisibilityEnum): Promise<GenericResponse<TxReceipt>>;
|
|
81
|
+
setComposeVisibility(stream: StreamLocator, visibility: VisibilityEnum): Promise<GenericResponse<TxReceipt>>;
|
|
101
82
|
/**
|
|
102
83
|
* Returns the compose visibility of the stream
|
|
103
84
|
*/
|
|
104
|
-
getComposeVisibility(): Promise<VisibilityEnum | null>;
|
|
85
|
+
getComposeVisibility(stream: StreamLocator): Promise<VisibilityEnum | null>;
|
|
105
86
|
/**
|
|
106
87
|
* Allows a wallet to read the stream
|
|
107
88
|
*/
|
|
108
|
-
allowReadWallet(wallet: EthereumAddress): Promise<GenericResponse<TxReceipt>>;
|
|
89
|
+
allowReadWallet(stream: StreamLocator, wallet: EthereumAddress): Promise<GenericResponse<TxReceipt>>;
|
|
109
90
|
/**
|
|
110
91
|
* Disables a wallet from reading the stream
|
|
111
92
|
*/
|
|
112
|
-
disableReadWallet(wallet: EthereumAddress): Promise<GenericResponse<TxReceipt>>;
|
|
93
|
+
disableReadWallet(stream: StreamLocator, wallet: EthereumAddress): Promise<GenericResponse<TxReceipt>>;
|
|
113
94
|
/**
|
|
114
95
|
* Allows a stream to use this stream as child
|
|
115
96
|
*/
|
|
116
|
-
allowComposeStream(
|
|
97
|
+
allowComposeStream(stream: StreamLocator, wallet: StreamLocator): Promise<GenericResponse<TxReceipt>>;
|
|
117
98
|
/**
|
|
118
99
|
* Disables a stream from using this stream as child
|
|
119
100
|
*/
|
|
120
|
-
disableComposeStream(
|
|
121
|
-
protected disableMetadata(rowId: string): Promise<GenericResponse<TxReceipt>>;
|
|
101
|
+
disableComposeStream(stream: StreamLocator, wallet: StreamLocator): Promise<GenericResponse<TxReceipt>>;
|
|
102
|
+
protected disableMetadata(stream: StreamLocator, rowId: string): Promise<GenericResponse<TxReceipt>>;
|
|
122
103
|
/**
|
|
123
104
|
* Returns the wallets allowed to read the stream
|
|
124
105
|
*/
|
|
125
|
-
getAllowedReadWallets(): Promise<EthereumAddress[]>;
|
|
106
|
+
getAllowedReadWallets(stream: StreamLocator): Promise<EthereumAddress[]>;
|
|
126
107
|
/**
|
|
127
108
|
* Returns the streams allowed to compose the stream
|
|
128
109
|
*/
|
|
129
|
-
getAllowedComposeStreams(): Promise<StreamLocator[]>;
|
|
110
|
+
getAllowedComposeStreams(stream: StreamLocator): Promise<StreamLocator[]>;
|
|
130
111
|
/**
|
|
131
112
|
* Returns the index change of the stream within the given date range
|
|
132
113
|
*/
|
|
@@ -147,9 +128,9 @@ export declare class Stream {
|
|
|
147
128
|
* @param procedure
|
|
148
129
|
* @param args
|
|
149
130
|
*/
|
|
150
|
-
customProcedureWithArgs(procedure: string, args: Record<string,
|
|
151
|
-
|
|
131
|
+
customProcedureWithArgs(procedure: string, args: Record<string, ValueType | ValueType[]>): Promise<{
|
|
132
|
+
eventTime: number;
|
|
152
133
|
value: string;
|
|
153
134
|
}[]>;
|
|
154
135
|
}
|
|
155
|
-
//# sourceMappingURL=
|
|
136
|
+
//# sourceMappingURL=action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAC,WAAW,EAAC,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,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IAsB1B;;;;;;;;OAQG;IACU,uBAAuB,CAClC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;;;;CAehD"}
|
|
@@ -1,40 +1,28 @@
|
|
|
1
1
|
import { KwilSigner, NodeKwil, WebKwil } from "@kwilteam/kwil-js";
|
|
2
2
|
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq";
|
|
3
3
|
import { TxReceipt } from "@kwilteam/kwil-js/dist/core/tx";
|
|
4
|
-
import { DateString } from "../types/other";
|
|
5
4
|
import { StreamLocator } from "../types/stream";
|
|
6
|
-
import {
|
|
5
|
+
import { Action } from "./action";
|
|
7
6
|
export declare const ErrorStreamNotComposed = "stream is not a composed stream";
|
|
8
7
|
export interface TaxonomySet {
|
|
8
|
+
stream: StreamLocator;
|
|
9
9
|
taxonomyItems: TaxonomyItem[];
|
|
10
|
-
startDate:
|
|
10
|
+
startDate: number;
|
|
11
11
|
}
|
|
12
12
|
export interface TaxonomyItem {
|
|
13
13
|
childStream: StreamLocator;
|
|
14
14
|
weight: string;
|
|
15
15
|
}
|
|
16
16
|
export interface DescribeTaxonomiesParams {
|
|
17
|
+
stream: StreamLocator;
|
|
17
18
|
/**
|
|
18
19
|
* if true, will return the latest version of the taxonomy only
|
|
19
20
|
*/
|
|
20
|
-
|
|
21
|
+
latestGroupSequence: boolean;
|
|
21
22
|
}
|
|
22
|
-
export declare class
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* Checks if the stream is a valid composed stream.
|
|
26
|
-
* A valid composed stream must be:
|
|
27
|
-
* - initialized
|
|
28
|
-
* - of type composed
|
|
29
|
-
*/
|
|
30
|
-
private checkValidComposedStream;
|
|
31
|
-
/**
|
|
32
|
-
* Executes a method after checking if the stream is a valid composed stream
|
|
33
|
-
* @param method The method name to execute
|
|
34
|
-
* @param inputs The inputs for the action
|
|
35
|
-
* @returns A generic response containing the transaction receipt
|
|
36
|
-
*/
|
|
37
|
-
private checkedComposedExecute;
|
|
23
|
+
export declare class ComposedAction extends Action {
|
|
24
|
+
protected neonConnectionString: string | undefined;
|
|
25
|
+
constructor(kwilClient: WebKwil | NodeKwil, kwilSigner: KwilSigner, neonConnectionString?: string);
|
|
38
26
|
/**
|
|
39
27
|
* Returns the taxonomy of the stream
|
|
40
28
|
* @param params Parameters for describing taxonomies
|
|
@@ -50,8 +38,9 @@ export declare class ComposedStream extends Stream {
|
|
|
50
38
|
/**
|
|
51
39
|
* Creates a ComposedStream from a base Stream
|
|
52
40
|
* @param stream The base stream to convert
|
|
41
|
+
* @param neonConnectionString The Neon connection string
|
|
53
42
|
* @returns A ComposedStream instance
|
|
54
43
|
*/
|
|
55
|
-
static fromStream(stream:
|
|
44
|
+
static fromStream(stream: Action, neonConnectionString?: string): ComposedAction;
|
|
56
45
|
}
|
|
57
|
-
//# sourceMappingURL=
|
|
46
|
+
//# sourceMappingURL=composedAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composedAction.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/composedAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAS,OAAO,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAKlC,eAAO,MAAM,sBAAsB,oCAAoC,CAAC;AAExE,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,aAAa,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,aAAa,CAAC;IACtB;;OAEG;IACH,mBAAmB,EAAE,OAAO,CAAC;CAC9B;AAED,qBAAa,cAAe,SAAQ,MAAM;IACxC,SAAS,CAAC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;gBAGjD,UAAU,EAAE,OAAO,GAAG,QAAQ,EAC9B,UAAU,EAAE,UAAU,EACtB,oBAAoB,CAAC,EAAE,MAAM;IAM/B;;;;OAIG;IACU,kBAAkB,CAC7B,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,WAAW,EAAE,CAAC;IA2DzB;;;;OAIG;IACU,WAAW,CACtB,QAAQ,EAAE,WAAW,GACpB,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IA+EtC;;;;;OAKG;WACW,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,oBAAoB,CAAC,EAAE,MAAM,GAAG,cAAc;CAOxF"}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { StreamId } from "../util/StreamId";
|
|
2
1
|
import { Kwil } from "@kwilteam/kwil-js/dist/client/kwil";
|
|
3
2
|
import { KwilSigner } from "@kwilteam/kwil-js";
|
|
4
3
|
import { TxReceipt } from "@kwilteam/kwil-js/dist/core/tx";
|
|
5
4
|
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq";
|
|
5
|
+
import { StreamLocator } from "../types/stream";
|
|
6
6
|
/**
|
|
7
7
|
* Input parameters for destroying a stream.
|
|
8
8
|
*/
|
|
9
9
|
export interface DestroyStreamInput {
|
|
10
|
-
|
|
10
|
+
stream: StreamLocator;
|
|
11
11
|
kwilClient: Kwil<any>;
|
|
12
12
|
kwilSigner: KwilSigner;
|
|
13
13
|
synchronous?: boolean;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Output after
|
|
16
|
+
* Output after deleting a stream.
|
|
17
17
|
*/
|
|
18
|
-
export interface
|
|
18
|
+
export interface DeleteStreamOutput {
|
|
19
19
|
receipt: TxReceipt;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* Delete a stream from TN.
|
|
23
23
|
* @param input - The input parameters for destroying the stream.
|
|
24
24
|
* @returns The transaction receipt of the destruction.
|
|
25
25
|
*/
|
|
26
|
-
export declare function
|
|
27
|
-
//# sourceMappingURL=
|
|
26
|
+
export declare function deleteStream(input: DestroyStreamInput): Promise<GenericResponse<TxReceipt>>;
|
|
27
|
+
//# sourceMappingURL=deleteStream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteStream.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/deleteStream.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,oCAAoC,CAAC;AACxD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAC,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAC,eAAe,EAAC,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,SAAS,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAgBrC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { StreamType } from "./contractValues";
|
|
2
2
|
import { TxReceipt } from "@kwilteam/kwil-js/dist/core/tx";
|
|
3
3
|
import { Kwil } from "@kwilteam/kwil-js/dist/client/kwil";
|
|
4
|
-
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq";
|
|
5
4
|
import { KwilSigner } from "@kwilteam/kwil-js";
|
|
5
|
+
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq";
|
|
6
6
|
import { StreamId } from "../util/StreamId";
|
|
7
7
|
export interface DeployStreamInput {
|
|
8
8
|
streamId: StreamId;
|
|
@@ -10,7 +10,7 @@ export interface DeployStreamInput {
|
|
|
10
10
|
kwilClient: Kwil<any>;
|
|
11
11
|
kwilSigner: KwilSigner;
|
|
12
12
|
synchronous?: boolean;
|
|
13
|
-
|
|
13
|
+
neonConnectionString?: string;
|
|
14
14
|
}
|
|
15
15
|
export interface DeployStreamOutput {
|
|
16
16
|
receipt: TxReceipt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployStream.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/deployStream.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"deployStream.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/deployStream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,SAAS,EAAC,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAC,IAAI,EAAC,MAAM,oCAAoC,CAAC;AACxD,OAAO,EAAC,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAC,eAAe,EAAC,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAI1C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,SAAS,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAChC,KAAK,EAAE,iBAAiB,GACvB,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAuCrC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { KwilSigner, NodeKwil, WebKwil } from "@kwilteam/kwil-js";
|
|
2
|
+
import { GenericResponse } from "@kwilteam/kwil-js/dist/core/resreq";
|
|
3
|
+
import { TxReceipt } from "@kwilteam/kwil-js/dist/core/tx";
|
|
4
|
+
import { Action } from "./action";
|
|
5
|
+
import { StreamLocator } from "../types/stream";
|
|
6
|
+
export declare class PrimitiveAction extends Action {
|
|
7
|
+
constructor(kwilClient: WebKwil | NodeKwil, kwilSigner: KwilSigner);
|
|
8
|
+
/**
|
|
9
|
+
* Insert a record into the stream
|
|
10
|
+
* @param input of a single record to insert
|
|
11
|
+
* @returns Transaction receipt
|
|
12
|
+
*/
|
|
13
|
+
insertRecord(input: InsertRecordInput): Promise<GenericResponse<TxReceipt>>;
|
|
14
|
+
/**
|
|
15
|
+
* Inserts records into the stream
|
|
16
|
+
* @param inputs Array of records to insert
|
|
17
|
+
* @param synchronous If true, the transaction will be executed synchronously
|
|
18
|
+
* @returns Transaction receipt
|
|
19
|
+
*/
|
|
20
|
+
insertRecords(inputs: InsertRecordInput[], synchronous?: boolean): Promise<GenericResponse<TxReceipt>>;
|
|
21
|
+
/**
|
|
22
|
+
* Creates a PrimitiveStream from a base Stream
|
|
23
|
+
* @param stream The base stream to convert
|
|
24
|
+
* @returns A Promise that resolves to a PrimitiveStream instance
|
|
25
|
+
*/
|
|
26
|
+
static fromStream(stream: Action): PrimitiveAction;
|
|
27
|
+
}
|
|
28
|
+
export interface InsertRecordInput {
|
|
29
|
+
stream: StreamLocator;
|
|
30
|
+
eventTime: number;
|
|
31
|
+
value: string;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=primitiveAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitiveAction.d.ts","sourceRoot":"","sources":["../../../src/contracts-api/primitiveAction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAS,OAAO,EAAC,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAC,eAAe,EAAC,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAC,SAAS,EAAC,MAAM,gCAAgC,CAAC;AAEzD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAK9C,qBAAa,eAAgB,SAAQ,MAAM;gBAEvC,UAAU,EAAE,OAAO,GAAG,QAAQ,EAC9B,UAAU,EAAE,UAAU;IAKxB;;;;OAIG;IACU,YAAY,CACrB,KAAK,EAAE,iBAAiB,GACzB,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAmBpC;;;;;OAKG;IACU,aAAa,CACtB,MAAM,EAAE,iBAAiB,EAAE,EAC3B,WAAW,CAAC,EAAE,OAAO,GACtB,OAAO,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAmBxC;;;;OAIG;WACW,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe;CAM1D;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAElB,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export type { TNClientOptions } from "./client/client";
|
|
2
2
|
export type { SignerInfo as EthProvider } from "./client/client";
|
|
3
3
|
export type { StreamLocator } from "./types/stream";
|
|
4
|
-
export type { StreamRecord } from "./contracts-api/
|
|
5
|
-
export type { GetRecordInput, GetFirstRecordInput } from "./contracts-api/
|
|
6
|
-
export type { InsertRecordInput } from "./contracts-api/
|
|
7
|
-
export type { TaxonomySet, TaxonomyItem } from "./contracts-api/
|
|
4
|
+
export type { StreamRecord } from "./contracts-api/action";
|
|
5
|
+
export type { GetRecordInput, GetFirstRecordInput } from "./contracts-api/action";
|
|
6
|
+
export type { InsertRecordInput } from "./contracts-api/primitiveAction";
|
|
7
|
+
export type { TaxonomySet, TaxonomyItem } from "./contracts-api/composedAction";
|
|
8
8
|
export { StreamId } from "./util/StreamId";
|
|
9
9
|
export { EthereumAddress } from "./util/EthereumAddress";
|
|
10
10
|
export { visibility } from "./util/visibility";
|
|
11
11
|
export type { VisibilityEnum } from "./util/visibility";
|
|
12
12
|
export { StreamType } from "./contracts-api/contractValues";
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
13
|
+
export { Action } from "./contracts-api/action";
|
|
14
|
+
export { PrimitiveAction } from "./contracts-api/primitiveAction";
|
|
15
|
+
export { ComposedAction } from "./contracts-api/composedAction";
|
|
16
16
|
//# sourceMappingURL=index.common.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface LastTransaction {
|
|
2
|
+
/** Block height */
|
|
3
|
+
blockHeight: number;
|
|
4
|
+
/** Which action was taken */
|
|
5
|
+
method: string;
|
|
6
|
+
/** Address that sent the on‐chain tx */
|
|
7
|
+
sender: string;
|
|
8
|
+
/** Hash of the on‐chain transaction */
|
|
9
|
+
transactionHash: string;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/types/transaction.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC5B,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,eAAe,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumAddress.d.ts","sourceRoot":"","sources":["../../../src/util/EthereumAddress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAe,MAAM,kBAAkB,CAAC;AAEvD,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAkB;gBAEvC,OAAO,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"EthereumAddress.d.ts","sourceRoot":"","sources":["../../../src/util/EthereumAddress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAe,MAAM,kBAAkB,CAAC;AAEvD,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAkB;gBAEvC,OAAO,EAAE,MAAM;IAa3B,OAAO,CAAC,uBAAuB;IAIxB,UAAU,IAAI,MAAM;IAQpB,QAAQ,IAAI,UAAU;IAItB,MAAM,IAAI,MAAM;WAIT,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe;WAIvC,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC,KAAK,EAAE,eAAe,CAAC;WAQ5D,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,eAAe,CAAC;CAOtE"}
|
|
@@ -2,8 +2,10 @@ import { Either } from "monads-io";
|
|
|
2
2
|
export declare class StreamId {
|
|
3
3
|
private readonly id;
|
|
4
4
|
private readonly correctlyCreated;
|
|
5
|
+
private readonly name?;
|
|
5
6
|
private constructor();
|
|
6
7
|
getId(): string;
|
|
8
|
+
getName(): string | undefined;
|
|
7
9
|
validate(): boolean;
|
|
8
10
|
toJSON(): string;
|
|
9
11
|
static fromJSON(json: string): StreamId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StreamId.d.ts","sourceRoot":"","sources":["../../../src/util/StreamId.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAkB;
|
|
1
|
+
{"version":3,"file":"StreamId.d.ts","sourceRoot":"","sources":["../../../src/util/StreamId.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAkB;IACnD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAS;IAE/B,OAAO;IAMA,KAAK,IAAI,MAAM;IAQf,OAAO,IAAI,MAAM,GAAG,SAAS;IAI7B,QAAQ,IAAI,OAAO;IAInB,MAAM,IAAI,MAAM;WAIT,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ;WAI1B,QAAQ,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;WAe5C,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC;CAO7D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trufnetwork/sdk-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Truf Network SDK for JavaScript",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -45,22 +45,28 @@
|
|
|
45
45
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
46
46
|
"prepublishOnly": "npm run build",
|
|
47
47
|
"tag:dev": "pnpm version 0.0.0-dev-$(date +%Y%m%d%H%M%S) --no-git-tag-version",
|
|
48
|
-
"publish:dev": "pnpm publish --tag dev --no-git-checks"
|
|
48
|
+
"publish:dev": "pnpm publish --tag dev --no-git-checks",
|
|
49
|
+
"test": "vitest"
|
|
49
50
|
},
|
|
50
51
|
"dependencies": {
|
|
51
|
-
"@kwilteam/kwil-js": "^0.
|
|
52
|
+
"@kwilteam/kwil-js": "^0.9.4",
|
|
52
53
|
"crypto-hash": "^3.1.0",
|
|
54
|
+
"ethers": "^6.13.5",
|
|
53
55
|
"lodash": "^4.17.21",
|
|
54
56
|
"monads-io": "^4.0.2",
|
|
55
|
-
"
|
|
57
|
+
"uuid": "^11.1.0",
|
|
58
|
+
"pg": "^8.14.1"
|
|
56
59
|
},
|
|
57
60
|
"devDependencies": {
|
|
58
61
|
"@types/lodash": "4.17.12",
|
|
59
62
|
"@types/node": "18.18.1",
|
|
63
|
+
"@types/pg": "^8.11.13",
|
|
60
64
|
"@typescript-eslint/eslint-plugin": "8.11.0",
|
|
61
65
|
"@typescript-eslint/parser": "8.11.0",
|
|
62
66
|
"disposablestack": "1.1.6",
|
|
63
67
|
"esbuild": "0.24.0",
|
|
68
|
+
"esbuild-plugin-file-path-extensions": "^2.1.3",
|
|
69
|
+
"esbuild-plugin-import-assertions": "1.0.1",
|
|
64
70
|
"eslint": "9.13.0",
|
|
65
71
|
"eslint-config-prettier": "9.1.0",
|
|
66
72
|
"eslint-import-resolver-alias": "1.1.2",
|
|
@@ -70,8 +76,6 @@
|
|
|
70
76
|
"eslint-plugin-prettier": "5.2.1",
|
|
71
77
|
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
72
78
|
"eslint-plugin-unused-imports": "4.1.4",
|
|
73
|
-
"esbuild-plugin-file-path-extensions": "^2.1.3",
|
|
74
|
-
"esbuild-plugin-import-assertions": "1.0.1",
|
|
75
79
|
"glob": "11.0.0",
|
|
76
80
|
"prettier": "3.3.3",
|
|
77
81
|
"tsx": "^4.19.1",
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/client/listAllStreams.ts
|
|
21
|
-
var listAllStreams_exports = {};
|
|
22
|
-
__export(listAllStreams_exports, {
|
|
23
|
-
isStream: () => isStream,
|
|
24
|
-
listAllStreams: () => listAllStreams
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(listAllStreams_exports);
|
|
27
|
-
var import_EthereumAddress = require("../util/EthereumAddress.cjs");
|
|
28
|
-
var import_StreamId = require("../util/StreamId.cjs");
|
|
29
|
-
async function listAllStreams(kwilClient, owner) {
|
|
30
|
-
const databases = await kwilClient.listDatabases(owner?.getAddress());
|
|
31
|
-
const schemas = await Promise.all(
|
|
32
|
-
databases.data?.map(async (database) => {
|
|
33
|
-
const schema = await kwilClient.getSchema(database.dbid);
|
|
34
|
-
if (schema.status === 200 && schema.data && isStream(schema.data)) {
|
|
35
|
-
return schema.data;
|
|
36
|
-
}
|
|
37
|
-
return void 0;
|
|
38
|
-
}) ?? []
|
|
39
|
-
);
|
|
40
|
-
return schemas.filter((schema) => schema !== void 0).map((schema) => ({
|
|
41
|
-
streamId: import_StreamId.StreamId.fromString(schema.name).throw(),
|
|
42
|
-
dataProvider: import_EthereumAddress.EthereumAddress.fromBytes(schema.owner).throw()
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
45
|
-
var isStream = (schema) => {
|
|
46
|
-
const requiredProcedures = ["get_index", "get_record", "get_metadata"];
|
|
47
|
-
return requiredProcedures.every(
|
|
48
|
-
(procedure) => schema.procedures.some((p) => p.name === procedure)
|
|
49
|
-
);
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=listAllStreams.cjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/client/listAllStreams.ts"],
|
|
4
|
-
"sourcesContent": ["import { Kwil } from \"@kwilteam/kwil-js/dist/client/kwil\";\nimport { EnvironmentType } from \"@kwilteam/kwil-js/dist/core/enums\";\nimport { StreamLocator } from \"../types/stream\";\nimport { EthereumAddress } from \"../util/EthereumAddress\";\nimport { StreamId } from \"../util/StreamId\";\nimport { Database } from \"@kwilteam/kwil-js/dist/core/database\";\n\n/**\n * List all streams from the TN network.\n * @param kwilClient - The Kwil client.\n * @param owner - The owner of the streams. If not provided, all streams will be returned.\n * @returns A list of stream locators.\n */\nexport async function listAllStreams(\n kwilClient: Kwil<EnvironmentType>,\n owner?: EthereumAddress,\n): Promise<StreamLocator[]> {\n const databases = await kwilClient.listDatabases(owner?.getAddress());\n const schemas = await Promise.all(\n databases.data?.map(async (database) => {\n const schema = await kwilClient.getSchema(database.dbid);\n if (schema.status === 200 && schema.data && isStream(schema.data)) {\n return schema.data;\n }\n return undefined;\n }) ?? [],\n );\n return schemas\n .filter((schema) => schema !== undefined)\n .map((schema) => ({\n streamId: StreamId.fromString(schema.name).throw(),\n dataProvider: EthereumAddress.fromBytes(schema.owner).throw(),\n }));\n}\n\nexport const isStream = (schema: Database) => {\n const requiredProcedures = [\"get_index\", \"get_record\", \"get_metadata\"];\n return requiredProcedures.every((procedure) =>\n schema.procedures.some((p) => p.name === procedure),\n );\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,6BAAgC;AAChC,sBAAyB;AASzB,eAAsB,eACpB,YACA,OAC0B;AAC1B,QAAM,YAAY,MAAM,WAAW,cAAc,OAAO,WAAW,CAAC;AACpE,QAAM,UAAU,MAAM,QAAQ;AAAA,IAC5B,UAAU,MAAM,IAAI,OAAO,aAAa;AACtC,YAAM,SAAS,MAAM,WAAW,UAAU,SAAS,IAAI;AACvD,UAAI,OAAO,WAAW,OAAO,OAAO,QAAQ,SAAS,OAAO,IAAI,GAAG;AACjE,eAAO,OAAO;AAAA,MAChB;AACA,aAAO;AAAA,IACT,CAAC,KAAK,CAAC;AAAA,EACT;AACA,SAAO,QACJ,OAAO,CAAC,WAAW,WAAW,MAAS,EACvC,IAAI,CAAC,YAAY;AAAA,IAChB,UAAU,yBAAS,WAAW,OAAO,IAAI,EAAE,MAAM;AAAA,IACjD,cAAc,uCAAgB,UAAU,OAAO,KAAK,EAAE,MAAM;AAAA,EAC9D,EAAE;AACN;AAEO,IAAM,WAAW,CAAC,WAAqB;AAC5C,QAAM,qBAAqB,CAAC,aAAa,cAAc,cAAc;AACrE,SAAO,mBAAmB;AAAA,IAAM,CAAC,cAC/B,OAAO,WAAW,KAAK,CAAC,MAAM,EAAE,SAAS,SAAS;AAAA,EACpD;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|