@edgestore/server 0.4.0 → 0.5.1

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.
Files changed (69) hide show
  1. package/adapters/astro/index.d.ts +1 -0
  2. package/adapters/astro/index.js +1 -0
  3. package/adapters/hono/index.d.ts +1 -0
  4. package/adapters/hono/index.js +1 -0
  5. package/adapters/remix/index.d.ts +1 -0
  6. package/adapters/remix/index.js +1 -0
  7. package/dist/adapters/astro/index.d.ts +14 -0
  8. package/dist/adapters/astro/index.d.ts.map +1 -0
  9. package/dist/adapters/astro/index.js +183 -0
  10. package/dist/adapters/astro/index.mjs +179 -0
  11. package/dist/adapters/express/index.js +3 -3
  12. package/dist/adapters/express/index.mjs +3 -3
  13. package/dist/adapters/fastify/index.js +3 -3
  14. package/dist/adapters/fastify/index.mjs +3 -3
  15. package/dist/adapters/hono/index.d.ts +82 -0
  16. package/dist/adapters/hono/index.d.ts.map +1 -0
  17. package/dist/adapters/hono/index.js +137 -0
  18. package/dist/adapters/hono/index.mjs +133 -0
  19. package/dist/adapters/next/app/index.js +3 -3
  20. package/dist/adapters/next/app/index.mjs +3 -3
  21. package/dist/adapters/next/pages/index.js +3 -3
  22. package/dist/adapters/next/pages/index.mjs +3 -3
  23. package/dist/adapters/remix/index.d.ts +18 -0
  24. package/dist/adapters/remix/index.d.ts.map +1 -0
  25. package/dist/adapters/remix/index.js +158 -0
  26. package/dist/adapters/remix/index.mjs +154 -0
  27. package/dist/adapters/shared.d.ts +2 -0
  28. package/dist/adapters/shared.d.ts.map +1 -1
  29. package/dist/adapters/start/index.js +3 -3
  30. package/dist/adapters/start/index.mjs +3 -3
  31. package/dist/core/index.js +3 -3
  32. package/dist/core/index.mjs +4 -4
  33. package/dist/core/sdk/index.d.ts.map +1 -1
  34. package/dist/{index-a7cc3cd3.mjs → index-2848cb40.mjs} +3 -2
  35. package/dist/{index-474a21c4.js → index-421c502f.js} +3 -2
  36. package/dist/{index-b689bf59.js → index-7b259533.js} +5 -4
  37. package/dist/libs/logger.d.ts +1 -1
  38. package/dist/libs/logger.d.ts.map +1 -1
  39. package/dist/providers/aws/index.d.ts +15 -1
  40. package/dist/providers/aws/index.d.ts.map +1 -1
  41. package/dist/providers/aws/index.js +28 -8
  42. package/dist/providers/aws/index.mjs +28 -8
  43. package/dist/providers/azure/index.d.ts.map +1 -1
  44. package/dist/providers/azure/index.js +6 -1
  45. package/dist/providers/azure/index.mjs +6 -1
  46. package/dist/providers/edgestore/index.d.ts.map +1 -1
  47. package/dist/providers/edgestore/index.js +13 -6
  48. package/dist/providers/edgestore/index.mjs +10 -3
  49. package/dist/{shared-d27101a7.js → shared-25dbfab4.js} +17 -4
  50. package/dist/{shared-c9442cbb.mjs → shared-4b199b96.mjs} +16 -4
  51. package/dist/{shared-6f6fd0bd.js → shared-685c8a0c.js} +17 -3
  52. package/dist/{utils-5819d5e1.js → utils-0aab6e3b.js} +3 -1
  53. package/dist/{utils-f6f56d38.mjs → utils-7349adab.mjs} +3 -1
  54. package/dist/{utils-461a2e3b.js → utils-b3d35894.js} +3 -2
  55. package/package.json +20 -3
  56. package/src/adapters/astro/index.ts +222 -0
  57. package/src/adapters/hono/index.ts +195 -0
  58. package/src/adapters/remix/index.ts +201 -0
  59. package/src/adapters/shared.ts +20 -3
  60. package/src/core/client/index.ts +2 -2
  61. package/src/core/sdk/index.ts +4 -3
  62. package/src/libs/logger.ts +4 -3
  63. package/src/providers/aws/index.ts +66 -14
  64. package/src/providers/azure/index.ts +5 -4
  65. package/src/providers/edgestore/index.ts +8 -3
  66. package/adapters/index.d.ts +0 -1
  67. package/adapters/index.js +0 -1
  68. package/providers/index.d.ts +0 -1
  69. package/providers/index.js +0 -1
