@ankhorage/data-sources 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ankhorage
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ <!-- markdownlint-disable MD013 MD033 -->
2
+ <!-- This file is generated by Paradox. Do not edit manually. -->
3
+
4
+ # @ankhorage/data-sources
5
+
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v0.0.0](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![docs: paradox](././paradox/badges/docs.svg)
7
+
8
+ Provider-neutral data source and endpoint system for APIs, databases, and runtime bindings.
9
+
10
+ ## Generated documentation
11
+
12
+ - [Interactive documentation app](././paradox/index.html)
13
+ - [Public API reference](././paradox/exports.md)
14
+ - [Component registry](././paradox/components.md)
15
+ - [Architecture overview](././paradox/diagrams/architecture-overview.mmd)
16
+ - [Module relationships](././paradox/diagrams/module-relationships.mmd)
17
+ - [Export graph](././paradox/diagrams/export-graph.mmd)
18
+
19
+ ## Architecture preview
20
+
21
+ <details>
22
+ <summary>Architecture overview</summary>
23
+
24
+ ```mermaid
25
+ graph TD
26
+ package__ankhorage_data_sources["@ankhorage/data-sources"]
27
+ entrypoint_src_index_ts["src/index.ts"]
28
+ package__ankhorage_data_sources --> entrypoint_src_index_ts
29
+ module_src_index_ts["src/index.ts"]
30
+ ```
31
+
32
+ </details>
@@ -0,0 +1,11 @@
1
+ import type { DataSourceConfig, DataSourceKind } from '@ankhorage/contracts/data';
2
+ export declare const DATA_SOURCES_PACKAGE_NAME: "@ankhorage/data-sources";
3
+ export declare const SUPPORTED_DATA_SOURCE_KINDS: readonly ["database", "graphql", "managed-api", "openapi", "rest"];
4
+ export interface DataSourcesPackageInfo {
5
+ readonly packageName: typeof DATA_SOURCES_PACKAGE_NAME;
6
+ readonly supportedKinds: typeof SUPPORTED_DATA_SOURCE_KINDS;
7
+ }
8
+ export declare function getDataSourcesPackageInfo(): DataSourcesPackageInfo;
9
+ export declare function isSupportedDataSourceKind(kind: string): kind is DataSourceKind;
10
+ export declare function getDataSourceKind(source: DataSourceConfig): DataSourceKind;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAElF,eAAO,MAAM,yBAAyB,EAAG,yBAAkC,CAAC;AAE5E,eAAO,MAAM,2BAA2B,oEAMM,CAAC;AAE/C,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,WAAW,EAAE,OAAO,yBAAyB,CAAC;IACvD,QAAQ,CAAC,cAAc,EAAE,OAAO,2BAA2B,CAAC;CAC7D;AAED,wBAAgB,yBAAyB,IAAI,sBAAsB,CAKlE;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,cAAc,CAE9E;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,cAAc,CAE1E"}
package/dist/index.js ADDED
@@ -0,0 +1,21 @@
1
+ export const DATA_SOURCES_PACKAGE_NAME = '@ankhorage/data-sources';
2
+ export const SUPPORTED_DATA_SOURCE_KINDS = [
3
+ 'database',
4
+ 'graphql',
5
+ 'managed-api',
6
+ 'openapi',
7
+ 'rest',
8
+ ];
9
+ export function getDataSourcesPackageInfo() {
10
+ return {
11
+ packageName: DATA_SOURCES_PACKAGE_NAME,
12
+ supportedKinds: SUPPORTED_DATA_SOURCE_KINDS,
13
+ };
14
+ }
15
+ export function isSupportedDataSourceKind(kind) {
16
+ return SUPPORTED_DATA_SOURCE_KINDS.some((supportedKind) => supportedKind === kind);
17
+ }
18
+ export function getDataSourceKind(source) {
19
+ return source.kind;
20
+ }
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,yBAAyB,GAAG,yBAAkC,CAAC;AAE5E,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,UAAU;IACV,SAAS;IACT,aAAa;IACb,SAAS;IACT,MAAM;CACsC,CAAC;AAO/C,MAAM,UAAU,yBAAyB;IACvC,OAAO;QACL,WAAW,EAAE,yBAAyB;QACtC,cAAc,EAAE,2BAA2B;KAC5C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,IAAY;IACpD,OAAO,2BAA2B,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,aAAa,KAAK,IAAI,CAAC,CAAC;AACrF,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAwB;IACxD,OAAO,MAAM,CAAC,IAAI,CAAC;AACrB,CAAC","sourcesContent":["import type { DataSourceConfig, DataSourceKind } from '@ankhorage/contracts/data';\n\nexport const DATA_SOURCES_PACKAGE_NAME = '@ankhorage/data-sources' as const;\n\nexport const SUPPORTED_DATA_SOURCE_KINDS = [\n 'database',\n 'graphql',\n 'managed-api',\n 'openapi',\n 'rest',\n] as const satisfies readonly DataSourceKind[];\n\nexport interface DataSourcesPackageInfo {\n readonly packageName: typeof DATA_SOURCES_PACKAGE_NAME;\n readonly supportedKinds: typeof SUPPORTED_DATA_SOURCE_KINDS;\n}\n\nexport function getDataSourcesPackageInfo(): DataSourcesPackageInfo {\n return {\n packageName: DATA_SOURCES_PACKAGE_NAME,\n supportedKinds: SUPPORTED_DATA_SOURCE_KINDS,\n };\n}\n\nexport function isSupportedDataSourceKind(kind: string): kind is DataSourceKind {\n return SUPPORTED_DATA_SOURCE_KINDS.some((supportedKind) => supportedKind === kind);\n}\n\nexport function getDataSourceKind(source: DataSourceConfig): DataSourceKind {\n return source.kind;\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,74 @@
1
+ {
2
+ "name": "@ankhorage/data-sources",
3
+ "type": "module",
4
+ "version": "0.0.0",
5
+ "description": "Headless toolkit for importing, generating, normalizing, and testing Ankhorage data-source configs.",
6
+ "homepage": "https://github.com/ankhorage/data-sources#readme",
7
+ "bugs": {
8
+ "url": "https://github.com/ankhorage/data-sources/issues"
9
+ },
10
+ "license": "MIT",
11
+ "main": "./dist/index.js",
12
+ "sideEffects": false,
13
+ "types": "./dist/index.d.ts",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/ankhorage/data-sources.git"
17
+ },
18
+ "keywords": [
19
+ "ankhorage",
20
+ "data-sources",
21
+ "api",
22
+ "openapi",
23
+ "graphql",
24
+ "rest",
25
+ "typescript"
26
+ ],
27
+ "dependencies": {
28
+ "@ankhorage/contracts": "^1.12.0"
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "src",
33
+ "package.json",
34
+ "README.md",
35
+ "CHANGELOG.md",
36
+ "LICENSE"
37
+ ],
38
+ "exports": {
39
+ ".": {
40
+ "browser": "./src/index.ts",
41
+ "types": "./dist/index.d.ts",
42
+ "import": "./dist/index.js",
43
+ "default": "./dist/index.js"
44
+ },
45
+ "./package.json": "./package.json"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
50
+ "scripts": {
51
+ "build": "rm -rf dist tsconfig.tsbuildinfo && bun x tsc -p tsconfig.build.json",
52
+ "changeset": "changeset",
53
+ "changeset:status": "changeset status --since=origin/main",
54
+ "docs": "paradox",
55
+ "knip": "ankhorage-knip",
56
+ "lint": "ankhorage-eslint . --max-warnings=0",
57
+ "lint:fix": "ankhorage-eslint . --fix --max-warnings=0",
58
+ "format": "ankhorage-prettier --write .",
59
+ "format:check": "ankhorage-prettier --check .",
60
+ "prepack": "bun run build",
61
+ "test": "bun test src",
62
+ "typecheck": "bun x tsc --noEmit -p tsconfig.json",
63
+ "version-packages": "changeset version"
64
+ },
65
+ "devDependencies": {
66
+ "@ankhorage/devtools": "^1.0.6",
67
+ "@ankhorage/paradox": "^0.1.7",
68
+ "@changesets/cli": "^2.30.0",
69
+ "@types/bun": "^1.3.13",
70
+ "@types/node": "^25.6.0",
71
+ "typescript": "^5.9.3"
72
+ },
73
+ "packageManager": "bun@1.3.13"
74
+ }
@@ -0,0 +1,39 @@
1
+ import type { RestDataSourceConfig } from '@ankhorage/contracts/data';
2
+ import { describe, expect, it } from 'bun:test';
3
+
4
+ import {
5
+ DATA_SOURCES_PACKAGE_NAME,
6
+ getDataSourceKind,
7
+ getDataSourcesPackageInfo,
8
+ isSupportedDataSourceKind,
9
+ SUPPORTED_DATA_SOURCE_KINDS,
10
+ } from './index';
11
+
12
+ describe('data-sources package baseline', () => {
13
+ it('exports package metadata', () => {
14
+ const info = getDataSourcesPackageInfo();
15
+
16
+ expect(info.packageName).toBe(DATA_SOURCES_PACKAGE_NAME);
17
+ expect(info.supportedKinds).toEqual(SUPPORTED_DATA_SOURCE_KINDS);
18
+ });
19
+
20
+ it('recognizes supported shared contract data-source kinds', () => {
21
+ expect(isSupportedDataSourceKind('rest')).toBe(true);
22
+ expect(isSupportedDataSourceKind('openapi')).toBe(true);
23
+ expect(isSupportedDataSourceKind('graphql')).toBe(true);
24
+ expect(isSupportedDataSourceKind('managed-api')).toBe(true);
25
+ expect(isSupportedDataSourceKind('database')).toBe(true);
26
+ expect(isSupportedDataSourceKind('studio')).toBe(false);
27
+ });
28
+
29
+ it('consumes data-source contracts from @ankhorage/contracts', () => {
30
+ const source: RestDataSourceConfig = {
31
+ id: 'cms',
32
+ kind: 'rest',
33
+ baseUrl: 'https://cms.example.com',
34
+ endpoints: {},
35
+ };
36
+
37
+ expect(getDataSourceKind(source)).toBe('rest');
38
+ });
39
+ });
package/src/index.ts ADDED
@@ -0,0 +1,31 @@
1
+ import type { DataSourceConfig, DataSourceKind } from '@ankhorage/contracts/data';
2
+
3
+ export const DATA_SOURCES_PACKAGE_NAME = '@ankhorage/data-sources' as const;
4
+
5
+ export const SUPPORTED_DATA_SOURCE_KINDS = [
6
+ 'database',
7
+ 'graphql',
8
+ 'managed-api',
9
+ 'openapi',
10
+ 'rest',
11
+ ] as const satisfies readonly DataSourceKind[];
12
+
13
+ export interface DataSourcesPackageInfo {
14
+ readonly packageName: typeof DATA_SOURCES_PACKAGE_NAME;
15
+ readonly supportedKinds: typeof SUPPORTED_DATA_SOURCE_KINDS;
16
+ }
17
+
18
+ export function getDataSourcesPackageInfo(): DataSourcesPackageInfo {
19
+ return {
20
+ packageName: DATA_SOURCES_PACKAGE_NAME,
21
+ supportedKinds: SUPPORTED_DATA_SOURCE_KINDS,
22
+ };
23
+ }
24
+
25
+ export function isSupportedDataSourceKind(kind: string): kind is DataSourceKind {
26
+ return SUPPORTED_DATA_SOURCE_KINDS.some((supportedKind) => supportedKind === kind);
27
+ }
28
+
29
+ export function getDataSourceKind(source: DataSourceConfig): DataSourceKind {
30
+ return source.kind;
31
+ }