Skip to content

Commit

Permalink
Merge branch 'master' into lg/text-in-links
Browse files Browse the repository at this point in the history
  • Loading branch information
levimykel committed Aug 27, 2024
2 parents 000f146 + 601edd5 commit 68ff687
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 116 deletions.
19 changes: 13 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,31 @@

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.9.0-alpha.2](https://github.com/prismicio/prismic-client/compare/v7.9.0-alpha.1...v7.9.0-alpha.2) (2024-08-27)
## [7.9.0-alpha.1](https://github.com/prismicio/prismic-client/compare/v7.9.0-alpha.0...v7.9.0-alpha.1) (2024-08-27)


### Features

* use KeyTextField for link text value definition ([1a4c51a](https://github.com/prismicio/prismic-client/commit/1a4c51a389ed4d06cf69c3edcb215559ba91fe99))


### Chore

* revert previous changes ([c53de86](https://github.com/prismicio/prismic-client/commit/c53de86a7ed749f0f9d8999b9e58564d9a8efe35))
* remove changelog for alpha ([50fc797](https://github.com/prismicio/prismic-client/commit/50fc797372726c0abc575b9f1b0a56d5db939bb1))

## [7.9.0-alpha.1](https://github.com/prismicio/prismic-client/compare/v7.9.0-alpha.0...v7.9.0-alpha.1) (2024-08-27)
### [7.8.1](https://github.com/prismicio/prismic-client/compare/v7.8.0...v7.8.1) (2024-08-27)


### Features
### Bug Fixes

* use KeyTextField for link text value definition ([1a4c51a](https://github.com/prismicio/prismic-client/commit/1a4c51a389ed4d06cf69c3edcb215559ba91fe99))
* add missing `is_master` property on repository type ([0289698](https://github.com/prismicio/prismic-client/commit/0289698cc9ca7ed5b264f71f2a9f8d39e3710058))

## [7.9.0-alpha.2](https://github.com/prismicio/prismic-client/compare/v7.9.0-alpha.1...v7.9.0-alpha.2) (2024-08-27)


### Chore

* remove changelog for alpha ([50fc797](https://github.com/prismicio/prismic-client/commit/50fc797372726c0abc575b9f1b0a56d5db939bb1))
* revert previous changes ([c53de86](https://github.com/prismicio/prismic-client/commit/c53de86a7ed749f0f9d8999b9e58564d9a8efe35))

## [7.8.0](https://github.com/prismicio/prismic-client/compare/v7.7.4...v7.8.0) (2024-08-01)

Expand Down
44 changes: 5 additions & 39 deletions package-lock.json

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

5 changes: 5 additions & 0 deletions src/types/api/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

/**
Expand Down
14 changes: 2 additions & 12 deletions test/helpers-isFilled.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down Expand Up @@ -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) => {
Expand Down
87 changes: 29 additions & 58 deletions test/helpers-mapSliceZone.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand All @@ -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 },
Expand All @@ -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" },
Expand All @@ -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" },
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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" },
Expand All @@ -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 },
Expand Down
1 change: 1 addition & 0 deletions test/types/api-language.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ import type * as prismic from "../../src"
expectType<prismic.Language>({
id: "string",
name: "string",
is_master: true,
})
2 changes: 1 addition & 1 deletion test/types/api-repository.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ expectType<prismic.Repository>({
},
],
integrationFieldsRef: "string",
languages: [{ id: "string", name: "string" }],
languages: [{ id: "string", name: "string", is_master: true }],
types: { foo: "string" },
tags: ["string"],
forms: {
Expand Down

0 comments on commit 68ff687

Please sign in to comment.