open-index/open-npm huggingface dataset:
npm package: @recubed/object-satisfies
Description: key-based object validation
Author: tanfonto
Latest version: 0.1.2

[![MIT
license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/)
[![Build
Status](https://travis-ci.org/rethree/object-satisfies.svg?branch=master)](https://travis-ci.org/rethree/object-satisfies) 
[![Coverage Status](https://coveralls.io/repos/github/rethree/object-satisfies/badge.svg?branch=master)](https://coveralls.io/github/rethree/object-satisfies?branch=master)
[![CodeFactor](https://www.codefactor.io/repository/github/rethree/object-satisfies/badge)](https://www.codefactor.io/repository/github/rethree/object-satisfies)
[![dependencies
Status](https://david-dm.org/rethree/object-satisfies/status.svg)](https://david-dm.org/rethree/object-satisfies) 
[![devDependencies Status](https://david-dm.org/rethree/object-satisfies/status/dev-status.svg)](https://david-dm.org/rethree/object-satisfies/status?type=dev)

### object-satisfies

Tiny helper library written to simplify the task of fine-grained object validation. 
Pretty much what you can do with `ramda/where` or `lodash/conforms` except that it's 
smaller, prioritizes typings and makes field-level predicates aware of field existence (not just emptiness).

Given an arbitrary object, e.g.:

```typescript
const scenario = {
  a: 42,
  b: 'ohai',
}
```

`object-satisfies` allows key-based predicate composition, i.e.:

```typescript
import satisfies from '@recubed/object-satisfies';

const spec = satisfies({
  a: x => x === 42,
  b: x => typeof x === 'string',
  // c is optional and not in the 'scenario' object, object-satisfies 
  // lets you run a predicate regardless, additionally - field existence flag is 
  // added to the list of predicate arguments; 
  c: (x, found) => !found     
})
const outcome = spec(scenario);

console.log(outcome); // true
```

Please note that type-wise, example above will only compile because the type of `scenario` object is 
unavailable at the time `spec` argument is defined. To overcome this limitation one would need 
to specify generic argument explicitly, like this:

```typescript
import satisfies from '@recubed/object-satisfies';

const spec = satisfies<typeof scenario>({
  a: x => x === 42,
  b: x => typeof x === 'string',
  c: (x, found) => !found     
});
```

...however, if validation of explicitly typed "scenario object" against a spec argument is performed one needs 
to make sure the former is a superset (key-wise) of the latter, optional properties do count. To fix the 
compilation error caused by the piece of code above following type definition would need to be
provided:

```typescript
type Scenario = { 
  a: number;
  b: string;
  c?: () => {};
};
const scenario: Scenario = {
  a: 42,
  b: 'ohai',
};
```

See [tests](https://github.com/rethree/object-satisfies/tree/master/lib/test) for additional use cases / behaviours.
npm package: @recuro/sdk
Description: Non-custodial recurring USDC subscriptions on Solana
Latest version: 0.1.1

# @recuro/sdk

Non-custodial recurring USDC subscription protocol on Solana.

## What is Recuro?

Recuro enables merchants to accept automated recurring USDC payments
without ever taking custody of subscriber funds. Subscribers approve
a limited SPL delegate — funds stay in their wallet until payment time.

## Install
```bash
yarn add @recuro/sdk
```

## Quick Start
```ts
import { SubscriptionSdk } from "@recuro/sdk";
import { AnchorProvider } from "@coral-xyz/anchor";

const sdk = new SubscriptionSdk(provider, { cluster: "devnet" });

// Merchant: create a plan
const { planPubkey } = await sdk.createPlan({
  name: "Pro Plan",
  amountUsdc: 29.99,
  intervalDays: 30,
});

// Subscriber: subscribe to a plan
const { subscriptionPubkey } = await sdk.createSubscription({ planPubkey });

// Subscriber: cancel any time
await sdk.cancelSubscription(subscriptionPubkey);
```

## How it works

1. Merchant creates a **Plan PDA** — price is locked forever, merchant cannot change it after subscribers join
2. Subscriber approves an **SPL delegate** — funds stay in their wallet
3. An off-chain **keeper** watches `next_payment_at` on-chain
4. Keeper calls `execute_payment` — program validates timing, transfers funds
5. **0.25% protocol fee** taken on top, merchant always receives full advertised price

## Security model

- Funds never leave subscriber wallet until payment time
- SPL delegate cap = maximum possible exposure per subscriber
- Keeper cannot change amounts, redirect funds, or double charge
- Cancel = immediate delegate revoke, zero future exposure
- Program validates all accounts from on-chain state

## Key features

- `createPlan` / `updatePlan` / `archivePlan`
- `createSubscription` / `cancelSubscription` / `renewSubscription`
- `pauseSubscription` / `resumeSubscription`
- `fetchPlan` / `fetchMerchantPlans` / `fetchSubscriberSubscriptions`
- `getAnalytics` — aggregated on-chain merchant analytics
- Event listeners for real-time payment tracking

## License

MIT