@builder.io/sdk-react-native 0.1.16 → 0.2.0
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/dist/functions/get-content/generate-content-url.js +2 -1
- package/dist/functions/get-content/generate-content-url.test.js +9 -0
- package/dist/types/api-version.js +4 -0
- package/package.json +1 -1
- package/src/functions/get-content/generate-content-url.js +2 -1
- package/src/functions/get-content/generate-content-url.test.js +9 -0
- package/src/types/api-version.js +4 -0
|
@@ -19,8 +19,9 @@ var __spreadValues = (a, b) => {
|
|
|
19
19
|
};
|
|
20
20
|
const flatten_js_1 = require("../../helpers/flatten.js");
|
|
21
21
|
const index_js_1 = require("../get-builder-search-params/index.js");
|
|
22
|
+
const api_version_1 = require("../../types/api-version");
|
|
22
23
|
const generateContentUrl = (options) => {
|
|
23
|
-
const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, locale, apiVersion =
|
|
24
|
+
const { limit = 30, userAttributes, query, noTraverse = false, model, apiKey, includeRefs = true, locale, apiVersion = api_version_1.DEFAULT_API_VERSION } = options;
|
|
24
25
|
if (!apiKey) {
|
|
25
26
|
throw new Error("Missing API key");
|
|
26
27
|
}
|
|
@@ -30,6 +30,15 @@ describe("Generate Content URL", () => {
|
|
|
30
30
|
});
|
|
31
31
|
expect(output).toMatchSnapshot();
|
|
32
32
|
});
|
|
33
|
+
test("generate content url with apiVersion as default", () => {
|
|
34
|
+
const output = (0, generate_content_url_1.generateContentUrl)({
|
|
35
|
+
apiKey: testKey,
|
|
36
|
+
model: testModel,
|
|
37
|
+
query: { id: testId },
|
|
38
|
+
options
|
|
39
|
+
});
|
|
40
|
+
expect(output).toMatchSnapshot();
|
|
41
|
+
});
|
|
33
42
|
test("generate content url with apiVersion as v2", () => {
|
|
34
43
|
const output = (0, generate_content_url_1.generateContentUrl)({
|
|
35
44
|
apiKey: testKey,
|
package/package.json
CHANGED
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
getBuilderSearchParamsFromWindow,
|
|
20
20
|
normalizeSearchParams
|
|
21
21
|
} from "../get-builder-search-params/index.js";
|
|
22
|
+
import { DEFAULT_API_VERSION } from "../../types/api-version";
|
|
22
23
|
const generateContentUrl = (options) => {
|
|
23
24
|
const {
|
|
24
25
|
limit = 30,
|
|
@@ -29,7 +30,7 @@ const generateContentUrl = (options) => {
|
|
|
29
30
|
apiKey,
|
|
30
31
|
includeRefs = true,
|
|
31
32
|
locale,
|
|
32
|
-
apiVersion =
|
|
33
|
+
apiVersion = DEFAULT_API_VERSION
|
|
33
34
|
} = options;
|
|
34
35
|
if (!apiKey) {
|
|
35
36
|
throw new Error("Missing API key");
|
|
@@ -28,6 +28,15 @@ describe("Generate Content URL", () => {
|
|
|
28
28
|
});
|
|
29
29
|
expect(output).toMatchSnapshot();
|
|
30
30
|
});
|
|
31
|
+
test("generate content url with apiVersion as default", () => {
|
|
32
|
+
const output = generateContentUrl({
|
|
33
|
+
apiKey: testKey,
|
|
34
|
+
model: testModel,
|
|
35
|
+
query: { id: testId },
|
|
36
|
+
options
|
|
37
|
+
});
|
|
38
|
+
expect(output).toMatchSnapshot();
|
|
39
|
+
});
|
|
31
40
|
test("generate content url with apiVersion as v2", () => {
|
|
32
41
|
const output = generateContentUrl({
|
|
33
42
|
apiKey: testKey,
|
package/src/types/api-version.js
CHANGED