@dbt-tools/core 0.3.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.
Files changed (37) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +51 -0
  3. package/dist/analysis/analysis-snapshot.d.ts +145 -0
  4. package/dist/analysis/analysis-snapshot.js +615 -0
  5. package/dist/analysis/dependency-service.d.ts +56 -0
  6. package/dist/analysis/dependency-service.js +75 -0
  7. package/dist/analysis/execution-analyzer.d.ts +85 -0
  8. package/dist/analysis/execution-analyzer.js +245 -0
  9. package/dist/analysis/manifest-graph.d.ts +118 -0
  10. package/dist/analysis/manifest-graph.js +651 -0
  11. package/dist/analysis/run-results-search.d.ts +56 -0
  12. package/dist/analysis/run-results-search.js +127 -0
  13. package/dist/analysis/sql-analyzer.d.ts +30 -0
  14. package/dist/analysis/sql-analyzer.js +218 -0
  15. package/dist/browser.d.ts +11 -0
  16. package/dist/browser.js +17 -0
  17. package/dist/errors/error-handler.d.ts +26 -0
  18. package/dist/errors/error-handler.js +59 -0
  19. package/dist/formatting/field-filter.d.ts +29 -0
  20. package/dist/formatting/field-filter.js +112 -0
  21. package/dist/formatting/graph-export.d.ts +9 -0
  22. package/dist/formatting/graph-export.js +147 -0
  23. package/dist/formatting/output-formatter.d.ts +77 -0
  24. package/dist/formatting/output-formatter.js +160 -0
  25. package/dist/index.d.ts +15 -0
  26. package/dist/index.js +38 -0
  27. package/dist/introspection/schema-generator.d.ts +29 -0
  28. package/dist/introspection/schema-generator.js +275 -0
  29. package/dist/io/artifact-loader.d.ts +27 -0
  30. package/dist/io/artifact-loader.js +142 -0
  31. package/dist/types.d.ts +43 -0
  32. package/dist/types.js +2 -0
  33. package/dist/validation/input-validator.d.ts +39 -0
  34. package/dist/validation/input-validator.js +167 -0
  35. package/dist/version.d.ts +28 -0
  36. package/dist/version.js +60 -0
  37. package/package.json +47 -0
