@sasjs/api 0.47.0 → 0.48.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.
package/README.md CHANGED
@@ -124,6 +124,12 @@ Refreshing the API surface: regenerate `api/public/swagger.yaml` in `sasjs/serve
124
124
 
125
125
  Re-vendoring is a two-repository change and the server half merges first: the document is only true once the controllers it is generated from answer what it states, so a copy taken from an unmerged server branch describes a server that does not exist yet. Take the copy from a released tag of `sasjs/server` rather than from its `main`, and the document and the code a host runs cannot disagree.
126
126
 
127
+ ### Dependency audit
128
+
129
+ `npm run audit:gate` uses `@sasjs/release` to judge the full tree, including development dependencies, from **info** upwards. This deliberately tightens the old low floor: even an unwaived info finding fails. Whenever a waiver exists the gate also audits production at info; production findings cannot be waived. This preserves the old dev-only rule even if a waived source appears in production at info. CI retains the separate production `npm audit --omit=dev --audit-level=low` and the independent `tools/viya-capture` audit.
130
+
131
+ `scripts/audit-allowlist.json` is empty because the former picomatch source 1247710 no longer appears. A future exemption must name its GHSA `id`, exact numeric `source`, exact `severity`, `recheckBy` date and a reason; `packages` can restrict its scope. A changed source or severity requires review. Unlike the old gate, a stale exemption fails: remove it when the finding clears. See the [shared gate documentation](https://github.com/sasjs/release#the-audit-gate) for the schema and replay options.
132
+
127
133
  ### The coverage ratchet
128
134
 
129
135
  `jest.config.js` carries a floor, and a floor only moves when somebody remembers to move it - so it passes a pull request that drops two points as long as it stays above the number. The ratchet is the other half:
package/build/browser.js CHANGED
@@ -1,4 +1,4 @@
1
- /* @sasjs/api 0.47.0 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
1
+ /* @sasjs/api 0.48.1 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
2
2
  "use strict";
3
3
  var SASjsApi = (() => {
4
4
  var __defProp = Object.defineProperty;
@@ -5536,8 +5536,6 @@ var SASjsApi = (() => {
5536
5536
  return value >>> 0;
5537
5537
  };
5538
5538
  var seedOf = (settings = {}) => {
5539
- if (settings.seed !== void 0 && settings.seed !== "")
5540
- return hash(`seed:${settings.seed}`);
5541
5539
  const address = normaliseServerUrl(settings.serverUrl);
5542
5540
  return hash(`url:${address || DEFAULT_SEED}`);
5543
5541
  };
@@ -10039,6 +10037,11 @@ var SASjsApi = (() => {
10039
10037
  };
10040
10038
  var CODE_LIFETIME_SECONDS = 30;
10041
10039
  var live = (issued, now) => issued && (issued.expiresAt === void 0 || issued.expiresAt > now) ? issued.subject : void 0;
10040
+ var PUBLIC_CLIENT = {
10041
+ clientId: "sas.cli",
10042
+ accessTokenExpiration: 86400,
10043
+ refreshTokenExpiration: 86400 * 30
10044
+ };
10042
10045
  var MemoryIdentityStore = class {
10043
10046
  constructor(fixture = DEFAULT_IDENTITY) {
10044
10047
  this.userList = [];
@@ -10146,7 +10149,9 @@ var SASjsApi = (() => {
10146
10149
  return this.passwords.get(user3.uid) === password;
10147
10150
  }
10148
10151
  async client(clientId) {
10149
- return this.clientMap.get(clientId);
10152
+ const declared = this.clientMap.get(clientId);
10153
+ if (declared) return declared;
10154
+ return clientId === PUBLIC_CLIENT.clientId ? { ...PUBLIC_CLIENT } : void 0;
10150
10155
  }
10151
10156
  async issue(subject, client) {
10152
10157
  const issuedAt = Date.now();
@@ -34,6 +34,21 @@ const CODE_LIFETIME_SECONDS = 30;
34
34
  const live = (issued, now) => issued && (issued.expiresAt === undefined || issued.expiresAt > now)
35
35
  ? issued.subject
36
36
  : undefined;
37
+ /**
38
+ * The public OAuth client every Viya deployment ships.
39
+ *
40
+ * `@sasjs/adapter` falls back to it whenever a target names no client, and
41
+ * sasjs/server binds its password grant - and the refresh that follows - to this
42
+ * id with an empty secret, as a rule rather than a stored record, because a
43
+ * client record carries a secret and a public client has none. The lifetimes are
44
+ * the ones the server mints with, so a pair bought here expires when it would
45
+ * there.
46
+ */
47
+ const PUBLIC_CLIENT = {
48
+ clientId: 'sas.cli',
49
+ accessTokenExpiration: 86400,
50
+ refreshTokenExpiration: 86400 * 30
51
+ };
37
52
  /**
38
53
  * Whether a token minted for one subject names the same user and client.
39
54
  *
@@ -151,7 +166,19 @@ class MemoryIdentityStore {
151
166
  return this.passwords.get(user.uid) === password;
152
167
  }
153
168
  async client(clientId) {
154
- return this.clientMap.get(clientId);
169
+ const declared = this.clientMap.get(clientId);
170
+ if (declared)
171
+ return declared;
172
+ // The public client is never a record, because a record carries a secret and
173
+ // a public client has none. The platform ships it, sasjs/server binds its
174
+ // password grant to exactly this id with an empty secret, and
175
+ // `@sasjs/adapter` falls back to it whenever a target names no client.
176
+ // Resolving it here lets a host answer the sign-in a server answers, while
177
+ // leaving `clients()` - the administration listing - to the fixture: what a
178
+ // site reports about its own clients must not depend on a rule of the estate.
179
+ return clientId === PUBLIC_CLIENT.clientId
180
+ ? { ...PUBLIC_CLIENT }
181
+ : undefined;
155
182
  }
156
183
  async issue(subject, client) {
157
184
  // The lifetimes are the client's, recorded against the instant of issue: a
@@ -9,15 +9,14 @@
9
9
  * tomorrow.
10
10
  *
11
11
  * The seed is therefore the identity of the estate, and the identity of an estate
12
- * is the address clients already use to reach it. A target that points at
13
- * `http://localhost:5000` and a target that points at `http://127.0.0.1:5000` are
14
- * the same estate spelled two ways, so the address is normalised before it is
15
- * hashed - and `seed` exists for the two cases where the address is the wrong
16
- * identity: the estate reached by a different hostname (a container name, a LAN
17
- * address), and the port that moves between runs (CI picks an ephemeral one).
12
+ * is the address clients already use to reach it, normalised so that one estate
13
+ * spelled two ways is one string. There is no override: an address that differs is
14
+ * a different estate with different data, by design. Anything that reads this
15
+ * data - a fixture, a screenshot, a test - has to work whatever the address is,
16
+ * because the address is all the identity there is.
18
17
  *
