@digipair/skill-web 0.113.1 → 0.114.2
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/{index.cjs.js → dist/index.cjs.js} +146 -161
- package/{index.esm.js → dist/index.esm.js} +10257 -11705
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/{libs/skill-web → dist}/src/lib/skill-web.d.ts +1 -0
- package/dist/src/lib/skill-web.d.ts.map +1 -0
- package/package.json +26 -5
- package/index.d.ts +0 -1
- package/libs/skill-web/src/index.d.ts +0 -1
- /package/{index.cjs.d.ts → dist/index.d.ts} +0 -0
- /package/{schema.fr.json → dist/schema.fr.json} +0 -0
- /package/{schema.json → dist/schema.json} +0 -0
package/README.md
ADDED
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
3
|
var engine = require('@digipair/engine');
|
|
6
4
|
var jsdom = require('jsdom');
|
|
7
5
|
var promises = require('fs/promises');
|
|
8
6
|
var require$$1 = require('path');
|
|
9
7
|
|
|
10
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
|
-
|
|
12
|
-
var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
|
|
13
|
-
|
|
14
|
-
function _extends() {
|
|
15
|
-
_extends = Object.assign || function assign(target) {
|
|
16
|
-
for(var i = 1; i < arguments.length; i++){
|
|
17
|
-
var source = arguments[i];
|
|
18
|
-
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
19
|
-
}
|
|
20
|
-
return target;
|
|
21
|
-
};
|
|
22
|
-
return _extends.apply(this, arguments);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
8
|
var mimeTypes = {};
|
|
26
9
|
|
|
27
10
|
var require$$0 = {
|
|
@@ -10746,141 +10729,141 @@ var require$$0 = {
|
|
|
10746
10729
|
*/
|
|
10747
10730
|
|
|
10748
10731
|
(function (exports) {
|
|
10749
|
-
/**
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
var extname = require$$
|
|
10754
|
-
/**
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10758
|
-
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
10759
|
-
/**
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
|
|
10763
|
-
exports.charsets = {
|
|
10764
|
-
|
|
10765
|
-
};
|
|
10766
|
-
exports.contentType = contentType;
|
|
10767
|
-
exports.extension = extension;
|
|
10768
|
-
exports.extensions = Object.create(null);
|
|
10769
|
-
exports.lookup = lookup;
|
|
10770
|
-
exports.types = Object.create(null);
|
|
10771
|
-
// Populate the extensions/types maps
|
|
10772
|
-
populateMaps(exports.extensions, exports.types);
|
|
10773
|
-
/**
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
}
|
|
10794
|
-
/**
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
}
|
|
10815
|
-
/**
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
|
|
10821
|
-
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
}
|
|
10833
|
-
/**
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
|
|
10847
|
-
|
|
10848
|
-
}
|
|
10849
|
-
/**
|
|
10850
|
-
|
|
10851
|
-
|
|
10852
|
-
|
|
10853
|
-
|
|
10854
|
-
|
|
10855
|
-
|
|
10856
|
-
|
|
10857
|
-
|
|
10858
|
-
|
|
10859
|
-
|
|
10860
|
-
|
|
10861
|
-
|
|
10862
|
-
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
|
|
10866
|
-
|
|
10867
|
-
|
|
10868
|
-
|
|
10869
|
-
|
|
10870
|
-
|
|
10871
|
-
|
|
10872
|
-
|
|
10873
|
-
|
|
10874
|
-
|
|
10875
|
-
|
|
10876
|
-
|
|
10877
|
-
|
|
10878
|
-
|
|
10879
|
-
|
|
10880
|
-
|
|
10881
|
-
|
|
10882
|
-
}
|
|
10883
|
-
}(mimeTypes));
|
|
10732
|
+
/**
|
|
10733
|
+
* Module dependencies.
|
|
10734
|
+
* @private
|
|
10735
|
+
*/ var db = mimeDb;
|
|
10736
|
+
var extname = require$$1.extname;
|
|
10737
|
+
/**
|
|
10738
|
+
* Module variables.
|
|
10739
|
+
* @private
|
|
10740
|
+
*/ var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
10741
|
+
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
10742
|
+
/**
|
|
10743
|
+
* Module exports.
|
|
10744
|
+
* @public
|
|
10745
|
+
*/ exports.charset = charset;
|
|
10746
|
+
exports.charsets = {
|
|
10747
|
+
lookup: charset
|
|
10748
|
+
};
|
|
10749
|
+
exports.contentType = contentType;
|
|
10750
|
+
exports.extension = extension;
|
|
10751
|
+
exports.extensions = Object.create(null);
|
|
10752
|
+
exports.lookup = lookup;
|
|
10753
|
+
exports.types = Object.create(null);
|
|
10754
|
+
// Populate the extensions/types maps
|
|
10755
|
+
populateMaps(exports.extensions, exports.types);
|
|
10756
|
+
/**
|
|
10757
|
+
* Get the default charset for a MIME type.
|
|
10758
|
+
*
|
|
10759
|
+
* @param {string} type
|
|
10760
|
+
* @return {boolean|string}
|
|
10761
|
+
*/ function charset(type) {
|
|
10762
|
+
if (!type || typeof type !== 'string') {
|
|
10763
|
+
return false;
|
|
10764
|
+
}
|
|
10765
|
+
// TODO: use media-typer
|
|
10766
|
+
var match = EXTRACT_TYPE_REGEXP.exec(type);
|
|
10767
|
+
var mime = match && db[match[1].toLowerCase()];
|
|
10768
|
+
if (mime && mime.charset) {
|
|
10769
|
+
return mime.charset;
|
|
10770
|
+
}
|
|
10771
|
+
// default text/* to utf-8
|
|
10772
|
+
if (match && TEXT_TYPE_REGEXP.test(match[1])) {
|
|
10773
|
+
return 'UTF-8';
|
|
10774
|
+
}
|
|
10775
|
+
return false;
|
|
10776
|
+
}
|
|
10777
|
+
/**
|
|
10778
|
+
* Create a full Content-Type header given a MIME type or extension.
|
|
10779
|
+
*
|
|
10780
|
+
* @param {string} str
|
|
10781
|
+
* @return {boolean|string}
|
|
10782
|
+
*/ function contentType(str) {
|
|
10783
|
+
// TODO: should this even be in this module?
|
|
10784
|
+
if (!str || typeof str !== 'string') {
|
|
10785
|
+
return false;
|
|
10786
|
+
}
|
|
10787
|
+
var mime = str.indexOf('/') === -1 ? exports.lookup(str) : str;
|
|
10788
|
+
if (!mime) {
|
|
10789
|
+
return false;
|
|
10790
|
+
}
|
|
10791
|
+
// TODO: use content-type or other module
|
|
10792
|
+
if (mime.indexOf('charset') === -1) {
|
|
10793
|
+
var _$charset = exports.charset(mime);
|
|
10794
|
+
if (_$charset) mime += '; charset=' + _$charset.toLowerCase();
|
|
10795
|
+
}
|
|
10796
|
+
return mime;
|
|
10797
|
+
}
|
|
10798
|
+
/**
|
|
10799
|
+
* Get the default extension for a MIME type.
|
|
10800
|
+
*
|
|
10801
|
+
* @param {string} type
|
|
10802
|
+
* @return {boolean|string}
|
|
10803
|
+
*/ function extension(type) {
|
|
10804
|
+
if (!type || typeof type !== 'string') {
|
|
10805
|
+
return false;
|
|
10806
|
+
}
|
|
10807
|
+
// TODO: use media-typer
|
|
10808
|
+
var match = EXTRACT_TYPE_REGEXP.exec(type);
|
|
10809
|
+
// get extensions
|
|
10810
|
+
var exts = match && exports.extensions[match[1].toLowerCase()];
|
|
10811
|
+
if (!exts || !exts.length) {
|
|
10812
|
+
return false;
|
|
10813
|
+
}
|
|
10814
|
+
return exts[0];
|
|
10815
|
+
}
|
|
10816
|
+
/**
|
|
10817
|
+
* Lookup the MIME type for a file path/extension.
|
|
10818
|
+
*
|
|
10819
|
+
* @param {string} path
|
|
10820
|
+
* @return {boolean|string}
|
|
10821
|
+
*/ function lookup(path) {
|
|
10822
|
+
if (!path || typeof path !== 'string') {
|
|
10823
|
+
return false;
|
|
10824
|
+
}
|
|
10825
|
+
// get the extension ("ext" or ".ext" or full path)
|
|
10826
|
+
var _$extension = extname('x.' + path).toLowerCase().substr(1);
|
|
10827
|
+
if (!_$extension) {
|
|
10828
|
+
return false;
|
|
10829
|
+
}
|
|
10830
|
+
return exports.types[_$extension] || false;
|
|
10831
|
+
}
|
|
10832
|
+
/**
|
|
10833
|
+
* Populate the extensions and types maps.
|
|
10834
|
+
* @private
|
|
10835
|
+
*/ function populateMaps(extensions, types) {
|
|
10836
|
+
// source preference (least -> most)
|
|
10837
|
+
var preference = [
|
|
10838
|
+
'nginx',
|
|
10839
|
+
'apache',
|
|
10840
|
+
undefined,
|
|
10841
|
+
'iana'
|
|
10842
|
+
];
|
|
10843
|
+
Object.keys(db).forEach(function forEachMimeType(type) {
|
|
10844
|
+
var mime = db[type];
|
|
10845
|
+
var exts = mime.extensions;
|
|
10846
|
+
if (!exts || !exts.length) {
|
|
10847
|
+
return;
|
|
10848
|
+
}
|
|
10849
|
+
// mime -> extensions
|
|
10850
|
+
extensions[type] = exts;
|
|
10851
|
+
// extension -> mime
|
|
10852
|
+
for(var i = 0; i < exts.length; i++){
|
|
10853
|
+
var _$extension = exts[i];
|
|
10854
|
+
if (types[_$extension]) {
|
|
10855
|
+
var from = preference.indexOf(db[types[_$extension]].source);
|
|
10856
|
+
var to = preference.indexOf(mime.source);
|
|
10857
|
+
if (types[_$extension] !== 'application/octet-stream' && (from > to || from === to && types[_$extension].substr(0, 12) === 'application/')) {
|
|
10858
|
+
continue;
|
|
10859
|
+
}
|
|
10860
|
+
}
|
|
10861
|
+
// set the extension -> mime
|
|
10862
|
+
types[_$extension] = type;
|
|
10863
|
+
}
|
|
10864
|
+
});
|
|
10865
|
+
}
|
|
10866
|
+
} (mimeTypes));
|
|
10884
10867
|
|
|
10885
10868
|
let WebService = class WebService {
|
|
10886
10869
|
filteredWebPinsSettings(item, path) {
|
|
@@ -10922,11 +10905,16 @@ let WebService = class WebService {
|
|
|
10922
10905
|
return preparedPinsSettings;
|
|
10923
10906
|
}
|
|
10924
10907
|
mergeConttext(context, newContext) {
|
|
10925
|
-
const output =
|
|
10908
|
+
const output = {
|
|
10909
|
+
...context
|
|
10910
|
+
};
|
|
10926
10911
|
for(const key in newContext){
|
|
10927
10912
|
if (Object.prototype.hasOwnProperty.call(newContext, key)) {
|
|
10928
10913
|
if (key !== 'protected' && typeof newContext[key] === 'object' && newContext[key] !== null && !Array.isArray(newContext[key]) && Object.prototype.hasOwnProperty.call(context, key)) {
|
|
10929
|
-
output[key] =
|
|
10914
|
+
output[key] = {
|
|
10915
|
+
...context[key],
|
|
10916
|
+
...newContext[key]
|
|
10917
|
+
};
|
|
10930
10918
|
} else if (typeof newContext[key] !== 'undefined') {
|
|
10931
10919
|
output[key] = newContext[key];
|
|
10932
10920
|
}
|
|
@@ -10955,7 +10943,6 @@ let WebService = class WebService {
|
|
|
10955
10943
|
}
|
|
10956
10944
|
}
|
|
10957
10945
|
async page(params, _pinsSettingsList, context) {
|
|
10958
|
-
var _context_request_body;
|
|
10959
10946
|
const { body, head, ssr = true, styleHtml = '', styleBody = '', factoryInitialize = [], browserInitialize = [], browserLoad = [], confirmBeforeUnload = 'false' } = params;
|
|
10960
10947
|
const engineVersion = context.config.VERSIONS['@digipair/engine'] || 'latest';
|
|
10961
10948
|
const preparedData = {};
|
|
@@ -10984,10 +10971,9 @@ let WebService = class WebService {
|
|
|
10984
10971
|
status: 'not found'
|
|
10985
10972
|
};
|
|
10986
10973
|
}
|
|
10987
|
-
if (context.config.VERSIONS[library]) {
|
|
10988
|
-
var _infos_keywords, _infos_keywords1;
|
|
10974
|
+
if (library === '@digipair/engine' || context.config.VERSIONS[library]) {
|
|
10989
10975
|
const infos = require(`${library}/package.json`);
|
|
10990
|
-
if (!(
|
|
10976
|
+
if (!(infos.keywords?.indexOf('digipair') >= 0 && infos.keywords?.indexOf('web') >= 0)) {
|
|
10991
10977
|
context.protected.res.status(404);
|
|
10992
10978
|
return {
|
|
10993
10979
|
status: 'not found'
|
|
@@ -11007,14 +10993,13 @@ let WebService = class WebService {
|
|
|
11007
10993
|
}
|
|
11008
10994
|
return result;
|
|
11009
10995
|
}
|
|
11010
|
-
if (context.request.method === 'POST' &&
|
|
10996
|
+
if (context.request.method === 'POST' && context.request.body?.type === 'DIGIPAIR_EXECUTE_FACTORY') {
|
|
11011
10997
|
const param = context.request.body.params.path.split('[')[0];
|
|
11012
10998
|
const pinsSettingsList = this.findFactoryPinsSettings(context.request.body.params.path, params[param]);
|
|
11013
10999
|
return JSON.stringify(await engine.executePinsList(pinsSettingsList, this.mergeConttext(context.request.body.context, context), `${context.request.body.params.path}.execute`));
|
|
11014
11000
|
}
|
|
11015
11001
|
const path = context.protected.req.path.replace(/\/$/g, '');
|
|
11016
|
-
|
|
11017
|
-
const baseUrl = ((_context_request_headers_xforwardedproto = context.request.headers['x-forwarded-proto']) != null ? _context_request_headers_xforwardedproto : context.protected.req.protocol) + '://' + context.request.headers.host + (context.request.params.length <= 0 || context.request.params[0] === '' ? path : path.substring(0, path.length - context.request.params.join('/').length - 1)) + '/__digipair_www__';
|
|
11002
|
+
const baseUrl = (context.request.headers['x-forwarded-proto'] ?? context.protected.req.protocol) + '://' + context.request.headers.host + (context.request.params.length <= 0 || context.request.params[0] === '' ? path : path.substring(0, path.length - context.request.params.join('/').length - 1)) + '/__digipair_www__';
|
|
11018
11003
|
await engine.executePinsList(factoryInitialize, context, `${context.__PATH__}.factoryInitialize`);
|
|
11019
11004
|
const html = `
|
|
11020
11005
|
<!DOCTYPE html>
|