@mastra/clickhouse 0.3.5-alpha.0 → 0.10.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.
@@ -1,23 +1,23 @@
1
1
 
2
- > @mastra/clickhouse@0.3.5-alpha.0 build /home/runner/work/mastra/mastra/stores/clickhouse
2
+ > @mastra/clickhouse@0.10.0-alpha.1 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 7673ms
9
+ TSC ⚡️ Build success in 8589ms
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 10881ms
16
+ DTS ⚡️ Build success in 11115ms
17
17
  CLI Cleaning output folder
18
18
  ESM Build start
19
19
  CJS Build start
20
20
  ESM dist/index.js 27.77 KB
21
- ESM ⚡️ Build success in 1010ms
21
+ ESM ⚡️ Build success in 963ms
22
22
  CJS dist/index.cjs 28.01 KB
23
- CJS ⚡️ Build success in 1009ms
23
+ CJS ⚡️ Build success in 986ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,55 @@
1
1
  # @mastra/clickhouse
2
2
 
3
+ ## 0.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 83da932: Move @mastra/core to peerdeps
8
+
9
+ ### Patch Changes
10
+
11
+ - b3a3d63: BREAKING: Make vnext workflow the default worklow, and old workflow legacy_workflow
12
+ - eabdcd9: [MASTRA-3451] SQL Injection Protection
13
+ - Updated dependencies [b3a3d63]
14
+ - Updated dependencies [344f453]
15
+ - Updated dependencies [0a3ae6d]
16
+ - Updated dependencies [95911be]
17
+ - Updated dependencies [f53a6ac]
18
+ - Updated dependencies [5eb5a99]
19
+ - Updated dependencies [7e632c5]
20
+ - Updated dependencies [1e9fbfa]
21
+ - Updated dependencies [eabdcd9]
22
+ - Updated dependencies [90be034]
23
+ - Updated dependencies [99f050a]
24
+ - Updated dependencies [d0ee3c6]
25
+ - Updated dependencies [b2ae5aa]
26
+ - Updated dependencies [23f258c]
27
+ - Updated dependencies [a7292b0]
28
+ - Updated dependencies [0dcb9f0]
29
+ - Updated dependencies [2672a05]
30
+ - @mastra/core@0.10.0
31
+
32
+ ## 0.4.0-alpha.1
33
+
34
+ ### Minor Changes
35
+
36
+ - 83da932: Move @mastra/core to peerdeps
37
+
38
+ ### Patch Changes
39
+
40
+ - b3a3d63: BREAKING: Make vnext workflow the default worklow, and old workflow legacy_workflow
41
+ - Updated dependencies [b3a3d63]
42
+ - Updated dependencies [344f453]
43
+ - Updated dependencies [0a3ae6d]
44
+ - Updated dependencies [95911be]
45
+ - Updated dependencies [5eb5a99]
46
+ - Updated dependencies [7e632c5]
47
+ - Updated dependencies [1e9fbfa]
48
+ - Updated dependencies [b2ae5aa]
49
+ - Updated dependencies [a7292b0]
50
+ - Updated dependencies [0dcb9f0]
51
+ - @mastra/core@0.10.0-alpha.1
52
+
3
53
  ## 0.3.5-alpha.0
4
54
 
5
55
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/clickhouse",
3
- "version": "0.3.5-alpha.0",
3
+ "version": "0.10.0",
4
4
  "description": "Clickhouse provider for Mastra - includes db storage capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -20,8 +20,7 @@
20
20
  },
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
- "@clickhouse/client": "^1.11.0",
24
- "@mastra/core": "^0.9.5-alpha.0"
23
+ "@clickhouse/client": "^1.11.0"
25
24
  },
26
25
  "devDependencies": {
27
26
  "@microsoft/api-extractor": "^7.52.5",
@@ -30,7 +29,11 @@
30
29
  "tsup": "^8.4.0",
31
30
  "typescript": "^5.8.2",
32
31
  "vitest": "^3.1.2",
33
- "@internal/lint": "0.0.5"
32
+ "@internal/lint": "0.0.6",
33
+ "@mastra/core": "0.10.0"
34
+ },
35
+ "peerDependencies": {
36
+ "@mastra/core": "^0.10.0"
34
37
  },
