@autorest/extension-base
Advanced tools
Comparing version 3.3.1 to 3.4.0-dev.1
@@ -9,8 +9,8 @@ { | ||
"packages/libs/extension-base/code-model-v1.d.ts": "7b1ea0b62681a8c2f395180dbdaeb0b9c01c6ce5", | ||
"packages/libs/extension-base/package.json": "58603b76f8e87c2e7f3c08c21e9bd81e00b1b293", | ||
"packages/libs/extension-base/package.json": "961867d50f43347c8136585ad21fc6ed2ad7ace6", | ||
"packages/libs/extension-base/readme.md": "f9e664f8dc4f8424b43ceae84772294f6c0cee76", | ||
"packages/libs/extension-base/src/convenience.ts": "1de32cc0aae8a771778256875f9024f833c90de2", | ||
"packages/libs/extension-base/src/exports.ts": "596302f74c66400fc8660db51d5e7ab9804a158e", | ||
"packages/libs/extension-base/src/convenience.ts": "3103890c8712ab7e6fae506bd269a23a4ed3e2d9", | ||
"packages/libs/extension-base/src/extension-base.ts": "f10ea70b4cde7b50263e74166145e6598b9c5d62", | ||
"packages/libs/extension-base/src/types.ts": "70d5693ca18d5b318cc70e739747c536334e5359", | ||
"packages/libs/extension-base/src/index.ts": "08c841d4758c6dbf8334b75882fb45ac01cdab6e", | ||
"packages/libs/extension-base/src/types.ts": "f852b4a1f173f6fc72ea997ea1eb70c98f296a71", | ||
"packages/libs/extension-base/tsconfig.json": "38c8cfc6dc922f3bd42dd6dc6be58fd47c63a502", | ||
@@ -17,0 +17,0 @@ "packages/libs/extension-base/.rush/temp/shrinkwrap-deps.json": "0f3dc4bc792a2da53eff5aeda3bddbb6bd596473" |
import { Schema } from "js-yaml"; | ||
import { Host } from "./exports"; | ||
import { Channel, Message, Mapping, RawSourceMap } from "./types"; | ||
import { Channel, Message, Mapping, RawSourceMap, LogSource } from "./types"; | ||
import { Host } from "."; | ||
export declare class Session<TInputModel> { | ||
@@ -14,3 +14,3 @@ readonly service: Host; | ||
setValue<V>(key: string, value: V): Promise<void>; | ||
listInputs(artifactType?: string | undefined): Promise<Array<string>>; | ||
listInputs(artifactType?: string | undefined): Promise<string[]>; | ||
protectFiles(path: string): Promise<void>; | ||
@@ -30,7 +30,7 @@ writeFile(filename: string, content: string, sourceMap?: Array<Mapping> | RawSourceMap | undefined, artifactType?: string | undefined): void; | ||
checkpoint(): void; | ||
protected msg(channel: Channel, message: string, key: Array<string>, objectOrPath?: string | Object, details?: any): void; | ||
warning(message: string, key: Array<string>, objectOrPath?: string | Object, details?: any): void; | ||
hint(message: string, key: Array<string>, objectOrPath?: string | Object, details?: any): void; | ||
error(message: string, key: Array<string>, objectOrPath?: string | Object, details?: any): void; | ||
fatal(message: string, key: Array<string>, objectOrPath?: string | Object, details?: any): void; | ||
protected msg(channel: Channel, message: string, key: string[], source?: LogSource, details?: any): void; | ||
warning(message: string, key: string[], source?: LogSource, details?: any): void; | ||
hint(message: string, key: string[], source?: LogSource, details?: any): void; | ||
error(message: string, key: string[], source?: LogSource, details?: any): void; | ||
fatal(message: string, key: string[], source?: LogSource, details?: any): void; | ||
protected output(channel: Channel, message: string, details?: any): void; | ||
@@ -37,0 +37,0 @@ debug(message: string, details: any): void; |
@@ -162,35 +162,26 @@ "use strict"; | ||
} | ||
msg(channel, message, key, objectOrPath, details) { | ||
const sourcePosition = objectOrPath ? objectOrPath["_#get-position#_"] || String(objectOrPath) : undefined; | ||
if (objectOrPath && objectOrPath["_#get-position#_"]) | ||
this.message({ | ||
Channel: channel, | ||
Key: key, | ||
Source: [sourcePosition], | ||
Text: message, | ||
Details: details, | ||
}); | ||
else { | ||
this.message({ | ||
Channel: channel, | ||
Key: key, | ||
Source: [], | ||
Text: message, | ||
Details: details, | ||
}); | ||
} | ||
msg(channel, message, key, source, details) { | ||
const sourcePosition = source ? getPosition(this.filename, source) : undefined; | ||
const sources = sourcePosition ? [sourcePosition] : []; | ||
this.message({ | ||
Channel: channel, | ||
Key: key, | ||
Source: sources, | ||
Text: message, | ||
Details: details, | ||
}); | ||
} | ||
warning(message, key, objectOrPath, details) { | ||
this.msg(types_1.Channel.Warning, message, key, objectOrPath, details); | ||
warning(message, key, source, details) { | ||
this.msg(types_1.Channel.Warning, message, key, source, details); | ||
} | ||
hint(message, key, objectOrPath, details) { | ||
this.msg(types_1.Channel.Hint, message, key, objectOrPath, details); | ||
hint(message, key, source, details) { | ||
this.msg(types_1.Channel.Hint, message, key, source, details); | ||
} | ||
error(message, key, objectOrPath, details) { | ||
error(message, key, source, details) { | ||
this.errorCount++; | ||
this.msg(types_1.Channel.Error, message, key, objectOrPath, details); | ||
this.msg(types_1.Channel.Error, message, key, source, details); | ||
} | ||
fatal(message, key, objectOrPath, details) { | ||
fatal(message, key, source, details) { | ||
this.errorCount++; | ||
this.msg(types_1.Channel.Fatal, message, key, objectOrPath, details); | ||
this.msg(types_1.Channel.Fatal, message, key, source, details); | ||
} | ||
@@ -219,2 +210,14 @@ output(channel, message, details) { | ||
exports.startSession = startSession; | ||
function getPosition(document, source) { | ||
if (typeof source === "string") { | ||
return { Position: { path: source }, document }; | ||
} | ||
if (source[codegen_1.ShadowedNodePath]) { | ||
return { Position: { path: source[codegen_1.ShadowedNodePath] }, document }; | ||
} | ||
if ("path" in source || "line" in source) { | ||
return { Position: source, document }; | ||
} | ||
return undefined; | ||
} | ||
//# sourceMappingURL=convenience.js.map |
@@ -1,11 +0,16 @@ | ||
export declare type Position = { | ||
import { ShadowedObject } from "@azure-tools/codegen"; | ||
export interface Position { | ||
line: number; | ||
column: number; | ||
} | { | ||
path?: JsonPath; | ||
}; | ||
export declare type JsonPath = Array<string | number>; | ||
} | ||
export interface PathPosition { | ||
/** | ||
* Path to the element. Either as a json pointer string or as an array of segements. | ||
*/ | ||
path: JsonPointerSegments | string; | ||
} | ||
export declare type JsonPointerSegments = Array<string | number>; | ||
export interface SourceLocation { | ||
document: string; | ||
Position: Position; | ||
Position: Position | PathPosition; | ||
} | ||
@@ -47,3 +52,3 @@ export interface Artifact { | ||
Text: string; | ||
Source?: Array<SourceLocation>; | ||
Source?: SourceLocation[]; | ||
} | ||
@@ -70,2 +75,3 @@ export interface ArtifactMessage extends Message { | ||
} | ||
export declare type LogSource = string | Position | PathPosition | ShadowedObject<any>; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@autorest/extension-base", | ||
"version": "3.3.1", | ||
"version": "3.4.0-dev.1", | ||
"description": "Library for creating AutoRest extensions", | ||
"main": "dist/exports.js", | ||
"typings": "./dist/exports.d.ts", | ||
"main": "dist/index.js", | ||
"typings": "./dist/index.d.ts", | ||
"engines": { | ||
@@ -46,4 +46,4 @@ "node": ">=12.0.0" | ||
"vscode-jsonrpc": "^3.5.0", | ||
"@azure-tools/codegen": "~2.7.0" | ||
"@azure-tools/codegen": "~2.8.0-dev.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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
88906
1139
3
+ Added@azure-tools/codegen@2.8.0(transitive)
- Removed@azure-tools/codegen@2.7.0(transitive)