@axium/server 0.26.1 → 0.26.2

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/api/acl.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { Permission } from '@axium/core/access';
1
2
  import * as z from 'zod';
2
3
  import * as acl from '../acl.js';
3
4
  import { parseBody, withError } from '../requests.js';
@@ -11,10 +12,7 @@ addRoute({
11
12
  async PUT(request, params) {
12
13
  const type = params.itemType;
13
14
  const itemId = params.itemId;
14
- const data = await parseBody(request, z.object({
15
- userId: z.uuid(),
16
- permission: z.number().int().min(0).max(5),
17
- }));
15
+ const data = await parseBody(request, z.object({ userId: z.uuid(), permission: Permission }));
18
16
  const share = await acl.createEntry(type, { ...data, itemId }).catch(withError('Failed to create access control'));
19
17
  return share;
20
18
  },
package/dist/cli.js CHANGED
@@ -544,7 +544,7 @@ try {
544
544
  secure: opt.ssl ? true : config.web.secure,
545
545
  ssl_cert: opt.ssl ? join(opt.ssl, 'cert.pem') : config.web.ssl_cert,
546
546
  ssl_key: opt.ssl ? join(opt.ssl, 'key.pem') : config.web.ssl_key,
547
- build: opt.build ? resolve(opt.build) : undefined,
547
+ build: opt.build ? resolve(opt.build) : config.web.build,
548
548
  });
549
549
  const port = !Number.isNaN(Number.parseInt(opt.port ?? '')) ? Number.parseInt(opt.port) : config.web.port;
550
550
  server.listen(port, () => {
package/dist/config.d.ts CHANGED
@@ -51,6 +51,7 @@ export declare const ConfigSchema: z.ZodObject<{
51
51
  secure: z.ZodOptional<z.ZodBoolean>;
52
52
  ssl_key: z.ZodOptional<z.ZodString>;
53
53
  ssl_cert: z.ZodOptional<z.ZodString>;
54
+ build: z.ZodOptional<z.ZodString>;
54
55
  }, z.core.$loose>>;
55
56
  }, z.core.$loose>;
56
57
  export interface Config extends z.infer<typeof ConfigSchema> {
@@ -124,6 +125,7 @@ export declare const FileSchema: z.ZodObject<{
124
125
  secure: z.ZodOptional<z.ZodBoolean>;
125
126
  ssl_key: z.ZodOptional<z.ZodString>;
126
127
  ssl_cert: z.ZodOptional<z.ZodString>;
128
+ build: z.ZodOptional<z.ZodString>;
127
129
  }, z.core.$loose>>>;
128
130
  }, z.core.$loose>;
129
131
  export interface File extends z.infer<typeof FileSchema> {
package/dist/config.js CHANGED
@@ -73,6 +73,7 @@ export const ConfigSchema = z
73
73
  secure: z.boolean(),
74
74
  ssl_key: z.string(),
75
75
  ssl_cert: z.string(),
76
+ build: z.string(),
76
77
  })
77
78
  .partial(),
78
79
  })
@@ -131,6 +132,7 @@ export const defaultConfig = {
131
132
  secure: true,
132
133
  ssl_key: resolve(dirs[0], 'ssl_key.pem'),
133
134
  ssl_cert: resolve(dirs[0], 'ssl_cert.pem'),
135
+ build: '../build/handler.js',
134
136
  },
135
137
  };
136
138
  const configShortcuts = {
@@ -197,7 +199,7 @@ export async function loadConfig(path, options = {}) {
197
199
  try {
198
200
  writeFileSync(path, '{}');
199
201
  }
200
- catch {
202
+ catch (e) {
201
203
  io.warn('Failed to create the main configuration file (/etc/axium/config.json): ' + e.message);
202
204
  return;
203
205
  }
@@ -212,6 +214,8 @@ export async function loadConfig(path, options = {}) {
212
214
  let file;
213
215
  try {
214
216
  file = FileSchema.parse(json);
217
+ if (file.web?.build)
218
+ file.web.build = resolve(dirname(path), file.web.build);
215
219
  }
216
220
  catch (e) {
217
221
  if (!options.loose)
@@ -90,7 +90,7 @@ export async function convertFromResponse(res, response) {
90
90
  res.off('close', cancel);
91
91
  res.off('error', cancel);
92
92
  // If the reader has already been interrupted with an error earlier,
93
- // then it will appear here, it is useless, but it needs to be catch.
93
+ // then it will appear here, it is useless, but it needs to be caught.
94
94
  reader.cancel(error).catch(() => { });
95
95
  if (error)
96
96
  res.destroy(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/server",
3
- "version": "0.26.1",
3
+ "version": "0.26.2",
4
4
  "author": "James Prevett <axium@jamespre.dev>",
5
5
  "funding": {
6
6
  "type": "individual",
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@axium/client": ">=0.6.0",
49
- "@axium/core": ">=0.9.0",
49
+ "@axium/core": ">=0.10.0",
50
50
  "kysely": "^0.28.0",
51
51
  "utilium": "^2.3.8",
52
52
  "zod": "^4.0.5"