ticlawk 0.1.15 → 0.1.16-dev.2

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.
@@ -3,48 +3,32 @@ import {
3
3
  getTiclawkAuthHelp,
4
4
  runTiclawkAuth,
5
5
  } from '../adapters/ticlawk/index.mjs';
6
- import {
7
- createTelegramAdapter,
8
- getTelegramAuthHelp,
9
- runTelegramAuth,
10
- } from '../adapters/telegram/index.mjs';
11
6
 
12
- const FACTORIES = {
13
- ticlawk: createTiclawkAdapter,
14
- telegram: createTelegramAdapter,
15
- };
7
+ /**
8
+ * Ticlawk has a single adapter: ticlawk itself. The registry shape is kept
9
+ * so callers can still depend on a stable surface (createAdapter, etc.)
10
+ * without branching on adapter ids.
11
+ */
16
12
 
17
- const AUTH_HANDLERS = {
18
- ticlawk: {
19
- help: getTiclawkAuthHelp,
20
- run: runTiclawkAuth,
21
- },
22
- telegram: {
23
- help: getTelegramAuthHelp,
24
- run: runTelegramAuth,
25
- },
26
- };
13
+ const ADAPTER_ID = 'ticlawk';
27
14
 
28
15
  export function createAdapter(adapterId, ctx) {
29
- const factory = FACTORIES[adapterId];
30
- if (!factory) {
16
+ if (adapterId !== ADAPTER_ID) {
31
17
  throw new Error(`unsupported adapter: ${adapterId}`);
32
18
  }
33
- return factory(ctx);
19
+ return createTiclawkAdapter(ctx);
34
20
  }
35
21
 
36
22
  export function getAdapterAuthHelp(adapterId) {
37
- const handler = AUTH_HANDLERS[adapterId];
38
- if (!handler?.help) {
23
+ if (adapterId !== ADAPTER_ID) {
39
24
  throw new Error(`unsupported adapter: ${adapterId}`);
40
25
  }
41
- return handler.help();
26
+ return getTiclawkAuthHelp();
42
27
  }
43
28
 
44
29
  export async function runAdapterAuth(adapterId, rawArgs) {
45
- const handler = AUTH_HANDLERS[adapterId];
46
- if (!handler?.run) {
30
+ if (adapterId !== ADAPTER_ID) {
47
31
  throw new Error(`unsupported adapter: ${adapterId}`);
48
32
  }
49
- return handler.run(rawArgs);
33
+ return runTiclawkAuth(rawArgs);
50
34
  }