@lastshotlabs/slingshot-organizations
npm install @lastshotlabs/slingshot-organizations
Functions
Section titled “Functions”createMemoryOrganizationsRateLimitStore
Section titled “createMemoryOrganizationsRateLimitStore”Result of a sliding-window rate-limit check.
function createMemoryOrganizationsRateLimitStore(options?: { maxEntries?: number; }): OrganizationsRateLimitStoreSource: packages/slingshot-organizations/src/lib/rateLimit.ts
createOrganizationsPackage
Section titled “createOrganizationsPackage”Organizations package factory.
Creates a SlingshotPackageDefinition that mounts the Organization,
OrganizationMember, OrganizationInvite, Group, and GroupMembership entities
(conditionally enabled by config), wires the invite rate-limit middleware
and admin-role guards, and publishes the org service + reconcile service
for cross-package consumers.
Every adapter ref, middleware closure, and rate-limit backend is owned by the factory’s closure (Rule 3) — multiple package instances in the same process do not share state.
function createOrganizationsPackage(rawConfig: OrganizationsPluginConfig = {}, deps: OrganizationsPluginDeps = {},): SlingshotPackageDefinitionSource: packages/slingshot-organizations/src/plugin.ts
createRedisOrganizationsRateLimitStore
Section titled “createRedisOrganizationsRateLimitStore”Minimal Redis client contract satisfied by ioredis, Upstash Redis, etc.
Re-exported from @lastshotlabs/slingshot-core so callers don’t need an extra import.
function createRedisOrganizationsRateLimitStore(redis: RedisLike, keyPrefix = 'org-rl:',): OrganizationsRateLimitStoreSource: packages/slingshot-organizations/src/lib/rateLimitRedis.ts
getOrganizationsOrgService
Section titled “getOrganizationsOrgService”Runtime organization service published through plugin state.
Peer plugins use this contract to resolve organizations by slug, create organizations, and add members without depending on a concrete adapter.
function getOrganizationsOrgService(input: PluginStateMap | PluginStateCarrier | object | null | undefined,): OrganizationsOrgServiceSource: packages/slingshot-organizations/src/orgService.ts
getOrganizationsOrgServiceOrNull
Section titled “getOrganizationsOrgServiceOrNull”Runtime organization service published through plugin state.
Peer plugins use this contract to resolve organizations by slug, create organizations, and add members without depending on a concrete adapter.
function getOrganizationsOrgServiceOrNull(input: PluginStateMap | PluginStateCarrier | object | null | undefined,): OrganizationsOrgService | nullSource: packages/slingshot-organizations/src/orgService.ts
getOrganizationsReconcile
Section titled “getOrganizationsReconcile”Result of reconcileOrphanedOrgRecords. Reports which dependent
collections still had orphaned rows when reconciliation began and which
(if any) failed to clean up. An empty failed list means the org has no
remaining orphans.
function getOrganizationsReconcile(input: PluginStateMap | PluginStateCarrier | object | null | undefined,): OrganizationsReconcileServiceSource: packages/slingshot-organizations/src/reconcile.ts
getOrganizationsReconcileOrNull
Section titled “getOrganizationsReconcileOrNull”Result of reconcileOrphanedOrgRecords. Reports which dependent
collections still had orphaned rows when reconciliation began and which
(if any) failed to clean up. An empty failed list means the org has no
remaining orphans.
function getOrganizationsReconcileOrNull(input: PluginStateMap | PluginStateCarrier | object | null | undefined,): OrganizationsReconcileService | nullSource: packages/slingshot-organizations/src/reconcile.ts
isUniqueViolationError
Section titled “isUniqueViolationError”Stable error code emitted in responses and logs when a slug uniqueness conflict is detected.
function isUniqueViolationError(err: unknown): booleanSource: packages/slingshot-organizations/src/errors.ts
Constants
Section titled “Constants”Organizations
Section titled “Organizations”Public contract for slingshot-organizations.
Cross-package consumers resolve OrganizationsOrgServiceCap through ctx.capabilities.require(...).
The legacy getOrganizationsOrgService(...) helper is retained as a thin wrapper that
resolves through the same contract path.
Source: packages/slingshot-organizations/src/public.ts
ORGANIZATIONS_RECONCILE_STATE_KEY
Section titled “ORGANIZATIONS_RECONCILE_STATE_KEY”Result of reconcileOrphanedOrgRecords. Reports which dependent
collections still had orphaned rows when reconciliation began and which
(if any) failed to clean up. An empty failed list means the org has no
remaining orphans.
Source: packages/slingshot-organizations/src/reconcile.ts
OrganizationsOrgServiceCap
Section titled “OrganizationsOrgServiceCap”Public contract for slingshot-organizations.
Cross-package consumers resolve OrganizationsOrgServiceCap through ctx.capabilities.require(...).
The legacy getOrganizationsOrgService(...) helper is retained as a thin wrapper that
resolves through the same contract path.
Source: packages/slingshot-organizations/src/public.ts
Classes
Section titled “Classes”SlugConflictError
Section titled “SlugConflictError”Stable error code emitted in responses and logs when a slug uniqueness conflict is detected.
Source: packages/slingshot-organizations/src/errors.ts
Interfaces
Section titled “Interfaces”GroupsConfig
Section titled “GroupsConfig”Fine-grained access-control options for the groups management routes.
Either adminRole or middleware can be used to protect the routes —
providing middleware overrides adminRole entirely.
Source: packages/slingshot-organizations/src/types/groups.ts
GroupsManagementConfig
Section titled “GroupsManagementConfig”Fine-grained access-control options for the groups management routes.
Either adminRole or middleware can be used to protect the routes —
providing middleware overrides adminRole entirely.
Source: packages/slingshot-organizations/src/types/groups.ts
OrganizationsPluginDeps
Section titled “OrganizationsPluginDeps”Organizations package factory.
Creates a SlingshotPackageDefinition that mounts the Organization,
OrganizationMember, OrganizationInvite, Group, and GroupMembership entities
(conditionally enabled by config), wires the invite rate-limit middleware
and admin-role guards, and publishes the org service + reconcile service
for cross-package consumers.
Every adapter ref, middleware closure, and rate-limit backend is owned by the factory’s closure (Rule 3) — multiple package instances in the same process do not share state.
Source: packages/slingshot-organizations/src/plugin.ts
OrganizationsRateLimitStore
Section titled “OrganizationsRateLimitStore”Result of a sliding-window rate-limit check.
Source: packages/slingshot-organizations/src/lib/rateLimit.ts
OrganizationsReconcileService
Section titled “OrganizationsReconcileService”Result of reconcileOrphanedOrgRecords. Reports which dependent
collections still had orphaned rows when reconciliation began and which
(if any) failed to clean up. An empty failed list means the org has no
remaining orphans.
Source: packages/slingshot-organizations/src/reconcile.ts
ReconcileOrphanedOrgRecordsResult
Section titled “ReconcileOrphanedOrgRecordsResult”Result of reconcileOrphanedOrgRecords. Reports which dependent
collections still had orphaned rows when reconciliation began and which
(if any) failed to clean up. An empty failed list means the org has no
remaining orphans.
Source: packages/slingshot-organizations/src/reconcile.ts
RedisLike
Section titled “RedisLike”Canonical Redis client interface used across all slingshot packages.
Concrete implementations (ioredis, Upstash Redis, etc.) satisfy this contract. Typed as an interface rather than a class so that any Redis-compatible client can be used without an adapter layer.
Remarks: getdel is optional because it is not supported by all Redis versions (requires Redis 6.2+). Framework code that calls getdel should fall back to GET+DEL when it is absent.
Source: packages/slingshot-core/src/redis.ts
OrganizationsOrgService
Section titled “OrganizationsOrgService”Runtime organization service published through plugin state.
Peer plugins use this contract to resolve organizations by slug, create organizations, and add members without depending on a concrete adapter.
Source: packages/slingshot-organizations/src/orgService.ts
OrganizationsPluginConfig
Section titled “OrganizationsPluginConfig”Organizations package factory.
Creates a SlingshotPackageDefinition that mounts the Organization,
OrganizationMember, OrganizationInvite, Group, and GroupMembership entities
(conditionally enabled by config), wires the invite rate-limit middleware
and admin-role guards, and publishes the org service + reconcile service
for cross-package consumers.
Every adapter ref, middleware closure, and rate-limit backend is owned by the factory’s closure (Rule 3) — multiple package instances in the same process do not share state.
Source: packages/slingshot-organizations/src/plugin.ts
OrganizationsRateLimitDecision
Section titled “OrganizationsRateLimitDecision”Result of a sliding-window rate-limit check.
Source: packages/slingshot-organizations/src/lib/rateLimit.ts