@hitc/netsuite-types 2024.1.9 → 2024.2.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/N/pgp.d.ts ADDED
@@ -0,0 +1,179 @@
1
+ /**
2
+ * Use the N/pgp module to enable secure messaging, file encryption, and document signing. Based on OpenPGP encryption standards.
3
+ * PGP stands for Pretty Good Privacy and is most commonly used for encrypting emails.
4
+ */
5
+
6
+ import {Signer} from "./crypto/certificate";
7
+
8
+ /** Stores general configuration options that can be used for message decryption. Use the pgp.createConfig(options) method to create a new configuration object. */
9
+ interface Config {
10
+ /** Enables decryption that is not secured with signing keys. */
11
+ readonly allowInsecureDecryptionWithSigningKeys: boolean;
12
+ /** Allows messages without integrity protection. */
13
+ readonly allowMessagesWithoutIntegrityProtection: boolean;
14
+ /** Allows relaxed signature parsing for configuration objects. */
15
+ readonly useRelaxedSignatureParsing: boolean;
16
+ }
17
+
18
+ /**
19
+ * Stores multiple cryptographic keys and metadata.
20
+ * You can use this object in the Message.decrypt(options) and MessageData.encrypt(options) methods.
21
+ */
22
+ interface Key {
23
+ // TODO: Nothing in the documentation?
24
+ }
25
+
26
+ /** Stores an octet scalar that identifies a (sub)key. This object is used for verification signatures. */
27
+ interface KeyId {
28
+ /** Returns the Key ID as a hexadecimal string. */
29
+ asHex: () => string;
30
+ }
31
+
32
+ /**
33
+ * Stores processed PGP data. Responsible for enabling message serialization and providing a set of single-step processors to covert to a readable message.
34
+ * Use the MessageData.toMessage() and MessageData.encrypt(options) to create a Message object.
35
+ */
36
+ interface Message {
37
+ /** Message type that specifies how a message is processed. Enables you to pick the appropriate method to process a message. */
38
+ readonly type: boolean;
39
+ /** Converts a message to ASCII armored format. */
40
+ asArmored: () => string;
41
+ /** Converts a pgp.Message object to message data without any processing. This method only works if the message is not encrypted. */
42
+ toMessageData: () => MessageData;
43
+ /** Decrypts a message and optionally verifies the signatures. */
44
+ decrypt: (options: DecryptMessageOptions) => MessageData;
45
+ }
46
+
47
+ /**
48
+ * Stores message data. The responsibilities of this object includes:
49
+ * - Store message contents with meta data.
50
+ * - Enable reading message contents and metadata.
51
+ * - For further processing, determines whether data is text or binary.
52
+ * - Provides a set of single-step processors for various PGP use cases.
53
+ * Use the pgp.createMessageData(options) method to create a message data object.
54
+ */
55
+ interface MessageData {
56
+ readonly filename: string;
57
+ readonly date: Date;
58
+ readonly format: Format;
59
+ /** Extracts the contents of the message as text. */
60
+ getText: () => string;
61
+ /** Creates a message with no signature, compression, or encryption. */
62
+ toMessage: () => Message;
63
+ /** Creates an encrypted message that is optionally signed. */
64
+ encrypt: (options: EncryptMessageDataOptions) => Message;
65
+ }
66
+
67
+ /** Stores verification results. Use the pgp.createVerification() method to create a Verification object. */
68
+ interface Verification {
69
+ /** Indicates whether the message verification was successful. */
70
+ readonly verified: null|boolean;
71
+ /** List of individual verifications, one per each signature. */
72
+ readonly signatures: null|VerificationSignature[];
73
+ }
74
+
75
+ /** Stores a verification result for single signature. */
76
+ interface VerificationSignature {
77
+ /** ID of the (sub)key that was used for signing. */
78
+ readonly keyId: KeyId;
79
+ /** Date when the message was signed. */
80
+ readonly dateSigned: Date;
81
+ /** Indicates whether verification was successful. */
82
+ readonly verified: boolean;
83
+ /** List of problems for more fine-grained decision making. */
84
+ readonly problems: string[];
85
+ }
86
+
87
+ /** Creates a new pgp.Config object. A configuration object stores general configuration options that can be used for message decryption. */
88
+ export function createConfig(options: CreateConfigOptions): Config;
89
+
90
+ /** Creates a new pgp.MessageData object. A message data object stores message content with metadata. */
91
+ export function createMessageData(options: CreateMessageDataOptions): MessageData;
92
+
93
+ /**
94
+ * Creates a certificate.Signer object for signing plain strings.
95
+ * If the given PGP key contains multiple valid signing sub keys, the most recently added will be used.
96
+ * This behavior is consistent with MessageData.encrypt(options) method.
97
+ */
98
+ export function createSigner(options: { key: Key, algorithm: string }): Signer;
99
+
100
+ /** Creates an empty verification object. */
101
+ export function createVerification(): Verification;
102
+
103
+ /** Loads a key contents that are securely stored in a secret. */
104
+ export function loadKeyFromSecret(options: LoadKeyFromSecretOptions): Key;
105
+
106
+ /** Parses an existing PGP key. Use pgp.loadKeyFromSecret(options) to load private keys. */
107
+ export function parseKey(options: ParseKeyOptions): Key;
108
+
109
+ /** Parses a PGP message. Parameter value is ASCII armored representation of the message. */
110
+ export function parseMessage(options: { value: string }): Message;
111
+
112
+ export enum CompressionAlgorithm {
113
+ ZLIB
114
+ }
115
+
116
+ export enum Format {
117
+ UTF8,
118
+ BINARY
119
+ }
120
+
121
+ interface CreateConfigOptions {
122
+ /** Enables decryption that is not secured with signing keys. Default value is false. */
123
+ allowInsecureDecryptionWithSigningKeys?: boolean;
124
+ /** Allows messages without integrity protection. Default value is false. */
125
+ allowMessagesWithoutIntegrityProtection?: boolean;
126
+ /** Allows relaxed signature parsing for configuration objects. Default value is false. */
127
+ useRelaxedSignatureParsing?: boolean;
128
+ }
129
+
130
+ interface CreateMessageDataOptions {
131
+ /** Content of the message. */
132
+ content: string;
133
+ /** File name if the message represents a file, empty string otherwise. */
134
+ filename?: string;
135
+ /** Date of the message or modification date of the file. Default value = new Date(). */
136
+ date?: Date;
137
+ /** Literal data packet type. Default value = Format.UTF8, if content is a string. Format.BINARY otherwise. */
138
+ format?: Format;
139
+ }
140
+
141
+ interface DecryptMessageOptions {
142
+ /** Uses one or more keys to attempt message decryption. */
143
+ decryptionKeys: Key|Key[];
144
+ /**
145
+ * Uses zero or more keys to attempt message signature verification. If you do not provide a verification key, the message's signature (if any) will be ignored.
146
+ * If you do provide a verification key, at least one signature must be verifiable by one of the provided keys, otherwise an error will be thrown.
147
+ * An expired key works if the signature was made before the expiration. Default value = [].
148
+ */
149
+ verificationKeys?: Key|Key[];
150
+ /** An empty verification object. If you provide a value for this parameter, the verification results will be flushed instead of throwing an error for invalid signature. Default value = null. */
151
+ verification?: Verification;
152
+ /** If set to true, the verification errors will not be thrown. This value is implicitly set to true when the verification parameter is provided. Default value = false. */
153
+ suppressVerificationErrors?: boolean;
154
+ /** The configuration. Default value is pgp.createConfig(options). */
155
+ config?: Config;
156
+ }
157
+
158
+ interface EncryptMessageDataOptions {
159
+ /** One or more keys used to encrypt a message. If a key contains multiple valid encryption (sub)keys, the most recent key added will be used. */
160
+ encryptionKeys: Key|Key[];
161
+ /** Zero or more keys used for signing. If a key contains multiple valid signing (sub)keys, the most recent key added will be used. Default value = []. */
162
+ signingKeys?: Key|Key[];
163
+ /** The compression algorithm to use. Default value = CompressionAlgorithm.ZLIB. */
164
+ compressionAlgorithm?: CompressionAlgorithm;
165
+ }
166
+
167
+ interface LoadKeyFromSecretOptions {
168
+ /** Secret that contains a PGP key in ASCII armored format. */
169
+ secret: { scriptId: string };
170
+ /** Secret that contains a password to unlock the key. Applicable for private keys. */
171
+ password?: { scriptId: string };
172
+ }
173
+
174
+ interface ParseKeyOptions {
175
+ /** ASCII armored key */
176
+ value: string;
177
+ /** Password to unlock the key. Applicable for private keys. */
178
+ password?: string;
179
+ }
package/N/record.d.ts CHANGED
@@ -562,8 +562,13 @@ export interface ClientCurrentRecord {
562
562
  hasSublistSubrecord(options: GetSublistValueOptions): boolean;
563
563
  /** Returns a value indicating whether the field contains a subrecord. */
564
564
  hasSubrecord(options: HasSubrecordOptions): boolean;
565
- /** The internal ID of a specific record. */
566
- id: number;
565
+ /**
566
+ * The internal ID of a specific record.
567
+ *
568
+ * If {@link isNew} is true, this is normally null, but there are exceptions,
569
+ * such as when {@link isNew} is true in the afterSubmit() entrypoint of a user event script.
570
+ */
571
+ id: number | null;
567
572
  /** Inserts a sublist line. */
568
573
  insertLine(options: InsertLineOptions): this; // Issue #132
569
574
  /**
@@ -599,7 +604,7 @@ export interface ClientCurrentRecord {
599
604
  * Removes the subrecord for the associated field.
600
605
  * @return {Record} same record, for chaining
601
606
  */
602
- removeSubrecord(options: RecordGetLineCountOptions): this;
607
+ removeSubrecord(options: GetFieldOptions): this;
603
608
  /** Selects an existing line in a sublist. */
604
609
  selectLine(options: SelectLineOptions): this;
605
610
  selectLine(sublistId: string, line: number): this;
@@ -760,8 +765,8 @@ interface RecordDetachFunction {
760
765
  * @throws {SuiteScriptError} SSS_MISSING_REQD_ARGUMENT if options.type or options.id is missing
761
766
  */
762
767
  interface RecordLoadFunction {
763
- (options: CopyLoadOptions): Record;
764
- promise(options: CopyLoadOptions): Promise<Record>;
768
+ (options: CopyLoadOptions): Record & { id: number };
769
+ promise(options: CopyLoadOptions): Promise<Record & { id: number }>;
765
770
  }
766
771
  /**
767
772
  * Delete a record object based on provided type, id and return the id of deleted record
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Use the N/scriptTypes/restlet module to create custom HTTP responses for your RESTlet script.
3
+ * This module is available only to RESTlet script type.
4
+ */
5
+
6
+ /** An HTTP response of a RESTlet script. This object is read-only. Use restlet.createResponse(options) to create and return this object. */
7
+ interface Response {
8
+ /** The content of the RESTlet HTTP response. */
9
+ readonly content: string;
10
+ /** The Content-Type header of the RESTlet HTTP response. */
11
+ readonly contentType: string;
12
+ }
13
+
14
+ /** Creates a custom RESTlet HTTP response. */
15
+ export function createResponse(options: CreateResponseOptions): Response;
16
+
17
+ interface CreateResponseOptions {
18
+ /** The content of the response. */
19
+ content: string;
20
+ /**
21
+ * The Content-Type header of the response.
22
+ * This value overrides the default Content-Type header, which is the same as the Content-Type header of the RESTlet HTTP request.
23
+ */
24
+ contentType: string;
25
+ }
package/N/types.d.ts CHANGED
@@ -201,7 +201,7 @@ export namespace EntryPoints {
201
201
  type beforeSubmit = (scriptContext: beforeSubmitContext) => void;
202
202
 
203
203
  interface afterSubmitContext {
204
- newRecord: N_record.Record;
204
+ newRecord: N_record.Record & { id: number };
205
205
  oldRecord: N_record.Record;
206
206
  type: UserEventType;
207
207
  UserEventType: UserEventTypes;
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": "2024.1.9",
11
+ "version": "2024.2.0",
12
12
  "author": "Head in the Cloud Development <gurus@headintheclouddev.com> (www.headintheclouddev.com)",
13
13
  "license": "MIT",
14
14
  "repository": {