@jam-comments/server-utilities 3.2.1 → 4.0.0-alpha.1

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.
@@ -18,7 +18,7 @@ const markupFetcher = (platform, fetchImplementation = fetch) => {
18
18
  if (environment !== "production") {
19
19
  params.set("stub", "true");
20
20
  }
21
- const requestUrl = `${baseUrl}/api/v2/markup?${params}`;
21
+ const requestUrl = `${baseUrl}/api/v3/markup?${params}`;
22
22
  const response = await fetchImplementation(requestUrl, {
23
23
  method: "GET",
24
24
  headers: {
@@ -18,7 +18,7 @@ const markupFetcher_1 = require("./markupFetcher");
18
18
  apiKey: "123abc",
19
19
  environment: "production",
20
20
  });
21
- (0, vitest_1.expect)(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v2/markup?path=%2Ftest&domain=test.com", vitest_1.expect.objectContaining({
21
+ (0, vitest_1.expect)(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v3/markup?path=%2Ftest&domain=test.com", vitest_1.expect.objectContaining({
22
22
  headers: vitest_1.expect.objectContaining({
23
23
  Accept: "application/json",
24
24
  Authorization: "Bearer 123abc",
@@ -43,7 +43,7 @@ const markupFetcher_1 = require("./markupFetcher");
43
43
  apiKey: "123abc",
44
44
  environment: "development",
45
45
  });
46
- (0, vitest_1.expect)(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v2/markup?path=%2Ftest&domain=test.com&stub=true", vitest_1.expect.anything());
46
+ (0, vitest_1.expect)(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v3/markup?path=%2Ftest&domain=test.com&stub=true", vitest_1.expect.anything());
47
47
  (0, vitest_1.expect)(result).toEqual("results!");
48
48
  });
49
49
  (0, vitest_1.it)("uses different base URL", async () => {
@@ -62,7 +62,7 @@ const markupFetcher_1 = require("./markupFetcher");
62
62
  baseUrl: "http://ur-mom.com",
63
63
  environment: "production",
64
64
  });
65
- (0, vitest_1.expect)(fetchMock).toHaveBeenCalledWith("http://ur-mom.com/api/v2/markup?path=%2Ftest&domain=test.com", vitest_1.expect.anything());
65
+ (0, vitest_1.expect)(fetchMock).toHaveBeenCalledWith("http://ur-mom.com/api/v3/markup?path=%2Ftest&domain=test.com", vitest_1.expect.anything());
66
66
  (0, vitest_1.expect)(result).toEqual("results!");
67
67
  });
68
68
  (0, vitest_1.it)("respects production!!!", async () => {
@@ -81,7 +81,7 @@ const markupFetcher_1 = require("./markupFetcher");
81
81
  baseUrl: "http://ur-mom.com",
82
82
  environment: "production",
83
83
  });
84
- (0, vitest_1.expect)(fetchMock).toHaveBeenCalledWith("http://ur-mom.com/api/v2/markup?path=%2Ftest&domain=test.com", vitest_1.expect.anything());
84
+ (0, vitest_1.expect)(fetchMock).toHaveBeenCalledWith("http://ur-mom.com/api/v3/markup?path=%2Ftest&domain=test.com", vitest_1.expect.anything());
85
85
  (0, vitest_1.expect)(result).toEqual("results!");
86
86
  });
87
87
  (0, vitest_1.it)("falls back to root path", async () => {
@@ -99,7 +99,7 @@ const markupFetcher_1 = require("./markupFetcher");
99
99
  apiKey: "123abc",
100
100
  environment: "production",
101
101
  });
102
- (0, vitest_1.expect)(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v2/markup?path=%2F&domain=test.com", vitest_1.expect.anything());
102
+ (0, vitest_1.expect)(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v3/markup?path=%2F&domain=test.com", vitest_1.expect.anything());
103
103
  (0, vitest_1.expect)(result).toEqual("results!");
104
104
  });
105
105
  (0, vitest_1.it)("credentials are invalid", async () => {
@@ -161,7 +161,7 @@ const markupFetcher_1 = require("./markupFetcher");
161
161
  tz: "America/New_York",
162
162
  environment: "production",
163
163
  });
164
- (0, vitest_1.expect)(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v2/markup?path=%2F&domain=test.com&tz=America%2FNew_York", vitest_1.expect.anything());
164
+ (0, vitest_1.expect)(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v3/markup?path=%2F&domain=test.com&tz=America%2FNew_York", vitest_1.expect.anything());
165
165
  (0, vitest_1.expect)(result).toEqual("results!");
166
166
  });
167
167
  (0, vitest_1.it)("trims a valid timezone", async () => {
@@ -180,7 +180,7 @@ const markupFetcher_1 = require("./markupFetcher");
180
180
  tz: " America/Chicago ",
181
181
  environment: "production",
182
182
  });
183
- (0, vitest_1.expect)(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v2/markup?path=%2F&domain=test.com&tz=America%2FChicago", vitest_1.expect.anything());
183
+ (0, vitest_1.expect)(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v3/markup?path=%2F&domain=test.com&tz=America%2FChicago", vitest_1.expect.anything());
184
184
  (0, vitest_1.expect)(result).toEqual("results!");
185
185
  });
