@hotmeshio/hotmesh 0.3.32 → 0.4.1
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 +128 -823
- package/build/index.d.ts +9 -9
- package/build/index.js +10 -10
- package/build/modules/enums.d.ts +23 -23
- package/build/modules/enums.js +26 -26
- package/build/modules/errors.d.ts +16 -16
- package/build/modules/errors.js +28 -28
- package/build/modules/key.js +190 -1
- package/build/modules/utils.js +374 -1
- package/build/package.json +22 -21
- package/build/services/activities/activity.js +549 -1
- package/build/services/activities/await.js +114 -1
- package/build/services/activities/cycle.js +112 -1
- package/build/services/activities/hook.js +168 -1
- package/build/services/activities/index.js +20 -1
- package/build/services/activities/interrupt.js +158 -1
- package/build/services/activities/signal.js +134 -1
- package/build/services/activities/trigger.js +246 -1
- package/build/services/activities/worker.js +106 -1
- package/build/services/collator/index.js +293 -1
- package/build/services/compiler/deployer.js +488 -1
- package/build/services/compiler/index.js +112 -1
- package/build/services/compiler/validator.js +147 -1
- package/build/services/engine/index.js +761 -1
- package/build/services/exporter/index.js +126 -1
- package/build/services/hotmesh/index.d.ts +160 -17
- package/build/services/hotmesh/index.js +160 -17
- package/build/services/mapper/index.js +81 -1
- package/build/services/{meshflow → memflow}/client.d.ts +3 -3
- package/build/services/{meshflow → memflow}/client.js +17 -16
- package/build/services/{meshflow → memflow}/connection.d.ts +2 -2
- package/build/services/{meshflow → memflow}/connection.js +1 -1
- package/build/services/memflow/context.d.ts +143 -0
- package/build/services/memflow/context.js +299 -0
- package/build/services/{meshflow → memflow}/exporter.d.ts +6 -6
- package/build/services/memflow/exporter.js +215 -0
- package/build/services/{meshflow → memflow}/handle.d.ts +4 -4
- package/build/services/{meshflow → memflow}/handle.js +2 -2
- package/build/services/{meshflow → memflow}/index.d.ts +18 -13
- package/build/services/{meshflow → memflow}/index.js +26 -21
- package/build/services/{meshflow → memflow}/schemas/factory.d.ts +4 -4
- package/build/services/{meshflow → memflow}/schemas/factory.js +5 -5
- package/build/services/{meshflow → memflow}/search.d.ts +1 -1
- package/build/services/{meshflow → memflow}/search.js +4 -4
- package/build/services/{meshflow → memflow}/worker.d.ts +5 -5
- package/build/services/{meshflow → memflow}/worker.js +24 -24
- package/build/services/memflow/workflow/common.d.ts +20 -0
- package/build/services/memflow/workflow/common.js +47 -0
- package/build/services/memflow/workflow/contextMethods.d.ts +14 -0
- package/build/services/memflow/workflow/contextMethods.js +33 -0
- package/build/services/{meshflow → memflow}/workflow/execChild.js +12 -12
- package/build/services/memflow/workflow/execHook.d.ts +65 -0
- package/build/services/memflow/workflow/execHook.js +73 -0
- package/build/services/{meshflow → memflow}/workflow/hook.js +19 -3
- package/build/services/{meshflow → memflow}/workflow/index.d.ts +7 -3
- package/build/services/{meshflow → memflow}/workflow/index.js +7 -3
- package/build/services/{meshflow → memflow}/workflow/proxyActivities.d.ts +2 -2
- package/build/services/{meshflow → memflow}/workflow/proxyActivities.js +8 -8
- package/build/services/{meshflow → memflow}/workflow/sleepFor.js +2 -2
- package/build/services/{meshflow → memflow}/workflow/waitFor.js +2 -2
- package/build/services/meshdata/index.d.ts +24 -24
- package/build/services/meshdata/index.js +40 -40
- package/build/services/pipe/functions/array.js +74 -1
- package/build/services/pipe/functions/bitwise.js +24 -1
- package/build/services/pipe/functions/conditional.js +36 -1
- package/build/services/pipe/functions/cron.js +40 -1
- package/build/services/pipe/functions/date.js +171 -1
- package/build/services/pipe/functions/index.js +30 -1
- package/build/services/pipe/functions/json.js +12 -1
- package/build/services/pipe/functions/logical.js +12 -1
- package/build/services/pipe/functions/math.js +184 -1
- package/build/services/pipe/functions/number.js +60 -1
- package/build/services/pipe/functions/object.js +81 -1
- package/build/services/pipe/functions/string.js +69 -1
- package/build/services/pipe/functions/symbol.js +33 -1
- package/build/services/pipe/functions/unary.js +18 -1
- package/build/services/pipe/index.js +242 -1
- package/build/services/quorum/index.js +263 -1
- package/build/services/reporter/index.js +348 -1
- package/build/services/router/config/index.d.ts +11 -0
- package/build/services/router/config/index.js +36 -0
- package/build/services/router/consumption/index.d.ts +34 -0
- package/build/services/router/consumption/index.js +395 -0
- package/build/services/router/error-handling/index.d.ts +8 -0
- package/build/services/router/error-handling/index.js +98 -0
- package/build/services/router/index.d.ts +13 -16
- package/build/services/router/index.js +121 -1
- package/build/services/router/lifecycle/index.d.ts +27 -0
- package/build/services/router/lifecycle/index.js +80 -0
- package/build/services/router/telemetry/index.d.ts +11 -0
- package/build/services/router/telemetry/index.js +32 -0
- package/build/services/router/throttling/index.d.ts +23 -0
- package/build/services/router/throttling/index.js +76 -0
- package/build/services/search/index.d.ts +2 -1
- package/build/services/search/providers/postgres/postgres.d.ts +2 -1
- package/build/services/search/providers/postgres/postgres.js +149 -1
- package/build/services/search/providers/redis/ioredis.d.ts +1 -0
- package/build/services/search/providers/redis/ioredis.js +121 -1
- package/build/services/search/providers/redis/redis.d.ts +1 -0
- package/build/services/search/providers/redis/redis.js +134 -1
- package/build/services/serializer/index.js +282 -1
- package/build/services/store/providers/postgres/kvsql.d.ts +1 -1
- package/build/services/store/providers/postgres/kvsql.js +198 -1
- package/build/services/store/providers/postgres/kvtables.js +441 -1
- package/build/services/store/providers/postgres/kvtransaction.js +248 -1
- package/build/services/store/providers/postgres/kvtypes/hash.d.ts +1 -1
- package/build/services/store/providers/postgres/kvtypes/hash.js +1287 -1
- package/build/services/store/providers/postgres/kvtypes/list.js +194 -1
- package/build/services/store/providers/postgres/kvtypes/string.js +115 -1
- package/build/services/store/providers/postgres/kvtypes/zset.js +214 -1
- package/build/services/store/providers/postgres/postgres.js +1036 -1
- package/build/services/store/providers/redis/_base.js +980 -1
- package/build/services/store/providers/redis/ioredis.js +180 -1
- package/build/services/store/providers/redis/redis.js +199 -1
- package/build/services/store/providers/store-initializable.js +2 -1
- package/build/services/stream/index.d.ts +5 -0
- package/build/services/stream/providers/nats/nats.d.ts +1 -0
- package/build/services/stream/providers/nats/nats.js +225 -1
- package/build/services/stream/providers/postgres/kvtables.d.ts +1 -0
- package/build/services/stream/providers/postgres/kvtables.js +146 -1
- package/build/services/stream/providers/postgres/postgres.d.ts +19 -0
- package/build/services/stream/providers/postgres/postgres.js +519 -1
- package/build/services/stream/providers/redis/ioredis.d.ts +1 -0
- package/build/services/stream/providers/redis/ioredis.js +272 -1
- package/build/services/stream/providers/redis/redis.d.ts +1 -0
- package/build/services/stream/providers/redis/redis.js +305 -1
- package/build/services/stream/providers/stream-initializable.js +2 -1
- package/build/services/sub/providers/nats/nats.js +105 -1
- package/build/services/sub/providers/postgres/postgres.js +92 -1
- package/build/services/sub/providers/redis/ioredis.js +81 -1
- package/build/services/sub/providers/redis/redis.js +72 -1
- package/build/services/task/index.js +206 -1
- package/build/services/telemetry/index.js +306 -1
- package/build/services/worker/index.js +197 -1
- package/build/types/error.d.ts +5 -5
- package/build/types/exporter.d.ts +1 -1
- package/build/types/index.d.ts +3 -3
- package/build/types/manifest.d.ts +2 -2
- package/build/types/{meshflow.d.ts → memflow.d.ts} +15 -15
- package/build/types/meshdata.d.ts +3 -3
- package/build/types/postgres.d.ts +7 -0
- package/build/types/stream.d.ts +3 -0
- package/index.ts +11 -11
- package/package.json +22 -21
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/build/services/meshflow/exporter.js +0 -1
- package/build/services/meshflow/workflow/common.d.ts +0 -18
- package/build/services/meshflow/workflow/common.js +0 -45
- package/typedoc.json +0 -46
- package/types/activity.ts +0 -268
- package/types/app.ts +0 -20
- package/types/async.ts +0 -6
- package/types/cache.ts +0 -1
- package/types/collator.ts +0 -9
- package/types/error.ts +0 -56
- package/types/exporter.ts +0 -102
- package/types/hook.ts +0 -44
- package/types/hotmesh.ts +0 -314
- package/types/index.ts +0 -306
- package/types/job.ts +0 -233
- package/types/logger.ts +0 -8
- package/types/manifest.ts +0 -70
- package/types/map.ts +0 -5
- package/types/meshcall.ts +0 -235
- package/types/meshdata.ts +0 -278
- package/types/meshflow.ts +0 -645
- package/types/ms.d.ts +0 -7
- package/types/nats.ts +0 -270
- package/types/pipe.ts +0 -90
- package/types/postgres.ts +0 -105
- package/types/provider.ts +0 -161
- package/types/quorum.ts +0 -167
- package/types/redis.ts +0 -404
- package/types/serializer.ts +0 -40
- package/types/stats.ts +0 -117
- package/types/stream.ts +0 -227
- package/types/task.ts +0 -7
- package/types/telemetry.ts +0 -16
- package/types/transition.ts +0 -20
- /package/build/services/{meshflow → memflow}/workflow/all.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/all.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/context.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/context.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/didRun.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/didRun.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/emit.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/emit.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/enrich.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/enrich.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/execChild.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/hook.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/interrupt.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/interrupt.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/isSideEffectAllowed.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/isSideEffectAllowed.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/random.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/random.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/searchMethods.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/searchMethods.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/signal.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/signal.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/sleepFor.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/trace.d.ts +0 -0
- /package/build/services/{meshflow → memflow}/workflow/trace.js +0 -0
- /package/build/services/{meshflow → memflow}/workflow/waitFor.d.ts +0 -0
- /package/build/types/{meshflow.js → memflow.js} +0 -0
package/types/nats.ts
DELETED
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import { ProviderClient, ProviderTransaction } from './provider';
|
|
2
|
-
|
|
3
|
-
/** Connection Options for NATS */
|
|
4
|
-
export interface NatsConnectionOptions {
|
|
5
|
-
servers?: string | string[];
|
|
6
|
-
timeout?: number;
|
|
7
|
-
name?: string;
|
|
8
|
-
user?: string;
|
|
9
|
-
pass?: string;
|
|
10
|
-
token?: string;
|
|
11
|
-
// Add other connection options as needed
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/** Additional JetStream Options */
|
|
15
|
-
export interface NatsJetStreamOptions {
|
|
16
|
-
domain?: string;
|
|
17
|
-
prefix?: string;
|
|
18
|
-
timeout?: number;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/** Combined Stream Options */
|
|
22
|
-
export interface NatsStreamOptions extends NatsConnectionOptions {
|
|
23
|
-
jetstream?: NatsJetStreamOptions;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/** Type for NATS Client Options */
|
|
27
|
-
export type NatsClientOptions = NatsStreamOptions;
|
|
28
|
-
|
|
29
|
-
/** Interface representing a NATS Connection */
|
|
30
|
-
export interface NatsConnection extends ProviderClient {
|
|
31
|
-
jetstream(options?: NatsJetStreamOptions): NatsJetStreamClient;
|
|
32
|
-
jetstreamManager(
|
|
33
|
-
options?: NatsJetStreamOptions,
|
|
34
|
-
): Promise<NatsJetStreamManager>;
|
|
35
|
-
close(): Promise<void>;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface NatsSubscriptionType {
|
|
39
|
-
/**
|
|
40
|
-
* Unsubscribes from the subject, stopping message delivery.
|
|
41
|
-
*/
|
|
42
|
-
unsubscribe(): void;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Drains the subscription, ensuring all pending messages are delivered
|
|
46
|
-
* before unsubscribing.
|
|
47
|
-
* @returns Promise<void>
|
|
48
|
-
*/
|
|
49
|
-
drain(): Promise<void>;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* The subject this subscription is listening to.
|
|
53
|
-
*/
|
|
54
|
-
subject: string;
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The queue group this subscription belongs to, if any.
|
|
58
|
-
*/
|
|
59
|
-
queue?: string;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Indicates whether this subscription is currently active.
|
|
63
|
-
*/
|
|
64
|
-
isClosed: boolean;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Async iterator for processing incoming messages.
|
|
68
|
-
*/
|
|
69
|
-
[Symbol.asyncIterator](): AsyncIterableIterator<NatsMessageType>;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** Type representing the NATS Connection */
|
|
73
|
-
export type NatsClientType = NatsConnection;
|
|
74
|
-
|
|
75
|
-
/** Type representing the NATS Connection Function */
|
|
76
|
-
export type NatsClassType = (
|
|
77
|
-
options: NatsClientOptions,
|
|
78
|
-
) => Promise<NatsConnection>;
|
|
79
|
-
|
|
80
|
-
/** Interface for JetStream Client */
|
|
81
|
-
export interface NatsJetStreamClient {
|
|
82
|
-
publish(
|
|
83
|
-
subject: string,
|
|
84
|
-
data: Uint8Array,
|
|
85
|
-
options?: NatsPublishOptions,
|
|
86
|
-
): Promise<NatsPubAck>;
|
|
87
|
-
consumers: any; // Simplify as needed
|
|
88
|
-
jetstreamManager(): Promise<NatsJetStreamManager>;
|
|
89
|
-
// Additional methods as needed
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/** **NatsJetStreamType** */
|
|
93
|
-
export type NatsJetStreamType = NatsJetStreamClient;
|
|
94
|
-
|
|
95
|
-
/** Interface for JetStream Manager */
|
|
96
|
-
export interface NatsJetStreamManager {
|
|
97
|
-
streams: NatsStreamManager;
|
|
98
|
-
consumers: NatsConsumerManager;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/** Interface for Stream Manager */
|
|
102
|
-
export interface NatsStreamManager {
|
|
103
|
-
add(config: Partial<NatsStreamConfig>): Promise<void>;
|
|
104
|
-
delete(stream: string): Promise<boolean>;
|
|
105
|
-
info(stream: string): Promise<NatsStreamInfo>;
|
|
106
|
-
list(): AsyncIterable<NatsStreamInfo>;
|
|
107
|
-
deleteMessage(stream: string, seq: number): Promise<boolean>;
|
|
108
|
-
update(stream: string, config: NatsStreamConfig): Promise<void>;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/** Interface for Consumer Manager */
|
|
112
|
-
export interface NatsConsumerManager {
|
|
113
|
-
add(stream: string, config: NatsConsumerConfig): Promise<void>;
|
|
114
|
-
delete(stream: string, consumer: string): Promise<boolean>;
|
|
115
|
-
info(stream: string, consumer: string): Promise<NatsConsumerInfo>;
|
|
116
|
-
list(stream: string): AsyncIterable<NatsConsumerInfo>;
|
|
117
|
-
// Additional methods as needed
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/** Stream Configuration */
|
|
121
|
-
export interface NatsStreamConfig {
|
|
122
|
-
name: string;
|
|
123
|
-
subjects?: string[];
|
|
124
|
-
retention?: NatsRetentionPolicy;
|
|
125
|
-
storage?: NatsStorageType;
|
|
126
|
-
num_replicas?: number;
|
|
127
|
-
max_msgs?: number;
|
|
128
|
-
max_age?: number; // In nanoseconds
|
|
129
|
-
// Add other stream configurations as needed
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/** Consumer Configuration */
|
|
133
|
-
export interface NatsConsumerConfig {
|
|
134
|
-
durable_name?: string;
|
|
135
|
-
deliver_subject?: string;
|
|
136
|
-
deliver_group?: string;
|
|
137
|
-
ack_policy?: NatsAckPolicy;
|
|
138
|
-
ack_wait?: number; // In nanoseconds
|
|
139
|
-
max_deliver?: number;
|
|
140
|
-
// Add other consumer configurations as needed
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/** Interface for JetStream Message */
|
|
144
|
-
export interface NatsJsMsg {
|
|
145
|
-
seq: number;
|
|
146
|
-
ack(): void;
|
|
147
|
-
nak(): void;
|
|
148
|
-
term(): void;
|
|
149
|
-
inProgress(): void;
|
|
150
|
-
working(): void;
|
|
151
|
-
data: Uint8Array;
|
|
152
|
-
subject: string;
|
|
153
|
-
headers?: { [key: string]: string };
|
|
154
|
-
info: NatsDeliveryInfo;
|
|
155
|
-
// Additional properties and methods as needed
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/** Delivery Info for a Message */
|
|
159
|
-
export interface NatsDeliveryInfo {
|
|
160
|
-
stream: string;
|
|
161
|
-
consumer: string;
|
|
162
|
-
redeliveryCount: number;
|
|
163
|
-
timestampNanos: number;
|
|
164
|
-
pending: number;
|
|
165
|
-
// Additional properties as needed
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/** Interface for Publish Acknowledgment */
|
|
169
|
-
export interface NatsPubAck extends ProviderTransaction {
|
|
170
|
-
stream: string;
|
|
171
|
-
seq: number;
|
|
172
|
-
duplicate: boolean;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/** Interface for Stream Information */
|
|
176
|
-
export interface NatsStreamInfo {
|
|
177
|
-
config: NatsStreamConfig;
|
|
178
|
-
state: NatsStreamState;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/** Stream State Information */
|
|
182
|
-
export interface NatsStreamState {
|
|
183
|
-
messages: number;
|
|
184
|
-
bytes: number;
|
|
185
|
-
first_seq: number;
|
|
186
|
-
last_seq: number;
|
|
187
|
-
// Additional state properties as needed
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
/** Interface for Consumer Information */
|
|
191
|
-
export interface NatsConsumerInfo {
|
|
192
|
-
name: string;
|
|
193
|
-
stream_name: string;
|
|
194
|
-
config: NatsConsumerConfig;
|
|
195
|
-
delivered: NatsSequenceInfo;
|
|
196
|
-
ack_floor: NatsSequenceInfo;
|
|
197
|
-
num_ack_pending: number;
|
|
198
|
-
num_redelivered: number;
|
|
199
|
-
num_waiting: number;
|
|
200
|
-
num_pending: number;
|
|
201
|
-
// Additional properties as needed
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/** Sequence Information */
|
|
205
|
-
export interface NatsSequenceInfo {
|
|
206
|
-
consumer_seq: number;
|
|
207
|
-
stream_seq: number;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/** Publish Options */
|
|
211
|
-
export interface NatsPublishOptions {
|
|
212
|
-
msgID?: string;
|
|
213
|
-
expect?: NatsMsgExpect;
|
|
214
|
-
headers?: { [key: string]: string };
|
|
215
|
-
// Additional options as needed
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/** Message Expectation */
|
|
219
|
-
export interface NatsMsgExpect {
|
|
220
|
-
lastMsgID?: string;
|
|
221
|
-
streamName?: string;
|
|
222
|
-
lastSequence?: number;
|
|
223
|
-
// Additional expectations as needed
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
/** NATS Error */
|
|
227
|
-
export interface NatsError extends Error {
|
|
228
|
-
code?: string;
|
|
229
|
-
// Additional properties as needed
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/** Retention Policies */
|
|
233
|
-
export type NatsRetentionPolicy = 'limits' | 'interest' | 'workqueue';
|
|
234
|
-
|
|
235
|
-
/** Storage Types */
|
|
236
|
-
export type NatsStorageType = 'file' | 'memory';
|
|
237
|
-
|
|
238
|
-
/** Acknowledgment Policies */
|
|
239
|
-
export type NatsAckPolicy = 'none' | 'all' | 'explicit';
|
|
240
|
-
|
|
241
|
-
/** Types for Specific Policies */
|
|
242
|
-
export type NatsRetentionPolicyWorkqueueType = 'workqueue';
|
|
243
|
-
export type NatsStorageMemoryType = 'memory';
|
|
244
|
-
export type NatsAckPolicyExplicitType = 'explicit';
|
|
245
|
-
|
|
246
|
-
/** NATS Message Type */
|
|
247
|
-
export type NatsMessageType = NatsJsMsg;
|
|
248
|
-
|
|
249
|
-
/** NATS Transaction Interface */
|
|
250
|
-
export interface NatsTransaction {
|
|
251
|
-
msgs: NatsMessageType[];
|
|
252
|
-
pubAcks: NatsPubAck[];
|
|
253
|
-
execute(): Promise<void>;
|
|
254
|
-
rollback(): Promise<void>;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/** NATS Client Error Type */
|
|
258
|
-
export type NatsErrorType = NatsError;
|
|
259
|
-
|
|
260
|
-
/** NATS Stream Info Type */
|
|
261
|
-
export type NatsStreamInfoType = NatsStreamInfo;
|
|
262
|
-
|
|
263
|
-
/** NATS Stream Config Type */
|
|
264
|
-
export type NatsStreamConfigType = Partial<NatsStreamConfig>;
|
|
265
|
-
|
|
266
|
-
/** NATS Consumer Config Type */
|
|
267
|
-
export type NatsConsumerConfigType = Partial<NatsConsumerConfig>;
|
|
268
|
-
|
|
269
|
-
/** NATS Publish Ack Type */
|
|
270
|
-
export type NatsPubAckType = NatsPubAck;
|
package/types/pipe.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Represents a single cell value in a pipeline row
|
|
3
|
-
* If the value is a string, the value will be a literal OR mapping expression
|
|
4
|
-
*/
|
|
5
|
-
type PipeItem = string | boolean | number | null | object;
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Array of `PipeItem` types.
|
|
9
|
-
*/
|
|
10
|
-
type PipeItems = PipeItem[];
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Represents a new nested context in the pipeline.
|
|
14
|
-
* As the structure is recursive, the nested pipe may contain an
|
|
15
|
-
* array of `PipeItem[]`, `PipeObject`, OR `ReduceObject` items.
|
|
16
|
-
*/
|
|
17
|
-
type PipeObject = { '@pipe': Array<PipeItem[] | PipeObject | ReduceObject> };
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Reduce is similar to Pipe in that it represents a new context
|
|
21
|
-
* and may include an array of `PipeItem[]`, `PipeObject`, or `ReduceObject`.
|
|
22
|
-
* But it also iterates and produces output. The context variables,
|
|
23
|
-
* `$input`, `$output`, `$item`, `$key`, and `$index` are available.
|
|
24
|
-
* @example
|
|
25
|
-
*
|
|
26
|
-
* // Example of a reduce expression. The optional object is empty and
|
|
27
|
-
* // serves as the $output during iteration. The last step in the iteration
|
|
28
|
-
* // sets $output. if ther are no more iterations, the $output is returned
|
|
29
|
-
* // and provided to the next step in the pipeline.
|
|
30
|
-
*
|
|
31
|
-
* // If data is:
|
|
32
|
-
* // { response: ['a', 'b', 'c'] }
|
|
33
|
-
*
|
|
34
|
-
* // The reduced/transformed expression will be:
|
|
35
|
-
* // { 'a': 0, 'b': 1, 'c': 2 }
|
|
36
|
-
*
|
|
37
|
-
* // Arrays and objects may be iterated over and transformed.
|
|
38
|
-
*
|
|
39
|
-
* //YAML
|
|
40
|
-
* '@pipe':
|
|
41
|
-
* - ['{data.response}', {}]
|
|
42
|
-
* - '@reduce':
|
|
43
|
-
* - '@pipe':
|
|
44
|
-
* - ['{$output}']
|
|
45
|
-
* - '@pipe':
|
|
46
|
-
* - ['{$item}']
|
|
47
|
-
* - '@pipe':
|
|
48
|
-
* - ['{$index}']
|
|
49
|
-
* - ['{@object.set}']
|
|
50
|
-
*/
|
|
51
|
-
type ReduceObject = {
|
|
52
|
-
'@reduce': Array<PipeItem[] | PipeObject | ReduceObject>;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Represents a sequence in the pipeline that can include arrays of `PipeItem`, `PipeObject`, or `ReduceObject`.
|
|
57
|
-
*/
|
|
58
|
-
type Pipe = (PipeItem[] | PipeObject | ReduceObject)[];
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Defines the context of a pipeline operation.
|
|
62
|
-
*/
|
|
63
|
-
type PipeContext = {
|
|
64
|
-
/**
|
|
65
|
-
* Input of the current iteration.
|
|
66
|
-
*/
|
|
67
|
-
$input: unknown[];
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Output of the current iteration and the final output for the reducer.
|
|
71
|
-
*/
|
|
72
|
-
$output: unknown;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Target item in the iterator.
|
|
76
|
-
*/
|
|
77
|
-
$item: unknown;
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Array index as string or object key.
|
|
81
|
-
*/
|
|
82
|
-
$key: string;
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Numeric index of the iterator.
|
|
86
|
-
*/
|
|
87
|
-
$index: number;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export { Pipe, PipeContext, PipeItem, PipeItems, PipeObject, ReduceObject };
|
package/types/postgres.ts
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
// /app/types/postgres.ts
|
|
2
|
-
export interface PostgresClientOptions {
|
|
3
|
-
host?: string;
|
|
4
|
-
port?: number;
|
|
5
|
-
user?: string;
|
|
6
|
-
password?: string;
|
|
7
|
-
database?: string;
|
|
8
|
-
max?: number;
|
|
9
|
-
idleTimeoutMillis?: number;
|
|
10
|
-
// Add any other options you might need
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export type PostgresJobEnumType =
|
|
14
|
-
| 'status'
|
|
15
|
-
| 'jdata'
|
|
16
|
-
| 'adata'
|
|
17
|
-
| 'udata'
|
|
18
|
-
| 'jmark'
|
|
19
|
-
| 'hmark'
|
|
20
|
-
| 'other';
|
|
21
|
-
|
|
22
|
-
export type PostgresClassType = {
|
|
23
|
-
new (options: PostgresClientOptions): PostgresClientType;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export type PostgresPoolType = {
|
|
27
|
-
new (options: PostgresClientOptions): PostgresPoolClientType;
|
|
28
|
-
connect: (options: PostgresClientOptions) => Promise<PostgresClientType>;
|
|
29
|
-
//NOTE: query is a shorthand and includes implicit `connect/release` handled by pool
|
|
30
|
-
query: (text: string, values?: any[]) => Promise<PostgresQueryResultType>;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export interface PostgresClientType {
|
|
34
|
-
connect: () => Promise<PostgresClientType>;
|
|
35
|
-
query: (text: string, values?: any[]) => Promise<PostgresQueryResultType>;
|
|
36
|
-
end: () => Promise<void>;
|
|
37
|
-
// Include other methods if necessary
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface PostgresPoolClientType {
|
|
41
|
-
connect: () => Promise<PostgresClientType>;
|
|
42
|
-
release: () => void;
|
|
43
|
-
end: () => Promise<void>;
|
|
44
|
-
query: (text: string, values?: any[]) => Promise<PostgresQueryResultType>;
|
|
45
|
-
idleCount: number;
|
|
46
|
-
totalCount: number;
|
|
47
|
-
// Include other methods if necessary
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export interface PostgresQueryResultType {
|
|
51
|
-
rows: any[];
|
|
52
|
-
rowCount: number;
|
|
53
|
-
// Include other properties if necessary
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface PostgresQueryConfigType {
|
|
57
|
-
text: string;
|
|
58
|
-
values?: any[];
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export interface PostgresStreamOptions extends PostgresClientOptions {
|
|
62
|
-
schema?: string;
|
|
63
|
-
maxRetries?: number;
|
|
64
|
-
retryDelay?: number;
|
|
65
|
-
streamTablePrefix?: string;
|
|
66
|
-
consumerTablePrefix?: string;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface PostgresStreamMessage {
|
|
70
|
-
id: string;
|
|
71
|
-
stream: string;
|
|
72
|
-
message: any;
|
|
73
|
-
created_at: Date;
|
|
74
|
-
sequence?: number;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export interface PostgresConsumerGroup {
|
|
78
|
-
stream: string;
|
|
79
|
-
group_name: string;
|
|
80
|
-
last_message_id: string;
|
|
81
|
-
created_at: Date;
|
|
82
|
-
updated_at: Date;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export interface PostgresPendingMessage {
|
|
86
|
-
stream: string;
|
|
87
|
-
group_name: string;
|
|
88
|
-
consumer_name: string;
|
|
89
|
-
message_id: string;
|
|
90
|
-
delivered_at: Date;
|
|
91
|
-
delivery_count: number;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface PostgresTransaction {
|
|
95
|
-
client: PostgresPoolClientType;
|
|
96
|
-
queryBuffer: {
|
|
97
|
-
text: string;
|
|
98
|
-
values: any[];
|
|
99
|
-
}[];
|
|
100
|
-
begin(): Promise<void>;
|
|
101
|
-
query(text: string, values?: any[]): Promise<PostgresQueryResultType>;
|
|
102
|
-
commit(): Promise<void>;
|
|
103
|
-
rollback(): Promise<void>;
|
|
104
|
-
release(): void;
|
|
105
|
-
}
|
package/types/provider.ts
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { KeyStoreParams } from '../modules/key';
|
|
2
|
-
|
|
3
|
-
import { StringAnyType } from './serializer';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Generic type for provider class
|
|
7
|
-
*/
|
|
8
|
-
export interface ProviderClass {
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Generic type for provider options
|
|
14
|
-
*/
|
|
15
|
-
export interface ProviderOptions {
|
|
16
|
-
[key: string]: any;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type Providers = 'redis' | 'nats' | 'postgres' | 'ioredis';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* A provider transaction is a set of operations that are executed
|
|
23
|
-
* atomically by the provider. The transaction is created by calling
|
|
24
|
-
* the `transact` method on the provider. The transaction object
|
|
25
|
-
* contains methods specific to the provider allowing it to optionally
|
|
26
|
-
* choose to execute a single command or collect all commands and
|
|
27
|
-
* execute as a single transaction.
|
|
28
|
-
*/
|
|
29
|
-
export interface ProviderTransaction {
|
|
30
|
-
exec(): Promise<any>;
|
|
31
|
-
|
|
32
|
-
// Allows callable properties while avoiding conflicts with ProviderTransaction instances
|
|
33
|
-
[key: string]: ((...args: any[]) => Promise<any>) | undefined | any;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* A provider native client is the raw client object provided by the
|
|
38
|
-
* connecter service. This object is passed to the ProviderClient
|
|
39
|
-
* (which wraps it), providing a standardized interface for all
|
|
40
|
-
* providers.
|
|
41
|
-
*/
|
|
42
|
-
export interface ProviderNativeClient {
|
|
43
|
-
[key: string]: any;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Wrapped provider native client object that standardizes the
|
|
48
|
-
* interface for all providers.
|
|
49
|
-
*/
|
|
50
|
-
export interface ProviderClient {
|
|
51
|
-
/** The provider-specific transaction object */
|
|
52
|
-
transact(): ProviderTransaction;
|
|
53
|
-
|
|
54
|
-
/** Mint a provider-specific key */
|
|
55
|
-
mintKey(type: KeyType, params: KeyStoreParams): string;
|
|
56
|
-
|
|
57
|
-
/** The provider-specific client object */
|
|
58
|
-
[key: string]: any;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* an array of outputs generic to all providers
|
|
63
|
-
* e.g., [3, 2, '0']
|
|
64
|
-
*/
|
|
65
|
-
export type TransactionResultList = (string | number)[]; // e.g., [3, 2, '0']
|
|
66
|
-
|
|
67
|
-
export type ProviderConfig = {
|
|
68
|
-
class: any;
|
|
69
|
-
options: StringAnyType;
|
|
70
|
-
/* 'redis' (Class) | 'ioredis' (Class) | 'postgres' (Client module) | 'postgres.pool' | 'postgres.poolclient', 'nats' */
|
|
71
|
-
provider?: string;
|
|
72
|
-
/**
|
|
73
|
-
* If provided and if true, the engine router instance will
|
|
74
|
-
* be initialized as a readonly instance and will not consume
|
|
75
|
-
* messages from the stream channel. An engine in readonly mode
|
|
76
|
-
* can still read/write to the store and can still pub/sub events.
|
|
77
|
-
*/
|
|
78
|
-
readonly?: boolean;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export type ProvidersConfig = {
|
|
82
|
-
sub: ProviderConfig;
|
|
83
|
-
store: ProviderConfig;
|
|
84
|
-
stream: ProviderConfig;
|
|
85
|
-
pub?: ProviderConfig;
|
|
86
|
-
search?: ProviderConfig;
|
|
87
|
-
/**
|
|
88
|
-
* If provided and if true, the engine router instance will
|
|
89
|
-
* be initialized as a readonly instance and will not consume
|
|
90
|
-
* messages from the stream channel. An engine in readonly mode
|
|
91
|
-
* can still read/write to the store and can still pub/sub events.
|
|
92
|
-
*/
|
|
93
|
-
readonly?: boolean;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export interface SetOptions {
|
|
97
|
-
nx?: boolean;
|
|
98
|
-
ex?: number; // Expiry time in seconds
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export interface HSetOptions {
|
|
102
|
-
nx?: boolean;
|
|
103
|
-
ex?: number; // Expiry time in seconds
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export interface ZAddOptions {
|
|
107
|
-
nx?: boolean;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export interface HScanResult {
|
|
111
|
-
cursor: string;
|
|
112
|
-
items: Record<string, string>;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface KVSQLProviderTransaction extends ProviderTransaction {
|
|
116
|
-
[key: string]: any;
|
|
117
|
-
exec(): Promise<any[]>;
|
|
118
|
-
set(key: string, value: string, options?: SetOptions): ProviderTransaction;
|
|
119
|
-
get(key: string): ProviderTransaction;
|
|
120
|
-
del(key: string): ProviderTransaction;
|
|
121
|
-
expire(key: string, seconds: number): ProviderTransaction;
|
|
122
|
-
hset(
|
|
123
|
-
key: string,
|
|
124
|
-
fields: Record<string, string>,
|
|
125
|
-
options?: HSetOptions,
|
|
126
|
-
): ProviderTransaction;
|
|
127
|
-
hget(key: string, field: string): ProviderTransaction;
|
|
128
|
-
hdel(key: string, fields: string[]): ProviderTransaction;
|
|
129
|
-
hmget(key: string, fields: string[]): ProviderTransaction;
|
|
130
|
-
hgetall(key: string): ProviderTransaction;
|
|
131
|
-
hincrbyfloat(key: string, field: string, value: number): ProviderTransaction;
|
|
132
|
-
hscan(key: string, cursor: string, count?: number): ProviderTransaction;
|
|
133
|
-
lrange(key: string, start: number, end: number): ProviderTransaction;
|
|
134
|
-
rpush(key: string, value: string): ProviderTransaction;
|
|
135
|
-
lpush(key: string, value: string): ProviderTransaction;
|
|
136
|
-
lpop(key: string): ProviderTransaction;
|
|
137
|
-
lmove(
|
|
138
|
-
source: string,
|
|
139
|
-
destination: string,
|
|
140
|
-
srcPosition: 'LEFT' | 'RIGHT',
|
|
141
|
-
destPosition: 'LEFT' | 'RIGHT',
|
|
142
|
-
): ProviderTransaction;
|
|
143
|
-
zadd(
|
|
144
|
-
key: string,
|
|
145
|
-
score: number,
|
|
146
|
-
member: string,
|
|
147
|
-
options?: ZAddOptions,
|
|
148
|
-
): ProviderTransaction;
|
|
149
|
-
zrange(key: string, start: number, stop: number): ProviderTransaction;
|
|
150
|
-
zrangebyscore(key: string, min: number, max: number): ProviderTransaction;
|
|
151
|
-
zrangebyscore_withscores(
|
|
152
|
-
key: string,
|
|
153
|
-
min: number,
|
|
154
|
-
max: number,
|
|
155
|
-
): ProviderTransaction;
|
|
156
|
-
zrem(key: string, member: string): ProviderTransaction;
|
|
157
|
-
zrank(key: string, member: string): ProviderTransaction;
|
|
158
|
-
scan(cursor: number, count?: number): ProviderTransaction;
|
|
159
|
-
rename(oldKey: string, newKey: string): ProviderTransaction;
|
|
160
|
-
// Add other methods as needed
|
|
161
|
-
}
|