{
  "schema": "leumas.docs.page/1",
  "id": "pkg:@leumas/schemas",
  "slug": "packages/schemas",
  "kind": "capabilities",
  "bucket": "package",
  "title": "@leumas/schemas",
  "name": "@leumas/schemas",
  "eyebrow": null,
  "chip": null,
  "summary": "Canonical Leumas data model — Drizzle (libSQL/SQLite) tables + drizzle-zod validators + enums. DB-agnostic definitions, no runtime connection.",
  "keywords": [
    "schemas",
    "db-agnostic",
    "drizzle-zod",
    "enums",
    "validators",
    "schemas api",
    "leumas schemas",
    "libsql"
  ],
  "audience": "both",
  "funnel": {
    "product": null,
    "cta": null
  },
  "body": "# @leumas/schemas\n\nThe **canonical Leumas data model** — one source of truth for every product/engine/service.\n\n- **Drizzle tables** (`src/schema/*`) for **libSQL/SQLite** (`drizzle-orm/sqlite-core`).\n- **drizzle-zod validators** (`src/validators.js`) — insert/select schemas derived from the tables.\n- **Enums** (`src/enums.js`) — role/status/type vocabularies shared as arrays.\n\n**DB-agnostic definitions only — no connection.** The runtime client, migrations, seed, and the generic\nrepository live in [`@leumas/db`](../db). The dynamic (schema-less) CRUD connector lives in\n`shared/engines/middleware`. Both point at the same libSQL file.\n\n```js\nimport * as schema from '@leumas/schemas/schema';   // drizzle(client, { schema })\nimport { users, memberships, ROLES, insertUserSchema } from '@leumas/schemas';\n```\n\n## Tables (grouped)\n\n- **identity** — `users`, `admins`, `temporary_users`, `leumas_ids`, `sessions`\n- **rbac** — `roles`, `permissions`, `user_roles`, `role_permissions`\n- **monetization** — `memberships`, `dev_api_keys`, `token_transactions`\n- **gamification** — `level_badge_definitions`, `user_badge_unlocks`, `user_experience_events`\n- **social** — `posts`, `post_media`, `comments`, `post_likes`, `comment_likes`, `friendships`,\n  `friend_requests`, `conversations`, `conversation_members`, `messages`, `message_reads`, `notifications`\n\n## Conventions\n\n- Text UUID primary keys (`crypto.randomUUID()`); timestamps as epoch-ms integers.\n- Mongo embedded arrays → child/join tables (`post_media`, `post_likes`, `conversation_members`, …).\n- Tokens are whole integers ($1 each); `token_transactions` is an append-only ledger.\n- Supersedes the legacy Mongoose `@leumas-tech/leumas-schemas` and `leumas-schema-library`.\n",
  "source": {
    "path": "shared/packages/schemas/README.md",
    "blobSha": "",
    "commit": "",
    "committedAt": "",
    "provenance": "no-git",
    "bytes": 1942,
    "hash": "10b722309c2d3f2108a7dd399d76afe16a74c316"
  },
  "urls": {
    "html": "/p/packages/schemas",
    "json": "/docs/packages/schemas.json",
    "md": "/docs/packages/schemas.md"
  },
  "links": {
    "composes": [],
    "usedBy": [
      "pkg:@leumas/actions",
      "pkg:@leumas/admin",
      "pkg:@leumas/auth",
      "pkg:@leumas/chatbots",
      "pkg:@leumas/connectors",
      "pkg:@leumas/control",
      "pkg:@leumas/db",
      "pkg:@leumas/dynamic",
      "pkg:@leumas/features",
      "pkg:@leumas/licensing",
      "pkg:@leumas/mcp",
      "pkg:@leumas/middleware",
      "pkg:@leumas/progression",
      "pkg:@leumas/router-kit",
      "pkg:@leumas/social-service",
      "pkg:@leumas/studio"
    ],
    "product": [
      "pkg:@leumas/admin",
      "pkg:@leumas/studio",
      "pkg:@leumas/web"
    ],
    "howTo": [],
    "skills": []
  },
  "exports": {
    "total": 205,
    "component": 87,
    "hook": 0,
    "helper": 118,
    "names": [
      {
        "n": "ACCOUNT_STATUS",
        "k": "component"
      },
      {
        "n": "ACTION_IDS",
        "k": "component"
      },
      {
        "n": "ACTIONS",
        "k": "component"
      },
      {
        "n": "API_KEY_ENV",
        "k": "component"
      },
      {
        "n": "API_KEY_SCOPES",
        "k": "component"
      },
      {
        "n": "API_KEY_STATUS",
        "k": "component"
      },
      {
        "n": "ARTIFACT_KINDS",
        "k": "component"
      },
      {
        "n": "ARTIFACT_SCOPES",
        "k": "component"
      },
      {
        "n": "ARTIFACT_SCRATCH_ROOT",
        "k": "component"
      },
      {
        "n": "ARTIFACT_SOURCE_TYPES",
        "k": "component"
      },
      {
        "n": "ARTIFACT_VERSION",
        "k": "component"
      },
      {
        "n": "BADGE_REQUIREMENT_TYPE",
        "k": "component"
      },
      {
        "n": "CAPABILITY_POLICY_MODES",
        "k": "component"
      },
      {
        "n": "CAPTURE_SOURCES",
        "k": "component"
      },
      {
        "n": "CAPTURE_TRIGGERS",
        "k": "component"
      },
      {
        "n": "CONTROL_PLANE_DEPLOYMENTS",
        "k": "component"
      },
      {
        "n": "CONTROL_PLANE_ROLES",
        "k": "component"
      },
      {
        "n": "CONVERSATION_KIND",
        "k": "component"
      },
      {
        "n": "COSMETIC_SOURCE",
        "k": "component"
      },
      {
        "n": "COSMETIC_UNLOCK_TYPE",
        "k": "component"
      },
      {
        "n": "CSS_NAMED_COLORS",
        "k": "component"
      },
      {
        "n": "DECLARED_FROM",
        "k": "component"
      },
      {
        "n": "DOC_COLLECTIONS",
        "k": "component"
      },
      {
        "n": "DOC_SCHEMAS",
        "k": "component"
      },
      {
        "n": "ENTITY_IDS",
        "k": "component"
      },
      {
        "n": "ENTITY_TYPES",
        "k": "component"
      },
      {
        "n": "EXECUTOR_KINDS",
        "k": "component"
      },
      {
        "n": "FRIEND_REQUEST_STATUS",
        "k": "component"
      },
      {
        "n": "GROUP_VISIBILITY",
        "k": "component"
      },
      {
        "n": "GYM_BOOKING_STATUS",
        "k": "component"
      },
      {
        "n": "GYM_COACHING_STATUS",
        "k": "component"
      },
      {
        "n": "GYM_EFFORT_SCALE",
        "k": "component"
      },
      {
        "n": "GYM_GOAL_KIND",
        "k": "component"
      },
      {
        "n": "GYM_JOIN_POLICY",
        "k": "component"
      },
      {
        "n": "GYM_KIND",
        "k": "component"
      },
      {
        "n": "GYM_LOGGING_MODE",
        "k": "component"
      },
      {
        "n": "GYM_MEMBER_ROLE",
        "k": "component"
      },
      {
        "n": "GYM_MEMBER_STATUS",
        "k": "component"
      },
      {
        "n": "GYM_PLAN_INTERVAL",
        "k": "component"
      },
      {
        "n": "GYM_POLICY",
        "k": "component"
      },
      {
        "n": "GYM_SESSION_STATUS",
        "k": "component"
      },
      {
        "n": "GYM_SUBSCRIPTION_SOURCE",
        "k": "component"
      },
      {
        "n": "GYM_SUBSCRIPTION_STATUS",
        "k": "component"
      },
      {
        "n": "GYM_VISIT_SOURCE",
        "k": "component"
      },
      {
        "n": "HOUSE_COLOR_TABLE",
        "k": "component"
      },
      {
        "n": "LEUMAS_ID_STATUS",
        "k": "component"
      },
      {
        "n": "LICENSE_ACTIVATION_STATUS",
        "k": "component"
      },
      {
        "n": "LICENSE_STATUS",
        "k": "component"
      },
      {
        "n": "LISTING_STATUS",
        "k": "component"
      },
      {
        "n": "MEDIA_KIND",
        "k": "component"
      },
      {
        "n": "MEDIA_TYPE",
        "k": "component"
      },
      {
        "n": "MEMBERSHIP_STATUS",
        "k": "component"
      },
      {
        "n": "MESSAGE_KIND",
        "k": "component"
      },
      {
        "n": "MOD_ACTION",
        "k": "component"
      },
      {
        "n": "NOTIFICATION_TYPE",
        "k": "component"
      },
      {
        "n": "ORDER_STATUS",
        "k": "component"
      },
      {
        "n": "PASSNODE_TYPES",
        "k": "component"
      },
      {
        "n": "PAYOUT_STATUS",
        "k": "component"
      },
      {
        "n": "PERMISSIONS",
        "k": "component"
      },
      {
        "n": "POST_TYPE",
        "k": "component"
      },
      {
        "n": "POST_VISIBILITY",
        "k": "component"
      },
      {
        "n": "PUBLIC_DEPLOYMENTS",
        "k": "component"
      },
      {
        "n": "QR_CODE_KIND",
        "k": "component"
      },
      {
        "n": "QR_CODE_STATUS",
        "k": "component"
      },
      {
        "n": "QR_REPORT_STATUS",
        "k": "component"
      },
      {
        "n": "QUEST_STATUS",
        "k": "component"
      },
      {
        "n": "RARITY_KEYS",
        "k": "component"
      },
      {
        "n": "REPORT_STATUS",
        "k": "component"
      },
      {
        "n": "REPORT_TARGET",
        "k": "component"
      },
      {
        "n": "ROLES",
        "k": "component"
      },
      {
        "n": "RUNTIMES",
        "k": "component"
      },
      {
        "n": "SALE_TYPE",
        "k": "component"
      },
      {
        "n": "SCRATCH_ABANDONED_TTL_MS",
        "k": "component"
      },
      {
        "n": "SCRATCH_TTL_MS",
        "k": "component"
      },
      {
        "n": "SERVICE_IDS",
        "k": "component"
      },
      {
        "n": "SERVICES",
        "k": "component"
      },
      {
        "n": "SHAPE_IDS",
        "k": "component"
      },
      {
        "n": "SHAPES",
        "k": "component"
      },
      {
        "n": "SHOP_ORDER_STATUS",
        "k": "component"
      },
      {
        "n": "SING_CHALLENGE_STATUS",
        "k": "component"
      },
      {
        "n": "SING_GRADE",
        "k": "component"
      },
      {
        "n": "SING_MODE",
        "k": "component"
      },
      {
        "n": "SUBDIVISIONS",
        "k": "component"
      },
      {
        "n": "TOKEN_TXN_SOURCE",
        "k": "component"
      },
      {
        "n": "TOKEN_TXN_TYPE",
        "k": "component"
      },
      {
        "n": "TRUSTED_FROM",
        "k": "component"
      },
      {
        "n": "VOICE_ENGINES",
        "k": "component"
      },
      {
        "n": "actionDocSchema",
        "k": "helper"
      },
      {
        "n": "appointments",
        "k": "helper"
      },
      {
        "n": "approvals",
        "k": "helper"
      },
      {
        "n": "artifactKindOf",
        "k": "helper"
      },
      {
        "n": "assetToArtifact",
        "k": "helper"
      },
      {
        "n": "availabilityRules",
        "k": "helper"
      },
      {
        "n": "axesOf",
        "k": "helper"
      },
      {
        "n": "bucketOf",
        "k": "helper"
      },
      {
        "n": "capabilitySchema",
        "k": "helper"
      },
      {
        "n": "caseParticipants",
        "k": "helper"
      },
      {
        "n": "cases",
        "k": "helper"
      },
      {
        "n": "chatbotSchema",
        "k": "helper"
      },
      {
        "n": "checkClosedOptions",
        "k": "helper"
      },
      {
        "n": "createOptionsCache",
        "k": "helper"
      },
      {
        "n": "createOptionsResolver",
        "k": "helper"
      },
      {
        "n": "describeCallable",
        "k": "helper"
      },
      {
        "n": "describeOutputs",
        "k": "helper"
      },
      {
        "n": "displayName",
        "k": "helper"
      },
      {
        "n": "docInputs",
        "k": "helper"
      },
      {
        "n": "documents",
        "k": "helper"
      },
      {
        "n": "employments",
        "k": "helper"
      },
      {
        "n": "entityIdOf",
        "k": "helper"
      },
      {
        "n": "entityLabelOf",
        "k": "helper"
      },
      {
        "n": "entityOf",
        "k": "helper"
      },
      {
        "n": "extensionFor",
        "k": "helper"
      },
      {
        "n": "fieldTypeFor",
        "k": "helper"
      },
      {
        "n": "fillLabel",
        "k": "helper"
      },
      {
        "n": "fillTokens",
        "k": "helper"
      },
      {
        "n": "formDefinitions",
        "k": "helper"
      },
      {
        "n": "formSubmissions",
        "k": "helper"
      },
      {
        "n": "fromBase64",
        "k": "helper"
      },
      {
        "n": "functioncallSchema",
        "k": "helper"
      },
      {
        "n": "gradeClassification",
        "k": "helper"
      },
      {
        "n": "hintedEntity",
        "k": "helper"
      },
      {
        "n": "inferEntity",
        "k": "helper"
      },
      {
        "n": "inputsToFields",
        "k": "helper"
      },
      {
        "n": "inputsToJsonSchema",
        "k": "helper"
      },
      {
        "n": "insertCategorySchema",
        "k": "helper"
      },
      {
        "n": "insertCommentSchema",
        "k": "helper"
      },
      {
        "n": "insertDevApiKeySchema",
        "k": "helper"
      },
      {
        "n": "insertFriendRequestSchema",
        "k": "helper"
      },
      {
        "n": "insertGroupSchema",
        "k": "helper"
      },
      {
        "n": "insertListingSchema",
        "k": "helper"
      },
      {
        "n": "insertMediaAssetSchema",
        "k": "helper"
      },
      {
        "n": "insertMembershipSchema",
        "k": "helper"
      },
      {
        "n": "insertMessageSchema",
        "k": "helper"
      },
      {
        "n": "insertNotificationSchema",
        "k": "helper"
      },
      {
        "n": "insertPermissionSchema",
        "k": "helper"
      },
      {
        "n": "insertPlaylistSchema",
        "k": "helper"
      },
      {
        "n": "insertPostSchema",
        "k": "helper"
      },
      {
        "n": "insertProfileSchema",
        "k": "helper"
      },
      {
        "n": "insertReportSchema",
        "k": "helper"
      },
      {
        "n": "insertReviewSchema",
        "k": "helper"
      },
      {
        "n": "insertRoleSchema",
        "k": "helper"
      },
      {
        "n": "insertRoomSchema",
        "k": "helper"
      },
      {
        "n": "insertUserSchema",
        "k": "helper"
      },
      {
        "n": "insertValidators",
        "k": "helper"
      },
      {
        "n": "institutionEvents",
        "k": "helper"
      },
      {
        "n": "isAction",
        "k": "helper"
      },
      {
        "n": "isControlPlane",
        "k": "helper"
      },
      {
        "n": "isDeclared",
        "k": "helper"
      },
      {
        "n": "isExpired",
        "k": "helper"
      },
      {
        "n": "isPublicDeployment",
        "k": "helper"
      },
      {
        "n": "isService",
        "k": "helper"
      },
      {
        "n": "isShape",
        "k": "helper"
      },
      {
        "n": "isTrusted",
        "k": "helper"
      },
      {
        "n": "journals",
        "k": "helper"
      },
      {
        "n": "jsonSchemaShape",
        "k": "helper"
      },
      {
        "n": "jsonSchemaToDescriptors",
        "k": "helper"
      },
      {
        "n": "knownColorsOf",
        "k": "helper"
      },
      {
        "n": "knownSubdivision",
        "k": "helper"
      },
      {
        "n": "ledgerAccounts",
        "k": "helper"
      },
      {
        "n": "ledgerEntries",
        "k": "helper"
      },
      {
        "n": "makeArtifactMeta",
        "k": "helper"
      },
      {
        "n": "manifestSchema",
        "k": "helper"
      },
      {
        "n": "normalizeInputs",
        "k": "helper"
      },
      {
        "n": "normalizeOutputs",
        "k": "helper"
      },
      {
        "n": "optionFilterFacets",
        "k": "helper"
      },
      {
        "n": "optionsCacheKey",
        "k": "helper"
      },
      {
        "n": "optionsDependencies",
        "k": "helper"
      },
      {
        "n": "optionsReady",
        "k": "helper"
      },
      {
        "n": "optionsSourceOf",
        "k": "helper"
      },
      {
        "n": "organizations",
        "k": "helper"
      },
      {
        "n": "outputPaths",
        "k": "helper"
      },
      {
        "n": "outputsToJsonSchema",
        "k": "helper"
      },
      {
        "n": "outputsToRows",
        "k": "helper"
      },
      {
        "n": "passnodeRuleSchema",
        "k": "helper"
      },
      {
        "n": "personProfiles",
        "k": "helper"
      },
      {
        "n": "persons",
        "k": "helper"
      },
      {
        "n": "positions",
        "k": "helper"
      },
      {
        "n": "prefersPositional",
        "k": "helper"
      },
      {
        "n": "projectOptions",
        "k": "helper"
      },
      {
        "n": "providerManifestSchema",
        "k": "helper"
      },
      {
        "n": "readOnlyOperations",
        "k": "helper"
      },
      {
        "n": "reasonForBareId",
        "k": "helper"
      },
      {
        "n": "resolveEntity",
        "k": "helper"
      },
      {
        "n": "resolveFunctionSpec",
        "k": "helper"
      },
      {
        "n": "resources",
        "k": "helper"
      },
      {
        "n": "resultSchema",
        "k": "helper"
      },
      {
        "n": "roleGrants",
        "k": "helper"
      },
      {
        "n": "ruleSchema",
        "k": "helper"
      },
      {
        "n": "scratchBundleKey",
        "k": "helper"
      },
      {
        "n": "scratchFolderFor",
        "k": "helper"
      },
      {
        "n": "seedFromInputs",
        "k": "helper"
      },
      {
        "n": "selectionNote",
        "k": "helper"
      },
      {
        "n": "selectUserSchema",
        "k": "helper"
      },
      {
        "n": "selectVariants",
        "k": "helper"
      },
      {
        "n": "shapeOf",
        "k": "helper"
      },
      {
        "n": "subdivisionsOf",
        "k": "helper"
      },
      {
        "n": "swatchCoverage",
        "k": "helper"
      },
      {
        "n": "swatchFor",
        "k": "helper"
      },
      {
        "n": "tableInputs",
        "k": "helper"
      },
      {
        "n": "toBase64",
        "k": "helper"
      }
    ]
  }
}
