@webiny/website-builder-sdk 6.5.0-beta.1 → 6.5.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- export declare const GET_PAGE_BY_ID = "\n query GetPageById($id: ID!) {\n websiteBuilder {\n getPageById(id: $id) {\n data {\n id\n properties\n elements\n bindings\n extensions\n languagePaths\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
1
+ export declare const GET_PAGE_BY_ID = "\n query GetPageById($id: ID!) {\n websiteBuilder {\n getPageById(id: $id) {\n data {\n id\n version\n properties\n metadata\n elements\n bindings\n extensions\n languagePaths\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
@@ -4,7 +4,9 @@ const GET_PAGE_BY_ID = `
4
4
  getPageById(id: $id) {
5
5
  data {
6
6
  id
7
+ version
7
8
  properties
9
+ metadata
8
10
  elements
9
11
  bindings
10
12
  extensions
@@ -1 +1 @@
1
- {"version":3,"file":"dataProviders/GET_PAGE_BY_ID.js","sources":["../../src/dataProviders/GET_PAGE_BY_ID.ts"],"sourcesContent":["export const GET_PAGE_BY_ID = /* GraphQL*/ `\n query GetPageById($id: ID!) {\n websiteBuilder {\n getPageById(id: $id) {\n data {\n id\n properties\n elements\n bindings\n extensions\n languagePaths\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"names":["GET_PAGE_BY_ID"],"mappings":"AAAO,MAAMA,iBAA8B,CAAC;;;;;;;;;;;;;;;;;;;;AAoB5C,CAAC"}
1
+ {"version":3,"file":"dataProviders/GET_PAGE_BY_ID.js","sources":["../../src/dataProviders/GET_PAGE_BY_ID.ts"],"sourcesContent":["export const GET_PAGE_BY_ID = /* GraphQL*/ `\n query GetPageById($id: ID!) {\n websiteBuilder {\n getPageById(id: $id) {\n data {\n id\n version\n properties\n metadata\n elements\n bindings\n extensions\n languagePaths\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"names":["GET_PAGE_BY_ID"],"mappings":"AAAO,MAAMA,iBAA8B,CAAC;;;;;;;;;;;;;;;;;;;;;;AAsB5C,CAAC"}
@@ -1 +1 @@
1
- export declare const GET_PAGE_BY_PATH = "\n query GetPageByPath($path: String!) {\n websiteBuilder {\n getPageByPath(path: $path) {\n data {\n id\n properties\n elements\n bindings\n extensions\n languagePaths\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
1
+ export declare const GET_PAGE_BY_PATH = "\n query GetPageByPath($path: String!) {\n websiteBuilder {\n getPageByPath(path: $path) {\n data {\n id\n version\n properties\n metadata\n elements\n bindings\n extensions\n languagePaths\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n";
@@ -4,7 +4,9 @@ const GET_PAGE_BY_PATH = `
4
4
  getPageByPath(path: $path) {
5
5
  data {
6
6
  id
7
+ version
7
8
  properties
9
+ metadata
8
10
  elements
9
11
  bindings
10
12
  extensions
@@ -1 +1 @@
1
- {"version":3,"file":"dataProviders/GET_PAGE_BY_PATH.js","sources":["../../src/dataProviders/GET_PAGE_BY_PATH.ts"],"sourcesContent":["export const GET_PAGE_BY_PATH = /* GraphQL*/ `\n query GetPageByPath($path: String!) {\n websiteBuilder {\n getPageByPath(path: $path) {\n data {\n id\n properties\n elements\n bindings\n extensions\n languagePaths\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"names":["GET_PAGE_BY_PATH"],"mappings":"AAAO,MAAMA,mBAAgC,CAAC;;;;;;;;;;;;;;;;;;;;AAoB9C,CAAC"}
1
+ {"version":3,"file":"dataProviders/GET_PAGE_BY_PATH.js","sources":["../../src/dataProviders/GET_PAGE_BY_PATH.ts"],"sourcesContent":["export const GET_PAGE_BY_PATH = /* GraphQL*/ `\n query GetPageByPath($path: String!) {\n websiteBuilder {\n getPageByPath(path: $path) {\n data {\n id\n version\n properties\n metadata\n elements\n bindings\n extensions\n languagePaths\n }\n error {\n code\n message\n data\n }\n }\n }\n }\n`;\n"],"names":["GET_PAGE_BY_PATH"],"mappings":"AAAO,MAAMA,mBAAgC,CAAC;;;;;;;;;;;;;;;;;;;;;;AAsB9C,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,45 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { GET_PAGE_BY_PATH } from "./GET_PAGE_BY_PATH.js";
3
+ import { GET_PAGE_BY_ID } from "./GET_PAGE_BY_ID.js";
4
+ const getDataSelection = (query)=>{
5
+ const match = query.match(/data\s*\{([^}]*)\}/);
6
+ if (!match) throw new Error("Query has no `data` selection set.");
7
+ return match[1].split("\n").map((line)=>line.trim()).filter(Boolean);
8
+ };
9
+ describe("single-page queries", ()=>{
10
+ it.each([
11
+ [
12
+ "GET_PAGE_BY_PATH",
13
+ GET_PAGE_BY_PATH
14
+ ],
15
+ [
16
+ "GET_PAGE_BY_ID",
17
+ GET_PAGE_BY_ID
18
+ ]
19
+ ])("%s selects metadata", (_name, query)=>{
20
+ expect(getDataSelection(query)).toContain("metadata");
21
+ });
22
+ it.each([
23
+ [
24
+ "GET_PAGE_BY_PATH",
25
+ GET_PAGE_BY_PATH
26
+ ],
27
+ [
28
+ "GET_PAGE_BY_ID",
29
+ GET_PAGE_BY_ID
30
+ ]
31
+ ])("%s selects exactly the expected fields", (_name, query)=>{
32
+ expect(getDataSelection(query)).toEqual([
33
+ "id",
34
+ "version",
35
+ "properties",
36
+ "metadata",
37
+ "elements",
38
+ "bindings",
39
+ "extensions",
40
+ "languagePaths"
41
+ ]);
42
+ });
43
+ });
44
+
45
+ //# sourceMappingURL=queries.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataProviders/queries.test.js","sources":["../../src/dataProviders/queries.test.ts"],"sourcesContent":["import { describe, it, expect } from \"vitest\";\nimport { GET_PAGE_BY_PATH } from \"./GET_PAGE_BY_PATH.js\";\nimport { GET_PAGE_BY_ID } from \"./GET_PAGE_BY_ID.js\";\n\n/**\n * Extracts the fields selected inside the `data { ... }` block of a single-page query.\n * The block is flat (all scalars), so matching up to the first closing brace is enough.\n */\nconst getDataSelection = (query: string): string[] => {\n const match = query.match(/data\\s*\\{([^}]*)\\}/);\n if (!match) {\n throw new Error(\"Query has no `data` selection set.\");\n }\n\n return match[1]\n .split(\"\\n\")\n .map(line => line.trim())\n .filter(Boolean);\n};\n\ndescribe(\"single-page queries\", () => {\n // These assertions exist because a missing `metadata` field previously forced consumers\n // to maintain a Yarn patch against the built SDK. Keep both queries selecting it.\n it.each([\n [\"GET_PAGE_BY_PATH\", GET_PAGE_BY_PATH],\n [\"GET_PAGE_BY_ID\", GET_PAGE_BY_ID]\n ])(\"%s selects metadata\", (_name, query) => {\n expect(getDataSelection(query)).toContain(\"metadata\");\n });\n\n // `PublicPage` also declares `state`, which is not sourced from the API and so is\n // deliberately absent from both queries.\n it.each([\n [\"GET_PAGE_BY_PATH\", GET_PAGE_BY_PATH],\n [\"GET_PAGE_BY_ID\", GET_PAGE_BY_ID]\n ])(\"%s selects exactly the expected fields\", (_name, query) => {\n expect(getDataSelection(query)).toEqual([\n \"id\",\n \"version\",\n \"properties\",\n \"metadata\",\n \"elements\",\n \"bindings\",\n \"extensions\",\n \"languagePaths\"\n ]);\n });\n});\n"],"names":["getDataSelection","query","match","Error","line","Boolean","describe","it","GET_PAGE_BY_PATH","GET_PAGE_BY_ID","_name","expect"],"mappings":";;;AAQA,MAAMA,mBAAmB,CAACC;IACtB,MAAMC,QAAQD,MAAM,KAAK,CAAC;IAC1B,IAAI,CAACC,OACD,MAAM,IAAIC,MAAM;IAGpB,OAAOD,KAAK,CAAC,EAAE,CACV,KAAK,CAAC,MACN,GAAG,CAACE,CAAAA,OAAQA,KAAK,IAAI,IACrB,MAAM,CAACC;AAChB;AAEAC,SAAS,uBAAuB;IAG5BC,GAAG,IAAI,CAAC;QACJ;YAAC;YAAoBC;SAAiB;QACtC;YAAC;YAAkBC;SAAe;KACrC,EAAE,uBAAuB,CAACC,OAAOT;QAC9BU,OAAOX,iBAAiBC,QAAQ,SAAS,CAAC;IAC9C;IAIAM,GAAG,IAAI,CAAC;QACJ;YAAC;YAAoBC;SAAiB;QACtC;YAAC;YAAkBC;SAAe;KACrC,EAAE,0CAA0C,CAACC,OAAOT;QACjDU,OAAOX,iBAAiBC,QAAQ,OAAO,CAAC;YACpC;YACA;YACA;YACA;YACA;YACA;YACA;YACA;SACH;IACL;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/website-builder-sdk",
3
- "version": "6.5.0-beta.1",
3
+ "version": "6.5.0-beta.3",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,7 +12,7 @@
12
12
  "author": "Pavel Denisjuk",
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "@webiny/sdk": "6.5.0-beta.1",
15
+ "@webiny/sdk": "6.5.0-beta.3",
16
16
  "csstype": "3.2.3",
17
17
  "deep-equal": "2.2.3",
18
18
  "deepmerge": "4.3.1",
@@ -30,7 +30,7 @@
30
30
  "devDependencies": {
31
31
  "@types/deep-equal": "1.0.4",
32
32
  "@types/is-hotkey": "0.1.10",
33
- "@webiny/build-tools": "6.5.0-beta.1",
33
+ "@webiny/build-tools": "6.5.0-beta.3",
34
34
  "typescript": "7.0.2",
35
35
  "vitest": "4.1.10"
36
36
  },