@blocklet/store 1.16.33-beta-20241022-042744-ed5c22d7 → 1.16.33-beta-20241024-064549-2c1ad302
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/index.cjs +11 -5
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +8 -3
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const security = require('@abtnode/util/lib/security');
|
|
4
|
-
const
|
|
4
|
+
const get = require('lodash/get');
|
|
5
5
|
const tweetnacl = require('tweetnacl');
|
|
6
6
|
const SealedBox = require('tweetnacl-sealedbox-js');
|
|
7
7
|
const ufo = require('ufo');
|
|
@@ -18,6 +18,7 @@ const yaml = require('js-yaml');
|
|
|
18
18
|
const pAll = require('p-all');
|
|
19
19
|
const path = require('path');
|
|
20
20
|
const createBlockletRelease = require('@abtnode/util/lib/create-blocklet-release');
|
|
21
|
+
const lodash = require('lodash');
|
|
21
22
|
const Client = require('@ocap/client');
|
|
22
23
|
const constant$1 = require('@abtnode/constant');
|
|
23
24
|
const constant = require('@blocklet/constant');
|
|
@@ -28,6 +29,7 @@ const fs = require('fs');
|
|
|
28
29
|
|
|
29
30
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
30
31
|
|
|
32
|
+
const get__default = /*#__PURE__*/_interopDefaultCompat(get);
|
|
31
33
|
const tweetnacl__default = /*#__PURE__*/_interopDefaultCompat(tweetnacl);
|
|
32
34
|
const SealedBox__default = /*#__PURE__*/_interopDefaultCompat(SealedBox);
|
|
33
35
|
const axios__default = /*#__PURE__*/_interopDefaultCompat(axios);
|
|
@@ -114,6 +116,7 @@ async function createConnect({
|
|
|
114
116
|
enableEncrypt = false,
|
|
115
117
|
closeOnSuccess,
|
|
116
118
|
monikers,
|
|
119
|
+
prettyUrl,
|
|
117
120
|
...restParams
|
|
118
121
|
} = {}) {
|
|
119
122
|
const ENDPOINT_CREATE_SESSION = `/api/did/${connectAction}/token`;
|
|
@@ -161,7 +164,10 @@ async function createConnect({
|
|
|
161
164
|
source,
|
|
162
165
|
closeOnSuccess
|
|
163
166
|
});
|
|
164
|
-
console.
|
|
167
|
+
console.info(
|
|
168
|
+
"If browser does not open automatically, please open the following link in your browser: ",
|
|
169
|
+
prettyUrl?.(pageUrl) || pageUrl
|
|
170
|
+
);
|
|
165
171
|
openPage?.(pageUrl);
|
|
166
172
|
return await wrapSpinner(`Waiting for connection: ${connectUrl}`, async () => {
|
|
167
173
|
const fetchData = await fetchConfigs({
|
|
@@ -176,10 +182,10 @@ async function createConnect({
|
|
|
176
182
|
});
|
|
177
183
|
} catch (e) {
|
|
178
184
|
const err = e;
|
|
179
|
-
const response =
|
|
185
|
+
const response = get__default(err, "response");
|
|
180
186
|
let errorMessage;
|
|
181
187
|
if (response) {
|
|
182
|
-
errorMessage =
|
|
188
|
+
errorMessage = get__default(response, "data.error", response.statusText) || "";
|
|
183
189
|
errorMessage = `[${response.status}] ${errorMessage}`;
|
|
184
190
|
} else {
|
|
185
191
|
errorMessage = err.message;
|
|
@@ -440,7 +446,7 @@ async function upload({
|
|
|
440
446
|
debug("Upload result:", uploadResult.data);
|
|
441
447
|
} catch (err) {
|
|
442
448
|
if (err.response) {
|
|
443
|
-
const errorMessage =
|
|
449
|
+
const errorMessage = get__default(err.response, "data.error", err.response.statusText);
|
|
444
450
|
throw new Error(`Upload failed with error: [${err.response.status}] ${errorMessage}`);
|
|
445
451
|
}
|
|
446
452
|
throw new Error(`Upload failed with error: ${err.message}`);
|
package/dist/index.d.cts
CHANGED
|
@@ -13,9 +13,10 @@ interface CreateConnectOptions {
|
|
|
13
13
|
projectId?: string;
|
|
14
14
|
monikers?: string;
|
|
15
15
|
userDid?: string;
|
|
16
|
+
prettyUrl?: (url: string) => string;
|
|
16
17
|
closeOnSuccess?: boolean;
|
|
17
18
|
}
|
|
18
|
-
declare function createConnect({ connectUrl, openPage, fetchTimeout, fetchInterval, retry, source, connectAction, wrapSpinner, projectId, userDid, enableEncrypt, closeOnSuccess, monikers, ...restParams }?: CreateConnectOptions): Promise<unknown>;
|
|
19
|
+
declare function createConnect({ connectUrl, openPage, fetchTimeout, fetchInterval, retry, source, connectAction, wrapSpinner, projectId, userDid, enableEncrypt, closeOnSuccess, monikers, prettyUrl, ...restParams }?: CreateConnectOptions): Promise<unknown>;
|
|
19
20
|
|
|
20
21
|
interface BlockletMeta {
|
|
21
22
|
name: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -13,9 +13,10 @@ interface CreateConnectOptions {
|
|
|
13
13
|
projectId?: string;
|
|
14
14
|
monikers?: string;
|
|
15
15
|
userDid?: string;
|
|
16
|
+
prettyUrl?: (url: string) => string;
|
|
16
17
|
closeOnSuccess?: boolean;
|
|
17
18
|
}
|
|
18
|
-
declare function createConnect({ connectUrl, openPage, fetchTimeout, fetchInterval, retry, source, connectAction, wrapSpinner, projectId, userDid, enableEncrypt, closeOnSuccess, monikers, ...restParams }?: CreateConnectOptions): Promise<unknown>;
|
|
19
|
+
declare function createConnect({ connectUrl, openPage, fetchTimeout, fetchInterval, retry, source, connectAction, wrapSpinner, projectId, userDid, enableEncrypt, closeOnSuccess, monikers, prettyUrl, ...restParams }?: CreateConnectOptions): Promise<unknown>;
|
|
19
20
|
|
|
20
21
|
interface BlockletMeta {
|
|
21
22
|
name: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -13,9 +13,10 @@ interface CreateConnectOptions {
|
|
|
13
13
|
projectId?: string;
|
|
14
14
|
monikers?: string;
|
|
15
15
|
userDid?: string;
|
|
16
|
+
prettyUrl?: (url: string) => string;
|
|
16
17
|
closeOnSuccess?: boolean;
|
|
17
18
|
}
|
|
18
|
-
declare function createConnect({ connectUrl, openPage, fetchTimeout, fetchInterval, retry, source, connectAction, wrapSpinner, projectId, userDid, enableEncrypt, closeOnSuccess, monikers, ...restParams }?: CreateConnectOptions): Promise<unknown>;
|
|
19
|
+
declare function createConnect({ connectUrl, openPage, fetchTimeout, fetchInterval, retry, source, connectAction, wrapSpinner, projectId, userDid, enableEncrypt, closeOnSuccess, monikers, prettyUrl, ...restParams }?: CreateConnectOptions): Promise<unknown>;
|
|
19
20
|
|
|
20
21
|
interface BlockletMeta {
|
|
21
22
|
name: string;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { encodeEncryptionKey } from '@abtnode/util/lib/security';
|
|
2
|
-
import
|
|
2
|
+
import get from 'lodash/get';
|
|
3
3
|
import tweetnacl from 'tweetnacl';
|
|
4
4
|
import SealedBox from 'tweetnacl-sealedbox-js';
|
|
5
5
|
import { withQuery, joinURL } from 'ufo';
|
|
@@ -16,6 +16,7 @@ import yaml from 'js-yaml';
|
|
|
16
16
|
import pAll from 'p-all';
|
|
17
17
|
import path from 'path';
|
|
18
18
|
import { createRelease } from '@abtnode/util/lib/create-blocklet-release';
|
|
19
|
+
import { cloneDeep, get as get$1 } from 'lodash';
|
|
19
20
|
import Client from '@ocap/client';
|
|
20
21
|
import { BLOCKLET_STORE_META_PATH } from '@abtnode/constant';
|
|
21
22
|
import { BLOCKLET_FACTORY_SHARES } from '@blocklet/constant';
|
|
@@ -96,6 +97,7 @@ async function createConnect({
|
|
|
96
97
|
enableEncrypt = false,
|
|
97
98
|
closeOnSuccess,
|
|
98
99
|
monikers,
|
|
100
|
+
prettyUrl,
|
|
99
101
|
...restParams
|
|
100
102
|
} = {}) {
|
|
101
103
|
const ENDPOINT_CREATE_SESSION = `/api/did/${connectAction}/token`;
|
|
@@ -143,7 +145,10 @@ async function createConnect({
|
|
|
143
145
|
source,
|
|
144
146
|
closeOnSuccess
|
|
145
147
|
});
|
|
146
|
-
console.
|
|
148
|
+
console.info(
|
|
149
|
+
"If browser does not open automatically, please open the following link in your browser: ",
|
|
150
|
+
prettyUrl?.(pageUrl) || pageUrl
|
|
151
|
+
);
|
|
147
152
|
openPage?.(pageUrl);
|
|
148
153
|
return await wrapSpinner(`Waiting for connection: ${connectUrl}`, async () => {
|
|
149
154
|
const fetchData = await fetchConfigs({
|
|
@@ -195,7 +200,7 @@ const getShare = async ({
|
|
|
195
200
|
developerDid
|
|
196
201
|
}) => {
|
|
197
202
|
const info = await getStoreInfo(storeUrl);
|
|
198
|
-
const shares = cloneDeep(get(meta, "payment.share", []));
|
|
203
|
+
const shares = cloneDeep(get$1(meta, "payment.share", []));
|
|
199
204
|
if (shares.length === 0) {
|
|
200
205
|
shares.push({
|
|
201
206
|
name: "developer",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/store",
|
|
3
|
-
"version": "1.16.33-beta-
|
|
3
|
+
"version": "1.16.33-beta-20241024-064549-2c1ad302",
|
|
4
4
|
"description": "Connect Store and upload blocklet to Store",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"author": "",
|
|
28
28
|
"license": "ISC",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@abtnode/constant": "1.16.33-beta-
|
|
31
|
-
"@abtnode/util": "1.16.33-beta-
|
|
32
|
-
"@arcblock/did": "1.18.
|
|
33
|
-
"@blocklet/constant": "1.16.33-beta-
|
|
34
|
-
"@blocklet/meta": "1.16.33-beta-
|
|
35
|
-
"@ocap/client": "^1.18.
|
|
36
|
-
"@ocap/util": "1.18.
|
|
37
|
-
"@ocap/wallet": "1.18.
|
|
30
|
+
"@abtnode/constant": "1.16.33-beta-20241024-064549-2c1ad302",
|
|
31
|
+
"@abtnode/util": "1.16.33-beta-20241024-064549-2c1ad302",
|
|
32
|
+
"@arcblock/did": "1.18.136",
|
|
33
|
+
"@blocklet/constant": "1.16.33-beta-20241024-064549-2c1ad302",
|
|
34
|
+
"@blocklet/meta": "1.16.33-beta-20241024-064549-2c1ad302",
|
|
35
|
+
"@ocap/client": "^1.18.136",
|
|
36
|
+
"@ocap/util": "1.18.136",
|
|
37
|
+
"@ocap/wallet": "1.18.136",
|
|
38
38
|
"form-data": "^4.0.0",
|
|
39
39
|
"fs-extra": "^11.2.0",
|
|
40
40
|
"js-yaml": "^4.1.0",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"typescript": "^5.6.3",
|
|
63
63
|
"unbuild": "^2.0.0"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "3b0da27501ff0c115335cbf46364c37a754fefdc"
|
|
66
66
|
}
|