@sasjs/adapter 3.7.9 → 3.7.12

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,3 +1,3 @@
1
1
  export declare class LoginRequiredError extends Error {
2
- constructor();
2
+ constructor(details?: any);
3
3
  }
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "prepublishOnly": "cp -r ./build/* . && rm -rf ./build",
15
15
  "postpublish": "git clean -fd",
16
16
  "semantic-release": "semantic-release",
17
- "typedoc": "typedoc",
17
+ "typedoc": "node createTSDocs",
18
18
  "prepare": "git rev-parse --git-dir && git config core.hooksPath ./.git-hooks && git config core.autocrlf false || true"
19
19
  },
20
20
  "publishConfig": {
@@ -65,8 +65,7 @@
65
65
  "tslint": "6.1.3",
66
66
  "tslint-config-prettier": "1.18.0",
67
67
  "typedoc": "0.22.11",
68
- "typedoc-neo-theme": "1.1.1",
69
- "typedoc-plugin-external-module-name": "4.0.6",
68
+ "typedoc-plugin-rename-defaults": "0.4.0",
70
69
  "typescript": "4.5.5",
71
70
  "webpack": "5.69.0",
72
71
  "webpack-cli": "4.9.2"
@@ -80,5 +79,5 @@
80
79
  "https": "1.0.0",
81
80
  "tough-cookie": "4.0.0"
82
81
  },
83
- "version": "3.7.9"
82
+ "version": "3.7.12"
84
83
  }
@@ -836,7 +836,9 @@ export class SASViyaApiClient {
836
836
 
837
837
  const { result: members } = await this.requestClient
838
838
  .get<{ items: any[] }>(
839
- `/folders/folders/${folder.id}/members?limit=${folder.memberCount}`,
839
+ `/folders/folders/${folder.id}/members?limit=${
840
+ folder.memberCount < 500 ? 500 : folder.memberCount
841
+ }`, // this is a fix for https://github.com/sasjs/adapter/issues/669
840
842
  accessToken
841
843
  )
842
844
  .catch((err) => {
package/src/SASjs.ts CHANGED
@@ -113,6 +113,9 @@ export default class SASjs {
113
113
  debug?: boolean
114
114
  ) {
115
115
  this.isMethodSupported('executeScriptSASViya', [ServerType.SasViya])
116
+
117
+ contextName = contextName || this.sasjsConfig.contextName
118
+
116
119
  if (!contextName) {
117
120
  throw new Error(
118
121
  'Context name is undefined. Please set a `contextName` in your SASjs or override config.'
@@ -557,8 +557,18 @@ export class RequestClient implements HttpClient {
557
557
  }
558
558
 
559
559
  export const throwIfError = (response: AxiosResponse) => {
560
- if (response.status === 401) {
561
- throw new LoginRequiredError()
560
+ switch (response.status) {
561
+ case 400:
562
+ if (typeof response.data === 'object') {
563
+ throw new LoginRequiredError(response.data)
564
+ }
565
+ break
566
+ case 401:
567
+ if (typeof response.data === 'object') {
568
+ throw new LoginRequiredError(response.data)
569
+ } else {
570
+ throw new LoginRequiredError()
571
+ }
562
572
  }
563
573
 
564
574
  if (response.data?.entityID?.includes('login')) {
@@ -1,6 +1,10 @@
1
1
  export class LoginRequiredError extends Error {
2
- constructor() {
3
- super('Auth error: You must be logged in to access this resource')
2
+ constructor(details?: any) {
3
+ const message = details
4
+ ? JSON.stringify(details, null, 2)
5
+ : 'You must be logged in to access this resource'
6
+
7
+ super(`Auth error: ${message}`)
4
8
  this.name = 'LoginRequiredError'
5
9
  Object.setPrototypeOf(this, LoginRequiredError.prototype)
6
10
  }
package/typedoc.json CHANGED
@@ -1,45 +1,13 @@
1
1
  {
2
2
  "out": "docs",
3
- "includeDeclarations": true,
4
- "exclude": "**/*+(index|.spec|.e2e).ts",
5
- "ignoreCompilerErrors": true,
6
- "disableOutputCheck": true,
3
+ "exclude": ["**/*+(index|.spec|.e2e).ts"],
7
4
  "excludeExternals": true,
8
5
  "excludePrivate": true,
9
- "excludeNotExported": true,
10
- "theme": "./node_modules/typedoc-neo-theme/bin/default",
11
- "outline": [
12
- {
13
- "SAS Adapter": {
14
- "SASjs": "classes/reflection-717.reflection-180.sasjs",
15
- "Types": "modules/types"
16
- },
17
- "SAS Viya API Client": "classes/reflection-717.reflection-180.sasviyaapiclient",
18
- "SAS 9 API Client": "classes/reflection-717.reflection-180.sas9apiclient"
19
- }
20
- ],
21
- "links": [
22
- {
23
- "label": "SASjs on Github",
24
- "url": "https://github.com/sasjs/adapter"
25
- },
26
- {
27
- "label": "SASjs.io",
28
- "url": "https://sasjs.io"
29
- },
30
- {
31
- "label": "SASjs CLI",
32
- "url": "https://github.com/sasjs/cli"
33
- },
34
- {
35
- "label": "React Seed App",
36
- "url": "https://github.com/sasjs/react-seed-app"
37
- }
38
- ],
39
- "source": [
40
- {
41
- "path": "https://github.com/sasjs/adapter/blob/master/src/",
42
- "line": "L"
43
- }
6
+ "entryPoints": [
7
+ "src/SASjs.ts",
8
+ "src/SAS9ApiClient.ts",
9
+ "src/SASjsApiClient.ts",
10
+ "src/SASViyaApiClient.ts",
11
+ "src/types"
44
12
  ]
45
13
  }
@@ -1,3 +1,3 @@
1
1
  export declare class LoginRequiredError extends Error {
2
- constructor();
2
+ constructor(details?: any);
3
3
  }