35
38
  "scripts": {
36
39
  "build": "tsup src/index.ts --format esm,cjs --experimental-dts --clean --treeshake=smallest --splitting",
@@ -60,10 +60,7 @@ const createSampleEval = () => ({
60
60
  createdAt: new Date(),
61
61
  });
62
62
 
63
- const createSampleWorkflowSnapshot = (
64
- status: WorkflowRunState['context']['steps'][string]['status'],
65
- createdAt?: Date,
66
- ) => {
63
+ const createSampleWorkflowSnapshot = (status: WorkflowRunState['context']['steps']['status'], createdAt?: Date) => {
67
64
  const runId = `run-${randomUUID()}`;
68
65
  const stepId = `step-${randomUUID()}`;
69
66
  const timestamp = createdAt || new Date();
@@ -71,21 +68,18 @@ const createSampleWorkflowSnapshot = (
71
68
  result: { success: true },
72
69
  value: {},
73
70
  context: {
74
- steps: {
75
- [stepId]: {
76
- status,
77
- payload: {},
78
- error: undefined,
79
- },
71
+ [stepId]: {
72
+ status,
73
+ payload: {},
74
+ error: undefined,
80
75
  },
81
- triggerData: {},
82
- attempts: {},
76
+ input: {},
83
77
  },
84
78
  activePaths: [],
85
79
  suspendedPaths: {},
86
80
  runId,
87
81
  timestamp: timestamp.getTime(),
88
- };
82
+ } as unknown as WorkflowRunState;
89
83
  return { snapshot, runId, stepId };
90
84
  };
91
85
 
@@ -93,7 +87,7 @@ const checkWorkflowSnapshot = (snapshot: WorkflowRunState | string, stepId: stri
93
87
  if (typeof snapshot === 'string') {
94
88
  throw new Error('Expected WorkflowRunState, got string');
95
89
  }
96
- expect(snapshot.context?.steps[stepId]?.status).toBe(status);
90
+ expect(snapshot.context?.[stepId]?.status).toBe(status);
97
91
  };
98
92
 
99
93
  describe('ClickhouseStore', () => {
@@ -371,17 +365,14 @@ describe('ClickhouseStore', () => {
371
365
  const snapshot = {
372
366
  status: 'running',
373
367
  context: {
374
- steps: {},
375
- stepResults: {},
376
- attempts: {},
377
- triggerData: { type: 'manual' },
368
+ input: { type: 'manual' },
378
369
  },
379
370
  value: {},
380
371
  activePaths: [],
381
372
  suspendedPaths: {},
382
373
  runId,
383
374
  timestamp: new Date().getTime(),
384
- };
375
+ } as unknown as WorkflowRunState;
385
376
 
386
377
  await store.persistWorkflowSnapshot({
387
378
  workflowName,
@@ -412,17 +403,14 @@ describe('ClickhouseStore', () => {
412
403
  const initialSnapshot = {
413
404
  status: 'running',
414
405
  context: {
415
- steps: {},
416
- stepResults: {},
417
- attempts: {},
418
- triggerData: { type: 'manual' },
406
+ input: { type: 'manual' },
419
407
  },
420
408
  value: {},
421
409
  activePaths: [],
422
410
  suspendedPaths: {},
423
411
  runId,
424
412
  timestamp: new Date().getTime(),
425
- };
413
+ } as unknown as WorkflowRunState;
426
414
 
427
415
  await store.persistWorkflowSnapshot({
428
416
  workflowName,
@@ -433,19 +421,15 @@ describe('ClickhouseStore', () => {
433
421
  const updatedSnapshot = {
434
422
  status: 'completed',
435
423
  context: {
436
- steps: {},
437
- stepResults: {
438
- 'step-1': { status: 'success', result: { data: 'test' } },
439
- },
440
- attempts: { 'step-1': 1 },
441
- triggerData: { type: 'manual' },
424
+ input: { type: 'manual' },
425
+ 'step-1': { status: 'success', result: { data: 'test' } },
442
426
  },
443
427
  value: {},
444
428
  activePaths: [],
445
429
  suspendedPaths: {},
446
430
  runId,
447
431
  timestamp: new Date().getTime(),
448
- };
432
+ } as unknown as WorkflowRunState;
449
433
 
450
434
  await store.persistWorkflowSnapshot({
451
435
  workflowName,
@@ -467,25 +451,21 @@ describe('ClickhouseStore', () => {
467
451
  const complexSnapshot = {
468
452
  value: { currentState: 'running' },
469
453
  context: {
470
- stepResults: {
471
- 'step-1': {
472
- status: 'success',
473
- result: {
474
- nestedData: {
475
- array: [1, 2, 3],
476
- object: { key: 'value' },
477
- date: new Date().toISOString(),
478
- },
454
+ 'step-1': {
455
+ status: 'success',
456
+ output: {
457
+ nestedData: {
458
+ array: [1, 2, 3],
459
+ object: { key: 'value' },
460
+ date: new Date().toISOString(),
479
461
  },
480
462
  },
481
- 'step-2': {
482
- status: 'waiting',
483
- dependencies: ['step-3', 'step-4'],
484
- },
485
463
  },
486
- steps: {},
487
- attempts: { 'step-1': 1, 'step-2': 0 },
488
- triggerData: {
464
+ 'step-2': {
465
+ status: 'waiting',
466
+ dependencies: ['step-3', 'step-4'],
467
+ },
468
+ input: {
489
469
  type: 'scheduled',
490
470
  metadata: {
491
471
  schedule: '0 0 * * *',
@@ -508,7 +488,7 @@ describe('ClickhouseStore', () => {
508
488
  suspendedPaths: {},
509
489
  runId: runId,
510
490
  timestamp: Date.now(),
511
- };
491
+ } as unknown as WorkflowRunState;
512
492
 
513
493
  await store.persistWorkflowSnapshot({
514
494
  workflowName,
@@ -540,7 +520,7 @@ describe('ClickhouseStore', () => {
540
520
  const workflowName2 = 'default_test_2';
541
521
 
542
522
  const { snapshot: workflow1, runId: runId1, stepId: stepId1 } = createSampleWorkflowSnapshot('success');
543
- const { snapshot: workflow2, runId: runId2, stepId: stepId2 } = createSampleWorkflowSnapshot('waiting');
523
+ const { snapshot: workflow2, runId: runId2, stepId: stepId2 } = createSampleWorkflowSnapshot('suspended');
544
524
 
545
525
  await store.persistWorkflowSnapshot({
546
526
  workflowName: workflowName1,
@@ -561,7 +541,7 @@ describe('ClickhouseStore', () => {
561
541
  expect(runs[1]!.workflowName).toBe(workflowName1);
562
542
  const firstSnapshot = runs[0]!.snapshot;
563
543
  const secondSnapshot = runs[1]!.snapshot;
564
- checkWorkflowSnapshot(firstSnapshot, stepId2, 'waiting');
544
+ checkWorkflowSnapshot(firstSnapshot, stepId2, 'suspended');
565
545
  checkWorkflowSnapshot(secondSnapshot, stepId1, 'success');
566
546
  });
567
547
 
@@ -603,8 +583,8 @@ describe('ClickhouseStore', () => {
603
583
  const workflowName3 = 'date_test_3';
604
584
 
605
585
  const { snapshot: workflow1, runId: runId1 } = createSampleWorkflowSnapshot('success');
606
- const { snapshot: workflow2, runId: runId2, stepId: stepId2 } = createSampleWorkflowSnapshot('waiting');
607
- const { snapshot: workflow3, runId: runId3, stepId: stepId3 } = createSampleWorkflowSnapshot('skipped');
586
+ const { snapshot: workflow2, runId: runId2, stepId: stepId2 } = createSampleWorkflowSnapshot('suspended');
587
+ const { snapshot: workflow3, runId: runId3, stepId: stepId3 } = createSampleWorkflowSnapshot('failed');
608
588
 
609
589
  await store.insert({
610
590
  tableName: TABLE_WORKFLOW_SNAPSHOT,
@@ -647,8 +627,8 @@ describe('ClickhouseStore', () => {
647
627
  expect(runs[1]!.workflowName).toBe(workflowName2);
648
628
  const firstSnapshot = runs[0]!.snapshot;
649
629
  const secondSnapshot = runs[1]!.snapshot;
650
- checkWorkflowSnapshot(firstSnapshot, stepId3, 'skipped');
651
- checkWorkflowSnapshot(secondSnapshot, stepId2, 'waiting');
630
+ checkWorkflowSnapshot(firstSnapshot, stepId3, 'failed');
631
+ checkWorkflowSnapshot(secondSnapshot, stepId2, 'suspended');
652
632
  });
653
633
 
654
634
  it('handles pagination', async () => {
@@ -657,8 +637,8 @@ describe('ClickhouseStore', () => {
657
637
  const workflowName3 = 'page_test_3';
658
638
 
659
639
  const { snapshot: workflow1, runId: runId1, stepId: stepId1 } = createSampleWorkflowSnapshot('success');
660
- const { snapshot: workflow2, runId: runId2, stepId: stepId2 } = createSampleWorkflowSnapshot('waiting');
661
- const { snapshot: workflow3, runId: runId3, stepId: stepId3 } = createSampleWorkflowSnapshot('skipped');
640
+ const { snapshot: workflow2, runId: runId2, stepId: stepId2 } = createSampleWorkflowSnapshot('suspended');
641
+ const { snapshot: workflow3, runId: runId3, stepId: stepId3 } = createSampleWorkflowSnapshot('failed');
662
642
 
663
643
  await store.persistWorkflowSnapshot({
664
644
  workflowName: workflowName1,
@@ -689,8 +669,8 @@ describe('ClickhouseStore', () => {
689
669
  expect(page1.runs[1]!.workflowName).toBe(workflowName2);
690
670
  const firstSnapshot = page1.runs[0]!.snapshot;
691
671
  const secondSnapshot = page1.runs[1]!.snapshot;
692
- checkWorkflowSnapshot(firstSnapshot, stepId3, 'skipped');
693
- checkWorkflowSnapshot(secondSnapshot, stepId2, 'waiting');
672
+ checkWorkflowSnapshot(firstSnapshot, stepId3, 'failed');
673
+ checkWorkflowSnapshot(secondSnapshot, stepId2, 'suspended');
694
674
 
695
675
  // Get second page
696
676
  const page2 = await store.getWorkflowRuns({
@@ -754,7 +734,7 @@ describe('ClickhouseStore', () => {
754
734
  // Insert multiple workflow runs for the same resourceId
755
735
  resourceId = 'resource-shared';
756
736
  for (const status of ['completed', 'running']) {
757
- const sample = createSampleWorkflowSnapshot(status as WorkflowRunState['context']['steps'][string]['status']);
737
+ const sample = createSampleWorkflowSnapshot(status as WorkflowRunState['context']['steps']['status']);
758
738
  runIds.push(sample.runId);
759
739
  await store.insert({
760
740
  tableName: TABLE_WORKFLOW_SNAPSHOT,
@@ -769,7 +749,7 @@ describe('ClickhouseStore', () => {
769
749
  });
770
750
  }
771
751
  // Insert a run with a different resourceId
772
- const other = createSampleWorkflowSnapshot('waiting');
752
+ const other = createSampleWorkflowSnapshot('suspended');
773
753
  await store.insert({
774
754
  tableName: TABLE_WORKFLOW_SNAPSHOT,
775
755
  record: {