@sasjs/adapter 6.0.1 → 6.1.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/README.md CHANGED
@@ -291,7 +291,7 @@ Configuration on the client side involves passing an object on startup, which ca
291
291
  - `appLoc` - this is the folder (eg in metadata or SAS Drive) under which the SAS services are created.
292
292
  - `serverType` - either `SAS9`, `SASVIYA` or `SASJS`. The `SASJS` server type is for use with [sasjs/server](https://github.com/sasjs/server).
293
293
  - `serverUrl` - the location (including http protocol and port) of the SAS Server. Can be omitted, eg if serving directly from the SAS Web Server, or in streaming mode.
294
- - `pathSASJS` - Only relevant when the serverType is `SASJS`. The path the SASjs Server API is mounted at - `/SASjsApi` by default, or `/api` to use the short spelling that sasjs/server also serves. Every SASjs Server route is addressed under this mount, including the stored-program endpoint at `<mount>/stp/execute`, which is not configurable.
294
+ - `pathSASJS` - Only relevant when the serverType is `SASJS`. The path the SASjs Server API is mounted at - `/SASjsApi` by default, or `/api` to use the short spelling that sasjs/server also serves. Every SASjs Server route is addressed under this mount, including the stored-program endpoint at `<mount>/stp/execute`, which is not configurable. Read the mount back with `sasjs.getApiBasePath()`, which answers the normalised mount (`/api` for a configured `/api/`, the mount itself for a configured `/api/stp/execute`, and the default `/SASjsApi` for a Viya or SAS 9 project) - note that `sasjs.getSasjsConfig().pathSASJS` reads back as configured, or `/SASjsApi` when it was never set, so a defaulted mount and one configured as `/SASjsApi` look the same there and `getApiBasePath()` is the answer to what the mount is. A root mount is `/`, and a caller concatenating onto it should treat that as an empty prefix rather than the value verbatim, or the URL carries a doubled slash.
295
295
  - `debug` - if `true` then SAS Logs and extra debug information is returned.
296
296
  - `verbose` - optional, if `true` then a summary of every HTTP response is logged.
297
297
  - `loginMechanism` - either `Default` or `Redirected`. See [SAS Logon](#sas-logon) section.
package/SASjs.d.ts CHANGED
@@ -246,13 +246,30 @@ export default class SASjs {
246
246
  */
247
247
  setSASjsConfig(config: Partial<SASjsConfig>): Promise<void>;
248
248
  /**
249
- * The mount every SASjs Server route sits under, read from `pathSASJS`.
249
+ * The mount every SASjs Server route sits under, normalised.
250
250
  *
251
- * One knob: deploy, code execution, triggers, sessions, auth and the
252
- * stored-program endpoint all hang off this, so they cannot end up on
253
- * different mounts.
254
- */
255
- private getApiBasePath;
251
+ * This is the read side of `pathSASJS`, and the only place the value is
252
+ * interpreted: one leading slash, no trailing one (`/api/` and ` api/ ` are
253
+ * both `/api`), a value carrying the stored-program endpoint
254
+ * (`/api/stp/execute`) is read as the mount it names, and absent or empty
255
+ * means `/SASjsApi`. A root mount is `/` - a proxy that puts the API at the
256
+ * origin - and a caller concatenating onto it contributes `''` for that
257
+ * case rather than the value verbatim, because `${serverUrl}/` + `/stp/...`
258
+ * is a doubled slash and a different URL to a proxy.
259
+ *
260
+ * A Viya or SAS 9 project has no such mount: neither server type reads
261
+ * `pathSASJS`, so this answers the default `/SASjsApi` for them.
262
+ *
263
+ * Public so a consumer that composes a URL by hand - `<mount>/stp/execute`
264
+ * for a `?_program=` link, or a route it builds for the drive and info
265
+ * endpoints - asks the adapter instead of re-implementing the normalisation
266
+ * or deep-importing the `apiBasePath` module. Note that
267
+ * `getSasjsConfig().pathSASJS` is not this value: it reads back as configured,
268
+ * or `/SASjsApi` when it was never set (the constructor's default), so a
269
+ * caller cannot tell a defaulted value from one configured as `/SASjsApi`
270
+ * there - this accessor is the answer to what the mount is.
271
+ */
272
+ getApiBasePath(): string;
256
273
  /**
257
274
  * Sets the debug state. Turning this on will enable additional logging in the adapter.
258
275
  * @param value - boolean indicating debug state (on/off).
package/SASjs.js CHANGED
@@ -439,11 +439,28 @@ class SASjs {
439
439
  });
440
440
  }
441
441
  /**
442
- * The mount every SASjs Server route sits under, read from `pathSASJS`.
442
+ * The mount every SASjs Server route sits under, normalised.
443
443
  *
444
- * One knob: deploy, code execution, triggers, sessions, auth and the
445
- * stored-program endpoint all hang off this, so they cannot end up on
446
- * different mounts.
444
+ * This is the read side of `pathSASJS`, and the only place the value is
445
+ * interpreted: one leading slash, no trailing one (`/api/` and ` api/ ` are
446
+ * both `/api`), a value carrying the stored-program endpoint
447
+ * (`/api/stp/execute`) is read as the mount it names, and absent or empty
448
+ * means `/SASjsApi`. A root mount is `/` - a proxy that puts the API at the
449
+ * origin - and a caller concatenating onto it contributes `''` for that
450
+ * case rather than the value verbatim, because `${serverUrl}/` + `/stp/...`
451
+ * is a doubled slash and a different URL to a proxy.
452
+ *
453
+ * A Viya or SAS 9 project has no such mount: neither server type reads
454
+ * `pathSASJS`, so this answers the default `/SASjsApi` for them.
455
+ *
456
+ * Public so a consumer that composes a URL by hand - `<mount>/stp/execute`
457
+ * for a `?_program=` link, or a route it builds for the drive and info
458
+ * endpoints - asks the adapter instead of re-implementing the normalisation
459
+ * or deep-importing the `apiBasePath` module. Note that
460
+ * `getSasjsConfig().pathSASJS` is not this value: it reads back as configured,
461
+ * or `/SASjsApi` when it was never set (the constructor's default), so a
462
+ * caller cannot tell a defaulted value from one configured as `/SASjsApi`
463
+ * there - this accessor is the answer to what the mount is.
447
464
  */
448
465
  getApiBasePath() {
449
466
  // Only a SASjs Server project has this mount; a Viya or SAS 9 project never
@@ -4333,11 +4333,28 @@ class SASjs {
4333
4333
  });
4334
4334
  }
4335
4335
  /**
4336
- * The mount every SASjs Server route sits under, read from `pathSASJS`.
4336
+ * The mount every SASjs Server route sits under, normalised.
4337
4337
  *
4338
- * One knob: deploy, code execution, triggers, sessions, auth and the
4339
- * stored-program endpoint all hang off this, so they cannot end up on
4340
- * different mounts.
4338
+ * This is the read side of `pathSASJS`, and the only place the value is
4339
+ * interpreted: one leading slash, no trailing one (`/api/` and ` api/ ` are
4340
+ * both `/api`), a value carrying the stored-program endpoint
4341
+ * (`/api/stp/execute`) is read as the mount it names, and absent or empty
4342
+ * means `/SASjsApi`. A root mount is `/` - a proxy that puts the API at the
4343
+ * origin - and a caller concatenating onto it contributes `''` for that
4344
+ * case rather than the value verbatim, because `${serverUrl}/` + `/stp/...`
4345
+ * is a doubled slash and a different URL to a proxy.
4346
+ *
4347
+ * A Viya or SAS 9 project has no such mount: neither server type reads
4348
+ * `pathSASJS`, so this answers the default `/SASjsApi` for them.
4349
+ *
4350
+ * Public so a consumer that composes a URL by hand - `<mount>/stp/execute`
4351
+ * for a `?_program=` link, or a route it builds for the drive and info
4352
+ * endpoints - asks the adapter instead of re-implementing the normalisation
4353
+ * or deep-importing the `apiBasePath` module. Note that
4354
+ * `getSasjsConfig().pathSASJS` is not this value: it reads back as configured,
4355
+ * or `/SASjsApi` when it was never set (the constructor's default), so a
4356
+ * caller cannot tell a defaulted value from one configured as `/SASjsApi`
4357
+ * there - this accessor is the answer to what the mount is.
4341
4358
  */
4342
4359
  getApiBasePath() {
4343
4360
  // Only a SASjs Server project has this mount; a Viya or SAS 9 project never
package/package.json CHANGED
@@ -131,7 +131,7 @@
131
131
  "safer-buffer": "npm:@socketregistry/safer-buffer@1.0.10",
132
132
  "side-channel": "npm:@socketregistry/side-channel@1.0.10"
133
133
  },
134
- "version": "6.0.1",
134
+ "version": "6.1.0",
135
135
  "engines": {
136
136
  "node": ">=22"
137
137
  },