@antlur/backstage 1.0.7 → 1.0.8
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/client.js +6 -14
- package/dist/config.js +2 -7
- package/dist/constants/google-events.js +2 -5
- package/dist/endpoints/alerts.js +3 -7
- package/dist/endpoints/events.js +7 -13
- package/dist/endpoints/locations.js +5 -10
- package/dist/endpoints/menus.js +7 -13
- package/dist/endpoints/navigation.js +7 -13
- package/dist/endpoints/pages.js +9 -16
- package/dist/endpoints/press.js +3 -7
- package/dist/endpoints/website.js +3 -7
- package/dist/index.js +11 -31
- package/dist/types/alert.js +1 -2
- package/dist/types/api.js +1 -2
- package/dist/types/event.js +1 -2
- package/dist/types/index.js +13 -29
- package/dist/types/location.js +1 -2
- package/dist/types/media-item.js +1 -2
- package/dist/types/menu-category-item.js +1 -2
- package/dist/types/menu-category.js +1 -2
- package/dist/types/menu-item.js +1 -2
- package/dist/types/menu.js +1 -2
- package/dist/types/navigation.js +1 -2
- package/dist/types/page.js +1 -2
- package/dist/types/press.js +1 -2
- package/dist/types/website.js +1 -2
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.client = exports.BackstageClient = void 0;
|
|
7
|
-
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
const config_1 = require("./config");
|
|
9
|
-
class BackstageClient {
|
|
1
|
+
import axios from "axios";
|
|
2
|
+
import { getGlobalConfig } from "./config";
|
|
3
|
+
export class BackstageClient {
|
|
10
4
|
constructor(config) {
|
|
11
5
|
// If no config is passed, try to get from the global config
|
|
12
|
-
const globalConfig =
|
|
6
|
+
const globalConfig = getGlobalConfig();
|
|
13
7
|
const finalConfig = config || globalConfig;
|
|
14
8
|
if (!finalConfig) {
|
|
15
9
|
throw new Error("No Backstage config found. Please call defineConfig() or pass config to BackstageClient.");
|
|
@@ -22,7 +16,7 @@ class BackstageClient {
|
|
|
22
16
|
throw new Error("No accountId found in the Backstage config. Please provide an accountId.");
|
|
23
17
|
}
|
|
24
18
|
const { baseURL, token, onError } = finalConfig;
|
|
25
|
-
this.instance =
|
|
19
|
+
this.instance = axios.create({
|
|
26
20
|
baseURL,
|
|
27
21
|
headers: {
|
|
28
22
|
Authorization: `Bearer ${token}`,
|
|
@@ -79,8 +73,6 @@ class BackstageClient {
|
|
|
79
73
|
return this.instance;
|
|
80
74
|
}
|
|
81
75
|
}
|
|
82
|
-
|
|
83
|
-
const client = function (config) {
|
|
76
|
+
export const client = function (config) {
|
|
84
77
|
return new BackstageClient(config);
|
|
85
78
|
};
|
|
86
|
-
exports.client = client;
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getGlobalConfig = exports.defineConfig = void 0;
|
|
4
1
|
const ROOT = process.cwd();
|
|
5
2
|
const CONFIG_PATH = process.env.BACKSTAGE_CONFIG_PATH || "./backstage.config";
|
|
6
3
|
const DEFAULT_BASE_URL = "https://bckstg.app/api";
|
|
@@ -9,16 +6,14 @@ let globalConfig = {
|
|
|
9
6
|
token: process.env.BACKSTAGE_API_KEY ?? undefined,
|
|
10
7
|
accountId: process.env.BACKSTAGE_ACCOUNT_ID ?? undefined,
|
|
11
8
|
};
|
|
12
|
-
function defineConfig(config) {
|
|
9
|
+
export function defineConfig(config) {
|
|
13
10
|
globalConfig = {
|
|
14
11
|
...globalConfig,
|
|
15
12
|
...config,
|
|
16
13
|
};
|
|
17
14
|
return globalConfig;
|
|
18
15
|
}
|
|
19
|
-
|
|
20
|
-
function getGlobalConfig() {
|
|
16
|
+
export function getGlobalConfig() {
|
|
21
17
|
// read the config from the project root
|
|
22
18
|
return globalConfig;
|
|
23
19
|
}
|
|
24
|
-
exports.getGlobalConfig = getGlobalConfig;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GALocations = exports.GAEvents = void 0;
|
|
4
|
-
exports.GAEvents = {
|
|
1
|
+
export const GAEvents = {
|
|
5
2
|
CLICK_TO_MAP: "click_to_map",
|
|
6
3
|
CLICK_TO_CALL: "click_to_call",
|
|
7
4
|
CLICK_TO_SOCIAL: "click_to_social",
|
|
@@ -9,7 +6,7 @@ exports.GAEvents = {
|
|
|
9
6
|
FIND_LOCATION: "find_location",
|
|
10
7
|
CLICK_TO_ORDER: "click_to_order",
|
|
11
8
|
};
|
|
12
|
-
|
|
9
|
+
export const GALocations = {
|
|
13
10
|
LOCATION_CARD: "location_card",
|
|
14
11
|
TOPBAR: "topbar",
|
|
15
12
|
};
|
package/dist/endpoints/alerts.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const client_1 = require("../client");
|
|
5
|
-
async function getAlerts() {
|
|
6
|
-
const { data } = await (0, client_1.client)().get("/alerts");
|
|
1
|
+
import { client } from "../client";
|
|
2
|
+
export async function getAlerts() {
|
|
3
|
+
const { data } = await client().get("/alerts");
|
|
7
4
|
return data;
|
|
8
5
|
}
|
|
9
|
-
exports.getAlerts = getAlerts;
|
package/dist/endpoints/events.js
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const client_1 = require("../client");
|
|
5
|
-
async function getEvents() {
|
|
6
|
-
const res = await (0, client_1.client)().get("/events");
|
|
1
|
+
import { client } from "../client";
|
|
2
|
+
export async function getEvents() {
|
|
3
|
+
const res = await client().get("/events");
|
|
7
4
|
const pages = res.data;
|
|
8
5
|
return pages;
|
|
9
6
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const res = await (0, client_1.client)().get("/events" + "?filter[id]=" + id);
|
|
7
|
+
export async function getEvent(id) {
|
|
8
|
+
const res = await client().get("/events" + "?filter[id]=" + id);
|
|
13
9
|
const pages = res.data?.[0];
|
|
14
10
|
return pages;
|
|
15
11
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const res = await (0, client_1.client)().get("/events" + "?filter[slug]=" + slug);
|
|
12
|
+
export async function getEventBySlug(slug) {
|
|
13
|
+
const res = await client().get("/events" + "?filter[slug]=" + slug);
|
|
19
14
|
const pages = res.data?.[0];
|
|
20
15
|
return pages;
|
|
21
16
|
}
|
|
22
|
-
exports.getEventBySlug = getEventBySlug;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const client_1 = require("../client");
|
|
5
|
-
async function getLocations() {
|
|
6
|
-
const res = await (0, client_1.client)().get("/locations");
|
|
1
|
+
import { client } from "../client";
|
|
2
|
+
export async function getLocations() {
|
|
3
|
+
const res = await client().get("/locations");
|
|
7
4
|
let locations = res.data;
|
|
8
5
|
locations = locations.sort((a, b) => {
|
|
9
6
|
if (a.name < b.name) {
|
|
@@ -13,13 +10,11 @@ async function getLocations() {
|
|
|
13
10
|
});
|
|
14
11
|
return locations;
|
|
15
12
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const res = await (0, client_1.client)().get(`/locations?filter[slug]=${slug}`);
|
|
13
|
+
export async function getLocationBySlug(slug) {
|
|
14
|
+
const res = await client().get(`/locations?filter[slug]=${slug}`);
|
|
19
15
|
const data = res.data;
|
|
20
16
|
if (Array.isArray(data) && data.length > 0) {
|
|
21
17
|
return data[0];
|
|
22
18
|
}
|
|
23
19
|
return data;
|
|
24
20
|
}
|
|
25
|
-
exports.getLocationBySlug = getLocationBySlug;
|
package/dist/endpoints/menus.js
CHANGED
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const client_1 = require("../client");
|
|
5
|
-
async function getMenus() {
|
|
6
|
-
const res = await (0, client_1.client)().get("/menus");
|
|
1
|
+
import { client } from "../client";
|
|
2
|
+
export async function getMenus() {
|
|
3
|
+
const res = await client().get("/menus");
|
|
7
4
|
const menus = res.data;
|
|
8
5
|
return menus;
|
|
9
6
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const res = await (0, client_1.client)().get(`/menus?filter[id]=${id}&include=categories.items`);
|
|
7
|
+
export async function getMenu(id) {
|
|
8
|
+
const res = await client().get(`/menus?filter[id]=${id}&include=categories.items`);
|
|
13
9
|
const data = res.data;
|
|
14
10
|
if (Array.isArray(data) && data.length > 0) {
|
|
15
11
|
return data[0];
|
|
16
12
|
}
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const res = await (0, client_1.client)().get(`/menus?filter[slug]=${slug}&include=categories.items`);
|
|
15
|
+
export async function getMenuBySlug(slug) {
|
|
16
|
+
const res = await client().get(`/menus?filter[slug]=${slug}&include=categories.items`);
|
|
22
17
|
const data = res.data;
|
|
23
18
|
if (Array.isArray(data) && data.length > 0) {
|
|
24
19
|
return data[0];
|
|
25
20
|
}
|
|
26
21
|
return data;
|
|
27
22
|
}
|
|
28
|
-
exports.getMenuBySlug = getMenuBySlug;
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getNavigation = exports.getNavigations = exports.getDefaultNavigation = void 0;
|
|
4
|
-
const client_1 = require("../client");
|
|
5
|
-
async function getDefaultNavigation() {
|
|
1
|
+
import { client } from "../client";
|
|
2
|
+
export async function getDefaultNavigation() {
|
|
6
3
|
const navigations = await getNavigations();
|
|
7
4
|
return navigations[0];
|
|
8
5
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const res = await (0, client_1.client)().get("/navigations");
|
|
6
|
+
export async function getNavigations() {
|
|
7
|
+
const res = await client().get("/navigations");
|
|
12
8
|
const navigations = res.data;
|
|
13
9
|
return Promise.all(navigations.map(async (navigation) => {
|
|
14
|
-
const res = await
|
|
10
|
+
const res = await client().get("/navigations/" + navigation.id);
|
|
15
11
|
return res.data[0];
|
|
16
12
|
}));
|
|
17
13
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const res = await (0, client_1.client)().get(`/navigations/${id}`);
|
|
14
|
+
export async function getNavigation(id) {
|
|
15
|
+
const res = await client().get(`/navigations/${id}`);
|
|
21
16
|
const navigation = res.data;
|
|
22
17
|
const topLevelItems = navigation.items.filter((item) => item.parent_id === null);
|
|
23
18
|
topLevelItems.forEach((item) => {
|
|
@@ -26,4 +21,3 @@ async function getNavigation(id) {
|
|
|
26
21
|
navigation.items = topLevelItems;
|
|
27
22
|
return navigation;
|
|
28
23
|
}
|
|
29
|
-
exports.getNavigation = getNavigation;
|
package/dist/endpoints/pages.js
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const client_1 = require("../client");
|
|
5
|
-
async function getPage(slug) {
|
|
6
|
-
const res = await (0, client_1.client)().get(`/pages/?filter[slug]=${slug}`);
|
|
1
|
+
import { client } from "../client";
|
|
2
|
+
export async function getPage(slug) {
|
|
3
|
+
const res = await client().get(`/pages/?filter[slug]=${slug}`);
|
|
7
4
|
return res.data[0];
|
|
8
5
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const { data } = await (0, client_1.client)().get("/pages");
|
|
6
|
+
export async function getPages() {
|
|
7
|
+
const { data } = await client().get("/pages");
|
|
12
8
|
return data;
|
|
13
9
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const res = await (0, client_1.client)().get("/pages?filter[slug]=/");
|
|
10
|
+
export async function getHomePage() {
|
|
11
|
+
const res = await client().get("/pages?filter[slug]=/");
|
|
17
12
|
return res.data[0];
|
|
18
13
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const res = await (0, client_1.client)().get("/pages?filter[slug]=" + slug);
|
|
14
|
+
export async function getPageBySlug(slug) {
|
|
15
|
+
const res = await client().get("/pages?filter[slug]=" + slug);
|
|
22
16
|
return res.data[0];
|
|
23
17
|
}
|
|
24
|
-
exports.getPageBySlug = getPageBySlug;
|
package/dist/endpoints/press.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const client_1 = require("../client");
|
|
5
|
-
async function getPress() {
|
|
6
|
-
const { data } = await (0, client_1.client)().get("/press");
|
|
1
|
+
import { client } from "../client";
|
|
2
|
+
export async function getPress() {
|
|
3
|
+
const { data } = await client().get("/press");
|
|
7
4
|
return data;
|
|
8
5
|
}
|
|
9
|
-
exports.getPress = getPress;
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const client_1 = require("../client");
|
|
5
|
-
async function getWebsite() {
|
|
6
|
-
const res = await (0, client_1.client)().get("/websites");
|
|
1
|
+
import { client } from "../client";
|
|
2
|
+
export async function getWebsite() {
|
|
3
|
+
const res = await client().get("/websites");
|
|
7
4
|
return res.data[0];
|
|
8
5
|
}
|
|
9
|
-
exports.getWebsite = getWebsite;
|
package/dist/index.js
CHANGED
|
@@ -1,35 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.BackstageClient = exports.getGlobalConfig = exports.defineConfig = void 0;
|
|
18
1
|
// Re-export config
|
|
19
|
-
|
|
20
|
-
Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return config_1.defineConfig; } });
|
|
21
|
-
Object.defineProperty(exports, "getGlobalConfig", { enumerable: true, get: function () { return config_1.getGlobalConfig; } });
|
|
2
|
+
export { defineConfig, getGlobalConfig } from "./config";
|
|
22
3
|
// Re-export the client class
|
|
23
|
-
|
|
24
|
-
Object.defineProperty(exports, "BackstageClient", { enumerable: true, get: function () { return client_1.BackstageClient; } });
|
|
4
|
+
export { BackstageClient } from "./client";
|
|
25
5
|
// Re-export endpoints
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
6
|
+
export * from "./endpoints/alerts";
|
|
7
|
+
export * from "./endpoints/events";
|
|
8
|
+
export * from "./endpoints/locations";
|
|
9
|
+
export * from "./endpoints/menus";
|
|
10
|
+
export * from "./endpoints/navigation";
|
|
11
|
+
export * from "./endpoints/pages";
|
|
12
|
+
export * from "./endpoints/press";
|
|
13
|
+
export * from "./endpoints/website";
|
|
34
14
|
// Re-export domain types
|
|
35
|
-
|
|
15
|
+
export * from "./types";
|
package/dist/types/alert.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/types/api.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/types/event.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/types/index.js
CHANGED
|
@@ -1,29 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./alert"), exports);
|
|
18
|
-
__exportStar(require("./api"), exports);
|
|
19
|
-
__exportStar(require("./event"), exports);
|
|
20
|
-
__exportStar(require("./location"), exports);
|
|
21
|
-
__exportStar(require("./media-item"), exports);
|
|
22
|
-
__exportStar(require("./menu-category-item"), exports);
|
|
23
|
-
__exportStar(require("./menu-category"), exports);
|
|
24
|
-
__exportStar(require("./menu-item"), exports);
|
|
25
|
-
__exportStar(require("./menu"), exports);
|
|
26
|
-
__exportStar(require("./navigation"), exports);
|
|
27
|
-
__exportStar(require("./page"), exports);
|
|
28
|
-
__exportStar(require("./press"), exports);
|
|
29
|
-
__exportStar(require("./website"), exports);
|
|
1
|
+
export * from "./alert";
|
|
2
|
+
export * from "./api";
|
|
3
|
+
export * from "./event";
|
|
4
|
+
export * from "./location";
|
|
5
|
+
export * from "./media-item";
|
|
6
|
+
export * from "./menu-category-item";
|
|
7
|
+
export * from "./menu-category";
|
|
8
|
+
export * from "./menu-item";
|
|
9
|
+
export * from "./menu";
|
|
10
|
+
export * from "./navigation";
|
|
11
|
+
export * from "./page";
|
|
12
|
+
export * from "./press";
|
|
13
|
+
export * from "./website";
|
package/dist/types/location.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/types/media-item.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/types/menu-item.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/types/menu.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/types/navigation.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/types/page.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/types/press.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/types/website.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|