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

magma-sdk

v1.1.2

Published

<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

Downloads

7

Readme

magma-sdk

Hi there, this is the Node.JS SDK for Magma.

Use cases:

  • Programmatic access to magma data
  • Automate your magma workflow
  • Anything you can imagine

Requirements

  • Paid team account on public, private or self-hosted Magma instance
  • Working installation of Node.JS version 18 or higher

Installation instructions

npm install magma-sdk

or

yarn add magma-sdk

Example application

const serverUrl = 'https://your-custom-deployment'; // leave undefined for default cloud server

// get token from /my/account/api
const apiToken = 'b4610f40-9a19-5421-b05e-6beb73bee04d';
const apiClient = new ApiClient({ serverUrl, apiToken });

const out = await apiClient.profile();
// out contains your profile information

License

All examples and public code are available under the MIT license.

Copyright (c) Magma

Classes

Class: ApiClient

Constructors

constructor

new ApiClient(options)

Parameters

| Name | Type | | :------ | :------ | | options | ApiClientOptions |

Properties

serverUrl

serverUrl: string

Methods

create

create(data): Promise<unknown>

Parameters

| Name | Type | | :------ | :------ | | data | CreateOptions |

Returns

Promise<unknown>


delete

delete(id): Promise<unknown>

Parameters

| Name | Type | | :------ | :------ | | id | string |

Returns

Promise<unknown>


download

download(id, type?): Promise<{ entity: EntityData ; stream: ReadableStream = response.body }>

Parameters

| Name | Type | Default value | | :------ | :------ | :------ | | id | string | undefined | | type | string | 'png' |

Returns

Promise<{ entity: EntityData ; stream: ReadableStream = response.body }>


get

get(id): Promise<EntityData>

Parameters

| Name | Type | | :------ | :------ | | id | string |

Returns

Promise<EntityData>


hierarchy

hierarchy(id): Promise<EntityData>

Parameters

| Name | Type | | :------ | :------ | | id | string |

Returns

Promise<EntityData>


list

list(__namedParameters): Promise<EntityData[]>

Parameters

| Name | Type | | :------ | :------ | | __namedParameters | ListOptions |

Returns

Promise<EntityData[]>


move

move(__namedParameters): Promise<{ failure: string[] ; sucess: string[] }>

Parameters

| Name | Type | | :------ | :------ | | __namedParameters | MoveOptions |

Returns

Promise<{ failure: string[] ; sucess: string[] }>


profile

profile(): Promise<UserData>

Returns

Promise<UserData>


teams

teams(): Promise<TeamTreeItem[]>

Returns

Promise<TeamTreeItem[]>


update

update(id, data): Promise<unknown>

Parameters

| Name | Type | | :------ | :------ | | id | string | | data | any |

Returns

Promise<unknown>


upload

upload(__namedParameters, stream): Promise<EntityData>

Parameters

| Name | Type | | :------ | :------ | | __namedParameters | UploadOptions | | stream | ArrayBuffer | Buffer | ReadableStream |

Returns

Promise<EntityData>


walkRecursively

walkRecursively(__namedParameters, callback): Promise<void>

Parameters

| Name | Type | | :------ | :------ | | __namedParameters | ListOptions | | callback | (context: WalkContext) => Promise<void> |

Returns

Promise<void>

Interfaces

Interface: ApiClientOptions

Properties

apiToken

apiToken: string


serverUrl

Optional serverUrl: string

Interface: CreateOptions

Properties

folder

Optional folder: string


name

Optional name: string


project

Optional project: string


type

type: string

Interface: EntityData

Properties

_id

_id: string


archived

Optional archived: boolean


author

Optional author: string | EntityAuthor


cacheId

Optional cacheId: string


children

Optional children: number


collaborators

Optional collaborators: Collaborator[]


createdAt

Optional createdAt: string | Date


depth

Optional depth: number


folder

Optional folder: string


folderHierarchy

Optional folderHierarchy: EntityData[]


hasPassword

Optional hasPassword: boolean


isHidden

Optional isHidden: boolean


modifiedAt

Optional modifiedAt: string | Date


name

name: string


openedAt

Optional openedAt: string | Date


participants

Optional participants: Participant[]


password

Optional password: string


privateId

Optional privateId: null | string | false


project

Optional project: string | ProjectLinkMetadata


shareType

Optional shareType: EntityShareTypes


shortId

shortId: string


status

Optional status: EntityStatus


team

Optional team: string


threads

Optional threads: Object

Type declaration

| Name | Type | | :------ | :------ | | unread | number | | unresolved | number |


type

type: EntityType


updatedAt

Optional updatedAt: string | Date


userRole

Optional userRole: UserRole

Interface: ListOptions

Properties

folder

Optional folder: string


project

Optional project: string

Interface: MoveOptions

Properties

entities

entities: string[]


folder

Optional folder: string


project

Optional project: string

Interface: TeamTreeItem

Properties

_id

_id: string


avatar

avatar: string


name

name: string


projects

projects: ProjectTreeItem[]


slug

slug: string

Interface: UploadOptions

Properties

filename

filename: string


folder

Optional folder: string


project

Optional project: string


team

Optional team: string


type

type: string

Interface: UserData

Properties

_id

_id: string


avatar

Optional avatar: string


color

Optional color: string


createdAt

Optional createdAt: string


email

Optional email: string


hideNewFeatureNotifications

Optional hideNewFeatureNotifications: boolean


intercomHash

Optional intercomHash: string


intercomPayload

Optional intercomPayload: string


isImpersonating

Optional isImpersonating: boolean


isSuperAdmin

Optional isSuperAdmin: boolean


lastActive

Optional lastActive: Date


lastNewFeature

Optional lastNewFeature: string


lastTeam

Optional lastTeam: string


muteAppNotifications

Optional muteAppNotifications: boolean


name

name: string


newFeature

Optional newFeature: string


newsletter

Optional newsletter: boolean


oauth

Optional oauth: string


plan

Optional plan: string


pro

Optional pro: boolean


settings

Optional settings: string


tawkHash

Optional tawkHash: string


unverifiedEmail

Optional unverifiedEmail: string


userType

userType: string


workRole

Optional workRole: string


workTags

Optional workTags: string[]

Interface: WalkContext

Properties

entity

entity: EntityData


tree

tree: WalkLocation[]

Interface: WalkLocation

Properties

entity

entity: EntityData