@sasjs/api 0.48.1 → 0.49.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.
Files changed (39) hide show
  1. package/README.md +4 -0
  2. package/build/browser.js +204 -56
  3. package/build/cjs/appstream/identity.js +2 -31
  4. package/build/cjs/corpus/viya/replay.js +117 -0
  5. package/build/cjs/index.js +6 -3
  6. package/build/cjs/uuid.js +30 -0
  7. package/build/cjs/viya/compute.js +38 -20
  8. package/build/cjs/viya/dispatch.js +10 -0
  9. package/build/cjs/viya/seed.js +34 -8
  10. package/build/cjs/viya/service.js +55 -11
  11. package/build/cjs/viya/sessions.js +24 -10
  12. package/build/esm/appstream/identity.d.ts +1 -9
  13. package/build/esm/appstream/identity.d.ts.map +1 -1
  14. package/build/esm/appstream/identity.js +1 -30
  15. package/build/esm/corpus/viya/replay.d.ts +53 -0
  16. package/build/esm/corpus/viya/replay.d.ts.map +1 -0
  17. package/build/esm/corpus/viya/replay.js +112 -0
  18. package/build/esm/identity/types.d.ts +2 -0
  19. package/build/esm/identity/types.d.ts.map +1 -1
  20. package/build/esm/index.d.ts +2 -0
  21. package/build/esm/index.d.ts.map +1 -1
  22. package/build/esm/index.js +1 -0
  23. package/build/esm/uuid.d.ts +6 -0
  24. package/build/esm/uuid.d.ts.map +1 -0
  25. package/build/esm/uuid.js +26 -0
  26. package/build/esm/viya/compute.d.ts.map +1 -1
  27. package/build/esm/viya/compute.js +39 -21
  28. package/build/esm/viya/dispatch.d.ts +3 -0
  29. package/build/esm/viya/dispatch.d.ts.map +1 -1
  30. package/build/esm/viya/dispatch.js +11 -1
  31. package/build/esm/viya/seed.d.ts +29 -7
  32. package/build/esm/viya/seed.d.ts.map +1 -1
  33. package/build/esm/viya/seed.js +32 -7
  34. package/build/esm/viya/service.d.ts.map +1 -1
  35. package/build/esm/viya/service.js +55 -11
  36. package/build/esm/viya/sessions.d.ts +24 -6
  37. package/build/esm/viya/sessions.d.ts.map +1 -1
  38. package/build/esm/viya/sessions.js +24 -10
  39. package/package.json +1 -1
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.COMPUTE_HANDLERS = exports.contextNameFrom = exports.EMULATED_CONTEXT_ID = exports.DEFAULT_CONTEXT_NAME = void 0;
4
4
  const types_js_1 = require("../types.js");
5
5
  const seed_js_1 = require("./seed.js");
6
- const seed_js_2 = require("./seed.js");
7
6
  const sessions_js_1 = require("./sessions.js");
8
7
  const ids_js_1 = require("./ids.js");
9
8
  /**
@@ -54,7 +53,7 @@ const linksFor = (uri, type, collection = false, itemType = false) => [
54
53
  ...(itemType ? { itemType: type } : {})
55
54
  }
56
55
  ];
57
- const estateOf = (services) => (0, sessions_js_1.estateFor)((0, seed_js_2.seedOf)(services.viya));
56
+ const estateOf = (services) => (0, sessions_js_1.estateFor)((0, seed_js_1.estateKeyOf)(services.viya), (0, seed_js_1.seedOf)(services.viya));
58
57
  /**
59
58
  * The context name a client asked for.
60
59
  *
@@ -137,15 +136,31 @@ const jobBody = (job) => {
137
136
  ])
138
137
  };
139
138
  };
140
- /** The session the request names, or the 404 a client that lost it expects. */
141
- const sessionOf = (services, id) => {
139
+ /** The browser mock has an anonymous principal distinct from every named user. */
140
+ const ownerOf = (subject) => {
141
+ if (subject === undefined)
142
+ return { kind: 'anonymous' };
143
+ if (!subject || typeof subject.userId !== 'string' || !subject.userId.trim())
144
+ throw new types_js_1.ApiError(401, 'A valid caller is required.');
145
+ if (subject.ownerId === undefined)
146
+ return { kind: 'user', key: subject.userId };
147
+ if (typeof subject.ownerId !== 'string' || !subject.ownerId.trim())
148
+ throw new types_js_1.ApiError(401, 'A valid caller is required.');
149
+ return { kind: 'account', key: subject.ownerId };
150
+ };
151
+ /** Ownerless records cannot be attributed and are deliberately inaccessible. */
152
+ const sessionOf = (services, id, subject) => {
153
+ const owner = ownerOf(subject);
142
154
  const session = estateOf(services).session(id);
143
- if (!session)
155
+ if (!session ||
156
+ !session.owner ||
157
+ session.owner.kind !== owner.kind ||
158
+ session.owner.key !== owner.key)
144
159
  throw new types_js_1.ApiError(404, `Session with ID '${id}' was not found.`);
145
160
  return session;
146
161
  };
147
- const jobOf = (services, sessionId, jobId) => {
148
- const job = sessionOf(services, sessionId).jobs.get(jobId);
162
+ const jobOf = (services, sessionId, jobId, subject) => {
163
+ const job = sessionOf(services, sessionId, subject).jobs.get(jobId);
149
164
  if (!job)
150
165
  throw new types_js_1.ApiError(404, `Job with ID '${jobId}' was not found.`);
151
166
  return job;
@@ -180,25 +195,25 @@ exports.COMPUTE_HANDLERS = {
180
195
  if (params.id !== exports.EMULATED_CONTEXT_ID)
181
196
  throw new types_js_1.ApiError(404, `Context with ID '${params.id}' was not found.`);
182
197
  const body = (request.body ?? {});
183
- const session = estateOf(services).create();
198
+ const session = estateOf(services).create(ownerOf(request.subject));
184
199
  return {
185
200
  status: 201,
186
201
  body: sessionBody(services, session, body.environment?.autoExecLines ?? [], (0, ids_js_1.callerId)(request.subject))
187
202
  };
188
203
  },
189
- 'GET /compute/sessions/{}/state': async ({ services, params }) => {
190
- sessionOf(services, params.id);
204
+ 'GET /compute/sessions/{}/state': async ({ services, params, request }) => {
205
+ sessionOf(services, params.id, request.subject);
191
206
  // a bare enum, not an object: the adapter calls `.trim()` on the answer, and
192
207
  // the capture recorded no shape here because there is no JSON body
193
208
  return { status: 200, body: 'idle' };
194
209
  },
195
- 'DELETE /compute/sessions/{}': async ({ services, params }) => {
196
- sessionOf(services, params.id);
210
+ 'DELETE /compute/sessions/{}': async ({ services, params, request }) => {
211
+ sessionOf(services, params.id, request.subject);
197
212
  estateOf(services).remove(params.id);
198
213
  return { status: 204, body: undefined };
199
214
  },
200
215
  'POST /compute/sessions/{}/jobs': async ({ services, params, request }) => {
201
- const session = sessionOf(services, params.id);
216
+ const session = sessionOf(services, params.id, request.subject);
202
217
  const body = (request.body ?? {});
203
218
  const job = estateOf(services).submit(session, body);
204
219
  const execute = services.viya?.execute;
@@ -237,8 +252,8 @@ exports.COMPUTE_HANDLERS = {
237
252
  });
238
253
  return { status: 201, body: jobBody(job) };
239
254
  },
240
- 'GET /compute/sessions/{}/filerefs/_webout/content': async ({ services, params }) => {
241
- const session = sessionOf(services, params.id);
255
+ 'GET /compute/sessions/{}/filerefs/_webout/content': async ({ services, params, request }) => {
256
+ const session = sessionOf(services, params.id, request.subject);
242
257
  const last = [...session.jobs.values()].pop();
243
258
  if (!last)
244
259
  throw new types_js_1.ApiError(404, 'This session has no `_webout` yet: nothing has run in it.');
@@ -257,20 +272,23 @@ exports.COMPUTE_HANDLERS = {
257
272
  headers: { 'content-type': 'text/plain' }
258
273
  };
259
274
  },
260
- 'GET /compute/sessions/{}/jobs/{}': async ({ services, params }) => {
275
+ 'GET /compute/sessions/{}/jobs/{}': async ({ services, params, request }) => {
261
276
  const [sessionId, jobId] = segmentsOf(params);
262
- return { status: 200, body: jobBody(jobOf(services, sessionId, jobId)) };
277
+ return {
278
+ status: 200,
279
+ body: jobBody(jobOf(services, sessionId, jobId, request.subject))
280
+ };
263
281
  },
264
- 'GET /compute/sessions/{}/jobs/{}/state': async ({ services, params }) => {
282
+ 'GET /compute/sessions/{}/jobs/{}/state': async ({ services, params, request }) => {
265
283
  const [sessionId, jobId] = segmentsOf(params);
266
284
  return {
267
285
  status: 200,
268
- body: jobOf(services, sessionId, jobId).state
286
+ body: jobOf(services, sessionId, jobId, request.subject).state
269
287
  };
270
288
  },
271
289
  'GET /compute/sessions/{}/jobs/{}/log/content': async ({ services, params, request }) => {
272
290
  const [sessionId, jobId] = segmentsOf(params);
273
- const job = jobOf(services, sessionId, jobId);
291
+ const job = jobOf(services, sessionId, jobId, request.subject);
274
292
  const start = Number(request.query?.start ?? 0) || 0;
275
293
  const limit = Number(request.query?.limit ?? 0) || 0;
276
294
  const lines = job.log.slice(start, limit ? start + limit : undefined);
@@ -56,6 +56,9 @@ exports.findViyaOperation = findViyaOperation;
56
56
  *
57
57
  * `request` is the same shape the SASjs dispatch takes, so a host that already
58
58
  * resolves a caller - a session cookie - passes `subject` rather than a token.
59
+ * For compute sessions a host with credentials must pass the authenticated
60
+ * subject on every request: a token alone is refused. No subject and no token
61
+ * is the anonymous browser mock, not an authentication boundary.
59
62
  */
60
63
  const dispatchViya = async (services, method, path, request = {}) => {
61
64
  const headers = (0, version_js_1.emulatedHeaders)();
@@ -98,6 +101,13 @@ const dispatchViya = async (services, method, path, request = {}) => {
98
101
  }
99
102
  };
100
103
  try {
104
+ // A host must resolve credentials before compute dispatch. A missing subject
105
+ // is the anonymous mock only when no credential was supplied.
106
+ if (request.subject === undefined &&
107
+ request.token !== undefined &&
108
+ (found.operation.id === 'POST /compute/contexts/{}/sessions' ||
109
+ found.operation.path.startsWith('/compute/sessions/')))
110
+ throw new types_js_1.ApiError(401, 'A valid caller is required.');
101
111
  const answer = await handler({
102
112
  services,
103
113
  request,
@@ -8,18 +8,27 @@
8
8
  * true after the next one, and a fixture committed today must match the answer
9
9
  * tomorrow.
10
10
  *
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, 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.
11
+ * The seed is therefore what the estate's *generated data* draws from, and the
12
+ * identity of an estate is the address clients already use to reach it,
13
+ * normalised so that one estate spelled two ways is one string. There is no
14
+ * override: an address that differs is a different estate with different data,
15
+ * by design. Anything that reads this data - a fixture, a screenshot, a test -
16
+ * has to work whatever the address is, because the address is all the identity
17
+ * there is.
18
+ *
19
+ * The seed is a 32-bit digest of that address, which is wide enough to vary the
20
+ * generated numbers and narrow enough that two distinct addresses collide on it
21
+ * - by birthday, roughly one pair per few-billion addresses, and a search finds
22
+ * one in minutes. A collision makes two estates answer with the same numbers,
23
+ * which is cosmetic; anything that *stores* state per estate - the live session
24
+ * registry - must therefore key by the full address, never by the seed, and
25
+ * `estateKeyOf` is that key.
17
26
  *
18
27
  * An emulator with no address has not said which estate it is, so every such
19
28
  * estate shares one seed. That is the only honest default.
20
29
  */
21
30
  Object.defineProperty(exports, "__esModule", { value: true });
22
- exports.drawFrom = exports.drawInt = exports.generator = exports.seedOf = exports.hash = exports.normaliseServerUrl = exports.DEFAULT_SEED = void 0;
31
+ exports.drawFrom = exports.drawInt = exports.generator = exports.estateKeyOf = exports.seedOf = exports.hash = exports.normaliseServerUrl = exports.DEFAULT_SEED = void 0;
23
32
  /** The seed every emulated estate falls back to. */
24
33
  exports.DEFAULT_SEED = 'emulated';
25
34
  /**
@@ -83,13 +92,30 @@ exports.hash = hash;
83
92
  * The number that makes this estate's generated data reproducible.
84
93
  *
85
94
  * The address is the only input: the same estate answers the same way every time,
86
- * and a different address is a different estate.
95
+ * and a different address is a different estate. A 32-bit digest, so it varies
96
+ * the numbers - it is not the estate's identity for anything that stores state
97
+ * (see `estateKeyOf`).
87
98
  */
88
99
  const seedOf = (settings = {}) => {
89
100
  const address = (0, exports.normaliseServerUrl)(settings.serverUrl);
90
101
  return (0, exports.hash)(`url:${address || exports.DEFAULT_SEED}`);
91
102
  };
92
103
  exports.seedOf = seedOf;
104
+ /**
105
+ * The key a per-estate store is held under: the full normalised address.
106
+ *
107
+ * The seed is a 32-bit digest of this key, and two distinct addresses collide
108
+ * on it - a pair exists for any such digest, and a search finds one in
109
+ * minutes. A registry keyed by the seed would then hand two addresses one
110
+ * shared store, so state is keyed by the address itself: distinct addresses
111
+ * are distinct stores even when their seeds are one number, and two spellings
112
+ * of one address (which normalise to one string) remain one store.
113
+ */
114
+ const estateKeyOf = (settings = {}) => {
115
+ const address = (0, exports.normaliseServerUrl)(settings.serverUrl);
116
+ return address || exports.DEFAULT_SEED;
117
+ };
118
+ exports.estateKeyOf = estateKeyOf;
93
119
  /**
94
120
  * A uniform generator over one seed (mulberry32).
95
121
  *
@@ -43,6 +43,10 @@ const folderBody = async (drive, path, caller) => {
43
43
  modifiedTimeStamp: ids_js_1.EMULATED_NOW,
44
44
  memberCount: listing.files.length + listing.folders.length,
45
45
  parentFolderUri: `/folders/folders/${(0, ids_js_1.idFor)(parent)}`,
46
+ // the capture's folder shape carries `properties`, and this body is the one a
47
+ // real folder is read through: answering only the recycle bin with it left a
48
+ // client reading `folder.properties` against nothing
49
+ properties: { allowMove: 'true' },
46
50
  links: linksFor(`/folders/folders/${id}`)
47
51
  };
48
52
  };
@@ -128,20 +132,60 @@ exports.VIYA_HANDLERS = {
128
132
  }
129
133
  };
130
134
  },
131
- 'GET /types/types': async () => ({
132
- status: 200,
133
- body: {
134
- count: 1,
135
- items: [
135
+ 'GET /types/types': async ({ request }) => {
136
+ const limit = Number(request.query?.limit ?? 0) || 0;
137
+ // the estate answers a collection envelope, not a bare list: a client reads
138
+ // `accept`, `start` and `version` off this answer, and a body carrying only
139
+ // `count` and `items` is a shape the capture does not have
140
+ const item = {
141
+ name: 'file',
142
+ label: 'File',
143
+ description: 'A file type',
144
+ mediaType: 'application/octet-stream',
145
+ resourceUri: '/types/types/file',
146
+ iconUri: '/types/types/file/icon',
147
+ tags: ['file'],
148
+ version: 1,
149
+ links: [
136
150
  {
137
- name: 'file',
138
- type: 'typeDef',
139
- version: 1,
140
- links: [{ href: '/types/types/file', rel: 'self', method: 'GET' }]
151
+ href: '/types/types/file',
152
+ uri: '/types/types/file',
153
+ rel: 'self',
154
+ method: 'GET',
155
+ type: 'application/vnd.sas.type.definition'
141
156
  }
142
157
  ]
143
- }
144
- }),
158
+ };
159
+ return {
160
+ status: 200,
161
+ body: {
162
+ accept: 'application/json',
163
+ name: 'types',
164
+ start: 0,
165
+ limit,
166
+ count: 1,
167
+ version: 2,
168
+ items: [item],
169
+ links: [
170
+ {
171
+ href: '/types/types',
172
+ uri: '/types/types',
173
+ rel: 'collection',
174
+ method: 'GET',
175
+ type: 'application/vnd.sas.collection',
176
+ itemType: 'typeDef'
177
+ },
178
+ {
179
+ href: '/types/types',
180
+ uri: '/types/types',
181
+ rel: 'self',
182
+ method: 'GET',
183
+ type: 'application/vnd.sas.collection'
184
+ }
185
+ ]
186
+ }
187
+ };
188
+ },
145
189
  'GET /folders/folders/@item': async ({ services, request }) => ({
146
190
  status: 200,
147
191
  body: await folderBody((0, ports_js_1.requireDrive)(services), pathFromQuery(request), (0, ids_js_1.callerId)(request.subject))
@@ -16,6 +16,7 @@ exports.estateFor = exports.EmulatedEstate = exports.logFor = void 0;
16
16
  * that parses for NOTEs still gets a well-formed log, and a person reading it is
17
17
  * not misled about what ran.
18
18
  */
19
+ const uuid_js_1 = require("../uuid.js");
19
20
  const seed_js_1 = require("./seed.js");
20
21
  /**
21
22
  * The generated log for one program.
@@ -52,19 +53,24 @@ exports.logFor = logFor;
52
53
  /**
53
54
  * The sessions one estate holds.
54
55
  *
55
- * Keyed by seed, so two emulated estates in one process - a test that runs two
56
- * targets - do not share a session namespace.
56
+ * Keyed by the estate's key - the full normalised address, not the seed it
57
+ * digests to - so two emulated estates in one process (a test that runs two
58
+ * targets, or two addresses whose 32-bit seeds collide) do not share a session
59
+ * namespace. See `estateKeyOf`.
57
60
  */
58
61
  class EmulatedEstate {
59
62
  constructor(seed) {
60
63
  this.seed = seed;
61
64
  this.sessions = new Map();
62
- this.created = 0;
63
65
  }
64
- /** A new session: deterministic id, no jobs. */
65
- create() {
66
+ /** A new session: opaque UUID v4, no jobs. */
67
+ create(owner) {
68
+ const id = (0, uuid_js_1.newUuidV4)();
69
+ if (this.sessions.has(id))
70
+ throw new Error('Duplicate compute session ID.');
66
71
  const session = {
67
- id: `emulated-${this.seed.toString(16)}-ses${String(this.created++).padStart(4, '0')}`,
72
+ id,
73
+ owner,
68
74
  createdAt: new Date().toISOString(),
69
75
  jobs: new Map(),
70
76
  submitted: 0
@@ -102,14 +108,22 @@ class EmulatedEstate {
102
108
  }
103
109
  }
104
110
  exports.EmulatedEstate = EmulatedEstate;
105
- /** One estate per seed, for the life of the process. */
111
+ /** One estate per address, for the life of the process. */
106
112
  const estates = new Map();
107
- const estateFor = (seed) => {
108
- const existing = estates.get(seed);
113
+ /**
114
+ * The estate one address holds, minting it on first use.
115
+ *
116
+ * Keyed by the estate's key - the full normalised address - never by the seed:
117
+ * the seed is a 32-bit digest of the address, two distinct addresses collide on
118
+ * it, and a collision must not give them one shared session store. The estate
119
+ * still uses the seed for its generated logs.
120
+ */
121
+ const estateFor = (key, seed) => {
122
+ const existing = estates.get(key);
109
123
  if (existing)
110
124
  return existing;
111
125
  const estate = new EmulatedEstate(seed);
112
- estates.set(seed, estate);
126
+ estates.set(key, estate);
113
127
  return estate;
114
128
  };
115
129
  exports.estateFor = estateFor;
@@ -13,15 +13,7 @@
13
13
  * is the key: what the registry, the routes and the permission rules point at.
14
14
  */
15
15
  export declare const normaliseAppLoc: (appLoc: string) => string;
16
- /**
17
- * A new id: a version 4 UUID.
18
- *
19
- * `crypto.randomUUID` exists in Node and in a browser worker on https or localhost,
20
- * which is where the mock drive runs. The fallback builds the same thing from
21
- * `getRandomValues` rather than from `Math.random`, so a weaker environment does not
22
- * quietly produce a weaker id.
23
- */
24
- export declare const newAppId: () => string;
16
+ export { newUuidV4 as newAppId } from '../uuid.js';
25
17
  /** Whether a string is a well-formed id: a version 4 UUID. */
26
18
  export declare const isAppId: (value: unknown) => value is string;
27
19
  //# sourceMappingURL=identity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/appstream/identity.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAgBhD,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,QAAO,MAkC3B,CAAA;AAOD,8DAA8D;AAC9D,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MACD,CAAA"}
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/appstream/identity.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAgBhD,CAAA;AAED,OAAO,EAAE,SAAS,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAA;AAOlD,8DAA8D;AAC9D,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MACD,CAAA"}
@@ -26,36 +26,7 @@ export const normaliseAppLoc = (appLoc) => {
26
26
  throw new ApiError(400, 'appLoc cannot be outside drive.');
27
27
  return normalised;
28
28
  };
29
- /**
30
- * A new id: a version 4 UUID.
31
- *
32
- * `crypto.randomUUID` exists in Node and in a browser worker on https or localhost,
33
- * which is where the mock drive runs. The fallback builds the same thing from
34
- * `getRandomValues` rather than from `Math.random`, so a weaker environment does not
35
- * quietly produce a weaker id.
36
- */
37
- export const newAppId = () => {
38
- const webCrypto = globalThis.crypto;
39
- if (typeof webCrypto?.randomUUID === 'function')
40
- return webCrypto.randomUUID();
41
- if (typeof webCrypto?.getRandomValues !== 'function')
42
- throw new Error('No cryptographic source of randomness is available.');
43
- const bytes = new Uint8Array(16);
44
- webCrypto.getRandomValues(bytes);
45
- // version 4, variant 10xx
46
- bytes[6] = (bytes[6] & 0x0f) | 0x40;
47
- bytes[8] = (bytes[8] & 0x3f) | 0x80;
48
- const hex = Array.from(bytes)
49
- .map((byte) => byte.toString(16).padStart(2, '0'))
50
- .join('');
51
- return [
52
- hex.slice(0, 8),
53
- hex.slice(8, 12),
54
- hex.slice(12, 16),
55
- hex.slice(16, 20),
56
- hex.slice(20)
57
- ].join('-');
58
- };
29
+ export { newUuidV4 as newAppId } from '../uuid.js';
59
30
  // no `i` flag: `newAppId` mints lower case and every lookup compares exactly, so
60
31
  // a guard that accepts upper case would vouch for an id no lookup can find
61
32
  const APP_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Replaying the Viya corpus against a host.
3
+ *
4
+ * The corpus (`VIYA_CORPUS`) is what the estate answered, as data, and both hosts
5
+ * answer it: the package through its dispatcher and a server over HTTP, and a
6
+ * browser host through its service worker. Keeping the replay here is what makes
7
+ * that one implementation: a host supplies the ids its own answers handed out and
8
+ * the values its own drive can use, and the corpus supplies everything else.
9
+ *
10
+ * What the corpus does NOT carry is the request: it records the answer's shape and
11
+ * the names of the queries the client sent, because those are the contract. A
12
+ * write's body is the caller's data, so a replay of a write is only as honest as
13
+ * the host's own fixture - which is why `requestFor` reports a hole it cannot fill
14
+ * instead of inventing one.
15
+ */
16
+ import type { ViyaCase } from './operations.js';
17
+ /**
18
+ * The identifiers a replay has collected, named by the segment they follow.
19
+ *
20
+ * `/compute/sessions/{}/jobs/{}` reads `sessions` then `jobs`, so the ids are
21
+ * keyed that way rather than by position: a corpus case added later slots in
22
+ * without the keys moving.
23
+ */
24
+ export type ViyaReplayState = Record<string, string | undefined>;
25
+ export interface ViyaReplayRequest {
26
+ method: string;
27
+ /** The path with every hole this replay could fill replaced. */
28
+ path: string;
29
+ /** Holes the state has no id for, as `segment` names - a request not yet answerable. */
30
+ unresolved: string[];
31
+ /** Query names the case records that the caller supplied no value for. */
32
+ omittedQueries: string[];
33
+ }
34
+ /**
35
+ * The request a captured case stands for, with `{}` filled from the ids a replay
36
+ * has collected so far.
37
+ *
38
+ * A hole takes the id named by the segment before it (`/folders/folders/{}` is a
39
+ * folder). A hole the state cannot fill is reported, not guessed: a path built
40
+ * from a placeholder would answer a 404 that says nothing about the contract.
41
+ */
42
+ export declare const requestFor: (viyaCase: ViyaCase, state?: ViyaReplayState, queryValues?: Record<string, string>) => ViyaReplayRequest;
43
+ /**
44
+ * Every place a captured shape and a body disagree, as readable strings.
45
+ *
46
+ * A shape's leaves are type names, so the comparison is on `typeof`; `'object'` is
47
+ * the depth cap and means "an object, contents not recorded". Unlike an
48
+ * assertion, this collects, so a host can report all the drift in one run instead
49
+ * of stopping at the first key - and a body with an element shows its element's
50
+ * shape, because an empty array proves nothing about it.
51
+ */
52
+ export declare const shapeMismatches: (shape: unknown, body: unknown, where?: string) => string[];
53
+ //# sourceMappingURL=replay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../../../src/corpus/viya/replay.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAE/C;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;AAahE,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAA;IACZ,wFAAwF;IACxF,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,0EAA0E;IAC1E,cAAc,EAAE,MAAM,EAAE,CAAA;CACzB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,GACrB,UAAU,QAAQ,EAClB,QAAO,eAAoB,EAC3B,cAAa,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,KACvC,iBAaF,CAAA;AAkDD;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,OAAO,EACd,MAAM,OAAO,EACb,cAAc,KACb,MAAM,EAmDR,CAAA"}
@@ -0,0 +1,112 @@
1
+ /** The segment a hole sits in, which is what names the id it takes. */
2
+ const KEY_BY_SEGMENT = {
3
+ contexts: 'context',
4
+ sessions: 'session',
5
+ jobs: 'job',
6
+ folders: 'folder',
7
+ files: 'file',
8
+ definitions: 'definition',
9
+ variables: 'variable'
10
+ };
11
+ /**
12
+ * The request a captured case stands for, with `{}` filled from the ids a replay
13
+ * has collected so far.
14
+ *
15
+ * A hole takes the id named by the segment before it (`/folders/folders/{}` is a
16
+ * folder). A hole the state cannot fill is reported, not guessed: a path built
17
+ * from a placeholder would answer a 404 that says nothing about the contract.
18
+ */
19
+ export const requestFor = (viyaCase, state = {}, queryValues = {}) => {
20
+ const [method, template] = viyaCase.route.split(' ');
21
+ const unresolved = [];
22
+ return build(method, template.split('/'), viyaCase, state, queryValues, unresolved);
23
+ };
24
+ /** Segments back into the path, filling each hole from the state. */
25
+ const build = (method, segments, viyaCase, state, queryValues, unresolved) => {
26
+ let previousSegment = '';
27
+ const filled = segments.map((segment) => {
28
+ if (segment !== '{}') {
29
+ previousSegment = segment;
30
+ return segment;
31
+ }
32
+ const key = KEY_BY_SEGMENT[previousSegment] ?? previousSegment;
33
+ const id = state[key];
34
+ if (id === undefined) {
35
+ unresolved.push(key);
36
+ return '{}';
37
+ }
38
+ return id;
39
+ });
40
+ let path = filled.join('/');
41
+ const omittedQueries = [];
42
+ const params = [];
43
+ // encoded by hand rather than with `URLSearchParams`: this module is compiled
44
+ // for the browser host as well as for node, and the package's build does not
45
+ // carry the DOM types that class needs
46
+ for (const name of viyaCase.queries) {
47
+ const value = queryValues[name];
48
+ if (value === undefined)
49
+ omittedQueries.push(name);
50
+ else
51
+ params.push(`${encodeURIComponent(name)}=${encodeURIComponent(value)}`);
52
+ }
53
+ if (params.length)
54
+ path += (path.includes('?') ? '&' : '?') + params.join('&');
55
+ return { method, path, unresolved, omittedQueries };
56
+ };
57
+ /**
58
+ * Every place a captured shape and a body disagree, as readable strings.
59
+ *
60
+ * A shape's leaves are type names, so the comparison is on `typeof`; `'object'` is
61
+ * the depth cap and means "an object, contents not recorded". Unlike an
62
+ * assertion, this collects, so a host can report all the drift in one run instead
63
+ * of stopping at the first key - and a body with an element shows its element's
64
+ * shape, because an empty array proves nothing about it.
65
+ */
66
+ export const shapeMismatches = (shape, body, where = 'body') => {
67
+ if (shape === 'object')
68
+ return isRecord(body)
69
+ ? []
70
+ : [`${where}: expected an object, got ${typeName(body)}`];
71
+ // `array` is a leaf the corpus really records (`properties: 'array'` on a job
72
+ // definition), and `typeof` never yields it: an array is `object`. Without this
73
+ // branch the comparison could never pass, and the message it produced -
74
+ // "expected array, got array" - contradicted itself
75
+ if (shape === 'array')
76
+ return Array.isArray(body)
77
+ ? []
78
+ : [`${where}: expected an array, got ${typeName(body)}`];
79
+ if (Array.isArray(shape)) {
80
+ if (!Array.isArray(body))
81
+ return [`${where}: expected an array, got ${typeName(body)}`];
82
+ const first = body[0];
83
+ // Neither side can say anything when the shape is empty: an empty answer
84
+ // cannot demonstrate its element's shape, and an element shape the capture
85
+ // recorded as `[]` is the absence of one. Comparing a real element against
86
+ // `undefined` invents a drift - "expected undefined, got object" - that no
87
+ // host could act on.
88
+ return first === undefined || shape.length === 0
89
+ ? []
90
+ : shapeMismatches(shape[0], first, `${where}[0]`);
91
+ }
92
+ if (shape && typeof shape === 'object') {
93
+ if (!isRecord(body))
94
+ return [`${where}: expected an object, got ${typeName(body)}`];
95
+ const record = body;
96
+ return Object.keys(shape).flatMap((key) => key in record
97
+ ? shapeMismatches(shape[key], record[key], `${where}.${key}`)
98
+ : [`${where}.${key}: missing from the answer`]);
99
+ }
100
+ return typeof body === String(shape)
101
+ ? []
102
+ : [`${where}: expected ${String(shape)}, got ${typeName(body)}`];
103
+ };
104
+ const typeName = (value) => value === null ? 'null' : Array.isArray(value) ? 'array' : typeof value;
105
+ /**
106
+ * An object with named fields, which is what every captured shape describes.
107
+ *
108
+ * An array is `typeof object` in JavaScript, so a body of `[]` would otherwise be
109
+ * compared as an object with no keys and reported as "missing every field" rather
110
+ * than as the array it is.
111
+ */
112
+ const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
@@ -11,6 +11,8 @@
11
11
  export interface Subject {
12
12
  userId: string;
13
13
  clientId: string;
14
+ /** Immutable account ID from the trusted host, for Viya compute ownership. */
15
+ ownerId?: string;
14
16
  }
15
17
  export interface IdentityUser {
16
18
  uid: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/identity/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,iFAAiF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AC,EAAE,MAAM,CAAA;CACtB;AAED,qEAAqE;AACrE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;CACf"}
@@ -40,6 +40,8 @@ export type { ViyaOverlayEntry } from './viya/overlay.js';
40
40
  export { VIYA_HANDLERS } from './viya/service.js';
41
41
  export { VIYA_CORPUS } from './corpus/viya/operations.js';
42
42
  export type { ViyaCase } from './corpus/viya/operations.js';
43
+ export { requestFor, shapeMismatches } from './corpus/viya/replay.js';
44
+ export type { ViyaReplayRequest, ViyaReplayState } from './corpus/viya/replay.js';
43
45
  export { dispatch, HANDLED_ROUTES } from './host/dispatch.js';
44
46
  export * from './identity/routeAccess.js';
45
47
  export type { ApiRequest, ApiResponse, Services } from './host/dispatch.js';