@skmtc/core 0.0.803 → 0.0.805
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/esm/oas/contact/Contact.d.ts +42 -0
- package/esm/oas/contact/Contact.d.ts.map +1 -1
- package/esm/oas/contact/Contact.js +36 -0
- package/esm/oas/info/Info.d.ts +36 -0
- package/esm/oas/info/Info.d.ts.map +1 -1
- package/esm/oas/info/Info.js +37 -0
- package/esm/oas/mediaType/MediaType.d.ts +17 -0
- package/esm/oas/mediaType/MediaType.d.ts.map +1 -1
- package/esm/oas/mediaType/MediaType.js +17 -0
- package/esm/oas/ref/ref-types.d.ts +48 -0
- package/esm/oas/ref/ref-types.d.ts.map +1 -1
- package/esm/oas/ref/ref-types.js +18 -0
- package/esm/oas/server/Server.d.ts +72 -0
- package/esm/oas/server/Server.d.ts.map +1 -1
- package/esm/oas/server/Server.js +66 -0
- package/esm/types/Brand.d.ts +41 -0
- package/esm/types/Brand.d.ts.map +1 -1
- package/esm/types/Brand.js +41 -0
- package/package.json +1 -1
- package/script/oas/contact/Contact.d.ts +42 -0
- package/script/oas/contact/Contact.d.ts.map +1 -1
- package/script/oas/contact/Contact.js +36 -0
- package/script/oas/info/Info.d.ts +36 -0
- package/script/oas/info/Info.d.ts.map +1 -1
- package/script/oas/info/Info.js +37 -0
- package/script/oas/mediaType/MediaType.d.ts +17 -0
- package/script/oas/mediaType/MediaType.d.ts.map +1 -1
- package/script/oas/mediaType/MediaType.js +17 -0
- package/script/oas/ref/ref-types.d.ts +48 -0
- package/script/oas/ref/ref-types.d.ts.map +1 -1
- package/script/oas/ref/ref-types.js +18 -0
- package/script/oas/server/Server.d.ts +72 -0
- package/script/oas/server/Server.d.ts.map +1 -1
- package/script/oas/server/Server.js +66 -0
- package/script/types/Brand.d.ts +41 -0
- package/script/types/Brand.d.ts.map +1 -1
- package/script/types/Brand.js +41 -0
package/esm/oas/server/Server.js
CHANGED
|
@@ -1,30 +1,75 @@
|
|
|
1
1
|
import "../../_dnt.polyfills.js";
|
|
2
|
+
/**
|
|
3
|
+
* Represents a Server Object in the OpenAPI Specification.
|
|
4
|
+
*
|
|
5
|
+
* The `OasServer` class encapsulates server connectivity information, including
|
|
6
|
+
* the server URL, optional description, and variable definitions for URL templating.
|
|
7
|
+
* Servers are used to specify different environments (development, staging, production)
|
|
8
|
+
* or different API versions that clients can connect to.
|
|
9
|
+
*
|
|
10
|
+
* @example Basic server
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const server = new OasServer({
|
|
13
|
+
* url: 'https://api.example.com/v1',
|
|
14
|
+
* description: 'Production API server'
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* @example Server with variables
|
|
19
|
+
* ```typescript
|
|
20
|
+
* const server = new OasServer({
|
|
21
|
+
* url: 'https://{environment}.example.com/{version}',
|
|
22
|
+
* description: 'Configurable API server',
|
|
23
|
+
* variables: {
|
|
24
|
+
* environment: new OasServerVariable({
|
|
25
|
+
* enum: ['api', 'staging', 'dev'],
|
|
26
|
+
* default: 'api',
|
|
27
|
+
* description: 'API environment'
|
|
28
|
+
* }),
|
|
29
|
+
* version: new OasServerVariable({
|
|
30
|
+
* default: 'v1',
|
|
31
|
+
* description: 'API version'
|
|
32
|
+
* })
|
|
33
|
+
* }
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
2
37
|
export class OasServer {
|
|
38
|
+
/**
|
|
39
|
+
* Creates a new OasServer instance.
|
|
40
|
+
*
|
|
41
|
+
* @param fields - Server configuration including URL, description, and variables
|
|
42
|
+
*/
|
|
3
43
|
constructor(fields) {
|
|
44
|
+
/** Type identifier for this OAS server */
|
|
4
45
|
Object.defineProperty(this, "oasType", {
|
|
5
46
|
enumerable: true,
|
|
6
47
|
configurable: true,
|
|
7
48
|
writable: true,
|
|
8
49
|
value: 'server'
|
|
9
50
|
});
|
|
51
|
+
/** Human-readable description of the server */
|
|
10
52
|
Object.defineProperty(this, "description", {
|
|
11
53
|
enumerable: true,
|
|
12
54
|
configurable: true,
|
|
13
55
|
writable: true,
|
|
14
56
|
value: void 0
|
|
15
57
|
});
|
|
58
|
+
/** Server URL with optional variable templating */
|
|
16
59
|
Object.defineProperty(this, "url", {
|
|
17
60
|
enumerable: true,
|
|
18
61
|
configurable: true,
|
|
19
62
|
writable: true,
|
|
20
63
|
value: void 0
|
|
21
64
|
});
|
|
65
|
+
/** Variable definitions for URL templating */
|
|
22
66
|
Object.defineProperty(this, "variables", {
|
|
23
67
|
enumerable: true,
|
|
24
68
|
configurable: true,
|
|
25
69
|
writable: true,
|
|
26
70
|
value: void 0
|
|
27
71
|
});
|
|
72
|
+
/** Custom extension fields (x-* properties) */
|
|
28
73
|
Object.defineProperty(this, "extensionFields", {
|
|
29
74
|
enumerable: true,
|
|
30
75
|
configurable: true,
|
|
@@ -36,15 +81,36 @@ export class OasServer {
|
|
|
36
81
|
this.variables = fields.variables;
|
|
37
82
|
this.extensionFields = fields.extensionFields;
|
|
38
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Determines if this server is a reference object.
|
|
86
|
+
*
|
|
87
|
+
* @returns Always false since servers are not reference objects in OpenAPI
|
|
88
|
+
*/
|
|
39
89
|
isRef() {
|
|
40
90
|
return false;
|
|
41
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Resolves this server object.
|
|
94
|
+
*
|
|
95
|
+
* @returns The server instance itself since it's already a concrete object
|
|
96
|
+
*/
|
|
42
97
|
resolve() {
|
|
43
98
|
return this;
|
|
44
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Resolves this server object one level.
|
|
102
|
+
*
|
|
103
|
+
* @returns The server instance itself since it's already a concrete object
|
|
104
|
+
*/
|
|
45
105
|
resolveOnce() {
|
|
46
106
|
return this;
|
|
47
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Converts this OAS server to an OpenAPI v3 JSON schema representation.
|
|
110
|
+
*
|
|
111
|
+
* @param _options - Conversion options (currently unused for server objects)
|
|
112
|
+
* @returns OpenAPI v3 server object with URL, description, and variables
|
|
113
|
+
*/
|
|
48
114
|
toJsonSchema(_options) {
|
|
49
115
|
return {
|
|
50
116
|
description: this.description,
|
package/esm/types/Brand.d.ts
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Brand Type System for SKMTC Core
|
|
3
|
+
*
|
|
4
|
+
* This module provides TypeScript branded types for creating type-safe identifiers
|
|
5
|
+
* and values that are structurally identical but nominally distinct. Branded types
|
|
6
|
+
* help prevent mixing up similar primitive types and provide better type safety
|
|
7
|
+
* across the SKMTC codebase.
|
|
8
|
+
*
|
|
9
|
+
* ## Key Features
|
|
10
|
+
*
|
|
11
|
+
* - **Type Safety**: Prevents accidental mixing of similar primitive types
|
|
12
|
+
* - **Nominal Typing**: Creates distinct types from the same underlying type
|
|
13
|
+
* - **Zero Runtime Cost**: Pure TypeScript compile-time construct
|
|
14
|
+
* - **Developer Experience**: Better IntelliSense and error messages
|
|
15
|
+
*
|
|
16
|
+
* @example Creating branded types
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import type { Brand } from '@skmtc/core/Brand';
|
|
19
|
+
*
|
|
20
|
+
* type UserId = Brand<string, 'UserId'>;
|
|
21
|
+
* type ProductId = Brand<string, 'ProductId'>;
|
|
22
|
+
*
|
|
23
|
+
* const userId: UserId = 'user-123' as UserId;
|
|
24
|
+
* const productId: ProductId = 'prod-456' as ProductId;
|
|
25
|
+
*
|
|
26
|
+
* // TypeScript will prevent this error:
|
|
27
|
+
* // const wrong: UserId = productId; // Type error!
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example Using with numbers
|
|
31
|
+
* ```typescript
|
|
32
|
+
* type Score = Brand<number, 'Score'>;
|
|
33
|
+
* type Percentage = Brand<number, 'Percentage'>;
|
|
34
|
+
*
|
|
35
|
+
* function calculateGrade(score: Score, total: Score): Percentage {
|
|
36
|
+
* return ((score / total) * 100) as Percentage;
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @module Brand
|
|
41
|
+
*/
|
|
1
42
|
/**
|
|
2
43
|
* Unique symbol used for branding types.
|
|
3
44
|
*
|
package/esm/types/Brand.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Brand.d.ts","sourceRoot":"","sources":["../../src/types/Brand.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,sBAAsB,CAAC;AAE9B,OAAO,CAAC,MAAM,KAAK,EAAE,OAAO,MAAM,CAAA;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,GAAG;IAAE,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
|
1
|
+
{"version":3,"file":"Brand.d.ts","sourceRoot":"","sources":["../../src/types/Brand.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH;;;;;;;;GAQG;AACH,OAAO,sBAAsB,CAAC;AAE9B,OAAO,CAAC,MAAM,KAAK,EAAE,OAAO,MAAM,CAAA;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,GAAG;IAAE,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
package/esm/types/Brand.js
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Brand Type System for SKMTC Core
|
|
3
|
+
*
|
|
4
|
+
* This module provides TypeScript branded types for creating type-safe identifiers
|
|
5
|
+
* and values that are structurally identical but nominally distinct. Branded types
|
|
6
|
+
* help prevent mixing up similar primitive types and provide better type safety
|
|
7
|
+
* across the SKMTC codebase.
|
|
8
|
+
*
|
|
9
|
+
* ## Key Features
|
|
10
|
+
*
|
|
11
|
+
* - **Type Safety**: Prevents accidental mixing of similar primitive types
|
|
12
|
+
* - **Nominal Typing**: Creates distinct types from the same underlying type
|
|
13
|
+
* - **Zero Runtime Cost**: Pure TypeScript compile-time construct
|
|
14
|
+
* - **Developer Experience**: Better IntelliSense and error messages
|
|
15
|
+
*
|
|
16
|
+
* @example Creating branded types
|
|
17
|
+
* ```typescript
|
|
18
|
+
* import type { Brand } from '@skmtc/core/Brand';
|
|
19
|
+
*
|
|
20
|
+
* type UserId = Brand<string, 'UserId'>;
|
|
21
|
+
* type ProductId = Brand<string, 'ProductId'>;
|
|
22
|
+
*
|
|
23
|
+
* const userId: UserId = 'user-123' as UserId;
|
|
24
|
+
* const productId: ProductId = 'prod-456' as ProductId;
|
|
25
|
+
*
|
|
26
|
+
* // TypeScript will prevent this error:
|
|
27
|
+
* // const wrong: UserId = productId; // Type error!
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example Using with numbers
|
|
31
|
+
* ```typescript
|
|
32
|
+
* type Score = Brand<number, 'Score'>;
|
|
33
|
+
* type Percentage = Brand<number, 'Percentage'>;
|
|
34
|
+
*
|
|
35
|
+
* function calculateGrade(score: Score, total: Score): Percentage {
|
|
36
|
+
* return ((score / total) * 100) as Percentage;
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @module Brand
|
|
41
|
+
*/
|
|
1
42
|
/**
|
|
2
43
|
* Unique symbol used for branding types.
|
|
3
44
|
*
|
package/package.json
CHANGED
|
@@ -1,15 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constructor fields for {@link OasContact}.
|
|
3
|
+
*
|
|
4
|
+
* Defines the configuration options for creating contact information,
|
|
5
|
+
* including name, URL, email, and extension fields.
|
|
6
|
+
*/
|
|
1
7
|
export type ContactFields = {
|
|
2
8
|
name?: string;
|
|
3
9
|
url?: string;
|
|
4
10
|
email?: string;
|
|
5
11
|
extensionFields?: Record<string, unknown>;
|
|
6
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* Represents a Contact Object in the OpenAPI Specification.
|
|
15
|
+
*
|
|
16
|
+
* The `OasContact` class encapsulates contact information for the API,
|
|
17
|
+
* providing details about who to contact for support, questions, or issues.
|
|
18
|
+
* This information is typically displayed in API documentation.
|
|
19
|
+
*
|
|
20
|
+
* @example Basic contact information
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { OasContact } from '@skmtc/core';
|
|
23
|
+
*
|
|
24
|
+
* const contact = new OasContact({
|
|
25
|
+
* name: 'API Support Team',
|
|
26
|
+
* email: 'support@example.com'
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @example Complete contact details
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const fullContact = new OasContact({
|
|
33
|
+
* name: 'John Doe',
|
|
34
|
+
* url: 'https://example.com/contact',
|
|
35
|
+
* email: 'john@example.com'
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
7
39
|
export declare class OasContact {
|
|
40
|
+
/** Type identifier for this OAS contact object */
|
|
8
41
|
oasType: "contact";
|
|
42
|
+
/** The identifying name of the contact person/organization */
|
|
9
43
|
name: string | undefined;
|
|
44
|
+
/** URL pointing to the contact information */
|
|
10
45
|
url: string | undefined;
|
|
46
|
+
/** Email address of the contact person/organization */
|
|
11
47
|
email: string | undefined;
|
|
48
|
+
/** Custom extension fields (x-* properties) for additional contact metadata */
|
|
12
49
|
extensionFields: Record<string, unknown> | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new OasContact instance.
|
|
52
|
+
*
|
|
53
|
+
* @param fields - Contact information fields including name, URL, and email
|
|
54
|
+
*/
|
|
13
55
|
constructor(fields?: ContactFields);
|
|
14
56
|
}
|
|
15
57
|
//# sourceMappingURL=Contact.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contact.d.ts","sourceRoot":"","sources":["../../../src/oas/contact/Contact.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED,qBAAa,UAAU;IACrB,OAAO,EAAG,SAAS,CAAS;IAE5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;IACvB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"Contact.d.ts","sourceRoot":"","sources":["../../../src/oas/contact/Contact.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,UAAU;IACrB,kDAAkD;IAClD,OAAO,EAAG,SAAS,CAAS;IAE5B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,8CAA8C;IAC9C,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;IACvB,uDAAuD;IACvD,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,+EAA+E;IAC/E,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IAEpD;;;;OAIG;gBACS,MAAM,GAAE,aAAkB;CAMvC"}
|
|
@@ -1,32 +1,68 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OasContact = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Represents a Contact Object in the OpenAPI Specification.
|
|
6
|
+
*
|
|
7
|
+
* The `OasContact` class encapsulates contact information for the API,
|
|
8
|
+
* providing details about who to contact for support, questions, or issues.
|
|
9
|
+
* This information is typically displayed in API documentation.
|
|
10
|
+
*
|
|
11
|
+
* @example Basic contact information
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { OasContact } from '@skmtc/core';
|
|
14
|
+
*
|
|
15
|
+
* const contact = new OasContact({
|
|
16
|
+
* name: 'API Support Team',
|
|
17
|
+
* email: 'support@example.com'
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example Complete contact details
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const fullContact = new OasContact({
|
|
24
|
+
* name: 'John Doe',
|
|
25
|
+
* url: 'https://example.com/contact',
|
|
26
|
+
* email: 'john@example.com'
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
4
30
|
class OasContact {
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new OasContact instance.
|
|
33
|
+
*
|
|
34
|
+
* @param fields - Contact information fields including name, URL, and email
|
|
35
|
+
*/
|
|
5
36
|
constructor(fields = {}) {
|
|
37
|
+
/** Type identifier for this OAS contact object */
|
|
6
38
|
Object.defineProperty(this, "oasType", {
|
|
7
39
|
enumerable: true,
|
|
8
40
|
configurable: true,
|
|
9
41
|
writable: true,
|
|
10
42
|
value: 'contact'
|
|
11
43
|
});
|
|
44
|
+
/** The identifying name of the contact person/organization */
|
|
12
45
|
Object.defineProperty(this, "name", {
|
|
13
46
|
enumerable: true,
|
|
14
47
|
configurable: true,
|
|
15
48
|
writable: true,
|
|
16
49
|
value: void 0
|
|
17
50
|
});
|
|
51
|
+
/** URL pointing to the contact information */
|
|
18
52
|
Object.defineProperty(this, "url", {
|
|
19
53
|
enumerable: true,
|
|
20
54
|
configurable: true,
|
|
21
55
|
writable: true,
|
|
22
56
|
value: void 0
|
|
23
57
|
});
|
|
58
|
+
/** Email address of the contact person/organization */
|
|
24
59
|
Object.defineProperty(this, "email", {
|
|
25
60
|
enumerable: true,
|
|
26
61
|
configurable: true,
|
|
27
62
|
writable: true,
|
|
28
63
|
value: void 0
|
|
29
64
|
});
|
|
65
|
+
/** Custom extension fields (x-* properties) for additional contact metadata */
|
|
30
66
|
Object.defineProperty(this, "extensionFields", {
|
|
31
67
|
enumerable: true,
|
|
32
68
|
configurable: true,
|
|
@@ -84,13 +84,49 @@ export type InfoFields = {
|
|
|
84
84
|
*/
|
|
85
85
|
export declare class OasInfo {
|
|
86
86
|
#private;
|
|
87
|
+
/** Type identifier for this OAS info object */
|
|
87
88
|
oasType: 'info';
|
|
89
|
+
/**
|
|
90
|
+
* Creates a new OasInfo instance.
|
|
91
|
+
*
|
|
92
|
+
* @param fields - API information fields including title, version, description, and contact details
|
|
93
|
+
*/
|
|
88
94
|
constructor(fields: InfoFields);
|
|
95
|
+
/**
|
|
96
|
+
* Gets the API title.
|
|
97
|
+
*
|
|
98
|
+
* @returns The title of the API
|
|
99
|
+
*/
|
|
89
100
|
get title(): string;
|
|
101
|
+
/**
|
|
102
|
+
* Gets the API description.
|
|
103
|
+
*
|
|
104
|
+
* @returns Optional detailed description of the API's purpose and functionality
|
|
105
|
+
*/
|
|
90
106
|
get description(): string | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Gets the terms of service URL.
|
|
109
|
+
*
|
|
110
|
+
* @returns Optional URL pointing to the API's terms of service
|
|
111
|
+
*/
|
|
91
112
|
get termsOfService(): string | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* Gets the contact information.
|
|
115
|
+
*
|
|
116
|
+
* @returns Optional contact information for API support and inquiries
|
|
117
|
+
*/
|
|
92
118
|
get contact(): OasContact | undefined;
|
|
119
|
+
/**
|
|
120
|
+
* Gets the license information.
|
|
121
|
+
*
|
|
122
|
+
* @returns Optional license information governing API usage
|
|
123
|
+
*/
|
|
93
124
|
get license(): OasLicense | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Gets the API version.
|
|
127
|
+
*
|
|
128
|
+
* @returns The version string of the API (e.g., '1.0.0', '2.1.3')
|
|
129
|
+
*/
|
|
94
130
|
get version(): string;
|
|
95
131
|
/** Specification Extension fields */
|
|
96
132
|
get extensionFields(): Record<string, unknown> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Info.d.ts","sourceRoot":"","sources":["../../../src/oas/info/Info.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,0CAA0C;IAC1C,OAAO,EAAE,MAAM,CAAA;IACf,+BAA+B;IAC/B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACnC,kDAAkD;IAClD,OAAO,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IAChC,kDAAkD;IAClD,OAAO,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;IAChC,+CAA+C;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,UAAU,GAAG,SAAS,CAEpC;IAED;;;;OAIG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,qCAAqC;IACrC,IAAI,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAEzD;CACF"}
|
package/script/oas/info/Info.js
CHANGED
|
@@ -77,31 +77,68 @@ require("../../_dnt.polyfills.js");
|
|
|
77
77
|
* ```
|
|
78
78
|
*/
|
|
79
79
|
class OasInfo {
|
|
80
|
+
/**
|
|
81
|
+
* Creates a new OasInfo instance.
|
|
82
|
+
*
|
|
83
|
+
* @param fields - API information fields including title, version, description, and contact details
|
|
84
|
+
*/
|
|
80
85
|
constructor(fields) {
|
|
86
|
+
/** Type identifier for this OAS info object */
|
|
81
87
|
Object.defineProperty(this, "oasType", {
|
|
82
88
|
enumerable: true,
|
|
83
89
|
configurable: true,
|
|
84
90
|
writable: true,
|
|
85
91
|
value: 'info'
|
|
86
92
|
});
|
|
93
|
+
/** Private storage for all info fields */
|
|
87
94
|
_OasInfo_fields.set(this, void 0);
|
|
88
95
|
__classPrivateFieldSet(this, _OasInfo_fields, fields, "f");
|
|
89
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Gets the API title.
|
|
99
|
+
*
|
|
100
|
+
* @returns The title of the API
|
|
101
|
+
*/
|
|
90
102
|
get title() {
|
|
91
103
|
return __classPrivateFieldGet(this, _OasInfo_fields, "f").title;
|
|
92
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Gets the API description.
|
|
107
|
+
*
|
|
108
|
+
* @returns Optional detailed description of the API's purpose and functionality
|
|
109
|
+
*/
|
|
93
110
|
get description() {
|
|
94
111
|
return __classPrivateFieldGet(this, _OasInfo_fields, "f").description;
|
|
95
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Gets the terms of service URL.
|
|
115
|
+
*
|
|
116
|
+
* @returns Optional URL pointing to the API's terms of service
|
|
117
|
+
*/
|
|
96
118
|
get termsOfService() {
|
|
97
119
|
return __classPrivateFieldGet(this, _OasInfo_fields, "f").termsOfService;
|
|
98
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Gets the contact information.
|
|
123
|
+
*
|
|
124
|
+
* @returns Optional contact information for API support and inquiries
|
|
125
|
+
*/
|
|
99
126
|
get contact() {
|
|
100
127
|
return __classPrivateFieldGet(this, _OasInfo_fields, "f").contact;
|
|
101
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Gets the license information.
|
|
131
|
+
*
|
|
132
|
+
* @returns Optional license information governing API usage
|
|
133
|
+
*/
|
|
102
134
|
get license() {
|
|
103
135
|
return __classPrivateFieldGet(this, _OasInfo_fields, "f").license;
|
|
104
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Gets the API version.
|
|
139
|
+
*
|
|
140
|
+
* @returns The version string of the API (e.g., '1.0.0', '2.1.3')
|
|
141
|
+
*/
|
|
105
142
|
get version() {
|
|
106
143
|
return __classPrivateFieldGet(this, _OasInfo_fields, "f").version;
|
|
107
144
|
}
|
|
@@ -96,13 +96,30 @@ export type MediaTypeFields = {
|
|
|
96
96
|
* ```
|
|
97
97
|
*/
|
|
98
98
|
export declare class OasMediaType {
|
|
99
|
+
/** Type identifier for this OAS media type */
|
|
99
100
|
oasType: 'mediaType';
|
|
101
|
+
/** The media type identifier (e.g., 'application/json', 'text/xml') */
|
|
100
102
|
mediaType: string;
|
|
103
|
+
/** The schema defining the structure and validation rules for the content */
|
|
101
104
|
schema: OasSchema | OasRef<'schema'> | undefined;
|
|
105
|
+
/** Example values demonstrating the media type content */
|
|
102
106
|
examples: Record<string, OasExample | OasRef<'example'>> | undefined;
|
|
107
|
+
/** Custom extension fields (x-* properties) defined for this media type */
|
|
103
108
|
extensionFields: Record<string, unknown> | undefined;
|
|
109
|
+
/** Encoding information for multipart and form data serialization */
|
|
104
110
|
encoding?: Record<string, unknown> | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Creates a new OasMediaType instance.
|
|
113
|
+
*
|
|
114
|
+
* @param fields - Media type configuration including content schema, examples, and encoding
|
|
115
|
+
*/
|
|
105
116
|
constructor(fields: MediaTypeFields);
|
|
117
|
+
/**
|
|
118
|
+
* Converts this OAS media type to an OpenAPI v3 JSON schema representation.
|
|
119
|
+
*
|
|
120
|
+
* @param options - Conversion options including reference handling and formatting preferences
|
|
121
|
+
* @returns OpenAPI v3 media type object with schema and examples
|
|
122
|
+
*/
|
|
106
123
|
toJsonSchema(options: ToJsonSchemaOptions): OpenAPIV3.MediaTypeObject;
|
|
107
124
|
}
|
|
108
125
|
//# sourceMappingURL=MediaType.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaType.d.ts","sourceRoot":"","sources":["../../../src/oas/mediaType/MediaType.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,mEAAmE;IACnE,SAAS,EAAE,MAAM,CAAA;IACjB,uDAAuD;IACvD,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAA;IACjD,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,SAAS,CAAA;IACrE,+CAA+C;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzC,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,G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+C;IAC/C,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzC,sDAAsD;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;CAC/C,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4EG;AACH,qBAAa,YAAY;IACvB,8CAA8C;IAC9C,OAAO,EAAE,WAAW,CAAc;IAClC,uEAAuE;IACvE,SAAS,EAAE,MAAM,CAAA;IACjB,6EAA6E;IAC7E,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAA;IAChD,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,SAAS,CAAA;IACpE,2EAA2E;IAC3E,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IACpD,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IAC9C;;;;OAIG;gBACS,MAAM,EAAE,eAAe;IAQnC;;;;;OAKG;IACH,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,SAAS,CAAC,eAAe;CAMtE"}
|
|
@@ -79,37 +79,48 @@ exports.OasMediaType = void 0;
|
|
|
79
79
|
* ```
|
|
80
80
|
*/
|
|
81
81
|
class OasMediaType {
|
|
82
|
+
/**
|
|
83
|
+
* Creates a new OasMediaType instance.
|
|
84
|
+
*
|
|
85
|
+
* @param fields - Media type configuration including content schema, examples, and encoding
|
|
86
|
+
*/
|
|
82
87
|
constructor(fields) {
|
|
88
|
+
/** Type identifier for this OAS media type */
|
|
83
89
|
Object.defineProperty(this, "oasType", {
|
|
84
90
|
enumerable: true,
|
|
85
91
|
configurable: true,
|
|
86
92
|
writable: true,
|
|
87
93
|
value: 'mediaType'
|
|
88
94
|
});
|
|
95
|
+
/** The media type identifier (e.g., 'application/json', 'text/xml') */
|
|
89
96
|
Object.defineProperty(this, "mediaType", {
|
|
90
97
|
enumerable: true,
|
|
91
98
|
configurable: true,
|
|
92
99
|
writable: true,
|
|
93
100
|
value: void 0
|
|
94
101
|
});
|
|
102
|
+
/** The schema defining the structure and validation rules for the content */
|
|
95
103
|
Object.defineProperty(this, "schema", {
|
|
96
104
|
enumerable: true,
|
|
97
105
|
configurable: true,
|
|
98
106
|
writable: true,
|
|
99
107
|
value: void 0
|
|
100
108
|
});
|
|
109
|
+
/** Example values demonstrating the media type content */
|
|
101
110
|
Object.defineProperty(this, "examples", {
|
|
102
111
|
enumerable: true,
|
|
103
112
|
configurable: true,
|
|
104
113
|
writable: true,
|
|
105
114
|
value: void 0
|
|
106
115
|
});
|
|
116
|
+
/** Custom extension fields (x-* properties) defined for this media type */
|
|
107
117
|
Object.defineProperty(this, "extensionFields", {
|
|
108
118
|
enumerable: true,
|
|
109
119
|
configurable: true,
|
|
110
120
|
writable: true,
|
|
111
121
|
value: void 0
|
|
112
122
|
});
|
|
123
|
+
/** Encoding information for multipart and form data serialization */
|
|
113
124
|
Object.defineProperty(this, "encoding", {
|
|
114
125
|
enumerable: true,
|
|
115
126
|
configurable: true,
|
|
@@ -122,6 +133,12 @@ class OasMediaType {
|
|
|
122
133
|
this.encoding = fields.encoding;
|
|
123
134
|
this.extensionFields = fields.extensionFields;
|
|
124
135
|
}
|
|
136
|
+
/**
|
|
137
|
+
* Converts this OAS media type to an OpenAPI v3 JSON schema representation.
|
|
138
|
+
*
|
|
139
|
+
* @param options - Conversion options including reference handling and formatting preferences
|
|
140
|
+
* @returns OpenAPI v3 media type object with schema and examples
|
|
141
|
+
*/
|
|
125
142
|
toJsonSchema(options) {
|
|
126
143
|
return {
|
|
127
144
|
schema: this.schema?.toJsonSchema(options),
|
|
@@ -65,6 +65,12 @@ export type OasParameterRefData = {
|
|
|
65
65
|
* Valibot schema for validating parameter reference data.
|
|
66
66
|
*/
|
|
67
67
|
export declare const oasParameterRefData: v.GenericSchema<OasParameterRefData>;
|
|
68
|
+
/**
|
|
69
|
+
* Data type for OpenAPI example reference objects.
|
|
70
|
+
*
|
|
71
|
+
* Represents $ref references to example objects in OpenAPI documents,
|
|
72
|
+
* enabling example reuse across multiple schema definitions and operations.
|
|
73
|
+
*/
|
|
68
74
|
export type OasExampleRefData = {
|
|
69
75
|
oasType: 'ref';
|
|
70
76
|
refType: 'example';
|
|
@@ -72,7 +78,16 @@ export type OasExampleRefData = {
|
|
|
72
78
|
summary?: string;
|
|
73
79
|
description?: string;
|
|
74
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* Valibot schema for validating example reference data.
|
|
83
|
+
*/
|
|
75
84
|
export declare const oasExampleRefData: v.GenericSchema<OasExampleRefData>;
|
|
85
|
+
/**
|
|
86
|
+
* Data type for OpenAPI request body reference objects.
|
|
87
|
+
*
|
|
88
|
+
* Represents $ref references to request body objects in OpenAPI documents,
|
|
89
|
+
* allowing request body definitions to be reused across operations.
|
|
90
|
+
*/
|
|
76
91
|
export type OasRequestBodyRefData = {
|
|
77
92
|
oasType: 'ref';
|
|
78
93
|
refType: 'requestBody';
|
|
@@ -80,7 +95,16 @@ export type OasRequestBodyRefData = {
|
|
|
80
95
|
summary?: string;
|
|
81
96
|
description?: string;
|
|
82
97
|
};
|
|
98
|
+
/**
|
|
99
|
+
* Valibot schema for validating request body reference data.
|
|
100
|
+
*/
|
|
83
101
|
export declare const oasRequestBodyRefData: v.GenericSchema<OasRequestBodyRefData>;
|
|
102
|
+
/**
|
|
103
|
+
* Data type for OpenAPI header reference objects.
|
|
104
|
+
*
|
|
105
|
+
* Represents $ref references to header objects in OpenAPI documents,
|
|
106
|
+
* enabling header definition reuse across operations and responses.
|
|
107
|
+
*/
|
|
84
108
|
export type OasHeaderRefData = {
|
|
85
109
|
oasType: 'ref';
|
|
86
110
|
refType: 'header';
|
|
@@ -88,13 +112,37 @@ export type OasHeaderRefData = {
|
|
|
88
112
|
summary?: string;
|
|
89
113
|
description?: string;
|
|
90
114
|
};
|
|
115
|
+
/**
|
|
116
|
+
* Valibot schema for validating header reference data.
|
|
117
|
+
*/
|
|
91
118
|
export declare const oasHeaderRefData: v.GenericSchema<OasHeaderRefData>;
|
|
119
|
+
/**
|
|
120
|
+
* Data type for OpenAPI security scheme reference objects.
|
|
121
|
+
*
|
|
122
|
+
* Represents $ref references to security scheme objects in OpenAPI documents,
|
|
123
|
+
* allowing security scheme definitions to be reused across operations.
|
|
124
|
+
*/
|
|
92
125
|
export type OasSecuritySchemeRefData = {
|
|
93
126
|
oasType: 'ref';
|
|
94
127
|
refType: 'securityScheme';
|
|
95
128
|
$ref: string;
|
|
96
129
|
};
|
|
130
|
+
/**
|
|
131
|
+
* Valibot schema for validating security scheme reference data.
|
|
132
|
+
*/
|
|
97
133
|
export declare const oasSecuritySchemeRefData: v.GenericSchema<OasSecuritySchemeRefData>;
|
|
134
|
+
/**
|
|
135
|
+
* Union type representing all possible OpenAPI reference data types.
|
|
136
|
+
*
|
|
137
|
+
* Encompasses all supported reference types in the OpenAPI specification,
|
|
138
|
+
* providing type-safe handling of references to various component types.
|
|
139
|
+
*/
|
|
98
140
|
export type OasRefData = OasSchemaRefData | OasResponseRefData | OasParameterRefData | OasExampleRefData | OasRequestBodyRefData | OasHeaderRefData | OasSecuritySchemeRefData;
|
|
141
|
+
/**
|
|
142
|
+
* Valibot schema for validating any OpenAPI reference data.
|
|
143
|
+
*
|
|
144
|
+
* Union schema that validates all supported reference types,
|
|
145
|
+
* ensuring type safety across the entire reference system.
|
|
146
|
+
*/
|
|
99
147
|
export declare const oasRefData: v.GenericSchema<OasRefData>;
|
|
100
148
|
//# sourceMappingURL=ref-types.d.ts.map
|