open-index/open-npm huggingface dataset:
npm package: @hexlabs/env-vars-ts
Description: Type safe control over environment variables in typescript
Author: hexlabs.io
Latest version: 2.0.15

@hexlabs/env-vars-ts

Typesafe control over environment variables in Typescript.

[![Build](https://github.com/hexlabsio/env-vars-ts/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/hexlabsio/env-vars-ts/actions/workflows/build.yml)
[![npm version](https://badge.fury.io/js/%40hexlabs%2Fenv-vars-ts.svg)](https://badge.fury.io/js/%40hexlabs%2Fenv-vars-ts)

## Get Started

Define the **required** environment variable names that you want by calling `create()`: 

```typescript
const builder = EnvironmentBuilder.create('a', 'b');
```

Define the optional environment variable names that you want:

```typescript
const builder = EnvironmentBuilder
  .create('a', 'b')
  .optionals('c', 'd');
```

Provide defaults optionally:

```typescript
const builder = EnvironmentBuilder
  .create('a', 'b')
  .optionals('c', 'd')
  .defaults({ a: 'default for a' });
```

Get environment variables from `process.env` by default or provide your own

```typescript
// The type of environment is { a: string; b: string; c?: string; d?: string }
const environment = EnvironmentBuilder
  .create('a', 'b')
  .optionals('c', 'd')
  .defaults({ a: 'default for a' })
  .environment(); // <- Provide your own envs here
```

Provide custom transforms for selected envs

```typescript
// The type of environment is 
// {
//   selected: boolean;
//   count: number;
//   optionallySelected?: boolean;
//   standardEnv?: string;
// }
const environment = EnvironmentBuilder
  .create('selected', 'count')
  .optionals('optionallySelected', 'standardEnv')
  .transform(s => s === 'true', 'selected', 'optionallySelected')
  .transform(s => Number.parseInt(s), 'count')
  .defaults({ count: 25 }) // defaults will take into account your transforms notice this is a number and not a string.
  .environment();
```

Lazily retrieve the type of environment before running 
```typescript
const environmentBuilder = EnvironmentBuilder.create('a', 'b');

// Use Type alias for the environment defintion 
// We use this in HexLabs to define expected lambda environment variables when creating CloudFormation stacks
// where we do not want to check at build time as the stack is generated form TypeScript.
type EnvVars = ReturnType<typeof environmentBuilder.environment>;

//Get actual environment variables somewhere else
const environment = environmentBuilder.environment();
```
npm package: @hexlabs/eventbridge-schedule-expressions
Description: ![Typescript](https://img.shields.io/badge/TypeScript-007ACC?style=flat-square&logo=typescript&logoColor=white) [![Build](https://github.com/hexlabsio/eventbridge-schedule-expressions/actions/workflows/npm-package.yml/badge.svg)](https://github.com/hexlab
Author: HexLabs
Latest version: 1.0.6

# Eventbridge Schedule Expressions

![Typescript](https://img.shields.io/badge/TypeScript-007ACC?style=flat-square&logo=typescript&logoColor=white)
[![Build](https://github.com/hexlabsio/eventbridge-schedule-expressions/actions/workflows/npm-package.yml/badge.svg)](https://github.com/hexlabsio/eventbridge-schedule-expressions/actions/workflows/npm-package.yml)
[![NPM Version](https://badge.fury.io/js/%40hexlabs%2Feventbridge-schedule-expressions.svg)](https://badge.fury.io/js/%40hexlabs%2Feventbridge-schedule-expressions)

A small Typescript package that checks **[AWS EventBridge Scheduler](https://aws.amazon.com/eventbridge/scheduler/)** scheduled expressions are valid at compile time. 
Cron expressions are incredibly powerful but mistakes can be easily made. 

Typescripts type system can be used to give better validation that plain strings enforcing rules such as cron minute values are being between 0-59 while hours between 0-23

## Cron Expressions
![Cron expression](img/cron_expression.gif)

## Rate Expressions
![Rate expression](img/rate_expression.gif)

## Formats
Expression formats are takes from the **[AWS Schedule Expressions](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html)** syntax. 
Feel free to **[create an issue](https://github.com/hexlabsio/eventbridge-schedule-expressions/issues)** if you find anything that breaks these formats. 

## Installation

```shell
npm install --save-dev @hexlabs/eventbridge-schedule-expressions
```

## Usage

### [Kloudformation-ts](https://github.com/hexlabsio/kloudformation-ts)
```ts
import {scheduleExpression} from '@hexlabs/eventbridge-schedule-expressions';

aws.schedulerSchedule({
    groupName: schedulerGroup.name,
    name: 'sheduler',
    scheduleExpression: scheduleExpression('cron(0 * * * ? *)'),
    target: {arn: lambda.attributes.Arn, roleArn: schedulerRole.attributes.Arn},
    flexibleTimeWindow: {mode: 'OFF'},
  },
);
```

### CDK
```ts
import {scheduleExpression} from '@hexlabs/eventbridge-schedule-expressions';

new CfnSchedule(this, 'my-schedule', {
  groupName: schedulerGroup.name,
  scheduleExpression:  scheduleExpression('cron(5,35 * * * ? *)'),
  target: {
    arn: lambdaFunction.functionArn,
    roleArn: schedulerRole.roleArn,
  },
  flexibleTimeWindow: {
    mode: 'OFF',
  },
});
```
### AWS SDK
```ts   
  import {scheduleExpression} from '@hexlabs/eventbridge-schedule-expressions';

  await eventBridge.putRule({
    Name: 'Rule-Name',
    ScheduleExpression: scheduleExpression('cron(5,35 * * * ? *)')
  }).promise();
```
npm package: @hexlabs/generator-hexlabs-api
Description: Generate an API like HexLabs does
Author: hexlabs
Latest version: 1.0.27

# How to create a new Product in HexLabs

1. Create Domain

2. Create AWS Accounts and GCP Projects
```shell
    npx @hexlabs/hexlabs-cli create
    # Use SSO to login to the production account and get the NS records for the domain - add them to the DNS entries for the domain in the registrar
```

3. Goto https://console.cloud.google.com/apis/credentials and select project per environment created in step 2. Setup OAuth2 Client with redirect urls matching the domain for the environment setup in the previous steps:

Example redirectUr: https://auth.dev.link-ni.co.uk/oauth2/idpresponse

4. Create repository for <<product-name>>-user-service and add secrets to actions for each environment

```
CLIENT_GOOGLE_ID_<<ENVIRONMENT>>
CLIENT_GOOGLE_SECRET_<<ENVIRONMENT>>
```

5. Install Yeoman Generator and Hexlabs Generator

```shell
npm install -g yo @hexlabs/generator-hexlabs-api
```

6. Create User service - (Cognito Userpool with triggers)
```shell
    mkdir <<product-name>>-user-service && cd <<product-name>>-user-service
    yo @hexlabs/hexlabs-api 
    select type User Service
    push to github repo
    once complete delete the A record pointing at 8.8.8.8
```

7. Create Web app (Generates two projects: an edge stack and a react app)
```shell
    yo @hexlabs/hexlabs-api 
    select type React UI
    push edge to github
    after deploy push ui to github
```

8. Create Services
```shell
    yo @hexlabs/hexlabs-api 
    select type General Service
    push to github
```