@drhomet/mithaq 0.0.0-stage → 0.2.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.
Files changed (152) hide show
  1. package/LICENSE +22 -0
  2. package/LICENSES/openstatus-time-picker.txt +21 -0
  3. package/LICENSES/payload.txt +22 -0
  4. package/LICENSES/ponytail.txt +21 -0
  5. package/README.md +160 -2
  6. package/dist/asas/actor.d.ts +96 -0
  7. package/dist/asas/actor.js +114 -0
  8. package/dist/asas/build.d.ts +239 -0
  9. package/dist/asas/build.js +834 -0
  10. package/dist/asas/cli/mithaq.d.ts +2 -0
  11. package/dist/asas/cli/mithaq.js +177 -0
  12. package/dist/asas/cli/upgrade.d.ts +33 -0
  13. package/dist/asas/cli/upgrade.js +256 -0
  14. package/dist/asas/http/fetch.d.ts +41 -0
  15. package/dist/asas/http/fetch.js +178 -0
  16. package/dist/asas/http/orpc.d.ts +45 -0
  17. package/dist/asas/http/orpc.js +153 -0
  18. package/dist/asas/runner/bulk.d.ts +20 -0
  19. package/dist/asas/runner/bulk.js +196 -0
  20. package/dist/asas/runner/errors.d.ts +63 -0
  21. package/dist/asas/runner/errors.js +75 -0
  22. package/dist/asas/runner/read.d.ts +72 -0
  23. package/dist/asas/runner/read.js +601 -0
  24. package/dist/asas/runner/runtime.d.ts +21 -0
  25. package/dist/asas/runner/runtime.js +8 -0
  26. package/dist/asas/runner/steps.d.ts +418 -0
  27. package/dist/asas/runner/steps.js +277 -0
  28. package/dist/asas/runner/store.d.ts +4 -0
  29. package/dist/asas/runner/store.js +21 -0
  30. package/dist/asas/runner/tenant.d.ts +54 -0
  31. package/dist/asas/runner/tenant.js +275 -0
  32. package/dist/asas/runner/write.d.ts +606 -0
  33. package/dist/asas/runner/write.js +1019 -0
  34. package/dist/auth/better-auth/access.d.ts +29 -0
  35. package/dist/auth/better-auth/access.js +103 -0
  36. package/dist/auth/better-auth/generate.d.ts +31 -0
  37. package/dist/auth/better-auth/generate.js +328 -0
  38. package/dist/auth/better-auth/index.d.ts +94 -0
  39. package/dist/auth/better-auth/index.js +81 -0
  40. package/dist/auth/better-auth/tenant.d.ts +26 -0
  41. package/dist/auth/better-auth/tenant.js +34 -0
  42. package/dist/auth/local/index.d.ts +285 -0
  43. package/dist/auth/local/index.js +738 -0
  44. package/dist/base/decimal.d.ts +9 -0
  45. package/dist/base/decimal.js +16 -0
  46. package/dist/base/fields.d.ts +124 -0
  47. package/dist/base/fields.js +52 -0
  48. package/dist/base/index.d.ts +47 -0
  49. package/dist/base/index.js +5 -0
  50. package/dist/base/json-schema.d.ts +7 -0
  51. package/dist/base/json-schema.js +35 -0
  52. package/dist/base/kinds.d.ts +75 -0
  53. package/dist/base/kinds.js +123 -0
  54. package/dist/base/rules.d.ts +73 -0
  55. package/dist/base/rules.js +81 -0
  56. package/dist/drizzle/index.d.ts +308 -0
  57. package/dist/drizzle/index.js +951 -0
  58. package/dist/drizzle/kinds.d.ts +28 -0
  59. package/dist/drizzle/kinds.js +43 -0
  60. package/dist/drizzle/migrate.d.ts +159 -0
  61. package/dist/drizzle/migrate.js +1328 -0
  62. package/dist/drizzle/proxy/index.d.ts +1 -0
  63. package/dist/drizzle/proxy/index.js +1 -0
  64. package/dist/drizzle/proxy/node-postgres.d.ts +1 -0
  65. package/dist/drizzle/proxy/node-postgres.js +1 -0
  66. package/dist/drizzle/proxy/pg-core.d.ts +1 -0
  67. package/dist/drizzle/proxy/pg-core.js +1 -0
  68. package/dist/drizzle/rules.d.ts +336 -0
  69. package/dist/drizzle/rules.js +44 -0
  70. package/dist/index.d.ts +35 -0
  71. package/dist/index.js +26 -0
  72. package/dist/mithaq/define.d.ts +335 -0
  73. package/dist/mithaq/define.js +57 -0
  74. package/dist/mithaq/generate-messages.d.ts +38 -0
  75. package/dist/mithaq/generate-messages.js +235 -0
  76. package/dist/mithaq/language.d.ts +374 -0
  77. package/dist/mithaq/language.js +76 -0
  78. package/dist/mithaq/lock.d.ts +71 -0
  79. package/dist/mithaq/lock.js +329 -0
  80. package/dist/mithaq/message-file.d.ts +13 -0
  81. package/dist/mithaq/message-file.js +29 -0
  82. package/dist/mithaq/messages.d.ts +55 -0
  83. package/dist/mithaq/messages.js +111 -0
  84. package/dist/mithaq/refusal.d.ts +6 -0
  85. package/dist/mithaq/refusal.js +6 -0
  86. package/dist/mithaq/resolve.d.ts +10 -0
  87. package/dist/mithaq/resolve.js +1014 -0
  88. package/dist/mithaq/rows.d.ts +87 -0
  89. package/dist/mithaq/rows.js +174 -0
  90. package/dist/mithaq/rukn.d.ts +72 -0
  91. package/dist/mithaq/rukn.js +15 -0
  92. package/dist/mithaq/standard-schema.d.ts +38 -0
  93. package/dist/mithaq/standard-schema.js +2 -0
  94. package/dist/mithaq/types.d.ts +386 -0
  95. package/dist/mithaq/types.js +15 -0
  96. package/dist/mithaq/user.d.ts +19 -0
  97. package/dist/mithaq/user.js +16 -0
  98. package/dist/mithaq/where.d.ts +32 -0
  99. package/dist/mithaq/where.js +87 -0
  100. package/dist/rbac/index.d.ts +105 -0
  101. package/dist/rbac/index.js +182 -0
  102. package/dist/rbac/steps.d.ts +22 -0
  103. package/dist/rbac/steps.js +161 -0
  104. package/dist/rich-text/index.d.ts +28 -0
  105. package/dist/rich-text/index.js +59 -0
  106. package/dist/rich-text/rich-text.d.ts +106 -0
  107. package/dist/rich-text/rich-text.js +249 -0
  108. package/dist/rich-text/value.d.ts +55 -0
  109. package/dist/rich-text/value.js +126 -0
  110. package/dist/screen/client.d.ts +156 -0
  111. package/dist/screen/client.js +71 -0
  112. package/dist/screen/generate.d.ts +14 -0
  113. package/dist/screen/generate.js +268 -0
  114. package/dist/screen/index.d.ts +496 -0
  115. package/dist/screen/index.js +663 -0
  116. package/dist/screen/react.d.ts +97 -0
  117. package/dist/screen/react.js +58 -0
  118. package/dist/screen/studio.d.ts +24 -0
  119. package/dist/screen/studio.js +68 -0
  120. package/dist/service/index.d.ts +63 -0
  121. package/dist/service/index.js +15 -0
  122. package/dist/storage/allowed-type.d.ts +5 -0
  123. package/dist/storage/allowed-type.js +7 -0
  124. package/dist/storage/index.d.ts +42 -0
  125. package/dist/storage/index.js +43 -0
  126. package/dist/storage/storage.d.ts +386 -0
  127. package/dist/storage/storage.js +412 -0
  128. package/dist/targets.d.ts +14 -0
  129. package/dist/targets.js +16 -0
  130. package/dist/versions/index.d.ts +37 -0
  131. package/dist/versions/index.js +8 -0
  132. package/dist/versions/versions.d.ts +104 -0
  133. package/dist/versions/versions.js +160 -0
  134. package/dist/vite.d.ts +7 -0
  135. package/dist/vite.js +81 -0
  136. package/dist/zod/index.d.ts +193 -0
  137. package/dist/zod/index.js +122 -0
  138. package/dist/zod/kinds.d.ts +36 -0
  139. package/dist/zod/kinds.js +58 -0
  140. package/dist/zod/rules.d.ts +117 -0
  141. package/dist/zod/rules.js +67 -0
  142. package/docs/packages/mithaq/README.md +962 -0
  143. package/docs/packages/mithaq/src/asas/cli/README.md +252 -0
  144. package/docs/packages/mithaq/src/asas/runner/README.md +472 -0
  145. package/docs/packages/mithaq/src/drizzle/README.md +39 -0
  146. package/docs/packages/mithaq-admin/README.md +312 -0
  147. package/docs/templates/asas/README.md +1056 -0
  148. package/package.json +92 -4
  149. package/skills/add-field/SKILL.md +27 -0
  150. package/skills/add-kayan/SKILL.md +26 -0
  151. package/skills/eject-admin-piece/SKILL.md +28 -0
  152. package/skills/upgrade-mithaq/SKILL.md +35 -0
