Socket
Socket
Sign inDemoInstall

@solace-community/eventportal

Package Overview
Dependencies
Maintainers
3
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solace-community/eventportal

This is a wrapper to Solace PubSub+ Event Portal REST API


Version published
Weekly downloads
3
Maintainers
3
Weekly downloads
 
Created
Source

Solace Pubsub+ Event Portal REST API Wrapper

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! ✨

Installation

npm install @solace-community/eventportal

Constructor

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)

How to use

Check out the create.js script in the example directory for API usage.

Here is a video as well

PubSub+ Event Portal API Wrapper Demo Video

Environment Variables

Env VariableDescription
SOLACE_CLOUD_TOKENSolace Cloud Token with the right EP access

Methods

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"
}

Returns

  • Application Domain ID

Notes

  • 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"
}

Returns

  • Schema Object ID

Notes

  • 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"
}

Returns

  • Schema Object ID

Notes

  • 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
}

Returns

  • Event Object ID

Notes

  • 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"
  }
}

Returns

  • Event Object ID

Notes

  • 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",
}

Returns

  • Application Object ID

Notes

  • 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"
}

Returns

  • Application Object ID

Notes

  • If the Application version exists and overwrite is not set, an error is thrown
  • declaredProducedEventVersionIds is an array of produced events
  • declaredConsumedEventVersionIds 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 ApplicationID
getApplicationIDs(applicationName) Return an array of matching applicatio name IDs
getEventName(eventID) Returns the Event Name given EventID
getEventIDs(eventName) Returns an array of matching event name IDs
getSchemaName(schemaID) Returns the Schema Name given SchemaID
getSchemaIDs(schemaName) Return an array of matching schema name IDs
getApplicationDomainID(domainName) Returns the ApplicationDomainID given Application Domain Name
getSchemaVersionID(schemaID, schemaVersion) Return the SchemaVersion ID given the schemaID and SchemaVersion string
getApplicationVersionID(applicationID, applicationVersion) Return the application version IDs given the applicationID and applicationVersion
getEventVersionID(eventID, eventVersion) Return the event version IDs given the eventID and eventVersion
getSchemaVersionID(schemaID, schemaVersion) Return the schema version IDs given the schemaID and schemaVersion
getApplicationState(applicationID, applicationVersion) Returns the Application State given the application ID and application version. The current states are - DRAFT - RELEASED - DEPRECATED - RETIRED
getEventState(eventID, eventVersion) Returns the Event State given the event ID and event version. The current states are - DRAFT - RELEASED - DEPRECATED - RETIRED
getSchemaState(schemaID, schemaVersion) Returns the Schema State given the schema ID and schema version. The current states are - DRAFT - RELEASED - DEPRECATED - RETIRED

To-Do

  • Add Jest unit tests
  • Add Enum support

FAQs

Package last updated on 11 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc