Skip to content

Commit 177e364

Browse files
authored
feat(ns-asyncapi-3): add package for apidom-ns-async-api-3 (#5032)
1 parent a8c8f4f commit 177e364

File tree

558 files changed

+31419
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

558 files changed

+31419
-28
lines changed

package-lock.json

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/apidom-ns-asyncapi-2/src/index.ts

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export type { Format } from './media-types.ts';
1717
// eslint-disable-next-line no-restricted-exports
1818
export { default } from './namespace.ts';
1919

20-
export type { default as specificationObj } from './refractor/specification.ts';
20+
export { default as specificationObj } from './refractor/specification.ts';
2121

2222
export { default as refractorPluginReplaceEmptyElement } from './refractor/plugins/replace-empty-element.ts';
2323

@@ -646,8 +646,8 @@ export type {
646646
PropertiesVisitorOptions as SchemaPropertiesVisitorOptions,
647647
JSONSchemaPropertiesVisitor,
648648
} from './refractor/visitors/async-api-2/schema/PropertiesVisitor.ts';
649+
export { default as SchemaOrReferenceVisitor } from './refractor/visitors/async-api-2/schema/SchemaOrReferenceVisitor.ts';
649650
export type {
650-
default as SchemaOrReferenceVisitor,
651651
SchemaOrReferenceVisitorOptions,
652652
JSONSchemaOrJSONReferenceVisitor,
653653
} from './refractor/visitors/async-api-2/schema/SchemaOrReferenceVisitor.ts';
@@ -859,29 +859,29 @@ export {
859859
WebSocketServerBindingElement,
860860
} from './refractor/registration.ts';
861861

862-
export type { default as ChannelItemsServersElement } from './elements/nces/ChannelItemsServers.ts';
863-
export type { default as ComponentsChannelBindingsElement } from './elements/nces/ComponentsChannelBindings.ts';
864-
export type { default as ComponentsChannelsElement } from './elements/nces/ComponentsChannels.ts';
865-
export type { default as ComponentsCorrelationIDsElement } from './elements/nces/ComponentsCorrelationIDs.ts';
866-
export type { default as ComponentsMessageBindingsElement } from './elements/nces/ComponentsMessageBindings.ts';
867-
export type { default as ComponentsMessagesElement } from './elements/nces/ComponentsMessages.ts';
868-
export type { default as ComponentsMessageTraitsElement } from './elements/nces/ComponentsMessageTraits.ts';
869-
export type { default as ComponentsOperationBindingsElement } from './elements/nces/ComponentsOperationBindings.ts';
870-
export type { default as ComponentsOperationTraitsElement } from './elements/nces/ComponentsOperationTraits.ts';
871-
export type { default as ComponentsParametersElement } from './elements/nces/ComponentsParameters.ts';
872-
export type { default as ComponentsSchemasElement } from './elements/nces/ComponentsSchemas.ts';
873-
export type { default as ComponentsSecuritySchemesElement } from './elements/nces/ComponentsSecuritySchemes.ts';
874-
export type { default as ComponentsServerBindingsElement } from './elements/nces/ComponentsServerBindings.ts';
875-
export type { default as ComponentsServersElement } from './elements/nces/ComponentsServers.ts';
876-
export type { default as ComponentsServerVariablesElement } from './elements/nces/ComponentsServerVariables.ts';
877-
export type { default as MessageExamplesElement } from './elements/nces/MessageExamples.ts';
878-
export type { default as MessageTraitExamplesElement } from './elements/nces/MessageTraitExamples.ts';
879-
export type { default as MessageTraitsElement } from './elements/nces/MessageTraits.ts';
880-
export type { default as OAuthFlowScopesElement } from './elements/nces/OAuthFlowScopes.ts';
881-
export type { default as OperationMessageElement } from './elements/nces/OperationMessage.ts';
882-
export type { default as OperationMessageMapElement } from './elements/nces/OperationMessageMap.ts';
883-
export type { default as OperationSecurityElement } from './elements/nces/OperationSecurity.ts';
884-
export type { default as OperationTraitsElement } from './elements/nces/OperationTraits.ts';
885-
export type { default as OperationTraitSecurityElement } from './elements/nces/OperationTraitSecurity.ts';
886-
export type { default as ServerSecurityElement } from './elements/nces/ServerSecurity.ts';
887-
export type { default as ServerVariablesElement } from './elements/nces/ServerVariables.ts';
862+
export { default as ChannelItemsServersElement } from './elements/nces/ChannelItemsServers.ts';
863+
export { default as ComponentsChannelBindingsElement } from './elements/nces/ComponentsChannelBindings.ts';
864+
export { default as ComponentsChannelsElement } from './elements/nces/ComponentsChannels.ts';
865+
export { default as ComponentsCorrelationIDsElement } from './elements/nces/ComponentsCorrelationIDs.ts';
866+
export { default as ComponentsMessageBindingsElement } from './elements/nces/ComponentsMessageBindings.ts';
867+
export { default as ComponentsMessagesElement } from './elements/nces/ComponentsMessages.ts';
868+
export { default as ComponentsMessageTraitsElement } from './elements/nces/ComponentsMessageTraits.ts';
869+
export { default as ComponentsOperationBindingsElement } from './elements/nces/ComponentsOperationBindings.ts';
870+
export { default as ComponentsOperationTraitsElement } from './elements/nces/ComponentsOperationTraits.ts';
871+
export { default as ComponentsParametersElement } from './elements/nces/ComponentsParameters.ts';
872+
export { default as ComponentsSchemasElement } from './elements/nces/ComponentsSchemas.ts';
873+
export { default as ComponentsSecuritySchemesElement } from './elements/nces/ComponentsSecuritySchemes.ts';
874+
export { default as ComponentsServerBindingsElement } from './elements/nces/ComponentsServerBindings.ts';
875+
export { default as ComponentsServersElement } from './elements/nces/ComponentsServers.ts';
876+
export { default as ComponentsServerVariablesElement } from './elements/nces/ComponentsServerVariables.ts';
877+
export { default as MessageExamplesElement } from './elements/nces/MessageExamples.ts';
878+
export { default as MessageTraitsElement } from './elements/nces/MessageTraits.ts';
879+
export { default as MessageTraitExamplesElement } from './elements/nces/MessageTraitExamples.ts';
880+
export { default as OAuthFlowScopesElement } from './elements/nces/OAuthFlowScopes.ts';
881+
export { default as OperationMessageElement } from './elements/nces/OperationMessage.ts';
882+
export { default as OperationMessageMapElement } from './elements/nces/OperationMessageMap.ts';
883+
export { default as OperationSecurityElement } from './elements/nces/OperationSecurity.ts';
884+
export { default as ServerVariablesElement } from './elements/nces/ServerVariables.ts';
885+
export { default as OperationTraitsElement } from './elements/nces/OperationTraits.ts';
886+
export { default as OperationTraitSecurityElement } from './elements/nces/OperationTraitSecurity.ts';
887+
export { default as ServerSecurityElement } from './elements/nces/ServerSecurity.ts';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/src/**/*.mjs
2+
/src/**/*.cjs
3+
/test/**/*.mjs
4+
/dist
5+
/types
6+
/NOTICE
7+
/swagger-api-apidom-ns-asyncapi-3-*.tgz
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extensions": ["ts"],
3+
"loader": "ts-node/esm",
4+
"recursive": true,
5+
"spec": "test/**/*.ts",
6+
"file": ["test/mocha-bootstrap.ts"],
7+
"ignore": ["test/perf/**/*.ts"]
8+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# apidom-ns-asyncapi-3
2+
3+
AsyncAPI 3.x.y namespace for ApiDOM.
4+
5+
This is a starter scaffold. Implement element classes, predicates and refractor visitors following the pattern from `apidom-ns-asyncapi-2`.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3+
"extends": "../../../../api-extractor.json"
4+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import path from 'node:path';
2+
3+
import { nonMinimizeTrait, minimizeTrait } from './traits.config.js';
4+
5+
const browser = {
6+
mode: 'production',
7+
entry: ['./src/index.ts'],
8+
target: 'web',
9+
performance: {
10+
maxEntrypointSize: 2200000,
11+
maxAssetSize: 2200000,
12+
},
13+
output: {
14+
path: path.resolve('./dist'),
15+
filename: 'apidom-ns-asyncapi-3.browser.js',
16+
libraryTarget: 'umd',
17+
library: 'apidomNsAsyncApi3',
18+
},
19+
resolve: {
20+
extensions: ['.ts', '.mjs', '.js', '.json'],
21+
},
22+
module: {
23+
rules: [
24+
{
25+
test: /\.(ts|js)?$/,
26+
exclude: /node_modules/,
27+
use: {
28+
loader: 'babel-loader',
29+
options: {
30+
babelrc: true,
31+
rootMode: 'upward',
32+
},
33+
},
34+
},
35+
],
36+
},
37+
...nonMinimizeTrait,
38+
};
39+
40+
const browserMin = {
41+
mode: 'production',
42+
entry: ['./src/index.ts'],
43+
target: 'web',
44+
performance: {
45+
maxEntrypointSize: 310000,
46+
maxAssetSize: 310000,
47+
},
48+
output: {
49+
path: path.resolve('./dist'),
50+
filename: 'apidom-ns-asyncapi-3.browser.min.js',
51+
libraryTarget: 'umd',
52+
library: 'apidomNsAsyncApi3',
53+
},
54+
resolve: {
55+
extensions: ['.ts', '.mjs', '.js', '.json'],
56+
},
57+
module: {
58+
rules: [
59+
{
60+
test: /\.(ts|js)?$/,
61+
exclude: /node_modules/,
62+
use: {
63+
loader: 'babel-loader',
64+
options: {
65+
babelrc: true,
66+
rootMode: 'upward',
67+
},
68+
},
69+
},
70+
],
71+
},
72+
...minimizeTrait,
73+
};
74+
75+
export default [browser, browserMin];
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import webpack from 'webpack';
2+
import TerserPlugin from 'terser-webpack-plugin';
3+
4+
export const nonMinimizeTrait = {
5+
optimization: {
6+
minimize: false,
7+
usedExports: false,
8+
concatenateModules: false,
9+
},
10+
};
11+
12+
export const minimizeTrait = {
13+
plugins: [
14+
new webpack.LoaderOptionsPlugin({
15+
minimize: true,
16+
}),
17+
],
18+
optimization: {
19+
minimizer: [
20+
new TerserPlugin({
21+
terserOptions: {
22+
compress: {
23+
warnings: false,
24+
},
25+
output: {
26+
comments: false,
27+
},
28+
},
29+
}),
30+
],
31+
},
32+
};
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"name": "@swagger-api/apidom-ns-asyncapi-3",
3+
"version": "1.0.0-beta.0",
4+
"description": "AsyncAPI 3.x.y namespace for ApiDOM.",
5+
"publishConfig": {
6+
"access": "public",
7+
"registry": "https://registry.npmjs.org"
8+
},
9+
"type": "module",
10+
"sideEffects": [],
11+
"main": "./src/index.cjs",
12+
"exports": {
13+
"types": "./types/apidom-ns-asyncapi-3.d.ts",
14+
"import": "./src/index.mjs",
15+
"require": "./src/index.cjs"
16+
},
17+
"types": "./types/apidom-ns-asyncapi-3.d.ts",
18+
"scripts": {
19+
"build": "npm run clean && run-p --max-parallel ${CPU_CORES:-2} typescript:declaration build:es build:cjs build:umd:browser",
20+
"build:es": "cross-env BABEL_ENV=es babel src --out-dir src --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward'",
21+
"build:cjs": "cross-env BABEL_ENV=cjs babel src --out-dir src --extensions '.ts' --out-file-extension '.cjs' --root-mode 'upward'",
22+
"build:umd:browser": "cross-env BABEL_ENV=browser webpack --config config/webpack/browser.config.js --progress",
23+
"lint": "eslint ./",
24+
"lint:fix": "eslint ./ --fix",
25+
"clean": "rimraf --glob 'src/**/*.mjs' 'src/**/*.cjs' ./dist ./types",
26+
"test": "NODE_ENV=test ts-mocha --exit",
27+
"test:update-snapshots": "cross-env UPDATE_SNAPSHOT=1 BABEL_ENV=cjs mocha",
28+
"perf": "cross-env BABEL_ENV=es babel ./test/perf --out-dir ./test/perf --extensions '.ts' --out-file-extension '.mjs' --root-mode 'upward' && cross-env NODE_ENV=test node ./test/perf/index.mjs",
29+
"perf:visitor-shortcut": "cross-env BABEL_ENV=es babel ./test/perf/visitor-shortcut.ts --out-file ./test/perf/visitor-shortcut.mjs --root-mode 'upward' && cross-env NODE_ENV=test node ./test/perf/visitor-shortcut.mjs",
30+
"typescript:check-types": "tsc --noEmit && tsc -p ./test/tsconfig.json --noEmit",
31+
"typescript:declaration": "tsc -p tsconfig.declaration.json && api-extractor run -l -c ./config/api-extractor/api-extractor.json 2>&1 | shx grep -v 'Visitor_base'"
32+
},
33+
"repository": {
34+
"type": "git",
35+
"url": "git+https://github.com/swagger-api/apidom.git"
36+
},
37+
"author": "apidom team",
38+
"license": "Apache-2.0",
39+
"dependencies": {
40+
"@babel/runtime-corejs3": "^7.26.10",
41+
"@swagger-api/apidom-core": "^1.0.0-rc.3",
42+
"@swagger-api/apidom-ns-asyncapi-2": "^1.0.0-rc.3",
43+
"@types/ramda": "~0.30.0",
44+
"ramda": "~0.30.0",
45+
"ramda-adjunct": "^5.0.0",
46+
"ts-mixer": "^6.0.3"
47+
},
48+
"files": [
49+
"src/**/*.mjs",
50+
"src/**/*.cjs",
51+
"dist/",
52+
"types/apidom-ns-asyncapi-3.d.ts",
53+
"LICENSES",
54+
"NOTICE",
55+
"README.md",
56+
"CHANGELOG.md"
57+
]
58+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { Attributes, Meta } from '@swagger-api/apidom-core';
2+
import { UnsupportedOperationError } from '@swagger-api/apidom-error';
3+
import {
4+
ExternalDocumentationElement,
5+
AsyncApi2Element,
6+
TagsElement,
7+
} from '@swagger-api/apidom-ns-asyncapi-2';
8+
9+
import OperationsElement from './Operations.ts';
10+
11+
/* eslint-disable class-methods-use-this */
12+
13+
/**
14+
* @public
15+
*/
16+
class AsyncApi3 extends AsyncApi2Element {
17+
constructor(content?: Record<string, unknown>, meta?: Meta, attributes?: Attributes) {
18+
super(content, meta, attributes);
19+
this.element = 'asyncApi3';
20+
}
21+
22+
get tags(): TagsElement | undefined {
23+
throw new UnsupportedOperationError('tags keyword has been moved to info');
24+
}
25+
26+
set tags(tags: TagsElement | undefined) {
27+
throw new UnsupportedOperationError('tags keyword has been moved to info');
28+
}
29+
30+
get externalDocs(): ExternalDocumentationElement | undefined {
31+
throw new UnsupportedOperationError('externalDocs keyword has been moved to info.');
32+
}
33+
34+
set externalDocs(externalDocs: ExternalDocumentationElement | undefined) {
35+
throw new UnsupportedOperationError('externalDocs keyword has been moved to info.');
36+
}
37+
38+
get operations(): OperationsElement | undefined {
39+
return this.get('operations');
40+
}
41+
42+
set operations(operations: OperationsElement | undefined) {
43+
this.set('operations', operations);
44+
}
45+
}
46+
47+
export default AsyncApi3;

0 commit comments

Comments
 (0)