From 3a9e94752d3a93bd4432c34123a02a0ebae338db Mon Sep 17 00:00:00 2001 From: Ronald Ronson Date: Mon, 25 Jul 2022 14:02:13 +0200 Subject: [PATCH 1/3] feat: add query params to getTasks method of entry --- lib/types/entry.types.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/types/entry.types.ts b/lib/types/entry.types.ts index 4bebd4c329..b704fd274b 100644 --- a/lib/types/entry.types.ts +++ b/lib/types/entry.types.ts @@ -12,11 +12,17 @@ export interface TaskInputData { dueDate?: string } +export interface BasicQueryOptions { + skip?: number + limit?: number + [key: string]: any +} + /** Allows accessing the Task API for the current entry. */ export interface TaskAPI { getTask(id: string): Promise - getTasks(): Promise> + getTasks(query: BasicQueryOptions): Promise> createTask(data: TaskInputData): Promise From 51c3dcab6dd7456735b8d507efe34c64be044756 Mon Sep 17 00:00:00 2001 From: Ronald Ronson Date: Mon, 25 Jul 2022 14:05:57 +0200 Subject: [PATCH 2/3] deps: bump contentful-management --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 583d8b0237..3936d5b5ea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "babel-eslint": "10.1.0", "chai": "4.3.6", "chai-as-promised": "7.1.1", - "contentful-management": "10.9.1", + "contentful-management": "10.10.0", "cross-spawn": "7.0.3", "eslint": "7.32.0", "eslint-config-prettier": "8.5.0", @@ -2185,9 +2185,9 @@ "dev": true }, "node_modules/contentful-management": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/contentful-management/-/contentful-management-10.9.1.tgz", - "integrity": "sha512-IwKwMhxvu3fO9Ei1FtaQtvMqjVZc/xb9gFl6Pi155rUQBGUWNn6HL93b2apKCxmO9q1neQ6qgZccFrMtviKnXA==", + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/contentful-management/-/contentful-management-10.10.0.tgz", + "integrity": "sha512-WYOe69K05UVjwRwLNuc2e8Z0f7x8+2V6h06jhNUz4JBHeKsTZWbLfBMjVNj47l7dRLJH4tWloFge65oeBTF2qg==", "dev": true, "dependencies": { "@types/json-patch": "0.0.30", @@ -13583,9 +13583,9 @@ "dev": true }, "contentful-management": { - "version": "10.9.1", - "resolved": "https://registry.npmjs.org/contentful-management/-/contentful-management-10.9.1.tgz", - "integrity": "sha512-IwKwMhxvu3fO9Ei1FtaQtvMqjVZc/xb9gFl6Pi155rUQBGUWNn6HL93b2apKCxmO9q1neQ6qgZccFrMtviKnXA==", + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/contentful-management/-/contentful-management-10.10.0.tgz", + "integrity": "sha512-WYOe69K05UVjwRwLNuc2e8Z0f7x8+2V6h06jhNUz4JBHeKsTZWbLfBMjVNj47l7dRLJH4tWloFge65oeBTF2qg==", "dev": true, "requires": { "@types/json-patch": "0.0.30", diff --git a/package.json b/package.json index 31b4d08b53..0d8ef54f27 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "babel-eslint": "10.1.0", "chai": "4.3.6", "chai-as-promised": "7.1.1", - "contentful-management": "10.9.1", + "contentful-management": "10.10.0", "cross-spawn": "7.0.3", "eslint": "7.32.0", "eslint-config-prettier": "8.5.0", From 545ca508a9518d20748634eb50a476b995725fc3 Mon Sep 17 00:00:00 2001 From: Ronald Ronson Date: Mon, 25 Jul 2022 15:24:57 +0200 Subject: [PATCH 3/3] fix: use SearchQuery --- lib/types/entry.types.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/types/entry.types.ts b/lib/types/entry.types.ts index b704fd274b..3a81341081 100644 --- a/lib/types/entry.types.ts +++ b/lib/types/entry.types.ts @@ -1,6 +1,6 @@ import { Metadata, Task } from './entities' import { EntryFieldAPI } from './field.types' -import { CollectionResponse, ContentEntitySys } from './utils' +import { CollectionResponse, ContentEntitySys, SearchQuery } from './utils' type TaskState = 'active' | 'resolved' @@ -12,17 +12,11 @@ export interface TaskInputData { dueDate?: string } -export interface BasicQueryOptions { - skip?: number - limit?: number - [key: string]: any -} - /** Allows accessing the Task API for the current entry. */ export interface TaskAPI { getTask(id: string): Promise - getTasks(query: BasicQueryOptions): Promise> + getTasks(query: SearchQuery): Promise> createTask(data: TaskInputData): Promise