open-index/open-npm huggingface dataset:
npm package: @lokalise/healthcheck-utils
Description: This package adds common utils that are used to work with healthchecks.
Latest version: 6.0.0

# Healthcheck Utils

This package adds common utils that are used to work with healthchecks.

## Usage

```ts
// this is a part of dependencies
const store = new HealthcheckResultsStore({
    maxHealthcheckNumber: 10,
    healthCheckResultTtlInMsecs: 40000,
})

const job = new HealthcheckRefreshJob(dependencies, healthcheckList, {
    intervalInMs: 15000,
})

await job.asyncRegister()
```
npm package: @lokalise/id-utils
Description: This package adds common utils that provide IDs compatible with CockroachDB UUID type.
Latest version: 3.0.1

# Id generation utils

This package adds common utils that provide IDs compatible with CockroachDB UUID type.

# Usage

```typescript
import { generateMonotonicUuid } from '@lokalise/id-utils'

const newId = generateMonotonicUuid()
```

Provided ID conforms with an abstract UUID representation
(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx) and is generated by ULID
algorithm, which makes it lexicographically sortable. You can use
basic language functions to sort by these ids:

```typescript
import { generateMonotonicUuid } from '@lokalise/id-utils'

const ids = []

for (const i of Array(1000)) {
	ids.push(generateMonotonicUuid())
}

const sorted = ids.sort()

// sorted == ids
```

### UUID7

This package also provides a function to generate a UUID7. It is a:

```
import { generateUuid7 } from '@lokalise/id-utils'

generateUuid7()
```
npm package: @lokalise/maestro-common
Description: This library provides common definitions for Maestro.
Latest version: 9.2.0

# Common library for Maestro

This library provides common definitions for Maestro.
It's meant to be used as a source of truth on common types and schemas for both Maestro and any client system libraries. Any template or generated layout in any client system, which uses Maestro, should satisfy these schemas and types.

