@hitc/netsuite-types 2026.1.3 → 2026.1.5

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,34 +0,0 @@
1
- /**
2
- * @NAPIVersion 2.0
3
- * @NScriptType ClientScript
4
- */
5
-
6
- import type {EntryPoints} from 'N/types';
7
- import * as search from 'N/search';
8
-
9
- export function pageInit(context: EntryPoints.Client.pageInitContext) {
10
- if (context.mode != 'edit') return;
11
-
12
- const customerId = context.currentRecord.getValue('entity'); // Assume this script is running on a transaction
13
- search.lookupFields.promise({ type: 'customer', id: customerId, columns: ['companyname', 'datecreated', 'entitystatus'] }).then((values) => {
14
- const name = values.companyname as string;
15
- const date = values.datecreated as string;
16
- const status = values.entitystatus as { value: string, text: string }[];
17
- console.log('Customer', name, 'created at', date, 'status', status);
18
- });
19
-
20
- search.create.promise({
21
- type: 'customer',
22
- filters: [search.createFilter({ name: 'companyname', operator: search.Operator.ISNOTEMPTY })],
23
- columns: [ // Not generally recommended to mix column creation formats like this, but it is technically acceptable. This demonstrates different ways to do it:
24
- search.createColumn({ name: 'companyname', sort: search.Sort.ASC }),
25
- { name: 'email' },
26
- 'fax',
27
- ],
28
- }).then(search => {
29
- return search.run().getRange.promise({ start: 0, end: 1 });
30
- }).then(results => {
31
- if (results.length === 0) return alert("No companies");
32
- alert(`First company alphabetically: ${results[0].getValue('companyname')}`);
33
- });
34
- }
@@ -1,34 +0,0 @@
1
- /**
2
- * @NApiVersion 2.1
3
- * @NScriptType customglplugin
4
- */
5
-
6
- /* This example is taken from https://suiteanswers.custhelp.com/app/answers/detail/a_id/1016997 */
7
-
8
- import type {EntryPoints} from "N/types";
9
- import * as log from "N/log";
10
-
11
- export const customizeGlImpact: EntryPoints.Plugins.GlPlugin.customizeGlImpact =
12
- (context: EntryPoints.Plugins.GlPlugin.glPluginContext) => {
13
- const customLines = context.customLines;
14
- const amount = "100.00";
15
-
16
- const memo = context.transactionRecord.getValue({ fieldId: "memo" });
17
- const firstAccount = context.standardLines.getLine({ index: 0 }).accountId;
18
- const secondAccount = context.standardLines.getLine({ index: 1 }).accountId;
19
- const bookId = context.book.id;
20
-
21
- const firstLine = customLines.addNewLine();
22
- firstLine.accountId = firstAccount;
23
- firstLine.creditAmount = amount;
24
- firstLine.memo = memo + " for book " + bookId;
25
- firstLine.isBookSpecific = false;
26
-
27
- const secondLine = customLines.addNewLine();
28
- secondLine.accountId = secondAccount;
29
- secondLine.debitAmount = amount;
30
- secondLine.memo = memo + " for book " + bookId;
31
- secondLine.isBookSpecific = false;
32
-
33
- log.audit("Added GL Entries", { customLines });
34
- };
@@ -1,21 +0,0 @@
1
- /**
2
- * @NAPIVersion 2.0
3
- * @NScriptType UserEventScript
4
- */
5
-
6
- import type {EntryPoints} from 'N/types';
7
- import * as log from 'N/log'
8
-
9
- const del: EntryPoints.RESTlet.delete_ = requestParams => {
10
- let type = requestParams.type;
11
- let id = requestParams.id;
12
-
13
- return {
14
- success: true
15
- };
16
- }
17
- export { del as delete };
18
-
19
- export const post: EntryPoints.RESTlet.post = requestBody => {
20
- return { success: true };
21
- }
@@ -1,23 +0,0 @@
1
- /**
2
- * @NAPIVersion 2.1
3
- * @NScriptType UserEventScript
4
- */
5
-
6
- import type {EntryPoints} from 'N/types';
7
- import * as log from 'N/log';
8
- import * as query from 'N/query';
9
-
10
- // Let's assume this example is deployed to sales orders
11
- export function beforeSubmit(context: EntryPoints.UserEvent.beforeSubmitContext) {
12
- if (context.type == context.UserEventType.CREATE) {
13
- const customerId = context.newRecord.getValue('entity') as string;
14
- log.debug('beforeSubmit', `Submitting new transaction for entity: ${customerId}`); // When creating a transaction from an entity, log the entity internal id
15
-
16
- // SuiteQL example
17
- const results: { companyname: string }[] = query.runSuiteQL({
18
- query: `SELECT companyName FROM customer WHERE id = ?`,
19
- params: [customerId]
20
- }).asMappedResults() as any;
21
- log.debug('beforeSubmit', `Customer ${customerId} values: ${JSON.stringify(results)}`);
22
- }
23
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * @NApiVersion 2.0
3
- * @NScriptType UserEventScript
4
- */
5
-
6
- import type {EntryPoints} from 'N/types';
7
- import * as log from 'N/log';
8
-
9
- const del: EntryPoints.RESTlet.delete_ = requestParams => {
10
- const type = requestParams.type;
11
- const id = requestParams.id;
12
-
13
- log.debug('Delete', `Input record type ${type} id ${id}.`);
14
- return { success: true };
15
- };
16
-
17
- export { del as delete };
18
-
19
- export const post: EntryPoints.RESTlet.post = (requestBody) => {
20
- log.debug('Post', `Body: ${JSON.stringify(requestBody)}.`); // Assuming its an object
21
- return { success: true };
22
- };
@@ -1,13 +0,0 @@
1
- /**
2
- * @NApiVersion 2.x
3
- * @NScriptType Suitelet
4
- */
5
-
6
- import type {EntryPoints} from 'N/types';
7
- import * as record from 'N/record';
8
-
9
- export const onRequest: EntryPoints.Suitelet.onRequest = (context) => {
10
- const folder = record.load({ type: 'folder', id: 36464 });
11
- const allFields = folder.getFields().join(', ');
12
- context.response.write(`<br>All fields: ${allFields}`);
13
- };
@@ -1,14 +0,0 @@
1
- /**
2
- * @NApiVersion 2.0
3
- * @NScriptType UserEventScript
4
- */
5
-
6
- import type {EntryPoints} from 'N/types';
7
- import * as log from 'N/log';
8
-
9
- export function beforeSubmit(context: EntryPoints.UserEvent.beforeSubmitContext) {
10
- if (~[context.UserEventType.CREATE, context.UserEventType.EDIT].indexOf(context.type)) { // If type is create or edit, log the company name (applies to customer records).
11
- const companyName = context.newRecord.getValue({ fieldId: 'companyname' });
12
- log.audit('Before Submit', `companyname is: ${companyName}`);
13
- }
14
- }
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "amd",
4
- "target": "es5",
5
- "moduleResolution":"node",
6
- "sourceMap": false,
7
- "newLine": "LF",
8
- "experimentalDecorators": true,
9
- "strict": true,
10
- "baseUrl": ".",
11
- "lib": ["es5", "es2015.promise", "dom"],
12
- "paths": {
13
- "N/*": ["../../N/*"]
14
- }
15
- },
16
- "include": ["../../N/*", "../../SuiteScriptV1.d.ts"],
17
- "exclude": ["node_modules"]
18
- }
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "amd",
4
- "target": "es5",
5
- "moduleResolution":"node",
6
- "sourceMap": false,
7
- "newLine": "LF",
8
- "experimentalDecorators": true,
9
- "noImplicitUseStrict": true,
10
- "baseUrl": ".",
11
- "lib": ["es5", "es2015.promise", "dom"],
12
- "paths": {
13
- "N/*": ["../../N/*"]
14
- }
15
- },
16
- "exclude": ["node_modules"],
17
- "include": ["./*Sample.ts"]
18
- }
@@ -1,8 +0,0 @@
1
- import { exec } from 'shelljs'
2
-
3
- describe('declaration files compilation', () => {
4
- it('should compile all declaration files without error', () => {
5
- let execOut = exec('node node_modules/typescript/bin/tsc -p spec/assets/specs_declarations_tsconfig.json')
6
- expect(execOut.code).toBe(0, execOut.stdout)
7
- })
8
- })
@@ -1,28 +0,0 @@
1
- import { exec, rm, cat, ls } from 'shelljs'
2
- import { parseScript } from 'esprima'
3
-
4
- describe('samples compilation', () => {
5
-
6
- let cleanup = () => rm('-rf', 'spec/assets/*.js')
7
- beforeAll(cleanup)
8
- afterAll(cleanup)
9
-
10
- it('compile basic samples with current local typescript', () => {
11
- let execOut = exec('node node_modules/typescript/bin/tsc -p spec/assets/specs_samples_tsconfig.json')
12
- expect(execOut.code).toBe(0, execOut.stdout)
13
- })
14
-
15
- it('should generate valid samples .js that keeps the jsdoc top comment', () => {
16
- ls('spec/assets/*Sample.ts').forEach((file) => {
17
- let js = cat(file.replace('.ts', '.js'))
18
- expect(js).toContain(' * @NApiVersion 2')
19
- try {
20
- parseScript(js)
21
- } catch (ex) {
22
- fail('invalid javascript generated')
23
- console.log(ex, ex.stack)
24
- }
25
- })
26
- })
27
-
28
- })
@@ -1,22 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "commonjs",
4
- "target": "es5",
5
- "moduleResolution": "node",
6
- "sourceMap": false,
7
- "newLine": "LF",
8
- "experimentalDecorators": true,
9
- "strict": true,
10
- "lib": [
11
- "es5"
12
- ]
13
- },
14
- "exclude": [
15
- "node_modules",
16
- "./assets",
17
- "./typecheck"
18
- ],
19
- "include": [
20
- "./*.ts"
21
- ]
22
- }
@@ -1,11 +0,0 @@
1
- {
2
- "spec_dir": "spec",
3
- "spec_files": [
4
- "**/*[sS]pec.js"
5
- ],
6
- "helpers": [
7
- "helpers/**/*.js"
8
- ],
9
- "stopSpecOnExpectationFailure": false,
10
- "random": false
11
- }
@@ -1,22 +0,0 @@
1
- // this spec is not meant to be run, it just need to be compiled. It checks that code snippets are able to be written using the typings
2
-
3
- import { create, Operator, Search } from 'N/search';
4
- import { expectType } from 'tsd-check';
5
-
6
- describe('search types', () => {
7
-
8
- describe('create', () => {
9
- it('should accept filters with values', () => {
10
- const s = create({
11
- type: 'item', columns: ['created'],
12
- filters: [{
13
- name: 'isinactive',
14
- operator: Operator.IS,
15
- values: 'F'
16
- }]
17
- });
18
- expectType<Search>(s);
19
- });
20
- });
21
-
22
- });
package/tsconfig.json DELETED
@@ -1,16 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "strict": true,
4
- "module": "amd",
5
- "target": "es5",
6
- "moduleResolution": "node",
7
- "sourceMap": false,
8
- "newLine": "LF",
9
- "esModuleInterop": true,
10
- "allowSyntheticDefaultImports": true,
11
- "experimentalDecorators": true,
12
- "baseUrl": ".",
13
- "lib": ["ES6", "DOM.Iterable", "DOM"]
14
- },
15
- "exclude": ["node_modules"]
16
- }