@sasjs/adapter 4.11.3 → 4.12.1

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.
@@ -2,6 +2,7 @@
2
2
  import { Job, Session, Context, ContextAllAttributes, Folder, File, EditContextInput, PollOptions } from './types';
3
3
  import { SasAuthResponse, MacroVar, AuthConfig } from '@sasjs/utils/types';
4
4
  import { RequestClient } from './request/RequestClient';
5
+ import { FileResource } from './types/FileResource';
5
6
  interface JobExecutionResult {
6
7
  result?: {
7
8
  result: object;
@@ -54,12 +55,6 @@ export declare class SASViyaApiClient {
54
55
  * @param accessToken - an access token for an authorized user.
55
56
  */
56
57
  getComputeContexts(accessToken?: string): Promise<{
57
- /**
58
- * A helper method used to call appendRequest method of RequestClient
59
- * @param response - response from sasjs request
60
- * @param program - name of program
61
- * @param debug - a boolean that indicates whether debug was enabled or not
62
- */
63
58
  createdBy: any;
64
59
  id: any;
65
60
  name: any;
@@ -144,6 +139,23 @@ export declare class SASViyaApiClient {
144
139
  * @param variables - an object that represents macro variables.
145
140
  */
146
141
  executeScript(jobPath: string, linesOfCode: string[], contextName: string, authConfig?: AuthConfig, data?: null, debug?: boolean, expectWebout?: boolean, waitForResult?: boolean, pollOptions?: PollOptions, printPid?: boolean, variables?: MacroVar): Promise<any>;
142
+ /**
143
+ * Fetches the file content for a file in the specified folder.
144
+ *
145
+ * @param folderPath - the full path to the folder containing the file. eg: /Public/folder1/folder2
146
+ * @param fileName - the name of the file in the `folderPath`
147
+ * @param accessToken - an access token for authorizing the request
148
+ */
149
+ getFileContent(folderPath: string, fileName: string, accessToken?: string): Promise<string>;
150
+ /**
151
+ * Updates the file content for a file in the specified folder.
152
+ *
153
+ * @param folderPath - the full path to the folder containing the file. eg: /Public/folder1/folder2
154
+ * @param fileName - the name of the file in the `folderPath`
155
+ * @param content - the new content to be written to the file
156
+ * @param accessToken - an access token for authorizing the request
157
+ */
158
+ updateFileContent(folderPath: string, fileName: string, content: string, accessToken?: string): Promise<FileResource>;
147
159
  /**
148
160
  * Fetches a folder. Path to the folder is required.
149
161
  * @param folderPath - the absolute path to the folder.
@@ -238,6 +250,7 @@ export declare class SASViyaApiClient {
238
250
  private uploadTables;
239
251
  private getFolderDetails;
240
252
  private getFolderUri;
253
+ private getFileUri;
241
254
  private getRecycleBinUri;
242
255
  /**
243
256
  * Returns a JSON representation of a compute context.
@@ -253,11 +266,15 @@ export declare class SASViyaApiClient {
253
266
  */
254
267
  getComputeContextById(contextId: string, accessToken?: string): Promise<ContextAllAttributes>;
255
268
  /**
256
- * Lists children folders for given Viya folder.
269
+ * Lists children folders/files for given Viya folder.
257
270
  * @param sourceFolder - the full path (eg `/Public/example/myFolder`) or URI of the source folder listed. Providing URI instead of path will save one extra request.
258
271
  * @param accessToken - an access token for authorizing the request.
272
+ * @param {Object} [options] - Additional options.
273
+ * @param {boolean} [options.returnDetails=false] - when set to true, the function will return an array of objects with member details, otherwise it will return an array of member names.
259
274
  */
260
- listFolder(sourceFolder: string, accessToken?: string, limit?: number): Promise<any[]>;
275
+ listFolder(sourceFolder: string, accessToken?: string, limit?: number, options?: {
276
+ returnDetails?: boolean;
277
+ }): Promise<any[]>;
261
278
  /**
262
279
  * Moves Viya folder to a new location. The folder may be renamed at the same time.
263
280
  * @param sourceFolder - the full path (eg `/Public/example/myFolder`) or URI of the source folder to be moved. Providing URI instead of path will save one extra request.
package/SASjs.d.ts CHANGED
@@ -157,6 +157,23 @@ export default class SASjs {
157
157
  * @param sasApiClient - a client for interfacing with SAS API.
158
158
  */
159
159
  createFile(fileName: string, content: Buffer, parentFolderPath: string, parentFolderUri?: string, accessToken?: string, sasApiClient?: SASViyaApiClient): Promise<import("./types").File>;
160
+ /**
161
+ * Fetches the file content for a file in the specified folder.
162
+ *
163
+ * @param folderPath - the full path to the folder containing the file. eg: /Public/folder1/folder2
164
+ * @param fileName - the name of the file in the `folderPath`
165
+ * @param accessToken - an access token for authorizing the request
166
+ */
167
+ getFileContent(folderPath: string, fileName: string, accessToken?: string): Promise<string>;
168
+ /**
169
+ * Updates the file content for a file in the specified folder.
170
+ *
171
+ * @param folderPath - the full path to the folder containing the file. eg: /Public/folder1/folder2
172
+ * @param fileName - the name of the file in the `folderPath`
173
+ * @param content - the new content to be written to the file
174
+ * @param accessToken - an access token for authorizing the request
175
+ */
176
+ updateFileContent(folderPath: string, fileName: string, content: string, accessToken?: string): Promise<import("./types/FileResource").FileResource>;
160
177
  /**
161
178
  * Fetches a folder from the SAS file system.
162
179
  * @param folderPath - path of the folder to be fetched.
@@ -173,8 +190,9 @@ export default class SASjs {
173
190
  * Lists children folders for given Viya folder.
174
191
  * @param sourceFolder - the full path (eg `/Public/example/myFolder`) or URI of the source folder listed. Providing URI instead of path will save one extra request.
175
192
  * @param accessToken - an access token for authorizing the request.
193
+ * @param returnDetails - when set to true, the function will return an array of objects with member details, otherwise it will return an array of member names.
176
194
  */
177
- listFolder(sourceFolder: string, accessToken?: string, limit?: number): Promise<any[] | undefined>;
195
+ listFolder(sourceFolder: string, accessToken?: string, limit?: number, returnDetails?: boolean): Promise<any[] | undefined>;
178
196
  /**
179
197
  * Moves folder to a new location. The folder may be renamed at the same time.
180
198
  * @param sourceFolder - the full path (eg `/Public/example/myFolder`) or URI of the source folder to be moved. Providing URI instead of path will save one extra request.