It holds:
- zod schemas for main shared system parts (workflow layout, and it's pieces like, step, step settings, actions, etc.)
- types for mentioned schemas

## Getting Started

Install all dependencies:

```shell
npm install
```

Run all tests:

```shell
npm run test
```
npm package: @lokalise/maestro-expert-shared
Description: This library provides shared objects, types and zod schemas for Maestro
Latest version: 1.4.0

# Shared API library between Maestro and Expert

This library provides shared objects, types and zod schemas for Maestro and Expert. This includes, but not limited to:
- zod schemas for Maestro API
- Workflow templates
- Definitions of workflow steps
- Resolvers (action handlers, guards)

### zod schemas for Maestro API

Used by both Maestro and Expert frontend to validate comms.

### Workflow templates

Used by both Maestro and Expert frontend. Holds definitions for specific workflow templates.

### Definitions of workflow steps

Used by both Maestro and Expert frontend. Holds definitions for specific workflow steps.

### Resolvers (action handlers, guards)

Used by Maestro. Defines the actions, which are used by state machine. And also guards, which are constrains for transitions to other steps. So basically it's an Expert specific business logic for workflow states.


It can serve as a reference for any upcoming potential integration with Maestro.

## Getting Started

Install all dependencies:

```shell
npm install
```

Run all tests:

```shell
npm run test
```
npm package: @lokalise/maestro-expert-tenant-lib
Description: This library provides shared objects, types and zod schemas for Maestro
Latest version: 11.1.4

# ✨ maestro-expert-tenant-lib

This library provides shared components for Maestro and Expert. This includes, but is not limited to:
- API contracts
- zod schemas
- Workflow templates
- Definitions of workflow steps
- Resolvers (action handlers, guards)

### API contracts and zod schemas

Used by both Maestro and Expert frontend to validate communications.

### Workflow templates

Holds definitions for specific workflow templates.

### Definitions of workflow steps

Holds definitions for specific workflow steps.

### Resolvers (action handlers, guards)

Used by Maestro. Defines the actions, which are used by state machine. And also guards, which are constrains for transitions to other steps. So basically it's an Expert specific business logic for workflow states.

It can serve as a reference for any upcoming potential integration with Maestro.

## 🏃‍♀️ Getting Started

Install all dependencies:

```shell
npm install
```

Run all tests:

```shell
npm run test
```
npm package: @lokalise/maestro-nextgen-tenant-lib
Description: This library provides objects, types and zod schemas for NextGen tenant to work with Maestro
Latest version: 7.2.0

# ✨ maestro-nextgen-tenant-lib

This library provides shared objects, types and zod schemas for NextGen tenant to work with Maestro. This includes, but is not limited to:
- contracts for NextGen APIs in Maestro;
- schemas for NextGen events in Maestro.

## 🏃‍♀️ Getting Started

Install all dependencies:

```shell
npm install
```

Build the library:

```shell
npm run build
```

Run all tests:

```shell
npm run test
```
npm package: @lokalise/mockttp-utils
Description: API contract-based mock servers for testing. Resolves path to be mocked based on the contract and passed path params, and automatically infers type for the response based on the contract schema
Latest version: 1.1.0

# mockttp-utils

API contract-based mock servers for testing.
Resolves path to be mocked based on the contract and passed path params, and automatically infers type for the response based on the contract schema

## Basic usage

```ts
import { buildPayloadRoute } from '@lokalise/api-contracts'
import { sendByPayloadRoute } from '@lokalise/frontend-http-client'
import { getLocal } from 'mockttp'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import wretch, { type Wretch } from 'wretch'
import { z } from 'zod'
import { mockValidPayloadResponse } from './mockttpUtils.js'

const REQUEST_BODY_SCHEMA = z.object({
  name: z.string(),
})
const RESPONSE_BODY_SCHEMA = z.object({
  id: z.string(),
})
const PATH_PARAMS_SCHEMA = z.object({
  userId: z.string(),
})

const contractWithPathParams = buildPayloadRoute({
  successResponseBodySchema: RESPONSE_BODY_SCHEMA,
  requestBodySchema: REQUEST_BODY_SCHEMA,
  requestPathParamsSchema: PATH_PARAMS_SCHEMA,
  method: 'post',
  description: 'some description',
  responseSchemasByStatusCode: {
    200: RESPONSE_BODY_SCHEMA,
  },
  pathResolver: (pathParams) => `/users/${pathParams.userId}`,
})

describe('mockttpUtils', () => {
  const mockServer = getLocal()
  let wretchClient: Wretch

  beforeEach(async () => {
    await mockServer.start()
    wretchClient = wretch(mockServer.url)
  })
  afterEach(() => mockServer.stop())

  describe('mockValidPayloadResponse', () => {
    it('mocks POST request with path params', async () => {
      await mockValidPayloadResponse(contractWithPathParams, mockServer, {
        pathParams: { userId: '3' },
        responseBody: { id: '2' },
      })

      const response = await sendByPayloadRoute(wretchClient, contractWithPathParams, {
        pathParams: {
          userId: '3',
        },
        body: { name: 'frf' },
      })

      expect(response).toMatchInlineSnapshot(`
              {
                "id": "2",
              }
            `)
    })
  })
})

```
npm package: @lokalise/polyglot-sdk
Description: REST API client for the Lokalise Polyglot service
Author: Lokalise
Latest version: 23.0.2

# Polyglot Client SDK

Polyglot service provides a REST API to interact with it directly, but we recommend using
this [@lokalise/polyglot-sdk](https://www.npmjs.com/package/@lokalise/polyglot-sdk) NPM package to integrate Translation
and LQA capabilities into your Node.js application.

## Usage

Use the following command to add the package to your project:

```
npm install @lokalise/polyglot-sdk
```

After that, you can start using the SDK like this:

```typescript
import { PolyglotClient } from '@lokalise/polyglot-sdk'

const client = new PolyglotClient({
	// Polyglot instance URL
	baseUrl: 'e.g. https://polyglot-service-main.test.lokalise.cloud',
	// Authentication token in JWT format
	jwtToken: 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.ey...',
	// Optional Undici retry config (see RetryConfig in https://github.com/kibertoad/undici-retry)
	retryConfig: {},
	logger,
})
```

### Translate

To translate some content units asynchronously, you can use a following call example:

```typescript
const reqContext: RequestContext

// Either<Error, 'scheduled' | 'nothingToTranslate'>
const polyglotResponse = await this.polyglotClient.translateAsync(
	{
		sourceLocale: 'en',
		targetLocale: 'de',
		contentUnits: [
			{
				id: '018f5231-7be5-b816-116b-4b0426d0f428',
				segments: [
					{
						id: '018f5231-d61d-aec6-c6b2-ed676bbab868',
						value: 'Hello world',
					},
				],
			},
		],
		tenantId: 'autopilot',
		ownerId: '<unique_project_id>',
		originCorrelationId: '<unique_job_id',
		callbackUrl: 'https://<callback_url_on_consumer_side>',
		callbackToken: '<auth_token_that_will_be_passed_within_callback>',
	},
	{ reqContext, fakeProcessing: false },
)
```

If `polyglotResponse` is `'scheduled'`, that means the request was put into the Polyglot queue and after it is
processed, Polyglot will call given `callbackUrl` and provide the results (see Callback section for details).

Results callback will have the following structure:

```json
// POST <callbackUrl>
// Authorization: Bearer <callbackToken>

{
	"originCorrelationId": "018f3958-a3bb-05cc-2243-58976a74cd35#1",
	"data": [
		{
			"contentUnitId": "018f3414-7070-e998-3628-5ab485306760",
			"segmentId": "018f3414-7070-e998-3628-5ab485306761",
			"polyglotRefId": "fc9d0719-4470-4756-a655-be925c2b56e8",
			"integration": "ChatGPT-4",
			"translation": "mundo",
			"score": 0.88
		},
		{
			"contentUnitId": "018f3414-7070-e998-3628-5ab485306760",
			"segmentId": "018f3414-7070-e998-3628-5ab485306762",
			"polyglotRefId": "403f65d3-81ab-4204-8bda-4860f08c5258",
			"integration": "ChatGPT-4",
			"translation": "hola",
			"score": null
		}
	]
}
```

See https://lokalise.atlassian.net/wiki/spaces/PDE/pages/2787180586/Polyglot+APIs+and+Usage+guidelines#Translate-API-(async)
for more details on available parameters and results.

### LQA

TBD after async endpoint is implemented
npm package: @lokalise/ragnarok-api-contracts
Description: Ragnarok API contracts
Author: Lokalise
Latest version: 2.4.0

# @lokalise/ragnarok-api-contracts

API contracts for the Lokalise Ragnarok Service.  
This package provides type-safe, validated API route definitions using Zod schemas.

## Installation

```bash
npm install @lokalise/ragnarok-api-contracts
```

### Peer Dependencies

This package requires `zod` as a peer dependency:

```bash
npm install zod@^4.0.0
```

## License

Apache-2.0
npm package: @lokalise/script-utils
Description: # Usage
Latest version: 3.0.0

# Script utils

# Usage

## Syncing vault secrets with .env file

```typescript
//sync-with-vault.ts
import { synchronizeEnvFileWithVault } from '@lokalise/script-utils'

//Use this function to sync .env file with vault secrets, provide all params to the function.
```

`tsx` is recommended to be used as a script runner, so you can add the following script to your `package.json` file:

```
"scripts": {
    "sync-with-vault": "tsx sync-with-vault.ts"
}
```
npm package: @lokalise/supported-languages
Description: This package provides a list of language codes that are supported by CLDR43, and a subset of them supported by Lokalise.
Latest version: 3.2.0

# Supported Languages

## Project Purpose

This package provides a list of language codes that are supported by CLDR43, and a subset of them supported by Lokalise.

## Getting Started

Install all dependencies:

```shell
npm install
```

Run all tests:

```shell
npm run test
```
npm package: @lokalise/tm-sdk
Description: REST API client for the Lokalise Translation Memory service
Author: Lokalise
Latest version: 10.4.0

# Translation Memory client SDK

Translation Memory service provides a REST API to interact with it, but we recommend using this
[@lokalise/tm-sdk](https://www.npmjs.com/package/@lokalise/tm-sdk) NPM package to integrate TM capabilities into your 
Node.js application.

## Usage

Use the following command to add the package to your project:

```
npm install @lokalise/tm-sdk
```

After that, you can start using the SDK like this:

```typescript
import { TranslationMemoryClient } from '@lokalise/tm-sdk'

const client = new TranslationMemoryClient({
  isEnabled: true,
  baseUrl: 'https://<translation-memory-server-url>',
  jwtToken: '<JWT auth token provided by the TM service>',
  // Undici retry config (see RetryConfig in https://github.com/kibertoad/undici-retry)
  retryConfig: {},
  // See types in https://github.com/lokalise/node-core/blob/main/src/errors/errorReporterTypes.ts
  errorReporter: {
    report: (errorReport: ErrorReport) => {},
  },
})
```

To create new records, call `upsertRecords()` method:

```typescript
const requestContext = {
  reqId: randomUUID(),
  logger: globalLogger,
}
const ownerGroupId = { 
  ownerId: randomUUID(), // must be UUID 
  groupId: 'my-group-id'
}
const records = [
  {
    sourceLocale: 'en',
    targetLocale: 'de',
    sourcePrevContent: 'Localization meets AI',
    sourceText: 'Your one-stop solution for AI-powered translations.',
    targetText: 'Ihre Lösung aus einer Hand für KI-gestützte Übersetzungen.',
    sourceNextContent:
      'Save money, speed up your market entry, and charm customers in every language.',
  },
]

client.upsertRecords(requestContext, ownerGroupId, records)
```

To search for exact matching records, you can use `findMatches()` API.

```typescript
const requestContext = {
  reqId: randomUUID(),
  logger: globalLogger,
}
const ownerId = randomUUID()
const searchRequest = {
  sourceText: 'Your one-stop solution for AI-powered translations and automated localization.',
  sourceLocale: 'en',
  targetLocale: 'de',
  prevContent: 'Localization meets AI',
}
/**
 * [{
 *  sourceText: 'Your one-stop solution for AI-powered translations.'
 *  targetText: 'Ihre Lösung aus einer Hand für KI-gestützte Übersetzungen.'
 * }]
 */
const matches = client.findMatches(requestContext, ownerId, searchRequest)
```

You can also use `bulkFindMatches()` and `bulkFindMatchesIterative()` APIs to perform the same kind of lookup for
multiple separate search requests.
npm package: @lokalise/token-dictionary
Description: Source of truth for design tokens at Lokalise.
Latest version: 2.44.0

# TokenDictionary

Source of truth for design tokens at Lokalise.

## Release actions

When performing a release, make sure to follow our conventional commit approach, as described in [contribution documentation](https://github.com/lokalise/token-dictionary/blob/main/CONTRIBUTING.md).

## License

This project is APACHE, VERSION 2.0 licensed, see LICENSE.md for details.

## Support Us

**lokalise-npm-package-template** was created by Lokalise Engineering Team. Support our work by keeping this line in your README.
npm package: @lokalise/websockets-common
Description: This package contains core websocket system events and tools that can be used by backend and frontend services
Latest version: 4.2.1

# Websockets common package

This package contains core websocket system events and tools that can be used by backend and frontend services

## Getting started

### Server to Client events and vice-versa

Events are separated into two groups

1. Server to Client events (`server-to-client`)
2. Client to Server events (`client-to-server`)

The names are pretty self-explanatory, but the gist of it is - these dictate which events can be subscribed to and which events can be emitted. For example the Server can only subscribe to `client-to-server` events and can only emit `server-to-client` events.

### Event schemas

Event schema is a Zod object. The object will be passed as an argument for the event.

```typescript
const DEMO_EVENT_SCHEMA = z.object({
	first: z.string(),
	second: z.string(),
})
```

### Creating an event contract

An event contract is basically an object containing entries with a `schema`. Each `key` in that object represents the event name. Here is an example event definition.

```typescript
export const DemoEvents = {
	'users.demo.request': {
		schema: DEMO_EVENT_SCHEMA,
	},
}
```

You can split your definitions into multiple files/objects and combine them later.

```typescript
export const MyEvents = {
	...DemoEvents,
	...SomeOtherEvents,
}
```