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: {