@@ -0,0 +1,239 @@
1
+ import { type AuthStrategy, type AuthStrategyResult } from './actor.ts';
2
+ import { betterAuthStrategy } from '../auth/better-auth/index.ts';
3
+ import { type LocalAuthActor, type ProtectedLocalField } from '../auth/local/index.ts';
4
+ import { type OperationEffect } from './runner/steps.ts';
5
+ import { type Globals, type Procedures, type Row, type Writes } from './runner/write.ts';
6
+ import { type ActorBoundAccess, type Kayan, type RuntimeField, type ServiceOf } from '../mithaq/types.ts';
7
+ import { type Language } from '../mithaq/language.ts';
8
+ import type { StandardSchemaV1 } from '../mithaq/standard-schema.ts';
9
+ import type { BuiltTables } from '../drizzle/index.ts';
10
+ import { type ScreenClient } from '../screen/index.ts';
11
+ import { type MessageRegistry, type MessagesResolver } from '../mithaq/messages.ts';
12
+ type UniqueNames<List extends readonly Kayan[], Seen = never> = List extends readonly [
13
+ infer Head extends Kayan,
14
+ ...infer Tail extends readonly Kayan[]
15
+ ] ? Head['name'] extends Seen ? false : UniqueNames<Tail, Seen | Head['name']> : true;
16
+ type BetterAuthServer = Parameters<typeof betterAuthStrategy>[0]['server'];
17
+ type ActorFor<L extends Language, KayanList extends readonly Kayan[]> = [Extract<AuthStrategies<L, KayanList>, AuthStrategy>] extends [never] ? unknown : Awaited<ReturnType<Extract<Extract<AuthStrategies<L, KayanList>, AuthStrategy>, AuthStrategy>['authenticate']>> extends AuthStrategyResult<infer Result> ? Result : never;
18
+ type Equal<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => (T extends B ? 1 : 2) ? true : false;
19
+ type FirstArg<Fn> = Fn extends (...args: infer Args) => unknown ? Args extends [] ? never : Args[0] : never;
20
+ type UserFromArg<Arg> = Arg extends {
21
+ user: infer User;
22
+ } ? NonNullable<User> : unknown;
23
+ type IdFromArg<Arg> = Arg extends {
24
+ id?: infer Id;
25
+ } ? Id : unknown;
26
+ type DataFromArg<Arg> = Arg extends {
27
+ data?: infer Data;
28
+ } ? Data : unknown;
29
+ type DocFromArg<Arg> = Arg extends {
30
+ doc?: infer Doc;
31
+ } ? Doc : unknown;
32
+ type CallbackRequirement<Fn> = [FirstArg<Fn>] extends [never] ? never : {
33
+ actor: UserFromArg<FirstArg<Fn>>;
34
+ data: DataFromArg<FirstArg<Fn>>;
35
+ doc: DocFromArg<FirstArg<Fn>>;
36
+ id: IdFromArg<FirstArg<Fn>>;
37
+ };
38
+ type AccessRequirement<K> = K extends {
39
+ access?: infer Access;
40
+ } ? NonNullable<Access> extends infer A ? '__mithaqAccessActor' extends keyof A ? A extends ActorBoundAccess<infer Actor> ? {
41
+ actor: Actor;
42
+ data: unknown;
43
+ doc: unknown;
44
+ id: unknown;
45
+ } | CallbackRequirement<A extends {
46
+ create?: infer Fn;
47
+ } ? NonNullable<Fn> : never> | CallbackRequirement<A extends {
48
+ read?: infer Fn;
49
+ } ? NonNullable<Fn> : never> | CallbackRequirement<A extends {
50
+ update?: infer Fn;
51
+ } ? NonNullable<Fn> : never> | CallbackRequirement<A extends {
52
+ delete?: infer Fn;
53
+ } ? NonNullable<Fn> : never> : never : never : never : never;
54
+ type FieldAccessRequirement<Fields> = Fields extends Record<string, RuntimeField> ? Fields[keyof Fields] extends infer Field ? Field extends {
55
+ access?: infer Access;
56
+ } ? {} extends Pick<Field, 'access'> ? never : NonNullable<NonNullable<Access>[keyof NonNullable<Access>]> extends infer Fn ? '__mithaqAccessActor' extends keyof NonNullable<Fn> ? NonNullable<Fn> extends ActorBoundAccess<infer Actor> ? {
57
+ actor: Actor;
58
+ data: unknown;
59
+ doc: unknown;
60
+ id: unknown;
61
+ } | CallbackRequirement<NonNullable<Fn>> | ('__mithaqFieldData' extends keyof NonNullable<Fn> ? NonNullable<Fn> extends {
62
+ __mithaqFieldData: infer Data;
63
+ __mithaqFieldId: infer Id;
64
+ } ? {
65
+ actor: Actor;
66
+ data: unknown;
67
+ doc: Data;
68
+ id: Id;
69
+ } : never : never) : never : never : never : never : never : never;
70
+ type BroadRecord = Record<string, unknown>;
71
+ type IsUnknown<T> = Equal<T, unknown>;
72
+ type IsBroadRecord<T> = Equal<T, BroadRecord>;
73
+ type MatchesDoc<Expected, Actual> = IsUnknown<Expected> extends true ? true : IsBroadRecord<Expected> extends true ? true : Equal<Expected, Actual>;
74
+ type MatchesData<Expected, Actual> = IsUnknown<Expected> extends true ? true : IsBroadRecord<Expected> extends true ? true : [Partial<Actual>] extends [Expected] ? true : false;
75
+ type MatchesId<Expected, Actual> = IsUnknown<Expected> extends true ? true : Equal<Expected, Actual>;
76
+ type MismatchName<One, Required, Actor, L extends Language, KayanList extends readonly Kayan[]> = Required extends {
77
+ actor: infer Needed;
78
+ data: infer Data;
79
+ doc: infer Doc;
80
+ id: infer Id;
81
+ } ? [Actor] extends [never] ? One extends {
82
+ name: infer Name;
83
+ } ? Name : never : [Actor] extends [Needed] ? One extends Kayan ? MatchesDoc<Doc, Row<One['fields'], L, KayanList>> extends true ? MatchesData<Data, Row<One['fields'], L, KayanList>> extends true ? 'id' extends keyof Row<One['fields'], L, KayanList> ? MatchesId<Id, Row<One['fields'], L, KayanList>['id']> extends true ? never : One extends {
84
+ name: infer Name;
85
+ } ? Name : never : One extends {
86
+ name: infer Name;
87
+ } ? Name : never : One extends {
88
+ name: infer Name;
89
+ } ? Name : never : One extends {
90
+ name: infer Name;
91
+ } ? Name : never : never : One extends {
92
+ name: infer Name;
93
+ } ? Name : never : never;
94
+ type AccessActorMismatch<KayanList extends readonly Kayan[], L extends Language, Actor> = KayanList[number] extends infer One ? MismatchName<One, AccessRequirement<One> | (One extends {
95
+ fields: infer Fields;
96
+ } ? FieldAccessRequirement<Fields> : never), Actor, L, KayanList> : never;
97
+ type AdminAccessRequirement<Auth> = Auth extends {
98
+ admin?: infer Admin;
99
+ } ? NonNullable<Admin> extends {
100
+ access?: infer Fn;
101
+ } ? CallbackRequirement<NonNullable<Fn>> : never : never;
102
+ type AdminAccessMismatch<Auth, Actor> = MismatchName<{
103
+ name: 'auth.admin.access';
104
+ }, AdminAccessRequirement<Auth>, Actor, never, never>;
105
+ type AdminAccessShapeMismatch<Auth> = Auth extends {
106
+ admin?: infer Admin;
107
+ } ? NonNullable<Admin> extends {
108
+ access: infer Fn;
109
+ } ? NonNullable<Fn> extends (...args: infer _Args) => infer Return ? Return extends boolean | Promise<boolean> ? never : 'auth.admin.access' : 'auth.admin.access' : never : never;
110
+ /** The keys this project has, in the two shapes `buildAsas` publishes them in. */
111
+ export type Vocabulary = {
112
+ catalog: readonly string[];
113
+ statements: Readonly<Record<string, readonly string[]>>;
114
+ /**
115
+ * How many rows, across every organization, still name the auth kayan's row `id` through a
116
+ * relationship that restricts its delete. A provider route that deletes a person outside a
117
+ * transaction asks it first, since the foreign key would fail only after other rows went.
118
+ */
119
+ referenced: (id: string) => Promise<number>;
120
+ };
121
+ /** The build's auth: the admin kayan whose actor passes default access, and where failures are reported. */
122
+ export type AuthConfig = {
123
+ /** The admin kayan: whose actor passes default access. */
124
+ admin?: {
125
+ kayan: Kayan;
126
+ access?: unknown;
127
+ };
128
+ /** Handed a strategy that threw and an access target that could not answer, each as an `Error` with the cause. Required where any kayan carries auth. */
129
+ onError: (error: unknown) => void;
130
+ /** The largest body an auth route reads, answered 413 past it: `defaultMaxBodyBytes` or the project's own. Required where any kayan carries auth. */
131
+ maxBodyBytes: number;
132
+ };
133
+ type PublicLocalUser<K extends Kayan, L extends Language, KayanList extends readonly Kayan[]> = Omit<Row<K['fields'], L, KayanList>, ProtectedLocalField>;
134
+ /** One strategy per kayan carrying `auth`, typed by that provider's or that strategy's own actor. */
135
+ type AuthStrategies<L extends Language, KayanList extends readonly Kayan[]> = KayanList[number] extends infer One ? One extends Kayan ? One['auth'] extends infer Declared ? Declared extends {
136
+ provider: 'local';
137
+ } ? AuthStrategy<LocalAuthActor<One['name'], PublicLocalUser<One, L, KayanList>>> : Declared extends {
138
+ provider: 'better-auth';
139
+ server: (...args: never[]) => infer Server;
140
+ } ? Server extends BetterAuthServer ? ReturnType<typeof betterAuthStrategy<Server, One['name']>> : never : Declared extends AuthStrategy ? Declared : never : never : never : never;
141
+ /** One built operation in the flat table `buildAsas` publishes: one entry per operation of every kayan and global, in declared order. */
142
+ export type Operation = {
143
+ /** The kayan or global the operation belongs to. */
144
+ kayan: string;
145
+ /** The operation's own name, which is also the action an access row grants. */
146
+ name: string;
147
+ effect: OperationEffect;
148
+ /** True for a global: its read takes no id and its update makes the row. */
149
+ single: boolean;
150
+ /** What a caller may send. A global's update publishes its update shape without the id, so a first update short of a required field is refused by the runner. */
151
+ input: StandardSchemaV1;
152
+ /** Runs the operation with the actor the request resolved and the context the plug's `context` function built. */
153
+ call: (input: unknown, options: ServedOptions) => Promise<unknown>;
154
+ };
155
+ /** What a plug hands a served call beside its input. */
156
+ export type ServedOptions = {
157
+ actor: unknown;
158
+ context?: Record<string, unknown>;
159
+ /** `?draft=true` on a kayan that keeps drafts. Nothing else a client sends reaches a call as an option. */
160
+ draft?: boolean;
161
+ autosave?: boolean;
162
+ /** `?tenant=mine` or `?tenant=all` on a read. A write sent one is refused. */
163
+ tenant?: string;
164
+ };
165
+ /** The operation table: the flat array a plug iterates, and `procedures`, a type-only view keyed by kayan then operation. */
166
+ export interface OperationTable<View = unknown> extends ReadonlyArray<Operation> {
167
+ /** Type only. There is no such property on the array at runtime. */
168
+ readonly procedures?: View;
169
+ }
170
+ /**
171
+ * What an HTTP plug hands back: `router`, which a typed client is built from, and `handle`,
172
+ * which answers `null` where no route of its own matched so the next plug is asked.
173
+ */
174
+ export type HttpPlug = {
175
+ /** The plug's own name, unique in the list. */
176
+ name: string;
177
+ router: unknown;
178
+ /** `actor` is a thunk, so a request no route of this plug matches costs no session lookup. */
179
+ handle: (request: Request, actor: () => Promise<unknown>) => Promise<Response | null>;
180
+ };
181
+ /**
182
+ * Every declared thing of one build, kayan and global alike, which is the
183
+ * registry a relationship is resolved against.
184
+ */
185
+ type Declared<KayanList extends readonly Kayan[], GlobalList extends readonly Kayan[]> = readonly (KayanList[number] | GlobalList[number])[];
186
+ export declare const buildAsas: <const L extends Language, const KayanList extends readonly Kayan[], const GlobalList extends readonly Kayan[] = readonly [], Auth extends AuthConfig = AuthConfig, Http extends HttpPlug = HttpPlug>(language: L, { kayan, global, auth, http, messages, statements: declaredStatements, }: {
187
+ kayan: KayanList & (UniqueNames<KayanList> extends true ? unknown : {
188
+ duplicateKayanNames: never;
189
+ }) & (AccessActorMismatch<KayanList, L, ActorFor<L, KayanList>> | AdminAccessMismatch<Auth, ActorFor<L, KayanList>> | AdminAccessShapeMismatch<Auth> extends never ? unknown : {
190
+ authAccessActorMismatch: AccessActorMismatch<KayanList, L, ActorFor<L, KayanList>> | AdminAccessMismatch<Auth, ActorFor<L, KayanList>> | AdminAccessShapeMismatch<Auth>;
191
+ });
192
+ /** The globals, each a kayan of one row. They share the kayan namespace. */
193
+ global?: GlobalList;
194
+ auth?: Auth;
195
+ /**
196
+ * The HTTP plugs, asked in order, so the order decides who owns a prefix two claim. Required:
197
+ * `fetchHttp` takes no dependency; `orpcHttp` first gives `asas.router` its typed client.
198
+ */
199
+ http: readonly [(operations: OperationTable<Procedures<KayanList, GlobalList, Declared<KayanList, GlobalList>, L>>) => Http, ...((operations: OperationTable<Procedures<KayanList, GlobalList, Declared<KayanList, GlobalList>, L>>) => HttpPlug)[]];
200
+ /** The project's own copy for the labels mithaq ships, as one resolver whose return shape mithaq declares. */
201
+ messages?: MessagesResolver<L>;
202
+ /** Keys no declaration derives, such as an auth provider's own actions, added to the vocabulary under the resources they name. */
203
+ statements?: Readonly<Record<string, readonly string[]>>;
204
+ }) => {
205
+ /** Every permission key this project has: one `<kayan>.<operation>` per operation, one `<kayan>.fields.<field>` per field, one `screen.<screen>` per screen. */
206
+ catalog: readonly string[];
207
+ /** Every scope of copy this project has. A getter: only the CLI reads it, and it calls the project's own resolver. */
208
+ readonly messages: MessageRegistry;
209
+ /** The same catalog in Better Auth's shape, for `createAccessControl(asas.statements)`. */
210
+ statements: Readonly<Record<string, readonly string[]>>;
211
+ /** Every built operation, flat. Its `procedures` view is a type, keyed by kayan then operation. */
212
+ operations: OperationTable<Procedures<KayanList, GlobalList, Declared<KayanList, GlobalList>, L>>;
213
+ /** The router the first plug built, which a typed client is built from; `undefined` for `fetchHttp`. */
214
+ router: Http['router'];
215
+ /** Every target as the language passed it, so `asas.targets.drizzle.db` is drizzle. A screen also carries its projection under `client`. */
216
+ targets: { [Name in keyof L['targets']]: L['targets'][Name] extends {
217
+ tables: unknown;
218
+ } ? Omit<L['targets'][Name], 'tables'> & {
219
+ tables: BuiltTables<Declared<KayanList, GlobalList>, Name, ServiceOf<L>['store'], L['kinds']>;
220
+ } : L['targets'][Name] extends {
221
+ capability: 'screen';
222
+ } ? L['targets'][Name] & {
223
+ client: ScreenClient;
224
+ } : L['targets'][Name]; };
225
+ kayan: Writes<KayanList, Declared<KayanList, GlobalList>, L, ActorFor<L, KayanList>>;
226
+ /** One row per global, under `findOne` and `update`. */
227
+ global: Globals<GlobalList, Declared<KayanList, GlobalList>, L, ActorFor<L, KayanList>>;
228
+ /** The strategies in the order the loop tries them, and the loop itself. */
229
+ auth: {
230
+ strategies: Extract<AuthStrategies<L, KayanList>, AuthStrategy>[];
231
+ actor: (headers: Headers) => Promise<ActorFor<L, KayanList> | null>;
232
+ };
233
+ handler: (request: Request) => Promise<Response>;
234
+ connect: ({ readOnly }?: {
235
+ readOnly?: boolean;
236
+ }) => Promise<void>;
237
+ destroy: () => Promise<void>;
238
+ };
239
+ export {};