@antlur/backstage 1.12.8 → 1.12.10

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.
Files changed (88) hide show
  1. package/dist/client.d.ts +8 -0
  2. package/dist/client.d.ts.map +1 -1
  3. package/dist/client.js +12 -0
  4. package/dist/endpoints/auth.d.ts +42 -0
  5. package/dist/endpoints/auth.d.ts.map +1 -0
  6. package/dist/endpoints/auth.js +28 -0
  7. package/dist/endpoints/blocks.d.ts +13 -9
  8. package/dist/endpoints/blocks.d.ts.map +1 -1
  9. package/dist/endpoints/blocks.js +19 -10
  10. package/dist/endpoints/entries.d.ts +31 -0
  11. package/dist/endpoints/entries.d.ts.map +1 -0
  12. package/dist/endpoints/entries.js +31 -0
  13. package/dist/endpoints/forms.d.ts +8 -0
  14. package/dist/endpoints/forms.d.ts.map +1 -0
  15. package/dist/endpoints/forms.js +7 -0
  16. package/dist/endpoints/layouts.d.ts +12 -5
  17. package/dist/endpoints/layouts.d.ts.map +1 -1
  18. package/dist/endpoints/layouts.js +23 -8
  19. package/dist/endpoints/menus.d.ts +15 -0
  20. package/dist/endpoints/menus.d.ts.map +1 -1
  21. package/dist/endpoints/menus.js +11 -0
  22. package/dist/endpoints/pages.d.ts +23 -0
  23. package/dist/endpoints/pages.d.ts.map +1 -1
  24. package/dist/endpoints/pages.js +11 -0
  25. package/dist/endpoints/redirects.d.ts +6 -0
  26. package/dist/endpoints/redirects.d.ts.map +1 -0
  27. package/dist/endpoints/redirects.js +7 -0
  28. package/dist/endpoints/website.d.ts +15 -2
  29. package/dist/endpoints/website.d.ts.map +1 -1
  30. package/dist/endpoints/website.js +20 -4
  31. package/dist/index.d.ts +7 -0
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +7 -0
  34. package/dist/types/account-block.d.ts +10 -0
  35. package/dist/types/account-block.d.ts.map +1 -0
  36. package/dist/types/account-block.js +1 -0
  37. package/dist/types/account-layout.d.ts +15 -0
  38. package/dist/types/account-layout.d.ts.map +1 -0
  39. package/dist/types/account-layout.js +1 -0
  40. package/dist/types/blueprint.d.ts +11 -0
  41. package/dist/types/blueprint.d.ts.map +1 -0
  42. package/dist/types/blueprint.js +1 -0
  43. package/dist/types/entry.d.ts +36 -0
  44. package/dist/types/entry.d.ts.map +1 -0
  45. package/dist/types/entry.js +1 -0
  46. package/dist/types/event.d.ts +3 -0
  47. package/dist/types/event.d.ts.map +1 -1
  48. package/dist/types/index.d.ts +5 -0
  49. package/dist/types/index.d.ts.map +1 -1
  50. package/dist/types/location.d.ts +4 -0
  51. package/dist/types/location.d.ts.map +1 -1
  52. package/dist/types/media-item.d.ts +6 -2
  53. package/dist/types/media-item.d.ts.map +1 -1
  54. package/dist/types/menu.d.ts +4 -1
  55. package/dist/types/menu.d.ts.map +1 -1
  56. package/dist/types/page.d.ts +3 -7
  57. package/dist/types/page.d.ts.map +1 -1
  58. package/dist/types/redirect.d.ts +10 -0
  59. package/dist/types/redirect.d.ts.map +1 -0
  60. package/dist/types/redirect.js +1 -0
  61. package/dist/types/website.d.ts +5 -1
  62. package/dist/types/website.d.ts.map +1 -1
  63. package/dist/util/event.js +1 -1
  64. package/package.json +1 -1
  65. package/src/client.ts +12 -0
  66. package/src/endpoints/auth.ts +68 -0
  67. package/src/endpoints/blocks.ts +31 -14
  68. package/src/endpoints/entries.ts +62 -0
  69. package/src/endpoints/forms.ts +12 -0
  70. package/src/endpoints/layouts.ts +31 -13
  71. package/src/endpoints/menus.ts +29 -1
  72. package/src/endpoints/pages.ts +37 -1
  73. package/src/endpoints/redirects.ts +9 -0
  74. package/src/endpoints/website.ts +35 -5
  75. package/src/index.ts +7 -0
  76. package/src/types/account-block.ts +9 -0
  77. package/src/types/account-layout.ts +14 -0
  78. package/src/types/blueprint.ts +10 -0
  79. package/src/types/entry.ts +38 -0
  80. package/src/types/event.ts +6 -3
  81. package/src/types/index.ts +5 -0
  82. package/src/types/location.ts +5 -0
  83. package/src/types/media-item.ts +6 -2
  84. package/src/types/menu.ts +6 -1
  85. package/src/types/page.ts +4 -7
  86. package/src/types/redirect.ts +9 -0
  87. package/src/types/website.ts +2 -1
  88. package/src/util/event.ts +1 -1
