@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.
@@ -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 = "v2" } = options;
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,
@@ -1 +1,5 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_API_VERSION = void 0;
4
+ const DEFAULT_API_VERSION = "v3";
5
+ exports.DEFAULT_API_VERSION = DEFAULT_API_VERSION;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@builder.io/sdk-react-native",
3
3
  "description": "Builder.io SDK for React Native",
4
- "version": "0.1.16",
4
+ "version": "0.2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
@@ -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 = "v2"
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,
@@ -0,0 +1,4 @@
1
+ const DEFAULT_API_VERSION = "v3";
2
+ export {
3
+ DEFAULT_API_VERSION
4
+ };