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

@iflb/tutti-client

v0.3.10

Published

## Installation

Downloads

5

Readme

Tutti JavaScript Client API

Installation

Node.js:

npm install @iflb/tutti-client

Usage

There are two ways to communicate with Tutti server: Call mode and Send mode.

Call mode

Calling commands with await prefix, the process waits there until the response is sent back, and receives it as a return value.

Directions

const data = await client.<namespace>.<command>({ <args object> }, awaited = true);

OR equivalently,

const data = await client.<namespace>.<command>.call(<args object>);

Send mode

Calling commands without await prefix, the process completes as soon as request is sent, and receives it in its listener.

Directions

Having defined a listener like below,

client.<namespace>.on('<command>', {
    success: (data) => {
        // do something for successful response...
    },
    error: (err) => {
        // do something for errors...
    },
    complete: () => {
        // do another thing to finalize request...
    }
});

Run:

client.<namespace>.<command>({ <args object> }, awaited = false);

OR equivalently,

client.<namespace>.<command>.send(<args object>);

Code Examples

Node.js:

const { TuttiClient } = require('@iflb/tutti-client');

async function main() {
    let client = new TuttiClient(true);
    await client.open('http://localhost:8080/ducts/wsd');

    // Sign in with an account first
    await client.resource.signIn({ user_name: 'admin', password: 'admin' })
    // Get a list of created projects
    const projects = await client.resource.listProjects();
    // List templates for the first project
    const templates = await client.resource.listTemplates({ project_name: projects[0].name });
}

main();

Browser:

<script src="https://unpkg.com/@iflb/tutti-client/dist/tutti.js"></script>
<script>
async function main() {
    const client = new tutti.TuttiClient(true);
    await client.open('http://localhost:8080/ducts/wsd');

    // Sign in with an account first
    await client.resource.signIn({ user_name: 'admin', password: 'admin' })
    // Get a list of created projects
    const projects = await client.resource.listProjects();
    // List templates for the first project
    const templates = await client.resource.listTemplates({ project_name: projects[0].name });
}
main();
</script>

Commands

Current options for namespaces are: resource, mturk.

TuttiClient.resource


checkProjectDiff

  • project_name: String
    • Tutti project name.
  • Boolean -- True if the project is in the newest version, thus no rebuild is needed.

createNanotaskGroup

  • name: String
    • Name for the nanotask group. Must be unique.
  • nanotask_ids: Array
  • project_name: String
    • Tutti project name.
  • template_name: String
    • Tutti template name of a project.
  • String -- Created nanotask group ID.

createNanotasks

  • project_name: String
    • Tutti project name.
  • template_name: String
    • Tutti template name of a project.
  • nanotasks: Array
  • tag: String
    • An arbitrary data field to tag nanotask for identifying purposes.
  • priority: Number
    • An integer value to represent nanotask importance. The smaller the value is, more prioritized the nanotask is among others. To learn more about nanotask priority, see Tutti's Programming Reference > Project Scheme.
  • num_assignable: Number
    • Maximum number of workers that can be assigned to nanotask.
  • Object
    • project_name: String
      • Tutti project name.
    • template_name: String
      • Tutti template name of a project.
    • nanotask_ids: Array

createProject

  • project_name: String
    • Tutti project name.

createTemplate

  • project_name: String
    • Tutti project name.
  • template_name: String
    • Tutti template name of a project.
  • preset_group_name: String
  • preset_name: String

deleteAccount

  • user_id: String
    • User ID of Tutti account.

deleteNanotaskGroup

  • nanotask_group_id: String

deleteNanotasks

  • nanotask_ids: Array

deleteProject

  • project_name: String
    • Tutti project name.

deleteTemplate

  • project_name: String
    • Tutti project name.
  • template_name: String
    • Tutti template name of a project.

getNanotaskGroup

  • nanotask_group_id: String

getProjectScheme

  • project_name: String
    • Tutti project name.
  • cached: Boolean
    • Whether to return cached value in the response. Note that setting this value to false may result in slower responses.

getUserIds

  • [None]

getWebServiceDescriptor

  • [None]

listNanotaskGroups

  • project_name: String
    • Tutti project name.
  • template_name: String
    • Tutti template name of a project.

listNanotasks

  • project_name: String
    • Tutti project name.
  • template_name: String
    • Tutti template name of a project.

listNanotasksWithResponses

  • project_name: String
    • Tutti project name.
  • template_name: String
    • Tutti template name of a project.

listNodeSessionsForWorkSession

  • work_session_id: String
  • only_template: Boolean
    • If True, returns only node sessions for template nodes.

listProjects

  • [None]

listProjectsWithResponses

  • [None]

listResponsesForNanotask

  • nanotask_id: String

listResponsesForProject

  • project_name: String
    • Tutti project name.

listResponsesForTemplate

  • project_name: String
    • Tutti project name.
  • template_name: String
    • Tutti template name of a project.

listResponsesForWorkSession

  • work_session_id: String

