From 603f23da083e5d0b138f1b1b6bc64cb1972516f2 Mon Sep 17 00:00:00 2001 From: Daniel Chambers Date: Mon, 26 Aug 2024 15:24:28 +1000 Subject: [PATCH 1/3] Updated to NDC v0.1.6 --- Cargo.lock | 4 +-- src/schema/schema.generated.json | 59 +++++++++++++++++++++++++++++++- src/schema/schema.generated.ts | 23 ++++++++++++- src/schema/version.generated.ts | 2 +- typegen/Cargo.toml | 2 +- 5 files changed, 84 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ddb7426..544395b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -238,8 +238,8 @@ checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "ndc-models" -version = "0.1.5" -source = "git+http://github.com/hasura/ndc-spec.git?tag=v0.1.5#78f52768bd02a8289194078a5abc2432c8e3a758" +version = "0.1.6" +source = "git+http://github.com/hasura/ndc-spec.git?tag=v0.1.6#d1be19e9cdd86ac7b6ad003ff82b7e5b4e96b84f" dependencies = [ "indexmap 2.2.6", "ref-cast", diff --git a/src/schema/schema.generated.json b/src/schema/schema.generated.json index 95ce4f4..a2e9c36 100644 --- a/src/schema/schema.generated.json +++ b/src/schema/schema.generated.json @@ -131,6 +131,15 @@ "$ref": "#/definitions/NestedFieldCapabilities" } ] + }, + "exists": { + "description": "Does the connector support EXISTS predicates", + "default": {}, + "allOf": [ + { + "$ref": "#/definitions/ExistsCapabilities" + } + ] } } }, @@ -177,6 +186,23 @@ } } }, + "ExistsCapabilities": { + "title": "Exists Capabilities", + "type": "object", + "properties": { + "nested_collections": { + "description": "Does the connector support ExistsInCollection::NestedCollection", + "anyOf": [ + { + "$ref": "#/definitions/LeafCapability" + }, + { + "type": "null" + } + ] + } + } + }, "MutationCapabilities": { "title": "Mutation Capabilities", "type": "object", @@ -684,7 +710,7 @@ ] }, "name": { - "description": "The name can refer to a primitive type or a scalar type", + "description": "The name can refer to a scalar or object type", "type": "string" } } @@ -1983,6 +2009,37 @@ } } } + }, + { + "type": "object", + "required": [ + "column_name", + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "nested_collection" + ] + }, + "column_name": { + "type": "string" + }, + "arguments": { + "type": "object", + "additionalProperties": { + "$ref": "#/definitions/Argument" + } + }, + "field_path": { + "description": "Path to a nested collection via object columns", + "type": "array", + "items": { + "type": "string" + } + } + } } ] }, diff --git a/src/schema/schema.generated.ts b/src/schema/schema.generated.ts index 9e70f03..965340a 100644 --- a/src/schema/schema.generated.ts +++ b/src/schema/schema.generated.ts @@ -82,7 +82,7 @@ export type Type = | { type: "named"; /** - * The name can refer to a primitive type or a scalar type + * The name can refer to a scalar or object type */ name: string; } @@ -343,6 +343,17 @@ export type ExistsInCollection = arguments: { [k: string]: RelationshipArgument; }; + } + | { + type: "nested_collection"; + column_name: string; + arguments?: { + [k: string]: Argument; + }; + /** + * Path to a nested collection via object columns + */ + field_path?: string[]; }; export type RelationshipType = "object" | "array"; /** @@ -411,6 +422,10 @@ export interface QueryCapabilities { * Does the connector support nested fields */ nested_fields?: NestedFieldCapabilities; + /** + * Does the connector support EXISTS predicates + */ + exists?: ExistsCapabilities; } /** * A unit value to indicate a particular leaf capability is supported. This is an empty struct to allow for future sub-capabilities. @@ -430,6 +445,12 @@ export interface NestedFieldCapabilities { */ aggregates?: LeafCapability | null; } +export interface ExistsCapabilities { + /** + * Does the connector support ExistsInCollection::NestedCollection + */ + nested_collections?: LeafCapability | null; +} export interface MutationCapabilities { /** * Does the connector support executing multiple mutations in a transaction. diff --git a/src/schema/version.generated.ts b/src/schema/version.generated.ts index a38e38f..f98b03c 100644 --- a/src/schema/version.generated.ts +++ b/src/schema/version.generated.ts @@ -1 +1 @@ -export const VERSION = "0.1.5"; +export const VERSION = "0.1.6"; diff --git a/typegen/Cargo.toml b/typegen/Cargo.toml index d0006e5..6ca3a01 100644 --- a/typegen/Cargo.toml +++ b/typegen/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ndc-models = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.5" } +ndc-models = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.6" } schemars = "0.8.15" serde = "^1.0" serde_json = "1.0.107" From 94a39ebf740380bcd4b1a6fe852f43fe904af0ef Mon Sep 17 00:00:00 2001 From: Daniel Chambers Date: Mon, 26 Aug 2024 15:27:53 +1000 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c72a0a..18a21e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # NDC TypeScript SDK Changelog +## [6.1.0] - 2024-08-26 +- Updated to support [v0.1.6 of the NDC Spec](https://hasura.github.io/ndc-spec/specification/changelog.html#016) ([#37](https://github.com/hasura/ndc-sdk-typescript/pull/37)) + - Support for [querying nested collections](https://hasura.github.io/ndc-spec/specification/queries/filtering.html#nested-collections) inside an EXISTS expression in a predicate + ## [6.0.0] - 2024-08-08 Breaking changes ([#36](https://github.com/hasura/ndc-sdk-typescript/pull/36)): - `Connector.healthCheck` has been removed and replaced with `Connector.getHealthReadiness`, which only returns whether the connector is able to accept requests, not whether any underlying connections to data sources actually work. From 92feb7fc52f68726624bb9d37604ef3a3c9c8729 Mon Sep 17 00:00:00 2001 From: Daniel Chambers Date: Mon, 26 Aug 2024 15:28:06 +1000 Subject: [PATCH 3/3] Update package version to v6.1.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4fef3dc..3ee5a00 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@hasura/ndc-sdk-typescript", - "version": "6.0.0", + "version": "6.1.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@hasura/ndc-sdk-typescript", - "version": "6.0.0", + "version": "6.1.0", "license": "Apache-2.0", "dependencies": { "@json-schema-tools/meta-schema": "^1.7.0", diff --git a/package.json b/package.json index 41cd701..22d732f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hasura/ndc-sdk-typescript", - "version": "6.0.0", + "version": "6.1.0", "description": "", "main": "./dist/index.js", "types": "./dist/index.d.ts",