@corsa-bind/napi 0.3.2 → 0.7.0

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/dist/index.d.mts CHANGED
@@ -1,10 +1,12 @@
1
- import { ApiClientOptions, ApiMode, CapabilitiesResponse, ConfigResponse, DiagnosticsCapabilities, DocumentIdentifier, EditorCapabilities, FileChangeSummary, FileChanges, FileDiagnosticsResponse, InitializeResponse, OverlayCapabilities, OverlayChanges, OverlayUpdate, ProjectDiagnosticsResponse, ProjectResponse, RuntimeCapabilities, SnapshotDiagnosticsResponse, TypeResponse, TypeTextKind, UnsafeTypeFlowInput, UpdateSnapshotParams, UpdateSnapshotResponse, VirtualChange, VirtualDocumentState } from "./types.mjs";
1
+ import { ApiClientOptions, ApiMode, CapabilitiesResponse, ConfigResponse, DiagnosticsCapabilities, DocumentIdentifier, EditorCapabilities, FileChangeSummary, FileChanges, FileDiagnosticsResponse, InitializeResponse, NativeLintDiagnostic, NativeLintFix, NativeLintNode, NativeLintRange, NativeLintRuleMeta, NativeLintSuggestion, OverlayCapabilities, OverlayChanges, OverlayUpdate, ProjectDiagnosticsResponse, ProjectResponse, RuntimeCapabilities, SnapshotDiagnosticsResponse, SymbolResponse, TypeResponse, TypeTextKind, UnsafeTypeFlowInput, UpdateSnapshotParams, UpdateSnapshotResponse, VirtualChange, VirtualDocumentState } from "./types.mjs";
2
2
  import * as ___index_js0 from "../index.js";
3
3
 
4
4
  //#region index.d.ts
5
5
  declare const binding: typeof ___index_js0;
6
6
  declare function isUnsafeAssignment(input: UnsafeTypeFlowInput): boolean;
7
7
  declare function isUnsafeReturn(input: UnsafeTypeFlowInput): boolean;
8
+ declare function runNativeLintRule(ruleName: string, node: NativeLintNode): NativeLintDiagnostic[];
9
+ declare function nativeLintRuleMetas(): NativeLintRuleMeta[];
8
10
  declare function classifyTypeText(text?: string): TypeTextKind;
9
11
  declare function splitTopLevelTypeText(text: string, delimiter: string): string[];
10
12
  declare function splitTypeText(text: string): string[];
