Skip to content

Commit

Permalink
Merge pull request #4 from hasura/daniel/by-pk-query
Browse files Browse the repository at this point in the history
Query by primary key support
  • Loading branch information
daniel-chambers authored Nov 22, 2023
2 parents 8225369 + 9b7b645 commit e3534b7
Show file tree
Hide file tree
Showing 10 changed files with 733 additions and 115 deletions.
3 changes: 2 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
"dependencies": {
"@aws-sdk/client-dynamodb": "^3.427.0",
"@hasura/ndc-sdk-typescript": "^1.1.0"
"@hasura/ndc-sdk-typescript": "^1.1.0",
"@smithy/util-base64": "^2.0.0"
},
"devDependencies": {
"@tsconfig/node18": "^18.2.2",
Expand Down
17 changes: 3 additions & 14 deletions src/configuration-schema.generated.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"type": "string"
},
"dynamoType": {
"$ref": "#/definitions/DynamoAttributeType"
"$ref": "#/definitions/DynamoType"
},
"name": {
"type": "string"
Expand Down Expand Up @@ -73,7 +73,7 @@
],
"type": "object"
},
"DynamoAttributeType": {
"DynamoType": {
"enum": [
"S",
"N",
Expand Down Expand Up @@ -161,18 +161,7 @@
"additionalProperties": false,
"properties": {
"indexName": {
"additionalProperties": {
"type": "string"
},
"properties": {
"length": {
"type": "number"
}
},
"required": [
"length"
],
"type": "object"
"type": "string"
},
"keySchema": {
"$ref": "#/definitions/KeySchema"
Expand Down
5 changes: 3 additions & 2 deletions src/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { Configuration, configurationSchema, makeEmptyConfiguration, updateConfiguration } from "./configuration";
import { ConnectorSchema, createSchema } from "./schema-ndc";
import { Err, Ok } from "./result";
import { performQuery } from "./query";


type State = {
Expand Down Expand Up @@ -56,8 +57,8 @@ export const connector: Connector<Configuration, State> = {
throw new BadRequest("Schema's busted, yo", result.error)
}
},
query: function (configuration: Configuration, state: State, request: QueryRequest): Promise<QueryResponse> {
throw new Error("Function not implemented.");
query: async function (configuration: Configuration, state: State, request: QueryRequest): Promise<QueryResponse> {
return await performQuery(request, state.schema, state.dynamodbClient);
},
explain: function (configuration: Configuration, state: State, request: QueryRequest): Promise<ExplainResponse> {
throw new Error("Function not implemented.");
Expand Down
Loading

0 comments on commit e3534b7

Please sign in to comment.