open-index/open-npm huggingface dataset:
npm package: @jcm/nexus-plugin-datetime
Description: Creates t.dateTime field
Author: Jonathan Cardoso
Latest version: 0.2.0

# @jcm/nexus-plugin-datetime<!-- omit in toc -->

<p align="center">
<a href="https://www.patreon.com/bePatron?u=19985213" data-patreon-widget-type="become-patron-button" title="Become a Patreon">
  <img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="190" alt="Patreon Logo">
</a>
<br>
<a href="https://discord.io/jonathancardoso" title="Join our Discord Server">
  <img src="https://i.imgur.com/DlKeNmn.png" alt="Discord Logo" width="190" />
</a>
</p>

This plugin adds the field method `dateTime(fieldName, fieldConfig)` to the Nexus Schema Builder, which can be used to create date-time fields with a few helpful methods.

Sample usage:

```typescript
const User = objectType({
  name: 'User',
  definition(t) {
    // ...
    t.dateTime('createdAt')
    // ...
  },
})
```

With the above code, the following schema will be generated:

```graphql
"""
Represents an ISO datetime that can be formatted in other formats
"""
type DateTimeField implements DateTimeFieldInterface {
  formatted(
    format: String!

    """
    Timezone to format the ISO date, defaults to UTC
    """
    timezone: String
  ): String!
  isAfter(
    """
    Defaults to the current time if not provided
    """
    iso: String
  ): Boolean!
  isBefore(
    """
    Defaults to the current time if not provided
    """
    iso: String
  ): Boolean!
  isBetween(
    """
    Defaults to the end of the current day if not provided
    """
    isoEnd: String

    """
    Defaults to the start of the current day if not provided
    """
    isoStart: String
  ): Boolean!
  iso: String!
  isSame(
    """
    Defaults to the current time if not provided
    """
    iso: String
  ): Boolean!
  isSameOrAfter(
    """
    Defaults to the current time if not provided
    """
    iso: String
  ): Boolean!
  isSameOrBefore(
    """
    Defaults to the current time if not provided
    """
    iso: String
  ): Boolean!
}

"""
A object that represents an ISO datetime
"""
interface DateTimeFieldInterface {
  formatted(
    format: String!

    """
    Timezone to format the ISO date, defaults to UTC
    """
    timezone: String
  ): String!
  isAfter(
    """
    Defaults to the current time if not provided
    """
    iso: String
  ): Boolean!
  isBefore(
    """
    Defaults to the current time if not provided
    """
    iso: String
  ): Boolean!
  isBetween(
    """
    Defaults to the end of the current day if not provided
    """
    isoEnd: String

    """
    Defaults to the start of the current day if not provided
    """
    isoStart: String
  ): Boolean!
  iso: String!
  isSame(
    """
    Defaults to the current time if not provided
    """
    iso: String
  ): Boolean!
  isSameOrAfter(
    """
    Defaults to the current time if not provided
    """
    iso: String
  ): Boolean!
  isSameOrBefore(
    """
    Defaults to the current time if not provided
    """
    iso: String
  ): Boolean!
}

type User {
  # ...
  createdAt: DateTimeField!
}

# ...
```
npm package: @jcm/nexus-plugin-elastic-apm-instrumentation
Description: Captures transactions spans for each field using an Elastic APM Agent
Author: Jonathan Cardoso
Latest version: 0.2.0

# @jcm/nexus-plugin-elastic-apm-instrumentation<!-- omit in toc -->

<p align="center">
<a href="https://www.patreon.com/bePatron?u=19985213" data-patreon-widget-type="become-patron-button" title="Become a Patreon">
  <img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="190" alt="Patreon Logo">
</a>
<br>
<a href="https://discord.io/jonathancardoso" title="Join our Discord Server">
  <img src="https://i.imgur.com/DlKeNmn.png" alt="Discord Logo" width="190" />
</a>
</p>