@@ -38,6 +40,11 @@ declare class CorsaApiClient {
38
40
  updateSnapshot(params?: UpdateSnapshotParams): UpdateSnapshotResponse;
39
41
  getSourceFile(snapshot: string, project: string, file: string): Uint8Array | null;
40
42
  getStringType(snapshot: string, project: string): TypeResponse;
43
+ getTypeAtPosition(snapshot: string, project: string, file: string, position: number): TypeResponse | undefined;
44
+ getSymbolAtPosition(snapshot: string, project: string, file: string, position: number): SymbolResponse | undefined;
45
+ getTypeArguments(snapshot: string, project: string, typeHandle: string, objectFlags?: number): TypeResponse[];
46
+ getTypeOfSymbol(snapshot: string, project: string, symbol: string): TypeResponse | undefined;
47
+ getDeclaredTypeOfSymbol(snapshot: string, project: string, symbol: string): TypeResponse | undefined;
41
48
  typeToString(snapshot: string, project: string, typeHandle: string, location?: string, flags?: number): string;
42
49
  callJson<T>(method: string, params?: unknown): T;
43
50
  callBinary(method: string, params?: unknown): Uint8Array | null;
@@ -72,5 +79,5 @@ declare class CorsaDistributedOrchestrator {
72
79
  }
73
80
  declare const version: typeof ___index_js0.version;
74
81
  //#endregion
75
- export { ApiClientOptions, ApiMode, CapabilitiesResponse, ConfigResponse, CorsaApiClient, CorsaApiClient as TsgoApiClient, CorsaDistributedOrchestrator, CorsaDistributedOrchestrator as TsgoDistributedOrchestrator, CorsaVirtualDocument, CorsaVirtualDocument as TsgoVirtualDocument, DiagnosticsCapabilities, DocumentIdentifier, EditorCapabilities, FileChangeSummary, FileChanges, FileDiagnosticsResponse, InitializeResponse, OverlayCapabilities, OverlayChanges, OverlayUpdate, ProjectDiagnosticsResponse, ProjectResponse, RuntimeCapabilities, SnapshotDiagnosticsResponse, TypeResponse, TypeTextKind, UnsafeTypeFlowInput, UpdateSnapshotParams, UpdateSnapshotResponse, Utils, VirtualChange, VirtualDocumentState, classifyTypeText, binding as default, isAnyLikeTypeTexts, isArrayLikeTypeTexts, isBigIntLikeTypeTexts, isErrorLikeTypeTexts, isNumberLikeTypeTexts, isPromiseLikeTypeTexts, isStringLikeTypeTexts, isUnknownLikeTypeTexts, isUnsafeAssignment, isUnsafeReturn, splitTopLevelTypeText, splitTypeText, version };
82
+ export { ApiClientOptions, ApiMode, CapabilitiesResponse, ConfigResponse, CorsaApiClient, CorsaApiClient as TsgoApiClient, CorsaDistributedOrchestrator, CorsaDistributedOrchestrator as TsgoDistributedOrchestrator, CorsaVirtualDocument, CorsaVirtualDocument as TsgoVirtualDocument, DiagnosticsCapabilities, DocumentIdentifier, EditorCapabilities, FileChangeSummary, FileChanges, FileDiagnosticsResponse, InitializeResponse, NativeLintDiagnostic, NativeLintFix, NativeLintNode, NativeLintRange, NativeLintRuleMeta, NativeLintSuggestion, OverlayCapabilities, OverlayChanges, OverlayUpdate, ProjectDiagnosticsResponse, ProjectResponse, RuntimeCapabilities, SnapshotDiagnosticsResponse, SymbolResponse, TypeResponse, TypeTextKind, UnsafeTypeFlowInput, UpdateSnapshotParams, UpdateSnapshotResponse, Utils, VirtualChange, VirtualDocumentState, classifyTypeText, binding as default, isAnyLikeTypeTexts, isArrayLikeTypeTexts, isBigIntLikeTypeTexts, isErrorLikeTypeTexts, isNumberLikeTypeTexts, isPromiseLikeTypeTexts, isStringLikeTypeTexts, isUnknownLikeTypeTexts, isUnsafeAssignment, isUnsafeReturn, nativeLintRuleMetas, runNativeLintRule, splitTopLevelTypeText, splitTypeText, version };
76
83
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -13,6 +13,12 @@ function isUnsafeAssignment(input) {
13
13
  function isUnsafeReturn(input) {
14
14
  return binding.isUnsafeReturn(toJson(input));
15
15
  }
16
+ function runNativeLintRule(ruleName, node) {
17
+ return fromJson(binding.runNativeLintRule(ruleName, toJson(node)));
18
+ }
19
+ function nativeLintRuleMetas() {
20
+ return fromJson(binding.nativeLintRuleMetasJson());
21
+ }
16
22
  function classifyTypeText(text) {
17
23
  return binding.classifyTypeText(text);
18
24
  }
@@ -82,6 +88,21 @@ var CorsaApiClient = class CorsaApiClient {
82
88
  getStringType(snapshot, project) {
83
89
  return fromJson(this.#inner.getStringTypeJson(snapshot, project));
84
90
  }
91
+ getTypeAtPosition(snapshot, project, file, position) {
92
+ return fromJson(this.#inner.getTypeAtPositionJson(snapshot, project, file, position)) ?? void 0;
93
+ }
94
+ getSymbolAtPosition(snapshot, project, file, position) {
95
+ return fromJson(this.#inner.getSymbolAtPositionJson(snapshot, project, file, position)) ?? void 0;
96
+ }
97
+ getTypeArguments(snapshot, project, typeHandle, objectFlags) {
98
+ return fromJson(this.#inner.getTypeArgumentsJson(snapshot, project, typeHandle, objectFlags));
99
+ }
100
+ getTypeOfSymbol(snapshot, project, symbol) {
101
+ return fromJson(this.#inner.getTypeOfSymbolJson(snapshot, project, symbol)) ?? void 0;
102
+ }
103
+ getDeclaredTypeOfSymbol(snapshot, project, symbol) {
104
+ return fromJson(this.#inner.getDeclaredTypeOfSymbolJson(snapshot, project, symbol)) ?? void 0;
105
+ }
85
106
  typeToString(snapshot, project, typeHandle, location, flags) {
86
107
  return this.#inner.typeToString(snapshot, project, typeHandle, location, flags);
87
108
  }
@@ -171,6 +192,6 @@ var CorsaDistributedOrchestrator = class {
171
192
  };
172
193
  const version = binding.version;
173
194
  //#endregion
174
- export { CorsaApiClient, CorsaApiClient as TsgoApiClient, CorsaDistributedOrchestrator, CorsaDistributedOrchestrator as TsgoDistributedOrchestrator, CorsaVirtualDocument, CorsaVirtualDocument as TsgoVirtualDocument, Utils, classifyTypeText, binding as default, isAnyLikeTypeTexts, isArrayLikeTypeTexts, isBigIntLikeTypeTexts, isErrorLikeTypeTexts, isNumberLikeTypeTexts, isPromiseLikeTypeTexts, isStringLikeTypeTexts, isUnknownLikeTypeTexts, isUnsafeAssignment, isUnsafeReturn, splitTopLevelTypeText, splitTypeText, version };
195
+ export { CorsaApiClient, CorsaApiClient as TsgoApiClient, CorsaDistributedOrchestrator, CorsaDistributedOrchestrator as TsgoDistributedOrchestrator, CorsaVirtualDocument, CorsaVirtualDocument as TsgoVirtualDocument, Utils, classifyTypeText, binding as default, isAnyLikeTypeTexts, isArrayLikeTypeTexts, isBigIntLikeTypeTexts, isErrorLikeTypeTexts, isNumberLikeTypeTexts, isPromiseLikeTypeTexts, isStringLikeTypeTexts, isUnknownLikeTypeTexts, isUnsafeAssignment, isUnsafeReturn, nativeLintRuleMetas, runNativeLintRule, splitTopLevelTypeText, splitTypeText, version };
175
196
 
176
197
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["#inner"],"sources":["../ts/index.ts"],"sourcesContent":["import * as nativeModule from \"../index.js\";\n\nimport type {\n ApiClientOptions,\n ConfigResponse,\n InitializeResponse,\n TypeTextKind,\n TypeResponse,\n UnsafeTypeFlowInput,\n UpdateSnapshotParams,\n UpdateSnapshotResponse,\n VirtualChange,\n VirtualDocumentState,\n} from \"./types\";\n\nconst binding = (\n \"default\" in nativeModule ? nativeModule.default : nativeModule\n) as typeof import(\"../index.js\");\n\ntype NativeApiClient = InstanceType<typeof binding.TsgoApiClient>;\ntype NativeDistributedOrchestrator = InstanceType<typeof binding.TsgoDistributedOrchestrator>;\ntype NativeVirtualDocument = InstanceType<typeof binding.TsgoVirtualDocument>;\n\nfunction fromJson<T>(value: string): T {\n return JSON.parse(value) as T;\n}\n\nfunction toJson(value: unknown): string {\n return JSON.stringify(value ?? null);\n}\n\nexport function isUnsafeAssignment(input: UnsafeTypeFlowInput): boolean {\n return binding.isUnsafeAssignment(toJson(input));\n}\n\nexport function isUnsafeReturn(input: UnsafeTypeFlowInput): boolean {\n return binding.isUnsafeReturn(toJson(input));\n}\n\nexport function classifyTypeText(text?: string): TypeTextKind {\n return binding.classifyTypeText(text) as TypeTextKind;\n}\n\nexport function splitTopLevelTypeText(text: string, delimiter: string): string[] {\n return binding.splitTopLevelTypeText(text, delimiter);\n}\n\nexport function splitTypeText(text: string): string[] {\n return binding.splitTypeText(text);\n}\n\nexport function isStringLikeTypeTexts(typeTexts: readonly string[]): boolean {\n return binding.isStringLikeTypeTexts([...typeTexts]);\n}\n\nexport function isNumberLikeTypeTexts(typeTexts: readonly string[]): boolean {\n return binding.isNumberLikeTypeTexts([...typeTexts]);\n}\n\nexport function isBigIntLikeTypeTexts(typeTexts: readonly string[]): boolean {\n return binding.isBigIntLikeTypeTexts([...typeTexts]);\n}\n\nexport function isAnyLikeTypeTexts(typeTexts: readonly string[]): boolean {\n return binding.isAnyLikeTypeTexts([...typeTexts]);\n}\n\nexport function isUnknownLikeTypeTexts(typeTexts: readonly string[]): boolean {\n return binding.isUnknownLikeTypeTexts([...typeTexts]);\n}\n\nexport function isArrayLikeTypeTexts(typeTexts: readonly string[]): boolean {\n return binding.isArrayLikeTypeTexts([...typeTexts]);\n}\n\nexport function isPromiseLikeTypeTexts(\n typeTexts: readonly string[],\n propertyNames: readonly string[] = [],\n): boolean {\n return binding.isPromiseLikeTypeTexts([...typeTexts], [...propertyNames]);\n}\n\nexport function isErrorLikeTypeTexts(\n typeTexts: readonly string[],\n propertyNames: readonly string[] = [],\n): boolean {\n return binding.isErrorLikeTypeTexts([...typeTexts], [...propertyNames]);\n}\n\nexport const Utils = Object.freeze({\n classifyTypeText,\n splitTopLevelTypeText,\n splitTypeText,\n isStringLikeTypeTexts,\n isNumberLikeTypeTexts,\n isBigIntLikeTypeTexts,\n isAnyLikeTypeTexts,\n isUnknownLikeTypeTexts,\n isArrayLikeTypeTexts,\n isPromiseLikeTypeTexts,\n isErrorLikeTypeTexts,\n});\n\nexport class CorsaApiClient {\n readonly #inner: NativeApiClient;\n\n private constructor(inner: NativeApiClient) {\n this.#inner = inner;\n }\n\n static spawn(options: ApiClientOptions): CorsaApiClient {\n return new CorsaApiClient(binding.TsgoApiClient.spawn(toJson(options)));\n }\n\n initialize(): InitializeResponse {\n return fromJson(this.#inner.initializeJson());\n }\n\n parseConfigFile(file: string): ConfigResponse {\n return fromJson(this.#inner.parseConfigFileJson(file));\n }\n\n updateSnapshot(params?: UpdateSnapshotParams): UpdateSnapshotResponse {\n return fromJson(this.#inner.updateSnapshotJson(params ? toJson(params) : undefined));\n }\n\n getSourceFile(snapshot: string, project: string, file: string): Uint8Array | null {\n return this.#inner.getSourceFile(snapshot, project, file) ?? null;\n }\n\n getStringType(snapshot: string, project: string): TypeResponse {\n return fromJson(this.#inner.getStringTypeJson(snapshot, project));\n }\n\n typeToString(\n snapshot: string,\n project: string,\n typeHandle: string,\n location?: string,\n flags?: number,\n ): string {\n return this.#inner.typeToString(snapshot, project, typeHandle, location, flags);\n }\n\n callJson<T>(method: string, params?: unknown): T {\n return fromJson(this.#inner.callJson(method, params ? toJson(params) : undefined));\n }\n\n callBinary(method: string, params?: unknown): Uint8Array | null {\n return this.#inner.callBinary(method, params ? toJson(params) : undefined) ?? null;\n }\n\n releaseHandle(handle: string): void {\n this.#inner.releaseHandle(handle);\n }\n\n close(): void {\n this.#inner.close();\n }\n}\n\nexport class CorsaVirtualDocument {\n readonly #inner: NativeVirtualDocument;\n\n private constructor(inner: NativeVirtualDocument) {\n this.#inner = inner;\n }\n\n static untitled(path: string, languageId: string, text: string): CorsaVirtualDocument {\n return new CorsaVirtualDocument(binding.TsgoVirtualDocument.untitled(path, languageId, text));\n }\n\n static inMemory(\n authority: string,\n path: string,\n languageId: string,\n text: string,\n ): CorsaVirtualDocument {\n return new CorsaVirtualDocument(\n binding.TsgoVirtualDocument.inMemory(authority, path, languageId, text),\n );\n }\n\n get uri(): string {\n return this.#inner.uri;\n }\n\n get languageId(): string {\n return this.#inner.languageId;\n }\n\n get version(): number {\n return this.#inner.version;\n }\n\n get text(): string {\n return this.#inner.text;\n }\n\n state(): VirtualDocumentState {\n return fromJson(this.#inner.stateJson());\n }\n\n replace(text: string): void {\n this.#inner.replace(text);\n }\n\n applyChanges(changes: VirtualChange[]): unknown[] {\n return fromJson(this.#inner.applyChangesJson(toJson(changes)));\n }\n}\n\nexport class CorsaDistributedOrchestrator {\n readonly #inner: NativeDistributedOrchestrator;\n\n constructor(nodeIds: string[]) {\n this.#inner = new binding.TsgoDistributedOrchestrator(nodeIds);\n }\n\n campaign(nodeId: string): number {\n return this.#inner.campaign(nodeId);\n }\n\n leaderId(): string | undefined {\n return this.#inner.leaderId() ?? undefined;\n }\n\n state<T>(): T | undefined {\n const value = this.#inner.stateJson();\n return value ? fromJson<T>(value) : undefined;\n }\n\n nodeState<T>(nodeId: string): T | undefined {\n const value = this.#inner.nodeStateJson(nodeId);\n return value ? fromJson<T>(value) : undefined;\n }\n\n document(nodeId: string, uri: string): VirtualDocumentState | undefined {\n const value = this.#inner.documentJson(nodeId, uri);\n return value ? fromJson<VirtualDocumentState>(value) : undefined;\n }\n\n openVirtualDocument(document: VirtualDocumentState): VirtualDocumentState {\n return fromJson(this.#inner.openVirtualDocumentJson(this.requireLeader(), toJson(document)));\n }\n\n changeVirtualDocument(uri: string, changes: VirtualChange[]): VirtualDocumentState {\n return fromJson(\n this.#inner.changeVirtualDocumentJson(this.requireLeader(), uri, toJson(changes)),\n );\n }\n\n closeVirtualDocument(uri: string): void {\n this.#inner.closeVirtualDocument(this.requireLeader(), uri);\n }\n\n private requireLeader(): string {\n const leaderId = this.leaderId();\n if (!leaderId) {\n throw new Error(\"raft leader has not been elected\");\n }\n return leaderId;\n }\n}\n\nexport {\n CorsaApiClient as TsgoApiClient,\n CorsaDistributedOrchestrator as TsgoDistributedOrchestrator,\n CorsaVirtualDocument as TsgoVirtualDocument,\n};\n\nexport default binding;\nexport const version = binding.version;\nexport type * from \"./types\";\n"],"mappings":";;AAeA,MAAM,UACJ,aAAa,eAAe,aAAa,UAAU;AAOrD,SAAS,SAAY,OAAkB;AACrC,QAAO,KAAK,MAAM,MAAM;;AAG1B,SAAS,OAAO,OAAwB;AACtC,QAAO,KAAK,UAAU,SAAS,KAAK;;AAGtC,SAAgB,mBAAmB,OAAqC;AACtE,QAAO,QAAQ,mBAAmB,OAAO,MAAM,CAAC;;AAGlD,SAAgB,eAAe,OAAqC;AAClE,QAAO,QAAQ,eAAe,OAAO,MAAM,CAA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ErD,SAAO;;;AAWX,MAAa,UAAU,QAAQ"}
1
+ {"version":3,"file":"index.mjs","names":["#inner"],"sources":["../ts/index.ts"],"sourcesContent":["import * as nativeModule from \"../index.js\";\n\nimport type {\n ApiClientOptions,\n ConfigResponse,\n InitializeResponse,\n NativeLintDiagnostic,\n NativeLintNode,\n NativeLintRuleMeta,\n SymbolResponse,\n TypeTextKind,\n TypeResponse,\n UnsafeTypeFlowInput,\n UpdateSnapshotParams,\n UpdateSnapshotResponse,\n VirtualChange,\n VirtualDocumentState,\n} from \"./types\";\n\nconst binding = (\n \"default\" in nativeModule ? nativeModule.default : nativeModule\n) as typeof import(\"../index.js\");\n\ntype NativeApiClient = InstanceType<typeof binding.TsgoApiClient>;\ntype NativeDistributedOrchestrator = InstanceType<typeof binding.TsgoDistributedOrchestrator>;\ntype NativeVirtualDocument = InstanceType<typeof binding.TsgoVirtualDocument>;\n\nfunction fromJson<T>(value: string): T {\n return JSON.parse(value) as T;\n}\n\nfunction toJson(value: unknown): string {\n return JSON.stringify(value ?? null);\n}\n\nexport function isUnsafeAssignment(input: UnsafeTypeFlowInput): boolean {\n return binding.isUnsafeAssignment(toJson(input));\n}\n\nexport function isUnsafeReturn(input: UnsafeTypeFlowInput): boolean {\n return binding.isUnsafeReturn(toJson(input));\n}\n\nexport function runNativeLintRule(ruleName: string, node: NativeLintNode): NativeLintDiagnostic[] {\n return fromJson(binding.runNativeLintRule(ruleName, toJson(node)));\n}\n\nexport function nativeLintRuleMetas(): NativeLintRuleMeta[] {\n return fromJson(binding.nativeLintRuleMetasJson());\n}\n\nexport function classifyTypeText(text?: string): TypeTextKind {\n return binding.classifyTypeText(text) as TypeTextKind;\n}\n\nexport function splitTopLevelTypeText(text: string, delimiter: string): string[] {\n return binding.splitTopLevelTypeText(text, delimiter);\n}\n\nexport function splitTypeText(text: string): string[] {\n return binding.splitTypeText(text);\n}\n\nexport function isStringLikeTypeTexts(typeTexts: readonly string[]): boolean {\n return binding.isStringLikeTypeTexts([...typeTexts]);\n}\n\nexport function isNumberLikeTypeTexts(typeTexts: readonly string[]): boolean {\n return binding.isNumberLikeTypeTexts([...typeTexts]);\n}\n\nexport function isBigIntLikeTypeTexts(typeTexts: readonly string[]): boolean {\n return binding.isBigIntLikeTypeTexts([...typeTexts]);\n}\n\nexport function isAnyLikeTypeTexts(typeTexts: readonly string[]): boolean {\n return binding.isAnyLikeTypeTexts([...typeTexts]);\n}\n\nexport function isUnknownLikeTypeTexts(typeTexts: readonly string[]): boolean {\n return binding.isUnknownLikeTypeTexts([...typeTexts]);\n}\n\nexport function isArrayLikeTypeTexts(typeTexts: readonly string[]): boolean {\n return binding.isArrayLikeTypeTexts([...typeTexts]);\n}\n\nexport function isPromiseLikeTypeTexts(\n typeTexts: readonly string[],\n propertyNames: readonly string[] = [],\n): boolean {\n return binding.isPromiseLikeTypeTexts([...typeTexts], [...propertyNames]);\n}\n\nexport function isErrorLikeTypeTexts(\n typeTexts: readonly string[],\n propertyNames: readonly string[] = [],\n): boolean {\n return binding.isErrorLikeTypeTexts([...typeTexts], [...propertyNames]);\n}\n\nexport const Utils = Object.freeze({\n classifyTypeText,\n splitTopLevelTypeText,\n splitTypeText,\n isStringLikeTypeTexts,\n isNumberLikeTypeTexts,\n isBigIntLikeTypeTexts,\n isAnyLikeTypeTexts,\n isUnknownLikeTypeTexts,\n isArrayLikeTypeTexts,\n isPromiseLikeTypeTexts,\n isErrorLikeTypeTexts,\n});\n\nexport class CorsaApiClient {\n readonly #inner: NativeApiClient;\n\n private constructor(inner: NativeApiClient) {\n this.#inner = inner;\n }\n\n static spawn(options: ApiClientOptions): CorsaApiClient {\n return new CorsaApiClient(binding.TsgoApiClient.spawn(toJson(options)));\n }\n\n initialize(): InitializeResponse {\n return fromJson(this.#inner.initializeJson());\n }\n\n parseConfigFile(file: string): ConfigResponse {\n return fromJson(this.#inner.parseConfigFileJson(file));\n }\n\n updateSnapshot(params?: UpdateSnapshotParams): UpdateSnapshotResponse {\n return fromJson(this.#inner.updateSnapshotJson(params ? toJson(params) : undefined));\n }\n\n getSourceFile(snapshot: string, project: string, file: string): Uint8Array | null {\n return this.#inner.getSourceFile(snapshot, project, file) ?? null;\n }\n\n getStringType(snapshot: string, project: string): TypeResponse {\n return fromJson(this.#inner.getStringTypeJson(snapshot, project));\n }\n\n getTypeAtPosition(\n snapshot: string,\n project: string,\n file: string,\n position: number,\n ): TypeResponse | undefined {\n return (\n fromJson<TypeResponse | null>(\n this.#inner.getTypeAtPositionJson(snapshot, project, file, position),\n ) ?? undefined\n );\n }\n\n getSymbolAtPosition(\n snapshot: string,\n project: string,\n file: string,\n position: number,\n ): SymbolResponse | undefined {\n return (\n fromJson<SymbolResponse | null>(\n this.#inner.getSymbolAtPositionJson(snapshot, project, file, position),\n ) ?? undefined\n );\n }\n\n getTypeArguments(\n snapshot: string,\n project: string,\n typeHandle: string,\n objectFlags?: number,\n ): TypeResponse[] {\n return fromJson(this.#inner.getTypeArgumentsJson(snapshot, project, typeHandle, objectFlags));\n }\n\n getTypeOfSymbol(snapshot: string, project: string, symbol: string): TypeResponse | undefined {\n return (\n fromJson<TypeResponse | null>(this.#inner.getTypeOfSymbolJson(snapshot, project, symbol)) ??\n undefined\n );\n }\n\n getDeclaredTypeOfSymbol(\n snapshot: string,\n project: string,\n symbol: string,\n ): TypeResponse | undefined {\n return (\n fromJson<TypeResponse | null>(\n this.#inner.getDeclaredTypeOfSymbolJson(snapshot, project, symbol),\n ) ?? undefined\n );\n }\n\n typeToString(\n snapshot: string,\n project: string,\n typeHandle: string,\n location?: string,\n flags?: number,\n ): string {\n return this.#inner.typeToString(snapshot, project, typeHandle, location, flags);\n }\n\n callJson<T>(method: string, params?: unknown): T {\n return fromJson(this.#inner.callJson(method, params ? toJson(params) : undefined));\n }\n\n callBinary(method: string, params?: unknown): Uint8Array | null {\n return this.#inner.callBinary(method, params ? toJson(params) : undefined) ?? null;\n }\n\n releaseHandle(handle: string): void {\n this.#inner.releaseHandle(handle);\n }\n\n close(): void {\n this.#inner.close();\n }\n}\n\nexport class CorsaVirtualDocument {\n readonly #inner: NativeVirtualDocument;\n\n private constructor(inner: NativeVirtualDocument) {\n this.#inner = inner;\n }\n\n static untitled(path: string, languageId: string, text: string): CorsaVirtualDocument {\n return new CorsaVirtualDocument(binding.TsgoVirtualDocument.untitled(path, languageId, text));\n }\n\n static inMemory(\n authority: string,\n path: string,\n languageId: string,\n text: string,\n ): CorsaVirtualDocument {\n return new CorsaVirtualDocument(\n binding.TsgoVirtualDocument.inMemory(authority, path, languageId, text),\n );\n }\n\n get uri(): string {\n return this.#inner.uri;\n }\n\n get languageId(): string {\n return this.#inner.languageId;\n }\n\n get version(): number {\n return this.#inner.version;\n }\n\n get text(): string {\n return this.#inner.text;\n }\n\n state(): VirtualDocumentState {\n return fromJson(this.#inner.stateJson());\n }\n\n replace(text: string): void {\n this.#inner.replace(text);\n }\n\n applyChanges(changes: VirtualChange[]): unknown[] {\n return fromJson(this.#inner.applyChangesJson(toJson(changes)));\n }\n}\n\nexport class CorsaDistributedOrchestrator {\n readonly #inner: NativeDistributedOrchestrator;\n\n constructor(nodeIds: string[]) {\n this.#inner = new binding.TsgoDistributedOrchestrator(nodeIds);\n }\n\n campaign(nodeId: string): number {\n return this.#inner.campaign(nodeId);\n }\n\n leaderId(): string | undefined {\n return this.#inner.leaderId() ?? undefined;\n }\n\n state<T>(): T | undefined {\n const value = this.#inner.stateJson();\n return value ? fromJson<T>(value) : undefined;\n }\n\n nodeState<T>(nodeId: string): T | undefined {\n const value = this.#inner.nodeStateJson(nodeId);\n return value ? fromJson<T>(value) : undefined;\n }\n\n document(nodeId: string, uri: string): VirtualDocumentState | undefined {\n const value = this.#inner.documentJson(nodeId, uri);\n return value ? fromJson<VirtualDocumentState>(value) : undefined;\n }\n\n openVirtualDocument(document: VirtualDocumentState): VirtualDocumentState {\n return fromJson(this.#inner.openVirtualDocumentJson(this.requireLeader(), toJson(document)));\n }\n\n changeVirtualDocument(uri: string, changes: VirtualChange[]): VirtualDocumentState {\n return fromJson(\n this.#inner.changeVirtualDocumentJson(this.requireLeader(), uri, toJson(changes)),\n );\n }\n\n closeVirtualDocument(uri: string): void {\n this.#inner.closeVirtualDocument(this.requireLeader(), uri);\n }\n\n private requireLeader(): string {\n const leaderId = this.leaderId();\n if (!leaderId) {\n throw new Error(\"raft leader has not been elected\");\n }\n return leaderId;\n }\n}\n\nexport {\n CorsaApiClient as TsgoApiClient,\n CorsaDistributedOrchestrator as TsgoDistributedOrchestrator,\n CorsaVirtualDocument as TsgoVirtualDocument,\n};\n\nexport default binding;\nexport const version = binding.version;\nexport type * from \"./types\";\n"],"mappings":";;AAmBA,MAAM,UACJ,aAAa,eAAe,aAAa,UAAU;AAOrD,SAAS,SAAY,OAAkB;AACrC,QAAO,KAAK,MAAM,MAAM;;AAG1B,SAAS,OAAO,OAAwB;AACtC,QAAO,KAAK,UAAU,SAAS,KAAK;;AAGtC,SAAgB,mBAAmB,OAAqC;AACtE,QAAO,QAAQ,mBAAmB,OAAO,MAAM,CAAC;;AAGlD,SAAgB,eAAe,OAAqC;AAClE,QAAO,QAAQ,eAAe,OAAO,MAAM,CAAC;;AAG9C,SAAgB,kBAAkB,UAAkB,MAA8C;AAChG,QAAO,SAAS,QAAQ,kBAAkB,UAAU,OAAO,KAAK,CAAC,CAAC;;AAGpE,SAAgB,sBAA4C;AAC1D,QAAO,SAAS,QAAQ,yBAAyB,CAAC;;AAGpD,SAAgB,iBAAiB,MAA6B;AAC5D,QAAO,QAAQ,iBAAiB,KAAK;;AAGvC,SAAgB,sBAAsB,MAAc,WAA6B;AAC/E,QAAO,QAAQ,sBAAsB,MAAM,UAAU;;AAGvD,SAAgB,cAAc,MAAwB;AACpD,QAAO,QAAQ,cAAc,KAAK;;AAGpC,SAAgB,sBAAsB,WAAuC;AAC3E,QAAO,QAAQ,sBAAsB,CAAC,GAAG,UAAU,CAAC;;AAGtD,SAAgB,sBAAsB,WAAuC;AAC3E,QAAO,QAAQ,sBAAsB,CAAC,GAA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Q,CAAC,CAClF;;CAGH,qBAAqB,KAAmB;AACtC,QAAA,MAAY,qBAAqB,KAAK,eAAe,EAAE,IAAI;;CAG7D,gBAAgC;EAC9B,MAAM,WAAW,KAAK,UAAU;AAChC,MAAI,CAAC,SACH,OAAM,IAAI,MAAM,mCAAmC;AAErD,SAAO;;;AAWX,MAAa,UAAU,QAAQ"}
package/dist/types.d.mts CHANGED
@@ -52,6 +52,14 @@ interface TypeResponse {
52
52
  symbol?: string;
53
53
  texts: string[];
54
54
  }
55
+ interface SymbolResponse {
56
+ id: string;
57
+ name: string;
58
+ flags: number;
59
+ checkFlags: number;
60
+ declarations: string[];
61
+ valueDeclaration?: string;
62
+ }
55
63
  interface OverlayUpdate {
56
64
  document: DocumentIdentifier;
57
65
  text: string;
@@ -107,6 +115,44 @@ interface UnsafeTypeFlowInput {
107
115
  sourceTypeTexts: readonly string[];
108
116
  targetTypeTexts?: readonly string[];
109
117
  }
118
+ interface NativeLintRange {
119
+ start: number;
120
+ end: number;
121
+ }
122
+ interface NativeLintNode {
123
+ kind: string;
124
+ range: NativeLintRange;
125
+ text?: string;
126
+ typeTexts?: readonly string[];
127
+ propertyNames?: readonly string[];
128
+ fields?: Record<string, unknown>;
129
+ children?: Record<string, NativeLintNode>;
130
+ childLists?: Record<string, readonly NativeLintNode[]>;
131
+ }
132
+ interface NativeLintFix {
133
+ range: NativeLintRange;
134
+ replacementText: string;
135
+ }
136
+ interface NativeLintSuggestion {
137
+ messageId: string;
138
+ message: string;
139
+ fixes: readonly NativeLintFix[];
140
+ }
141
+ interface NativeLintDiagnostic {
142
+ ruleName: string;
143
+ messageId: string;
144
+ message: string;
145
+ range: NativeLintRange;
146
+ suggestions?: readonly NativeLintSuggestion[];
147
+ }
148
+ interface NativeLintRuleMeta {
149
+ name: string;
150
+ docsDescription: string;
151
+ messages: Record<string, string>;
152
+ hasSuggestions: boolean;
153
+ listeners: readonly string[];
154
+ requiresTypeTexts: boolean;
155
+ }
110
156
  type TypeTextKind = "any" | "bigint" | "boolean" | "nullish" | "number" | "regexp" | "string" | "unknown" | "other";
111
157
  interface VirtualChange {
112
158
  range?: {
@@ -129,5 +175,5 @@ interface VirtualDocumentState {
129
175
  text: string;
130
176
  }
131
177
  //#endregion
132
- export { ApiClientOptions, ApiMode, CapabilitiesResponse, ConfigResponse, DiagnosticsCapabilities, DocumentIdentifier, EditorCapabilities, FileChangeSummary, FileChanges, FileDiagnosticsResponse, InitializeResponse, OverlayCapabilities, OverlayChanges, OverlayUpdate, ProjectDiagnosticsResponse, ProjectResponse, RuntimeCapabilities, SnapshotDiagnosticsResponse, TypeResponse, TypeTextKind, UnsafeTypeFlowInput, UpdateSnapshotParams, UpdateSnapshotResponse, VirtualChange, VirtualDocumentState };
178
+ export { ApiClientOptions, ApiMode, CapabilitiesResponse, ConfigResponse, DiagnosticsCapabilities, DocumentIdentifier, EditorCapabilities, FileChangeSummary, FileChanges, FileDiagnosticsResponse, InitializeResponse, NativeLintDiagnostic, NativeLintFix, NativeLintNode, NativeLintRange, NativeLintRuleMeta, NativeLintSuggestion, OverlayCapabilities, OverlayChanges, OverlayUpdate, ProjectDiagnosticsResponse, ProjectResponse, RuntimeCapabilities, SnapshotDiagnosticsResponse, SymbolResponse, TypeResponse, TypeTextKind, UnsafeTypeFlowInput, UpdateSnapshotParams, UpdateSnapshotResponse, VirtualChange, VirtualDocumentState };
133
179
  //# sourceMappingURL=types.d.mts.map
package/index.d.ts CHANGED
@@ -3,6 +3,8 @@
3
3
 
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
+ export declare function runNativeLintRule(ruleName: string, nodeJson: string): string
7
+ export declare function nativeLintRuleMetasJson(): string
6
8
  export declare function isUnsafeAssignment(inputJson: string): boolean
7
9
  export declare function isUnsafeReturn(inputJson: string): boolean
8
10
  export declare function classifyTypeText(text?: string | undefined | null): string
@@ -40,6 +42,16 @@ export declare class TsgoApiClient {
40
42
  getSourceFile(snapshot: string, project: string, file: string): Buffer | null
41
43
  /** Resolves the intrinsic string type for a project. */
42
44
  getStringTypeJson(snapshot: string, project: string): string
45
+ /** Resolves the checker type visible at a file position. */
46
+ getTypeAtPositionJson(snapshot: string, project: string, file: string, position: number): string
47
+ /** Resolves the checker symbol visible at a file position. */
48
+ getSymbolAtPositionJson(snapshot: string, project: string, file: string, position: number): string
49
+ /** Resolves type arguments for type-reference objects and returns [] otherwise. */
50
+ getTypeArgumentsJson(snapshot: string, project: string, typeHandle: string, objectFlags?: number | undefined | null): string
51
+ /** Resolves the apparent checker type of a symbol. */
52
+ getTypeOfSymbolJson(snapshot: string, project: string, symbol: string): string
53
+ /** Resolves the declared checker type of a symbol. */
54
+ getDeclaredTypeOfSymbolJson(snapshot: string, project: string, symbol: string): string
43
55
  /** Renders a type back to a string representation. */
44
56
  typeToString(snapshot: string, project: string, typeHandle: string, location?: string | undefined | null, flags?: number | undefined | null): string
45
57
  /** Sends an arbitrary JSON endpoint request. */
package/index.js CHANGED
@@ -310,10 +310,12 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { TsgoApiClient, TsgoVirtualDocument, TsgoDistributedOrchestrator, isUnsafeAssignment, isUnsafeReturn, classifyTypeText, splitTopLevelTypeText, splitTypeText, isStringLikeTypeTexts, isNumberLikeTypeTexts, isBigIntLikeTypeTexts, isAnyLikeTypeTexts, isUnknownLikeTypeTexts, isArrayLikeTypeTexts, isPromiseLikeTypeTexts, isErrorLikeTypeTexts, version } = nativeBinding
313
+ const { TsgoApiClient, TsgoVirtualDocument, runNativeLintRule, nativeLintRuleMetasJson, TsgoDistributedOrchestrator, isUnsafeAssignment, isUnsafeReturn, classifyTypeText, splitTopLevelTypeText, splitTypeText, isStringLikeTypeTexts, isNumberLikeTypeTexts, isBigIntLikeTypeTexts, isAnyLikeTypeTexts, isUnknownLikeTypeTexts, isArrayLikeTypeTexts, isPromiseLikeTypeTexts, isErrorLikeTypeTexts, version } = nativeBinding
314
314
 
315
315
  module.exports.TsgoApiClient = TsgoApiClient
316
316
  module.exports.TsgoVirtualDocument = TsgoVirtualDocument
317
+ module.exports.runNativeLintRule = runNativeLintRule
318
+ module.exports.nativeLintRuleMetasJson = nativeLintRuleMetasJson
317
319
  module.exports.TsgoDistributedOrchestrator = TsgoDistributedOrchestrator
318
320
  module.exports.isUnsafeAssignment = isUnsafeAssignment
319
321
  module.exports.isUnsafeReturn = isUnsafeReturn
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corsa-bind/napi",
3
- "version": "0.3.2",
3
+ "version": "0.7.0",
4
4
  "description": "Native Node.js bindings for corsa and typescript-go stdio workflows",
5
5
  "homepage": "https://github.com/ubugeeei/corsa-bind/tree/main/src/bindings/nodejs/corsa_node",
6
6
  "bugs": {
@@ -46,13 +46,13 @@
46
46
  "node": ">=22"
47
47
  },
48
48
  "optionalDependencies": {
49
- "@corsa-bind/napi-win32-x64-msvc": "0.3.2",
50
- "@corsa-bind/napi-darwin-x64": "0.3.2",
51
- "@corsa-bind/napi-linux-x64-gnu": "0.3.2",
52
- "@corsa-bind/napi-darwin-arm64": "0.3.2",
53
- "@corsa-bind/napi-win32-arm64-msvc": "0.3.2",
54
- "@corsa-bind/napi-linux-x64-musl": "0.3.2",
55
- "@corsa-bind/napi-linux-arm64-gnu": "0.3.2",
56
- "@corsa-bind/napi-linux-arm64-musl": "0.3.2"
49
+ "@corsa-bind/napi-win32-x64-msvc": "0.7.0",
50
+ "@corsa-bind/napi-darwin-x64": "0.7.0",
51
+ "@corsa-bind/napi-linux-x64-gnu": "0.7.0",
52
+ "@corsa-bind/napi-darwin-arm64": "0.7.0",
53
+ "@corsa-bind/napi-win32-arm64-msvc": "0.7.0",
54
+ "@corsa-bind/napi-linux-x64-musl": "0.7.0",
55
+ "@corsa-bind/napi-linux-arm64-gnu": "0.7.0",
56
+ "@corsa-bind/napi-linux-arm64-musl": "0.7.0"
57
57
  }
58
58
  }