19
- * Absent both, every emulated estate shares one seed. That is the only honest
20
- * default: an emulator with no address has not told us which estate it is.
18
+ * An emulator with no address has not said which estate it is, so every such
19
+ * estate shares one seed. That is the only honest default.
21
20
  */
22
21
  Object.defineProperty(exports, "__esModule", { value: true });
23
22
  exports.drawFrom = exports.drawInt = exports.generator = exports.seedOf = exports.hash = exports.normaliseServerUrl = exports.DEFAULT_SEED = void 0;
@@ -83,13 +82,10 @@ exports.hash = hash;
83
82
  /**
84
83
  * The number that makes this estate's generated data reproducible.
85
84
  *
86
- * `seed` wins over the address when both are present: it is the override a host
87
- * reaches for when the address disagrees with the estate, not a second opinion
88
- * the address gets to overrule.
85
+ * The address is the only input: the same estate answers the same way every time,
86
+ * and a different address is a different estate.
89
87
  */
90
88
  const seedOf = (settings = {}) => {
91
- if (settings.seed !== undefined && settings.seed !== '')
92
- return (0, exports.hash)(`seed:${settings.seed}`);
93
89
  const address = (0, exports.normaliseServerUrl)(settings.serverUrl);
94
90
  return (0, exports.hash)(`url:${address || exports.DEFAULT_SEED}`);
95
91
  };
