@antelopejs/interface-database-catalog 0.0.3 → 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/README.md CHANGED
@@ -1,12 +1,18 @@
1
- # @antelopejs/interface-database-catalog
1
+ <a href="https://github.com/AntelopeJS/antelopejs"><img data-illustration src="./.github/readme/strip.svg" width="100%" alt="INTERFACE · DATABASE CATALOG: part of AntelopeJS, hexagonal architecture beyond your own code. A glowing button reads Star AntelopeJS."></a>
2
2
 
3
3
  <div align="center">
4
- <a href="./LICENSE"><img alt="License" src="https://img.shields.io/badge/License-Apache_2.0-000000?style=for-the-badge&labelColor=000000"></a>
5
- <a href="https://discord.gg/sjK28QHrA7"><img alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a>
6
- <a href="https://github.com/AntelopeJS/interface-database-catalog/tree/main/docs"><img alt="Docs" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a>
4
+
5
+ # `@antelopejs/interface-database-catalog`
6
+
7
+ <a href="https://www.npmjs.com/package/@antelopejs/interface-database-catalog"><img data-illustration alt="npm" src="https://img.shields.io/npm/v/@antelopejs/interface-database-catalog?style=for-the-badge&labelColor=000000&color=000000"></a> <a href="./LICENSE"><img data-illustration alt="License" src="https://img.shields.io/badge/License-Apache_2.0-000000?style=for-the-badge&labelColor=000000"></a> <a href="https://discord.gg/g4pFt6eXqu"><img data-illustration alt="Discord" src="https://img.shields.io/badge/Discord-18181B?logo=discord&style=for-the-badge&color=000000"></a> <a href="https://github.com/AntelopeJS/interface-database-catalog/tree/main/docs"><img data-illustration alt="Docs" src="https://img.shields.io/badge/Docs-18181B?style=for-the-badge&color=000000"></a> <a href="https://github.com/AntelopeJS/antelopejs"><img data-illustration alt="Star AntelopeJS" src="https://img.shields.io/github/stars/AntelopeJS/antelopejs?label=Star%20AntelopeJS&style=for-the-badge&labelColor=000000&color=000000&logo=github"></a>
8
+
9
+ **Describes and profiles a database that an AntelopeJS database provider is connected to but does not own, so a generator can propose matching tables.**
10
+
11
+ [Documentation](./docs/index.md) · [Implementations](#implementations) · [All interfaces and providers](https://github.com/AntelopeJS/antelopejs#ecosystem)
12
+
7
13
  </div>
8
14
 
9
- Describes and profiles a database that an [`@antelopejs/interface-database`](https://github.com/AntelopeJS/interface-database) provider is connected to but does not own, so a generator can propose a module whose tables mirror it. It is a development tool: every function refuses outside development.
15
+ Describes and profiles a database that an [`@antelopejs/interface-database`](https://github.com/AntelopeJS/interface-database) provider is connected to but does not own, so a generator can propose a module whose tables mirror it. It is a development tool: every catalog function refuses outside development.
10
16
 
11
17
  ## What it offers
12
18
 
@@ -15,17 +21,18 @@ Describes and profiles a database that an [`@antelopejs/interface-database`](htt
15
21
  - `DescribeRelations` details columns with their native types and the `@Field` declarations they accept, indexes and foreign keys.
16
22
  - `Profile` aggregates a relation per column and per foreign key, never returning rows.
17
23
  - `CheckReference` measures how much of one column's values another column holds, for references the database does not declare.
18
- - `SampleRows` answers a few rows of a relation, each value as text, for a person to look at; it is the one function that returns rows, and is never meant for a generator or a model.
24
+ - `SampleRows` answers a few rows of a relation, each value as text, for a person to look at. It is the one function that returns rows, and it is never meant for a generator or a model.
25
+ - `Probe` types the `probe` every driver exports from `dist/probe.js`: it signs in with a connection string and answers whether the account may read and write.
19
26
 
20
- The answers follow the provider's own registration rules: a relation the catalog calls mappable registers, and the key it names is the one `_id` aliases.
27
+ The answers follow the provider's own registration rules. A relation the catalog calls mappable registers, and the key it names is the one `_id` aliases.
21
28
 
22
29
  ## Implementations
23
30
 
24
- No public module implements this interface yet. A provider of `@antelopejs/interface-database` that connects to a database it does not own can implement it as well.
31
+ `@antelopejs/postgres`, `@antelopejs/mongodb` and `@antelopejs/rethinkdb` implement this interface next to `@antelopejs/interface-database`. Each lists it under `antelopeJs.implements` in its `package.json`. Another provider of `@antelopejs/interface-database` that connects to a database it does not own can implement it as well.
25
32
 
26
33
  ## Install
27
34
 
28
- The package is not published to npm yet. Once it is, add it to the module that reads the catalog:
35
+ Add the package to the module that reads the catalog:
29
36
 
30
37
  ```bash
31
38
  pnpm add @antelopejs/interface-database-catalog
@@ -52,13 +59,15 @@ Relations are named `"schema.name"`, the form `DescribeRelations` and `Profile`
52
59
 
53
60
  ## Compatibility
54
61
 
55
- Requires AntelopeJS core `>=1.14.0` and the following peer dependency:
62
+ The interface has one AntelopeJS peer dependency:
63
+
64
+ <!-- antelopejs-docs-compat:start -->
56
65
 
57
- <!-- docs-compat: ./package.json#peerDependencies -->
66
+ | Package | Supported | Tested with |
67
+ | ---------------------------- | ---------------- | ----------- |
68
+ | `@antelopejs/interface-core` | `>=0.5.0 <0.6.0` | `0.5.1` |
58
69
 
59
- | Package | Range |
60
- | ---------------------------- | ---------------- |
61
- | `@antelopejs/interface-core` | `>=0.2.4 <1.0.0` |
70
+ <!-- antelopejs-docs-compat:end -->
62
71
 
63
72
  ## Contributing
64
73
 
@@ -66,10 +75,27 @@ Read [CONTRIBUTING.md](./CONTRIBUTING.md) before you open a pull request. The lo
66
75
 
67
76
  ```bash
68
77
  pnpm install
69
- pnpm lint
70
- pnpm typecheck
78
+ pnpm run checks
71
79
  ```
72
80
 
81
+ ## Part of AntelopeJS
82
+
83
+ [AntelopeJS](https://github.com/AntelopeJS/antelopejs) is a TypeScript framework where modules depend on contracts and the application chooses the provider behind each one. [AntelopeJS DMS](https://github.com/AntelopeJS/dms), the open-source back office, is built on it.
84
+
85
+ <!-- antelopejs-framework-modules:start -->
86
+
87
+ | Area | Contracts | Providers |
88
+ | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
89
+ | API | [`interface-api`](https://github.com/AntelopeJS/interface-api) · [`interface-api-util`](https://github.com/AntelopeJS/interface-api-util) · [`interface-data-api`](https://github.com/AntelopeJS/interface-data-api) | [`api`](https://github.com/AntelopeJS/api) |
90
+ | Auth | [`interface-auth`](https://github.com/AntelopeJS/interface-auth) | [`auth-jwt`](https://github.com/AntelopeJS/auth-jwt) |
91
+ | Database | [`interface-database`](https://github.com/AntelopeJS/interface-database) · [`interface-database-decorators`](https://github.com/AntelopeJS/interface-database-decorators) · **`interface-database-catalog`** · [`interface-mongodb`](https://github.com/AntelopeJS/interface-mongodb) · [`interface-rethinkdb`](https://github.com/AntelopeJS/interface-rethinkdb) | [`postgres`](https://github.com/AntelopeJS/postgres) · [`mysql`](https://github.com/AntelopeJS/mysql) · [`mongodb`](https://github.com/AntelopeJS/mongodb) · [`rethinkdb`](https://github.com/AntelopeJS/rethinkdb) |
92
+ | Redis | [`interface-redis`](https://github.com/AntelopeJS/interface-redis) · [`interface-redis-scheduler`](https://github.com/AntelopeJS/interface-redis-scheduler) | [`redis`](https://github.com/AntelopeJS/redis) |
93
+ | Email | [`interface-email`](https://github.com/AntelopeJS/interface-email) | [`nodemailer`](https://github.com/AntelopeJS/nodemailer) · [`brevo`](https://github.com/AntelopeJS/brevo) |
94
+ | File storage | [`interface-file-storage`](https://github.com/AntelopeJS/interface-file-storage) | [`file-storage-local`](https://github.com/AntelopeJS/file-storage-local) · [`file-storage-s3`](https://github.com/AntelopeJS/file-storage-s3) |
95
+ | Payments | [`interface-payment`](https://github.com/AntelopeJS/interface-payment) · [`interface-subscriptions`](https://github.com/AntelopeJS/interface-subscriptions) · [`interface-stripe`](https://github.com/AntelopeJS/interface-stripe) | [`stripe`](https://github.com/AntelopeJS/stripe) · [`mollie`](https://github.com/AntelopeJS/mollie) · [`checkout-com`](https://github.com/AntelopeJS/checkout-com) · [`payment-subscriptions`](https://github.com/AntelopeJS/payment-subscriptions) |
96
+
97
+ <!-- antelopejs-framework-modules:end -->
98
+
73
99
  ## License
74
100
 
75
101
  [Apache-2.0](./LICENSE)
package/dist/index.d.ts CHANGED
@@ -276,6 +276,62 @@ export interface RowSample {
276
276
  /** How the relation was sampled before its first rows were read, when it was. */
277
277
  sample: SampleInfo | null;
278
278
  }
279
+ /**
280
+ * Why the server turned the probe away: wrong user or password, a client host the server does
281
+ * not accept, a database that does not exist, a database the account may not connect to, a
282
+ * server that wants credentials the URL does not give, or any other refusal.
283
+ */
284
+ export type ProbeRefusal = "credentials" | "host" | "database" | "database-denied" | "sign-in-required" | "other";
285
+ /**
286
+ * Why a signed-in account cannot read, when the cause is not its privileges: the URL names no
287
+ * database, the server has no database with that name, or the account may not list the database's
288
+ * relations.
289
+ */
290
+ export type ProbeUnreadable = "no-database-named" | "no-database" | "cannot-list";
291
+ /** What a driver's probe connects to, and how long it may take. */
292
+ export type ProbeConfig = {
293
+ /** The connection string the driver's `config.url` takes; the database is its path. */
294
+ url: string;
295
+ /** Bounds the connect and each answer, in milliseconds. */
296
+ timeoutMs: number;
297
+ /** When it aborts, the probe closes everything it opened at once. */
298
+ signal: AbortSignal;
299
+ };
300
+ /** What a probe found, told apart by `outcome`. */
301
+ export type ProbeAnswer = {
302
+ /** No server answered at the URL. */
303
+ outcome: "unreachable";
304
+ /** The driver's own text, which may hold the URL or the password; redact it before showing it. */
305
+ message: string;
306
+ } | {
307
+ /** A server answered and refused the sign-in. */
308
+ outcome: "refused";
309
+ refusal: ProbeRefusal;
310
+ /** The driver's own text, which may hold the URL or the password; redact it before showing it. */
311
+ message: string;
312
+ } | {
313
+ /** The account signed in. */
314
+ outcome: "signed-in";
315
+ /** How long the account's first query took, in milliseconds, rounded up. */
316
+ latencyMs: number;
317
+ /** The account the server signed in, when it names one. */
318
+ user?: string;
319
+ /**
320
+ * The account may read any relation it sees, or it sees none. False whenever `unreadable` is
321
+ * set.
322
+ */
323
+ canRead: boolean;
324
+ /** The account may insert, update or delete in any relation it sees. */
325
+ canWrite: boolean;
326
+ /** Why the account cannot read when the cause is not its privileges; set only with `canRead` false. */
327
+ unreadable?: ProbeUnreadable;
328
+ };
329
+ /**
330
+ * Signs in to a database and reports what the account may do there. Every driver exports one as
331
+ * `probe` from `dist/probe.js`, required as `@antelopejs/<driver>/dist/probe`. It never rejects
332
+ * and changes no row.
333
+ */
334
+ export type Probe = (config: ProbeConfig) => Promise<ProbeAnswer>;
279
335
  /**
280
336
  * The connected database: engine, version, database and role.
281
337
  *
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,+DAA+D;AAwS/D,sCAAsC;AACzB,QAAA,iBAAiB,GAAG,EAAE,CAAC;AAEpC,oEAAoE;AACvD,QAAA,kBAAkB,GAAG,GAAG,CAAC;AAgCtC;;;;;GAKG;AACU,QAAA,IAAI,GAAG,IAAA,kCAAiB,GAA8B,CAAC;AAEpE;;;GAGG;AACU,QAAA,aAAa,GACxB,IAAA,kCAAiB,GAAsD,CAAC;AAE1E,qDAAqD;AACxC,QAAA,iBAAiB,GAC5B,IAAA,kCAAiB,GAA2D,CAAC;AAE/E;;;GAGG;AACU,QAAA,OAAO,GAClB,IAAA,kCAAiB,GAAyD,CAAC;AAE7E;;;GAGG;AACU,QAAA,cAAc,GACzB,IAAA,kCAAiB,GAEd,CAAC;AAEN;;;GAGG;AACU,QAAA,UAAU,GACrB,IAAA,kCAAiB,GAAkD,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,+DAA+D;AAwS/D,sCAAsC;AACzB,QAAA,iBAAiB,GAAG,EAAE,CAAC;AAEpC,oEAAoE;AACvD,QAAA,kBAAkB,GAAG,GAAG,CAAC;AAyGtC;;;;;GAKG;AACU,QAAA,IAAI,GAAG,IAAA,kCAAiB,GAA8B,CAAC;AAEpE;;;GAGG;AACU,QAAA,aAAa,GACxB,IAAA,kCAAiB,GAAsD,CAAC;AAE1E,qDAAqD;AACxC,QAAA,iBAAiB,GAC5B,IAAA,kCAAiB,GAA2D,CAAC;AAE/E;;;GAGG;AACU,QAAA,OAAO,GAClB,IAAA,kCAAiB,GAAyD,CAAC;AAE7E;;;GAGG;AACU,QAAA,cAAc,GACzB,IAAA,kCAAiB,GAEd,CAAC;AAEN;;;GAGG;AACU,QAAA,UAAU,GACrB,IAAA,kCAAiB,GAAkD,CAAC"}
package/docs/index.md CHANGED
@@ -1,10 +1,14 @@
1
- # Inspect an existing database
1
+ ---
2
+ title: Inspect an existing database
3
+ description: Discover, describe and profile the relations of a database that an interface-database provider is connected to but does not own.
4
+ mode: how-to
5
+ ---
2
6
 
3
- Use `@antelopejs/interface-database-catalog` to discover relations, inspect their structure, and profile aggregate characteristics before mapping an existing database into an application. The catalog describes a provider's connection; it does not open a new connection or register tables, and it returns no raw records except through `SampleRows`, a few rows for a person to look at.
7
+ Use `@antelopejs/interface-database-catalog` to discover relations, inspect their structure, and profile aggregate characteristics before mapping an existing database into an application. The catalog describes a provider's connection. It does not open a new connection or register tables; only a driver's `probe`, described below, signs in on its own. It returns no raw records, except through `SampleRows`, which answers a few rows for a person to look at.
4
8
 
5
9
  ## Before you begin
6
10
 
7
- Run inside an AntelopeJS module in development, connected to a provider that implements this catalog and does not own its tables. Every catalog function refuses outside development or on an instance that owns its tables. These are safety boundaries, not configuration errors to work around in production.
11
+ Run inside an AntelopeJS module in development, connected to a provider that implements this catalog and does not own its tables. Every catalog function refuses outside development or on an instance that owns its tables. These refusals are safety boundaries. Do not work around them in production.
8
12
 
9
13
  ## Explore in increasing detail
10
14
 
@@ -16,11 +20,11 @@ Run inside an AntelopeJS module in development, connected to a provider that imp
16
20
  | 4. Measure only what you need | `Profile({ relation, columns })` | Inspect aggregates and traits for selected columns. |
17
21
  | 5. Investigate an undeclared relationship | `CheckReference({ from, to })` | Measure value containment without declaring a foreign key. |
18
22
 
19
- Start with metadata before requesting profiles. Use qualified relation names such as `"public.orders"`; omitting `columns` profiles all columns of the selected relation.
23
+ Read the metadata before you request a profile. Name relations with their schema, such as `"public.orders"`. A profile without `columns` covers every column of the relation.
20
24
 
21
25
  ## Inspect one relation
22
26
 
23
- This example uses the consuming module's default catalog binding. First inspect the relation list, then pass a name it returned to `inspectRelation`, such as `"public.orders"`. It reads metadata only; profiling is a separate, potentially more expensive step.
27
+ This example uses the consuming module's default catalog binding. First inspect the relation list, then pass a name it returned to `inspectRelation`, such as `"public.orders"`. It reads metadata only. A profile is a separate step, and it can cost more.
24
28
 
25
29
  ```ts docs-check
26
30
  import {
@@ -45,13 +49,13 @@ export async function inspectRelation(relation: string) {
45
49
  }
46
50
  ```
47
51
 
48
- Review `unmappable`, each column's `accepts` and `lossy` notes, and write permissions before generating table declarations. A missing key is not automatically a mapping refusal: such a relation can register without `_id`. Introspection does not grant permissions or add constraints.
52
+ Before you generate table declarations, review `unmappable`, each column's `accepts` and `lossy` notes, and the write permissions. A relation without a key is not refused for that reason alone. It registers without `_id`. Reading the catalog grants no permission and adds no constraint.
49
53
 
50
54
  ## Advanced: select a named provider
51
55
 
52
56
  A module that implements `@antelopejs/interface-database` over a database it does not own may also implement this interface. Each consumer reaches it through a connection declared on its own module entry in the project configuration, one per database. Two consumers of the same database give their connections the same id:
53
57
 
54
- ```ts
58
+ ```ts fragment
55
59
  "dms-builder": {
56
60
  importOverrides: [
57
61
  { interface: "@antelopejs/interface-database-catalog", source: "postgres-erp", id: "erp" },
@@ -64,7 +68,7 @@ A module that implements `@antelopejs/interface-database` over a database it doe
64
68
  },
65
69
  ```
66
70
 
67
- `GetInterfaceInstances(interfaceID)` lists connections visible to the calling module. `GetInterfaceInstance(interfaceID, connectionID)` returns connection metadata, including its loadable `path`, or `undefined`; it does not return the catalog exports. Resolve the connection by package name and load its path using AntelopeJS's established CommonJS loader pattern:
71
+ `GetInterfaceInstances(interfaceID)` lists connections visible to the calling module. `GetInterfaceInstance(interfaceID, connectionID)` returns the connection's metadata, including the `path` to load, or `undefined`. It does not return the catalog exports. Look the connection up by package name, then `require` its `path`:
68
72
 
69
73
  ```ts docs-check
70
74
  import { GetInterfaceInstance } from "@antelopejs/interface-core";
@@ -83,7 +87,7 @@ export async function inspectErp() {
83
87
  }
84
88
  ```
85
89
 
86
- Run this inside the consuming AntelopeJS module, with the provider loaded and the connection configured. A plain package import uses that module's default binding; loading `connection.path` selects the named binding. These calls do not create database connections themselves.
90
+ Run this inside the consuming AntelopeJS module, with the provider loaded and the connection configured. `require` returns an untyped value, and the annotation states its shape without checking it. It holds because `connection.path` resolves to this interface package, bound to the connection's provider. A plain package import uses the module's default binding, and loading `connection.path` selects the named binding. These calls do not open database connections.
87
91
 
88
92
  ## Functions
89
93
 
@@ -112,26 +116,26 @@ Values appear only as enum labels and as **categories**: the most frequent value
112
116
 
113
117
  ### Interpret incomplete measurements
114
118
 
115
- Every measure has its own time bound. Handle its status before reading a value; a failed measure does not invalidate the rest of a profile.
119
+ Every measure has its own time bound. Check its status before you read a value. A failed measure leaves the rest of the profile standing.
116
120
 
117
121
  | Status | Available data | Interpretation |
118
122
  | ----------- | -------------- | ----------------------------------------------------------------------------------- |
119
123
  | `"ok"` | `value` | The measure completed. Check sampling and exactness before treating it as a census. |
120
- | `"timeout"` | No value | The time bound expired; this is not a zero count. |
124
+ | `"timeout"` | No value | The time bound expired. This is not a zero count. |
121
125
  | `"error"` | `code` | The database refused the measure; only its error code is exposed. |
122
126
 
123
- A large relation is sampled, and `sample` reports the percentage and row count. A distinct count from a sample is a lower bound. Row counts also carry an `exact` flag. `CheckReference` reports containment and whether the target is a key; it does not prove that the database enforces a foreign key.
127
+ A large relation is sampled, and `sample` reports the percentage and the row count. A distinct count from a sample is a lower bound. Row counts also carry an `exact` flag. `CheckReference` answers a `Measure` too. Its value reports containment and whether the target is a key. It does not prove that the database enforces a foreign key.
124
128
 
125
129
  ## What a sample answers
126
130
 
127
- `SampleRows` is the one function that answers row values. It is meant for a person deciding what a relation's columns hold, never for a generator or a model:
131
+ `SampleRows` is the one function that answers row values. It is meant for a person who decides what a relation's columns hold, never for a generator or a model:
128
132
 
129
133
  - at most `SAMPLE_ROWS_LIMIT` (20) rows;
130
134
  - every value as text, cut at `SAMPLE_TEXT_LENGTH` (200) characters, and `truncated` when it was;
131
135
  - a binary value as its length only;
132
136
  - a large relation is sampled as a profile is, and `sample` says so.
133
137
 
134
- It reads without writing anything, within the same time bounds as a profile.
138
+ The interface does not fix how the provider reads the rows. `@antelopejs/postgres` reads them in one read-only transaction under the time bound of a measure, and throws when the read does not finish.
135
139
 
136
140
  ## Refusals
137
141
 
@@ -139,3 +143,52 @@ Every function refuses:
139
143
 
140
144
  - outside development;
141
145
  - on a provider instance that owns its tables.
146
+
147
+ ## Probe a connection string
148
+
149
+ Every AntelopeJS database driver exports `probe` from `dist/probe.js`, typed `export const probe: Probe`. A caller requires it as `@antelopejs/<driver>/dist/probe` to learn whether a connection string signs in and what the account may do. The probe opens its own connection from the URL and is not a catalog function. The interface declares the types; each driver implements them.
150
+
151
+ ```ts docs-check
152
+ import type { Probe } from "@antelopejs/interface-database-catalog";
153
+
154
+ export async function probeUrl(driver: string, url: string) {
155
+ const { probe }: { probe: Probe } = require(
156
+ `@antelopejs/${driver}/dist/probe`,
157
+ );
158
+ const timeoutMs = 5000;
159
+ const controller = new AbortController();
160
+ const deadline = setTimeout(() => controller.abort(), 3 * timeoutMs);
161
+ try {
162
+ return await probe({ url, timeoutMs, signal: controller.signal });
163
+ } finally {
164
+ clearTimeout(deadline);
165
+ }
166
+ }
167
+ ```
168
+
169
+ `require` returns an untyped value, and the annotation states its shape without checking it. It holds because each driver's `dist/probe.js` exports `probe` typed `Probe`.
170
+
171
+ `ProbeConfig` takes:
172
+
173
+ - `url`, the connection string the driver's `config.url` takes, with the database as its path;
174
+ - `timeoutMs`, which bounds the connect and each answer;
175
+ - `signal`, which closes everything the probe opened at once when it aborts. The caller sets its own deadline on it.
176
+
177
+ A probe never rejects and changes no row. It answers a `ProbeAnswer`, told apart by `outcome`:
178
+
179
+ | `outcome` | Fields | Meaning |
180
+ | --------------- | ---------------------------------------------------------- | ------------------------------------------- |
181
+ | `"unreachable"` | `message` | No server answered at the URL. |
182
+ | `"refused"` | `refusal`, `message` | A server answered and refused the sign-in. |
183
+ | `"signed-in"` | `latencyMs`, `user?`, `canRead`, `canWrite`, `unreadable?` | The account signed in, with what it may do. |
184
+
185
+ `refusal` is a `ProbeRefusal`: `"credentials"`, `"host"`, `"database"`, `"database-denied"`, `"sign-in-required"` or `"other"`.
186
+
187
+ For a signed-in account:
188
+
189
+ - `canWrite` is true when the account may insert, update or delete in any relation it sees;
190
+ - `canRead` is true when it may read any relation it sees, or sees none, and false whenever `unreadable` is set;
191
+ - `latencyMs` is how long the account's first query took, rounded up to a millisecond;
192
+ - `unreadable`, a `ProbeUnreadable`, comes with `canRead: false` and says why the account cannot read when the cause is not its privileges: `"no-database-named"`, `"no-database"` or `"cannot-list"`.
193
+
194
+ `message` is the driver's own text. A caller that shows it to a person writes its own sentence and redacts the URL and the password first.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antelopejs/interface-database-catalog",
3
- "version": "0.0.3",
3
+ "version": "0.1.0",
4
4
  "description": "AntelopeJS interface for describing and profiling a connected database",
5
5
  "keywords": [
6
6
  "antelopejs",
@@ -32,22 +32,32 @@
32
32
  "provenance": true
33
33
  },
34
34
  "scripts": {
35
- "build": "rimraf dist && tsc",
35
+ "build": "rimraf dist && tsc --skipLibCheck",
36
36
  "typecheck": "tsc --noEmit",
37
+ "test": "pnpm run build",
37
38
  "format": "oxfmt .",
38
39
  "lint:fix": "oxlint --fix",
39
40
  "lint": "oxlint",
40
41
  "prepack": "pnpm run build",
41
- "release": "pnpm run lint && pnpm run prepack && release-it",
42
+ "release": "pnpm run lint && pnpm run typecheck && pnpm run prepack && release-it",
42
43
  "format:check": "oxfmt --check .",
43
- "knip": "knip"
44
+ "knip": "knip",
45
+ "prepare": "if [ -e .git ] && command -v git >/dev/null 2>&1 && command -v lefthook >/dev/null 2>&1 && GIT_DIR=.git GIT_WORK_TREE=. git rev-parse --git-dir >/dev/null 2>&1; then GIT_DIR=.git GIT_WORK_TREE=. lefthook install; fi",
46
+ "checks": "antelopejs-checks",
47
+ "size": "antelopejs-check-size",
48
+ "sync": "antelopejs-sync",
49
+ "sync:check": "antelopejs-sync --check",
50
+ "suppressions": "antelopejs-suppressions",
51
+ "suppressions:update": "antelopejs-suppressions --update"
44
52
  },
45
53
  "devDependencies": {
46
- "@antelopejs/interface-core": ">=0.2.4 <1.0.0",
47
- "@antelopejs/tooling-configs": "^0.0.9",
54
+ "@antelopejs/core": "~1.23.3",
55
+ "@antelopejs/interface-core": ">=0.5.0 <0.6.0",
56
+ "@antelopejs/tooling-configs": ">=0.7.1 <0.8.0",
48
57
  "@types/node": "^22.19.15",
49
58
  "knip": "^6.34.0",
50
- "oxfmt": "^0.66.0",
59
+ "lefthook": "^2.2.2",
60
+ "oxfmt": "^0.77.0",
51
61
  "oxlint": "1.81.0",
52
62
  "oxlint-tsgolint": "^7.0.2001",
53
63
  "release-it": "^19.2.4",
@@ -56,7 +66,12 @@
56
66
  "typescript": "^5.9.3"
57
67
  },
58
68
  "peerDependencies": {
59
- "@antelopejs/interface-core": ">=0.2.4 <1.0.0"
69
+ "@antelopejs/interface-core": ">=0.5.0 <0.6.0"
60
70
  },
61
- "packageManager": "pnpm@10.6.5"
71
+ "packageManager": "pnpm@10.6.5",
72
+ "antelopeJs": {
73
+ "docs": {
74
+ "standard": true
75
+ }
76
+ }
62
77
  }