@kelpie/server 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/README.md +57 -0
- package/dist/app.d.ts +36 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +98 -0
- package/dist/app.js.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/actor.d.ts +71 -0
- package/dist/lib/actor.d.ts.map +1 -0
- package/dist/lib/actor.js +48 -0
- package/dist/lib/actor.js.map +1 -0
- package/dist/lib/changes.d.ts +17 -0
- package/dist/lib/changes.d.ts.map +1 -0
- package/dist/lib/changes.js +35 -0
- package/dist/lib/changes.js.map +1 -0
- package/dist/lib/columns.d.ts +152 -0
- package/dist/lib/columns.d.ts.map +1 -0
- package/dist/lib/columns.js +126 -0
- package/dist/lib/columns.js.map +1 -0
- package/dist/lib/config.d.ts +36 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +52 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/database.d.ts +57 -0
- package/dist/lib/database.d.ts.map +1 -0
- package/dist/lib/database.js +91 -0
- package/dist/lib/database.js.map +1 -0
- package/dist/lib/dates.d.ts +11 -0
- package/dist/lib/dates.d.ts.map +1 -0
- package/dist/lib/dates.js +17 -0
- package/dist/lib/dates.js.map +1 -0
- package/dist/lib/email.d.ts +42 -0
- package/dist/lib/email.d.ts.map +1 -0
- package/dist/lib/email.js +38 -0
- package/dist/lib/email.js.map +1 -0
- package/dist/lib/errors.d.ts +76 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +102 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/http.d.ts +59 -0
- package/dist/lib/http.d.ts.map +1 -0
- package/dist/lib/http.js +89 -0
- package/dist/lib/http.js.map +1 -0
- package/dist/lib/ids.d.ts +55 -0
- package/dist/lib/ids.d.ts.map +1 -0
- package/dist/lib/ids.js +56 -0
- package/dist/lib/ids.js.map +1 -0
- package/dist/lib/logger.d.ts +22 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +43 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/moduleConfig.d.ts +14 -0
- package/dist/lib/moduleConfig.d.ts.map +1 -0
- package/dist/lib/moduleConfig.js +56 -0
- package/dist/lib/moduleConfig.js.map +1 -0
- package/dist/lib/normalisation.d.ts +19 -0
- package/dist/lib/normalisation.d.ts.map +1 -0
- package/dist/lib/normalisation.js +32 -0
- package/dist/lib/normalisation.js.map +1 -0
- package/dist/lib/pagination.d.ts +104 -0
- package/dist/lib/pagination.d.ts.map +1 -0
- package/dist/lib/pagination.js +189 -0
- package/dist/lib/pagination.js.map +1 -0
- package/dist/lib/passwords.d.ts +32 -0
- package/dist/lib/passwords.d.ts.map +1 -0
- package/dist/lib/passwords.js +51 -0
- package/dist/lib/passwords.js.map +1 -0
- package/dist/lib/search.d.ts +11 -0
- package/dist/lib/search.d.ts.map +1 -0
- package/dist/lib/search.js +25 -0
- package/dist/lib/search.js.map +1 -0
- package/dist/lib/secrets.d.ts +40 -0
- package/dist/lib/secrets.d.ts.map +1 -0
- package/dist/lib/secrets.js +152 -0
- package/dist/lib/secrets.js.map +1 -0
- package/dist/lib/timezones.d.ts +38 -0
- package/dist/lib/timezones.d.ts.map +1 -0
- package/dist/lib/timezones.js +55 -0
- package/dist/lib/timezones.js.map +1 -0
- package/dist/lib/tokens.d.ts +10 -0
- package/dist/lib/tokens.d.ts.map +1 -0
- package/dist/lib/tokens.js +31 -0
- package/dist/lib/tokens.js.map +1 -0
- package/dist/lib/url.d.ts +25 -0
- package/dist/lib/url.d.ts.map +1 -0
- package/dist/lib/url.js +41 -0
- package/dist/lib/url.js.map +1 -0
- package/dist/modules/activities/index.d.ts +18 -0
- package/dist/modules/activities/index.d.ts.map +1 -0
- package/dist/modules/activities/index.js +34 -0
- package/dist/modules/activities/index.js.map +1 -0
- package/dist/modules/activities/recorder.d.ts +53 -0
- package/dist/modules/activities/recorder.d.ts.map +1 -0
- package/dist/modules/activities/recorder.js +36 -0
- package/dist/modules/activities/recorder.js.map +1 -0
- package/dist/modules/activities/repository.d.ts +52 -0
- package/dist/modules/activities/repository.d.ts.map +1 -0
- package/dist/modules/activities/repository.js +127 -0
- package/dist/modules/activities/repository.js.map +1 -0
- package/dist/modules/activities/routes.d.ts +17 -0
- package/dist/modules/activities/routes.d.ts.map +1 -0
- package/dist/modules/activities/routes.js +45 -0
- package/dist/modules/activities/routes.js.map +1 -0
- package/dist/modules/activities/schema.d.ts +188 -0
- package/dist/modules/activities/schema.d.ts.map +1 -0
- package/dist/modules/activities/schema.js +34 -0
- package/dist/modules/activities/schema.js.map +1 -0
- package/dist/modules/activities/service.d.ts +32 -0
- package/dist/modules/activities/service.d.ts.map +1 -0
- package/dist/modules/activities/service.js +28 -0
- package/dist/modules/activities/service.js.map +1 -0
- package/dist/modules/activities/tools.d.ts +4 -0
- package/dist/modules/activities/tools.d.ts.map +1 -0
- package/dist/modules/activities/tools.js +26 -0
- package/dist/modules/activities/tools.js.map +1 -0
- package/dist/modules/activities/wording.d.ts +79 -0
- package/dist/modules/activities/wording.d.ts.map +1 -0
- package/dist/modules/activities/wording.js +134 -0
- package/dist/modules/activities/wording.js.map +1 -0
- package/dist/modules/agent-tasks/catalog.d.ts +16 -0
- package/dist/modules/agent-tasks/catalog.d.ts.map +1 -0
- package/dist/modules/agent-tasks/catalog.js +694 -0
- package/dist/modules/agent-tasks/catalog.js.map +1 -0
- package/dist/modules/agent-tasks/dispatch.d.ts +61 -0
- package/dist/modules/agent-tasks/dispatch.d.ts.map +1 -0
- package/dist/modules/agent-tasks/dispatch.js +139 -0
- package/dist/modules/agent-tasks/dispatch.js.map +1 -0
- package/dist/modules/agent-tasks/index.d.ts +17 -0
- package/dist/modules/agent-tasks/index.d.ts.map +1 -0
- package/dist/modules/agent-tasks/index.js +54 -0
- package/dist/modules/agent-tasks/index.js.map +1 -0
- package/dist/modules/agent-tasks/prompt.d.ts +41 -0
- package/dist/modules/agent-tasks/prompt.d.ts.map +1 -0
- package/dist/modules/agent-tasks/prompt.js +78 -0
- package/dist/modules/agent-tasks/prompt.js.map +1 -0
- package/dist/modules/agent-tasks/repository.d.ts +32 -0
- package/dist/modules/agent-tasks/repository.d.ts.map +1 -0
- package/dist/modules/agent-tasks/repository.js +83 -0
- package/dist/modules/agent-tasks/repository.js.map +1 -0
- package/dist/modules/agent-tasks/resolve.d.ts +44 -0
- package/dist/modules/agent-tasks/resolve.d.ts.map +1 -0
- package/dist/modules/agent-tasks/resolve.js +396 -0
- package/dist/modules/agent-tasks/resolve.js.map +1 -0
- package/dist/modules/agent-tasks/routes.d.ts +55 -0
- package/dist/modules/agent-tasks/routes.d.ts.map +1 -0
- package/dist/modules/agent-tasks/routes.js +173 -0
- package/dist/modules/agent-tasks/routes.js.map +1 -0
- package/dist/modules/agent-tasks/schema.d.ts +346 -0
- package/dist/modules/agent-tasks/schema.d.ts.map +1 -0
- package/dist/modules/agent-tasks/schema.js +47 -0
- package/dist/modules/agent-tasks/schema.js.map +1 -0
- package/dist/modules/agent-tasks/service.d.ts +79 -0
- package/dist/modules/agent-tasks/service.d.ts.map +1 -0
- package/dist/modules/agent-tasks/service.js +210 -0
- package/dist/modules/agent-tasks/service.js.map +1 -0
- package/dist/modules/agent-tasks/wire.d.ts +35 -0
- package/dist/modules/agent-tasks/wire.d.ts.map +1 -0
- package/dist/modules/agent-tasks/wire.js +31 -0
- package/dist/modules/agent-tasks/wire.js.map +1 -0
- package/dist/modules/api-keys/index.d.ts +9 -0
- package/dist/modules/api-keys/index.d.ts.map +1 -0
- package/dist/modules/api-keys/index.js +29 -0
- package/dist/modules/api-keys/index.js.map +1 -0
- package/dist/modules/api-keys/keys.d.ts +25 -0
- package/dist/modules/api-keys/keys.d.ts.map +1 -0
- package/dist/modules/api-keys/keys.js +40 -0
- package/dist/modules/api-keys/keys.js.map +1 -0
- package/dist/modules/api-keys/repository.d.ts +15 -0
- package/dist/modules/api-keys/repository.d.ts.map +1 -0
- package/dist/modules/api-keys/repository.js +48 -0
- package/dist/modules/api-keys/repository.js.map +1 -0
- package/dist/modules/api-keys/routes.d.ts +8 -0
- package/dist/modules/api-keys/routes.d.ts.map +1 -0
- package/dist/modules/api-keys/routes.js +52 -0
- package/dist/modules/api-keys/routes.js.map +1 -0
- package/dist/modules/api-keys/schema.d.ts +166 -0
- package/dist/modules/api-keys/schema.d.ts.map +1 -0
- package/dist/modules/api-keys/schema.js +23 -0
- package/dist/modules/api-keys/schema.js.map +1 -0
- package/dist/modules/api-keys/service.d.ts +37 -0
- package/dist/modules/api-keys/service.d.ts.map +1 -0
- package/dist/modules/api-keys/service.js +95 -0
- package/dist/modules/api-keys/service.js.map +1 -0
- package/dist/modules/attachedRecords.d.ts +39 -0
- package/dist/modules/attachedRecords.d.ts.map +1 -0
- package/dist/modules/attachedRecords.js +52 -0
- package/dist/modules/attachedRecords.js.map +1 -0
- package/dist/modules/auth/actor.d.ts +11 -0
- package/dist/modules/auth/actor.d.ts.map +1 -0
- package/dist/modules/auth/actor.js +10 -0
- package/dist/modules/auth/actor.js.map +1 -0
- package/dist/modules/auth/credentials.d.ts +18 -0
- package/dist/modules/auth/credentials.d.ts.map +1 -0
- package/dist/modules/auth/credentials.js +105 -0
- package/dist/modules/auth/credentials.js.map +1 -0
- package/dist/modules/auth/index.d.ts +3 -0
- package/dist/modules/auth/index.d.ts.map +1 -0
- package/dist/modules/auth/index.js +41 -0
- package/dist/modules/auth/index.js.map +1 -0
- package/dist/modules/auth/preferences.d.ts +34 -0
- package/dist/modules/auth/preferences.d.ts.map +1 -0
- package/dist/modules/auth/preferences.js +30 -0
- package/dist/modules/auth/preferences.js.map +1 -0
- package/dist/modules/auth/repository.d.ts +54 -0
- package/dist/modules/auth/repository.d.ts.map +1 -0
- package/dist/modules/auth/repository.js +137 -0
- package/dist/modules/auth/repository.js.map +1 -0
- package/dist/modules/auth/routes.d.ts +10 -0
- package/dist/modules/auth/routes.d.ts.map +1 -0
- package/dist/modules/auth/routes.js +181 -0
- package/dist/modules/auth/routes.js.map +1 -0
- package/dist/modules/auth/schema.d.ts +530 -0
- package/dist/modules/auth/schema.d.ts.map +1 -0
- package/dist/modules/auth/schema.js +67 -0
- package/dist/modules/auth/schema.js.map +1 -0
- package/dist/modules/auth/service.d.ts +73 -0
- package/dist/modules/auth/service.d.ts.map +1 -0
- package/dist/modules/auth/service.js +288 -0
- package/dist/modules/auth/service.js.map +1 -0
- package/dist/modules/auth/session.d.ts +16 -0
- package/dist/modules/auth/session.d.ts.map +1 -0
- package/dist/modules/auth/session.js +30 -0
- package/dist/modules/auth/session.js.map +1 -0
- package/dist/modules/companies/index.d.ts +9 -0
- package/dist/modules/companies/index.d.ts.map +1 -0
- package/dist/modules/companies/index.js +37 -0
- package/dist/modules/companies/index.js.map +1 -0
- package/dist/modules/companies/repository.d.ts +40 -0
- package/dist/modules/companies/repository.d.ts.map +1 -0
- package/dist/modules/companies/repository.js +112 -0
- package/dist/modules/companies/repository.js.map +1 -0
- package/dist/modules/companies/routes.d.ts +89 -0
- package/dist/modules/companies/routes.d.ts.map +1 -0
- package/dist/modules/companies/routes.js +125 -0
- package/dist/modules/companies/routes.js.map +1 -0
- package/dist/modules/companies/schema.d.ts +381 -0
- package/dist/modules/companies/schema.d.ts.map +1 -0
- package/dist/modules/companies/schema.js +51 -0
- package/dist/modules/companies/schema.js.map +1 -0
- package/dist/modules/companies/service.d.ts +49 -0
- package/dist/modules/companies/service.d.ts.map +1 -0
- package/dist/modules/companies/service.js +184 -0
- package/dist/modules/companies/service.js.map +1 -0
- package/dist/modules/companies/tools.d.ts +4 -0
- package/dist/modules/companies/tools.d.ts.map +1 -0
- package/dist/modules/companies/tools.js +27 -0
- package/dist/modules/companies/tools.js.map +1 -0
- package/dist/modules/core.d.ts +21 -0
- package/dist/modules/core.d.ts.map +1 -0
- package/dist/modules/core.js +82 -0
- package/dist/modules/core.js.map +1 -0
- package/dist/modules/crudTools.d.ts +99 -0
- package/dist/modules/crudTools.d.ts.map +1 -0
- package/dist/modules/crudTools.js +123 -0
- package/dist/modules/crudTools.js.map +1 -0
- package/dist/modules/dashboard/attention.d.ts +39 -0
- package/dist/modules/dashboard/attention.d.ts.map +1 -0
- package/dist/modules/dashboard/attention.js +57 -0
- package/dist/modules/dashboard/attention.js.map +1 -0
- package/dist/modules/dashboard/index.d.ts +15 -0
- package/dist/modules/dashboard/index.d.ts.map +1 -0
- package/dist/modules/dashboard/index.js +44 -0
- package/dist/modules/dashboard/index.js.map +1 -0
- package/dist/modules/dashboard/repository.d.ts +83 -0
- package/dist/modules/dashboard/repository.d.ts.map +1 -0
- package/dist/modules/dashboard/repository.js +217 -0
- package/dist/modules/dashboard/repository.js.map +1 -0
- package/dist/modules/dashboard/routes.d.ts +21 -0
- package/dist/modules/dashboard/routes.d.ts.map +1 -0
- package/dist/modules/dashboard/routes.js +116 -0
- package/dist/modules/dashboard/routes.js.map +1 -0
- package/dist/modules/dashboard/service.d.ts +122 -0
- package/dist/modules/dashboard/service.d.ts.map +1 -0
- package/dist/modules/dashboard/service.js +215 -0
- package/dist/modules/dashboard/service.js.map +1 -0
- package/dist/modules/dashboard/tools.d.ts +4 -0
- package/dist/modules/dashboard/tools.d.ts.map +1 -0
- package/dist/modules/dashboard/tools.js +33 -0
- package/dist/modules/dashboard/tools.js.map +1 -0
- package/dist/modules/deals/index.d.ts +11 -0
- package/dist/modules/deals/index.d.ts.map +1 -0
- package/dist/modules/deals/index.js +38 -0
- package/dist/modules/deals/index.js.map +1 -0
- package/dist/modules/deals/repository.d.ts +44 -0
- package/dist/modules/deals/repository.d.ts.map +1 -0
- package/dist/modules/deals/repository.js +160 -0
- package/dist/modules/deals/repository.js.map +1 -0
- package/dist/modules/deals/routes.d.ts +50 -0
- package/dist/modules/deals/routes.d.ts.map +1 -0
- package/dist/modules/deals/routes.js +132 -0
- package/dist/modules/deals/routes.js.map +1 -0
- package/dist/modules/deals/schema.d.ts +419 -0
- package/dist/modules/deals/schema.d.ts.map +1 -0
- package/dist/modules/deals/schema.js +61 -0
- package/dist/modules/deals/schema.js.map +1 -0
- package/dist/modules/deals/service.d.ts +71 -0
- package/dist/modules/deals/service.d.ts.map +1 -0
- package/dist/modules/deals/service.js +277 -0
- package/dist/modules/deals/service.js.map +1 -0
- package/dist/modules/deals/tools.d.ts +4 -0
- package/dist/modules/deals/tools.d.ts.map +1 -0
- package/dist/modules/deals/tools.js +33 -0
- package/dist/modules/deals/tools.js.map +1 -0
- package/dist/modules/decisions/index.d.ts +11 -0
- package/dist/modules/decisions/index.d.ts.map +1 -0
- package/dist/modules/decisions/index.js +34 -0
- package/dist/modules/decisions/index.js.map +1 -0
- package/dist/modules/decisions/repository.d.ts +38 -0
- package/dist/modules/decisions/repository.d.ts.map +1 -0
- package/dist/modules/decisions/repository.js +126 -0
- package/dist/modules/decisions/repository.js.map +1 -0
- package/dist/modules/decisions/routes.d.ts +42 -0
- package/dist/modules/decisions/routes.d.ts.map +1 -0
- package/dist/modules/decisions/routes.js +131 -0
- package/dist/modules/decisions/routes.js.map +1 -0
- package/dist/modules/decisions/schema.d.ts +228 -0
- package/dist/modules/decisions/schema.d.ts.map +1 -0
- package/dist/modules/decisions/schema.js +41 -0
- package/dist/modules/decisions/schema.js.map +1 -0
- package/dist/modules/decisions/service.d.ts +60 -0
- package/dist/modules/decisions/service.d.ts.map +1 -0
- package/dist/modules/decisions/service.js +122 -0
- package/dist/modules/decisions/service.js.map +1 -0
- package/dist/modules/decisions/tools.d.ts +4 -0
- package/dist/modules/decisions/tools.d.ts.map +1 -0
- package/dist/modules/decisions/tools.js +32 -0
- package/dist/modules/decisions/tools.js.map +1 -0
- package/dist/modules/forms/embed.d.ts +50 -0
- package/dist/modules/forms/embed.d.ts.map +1 -0
- package/dist/modules/forms/embed.js +236 -0
- package/dist/modules/forms/embed.js.map +1 -0
- package/dist/modules/forms/fields.d.ts +71 -0
- package/dist/modules/forms/fields.d.ts.map +1 -0
- package/dist/modules/forms/fields.js +122 -0
- package/dist/modules/forms/fields.js.map +1 -0
- package/dist/modules/forms/index.d.ts +15 -0
- package/dist/modules/forms/index.d.ts.map +1 -0
- package/dist/modules/forms/index.js +53 -0
- package/dist/modules/forms/index.js.map +1 -0
- package/dist/modules/forms/mapping.d.ts +99 -0
- package/dist/modules/forms/mapping.d.ts.map +1 -0
- package/dist/modules/forms/mapping.js +152 -0
- package/dist/modules/forms/mapping.js.map +1 -0
- package/dist/modules/forms/publicRoutes.d.ts +11 -0
- package/dist/modules/forms/publicRoutes.d.ts.map +1 -0
- package/dist/modules/forms/publicRoutes.js +68 -0
- package/dist/modules/forms/publicRoutes.js.map +1 -0
- package/dist/modules/forms/repository.d.ts +65 -0
- package/dist/modules/forms/repository.d.ts.map +1 -0
- package/dist/modules/forms/repository.js +139 -0
- package/dist/modules/forms/repository.js.map +1 -0
- package/dist/modules/forms/routes.d.ts +106 -0
- package/dist/modules/forms/routes.d.ts.map +1 -0
- package/dist/modules/forms/routes.js +204 -0
- package/dist/modules/forms/routes.js.map +1 -0
- package/dist/modules/forms/schema.d.ts +643 -0
- package/dist/modules/forms/schema.d.ts.map +1 -0
- package/dist/modules/forms/schema.js +87 -0
- package/dist/modules/forms/schema.js.map +1 -0
- package/dist/modules/forms/service.d.ts +62 -0
- package/dist/modules/forms/service.d.ts.map +1 -0
- package/dist/modules/forms/service.js +208 -0
- package/dist/modules/forms/service.js.map +1 -0
- package/dist/modules/forms/submission.d.ts +30 -0
- package/dist/modules/forms/submission.d.ts.map +1 -0
- package/dist/modules/forms/submission.js +337 -0
- package/dist/modules/forms/submission.js.map +1 -0
- package/dist/modules/forms/tools.d.ts +4 -0
- package/dist/modules/forms/tools.d.ts.map +1 -0
- package/dist/modules/forms/tools.js +46 -0
- package/dist/modules/forms/tools.js.map +1 -0
- package/dist/modules/handbook/index.d.ts +15 -0
- package/dist/modules/handbook/index.d.ts.map +1 -0
- package/dist/modules/handbook/index.js +37 -0
- package/dist/modules/handbook/index.js.map +1 -0
- package/dist/modules/handbook/repository.d.ts +52 -0
- package/dist/modules/handbook/repository.d.ts.map +1 -0
- package/dist/modules/handbook/repository.js +109 -0
- package/dist/modules/handbook/repository.js.map +1 -0
- package/dist/modules/handbook/routes.d.ts +38 -0
- package/dist/modules/handbook/routes.d.ts.map +1 -0
- package/dist/modules/handbook/routes.js +103 -0
- package/dist/modules/handbook/routes.js.map +1 -0
- package/dist/modules/handbook/schema.d.ts +206 -0
- package/dist/modules/handbook/schema.d.ts.map +1 -0
- package/dist/modules/handbook/schema.js +37 -0
- package/dist/modules/handbook/schema.js.map +1 -0
- package/dist/modules/handbook/service.d.ts +59 -0
- package/dist/modules/handbook/service.d.ts.map +1 -0
- package/dist/modules/handbook/service.js +246 -0
- package/dist/modules/handbook/service.js.map +1 -0
- package/dist/modules/handbook/slugs.d.ts +28 -0
- package/dist/modules/handbook/slugs.d.ts.map +1 -0
- package/dist/modules/handbook/slugs.js +48 -0
- package/dist/modules/handbook/slugs.js.map +1 -0
- package/dist/modules/handbook/tools.d.ts +4 -0
- package/dist/modules/handbook/tools.d.ts.map +1 -0
- package/dist/modules/handbook/tools.js +26 -0
- package/dist/modules/handbook/tools.js.map +1 -0
- package/dist/modules/handbook/tree.d.ts +69 -0
- package/dist/modules/handbook/tree.d.ts.map +1 -0
- package/dist/modules/handbook/tree.js +117 -0
- package/dist/modules/handbook/tree.js.map +1 -0
- package/dist/modules/hiring/candidates.d.ts +70 -0
- package/dist/modules/hiring/candidates.d.ts.map +1 -0
- package/dist/modules/hiring/candidates.js +243 -0
- package/dist/modules/hiring/candidates.js.map +1 -0
- package/dist/modules/hiring/index.d.ts +15 -0
- package/dist/modules/hiring/index.d.ts.map +1 -0
- package/dist/modules/hiring/index.js +48 -0
- package/dist/modules/hiring/index.js.map +1 -0
- package/dist/modules/hiring/repository.d.ts +52 -0
- package/dist/modules/hiring/repository.d.ts.map +1 -0
- package/dist/modules/hiring/repository.js +137 -0
- package/dist/modules/hiring/repository.js.map +1 -0
- package/dist/modules/hiring/roles.d.ts +42 -0
- package/dist/modules/hiring/roles.d.ts.map +1 -0
- package/dist/modules/hiring/roles.js +104 -0
- package/dist/modules/hiring/roles.js.map +1 -0
- package/dist/modules/hiring/routes.d.ts +73 -0
- package/dist/modules/hiring/routes.d.ts.map +1 -0
- package/dist/modules/hiring/routes.js +170 -0
- package/dist/modules/hiring/routes.js.map +1 -0
- package/dist/modules/hiring/schema.d.ts +308 -0
- package/dist/modules/hiring/schema.d.ts.map +1 -0
- package/dist/modules/hiring/schema.js +62 -0
- package/dist/modules/hiring/schema.js.map +1 -0
- package/dist/modules/hiring/tools.d.ts +8 -0
- package/dist/modules/hiring/tools.d.ts.map +1 -0
- package/dist/modules/hiring/tools.js +50 -0
- package/dist/modules/hiring/tools.js.map +1 -0
- package/dist/modules/import-export/csv.d.ts +47 -0
- package/dist/modules/import-export/csv.d.ts.map +1 -0
- package/dist/modules/import-export/csv.js +138 -0
- package/dist/modules/import-export/csv.js.map +1 -0
- package/dist/modules/import-export/drafts.d.ts +83 -0
- package/dist/modules/import-export/drafts.d.ts.map +1 -0
- package/dist/modules/import-export/drafts.js +97 -0
- package/dist/modules/import-export/drafts.js.map +1 -0
- package/dist/modules/import-export/exportRows.d.ts +8 -0
- package/dist/modules/import-export/exportRows.d.ts.map +1 -0
- package/dist/modules/import-export/exportRows.js +71 -0
- package/dist/modules/import-export/exportRows.js.map +1 -0
- package/dist/modules/import-export/index.d.ts +15 -0
- package/dist/modules/import-export/index.d.ts.map +1 -0
- package/dist/modules/import-export/index.js +43 -0
- package/dist/modules/import-export/index.js.map +1 -0
- package/dist/modules/import-export/mapping.d.ts +46 -0
- package/dist/modules/import-export/mapping.d.ts.map +1 -0
- package/dist/modules/import-export/mapping.js +115 -0
- package/dist/modules/import-export/mapping.js.map +1 -0
- package/dist/modules/import-export/plan.d.ts +107 -0
- package/dist/modules/import-export/plan.d.ts.map +1 -0
- package/dist/modules/import-export/plan.js +178 -0
- package/dist/modules/import-export/plan.js.map +1 -0
- package/dist/modules/import-export/presets.d.ts +39 -0
- package/dist/modules/import-export/presets.d.ts.map +1 -0
- package/dist/modules/import-export/presets.js +151 -0
- package/dist/modules/import-export/presets.js.map +1 -0
- package/dist/modules/import-export/repository.d.ts +171 -0
- package/dist/modules/import-export/repository.d.ts.map +1 -0
- package/dist/modules/import-export/repository.js +343 -0
- package/dist/modules/import-export/repository.js.map +1 -0
- package/dist/modules/import-export/routes.d.ts +9 -0
- package/dist/modules/import-export/routes.d.ts.map +1 -0
- package/dist/modules/import-export/routes.js +199 -0
- package/dist/modules/import-export/routes.js.map +1 -0
- package/dist/modules/import-export/schema.d.ts +494 -0
- package/dist/modules/import-export/schema.d.ts.map +1 -0
- package/dist/modules/import-export/schema.js +99 -0
- package/dist/modules/import-export/schema.js.map +1 -0
- package/dist/modules/import-export/service.d.ts +74 -0
- package/dist/modules/import-export/service.d.ts.map +1 -0
- package/dist/modules/import-export/service.js +561 -0
- package/dist/modules/import-export/service.js.map +1 -0
- package/dist/modules/import-export/streams.d.ts +4 -0
- package/dist/modules/import-export/streams.d.ts.map +1 -0
- package/dist/modules/import-export/streams.js +55 -0
- package/dist/modules/import-export/streams.js.map +1 -0
- package/dist/modules/import-export/tools.d.ts +22 -0
- package/dist/modules/import-export/tools.d.ts.map +1 -0
- package/dist/modules/import-export/tools.js +116 -0
- package/dist/modules/import-export/tools.js.map +1 -0
- package/dist/modules/import-export/validation.d.ts +7 -0
- package/dist/modules/import-export/validation.d.ts.map +1 -0
- package/dist/modules/import-export/validation.js +114 -0
- package/dist/modules/import-export/validation.js.map +1 -0
- package/dist/modules/import-export/writes.d.ts +45 -0
- package/dist/modules/import-export/writes.d.ts.map +1 -0
- package/dist/modules/import-export/writes.js +247 -0
- package/dist/modules/import-export/writes.js.map +1 -0
- package/dist/modules/integrations/schema.d.ts +185 -0
- package/dist/modules/integrations/schema.d.ts.map +1 -0
- package/dist/modules/integrations/schema.js +26 -0
- package/dist/modules/integrations/schema.js.map +1 -0
- package/dist/modules/mcp/index.d.ts +26 -0
- package/dist/modules/mcp/index.d.ts.map +1 -0
- package/dist/modules/mcp/index.js +45 -0
- package/dist/modules/mcp/index.js.map +1 -0
- package/dist/modules/mcp/protocol.d.ts +166 -0
- package/dist/modules/mcp/protocol.d.ts.map +1 -0
- package/dist/modules/mcp/protocol.js +292 -0
- package/dist/modules/mcp/protocol.js.map +1 -0
- package/dist/modules/mcp/router.d.ts +23 -0
- package/dist/modules/mcp/router.d.ts.map +1 -0
- package/dist/modules/mcp/router.js +298 -0
- package/dist/modules/mcp/router.js.map +1 -0
- package/dist/modules/notes/index.d.ts +9 -0
- package/dist/modules/notes/index.d.ts.map +1 -0
- package/dist/modules/notes/index.js +37 -0
- package/dist/modules/notes/index.js.map +1 -0
- package/dist/modules/notes/repository.d.ts +34 -0
- package/dist/modules/notes/repository.d.ts.map +1 -0
- package/dist/modules/notes/repository.js +70 -0
- package/dist/modules/notes/repository.js.map +1 -0
- package/dist/modules/notes/routes.d.ts +37 -0
- package/dist/modules/notes/routes.d.ts.map +1 -0
- package/dist/modules/notes/routes.js +124 -0
- package/dist/modules/notes/routes.js.map +1 -0
- package/dist/modules/notes/schema.d.ts +176 -0
- package/dist/modules/notes/schema.d.ts.map +1 -0
- package/dist/modules/notes/schema.js +35 -0
- package/dist/modules/notes/schema.js.map +1 -0
- package/dist/modules/notes/service.d.ts +49 -0
- package/dist/modules/notes/service.d.ts.map +1 -0
- package/dist/modules/notes/service.js +118 -0
- package/dist/modules/notes/service.js.map +1 -0
- package/dist/modules/notes/tools.d.ts +4 -0
- package/dist/modules/notes/tools.d.ts.map +1 -0
- package/dist/modules/notes/tools.js +41 -0
- package/dist/modules/notes/tools.js.map +1 -0
- package/dist/modules/opportunities/index.d.ts +11 -0
- package/dist/modules/opportunities/index.d.ts.map +1 -0
- package/dist/modules/opportunities/index.js +38 -0
- package/dist/modules/opportunities/index.js.map +1 -0
- package/dist/modules/opportunities/repository.d.ts +28 -0
- package/dist/modules/opportunities/repository.d.ts.map +1 -0
- package/dist/modules/opportunities/repository.js +89 -0
- package/dist/modules/opportunities/repository.js.map +1 -0
- package/dist/modules/opportunities/routes.d.ts +39 -0
- package/dist/modules/opportunities/routes.d.ts.map +1 -0
- package/dist/modules/opportunities/routes.js +104 -0
- package/dist/modules/opportunities/routes.js.map +1 -0
- package/dist/modules/opportunities/schema.d.ts +266 -0
- package/dist/modules/opportunities/schema.d.ts.map +1 -0
- package/dist/modules/opportunities/schema.js +41 -0
- package/dist/modules/opportunities/schema.js.map +1 -0
- package/dist/modules/opportunities/service.d.ts +60 -0
- package/dist/modules/opportunities/service.d.ts.map +1 -0
- package/dist/modules/opportunities/service.js +212 -0
- package/dist/modules/opportunities/service.js.map +1 -0
- package/dist/modules/opportunities/tools.d.ts +4 -0
- package/dist/modules/opportunities/tools.d.ts.map +1 -0
- package/dist/modules/opportunities/tools.js +33 -0
- package/dist/modules/opportunities/tools.js.map +1 -0
- package/dist/modules/partnerships/index.d.ts +11 -0
- package/dist/modules/partnerships/index.d.ts.map +1 -0
- package/dist/modules/partnerships/index.js +38 -0
- package/dist/modules/partnerships/index.js.map +1 -0
- package/dist/modules/partnerships/repository.d.ts +47 -0
- package/dist/modules/partnerships/repository.d.ts.map +1 -0
- package/dist/modules/partnerships/repository.js +169 -0
- package/dist/modules/partnerships/repository.js.map +1 -0
- package/dist/modules/partnerships/routes.d.ts +46 -0
- package/dist/modules/partnerships/routes.d.ts.map +1 -0
- package/dist/modules/partnerships/routes.js +122 -0
- package/dist/modules/partnerships/routes.js.map +1 -0
- package/dist/modules/partnerships/schema.d.ts +338 -0
- package/dist/modules/partnerships/schema.d.ts.map +1 -0
- package/dist/modules/partnerships/schema.js +54 -0
- package/dist/modules/partnerships/schema.js.map +1 -0
- package/dist/modules/partnerships/service.d.ts +71 -0
- package/dist/modules/partnerships/service.d.ts.map +1 -0
- package/dist/modules/partnerships/service.js +273 -0
- package/dist/modules/partnerships/service.js.map +1 -0
- package/dist/modules/partnerships/tools.d.ts +4 -0
- package/dist/modules/partnerships/tools.d.ts.map +1 -0
- package/dist/modules/partnerships/tools.js +35 -0
- package/dist/modules/partnerships/tools.js.map +1 -0
- package/dist/modules/people/index.d.ts +9 -0
- package/dist/modules/people/index.d.ts.map +1 -0
- package/dist/modules/people/index.js +37 -0
- package/dist/modules/people/index.js.map +1 -0
- package/dist/modules/people/repository.d.ts +31 -0
- package/dist/modules/people/repository.d.ts.map +1 -0
- package/dist/modules/people/repository.js +109 -0
- package/dist/modules/people/repository.js.map +1 -0
- package/dist/modules/people/routes.d.ts +111 -0
- package/dist/modules/people/routes.d.ts.map +1 -0
- package/dist/modules/people/routes.js +134 -0
- package/dist/modules/people/routes.js.map +1 -0
- package/dist/modules/people/schema.d.ts +354 -0
- package/dist/modules/people/schema.d.ts.map +1 -0
- package/dist/modules/people/schema.js +61 -0
- package/dist/modules/people/schema.js.map +1 -0
- package/dist/modules/people/service.d.ts +56 -0
- package/dist/modules/people/service.d.ts.map +1 -0
- package/dist/modules/people/service.js +190 -0
- package/dist/modules/people/service.js.map +1 -0
- package/dist/modules/people/tools.d.ts +4 -0
- package/dist/modules/people/tools.d.ts.map +1 -0
- package/dist/modules/people/tools.js +27 -0
- package/dist/modules/people/tools.js.map +1 -0
- package/dist/modules/pipelines/index.d.ts +9 -0
- package/dist/modules/pipelines/index.d.ts.map +1 -0
- package/dist/modules/pipelines/index.js +37 -0
- package/dist/modules/pipelines/index.js.map +1 -0
- package/dist/modules/pipelines/repository.d.ts +26 -0
- package/dist/modules/pipelines/repository.d.ts.map +1 -0
- package/dist/modules/pipelines/repository.js +67 -0
- package/dist/modules/pipelines/repository.js.map +1 -0
- package/dist/modules/pipelines/routes.d.ts +33 -0
- package/dist/modules/pipelines/routes.d.ts.map +1 -0
- package/dist/modules/pipelines/routes.js +98 -0
- package/dist/modules/pipelines/routes.js.map +1 -0
- package/dist/modules/pipelines/schema.d.ts +170 -0
- package/dist/modules/pipelines/schema.d.ts.map +1 -0
- package/dist/modules/pipelines/schema.js +30 -0
- package/dist/modules/pipelines/schema.js.map +1 -0
- package/dist/modules/pipelines/service.d.ts +49 -0
- package/dist/modules/pipelines/service.d.ts.map +1 -0
- package/dist/modules/pipelines/service.js +227 -0
- package/dist/modules/pipelines/service.js.map +1 -0
- package/dist/modules/pipelines/tools.d.ts +4 -0
- package/dist/modules/pipelines/tools.d.ts.map +1 -0
- package/dist/modules/pipelines/tools.js +43 -0
- package/dist/modules/pipelines/tools.js.map +1 -0
- package/dist/modules/plans/index.d.ts +10 -0
- package/dist/modules/plans/index.d.ts.map +1 -0
- package/dist/modules/plans/index.js +33 -0
- package/dist/modules/plans/index.js.map +1 -0
- package/dist/modules/plans/repository.d.ts +49 -0
- package/dist/modules/plans/repository.d.ts.map +1 -0
- package/dist/modules/plans/repository.js +94 -0
- package/dist/modules/plans/repository.js.map +1 -0
- package/dist/modules/plans/routes.d.ts +46 -0
- package/dist/modules/plans/routes.d.ts.map +1 -0
- package/dist/modules/plans/routes.js +152 -0
- package/dist/modules/plans/routes.js.map +1 -0
- package/dist/modules/plans/schema.d.ts +209 -0
- package/dist/modules/plans/schema.d.ts.map +1 -0
- package/dist/modules/plans/schema.js +37 -0
- package/dist/modules/plans/schema.js.map +1 -0
- package/dist/modules/plans/service.d.ts +57 -0
- package/dist/modules/plans/service.d.ts.map +1 -0
- package/dist/modules/plans/service.js +125 -0
- package/dist/modules/plans/service.js.map +1 -0
- package/dist/modules/plans/tools.d.ts +4 -0
- package/dist/modules/plans/tools.d.ts.map +1 -0
- package/dist/modules/plans/tools.js +39 -0
- package/dist/modules/plans/tools.js.map +1 -0
- package/dist/modules/positions/index.d.ts +9 -0
- package/dist/modules/positions/index.d.ts.map +1 -0
- package/dist/modules/positions/index.js +36 -0
- package/dist/modules/positions/index.js.map +1 -0
- package/dist/modules/positions/repository.d.ts +34 -0
- package/dist/modules/positions/repository.d.ts.map +1 -0
- package/dist/modules/positions/repository.js +71 -0
- package/dist/modules/positions/repository.js.map +1 -0
- package/dist/modules/positions/routes.d.ts +22 -0
- package/dist/modules/positions/routes.d.ts.map +1 -0
- package/dist/modules/positions/routes.js +56 -0
- package/dist/modules/positions/routes.js.map +1 -0
- package/dist/modules/positions/schema.d.ts +154 -0
- package/dist/modules/positions/schema.d.ts.map +1 -0
- package/dist/modules/positions/schema.js +36 -0
- package/dist/modules/positions/schema.js.map +1 -0
- package/dist/modules/positions/service.d.ts +46 -0
- package/dist/modules/positions/service.d.ts.map +1 -0
- package/dist/modules/positions/service.js +159 -0
- package/dist/modules/positions/service.js.map +1 -0
- package/dist/modules/positions/tools.d.ts +4 -0
- package/dist/modules/positions/tools.d.ts.map +1 -0
- package/dist/modules/positions/tools.js +26 -0
- package/dist/modules/positions/tools.js.map +1 -0
- package/dist/modules/raises/index.d.ts +11 -0
- package/dist/modules/raises/index.d.ts.map +1 -0
- package/dist/modules/raises/index.js +38 -0
- package/dist/modules/raises/index.js.map +1 -0
- package/dist/modules/raises/repository.d.ts +48 -0
- package/dist/modules/raises/repository.d.ts.map +1 -0
- package/dist/modules/raises/repository.js +164 -0
- package/dist/modules/raises/repository.js.map +1 -0
- package/dist/modules/raises/routes.d.ts +48 -0
- package/dist/modules/raises/routes.d.ts.map +1 -0
- package/dist/modules/raises/routes.js +126 -0
- package/dist/modules/raises/routes.js.map +1 -0
- package/dist/modules/raises/schema.d.ts +356 -0
- package/dist/modules/raises/schema.d.ts.map +1 -0
- package/dist/modules/raises/schema.js +55 -0
- package/dist/modules/raises/schema.js.map +1 -0
- package/dist/modules/raises/service.d.ts +79 -0
- package/dist/modules/raises/service.d.ts.map +1 -0
- package/dist/modules/raises/service.js +275 -0
- package/dist/modules/raises/service.js.map +1 -0
- package/dist/modules/raises/tools.d.ts +4 -0
- package/dist/modules/raises/tools.d.ts.map +1 -0
- package/dist/modules/raises/tools.js +33 -0
- package/dist/modules/raises/tools.js.map +1 -0
- package/dist/modules/recordTargets.d.ts +55 -0
- package/dist/modules/recordTargets.d.ts.map +1 -0
- package/dist/modules/recordTargets.js +107 -0
- package/dist/modules/recordTargets.js.map +1 -0
- package/dist/modules/references.d.ts +8 -0
- package/dist/modules/references.d.ts.map +1 -0
- package/dist/modules/references.js +40 -0
- package/dist/modules/references.js.map +1 -0
- package/dist/modules/reseal.d.ts +33 -0
- package/dist/modules/reseal.d.ts.map +1 -0
- package/dist/modules/reseal.js +108 -0
- package/dist/modules/reseal.js.map +1 -0
- package/dist/modules/search/index.d.ts +21 -0
- package/dist/modules/search/index.d.ts.map +1 -0
- package/dist/modules/search/index.js +50 -0
- package/dist/modules/search/index.js.map +1 -0
- package/dist/modules/search/query.d.ts +44 -0
- package/dist/modules/search/query.d.ts.map +1 -0
- package/dist/modules/search/query.js +88 -0
- package/dist/modules/search/query.js.map +1 -0
- package/dist/modules/search/repository.d.ts +44 -0
- package/dist/modules/search/repository.d.ts.map +1 -0
- package/dist/modules/search/repository.js +252 -0
- package/dist/modules/search/repository.js.map +1 -0
- package/dist/modules/search/routes.d.ts +17 -0
- package/dist/modules/search/routes.d.ts.map +1 -0
- package/dist/modules/search/routes.js +93 -0
- package/dist/modules/search/routes.js.map +1 -0
- package/dist/modules/search/service.d.ts +55 -0
- package/dist/modules/search/service.d.ts.map +1 -0
- package/dist/modules/search/service.js +69 -0
- package/dist/modules/search/service.js.map +1 -0
- package/dist/modules/search/tools.d.ts +4 -0
- package/dist/modules/search/tools.d.ts.map +1 -0
- package/dist/modules/search/tools.js +52 -0
- package/dist/modules/search/tools.js.map +1 -0
- package/dist/modules/stagedRecords.d.ts +28 -0
- package/dist/modules/stagedRecords.d.ts.map +1 -0
- package/dist/modules/stagedRecords.js +50 -0
- package/dist/modules/stagedRecords.js.map +1 -0
- package/dist/modules/webhooks/delivery.d.ts +98 -0
- package/dist/modules/webhooks/delivery.d.ts.map +1 -0
- package/dist/modules/webhooks/delivery.js +237 -0
- package/dist/modules/webhooks/delivery.js.map +1 -0
- package/dist/modules/webhooks/index.d.ts +23 -0
- package/dist/modules/webhooks/index.d.ts.map +1 -0
- package/dist/modules/webhooks/index.js +48 -0
- package/dist/modules/webhooks/index.js.map +1 -0
- package/dist/modules/webhooks/payloads.d.ts +31 -0
- package/dist/modules/webhooks/payloads.d.ts.map +1 -0
- package/dist/modules/webhooks/payloads.js +52 -0
- package/dist/modules/webhooks/payloads.js.map +1 -0
- package/dist/modules/webhooks/repository.d.ts +70 -0
- package/dist/modules/webhooks/repository.d.ts.map +1 -0
- package/dist/modules/webhooks/repository.js +140 -0
- package/dist/modules/webhooks/repository.js.map +1 -0
- package/dist/modules/webhooks/routes.d.ts +47 -0
- package/dist/modules/webhooks/routes.d.ts.map +1 -0
- package/dist/modules/webhooks/routes.js +170 -0
- package/dist/modules/webhooks/routes.js.map +1 -0
- package/dist/modules/webhooks/schema.d.ts +396 -0
- package/dist/modules/webhooks/schema.d.ts.map +1 -0
- package/dist/modules/webhooks/schema.js +61 -0
- package/dist/modules/webhooks/schema.js.map +1 -0
- package/dist/modules/webhooks/service.d.ts +65 -0
- package/dist/modules/webhooks/service.d.ts.map +1 -0
- package/dist/modules/webhooks/service.js +202 -0
- package/dist/modules/webhooks/service.js.map +1 -0
- package/dist/modules/webhooks/signing.d.ts +57 -0
- package/dist/modules/webhooks/signing.d.ts.map +1 -0
- package/dist/modules/webhooks/signing.js +69 -0
- package/dist/modules/webhooks/signing.js.map +1 -0
- package/dist/modules/webhooks/tools.d.ts +4 -0
- package/dist/modules/webhooks/tools.d.ts.map +1 -0
- package/dist/modules/webhooks/tools.js +77 -0
- package/dist/modules/webhooks/tools.js.map +1 -0
- package/dist/modules/webhooks/url.d.ts +10 -0
- package/dist/modules/webhooks/url.d.ts.map +1 -0
- package/dist/modules/webhooks/url.js +9 -0
- package/dist/modules/webhooks/url.js.map +1 -0
- package/dist/modules/workspace/capabilities.d.ts +9 -0
- package/dist/modules/workspace/capabilities.d.ts.map +1 -0
- package/dist/modules/workspace/capabilities.js +12 -0
- package/dist/modules/workspace/capabilities.js.map +1 -0
- package/dist/modules/workspace/idempotencyMiddleware.d.ts +16 -0
- package/dist/modules/workspace/idempotencyMiddleware.d.ts.map +1 -0
- package/dist/modules/workspace/idempotencyMiddleware.js +142 -0
- package/dist/modules/workspace/idempotencyMiddleware.js.map +1 -0
- package/dist/modules/workspace/idempotencyRepository.d.ts +43 -0
- package/dist/modules/workspace/idempotencyRepository.d.ts.map +1 -0
- package/dist/modules/workspace/idempotencyRepository.js +75 -0
- package/dist/modules/workspace/idempotencyRepository.js.map +1 -0
- package/dist/modules/workspace/index.d.ts +9 -0
- package/dist/modules/workspace/index.d.ts.map +1 -0
- package/dist/modules/workspace/index.js +53 -0
- package/dist/modules/workspace/index.js.map +1 -0
- package/dist/modules/workspace/repository.d.ts +112 -0
- package/dist/modules/workspace/repository.d.ts.map +1 -0
- package/dist/modules/workspace/repository.js +266 -0
- package/dist/modules/workspace/repository.js.map +1 -0
- package/dist/modules/workspace/roles.d.ts +22 -0
- package/dist/modules/workspace/roles.d.ts.map +1 -0
- package/dist/modules/workspace/roles.js +31 -0
- package/dist/modules/workspace/roles.js.map +1 -0
- package/dist/modules/workspace/routes.d.ts +41 -0
- package/dist/modules/workspace/routes.d.ts.map +1 -0
- package/dist/modules/workspace/routes.js +158 -0
- package/dist/modules/workspace/routes.js.map +1 -0
- package/dist/modules/workspace/schema.d.ts +719 -0
- package/dist/modules/workspace/schema.d.ts.map +1 -0
- package/dist/modules/workspace/schema.js +102 -0
- package/dist/modules/workspace/schema.js.map +1 -0
- package/dist/modules/workspace/service.d.ts +94 -0
- package/dist/modules/workspace/service.d.ts.map +1 -0
- package/dist/modules/workspace/service.js +528 -0
- package/dist/modules/workspace/service.js.map +1 -0
- package/dist/modules/workspace/starters.d.ts +22 -0
- package/dist/modules/workspace/starters.d.ts.map +1 -0
- package/dist/modules/workspace/starters.js +56 -0
- package/dist/modules/workspace/starters.js.map +1 -0
- package/dist/modules/workspace/tools.d.ts +4 -0
- package/dist/modules/workspace/tools.d.ts.map +1 -0
- package/dist/modules/workspace/tools.js +95 -0
- package/dist/modules/workspace/tools.js.map +1 -0
- package/dist/runtime/entitlements.d.ts +66 -0
- package/dist/runtime/entitlements.d.ts.map +1 -0
- package/dist/runtime/entitlements.js +62 -0
- package/dist/runtime/entitlements.js.map +1 -0
- package/dist/runtime/events.d.ts +139 -0
- package/dist/runtime/events.d.ts.map +1 -0
- package/dist/runtime/events.js +98 -0
- package/dist/runtime/events.js.map +1 -0
- package/dist/runtime/migrate.d.ts +28 -0
- package/dist/runtime/migrate.d.ts.map +1 -0
- package/dist/runtime/migrate.js +43 -0
- package/dist/runtime/migrate.js.map +1 -0
- package/dist/runtime/module.d.ts +138 -0
- package/dist/runtime/module.d.ts.map +1 -0
- package/dist/runtime/module.js +2 -0
- package/dist/runtime/module.js.map +1 -0
- package/dist/runtime/moduleConfig.d.ts +21 -0
- package/dist/runtime/moduleConfig.d.ts.map +1 -0
- package/dist/runtime/moduleConfig.js +54 -0
- package/dist/runtime/moduleConfig.js.map +1 -0
- package/dist/runtime/order.d.ts +21 -0
- package/dist/runtime/order.d.ts.map +1 -0
- package/dist/runtime/order.js +72 -0
- package/dist/runtime/order.js.map +1 -0
- package/dist/runtime/registry.d.ts +66 -0
- package/dist/runtime/registry.d.ts.map +1 -0
- package/dist/runtime/registry.js +148 -0
- package/dist/runtime/registry.js.map +1 -0
- package/dist/runtime/transaction.d.ts +34 -0
- package/dist/runtime/transaction.d.ts.map +1 -0
- package/dist/runtime/transaction.js +24 -0
- package/dist/runtime/transaction.js.map +1 -0
- package/dist/schema/index.d.ts +30 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +30 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/testing/app.d.ts +42 -0
- package/dist/testing/app.d.ts.map +1 -0
- package/dist/testing/app.js +31 -0
- package/dist/testing/app.js.map +1 -0
- package/dist/testing/client.d.ts +34 -0
- package/dist/testing/client.d.ts.map +1 -0
- package/dist/testing/client.js +70 -0
- package/dist/testing/client.js.map +1 -0
- package/dist/testing/database.d.ts +17 -0
- package/dist/testing/database.d.ts.map +1 -0
- package/dist/testing/database.js +84 -0
- package/dist/testing/database.js.map +1 -0
- package/dist/testing/environment.d.ts +17 -0
- package/dist/testing/environment.d.ts.map +1 -0
- package/dist/testing/environment.js +19 -0
- package/dist/testing/environment.js.map +1 -0
- package/dist/testing/fixtures.d.ts +22 -0
- package/dist/testing/fixtures.d.ts.map +1 -0
- package/dist/testing/fixtures.js +55 -0
- package/dist/testing/fixtures.js.map +1 -0
- package/dist/testing/index.d.ts +10 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +6 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/services.d.ts +18 -0
- package/dist/testing/services.d.ts.map +1 -0
- package/dist/testing/services.js +43 -0
- package/dist/testing/services.js.map +1 -0
- package/migrations/0000_initial_schema.sql +597 -0
- package/migrations/0001_uneven_lockjaw.sql +11 -0
- package/migrations/0002_neat_madame_web.sql +2 -0
- package/migrations/0003_bright_shockwave.sql +1 -0
- package/migrations/0004_drop_unused_import_columns.sql +2 -0
- package/migrations/0005_import_job_rows.sql +23 -0
- package/migrations/0006_drop_webhook_secret_hash.sql +1 -0
- package/migrations/0007_add_webhook_secret_encrypted.sql +1 -0
- package/migrations/0008_rich_mister_sinister.sql +3 -0
- package/migrations/0009_natural_proemial_gods.sql +1 -0
- package/migrations/0010_fine_brood.sql +1 -0
- package/migrations/0011_add_webhook_previous_secret.sql +2 -0
- package/migrations/0012_idempotency_keys_response_nullable.sql +1 -0
- package/migrations/0013_add_agent_run_failure_reason.sql +1 -0
- package/migrations/0014_right_shinko_yamashiro.sql +12 -0
- package/migrations/0015_peaceful_chimera.sql +33 -0
- package/migrations/meta/0000_snapshot.json +4467 -0
- package/migrations/meta/0001_snapshot.json +4539 -0
- package/migrations/meta/0002_snapshot.json +4539 -0
- package/migrations/meta/0003_snapshot.json +4544 -0
- package/migrations/meta/0004_snapshot.json +4531 -0
- package/migrations/meta/0005_snapshot.json +4674 -0
- package/migrations/meta/0006_snapshot.json +4668 -0
- package/migrations/meta/0007_snapshot.json +4674 -0
- package/migrations/meta/0008_snapshot.json +4694 -0
- package/migrations/meta/0009_snapshot.json +4700 -0
- package/migrations/meta/0010_snapshot.json +4694 -0
- package/migrations/meta/0011_snapshot.json +4706 -0
- package/migrations/meta/0012_snapshot.json +4706 -0
- package/migrations/meta/0013_snapshot.json +4712 -0
- package/migrations/meta/0014_snapshot.json +4802 -0
- package/migrations/meta/0015_snapshot.json +5077 -0
- package/migrations/meta/_journal.json +118 -0
- package/package.json +68 -0
- package/src/app.ts +157 -0
- package/src/index.ts +113 -0
- package/src/lib/actor.ts +99 -0
- package/src/lib/changes.ts +43 -0
- package/src/lib/columns.ts +170 -0
- package/src/lib/config.ts +86 -0
- package/src/lib/database.ts +118 -0
- package/src/lib/dates.ts +18 -0
- package/src/lib/email.ts +65 -0
- package/src/lib/errors.ts +156 -0
- package/src/lib/http.ts +109 -0
- package/src/lib/ids.ts +61 -0
- package/src/lib/logger.ts +73 -0
- package/src/lib/moduleConfig.ts +65 -0
- package/src/lib/normalisation.ts +36 -0
- package/src/lib/pagination.ts +291 -0
- package/src/lib/passwords.ts +56 -0
- package/src/lib/search.ts +29 -0
- package/src/lib/secrets.ts +223 -0
- package/src/lib/timezones.ts +59 -0
- package/src/lib/tokens.ts +37 -0
- package/src/lib/url.ts +52 -0
- package/src/modules/activities/index.ts +43 -0
- package/src/modules/activities/recorder.ts +108 -0
- package/src/modules/activities/repository.ts +196 -0
- package/src/modules/activities/routes.ts +78 -0
- package/src/modules/activities/schema.ts +41 -0
- package/src/modules/activities/service.ts +93 -0
- package/src/modules/activities/tools.ts +40 -0
- package/src/modules/activities/wording.ts +168 -0
- package/src/modules/agent-tasks/catalog.ts +712 -0
- package/src/modules/agent-tasks/dispatch.ts +188 -0
- package/src/modules/agent-tasks/index.ts +79 -0
- package/src/modules/agent-tasks/prompt.ts +140 -0
- package/src/modules/agent-tasks/repository.ts +152 -0
- package/src/modules/agent-tasks/resolve.ts +704 -0
- package/src/modules/agent-tasks/routes.ts +260 -0
- package/src/modules/agent-tasks/schema.ts +57 -0
- package/src/modules/agent-tasks/service.ts +370 -0
- package/src/modules/agent-tasks/wire.ts +61 -0
- package/src/modules/api-keys/index.ts +34 -0
- package/src/modules/api-keys/keys.ts +59 -0
- package/src/modules/api-keys/repository.ts +82 -0
- package/src/modules/api-keys/routes.ts +83 -0
- package/src/modules/api-keys/schema.ts +28 -0
- package/src/modules/api-keys/service.ts +152 -0
- package/src/modules/attachedRecords.ts +85 -0
- package/src/modules/auth/actor.ts +17 -0
- package/src/modules/auth/credentials.ts +153 -0
- package/src/modules/auth/index.ts +49 -0
- package/src/modules/auth/preferences.ts +57 -0
- package/src/modules/auth/repository.ts +240 -0
- package/src/modules/auth/routes.ts +247 -0
- package/src/modules/auth/schema.ts +77 -0
- package/src/modules/auth/service.ts +441 -0
- package/src/modules/auth/session.ts +40 -0
- package/src/modules/companies/index.ts +43 -0
- package/src/modules/companies/repository.ts +185 -0
- package/src/modules/companies/routes.ts +170 -0
- package/src/modules/companies/schema.ts +66 -0
- package/src/modules/companies/service.ts +267 -0
- package/src/modules/companies/tools.ts +32 -0
- package/src/modules/core.ts +93 -0
- package/src/modules/crudTools.ts +226 -0
- package/src/modules/dashboard/attention.ts +67 -0
- package/src/modules/dashboard/index.ts +49 -0
- package/src/modules/dashboard/repository.ts +360 -0
- package/src/modules/dashboard/routes.ts +171 -0
- package/src/modules/dashboard/service.ts +449 -0
- package/src/modules/dashboard/tools.ts +39 -0
- package/src/modules/deals/index.ts +44 -0
- package/src/modules/deals/repository.ts +251 -0
- package/src/modules/deals/routes.ts +166 -0
- package/src/modules/deals/schema.ts +72 -0
- package/src/modules/deals/service.ts +433 -0
- package/src/modules/deals/tools.ts +39 -0
- package/src/modules/decisions/index.ts +40 -0
- package/src/modules/decisions/repository.ts +204 -0
- package/src/modules/decisions/routes.ts +184 -0
- package/src/modules/decisions/schema.ts +56 -0
- package/src/modules/decisions/service.ts +223 -0
- package/src/modules/decisions/tools.ts +38 -0
- package/src/modules/forms/embed.ts +274 -0
- package/src/modules/forms/fields.ts +206 -0
- package/src/modules/forms/index.ts +61 -0
- package/src/modules/forms/mapping.ts +222 -0
- package/src/modules/forms/publicRoutes.ts +92 -0
- package/src/modules/forms/repository.ts +223 -0
- package/src/modules/forms/routes.ts +276 -0
- package/src/modules/forms/schema.ts +135 -0
- package/src/modules/forms/service.ts +362 -0
- package/src/modules/forms/submission.ts +496 -0
- package/src/modules/forms/tools.ts +66 -0
- package/src/modules/handbook/index.ts +43 -0
- package/src/modules/handbook/repository.ts +173 -0
- package/src/modules/handbook/routes.ts +145 -0
- package/src/modules/handbook/schema.ts +43 -0
- package/src/modules/handbook/service.ts +399 -0
- package/src/modules/handbook/slugs.ts +54 -0
- package/src/modules/handbook/tools.ts +32 -0
- package/src/modules/handbook/tree.ts +158 -0
- package/src/modules/hiring/candidates.ts +391 -0
- package/src/modules/hiring/index.ts +55 -0
- package/src/modules/hiring/repository.ts +244 -0
- package/src/modules/hiring/roles.ts +174 -0
- package/src/modules/hiring/routes.ts +257 -0
- package/src/modules/hiring/schema.ts +93 -0
- package/src/modules/hiring/tools.ts +73 -0
- package/src/modules/import-export/csv.ts +180 -0
- package/src/modules/import-export/drafts.ts +182 -0
- package/src/modules/import-export/exportRows.ts +85 -0
- package/src/modules/import-export/index.ts +49 -0
- package/src/modules/import-export/mapping.ts +154 -0
- package/src/modules/import-export/plan.ts +311 -0
- package/src/modules/import-export/presets.ts +183 -0
- package/src/modules/import-export/repository.ts +603 -0
- package/src/modules/import-export/routes.ts +276 -0
- package/src/modules/import-export/schema.ts +142 -0
- package/src/modules/import-export/service.ts +842 -0
- package/src/modules/import-export/streams.ts +98 -0
- package/src/modules/import-export/tools.ts +153 -0
- package/src/modules/import-export/validation.ts +163 -0
- package/src/modules/import-export/writes.ts +365 -0
- package/src/modules/integrations/schema.ts +31 -0
- package/src/modules/mcp/index.ts +52 -0
- package/src/modules/mcp/protocol.ts +442 -0
- package/src/modules/mcp/router.ts +425 -0
- package/src/modules/notes/index.ts +43 -0
- package/src/modules/notes/repository.ts +130 -0
- package/src/modules/notes/routes.ts +170 -0
- package/src/modules/notes/schema.ts +42 -0
- package/src/modules/notes/service.ts +204 -0
- package/src/modules/notes/tools.ts +46 -0
- package/src/modules/opportunities/index.ts +44 -0
- package/src/modules/opportunities/repository.ts +157 -0
- package/src/modules/opportunities/routes.ts +152 -0
- package/src/modules/opportunities/schema.ts +47 -0
- package/src/modules/opportunities/service.ts +342 -0
- package/src/modules/opportunities/tools.ts +39 -0
- package/src/modules/partnerships/index.ts +44 -0
- package/src/modules/partnerships/repository.ts +274 -0
- package/src/modules/partnerships/routes.ts +170 -0
- package/src/modules/partnerships/schema.ts +65 -0
- package/src/modules/partnerships/service.ts +442 -0
- package/src/modules/partnerships/tools.ts +41 -0
- package/src/modules/people/index.ts +43 -0
- package/src/modules/people/repository.ts +167 -0
- package/src/modules/people/routes.ts +175 -0
- package/src/modules/people/schema.ts +89 -0
- package/src/modules/people/service.ts +284 -0
- package/src/modules/people/tools.ts +32 -0
- package/src/modules/pipelines/index.ts +43 -0
- package/src/modules/pipelines/repository.ts +116 -0
- package/src/modules/pipelines/routes.ts +157 -0
- package/src/modules/pipelines/schema.ts +37 -0
- package/src/modules/pipelines/service.ts +339 -0
- package/src/modules/pipelines/tools.ts +52 -0
- package/src/modules/plans/index.ts +39 -0
- package/src/modules/plans/repository.ts +174 -0
- package/src/modules/plans/routes.ts +212 -0
- package/src/modules/plans/schema.ts +45 -0
- package/src/modules/plans/service.ts +223 -0
- package/src/modules/plans/tools.ts +45 -0
- package/src/modules/positions/index.ts +42 -0
- package/src/modules/positions/repository.ts +136 -0
- package/src/modules/positions/routes.ts +97 -0
- package/src/modules/positions/schema.ts +42 -0
- package/src/modules/positions/service.ts +253 -0
- package/src/modules/positions/tools.ts +32 -0
- package/src/modules/raises/index.ts +44 -0
- package/src/modules/raises/repository.ts +254 -0
- package/src/modules/raises/routes.ts +160 -0
- package/src/modules/raises/schema.ts +66 -0
- package/src/modules/raises/service.ts +442 -0
- package/src/modules/raises/tools.ts +39 -0
- package/src/modules/recordTargets.ts +194 -0
- package/src/modules/references.ts +44 -0
- package/src/modules/reseal.ts +178 -0
- package/src/modules/search/index.ts +55 -0
- package/src/modules/search/query.ts +104 -0
- package/src/modules/search/repository.ts +388 -0
- package/src/modules/search/routes.ts +131 -0
- package/src/modules/search/service.ts +153 -0
- package/src/modules/search/tools.ts +60 -0
- package/src/modules/stagedRecords.ts +91 -0
- package/src/modules/webhooks/delivery.ts +349 -0
- package/src/modules/webhooks/index.ts +85 -0
- package/src/modules/webhooks/payloads.ts +84 -0
- package/src/modules/webhooks/repository.ts +244 -0
- package/src/modules/webhooks/routes.ts +240 -0
- package/src/modules/webhooks/schema.ts +78 -0
- package/src/modules/webhooks/service.ts +347 -0
- package/src/modules/webhooks/signing.ts +95 -0
- package/src/modules/webhooks/tools.ts +108 -0
- package/src/modules/webhooks/url.ts +21 -0
- package/src/modules/workspace/capabilities.ts +14 -0
- package/src/modules/workspace/idempotencyMiddleware.ts +207 -0
- package/src/modules/workspace/idempotencyRepository.ts +111 -0
- package/src/modules/workspace/index.ts +64 -0
- package/src/modules/workspace/repository.ts +420 -0
- package/src/modules/workspace/roles.ts +38 -0
- package/src/modules/workspace/routes.ts +255 -0
- package/src/modules/workspace/schema.ts +130 -0
- package/src/modules/workspace/service.ts +798 -0
- package/src/modules/workspace/starters.ts +69 -0
- package/src/modules/workspace/tools.ts +141 -0
- package/src/runtime/entitlements.ts +142 -0
- package/src/runtime/events.ts +185 -0
- package/src/runtime/migrate.ts +75 -0
- package/src/runtime/module.ts +147 -0
- package/src/runtime/moduleConfig.ts +68 -0
- package/src/runtime/order.ts +90 -0
- package/src/runtime/registry.ts +263 -0
- package/src/runtime/transaction.ts +80 -0
- package/src/schema/index.ts +30 -0
- package/src/testing/app.ts +79 -0
- package/src/testing/client.ts +118 -0
- package/src/testing/database.ts +106 -0
- package/src/testing/environment.ts +22 -0
- package/src/testing/fixtures.ts +70 -0
- package/src/testing/index.ts +13 -0
- package/src/testing/services.ts +67 -0
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @kelpie/server
|
|
2
|
+
|
|
3
|
+
The [Kelpie](https://github.com/velvet-tiger/kelpie) service as a library.
|
|
4
|
+
|
|
5
|
+
Kelpie is an open-source, agent-native CRM and company brain. This package holds the module runtime, the core CRM modules, the REST API, the MCP surface, and the shared migration pipeline.
|
|
6
|
+
|
|
7
|
+
It is a library, not a program. Importing it starts nothing. You compose an **assembly**: a small app that lists its modules, wires its dependencies, and serves. That is what lets a self-hosted deployment and a commercial one run the same core with different module lists.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @kelpie/server @hono/node-server
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Needs Node 24 or newer and a Postgres it can reach through `DATABASE_URL`.
|
|
16
|
+
|
|
17
|
+
## Use
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { serve } from '@hono/node-server'
|
|
21
|
+
import { connectDatabase, createApp, createEventBus, createIdFactory, createLogger, loadConfig, registerModules, runMigrations } from '@kelpie/server'
|
|
22
|
+
|
|
23
|
+
import { modules } from './kelpie.config.ts'
|
|
24
|
+
|
|
25
|
+
const config = loadConfig(process.env)
|
|
26
|
+
const logger = createLogger(config.logLevel)
|
|
27
|
+
const database = connectDatabase(config.databaseUrl, logger)
|
|
28
|
+
const events = createEventBus(logger)
|
|
29
|
+
|
|
30
|
+
const contributions = await registerModules({ modules, environment: process.env, logger, events, /* … */ })
|
|
31
|
+
|
|
32
|
+
await runMigrations(database.db, contributions.schemas, logger)
|
|
33
|
+
|
|
34
|
+
const app = createApp({ logger, probeDatabase: database.probe, contributions, /* … */ })
|
|
35
|
+
|
|
36
|
+
serve({ fetch: app.fetch, port: config.port })
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Registration runs before migrations. Modules declare their migrations directory while registering, so there is nothing to migrate until that pass has finished.
|
|
40
|
+
|
|
41
|
+
The full entry point, including shutdown and error handling, is [`apps/kelpie/src/server.ts`](https://github.com/velvet-tiger/kelpie/blob/main/apps/kelpie/src/server.ts). Start from that rather than from the sketch above.
|
|
42
|
+
|
|
43
|
+
## Migrations
|
|
44
|
+
|
|
45
|
+
The package ships its migrations. `coreMigrationsDirectory` points at them, and `runMigrations` applies them per module at boot. Nothing else has to be installed to get a working schema.
|
|
46
|
+
|
|
47
|
+
## Testing
|
|
48
|
+
|
|
49
|
+
`@kelpie/server/testing` exports the harness the core suite uses: an app factory, a database connection helper, workspace fixtures, and a typed request client. A module's own tests can use the same tools.
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import { createTestApp, insertWorkspaceFixture } from '@kelpie/server/testing'
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Licence
|
|
56
|
+
|
|
57
|
+
AGPL-3.0-only. Running a modified version as a network service obliges you to offer its source to users.
|
package/dist/app.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Hono } from 'hono';
|
|
2
|
+
import type { DatabaseProbe } from './lib/database.ts';
|
|
3
|
+
import type { IdFactory } from './lib/ids.ts';
|
|
4
|
+
import type { Logger } from './lib/logger.ts';
|
|
5
|
+
import type { CredentialDependencies } from './modules/auth/credentials.ts';
|
|
6
|
+
import type { ModuleContributions } from './runtime/registry.ts';
|
|
7
|
+
/**
|
|
8
|
+
* Builds the HTTP application. Everything it touches arrives as a dependency, so
|
|
9
|
+
* the app can be exercised without a database or a listening socket.
|
|
10
|
+
*/
|
|
11
|
+
export interface AppDependencies {
|
|
12
|
+
readonly logger: Logger;
|
|
13
|
+
readonly probeDatabase: () => Promise<DatabaseProbe>;
|
|
14
|
+
/** Produced by the registration pass. Routers mount under `/v1`. */
|
|
15
|
+
readonly contributions: ModuleContributions;
|
|
16
|
+
/**
|
|
17
|
+
* What `/mcp` checks a bearer key against. The REST routes resolve their own
|
|
18
|
+
* actor inside each module; the MCP endpoint is mounted here rather than by a
|
|
19
|
+
* module, because its tools come from every module and the last of those has to
|
|
20
|
+
* have registered before the listing exists.
|
|
21
|
+
*/
|
|
22
|
+
readonly credentials: CredentialDependencies;
|
|
23
|
+
/** Injected so tests can pin the id echoed on responses. */
|
|
24
|
+
readonly generateRequestId?: () => string;
|
|
25
|
+
/** Injected so tests can pin the ids `idempotencyMiddleware` reserves rows under. */
|
|
26
|
+
readonly createId?: IdFactory;
|
|
27
|
+
}
|
|
28
|
+
/** Per-request values the middleware chain sets and handlers read. */
|
|
29
|
+
export interface AppBindings {
|
|
30
|
+
Variables: {
|
|
31
|
+
requestId: string;
|
|
32
|
+
logger: Logger;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export declare function createApp(dependencies: AppDependencies): Hono<AppBindings>;
|
|
36
|
+
//# sourceMappingURL=app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAG3B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAItD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAI3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAEhE;;;GAGG;AAEH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,aAAa,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAA;IACpD,oEAAoE;IACpE,QAAQ,CAAC,aAAa,EAAE,mBAAmB,CAAA;IAC3C;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,sBAAsB,CAAA;IAC5C,4DAA4D;IAC5D,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,MAAM,CAAA;IACzC,qFAAqF;IACrF,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAC9B;AAED,sEAAsE;AACtE,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE;QACT,SAAS,EAAE,MAAM,CAAA;QACjB,MAAM,EAAE,MAAM,CAAA;KACf,CAAA;CACF;AAqBD,wBAAgB,SAAS,CAAC,YAAY,EAAE,eAAe,GAAG,IAAI,CAAC,WAAW,CAAC,CA2F1E"}
|
package/dist/app.js
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Hono } from 'hono';
|
|
2
|
+
import { cors } from 'hono/cors';
|
|
3
|
+
import { AppError, internalErrorBody, toErrorBody } from './lib/errors.js';
|
|
4
|
+
import { PUBLIC_ROUTE_PREFIX } from './lib/http.js';
|
|
5
|
+
import { createIdFactory } from './lib/ids.js';
|
|
6
|
+
import { MCP_INSTRUCTIONS, MCP_ROUTE_PREFIX, MCP_SERVER_INFO } from './modules/mcp/index.js';
|
|
7
|
+
import { createMcpEndpoint } from './modules/mcp/router.js';
|
|
8
|
+
import { createIdempotencyMiddleware } from './modules/workspace/idempotencyMiddleware.js';
|
|
9
|
+
const REQUEST_ID_HEADER = 'X-Request-Id';
|
|
10
|
+
/**
|
|
11
|
+
* Any origin, because a public endpoint exists to be called from a customer's
|
|
12
|
+
* own website and Kelpie does not know that site's address.
|
|
13
|
+
*
|
|
14
|
+
* `credentials` stays off, which is what keeps this safe: a browser will not
|
|
15
|
+
* attach the session cookie to these requests, so an embedded form on an
|
|
16
|
+
* attacker's page cannot borrow a signed-in reader's identity. A public handler
|
|
17
|
+
* has no `Actor` in any case (`runtime/module.ts`).
|
|
18
|
+
*/
|
|
19
|
+
const PUBLIC_CORS = cors({
|
|
20
|
+
origin: '*',
|
|
21
|
+
allowMethods: ['GET', 'POST', 'OPTIONS'],
|
|
22
|
+
allowHeaders: ['Content-Type'],
|
|
23
|
+
credentials: false,
|
|
24
|
+
maxAge: 86_400,
|
|
25
|
+
});
|
|
26
|
+
export function createApp(dependencies) {
|
|
27
|
+
const generateRequestId = dependencies.generateRequestId ?? (() => crypto.randomUUID());
|
|
28
|
+
const createId = dependencies.createId ?? createIdFactory();
|
|
29
|
+
const app = new Hono();
|
|
30
|
+
app.use('*', async (context, next) => {
|
|
31
|
+
const requestId = context.req.header(REQUEST_ID_HEADER) ?? generateRequestId();
|
|
32
|
+
const logger = dependencies.logger.child({ requestId });
|
|
33
|
+
context.set('requestId', requestId);
|
|
34
|
+
context.set('logger', logger);
|
|
35
|
+
context.header(REQUEST_ID_HEADER, requestId);
|
|
36
|
+
const startedAt = performance.now();
|
|
37
|
+
await next();
|
|
38
|
+
logger.info('request', {
|
|
39
|
+
method: context.req.method,
|
|
40
|
+
path: context.req.path,
|
|
41
|
+
status: context.res.status,
|
|
42
|
+
durationMs: Math.round(performance.now() - startedAt),
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
// Every module's `POST` gets this the same way, decided once here rather than
|
|
46
|
+
// per route (`api.md`). It skips `/v1/public/*` itself — a public request has
|
|
47
|
+
// no `Actor` to scope a key to — so it is mounted ahead of the public CORS
|
|
48
|
+
// middleware without conflicting with it.
|
|
49
|
+
app.use('/v1/*', createIdempotencyMiddleware({
|
|
50
|
+
db: dependencies.credentials.db,
|
|
51
|
+
now: dependencies.credentials.now,
|
|
52
|
+
createId,
|
|
53
|
+
credentials: dependencies.credentials,
|
|
54
|
+
log: dependencies.logger,
|
|
55
|
+
}));
|
|
56
|
+
// Public first. `/v1/public/...` cannot collide with a `/v1` route unless a
|
|
57
|
+
// module names a resource `public`, and mounting in this order means the CORS
|
|
58
|
+
// middleware is attached before anything can answer under the prefix.
|
|
59
|
+
app.use(`${PUBLIC_ROUTE_PREFIX}/*`, PUBLIC_CORS);
|
|
60
|
+
for (const { router } of dependencies.contributions.publicRouters) {
|
|
61
|
+
app.route(PUBLIC_ROUTE_PREFIX, router);
|
|
62
|
+
}
|
|
63
|
+
for (const { router } of dependencies.contributions.routers) {
|
|
64
|
+
app.route('/v1', router);
|
|
65
|
+
}
|
|
66
|
+
const mcp = createMcpEndpoint({
|
|
67
|
+
...dependencies.credentials,
|
|
68
|
+
tools: dependencies.contributions.mcpTools,
|
|
69
|
+
serverInfo: MCP_SERVER_INFO,
|
|
70
|
+
instructions: MCP_INSTRUCTIONS,
|
|
71
|
+
logger: dependencies.logger,
|
|
72
|
+
});
|
|
73
|
+
app.route(MCP_ROUTE_PREFIX, mcp.transport);
|
|
74
|
+
app.route('/v1', mcp.catalog);
|
|
75
|
+
app.onError((error, context) => {
|
|
76
|
+
if (error instanceof AppError) {
|
|
77
|
+
return context.json(toErrorBody(error), error.status);
|
|
78
|
+
}
|
|
79
|
+
context.get('logger').error('unhandled error', {
|
|
80
|
+
method: context.req.method,
|
|
81
|
+
path: context.req.path,
|
|
82
|
+
error: error.message,
|
|
83
|
+
stack: error.stack,
|
|
84
|
+
});
|
|
85
|
+
return context.json(internalErrorBody(), 500);
|
|
86
|
+
});
|
|
87
|
+
app.notFound((context) => context.json(toErrorBody(AppError.notFound()), 404));
|
|
88
|
+
app.get('/healthz', async (context) => {
|
|
89
|
+
const probe = await dependencies.probeDatabase();
|
|
90
|
+
if (!probe.reachable) {
|
|
91
|
+
context.get('logger').error('database unreachable', { reason: probe.reason });
|
|
92
|
+
return context.json({ status: 'degraded', database: 'down' }, 503);
|
|
93
|
+
}
|
|
94
|
+
return context.json({ status: 'ok', database: 'up' }, 200);
|
|
95
|
+
});
|
|
96
|
+
return app;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=app.js.map
|
package/dist/app.js.map
ADDED
|
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AAG,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;IAE9E,GAAG,CAAC,GAAG,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACpC,MAAM,KAAK,GAAG,MAAM,YAAY,CAAC,aAAa,EAAE,CAAA;QAEhD,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;YACrB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,sBAAsB,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;YAC7E,OAAO,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,CAAA;QACpE,CAAC;QAED,OAAO,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,GAAG,CAAC,CAAA;IAC5D,CAAC,CAAC,CAAA;IAEF,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export { createApp } from './app.ts';
|
|
2
|
+
export type { AppDependencies } from './app.ts';
|
|
3
|
+
export { ConfigurationError, loadConfig } from './lib/config.ts';
|
|
4
|
+
export type { Environment, KelpieConfig, LogLevel, RuntimeMode } from './lib/config.ts';
|
|
5
|
+
export { ModuleConfigFileError, readModuleConfigFile } from './lib/moduleConfig.ts';
|
|
6
|
+
export { FOREIGN_KEY_VIOLATION, RESTRICT_VIOLATION, UNIQUE_VIOLATION, connectDatabase, isReferenceViolation, postgresErrorCode, } from './lib/database.ts';
|
|
7
|
+
export type { Database, DatabaseConnection, DatabaseProbe } from './lib/database.ts';
|
|
8
|
+
export * as schema from './schema/index.ts';
|
|
9
|
+
export { createEmailSender, createLogEmailSender, emailConfigSchema } from './lib/email.ts';
|
|
10
|
+
export type { EmailConfig, EmailMessage, EmailSender } from './lib/email.ts';
|
|
11
|
+
export { MINIMUM_PASSWORD_LENGTH, hashPassword, isPasswordStrongEnough, verifyPassword } from './lib/passwords.ts';
|
|
12
|
+
export { generateToken, hashToken, tokenHashesMatch } from './lib/tokens.ts';
|
|
13
|
+
export { SecretDecryptionError, createSecretCipher, secretEncryptionConfigSchema, } from './lib/secrets.ts';
|
|
14
|
+
export type { SecretCipher, SecretEncryptionConfig } from './lib/secrets.ts';
|
|
15
|
+
export { AppError, describeThrown, describeValidationIssue, internalErrorBody, toErrorBody, toErrorDetails, } from './lib/errors.ts';
|
|
16
|
+
export type { ErrorBody, ErrorCode, ErrorDetail, ErrorStatus, ValidationIssue } from './lib/errors.ts';
|
|
17
|
+
export { createIdFactory, idPrefixes } from './lib/ids.ts';
|
|
18
|
+
export type { IdFactory, ObjectKind } from './lib/ids.ts';
|
|
19
|
+
export { createLogger } from './lib/logger.ts';
|
|
20
|
+
export type { LogFields, Logger, LogSink } from './lib/logger.ts';
|
|
21
|
+
export type { KelpieModule, McpTool, McpToolDefinition, McpToolRegistry, ModuleCatalogEntry, ModuleContext, SchemaContribution, } from './runtime/module.ts';
|
|
22
|
+
export { ModuleBootError, orderModules } from './runtime/order.ts';
|
|
23
|
+
export { createEntitlementRegistry, limitFor, requireCapability } from './runtime/entitlements.ts';
|
|
24
|
+
export type { Capability, Entitlement, EntitlementRegistry, FlagCapability, GrantProvider, LimitCapability, } from './runtime/entitlements.ts';
|
|
25
|
+
export { SEATS_LIMIT } from './modules/workspace/capabilities.ts';
|
|
26
|
+
export { DOMAIN_EVENT_NAMES, RECORD_OBJECT_TYPES, createEventBus } from './runtime/events.ts';
|
|
27
|
+
export type { DomainEventName, DomainEvents, EventBus, EventHandler, RecordObjectType, StagedObjectType, } from './runtime/events.ts';
|
|
28
|
+
export { createTransactionScope } from './runtime/transaction.ts';
|
|
29
|
+
export type { BufferedEvents, Transaction, TransactionContext, TransactionScope, TransactionScopeDependencies, } from './runtime/transaction.ts';
|
|
30
|
+
export { planMigrations, runMigrations } from './runtime/migrate.ts';
|
|
31
|
+
export type { MigrationPlanStep } from './runtime/migrate.ts';
|
|
32
|
+
export { coreMigrationsDirectory, coreModules } from './modules/core.ts';
|
|
33
|
+
export { resealStoredSecrets } from './modules/reseal.ts';
|
|
34
|
+
export type { ResealColumnOutcome, ResealOutcome } from './modules/reseal.ts';
|
|
35
|
+
export { KEY_KINDS, kindOfSecret, mintKey, parseKeyKind, readBearerToken } from './modules/api-keys/keys.ts';
|
|
36
|
+
export type { KeyKind, MintedKey } from './modules/api-keys/keys.ts';
|
|
37
|
+
export { registerModules } from './runtime/registry.ts';
|
|
38
|
+
export type { ModuleContributions, ModuleRouter, ModuleRuntimeOptions } from './runtime/registry.ts';
|
|
39
|
+
export type { ModuleServices } from './runtime/module.ts';
|
|
40
|
+
export type { Actor, ApiKeyActor, SessionActor } from './modules/auth/actor.ts';
|
|
41
|
+
export { actorUserId, actorWorkspaceId, requireSessionActor } from './modules/auth/actor.ts';
|
|
42
|
+
export { resolveActor, resolveActorFrom } from './modules/auth/credentials.ts';
|
|
43
|
+
export type { CredentialDependencies } from './modules/auth/credentials.ts';
|
|
44
|
+
export { MEMBER_ROLES, INVITABLE_ROLES, parseMemberRole, roleAllows } from './modules/workspace/roles.ts';
|
|
45
|
+
export type { InvitableRole, MemberRole } from './modules/workspace/roles.ts';
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iBA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YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAC5G,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,YAAY,EAAE,mBAAmB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACpG,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAC/E,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC5F,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAC9E,YAAY,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA;AACzG,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { createApp } from './app.js';
|
|
2
|
+
export { ConfigurationError, loadConfig } from './lib/config.js';
|
|
3
|
+
export { ModuleConfigFileError, readModuleConfigFile } from './lib/moduleConfig.js';
|
|
4
|
+
export { FOREIGN_KEY_VIOLATION, RESTRICT_VIOLATION, UNIQUE_VIOLATION, connectDatabase, isReferenceViolation, postgresErrorCode, } from './lib/database.js';
|
|
5
|
+
export * as schema from './schema/index.js';
|
|
6
|
+
export { createEmailSender, createLogEmailSender, emailConfigSchema } from './lib/email.js';
|
|
7
|
+
export { MINIMUM_PASSWORD_LENGTH, hashPassword, isPasswordStrongEnough, verifyPassword } from './lib/passwords.js';
|
|
8
|
+
export { generateToken, hashToken, tokenHashesMatch } from './lib/tokens.js';
|
|
9
|
+
export { SecretDecryptionError, createSecretCipher, secretEncryptionConfigSchema, } from './lib/secrets.js';
|
|
10
|
+
export { AppError, describeThrown, describeValidationIssue, internalErrorBody, toErrorBody, toErrorDetails, } from './lib/errors.js';
|
|
11
|
+
export { createIdFactory, idPrefixes } from './lib/ids.js';
|
|
12
|
+
export { createLogger } from './lib/logger.js';
|
|
13
|
+
export { ModuleBootError, orderModules } from './runtime/order.js';
|
|
14
|
+
export { createEntitlementRegistry, limitFor, requireCapability } from './runtime/entitlements.js';
|
|
15
|
+
export { SEATS_LIMIT } from './modules/workspace/capabilities.js';
|
|
16
|
+
export { DOMAIN_EVENT_NAMES, RECORD_OBJECT_TYPES, createEventBus } from './runtime/events.js';
|
|
17
|
+
export { createTransactionScope } from './runtime/transaction.js';
|
|
18
|
+
export { planMigrations, runMigrations } from './runtime/migrate.js';
|
|
19
|
+
export { coreMigrationsDirectory, coreModules } from './modules/core.js';
|
|
20
|
+
export { resealStoredSecrets } from './modules/reseal.js';
|
|
21
|
+
export { KEY_KINDS, kindOfSecret, mintKey, parseKeyKind, readBearerToken } from './modules/api-keys/keys.js';
|
|
22
|
+
export { registerModules } from './runtime/registry.js';
|
|
23
|
+
export { actorUserId, actorWorkspaceId, requireSessionActor } from './modules/auth/actor.js';
|
|
24
|
+
export { resolveActor, resolveActorFrom } from './modules/auth/credentials.js';
|
|
25
|
+
export { MEMBER_ROLES, INVITABLE_ROLES, parseMemberRole, roleAllows } from './modules/workspace/roles.js';
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGpC,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAGhE,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MA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EAAE,MAAM,qBAAqB,CAAA;AAGzD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AAG5G,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAKvD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAC5F,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAE9E,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { MemberRole } from '@kelpie/schemas';
|
|
2
|
+
/**
|
|
3
|
+
* Who is making a request. Resolved from credentials and passed explicitly to
|
|
4
|
+
* services; nothing reads auth state from a global.
|
|
5
|
+
*
|
|
6
|
+
* A union rather than a bag of optional fields, so a handler that needs a signed-in
|
|
7
|
+
* human cannot silently accept a workspace key that has no user behind it.
|
|
8
|
+
*
|
|
9
|
+
* It lives in `lib/` rather than in the auth module because the module runtime has
|
|
10
|
+
* to name it: an MCP tool receives its caller the same way a route handler does
|
|
11
|
+
* (`runtime/module.ts`), and `runtime/` must not import a feature module. Auth is
|
|
12
|
+
* still where an actor is *resolved* (`modules/auth/credentials.ts`), and
|
|
13
|
+
* `modules/auth/actor.ts` is still where modules read the type from.
|
|
14
|
+
*/
|
|
15
|
+
/** A browser session. `workspaceId` is null between signup and the first workspace. */
|
|
16
|
+
export interface SessionActor {
|
|
17
|
+
readonly kind: 'session';
|
|
18
|
+
readonly userId: string;
|
|
19
|
+
readonly sessionId: string;
|
|
20
|
+
readonly workspaceId: string | null;
|
|
21
|
+
readonly role: MemberRole | null;
|
|
22
|
+
/** The `workspace_members` row behind this actor. Null when there is no membership. */
|
|
23
|
+
readonly memberId: string | null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A bearer key, always bound to one workspace at creation (`api.md`).
|
|
27
|
+
*
|
|
28
|
+
* `userId` is set for a personal key, which acts as its user, and null for a
|
|
29
|
+
* workspace key, which acts as the workspace itself.
|
|
30
|
+
*/
|
|
31
|
+
export interface ApiKeyActor {
|
|
32
|
+
readonly kind: 'api_key';
|
|
33
|
+
readonly apiKeyId: string;
|
|
34
|
+
readonly userId: string | null;
|
|
35
|
+
readonly workspaceId: string;
|
|
36
|
+
readonly role: MemberRole;
|
|
37
|
+
/** Null for a workspace key: it belongs to the workspace, not to a member. */
|
|
38
|
+
readonly memberId: string | null;
|
|
39
|
+
}
|
|
40
|
+
export type Actor = SessionActor | ApiKeyActor;
|
|
41
|
+
/** The workspace an actor is operating in, or null if a fresh account has none yet. */
|
|
42
|
+
export declare function actorWorkspaceId(actor: Actor): string | null;
|
|
43
|
+
/**
|
|
44
|
+
* The same thing, for the endpoints that cannot work without one.
|
|
45
|
+
*
|
|
46
|
+
* CRM routes carry no workspace path segment and read no workspace header: a key
|
|
47
|
+
* is bound to its workspace at creation and a session carries its active one
|
|
48
|
+
* (`api.md`). The only actor without a workspace is an account between signup and
|
|
49
|
+
* its first workspace create.
|
|
50
|
+
*
|
|
51
|
+
* @throws AppError 403 when the actor has no workspace.
|
|
52
|
+
*/
|
|
53
|
+
export declare function requireWorkspaceId(actor: Actor): string;
|
|
54
|
+
/**
|
|
55
|
+
* Narrows to a signed-in human.
|
|
56
|
+
*
|
|
57
|
+
* @throws AppError 403 for a key, which has no session to manage and no password
|
|
58
|
+
* to change.
|
|
59
|
+
*/
|
|
60
|
+
export declare function requireSessionActor(actor: Actor): SessionActor;
|
|
61
|
+
/** The user behind the request, if there is one. A workspace key has none. */
|
|
62
|
+
export declare function actorUserId(actor: Actor): string | null;
|
|
63
|
+
/**
|
|
64
|
+
* The member row to attribute a write to: a note's author, an activity's actor.
|
|
65
|
+
*
|
|
66
|
+
* Null means nobody on the team did this. A workspace key is the case that
|
|
67
|
+
* reaches here today; an integration writing on the workspace's behalf is the
|
|
68
|
+
* one the `actor_label` column exists for.
|
|
69
|
+
*/
|
|
70
|
+
export declare function actorMemberId(actor: Actor): string | null;
|
|
71
|
+
//# sourceMappingURL=actor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actor.d.ts","sourceRoot":"","sources":["../../src/lib/actor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAIjD;;;;;;;;;;;;GAYG;AAEH,uFAAuF;AACvF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IACnC,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAA;IAChC,uFAAuF;IACvF,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACjC;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IACzB,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;CACjC;AAED,MAAM,MAAM,KAAK,GAAG,YAAY,GAAG,WAAW,CAAA;AAE9C,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAE5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAMvD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,YAAY,CAM9D;AAED,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAEvD;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAEzD"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { AppError } from './errors.js';
|
|
2
|
+
/** The workspace an actor is operating in, or null if a fresh account has none yet. */
|
|
3
|
+
export function actorWorkspaceId(actor) {
|
|
4
|
+
return actor.workspaceId;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* The same thing, for the endpoints that cannot work without one.
|
|
8
|
+
*
|
|
9
|
+
* CRM routes carry no workspace path segment and read no workspace header: a key
|
|
10
|
+
* is bound to its workspace at creation and a session carries its active one
|
|
11
|
+
* (`api.md`). The only actor without a workspace is an account between signup and
|
|
12
|
+
* its first workspace create.
|
|
13
|
+
*
|
|
14
|
+
* @throws AppError 403 when the actor has no workspace.
|
|
15
|
+
*/
|
|
16
|
+
export function requireWorkspaceId(actor) {
|
|
17
|
+
if (actor.workspaceId === null) {
|
|
18
|
+
throw new AppError('forbidden', 'Create or join a workspace before using this endpoint');
|
|
19
|
+
}
|
|
20
|
+
return actor.workspaceId;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Narrows to a signed-in human.
|
|
24
|
+
*
|
|
25
|
+
* @throws AppError 403 for a key, which has no session to manage and no password
|
|
26
|
+
* to change.
|
|
27
|
+
*/
|
|
28
|
+
export function requireSessionActor(actor) {
|
|
29
|
+
if (actor.kind !== 'session') {
|
|
30
|
+
throw new AppError('forbidden', 'This endpoint needs a signed-in user, not an API key');
|
|
31
|
+
}
|
|
32
|
+
return actor;
|
|
33
|
+
}
|
|
34
|
+
/** The user behind the request, if there is one. A workspace key has none. */
|
|
35
|
+
export function actorUserId(actor) {
|
|
36
|
+
return actor.userId;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The member row to attribute a write to: a note's author, an activity's actor.
|
|
40
|
+
*
|
|
41
|
+
* Null means nobody on the team did this. A workspace key is the case that
|
|
42
|
+
* reaches here today; an integration writing on the workspace's behalf is the
|
|
43
|
+
* one the `actor_label` column exists for.
|
|
44
|
+
*/
|
|
45
|
+
export function actorMemberId(actor) {
|
|
46
|
+
return actor.memberId;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=actor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actor.js","sourceRoot":"","sources":["../../src/lib/actor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AA6CtC,uFAAuF;AACvF,MAAM,UAAU,gBAAgB,CAAC,KAAY;IAC3C,OAAO,KAAK,CAAC,WAAW,CAAA;AAC1B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAY;IAC7C,IAAI,KAAK,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;QAC/B,MAAM,IAAI,QAAQ,CAAC,WAAW,EAAE,uDAAuD,CAAC,CAAA;IAC1F,CAAC;IAED,OAAO,KAAK,CAAC,WAAW,CAAA;AAC1B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAY;IAC9C,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,IAAI,QAAQ,CAAC,WAAW,EAAE,sDAAsD,CAAC,CAAA;IACzF,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,WAAW,CAAC,KAAY;IACtC,OAAO,KAAK,CAAC,MAAM,CAAA;AACrB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAY;IACxC,OAAO,KAAK,CAAC,QAAQ,CAAA;AACvB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which fields a PATCH actually changed.
|
|
3
|
+
*
|
|
4
|
+
* `record.updated` carries the changed fields, and a consumer that acts on
|
|
5
|
+
* "summary changed" should not be woken by a request that resent the summary it
|
|
6
|
+
* already had. A PATCH that changes nothing is also a write worth not doing:
|
|
7
|
+
* bumping `updated_at` for it would make every record look freshly touched.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* @param before The stored record.
|
|
11
|
+
* @param changes Partial by PATCH semantics: an absent key means "leave it", so
|
|
12
|
+
* only the keys present here are considered. A key `before` does not carry
|
|
13
|
+
* counts as a change, which is what a column added since the row was written
|
|
14
|
+
* should look like.
|
|
15
|
+
*/
|
|
16
|
+
export declare function changedKeys(before: Readonly<Record<string, unknown>>, changes: Readonly<Record<string, unknown>>): readonly string[];
|
|
17
|
+
//# sourceMappingURL=changes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../src/lib/changes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACzC,SAAS,MAAM,EAAE,CAcnB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which fields a PATCH actually changed.
|
|
3
|
+
*
|
|
4
|
+
* `record.updated` carries the changed fields, and a consumer that acts on
|
|
5
|
+
* "summary changed" should not be woken by a request that resent the summary it
|
|
6
|
+
* already had. A PATCH that changes nothing is also a write worth not doing:
|
|
7
|
+
* bumping `updated_at` for it would make every record look freshly touched.
|
|
8
|
+
*/
|
|
9
|
+
/** Dates compare by instant. Everything else compares by its JSON form, which covers arrays and objects. */
|
|
10
|
+
function sameValue(before, after) {
|
|
11
|
+
if (before instanceof Date && after instanceof Date) {
|
|
12
|
+
return before.getTime() === after.getTime();
|
|
13
|
+
}
|
|
14
|
+
return JSON.stringify(before) === JSON.stringify(after);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* @param before The stored record.
|
|
18
|
+
* @param changes Partial by PATCH semantics: an absent key means "leave it", so
|
|
19
|
+
* only the keys present here are considered. A key `before` does not carry
|
|
20
|
+
* counts as a change, which is what a column added since the row was written
|
|
21
|
+
* should look like.
|
|
22
|
+
*/
|
|
23
|
+
export function changedKeys(before, changes) {
|
|
24
|
+
const changed = [];
|
|
25
|
+
for (const [key, value] of Object.entries(changes)) {
|
|
26
|
+
if (value === undefined) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (!sameValue(before[key], value)) {
|
|
30
|
+
changed.push(key);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return changed;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=changes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changes.js","sourceRoot":"","sources":["../../src/lib/changes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,4GAA4G;AAC5G,SAAS,SAAS,CAAC,MAAe,EAAE,KAAc;IAChD,IAAI,MAAM,YAAY,IAAI,IAAI,KAAK,YAAY,IAAI,EAAE,CAAC;QACpD,OAAO,MAAM,CAAC,OAAO,EAAE,KAAK,KAAK,CAAC,OAAO,EAAE,CAAA;IAC7C,CAAC;IAED,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AACzD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,MAAyC,EACzC,OAA0C;IAE1C,MAAM,OAAO,GAAa,EAAE,CAAA;IAE5B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,SAAQ;QACV,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;YACnC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;QACnB,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { Column, SQL } from 'drizzle-orm';
|
|
2
|
+
import type { PgColumn } from 'drizzle-orm/pg-core';
|
|
3
|
+
/**
|
|
4
|
+
* Column conventions from `schema.md`, in one place so tables cannot drift.
|
|
5
|
+
*
|
|
6
|
+
* Primary keys are text `<prefix>_<ulid>` (see `lib/ids.ts`), not serials, so an
|
|
7
|
+
* id is meaningful on its own and safe to expose.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Case-insensitive text, for emails and domains. Values are also normalised to
|
|
11
|
+
* lowercase on write; citext makes a stray uppercase comparison still match
|
|
12
|
+
* rather than silently creating a duplicate.
|
|
13
|
+
*/
|
|
14
|
+
export declare const citext: {
|
|
15
|
+
(): import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
|
|
16
|
+
name: "";
|
|
17
|
+
dataType: 'custom';
|
|
18
|
+
columnType: 'PgCustomColumn';
|
|
19
|
+
data: string;
|
|
20
|
+
driverParam: string;
|
|
21
|
+
enumValues: undefined;
|
|
22
|
+
}>;
|
|
23
|
+
<TConfig extends Record<string, any> & unknown>(fieldConfig?: TConfig | undefined): import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
|
|
24
|
+
name: "";
|
|
25
|
+
dataType: 'custom';
|
|
26
|
+
columnType: 'PgCustomColumn';
|
|
27
|
+
data: string;
|
|
28
|
+
driverParam: string;
|
|
29
|
+
enumValues: undefined;
|
|
30
|
+
}>;
|
|
31
|
+
<TName extends string>(dbName: TName, fieldConfig?: unknown): import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
|
|
32
|
+
name: TName;
|
|
33
|
+
dataType: 'custom';
|
|
34
|
+
columnType: 'PgCustomColumn';
|
|
35
|
+
data: string;
|
|
36
|
+
driverParam: string;
|
|
37
|
+
enumValues: undefined;
|
|
38
|
+
}>;
|
|
39
|
+
};
|
|
40
|
+
export declare function primaryId(): import("drizzle-orm").IsPrimaryKey<import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgTextBuilderInitial<"id", [string, ...string[]]>>>;
|
|
41
|
+
/**
|
|
42
|
+
* A Postgres full-text vector, for the `search_vector` column every searchable
|
|
43
|
+
* table carries. Nothing selects it; it exists to be matched and ranked against.
|
|
44
|
+
*/
|
|
45
|
+
export declare const tsvector: {
|
|
46
|
+
(): import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
|
|
47
|
+
name: "";
|
|
48
|
+
dataType: 'custom';
|
|
49
|
+
columnType: 'PgCustomColumn';
|
|
50
|
+
data: string;
|
|
51
|
+
driverParam: string;
|
|
52
|
+
enumValues: undefined;
|
|
53
|
+
}>;
|
|
54
|
+
<TConfig extends Record<string, any> & unknown>(fieldConfig?: TConfig | undefined): import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
|
|
55
|
+
name: "";
|
|
56
|
+
dataType: 'custom';
|
|
57
|
+
columnType: 'PgCustomColumn';
|
|
58
|
+
data: string;
|
|
59
|
+
driverParam: string;
|
|
60
|
+
enumValues: undefined;
|
|
61
|
+
}>;
|
|
62
|
+
<TName extends string>(dbName: TName, fieldConfig?: unknown): import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
|
|
63
|
+
name: TName;
|
|
64
|
+
dataType: 'custom';
|
|
65
|
+
columnType: 'PgCustomColumn';
|
|
66
|
+
data: string;
|
|
67
|
+
driverParam: string;
|
|
68
|
+
enumValues: undefined;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* The one text search configuration every vector and every query is built with.
|
|
73
|
+
*
|
|
74
|
+
* It has to be a literal rather than a setting: a generated column's expression
|
|
75
|
+
* must be immutable, and `to_tsvector(text)` without an explicit configuration
|
|
76
|
+
* reads `default_text_search_config` at run time, which makes it merely stable.
|
|
77
|
+
* A per-workspace language would therefore need its own column, not a parameter.
|
|
78
|
+
*/
|
|
79
|
+
export declare const SEARCH_CONFIGURATION = "english";
|
|
80
|
+
/**
|
|
81
|
+
* Where a field sits in a result's ranking. `ts_rank` weighs A heaviest.
|
|
82
|
+
*
|
|
83
|
+
* A is what the reader clicks: a name, a title, the body of a decision. B is the
|
|
84
|
+
* record's own prose. C is tags and other short arrays, which match usefully but
|
|
85
|
+
* should not outrank a name.
|
|
86
|
+
*/
|
|
87
|
+
export type SearchWeight = 'A' | 'B' | 'C';
|
|
88
|
+
export interface SearchVectorPart {
|
|
89
|
+
readonly column: Column;
|
|
90
|
+
readonly weight: SearchWeight;
|
|
91
|
+
/**
|
|
92
|
+
* True for a `text[]` column. Arrays are flattened by
|
|
93
|
+
* `kelpie_text_array_to_string`, a wrapper that migration `0015` adds because
|
|
94
|
+
* `array_to_string` itself is stable rather than immutable and Postgres refuses
|
|
95
|
+
* a generated column built on it.
|
|
96
|
+
*/
|
|
97
|
+
readonly array?: boolean;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The `search_vector` column: a stored, generated tsvector over the record's own
|
|
101
|
+
* text, indexed with GIN by the table that declares it.
|
|
102
|
+
*
|
|
103
|
+
* Generated rather than maintained by the service, so it cannot fall out of step
|
|
104
|
+
* with the row. A trigger or an application write would both leave a window where
|
|
105
|
+
* an updated record is unfindable, and an import that bypassed the service would
|
|
106
|
+
* leave one permanently.
|
|
107
|
+
*
|
|
108
|
+
* The declared return type is not decoration. Every part names a column of the
|
|
109
|
+
* table being declared, so an inferred one would send TypeScript around a cycle:
|
|
110
|
+
* the table's type needs this column's type, which would need the parts, which
|
|
111
|
+
* name the table. Naming the type up front cuts it, the same way Drizzle's own
|
|
112
|
+
* self-referencing examples annotate their generated expressions.
|
|
113
|
+
*
|
|
114
|
+
* @param parts Deferred for the same reason at run time. Reading them eagerly
|
|
115
|
+
* would run before the table's own `const` is assigned.
|
|
116
|
+
*/
|
|
117
|
+
export declare function searchVector(parts: () => readonly SearchVectorPart[]): SearchVectorColumn;
|
|
118
|
+
type SearchVectorColumn = ReturnType<ReturnType<typeof tsvector>['generatedAlwaysAs']>;
|
|
119
|
+
/**
|
|
120
|
+
* Timestamps are `Date` in TypeScript, never strings. Postgres renders its own
|
|
121
|
+
* string format (`2026-08-02 11:23:26.138+00`), which is not the ISO 8601 that
|
|
122
|
+
* `api.md` requires, so string mode would leak a non-conforming value straight
|
|
123
|
+
* onto the wire. Routes call `toISOString()` at the boundary.
|
|
124
|
+
*/
|
|
125
|
+
export declare function createdAt(): import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgTimestampBuilderInitial<"created_at">>>;
|
|
126
|
+
export declare function updatedAt(): import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgTimestampBuilderInitial<"updated_at">>>;
|
|
127
|
+
/** A timestamptz that carries a real domain meaning rather than row bookkeeping. */
|
|
128
|
+
export declare function moment(name: string): import("drizzle-orm/pg-core").PgTimestampBuilderInitial<string>;
|
|
129
|
+
/**
|
|
130
|
+
* A check constraint restricting a column to a fixed set, built from the same
|
|
131
|
+
* array the API validates against.
|
|
132
|
+
*
|
|
133
|
+
* `schema.md` stores fixed enums as text plus a check rather than as a Postgres
|
|
134
|
+
* enum, so that adding a value is a constraint swap instead of a type migration.
|
|
135
|
+
* The cost of that is two lists of the same values, one in the constraint and one
|
|
136
|
+
* at the boundary. Taking both from one array is what stops them drifting into a
|
|
137
|
+
* request the API accepts and the database rejects with a 500.
|
|
138
|
+
*
|
|
139
|
+
* @param values Literals from our own source, never request data. They are
|
|
140
|
+
* inlined into DDL, so a quote in one would be a syntax error at boot.
|
|
141
|
+
*/
|
|
142
|
+
export declare function checkOneOf(name: string, column: PgColumn, values: readonly string[]): import("drizzle-orm/pg-core").CheckBuilder;
|
|
143
|
+
/**
|
|
144
|
+
* The `column in (…)` half of such a constraint, for a column whose rule needs
|
|
145
|
+
* more than membership. A nullable enum is the case: `interview_stage` is either
|
|
146
|
+
* null or one of the stages, and only the second half comes from the array.
|
|
147
|
+
*
|
|
148
|
+
* @param constraintName Only for the error below, which fires at boot.
|
|
149
|
+
*/
|
|
150
|
+
export declare function oneOf(constraintName: string, column: Column, values: readonly string[]): SQL<unknown>;
|
|
151
|
+
export {};
|
|
152
|
+
//# sourceMappingURL=columns.d.ts.map
|