@intelligentgraphics/ig.gfx.packager 2.1.4 → 2.2.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/index.js CHANGED
@@ -3265,6 +3265,157 @@ exports.WorkSlave = WorkSlave;
3265
3265
 
3266
3266
  /***/ }),
3267
3267
 
3268
+ /***/ "./src/assetService.ts":
3269
+ /*!*****************************!*\
3270
+ !*** ./src/assetService.ts ***!
3271
+ \*****************************/
3272
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
3273
+
3274
+ "use strict";
3275
+
3276
+
3277
+ Object.defineProperty(exports, "__esModule", ({
3278
+ value: true
3279
+ }));
3280
+ exports.uploadPackage = exports.startSession = exports.closeSession = void 0;
3281
+
3282
+ __webpack_require__(/*! core-js/modules/es.promise.js */ "../../node_modules/core-js/modules/es.promise.js");
3283
+
3284
+ var _axios = _interopRequireDefault(__webpack_require__(/*! axios */ "axios"));
3285
+
3286
+ var fs = _interopRequireWildcard(__webpack_require__(/*! fs */ "fs"));
3287
+
3288
+ const _excluded = ["url", "authentication"];
3289
+
3290
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
3291
+
3292
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
3293
+
3294
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3295
+
3296
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3297
+
3298
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3299
+
3300
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3301
+
3302
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
3303
+
3304
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
3305
+
3306
+ /**
3307
+ * Starts an asset service session and returns the sessionId
3308
+ *
3309
+ * @param {SessionStartParams} params
3310
+ * @returns
3311
+ */
3312
+ const startSession = async _ref => {
3313
+ let {
3314
+ url,
3315
+ authentication
3316
+ } = _ref,
3317
+ params = _objectWithoutProperties(_ref, _excluded);
3318
+
3319
+ const payload = _objectSpread(_objectSpread({}, params), {}, {
3320
+ user: undefined,
3321
+ password: undefined,
3322
+ license: undefined
3323
+ });
3324
+
3325
+ if (authentication.type === "credentials") {
3326
+ payload.user = authentication.username;
3327
+ payload.password = authentication.password;
3328
+ } else if (authentication.type === "license") {
3329
+ payload.license = authentication.license;
3330
+ }
3331
+
3332
+ const {
3333
+ data: {
3334
+ session: sessionId,
3335
+ state
3336
+ }
3337
+ } = await _axios.default.post(`Session/Start2`, JSON.stringify(payload), {
3338
+ baseURL: url
3339
+ });
3340
+
3341
+ if (state !== "SUCCESS") {
3342
+ throw new Error(`Could not start session: Asset server responded with ${state}`);
3343
+ }
3344
+
3345
+ return sessionId;
3346
+ };
3347
+
3348
+ exports.startSession = startSession;
3349
+
3350
+ const closeSession = async (url, sessionId) => {
3351
+ await _axios.default.get(`Session/Close/${sessionId}`, {
3352
+ baseURL: url
3353
+ });
3354
+ };
3355
+
3356
+ exports.closeSession = closeSession;
3357
+
3358
+ const uploadPackage = async (url, sessionId, packageName, zipFilePath) => {
3359
+ try {
3360
+ await uploadPackageToUrl(url, `UploadPackage/${sessionId}/${packageName}`, zipFilePath);
3361
+ } catch (err) {
3362
+ await uploadPackageToUrl(url, `UploadPackage/${sessionId}/${packageName}/`, zipFilePath);
3363
+ }
3364
+ };
3365
+
3366
+ exports.uploadPackage = uploadPackage;
3367
+
3368
+ const uploadPackageToUrl = (url, path, zipFilePath) => _axios.default.post(path, fs.createReadStream(zipFilePath), {
3369
+ baseURL: url
3370
+ }).then(({
3371
+ data,
3372
+ status
3373
+ }) => {
3374
+ let objectBody;
3375
+
3376
+ if (typeof data === "string") {
3377
+ try {
3378
+ objectBody = JSON.parse(data);
3379
+ } catch (err) {}
3380
+ } else if (typeof data === "object") {
3381
+ objectBody = data;
3382
+ }
3383
+
3384
+ if (objectBody !== undefined) {
3385
+ if ("state" in objectBody && objectBody.state !== "SUCCESS") {
3386
+ var _objectBody$response;
3387
+
3388
+ throw new Error((_objectBody$response = objectBody.response) !== null && _objectBody$response !== void 0 ? _objectBody$response : objectBody.state);
3389
+ }
3390
+ }
3391
+
3392
+ if (status >= 400) {
3393
+ if (objectBody !== undefined) {
3394
+ let text = "";
3395
+
3396
+ for (const key in objectBody) {
3397
+ text += key + ": \n";
3398
+
3399
+ if (typeof objectBody[key] === "object") {
3400
+ text += JSON.stringify(objectBody[key], undefined, 2);
3401
+ } else {
3402
+ text += objectBody[key];
3403
+ }
3404
+
3405
+ text += "\n\n";
3406
+ }
3407
+
3408
+ throw new Error(text);
3409
+ }
3410
+
3411
+ throw new Error(data);
3412
+ }
3413
+
3414
+ return data;
3415
+ });
3416
+
3417
+ /***/ }),
3418
+
3268
3419
  /***/ "./src/commands/build.ts":
