@sasjs/adapter 4.12.1 → 4.13.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/SASjs.d.ts +9 -1
- package/index-dev.js +73 -2
- package/index.js +73 -2
- package/minified_sas9.js +63 -2
- package/node/SASjs.d.ts +9 -1
- package/node/index.js +1368 -230
- package/node/types/Tables.d.ts +7 -0
- package/node/types/errors/ArgumentError.d.ts +4 -0
- package/node/types/errors/index.d.ts +1 -0
- package/node/types/index.d.ts +1 -0
- package/package.json +2 -2
- package/src/SASjs.ts +13 -1
- package/src/types/Tables.ts +29 -0
- package/src/types/errors/ArgumentError.ts +7 -0
- package/src/types/errors/index.ts +1 -0
- package/src/types/index.ts +1 -0
- package/types/Tables.d.ts +7 -0
- package/types/Tables.spec.d.ts +1 -0
- package/types/errors/ArgumentError.d.ts +4 -0
- package/types/errors/index.d.ts +1 -0
- package/types/index.d.ts +1 -0
package/node/types/index.d.ts
CHANGED
package/package.json
CHANGED
package/src/SASjs.ts
CHANGED
|
@@ -9,7 +9,8 @@ import {
|
|
|
9
9
|
ErrorResponse,
|
|
10
10
|
LoginOptions,
|
|
11
11
|
LoginResult,
|
|
12
|
-
ExecutionQuery
|
|
12
|
+
ExecutionQuery,
|
|
13
|
+
Tables
|
|
13
14
|
} from './types'
|
|
14
15
|
import { SASViyaApiClient } from './SASViyaApiClient'
|
|
15
16
|
import { SAS9ApiClient } from './SAS9ApiClient'
|
|
@@ -1240,4 +1241,15 @@ export default class SASjs {
|
|
|
1240
1241
|
public setVerboseMode = (verboseMode: VerboseMode) => {
|
|
1241
1242
|
this.requestClient?.setVerboseMode(verboseMode)
|
|
1242
1243
|
}
|
|
1244
|
+
|
|
1245
|
+
/**
|
|
1246
|
+
* Create a tables class containing one or more tables to be sent to
|
|
1247
|
+
* SAS.
|
|
1248
|
+
* @param table - initial table data
|
|
1249
|
+
* @param macroName - macro name
|
|
1250
|
+
* @returns Tables class
|
|
1251
|
+
*/
|
|
1252
|
+
Tables(table: Record<string, any>, macroName: string) {
|
|
1253
|
+
return new Tables(table, macroName)
|
|
1254
|
+
}
|
|
1243
1255
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ArgumentError } from './errors'
|
|
2
|
+
|
|
3
|
+
export class Tables {
|
|
4
|
+
_tables: { [macroName: string]: Record<string, any> }
|
|
5
|
+
|
|
6
|
+
constructor(table: Record<string, any>, macroName: string) {
|
|
7
|
+
this._tables = {}
|
|
8
|
+
|
|
9
|
+
this.add(table, macroName)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
add(table: Record<string, any> | null, macroName: string) {
|
|
13
|
+
if (table && macroName) {
|
|
14
|
+
if (!(table instanceof Array)) {
|
|
15
|
+
throw new ArgumentError('First argument must be array')
|
|
16
|
+
}
|
|
17
|
+
if (typeof macroName !== 'string') {
|
|
18
|
+
throw new ArgumentError('Second argument must be string')
|
|
19
|
+
}
|
|
20
|
+
if (!isNaN(Number(macroName[macroName.length - 1]))) {
|
|
21
|
+
throw new ArgumentError('Macro name cannot have number at the end')
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
throw new ArgumentError('Missing arguments')
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
this._tables[macroName] = table
|
|
28
|
+
}
|
|
29
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/types/errors/index.d.ts
CHANGED
package/types/index.d.ts
CHANGED