@wovin/connect-nftstorage 0.0.1-RC21 → 0.0.1-RC23
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/{chunk-JPD6PCG6.js → chunk-7HXBFNXR.js} +491 -186
- package/dist/chunk-7HXBFNXR.js.map +1 -0
- package/dist/chunk-R6GDUZUI.js +1520 -0
- package/dist/chunk-R6GDUZUI.js.map +1 -0
- package/dist/chunk-UEOOYEN2.js +19054 -0
- package/dist/chunk-UEOOYEN2.js.map +1 -0
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -8
- package/dist/index.js.map +1 -1
- package/dist/retrieve.js +2 -3
- package/dist/store.d.ts +2 -3
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +2 -4
- package/dist/utils.d.ts +0 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +0 -20
- package/dist/utils.js.map +1 -1
- package/package.json +3 -4
- package/dist/chunk-4FG7WPTV.js +0 -104673
- package/dist/chunk-4FG7WPTV.js.map +0 -1
- package/dist/chunk-JN4DQDNQ.js +0 -385
- package/dist/chunk-JN4DQDNQ.js.map +0 -1
- package/dist/chunk-JPD6PCG6.js.map +0 -1
- package/dist/chunk-JS6FK6O4.js +0 -102284
- package/dist/chunk-JS6FK6O4.js.map +0 -1
- package/dist/chunk-RXHOK4WI.js +0 -16396
- package/dist/chunk-RXHOK4WI.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Crypto, ucan } from '@oddjs/odd';
|
|
2
1
|
import * as ucans from '@ucans/ucans';
|
|
3
2
|
import { type StorageConnector } from '@wovin/core/pubsub';
|
|
4
3
|
import { CID } from 'multiformats';
|
|
@@ -7,13 +6,12 @@ export declare class NftStorageConnector implements StorageConnector {
|
|
|
7
6
|
private keypair;
|
|
8
7
|
serviceDID: string;
|
|
9
8
|
apiKey: string;
|
|
10
|
-
rootUcan:
|
|
9
|
+
rootUcan: ucans.Ucan;
|
|
11
10
|
static init({ apiKey }: {
|
|
12
|
-
oddCrypto: Crypto.Implementation;
|
|
13
11
|
apiKey?: string;
|
|
14
|
-
rootUcan?:
|
|
12
|
+
rootUcan?: ucans.Ucan;
|
|
15
13
|
}): Promise<NftStorageConnector>;
|
|
16
|
-
constructor(keypair: ucans.DidableKey, serviceDID: string, apiKey: string, rootUcan:
|
|
14
|
+
constructor(keypair: ucans.DidableKey, serviceDID: string, apiKey: string, rootUcan: ucans.Ucan);
|
|
17
15
|
storeCar(car: Blob): Promise<CID<unknown, number, number, import("multiformats").Version>>;
|
|
18
16
|
retrieveCar(cid: CID): Promise<import("@ipld/car").CarReader>;
|
|
19
17
|
}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAMlC,cAAc,YAAY,CAAA;AAG1B,qBAAa,mBAAoB,YAAW,gBAAgB;IAmB1D,OAAO,CAAC,OAAO;IACR,UAAU,EAAE,MAAM;IAClB,MAAM,EAAE,MAAM;IACd,QAAQ,EAAE,KAAK,CAAC,IAAI;WArBf,IAAI,CAAC,EAAE,MAAM,EAA4B,EAAE;QAEvD,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,QAAQ,CAAC,EAAE,KAAK,CAAC,IAAI,CAAA;KACrB;gBAcQ,OAAO,EAAE,KAAK,CAAC,UAAU,EAC1B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,KAAK,CAAC,IAAI;IAGtB,QAAQ,CAAC,GAAG,EAAE,IAAI;IAiBlB,WAAW,CAAC,GAAG,EAAE,GAAG;CAG1B"}
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
resolveIPNS,
|
|
3
3
|
retrieveCar,
|
|
4
4
|
retrievePubStream
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-UEOOYEN2.js";
|
|
6
6
|
import {
|
|
7
7
|
EdKeypair,
|
|
8
8
|
createRequestToken,
|
|
@@ -10,17 +10,12 @@ import {
|
|
|
10
10
|
getRootUcan,
|
|
11
11
|
registerDid,
|
|
12
12
|
storeCar
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-7HXBFNXR.js";
|
|
14
14
|
import {
|
|
15
15
|
Logger
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-4FG7WPTV.js";
|
|
18
|
-
import {
|
|
19
|
-
init_dirname
|
|
20
|
-
} from "./chunk-RXHOK4WI.js";
|
|
16
|
+
} from "./chunk-R6GDUZUI.js";
|
|
21
17
|
|
|
22
18
|
// src/index.ts
|
|
23
|
-
init_dirname();
|
|
24
19
|
var { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.DEBUG);
|
|
25
20
|
var NftStorageConnector = class _NftStorageConnector {
|
|
26
21
|
constructor(keypair, serviceDID, apiKey, rootUcan) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { Crypto, did, ucan } from '@oddjs/odd'\nimport * as ucans from '@ucans/ucans'\nimport { CidString } from '@wovin/core'\nimport { type StorageConnector } from '@wovin/core/pubsub'\nimport { Logger } from 'besonders-logger'\nimport { CID } from 'multiformats'\nimport { retrieveCar, retrievePubStream } from './retrieve'\nimport { createRequestToken, getRootUcan, registerDid, storeCar } from './store'\
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// import { Crypto, did, ucan } from '@oddjs/odd/'\nimport * as ucans from '@ucans/ucans'\nimport { CidString } from '@wovin/core'\nimport { type StorageConnector } from '@wovin/core/pubsub'\nimport { Logger } from 'besonders-logger'\nimport { CID } from 'multiformats'\nimport { retrieveCar, retrievePubStream } from './retrieve'\nimport { createRequestToken, getRootUcan, registerDid, storeCar } from './store'\n\nconst { WARN, LOG, DEBUG, VERBOSE, ERROR } = Logger.setup(Logger.DEBUG) // eslint-disable-line no-unused-vars\n\nexport * from './retrieve'\n// export * from './store'\n\nexport class NftStorageConnector implements StorageConnector {\n\tstatic async init({ apiKey /* rootUcan, oddCrypto*/ }: {\n\t\t// oddCrypto: Crypto.Implementation\n\t\tapiKey?: string\n\t\trootUcan?: ucans.Ucan\n\t}) {\n\t\tconst { value: serviceDID } = await (await fetch('https://api.nft.storage/did')).json()\n\t\t// const myDid = await getDid(oddCrypto)\n\t\tconst keypair = await ucans.EdKeypair.create()\n\t\tLOG(`Service DID:`, serviceDID)\n\t\t// LOG(`My DID:`, myDid, keypair)\n\t\t// if (!rootUcan) {\n\t\t// await registerDid(apiKey, myDid)\n\t\t// rootUcan = await getRootUcan(apiKey)\n\t\t// }\n\t\treturn new NftStorageConnector(keypair, serviceDID, apiKey, null /* rootUcan */)\n\t}\n\tconstructor(\n\t\t// private oddCrypto: Crypto.Implementation,\n\t\tprivate keypair: ucans.DidableKey,\n\t\tpublic serviceDID: string,\n\t\tpublic apiKey: string,\n\t\tpublic rootUcan: ucans.Ucan,\n\t) {}\n\n\tasync storeCar(car: Blob) {\n\t\tfor (let attempt = 0; attempt < 3; attempt++) {\n\t\t\ttry {\n\t\t\t\tif (!this.rootUcan) {\n\t\t\t\t\tawait registerDid(this.apiKey, this.keypair.did())\n\t\t\t\t\tthis.rootUcan = await getRootUcan(this.apiKey)\n\t\t\t\t}\n\t\t\t\tconst requestUcan = await createRequestToken(this.keypair, this.serviceDID, this.rootUcan)\n\t\t\t\treturn storeCar(car, ucans.encode(requestUcan))\n\t\t\t} catch (err) {\n\t\t\t\tif ((err as any).message?.contains('ERROR_TOKEN_NOT_FOUND')) {\n\t\t\t\t\tWARN(`Token not found (might be a race condition), retrying...`, err)\n\t\t\t\t} else throw err\n\t\t\t}\n\t\t}\n\t}\n\n\tasync retrieveCar(cid: CID) {\n\t\treturn retrieveCar(cid)\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AASA,IAAM,EAAE,MAAM,KAAK,OAAO,SAAS,MAAM,IAAI,OAAO,MAAM,OAAO,KAAK;AAK/D,IAAM,sBAAN,MAAM,qBAAgD;AAAA,EAiB5D,YAES,SACD,YACA,QACA,UACN;AAJO;AACD;AACA;AACA;AAAA,EACL;AAAA,EAtBH,aAAa,KAAK;AAAA,IAAE;AAAA;AAAA,EAAiC,GAIlD;AACF,UAAM,EAAE,OAAO,WAAW,IAAI,OAAO,MAAM,MAAM,6BAA6B,GAAG,KAAK;AAEtF,UAAM,UAAU,MAAY,UAAU,OAAO;AAC7C,QAAI,gBAAgB,UAAU;AAM9B,WAAO,IAAI;AAAA,MAAoB;AAAA,MAAS;AAAA,MAAY;AAAA,MAAQ;AAAA;AAAA,IAAmB;AAAA,EAChF;AAAA,EASA,MAAM,SAAS,KAAW;AACzB,aAAS,UAAU,GAAG,UAAU,GAAG,WAAW;AAC7C,UAAI;AACH,YAAI,CAAC,KAAK,UAAU;AACnB,gBAAM,YAAY,KAAK,QAAQ,KAAK,QAAQ,IAAI,CAAC;AACjD,eAAK,WAAW,MAAM,YAAY,KAAK,MAAM;AAAA,QAC9C;AACA,cAAM,cAAc,MAAM,mBAAmB,KAAK,SAAS,KAAK,YAAY,KAAK,QAAQ;AACzF,eAAO,SAAS,KAAW,OAAO,WAAW,CAAC;AAAA,MAC/C,SAAS,KAAK;AACb,YAAK,IAAY,SAAS,SAAS,uBAAuB,GAAG;AAC5D,eAAK,4DAA4D,GAAG;AAAA,QACrE;AAAO,gBAAM;AAAA,MACd;AAAA,IACD;AAAA,EACD;AAAA,EAEA,MAAM,YAAY,KAAU;AAC3B,WAAO,YAAY,GAAG;AAAA,EACvB;AACD;","names":[]}
|
package/dist/retrieve.js
CHANGED
package/dist/store.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ucan } from '@oddjs/odd';
|
|
2
1
|
import * as ucans from '@ucans/ucans';
|
|
3
2
|
import { CID } from 'multiformats';
|
|
4
3
|
export declare function storeCar(car: Blob, encodedUcan: string): Promise<CID>;
|
|
5
|
-
export declare function createRequestToken(keypair: ucans.DidableKey, serviceDID: string, ucanToken:
|
|
4
|
+
export declare function createRequestToken(keypair: ucans.DidableKey, serviceDID: string, ucanToken: ucans.Ucan): Promise<ucans.Ucan<string>>;
|
|
6
5
|
export declare function registerDid(apiKey: string, did: string): Promise<void>;
|
|
7
|
-
export declare function getRootUcan(apiKey: string): Promise<
|
|
6
|
+
export declare function getRootUcan(apiKey: string): Promise<ucans.Ucan<string>>;
|
|
8
7
|
//# sourceMappingURL=store.d.ts.map
|
package/dist/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAIlC,wBAAsB,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,GAAmB,OAAO,CAAC,GAAG,CAAC,CAgB3F;AA0BD,wBAAsB,kBAAkB,CACvC,OAAO,EAAE,KAAK,CAAC,UAAU,EAEzB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,KAAK,CAAC,IAAI,+BA0BrB;AACD,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,iBAa5D;AACD,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,+BAW/C"}
|
package/dist/store.js
CHANGED
|
@@ -3,10 +3,8 @@ import {
|
|
|
3
3
|
getRootUcan,
|
|
4
4
|
registerDid,
|
|
5
5
|
storeCar
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-4FG7WPTV.js";
|
|
9
|
-
import "./chunk-RXHOK4WI.js";
|
|
6
|
+
} from "./chunk-7HXBFNXR.js";
|
|
7
|
+
import "./chunk-R6GDUZUI.js";
|
|
10
8
|
export {
|
|
11
9
|
createRequestToken,
|
|
12
10
|
getRootUcan,
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":""}
|
package/dist/utils.js
CHANGED
|
@@ -1,21 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
did_exports
|
|
3
|
-
} from "./chunk-4FG7WPTV.js";
|
|
4
|
-
import {
|
|
5
|
-
init_dirname
|
|
6
|
-
} from "./chunk-RXHOK4WI.js";
|
|
7
|
-
|
|
8
|
-
// src/utils.ts
|
|
9
|
-
init_dirname();
|
|
10
|
-
async function getDid(crypto) {
|
|
11
|
-
const pubKey = await crypto.keystore.publicExchangeKey();
|
|
12
|
-
return did_exports.publicKeyToDid(
|
|
13
|
-
crypto,
|
|
14
|
-
pubKey,
|
|
15
|
-
"ed25519"
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
getDid
|
|
20
|
-
};
|
|
21
1
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wovin/connect-nftstorage",
|
|
3
|
-
"version": "0.0.1-
|
|
3
|
+
"version": "0.0.1-RC23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsup && tsc --emitDeclarationOnly --declaration",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
|
|
10
10
|
"pub": "npm publish --tag latest --access=public"
|
|
11
11
|
},
|
|
12
|
-
"main": "dist/index.cjs",
|
|
12
|
+
"//main": "dist/index.cjs",
|
|
13
13
|
"module": "dist/index.js",
|
|
14
14
|
"types": "dist/index.d.ts",
|
|
15
15
|
"exports": {
|
|
@@ -23,9 +23,8 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@ipld/car": "^5.2.4",
|
|
26
|
-
"@oddjs/odd": "^0.37.2",
|
|
27
26
|
"@ucans/ucans": "^0.12.0",
|
|
28
|
-
"@wovin/core": "0.0.1-
|
|
27
|
+
"@wovin/core": "0.0.1-RC23",
|
|
29
28
|
"besonders-logger": "1.0.0-RC11",
|
|
30
29
|
"multiformats": "^12.1.3",
|
|
31
30
|
"ucan-storage": "^1.3.0"
|