@blocklet/sdk 1.16.53-beta-20251010-233105-b0ddacda → 1.16.53-beta-20251011-054719-4ed2f6b7
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/lib/component/index.js
CHANGED
|
@@ -87,7 +87,7 @@ const doCall = async ({ url, headers = {}, ...options }, retryOptions = {}) => (
|
|
|
87
87
|
onFailedAttempt: retryOptions.onFailedAttempt || noop_1.default,
|
|
88
88
|
});
|
|
89
89
|
const getComponent = (name) => {
|
|
90
|
-
const item = config_1.
|
|
90
|
+
const item = (0, config_1.getComponents)().find((x) => [x.title, x.name, x.did].includes(name));
|
|
91
91
|
return item;
|
|
92
92
|
};
|
|
93
93
|
const getComponentWebEndpoint = (keyword) => {
|
|
@@ -164,11 +164,11 @@ const getReleaseExportDir = ({ projectId, releaseId }) => {
|
|
|
164
164
|
};
|
|
165
165
|
exports.getReleaseExportDir = getReleaseExportDir;
|
|
166
166
|
const getResources = ({ scope = 'all', types, skipRunningCheck, } = {}) => {
|
|
167
|
-
return Util.getResources({ components: config_1.
|
|
167
|
+
return Util.getResources({ components: (0, config_1.getComponents)(), scope, types, skipRunningCheck });
|
|
168
168
|
};
|
|
169
169
|
exports.getResources = getResources;
|
|
170
170
|
const getPackResources = ({ types, } = {}) => {
|
|
171
|
-
return Util.getResources({ components: config_1.
|
|
171
|
+
return Util.getResources({ components: (0, config_1.getComponents)(), scope: 'pack', types, ignorePublic: true });
|
|
172
172
|
};
|
|
173
173
|
exports.getPackResources = getPackResources;
|
|
174
174
|
const waitForComponentRunning = async (name, timeout = 30000, interval = 250) => {
|
package/lib/config.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ type MountPoint = TComponentInternalInfo & {
|
|
|
57
57
|
type TComponent = MountPoint;
|
|
58
58
|
type TComponents = Array<TComponent>;
|
|
59
59
|
declare const componentStore: TComponents;
|
|
60
|
+
declare const getComponents: () => TComponents;
|
|
60
61
|
declare const _handleComponentUpdateOld: (data: {
|
|
61
62
|
components: TComponents;
|
|
62
63
|
}) => void;
|
|
@@ -88,7 +89,7 @@ declare const getBlockletSettings: () => {
|
|
|
88
89
|
enableBlacklist: boolean;
|
|
89
90
|
};
|
|
90
91
|
declare const getBlockletJs: (pageGroup?: string, pathPrefix?: string, source?: string) => string;
|
|
91
|
-
export { logger, setLogger, env, componentStore as components, MountPoint, // @deprecated, for backward compatibility
|
|
92
|
+
export { logger, setLogger, env, componentStore as components, getComponents, MountPoint, // @deprecated, for backward compatibility
|
|
92
93
|
TComponent, events, Events, getBlockletJs, _handleComponentUpdateOld, _handleAppConfigUpdate, _handleAppSettingUpdate, _handleComponentInstalled, _handleComponentUpdated, _handleComponentStarted, _handleComponentStopped, _handleComponentRemoved, _handleComponentConfigUpdate, getBlockletSettings, };
|
|
93
94
|
declare const _default: {
|
|
94
95
|
logger: {
|
|
@@ -133,7 +134,8 @@ declare const _default: {
|
|
|
133
134
|
componentDid: string;
|
|
134
135
|
initialized?: boolean;
|
|
135
136
|
};
|
|
136
|
-
|
|
137
|
+
getComponents: () => TComponents;
|
|
138
|
+
readonly components: TComponents;
|
|
137
139
|
events: EventEmitter<[never]>;
|
|
138
140
|
Events: {
|
|
139
141
|
componentAdded: string;
|
package/lib/config.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getBlockletSettings = exports._handleComponentConfigUpdate = exports._handleComponentRemoved = exports._handleComponentStopped = exports._handleComponentStarted = exports._handleComponentUpdated = exports._handleComponentInstalled = exports._handleAppSettingUpdate = exports._handleAppConfigUpdate = exports._handleComponentUpdateOld = exports.getBlockletJs = exports.Events = exports.events = exports.components = exports.env = exports.setLogger = exports.logger = void 0;
|
|
6
|
+
exports.getBlockletSettings = exports._handleComponentConfigUpdate = exports._handleComponentRemoved = exports._handleComponentStopped = exports._handleComponentStarted = exports._handleComponentUpdated = exports._handleComponentInstalled = exports._handleAppSettingUpdate = exports._handleAppConfigUpdate = exports._handleComponentUpdateOld = exports.getBlockletJs = exports.Events = exports.events = exports.getComponents = exports.components = exports.env = exports.setLogger = exports.logger = void 0;
|
|
7
7
|
/* eslint-disable prettier/prettier */
|
|
8
8
|
/* eslint-disable no-console */
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
@@ -134,9 +134,11 @@ const initComponentStore = () => {
|
|
|
134
134
|
};
|
|
135
135
|
const componentStore = initComponentStore();
|
|
136
136
|
exports.components = componentStore;
|
|
137
|
+
const getComponents = () => componentStore;
|
|
138
|
+
exports.getComponents = getComponents;
|
|
137
139
|
const updateComponentStoreInDocker = (components) => {
|
|
138
140
|
if (!components || !components.length) {
|
|
139
|
-
return
|
|
141
|
+
return;
|
|
140
142
|
}
|
|
141
143
|
if (process.env.DOCKER_HOST_SERVER_DIR && process.env.DOCKER_CONTAINER_SERVER_DIR) {
|
|
142
144
|
const raw = JSON.stringify({ v: components });
|
|
@@ -146,7 +148,6 @@ const updateComponentStoreInDocker = (components) => {
|
|
|
146
148
|
components[i] = nextComponents[i];
|
|
147
149
|
}
|
|
148
150
|
}
|
|
149
|
-
return components;
|
|
150
151
|
};
|
|
151
152
|
const _handleComponentUpdateOld = (data) => {
|
|
152
153
|
componentStore.splice(0, componentStore.length);
|
|
@@ -395,7 +396,7 @@ if (inRuntimeEnv && !process.env.BLOCKLET_HOOK_NAME && process.env.BLOCKLET_MODE
|
|
|
395
396
|
notification_1.default.on(constant_1.BlockletInternalEvents.componentInstalled, runInServer(_handleComponentInstalled, 'new'));
|
|
396
397
|
notification_1.default.on(constant_1.BlockletInternalEvents.componentUpgraded, runInServer(_handleComponentUpdated, 'new'));
|
|
397
398
|
notification_1.default.on(constant_1.BlockletInternalEvents.componentUpdated, runInServer(_handleComponentUpdated, 'new'));
|
|
398
|
-
notification_1.default.on(constant_1.BlockletInternalEvents.componentStarted, runInServer(
|
|
399
|
+
notification_1.default.on(constant_1.BlockletInternalEvents.componentStarted, runInServer(_handleComponentStarted, 'new'));
|
|
399
400
|
notification_1.default.on(constant_1.BlockletInternalEvents.componentStopped, runInServer(_handleComponentStopped, 'new'));
|
|
400
401
|
notification_1.default.on(constant_1.BlockletInternalEvents.componentRemoved, runInServer(_handleComponentRemoved, 'new'));
|
|
401
402
|
notification_1.default.on(constant_1.BlockletInternalEvents.componentInstalled, runInServer(refreshBlockletContext, 'new'));
|
|
@@ -411,7 +412,10 @@ exports.default = {
|
|
|
411
412
|
logger,
|
|
412
413
|
setLogger,
|
|
413
414
|
env,
|
|
414
|
-
|
|
415
|
+
getComponents,
|
|
416
|
+
get components() {
|
|
417
|
+
return componentStore;
|
|
418
|
+
},
|
|
415
419
|
events,
|
|
416
420
|
Events,
|
|
417
421
|
fetchBlockletJs,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TComponentInternalInfo } from '@blocklet/meta/lib/blocklet';
|
|
2
2
|
type MountPoint = TComponentInternalInfo & {
|
|
3
3
|
webEndpoint?: string;
|
|
4
|
+
isGreen?: boolean;
|
|
4
5
|
};
|
|
5
6
|
export declare function parseDockerComponentHost(component: MountPoint): string;
|
|
6
7
|
export declare function parseDockerComponentEndpoint(endpoint: string, component: MountPoint): string;
|
|
@@ -13,7 +13,7 @@ function parseDockerHost(input) {
|
|
|
13
13
|
}
|
|
14
14
|
function parseDockerComponentHost(component) {
|
|
15
15
|
if (process.env.BLOCKLET_DOCKER_NETWORK && process.env.BLOCKLET_DOCKER_NETWORK !== 'host') {
|
|
16
|
-
return parseDockerHost(`${process.env.BLOCKLET_DOCKER_NETWORK}-${component.name || component.did}`);
|
|
16
|
+
return parseDockerHost(`${process.env.BLOCKLET_DOCKER_NETWORK}-${component.name || component.did}${component.isGreen ? '-green' : ''}`);
|
|
17
17
|
}
|
|
18
18
|
return '127.0.0.1';
|
|
19
19
|
}
|
|
@@ -21,7 +21,7 @@ function parseDockerComponentEndpoint(endpoint, component) {
|
|
|
21
21
|
if (endpoint && process.env.BLOCKLET_DOCKER_NETWORK && process.env.BLOCKLET_DOCKER_NETWORK !== 'host') {
|
|
22
22
|
try {
|
|
23
23
|
const url = new URL(endpoint);
|
|
24
|
-
url.host = parseDockerHost(`${process.env.BLOCKLET_DOCKER_NETWORK}-${component.name || component.did}`);
|
|
24
|
+
url.host = parseDockerHost(`${process.env.BLOCKLET_DOCKER_NETWORK}-${component.name || component.did}${component.isGreen ? '-green' : ''}`);
|
|
25
25
|
if (component.containerPort) {
|
|
26
26
|
url.port = component.containerPort;
|
|
27
27
|
}
|
package/package.json
CHANGED
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.53-beta-
|
|
6
|
+
"version": "1.16.53-beta-20251011-054719-4ed2f6b7",
|
|
7
7
|
"description": "graphql client to read/write data on abt node",
|
|
8
|
+
"homepage": "https://www.arcblock.io/docs/blocklet-sdk-nodejs",
|
|
8
9
|
"main": "lib/index.js",
|
|
9
10
|
"typings": "lib/index.d.ts",
|
|
10
11
|
"files": [
|
|
@@ -27,18 +28,18 @@
|
|
|
27
28
|
"author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
|
|
28
29
|
"license": "Apache-2.0",
|
|
29
30
|
"dependencies": {
|
|
30
|
-
"@abtnode/constant": "1.16.53-beta-
|
|
31
|
-
"@abtnode/db-cache": "1.16.53-beta-
|
|
32
|
-
"@abtnode/util": "1.16.53-beta-
|
|
31
|
+
"@abtnode/constant": "1.16.53-beta-20251011-054719-4ed2f6b7",
|
|
32
|
+
"@abtnode/db-cache": "1.16.53-beta-20251011-054719-4ed2f6b7",
|
|
33
|
+
"@abtnode/util": "1.16.53-beta-20251011-054719-4ed2f6b7",
|
|
33
34
|
"@arcblock/did": "1.25.6",
|
|
34
35
|
"@arcblock/did-connect-js": "1.25.6",
|
|
35
36
|
"@arcblock/jwt": "1.25.6",
|
|
36
37
|
"@arcblock/ws": "1.25.6",
|
|
37
|
-
"@blocklet/constant": "1.16.53-beta-
|
|
38
|
-
"@blocklet/env": "1.16.53-beta-
|
|
38
|
+
"@blocklet/constant": "1.16.53-beta-20251011-054719-4ed2f6b7",
|
|
39
|
+
"@blocklet/env": "1.16.53-beta-20251011-054719-4ed2f6b7",
|
|
39
40
|
"@blocklet/error": "^0.2.5",
|
|
40
|
-
"@blocklet/meta": "1.16.53-beta-
|
|
41
|
-
"@blocklet/server-js": "1.16.53-beta-
|
|
41
|
+
"@blocklet/meta": "1.16.53-beta-20251011-054719-4ed2f6b7",
|
|
42
|
+
"@blocklet/server-js": "1.16.53-beta-20251011-054719-4ed2f6b7",
|
|
42
43
|
"@blocklet/theme": "^3.1.45",
|
|
43
44
|
"@did-connect/authenticator": "^2.2.8",
|
|
44
45
|
"@did-connect/handler": "^2.2.8",
|
|
@@ -85,5 +86,5 @@
|
|
|
85
86
|
"ts-node": "^10.9.1",
|
|
86
87
|
"typescript": "^5.6.3"
|
|
87
88
|
},
|
|
88
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "26bebabf3b6e72db61ec6b48e679c37b3d5088fe"
|
|
89
90
|
}
|