@webiny/website-builder-sdk 6.5.0-beta.1 → 6.5.0-beta.2
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.
- package/dataProviders/GET_PAGE_BY_ID.d.ts +1 -1
- package/dataProviders/GET_PAGE_BY_ID.js +2 -0
- package/dataProviders/GET_PAGE_BY_ID.js.map +1 -1
- package/dataProviders/GET_PAGE_BY_PATH.d.ts +1 -1
- package/dataProviders/GET_PAGE_BY_PATH.js +2 -0
- package/dataProviders/GET_PAGE_BY_PATH.js.map +1 -1
- package/dataProviders/queries.test.d.ts +1 -0
- package/dataProviders/queries.test.js +45 -0
- package/dataProviders/queries.test.js.map +1 -0
- package/package.json +3 -3
|
@@ -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";
|
|
@@ -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
|
|
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";
|
|
@@ -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
|
|
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.
|
|
3
|
+
"version": "6.5.0-beta.2",
|
|
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.
|
|
15
|
+
"@webiny/sdk": "6.5.0-beta.2",
|
|
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.
|
|
33
|
+
"@webiny/build-tools": "6.5.0-beta.2",
|
|
34
34
|
"typescript": "7.0.2",
|
|
35
35
|
"vitest": "4.1.10"
|
|
36
36
|
},
|