@adonis-agora/filter 1.0.0-rc.0 → 1.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/commands/agora_doctor.d.ts +23 -0
- package/dist/commands/agora_doctor.d.ts.map +1 -0
- package/dist/commands/agora_doctor.js +110 -0
- package/dist/commands/agora_doctor.js.map +1 -0
- package/dist/commands/filter_doctor.d.ts +8 -0
- package/dist/commands/filter_doctor.d.ts.map +1 -0
- package/dist/commands/filter_doctor.js +8 -0
- package/dist/commands/filter_doctor.js.map +1 -0
- package/dist/commands/main.d.ts +6 -4
- package/dist/commands/main.d.ts.map +1 -1
- package/dist/commands/main.js +6 -3
- package/dist/commands/main.js.map +1 -1
- package/dist/commands/make_filter_client.d.ts.map +1 -1
- package/dist/commands/make_filter_client.js +10 -14
- package/dist/commands/make_filter_client.js.map +1 -1
- package/dist/providers/filter_provider.d.ts +4 -0
- package/dist/providers/filter_provider.d.ts.map +1 -1
- package/dist/providers/filter_provider.js +31 -0
- package/dist/providers/filter_provider.js.map +1 -1
- package/dist/src/dev_tools/contract.d.ts +61 -0
- package/dist/src/dev_tools/contract.d.ts.map +1 -0
- package/dist/src/dev_tools/contract.js +12 -0
- package/dist/src/dev_tools/contract.js.map +1 -0
- package/dist/src/dev_tools/explain.d.ts +88 -0
- package/dist/src/dev_tools/explain.d.ts.map +1 -0
- package/dist/src/dev_tools/explain.js +168 -0
- package/dist/src/dev_tools/explain.js.map +1 -0
- package/dist/src/dev_tools/query_string.d.ts +8 -0
- package/dist/src/dev_tools/query_string.d.ts.map +1 -0
- package/dist/src/dev_tools/query_string.js +102 -0
- package/dist/src/dev_tools/query_string.js.map +1 -0
- package/dist/src/dev_tools/tools.d.ts +25 -0
- package/dist/src/dev_tools/tools.d.ts.map +1 -0
- package/dist/src/dev_tools/tools.js +147 -0
- package/dist/src/dev_tools/tools.js.map +1 -0
- package/dist/src/doctor/agora_doctor.d.ts +116 -0
- package/dist/src/doctor/agora_doctor.d.ts.map +1 -0
- package/dist/src/doctor/agora_doctor.js +685 -0
- package/dist/src/doctor/agora_doctor.js.map +1 -0
- package/dist/src/doctor/checks.d.ts +12 -0
- package/dist/src/doctor/checks.d.ts.map +1 -0
- package/dist/src/doctor/checks.js +173 -0
- package/dist/src/doctor/checks.js.map +1 -0
- package/dist/src/doctor/index.d.ts +5 -0
- package/dist/src/doctor/index.d.ts.map +1 -0
- package/dist/src/doctor/index.js +5 -0
- package/dist/src/doctor/index.js.map +1 -0
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +4 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/manifest.d.ts +33 -0
- package/dist/src/manifest.d.ts.map +1 -0
- package/dist/src/manifest.js +50 -0
- package/dist/src/manifest.js.map +1 -0
- package/package.json +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @adonis-agora/filter
|
|
2
2
|
|
|
3
|
+
## 1.0.0-rc.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#146](https://github.com/DavideCarvalho/adonis-agora-filter/pull/146) [`efaae21`](https://github.com/DavideCarvalho/adonis-agora-filter/commit/efaae2137a53a8c85a66a9640d5606256ac82852) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - `node ace agora:doctor` (the shared Agora health check) and `node ace filter:doctor`, with the `filter.manifest` check: `config/filter.ts` loads, and the clients in `app/generated/filters` match it (out of date, missing or orphaned → run `make:filter-client`). New `@adonis-agora/filter/doctor` entry for `--no-boot`.
|
|
8
|
+
|
|
9
|
+
## 1.0.0-rc.1
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#145](https://github.com/DavideCarvalho/adonis-agora-filter/pull/145) [`7548c56`](https://github.com/DavideCarvalho/adonis-agora-filter/commit/7548c56e9ac622723ebcdca9a9253ef3068fdc2b) Thanks [@DavideCarvalho](https://github.com/DavideCarvalho)! - Dev MCP tools on `@adonis-agora/agent`'s `/mcp/agora` endpoint (gated by its `devTools.authorize`): `filter_list_specs`, `filter_get_spec`, `filter_explain_query` (dry run of a query string against a spec, no database). New exports `explainFilterQuery`, `parseQueryString` and `loadFilterManifest`; `make:filter-client` now also reads a default `{ filters }` export or `filters` in the `filter` config.
|
|
14
|
+
|
|
3
15
|
## 1.0.0-rc.0
|
|
4
16
|
|
|
5
17
|
### Major Changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseCommand } from '@adonisjs/core/ace';
|
|
2
|
+
import type { CommandOptions } from '@adonisjs/core/types/ace';
|
|
3
|
+
/**
|
|
4
|
+
* `node ace agora:doctor`: one health check for every installed `@adonis-agora` lib. Exit code `0`
|
|
5
|
+
* when nothing is an error (`--strict`: nor a warning), `1` otherwise, `2` when the doctor itself
|
|
6
|
+
* cannot run.
|
|
7
|
+
*/
|
|
8
|
+
export default class AgoraDoctor extends BaseCommand {
|
|
9
|
+
static commandName: string;
|
|
10
|
+
static description: string;
|
|
11
|
+
static options: CommandOptions;
|
|
12
|
+
/** A `<lib>:doctor` alias sets this to pre-filter its lib. */
|
|
13
|
+
protected presetLib: string | undefined;
|
|
14
|
+
json: boolean;
|
|
15
|
+
lib?: string;
|
|
16
|
+
deep: boolean;
|
|
17
|
+
only?: string;
|
|
18
|
+
strict: boolean;
|
|
19
|
+
verbose: boolean;
|
|
20
|
+
boot: boolean;
|
|
21
|
+
run(): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=agora_doctor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agora_doctor.d.ts","sourceRoot":"","sources":["../../commands/agora_doctor.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAS,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAS/D;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,WAAW;IAClD,OAAgB,WAAW,SAAkB;IAC7C,OAAgB,WAAW,SAAkE;IAE7F,OAAgB,OAAO,EAAE,cAAc,CAAuB;IAE9D,8DAA8D;IAC9D,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAa;IAG5C,IAAI,EAAE,OAAO,CAAC;IAGd,GAAG,CAAC,EAAE,MAAM,CAAC;IAGb,IAAI,EAAE,OAAO,CAAC;IAGd,IAAI,CAAC,EAAE,MAAM,CAAC;IAGd,MAAM,EAAE,OAAO,CAAC;IAGhB,OAAO,EAAE,OAAO,CAAC;IAOjB,IAAI,EAAE,OAAO,CAAC;IAEP,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAwDlC;CACF"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// agora-doctor command v1 — keep identical across libs
|
|
2
|
+
// Revision 1.1 (see the canonical README for the changelog).
|
|
3
|
+
// Every @adonis-agora lib ships this command (commands/agora_doctor.ts); whichever copy Ace loads
|
|
4
|
+
// last wins, and they all behave the same. Each repo's CI checks its sha256 against the pinned
|
|
5
|
+
// canonical one. Never edit a lib's copy: change the canonical copy, then re-copy it into every lib.
|
|
6
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
7
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
};
|
|
12
|
+
import { BaseCommand, flags } from '@adonisjs/core/ace';
|
|
13
|
+
import { AgoraDoctorUsageError, discoverDoctorChecks, readDoctorChecks, renderAgoraDoctor, runAgoraDoctor, } from '../src/doctor/agora_doctor.js';
|
|
14
|
+
/**
|
|
15
|
+
* `node ace agora:doctor`: one health check for every installed `@adonis-agora` lib. Exit code `0`
|
|
16
|
+
* when nothing is an error (`--strict`: nor a warning), `1` otherwise, `2` when the doctor itself
|
|
17
|
+
* cannot run.
|
|
18
|
+
*/
|
|
19
|
+
export default class AgoraDoctor extends BaseCommand {
|
|
20
|
+
static commandName = 'agora:doctor';
|
|
21
|
+
static description = 'Check the configuration of every installed @adonis-agora lib';
|
|
22
|
+
// The app is booted by `run()` itself, so `--no-boot` can skip it.
|
|
23
|
+
static options = { startApp: false };
|
|
24
|
+
/** A `<lib>:doctor` alias sets this to pre-filter its lib. */
|
|
25
|
+
presetLib = undefined;
|
|
26
|
+
async run() {
|
|
27
|
+
const err = (line) => process.stderr.write(`${line}\n`);
|
|
28
|
+
try {
|
|
29
|
+
let checks;
|
|
30
|
+
if (this.boot === false) {
|
|
31
|
+
checks = await discoverDoctorChecks(this.app);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
if (!this.app.isReady) {
|
|
35
|
+
try {
|
|
36
|
+
await this.app.boot();
|
|
37
|
+
await this.app.start(() => { });
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
41
|
+
throw new AgoraDoctorUsageError(`the app did not boot (${reason}). Fix the boot error, or run with --no-boot.`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
checks = await readDoctorChecks(this.app.container);
|
|
45
|
+
}
|
|
46
|
+
const libs = (this.lib ?? this.presetLib)
|
|
47
|
+
?.split(',')
|
|
48
|
+
.map((name) => name.trim())
|
|
49
|
+
.filter(Boolean);
|
|
50
|
+
const { report, exitCode } = await runAgoraDoctor(this.app, checks, {
|
|
51
|
+
...(libs ? { libs } : {}),
|
|
52
|
+
...(this.only ? { only: this.only } : {}),
|
|
53
|
+
deep: this.deep === true,
|
|
54
|
+
noBoot: this.boot === false,
|
|
55
|
+
strict: this.strict === true,
|
|
56
|
+
});
|
|
57
|
+
if (this.json) {
|
|
58
|
+
process.stdout.write(`${JSON.stringify(report)}\n`);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
const fancy = process.stdout.isTTY === true && !process.env.NO_COLOR;
|
|
62
|
+
const c = this.colors;
|
|
63
|
+
process.stdout.write(renderAgoraDoctor(report, {
|
|
64
|
+
verbose: this.verbose === true,
|
|
65
|
+
fancy,
|
|
66
|
+
paint: {
|
|
67
|
+
green: (t) => c.green(t),
|
|
68
|
+
yellow: (t) => c.yellow(t),
|
|
69
|
+
red: (t) => c.red(t),
|
|
70
|
+
dim: (t) => c.dim(t),
|
|
71
|
+
bold: (t) => c.bold(t),
|
|
72
|
+
},
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
this.exitCode = exitCode;
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
if (!(error instanceof AgoraDoctorUsageError))
|
|
79
|
+
throw error;
|
|
80
|
+
err(`agora:doctor: ${error.message}`);
|
|
81
|
+
this.exitCode = 2;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
__decorate([
|
|
86
|
+
flags.boolean({ description: 'Print one JSON object to stdout' })
|
|
87
|
+
], AgoraDoctor.prototype, "json", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
flags.string({ description: 'Only these libs, comma separated (durable,payments)' })
|
|
90
|
+
], AgoraDoctor.prototype, "lib", void 0);
|
|
91
|
+
__decorate([
|
|
92
|
+
flags.boolean({ description: 'Also run checks that touch the database, Redis or the network' })
|
|
93
|
+
], AgoraDoctor.prototype, "deep", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
flags.string({ description: 'Run one check by id' })
|
|
96
|
+
], AgoraDoctor.prototype, "only", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
flags.boolean({ description: 'Fail (exit 1) on warnings too' })
|
|
99
|
+
], AgoraDoctor.prototype, "strict", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
flags.boolean({ description: 'Show skipped checks and every message' })
|
|
102
|
+
], AgoraDoctor.prototype, "verbose", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
flags.boolean({
|
|
105
|
+
description: 'Boot the app first; --no-boot checks the config only (when boot itself fails)',
|
|
106
|
+
default: true,
|
|
107
|
+
showNegatedVariantInHelp: true,
|
|
108
|
+
})
|
|
109
|
+
], AgoraDoctor.prototype, "boot", void 0);
|
|
110
|
+
//# sourceMappingURL=agora_doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agora_doctor.js","sourceRoot":"","sources":["../../commands/agora_doctor.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,6DAA6D;AAC7D,kGAAkG;AAClG,+FAA+F;AAC/F,qGAAqG;;;;;;;AAErG,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GACf,MAAM,+BAA+B,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,WAAW;IAClD,MAAM,CAAU,WAAW,GAAG,cAAc,CAAC;IAC7C,MAAM,CAAU,WAAW,GAAG,8DAA8D,CAAC;IAC7F,mEAAmE;IACnE,MAAM,CAAU,OAAO,GAAmB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAE9D,8DAA8D;IACpD,SAAS,GAAuB,SAAS,CAAC;IA2B3C,KAAK,CAAC,GAAG;QAChB,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;QAChE,IAAI,CAAC;YACH,IAAI,MAAoD,CAAC;Y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,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,CAAC,KAAK,YAAY,qBAAqB,CAAC;gBAAE,MAAM,KAAK,CAAC;YAC3D,GAAG,CAAC,iBAAiB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACtC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QACpB,CAAC;IACH,CAAC;CACF;AAjFS;IADP,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,iCAAiC,EAAE,CAAC;yCAC5C;AAGd;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,qDAAqD,EAAE,CAAC;wCAChE;AAGb;IADP,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,+DAA+D,EAAE,CAAC;yCAC1E;AAGd;IADP,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,qBAAqB,EAAE,CAAC;yCAC/B;AAGd;IADP,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,+BAA+B,EAAE,CAAC;2CACxC;AAGhB;IADP,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,uCAAuC,EAAE,CAAC;4CAC/C;AAOjB;IALP,KAAK,CAAC,OAAO,CAAC;QACb,WAAW,EAAE,+EAA+E;QAC5F,OAAO,EAAE,IAAI;QACb,wBAAwB,EAAE,IAAI;KAC/B,CAAC;yCACoB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import AgoraDoctor from './agora_doctor.js';
|
|
2
|
+
/** `node ace filter:doctor`: `agora:doctor` for `@adonis-agora/filter` only. */
|
|
3
|
+
export default class FilterDoctor extends AgoraDoctor {
|
|
4
|
+
static commandName: string;
|
|
5
|
+
static description: string;
|
|
6
|
+
protected presetLib: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=filter_doctor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter_doctor.d.ts","sourceRoot":"","sources":["../../commands/filter_doctor.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAE5C,gFAAgF;AAChF,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAW;IACnD,OAAgB,WAAW,SAAmB;IAC9C,OAAgB,WAAW,SAAkD;IAC7E,UAAmB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAY;CAC7D"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import AgoraDoctor from './agora_doctor.js';
|
|
2
|
+
/** `node ace filter:doctor`: `agora:doctor` for `@adonis-agora/filter` only. */
|
|
3
|
+
export default class FilterDoctor extends AgoraDoctor {
|
|
4
|
+
static commandName = 'filter:doctor';
|
|
5
|
+
static description = 'Check the @adonis-agora/filter configuration';
|
|
6
|
+
presetLib = 'filter';
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=filter_doctor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter_doctor.js","sourceRoot":"","sources":["../../commands/filter_doctor.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAE5C,gFAAgF;AAChF,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAW;IACnD,MAAM,CAAU,WAAW,GAAG,eAAe,CAAC;IAC9C,MAAM,CAAU,WAAW,GAAG,8CAA8C,CAAC;IAC1D,SAAS,GAAuB,QAAQ,CAAC;CAC7D"}
|
package/dist/commands/main.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import { ListLoader } from '@adonisjs/core/ace';
|
|
2
|
+
import AgoraDoctor from './agora_doctor.js';
|
|
2
3
|
import MakeFilter from './make_filter.js';
|
|
3
4
|
import MakeFilterClient from './make_filter_client.js';
|
|
4
5
|
/**
|
|
5
6
|
* The commands barrel for `@adonis-agora/filter`. An app registers it in its
|
|
6
7
|
* `adonisrc` via `rcFile.addCommand('@adonis-agora/filter/commands')`. A
|
|
7
8
|
* {@link ListLoader} exposes the `make:filter-client` command's metadata and
|
|
8
|
-
* constructors to the ace kernel: `make:filter` (scaffold a filter class)
|
|
9
|
-
* `make:filter-client` (emit the typed front-end builders)
|
|
9
|
+
* constructors to the ace kernel: `make:filter` (scaffold a filter class),
|
|
10
|
+
* `make:filter-client` (emit the typed front-end builders) and the `agora:doctor` /
|
|
11
|
+
* `filter:doctor` health check.
|
|
10
12
|
*
|
|
11
13
|
* `@adonisjs/core` is an *optional* peer of this otherwise framework-free core —
|
|
12
14
|
* only this `./commands` subpath imports it, so the main entrypoint stays
|
|
13
15
|
* dependency-free.
|
|
14
16
|
*/
|
|
15
|
-
declare const loader: ListLoader<typeof MakeFilter | typeof MakeFilterClient>;
|
|
17
|
+
declare const loader: ListLoader<typeof AgoraDoctor | typeof MakeFilter | typeof MakeFilterClient>;
|
|
16
18
|
export declare const getMetaData: () => Promise<import("@adonisjs/core/types/ace").CommandMetaData[]>;
|
|
17
|
-
export declare const getCommand: (metaData: import("@adonisjs/core/types/ace").CommandMetaData) => Promise<typeof MakeFilter | typeof MakeFilterClient | null>;
|
|
19
|
+
export declare const getCommand: (metaData: import("@adonisjs/core/types/ace").CommandMetaData) => Promise<typeof AgoraDoctor | typeof MakeFilter | typeof MakeFilterClient | null>;
|
|
18
20
|
export default loader;
|
|
19
21
|
//# sourceMappingURL=main.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../commands/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AAEvD
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../commands/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAE5C,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,MAAM,8EAA4E,CAAC;AAEzF,eAAO,MAAM,WAAW,qEAAkC,CAAC;AAC3D,eAAO,MAAM,UAAU,oJAAiC,CAAC;eAE1C,MAAM"}
|
package/dist/commands/main.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { ListLoader } from '@adonisjs/core/ace';
|
|
2
|
+
import AgoraDoctor from './agora_doctor.js';
|
|
3
|
+
import FilterDoctor from './filter_doctor.js';
|
|
2
4
|
import MakeFilter from './make_filter.js';
|
|
3
5
|
import MakeFilterClient from './make_filter_client.js';
|
|
4
6
|
/**
|
|
5
7
|
* The commands barrel for `@adonis-agora/filter`. An app registers it in its
|
|
6
8
|
* `adonisrc` via `rcFile.addCommand('@adonis-agora/filter/commands')`. A
|
|
7
9
|
* {@link ListLoader} exposes the `make:filter-client` command's metadata and
|
|
8
|
-
* constructors to the ace kernel: `make:filter` (scaffold a filter class)
|
|
9
|
-
* `make:filter-client` (emit the typed front-end builders)
|
|
10
|
+
* constructors to the ace kernel: `make:filter` (scaffold a filter class),
|
|
11
|
+
* `make:filter-client` (emit the typed front-end builders) and the `agora:doctor` /
|
|
12
|
+
* `filter:doctor` health check.
|
|
10
13
|
*
|
|
11
14
|
* `@adonisjs/core` is an *optional* peer of this otherwise framework-free core —
|
|
12
15
|
* only this `./commands` subpath imports it, so the main entrypoint stays
|
|
13
16
|
* dependency-free.
|
|
14
17
|
*/
|
|
15
|
-
const loader = new ListLoader([MakeFilter, MakeFilterClient]);
|
|
18
|
+
const loader = new ListLoader([MakeFilter, MakeFilterClient, FilterDoctor, AgoraDoctor]);
|
|
16
19
|
export const getMetaData = loader.getMetaData.bind(loader);
|
|
17
20
|
export const getCommand = loader.getCommand.bind(loader);
|
|
18
21
|
export default loader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../commands/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AAEvD
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../commands/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAC5C,OAAO,YAAY,MAAM,oBAAoB,CAAC;AAC9C,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAC1C,OAAO,gBAAgB,MAAM,yBAAyB,CAAC;AAEvD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,CAAC,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;AAEzF,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAEzD,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make_filter_client.d.ts","sourceRoot":"","sources":["../../commands/make_filter_client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,WAAW,EAAS,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"make_filter_client.d.ts","sourceRoot":"","sources":["../../commands/make_filter_client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,WAAW,EAAS,MAAM,oBAAoB,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAK/D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,WAAW;;IACvD,OAAgB,WAAW,SAAwB;IACnD,OAAgB,WAAW,SAC4C;IACvE,OAAgB,OAAO,EAAE,cAAc,CAAsB;IAOrD,UAAU,EAAE,MAAM,CAAC;IAMnB,MAAM,EAAE,MAAM,CAAC;IAER,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,CAelC;CAiBF"}
|
|
@@ -8,6 +8,7 @@ import { mkdir, writeFile } from 'node:fs/promises';
|
|
|
8
8
|
import { isAbsolute, join } from 'node:path';
|
|
9
9
|
import { args, BaseCommand, flags } from '@adonisjs/core/ace';
|
|
10
10
|
import { generateFilterClients } from '../src/generate_client.js';
|
|
11
|
+
import { loadFilterManifest } from '../src/manifest.js';
|
|
11
12
|
/**
|
|
12
13
|
* `node ace make:filter-client [entrypoint]` — the idiomatic AdonisJS equivalent
|
|
13
14
|
* of the NestJS `nestjs-filter` codegen bin.
|
|
@@ -49,24 +50,19 @@ export default class MakeFilterClient extends BaseCommand {
|
|
|
49
50
|
}
|
|
50
51
|
this.logger.success(`Generated ${generated.length} filter client(s) into ${this.output}.`);
|
|
51
52
|
}
|
|
52
|
-
/**
|
|
53
|
+
/** Load the `filters` manifest with the loader the doctor and the dev tools share. */
|
|
53
54
|
async #loadManifest() {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
this.logger.error(`Could not import filter manifest "${this.entrypoint}": ${String(error)}`);
|
|
55
|
+
const load = await loadFilterManifest(this.app, this.entrypoint);
|
|
56
|
+
if (load.status === 'loaded')
|
|
57
|
+
return load.manifest;
|
|
58
|
+
if (load.status === 'failed' || load.status === 'missing') {
|
|
59
|
+
const reason = load.status === 'failed' ? load.error : 'the module was not found';
|
|
60
|
+
this.logger.error(`Could not import filter manifest "${this.entrypoint}": ${reason}`);
|
|
61
61
|
this.exitCode = 1;
|
|
62
62
|
return undefined;
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
this.logger.warning(`No \`filters\` manifest exported from "${this.entrypoint}" — nothing to generate.`);
|
|
67
|
-
return undefined;
|
|
68
|
-
}
|
|
69
|
-
return manifest;
|
|
64
|
+
this.logger.warning(`No \`filters\` manifest exported from "${this.entrypoint}" — nothing to generate.`);
|
|
65
|
+
return undefined;
|
|
70
66
|
}
|
|
71
67
|
}
|
|
72
68
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"make_filter_client.js","sourceRoot":"","sources":["../../commands/make_filter_client.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"make_filter_client.js","sourceRoot":"","sources":["../../commands/make_filter_client.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,WAAW;IACvD,MAAM,CAAU,WAAW,GAAG,oBAAoB,CAAC;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MAAM,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1D,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,0BAA0B,CAAC;YAClF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qCAAqC,IAAI,CAAC,UAAU,MAAM,MAAM,EAAE,CAAC,CAAC;YACtF,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;YAClB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,OAAO,CACjB,0CAA0C,IAAI,CAAC,UAAU,0BAA0B,CACpF,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;CACF;AAxCS;IALP,IAAI,CAAC,MAAM,CAAC;QACX,WAAW,EAAE,uCAAuC;QACpD,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,kBAAkB;KAC5B,CAAC;oDACyB;AAMnB;IAJP,KAAK,CAAC,MAAM,CAAC;QACZ,WAAW,EAAE,4CAA4C;QACzD,OAAO,EAAE,uBAAuB;KACjC,CAAC;gDACqB"}
|
|
@@ -15,12 +15,16 @@ import type { ApplicationService } from '@adonisjs/core/types';
|
|
|
15
15
|
* const page = await User.query().filterPaginate(userFilter, ctx)
|
|
16
16
|
* ```
|
|
17
17
|
*
|
|
18
|
+
* It also registers the `agora:doctor` checks, and the filter developer tools on `@adonis-agora/agent`'s dev MCP endpoint when
|
|
19
|
+
* that is installed.
|
|
20
|
+
*
|
|
18
21
|
* Register it in `adonisrc.ts` (`providers`). The free functions
|
|
19
22
|
* (`applyFilterFromRequest`, `applyCursorFromRequest`) work without it — this
|
|
20
23
|
* provider only adds the chainable sugar, so `@adonisjs/lucid` is loaded lazily
|
|
21
24
|
* here (not a hard dependency of the package).
|
|
22
25
|
*/
|
|
23
26
|
export default class FilterProvider {
|
|
27
|
+
#private;
|
|
24
28
|
protected app: ApplicationService;
|
|
25
29
|
constructor(app: ApplicationService);
|
|
26
30
|
boot(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter_provider.d.ts","sourceRoot":"","sources":["../../providers/filter_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"filter_provider.d.ts","sourceRoot":"","sources":["../../providers/filter_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAO/D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc;;IACrB,SAAS,CAAC,GAAG,EAAE,kBAAkB;IAA7C,YAAsB,GAAG,EAAE,kBAAkB,EAAI;IAE3C,IAAI,kBAKT;CA2BF"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { registerFilterDevTools } from '../src/dev_tools/tools.js';
|
|
2
|
+
import { registerDoctorChecks } from '../src/doctor/agora_doctor.js';
|
|
3
|
+
import { filterDoctorChecks } from '../src/doctor/checks.js';
|
|
1
4
|
import { registerFilterMacros } from '../src/lucid_macros.js';
|
|
5
|
+
import { loadFilterManifest } from '../src/manifest.js';
|
|
2
6
|
/**
|
|
3
7
|
* Wires `@adonis-agora/filter`'s chainable Lucid macros into the application.
|
|
4
8
|
*
|
|
@@ -15,6 +19,9 @@ import { registerFilterMacros } from '../src/lucid_macros.js';
|
|
|
15
19
|
* const page = await User.query().filterPaginate(userFilter, ctx)
|
|
16
20
|
* ```
|
|
17
21
|
*
|
|
22
|
+
* It also registers the `agora:doctor` checks, and the filter developer tools on `@adonis-agora/agent`'s dev MCP endpoint when
|
|
23
|
+
* that is installed.
|
|
24
|
+
*
|
|
18
25
|
* Register it in `adonisrc.ts` (`providers`). The free functions
|
|
19
26
|
* (`applyFilterFromRequest`, `applyCursorFromRequest`) work without it — this
|
|
20
27
|
* provider only adds the chainable sugar, so `@adonisjs/lucid` is loaded lazily
|
|
@@ -26,8 +33,32 @@ export default class FilterProvider {
|
|
|
26
33
|
this.app = app;
|
|
27
34
|
}
|
|
28
35
|
async boot() {
|
|
36
|
+
await registerDoctorChecks(this.app.container, filterDoctorChecks());
|
|
29
37
|
const { ModelQueryBuilder } = await import('@adonisjs/lucid/orm');
|
|
30
38
|
registerFilterMacros(ModelQueryBuilder);
|
|
39
|
+
await this.#registerDevTools();
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Registers the filter developer tools on `@adonis-agora/agent`'s dev MCP endpoint
|
|
43
|
+
* (`/mcp/agora`) when it is installed. They read the `filters` manifest of config/filter.ts at
|
|
44
|
+
* call time.
|
|
45
|
+
*/
|
|
46
|
+
async #registerDevTools() {
|
|
47
|
+
const container = this.app.container;
|
|
48
|
+
if (typeof container.hasBinding !== 'function')
|
|
49
|
+
return;
|
|
50
|
+
if (this.app.config.get('filter', {})?.devTools === false) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const outcome = await registerFilterDevTools(this.app.container, {
|
|
54
|
+
manifest: () => loadFilterManifest(this.app),
|
|
55
|
+
});
|
|
56
|
+
if (outcome === 'unsupported' || outcome === 'failed') {
|
|
57
|
+
const logger = (await this.app.container.make('logger').catch(() => undefined));
|
|
58
|
+
logger?.debug(outcome === 'unsupported'
|
|
59
|
+
? '[@adonis-agora/filter] dev tools not registered: the installed @adonis-agora/agent cannot gate libs without a console (needs devTools.authorize support)'
|
|
60
|
+
: '[@adonis-agora/filter] dev tools could not be registered');
|
|
61
|
+
}
|
|
31
62
|
}
|
|
32
63
|
}
|
|
33
64
|
//# sourceMappingURL=filter_provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter_provider.js","sourceRoot":"","sources":["../../providers/filter_provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;
|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AC;SAC7C,CAAC,CAAC;QACH,IAAI,OAAO,KAAK,aAAa,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;YACtD,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAEjE,CAAC;YACd,MAAM,EAAE,KAAK,CACX,OAAO,KAAK,aAAa;gBACvB,CAAC,CAAC,0JAA0J;gBAC5J,CAAC,CAAC,0DAA0D,CAC/D,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A local, structural copy of the dev-tools registration contract (version 1) served by
|
|
3
|
+
* `@adonis-agora/agent`'s MCP provider at `/mcp/agora`. filter never imports the agent: it
|
|
4
|
+
* registers into the `'agora.devTools'` container binding when it exists.
|
|
5
|
+
*
|
|
6
|
+
* filter has no console, so it registers WITHOUT its own `authorize`: the endpoint-level
|
|
7
|
+
* `devTools.authorize` (config/mcp.ts) gates its tools. That needs a hub that says
|
|
8
|
+
* `supports('endpoint-authorize')`.
|
|
9
|
+
*/
|
|
10
|
+
/** The container binding the hub lives at. */
|
|
11
|
+
export declare const DEV_TOOLS_BINDING = "agora.devTools";
|
|
12
|
+
export interface DevToolsHub {
|
|
13
|
+
readonly version: 1;
|
|
14
|
+
register(lib: DevToolsLib): void;
|
|
15
|
+
/** Optional capability probe. filter needs `'endpoint-authorize'`. */
|
|
16
|
+
supports?(capability: string): boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface DevToolsLib {
|
|
19
|
+
lib: string;
|
|
20
|
+
title: string;
|
|
21
|
+
/** Omitted: the endpoint's `devTools.authorize` decides. */
|
|
22
|
+
authorize?: (ctx: unknown) => Promise<unknown>;
|
|
23
|
+
tools: DevTool[];
|
|
24
|
+
}
|
|
25
|
+
export interface DevToolInputProperty {
|
|
26
|
+
type: 'string' | 'number' | 'integer' | 'boolean' | 'array';
|
|
27
|
+
description?: string;
|
|
28
|
+
enum?: readonly string[];
|
|
29
|
+
items?: {
|
|
30
|
+
type: 'string';
|
|
31
|
+
};
|
|
32
|
+
minimum?: number;
|
|
33
|
+
maximum?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface DevToolInputSchema {
|
|
36
|
+
type: 'object';
|
|
37
|
+
properties: Record<string, DevToolInputProperty>;
|
|
38
|
+
required?: string[];
|
|
39
|
+
}
|
|
40
|
+
export interface DevToolsCaller {
|
|
41
|
+
id: string;
|
|
42
|
+
via: 'token' | 'session' | 'open';
|
|
43
|
+
}
|
|
44
|
+
export interface DevToolCall {
|
|
45
|
+
ctx: unknown;
|
|
46
|
+
caller: DevToolsCaller;
|
|
47
|
+
limits: {
|
|
48
|
+
maxRows: number;
|
|
49
|
+
maxBytes: number;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export interface DevTool {
|
|
53
|
+
name: string;
|
|
54
|
+
kind: 'read' | 'action';
|
|
55
|
+
description: string;
|
|
56
|
+
input: DevToolInputSchema;
|
|
57
|
+
destructive?: boolean;
|
|
58
|
+
available?(): boolean | Promise<boolean>;
|
|
59
|
+
run(input: Record<string, unknown>, call: DevToolCall): Promise<unknown>;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../src/dev_tools/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,8CAA8C;AAC9C,eAAO,MAAM,iBAAiB,mBAAmB,CAAC;AAElD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC;IACpB,QAAQ,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI,CAAC;IACjC,sEAAsE;IACtE,QAAQ,CAAC,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;CACx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AS,CAAC,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1E"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A local, structural copy of the dev-tools registration contract (version 1) served by
|
|
3
|
+
* `@adonis-agora/agent`'s MCP provider at `/mcp/agora`. filter never imports the agent: it
|
|
4
|
+
* registers into the `'agora.devTools'` container binding when it exists.
|
|
5
|
+
*
|
|
6
|
+
* filter has no console, so it registers WITHOUT its own `authorize`: the endpoint-level
|
|
7
|
+
* `devTools.authorize` (config/mcp.ts) gates its tools. That needs a hub that says
|
|
8
|
+
* `supports('endpoint-authorize')`.
|
|
9
|
+
*/
|
|
10
|
+
/** The container binding the hub lives at. */
|
|
11
|
+
export const DEV_TOOLS_BINDING = 'agora.devTools';
|
|
12
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../src/dev_tools/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { FilterSpec } from '../filter_spec.js';
|
|
2
|
+
import type { QueryBuilderLike } from '../lucid_adapter.js';
|
|
3
|
+
import type { FilterInput } from '../types.js';
|
|
4
|
+
/** One query-builder call a dry run recorded. */
|
|
5
|
+
export interface RecordedCall {
|
|
6
|
+
method: string;
|
|
7
|
+
args: unknown[];
|
|
8
|
+
}
|
|
9
|
+
/** What a request part (one filter, one sort…) does under the spec. */
|
|
10
|
+
export interface ExplainIssue {
|
|
11
|
+
part: 'filter' | 'sort' | 'distinct' | 'search' | 'size';
|
|
12
|
+
/** The field (or the raw value) the issue is about. */
|
|
13
|
+
subject: string;
|
|
14
|
+
message: string;
|
|
15
|
+
/** `rejected`: the request fails; `dropped`: silently ignored; `clamped`/`ignored`: adjusted. */
|
|
16
|
+
effect: 'rejected' | 'dropped' | 'clamped' | 'ignored';
|
|
17
|
+
}
|
|
18
|
+
/** The result of {@link explainFilterQuery}. */
|
|
19
|
+
export interface FilterQueryExplanation {
|
|
20
|
+
/** What the query string decodes to (`ctx.request.qs()`). */
|
|
21
|
+
decoded: Record<string, unknown>;
|
|
22
|
+
/** The filters, sorts, search and pagination the server reads from it. */
|
|
23
|
+
parsed: FilterInput;
|
|
24
|
+
/** `true` when the request would be refused (a 4xx from `InvalidColumnFilterError`). */
|
|
25
|
+
rejected: boolean;
|
|
26
|
+
rejection: string | null;
|
|
27
|
+
issues: ExplainIssue[];
|
|
28
|
+
/** The query-builder calls the request filters, search and sort produce (no tenant scope). */
|
|
29
|
+
calls: RecordedCall[];
|
|
30
|
+
pagination: {
|
|
31
|
+
page: number;
|
|
32
|
+
size: number;
|
|
33
|
+
} | null;
|
|
34
|
+
/** What the server adds on its own, outside the client's control. */
|
|
35
|
+
serverScope: {
|
|
36
|
+
tenantColumn: string | null;
|
|
37
|
+
defaultFilters: unknown[];
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* A query builder that records every call instead of running SQL: the dry-run target. Callback
|
|
42
|
+
* arguments (sub-queries, `whereHas`) are run against a nested recorder and kept as `calls`.
|
|
43
|
+
*/
|
|
44
|
+
export declare function recordingBuilder(calls?: RecordedCall[]): {
|
|
45
|
+
qb: QueryBuilderLike;
|
|
46
|
+
calls: RecordedCall[];
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Dry-run a query string against a spec, through the same parse, alias, validation, allow-list
|
|
50
|
+
* and builder code a request runs, with no database: what is kept, what is dropped or refused, and
|
|
51
|
+
* the builder calls it would make.
|
|
52
|
+
*/
|
|
53
|
+
export declare function explainFilterQuery(spec: FilterSpec, query: string): FilterQueryExplanation;
|
|
54
|
+
/** The spec as data: allow-lists with field types and operators, relations and defaults. */
|
|
55
|
+
export declare function describeSpec(spec: FilterSpec, name: string): {
|
|
56
|
+
name: string;
|
|
57
|
+
filterable: import("../filter_spec.js").RelationColumns;
|
|
58
|
+
sortable: import("../filter_spec.js").RelationColumns;
|
|
59
|
+
/** Every filterable path, relation-dotted (`'*'` lists contribute none). */
|
|
60
|
+
filterablePaths: string[];
|
|
61
|
+
sortablePaths: string[];
|
|
62
|
+
operators: import("../operators.js").FilterOperator[];
|
|
63
|
+
operatorAliases: {
|
|
64
|
+
[x: string]: import("../operators.js").FilterOperator;
|
|
65
|
+
};
|
|
66
|
+
searchable: string[];
|
|
67
|
+
fullText: {
|
|
68
|
+
column: string | readonly string[];
|
|
69
|
+
} | null;
|
|
70
|
+
fieldTypes: Readonly<Record<string, import("../generate_client.js").FilterFieldTypeInfo>>;
|
|
71
|
+
relations: Record<string, {
|
|
72
|
+
filterable: unknown;
|
|
73
|
+
sortable: unknown;
|
|
74
|
+
relations: unknown;
|
|
75
|
+
}>;
|
|
76
|
+
maxDepth: number;
|
|
77
|
+
aliases: import("../field_aliases.js").FieldAliases;
|
|
78
|
+
computed: {
|
|
79
|
+
[k: string]: string;
|
|
80
|
+
};
|
|
81
|
+
tenantColumn: string | null;
|
|
82
|
+
defaultFilters: unknown[];
|
|
83
|
+
defaultSort: import("../types.js").SortItem[];
|
|
84
|
+
defaultSize: number | null;
|
|
85
|
+
maxSize: number | null;
|
|
86
|
+
throwOnInvalid: boolean;
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=explain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"explain.d.ts","sourceRoot":"","sources":["../../../src/dev_tools/explain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGpD,OAAO,KAAK,EAAE,gBA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