@objectstack/hono 1.0.0 → 1.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @objectstack/hono
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 109fc5b: Unified patch release to align all package versions.
8
+ - Updated dependencies [a0a6c85]
9
+ - Updated dependencies [109fc5b]
10
+ - @objectstack/runtime@1.0.2
11
+
12
+ ## 1.0.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+ - @objectstack/runtime@1.0.1
18
+
3
19
  ## 1.0.0
4
20
 
5
21
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,KAAK,YAAY,EAAwC,MAAM,sBAAsB,CAAC;AAE/F,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,sBAAsB,8EAsK5D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,IAC1C,GAAG,GAAG,EAAE,MAAM,GAAG,mBAIhC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,EAAE,KAAK,YAAY,EAAwC,MAAM,sBAAsB,CAAC;AAE/F,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,sBAAsB,8EAmL5D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,IAC1C,GAAG,GAAG,EAAE,MAAM,GAAG,mBAIhC"}
package/dist/index.js CHANGED
@@ -68,7 +68,19 @@ function createHonoApp(options) {
68
68
  app.all(`${prefix}/metadata*`, async (c) => {
69
69
  try {
70
70
  const path = c.req.path.substring(c.req.path.indexOf('/metadata') + 9);
71
- const result = await dispatcher.handleMetadata(path, { request: c.req.raw });
71
+ const method = c.req.method;
72
+ let body = undefined;
73
+ if (method === 'PUT' || method === 'POST') {
74
+ // Attempt to parse JSON body
75
+ try {
76
+ body = await c.req.json();
77
+ }
78
+ catch (e) {
79
+ // Ignore parse errors, body remains undefined or empty
80
+ body = {};
81
+ }
82
+ }
83
+ const result = await dispatcher.handleMetadata(path, { request: c.req.raw }, method, body);
72
84
  return normalizeResponse(c, result);
73
85
  }
74
86
  catch (err) {
package/package.json CHANGED
@@ -1,17 +1,24 @@
1
1
  {
2
2
  "name": "@objectstack/hono",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.js"
12
+ }
13
+ },
7
14
  "peerDependencies": {
8
15
  "hono": "^4.0.0",
9
- "@objectstack/runtime": "1.0.0"
16
+ "@objectstack/runtime": "1.0.2"
10
17
  },
11
18
  "devDependencies": {
12
19
  "hono": "^4.0.0",
13
20
  "typescript": "^5.0.0",
14
- "@objectstack/runtime": "1.0.0"
21
+ "@objectstack/runtime": "1.0.2"
15
22
  },
16
23
  "scripts": {
17
24
  "build": "tsc"
package/src/index.ts CHANGED
@@ -76,7 +76,20 @@ export function createHonoApp(options: ObjectStackHonoOptions) {
76
76
  app.all(`${prefix}/metadata*`, async (c) => {
77
77
  try {
78
78
  const path = c.req.path.substring(c.req.path.indexOf('/metadata') + 9);
79
- const result = await dispatcher.handleMetadata(path, { request: c.req.raw });
79
+ const method = c.req.method;
80
+ let body = undefined;
81
+
82
+ if (method === 'PUT' || method === 'POST') {
83
+ // Attempt to parse JSON body
84
+ try {
85
+ body = await c.req.json();
86
+ } catch (e) {
87
+ // Ignore parse errors, body remains undefined or empty
88
+ body = {};
89
+ }
90
+ }
91
+
92
+ const result = await dispatcher.handleMetadata(path, { request: c.req.raw }, method, body);
80
93
  return normalizeResponse(c, result);
81
94
  } catch (err: any) {
82
95
  return c.json({ success: false, error: { message: err.message, code: err.statusCode || 500 } }, err.statusCode || 500);