@sasjs/api 0.44.3 → 0.44.4
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 +10 -6
- package/build/cjs/host/dispatch.js +27 -15
- package/build/esm/host/dispatch.d.ts.map +1 -1
- package/build/esm/host/dispatch.js +27 -15
- package/package.json +1 -1
package/build/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @sasjs/api 0.44.
|
|
1
|
+
/* @sasjs/api 0.44.4 - 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;
|
|
@@ -6790,11 +6790,15 @@ var SASjsApi = (() => {
|
|
|
6790
6790
|
}
|
|
6791
6791
|
};
|
|
6792
6792
|
var APP_ENTRY_FILE = "index.html";
|
|
6793
|
-
var
|
|
6793
|
+
var layoutOf = (value) => {
|
|
6794
|
+
if (value === void 0) return void 0;
|
|
6794
6795
|
if (typeof value === "boolean") return value;
|
|
6795
|
-
if (value === "
|
|
6796
|
-
|
|
6797
|
-
|
|
6796
|
+
if (typeof value === "string") {
|
|
6797
|
+
const text2 = value.trim().toLowerCase();
|
|
6798
|
+
if (text2 === "true") return true;
|
|
6799
|
+
if (text2 === "false") return false;
|
|
6800
|
+
}
|
|
6801
|
+
throw new ApiError(400, '"layout" must be a boolean.');
|
|
6798
6802
|
};
|
|
6799
6803
|
var APP_NOT_REGISTERED = "No App Stream is registered with that id.";
|
|
6800
6804
|
var appNotRegistered = () => new ApiError(404, APP_NOT_REGISTERED, {
|
|
@@ -7417,7 +7421,7 @@ var SASjsApi = (() => {
|
|
|
7417
7421
|
filePath: body.filePath,
|
|
7418
7422
|
// the body is rebuilt field by field here, so a flag the service reads
|
|
7419
7423
|
// has to be named or the request's own answer is lost on the way
|
|
7420
|
-
layout:
|
|
7424
|
+
layout: layoutOf(body.layout)
|
|
7421
7425
|
})
|
|
7422
7426
|
};
|
|
7423
7427
|
case "GET /SASjsApi/info/authorizedRoutes":
|
|
@@ -108,23 +108,35 @@ const APP_ENTRY_FILE = 'index.html';
|
|
|
108
108
|
/**
|
|
109
109
|
* A body field the document states as a boolean, read the way the server reads it.
|
|
110
110
|
*
|
|
111
|
-
* The server validates this one with `Joi.boolean()`, which converts
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
111
|
+
* The server validates this one with `Joi.boolean()`, which converts real booleans
|
|
112
|
+
* and the string spellings of them - case-insensitively, and trimmed, as Joi 18
|
|
113
|
+
* does - and refuses every other shape. Both halves are reproduced here: a client
|
|
114
|
+
* that sent the string `"false"` and had its buffer laid out anyway would find two
|
|
115
|
+
* hosts disagreeing about which button it pressed.
|
|
116
|
+
*
|
|
117
|
+
* The conversion is limited to strings on purpose. `String(value)` would also read
|
|
118
|
+
* shapes the schema refuses - a one-element array `["true"]` stringifies to
|
|
119
|
+
* `'true'` - so a non-string, non-boolean value is not looked at, it is refused.
|
|
120
|
+
*
|
|
121
|
+
* A value that cannot be read is refused rather than guessed at, with the answer an
|
|
122
|
+
* installation gives it: `"yes"` is a caller's bug, and reading it as the default
|
|
123
|
+
* leaves that bug unanswered. `replaceOf` refuses its own boolean field for the
|
|
124
|
+
* same reason, though not by the same rules - an empty string there means the query
|
|
125
|
+
* parameter was not stated, and for this body field the schema refuses it.
|
|
119
126
|
*/
|
|
120
|
-
const
|
|
127
|
+
const layoutOf = (value) => {
|
|
128
|
+
if (value === undefined)
|
|
129
|
+
return undefined;
|
|
121
130
|
if (typeof value === 'boolean')
|
|
122
131
|
return value;
|
|
123
|
-
if (value === '
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
132
|
+
if (typeof value === 'string') {
|
|
133
|
+
const text = value.trim().toLowerCase();
|
|
134
|
+
if (text === 'true')
|
|
135
|
+
return true;
|
|
136
|
+
if (text === 'false')
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
throw new types_js_1.ApiError(400, '"layout" must be a boolean.');
|
|
128
140
|
};
|
|
129
141
|
/**
|
|
130
142
|
* An app the index does not hold, in the wording the route answers with.
|
|
@@ -793,7 +805,7 @@ const dispatch = async (services, routeId, request = {}) => {
|
|
|
793
805
|
filePath: body.filePath,
|
|
794
806
|
// the body is rebuilt field by field here, so a flag the service reads
|
|
795
807
|
// has to be named or the request's own answer is lost on the way
|
|
796
|
-
layout:
|
|
808
|
+
layout: layoutOf(body.layout)
|
|
797
809
|
})
|
|
798
810
|
};
|
|
799
811
|
case 'GET /SASjsApi/info/authorizedRoutes':
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/host/dispatch.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AASvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM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D,eAAO,MAAM,cAAc,EAAE,MAAM,EA+DlC,CAAA"}
|
|
@@ -105,23 +105,35 @@ const APP_ENTRY_FILE = 'index.html';
|
|
|
105
105
|
/**
|
|
106
106
|
* A body field the document states as a boolean, read the way the server reads it.
|
|
107
107
|
*
|
|
108
|
-
* The server validates this one with `Joi.boolean()`, which converts
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
108
|
+
* The server validates this one with `Joi.boolean()`, which converts real booleans
|
|
109
|
+
* and the string spellings of them - case-insensitively, and trimmed, as Joi 18
|
|
110
|
+
* does - and refuses every other shape. Both halves are reproduced here: a client
|
|
111
|
+
* that sent the string `"false"` and had its buffer laid out anyway would find two
|
|
112
|
+
* hosts disagreeing about which button it pressed.
|
|
113
|
+
*
|
|
114
|
+
* The conversion is limited to strings on purpose. `String(value)` would also read
|
|
115
|
+
* shapes the schema refuses - a one-element array `["true"]` stringifies to
|
|
116
|
+
* `'true'` - so a non-string, non-boolean value is not looked at, it is refused.
|
|
117
|
+
*
|
|
118
|
+
* A value that cannot be read is refused rather than guessed at, with the answer an
|
|
119
|
+
* installation gives it: `"yes"` is a caller's bug, and reading it as the default
|
|
120
|
+
* leaves that bug unanswered. `replaceOf` refuses its own boolean field for the
|
|
121
|
+
* same reason, though not by the same rules - an empty string there means the query
|
|
122
|
+
* parameter was not stated, and for this body field the schema refuses it.
|
|
116
123
|
*/
|
|
117
|
-
const
|
|
124
|
+
const layoutOf = (value) => {
|
|
125
|
+
if (value === undefined)
|
|
126
|
+
return undefined;
|
|
118
127
|
if (typeof value === 'boolean')
|
|
119
128
|
return value;
|
|
120
|
-
if (value === '
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
129
|
+
if (typeof value === 'string') {
|
|
130
|
+
const text = value.trim().toLowerCase();
|
|
131
|
+
if (text === 'true')
|
|
132
|
+
return true;
|
|
133
|
+
if (text === 'false')
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
throw new ApiError(400, '"layout" must be a boolean.');
|
|
125
137
|
};
|
|
126
138
|
/**
|
|
127
139
|
* An app the index does not hold, in the wording the route answers with.
|
|
@@ -790,7 +802,7 @@ export const dispatch = async (services, routeId, request = {}) => {
|
|
|
790
802
|
filePath: body.filePath,
|
|
791
803
|
// the body is rebuilt field by field here, so a flag the service reads
|
|
792
804
|
// has to be named or the request's own answer is lost on the way
|
|
793
|
-
layout:
|
|
805
|
+
layout: layoutOf(body.layout)
|
|
794
806
|
})
|
|
795
807
|
};
|
|
796
808
|
case 'GET /SASjsApi/info/authorizedRoutes':
|
package/package.json
CHANGED