@@ -0,0 +1,28 @@
1
+ import type { ParsedManifest } from "dbt-artifacts-parser/manifest";
2
+ import type { VersionInfo } from "./types";
3
+ /**
4
+ * Minimum supported manifest schema version
5
+ * Manifest v10 corresponds to dbt Core 1.6+, but we require dbt 1.10+
6
+ * Since v10 covers 1.6-1.9 and v12 covers 1.9+, accepting v10+ ensures we support 1.10+
7
+ */
8
+ export declare const MIN_SUPPORTED_SCHEMA_VERSION = 10;
9
+ /**
10
+ * Minimum supported dbt version (for reference in error messages)
11
+ */
12
+ export declare const MIN_SUPPORTED_DBT_VERSION = "1.10.0";
13
+ /**
14
+ * Extract manifest schema version number from dbt_schema_version URL
15
+ */
16
+ export declare function getManifestSchemaVersion(manifest: ParsedManifest): number | null;
17
+ /**
18
+ * Extract dbt version from manifest metadata
19
+ */
20
+ export declare function getDbtVersion(manifest: ParsedManifest): string | null;
21
+ /**
22
+ * Check if the manifest version is supported
23
+ */
24
+ export declare function isSupportedVersion(manifest: ParsedManifest): boolean;
25
+ /**
26
+ * Get comprehensive version information from a manifest
27
+ */
28
+ export declare function getVersionInfo(manifest: ParsedManifest): VersionInfo;
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MIN_SUPPORTED_DBT_VERSION = exports.MIN_SUPPORTED_SCHEMA_VERSION = void 0;
4
+ exports.getManifestSchemaVersion = getManifestSchemaVersion;
5
+ exports.getDbtVersion = getDbtVersion;
6
+ exports.isSupportedVersion = isSupportedVersion;
7
+ exports.getVersionInfo = getVersionInfo;
8
+ /**
9
+ * Minimum supported manifest schema version
10
+ * Manifest v10 corresponds to dbt Core 1.6+, but we require dbt 1.10+
11
+ * Since v10 covers 1.6-1.9 and v12 covers 1.9+, accepting v10+ ensures we support 1.10+
12
+ */
13
+ exports.MIN_SUPPORTED_SCHEMA_VERSION = 10;
14
+ /**
15
+ * Minimum supported dbt version (for reference in error messages)
16
+ */
17
+ exports.MIN_SUPPORTED_DBT_VERSION = "1.10.0";
18
+ /**
19
+ * Extract manifest schema version number from dbt_schema_version URL
20
+ */
21
+ function getManifestSchemaVersion(manifest) {
22
+ const metadata = manifest.metadata;
23
+ if (!metadata || !metadata.dbt_schema_version) {
24
+ return null;
25
+ }
26
+ const schemaVersion = metadata.dbt_schema_version;
27
+ // Match patterns like: https://schemas.getdbt.com/dbt/manifest/v12.json
28
+ const match = schemaVersion.match(/\/manifest\/v(\d+)\.json$/);
29
+ return match ? parseInt(match[1], 10) : null;
30
+ }
31
+ /**
32
+ * Extract dbt version from manifest metadata
33
+ */
34
+ function getDbtVersion(manifest) {
35
+ const metadata = manifest.metadata;
36
+ return (metadata === null || metadata === void 0 ? void 0 : metadata.dbt_version) || null;
37
+ }
38
+ /**
39
+ * Check if the manifest version is supported
40
+ */
41
+ function isSupportedVersion(manifest) {
42
+ const schemaVersion = getManifestSchemaVersion(manifest);
43
+ if (schemaVersion === null) {
44
+ return false;
45
+ }
46
+ return schemaVersion >= exports.MIN_SUPPORTED_SCHEMA_VERSION;
47
+ }
48
+ /**
49
+ * Get comprehensive version information from a manifest
50
+ */
51
+ function getVersionInfo(manifest) {
52
+ const schemaVersion = getManifestSchemaVersion(manifest);
53
+ const dbtVersion = getDbtVersion(manifest);
54
+ const isSupported = isSupportedVersion(manifest);
55
+ return {
56
+ schema_version: schemaVersion,
57
+ dbt_version: dbtVersion,
58
+ is_supported: isSupported,
59
+ };
60
+ }
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@dbt-tools/core",
3
+ "version": "0.3.2",
4
+ "description": "Core library for dbt artifact graph management and analysis",
5
+ "keywords": [
6
+ "dbt",
7
+ "graph",
8
+ "analysis"
9
+ ],
10
+ "license": "Apache-2.0",
11
+ "author": "yu-iskw",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.js"
16
+ },
17
+ "./browser": {
18
+ "types": "./dist/browser.d.ts",
19
+ "default": "./dist/browser.js"
20
+ }
21
+ },
22
+ "main": "dist/index.js",
23
+ "types": "dist/index.d.ts",
24
+ "files": [
25
+ "dist",
26
+ "README.md"
27
+ ],
28
+ "dependencies": {
29
+ "graphology": "^0.26.0",
30
+ "graphology-dag": "^0.4.1",
31
+ "node-sql-parser": "^5.4.0",
32
+ "dbt-artifacts-parser": "0.3.2"
33
+ },
34
+ "devDependencies": {
35
+ "@types/node": "^25.5.0",
36
+ "typescript": "^6.0.2",
37
+ "vitest": "^4.1.2"
38
+ },
39
+ "publishConfig": {
40
+ "access": "public"
41
+ },
42
+ "scripts": {
43
+ "build": "tsc",
44
+ "test": "vitest run packages/dbt-tools/core/src",
45
+ "test:watch": "vitest packages/dbt-tools/core/src"
46
+ }
47
+ }