@flexbe/sdk 0.2.42 → 0.2.44

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.
@@ -113,7 +113,7 @@ export class ApiClient {
113
113
  }
114
114
  get(url, config) {
115
115
  return __awaiter(this, void 0, void 0, function* () {
116
- return this.request(Object.assign(Object.assign({}, config), { url, method: 'GET' }));
116
+ return this.request(Object.assign({ cache: 'no-store', url, method: 'GET' }, config));
117
117
  });
118
118
  }
119
119
  post(url, data, config) {
@@ -46,7 +46,11 @@ export class Pages {
46
46
  */
47
47
  getPage(pageId) {
48
48
  return __awaiter(this, void 0, void 0, function* () {
49
- const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}`);
49
+ const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}`, {
50
+ params: {
51
+ v: Date.now().toString(32),
52
+ },
53
+ });
50
54
  return response.data;
51
55
  });
52
56
  }
@@ -304,7 +308,11 @@ export class Pages {
304
308
  */
305
309
  getVersion(pageId, versionId) {
306
310
  return __awaiter(this, void 0, void 0, function* () {
307
- const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions/${versionId}`);
311
+ const response = yield this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions/${versionId}`, {
312
+ params: {
313
+ v: Date.now().toString(32),
314
+ },
315
+ });
308
316
  return response.data;
309
317
  });
310
318
  }
@@ -0,0 +1,47 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ export class Sandbox {
11
+ constructor(api, siteId) {
12
+ this.api = api;
13
+ this.siteId = siteId;
14
+ }
15
+ /**
16
+ * Create or get existing sandbox
17
+ * @param branch - Git branch name for the sandbox
18
+ * @returns Promise with sandbox details including URLs and token
19
+ * @throws {UnauthorizedException} When the API key is invalid or expired
20
+ * @throws {ForbiddenException} When the user does not have permission to access this site
21
+ * @throws {BadRequestException} When the request is invalid or failed to create sandbox
22
+ * @throws {ServerException} When the server encounters an error
23
+ * @throws {TimeoutException} When the request times out
24
+ */
25
+ create(branch) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const request = { branch };
28
+ const response = yield this.api.post(`/sites/${this.siteId}/app/sandbox`, request);
29
+ return response.data;
30
+ });
31
+ }
32
+ /**
33
+ * Delete sandbox
34
+ * @param sandboxId - The sandbox ID to delete
35
+ * @throws {UnauthorizedException} When the API key is invalid or expired
36
+ * @throws {ForbiddenException} When the user does not have permission to access this site
37
+ * @throws {BadRequestException} When the request is invalid or failed to delete sandbox
38
+ * @throws {NotFoundException} When the sandbox is not found
39
+ * @throws {ServerException} When the server encounters an error
40
+ * @throws {TimeoutException} When the request times out
41
+ */
42
+ delete(sandboxId) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ yield this.api.delete(`/sites/${this.siteId}/app/sandbox/${sandboxId}`);
45
+ });
46
+ }
47
+ }
@@ -1,8 +1,10 @@
1
1
  import { Pages } from './pages';
2
+ import { Sandbox } from './sandbox';
2
3
  import { Stat } from './stat';
3
4
  export class SiteApi {
4
5
  constructor(api, siteId) {
5
6
  this.pages = new Pages(api, siteId);
7
+ this.sandbox = new Sandbox(api, siteId);
6
8
  this.stat = new Stat(api, siteId);
7
9
  }
8
10
  }
@@ -1,3 +1,4 @@
1
1
  export * from './client/client';
2
2
  export * from './client/pages';
3
+ export * from './client/sandbox';
3
4
  export * from './types';
@@ -2,6 +2,7 @@ export * from './meta';
2
2
  export * from './animations';
3
3
  export * from './pages';
4
4
  export * from './stat';
5
+ export * from './sandbox';
5
6
  export var FlexbeAuthType;
