diff --git a/lib/adapters/REST/endpoints/concept-scheme.ts b/lib/adapters/REST/endpoints/concept-scheme.ts index 564ff76df..8c5e87c50 100644 --- a/lib/adapters/REST/endpoints/concept-scheme.ts +++ b/lib/adapters/REST/endpoints/concept-scheme.ts @@ -1,7 +1,7 @@ import type { RawAxiosRequestHeaders } from 'axios' import type { AxiosInstance } from 'contentful-sdk-core' -import type { OpPatch } from 'json-patch' import type { + OpPatch, CursorPaginatedCollectionProp, DeleteConceptSchemeParams, GetConceptSchemeParams, diff --git a/lib/adapters/REST/endpoints/concept.ts b/lib/adapters/REST/endpoints/concept.ts index 58c553237..67c229113 100644 --- a/lib/adapters/REST/endpoints/concept.ts +++ b/lib/adapters/REST/endpoints/concept.ts @@ -1,7 +1,7 @@ import type { RawAxiosRequestHeaders } from 'axios' import type { AxiosInstance } from 'contentful-sdk-core' -import type { OpPatch } from 'json-patch' import type { + OpPatch, CursorPaginatedCollectionProp, DeleteConceptParams, GetConceptDescendantsParams, diff --git a/lib/adapters/REST/endpoints/entry.ts b/lib/adapters/REST/endpoints/entry.ts index 5a1e41bf6..10a08af82 100644 --- a/lib/adapters/REST/endpoints/entry.ts +++ b/lib/adapters/REST/endpoints/entry.ts @@ -1,9 +1,9 @@ import type { RawAxiosRequestHeaders } from 'axios' import type { AxiosInstance } from 'contentful-sdk-core' import copy from 'fast-copy' -import type { OpPatch } from 'json-patch' import type { SetOptional } from 'type-fest' import type { + OpPatch, CollectionProp, CreateReleaseEntryParams, CreateWithIdReleaseEntryParams, diff --git a/lib/adapters/REST/endpoints/release-entry.ts b/lib/adapters/REST/endpoints/release-entry.ts index 6ea784a9f..2df59fa18 100644 --- a/lib/adapters/REST/endpoints/release-entry.ts +++ b/lib/adapters/REST/endpoints/release-entry.ts @@ -1,9 +1,9 @@ import type { RawAxiosRequestHeaders } from 'axios' import type { AxiosInstance } from 'contentful-sdk-core' import copy from 'fast-copy' -import type { OpPatch } from 'json-patch' import type { SetOptional } from 'type-fest' import type { + OpPatch, CollectionProp, CreateReleaseEntryParams, CreateWithIdReleaseEntryParams, diff --git a/lib/adapters/REST/make-request.ts b/lib/adapters/REST/make-request.ts index 6e6d599ed..399fd6fac 100644 --- a/lib/adapters/REST/make-request.ts +++ b/lib/adapters/REST/make-request.ts @@ -1,6 +1,5 @@ import type { AxiosInstance } from 'contentful-sdk-core' -import type { MakeRequestOptions, MakeRequestPayload } from '../../common-types' -import type { OpPatch } from 'json-patch' +import type { OpPatch, MakeRequestOptions, MakeRequestPayload } from '../../common-types' import type { RawAxiosRequestHeaders } from 'axios' import endpoints from './endpoints' diff --git a/lib/common-types.ts b/lib/common-types.ts index 2c6efa967..f30b7e230 100644 --- a/lib/common-types.ts +++ b/lib/common-types.ts @@ -909,6 +909,34 @@ export interface Adapter { makeRequest: MakeRequestWithUserAgent } +export type OpPatch = AddPatch | RemovePatch | ReplacePatch | MovePatch | CopyPatch | TestPatch +interface Patch { + path: string +} +interface AddPatch extends Patch { + op: 'add' + value: any +} +interface RemovePatch extends Patch { + op: 'remove' +} +interface ReplacePatch extends Patch { + op: 'replace' + value: any +} +interface MovePatch extends Patch { + op: 'move' + from: string +} +interface CopyPatch extends Patch { + op: 'copy' + from: string +} +interface TestPatch extends Patch { + op: 'test' + value: any +} + /** * @private */ diff --git a/lib/create-entry-api.ts b/lib/create-entry-api.ts index bbc3f8cbe..fadff5636 100644 --- a/lib/create-entry-api.ts +++ b/lib/create-entry-api.ts @@ -1,5 +1,4 @@ -import type { OpPatch } from 'json-patch' -import type { MakeRequest } from './common-types' +import type { MakeRequest, OpPatch } from './common-types' import type { CreateCommentParams, CreateCommentProps } from './entities/comment' import type { Entry, EntryProps, EntryReferenceOptionsProps } from './entities/entry' import type { CreateTaskProps } from './entities/task' diff --git a/lib/plain/common-types.ts b/lib/plain/common-types.ts index 1a98cf55d..817e2d80c 100644 --- a/lib/plain/common-types.ts +++ b/lib/plain/common-types.ts @@ -1,6 +1,6 @@ import type { RawAxiosRequestConfig, RawAxiosRequestHeaders } from 'axios' -import type { OpPatch } from 'json-patch' import type { + OpPatch, BasicCursorPaginationOptions, CollectionProp, CreateReleaseAssetParams, diff --git a/lib/plain/entities/concept-scheme.ts b/lib/plain/entities/concept-scheme.ts index 57b36903e..597fa225c 100644 --- a/lib/plain/entities/concept-scheme.ts +++ b/lib/plain/entities/concept-scheme.ts @@ -1,4 +1,5 @@ import type { + OpPatch, CursorPaginatedCollectionProp, DeleteConceptSchemeParams, GetConceptSchemeParams, @@ -7,7 +8,6 @@ import type { UpdateConceptSchemeParams, } from '../../common-types' import type { ConceptSchemeProps, CreateConceptSchemeProps } from '../../entities/concept-scheme' -import type { OpPatch } from 'json-patch' import type { SetOptional } from 'type-fest' export type ConceptSchemePlainClientAPI = { diff --git a/lib/plain/entities/concept.ts b/lib/plain/entities/concept.ts index 5e2825c23..e96eec4f0 100644 --- a/lib/plain/entities/concept.ts +++ b/lib/plain/entities/concept.ts @@ -1,4 +1,5 @@ import type { + OpPatch, CursorPaginatedCollectionProp, DeleteConceptParams, GetConceptDescendantsParams, @@ -8,7 +9,6 @@ import type { UpdateConceptParams, } from '../../common-types' import type { ConceptProps, CreateConceptProps } from '../../entities/concept' -import type { OpPatch } from 'json-patch' import type { SetOptional } from 'type-fest' export type ConceptPlainClientAPI = { diff --git a/package-lock.json b/package-lock.json index 946998ce1..9e5bcdfd7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,6 @@ "@rollup/plugin-typescript": "^12.3.0", "@semantic-release/changelog": "^6.0.3", "@size-limit/file": "^11.1.6", - "@types/json-patch": "0.0.30", "@types/lodash": "^4.14.168", "@types/node": "^20.12.13", "@vitest/browser": "^2.1.5", @@ -38,7 +37,6 @@ "express": "^4.21.1", "husky": "^9.1.7", "in-publish": "^2.0.1", - "json-patch": "^0.7.0", "jsonwebtoken": "^9.0.2", "lint-staged": "^15.2.5", "lodash": "^4.17.20", @@ -7208,13 +7206,6 @@ "dev": true, "license": "MIT" }, - "node_modules/json-patch": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/json-patch/-/json-patch-0.7.0.tgz", - "integrity": "sha512-9zaGTzsV6Hal5HVMC8kb4niXYQOOcq3tUp0P/GTw6HHZFPVwtCU2+mXE9q59MelL9uknALWnoKrUxnDpUX728g==", - "dev": true, - "license": "BSD" - }, "node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", diff --git a/package.json b/package.json index c21a59e29..88507b3f3 100644 --- a/package.json +++ b/package.json @@ -89,7 +89,6 @@ "@rollup/plugin-typescript": "^12.3.0", "@semantic-release/changelog": "^6.0.3", "@size-limit/file": "^11.1.6", - "@types/json-patch": "0.0.30", "@types/lodash": "^4.14.168", "@types/node": "^20.12.13", "@vitest/browser": "^2.1.5", @@ -100,7 +99,6 @@ "express": "^4.21.1", "husky": "^9.1.7", "in-publish": "^2.0.1", - "json-patch": "^0.7.0", "jsonwebtoken": "^9.0.2", "lint-staged": "^15.2.5", "lodash": "^4.17.20",