@@ -117,10 +117,10 @@ export interface Services {
117
117
  /**
118
118
  * The emulated Viya estate this host mounts, when it mounts one.
119
119
  *
120
- * Absent, the emulated answers fall back to one shared seed. The address is what
121
- * identifies an estate, so `serverUrl` is the seed unless `seed` overrides it -
122
- * which a host does when the port moves between runs or the estate answers on a
123
- * second hostname.
120
+ * Absent, the emulated answers fall back to one shared seed. The normalised
121
+ * `serverUrl` is the whole identity: one address is one estate, a different
122
+ * address - a moved port, a second hostname - is a different estate with its own
123
+ * data, and there is no setting that makes two addresses one.
124
124
  */
125
125
  viya?: ViyaSeedSettings;
126
126
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../../../src/identity/memory-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,QAAQ,EACR,aAAa,EACb,OAAO,EACP,OAAO,EACP,SAAS,EACT,UAAU,EACX,MAAM,YAAY,CAAA;AACnB,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,cAAc,CAAA;AA+DrB;;;;;GAKG;AACH,qBAAa,mBAAoB,YAAW,aAAa;IACvD,OAAO,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E,MAAM,GACd,OAAO,CAAC,mBAAmB,GAAG,SAAS,CAAC;IAOrC,WAAW,IAAI,OAAO,CAAC,wBAAwB,EAAE,CAAC;IAIlD,cAAc,CAClB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;IAI1C,gBAAgB,CACpB,KAAK,EAAE,aAAa,GACnB,OAAO,CAAC,wBAAwB,CAAC;IAa9B,oBAAoB,CACxB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,wBAAwB,GAAG,SAAS,CAAC;IAO1C,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5C,OAAO,IAAI,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAI1C,YAAY,CAChB,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,oBAAoB,CAAC;IAUhC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,IAAI,eAAe;CA4B5B"}
@@ -31,6 +31,21 @@ const CODE_LIFETIME_SECONDS = 30;
31
31
  const live = (issued, now) => issued && (issued.expiresAt === undefined || issued.expiresAt > now)
32
32
  ? issued.subject
33
33
  : undefined;
34
+ /**
35
+ * The public OAuth client every Viya deployment ships.
36
+ *
37
+ * `@sasjs/adapter` falls back to it whenever a target names no client, and
38
+ * sasjs/server binds its password grant - and the refresh that follows - to this
39
+ * id with an empty secret, as a rule rather than a stored record, because a
40
+ * client record carries a secret and a public client has none. The lifetimes are
41
+ * the ones the server mints with, so a pair bought here expires when it would
42
+ * there.
43
+ */
44
+ const PUBLIC_CLIENT = {
45
+ clientId: 'sas.cli',
46
+ accessTokenExpiration: 86400,
47
+ refreshTokenExpiration: 86400 * 30
48
+ };
34
49
  /**
35
50
  * Whether a token minted for one subject names the same user and client.
36
51
  *
@@ -148,7 +163,19 @@ export class MemoryIdentityStore {
148
163
  return this.passwords.get(user.uid) === password;
149
164
  }
150
165
  async client(clientId) {
151
- return this.clientMap.get(clientId);
166
+ const declared = this.clientMap.get(clientId);
167
+ if (declared)
168
+ return declared;
169
+ // The public client is never a record, because a record carries a secret and
170
+ // a public client has none. The platform ships it, sasjs/server binds its
171
+ // password grant to exactly this id with an empty secret, and
172
+ // `@sasjs/adapter` falls back to it whenever a target names no client.
173
+ // Resolving it here lets a host answer the sign-in a server answers, while
174
+ // leaving `clients()` - the administration listing - to the fixture: what a
175
+ // site reports about its own clients must not depend on a rule of the estate.
176
+ return clientId === PUBLIC_CLIENT.clientId
177
+ ? { ...PUBLIC_CLIENT }
178
+ : undefined;
152
179
  }
153
180
  async issue(subject, client) {
154
181
  // The lifetimes are the client's, recorded against the instant of issue: a
@@ -8,15 +8,14 @@
8
8
  * tomorrow.
9
9
  *
10
10
  * The seed is therefore the identity of the estate, and the identity of an estate
11
- * is the address clients already use to reach it. A target that points at
12
- * `http://localhost:5000` and a target that points at `http://127.0.0.1:5000` are
13
- * the same estate spelled two ways, so the address is normalised before it is
14
- * hashed - and `seed` exists for the two cases where the address is the wrong
15
- * identity: the estate reached by a different hostname (a container name, a LAN
16
- * address), and the port that moves between runs (CI picks an ephemeral one).
11
+ * is the address clients already use to reach it, normalised so that one estate
12
+ * spelled two ways is one string. There is no override: an address that differs is
13
+ * a different estate with different data, by design. Anything that reads this
14
+ * data - a fixture, a screenshot, a test - has to work whatever the address is,
15
+ * because the address is all the identity there is.
17
16
  *
18
- * Absent both, every emulated estate shares one seed. That is the only honest
19
- * default: an emulator with no address has not told us which estate it is.
17
+ * An emulator with no address has not said which estate it is, so every such
18
+ * estate shares one seed. That is the only honest default.
20
19
  */
21
20
  /** The seed every emulated estate falls back to. */
22
21
  export declare const DEFAULT_SEED = "emulated";
@@ -56,10 +55,8 @@ export interface ViyaRun {
56
55
  state?: 'completed' | 'failed';
57
56
  }
58
57
  export interface ViyaSeedSettings {
59
- /** The address this estate answers at. */
58
+ /** The address this estate answers at, which is what seeds it. */
60
59
  serverUrl?: string;
61
- /** Pins the generated data when the address is not the identity. */
62
- seed?: string | number;
63
60
  /** Runs a submitted program, when the host has an engine. */
64
61
  execute?: ViyaExecutor['execute'];
65
62
  }
@@ -77,9 +74,8 @@ export declare const hash: (input: string) => number;
77
74
  /**
78
75
  * The number that makes this estate's generated data reproducible.
79
76
  *
80
- * `seed` wins over the address when both are present: it is the override a host
81
- * reaches for when the address disagrees with the estate, not a second opinion
82
- * the address gets to overrule.
77
+ * The address is the only input: the same estate answers the same way every time,
78
+ * and a different address is a different estate.
83
79
  */
84
80
  export declare const seedOf: (settings?: ViyaSeedSettings) => number;
85
81
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"seed.d.ts","sourceRoot":"","sources":["../../../src/viya/seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,oDAAoD;AACpD,eAAO,MAAM,YAAY,aAAa,CAAA;AAEtC;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,OAAO,EAAE;QACf,2DAA2D;QAC3D,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;QAC1B,4DAA4D;QAC5D,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;QAClC,kEAAkE;QAClE,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,sCAAsC;QACtC,SAAS,EAAE,MAAM,CAAA;KAClB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACrB;AAED,8CAA8C;AAC9C,MAAM,WAAW,OAAO;IACtB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gFAAgF;IAChF,GAAG,EAAE,MAAM,CAAA;IACX;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAA;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,0CAA0C;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,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C7D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,gFAAgF;IAChF,GAAG,EAAE,MAAM,CAAA;IACX;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAA;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,YAAY,CAAC,SAAS,CAAC,CAAA;CAClC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,GAAG,SAAS,KAAG,MA+C5D,CAAA;AAED,8DAA8D;AAC9D,eAAO,MAAM,IAAI,GAAI,OAAO,MAAM,KAAG,MASpC,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,WAAU,gBAAqB,KAAG,MAIxD,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,CAAC,MAAM,MAAM,CAarD,CAAA;AAED,4DAA4D;AAC5D,eAAO,MAAM,OAAO,GAAI,MAAM,MAAM,MAAM,EAAE,OAAO,MAAM,KAAG,MAChC,CAAA;AAE5B,oDAAoD;AACpD,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,MAAM,MAAM,MAAM,EAAE,QAAQ,CAAC,EAAE,KAAG,CACxB,CAAA"}
@@ -8,15 +8,14 @@
8
8
  * tomorrow.
9
9
  *
10
10
  * The seed is therefore the identity of the estate, and the identity of an estate
11
- * is the address clients already use to reach it. A target that points at
12
- * `http://localhost:5000` and a target that points at `http://127.0.0.1:5000` are
13
- * the same estate spelled two ways, so the address is normalised before it is
14
- * hashed - and `seed` exists for the two cases where the address is the wrong
15
- * identity: the estate reached by a different hostname (a container name, a LAN
16
- * address), and the port that moves between runs (CI picks an ephemeral one).
11
+ * is the address clients already use to reach it, normalised so that one estate
12
+ * spelled two ways is one string. There is no override: an address that differs is
13
+ * a different estate with different data, by design. Anything that reads this
14
+ * data - a fixture, a screenshot, a test - has to work whatever the address is,
15
+ * because the address is all the identity there is.
17
16
  *
18
- * Absent both, every emulated estate shares one seed. That is the only honest
19
- * default: an emulator with no address has not told us which estate it is.
17
+ * An emulator with no address has not said which estate it is, so every such
18
+ * estate shares one seed. That is the only honest default.
20
19
  */
21
20
  /** The seed every emulated estate falls back to. */
22
21
  export const DEFAULT_SEED = 'emulated';
@@ -78,13 +77,10 @@ export const hash = (input) => {
78
77
  /**
79
78
  * The number that makes this estate's generated data reproducible.
80
79
  *
81
- * `seed` wins over the address when both are present: it is the override a host
82
- * reaches for when the address disagrees with the estate, not a second opinion
83
- * the address gets to overrule.
80
+ * The address is the only input: the same estate answers the same way every time,
81
+ * and a different address is a different estate.
84
82
  */
85
83
  export const seedOf = (settings = {}) => {
86
- if (settings.seed !== undefined && settings.seed !== '')
87
- return hash(`seed:${settings.seed}`);
88
84
  const address = normaliseServerUrl(settings.serverUrl);
89
85
  return hash(`url:${address || DEFAULT_SEED}`);
90
86
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sasjs/api",
3
- "version": "0.47.0",
3
+ "version": "0.48.1",
4
4
  "description": "The SASjs Server API, described once - a generated route table, the services behind it, and the conformance corpus both hosts run",
5
5
  "license": "MIT",
6
6
  "author": "SASjs",
@@ -49,14 +49,14 @@
49
49
  "check:viya": "node scripts/viya-generate.mjs --check",
50
50
  "check:builds": "node scripts/check-builds.mjs",
51
51
  "check:package": "node scripts/check-package.mjs",
52
- "audit:gate": "node scripts/audit.mjs",
52
+ "audit:gate": "sasjs-release --audit --audit-level info --audit-require-source --audit-require-severity",
53
53
  "check:appstream": "node scripts/appstream-browser-check.cjs",
54
54
  "conformance": "node tools/viya-conformance/conformance.mjs",
55
55
  "release": "sasjs-release",
56
56
  "prepublishOnly": "node -e \"const v=require('./package.json').version; if (/^0\\.0\\.0/.test(v)) { console.error('refusing to publish ' + v + ': the version is stamped from the tag by @sasjs/release --prepare-publish'); process.exit(1) }\""
57
57
  },
58
58
  "devDependencies": {
59
- "@sasjs/release": "0.11.1",
59
+ "@sasjs/release": "0.18.0",
60
60
  "@types/jest": "30.0.0",
61
61
  "@types/node": "22.20.5",
62
62
  "deepmerge": "file:./vendor/deepmerge",