ocel 0.0.1-alpha.0 → 0.0.1

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 (271) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +2 -0
  3. package/README.md +98 -0
  4. package/dist/binding/binding.d.ts +22 -0
  5. package/dist/binding/binding.js +60 -0
  6. package/dist/binding/unprovisioned.d.ts +17 -0
  7. package/dist/binding/unprovisioned.js +25 -0
  8. package/dist/bucket/bucket-client.d.ts +4 -0
  9. package/dist/bucket/bucket-client.js +5 -0
  10. package/dist/bucket/bucket-context.d.ts +8 -0
  11. package/dist/bucket/bucket-context.js +10 -0
  12. package/dist/bucket/bucket.d.ts +60 -0
  13. package/dist/bucket/bucket.js +91 -0
  14. package/dist/bucket/client.d.ts +49 -0
  15. package/dist/bucket/client.js +95 -0
  16. package/dist/bucket/errors.d.ts +12 -0
  17. package/dist/bucket/errors.js +20 -0
  18. package/dist/bucket/express.d.ts +10 -0
  19. package/dist/bucket/express.js +24 -0
  20. package/dist/bucket/hono.d.ts +18 -0
  21. package/dist/bucket/hono.js +13 -0
  22. package/dist/bucket/index.d.ts +8 -0
  23. package/dist/bucket/index.js +6 -0
  24. package/dist/bucket/keys.d.ts +5 -0
  25. package/dist/bucket/keys.js +24 -0
  26. package/dist/bucket/metadata.d.ts +6 -0
  27. package/dist/bucket/metadata.js +6 -0
  28. package/dist/bucket/next.d.ts +15 -0
  29. package/dist/bucket/next.js +11 -0
  30. package/dist/bucket/objects.d.ts +130 -0
  31. package/dist/bucket/objects.js +350 -0
  32. package/dist/bucket/route.d.ts +13 -0
  33. package/dist/bucket/route.js +247 -0
  34. package/dist/bucket/server-only.js +5 -0
  35. package/dist/bucket/types.d.ts +63 -0
  36. package/dist/bucket/uploader.d.ts +3 -0
  37. package/dist/bucket/uploader.js +6 -0
  38. package/dist/build-env.d.ts +17 -0
  39. package/dist/build-env.js +41 -0
  40. package/dist/config.d.ts +30 -0
  41. package/dist/config.js +9 -0
  42. package/dist/declaration/callsite.d.ts +15 -0
  43. package/dist/declaration/callsite.js +43 -0
  44. package/dist/declaration/component.d.ts +4 -0
  45. package/dist/declaration/component.js +1 -0
  46. package/dist/declaration/defer.d.ts +5 -0
  47. package/dist/declaration/defer.js +9 -0
  48. package/dist/delivery/duration.d.ts +13 -0
  49. package/dist/delivery/duration.js +36 -0
  50. package/dist/delivery/lane.d.ts +4 -0
  51. package/dist/delivery/lane.js +15 -0
  52. package/dist/delivery/payload.d.ts +6 -0
  53. package/dist/delivery/payload.js +14 -0
  54. package/dist/delivery/retry.d.ts +16 -0
  55. package/dist/delivery/retry.js +10 -0
  56. package/dist/delivery/schema.d.ts +10 -0
  57. package/dist/delivery/schema.js +20 -0
  58. package/dist/dns.d.ts +11 -0
  59. package/dist/dns.js +4 -0
  60. package/dist/edge.d.ts +4 -0
  61. package/dist/edge.js +4 -0
  62. package/dist/env/access.d.ts +22 -0
  63. package/dist/env/access.js +49 -0
  64. package/dist/env/client.d.ts +5 -0
  65. package/dist/env/client.js +10 -0
  66. package/dist/env/declare.d.ts +2 -0
  67. package/dist/env/declare.js +83 -0
  68. package/dist/env/definition.d.ts +46 -0
  69. package/dist/env/definition.js +164 -0
  70. package/dist/env/deployment.d.ts +23 -0
  71. package/dist/env/deployment.js +13 -0
  72. package/dist/env/edge.d.ts +10 -0
  73. package/dist/env/edge.js +30 -0
  74. package/dist/env/errors.d.ts +9 -0
  75. package/dist/env/errors.js +9 -0
  76. package/dist/env/file.d.ts +1 -0
  77. package/dist/env/file.js +27 -0
  78. package/dist/env/index.d.ts +10 -0
  79. package/dist/env/index.js +63 -0
  80. package/dist/env/live.d.ts +3 -0
  81. package/dist/env/live.js +12 -0
  82. package/dist/env/schema.d.ts +27 -0
  83. package/dist/env/schema.js +43 -0
  84. package/dist/env/scope.d.ts +7 -0
  85. package/dist/env/scope.js +45 -0
  86. package/dist/env/standard.d.ts +10 -0
  87. package/dist/env/standard.js +21 -0
  88. package/dist/env/value.d.ts +5 -0
  89. package/dist/env/value.js +26 -0
  90. package/dist/env-source.d.ts +17 -0
  91. package/dist/env-source.js +16 -0
  92. package/dist/gen/proto/app/bucket/v1/bucket_pb.d.ts +911 -0
  93. package/dist/gen/proto/app/bucket/v1/bucket_pb.js +253 -0
  94. package/dist/gen/proto/app/realtime/v1/realtime_pb.d.ts +50 -0
  95. package/dist/gen/proto/app/realtime/v1/realtime_pb.js +23 -0
  96. package/dist/gen/proto/app/resources/v1/resources_pb.d.ts +554 -0
  97. package/dist/gen/proto/app/resources/v1/resources_pb.js +214 -0
  98. package/dist/gen/proto/app/resources/v1/variables_pb.d.ts +231 -0
  99. package/dist/gen/proto/app/resources/v1/variables_pb.js +101 -0
  100. package/dist/gen/proto/app/task/v1/task_pb.d.ts +498 -0
  101. package/dist/gen/proto/app/task/v1/task_pb.js +151 -0
  102. package/dist/gen/proto/app/topic/v1/topic_pb.d.ts +456 -0
  103. package/dist/gen/proto/app/topic/v1/topic_pb.js +125 -0
  104. package/dist/gen/proto/buf/validate/validate_pb.d.ts +4833 -0
  105. package/dist/gen/proto/buf/validate/validate_pb.js +356 -0
  106. package/dist/gen/proto/common/bindings/v1/bindings_pb.d.ts +378 -0
  107. package/dist/gen/proto/common/bindings/v1/bindings_pb.js +140 -0
  108. package/dist/generated/config.d.ts +428 -0
  109. package/dist/generated/config.js +2 -0
  110. package/dist/kv/entries.d.ts +193 -0
  111. package/dist/kv/entries.js +325 -0
  112. package/dist/kv/errors.d.ts +12 -0
  113. package/dist/kv/errors.js +14 -0
  114. package/dist/kv/index.d.ts +6 -0
  115. package/dist/kv/index.js +3 -0
  116. package/dist/kv/ioredis.d.ts +2 -0
  117. package/dist/kv/ioredis.js +20 -0
  118. package/dist/kv/kv.d.ts +84 -0
  119. package/dist/kv/kv.js +177 -0
  120. package/dist/kv/pattern.d.ts +27 -0
  121. package/dist/kv/pattern.js +73 -0
  122. package/dist/kv/ttl.d.ts +22 -0
  123. package/dist/kv/ttl.js +21 -0
  124. package/dist/postgres/index.d.ts +21 -2
  125. package/dist/postgres/index.js +73 -2
  126. package/dist/postgres/pg.d.ts +5 -4
  127. package/dist/postgres/pg.js +16 -12
  128. package/dist/providers/aws/dns.d.ts +11 -0
  129. package/dist/providers/aws/dns.js +4 -0
  130. package/dist/providers/aws/edge.d.ts +6 -0
  131. package/dist/providers/aws/edge.js +8 -0
  132. package/dist/providers/aws/index.d.ts +4 -0
  133. package/dist/providers/aws/index.js +4 -0
  134. package/dist/providers/gcp/edge.d.ts +14 -0
  135. package/dist/providers/gcp/edge.js +14 -0
  136. package/dist/providers/gcp/index.d.ts +9 -0
  137. package/dist/providers/gcp/index.js +9 -0
  138. package/dist/providers/vps/index.d.ts +4 -0
  139. package/dist/providers/vps/index.js +4 -0
  140. package/dist/realtime/client-error.d.ts +30 -0
  141. package/dist/realtime/client-error.js +17 -0
  142. package/dist/realtime/client-event-socket.d.ts +8 -0
  143. package/dist/realtime/client-event-socket.js +169 -0
  144. package/dist/realtime/client-transport.d.ts +29 -0
  145. package/dist/realtime/client-transport.js +13 -0
  146. package/dist/realtime/client.d.ts +150 -0
  147. package/dist/realtime/client.js +345 -0
  148. package/dist/realtime/express.d.ts +18 -0
  149. package/dist/realtime/express.js +83 -0
  150. package/dist/realtime/handler.d.ts +56 -0
  151. package/dist/realtime/handler.js +287 -0
  152. package/dist/realtime/hono.d.ts +19 -0
  153. package/dist/realtime/hono.js +24 -0
  154. package/dist/realtime/index.d.ts +2 -0
  155. package/dist/realtime/index.js +2 -0
  156. package/dist/realtime/next.d.ts +26 -0
  157. package/dist/realtime/next.js +16 -0
  158. package/dist/realtime/realtime.d.ts +181 -0
  159. package/dist/realtime/realtime.js +205 -0
  160. package/dist/realtime/token.d.ts +20 -0
  161. package/dist/realtime/token.js +45 -0
  162. package/dist/realtime/transport.d.ts +11 -0
  163. package/dist/realtime/transport.js +15 -0
  164. package/dist/realtime/wire.d.ts +30 -0
  165. package/dist/realtime/wire.js +104 -0
  166. package/dist/runtime/dev-server.d.ts +8 -0
  167. package/dist/runtime/dev-server.js +8 -0
  168. package/dist/runtime/rpc.d.ts +23 -0
  169. package/dist/runtime/rpc.js +24 -0
  170. package/dist/runtime/transport.d.ts +11 -0
  171. package/dist/runtime/transport.js +35 -0
  172. package/dist/task/errors.d.ts +7 -0
  173. package/dist/task/errors.js +7 -0
  174. package/dist/task/hooks.d.ts +57 -0
  175. package/dist/task/hooks.js +1 -0
  176. package/dist/task/index.d.ts +9 -0
  177. package/dist/task/index.js +4 -0
  178. package/dist/task/runs.d.ts +74 -0
  179. package/dist/task/runs.js +82 -0
  180. package/dist/task/task.d.ts +117 -0
  181. package/dist/task/task.js +109 -0
  182. package/dist/topic/dead-letters.d.ts +53 -0
  183. package/dist/topic/dead-letters.js +62 -0
  184. package/dist/topic/index.d.ts +8 -0
  185. package/dist/topic/index.js +4 -0
  186. package/dist/topic/topic.d.ts +85 -0
  187. package/dist/topic/topic.js +117 -0
  188. package/dist/version.d.ts +2 -0
  189. package/dist/version.js +2 -0
  190. package/dist/worker/context.d.ts +36 -0
  191. package/dist/worker/context.js +1 -0
  192. package/dist/worker/deliver.d.ts +13 -0
  193. package/dist/worker/deliver.js +258 -0
  194. package/dist/worker/index.d.ts +4 -0
  195. package/dist/worker/index.js +2 -0
  196. package/dist/worker/registry.d.ts +28 -0
  197. package/dist/worker/registry.js +22 -0
  198. package/dist/worker/semaphore.d.ts +7 -0
  199. package/dist/worker/semaphore.js +36 -0
  200. package/dist/worker/worker.d.ts +21 -0
  201. package/dist/worker/worker.js +32 -0
  202. package/package.json +158 -57
  203. package/bin/run.js +0 -39
  204. package/dist/blob/bucket.d.ts +0 -55
  205. package/dist/blob/bucket.js +0 -65
  206. package/dist/blob/index.d.ts +0 -8
  207. package/dist/blob/index.js +0 -13
  208. package/dist/blob/integrations/client.d.ts +0 -25
  209. package/dist/blob/integrations/client.js +0 -71
  210. package/dist/blob/integrations/hono.d.ts +0 -31
  211. package/dist/blob/integrations/hono.js +0 -11
  212. package/dist/blob/mime-types.d.ts +0 -1
  213. package/dist/blob/parse.d.ts +0 -16
  214. package/dist/blob/parse.js +0 -69
  215. package/dist/blob/s3-listener.d.ts +0 -7
  216. package/dist/blob/s3-listener.js +0 -35
  217. package/dist/blob/types.d.ts +0 -128
  218. package/dist/blob/types.js +0 -1
  219. package/dist/blob/upload-error.d.ts +0 -35
  220. package/dist/blob/upload-error.js +0 -54
  221. package/dist/blob/uploader.d.ts +0 -67
  222. package/dist/blob/uploader.js +0 -323
  223. package/dist/internal/db/index.d.ts +0 -68
  224. package/dist/internal/db/index.js +0 -73
  225. package/dist/lambda/index.d.ts +0 -2
  226. package/dist/lambda/index.js +0 -4
  227. package/dist/lambda/integrations/express.d.ts +0 -3
  228. package/dist/lambda/integrations/express.js +0 -13
  229. package/dist/lambda/integrations/hono.d.ts +0 -3
  230. package/dist/lambda/integrations/hono.js +0 -13
  231. package/dist/lambda/lambda.d.ts +0 -43
  232. package/dist/lambda/lambda.js +0 -30
  233. package/dist/utils/component.d.ts +0 -3
  234. package/dist/utils/constants.d.ts +0 -2
  235. package/dist/utils/constants.js +0 -2
  236. package/dist/utils/nanoid.d.ts +0 -1
  237. package/dist/utils/nanoid.js +0 -6
  238. package/dist/utils/rpc.d.ts +0 -11
  239. package/dist/utils/rpc.js +0 -17
  240. package/dist/utils/stack.d.ts +0 -4
  241. package/dist/utils/stack.js +0 -23
  242. package/dist/workflow/index.d.ts +0 -3
  243. package/dist/workflow/index.js +0 -4
  244. package/dist/workflow/workflow.d.ts +0 -34
  245. package/dist/workflow/workflow.js +0 -146
  246. package/src/blob/bucket.ts +0 -92
  247. package/src/blob/index.ts +0 -34
  248. package/src/blob/integrations/client.ts +0 -127
  249. package/src/blob/integrations/hono.ts +0 -16
  250. package/src/blob/mime-types.ts +0 -68
  251. package/src/blob/parse.ts +0 -93
  252. package/src/blob/s3-listener.ts +0 -48
  253. package/src/blob/types.ts +0 -142
  254. package/src/blob/upload-error.ts +0 -67
  255. package/src/blob/uploader.ts +0 -426
  256. package/src/internal/db/index.ts +0 -78
  257. package/src/lambda/index.ts +0 -8
  258. package/src/lambda/integrations/express.ts +0 -25
  259. package/src/lambda/integrations/hono.ts +0 -25
  260. package/src/lambda/lambda.ts +0 -94
  261. package/src/postgres/index.ts +0 -5
  262. package/src/postgres/pg.ts +0 -33
  263. package/src/utils/component.ts +0 -3
  264. package/src/utils/constants.ts +0 -2
  265. package/src/utils/nanoid.ts +0 -9
  266. package/src/utils/rpc.ts +0 -28
  267. package/src/utils/stack.ts +0 -26
  268. package/src/workflow/index.ts +0 -9
  269. package/src/workflow/workflow.ts +0 -235
  270. /package/dist/{blob/mime-types.js → bucket/server-only.d.ts} +0 -0
  271. /package/dist/{utils/component.js → bucket/types.js} +0 -0
