@superfaceai/parser
Advanced tools
Comparing version 0.0.24-beta.2 to 0.0.24-beta.3
@@ -10,2 +10,16 @@ # Changelog | ||
### Changed | ||
**BREAKING CHANGE:** `ProfileDocumentId` renamed to `ProfileIdRange` | ||
**BREAKING CHANGE:** `DocumentVersion` renamed to `VersionRange` | ||
**BREAKING CHANGE:** `parseVersionNumber` renamed to `tryParseVersionNumber` | ||
**BREAKING CHANGE:** removed `isValidDocumentIdentifier` started using `isValidDocumentName` from AST | ||
**BREAKING CHANGE:** removed `splitLimit` strated using `splitLimit` from AST | ||
### Added | ||
`ProfileVersion` class representing version of profile in ProfileId | ||
`ProfileId` class representing complete id of profile | ||
`MapVersion` class representing version of map in MapId | ||
`MapId` class representing complete id of map | ||
## [0.0.23] - 2021-10-18 | ||
@@ -12,0 +26,0 @@ ### Added |
@@ -5,2 +5,2 @@ export * from './errors'; | ||
export * from './common'; | ||
export * from './metadata'; | ||
export { VERSION, PARSED_VERSION, PARSED_AST_VERSION } from './metadata'; |
@@ -13,2 +13,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PARSED_AST_VERSION = exports.PARSED_VERSION = exports.VERSION = void 0; | ||
var language_1 = require("./language"); | ||
@@ -19,5 +20,8 @@ __exportStar(require("./errors"), exports); | ||
__exportStar(require("./common"), exports); | ||
__exportStar(require("./metadata"), exports); | ||
var metadata_1 = require("./metadata"); | ||
Object.defineProperty(exports, "VERSION", { enumerable: true, get: function () { return metadata_1.VERSION; } }); | ||
Object.defineProperty(exports, "PARSED_VERSION", { enumerable: true, get: function () { return metadata_1.PARSED_VERSION; } }); | ||
Object.defineProperty(exports, "PARSED_AST_VERSION", { enumerable: true, get: function () { return metadata_1.PARSED_AST_VERSION; } }); | ||
// Parse env features here, globally | ||
language_1.parseEnvFeatures(); | ||
//# sourceMappingURL=index.js.map |
@@ -34,3 +34,11 @@ "use strict"; | ||
function addDoc(node, structure) { | ||
return __assign(__assign({}, structure), { documentation: node.documentation }); | ||
var _a, _b; | ||
var result = __assign({}, structure); | ||
if (((_a = node.documentation) === null || _a === void 0 ? void 0 : _a.description) !== undefined) { | ||
result.description = node.documentation.description; | ||
} | ||
if (((_b = node.documentation) === null || _b === void 0 ? void 0 : _b.title) !== undefined) { | ||
result.title = node.documentation.title; | ||
} | ||
return result; | ||
} | ||
@@ -176,3 +184,3 @@ function assertUnreachable(node) { | ||
.map(function (definition) { return _this.visit(definition); }); | ||
return { header: header, usecases: usecases }; | ||
return addDoc(node.header, { header: header, usecases: usecases }); | ||
}; | ||
@@ -179,0 +187,0 @@ ProfileIOAnalyzer.prototype.visitProfileHeaderNode = function (node) { |
@@ -1,2 +0,1 @@ | ||
import { DocumentedNode } from '@superfaceai/ast'; | ||
export declare type StructureKind = 'PrimitiveStructure' | 'EnumStructure' | 'NonNullStructure' | 'ListStructure' | 'ObjectStructure' | 'UnionStructure' | 'ScalarStructure'; | ||
@@ -13,3 +12,6 @@ /** | ||
*/ | ||
export declare type DocumentedStructure = DocumentedNode; | ||
export declare type DocumentedStructure = { | ||
title?: string; | ||
description?: string; | ||
}; | ||
/** | ||
@@ -104,3 +106,3 @@ * @interface PrimitiveStructure represents structure of primitive type | ||
*/ | ||
export interface ProfileOutput { | ||
export interface ProfileOutput extends DocumentedStructure { | ||
header: ProfileHeaderStructure; | ||
@@ -107,0 +109,0 @@ usecases: UseCaseStructure[]; |
@@ -8,4 +8,5 @@ export declare const VERSION: string; | ||
}; | ||
export declare function parseMetadataVersion(input: string): FullVersion; | ||
export declare const PARSED_VERSION: FullVersion; | ||
export declare const PARSED_AST_VERSION: FullVersion; | ||
export {}; |
"use strict"; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PARSED_AST_VERSION = exports.PARSED_VERSION = exports.VERSION = void 0; | ||
exports.PARSED_AST_VERSION = exports.PARSED_VERSION = exports.parseMetadataVersion = exports.VERSION = void 0; | ||
var ast_1 = require("@superfaceai/ast"); | ||
var debug_1 = __importDefault(require("debug")); | ||
var metadataDebug = debug_1.default('superface-parser:metadata'); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-var-requires | ||
@@ -9,32 +30,44 @@ var packageJson = require('../package.json'); | ||
exports.VERSION = packageJson.version; | ||
function parseVersion(input) { | ||
var _a, _b; | ||
var version; | ||
function parseMetadataVersion(input) { | ||
var version = { | ||
major: 0, | ||
minor: 0, | ||
patch: 0, | ||
label: undefined, | ||
}; | ||
var plusInInput = input.indexOf('+'); | ||
if (plusInInput !== -1) { | ||
version.label = input.slice(plusInInput + 1); | ||
return version; | ||
} | ||
var _a = __read(ast_1.splitLimit(input, '-', 1), 2), verStr = _a[0], label = _a[1]; | ||
var _b = __read(ast_1.splitLimit(verStr, '.', 2), 3), majorStr = _b[0], minorStr = _b[1], patchStr = _b[2]; | ||
try { | ||
var extracted = ast_1.extractVersion(input); | ||
if (extracted.minor === undefined || extracted.patch === undefined) { | ||
console.error("Version \"" + input + "\" missing minor or patch version. Defaulting missing parts to 0."); | ||
version = { | ||
major: extracted.major, | ||
minor: (_a = extracted.minor) !== null && _a !== void 0 ? _a : 0, | ||
patch: (_b = extracted.patch) !== null && _b !== void 0 ? _b : 0, | ||
label: extracted.label, | ||
}; | ||
version.major = ast_1.parseVersionNumber(majorStr); | ||
} | ||
catch (_c) { | ||
metadataDebug("Major version \"" + majorStr + "\" is not a valid number"); | ||
} | ||
if (minorStr !== undefined) { | ||
try { | ||
version.minor = ast_1.parseVersionNumber(minorStr); | ||
} | ||
else { | ||
version = extracted; | ||
catch (_d) { | ||
metadataDebug("Minor version \"" + minorStr + "\" is not a valid number"); | ||
} | ||
} | ||
catch (err) { | ||
console.error("Unable to parse version \"" + input + "\". Defaulting to 0.0.0."); | ||
version = { | ||
major: 0, | ||
minor: 0, | ||
patch: 0, | ||
}; | ||
if (patchStr !== undefined) { | ||
try { | ||
version.patch = ast_1.parseVersionNumber(patchStr); | ||
} | ||
catch (_e) { | ||
metadataDebug("Patch version \"" + patchStr + "\" is not a valid number"); | ||
} | ||
} | ||
version.label = label; | ||
return version; | ||
} | ||
exports.PARSED_VERSION = parseVersion(exports.VERSION); | ||
exports.PARSED_AST_VERSION = parseVersion(ast_1.VERSION); | ||
exports.parseMetadataVersion = parseMetadataVersion; | ||
exports.PARSED_VERSION = parseMetadataVersion(exports.VERSION); | ||
exports.PARSED_AST_VERSION = parseMetadataVersion(ast_1.VERSION); | ||
//# sourceMappingURL=metadata.js.map |
{ | ||
"name": "@superfaceai/parser", | ||
"version": "0.0.24-beta.2", | ||
"version": "0.0.24-beta.3", | ||
"description": "Level 5 autonomous, self-driving API client, https://superface.ai", | ||
@@ -46,3 +46,3 @@ "repository": "https://github.com/superfaceai/parser.git", | ||
"dependencies": { | ||
"@superfaceai/ast": "0.0.35-beta.1", | ||
"@superfaceai/ast": "0.0.35-beta.2", | ||
"@types/debug": "^4.1.5", | ||
@@ -49,0 +49,0 @@ "debug": "^4.3.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
840711
16337
+ Added@superfaceai/ast@0.0.35-beta.2(transitive)
- Removed@superfaceai/ast@0.0.35-beta.1(transitive)