From 4211c15a8c115eecd86821af9aeca9b28506e508 Mon Sep 17 00:00:00 2001 From: Sasa Pettyjohn Date: Fri, 23 Jan 2026 11:09:29 -0600 Subject: [PATCH 1/3] add types for continuous aggregates based on docs --- types/index.d.ts | 60 +++++++++++++++++++++++++++++++++++++++++++++ types/tsconfig.json | 2 +- 2 files changed, 61 insertions(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 239911a..5ae3a7b 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -867,8 +867,68 @@ declare namespace CbServer { changes: Partial, uniquelyIndexedColumn: string ): Promise>>; + createContinuousAggregate( + query: string, + options: ContinuousAggregateOptions, + ): Promise; + fetchAggregate( + aggregateName: string, + query: Query, + ): Promise; + fetchAggregateRaw( + aggregateName: string, + query: string, + ): Promise>>; + dropContinuousAggregate(aggregateName: string): Promise; + } + + /** + * Must be of one of the following forms: + * - "1 second", "1 hour", "1 day", "1 month", "1 year" + * - "X seconds", "X hours", "X days", "X months", "X years" where X > 1 + */ + type TimescaleInterval = + | "1 second" + | "1 hour" + | "1 day" + | "1 month" + | "1 year" + | `${number} seconds` + | `${number} hours` + | `${number} days` + | `${number} months` + | `${number} years`; + + interface ContinuousAggregateOptions { + /** + * The name of the continuous aggregate + */ + view_name: string; + /** + * The offset from the current date to begin aggregating data (Ex. "1 month") + */ + start_offset: TimescaleInterval; + /** + * The offset from the current date to stop aggregating data (Ex. "12 hours") + */ + end_offset: TimescaleInterval; + /** + * The interval at which to recompute the continuous aggregate (Ex. "1 hour") + */ + schedule_interval: TimescaleInterval; + /** + * If set to true, the aggregate will be created without initially calculating the aggregate value + */ + with_no_data: boolean; } + /** + * The results of a database query. Can be directly indexed or call `stream` to access the data as a `ReadableStream` + */ + type AggregateResult = Array> & { + stream: () => ReadableStream; + }; + interface CustomSyncAsync { Platform: string; AllEdges: string; diff --git a/types/tsconfig.json b/types/tsconfig.json index fef8d2c..0c782ed 100644 --- a/types/tsconfig.json +++ b/types/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es6"], + "lib": ["es6", "dom"], "noImplicitAny": true, "noImplicitThis": true, "strictFunctionTypes": true, From 97ae7b311c4ec722e9db9918a33bb85ccf251ed5 Mon Sep 17 00:00:00 2001 From: Sasa Pettyjohn Date: Fri, 23 Jan 2026 11:14:02 -0600 Subject: [PATCH 2/3] increment version for release --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8b801e3..690de66 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@clearblade/code-service-types", - "version": "3.12.7", + "version": "3.12.8", "description": "TypeScript declarations for the ClearBlade Code Service engine", "main": "index.d.ts", "scripts": { From 237449195c881220774254135f63a6a18121dd0e Mon Sep 17 00:00:00 2001 From: Sasa Pettyjohn Date: Fri, 30 Jan 2026 11:38:30 -0600 Subject: [PATCH 3/3] remove support for types of fetchaggregate because of pipeline failure --- types/index.d.ts | 11 ----------- types/tsconfig.json | 2 +- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 5ae3a7b..56e6a23 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -871,10 +871,6 @@ declare namespace CbServer { query: string, options: ContinuousAggregateOptions, ): Promise; - fetchAggregate( - aggregateName: string, - query: Query, - ): Promise; fetchAggregateRaw( aggregateName: string, query: string, @@ -922,13 +918,6 @@ declare namespace CbServer { with_no_data: boolean; } - /** - * The results of a database query. Can be directly indexed or call `stream` to access the data as a `ReadableStream` - */ - type AggregateResult = Array> & { - stream: () => ReadableStream; - }; - interface CustomSyncAsync { Platform: string; AllEdges: string; diff --git a/types/tsconfig.json b/types/tsconfig.json index 0c782ed..fef8d2c 100644 --- a/types/tsconfig.json +++ b/types/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es6", "dom"], + "lib": ["es6"], "noImplicitAny": true, "noImplicitThis": true, "strictFunctionTypes": true,