186
186
  });
@@ -15,7 +15,7 @@ export const markupFetcher = (platform, fetchImplementation = fetch) => {
15
15
  if (environment !== "production") {
16
16
  params.set("stub", "true");
17
17
  }
18
- const requestUrl = `${baseUrl}/api/v2/markup?${params}`;
18
+ const requestUrl = `${baseUrl}/api/v3/markup?${params}`;
19
19
  const response = await fetchImplementation(requestUrl, {
20
20
  method: "GET",
21
21
  headers: {
@@ -16,7 +16,7 @@ describe("markupFetcher", () => {
16
16
  apiKey: "123abc",
17
17
  environment: "production",
18
18
  });
19
- expect(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v2/markup?path=%2Ftest&domain=test.com", expect.objectContaining({
19
+ expect(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v3/markup?path=%2Ftest&domain=test.com", expect.objectContaining({
20
20
  headers: expect.objectContaining({
21
21
  Accept: "application/json",
22
22
  Authorization: "Bearer 123abc",
@@ -41,7 +41,7 @@ describe("markupFetcher", () => {
41
41
  apiKey: "123abc",
42
42
  environment: "development",
43
43
  });
44
- expect(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v2/markup?path=%2Ftest&domain=test.com&stub=true", expect.anything());
44
+ expect(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v3/markup?path=%2Ftest&domain=test.com&stub=true", expect.anything());
45
45
  expect(result).toEqual("results!");
46
46
  });
47
47
  it("uses different base URL", async () => {
@@ -60,7 +60,7 @@ describe("markupFetcher", () => {
60
60
  baseUrl: "http://ur-mom.com",
61
61
  environment: "production",
62
62
  });
63
- expect(fetchMock).toHaveBeenCalledWith("http://ur-mom.com/api/v2/markup?path=%2Ftest&domain=test.com", expect.anything());
63
+ expect(fetchMock).toHaveBeenCalledWith("http://ur-mom.com/api/v3/markup?path=%2Ftest&domain=test.com", expect.anything());
64
64
  expect(result).toEqual("results!");
65
65
  });
66
66
  it("respects production!!!", async () => {
@@ -79,7 +79,7 @@ describe("markupFetcher", () => {
79
79
  baseUrl: "http://ur-mom.com",
80
80
  environment: "production",
81
81
  });
82
- expect(fetchMock).toHaveBeenCalledWith("http://ur-mom.com/api/v2/markup?path=%2Ftest&domain=test.com", expect.anything());
82
+ expect(fetchMock).toHaveBeenCalledWith("http://ur-mom.com/api/v3/markup?path=%2Ftest&domain=test.com", expect.anything());
83
83
  expect(result).toEqual("results!");
84
84
  });
85
85
  it("falls back to root path", async () => {
@@ -97,7 +97,7 @@ describe("markupFetcher", () => {
97
97
  apiKey: "123abc",
98
98
  environment: "production",
99
99
  });
100
- expect(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v2/markup?path=%2F&domain=test.com", expect.anything());
100
+ expect(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v3/markup?path=%2F&domain=test.com", expect.anything());
101
101
  expect(result).toEqual("results!");
102
102
  });
103
103
  it("credentials are invalid", async () => {
@@ -159,7 +159,7 @@ describe("markupFetcher", () => {
159
159
  tz: "America/New_York",
160
160
  environment: "production",
161
161
  });
162
- expect(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v2/markup?path=%2F&domain=test.com&tz=America%2FNew_York", expect.anything());
162
+ expect(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v3/markup?path=%2F&domain=test.com&tz=America%2FNew_York", expect.anything());
163
163
  expect(result).toEqual("results!");
164
164
  });
165
165
  it("trims a valid timezone", async () => {
@@ -178,7 +178,7 @@ describe("markupFetcher", () => {
178
178
  tz: " America/Chicago ",
179
179
  environment: "production",
180
180
  });
181
- expect(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v2/markup?path=%2F&domain=test.com&tz=America%2FChicago", expect.anything());
181
+ expect(fetchMock).toHaveBeenCalledWith("https://go.jamcomments.com/api/v3/markup?path=%2F&domain=test.com&tz=America%2FChicago", expect.anything());
182
182
  expect(result).toEqual("results!");
183
183
  });
184
184
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jam-comments/server-utilities",
3
- "version": "3.2.1",
3
+ "version": "4.0.0-alpha.1",
4
4
  "description": "Various JavaScript utilities for JamComments.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -21,11 +21,11 @@
21
21
  "homepage": "https://jamcomments.com",
22
22
  "license": "GPL-2.0",
23
23
  "devDependencies": {
24
- "@types/node": "^20.2.5",
25
- "prettier": "^2.8.8",
26
- "typescript": "^5.0.4",
27
- "vite": "^4.3.9",
28
- "vitest": "^0.31.1"
24
+ "@types/node": "^20.9.0",
25
+ "prettier": "^3.0.3",
26
+ "typescript": "^5.2.2",
27
+ "vite": "^4.5.0",
28
+ "vitest": "^0.34.6"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"