@@ -0,0 +1 @@
1
+ export * from '../../dist/adapters/astro';
@@ -0,0 +1 @@
1
+ module.exports = require('../../dist/adapters/astro');
@@ -0,0 +1 @@
1
+ export * from '../../dist/adapters/hono';
@@ -0,0 +1 @@
1
+ module.exports = require('../../dist/adapters/hono');
@@ -0,0 +1 @@
1
+ export * from '../../dist/adapters/remix';
@@ -0,0 +1 @@
1
+ module.exports = require('../../dist/adapters/remix');
@@ -0,0 +1,14 @@
1
+ import { type EdgeStoreRouter, type MaybePromise, type Provider } from '@edgestore/shared';
2
+ import type { APIContext } from 'astro';
3
+ import { type LogLevel } from '../../libs/logger';
4
+ export type Config<TCtx> = {
5
+ provider?: Provider;
6
+ router: EdgeStoreRouter<TCtx>;
7
+ logLevel?: LogLevel;
8
+ } & (TCtx extends Record<string, never> ? object : {
9
+ provider?: Provider;
10
+ router: EdgeStoreRouter<TCtx>;
11
+ createContext: (opts: APIContext) => MaybePromise<TCtx>;
12
+ });
13
+ export declare function createEdgeStoreAstroHandler<TCtx>(config: Config<TCtx>): (context: APIContext) => Promise<Response>;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/astro/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACxC,OAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAiB1D,MAAM,MAAM,MAAM,CAAC,IAAI,IAAI;IACzB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;IAC9B,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,GAAG,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACnC,MAAM,GACN;IACE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;IAC9B,aAAa,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CACzD,CAAC,CAAC;AAsBP,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,aAM7C,UAAU,uBA6JlC"}
@@ -0,0 +1,183 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var shared = require('@edgestore/shared');
6
+ var utils = require('../../utils-0aab6e3b.js');
7
+ var providers_edgestore_index = require('../../providers/edgestore/index.js');
8
+ var shared$1 = require('../../shared-685c8a0c.js');
9
+ require('../../index-7b259533.js');
10
+ require('@panva/hkdf');
11
+ require('cookie');
12
+ require('jose');
13
+ require('uuid');
14
+
15
+ // Helper to safely get cookies from Astro request
16
+ function getCookie(request, name) {
17
+ const cookieHeader = request.headers.get('cookie');
18
+ if (!cookieHeader) return undefined;
19
+ const cookies = cookieHeader.split(';').reduce((acc, cookie)=>{
20
+ const [key, value] = cookie.trim().split('=');
21
+ if (key && value) acc[key] = value;
22
+ return acc;
23
+ }, {});
24
+ return cookies[name];
25
+ }
26
+ function createEdgeStoreAstroHandler(config) {
27
+ const { provider = providers_edgestore_index.EdgeStoreProvider() } = config;
28
+ const log = new utils.Logger(config.logLevel);
29
+ globalThis._EDGE_STORE_LOGGER = log;
30
+ log.debug('Creating EdgeStore Astro handler');
31
+ return async (context)=>{
32
+ try {
33
+ const { request } = context;
34
+ const url = new URL(request.url);
35
+ if (utils.matchPath(url.pathname, 'health')) {
36
+ return new Response('OK');
37
+ } else if (utils.matchPath(url.pathname, 'init')) {
38
+ let ctx = {};
39
+ try {
40
+ ctx = 'createContext' in config ? await config.createContext(context) : {};
41
+ } catch (err) {
42
+ throw new shared.EdgeStoreError({
43
+ message: 'Error creating context',
44
+ code: 'CREATE_CONTEXT_ERROR',
45
+ cause: err instanceof Error ? err : undefined
46
+ });
47
+ }
48
+ const { newCookies, token, baseUrl } = await shared$1.init({
49
+ ctx,
50
+ provider,
51
+ router: config.router
52
+ });
53
+ const headers = new Headers();
54
+ headers.set('Content-Type', 'application/json');
55
+ // Set cookies
56
+ if (Array.isArray(newCookies)) {
57
+ for (const cookie of newCookies){
58
+ headers.append('Set-Cookie', cookie);
59
+ }
60
+ } else if (newCookies) {
61
+ headers.append('Set-Cookie', newCookies);
62
+ }
63
+ return new Response(JSON.stringify({
64
+ token,
65
+ baseUrl
66
+ }), {
67
+ headers
68
+ });
69
+ } else if (utils.matchPath(url.pathname, 'request-upload')) {
70
+ const body = await request.json();
71
+ const result = await shared$1.requestUpload({
72
+ provider,
73
+ router: config.router,
74
+ body,
75
+ ctxToken: getCookie(request, 'edgestore-ctx')
76
+ });
77
+ return new Response(JSON.stringify(result), {
78
+ headers: {
79
+ 'Content-Type': 'application/json'
80
+ }
81
+ });
82
+ } else if (utils.matchPath(url.pathname, 'request-upload-parts')) {
83
+ const body = await request.json();
84
+ const result = await shared$1.requestUploadParts({
85
+ provider,
86
+ router: config.router,
87
+ body,
88
+ ctxToken: getCookie(request, 'edgestore-ctx')
89
+ });
90
+ return new Response(JSON.stringify(result), {
91
+ headers: {
92
+ 'Content-Type': 'application/json'
93
+ }
94
+ });
95
+ } else if (utils.matchPath(url.pathname, 'complete-multipart-upload')) {
96
+ const body = await request.json();
97
+ await shared$1.completeMultipartUpload({
98
+ provider,
99
+ router: config.router,
100
+ body,
101
+ ctxToken: getCookie(request, 'edgestore-ctx')
102
+ });
103
+ return new Response(null, {
104
+ status: 200
105
+ });
106
+ } else if (utils.matchPath(url.pathname, 'confirm-upload')) {
107
+ const body = await request.json();
108
+ const result = await shared$1.confirmUpload({
109
+ provider,
110
+ router: config.router,
111
+ body,
112
+ ctxToken: getCookie(request, 'edgestore-ctx')
113
+ });
114
+ return new Response(JSON.stringify(result), {
115
+ headers: {
116
+ 'Content-Type': 'application/json'
117
+ }
118
+ });
119
+ } else if (utils.matchPath(url.pathname, 'delete-file')) {
120
+ const body = await request.json();
121
+ const result = await shared$1.deleteFile({
122
+ provider,
123
+ router: config.router,
124
+ body,
125
+ ctxToken: getCookie(request, 'edgestore-ctx')
126
+ });
127
+ return new Response(JSON.stringify(result), {
128
+ headers: {
129
+ 'Content-Type': 'application/json'
130
+ }
131
+ });
132
+ } else if (utils.matchPath(url.pathname, 'proxy-file')) {
133
+ const url = new URL(request.url).searchParams.get('url');
134
+ if (typeof url === 'string') {
135
+ const cookieHeader = request.headers.get('cookie') ?? '';
136
+ const proxyRes = await fetch(url, {
137
+ headers: {
138
+ cookie: cookieHeader
139
+ }
140
+ });
141
+ const data = await proxyRes.arrayBuffer();
142
+ const headers = new Headers();
143
+ headers.set('Content-Type', proxyRes.headers.get('Content-Type') ?? 'application/octet-stream');
144
+ return new Response(data, {
145
+ headers
146
+ });
147
+ } else {
148
+ return new Response(null, {
149
+ status: 400
150
+ });
151
+ }
152
+ } else {
153
+ return new Response(null, {
154
+ status: 404
155
+ });
156
+ }
157
+ } catch (err) {
158
+ if (err instanceof shared.EdgeStoreError) {
159
+ log[err.level](err.formattedMessage());
160
+ if (err.cause) log[err.level](err.cause);
161
+ return new Response(JSON.stringify(err.formattedJson()), {
162
+ status: shared.EDGE_STORE_ERROR_CODES[err.code],
163
+ headers: {
164
+ 'Content-Type': 'application/json'
165
+ }
166
+ });
167
+ } else {
168
+ log.error(err);
169
+ return new Response(JSON.stringify(new shared.EdgeStoreError({
170
+ message: 'Internal Server Error',
171
+ code: 'SERVER_ERROR'
172
+ }).formattedJson()), {
173
+ status: 500,
174
+ headers: {
175
+ 'Content-Type': 'application/json'
176
+ }
177
+ });
178
+ }
179
+ }
180
+ };
181
+ }
182
+
183
+ exports.createEdgeStoreAstroHandler = createEdgeStoreAstroHandler;
@@ -0,0 +1,179 @@
1
+ import { EdgeStoreError, EDGE_STORE_ERROR_CODES } from '@edgestore/shared';
2
+ import { L as Logger, m as matchPath } from '../../utils-7349adab.mjs';
3
+ import { EdgeStoreProvider } from '../../providers/edgestore/index.mjs';
4
+ import { a as init, r as requestUpload, c as requestUploadParts, d as completeMultipartUpload, e as confirmUpload, f as deleteFile } from '../../shared-4b199b96.mjs';
5
+ import '../../index-2848cb40.mjs';
6
+ import '@panva/hkdf';
7
+ import 'cookie';
8
+ import 'jose';
9
+ import 'uuid';
10
+
11
+ // Helper to safely get cookies from Astro request
12
+ function getCookie(request, name) {
13
+ const cookieHeader = request.headers.get('cookie');
14
+ if (!cookieHeader) return undefined;
15
+ const cookies = cookieHeader.split(';').reduce((acc, cookie)=>{
16
+ const [key, value] = cookie.trim().split('=');
17
+ if (key && value) acc[key] = value;
18
+ return acc;
19
+ }, {});
20
+ return cookies[name];
21
+ }
22
+ function createEdgeStoreAstroHandler(config) {
23
+ const { provider = EdgeStoreProvider() } = config;
24
+ const log = new Logger(config.logLevel);
25
+ globalThis._EDGE_STORE_LOGGER = log;
26
+ log.debug('Creating EdgeStore Astro handler');
27
+ return async (context)=>{
28
+ try {
29
+ const { request } = context;
30
+ const url = new URL(request.url);
31
+ if (matchPath(url.pathname, 'health')) {
32
+ return new Response('OK');
33
+ } else if (matchPath(url.pathname, 'init')) {
34
+ let ctx = {};
35
+ try {
36
+ ctx = 'createContext' in config ? await config.createContext(context) : {};
37
+ } catch (err) {
38
+ throw new EdgeStoreError({
39
+ message: 'Error creating context',
40
+ code: 'CREATE_CONTEXT_ERROR',
41
+ cause: err instanceof Error ? err : undefined
42
+ });
43
+ }
44
+ const { newCookies, token, baseUrl } = await init({
45
+ ctx,
46
+ provider,
47
+ router: config.router
48
+ });
49
+ const headers = new Headers();
50
+ headers.set('Content-Type', 'application/json');
51
+ // Set cookies
52
+ if (Array.isArray(newCookies)) {
53
+ for (const cookie of newCookies){
54
+ headers.append('Set-Cookie', cookie);
55
+ }
56
+ } else if (newCookies) {
57
+ headers.append('Set-Cookie', newCookies);
58
+ }
59
+ return new Response(JSON.stringify({
60
+ token,
61
+ baseUrl
62
+ }), {
63
+ headers
64
+ });
65
+ } else if (matchPath(url.pathname, 'request-upload')) {
66
+ const body = await request.json();
67
+ const result = await requestUpload({
68
+ provider,
69
+ router: config.router,
70
+ body,
71
+ ctxToken: getCookie(request, 'edgestore-ctx')
72
+ });
73
+ return new Response(JSON.stringify(result), {
74
+ headers: {
75
+ 'Content-Type': 'application/json'
76
+ }
77
+ });
78
+ } else if (matchPath(url.pathname, 'request-upload-parts')) {
79
+ const body = await request.json();
80
+ const result = await requestUploadParts({
81
+ provider,
82
+ router: config.router,
83
+ body,
84
+ ctxToken: getCookie(request, 'edgestore-ctx')
85
+ });
86
+ return new Response(JSON.stringify(result), {
87
+ headers: {
88
+ 'Content-Type': 'application/json'
89
+ }
90
+ });
91
+ } else if (matchPath(url.pathname, 'complete-multipart-upload')) {
92
+ const body = await request.json();
93
+ await completeMultipartUpload({
94
+ provider,
95
+ router: config.router,
96
+ body,
97
+ ctxToken: getCookie(request, 'edgestore-ctx')
98
+ });
99
+ return new Response(null, {
100
+ status: 200
101
+ });
102
+ } else if (matchPath(url.pathname, 'confirm-upload')) {
103
+ const body = await request.json();
104
+ const result = await confirmUpload({
105
+ provider,
106
+ router: config.router,
107
+ body,
108
+ ctxToken: getCookie(request, 'edgestore-ctx')
109
+ });
110
+ return new Response(JSON.stringify(result), {
111
+ headers: {
112
+ 'Content-Type': 'application/json'
113
+ }
114
+ });
115
+ } else if (matchPath(url.pathname, 'delete-file')) {
116
+ const body = await request.json();
117
+ const result = await deleteFile({
118
+ provider,
119
+ router: config.router,
120
+ body,
121
+ ctxToken: getCookie(request, 'edgestore-ctx')
122
+ });
123
+ return new Response(JSON.stringify(result), {
124
+ headers: {
125
+ 'Content-Type': 'application/json'
126
+ }
127
+ });
128
+ } else if (matchPath(url.pathname, 'proxy-file')) {
129
+ const url = new URL(request.url).searchParams.get('url');
130
+ if (typeof url === 'string') {
131
+ const cookieHeader = request.headers.get('cookie') ?? '';
132
+ const proxyRes = await fetch(url, {
133
+ headers: {
134
+ cookie: cookieHeader
135
+ }
136
+ });
137
+ const data = await proxyRes.arrayBuffer();
138
+ const headers = new Headers();
139
+ headers.set('Content-Type', proxyRes.headers.get('Content-Type') ?? 'application/octet-stream');
140
+ return new Response(data, {
141
+ headers
142
+ });
143
+ } else {
144
+ return new Response(null, {
145
+ status: 400
146
+ });
147
+ }
148
+ } else {
149
+ return new Response(null, {
150
+ status: 404
151
+ });
152
+ }
153
+ } catch (err) {
154
+ if (err instanceof EdgeStoreError) {
155
+ log[err.level](err.formattedMessage());
156
+ if (err.cause) log[err.level](err.cause);
157
+ return new Response(JSON.stringify(err.formattedJson()), {
158
+ status: EDGE_STORE_ERROR_CODES[err.code],
159
+ headers: {
160
+ 'Content-Type': 'application/json'
161
+ }
162
+ });
163
+ } else {
164
+ log.error(err);
165
+ return new Response(JSON.stringify(new EdgeStoreError({
166
+ message: 'Internal Server Error',
167
+ code: 'SERVER_ERROR'
168
+ }).formattedJson()), {
169
+ status: 500,
170
+ headers: {
171
+ 'Content-Type': 'application/json'
172
+ }
173
+ });
174
+ }
175
+ }
176
+ };
177
+ }
178
+
179
+ export { createEdgeStoreAstroHandler };
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var shared = require('@edgestore/shared');
6
- var utils = require('../../utils-5819d5e1.js');
6
+ var utils = require('../../utils-0aab6e3b.js');
7
7
  var providers_edgestore_index = require('../../providers/edgestore/index.js');
