@arcgis/languages-api-utils 4.31.0-next.64 → 4.31.0-next.67
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/cjs/index.cjs +2 -2
- package/dist/cjs/index.d.cts +32 -40
- package/dist/esm/index.d.ts +32 -40
- package/dist/esm/index.js +2 -2
- package/package.json +4 -4
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var f=Object.defineProperty;var
|
|
1
|
+
"use strict";var f=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var h=(e,t)=>{for(var n in t)f(e,n,{get:t[n],enumerable:!0})},k=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of x(t))!D.call(e,o)&&o!==n&&f(e,o,{get:()=>t[o],enumerable:!(i=C(t,o))||i.enumerable});return e};var M=e=>k(f({},"__esModule",{value:!0}),e);var w={};h(w,{ApiService:()=>d,filterApiLibraryForContext:()=>A,isDictionaryVariable:()=>V,isValueVariable:()=>S});module.exports=M(w);var s=require("vscode-languageserver-types");async function A(e,t){try{let n=await e,i=new Map,o=new Map,a=[],r=T(t);return n.forEach(c=>{let l=[];c.items.forEach(p=>v(l,o,i,r,p)),l.length&&a.push({...c,items:l})}),{categories:a,functionDefinitions:i,constantDefinitions:o}}catch(n){return console.error(n),{categories:[],functionDefinitions:new Map,constantDefinitions:new Map}}}function T(e){let{profile:{apiVersion:t,bundles:n,hiddenApiItems:i=[]}={}}=e,o=g(t),a=Array.isArray(n)&&n.length>0?new Set(["core",...n]):void 0;return r=>L(o,r.sinceVersion)&&(!a||a.has(r.bundle))&&!i.includes(r.name)}function v(e,t,n,i,o){if(Array.isArray(o)){o.forEach(a=>b(e,n,i,a));return}o.type==="constant"?F(e,t,i,o):b(e,n,i,o)}function b(e,t,n,i){if(!n(i))return;i.disableDocumentation||e.push(i);let{completion:{label:o}}=i,a=o.toLowerCase(),r=t.get(a);r||(r={type:"functionDefinition",key:a,overloads:[]},t.set(a,r)),r.overloads.push(i)}function F(e,t,n,i){if(!n(i))return;e.push(i);let{completion:{label:o}}=i,a=o.toLowerCase();t.set(a,i);let[r,c]=i.completion.label.split(".");if(!c)return;let l=r.toLowerCase(),p=t.get(l);p||(p={type:"namespace",key:l,members:[],completion:{label:r,detail:r,insertText:r,insertTextMode:s.InsertTextMode.adjustIndentation,insertTextFormat:s.InsertTextFormat.PlainText,kind:s.CompletionItemKind.Enum}},t.set(l,p));let u=structuredClone(i);u.name=c,u.completion.label=c,u.completion.insertText=c,u.completion.kind=s.CompletionItemKind.Constant,p.members.push(u),p.completion.documentation=p.members.reduce((m,y)=>(m.value=`${m.value}${m.value?`
|
|
2
2
|
|
|
3
|
-
`:""}**${
|
|
3
|
+
`:""}**${y.completion.label}**: ${y.description}`,m),{kind:s.MarkupKind.Markdown,value:""})}function g(e){if(!e||typeof e!="string")return null;let t=e.split(".").map(o=>Number.parseInt(o));if(t.some(Number.isNaN))return console.error("Invalid API version string",e),null;let[n,i]=t.slice(0,2);return{major:n,minor:i}}function L(e,t){if(!e)return!0;let n=g(t);return n?e.major>n.major?!1:e.minor===void 0||n.minor===void 0?!0:n.minor<=e.minor:!0}function S(e){return!!e&&e.type!=="dictionary"}function V(e){return e?.type==="dictionary"}var d=class{constructor(t){this._settings=t;this.localeToApiLibraryPromiseMap=new Map}async getApiDatabase(t){let{locale:n="en"}=t,i=this.localeToApiLibraryPromiseMap.get(n);return i||(i=this._settings.getApiLibrary(n),this.localeToApiLibraryPromiseMap.set(n,i)),await A(i,t)}async getApiLibrary(t){let{categories:n}=await this.getApiDatabase(t);return n}};0&&(module.exports={ApiService,filterApiLibraryForContext,isDictionaryVariable,isValueVariable});
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -145,6 +145,17 @@ interface SdkFunction extends SdkItemBase {
|
|
|
145
145
|
*/
|
|
146
146
|
type SdkItem = SdkConstant | SdkFunction | SdkFunction[];
|
|
147
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Represent items stored in the library
|
|
150
|
+
*/
|
|
151
|
+
type ApiItem = SdkConstant | SdkFunction;
|
|
152
|
+
/**
|
|
153
|
+
* Represent a category of api items in the api library
|
|
154
|
+
*/
|
|
155
|
+
interface ApiCategory extends SdkCategory {
|
|
156
|
+
items: ApiItem[];
|
|
157
|
+
}
|
|
158
|
+
|
|
148
159
|
/**
|
|
149
160
|
* The editor can be extended with custom snippets
|
|
150
161
|
*/
|
|
@@ -248,45 +259,11 @@ interface ApiValueVariable extends ApiVariableBase {
|
|
|
248
259
|
* The profile variable type
|
|
249
260
|
*/
|
|
250
261
|
type ApiVariable = ApiDictionaryVariable | ApiValueVariable;
|
|
251
|
-
/**
|
|
252
|
-
* Helper function to test if a variable is a value variable
|
|
253
|
-
*/
|
|
254
|
-
declare function isValueVariable(variable: ApiVariable | null | undefined): variable is ApiValueVariable;
|
|
255
|
-
/**
|
|
256
|
-
* Helper function to test if a variable is a dictionary variable
|
|
257
|
-
*/
|
|
258
|
-
declare function isDictionaryVariable(variable: ApiVariable | null | undefined): variable is ApiDictionaryVariable;
|
|
259
262
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
type ApiItem = SdkConstant | SdkFunction;
|
|
264
|
-
/**
|
|
265
|
-
* Represent a category of api items in the api library
|
|
266
|
-
*/
|
|
267
|
-
interface ApiCategory extends SdkCategory {
|
|
268
|
-
items: ApiItem[];
|
|
263
|
+
interface ApiVersion {
|
|
264
|
+
major: number;
|
|
265
|
+
minor?: number;
|
|
269
266
|
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Language service settings
|
|
273
|
-
*/
|
|
274
|
-
interface LanguageServiceSettings {
|
|
275
|
-
/**
|
|
276
|
-
* The path to the assets folder where the api files are stored
|
|
277
|
-
*/
|
|
278
|
-
assetsPath?: string;
|
|
279
|
-
/**
|
|
280
|
-
* A template string for constructing the path to the api definition
|
|
281
|
-
* example: `${assetsPath}/api/arcade-api.t9n.${locale}.json`
|
|
282
|
-
*/
|
|
283
|
-
apiPathTemplate: string;
|
|
284
|
-
/**
|
|
285
|
-
* The language id
|
|
286
|
-
*/
|
|
287
|
-
languageId: string;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
267
|
type ApiConstantNamespace = {
|
|
291
268
|
type: "namespace";
|
|
292
269
|
key: string;
|
|
@@ -307,9 +284,25 @@ interface ApiDatabase {
|
|
|
307
284
|
functionDefinitions: Map<string, ApiFunctionDefinition>;
|
|
308
285
|
constantDefinitions: Map<string, ApiConstantDefinition>;
|
|
309
286
|
}
|
|
287
|
+
declare function filterApiLibraryForContext(apiLibraryPromise: Promise<SdkCategory[]>, context: ApiContext): Promise<ApiDatabase>;
|
|
288
|
+
/**
|
|
289
|
+
* Helper function to test if a variable is a value variable
|
|
290
|
+
*/
|
|
291
|
+
declare function isValueVariable(variable: ApiVariable | null | undefined): variable is ApiValueVariable;
|
|
292
|
+
/**
|
|
293
|
+
* Helper function to test if a variable is a dictionary variable
|
|
294
|
+
*/
|
|
295
|
+
declare function isDictionaryVariable(variable: ApiVariable | null | undefined): variable is ApiDictionaryVariable;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Language service settings
|
|
299
|
+
*/
|
|
300
|
+
interface LanguageServiceSettings {
|
|
301
|
+
getApiLibrary: (locale: string) => Promise<ApiCategory[]>;
|
|
302
|
+
}
|
|
310
303
|
declare class ApiService<TApiContext extends ApiContext = ApiContext> {
|
|
311
304
|
private _settings;
|
|
312
|
-
private
|
|
305
|
+
private localeToApiLibraryPromiseMap;
|
|
313
306
|
constructor(_settings: LanguageServiceSettings);
|
|
314
307
|
/**
|
|
315
308
|
* Returns the API definitions for the given settings: definitions, constant definitions, and function definitions
|
|
@@ -319,7 +312,6 @@ declare class ApiService<TApiContext extends ApiContext = ApiContext> {
|
|
|
319
312
|
* Returns the API definitions
|
|
320
313
|
*/
|
|
321
314
|
getApiLibrary(context: TApiContext): Promise<ApiCategory[]>;
|
|
322
|
-
private loadSdkApiLibrary;
|
|
323
315
|
}
|
|
324
316
|
|
|
325
|
-
export { type ApiCategory, type SdkConstant as ApiConstant, type ApiConstantDefinition, type ApiConstantNamespace, type ApiContext, type ApiDatabase, type ApiDictionaryVariable, type SdkFunction as ApiFunction, type ApiFunctionDefinition, type ApiItem, type ApiProfile, ApiService, type ApiSnippet, type ApiValueVariable, type ApiValueVariableType, type ApiVariable, type SdkVariableType as ApiVariableType, type BundleType, type LanguageServiceSettings, type ProfileId, type SdkPredefinedProfile, isDictionaryVariable, isValueVariable };
|
|
317
|
+
export { type ApiCategory, type SdkConstant as ApiConstant, type ApiConstantDefinition, type ApiConstantNamespace, type ApiContext, type ApiDatabase, type ApiDictionaryVariable, type SdkFunction as ApiFunction, type ApiFunctionDefinition, type ApiItem, type ApiProfile, ApiService, type ApiSnippet, type ApiValueVariable, type ApiValueVariableType, type ApiVariable, type SdkVariableType as ApiVariableType, type ApiVersion, type BundleType, type LanguageServiceSettings, type ProfileId, type SdkPredefinedProfile, filterApiLibraryForContext, isDictionaryVariable, isValueVariable };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -145,6 +145,17 @@ interface SdkFunction extends SdkItemBase {
|
|
|
145
145
|
*/
|
|
146
146
|
type SdkItem = SdkConstant | SdkFunction | SdkFunction[];
|
|
147
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Represent items stored in the library
|
|
150
|
+
*/
|
|
151
|
+
type ApiItem = SdkConstant | SdkFunction;
|
|
152
|
+
/**
|
|
153
|
+
* Represent a category of api items in the api library
|
|
154
|
+
*/
|
|
155
|
+
interface ApiCategory extends SdkCategory {
|
|
156
|
+
items: ApiItem[];
|
|
157
|
+
}
|
|
158
|
+
|
|
148
159
|
/**
|
|
149
160
|
* The editor can be extended with custom snippets
|
|
150
161
|
*/
|
|
@@ -248,45 +259,11 @@ interface ApiValueVariable extends ApiVariableBase {
|
|
|
248
259
|
* The profile variable type
|
|
249
260
|
*/
|
|
250
261
|
type ApiVariable = ApiDictionaryVariable | ApiValueVariable;
|
|
251
|
-
/**
|
|
252
|
-
* Helper function to test if a variable is a value variable
|
|
253
|
-
*/
|
|
254
|
-
declare function isValueVariable(variable: ApiVariable | null | undefined): variable is ApiValueVariable;
|
|
255
|
-
/**
|
|
256
|
-
* Helper function to test if a variable is a dictionary variable
|
|
257
|
-
*/
|
|
258
|
-
declare function isDictionaryVariable(variable: ApiVariable | null | undefined): variable is ApiDictionaryVariable;
|
|
259
262
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
type ApiItem = SdkConstant | SdkFunction;
|
|
264
|
-
/**
|
|
265
|
-
* Represent a category of api items in the api library
|
|
266
|
-
*/
|
|
267
|
-
interface ApiCategory extends SdkCategory {
|
|
268
|
-
items: ApiItem[];
|
|
263
|
+
interface ApiVersion {
|
|
264
|
+
major: number;
|
|
265
|
+
minor?: number;
|
|
269
266
|
}
|
|
270
|
-
|
|
271
|
-
/**
|
|
272
|
-
* Language service settings
|
|
273
|
-
*/
|
|
274
|
-
interface LanguageServiceSettings {
|
|
275
|
-
/**
|
|
276
|
-
* The path to the assets folder where the api files are stored
|
|
277
|
-
*/
|
|
278
|
-
assetsPath?: string;
|
|
279
|
-
/**
|
|
280
|
-
* A template string for constructing the path to the api definition
|
|
281
|
-
* example: `${assetsPath}/api/arcade-api.t9n.${locale}.json`
|
|
282
|
-
*/
|
|
283
|
-
apiPathTemplate: string;
|
|
284
|
-
/**
|
|
285
|
-
* The language id
|
|
286
|
-
*/
|
|
287
|
-
languageId: string;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
267
|
type ApiConstantNamespace = {
|
|
291
268
|
type: "namespace";
|
|
292
269
|
key: string;
|
|
@@ -307,9 +284,25 @@ interface ApiDatabase {
|
|
|
307
284
|
functionDefinitions: Map<string, ApiFunctionDefinition>;
|
|
308
285
|
constantDefinitions: Map<string, ApiConstantDefinition>;
|
|
309
286
|
}
|
|
287
|
+
declare function filterApiLibraryForContext(apiLibraryPromise: Promise<SdkCategory[]>, context: ApiContext): Promise<ApiDatabase>;
|
|
288
|
+
/**
|
|
289
|
+
* Helper function to test if a variable is a value variable
|
|
290
|
+
*/
|
|
291
|
+
declare function isValueVariable(variable: ApiVariable | null | undefined): variable is ApiValueVariable;
|
|
292
|
+
/**
|
|
293
|
+
* Helper function to test if a variable is a dictionary variable
|
|
294
|
+
*/
|
|
295
|
+
declare function isDictionaryVariable(variable: ApiVariable | null | undefined): variable is ApiDictionaryVariable;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Language service settings
|
|
299
|
+
*/
|
|
300
|
+
interface LanguageServiceSettings {
|
|
301
|
+
getApiLibrary: (locale: string) => Promise<ApiCategory[]>;
|
|
302
|
+
}
|
|
310
303
|
declare class ApiService<TApiContext extends ApiContext = ApiContext> {
|
|
311
304
|
private _settings;
|
|
312
|
-
private
|
|
305
|
+
private localeToApiLibraryPromiseMap;
|
|
313
306
|
constructor(_settings: LanguageServiceSettings);
|
|
314
307
|
/**
|
|
315
308
|
* Returns the API definitions for the given settings: definitions, constant definitions, and function definitions
|
|
@@ -319,7 +312,6 @@ declare class ApiService<TApiContext extends ApiContext = ApiContext> {
|
|
|
319
312
|
* Returns the API definitions
|
|
320
313
|
*/
|
|
321
314
|
getApiLibrary(context: TApiContext): Promise<ApiCategory[]>;
|
|
322
|
-
private loadSdkApiLibrary;
|
|
323
315
|
}
|
|
324
316
|
|
|
325
|
-
export { type ApiCategory, type SdkConstant as ApiConstant, type ApiConstantDefinition, type ApiConstantNamespace, type ApiContext, type ApiDatabase, type ApiDictionaryVariable, type SdkFunction as ApiFunction, type ApiFunctionDefinition, type ApiItem, type ApiProfile, ApiService, type ApiSnippet, type ApiValueVariable, type ApiValueVariableType, type ApiVariable, type SdkVariableType as ApiVariableType, type BundleType, type LanguageServiceSettings, type ProfileId, type SdkPredefinedProfile, isDictionaryVariable, isValueVariable };
|
|
317
|
+
export { type ApiCategory, type SdkConstant as ApiConstant, type ApiConstantDefinition, type ApiConstantNamespace, type ApiContext, type ApiDatabase, type ApiDictionaryVariable, type SdkFunction as ApiFunction, type ApiFunctionDefinition, type ApiItem, type ApiProfile, ApiService, type ApiSnippet, type ApiValueVariable, type ApiValueVariableType, type ApiVariable, type SdkVariableType as ApiVariableType, type ApiVersion, type BundleType, type LanguageServiceSettings, type ProfileId, type SdkPredefinedProfile, filterApiLibraryForContext, isDictionaryVariable, isValueVariable };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{CompletionItemKind as f,InsertTextFormat as
|
|
1
|
+
import{CompletionItemKind as f,InsertTextFormat as g,InsertTextMode as C,MarkupKind as x}from"vscode-languageserver-types";async function d(t,i){try{let n=await t,e=new Map,o=new Map,a=[],r=D(i);return n.forEach(p=>{let c=[];p.items.forEach(s=>h(c,o,e,r,s)),c.length&&a.push({...p,items:c})}),{categories:a,functionDefinitions:e,constantDefinitions:o}}catch(n){return console.error(n),{categories:[],functionDefinitions:new Map,constantDefinitions:new Map}}}function D(t){let{profile:{apiVersion:i,bundles:n,hiddenApiItems:e=[]}={}}=t,o=y(i),a=Array.isArray(n)&&n.length>0?new Set(["core",...n]):void 0;return r=>M(o,r.sinceVersion)&&(!a||a.has(r.bundle))&&!e.includes(r.name)}function h(t,i,n,e,o){if(Array.isArray(o)){o.forEach(a=>A(t,n,e,a));return}o.type==="constant"?k(t,i,e,o):A(t,n,e,o)}function A(t,i,n,e){if(!n(e))return;e.disableDocumentation||t.push(e);let{completion:{label:o}}=e,a=o.toLowerCase(),r=i.get(a);r||(r={type:"functionDefinition",key:a,overloads:[]},i.set(a,r)),r.overloads.push(e)}function k(t,i,n,e){if(!n(e))return;t.push(e);let{completion:{label:o}}=e,a=o.toLowerCase();i.set(a,e);let[r,p]=e.completion.label.split(".");if(!p)return;let c=r.toLowerCase(),s=i.get(c);s||(s={type:"namespace",key:c,members:[],completion:{label:r,detail:r,insertText:r,insertTextMode:C.adjustIndentation,insertTextFormat:g.PlainText,kind:f.Enum}},i.set(c,s));let l=structuredClone(e);l.name=p,l.completion.label=p,l.completion.insertText=p,l.completion.kind=f.Constant,s.members.push(l),s.completion.documentation=s.members.reduce((u,m)=>(u.value=`${u.value}${u.value?`
|
|
2
2
|
|
|
3
|
-
`:""}**${
|
|
3
|
+
`:""}**${m.completion.label}**: ${m.description}`,u),{kind:x.Markdown,value:""})}function y(t){if(!t||typeof t!="string")return null;let i=t.split(".").map(o=>Number.parseInt(o));if(i.some(Number.isNaN))return console.error("Invalid API version string",t),null;let[n,e]=i.slice(0,2);return{major:n,minor:e}}function M(t,i){if(!t)return!0;let n=y(i);return n?t.major>n.major?!1:t.minor===void 0||n.minor===void 0?!0:n.minor<=t.minor:!0}function v(t){return!!t&&t.type!=="dictionary"}function F(t){return t?.type==="dictionary"}var b=class{constructor(i){this._settings=i;this.localeToApiLibraryPromiseMap=new Map}async getApiDatabase(i){let{locale:n="en"}=i,e=this.localeToApiLibraryPromiseMap.get(n);return e||(e=this._settings.getApiLibrary(n),this.localeToApiLibraryPromiseMap.set(n,e)),await d(e,i)}async getApiLibrary(i){let{categories:n}=await this.getApiDatabase(i);return n}};export{b as ApiService,d as filterApiLibraryForContext,F as isDictionaryVariable,v as isValueVariable};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/languages-api-utils",
|
|
3
|
-
"version": "4.31.0-next.
|
|
3
|
+
"version": "4.31.0-next.67",
|
|
4
4
|
"description": "ArcGIS Languages API Utilities",
|
|
5
5
|
"homepage": "https://developers.arcgis.com/javascript/latest/",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
18
18
|
"scripts": {
|
|
19
|
-
"build:dev": "yarn build:esm --sourcemap",
|
|
19
|
+
"build:dev": "yarn build:esm --sourcemap --no-minify",
|
|
20
20
|
"build:cjs": "tsup --format cjs --outDir dist/cjs --silent --minify",
|
|
21
21
|
"build:esm": "tsup --format esm --outDir dist/esm --silent --minify",
|
|
22
22
|
"build": "npm run build:cjs && npm run build:esm",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@arcgis/arcade-sdk": "~1.26.5",
|
|
32
|
-
"@arcgis/typescript-config": "4.31.0-next.
|
|
32
|
+
"@arcgis/typescript-config": "4.31.0-next.67",
|
|
33
33
|
"@swc/core": "^1.7.11",
|
|
34
34
|
"@swc/jest": "^0.2.36",
|
|
35
35
|
"@types/jest": "^29.5.0",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"tsup": "^8.1.0",
|
|
41
41
|
"typescript": "~5.4.0"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "d42716bf4b5fb039ad270bec4e4a44d60bd8770a"
|
|
44
44
|
}
|