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

@appteum/appteum-js

v1.0.9

Published

A thin workspace client for Appteum.

Downloads

8

Readme

@appteum-js

A Typescript client for Appteum.

  • Documentation: https://docs.appteum.com/

Installing

Install as package

You can install @appteun/appteum-js via the terminal.

npm install @appteum/appteum-js

Initializing

You can initialize a new Appteum client using the AppteumWorkspaceClient() class.

The Appteum client is your entrypoint to the rest of the Appteum functionality and is the easiest way to interact with everything we offer within the Appteum platform.

import { AppteumWorkspaceClient } from "@appteum/appteum-js";

WorkspaceClient Parameters

API Key

Use API Key scoped clients to call Auth and Object services.

:warning: API Key scoped clients use the Anonymous User by default: You should treat the Anonymous User with caution, limiting access to data you are willing to expose publicly.

import { AppteumWorkspaceClient } from "@appteum/appteum-js";

const apiKeyScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
});

API Key & ID Token

Use API Key and Token scoped clients to call object services.

import { AppteumWorkspaceClient } from "@appteum/appteum-js";

const apiKeyIdAccessTokenScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
  idToken: "<JWT_ID_TOKEN>",
});

API Key & ID / ACCESS Token

Use API Key, id Token and access Token scoped clients to change workspace users password.

import { AppteumWorkspaceClient } from "@appteum/appteum-js";

const apiKeyIdAccessTokenScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
  idToken: "<JWT_ID_TOKEN>",
  accessToken: "<JWT_ACCESS_TOKEN>",
});

Auth

Sign-Up

To create a user, you need to provide the profileId of one of the profiles that exists in your workspace.

import { AppteumWorkspaceClient } from "@appteum/appteum-js";
import { ServiceResponse } from "@appteum/appteum-js/api";
const apiKeyScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
});

const signUp: ServiceResponse = await apiKeyScopedClient.auth.signUp({
  email: "",
  password: "",
  profileId: "", // -> can be retrieved from appteum administration panel
});

Confirm Sign-Up

Once you sign-up a user they will receive an email with a confirmation code in order to verify their email address before logging in.

import { AppteumWorkspaceClient } from "@appteum/appteum-js";
import { ActionResponse } from "@appteum/appteum-js/api";
const apiKeyScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
});

const confirmSignUp: ActionResponse =
  await apiKeyScopedClient.auth.confirmSignUp({
    email: "",
    confirmationCode: "", //-> sent to workspace users email on sign up
  });

Resend Confirmation Code

import { AppteumWorkspaceClient } from "@appteum/appteum-js";
import { ActionResponse } from "@appteum/appteum-js/api";
const apiKeyScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
});

const resendCode: ActionResponse =
  await apiKeyScopedClient.auth.resendConfirmationCode({
    email: "",
  });

Sign-In

Log in an existing user with an email and password.

import { AppteumWorkspaceClient } from "@appteum/appteum-js";
import { SignInResponse } from "@appteum/appteum-js/api";
const apiKeyScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
});

const signIn: SignInResponse = await apiKeyScopedClient.auth.signIn({
  email: "",
  password: "",
});

Temporary Password Sign-In

Valid only for workspace users invited from the appteum admin panel and have received temporary password in their emails.

import { AppteumWorkspaceClient } from "@appteum/appteum-js";
import { SignInResponse } from "@appteum/appteum-js/api";
const apiKeyScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
});

const signIn: SignInResponse =
  await apiKeyScopedClient.auth.temporaryPasswordSignIn({
    email: "",
    temporaryPassword: "", // ->  sent to workspace users email on workspace user invitation from appteums admin panel
    password: "",
  });

Forgot Password Request

import { AppteumWorkspaceClient } from "@appteum/appteum-js";
import { ActionResponse } from "@appteum/appteum-js/api";
const apiKeyScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
});

const forgotPassword: ActionResponse =
  await apiKeyScopedClient.auth.forgotPassword({
    email: "",
  });

Confirm Forgot Password Request

import { AppteumWorkspaceClient } from "@appteum/appteum-js";
import { ActionResponse } from "@appteum/appteum-js/api";
const apiKeyScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
});

const confirmForgotPassword: ActionResponse =
  await apiKeyScopedClient.auth.confirmForgotPassword({
    password: "",
    confirmationCode: "", // ->  sent to workspace users email on Forgot Password Request
    email: "",
  });

Refresh JWT Token

import { AppteumWorkspaceClient } from "@appteum/appteum-js";
import { RefreshTokenResponse } from "@appteum/appteum-js/api";
const apiKeyScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
});