3269
3420
  /*!*******************************!*\
3270
3421
  !*** ./src/commands/build.ts ***!
@@ -3545,8 +3696,7 @@ const releaseFolder = async (folderPath, options) => {
3545
3696
  cwd: options.cwd,
3546
3697
  upload: !options.noUpload,
3547
3698
  service: options.service,
3548
- user: options.user,
3549
- password: options.password,
3699
+ authentication: options.authentication,
3550
3700
  folderPath,
3551
3701
  pushOnly: options.pushOnly
3552
3702
  });
@@ -3835,6 +3985,8 @@ var _igTools = __webpack_require__(/*! @intelligentgraphics/ig.tools.core */ "..
3835
3985
 
3836
3986
  var _util2 = __webpack_require__(/*! ./util */ "./src/util.ts");
3837
3987
 
3988
+ var AssetService = _interopRequireWildcard(__webpack_require__(/*! ./assetService */ "./src/assetService.ts"));
3989
+
3838
3990
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
3839
3991
 
3840
3992
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -3949,9 +4101,26 @@ const buildArchive = async ({
3949
4101
  continue;
3950
4102
  }
3951
4103
 
3952
- const content = _igTools.FileUtil.readFile(path.join(primaryScriptDir, scriptFile));
4104
+ const scriptFilePath = path.join(primaryScriptDir, scriptFile);
4105
+
4106
+ const content = _igTools.FileUtil.readFile(scriptFilePath);
4107
+
4108
+ let data;
4109
+
4110
+ try {
4111
+ data = JSON.parse(content);
4112
+ } catch (err) {
4113
+ const relativePath = path.relative(cwd, scriptFilePath);
4114
+
4115
+ if (err instanceof SyntaxError) {
4116
+ throw new Error(`Encountered invalid syntax in file "${relativePath}": ${String(err)}`);
4117
+ }
4118
+
4119
+ throw new Error(`Encountered an unexpected error while parsing animation json file at path "${relativePath}"`, {
4120
+ cause: err
4121
+ });
4122
+ }
3953
4123
 
3954
- const data = JSON.parse(content);
3955
4124
  validateSchema(data);
3956
4125
  animations.set(data.Id, JSON.stringify(data));
3957
4126
  }
