@sonatel-os/openapi-runtime 0.1.1 → 0.2.1

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sonatel-os/openapi-runtime",
3
- "version": "0.1.1",
4
- "description": "The dynamic, zero-codegen OpenAPI SDK. Load specs at runtime, mock responses, validate payloads, and execute requests without generating a single file.",
3
+ "version": "0.2.1",
4
+ "description": "Enterprise-grade, zero-codegen OpenAPI runtime. Load specs dynamically, execute APIs with type-safe validation, mock responses, and robust authentication.",
5
5
  "license": "MIT",
6
6
  "author": "Sonatel Open Source <opensource@sonatel.com>",
7
7
  "homepage": "https://github.com/sonatel-os/openapi-runtime#readme",
@@ -21,9 +21,12 @@
21
21
  "fetch",
22
22
  "mock",
23
23
  "validation",
24
- "sonatel",
24
+ "enterprise",
25
25
  "zero-codegen",
26
- "dynamic-client"
26
+ "dynamic-client",
27
+ "api",
28
+ "rest",
29
+ "typescript"
27
30
  ],
28
31
  "type": "module",
29
32
  "main": "dist/index.cjs",
@@ -42,6 +45,16 @@
42
45
  "require": "./dist/index.cjs",
43
46
  "import": "./dist/index.esm.js",
44
47
  "types": "./dist/index.d.ts"
48
+ },
49
+ "./react": {
50
+ "require": "./dist/react/index.cjs",
51
+ "import": "./dist/react/index.esm.js",
52
+ "types": "./dist/react/index.d.ts"
53
+ },
54
+ "./errors": {
55
+ "require": "./dist/errors.cjs",
56
+ "import": "./dist/errors.esm.js",
57
+ "types": "./dist/errors.d.ts"
45
58
  }
46
59
  },
47
60
  "sideEffects": false,
@@ -50,10 +63,14 @@
50
63
  },
51
64
  "scripts": {
52
65
  "dev": "node --watch src/index.js",
53
- "build": "rm -rf dist && vite build && npx tsc --emitDeclarationOnly --declaration --declarationDir dist",
66
+ "build": "rm -rf dist && vite build && npm run build:types",
67
+ "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist",
54
68
  "lint": "eslint .",
55
- "test": "node --test",
56
- "prepublishOnly": "npm run build"
69
+ "lint:fix": "eslint . --fix",
70
+ "test": "node --test src/**/*.test.js",
71
+ "test:watch": "node --test --watch src/**/*.test.js",
72
+ "prepublishOnly": "npm run build",
73
+ "typecheck": "tsc --noEmit"
57
74
  },
58
75
  "peerDependencies": {
59
76
  "react": ">=18"
@@ -75,4 +92,4 @@
75
92
  "openapi-sampler": "^1.5.1",
76
93
  "swagger-client": "^3.26.1"
77
94
  }
78
- }
95
+ }
@@ -1,33 +0,0 @@
1
- export function setAuth(name: any, providers: any): void;
2
- export function applyAuth(entry: any, operationId: any, req: any): Promise<void>;
3
- export function apiKey({ in: placement, name, getValue }: {
4
- in: any;
5
- name: any;
6
- getValue: any;
7
- }): {
8
- apply(_entry: any, _schemeName: any, _scopes: any, req: any): Promise<void>;
9
- };
10
- export function basic({ username, password, getCredentials }: {
11
- username: any;
12
- password: any;
13
- getCredentials: any;
14
- }): {
15
- apply(_entry: any, _schemeName: any, _scopes: any, req: any): Promise<void>;
16
- };
17
- export function bearer({ token, getToken }: {
18
- token: any;
19
- getToken: any;
20
- }): {
21
- apply(_entry: any, _schemeName: any, _scopes: any, req: any): Promise<void>;
22
- };
23
- export function clientCredentials({ tokenUrl, clientId, clientSecret, scope, audience, extraParams }: {
24
- tokenUrl: any;
25
- clientId: any;
26
- clientSecret: any;
27
- scope: any;
28
- audience: any;
29
- extraParams: any;
30
- }): {
31
- apply(_entry: any, _schemeName: any, reqScopes: any, req: any): Promise<void>;
32
- };
33
- export function providersFromConfig(_name: any, _spec: any, cfg: any): {};
@@ -1,20 +0,0 @@
1
- /**
2
- * @param {{ name: string, spec: string|object }} opts
3
- * @returns {Promise<import('./registry.js').SpecEntry>}
4
- */
5
- export function buildClient({ name, spec }: {
6
- name: string;
7
- spec: string | object;
8
- }): Promise<import("./registry.js").SpecEntry>;
9
- /**
10
- * Execute with merged headers, auth, and simple interceptors.
11
- * @param {import('./registry.js').SpecEntry} entry
12
- * @param {{ operationId: string, parameters?: object, requestBody?: any, headers?: object, qs?: object }} req
13
- */
14
- export function executeByOperationId(entry: import("./registry.js").SpecEntry, req: {
15
- operationId: string;
16
- parameters?: object;
17
- requestBody?: any;
18
- headers?: object;
19
- qs?: object;
20
- }): Promise<any>;
@@ -1,10 +0,0 @@
1
- /**
2
- * Load auth config from YAML if available.
3
- * Path: process.env.OPENAPI_RUNTIME_AUTH_CONFIG || "./openapi.auth.yml"
4
- * Returns a plain object or null.
5
- */
6
- export function loadAuthConfig(): any;
7
- /**
8
- * Read an env var safely (supports default via "ENV|default").
9
- */
10
- export function getEnv(keyOrExpr: any): any;
File without changes
@@ -1,28 +0,0 @@
1
- export function getRegistry(): Map<any, any>;
2
- export function ensureEntry(name: any): any;
3
- export function indexOperations(spec: any): {
4
- opsById: Map<string, object>;
5
- operations: OperationInfo[];
6
- };
7
- export type OperationInfo = {
8
- operationId: string;
9
- method: string;
10
- path: string;
11
- summary?: string | undefined;
12
- tags?: string[] | undefined;
13
- };
14
- export type SpecEntry = {
15
- name: string;
16
- client: any;
17
- spec: object;
18
- opsById: Map<string, object>;
19
- operations: OperationInfo[];
20
- defaults: {
21
- headers?: Record<string, string>;
22
- };
23
- interceptors: {
24
- request?: Function;
25
- response?: Function;
26
- error?: Function;
27
- };
28
- };
@@ -1,2 +0,0 @@
1
- export function responseSampleFor(entry: any, api: any, status: any): unknown;
2
- export function requestSampleFor(entry: any, api: any): unknown;
@@ -1,17 +0,0 @@
1
- /**
2
- * Build a validator for a given operation's response.
3
- * @param {import('./registry.js').SpecEntry} entry
4
- * @param {{ api: string, status: string, contentType: string, data: any }} opts
5
- */
6
- export function validateResponseFor(entry: import("./registry.js").SpecEntry, { api, status, contentType, data }: {
7
- api: string;
8
- status: string;
9
- contentType: string;
10
- data: any;
11
- }): {
12
- valid: boolean;
13
- errors?: undefined;
14
- } | {
15
- valid: boolean;
16
- errors: import("ajv").ErrorObject<string, Record<string, any>, unknown>[];
17
- };