@@ -0,0 +1,428 @@
1
+ /** The project configuration `ocel deploy` reads, whether written as `ocel.json`, as `ocel.yaml` or as `ocel.config.ts`. */
2
+ export interface OcelConfig {
3
+ /** The JSON Schema this config is written against. ocel init writes the schema shipped with the CLI that created it. */
4
+ $schema?: string;
5
+ /** The needs this project waives rather than have a deploy refused over. */
6
+ allowDegraded?: ("edge-middleware" | "edge-runtime" | "ppr-resume" | "edge-cache" | "streaming")[];
7
+ /** The apps this project deploys. Left off, ocel detects one at the project root. */
8
+ apps?: AppConfig[];
9
+ /** Resources this project declares that ocel binds instead of provisioning them itself. Keyed by resource type, then by the name the app declares. The value is "@" followed by the name a record your own infrastructure published, such as "@warehouse", and a name nothing has published refuses the deploy; or the record written inline, checked at deploy rather than provisioned, optionally keyed by the tier it serves. */
10
+ bindings?: {
11
+ /** Each key is a bucket resource this project declares. Its value is "@" followed by the name a record is published under, such as "@warehouse"; or the record itself, whose secrets are ocel variables written { "$env": "NAME" }; or that record keyed by the tier it serves, leaving the other tier to provision its own. */
12
+ bucket?: Record<string, `@${string}` | BucketBinding | {
13
+ /** The record previews bind. Left off, previews provision their own. */
14
+ preview?: BucketBinding;
15
+ /** The record production binds. Left off, production provisions its own. */
16
+ production?: BucketBinding;
17
+ }>;
18
+ /** Each key is a kv resource this project declares; its value is "@" followed by the name the record is published under, such as "@shared-cache". */
19
+ kv?: Record<string, `@${string}`>;
20
+ /** Each key is a postgres resource this project declares. Its value is "@" followed by the name a record is published under, such as "@warehouse"; or the record itself, whose secrets are ocel variables written { "$env": "NAME" }; or that record keyed by the tier it serves, leaving the other tier to provision its own. */
21
+ postgres?: Record<string, `@${string}` | PostgresBinding | {
22
+ /** The record previews bind. Left off, previews provision their own. */
23
+ preview?: PostgresBinding;
24
+ /** The record production binds. Left off, production provisions its own. */
25
+ production?: PostgresBinding;
26
+ }>;
27
+ };
28
+ /** Where the resources an app declares are found. */
29
+ discovery?: DiscoveryConfig;
30
+ /** Where the project's hostname records are written, keyed by the DNS service's identifier with its options as the value, or named alone. */
31
+ dns?: DNSDescriptor;
32
+ /** The hostnames this project is served on. */
33
+ domains?: ProjectDomainConfig;
34
+ /** The edge in front of the origin, keyed by its identifier with its options as the value, or named alone. Omit it for the provider's default: CloudFront on AWS, and no edge on GCP or a VPS. */
35
+ edge?: EdgeDescriptor;
36
+ /** Where each tier's values are read from. A tier left off reads its default: ocel's own store in your account for production and preview, the project's .env file for dev. */
37
+ envSource?: EnvSourceConfig;
38
+ /** The provider ocel deploy provisions into, keyed by its identifier with its options as the value. A provider that needs no options may be named alone. */
39
+ provider?: ProviderDescriptor;
40
+ /** Where this project's container images are pushed. */
41
+ registry?: RegistryConfig;
42
+ /** The project's deployment identity. Every stack and resource ocel creates in your own account is keyed on it, so changing it forks a new project. */
43
+ slug: string;
44
+ /** Transform modules applied while provisioning, in order — later modules win where their patches collide. Each is a path to a module whose default export is a defineTransform(...) result, keyed by the provider it patches. */
45
+ transforms?: string | string[];
46
+ }
47
+ export interface AppConfig {
48
+ /** The processor architecture an app's functions or container image are built for. Left off, what the provider runs the app on. */
49
+ arch?: "x86_64" | "arm64";
50
+ /** How a container app's image is built. */
51
+ build?: BuildConfig;
52
+ /** What the app runs on: serverless functions packed per route, or one container image serving everything. */
53
+ compute?: "serverless" | "container";
54
+ /** The hostnames this app is served on. */
55
+ domains?: AppDomainConfig;
56
+ /** The file the app is served from, when it is not the one ocel would detect. */
57
+ entrypoint?: string;
58
+ /** The variables folder this app reads, when it does not read the project's own. */
59
+ folder?: string;
60
+ /** What a serverless app is built with, when ocel is not to read it off the app's own manifest. */
61
+ framework?: "node" | "next" | "go" | "python" | "rust";
62
+ /** How a container app is checked before it is served. */
63
+ health?: HealthConfig;
64
+ /** The most instances of a container app run at once, however busy it is. Left off, as many as minInstances, or 1. A serverless app scales itself and takes no instance counts. */
65
+ maxInstances?: number;
66
+ /** The fewest instances of a container app kept running, however quiet it is. Left off, 1. A serverless app scales itself and takes no instance counts. */
67
+ minInstances?: number;
68
+ /** The app's name. It is a label of every resource the app deploys and of its preview hostname, so it is a DNS label. */
69
+ name: string;
70
+ /** The app's directory, relative to the config. */
71
+ path: string;
72
+ }
73
+ /** How a container app's image is built. */
74
+ export interface BuildConfig {
75
+ /** The command that builds the app inside the image. Left off, the app's own build script runs. */
76
+ command?: string;
77
+ /** The directory the image is built from, relative to the project. Left off, it is the workspace root the app belongs to. */
78
+ context?: string;
79
+ /** The Dockerfile to build from. A relative path resolves against the app's directory. */
80
+ dockerfile?: string;
81
+ }
82
+ /** The hostnames this app is served on. */
83
+ export interface AppDomainConfig {
84
+ /** The hostnames production is served on. */
85
+ production?: string | string[];
86
+ }
87
+ /** How a container app is checked before it is served. */
88
+ export interface HealthConfig {
89
+ /** The path the check requests, off the app's own root. Any 2xx answer means up. Left off, a VPS finds the path by probing /up, /health, /healthz and / in turn and keeps the first that exists, and AWS and Google Cloud request /. */
90
+ path?: string;
91
+ }
92
+ /** An existing S3-compatible bucket a tier binds rather than provisioning its own. */
93
+ export interface BucketBinding {
94
+ /** The public half of the key pair the runtime reaches the store with. */
95
+ accessKeyId: VariableRef;
96
+ /** The bucket's name in that store. */
97
+ bucket: string | VariableRef;
98
+ /** The address of the S3-compatible store the bucket lives in, such as https://<account>.r2.cloudflarestorage.com. */
99
+ endpoint: string | VariableRef;
100
+ /** Address the bucket as a path on the endpoint rather than as a subdomain of it, for stores that serve no virtual hosts. */
101
+ pathStyle?: boolean;
102
+ /** The prefix every key the app writes is kept under, so one bucket can store several resources or environments. */
103
+ prefix?: string | VariableRef;
104
+ /** The address the bucket's objects are served from publicly, when the code declares it public. */
105
+ publicBaseUrl?: string | VariableRef;
106
+ /** The region requests to the store are signed for; auto for R2. */
107
+ region: string | VariableRef;
108
+ /** The secret half of that key pair. */
109
+ secretAccessKey: VariableRef;
110
+ }
111
+ /** An ocel variable holding this value, written { "$env": "NAME" }, so the value itself never sits in the config. */
112
+ export interface VariableRef {
113
+ /** The ocel variable containing this value, set per tier and environment with ocel env set. The app never reads it as a variable of its own. */
114
+ $env: string;
115
+ }
116
+ /** An existing Postgres database a tier binds rather than provisioning its own, reached by a connection string or by host and role. */
117
+ export type PostgresBinding = PostgresUrlBinding | PostgresHostBinding;
118
+ export interface PostgresUrlBinding {
119
+ /** The whole connection string, kept verbatim so its sslmode, options and pooler parameters reach the client. */
120
+ url: VariableRef;
121
+ }
122
+ export interface PostgresHostBinding {
123
+ /** The database the app connects to. */
124
+ database: string | VariableRef;
125
+ /** The server's hostname. */
126
+ host: string | VariableRef;
127
+ /** The role's password. */
128
+ password: VariableRef;
129
+ /** The server's port. Left off, 5432. */
130
+ port?: number;
131
+ /** How the connection is encrypted. Left off, each client library connects as it does by default. */
132
+ tls?: PostgresTLS;
133
+ /** The role the app connects as. */
134
+ username: string | VariableRef;
135
+ }
136
+ /** How the connection is encrypted. Left off, each client library connects as it does by default. */
137
+ export interface PostgresTLS {
138
+ /** The certificate authority the server's certificate chains to, as PEM, when it is not one the system trusts. */
139
+ ca?: VariableRef;
140
+ /** require encrypts the connection; verify-full also checks the server's certificate and hostname. */
141
+ mode: "require" | "verify-full";
142
+ }
143
+ /** Where the resources an app declares are found. */
144
+ export interface DiscoveryConfig {
145
+ /** The directories containing infrastructure declarations, relative to the config. Left off, ocel reads the default discovery directory. */
146
+ paths?: string[];
147
+ }
148
+ /** Where the project's hostname records are written, keyed by the DNS service's identifier with its options as the value, or named alone. */
149
+ export type DNSDescriptor = "cloudflare" | "route53" | {
150
+ cloudflare: DNSOptions;
151
+ route53?: never;
152
+ } | {
153
+ cloudflare?: never;
154
+ route53: DNSOptions;
155
+ };
156
+ export interface DNSOptions {
157
+ /** The zone the records are written into. Omit it and ocel picks the zone that covers the hostname. */
158
+ zone?: string;
159
+ }
160
+ /** The hostnames this project is served on. */
161
+ export interface ProjectDomainConfig {
162
+ /** The wildcard hostname previews are served under, such as *.preview.example.com. */
163
+ preview?: string;
164
+ /** The hostnames production is served on. */
165
+ production?: string | string[];
166
+ }
167
+ /** The edge in front of the origin, keyed by its identifier with its options as the value, or named alone. Omit it for the provider's default: CloudFront on AWS, and no edge on GCP or a VPS. */
168
+ export type EdgeDescriptor = "alb" | "api-gateway" | "cloudflare" | "cloudfront" | {
169
+ alb: AlbEdgeOptions;
170
+ "api-gateway"?: never;
171
+ cloudflare?: never;
172
+ cloudfront?: never;
173
+ } | {
174
+ alb?: never;
175
+ "api-gateway": ApiGatewayEdgeOptions;
176
+ cloudflare?: never;
177
+ cloudfront?: never;
178
+ } | {
179
+ alb?: never;
180
+ "api-gateway"?: never;
181
+ cloudflare: CloudflareEdgeOptions;
182
+ cloudfront?: never;
183
+ } | {
184
+ alb?: never;
185
+ "api-gateway"?: never;
186
+ cloudflare?: never;
187
+ cloudfront: CloudFrontEdgeOptions;
188
+ };
189
+ /** Options for the Application Load Balancer edge. Everything the load balancer needs comes from the provider's own options. */
190
+ export type AlbEdgeOptions = Record<string, never>;
191
+ /** Options for the API Gateway edge. Everything API Gateway needs comes from the provider's own options. */
192
+ export type ApiGatewayEdgeOptions = Record<string, never>;
193
+ /** Options for the Cloudflare edge. The token and account id are read from the environment. */
194
+ export interface CloudflareEdgeOptions {
195
+ /** Reach the origin through a tunnel the origin opens to the edge, rather than at its address, so the origin takes no traffic from anything else. Cloudflare in front of a VPS box opens one. */
196
+ tunnel?: boolean;
197
+ }
198
+ /** Options for the CloudFront edge. Everything CloudFront needs comes from the provider's own options. */
199
+ export type CloudFrontEdgeOptions = Record<string, never>;
200
+ /** Where each tier's values are read from. A tier left off reads its default: ocel's own store in your account for production and preview, the project's .env file for dev. */
201
+ export interface EnvSourceConfig {
202
+ /** Where ocel dev and ocel run read values from on your machine. Left off, the project's .env file ("dotenv"). .env.local overrides whatever this reads. */
203
+ dev?: DevEnvSourceDescriptor;
204
+ /** Where every preview's tier-wide values are read from. Left off, ocel's own store in your account ("builtin"). A value set for one named preview stays ocel's own. */
205
+ preview?: EnvSourceDescriptor;
206
+ /** Where production's values are read from. Left off, ocel's own store in your account ("builtin"). */
207
+ production?: EnvSourceDescriptor;
208
+ }
209
+ /** Where ocel dev and ocel run read values from on your machine: the project's .env file ("dotenv"), or an env source keyed by its identifier with its options as the value. */
210
+ export type DevEnvSourceDescriptor = "dotenv" | {
211
+ /** A command run on your machine, whose output is the values. */
212
+ exec: ExecOptions;
213
+ infisical?: never;
214
+ } | {
215
+ /** Infisical, read as you: from INFISICAL_TOKEN, or else the infisical CLI you are logged in to. */
216
+ infisical: InfisicalOptions;
217
+ exec?: never;
218
+ };
219
+ /** A command whose output is a tier's values: run on the machine that deploys for production and preview, and on yours for dev. */
220
+ export interface ExecOptions {
221
+ /** The command to run and its arguments. {folder} in an argument is replaced with the variables folder being read. */
222
+ command: string[];
223
+ /** What the command prints: a JSON object of names to values, or KEY=VALUE lines. */
224
+ format: "json" | "dotenv";
225
+ }
226
+ /** The Infisical project and environment a tier reads its values from. Production and preview read it as the machine identity auth names; dev reads it as you. */
227
+ export interface InfisicalOptions {
228
+ /** The machine identity production or preview reads as, keyed by its login method. Required there, and refused for dev, which reads as you. */
229
+ auth?: InfisicalAuth;
230
+ /** The slug of the Infisical environment this tier reads, such as prod. */
231
+ environment: string;
232
+ /** The base URL of a self-hosted Infisical. Left off, https://app.infisical.com. */
233
+ host?: string;
234
+ /** The Infisical folder the project's values sit under. A variables folder such as /web reads from that folder beneath it. Left off, the environment's root, /. */
235
+ path?: string;
236
+ /** The id of the Infisical project the values live in. */
237
+ project: string;
238
+ /** What ocel may write into Infisical. "missing" creates a key a declaration names and Infisical lacks, and never overwrites one. "values" also updates a value Infisical holds, from ocel env set or the variables page, unless it changed in Infisical since ocel last read it. Nothing ocel does ever deletes a key there. Left off, "never". Refused for dev, which only reads. */
239
+ write?: "never" | "missing" | "values";
240
+ }
241
+ /** How ocel logs in to Infisical, keyed by the login method. */
242
+ export type InfisicalAuth = {
243
+ /** Universal Auth: a client id and client secret, each an ocel variable. */
244
+ universal: UniversalAuth;
245
+ identity?: never;
246
+ } | {
247
+ /** This target's own cloud identity signs in, so no secret is stored. */
248
+ identity: IdentityAuth;
249
+ universal?: never;
250
+ };
251
+ /** Logs in to Infisical with a Universal Auth client id and client secret, each an ocel variable. */
252
+ export interface UniversalAuth {
253
+ /** The ocel variable containing the Universal Auth client id. */
254
+ clientId: VariableRef;
255
+ /** The ocel variable containing the Universal Auth client secret. */
256
+ clientSecret: VariableRef;
257
+ }
258
+ /** Logs in to Infisical as the target's own cloud identity, so no secret is stored. */
259
+ export interface IdentityAuth {
260
+ /** The id of the Infisical machine identity to sign in as. */
261
+ identityId: string;
262
+ }
263
+ /** Where production or preview reads its values from: ocel's own store in your account ("builtin"), or an env source keyed by its identifier with its options as the value. */
264
+ export type EnvSourceDescriptor = "builtin" | {
265
+ /** A command run on the machine that deploys, whose output is the tier's values. It runs at each deploy and on no schedule. */
266
+ exec: ExecOptions;
267
+ infisical?: never;
268
+ } | {
269
+ /** Infisical, read as the machine identity auth names and synced every minute. */
270
+ infisical: InfisicalOptions;
271
+ exec?: never;
272
+ };
273
+ /** The provider ocel deploy provisions into, keyed by its identifier with its options as the value. A provider that needs no options may be named alone. */
274
+ export type ProviderDescriptor = "aws" | {
275
+ aws: AwsProviderOptions;
276
+ gcp?: never;
277
+ vps?: never;
278
+ } | {
279
+ aws?: never;
280
+ gcp: GcpProviderOptions;
281
+ vps?: never;
282
+ } | {
283
+ aws?: never;
284
+ gcp?: never;
285
+ vps: VpsProviderOptions;
286
+ };
287
+ export interface AwsProviderOptions {
288
+ /** Certificates to serve a hostname with, keyed by hostname, valued by the ARN of an already-issued ACM certificate. A hostname left off gets a certificate ocel requests, validates and deletes again. */
289
+ certificates?: Record<string, string>;
290
+ /** The AWS region to deploy into. */
291
+ region?: string;
292
+ /** ARN of a KMS key to encrypt this account's variables under. Omit it and ocel bootstrap --features variables-key makes a key ocel owns. */
293
+ variablesKey?: string;
294
+ }
295
+ export interface GcpProviderOptions {
296
+ /** The Google Cloud project to deploy into. */
297
+ project: string;
298
+ /** The region to deploy into. A project spans them all, so this names the one. */
299
+ region: string;
300
+ }
301
+ export interface VpsProviderOptions {
302
+ /** Certificates to serve a hostname with, keyed by hostname, valued by the path to the certificate on the machine. */
303
+ certificates?: Record<string, string>;
304
+ /** Path to the public key the ocel-deploy login accepts; defaults to the bootstrapping login's keys. */
305
+ deployKey?: string;
306
+ /** Deploy previews even though the proxy orders a publicly trusted certificate for each preview hostname, which Certificate Transparency logs publish within minutes. Left out, such a preview deploy is refused: set proxy.traefik.previewResolver, pin a wildcard certificate for the preview base, or front the box with an edge that shields it with an origin certificate instead. */
307
+ perHostnamePreviewCertificates?: boolean;
308
+ /** What fronts this machine on ports 80 and 443. Leave it out and ocel runs its own proxy; name the one the machine already runs to deploy behind it. */
309
+ proxy?: VpsProxy;
310
+ /** The machine to deploy onto: a Host alias from ssh_config, or the destination spelled out. */
311
+ ssh: string | VpsTarget;
312
+ }
313
+ /** What fronts this machine on ports 80 and 443. Leave it out and ocel runs its own proxy; name the one the machine already runs to deploy behind it. */
314
+ export type VpsProxy = "manual" | {
315
+ /** A Traefik the machine already runs, reading ocel's routes from a directory its file provider watches. */
316
+ traefik: VpsTraefik;
317
+ caddy?: never;
318
+ manual?: never;
319
+ } | {
320
+ /** A Caddy the machine already runs, importing ocel's site blocks from a directory. */
321
+ caddy: VpsCaddy;
322
+ traefik?: never;
323
+ manual?: never;
324
+ } | {
325
+ /** A proxy you route to ocel yourself; ocel writes nothing to it. */
326
+ manual: VpsManual;
327
+ traefik?: never;
328
+ caddy?: never;
329
+ };
330
+ /** A Traefik the machine already runs, reading ocel's routes from a directory its file provider watches. */
331
+ export type VpsTraefik = {
332
+ /** Where directory is mounted in the container your Traefik runs in, as its providers.file.directory names it; ocel.yml names the origin certificates it places in directory by this path. Left out, directory itself. */
333
+ containerDirectory?: string;
334
+ /** The directory Traefik's file provider watches, where ocel writes its routers. */
335
+ directory?: string;
336
+ /** The entry points ocel's routers attach to. */
337
+ entrypoints?: VpsEntrypoints;
338
+ /** A docker network ocel's switchboard joins, so Traefik reaches it by name. Not with port. */
339
+ network?: string;
340
+ /** The loopback port ocel's switchboard is published on for Traefik to reach, in place of the network a preset fills; 8480 when left out. Not with network. */
341
+ port?: number;
342
+ /** The host tool whose Traefik this is. It fills in every other field, and a field written beside it overrides. */
343
+ preset: "coolify" | "dokploy";
344
+ /** A resolver that can issue the preview base's wildcard over DNS-01. Set, previews share one wildcard certificate; left out, each preview hostname gets its own from resolver. */
345
+ previewResolver?: string;
346
+ /** The certificate resolver every hostname router ocel writes names. */
347
+ resolver?: string;
348
+ } | {
349
+ /** Where directory is mounted in the container your Traefik runs in, as its providers.file.directory names it; ocel.yml names the origin certificates it places in directory by this path. Left out, directory itself. */
350
+ containerDirectory?: string;
351
+ /** The directory Traefik's file provider watches, where ocel writes its routers. */
352
+ directory: string;
353
+ /** The entry points ocel's routers attach to. */
354
+ entrypoints?: VpsEntrypoints;
355
+ /** A docker network ocel's switchboard joins, so Traefik reaches it by name. Not with port. */
356
+ network?: string;
357
+ /** The loopback port ocel's switchboard is published on for Traefik to reach, in place of the network a preset fills; 8480 when left out. Not with network. */
358
+ port?: number;
359
+ preset?: never;
360
+ /** A resolver that can issue the preview base's wildcard over DNS-01. Set, previews share one wildcard certificate; left out, each preview hostname gets its own from resolver. */
361
+ previewResolver?: string;
362
+ /** The certificate resolver every hostname router ocel writes names. */
363
+ resolver: string;
364
+ };
365
+ /** The entry points ocel's routers attach to. */
366
+ export interface VpsEntrypoints {
367
+ /** The entry point ocel's http-to-https redirect routers attach to; web when left out. */
368
+ http?: string;
369
+ /** The entry point ocel's hostname routers attach to; websecure when left out. */
370
+ https?: string;
371
+ }
372
+ /** A Caddy the machine already runs, importing ocel's site blocks from a directory. */
373
+ export type VpsCaddy = {
374
+ /** The config file caddy reload names inside the container; /etc/caddy/Caddyfile when left out. */
375
+ config?: string;
376
+ /** The container Caddy runs in; left out, Caddy runs as the systemd caddy.service. */
377
+ container?: string;
378
+ /** Where directory is mounted in the container Caddy runs in; ocel.caddy names the origin certificates it places in directory by this path. Left out, directory itself. */
379
+ containerDirectory?: string;
380
+ /** The directory the running Caddy imports site blocks from. */
381
+ directory?: string;
382
+ /** A docker network ocel's switchboard joins, so Caddy reaches it by name. Not with port. */
383
+ network?: string;
384
+ /** The loopback port ocel's switchboard is published on for Caddy to reach, in place of the network a preset fills; 8480 when left out. Not with network. */
385
+ port?: number;
386
+ /** The host tool whose Caddy this is. It fills in every other field, and a field written beside it overrides. */
387
+ preset: "coolify";
388
+ } | {
389
+ /** The config file caddy reload names inside the container; /etc/caddy/Caddyfile when left out. */
390
+ config?: string;
391
+ /** The container Caddy runs in; left out, Caddy runs as the systemd caddy.service. */
392
+ container?: string;
393
+ /** Where directory is mounted in the container Caddy runs in; ocel.caddy names the origin certificates it places in directory by this path. Left out, directory itself. */
394
+ containerDirectory?: string;
395
+ /** The directory the running Caddy imports site blocks from. */
396
+ directory: string;
397
+ /** A docker network ocel's switchboard joins, so Caddy reaches it by name. Not with port. */
398
+ network?: string;
399
+ /** The loopback port ocel's switchboard is published on for Caddy to reach, in place of the network a preset fills; 8480 when left out. Not with network. */
400
+ port?: number;
401
+ preset?: never;
402
+ };
403
+ /** A proxy you route to ocel yourself; ocel writes nothing to it. */
404
+ export interface VpsManual {
405
+ /** A docker network ocel's switchboard also joins, so a proxy on it reaches the switchboard by name even after it is recreated. */
406
+ network?: string;
407
+ /** The loopback port your proxy forwards to ocel's switchboard on; 8480 when left out. */
408
+ port?: number;
409
+ }
410
+ export interface VpsTarget {
411
+ /** The hostname or address to reach the machine at. */
412
+ host: string;
413
+ /** The private key to authenticate with, as a path. */
414
+ identityFile?: string;
415
+ /** The port sshd listens on. Omit it and ssh's own default applies. */
416
+ port?: number;
417
+ /** The account to log in as. Omit it and ssh resolves the user itself. */
418
+ user?: string;
419
+ }
420
+ /** Where this project's container images are pushed. */
421
+ export interface RegistryConfig {
422
+ /** The environment variable containing the password or token, written as "${REGISTRY_TOKEN}" and read where the push authenticates — never the secret itself. */
423
+ password: `\${${string}`;
424
+ /** The registry host and the namespace images sit under, such as ghcr.io/acme. No scheme, and no credentials. */
425
+ server: string;
426
+ /** The username the push authenticates as, where the registry wants one. */
427
+ username?: string;
428
+ }
@@ -0,0 +1,2 @@
1
+ // generated by scripts/schema/build.mjs from the committed JSON Schema; do not edit
2
+ export {};
@@ -0,0 +1,193 @@
1
+ import type { StandardSchemaV1 } from "@standard-schema/spec";
2
+ import type { ChainableCommander, Redis } from "ioredis";
3
+ import { KvShape } from "../gen/proto/app/resources/v1/resources_pb.js";
4
+ import { type KeyArgs, type KeyOf, type Pattern } from "./pattern.js";
5
+ import { type KVDuration, type TTL, type WriteOptions } from "./ttl.js";
6
+ export type Shape = "text" | "counter" | "json" | "list" | "set";
7
+ export declare const shapes: Record<Shape, KvShape>;
8
+ /** How an entry is declared. */
9
+ export interface EntryOptions {
10
+ /** How long a key lives after each write; without it, until it is deleted or evicted. */
11
+ ttl?: KVDuration;
12
+ }
13
+ /** How a `json` entry is declared. */
14
+ export interface JsonEntryOptions<TSchema extends StandardSchemaV1> extends EntryOptions {
15
+ /** The Standard Schema every value is checked against, on write and on read. */
16
+ schema: TSchema;
17
+ /**
18
+ * What a read does with a stored value that fails the schema: `"throw"` (the default)
19
+ * throws an {@link InvalidKVValueError}, and `"miss"` reads it as absent.
20
+ */
21
+ onInvalid?: "throw" | "miss";
22
+ }
23
+ /** An entry as declared, before it is a member of a store. */
24
+ export interface EntryDeclaration<TShape extends Shape = Shape, TPattern extends string = string, TInput = unknown, TOutput = unknown> {
25
+ /** The encoding the entry's keys hold. */
26
+ readonly shape: TShape;
27
+ /** The pattern its keys are built from. */
28
+ readonly pattern: TPattern;
29
+ /** Type-only: the value a write takes and the value a read answers. */
30
+ readonly types?: {
31
+ input: TInput;
32
+ output: TOutput;
33
+ };
34
+ }
35
+ export declare function declareEntry<TShape extends Shape, TPattern extends string, TInput, TOutput>(shape: TShape, pattern: TPattern, options: EntryOptions & {
36
+ schema?: StandardSchemaV1;
37
+ onInvalid?: "throw" | "miss";
38
+ }): EntryDeclaration<TShape, TPattern, TInput, TOutput>;
39
+ export interface DeclaredEntry {
40
+ shape: Shape;
41
+ pattern: string;
42
+ parsed: Pattern;
43
+ ttl: number | undefined;
44
+ schema: StandardSchemaV1 | undefined;
45
+ missOnInvalid: boolean;
46
+ source: string;
47
+ }
48
+ export declare function readDeclaredEntry(declaration: EntryDeclaration): DeclaredEntry;
49
+ /** A `text` entry: a string under each key. */
50
+ export interface TextEntry<TPattern extends string> {
51
+ /** The string under the key, or `undefined` when there is none. */
52
+ get(...key: KeyArgs<TPattern>): Promise<string | undefined>;
53
+ /** The string under each key, in order, read in one round trip. */
54
+ getMany(keys: readonly KeyOf<TPattern>[]): Promise<(string | undefined)[]>;
55
+ /** Writes the string under the key. */
56
+ set(...args: [...KeyArgs<TPattern>, value: string, options?: WriteOptions]): Promise<void>;
57
+ /** Deletes the key, answering whether it existed. */
58
+ delete(...key: KeyArgs<TPattern>): Promise<boolean>;
59
+ }
60
+ /**
61
+ * A `counter` entry: an integer under each key, changed atomically. A count is a safe
62
+ * integer: reading or answering one past ±(2^53 - 1) throws a `RangeError`.
63
+ */
64
+ export interface CounterEntry<TPattern extends string> {
65
+ /** The integer under the key, or `undefined` when there is none. */
66
+ get(...key: KeyArgs<TPattern>): Promise<number | undefined>;
67
+ /** The integer under each key, in order, read in one round trip. */
68
+ getMany(keys: readonly KeyOf<TPattern>[]): Promise<(number | undefined)[]>;
69
+ /** Writes the integer under the key. */
70
+ set(...args: [...KeyArgs<TPattern>, value: number, options?: WriteOptions]): Promise<void>;
71
+ /** Adds `by` (1 by default) to the integer under the key, from 0 when there is none, and answers the sum. */
72
+ increment(...args: [...KeyArgs<TPattern>, by?: number, options?: WriteOptions]): Promise<number>;
73
+ /** Subtracts `by` (1 by default) from the integer under the key, from 0 when there is none, and answers the difference. */
74
+ decrement(...args: [...KeyArgs<TPattern>, by?: number, options?: WriteOptions]): Promise<number>;
75
+ /** Deletes the key, answering whether it existed. */
76
+ delete(...key: KeyArgs<TPattern>): Promise<boolean>;
77
+ }
78
+ /** A `json` entry: a value checked against the entry's schema under each key. */
79
+ export interface JsonEntry<TPattern extends string, TInput, TOutput> {
80
+ /** The value under the key, or `undefined` when there is none. */
81
+ get(...key: KeyArgs<TPattern>): Promise<TOutput | undefined>;
82
+ /** The value under each key, in order, read in one round trip. */
83
+ getMany(keys: readonly KeyOf<TPattern>[]): Promise<(TOutput | undefined)[]>;
84
+ /** Checks the value against the schema and writes the value the schema answers under the key. */
85
+ set(...args: [...KeyArgs<TPattern>, value: TInput, options?: WriteOptions]): Promise<void>;
86
+ /** Deletes the key, answering whether it existed. */
87
+ delete(...key: KeyArgs<TPattern>): Promise<boolean>;
88
+ }
89
+ /** A `list` entry: a list of strings under each key. */
90
+ export interface ListEntry<TPattern extends string> {
91
+ /** Appends the values to the end of the list, answering its new length. */
92
+ push(...args: [...KeyArgs<TPattern>, values: string | readonly string[], options?: WriteOptions]): Promise<number>;
93
+ /** Prepends the values to the start of the list, answering its new length. */
94
+ unshift(...args: [...KeyArgs<TPattern>, values: string | readonly string[], options?: WriteOptions]): Promise<number>;
95
+ /** Removes and answers the last value, or `undefined` when the list is empty. */
96
+ pop(...key: KeyArgs<TPattern>): Promise<string | undefined>;
97
+ /** Removes and answers the first value, or `undefined` when the list is empty. */
98
+ shift(...key: KeyArgs<TPattern>): Promise<string | undefined>;
99
+ /** The value at `index`, counting back from the end when negative, or `undefined` past either end. */
100
+ at(...args: [...KeyArgs<TPattern>, index: number]): Promise<string | undefined>;
101
+ /** The values from `start` up to but not including `end`, as `Array.prototype.slice` reads them. */
102
+ slice(...args: [...KeyArgs<TPattern>, start?: number, end?: number]): Promise<string[]>;
103
+ /** How many values the list holds. */
104
+ length(...key: KeyArgs<TPattern>): Promise<number>;
105
+ /** Deletes the list, answering whether it existed. */
106
+ delete(...key: KeyArgs<TPattern>): Promise<boolean>;
107
+ }
108
+ /** A `set` entry: a set of strings under each key. */
109
+ export interface SetEntry<TPattern extends string> {
110
+ /** Adds the members, answering how many were not already in the set. */
111
+ add(...args: [...KeyArgs<TPattern>, members: string | readonly string[], options?: WriteOptions]): Promise<number>;
112
+ /** Removes the member, answering whether it was in the set. */
113
+ delete(...args: [...KeyArgs<TPattern>, member: string]): Promise<boolean>;
114
+ /** Whether the member is in the set. */
115
+ has(...args: [...KeyArgs<TPattern>, member: string]): Promise<boolean>;
116
+ /** How many members the set holds. */
117
+ size(...key: KeyArgs<TPattern>): Promise<number>;
118
+ /** Every member of the set. */
119
+ values(...key: KeyArgs<TPattern>): Promise<Set<string>>;
120
+ /** Deletes the set, answering whether it existed. */
121
+ clear(...key: KeyArgs<TPattern>): Promise<boolean>;
122
+ }
123
+ /** The member a store holds for an entry declaration. */
124
+ export type EntryOf<TDeclaration> = TDeclaration extends EntryDeclaration<infer TShape, infer TPattern, infer TInput, infer TOutput> ? {
125
+ text: TextEntry<TPattern>;
126
+ counter: CounterEntry<TPattern>;
127
+ json: JsonEntry<TPattern, TInput, TOutput>;
128
+ list: ListEntry<TPattern>;
129
+ set: SetEntry<TPattern>;
130
+ }[TShape] : never;
131
+ type OpenClient = (operation: string) => Redis;
132
+ type Args = unknown[];
133
+ declare class Entry {
134
+ protected readonly name: string;
135
+ protected readonly declaration: DeclaredEntry;
136
+ private readonly openClient;
137
+ private readonly keyed;
138
+ constructor(name: string, declaration: DeclaredEntry, openClient: OpenClient);
139
+ protected open(operation: string): Redis;
140
+ protected split(args: Args): [string, Args];
141
+ protected keyOf(key: unknown): string;
142
+ protected ttl(options: unknown): TTL;
143
+ protected setString(client: Redis, key: string, value: string, ttl: TTL): Promise<void>;
144
+ protected write<T>(client: Redis, key: string, ttl: TTL, command: (transaction: ChainableCommander) => ChainableCommander): Promise<T>;
145
+ protected readMany(operation: string, keys: readonly unknown[]): Promise<(string | null)[]>;
146
+ protected deleteKey(operation: string, args: Args): Promise<boolean>;
147
+ }
148
+ export declare class TextHandle extends Entry {
149
+ get(...args: Args): Promise<string | undefined>;
150
+ getMany(keys: readonly unknown[]): Promise<(string | undefined)[]>;
151
+ set(...args: Args): Promise<void>;
152
+ delete(...args: Args): Promise<boolean>;
153
+ }
154
+ export declare class CounterHandle extends Entry {
155
+ private decode;
156
+ get(...args: Args): Promise<number | undefined>;
157
+ getMany(keys: readonly unknown[]): Promise<(number | undefined)[]>;
158
+ set(...args: Args): Promise<void>;
159
+ increment(...args: Args): Promise<number>;
160
+ decrement(...args: Args): Promise<number>;
161
+ private add;
162
+ delete(...args: Args): Promise<boolean>;
163
+ }
164
+ export declare class JsonHandle extends Entry {
165
+ private get schema();
166
+ private decode;
167
+ private refuseRead;
168
+ get(...args: Args): Promise<unknown>;
169
+ getMany(keys: readonly unknown[]): Promise<unknown[]>;
170
+ set(...args: Args): Promise<void>;
171
+ delete(...args: Args): Promise<boolean>;
172
+ }
173
+ export declare class ListHandle extends Entry {
174
+ push(...args: Args): Promise<number>;
175
+ unshift(...args: Args): Promise<number>;
176
+ private insert;
177
+ pop(...args: Args): Promise<string | undefined>;
178
+ shift(...args: Args): Promise<string | undefined>;
179
+ at(...args: Args): Promise<string | undefined>;
180
+ slice(...args: Args): Promise<string[]>;
181
+ length(...args: Args): Promise<number>;
182
+ delete(...args: Args): Promise<boolean>;
183
+ }
184
+ export declare class SetHandle extends Entry {
185
+ add(...args: Args): Promise<number>;
186
+ delete(...args: Args): Promise<boolean>;
187
+ has(...args: Args): Promise<boolean>;
188
+ size(...args: Args): Promise<number>;
189
+ values(...args: Args): Promise<Set<string>>;
190
+ clear(...args: Args): Promise<boolean>;
191
+ }
192
+ export declare const handles: Record<Shape, new (name: string, declaration: DeclaredEntry, openClient: OpenClient) => Entry>;
193
+ export {};