@hitc/netsuite-types 2025.1.12 → 2025.1.14

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/N/email.d.ts CHANGED
@@ -11,7 +11,7 @@ interface SendOptions {
11
11
  * A maximum of 10 recipients (recipient + cc + bcc) is allowed.
12
12
  * Note: Only the first recipient displays on the Communication tab (under the Recipient column).
13
13
  */
14
- recipients: number[]|string[]|number|string;
14
+ recipients: number|string|number[]|string[]|readonly number[]|readonly string[];
15
15
  /**
16
16
  * The email address that appears in the reply-to header when an email is sent out.
17
17
  */
@@ -21,13 +21,13 @@ interface SendOptions {
21
21
  * For multiple recipients, use an array of internal IDs or email addresses. You can use an array that contains a combination of internal IDs and email addresses.
22
22
  * A maximum of 10 recipients (recipient + cc + bcc) is allowed.
23
23
  */
24
- cc?: string[]|number[];
24
+ cc?: number[]|string[]|readonly number[]|readonly string[];
25
25
  /**
26
26
  * The internal ID or email address of the secondary recipient to blind copy.
27
27
  * For multiple recipients, use an array of internal IDs or email addresses. You can use an array that contains a combination of internal IDs and email addresses.
28
28
  * A maximum of 10 recipients (recipient + cc + bcc) is allowed.
29
29
  */
30
- bcc?: string[]|number[];
30
+ bcc?: number[]|string[]|readonly number[]|readonly string[];
31
31
  /**
32
32
  * Subject of the outgoing message
33
33
  */
@@ -41,7 +41,7 @@ interface SendOptions {
41
41
  * An individual attachment must not exceed 5MB and the total message size must be 15MB or less.
42
42
  * Note: Supported for server-side scripts only.
43
43
  */
44
- attachments?: File[];
44
+ attachments?: File[]|readonly File[];
45
45
  /**
46
46
  * Object that contains key/value pairs to associate the Message record with related records (including custom records).
47
47
  */
@@ -49,7 +49,7 @@ interface SendOptions {
49
49
  /**
50
50
  * If true, the Message record is not visible to an external Entity (for example, a customer or contact). Default is false.
51
51
  */
52
- isInternalOnly?: boolean;
52
+ isInternalOnly?: boolean;
53
53
  }
54
54
 
55
55
  interface RelatedRecordTypes {
package/N/llm.d.ts CHANGED
@@ -3,34 +3,177 @@
3
3
  * You can use this module to send requests to the large language models (LLMs) supported by NetSuite and to receive LLM responses to use in your scripts.
4
4
  */
5
5
 
6
+ import type {File} from './file';
7
+
6
8
  /** The chat message object returned by the llm.createChatMessage(options) method. */
7
9
  interface ChatMessage {
8
10
  text: string;
9
11
  readonly role: ChatRole;
10
12
  }
11
13
 
14
+ /**
15
+ * A citation returned from the LLM when source documents are provided to llm.generateText(options) or llm.generateText.promise(options).
16
+ *
17
+ * A citation represents the content from source documents where the LLM found relevant information for its response.
18
+ * Citations are created using retrieval-augmented generation (RAG), which lets you provide additional context that the LLM can use to generate its responses.
19
+ * For more information about RAG, see What Is Retrieval-Augmented Generation (RAG)?
20
+ *
21
+ * Citation objects are included in the llm.Response object that is returned from llm.generateText(options) or llm.generateText.promise(options), if applicable, through the Response.citations property.
22
+ * You can use the citation object to identify the documents that the LLM used for its response, as well as where the cited text appears in the response.
23
+ * The object includes properties that specify the documents used (Citation.documentIds), the start and end points of the cited text (Citation.start and Citation.end), and the content itself (Citation.text).
24
+ */
25
+ interface Citation {
26
+ documentIds: string[];
27
+ readonly end: number;
28
+ readonly start: number;
29
+ readonly text: string;
30
+ }
31
+
12
32
  /** The response returned from LLM. Use the llm.generateText(options) or the llm.generateText.promise(options) method to retrieve a response from the LLM. */
13
33
  interface Response {
34
+ readonly citations: Citation[];
35
+ readonly documents: Document[];
14
36
  readonly text: string;
15
37
  readonly model: string;
16
38
  readonly chatHistory: ChatMessage[];
17
39
  }
18
40
 
41
+ interface StreamedResponse {
42
+ readonly citations: Citation[];
43
+ readonly documents: Document[];
44
+ readonly text: string;
45
+ readonly model: string;
46
+ readonly chatHistory: ChatMessage[];
47
+ }
48
+
49
+ /**
50
+ * Creates a chat message based on a specified role and text.
51
+ * Chat messages can be used in the chatHistory parameter of the llm.generateText(options) method.
52
+ * Supported roles are defined by the llm.ChatRole enum.
53
+ */
19
54
  export function createChatMessage(options: { role: string, text: string }): ChatMessage;
20
55
 
56
+ /**
57
+ * Creates a document with the specified ID and content.
58
+ *
59
+ * A document represents source content that you can provide as additional context to the LLM when you call llm.generateText(options) or llm.generateText.promise(options).
60
+ * The LLM uses information in the provided documents to augment its response using retrieval-augmented generation (RAG).
61
+ * For more information about RAG, see What Is Retrieval-Augmented Generation (RAG)?
62
+ *
63
+ * You do not need to use this method to create a document before providing the document to llm.generateText(options) or llm.generateText.promise(options).
64
+ * You can also provide a plain JavaScript object that uses the id and data properties.
65
+ */
66
+ export function createDocument(options: { data: string, id: string }): Document;
67
+
68
+ export const embed: IEmbededFunction
69
+
70
+ /**
71
+ * Takes the ID of an existing prompt and values for variables used in the prompt and returns the response from the LLM.
72
+ *
73
+ * You can use this method to evaluate a prompt that is available in Prompt Studio by providing values for any variables that the prompt uses.
74
+ * The resulting prompt is sent to the LLM, and this method returns the LLM response, similar to the llm.generateText(options) method.
75
+ * For more information about Prompt Studio, see Prompt Studio.
76
+ *
77
+ * When unlimited usage mode is used, this method accepts the OCI configuration parameters.
78
+ * You can also specify OCI configuration parameters on the SuiteScript tab of the AI Preferences page.
79
+ * For more information, see Using Your Own OCI Configuration for SuiteScript Generative AI APIs.
80
+ */
81
+ export const evaluatePrompt: IEvaluatePromptFunction;
82
+
83
+ export const evaluatePromptStreamed: IEvaluatePromptStreamedFunction;
84
+
21
85
  export const generateText: GenerateTextFunction;
22
86
 
87
+ /**
88
+ * Returns the streamed response from the LLM for a given prompt.
89
+ *
90
+ * This method is similar to llm.generateText(options) but returns the LLM response as a stream.
91
+ * After calling this method, you can access the partial response (using the StreamedResponse.text property of the returned llm.StreamedResponse object) before the entire response has been generated.
92
+ * You can also use an iterator to examine each token returned by the LLM.
93
+ */
94
+ export const generateTextStreamed: GenerateTextStreamedFunction;
95
+
23
96
  /** Returns the number of free requests in the current month. */
24
97
  export const getRemainingFreeUsage: GetRemainingFreeUsageFunction;
25
98
 
99
+ /** Returns the number of free embeddings requests in the current month. This method tracks free requests for embed API calls, such as llm.embed(options). To track free requests for non-embed API calls (such as llm.generateText(options)), use llm.getRemainingFreeUsage() instead. */
100
+ export const getRemainingFreeEmbedUsage: GetRemainingFreeUsageFunction;
101
+
102
+ interface IEmbededFunction {
103
+ (options: IEmbedOptions): EmbeddedResponse;
104
+ promise(options: IEmbedOptions): Promise<EmbeddedResponse>;
105
+ }
106
+
107
+ interface IEvaluatePromptFunction {
108
+ (options: IEvaluatePromptOptions): Response;
109
+ promise(options: IEvaluatePromptOptions): Promise<Response>;
110
+ }
111
+
112
+ interface IEvaluatePromptStreamedFunction {
113
+ (options: IEvaluatePromptOptions): StreamedResponse;
114
+ promise(options: IEvaluatePromptOptions): Promise<StreamedResponse>;
115
+ }
116
+
26
117
  interface GenerateTextFunction {
27
118
  (options: IGenerateTextOptions): Response;
28
- promise(options: IGenerateTextOptions): Response;
119
+ promise(options: IGenerateTextOptions): Promise<Response>;
120
+ }
121
+
122
+ interface GenerateTextStreamedFunction {
123
+ (options: IGenerateTextOptions): StreamedResponse;
124
+ promise(options: IGenerateTextOptions): Promise<StreamedResponse>;
29
125
  }
30
126
 
31
127
  interface GetRemainingFreeUsageFunction {
32
128
  (): number;
33
- promise(): number;
129
+ promise(): Promise<number>;
130
+ }
131
+
132
+ interface EmbeddedResponse {
133
+ readonly embeddings: number[];
134
+ /** The list of inputs used to generate the embeddings response. */
135
+ readonly inputs: string[];
136
+ /** The model used to generate the embeddings response. */
137
+ readonly model: string;
138
+ }
139
+
140
+ interface IEmbedOptions {
141
+ /** An array of inputs to get embeddings for. */
142
+ inputs: string[] | readonly string[];
143
+ /** The embed model family to use. Use values from llm.EmbedModelFamily to set this value. If not specified, the Cohere Embed Multilingual model is used. */
144
+ embededModelFamily?: string;
145
+ /** Configuration needed for unlimited usage through OCI Generative AI Service. Required only when accessing the LLM through an Oracle Cloud Account and the OCI Generative AI Service. SuiteApps installed to target accounts are prevented from using the free usage pool for N/llm and must use the OCI configuration. */
146
+ ociConfig?: IOCIConfig;
147
+ /** The amount of time to wait for a response from the LLM, in milliseconds. If not specified, the default value is 30,000. */
148
+ timeout?: number;
149
+ /** The truncation method to use when embeddings input exceeds 512 tokens. Use values from llm.Truncate to set this value. If not specified, no truncation method is used. */
150
+ truncate?: string;
151
+ }
152
+
153
+ interface IEvaluatePromptOptions {
154
+ id: string|number;
155
+ /**
156
+ * Configuration needed for unlimited usage through OCI Generative AI Service.
157
+ * Required only when accessing the LLM through an Oracle Cloud Account and the OCI Generative AI Service.
158
+ * SuiteApps installed to target accounts are prevented from using the free usage pool for N/llm and must use the OCI configuration.
159
+ *
160
+ * Instead of specifying OCI configuration details using this parameter, you can specify them on the SuiteScript tab of the AI Preferences page.
161
+ * When you do so, those OCI configuration details are used for all scripts in your account that use N/llm module methods, and unlimited usage mode is enabled for those scripts.
162
+ * If you specify OCI configuration details in both places (using this parameter and using the SuiteScript tab of the AI Preferences page), the details provided in this parameter override those that are specified on the SuiteScript tab.
163
+ * For more information, see Using Your Own OCI Configuration for SuiteScript Generative AI APIs.
164
+ */
165
+ ociConfig?: IOCIConfig;
166
+ /** Timeout in milliseconds, defaults to 30,000. */
167
+ timeout?: number;
168
+ /**
169
+ * Values for the variables that are used in the prompt. Provide these values as an object with key-value pairs.
170
+ * For an example, see the Syntax section.
171
+ *
172
+ * You can use Prompt Studio to generate a SuiteScript example that uses this method and includes the variables for a prompt in the correct format.
173
+ * When viewing a prompt in Prompt Studio, click Show SuiteScript Example to generate SuiteScript code with all the variables that prompt uses.
174
+ * You can then use this code in your scripts and provide a value for each variable.
175
+ */
176
+ variables?: object;
34
177
  }
35
178
 
36
179
  interface IGenerateTextOptions {
@@ -38,6 +181,16 @@ interface IGenerateTextOptions {
38
181
  prompt: string;
39
182
  /** Chat history to be taken into consideration. */
40
183
  chatHistory?: ChatMessage[];
184
+ /** A list of documents to provide additional context for the LLM to generate the response. */
185
+ documents?: Document[];
186
+ /**
187
+ * An image to query. You can send an image (as a file.File object) to the LLM and ask questions about the image and get text outputs, such as:
188
+ * - Advanced image captions
189
+ * - Detailed description of an image
190
+ * - Answers to questions about an image
191
+ * - Information about charts and graphs in an image
192
+ */
193
+ image?: File;
41
194
  /** Specifies the LLM to use. Use llm.ModelFamily to set the value. If not specified, the Cohere Command R LLM is used. */
42
195
  modelFamily?: ModelFamily;
43
196
  modelParameters?: IModelParameters;
@@ -47,10 +200,17 @@ interface IGenerateTextOptions {
47
200
  * SuiteApps installed to target accounts are prevented from using the free usage pool for N/llm and must use the OCI configuration.
48
201
  */
49
202
  ociConfig?: IOCIConfig;
203
+ /** Preamble override for the LLM. A preamble is the Initial context or guiding message for an LLM. For more details about using a preamble, refer to About the Chat Models in Generative AI (Chat Model Parameters section) in the Oracle Cloud Infrastructure Documentation. */
50
204
  preamble?: string;
205
+ /** Timeout in milliseconds, defaults to 30,000. */
51
206
  timeout?: number;
52
207
  }
53
208
 
209
+ interface Document {
210
+ readonly data: string;
211
+ readonly id: string;
212
+ }
213
+
54
214
  interface IModelParameters {
55
215
  /** A penalty that is assigned to a token when that token appears frequently. The higher the value, the stronger a penalty is applied to previously present tokens, proportional to how many times they have already appeared in the prompt or prior generation. See Model Parameter Values by LLM for valid values. */
56
216
  frequencyPenalty?: number;
@@ -109,6 +269,16 @@ declare enum ChatRole {
109
269
  CHATBOT = "CHATBOT"
110
270
  }
111
271
 
272
+ /** The large language model to be used to generate embeddings. */
273
+ declare enum EmbedModelFamily {
274
+ COHERE_EMBED_ENGLISH = 'cohere.embed-english-v3.0',
275
+ /** Light versions of embedding models might generate embeddings faster than regular embedding models, but the output might not be as accurate. */
276
+ COHERE_EMBED_ENGLISH_LIGHT = 'cohere.embed-english-light-v3.0',
277
+ COHERE_EMBED_MULTILINGUAL = 'cohere.embed-multilingual-v3.0',
278
+ /** Light versions of embedding models might generate embeddings faster than regular embedding models, but the output might not be as accurate. */
279
+ COHERE_EMBED_MULTILINGUAL_LIGHT = 'cohere.embed-multilingual-light-v3.0'
280
+ }
281
+
112
282
  /** The large language model to be used. */
113
283
  declare enum ModelFamily {
114
284
  /** Always uses the latest supported Cohere model. Cohere Command-R is the default when the options.modelFamily parameter is omitted. */
@@ -116,3 +286,10 @@ declare enum ModelFamily {
116
286
  /** Always uses the latest supported Meta Llama model. */
117
287
  META_LLAMA = 'meta.llama-3.1-70b-instruct'
118
288
  }
289
+
290
+ /** The truncation method to use when embeddings input exceeds 512 tokens. Use this enum to set the value of the options.truncate parameter in llm.embed(options). */
291
+ declare enum Truncate {
292
+ END = 'END',
293
+ NONE = 'NONE',
294
+ START = 'START'
295
+ }
package/N/log.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  interface LogOptions {
2
2
  /** String to appear in the Title column on the Execution Log tab of the script deployment. Maximum length is 99 characters. */
3
- title?: string;
3
+ title: string;
4
4
  /**
5
5
  * You can pass any value for this parameter.
6
6
  * If the value is a JavaScript object type, JSON.stringify(obj) is called on the object before displaying the value.
7
7
  * NetSuite truncates any resulting string over 3999 characters.
8
8
  */
9
- details: any;
9
+ details?: any;
10
10
  }
11
11
 
12
12
  interface LogFunction {
package/N/query.d.ts CHANGED
@@ -54,7 +54,13 @@ interface CreateConditionOptions {
54
54
  * Array of values to use for the condition.
55
55
  * Required if options.fieldId and options.operator are used, and options.operator does not have a value of query.Operator.EMPTY or query.Operator.EMPTY_NOT.
56
56
  */
57
- values: string | boolean | string[] | boolean[] | number[] | Date[] | RelativeDate[] | Period[]; // You wouldn't have multiple boolean values in an array, obviously. But you might specify it like: [true].
57
+ values: string | boolean |
58
+ string[] | readonly string[] |
59
+ boolean[] | readonly boolean[] | // You wouldn't have multiple boolean values in an array, obviously. But you might specify it like: [true].
60
+ number[] | readonly number[] |
61
+ Date[] | readonly Date[] |
62
+ RelativeDate[] | readonly RelativeDate[] |
63
+ Period[] | readonly Period[];
58
64
 
59
65
  /**
60
66
  * If you use the options.formula parameter, use this parameter to explicitly define the formula’s return type. This value sets the Condition.type property.
@@ -112,8 +118,8 @@ interface CreateColumnOptions {
112
118
 
113
119
  /**
114
120
  * An alias for this column. An alias is an alternate name for a column, and the alias is used in mapped results.
115
- * In general, the alias is an optional property.
116
- *
121
+ * In general, the alias is an optional property.
122
+ *
117
123
  * To use mapped results, you must specify an alias in the following situations:
118
124
  * 1. You must specify an alias for a column when the column uses a formula.
119
125
  * 2. You must specify an alias when two columns in a joined query use the same field ID.
@@ -149,8 +155,8 @@ interface CreateColumnWithFormulaOptions {
149
155
 
150
156
  /**
151
157
  * An alias for this column. An alias is an alternate name for a column, and the alias is used in mapped results.
152
- * In general, the alias is an optional property.
153
- *
158
+ * In general, the alias is an optional property.
159
+ *
154
160
  * To use mapped results, you must specify an alias in the following situations:
155
161
  * 1. You must specify an alias for a column when the column uses a formula.
156
162
  * 2. You must specify an alias when two columns in a joined query use the same field ID.
@@ -185,9 +191,9 @@ interface CreateSortOptions {
185
191
  interface CreateQueryOptions {
186
192
  /** The query type. Use the Type enum. */
187
193
  type: string;
188
- columns?: Column[];
194
+ columns?: Column[] | readonly Column[];
189
195
  condition?: Condition;
190
- sort?: Sort[];
196
+ sort?: Sort[] | readonly Sort[];
191
197
  }
192
198
 
193
199
  interface LoadQueryOptions {
@@ -206,8 +212,9 @@ export interface RunSuiteQLOptions {
206
212
  */
207
213
  query: string;
208
214
 
209
- params?: Array<string | number | boolean>;
210
-
215
+ params?: Array<string | number | boolean> |
216
+ ReadonlyArray<string | number | boolean>;
217
+
211
218
  customScriptId?: string;
212
219
  }
213
220
 
@@ -753,7 +760,7 @@ interface Period {
753
760
  readonly code: string;
754
761
  /**
755
762
  * The type of the period. This property uses values from the query.PeriodType enum.
756
- * If you create a period using query.createPeriod(options) and do not specify a value for the options.type
763
+ * If you create a period using query.createPeriod(options) and do not specify a value for the options.type
757
764
  * parameter, the default value of this property is query.PeriodType.START.
758
765
  */
759
766
  readonly type: string;
@@ -1260,7 +1267,7 @@ export enum FieldContext {
1260
1267
  CONVERTED = "CONVERTED",
1261
1268
  /** Displays consolidated currency amounts in the base currency. */
1262
1269
  CURRENCY_CONSOLIDATED = "CURRENCY_CONSOLIDATED",
1263
- /**
1270
+ /**
1264
1271
  * Displays user-friendly field values.
1265
1272
  * For example, for the entity field on Transaction records, using the DISPLAY enum value displays the name of the entity instead of its ID.
1266
1273
  */
package/N/types.d.ts CHANGED
@@ -194,7 +194,7 @@ export namespace EntryPoints {
194
194
 
195
195
  interface beforeSubmitContext {
196
196
  newRecord: N_record.Record;
197
- oldRecord?: N_record.Record;
197
+ oldRecord: N_record.Record | null;
198
198
  type: UserEventType;
199
199
  UserEventType: UserEventTypes;
200
200
  }
@@ -203,7 +203,7 @@ export namespace EntryPoints {
203
203
 
204
204
  interface afterSubmitContext {
205
205
  newRecord: N_record.Record & { id: number };
206
- oldRecord?: N_record.Record;
206
+ oldRecord: N_record.Record | null;
207
207
  type: UserEventType;
208
208
  UserEventType: UserEventTypes;
209
209
  }
@@ -364,7 +364,7 @@ export namespace EntryPoints {
364
364
  namespace WorkflowAction {
365
365
  interface onActionContext {
366
366
  newRecord: N_record.Record;
367
- oldRecord?: N_record.Record;
367
+ oldRecord: N_record.Record | null;
368
368
  form?: N_ui_serverWidget.Form;
369
369
  type?: string;
370
370
  workflowId?: number;
package/package.json CHANGED
@@ -8,7 +8,7 @@
8
8
  "posttest": "npm run cleanup"
9
9
  },
10
10
  "homepage": "https://github.com/headintheclouddev/typings-suitescript-2.0",
11
- "version": "2025.1.12",
11
+ "version": "2025.1.14",
12
12
  "author": "Head in the Cloud Development <gurus@headintheclouddev.com> (www.headintheclouddev.com)",
13
13
  "license": "MIT",
14
14
  "repository": {