8
- var shared$1 = require('../../shared-6f6fd0bd.js');
9
- require('../../index-b689bf59.js');
8
+ var shared$1 = require('../../shared-685c8a0c.js');
9
+ require('../../index-7b259533.js');
10
10
  require('@panva/hkdf');
11
11
  require('cookie');
12
12
  require('jose');
@@ -1,8 +1,8 @@
1
1
  import { EdgeStoreError, EDGE_STORE_ERROR_CODES } from '@edgestore/shared';
2
- import { L as Logger, m as matchPath } from '../../utils-f6f56d38.mjs';
2
+ import { L as Logger, m as matchPath } from '../../utils-7349adab.mjs';
3
3
  import { EdgeStoreProvider } from '../../providers/edgestore/index.mjs';
4
- import { i as init, r as requestUpload, a as requestUploadParts, c as completeMultipartUpload, d as confirmUpload, e as deleteFile } from '../../shared-c9442cbb.mjs';
5
- import '../../index-a7cc3cd3.mjs';
4
+ import { a as init, r as requestUpload, c as requestUploadParts, d as completeMultipartUpload, e as confirmUpload, f as deleteFile } from '../../shared-4b199b96.mjs';
5
+ import '../../index-2848cb40.mjs';
6
6
  import '@panva/hkdf';