const refreshJWtToken: RefreshTokenResponse =
  await apiKeyScopedClient.auth.refreshToken({
    refreshToken: signIn.auth.refreshToken,
  });

Change User Password

import { AppteumWorkspaceClient } from "@appteum/appteum-js";
import { ActionResponse } from "@appteum/appteum-js/api";
const apiKeyTokenScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
  idToken: `Bearer <JWT_ID_TOKEN>`,
  accessToken: "<JWT_ACCESS_TOKEN>",
});
const changeUserPassword: ActionResponse =
  await apiKeyTokenScopedClient.auth.changePassword({
    previousPassword: "",
    newPassword: "",
  });

Objects

:point_right: Object services can be used with API Key scoped or API Key and Token scoped clients.

Query Data

Perform a query on the object or relations.

  • By default, Appteum returns a maximum of 100 rows. You can use the "objects.dataCursor" method to paginate through your data.
  • For the query syntax check the docs https://docs.appteum.com/
import { AppteumWorkspaceClient } from "@appteum/appteum-js";
import { CursorResponse } from "@appteum/appteum-js/api";
const apiKeyTokenScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
  idToken: `Bearer <JWT_ID_TOKEN>`, // -> remove to use with anonymous user
});

const dataQueryResult: CursorResponse =
  await apiKeyTokenScopedClient.objects.data({
    q: "select first_name, last_name from users",
  });

Query Data Cursor

Use the DataCursor to paginate through your object data.

import { AppteumWorkspaceClient } from "@appteum/appteum-js";
import { CursorResponse } from "@appteum/appteum-js/api";
const apiKeyTokenScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
  idToken: `Bearer <JWT_ID_TOKEN>`, // -> remove to use with anonymous user
});
const dataQueryResult: CursorResponse =
  await apiKeyTokenScopedClient.objects.data({
    q: "select first_name, last_name from users",
  });

const objectBatchData: CursorResponse =
  await apiKeyTokenScopedClient.objects.dataCursor(
    dataQuery.cursor.nextDataCursor,
    { xQueryBatchSize: "100" }
  );

Create Data

:point_right: Can be used to create single or multiple records. Max number of records per request is 200.

  • name is a mandatory field for all objects.
import { AppteumWorkspaceClient } from "@appteum/appteum-js";
import { ServiceResponse } from "@appteum/appteum-js/api";
const apiKeyTokenScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
  idToken: `Bearer <JWT_ID_TOKEN>`, // -> remove to use with anonymous user
});

const createObjectDataRecord: ServiceResponse =
  await apiKeyTokenScopedClient.objects.create("users", {
    dataRecords: [
      // -> max array size 200
      {
        name: "John Doe", // -> mandatory field for all objects
        first_name: "John",
        last_name: "Doe",
      },
      {
        name: "John Smith", // -> mandatory field for all objects
        first_name: "John",
        last_name: "Smith",
      },
    ],
  });

Delete Data

import { AppteumWorkspaceClient } from "@appteum/appteum-js";
import { ServiceResponse } from "@appteum/appteum-js/api";
const apiKeyTokenScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
  idToken: `Bearer <JWT_ID_TOKEN>`, // -> remove to use with anonymous user
});

const deleteObjectDataRecord: ServiceResponse =
  await apiKeyTokenScopedClient.objects.delete(
    "<OBJECT_NAME>",
    "<OBJECT_DATA_RECORD_ID>"
  );

Update Data

import { AppteumWorkspaceClient } from "@appteum/appteum-js";
import { ServiceResponse } from "@appteum/appteum-js/api";
const apiKeyTokenScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
  idToken: `Bearer <JWT_ID_TOKEN>`, // -> remove to use with anonymous user
});

const updateRecordRequest: UpdateRecordRequest = {
  rowVersion: "<RECORD_ROW_VERSION>",
  dataRecord: {
    first_name: "", //-> record property to update
  },
};

const updateObjectDataRecord: ServiceResponse =
  await apiKeyTokenScopedClient.objects.update(
    "<OBJECT_NAME>",
    "<RECORD_ID>",
    updateRecordRequest
  );

Describe Object

import { AppteumWorkspaceClient } from "@appteum/appteum-js";
import { ObjectDescribeResponse } from "@appteum/appteum-js/api";
const apiKeyIdAccessTokenScopedClient = new AppteumWorkspaceClient({
  apiKey: "<API_KEY>",
  idToken: `Bearer <JWT_ID_TOKEN>`, // -> remove to use with anonymous user
});

const objectDescribeResponse: ObjectDescribeResponse =
  await apiKeyTokenScopedClient.objects.describe("<OBJECT_NAME>");