@@ -4052,8 +4221,7 @@ const uploadArchive = async ({
4052
4221
  version,
4053
4222
  service,
4054
4223
  upload,
4055
- user,
4056
- password
4224
+ authentication
4057
4225
  }, zipFilePath, packageName, logStep) => {
4058
4226
  const resolvedTargetDomain = targetDomain && targetDomain !== domain ? targetDomain : domain;
4059
4227
  const resolvedTargetSubdomain = targetSubdomain && targetSubdomain !== subdomain ? targetSubdomain : subdomain;
@@ -4065,88 +4233,22 @@ const uploadArchive = async ({
4065
4233
  return;
4066
4234
  }
4067
4235
 
4068
- const startPayload = {
4236
+ if (!authentication) {
4237
+ throw new Error(`Expected authentication to be available`);
4238
+ }
4239
+
4240
+ logStep(`Opening connection to asset server`);
4241
+ const sessionId = await AssetService.startSession({
4242
+ url: service,
4069
4243
  plugin: PLUGIN_ID,
4070
4244
  address: resolvedAddress,
4071
4245
  domain: resolvedTargetDomain,
4072
4246
  subDomain: resolvedTargetSubdomain,
4073
- user,
4074
- password
4075
- };
4076
- logStep(`Opening connection to bridge server`);
4077
- const {
4078
- data: {
4079
- session: sessionId,
4080
- state
4081
- }
4082
- } = await _axios.default.post(`Session/Start2`, JSON.stringify(startPayload), {
4083
- baseURL: service
4084
- });
4085
-
4086
- if (state !== "SUCCESS") {
4087
- throw new Error(`Could not start session: Bridge server responded with ${state}`);
4088
- }
4089
-
4090
- const uploadPackage = relativePath => _axios.default.post(relativePath, fs.readFileSync(zipFilePath), {
4091
- baseURL: service
4092
- }).then(({
4093
- data,
4094
- status
4095
- }) => {
4096
- let objectBody;
4097
-
4098
- if (typeof data === "string") {
4099
- try {
4100
- objectBody = JSON.parse(data);
4101
- } catch (err) {}
4102
- } else if (typeof data === "object") {
4103
- objectBody = data;
4104
- }
4105
-
4106
- if (objectBody !== undefined) {
4107
- if ("state" in objectBody && objectBody.state !== "SUCCESS") {
4108
- var _objectBody$response;
4109
-
4110
- throw new Error((_objectBody$response = objectBody.response) !== null && _objectBody$response !== void 0 ? _objectBody$response : objectBody.state);
4111
- }
4112
- }
4113
-
4114
- if (status >= 400) {
4115
- if (objectBody !== undefined) {
4116
- let text = "";
4117
-
4118
- for (const key in objectBody) {
4119
- text += key + ": \n";
4120
-
4121
- if (typeof objectBody[key] === "object") {
4122
- text += JSON.stringify(objectBody[key], undefined, 2);
4123
- } else {
4124
- text += objectBody[key];
4125
- }
4126
-
4127
- text += "\n\n";
4128
- }
4129
-
4130
- throw new Error(text);
4131
- }
4132
-
4133
- throw new Error(data);
4134
- }
4135
-
4136
- return data;
4247
+ authentication
4137
4248
  });
4138
-
4139
4249
  logStep(`Uploading package to ${resolvedTargetDomain}.${resolvedTargetSubdomain}`);
4140
-
4141
- try {
4142
- await uploadPackage(`UploadPackage/${sessionId}/${packageName}`);
4143
- } catch (err) {
4144
- await uploadPackage(`UploadPackage/${sessionId}/${packageName}/`);
4145
- }
4146
-
4147
- await _axios.default.get(`Session/Close/${sessionId}`, {
4148
- baseURL: service
4149
- });
4250
+ await AssetService.uploadPackage(service, sessionId, packageName, zipFilePath);
4251
+ await AssetService.closeSession(service, sessionId);
4150
4252
  };
4151
4253
 
4152
4254
  /***/ }),
@@ -4834,8 +4936,10 @@ module.exports = function (O, key, value, options) {
4834
4936
  if (simple) O[key] = value;
4835
4937
  else defineGlobalProperty(key, value);
4836
4938
  } else {
4837
- if (!options.unsafe) delete O[key];
4838
- else if (O[key]) simple = true;
4939
+ try {
4940
+ if (!options.unsafe) delete O[key];
4941
+ else if (O[key]) simple = true;
4942
+ } catch (error) { /* empty */ }
4839
4943
  if (simple) O[key] = value;
4840
4944
  else definePropertyModule.f(O, key, {
4841
4945
  value: value,
@@ -4917,6 +5021,18 @@ module.exports = function (it) {
4917
5021
  module.exports = typeof window == 'object' && typeof Deno != 'object';
4918
5022
 
4919
5023
 
5024
+ /***/ }),
5025
+
5026
+ /***/ "../../node_modules/core-js/internals/engine-is-deno.js":
5027
+ /*!**************************************************************!*\
5028
+ !*** ../../node_modules/core-js/internals/engine-is-deno.js ***!
5029
+ \**************************************************************/
5030
+ /***/ ((module) => {
5031
+
5032
+ /* global Deno -- Deno case */
5033
+ module.exports = typeof Deno == 'object' && Deno && typeof Deno.version == 'object';
5034
+
5035
+
4920
5036
  /***/ }),
4921
5037
 
4922
5038
  /***/ "../../node_modules/core-js/internals/engine-is-ios-pebble.js":
@@ -5779,6 +5895,7 @@ var ResultPrototype = Result.prototype;
5779
5895
  module.exports = function (iterable, unboundFunction, options) {
5780
5896
  var that = options && options.that;
5781
5897
  var AS_ENTRIES = !!(options && options.AS_ENTRIES);
5898
+ var IS_RECORD = !!(options && options.IS_RECORD);
5782
5899
  var IS_ITERATOR = !!(options && options.IS_ITERATOR);
5783
5900
  var INTERRUPTED = !!(options && options.INTERRUPTED);
5784
5901
  var fn = bind(unboundFunction, that);
@@ -5796,7 +5913,9 @@ module.exports = function (iterable, unboundFunction, options) {
5796
5913
  } return INTERRUPTED ? fn(value, stop) : fn(value);
5797
5914
  };
5798
5915
 
5799
- if (IS_ITERATOR) {
5916
+ if (IS_RECORD) {
5917
+ iterator = iterable.iterator;
5918
+ } else if (IS_ITERATOR) {
5800
5919
  iterator = iterable;
5801
5920
  } else {
5802
5921
  iterFn = getIteratorMethod(iterable);
@@ -5811,7 +5930,7 @@ module.exports = function (iterable, unboundFunction, options) {
5811
5930
  iterator = getIterator(iterable, iterFn);
5812
5931
  }
5813
5932
 
5814
- next = iterator.next;
5933
+ next = IS_RECORD ? iterable.next : iterator.next;
5815
5934
  while (!(step = call(next, iterator)).done) {
5816
5935
  try {
5817
5936
  result = callFn(step.value);
@@ -5918,7 +6037,8 @@ var makeBuiltIn = module.exports = function (value, name, options) {
5918
6037
  if (options && options.getter) name = 'get ' + name;
5919
6038
  if (options && options.setter) name = 'set ' + name;
5920
6039
  if (!hasOwn(value, 'name') || (CONFIGURABLE_FUNCTION_NAME && value.name !== name)) {
5921
- defineProperty(value, 'name', { value: name, configurable: true });
6040
+ if (DESCRIPTORS) defineProperty(value, 'name', { value: name, configurable: true });
6041
+ else value.name = name;
5922
6042
  }
5923
6043
  if (CONFIGURABLE_LENGTH && options && hasOwn(options, 'arity') && value.length !== options.arity) {
5924
6044
  defineProperty(value, 'length', { value: options.arity });
@@ -6431,6 +6551,7 @@ var isForced = __webpack_require__(/*! ../internals/is-forced */ "../../node_mod
6431
6551
  var inspectSource = __webpack_require__(/*! ../internals/inspect-source */ "../../node_modules/core-js/internals/inspect-source.js");
6432
6552
  var wellKnownSymbol = __webpack_require__(/*! ../internals/well-known-symbol */ "../../node_modules/core-js/internals/well-known-symbol.js");
6433
6553
  var IS_BROWSER = __webpack_require__(/*! ../internals/engine-is-browser */ "../../node_modules/core-js/internals/engine-is-browser.js");
6554
+ var IS_DENO = __webpack_require__(/*! ../internals/engine-is-deno */ "../../node_modules/core-js/internals/engine-is-deno.js");
6434
6555
  var IS_PURE = __webpack_require__(/*! ../internals/is-pure */ "../../node_modules/core-js/internals/is-pure.js");
6435
6556
  var V8_VERSION = __webpack_require__(/*! ../internals/engine-v8-version */ "../../node_modules/core-js/internals/engine-v8-version.js");
6436
6557
 
@@ -6451,18 +6572,18 @@ var FORCED_PROMISE_CONSTRUCTOR = isForced('Promise', function () {
6451
6572
  // We can't use @@species feature detection in V8 since it causes
6452
6573
  // deoptimization and performance degradation
6453
6574
  // https://github.com/zloirock/core-js/issues/679
6454
- if (V8_VERSION >= 51 && /native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) return false;
6455
- // Detect correctness of subclassing with @@species support
6456
- var promise = new NativePromiseConstructor(function (resolve) { resolve(1); });
6457
- var FakePromise = function (exec) {
6458
- exec(function () { /* empty */ }, function () { /* empty */ });
6459
- };
6460
- var constructor = promise.constructor = {};
6461
- constructor[SPECIES] = FakePromise;
6462
- SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
6463
- if (!SUBCLASSING) return true;
6575
+ if (V8_VERSION < 51 || !/native code/.test(PROMISE_CONSTRUCTOR_SOURCE)) {
6576
+ // Detect correctness of subclassing with @@species support
6577
+ var promise = new NativePromiseConstructor(function (resolve) { resolve(1); });
6578
+ var FakePromise = function (exec) {
6579
+ exec(function () { /* empty */ }, function () { /* empty */ });
6580
+ };
6581
+ var constructor = promise.constructor = {};
6582
+ constructor[SPECIES] = FakePromise;
6583
+ SUBCLASSING = promise.then(function () { /* empty */ }) instanceof FakePromise;
6584
+ if (!SUBCLASSING) return true;
6464
6585
  // Unhandled rejections tracking support, NodeJS Promise without it fails @@species test
6465
- return !GLOBAL_CORE_JS_PROMISE && IS_BROWSER && !NATIVE_PROMISE_REJECTION_EVENT;
6586
+ } return !GLOBAL_CORE_JS_PROMISE && (IS_BROWSER || IS_DENO) && !NATIVE_PROMISE_REJECTION_EVENT;
6466
6587
  });
6467
6588
 
6468
6589
  module.exports = {
@@ -6676,10 +6797,10 @@ var store = __webpack_require__(/*! ../internals/shared-store */ "../../node_mod
6676
6797
  (module.exports = function (key, value) {
6677
6798
  return store[key] || (store[key] = value !== undefined ? value : {});
6678
6799
  })('versions', []).push({
6679
- version: '3.23.2',
6800
+ version: '3.24.0',
6680
6801
  mode: IS_PURE ? 'pure' : 'global',
6681
6802
  copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
6682
- license: 'https://github.com/zloirock/core-js/blob/v3.23.2/LICENSE',
6803
+ license: 'https://github.com/zloirock/core-js/blob/v3.24.0/LICENSE',
6683
6804
  source: 'https://github.com/zloirock/core-js'
6684
6805
  });
6685
6806
 
@@ -7961,7 +8082,7 @@ module.exports = require("util");
7961
8082
  /***/ ((module) => {
7962
8083
 
7963
8084
  "use strict";
7964
- module.exports = JSON.parse('{"name":"@intelligentgraphics/ig.gfx.packager","version":"2.1.4","description":"IG.GFX.Packager 2.1.4 (2.1.4.100)","main":"build/index.js","private":false,"publishConfig":{"access":"public"},"bin":{"packager":"./build/index.js"},"files":["build","locales","scripts"],"scripts":{"dist":"webpack","clean":"rimraf build *.tsbuildinfo","prepublishOnly":"yarn clean && yarn dist","test":"jest","_postinstall":"node scripts/postinstall.js"},"author":"Michael Beier <mb@intelligentgraphics.biz>","dependencies":{"ajv":"^8.6.2","axios":"^0.21.1","core-js":"^3.16.0","execa":"^5.1.1","fs-extra":"^10.0.0","glob":"^7.1.4","jszip":"^3.10.0","rimraf":"^3.0.2","source-map-support":"^0.5.19","terser":"^4.8.0","typedoc":"~0.23.2","typescript":"~4.7.4","update-notifier":"^5.1.0","v8-compile-cache":"^2.1.1","y18n":"^5.0.8","yargs":"^17.0.1"},"devDependencies":{"@babel/plugin-proposal-class-properties":"^7.14.5","@babel/plugin-proposal-object-rest-spread":"^7.14.7","@babel/preset-env":"^7.14.9","@intelligentgraphics/ig.tools.core":"^1.5.1","@intelligentgraphics/ig.utilities":"^1.6.6","@types/archiver":"^5.1.1","@types/fs-extra":"^9.0.12","@types/glob":"^7.1.4","@types/node":"^16.4.11","@types/rimraf":"^3.0.1","@types/update-notifier":"^5.1.0","@types/yargs":"^17.0.2","babel-loader":"^8.1.0","jest":"^28.1.1","ts-jest":"^28.0.5","ts-loader":"^9.2.5","ts-node":"^10.1.0","webpack":"^5.64.4","webpack-cli":"^4.7.2"},"jest":{"transform":{"\\\\.tsx?$":"ts-jest"},"testRegex":"(.*\\\\.(test))\\\\.(ts|tsx)$","moduleFileExtensions":["ts","tsx","js","json"],"moduleNameMapper":{"^~/(.*)":"<rootDir>/src/$1"},"testEnvironmentOptions":{"url":"http://localhost/"}}}');
8085
+ module.exports = JSON.parse('{"name":"@intelligentgraphics/ig.gfx.packager","version":"2.2.0","description":"IG.GFX.Packager 2.2.0 (2.2.0.100)","author":"Michael Beier <mb@intelligentgraphics.biz>","main":"build/index.js","private":false,"publishConfig":{"access":"public"},"engines":{"node":">=14.0.0"},"bin":{"packager":"./build/index.js"},"files":["build","locales","scripts"],"scripts":{"dist":"webpack","clean":"rimraf build *.tsbuildinfo","prepublishOnly":"yarn clean && yarn dist","test":"jest","_postinstall":"node scripts/postinstall.js"},"dependencies":{"ajv":"^8.6.2","axios":"^0.21.1","core-js":"^3.16.0","execa":"^5.1.1","fs-extra":"^10.0.0","glob":"^7.1.4","jszip":"^3.10.0","rimraf":"^3.0.2","source-map-support":"^0.5.19","terser":"^4.8.0","typedoc":"~0.23.2","typescript":"~4.7.4","update-notifier":"^5.1.0","v8-compile-cache":"^2.1.1","y18n":"^5.0.8","yargs":"^17.0.1"},"devDependencies":{"@babel/plugin-proposal-class-properties":"^7.18.6","@babel/plugin-proposal-object-rest-spread":"^7.18.9","@babel/preset-env":"^7.18.9","@intelligentgraphics/ig.tools.core":"^1.5.1","@intelligentgraphics/ig.utilities":"^1.6.6","@types/fs-extra":"^9.0.12","@types/glob":"^7.1.4","@types/node":"^16.4.11","@types/rimraf":"^3.0.1","@types/update-notifier":"^5.1.0","@types/yargs":"^17.0.2","babel-loader":"^8.1.0","ts-loader":"^9.2.5","ts-node":"^10.1.0","webpack":"^5.64.4","webpack-cli":"^4.7.2"}}');
7965
8086
 
7966
8087
  /***/ })
7967
8088
 
@@ -8007,9 +8128,9 @@ __webpack_require__(/*! v8-compile-cache */ "v8-compile-cache");
8007
8128
 
8008
8129
  var _updateNotifier = _interopRequireDefault(__webpack_require__(/*! update-notifier */ "update-notifier"));
8009
8130
 
8010
- var yargs = _interopRequireWildcard(__webpack_require__(/*! yargs */ "yargs"));
8131
+ var fs = _interopRequireWildcard(__webpack_require__(/*! fs */ "fs"));
8011
8132
 
8012
- var _util = __webpack_require__(/*! util */ "util");
8133
+ var yargs = _interopRequireWildcard(__webpack_require__(/*! yargs */ "yargs"));
8013
8134
 
8014
8135
  var _igTools = __webpack_require__(/*! @intelligentgraphics/ig.tools.core */ "../core/build/index.js");
8015
8136
 
@@ -8018,7 +8139,7 @@ var _localization = __webpack_require__(/*! ./localization */ "./src/localizatio
8018
8139
  var _build = __webpack_require__(/*! ./commands/build */ "./src/commands/build.ts");
8019
8140
 
8020
8141
  const _excluded = ["directories"],
8021
- _excluded2 = ["directory", "user", "password", "service"];
8142
+ _excluded2 = ["directory", "user", "password", "service", "license"];
8022
8143
 
8023
8144
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8024
8145
 
@@ -8057,7 +8178,7 @@ const applyBuildOptions = argv => argv.options({
8057
8178
  description: (0, _localization.translate)("options.outDir.description"),
8058
8179
  type: "string",
8059
8180
  default: "bin",
8060
- coerce: input => (0, _util.isNullOrUndefined)(input) ? input : _igTools.PathUtil.ensureAbsolute(input, process.cwd())
8181
+ coerce: input => input === undefined || input === null ? undefined : _igTools.PathUtil.ensureAbsolute(input, process.cwd())
8061
8182
  },
8062
8183
  minimize: {
8063
8184
  description: (0, _localization.translate)("options.minimize.description"),
@@ -8147,6 +8268,11 @@ yargs.command({
8147
8268
  type: "boolean",
8148
8269
  default: false,
8149
8270
  description: (0, _localization.translate)("options.pushOnly.description")
8271
+ },
8272
+ license: {
8273
+ type: "string",
8274
+ description: (0, _localization.translate)("options.license.description"),
8275
+ default: process.env.IG_GFX_LICENSE
8150
8276
  }
8151
8277
  }),
8152
8278
  handler: async _ref2 => {
@@ -8154,7 +8280,8 @@ yargs.command({
8154
8280
  directory,
8155
8281
  user,
8156
8282
  password,
8157
- service
8283
+ service,
8284
+ license
8158
8285
  } = _ref2,
8159
8286
  options = _objectWithoutProperties(_ref2, _excluded2);
8160
8287
 
@@ -8162,32 +8289,63 @@ yargs.command({
8162
8289
 
8163
8290
  if (!options.noUpload) {
8164
8291
  if (!service) {
8165
- missing.push((0, _localization.translate)("options.service.demands", "IG_GFX_ASSET_SERVICE"));
8292
+ captureError(new Error((0, _localization.translate)("options.service.demands", "IG_GFX_ASSET_SERVICE")));
8293
+ return;
8166
8294
  }
8167
8295
 
8168
- if (!user) {
8169
- missing.push((0, _localization.translate)("options.user.demands", "IG_GFX_USER"));
8296
+ if (!license && (!user || !password)) {
8297
+ captureError(new Error(`Expected authentication to be provided through either of the following methods:
8298
+ - as a path to a license file using the --license option or the IG_GFX_LICENSE environment variable
8299
+ - as a username and password using the --user and --password options, or the IG_GFX_USER and IG_GFX_PWD environment variables`));
8300
+ return;
8170
8301
  }
8171
8302
 
8172
- if (!password) {
8173
- missing.push((0, _localization.translate)("options.password.demands", "IG_GFX_PWD"));
8303
+ if (license && !license.endsWith(".iglic")) {
8304
+ captureError(new Error(`Expected the license path to end with the extension .iglic`));
8305
+ return;
8174
8306
  }
8307
+ }
8308
+
8309
+ let authentication;
8175
8310
 
8176
- if (missing.length > 0) {
8177
- const message = (0, _localization.translate)("messages.missingUploadArgs") + "\n\n" + missing.join("\n");
8178
- return captureError(new Error(message));
8311
+ if (license) {
8312
+ const fullLicensePath = _igTools.PathUtil.ensureAbsolute(license, process.cwd());
8313
+
8314
+ try {
8315
+ const content = fs.readFileSync(fullLicensePath);
8316
+ authentication = {
8317
+ type: "license",
8318
+ license: content.toString("base64")
8319
+ };
8320
+ } catch (err) {
8321
+ if ((err === null || err === void 0 ? void 0 : err.code) === "ENOENT") {
8322
+ captureError(new Error(`Expected to find a license file at path: ${fullLicensePath}`));
8323
+ return;
8324
+ }
8325
+
8326
+ captureError(new Error(`Failed to read license file at path: ${fullLicensePath}`));
8327
+ return;
8179
8328
  }
8329
+ } else if (user && password) {
8330
+ console.log(`Detected usage of username and password authentication. Please migrate to the new license file based authentication.`);
8331
+ authentication = {
8332
+ type: "credentials",
8333
+ username: user,
8334
+ password
8335
+ };
8180
8336
  }
8181
8337
 
8182
8338
  const {
8183
8339
  releaseFolders
8184
8340
  } = await Promise.resolve().then(() => _interopRequireWildcard(__webpack_require__(/*! ./commands/release */ "./src/commands/release.ts")));
8185
- releaseFolders(_objectSpread(_objectSpread({}, options), {}, {
8186
- user: user,
8187
- password: password,
8341
+
8342
+ const fullOptions = _objectSpread(_objectSpread({}, options), {}, {
8343
+ authentication,
8188
8344
  service: service,
8189
8345
  directories: [directory]
8190
- })).catch(captureError);
8346
+ });
8347
+
8348
+ releaseFolders(fullOptions).catch(captureError);
8191
8349
  }
8192
8350
  });
8193
8351
  yargs.demandCommand().pkgConf("packager").showHelpOnFail(false).version().argv;