7
7
  import 'cookie';
8
8
  import 'jose';
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var shared = require('@edgestore/shared');
6
- var utils = require('../../utils-5819d5e1.js');
6
+ var utils = require('../../utils-0aab6e3b.js');
7
7
  var providers_edgestore_index = require('../../providers/edgestore/index.js');
8
- var shared$1 = require('../../shared-6f6fd0bd.js');
9
- require('../../index-b689bf59.js');
8
+ var shared$1 = require('../../shared-685c8a0c.js');
9
+ require('../../index-7b259533.js');
10
10
  require('@panva/hkdf');
11
11
  require('cookie');
12
12
  require('jose');
@@ -1,8 +1,8 @@
1
1
  import { EdgeStoreError, EDGE_STORE_ERROR_CODES } from '@edgestore/shared';
2
- import { L as Logger, m as matchPath } from '../../utils-f6f56d38.mjs';
2
+ import { L as Logger, m as matchPath } from '../../utils-7349adab.mjs';
3
3
  import { EdgeStoreProvider } from '../../providers/edgestore/index.mjs';
4
- import { i as init, r as requestUpload, a as requestUploadParts, c as completeMultipartUpload, d as confirmUpload, e as deleteFile } from '../../shared-c9442cbb.mjs';
5
- import '../../index-a7cc3cd3.mjs';
4
+ import { a as init, r as requestUpload, c as requestUploadParts, d as completeMultipartUpload, e as confirmUpload, f as deleteFile } from '../../shared-4b199b96.mjs';
5
+ import '../../index-2848cb40.mjs';
6
6
  import '@panva/hkdf';
