@ultrst-armada/kloks 1.8.0 → 1.10.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/.krusbl-release-attestation.json +3 -3
- package/package.json +2 -2
- package/packages/backend/dist/auth/index.js +2 -2
- package/packages/backend/dist/{chunk-SQGBAWZN.js → chunk-OYVHKYJW.js} +7 -6
- package/packages/backend/dist/{chunk-BPFZCDS4.js → chunk-UMEO6XS4.js} +9 -9
- package/packages/backend/dist/{chunk-HT2SEDHD.js → chunk-W6JNJD3Q.js} +1 -1
- package/packages/backend/dist/{chunk-M4GSR46Y.js → chunk-WTBAG4AV.js} +5 -3
- package/packages/backend/dist/development/index.d.ts +1 -1
- package/packages/backend/dist/development/index.js +1 -1
- package/packages/backend/dist/index.d.ts +40 -1
- package/packages/backend/dist/index.js +187 -43
- package/packages/backend/dist/krnl-services.js +5 -5
- package/packages/backend/dist/services/index.js +2 -2
- package/packages/backend/dist/srkl/index.js +1 -1
- package/packages/backend/dist/storage/index.js +7 -7
- package/packages/contracts/dist/index.d.ts +124 -1
- package/packages/contracts/dist/index.js +92 -0
- package/packages/services/dist/index.d.ts +36 -2
- package/packages/services/dist/index.js +265 -0
- package/packages/state-graph/dist/index.js +23 -23
- package/packages/backend/dist/{chunk-5RXXC6GE.js → chunk-VKSGYMAH.js} +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
3
|
"packageName": "@ultrst-armada/kloks",
|
|
4
|
-
"version": "1.
|
|
5
|
-
"sourceCommit": "
|
|
4
|
+
"version": "1.10.0",
|
|
5
|
+
"sourceCommit": "302682bf08b2a4adcb8109f8f4a6a44651b25909",
|
|
6
6
|
"releaseWorkflow": "npm Release",
|
|
7
|
-
"workflowRunId": "
|
|
7
|
+
"workflowRunId": "40287961465"
|
|
8
8
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultrst-armada/kloks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
"typescript": "^5.7.3",
|
|
165
165
|
"vitest": "^3.1.0"
|
|
166
166
|
},
|
|
167
|
-
"packageManager": "pnpm@
|
|
167
|
+
"packageManager": "pnpm@10.33.0",
|
|
168
168
|
"repository": {
|
|
169
169
|
"type": "git",
|
|
170
170
|
"url": "git+https://github.com/dinilmusick/Kloks.git"
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
BaseAccountProvider,
|
|
4
4
|
LocalAccountProvider,
|
|
5
5
|
PasswordHasher
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-W6JNJD3Q.js";
|
|
7
7
|
import {
|
|
8
8
|
CanonicalAuthClient,
|
|
9
9
|
RateLimiter,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
createCanonicalAuthClient,
|
|
12
12
|
loginSystemUser,
|
|
13
13
|
resolveUserFromToken
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-WTBAG4AV.js";
|
|
15
15
|
export {
|
|
16
16
|
AdminGuard,
|
|
17
17
|
BaseAccountProvider,
|
|
@@ -297,9 +297,10 @@ var COMMANDS2 = {
|
|
|
297
297
|
test: { command: "pnpm", args: ["run", "test", "--if-present"] },
|
|
298
298
|
build: { command: "pnpm", args: ["run", "build", "--if-present"] },
|
|
299
299
|
krnl: { command: "pnpm", args: ["exec", "krnl", "validate"] },
|
|
300
|
-
frnl: { command: "pnpm", args: ["exec", "frnl", "validate"] }
|
|
300
|
+
frnl: { command: "pnpm", args: ["exec", "frnl", "validate"] },
|
|
301
|
+
"lockfile-check": { command: "pnpm", args: ["install", "--frozen-lockfile", "--ignore-scripts"] }
|
|
301
302
|
};
|
|
302
|
-
var DEFAULT_LAYERS = ["syntax", "lint", "krnl", "frnl"];
|
|
303
|
+
var DEFAULT_LAYERS = ["lockfile-check", "syntax", "lint", "krnl", "frnl"];
|
|
303
304
|
var commandText = (command, args) => [command, ...args].join(" ");
|
|
304
305
|
var CodeValidationRuntime = class {
|
|
305
306
|
constructor(runtime5 = new WebContainerRuntime()) {
|
|
@@ -310,9 +311,9 @@ var CodeValidationRuntime = class {
|
|
|
310
311
|
if (input.files) await this.runtime.mount(input.files);
|
|
311
312
|
const diagnostics = [];
|
|
312
313
|
if (input.install) {
|
|
313
|
-
const installed = await this.runtime.runCommand("pnpm", ["install", "--
|
|
314
|
-
diagnostics.push({ layer: "
|
|
315
|
-
if (installed.exitCode !== 0) return { ok: false, diagnostics, failedLayers: ["
|
|
314
|
+
const installed = await this.runtime.runCommand("pnpm", ["install", "--frozen-lockfile", "--ignore-scripts"], input.cwd, input.env);
|
|
315
|
+
diagnostics.push({ layer: "lockfile-check", ok: installed.exitCode === 0, exitCode: installed.exitCode, output: installed.output, command: "pnpm install --frozen-lockfile --ignore-scripts" });
|
|
316
|
+
if (installed.exitCode !== 0) return { ok: false, diagnostics, failedLayers: ["lockfile-check"] };
|
|
316
317
|
}
|
|
317
318
|
const layers = input.layers?.length ? input.layers : DEFAULT_LAYERS;
|
|
318
319
|
for (const layer of layers) {
|
|
@@ -337,7 +338,7 @@ var runtime2 = new CodeValidationRuntime();
|
|
|
337
338
|
var CodeValidationServiceDefinition = createServiceDefinition({
|
|
338
339
|
id: "kloks.backend.codeValidation",
|
|
339
340
|
name: "CodeValidationService",
|
|
340
|
-
version: "1.
|
|
341
|
+
version: "1.1.0",
|
|
341
342
|
operations: { validate: { id: "CodeValidationService.validate", name: "validate", handler: async (input) => runtime2.validate(input) } }
|
|
342
343
|
});
|
|
343
344
|
var CodeValidationServiceFacade = {
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
workspaceGraphService
|
|
3
|
+
} from "./chunk-VKSGYMAH.js";
|
|
1
4
|
import {
|
|
2
5
|
getSrklAccounts,
|
|
3
6
|
srklListBackblazeBuckets
|
|
4
7
|
} from "./chunk-XHADDA75.js";
|
|
5
8
|
import {
|
|
6
|
-
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
StorageAdapterFactory
|
|
10
|
+
} from "./chunk-SHZAQTIT.js";
|
|
11
|
+
import {
|
|
12
|
+
b2ListBuckets
|
|
13
|
+
} from "./chunk-4QEMALXF.js";
|
|
8
14
|
import {
|
|
9
15
|
formatCanonicalWorkspaceFolderName,
|
|
10
16
|
sanitizeWorkspaceName
|
|
@@ -19,18 +25,12 @@ import {
|
|
|
19
25
|
import {
|
|
20
26
|
queryUnifiedDb
|
|
21
27
|
} from "./chunk-VAFCR2MS.js";
|
|
22
|
-
import {
|
|
23
|
-
b2ListBuckets
|
|
24
|
-
} from "./chunk-4QEMALXF.js";
|
|
25
|
-
import {
|
|
26
|
-
StorageAdapterFactory
|
|
27
|
-
} from "./chunk-SHZAQTIT.js";
|
|
28
28
|
import {
|
|
29
29
|
RateLimiter,
|
|
30
30
|
SessionManager,
|
|
31
31
|
loginSystemUser,
|
|
32
32
|
resolveUserFromToken
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-WTBAG4AV.js";
|
|
34
34
|
import {
|
|
35
35
|
createService,
|
|
36
36
|
createServiceDefinition
|
|
@@ -180,9 +180,11 @@ async function resolveUserFromToken(tokenOrUserId, _queryDb, env) {
|
|
|
180
180
|
if (!tokenOrUserId) return null;
|
|
181
181
|
try {
|
|
182
182
|
const client = createCanonicalAuthClient(requireAuthBaseUrl(env));
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
);
|
|
183
|
+
const credential = tokenOrUserId.trim();
|
|
184
|
+
if (!credential) return null;
|
|
185
|
+
const token = credential.replace(/^Bearer[ \t]+/i, "").trim();
|
|
186
|
+
if (!token) return null;
|
|
187
|
+
const session = await client.getSession(`better-auth.session_token=${token}`);
|
|
186
188
|
if (!session?.user) return null;
|
|
187
189
|
return {
|
|
188
190
|
...session.user,
|
|
@@ -144,7 +144,7 @@ declare const DevelopmentServiceFacade: {
|
|
|
144
144
|
execute: <TIn = unknown, TOut = unknown>(op: string, input?: TIn) => Promise<TOut>;
|
|
145
145
|
};
|
|
146
146
|
|
|
147
|
-
type ValidationLayer = 'syntax' | 'lint' | 'test' | 'build' | 'krnl' | 'frnl' | 'law-l9';
|
|
147
|
+
type ValidationLayer = 'syntax' | 'lint' | 'test' | 'build' | 'krnl' | 'frnl' | 'lockfile-check' | 'law-l9';
|
|
148
148
|
interface CodeValidationInput {
|
|
149
149
|
layers?: ValidationLayer[];
|
|
150
150
|
cwd?: string;
|
|
@@ -765,6 +765,7 @@ declare function buildProjectObservability(projects: any[], deployments: any[],
|
|
|
765
765
|
fastDataTransferFormatted: string;
|
|
766
766
|
middlewareInvocations: number;
|
|
767
767
|
middlewareInvocationsFormatted: string;
|
|
768
|
+
latestDeploymentId: any;
|
|
768
769
|
latestDeploymentUrl: string;
|
|
769
770
|
latestDeploymentStatus: string;
|
|
770
771
|
latestDeploymentCreatedAt: string;
|
|
@@ -780,8 +781,46 @@ declare function buildProjectsList(observability: any[]): {
|
|
|
780
781
|
domain: any;
|
|
781
782
|
domains: any;
|
|
782
783
|
updatedAt: any;
|
|
784
|
+
deploymentId: any;
|
|
783
785
|
}[];
|
|
784
786
|
|
|
787
|
+
/**
|
|
788
|
+
* Provider deployment-control operations.
|
|
789
|
+
*
|
|
790
|
+
* Vercel: pauses/resumes a project's production service.
|
|
791
|
+
* Cloudflare Pages: disables/enables automatic production and preview deployments.
|
|
792
|
+
*/
|
|
793
|
+
type CloudflarePagesPreviewSetting = 'all' | 'none' | 'custom';
|
|
794
|
+
interface CloudflarePagesPauseState {
|
|
795
|
+
productionDeploymentsEnabled: boolean;
|
|
796
|
+
previewDeploymentSetting: CloudflarePagesPreviewSetting;
|
|
797
|
+
}
|
|
798
|
+
interface DeploymentControlResult {
|
|
799
|
+
success: true;
|
|
800
|
+
provider: 'VERCEL' | 'CLOUDFLARE';
|
|
801
|
+
projectId: string;
|
|
802
|
+
controlState: 'ACTIVE' | 'PAUSED';
|
|
803
|
+
pauseState?: CloudflarePagesPauseState;
|
|
804
|
+
}
|
|
805
|
+
interface CredentialPayload {
|
|
806
|
+
token?: string;
|
|
807
|
+
apiToken?: string;
|
|
808
|
+
accessToken?: string;
|
|
809
|
+
teamId?: string;
|
|
810
|
+
accountId?: string;
|
|
811
|
+
cfAccountId?: string;
|
|
812
|
+
accountTag?: string;
|
|
813
|
+
authKey?: string;
|
|
814
|
+
globalApiKey?: string;
|
|
815
|
+
authEmail?: string;
|
|
816
|
+
email?: string;
|
|
817
|
+
credentials?: Record<string, any>;
|
|
818
|
+
}
|
|
819
|
+
declare function pauseVercelProject(projectId: string, payload?: CredentialPayload, userId?: string, env?: Record<string, unknown>): Promise<DeploymentControlResult>;
|
|
820
|
+
declare function resumeVercelProject(projectId: string, payload?: CredentialPayload, userId?: string, env?: Record<string, unknown>): Promise<DeploymentControlResult>;
|
|
821
|
+
declare function pauseCloudflarePagesProject(projectName: string, payload?: CredentialPayload, userId?: string, env?: Record<string, unknown>): Promise<DeploymentControlResult>;
|
|
822
|
+
declare function resumeCloudflarePagesProject(projectName: string, pauseState: CloudflarePagesPauseState, payload?: CredentialPayload, userId?: string, env?: Record<string, unknown>): Promise<DeploymentControlResult>;
|
|
823
|
+
|
|
785
824
|
declare function createWavBuffer(sampleRate: number, numChannels: number, samples: Float32Array[]): Buffer;
|
|
786
825
|
|
|
787
826
|
declare function ensureGlobalSamples(globalSamplesDir: string): Promise<void>;
|
|
@@ -1638,4 +1677,4 @@ declare function resolveSystemDatabaseUrl(env?: Record<string, string | undefine
|
|
|
1638
1677
|
*/
|
|
1639
1678
|
declare function tryResolveSystemDatabaseUrl(env?: Record<string, string | undefined>): string | null;
|
|
1640
1679
|
|
|
1641
|
-
export { type AssetChannelType, type AssetDataType, type AssetFolderInfo, type AssetPoolItem, type AssetPoolScope, type B2AuthData, type BackendFacade, BaseDataProvider, BaseResourceFetcher, type CloudflareObservability, type CloudflareProjectItem, CloudflareResourceFetcher, type CloudflareUsageMetrics, type CredentialEntry, type CredentialManifest, type Deployment, type FunctionSet, FunctionalityTable, GRAPHS_ROOT, type IDataProvider, LEGACY_PROJECTS_ROOT, type OrchestrationFn, PROJECTS_ROOT, type ProjectMetadata, type PublicRouteRecord, type QueryFilter, ResourceFetcherRegistry, type Runtime, SAMPLES_GLOBAL_ROOT, SUPPORTED_AUDIO_EXTS, SUPPORTED_MIDI_EXTS, type ServerAudioSampleItem, type ServiceFacade, type ServiceRegistryRecord, type SortOrder, type SrklB2Account, SrklStorageService, type SyncFileResult, type UnifiedQueryResult, type UnifiedResourceMetricItem, type UnifiedResourceMetrics, VercelResourceFetcher, WORKSPACE_ASSETS_ROOT, WORKSPACE_ROOT, type WorkingWorkspaceConfig, type WorkspaceFolderResolution, type WorkspaceStorageConfig, b2DeleteFileVersion, b2DeleteFolder, buildProjectObservability, buildProjectsList, cleanDbUrl, computeDeploymentFinalWeight, computeUsageWeightScore, configureStarterProjectTemplate, createAssetSubfolder, createCredential, createGraphAssetFolder, createGraphAssetFolder as createGraphAssetSubfolder, createGraphPackage, createWavBuffer, createWorkspace, createWorkspaceGraph, decryptSecretFromBlob, deleteAssetFromGraph, deleteAssetFromPool, deleteCredential, deleteGlobalSample, deleteGraphPackage, deleteProject, deleteProjectSample, deleteRoute, deleteWorkspace, deleteWorkspaceFile, deleteWorkspaceFolder, deleteWorkspaceGraph, encryptSecretToBlob, ensureAssetPoolDirectories, ensureGlobalSamples, ensureGraphAssetDirectories, ensureProjectAssets, ensureProjectsRoot, ensureWorkspaceStructure, exportEncryptedCredentials, fetchCloudflareData, fetchVercelData, findUserWorkspace, findWorkspaceRecord, formatRelativeCreated, getAllRoutes, getAssetPoolLocationPath, getAssetPoolPublicUrl, getB2BucketId, getConnectedDeploymentNode, getConnectedWeightModifiers, getCredential, getDefaultWorkingWorkspaceDir, getExecutions, getGatewayConfig, getGraphPackageById, getPrimarySrklDeploymentUrl as getPrimarySrklCoreDeploymentUrl, getProjectById, getPublicRouteByPath, getPublicRoutes, getSrklAccounts as getSrklCoreAccounts, getSrklStatus, getUnifiedDbUrl, getUsers, getWeightModifierScore, getWorkingWorkspaceConfig, getWorkingWorkspaceDir, getWorkspaceFolderKey, getWorkspaceFolderPrefix, getWorkspaceGraph, getWorkspaceStorageDetails, getWorkspaces, importEncryptedCredentials, importGraphDependency, initGlobalSamplesDirectory, isB2Workspace, listAllGraphPackages, listAllProjects, listBackblazeBuckets, listCredentials, listGlobalSamples, listProjectSamples, listWorkspaceFiles, listWorkspaceGraphs, loadCredentialManifest, loadWorkspaceData, loginUser, matchGatewayIngress, matchGatewayIngressAsync, queryUnifiedDb, readWorkspaceFile, recordExecution, removeGraphDependency, renameAppInWorkspaceData, resolveDynamicRouteFromDb, resolveSystemDatabaseUrl, resolveWorkspaceConnection, resolveWorkspaceDir, saveAssetToGraph, saveAssetToPool, saveCredentialManifest, saveGlobalSample, saveGraphPackage, saveProject, saveProjectSample, saveWorkspaceData, saveWorkspaceGraph, scanAssetPool, scanGraphAssets, seedDefaultAssets, seedStarterGraphAssets, serverPublicRoutes, setServerPublicRoutes, setWorkingWorkspaceConfig, srklListBackblazeBuckets as srklCoreListBackblazeBuckets, syncWorkspace, syncWorkspaceCreateToBucket, syncWorkspaceDataToBucket, syncWorkspaceDeleteToBucket, tryResolveSystemDatabaseUrl, updateCredential, updateWorkspace, upsertRoute, validateServiceDefinition, writeWorkspaceFile };
|
|
1680
|
+
export { type AssetChannelType, type AssetDataType, type AssetFolderInfo, type AssetPoolItem, type AssetPoolScope, type B2AuthData, type BackendFacade, BaseDataProvider, BaseResourceFetcher, type CloudflareObservability, type CloudflarePagesPauseState, type CloudflarePagesPreviewSetting, type CloudflareProjectItem, CloudflareResourceFetcher, type CloudflareUsageMetrics, type CredentialEntry, type CredentialManifest, type Deployment, type DeploymentControlResult, type FunctionSet, FunctionalityTable, GRAPHS_ROOT, type IDataProvider, LEGACY_PROJECTS_ROOT, type OrchestrationFn, PROJECTS_ROOT, type ProjectMetadata, type PublicRouteRecord, type QueryFilter, ResourceFetcherRegistry, type Runtime, SAMPLES_GLOBAL_ROOT, SUPPORTED_AUDIO_EXTS, SUPPORTED_MIDI_EXTS, type ServerAudioSampleItem, type ServiceFacade, type ServiceRegistryRecord, type SortOrder, type SrklB2Account, SrklStorageService, type SyncFileResult, type UnifiedQueryResult, type UnifiedResourceMetricItem, type UnifiedResourceMetrics, VercelResourceFetcher, WORKSPACE_ASSETS_ROOT, WORKSPACE_ROOT, type WorkingWorkspaceConfig, type WorkspaceFolderResolution, type WorkspaceStorageConfig, b2DeleteFileVersion, b2DeleteFolder, buildProjectObservability, buildProjectsList, cleanDbUrl, computeDeploymentFinalWeight, computeUsageWeightScore, configureStarterProjectTemplate, createAssetSubfolder, createCredential, createGraphAssetFolder, createGraphAssetFolder as createGraphAssetSubfolder, createGraphPackage, createWavBuffer, createWorkspace, createWorkspaceGraph, decryptSecretFromBlob, deleteAssetFromGraph, deleteAssetFromPool, deleteCredential, deleteGlobalSample, deleteGraphPackage, deleteProject, deleteProjectSample, deleteRoute, deleteWorkspace, deleteWorkspaceFile, deleteWorkspaceFolder, deleteWorkspaceGraph, encryptSecretToBlob, ensureAssetPoolDirectories, ensureGlobalSamples, ensureGraphAssetDirectories, ensureProjectAssets, ensureProjectsRoot, ensureWorkspaceStructure, exportEncryptedCredentials, fetchCloudflareData, fetchVercelData, findUserWorkspace, findWorkspaceRecord, formatRelativeCreated, getAllRoutes, getAssetPoolLocationPath, getAssetPoolPublicUrl, getB2BucketId, getConnectedDeploymentNode, getConnectedWeightModifiers, getCredential, getDefaultWorkingWorkspaceDir, getExecutions, getGatewayConfig, getGraphPackageById, getPrimarySrklDeploymentUrl as getPrimarySrklCoreDeploymentUrl, getProjectById, getPublicRouteByPath, getPublicRoutes, getSrklAccounts as getSrklCoreAccounts, getSrklStatus, getUnifiedDbUrl, getUsers, getWeightModifierScore, getWorkingWorkspaceConfig, getWorkingWorkspaceDir, getWorkspaceFolderKey, getWorkspaceFolderPrefix, getWorkspaceGraph, getWorkspaceStorageDetails, getWorkspaces, importEncryptedCredentials, importGraphDependency, initGlobalSamplesDirectory, isB2Workspace, listAllGraphPackages, listAllProjects, listBackblazeBuckets, listCredentials, listGlobalSamples, listProjectSamples, listWorkspaceFiles, listWorkspaceGraphs, loadCredentialManifest, loadWorkspaceData, loginUser, matchGatewayIngress, matchGatewayIngressAsync, pauseCloudflarePagesProject, pauseVercelProject, queryUnifiedDb, readWorkspaceFile, recordExecution, removeGraphDependency, renameAppInWorkspaceData, resolveDynamicRouteFromDb, resolveSystemDatabaseUrl, resolveWorkspaceConnection, resolveWorkspaceDir, resumeCloudflarePagesProject, resumeVercelProject, saveAssetToGraph, saveAssetToPool, saveCredentialManifest, saveGlobalSample, saveGraphPackage, saveProject, saveProjectSample, saveWorkspaceData, saveWorkspaceGraph, scanAssetPool, scanGraphAssets, seedDefaultAssets, seedStarterGraphAssets, serverPublicRoutes, setServerPublicRoutes, setWorkingWorkspaceConfig, srklListBackblazeBuckets as srklCoreListBackblazeBuckets, syncWorkspace, syncWorkspaceCreateToBucket, syncWorkspaceDataToBucket, syncWorkspaceDeleteToBucket, tryResolveSystemDatabaseUrl, updateCredential, updateWorkspace, upsertRoute, validateServiceDefinition, writeWorkspaceFile };
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CompositeBackend,
|
|
3
|
+
EndpointGenerator,
|
|
4
|
+
LOCAL_STORAGE_GRAPHS_PREFIX,
|
|
5
|
+
NodeGraphPersistenceService,
|
|
6
|
+
createBackend,
|
|
7
|
+
createCompositeService,
|
|
8
|
+
createLocalService,
|
|
9
|
+
createRemoteService,
|
|
10
|
+
exportGraphAsJsonFile,
|
|
11
|
+
nodeGraphPersistence,
|
|
12
|
+
parseGraphJsonFile,
|
|
13
|
+
validateGraphDocument
|
|
14
|
+
} from "./chunk-RBF2OGMC.js";
|
|
1
15
|
import {
|
|
2
16
|
CANONICAL_SRKL_URL,
|
|
3
17
|
SrklClient,
|
|
@@ -17,19 +31,8 @@ import {
|
|
|
17
31
|
useSrklServices
|
|
18
32
|
} from "./chunk-3IUA66RS.js";
|
|
19
33
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
LOCAL_STORAGE_GRAPHS_PREFIX,
|
|
23
|
-
NodeGraphPersistenceService,
|
|
24
|
-
createBackend,
|
|
25
|
-
createCompositeService,
|
|
26
|
-
createLocalService,
|
|
27
|
-
createRemoteService,
|
|
28
|
-
exportGraphAsJsonFile,
|
|
29
|
-
nodeGraphPersistence,
|
|
30
|
-
parseGraphJsonFile,
|
|
31
|
-
validateGraphDocument
|
|
32
|
-
} from "./chunk-RBF2OGMC.js";
|
|
34
|
+
S3Adapter
|
|
35
|
+
} from "./chunk-RBQ4CW3T.js";
|
|
33
36
|
import {
|
|
34
37
|
RemoteWorkspaceService,
|
|
35
38
|
SyncEngine,
|
|
@@ -46,9 +49,6 @@ import {
|
|
|
46
49
|
syncWorkspace,
|
|
47
50
|
workingWorkspaceService
|
|
48
51
|
} from "./chunk-BTMIK44G.js";
|
|
49
|
-
import {
|
|
50
|
-
S3Adapter
|
|
51
|
-
} from "./chunk-RBQ4CW3T.js";
|
|
52
52
|
import {
|
|
53
53
|
AuthServiceDefinition,
|
|
54
54
|
AuthServiceFacade,
|
|
@@ -82,15 +82,35 @@ import {
|
|
|
82
82
|
krnlWorkspaceGraphServiceFacade,
|
|
83
83
|
krnlWorkspaceServiceDefinition,
|
|
84
84
|
krnlWorkspaceServiceFacade
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-UMEO6XS4.js";
|
|
86
|
+
import {
|
|
87
|
+
workspaceGraphService
|
|
88
|
+
} from "./chunk-VKSGYMAH.js";
|
|
86
89
|
import {
|
|
87
90
|
getPrimarySrklDeploymentUrl,
|
|
88
91
|
getSrklAccounts,
|
|
89
92
|
srklListBackblazeBuckets
|
|
90
93
|
} from "./chunk-XHADDA75.js";
|
|
91
94
|
import {
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
BackblazeB2Adapter,
|
|
96
|
+
LocalFSAdapter,
|
|
97
|
+
StorageAdapterFactory,
|
|
98
|
+
SupabaseStorageAdapter,
|
|
99
|
+
ensureS3DirectoryMarker,
|
|
100
|
+
isSecretMasked,
|
|
101
|
+
normalizeBackblazeCredentials,
|
|
102
|
+
permanentDeleteS3Folder,
|
|
103
|
+
permanentDeleteS3Object,
|
|
104
|
+
renameS3Folder,
|
|
105
|
+
resolveBackblazeEndpoint
|
|
106
|
+
} from "./chunk-SHZAQTIT.js";
|
|
107
|
+
import {
|
|
108
|
+
authorizeB2,
|
|
109
|
+
b2DownloadFile,
|
|
110
|
+
b2ListBuckets,
|
|
111
|
+
b2ListFileNames,
|
|
112
|
+
b2UploadFile
|
|
113
|
+
} from "./chunk-4QEMALXF.js";
|
|
94
114
|
import {
|
|
95
115
|
formatCanonicalWorkspaceFolderName,
|
|
96
116
|
sanitizeWorkspaceName
|
|
@@ -125,26 +145,6 @@ import {
|
|
|
125
145
|
getUnifiedDbUrl,
|
|
126
146
|
queryUnifiedDb
|
|
127
147
|
} from "./chunk-VAFCR2MS.js";
|
|
128
|
-
import {
|
|
129
|
-
authorizeB2,
|
|
130
|
-
b2DownloadFile,
|
|
131
|
-
b2ListBuckets,
|
|
132
|
-
b2ListFileNames,
|
|
133
|
-
b2UploadFile
|
|
134
|
-
} from "./chunk-4QEMALXF.js";
|
|
135
|
-
import {
|
|
136
|
-
BackblazeB2Adapter,
|
|
137
|
-
LocalFSAdapter,
|
|
138
|
-
StorageAdapterFactory,
|
|
139
|
-
SupabaseStorageAdapter,
|
|
140
|
-
ensureS3DirectoryMarker,
|
|
141
|
-
isSecretMasked,
|
|
142
|
-
normalizeBackblazeCredentials,
|
|
143
|
-
permanentDeleteS3Folder,
|
|
144
|
-
permanentDeleteS3Object,
|
|
145
|
-
renameS3Folder,
|
|
146
|
-
resolveBackblazeEndpoint
|
|
147
|
-
} from "./chunk-SHZAQTIT.js";
|
|
148
148
|
import {
|
|
149
149
|
BaseStorageAdapter,
|
|
150
150
|
GoogleDriveAdapter,
|
|
@@ -163,7 +163,7 @@ import {
|
|
|
163
163
|
BaseAccountProvider,
|
|
164
164
|
LocalAccountProvider,
|
|
165
165
|
PasswordHasher
|
|
166
|
-
} from "./chunk-
|
|
166
|
+
} from "./chunk-W6JNJD3Q.js";
|
|
167
167
|
import {
|
|
168
168
|
CanonicalAuthClient,
|
|
169
169
|
RateLimiter,
|
|
@@ -171,7 +171,7 @@ import {
|
|
|
171
171
|
createCanonicalAuthClient,
|
|
172
172
|
loginSystemUser,
|
|
173
173
|
resolveUserFromToken
|
|
174
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-WTBAG4AV.js";
|
|
175
175
|
import {
|
|
176
176
|
BackendProvider,
|
|
177
177
|
useBackend,
|
|
@@ -232,7 +232,7 @@ import {
|
|
|
232
232
|
WebContainerServiceFacade,
|
|
233
233
|
codeDiagnosticsService,
|
|
234
234
|
resolveDevelopmentCommand
|
|
235
|
-
} from "./chunk-
|
|
235
|
+
} from "./chunk-OYVHKYJW.js";
|
|
236
236
|
import "./chunk-TY32TUNI.js";
|
|
237
237
|
|
|
238
238
|
// src/data/BaseDataProvider.ts
|
|
@@ -2058,6 +2058,8 @@ async function fetchCloudflareData(payload, rawUserId, env) {
|
|
|
2058
2058
|
id: p.name || p.id,
|
|
2059
2059
|
name: p.name,
|
|
2060
2060
|
type: "PAGES_PROJECT",
|
|
2061
|
+
providerProjectId: p.id,
|
|
2062
|
+
providerDeploymentId: p.latest_deployment?.id,
|
|
2061
2063
|
status: p.latest_deployment?.status || "READY",
|
|
2062
2064
|
framework: "Cloudflare Pages",
|
|
2063
2065
|
domain: pDomain,
|
|
@@ -2192,6 +2194,7 @@ function buildProjectObservability(projects, deployments, user) {
|
|
|
2192
2194
|
fastDataTransferFormatted: "100 MB",
|
|
2193
2195
|
middlewareInvocations: 10,
|
|
2194
2196
|
middlewareInvocationsFormatted: "10",
|
|
2197
|
+
latestDeploymentId: latestDep?.id,
|
|
2195
2198
|
latestDeploymentUrl: `https://${cleanDeploymentUrl}`,
|
|
2196
2199
|
latestDeploymentStatus: displayStatus,
|
|
2197
2200
|
latestDeploymentCreatedAt: new Date(createdAtTime).toISOString(),
|
|
@@ -2209,7 +2212,8 @@ function buildProjectsList(observability) {
|
|
|
2209
2212
|
url: po.latestDeploymentUrl,
|
|
2210
2213
|
domain: po.domains && po.domains[0] || `${po.projectName}.vercel.app`,
|
|
2211
2214
|
domains: po.domains || [`${po.projectName}.vercel.app`],
|
|
2212
|
-
updatedAt: po.latestDeploymentCreatedAt
|
|
2215
|
+
updatedAt: po.latestDeploymentCreatedAt,
|
|
2216
|
+
deploymentId: po.latestDeploymentId
|
|
2213
2217
|
}));
|
|
2214
2218
|
}
|
|
2215
2219
|
|
|
@@ -2378,6 +2382,142 @@ async function fetchVercelData(payload, rawUserId, env) {
|
|
|
2378
2382
|
}
|
|
2379
2383
|
}
|
|
2380
2384
|
|
|
2385
|
+
// src/core/deploymentControlCore.ts
|
|
2386
|
+
function firstString(...values) {
|
|
2387
|
+
return values.find((value) => typeof value === "string" && value.trim().length > 0)?.trim() || "";
|
|
2388
|
+
}
|
|
2389
|
+
async function resolveVercelCredentials(payload, userId, env) {
|
|
2390
|
+
const credentials = payload.credentials || {};
|
|
2391
|
+
let token = firstString(payload.token, payload.apiToken, payload.accessToken, credentials.token, credentials.apiToken, credentials.accessToken);
|
|
2392
|
+
let teamId = firstString(payload.teamId, credentials.teamId);
|
|
2393
|
+
if ((!token || !teamId) && userId && (payload.accountId || credentials.accountId)) {
|
|
2394
|
+
const accountId = firstString(payload.accountId, credentials.accountId);
|
|
2395
|
+
const srkl = await getSrklAccounts2(userId, "vercel", env);
|
|
2396
|
+
const account = srkl.accounts?.find((item) => item.id === accountId);
|
|
2397
|
+
const accountCredentials = account?.credentials || account?.metadata?.credentials || {};
|
|
2398
|
+
token ||= firstString(accountCredentials.token, accountCredentials.apiToken, accountCredentials.accessToken);
|
|
2399
|
+
teamId ||= firstString(accountCredentials.teamId);
|
|
2400
|
+
}
|
|
2401
|
+
if (!token) throw new Error("Vercel API token is missing or not configured for this account.");
|
|
2402
|
+
return { token, teamId };
|
|
2403
|
+
}
|
|
2404
|
+
async function resolveCloudflareCredentials(payload, userId, env) {
|
|
2405
|
+
const credentials = payload.credentials || {};
|
|
2406
|
+
let token = firstString(payload.token, payload.apiToken, payload.accessToken, credentials.token, credentials.apiToken, credentials.accessToken);
|
|
2407
|
+
let accountId = firstString(payload.accountId, payload.cfAccountId, payload.accountTag, credentials.accountId, credentials.cfAccountId, credentials.accountTag);
|
|
2408
|
+
let authKey = firstString(payload.authKey, payload.globalApiKey, credentials.authKey, credentials.globalApiKey);
|
|
2409
|
+
let authEmail = firstString(payload.authEmail, payload.email, credentials.authEmail, credentials.email);
|
|
2410
|
+
if (!token && !authKey || !accountId) {
|
|
2411
|
+
const requestedAccountId = firstString(payload.accountId, credentials.accountId);
|
|
2412
|
+
if (userId && requestedAccountId) {
|
|
2413
|
+
const srkl = await getSrklAccounts2(userId, "cloudflare", env);
|
|
2414
|
+
const account = srkl.accounts?.find((item) => item.id === requestedAccountId);
|
|
2415
|
+
const accountCredentials = account?.credentials || account?.metadata?.credentials || {};
|
|
2416
|
+
token ||= firstString(accountCredentials.token, accountCredentials.apiToken, accountCredentials.accessToken);
|
|
2417
|
+
accountId ||= firstString(accountCredentials.accountId, accountCredentials.cfAccountId, accountCredentials.accountTag);
|
|
2418
|
+
authKey ||= firstString(accountCredentials.authKey, accountCredentials.globalApiKey);
|
|
2419
|
+
authEmail ||= firstString(accountCredentials.authEmail, accountCredentials.email);
|
|
2420
|
+
}
|
|
2421
|
+
}
|
|
2422
|
+
if (!token && !authKey) throw new Error("Cloudflare API Token or Global API Key required.");
|
|
2423
|
+
if (!accountId) throw new Error("Cloudflare Account ID is required.");
|
|
2424
|
+
return { token, accountId, authKey, authEmail };
|
|
2425
|
+
}
|
|
2426
|
+
function cloudflareHeaders(token, authKey, authEmail) {
|
|
2427
|
+
const headers = { "Content-Type": "application/json", "User-Agent": "Kloks-DeploymentControl/1.0" };
|
|
2428
|
+
if (token) headers.Authorization = `Bearer ${token}`;
|
|
2429
|
+
else {
|
|
2430
|
+
headers["X-Auth-Key"] = authKey;
|
|
2431
|
+
headers["X-Auth-Email"] = authEmail;
|
|
2432
|
+
}
|
|
2433
|
+
return headers;
|
|
2434
|
+
}
|
|
2435
|
+
async function assertOk(response, provider) {
|
|
2436
|
+
if (response.ok) return;
|
|
2437
|
+
const body = await response.json().catch(() => ({}));
|
|
2438
|
+
const message = body?.error?.message || body?.errors?.[0]?.message || body?.message || response.statusText;
|
|
2439
|
+
throw new Error(`${provider} API error (${response.status}): ${message}`);
|
|
2440
|
+
}
|
|
2441
|
+
async function pauseVercelProject(projectId, payload = {}, userId, env) {
|
|
2442
|
+
if (!projectId?.trim()) throw new Error("Vercel project ID is required.");
|
|
2443
|
+
const { token, teamId } = await resolveVercelCredentials(payload, userId, env);
|
|
2444
|
+
const query = teamId ? `?teamId=${encodeURIComponent(teamId)}` : "";
|
|
2445
|
+
const response = await fetch(`https://api.vercel.com/v1/projects/${encodeURIComponent(projectId)}/pause${query}`, {
|
|
2446
|
+
method: "POST",
|
|
2447
|
+
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" }
|
|
2448
|
+
});
|
|
2449
|
+
await assertOk(response, "Vercel");
|
|
2450
|
+
return { success: true, provider: "VERCEL", projectId, controlState: "PAUSED" };
|
|
2451
|
+
}
|
|
2452
|
+
async function resumeVercelProject(projectId, payload = {}, userId, env) {
|
|
2453
|
+
if (!projectId?.trim()) throw new Error("Vercel project ID is required.");
|
|
2454
|
+
const { token, teamId } = await resolveVercelCredentials(payload, userId, env);
|
|
2455
|
+
const query = teamId ? `?teamId=${encodeURIComponent(teamId)}` : "";
|
|
2456
|
+
const response = await fetch(`https://api.vercel.com/v1/projects/${encodeURIComponent(projectId)}/unpause${query}`, {
|
|
2457
|
+
method: "POST",
|
|
2458
|
+
headers: { Authorization: `Bearer ${token}`, "Content-Type": "application/json" }
|
|
2459
|
+
});
|
|
2460
|
+
await assertOk(response, "Vercel");
|
|
2461
|
+
return { success: true, provider: "VERCEL", projectId, controlState: "ACTIVE" };
|
|
2462
|
+
}
|
|
2463
|
+
async function pauseCloudflarePagesProject(projectName, payload = {}, userId, env) {
|
|
2464
|
+
if (!projectName?.trim()) throw new Error("Cloudflare Pages project name is required.");
|
|
2465
|
+
const { token, accountId, authKey, authEmail } = await resolveCloudflareCredentials(payload, userId, env);
|
|
2466
|
+
const base = `https://api.cloudflare.com/client/v4/accounts/${encodeURIComponent(accountId)}/pages/projects/${encodeURIComponent(projectName)}`;
|
|
2467
|
+
const currentResponse = await fetch(base, { headers: cloudflareHeaders(token, authKey, authEmail) });
|
|
2468
|
+
await assertOk(currentResponse, "Cloudflare");
|
|
2469
|
+
const current = await currentResponse.json();
|
|
2470
|
+
const config = current?.result?.source?.config;
|
|
2471
|
+
if (!config) throw new Error("Cloudflare Pages project has no source deployment configuration to pause.");
|
|
2472
|
+
const pauseState = {
|
|
2473
|
+
productionDeploymentsEnabled: config.production_deployments_enabled !== false,
|
|
2474
|
+
previewDeploymentSetting: config.preview_deployment_setting || "all"
|
|
2475
|
+
};
|
|
2476
|
+
const updateResponse = await fetch(base, {
|
|
2477
|
+
method: "PATCH",
|
|
2478
|
+
headers: cloudflareHeaders(token, authKey, authEmail),
|
|
2479
|
+
body: JSON.stringify({
|
|
2480
|
+
source: {
|
|
2481
|
+
type: current?.result?.source?.type,
|
|
2482
|
+
config: {
|
|
2483
|
+
...config,
|
|
2484
|
+
production_deployments_enabled: false,
|
|
2485
|
+
preview_deployment_setting: "none"
|
|
2486
|
+
}
|
|
2487
|
+
}
|
|
2488
|
+
})
|
|
2489
|
+
});
|
|
2490
|
+
await assertOk(updateResponse, "Cloudflare");
|
|
2491
|
+
return { success: true, provider: "CLOUDFLARE", projectId: projectName, controlState: "PAUSED", pauseState };
|
|
2492
|
+
}
|
|
2493
|
+
async function resumeCloudflarePagesProject(projectName, pauseState, payload = {}, userId, env) {
|
|
2494
|
+
if (!projectName?.trim()) throw new Error("Cloudflare Pages project name is required.");
|
|
2495
|
+
if (!pauseState) throw new Error("Cloudflare Pages pause state is required to resume safely.");
|
|
2496
|
+
const { token, accountId, authKey, authEmail } = await resolveCloudflareCredentials(payload, userId, env);
|
|
2497
|
+
const base = `https://api.cloudflare.com/client/v4/accounts/${encodeURIComponent(accountId)}/pages/projects/${encodeURIComponent(projectName)}`;
|
|
2498
|
+
const currentResponse = await fetch(base, { headers: cloudflareHeaders(token, authKey, authEmail) });
|
|
2499
|
+
await assertOk(currentResponse, "Cloudflare");
|
|
2500
|
+
const current = await currentResponse.json();
|
|
2501
|
+
const config = current?.result?.source?.config;
|
|
2502
|
+
if (!config) throw new Error("Cloudflare Pages project has no source deployment configuration to resume.");
|
|
2503
|
+
const updateResponse = await fetch(base, {
|
|
2504
|
+
method: "PATCH",
|
|
2505
|
+
headers: cloudflareHeaders(token, authKey, authEmail),
|
|
2506
|
+
body: JSON.stringify({
|
|
2507
|
+
source: {
|
|
2508
|
+
type: current?.result?.source?.type,
|
|
2509
|
+
config: {
|
|
2510
|
+
...config,
|
|
2511
|
+
production_deployments_enabled: pauseState.productionDeploymentsEnabled,
|
|
2512
|
+
preview_deployment_setting: pauseState.previewDeploymentSetting
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
})
|
|
2516
|
+
});
|
|
2517
|
+
await assertOk(updateResponse, "Cloudflare");
|
|
2518
|
+
return { success: true, provider: "CLOUDFLARE", projectId: projectName, controlState: "ACTIVE" };
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2381
2521
|
// src/server/wavHelper.ts
|
|
2382
2522
|
function createWavBuffer(sampleRate, numChannels, samples) {
|
|
2383
2523
|
const numSamples = samples[0].length;
|
|
@@ -4430,6 +4570,8 @@ export {
|
|
|
4430
4570
|
nodeGraphPersistence,
|
|
4431
4571
|
normalizeBackblazeCredentials,
|
|
4432
4572
|
parseGraphJsonFile,
|
|
4573
|
+
pauseCloudflarePagesProject,
|
|
4574
|
+
pauseVercelProject,
|
|
4433
4575
|
permanentDeleteS3Folder,
|
|
4434
4576
|
permanentDeleteS3Object,
|
|
4435
4577
|
queryUnifiedDb,
|
|
@@ -4448,6 +4590,8 @@ export {
|
|
|
4448
4590
|
resolveUserFromToken,
|
|
4449
4591
|
resolveWorkspaceConnection,
|
|
4450
4592
|
resolveWorkspaceDir,
|
|
4593
|
+
resumeCloudflarePagesProject,
|
|
4594
|
+
resumeVercelProject,
|
|
4451
4595
|
sanitizeWorkspaceName,
|
|
4452
4596
|
saveAssetToGraph,
|
|
4453
4597
|
saveAssetToPool,
|
|
@@ -31,16 +31,16 @@ import {
|
|
|
31
31
|
krnlWorkspaceGraphServiceFacade,
|
|
32
32
|
krnlWorkspaceServiceDefinition,
|
|
33
33
|
krnlWorkspaceServiceFacade
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-UMEO6XS4.js";
|
|
35
|
+
import "./chunk-VKSGYMAH.js";
|
|
35
36
|
import "./chunk-XHADDA75.js";
|
|
36
|
-
import "./chunk-
|
|
37
|
+
import "./chunk-SHZAQTIT.js";
|
|
38
|
+
import "./chunk-4QEMALXF.js";
|
|
37
39
|
import "./chunk-FZKBTF34.js";
|
|
38
40
|
import "./chunk-6K75XXFD.js";
|
|
39
41
|
import "./chunk-VAFCR2MS.js";
|
|
40
|
-
import "./chunk-4QEMALXF.js";
|
|
41
|
-
import "./chunk-SHZAQTIT.js";
|
|
42
42
|
import "./chunk-KKRWZDMN.js";
|
|
43
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-WTBAG4AV.js";
|
|
44
44
|
import "./chunk-TY32TUNI.js";
|
|
45
45
|
export {
|
|
46
46
|
AuthServiceDefinition,
|
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
} from "../chunk-RBF2OGMC.js";
|
|
15
15
|
import {
|
|
16
16
|
workspaceGraphService
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-VKSGYMAH.js";
|
|
18
|
+
import "../chunk-SHZAQTIT.js";
|
|
18
19
|
import "../chunk-6K75XXFD.js";
|
|
19
20
|
import "../chunk-VAFCR2MS.js";
|
|
20
|
-
import "../chunk-SHZAQTIT.js";
|
|
21
21
|
import "../chunk-KKRWZDMN.js";
|
|
22
22
|
import "../chunk-TY32TUNI.js";
|
|
23
23
|
export {
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
S3Adapter
|
|
3
3
|
} from "../chunk-RBQ4CW3T.js";
|
|
4
|
-
import {
|
|
5
|
-
authorizeB2,
|
|
6
|
-
b2DownloadFile,
|
|
7
|
-
b2ListBuckets,
|
|
8
|
-
b2ListFileNames,
|
|
9
|
-
b2UploadFile
|
|
10
|
-
} from "../chunk-4QEMALXF.js";
|
|
11
4
|
import {
|
|
12
5
|
BackblazeB2Adapter,
|
|
13
6
|
LocalFSAdapter,
|
|
@@ -21,6 +14,13 @@ import {
|
|
|
21
14
|
renameS3Folder,
|
|
22
15
|
resolveBackblazeEndpoint
|
|
23
16
|
} from "../chunk-SHZAQTIT.js";
|
|
17
|
+
import {
|
|
18
|
+
authorizeB2,
|
|
19
|
+
b2DownloadFile,
|
|
20
|
+
b2ListBuckets,
|
|
21
|
+
b2ListFileNames,
|
|
22
|
+
b2UploadFile
|
|
23
|
+
} from "../chunk-4QEMALXF.js";
|
|
24
24
|
import {
|
|
25
25
|
BaseStorageAdapter,
|
|
26
26
|
GoogleDriveAdapter,
|