@mastra/clickhouse 0.3.2-alpha.1 → 0.3.2-alpha.3

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.
@@ -1,23 +1,23 @@
1
1
 
2
- > @mastra/clickhouse@0.3.2-alpha.1 build /home/runner/work/mastra/mastra/stores/clickhouse
2
+ > @mastra/clickhouse@0.3.2-alpha.3 build /home/runner/work/mastra/mastra/stores/clickhouse
3
3
  > tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting
4
4
 
5
5
  CLI Building entry: src/index.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v8.4.0
8
8
  TSC Build start
9
- TSC ⚡️ Build success in 8159ms
9
+ TSC ⚡️ Build success in 8991ms
10
10
  DTS Build start
11
11
  CLI Target: es2022
12
12
  Analysis will use the bundled TypeScript version 5.8.3
13
13
  Writing package typings: /home/runner/work/mastra/mastra/stores/clickhouse/dist/_tsup-dts-rollup.d.ts
14
14
  Analysis will use the bundled TypeScript version 5.8.3
15
15
  Writing package typings: /home/runner/work/mastra/mastra/stores/clickhouse/dist/_tsup-dts-rollup.d.cts
16
- DTS ⚡️ Build success in 11936ms
16
+ DTS ⚡️ Build success in 10980ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
- CJS dist/index.cjs 27.76 KB
21
- CJS ⚡️ Build success in 1000ms
22
- ESM dist/index.js 27.51 KB
23
- ESM ⚡️ Build success in 1000ms
20
+ ESM dist/index.js 27.82 KB
21
+ ESM ⚡️ Build success in 843ms
22
+ CJS dist/index.cjs 28.07 KB
23
+ CJS ⚡️ Build success in 844ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @mastra/clickhouse
2
2
 
3
+ ## 0.3.2-alpha.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 4155f47: Add parameters to filter workflow runs
8
+ Add fromDate and toDate to telemetry parameters
9
+ - Updated dependencies [967b41c]
10
+ - Updated dependencies [4155f47]
11
+ - Updated dependencies [17826a9]
12
+ - @mastra/core@0.9.2-alpha.3
13
+
14
+ ## 0.3.2-alpha.2
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [26738f4]
19
+ - @mastra/core@0.9.2-alpha.2
20
+
3
21
  ## 0.3.2-alpha.1
4
22
 
5
23
  ### Patch Changes
@@ -45,13 +45,15 @@ declare class ClickhouseStore extends MastraStorage {
45
45
  tableName: TABLE_NAMES;
46
46
  records: Record<string, any>[];
47
47
  }): Promise<void>;
