plugin-cluster-manager 1.1.7 → 1.1.10
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/client/AclCacheManager.d.ts +2 -0
- package/dist/client/CacheMonitor.d.ts +2 -0
- package/dist/client/ClusterManagerLayout.d.ts +2 -0
- package/dist/client/ClusterNodes.d.ts +2 -0
- package/dist/client/ContainerOrchestrator.d.ts +2 -0
- package/dist/client/EventQueueMonitor.d.ts +2 -0
- package/dist/client/LockMonitor.d.ts +2 -0
- package/dist/client/PackageInstaller.d.ts +2 -0
- package/dist/client/PluginOperations.d.ts +2 -0
- package/dist/client/RedisMonitor.d.ts +2 -0
- package/dist/client/TaskManager.d.ts +2 -0
- package/dist/client/WorkflowExecutions.d.ts +2 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/utils.d.ts +12 -0
- package/dist/index.d.ts +2 -0
- package/dist/server/actions/acl-cache.d.ts +53 -0
- package/dist/server/actions/acl-cache.js +1 -1
- package/dist/server/actions/cache-monitor.d.ts +23 -0
- package/dist/server/actions/cluster-nodes.d.ts +49 -0
- package/dist/server/actions/event-queue-monitor.d.ts +13 -0
- package/dist/server/actions/lock-monitor.d.ts +19 -0
- package/dist/server/actions/orchestrator.d.ts +58 -0
- package/dist/server/actions/package-manager.d.ts +6 -0
- package/dist/server/actions/plugin-operations.d.ts +6 -0
- package/dist/server/actions/redis-monitor.d.ts +12 -0
- package/dist/server/actions/tasks.d.ts +7 -0
- package/dist/server/actions/workflow-executions.d.ts +7 -0
- package/dist/server/adapters/redis-lock-adapter.d.ts +15 -0
- package/dist/server/adapters/redis-node-registry.d.ts +12 -0
- package/dist/server/adapters/redis-pubsub-adapter.d.ts +16 -0
- package/dist/server/collections/app.d.ts +8 -0
- package/dist/server/collections/cluster-manager-acl-cache.d.ts +22 -0
- package/dist/server/collections/cluster-manager-cache-mgr.d.ts +22 -0
- package/dist/server/collections/cluster-manager-cluster.d.ts +22 -0
- package/dist/server/collections/cluster-manager-lock.d.ts +22 -0
- package/dist/server/collections/cluster-manager-plugins.d.ts +18 -0
- package/dist/server/collections/cluster-manager-queue.d.ts +22 -0
- package/dist/server/collections/cluster-manager-redis.d.ts +22 -0
- package/dist/server/collections/cluster-manager-workflow.d.ts +22 -0
- package/dist/server/collections/cluster-manager.d.ts +22 -0
- package/dist/server/collections/orchestrator-settings.d.ts +59 -0
- package/dist/server/collections/orchestrator-stacks.d.ts +102 -0
- package/dist/server/collections/worker-orchestrator.d.ts +22 -0
- package/dist/server/collections/worker-packages-configs.d.ts +3 -0
- package/dist/server/collections/worker-packages.d.ts +22 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/orchestrator/PackageManager.d.ts +39 -0
- package/dist/server/orchestrator/PackageManager.js +63 -11
- package/dist/server/orchestrator/docker-adapter.d.ts +41 -0
- package/dist/server/orchestrator/index.d.ts +4 -0
- package/dist/server/orchestrator/k8s-adapter.d.ts +50 -0
- package/dist/server/orchestrator/leader-election.d.ts +48 -0
- package/dist/server/orchestrator/types.d.ts +84 -0
- package/dist/server/plugin.d.ts +26 -0
- package/dist/server/plugin.js +9 -0
- package/dist/server/utils/node.d.ts +6 -0
- package/dist/server/utils/redis.d.ts +29 -0
- package/dist/shared/packages.d.ts +23 -0
- package/package.json +1 -1
- package/src/server/actions/acl-cache.ts +2 -2
- package/src/server/plugin.ts +15 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Context } from '@nocobase/actions';
|
|
2
|
+
export declare function getRedisClient(app?: any): any;
|
|
3
|
+
/**
|
|
4
|
+
* Get the shared Redis connection from the app's connection manager.
|
|
5
|
+
* Returns undefined if Redis is not configured.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getRedis(ctx: Context): any;
|
|
8
|
+
/**
|
|
9
|
+
* Get Redis connection or throw 503 if not available.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getRedisOrThrow(ctx: Context): any;
|
|
12
|
+
/**
|
|
13
|
+
* Scan Redis keys using SCAN (cursor-based) instead of the blocking KEYS command.
|
|
14
|
+
* Safe for production use — never blocks the Redis event loop.
|
|
15
|
+
*
|
|
16
|
+
* @param redis - Redis client instance
|
|
17
|
+
* @param pattern - Glob pattern to match keys (e.g. "acl:can:*")
|
|
18
|
+
* @param batchSize - Number of keys to scan per iteration (default 200)
|
|
19
|
+
*/
|
|
20
|
+
export declare function scanKeys(redis: any, pattern: string, batchSize?: number): Promise<string[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Delete keys in chunked batches to avoid exceeding Redis command argument limits.
|
|
23
|
+
*
|
|
24
|
+
* @param redis - Redis client instance
|
|
25
|
+
* @param keys - Array of keys to delete
|
|
26
|
+
* @param chunkSize - Max keys per DEL command (default 500)
|
|
27
|
+
* @returns Total number of keys deleted
|
|
28
|
+
*/
|
|
29
|
+
export declare function deleteKeysChunked(redis: any, keys: string[], chunkSize?: number): Promise<number>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const DEFAULT_WORKER_PACKAGES: {
|
|
2
|
+
apt: string[];
|
|
3
|
+
python: string[];
|
|
4
|
+
npm: string[];
|
|
5
|
+
};
|
|
6
|
+
export interface WorkerPackageMap {
|
|
7
|
+
apt?: string[];
|
|
8
|
+
npm?: string[];
|
|
9
|
+
python?: string[];
|
|
10
|
+
}
|
|
11
|
+
export interface CustomPackageMap {
|
|
12
|
+
python?: string[];
|
|
13
|
+
node?: string[];
|
|
14
|
+
npm?: string[];
|
|
15
|
+
}
|
|
16
|
+
export declare function normalizePackages(packages?: Array<string | undefined>): string[];
|
|
17
|
+
export declare function parsePackageText(value: unknown, fallback?: string[]): string[];
|
|
18
|
+
export declare function formatPackageText(packages?: string[]): string;
|
|
19
|
+
export declare function packagesFromConfig(config: {
|
|
20
|
+
aptPackages?: unknown;
|
|
21
|
+
pythonPackages?: unknown;
|
|
22
|
+
npmPackages?: unknown;
|
|
23
|
+
}): WorkerPackageMap;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"displayName": "Cluster Manager",
|
|
4
4
|
"displayName.zh-CN": "Cluster Manager",
|
|
5
5
|
"description": "Cluster node tracking, task orchestration, worker management, and package distribution",
|
|
6
|
-
"version": "1.1.
|
|
6
|
+
"version": "1.1.10",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
8
|
"main": "./dist/server/index.js",
|
|
9
9
|
"keywords": [
|
|
@@ -108,8 +108,8 @@ export function createAclCacheMiddleware(app: any) {
|
|
|
108
108
|
// This is safe because we read ctx.permission AFTER next() completes —
|
|
109
109
|
// no monkey-patching of shared singletons.
|
|
110
110
|
try {
|
|
111
|
-
const result = ctx.permission?.can;
|
|
112
|
-
const valueToCache =
|
|
111
|
+
const result = ctx.permission?.can as any;
|
|
112
|
+
const valueToCache = JSON.stringify(result !== undefined && result !== null ? result : true);
|
|
113
113
|
cache.set(cacheKey, valueToCache, ACL_CACHE_TTL).catch(() => {});
|
|
114
114
|
} catch {
|
|
115
115
|
// Ignore cache write errors
|
package/src/server/plugin.ts
CHANGED
|
@@ -33,6 +33,21 @@ export class PluginClusterManagerServer extends Plugin {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
async load() {
|
|
36
|
+
// Fix NocoBase core strategy resource permission check crash:
|
|
37
|
+
// Attachments collection has "createdBy: true" options but lacks explicit 'createdById' metadata field registration.
|
|
38
|
+
// When non-root roles upload attachments, core ACL merges 'own' filters (createdById) and calls checkFilterParams,
|
|
39
|
+
// which throws a NoPermissionError because getField('createdById') returns undefined.
|
|
40
|
+
// Registering 'createdById' explicitly as a metadata field on the attachments collection prevents this check from crashing.
|
|
41
|
+
this.db.extendCollection({
|
|
42
|
+
name: 'attachments',
|
|
43
|
+
fields: [
|
|
44
|
+
{
|
|
45
|
+
type: 'bigInt',
|
|
46
|
+
name: 'createdById',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
});
|
|
50
|
+
|
|
36
51
|
this.nodeRegistry = new RedisNodeRegistry(this.app);
|
|
37
52
|
|
|
38
53
|
(this.app as any).on('afterStart', () => {
|