npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nexus-switchboard/nexus-mod-opslevel

v0.0.5

Published

Provides various opslevel integration functionality.

Downloads

7

Readme

Infra

The Infra module provides functionality that provides ways of interacting with the infra team through existing tools, maintaining documentation that infrastructure is respoonsible among other things.

Add "Submit Infra Request" to Message Actions**

A new action will appear in the actions menu named Submit Infra Request.

When clicked, a modal appears allowing the user to enter request details.

When the modal is submitted, a Jira Ticket is created and associated with the channel in which the message first appeared. It will also post a reply in the thread with information about the ticket submitted and action buttons that allow folks to cancel, claim and complete the ticket directly from Slack.

Implementation

The ServiceRequest class is where the bulk of the functionality lives. The interactions.ts file is where the interactions are received.

Associating Slack with Jira and vice versa

The most important thing to remember is that we use the channel and timestamp of the thread to associate slack actions with the created ticket. To do that, we submit the channel/ts combo as a label in Jira and use that to reference back to the original slack message and action areas.

Associating Slack Users with Jira Users

In order for the create, claim, cancel and complete actions to set the reporter and assignee properly based on the slack user who is performing the action, we assume that the email associated with the slack user is the same as the email associated with the jira user. If that is not the case, then user operations will not work.

Slack App Configuration

You will need the following configuration options set in the Slack App you create and point to your instance of the module:

  1. Intractive Components
    1. Enable
    2. Add Action: Callback ID is submit_infra_request
    3. Action Name: Whatever you want
    4. Request URL: https://<your_dmoain>/m/infra/slack/interactions
  2. OAuth & Permissions
    1. Scopes - See below for the scopes that you will need to add and request permission from users to apply
    2. Bot User - Add a bot and name it whatever you want
    3. Always Show My Bot Online - Set to "On" (but not required)

Slack App Permissions

The Slack App requires the following OAuth roles to function properly:

  • bot - Required for having a bot presence that can behave as a user and be mentioned and DM'd
  • channels:history - Required to pull message information from a channel
  • groups:history - Required to pull message information from a user's private chanel
  • im:history - Required to pull message information from the user's DMs
  • mpim:history - Required to pull message information from the users' multi-person DMs
  • users:read - Required to pull profile information needed to connect Jira with Slack
  • users:read.email - Required to pull user's email needed to connect Jira with Slack

Module Configuration

# This is the project that new requests will be added to
REQUEST_JIRA_PROJECT: "<JIRA_KEY>",   

# This is the issue type for the tickets created
REQUEST_JIRA_ISSUE_TYPE_ID: "<JIRA_ISSUE_TYPE_ID>",

# This is the epic under which the ticket will be created
REQUEST_JIRA_EPIC: "<JIRA_EPIC_PARENT_KEY>",

# This is the transition to use to set the status to some form of _In Progress_
REQUEST_JIRA_START_TRANSITION_ID: 21,

# This is the transition  to use to set the status to some form of _Done_ (note that cancel and complete use the same transition but the resolution is set to "Done" for complete and "Won't Do" for cancelled)
REQUEST_JIRA_COMPLETE_TRANSITION_ID: 31,

# Mapping priorities to Jira Priority IDs.  You can probably leave
#   these as is.
PRIORITIES: {
    emergency: "5",
    immediate: "5",
    high: "4",
    medium: "2",
    low: "3"
}

The following are connection-specific configuration options:

  • INFRA_SLACK_APP_ID: [string]
  • INFRA_SLACK_CLIENT_ID: [string]
  • INFRA_SLACK_CLIENT_SECRET: [string]
  • INFRA_SLACK_SIGNING_SECRET: [string]
  • INFRA_SLACK_CLIENT_OAUTH_TOKEN: xoxp-[string]
  • INFRA_SLACK_USER_OAUTH_TOKEN: xoxb-[string]*
  • INFRA_JIRA_HOST: [subdomain].atlassian.net
  • INFRA_JIRA_USERNAME: [email]
  • INFRA_JIRA_API_KEY: [user_api_key]

Note that the INFRA_ prefix is only necessary when stored as environment variables. See documentation on cnofiguration secrets in the main README.md

Sync OpsLevel Service Info with Confluence Page

This module creates a job that will periodically run and pull the data from an OpsLevel account and generate a Confluence page that lists all the services (and some basic information about it) in table form.

Module Configuration

  • CONF_SERVICE_LIST_PAGE_ID: "<confluence_page_id>" - This is the confluence page that will be updated.
  • CONF_SERVICE_UPDATE_FREQ: "<cron_schedule_string>" - This is the cron configuration string used to schedule the job.

These are connection-specific configuration options:

  • INFRA_OPSLEVEL_TOKEN=[string]
  • INFRA_OPSLEVEL_GQL_ENDPOINT=[url]
  • INFRA_CONFLUENCE_HOST=https://[subdomain].atlassian.net/wiki
  • INFRA_CONFLUENCE_USERNAME=[email]
  • INFRA_CONFLUENCE_API_KEY=[api_key]
  • INFRA_SENDGRID_API_KEY=[string]

Note that the INFRA_ prefix is only necessary when stored as environment variables. See documentation on cnofiguration secrets in the main README.md