@bluestep-systems/b6p-core 0.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.
- package/README.md +75 -0
- package/dist/B6PCore.d.ts +109 -0
- package/dist/B6PCore.js +470 -0
- package/dist/B6PCore.js.map +1 -0
- package/dist/B6PUri.d.ts +31 -0
- package/dist/B6PUri.js +110 -0
- package/dist/B6PUri.js.map +1 -0
- package/dist/Err.d.ts +470 -0
- package/dist/Err.js +800 -0
- package/dist/Err.js.map +1 -0
- package/dist/auth/BasicAuthProvider.d.ts +39 -0
- package/dist/auth/BasicAuthProvider.js +106 -0
- package/dist/auth/BasicAuthProvider.js.map +1 -0
- package/dist/cache/OrgCache.d.ts +66 -0
- package/dist/cache/OrgCache.js +220 -0
- package/dist/cache/OrgCache.js.map +1 -0
- package/dist/cache/ScriptMetaDataStore.d.ts +39 -0
- package/dist/cache/ScriptMetaDataStore.js +83 -0
- package/dist/cache/ScriptMetaDataStore.js.map +1 -0
- package/dist/constants/ApiEndpoints.d.ts +13 -0
- package/dist/constants/ApiEndpoints.js +18 -0
- package/dist/constants/ApiEndpoints.js.map +1 -0
- package/dist/constants/AuthTypes.d.ts +9 -0
- package/dist/constants/AuthTypes.js +14 -0
- package/dist/constants/AuthTypes.js.map +1 -0
- package/dist/constants/BlueHQ.d.ts +20 -0
- package/dist/constants/BlueHQ.js +36 -0
- package/dist/constants/BlueHQ.js.map +1 -0
- package/dist/constants/CryptoAlgorithms.d.ts +8 -0
- package/dist/constants/CryptoAlgorithms.js +13 -0
- package/dist/constants/CryptoAlgorithms.js.map +1 -0
- package/dist/constants/ExtensionConfig.d.ts +11 -0
- package/dist/constants/ExtensionConfig.js +16 -0
- package/dist/constants/ExtensionConfig.js.map +1 -0
- package/dist/constants/FileExtensions.d.ts +13 -0
- package/dist/constants/FileExtensions.js +18 -0
- package/dist/constants/FileExtensions.js.map +1 -0
- package/dist/constants/FolderNames.d.ts +12 -0
- package/dist/constants/FolderNames.js +17 -0
- package/dist/constants/FolderNames.js.map +1 -0
- package/dist/constants/GitHubUrls.d.ts +12 -0
- package/dist/constants/GitHubUrls.js +17 -0
- package/dist/constants/GitHubUrls.js.map +1 -0
- package/dist/constants/Http.d.ts +57 -0
- package/dist/constants/Http.js +67 -0
- package/dist/constants/Http.js.map +1 -0
- package/dist/constants/MimeTypes.d.ts +9 -0
- package/dist/constants/MimeTypes.js +14 -0
- package/dist/constants/MimeTypes.js.map +1 -0
- package/dist/constants/Numerical.d.ts +14 -0
- package/dist/constants/Numerical.js +32 -0
- package/dist/constants/Numerical.js.map +1 -0
- package/dist/constants/OutputChannels.d.ts +8 -0
- package/dist/constants/OutputChannels.js +13 -0
- package/dist/constants/OutputChannels.js.map +1 -0
- package/dist/constants/SettingsKeys.d.ts +11 -0
- package/dist/constants/SettingsKeys.js +16 -0
- package/dist/constants/SettingsKeys.js.map +1 -0
- package/dist/constants/SpecialFiles.d.ts +10 -0
- package/dist/constants/SpecialFiles.js +15 -0
- package/dist/constants/SpecialFiles.js.map +1 -0
- package/dist/constants/WebDAVElements.d.ts +10 -0
- package/dist/constants/WebDAVElements.js +15 -0
- package/dist/constants/WebDAVElements.js.map +1 -0
- package/dist/constants/index.d.ts +22 -0
- package/dist/constants/index.js +41 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/data/DownstairsPathParser.d.ts +20 -0
- package/dist/data/DownstairsPathParser.js +132 -0
- package/dist/data/DownstairsPathParser.js.map +1 -0
- package/dist/data/GlobMatcher.d.ts +23 -0
- package/dist/data/GlobMatcher.js +135 -0
- package/dist/data/GlobMatcher.js.map +1 -0
- package/dist/data/IdUtility.d.ts +22 -0
- package/dist/data/IdUtility.js +119 -0
- package/dist/data/IdUtility.js.map +1 -0
- package/dist/data/OrgWorker.d.ts +14 -0
- package/dist/data/OrgWorker.js +54 -0
- package/dist/data/OrgWorker.js.map +1 -0
- package/dist/data/ScriptKey.d.ts +93 -0
- package/dist/data/ScriptKey.js +123 -0
- package/dist/data/ScriptKey.js.map +1 -0
- package/dist/data/ScriptUrlParser.d.ts +42 -0
- package/dist/data/ScriptUrlParser.js +258 -0
- package/dist/data/ScriptUrlParser.js.map +1 -0
- package/dist/data/index.d.ts +5 -0
- package/dist/data/index.js +14 -0
- package/dist/data/index.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +88 -0
- package/dist/index.js.map +1 -0
- package/dist/network/HttpClient.d.ts +32 -0
- package/dist/network/HttpClient.js +65 -0
- package/dist/network/HttpClient.js.map +1 -0
- package/dist/network/HttpClientProvider.d.ts +216 -0
- package/dist/network/HttpClientProvider.js +256 -0
- package/dist/network/HttpClientProvider.js.map +1 -0
- package/dist/network/StatusCodes.d.ts +101 -0
- package/dist/network/StatusCodes.js +121 -0
- package/dist/network/StatusCodes.js.map +1 -0
- package/dist/persistence/Persistable.d.ts +9 -0
- package/dist/persistence/Persistable.js +3 -0
- package/dist/persistence/Persistable.js.map +1 -0
- package/dist/persistence/PersistablePseudoMap.d.ts +50 -0
- package/dist/persistence/PersistablePseudoMap.js +62 -0
- package/dist/persistence/PersistablePseudoMap.js.map +1 -0
- package/dist/persistence/PersistenceKeys.d.ts +38 -0
- package/dist/persistence/PersistenceKeys.js +44 -0
- package/dist/persistence/PersistenceKeys.js.map +1 -0
- package/dist/persistence/PrivatePersistanceMap.d.ts +30 -0
- package/dist/persistence/PrivatePersistanceMap.js +67 -0
- package/dist/persistence/PrivatePersistanceMap.js.map +1 -0
- package/dist/persistence/PseudoMap.d.ts +65 -0
- package/dist/persistence/PseudoMap.js +96 -0
- package/dist/persistence/PseudoMap.js.map +1 -0
- package/dist/persistence/PublicPersistanceMap.d.ts +25 -0
- package/dist/persistence/PublicPersistanceMap.js +38 -0
- package/dist/persistence/PublicPersistanceMap.js.map +1 -0
- package/dist/persistence/Serializable.d.ts +40 -0
- package/dist/persistence/Serializable.js +54 -0
- package/dist/persistence/Serializable.js.map +1 -0
- package/dist/persistence/SharedFilePersistence.d.ts +70 -0
- package/dist/persistence/SharedFilePersistence.js +277 -0
- package/dist/persistence/SharedFilePersistence.js.map +1 -0
- package/dist/persistence/TypedMap.d.ts +73 -0
- package/dist/persistence/TypedMap.js +104 -0
- package/dist/persistence/TypedMap.js.map +1 -0
- package/dist/persistence/TypedPersistable.d.ts +36 -0
- package/dist/persistence/TypedPersistable.js +42 -0
- package/dist/persistence/TypedPersistable.js.map +1 -0
- package/dist/persistence/TypedPrivatePersistable.d.ts +124 -0
- package/dist/persistence/TypedPrivatePersistable.js +164 -0
- package/dist/persistence/TypedPrivatePersistable.js.map +1 -0
- package/dist/persistence/dirLockdown.d.ts +12 -0
- package/dist/persistence/dirLockdown.js +73 -0
- package/dist/persistence/dirLockdown.js.map +1 -0
- package/dist/persistence/index.d.ts +11 -0
- package/dist/persistence/index.js +27 -0
- package/dist/persistence/index.js.map +1 -0
- package/dist/providers.d.ts +133 -0
- package/dist/providers.js +3 -0
- package/dist/providers.js.map +1 -0
- package/dist/push.d.ts +20 -0
- package/dist/push.js +245 -0
- package/dist/push.js.map +1 -0
- package/dist/script/ScriptContext.d.ts +24 -0
- package/dist/script/ScriptContext.js +3 -0
- package/dist/script/ScriptContext.js.map +1 -0
- package/dist/script/ScriptFactory.d.ts +44 -0
- package/dist/script/ScriptFactory.js +130 -0
- package/dist/script/ScriptFactory.js.map +1 -0
- package/dist/script/ScriptFile.d.ts +62 -0
- package/dist/script/ScriptFile.js +373 -0
- package/dist/script/ScriptFile.js.map +1 -0
- package/dist/script/ScriptFolder.d.ts +43 -0
- package/dist/script/ScriptFolder.js +109 -0
- package/dist/script/ScriptFolder.js.map +1 -0
- package/dist/script/ScriptNode.d.ts +87 -0
- package/dist/script/ScriptNode.js +273 -0
- package/dist/script/ScriptNode.js.map +1 -0
- package/dist/script/ScriptPathElement.d.ts +30 -0
- package/dist/script/ScriptPathElement.js +3 -0
- package/dist/script/ScriptPathElement.js.map +1 -0
- package/dist/script/ScriptRoot.d.ts +61 -0
- package/dist/script/ScriptRoot.js +331 -0
- package/dist/script/ScriptRoot.js.map +1 -0
- package/dist/script/ScriptTranspiler.d.ts +18 -0
- package/dist/script/ScriptTranspiler.js +122 -0
- package/dist/script/ScriptTranspiler.js.map +1 -0
- package/dist/script/SnapshotHistoryRecorder.d.ts +12 -0
- package/dist/script/SnapshotHistoryRecorder.js +175 -0
- package/dist/script/SnapshotHistoryRecorder.js.map +1 -0
- package/dist/script/TsConfig.d.ts +26 -0
- package/dist/script/TsConfig.js +110 -0
- package/dist/script/TsConfig.js.map +1 -0
- package/dist/session/SessionManager.d.ts +77 -0
- package/dist/session/SessionManager.js +290 -0
- package/dist/session/SessionManager.js.map +1 -0
- package/dist/testing/MockFileSystem.d.ts +37 -0
- package/dist/testing/MockFileSystem.js +249 -0
- package/dist/testing/MockFileSystem.js.map +1 -0
- package/dist/testing/TestableFactory.d.ts +61 -0
- package/dist/testing/TestableFactory.js +3 -0
- package/dist/testing/TestableFactory.js.map +1 -0
- package/dist/types.d.ts +577 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/update/UpdateService.d.ts +126 -0
- package/dist/update/UpdateService.js +351 -0
- package/dist/update/UpdateService.js.map +1 -0
- package/dist/update/index.d.ts +2 -0
- package/dist/update/index.js +6 -0
- package/dist/update/index.js.map +1 -0
- package/dist/update/types.d.ts +96 -0
- package/dist/update/types.js +3 -0
- package/dist/update/types.js.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# @bluestep-systems/b6p-core
|
|
2
|
+
|
|
3
|
+
The core library for **B6P** — BlueStep script management (push / pull / audit / deploy of JavaScript &
|
|
4
|
+
TypeScript "formula" scripts over WebDAV).
|
|
5
|
+
|
|
6
|
+
This package contains the headless orchestration logic shared by the
|
|
7
|
+
[`b6p` CLI](https://github.com/Bluestep-Systems/b6p-cli) and the
|
|
8
|
+
[VS Code extension](https://github.com/Bluestep-Systems/b6p-vscode). It's **platform-agnostic** — it runs
|
|
9
|
+
anywhere Node does. You supply the platform adapters (file system, prompts, logging, progress,
|
|
10
|
+
persistence) through provider interfaces.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @bluestep-systems/b6p-core
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
Construct `B6PCore` with your platform's [`B6PProviders`](src/providers.ts) implementation, then call
|
|
21
|
+
the command methods:
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { B6PCore, type B6PProviders } from "@bluestep-systems/b6p-core";
|
|
25
|
+
|
|
26
|
+
const providers: B6PProviders = {
|
|
27
|
+
fs, // IFileSystem — read/write/list files
|
|
28
|
+
persistence, // IPersistence — durable key/value (settings, sessions)
|
|
29
|
+
prompt, // IPrompt — ask the user for input/credentials
|
|
30
|
+
logger, // ILogger — diagnostic logging
|
|
31
|
+
progress, // IProgress — long-running task reporting
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const core = new B6PCore(providers);
|
|
35
|
+
|
|
36
|
+
await core.pull({ formulaUrl: "https://org.bluestep.net/files/<id>/draft/", workspacePath });
|
|
37
|
+
await core.push({ rootPath, snapshot: true, message: "Update script" });
|
|
38
|
+
const audit = await core.audit({ filePath, workspacePath });
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Command surface
|
|
42
|
+
|
|
43
|
+
`B6PCore` exposes the operations both front-ends drive:
|
|
44
|
+
|
|
45
|
+
| Method | Purpose |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| `push` / `pushCurrent` | Upload local script files to the platform (optional versioned snapshot) |
|
|
48
|
+
| `pull` / `pullCurrent` | Download script files from a formula URL into a workspace |
|
|
49
|
+
| `audit` / `auditPull` | Compare local vs. server; optionally pull differences |
|
|
50
|
+
| `deploy` | Multi-target deploy driven by a config file |
|
|
51
|
+
| `report` | Report cached metadata / org-cache state |
|
|
52
|
+
| `updateCredentials` / `clearSessions` / `clearSettings` / `clearAll` | Auth & state management |
|
|
53
|
+
| `getConfig` / `setConfig` / `getSetupUrl` | Configuration helpers |
|
|
54
|
+
| `checkForUpdates` | GitHub-releases-based update check |
|
|
55
|
+
|
|
56
|
+
See [`src/index.ts`](src/index.ts) for the full set of exported classes, provider interfaces, data
|
|
57
|
+
utilities, constants, and types.
|
|
58
|
+
|
|
59
|
+
## Development
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install
|
|
63
|
+
npm run check-types # tsc --noEmit
|
|
64
|
+
npm run lint # eslint
|
|
65
|
+
npm run compile # tsc → dist/
|
|
66
|
+
npm run watch # tsc --watch
|
|
67
|
+
npm run format # prettier --write
|
|
68
|
+
npm run clean # rm -rf dist
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`npm run compile` emits `dist/` (JavaScript + `.d.ts` declarations), which is what gets published.
|
|
72
|
+
|
|
73
|
+
## License
|
|
74
|
+
|
|
75
|
+
MIT
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { BasicAuthProvider } from "./auth/BasicAuthProvider";
|
|
2
|
+
import { SessionManager } from "./session/SessionManager";
|
|
3
|
+
import type { B6PProviders, IFileSystem, ILogger, IPersistence, IProgress, IPrompt } from "./providers";
|
|
4
|
+
import { ScriptMetaDataStore } from "./cache/ScriptMetaDataStore";
|
|
5
|
+
import { OrgCache } from "./cache/OrgCache";
|
|
6
|
+
import type { ScriptContext } from "./script/ScriptContext";
|
|
7
|
+
import { ScriptFactory } from "./script/ScriptFactory";
|
|
8
|
+
import { UpdateService } from "./update/UpdateService";
|
|
9
|
+
/**
|
|
10
|
+
* Result returned by the audit command.
|
|
11
|
+
*/
|
|
12
|
+
export interface AuditResult {
|
|
13
|
+
changedFiles: string[];
|
|
14
|
+
baseUrl: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Result returned by the report command.
|
|
18
|
+
*/
|
|
19
|
+
export interface ReportResult {
|
|
20
|
+
metadataEntries: number;
|
|
21
|
+
orgCacheEntries: number;
|
|
22
|
+
details: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Headless orchestrator for all B6P operations.
|
|
26
|
+
*
|
|
27
|
+
* Consumers (VS Code extension, CLI, tests) construct this with their own
|
|
28
|
+
* {@link B6PProviders} implementations, then call the command methods.
|
|
29
|
+
*
|
|
30
|
+
* This class contains zero `vscode.*` imports — all platform-specific
|
|
31
|
+
* behaviour is delegated to the providers.
|
|
32
|
+
*/
|
|
33
|
+
export declare class B6PCore implements ScriptContext {
|
|
34
|
+
readonly fs: IFileSystem;
|
|
35
|
+
readonly persistence: IPersistence;
|
|
36
|
+
readonly prompt: IPrompt;
|
|
37
|
+
readonly logger: ILogger;
|
|
38
|
+
readonly progress: IProgress;
|
|
39
|
+
readonly auth: BasicAuthProvider;
|
|
40
|
+
readonly sessionManager: SessionManager;
|
|
41
|
+
readonly scriptMetadataStore: ScriptMetaDataStore;
|
|
42
|
+
readonly orgCache: OrgCache;
|
|
43
|
+
readonly updateService: UpdateService | null;
|
|
44
|
+
private factory;
|
|
45
|
+
private readonly _isDebugMode;
|
|
46
|
+
constructor(providers: B6PProviders);
|
|
47
|
+
getScriptFactory(): ScriptFactory;
|
|
48
|
+
isDebugMode(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Create a ScriptUrlParser wired to this core's session and logger.
|
|
51
|
+
*/
|
|
52
|
+
private createParser;
|
|
53
|
+
/**
|
|
54
|
+
* Derive the base WebDAV URL from a local file path by parsing the
|
|
55
|
+
* downstairs path structure and looking up stored metadata.
|
|
56
|
+
*/
|
|
57
|
+
private deriveBaseUrl;
|
|
58
|
+
/**
|
|
59
|
+
* Derive the workspace folder (parent of the org folder) from a file path
|
|
60
|
+
* inside a script root. Returns null if the path can't be parsed.
|
|
61
|
+
*/
|
|
62
|
+
deriveWorkspacePath(filePath: string): string | null;
|
|
63
|
+
push(opts: {
|
|
64
|
+
targetUrl?: string;
|
|
65
|
+
rootPath: string;
|
|
66
|
+
snapshot?: boolean;
|
|
67
|
+
message?: string;
|
|
68
|
+
}): Promise<void>;
|
|
69
|
+
pushCurrent(opts: {
|
|
70
|
+
filePath: string;
|
|
71
|
+
snapshot?: boolean;
|
|
72
|
+
message?: string;
|
|
73
|
+
}): Promise<void>;
|
|
74
|
+
pull(opts: {
|
|
75
|
+
formulaUrl?: string;
|
|
76
|
+
workspacePath: string;
|
|
77
|
+
}): Promise<void>;
|
|
78
|
+
pullCurrent(opts: {
|
|
79
|
+
filePath: string;
|
|
80
|
+
workspacePath: string;
|
|
81
|
+
}): Promise<void>;
|
|
82
|
+
audit(opts: {
|
|
83
|
+
filePath: string;
|
|
84
|
+
workspacePath: string;
|
|
85
|
+
}): Promise<AuditResult | null>;
|
|
86
|
+
private auditWithUrl;
|
|
87
|
+
auditPull(opts: {
|
|
88
|
+
filePath: string;
|
|
89
|
+
workspacePath: string;
|
|
90
|
+
}): Promise<void>;
|
|
91
|
+
deploy(opts: {
|
|
92
|
+
configPath: string;
|
|
93
|
+
}): Promise<void>;
|
|
94
|
+
updateCredentials(): Promise<void>;
|
|
95
|
+
clearSessions(): Promise<void>;
|
|
96
|
+
clearSettings(): Promise<void>;
|
|
97
|
+
clearAll(): Promise<void>;
|
|
98
|
+
report(): Promise<ReportResult>;
|
|
99
|
+
checkForUpdates(): Promise<void>;
|
|
100
|
+
setConfig(key: string, value: unknown): Promise<void>;
|
|
101
|
+
getConfig<T>(key: string): Promise<T | undefined>;
|
|
102
|
+
getSetupUrl(opts: {
|
|
103
|
+
filePath: string;
|
|
104
|
+
}): Promise<string | null>;
|
|
105
|
+
/**
|
|
106
|
+
* Dispose resources (session cleanup timer, etc.).
|
|
107
|
+
*/
|
|
108
|
+
dispose(): void;
|
|
109
|
+
}
|
package/dist/B6PCore.js
ADDED
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.B6PCore = void 0;
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const BasicAuthProvider_1 = require("./auth/BasicAuthProvider");
|
|
39
|
+
const B6PUri_1 = require("./B6PUri");
|
|
40
|
+
const ScriptUrlParser_1 = require("./data/ScriptUrlParser");
|
|
41
|
+
const DownstairsPathParser_1 = require("./data/DownstairsPathParser");
|
|
42
|
+
const SessionManager_1 = require("./session/SessionManager");
|
|
43
|
+
const push_1 = require("./push");
|
|
44
|
+
const ScriptMetaDataStore_1 = require("./cache/ScriptMetaDataStore");
|
|
45
|
+
const OrgCache_1 = require("./cache/OrgCache");
|
|
46
|
+
const ScriptFactory_1 = require("./script/ScriptFactory");
|
|
47
|
+
const UpdateService_1 = require("./update/UpdateService");
|
|
48
|
+
const NOOP_ORG_CACHE_SETTINGS = {
|
|
49
|
+
getParsedAnyDomainOverrideUrl: () => null,
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Headless orchestrator for all B6P operations.
|
|
53
|
+
*
|
|
54
|
+
* Consumers (VS Code extension, CLI, tests) construct this with their own
|
|
55
|
+
* {@link B6PProviders} implementations, then call the command methods.
|
|
56
|
+
*
|
|
57
|
+
* This class contains zero `vscode.*` imports — all platform-specific
|
|
58
|
+
* behaviour is delegated to the providers.
|
|
59
|
+
*/
|
|
60
|
+
class B6PCore {
|
|
61
|
+
fs;
|
|
62
|
+
persistence;
|
|
63
|
+
prompt;
|
|
64
|
+
logger;
|
|
65
|
+
progress;
|
|
66
|
+
auth;
|
|
67
|
+
sessionManager;
|
|
68
|
+
scriptMetadataStore;
|
|
69
|
+
orgCache;
|
|
70
|
+
updateService = null;
|
|
71
|
+
factory = null;
|
|
72
|
+
_isDebugMode;
|
|
73
|
+
constructor(providers) {
|
|
74
|
+
this.fs = providers.fs;
|
|
75
|
+
this.persistence = providers.persistence;
|
|
76
|
+
this.prompt = providers.prompt;
|
|
77
|
+
this.logger = providers.logger;
|
|
78
|
+
this.progress = providers.progress;
|
|
79
|
+
this._isDebugMode = providers.isDebugMode ?? (() => false);
|
|
80
|
+
this.auth = new BasicAuthProvider_1.BasicAuthProvider(this.persistence, this.prompt, this.logger);
|
|
81
|
+
this.sessionManager = new SessionManager_1.SessionManager(this.persistence, this.logger, this.auth, this._isDebugMode, this.prompt, providers.fetchFn);
|
|
82
|
+
this.scriptMetadataStore = new ScriptMetaDataStore_1.ScriptMetaDataStore(this.persistence);
|
|
83
|
+
this.orgCache = new OrgCache_1.OrgCache(this.persistence, this.logger, providers.orgCacheSettings ?? NOOP_ORG_CACHE_SETTINGS, this._isDebugMode, this.prompt);
|
|
84
|
+
// Initialize update service if configuration is provided
|
|
85
|
+
if (providers.updateServiceConfig) {
|
|
86
|
+
this.updateService = new UpdateService_1.UpdateService(this.persistence, this.logger, providers.updateServiceConfig, providers.fetchFn);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
getScriptFactory() {
|
|
90
|
+
if (!this.factory) {
|
|
91
|
+
this.factory = new ScriptFactory_1.ScriptFactory(this);
|
|
92
|
+
}
|
|
93
|
+
return this.factory;
|
|
94
|
+
}
|
|
95
|
+
isDebugMode() {
|
|
96
|
+
return this._isDebugMode();
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Create a ScriptUrlParser wired to this core's session and logger.
|
|
100
|
+
*/
|
|
101
|
+
createParser(url) {
|
|
102
|
+
return new ScriptUrlParser_1.ScriptUrlParser(url, this.sessionManager, this.logger, this.prompt);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Derive the base WebDAV URL from a local file path by parsing the
|
|
106
|
+
* downstairs path structure and looking up stored metadata.
|
|
107
|
+
*/
|
|
108
|
+
async deriveBaseUrl(filePath, _workspacePath) {
|
|
109
|
+
try {
|
|
110
|
+
const sf = this.getScriptFactory().createFile(B6PUri_1.B6PUri.fromFsPath(filePath));
|
|
111
|
+
return sf.getScriptRoot().getBaseWebDavUrlString();
|
|
112
|
+
}
|
|
113
|
+
catch {
|
|
114
|
+
this.logger.warn(`Could not parse downstairs path: ${filePath}`);
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Derive the workspace folder (parent of the org folder) from a file path
|
|
120
|
+
* inside a script root. Returns null if the path can't be parsed.
|
|
121
|
+
*/
|
|
122
|
+
deriveWorkspacePath(filePath) {
|
|
123
|
+
try {
|
|
124
|
+
const sf = this.getScriptFactory().createFile(B6PUri_1.B6PUri.fromFsPath(filePath));
|
|
125
|
+
return sf.getScriptRoot().getOrgUri().dirname.fsPath;
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// ── Push / Pull ───────────────────────────────────────────────────
|
|
132
|
+
async push(opts) {
|
|
133
|
+
const targetUrl = opts.targetUrl ?? (await this.prompt.inputBox({ prompt: "Paste in the target formula URI" }));
|
|
134
|
+
if (targetUrl === undefined) {
|
|
135
|
+
this.prompt.error("No target formula URI provided");
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
this.logger.info(`Pushing script from ${opts.rootPath} to ${targetUrl}${opts.snapshot ? " (snapshot)" : ""}`);
|
|
139
|
+
await (0, push_1.executePush)({
|
|
140
|
+
ctx: this,
|
|
141
|
+
progress: this.progress,
|
|
142
|
+
targetUrl,
|
|
143
|
+
rootPath: opts.rootPath,
|
|
144
|
+
snapshot: opts.snapshot ?? false,
|
|
145
|
+
message: opts.message,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
async pushCurrent(opts) {
|
|
149
|
+
this.logger.info(`Push current for file: ${opts.filePath}`);
|
|
150
|
+
const baseUrl = await this.deriveBaseUrl(opts.filePath, "");
|
|
151
|
+
if (!baseUrl) {
|
|
152
|
+
const url = await this.prompt.inputBox({
|
|
153
|
+
prompt: "Could not determine script URL. Paste the target formula URI:",
|
|
154
|
+
});
|
|
155
|
+
if (!url) {
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
// Derive rootPath from the file's path structure
|
|
159
|
+
const parser = new DownstairsPathParser_1.DownstairsPathParser(opts.filePath);
|
|
160
|
+
await this.push({
|
|
161
|
+
targetUrl: url,
|
|
162
|
+
rootPath: parser.getShavedName(),
|
|
163
|
+
snapshot: opts.snapshot,
|
|
164
|
+
message: opts.message,
|
|
165
|
+
});
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const parser = new DownstairsPathParser_1.DownstairsPathParser(opts.filePath);
|
|
169
|
+
await this.push({
|
|
170
|
+
targetUrl: baseUrl,
|
|
171
|
+
rootPath: parser.getShavedName(),
|
|
172
|
+
snapshot: opts.snapshot,
|
|
173
|
+
message: opts.message,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
async pull(opts) {
|
|
177
|
+
const formulaUrl = opts.formulaUrl ?? (await this.prompt.inputBox({ prompt: "Paste in the desired formula URL" }));
|
|
178
|
+
if (formulaUrl === undefined) {
|
|
179
|
+
this.prompt.error("No formula URL provided");
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
this.logger.info(`Pulling script from ${formulaUrl} into ${opts.workspacePath}`);
|
|
183
|
+
const parser = this.createParser(formulaUrl);
|
|
184
|
+
const fetchedScriptObject = await parser.getScript();
|
|
185
|
+
if (!fetchedScriptObject) {
|
|
186
|
+
this.logger.warn("fetchedScriptObject is null");
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const U = await parser.getU();
|
|
190
|
+
const scriptName = await parser.getScriptName();
|
|
191
|
+
this.logger.info(`Resolved script name: "${scriptName}" (webdavId: ${parser.webDavId})`);
|
|
192
|
+
// Guard against a known bug where getScriptName() returns the name of a
|
|
193
|
+
// recently-pulled script instead of the correct one (observed when two
|
|
194
|
+
// merge reports share a common name prefix, e.g. "Test_Green" and
|
|
195
|
+
// "Test_bp6_CLI"). If the resolved name is already linked to a *different*
|
|
196
|
+
// webdavId in local metadata, aborting here prevents overwriting the wrong
|
|
197
|
+
// directory and corrupting both scripts.
|
|
198
|
+
const conflictingEntry = this.scriptMetadataStore.findByScriptName(U, scriptName);
|
|
199
|
+
if (conflictingEntry && conflictingEntry.webdavId !== parser.webDavId) {
|
|
200
|
+
this.prompt.error(`Pull aborted: the server returned script name "${scriptName}" for webdavId ${parser.webDavId}, ` +
|
|
201
|
+
`but that name is already linked locally to webdavId ${conflictingEntry.webdavId}. ` +
|
|
202
|
+
`Proceeding would overwrite the wrong directory. ` +
|
|
203
|
+
`Please report this issue — try pulling again or clearing your local metadata.`);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
const factory = this.getScriptFactory();
|
|
207
|
+
const pullTasks = fetchedScriptObject.map((entry) => ({
|
|
208
|
+
execute: async () => {
|
|
209
|
+
const ultimatePath = path.join(opts.workspacePath, U, entry.downstairsPath);
|
|
210
|
+
const isDirectory = ultimatePath.endsWith("/") || entry.downstairsPath.endsWith("/");
|
|
211
|
+
if (isDirectory) {
|
|
212
|
+
const uri = B6PUri_1.B6PUri.fromFsPath(ultimatePath);
|
|
213
|
+
if (!(await this.fs.exists(uri))) {
|
|
214
|
+
await this.fs.createDirectory(uri);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
// Use ScriptFile.download() so that we get gitignore filtering, ETag-based
|
|
219
|
+
// integrity verification, and `lastPulled` metadata tracking — all the
|
|
220
|
+
// behaviour the previous inline fetch+writeFile loop was missing.
|
|
221
|
+
const fileUri = B6PUri_1.B6PUri.fromFsPath(ultimatePath);
|
|
222
|
+
const scriptRoot = factory.createScriptRoot(fileUri);
|
|
223
|
+
scriptRoot.withParser(parser);
|
|
224
|
+
const file = factory.createFile(fileUri, scriptRoot);
|
|
225
|
+
// Make sure the parent directory exists before download writes the file.
|
|
226
|
+
const parentUri = fileUri.dirname;
|
|
227
|
+
if (!(await this.fs.exists(parentUri))) {
|
|
228
|
+
await this.fs.createDirectory(parentUri);
|
|
229
|
+
}
|
|
230
|
+
await file.download(parser);
|
|
231
|
+
}
|
|
232
|
+
return ultimatePath;
|
|
233
|
+
},
|
|
234
|
+
description: "scripts",
|
|
235
|
+
}));
|
|
236
|
+
await this.progress.withProgress(pullTasks, {
|
|
237
|
+
title: "Pulling Script...",
|
|
238
|
+
cleanupMessage: "Cleaning up the downstairs folder...",
|
|
239
|
+
});
|
|
240
|
+
this.prompt.info("Pull complete!");
|
|
241
|
+
}
|
|
242
|
+
async pullCurrent(opts) {
|
|
243
|
+
const baseUrl = await this.deriveBaseUrl(opts.filePath, opts.workspacePath);
|
|
244
|
+
if (!baseUrl) {
|
|
245
|
+
const url = await this.prompt.inputBox({ prompt: "Could not determine script URL. Paste the formula URL:" });
|
|
246
|
+
if (!url) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
await this.pull({ formulaUrl: url, workspacePath: opts.workspacePath });
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
await this.pull({ formulaUrl: baseUrl, workspacePath: opts.workspacePath });
|
|
253
|
+
}
|
|
254
|
+
// ── Audit ─────────────────────────────────────────────────────────
|
|
255
|
+
async audit(opts) {
|
|
256
|
+
this.logger.info(`Auditing file: ${opts.filePath}`);
|
|
257
|
+
const baseUrl = await this.deriveBaseUrl(opts.filePath, opts.workspacePath);
|
|
258
|
+
if (!baseUrl) {
|
|
259
|
+
const url = await this.prompt.inputBox({ prompt: "Could not determine script URL. Paste the formula URL:" });
|
|
260
|
+
if (!url) {
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
return this.auditWithUrl(url, opts.workspacePath);
|
|
264
|
+
}
|
|
265
|
+
return this.auditWithUrl(baseUrl, opts.workspacePath);
|
|
266
|
+
}
|
|
267
|
+
async auditWithUrl(baseUrl, workspacePath) {
|
|
268
|
+
const parser = this.createParser(baseUrl);
|
|
269
|
+
const fetchedScriptObject = await parser.getScript();
|
|
270
|
+
if (!fetchedScriptObject) {
|
|
271
|
+
this.logger.warn("fetchedScriptObject is null during audit");
|
|
272
|
+
return null;
|
|
273
|
+
}
|
|
274
|
+
const U = await parser.getU();
|
|
275
|
+
const changedFiles = [];
|
|
276
|
+
const factory = this.getScriptFactory();
|
|
277
|
+
for (const entry of fetchedScriptObject) {
|
|
278
|
+
const ultimatePath = path.join(workspacePath, U, entry.downstairsPath);
|
|
279
|
+
if (ultimatePath.endsWith("/") || entry.downstairsPath.endsWith("/")) {
|
|
280
|
+
continue; // skip directories
|
|
281
|
+
}
|
|
282
|
+
const fileUri = B6PUri_1.B6PUri.fromFsPath(ultimatePath);
|
|
283
|
+
if (!(await this.fs.exists(fileUri))) {
|
|
284
|
+
changedFiles.push(entry.downstairsPath + " (new)");
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
// Use ScriptFile.currentIntegrityMatches() so that we get the same robust
|
|
288
|
+
// ETag handling (standard / weak / numeric / complex) used by download().
|
|
289
|
+
const scriptRoot = factory.createScriptRoot(fileUri);
|
|
290
|
+
scriptRoot.withParser(parser);
|
|
291
|
+
const file = factory.createFile(fileUri, scriptRoot);
|
|
292
|
+
const upstairsOverride = new URL(entry.upstairsPath);
|
|
293
|
+
const matches = await file.currentIntegrityMatches({ upstairsOverride });
|
|
294
|
+
if (!matches) {
|
|
295
|
+
changedFiles.push(entry.downstairsPath);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (changedFiles.length === 0) {
|
|
299
|
+
this.prompt.info("No differences detected. Local script is in sync with the server.");
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
this.prompt.info(`Detected ${changedFiles.length} file(s) with differences:\n\n${changedFiles.join("\n")}`);
|
|
303
|
+
}
|
|
304
|
+
return { changedFiles, baseUrl };
|
|
305
|
+
}
|
|
306
|
+
async auditPull(opts) {
|
|
307
|
+
const result = await this.audit(opts);
|
|
308
|
+
if (!result || result.changedFiles.length === 0) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
const YES = "Sync";
|
|
312
|
+
const NO = "Cancel";
|
|
313
|
+
const response = await this.prompt.confirm(`Detected ${result.changedFiles.length} file(s) with differences:\n\n${result.changedFiles.join("\n")}\n\nSync local copy with the server?`, [YES, NO]);
|
|
314
|
+
if (response !== YES) {
|
|
315
|
+
this.logger.info("User declined audit-pull sync");
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
await this.pull({ formulaUrl: result.baseUrl, workspacePath: opts.workspacePath });
|
|
319
|
+
}
|
|
320
|
+
// ── Deploy ────────────────────────────────────────────────────────
|
|
321
|
+
async deploy(opts) {
|
|
322
|
+
this.logger.info(`Quick deploy from config: ${opts.configPath}`);
|
|
323
|
+
// Read config file
|
|
324
|
+
const configUri = B6PUri_1.B6PUri.fromFsPath(opts.configPath);
|
|
325
|
+
if (!(await this.fs.exists(configUri))) {
|
|
326
|
+
this.prompt.error(`Config file not found: ${opts.configPath}`);
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
const configContent = await this.fs.readFile(configUri);
|
|
330
|
+
const configText = Buffer.from(configContent).toString("utf-8");
|
|
331
|
+
let config;
|
|
332
|
+
try {
|
|
333
|
+
config = JSON.parse(configText);
|
|
334
|
+
}
|
|
335
|
+
catch (error) {
|
|
336
|
+
this.prompt.error(`Failed to parse config file: ${error instanceof Error ? error.message : error}`);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
if (!config.sourceRootPath || !config.targets || config.targets.length === 0) {
|
|
340
|
+
this.prompt.error("Invalid config file. Required fields: sourceRootPath, targets[]");
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
this.logger.info(`Deploying to ${config.targets.length} target(s)`);
|
|
344
|
+
for (const target of config.targets) {
|
|
345
|
+
this.logger.info(`Deploying to: ${target.url}`);
|
|
346
|
+
try {
|
|
347
|
+
await this.push({
|
|
348
|
+
targetUrl: target.url,
|
|
349
|
+
rootPath: config.sourceRootPath,
|
|
350
|
+
snapshot: target.snapshot ?? false,
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
catch (error) {
|
|
354
|
+
this.logger.error(`Failed to deploy to ${target.url}: ${error instanceof Error ? error.message : error}`);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
this.prompt.info("Deploy complete!");
|
|
358
|
+
}
|
|
359
|
+
// ── Credentials ───────────────────────────────────────────────────
|
|
360
|
+
async updateCredentials() {
|
|
361
|
+
await this.auth.update();
|
|
362
|
+
}
|
|
363
|
+
// ── Session Management ────────────────────────────────────────────
|
|
364
|
+
async clearSessions() {
|
|
365
|
+
this.prompt.info("Clearing all sessions");
|
|
366
|
+
await this.sessionManager.clearAll();
|
|
367
|
+
}
|
|
368
|
+
// ── Settings ──────────────────────────────────────────────────────
|
|
369
|
+
async clearSettings() {
|
|
370
|
+
this.prompt.info("Reverting to default settings");
|
|
371
|
+
await this.persistence.clearPublic();
|
|
372
|
+
}
|
|
373
|
+
async clearAll() {
|
|
374
|
+
this.prompt.info("Clearing sessions, auth, and settings");
|
|
375
|
+
await this.persistence.clearPublic();
|
|
376
|
+
await this.sessionManager.clearAll();
|
|
377
|
+
await this.auth.clear();
|
|
378
|
+
}
|
|
379
|
+
// ── State ─────────────────────────────────────────────────────────
|
|
380
|
+
async report() {
|
|
381
|
+
// Note: This is a basic implementation. Full functionality requires
|
|
382
|
+
// IPersistence to support listing keys by prefix.
|
|
383
|
+
this.logger.info("Generating state report...");
|
|
384
|
+
const details = [
|
|
385
|
+
"Script Metadata and Org Cache reporting requires persistence layer",
|
|
386
|
+
"to support key enumeration. This feature is pending full implementation.",
|
|
387
|
+
"",
|
|
388
|
+
"In the CLI, persistence is stored in .b6p/ directory.",
|
|
389
|
+
"Use file system tools to inspect the raw JSON files for now.",
|
|
390
|
+
].join("\n");
|
|
391
|
+
this.prompt.info(details);
|
|
392
|
+
return {
|
|
393
|
+
metadataEntries: 0,
|
|
394
|
+
orgCacheEntries: 0,
|
|
395
|
+
details,
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
// ── Updates ───────────────────────────────────────────────────────
|
|
399
|
+
async checkForUpdates() {
|
|
400
|
+
if (!this.updateService) {
|
|
401
|
+
this.prompt.error("Update service is not configured");
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
this.logger.info("Checking for updates...");
|
|
405
|
+
try {
|
|
406
|
+
const updateInfo = await this.updateService.checkForUpdates();
|
|
407
|
+
if (updateInfo) {
|
|
408
|
+
this.prompt.info(`A new version is available!\n` +
|
|
409
|
+
`Current: v${this.updateService.getCurrentVersion()}\n` +
|
|
410
|
+
`Latest: v${updateInfo.version}\n\n` +
|
|
411
|
+
`Download from: ${updateInfo.downloadUrl}`);
|
|
412
|
+
}
|
|
413
|
+
else {
|
|
414
|
+
this.prompt.info(`You are running the latest version (v${this.updateService.getCurrentVersion()})`);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
catch (error) {
|
|
418
|
+
this.prompt.error(`Error checking for updates: ${error instanceof Error ? error.message : error}`);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
// ── Config Toggles ────────────────────────────────────────────────
|
|
422
|
+
async setConfig(key, value) {
|
|
423
|
+
await this.persistence.set(`settings.${key}`, value);
|
|
424
|
+
this.prompt.info(`Set ${key} = ${JSON.stringify(value)}`);
|
|
425
|
+
}
|
|
426
|
+
async getConfig(key) {
|
|
427
|
+
return this.persistence.get(`settings.${key}`);
|
|
428
|
+
}
|
|
429
|
+
// ── Setup URL ─────────────────────────────────────────────────────
|
|
430
|
+
async getSetupUrl(opts) {
|
|
431
|
+
try {
|
|
432
|
+
const parser = new DownstairsPathParser_1.DownstairsPathParser(opts.filePath);
|
|
433
|
+
const metadataKey = `scriptMeta.${parser.scriptName}`;
|
|
434
|
+
const meta = await this.persistence.get(metadataKey);
|
|
435
|
+
if (!meta?.webdavUrl || !meta.classid || !meta.seqnum) {
|
|
436
|
+
this.prompt.error(`No stored metadata found for script "${parser.scriptName}". Pull the script first.`);
|
|
437
|
+
return null;
|
|
438
|
+
}
|
|
439
|
+
const origin = new URL(meta.webdavUrl).origin;
|
|
440
|
+
// Build setup URL using ScriptKey pattern from the main codebase
|
|
441
|
+
// Format: {origin}/shared/admin/applications/relate/{setupPage}?_event=edit&_id={classid__seqnum}
|
|
442
|
+
const SCRIPT_TYPE_REGISTRY = {
|
|
443
|
+
"654015": { setupPage: "editformuladetails.jsp" },
|
|
444
|
+
"530024": { setupPage: "editdetailreport1.jsp" },
|
|
445
|
+
"363769": { setupPage: "editendpoint.jsp" },
|
|
446
|
+
};
|
|
447
|
+
const registry = SCRIPT_TYPE_REGISTRY[meta.classid];
|
|
448
|
+
if (!registry) {
|
|
449
|
+
this.prompt.error(`Unknown script type (classid: ${meta.classid}). Cannot generate setup URL.`);
|
|
450
|
+
return null;
|
|
451
|
+
}
|
|
452
|
+
const compoundId = `${meta.classid}___${meta.seqnum}`;
|
|
453
|
+
const setupUrl = `${origin}/shared/admin/applications/relate/${registry.setupPage}?_event=edit&_id=${compoundId}`;
|
|
454
|
+
return setupUrl;
|
|
455
|
+
}
|
|
456
|
+
catch (error) {
|
|
457
|
+
this.logger.error(`Error generating setup URL: ${error instanceof Error ? error.message : error}`);
|
|
458
|
+
return null;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Dispose resources (session cleanup timer, etc.).
|
|
463
|
+
*/
|
|
464
|
+
dispose() {
|
|
465
|
+
this.sessionManager.dispose();
|
|
466
|
+
this.orgCache.dispose();
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
exports.B6PCore = B6PCore;
|
|
470
|
+
//# sourceMappingURL=B6PCore.js.map
|