@edgestore/server 0.1.5-alpha.7 → 0.1.5-alpha.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapters/next/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAK7E,OAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAenD,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,EAAE,WAAW,CAAC;CAClB,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,SAGhD,WAAW,uBAiK/B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapters/next/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAK7E,OAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAenD,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,EAAE,WAAW,CAAC;CAClB,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;AAMP,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,SAMhD,WAAW,uBAiK/B"}
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('../../../index-e25c8209.js');
6
- var logger = require('../../../logger-623f2833.js');
5
+ var index = require('../../../index-874abae5.js');
6
+ var logger = require('../../../logger-b530a3e1.js');
7
7
  var providers_edgestore_index = require('../../../providers/edgestore/index.js');
8
- var shared = require('../../../shared-1ab6701b.js');
8
+ var shared = require('../../../shared-4c2a6210.js');
9
9
  require('@swc/helpers/_/_define_property');
10
10
  require('@panva/hkdf');
11
11
  require('cookie');
@@ -15,6 +15,8 @@ require('uuid');
15
15
  function createEdgeStoreNextHandler(config) {
16
16
  const { provider = providers_edgestore_index.EdgeStoreProvider() } = config;
17
17
  const log = new logger.Logger(config.logLevel);
18
+ globalThis._EDGE_STORE_LOGGER = log;
19
+ log.debug('Creating Edge Store Next handler (app adapter)');
18
20
  return async (req)=>{
19
21
  try {
20
22
  if (!('nextUrl' in req)) throw new index.EdgeStoreError({
@@ -1,7 +1,7 @@
1
- import { E as EdgeStoreError, a as EDGE_STORE_ERROR_CODES } from '../../../index-7cb3a3f3.mjs';
2
- import { L as Logger } from '../../../logger-0f08f252.mjs';
1
+ import { E as EdgeStoreError, a as EDGE_STORE_ERROR_CODES } from '../../../index-537039e4.mjs';
2
+ import { L as Logger } from '../../../logger-7ea2248c.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-4e509924.mjs';
4
+ import { i as init, r as requestUpload, a as requestUploadParts, c as completeMultipartUpload, d as confirmUpload, e as deleteFile } from '../../../shared-6b717151.mjs';
5
5
  import '@swc/helpers/_/_define_property';
6
6
  import '@panva/hkdf';
7
7
  import 'cookie';
@@ -11,6 +11,8 @@ import 'uuid';
11
11
  function createEdgeStoreNextHandler(config) {
12
12
  const { provider = EdgeStoreProvider() } = config;
13
13
  const log = new Logger(config.logLevel);
14
+ globalThis._EDGE_STORE_LOGGER = log;
15
+ log.debug('Creating Edge Store Next handler (app adapter)');
14
16
  return async (req)=>{
15
17
  try {
16
18
  if (!('nextUrl' in req)) throw new EdgeStoreError({
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapters/next/pages/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAK7E,OA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AG;IACjC,GAAG,EAAE,cAAc,CAAC;IACpB,GAAG,EAAE,eAAe,CAAC;CACtB,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;AAMP,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,SAMhD,cAAc,OAAO,eAAe,mBAoHxD"}
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('../../../index-e25c8209.js');
6
- var logger = require('../../../logger-623f2833.js');
5
+ var index = require('../../../index-874abae5.js');
6
+ var logger = require('../../../logger-b530a3e1.js');
7
7
  var providers_edgestore_index = require('../../../providers/edgestore/index.js');
8
- var shared = require('../../../shared-1ab6701b.js');
8
+ var shared = require('../../../shared-4c2a6210.js');
9
9
  require('@swc/helpers/_/_define_property');
10
10
  require('@panva/hkdf');
11
11
  require('cookie');
@@ -15,6 +15,8 @@ require('uuid');
15
15
  function createEdgeStoreNextHandler(config) {
16
16
  const { provider = providers_edgestore_index.EdgeStoreProvider() } = config;
17
17
  const log = new logger.Logger(config.logLevel);
18
+ globalThis._EDGE_STORE_LOGGER = log;
19
+ log.debug('Creating Edge Store Next handler (pages adapter)');
18
20
  return async (req, res)=>{
19
21
  try {
20
22
  if (!('json' in res)) throw new index.EdgeStoreError({
@@ -1,7 +1,7 @@
1
- import { E as EdgeStoreError, a as EDGE_STORE_ERROR_CODES } from '../../../index-7cb3a3f3.mjs';
2
- import { L as Logger } from '../../../logger-0f08f252.mjs';
1
+ import { E as EdgeStoreError, a as EDGE_STORE_ERROR_CODES } from '../../../index-537039e4.mjs';
2
+ import { L as Logger } from '../../../logger-7ea2248c.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-4e509924.mjs';
4
+ import { i as init, r as requestUpload, a as requestUploadParts, c as completeMultipartUpload, d as confirmUpload, e as deleteFile } from '../../../shared-6b717151.mjs';
5
5
  import '@swc/helpers/_/_define_property';
6
6
  import '@panva/hkdf';
7
7
  import 'cookie';
@@ -11,6 +11,8 @@ import 'uuid';
11
11
  function createEdgeStoreNextHandler(config) {
12
12
  const { provider = EdgeStoreProvider() } = config;
13
13
  const log = new Logger(config.logLevel);
14
+ globalThis._EDGE_STORE_LOGGER = log;
15
+ log.debug('Creating Edge Store Next handler (pages adapter)');
14
16
  return async (req, res)=>{
15
17
  try {
16
18
  if (!('json' in res)) throw new EdgeStoreError({
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/adapters/shared.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,eAAe,EACrB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAMnD,wBAAsB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE;IACvC,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;IAC9B,GAAG,EAAE,IAAI,CAAC;CACX;;;;GA4BA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,KA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;CACb,CAAC;AAEF,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE;IAC7C,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;IAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,IAAI,EAAE,cAAc,CAAC;CACtB,uDAwDA;AA8CD,wBAAgB,SAAS,CAAC,MAAM,EAAE;IAChC,QAAQ,EAAE,iBAAiB,CAAC,UAAU,CAAC,CAAC;IACxC,MAAM,EAAE,UAAU,CAAC;IACnB,SAAS,EAAE;QACT,GAAG,EAAE,GAAG,CAAC;QACT,KAAK,EAAE,GAAG,CAAC;KACZ,CAAC;CACH;;;IA8BA;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE;;;EAU/D;AAwBD,MAAM,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC;AACvD,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC;AACzE,MAAM,MAAM,qBAAqB,GAAG,OAAO,CACzC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CACtC,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC,CAAC"}
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var shared = require('../shared-1ab6701b.js');
6
- var index = require('../index-e25c8209.js');
5
+ var shared = require('../shared-4c2a6210.js');
6
+ var index = require('../index-874abae5.js');
7
7
  var _define_property = require('@swc/helpers/_/_define_property');
8
8
  require('@panva/hkdf');
9
9
  require('cookie');
@@ -1,6 +1,6 @@
1
- import { b as buildPath, p as parsePath } from '../shared-4e509924.mjs';
2
- import { i as initEdgeStoreSdk } from '../index-7cb3a3f3.mjs';
3
- export { e as edgeStoreRawSdk, i as initEdgeStoreSdk } from '../index-7cb3a3f3.mjs';
1
+ import { b as buildPath, p as parsePath } from '../shared-6b717151.mjs';
2
+ import { i as initEdgeStoreSdk } from '../index-537039e4.mjs';
3
+ export { e as edgeStoreRawSdk, i as initEdgeStoreSdk } from '../index-537039e4.mjs';
4
4
  import { _ } from '@swc/helpers/_/_define_property';
5
5
  import '@panva/hkdf';
6
6
  import 'cookie';
@@ -12,7 +12,7 @@ import { _ } from '@swc/helpers/_/_define_property';
12
12
  };
13
13
  class EdgeStoreError extends Error {
14
14
  formattedMessage() {
15
- return `EdgeStore${this.level === 'error' ? 'Error' : 'Info'}: ${this.message}${this.details ? `\n Details: ${JSON.stringify(this.details)}` : ''}${this.cause ? `\n Caused by: ${this.cause.message}` : ''}`;
15
+ return `${this.message}${this.details ? `\n Details: ${JSON.stringify(this.details)}` : ''}${this.cause ? `\n Caused by: ${this.cause.message}` : ''}`;
16
16
  }
17
17
  formattedJson() {
18
18
  return {
@@ -14,7 +14,7 @@ var _define_property = require('@swc/helpers/_/_define_property');
14
14
  };
15
15
  class EdgeStoreError extends Error {
16
16
  formattedMessage() {
17
- return `EdgeStore${this.level === 'error' ? 'Error' : 'Info'}: ${this.message}${this.details ? `\n Details: ${JSON.stringify(this.details)}` : ''}${this.cause ? `\n Caused by: ${this.cause.message}` : ''}`;
17
+ return `${this.message}${this.details ? `\n Details: ${JSON.stringify(this.details)}` : ''}${this.cause ? `\n Caused by: ${this.cause.message}` : ''}`;
18
18
  }
19
19
  formattedJson() {
20
20
  return {
@@ -19,7 +19,7 @@ class EdgeStoreError extends Error {
19
19
  this.details = 'details' in opts ? opts.details : undefined;
20
20
  }
21
21
  formattedMessage() {
22
- return `EdgeStore${this.level === 'error' ? 'Error' : 'Info'}: ${this.message}${this.details ? `\n Details: ${JSON.stringify(this.details)}` : ''}${this.cause ? `\n Caused by: ${this.cause.message}` : ''}`;
22
+ return `${this.message}${this.details ? `\n Details: ${JSON.stringify(this.details)}` : ''}${this.cause ? `\n Caused by: ${this.cause.message}` : ''}`;
23
23
  }
24
24
  formattedJson() {
25
25
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"EdgeStoreError.d.ts","sourceRoot":"","sources":["../../../src/libs/errors/EdgeStoreError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG5C,eAAO,MAAM,sBAAsB;;;;;;;;;CASzB,CAAC;AAEX,MAAM,MAAM,qBAAqB,GAAG,MAAM,OAAO,sBAAsB,CAAC;AAExE,MAAM,MAAM,qBAAqB,CAAC,KAAK,SAAS,qBAAqB,IACnE,KAAK,SAAS,gBAAgB,GAC1B;IACE,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB,GACD,KAAK,SAAS,uBAAuB,GACrC;IACE,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;CAClB,GACD,KAAK,CAAC;AAEZ,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CACxC;IACE,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;CAClD,GACD;IACE,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,qBAAqB,CAAC,uBAAuB,CAAC,CAAC;CACzD,GACD;IACE,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CACX,qBAAqB,EACrB,gBAAgB,GAAG,uBAAuB,CAC3C,CAAC;CACH,CACJ,CAAC;AAEF,cAAM,cAAc,CAAC,KAAK,SAAS,qBAAqB,CAAE,SAAQ,KAAK;IACrE,SAAgB,KAAK,CAAC,EAAE,KAAK,CAAC;IAC9B,SAAgB,IAAI,EAAE,KA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AO,EAAE,qBAAqB,CAAC,uBAAuB,CAAC,CAAC;CACzD,GACD;IACE,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,CACX,qBAAqB,EACrB,gBAAgB,GAAG,uBAAuB,CAC3C,CAAC;CACH,CACJ,CAAC;AAEF,cAAM,cAAc,CAAC,KAAK,SAAS,qBAAqB,CAAE,SAAQ,KAAK;IACrE,SAAgB,KAAK,CAAC,EAAE,KAAK,CAAC;IAC9B,SAAgB,IAAI,EAAE,KAAK,CAAC;IAC5B,SAAgB,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC;IACxC,SAAgB,OAAO,EAAE,qBAAqB,CAAC,KAAK,CAAC,CAAC;gBAGpD,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,KAAK,CAAC;QACZ,KAAK,CAAC,EAAE,KAAK,CAAC;KACf,GAAG,CAAC,qBAAqB,CAAC,KAAK,CAAC,SAAS,SAAS,GAC/C,MAAM,GACN;QACE,OAAO,EAAE,qBAAqB,CAAC,KAAK,CAAC,CAAC;KACvC,CAAC;IAWR,gBAAgB,IAAI,MAAM;IAM1B,aAAa,IAAI,qBAAqB;CAQvC;AAED,eAAe,cAAc,CAAC"}
@@ -13,27 +13,27 @@ class Logger {
13
13
  }
14
14
  debug(message, ...optionalParams) {
15
15
  if (this.shouldLog('debug')) {
16
- console.debug(message, ...optionalParams);
16
+ console.debug('[EdgeStoreDebug]', message, ...optionalParams);
17
17
  }
18
18
  }
19
19
  info(message, ...optionalParams) {
20
20
  if (this.shouldLog('info')) {
21
- console.info(message, ...optionalParams);
21
+ console.info('[EdgeStoreInfo]', message, ...optionalParams);
22
22
  }
23
23
  }
24
24
  warn(message, ...optionalParams) {
25
25
  if (this.shouldLog('warn')) {
26
- console.warn(message, ...optionalParams);
26
+ console.warn('[EdgeStoreWarn]', message, ...optionalParams);
27
27
  }
28
28
  }
29
29
  error(message, ...optionalParams) {
30
30
  if (this.shouldLog('error')) {
31
- console.error(message, ...optionalParams);
31
+ console.error('[EdgeStoreError]', message, ...optionalParams);
32
32
  }
33
33
  }
34
34
  constructor(logLevel){
35
35
  _(this, "logLevel", void 0);
36
- this.logLevel = logLevel ?? process.env.NODE_ENV === 'production' ? 'error' : 'info';
36
+ this.logLevel = logLevel ?? (process.env.NODE_ENV === 'production' ? 'error' : 'info');
37
37
  }
38
38
  }
39
39
 
@@ -15,27 +15,27 @@ class Logger {
15
15
  }
16
16
  debug(message, ...optionalParams) {
17
17
  if (this.shouldLog('debug')) {
18
- console.debug(message, ...optionalParams);
18
+ console.debug('[EdgeStoreDebug]', message, ...optionalParams);
19
19
  }
20
20
  }
21
21
  info(message, ...optionalParams) {
22
22
  if (this.shouldLog('info')) {
23
- console.info(message, ...optionalParams);
23
+ console.info('[EdgeStoreInfo]', message, ...optionalParams);
24
24
  }
25
25
  }
26
26
  warn(message, ...optionalParams) {
27
27
  if (this.shouldLog('warn')) {
28
- console.warn(message, ...optionalParams);
28
+ console.warn('[EdgeStoreWarn]', message, ...optionalParams);
29
29
  }
30
30
  }
31
31
  error(message, ...optionalParams) {
32
32
  if (this.shouldLog('error')) {
33
- console.error(message, ...optionalParams);
33
+ console.error('[EdgeStoreError]', message, ...optionalParams);
34
34
  }
35
35
  }
36
36
  constructor(logLevel){
37
37
  _define_property._(this, "logLevel", void 0);
38
- this.logLevel = logLevel ?? process.env.NODE_ENV === 'production' ? 'error' : 'info';
38
+ this.logLevel = logLevel ?? (process.env.NODE_ENV === 'production' ? 'error' : 'info');
39
39
  }
40
40
  }
41
41
 
@@ -3,29 +3,29 @@ const logLevel = ['debug', 'info', 'warn', 'error', 'none'];
3
3
  class Logger {
4
4
  constructor(logLevel) {
5
5
  this.logLevel =
6
- logLevel ?? process.env.NODE_ENV === 'production' ? 'error' : 'info';
6
+ logLevel ?? (process.env.NODE_ENV === 'production' ? 'error' : 'info');
7
7
  }
8
8
  shouldLog(level) {
9
9
  return logLevel.indexOf(level) >= logLevel.indexOf(this.logLevel);
10
10
  }
11
11
  debug(message, ...optionalParams) {
12
12
  if (this.shouldLog('debug')) {
13
- console.debug(message, ...optionalParams);
13
+ console.debug('[EdgeStoreDebug]', message, ...optionalParams);
14
14
  }
15
15
  }
16
16
  info(message, ...optionalParams) {
17
17
  if (this.shouldLog('info')) {
18
- console.info(message, ...optionalParams);
18
+ console.info('[EdgeStoreInfo]', message, ...optionalParams);
19
19
  }
20
20
  }
21
21
  warn(message, ...optionalParams) {
22
22
  if (this.shouldLog('warn')) {
23
- console.warn(message, ...optionalParams);
23
+ console.warn('[EdgeStoreWarn]', message, ...optionalParams);
24
24
  }
25
25
  }
26
26
  error(message, ...optionalParams) {
27
27
  if (this.shouldLog('error')) {
28
- console.error(message, ...optionalParams);
28
+ console.error('[EdgeStoreError]', message, ...optionalParams);
29
29
  }
30
30
  }
31
31
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('../../index-e25c8209.js');
5
+ var index = require('../../index-874abae5.js');
6
6
  require('@swc/helpers/_/_define_property');
7
7
 
8
8
  const DEFAULT_BASE_URL = 'https://files.edgestore.dev';
@@ -1,4 +1,4 @@
1
- import { b as EdgeStoreCredentialsError, i as initEdgeStoreSdk, E as EdgeStoreError } from '../../index-7cb3a3f3.mjs';
1
+ import { b as EdgeStoreCredentialsError, i as initEdgeStoreSdk, E as EdgeStoreError } from '../../index-537039e4.mjs';
2
2
  import '@swc/helpers/_/_define_property';
3
3
 
4
4
  const DEFAULT_BASE_URL = 'https://files.edgestore.dev';
@@ -4,7 +4,7 @@ var hkdf = require('@panva/hkdf');
4
4
  var cookie = require('cookie');
5
5
  var jose = require('jose');
6
6
  var uuid = require('uuid');
7
- var index = require('./index-e25c8209.js');
7
+ var index = require('./index-874abae5.js');
8
8
 
9
9
  const IMAGE_MIME_TYPES = [
10
10
  'image/jpeg',
@@ -20,7 +20,11 @@ const IMAGE_MIME_TYPES = [
20
20
  // TODO: change it to 1 hour when we have a way to refresh the token
21
21
  const DEFAULT_MAX_AGE = 30 * 24 * 60 * 60; // 30 days
22
22
  async function init(params) {
23
+ const log = globalThis._EDGE_STORE_LOGGER;
23
24
  const { ctx, provider, router } = params;
25
+ log.debug('Running [init]', {
26
+ ctx
27
+ });
24
28
  const ctxToken = await encryptJWT(ctx);
25
29
  const { token } = await provider.init({
26
30
  ctx,
@@ -39,6 +43,12 @@ async function init(params) {
39
43
  }));
40
44
  }
41
45
  const baseUrl = await provider.getBaseUrl();
46
+ log.debug('Finished [init]', {
47
+ ctx,
48
+ newCookies,
49
+ token,
50
+ baseUrl
51
+ });
42
52
  return {
43
53
  newCookies,
44
54
  token,
@@ -47,6 +57,12 @@ async function init(params) {
47
57
  }
48
58
  async function requestUpload(params) {
49
59
  const { provider, router, ctxToken, body: { bucketName, input, fileInfo } } = params;
60
+ const log = globalThis._EDGE_STORE_LOGGER;
61
+ log.debug('Running [requestUpload]', {
62
+ bucketName,
63
+ input,
64
+ fileInfo
65
+ });
50
66
  if (!ctxToken) {
51
67
  throw new index.EdgeStoreError({
52
68
  message: 'Missing edgestore-ctx cookie',
@@ -54,6 +70,9 @@ async function requestUpload(params) {
54
70
  });
55
71
  }
56
72
  const ctx = await getContext(ctxToken);
73
+ log.debug('Decrypted Context', {
74
+ ctx
75
+ });
57
76
  const bucket = router.buckets[bucketName];
58
77
  if (!bucket) {
59
78
  throw new index.EdgeStoreError({
@@ -62,6 +81,7 @@ async function requestUpload(params) {
62
81
  });
63
82
  }
64
83
  if (bucket._def.beforeUpload) {
84
+ log.debug('Running [beforeUpload]');
65
85
  const canUpload = await bucket._def.beforeUpload?.({
66
86
  ctx,
67
87
  input,
@@ -74,6 +94,9 @@ async function requestUpload(params) {
74
94
  temporary: fileInfo.temporary
75
95
  }
76
96
  });
97
+ log.debug('Finished [beforeUpload]', {
98
+ canUpload
99
+ });
77
100
  if (!canUpload) {
78
101
  throw new index.EdgeStoreError({
79
102
  message: 'Upload not allowed for the current context',
@@ -144,6 +167,12 @@ async function requestUpload(params) {
144
167
  input
145
168
  });
146
169
  const isPublic = bucket._def.accessControl === undefined;
170
+ log.debug('upload info', {
171
+ path,
172
+ metadata,
173
+ isPublic,
174
+ bucketType: bucket._def.type
175
+ });
147
176
  const requestUploadRes = await provider.requestUpload({
148
177
  bucketName,
149
178
  bucketType: bucket._def.type,
@@ -155,6 +184,7 @@ async function requestUpload(params) {
155
184
  }
156
185
  });
157
186
  const { parsedPath, pathOrder } = parsePath(path);
187
+ log.debug('Finished [requestUpload]');
158
188
  return {
159
189
  ...requestUploadRes,
160
190
  size: fileInfo.size,
@@ -166,6 +196,11 @@ async function requestUpload(params) {
166
196
  }
167
197
  async function requestUploadParts(params) {
168
198
  const { provider, ctxToken, body: { multipart, path } } = params;
199
+ const log = globalThis._EDGE_STORE_LOGGER;
200
+ log.debug('Running [requestUploadParts]', {
201
+ multipart,
202
+ path
203
+ });
169
204
  if (!ctxToken) {
170
205
  throw new index.EdgeStoreError({
171
206
  message: 'Missing edgestore-ctx cookie',
@@ -173,13 +208,21 @@ async function requestUploadParts(params) {
173
208
  });
174
209
  }
175
210
  await getContext(ctxToken); // just to check if the token is valid
176
- return await provider.requestUploadParts({
211
+ const res = await provider.requestUploadParts({
177
212
  multipart,
178
213
  path
179
214
  });
215
+ log.debug('Finished [requestUploadParts]');
216
+ return res;
180
217
  }
181
218
  async function completeMultipartUpload(params) {
182
219
  const { provider, router, ctxToken, body: { bucketName, uploadId, key, parts } } = params;
220
+ const log = globalThis._EDGE_STORE_LOGGER;
221
+ log.debug('Running [completeMultipartUpload]', {
222
+ bucketName,
223
+ uploadId,
224
+ key
225
+ });
183
226
  if (!ctxToken) {
184
227
  throw new index.EdgeStoreError({
185
228
  message: 'Missing edgestore-ctx cookie',
@@ -194,14 +237,21 @@ async function completeMultipartUpload(params) {
194
237
  code: 'BAD_REQUEST'
195
238
  });
196
239
  }
197
- return await provider.completeMultipartUpload({
240
+ const res = await provider.completeMultipartUpload({
198
241
  uploadId,
199
242
  key,
200
243
  parts
201
244
  });
245
+ log.debug('Finished [completeMultipartUpload]');
246
+ return res;
202
247
  }
203
248
  async function confirmUpload(params) {
204
249
  const { provider, router, ctxToken, body: { bucketName, url } } = params;
250
+ const log = globalThis._EDGE_STORE_LOGGER;
251
+ log.debug('Running [confirmUpload]', {
252
+ bucketName,
253
+ url
254
+ });
205
255
  if (!ctxToken) {
206
256
  throw new index.EdgeStoreError({
207
257
  message: 'Missing edgestore-ctx cookie',
@@ -216,13 +266,20 @@ async function confirmUpload(params) {
216
266
  code: 'BAD_REQUEST'
217
267
  });
218
268
  }
219
- return await provider.confirmUpload({
269
+ const res = await provider.confirmUpload({
220
270
  bucket,
221
271
  url: unproxyUrl(url)
222
272
  });
273
+ log.debug('Finished [confirmUpload]');
274
+ return res;
223
275
  }
224
276
  async function deleteFile(params) {
225
277
  const { provider, router, ctxToken, body: { bucketName, url } } = params;
278
+ const log = globalThis._EDGE_STORE_LOGGER;
279
+ log.debug('Running [deleteFile]', {
280
+ bucketName,
281
+ url
282
+ });
226
283
  if (!ctxToken) {
227
284
  throw new index.EdgeStoreError({
228
285
  message: 'Missing edgestore-ctx cookie',
@@ -256,10 +313,12 @@ async function deleteFile(params) {
256
313
  code: 'DELETE_NOT_ALLOWED'
257
314
  });
258
315
  }
259
- return await provider.deleteFile({
316
+ const res = await provider.deleteFile({
260
317
  bucket,
261
318
  url: unproxyUrl(url)
262
319
  });
320
+ log.debug('Finished [deleteFile]');
321
+ return res;
263
322
  }
264
323
  async function encryptJWT(ctx) {
265
324
  const secret = process.env.EDGE_STORE_JWT_SECRET ?? process.env.EDGE_STORE_SECRET_KEY;
@@ -2,7 +2,7 @@ import { hkdf } from '@panva/hkdf';
2
2
  import { serialize } from 'cookie';
3
3
  import { EncryptJWT, jwtDecrypt } from 'jose';
4
4
  import { v4 } from 'uuid';
5
- import { E as EdgeStoreError } from './index-7cb3a3f3.mjs';
5
+ import { E as EdgeStoreError } from './index-537039e4.mjs';
6
6
 
7
7
  const IMAGE_MIME_TYPES = [
8
8
  'image/jpeg',
@@ -18,7 +18,11 @@ const IMAGE_MIME_TYPES = [
18
18
  // TODO: change it to 1 hour when we have a way to refresh the token
19
19
  const DEFAULT_MAX_AGE = 30 * 24 * 60 * 60; // 30 days
20
20
  async function init(params) {
21
+ const log = globalThis._EDGE_STORE_LOGGER;
21
22
  const { ctx, provider, router } = params;
23
+ log.debug('Running [init]', {
24
+ ctx
25
+ });
22
26
  const ctxToken = await encryptJWT(ctx);
23
27
  const { token } = await provider.init({
24
28
  ctx,
@@ -37,6 +41,12 @@ async function init(params) {
37
41
  }));
38
42
  }
39
43
  const baseUrl = await provider.getBaseUrl();
44
+ log.debug('Finished [init]', {
45
+ ctx,
46
+ newCookies,
47
+ token,
48
+ baseUrl
49
+ });
40
50
  return {
41
51
  newCookies,
42
52
  token,
@@ -45,6 +55,12 @@ async function init(params) {
45
55
  }
46
56
  async function requestUpload(params) {
47
57
  const { provider, router, ctxToken, body: { bucketName, input, fileInfo } } = params;
58
+ const log = globalThis._EDGE_STORE_LOGGER;
59
+ log.debug('Running [requestUpload]', {
60
+ bucketName,
61
+ input,
62
+ fileInfo
63
+ });
48
64
  if (!ctxToken) {
49
65
  throw new EdgeStoreError({
50
66
  message: 'Missing edgestore-ctx cookie',
@@ -52,6 +68,9 @@ async function requestUpload(params) {
52
68
  });
53
69
  }
54
70
  const ctx = await getContext(ctxToken);
71
+ log.debug('Decrypted Context', {
72
+ ctx
73
+ });
55
74
  const bucket = router.buckets[bucketName];
56
75
  if (!bucket) {
57
76
  throw new EdgeStoreError({
@@ -60,6 +79,7 @@ async function requestUpload(params) {
60
79
  });
61
80
  }
62
81
  if (bucket._def.beforeUpload) {
82
+ log.debug('Running [beforeUpload]');
63
83
  const canUpload = await bucket._def.beforeUpload?.({
64
84
  ctx,
65
85
  input,
@@ -72,6 +92,9 @@ async function requestUpload(params) {
72
92
  temporary: fileInfo.temporary
73
93
  }
74
94
  });
95
+ log.debug('Finished [beforeUpload]', {
96
+ canUpload
97
+ });
75
98
  if (!canUpload) {
76
99
  throw new EdgeStoreError({
77
100
  message: 'Upload not allowed for the current context',
@@ -142,6 +165,12 @@ async function requestUpload(params) {
142
165
  input
143
166
  });
144
167
  const isPublic = bucket._def.accessControl === undefined;
168
+ log.debug('upload info', {
169
+ path,
170
+ metadata,
171
+ isPublic,
172
+ bucketType: bucket._def.type
173
+ });
145
174
  const requestUploadRes = await provider.requestUpload({
146
175
  bucketName,
147
176
  bucketType: bucket._def.type,
@@ -153,6 +182,7 @@ async function requestUpload(params) {
153
182
  }
154
183
  });
155
184
  const { parsedPath, pathOrder } = parsePath(path);
185
+ log.debug('Finished [requestUpload]');
156
186
  return {
157
187
  ...requestUploadRes,
158
188
  size: fileInfo.size,
@@ -164,6 +194,11 @@ async function requestUpload(params) {
164
194
  }
165
195
  async function requestUploadParts(params) {
166
196
  const { provider, ctxToken, body: { multipart, path } } = params;
197
+ const log = globalThis._EDGE_STORE_LOGGER;
198
+ log.debug('Running [requestUploadParts]', {
199
+ multipart,
200
+ path
201
+ });
167
202
  if (!ctxToken) {
168
203
  throw new EdgeStoreError({
169
204
  message: 'Missing edgestore-ctx cookie',
@@ -171,13 +206,21 @@ async function requestUploadParts(params) {
171
206
  });
172
207
  }
173
208
  await getContext(ctxToken); // just to check if the token is valid
174
- return await provider.requestUploadParts({
209
+ const res = await provider.requestUploadParts({
175
210
  multipart,
176
211
  path
177
212
  });
213
+ log.debug('Finished [requestUploadParts]');
214
+ return res;
178
215
  }
179
216
  async function completeMultipartUpload(params) {
180
217
  const { provider, router, ctxToken, body: { bucketName, uploadId, key, parts } } = params;
218
+ const log = globalThis._EDGE_STORE_LOGGER;
219
+ log.debug('Running [completeMultipartUpload]', {
220
+ bucketName,
221
+ uploadId,
222
+ key
223
+ });
181
224
  if (!ctxToken) {
182
225
  throw new EdgeStoreError({
183
226
  message: 'Missing edgestore-ctx cookie',
@@ -192,14 +235,21 @@ async function completeMultipartUpload(params) {
192
235
  code: 'BAD_REQUEST'
193
236
  });
194
237
  }
195
- return await provider.completeMultipartUpload({
238
+ const res = await provider.completeMultipartUpload({
196
239
  uploadId,
197
240
  key,
198
241
  parts
199
242
  });
243
+ log.debug('Finished [completeMultipartUpload]');
244
+ return res;
200
245
  }
201
246
  async function confirmUpload(params) {
202
247
  const { provider, router, ctxToken, body: { bucketName, url } } = params;
248
+ const log = globalThis._EDGE_STORE_LOGGER;
249
+ log.debug('Running [confirmUpload]', {
250
+ bucketName,
251
+ url
252
+ });
203
253
  if (!ctxToken) {
204
254
  throw new EdgeStoreError({
205
255
  message: 'Missing edgestore-ctx cookie',
@@ -214,13 +264,20 @@ async function confirmUpload(params) {
214
264
  code: 'BAD_REQUEST'
215
265
  });
216
266
  }
217
- return await provider.confirmUpload({
267
+ const res = await provider.confirmUpload({
218
268
  bucket,
219
269
  url: unproxyUrl(url)
220
270
  });
271
+ log.debug('Finished [confirmUpload]');
272
+ return res;
221
273
  }
222
274
  async function deleteFile(params) {
223
275
  const { provider, router, ctxToken, body: { bucketName, url } } = params;
276
+ const log = globalThis._EDGE_STORE_LOGGER;
277
+ log.debug('Running [deleteFile]', {
278
+ bucketName,
279
+ url
280
+ });
224
281
  if (!ctxToken) {
225
282
  throw new EdgeStoreError({
226
283
  message: 'Missing edgestore-ctx cookie',
@@ -254,10 +311,12 @@ async function deleteFile(params) {
254
311
  code: 'DELETE_NOT_ALLOWED'
255
312
  });
256
313
  }
257
- return await provider.deleteFile({
314
+ const res = await provider.deleteFile({
258
315
  bucket,
259
316
  url: unproxyUrl(url)
260
317
  });
318
+ log.debug('Finished [deleteFile]');
319
+ return res;
261
320
  }
262
321
  async function encryptJWT(ctx) {
263
322
  const secret = process.env.EDGE_STORE_JWT_SECRET ?? process.env.EDGE_STORE_SECRET_KEY;
@@ -2,7 +2,7 @@ import { hkdf } from '@panva/hkdf';
2
2
  import { serialize } from 'cookie';
3
3
  import { EncryptJWT, jwtDecrypt } from 'jose';
4
4
  import { v4 } from 'uuid';
5
- import { E as EdgeStoreError } from './index-9eb6248c.js';
5
+ import { E as EdgeStoreError } from './index-b8745c2f.js';
6
6
 
7
7
  const IMAGE_MIME_TYPES = [
8
8
  'image/jpeg',
@@ -18,7 +18,9 @@ const IMAGE_MIME_TYPES = [
18
18
  // TODO: change it to 1 hour when we have a way to refresh the token
19
19
  const DEFAULT_MAX_AGE = 30 * 24 * 60 * 60; // 30 days
20
20
  async function init(params) {
21
+ const log = globalThis._EDGE_STORE_LOGGER;
21
22
  const { ctx, provider, router } = params;
23
+ log.debug('Running [init]', { ctx });
22
24
  const ctxToken = await encryptJWT(ctx);
23
25
  const { token } = await provider.init({
24
26
  ctx,
@@ -37,6 +39,7 @@ async function init(params) {
37
39
  }));
38
40
  }
39
41
  const baseUrl = await provider.getBaseUrl();
42
+ log.debug('Finished [init]', { ctx, newCookies, token, baseUrl });
40
43
  return {
41
44
  newCookies,
42
45
  token,
@@ -45,6 +48,8 @@ async function init(params) {
45
48
  }
46
49
  async function requestUpload(params) {
47
50
  const { provider, router, ctxToken, body: { bucketName, input, fileInfo }, } = params;
51
+ const log = globalThis._EDGE_STORE_LOGGER;
52
+ log.debug('Running [requestUpload]', { bucketName, input, fileInfo });
48
53
  if (!ctxToken) {
49
54
  throw new EdgeStoreError({
50
55
  message: 'Missing edgestore-ctx cookie',
@@ -52,6 +57,7 @@ async function requestUpload(params) {
52
57
  });
53
58
  }
54
59
  const ctx = await getContext(ctxToken);
60
+ log.debug('Decrypted Context', { ctx });
55
61
  const bucket = router.buckets[bucketName];
56
62
  if (!bucket) {
57
63
  throw new EdgeStoreError({
@@ -60,6 +66,7 @@ async function requestUpload(params) {
60
66
  });
61
67
  }
62
68
  if (bucket._def.beforeUpload) {
69
+ log.debug('Running [beforeUpload]');
63
70
  const canUpload = await bucket._def.beforeUpload?.({
64
71
  ctx,
65
72
  input,
@@ -72,6 +79,7 @@ async function requestUpload(params) {
72
79
  temporary: fileInfo.temporary,
73
80
  },
74
81
  });
82
+ log.debug('Finished [beforeUpload]', { canUpload });
75
83
  if (!canUpload) {
76
84
  throw new EdgeStoreError({
77
85
  message: 'Upload not allowed for the current context',
@@ -137,6 +145,12 @@ async function requestUpload(params) {
137
145
  });
138
146
  const metadata = await bucket._def.metadata?.({ ctx, input });
139
147
  const isPublic = bucket._def.accessControl === undefined;
148
+ log.debug('upload info', {
149
+ path,
150
+ metadata,
151
+ isPublic,
152
+ bucketType: bucket._def.type,
153
+ });
140
154
  const requestUploadRes = await provider.requestUpload({
141
155
  bucketName,
142
156
  bucketType: bucket._def.type,
@@ -148,6 +162,7 @@ async function requestUpload(params) {
148
162
  },
149
163
  });
150
164
  const { parsedPath, pathOrder } = parsePath(path);
165
+ log.debug('Finished [requestUpload]');
151
166
  return {
152
167
  ...requestUploadRes,
153
168
  size: fileInfo.size,
@@ -159,6 +174,8 @@ async function requestUpload(params) {
159
174
  }
160
175
  async function requestUploadParts(params) {
161
176
  const { provider, ctxToken, body: { multipart, path }, } = params;
177
+ const log = globalThis._EDGE_STORE_LOGGER;
178
+ log.debug('Running [requestUploadParts]', { multipart, path });
162
179
  if (!ctxToken) {
163
180
  throw new EdgeStoreError({
164
181
  message: 'Missing edgestore-ctx cookie',
@@ -166,13 +183,21 @@ async function requestUploadParts(params) {
166
183
  });
167
184
  }
168
185
  await getContext(ctxToken); // just to check if the token is valid
169
- return await provider.requestUploadParts({
186
+ const res = await provider.requestUploadParts({
170
187
  multipart,
171
188
  path,
172
189
  });
190
+ log.debug('Finished [requestUploadParts]');
191
+ return res;
173
192
  }
174
193
  async function completeMultipartUpload(params) {
175
194
  const { provider, router, ctxToken, body: { bucketName, uploadId, key, parts }, } = params;
195
+ const log = globalThis._EDGE_STORE_LOGGER;
196
+ log.debug('Running [completeMultipartUpload]', {
197
+ bucketName,
198
+ uploadId,
199
+ key,
200
+ });
176
201
  if (!ctxToken) {
177
202
  throw new EdgeStoreError({
178
203
  message: 'Missing edgestore-ctx cookie',
@@ -187,14 +212,18 @@ async function completeMultipartUpload(params) {
187
212
  code: 'BAD_REQUEST',
188
213
  });
189
214
  }
190
- return await provider.completeMultipartUpload({
215
+ const res = await provider.completeMultipartUpload({
191
216
  uploadId,
192
217
  key,
193
218
  parts,
194
219
  });
220
+ log.debug('Finished [completeMultipartUpload]');
221
+ return res;
195
222
  }
196
223
  async function confirmUpload(params) {
197
224
  const { provider, router, ctxToken, body: { bucketName, url }, } = params;
225
+ const log = globalThis._EDGE_STORE_LOGGER;
226
+ log.debug('Running [confirmUpload]', { bucketName, url });
198
227
  if (!ctxToken) {
199
228
  throw new EdgeStoreError({
200
229
  message: 'Missing edgestore-ctx cookie',
@@ -209,13 +238,17 @@ async function confirmUpload(params) {
209
238
  code: 'BAD_REQUEST',
210
239
  });
211
240
  }
212
- return await provider.confirmUpload({
241
+ const res = await provider.confirmUpload({
213
242
  bucket,
214
243
  url: unproxyUrl(url),
215
244
  });
245
+ log.debug('Finished [confirmUpload]');
246
+ return res;
216
247
  }
217
248
  async function deleteFile(params) {
218
249
  const { provider, router, ctxToken, body: { bucketName, url }, } = params;
250
+ const log = globalThis._EDGE_STORE_LOGGER;
251
+ log.debug('Running [deleteFile]', { bucketName, url });
219
252
  if (!ctxToken) {
220
253
  throw new EdgeStoreError({
221
254
  message: 'Missing edgestore-ctx cookie',
@@ -249,10 +282,12 @@ async function deleteFile(params) {
249
282
  code: 'DELETE_NOT_ALLOWED',
250
283
  });
251
284
  }
252
- return await provider.deleteFile({
285
+ const res = await provider.deleteFile({
253
286
  bucket,
254
287
  url: unproxyUrl(url),
255
288
  });
289
+ log.debug('Finished [deleteFile]');
290
+ return res;
256
291
  }
257
292
  async function encryptJWT(ctx) {
258
293
  const secret = process.env.EDGE_STORE_JWT_SECRET ?? process.env.EDGE_STORE_SECRET_KEY;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgestore/server",
3
- "version": "0.1.5-alpha.7",
3
+ "version": "0.1.5-alpha.9",
4
4
  "description": "Upload files with ease from React/Next.js",
5
5
  "homepage": "https://edgestore.dev",
6
6
  "repository": "https://github.com/edgestorejs/edgestore.git",
@@ -127,5 +127,5 @@
127
127
  "typescript": "^5.1.6",
128
128
  "zod": "^3.21.4"
129
129
  },
130
- "gitHead": "d67b6ec3945767cf3944ba3c65279141b16b8325"
130
+ "gitHead": "a2739cac672d5fb29feb5c1c867a96faf5115756"
131
131
  }
@@ -38,9 +38,16 @@ export type Config<TCtx> = {
38
38
  createContext: (opts: CreateContextOptions) => MaybePromise<TCtx>;
39
39
  });
40
40
 
41
+ declare const globalThis: {
42
+ _EDGE_STORE_LOGGER: Logger;
43
+ };
44
+
41
45
  export function createEdgeStoreNextHandler<TCtx>(config: Config<TCtx>) {
42
46
  const { provider = EdgeStoreProvider() } = config;
43
47
  const log = new Logger(config.logLevel);
48
+ globalThis._EDGE_STORE_LOGGER = log;
49
+ log.debug('Creating Edge Store Next handler (app adapter)');
50
+
44
51
  return async (req: NextRequest) => {
45
52
  try {
46
53
  if (!('nextUrl' in req))
@@ -39,9 +39,16 @@ export type Config<TCtx> = {
39
39
  createContext: (opts: CreateContextOptions) => MaybePromise<TCtx>;
40
40
  });
41
41
 
42
+ declare const globalThis: {
43
+ _EDGE_STORE_LOGGER: Logger;
44
+ };
45
+
42
46
  export function createEdgeStoreNextHandler<TCtx>(config: Config<TCtx>) {
43
47
  const { provider = EdgeStoreProvider() } = config;
44
48
  const log = new Logger(config.logLevel);
49
+ globalThis._EDGE_STORE_LOGGER = log;
50
+ log.debug('Creating Edge Store Next handler (pages adapter)');
51
+
45
52
  return async (req: NextApiRequest, res: NextApiResponse) => {
46
53
  try {
47
54
  if (!('json' in res))
@@ -7,18 +7,25 @@ import {
7
7
  type EdgeStoreRouter,
8
8
  } from '../core/internals/bucketBuilder';
9
9
  import EdgeStoreError from '../libs/errors/EdgeStoreError';
10
+ import type Logger from '../libs/logger';
10
11
  import { type Provider } from '../providers/types';
11
12
  import { IMAGE_MIME_TYPES } from './imageTypes';
12
13
 
13
14
  // TODO: change it to 1 hour when we have a way to refresh the token
14
15
  const DEFAULT_MAX_AGE = 30 * 24 * 60 * 60; // 30 days
15
16
 
17
+ declare const globalThis: {
18
+ _EDGE_STORE_LOGGER: Logger;
19
+ };
20
+
16
21
  export async function init<TCtx>(params: {
17
22
  provider: Provider;
18
23
  router: EdgeStoreRouter<TCtx>;
19
24
  ctx: TCtx;
20
25
  }) {
26
+ const log = globalThis._EDGE_STORE_LOGGER;
21
27
  const { ctx, provider, router } = params;
28
+ log.debug('Running [init]', { ctx });
22
29
  const ctxToken = await encryptJWT(ctx);
23
30
  const { token } = await provider.init({
24
31
  ctx,
@@ -40,6 +47,8 @@ export async function init<TCtx>(params: {
40
47
  }
41
48
  const baseUrl = await provider.getBaseUrl();
42
49
 
50
+ log.debug('Finished [init]', { ctx, newCookies, token, baseUrl });
51
+
43
52
  return {
44
53
  newCookies,
45
54
  token,
@@ -72,6 +81,8 @@ export async function requestUpload<TCtx>(params: {
72
81
  ctxToken,
73
82
  body: { bucketName, input, fileInfo },
74
83
  } = params;
84
+ const log = globalThis._EDGE_STORE_LOGGER;
85
+ log.debug('Running [requestUpload]', { bucketName, input, fileInfo });
75
86
 
76
87
  if (!ctxToken) {
77
88
  throw new EdgeStoreError({
@@ -80,6 +91,9 @@ export async function requestUpload<TCtx>(params: {
80
91
  });
81
92
  }
82
93
  const ctx = await getContext(ctxToken);
94
+
95
+ log.debug('Decrypted Context', { ctx });
96
+
83
97
  const bucket = router.buckets[bucketName];
84
98
  if (!bucket) {
85
99
  throw new EdgeStoreError({
@@ -88,6 +102,7 @@ export async function requestUpload<TCtx>(params: {
88
102
  });
89
103
  }
90
104
  if (bucket._def.beforeUpload) {
105
+ log.debug('Running [beforeUpload]');
91
106
  const canUpload = await bucket._def.beforeUpload?.({
92
107
  ctx,
93
108
  input,
@@ -100,6 +115,7 @@ export async function requestUpload<TCtx>(params: {
100
115
  temporary: fileInfo.temporary,
101
116
  },
102
117
  });
118
+ log.debug('Finished [beforeUpload]', { canUpload });
103
119
  if (!canUpload) {
104
120
  throw new EdgeStoreError({
105
121
  message: 'Upload not allowed for the current context',
@@ -170,6 +186,14 @@ export async function requestUpload<TCtx>(params: {
170
186
  });
171
187
  const metadata = await bucket._def.metadata?.({ ctx, input });
172
188
  const isPublic = bucket._def.accessControl === undefined;
189
+
190
+ log.debug('upload info', {
191
+ path,
192
+ metadata,
193
+ isPublic,
194
+ bucketType: bucket._def.type,
195
+ });
196
+
173
197
  const requestUploadRes = await provider.requestUpload({
174
198
  bucketName,
175
199
  bucketType: bucket._def.type,
@@ -182,6 +206,8 @@ export async function requestUpload<TCtx>(params: {
182
206
  });
183
207
  const { parsedPath, pathOrder } = parsePath(path);
184
208
 
209
+ log.debug('Finished [requestUpload]');
210
+
185
211
  return {
186
212
  ...requestUploadRes,
187
213
  size: fileInfo.size,
@@ -211,6 +237,10 @@ export async function requestUploadParts<TCtx>(params: {
211
237
  ctxToken,
212
238
  body: { multipart, path },
213
239
  } = params;
240
+
241
+ const log = globalThis._EDGE_STORE_LOGGER;
242
+ log.debug('Running [requestUploadParts]', { multipart, path });
243
+
214
244
  if (!ctxToken) {
215
245
  throw new EdgeStoreError({
216
246
  message: 'Missing edgestore-ctx cookie',
@@ -218,10 +248,15 @@ export async function requestUploadParts<TCtx>(params: {
218
248
  });
219
249
  }
220
250
  await getContext(ctxToken); // just to check if the token is valid
221
- return await provider.requestUploadParts({
251
+
252
+ const res = await provider.requestUploadParts({
222
253
  multipart,
223
254
  path,
224
255
  });
256
+
257
+ log.debug('Finished [requestUploadParts]');
258
+
259
+ return res;
225
260
  }
226
261
 
227
262
  export type CompleteMultipartUploadBody = {
@@ -246,6 +281,14 @@ export async function completeMultipartUpload<TCtx>(params: {
246
281
  ctxToken,
247
282
  body: { bucketName, uploadId, key, parts },
248
283
  } = params;
284
+
285
+ const log = globalThis._EDGE_STORE_LOGGER;
286
+ log.debug('Running [completeMultipartUpload]', {
287
+ bucketName,
288
+ uploadId,
289
+ key,
290
+ });
291
+
249
292
  if (!ctxToken) {
250
293
  throw new EdgeStoreError({
251
294
  message: 'Missing edgestore-ctx cookie',
@@ -260,11 +303,16 @@ export async function completeMultipartUpload<TCtx>(params: {
260
303
  code: 'BAD_REQUEST',
261
304
  });
262
305
  }
263
- return await provider.completeMultipartUpload({
306
+
307
+ const res = await provider.completeMultipartUpload({
264
308
  uploadId,
265
309
  key,
266
310
  parts,
267
311
  });
312
+
313
+ log.debug('Finished [completeMultipartUpload]');
314
+
315
+ return res;
268
316
  }
269
317
 
270
318
  export type ConfirmUploadBody = {
@@ -285,6 +333,9 @@ export async function confirmUpload<TCtx>(params: {
285
333
  body: { bucketName, url },
286
334
  } = params;
287
335
 
336
+ const log = globalThis._EDGE_STORE_LOGGER;
337
+ log.debug('Running [confirmUpload]', { bucketName, url });
338
+
288
339
  if (!ctxToken) {
289
340
  throw new EdgeStoreError({
290
341
  message: 'Missing edgestore-ctx cookie',
@@ -300,10 +351,13 @@ export async function confirmUpload<TCtx>(params: {
300
351
  });
301
352
  }
302
353
 
303
- return await provider.confirmUpload({
354
+ const res = await provider.confirmUpload({
304
355
  bucket,
305
356
  url: unproxyUrl(url),
306
357
  });
358
+
359
+ log.debug('Finished [confirmUpload]');
360
+ return res;
307
361
  }
308
362
 
309
363
  export type DeleteFileBody = {
@@ -324,6 +378,9 @@ export async function deleteFile<TCtx>(params: {
324
378
  body: { bucketName, url },
325
379
  } = params;
326
380
 
381
+ const log = globalThis._EDGE_STORE_LOGGER;
382
+ log.debug('Running [deleteFile]', { bucketName, url });
383
+
327
384
  if (!ctxToken) {
328
385
  throw new EdgeStoreError({
329
386
  message: 'Missing edgestore-ctx cookie',
@@ -361,10 +418,14 @@ export async function deleteFile<TCtx>(params: {
361
418
  code: 'DELETE_NOT_ALLOWED',
362
419
  });
363
420
  }
364
- return await provider.deleteFile({
421
+ const res = await provider.deleteFile({
365
422
  bucket,
366
423
  url: unproxyUrl(url),
367
424
  });
425
+
426
+ log.debug('Finished [deleteFile]');
427
+
428
+ return res;
368
429
  }
369
430
 
370
431
  async function encryptJWT(ctx: any) {
@@ -74,11 +74,9 @@ class EdgeStoreError<TCode extends EdgeStoreErrorCodeKey> extends Error {
74
74
  }
75
75
 
76
76
  formattedMessage(): string {
77
- return `EdgeStore${this.level === 'error' ? 'Error' : 'Info'}: ${
78
- this.message
79
- }${this.details ? `\n Details: ${JSON.stringify(this.details)}` : ''}${
80
- this.cause ? `\n Caused by: ${this.cause.message}` : ''
81
- }`;
77
+ return `${this.message}${
78
+ this.details ? `\n Details: ${JSON.stringify(this.details)}` : ''
79
+ }${this.cause ? `\n Caused by: ${this.cause.message}` : ''}`;
82
80
  }
83
81
 
84
82
  formattedJson(): EdgeStoreJsonResponse {
@@ -9,7 +9,7 @@ class Logger {
9
9
 
10
10
  constructor(logLevel?: LogLevel) {
11
11
  this.logLevel =
12
- logLevel ?? process.env.NODE_ENV === 'production' ? 'error' : 'info';
12
+ logLevel ?? (process.env.NODE_ENV === 'production' ? 'error' : 'info');
13
13
  }
14
14
 
15
15
  private shouldLog(level: LogLevel): boolean {
@@ -18,25 +18,25 @@ class Logger {
18
18
 
19
19
  debug(message?: any, ...optionalParams: any[]): void {
20
20
  if (this.shouldLog('debug')) {
21
- console.debug(message, ...optionalParams);
21
+ console.debug('[EdgeStoreDebug]', message, ...optionalParams);
22
22
  }
23
23
  }
24
24
 
25
25
  info(message?: any, ...optionalParams: any[]): void {
26
26
  if (this.shouldLog('info')) {
27
- console.info(message, ...optionalParams);
27
+ console.info('[EdgeStoreInfo]', message, ...optionalParams);
28
28
  }
29
29
  }
30
30
 
31
31
  warn(message?: any, ...optionalParams: any[]): void {
32
32
  if (this.shouldLog('warn')) {
33
- console.warn(message, ...optionalParams);
33
+ console.warn('[EdgeStoreWarn]', message, ...optionalParams);
34
34
  }
35
35
  }
36
36
 
37
37
  error(message?: any, ...optionalParams: any[]): void {
38
38
  if (this.shouldLog('error')) {
39
- console.error(message, ...optionalParams);
39
+ console.error('[EdgeStoreError]', message, ...optionalParams);
40
40
  }
41
41
  }
42
42
  }