@sasjs/api 0.17.3 → 0.17.5
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 +16 -6
- package/build/cjs/corpus/session.js +5 -1
- package/build/cjs/routes/index.js +14 -3
- package/build/cjs/session/memory-host.js +7 -1
- package/build/esm/corpus/session.d.ts.map +1 -1
- package/build/esm/corpus/session.js +5 -1
- package/build/esm/routes/index.d.ts.map +1 -1
- package/build/esm/routes/index.js +14 -3
- package/build/esm/session/memory-host.d.ts.map +1 -1
- package/build/esm/session/memory-host.js +7 -1
- package/package.json +1 -1
package/build/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @sasjs/api 0.17.
|
|
1
|
+
/* @sasjs/api 0.17.5 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
|
|
2
2
|
"use strict";
|
|
3
3
|
var SASjsApi = (() => {
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
@@ -2839,17 +2839,17 @@ var SASjsApi = (() => {
|
|
|
2839
2839
|
}
|
|
2840
2840
|
return escape(segment);
|
|
2841
2841
|
}).join("/");
|
|
2842
|
-
return { route, keys, regex: new RegExp("^" + pattern + "/?$") };
|
|
2842
|
+
return { route, keys, regex: new RegExp("^" + pattern + "/?$", "i") };
|
|
2843
2843
|
}
|
|
2844
2844
|
);
|
|
2845
2845
|
var exact = /* @__PURE__ */ new Map();
|
|
2846
2846
|
for (const route of ROUTES)
|
|
2847
2847
|
if (!route.path.includes("{"))
|
|
2848
|
-
exact.set(route.method + " " + route.path, route);
|
|
2848
|
+
exact.set(route.method + " " + route.path.toLowerCase(), route);
|
|
2849
2849
|
var findRoute = (method, path) => {
|
|
2850
2850
|
const verb = method.toUpperCase();
|
|
2851
2851
|
const clean = path.split("?")[0].replace(/\/+$/, "") || "/";
|
|
2852
|
-
const hit = exact.get(verb + " " + clean);
|
|
2852
|
+
const hit = exact.get(verb + " " + clean.toLowerCase());
|
|
2853
2853
|
if (hit) return { route: hit, params: {} };
|
|
2854
2854
|
for (const candidate of compiled) {
|
|
2855
2855
|
if (candidate.route.method !== verb) continue;
|
|
@@ -5276,13 +5276,17 @@ var SASjsApi = (() => {
|
|
|
5276
5276
|
route: "GET /SASjsApi/session/{sessionId}",
|
|
5277
5277
|
description: "answers an administrator another account's session",
|
|
5278
5278
|
request: { subject: ADMIN, params: { sessionId: "sess-restricted" } },
|
|
5279
|
+
// both stamps: the document requires them, and this host stamps a session's
|
|
5280
|
+
// death time at creation rather than at completion - a running session
|
|
5281
|
+
// answers with the moment it is due to be destroyed
|
|
5279
5282
|
expect: {
|
|
5280
5283
|
status: 200,
|
|
5281
5284
|
body: {
|
|
5282
5285
|
sessionId: "sess-restricted",
|
|
5283
5286
|
state: "running",
|
|
5284
5287
|
pid: 4243,
|
|
5285
|
-
creationTimeStamp: "2026-11-07T09:05:00.000Z"
|
|
5288
|
+
creationTimeStamp: "2026-11-07T09:05:00.000Z",
|
|
5289
|
+
deathTimeStamp: "2026-11-07T09:20:00.000Z"
|
|
5286
5290
|
}
|
|
5287
5291
|
}
|
|
5288
5292
|
},
|
|
@@ -5448,7 +5452,13 @@ var SASjsApi = (() => {
|
|
|
5448
5452
|
sessionId: "sess-restricted",
|
|
5449
5453
|
state: "running",
|
|
5450
5454
|
pid: 4243,
|
|
5451
|
-
creationTimeStamp: "2026-11-07T09:05:00.000Z"
|
|
5455
|
+
creationTimeStamp: "2026-11-07T09:05:00.000Z",
|
|
5456
|
+
// the document makes both stamps required, and a real session carries
|
|
5457
|
+
// the death stamp from the moment it is created: sasjs/server writes
|
|
5458
|
+
// creation + its default lifetime, which is what a poller reads to know
|
|
5459
|
+
// when the folder will be gone. A running session without one is a shape
|
|
5460
|
+
// no host produces.
|
|
5461
|
+
deathTimeStamp: "2026-11-07T09:20:00.000Z"
|
|
5452
5462
|
}
|
|
5453
5463
|
},
|
|
5454
5464
|
"sess-silent": {
|
|
@@ -29,13 +29,17 @@ exports.SESSION_CORPUS = [
|
|
|
29
29
|
route: 'GET /SASjsApi/session/{sessionId}',
|
|
30
30
|
description: "answers an administrator another account's session",
|
|
31
31
|
request: { subject: ADMIN, params: { sessionId: 'sess-restricted' } },
|
|
32
|
+
// both stamps: the document requires them, and this host stamps a session's
|
|
33
|
+
// death time at creation rather than at completion - a running session
|
|
34
|
+
// answers with the moment it is due to be destroyed
|
|
32
35
|
expect: {
|
|
33
36
|
status: 200,
|
|
34
37
|
body: {
|
|
35
38
|
sessionId: 'sess-restricted',
|
|
36
39
|
state: 'running',
|
|
37
40
|
pid: 4243,
|
|
38
|
-
creationTimeStamp: '2026-11-07T09:05:00.000Z'
|
|
41
|
+
creationTimeStamp: '2026-11-07T09:05:00.000Z',
|
|
42
|
+
deathTimeStamp: '2026-11-07T09:20:00.000Z'
|
|
39
43
|
}
|
|
40
44
|
}
|
|
41
45
|
},
|
|
@@ -69,6 +69,17 @@ const escape = (segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
|
69
69
|
* Compiles a documented path into a matcher. The table is static, so this runs
|
|
70
70
|
* once at import; `findRoute` then tests exact paths first (most of the API is
|
|
71
71
|
* static) and only falls through to the templates for `{uid}`-style paths.
|
|
72
|
+
*
|
|
73
|
+
* Both matchers ignore case in the path's static segments, because the host
|
|
74
|
+
* does: express's `case sensitive routing` is off unless a server turns it on,
|
|
75
|
+
* and `sasjs/server` does not, so `/SASjsApi/drive/fileTree` reaches the
|
|
76
|
+
* handler documented as `filetree`. A matcher that compared the strings would
|
|
77
|
+
* answer 404 for a request the server serves - and did: the server's own front
|
|
78
|
+
* end calls the route with a capital T.
|
|
79
|
+
*
|
|
80
|
+
* The `i` flag applies to the static segments and to the parameter pattern; a
|
|
81
|
+
* captured value keeps the case it was sent with, which is what a host needs to
|
|
82
|
+
* look a user or a file up.
|
|
72
83
|
*/
|
|
73
84
|
const compiled = exports.ROUTES.filter((route) => route.path.includes('{')).map((route) => {
|
|
74
85
|
const keys = [];
|
|
@@ -82,12 +93,12 @@ const compiled = exports.ROUTES.filter((route) => route.path.includes('{')).map(
|
|
|
82
93
|
return escape(segment);
|
|
83
94
|
})
|
|
84
95
|
.join('/');
|
|
85
|
-
return { route, keys, regex: new RegExp('^' + pattern + '/?$') };
|
|
96
|
+
return { route, keys, regex: new RegExp('^' + pattern + '/?$', 'i') };
|
|
86
97
|
});
|
|
87
98
|
const exact = new Map();
|
|
88
99
|
for (const route of exports.ROUTES)
|
|
89
100
|
if (!route.path.includes('{'))
|
|
90
|
-
exact.set(route.method + ' ' + route.path, route);
|
|
101
|
+
exact.set(route.method + ' ' + route.path.toLowerCase(), route);
|
|
91
102
|
/**
|
|
92
103
|
* The route a request names, or undefined when the API has no such operation.
|
|
93
104
|
*
|
|
@@ -98,7 +109,7 @@ for (const route of exports.ROUTES)
|
|
|
98
109
|
const findRoute = (method, path) => {
|
|
99
110
|
const verb = method.toUpperCase();
|
|
100
111
|
const clean = path.split('?')[0].replace(/\/+$/, '') || '/';
|
|
101
|
-
const hit = exact.get(verb + ' ' + clean);
|
|
112
|
+
const hit = exact.get(verb + ' ' + clean.toLowerCase());
|
|
102
113
|
if (hit)
|
|
103
114
|
return { route: hit, params: {} };
|
|
104
115
|
for (const candidate of compiled) {
|
|
@@ -27,7 +27,13 @@ exports.DEFAULT_SESSIONS = {
|
|
|
27
27
|
sessionId: 'sess-restricted',
|
|
28
28
|
state: 'running',
|
|
29
29
|
pid: 4243,
|
|
30
|
-
creationTimeStamp: '2026-11-07T09:05:00.000Z'
|
|
30
|
+
creationTimeStamp: '2026-11-07T09:05:00.000Z',
|
|
31
|
+
// the document makes both stamps required, and a real session carries
|
|
32
|
+
// the death stamp from the moment it is created: sasjs/server writes
|
|
33
|
+
// creation + its default lifetime, which is what a poller reads to know
|
|
34
|
+
// when the folder will be gone. A running session without one is a shape
|
|
35
|
+
// no host produces.
|
|
36
|
+
deathTimeStamp: '2026-11-07T09:20:00.000Z'
|
|
31
37
|
}
|
|
32
38
|
},
|
|
33
39
|
'sess-silent': {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/corpus/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAQ5C,eAAO,MAAM,cAAc,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../../src/corpus/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAQ5C,eAAO,MAAM,cAAc,EAAE,UAAU,EA4ItC,CAAA"}
|
|
@@ -26,13 +26,17 @@ export const SESSION_CORPUS = [
|
|
|
26
26
|
route: 'GET /SASjsApi/session/{sessionId}',
|
|
27
27
|
description: "answers an administrator another account's session",
|
|
28
28
|
request: { subject: ADMIN, params: { sessionId: 'sess-restricted' } },
|
|
29
|
+
// both stamps: the document requires them, and this host stamps a session's
|
|
30
|
+
// death time at creation rather than at completion - a running session
|
|
31
|
+
// answers with the moment it is due to be destroyed
|
|
29
32
|
expect: {
|
|
30
33
|
status: 200,
|
|
31
34
|
body: {
|
|
32
35
|
sessionId: 'sess-restricted',
|
|
33
36
|
state: 'running',
|
|
34
37
|
pid: 4243,
|
|
35
|
-
creationTimeStamp: '2026-11-07T09:05:00.000Z'
|
|
38
|
+
creationTimeStamp: '2026-11-07T09:05:00.000Z',
|
|
39
|
+
deathTimeStamp: '2026-11-07T09:20:00.000Z'
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,aAAa,CAAA;AA4DvD,eAAO,MAAM,MAAM,EAAE,KAAK,EAAgC,CAAA;AAW1D,4EAA4E;AAC5E,eAAO,MAAM,SAAS,GAAI,IAAI,MAAM,KAAG,KAAK,GAAG,SAAyB,CAAA;AAExE,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,KAAK,CAAA;IACZ,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/index.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,KAAK,EAAiB,MAAM,aAAa,CAAA;AA4DvD,eAAO,MAAM,MAAM,EAAE,KAAK,EAAgC,CAAA;AAW1D,4EAA4E;AAC5E,eAAO,MAAM,SAAS,GAAI,IAAI,MAAM,KAAG,KAAK,GAAG,SAAyB,CAAA;AAExE,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,KAAK,CAAA;IACZ,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B;AA2CD;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,GACpB,QAAQ,MAAM,EACd,MAAM,MAAM,KACX,UAAU,GAAG,SAuBf,CAAA"}
|
|
@@ -65,6 +65,17 @@ const escape = (segment) => segment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
|
65
65
|
* Compiles a documented path into a matcher. The table is static, so this runs
|
|
66
66
|
* once at import; `findRoute` then tests exact paths first (most of the API is
|
|
67
67
|
* static) and only falls through to the templates for `{uid}`-style paths.
|
|
68
|
+
*
|
|
69
|
+
* Both matchers ignore case in the path's static segments, because the host
|
|
70
|
+
* does: express's `case sensitive routing` is off unless a server turns it on,
|
|
71
|
+
* and `sasjs/server` does not, so `/SASjsApi/drive/fileTree` reaches the
|
|
72
|
+
* handler documented as `filetree`. A matcher that compared the strings would
|
|
73
|
+
* answer 404 for a request the server serves - and did: the server's own front
|
|
74
|
+
* end calls the route with a capital T.
|
|
75
|
+
*
|
|
76
|
+
* The `i` flag applies to the static segments and to the parameter pattern; a
|
|
77
|
+
* captured value keeps the case it was sent with, which is what a host needs to
|
|
78
|
+
* look a user or a file up.
|
|
68
79
|
*/
|
|
69
80
|
const compiled = ROUTES.filter((route) => route.path.includes('{')).map((route) => {
|
|
70
81
|
const keys = [];
|
|
@@ -78,12 +89,12 @@ const compiled = ROUTES.filter((route) => route.path.includes('{')).map((route)
|
|
|
78
89
|
return escape(segment);
|
|
79
90
|
})
|
|
80
91
|
.join('/');
|
|
81
|
-
return { route, keys, regex: new RegExp('^' + pattern + '/?$') };
|
|
92
|
+
return { route, keys, regex: new RegExp('^' + pattern + '/?$', 'i') };
|
|
82
93
|
});
|
|
83
94
|
const exact = new Map();
|
|
84
95
|
for (const route of ROUTES)
|
|
85
96
|
if (!route.path.includes('{'))
|
|
86
|
-
exact.set(route.method + ' ' + route.path, route);
|
|
97
|
+
exact.set(route.method + ' ' + route.path.toLowerCase(), route);
|
|
87
98
|
/**
|
|
88
99
|
* The route a request names, or undefined when the API has no such operation.
|
|
89
100
|
*
|
|
@@ -94,7 +105,7 @@ for (const route of ROUTES)
|
|
|
94
105
|
export const findRoute = (method, path) => {
|
|
95
106
|
const verb = method.toUpperCase();
|
|
96
107
|
const clean = path.split('?')[0].replace(/\/+$/, '') || '/';
|
|
97
|
-
const hit = exact.get(verb + ' ' + clean);
|
|
108
|
+
const hit = exact.get(verb + ' ' + clean.toLowerCase());
|
|
98
109
|
if (hit)
|
|
99
110
|
return { route: hit, params: {} };
|
|
100
111
|
for (const candidate of compiled) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-host.d.ts","sourceRoot":"","sources":["../../../src/session/memory-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,eAAe,EACf,WAAW,EACX,oBAAoB,EACrB,MAAM,cAAc,CAAA;AAErB;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,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
sessionId: 'sess-restricted',
|
|
25
25
|
state: 'running',
|
|
26
26
|
pid: 4243,
|
|
27
|
-
creationTimeStamp: '2026-11-07T09:05:00.000Z'
|
|
27
|
+
creationTimeStamp: '2026-11-07T09:05:00.000Z',
|
|
28
|
+
// the document makes both stamps required, and a real session carries
|
|
29
|
+
// the death stamp from the moment it is created: sasjs/server writes
|
|
30
|
+
// creation + its default lifetime, which is what a poller reads to know
|
|
31
|
+
// when the folder will be gone. A running session without one is a shape
|
|
32
|
+
// no host produces.
|
|
33
|
+
deathTimeStamp: '2026-11-07T09:20:00.000Z'
|
|
28
34
|
}
|
|
29
35
|
},
|
|
30
36
|
'sess-silent': {
|
package/package.json
CHANGED