@shivaedev/quality 0.57.1 → 0.58.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/CHANGELOG.md +21 -0
- package/README.md +11 -4
- package/dist/adapters/ImportAnalysisFailure.d.ts +10 -0
- package/dist/adapters/ImportAnalysisFailure.d.ts.map +1 -0
- package/dist/adapters/ImportAnalysisFailure.js +4 -0
- package/dist/adapters/ImportAnalysisFailure.js.map +1 -0
- package/dist/adapters/ImportCompiler.d.ts +2 -13
- package/dist/adapters/ImportCompiler.d.ts.map +1 -1
- package/dist/adapters/ImportCompiler.js +7 -13
- package/dist/adapters/ImportCompiler.js.map +1 -1
- package/dist/adapters/imports/analysisFailure.d.ts +3 -0
- package/dist/adapters/imports/analysisFailure.d.ts.map +1 -0
- package/dist/adapters/imports/analysisFailure.js +5 -0
- package/dist/adapters/imports/analysisFailure.js.map +1 -0
- package/dist/adapters/imports/analyzeDepartures.d.ts +5 -0
- package/dist/adapters/imports/analyzeDepartures.d.ts.map +1 -0
- package/dist/adapters/imports/analyzeDepartures.js +5 -0
- package/dist/adapters/imports/analyzeDepartures.js.map +1 -0
- package/dist/adapters/imports/analyzeGraph.d.ts +4 -0
- package/dist/adapters/imports/analyzeGraph.d.ts.map +1 -0
- package/dist/adapters/imports/analyzeGraph.js +6 -0
- package/dist/adapters/imports/analyzeGraph.js.map +1 -0
- package/dist/adapters/imports/checkBrowser.d.ts +4 -0
- package/dist/adapters/imports/checkBrowser.d.ts.map +1 -0
- package/dist/adapters/imports/checkBrowser.js +4 -0
- package/dist/adapters/imports/checkBrowser.js.map +1 -0
- package/dist/adapters/indirectServiceReferences.d.ts +3 -0
- package/dist/adapters/indirectServiceReferences.d.ts.map +1 -0
- package/dist/adapters/indirectServiceReferences.js +19 -0
- package/dist/adapters/indirectServiceReferences.js.map +1 -0
- package/dist/adapters/knip/entryPointFindings.d.ts +1 -1
- package/dist/adapters/knip/entryPointFindings.d.ts.map +1 -1
- package/dist/adapters/nativeTransactionFindings.d.ts +4 -0
- package/dist/adapters/nativeTransactionFindings.d.ts.map +1 -0
- package/dist/adapters/nativeTransactionFindings.js +98 -0
- package/dist/adapters/nativeTransactionFindings.js.map +1 -0
- package/dist/adapters/outsideImportFindings.d.ts +1 -1
- package/dist/adapters/outsideImportFindings.d.ts.map +1 -1
- package/dist/adapters/queueReadoutFindings.d.ts +1 -1
- package/dist/adapters/queueReadoutFindings.d.ts.map +1 -1
- package/dist/adapters/serviceAssemblyImports.d.ts +10 -0
- package/dist/adapters/serviceAssemblyImports.d.ts.map +1 -0
- package/dist/adapters/serviceAssemblyImports.js +71 -0
- package/dist/adapters/serviceAssemblyImports.js.map +1 -0
- package/dist/adapters/serviceAssemblySyntax.d.ts +10 -0
- package/dist/adapters/serviceAssemblySyntax.d.ts.map +1 -0
- package/dist/adapters/serviceAssemblySyntax.js +105 -0
- package/dist/adapters/serviceAssemblySyntax.js.map +1 -0
- package/dist/adapters/serviceDefinitionProblems.d.ts +7 -0
- package/dist/adapters/serviceDefinitionProblems.d.ts.map +1 -0
- package/dist/adapters/serviceDefinitionProblems.js +43 -0
- package/dist/adapters/serviceDefinitionProblems.js.map +1 -0
- package/dist/adapters/serviceIdFindings.d.ts.map +1 -1
- package/dist/adapters/serviceIdFindings.js +12 -7
- package/dist/adapters/serviceIdFindings.js.map +1 -1
- package/dist/adapters/transactionChanges.d.ts +3 -0
- package/dist/adapters/transactionChanges.d.ts.map +1 -0
- package/dist/adapters/transactionChanges.js +81 -0
- package/dist/adapters/transactionChanges.js.map +1 -0
- package/dist/imports/departures.d.ts +1 -1
- package/dist/imports/departures.d.ts.map +1 -1
- package/dist/imports/fences/check.d.ts +1 -1
- package/dist/imports/fences/check.d.ts.map +1 -1
- package/dist/imports/graph.d.ts +1 -1
- package/dist/imports/graph.d.ts.map +1 -1
- package/dist/rules/builtIn.d.ts +1 -1
- package/dist/rules/builtIn.d.ts.map +1 -1
- package/dist/rules/builtIn.js +4 -0
- package/dist/rules/builtIn.js.map +1 -1
- package/dist/rules/effect/serviceCatalog.d.ts +1 -1
- package/dist/rules/effect/serviceCatalog.d.ts.map +1 -1
- package/dist/rules/effect/serviceCatalog.js +4 -2
- package/dist/rules/effect/serviceCatalog.js.map +1 -1
- package/dist/rules/effect/serviceDefinitionAssembly.d.ts +2 -0
- package/dist/rules/effect/serviceDefinitionAssembly.d.ts.map +1 -0
- package/dist/rules/effect/serviceDefinitionAssembly.js +43 -0
- package/dist/rules/effect/serviceDefinitionAssembly.js.map +1 -0
- package/dist/rules/effect/serviceIds.js +1 -1
- package/dist/rules/effect/serviceIds.js.map +1 -1
- package/dist/rules/effect/serviceParameters.d.ts.map +1 -1
- package/dist/rules/effect/serviceParameters.js +12 -6
- package/dist/rules/effect/serviceParameters.js.map +1 -1
- package/dist/rules/effect/sqlTransact.d.ts +2 -0
- package/dist/rules/effect/sqlTransact.d.ts.map +1 -0
- package/dist/rules/effect/sqlTransact.js +9 -0
- package/dist/rules/effect/sqlTransact.js.map +1 -0
- package/dist/rules/stories/sources.d.ts +1 -1
- package/dist/rules/stories/sources.d.ts.map +1 -1
- package/dist/testing/adapters/cli.d.ts +2 -2
- package/dist/testing/adapters/cli.d.ts.map +1 -1
- package/dist/testing/adapters/cli.js +11 -14
- package/dist/testing/adapters/cli.js.map +1 -1
- package/dist/testing/adapters/git.d.ts +10 -0
- package/dist/testing/adapters/git.d.ts.map +1 -1
- package/dist/testing/adapters/git.js +6 -2
- package/dist/testing/adapters/git.js.map +1 -1
- package/dist/testing/adapters/hookRepository.d.ts.map +1 -1
- package/dist/testing/adapters/hookRepository.js +6 -2
- package/dist/testing/adapters/hookRepository.js.map +1 -1
- package/dist/testing/ruleStory.d.ts.map +1 -1
- package/dist/testing/ruleStory.js +1 -2
- package/dist/testing/ruleStory.js.map +1 -1
- package/package.json +5 -5
- package/src/adapters/ImportAnalysisFailure.ts +6 -0
- package/src/adapters/ImportCompiler.ts +7 -20
- package/src/adapters/imports/analysisFailure.ts +5 -0
- package/src/adapters/imports/analyzeDepartures.ts +9 -0
- package/src/adapters/imports/analyzeGraph.ts +9 -0
- package/src/adapters/imports/checkBrowser.ts +5 -0
- package/src/adapters/indirectServiceReferences.ts +25 -0
- package/src/adapters/nativeTransactionFindings.ts +108 -0
- package/src/adapters/outsideImportFindings.ts +1 -1
- package/src/adapters/serviceAssemblyImports.ts +93 -0
- package/src/adapters/serviceAssemblySyntax.ts +129 -0
- package/src/adapters/serviceDefinitionProblems.ts +63 -0
- package/src/adapters/serviceIdFindings.ts +16 -13
- package/src/adapters/transactionChanges.ts +85 -0
- package/src/rules/builtIn.ts +4 -0
- package/src/rules/effect/serviceCatalog.ts +4 -2
- package/src/rules/effect/serviceDefinitionAssembly.ts +46 -0
- package/src/rules/effect/serviceIds.ts +1 -1
- package/src/rules/effect/serviceParameters.ts +12 -6
- package/src/rules/effect/sqlTransact.ts +10 -0
- package/src/testing/adapters/cli.ts +22 -14
- package/src/testing/adapters/git.ts +7 -2
- package/src/testing/adapters/hookRepository.ts +6 -2
- package/src/testing/ruleStory.ts +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.58.0 - 2026-11-04
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Report native `sql.withTransaction` around repository writes or change announcements with `effect/sql-transact`, directing callers to begin the outer transaction with `transact(effect, { onSqlError })` before the unsupported composition runs. Native read-only and raw SQL transactions remain supported.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Quality fixtures use their own process lock for in-process commands, executable commands and git-hook checks.
|
|
12
|
+
|
|
13
|
+
### Breaking
|
|
14
|
+
|
|
15
|
+
- `runQuality` from `testing/adapters/cli.ts` returns an Effect that keeps the caller's clock and lifecycle. Replace `await runQuality(...)` and `Effect.promise(() => runQuality(...))` with `yield* runQuality(...)` inside an Effect. Quality story kits use the controlled test clock.
|
|
16
|
+
|
|
17
|
+
## 0.57.2 - 2026-11-03
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Read service-id prefixes and package ownership from workspace manifests, including nested consumer packages with their own npm scope.
|
|
22
|
+
- Discover service shapes in installed declarations from the consuming repository's package scopes as well as workspace sources.
|
|
23
|
+
|
|
3
24
|
## 0.57.1 - 2026-11-03
|
|
4
25
|
|
|
5
26
|
### Changed
|
package/README.md
CHANGED
|
@@ -66,7 +66,7 @@ ruleStory.it(
|
|
|
66
66
|
|
|
67
67
|
Seed a `quality.config.ts` that registers the custom rule to test the whole gate. `gate()` runs `quality lint`; `gateOutcome()` reads `passed`, `rejected` or `invalid`, and `gateReport()` reads its output. `writes(...)` changes fixture files and `removes(path)` deletes them. Use the kit’s `qualityInstalled()` trait when a fixture imports Quality or its tooling presets. It links the installed package into that fixture. The kit removes its temporary repository when the scope closes. Config imports are cached within the process, so use `quality` from `@shivaedev/quality/testing/adapters/cli.ts` to spawn a fresh command after changing a config.
|
|
68
68
|
|
|
69
|
-
For an existing kit, compose the lower-level helpers through its local test-support facade: `seedTree` and `removeSeededTrees` from `@shivaedev/quality/testing/adapters/tree.ts` manage fixture files; `scanned` and `findingsIn` from `@shivaedev/quality/testing/adapters/imports.ts` collect inventory and run a configured rule; `runQuality` from `@shivaedev/quality/testing/adapters/cli.ts` runs commands in process. These helpers use the same engine as the rule story kit.
|
|
69
|
+
For an existing kit, compose the lower-level helpers through its local test-support facade: `seedTree` and `removeSeededTrees` from `@shivaedev/quality/testing/adapters/tree.ts` manage fixture files; `scanned` and `findingsIn` from `@shivaedev/quality/testing/adapters/imports.ts` collect inventory and run a configured rule; `runQuality` from `@shivaedev/quality/testing/adapters/cli.ts` runs commands in process. Yield `runQuality(root, "lint")` as an Effect in the kit so it uses the story's controlled clock. These helpers use the same engine as the rule story kit.
|
|
70
70
|
|
|
71
71
|
### Effect boundaries and services
|
|
72
72
|
|
|
@@ -80,7 +80,7 @@ Only folders named `adapters/` or `test-support/`, at any depth, are exempt from
|
|
|
80
80
|
|
|
81
81
|
The `ambient-runtime` Biome plugin also reports `Effect.run*` calls whose computation contains `Clock`, `Config` or `Random`, `currentTimeMillisUnsafe`, crypto UUIDs and bytes, `performance.now`, process arguments, working directory and exit state, `globalThis.process.env`, timeouts and microtasks. Yield service computations in the caller's Effect so its environment controls them. These additional checks apply to core TypeScript code. They accept `cli.ts`, `main.ts(x)`, `entry.ts(x)`, `*-cli.ts`, modules that call `runMain`, use `NodeRuntime.runMain` or guard execution with `fileURLToPath(import.meta.url) === process.argv[1]`, tool configs, tests, `adapters/` and `test-support/`. The existing `Date.now()`, `new Date()`, `Math.random()`, console and direct `process.env` bans still apply there.
|
|
82
82
|
|
|
83
|
-
`effect/service-parameters` reports parameters carrying a service in exported functions and public methods, including returned factories. It follows service classes and tags, non-empty Contexts and service implementation shapes through aliases, interfaces, generic constraints, inferred parameters and destructuring. Read services from Effect's environment instead. An Effect or Stream requiring a service is a computation and is accepted. Methods implementing a service and functions constructing Layers may take services as parameters. Only `test-support/` folders are exempt from this rule; `adapters/` folders are checked.
|
|
83
|
+
`effect/service-parameters` reports parameters carrying a service in exported functions and public methods, including returned factories. It follows service classes and tags, non-empty Contexts and service implementation shapes through aliases, interfaces, generic constraints, inferred parameters and destructuring. Read services from Effect's environment instead. An Effect or Stream requiring a service is a computation and is accepted. Methods implementing a service and functions constructing Layers may take services as parameters. Only `test-support/` folders are exempt from this rule; `adapters/` folders are checked. Installed implementation shapes are discovered in the consuming repository's package scopes, alongside the framework service package's scope.
|
|
84
84
|
|
|
85
85
|
Both rules refuse config exceptions and inline suppressions. Record existing debt with `quality baseline write --rule effect/boundary --file src/legacy.ts` and `quality baseline write --rule effect/service-parameters --file src/legacy.ts`; the normal report and baseline burn-down apply.
|
|
86
86
|
|
|
@@ -88,9 +88,15 @@ When an upgrade expands these checks, inspect the new findings, repair the small
|
|
|
88
88
|
|
|
89
89
|
### Package service ids
|
|
90
90
|
|
|
91
|
-
`effect/service-ids` checks literal ids passed to `Context.Service`, `Context.Reference`, `defineService` and RPC middleware `Service` or `Tag` constructors in `packages
|
|
91
|
+
`effect/service-ids` checks literal ids passed to `Context.Service`, `Context.Reference`, `defineService` and RPC middleware `Service` or `Tag` constructors in workspace packages under `packages/`. Each id must start with the owning package manifest's `name`, including a trailing slash. The workspace declarations identify package folders, and the deepest matching folder owns a source file. For example, `packages/group/domain/package.json` named `@antumbra/domain` uses `@antumbra/domain/Store`. Prefix a reported id with its owning package and update any references to that id.
|
|
92
92
|
|
|
93
|
-
Import and local aliases, string literals and templates without substitutions are checked, including in adapters and tests. Computed ids and files outside `packages/` are left alone. This rule refuses config exceptions and inline suppressions.
|
|
93
|
+
Import and local aliases, string literals and templates without substitutions are checked, including in adapters and tests. Computed ids, files without a named workspace owner and files outside `packages/` are left alone. This rule refuses config exceptions and inline suppressions.
|
|
94
|
+
|
|
95
|
+
### Service assemblies
|
|
96
|
+
|
|
97
|
+
`effect/service-definition-assembly` keeps top-level `defineService` declarations as operation inventories. List `id`, `requires`, `initialize` and `methods` directly. Import a named initializer Effect or use `Effect.void`; the methods arrow returns a literal record of imported named operations or calls to imported state factories. `genericMethod` can wrap either form. Keep implementation bodies in focused files outside the assembly. Quality's existing Biome checks own `Effect.fn` span names.
|
|
98
|
+
|
|
99
|
+
The rule reports hidden configurations and method records, configuration and operation spreads, computed members, local implementations and inline bodies, including in adapters and tests. It takes no config exceptions or inline suppressions. See the [service guide](https://github.com/ShivaeDev/platform/tree/main/packages/service#1-assemble-the-service-from-focused-files) for the shape.
|
|
94
100
|
|
|
95
101
|
### Outside library imports
|
|
96
102
|
|
|
@@ -348,6 +354,7 @@ For adoption, run `quality baseline write --rule code/unused --file src/legacy.t
|
|
|
348
354
|
- **Imports:** cycles, unresolvable imports, workspace imports missing from the manifest or an entry point, relative imports that leave their folder (except a module’s client or server `registration.ts` or `registration.tsx` importing its own `./admin/` subtree), production imports of test code, runtime folders and fences, as described above.
|
|
349
355
|
- **Names and files:** the Biome preset's naming rules and plugins, and the `files/*` rules, which name a file after its main export with its folders as the prefix. `files/named-after-export` accepts a file named after its single exported constant, such as `liveQueryWindow.ts` exporting `const liveQueryWindow`. It keeps the export’s full name while the file name omits words already supplied by any folder above it. In `spaces/client/`, a component exporting `CreateSpace` lives in `Create.tsx`: `spaces/` supplies “Space” even across the intervening `client/` folder. Keep the export named `CreateSpace`; `CreateSpace.tsx` would repeat a folder name. Inside a module’s `client/admin/` or `server/admin/` subtree, file names may repeat words from above `admin/`: `src/modules/inbox/client/admin/inboxRoutes.ts` may export `inboxRoutes`. Names must still match their exports and omit words repeated by folders within the admin subtree. No naming rule renames anything; the author picks the name. A name an outside system owns, such as a query parameter or an environment variable, is written as a quoted key, which the naming rules skip. A `Schema.Struct` field stays camelCase even when quoted and maps to the outside name with `Schema.encodeKeys`. Biome's naming messages print only a pattern: spell acronyms as words (`HttpClient`, `userId`, `parseUrl`) rather than turning off `strictCase` as its hint suggests, give a type no `I` prefix, and name a type parameter `T`, `T` plus a PascalCase name (`TItem`), or Effect's `A`, `E` and `R`. No rule checks these, so review does: a boolean reads as a question (`isOpen`, `canRetry`) unless the DOM or React names it (`open`, `disabled`); a schema shares its name with its type (`type Item = typeof Item.Type`); an unused parameter is removed rather than renamed with the `_` prefix TypeScript accepts. The naming rules take repository facts: `toolOwned` lists `.gitignore` patterns whose names a tool fixes, and a configured list extends the rule's defaults, so list only repository-specific additions; `content` lists snake_case content folders and files; `tests/follow` and `tests/colocated` take `suites` for test folders with their own layout, such as a Playwright suite.
|
|
350
356
|
- **Change keys:** `boundaries/imported-change-keys` reports literal collection and bucket names in Reactivity invalidations and mutations, SQL `invalidateOnCommit`, and the `changes` key encoders. Import the owning declaration and use its name, list, item or bucket key. Literal record IDs and bucket values are accepted, as are names at their collection declaration.
|
|
357
|
+
- **SQL transactions:** `effect/sql-transact` reports native `sql.withTransaction` calls around repository writes, `transact` or `invalidateOnCommit`. Begin the outer transaction with `transact(effect, { onSqlError })` so changed keys follow its commit. The rule resolves native SQL and repository declarations and follows direct calls, pipes, local aliases and source helpers. Native read-only and raw SQL transactions and unrelated transaction methods remain supported.
|
|
351
358
|
- **React:** `react/jsx-conditionals` reports `&&` and ternaries in the JSX children a component returns, including nested decisions and returned `.map` items. Decisions in a `const` above the return, JSX built inside library callbacks and conditional attributes are accepted. A ternary with two plain string or number literal branches, such as `{on ? "On" : "Off"}`, is accepted; branches that select JSX, components or computed values still need a decision before the JSX. This rule owns the check, so the shared Biome preset leaves `noLeakedRender` off.
|
|
352
359
|
- **Tests:** `tests/follow` and `tests/colocated` keep a test beside the code it covers, named `<file>[.<modifier>].test.ts` or `<behaviour>[.<modifier>].spec.ts` with at most one modifier of `dom`, `slow`, `typecheck` and `unit`; a unit test runs without the DOM, so `.unit.dom` is rejected. `tests/colocated` always treats `__tests__/` as a test folder. It treats `test/`, `tests/` and `spec/` as test folders only when their directly contained checked files are all tests or test support; a product folder with source beside its specs is an ordinary source folder. Declared `suites` keep their own layout. Shared test support belongs in `test-support/`, the sanctioned test-only folder. A test covering a whole module may sit at its root or directly beside its folder. The story rules above keep setup in the kit.
|
|
353
360
|
- **Manifests:** `manifests/valid` decodes every repository `package.json` through one shared Schema before dependent rules run and reports each invalid manifest once with its file path. An unreadable manifest or one removed after discovery becomes a `manifests/valid` finding. Optional lookups still treat `NotFound` as absence. `manifests/sorted` keeps every `package.json` in sort-package-json order, and `manifests/source-first` puts the `source` condition first in `exports` and `imports`. `manifests/exports-shape` checks the package root and workspace members. They use one file-preserving TypeScript wildcard: for example, `./*.ts` maps to `./src/*.ts`, `./dist/*.d.ts` and `./dist/*.js` under `source`, `types` and `default`. A subtree pattern such as `./server/*.ts` keeps that same subtree in its targets. An optional root entry and exact-path non-code assets such as JSON presets and `./package.json` are allowed. Every module remains importable; `null` export entries fail with a request to remove the block. A package without modules, such as a dependency shell, exports only exact assets and needs no wildcard. Import each module at its path under `src/`; named aliases, flattened paths, per-file module lists and additional wildcards fail. When declared, the standard imports must preserve their roots: `#*.ts` maps directly to `./src/*.ts` or uses source `./src/*.ts`, types `./dist/*.d.ts` and default `./dist/*.js`; `#test/*` maps to `./src/test-support/*`. Include subfolders in specifiers, such as `#server/module.ts`. Other aliases are allowed. `manifests/application` keeps an application on its entry points, as described above.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare const ImportAnalysisFailure_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
2
|
+
readonly _tag: "ImportAnalysisFailure";
|
|
3
|
+
} & Readonly<A>;
|
|
4
|
+
export declare class ImportAnalysisFailure extends ImportAnalysisFailure_base<{
|
|
5
|
+
readonly message: string;
|
|
6
|
+
readonly root: string;
|
|
7
|
+
}> {
|
|
8
|
+
}
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=ImportAnalysisFailure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportAnalysisFailure.d.ts","sourceRoot":"","sources":["../../src/adapters/ImportAnalysisFailure.ts"],"names":[],"mappings":";;;AAEA,qBAAa,qBAAsB,SAAQ,2BAA0C;IACpF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB,CAAC;CAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImportAnalysisFailure.js","sourceRoot":"","sources":["../../src/adapters/ImportAnalysisFailure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,OAAO,qBAAsB,SAAQ,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAGjF;CAAG"}
|
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import type ts from "typescript";
|
|
3
|
-
import type { WorkspacePackage } from "#imports/workspace.ts";
|
|
4
|
-
import type { RuleInputs } from "#rule.ts";
|
|
5
|
-
declare const ImportAnalysisFailure_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
6
|
-
readonly _tag: "ImportAnalysisFailure";
|
|
7
|
-
} & Readonly<A>;
|
|
8
|
-
export declare class ImportAnalysisFailure extends ImportAnalysisFailure_base<{
|
|
9
|
-
readonly message: string;
|
|
10
|
-
readonly root: string;
|
|
11
|
-
}> {
|
|
12
|
-
}
|
|
13
3
|
export declare const ImportCompiler: import("effect/Context").Service<"@shivaedev/quality/ImportCompiler", Readonly<{
|
|
14
4
|
readonly browserChecker: (source: ts.SourceFile) => Effect.Effect<ts.TypeChecker, never, never>;
|
|
15
|
-
readonly departures: (inputs: RuleInputs, packages: readonly WorkspacePackage[]) => Effect.Effect<readonly import("../imports/departures.ts").Departure[], ImportAnalysisFailure, never>;
|
|
16
|
-
readonly graph: (inputs: RuleInputs) => Effect.Effect<Pick<import("../imports/graph.ts").ImportGraph, "configFindings" | "edges" | "modules" | "unresolved">, ImportAnalysisFailure, never>;
|
|
5
|
+
readonly departures: (inputs: import("../rule.ts").RuleInputs, packages: readonly import("../imports/workspace.ts").WorkspacePackage[]) => Effect.Effect<readonly import("../imports/departures.ts").Departure[], import("./ImportAnalysisFailure.ts").ImportAnalysisFailure, never>;
|
|
6
|
+
readonly graph: (inputs: import("../rule.ts").RuleInputs) => Effect.Effect<Pick<import("../imports/graph.ts").ImportGraph, "configFindings" | "edges" | "modules" | "unresolved">, import("./ImportAnalysisFailure.ts").ImportAnalysisFailure, never>;
|
|
17
7
|
}>> & {
|
|
18
8
|
readonly layer: import("effect/Layer").Layer<"@shivaedev/quality/ImportCompiler", never, never>;
|
|
19
9
|
};
|
|
20
|
-
export {};
|
|
21
10
|
//# sourceMappingURL=ImportCompiler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImportCompiler.d.ts","sourceRoot":"","sources":["../../src/adapters/ImportCompiler.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ImportCompiler.d.ts","sourceRoot":"","sources":["../../src/adapters/ImportCompiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAMjC,eAAO,MAAM,cAAc;;;;;;CASzB,CAAC"}
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Data, Effect } from "effect";
|
|
1
|
+
import { Effect } from "effect";
|
|
3
2
|
import { defineService } from "@shivaedev/service/defineService.ts";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
export class ImportAnalysisFailure extends Data.TaggedError("ImportAnalysisFailure") {
|
|
8
|
-
}
|
|
9
|
-
function failure(root, cause) {
|
|
10
|
-
return new ImportAnalysisFailure({ message: `Cannot analyze imports in ${root}: ${cause instanceof Error ? cause.message : String(cause)}`, root });
|
|
11
|
-
}
|
|
3
|
+
import { analyzeDepartures } from "#adapters/imports/analyzeDepartures.ts";
|
|
4
|
+
import { analyzeGraph } from "#adapters/imports/analyzeGraph.ts";
|
|
5
|
+
import { checkBrowser } from "#adapters/imports/checkBrowser.ts";
|
|
12
6
|
export const ImportCompiler = defineService({
|
|
13
7
|
id: "@shivaedev/quality/ImportCompiler",
|
|
14
8
|
initialize: Effect.void,
|
|
15
9
|
methods: () => ({
|
|
16
|
-
browserChecker:
|
|
17
|
-
departures:
|
|
18
|
-
graph:
|
|
10
|
+
browserChecker: checkBrowser,
|
|
11
|
+
departures: analyzeDepartures,
|
|
12
|
+
graph: analyzeGraph,
|
|
19
13
|
}),
|
|
20
14
|
requires: [],
|
|
21
15
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImportCompiler.js","sourceRoot":"","sources":["../../src/adapters/ImportCompiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ImportCompiler.js","sourceRoot":"","sources":["../../src/adapters/ImportCompiler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;IAC3C,EAAE,EAAE,mCAAmC;IACvC,UAAU,EAAE,MAAM,CAAC,IAAI;IACvB,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC;QACf,cAAc,EAAE,YAA+E;QAC/F,UAAU,EAAE,iBAAiB;QAC7B,KAAK,EAAE,YAAY;KACnB,CAAC;IACF,QAAQ,EAAE,EAAE;CACZ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analysisFailure.d.ts","sourceRoot":"","sources":["../../../src/adapters/imports/analysisFailure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,qBAAqB,CAEnF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ImportAnalysisFailure } from "#adapters/ImportAnalysisFailure.ts";
|
|
2
|
+
export function analysisFailure(root, cause) {
|
|
3
|
+
return new ImportAnalysisFailure({ message: `Cannot analyze imports in ${root}: ${cause instanceof Error ? cause.message : String(cause)}`, root });
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=analysisFailure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analysisFailure.js","sourceRoot":"","sources":["../../../src/adapters/imports/analysisFailure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAE3E,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,KAAc;IAC3D,OAAO,IAAI,qBAAqB,CAAC,EAAE,OAAO,EAAE,6BAA6B,IAAI,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;AACrJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { WorkspacePackage } from "#imports/workspace.ts";
|
|
3
|
+
import type { RuleInputs } from "#rule.ts";
|
|
4
|
+
export declare const analyzeDepartures: (inputs: RuleInputs, packages: readonly WorkspacePackage[]) => Effect.Effect<readonly import("../../imports/departures.ts").Departure[], import("../ImportAnalysisFailure.ts").ImportAnalysisFailure, never>;
|
|
5
|
+
//# sourceMappingURL=analyzeDepartures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzeDepartures.d.ts","sourceRoot":"","sources":["../../../src/adapters/imports/analyzeDepartures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C,eAAO,MAAM,iBAAiB,8MAE7B,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { analysisFailure } from "./analysisFailure.js";
|
|
3
|
+
import { departures } from "./departures.js";
|
|
4
|
+
export const analyzeDepartures = Effect.fn("ImportCompiler.analyzeDepartures")((inputs, packages) => Effect.try({ catch: (cause) => analysisFailure(inputs.root, cause), try: () => departures(inputs, packages) }));
|
|
5
|
+
//# sourceMappingURL=analyzeDepartures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzeDepartures.js","sourceRoot":"","sources":["../../../src/adapters/imports/analyzeDepartures.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,EAAE,CAAC,kCAAkC,CAAC,CAAC,CAAC,MAAkB,EAAE,QAAqC,EAAE,EAAE,CAC5I,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,CAC9G,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { RuleInputs } from "#rule.ts";
|
|
3
|
+
export declare const analyzeGraph: (inputs: RuleInputs) => Effect.Effect<Pick<import("../../imports/graph.ts").ImportGraph, "configFindings" | "edges" | "modules" | "unresolved">, import("../ImportAnalysisFailure.ts").ImportAnalysisFailure, never>;
|
|
4
|
+
//# sourceMappingURL=analyzeGraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzeGraph.d.ts","sourceRoot":"","sources":["../../../src/adapters/imports/analyzeGraph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAI3C,eAAO,MAAM,YAAY,sNAExB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { realpathSync } from "node:fs";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { analysisFailure } from "./analysisFailure.js";
|
|
4
|
+
import { graph } from "./graph.js";
|
|
5
|
+
export const analyzeGraph = Effect.fn("ImportCompiler.analyzeGraph")((inputs) => Effect.try({ catch: (cause) => analysisFailure(inputs.root, cause), try: () => graph(inputs, realpathSync(inputs.root)) }));
|
|
6
|
+
//# sourceMappingURL=analyzeGraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analyzeGraph.js","sourceRoot":"","sources":["../../../src/adapters/imports/analyzeGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,EAAE,CAAC,6BAA6B,CAAC,CAAC,CAAC,MAAkB,EAAE,EAAE,CAC3F,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAC1H,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkBrowser.d.ts","sourceRoot":"","sources":["../../../src/adapters/imports/checkBrowser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AAGjC,eAAO,MAAM,YAAY,wEAAiH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkBrowser.js","sourceRoot":"","sources":["../../../src/adapters/imports/checkBrowser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,EAAE,CAAC,6BAA6B,CAAC,CAAC,CAAC,MAAqB,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indirectServiceReferences.d.ts","sourceRoot":"","sources":["../../src/adapters/indirectServiceReferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,wBAAgB,yBAAyB,CACxC,MAAM,EAAE,EAAE,CAAC,UAAU,EACrB,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAC1B,WAAW,EAAE,SAAS,EAAE,CAAC,cAAc,EAAE,GACvC,SAAS,EAAE,CAAC,IAAI,EAAE,CAiBpB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
import { unwrapExpression } from "#adapters/serviceAssemblySyntax.ts";
|
|
3
|
+
export function indirectServiceReferences(source, names, definitions) {
|
|
4
|
+
const direct = new Set(definitions.map((definition) => unwrapExpression(definition.expression)));
|
|
5
|
+
const found = [];
|
|
6
|
+
function visit(node) {
|
|
7
|
+
if (ts.isIdentifier(node)
|
|
8
|
+
&& names.has(node.text)
|
|
9
|
+
&& !direct.has(node)
|
|
10
|
+
&& !ts.isImportSpecifier(node.parent)
|
|
11
|
+
&& !ts.isPropertyAccessExpression(node.parent)) {
|
|
12
|
+
found.push(node);
|
|
13
|
+
}
|
|
14
|
+
ts.forEachChild(node, visit);
|
|
15
|
+
}
|
|
16
|
+
visit(source);
|
|
17
|
+
return found;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=indirectServiceReferences.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indirectServiceReferences.js","sourceRoot":"","sources":["../../src/adapters/indirectServiceReferences.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE,MAAM,UAAU,yBAAyB,CACxC,MAAqB,EACrB,KAA0B,EAC1B,WAAyC;IAEzC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,gBAAgB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IACjG,MAAM,KAAK,GAAc,EAAE,CAAC;IAC5B,SAAS,KAAK,CAAC,IAAa;QAC3B,IACC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC;eAClB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;eACpB,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;eACjB,CAAC,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC;eAClC,CAAC,EAAE,CAAC,0BAA0B,CAAC,IAAI,CAAC,MAAM,CAAC,EAC7C,CAAC;YACF,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAClB,CAAC;QACD,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC9B,CAAC;IACD,KAAK,CAAC,MAAM,CAAC,CAAC;IACd,OAAO,KAAK,CAAC;AACd,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import type { Findings, RuleInputs } from "#rule.ts";
|
|
3
|
-
export declare const entryPointFindings: (inputs: RuleInputs, findings: Findings) => Effect.Effect<import("#rule.ts").Finding[], import("../
|
|
3
|
+
export declare const entryPointFindings: (inputs: RuleInputs, findings: Findings) => Effect.Effect<import("#rule.ts").Finding[], import("../ImportAnalysisFailure.ts").ImportAnalysisFailure, never>;
|
|
4
4
|
//# sourceMappingURL=entryPointFindings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entryPointFindings.d.ts","sourceRoot":"","sources":["../../../src/adapters/knip/entryPointFindings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAUhC,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAOrD,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"entryPointFindings.d.ts","sourceRoot":"","sources":["../../../src/adapters/knip/entryPointFindings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAUhC,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAOrD,eAAO,MAAM,kBAAkB,6JA2D7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeTransactionFindings.d.ts","sourceRoot":"","sources":["../../src/adapters/nativeTransactionFindings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAyFpD,eAAO,MAAM,yBAAyB,gEAerC,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
import { effectProgram } from "#rules/effect/program.ts";
|
|
5
|
+
import { parse } from "#rules/parse.ts";
|
|
6
|
+
import { memberName, nodesWhere, unwrapped } from "#rules/stories/syntax.ts";
|
|
7
|
+
import { transactionChanges } from "./transactionChanges.js";
|
|
8
|
+
function candidates(source) {
|
|
9
|
+
const aliases = new Set(["withTransaction"]);
|
|
10
|
+
for (const node of nodesWhere(source, (candidate) => ts.isVariableDeclaration(candidate) || ts.isBindingElement(candidate))) {
|
|
11
|
+
if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer !== undefined) {
|
|
12
|
+
const value = unwrapped(node.initializer);
|
|
13
|
+
if (memberName(value) === "withTransaction" || (ts.isIdentifier(value) && aliases.has(value.text))) {
|
|
14
|
+
aliases.add(node.name.text);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
if (ts.isBindingElement(node) && node.propertyName?.getText() === "withTransaction" && ts.isIdentifier(node.name)) {
|
|
18
|
+
aliases.add(node.name.text);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function reference(expression) {
|
|
22
|
+
const value = unwrapped(expression);
|
|
23
|
+
return memberName(value) === "withTransaction" || (ts.isIdentifier(value) && aliases.has(value.text));
|
|
24
|
+
}
|
|
25
|
+
return nodesWhere(source, (node) => ts.isCallExpression(node) && (reference(node.expression) || node.arguments.some(reference)));
|
|
26
|
+
}
|
|
27
|
+
function nativeTransaction(checker, expression) {
|
|
28
|
+
const value = unwrapped(expression);
|
|
29
|
+
if (!ts.isIdentifier(value) && memberName(value) !== "withTransaction") {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
const signature = checker.getTypeAtLocation(value).getCallSignatures()[0];
|
|
33
|
+
const declaration = signature?.getDeclaration();
|
|
34
|
+
if (declaration === undefined) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
const path = declaration.getSourceFile().fileName.replaceAll("\\", "/");
|
|
38
|
+
return (/\/effect\/(?:src|dist(?:\/dts)?)\/sql\/SqlClient\.(?:d\.)?ts$/u.test(path)
|
|
39
|
+
&& ts.isPropertySignature(declaration.parent)
|
|
40
|
+
&& declaration.parent.name.getText() === "withTransaction");
|
|
41
|
+
}
|
|
42
|
+
function changedBodies(checker, call) {
|
|
43
|
+
if (nativeTransaction(checker, call.expression)) {
|
|
44
|
+
return call.arguments.slice(0, 1);
|
|
45
|
+
}
|
|
46
|
+
const callee = unwrapped(call.expression);
|
|
47
|
+
const index = call.arguments.findIndex((argument) => nativeTransaction(checker, argument));
|
|
48
|
+
if (index < 0) {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
if (ts.isPropertyAccessExpression(callee) && callee.name.text === "pipe") {
|
|
52
|
+
return [callee.expression, ...call.arguments.slice(0, index)];
|
|
53
|
+
}
|
|
54
|
+
const declaration = checker.getResolvedSignature(call)?.getDeclaration();
|
|
55
|
+
return declaration !== undefined && /\/effect\/(?:src|dist(?:\/dts)?)\/Function\.(?:d\.)?ts$/u.test(declaration.getSourceFile().fileName)
|
|
56
|
+
? call.arguments.slice(0, index)
|
|
57
|
+
: [];
|
|
58
|
+
}
|
|
59
|
+
function findingsIn(inputs) {
|
|
60
|
+
const program = effectProgram(inputs);
|
|
61
|
+
const checker = program.getTypeChecker();
|
|
62
|
+
return inputs.sources.flatMap((file) => {
|
|
63
|
+
const source = program.getSourceFile(join(inputs.root, file.path));
|
|
64
|
+
if (source === undefined) {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
return candidates(source).flatMap((node) => {
|
|
68
|
+
if (!ts.isCallExpression(node)) {
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
if (!changedBodies(checker, node).some((body) => transactionChanges(checker, body))) {
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
return [
|
|
75
|
+
{
|
|
76
|
+
file: file.path,
|
|
77
|
+
line: source.getLineAndCharacterOfPosition(node.getStart(source)).line + 1,
|
|
78
|
+
message: "Uses native sql.withTransaction around repository writes or change announcements. Begin the outer transaction with transact(effect, { onSqlError }) so changed keys follow its commit.",
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export const nativeTransactionFindings = Effect.fn("NativeTransactions.nativeTransactionFindings")((inputs) => Effect.sync(() => {
|
|
85
|
+
const groups = new Map();
|
|
86
|
+
for (const source of inputs.sources) {
|
|
87
|
+
const syntax = source.text.includes("withTransaction") ? parse(source) : undefined;
|
|
88
|
+
if (syntax === undefined || candidates(syntax).length === 0) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const group = /^(?:packages|examples)\/[^/]+/u.exec(source.path)?.[0] ?? ".";
|
|
92
|
+
const sources = groups.get(group) ?? [];
|
|
93
|
+
sources.push(source);
|
|
94
|
+
groups.set(group, sources);
|
|
95
|
+
}
|
|
96
|
+
return [...groups.values()].flatMap((sources) => findingsIn({ ...inputs, sources }));
|
|
97
|
+
}));
|
|
98
|
+
//# sourceMappingURL=nativeTransactionFindings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeTransactionFindings.js","sourceRoot":"","sources":["../../src/adapters/nativeTransactionFindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,SAAS,UAAU,CAAC,MAAqB;IACxC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC;IA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CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC;QAC7E,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QACxC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrB,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC5B,CAAC;IACD,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AACtF,CAAC,CAAC,CACF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import type { ImportAnalysisFailure } from "#adapters/
|
|
2
|
+
import type { ImportAnalysisFailure } from "#adapters/ImportAnalysisFailure.ts";
|
|
3
3
|
import type { Finding, RuleInputs } from "#rule.ts";
|
|
4
4
|
export declare const outsideImportFindings: (inputs: RuleInputs) => Effect.Effect<readonly Finding[], ImportAnalysisFailure, never>;
|
|
5
5
|
//# sourceMappingURL=outsideImportFindings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outsideImportFindings.d.ts","sourceRoot":"","sources":["../../src/adapters/outsideImportFindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"outsideImportFindings.d.ts","sourceRoot":"","sources":["../../src/adapters/outsideImportFindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAKhF,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AA2CpD,eAAO,MAAM,qBAAqB,yFA+ChC,CAAC"}
|
|
@@ -4,5 +4,5 @@ export declare const queueReadoutFindings: (inputs: RuleInputs) => Effect.Effect
|
|
|
4
4
|
file: string;
|
|
5
5
|
line: number;
|
|
6
6
|
message: string;
|
|
7
|
-
}[], import("./
|
|
7
|
+
}[], import("./ImportAnalysisFailure.ts").ImportAnalysisFailure, never>;
|
|
8
8
|
//# sourceMappingURL=queueReadoutFindings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queueReadoutFindings.d.ts","sourceRoot":"","sources":["../../src/adapters/queueReadoutFindings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAS3C,eAAO,MAAM,oBAAoB;;;;
|
|
1
|
+
{"version":3,"file":"queueReadoutFindings.d.ts","sourceRoot":"","sources":["../../src/adapters/queueReadoutFindings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAS3C,eAAO,MAAM,oBAAoB;;;;uEAqB/B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
export interface ServiceAssemblyImports {
|
|
3
|
+
readonly definitions: ReadonlySet<string>;
|
|
4
|
+
readonly effects: ReadonlySet<string>;
|
|
5
|
+
readonly generics: ReadonlySet<string>;
|
|
6
|
+
readonly unsupported: readonly ts.Node[];
|
|
7
|
+
readonly values: ReadonlySet<string>;
|
|
8
|
+
}
|
|
9
|
+
export declare function serviceAssemblyImports(source: ts.SourceFile): ServiceAssemblyImports;
|
|
10
|
+
//# sourceMappingURL=serviceAssemblyImports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceAssemblyImports.d.ts","sourceRoot":"","sources":["../../src/adapters/serviceAssemblyImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,QAAQ,CAAC,WAAW,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,CAAC;IACzC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACrC;AA2DD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,GAAG,sBAAsB,CAyBpF"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
function importedNames(clause, name) {
|
|
3
|
+
const bindings = clause.namedBindings;
|
|
4
|
+
if (bindings === undefined || !ts.isNamedImports(bindings)) {
|
|
5
|
+
return [];
|
|
6
|
+
}
|
|
7
|
+
return bindings.elements.flatMap((element) => !element.isTypeOnly && (element.propertyName?.text ?? element.name.text) === name ? [element.name.text] : []);
|
|
8
|
+
}
|
|
9
|
+
function valueImport(statement) {
|
|
10
|
+
if (!(ts.isImportDeclaration(statement) && ts.isStringLiteral(statement.moduleSpecifier))
|
|
11
|
+
|| statement.importClause === undefined
|
|
12
|
+
|| statement.importClause.isTypeOnly) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
clause: statement.importClause,
|
|
17
|
+
module: statement.moduleSpecifier.text,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function collectDefinitionImport(clause, definitions, unsupported) {
|
|
21
|
+
if (clause.namedBindings !== undefined && ts.isNamespaceImport(clause.namedBindings)) {
|
|
22
|
+
unsupported.push(clause.namedBindings);
|
|
23
|
+
}
|
|
24
|
+
for (const name of importedNames(clause, "defineService")) {
|
|
25
|
+
definitions.add(name);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function collectValueImports(clause, values) {
|
|
29
|
+
if (clause.namedBindings === undefined || !ts.isNamedImports(clause.namedBindings)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
for (const element of clause.namedBindings.elements) {
|
|
33
|
+
if (!element.isTypeOnly) {
|
|
34
|
+
values.add(element.name.text);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function effectNames(clause, module) {
|
|
39
|
+
if (module === "effect") {
|
|
40
|
+
return importedNames(clause, "Effect");
|
|
41
|
+
}
|
|
42
|
+
const bindings = clause.namedBindings;
|
|
43
|
+
return module === "effect/Effect" && bindings !== undefined && ts.isNamespaceImport(bindings) ? [bindings.name.text] : [];
|
|
44
|
+
}
|
|
45
|
+
export function serviceAssemblyImports(source) {
|
|
46
|
+
const definitions = new Set();
|
|
47
|
+
const effects = new Set();
|
|
48
|
+
const generics = new Set();
|
|
49
|
+
const unsupported = [];
|
|
50
|
+
const values = new Set();
|
|
51
|
+
for (const statement of source.statements) {
|
|
52
|
+
const imported = valueImport(statement);
|
|
53
|
+
if (imported === undefined) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
collectValueImports(imported.clause, values);
|
|
57
|
+
if (imported.module === "@shivaedev/service/defineService.ts") {
|
|
58
|
+
collectDefinitionImport(imported.clause, definitions, unsupported);
|
|
59
|
+
}
|
|
60
|
+
if (imported.module === "@shivaedev/service/genericMethod.ts") {
|
|
61
|
+
for (const name of importedNames(imported.clause, "genericMethod")) {
|
|
62
|
+
generics.add(name);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
for (const name of effectNames(imported.clause, imported.module)) {
|
|
66
|
+
effects.add(name);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return { definitions, effects, generics, unsupported, values };
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=serviceAssemblyImports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceAssemblyImports.js","sourceRoot":"","sources":["../../src/adapters/serviceAssemblyImports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAU5B,SAAS,aAAa,CAAC,MAAuB,EAAE,IAAY;IAC3D,MAAM,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAC;IACtC,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5D,OAAO,EAAE,CAAC;IACX,CAAC;IACD,OAAO,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC5C,CAAC,OAAO,CAAC,UAAU,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAC5G,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,SAAuB;IAM3C,IACC,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,eAAe,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;WAClF,SAAS,CAAC,YAAY,KAAK,SAAS;WACpC,SAAS,CAAC,YAAY,CAAC,UAAU,EACnC,CAAC;QACF,OAAO;IACR,CAAC;IACD,OAAO;QACN,MAAM,EAAE,SAAS,CAAC,YAAY;QAC9B,MAAM,EAAE,SAAS,CAAC,eAAe,CAAC,IAAI;KACtC,CAAC;AACH,CAAC;AAED,SAAS,uBAAuB,CAAC,MAAuB,EAAE,WAAwB,EAAE,WAAsB;IACzG,IAAI,MAAM,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OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAClC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAC;IACnC,MAAM,WAAW,GAAc,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IACjC,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;QACxC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC5B,SAAS;QACV,CAAC;QACD,mBAAmB,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC7C,IAAI,QAAQ,CAAC,MAAM,KAAK,qCAAqC,EAAE,CAAC;YAC/D,uBAAuB,CAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;QACpE,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM,KAAK,qCAAqC,EAAE,CAAC;YAC/D,KAAK,MAAM,IAAI,IAAI,aAAa,CAAC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE,CAAC;gBACpE,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACpB,CAAC;QACF,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAClE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACF,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import ts from "typescript";
|
|
2
|
+
export declare function unwrapExpression(expression: ts.Expression): ts.Expression;
|
|
3
|
+
export declare function directServiceDefinitions(source: ts.SourceFile, names: ReadonlySet<string>): readonly ts.CallExpression[];
|
|
4
|
+
export declare function invalidServiceMembers(config: ts.ObjectLiteralExpression): readonly ts.ObjectLiteralElementLike[];
|
|
5
|
+
export declare function serviceProperty(object: ts.ObjectLiteralExpression, name: string): ts.Expression | undefined;
|
|
6
|
+
export declare function returnedServiceMethods(value: ts.Expression): ts.ObjectLiteralExpression | undefined;
|
|
7
|
+
export declare function isEffectVoid(value: ts.Expression, effects: ReadonlySet<string>): boolean;
|
|
8
|
+
export declare function isOperationReference(member: ts.ObjectLiteralElementLike, imports: ReadonlySet<string>, generics: ReadonlySet<string>): boolean;
|
|
9
|
+
export declare function implementationBodies(source: ts.SourceFile, allowed: ReadonlySet<ts.Node>): readonly ts.Node[];
|
|
10
|
+
//# sourceMappingURL=serviceAssemblySyntax.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceAssemblySyntax.d.ts","sourceRoot":"","sources":["../../src/adapters/serviceAssemblySyntax.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC,UAAU,CAKzE;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,EAAE,CAAC,cAAc,EAAE,CAqBxH;AAID,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,EAAE,CAAC,uBAAuB,GAAG,SAAS,EAAE,CAAC,wBAAwB,EAAE,CAShH;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,EAAE,CAAC,uBAAuB,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,CAAC,UAAU,GAAG,SAAS,CAW3G;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC,uBAAuB,GAAG,SAAS,CAiBnG;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,OAAO,CAIxF;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,EAAE,CAAC,wBAAwB,EAAE,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,OAAO,CAgB9I;AAkBD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,SAAS,EAAE,CAAC,IAAI,EAAE,CAW7G"}
|