@antlur/backstage 1.12.9 → 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.
- package/dist/client.d.ts +8 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +12 -0
- package/dist/endpoints/auth.d.ts +42 -0
- package/dist/endpoints/auth.d.ts.map +1 -0
- package/dist/endpoints/auth.js +28 -0
- package/dist/endpoints/blocks.d.ts +13 -9
- package/dist/endpoints/blocks.d.ts.map +1 -1
- package/dist/endpoints/blocks.js +19 -10
- package/dist/endpoints/entries.d.ts +31 -0
- package/dist/endpoints/entries.d.ts.map +1 -0
- package/dist/endpoints/entries.js +31 -0
- package/dist/endpoints/forms.d.ts +8 -0
- package/dist/endpoints/forms.d.ts.map +1 -0
- package/dist/endpoints/forms.js +7 -0
- package/dist/endpoints/layouts.d.ts +12 -5
- package/dist/endpoints/layouts.d.ts.map +1 -1
- package/dist/endpoints/layouts.js +23 -8
- package/dist/endpoints/menus.d.ts +15 -0
- package/dist/endpoints/menus.d.ts.map +1 -1
- package/dist/endpoints/menus.js +11 -0
- package/dist/endpoints/pages.d.ts +23 -0
- package/dist/endpoints/pages.d.ts.map +1 -1
- package/dist/endpoints/pages.js +11 -0
- package/dist/endpoints/redirects.d.ts +6 -0
- package/dist/endpoints/redirects.d.ts.map +1 -0
- package/dist/endpoints/redirects.js +7 -0
- package/dist/endpoints/website.d.ts +15 -2
- package/dist/endpoints/website.d.ts.map +1 -1
- package/dist/endpoints/website.js +20 -4
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/package.json +1 -1
- package/src/client.ts +12 -0
- package/src/endpoints/auth.ts +68 -0
- package/src/endpoints/blocks.ts +31 -14
- package/src/endpoints/entries.ts +62 -0
- package/src/endpoints/forms.ts +12 -0
- package/src/endpoints/layouts.ts +31 -13
- package/src/endpoints/menus.ts +29 -1
- package/src/endpoints/pages.ts +37 -1
- package/src/endpoints/redirects.ts +9 -0
- package/src/endpoints/website.ts +35 -5
- package/src/index.ts +7 -0
package/dist/client.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { BackstageUserConfig } from "./config.js";
|
|
2
2
|
import { AlertService } from "./endpoints/alerts.js";
|
|
3
|
+
import { AuthService } from "./endpoints/auth.js";
|
|
3
4
|
import { BlocksService } from "./endpoints/blocks.js";
|
|
5
|
+
import { EntryService } from "./endpoints/entries.js";
|
|
4
6
|
import { EventService } from "./endpoints/events.js";
|
|
7
|
+
import { FormService } from "./endpoints/forms.js";
|
|
5
8
|
import { InstagramService } from "./endpoints/instagram.js";
|
|
6
9
|
import { LayoutService } from "./endpoints/layouts.js";
|
|
7
10
|
import { LocationService } from "./endpoints/locations.js";
|
|
@@ -9,6 +12,7 @@ import { MenuService } from "./endpoints/menus.js";
|
|
|
9
12
|
import { NavigationService } from "./endpoints/navigation.js";
|
|
10
13
|
import { PageService } from "./endpoints/pages.js";
|
|
11
14
|
import { PressService } from "./endpoints/press.js";
|
|
15
|
+
import { RedirectService } from "./endpoints/redirects.js";
|
|
12
16
|
import { RouteService } from "./endpoints/routes.js";
|
|
13
17
|
import { WebsiteService } from "./endpoints/website.js";
|
|
14
18
|
import { MediaService } from "./endpoints/media.js";
|
|
@@ -18,8 +22,11 @@ export declare class BackstageClient {
|
|
|
18
22
|
private accountId;
|
|
19
23
|
private onError?;
|
|
20
24
|
readonly alerts: AlertService;
|
|
25
|
+
readonly auth: AuthService;
|
|
21
26
|
readonly blocks: BlocksService;
|
|
27
|
+
readonly entries: EntryService;
|
|
22
28
|
readonly events: EventService;
|
|
29
|
+
readonly forms: FormService;
|
|
23
30
|
readonly instagram: InstagramService;
|
|
24
31
|
readonly layouts: LayoutService;
|
|
25
32
|
readonly locations: LocationService;
|
|
@@ -28,6 +35,7 @@ export declare class BackstageClient {
|
|
|
28
35
|
readonly navigation: NavigationService;
|
|
29
36
|
readonly pages: PageService;
|
|
30
37
|
readonly press: PressService;
|
|
38
|
+
readonly redirects: RedirectService;
|
|
31
39
|
readonly routes: RouteService;
|
|
32
40
|
readonly website: WebsiteService;
|
|
33
41
|
constructor(config?: BackstageUserConfig);
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD,qBAAa,eAAe;IAC1B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAC,CAAyB;IAGzC,SAAgB,MAAM,EAAE,YAAY,CAAC;IACrC,SAAgB,MAAM,EAAE,aAAa,CAAC;IACtC,SAAgB,MAAM,EAAE,YAAY,CAAC;IACrC,SA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,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;IAIjF,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;IAIhF,KAAK,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;IAIlF,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;CAGjF"}
|
package/dist/client.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { getGlobalConfig } from "./config.js";
|
|
2
2
|
import { AlertService } from "./endpoints/alerts.js";
|
|
3
|
+
import { AuthService } from "./endpoints/auth.js";
|
|
3
4
|
import { BlocksService } from "./endpoints/blocks.js";
|
|
5
|
+
import { EntryService } from "./endpoints/entries.js";
|
|
4
6
|
import { EventService } from "./endpoints/events.js";
|
|
7
|
+
import { FormService } from "./endpoints/forms.js";
|
|
5
8
|
import { InstagramService } from "./endpoints/instagram.js";
|
|
6
9
|
import { LayoutService } from "./endpoints/layouts.js";
|
|
7
10
|
import { LocationService } from "./endpoints/locations.js";
|
|
@@ -9,6 +12,7 @@ import { MenuService } from "./endpoints/menus.js";
|
|
|
9
12
|
import { NavigationService } from "./endpoints/navigation.js";
|
|
10
13
|
import { PageService } from "./endpoints/pages.js";
|
|
11
14
|
import { PressService } from "./endpoints/press.js";
|
|
15
|
+
import { RedirectService } from "./endpoints/redirects.js";
|
|
12
16
|
import { RouteService } from "./endpoints/routes.js";
|
|
13
17
|
import { WebsiteService } from "./endpoints/website.js";
|
|
14
18
|
import { MediaService } from "./endpoints/media.js";
|
|
@@ -19,8 +23,11 @@ export class BackstageClient {
|
|
|
19
23
|
onError;
|
|
20
24
|
// Service Instances
|
|
21
25
|
alerts;
|
|
26
|
+
auth;
|
|
22
27
|
blocks;
|
|
28
|
+
entries;
|
|
23
29
|
events;
|
|
30
|
+
forms;
|
|
24
31
|
instagram;
|
|
25
32
|
layouts;
|
|
26
33
|
locations;
|
|
@@ -29,6 +36,7 @@ export class BackstageClient {
|
|
|
29
36
|
navigation;
|
|
30
37
|
pages;
|
|
31
38
|
press;
|
|
39
|
+
redirects;
|
|
32
40
|
routes;
|
|
33
41
|
website;
|
|
34
42
|
constructor(config) {
|
|
@@ -51,8 +59,11 @@ export class BackstageClient {
|
|
|
51
59
|
this.onError = finalConfig.onError;
|
|
52
60
|
// Initialize service instances
|
|
53
61
|
this.alerts = new AlertService(this);
|
|
62
|
+
this.auth = new AuthService(this);
|
|
54
63
|
this.blocks = new BlocksService(this);
|
|
64
|
+
this.entries = new EntryService(this);
|
|
55
65
|
this.events = new EventService(this);
|
|
66
|
+
this.forms = new FormService(this);
|
|
56
67
|
this.instagram = new InstagramService(this);
|
|
57
68
|
this.layouts = new LayoutService(this);
|
|
58
69
|
this.locations = new LocationService(this);
|
|
@@ -61,6 +72,7 @@ export class BackstageClient {
|
|
|
61
72
|
this.navigation = new NavigationService(this);
|
|
62
73
|
this.pages = new PageService(this);
|
|
63
74
|
this.press = new PressService(this);
|
|
75
|
+
this.redirects = new RedirectService(this);
|
|
64
76
|
this.routes = new RouteService(this);
|
|
65
77
|
this.website = new WebsiteService(this);
|
|
66
78
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { BaseService } from "./base.js";
|
|
2
|
+
export interface LoginCredentials {
|
|
3
|
+
email: string;
|
|
4
|
+
password: string;
|
|
5
|
+
}
|
|
6
|
+
export interface User {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
email: string;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
export interface TokenAbility {
|
|
13
|
+
action: string;
|
|
14
|
+
subject: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CreateTokenParams {
|
|
17
|
+
name: string;
|
|
18
|
+
abilities?: string[] | TokenAbility[];
|
|
19
|
+
expires_at?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface Token {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
token?: string;
|
|
25
|
+
abilities: string[];
|
|
26
|
+
last_used_at: string | null;
|
|
27
|
+
expires_at: string | null;
|
|
28
|
+
created_at: string;
|
|
29
|
+
updated_at: string;
|
|
30
|
+
}
|
|
31
|
+
export declare class AuthService extends BaseService {
|
|
32
|
+
login(credentials: LoginCredentials, options?: RequestInit): Promise<{
|
|
33
|
+
token: string;
|
|
34
|
+
user: User;
|
|
35
|
+
}>;
|
|
36
|
+
logout(options?: RequestInit): Promise<void>;
|
|
37
|
+
getUser(options?: RequestInit): Promise<User>;
|
|
38
|
+
createToken(params: CreateTokenParams, options?: RequestInit): Promise<Token>;
|
|
39
|
+
getTokens(options?: RequestInit): Promise<Token[]>;
|
|
40
|
+
revokeToken(tokenId: string, options?: RequestInit): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/endpoints/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MA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ials, options) {
|
|
4
|
+
const response = await this.client.post("/login", credentials, options);
|
|
5
|
+
return response;
|
|
6
|
+
}
|
|
7
|
+
async logout(options) {
|
|
8
|
+
await this.client.post("/logout", {}, options);
|
|
9
|
+
}
|
|
10
|
+
async getUser(options) {
|
|
11
|
+
const response = await this.client.get("/user", options);
|
|
12
|
+
return response;
|
|
13
|
+
}
|
|
14
|
+
async createToken(params, options) {
|
|
15
|
+
const response = await this.client.post("/tokens", params, options);
|
|
16
|
+
return response;
|
|
17
|
+
}
|
|
18
|
+
async getTokens(options) {
|
|
19
|
+
const response = await this.client.get("/tokens", options);
|
|
20
|
+
return response;
|
|
21
|
+
}
|
|
22
|
+
async revokeToken(tokenId, options) {
|
|
23
|
+
await this.client.delete(`/tokens`, {
|
|
24
|
+
...options,
|
|
25
|
+
body: JSON.stringify({ token_id: tokenId }),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
+
import type { AccountBlock } from "../types/index";
|
|
1
2
|
import { BaseService } from "./base.js";
|
|
2
|
-
interface
|
|
3
|
+
export interface CreateBlockParams {
|
|
3
4
|
name: string;
|
|
4
5
|
slug: string;
|
|
5
6
|
schema: any;
|
|
6
7
|
description?: string;
|
|
7
8
|
}
|
|
9
|
+
export interface UpdateBlockParams {
|
|
10
|
+
name?: string;
|
|
11
|
+
slug?: string;
|
|
12
|
+
schema?: any;
|
|
13
|
+
description?: string;
|
|
14
|
+
}
|
|
8
15
|
export declare class BlocksService extends BaseService {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
create(params: BlockParams, options?: RequestInit): Promise<BlockParams>;
|
|
15
|
-
update(id: string, params: BlockParams, options?: RequestInit): Promise<BlockParams>;
|
|
16
|
+
list(options?: RequestInit): Promise<AccountBlock[]>;
|
|
17
|
+
get(id: string, options?: RequestInit): Promise<AccountBlock | null>;
|
|
18
|
+
create(params: CreateBlockParams, options?: RequestInit): Promise<AccountBlock>;
|
|
19
|
+
update(id: string, params: UpdateBlockParams, options?: RequestInit): Promise<AccountBlock>;
|
|
20
|
+
delete(id: string, options?: RequestInit): Promise<void>;
|
|
16
21
|
}
|
|
17
|
-
export {};
|
|
18
22
|
//# sourceMappingURL=blocks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/endpoints/blocks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/endpoints/blocks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4C,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC7F,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,aAAc,SAAQ,WAAW;IACtC,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAKpD,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IASpE,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAK/E,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAK3F,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/D"}
|
package/dist/endpoints/blocks.js
CHANGED
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
import { BaseService } from "./base.js";
|
|
2
2
|
export class BlocksService extends BaseService {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
async
|
|
8
|
-
|
|
3
|
+
async list(options) {
|
|
4
|
+
const { data } = await this.client.get("/blocks", options);
|
|
5
|
+
return data;
|
|
6
|
+
}
|
|
7
|
+
async get(id, options) {
|
|
8
|
+
try {
|
|
9
|
+
const { data } = await this.client.get(`/blocks/${id}`, options);
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
9
15
|
}
|
|
10
16
|
async create(params, options) {
|
|
11
|
-
const
|
|
12
|
-
return
|
|
17
|
+
const { data } = await this.client.post("/blocks", params, options);
|
|
18
|
+
return data;
|
|
13
19
|
}
|
|
14
20
|
async update(id, params, options) {
|
|
15
|
-
const
|
|
16
|
-
return
|
|
21
|
+
const { data } = await this.client.put(`/blocks/${id}`, params, options);
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
async delete(id, options) {
|
|
25
|
+
await this.client.delete(`/blocks/${id}`, options);
|
|
17
26
|
}
|
|
18
27
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Entry } from "../types/index";
|
|
2
|
+
import { BaseService } from "./base.js";
|
|
3
|
+
export interface CreateEntryParams {
|
|
4
|
+
blueprint_id: string;
|
|
5
|
+
location_id?: string;
|
|
6
|
+
slug?: string;
|
|
7
|
+
data: Record<string, any>;
|
|
8
|
+
seo?: {
|
|
9
|
+
title?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
};
|
|
12
|
+
status?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface UpdateEntryParams {
|
|
15
|
+
slug?: string;
|
|
16
|
+
data?: Record<string, any>;
|
|
17
|
+
seo?: {
|
|
18
|
+
title?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
};
|
|
21
|
+
status?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare class EntryService extends BaseService {
|
|
24
|
+
getEntries(options?: RequestInit): Promise<Entry[]>;
|
|
25
|
+
getEntry(id: string, options?: RequestInit): Promise<Entry | null>;
|
|
26
|
+
getCollection(blueprintSlug: string, options?: RequestInit): Promise<Entry[]>;
|
|
27
|
+
createEntry(params: CreateEntryParams, options?: RequestInit): Promise<Entry>;
|
|
28
|
+
updateEntry(id: string, params: UpdateEntryParams, options?: RequestInit): Promise<Entry>;
|
|
29
|
+
deleteEntry(id: string, options?: RequestInit): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=entries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entries.d.ts","sourceRoot":"","sources":["../../src/endpoints/entries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4C,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,GAAG,CAAC,EAAE;QACJ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,YAAa,SAAQ,WAAW;IACrC,UAAU,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAKnD,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IASlE,aAAa,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAQ7E,WAAW,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC;IAK7E,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC;IAKzF,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAGpE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseService } from "./base.js";
|
|
2
|
+
export class EntryService extends BaseService {
|
|
3
|
+
async getEntries(options) {
|
|
4
|
+
const { data } = await this.client.get("/entries", options);
|
|
5
|
+
return data;
|
|
6
|
+
}
|
|
7
|
+
async getEntry(id, options) {
|
|
8
|
+
try {
|
|
9
|
+
const { data } = await this.client.get(`/entries/${id}`, options);
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
async getCollection(blueprintSlug, options) {
|
|
17
|
+
const { data } = await this.client.get(`/collections/${blueprintSlug}`, options);
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
20
|
+
async createEntry(params, options) {
|
|
21
|
+
const { data } = await this.client.post("/entries", params, options);
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
async updateEntry(id, params, options) {
|
|
25
|
+
const { data } = await this.client.put(`/entries/${id}`, params, options);
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
async deleteEntry(id, options) {
|
|
29
|
+
await this.client.delete(`/entries/${id}`, options);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseService } from "./base.js";
|
|
2
|
+
export interface FormSubmissionData {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
5
|
+
export declare class FormService extends BaseService {
|
|
6
|
+
submitForm(formId: string, data: FormSubmissionData, options?: RequestInit): Promise<any>;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=forms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forms.d.ts","sourceRoot":"","sources":["../../src/endpoints/forms.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,WAAW,kBAAkB;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,qBAAa,WAAY,SAAQ,WAAW;IACpC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC;CAIhG"}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
+
import type { AccountLayout } from "../types/index";
|
|
1
2
|
import { BaseService } from "./base.js";
|
|
2
|
-
interface
|
|
3
|
+
export interface CreateLayoutParams {
|
|
3
4
|
name: string;
|
|
4
5
|
slug: string;
|
|
5
6
|
schema: any;
|
|
6
7
|
}
|
|
8
|
+
export interface UpdateLayoutParams {
|
|
9
|
+
name?: string;
|
|
10
|
+
slug?: string;
|
|
11
|
+
schema?: any;
|
|
12
|
+
}
|
|
7
13
|
export declare class LayoutService extends BaseService {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
list(options?: RequestInit): Promise<AccountLayout[]>;
|
|
15
|
+
get(id: string, options?: RequestInit): Promise<AccountLayout | null>;
|
|
16
|
+
create(params: CreateLayoutParams, options?: RequestInit): Promise<AccountLayout>;
|
|
17
|
+
update(id: string, params: UpdateLayoutParams, options?: RequestInit): Promise<AccountLayout>;
|
|
18
|
+
delete(id: string, options?: RequestInit): Promise<void>;
|
|
11
19
|
}
|
|
12
|
-
export {};
|
|
13
20
|
//# sourceMappingURL=layouts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layouts.d.ts","sourceRoot":"","sources":["../../src/endpoints/layouts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"layouts.d.ts","sourceRoot":"","sources":["../../src/endpoints/layouts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4C,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,GAAG,CAAC;CACb;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,GAAG,CAAC;CACd;AAED,qBAAa,aAAc,SAAQ,WAAW;IACtC,IAAI,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAKrD,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IASrE,MAAM,CAAC,MAAM,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IAKjF,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IAK7F,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/D"}
|
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
import { BaseService } from "./base.js";
|
|
2
2
|
export class LayoutService extends BaseService {
|
|
3
|
-
async
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
async list(options) {
|
|
4
|
+
const { data } = await this.client.get("/layouts", options);
|
|
5
|
+
return data;
|
|
6
|
+
}
|
|
7
|
+
async get(id, options) {
|
|
8
|
+
try {
|
|
9
|
+
const { data } = await this.client.get(`/layouts/${id}`, options);
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
12
|
+
catch (error) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
async create(params, options) {
|
|
17
|
+
const { data } = await this.client.post("/layouts", params, options);
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
20
|
+
async update(id, params, options) {
|
|
21
|
+
const { data } = await this.client.put(`/layouts/${id}`, params, options);
|
|
22
|
+
return data;
|
|
23
|
+
}
|
|
24
|
+
async delete(id, options) {
|
|
25
|
+
await this.client.delete(`/layouts/${id}`, options);
|
|
11
26
|
}
|
|
12
27
|
}
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import type { Menu } from "../types/index";
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
|
+
export interface CreateMenuParams {
|
|
4
|
+
title: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
subtitle?: string;
|
|
7
|
+
is_default?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface UpdateMenuParams {
|
|
10
|
+
title?: string;
|
|
11
|
+
slug?: string;
|
|
12
|
+
subtitle?: string;
|
|
13
|
+
is_default?: boolean;
|
|
14
|
+
}
|
|
3
15
|
export declare class MenuService extends BaseService {
|
|
4
16
|
getMenus(options?: RequestInit): Promise<Menu[]>;
|
|
5
17
|
getMenu(id: string, options?: RequestInit): Promise<Menu | Menu[]>;
|
|
6
18
|
getMenuBySlug(slug: string, options?: RequestInit): Promise<Menu | Menu[]>;
|
|
19
|
+
createMenu(params: CreateMenuParams, options?: RequestInit): Promise<Menu>;
|
|
20
|
+
updateMenu(id: string, params: UpdateMenuParams, options?: RequestInit): Promise<Menu>;
|
|
21
|
+
deleteMenu(id: string, options?: RequestInit): Promise<void>;
|
|
7
22
|
}
|
|
8
23
|
//# sourceMappingURL=menus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menus.d.ts","sourceRoot":"","sources":["../../src/endpoints/menus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"menus.d.ts","sourceRoot":"","sources":["../../src/endpoints/menus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4C,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,qBAAa,WAAY,SAAQ,WAAW;IACpC,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAMhD,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW;IAczC,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW;IAcjD,UAAU,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1E,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAKtF,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE"}
|
package/dist/endpoints/menus.js
CHANGED
|
@@ -21,4 +21,15 @@ export class MenuService extends BaseService {
|
|
|
21
21
|
}
|
|
22
22
|
return data;
|
|
23
23
|
}
|
|
24
|
+
async createMenu(params, options) {
|
|
25
|
+
const { data } = await this.client.post("/menus", params, options);
|
|
26
|
+
return data;
|
|
27
|
+
}
|
|
28
|
+
async updateMenu(id, params, options) {
|
|
29
|
+
const { data } = await this.client.put(`/menus/${id}`, params, options);
|
|
30
|
+
return data;
|
|
31
|
+
}
|
|
32
|
+
async deleteMenu(id, options) {
|
|
33
|
+
await this.client.delete(`/menus/${id}`, options);
|
|
34
|
+
}
|
|
24
35
|
}
|
|
@@ -1,10 +1,33 @@
|
|
|
1
1
|
import type { Page } from "../types/index";
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
|
+
export interface CreatePageParams {
|
|
4
|
+
title: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
blocks?: any[];
|
|
7
|
+
settings?: any;
|
|
8
|
+
is_home?: boolean;
|
|
9
|
+
layout_id?: string;
|
|
10
|
+
seo_title?: string;
|
|
11
|
+
seo_description?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface UpdatePageParams {
|
|
14
|
+
title?: string;
|
|
15
|
+
slug?: string;
|
|
16
|
+
blocks?: any[];
|
|
17
|
+
settings?: any;
|
|
18
|
+
is_home?: boolean;
|
|
19
|
+
layout_id?: string;
|
|
20
|
+
seo_title?: string;
|
|
21
|
+
seo_description?: string;
|
|
22
|
+
}
|
|
3
23
|
export declare class PageService extends BaseService {
|
|
4
24
|
getPages(options?: RequestInit): Promise<Page[]>;
|
|
5
25
|
getPage(id: string, options?: RequestInit): Promise<Page | null>;
|
|
6
26
|
getPageBySlug(slug: string, options?: RequestInit): Promise<Page | null>;
|
|
7
27
|
getHomePage(options?: RequestInit): Promise<Page | null>;
|
|
8
28
|
getPageByPathname(pathname: string, options?: RequestInit): Promise<Page | null>;
|
|
29
|
+
createPage(params: CreatePageParams, options?: RequestInit): Promise<Page>;
|
|
30
|
+
updatePage(id: string, params: UpdatePageParams, options?: RequestInit): Promise<Page>;
|
|
31
|
+
deletePage(id: string, options?: RequestInit): Promise<void>;
|
|
9
32
|
}
|
|
10
33
|
//# sourceMappingURL=pages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/endpoints/pages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"pages.d.ts","sourceRoot":"","sources":["../../src/endpoints/pages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4C,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,QAAQ,CAA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AC,IAAI,CAAC;IAKtF,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CAGnE"}
|
package/dist/endpoints/pages.js
CHANGED
|
@@ -32,4 +32,15 @@ export class PageService extends BaseService {
|
|
|
32
32
|
}
|
|
33
33
|
return res.data[0];
|
|
34
34
|
}
|
|
35
|
+
async createPage(params, options) {
|
|
36
|
+
const { data } = await this.client.post("/pages", params, options);
|
|
37
|
+
return data;
|
|
38
|
+
}
|
|
39
|
+
async updatePage(id, params, options) {
|
|
40
|
+
const { data } = await this.client.put(`/pages/${id}`, params, options);
|
|
41
|
+
return data;
|
|
42
|
+
}
|
|
43
|
+
async deletePage(id, options) {
|
|
44
|
+
await this.client.delete(`/pages/${id}`, options);
|
|
45
|
+
}
|
|
35
46
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirects.d.ts","sourceRoot":"","sources":["../../src/endpoints/redirects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAyB,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,qBAAa,eAAgB,SAAQ,WAAW;IACxC,YAAY,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;CAI/D"}
|
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import type { Website } from "../types/index";
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
|
+
export interface CreateWebsiteParams {
|
|
4
|
+
app_name: string;
|
|
5
|
+
domain: string;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
export interface UpdateWebsiteParams {
|
|
9
|
+
app_name?: string;
|
|
10
|
+
domain?: string;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
3
13
|
export declare class WebsiteService extends BaseService {
|
|
4
|
-
|
|
5
|
-
|
|
14
|
+
getWebsites(options?: RequestInit): Promise<Website[]>;
|
|
15
|
+
getWebsite(id?: string, options?: RequestInit): Promise<Website>;
|
|
16
|
+
createWebsite(params: CreateWebsiteParams, options?: RequestInit): Promise<Website>;
|
|
17
|
+
updateWebsite(id: string, params: UpdateWebsiteParams, options?: RequestInit): Promise<Website>;
|
|
18
|
+
routes(websiteId?: string, options?: RequestInit): Promise<string[]>;
|
|
6
19
|
}
|
|
7
20
|
//# sourceMappingURL=website.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"website.d.ts","sourceRoot":"","sources":["../../src/endpoints/website.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"website.d.ts","sourceRoot":"","sources":["../../src/endpoints/website.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA4C,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,qBAAa,cAAe,SAAQ,WAAW;IACvC,WAAW,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAKtD,UAAU,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAShE,aAAa,CAAC,MAAM,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAKnF,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAK/F,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAI3E"}
|
|
@@ -1,11 +1,27 @@
|
|
|
1
1
|
import { BaseService } from "./base.js";
|
|
2
2
|
export class WebsiteService extends BaseService {
|
|
3
|
-
async
|
|
3
|
+
async getWebsites(options) {
|
|
4
|
+
const { data } = await this.client.get("/websites", options);
|
|
5
|
+
return data;
|
|
6
|
+
}
|
|
7
|
+
async getWebsite(id, options) {
|
|
8
|
+
if (id) {
|
|
9
|
+
const { data } = await this.client.get(`/websites/${id}`, options);
|
|
10
|
+
return data;
|
|
11
|
+
}
|
|
4
12
|
const res = await this.client.get("/websites", options);
|
|
5
13
|
return res.data[0];
|
|
6
14
|
}
|
|
7
|
-
async
|
|
8
|
-
const
|
|
9
|
-
return
|
|
15
|
+
async createWebsite(params, options) {
|
|
16
|
+
const { data } = await this.client.post("/websites", params, options);
|
|
17
|
+
return data;
|
|
18
|
+
}
|
|
19
|
+
async updateWebsite(id, params, options) {
|
|
20
|
+
const { data } = await this.client.put(`/websites/${id}`, params, options);
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
async routes(websiteId, options) {
|
|
24
|
+
const id = websiteId || (await this.getWebsite()).id;
|
|
25
|
+
return this.client.get(`/websites/${id}/routes`, options);
|
|
10
26
|
}
|
|
11
27
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
export { defineConfig, getGlobalConfig } from "./config.js";
|
|
2
2
|
export { BackstageClient } from "./client.js";
|
|
3
3
|
export * from "./endpoints/alerts.js";
|
|
4
|
+
export * from "./endpoints/auth.js";
|
|
5
|
+
export * from "./endpoints/blocks.js";
|
|
6
|
+
export * from "./endpoints/entries.js";
|
|
4
7
|
export * from "./endpoints/events.js";
|
|
8
|
+
export * from "./endpoints/forms.js";
|
|
9
|
+
export * from "./endpoints/instagram.js";
|
|
10
|
+
export * from "./endpoints/layouts.js";
|
|
5
11
|
export * from "./endpoints/locations.js";
|
|
6
12
|
export * from "./endpoints/media.js";
|
|
7
13
|
export * from "./endpoints/menus.js";
|
|
8
14
|
export * from "./endpoints/navigation.js";
|
|
9
15
|
export * from "./endpoints/pages.js";
|
|
10
16
|
export * from "./endpoints/press.js";
|
|
17
|
+
export * from "./endpoints/redirects.js";
|
|
11
18
|
export * from "./endpoints/routes.js";
|
|
12
19
|
export * from "./endpoints/website.js";
|
|
13
20
|
export * from "./types/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG5D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG5D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,13 +4,20 @@ export { defineConfig, getGlobalConfig } from "./config.js";
|
|
|
4
4
|
export { BackstageClient } from "./client.js";
|
|
5
5
|
// Re-export endpoints
|
|
6
6
|
export * from "./endpoints/alerts.js";
|
|
7
|
+
export * from "./endpoints/auth.js";
|
|
8
|
+
export * from "./endpoints/blocks.js";
|
|
9
|
+
export * from "./endpoints/entries.js";
|
|
7
10
|
export * from "./endpoints/events.js";
|
|
11
|
+
export * from "./endpoints/forms.js";
|
|
12
|
+
export * from "./endpoints/instagram.js";
|
|
13
|
+
export * from "./endpoints/layouts.js";
|
|
8
14
|
export * from "./endpoints/locations.js";
|
|
9
15
|
export * from "./endpoints/media.js";
|
|
10
16
|
export * from "./endpoints/menus.js";
|
|
11
17
|
export * from "./endpoints/navigation.js";
|
|
12
18
|
export * from "./endpoints/pages.js";
|
|
13
19
|
export * from "./endpoints/press.js";
|
|
20
|
+
export * from "./endpoints/redirects.js";
|
|
14
21
|
export * from "./endpoints/routes.js";
|
|
15
22
|
export * from "./endpoints/website.js";
|
|
16
23
|
// Re-export domain types
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { getGlobalConfig, BackstageUserConfig } from "./config.js";
|
|
2
2
|
import { AlertService } from "./endpoints/alerts.js";
|
|
3
|
+
import { AuthService } from "./endpoints/auth.js";
|
|
3
4
|
import { BlocksService } from "./endpoints/blocks.js";
|
|
5
|
+
import { EntryService } from "./endpoints/entries.js";
|
|
4
6
|
import { EventService } from "./endpoints/events.js";
|
|
7
|
+
import { FormService } from "./endpoints/forms.js";
|
|
5
8
|
import { InstagramService } from "./endpoints/instagram.js";
|
|
6
9
|
import { LayoutService } from "./endpoints/layouts.js";
|
|
7
10
|
import { LocationService } from "./endpoints/locations.js";
|
|
@@ -9,6 +12,7 @@ import { MenuService } from "./endpoints/menus.js";
|
|
|
9
12
|
import { NavigationService } from "./endpoints/navigation.js";
|
|
10
13
|
import { PageService } from "./endpoints/pages.js";
|
|
11
14
|
import { PressService } from "./endpoints/press.js";
|
|
15
|
+
import { RedirectService } from "./endpoints/redirects.js";
|
|
12
16
|
import { RouteService } from "./endpoints/routes.js";
|
|
13
17
|
import { WebsiteService } from "./endpoints/website.js";
|
|
14
18
|
import { MediaService } from "./endpoints/media.js";
|
|
@@ -21,8 +25,11 @@ export class BackstageClient {
|
|
|
21
25
|
|
|
22
26
|
// Service Instances
|
|
23
27
|
public readonly alerts: AlertService;
|
|
28
|
+
public readonly auth: AuthService;
|
|
24
29
|
public readonly blocks: BlocksService;
|
|
30
|
+
public readonly entries: EntryService;
|
|
25
31
|
public readonly events: EventService;
|
|
32
|
+
public readonly forms: FormService;
|
|
26
33
|
public readonly instagram: InstagramService;
|
|
27
34
|
public readonly layouts: LayoutService;
|
|
28
35
|
public readonly locations: LocationService;
|
|
@@ -31,6 +38,7 @@ export class BackstageClient {
|
|
|
31
38
|
public readonly navigation: NavigationService;
|
|
32
39
|
public readonly pages: PageService;
|
|
33
40
|
public readonly press: PressService;
|
|
41
|
+
public readonly redirects: RedirectService;
|
|
34
42
|
public readonly routes: RouteService;
|
|
35
43
|
public readonly website: WebsiteService;
|
|
36
44
|
|
|
@@ -59,8 +67,11 @@ export class BackstageClient {
|
|
|
59
67
|
|
|
60
68
|
// Initialize service instances
|
|
61
69
|
this.alerts = new AlertService(this);
|
|
70
|
+
this.auth = new AuthService(this);
|
|
62
71
|
this.blocks = new BlocksService(this);
|
|
72
|
+
this.entries = new EntryService(this);
|
|
63
73
|
this.events = new EventService(this);
|
|
74
|
+
this.forms = new FormService(this);
|
|
64
75
|
this.instagram = new InstagramService(this);
|
|
65
76
|
this.layouts = new LayoutService(this);
|
|
66
77
|
this.locations = new LocationService(this);
|
|
@@ -69,6 +80,7 @@ export class BackstageClient {
|
|
|
69
80
|
this.navigation = new NavigationService(this);
|
|
70
81
|
this.pages = new PageService(this);
|
|
71
82
|
this.press = new PressService(this);
|
|
83
|
+
this.redirects = new RedirectService(this);
|
|
72
84
|
this.routes = new RouteService(this);
|
|
73
85
|
this.website = new WebsiteService(this);
|
|
74
86
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { BaseService } from "./base.js";
|
|
2
|
+
|
|
3
|
+
export interface LoginCredentials {
|
|
4
|
+
email: string;
|
|
5
|
+
password: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface User {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
email: string;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface TokenAbility {
|
|
16
|
+
action: string;
|
|
17
|
+
subject: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface CreateTokenParams {
|
|
21
|
+
name: string;
|
|
22
|
+
abilities?: string[] | TokenAbility[];
|
|
23
|
+
expires_at?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface Token {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
token?: string; // Only present on creation
|
|
30
|
+
abilities: string[];
|
|
31
|
+
last_used_at: string | null;
|
|
32
|
+
expires_at: string | null;
|
|
33
|
+
created_at: string;
|
|
34
|
+
updated_at: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class AuthService extends BaseService {
|
|
38
|
+
async login(credentials: LoginCredentials, options?: RequestInit): Promise<{ token: string; user: User }> {
|
|
39
|
+
const response = await this.client.post<{ token: string; user: User }>("/login", credentials, options);
|
|
40
|
+
return response;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async logout(options?: RequestInit): Promise<void> {
|
|
44
|
+
await this.client.post("/logout", {}, options);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
async getUser(options?: RequestInit): Promise<User> {
|
|
48
|
+
const response = await this.client.get<User>("/user", options);
|
|
49
|
+
return response;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async createToken(params: CreateTokenParams, options?: RequestInit): Promise<Token> {
|
|
53
|
+
const response = await this.client.post<Token>("/tokens", params, options);
|
|
54
|
+
return response;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async getTokens(options?: RequestInit): Promise<Token[]> {
|
|
58
|
+
const response = await this.client.get<Token[]>("/tokens", options);
|
|
59
|
+
return response;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async revokeToken(tokenId: string, options?: RequestInit): Promise<void> {
|
|
63
|
+
await this.client.delete(`/tokens`, {
|
|
64
|
+
...options,
|
|
65
|
+
body: JSON.stringify({ token_id: tokenId }),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
package/src/endpoints/blocks.ts
CHANGED
|
@@ -1,29 +1,46 @@
|
|
|
1
|
-
import type { ApiSingleResponse } from "../types/index";
|
|
1
|
+
import type { ApiCollectionResponse, ApiSingleResponse, AccountBlock } from "../types/index";
|
|
2
2
|
import { BaseService } from "./base.js";
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface CreateBlockParams {
|
|
5
5
|
name: string;
|
|
6
6
|
slug: string;
|
|
7
7
|
schema: any;
|
|
8
8
|
description?: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
export interface UpdateBlockParams {
|
|
12
|
+
name?: string;
|
|
13
|
+
slug?: string;
|
|
14
|
+
schema?: any;
|
|
15
|
+
description?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
export class BlocksService extends BaseService {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
async list(options?: RequestInit): Promise<AccountBlock[]> {
|
|
20
|
+
const { data } = await this.client.get<ApiCollectionResponse<AccountBlock>>("/blocks", options);
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async get(id: string, options?: RequestInit): Promise<AccountBlock | null> {
|
|
25
|
+
try {
|
|
26
|
+
const { data } = await this.client.get<ApiSingleResponse<AccountBlock>>(`/blocks/${id}`, options);
|
|
27
|
+
return data;
|
|
28
|
+
} catch (error) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async create(params: CreateBlockParams, options?: RequestInit): Promise<AccountBlock> {
|
|
34
|
+
const { data } = await this.client.post<ApiSingleResponse<AccountBlock>>("/blocks", params, options);
|
|
35
|
+
return data;
|
|
18
36
|
}
|
|
19
37
|
|
|
20
|
-
async
|
|
21
|
-
const
|
|
22
|
-
return
|
|
38
|
+
async update(id: string, params: UpdateBlockParams, options?: RequestInit): Promise<AccountBlock> {
|
|
39
|
+
const { data } = await this.client.put<ApiSingleResponse<AccountBlock>>(`/blocks/${id}`, params, options);
|
|
40
|
+
return data;
|
|
23
41
|
}
|
|
24
42
|
|
|
25
|
-
async
|
|
26
|
-
|
|
27
|
-
return res.data;
|
|
43
|
+
async delete(id: string, options?: RequestInit): Promise<void> {
|
|
44
|
+
await this.client.delete(`/blocks/${id}`, options);
|
|
28
45
|
}
|
|
29
46
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ApiCollectionResponse, ApiSingleResponse, Entry } from "../types/index";
|
|
2
|
+
import { BaseService } from "./base.js";
|
|
3
|
+
|
|
4
|
+
export interface CreateEntryParams {
|
|
5
|
+
blueprint_id: string;
|
|
6
|
+
location_id?: string;
|
|
7
|
+
slug?: string;
|
|
8
|
+
data: Record<string, any>;
|
|
9
|
+
seo?: {
|
|
10
|
+
title?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
};
|
|
13
|
+
status?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface UpdateEntryParams {
|
|
17
|
+
slug?: string;
|
|
18
|
+
data?: Record<string, any>;
|
|
19
|
+
seo?: {
|
|
20
|
+
title?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
};
|
|
23
|
+
status?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export class EntryService extends BaseService {
|
|
27
|
+
async getEntries(options?: RequestInit): Promise<Entry[]> {
|
|
28
|
+
const { data } = await this.client.get<ApiCollectionResponse<Entry>>("/entries", options);
|
|
29
|
+
return data;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
async getEntry(id: string, options?: RequestInit): Promise<Entry | null> {
|
|
33
|
+
try {
|
|
34
|
+
const { data } = await this.client.get<ApiSingleResponse<Entry>>(`/entries/${id}`, options);
|
|
35
|
+
return data;
|
|
36
|
+
} catch (error) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async getCollection(blueprintSlug: string, options?: RequestInit): Promise<Entry[]> {
|
|
42
|
+
const { data } = await this.client.get<ApiCollectionResponse<Entry>>(
|
|
43
|
+
`/collections/${blueprintSlug}`,
|
|
44
|
+
options
|
|
45
|
+
);
|
|
46
|
+
return data;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async createEntry(params: CreateEntryParams, options?: RequestInit): Promise<Entry> {
|
|
50
|
+
const { data } = await this.client.post<ApiSingleResponse<Entry>>("/entries", params, options);
|
|
51
|
+
return data;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async updateEntry(id: string, params: UpdateEntryParams, options?: RequestInit): Promise<Entry> {
|
|
55
|
+
const { data } = await this.client.put<ApiSingleResponse<Entry>>(`/entries/${id}`, params, options);
|
|
56
|
+
return data;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async deleteEntry(id: string, options?: RequestInit): Promise<void> {
|
|
60
|
+
await this.client.delete(`/entries/${id}`, options);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseService } from "./base.js";
|
|
2
|
+
|
|
3
|
+
export interface FormSubmissionData {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export class FormService extends BaseService {
|
|
8
|
+
async submitForm(formId: string, data: FormSubmissionData, options?: RequestInit): Promise<any> {
|
|
9
|
+
const response = await this.client.post(`/wa/forms/${formId}`, data, options);
|
|
10
|
+
return response;
|
|
11
|
+
}
|
|
12
|
+
}
|
package/src/endpoints/layouts.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
14
|
-
const
|
|
15
|
-
return
|
|
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
|
|
19
|
-
|
|
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
|
}
|
package/src/endpoints/menus.ts
CHANGED
|
@@ -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
|
}
|
package/src/endpoints/pages.ts
CHANGED
|
@@ -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
|
+
}
|
package/src/endpoints/website.ts
CHANGED
|
@@ -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
|
|
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
|
|
11
|
-
const
|
|
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
|
-
|
|
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
|
|