7
7
  import 'cookie';
8
8
  import 'jose';
@@ -0,0 +1,82 @@
1
+ import { type EdgeStoreErrorCodeKey, type EdgeStoreRouter, type MaybePromise, type Provider } from '@edgestore/shared';
2
+ import { type Context } from 'hono';
3
+ import { type LogLevel } from '../../libs/logger';
4
+ export type CreateContextOptions = {
5
+ c: Context;
6
+ };
7
+ export type Config<TCtx> = {
8
+ provider?: Provider;
9
+ router: EdgeStoreRouter<TCtx>;
10
+ logLevel?: LogLevel;
11
+ } & (TCtx extends Record<string, never> ? object : {
12
+ provider?: Provider;
13
+ router: EdgeStoreRouter<TCtx>;
14
+ createContext: (opts: CreateContextOptions) => MaybePromise<TCtx>;
15
+ });
16
+ export declare function createEdgeStoreHonoHandler<TCtx>(config: Config<TCtx>): (c: Context) => Promise<(Response & import("hono").TypedResponse<"OK", import("hono/utils/http-status").ContentfulStatusCode, "text">) | (Response & import("hono").TypedResponse<{
17
+ token: string | undefined;
18
+ baseUrl: string;
19
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
20
+ uploadUrl: string;
21
+ accessUrl: string;
22
+ thumbnailUrl?: (string | null) | undefined;
23
+ size: number;
24
+ uploadedAt: string;
25
+ path: {
26
+ [x: string]: string;
27
+ };
28
+ pathOrder: string[];
29
+ metadata: {
30
+ [x: string]: string | null | undefined;
31
+ };
32
+ } | {
33
+ multipart: {
34
+ key: string;
35
+ uploadId: string;
36
+ partSize: number;
37
+ totalParts: number;
38
+ parts: {
39
+ partNumber: number;
40
+ uploadUrl: string;
41
+ }[];
42
+ };
43
+ accessUrl: string;
44
+ thumbnailUrl?: (string | null) | undefined;
45
+ size: number;
46
+ uploadedAt: string;
47
+ path: {
48
+ [x: string]: string;
49
+ };
50
+ pathOrder: string[];
51
+ metadata: {
52
+ [x: string]: string | null | undefined;
53
+ };
54
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
55
+ multipart: {
56
+ uploadId: string;
57
+ parts: {
58
+ partNumber: number;
59
+ uploadUrl: string;
60
+ }[];
61
+ };
62
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<{
63
+ success: boolean;
64
+ }, import("hono/utils/http-status").ContentfulStatusCode, "json">) | (Response & import("hono").TypedResponse<unknown, import("hono/utils/http-status").ContentfulStatusCode, "body">) | (Response & import("hono").TypedResponse<{
65
+ message: string;
66
+ code: "FILE_TOO_LARGE";
67
+ details: {
68
+ maxFileSize: number;
69
+ fileSize: number;
70
+ };
71
+ } | {
72
+ message: string;
73
+ code: "MIME_TYPE_NOT_ALLOWED";
74
+ details: {
75
+ allowedMimeTypes: string[];
76
+ mimeType: string;
77
+ };
78
+ } | {
79
+ message: string;
80
+ code: Exclude<EdgeStoreErrorCodeKey, "FILE_TOO_LARGE" | "MIME_TYPE_NOT_ALLOWED">;
81
+ }, 400 | 401 | 403 | 500, "json">)>;
82
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/hono/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,MAAM,CAAC;AACpC,OAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAiB1D,MAAM,MAAM,oBAAoB,GAAG;IACjC,CAAC,EAAE,OAAO,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,MAAM,CAAC,IAAI,IAAI;IACzB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;IAC9B,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,GAAG,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GACnC,MAAM,GACN;IACE,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;IAC9B,aAAa,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;CACnE,CAAC,CAAC;AAeP,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,OAMlD,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAqIzB"}