@kapeta/local-cluster-service 0.30.0 → 0.31.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [0.31.0](https://github.com/kapetacom/local-cluster-service/compare/v0.30.1...v0.31.0) (2023-12-18)
2
+
3
+
4
+ ### Features
5
+
6
+ * Get/set pixel grid settings ([538b63a](https://github.com/kapetacom/local-cluster-service/commit/538b63a7039d29b24a50c2d37063fe90465bad36))
7
+
8
+ ## [0.30.1](https://github.com/kapetacom/local-cluster-service/compare/v0.30.0...v0.30.1) (2023-12-18)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * use cluster-config getEnvironment api instead of ENV ([#105](https://github.com/kapetacom/local-cluster-service/issues/105)) ([ca90d5a](https://github.com/kapetacom/local-cluster-service/commit/ca90d5a1841826c2903507900842823a2c5f8622))
14
+
1
15
  # [0.30.0](https://github.com/kapetacom/local-cluster-service/compare/v0.29.0...v0.30.0) (2023-12-14)
2
16
 
3
17
 
@@ -40,6 +40,22 @@ router.post('/release-channel', (req, res) => {
40
40
  filesystemManager_1.filesystemManager.setReleaseChannel(req.stringBody ?? '');
41
41
  res.sendStatus(204);
42
42
  });
43
+ router.get('/show-pixel-grid', (req, res) => {
44
+ res.send(filesystemManager_1.filesystemManager.getShowPixelGrid());
45
+ });
46
+ router.use('/show-pixel-grid', stringBody_1.stringBody);
47
+ router.post('/show-pixel-grid', (req, res) => {
48
+ filesystemManager_1.filesystemManager.setShowPixelGrid(req?.stringBody === 'true' ?? false);
49
+ res.sendStatus(204);
50
+ });
51
+ router.get('/snap-to-pixel-grid', (req, res) => {
52
+ res.send(filesystemManager_1.filesystemManager.getSnapToPixelGrid());
53
+ });
54
+ router.use('/snap-to-pixel-grid', stringBody_1.stringBody);
55
+ router.post('/snap-to-pixel-grid', (req, res) => {
56
+ filesystemManager_1.filesystemManager.setSnapToPixelGrid(req?.stringBody === 'true' ?? false);
57
+ res.sendStatus(204);
58
+ });
43
59
  router.use('/', (req, res, next) => {
44
60
  if (!req.query.path) {
45
61
  res.status(400).send({ error: 'Missing required query parameter "path"' });
@@ -18,6 +18,10 @@ declare class FilesystemManager {
18
18
  setEditor(editor: string): void;
19
19
  getReleaseChannel(): string | undefined;
20
20
  setReleaseChannel(channel: string): void;
21
+ getShowPixelGrid(): boolean | undefined;
22
+ setShowPixelGrid(show: boolean): void;
23
+ getSnapToPixelGrid(): boolean | undefined;
24
+ setSnapToPixelGrid(snap: boolean): void;
21
25
  }
22
26
  export declare const filesystemManager: FilesystemManager;
23
27
  export {};
@@ -16,6 +16,8 @@ const SECTION_ID = 'filesystem';
16
16
  const PROJECT_ROOT = 'project_root';
17
17
  const EDITOR = 'editor';
18
18
  const RELEASE_CHANNEL = 'release_channel';
19
+ const SHOW_PIXEL_GRID = 'show_pixel_grid';
20
+ const SNAP_TO_PIXEL_GRID = 'snap_to_pixel_grid';
19
21
  function isFile(path) {
20
22
  try {
21
23
  return fs_1.default.statSync(path).isFile();
@@ -100,5 +102,17 @@ class FilesystemManager {
100
102
  setReleaseChannel(channel) {
101
103
  storageService_1.storageService.put('app', RELEASE_CHANNEL, channel);
102
104
  }
105
+ getShowPixelGrid() {
106
+ return storageService_1.storageService.get('app', SHOW_PIXEL_GRID, false);
107
+ }
108
+ setShowPixelGrid(show) {
109
+ storageService_1.storageService.put('app', SHOW_PIXEL_GRID, show);
110
+ }
111
+ getSnapToPixelGrid() {
112
+ return storageService_1.storageService.get('app', SNAP_TO_PIXEL_GRID, false);
113
+ }
114
+ setSnapToPixelGrid(snap) {
115
+ storageService_1.storageService.put('app', SNAP_TO_PIXEL_GRID, snap);
116
+ }
103
117
  }
104
118
  exports.filesystemManager = new FilesystemManager();
@@ -19,7 +19,9 @@ const filesystemManager_1 = require("../filesystemManager");
19
19
  const nodejs_registry_utils_1 = require("@kapeta/nodejs-registry-utils");
20
20
  const progressListener_1 = require("../progressListener");
21
21
  const glob_1 = require("glob");
22
- const PROVIDERS_FILENAME = process.env.KAP_ENV === 'staging' ? 'default-providers-staging.tar.gz' : 'default-providers.tar.gz';
22
+ const PROVIDERS_FILENAME = local_cluster_config_1.default.getEnvironment() === 'staging'
23
+ ? 'default-providers-staging.tar.gz'
24
+ : 'default-providers.tar.gz';
23
25
  const DEFAULT_PROVIDERS_URL = `https://storage.googleapis.com/kapeta-production-cdn/archives/${PROVIDERS_FILENAME}`;
24
26
  const DEFAULT_PROJECT_HOME_DIR = 'KapetaProjects';
25
27
  const ARCHIVE_LOCAL_PREFIX = 'local';
@@ -40,6 +40,22 @@ router.post('/release-channel', (req, res) => {
40
40
  filesystemManager_1.filesystemManager.setReleaseChannel(req.stringBody ?? '');
41
41
  res.sendStatus(204);
42
42
  });
43
+ router.get('/show-pixel-grid', (req, res) => {
44
+ res.send(filesystemManager_1.filesystemManager.getShowPixelGrid());
45
+ });
46
+ router.use('/show-pixel-grid', stringBody_1.stringBody);
47
+ router.post('/show-pixel-grid', (req, res) => {
48
+ filesystemManager_1.filesystemManager.setShowPixelGrid(req?.stringBody === 'true' ?? false);
49
+ res.sendStatus(204);
50
+ });
51
+ router.get('/snap-to-pixel-grid', (req, res) => {
52
+ res.send(filesystemManager_1.filesystemManager.getSnapToPixelGrid());
53
+ });
54
+ router.use('/snap-to-pixel-grid', stringBody_1.stringBody);
55
+ router.post('/snap-to-pixel-grid', (req, res) => {
56
+ filesystemManager_1.filesystemManager.setSnapToPixelGrid(req?.stringBody === 'true' ?? false);
57
+ res.sendStatus(204);
58
+ });
43
59
  router.use('/', (req, res, next) => {
44
60
  if (!req.query.path) {
45
61
  res.status(400).send({ error: 'Missing required query parameter "path"' });
@@ -18,6 +18,10 @@ declare class FilesystemManager {
18
18
  setEditor(editor: string): void;
19
19
  getReleaseChannel(): string | undefined;
20
20
  setReleaseChannel(channel: string): void;
21
+ getShowPixelGrid(): boolean | undefined;
22
+ setShowPixelGrid(show: boolean): void;
23
+ getSnapToPixelGrid(): boolean | undefined;
24
+ setSnapToPixelGrid(snap: boolean): void;
21
25
  }
22
26
  export declare const filesystemManager: FilesystemManager;
23
27
  export {};
@@ -16,6 +16,8 @@ const SECTION_ID = 'filesystem';
16
16
  const PROJECT_ROOT = 'project_root';
17
17
  const EDITOR = 'editor';
18
18
  const RELEASE_CHANNEL = 'release_channel';
19
+ const SHOW_PIXEL_GRID = 'show_pixel_grid';
20
+ const SNAP_TO_PIXEL_GRID = 'snap_to_pixel_grid';
19
21
  function isFile(path) {
20
22
  try {
21
23
  return fs_1.default.statSync(path).isFile();
@@ -100,5 +102,17 @@ class FilesystemManager {
100
102
  setReleaseChannel(channel) {
101
103
  storageService_1.storageService.put('app', RELEASE_CHANNEL, channel);
102
104
  }
105
+ getShowPixelGrid() {
106
+ return storageService_1.storageService.get('app', SHOW_PIXEL_GRID, false);
107
+ }
108
+ setShowPixelGrid(show) {
109
+ storageService_1.storageService.put('app', SHOW_PIXEL_GRID, show);
110
+ }
111
+ getSnapToPixelGrid() {
112
+ return storageService_1.storageService.get('app', SNAP_TO_PIXEL_GRID, false);
113
+ }
114
+ setSnapToPixelGrid(snap) {
115
+ storageService_1.storageService.put('app', SNAP_TO_PIXEL_GRID, snap);
116
+ }
103
117
  }
104
118
  exports.filesystemManager = new FilesystemManager();
@@ -19,7 +19,9 @@ const filesystemManager_1 = require("../filesystemManager");
19
19
  const nodejs_registry_utils_1 = require("@kapeta/nodejs-registry-utils");
20
20
  const progressListener_1 = require("../progressListener");
21
21
  const glob_1 = require("glob");
22
- const PROVIDERS_FILENAME = process.env.KAP_ENV === 'staging' ? 'default-providers-staging.tar.gz' : 'default-providers.tar.gz';
22
+ const PROVIDERS_FILENAME = local_cluster_config_1.default.getEnvironment() === 'staging'
23
+ ? 'default-providers-staging.tar.gz'
24
+ : 'default-providers.tar.gz';
23
25
  const DEFAULT_PROVIDERS_URL = `https://storage.googleapis.com/kapeta-production-cdn/archives/${PROVIDERS_FILENAME}`;
24
26
  const DEFAULT_PROJECT_HOME_DIR = 'KapetaProjects';
25
27
  const ARCHIVE_LOCAL_PREFIX = 'local';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kapeta/local-cluster-service",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "description": "Manages configuration, ports and service discovery for locally running Kapeta systems",
5
5
  "type": "commonjs",
6
6
  "exports": {
@@ -48,7 +48,7 @@
48
48
  "homepage": "https://github.com/kapetacom/local-cluster-service#readme",
49
49
  "dependencies": {
50
50
  "@kapeta/codegen": "<2",
51
- "@kapeta/local-cluster-config": ">= 0.2.3 <2",
51
+ "@kapeta/local-cluster-config": ">= 0.3.0 <2",
52
52
  "@kapeta/nodejs-api-client": ">=0.1.3 <2",
53
53
  "@kapeta/nodejs-process": "<2",
54
54
  "@kapeta/nodejs-registry-utils": "<2",
@@ -50,6 +50,28 @@ router.post('/release-channel', (req: StringBodyRequest, res: Response) => {
50
50
  res.sendStatus(204);
51
51
  });
52
52
 
53
+ router.get('/show-pixel-grid', (req: Request, res: Response) => {
54
+ res.send(filesystemManager.getShowPixelGrid());
55
+ });
56
+
57
+ router.use('/show-pixel-grid', stringBody);
58
+
59
+ router.post('/show-pixel-grid', (req: StringBodyRequest, res: Response) => {
60
+ filesystemManager.setShowPixelGrid(req?.stringBody === 'true' ?? false);
61
+ res.sendStatus(204);
62
+ });
63
+
64
+ router.get('/snap-to-pixel-grid', (req: Request, res: Response) => {
65
+ res.send(filesystemManager.getSnapToPixelGrid());
66
+ });
67
+
68
+ router.use('/snap-to-pixel-grid', stringBody);
69
+
70
+ router.post('/snap-to-pixel-grid', (req: StringBodyRequest, res: Response) => {
71
+ filesystemManager.setSnapToPixelGrid(req?.stringBody === 'true' ?? false);
72
+ res.sendStatus(204);
73
+ });
74
+
53
75
  router.use('/', (req: Request, res: Response, next: NextFunction) => {
54
76
  if (!req.query.path) {
55
77
  res.status(400).send({ error: 'Missing required query parameter "path"' });
@@ -12,6 +12,8 @@ const SECTION_ID = 'filesystem';
12
12
  const PROJECT_ROOT = 'project_root';
13
13
  const EDITOR = 'editor';
14
14
  const RELEASE_CHANNEL = 'release_channel';
15
+ const SHOW_PIXEL_GRID = 'show_pixel_grid';
16
+ const SNAP_TO_PIXEL_GRID = 'snap_to_pixel_grid';
15
17
 
16
18
  function isFile(path: string) {
17
19
  try {
@@ -110,6 +112,22 @@ class FilesystemManager {
110
112
  setReleaseChannel(channel: string) {
111
113
  storageService.put('app', RELEASE_CHANNEL, channel);
112
114
  }
115
+
116
+ getShowPixelGrid() {
117
+ return storageService.get<boolean>('app', SHOW_PIXEL_GRID, false);
118
+ }
119
+
120
+ setShowPixelGrid(show: boolean) {
121
+ storageService.put('app', SHOW_PIXEL_GRID, show);
122
+ }
123
+
124
+ getSnapToPixelGrid() {
125
+ return storageService.get<boolean>('app', SNAP_TO_PIXEL_GRID, false);
126
+ }
127
+
128
+ setSnapToPixelGrid(snap: boolean) {
129
+ storageService.put('app', SNAP_TO_PIXEL_GRID, snap);
130
+ }
113
131
  }
114
132
 
115
133
  export const filesystemManager = new FilesystemManager();
@@ -16,7 +16,9 @@ import { ProgressListener } from '../progressListener';
16
16
  import { glob } from 'glob';
17
17
 
18
18
  const PROVIDERS_FILENAME =
19
- process.env.KAP_ENV === 'staging' ? 'default-providers-staging.tar.gz' : 'default-providers.tar.gz';
19
+ ClusterConfiguration.getEnvironment() === 'staging'
20
+ ? 'default-providers-staging.tar.gz'
21
+ : 'default-providers.tar.gz';
20
22
  const DEFAULT_PROVIDERS_URL = `https://storage.googleapis.com/kapeta-production-cdn/archives/${PROVIDERS_FILENAME}`;
21
23
  const DEFAULT_PROJECT_HOME_DIR = 'KapetaProjects';
22
24