@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.
- package/README.md +7 -0
- package/build/browser.js +339 -8
- package/build/cjs/viya/appSurface.js +241 -0
- package/build/cjs/viya/compute.js +33 -0
- package/build/cjs/viya/declared.js +96 -0
- package/build/cjs/viya/identity.js +191 -0
- package/build/cjs/viya/overlay.js +10 -0
- package/build/cjs/viya/service.js +3 -1
- package/build/esm/viya/appSurface.d.ts +51 -0
- package/build/esm/viya/appSurface.d.ts.map +1 -0
- package/build/esm/viya/appSurface.js +238 -0
- package/build/esm/viya/compute.d.ts.map +1 -1
- package/build/esm/viya/compute.js +34 -1
- package/build/esm/viya/declared.d.ts.map +1 -1
- package/build/esm/viya/declared.js +96 -0
- package/build/esm/viya/identity.d.ts +34 -0
- package/build/esm/viya/identity.d.ts.map +1 -0
- package/build/esm/viya/identity.js +187 -0
- package/build/esm/viya/overlay.d.ts.map +1 -1
- package/build/esm/viya/overlay.js +10 -0
- package/build/esm/viya/service.d.ts.map +1 -1
- package/build/esm/viya/service.js +3 -1
- package/package.json +3 -1
|
@@ -76,6 +76,31 @@ const contextBody = (name, caller) => ({
|
|
|
76
76
|
version: 2,
|
|
77
77
|
links: linksFor(`/compute/contexts/${exports.EMULATED_CONTEXT_ID}`, 'application/vnd.sas.compute.context')
|
|
78
78
|
});
|
|
79
|
+
/**
|
|
80
|
+
* The context in full, for the read a client makes of one it already holds.
|
|
81
|
+
*
|
|
82
|
+
* The list view Viya answers is deliberately minimal, so a client that needs a
|
|
83
|
+
* context's attributes reads the context itself - Data Controller's deploy
|
|
84
|
+
* screen fetches each one to pick up its batch identity. The attributes are the
|
|
85
|
+
* ones an emulated estate truthfully has: nothing runs as a batch identity here,
|
|
86
|
+
* and `reuseServerProcesses` is `false` for the same reason, which is what leaves
|
|
87
|
+
* a client's batch-id list empty rather than inventing an account to run as.
|
|
88
|
+
*/
|
|
89
|
+
const contextDetailsBody = (caller) => ({
|
|
90
|
+
...contextBody(exports.DEFAULT_CONTEXT_NAME, caller),
|
|
91
|
+
description: 'The compute context an emulated estate answers for',
|
|
92
|
+
creationTimeStamp: ids_js_1.EMULATED_NOW,
|
|
93
|
+
modifiedTimeStamp: ids_js_1.EMULATED_NOW,
|
|
94
|
+
modifiedBy: caller,
|
|
95
|
+
launchType: 'service',
|
|
96
|
+
launchContext: { contextId: exports.EMULATED_CONTEXT_ID },
|
|
97
|
+
environment: { autoExecLines: [] },
|
|
98
|
+
attributes: {
|
|
99
|
+
reuseServerProcesses: 'false',
|
|
100
|
+
allowXCMD: 'false',
|
|
101
|
+
serverMinAvailable: '1'
|
|
102
|
+
}
|
|
103
|
+
});
|
|
79
104
|
const sessionBody = (services, session, autoExecLines, caller) => {
|
|
80
105
|
const { id } = session;
|
|
81
106
|
const uri = `/compute/sessions/${id}`;
|
|
@@ -191,6 +216,14 @@ exports.COMPUTE_HANDLERS = {
|
|
|
191
216
|
}
|
|
192
217
|
};
|
|
193
218
|
},
|
|
219
|
+
'GET /compute/contexts/{}': async ({ request, params }) => {
|
|
220
|
+
// the estate has one context and its id does not move, so an id it is not is
|
|
221
|
+
// an id no context here ever had - the same refusal the drive makes for an
|
|
222
|
+
// unknown folder rather than a body about some other context
|
|
223
|
+
if (params.id !== exports.EMULATED_CONTEXT_ID)
|
|
224
|
+
throw new types_js_1.ApiError(404, `No compute context matches the id ${params.id}. The emulated estate answers one context, and this is not its id.`);
|
|
225
|
+
return { status: 200, body: contextDetailsBody((0, ids_js_1.callerId)(request.subject)) };
|
|
226
|
+
},
|
|
194
227
|
'POST /compute/contexts/{}/sessions': async ({ services, params, request }) => {
|
|
195
228
|
if (params.id !== exports.EMULATED_CONTEXT_ID)
|
|
196
229
|
throw new types_js_1.ApiError(404, `Context with ID '${params.id}' was not found.`);
|
|
@@ -32,6 +32,102 @@ exports.DECLARED = [
|
|
|
32
32
|
// there is no JSON shape to record
|
|
33
33
|
shape: undefined,
|
|
34
34
|
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.'
|
|
35
|
+
},
|
|
36
|
+
// The application's own identity reads. No capture describes these at all: the
|
|
37
|
+
// recorder drives the client the adapter is, and Data Controller's group, user
|
|
38
|
+
// and deploy screens call the identity service from the browser instead. That
|
|
39
|
+
// is why they are declared rather than recorded, and why the scope they belong
|
|
40
|
+
// to is stated in `src/viya/appSurface.ts`.
|
|
41
|
+
{
|
|
42
|
+
id: 'GET /identities/groups',
|
|
43
|
+
method: 'GET',
|
|
44
|
+
path: '/identities/groups',
|
|
45
|
+
steps: [],
|
|
46
|
+
statuses: [200],
|
|
47
|
+
queries: ['sortBy', 'limit', 'start'],
|
|
48
|
+
request: { queries: ['sortBy', 'limit', 'start'], body: undefined },
|
|
49
|
+
// a collection of groups, whose own shape Viya publishes rather than an
|
|
50
|
+
// estate recording supplying it
|
|
51
|
+
shape: undefined,
|
|
52
|
+
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.'
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'GET /identities/groups/{}/members',
|
|
56
|
+
method: 'GET',
|
|
57
|
+
path: '/identities/groups/{}/members',
|
|
58
|
+
steps: [],
|
|
59
|
+
statuses: [200, 404],
|
|
60
|
+
queries: ['limit'],
|
|
61
|
+
request: { queries: ['limit'], body: undefined },
|
|
62
|
+
shape: undefined,
|
|
63
|
+
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.'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: 'GET /identities/users',
|
|
67
|
+
method: 'GET',
|
|
68
|
+
path: '/identities/users',
|
|
69
|
+
steps: [],
|
|
70
|
+
statuses: [200],
|
|
71
|
+
queries: ['limit', 'start'],
|
|
72
|
+
request: { queries: ['limit', 'start'], body: undefined },
|
|
73
|
+
shape: undefined,
|
|
74
|
+
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.'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 'GET /identities/users/{}',
|
|
78
|
+
method: 'GET',
|
|
79
|
+
path: '/identities/users/{}',
|
|
80
|
+
steps: [],
|
|
81
|
+
statuses: [200, 404],
|
|
82
|
+
queries: [],
|
|
83
|
+
request: { queries: [], body: undefined },
|
|
84
|
+
shape: undefined,
|
|
85
|
+
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.'
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: 'GET /identities/users/@currentUser/memberships',
|
|
89
|
+
method: 'GET',
|
|
90
|
+
path: '/identities/users/@currentUser/memberships',
|
|
91
|
+
steps: [],
|
|
92
|
+
statuses: [200],
|
|
93
|
+
queries: ['limit', 'start'],
|
|
94
|
+
request: { queries: ['limit', 'start'], body: undefined },
|
|
95
|
+
shape: undefined,
|
|
96
|
+
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.'
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: 'GET /identities/users/{}/memberships',
|
|
100
|
+
method: 'GET',
|
|
101
|
+
path: '/identities/users/{}/memberships',
|
|
102
|
+
steps: [],
|
|
103
|
+
statuses: [200, 401],
|
|
104
|
+
queries: ['limit', 'start'],
|
|
105
|
+
request: { queries: ['limit', 'start'], body: undefined },
|
|
106
|
+
shape: undefined,
|
|
107
|
+
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.'
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: 'GET /identities/users/{}/avatar/content',
|
|
111
|
+
method: 'GET',
|
|
112
|
+
path: '/identities/users/{}/avatar/content',
|
|
113
|
+
steps: [],
|
|
114
|
+
statuses: [404],
|
|
115
|
+
queries: [],
|
|
116
|
+
request: { queries: [], body: undefined },
|
|
117
|
+
// the body is an image when an estate holds one: there is no JSON shape
|
|
118
|
+
shape: undefined,
|
|
119
|
+
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.'
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
id: 'GET /compute/contexts/{}',
|
|
123
|
+
method: 'GET',
|
|
124
|
+
path: '/compute/contexts/{}',
|
|
125
|
+
steps: [],
|
|
126
|
+
statuses: [200, 404],
|
|
127
|
+
queries: [],
|
|
128
|
+
request: { queries: [], body: undefined },
|
|
129
|
+
shape: undefined,
|
|
130
|
+
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.'
|
|
35
131
|
}
|
|
36
132
|
];
|
|
37
133
|
/** Every operation the emulator answers: what an estate did, plus what it must. */
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IDENTITY_HANDLERS = exports.requireRecords = void 0;
|
|
4
|
+
const types_js_1 = require("../types.js");
|
|
5
|
+
const ids_js_1 = require("./ids.js");
|
|
6
|
+
/** The port these handlers read, or the capability the host did not supply. */
|
|
7
|
+
const requireRecords = (services) => {
|
|
8
|
+
if (!services.records)
|
|
9
|
+
throw new types_js_1.ApiError(501, 'The emulated identity answers from the records service, which this host does not supply.');
|
|
10
|
+
return services.records;
|
|
11
|
+
};
|
|
12
|
+
exports.requireRecords = requireRecords;
|
|
13
|
+
/**
|
|
14
|
+
* The caller, from the subject a host resolved or from the token it forwarded.
|
|
15
|
+
*
|
|
16
|
+
* A host that already knows its caller passes `subject`; one that hands the
|
|
17
|
+
* emulator a bearer token (the server's Viya router does) gets the token read
|
|
18
|
+
* here, exactly as `GET /identities/users/@currentUser` reads it. Neither is
|
|
19
|
+
* optional in effect: an unauthenticated caller has no identity to answer about.
|
|
20
|
+
*/
|
|
21
|
+
const callerOf = async (services, request) => request.subject ?? (await services.identity?.authenticate(request.token));
|
|
22
|
+
/**
|
|
23
|
+
* The `{}` a membership or avatar read was addressed to, as a uid.
|
|
24
|
+
*
|
|
25
|
+
* `@currentUser` is where Viya puts the caller's own account, and a client asks
|
|
26
|
+
* for it by that spelling. It is resolved here rather than given its own row so
|
|
27
|
+
* the handler has one shape to answer.
|
|
28
|
+
*/
|
|
29
|
+
const userIdFrom = (segment, caller) => {
|
|
30
|
+
if (segment.toLowerCase() !== '@currentuser')
|
|
31
|
+
return segment;
|
|
32
|
+
const id = caller?.userId;
|
|
33
|
+
if (!id)
|
|
34
|
+
throw new types_js_1.ApiError(401, 'No caller is signed in.');
|
|
35
|
+
return id;
|
|
36
|
+
};
|
|
37
|
+
/** The paging fields every collection answer carries, as the captured ones do. */
|
|
38
|
+
const collection = (name, items, limit, uri, type) => {
|
|
39
|
+
const page = limit > 0 ? items.slice(0, limit) : items;
|
|
40
|
+
return {
|
|
41
|
+
accept: 'application/json',
|
|
42
|
+
name,
|
|
43
|
+
start: 0,
|
|
44
|
+
// the value asked for is echoed, as the folder answers echo it: a caller
|
|
45
|
+
// that asked for five and is told zero cannot tell what happened
|
|
46
|
+
limit: limit || page.length,
|
|
47
|
+
count: page.length,
|
|
48
|
+
version: 2,
|
|
49
|
+
items: page,
|
|
50
|
+
links: [
|
|
51
|
+
{
|
|
52
|
+
href: uri,
|
|
53
|
+
uri,
|
|
54
|
+
rel: 'self',
|
|
55
|
+
method: 'GET',
|
|
56
|
+
type: 'application/vnd.sas.collection',
|
|
57
|
+
itemType: type
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
const identityLinks = (uri, type) => [
|
|
63
|
+
{ href: uri, uri, rel: 'self', method: 'GET', type }
|
|
64
|
+
];
|
|
65
|
+
const GROUP_TYPE = 'application/vnd.sas.identity.group';
|
|
66
|
+
const USER_TYPE = 'application/vnd.sas.identity.user';
|
|
67
|
+
/** A group as Viya represents one, from the store's record. */
|
|
68
|
+
const groupBody = (group, memberCount) => ({
|
|
69
|
+
id: group.uid,
|
|
70
|
+
name: group.name,
|
|
71
|
+
description: group.description,
|
|
72
|
+
providerId: 'sas',
|
|
73
|
+
state: 'active',
|
|
74
|
+
memberCount,
|
|
75
|
+
creationTimeStamp: ids_js_1.EMULATED_NOW,
|
|
76
|
+
modifiedTimeStamp: ids_js_1.EMULATED_NOW,
|
|
77
|
+
version: 1,
|
|
78
|
+
links: identityLinks(`/identities/groups/${group.uid}`, GROUP_TYPE)
|
|
79
|
+
});
|
|
80
|
+
/** A user as Viya represents one. */
|
|
81
|
+
const userBody = (user) => ({
|
|
82
|
+
id: user.uid,
|
|
83
|
+
// Viya's `name` is the identifier a person signs in with; the display name is
|
|
84
|
+
// a separate field, and this is the one a member list shows
|
|
85
|
+
name: user.username,
|
|
86
|
+
displayName: user.displayName,
|
|
87
|
+
providerId: 'sas',
|
|
88
|
+
state: 'active',
|
|
89
|
+
version: 1,
|
|
90
|
+
links: identityLinks(`/identities/users/${user.uid}`, USER_TYPE)
|
|
91
|
+
});
|
|
92
|
+
/** The groups a user is a member of, as Viya's memberships route answers them. */
|
|
93
|
+
const membershipsOf = async (records, caller, uid) => {
|
|
94
|
+
const users = await records.listUsers(caller);
|
|
95
|
+
// Viya clients may address a user by login name; prefer an exact uid when a
|
|
96
|
+
// login happens to equal another user's uid.
|
|
97
|
+
const user = users.find((item) => item.uid === uid) ??
|
|
98
|
+
users.find((item) => item.username === uid);
|
|
99
|
+
const resolvedUid = user?.uid ?? uid;
|
|
100
|
+
const groups = await records.listGroups(caller);
|
|
101
|
+
const found = [];
|
|
102
|
+
for (const group of groups) {
|
|
103
|
+
const details = await records.getGroup(caller, { uid: group.uid });
|
|
104
|
+
if (details.users.some((member) => member.uid === resolvedUid))
|
|
105
|
+
found.push(groupBody(group, details.users.length));
|
|
106
|
+
}
|
|
107
|
+
return found;
|
|
108
|
+
};
|
|
109
|
+
exports.IDENTITY_HANDLERS = {
|
|
110
|
+
'GET /identities/groups': async ({ services, request }) => {
|
|
111
|
+
const records = (0, exports.requireRecords)(services);
|
|
112
|
+
const caller = await callerOf(services, request);
|
|
113
|
+
const limit = Number(request.query?.limit ?? 0) || 0;
|
|
114
|
+
const sortBy = request.query?.sortBy;
|
|
115
|
+
const groups = await records.listGroups(caller);
|
|
116
|
+
const items = [];
|
|
117
|
+
for (const group of groups) {
|
|
118
|
+
const details = await records.getGroup(caller, { uid: group.uid });
|
|
119
|
+
items.push(groupBody(group, details.users.length));
|
|
120
|
+
}
|
|
121
|
+
// `sortBy=name` is what the application asks for, and the store's order is
|
|
122
|
+
// not one: a screen that lists groups alphabetically asks the service for it
|
|
123
|
+
const ordered = sortBy && sortBy.toLowerCase() === 'name'
|
|
124
|
+
? [...items].sort((left, right) => left.name.localeCompare(right.name))
|
|
125
|
+
: items;
|
|
126
|
+
return {
|
|
127
|
+
status: 200,
|
|
128
|
+
body: collection('groups', ordered, limit, '/identities/groups', GROUP_TYPE)
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
'GET /identities/groups/{}/members': async ({ services, request, params }) => {
|
|
132
|
+
const records = (0, exports.requireRecords)(services);
|
|
133
|
+
const caller = await callerOf(services, request);
|
|
134
|
+
const limit = Number(request.query?.limit ?? 0) || 0;
|
|
135
|
+
const details = await records.getGroup(caller, { uid: params.id });
|
|
136
|
+
const items = details.users.map((user) => userBody(user));
|
|
137
|
+
return {
|
|
138
|
+
status: 200,
|
|
139
|
+
body: collection('members', items, limit, `/identities/groups/${details.uid}/members`, USER_TYPE)
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
'GET /identities/users': async ({ services, request }) => {
|
|
143
|
+
const records = (0, exports.requireRecords)(services);
|
|
144
|
+
const caller = await callerOf(services, request);
|
|
145
|
+
const limit = Number(request.query?.limit ?? 0) || 0;
|
|
146
|
+
const users = await records.listUsers(caller);
|
|
147
|
+
return {
|
|
148
|
+
status: 200,
|
|
149
|
+
body: collection('users', users.map((user) => userBody(user)), limit, '/identities/users', USER_TYPE)
|
|
150
|
+
};
|
|
151
|
+
},
|
|
152
|
+
'GET /identities/users/{}': async ({ services, request, params }) => {
|
|
153
|
+
const records = (0, exports.requireRecords)(services);
|
|
154
|
+
const caller = await callerOf(services, request);
|
|
155
|
+
const uid = userIdFrom(params.id, caller);
|
|
156
|
+
const user = await records.getUser(caller, { uid });
|
|
157
|
+
return { status: 200, body: userBody(user) };
|
|
158
|
+
},
|
|
159
|
+
'GET /identities/users/@currentUser/memberships': async ({ services, request }) => {
|
|
160
|
+
const records = (0, exports.requireRecords)(services);
|
|
161
|
+
const caller = await callerOf(services, request);
|
|
162
|
+
const limit = Number(request.query?.limit ?? 0) || 0;
|
|
163
|
+
const uid = userIdFrom('@currentUser', caller);
|
|
164
|
+
const items = await membershipsOf(records, caller, uid);
|
|
165
|
+
return {
|
|
166
|
+
status: 200,
|
|
167
|
+
body: collection('memberships', items, limit, '/identities/users/@currentUser/memberships', GROUP_TYPE)
|
|
168
|
+
};
|
|
169
|
+
},
|
|
170
|
+
'GET /identities/users/{}/memberships': async ({ services, request, params }) => {
|
|
171
|
+
const records = (0, exports.requireRecords)(services);
|
|
172
|
+
const caller = await callerOf(services, request);
|
|
173
|
+
const limit = Number(request.query?.limit ?? 0) || 0;
|
|
174
|
+
const uid = userIdFrom(params.id, caller);
|
|
175
|
+
// the address the client used is the address echoed back, as the other
|
|
176
|
+
// answers do: a client that followed a rel is never told about another one
|
|
177
|
+
const items = await membershipsOf(records, caller, uid);
|
|
178
|
+
return {
|
|
179
|
+
status: 200,
|
|
180
|
+
body: collection('memberships', items, limit, `/identities/users/${params.id}/memberships`, GROUP_TYPE)
|
|
181
|
+
};
|
|
182
|
+
},
|
|
183
|
+
'GET /identities/users/{}/avatar/content': async ({ services, request, params }) => {
|
|
184
|
+
const caller = await callerOf(services, request);
|
|
185
|
+
const uid = userIdFrom(params.id, caller);
|
|
186
|
+
// the estate's identity carries no avatar, and Viya answers a 404 for an
|
|
187
|
+
// account that has none - so a client's fallback image is what a real
|
|
188
|
+
// estate with none would show it
|
|
189
|
+
throw new types_js_1.ApiError(404, `No avatar is recorded for the user ${uid}.`);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
@@ -41,9 +41,19 @@ exports.VIYA_OVERLAY = {
|
|
|
41
41
|
'GET /folders/folders/@item': { implemented: true },
|
|
42
42
|
'GET /folders/folders/@myRecycleBin': { implemented: true },
|
|
43
43
|
'GET /identities/users/@currentUser': { implemented: true },
|
|
44
|
+
// answered here: the application's own identity reads, declared rather than
|
|
45
|
+
// captured - see src/viya/appSurface.ts for the scope they belong to
|
|
46
|
+
'GET /identities/groups': { implemented: true },
|
|
47
|
+
'GET /identities/groups/{}/members': { implemented: true },
|
|
48
|
+
'GET /identities/users': { implemented: true },
|
|
49
|
+
'GET /identities/users/{}': { implemented: true },
|
|
50
|
+
'GET /identities/users/@currentUser/memberships': { implemented: true },
|
|
51
|
+
'GET /identities/users/{}/memberships': { implemented: true },
|
|
52
|
+
'GET /identities/users/{}/avatar/content': { implemented: true },
|
|
44
53
|
'GET /types/types': { implemented: true },
|
|
45
54
|
// answered here: compute
|
|
46
55
|
'GET /compute/contexts': { implemented: true },
|
|
56
|
+
'GET /compute/contexts/{}': { implemented: true },
|
|
47
57
|
'POST /compute/contexts/{}/sessions': { implemented: true },
|
|
48
58
|
'DELETE /compute/sessions/{}': { implemented: true },
|
|
49
59
|
'POST /compute/sessions/{}/jobs': { implemented: true },
|
|
@@ -5,6 +5,7 @@ const types_js_1 = require("../types.js");
|
|
|
5
5
|
const ports_js_1 = require("./ports.js");
|
|
6
6
|
const compute_js_1 = require("./compute.js");
|
|
7
7
|
const files_js_1 = require("./files.js");
|
|
8
|
+
const identity_js_1 = require("./identity.js");
|
|
8
9
|
const ids_js_1 = require("./ids.js");
|
|
9
10
|
const linksFor = (uri, collection = false) => {
|
|
10
11
|
const self = {
|
|
@@ -339,5 +340,6 @@ exports.VIYA_HANDLERS = {
|
|
|
339
340
|
};
|
|
340
341
|
},
|
|
341
342
|
...compute_js_1.COMPUTE_HANDLERS,
|
|
342
|
-
...files_js_1.FILE_HANDLERS
|
|
343
|
+
...files_js_1.FILE_HANDLERS,
|
|
344
|
+
...identity_js_1.IDENTITY_HANDLERS
|
|
343
345
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The application's call surface, and what this package decides about each entry.
|
|
3
|
+
*
|
|
4
|
+
* `src/viya/surface.ts` is the adapter's surface: what `@sasjs/adapter` measured
|
|
5
|
+
* to build. It is not the whole story, because an application can call the
|
|
6
|
+
* platform itself. Data Controller does exactly that - its group, user and deploy
|
|
7
|
+
* screens speak Viya REST directly for the calls the adapter does not offer -
|
|
8
|
+
* and the emulator answered those paths with the 404 that says "the emulated
|
|
9
|
+
* estate answers the client's call surface and nothing else". A capture pass
|
|
10
|
+
* driven by the adapter can never see them, so they were outside a scope that
|
|
11
|
+
* was measured from the adapter alone, and the screens they carry were dead on
|
|
12
|
+
* an emulated estate.
|
|
13
|
+
*
|
|
14
|
+
* This file is the second measurement. `spec/viya/app-paths.json` is what Data
|
|
15
|
+
* Controller's client was measured to build (`scripts/viya-app-scope.mjs` re-runs
|
|
16
|
+
* the extraction from a checkout), and every path in it is classified here. The
|
|
17
|
+
* two are held together in both directions, the way the adapter's inventory and
|
|
18
|
+
* `surface.ts` are: a path nobody classified is scope creep nobody chose, and a
|
|
19
|
+
* classification for a path the application no longer builds is a stale claim
|
|
20
|
+
* about what a host has to answer.
|
|
21
|
+
*
|
|
22
|
+
* `decision: 'in'` means a host must answer it. That is a promise the table keeps
|
|
23
|
+
* - `spec/viyaTable.spec.ts` refuses an answered operation no in-scope entry
|
|
24
|
+
* covers - so an `in` entry with no operation is a gap the table spec does not
|
|
25
|
+
* catch. Read the two together: `src/viya/declared.ts` is where an `in` path
|
|
26
|
+
* becomes an operation.
|
|
27
|
+
*/
|
|
28
|
+
import type { SurfaceFamily } from './surface.js';
|
|
29
|
+
export interface AppSurfaceEntry {
|
|
30
|
+
/** Where the application sends it; `{}` is one path segment. */
|
|
31
|
+
path: string;
|
|
32
|
+
family: SurfaceFamily;
|
|
33
|
+
decision: 'in' | 'declined';
|
|
34
|
+
/** What the emulator answers, or why it does not answer this at all. */
|
|
35
|
+
reason: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The application the inventory was measured from.
|
|
39
|
+
*
|
|
40
|
+
* Named rather than assumed: the inventory describes one application's calls,
|
|
41
|
+
* and a second application running on an emulated estate is a second inventory -
|
|
42
|
+
* not an edit to this one, whose rows would then be a claim about a client
|
|
43
|
+
* nobody measured.
|
|
44
|
+
*/
|
|
45
|
+
export declare const APP_SURFACE_APPLICATION: {
|
|
46
|
+
name: string;
|
|
47
|
+
repository: string;
|
|
48
|
+
measuredFrom: string;
|
|
49
|
+
};
|
|
50
|
+
export declare const APP_SURFACE: AppSurfaceEntry[];
|
|
51
|
+
//# sourceMappingURL=appSurface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appSurface.d.ts","sourceRoot":"","sources":["../../../src/viya/appSurface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEjD,MAAM,WAAW,eAAe;IAC9B,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,aAAa,CAAA;IACrB,QAAQ,EAAE,IAAI,GAAG,UAAU,CAAA;IAC3B,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB;;;;CAInC,CAAA;AAMD,eAAO,MAAM,WAAW,EAAE,eAAe,EAkPxC,CAAA"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The application the inventory was measured from.
|
|
3
|
+
*
|
|
4
|
+
* Named rather than assumed: the inventory describes one application's calls,
|
|
5
|
+
* and a second application running on an emulated estate is a second inventory -
|
|
6
|
+
* not an edit to this one, whose rows would then be a claim about a client
|
|
7
|
+
* nobody measured.
|
|
8
|
+
*/
|
|
9
|
+
export const APP_SURFACE_APPLICATION = {
|
|
10
|
+
name: 'Data Controller for SAS',
|
|
11
|
+
repository: 'https://git.datacontroller.io/dc/dc',
|
|
12
|
+
measuredFrom: 'client/src'
|
|
13
|
+
};
|
|
14
|
+
/** Why a namespace the API-explorer page lists is not an answered operation. */
|
|
15
|
+
const EXPLORER_ONLY = 'The application names this namespace in its Viya API map, which its API-explorer page reads; no product screen calls it, so the emulated estate does not answer it.';
|
|
16
|
+
export const APP_SURFACE = [
|
|
17
|
+
// the auth flow the client shares with the adapter
|
|
18
|
+
{
|
|
19
|
+
path: '/SASLogon',
|
|
20
|
+
family: 'viya-auth',
|
|
21
|
+
decision: 'in',
|
|
22
|
+
reason: 'the auth flow, named by the application as well as the adapter, and the reason the emulated paths cannot be renamed'
|
|
23
|
+
},
|
|
24
|
+
// compute: the list, and the read of one context a deploy screen makes
|
|
25
|
+
{
|
|
26
|
+
path: '/compute/contexts',
|
|
27
|
+
family: 'viya-compute',
|
|
28
|
+
decision: 'in',
|
|
29
|
+
reason: 'the deploy screen lists the contexts it may run a session in, and picks the one the wizard will use'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
path: '/compute/contexts/{}',
|
|
33
|
+
family: 'viya-compute',
|
|
34
|
+
decision: 'in',
|
|
35
|
+
reason: 'the deploy screen reads each context in full for its batch identity and reuse setting, which the list view does not carry'
|
|
36
|
+
},
|
|
37
|
+
// folders: the two reads an application makes of a deployment folder
|
|
38
|
+
{
|
|
39
|
+
path: '/folders/folders/@item',
|
|
40
|
+
family: 'viya-folders',
|
|
41
|
+
decision: 'in',
|
|
42
|
+
reason: 'the application resolves its own appLoc by path to find the services it will run'
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
path: '/folders/folders/{}/members',
|
|
46
|
+
family: 'viya-folders',
|
|
47
|
+
decision: 'in',
|
|
48
|
+
reason: 'the application lists the members of the folder it resolved, to find a deployed service'
|
|
49
|
+
},
|
|
50
|
+
// identities: the family the adapter asks one question of and an app asks six
|
|
51
|
+
{
|
|
52
|
+
path: '/identities/groups',
|
|
53
|
+
family: 'viya-identity',
|
|
54
|
+
decision: 'in',
|
|
55
|
+
reason: 'the deploy screen fetches the group list to offer the admin-group dropdown, and its failure aborts the wizard'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
path: '/identities/groups/{}',
|
|
59
|
+
family: 'viya-identity',
|
|
60
|
+
decision: 'in',
|
|
61
|
+
reason: 'the group screen appends the group id and a member list to this fragment, to show who holds a group'
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
path: '/identities/users',
|
|
65
|
+
family: 'viya-identity',
|
|
66
|
+
decision: 'in',
|
|
67
|
+
reason: 'the user screen lists the accounts the estate holds'
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
path: '/identities/users/@currentUser',
|
|
71
|
+
family: 'viya-identity',
|
|
72
|
+
decision: 'in',
|
|
73
|
+
reason: 'the caller, which the application reads for its own profile as the adapter does'
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
path: '/identities/users/@currentUser/memberships',
|
|
77
|
+
family: 'viya-identity',
|
|
78
|
+
decision: 'in',
|
|
79
|
+
reason: 'the deploy screen filters the group list to the caller own groups, and falls back to all groups when this read fails'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
path: '/identities/users/{}',
|
|
83
|
+
family: 'viya-identity',
|
|
84
|
+
decision: 'in',
|
|
85
|
+
reason: 'the user screen appends an account id to this fragment for a profile and its memberships'
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
path: '/identities/users/{}/avatar/content',
|
|
89
|
+
family: 'viya-identity',
|
|
90
|
+
decision: 'in',
|
|
91
|
+
reason: 'the header renders the caller avatar from this URL, and an account with none answers the 404 an estate would'
|
|
92
|
+
},
|
|
93
|
+
// the API roots and the explorer-only namespaces: named, never called
|
|
94
|
+
{
|
|
95
|
+
path: '/identities',
|
|
96
|
+
family: 'viya-identity',
|
|
97
|
+
decision: 'declined',
|
|
98
|
+
reason: 'the service root the application API map lists for its explorer page, not an endpoint any screen calls'
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
path: '/folders',
|
|
102
|
+
family: 'viya-folders',
|
|
103
|
+
decision: 'declined',
|
|
104
|
+
reason: 'the service root the application API map lists for its explorer page, not an endpoint any screen calls'
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
path: '/files',
|
|
108
|
+
family: 'viya-files',
|
|
109
|
+
decision: 'declined',
|
|
110
|
+
reason: 'the service root the application API map lists for its explorer page, not an endpoint any screen calls'
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
path: '/jobDefinitions',
|
|
114
|
+
family: 'viya-jobs',
|
|
115
|
+
decision: 'declined',
|
|
116
|
+
reason: 'the service root the application API map lists for its explorer page, not an endpoint any screen calls'
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
path: '/jobExecution',
|
|
120
|
+
family: 'viya-jobs',
|
|
121
|
+
decision: 'declined',
|
|
122
|
+
reason: 'the service root the application API map lists for its explorer page, not an endpoint any screen calls'
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
path: '/annotations',
|
|
126
|
+
family: 'viya-files',
|
|
127
|
+
decision: 'declined',
|
|
128
|
+
reason: EXPLORER_ONLY
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
path: '/authorization',
|
|
132
|
+
family: 'viya-identity',
|
|
133
|
+
decision: 'declined',
|
|
134
|
+
reason: EXPLORER_ONLY
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
path: '/businessRules',
|
|
138
|
+
family: 'viya-jobs',
|
|
139
|
+
decision: 'declined',
|
|
140
|
+
reason: EXPLORER_ONLY
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
path: '/dataMining',
|
|
144
|
+
family: 'viya-jobs',
|
|
145
|
+
decision: 'declined',
|
|
146
|
+
reason: EXPLORER_ONLY
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
path: '/decisionsRuntimeBuilder',
|
|
150
|
+
family: 'viya-jobs',
|
|
151
|
+
decision: 'declined',
|
|
152
|
+
reason: EXPLORER_ONLY
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
path: '/insights',
|
|
156
|
+
family: 'viya-jobs',
|
|
157
|
+
decision: 'declined',
|
|
158
|
+
reason: EXPLORER_ONLY
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
path: '/microanalyticScore',
|
|
162
|
+
family: 'viya-jobs',
|
|
163
|
+
decision: 'declined',
|
|
164
|
+
reason: EXPLORER_ONLY
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
path: '/mlPipelineAutomation',
|
|
168
|
+
family: 'viya-jobs',
|
|
169
|
+
decision: 'declined',
|
|
170
|
+
reason: EXPLORER_ONLY
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
path: '/modelManagement',
|
|
174
|
+
family: 'viya-jobs',
|
|
175
|
+
decision: 'declined',
|
|
176
|
+
reason: EXPLORER_ONLY
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
path: '/modelPublish',
|
|
180
|
+
family: 'viya-jobs',
|
|
181
|
+
decision: 'declined',
|
|
182
|
+
reason: EXPLORER_ONLY
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
path: '/modelRepository',
|
|
186
|
+
family: 'viya-jobs',
|
|
187
|
+
decision: 'declined',
|
|
188
|
+
reason: EXPLORER_ONLY
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
path: '/referenceData',
|
|
192
|
+
family: 'viya-jobs',
|
|
193
|
+
decision: 'declined',
|
|
194
|
+
reason: EXPLORER_ONLY
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
path: '/relationships',
|
|
198
|
+
family: 'viya-folders',
|
|
199
|
+
decision: 'declined',
|
|
200
|
+
reason: EXPLORER_ONLY
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
path: '/reportImages',
|
|
204
|
+
family: 'viya-jobs',
|
|
205
|
+
decision: 'declined',
|
|
206
|
+
reason: EXPLORER_ONLY
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
path: '/reportTransforms',
|
|
210
|
+
family: 'viya-jobs',
|
|
211
|
+
decision: 'declined',
|
|
212
|
+
reason: EXPLORER_ONLY
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
path: '/reports',
|
|
216
|
+
family: 'viya-jobs',
|
|
217
|
+
decision: 'declined',
|
|
218
|
+
reason: EXPLORER_ONLY
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
path: '/subjectContacts',
|
|
222
|
+
family: 'viya-jobs',
|
|
223
|
+
decision: 'declined',
|
|
224
|
+
reason: EXPLORER_ONLY
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
path: '/treatmentDefinitions',
|
|
228
|
+
family: 'viya-jobs',
|
|
229
|
+
decision: 'declined',
|
|
230
|
+
reason: EXPLORER_ONLY
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
path: '/visualAnalytics',
|
|
234
|
+
family: 'viya-jobs',
|
|
235
|
+
decision: 'declined',
|
|
236
|
+
reason: EXPLORER_ONLY
|
|
237
|
+
}
|
|
238
|
+
];
|