6
7
  (function (FlexbeAuthType) {
7
8
  FlexbeAuthType["API_KEY"] = "apiKey";
@@ -0,0 +1 @@
1
+ export {};
@@ -109,10 +109,20 @@ class ApiClient {
109
109
  }
110
110
  }
111
111
  async get(url, config) {
112
- return this.request({ ...config, url, method: 'GET' });
112
+ return this.request({
113
+ cache: 'no-store',
114
+ url,
115
+ method: 'GET',
116
+ ...config,
117
+ });
113
118
  }
114
119
  async post(url, data, config) {
115
- return this.request({ ...config, url, method: 'POST', body: JSON.stringify(data) });
120
+ return this.request({
121
+ ...config,
122
+ url,
123
+ method: 'POST',
124
+ body: JSON.stringify(data),
125
+ });
116
126
  }
117
127
  async put(url, data, config) {
118
128
  return this.request({ ...config, url, method: 'PUT', body: JSON.stringify(data) });
@@ -42,7 +42,11 @@ class Pages {
42
42
  * @throws {TimeoutException} When the request times out
43
43
  */
44
44
  async getPage(pageId) {
45
- const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}`);
45
+ const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}`, {
46
+ params: {
47
+ v: Date.now().toString(32),
48
+ },
49
+ });
46
50
  return response.data;
47
51
  }
48
52
  /**
@@ -272,7 +276,11 @@ class Pages {
272
276
  * @throws {TimeoutException} When the request times out
273
277
  */
274
278
  async getVersion(pageId, versionId) {
275
- const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions/${versionId}`);
279
+ const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions/${versionId}`, {
280
+ params: {
281
+ v: Date.now().toString(32),
282
+ },
283
+ });
276
284
  return response.data;
277
285
  }
278
286
  /**
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Sandbox = void 0;
4
+ class Sandbox {
5
+ constructor(api, siteId) {
6
+ this.api = api;
7
+ this.siteId = siteId;
8
+ }
9
+ /**
10
+ * Create or get existing sandbox
11
+ * @param branch - Git branch name for the sandbox
12
+ * @returns Promise with sandbox details including URLs and token
13
+ * @throws {UnauthorizedException} When the API key is invalid or expired
14
+ * @throws {ForbiddenException} When the user does not have permission to access this site
15
+ * @throws {BadRequestException} When the request is invalid or failed to create sandbox
16
+ * @throws {ServerException} When the server encounters an error
17
+ * @throws {TimeoutException} When the request times out
18
+ */
19
+ async create(branch) {
20
+ const request = { branch };
21
+ const response = await this.api.post(`/sites/${this.siteId}/app/sandbox`, request);
22
+ return response.data;
23
+ }
24
+ /**
25
+ * Delete sandbox
26
+ * @param sandboxId - The sandbox ID to delete
27
+ * @throws {UnauthorizedException} When the API key is invalid or expired
28
+ * @throws {ForbiddenException} When the user does not have permission to access this site
29
+ * @throws {BadRequestException} When the request is invalid or failed to delete sandbox
30
+ * @throws {NotFoundException} When the sandbox is not found
31
+ * @throws {ServerException} When the server encounters an error
32
+ * @throws {TimeoutException} When the request times out
33
+ */
34
+ async delete(sandboxId) {
35
+ await this.api.delete(`/sites/${this.siteId}/app/sandbox/${sandboxId}`);
36
+ }
37
+ }
38
+ exports.Sandbox = Sandbox;
@@ -2,10 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SiteApi = void 0;
4
4
  const pages_1 = require("./pages");
5
+ const sandbox_1 = require("./sandbox");
5
6
  const stat_1 = require("./stat");
6
7
  class SiteApi {
7
8
  constructor(api, siteId) {
8
9
  this.pages = new pages_1.Pages(api, siteId);
10
+ this.sandbox = new sandbox_1.Sandbox(api, siteId);
9
11
  this.stat = new stat_1.Stat(api, siteId);
10
12
  }
11
13
  }
package/dist/cjs/index.js CHANGED
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./client/client"), exports);
18
18
  __exportStar(require("./client/pages"), exports);
19
+ __exportStar(require("./client/sandbox"), exports);
19
20
  __exportStar(require("./types"), exports);
@@ -19,6 +19,7 @@ __exportStar(require("./meta"), exports);
19
19
  __exportStar(require("./animations"), exports);
20
20
  __exportStar(require("./pages"), exports);
21
21
  __exportStar(require("./stat"), exports);
22
+ __exportStar(require("./sandbox"), exports);
22
23
  var FlexbeAuthType;
