Give connectors a store that survives restarts, and a way to clear it
`ConnectorNode.store` keeps short strings per connector package in the
engine's database (`connector_state`, migration f8c3e5a91d27), so the nodes of
one package share them and `fluksio serve` needs nothing new: get, set and
delete, at most 64 kB a value and 256 keys a package. A superuser lists the
keys (never the values) and clears them through `/connectors/{node_type}/state`,
or under Stored state in a connector node's panel. Documented in the connector
contract.
This commit is contained in:
@@ -565,6 +565,29 @@ export const ChatItemSchema = {
|
||||
title: 'ChatItem'
|
||||
} as const;
|
||||
|
||||
export const ConnectorStatePublicSchema = {
|
||||
properties: {
|
||||
connector: {
|
||||
type: 'string',
|
||||
title: 'Connector'
|
||||
},
|
||||
data: {
|
||||
items: {
|
||||
'$ref': '#/components/schemas/StoredKey'
|
||||
},
|
||||
type: 'array',
|
||||
title: 'Data'
|
||||
},
|
||||
count: {
|
||||
type: 'integer',
|
||||
title: 'Count'
|
||||
}
|
||||
},
|
||||
type: 'object',
|
||||
required: ['connector', 'data', 'count'],
|
||||
title: 'ConnectorStatePublic'
|
||||
} as const;
|
||||
|
||||
export const ControlNodeSchema = {
|
||||
properties: {
|
||||
id: {
|
||||
@@ -3669,6 +3692,27 @@ export const ShareRequestSchema = {
|
||||
title: 'ShareRequest'
|
||||
} as const;
|
||||
|
||||
export const StoredKeySchema = {
|
||||
properties: {
|
||||
key: {
|
||||
type: 'string',
|
||||
title: 'Key'
|
||||
},
|
||||
size: {
|
||||
type: 'integer',
|
||||
title: 'Size'
|
||||
},
|
||||
updated_at: {
|
||||
type: 'string',
|
||||
format: 'date-time',
|
||||
title: 'Updated At'
|
||||
}
|
||||
},
|
||||
type: 'object',
|
||||
required: ['key', 'size', 'updated_at'],
|
||||
title: 'StoredKey'
|
||||
} as const;
|
||||
|
||||
export const SubscriptionSchema = {
|
||||
properties: {
|
||||
endpoint: {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -142,6 +142,12 @@ export type ChatItem = {
|
||||
error?: (string | null);
|
||||
};
|
||||
|
||||
export type ConnectorStatePublic = {
|
||||
connector: string;
|
||||
data: Array<StoredKey>;
|
||||
count: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* A wren node the chat can talk to: where it sends and where it reads.
|
||||
*/
|
||||
@@ -1235,6 +1241,12 @@ export type ShareRequest = {
|
||||
lib_name: string;
|
||||
};
|
||||
|
||||
export type StoredKey = {
|
||||
key: string;
|
||||
size: number;
|
||||
updated_at: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* What a browser handed us. Opaque apart from the endpoint's host.
|
||||
*/
|
||||
@@ -1553,6 +1565,25 @@ export type CloudAddRemoteUserResponse = (UserPublic);
|
||||
|
||||
export type CloudDisconnectResponse = (Message);
|
||||
|
||||
export type ConnectorsReadConnectorStateData = {
|
||||
nodeType: string;
|
||||
};
|
||||
|
||||
export type ConnectorsReadConnectorStateResponse = (ConnectorStatePublic);
|
||||
|
||||
export type ConnectorsClearConnectorStateData = {
|
||||
nodeType: string;
|
||||
};
|
||||
|
||||
export type ConnectorsClearConnectorStateResponse = (Message);
|
||||
|
||||
export type ConnectorsDeleteConnectorStateData = {
|
||||
key: string;
|
||||
nodeType: string;
|
||||
};
|
||||
|
||||
export type ConnectorsDeleteConnectorStateResponse = (Message);
|
||||
|
||||
export type DashboardsReadDashboardsResponse = (DashboardsPublic);
|
||||
|
||||
export type DashboardsReadDashboardData = {
|
||||
|
||||
Reference in New Issue
Block a user