@helia/http 2.0.5 → 2.1.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.
@@ -52,6 +52,11 @@ export interface HeliaHTTPInit extends HeliaInit {
52
52
  */
53
53
  start?: boolean;
54
54
  }
55
+ /**
56
+ * Create and return the default options used to create a Helia node that only
57
+ * uses HTTP services
58
+ */
59
+ export declare function heliaDefaults(init?: Partial<HeliaHTTPInit>): Promise<HeliaHTTPInit>;
55
60
  /**
56
61
  * Create and return a Helia node
57
62
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAIH,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAGlE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAI7C,cAAc,kBAAkB,CAAA;AAEhC,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAE,IAAI,GAAE,OAAO,CAAC,aAAa,CAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAsBxF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAIH,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAGlE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAI7C,cAAc,kBAAkB,CAAA;AAEhC,MAAM,WAAW,aAAc,SAAQ,SAAS;IAC9C;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAE,IAAI,GAAE,OAAO,CAAC,aAAa,CAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAgB9F;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAE,IAAI,GAAE,OAAO,CAAC,aAAa,CAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAsBxF"}
package/dist/src/index.js CHANGED
@@ -51,6 +51,26 @@ import { MemoryDatastore } from 'datastore-core';
51
51
  // re-export interface types so people don't have to depend on @helia/interface
52
52
  // if they don't want to
53
53
  export * from '@helia/interface';
54
+ /**
55
+ * Create and return the default options used to create a Helia node that only
56
+ * uses HTTP services
57
+ */
58
+ export async function heliaDefaults(init = {}) {
59
+ const datastore = init.datastore ?? new MemoryDatastore();
60
+ const blockstore = init.blockstore ?? new MemoryBlockstore();
61
+ return {
62
+ ...init,
63
+ datastore,
64
+ blockstore,
65
+ blockBrokers: init.blockBrokers ?? [
66
+ trustlessGateway()
67
+ ],
68
+ routers: init.routers ?? [
69
+ delegatedHTTPRouting('https://delegated-ipfs.dev'),
70
+ httpGatewayRouting()
71
+ ]
72
+ };
73
+ }
54
74
  /**
55
75
  * Create and return a Helia node
56
76
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AACzE,OAAO,EAAE,KAAK,IAAI,UAAU,EAAkB,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAGhD,+EAA+E;AAC/E,wBAAwB;AACxB,cAAc,kBAAkB,CAAA;AAShC;;GAEG;AACH,MAAM,CAA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AAG,IAAI,CAAC,UAAU,IAAI,IAAI,gBAAgB,EAAE,CAAA;IAE5D,OAAO;QACL,GAAG,IAAI;QACP,SAAS;QACT,UAAU;QACV,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI;YACjC,gBAAgB,EAAE;SACnB;QACD,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI;YACvB,oBAAoB,CAAC,4BAA4B,CAAC;YAClD,kBAAkB,EAAE;SACrB;KACF,CAAA;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAE,OAA+B,EAAE;IACtE,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,eAAe,EAAE,CAAA;IACzD,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,gBAAgB,EAAE,CAAA;IAE5D,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC;QAC3B,GAAG,IAAI;QACP,SAAS;QACT,UAAU;QACV,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI;YACjC,gBAAgB,EAAE;SACnB;QACD,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI;YACvB,oBAAoB,CAAC,4BAA4B,CAAC;YAClD,kBAAkB,EAAE;SACrB;KACF,CAAC,CAAA;IAEF,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,CAAC,KAAK,EAAE,CAAA;IACrB,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -2,5 +2,7 @@
2
2
  "HeliaHTTPInit": "https://ipfs.github.io/helia/interfaces/_helia_http.HeliaHTTPInit.html",
3
3
  ".:HeliaHTTPInit": "https://ipfs.github.io/helia/interfaces/_helia_http.HeliaHTTPInit.html",
4
4
  "createHeliaHTTP": "https://ipfs.github.io/helia/functions/_helia_http.createHeliaHTTP.html",
5
- ".:createHeliaHTTP": "https://ipfs.github.io/helia/functions/_helia_http.createHeliaHTTP.html"
5
+ ".:createHeliaHTTP": "https://ipfs.github.io/helia/functions/_helia_http.createHeliaHTTP.html",
6
+ "heliaDefaults": "https://ipfs.github.io/helia/functions/_helia_http.heliaDefaults.html",
7
+ ".:heliaDefaults": "https://ipfs.github.io/helia/functions/_helia_http.heliaDefaults.html"
6
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@helia/http",
3
- "version": "2.0.5",
3
+ "version": "2.1.0",
4
4
  "description": "A lightweight implementation of IPFS over HTTP in JavaScript",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/ipfs/helia/tree/main/packages/http#readme",
@@ -54,10 +54,10 @@
54
54
  "test:electron-main": "aegir test -t electron-main"
55
55
  },
56
56
  "dependencies": {
57
- "@helia/block-brokers": "^4.1.0",
58
- "@helia/interface": "^5.2.1",
59
- "@helia/routers": "^3.0.1",
60
- "@helia/utils": "^1.2.2",
57
+ "@helia/block-brokers": "^4.2.0",
58
+ "@helia/interface": "^5.3.0",
59
+ "@helia/routers": "^3.1.0",
60
+ "@helia/utils": "^1.3.0",
61
61
  "blockstore-core": "^5.0.2",
62
62
  "datastore-core": "^10.0.2"
63
63
  },
package/src/index.ts CHANGED
@@ -62,6 +62,28 @@ export interface HeliaHTTPInit extends HeliaInit {
62
62
  start?: boolean
63
63
  }
64
64
 
65
+ /**
66
+ * Create and return the default options used to create a Helia node that only
67
+ * uses HTTP services
68
+ */
69
+ export async function heliaDefaults (init: Partial<HeliaHTTPInit> = {}): Promise<HeliaHTTPInit> {
70
+ const datastore = init.datastore ?? new MemoryDatastore()
71
+ const blockstore = init.blockstore ?? new MemoryBlockstore()
72
+
73
+ return {
74
+ ...init,
75
+ datastore,
76
+ blockstore,
77
+ blockBrokers: init.blockBrokers ?? [
78
+ trustlessGateway()
79
+ ],
80
+ routers: init.routers ?? [
81
+ delegatedHTTPRouting('https://delegated-ipfs.dev'),
82
+ httpGatewayRouting()
83
+ ]
84
+ }
85
+ }
86
+
65
87
  /**
66
88
  * Create and return a Helia node
67
89
  */