open-index/open-npm huggingface dataset:
npm package: @nosana/api
Description: Nosana API module
Author: Nosana
Latest version: 2.2.2

# @nosana/api

TypeScript SDK for the Nosana API.

## Installation

```bash
npm install @nosana/api
```

## Quick Start

```typescript
import { createNosanaApi, NosanaNetwork } from '@nosana/api';

// Create API instance
const api = createNosanaApi(NosanaNetwork.MAINNET, 'your-api-key');

// Use the API
const jobs = await api.jobs.list();
const credits = await api.credits.get();
```

## Authentication

### API Key
```typescript
const api = createNosanaApi(NosanaNetwork.MAINNET, 'your-api-key');
```

### SignerAuth (for vault operations)

SignerAuth enables wallet-based authentication and is required for deployment vault operations (balance, topup, withdraw).

```typescript
import type { SignerAuth } from '@nosana/api';

const signerAuth: SignerAuth = {
  identifier: 'wallet-public-key',
  generate: async (message: string) => {
    // Sign message with wallet
    return signedMessage;
  },
  solana: {
    getBalance: async (address: string) => ({ SOL: 0, NOS: 0 }),
    transferTokensToRecipient: async (recipient, tokens) => { /* ... */ },
    deserializeSignSendAndConfirmTransaction: async (tx) => 'signature',
  },
};

const api = createNosanaApi(NosanaNetwork.MAINNET, signerAuth);

// Use vault methods
const vault = await api.deployments.vaults.create();
await vault.topup({ NOS: 100 });
```

**Note:** When using `@nosana/kit`, SignerAuth is automatically created from your wallet.

## API Modules

- `api.jobs` - Job management
- `api.credits` - Credit balance
- `api.markets` - Market data
- `api.deployments` - Deployments and vaults

## Development

```bash
npm install
npm test
npm run build
```
npm package: @nosana/schema-validator
Description: To install dependencies:
Author: Nosana
Latest version: 0.1.35

# Nosana Validate Pipeline Schema

Simple to use library to validate Nosana Pipeline Schemas.
You can learn more about the pipeline at [Nosana Pipeline documentation](https://docs.nosana.io/pipelines/intro.html).

The schema can be found at [src/schema.ts](src/schema.ts).

When this library is bundled as ESM, types are also included.

## Quickstart

Install:

```bash
npm i @nosana-ci/schema-validator
```

There are two functions available for use:

- `validateJson`
- `validateYaml`

Example:

## Validate JSON

```javascript
import { validateJson } from '@nosana-ci/schema-validator'

const nosana_pipeline = {
    "global": {
        "image": "registry.hub.docker.com/library/node:16",
        "trigger": {
        "branch": [
            "main"
        ]
        }
    },
    "jobs": [
        {
        "name": "install-deps and run test",
        "commands": [
            "npm ci",
            "npm run test"
        ]
        }
    ]
}

validateJson(nosana_pipeline)
// => { valid: true, errors: []}

```

## Validate YAML

It is also possible to validate a YAML file:

```javascript

const yaml = `
global:
  image: registry.hub.docker.com/library/cljkondo/clj-kondo
  
  trigger:
    branch:
      - main

  environment:
    DEBIAN_FRONTEND: noninteractive

jobs:
  - name: install and build container
    commands:
      - env
      - clj-kondo --lint src --dependencies --parallel --copy-configs
      - git submodule init
      - git submodule update
`

validateYaml(yaml)
// => { valid: true, errors: []}

```

## Errors

If the schema is invalid, the errors will be returned.
The `instancePath` will be the path to the invalid property and the `message` will be the reason why it is invalid.

```javascript
const nosana_pipeline ={
    "global": {
        "image": "registry.hub.docker.com/library/node:16",
        "trigger": {
        "branch": [
            "main"
        ]
        }
    },
    "jobs": [
        {
            "name": "install-deps and run test",
            "commands": {
                "one": "npm ci",
                "two": "npm run test"
            }
        }
    ]
}

validateJson(nosana_pipeline)
/* => validated {
  valid: false,
  errors: [
    {
      instancePath: '/jobs/0/commands',
      schemaPath: '#/properties/jobs/items/properties/commands/type',
      keyword: 'type',
      params: [Object],
      message: 'must be array',
      schema: 'array',
      parentSchema: [Object],
      data: [Object]
    }
  ],
*/

```
npm package: @nosana/types
Description: Nosana Types Module
Author: Nosana
Latest version: 2.2.2

# @nosana/types

Shared TypeScript types for Nosana SDKs.

## Installation

```bash
npm install @nosana/types
```

## Usage

Import types directly:

```typescript
import { Job, Market, JobDefinition } from '@nosana/types';
```

## Solana Integration

Configure Solana types in your `types.ts` or `index.d.ts` file.

### Using @solana/kit

```typescript
import type { Address as SolanaAddress } from '@solana/kit';

declare module '@nosana/types' {
  interface Address {
    _type: SolanaAddress<string>;
  }
}
```

### Using @solana/web3.js

```typescript
import type { PublicKey as SolanaPublicKey } from '@solana/web3.js';

declare module '@nosana/types' {
  interface PublicKey {
    _type: SolanaPublicKey;
  }
}
```