23
24
  (function (FlexbeAuthType) {
24
25
  FlexbeAuthType["API_KEY"] = "apiKey";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -106,10 +106,20 @@ export class ApiClient {
106
106
  }
107
107
  }
108
108
  async get(url, config) {
109
- return this.request({ ...config, url, method: 'GET' });
109
+ return this.request({
110
+ cache: 'no-store',
111
+ url,
112
+ method: 'GET',
113
+ ...config,
114
+ });
110
115
  }
111
116
  async post(url, data, config) {
112
- return this.request({ ...config, url, method: 'POST', body: JSON.stringify(data) });
117
+ return this.request({
118
+ ...config,
119
+ url,
120
+ method: 'POST',
121
+ body: JSON.stringify(data),
122
+ });
113
123
  }
114
124
  async put(url, data, config) {
115
125
  return this.request({ ...config, url, method: 'PUT', body: JSON.stringify(data) });
@@ -39,7 +39,11 @@ export class Pages {
39
39
  * @throws {TimeoutException} When the request times out
40
40
  */
41
41
  async getPage(pageId) {
42
- const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}`);
42
+ const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}`, {
43
+ params: {
44
+ v: Date.now().toString(32),
45
+ },
46
+ });
43
47
  return response.data;
44
48
  }
45
49
  /**
@@ -269,7 +273,11 @@ export class Pages {
269
273
  * @throws {TimeoutException} When the request times out
270
274
  */
271
275
  async getVersion(pageId, versionId) {
272
- const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions/${versionId}`);
276
+ const response = await this.api.get(`/sites/${this.siteId}/pages/${pageId}/versions/${versionId}`, {
277
+ params: {
278
+ v: Date.now().toString(32),
279
+ },
280
+ });
273
281
  return response.data;
274
282
  }
275
283
  /**
@@ -0,0 +1,34 @@
1
+ export class Sandbox {
2
+ constructor(api, siteId) {
3
+ this.api = api;
4
+ this.siteId = siteId;
5
+ }
6
+ /**
7
+ * Create or get existing sandbox
8
+ * @param branch - Git branch name for the sandbox
9
+ * @returns Promise with sandbox details including URLs and token
10
+ * @throws {UnauthorizedException} When the API key is invalid or expired
11
+ * @throws {ForbiddenException} When the user does not have permission to access this site
12
+ * @throws {BadRequestException} When the request is invalid or failed to create sandbox
13
+ * @throws {ServerException} When the server encounters an error
14
+ * @throws {TimeoutException} When the request times out
15
+ */
16
+ async create(branch) {
17
+ const request = { branch };
18
+ const response = await this.api.post(`/sites/${this.siteId}/app/sandbox`, request);
19
+ return response.data;
20
+ }
21
+ /**
22
+ * Delete sandbox
23
+ * @param sandboxId - The sandbox ID to delete
24
+ * @throws {UnauthorizedException} When the API key is invalid or expired
25
+ * @throws {ForbiddenException} When the user does not have permission to access this site
26
+ * @throws {BadRequestException} When the request is invalid or failed to delete sandbox
27
+ * @throws {NotFoundException} When the sandbox is not found
28
+ * @throws {ServerException} When the server encounters an error
29
+ * @throws {TimeoutException} When the request times out
30
+ */
31
+ async delete(sandboxId) {
32
+ await this.api.delete(`/sites/${this.siteId}/app/sandbox/${sandboxId}`);
33
+ }
34
+ }
@@ -1,8 +1,10 @@
1
1
  import { Pages } from './pages';
2
+ import { Sandbox } from './sandbox';
2
3
  import { Stat } from './stat';
3
4
  export class SiteApi {
4
5
  constructor(api, siteId) {
5
6
  this.pages = new Pages(api, siteId);
7
+ this.sandbox = new Sandbox(api, siteId);
6
8
  this.stat = new Stat(api, siteId);
7
9
  }
8
10
  }
package/dist/esm/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './client/client';
2
2
  export * from './client/pages';
3
+ export * from './client/sandbox';
3
4
  export * from './types';
@@ -2,6 +2,7 @@ export * from './meta';
2
2
  export * from './animations';
3
3
  export * from './pages';
4
4
  export * from './stat';
5
+ export * from './sandbox';
5
6
  export var FlexbeAuthType;
6
7
  (function (FlexbeAuthType) {
7
8
  FlexbeAuthType["API_KEY"] = "apiKey";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ import type { ApiClient } from './api-client';
2
+ import type { SandboxResponse } from '../types/sandbox';
3
+ export declare class Sandbox {
4
+ private readonly api;
5
+ private readonly siteId;
6
+ constructor(api: ApiClient, siteId: number);
7
+ /**
8
+ * Create or get existing sandbox
9
+ * @param branch - Git branch name for the sandbox
10
+ * @returns Promise with sandbox details including URLs and token
11
+ * @throws {UnauthorizedException} When the API key is invalid or expired
12
+ * @throws {ForbiddenException} When the user does not have permission to access this site
13
+ * @throws {BadRequestException} When the request is invalid or failed to create sandbox
14
+ * @throws {ServerException} When the server encounters an error
15
+ * @throws {TimeoutException} When the request times out
16
+ */
17
+ create(branch: string): Promise<SandboxResponse>;
18
+ /**
19
+ * Delete sandbox
20
+ * @param sandboxId - The sandbox ID to delete
21
+ * @throws {UnauthorizedException} When the API key is invalid or expired
22
+ * @throws {ForbiddenException} When the user does not have permission to access this site
23
+ * @throws {BadRequestException} When the request is invalid or failed to delete sandbox
24
+ * @throws {NotFoundException} When the sandbox is not found
25
+ * @throws {ServerException} When the server encounters an error
26
+ * @throws {TimeoutException} When the request times out
27
+ */
28
+ delete(sandboxId: string): Promise<void>;
29
+ }
@@ -1,8 +1,10 @@
1
1
  import { Pages } from './pages';
2
+ import { Sandbox } from './sandbox';
2
3
  import { Stat } from './stat';
3
4
  import type { ApiClient } from './api-client';
4
5
  export declare class SiteApi {
5
6
  readonly pages: Pages;
7
+ readonly sandbox: Sandbox;
6
8
  readonly stat: Stat;
7
9
  constructor(api: ApiClient, siteId: number);
8
10
  }
@@ -1,3 +1,4 @@
1
1
  export * from './client/client';
2
2
  export * from './client/pages';
3
+ export * from './client/sandbox';
3
4
  export * from './types';
@@ -2,6 +2,7 @@ export * from './meta';
2
2
  export * from './animations';
3
3
  export * from './pages';
4
4
  export * from './stat';
5
+ export * from './sandbox';
5
6
  export declare enum FlexbeAuthType {
6
7
  API_KEY = "apiKey",
7
8
  BEARER = "bearer"
@@ -0,0 +1,10 @@
1
+ export interface CreateSandboxRequest {
2
+ branch: string;
3
+ }
4
+ export interface SandboxResponse {
5
+ id: string;
6
+ previewUrl: string;
7
+ controllerUrl: string;
8
+ ideUrl: string;
9
+ token: string;
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexbe/sdk",
3
- "version": "0.2.42",
3
+ "version": "0.2.44",
4
4
  "description": "TypeScript SDK for Flexbe API",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -14,16 +14,18 @@
14
14
  }
15
15
  },
16
16
  "scripts": {
17
- "build": "npm run build:esm && npm run build:cjs && npm run build:browser",
17
+ "build": "bun run build:esm && bun run build:cjs && bun run build:browser",
18
18
  "build:esm": "tsc -p tsconfig.esm.json",
19
19
  "build:cjs": "tsc -p tsconfig.cjs.json",
20
20
  "build:browser": "tsc -p tsconfig.browser.json",
21
21
  "dev": "tsc -p tsconfig.esm.json --watch",
22
22
  "test": "dotenv -e test/.env.test jest",
23
- "lint": "eslint src --ext .ts",
23
+ "lint": "eslint src --ext .ts --fix",
24
24
  "format": "prettier --write \"src/**/*.ts\"",
25
- "prepare": "npm run build",
26
- "prepublishOnly_": "npm test && npm run lint"
25
+ "prepare": "bun run build",
26
+ "prepublishOnly": "bun run lint",
27
+ "version": "changeset && changeset version",
28
+ "release": "changeset publish"
27
29
  },
28
30
  "keywords": [
29
31
  "flexbe",
@@ -42,23 +44,25 @@
42
44
  },
43
45
  "homepage": "https://github.com/flexbe/sdk-ts#readme",
44
46
  "devDependencies": {
45
- "@flexbe/eslint-config": "^1.0.7",
46
- "@types/jest": "^29.5.12",
47
- "@types/node": "^20.11.19",
48
- "dotenv-cli": "^7.4.1",
49
- "eslint": "^9.26.0",
50
- "jest": "^29.7.0",
51
- "ts-jest": "^29.1.2",
52
- "typescript": "~5.5.0"
47
+ "@changesets/cli": "^2.29.7",
48
+ "@flexbe/eslint-config": "^1.0.11",
49
+ "@types/jest": "^30.0.0",
50
+ "@types/node": "^24.3.1",
51
+ "dotenv-cli": "^10.0.0",
52
+ "eslint": "^9.35.0",
53
+ "jest": "^30.1.3",
54
+ "ts-jest": "^29.4.1",
55
+ "typescript": "~5.9.2"
53
56
  },
54
57
  "files": [
55
58
  "dist",
56
59
  "README.md"
57
60
  ],
58
61
  "engines": {
59
- "node": ">=16.0.0"
62
+ "node": ">=20.0.0"
60
63
  },
61
64
  "publishConfig": {
62
65
  "access": "public"
63
- }
66
+ },
67
+ "packageManager": "bun@1.2.21"
64
68
  }