@stackwright-pro/openapi 0.3.0-alpha.8 → 0.3.0-alpha.9
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/dist/index.d.mts +4 -117
- package/dist/index.d.ts +4 -117
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,127 +1,14 @@
|
|
|
1
1
|
import { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
|
|
2
2
|
import { z, ZodSchema } from 'zod';
|
|
3
|
+
import { ActionConfig, EndpointFilter as EndpointFilter$1, PrebuildSecurityConfig, ValidationResult } from '@stackwright-pro/types';
|
|
4
|
+
export { ActionConfig, ApprovedSpec, OpenAPIConfig, PrebuildSecurityConfig, SiteConfig, ValidationResult } from '@stackwright-pro/types';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Supported OpenAPI versions
|
|
6
8
|
*/
|
|
7
9
|
type OpenAPIDocument = OpenAPIV3.Document | OpenAPIV3_1.Document;
|
|
8
10
|
/**
|
|
9
|
-
*
|
|
10
|
-
* Used by enterprise customers to whitelist specific OpenAPI specs.
|
|
11
|
-
*/
|
|
12
|
-
interface ApprovedSpec {
|
|
13
|
-
/** Human-readable name for the spec */
|
|
14
|
-
name: string;
|
|
15
|
-
/** URL or file path to the approved spec */
|
|
16
|
-
url: string;
|
|
17
|
-
/** Expected SHA-256 hash of the spec content */
|
|
18
|
-
sha256: string;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Security configuration for approved specs enforcement.
|
|
22
|
-
* Configured in stackwright.yml under `prebuild.security`.
|
|
23
|
-
*/
|
|
24
|
-
interface PrebuildSecurityConfig {
|
|
25
|
-
/** Enable approved-specs enforcement */
|
|
26
|
-
enabled: boolean;
|
|
27
|
-
/** List of approved specifications */
|
|
28
|
-
allowlist: ApprovedSpec[];
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Result of validating a spec against the approved list.
|
|
32
|
-
*/
|
|
33
|
-
interface ValidationResult {
|
|
34
|
-
/** Whether the spec is approved */
|
|
35
|
-
valid: boolean;
|
|
36
|
-
/** Error code if not valid */
|
|
37
|
-
errorCode?: 'SPEC_NOT_ON_ALLOWLIST' | 'SPEC_MODIFIED' | 'DOWNLOAD_FAILED';
|
|
38
|
-
/** Human-readable error message */
|
|
39
|
-
error?: string;
|
|
40
|
-
/** URL of the spec that was validated */
|
|
41
|
-
specUrl?: string;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Extended site config with prebuild security.
|
|
45
|
-
* Users can add this to stackwright.yml.
|
|
46
|
-
*/
|
|
47
|
-
interface SiteConfig {
|
|
48
|
-
/** Prebuild configuration */
|
|
49
|
-
prebuild?: {
|
|
50
|
-
/** Security settings for approved-specs enforcement */
|
|
51
|
-
security?: PrebuildSecurityConfig;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Endpoint filter configuration
|
|
56
|
-
*/
|
|
57
|
-
interface EndpointFilter$1 {
|
|
58
|
-
/** Endpoints/patterns to include (default: all) */
|
|
59
|
-
include?: string[];
|
|
60
|
-
/** Endpoints/patterns to exclude */
|
|
61
|
-
exclude?: string[];
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Configuration for a single action endpoint in stackwright.yml
|
|
65
|
-
*
|
|
66
|
-
* Actions are write-through endpoints (POST, PUT, DELETE, PATCH) that can be
|
|
67
|
-
* invoked from workflow on_submit handlers via service: references.
|
|
68
|
-
*
|
|
69
|
-
* Unlike collections (which generate CollectionProviders for data display),
|
|
70
|
-
* actions generate typed, schema-validated callables that the workflow runtime
|
|
71
|
-
* resolves by name.
|
|
72
|
-
*
|
|
73
|
-
* Example stackwright.yml:
|
|
74
|
-
* actions:
|
|
75
|
-
* - name: create-supply-request # resolves service:create-supply-request
|
|
76
|
-
* endpoint: /supplies/request
|
|
77
|
-
* method: POST
|
|
78
|
-
*/
|
|
79
|
-
interface ActionConfig {
|
|
80
|
-
/** Service name — resolves service:<name> in workflow YAML on_submit.action */
|
|
81
|
-
name: string;
|
|
82
|
-
/** API endpoint path (e.g. '/supplies/request') */
|
|
83
|
-
endpoint: string;
|
|
84
|
-
/** HTTP method — typically POST, PUT, PATCH, or DELETE */
|
|
85
|
-
method: 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
86
|
-
/** Optional human-readable description (used in generated JSDoc) */
|
|
87
|
-
description?: string;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Configuration for OpenAPI integration in stackwright.yml
|
|
91
|
-
*/
|
|
92
|
-
interface OpenAPIConfig {
|
|
93
|
-
/** Name of this integration */
|
|
94
|
-
name: string;
|
|
95
|
-
/** OpenAPI spec (URL or local file path) */
|
|
96
|
-
spec: string;
|
|
97
|
-
/** Mock server URL for development (e.g., http://localhost:4010) */
|
|
98
|
-
mockUrl?: string;
|
|
99
|
-
/** Authentication configuration */
|
|
100
|
-
auth?: {
|
|
101
|
-
type: 'bearer' | 'apiKey' | 'oauth2';
|
|
102
|
-
token?: string;
|
|
103
|
-
apiKey?: string;
|
|
104
|
-
};
|
|
105
|
-
/** Collections to generate from endpoints */
|
|
106
|
-
collections?: Array<{
|
|
107
|
-
/** API endpoint path */
|
|
108
|
-
endpoint: string;
|
|
109
|
-
/** Field to use as slug/ID */
|
|
110
|
-
slug_field: string;
|
|
111
|
-
/** HTTP method for this collection endpoint — defaults to 'GET' */
|
|
112
|
-
method?: string;
|
|
113
|
-
/** Transport protocol — 'websocket' collections are skipped during prebuild */
|
|
114
|
-
transport?: string;
|
|
115
|
-
/** Optional filters */
|
|
116
|
-
filters?: Record<string, unknown>;
|
|
117
|
-
}>;
|
|
118
|
-
/** Actions to generate from write endpoints (POST, PUT, PATCH, DELETE) */
|
|
119
|
-
actions?: ActionConfig[];
|
|
120
|
-
/** Endpoint filter - only generate code for matching endpoints */
|
|
121
|
-
endpoints?: EndpointFilter$1;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Result of OpenAPI compilation
|
|
11
|
+
* Result of OpenAPI compilation (internal — not a public contract)
|
|
125
12
|
*/
|
|
126
13
|
interface OpenAPICompilationResult {
|
|
127
14
|
/** Generated Zod schemas as code */
|
|
@@ -1061,4 +948,4 @@ declare class ApprovedSpecsValidator {
|
|
|
1061
948
|
clearCache(): void;
|
|
1062
949
|
}
|
|
1063
950
|
|
|
1064
|
-
export {
|
|
951
|
+
export { ActionGenerator, ApprovedSpecsValidator, type ClientGenerationOptions, ClientGenerator, type CollectionConfig, CollectionProviderGenerator, EndpointFilter, type OpenAPICompilationResult, type OpenAPIDocument, OpenAPIParser, OpenAPIPlugin, type OpenAPISourceConfig, type ParseOptions, type ParseResult, type ProviderGenerationOptions, type SchemaMapping, SchemaResolver, type TypeGenerationOptions, TypeGenerator, type ZodGenerationOptions, ZodSchemaGenerator, createOpenAPIFetcher, createOpenAPIPlugin, isUrlSafe, validateUrlSafe };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,127 +1,14 @@
|
|
|
1
1
|
import { OpenAPIV3, OpenAPIV3_1 } from 'openapi-types';
|
|
2
2
|
import { z, ZodSchema } from 'zod';
|
|
3
|
+
import { ActionConfig, EndpointFilter as EndpointFilter$1, PrebuildSecurityConfig, ValidationResult } from '@stackwright-pro/types';
|
|
4
|
+
export { ActionConfig, ApprovedSpec, OpenAPIConfig, PrebuildSecurityConfig, SiteConfig, ValidationResult } from '@stackwright-pro/types';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Supported OpenAPI versions
|
|
6
8
|
*/
|
|
7
9
|
type OpenAPIDocument = OpenAPIV3.Document | OpenAPIV3_1.Document;
|
|
8
10
|
/**
|
|
9
|
-
*
|
|
10
|
-
* Used by enterprise customers to whitelist specific OpenAPI specs.
|
|
11
|
-
*/
|
|
12
|
-
interface ApprovedSpec {
|
|
13
|
-
/** Human-readable name for the spec */
|
|
14
|
-
name: string;
|
|
15
|
-
/** URL or file path to the approved spec */
|
|
16
|
-
url: string;
|
|
17
|
-
/** Expected SHA-256 hash of the spec content */
|
|
18
|
-
sha256: string;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Security configuration for approved specs enforcement.
|
|
22
|
-
* Configured in stackwright.yml under `prebuild.security`.
|
|
23
|
-
*/
|
|
24
|
-
interface PrebuildSecurityConfig {
|
|
25
|
-
/** Enable approved-specs enforcement */
|
|
26
|
-
enabled: boolean;
|
|
27
|
-
/** List of approved specifications */
|
|
28
|
-
allowlist: ApprovedSpec[];
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Result of validating a spec against the approved list.
|
|
32
|
-
*/
|
|
33
|
-
interface ValidationResult {
|
|
34
|
-
/** Whether the spec is approved */
|
|
35
|
-
valid: boolean;
|
|
36
|
-
/** Error code if not valid */
|
|
37
|
-
errorCode?: 'SPEC_NOT_ON_ALLOWLIST' | 'SPEC_MODIFIED' | 'DOWNLOAD_FAILED';
|
|
38
|
-
/** Human-readable error message */
|
|
39
|
-
error?: string;
|
|
40
|
-
/** URL of the spec that was validated */
|
|
41
|
-
specUrl?: string;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Extended site config with prebuild security.
|
|
45
|
-
* Users can add this to stackwright.yml.
|
|
46
|
-
*/
|
|
47
|
-
interface SiteConfig {
|
|
48
|
-
/** Prebuild configuration */
|
|
49
|
-
prebuild?: {
|
|
50
|
-
/** Security settings for approved-specs enforcement */
|
|
51
|
-
security?: PrebuildSecurityConfig;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Endpoint filter configuration
|
|
56
|
-
*/
|
|
57
|
-
interface EndpointFilter$1 {
|
|
58
|
-
/** Endpoints/patterns to include (default: all) */
|
|
59
|
-
include?: string[];
|
|
60
|
-
/** Endpoints/patterns to exclude */
|
|
61
|
-
exclude?: string[];
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Configuration for a single action endpoint in stackwright.yml
|
|
65
|
-
*
|
|
66
|
-
* Actions are write-through endpoints (POST, PUT, DELETE, PATCH) that can be
|
|
67
|
-
* invoked from workflow on_submit handlers via service: references.
|
|
68
|
-
*
|
|
69
|
-
* Unlike collections (which generate CollectionProviders for data display),
|
|
70
|
-
* actions generate typed, schema-validated callables that the workflow runtime
|
|
71
|
-
* resolves by name.
|
|
72
|
-
*
|
|
73
|
-
* Example stackwright.yml:
|
|
74
|
-
* actions:
|
|
75
|
-
* - name: create-supply-request # resolves service:create-supply-request
|
|
76
|
-
* endpoint: /supplies/request
|
|
77
|
-
* method: POST
|
|
78
|
-
*/
|
|
79
|
-
interface ActionConfig {
|
|
80
|
-
/** Service name — resolves service:<name> in workflow YAML on_submit.action */
|
|
81
|
-
name: string;
|
|
82
|
-
/** API endpoint path (e.g. '/supplies/request') */
|
|
83
|
-
endpoint: string;
|
|
84
|
-
/** HTTP method — typically POST, PUT, PATCH, or DELETE */
|
|
85
|
-
method: 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
86
|
-
/** Optional human-readable description (used in generated JSDoc) */
|
|
87
|
-
description?: string;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Configuration for OpenAPI integration in stackwright.yml
|
|
91
|
-
*/
|
|
92
|
-
interface OpenAPIConfig {
|
|
93
|
-
/** Name of this integration */
|
|
94
|
-
name: string;
|
|
95
|
-
/** OpenAPI spec (URL or local file path) */
|
|
96
|
-
spec: string;
|
|
97
|
-
/** Mock server URL for development (e.g., http://localhost:4010) */
|
|
98
|
-
mockUrl?: string;
|
|
99
|
-
/** Authentication configuration */
|
|
100
|
-
auth?: {
|
|
101
|
-
type: 'bearer' | 'apiKey' | 'oauth2';
|
|
102
|
-
token?: string;
|
|
103
|
-
apiKey?: string;
|
|
104
|
-
};
|
|
105
|
-
/** Collections to generate from endpoints */
|
|
106
|
-
collections?: Array<{
|
|
107
|
-
/** API endpoint path */
|
|
108
|
-
endpoint: string;
|
|
109
|
-
/** Field to use as slug/ID */
|
|
110
|
-
slug_field: string;
|
|
111
|
-
/** HTTP method for this collection endpoint — defaults to 'GET' */
|
|
112
|
-
method?: string;
|
|
113
|
-
/** Transport protocol — 'websocket' collections are skipped during prebuild */
|
|
114
|
-
transport?: string;
|
|
115
|
-
/** Optional filters */
|
|
116
|
-
filters?: Record<string, unknown>;
|
|
117
|
-
}>;
|
|
118
|
-
/** Actions to generate from write endpoints (POST, PUT, PATCH, DELETE) */
|
|
119
|
-
actions?: ActionConfig[];
|
|
120
|
-
/** Endpoint filter - only generate code for matching endpoints */
|
|
121
|
-
endpoints?: EndpointFilter$1;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Result of OpenAPI compilation
|
|
11
|
+
* Result of OpenAPI compilation (internal — not a public contract)
|
|
125
12
|
*/
|
|
126
13
|
interface OpenAPICompilationResult {
|
|
127
14
|
/** Generated Zod schemas as code */
|
|
@@ -1061,4 +948,4 @@ declare class ApprovedSpecsValidator {
|
|
|
1061
948
|
clearCache(): void;
|
|
1062
949
|
}
|
|
1063
950
|
|
|
1064
|
-
export {
|
|
951
|
+
export { ActionGenerator, ApprovedSpecsValidator, type ClientGenerationOptions, ClientGenerator, type CollectionConfig, CollectionProviderGenerator, EndpointFilter, type OpenAPICompilationResult, type OpenAPIDocument, OpenAPIParser, OpenAPIPlugin, type OpenAPISourceConfig, type ParseOptions, type ParseResult, type ProviderGenerationOptions, type SchemaMapping, SchemaResolver, type TypeGenerationOptions, TypeGenerator, type ZodGenerationOptions, ZodSchemaGenerator, createOpenAPIFetcher, createOpenAPIPlugin, isUrlSafe, validateUrlSafe };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stackwright-pro/openapi",
|
|
3
|
-
"version": "0.3.0-alpha.
|
|
3
|
+
"version": "0.3.0-alpha.9",
|
|
4
4
|
"description": "OpenAPI spec to typed Stackwright application compiler",
|
|
5
5
|
"license": "PROPRIETARY",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"openapi-types": "^12.1.3",
|
|
25
25
|
"safe-regex": "^2.1.1",
|
|
26
26
|
"zod": "^4.3.6",
|
|
27
|
-
"zod-to-ts": "^2.0.0"
|
|
27
|
+
"zod-to-ts": "^2.0.0",
|
|
28
|
+
"@stackwright-pro/types": "0.2.0-alpha.0"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
31
|
"@types/node": "^24.1.0",
|