listResponsesForWorker

  • worker_id: String
    • Tutti's internal hash ID for worker.

listTemplatePresets

  • project_name: String
    • Tutti project name.

listTemplates

  • project_name: String
    • Tutti project name.

listTemplatesWithResponses

  • project_name: String
    • Tutti project name.

listWorkSessionsWithResponses

  • project_name: String
    • Tutti project name.

listWorkersForProject

  • project_name: String
    • Tutti project name.

listWorkersWithResponses

  • project_name: String
    • Tutti project name.

rebuildProject

  • project_name: String
    • Tutti project name.

signIn

  • user_name: String, default null
    • User name of Tutti account.
  • password_hash: String, default null
    • MD5-hashed password (hex-digested) of Tutti account.
  • access_token: String, default null
    • Valid access token obtained in previous logins.
  • ...args:
    • Accepts only password key (non-hashed password of Tutti account). This is not recommended; use password_hash or access_token instead.

signOut

  • [None]

signUp

  • user_name: String
    • User name of Tutti account.
  • password:
  • privilege_ids: Array
    • Priviledge IDs to associate with account. Currently not in use.

TuttiClient.mturk


addCredentials

  • access_key_id: String
    • Access Key ID of MTurk credentials.
  • secret_access_key: String
    • Secret Access Key of MTurk credentials.
  • label:

addHITsToTuttiHITBatch

  • batch_id: String
    • Tutti's internal hash ID for Tutti HIT Batch.
  • hit_params: Object
    • Parameters for CreateHIT operation of MTurk.
  • num_hits: Number
    • Number of HITs to create for Tutti HIT Batch.

approveAssignments

  • assignment_ids: Array
    • List of MTurk Assignment IDs.
  • requester_feedback:
  • override_rejection:

associateQualificationsWithWorkers

  • qualification_type_id:
  • worker_ids: Array
    • List of MTurk Worker IDs.
  • integer_value:
  • send_notification:

createQualificationType

  • name:
  • description:
  • auto_granted:
  • qualification_type_status:

createTuttiHITBatch

  • name:
  • project_name: String
    • Tutti project name.
  • hit_type_params: Object
    • Parameters for CreateHITType operation of MTurk.
  • hit_params: Object
    • Parameters for CreateHIT operation of MTurk.
  • num_hits: Number
    • Number of HITs to create for Tutti HIT Batch.

deleteCredentials

  • credentials_id: String
    • Tutti's internal hash ID for registered MTurk credentials.

deleteHITs

  • request_id: String
    • Arbitrary string value to identify response for this request.
  • hit_ids: Array
    • List of MTurk HIT Ids.

deleteQualificationTypes

  • qualification_type_ids: Array
    • List of MTurk Qualification type IDs.

deleteTuttiHITBatch

  • request_id: String
    • Arbitrary string value to identify response for this request.
  • batch_id: String
    • Tutti's internal hash ID for Tutti HIT Batch.

execBoto3

  • method:
  • parameters:

expireHITs

  • request_id: String
    • Arbitrary string value to identify response for this request.
  • hit_ids: Array
    • List of MTurk HIT Ids.

getActiveCredentials

  • [None]

getCredentials

  • credentials_id: String
    • Tutti's internal hash ID for registered MTurk credentials.

listAssignmentsForTuttiHITBatch

  • batch_id: String
    • Tutti's internal hash ID for Tutti HIT Batch.
  • cached: Boolean
    • Whether to return cached value in the response. Note that setting this value to false may result in slower responses.

listCredentials

  • [None]

listHITTypes

  • [None]

listHITsForTuttiHITBatch

  • batch_id: String
    • Tutti's internal hash ID for Tutti HIT Batch.
  • cached: Boolean
    • Whether to return cached value in the response. Note that setting this value to false may result in slower responses.

listQualificationTypes

  • query:
  • only_user_defined: Boolean
    • Whether to filter out Qualification types of other requesters in the results. This is directly passed to MustBeOwnedByCaller parameter for MTurk's ListQualificationTypes operation.
  • cached: Boolean
    • Whether to return cached value in the response. Note that setting this value to false may result in slower responses.

listTuttiHITBatches

  • [None]

listTuttiHITBatchesWithHITs

  • [None]

listWorkers

  • [None]

notifyWorkers

  • subject:
  • message_text:
  • worker_ids: Array
    • List of MTurk Worker IDs.

rejectAssignments

  • assignment_ids: Array
    • List of MTurk Assignment IDs.
  • requester_feedback:

renameCredentials

  • credentials_id: String
    • Tutti's internal hash ID for registered MTurk credentials.
  • label:

sendBonus

  • worker_ids: Array
    • List of MTurk Worker IDs.
  • bonus_amount:
  • assignment_ids: Array
    • List of MTurk Assignment IDs.
  • reason:

setActiveCredentials

  • credentials_id: String
    • Tutti's internal hash ID for registered MTurk credentials.

setActiveSandboxMode

  • is_sandbox: Boolean
    • Activation of Sandbox mode for MTurk credentials.