@arcgis/languages-api-utils 5.2.0-next.98 → 6.0.0-next.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.
@@ -1,21 +1,23 @@
1
- import { ApiCategory, ApiContext } from './types';
2
- import { ApiDatabase } from './utils';
3
- /**
4
- * Language service settings
5
- */
1
+ import type { ApiCategory, ApiContext } from "./types.js";
2
+ import type { ApiDatabase } from "./utils.js";
3
+
4
+ /** Language service settings */
6
5
  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[]>;
6
+ getApiLibrary: (locale: string) => Promise<ApiCategory[]>;
21
7
  }
8
+
9
+ export class ApiService<TApiContext extends ApiContext = ApiContext> {
10
+ constructor(settings: LanguageServiceSettings);
11
+ /**
12
+ * Returns the API definitions for the given settings: definitions, constant definitions, and function definitions
13
+ *
14
+ * @param context
15
+ */
16
+ getApiDatabase(context: TApiContext): Promise<ApiDatabase>;
17
+ /**
18
+ * Returns the API definitions
19
+ *
20
+ * @param context
21
+ */
22
+ getApiLibrary(context: TApiContext): Promise<ApiCategory[]>;
23
+ }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- export * from './ApiService';
2
- export type * from './types';
3
- export * from './utils';
1
+ export * from "./ApiService.js";
2
+ export type * from "./types.js";
3
+ export * from "./utils.js";
4
+
package/dist/index.js CHANGED
@@ -95,11 +95,18 @@ function C(n) {
95
95
  return n?.type === "dictionary";
96
96
  }
97
97
  class D {
98
+ /**
99
+ * @public
100
+ * @param settings
101
+ */
98
102
  constructor(r) {
99
103
  this._settings = r, this.localeToApiLibraryPromiseMap = /* @__PURE__ */ new Map();
100
104
  }
101
105
  /**
102
106
  * Returns the API definitions for the given settings: definitions, constant definitions, and function definitions
107
+ *
108
+ * @public
109
+ * @param context
103
110
  */
104
111
  async getApiDatabase(r) {
105
112
  const { locale: t = "en" } = r;
@@ -108,6 +115,9 @@ class D {
108
115
  }
109
116
  /**
110
117
  * Returns the API definitions
118
+ *
119
+ * @public
120
+ * @param context
111
121
  */
112
122
  async getApiLibrary(r) {
113
123
  const { categories: t } = await this.getApiDatabase(r);
package/dist/types.d.ts CHANGED
@@ -1,117 +1,81 @@
1
- import { SdkConstant as ApiConstant, SdkFunction as ApiFunction, SdkVariableType as ApiVariableType, SdkPredefinedProfile, BundleType, ProfileId, SdkCategory, ArcadeSdkPredefinedProfile, SqlSdkPredefinedProfile, ArcadeRuntime } 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
- */
1
+ import type { SdkConstant as ApiConstant, SdkFunction as ApiFunction, SdkVariableType as ApiVariableType, BundleType, ProfileId, SdkCategory } from "@arcgis/languages-sdk-spec";
2
+ import type { CompletionItem } from "vscode-languageserver-types";
3
+
4
+ /** Represent items stored in the library */
7
5
  export type ApiItem = ApiConstant | ApiFunction;
8
- /**
9
- * Represent a category of api items in the api library
10
- */
6
+
7
+ /** Represent a category of api items in the api library */
11
8
  export interface ApiCategory extends SdkCategory {
12
- items: ApiItem[];
9
+ items: ApiItem[];
13
10
  }
14
- export type { ProfileId, ApiVariableType, SdkPredefinedProfile, ArcadeSdkPredefinedProfile, SqlSdkPredefinedProfile, ArcadeRuntime, };
15
- /**
16
- * The editor can be extended with custom snippets
17
- */
11
+
12
+ /** The editor can be extended with custom snippets */
18
13
  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;
14
+ /**
15
+ * The label for the snippet. The editor will use it to offer the snippet based on the text typed in the editor.
16
+ * It's recommended to keep it short and as close as possible to what the user may be looking for.
17
+ * For example: 'polyline'
18
+ */
19
+ label: string;
20
+ /** A slightly longer description of what the snippet offers. */
21
+ detail: string;
22
+ /**
23
+ * A string that should be inserted into the script when selecting
24
+ * this snippet.
25
+ *
26
+ * The `insertText` is subject to interpretation by the editor.
27
+ * Use this rules: https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#snippet_syntax
28
+ */
29
+ insertText: string;
37
30
  }
38
- /**
39
- * Language service api options
40
- */
31
+
32
+ /** Language service api options */
41
33
  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[];
34
+ /** The profile (variables, additional api items, bundles, etc.) */
35
+ profile?: ApiProfile;
36
+ /** The locale for the Api */
37
+ locale?: string;
38
+ /** Allows to augment the language snippets with a collection of snippets */
39
+ snippets?: ApiSnippet[];
54
40
  }
55
- /**
56
- * Language service profile
57
- */
41
+
42
+ /** Language service profile */
58
43
  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[];
44
+ /** The wellknown profile id if applicable */
45
+ id?: ProfileId;
46
+ /** The set of profile variables */
47
+ variables: ApiVariable[];
48
+ /** The api version to use */
49
+ apiVersion?: string;
50
+ /** The api bundles to use */
51
+ bundles?: BundleType[];
52
+ /** A collection of api item names to hide. */
53
+ hiddenApiItems?: string[];
79
54
  }
