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

outpost-sdk

v1.0.3

Published

๐Ÿ“จ ๐Ÿš€ The official JavaScript client SDK for the Outpost Protocol.

Downloads

10

Readme

outpost-sdk

๐Ÿ“จ ๐Ÿš€ The official JavaScript client SDK for the Outpost Protocol.

Install

npm install outpost-sdk

OR

yarn add outpost-sdk

Usage

Import into your project

const { createClient } = require('outpost-sdk')

Or with es6

import { createClient } from 'outpost-sdk'

Methods

createClient

Create an outpost client. Returns the methods available in the SDK.

const createClient = (options: createClientParams = defaultOptions): createClientResult

The result:

type createClientResult = {
  readonly getAllCommunities: () => Promise<readonly Community[]>;
  readonly getPosts: (params: getPostsParams) => Promise<getPostsResult>;
  readonly getChallenge: (
    params: getChallengeParams
  ) => Promise<getChallengeResult>;
  readonly getAuthToken: (
    params: getAuthTokenParams
  ) => Promise<getAuthTokenResult>;
  readonly getPostPreview: (
    params: getPostPreviewParams
  ) => Promise<getPostPreviewResult>;
  readonly uploadImage: (
    params: uploadImageParams
  ) => Promise<uploadImageResult>;
  readonly uploadPost: (params: uploadPostParams) => Promise<uploadPostResult>;
  readonly uploadComment: (
    params: uploadCommentParams
  ) => Promise<uploadCommentResult>;
  readonly getPost: (params: getPostParams) => Promise<getPostResult>;
};

getChallenge

Get a challenge from the outpost server so that it can verify a user owns their Ethereum address. Returns a string that the user must sign and send back to the server in getAuthToken.

getChallenge: (params: getChallengeParams) => Promise<getChallengeResult>

type getChallengeParams = { readonly address: string; };

type getChallengeResult = string;

getAuthToken

Get an authentication token to be able to access authenticated routes. Returns the users authentication token.

getAuthToken: (params: getAuthTokenParams) => Promise<getAuthTokenResult>;

type getAuthTokenParams = {
  readonly address: string;
  readonly signature: string;
};

type getAuthTokenResult = string;

getPosts

List all the posts of a specified community. Returns an array of posts.

getPosts: (params: getPostsParams) => Promise<getPostsResult>;

type getPostsParams = { readonly slug: string; };

type getPostsResult = readonly Post[];

type Post = {
  readonly id: string;
  readonly title: string;
  readonly subtitle: string;
  readonly timestamp: number;
  readonly txId: string;
  readonly featuredImg: string;
};

getPostPreview

Get the preview for a post.

getPostPreview: (params: getPostPreviewParams) => Promise<getPostPreviewResult>;

export type getPostPreviewParams = { readonly txId: string; };

type getPostPreviewResult = {
  readonly id: string;
  readonly title: string;
  readonly subtitle: string;
  readonly timestamp: number;
  readonly txId: string;
  readonly featuredImg: string | null;
  readonly canonicalLink: string;
};

uploadImage

Upload a base64 representation of an image file to arweave. Returns the transaction id of the upload.

uploadImage: (params: uploadImageParams) => Promise<uploadImageResult>;

type uploadImageParams = {
  readonly base64: string;
  readonly authToken: string;
};
type uploadImageResult = {
  readonly txId: string;
  readonly gateway: string;
};

Now you can view the image at

`https://${gateway}/${txId}`

Note: The gateway returned is the host of the gateway the image was uploaded to (i.e. 'arweave.net'). Transactions take about 2 minutes to be included in a block but Arweave's gateways ('arweave.net' and 'arweave.dev') optimistically store the transaction so it can be served immediately.

uploadPost

Upload a post to arweave.

uploadPost: (params: uploadPostParams) => Promise<uploadPostResult>;

type uploadPostParams = {
  readonly authToken: string;
  readonly communityTxId: string;
  readonly postUpload: {
    readonly canonicalLink: string;
    readonly postText: string;
    readonly subtitle: string;
    readonly timestamp: number;
    readonly title: string;
  };
};
type uploadPostResult = {
  readonly txId: string;
  readonly title: string;
  readonly postText: string;
  readonly subtitle: string;
  readonly timestamp: number;
  readonly canonicalLink: string;
  readonly community: {
    readonly name: string;
  };
  readonly user: {
    readonly address: string;
  };
};

getPost

Get a post.

uploadPost: (params: uploadPostParams) => Promise<uploadPostResult>;

type getPostParams = {
  readonly txId: string;
  readonly authToken: string;
};

getAllCommunities

Get all the publications (a.k.a. communities).

getAllCommunities: () => Promise<readonly Community[]>;