mirror of
https://github.com/vercel/chat.git
synced 2026-09-14 18:32:29 +08:00
06fb8e59ef
* set up konsistent with basic initial config * add konsistent to CI * fix konsistent.json formatting * fix(gchat): move GoogleChatAdapterConfig to ./types for konsistent * fix(slack): move SlackAdapterConfig to ./types and drop Partial wrapper from createSlackAdapter * fix(messenger): name createMessengerAdapter parameter MessengerAdapterConfig * fix(web): rename WebAdapterOptions to WebAdapterConfig and import Adapter type in index.ts * fix(whatsapp): align WhatsAppAdapterConfig and creator with konsistent + map kebab to PascalCase * fix(state-memory): add MemoryStateAdapterOptions type for konsistent * fix(state-ioredis): unify URL and client options under IoRedisStateAdapterOptions * fix(state-redis): unify URL and client options under RedisStateAdapterOptions * fix(state-pg): unify URL and client options under PostgresStateAdapterOptions * chore: changeset for konsistent convention alignment * chore: drop CHANGELOG.md from konsistent's required files list CHANGELOG.md is generated automatically by changesets on each release — it's never hand-authored and doesn't exist for a package until its first release lands. Requiring it as a convention check makes CI fail indefinitely for any newly added package, with no honest fix available (an empty placeholder is just noise that gets overwritten on first release). * docs: document konsistent and package shape conventions * fix(web): use WebAdapterConfig in WebAdapter field types after main merge The merge of main into konsistent brought in PR #475's `protected` field modifiers on top of the WebAdapterOptions → WebAdapterConfig rename, leaving two stale references to the (un-imported) old name. Switch them to WebAdapterConfig and update a stale JSDoc reference in als.ts to match. --------- Co-authored-by: Ben Sabic <bensabic@users.noreply.github.com> Co-authored-by: Ben Sabic <27636870+bensabic@users.noreply.github.com>
112 lines
3.6 KiB
JSON
112 lines
3.6 KiB
JSON
{
|
|
"$schema": "../node_modules/konsistent/konsistent.schema.json",
|
|
"version": "v1",
|
|
"conventions": [
|
|
{
|
|
"name": "package-dir-must-have-required-files",
|
|
"description": "Every package directory must contain a specific minimum set of files.",
|
|
"paths": ["packages/*", "!packages/integration-tests"],
|
|
"must": [
|
|
{
|
|
"name": "package-dir-must-have-package-and-docs-files",
|
|
"description": "Every package directory must contain README, package.json and tsconfig.json.",
|
|
"must": {
|
|
"haveType": "directory",
|
|
"haveFiles": [
|
|
"README.md",
|
|
"package.json",
|
|
"tsconfig.json",
|
|
"tsup.config.ts",
|
|
"src/index.ts"
|
|
]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "adapter-package-must-export-required-symbols",
|
|
"description": "Every adapter package must have specific files that export a specific set of symbols.",
|
|
"paths": [
|
|
"packages/adapter-{adapterId}/src/index.ts",
|
|
"!packages/adapter-shared"
|
|
],
|
|
"must": [
|
|
{
|
|
"name": "adapter-package-must-export-provider-creator-and-settings",
|
|
"description": "Every adapter package must export adapter class, creator function, and config type from its index.ts file.",
|
|
"must": {
|
|
"importTypes": [
|
|
{
|
|
"name": "Adapter",
|
|
"from": "chat"
|
|
}
|
|
],
|
|
"exportClasses": [
|
|
{
|
|
"name": "${adapterId.toPascalCase()}Adapter",
|
|
"implement": ["Adapter"]
|
|
}
|
|
],
|
|
"exportFunctions": [
|
|
{
|
|
"name": "create${adapterId.toPascalCase()}Adapter",
|
|
"receiveParamOfType": "${adapterId.toPascalCase()}AdapterConfig",
|
|
"returnValueOfType": "${adapterId.toPascalCase()}Adapter"
|
|
}
|
|
],
|
|
"exportTypes": [
|
|
{
|
|
"name": "${adapterId.toPascalCase()}AdapterConfig",
|
|
"from": "./types"
|
|
}
|
|
],
|
|
"haveFiles": ["types.ts"]
|
|
}
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"name": "state-package-must-export-required-symbols",
|
|
"description": "Every state package must have specific files that export a specific set of symbols.",
|
|
"paths": ["packages/state-{stateAdapterId}/src/index.ts"],
|
|
"must": [
|
|
{
|
|
"name": "state-package-must-export-provider-creator-and-settings",
|
|
"description": "Every state package must export state adapter class, creator function, and config type from its index.ts file.",
|
|
"must": {
|
|
"importTypes": [
|
|
{
|
|
"name": "StateAdapter",
|
|
"from": "chat"
|
|
}
|
|
],
|
|
"exportClasses": [
|
|
{
|
|
"name": "${stateAdapterId.toPascalCase()}StateAdapter",
|
|
"implement": ["StateAdapter"]
|
|
}
|
|
],
|
|
"exportFunctions": [
|
|
{
|
|
"name": "create${stateAdapterId.toPascalCase()}State",
|
|
"receiveParamOfType": "${stateAdapterId.toPascalCase()}StateAdapterOptions",
|
|
"returnValueOfType": "${stateAdapterId.toPascalCase()}StateAdapter"
|
|
}
|
|
],
|
|
"exportTypes": [
|
|
"${stateAdapterId.toPascalCase()}StateAdapterOptions"
|
|
]
|
|
}
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"kebabToPascalMap": {
|
|
"gchat": "GoogleChat",
|
|
"github": "GitHub",
|
|
"ioredis": "IoRedis",
|
|
"pg": "Postgres",
|
|
"whatsapp": "WhatsApp"
|
|
}
|
|
}
|