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

@teammaestro/node-document-service

v2.8.0

Published

A TypeScript node.js client that interfaces with the Maestro Document Service

Downloads

4

Readme

node-document-service

A TypeScript NodeJS client that interfaces with the Maestro Document Service

Getting Started

Run this to install the latest stable version.

npm i @teammaestro/node-document-service

Import @teammaestro/node-document-service and the client will be exported into your script from the latest build.

import { DocumentService } from 'node-document-service';

Documentation

Overview

new DocumentService(apiKey: string, options?: { host?: string, logging?: boolean | Function })

Parameters:

  • apiKey (string) - This is the API Key from your document managment service account
  • options.host (string | optional | default: https://dms.meetmaestro.com) - The domain that DMS is located at
  • options.logging (boolean or Function | optional ) - Use this to turn on logging or pass in your custom logger.

Request Example:

new DocumentService(apiKey: '123', {
    host: 'https://dev-dms.meetmaestro.com',
    logging: console.log
})

.catch()

Whenever the API makes a call and runs into a catch block, you will get an error block that looks consistently like this:

|Name|Type|Description| |---|---|---| |error|Error|The exception that was thrown| |status|number|The HTTP Status Code| |message|string|The HTTP error message (some are custom mapped)| |duration|number|How long the response took in miliseconds|

Response Example:

{
    error: Error
    status: 500,
    message: 'Internal Server Error',
    duration: 300
}

getPreSignedData({ filename: string, acl: string, expiration: number }) GET /api/v1/pre-sign

This endpoint is used for creating policies in order to upload content to your S3 bucket Note: You must send the payload to S3 in the order that we send them back.

You can append anything you want to the key property (including the file extension).

You can also update the Content-Type to the real mime-type.

Parameters

|Name|Type|Required|Description| |---|---|---|---| |filename|string | False (default: UUID)| Set this if you want to name the file.| |acl|string | False (default: private)| This is the permissions for the file. Options are private|public| |expiration|number | False (default: 1800) | This is expiration time for the signature in seconds|

Request Example:

dms.getPreSignedConfig({
    acl: 'public',
    filename: 'test.pdf',
    expiration: 120
})

Response Example:

{
    "url": "https://new-media-test-bucket.s3.amazonaws.com",
    "key": "a8231d87-c327-4cfc-a225-d1567de732ce",
    "Content-Type": "binary/octet-stream",
    "AWSAccessKeyId": "AKIAIF4CQIVFLH2VGVNA",
    "acl": "public-read",
    "policy": "eyJleHBpcmF0aW9uIjoiMjAxNy0wMi0xM1QwN...",
    "signature": "mmgVVFG6swkWvm3AmWZ9FB71R8s=",
    "expiration": "2017-04-06T14:49:16.267Z"
}

getSignedUrl(url: string, expiration: number) GET /api/v1/sign

This endpoint is used for signing your S3 private content

Parameters

|Name|Type|Required|Description| |---|---|---|---| |url|string|True| The url of the private S3 content you want to view| |expiration|number| False (default: 1800)| This is expiration time for the signature in seconds|

Request Example:

dms.getSignedUrl('https://new-media-test-bucket.s3.amazonaws.com/test.pdf', 2000)

Response Example:

{
  "url": "https://bucket.s3.amazonaws.com/73aff5ee-a986-4af...",
  "expiration": "2017-04-06T14:49:16.267Z"
}

register(options: DocumentServiceOptions.RegistrationData) [POST /api/v1/content] (https://dev-dms.meetmaestro.com/docs/development/index.html#api-Content-Registration)

This endpoint is used to register your content with the document service.

Parameters

|Name|Type|Required|Description| |---|---|---|---| |options.title|string|True| The title of the content| |options.path|string|True| The location of the content in S3| |options.fileFormat|MediaType|True| The format of the file |options.convertFormat|boolean|False| The format to convert the file to| |options.shouldGenerateThumbnail|boolean|False| If a thumbnail should be generated|

Request Example:

dms.register({
    title: 'Training Intro',
    path: 'https://new-media-test-bucket.s3.amazonaws.com/test.pdf',
    fileFormat: 'PDF',
    shouldGenerateThumbnail: true
})

Response Example:

{
  "identity": "ad9991a8-ab82-4521-befe-a8f2f956ce12"
}

view(options: DocumentServiceOptions.ViewOptions) [GET /api/v1/content/:identity/view] (https://dev-dms.meetmaestro.com/docs/development/index.html#api-Content-View)

This endpoint is used for generating the information you need to view the content

The payload will be a little dynamic based on the content type

Parameters

|Name|Type|Required|Description| |---|---|---|---| |options.identity|string|True| The identity that DMS will use for callbacks| |options.registrationId|string|False| The registrationId of the course in scorm engine|

Request Example:

dms.view({
    identity: 'ad9991a8-ab82-4521-befe-a8f2f956ce12'
})

Response Example:

{
  "url": "https://bucket.s3.amazonaws.com/73aff5ee-a986-4af...",
  "expiration": "2017-04-06T14:49:16.267Z",
  "downloadUrl": "https://bucket.s3.amazonaws.com/73aff5ee-a986-4af...",
  "fileFormat": "docx",
  "convertedContent": {
    "url": "https://bucket.s3.amazonaws.com/73aff5ee-a986-4af...",
    "expiration": "2017-04-06T14:49:16.267Z",
    "downloadUrl": "https://bucket.s3.amazonaws.com/73aff5ee-a986-4af...",
    "fileFormat": "pdf",
  }
}

Contributors

| :---: | John Pinkster|