### Install Dependencies and Run Web App Source: https://github.com/nats-nui/nui/blob/main/README.md Installs project dependencies using npm and starts the application in web mode. Uses the 'db' directory for persistent data. ```bash npm install make dev-web ``` -------------------------------- ### GET /api/about Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/about/about.md Retrieves information about the current version, latest version, and update status of the NUI. ```APIDOC ## GET /api/about ### Description Retrieves information about the current version, latest version, and update status of the NUI. ### Method GET ### Endpoint /api/about ### Response #### Success Response (200) - **current_version** (string) - The currently installed version of the NUI. - **latest_version** (string) - The latest available version of the NUI. - **should_update** (string) - Indicates whether an update is recommended ('true' or 'false'). #### Response Example ```json { "current_version": "1.0.0", "latest_version": "1.1.0", "should_update": "true" } ``` ``` -------------------------------- ### Example Protobuf Schema Source: https://github.com/nats-nui/nui/blob/main/PROTOBUF_USAGE.md Define a message structure for user creation events. Ensure this .proto file is placed in the correct schemas directory. ```protobuf // default/user_events.proto syntax = "proto3"; message UserCreated { string user_id = 1; string email = 2; int64 created_at = 3; } ``` -------------------------------- ### Run Desktop App in Development Mode Source: https://github.com/nats-nui/nui/blob/main/README.md Starts the Wails development server to build and run the desktop application. The build is based on the underlying operating system. ```bash make dev ``` -------------------------------- ### GET /api/connection Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/connection/index.md Retrieves a list of active connections. ```APIDOC ## GET /api/connection ### Description Retrieves a list of active connections. ### Method GET ### Endpoint /api/connection ### Parameters ### Request Body null ### Response #### Success Response (200) - connection[] (array) - An array of connection objects. #### Response Example ```json [ { "id": "connection-1", "name": "MyConnection", "status": "active" } ] ``` ``` -------------------------------- ### Mirror Configuration Object Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-config.md Configures a mirror for a stream, allowing it to replicate data from another stream. Includes options for starting sequence/time and subject filtering. ```typescript Mirror { /** is taken from stream names */ name: string // omitted if empty optStartSeq: number // omitted if zero optStartTime: string // omitted if empty filterSubject: string // omitted if empty subjectTransforms: SubjectTransform[] // object, omitted if null external: { // omitted if null api: string deliver: string } domain: string // omitted if empty } ``` -------------------------------- ### GET /api/connection/:connection_id/kv/:bucket/key/:key Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/kv-entry/get.md Retrieves a key-value pair from a specified bucket within a given connection. ```APIDOC ## GET /api/connection/:connection_id/kv/:bucket/key/:key ### Description Get a key value pair from a bucket by name. ### Method GET ### Endpoint /api/connection/:connection_id/kv/:bucket/key/:key ### Parameters #### Path Parameters - **connection_id** (uuid) - Required - uuid of the connection to get the KV buckets for - **bucket** (string) - Required - name of the bucket to get the keys for - **key** (string) - Required - key to get the value for ### Request Body null ### Response #### Success Response (200) - **kv-entry** (object) - The retrieved key-value entry. See [KV-ENTRY](./def/entry.md) for details. ``` -------------------------------- ### GET /api/connection/:connection_id/kv/:bucket/key Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/kv-entry/index.md Retrieves a list of all KV buckets for a given connection, or keys within a specific bucket. ```APIDOC ## GET /api/connection/:connection_id/kv/:bucket/key ### Description List of all the KV buckets for a connection. ### Method GET ### Endpoint /api/connection/:connection_id/kv/:bucket/key ### Parameters #### Path Parameters - **connection_id** (uuid) - Required - uuid of the connection to get the KV buckets for - **bucket** (string) - Required - name of the bucket to get the keys for ### Request Body `null` ### Response #### Success Response (200) - **kv-entry[]** (array) - value and history are null in index. See [KV-ENTRY](./def/entry.md) for details. ``` -------------------------------- ### Get Connection Subscriptions Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/connection_messages/subscription index.md Retrieves a list of message subscriptions for a given connection. ```APIDOC ## GET /api/connection/:connection_id/messages/subscription ### Description Retrieves a list of message subscriptions for a specific connection. ### Method GET ### Endpoint /api/connection/:connection_id/messages/subscription ### Parameters #### Path Parameters - **connection_id** (string) - Required - The ID of the connection to retrieve subscriptions for. ### Response #### Success Response (200) - **subscription[]** (array) - An array of subscription objects. ``` -------------------------------- ### Subscribe to Metrics WebSocket Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/ws/metrics.md Use this HTTP GET request to subscribe to the metrics WebSocket endpoint. Replace `` with your specific connection identifier. ```http GET /ws/metrics?id= ``` -------------------------------- ### GET /api/connection/:connection_id/kv/:bucket Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/kv-bucket/get.md Retrieves the state of a specific Key-Value bucket within a given NATS connection. ```APIDOC ## GET /api/connection/:connection_id/kv/:bucket ### Description Get the state of a specific bucket. ### Method GET ### Endpoint /api/connection/:connection_id/kv/:bucket ### Parameters #### Path Parameters - **connection_id** (uuid) - Required - uuid of the connection to get the bucket from - **bucket** (string) - Required - name of the bucket ### Request Body `null` ### Response #### Success Response (200) - **bucket_state** (object) - The state of the bucket. See [BUCKET-STATE](./def/bucket-state.md) for details. #### Response Example ```json { "bucket_state": { "keys": 10, "size": 1024 } } ``` ``` -------------------------------- ### Get Stream Consumers Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/consumer/index.md Retrieves a list of all consumers associated with a specific stream within a given connection. ```APIDOC ## GET /api/connection/:connection_id/stream/:stream_name/consumer ### Description Get all consumers associated with a stream. ### Method GET ### Endpoint /api/connection/:connection_id/stream/:stream_name/consumer ### Parameters #### Path Parameters - **connection_id** (uuid) - Required - uuid of saved connection - **stream_name** (string) - Required - name of the stream containig consumer ### Request Body `null` ### Response #### Success Response (200) - **consumer_info[]** (array) - An array of consumer information objects. See [CONSUMER-INFO](./def/stream-consumer.md) for details. ``` -------------------------------- ### Metrics Request Message Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/ws/metrics.md Client sends this JSON message to request a metrics stream for a connection. Set the `enabled` field to `true` to start receiving metrics. ```json { "type": "metrics_req", "payload": { "enabled": boolean } } ``` -------------------------------- ### NATS WebSocket Subscription Endpoint Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/ws/connection.md Use this GET endpoint to subscribe to NATS subjects over WebSocket. Replace with your active connection identifier. ```http GET /ws/sub?id= ``` -------------------------------- ### GET /api/connection/:connection_id/stream/:stream_name/messages Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream_messages/index.md Retrieves a collection of stream messages, optionally filtered by sequence number, time, interval, and subjects. ```APIDOC ## GET /api/connection/:connection_id/stream/:stream_name/messages ### Description Return a (filtered) COLLECTION of STREAMS-MESSAGES ### Method GET ### Endpoint GET /api/connection/:connection_id/stream/:stream_name/messages?seq_start=<>&interval=<>&subjects=<> ### Parameters #### Path Parameters - **connection_id** (uuid) - Required - uuid of the CONNECTION that contains the STREAM messages - **stream_name** (string) - Required - name of the STREAM to retrieve messages from #### Query Parameters - **seq_start** (integer) - Optional - message sequence number to fetch from - **start_time** (datetime) - Optional - datetime (in RCF3339) to fetch from. it takes precendence over the `seq_start` parameter - **interval** (integer) - Optional - number of messages to retrieve (to allow pagination). if the fetch is by seq_number, also negative interval are permitted - **subjects** (string) - Optional - filter messages by subject. concatenated into a single string divided with "," ### Request Body null ### Response #### Success Response (200) - **stream_message[]** (array) - An array of stream messages. See [STREAM-MESSAGE](./def/stream-message.md) for details. ``` -------------------------------- ### Import from CLI Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/connection/import.md Imports connections and CLI import data using a provided path. ```APIDOC ## POST /api/connection/import/nats-cli ### Description Imports connections and CLI import data from a specified path. ### Method POST ### Endpoint /api/connection/import/nats-cli ### Parameters #### Request Body - **path** (string) - Required - The path to the import file. ### Request Example ```json { "path": "string" } ``` ### Response #### Success Response (200) - **connections** (Connection[]) - A list of imported connections. - **imports** (CliImport[]) - A list of imported CLI import data. #### Response Example ```json { "connections": [ // Connection objects ], "imports": [ // CliImport objects ] } ``` ``` -------------------------------- ### Placement Configuration Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-config.md Defines placement constraints for stream replicas. ```APIDOC ## Placement ### Description Defines placement constraints for stream replicas. ### Properties - **cluster** (string) - The cluster name for placement (omitted if empty). - **tags** (string[]) - List of tags for placement (omitted if empty). ``` -------------------------------- ### CREATE KV Bucket Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/kv-bucket/create.md Creates a new KV bucket on a specified connection. ```APIDOC ## POST /api/connection/:connection_id/kv ### Description Creates a new KV Bucket. ### Method POST ### Endpoint /api/connection/:connection_id/kv ### Parameters #### Path Parameters - **connection_id** (uuid) - Required - uuid of connection to create the bucket on #### Request Body - **bucket_config** (BUCKET-CONFIG) - Required - Configuration for the bucket to be created. ### Response #### Success Response (200) - **stream_state** (BUCKET-STATE) - The state of the created bucket. ``` -------------------------------- ### Source Configuration Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-config.md Defines settings for a source stream that can be mirrored. ```APIDOC ## Source ### Description Defines settings for a source stream that can be mirrored. ### Properties - **name** (string) - The name of the source stream (omitted if empty). - **optStartSeq** (number) - Optional starting sequence number for the source (omitted if zero). - **optStartTime** (string) - Optional start time for the source (omitted if empty). - **filterSubject** (string) - Subject filter for the source (omitted if empty). - **subjectTransforms** (SubjectTransform[]) - List of subject transformations to apply (omitted if null). - **external** (object) - External stream configuration (omitted if null). - **api** (string) - API endpoint for the external stream. - **deliver** (string) - Delivery endpoint for the external stream. - **domain** (string) - Domain of the external stream (omitted if empty). ``` -------------------------------- ### Placement Configuration Object Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-config.md Specifies the desired placement for stream replicas within a NATS cluster. ```typescript Placement { cluster: string // omitted if empty tags: string[] // omitted if empty } ``` -------------------------------- ### ConsumerLimit Configuration Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-config.md Defines limits for consumers. ```APIDOC ## ConsumerLimit ### Description Defines limits for consumers. ### Properties - **inactiveThreshold** (string) - Time string indicating the inactivity threshold (omitted if zero). - **maxAckPending** (number) - Maximum number of pending acknowledgments (omitted if zero). ``` -------------------------------- ### Mirror Configuration Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-config.md Defines settings for mirroring messages from another stream. ```APIDOC ## Mirror ### Description Defines settings for mirroring messages from another stream. ### Properties - **name** (string) - The name of the stream to mirror (omitted if empty). - **optStartSeq** (number) - Optional starting sequence number for mirroring (omitted if zero). - **optStartTime** (string) - Optional start time for mirroring (omitted if empty). - **filterSubject** (string) - Subject filter for mirroring (omitted if empty). - **subjectTransforms** (SubjectTransform[]) - List of subject transformations to apply (omitted if null). - **external** (object) - External stream configuration (omitted if null). - **api** (string) - API endpoint for the external stream. - **deliver** (string) - Delivery endpoint for the external stream. - **domain** (string) - Domain of the external stream (omitted if empty). ``` -------------------------------- ### Import NATS CLI Connection Endpoint Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/connection/import.md Use this POST endpoint to import connections from the NATS CLI. The request body requires the path to the NATS configuration file. ```http POST /api/connection/import/nats-cli ``` -------------------------------- ### Create KV Bucket API URL Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/kv-bucket/create.md Use this POST endpoint to create a new KV bucket. Replace ':connection_id' with the actual connection UUID. ```http POST /api/connection/:connection_id/kv ``` -------------------------------- ### POST /api/connection/{connection_id}/stream/{stream_name}/consumer Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/consumer/create.md Creates a new consumer for a given stream. ```APIDOC ## POST /api/connection/{connection_id}/stream/{stream_name}/consumer ### Description Creates a new consumer for a given stream. ### Method POST ### Endpoint /api/connection/{connection_id}/stream/{stream_name}/consumer ### Parameters #### Path Parameters - **connection_id** (string) - Required - The ID of the connection. - **stream_name** (string) - Required - The name of the stream. #### Request Body - **Consumer configuration** (object) - Required - Consumer configuration (see NATS JetStream docs). ### Request Example ```json { "example": "consumer config" } ``` ### Response #### Success Response (200 OK) - **Consumer info** (object) - Consumer created successfully. #### Error Response - **422 Unprocessable Entity**: Validation error. ``` -------------------------------- ### POST /api/connection Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/connection/create.md Creates a new connection using the provided connection details. ```APIDOC ## POST /api/connection ### Description Creates a new connection. ### Method POST ### Endpoint /api/connection ### Request Body - **connection** (object) - Required - Connection details. ### Request Example ```json { "connection": "connection_details" } ``` ### Response #### Success Response (200) - **connection** (object) - Details of the created connection. #### Response Example ```json { "connection": "created_connection_details" } ``` ``` -------------------------------- ### Nui TLS Authentication Configuration Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/connection/def/connection.md Configures TLS authentication for Nui connections. Enable TLS and specify paths for certificates and keys. ```typescript TLSAuth { enabled: bool cert_path: string key_path: string ca_path: string handshake_first: bool } ``` -------------------------------- ### Source Configuration Object Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-config.md Defines a source stream from which data can be mirrored. Similar to Mirror but for outgoing replication. ```typescript Source { /** is taken from stream names */ name: string // omitted if empty optStartSeq: number // omitted if zero optStartTime: string // omitted if empty filterSubject: string // omitted if empty subjectTransforms: SubjectTransform[] // object, omitted if null external: { // omitted if null api: string deliver: string } domain: string // omitted if empty } ``` -------------------------------- ### Define Bucket Configuration Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/kv-bucket/def/bucket-config.md Defines the structure for configuring NATS buckets, specifying parameters like size, history, TTL, storage type, replication, and placement strategies. ```typescript BucketConfig { bucket: string // The name of the bucket description: string // The description of the bucket maxValueSize: number // The maximum size of a value in the bucket history: number // The max entries history of the bucket ttl: number // ttl in nanoseconds maxBytes: number // The maximum size of the bucket in bytes storage: STORAGE // The storage type of the bucket (Go type: StorageType) replicas: number // The number of replicas for the bucket placement: Placement // The placement strategy for the bucket (same as stream ) rePublish: Republish // The republish strategy for the bucket (same as stream) mirror: Mirror // The mirror source for the bucket (same as stream) sources: Source[] // The sources for the bucket (same as stream) compression: boolean // Whether the bucket is compressed or not metadata? {[key: string] : string} // hash of string -> string to add custom metadata to consumer } ``` -------------------------------- ### Resume Consumer Request Body Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/consumer/pause_resume.md Use this JSON body to resume a paused consumer. Specify the action as 'resume'. ```json { "action": "resume" } ``` -------------------------------- ### KV Bucket Configuration Body Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/kv-bucket/create.md The request body for creating a KV bucket should contain the 'bucket_config' object. ```typescript bucket_config ``` -------------------------------- ### StreamInfo Interface Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-info.md Provides details about the StreamInfo interface, including its configuration and optional state. It also explains the condition under which a stream is considered new. ```APIDOC ## StreamInfo Interface ### Description The `StreamInfo` interface encapsulates the configuration and state of a NATS stream. It is used to retrieve information about existing streams or to check the status of newly created ones. ### Structure ```typescript StreamInfo { config: StreamConfig state?: StreamState } ``` ### State Interpretation - If the `state` field is `null` or `undefined`, it indicates that the `STREAM-INFO` represents a newly created stream that has not yet established its state. ### Related Interfaces - `StreamConfig`: Defines the configuration parameters for a stream. - `StreamState`: Defines the runtime state of a stream. ``` -------------------------------- ### KV Bucket Creation Response Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/kv-bucket/create.md Upon successful creation, the API returns a 'stream_state' object indicating the bucket's status. ```typescript stream_state ``` -------------------------------- ### List KV Buckets for a Connection Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/kv-bucket/index.md Retrieves a list of all Key-Value (KV) buckets associated with a specific connection. ```APIDOC ## GET /api/connection/:connection_id/kv ### Description List of all the KV buckets for a connection. ### Method GET ### Endpoint /api/connection/:connection_id/kv ### Parameters #### Path Parameters - **connection_id** (uuid) - Required - uuid of the connection to get the KV buckets for ### Request Body `null` ### Response #### Success Response (200) - **bucket_state[]** (array) - An array of bucket states. Buckets come with config = null. ``` -------------------------------- ### Republish Configuration Object Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-config.md Defines settings for republishing messages. 'src', 'dest', and 'headersOnly' can be omitted based on their values. ```typescript Republish { src: string, // omitted if empty dest: string, // omitted if empty headersOnly: false // omitted if false } ``` -------------------------------- ### Nui Metrics Configuration Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/connection/def/connection.md Configures metrics collection for Nui connections. Supports HTTP and NATS sources for metrics. ```typescript Metrics { httpSource: { active: boolean url: string } natsSource: { active: boolean auth: Auth } } ``` -------------------------------- ### Create Connection API Endpoint Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/connection/create.md Use this endpoint to establish a new connection. Requires a connection object in the request body. ```http POST /api/connection ``` ```typescript connection ``` ```typescript connection ``` -------------------------------- ### Request Body for Importing NATS CLI Connection Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/connection/import.md Specify the 'path' to your NATS configuration file in the request body. ```typescript { path: string } ``` -------------------------------- ### Response Body for Importing NATS CLI Connection Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/connection/import.md The response includes a list of successfully imported 'connections' and 'imports' from the NATS CLI configuration. ```typescript { connections: Connection[] imports: CliImport[] } ``` -------------------------------- ### STORAGE Enum Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-config.md Enumeration for storage types. ```APIDOC ## STORAGE ### Description Enumeration for storage types. ### Values - **FILE**: Indicates file-based storage. - **MEMORY**: Indicates memory-based storage. ``` -------------------------------- ### Subscribe to WebSocket Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/ws/connection.md Endpoint to establish a WebSocket subscription for receiving NATS messages. ```APIDOC ## GET /ws/sub?id= ### Description Establishes a WebSocket connection to subscribe to NATS messages. Requires a connection ID. ### Method GET ### Endpoint /ws/sub ### Query Parameters - **id** (string) - Required - The unique identifier for the connection. ``` -------------------------------- ### Republish Configuration Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-config.md Defines settings for republishing messages from one stream to another. ```APIDOC ## Republish ### Description Defines settings for republishing messages. ### Properties - **src** (string) - Source subject for republishing (omitted if empty). - **dest** (string) - Destination subject for republishing (omitted if empty). - **headersOnly** (boolean) - If true, only headers are republished (omitted if false). ``` -------------------------------- ### Update Consumer Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/consumer/update.md Updates an existing consumer's configuration. ```APIDOC ## POST /api/connection/{connection_id}/stream/{stream_name}/consumer/{consumer_name} ### Description Updates an existing consumer's configuration. ### Method POST ### Endpoint `/api/connection/{connection_id}/stream/{stream_name}/consumer/{consumer_name}` ### Parameters #### Path Parameters - **connection_id** (string) - Required - The ID of the connection. - **stream_name** (string) - Required - The name of the stream. - **consumer_name** (string) - Required - The name of the consumer to update. ### Request Body - **consumer_config** (object) - Required - Consumer configuration (see NATS JetStream docs). ### Request Example ```typescript consumer_config ``` [CONSUMER-CONFIG](./def/consumer-config.md) ### Response #### Success Response (200) Consumer updated successfully (returns consumer info). #### Error Response - **422 Unprocessable Entity**: Validation error. ``` -------------------------------- ### ConsumerConfig Object Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/consumer/def/consumer-config.md Defines the configuration parameters for a NATS consumer, including basic information, delivery policies, acknowledgment policies, pull options, and advanced settings. ```APIDOC ## ConsumerConfig Object Definition ### Description Represents the configuration for a NATS consumer, specifying how messages should be delivered, acknowledged, and managed. ### Fields #### Basic Info - **name** (string) - Optional - The name of the consumer. Not editable. - **durableName** (string) - Optional - The name of the durable subscription. Not editable. - **description** (string) - Optional - A description for the consumer. Editable. - **replayPolicy** (ReplayPolicy) - Required - The policy for message replay. Not editable. #### Delivery Policy - **deliverPolicy** (DeliverPolicy) - Required - The policy for message delivery. Defaults to 'All'. Not editable. - **optStartSeq** (number) - Optional - The sequence number to start delivering messages from. Only applicable for 'by sequence' policy. Not editable. - **optStartTime** (any) - Optional - The time to start delivering messages from. Applicable for 'by time' policy. Format and behavior similar to stream time filter. Not editable. - **filterSubjects** (string[]) - Optional - An array of subjects to filter on for message delivery. Not editable. - **filterSubject** (string) - Optional - The subject to filter on for message delivery. Not editable. - **rateLimitBps** (number) - Optional - The rate limit in bytes per second for message delivery. Editable. Defaults to 0. #### Ack Policy - **ackPolicy** (AckPolicy) - Required - The policy for message acknowledgement. Not editable. - **ackWait** (number) - Optional - The time in nanoseconds to wait for message acknowledgement. Editable. Defaults to 0. - **maxDeliver** (number) - Optional - The maximum number of times a message will be delivered. - **maxWaiting** (number) - Optional - The maximum number of waiting messages. - **maxAckPending** (number) - Optional - The maximum number of unacknowledged messages. - **sampleFreq** (string) - Optional - The sampling frequency for metrics. Editable. Defaults to '0' (0 to 100). - **backoff** (number[]) - Optional - The backoff strategy for redelivery in nanoseconds. #### Pull Options - **maxBatch** (number) - Optional - The maximum batch size for message delivery. Editable. Defaults to 1. - **maxExpires** (number) - Optional - The maximum time duration in nanoseconds a message can exist. Editable. Defaults to 1. - **maxBytes** (number) - Optional - The maximum size of a message in bytes. Editable. Defaults to 1. #### Advanced - **inactiveThreshold** (number) - Optional - The threshold for marking a consumer as inactive. Editable. Defaults to 1. - **numReplicas** (number) - Required - The number of replicas for the consumer. Not editable. - **memStorage** (boolean) - Optional - Whether to use memory storage. Editable. Defaults to false. - **metadata** (object) - Optional - A hash of string to string for custom metadata. - **pauseUntil** (string) - Optional - The time until which the consumer is paused (ISO string format). Editable. Applicable for NATS 2.11+. ``` -------------------------------- ### BucketConfig Object Structure Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/kv-bucket/def/bucket-config.md Defines the structure of the BucketConfig object, which is used to configure buckets in NATS NUI. ```APIDOC ## BucketConfig ### Description Represents the configuration for a bucket in NATS NUI. ### Fields - **bucket** (string) - Required - The name of the bucket. - **description** (string) - Required - The description of the bucket. - **maxValueSize** (number) - Required - The maximum size of a value in the bucket. - **history** (number) - Required - The maximum number of entries in the bucket's history. - **ttl** (number) - Required - Time-to-live for entries in the bucket, in nanoseconds. - **maxBytes** (number) - Required - The maximum size of the bucket in bytes. - **storage** (STORAGE) - Required - The storage type of the bucket (Go type: StorageType). - **replicas** (number) - Required - The number of replicas for the bucket. - **placement** (Placement) - Required - The placement strategy for the bucket (same as stream). - **rePublish** (Republish) - Required - The republish strategy for the bucket (same as stream). - **mirror** (Mirror) - Required - The mirror source for the bucket (same as stream). - **sources** (Source[]) - Required - The sources for the bucket (same as stream). - **compression** (boolean) - Required - Whether the bucket is compressed or not. - **metadata** ({[key: string] : string}) - Optional - Custom metadata for the consumer (hash of string -> string). ``` -------------------------------- ### KV PUT API URL Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/kv-entry/put.md Use this URL to add or update a key-value pair in a specified bucket. Ensure the connection ID, bucket name, and key are correctly provided. ```http POST /api/connection/:connection_id/kv/:bucket/key/:key ``` -------------------------------- ### BucketState Structure Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/kv-bucket/def/bucket-state.md Defines the structure for representing the state of a bucket, including its name, size, history, and configuration. This is used to understand the current status of data storage within the NATS NUI. ```typescript BucketState { bucket: string // The name of the bucket values: number // The number of key-values in the bucket history: number // The max entries history of the bucket ttl: number // ttl in nanoseconds backing_store: STORAGE // The backing store of the bucket, same as stream storage bytes: number // The size of the bucket in bytes compressed: boolean // Whether the bucket is compressed or not config: BucketConfig } ``` -------------------------------- ### SequenceInfo Structure Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/consumer/def/stream-consumer.md Provides information about message sequences for a consumer. Useful for tracking delivery and acknowledgment progress. ```typescript SequenceInfo { consumer_seq: number stream_seq: number // Go type: time last_active ? : any } ``` -------------------------------- ### SequenceInfo Object Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/consumer/def/stream-consumer.md Provides information about the sequence of messages within a stream. ```APIDOC ## SequenceInfo Object ### Description Provides information about the sequence of messages within a stream. ### Fields - **consumer_seq** (number) - The sequence number for the consumer. - **stream_seq** (number) - The sequence number for the stream. - **last_active** (any) - Optional. The time of the last active event (Go type: time). ``` -------------------------------- ### Define CliImport Type Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/connection/def/nats-cli-import.md Defines the structure for importing CLI configurations, including connection details and potential errors. ```typescript CliImport { name: string path: string error: string importedContext: { [key: string]: any } } ``` -------------------------------- ### Pause and Resume Consumer Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/consumer/pause_resume.md Allows pausing or resuming a consumer for a given stream within a connection. ```APIDOC ## POST /api/connection/{connection_id}/stream/{stream_name}/consumer/{consumer_name}/pause_resume ### Description Pauses or resumes a consumer for a given stream. ### Method POST ### Endpoint `/api/connection/{connection_id}/stream/{stream_name}/consumer/{consumer_name}/pause_resume` ### Parameters #### Request Body - **action** (string) - Required - Either `pause` or `resume` - **pause_until** (string) - Required for `pause` action - RFC3339 timestamp until which the consumer will be paused ### Request Example ```json { "action": "pause", "pause_until": "2025-06-01T12:00:00Z" } ``` ```json { "action": "resume" } ``` ### Response #### Success Response (200) Consumer paused or resumed successfully (returns consumer info) #### Error Response - **422 Unprocessable Entity**: Validation error ``` -------------------------------- ### StreamInfo Interface Definition Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-info.md Defines the structure for StreamInfo, which includes configuration and optional state. If state is null, the StreamInfo is considered new. ```typescript StreamInfo { config: StreamConfig state?: StreamState } ``` -------------------------------- ### SubjectTransform Configuration Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-config.md Defines a transformation rule for subjects. ```APIDOC ## SubjectTransform ### Description Defines a transformation rule for subjects. ### Properties - **src** (string) - The source subject pattern. - **dest** (string) - The destination subject pattern. ``` -------------------------------- ### Nui Authentication Structure Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/connection/def/connection.md Manages authentication details for a Nui connection. Supports various authentication modes including token, username/password, NKEY, JWT, and credentials file. ```typescript Auth { mode: AUTH_MODE username?: string password?: string token?: string jwt?: string n_key_seed?: string creds?: string active: boolean } ``` -------------------------------- ### Publish Request URL Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/request_response/request_response.md Use this URL to send a request to a specific NATS connection. The connection ID must be provided. ```http POST /api/connection/:connection_id/request ``` -------------------------------- ### Pause Consumer Request Body Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/consumer/pause_resume.md Use this JSON body to pause a consumer. Specify the action as 'pause' and provide an RFC3339 timestamp for 'pause_until'. ```json { "action": "pause", "pause_until": "2025-06-01T12:00:00Z" } ``` -------------------------------- ### StreamConfig Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-config.md Defines the configuration for creating or editing a NATS stream. Many properties have default values if omitted. ```APIDOC ## StreamConfig ### Description This is the STREAM creation data. Some of them, but not all, can be modified in edit. If one of these data is omitted it assumes a default value. ### Properties - **name** (string) - Identifies the stream (not editable). - **description** (string) - Descriptive text for the stream (omitted if empty). - **subjects** (string[]) - The subjects available in the stream (omitted if empty). - **retention** (RETENTION) - The retention policy for the stream (not editable). - **max_consumers** (number) - Maximum number of consumers allowed (omitted if zero, not editable). - **max_msgs** (number) - Maximum number of messages allowed in the stream (omitted if zero). - **max_bytes** (number) - Maximum size in bytes allowed for the stream (omitted if zero). - **discard** (DISCARD) - Policy for discarding messages when limits are reached ('old' or 'new'). - **discardNewPerSubject** (boolean) - If true, discard new messages per subject when limits are reached (omitted if false). - **max_age** (number) - Maximum age of messages in the stream (omitted if zero). - **max_msgs_per_subject** (number) - Maximum number of messages per subject (omitted if zero). - **max_msg_size** (number) - Maximum size of a single message (omitted if zero). - **storage** (STORAGE) - Storage type for the stream (not editable). - **num_replicas** (number) - Number of replicas for the stream data (omitted if zero). - **no_ack** (boolean) - If true, disables acknowledgment (omitted if false). - **template_owner** (string) - Owner of the template if this stream is based on one (omitted if empty). - **duplicate_window** (number) - Window duration in seconds for duplicate detection (omitted if zero). - **placement** (Placement) - Placement configuration for the stream (omitted if null). - **mirror** (Mirror) - Mirror configuration for the stream (omitted if null, not editable). - **sources** (Source[]) - List of sources for mirroring stream data (omitted if empty). - **sealed** (boolean) - If true, the stream is sealed and cannot be modified (omitted if false, read only). - **deny_delete** (boolean) - If true, denies deletion of messages (omitted if false, not editable). - **deny_purge** (boolean) - If true, denies purging of the stream (omitted if false, not editable). - **allow_rollup_hdrs** (boolean) - If true, allows rollup headers (omitted if false). - **republish** (Republish) - Republish configuration for messages (omitted if null). - **allow_direct** (boolean) - If true, allows direct access to the stream (omitted if false). - **mirror_direct** (boolean) - If true, allows direct access to mirrored streams (omitted if false). - **metadata** (object) - Custom metadata as a hash of string key-value pairs. - **compression** (string) - Compression type for messages (omitted if null). - **firstSeq** (number) - The sequence number of the first message (omitted if zero). - **subjectTransform** (SubjectTransform) - Subject transformation configuration (omitted if null). - **consumerLimits** (ConsumerLimit) - Limits for consumers (omitted if null). - **subjectDeleteMarkerTtl** (number) - TTL for subject delete markers in seconds (omitted if zero). - **allowMsgTtl** (boolean) - If true, allows message TTL (omitted if false). ``` -------------------------------- ### ClusterInfo Object Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/consumer/def/stream-consumer.md Contains information about a NATS cluster. ```APIDOC ## ClusterInfo Object ### Description Contains information about a NATS cluster. ### Fields - **name** (string) - Optional. The name of the cluster. - **leader** (string) - Optional. The identifier of the cluster leader. ``` -------------------------------- ### Subscribe to Metrics WebSocket Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/ws/metrics.md This endpoint allows clients to subscribe to a stream of NATS server metrics. A connection ID is required to establish the stream. ```APIDOC ## GET /ws/metrics?id= ### Description Clients can subscribe to a stream of NATS server metrics by sending a GET request to this endpoint. The `id` query parameter specifies the connection ID for which metrics are requested. ### Method GET ### Endpoint /ws/metrics #### Query Parameters - **id** (string) - Required - The unique identifier for the connection to monitor. ``` -------------------------------- ### DISCARD Enum Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-config.md Enumeration for discard policies. ```APIDOC ## DISCARD ### Description Enumeration for discard policies. ### Values - **OLD**: Discard old messages when limits are reached. - **NEW**: Discard new messages when limits are reached. ``` -------------------------------- ### Nui Authentication Modes Enum Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/connection/def/connection.md Enumerates the different authentication modes supported by Nui. Select the appropriate mode based on your authentication strategy. ```typescript AUTH_MODE { // no other info to set NONE = "auth_none", // use token field TOKEN = "auth_token", // use username and password fields USER_PASSWORD = "auth_user_password", // use NKEY public key and seed NKEY = "auth_nkey", // use jwt and nkey fields JWT = "auth_jwt", // use a jwt token as bearer BEARER_JWT = "auth_jwt_bearer", // use creds field (local path to a file) CREDS_FILE = "auth_creds_file" } ``` -------------------------------- ### PUBLISH API Endpoint Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/request_response/request_response.md This endpoint allows publishing a request to a specified connection and subject, with an optional payload and timeout. ```APIDOC ## POST /api/connection/:connection_id/request ### Description Publishes a request to a NATS subject via a specific connection. ### Method POST ### Endpoint /api/connection/:connection_id/request ### Parameters #### Path Parameters - **connection_id** (string) - Required - The ID of the NATS connection. #### Request Body - **subject** (string) - Required - The NATS subject to publish the request to. - **payload** (string) - Required - The base64 encoded request payload. - **headers** (object) - Optional - Key-value pairs for request headers, where values are arrays of strings. - **timeout** (integer) - Optional - The timeout in nanoseconds for the request. ### Request Example ```json { "subject": "my.request.subject", "payload": "aGVsbG8gd29ybGQ=", "headers": { "X-Custom-Header": ["value1", "value2"] }, "timeout": 1000000000 } ``` ### Response #### Success Response (200) - **subject** (string) - The subject of the response. - **payload** (string) - The base64 encoded response payload. - **headers** (object) - Key-value pairs for response headers, where values are arrays of strings. #### Response Example ```json { "subject": "my.response.subject", "payload": "aGVsbG8gZnJvbSB0aGUgc2VydmVy", "headers": { "Content-Type": ["application/json"] } } ``` ``` -------------------------------- ### Define Nui Connection Structure Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/connection/def/connection.md Defines the structure for a Nui connection, managing underlying NATS server connections. Includes fields for ID, name, hosts, inbox prefix, subscriptions, authentication, TLS settings, metrics, and status. ```typescript Connection { id?: string name: string hosts: string[] inboxPrefix: string subscriptions: Subscription[] auth: Auth[] ls_auth: TLSAuth metrics: Metrics status?: CNN_STATUS } ``` -------------------------------- ### Add or Update Key-Value Pair Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/kv-entry/put.md This endpoint allows you to add a new key-value pair or update an existing one in a specified bucket within a NATS connection. ```APIDOC ## POST /api/connection/:connection_id/kv/:bucket/key/:key ### Description Adds or updates a key-value pair in a bucket by name. ### Method POST ### Endpoint /api/connection/:connection_id/kv/:bucket/key/:key ### Parameters #### Path Parameters - **connection_id** (uuid) - Required - The UUID of the connection to get the KV buckets for. - **bucket** (string) - Required - The name of the bucket to get the keys for. - **key** (string) - Required - The key to get the value for. #### Request Body - **payload** (string) - Required - The value to set, encoded in base64. - **ttl** (number) - Optional - The time-to-live in nanoseconds. ### Request Example ```json { "payload": "aGVsbG8gd29ybGQ=", "ttl": 1000000000 } ``` ### Response #### Success Response (200) - **kv-entry** (object) - Represents the KV entry that was added or updated. See [KV-ENTRY](./def/entry.md) for details. ``` -------------------------------- ### UPDATE Subscription Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/connection_messages/subscription update.md Updates the subscriptions for a given connection. ```APIDOC ## POST /api/connection/:connection_id/messages/subscription ### Description Updates the subscriptions for a given connection. ### Method POST ### Endpoint /api/connection/:connection_id/messages/subscription ### Parameters #### Path Parameters - **connection_id** (string) - Required - The ID of the connection to update subscriptions for. ### Request Body - **subscription[]** (array) - Required - An array of subscription objects. ### Response #### Success Response (200) - **subscription[]** (array) - An array of subscription objects representing the updated subscriptions. ``` -------------------------------- ### Define Subscription Object Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/connection_messages/def/subscription.md Defines the structure for a subscription, specifying the subject to subscribe to. ```typescript Subscription { subject: string } ``` -------------------------------- ### ClusterInfo Structure Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/consumer/def/stream-consumer.md Contains information about the NATS cluster. Use this to identify cluster name and leader. ```typescript ClusterInfo { name ? : string leader ? : string } ``` -------------------------------- ### NATS WebSocket Subscription Request Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/ws/connection.md Send an array of subjects the client wants to stream from. This is a client-to-server message. ```typescript { "type": "subscriptions_req", "subjects": string[] } ``` -------------------------------- ### Publish Request Body Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/request_response/request_response.md The request body should be a JSON object containing the subject, payload, headers, and timeout for the request. The payload must be base64 encoded. ```typescript { "subject": string, // request subject "payload": string, // base64 encoded request payload "headers": {[key: string] : string[]}, "timeout": int // timeout in ns } ``` -------------------------------- ### RETENTION Enum Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-config.md Enumeration for retention policies. ```APIDOC ## RETENTION ### Description Enumeration for retention policies. ### Values - **LIMIT**: Retention based on limits (e.g., max messages, max age). - **INTEREST**: Retention based on consumer interest. - **WORKQUEUE**: Retention for work queue streams. ``` -------------------------------- ### Check for Updates API Endpoint Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/about/about.md This endpoint is used to check for available updates for the NATS NUI. It returns the current version, the latest available version, and a flag indicating if an update is recommended. ```http GET /api/about ``` ```typescript { current_version: string; latest_version: string; should_update: string; } ``` -------------------------------- ### StreamConfig Object Definition Source: https://github.com/nats-nui/nui/blob/main/frontend/docs/entities/stream/def/stream-config.md Defines the main configuration for a NATS stream. Many properties have default values or are omitted if empty/zero. ```typescript StreamConfig { // --- main // identificativo dello stream name: string // not editable // testo descrittivo dello STREAM description: string // omitted if empty // i SUBJECTs disponibili nello stream subjects: string[] // omitted if empty // --- retention: RETENTION // not editable max_consumers: number // omitted if zero, not editable max_msgs: number // omitted if zero max_bytes: number // omitted if zero discard: DISCARD // "old" or "new" discardNewPerSubject: boolean // boolean, omitted if false max_age?: number // omitted if zero max_msgs_per_subject: number, // omitted if zero max_msg_size: number, // omitted if zero storage?: STORAGE // not editable num_replicas: number, // omitted if zero no_ack: boolean, // omitted if false template_owner: string, // omitted if empty duplicate_window: number, // omitted if zero placement: Placement // omitted if null mirror: Mirror // omitted if null, not editable sources: Source[] // omitted if empty sealed: boolean // omitted if false, read only deny_delete: boolean, // omitted if false, not editable deny_purge: boolean, // omitted if false, not editable allow_rollup_hdrs: boolean // omitted if false republish: Republish // omitted if null allow_direct: boolean // omitted if false mirror_direct: boolean // omitted if false metadata? {[key: string] : string} // hash of string -> string to add custom metadata to consumer compression: string // string, omitted if null firstSeq: number // integer, omitted if zero subjectTransform?: SubjectTransform // object, omitted if null consumerLimits: ConsumerLimit // object, omitted if null subjectDeleteMarkerTtl: number // integer, omitted if zero allowMsgTtl: boolean // boolean, omitted if false } ```