@digipair/skill-s3 0.136.3 → 0.136.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.
@@ -1,24 +1,17 @@
1
- import { B as evaluateCondition, D as EndpointError, F as evaluateExpression, G as getEndpointHeaders, J as getEndpointProperties, K as getEndpointUrl } from './index.esm3.js';
1
+ import { P as ProviderError, ak as IniSectionType, k as CONFIG_PREFIX_SEPARATOR, r as readFile, al as getConfigFilepath, am as parseIni } from './index.esm2.js';
2
2
 
3
- function _class_call_check$1(instance, Constructor) {
4
- if (!(instance instanceof Constructor)) {
5
- throw new TypeError("Cannot call a class as a function");
3
+ function _assert_this_initialized(self) {
4
+ if (self === void 0) {
5
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
6
6
  }
7
+ return self;
7
8
  }
8
- function _defineProperties$1(target, props) {
9
- for(var i = 0; i < props.length; i++){
10
- var descriptor = props[i];
11
- descriptor.enumerable = descriptor.enumerable || false;
12
- descriptor.configurable = true;
13
- if ("value" in descriptor) descriptor.writable = true;
14
- Object.defineProperty(target, descriptor.key, descriptor);
9
+ function _class_call_check(instance, Constructor) {
10
+ if (!(instance instanceof Constructor)) {
11
+ throw new TypeError("Cannot call a class as a function");
15
12
  }
16
13
  }
17
- function _create_class$1(Constructor, protoProps, staticProps) {
18
- if (staticProps) _defineProperties$1(Constructor, staticProps);
19
- return Constructor;
20
- }
21
- function _define_property(obj, key, value) {
14
+ function _define_property$1(obj, key, value) {
22
15
  if (key in obj) {
23
16
  Object.defineProperty(obj, key, {
24
17
  value: value,
@@ -31,28 +24,80 @@ function _define_property(obj, key, value) {
31
24
  }
32
25
  return obj;
33
26
  }
34
- var BinaryDecisionDiagram = /*#__PURE__*/ function() {
35
- function BinaryDecisionDiagram(bdd, root, conditions, results) {
36
- _class_call_check$1(this, BinaryDecisionDiagram);
37
- _define_property(this, "nodes", void 0);
38
- _define_property(this, "root", void 0);
39
- _define_property(this, "conditions", void 0);
40
- _define_property(this, "results", void 0);
41
- this.nodes = bdd;
42
- this.root = root;
43
- this.conditions = conditions;
44
- this.results = results;
27
+ function _get_prototype_of(o) {
28
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
29
+ return o.__proto__ || Object.getPrototypeOf(o);
30
+ };
31
+ return _get_prototype_of(o);
32
+ }
33
+ function _inherits(subClass, superClass) {
34
+ if (typeof superClass !== "function" && superClass !== null) {
35
+ throw new TypeError("Super expression must either be null or a function");
45
36
  }
46
- _create_class$1(BinaryDecisionDiagram, null, [
47
- {
48
- key: "from",
49
- value: function from(bdd, root, conditions, results) {
50
- return new BinaryDecisionDiagram(bdd, root, conditions, results);
51
- }
37
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
38
+ constructor: {
39
+ value: subClass,
40
+ writable: true,
41
+ configurable: true
52
42
  }
53
- ]);
54
- return BinaryDecisionDiagram;
55
- }();
43
+ });
44
+ if (superClass) _set_prototype_of(subClass, superClass);
45
+ }
46
+ function _possible_constructor_return(self, call) {
47
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
48
+ return call;
49
+ }
50
+ return _assert_this_initialized(self);
51
+ }
52
+ function _set_prototype_of(o, p) {
53
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
54
+ o.__proto__ = p;
55
+ return o;
56
+ };
57
+ return _set_prototype_of(o, p);
58
+ }
59
+ function _type_of(obj) {
60
+ "@swc/helpers - typeof";
61
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
62
+ }
63
+ function _is_native_reflect_construct() {
64
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
65
+ if (Reflect.construct.sham) return false;
66
+ if (typeof Proxy === "function") return true;
67
+ try {
68
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
69
+ return true;
70
+ } catch (e) {
71
+ return false;
72
+ }
73
+ }
74
+ function _create_super(Derived) {
75
+ var hasNativeReflectConstruct = _is_native_reflect_construct();
76
+ return function _createSuperInternal() {
77
+ var Super = _get_prototype_of(Derived), result;
78
+ if (hasNativeReflectConstruct) {
79
+ var NewTarget = _get_prototype_of(this).constructor;
80
+ result = Reflect.construct(Super, arguments, NewTarget);
81
+ } else {
82
+ result = Super.apply(this, arguments);
83
+ }
84
+ return _possible_constructor_return(this, result);
85
+ };
86
+ }
87
+ var TokenProviderError = /*#__PURE__*/ function(ProviderError) {
88
+ _inherits(TokenProviderError, ProviderError);
89
+ var _super = _create_super(TokenProviderError);
90
+ function TokenProviderError(message) {
91
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
92
+ _class_call_check(this, TokenProviderError);
93
+ var _this;
94
+ _this = _super.call(this, message, options);
95
+ _define_property$1(_assert_this_initialized(_this), "name", "TokenProviderError");
96
+ Object.setPrototypeOf(_assert_this_initialized(_this), TokenProviderError.prototype);
97
+ return _this;
98
+ }
99
+ return TokenProviderError;
100
+ }(ProviderError);
56
101
 
57
102
  function _array_like_to_array(arr, len) {
58
103
  if (len == null || len > arr.length) len = arr.length;
@@ -62,6 +107,19 @@ function _array_like_to_array(arr, len) {
62
107
  function _array_with_holes(arr) {
63
108
  if (Array.isArray(arr)) return arr;
64
109
  }
110
+ function _define_property(obj, key, value) {
111
+ if (key in obj) {
112
+ Object.defineProperty(obj, key, {
113
+ value: value,
114
+ enumerable: true,
115
+ configurable: true,
116
+ writable: true
117
+ });
118
+ } else {
119
+ obj[key] = value;
120
+ }
121
+ return obj;
122
+ }
65
123
  function _iterable_to_array_limit(arr, i) {
66
124
  var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
67
125
  if (_i == null) return;
@@ -89,6 +147,40 @@ function _iterable_to_array_limit(arr, i) {
89
147
  function _non_iterable_rest() {
90
148
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
91
149
  }
150
+ function _object_spread(target) {
151
+ for(var i = 1; i < arguments.length; i++){
152
+ var source = arguments[i] != null ? arguments[i] : {};
153
+ var ownKeys = Object.keys(source);
154
+ if (typeof Object.getOwnPropertySymbols === "function") {
155
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
156
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
157
+ }));
158
+ }
159
+ ownKeys.forEach(function(key) {
160
+ _define_property(target, key, source[key]);
161
+ });
162
+ }
163
+ return target;
164
+ }
165
+ function ownKeys(object, enumerableOnly) {
166
+ var keys = Object.keys(object);
167
+ if (Object.getOwnPropertySymbols) {
168
+ var symbols = Object.getOwnPropertySymbols(object);
169
+ keys.push.apply(keys, symbols);
170
+ }
171
+ return keys;
172
+ }
173
+ function _object_spread_props(target, source) {
174
+ source = source != null ? source : {};
175
+ if (Object.getOwnPropertyDescriptors) {
176
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
177
+ } else {
178
+ ownKeys(Object(source)).forEach(function(key) {
179
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
180
+ });
181
+ }
182
+ return target;
183
+ }
92
184
  function _sliced_to_array(arr, i) {
93
185
  return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
94
186
  }
@@ -100,49 +192,14 @@ function _unsupported_iterable_to_array(o, minLen) {
100
192
  if (n === "Map" || n === "Set") return Array.from(n);
101
193
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
102
194
  }
103
- var RESULT = 100000000;
104
- var decideEndpoint = function(bdd, options) {
105
- var nodes = bdd.nodes, root = bdd.root, results = bdd.results, conditions = bdd.conditions;
106
- var ref = root;
107
- var referenceRecord = {};
108
- var closure = {
109
- referenceRecord: referenceRecord,
110
- endpointParams: options.endpointParams,
111
- logger: options.logger
112
- };
113
- while(ref !== 1 && ref !== -1 && ref < RESULT){
114
- var node_i = 3 * (Math.abs(ref) - 1);
115
- var _ref = [
116
- nodes[node_i],
117
- nodes[node_i + 1],
118
- nodes[node_i + 2]
119
- ], condition_i = _ref[0], highRef = _ref[1], lowRef = _ref[2];
120
- var _conditions_condition_i = _sliced_to_array(conditions[condition_i], 3), fn = _conditions_condition_i[0], argv = _conditions_condition_i[1], assign = _conditions_condition_i[2];
121
- var evaluation = evaluateCondition({
122
- fn: fn,
123
- assign: assign,
124
- argv: argv
125
- }, closure);
126
- if (evaluation.toAssign) {
127
- var _evaluation_toAssign = evaluation.toAssign, name = _evaluation_toAssign.name, value = _evaluation_toAssign.value;
128
- referenceRecord[name] = value;
129
- }
130
- ref = ref >= 0 === evaluation.result ? highRef : lowRef;
131
- }
132
- if (ref >= RESULT) {
133
- var result = results[ref - RESULT];
134
- if (result[0] === -1) {
135
- var _result = _sliced_to_array(result, 2), errorExpression = _result[1];
136
- throw new EndpointError(evaluateExpression(errorExpression, "Error", closure));
137
- }
138
- var _result1 = _sliced_to_array(result, 3), url = _result1[0], properties = _result1[1], headers = _result1[2];
139
- return {
140
- url: getEndpointUrl(url, closure),
141
- properties: getEndpointProperties(properties, closure),
142
- headers: getEndpointHeaders(headers !== null && headers !== void 0 ? headers : {}, closure)
143
- };
144
- }
145
- throw new EndpointError("No matching endpoint.");
195
+ var getSsoSessionData = function(data) {
196
+ return Object.entries(data).filter(function(param) {
197
+ var _param = _sliced_to_array(param, 1), key = _param[0];
198
+ return key.startsWith(IniSectionType.SSO_SESSION + CONFIG_PREFIX_SEPARATOR);
199
+ }).reduce(function(acc, param) {
200
+ var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
201
+ return _object_spread_props(_object_spread({}, acc), _define_property({}, key.substring(key.indexOf(CONFIG_PREFIX_SEPARATOR) + 1), value));
202
+ }, {});
146
203
  };
147
204
 
148
205
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
@@ -174,24 +231,6 @@ function _async_to_generator(fn) {
174
231
  });
175
232
  };
176
233
  }
177
- function _class_call_check(instance, Constructor) {
178
- if (!(instance instanceof Constructor)) {
179
- throw new TypeError("Cannot call a class as a function");
180
- }
181
- }
182
- function _defineProperties(target, props) {
183
- for(var i = 0; i < props.length; i++){
184
- var descriptor = props[i];
185
- descriptor.enumerable = descriptor.enumerable || false;
186
- descriptor.configurable = true;
187
- if ("value" in descriptor) descriptor.writable = true;
188
- Object.defineProperty(target, descriptor.key, descriptor);
189
- }
190
- }
191
- function _create_class(Constructor, protoProps, staticProps) {
192
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
193
- return Constructor;
194
- }
195
234
  function _ts_generator(thisArg, body) {
196
235
  var f, y, t, g, _ = {
197
236
  label: 0,
@@ -287,30 +326,24 @@ function _ts_generator(thisArg, body) {
287
326
  };
288
327
  }
289
328
  }
290
- var NoAuthSigner = /*#__PURE__*/ function() {
291
- function NoAuthSigner() {
292
- _class_call_check(this, NoAuthSigner);
293
- }
294
- _create_class(NoAuthSigner, [
295
- {
296
- key: "sign",
297
- value: function sign(httpRequest, identity, signingProperties) {
298
- return _async_to_generator(function() {
299
- return _ts_generator(this, function(_state) {
300
- return [
301
- 2,
302
- httpRequest
303
- ];
304
- });
305
- })();
306
- }
307
- }
308
- ]);
309
- return NoAuthSigner;
329
+ var swallowError = function() {
330
+ return {};
331
+ };
332
+ var loadSsoSessionData = function() {
333
+ var _ref = _async_to_generator(function() {
334
+ var init, _init_configFilepath;
335
+ var _arguments = arguments;
336
+ return _ts_generator(this, function(_state) {
337
+ init = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
338
+ return [
339
+ 2,
340
+ readFile((_init_configFilepath = init.configFilepath) !== null && _init_configFilepath !== void 0 ? _init_configFilepath : getConfigFilepath()).then(parseIni).then(getSsoSessionData).catch(swallowError)
341
+ ];
342
+ });
343
+ });
344
+ return function loadSsoSessionData() {
345
+ return _ref.apply(this, arguments);
346
+ };
310
347
  }();
311
348
 
312
- var version = "3.997.20";
313
- var packageInfo = {
314
- version: version};
315
-
316
- export { BinaryDecisionDiagram as B, NoAuthSigner as N, decideEndpoint as d, packageInfo as p };
349
+ export { TokenProviderError as T, loadSsoSessionData as l };
@@ -0,0 +1,165 @@
1
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
2
+ try {
3
+ var info = gen[key](arg);
4
+ var value = info.value;
5
+ } catch (error) {
6
+ reject(error);
7
+ return;
8
+ }
9
+ if (info.done) {
10
+ resolve(value);
11
+ } else {
12
+ Promise.resolve(value).then(_next, _throw);
13
+ }
14
+ }
15
+ function _async_to_generator(fn) {
16
+ return function() {
17
+ var self = this, args = arguments;
18
+ return new Promise(function(resolve, reject) {
19
+ var gen = fn.apply(self, args);
20
+ function _next(value) {
21
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
22
+ }
23
+ function _throw(err) {
24
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
25
+ }
26
+ _next(undefined);
27
+ });
28
+ };
29
+ }
30
+ function _class_call_check(instance, Constructor) {
31
+ if (!(instance instanceof Constructor)) {
32
+ throw new TypeError("Cannot call a class as a function");
33
+ }
34
+ }
35
+ function _defineProperties(target, props) {
36
+ for(var i = 0; i < props.length; i++){
37
+ var descriptor = props[i];
38
+ descriptor.enumerable = descriptor.enumerable || false;
39
+ descriptor.configurable = true;
40
+ if ("value" in descriptor) descriptor.writable = true;
41
+ Object.defineProperty(target, descriptor.key, descriptor);
42
+ }
43
+ }
44
+ function _create_class(Constructor, protoProps, staticProps) {
45
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
46
+ return Constructor;
47
+ }
48
+ function _ts_generator(thisArg, body) {
49
+ var f, y, t, g, _ = {
50
+ label: 0,
51
+ sent: function() {
52
+ if (t[0] & 1) throw t[1];
53
+ return t[1];
54
+ },
55
+ trys: [],
56
+ ops: []
57
+ };
58
+ return g = {
59
+ next: verb(0),
60
+ "throw": verb(1),
61
+ "return": verb(2)
62
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
63
+ return this;
64
+ }), g;
65
+ function verb(n) {
66
+ return function(v) {
67
+ return step([
68
+ n,
69
+ v
70
+ ]);
71
+ };
72
+ }
73
+ function step(op) {
74
+ if (f) throw new TypeError("Generator is already executing.");
75
+ while(_)try {
76
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
77
+ if (y = 0, t) op = [
78
+ op[0] & 2,
79
+ t.value
80
+ ];
81
+ switch(op[0]){
82
+ case 0:
83
+ case 1:
84
+ t = op;
85
+ break;
86
+ case 4:
87
+ _.label++;
88
+ return {
89
+ value: op[1],
90
+ done: false
91
+ };
92
+ case 5:
93
+ _.label++;
94
+ y = op[1];
95
+ op = [
96
+ 0
97
+ ];
98
+ continue;
99
+ case 7:
100
+ op = _.ops.pop();
101
+ _.trys.pop();
102
+ continue;
103
+ default:
104
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
105
+ _ = 0;
106
+ continue;
107
+ }
108
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
109
+ _.label = op[1];
110
+ break;
111
+ }
112
+ if (op[0] === 6 && _.label < t[1]) {
113
+ _.label = t[1];
114
+ t = op;
115
+ break;
116
+ }
117
+ if (t && _.label < t[2]) {
118
+ _.label = t[2];
119
+ _.ops.push(op);
120
+ break;
121
+ }
122
+ if (t[2]) _.ops.pop();
123
+ _.trys.pop();
124
+ continue;
125
+ }
126
+ op = body.call(thisArg, _);
127
+ } catch (e) {
128
+ op = [
129
+ 6,
130
+ e
131
+ ];
132
+ y = 0;
133
+ } finally{
134
+ f = t = 0;
135
+ }
136
+ if (op[0] & 5) throw op[1];
137
+ return {
138
+ value: op[0] ? op[1] : void 0,
139
+ done: true
140
+ };
141
+ }
142
+ }
143
+ var NoAuthSigner = /*#__PURE__*/ function() {
144
+ function NoAuthSigner() {
145
+ _class_call_check(this, NoAuthSigner);
146
+ }
147
+ _create_class(NoAuthSigner, [
148
+ {
149
+ key: "sign",
150
+ value: function sign(httpRequest, identity, signingProperties) {
151
+ return _async_to_generator(function() {
152
+ return _ts_generator(this, function(_state) {
153
+ return [
154
+ 2,
155
+ httpRequest
156
+ ];
157
+ });
158
+ })();
159
+ }
160
+ }
161
+ ]);
162
+ return NoAuthSigner;
163
+ }();
164
+
165
+ export { NoAuthSigner as N };
@@ -1,4 +1,4 @@
1
- import { l as loadSharedConfigFiles } from './index.esm3.js';
1
+ import { a as loadSharedConfigFiles } from './index.esm2.js';
2
2
 
3
3
  function _array_like_to_array(arr, len) {
4
4
  if (len == null || len > arr.length) len = arr.length;
@@ -0,0 +1,2 @@
1
+ export * from './lib/skill-s3';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { PinsSettings } from '@digipair/engine';
2
+ export declare const upload: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<import("@aws-sdk/client-s3").PutObjectCommandOutput>;
3
+ export declare const download: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<string>;
4
+ export declare const remove: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<import("@aws-sdk/client-s3").DeleteObjectCommandOutput>;
5
+ export declare const list: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<import("@aws-sdk/client-s3").ListObjectsV2CommandOutput>;
6
+ //# sourceMappingURL=skill-s3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-s3.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-s3.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA0EhD,eAAO,MAAM,MAAM,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iEAC/B,CAAC;AAEpD,eAAO,MAAM,QAAQ,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,oBAC/B,CAAC;AAEtD,eAAO,MAAM,MAAM,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,oEAC/B,CAAC;AAEpD,eAAO,MAAM,IAAI,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,qEAC/B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-s3",
3
- "version": "0.136.3",
3
+ "version": "0.136.5",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",