@arcgis/languages-api-utils 5.2.0-next.3 → 5.2.0-next.31
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/package.json +2 -2
- package/dist/ApiService.d.cts +0 -21
- package/dist/index.cjs +0 -3
- package/dist/index.d.cts +0 -3
- package/dist/types.d.cts +0 -117
- package/dist/utils.d.cts +0 -36
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/languages-api-utils",
|
|
3
|
-
"version": "5.2.0-next.
|
|
3
|
+
"version": "5.2.0-next.31",
|
|
4
4
|
"description": "ArcGIS Languages API Utilities",
|
|
5
5
|
"homepage": "https://developers.arcgis.com/javascript/latest/",
|
|
6
6
|
"type": "module",
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"tslib": "^2.8.1",
|
|
16
16
|
"vscode-languageserver-types": "^3.17.5",
|
|
17
|
-
"@arcgis/languages-sdk-spec": "5.2.0-next.
|
|
17
|
+
"@arcgis/languages-sdk-spec": "5.2.0-next.31"
|
|
18
18
|
}
|
|
19
19
|
}
|
package/dist/ApiService.d.cts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ApiCategory, ApiContext } from './types';
|
|
2
|
-
import { ApiDatabase } from './utils';
|
|
3
|
-
/**
|
|
4
|
-
* Language service settings
|
|
5
|
-
*/
|
|
6
|
-
export interface LanguageServiceSettings {
|
|
7
|
-
getApiLibrary: (locale: string) => Promise<ApiCategory[]>;
|
|
8
|
-
}
|
|
9
|
-
export declare class ApiService<TApiContext extends ApiContext = ApiContext> {
|
|
10
|
-
private _settings;
|
|
11
|
-
private localeToApiLibraryPromiseMap;
|
|
12
|
-
constructor(_settings: LanguageServiceSettings);
|
|
13
|
-
/**
|
|
14
|
-
* Returns the API definitions for the given settings: definitions, constant definitions, and function definitions
|
|
15
|
-
*/
|
|
16
|
-
getApiDatabase(context: TApiContext): Promise<ApiDatabase>;
|
|
17
|
-
/**
|
|
18
|
-
* Returns the API definitions
|
|
19
|
-
*/
|
|
20
|
-
getApiLibrary(context: TApiContext): Promise<ApiCategory[]>;
|
|
21
|
-
}
|
package/dist/index.cjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("vscode-languageserver-types");async function d(n,r){try{const t=await n,e=new Map,o=new Map,s=[],i=h(r);return t.forEach(c=>{const l=[];c.items.forEach(a=>g(l,o,e,i,a)),l.length&&s.push({...c,items:l})}),{categories:s,functionDefinitions:e,constantDefinitions:o}}catch(t){return console.error(t),{categories:[],functionDefinitions:new Map,constantDefinitions:new Map}}}function h(n){const{profile:{apiVersion:r,bundles:t,hiddenApiItems:e=[]}={}}=n,o=b(r),s=Array.isArray(t)&&t.length>0?new Set(["core",...t]):void 0;return i=>v(o,i.sinceVersion)&&(!s||s.has(i.bundle))&&!e.includes(i.name)}function g(n,r,t,e,o){if(Array.isArray(o)){o.forEach(s=>y(n,t,e,s));return}o.type==="constant"?A(n,r,e,o):y(n,t,e,o)}function y(n,r,t,e){if(!t(e))return;e.disableDocumentation||n.push(e);const{completion:{label:o}}=e,s=o.toLowerCase();let i=r.get(s);i||(i={type:"functionDefinition",key:s,overloads:[]},r.set(s,i)),i.overloads.push(e)}function A(n,r,t,e){if(!t(e))return;n.push(e);const{completion:{label:o}}=e,s=o.toLowerCase();r.set(s,e);const[i,c]=e.completion.label.split(".");if(!c)return;const l=i.toLowerCase();let a=r.get(l);a||(a={type:"namespace",key:l,members:[],completion:{label:i,detail:i,insertText:i,insertTextMode:p.InsertTextMode.adjustIndentation,insertTextFormat:p.InsertTextFormat.PlainText,kind:p.CompletionItemKind.Enum}},r.set(l,a));const u=structuredClone(e);u.name=c,u.completion.label=c,u.completion.insertText=c,u.completion.kind=p.CompletionItemKind.Constant,a.members.push(u),a.completion.documentation=a.members.reduce((f,m)=>(f.value=`${f.value}${f.value?`
|
|
2
|
-
|
|
3
|
-
`:""}**${m.completion.label}**: ${m.description}`,f),{kind:p.MarkupKind.Markdown,value:""})}function b(n){if(!n||typeof n!="string")return null;const r=n.split(".").map(o=>Number.parseInt(o));if(r.some(Number.isNaN))return console.error("Invalid API version string",n),null;const[t,e]=r.slice(0,2);return{major:t,minor:e}}function v(n,r){if(!n)return!0;const t=b(r);return t?n.major>t.major?!1:n.minor===void 0||t.minor===void 0?!0:t.minor<=n.minor:!0}function w(n){return!!n&&n.type!=="dictionary"}function L(n){return n?.type==="dictionary"}class M{constructor(r){this._settings=r,this.localeToApiLibraryPromiseMap=new Map}async getApiDatabase(r){const{locale:t="en"}=r;let e=this.localeToApiLibraryPromiseMap.get(t);return e||(e=this._settings.getApiLibrary(t),this.localeToApiLibraryPromiseMap.set(t,e)),await d(e,r)}async getApiLibrary(r){const{categories:t}=await this.getApiDatabase(r);return t}}exports.ApiService=M;exports.filterApiLibraryForContext=d;exports.isDictionaryVariable=L;exports.isValueVariable=w;
|
package/dist/index.d.cts
DELETED
package/dist/types.d.cts
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import { SdkConstant as ApiConstant, SdkFunction as ApiFunction, SdkVariableType as ApiVariableType, SdkPredefinedProfile, BundleType, ProfileId, SdkCategory, ArcadeSdkPredefinedProfile, SqlSdkPredefinedProfile } from '@arcgis/languages-sdk-spec';
|
|
2
|
-
import { CompletionItem } from 'vscode-languageserver-types';
|
|
3
|
-
export type { ApiConstant, ApiFunction, BundleType };
|
|
4
|
-
/**
|
|
5
|
-
* Represent items stored in the library
|
|
6
|
-
*/
|
|
7
|
-
export type ApiItem = ApiConstant | ApiFunction;
|
|
8
|
-
/**
|
|
9
|
-
* Represent a category of api items in the api library
|
|
10
|
-
*/
|
|
11
|
-
export interface ApiCategory extends SdkCategory {
|
|
12
|
-
items: ApiItem[];
|
|
13
|
-
}
|
|
14
|
-
export type { ProfileId, ApiVariableType, SdkPredefinedProfile, ArcadeSdkPredefinedProfile, SqlSdkPredefinedProfile };
|
|
15
|
-
/**
|
|
16
|
-
* The editor can be extended with custom snippets
|
|
17
|
-
*/
|
|
18
|
-
export interface ApiSnippet {
|
|
19
|
-
/**
|
|
20
|
-
* The label for the snippet. The editor will use it to offer the snippet based on the text typed in the editor.
|
|
21
|
-
* It's recommended to keep it short and as close as possible to what the user may be looking for.
|
|
22
|
-
* For example: 'polyline'
|
|
23
|
-
*/
|
|
24
|
-
label: string;
|
|
25
|
-
/**
|
|
26
|
-
* A slightly longer description of what the snippet offers.
|
|
27
|
-
*/
|
|
28
|
-
detail: string;
|
|
29
|
-
/**
|
|
30
|
-
* A string that should be inserted into the script when selecting
|
|
31
|
-
* this snippet.
|
|
32
|
-
*
|
|
33
|
-
* The `insertText` is subject to interpretation by the editor.
|
|
34
|
-
* Use this rules: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#snippet_syntax
|
|
35
|
-
*/
|
|
36
|
-
insertText: string;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Language service api options
|
|
40
|
-
*/
|
|
41
|
-
export interface ApiContext {
|
|
42
|
-
/**
|
|
43
|
-
* The profile (variables, additional api items, bundles, etc.)
|
|
44
|
-
*/
|
|
45
|
-
profile?: ApiProfile;
|
|
46
|
-
/**
|
|
47
|
-
* The locale for the Api
|
|
48
|
-
*/
|
|
49
|
-
locale?: string;
|
|
50
|
-
/**
|
|
51
|
-
* Allows to augment the language snippets with a collection of snippets
|
|
52
|
-
*/
|
|
53
|
-
snippets?: ApiSnippet[];
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Language service profile
|
|
57
|
-
*/
|
|
58
|
-
export interface ApiProfile {
|
|
59
|
-
/**
|
|
60
|
-
* The wellknown profile id if applicable
|
|
61
|
-
*/
|
|
62
|
-
id?: ProfileId;
|
|
63
|
-
/**
|
|
64
|
-
* The set of profile variables
|
|
65
|
-
*/
|
|
66
|
-
variables: ApiVariable[];
|
|
67
|
-
/**
|
|
68
|
-
* The api version to use
|
|
69
|
-
*/
|
|
70
|
-
apiVersion?: string;
|
|
71
|
-
/**
|
|
72
|
-
* The api bundles to use
|
|
73
|
-
*/
|
|
74
|
-
bundles?: BundleType[];
|
|
75
|
-
/**
|
|
76
|
-
* A collection of api item names to hide.
|
|
77
|
-
*/
|
|
78
|
-
hiddenApiItems?: string[];
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* The type for value variable.
|
|
82
|
-
*/
|
|
83
|
-
export type ApiValueVariableType = Exclude<ApiVariableType, "dictionary">;
|
|
84
|
-
interface ApiVariableBase {
|
|
85
|
-
/**
|
|
86
|
-
* Name of the variable
|
|
87
|
-
*/
|
|
88
|
-
name: string;
|
|
89
|
-
/**
|
|
90
|
-
* Optional short description for the variable
|
|
91
|
-
*/
|
|
92
|
-
description?: string;
|
|
93
|
-
/**
|
|
94
|
-
* Completion item for the variable, leveraged bu the editor
|
|
95
|
-
*/
|
|
96
|
-
completion?: CompletionItem;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Describes a dictionary type (feature, dictionary)
|
|
100
|
-
*/
|
|
101
|
-
export interface ApiDictionaryVariable extends ApiVariableBase {
|
|
102
|
-
type: "dictionary";
|
|
103
|
-
/**
|
|
104
|
-
* Dictionary properties
|
|
105
|
-
*/
|
|
106
|
-
properties?: ApiVariable[];
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Describes a simple variable type (number, featureSet, etc.)
|
|
110
|
-
*/
|
|
111
|
-
export interface ApiValueVariable extends ApiVariableBase {
|
|
112
|
-
type: ApiValueVariableType;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* The profile variable type
|
|
116
|
-
*/
|
|
117
|
-
export type ApiVariable = ApiDictionaryVariable | ApiValueVariable;
|
package/dist/utils.d.cts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { SdkConstant as ApiConstant, SdkFunction as ApiFunction, SdkCategory } from '@arcgis/languages-sdk-spec';
|
|
2
|
-
import { ApiCategory, ApiContext, ApiDictionaryVariable, ApiValueVariable, ApiVariable } from './types';
|
|
3
|
-
import { CompletionItem } from 'vscode-languageserver-types';
|
|
4
|
-
export interface ApiVersion {
|
|
5
|
-
major: number;
|
|
6
|
-
minor?: number;
|
|
7
|
-
}
|
|
8
|
-
export type ApiConstantNamespace = {
|
|
9
|
-
type: "namespace";
|
|
10
|
-
key: string;
|
|
11
|
-
members: ApiConstant[];
|
|
12
|
-
completion: CompletionItem;
|
|
13
|
-
};
|
|
14
|
-
export type ApiConstantDefinition = ApiConstant | ApiConstantNamespace;
|
|
15
|
-
export type ApiFunctionDefinition = {
|
|
16
|
-
type: "functionDefinition";
|
|
17
|
-
key: string;
|
|
18
|
-
overloads: ApiFunction[];
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Describes the API properties
|
|
22
|
-
*/
|
|
23
|
-
export interface ApiDatabase {
|
|
24
|
-
categories: ApiCategory[];
|
|
25
|
-
functionDefinitions: Map<string, ApiFunctionDefinition>;
|
|
26
|
-
constantDefinitions: Map<string, ApiConstantDefinition>;
|
|
27
|
-
}
|
|
28
|
-
export declare function filterApiLibraryForContext(apiLibraryPromise: Promise<SdkCategory[]>, context: ApiContext): Promise<ApiDatabase>;
|
|
29
|
-
/**
|
|
30
|
-
* Helper function to test if a variable is a value variable
|
|
31
|
-
*/
|
|
32
|
-
export declare function isValueVariable(variable: ApiVariable | null | undefined): variable is ApiValueVariable;
|
|
33
|
-
/**
|
|
34
|
-
* Helper function to test if a variable is a dictionary variable
|
|
35
|
-
*/
|
|
36
|
-
export declare function isDictionaryVariable(variable: ApiVariable | null | undefined): variable is ApiDictionaryVariable;
|