This module wraps the Solace PubSub+ EP REST API. This can be used to enable the creation of integrations, plugins, and component on top of the Solace PubSub+ Event API.
Dont forget to give this repo a star! ✨
npm install @solace-community/eventportal
const EventPortal = require('@solace-community/eventportal')
const ep = new EventPortal()
// Optional: You can pass Solace Cloud Token as parameter if not defined as environment variable
const ep = new EventPortal(SOLACE_CLOUD_TOKEN)
Check out the create.js
script in the example directory for API usage.
Here is a video as well
Env Variable | Description |
---|---|
SOLACE_CLOUD_TOKEN | Solace Cloud Token with the right EP access |
createApplicationDomain(domain)
Creates an application domain given a domain object. An example of an application domain object :domain = {
name: "Application Domain name",
description: "Application Domain description",
uniqueTopicAddressEnforcementEnabled: true,
topicDomainEnforcementEnabled: false,
type: "ApplicationDomain"
}
- Application Domain ID
- If Application Domain name exists, matching Application Domain ID is returned
createSchemaObject(schema)
Creates an EP Schema Object in the Application Domain given a schema object definition. An example of a schema object :schema = {
applicationDomainId: domainID,
name: "Schema1",
shared: false,
contentType: "json",
schemaType: "jsonSchema"
}
- Schema Object ID
- If the Schema name exists, matching Schema Object ID is returned
createSchemaVersion(schemaVersion, overwrite)
Creates a Schema version given a schema version definition. An example of a schema version object :schemaVersion = {
schemaID: schemaID,
description: "This is the schema version description",
version: "0.0.1",
displayName: "This is the Display name of the schema",
content: JSON.stringify(schemaContent),
stateID: "1"
}
- Schema Object ID
- If the Schema version exists and overwrite is not set, an error is thrown
- The schema content is in string format
- Setting the overwrite flag to true will overwrite the schema if the State is
DRAFT
otherwise throws an error
createEventObject(event)
Creates an EP Event Object in the Application Domain given an event object definition. An example of a event object :event = {
applicationDomainId: domainID,
name: "Event Name",
shared: false
}
- Event Object ID
- If the Event name exists, matching Event Object ID is returned
createEventVersion(eventVersion, overwrite)
Creates an Event version given an event version definition. An example of an event version object :eventVersion = {
eventID: eventID,
displayName: "Scripted Version",
version: "0.0.1",
schemaVersionId: schemaVersionID,
deliveryDescriptor:{
brokerType: "solace",
address:{
addressLevels
},
stateID:"1"
}
}
- Event Object ID
- If the Event version exists and overwrite is not set, an error is thrown
- Setting the overwrite flag to true will overwrite the event if the State is
DRAFT
otherwise throws an error - the
addressLevels
parameter is an array with the following format
let addressLevels = [
{name: "level1", addressLevelType: "literal"},
{name: "level2", addressLevelType: "variable"},
{name: "level3", addressLevelType: "literal"},
{name: "level4", addressLevelType: "variable"},
]
createApplicationObject(application)
Creates an EP Application Object in the Application Domain given an application object definition. An example of a application object :application = {
applicationDomainId: domainID,
name: "My Scripted Application",
applicationType: "standard",
}
- Application Object ID
- If the Application name exists, matching Application Object ID is returned
createApplicationVersion(applicationVersion, overwrite)
Creates an Application version given an application version definition. An example of an application version object :applicationVersion = {
applicationID: applicationID,
displayName: "Display Name",
description: "This is the scripted description",
version: "0.0.1",
declaredProducedEventVersionIds:[eventVersionID],
type: "application"
}
- Application Object ID
- If the Application version exists and overwrite is not set, an error is thrown
declaredProducedEventVersionIds
is an array of produced eventsdeclaredConsumedEventVersionIds
is an array of consumed events- Setting the overwrite flag to true will overwrite the application if the State is
DRAFT
otherwise throws an error
getApplicationName(applicationID)
Returns the Application Name given ApplicationIDgetApplicationIDs(applicationName)
Return an array of matching applicatio name IDsgetEventName(eventID)
Returns the Event Name given EventIDgetEventIDs(eventName)
Returns an array of matching event name IDsgetSchemaName(schemaID)
Returns the Schema Name given SchemaIDgetSchemaIDs(schemaName)
Return an array of matching schema name IDsgetApplicationDomainID(domainName)
Returns the ApplicationDomainID given Application Domain NamegetSchemaVersionID(schemaID, schemaVersion)
Return the SchemaVersion ID given the schemaID and SchemaVersion stringgetApplicationVersionID(applicationID, applicationVersion)
Return the application version IDs given the applicationID and applicationVersiongetEventVersionID(eventID, eventVersion)
Return the event version IDs given the eventID and eventVersiongetSchemaVersionID(schemaID, schemaVersion)
Return the schema version IDs given the schemaID and schemaVersiongetApplicationState(applicationID, applicationVersion)
Returns the Application State given the application ID and application version. The current states are - DRAFT - RELEASED - DEPRECATED - RETIREDgetEventState(eventID, eventVersion)
Returns the Event State given the event ID and event version. The current states are - DRAFT - RELEASED - DEPRECATED - RETIREDgetSchemaState(schemaID, schemaVersion)
Returns the Schema State given the schema ID and schema version. The current states are - DRAFT - RELEASED - DEPRECATED - RETIRED- Add Jest unit tests
- Add Enum support