80
- /**
81
- * The type for value variable.
82
- */
55
+
56
+ /** The type for value variable. */
83
57
  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;
58
+
59
+ export interface ApiVariableBase {
60
+ /** Name of the variable */
61
+ name: string;
62
+ /** Optional short description for the variable */
63
+ description?: string;
64
+ /** Completion item for the variable, leveraged bu the editor */
65
+ completion?: CompletionItem;
97
66
  }
98
- /**
99
- * Describes a dictionary type (feature, dictionary)
100
- */
67
+
68
+ /** Describes a dictionary type (feature, dictionary) */
101
69
  export interface ApiDictionaryVariable extends ApiVariableBase {
102
- type: "dictionary";
103
- /**
104
- * Dictionary properties
105
- */
106
- properties?: ApiVariable[];
70
+ type: "dictionary";
71
+ /** Dictionary properties */
72
+ properties?: ApiVariable[];
107
73
  }
108
- /**
109
- * Describes a simple variable type (number, featureSet, etc.)
110
- */
74
+
75
+ /** Describes a simple variable type (number, featureSet, etc.) */
111
76
  export interface ApiValueVariable extends ApiVariableBase {
112
- type: ApiValueVariableType;
77
+ type: ApiValueVariableType;
113
78
  }
114
- /**
115
- * The profile variable type
116
- */
117
- export type ApiVariable = ApiDictionaryVariable | ApiValueVariable;
79
+
80
+ /** The profile variable type */
81
+ export type ApiVariable = ApiDictionaryVariable | ApiValueVariable;
package/dist/utils.d.ts CHANGED
@@ -1,36 +1,50 @@
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';
1
+ import type { SdkConstant as ApiConstant, SdkFunction as ApiFunction, SdkCategory } from "@arcgis/languages-sdk-spec";
2
+ import type { ApiCategory, ApiContext, ApiDictionaryVariable, ApiValueVariable, ApiVariable } from "./types.js";
3
+ import type { CompletionItem } from "vscode-languageserver-types";
4
+
4
5
  export interface ApiVersion {
5
- major: number;
6
- minor?: number;
6
+ major: number;
7
+ minor?: number;
7
8
  }
9
+
8
10
  export type ApiConstantNamespace = {
9
- type: "namespace";
10
- key: string;
11
- members: ApiConstant[];
12
- completion: CompletionItem;
11
+ type: "namespace";
12
+ key: string;
13
+ members: ApiConstant[];
14
+ completion: CompletionItem;
13
15
  };
16
+
14
17
  export type ApiConstantDefinition = ApiConstant | ApiConstantNamespace;
18
+
15
19
  export type ApiFunctionDefinition = {
16
- type: "functionDefinition";
17
- key: string;
18
- overloads: ApiFunction[];
20
+ type: "functionDefinition";
21
+ key: string;
22
+ overloads: ApiFunction[];
19
23
  };
20
- /**
21
- * Describes the API properties
22
- */
24
+
25
+ /** Describes the API properties */
23
26
  export interface ApiDatabase {
24
- categories: ApiCategory[];
25
- functionDefinitions: Map<string, ApiFunctionDefinition>;
26
- constantDefinitions: Map<string, ApiConstantDefinition>;
27
+ categories: ApiCategory[];
28
+ functionDefinitions: Map<string, ApiFunctionDefinition>;
29
+ constantDefinitions: Map<string, ApiConstantDefinition>;
27
30
  }
28
- export declare function filterApiLibraryForContext(apiLibraryPromise: Promise<SdkCategory[]>, context: ApiContext): Promise<ApiDatabase>;
31
+
32
+ /**
33
+ * @param apiLibraryPromise
34
+ * @param context
35
+ */
36
+ export function filterApiLibraryForContext(apiLibraryPromise: Promise<SdkCategory[]>, context: ApiContext): Promise<ApiDatabase>;
37
+
29
38
  /**
30
39
  * Helper function to test if a variable is a value variable
40
+ *
41
+ * @param variable
31
42
  */
32
- export declare function isValueVariable(variable: ApiVariable | null | undefined): variable is ApiValueVariable;
43
+ export function isValueVariable(variable: ApiVariable | null | undefined): variable is ApiValueVariable;
44
+
33
45
  /**
34
46
  * Helper function to test if a variable is a dictionary variable
47
+ *
48
+ * @param variable
35
49
  */
36
- export declare function isDictionaryVariable(variable: ApiVariable | null | undefined): variable is ApiDictionaryVariable;
50
+ export function isDictionaryVariable(variable: ApiVariable | null | undefined): variable is ApiDictionaryVariable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/languages-api-utils",
3
- "version": "5.2.0-next.98",
3
+ "version": "6.0.0-next.0",
4
4
  "description": "ArcGIS Languages API Utilities",
5
5
  "homepage": "https://developers.arcgis.com/javascript/latest/",
6
6
  "type": "module",
@@ -12,7 +12,7 @@
12
12
  ],
13
13
  "license": "SEE LICENSE IN LICENSE.md",
14
14
  "dependencies": {
15
- "@arcgis/languages-sdk-spec": "5.2.0-next.98",
15
+ "@arcgis/languages-sdk-spec": "6.0.0-next.0",
16
16
  "tslib": "^2.8.1",
17
17
  "vscode-languageserver-types": "^3.17.5"
18
18
  }