@@ -1,26 +1,44 @@
1
- import type { ApiSingleResponse } from "../types/index";
1
+ import type { ApiCollectionResponse, ApiSingleResponse, AccountLayout } from "../types/index";
2
2
  import { BaseService } from "./base.js";
3
3
 
4
- interface LayoutParams {
4
+ export interface CreateLayoutParams {
5
5
  name: string;
6
6
  slug: string;
7
7
  schema: any;
8
8
  }
9
9
 
10
+ export interface UpdateLayoutParams {
11
+ name?: string;
12
+ slug?: string;
13
+ schema?: any;
14
+ }
15
+
10
16
  export class LayoutService extends BaseService {
11
- async all(options?: RequestInit) {}
17
+ async list(options?: RequestInit): Promise<AccountLayout[]> {
18
+ const { data } = await this.client.get<ApiCollectionResponse<AccountLayout>>("/layouts", options);
19
+ return data;
20
+ }
21
+
22
+ async get(id: string, options?: RequestInit): Promise<AccountLayout | null> {
23
+ try {
24
+ const { data } = await this.client.get<ApiSingleResponse<AccountLayout>>(`/layouts/${id}`, options);
25
+ return data;
26
+ } catch (error) {
27
+ return null;
28
+ }
29
+ }
30
+
31
+ async create(params: CreateLayoutParams, options?: RequestInit): Promise<AccountLayout> {
32
+ const { data } = await this.client.post<ApiSingleResponse<AccountLayout>>("/layouts", params, options);
33
+ return data;
34
+ }
12
35
 
13
- async create({ name, slug, schema }: LayoutParams, options?: RequestInit) {
14
- const res = await this.client.post<ApiSingleResponse<LayoutParams>>("/layouts", { name, slug, schema }, options);
15
- return res.data;
36
+ async update(id: string, params: UpdateLayoutParams, options?: RequestInit): Promise<AccountLayout> {
37
+ const { data } = await this.client.put<ApiSingleResponse<AccountLayout>>(`/layouts/${id}`, params, options);
38
+ return data;
16
39
  }
17
40
 
18
- async update(id: string, { name, slug, schema }: LayoutParams, options?: RequestInit) {
19
- const res = await this.client.put<ApiSingleResponse<LayoutParams>>(
20
- `/layouts/${id}`,
21
- { name, slug, schema },
22
- options
23
- );
24
- return res.data;
41
+ async delete(id: string, options?: RequestInit): Promise<void> {
42
+ await this.client.delete(`/layouts/${id}`, options);
25
43
  }
26
44
  }
@@ -1,6 +1,20 @@
1
- import type { ApiCollectionResponse, Menu } from "../types/index";
1
+ import type { ApiCollectionResponse, ApiSingleResponse, Menu } from "../types/index";
2
2
  import { BaseService } from "./base.js";
3
3
 
4
+ export interface CreateMenuParams {
5
+ title: string;
6
+ slug: string;
7
+ subtitle?: string;
8
+ is_default?: boolean;
9
+ }
10
+
11
+ export interface UpdateMenuParams {
12
+ title?: string;
13
+ slug?: string;
14
+ subtitle?: string;
15
+ is_default?: boolean;
16
+ }
17
+
4
18
  export class MenuService extends BaseService {
5
19
  async getMenus(options?: RequestInit): Promise<Menu[]> {
6
20
  const res = await this.client.get<ApiCollectionResponse<Menu>>("/menus", options);
@@ -35,4 +49,18 @@ export class MenuService extends BaseService {
35
49
 
36
50
  return data;
37
51
  }
52
+
53
+ async createMenu(params: CreateMenuParams, options?: RequestInit): Promise<Menu> {
54
+ const { data } = await this.client.post<ApiSingleResponse<Menu>>("/menus", params, options);
55
+ return data;
56
+ }
57
+
58
+ async updateMenu(id: string, params: UpdateMenuParams, options?: RequestInit): Promise<Menu> {
59
+ const { data } = await this.client.put<ApiSingleResponse<Menu>>(`/menus/${id}`, params, options);
60
+ return data;
61
+ }
62
+
63
+ async deleteMenu(id: string, options?: RequestInit): Promise<void> {
64
+ await this.client.delete(`/menus/${id}`, options);
65
+ }
38
66
  }
@@ -1,6 +1,28 @@
1
- import type { ApiCollectionResponse, Page } from "../types/index";
1
+ import type { ApiCollectionResponse, ApiSingleResponse, Page } from "../types/index";
2
2
  import { BaseService } from "./base.js";
3
3
 
4
+ export interface CreatePageParams {
5
+ title: string;
6
+ slug: string;
7
+ blocks?: any[];
8
+ settings?: any;
9
+ is_home?: boolean;
10
+ layout_id?: string;
11
+ seo_title?: string;
12
+ seo_description?: string;
13
+ }
14
+
15
+ export interface UpdatePageParams {
16
+ title?: string;
17
+ slug?: string;
18
+ blocks?: any[];
19
+ settings?: any;
20
+ is_home?: boolean;
21
+ layout_id?: string;
22
+ seo_title?: string;
23
+ seo_description?: string;
24
+ }
25
+
4
26
  export class PageService extends BaseService {
5
27
  async getPages(options?: RequestInit): Promise<Page[]> {
6
28
  const res = await this.client.get<ApiCollectionResponse<Page>>("/pages", options);
@@ -38,4 +60,18 @@ export class PageService extends BaseService {
38
60
  }
39
61
  return res.data[0];
40
62
  }
63
+
64
+ async createPage(params: CreatePageParams, options?: RequestInit): Promise<Page> {
65
+ const { data } = await this.client.post<ApiSingleResponse<Page>>("/pages", params, options);
66
+ return data;
67
+ }
68
+
69
+ async updatePage(id: string, params: UpdatePageParams, options?: RequestInit): Promise<Page> {
70
+ const { data } = await this.client.put<ApiSingleResponse<Page>>(`/pages/${id}`, params, options);
71
+ return data;
72
+ }
73
+
74
+ async deletePage(id: string, options?: RequestInit): Promise<void> {
75
+ await this.client.delete(`/pages/${id}`, options);
76
+ }
41
77
  }
@@ -0,0 +1,9 @@
1
+ import type { ApiCollectionResponse, Redirect } from "../types/index";
2
+ import { BaseService } from "./base.js";
3
+
4
+ export class RedirectService extends BaseService {
5
+ async getRedirects(options?: RequestInit): Promise<Redirect[]> {
6
+ const { data } = await this.client.get<ApiCollectionResponse<Redirect>>("/redirects", options);
7
+ return data;
8
+ }
9
+ }
@@ -1,15 +1,45 @@
1
- import type { ApiCollectionResponse, Website } from "../types/index";
1
+ import type { ApiCollectionResponse, ApiSingleResponse, Website } from "../types/index";
2
2
  import { BaseService } from "./base.js";
3
3
 
4
+ export interface CreateWebsiteParams {
5
+ app_name: string;
6
+ domain: string;
7
+ [key: string]: any;
8
+ }
9
+
10
+ export interface UpdateWebsiteParams {
11
+ app_name?: string;
12
+ domain?: string;
13
+ [key: string]: any;
14
+ }
15
+
4
16
  export class WebsiteService extends BaseService {
5
- async getWebsite(options?: RequestInit): Promise<Website> {
17
+ async getWebsites(options?: RequestInit): Promise<Website[]> {
18
+ const { data } = await this.client.get<ApiCollectionResponse<Website>>("/websites", options);
19
+ return data;
20
+ }
21
+
22
+ async getWebsite(id?: string, options?: RequestInit): Promise<Website> {
23
+ if (id) {
24
+ const { data } = await this.client.get<ApiSingleResponse<Website>>(`/websites/${id}`, options);
25
+ return data;
26
+ }
6
27
  const res = await this.client.get<ApiCollectionResponse<Website>>("/websites", options);
7
28
  return res.data[0];
8
29
  }
9
30
 
10
- async routes(options?: RequestInit): Promise<string[]> {
11
- const website = await this.getWebsite(options);
31
+ async createWebsite(params: CreateWebsiteParams, options?: RequestInit): Promise<Website> {
32
+ const { data } = await this.client.post<ApiSingleResponse<Website>>("/websites", params, options);
33
+ return data;
34
+ }
35
+
36
+ async updateWebsite(id: string, params: UpdateWebsiteParams, options?: RequestInit): Promise<Website> {
37
+ const { data } = await this.client.put<ApiSingleResponse<Website>>(`/websites/${id}`, params, options);
38
+ return data;
39
+ }
12
40
 
13
- return this.client.get<string[]>(`/websites/${website.id}/routes`, options);
41
+ async routes(websiteId?: string, options?: RequestInit): Promise<string[]> {
42
+ const id = websiteId || (await this.getWebsite()).id;
43
+ return this.client.get<string[]>(`/websites/${id}/routes`, options);
14
44
  }
15
45
  }
package/src/index.ts CHANGED
@@ -6,13 +6,20 @@ export { BackstageClient } from "./client.js";
6
6
 
7
7
  // Re-export endpoints
8
8
  export * from "./endpoints/alerts.js";
9
+ export * from "./endpoints/auth.js";
10
+ export * from "./endpoints/blocks.js";
11
+ export * from "./endpoints/entries.js";
9
12
  export * from "./endpoints/events.js";
13
+ export * from "./endpoints/forms.js";
14
+ export * from "./endpoints/instagram.js";
15
+ export * from "./endpoints/layouts.js";
10
16
  export * from "./endpoints/locations.js";
11
17
  export * from "./endpoints/media.js";
12
18
  export * from "./endpoints/menus.js";
13
19
  export * from "./endpoints/navigation.js";
14
20
  export * from "./endpoints/pages.js";
15
21
  export * from "./endpoints/press.js";
22
+ export * from "./endpoints/redirects.js";
16
23
  export * from "./endpoints/routes.js";
17
24
  export * from "./endpoints/website.js";
18
25
 
@@ -0,0 +1,9 @@
1
+ export interface AccountBlock {
2
+ id: string;
3
+ account_id: string;
4
+ slug: string;
5
+ name: string;
6
+ schema: any;
7
+ created_at: string;
8
+ updated_at: string;
9
+ }
@@ -0,0 +1,14 @@
1
+ export interface AccountLayout {
2
+ id: string;
3
+ name: string;
4
+ slug: string;
5
+ schema: {
6
+ fields: Array<{
7
+ slug: string;
8
+ name: string;
9
+ type: string;
10
+ [key: string]: any;
11
+ }>;
12
+ };
13
+ data: Record<string, any>;
14
+ }
@@ -0,0 +1,10 @@
1
+ export interface Blueprint {
2
+ id: string;
3
+ account_id: string;
4
+ name: string;
5
+ slug: string;
6
+ description: string | null;
7
+ schema: any;
8
+ created_at: string;
9
+ updated_at: string;
10
+ }
@@ -0,0 +1,38 @@
1
+ import { Location } from "./location";
2
+
3
+ export interface EntryField {
4
+ id: string;
5
+ name: string;
6
+ slug: string;
7
+ type: string;
8
+ options: any;
9
+ order: number;
10
+ }
11
+
12
+ export interface EntryValue {
13
+ id: string;
14
+ entry_id: string;
15
+ field_id: string;
16
+ value: any;
17
+ }
18
+
19
+ export interface Entry {
20
+ id: string;
21
+ account_id: string;
22
+ blueprint_id: string;
23
+ status: string;
24
+ slug: string;
25
+ location: Location | null;
26
+ fields: EntryField[];
27
+ data: Record<string, any>;
28
+ unstable_data: Record<string, any>;
29
+ seo: {
30
+ title?: string;
31
+ description?: string;
32
+ } | null;
33
+ primary_field_name: string | null;
34
+ primary_field_accessor: string | null;
35
+ primary_field_value: any;
36
+ created_at: string;
37
+ updated_at: string;
38
+ }
@@ -3,12 +3,15 @@ import { MediaItem } from "./media-item";
3
3
  export interface Event {
4
4
  id: number;
5
5
  title: string;
6
+ slug: string;
6
7
  short_description: string;
7
8
  description: string;
8
- start_time: string; // or Date if the date is being converted before being used in TypeScript
9
- end_time: string; // or Date if the date is being converted before being used in TypeScript
9
+ is_featured: boolean;
10
+ start_time: string;
11
+ end_time: string;
10
12
  timezone: string;
11
13
  cover_media_id: number;
12
- cover_media: MediaItem; // Replace 'any' with the actual type of the cover_media
14
+ cover_media: MediaItem;
13
15
  account_id: number;
16
+ ticket_uri: string | null;
14
17
  }
@@ -1,5 +1,9 @@
1
+ export type * from "./account-block";
2
+ export type * from "./account-layout";
1
3
  export type * from "./alert";
2
4
  export type * from "./api";
5
+ export type * from "./blueprint";
6
+ export type * from "./entry";
3
7
  export type * from "./event";
4
8
  export type * from "./instagram";
5
9
  export type * from "./location";
@@ -11,6 +15,7 @@ export type * from "./menu";
11
15
  export type * from "./navigation";
12
16
  export type * from "./page";
13
17
  export type * from "./press";
18
+ export type * from "./redirect";
14
19
  export type * from "./route";
15
20
  export type * from "./website";
16
21
 
@@ -1,3 +1,5 @@
1
+ import { Menu } from "./menu";
2
+
1
3
  export interface Location {
2
4
  id: string;
3
5
  account_id: string;
@@ -13,6 +15,8 @@ export interface Location {
13
15
  zip: string;
14
16
  map_link: string | null;
15
17
  map_embed: string | null;
18
+ map_embed_query: string | null;
19
+ map_embed_zoom: number | null;
16
20
  latitude: number | null;
17
21
  longitude: number | null;
18
22
  phone: string;
@@ -64,6 +68,7 @@ export interface Location {
64
68
  height: number;
65
69
  alt: string;
66
70
  };
71
+ menus: Menu[];
67
72
  status: string;
68
73
  status_text: string;
69
74
  }
@@ -1,10 +1,14 @@
1
1
  export interface MediaItem {
2
2
  id: string;
3
+ uuid: string;
4
+ name: string;
3
5
  file_name: string;
6
+ alt: string;
4
7
  url: string;
5
- transform_url: string;
8
+ extension: string;
9
+ size: number;
10
+ thumb: string;
6
11
  path: string;
7
12
  width: number;
8
13
  height: number;
9
- alt: string;
10
14
  }
package/src/types/menu.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { MenuCategory } from "./menu-category";
2
+
1
3
  export interface Menu {
2
4
  id: string;
3
5
  slug: string;
@@ -6,7 +8,10 @@ export interface Menu {
6
8
  subtitle: string | null;
7
9
  account_id: string;
8
10
  pdf_url: string | null;
9
- categories: string[]; // You can replace this with the actual type for categories if needed
11
+ categories: MenuCategory[];
12
+ published_at: string | null;
10
13
  created_at: string;
11
14
  updated_at: string;
15
+ // Pivot fields when attached to a location
16
+ order?: number;
12
17
  }
package/src/types/page.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { AccountLayout } from "./account-layout";
2
+
1
3
  export interface Block {
2
4
  id: string;
3
5
  slug: string;
@@ -17,15 +19,10 @@ export interface Page {
17
19
  id: string;
18
20
  title: string;
19
21
  slug: string;
22
+ pathname: string;
20
23
  blocks: Block[];
21
24
  settings: Settings;
22
25
  meta: Meta;
23
26
  is_home: boolean;
24
- pathname: string;
25
- layout: {
26
- id: string;
27
- name: string;
28
- slug: string;
29
- schema: any;
30
- };
27
+ layout: AccountLayout | null;
31
28
  }
@@ -0,0 +1,9 @@
1
+ export interface Redirect {
2
+ id: string;
3
+ account_id: string;
4
+ source_url: string;
5
+ target_url: string;
6
+ status_code: number;
7
+ created_at: string;
8
+ updated_at: string;
9
+ }
@@ -11,6 +11,7 @@ export interface FontFamily {
11
11
  }
12
12
 
13
13
  export interface ThemeColors {
14
+ palette?: Array<{ name: string; value: string }>;
14
15
  primary?: string;
15
16
  primaryForeground: string;
16
17
  secondary?: string;
@@ -83,6 +84,7 @@ export interface Website {
83
84
  app_name: string;
84
85
  domain: string;
85
86
  favicon_url: string | null;
87
+ apple_icon_url: string | null;
86
88
  logo: Logo | null;
87
89
  account: Account;
88
90
  meta: WebsiteMeta;
@@ -99,5 +101,4 @@ export interface Website {
99
101
  social_links: SocialLink[];
100
102
  home_cta_text: string | null;
101
103
  home_cta_url: string | null;
102
- has_accessibility_widget: boolean;
103
104
  }
package/src/util/event.ts CHANGED
@@ -71,7 +71,7 @@ export function makeEventSchema(website: Website, event: Event, locations: Locat
71
71
  ],
72
72
  image: {
73
73
  "@type": "ImageObject",
74
- url: event.cover_media?.transform_url,
74
+ url: event.cover_media?.url,
75
75
  },
76
76
  };
77
77
  }