This plugin will use the passed [`apmAgent`](https://github.com/elastic/apm-agent-nodejs) to capture spans for each GraphQL field resolver.
npm package: @jcm/nexus-plugin-field-authentication
Description: Adds a new field config "authentication" that should be used to determine if the field should be resolved or not
Author: Jonathan Cardoso
Latest version: 0.2.0

# @jcm/nexus-plugin-relay-node-interface<!-- omit in toc -->

<p align="center">
<a href="https://www.patreon.com/bePatron?u=19985213" data-patreon-widget-type="become-patron-button" title="Become a Patreon">
  <img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="190" alt="Patreon Logo">
</a>
<br>
<a href="https://discord.io/jonathancardoso" title="Join our Discord Server">
  <img src="https://i.imgur.com/DlKeNmn.png" alt="Discord Logo" width="190" />
</a>
</p>

This plugin allows to set a `authentication` property on any field, and it will validate that the user is / is not authenticated before resolving it.

Sample usage:

```typescript
const User = objectType({
  name: 'User',
  definition(t) {
    // ..

    t.string('email', {
      // this field will only be resolved if the user is authenticated
      authentication: true,
    })

    t.string('email', {
      // this field will only be resolved if the user is NOT authenticated
      authentication: false,
    })

    t.string('email', {
      // this field will only be resolved if the user is authenticated
      //  when they are not, 'random-email@domain.tld' will be returned instead
      authentication: [true, 'random-email@domain.tld'],
    })

    t.string('email', {
      // this field will only be resolved if the user is authenticated
      //  when they are not, an error will be thrown
      authentication: [true, new Error('Something happened!')],
    })

    // you can also pass a resolve like function, their result must be like the value above
    //  or it can also throw an error
    t.string('email', {
      // this field will only be resolved if the user is authenticated
      //  when they are not, an error will be thrown
      authentication: async (root, args, ctx, info) => [false],
    })
  },
})
```

The plugin accepts a few options, but the main one is `isLogged`, which is a resolve like function that you can provide to assert that the client is logged or not. By default it's set to:

```
(_root, _args, ctx, _info) => !!ctx?.state?.user
```

Which will work if you are storing the logged user on `ctx.state.user`. Otherwise you can change it to your own logic.

> It's so confusing allowing false in the `authentication` field!

I agree, in reality I have never had the need to use something other than `true` | `Error`
npm package: @jcm/nexus-plugin-relay-global-id
Description: Adds t.relayGlobalId to the schema builder
Author: Jonathan Cardoso
Latest version: 0.2.0

# @jcm/nexus-plugin-relay-global-id<!-- omit in toc -->

<p align="center">
<a href="https://www.patreon.com/bePatron?u=19985213" data-patreon-widget-type="become-patron-button" title="Become a Patreon">
  <img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="190" alt="Patreon Logo">
</a>
<br>
<a href="https://discord.io/jonathancardoso" title="Join our Discord Server">
  <img src="https://i.imgur.com/DlKeNmn.png" alt="Discord Logo" width="190" />
</a>
</p>

This plugin adds the field method `relayGlobalId(fieldName, fieldConfig)` to the Nexus Schema Builder, which can be used to create [Relay-compliant global IDs](https://relay.dev/docs/en/graphql-server-specification.html#object-identification).

Sample usage:

```typescript
const User = objectType({
  name: 'User',
  definition(t) {
    // ...
    t.relayGlobalId('id')
    // ...
  },
})
```

With the above code, the following schema will be generated:

```graphql
type User {
  id: ID!
  rawId: ID!
}
# ...
```
npm package: @jcm/nexus-plugin-relay-mutation
Description: Adds relayMutation(field, config) method to the nexus/schema builder to create Relay compatible mutations
Author: Jonathan Cardoso
Latest version: 0.2.0

# @jcm/nexus-plugin-relay-mutation<!-- omit in toc -->

<p align="center">
<a href="https://www.patreon.com/bePatron?u=19985213" data-patreon-widget-type="become-patron-button" title="Become a Patreon">
  <img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="190" alt="Patreon Logo">
</a>
<br>
<a href="https://discord.io/jonathancardoso" title="Join our Discord Server">
  <img src="https://i.imgur.com/DlKeNmn.png" alt="Discord Logo" width="190" />
</a>
</p>

This plugin adds the field method `relayMutation(fieldName, fieldConfig)` to the Nexus Schema Builder, which can be used to create [Relay-compliant mutations](https://relay.dev/docs/en/graphql-server-specification.html#mutations).

It's based on the [`mutation` helper](https://github.com/graphql/graphql-relay-js/blob/f00bad1395eed1738264f41c35e3901dddff1559/src/mutation/mutation.js) from `graphql-relay`.

Sample usage:

```typescript
const mutation = mutationField((t) => {
  t.relayMutation('addNumbers', {
    inputFields(t2) {
      t2.int('number1', {
        required: true,
      })
      t2.int('number2', {
        required: true,
      })
    },
    outputFields(t2) {
      t2.int('result')
    },
    mutateAndGetPayload(_root, input, _ctx, _info) {
      return {
        result: input.number1 + input.number2,
      }
    },
  })
})
```

With the above code, the following schema will be generated:

```graphql
input addNumbersInput {
  number1: Int!
  number2: Int!
  clientMutationId: String
}

type addNumbersPayload {
  result: Int!
  clientMutationId: String
}

type Mutation {
  addNumbers(input: addNumbersInput!): addNumbersPayload!
  # ...
}

# ...
```
npm package: @jcm/nexus-plugin-relay-node-interface
Description: Creates the Relay Node interface and add node/nodes fields to the Query type
Author: Jonathan Cardoso
Latest version: 0.2.0

# @jcm/nexus-plugin-relay-node-interface<!-- omit in toc -->

<p align="center">
<a href="https://www.patreon.com/bePatron?u=19985213" data-patreon-widget-type="become-patron-button" title="Become a Patreon">
  <img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="190" alt="Patreon Logo">
</a>
<br>
<a href="https://discord.io/jonathancardoso" title="Join our Discord Server">
  <img src="https://i.imgur.com/DlKeNmn.png" alt="Discord Logo" width="190" />
</a>
</p>

This plugin adds the following to the `GraphQL` schema generated by nexus:

- `Node` interface
- `node($id: ID!): Node` field on `Query`
- `nodes($ids: [ID!]!): Node!` field on `Query`

The plugin itself accepts a few configuration options:

### idFetcher [required]

A function with signature `(idValue, ctx, info) => Object`, which should return the node for given `idValue`

### resolveType [required]

A function with signature `(object) => string | GraphQLType`, which should return the GraphQL type for the given object. This is basically the resolveType of the `Node` interface created by the plugin.

### idParser

A function with signature `(id) => any`. It will be called with the ID passed to the `node` / `nodes` fields, and their result will be used as the first argument passed to `idFetcher` above. By default this is set to `fromGlobalId` from `graphql-relay`.
npm package: @jcm/nexus-plugin-yup-validation
Description: Allows to use Yup schemas to validate GraphQL arguments
Author: Jonathan Cardoso
Latest version: 0.1.1

# @jcm/nexus-plugin-yup-validation<!-- omit in toc -->

<p align="center">
<a href="https://www.patreon.com/bePatron?u=19985213" data-patreon-widget-type="become-patron-button" title="Become a Patreon">
  <img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="190" alt="Patreon Logo">
</a>
<br>
<a href="https://discord.io/jonathancardoso" title="Join our Discord Server">
  <img src="https://i.imgur.com/DlKeNmn.png" alt="Discord Logo" width="190" />
</a>
</p>

This plugin allows to set a `yup` property on some field (Mutations are the only ones supported at the moment), and it will validate the arguments passed to the field using the given [`yup`](https://github.com/jquense/yup) schema. It's inspired by something I wrote a long time ago: [GraphQL Mutation Arguments Validation with Yup using graphql-middleware](https://jonathancardoso.com/en/blog/graphql-mutation-arguments-validation-with-yup-using-graphql-middleware/)

Sample usage:

```typescript
const AddUserMutation = mutationField((t) => {
  t.field('addUser', {
    type: AddUserPayload,
    args: {
      email: stringArg(),
    },
    yup: {
      schema: yup.object({
        email: yup.string().email().required(),
      }),
    },
    // ...
  })
})
```

The default `errorPayloadBuilder` assumes that the mutation output type has a field named `error` which is an object with the following structure:

```ts
{
  message: string,
  details: ErrorDetail[]
}

// ErrorDetails:
{
  path: string[],
  messages: string[]
}
```
npm package: @jcmagoo/react-env
Description: Hook/Context based environment variables for React Single Page Applications (SPA)
Author: John Clarke
Latest version: 1.0.0

# react-env

[![Coverage Status](https://coveralls.io/repos/github/TheMagoo73/react-env/badge.svg?branch=main)](https://coveralls.io/github/TheMagoo73/react-env?branch=main)

## Contents
- [Rational](#rational)
- [Installation](#installation)
- [Getting Started](#getting-started)

## Rational

Create-React-App (CRA) allows the use of environment variables to configure the application for separate environments, for example allowing different API keys in development, staging and production environments. However, unlike in a traditional server-side environment, these environment variables are 'baked into' the resulting app when it is built.

If you are running a separate build for each environment this solution can work well, however in the world of container-based deployments we often want to build a single container, and then use that in multiple environments. At this point, the CRA approach of baking in the environment variables at build time isn't ideal; we want to apply the environment variables in the browser based on the environment that the user has browsed to.

This context-based hook aims to provide a simple solution to runtime configuration by allowing the React app to download a configuration from a provided URL. If you're backend is running in a container you can then mount the environment specific configuration into the app's container. For example in K8s this could be mounted from a secret.

## Installation

Using [npm](https://npmjs.org)

```bash
npm install @jcmagoo/react-env
```

Using [yarn](https://yarnpkg.com)

```bash
yarn add @jcmagoo/react-env
```

## Getting Started

Wrap your app in the EnvProvider, and speify where to get the environment config from, and a default configuration if the load fails for any reason.

```jsx
// src/index.js
import React from 'react';
import ReactDOM from 'react-dom';
import {EnvProvider} from 'react-env';
import App from './App';

const defaultEnv = {
    environmentName: 'dev'
}

ReactDOM.render(
    <EnvProvider
        url="https://yoursite.com/config/env.json"
        defaultEnv={ defaultEnv }
    >
        <App />
    </EnvProvider>,
    document.getElementById('app')
);
```

Now use the `useEnv` hook to access the configuration once it's been loaded

```jsx
import React from 'react';
import { useEnv } from 'react-env';

function App() {
    const {
        state,
        env,
    } = useEnv();

    if (state === 'LOADING') {
        return (<div>Config is loading...</div>)
    }

    const hasExtraText = hasFeature('extra_text')
    const theValue = getValue('example_value')

    return (<div>
        <div>Welcome to the {env.environmentName} environment.</div>
        {
            state==='ERRORED' && <div>Environment failed to load, using defaults</div>
        }
    </div>)
}

export default App;
```
npm package: @jcmagoo/react-event-emitter
Description: Hook based pub/sub event emitter for React Single Page Applications (SPA)
Author: John Clarke
Latest version: 1.0.3

# @magoo/react-event-emitter

React hook for event subscription and publishing

[![npm version](https://badge.fury.io/js/%40jcmagoo%2Freact-event-emitter.svg)](https://badge.fury.io/js/%40jcmagoo%2Freact-event-emitter)
[![Known Vulnerabilities](https://snyk.io/test/github/TheMagoo73/flagsmith-react/badge.svg)](https://snyk.io/test/github/TheMagoo73/react-event-emitter)
![CI Build](https://github.com/TheMagoo73/react-event-emitter/actions/workflows/ci-build.yml/badge.svg)
[![Test Coverage](https://api.codeclimate.com/v1/badges/3d634028cffba29aba92/test_coverage)](https://codeclimate.com/github/TheMagoo73/react-event-emitter/test_coverage)

## Contents

- [Installation](#installation)
- [Getting Started](#getting-started)
- [API Reference](#api-reference)

If you're creating a React hook, and need to provide a mechanism for client components to subscribe to events that the hook raises, then this module is for you!

## Instalation

Using [npm](https://npmjs.org)

```bash
npm install @jcmagoo/react-event-emitter
```

Using [yarn](https://yarnpkg.com)

```bash
yarn add @jcmagoo/react-event-emitter
```

## Getting Started

Here's a very simple example of subscribing to an emitter, and emitting an event.

```javascript
import useEventEmitter from './src'

const {useSubscription, emit} = useEventEmitter()

useSubscription(() => console.log('Hello Foo!'))
useSubscription(() => console.log('Hello Bar'))

emit()

// Hello Foo
// Hello Bar
```

When used in a custom hook, typically the hook would expose the `useSubscription` method to allow consumers to register callbacks to be notified of events by the hook. The hook itself would call `emit` when it needed to trigger the notification.

## API Reference

### useEventEmitter

```javascript
const {
    useSubscription,
    emit
} = useEventEmitter();
```

Use the `useEventEmitter` hook to add pub/sub event support to your components and hooks.

### useSubscription

```javascript
useSubscription(callback)
```

Add a subscription to the event emitter.

### emit

```javascript
emit()
```

Call the callback for each attached subscriber.
npm package: @jcmap-sdk-web/navegador-core
Description: navegador core
Author: Chuan Zh.
Latest version: 2.1.0-1

# 甲虫网络室内定位导航

核心功能

```javascript
import NavegadorCore from '@jcmap-sdk-web/navegador-core';
const navegadorCore = new NavegadorCore();
// ... do something with navegadorCore
```
npm package: @jcmcool/utils
Description: My frequently used utils.
Author: Graves2046
Latest version: 1.0.14

# @jcmcool/utils

To install dependencies:

```bash
bun install
```

To run:

```bash
bun run index.ts
```

This project was created using `bun init` in bun v1.1.18. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
npm package: @jcminarro/firefly-iii-mcp-core
Description: core modules for Firefly III MCP server
Author: Evans Mike
Latest version: 1.4.1

# Firefly III MCP Server - Core

Core module for the Firefly III MCP (Model Context Protocol) server. This package provides the foundation for interacting with the Firefly III API through the Model Context Protocol.

*[查看中文版](README_ZH.md)*

## Installation

```bash
npm install @jcminarro/firefly-iii-mcp-core
```

## Usage

This package is primarily used by the `@jcminarro/firefly-iii-mcp-local` and `@firefly-iii-mcp/cloudflare-worker` packages, but can also be used directly to create custom MCP server implementations.

```typescript
import { getServer, McpServerConfig } from '@jcminarro/firefly-iii-mcp-core';

// Create configuration
const config: McpServerConfig = {
  pat: 'YOUR_PERSONAL_ACCESS_TOKEN',
  baseUrl: 'YOUR_FIREFLY_III_URL'
};

// Get server instance
const server = getServer(config);

// Connect to a transport
// Example using StdioServerTransport
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
const transport = new StdioServerTransport();
await server.connect(transport);
```

## Features

- Provides complete interaction with the Firefly III API
- Implements the Model Context Protocol standard
- Supports multiple transport methods (stdio, HTTP, etc.)

## Requirements

- Node.js >= 20
- ESM module support

## Development

This package is part of a monorepo managed with Turborepo. Please refer to the [CONTRIBUTING.md](../../CONTRIBUTING.md) file in the project root for detailed contribution guidelines.

## License

This project is licensed under the [MIT License](../../LICENSE).