diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..e805869 --- /dev/null +++ b/changelog.md @@ -0,0 +1,24 @@ +# Changelog + +## {{nextVersion}} - {{nextVersionMessage}} + +### Changed +- Updated description +- Updated tsconfig +- Updated npmextra.json: githost +- Switched to new org scheme + +## 2.0.0 - BREAKING CHANGE(core): switch to esm + +### Changed +- Switched to ECMAScript modules + +## 1.0.9 - fix(TTL): tables now have a default TTL for data of 1 MONTH + +### Fixed +- Tables now have a default TTL (Time-To-Live) for data of 1 month + +## 1.0.10 - fix(TimDataTable): cleanup + +### Fixed +- Cleaned up TimDataTable configuration \ No newline at end of file diff --git a/license b/license index 191c353..a5b3326 100644 --- a/license +++ b/license @@ -1,4 +1,4 @@ -Copyright (c) 2022 Lossless GmbH (hello@lossless.com) +Copyright (c) 2022 Task Venture Capital GmbH (hello@task.vc) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/test/test.nonci.ts b/test/test.nonci.ts index 7276b05..f972483 100644 --- a/test/test.nonci.ts +++ b/test/test.nonci.ts @@ -72,16 +72,6 @@ tap.test('should delete old entries', async (toolsArg) => { await toolsArg.delayFor(5000); }); -tap.test('should delete the table', async () => { - await table.delete(); - // Verify table deletion - const result = await testClickhouseDb.clickhouseHttpClient.queryPromise(` - SHOW TABLES FROM ${testClickhouseDb.options.database} LIKE '${table.options.tableName}' - `); - console.log('Table exists after deletion:', result); - expect(result.length).toEqual(0); -}); - tap.test('should stream new entries', async (toolsArg) => { const stream = table.watchNewEntries(); const subscription = stream.subscribe((entry) => { @@ -101,4 +91,14 @@ tap.test('should stream new entries', async (toolsArg) => { subscription.unsubscribe(); }); +tap.test('should delete the table', async () => { + await table.delete(); + // Verify table deletion + const result = await testClickhouseDb.clickhouseHttpClient.queryPromise(` + SHOW TABLES FROM ${testClickhouseDb.options.database} LIKE '${table.options.tableName}' + `); + console.log('Table exists after deletion:', result); + expect(result.length).toEqual(0); +}); + export default tap.start(); \ No newline at end of file diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 1a55dd2..7c56985 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -1,8 +1,8 @@ /** - * autocreated commitinfo by @pushrocks/commitinfo + * autocreated commitinfo by @push.rocks/commitinfo */ export const commitinfo = { name: '@push.rocks/smartclickhouse', - version: '2.0.17', + version: '2.0.18', description: 'A TypeScript-based ODM for ClickHouse databases that supports creating, managing, and querying tables with a focus on handling time-series data.' } diff --git a/ts/smartclickhouse.classes.timedatatable.ts b/ts/smartclickhouse.classes.timedatatable.ts index a15073e..ed456cd 100644 --- a/ts/smartclickhouse.classes.timedatatable.ts +++ b/ts/smartclickhouse.classes.timedatatable.ts @@ -270,6 +270,7 @@ export class TimeDataTable { return new plugins.smartrx.rxjs.Observable((observer) => { const pollInterval = 1000; // Poll every 1 second let lastTimestamp: number; + let intervalId: NodeJS.Timeout; const fetchLastEntryTimestamp = async () => { const lastEntry = await this.smartClickHouseDbRef.clickhouseHttpClient.queryPromise(` @@ -292,13 +293,13 @@ export class TimeDataTable { const startPolling = async () => { await fetchLastEntryTimestamp(); - const intervalId = setInterval(fetchNewEntries, pollInterval); - - // Cleanup on unsubscribe - return () => clearInterval(intervalId); + intervalId = setInterval(fetchNewEntries, pollInterval); }; startPolling().catch((err) => observer.error(err)); + + // Cleanup on unsubscribe + return () => clearInterval(intervalId); }); } }