Skip to content

About

The provider catalog behind Kingdom integrations: operations, events, resource kinds and scopes per provider (MIT)

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

@inixiative/integrations

The provider catalog behind Kingdom integrations. For each provider it declares the operations and events it offers, the resource kind each one acts on, and the scopes it needs. Beside the catalog sits the code that reaches each provider: requests, webhook signature checks, event normalizers and credential renewal.

Kingdom is the permissions hub that decides who may use an integration. This package only says what an integration can do.

Install

bun add @inixiative/integrations zod

Use

Every file under src/ holds one export and is importable by its path.

import { findProvider } from '@inixiative/integrations/catalog/findProvider';
import { operationLeaves } from '@inixiative/integrations/catalog/operationLeaves';

findProvider('slack')?.operations;
operationLeaves('githubOrganization', 'repository');

Shape

Each provider has a folder under src/providers/, with auth/, events/, models/<model>/ and services/ inside it where it has that code, a <provider>Operations.ts of its catalog operations and a <provider>Provider.ts definition that src/catalog/providers.ts lists. The definition's operations are generated from the operations.

Every call is an atomic operation from @inixiative/api-client, called (client, input, options?):

import { findProvider } from '@inixiative/integrations/catalog/findProvider';
import { credentialAuth } from '@inixiative/integrations/credentials/credentialAuth';
import { providerOperationOrThrow } from '@inixiative/integrations/operations/providerOperationOrThrow';

const client = {
  baseUrl: findProvider('slack')?.apiBaseUrl ?? '',
  auth: credentialAuth({ provider: 'slack', method: 'bearer', token: async () => secret.token }),
  send,
};
await providerOperationOrThrow('slack', 'messages.read')(client, {
  resource: { kind: 'channel', externalId: 'C123', metadata: {} },
  configuration: {},
  limit: 15,
  input: {},
});
  • Client: { baseUrl, auth?, send? }. send is any fetch, so a recording or stubbed fetch drops in.
  • Input: a catalog operation takes the stored resource, the integration's configuration, a limit and the operation's own input.
  • Options: auth, logger, retry, signal, timeoutMs.

Pagination

@inixiative/api-client/http/pagination reads page-numbered and cursor lists, and @inixiative/api-client/graphql walks a GraphQL connection. A provider declares its strategy, its parameter names and where its responses keep the list (githubPagination, slackPagination, linearPagination); a service walks a list by calling one list operation per page.

License

MIT

About

The provider catalog behind Kingdom integrations: operations, events, resource kinds and scopes per provider (MIT)

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages