@sasjs/api 0.49.1 → 0.50.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.
@@ -1 +1 @@
1
- {"version":3,"file":"compute.d.ts","sourceRoot":"","sources":["../../../src/viya/compute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAMnD;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,sCAAsC,CAAA;AAEvE,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,QAAuC,CAAA;AAgDvE;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,GAAG,SAAS,KAAG,MAM5D,CAAA;AAyID,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,MAAM,EACN,CAAC,OAAO,EAAE;IACR,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;QAC1C,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,OAAO,CAAC,EAAE,OAAO,CAAA;KAClB,CAAA;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B,KAAK,OAAO,CAAC,WAAW,CAAC,CAiN3B,CAAA"}
1
+ {"version":3,"file":"compute.d.ts","sourceRoot":"","sources":["../../../src/viya/compute.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAMnD;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,sCAAsC,CAAA;AAEvE,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,QAAuC,CAAA;AAgDvE;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,GAAG,SAAS,KAAG,MAM5D,CAAA;AAmKD,eAAO,MAAM,gBAAgB,EAAE,MAAM,CACnC,MAAM,EACN,CAAC,OAAO,EAAE;IACR,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;QAC1C,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,OAAO,CAAC,EAAE,OAAO,CAAA;KAClB,CAAA;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B,KAAK,OAAO,CAAC,WAAW,CAAC,CA8N3B,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { ApiError } from '../types.js';
2
2
  import { estateKeyOf, normaliseServerUrl, seedOf } from './seed.js';
3
3
  import { estateFor } from './sessions.js';
4
- import { idFor, callerId } from './ids.js';
4
+ import { idFor, callerId, EMULATED_NOW } from './ids.js';
5
5
  /**
6
6
  * The name the emulator answers when a client asks for no particular context.
7
7
  *
@@ -72,6 +72,31 @@ const contextBody = (name, caller) => ({
72
72
  version: 2,
73
73
  links: linksFor(`/compute/contexts/${EMULATED_CONTEXT_ID}`, 'application/vnd.sas.compute.context')
74
74
  });
75
+ /**
76
+ * The context in full, for the read a client makes of one it already holds.
77
+ *
78
+ * The list view Viya answers is deliberately minimal, so a client that needs a
79
+ * context's attributes reads the context itself - Data Controller's deploy
80
+ * screen fetches each one to pick up its batch identity. The attributes are the
81
+ * ones an emulated estate truthfully has: nothing runs as a batch identity here,
82
+ * and `reuseServerProcesses` is `false` for the same reason, which is what leaves
83
+ * a client's batch-id list empty rather than inventing an account to run as.
84
+ */
85
+ const contextDetailsBody = (caller) => ({
86
+ ...contextBody(DEFAULT_CONTEXT_NAME, caller),
87
+ description: 'The compute context an emulated estate answers for',
88
+ creationTimeStamp: EMULATED_NOW,
89
+ modifiedTimeStamp: EMULATED_NOW,
90
+ modifiedBy: caller,
91
+ launchType: 'service',
92
+ launchContext: { contextId: EMULATED_CONTEXT_ID },
93
+ environment: { autoExecLines: [] },
94
+ attributes: {
95
+ reuseServerProcesses: 'false',
96
+ allowXCMD: 'false',
97
+ serverMinAvailable: '1'
98
+ }
99
+ });
75
100
  const sessionBody = (services, session, autoExecLines, caller) => {
76
101
  const { id } = session;
77
102
  const uri = `/compute/sessions/${id}`;
@@ -187,6 +212,14 @@ export const COMPUTE_HANDLERS = {
187
212
  }
188
213
  };
189
214
  },
215
+ 'GET /compute/contexts/{}': async ({ request, params }) => {
216
+ // the estate has one context and its id does not move, so an id it is not is
217
+ // an id no context here ever had - the same refusal the drive makes for an
218
+ // unknown folder rather than a body about some other context
219
+ if (params.id !== EMULATED_CONTEXT_ID)
220
+ throw new ApiError(404, `No compute context matches the id ${params.id}. The emulated estate answers one context, and this is not its id.`);
221
+ return { status: 200, body: contextDetailsBody(callerId(request.subject)) };
222
+ },
190
223
  'POST /compute/contexts/{}/sessions': async ({ services, params, request }) => {
191
224
  if (params.id !== EMULATED_CONTEXT_ID)
192
225
  throw new ApiError(404, `Context with ID '${params.id}' was not found.`);
@@ -1 +1 @@
1
- {"version":3,"file":"declared.d.ts","sourceRoot":"","sources":["../../../src/viya/declared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;AAE3D,wDAAwD;AACxD,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,eAAO,MAAM,QAAQ,EAAE,iBAAiB,EAiBvC,CAAA;AAED,mFAAmF;AACnF,eAAO,MAAM,eAAe,EAAE,aAAa,EAAiC,CAAA"}
1
+ {"version":3,"file":"declared.d.ts","sourceRoot":"","sources":["../../../src/viya/declared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;AAE3D,wDAAwD;AACxD,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,qEAAqE;IACrE,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,eAAO,MAAM,QAAQ,EAAE,iBAAiB,EA0HvC,CAAA;AAED,mFAAmF;AACnF,eAAO,MAAM,eAAe,EAAE,aAAa,EAAiC,CAAA"}
@@ -29,6 +29,102 @@ export const DECLARED = [
29
29
  // there is no JSON shape to record
30
30
  shape: undefined,
31
31
  declared: 'The adapter fetches this only when a run expects a webout (`expectWebout`), and the recording pass submits a `%put` and reads the log instead. Without it an application cannot receive the data its service returns, so the emulator answers it from the job it just ran.'
32
+ },
33
+ // The application's own identity reads. No capture describes these at all: the
34
+ // recorder drives the client the adapter is, and Data Controller's group, user
35
+ // and deploy screens call the identity service from the browser instead. That
36
+ // is why they are declared rather than recorded, and why the scope they belong
37
+ // to is stated in `src/viya/appSurface.ts`.
38
+ {
39
+ id: 'GET /identities/groups',
40
+ method: 'GET',
41
+ path: '/identities/groups',
42
+ steps: [],
43
+ statuses: [200],
44
+ queries: ['sortBy', 'limit', 'start'],
45
+ request: { queries: ['sortBy', 'limit', 'start'], body: undefined },
46
+ // a collection of groups, whose own shape Viya publishes rather than an
47
+ // estate recording supplying it
48
+ shape: undefined,
49
+ declared: 'The application fetches the group list twice on its deploy screen - for the admin-group dropdown and, filtered, for the caller own groups - and aborts the wizard when that read fails. The adapter never calls it, so no recording pass reaches it.'
50
+ },
51
+ {
52
+ id: 'GET /identities/groups/{}/members',
53
+ method: 'GET',
54
+ path: '/identities/groups/{}/members',
55
+ steps: [],
56
+ statuses: [200, 404],
57
+ queries: ['limit'],
58
+ request: { queries: ['limit'], body: undefined },
59
+ shape: undefined,
60
+ declared: 'The group screen lists the accounts that hold a group, following the members link the group list advertises. The adapter has no identity route beyond the caller, so a capture driven by it cannot reach this one.'
61
+ },
62
+ {
63
+ id: 'GET /identities/users',
64
+ method: 'GET',
65
+ path: '/identities/users',
66
+ steps: [],
67
+ statuses: [200],
68
+ queries: ['limit', 'start'],
69
+ request: { queries: ['limit', 'start'], body: undefined },
70
+ shape: undefined,
71
+ declared: 'The user screen lists the estate accounts. The adapter does not offer an account list and never requests one, so the recording pass has no way to observe it.'
72
+ },
73
+ {
74
+ id: 'GET /identities/users/{}',
75
+ method: 'GET',
76
+ path: '/identities/users/{}',
77
+ steps: [],
78
+ statuses: [200, 404],
79
+ queries: [],
80
+ request: { queries: [], body: undefined },
81
+ shape: undefined,
82
+ declared: 'The user screen reads one account from the id the list returned, for the profile above the memberships. The adapter asks only about the caller, which is a different operation with its own row.'
83
+ },
84
+ {
85
+ id: 'GET /identities/users/@currentUser/memberships',
86
+ method: 'GET',
87
+ path: '/identities/users/@currentUser/memberships',
88
+ steps: [],
89
+ statuses: [200],
90
+ queries: ['limit', 'start'],
91
+ request: { queries: ['limit', 'start'], body: undefined },
92
+ shape: undefined,
93
+ declared: 'The deploy screen filters the admin-group list to the groups the caller belongs to, and shows every group when this read fails. The adapter reads the caller itself but never the caller memberships.'
94
+ },
95
+ {
96
+ id: 'GET /identities/users/{}/memberships',
97
+ method: 'GET',
98
+ path: '/identities/users/{}/memberships',
99
+ steps: [],
100
+ statuses: [200, 401],
101
+ queries: ['limit', 'start'],
102
+ request: { queries: ['limit', 'start'], body: undefined },
103
+ shape: undefined,
104
+ declared: 'The user screen lists the groups any account holds, addressed by the id the list returned. It is the same answer as the caller own memberships for one id, and the adapter asks for neither.'
105
+ },
106
+ {
107
+ id: 'GET /identities/users/{}/avatar/content',
108
+ method: 'GET',
109
+ path: '/identities/users/{}/avatar/content',
110
+ steps: [],
111
+ statuses: [404],
112
+ queries: [],
113
+ request: { queries: [], body: undefined },
114
+ // the body is an image when an estate holds one: there is no JSON shape
115
+ shape: undefined,
116
+ declared: 'The header renders the caller avatar from this URL, and an estate whose identity carries no avatar answers 404 so the client falls back to its own image. The adapter has no avatar read.'
117
+ },
118
+ {
119
+ id: 'GET /compute/contexts/{}',
120
+ method: 'GET',
121
+ path: '/compute/contexts/{}',
122
+ steps: [],
123
+ statuses: [200, 404],
124
+ queries: [],
125
+ request: { queries: [], body: undefined },
126
+ shape: undefined,
127
+ declared: 'The deploy screen reads each context in full, because the list view carries neither the batch identity nor the reuse setting it filters on. The capture recorded the list only, so the read it follows with is stated here.'
32
128
  }
33
129
  ];
34
130
  /** Every operation the emulator answers: what an estate did, plus what it must. */
@@ -0,0 +1,34 @@
1
+ /**
2
+ * The Viya identity answers an application reads for itself.
3
+ *
4
+ * The adapter asks Viya who the caller is and nothing else, so `/identities`
5
+ * used to be one operation here. An application asks more than that: Data
6
+ * Controller's group, user and deploy screens call the identity service
7
+ * directly - `GET /identities/groups` twice on the deploy screen alone - and on
8
+ * an emulated estate those calls answered 404, which is a screen a visitor
9
+ * cannot use. `src/viya/appSurface.ts` is where those calls are declared, and
10
+ * this is where they are answered.
11
+ *
12
+ * The estate has one identity: the store the package already serves the
13
+ * administration routes from. That store is the project's `mock-identity.json`
14
+ * on a mock site and the host's own records on a server, so a group named in the
15
+ * fixture is the group this answers - nothing here invents a population. The
16
+ * port is `RecordService` rather than `IdentityStore` because the administration
17
+ * routes' gates belong with them: a caller with no account gets the same 401
18
+ * here that it gets there.
19
+ */
20
+ import type { ApiResponse, Services } from '../host/dispatch.js';
21
+ import type { Subject } from '../identity/types.js';
22
+ import type { RecordService } from '../identity/records.js';
23
+ /** The port these handlers read, or the capability the host did not supply. */
24
+ export declare const requireRecords: (services: Services) => RecordService;
25
+ export declare const IDENTITY_HANDLERS: Record<string, (context: {
26
+ services: Services;
27
+ request: {
28
+ query?: Record<string, string | undefined>;
29
+ subject?: Subject;
30
+ token?: string;
31
+ };
32
+ params: Record<string, string>;
33
+ }) => Promise<ApiResponse>>;
34
+ //# sourceMappingURL=identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../../src/viya/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEhE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAG3D,+EAA+E;AAC/E,eAAO,MAAM,cAAc,GAAI,UAAU,QAAQ,KAAG,aAQnD,CAAA;AAqID,eAAO,MAAM,iBAAiB,EAAE,MAAM,CACpC,MAAM,EACN,CAAC,OAAO,EAAE;IACR,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;QAC1C,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B,KAAK,OAAO,CAAC,WAAW,CAAC,CAsJ3B,CAAA"}
@@ -0,0 +1,187 @@
1
+ import { ApiError } from '../types.js';
2
+ import { EMULATED_NOW } from './ids.js';
3
+ /** The port these handlers read, or the capability the host did not supply. */
4
+ export const requireRecords = (services) => {
5
+ if (!services.records)
6
+ throw new ApiError(501, 'The emulated identity answers from the records service, which this host does not supply.');
7
+ return services.records;
8
+ };
9
+ /**
10
+ * The caller, from the subject a host resolved or from the token it forwarded.
11
+ *
12
+ * A host that already knows its caller passes `subject`; one that hands the
13
+ * emulator a bearer token (the server's Viya router does) gets the token read
14
+ * here, exactly as `GET /identities/users/@currentUser` reads it. Neither is
15
+ * optional in effect: an unauthenticated caller has no identity to answer about.
16
+ */
17
+ const callerOf = async (services, request) => request.subject ?? (await services.identity?.authenticate(request.token));
18
+ /**
19
+ * The `{}` a membership or avatar read was addressed to, as a uid.
20
+ *
21
+ * `@currentUser` is where Viya puts the caller's own account, and a client asks
22
+ * for it by that spelling. It is resolved here rather than given its own row so
23
+ * the handler has one shape to answer.
24
+ */
25
+ const userIdFrom = (segment, caller) => {
26
+ if (segment.toLowerCase() !== '@currentuser')
27
+ return segment;
28
+ const id = caller?.userId;
29
+ if (!id)
30
+ throw new ApiError(401, 'No caller is signed in.');
31
+ return id;
32
+ };
33
+ /** The paging fields every collection answer carries, as the captured ones do. */
34
+ const collection = (name, items, limit, uri, type) => {
35
+ const page = limit > 0 ? items.slice(0, limit) : items;
36
+ return {
37
+ accept: 'application/json',
38
+ name,
39
+ start: 0,
40
+ // the value asked for is echoed, as the folder answers echo it: a caller
41
+ // that asked for five and is told zero cannot tell what happened
42
+ limit: limit || page.length,
43
+ count: page.length,
44
+ version: 2,
45
+ items: page,
46
+ links: [
47
+ {
48
+ href: uri,
49
+ uri,
50
+ rel: 'self',
51
+ method: 'GET',
52
+ type: 'application/vnd.sas.collection',
53
+ itemType: type
54
+ }
55
+ ]
56
+ };
57
+ };
58
+ const identityLinks = (uri, type) => [
59
+ { href: uri, uri, rel: 'self', method: 'GET', type }
60
+ ];
61
+ const GROUP_TYPE = 'application/vnd.sas.identity.group';
62
+ const USER_TYPE = 'application/vnd.sas.identity.user';
63
+ /** A group as Viya represents one, from the store's record. */
64
+ const groupBody = (group, memberCount) => ({
65
+ id: group.uid,
66
+ name: group.name,
67
+ description: group.description,
68
+ providerId: 'sas',
69
+ state: 'active',
70
+ memberCount,
71
+ creationTimeStamp: EMULATED_NOW,
72
+ modifiedTimeStamp: EMULATED_NOW,
73
+ version: 1,
74
+ links: identityLinks(`/identities/groups/${group.uid}`, GROUP_TYPE)
75
+ });
76
+ /** A user as Viya represents one. */
77
+ const userBody = (user) => ({
78
+ id: user.uid,
79
+ // Viya's `name` is the identifier a person signs in with; the display name is
80
+ // a separate field, and this is the one a member list shows
81
+ name: user.username,
82
+ displayName: user.displayName,
83
+ providerId: 'sas',
84
+ state: 'active',
85
+ version: 1,
86
+ links: identityLinks(`/identities/users/${user.uid}`, USER_TYPE)
87
+ });
88
+ /** The groups a user is a member of, as Viya's memberships route answers them. */
89
+ const membershipsOf = async (records, caller, uid) => {
90
+ const users = await records.listUsers(caller);
91
+ // Viya clients may address a user by login name; prefer an exact uid when a
92
+ // login happens to equal another user's uid.
93
+ const user = users.find((item) => item.uid === uid) ??
94
+ users.find((item) => item.username === uid);
95
+ const resolvedUid = user?.uid ?? uid;
96
+ const groups = await records.listGroups(caller);
97
+ const found = [];
98
+ for (const group of groups) {
99
+ const details = await records.getGroup(caller, { uid: group.uid });
100
+ if (details.users.some((member) => member.uid === resolvedUid))
101
+ found.push(groupBody(group, details.users.length));
102
+ }
103
+ return found;
104
+ };
105
+ export const IDENTITY_HANDLERS = {
106
+ 'GET /identities/groups': async ({ services, request }) => {
107
+ const records = requireRecords(services);
108
+ const caller = await callerOf(services, request);
109
+ const limit = Number(request.query?.limit ?? 0) || 0;
110
+ const sortBy = request.query?.sortBy;
111
+ const groups = await records.listGroups(caller);
112
+ const items = [];
113
+ for (const group of groups) {
114
+ const details = await records.getGroup(caller, { uid: group.uid });
115
+ items.push(groupBody(group, details.users.length));
116
+ }
117
+ // `sortBy=name` is what the application asks for, and the store's order is
118
+ // not one: a screen that lists groups alphabetically asks the service for it
119
+ const ordered = sortBy && sortBy.toLowerCase() === 'name'
120
+ ? [...items].sort((left, right) => left.name.localeCompare(right.name))
121
+ : items;
122
+ return {
123
+ status: 200,
124
+ body: collection('groups', ordered, limit, '/identities/groups', GROUP_TYPE)
125
+ };
126
+ },
127
+ 'GET /identities/groups/{}/members': async ({ services, request, params }) => {
128
+ const records = requireRecords(services);
129
+ const caller = await callerOf(services, request);
130
+ const limit = Number(request.query?.limit ?? 0) || 0;
131
+ const details = await records.getGroup(caller, { uid: params.id });
132
+ const items = details.users.map((user) => userBody(user));
133
+ return {
134
+ status: 200,
135
+ body: collection('members', items, limit, `/identities/groups/${details.uid}/members`, USER_TYPE)
136
+ };
137
+ },
138
+ 'GET /identities/users': async ({ services, request }) => {
139
+ const records = requireRecords(services);
140
+ const caller = await callerOf(services, request);
141
+ const limit = Number(request.query?.limit ?? 0) || 0;
142
+ const users = await records.listUsers(caller);
143
+ return {
144
+ status: 200,
145
+ body: collection('users', users.map((user) => userBody(user)), limit, '/identities/users', USER_TYPE)
146
+ };
147
+ },
148
+ 'GET /identities/users/{}': async ({ services, request, params }) => {
149
+ const records = requireRecords(services);
150
+ const caller = await callerOf(services, request);
151
+ const uid = userIdFrom(params.id, caller);
152
+ const user = await records.getUser(caller, { uid });
153
+ return { status: 200, body: userBody(user) };
154
+ },
155
+ 'GET /identities/users/@currentUser/memberships': async ({ services, request }) => {
156
+ const records = requireRecords(services);
157
+ const caller = await callerOf(services, request);
158
+ const limit = Number(request.query?.limit ?? 0) || 0;
159
+ const uid = userIdFrom('@currentUser', caller);
160
+ const items = await membershipsOf(records, caller, uid);
161
+ return {
162
+ status: 200,
163
+ body: collection('memberships', items, limit, '/identities/users/@currentUser/memberships', GROUP_TYPE)
164
+ };
165
+ },
166
+ 'GET /identities/users/{}/memberships': async ({ services, request, params }) => {
167
+ const records = requireRecords(services);
168
+ const caller = await callerOf(services, request);
169
+ const limit = Number(request.query?.limit ?? 0) || 0;
170
+ const uid = userIdFrom(params.id, caller);
171
+ // the address the client used is the address echoed back, as the other
172
+ // answers do: a client that followed a rel is never told about another one
173
+ const items = await membershipsOf(records, caller, uid);
174
+ return {
175
+ status: 200,
176
+ body: collection('memberships', items, limit, `/identities/users/${params.id}/memberships`, GROUP_TYPE)
177
+ };
178
+ },
179
+ 'GET /identities/users/{}/avatar/content': async ({ services, request, params }) => {
180
+ const caller = await callerOf(services, request);
181
+ const uid = userIdFrom(params.id, caller);
182
+ // the estate's identity carries no avatar, and Viya answers a 404 for an
183
+ // account that has none - so a client's fallback image is what a real
184
+ // estate with none would show it
185
+ throw new ApiError(404, `No avatar is recorded for the user ${uid}.`);
186
+ }
187
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../src/viya/overlay.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,OAAO,CAAA;IACpB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAuBD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAgEzD,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,GAC/B,SAAS,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,EACzC,aAAY,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAmB,KAClD,IAcF,CAAA"}
1
+ {"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../../../src/viya/overlay.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,OAAO,CAAA;IACpB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAuBD,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CA4EzD,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB,GAC/B,SAAS,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,EACzC,aAAY,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAmB,KAClD,IAcF,CAAA"}
@@ -38,9 +38,19 @@ export const VIYA_OVERLAY = {
38
38
  'GET /folders/folders/@item': { implemented: true },
39
39
  'GET /folders/folders/@myRecycleBin': { implemented: true },
40
40
  'GET /identities/users/@currentUser': { implemented: true },
41
+ // answered here: the application's own identity reads, declared rather than
42
+ // captured - see src/viya/appSurface.ts for the scope they belong to
43
+ 'GET /identities/groups': { implemented: true },
44
+ 'GET /identities/groups/{}/members': { implemented: true },
45
+ 'GET /identities/users': { implemented: true },
46
+ 'GET /identities/users/{}': { implemented: true },
47
+ 'GET /identities/users/@currentUser/memberships': { implemented: true },
48
+ 'GET /identities/users/{}/memberships': { implemented: true },
49
+ 'GET /identities/users/{}/avatar/content': { implemented: true },
41
50
  'GET /types/types': { implemented: true },
42
51
  // answered here: compute
43
52
  'GET /compute/contexts': { implemented: true },
53
+ 'GET /compute/contexts/{}': { implemented: true },
44
54
  'POST /compute/contexts/{}/sessions': { implemented: true },
45
55
  'DELETE /compute/sessions/{}': { implemented: true },
46
56
  'POST /compute/sessions/{}/jobs': { implemented: true },
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/viya/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAiJnD,gEAAgE;AAChE,eAAO,MAAM,aAAa,EAAE,MAAM,CAChC,MAAM,EACN,CAAC,OAAO,EAAE;IACR,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;QAC1C,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,OAAO,CAAC,EAAE,OAAO,CAAA;KAClB,CAAA;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B,KAAK,OAAO,CAAC,WAAW,CAAC,CAkS3B,CAAA"}
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/viya/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAkJnD,gEAAgE;AAChE,eAAO,MAAM,aAAa,EAAE,MAAM,CAChC,MAAM,EACN,CAAC,OAAO,EAAE;IACR,QAAQ,EAAE,QAAQ,CAAA;IAClB,OAAO,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;QAC1C,IAAI,CAAC,EAAE,OAAO,CAAA;QACd,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,OAAO,CAAC,EAAE,OAAO,CAAA;KAClB,CAAA;IACD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B,KAAK,OAAO,CAAC,WAAW,CAAC,CAoS3B,CAAA"}
@@ -2,6 +2,7 @@ import { ApiError } from '../types.js';
2
2
  import { requireDrive } from './ports.js';
3
3
  import { COMPUTE_HANDLERS } from './compute.js';
4
4
  import { FILE_HANDLERS } from './files.js';
5
+ import { IDENTITY_HANDLERS } from './identity.js';
5
6
  import { idFor, normalisePath, EMULATED_NOW, EMULATED_USER, callerId } from './ids.js';
6
7
  const linksFor = (uri, collection = false) => {
7
8
  const self = {
@@ -336,5 +337,6 @@ export const VIYA_HANDLERS = {
336
337
  };
337
338
  },
338
339
  ...COMPUTE_HANDLERS,
339
- ...FILE_HANDLERS
340
+ ...FILE_HANDLERS,
341
+ ...IDENTITY_HANDLERS
340
342
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sasjs/api",
3
- "version": "0.49.1",
3
+ "version": "0.50.0",
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",
@@ -45,6 +45,8 @@
45
45
  "check:routes": "node scripts/sync-routes.mjs --check",
46
46
  "sync:scope": "node scripts/viya-scope.mjs",
47
47
  "check:scope": "node scripts/viya-scope.mjs --check",
48
+ "sync:app-scope": "node scripts/viya-app-scope.mjs",
49
+ "check:app-scope": "node scripts/viya-app-scope.mjs --check",
48
50
  "sync:viya": "node scripts/viya-generate.mjs",
49
51
  "check:viya": "node scripts/viya-generate.mjs --check",
50
52
  "check:builds": "node scripts/check-builds.mjs",