@sasjs/api 0.33.0 → 0.36.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/build/browser.js +2452 -50
- package/build/cjs/corpus/viya/operations.js +647 -0
- package/build/cjs/index.js +60 -40
- package/build/cjs/viya/compute.js +223 -0
- package/build/cjs/viya/dispatch.js +141 -0
- package/build/cjs/viya/files.js +199 -0
- package/build/cjs/viya/ids.js +60 -0
- package/build/cjs/viya/overlay.js +79 -0
- package/build/cjs/viya/ports.js +5 -0
- package/build/cjs/viya/seed.js +120 -0
- package/build/cjs/viya/service.js +283 -0
- package/build/cjs/viya/sessions.js +114 -0
- package/build/cjs/viya/surface.js +1 -49
- package/build/cjs/viya/table.js +805 -0
- package/build/cjs/viya/unrecorded.js +58 -0
- package/build/cjs/viya/version.js +43 -0
- package/build/esm/corpus/viya/operations.d.ts +28 -0
- package/build/esm/corpus/viya/operations.d.ts.map +1 -0
- package/build/esm/corpus/viya/operations.js +644 -0
- package/build/esm/host/dispatch.d.ts +10 -0
- package/build/esm/host/dispatch.d.ts.map +1 -1
- package/build/esm/index.d.ts +12 -0
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +7 -0
- package/build/esm/viya/compute.d.ts +39 -0
- package/build/esm/viya/compute.d.ts.map +1 -0
- package/build/esm/viya/compute.js +219 -0
- package/build/esm/viya/dispatch.d.ts +35 -0
- package/build/esm/viya/dispatch.d.ts.map +1 -0
- package/build/esm/viya/dispatch.js +136 -0
- package/build/esm/viya/files.d.ts +33 -0
- package/build/esm/viya/files.d.ts.map +1 -0
- package/build/esm/viya/files.js +196 -0
- package/build/esm/viya/ids.d.ts +35 -0
- package/build/esm/viya/ids.d.ts.map +1 -0
- package/build/esm/viya/ids.js +55 -0
- package/build/esm/viya/overlay.d.ts +25 -0
- package/build/esm/viya/overlay.d.ts.map +1 -0
- package/build/esm/viya/overlay.js +75 -0
- package/build/esm/viya/ports.d.ts +12 -0
- package/build/esm/viya/ports.d.ts.map +1 -0
- package/build/esm/viya/ports.js +1 -0
- package/build/esm/viya/seed.d.ts +60 -0
- package/build/esm/viya/seed.d.ts.map +1 -0
- package/build/esm/viya/seed.js +111 -0
- package/build/esm/viya/service.d.ts +28 -0
- package/build/esm/viya/service.d.ts.map +1 -0
- package/build/esm/viya/service.js +280 -0
- package/build/esm/viya/sessions.d.ts +63 -0
- package/build/esm/viya/sessions.d.ts.map +1 -0
- package/build/esm/viya/sessions.js +108 -0
- package/build/esm/viya/surface.d.ts.map +1 -1
- package/build/esm/viya/surface.js +1 -49
- package/build/esm/viya/table.d.ts +39 -0
- package/build/esm/viya/table.d.ts.map +1 -0
- package/build/esm/viya/table.js +802 -0
- package/build/esm/viya/unrecorded.d.ts +24 -0
- package/build/esm/viya/unrecorded.d.ts.map +1 -0
- package/build/esm/viya/unrecorded.js +55 -0
- package/build/esm/viya/version.d.ts +37 -0
- package/build/esm/viya/version.d.ts.map +1 -0
- package/build/esm/viya/version.js +39 -0
- package/package.json +5 -2
package/build/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,cAAc,YAAY,CAAA;AAC1B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,OAAO,EACP,QAAQ,EACR,MAAM,EACP,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,iBAAiB,EAClB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACX,MAAM,mBAAmB,CAAA;AAC1B,YAAY,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,MAAM,qBAAqB,CAAA;AAC5B,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACzD,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,oBAAoB,EACrB,MAAM,wBAAwB,CAAA;AAC/B,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,iBAAiB,EAClB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACf,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EACV,SAAS,EACT,WAAW,EACX,aAAa,EACd,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,cAAc,EACd,yBAAyB,EACzB,UAAU,EACX,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,SAAS,EACT,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA"}
|
package/build/esm/index.js
CHANGED
|
@@ -23,6 +23,13 @@ export { OVERLAY, TAG_CAPABILITIES } from './routes/overlay.js';
|
|
|
23
23
|
// the client's call surface, and this package's decision about each entry: a
|
|
24
24
|
// host that refuses an out-of-scope path reads the same statement the guard does
|
|
25
25
|
export { SURFACE, SURFACE_ADAPTER_VERSION } from './viya/surface.js';
|
|
26
|
+
export { VIYA_TABLE } from './viya/table.js';
|
|
27
|
+
export { UNRECORDED } from './viya/unrecorded.js';
|
|
28
|
+
export { EMULATED_HEADER, EMULATED_HEADER_VALUE, VIYA_CAPTURED_AT, VIYA_TARGET_VERSION, emulatedHeaders } from './viya/version.js';
|
|
29
|
+
export { dispatchViya, findViyaOperation } from './viya/dispatch.js';
|
|
30
|
+
export { VIYA_OVERLAY } from './viya/overlay.js';
|
|
31
|
+
export { VIYA_HANDLERS } from './viya/service.js';
|
|
32
|
+
export { VIYA_CORPUS } from './corpus/viya/operations.js';
|
|
26
33
|
export { dispatch, HANDLED_ROUTES } from './host/dispatch.js';
|
|
27
34
|
// a host gating its own middleware reads the same decision the inventory reports
|
|
28
35
|
export * from './identity/routeAccess.js';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The compute family: contexts, sessions, jobs and the logs generated for them.
|
|
3
|
+
*
|
|
4
|
+
* These are the operations a `serverType=SASVIYA` application needs before it can
|
|
5
|
+
* do anything: find a context, start a session, submit a program, poll it, read
|
|
6
|
+
* its log. The emulator answers all of them from `EmulatedEstate` - this process -
|
|
7
|
+
* because there is no SAS engine to reach for in a browser and no reason to reach
|
|
8
|
+
* for one here.
|
|
9
|
+
*
|
|
10
|
+
* The context is the one place the emulator answers the question it was asked
|
|
11
|
+
* rather than one it chose: a client names the context it wants by filter and the
|
|
12
|
+
* emulated estate has exactly one, under that name. Its id does not move with the
|
|
13
|
+
* name, so a session can be created for the id the list returned.
|
|
14
|
+
*/
|
|
15
|
+
import type { ApiResponse, Services } from '../host/dispatch.js';
|
|
16
|
+
/** The name the emulator answers when a client asks for no particular context. */
|
|
17
|
+
export declare const DEFAULT_CONTEXT_NAME = "Emulated Compute Context";
|
|
18
|
+
/** The one context id this estate mints, whatever name it is asked for. */
|
|
19
|
+
export declare const EMULATED_CONTEXT_ID: string;
|
|
20
|
+
/**
|
|
21
|
+
* The context name a client asked for.
|
|
22
|
+
*
|
|
23
|
+
* The adapter filters by name (`filter=eq(name,'X')`), so the answer is the one
|
|
24
|
+
* emulated context under the requested name. A second estate is not something an
|
|
25
|
+
* emulator can have, and an empty list would fail a client that has nothing wrong
|
|
26
|
+
* with it.
|
|
27
|
+
*/
|
|
28
|
+
export declare const contextNameFrom: (filter: string | undefined) => string;
|
|
29
|
+
export declare const COMPUTE_HANDLERS: Record<string, (context: {
|
|
30
|
+
services: Services;
|
|
31
|
+
request: {
|
|
32
|
+
query?: Record<string, string | undefined>;
|
|
33
|
+
body?: unknown;
|
|
34
|
+
token?: string;
|
|
35
|
+
subject?: unknown;
|
|
36
|
+
};
|
|
37
|
+
params: Record<string, string>;
|
|
38
|
+
}) => Promise<ApiResponse>>;
|
|
39
|
+
//# sourceMappingURL=compute.d.ts.map
|
|
@@ -0,0 +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;AAOhE,kFAAkF;AAClF,eAAO,MAAM,oBAAoB,6BAA6B,CAAA;AAE9D,2EAA2E;AAC3E,eAAO,MAAM,mBAAmB,QAAuC,CAAA;AA+CvE;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,GAAG,SAAS,KAAG,MAM5D,CAAA;AA6GD,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,CAwH3B,CAAA"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { ApiError } from '../types.js';
|
|
2
|
+
import { normaliseServerUrl } from './seed.js';
|
|
3
|
+
import { seedOf } from './seed.js';
|
|
4
|
+
import { estateFor } from './sessions.js';
|
|
5
|
+
import { EMULATED_USER, idFor } from './ids.js';
|
|
6
|
+
/** The name the emulator answers when a client asks for no particular context. */
|
|
7
|
+
export const DEFAULT_CONTEXT_NAME = 'Emulated Compute Context';
|
|
8
|
+
/** The one context id this estate mints, whatever name it is asked for. */
|
|
9
|
+
export const EMULATED_CONTEXT_ID = idFor('emulated-context', 'context');
|
|
10
|
+
/**
|
|
11
|
+
* The links a client follows, by rel.
|
|
12
|
+
*
|
|
13
|
+
* The rels are not decoration: the adapter reads `state` to poll a session and a
|
|
14
|
+
* job, `log` to fetch the log, `up` to reach the session from a job. A body that
|
|
15
|
+
* carried only `self` answered 201 and then failed the client, which is how the
|
|
16
|
+
* conformance harness found this.
|
|
17
|
+
*/
|
|
18
|
+
const relLinks = (type, rels) => rels.map(([rel, href]) => ({ href, uri: href, rel, method: 'GET', type }));
|
|
19
|
+
const linksFor = (uri, type, collection = false, itemType = false) => [
|
|
20
|
+
// the collection link comes first, because that is the order the capture
|
|
21
|
+
// recorded and the item shape assertion walks the first element
|
|
22
|
+
...(collection
|
|
23
|
+
? [
|
|
24
|
+
{
|
|
25
|
+
href: `${uri}/members`,
|
|
26
|
+
uri: `${uri}/members`,
|
|
27
|
+
rel: 'members',
|
|
28
|
+
method: 'GET',
|
|
29
|
+
type,
|
|
30
|
+
itemType: type
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
: []),
|
|
34
|
+
{
|
|
35
|
+
href: uri,
|
|
36
|
+
uri,
|
|
37
|
+
rel: 'self',
|
|
38
|
+
method: 'GET',
|
|
39
|
+
type,
|
|
40
|
+
// the log's capture records itemType on its first link, so it is stamped
|
|
41
|
+
// there rather than invented as a members link the estate does not have
|
|
42
|
+
...(itemType ? { itemType: type } : {})
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
const estateOf = (services) => estateFor(seedOf(services.viya));
|
|
46
|
+
/**
|
|
47
|
+
* The context name a client asked for.
|
|
48
|
+
*
|
|
49
|
+
* The adapter filters by name (`filter=eq(name,'X')`), so the answer is the one
|
|
50
|
+
* emulated context under the requested name. A second estate is not something an
|
|
51
|
+
* emulator can have, and an empty list would fail a client that has nothing wrong
|
|
52
|
+
* with it.
|
|
53
|
+
*/
|
|
54
|
+
export const contextNameFrom = (filter) => {
|
|
55
|
+
if (!filter)
|
|
56
|
+
return DEFAULT_CONTEXT_NAME;
|
|
57
|
+
const match = /name\s*,\s*'([^']*)'|name\s*,\s*"([^"]*)"/i.exec(filter);
|
|
58
|
+
return match?.[1] ?? match?.[2] ?? DEFAULT_CONTEXT_NAME;
|
|
59
|
+
};
|
|
60
|
+
const contextBody = (name) => ({
|
|
61
|
+
id: EMULATED_CONTEXT_ID,
|
|
62
|
+
name,
|
|
63
|
+
createdBy: EMULATED_USER.id,
|
|
64
|
+
version: 2,
|
|
65
|
+
links: linksFor(`/compute/contexts/${EMULATED_CONTEXT_ID}`, 'application/vnd.sas.compute.context')
|
|
66
|
+
});
|
|
67
|
+
const sessionBody = (services, session, autoExecLines) => {
|
|
68
|
+
const { id } = session;
|
|
69
|
+
const uri = `/compute/sessions/${id}`;
|
|
70
|
+
return {
|
|
71
|
+
id,
|
|
72
|
+
applicationName: 'emulated',
|
|
73
|
+
owner: EMULATED_USER.id,
|
|
74
|
+
serverId: idFor(normaliseServerUrl(services.viya?.serverUrl) || 'emulated', 'server'),
|
|
75
|
+
state: 'idle',
|
|
76
|
+
attributes: {
|
|
77
|
+
homeDirectory: '/tmp/emulated',
|
|
78
|
+
sessionInactiveTimeout: 3600
|
|
79
|
+
},
|
|
80
|
+
environment: { autoExecLines },
|
|
81
|
+
// the real clock: the adapter computes a session's age from this stamp and
|
|
82
|
+
// expires it against sessionInactiveTimeout
|
|
83
|
+
creationTimeStamp: session.createdAt,
|
|
84
|
+
serviceAPIVersion: 1,
|
|
85
|
+
sessionConditionCode: 0,
|
|
86
|
+
stateElapsedTime: 0,
|
|
87
|
+
version: 2,
|
|
88
|
+
links: relLinks('application/vnd.sas.compute.session', [
|
|
89
|
+
['self', uri],
|
|
90
|
+
['state', `${uri}/state`],
|
|
91
|
+
['log', `${uri}/log`],
|
|
92
|
+
['jobs', `${uri}/jobs`]
|
|
93
|
+
])
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
const jobBody = (job) => {
|
|
97
|
+
const uri = `/compute/sessions/${job.sessionId}/jobs/${job.id}`;
|
|
98
|
+
return {
|
|
99
|
+
id: job.id,
|
|
100
|
+
name: job.name,
|
|
101
|
+
sessionId: job.sessionId,
|
|
102
|
+
state: job.state,
|
|
103
|
+
creationTimeStamp: job.creationTimeStamp,
|
|
104
|
+
completedTimeStamp: job.completedTimeStamp,
|
|
105
|
+
jobConditionCode: 0,
|
|
106
|
+
stateElapsedTime: 1,
|
|
107
|
+
listingStatistics: {
|
|
108
|
+
lineCount: job.log.length,
|
|
109
|
+
modifiedTimeStamp: job.completedTimeStamp
|
|
110
|
+
},
|
|
111
|
+
logStatistics: {
|
|
112
|
+
lineCount: job.log.length,
|
|
113
|
+
modifiedTimeStamp: job.completedTimeStamp
|
|
114
|
+
},
|
|
115
|
+
statistics: { systemCpuTime: 0.01, userCpuTime: 0.02 },
|
|
116
|
+
version: 2,
|
|
117
|
+
links: relLinks('application/vnd.sas.compute.job', [
|
|
118
|
+
['self', uri],
|
|
119
|
+
['state', `${uri}/state`],
|
|
120
|
+
['log', `${uri}/log`],
|
|
121
|
+
['up', `/compute/sessions/${job.sessionId}`]
|
|
122
|
+
])
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
/** The session the request names, or the 404 a client that lost it expects. */
|
|
126
|
+
const sessionOf = (services, id) => {
|
|
127
|
+
const session = estateOf(services).session(id);
|
|
128
|
+
if (!session)
|
|
129
|
+
throw new ApiError(404, `Session with ID '${id}' was not found.`);
|
|
130
|
+
return session;
|
|
131
|
+
};
|
|
132
|
+
const jobOf = (services, sessionId, jobId) => {
|
|
133
|
+
const job = sessionOf(services, sessionId).jobs.get(jobId);
|
|
134
|
+
if (!job)
|
|
135
|
+
throw new ApiError(404, `Job with ID '${jobId}' was not found.`);
|
|
136
|
+
return job;
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* The `{}` values a request carried, in path order.
|
|
140
|
+
*
|
|
141
|
+
* `dispatchViya` sets `segments` on every request it hands a handler, so there is
|
|
142
|
+
* no absent case to answer - a fallback here would be a branch nothing reaches.
|
|
143
|
+
*/
|
|
144
|
+
const segmentsOf = (params) => params.segments;
|
|
145
|
+
export const COMPUTE_HANDLERS = {
|
|
146
|
+
'GET /compute/contexts': async ({ request }) => {
|
|
147
|
+
const limit = Number(request.query?.limit ?? 0) || 0;
|
|
148
|
+
return {
|
|
149
|
+
status: 200,
|
|
150
|
+
body: {
|
|
151
|
+
accept: 'application/json',
|
|
152
|
+
name: 'contexts',
|
|
153
|
+
start: 0,
|
|
154
|
+
limit,
|
|
155
|
+
count: 1,
|
|
156
|
+
version: 2,
|
|
157
|
+
items: [contextBody(contextNameFrom(request.query?.filter))],
|
|
158
|
+
links: linksFor('/compute/contexts', 'application/vnd.sas.compute.context', true)
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
},
|
|
162
|
+
'POST /compute/contexts/{}/sessions': async ({ services, params, request }) => {
|
|
163
|
+
if (params.id !== EMULATED_CONTEXT_ID)
|
|
164
|
+
throw new ApiError(404, `Context with ID '${params.id}' was not found.`);
|
|
165
|
+
const body = (request.body ?? {});
|
|
166
|
+
const session = estateOf(services).create();
|
|
167
|
+
return {
|
|
168
|
+
status: 201,
|
|
169
|
+
body: sessionBody(services, session, body.environment?.autoExecLines ?? [])
|
|
170
|
+
};
|
|
171
|
+
},
|
|
172
|
+
'GET /compute/sessions/{}/state': async ({ services, params }) => {
|
|
173
|
+
sessionOf(services, params.id);
|
|
174
|
+
// a bare enum, not an object: the adapter calls `.trim()` on the answer, and
|
|
175
|
+
// the capture recorded no shape here because there is no JSON body
|
|
176
|
+
return { status: 200, body: 'idle' };
|
|
177
|
+
},
|
|
178
|
+
'DELETE /compute/sessions/{}': async ({ services, params }) => {
|
|
179
|
+
sessionOf(services, params.id);
|
|
180
|
+
estateOf(services).remove(params.id);
|
|
181
|
+
return { status: 204, body: undefined };
|
|
182
|
+
},
|
|
183
|
+
'POST /compute/sessions/{}/jobs': async ({ services, params, request }) => {
|
|
184
|
+
const session = sessionOf(services, params.id);
|
|
185
|
+
const job = estateOf(services).submit(session, (request.body ?? {}));
|
|
186
|
+
return { status: 201, body: jobBody(job) };
|
|
187
|
+
},
|
|
188
|
+
'GET /compute/sessions/{}/jobs/{}': async ({ services, params }) => {
|
|
189
|
+
const [sessionId, jobId] = segmentsOf(params);
|
|
190
|
+
return { status: 200, body: jobBody(jobOf(services, sessionId, jobId)) };
|
|
191
|
+
},
|
|
192
|
+
'GET /compute/sessions/{}/jobs/{}/state': async ({ services, params }) => {
|
|
193
|
+
const [sessionId, jobId] = segmentsOf(params);
|
|
194
|
+
return {
|
|
195
|
+
status: 200,
|
|
196
|
+
body: jobOf(services, sessionId, jobId).state
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
'GET /compute/sessions/{}/jobs/{}/log/content': async ({ services, params, request }) => {
|
|
200
|
+
const [sessionId, jobId] = segmentsOf(params);
|
|
201
|
+
const job = jobOf(services, sessionId, jobId);
|
|
202
|
+
const start = Number(request.query?.start ?? 0) || 0;
|
|
203
|
+
const limit = Number(request.query?.limit ?? 0) || 0;
|
|
204
|
+
const lines = job.log.slice(start, limit ? start + limit : undefined);
|
|
205
|
+
return {
|
|
206
|
+
status: 200,
|
|
207
|
+
body: {
|
|
208
|
+
accept: 'application/json',
|
|
209
|
+
name: 'content',
|
|
210
|
+
start,
|
|
211
|
+
limit: limit || lines.length,
|
|
212
|
+
count: job.log.length,
|
|
213
|
+
version: 2,
|
|
214
|
+
items: lines.map((line) => ({ line, type: 'NOTE', version: 2 })),
|
|
215
|
+
links: linksFor(`/compute/sessions/${job.sessionId}/jobs/${job.id}/log`, 'application/vnd.sas.compute.job.log', false, true)
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one entry point for a Viya-shaped request.
|
|
3
|
+
*
|
|
4
|
+
* A host owns its transport - express on one side, a service worker on the other
|
|
5
|
+
* - and this is where a Viya path becomes an answer. The table supplies the
|
|
6
|
+
* operations, the overlay supplies the decision, the handlers supply the body,
|
|
7
|
+
* and every answer leaves through one place so the emulated header cannot be
|
|
8
|
+
* forgotten on the paths that are easiest to forget it: a refusal and a 404.
|
|
9
|
+
*
|
|
10
|
+
* A request for a path the table does not have is a 404 that says so, and it
|
|
11
|
+
* carries the header like everything else - an emulated 404 must not be read as
|
|
12
|
+
* evidence about Viya.
|
|
13
|
+
*/
|
|
14
|
+
import type { ApiRequest, ApiResponse, Services } from '../host/dispatch.js';
|
|
15
|
+
import { type ViyaOperation } from './table.js';
|
|
16
|
+
/** An answer that states which contract produced it. */
|
|
17
|
+
export interface ViyaResponse extends ApiResponse {
|
|
18
|
+
/** Always carries `x-sasjs-emulated`, including on a 404 and a 501. */
|
|
19
|
+
headers: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
export interface ViyaMatch {
|
|
22
|
+
operation: ViyaOperation;
|
|
23
|
+
/** The values the `{}` segments carried, in order. */
|
|
24
|
+
segments: string[];
|
|
25
|
+
}
|
|
26
|
+
/** The operation a request names, ignoring case in the static segments. */
|
|
27
|
+
export declare const findViyaOperation: (method: string, path: string) => ViyaMatch | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Answer a Viya request.
|
|
30
|
+
*
|
|
31
|
+
* `request` is the same shape the SASjs dispatch takes, so a host that already
|
|
32
|
+
* resolves a caller - a session cookie - passes `subject` rather than a token.
|
|
33
|
+
*/
|
|
34
|
+
export declare const dispatchViya: (services: Services, method: string, path: string, request?: ApiRequest) => Promise<ViyaResponse>;
|
|
35
|
+
//# sourceMappingURL=dispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/viya/dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE5E,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;AAK3D,wDAAwD;AACxD,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChC;AAED,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,aAAa,CAAA;IACxB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AA4BD,2EAA2E;AAC3E,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,MAAM,EACd,MAAM,MAAM,KACX,SAAS,GAAG,SA0Bd,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GACvB,UAAU,QAAQ,EAClB,QAAQ,MAAM,EACd,MAAM,MAAM,EACZ,UAAS,UAAe,KACvB,OAAO,CAAC,YAAY,CAyFtB,CAAA"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { isApiError } from '../types.js';
|
|
2
|
+
import { VIYA_TABLE } from './table.js';
|
|
3
|
+
import { VIYA_OVERLAY } from './overlay.js';
|
|
4
|
+
import { VIYA_HANDLERS } from './service.js';
|
|
5
|
+
import { emulatedHeaders } from './version.js';
|
|
6
|
+
const escape = (segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
7
|
+
const compiled = VIYA_TABLE.filter((operation) => operation.path.includes('{}')).map((operation) => ({
|
|
8
|
+
operation,
|
|
9
|
+
pattern: new RegExp('^' +
|
|
10
|
+
operation.path
|
|
11
|
+
.split('/')
|
|
12
|
+
.map((segment) => (segment === '{}' ? '([^/]+)' : escape(segment)))
|
|
13
|
+
.join('/') +
|
|
14
|
+
'$',
|
|
15
|
+
// the static segments ignore case, as the hosts do
|
|
16
|
+
'i')
|
|
17
|
+
}));
|
|
18
|
+
const exact = new Map();
|
|
19
|
+
for (const operation of VIYA_TABLE)
|
|
20
|
+
if (!operation.path.includes('{}'))
|
|
21
|
+
// keyed in lower case, because the hosts are: express's `case sensitive
|
|
22
|
+
// routing` is off and the emulated estate has to match what they serve
|
|
23
|
+
exact.set(`${operation.method} ${operation.path}`.toLowerCase(), operation);
|
|
24
|
+
/** The operation a request names, ignoring case in the static segments. */
|
|
25
|
+
export const findViyaOperation = (method, path) => {
|
|
26
|
+
const verb = method.toUpperCase();
|
|
27
|
+
const clean = path.split('?')[0].replace(/\/+$/, '') || '/';
|
|
28
|
+
const staticHit = exact.get(`${verb} ${clean}`.toLowerCase());
|
|
29
|
+
if (staticHit)
|
|
30
|
+
return { operation: staticHit, segments: [] };
|
|
31
|
+
for (const candidate of compiled) {
|
|
32
|
+
if (candidate.operation.method !== verb)
|
|
33
|
+
continue;
|
|
34
|
+
const match = candidate.pattern.exec(clean);
|
|
35
|
+
if (match)
|
|
36
|
+
return {
|
|
37
|
+
operation: candidate.operation,
|
|
38
|
+
segments: match.slice(1).map((segment) => {
|
|
39
|
+
try {
|
|
40
|
+
return decodeURIComponent(segment);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return segment;
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
return undefined;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Answer a Viya request.
|
|
52
|
+
*
|
|
53
|
+
* `request` is the same shape the SASjs dispatch takes, so a host that already
|
|
54
|
+
* resolves a caller - a session cookie - passes `subject` rather than a token.
|
|
55
|
+
*/
|
|
56
|
+
export const dispatchViya = async (services, method, path, request = {}) => {
|
|
57
|
+
const headers = emulatedHeaders();
|
|
58
|
+
const found = findViyaOperation(method, path);
|
|
59
|
+
if (!found)
|
|
60
|
+
return {
|
|
61
|
+
status: 404,
|
|
62
|
+
headers,
|
|
63
|
+
body: {
|
|
64
|
+
version: 2,
|
|
65
|
+
httpStatusCode: 404,
|
|
66
|
+
errorCode: 404,
|
|
67
|
+
message: `No operation is emulated at ${method.toUpperCase()} ${path}. The emulated estate answers the client's call surface and nothing else.`
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const entry = VIYA_OVERLAY[found.operation.id];
|
|
71
|
+
if (!entry)
|
|
72
|
+
// the overlay refuses to import unclassified rows, so reaching here is a
|
|
73
|
+
// change that bypassed that check
|
|
74
|
+
return {
|
|
75
|
+
status: 501,
|
|
76
|
+
headers,
|
|
77
|
+
body: { message: `${found.operation.id} has no decision in the overlay.` }
|
|
78
|
+
};
|
|
79
|
+
if (!entry.implemented)
|
|
80
|
+
return {
|
|
81
|
+
status: 501,
|
|
82
|
+
headers,
|
|
83
|
+
body: {
|
|
84
|
+
message: `${found.operation.id} is not emulated. ${entry.reason ?? ''}`.trim()
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
const handler = VIYA_HANDLERS[found.operation.id];
|
|
88
|
+
if (!handler)
|
|
89
|
+
return {
|
|
90
|
+
status: 501,
|
|
91
|
+
headers,
|
|
92
|
+
body: {
|
|
93
|
+
message: `${found.operation.id} is marked implemented, but no handler answers it.`
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
try {
|
|
97
|
+
const answer = await handler({
|
|
98
|
+
services,
|
|
99
|
+
request,
|
|
100
|
+
params: {
|
|
101
|
+
id: found.segments[0],
|
|
102
|
+
segments: found.segments
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return {
|
|
106
|
+
...answer,
|
|
107
|
+
// the emulated headers are spread LAST: they are the invariant this module
|
|
108
|
+
// exists to guarantee, so a handler cannot overwrite the stamp even by
|
|
109
|
+
// returning headers of its own
|
|
110
|
+
headers: { ...answer.headers, ...headers }
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
if (isApiError(error))
|
|
115
|
+
return {
|
|
116
|
+
status: error.status,
|
|
117
|
+
headers,
|
|
118
|
+
body: error.body ?? {
|
|
119
|
+
version: 2,
|
|
120
|
+
httpStatusCode: error.status,
|
|
121
|
+
errorCode: error.status,
|
|
122
|
+
message: error.message
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
return {
|
|
126
|
+
status: 500,
|
|
127
|
+
headers,
|
|
128
|
+
body: {
|
|
129
|
+
version: 2,
|
|
130
|
+
httpStatusCode: 500,
|
|
131
|
+
errorCode: 500,
|
|
132
|
+
message: String(error?.message ?? error)
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The file family: upload, read back, rename, read content, replace content.
|
|
3
|
+
*
|
|
4
|
+
* Five operations, all answered by the drive the package already has, so nothing
|
|
5
|
+
* here stores bytes of its own: an uploaded file is a file in the drive, and
|
|
6
|
+
* reading it back is the drive's read. That is also what makes an upload visible
|
|
7
|
+
* to the folder family - the same estate holds both views.
|
|
8
|
+
*
|
|
9
|
+
* A file id is derived from its path, like a folder id: a client stores the id an
|
|
10
|
+
* upload answered and asks for it later, so the id cannot move between runs.
|
|
11
|
+
*/
|
|
12
|
+
import type { ApiResponse, Services } from '../host/dispatch.js';
|
|
13
|
+
/** What an upload answers about itself, whichever operation asked. */
|
|
14
|
+
export interface EmulatedFile {
|
|
15
|
+
name: string;
|
|
16
|
+
path: string;
|
|
17
|
+
size: number;
|
|
18
|
+
}
|
|
19
|
+
export declare const FILE_HANDLERS: Record<string, (context: {
|
|
20
|
+
services: Services;
|
|
21
|
+
request: {
|
|
22
|
+
query?: Record<string, string | undefined>;
|
|
23
|
+
body?: unknown;
|
|
24
|
+
file?: {
|
|
25
|
+
name: string;
|
|
26
|
+
contents: string | Uint8Array;
|
|
27
|
+
};
|
|
28
|
+
token?: string;
|
|
29
|
+
subject?: unknown;
|
|
30
|
+
};
|
|
31
|
+
params: Record<string, string>;
|
|
32
|
+
}) => Promise<ApiResponse>>;
|
|
33
|
+
//# sourceMappingURL=files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/viya/files.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAOhE,sEAAsE;AACtE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AA4KD,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,IAAI,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAA;SAAE,CAAA;QACtD,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,CA6E3B,CAAA"}
|