@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ref-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O,MAAM,wBAAwB,EAAE,CAAC,CAAC,aAAa,CAAC,wBAAwB,CAI7E,CAAA;AAUF;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAClB,gBAAgB,GAChB,kBAAkB,GAClB,mBAAmB,GACnB,iBAAiB,GACjB,qBAAqB,GACrB,gBAAgB,GAChB,wBAAwB,CAAA;AAG5B;;;;;GAKG;AACH,eAAO,MAAM,UAAU,EAAE,CAAC,CAAC,aAAa,CAAC,UAAU,CASjD,CAAA"}
|
|
@@ -66,6 +66,9 @@ exports.oasParameterRefData = v.object({
|
|
|
66
66
|
summary: v.optional(v.string()),
|
|
67
67
|
description: v.optional(markdown_types_js_1.markdown)
|
|
68
68
|
});
|
|
69
|
+
/**
|
|
70
|
+
* Valibot schema for validating example reference data.
|
|
71
|
+
*/
|
|
69
72
|
exports.oasExampleRefData = v.object({
|
|
70
73
|
oasType: v.literal('ref'),
|
|
71
74
|
refType: v.literal('example'),
|
|
@@ -73,6 +76,9 @@ exports.oasExampleRefData = v.object({
|
|
|
73
76
|
summary: v.optional(v.string()),
|
|
74
77
|
description: v.optional(markdown_types_js_1.markdown)
|
|
75
78
|
});
|
|
79
|
+
/**
|
|
80
|
+
* Valibot schema for validating request body reference data.
|
|
81
|
+
*/
|
|
76
82
|
exports.oasRequestBodyRefData = v.object({
|
|
77
83
|
oasType: v.literal('ref'),
|
|
78
84
|
refType: v.literal('requestBody'),
|
|
@@ -80,6 +86,9 @@ exports.oasRequestBodyRefData = v.object({
|
|
|
80
86
|
summary: v.optional(v.string()),
|
|
81
87
|
description: v.optional(markdown_types_js_1.markdown)
|
|
82
88
|
});
|
|
89
|
+
/**
|
|
90
|
+
* Valibot schema for validating header reference data.
|
|
91
|
+
*/
|
|
83
92
|
exports.oasHeaderRefData = v.object({
|
|
84
93
|
oasType: v.literal('ref'),
|
|
85
94
|
refType: v.literal('header'),
|
|
@@ -87,12 +96,21 @@ exports.oasHeaderRefData = v.object({
|
|
|
87
96
|
summary: v.optional(v.string()),
|
|
88
97
|
description: v.optional(markdown_types_js_1.markdown)
|
|
89
98
|
});
|
|
99
|
+
/**
|
|
100
|
+
* Valibot schema for validating security scheme reference data.
|
|
101
|
+
*/
|
|
90
102
|
exports.oasSecuritySchemeRefData = v.object({
|
|
91
103
|
oasType: v.literal('ref'),
|
|
92
104
|
refType: v.literal('securityScheme'),
|
|
93
105
|
$ref: v.string()
|
|
94
106
|
});
|
|
95
107
|
// OasPathItemRefData
|
|
108
|
+
/**
|
|
109
|
+
* Valibot schema for validating any OpenAPI reference data.
|
|
110
|
+
*
|
|
111
|
+
* Union schema that validates all supported reference types,
|
|
112
|
+
* ensuring type safety across the entire reference system.
|
|
113
|
+
*/
|
|
96
114
|
exports.oasRefData = v.union([
|
|
97
115
|
exports.oasSchemaRefData,
|
|
98
116
|
exports.oasResponseRefData,
|
|
@@ -2,22 +2,94 @@ import "../../_dnt.polyfills.js";
|
|
|
2
2
|
import type { ToJsonSchemaOptions } from '../schema/Schema.js';
|
|
3
3
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
4
4
|
import type { OasServerVariable } from '../serverVariable/ServerVariable.js';
|
|
5
|
+
/**
|
|
6
|
+
* Constructor fields for {@link OasServer}.
|
|
7
|
+
*
|
|
8
|
+
* Defines the configuration options available when creating server instances,
|
|
9
|
+
* including URL, description, variables, and extension fields.
|
|
10
|
+
*/
|
|
5
11
|
export type ServerFields = {
|
|
6
12
|
description?: string | undefined;
|
|
7
13
|
url: string;
|
|
8
14
|
variables?: Record<string, OasServerVariable> | undefined;
|
|
9
15
|
extensionFields?: Record<string, unknown>;
|
|
10
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Represents a Server Object in the OpenAPI Specification.
|
|
19
|
+
*
|
|
20
|
+
* The `OasServer` class encapsulates server connectivity information, including
|
|
21
|
+
* the server URL, optional description, and variable definitions for URL templating.
|
|
22
|
+
* Servers are used to specify different environments (development, staging, production)
|
|
23
|
+
* or different API versions that clients can connect to.
|
|
24
|
+
*
|
|
25
|
+
* @example Basic server
|
|
26
|
+
* ```typescript
|
|
27
|
+
* const server = new OasServer({
|
|
28
|
+
* url: 'https://api.example.com/v1',
|
|
29
|
+
* description: 'Production API server'
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example Server with variables
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const server = new OasServer({
|
|
36
|
+
* url: 'https://{environment}.example.com/{version}',
|
|
37
|
+
* description: 'Configurable API server',
|
|
38
|
+
* variables: {
|
|
39
|
+
* environment: new OasServerVariable({
|
|
40
|
+
* enum: ['api', 'staging', 'dev'],
|
|
41
|
+
* default: 'api',
|
|
42
|
+
* description: 'API environment'
|
|
43
|
+
* }),
|
|
44
|
+
* version: new OasServerVariable({
|
|
45
|
+
* default: 'v1',
|
|
46
|
+
* description: 'API version'
|
|
47
|
+
* })
|
|
48
|
+
* }
|
|
49
|
+
* });
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
11
52
|
export declare class OasServer {
|
|
53
|
+
/** Type identifier for this OAS server */
|
|
12
54
|
oasType: 'server';
|
|
55
|
+
/** Human-readable description of the server */
|
|
13
56
|
description: string | undefined;
|
|
57
|
+
/** Server URL with optional variable templating */
|
|
14
58
|
url: string;
|
|
59
|
+
/** Variable definitions for URL templating */
|
|
15
60
|
variables: Record<string, OasServerVariable> | undefined;
|
|
61
|
+
/** Custom extension fields (x-* properties) */
|
|
16
62
|
extensionFields: Record<string, unknown> | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Creates a new OasServer instance.
|
|
65
|
+
*
|
|
66
|
+
* @param fields - Server configuration including URL, description, and variables
|
|
67
|
+
*/
|
|
17
68
|
constructor(fields: ServerFields);
|
|
69
|
+
/**
|
|
70
|
+
* Determines if this server is a reference object.
|
|
71
|
+
*
|
|
72
|
+
* @returns Always false since servers are not reference objects in OpenAPI
|
|
73
|
+
*/
|
|
18
74
|
isRef(): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Resolves this server object.
|
|
77
|
+
*
|
|
78
|
+
* @returns The server instance itself since it's already a concrete object
|
|
79
|
+
*/
|
|
19
80
|
resolve(): OasServer;
|
|
81
|
+
/**
|
|
82
|
+
* Resolves this server object one level.
|
|
83
|
+
*
|
|
84
|
+
* @returns The server instance itself since it's already a concrete object
|
|
85
|
+
*/
|
|
20
86
|
resolveOnce(): OasServer;
|
|
87
|
+
/**
|
|
88
|
+
* Converts this OAS server to an OpenAPI v3 JSON schema representation.
|
|
89
|
+
*
|
|
90
|
+
* @param _options - Conversion options (currently unused for server objects)
|
|
91
|
+
* @returns OpenAPI v3 server object with URL, description, and variables
|
|
92
|
+
*/
|
|
21
93
|
toJsonSchema(_options: ToJsonSchemaOptions): OpenAPIV3.ServerObject;
|
|
22
94
|
}
|
|
23
95
|
//# sourceMappingURL=Server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Server.d.ts","sourceRoot":"","sources":["../../../src/oas/server/Server.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAE5E,MAAM,MAAM,YAAY,GAAG;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GAAG,SAAS,CAAA;IACzD,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC1C,CAAA;AAED,qBAAa,SAAS;IACpB,OAAO,EAAE,QAAQ,CAAW;IAC5B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,SAAS,EAAE,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IACH,WAAW,IAAI,SAAS;IAIxB;;;;;OAKG;IACH,YAAY,CAAC,QAAQ,EAAE,mBAAmB,GAAG,SAAS,CAAC,YAAY;CAOpE"}
|
|
@@ -2,32 +2,77 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OasServer = void 0;
|
|
4
4
|
require("../../_dnt.polyfills.js");
|
|
5
|
+
/**
|
|
6
|
+
* Represents a Server Object in the OpenAPI Specification.
|
|
7
|
+
*
|
|
8
|
+
* The `OasServer` class encapsulates server connectivity information, including
|
|
9
|
+
* the server URL, optional description, and variable definitions for URL templating.
|
|
10
|
+
* Servers are used to specify different environments (development, staging, production)
|
|
11
|
+
* or different API versions that clients can connect to.
|
|
12
|
+
*
|
|
13
|
+
* @example Basic server
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const server = new OasServer({
|
|
16
|
+
* url: 'https://api.example.com/v1',
|
|
17
|
+
* description: 'Production API server'
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @example Server with variables
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const server = new OasServer({
|
|
24
|
+
* url: 'https://{environment}.example.com/{version}',
|
|
25
|
+
* description: 'Configurable API server',
|
|
26
|
+
* variables: {
|
|
27
|
+
* environment: new OasServerVariable({
|
|
28
|
+
* enum: ['api', 'staging', 'dev'],
|
|
29
|
+
* default: 'api',
|
|
30
|
+
* description: 'API environment'
|
|
31
|
+
* }),
|
|
32
|
+
* version: new OasServerVariable({
|
|
33
|
+
* default: 'v1',
|
|
34
|
+
* description: 'API version'
|
|
35
|
+
* })
|
|
36
|
+
* }
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
5
40
|
class OasServer {
|
|
41
|
+
/**
|
|
42
|
+
* Creates a new OasServer instance.
|
|
43
|
+
*
|
|
44
|
+
* @param fields - Server configuration including URL, description, and variables
|
|
45
|
+
*/
|
|
6
46
|
constructor(fields) {
|
|
47
|
+
/** Type identifier for this OAS server */
|
|
7
48
|
Object.defineProperty(this, "oasType", {
|
|
8
49
|
enumerable: true,
|
|
9
50
|
configurable: true,
|
|
10
51
|
writable: true,
|
|
11
52
|
value: 'server'
|
|
12
53
|
});
|
|
54
|
+
/** Human-readable description of the server */
|
|
13
55
|
Object.defineProperty(this, "description", {
|
|
14
56
|
enumerable: true,
|
|
15
57
|
configurable: true,
|
|
16
58
|
writable: true,
|
|
17
59
|
value: void 0
|
|
18
60
|
});
|
|
61
|
+
/** Server URL with optional variable templating */
|
|
19
62
|
Object.defineProperty(this, "url", {
|
|
20
63
|
enumerable: true,
|
|
21
64
|
configurable: true,
|
|
22
65
|
writable: true,
|
|
23
66
|
value: void 0
|
|
24
67
|
});
|
|
68
|
+
/** Variable definitions for URL templating */
|
|
25
69
|
Object.defineProperty(this, "variables", {
|
|
26
70
|
enumerable: true,
|
|
27
71
|
configurable: true,
|
|
28
72
|
writable: true,
|
|
29
73
|
value: void 0
|
|
30
74
|
});
|
|
75
|
+
/** Custom extension fields (x-* properties) */
|
|
31
76
|
Object.defineProperty(this, "extensionFields", {
|
|
32
77
|
enumerable: true,
|
|
33
78
|
configurable: true,
|
|
@@ -39,15 +84,36 @@ class OasServer {
|
|
|
39
84
|
this.variables = fields.variables;
|
|
40
85
|
this.extensionFields = fields.extensionFields;
|
|
41
86
|
}
|
|
87
|
+
/**
|
|
88
|
+
* Determines if this server is a reference object.
|
|
89
|
+
*
|
|
90
|
+
* @returns Always false since servers are not reference objects in OpenAPI
|
|
91
|
+
*/
|
|
42
92
|
isRef() {
|
|
43
93
|
return false;
|
|
44
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Resolves this server object.
|
|
97
|
+
*
|
|
98
|
+
* @returns The server instance itself since it's already a concrete object
|
|
99
|
+
*/
|
|
45
100
|
resolve() {
|
|
46
101
|
return this;
|
|
47
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Resolves this server object one level.
|
|
105
|
+
*
|
|
106
|
+
* @returns The server instance itself since it's already a concrete object
|
|
107
|
+
*/
|
|
48
108
|
resolveOnce() {
|
|
49
109
|
return this;
|
|
50
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Converts this OAS server to an OpenAPI v3 JSON schema representation.
|
|
113
|
+
*
|
|
114
|
+
* @param _options - Conversion options (currently unused for server objects)
|
|
115
|
+
* @returns OpenAPI v3 server object with URL, description, and variables
|
|
116
|
+
*/
|
|
51
117
|
toJsonSchema(_options) {
|
|
52
118
|
return {
|
|
53
119
|
description: this.description,
|
package/script/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
|
*
|
|
@@ -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/script/types/Brand.js
CHANGED
|
@@ -1,4 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Brand Type System for SKMTC Core
|
|
4
|
+
*
|
|
5
|
+
* This module provides TypeScript branded types for creating type-safe identifiers
|
|
6
|
+
* and values that are structurally identical but nominally distinct. Branded types
|
|
7
|
+
* help prevent mixing up similar primitive types and provide better type safety
|
|
8
|
+
* across the SKMTC codebase.
|
|
9
|
+
*
|
|
10
|
+
* ## Key Features
|
|
11
|
+
*
|
|
12
|
+
* - **Type Safety**: Prevents accidental mixing of similar primitive types
|
|
13
|
+
* - **Nominal Typing**: Creates distinct types from the same underlying type
|
|
14
|
+
* - **Zero Runtime Cost**: Pure TypeScript compile-time construct
|
|
15
|
+
* - **Developer Experience**: Better IntelliSense and error messages
|
|
16
|
+
*
|
|
17
|
+
* @example Creating branded types
|
|
18
|
+
* ```typescript
|
|
19
|
+
* import type { Brand } from '@skmtc/core/Brand';
|
|
20
|
+
*
|
|
21
|
+
* type UserId = Brand<string, 'UserId'>;
|
|
22
|
+
* type ProductId = Brand<string, 'ProductId'>;
|
|
23
|
+
*
|
|
24
|
+
* const userId: UserId = 'user-123' as UserId;
|
|
25
|
+
* const productId: ProductId = 'prod-456' as ProductId;
|
|
26
|
+
*
|
|
27
|
+
* // TypeScript will prevent this error:
|
|
28
|
+
* // const wrong: UserId = productId; // Type error!
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example Using with numbers
|
|
32
|
+
* ```typescript
|
|
33
|
+
* type Score = Brand<number, 'Score'>;
|
|
34
|
+
* type Percentage = Brand<number, 'Percentage'>;
|
|
35
|
+
*
|
|
36
|
+
* function calculateGrade(score: Score, total: Score): Percentage {
|
|
37
|
+
* return ((score / total) * 100) as Percentage;
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @module Brand
|
|
42
|
+
*/
|
|
2
43
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
44
|
/**
|
|
4
45
|
* Unique symbol used for branding types.
|