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

@wral/sdk-dam

v1.1.4

Published

A Software Development Kit for working with the Digital Asset Manager (DAM)

Downloads

2

Readme

dam-sdk

The dam-sdk is a JavaScript SDK (Software Development Kit) designed to interact with a Digital Asset Management (DAM) API. This SDK provides a set of functions to simplify common operations related to managing digital assets such as uploading files, fetching asset details, updating metadata, and searching assets.

Installation

You can install the dam-sdk package via npm:

npm install dam-sdk

Usage

To use the dam-sdk, you first need to import it into your JavaScript or TypeScript project:

import { createClient } from '@wral/dam-sdk/v1';
// Or import everything:
// import * as v1 from '@wral/dam-sdk/v1';

Alternatively, you can import the whole sdk and use multiple versions:

import dam from '@wral/dam-sdk';
// Then use it with dam.v1.createClient(), etc.

Then, you can create a client instance with your configuration:

const config = {
  apiKey: 'YOUR_API_KEY',
  baseUrl: 'YOUR_BASE_URL', // Base URL of your DAM API (without version)
};

const client = createClient(config);

After creating the client instance, you can use its methods to interact with the DAM API. Here are some examples:

// Fetch asset details by ID
const assetDetails = await client.getAssetById({ id: 'ASSET_ID' });

// Delete asset by ID
await client.deleteAssetById({ id: 'ASSET_ID' });

// Generate upload URL for an asset
const uploadUrl = await client.generateUploadUrl({ id: 'ASSET_ID', metadata: { /* Metadata object */ } });

// Upload an asset
const uploadResult = await client.uploadAsset({ id: 'ASSET_ID', data: 'FILE_DATA', metadata: { /* Metadata object */ } });

// Fetch asset metadata by ID
const metadata = await client.getAssetMetadata({ id: 'ASSET_ID' });

// Replace asset metadata
await client.replaceAssetMetadata({ id: 'ASSET_ID', metadata: { /* Updated metadata object */ } });

// Update asset metadata with a patch
await client.updateAssetMetadata({ id: 'ASSET_ID', metadata: { /* Metadata patch object */ } });

// Search assets
const searchResults = await client.search({ query: 'SEARCH_QUERY' });

API

createClient(config)

Creates a new client instance with the provided configuration.

  • config: An object containing API configuration parameters:
    • apiKey: The API key for authentication.
    • baseUrl: The base URL of the DAM API.

Returns a client instance with methods for interacting with the DAM API.

Methods

  • getAssetById({ id }): Fetches asset details by ID.
  • deleteAssetById({ id }): Deletes an asset by ID.
  • generateUploadUrl({ id, metadata }): Generates an upload URL for an asset.
  • uploadAsset({ id, data, metadata }): Uploads an asset.
  • getAssetMetadata({ id }): Fetches asset metadata by ID.
  • replaceAssetMetadata({ id, metadata }): Replaces asset metadata.
  • updateAssetMetadata({ id, metadata }): Updates asset metadata with a patch.
  • search({ query }): Searches for assets based on a query.