From 0289698cc9ca7ed5b264f71f2a9f8d39e3710058 Mon Sep 17 00:00:00 2001 From: lihbr Date: Tue, 27 Aug 2024 14:37:58 +0200 Subject: [PATCH 1/3] fix: add missing `is_master` property on repository type --- package-lock.json | 44 ++------------- src/types/api/repository.ts | 5 ++ test/helpers-isFilled.test.ts | 14 +---- test/helpers-mapSliceZone.test.ts | 87 ++++++++++-------------------- test/types/api-language.types.ts | 1 + test/types/api-repository.types.ts | 2 +- 6 files changed, 43 insertions(+), 110 deletions(-) diff --git a/package-lock.json b/package-lock.json index 407e3ca2..723e82e3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1198,30 +1198,19 @@ } }, "node_modules/@prismicio/client": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/@prismicio/client/-/client-7.2.0.tgz", - "integrity": "sha512-bfbs2ZMLd3ba7Bp1qI4qAz+13FIWE/JDT9+h+3hL/MVpK4iDpjz3vmOlYJs25myhryU9HP8Og7qKoaeE9hPzmA==", + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@prismicio/client/-/client-7.8.0.tgz", + "integrity": "sha512-Jv0F5+GCq5ADgdDTZNO6aw/WQp6bkGbg20YuAwSFfihEoG6gAnrMsv2VwSGdW/2QT7TFfa+ezJ+9u2+2Y1mXoQ==", "dev": true, + "license": "Apache-2.0", "peer": true, "dependencies": { - "@prismicio/richtext": "^2.1.5", - "imgix-url-builder": "^0.0.4" + "imgix-url-builder": "^0.0.5" }, "engines": { "node": ">=14.15.0" } }, - "node_modules/@prismicio/client/node_modules/imgix-url-builder": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/imgix-url-builder/-/imgix-url-builder-0.0.4.tgz", - "integrity": "sha512-JRLydfxGTTbSSOG82ewuCgnmw/CzIPzoDqpP3UYD7RE+QWS8ZZbpF87ZuRqtcbEKdxahRsExinuKRxPZVvukWA==", - "dev": true, - "license": "Apache-2.0", - "peer": true, - "engines": { - "node": ">=12.7.0" - } - }, "node_modules/@prismicio/mock": { "version": "0.3.7", "resolved": "https://registry.npmjs.org/@prismicio/mock/-/mock-0.3.7.tgz", @@ -1238,29 +1227,6 @@ "@prismicio/client": "^7" } }, - "node_modules/@prismicio/richtext": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@prismicio/richtext/-/richtext-2.1.5.tgz", - "integrity": "sha512-Sf6iCsciPmfK3uQeFmeY9RTRSuhrCVzyU39OkiJ1VJn8O0531pKapGoWS+5WGxouJtE5+jGqV8L+L2mKP7NkXQ==", - "dev": true, - "peer": true, - "dependencies": { - "@prismicio/types": "^0.2.7" - }, - "engines": { - "node": ">=12.7.0" - } - }, - "node_modules/@prismicio/types": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/@prismicio/types/-/types-0.2.8.tgz", - "integrity": "sha512-EmuYYil56U+UtEifMD/9TmLzpWliV+X6kypwPq47GNXmIXyFK1JsP3z872fUziXwoBjd2YILj28DNdYXlLOpXg==", - "dev": true, - "peer": true, - "engines": { - "node": ">=12.7.0" - } - }, "node_modules/@prismicio/types-internal": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/@prismicio/types-internal/-/types-internal-2.6.0.tgz", diff --git a/src/types/api/repository.ts b/src/types/api/repository.ts index aeec2033..dcd0485c 100644 --- a/src/types/api/repository.ts +++ b/src/types/api/repository.ts @@ -91,6 +91,11 @@ export interface Language { * The name of the language. */ name: string + + /** + * Whether or not the language is the default language of the repository. + */ + is_master: boolean } /** diff --git a/test/helpers-isFilled.test.ts b/test/helpers-isFilled.test.ts index 75970667..4f7b7fcf 100644 --- a/test/helpers-isFilled.test.ts +++ b/test/helpers-isFilled.test.ts @@ -61,12 +61,7 @@ it("image", (ctx) => { expect(isFilled.image(null)).toBe(false) expect(isFilled.image(undefined)).toBe(false) expect(isFilled.image({})).toBe(false) - expect( - isFilled.image( - // @ts-expect-error Remove this comment after v7.3.0 is published. - ctx.mock.value.image(), - ), - ).toBe(true) + expect(isFilled.image(ctx.mock.value.image())).toBe(true) }) it("image thumbnail", () => { @@ -137,12 +132,7 @@ it("rich text", (ctx) => { expect(isFilled.richText([{ type: "paragraph", text: "", spans: [] }])).toBe( false, ) - expect( - isFilled.richText( - // @ts-expect-error Remove this comment after v7.3.0 is published. - ctx.mock.value.richText(), - ), - ).toBe(true) + expect(isFilled.richText(ctx.mock.value.richText())).toBe(true) }) it("select", (ctx) => { diff --git a/test/helpers-mapSliceZone.test.ts b/test/helpers-mapSliceZone.test.ts index b431d300..f7b71b24 100644 --- a/test/helpers-mapSliceZone.test.ts +++ b/test/helpers-mapSliceZone.test.ts @@ -36,14 +36,10 @@ const generateTestData = (ctx: TestContext) => { it("maps a Slice Zone", async (ctx) => { const { sliceZone, model1, model2 } = generateTestData(ctx) - const actual = await mapSliceZone( - // @ts-expect-error Remove this comment after v7.3.0 is published. - sliceZone, - { - [model1.id]: () => ({ foo: "bar" }), - [model2.id]: () => ({ baz: "qux" }), - }, - ) + const actual = await mapSliceZone(sliceZone, { + [model1.id]: () => ({ foo: "bar" }), + [model2.id]: () => ({ baz: "qux" }), + }) expect(actual).toStrictEqual([ { __mapped: true, id: undefined, slice_type: model1.id, foo: "bar" }, @@ -54,14 +50,10 @@ it("maps a Slice Zone", async (ctx) => { it("supports mapping functions that return undefined", async (ctx) => { const { sliceZone, model1, model2 } = generateTestData(ctx) - const actual = await mapSliceZone( - // @ts-expect-error Remove this comment after v7.3.0 is published. - sliceZone, - { - [model1.id]: () => void 0, - [model2.id]: () => void 0, - }, - ) + const actual = await mapSliceZone(sliceZone, { + [model1.id]: () => void 0, + [model2.id]: () => void 0, + }) expect(actual).toStrictEqual([ { __mapped: true, id: undefined, slice_type: model1.id }, @@ -72,14 +64,10 @@ it("supports mapping functions that return undefined", async (ctx) => { it("supports async mapping functions", async (ctx) => { const { sliceZone, model1, model2 } = generateTestData(ctx) - const actual = await mapSliceZone( - // @ts-expect-error Remove this comment after v7.3.0 is published. - sliceZone, - { - [model1.id]: async () => ({ foo: "bar" }), - [model2.id]: async () => ({ baz: "qux" }), - }, - ) + const actual = await mapSliceZone(sliceZone, { + [model1.id]: async () => ({ foo: "bar" }), + [model2.id]: async () => ({ baz: "qux" }), + }) expect(actual).toStrictEqual([ { __mapped: true, id: undefined, slice_type: model1.id, foo: "bar" }, @@ -90,14 +78,10 @@ it("supports async mapping functions", async (ctx) => { it("supports overriding id and slice_type properties", async (ctx) => { const { sliceZone, model1, model2 } = generateTestData(ctx) - const actual = await mapSliceZone( - // @ts-expect-error Remove this comment after v7.3.0 is published. - sliceZone, - { - [model1.id]: async () => ({ id: "foo", slice_type: "bar" }), - [model2.id]: async () => ({ id: "baz", slice_type: "qux" }), - }, - ) + const actual = await mapSliceZone(sliceZone, { + [model1.id]: async () => ({ id: "foo", slice_type: "bar" }), + [model2.id]: async () => ({ id: "baz", slice_type: "qux" }), + }) expect(actual).toStrictEqual([ { __mapped: true, id: "foo", slice_type: "bar" }, @@ -111,14 +95,10 @@ it("provides Slice data to mapping functions", async (ctx) => { const mapper1 = vi.fn() const mapper2 = vi.fn() - await mapSliceZone( - // @ts-expect-error Remove this comment after v7.3.0 is published. - sliceZone, - { - [model1.id]: mapper1, - [model2.id]: mapper2, - }, - ) + await mapSliceZone(sliceZone, { + [model1.id]: mapper1, + [model2.id]: mapper2, + }) expect(mapper1).toHaveBeenCalledWith({ context: undefined, @@ -143,7 +123,6 @@ it("supports context", async (ctx) => { const context = { foo: "bar" } await mapSliceZone( - // @ts-expect-error Remove this comment after v7.3.0 is published. sliceZone, { [model1.id]: mapper1, @@ -169,16 +148,12 @@ it("supports context", async (ctx) => { it("supports lazy-loaded mapping functions", async (ctx) => { const { sliceZone, model1, model2 } = generateTestData(ctx) - const actual = await mapSliceZone( - // @ts-expect-error Remove this comment after v7.3.0 is published. - sliceZone, - { - // Simulates `import()` with a named `default` export. - [model1.id]: async () => ({ default: () => ({ foo: "bar" }) }), - // Simulates `import()` with a default export. - [model2.id]: async () => () => ({ baz: "qux" }), - }, - ) + const actual = await mapSliceZone(sliceZone, { + // Simulates `import()` with a named `default` export. + [model1.id]: async () => ({ default: () => ({ foo: "bar" }) }), + // Simulates `import()` with a default export. + [model2.id]: async () => () => ({ baz: "qux" }), + }) expect(actual).toStrictEqual([ { __mapped: true, id: undefined, slice_type: model1.id, foo: "bar" }, @@ -189,13 +164,9 @@ it("supports lazy-loaded mapping functions", async (ctx) => { it("skips Slices without a mapping function", async (ctx) => { const { sliceZone, model1 } = generateTestData(ctx) - const actual = await mapSliceZone( - // @ts-expect-error Remove this comment after v7.3.0 is published. - sliceZone, - { - [model1.id]: () => void 0, - }, - ) + const actual = await mapSliceZone(sliceZone, { + [model1.id]: () => void 0, + }) expect(actual).toStrictEqual([ { __mapped: true, id: undefined, slice_type: model1.id }, diff --git a/test/types/api-language.types.ts b/test/types/api-language.types.ts index c58beb45..a36a0836 100644 --- a/test/types/api-language.types.ts +++ b/test/types/api-language.types.ts @@ -21,4 +21,5 @@ import type * as prismic from "../../src" expectType({ id: "string", name: "string", + is_master: true, }) diff --git a/test/types/api-repository.types.ts b/test/types/api-repository.types.ts index 24fd1794..fb064fe7 100644 --- a/test/types/api-repository.types.ts +++ b/test/types/api-repository.types.ts @@ -29,7 +29,7 @@ expectType({ }, ], integrationFieldsRef: "string", - languages: [{ id: "string", name: "string" }], + languages: [{ id: "string", name: "string", is_master: true }], types: { foo: "string" }, tags: ["string"], forms: { From 57fd3025e46ad0a7911396396cde04a9e5c6a00b Mon Sep 17 00:00:00 2001 From: lihbr Date: Tue, 27 Aug 2024 14:39:53 +0200 Subject: [PATCH 2/3] chore(release): 7.8.1 --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2fab63e..ac4b8858 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +### [7.8.1](https://github.com/prismicio/prismic-client/compare/v7.8.0...v7.8.1) (2024-08-27) + + +### Bug Fixes + +* add missing `is_master` property on repository type ([0289698](https://github.com/prismicio/prismic-client/commit/0289698cc9ca7ed5b264f71f2a9f8d39e3710058)) + ## [7.8.0](https://github.com/prismicio/prismic-client/compare/v7.7.4...v7.8.0) (2024-08-01) diff --git a/package-lock.json b/package-lock.json index 723e82e3..85e03620 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@prismicio/client", - "version": "7.8.0", + "version": "7.8.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@prismicio/client", - "version": "7.8.0", + "version": "7.8.1", "license": "Apache-2.0", "dependencies": { "imgix-url-builder": "^0.0.5" diff --git a/package.json b/package.json index 53f906f7..e049548b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@prismicio/client", - "version": "7.8.0", + "version": "7.8.1", "description": "The official JavaScript + TypeScript client library for Prismic", "keywords": [ "typescript", From 601edd55ed2594010da740f3f40250a7f517cf5c Mon Sep 17 00:00:00 2001 From: lihbr Date: Tue, 27 Aug 2024 14:41:33 +0200 Subject: [PATCH 3/3] chore(deps): maintain lock file --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 85e03620..cf16c921 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1198,9 +1198,9 @@ } }, "node_modules/@prismicio/client": { - "version": "7.8.0", - "resolved": "https://registry.npmjs.org/@prismicio/client/-/client-7.8.0.tgz", - "integrity": "sha512-Jv0F5+GCq5ADgdDTZNO6aw/WQp6bkGbg20YuAwSFfihEoG6gAnrMsv2VwSGdW/2QT7TFfa+ezJ+9u2+2Y1mXoQ==", + "version": "7.8.1", + "resolved": "https://registry.npmjs.org/@prismicio/client/-/client-7.8.1.tgz", + "integrity": "sha512-L1pwiBHy4X2KB4ayliTbTB6wbgRDkspyQ+R/czVqNON9R5cU1pAHxSxK8/GVbukKrEHNAaZHlAfOT3rzSJJGBw==", "dev": true, "license": "Apache-2.0", "peer": true,