@smythos/sre 1.5.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 +135 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/types/Components/APICall/APICall.class.d.ts +34 -0
- package/dist/types/Components/APICall/AccessTokenManager.d.ts +17 -0
- package/dist/types/Components/APICall/ArrayBufferResponse.helper.d.ts +3 -0
- package/dist/types/Components/APICall/OAuth.helper.d.ts +10 -0
- package/dist/types/Components/APICall/mimeTypeCategories.d.ts +6 -0
- package/dist/types/Components/APICall/parseData.d.ts +5 -0
- package/dist/types/Components/APICall/parseHeaders.d.ts +3 -0
- package/dist/types/Components/APICall/parseProxy.d.ts +4 -0
- package/dist/types/Components/APICall/parseUrl.d.ts +7 -0
- package/dist/types/Components/APIEndpoint.class.d.ts +16 -0
- package/dist/types/Components/APIOutput.class.d.ts +15 -0
- package/dist/types/Components/AgentPlugin.class.d.ts +16 -0
- package/dist/types/Components/Async.class.d.ts +17 -0
- package/dist/types/Components/Await.class.d.ts +22 -0
- package/dist/types/Components/Classifier.class.d.ts +33 -0
- package/dist/types/Components/Component.class.d.ts +35 -0
- package/dist/types/Components/ComponentHost.class.d.ts +12 -0
- package/dist/types/Components/DataSourceCleaner.class.d.ts +19 -0
- package/dist/types/Components/DataSourceIndexer.class.d.ts +25 -0
- package/dist/types/Components/DataSourceLookup.class.d.ts +17 -0
- package/dist/types/Components/FEncDec.class.d.ts +17 -0
- package/dist/types/Components/FHash.class.d.ts +17 -0
- package/dist/types/Components/FSign.class.d.ts +18 -0
- package/dist/types/Components/FSleep.class.d.ts +19 -0
- package/dist/types/Components/FTimestamp.class.d.ts +19 -0
- package/dist/types/Components/FileStore.class.d.ts +11 -0
- package/dist/types/Components/ForEach.class.d.ts +16 -0
- package/dist/types/Components/GPTPlugin.class.d.ts +17 -0
- package/dist/types/Components/GenAILLM.class.d.ts +130 -0
- package/dist/types/Components/HuggingFace.class.d.ts +17 -0
- package/dist/types/Components/Image/imageSettings.config.d.ts +21 -0
- package/dist/types/Components/ImageGenerator.class.d.ts +17 -0
- package/dist/types/Components/JSONFilter.class.d.ts +13 -0
- package/dist/types/Components/LLMAssistant.class.d.ts +19 -0
- package/dist/types/Components/LogicAND.class.d.ts +7 -0
- package/dist/types/Components/LogicAtLeast.class.d.ts +9 -0
- package/dist/types/Components/LogicAtMost.class.d.ts +9 -0
- package/dist/types/Components/LogicOR.class.d.ts +7 -0
- package/dist/types/Components/LogicXOR.class.d.ts +7 -0
- package/dist/types/Components/MCPClient.class.d.ts +17 -0
- package/dist/types/Components/PromptGenerator.class.d.ts +19 -0
- package/dist/types/Components/ScrapflyWebScrape.class.d.ts +30 -0
- package/dist/types/Components/TavilyWebSearch.class.d.ts +31 -0
- package/dist/types/Components/index.d.ts +74 -0
- package/dist/types/Core/AgentProcess.helper.d.ts +36 -0
- package/dist/types/Core/Connector.class.d.ts +34 -0
- package/dist/types/Core/ConnectorsService.d.ts +64 -0
- package/dist/types/Core/DummyConnector.d.ts +4 -0
- package/dist/types/Core/HookService.d.ts +27 -0
- package/dist/types/Core/SmythRuntime.class.d.ts +28 -0
- package/dist/types/Core/SystemEvents.d.ts +12 -0
- package/dist/types/Core/boot.d.ts +1 -0
- package/dist/types/config.d.ts +11 -0
- package/dist/types/constants.d.ts +79 -0
- package/dist/types/helpers/BinaryInput.helper.d.ts +33 -0
- package/dist/types/helpers/Conversation.helper.d.ts +85 -0
- package/dist/types/helpers/JsonContent.helper.d.ts +16 -0
- package/dist/types/helpers/LocalCache.helper.d.ts +14 -0
- package/dist/types/helpers/Log.helper.d.ts +22 -0
- package/dist/types/helpers/OpenApiParser.helper.d.ts +10 -0
- package/dist/types/helpers/S3Cache.helper.d.ts +9 -0
- package/dist/types/helpers/SmythURI.helper.d.ts +3 -0
- package/dist/types/helpers/TemplateString.helper.d.ts +71 -0
- package/dist/types/helpers/TypeChecker.helper.d.ts +10 -0
- package/dist/types/index.d.ts +173 -0
- package/dist/types/subsystems/AgentManager/Agent.class.d.ts +78 -0
- package/dist/types/subsystems/AgentManager/Agent.helper.d.ts +1 -0
- package/dist/types/subsystems/AgentManager/AgentData.service/AgentDataConnector.d.ts +33 -0
- package/dist/types/subsystems/AgentManager/AgentData.service/connectors/CLIAgentDataConnector.class.d.ts +20 -0
- package/dist/types/subsystems/AgentManager/AgentData.service/connectors/LocalAgentDataConnector.class.d.ts +48 -0
- package/dist/types/subsystems/AgentManager/AgentData.service/connectors/NullAgentData.class.d.ts +19 -0
- package/dist/types/subsystems/AgentManager/AgentData.service/index.d.ts +4 -0
- package/dist/types/subsystems/AgentManager/AgentLogger.class.d.ts +11 -0
- package/dist/types/subsystems/AgentManager/AgentRequest.class.d.ts +15 -0
- package/dist/types/subsystems/AgentManager/AgentRuntime.class.d.ts +91 -0
- package/dist/types/subsystems/AgentManager/AgentSSE.class.d.ts +40 -0
- package/dist/types/subsystems/AgentManager/AgentSettings.class.d.ts +12 -0
- package/dist/types/subsystems/AgentManager/Component.service/ComponentConnector.d.ts +17 -0
- package/dist/types/subsystems/AgentManager/Component.service/connectors/LocalComponentConnector.class.d.ts +14 -0
- package/dist/types/subsystems/AgentManager/Component.service/index.d.ts +4 -0
- package/dist/types/subsystems/AgentManager/EmbodimentSettings.class.d.ts +8 -0
- package/dist/types/subsystems/AgentManager/ForkedAgent.class.d.ts +15 -0
- package/dist/types/subsystems/AgentManager/OSResourceMonitor.d.ts +2 -0
- package/dist/types/subsystems/ComputeManager/Code.service/CodeConnector.d.ts +58 -0
- package/dist/types/subsystems/ComputeManager/Code.service/connectors/AWSLambdaCode.class.d.ts +15 -0
- package/dist/types/subsystems/ComputeManager/Code.service/index.d.ts +4 -0
- package/dist/types/subsystems/IO/CLI.service/CLIConnector.d.ts +21 -0
- package/dist/types/subsystems/IO/CLI.service/index.d.ts +4 -0
- package/dist/types/subsystems/IO/Log.service/LogConnector.d.ts +17 -0
- package/dist/types/subsystems/IO/Log.service/connectors/ConsoleLog.class.d.ts +12 -0
- package/dist/types/subsystems/IO/Log.service/index.d.ts +4 -0
- package/dist/types/subsystems/IO/NKV.service/NKVConnector.d.ts +33 -0
- package/dist/types/subsystems/IO/NKV.service/connectors/NKVRAM.class.d.ts +43 -0
- package/dist/types/subsystems/IO/NKV.service/connectors/NKVRedis.class.d.ts +27 -0
- package/dist/types/subsystems/IO/NKV.service/index.d.ts +4 -0
- package/dist/types/subsystems/IO/Router.service/RouterConnector.d.ts +11 -0
- package/dist/types/subsystems/IO/Router.service/connectors/ExpressRouter.class.d.ts +21 -0
- package/dist/types/subsystems/IO/Router.service/connectors/NullRouter.class.d.ts +12 -0
- package/dist/types/subsystems/IO/Router.service/index.d.ts +4 -0
- package/dist/types/subsystems/IO/Storage.service/SmythFS.class.d.ts +49 -0
- package/dist/types/subsystems/IO/Storage.service/StorageConnector.d.ts +30 -0
- package/dist/types/subsystems/IO/Storage.service/connectors/LocalStorage.class.d.ts +58 -0
- package/dist/types/subsystems/IO/Storage.service/connectors/S3Storage.class.d.ts +53 -0
- package/dist/types/subsystems/IO/Storage.service/index.d.ts +4 -0
- package/dist/types/subsystems/IO/VectorDB.service/VectorDBConnector.d.ts +41 -0
- package/dist/types/subsystems/IO/VectorDB.service/connectors/MilvusVectorDB.class.d.ts +49 -0
- package/dist/types/subsystems/IO/VectorDB.service/connectors/PineconeVectorDB.class.d.ts +50 -0
- package/dist/types/subsystems/IO/VectorDB.service/connectors/RAMVecrtorDB.class.d.ts +52 -0
- package/dist/types/subsystems/IO/VectorDB.service/embed/BaseEmbedding.d.ts +53 -0
- package/dist/types/subsystems/IO/VectorDB.service/embed/OpenAIEmbedding.d.ts +16 -0
- package/dist/types/subsystems/IO/VectorDB.service/embed/index.d.ts +16 -0
- package/dist/types/subsystems/IO/VectorDB.service/index.d.ts +4 -0
- package/dist/types/subsystems/LLMManager/LLM.helper.d.ts +125 -0
- package/dist/types/subsystems/LLMManager/LLM.inference.d.ts +36 -0
- package/dist/types/subsystems/LLMManager/LLM.service/LLMConnector.d.ts +62 -0
- package/dist/types/subsystems/LLMManager/LLM.service/LLMCredentials.helper.d.ts +3 -0
- package/dist/types/subsystems/LLMManager/LLM.service/connectors/Anthropic.class.d.ts +68 -0
- package/dist/types/subsystems/LLMManager/LLM.service/connectors/Bedrock.class.d.ts +46 -0
- package/dist/types/subsystems/LLMManager/LLM.service/connectors/Echo.class.d.ts +18 -0
- package/dist/types/subsystems/LLMManager/LLM.service/connectors/GoogleAI.class.d.ts +57 -0
- package/dist/types/subsystems/LLMManager/LLM.service/connectors/Groq.class.d.ts +55 -0
- package/dist/types/subsystems/LLMManager/LLM.service/connectors/OpenAI.class.d.ts +92 -0
- package/dist/types/subsystems/LLMManager/LLM.service/connectors/Perplexity.class.d.ts +86 -0
- package/dist/types/subsystems/LLMManager/LLM.service/connectors/VertexAI.class.d.ts +38 -0
- package/dist/types/subsystems/LLMManager/LLM.service/index.d.ts +5 -0
- package/dist/types/subsystems/LLMManager/ModelsProvider.service/ModelsProviderConnector.d.ts +36 -0
- package/dist/types/subsystems/LLMManager/ModelsProvider.service/connectors/SmythModelsProvider.class.d.ts +39 -0
- package/dist/types/subsystems/LLMManager/ModelsProvider.service/index.d.ts +4 -0
- package/dist/types/subsystems/LLMManager/custom-models.d.ts +785 -0
- package/dist/types/subsystems/LLMManager/models.d.ts +2629 -0
- package/dist/types/subsystems/LLMManager/paramMappings.d.ts +69 -0
- package/dist/types/subsystems/MemoryManager/Cache.service/CacheConnector.d.ts +41 -0
- package/dist/types/subsystems/MemoryManager/Cache.service/connectors/LocalStorageCache.class.d.ts +33 -0
- package/dist/types/subsystems/MemoryManager/Cache.service/connectors/RAMCache.class.d.ts +31 -0
- package/dist/types/subsystems/MemoryManager/Cache.service/connectors/RedisCache.class.d.ts +33 -0
- package/dist/types/subsystems/MemoryManager/Cache.service/connectors/S3Cache.class.d.ts +38 -0
- package/dist/types/subsystems/MemoryManager/Cache.service/index.d.ts +4 -0
- package/dist/types/subsystems/MemoryManager/LLMCache.d.ts +27 -0
- package/dist/types/subsystems/MemoryManager/LLMContext.d.ts +25 -0
- package/dist/types/subsystems/MemoryManager/RuntimeContext.d.ts +50 -0
- package/dist/types/subsystems/Security/AccessControl/ACL.class.d.ts +29 -0
- package/dist/types/subsystems/Security/AccessControl/AccessCandidate.class.d.ts +21 -0
- package/dist/types/subsystems/Security/AccessControl/AccessRequest.class.d.ts +13 -0
- package/dist/types/subsystems/Security/Account.service/AccountConnector.d.ts +27 -0
- package/dist/types/subsystems/Security/Account.service/connectors/AWSAccount.class.d.ts +19 -0
- package/dist/types/subsystems/Security/Account.service/connectors/DummyAccount.class.d.ts +19 -0
- package/dist/types/subsystems/Security/Account.service/connectors/JSONFileAccount.class.d.ts +25 -0
- package/dist/types/subsystems/Security/Account.service/index.d.ts +4 -0
- package/dist/types/subsystems/Security/Credentials.helper.d.ts +16 -0
- package/dist/types/subsystems/Security/ManagedVault.service/ManagedVaultConnector.d.ts +23 -0
- package/dist/types/subsystems/Security/ManagedVault.service/connectors/NullManagedVault.class.d.ts +14 -0
- package/dist/types/subsystems/Security/ManagedVault.service/connectors/SecretManagerManagedVault.d.ts +22 -0
- package/dist/types/subsystems/Security/ManagedVault.service/index.d.ts +4 -0
- package/dist/types/subsystems/Security/SecureConnector.class.d.ts +13 -0
- package/dist/types/subsystems/Security/Vault.service/Vault.helper.d.ts +5 -0
- package/dist/types/subsystems/Security/Vault.service/VaultConnector.d.ts +17 -0
- package/dist/types/subsystems/Security/Vault.service/connectors/HashicorpVault.class.d.ts +13 -0
- package/dist/types/subsystems/Security/Vault.service/connectors/JSONFileVault.class.d.ts +23 -0
- package/dist/types/subsystems/Security/Vault.service/connectors/NullVault.class.d.ts +16 -0
- package/dist/types/subsystems/Security/Vault.service/connectors/SecretsManager.class.d.ts +20 -0
- package/dist/types/subsystems/Security/Vault.service/index.d.ts +4 -0
- package/dist/types/types/ACL.types.d.ts +83 -0
- package/dist/types/types/AWS.types.d.ts +7 -0
- package/dist/types/types/Agent.types.d.ts +52 -0
- package/dist/types/types/AgentLogger.types.d.ts +16 -0
- package/dist/types/types/Cache.types.d.ts +1 -0
- package/dist/types/types/Common.types.d.ts +3 -0
- package/dist/types/types/LLM.types.d.ts +365 -0
- package/dist/types/types/Redis.types.d.ts +6 -0
- package/dist/types/types/SRE.types.d.ts +60 -0
- package/dist/types/types/Security.types.d.ts +16 -0
- package/dist/types/types/Storage.types.d.ts +3 -0
- package/dist/types/types/VectorDB.types.d.ts +66 -0
- package/dist/types/utils/base64.utils.d.ts +86 -0
- package/dist/types/utils/cli.utils.d.ts +20 -0
- package/dist/types/utils/data.utils.d.ts +17 -0
- package/dist/types/utils/date-time.utils.d.ts +3 -0
- package/dist/types/utils/general.utils.d.ts +75 -0
- package/dist/types/utils/index.d.ts +9 -0
- package/dist/types/utils/numbers.utils.d.ts +2 -0
- package/dist/types/utils/oauth.utils.d.ts +7 -0
- package/dist/types/utils/string.utils.d.ts +28 -0
- package/dist/types/utils/url.utils.d.ts +1 -0
- package/dist/types/utils/validation.utils.d.ts +25 -0
- package/package.json +117 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class AgentRequest {
|
|
2
|
+
headers: any;
|
|
3
|
+
body: any;
|
|
4
|
+
query: any;
|
|
5
|
+
params: any;
|
|
6
|
+
method: string;
|
|
7
|
+
path: string;
|
|
8
|
+
sessionID: string;
|
|
9
|
+
res: Response | null;
|
|
10
|
+
req: Request | null;
|
|
11
|
+
files: any[];
|
|
12
|
+
_agent_authinfo: any;
|
|
13
|
+
constructor(req?: AgentRequest | string[] | any);
|
|
14
|
+
header(name: string): any;
|
|
15
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Agent } from './Agent.class';
|
|
2
|
+
import { LLMCache } from '@sre/MemoryManager/LLMCache';
|
|
3
|
+
export declare class AgentRuntime {
|
|
4
|
+
agent: Agent;
|
|
5
|
+
private static processResults;
|
|
6
|
+
private static tagsData;
|
|
7
|
+
static dummy: {};
|
|
8
|
+
private agentContext;
|
|
9
|
+
llmCache: LLMCache;
|
|
10
|
+
private xDebugRun;
|
|
11
|
+
private xDebugInject;
|
|
12
|
+
private xDebugRead;
|
|
13
|
+
private xDebugStop;
|
|
14
|
+
private xDebugPendingInject;
|
|
15
|
+
private xMockDataInject;
|
|
16
|
+
xDebugId: string | undefined;
|
|
17
|
+
private xDebugCmd;
|
|
18
|
+
private _debugActive;
|
|
19
|
+
private _runtimeFileReady;
|
|
20
|
+
sessionClosed: boolean;
|
|
21
|
+
private reqTagOwner;
|
|
22
|
+
reqTag: any;
|
|
23
|
+
processID: any;
|
|
24
|
+
workflowReqId: any;
|
|
25
|
+
alwaysActiveComponents: any;
|
|
26
|
+
exclusiveComponents: any;
|
|
27
|
+
private checkRuntimeContext;
|
|
28
|
+
get circularLimitReached(): string | boolean;
|
|
29
|
+
set circularLimitReached(value: string | boolean);
|
|
30
|
+
get debug(): boolean;
|
|
31
|
+
get curStep(): number;
|
|
32
|
+
constructor(agent: Agent);
|
|
33
|
+
ready(): Promise<boolean>;
|
|
34
|
+
destroy(): void;
|
|
35
|
+
incTag(componentId: any): void;
|
|
36
|
+
sync(): Promise<void>;
|
|
37
|
+
getWaitingComponents(): any;
|
|
38
|
+
getExclusiveActiveComponents(): any;
|
|
39
|
+
readState(stateId: string, deltaOnly?: boolean): {
|
|
40
|
+
state: {};
|
|
41
|
+
dbgSession: any;
|
|
42
|
+
sessionClosed: boolean;
|
|
43
|
+
error: string;
|
|
44
|
+
step?: undefined;
|
|
45
|
+
} | {
|
|
46
|
+
state: {};
|
|
47
|
+
dbgSession: any;
|
|
48
|
+
sessionClosed: boolean;
|
|
49
|
+
step: number;
|
|
50
|
+
error?: undefined;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* This method is called by the agent to run a process cycle, it will run all active components and return the results
|
|
54
|
+
* The function is called multiple times until all components are executed and no more active components are available
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
57
|
+
runCycle(): Promise<any>;
|
|
58
|
+
private processResults;
|
|
59
|
+
checkCircularLimit(): string | boolean;
|
|
60
|
+
injectDebugOutput(componentId: string): Promise<any>;
|
|
61
|
+
getRuntimeData(componentId: any): {
|
|
62
|
+
input?: {
|
|
63
|
+
[key: string]: any;
|
|
64
|
+
};
|
|
65
|
+
_LoopData?: any;
|
|
66
|
+
_ChildLoopData?: any;
|
|
67
|
+
};
|
|
68
|
+
updateRuntimeData(componentId: any, data: any): void;
|
|
69
|
+
saveRuntimeComponentData(componentId: any, data: any): void;
|
|
70
|
+
incStep(): void;
|
|
71
|
+
updateComponent(componentId: string, data: any): void;
|
|
72
|
+
resetComponent(componentId: string): void;
|
|
73
|
+
getComponentData(componentId: string): {
|
|
74
|
+
active: boolean;
|
|
75
|
+
name: string;
|
|
76
|
+
runtimeData?: {
|
|
77
|
+
input?: {
|
|
78
|
+
[key: string]: any;
|
|
79
|
+
};
|
|
80
|
+
_LoopData?: any;
|
|
81
|
+
_ChildLoopData?: any;
|
|
82
|
+
};
|
|
83
|
+
step: number;
|
|
84
|
+
input?: {
|
|
85
|
+
[key: string]: any;
|
|
86
|
+
};
|
|
87
|
+
output?: {
|
|
88
|
+
[key: string]: any;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Agent } from './Agent.class';
|
|
2
|
+
export declare class AgentSSE {
|
|
3
|
+
private agent;
|
|
4
|
+
private connections;
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new AgentSSE instance
|
|
7
|
+
* @param agent - The agent instance this SSE belongs to
|
|
8
|
+
*/
|
|
9
|
+
constructor(agent: Agent);
|
|
10
|
+
/**
|
|
11
|
+
* Updates or adds a response object with the given monitor ID
|
|
12
|
+
* Maintains backward compatibility by also setting the res property
|
|
13
|
+
* @param res - The response object to add or update
|
|
14
|
+
* @param monitorId - The monitor ID associated with this connection
|
|
15
|
+
* @returns The connection ID that was created or updated
|
|
16
|
+
*/
|
|
17
|
+
add(res: any, monitorId: string): void;
|
|
18
|
+
[Symbol.iterator](): IterableIterator<[string, any]>;
|
|
19
|
+
/**
|
|
20
|
+
* Sends an event to all connected clients
|
|
21
|
+
* @param _type - The event type
|
|
22
|
+
* @param _data - The event data
|
|
23
|
+
*/
|
|
24
|
+
send(_type: string, _data: any): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Removes a specific connection
|
|
27
|
+
* @param connectionId - The ID of the connection to remove
|
|
28
|
+
* @returns True if the connection was found and removed, false otherwise
|
|
29
|
+
*/
|
|
30
|
+
remove(connectionId: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Closes all connections
|
|
33
|
+
*/
|
|
34
|
+
close(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the number of active connections
|
|
37
|
+
* @returns The number of active connections
|
|
38
|
+
*/
|
|
39
|
+
getConnectionCount(): number;
|
|
40
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EmbodimentSettings } from './EmbodimentSettings.class';
|
|
2
|
+
export declare class AgentSettings {
|
|
3
|
+
private _settings;
|
|
4
|
+
embodiments?: EmbodimentSettings;
|
|
5
|
+
private _ready;
|
|
6
|
+
constructor(agentId?: any);
|
|
7
|
+
init(agentId: any): Promise<void>;
|
|
8
|
+
ready(maxWait?: number): Promise<unknown>;
|
|
9
|
+
get(key: string): any;
|
|
10
|
+
set(key: string, value: any): void;
|
|
11
|
+
has(key: string): any;
|
|
12
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ACL } from '@sre/Security/AccessControl/ACL.class';
|
|
2
|
+
import { AccessCandidate } from '@sre/Security/AccessControl/AccessCandidate.class';
|
|
3
|
+
import { SecureConnector } from '@sre/Security/SecureConnector.class';
|
|
4
|
+
import { IAccessCandidate } from '@sre/types/ACL.types';
|
|
5
|
+
import { AccessRequest } from '@sre/Security/AccessControl/AccessRequest.class';
|
|
6
|
+
export interface IComponentRequest {
|
|
7
|
+
register(componentName: string, componentInstance: any): Promise<void>;
|
|
8
|
+
get(componentName: string): Promise<any>;
|
|
9
|
+
getAll(): Promise<any>;
|
|
10
|
+
}
|
|
11
|
+
export declare abstract class ComponentConnector extends SecureConnector {
|
|
12
|
+
abstract getResourceACL(resourceId: string, candidate: IAccessCandidate): Promise<ACL>;
|
|
13
|
+
protected abstract register(acRequest: AccessRequest, componentName: string, componentInstance: any): Promise<void>;
|
|
14
|
+
protected abstract get(acRequest: AccessRequest, componentName: string): Promise<any>;
|
|
15
|
+
protected abstract getAll(acRequest: AccessRequest): Promise<any>;
|
|
16
|
+
requester(candidate: AccessCandidate): IComponentRequest;
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AccessRequest } from '@sre/Security/AccessControl/AccessRequest.class';
|
|
2
|
+
import { ACL } from '@sre/Security/AccessControl/ACL.class';
|
|
3
|
+
import { IAccessCandidate } from '@sre/types/ACL.types';
|
|
4
|
+
import { ComponentConnector } from '../ComponentConnector';
|
|
5
|
+
export declare class LocalComponentConnector extends ComponentConnector {
|
|
6
|
+
name: string;
|
|
7
|
+
private components;
|
|
8
|
+
constructor();
|
|
9
|
+
init(): Promise<void>;
|
|
10
|
+
protected register(acRequest: AccessRequest, componentName: string, componentInstance: any): Promise<void>;
|
|
11
|
+
protected get(acRequest: AccessRequest, componentName: string): Promise<any>;
|
|
12
|
+
protected getAll(acRequest: AccessRequest): Promise<any>;
|
|
13
|
+
getResourceACL(resourceId: string, candidate: IAccessCandidate): Promise<ACL>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IAgent } from '@sre/types/Agent.types';
|
|
2
|
+
/**
|
|
3
|
+
* This class creates a forked agent from a parent agent branch, it allows running a sub-branch of the parent agent asynchrounously by providing a separate agent context
|
|
4
|
+
* We use composition instead of inheritance to avoid circular dependencies between Agent and ForkedAgent
|
|
5
|
+
*/
|
|
6
|
+
export declare class ForkedAgent {
|
|
7
|
+
private parent;
|
|
8
|
+
agent: IAgent;
|
|
9
|
+
get agentRequest(): any;
|
|
10
|
+
get components(): any;
|
|
11
|
+
get agentRuntime(): any;
|
|
12
|
+
get jobID(): any;
|
|
13
|
+
constructor(parent: IAgent, componentId: string);
|
|
14
|
+
process(path: string, input: any): Promise<any>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { AccessCandidate } from '@sre/Security/AccessControl/AccessCandidate.class';
|
|
2
|
+
import { AccessRequest } from '@sre/Security/AccessControl/AccessRequest.class';
|
|
3
|
+
import { ACL } from '@sre/Security/AccessControl/ACL.class';
|
|
4
|
+
import { IAccessCandidate } from '@sre/types/ACL.types';
|
|
5
|
+
import { SecureConnector } from '@sre/Security/SecureConnector.class';
|
|
6
|
+
export interface CodeInput {
|
|
7
|
+
code: string;
|
|
8
|
+
dependencies?: string;
|
|
9
|
+
files?: Record<string, string>;
|
|
10
|
+
inputs?: Record<string, any>;
|
|
11
|
+
}
|
|
12
|
+
export interface CodeConfig {
|
|
13
|
+
runtime: string;
|
|
14
|
+
timeout?: number;
|
|
15
|
+
memoryLimit?: number;
|
|
16
|
+
environment?: Record<string, string>;
|
|
17
|
+
platformConfig?: Record<string, any>;
|
|
18
|
+
}
|
|
19
|
+
export interface CodeExecutionResult {
|
|
20
|
+
output: any;
|
|
21
|
+
executionTime: number;
|
|
22
|
+
logs?: string[];
|
|
23
|
+
errors?: string[];
|
|
24
|
+
success: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface CodePreparationResult {
|
|
27
|
+
prepared: boolean;
|
|
28
|
+
errors?: string[];
|
|
29
|
+
warnings?: string[];
|
|
30
|
+
metadata?: Record<string, any>;
|
|
31
|
+
}
|
|
32
|
+
export interface CodeDeployment {
|
|
33
|
+
id: string;
|
|
34
|
+
status: 'deploying' | 'ready' | 'failed';
|
|
35
|
+
runtime: string;
|
|
36
|
+
createdAt: Date;
|
|
37
|
+
lastUsed?: Date;
|
|
38
|
+
}
|
|
39
|
+
export interface ICodeRequest {
|
|
40
|
+
prepare(input: CodeInput, config: CodeConfig): Promise<CodePreparationResult>;
|
|
41
|
+
deploy(deploymentId: string, input: CodeInput, config: CodeConfig): Promise<CodeDeployment>;
|
|
42
|
+
execute(input: CodeInput, config: CodeConfig): Promise<CodeExecutionResult>;
|
|
43
|
+
executeDeployment(deploymentId: string, inputs: Record<string, any>): Promise<CodeExecutionResult>;
|
|
44
|
+
listDeployments(): Promise<CodeDeployment[]>;
|
|
45
|
+
getDeployment(deploymentId: string): Promise<CodeDeployment | null>;
|
|
46
|
+
deleteDeployment(deploymentId: string): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
export declare abstract class CodeConnector extends SecureConnector {
|
|
49
|
+
abstract getResourceACL(resourceId: string, candidate: IAccessCandidate): Promise<ACL>;
|
|
50
|
+
protected abstract prepare(acRequest: AccessRequest, input: CodeInput, config: CodeConfig): Promise<CodePreparationResult>;
|
|
51
|
+
protected abstract deploy(acRequest: AccessRequest, deploymentId: string, input: CodeInput, config: CodeConfig): Promise<CodeDeployment>;
|
|
52
|
+
protected abstract execute(acRequest: AccessRequest, input: CodeInput, config: CodeConfig): Promise<CodeExecutionResult>;
|
|
53
|
+
protected abstract executeDeployment(acRequest: AccessRequest, deploymentId: string, inputs: Record<string, any>): Promise<CodeExecutionResult>;
|
|
54
|
+
protected abstract listDeployments(acRequest: AccessRequest): Promise<CodeDeployment[]>;
|
|
55
|
+
protected abstract getDeployment(acRequest: AccessRequest, deploymentId: string): Promise<CodeDeployment | null>;
|
|
56
|
+
protected abstract deleteDeployment(acRequest: AccessRequest, deploymentId: string): Promise<void>;
|
|
57
|
+
requester(candidate: AccessCandidate): ICodeRequest;
|
|
58
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IAccessCandidate } from '@sre/types/ACL.types';
|
|
2
|
+
import { ACL } from '@sre/Security/AccessControl/ACL.class';
|
|
3
|
+
import { CodeConfig, CodePreparationResult, CodeConnector, CodeInput, CodeDeployment, CodeExecutionResult } from '../CodeConnector';
|
|
4
|
+
import { AccessRequest } from '@sre/Security/AccessControl/AccessRequest.class';
|
|
5
|
+
export declare class AWSLambdaCode extends CodeConnector {
|
|
6
|
+
name: string;
|
|
7
|
+
prepare(acRequest: AccessRequest, input: CodeInput, config: CodeConfig): Promise<CodePreparationResult>;
|
|
8
|
+
deploy(acRequest: AccessRequest, deploymentId: string, input: CodeInput, config: CodeConfig): Promise<CodeDeployment>;
|
|
9
|
+
execute(acRequest: AccessRequest, input: CodeInput, config: CodeConfig): Promise<CodeExecutionResult>;
|
|
10
|
+
executeDeployment(acRequest: AccessRequest, deploymentId: string, inputs: Record<string, any>): Promise<CodeExecutionResult>;
|
|
11
|
+
listDeployments(acRequest: AccessRequest): Promise<CodeDeployment[]>;
|
|
12
|
+
getDeployment(acRequest: AccessRequest, deploymentId: string): Promise<CodeDeployment | null>;
|
|
13
|
+
deleteDeployment(acRequest: AccessRequest, deploymentId: string): Promise<void>;
|
|
14
|
+
getResourceACL(resourceId: string, candidate: IAccessCandidate): Promise<ACL>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Connector } from '@sre/Core/Connector.class';
|
|
2
|
+
export declare class CLIConnector extends Connector {
|
|
3
|
+
protected _settings?: any;
|
|
4
|
+
name: string;
|
|
5
|
+
params: any;
|
|
6
|
+
constructor(_settings?: any);
|
|
7
|
+
/**
|
|
8
|
+
* Parses the command line arguments, and returns the parsed arguments object
|
|
9
|
+
* if args is provided, it will only parse the provided args
|
|
10
|
+
* @param argv The command line arguments, usually process.argv
|
|
11
|
+
* @param args The arguments to parse
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
parse(argv: string[], args?: string | string[]): Record<string, any>;
|
|
15
|
+
/**
|
|
16
|
+
* Get the parsed arguments as an object
|
|
17
|
+
* @param args The arguments to get
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
get(args: string | string[]): {};
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SecureConnector } from '@sre/Security/SecureConnector.class';
|
|
2
|
+
import { IAccessCandidate } from '@sre/types/ACL.types';
|
|
3
|
+
import { ACL } from '@sre/Security/AccessControl/ACL.class';
|
|
4
|
+
import { AccessCandidate } from '@sre/Security/AccessControl/AccessCandidate.class';
|
|
5
|
+
import { AccessRequest } from '@sre/Security/AccessControl/AccessRequest.class';
|
|
6
|
+
import { AgentCallLog } from '@sre/types/AgentLogger.types';
|
|
7
|
+
export interface ILogRequest {
|
|
8
|
+
log(logData: AgentCallLog, callId?: string): Promise<any>;
|
|
9
|
+
logTask(tasks: number, isUsingTestDomain: boolean): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare abstract class LogConnector extends SecureConnector {
|
|
12
|
+
abstract id: string;
|
|
13
|
+
abstract getResourceACL(resourceId: string, candidate: IAccessCandidate): Promise<ACL>;
|
|
14
|
+
requester(candidate: AccessCandidate): ILogRequest;
|
|
15
|
+
protected abstract log(acRequest: AccessRequest, logData: AgentCallLog, callId?: string): Promise<any>;
|
|
16
|
+
protected abstract logTask(acRequest: AccessRequest, tasks: number, isUsingTestDomain: boolean): Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AccessRequest } from '@sre/Security/AccessControl/AccessRequest.class';
|
|
2
|
+
import { ACL } from '@sre/Security/AccessControl/ACL.class';
|
|
3
|
+
import { IAccessCandidate } from '@sre/types/ACL.types';
|
|
4
|
+
import { LogConnector } from '../LogConnector';
|
|
5
|
+
import { AgentCallLog } from '@sre/types/AgentLogger.types';
|
|
6
|
+
export declare class ConsoleLog extends LogConnector {
|
|
7
|
+
id: string;
|
|
8
|
+
getResourceACL(resourceId: string, candidate: IAccessCandidate): Promise<ACL>;
|
|
9
|
+
protected log(acRequest: AccessRequest, logData: AgentCallLog, callId?: string): Promise<any>;
|
|
10
|
+
protected logTask(acRequest: AccessRequest, tasks: number, isUsingTestDomain: boolean): Promise<void>;
|
|
11
|
+
name: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ACL } from '@sre/Security/AccessControl/ACL.class';
|
|
2
|
+
import { AccessCandidate } from '@sre/Security/AccessControl/AccessCandidate.class';
|
|
3
|
+
import { AccessRequest } from '@sre/Security/AccessControl/AccessRequest.class';
|
|
4
|
+
import { SecureConnector } from '@sre/Security/SecureConnector.class';
|
|
5
|
+
import { IAccessCandidate } from '@sre/types/ACL.types';
|
|
6
|
+
import { StorageData } from '@sre/types/Storage.types';
|
|
7
|
+
export interface INKVRequest {
|
|
8
|
+
get(namespace: string, key: string): Promise<StorageData>;
|
|
9
|
+
set(namespace: string, key: string, value: StorageData): Promise<void>;
|
|
10
|
+
delete(namespace: string, key: string): Promise<void>;
|
|
11
|
+
exists(namespace: string, key: string): Promise<boolean>;
|
|
12
|
+
deleteAll(namespace: string): Promise<void>;
|
|
13
|
+
list(namespace: string): Promise<{
|
|
14
|
+
key: string;
|
|
15
|
+
data: StorageData;
|
|
16
|
+
}[]>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* NKV = Namespace-Key-Value Connector
|
|
20
|
+
*/
|
|
21
|
+
export declare abstract class NKVConnector extends SecureConnector {
|
|
22
|
+
requester(candidate: AccessCandidate): INKVRequest;
|
|
23
|
+
abstract getResourceACL(resourceId: string, candidate: IAccessCandidate): Promise<ACL>;
|
|
24
|
+
protected abstract get(acRequest: AccessRequest, namespace: string, key: string): Promise<StorageData>;
|
|
25
|
+
protected abstract set(acRequest: AccessRequest, namespace: string, key: string, value: StorageData): Promise<void>;
|
|
26
|
+
protected abstract delete(acRequest: AccessRequest, namespace: string, key: string): Promise<void>;
|
|
27
|
+
protected abstract exists(acRequest: AccessRequest, namespace: string, key: string): Promise<boolean>;
|
|
28
|
+
protected abstract deleteAll(acRequest: AccessRequest, namespace: string): Promise<void>;
|
|
29
|
+
protected abstract list(acRequest: AccessRequest, namespace: string): Promise<{
|
|
30
|
+
key: string;
|
|
31
|
+
data: StorageData;
|
|
32
|
+
}[]>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { AccessRequest } from '@sre/Security/AccessControl/AccessRequest.class';
|
|
2
|
+
import { NKVConnector } from '../NKVConnector';
|
|
3
|
+
import { IAccessCandidate } from '@sre/types/ACL.types';
|
|
4
|
+
import { ACL } from '@sre/Security/AccessControl/ACL.class';
|
|
5
|
+
import { StorageData } from '@sre/types/Storage.types';
|
|
6
|
+
export declare class NKVRAM extends NKVConnector {
|
|
7
|
+
protected _settings?: any;
|
|
8
|
+
name: string;
|
|
9
|
+
private storage;
|
|
10
|
+
private namespaces;
|
|
11
|
+
private accountConnector;
|
|
12
|
+
private cacheConnector;
|
|
13
|
+
constructor(_settings?: any);
|
|
14
|
+
key(...parts: string[]): string;
|
|
15
|
+
mdKey(...parts: string[]): string;
|
|
16
|
+
protected get(acRequest: AccessRequest, namespace: string, key: string): Promise<StorageData>;
|
|
17
|
+
protected set(acRequest: AccessRequest, namespace: string, key: string, value: any): Promise<void>;
|
|
18
|
+
protected delete(acRequest: AccessRequest, namespace: string, key: string): Promise<void>;
|
|
19
|
+
protected exists(acRequest: AccessRequest, namespace: string, key: string): Promise<boolean>;
|
|
20
|
+
list(acRequest: AccessRequest, namespace: string): Promise<{
|
|
21
|
+
key: string;
|
|
22
|
+
data: StorageData;
|
|
23
|
+
}[]>;
|
|
24
|
+
deleteAll(acRequest: AccessRequest, namespace: string): Promise<void>;
|
|
25
|
+
getResourceACL(resourceId: string, candidate: IAccessCandidate): Promise<ACL>;
|
|
26
|
+
/**
|
|
27
|
+
* Get all keys matching a prefix (for internal use)
|
|
28
|
+
*/
|
|
29
|
+
private getKeysByPrefix;
|
|
30
|
+
/**
|
|
31
|
+
* Clear all data (useful for testing)
|
|
32
|
+
*/
|
|
33
|
+
clearAll(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Get storage statistics
|
|
36
|
+
*/
|
|
37
|
+
getStats(): {
|
|
38
|
+
totalKeys: number;
|
|
39
|
+
totalNamespaces: number;
|
|
40
|
+
};
|
|
41
|
+
static NamespaceAccessControl(target: any, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
42
|
+
static Validate(target: any, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
43
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AccessRequest } from '@sre/Security/AccessControl/AccessRequest.class';
|
|
2
|
+
import { NKVConnector } from '../NKVConnector';
|
|
3
|
+
import { IAccessCandidate } from '@sre/types/ACL.types';
|
|
4
|
+
import { ACL } from '@sre/Security/AccessControl/ACL.class';
|
|
5
|
+
import { StorageData } from '@sre/types/Storage.types';
|
|
6
|
+
export declare class NKVRedis extends NKVConnector {
|
|
7
|
+
protected _settings?: any;
|
|
8
|
+
name: string;
|
|
9
|
+
private redisCacheConnector;
|
|
10
|
+
private accountConnector;
|
|
11
|
+
constructor(_settings?: any);
|
|
12
|
+
key(...parts: string[]): string;
|
|
13
|
+
mdKey(...parts: string[]): string;
|
|
14
|
+
protected get(acRequest: AccessRequest, namespace: string, key: string): Promise<StorageData>;
|
|
15
|
+
protected set(acRequest: AccessRequest, namespace: string, key: string, value: any): Promise<void>;
|
|
16
|
+
protected delete(acRequest: AccessRequest, namespace: string, key: string): Promise<void>;
|
|
17
|
+
protected exists(acRequest: AccessRequest, namespace: string, key: string): Promise<boolean>;
|
|
18
|
+
list(acRequest: AccessRequest, namespace: string): Promise<{
|
|
19
|
+
key: string;
|
|
20
|
+
data: StorageData;
|
|
21
|
+
}[]>;
|
|
22
|
+
deleteAll(acRequest: AccessRequest, namespace: string): Promise<void>;
|
|
23
|
+
getResourceACL(resourceId: string, candidate: IAccessCandidate): Promise<ACL>;
|
|
24
|
+
private fetchKeysByPrefix;
|
|
25
|
+
static NamespaceAccessControl(target: any, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
26
|
+
static Validate(target: any, propertyKey: string, descriptor: PropertyDescriptor): PropertyDescriptor;
|
|
27
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Connector } from '@sre/Core/Connector.class';
|
|
2
|
+
export type GenericRequestHandler = (...args: any[]) => void | Promise<void>;
|
|
3
|
+
export declare abstract class RouterConnector extends Connector {
|
|
4
|
+
abstract baseUrl: string;
|
|
5
|
+
abstract get(path: string, ...handlers: GenericRequestHandler[]): this;
|
|
6
|
+
abstract post(path: string, ...handlers: GenericRequestHandler[]): this;
|
|
7
|
+
abstract put(path: string, ...handlers: GenericRequestHandler[]): this;
|
|
8
|
+
abstract delete(path: string, ...handlers: GenericRequestHandler[]): this;
|
|
9
|
+
abstract useFn(...handlers: GenericRequestHandler[]): this;
|
|
10
|
+
abstract use(path: string, ...handlers: GenericRequestHandler[]): this;
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Router } from 'express';
|
|
2
|
+
import { RouterConnector, GenericRequestHandler } from '../RouterConnector';
|
|
3
|
+
export declare class ExpressRouter extends RouterConnector {
|
|
4
|
+
protected _settings?: {
|
|
5
|
+
router: Router;
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
};
|
|
8
|
+
private router;
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
constructor(_settings?: {
|
|
11
|
+
router: Router;
|
|
12
|
+
baseUrl: string;
|
|
13
|
+
});
|
|
14
|
+
get(path: string, ...handlers: GenericRequestHandler[]): this;
|
|
15
|
+
post(path: string, ...handlers: GenericRequestHandler[]): this;
|
|
16
|
+
put(path: string, ...handlers: GenericRequestHandler[]): this;
|
|
17
|
+
delete(path: string, ...handlers: GenericRequestHandler[]): this;
|
|
18
|
+
useFn(...handlers: GenericRequestHandler[]): this;
|
|
19
|
+
use(path: string, ...handlers: GenericRequestHandler[]): this;
|
|
20
|
+
getRouter(): Router;
|
|
21
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RouterConnector, GenericRequestHandler } from '../RouterConnector';
|
|
2
|
+
export declare class NullRouter extends RouterConnector {
|
|
3
|
+
protected _settings?: any;
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
constructor(_settings?: any);
|
|
6
|
+
get(path: string, ...handlers: GenericRequestHandler[]): this;
|
|
7
|
+
post(path: string, ...handlers: GenericRequestHandler[]): this;
|
|
8
|
+
put(path: string, ...handlers: GenericRequestHandler[]): this;
|
|
9
|
+
delete(path: string, ...handlers: GenericRequestHandler[]): this;
|
|
10
|
+
useFn(...handlers: GenericRequestHandler[]): this;
|
|
11
|
+
use(path: string, ...handlers: GenericRequestHandler[]): this;
|
|
12
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { IAccessCandidate } from '@sre/types/ACL.types';
|
|
2
|
+
import { StorageMetadata } from '@sre/types/Storage.types';
|
|
3
|
+
import { StorageConnector } from './StorageConnector';
|
|
4
|
+
import { CacheConnector } from '@sre/MemoryManager/Cache.service/CacheConnector';
|
|
5
|
+
export type TSmythFSURI = {
|
|
6
|
+
hash: string;
|
|
7
|
+
team: string;
|
|
8
|
+
path: string;
|
|
9
|
+
};
|
|
10
|
+
export declare class SmythFS {
|
|
11
|
+
private storage;
|
|
12
|
+
private cache;
|
|
13
|
+
private hash;
|
|
14
|
+
static instances: any;
|
|
15
|
+
private static generateInstanceHash;
|
|
16
|
+
static get Instance(): SmythFS;
|
|
17
|
+
static getInstance(storageProvider?: string | StorageConnector, cacheProvider?: string | CacheConnector): SmythFS;
|
|
18
|
+
private constructor();
|
|
19
|
+
getBaseUri(candidate: IAccessCandidate): string;
|
|
20
|
+
/**
|
|
21
|
+
* Reads a resource from smyth file system
|
|
22
|
+
* @param uri smythfs:// uri
|
|
23
|
+
* @param candidate
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
read(uri: string, candidate?: IAccessCandidate): Promise<Buffer>;
|
|
27
|
+
write(uri: string, data: any, candidate?: IAccessCandidate, metadata?: StorageMetadata, ttl?: number): Promise<void>;
|
|
28
|
+
delete(uri: string, candidate?: IAccessCandidate): Promise<void>;
|
|
29
|
+
exists(uri: string, candidate?: IAccessCandidate): Promise<boolean>;
|
|
30
|
+
genTempUrl(uri: string, candidate?: IAccessCandidate, ttlSeconds?: number): Promise<string>;
|
|
31
|
+
destroyTempUrl(url: string, { delResource }?: {
|
|
32
|
+
delResource: boolean;
|
|
33
|
+
}): Promise<void>;
|
|
34
|
+
serveTempContent(req: any, res: any): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Generates a public url for the resource
|
|
37
|
+
* @param uri
|
|
38
|
+
* @param candidate
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
genResourceUrl(uri: string, candidate?: IAccessCandidate): Promise<string>;
|
|
42
|
+
destroyResourceUrl(url: string, { delResource }?: {
|
|
43
|
+
delResource: boolean;
|
|
44
|
+
}): Promise<void>;
|
|
45
|
+
serveResource(req: any, res: any): Promise<void>;
|
|
46
|
+
private URIParser;
|
|
47
|
+
private CaseSensitiveURL;
|
|
48
|
+
private toBuffer;
|
|
49
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ACL } from '@sre/Security/AccessControl/ACL.class';
|
|
2
|
+
import { AccessCandidate } from '@sre/Security/AccessControl/AccessCandidate.class';
|
|
3
|
+
import { AccessRequest } from '@sre/Security/AccessControl/AccessRequest.class';
|
|
4
|
+
import { SecureConnector } from '@sre/Security/SecureConnector.class';
|
|
5
|
+
import { IAccessCandidate, IACL } from '@sre/types/ACL.types';
|
|
6
|
+
import { StorageData, StorageMetadata } from '@sre/types/Storage.types';
|
|
7
|
+
export interface IStorageRequest {
|
|
8
|
+
read(resourceId: string): Promise<StorageData>;
|
|
9
|
+
write(resourceId: string, value: StorageData, acl?: IACL, metadata?: StorageMetadata): Promise<void>;
|
|
10
|
+
delete(resourceId: string): Promise<void>;
|
|
11
|
+
exists(resourceId: string): Promise<boolean>;
|
|
12
|
+
getMetadata(resourceId: string): Promise<StorageMetadata | undefined>;
|
|
13
|
+
setMetadata(resourceId: string, metadata: StorageMetadata): Promise<void>;
|
|
14
|
+
getACL(resourceId: string): Promise<ACL | undefined>;
|
|
15
|
+
setACL(resourceId: string, acl: IACL): Promise<void>;
|
|
16
|
+
expire(resourceId: string, ttl: number): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare abstract class StorageConnector extends SecureConnector {
|
|
19
|
+
abstract getResourceACL(resourceId: string, candidate: IAccessCandidate): Promise<ACL>;
|
|
20
|
+
protected abstract read(acRequest: AccessRequest, resourceId: string): Promise<StorageData>;
|
|
21
|
+
protected abstract write(acRequest: AccessRequest, resourceId: string, value: StorageData, acl?: IACL, metadata?: StorageMetadata): Promise<void>;
|
|
22
|
+
protected abstract delete(acRequest: AccessRequest, resourceId: string): Promise<void>;
|
|
23
|
+
protected abstract exists(acRequest: AccessRequest, resourceId: string): Promise<boolean>;
|
|
24
|
+
protected abstract getMetadata(acRequest: AccessRequest, resourceId: string): Promise<StorageMetadata | undefined>;
|
|
25
|
+
protected abstract setMetadata(acRequest: AccessRequest, resourceId: string, metadata: StorageMetadata): Promise<void>;
|
|
26
|
+
protected abstract getACL(acRequest: AccessRequest, resourceId: string): Promise<ACL | undefined>;
|
|
27
|
+
protected abstract setACL(acRequest: AccessRequest, resourceId: string, acl: IACL): Promise<void>;
|
|
28
|
+
protected abstract expire(acRequest: AccessRequest, resourceId: string, ttl: number): Promise<void>;
|
|
29
|
+
requester(candidate: AccessCandidate): IStorageRequest;
|
|
30
|
+
}
|