@ama-openapi/redocly-plugin 0.0.0-placeholder.9 → 13.5.0-prerelease.12

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/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Copyright Amadeus SAS
2
+
3
+ Redistribution and use in source and binary forms, with or without modification,
4
+ are permitted provided that the following conditions are met:
5
+
6
+ 1. Redistributions of source code must retain the above copyright notice, this
7
+ list of conditions and the following disclaimer.
8
+
9
+ 2. Redistributions in binary form must reproduce the above copyright notice,
10
+ this list of conditions and the following disclaimer in the documentation and/or
11
+ other materials provided with the distribution.
12
+
13
+ 3. Neither the name of the copyright holder nor the names of its contributors
14
+ may be used to endorse or promote products derived from this software without
15
+ specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
21
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # Ama OpenAPI Redocly Plugin
2
+
3
+ [![Stable Version](https://img.shields.io/npm/v/@ama-openapi/redocly-plugin?style=for-the-badge)](https://www.npmjs.com/package/@ama-openapi/redocly-plugin)
4
+ [![Bundle Size](https://img.shields.io/bundlephobia/min/@ama-openapi/redocly-plugin?color=green&style=for-the-badge)](https://www.npmjs.com/package/@ama-openapi/redocly-plugin)
5
+
6
+ A Redocly CLI plugin for managing OpenAPI dependencies and masking operations based on [@ama-openapi/core](https://www.npmjs.com/package/@ama-openapi/core).
7
+
8
+ ## Overview
9
+
10
+ This plugin extends the Redocly CLI with functionality to handle OpenAPI dependency setup and content masking. It leverages the core dependency management system provided by `@ama-openapi/core` to automatically resolve and integrate OpenAPI dependencies in your specifications.
11
+
12
+ ## Features
13
+
14
+ - **Dependency management**: Automatically resolves and manages OpenAPI dependencies
15
+ - **Content masking**: Applies masking rules to hide or transform sensitive information in OpenAPI specifications
16
+ - **Redocly integration**: Seamlessly integrates with the Redocly CLI toolchain
17
+ - **Configurable**: Supports custom configuration for dependency resolution and masking rules
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ npm install @ama-openapi/redocly-plugin
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ### Basic Configuration
28
+
29
+ Add the plugin to your Redocly configuration file (`.redocly.yaml` or `redocly.yaml`):
30
+
31
+ ```yaml
32
+ plugins:
33
+ - '@ama-openapi/redocly-plugin'
34
+ ```
35
+
36
+ ### Dependency Retrieval
37
+
38
+ The plugin retrieves dependencies defined in your [OpenAPI Configuration](https://github.com/AmadeusITGroup/otter/tree/main/packages/@ama-openapi/core#manifest-configuration):
39
+
40
+ ```json5
41
+ // in the package.json file
42
+ {
43
+ "name": "@my/specification",
44
+ "dependencies": {
45
+ "@specification/pet-store": "latest"
46
+ }
47
+ }
48
+ ```
49
+
50
+ ```yaml
51
+ # in the openapi.manifest.yaml
52
+ models:
53
+ "@specification/pet-store": "models/pet.v1.yaml"
54
+ ```
55
+
56
+ ```yaml
57
+ # in your specification
58
+ openapi: 3.0.0
59
+ info:
60
+ title: My API
61
+ version: 1.0.0
62
+
63
+ content:
64
+ application/json:
65
+ schema:
66
+ type: object
67
+ properties:
68
+ data:
69
+ $ref: './specification/pet-store/models/pet.v1.yaml'
70
+
71
+ ```
72
+
73
+ > [!TIP]
74
+ > Find the documentation regarding the package management strategy on [Node Package Manager](https://github.com/AmadeusITGroup/otter/tree/main/packages/@ama-openapi/core#dependency-resolution-concept).\
75
+ > Find a complete documentation regarding the Manifest on the [OpenAPI Configuration](https://github.com/AmadeusITGroup/otter/tree/main/packages/@ama-openapi/core#manifest-configuration).
76
+
77
+ ### Masking Configuration
78
+
79
+ A full documentation on masking specified information is available in [OpenAPI Masking configuration](https://github.com/AmadeusITGroup/otter/tree/main/packages/@ama-openapi/core#manifest-configuration).\
80
+ A simple example can be:
81
+
82
+ ```yaml
83
+ # in the openapi.manifest.yaml
84
+ models:
85
+ "@specification/pet-store":
86
+ - path: "models/pet.v1.yaml"
87
+ transform:
88
+ - fileRename: "my-$1"
89
+ mask:
90
+ properties:
91
+ exampleField:
92
+ ```
93
+
94
+ ## Available plugin configurations
95
+
96
+ As the plugin must be executed at the initialization of the Redocly process, the configuration of the plugin should be provided via [environment variables](https://en.wikipedia.org/wiki/Environment_variable).
97
+
98
+ The following environment variables are supported:
99
+
100
+ | Environment Variable | Description | Default Value |
101
+ | --- | --- | --- |
102
+ | `AMA_OPENAPI_REDOCLY_CONTINUE_ON_ERROR` | Ignore process failure and continue Redocly process | `false` |
103
+ | `AMA_OPENAPI_REDOCLY_VERBOSE` | Display debug level logs | `false` |
104
+ | `AMA_OPENAPI_REDOCLY_QUIET` | Suppress all output| `false` |
105
+
106
+ ## Integration
107
+
108
+ This Redocly Plugin is designed to work with the following tools:
109
+
110
+ - [@ama-openapi/core](https://www.npmjs.com/package/@ama-openapi/core): Core dependency management functionality
111
+ - [@ama-openapi/cli](https://www.npmjs.com/package/@ama-openapi/cli): Command to manually retrieve the dependencies
112
+ - [@ama-openapi/create](https://www.npmjs.com/package/@ama-openapi/create): Project scaffolding tool
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ama-openapi/redocly-plugin",
3
- "version": "0.0.0-placeholder.9",
3
+ "version": "13.5.0-prerelease.12",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -30,13 +30,13 @@
30
30
  "postbuild": "patch-package-json-main"
31
31
  },
32
32
  "dependencies": {
33
- "@ama-openapi/core": "0.0.0-placeholder.9",
33
+ "@ama-openapi/core": "~13.5.0-prerelease.12",
34
34
  "dotenv": "~17.2.3",
35
35
  "tslib": "^2.6.2",
36
36
  "yargs": "~18.0.0"
37
37
  },
38
38
  "peerDependencies": {
39
- "@o3r/telemetry": "0.0.0-placeholder.9",
39
+ "@o3r/telemetry": "~13.5.0-prerelease.12",
40
40
  "@redocly/openapi-core": "^2.11.0"
41
41
  },
42
42
  "peerDependenciesMeta": {
@@ -48,34 +48,34 @@
48
48
  "@babel/core": "~7.28.0",
49
49
  "@babel/preset-env": "~7.28.0",
50
50
  "@babel/preset-typescript": "~7.28.0",
51
- "@compodoc/compodoc": "^1.1.19",
51
+ "@compodoc/compodoc": "^1.1.32",
52
52
  "@eslint-community/eslint-plugin-eslint-comments": "^4.4.0",
53
53
  "@nx/eslint": "~21.6.0",
54
54
  "@nx/eslint-plugin": "~21.6.0",
55
55
  "@nx/jest": "~21.6.0",
56
56
  "@nx/js": "~21.6.0",
57
- "@o3r/build-helpers": "0.0.0-placeholder.9",
58
- "@o3r/eslint-plugin": "0.0.0-placeholder.9",
59
- "@o3r/telemetry": "0.0.0-placeholder.9",
60
- "@o3r/test-helpers": "0.0.0-placeholder.9",
57
+ "@o3r/build-helpers": "~13.5.0-prerelease.12",
58
+ "@o3r/eslint-plugin": "~13.5.0-prerelease.12",
59
+ "@o3r/telemetry": "~13.5.0-prerelease.12",
60
+ "@o3r/test-helpers": "~13.5.0-prerelease.12",
61
61
  "@redocly/openapi-core": "~2.11.0",
62
- "@stylistic/eslint-plugin": "~5.5.0",
62
+ "@stylistic/eslint-plugin": "~5.6.0",
63
63
  "@types/jest": "~29.5.2",
64
64
  "@types/js-yaml": "^4.0.5",
65
65
  "@types/minimist": "^1.2.2",
66
66
  "@types/node": "~22.18.0",
67
67
  "@types/semver": "^7.3.13",
68
68
  "@types/yargs": "~17.0.33",
69
- "@typescript-eslint/parser": "~8.46.0",
70
- "angular-eslint": "~20.5.0",
69
+ "@typescript-eslint/parser": "~8.47.0",
70
+ "angular-eslint": "~20.6.0",
71
71
  "babel-jest": "^29.7.0",
72
72
  "cpy-cli": "^6.0.0",
73
- "eslint": "~9.38.0",
73
+ "eslint": "~9.39.0",
74
74
  "eslint-import-resolver-node": "~0.3.9",
75
75
  "eslint-import-resolver-typescript": "~4.4.0",
76
76
  "eslint-plugin-import": "~2.32.0",
77
77
  "eslint-plugin-import-newlines": "~1.4.0",
78
- "eslint-plugin-jest": "~29.0.0",
78
+ "eslint-plugin-jest": "~29.1.0",
79
79
  "eslint-plugin-jsdoc": "~54.7.0",
80
80
  "eslint-plugin-prefer-arrow": "~1.2.3",
81
81
  "eslint-plugin-unicorn": "~60.0.0",
@@ -87,12 +87,80 @@
87
87
  "jest-util": "~29.7.0",
88
88
  "jsonc-eslint-parser": "~2.4.0",
89
89
  "nx": "~21.6.0",
90
- "pid-from-port": "^1.1.3",
91
90
  "ts-jest": "~29.4.0",
92
91
  "typescript": "~5.9.2",
93
- "typescript-eslint": "~8.46.0"
92
+ "typescript-eslint": "~8.47.0"
94
93
  },
95
94
  "engines": {
96
95
  "node": "^20.19.0 || ^22.17.0 || ^24.0.0"
97
- }
98
- }
96
+ },
97
+ "contributors": [
98
+ {
99
+ "name": "Yannick Adam",
100
+ "url": "https://github.com/yannickadam",
101
+ "email": "yannickadam@users.noreply.github.com"
102
+ },
103
+ {
104
+ "name": "Kilian Panot",
105
+ "url": "https://github.com/kpanot",
106
+ "email": "kpanot@users.noreply.github.com"
107
+ },
108
+ {
109
+ "name": "Jeremy Bourgeois",
110
+ "url": "https://github.com/jbourgeois-1A",
111
+ "email": "jbourgeois-1A@users.noreply.github.com"
112
+ },
113
+ {
114
+ "name": "Pierre Henri Ginoux",
115
+ "url": "https://github.com/pginoux-1A",
116
+ "email": "pginoux-1A@users.noreply.github.com"
117
+ },
118
+ {
119
+ "name": "Mircea Vasile Rednic",
120
+ "url": "https://github.com/mrednic-1A",
121
+ "email": "mrednic-1A@users.noreply.github.com"
122
+ },
123
+ {
124
+ "name": "Stephane Dalle",
125
+ "url": "https://github.com/sdalle-1A",
126
+ "email": "sdalle-1A@users.noreply.github.com"
127
+ },
128
+ {
129
+ "name": "Nicolas Hoffmann",
130
+ "url": "https://github.com/nhoffmann-1A",
131
+ "email": "nhoffmann-1A@users.noreply.github.com"
132
+ },
133
+ {
134
+ "name": "Victor Scaiceanu",
135
+ "url": "https://github.com/vscaiceanu-1a",
136
+ "email": "vscaiceanu-1A@users.noreply.github.com"
137
+ },
138
+ {
139
+ "name": "Florian Paul",
140
+ "url": "https://github.com/fpaul-1A",
141
+ "email": "fpaul-1A@users.noreply.github.com"
142
+ },
143
+ {
144
+ "name": "Corinne Paulve",
145
+ "url": "https://github.com/cpaulve-1A",
146
+ "email": "cpaulve-1A@users.noreply.github.com"
147
+ },
148
+ {
149
+ "name": "Matthieu Crouzet",
150
+ "url": "https://github.com/matthieu-crouzet",
151
+ "email": "matthieu-crouzet@users.noreply.github.com"
152
+ },
153
+ {
154
+ "name": "Salome Do",
155
+ "url": "https://github.com/sdo-1A",
156
+ "email": "sdo-1A@users.noreply.github.com"
157
+ }
158
+ ],
159
+ "bugs": "https://github.com/AmadeusITGroup/otter/issues",
160
+ "repository": {
161
+ "type": "git",
162
+ "url": "git+https://github.com/AmadeusITGroup/otter.git"
163
+ },
164
+ "license": "BSD-3-Clause",
165
+ "homepage": "https://amadeusitgroup.github.io/otter/"
166
+ }
package/src/logger.d.mts CHANGED
@@ -9,18 +9,10 @@ type Problem = {
9
9
  forceSeverity?: RuleSeverity;
10
10
  ruleId?: string;
11
11
  };
12
- /** Log levels for logger */
13
- export type LogLevel = 'silent' | 'error' | 'warn' | 'info' | 'debug';
14
12
  /**
15
13
  * Create a Logger from a report function
16
14
  * @param report
17
15
  */
18
16
  export declare const getLoggerFromReport: (report: (problem: Problem) => void) => Logger;
19
- /**
20
- * Get a logger with the specified log level
21
- * @param level
22
- * @param logger
23
- */
24
- export declare const getLogger: (level?: LogLevel, logger?: Logger) => Logger;
25
17
  export {};
26
18
  //# sourceMappingURL=logger.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.mts","sourceRoot":"","sources":["../../src/logger.mts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,MAAM,EACP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACb,MAAM,uBAAuB,CAAC;AAE/B,gEAAgE;AAChE,KAAK,OAAO,GAAG;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;IAC/D,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAIF,4BAA4B;AAC5B,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEtE;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,KAAG,MAMvE,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,QAAQ,QAAQ,EAAE,SAAQ,MAAgB,WAqBnE,CAAC"}
1
+ {"version":3,"file":"logger.d.mts","sourceRoot":"","sources":["../../src/logger.mts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,MAAM,EACP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EACV,cAAc,EACd,YAAY,EACb,MAAM,uBAAuB,CAAC;AAE/B,gEAAgE;AAChE,KAAK,OAAO,GAAG;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;IAC/D,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,aAAa,CAAC,EAAE,YAAY,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,KAAG,MAMvE,CAAC"}
package/src/logger.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import { EOL, } from 'node:os';
2
- const noop = () => { };
3
2
  /**
4
3
  * Create a Logger from a report function
5
4
  * @param report
@@ -11,31 +10,4 @@ export const getLoggerFromReport = (report) => ({
11
10
  debug: (...messages) => report({ message: messages.map((msg) => JSON.stringify(msg)).join(EOL) }),
12
11
  log: (...messages) => report({ message: messages.map((msg) => JSON.stringify(msg)).join(EOL) })
13
12
  });
14
- /**
15
- * Get a logger with the specified log level
16
- * @param level
17
- * @param logger
18
- */
19
- export const getLogger = (level, logger = console) => {
20
- if (level) {
21
- switch (level) {
22
- case 'silent': {
23
- logger = { ...logger, error: noop };
24
- }
25
- // eslint-disable-next-line no-fallthrough -- done on purpose to disable multiple levels
26
- case 'error': {
27
- logger = { ...logger, warn: noop };
28
- }
29
- // eslint-disable-next-line no-fallthrough -- done on purpose to disable multiple levels
30
- case 'warn': {
31
- logger = { ...logger, info: noop };
32
- }
33
- // eslint-disable-next-line no-fallthrough -- done on purpose to disable multiple levels
34
- case 'info': {
35
- logger = { ...logger, debug: noop };
36
- }
37
- }
38
- }
39
- return logger;
40
- };
41
13
  //# sourceMappingURL=logger.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"logger.mjs","sourceRoot":"","sources":["../../src/logger.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,GACJ,MAAM,SAAS,CAAC;AAmBjB,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAKtB;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAkC,EAAU,EAAE,CAAC,CAAC;IAClF,KAAK,EAAE,CAAC,GAAG,QAAe,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IAChI,IAAI,EAAE,CAAC,GAAG,QAAe,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IAC9H,IAAI,EAAE,CAAC,GAAG,QAAe,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IACvG,KAAK,EAAE,CAAC,GAAG,QAAe,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS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ANGED
@@ -1,12 +1,10 @@
1
- import { type InstallDependenciesOptions } from '@ama-openapi/core';
2
- import { Plugin } from '@redocly/openapi-core';
1
+ import { type Plugin } from '@redocly/openapi-core';
2
+ import { type RetrieveDependencyOptions } from './plugins/meta/retrieve-dependency.meta.mjs';
3
3
  /** Options for ama-openapi plugin */
4
- export interface AmaOpenapiPluginOptions extends InstallDependenciesOptions {
5
- /** Skip the download of dependency */
6
- skipDependencyDownload?: boolean;
4
+ export interface AmaOpenapiPluginOptions extends Partial<RetrieveDependencyOptions> {
7
5
  }
8
6
  /**
9
- * Ama OpenAPI Redocly Plugin
7
+ * Ama OpenAPI {@link https://redocly.com/docs/cli/custom-plugins | Redocly Plugin}
10
8
  * @param options
11
9
  */
12
10
  export declare const amaOpenapiPlugin: (options?: AmaOpenapiPluginOptions) => Promise<Plugin>;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","sourceRoot":"","sources":["../../src/plugin.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAEhC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,MAAM,EACP,MAAM,uBAAuB,CAAC;AAW/B,qCAAqC;AACrC,MAAM,WAAW,uBAAwB,SAAQ,0BAA0B;IACzE,sCAAsC;IACtC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAU,UAAU,uBAAuB,KAAG,OAAO,CAAC,MAAM,CAaxF,CAAC"}
1
+ {"version":3,"file":"plugin.d.mts","sourceRoot":"","sources":["../../src/plugin.mts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,MAAM,EACZ,MAAM,uBAAuB,CAAC;AAO/B,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,6CAA6C,CAAC;AAIrD,qCAAqC;AACrC,MAAM,WAAW,uBAAwB,SAAQ,OAAO,CAAC,yBAAyB,CAAC;CAClF;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAU,UAAU,uBAAuB,KAAG,OAAO,CAAC,MAAM,CAkBxF,CAAC"}
package/src/plugin.mjs CHANGED
@@ -1,17 +1,19 @@
1
1
  import { config, } from 'dotenv';
2
2
  import { ENVIRONMENT_VARIABLE_PREFIX, } from './constants.mjs';
3
3
  import { retrieveDependency, } from './plugins/meta/retrieve-dependency.meta.mjs';
4
+ const DEFAULT_OPTIONS = 'error';
4
5
  /**
5
- * Ama OpenAPI Redocly Plugin
6
+ * Ama OpenAPI {@link https://redocly.com/docs/cli/custom-plugins | Redocly Plugin}
6
7
  * @param options
7
8
  */
8
9
  export const amaOpenapiPlugin = async (options) => {
9
10
  config({ override: true, quiet: true });
10
- options = {
11
- skipDependencyDownload: !!process.env[`${ENVIRONMENT_VARIABLE_PREFIX}_SKIP_DOWNLOAD`],
12
- ...options
13
- };
14
- await retrieveDependency(options);
11
+ const { [`${ENVIRONMENT_VARIABLE_PREFIX}_VERBOSE`]: verbose, [`${ENVIRONMENT_VARIABLE_PREFIX}_QUIET`]: quiet, [`${ENVIRONMENT_VARIABLE_PREFIX}_CONTINUE_ON_ERROR`]: continueOnError } = process.env;
12
+ await retrieveDependency({
13
+ logLevel: verbose === 'true' ? 'debug' : (options?.logLevel ?? DEFAULT_OPTIONS),
14
+ quiet: quiet ? quiet === 'true' : options?.quiet ?? false,
15
+ continueOnError: continueOnError ? continueOnError === 'true' : options?.continueOnError ?? false
16
+ });
15
17
  return {
16
18
  id: 'ama-openapi'
17
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.mjs","sourceRoot":"","sources":["../../src/plugin.mts"],"names":[],"mappings":"AAOA,OAAO,EACL,MAAM,GACP,MAAM,QAAQ,CAAC;AAChB,OAAO,EACL,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,GACnB,MAAM,6CAA6C,CAAC;AAQrD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,OAAiC,E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AAK;QACzD,eAAe,EAAE,eAAe,CAAC,CAAC,CAAC,eAAe,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,eAAe,IAAI,KAAK;KAClG,CAAC,CAAC;IAEH,OAAO;QACL,EAAE,EAAE,aAAa;KAClB,CAAC;AACJ,CAAC,CAAC"}
@@ -1,17 +1,22 @@
1
- import { type InstallDependenciesOptions } from '@ama-openapi/core';
2
- import { type LogLevel } from '../../logger.mjs';
1
+ import { type InstallDependenciesOptions, type LogLevel } from '@ama-openapi/core';
2
+ /**
3
+ * Options to retrieve dependency
4
+ */
3
5
  export interface RetrieveDependencyOptions extends InstallDependenciesOptions {
4
6
  /**
5
7
  * Define the logging level
6
8
  * @default 'error'
7
9
  */
8
- logLevel?: LogLevel;
10
+ logLevel: LogLevel;
11
+ /** Suppress all output */
12
+ quiet: boolean;
9
13
  /** Continue on dependency download failure */
10
- noBail?: boolean;
14
+ continueOnError: boolean;
11
15
  }
12
16
  /**
13
- * Retrieve dependencies according to manifest files
17
+ * Retrieve dependencies according to manifest files.
18
+ * Refer to {@link InstallDependencies} for more information
14
19
  * @param options
15
20
  */
16
- export declare const retrieveDependency: (options?: RetrieveDependencyOptions) => Promise<void>;
21
+ export declare const retrieveDependency: (options: RetrieveDependencyOptions) => Promise<void>;
17
22
  //# sourceMappingURL=retrieve-dependency.meta.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"retrieve-dependency.meta.d.mts","sourceRoot":"","sources":["../../../../src/plugins/meta/retrieve-dependency.meta.mts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,0BAA0B,EAEhC,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAEL,KAAK,QAAQ,EACd,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,yBAA0B,SAAQ,0BAA0B;IAC3E;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IAEpB,8CAA8C;IAC9C,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAMD;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAU,UAAU,yBAAyB,kBAiB3E,CAAC"}
1
+ {"version":3,"file":"retrieve-dependency.meta.d.mts","sourceRoot":"","sources":["../../../../src/plugins/meta/retrieve-dependency.meta.mts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,QAAQ,EAEd,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,0BAA0B;IAC3E;;;OAGG;IACH,QAAQ,EAAE,QAAQ,CAAC;IAEnB,0BAA0B;IAC1B,KAAK,EAAE,OAAO,CAAC;IAEf,8CAA8C;IAC9C,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,GAAU,SAAS,yBAAyB,kBAY1E,CAAC"}
@@ -1,27 +1,18 @@
1
- import { installDependencies,
2
- // eslint-disable-next-line import/no-unresolved -- Cannot resolve mjs file in current setup
1
+ import { getLogger, installDependencies,
2
+ // eslint-disable-next-line import/no-unresolved -- Cannot resolve mjs file in current setup (see #3738)
3
3
  } from '@ama-openapi/core';
4
- import { ENVIRONMENT_VARIABLE_PREFIX, } from '../../constants.mjs';
5
- import { getLogger, } from '../../logger.mjs';
6
- const DEFAULT_OPTIONS = {
7
- logLevel: 'error'
8
- };
9
4
  /**
10
- * Retrieve dependencies according to manifest files
5
+ * Retrieve dependencies according to manifest files.
6
+ * Refer to {@link InstallDependencies} for more information
11
7
  * @param options
12
8
  */
13
9
  export const retrieveDependency = async (options) => {
14
- options = {
15
- ...DEFAULT_OPTIONS,
16
- noBail: !!process.env[`${ENVIRONMENT_VARIABLE_PREFIX}_NO_BAIL`],
17
- ...options
18
- };
19
- const logger = getLogger(options?.logLevel || DEFAULT_OPTIONS.logLevel, options?.logger);
10
+ const logger = options.quiet ? undefined : getLogger(options.logLevel);
20
11
  try {
21
12
  await installDependencies(process.cwd(), { ...options, logger });
22
13
  }
23
14
  catch (e) {
24
- if (options?.noBail) {
15
+ if (options?.continueOnError) {
25
16
  logger?.error(e);
26
17
  }
27
18
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"retrieve-dependency.meta.mjs","sourceRoot":"","sources":["../../../../src/plugins/meta/retrieve-dependency.meta.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB;AAEnB,4FAA4F;EAC7F,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,SAAS,GAEV,MAAM,kBAAkB,CAAC;AAa1B,MAAM,eAAe,GAA8B;IACjD,QAAQ,EAAE,OAAO;CAClB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,OAAmC,EAAE,EAAE;IAC9E,OAAO,GAAG;QACR,GAAG,eAAe;QAClB,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,2BAA2B,UAAU,CAAC;QAC/D,GAAG,OAAO;KACX,CAAC;IACF,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,EAAE,QAAQ,IAAI,eAAe,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAEzF,IAAI,CAAC;QACH,MAAM,mBAAmB,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACnE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,OAAO,EAAE,MAAM,EAAE,CAAC;YACpB,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;AACH,CAAC,CAAC"}
1
+ {"version":3,"file":"retrieve-dependency.meta.mjs","sourceRoot":"","sources":["../../../../src/plugins/meta/retrieve-dependency.meta.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,mBAAmB;AAGnB,wGAAwG;EACzG,MAAM,mBAAmB,CAAC;AAmB3B;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,OAAkC,EAAE,EAAE;IAC7E,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEvE,IAAI,CAAC;QACH,MAAM,mBAAmB,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACnE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,OAAO,EAAE,eAAe,EAAE,CAAC;YAC7B,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;AACH,CAAC,CAAC"}