48
- getTraces({ name, scope, page, perPage, attributes, filters, }: {
48
+ getTraces({ name, scope, page, perPage, attributes, filters, fromDate, toDate, }: {
49
49
  name?: string;
50
50
  scope?: string;
51
51
  page: number;
52
52
  perPage: number;
53
53
  attributes?: Record<string, string>;
54
54
  filters?: Record<string, any>;
55
+ fromDate?: Date;
56
+ toDate?: Date;
55
57
  }): Promise<any[]>;
56
58
  optimizeTable({ tableName }: {
57
59
  tableName: TABLE_NAMES;
@@ -45,13 +45,15 @@ declare class ClickhouseStore extends MastraStorage {
45
45
  tableName: TABLE_NAMES;
46
46
  records: Record<string, any>[];
47
47
  }): Promise<void>;
48
- getTraces({ name, scope, page, perPage, attributes, filters, }: {
48
+ getTraces({ name, scope, page, perPage, attributes, filters, fromDate, toDate, }: {
49
49
  name?: string;
50
50
  scope?: string;
51
51
  page: number;
52
52
  perPage: number;
53
53
  attributes?: Record<string, string>;
54
54
  filters?: Record<string, any>;
55
+ fromDate?: Date;
56
+ toDate?: Date;
55
57
  }): Promise<any[]>;
56
58
  optimizeTable({ tableName }: {
57
59
  tableName: TABLE_NAMES;
package/dist/index.cjs CHANGED
@@ -138,7 +138,9 @@ var ClickhouseStore = class extends storage.MastraStorage {
138
138
  page,
139
139
  perPage,
140
140
  attributes,
141
- filters
141
+ filters,
142
+ fromDate,
143
+ toDate
142
144
  }) {
143
145
  const limit = perPage;
144
146
  const offset = page * perPage;
@@ -166,6 +168,14 @@ var ClickhouseStore = class extends storage.MastraStorage {
166
168
  args[`var_col_${key}`] = value;
167
169
  });
168
170
  }
171
+ if (fromDate) {
172
+ conditions.push(`createdAt >= {var_from_date:DateTime64(3)}`);
173
+ args.var_from_date = fromDate.getTime() / 1e3;
174
+ }
175
+ if (toDate) {
176
+ conditions.push(`createdAt <= {var_to_date:DateTime64(3)}`);
177
+ args.var_to_date = toDate.getTime() / 1e3;
178
+ }
169
179
  const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
170
180
  const result = await this.db.query({
171
181
  query: `SELECT *, toDateTime64(createdAt, 3) as createdAt FROM ${storage.TABLE_TRACES} ${whereClause} ORDER BY "createdAt" DESC LIMIT ${limit} OFFSET ${offset}`,
package/dist/index.js CHANGED
@@ -136,7 +136,9 @@ var ClickhouseStore = class extends MastraStorage {
136
136
  page,
137
137
  perPage,
138
138
  attributes,
139
- filters
139
+ filters,
140
+ fromDate,
141
+ toDate
140
142
  }) {
141
143
  const limit = perPage;
142
144
  const offset = page * perPage;
@@ -164,6 +166,14 @@ var ClickhouseStore = class extends MastraStorage {
164
166
  args[`var_col_${key}`] = value;
165
167
  });
166
168
  }
169
+ if (fromDate) {
170
+ conditions.push(`createdAt >= {var_from_date:DateTime64(3)}`);
171
+ args.var_from_date = fromDate.getTime() / 1e3;
172
+ }
173
+ if (toDate) {
174
+ conditions.push(`createdAt <= {var_to_date:DateTime64(3)}`);
175
+ args.var_to_date = toDate.getTime() / 1e3;
176
+ }
167
177
  const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
168
178
  const result = await this.db.query({
169
179
  query: `SELECT *, toDateTime64(createdAt, 3) as createdAt FROM ${TABLE_TRACES} ${whereClause} ORDER BY "createdAt" DESC LIMIT ${limit} OFFSET ${offset}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/clickhouse",
3
- "version": "0.3.2-alpha.1",
3
+ "version": "0.3.2-alpha.3",
4
4
  "description": "Clickhouse provider for Mastra - includes db storage capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
23
  "@clickhouse/client": "^1.11.0",
24
- "@mastra/core": "^0.9.2-alpha.1"
24
+ "@mastra/core": "^0.9.2-alpha.3"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@microsoft/api-extractor": "^7.52.5",
@@ -210,6 +210,8 @@ export class ClickhouseStore extends MastraStorage {
210
210
  perPage,
211
211
  attributes,
212
212
  filters,
213
+ fromDate,
214
+ toDate,
213
215
  }: {
214
216
  name?: string;
215
217
  scope?: string;
@@ -217,6 +219,8 @@ export class ClickhouseStore extends MastraStorage {
217
219
  perPage: number;
218
220
  attributes?: Record<string, string>;
219
221
  filters?: Record<string, any>;
222
+ fromDate?: Date;
223
+ toDate?: Date;
220
224
  }): Promise<any[]> {
221
225
  const limit = perPage;
222
226
  const offset = page * perPage;
@@ -248,6 +252,16 @@ export class ClickhouseStore extends MastraStorage {
248
252
  });
249
253
  }
250
254
 
255
+ if (fromDate) {
256
+ conditions.push(`createdAt >= {var_from_date:DateTime64(3)}`);
257
+ args.var_from_date = fromDate.getTime() / 1000; // Convert to Unix timestamp
258
+ }
259
+
260
+ if (toDate) {
261
+ conditions.push(`createdAt <= {var_to_date:DateTime64(3)}`);
262
+ args.var_to_date = toDate.getTime() / 1000; // Convert to Unix timestamp
263
+ }
264
+
251
265
  const whereClause = conditions.length > 0 ? `WHERE ${conditions.join(' AND ')}` : '';
252
266
 
253
267
  const result = await this.db.query({