epicenter-libs 3.34.1 → 3.35.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/README.md +61 -86
  3. package/dist/browser/epicenter.js +1586 -230
  4. package/dist/browser/epicenter.js.map +1 -1
  5. package/dist/cjs/epicenter.js +1508 -145
  6. package/dist/cjs/epicenter.js.map +1 -1
  7. package/dist/cjs/package.json +1 -0
  8. package/dist/epicenter.js +1592 -229
  9. package/dist/epicenter.js.map +1 -1
  10. package/dist/epicenter.min.js +1 -1
  11. package/dist/epicenter.min.js.map +1 -1
  12. package/dist/module/epicenter.js +1502 -146
  13. package/dist/module/epicenter.js.map +1 -1
  14. package/dist/types/adapters/docket.d.ts +80 -0
  15. package/dist/types/adapters/encyclopedia.d.ts +86 -0
  16. package/dist/types/adapters/file.d.ts +201 -0
  17. package/dist/types/adapters/git.d.ts +171 -0
  18. package/dist/types/adapters/index.d.ts +8 -1
  19. package/dist/types/adapters/pipeline.d.ts +88 -0
  20. package/dist/types/adapters/powerpoint.d.ts +130 -0
  21. package/dist/types/adapters/registration.d.ts +270 -0
  22. package/dist/types/adapters/task.d.ts +99 -37
  23. package/dist/types/epicenter.d.ts +2 -2
  24. package/dist/types/types.d.ts +6 -1
  25. package/dist/types/utils/router.d.ts +1 -0
  26. package/package.json +12 -7
  27. package/src/adapters/docket.ts +109 -0
  28. package/src/adapters/encyclopedia.ts +128 -0
  29. package/src/adapters/file.ts +332 -0
  30. package/src/adapters/git.ts +278 -0
  31. package/src/adapters/index.ts +14 -0
  32. package/src/adapters/pipeline.ts +145 -0
  33. package/src/adapters/powerpoint.ts +238 -0
  34. package/src/adapters/registration.ts +413 -0
  35. package/src/adapters/task.ts +170 -47
  36. package/src/epicenter.ts +10 -3
  37. package/src/globals.d.ts +6 -0
  38. package/src/types.ts +61 -0
  39. package/src/utils/config.ts +5 -4
  40. package/src/utils/router.ts +1 -0
package/dist/epicenter.js CHANGED
@@ -25,7 +25,7 @@
25
25
  if (hasRequiredRuntime) return runtime.exports;
26
26
  hasRequiredRuntime = 1;
27
27
  (function (module) {
28
- var runtime = (function (exports$1) {
28
+ var runtime = (function (exports) {
29
29
 
30
30
  var Op = Object.prototype;
31
31
  var hasOwn = Op.hasOwnProperty;
@@ -66,7 +66,7 @@
66
66
 
67
67
  return generator;
68
68
  }
69
- exports$1.wrap = wrap;
69
+ exports.wrap = wrap;
70
70
 
71
71
  // Try/catch helper to minimize deoptimizations. Returns a completion
72
72
  // record like context.tryEntries[i].completion. This interface could
@@ -145,7 +145,7 @@
145
145
  });
146
146
  }
147
147
 
148
- exports$1.isGeneratorFunction = function(genFun) {
148
+ exports.isGeneratorFunction = function(genFun) {
149
149
  var ctor = typeof genFun === "function" && genFun.constructor;
150
150
  return ctor
151
151
  ? ctor === GeneratorFunction ||
@@ -155,7 +155,7 @@
155
155
  : false;
156
156
  };
157
157
 
158
- exports$1.mark = function(genFun) {
158
+ exports.mark = function(genFun) {
159
159
  if (Object.setPrototypeOf) {
160
160
  Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
161
161
  } else {
@@ -170,7 +170,7 @@
170
170
  // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
171
171
  // `hasOwn.call(value, "__await")` to determine if the yielded value is
172
172
  // meant to be awaited.
173
- exports$1.awrap = function(arg) {
173
+ exports.awrap = function(arg) {
174
174
  return { __await: arg };
175
175
  };
176
176
 
@@ -245,12 +245,12 @@
245
245
  define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
246
246
  return this;
247
247
  });
248
- exports$1.AsyncIterator = AsyncIterator;
248
+ exports.AsyncIterator = AsyncIterator;
249
249
 
250
250
  // Note that simple async functions are implemented on top of
251
251
  // AsyncIterator objects; they just return a Promise for the value of
252
252
  // the final result produced by the iterator.
253
- exports$1.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
253
+ exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
254
254
  if (PromiseImpl === void 0) PromiseImpl = Promise;
255
255
 
256
256
  var iter = new AsyncIterator(
@@ -258,7 +258,7 @@
258
258
  PromiseImpl
259
259
  );
260
260
 
261
- return exports$1.isGeneratorFunction(outerFn)
261
+ return exports.isGeneratorFunction(outerFn)
262
262
  ? iter // If outerFn is a generator, return the full iterator.
263
263
  : iter.next().then(function(result) {
264
264
  return result.done ? result.value : iter.next();
@@ -478,7 +478,7 @@
478
478
  this.reset(true);
479
479
  }
480
480
 
481
- exports$1.keys = function(val) {
481
+ exports.keys = function(val) {
482
482
  var object = Object(val);
483
483
  var keys = [];
484
484
  for (var key in object) {
@@ -539,7 +539,7 @@
539
539
 
540
540
  throw new TypeError(typeof iterable + " is not iterable");
541
541
  }
542
- exports$1.values = values;
542
+ exports.values = values;
543
543
 
544
544
  function doneResult() {
545
545
  return { value: undefined$1, done: true };
@@ -749,7 +749,7 @@
749
749
  // or not, return the runtime object so that we can declare the variable
750
750
  // regeneratorRuntime in the outer scope, which allows this module to be
751
751
  // injected easily by `bin/regenerator --include-runtime script.js`.
752
- return exports$1;
752
+ return exports;
753
753
 
754
754
  }(
755
755
  // If this script is executing as a CommonJS module, use module.exports
@@ -826,7 +826,7 @@
826
826
  function requireBrowserPonyfill () {
827
827
  if (hasRequiredBrowserPonyfill) return browserPonyfill.exports;
828
828
  hasRequiredBrowserPonyfill = 1;
829
- (function (module, exports$1) {
829
+ (function (module, exports) {
830
830
  // Save global object in a variable
831
831
  var __global__ =
832
832
  (typeof globalThis !== 'undefined' && globalThis) ||
@@ -845,7 +845,7 @@
845
845
  // "globalThis" that's going to be patched
846
846
  (function(globalThis) {
847
847
 
848
- ((function (exports$1) {
848
+ ((function (exports) {
849
849
 
850
850
  /* eslint-disable no-prototype-builtins */
851
851
  var g =
@@ -1358,18 +1358,18 @@
1358
1358
  return new Response(null, {status: status, headers: {location: url}})
1359
1359
  };
1360
1360
 
1361
- exports$1.DOMException = g.DOMException;
1361
+ exports.DOMException = g.DOMException;
1362
1362
  try {
1363
- new exports$1.DOMException();
1363
+ new exports.DOMException();
1364
1364
  } catch (err) {
1365
- exports$1.DOMException = function(message, name) {
1365
+ exports.DOMException = function(message, name) {
1366
1366
  this.message = message;
1367
1367
  this.name = name;
1368
1368
  var error = Error(message);
1369
1369
  this.stack = error.stack;
1370
1370
  };
1371
- exports$1.DOMException.prototype = Object.create(Error.prototype);
1372
- exports$1.DOMException.prototype.constructor = exports$1.DOMException;
1371
+ exports.DOMException.prototype = Object.create(Error.prototype);
1372
+ exports.DOMException.prototype.constructor = exports.DOMException;
1373
1373
  }
1374
1374
 
1375
1375
  function fetch(input, init) {
@@ -1377,7 +1377,7 @@
1377
1377
  var request = new Request(input, init);
1378
1378
 
1379
1379
  if (request.signal && request.signal.aborted) {
1380
- return reject(new exports$1.DOMException('Aborted', 'AbortError'))
1380
+ return reject(new exports.DOMException('Aborted', 'AbortError'))
1381
1381
  }
1382
1382
 
1383
1383
  var xhr = new XMLHttpRequest();
@@ -1419,7 +1419,7 @@
1419
1419
 
1420
1420
  xhr.onabort = function() {
1421
1421
  setTimeout(function() {
1422
- reject(new exports$1.DOMException('Aborted', 'AbortError'));
1422
+ reject(new exports.DOMException('Aborted', 'AbortError'));
1423
1423
  }, 0);
1424
1424
  };
1425
1425
 
@@ -1490,14 +1490,14 @@
1490
1490
  g.Response = Response;
1491
1491
  }
1492
1492
 
1493
- exports$1.Headers = Headers;
1494
- exports$1.Request = Request;
1495
- exports$1.Response = Response;
1496
- exports$1.fetch = fetch;
1493
+ exports.Headers = Headers;
1494
+ exports.Request = Request;
1495
+ exports.Response = Response;
1496
+ exports.fetch = fetch;
1497
1497
 
1498
- Object.defineProperty(exports$1, '__esModule', { value: true });
1498
+ Object.defineProperty(exports, '__esModule', { value: true });
1499
1499
 
1500
- return exports$1;
1500
+ return exports;
1501
1501
 
1502
1502
  }))({});
1503
1503
  })(__globalThis__);
@@ -1506,13 +1506,13 @@
1506
1506
  delete __globalThis__.fetch.polyfill;
1507
1507
  // Choose between native implementation (__global__) or custom implementation (__globalThis__)
1508
1508
  var ctx = __global__.fetch ? __global__ : __globalThis__;
1509
- exports$1 = ctx.fetch; // To enable: import fetch from 'cross-fetch'
1510
- exports$1.default = ctx.fetch; // For TypeScript consumers without esModuleInterop.
1511
- exports$1.fetch = ctx.fetch; // To enable: import {fetch} from 'cross-fetch'
1512
- exports$1.Headers = ctx.Headers;
1513
- exports$1.Request = ctx.Request;
1514
- exports$1.Response = ctx.Response;
1515
- module.exports = exports$1;
1509
+ exports = ctx.fetch; // To enable: import fetch from 'cross-fetch'
1510
+ exports.default = ctx.fetch; // For TypeScript consumers without esModuleInterop.
1511
+ exports.fetch = ctx.fetch; // To enable: import {fetch} from 'cross-fetch'
1512
+ exports.Headers = ctx.Headers;
1513
+ exports.Request = ctx.Request;
1514
+ exports.Response = ctx.Response;
1515
+ module.exports = exports;
1516
1516
  } (browserPonyfill, browserPonyfill.exports));
1517
1517
  return browserPonyfill.exports;
1518
1518
  }
@@ -2055,11 +2055,12 @@
2055
2055
  return this._apiProtocol;
2056
2056
  }
2057
2057
  set apiProtocol(apiProtocol) {
2058
- if (!apiProtocol.startsWith('http')) return;
2059
- if (apiProtocol.endsWith(':')) {
2060
- apiProtocol = apiProtocol.slice(0, -1);
2058
+ let proto = apiProtocol.toLowerCase();
2059
+ if (!proto.startsWith('http')) return;
2060
+ if (proto.endsWith(':')) {
2061
+ proto = proto.slice(0, -1);
2061
2062
  }
2062
- this._apiProtocol = apiProtocol;
2063
+ this._apiProtocol = proto;
2063
2064
  }
2064
2065
 
2065
2066
  /**
@@ -3317,7 +3318,7 @@
3317
3318
  * @param [optionals] Optional arguments; pass network call options overrides here.
3318
3319
  * @returns promise that resolves to the project object
3319
3320
  */
3320
- async function get$e(optionals = {}) {
3321
+ async function get$f(optionals = {}) {
3321
3322
  return await new Router().get('/project', optionals).then(({
3322
3323
  body
3323
3324
  }) => body);
@@ -3335,7 +3336,7 @@
3335
3336
  * @param [optionals] Optional arguments; pass network call options overrides here.
3336
3337
  * @returns promise that resolves to an array of project objects
3337
3338
  */
3338
- async function list$4(accountShortName, optionals = {}) {
3339
+ async function list$5(accountShortName, optionals = {}) {
3339
3340
  return await new Router().withAccountShortName(accountShortName).withProjectShortName('manager').get('/project/in', optionals).then(({
3340
3341
  body
3341
3342
  }) => body);
@@ -3348,8 +3349,8 @@
3348
3349
  PHYLOGENY: PHYLOGENY,
3349
3350
  WORKER_PARTITION: WORKER_PARTITION,
3350
3351
  channelsEnabled: channelsEnabled,
3351
- get: get$e,
3352
- list: list$4
3352
+ get: get$f,
3353
+ list: list$5
3353
3354
  });
3354
3355
 
3355
3356
  const AUTH_TOKEN_KEY = 'com.forio.epicenter.token';
@@ -3416,7 +3417,7 @@
3416
3417
  logLevel: 'warn'
3417
3418
  }) {
3418
3419
  var _project$channelProto;
3419
- const project = await get$e();
3420
+ const project = await get$f();
3420
3421
  if (!project.channelEnabled) throw new EpicenterError('Push Channels are not enabled on this project');
3421
3422
  const channelProtocol = ((_project$channelProto = project.channelProtocol) === null || _project$channelProto === void 0 ? void 0 : _project$channelProto.toLowerCase()) || DEFAULT_CHANNEL_PROTOCOL;
3422
3423
  const {
@@ -4236,7 +4237,7 @@
4236
4237
  * @param [optionals.tokenAccessSeconds] How long the presigned URL is valid for in seconds
4237
4238
  * @returns promise that resolves to an asset ticket containing the presigned upload URL
4238
4239
  */
4239
- async function create$a(file, scope, optionals = {}) {
4240
+ async function create$c(file, scope, optionals = {}) {
4240
4241
  const {
4241
4242
  scopeBoundary,
4242
4243
  scopeKey,
@@ -4341,7 +4342,7 @@
4341
4342
  * @param [optionals] Optional arguments; pass network call options overrides here.
4342
4343
  * @returns promise that resolves when the asset is deleted
4343
4344
  */
4344
- async function remove$4(assetKey, optionals = {}) {
4345
+ async function remove$5(assetKey, optionals = {}) {
4345
4346
  return await new Router().delete(`/asset/${assetKey}`, optionals).then(({
4346
4347
  body
4347
4348
  }) => body);
@@ -4389,7 +4390,7 @@
4389
4390
  * @param [optionals] Optional arguments; pass network call options overrides here.
4390
4391
  * @returns promise that resolves to the asset metadata
4391
4392
  */
4392
- async function get$d(assetKey, optionals = {}) {
4393
+ async function get$e(assetKey, optionals = {}) {
4393
4394
  const {
4394
4395
  server,
4395
4396
  accountShortName,
@@ -4425,7 +4426,7 @@
4425
4426
  * @param [optionals.filter] File pattern to filter assets (e.g., '*.pdf' for PDF files); defaults to '*' (all files)
4426
4427
  * @returns promise that resolves to a list of assets
4427
4428
  */
4428
- async function list$3(scope, optionals = {}) {
4429
+ async function list$4(scope, optionals = {}) {
4429
4430
  const {
4430
4431
  scopeBoundary,
4431
4432
  scopeKey,
@@ -4518,7 +4519,7 @@
4518
4519
  * @param [optionals.tokenAccessSeconds] How long the presigned URL is valid for in seconds
4519
4520
  * @returns promise that resolves when the download is complete
4520
4521
  */
4521
- async function download$1(assetKey, optionals = {}) {
4522
+ async function download$2(assetKey, optionals = {}) {
4522
4523
  const {
4523
4524
  tokenAccessSeconds,
4524
4525
  ...routingOptions
@@ -4606,7 +4607,7 @@
4606
4607
  const name = fileName !== null && fileName !== void 0 ? fileName : file.name;
4607
4608
  let presignedUrl = '';
4608
4609
  try {
4609
- const response = await create$a(name, scope, {
4610
+ const response = await create$c(name, scope, {
4610
4611
  inert: true,
4611
4612
  ...remaining
4612
4613
  });
@@ -4630,14 +4631,14 @@
4630
4631
 
4631
4632
  var asset = /*#__PURE__*/Object.freeze({
4632
4633
  __proto__: null,
4633
- create: create$a,
4634
- download: download$1,
4634
+ create: create$c,
4635
+ download: download$2,
4635
4636
  downloadWithScope: downloadWithScope,
4636
- get: get$d,
4637
+ get: get$e,
4637
4638
  getURL: getURL$1,
4638
4639
  getURLWithScope: getURLWithScope,
4639
- list: list$3,
4640
- remove: remove$4,
4640
+ list: list$4,
4641
+ remove: remove$5,
4641
4642
  removeFromScope: removeFromScope,
4642
4643
  store: store,
4643
4644
  update: update$6
@@ -4845,7 +4846,7 @@
4845
4846
  * @param [optionals.category] Optional argument to allow for establishing episode hierarchies
4846
4847
  * @returns promise that resolves to the newly created episode
4847
4848
  */
4848
- async function create$9(name, groupName, optionals = {}) {
4849
+ async function create$b(name, groupName, optionals = {}) {
4849
4850
  const {
4850
4851
  draft,
4851
4852
  runLimit,
@@ -4877,7 +4878,7 @@
4877
4878
  * @param [optionals] Optional arguments; pass network call options overrides here.
4878
4879
  * @returns promise that resolves to an episode
4879
4880
  */
4880
- async function get$c(episodeKey, optionals = {}) {
4881
+ async function get$d(episodeKey, optionals = {}) {
4881
4882
  return await new Router().get(`/episode/${episodeKey}`, optionals).then(({
4882
4883
  body
4883
4884
  }) => body);
@@ -4913,7 +4914,7 @@
4913
4914
  * @param [optionals] Optional arguments; pass network call options overrides here.
4914
4915
  * @returns promise that resolves to a page of episodes
4915
4916
  */
4916
- async function query$4(searchOptions, optionals = {}) {
4917
+ async function query$5(searchOptions, optionals = {}) {
4917
4918
  const {
4918
4919
  filter,
4919
4920
  sort = [],
@@ -4987,7 +4988,7 @@
4987
4988
  * @param [optionals] Optional arguments; pass network call options overrides here.
4988
4989
  * @returns promise that resolves to undefined if successful
4989
4990
  */
4990
- async function remove$3(episodeKey, optionals = {}) {
4991
+ async function remove$4(episodeKey, optionals = {}) {
4991
4992
  return await new Router().delete(`/episode/${episodeKey}`, optionals).then(({
4992
4993
  body
4993
4994
  }) => body);
@@ -4995,11 +4996,11 @@
4995
4996
 
4996
4997
  var episode = /*#__PURE__*/Object.freeze({
4997
4998
  __proto__: null,
4998
- create: create$9,
4999
+ create: create$b,
4999
5000
  forGroup: forGroup$1,
5000
- get: get$c,
5001
- query: query$4,
5002
- remove: remove$3,
5001
+ get: get$d,
5002
+ query: query$5,
5003
+ remove: remove$4,
5003
5004
  withName: withName
5004
5005
  });
5005
5006
 
@@ -5022,7 +5023,7 @@
5022
5023
  * @param [optionals.groupKey] Group key; if omitted will attempt to use the group associated with the current session
5023
5024
  * @returns promise that resolves to a group
5024
5025
  */
5025
- async function get$b(optionals = {}) {
5026
+ async function get$c(optionals = {}) {
5026
5027
  const {
5027
5028
  groupKey,
5028
5029
  augment,
@@ -5172,7 +5173,7 @@
5172
5173
  * @param [optionals] Optional arguments; pass network call options overrides here.
5173
5174
  * @returns promise that resolves to the newly created group
5174
5175
  */
5175
- async function create$8(group, optionals = {}) {
5176
+ async function create$a(group, optionals = {}) {
5176
5177
  const {
5177
5178
  name,
5178
5179
  runLimit,
@@ -5239,7 +5240,7 @@
5239
5240
  * @param [optionals] Optional arguments; pass network call options overrides here.
5240
5241
  * @returns promise that resolves to a page of groups
5241
5242
  */
5242
- async function query$3(searchOptions, optionals = {}) {
5243
+ async function query$4(searchOptions, optionals = {}) {
5243
5244
  const {
5244
5245
  filter,
5245
5246
  sort = [],
@@ -5278,7 +5279,7 @@
5278
5279
  max,
5279
5280
  quantized
5280
5281
  };
5281
- return await query$3(searchOptions, routingOptions);
5282
+ return await query$4(searchOptions, routingOptions);
5282
5283
  }
5283
5284
 
5284
5285
  /**
@@ -5651,14 +5652,14 @@
5651
5652
  var group = /*#__PURE__*/Object.freeze({
5652
5653
  __proto__: null,
5653
5654
  addUser: addUser$1,
5654
- create: create$8,
5655
+ create: create$a,
5655
5656
  destroy: destroy$2,
5656
5657
  forUser: forUser,
5657
5658
  gather: gather,
5658
- get: get$b,
5659
+ get: get$c,
5659
5660
  getSessionGroups: getSessionGroups,
5660
5661
  getWhitelistedUsers: getWhitelistedUsers,
5661
- query: query$3,
5662
+ query: query$4,
5662
5663
  removeUser: removeUser,
5663
5664
  search: search,
5664
5665
  selfRegister: selfRegister,
@@ -5757,7 +5758,7 @@
5757
5758
  * @param [optionals] Optional arguments; pass network call options overrides here.
5758
5759
  * @returns promise that resolves to a list of leaderboard entries
5759
5760
  */
5760
- async function list$2(collection, scope, searchOptions, optionals = {}) {
5761
+ async function list$3(collection, scope, searchOptions, optionals = {}) {
5761
5762
  const {
5762
5763
  scopeBoundary,
5763
5764
  scopeKey
@@ -5778,9 +5779,9 @@
5778
5779
  body
5779
5780
  }) => body);
5780
5781
  }
5781
- async function get$a(collection, scope, searchOptions, optionals = {}) {
5782
+ async function get$b(collection, scope, searchOptions, optionals = {}) {
5782
5783
  console.warn('DEPRECATION WARNING: leaderboardAdapter.get is deprecated and will be removed with the next release. Use leaderboardAdapter.list instead.');
5783
- return await list$2(collection, scope, searchOptions, optionals);
5784
+ return await list$3(collection, scope, searchOptions, optionals);
5784
5785
  }
5785
5786
 
5786
5787
  /**
@@ -5826,9 +5827,9 @@
5826
5827
 
5827
5828
  var leaderboard = /*#__PURE__*/Object.freeze({
5828
5829
  __proto__: null,
5829
- get: get$a,
5830
+ get: get$b,
5830
5831
  getCount: getCount,
5831
- list: list$2,
5832
+ list: list$3,
5832
5833
  update: update$4
5833
5834
  });
5834
5835
 
@@ -5977,7 +5978,7 @@
5977
5978
  * @param [optionals.allowChannel] Opt into push notifications for this resource. Applicable to projects with phylogeny >= SILENT
5978
5979
  * @returns promise that resolves to the newly created run
5979
5980
  */
5980
- async function create$7(model, scope, optionals = {}) {
5981
+ async function create$9(model, scope, optionals = {}) {
5981
5982
  const {
5982
5983
  scopeBoundary,
5983
5984
  scopeKey,
@@ -6268,7 +6269,7 @@
6268
6269
  * @param [optionals] Optional arguments; pass network call options overrides here.
6269
6270
  * @returns promise that resolve to undefined if successful
6270
6271
  */
6271
- async function remove$2(runKey, optionals = {}) {
6272
+ async function remove$3(runKey, optionals = {}) {
6272
6273
  return await new Router().delete(`/run/${runKey}`, optionals).then(({
6273
6274
  body
6274
6275
  }) => body);
@@ -6286,7 +6287,7 @@
6286
6287
  * @param [optionals] Optional arguments; pass network call options overrides here.
6287
6288
  * @returns promise that resolves to the run
6288
6289
  */
6289
- async function get$9(runKey, optionals = {}) {
6290
+ async function get$a(runKey, optionals = {}) {
6290
6291
  return await new Router().get(`/run/${runKey}`, optionals).then(({
6291
6292
  body
6292
6293
  }) => body);
@@ -6328,7 +6329,7 @@
6328
6329
  * @param [optionals] Optional arguments; pass network call options overrides here.
6329
6330
  * @returns promise that resolves to a page of runs
6330
6331
  */
6331
- async function query$2(model, searchOptions, optionals = {}) {
6332
+ async function query$3(model, searchOptions, optionals = {}) {
6332
6333
  const {
6333
6334
  filter,
6334
6335
  sort = [],
@@ -6885,15 +6886,15 @@
6885
6886
  };
6886
6887
  const {
6887
6888
  values: [lastRun]
6888
- } = await query$2(model, searchOptions);
6889
+ } = await query$3(model, searchOptions);
6889
6890
  if (!lastRun) {
6890
- const newRun = await create$7(model, scope, optionals);
6891
+ const newRun = await create$9(model, scope, optionals);
6891
6892
  // await serial(newRun.runKey, initOperations, optionals = {});
6892
6893
  return newRun;
6893
6894
  }
6894
6895
  return lastRun;
6895
6896
  } else if (strategy === 'reuse-never') {
6896
- const newRun = await create$7(model, scope, optionals);
6897
+ const newRun = await create$9(model, scope, optionals);
6897
6898
  // await serial(newRun.runKey, initOperations, optionals = {});
6898
6899
  return newRun;
6899
6900
  } else ;
@@ -6946,9 +6947,9 @@
6946
6947
  MORPHOLOGY: MORPHOLOGY,
6947
6948
  action: action,
6948
6949
  clone: clone,
6949
- create: create$7,
6950
+ create: create$9,
6950
6951
  createSingular: createSingular,
6951
- get: get$9,
6952
+ get: get$a,
6952
6953
  getMetadata: getMetadata,
6953
6954
  getSingularRunKey: getSingularRunKey,
6954
6955
  getVariable: getVariable,
@@ -6958,8 +6959,8 @@
6958
6959
  introspectWithRunKey: introspectWithRunKey,
6959
6960
  migrate: migrate,
6960
6961
  operation: operation,
6961
- query: query$2,
6962
- remove: remove$2,
6962
+ query: query$3,
6963
+ remove: remove$3,
6963
6964
  removeFromWorld: removeFromWorld,
6964
6965
  restore: restore,
6965
6966
  retrieveFromWorld: retrieveFromWorld,
@@ -7041,7 +7042,7 @@
7041
7042
  * @param [optionals] Optional arguments; pass network call options overrides here.
7042
7043
  * @returns promise that resolves to a user
7043
7044
  */
7044
- async function get$8(userKey, optionals = {}) {
7045
+ async function get$9(userKey, optionals = {}) {
7045
7046
  return await new Router().get(`/user/${userKey}`, optionals).then(({
7046
7047
  body
7047
7048
  }) => body);
@@ -7074,7 +7075,7 @@
7074
7075
  var user = /*#__PURE__*/Object.freeze({
7075
7076
  __proto__: null,
7076
7077
  createUser: createUser,
7077
- get: get$8,
7078
+ get: get$9,
7078
7079
  getWithHandle: getWithHandle,
7079
7080
  uploadCSV: uploadCSV
7080
7081
  });
@@ -7165,7 +7166,7 @@
7165
7166
  * @param [optionals] Optional arguments; pass network call options overrides here.
7166
7167
  * @returns promise that resolves to the vault, or undefined if not found
7167
7168
  */
7168
- async function get$7(vaultKey, optionals = {}) {
7169
+ async function get$8(vaultKey, optionals = {}) {
7169
7170
  return await new Router().get(`/vault/${vaultKey}`, optionals).catch(error => {
7170
7171
  if (error.status === NOT_FOUND$4) return {
7171
7172
  body: undefined
@@ -7265,7 +7266,7 @@
7265
7266
  * @param [optionals.mutationKey] Mutation key for optimistic concurrency control
7266
7267
  * @returns promise that resolves to undefined when successful
7267
7268
  */
7268
- async function remove$1(vaultKey, optionals = {}) {
7269
+ async function remove$2(vaultKey, optionals = {}) {
7269
7270
  const {
7270
7271
  mutationKey,
7271
7272
  ...routingOptions
@@ -7380,7 +7381,7 @@
7380
7381
  * @param [optionals.mutationStrategy] Mutation strategy: ALLOW (upsert), DISALLOW (insert without update), ERROR (insert with conflict exception if exists)
7381
7382
  * @returns promise that resolves to the created vault
7382
7383
  */
7383
- async function create$6(name, scope, items, optionals = {}) {
7384
+ async function create$8(name, scope, items, optionals = {}) {
7384
7385
  console.warn('DEPRECATION WARNING: vaultAdapter.create is deprecated and will be removed with the next release. Use vaultAdapter.define instead.');
7385
7386
  return await define(name, scope, {
7386
7387
  items,
@@ -7412,7 +7413,7 @@
7412
7413
  * @param [optionals.groupName] Name of the group
7413
7414
  * @returns promise that resolves to an array of vaults that match the search options
7414
7415
  */
7415
- async function list$1(searchOptions, optionals = {}) {
7416
+ async function list$2(searchOptions, optionals = {}) {
7416
7417
  const {
7417
7418
  first,
7418
7419
  filter,
@@ -7477,11 +7478,11 @@
7477
7478
  __proto__: null,
7478
7479
  byName: byName$1,
7479
7480
  count: count,
7480
- create: create$6,
7481
+ create: create$8,
7481
7482
  define: define,
7482
- get: get$7,
7483
- list: list$1,
7484
- remove: remove$1,
7483
+ get: get$8,
7484
+ list: list$2,
7485
+ remove: remove$2,
7485
7486
  update: update$2,
7486
7487
  updateProperties: updateProperties,
7487
7488
  withScope: withScope$1
@@ -7806,7 +7807,7 @@
7806
7807
  * @param [optionals] Optional arguments; pass network call options overrides here.
7807
7808
  * @returns promise that resolves to undefined when successful
7808
7809
  */
7809
- async function remove(videoKey, optionals = {}) {
7810
+ async function remove$1(videoKey, optionals = {}) {
7810
7811
  return deleteVideoByKey(videoKey, optionals);
7811
7812
  }
7812
7813
 
@@ -7831,7 +7832,7 @@
7831
7832
  * @param [optionals] Optional arguments; pass network call options overrides here.
7832
7833
  * @returns promise that resolves to a page of video objects
7833
7834
  */
7834
- async function query$1(searchOptions, optionals = {}) {
7835
+ async function query$2(searchOptions, optionals = {}) {
7835
7836
  const {
7836
7837
  filter,
7837
7838
  sort = [],
@@ -8021,7 +8022,7 @@
8021
8022
  * @param [optionals.videoKey] Key for the video object
8022
8023
  * @returns promise that resolves to undefined when download is complete
8023
8024
  */
8024
- async function download(file, optionals = {}) {
8025
+ async function download$1(file, optionals = {}) {
8025
8026
  const {
8026
8027
  scope,
8027
8028
  affiliate,
@@ -8040,12 +8041,12 @@
8040
8041
 
8041
8042
  var video = /*#__PURE__*/Object.freeze({
8042
8043
  __proto__: null,
8043
- download: download,
8044
+ download: download$1,
8044
8045
  getDirectoryURL: getDirectoryURL,
8045
8046
  getURL: getURL,
8046
8047
  processVideo: processVideo,
8047
- query: query$1,
8048
- remove: remove
8048
+ query: query$2,
8049
+ remove: remove$1
8049
8050
  });
8050
8051
 
8051
8052
  /**
@@ -8392,7 +8393,7 @@
8392
8393
  * @param [optionals.allowChannel] Opt into push notifications for this resource. Applicable to projects with phylogeny >= SILENT
8393
8394
  * @returns promise that resolves to the newly created world
8394
8395
  */
8395
- async function create$5(optionals = {}) {
8396
+ async function create$7(optionals = {}) {
8396
8397
  const {
8397
8398
  name,
8398
8399
  displayName,
@@ -8434,7 +8435,7 @@
8434
8435
  * @param [optionals.mine] Flag for indicating to get only the worlds the requesting user is in (based on session token)
8435
8436
  * @returns promise that resolves to a list of worlds
8436
8437
  */
8437
- async function get$6(optionals = {}) {
8438
+ async function get$7(optionals = {}) {
8438
8439
  const {
8439
8440
  groupName,
8440
8441
  episodeName,
@@ -8815,10 +8816,10 @@
8815
8816
  WORLD_NAME_GENERATOR_TYPE: WORLD_NAME_GENERATOR_TYPE,
8816
8817
  assignRun: assignRun,
8817
8818
  autoAssignUsers: autoAssignUsers,
8818
- create: create$5,
8819
+ create: create$7,
8819
8820
  destroy: destroy$1,
8820
8821
  editAssignments: editAssignments,
8821
- get: get$6,
8822
+ get: get$7,
8822
8823
  getAssignments: getAssignments,
8823
8824
  getAssignmentsByKey: getAssignmentsByKey,
8824
8825
  getPersonas: getPersonas,
@@ -8843,7 +8844,7 @@
8843
8844
  * @returns promise that resolves to the current server time in ISO 8601 format, or undefined if not found
8844
8845
  */
8845
8846
  const NOT_FOUND$3 = 404;
8846
- async function get$5(optionals = {}) {
8847
+ async function get$6(optionals = {}) {
8847
8848
  return await new Router().get('/time', optionals).catch(error => {
8848
8849
  if (error.status === NOT_FOUND$3) return {
8849
8850
  body: undefined
@@ -8856,15 +8857,13 @@
8856
8857
 
8857
8858
  var time = /*#__PURE__*/Object.freeze({
8858
8859
  __proto__: null,
8859
- get: get$5
8860
+ get: get$6
8860
8861
  });
8861
8862
 
8862
8863
  let RETRY_POLICY = /*#__PURE__*/function (RETRY_POLICY) {
8863
8864
  RETRY_POLICY["DO_NOTHING"] = "DO_NOTHING";
8864
8865
  // If the task fails, do nothing (this is the default)
8865
- RETRY_POLICY["RESCHEDULE"] = "RESCHEDULE";
8866
- // If the task fails retry at the next scheduled time point
8867
- RETRY_POLICY["FIRE_ON_FAIL_SAFE"] = "FIRE_ON_FAIL_SAFE"; // Will re-execute the task after it fails; how long until this occurs is equal to ttlSeconds
8866
+ RETRY_POLICY["FIRE_ON_FAIL_SAFE"] = "FIRE_ON_FAIL_SAFE"; // Retry within the task's fail-safe execution window
8868
8867
  return RETRY_POLICY;
8869
8868
  }({});
8870
8869
 
@@ -8881,7 +8880,7 @@
8881
8880
  // Task response structure
8882
8881
 
8883
8882
  /**
8884
- * Creates a task; requires support level authentication
8883
+ * Creates a task; requires facilitator (or higher) privileges
8885
8884
  * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task`
8886
8885
  *
8887
8886
  * @example
@@ -8893,7 +8892,9 @@
8893
8892
  * const name = 'task-1-send-emails';
8894
8893
  * const payload = {
8895
8894
  * method: 'POST',
8896
- * url: 'https://forio.com/app/forio-dev/test-project/send-out-emails',
8895
+ * url: '/send-out-emails',
8896
+ * target: 'PROXY', // fire at the project's proxy server; omit to fire at the app
8897
+ * body: {},
8897
8898
  * };
8898
8899
  * const trigger = {
8899
8900
  * value: '0 7 15 * * ?', // triggers on day 15 7am of each month
@@ -8906,11 +8907,13 @@
8906
8907
  * @param scope.scopeKey Scope key, a unique identifier tied to the scope. E.g., if your `scopeBoundary` is `GROUP`, your `scopeKey` will be your `groupKey`; for `EPISODE`, `episodeKey`, etc.
8907
8908
  * @param [scope.userKey] Key associated with the user
8908
8909
  * @param name Name of the task
8909
- * @param payload An HTTP task object that will be executed when the task is triggered
8910
- * @param payload.method Type of method to use with the HTTP request (e.g., 'GET', 'POST', 'PATCH')
8911
- * @param payload.url The URL the HTTP request will be sent to
8912
- * @param [payload.body] The body of the HTTP request
8913
- * @param [payload.headers] Headers to send along with the HTTP request
8910
+ * @param payload An HTTP request or group-status change to execute when the task is triggered
8911
+ * @param payload.method Type of method to use with the HTTP request (e.g., 'GET', 'POST')
8912
+ * @param payload.url Relative URL the HTTP request will be sent to; the task runner builds the full URL as `{host}{targetPath}/{account}/{project}{url}`
8913
+ * @param [payload.target] Where the task fires: 'APPLICATION' (the project app, `/app`, the default) or 'PROXY' (the project's proxy server, `/proxy`)
8914
+ * @param payload.body The JSON body of the HTTP request
8915
+ * @param [payload.headers] Headers to send along with the HTTP request; must be non-empty when provided — omit rather than pass an empty object
8916
+ * @param [payload.timeoutSeconds] Request timeout in seconds (1–30)
8914
8917
  * @param trigger Object that determines when to run the task (cron, offset, or date)
8915
8918
  * @param [trigger.value] For cron: cron expression (e.g., '0 7 * * * ?'). For date: ISO-8601 date-time string
8916
8919
  * @param [trigger.objectType] Type of trigger: 'cron', 'offset', or 'date'
@@ -8921,23 +8924,24 @@
8921
8924
  * @param [optionals.accountShortName] Name of account (by default will be the account associated with the session)
8922
8925
  * @param [optionals.projectShortName] Name of project (by default will be the project associated with the session)
8923
8926
  * @param [optionals.retryPolicy] Specifies what to do should the task fail; see RETRY_POLICY
8924
- * @param [optionals.failSafeTermination] The ISO-8601 date-time when the task will be deleted regardless of any triggers; defaults to null
8925
- * @param [optionals.ttlSeconds] Max life expectancy of the task; used to determine if retrying the task is necessary
8927
+ * @param [optionals.failSafeTermination] ISO-8601 deadline after which the task terminates; the server defaults and caps this at one year from creation
8928
+ * @param [optionals.ttlSeconds] Execution fail-safe window in seconds; the server applies its configured minimum
8926
8929
  * @returns promise that resolves to the task object including the taskKey
8927
8930
  */
8928
- async function create$4(scope, name, payload, trigger, optionals = {}) {
8931
+ async function create$6(scope, name, payload, trigger, optionals = {}) {
8929
8932
  const {
8930
8933
  retryPolicy,
8931
8934
  failSafeTermination,
8932
8935
  ttlSeconds,
8933
8936
  ...routingOptions
8934
8937
  } = optionals;
8938
+ const normalizedPayload = payload.objectType === 'groupStatus' ? payload : {
8939
+ ...payload,
8940
+ objectType: 'http'
8941
+ };
8935
8942
  return await new Router().post('/task', {
8936
8943
  body: {
8937
- payload: {
8938
- objectType: 'http',
8939
- ...payload
8940
- },
8944
+ payload: normalizedPayload,
8941
8945
  trigger,
8942
8946
  retryPolicy,
8943
8947
  failSafeTermination,
@@ -8952,7 +8956,7 @@
8952
8956
  }
8953
8957
 
8954
8958
  /**
8955
- * Deletes a task (changes status to cancelled); requires support level authentication
8959
+ * Deletes a task (changes status to cancelled); requires facilitator (or higher) privileges
8956
8960
  * Base URL: DELETE `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/{TASK_KEY}`
8957
8961
  *
8958
8962
  * @example
@@ -8961,7 +8965,7 @@
8961
8965
  * await taskAdapter.destroy(taskKey);
8962
8966
  *
8963
8967
  * @param taskKey Unique key associated with a task
8964
- * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
8968
+ * @param [optionals] Optional arguments; pass network call options overrides here.
8965
8969
  * @param [optionals.accountShortName] Name of account (by default will be the account associated with the session)
8966
8970
  * @param [optionals.projectShortName] Name of project (by default will be the project associated with the session)
8967
8971
  * @returns promise that resolves to undefined when successful
@@ -8973,7 +8977,7 @@
8973
8977
  }
8974
8978
 
8975
8979
  /**
8976
- * Gets a task by taskKey; requires support level authentication
8980
+ * Gets a task by taskKey; requires facilitator (or higher) privileges
8977
8981
  * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/{TASK_KEY}`
8978
8982
  *
8979
8983
  * @example
@@ -8982,19 +8986,19 @@
8982
8986
  * const task = await taskAdapter.get(taskKey);
8983
8987
  *
8984
8988
  * @param taskKey Unique key associated with a task
8985
- * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
8989
+ * @param [optionals] Optional arguments; pass network call options overrides here.
8986
8990
  * @param [optionals.accountShortName] Name of account (by default will be the account associated with the session)
8987
8991
  * @param [optionals.projectShortName] Name of project (by default will be the project associated with the session)
8988
8992
  * @returns promise that resolves to the task object
8989
8993
  */
8990
- async function get$4(taskKey, optionals = {}) {
8994
+ async function get$5(taskKey, optionals = {}) {
8991
8995
  return await new Router().get(`/task/${taskKey}`, optionals).then(({
8992
8996
  body
8993
8997
  }) => body);
8994
8998
  }
8995
8999
 
8996
9000
  /**
8997
- * Gets the history (100 most recent times it has triggered) of a task by taskKey; requires support level authentication
9001
+ * Gets the history (100 most recent times it has triggered) of a task by taskKey; requires facilitator (or higher) privileges
8998
9002
  * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/history/{TASK_KEY}`
8999
9003
  *
9000
9004
  * @example
@@ -9003,19 +9007,32 @@
9003
9007
  * const history = await taskAdapter.getHistory(taskKey);
9004
9008
  *
9005
9009
  * @param taskKey Unique key associated with a task
9006
- * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
9010
+ * @param [optionals] Pagination and network options
9011
+ * @param [optionals.first] Zero-based index of the first history record; defaults to 0
9012
+ * @param [optionals.max] Maximum history records to return; defaults to 100 and cannot exceed 100
9007
9013
  * @param [optionals.accountShortName] Name of account (by default will be the account associated with the session)
9008
9014
  * @param [optionals.projectShortName] Name of project (by default will be the project associated with the session)
9009
- * @returns promise that resolves to an array of task history objects
9015
+ * @returns promise that resolves to a page of task history objects
9010
9016
  */
9011
9017
  async function getHistory(taskKey, optionals = {}) {
9012
- return await new Router().get(`/task/history/${taskKey}`, optionals).then(({
9018
+ const {
9019
+ first,
9020
+ max,
9021
+ ...routingOptions
9022
+ } = optionals;
9023
+ return await new Router().withSearchParams({
9024
+ first,
9025
+ max
9026
+ }).get(`/task/history/${taskKey}`, {
9027
+ paginated: true,
9028
+ ...routingOptions
9029
+ }).then(({
9013
9030
  body
9014
9031
  }) => body);
9015
9032
  }
9016
9033
 
9017
9034
  /**
9018
- * Gets most recent 100 tasks related to the selected scope; requires support level authentication
9035
+ * Gets most recent 100 tasks related to the selected scope; requires facilitator (or higher) privileges
9019
9036
  * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/in/{SCOPE_BOUNDARY}/{SCOPE_KEY}` or GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/in/{SCOPE_BOUNDARY}/{SCOPE_KEY}/{USER_KEY}`
9020
9037
  *
9021
9038
  * Note: Will retrieve all tasks that were CREATED in the specified scope. If something was created with episode scope, it will not be retrievable through group scoping.
@@ -9032,10 +9049,13 @@
9032
9049
  * @param scope.scopeBoundary Scope boundary, defines the type of scope; See [scope boundary](#SCOPE_BOUNDARY) for all types
9033
9050
  * @param scope.scopeKey Scope key, a unique identifier tied to the scope. E.g., if your `scopeBoundary` is `GROUP`, your `scopeKey` will be your `groupKey`; for `EPISODE`, `episodeKey`, etc.
9034
9051
  * @param [scope.userKey] Key associated with the user; will retrieve tasks in the scope that were made by the specified user
9035
- * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
9052
+ * @param [optionals] Pagination, sorting, and network options
9053
+ * @param [optionals.sort] Task fields to sort by
9054
+ * @param [optionals.first] Zero-based index of the first task; defaults to 0
9055
+ * @param [optionals.max] Maximum tasks to return; defaults to 100 and cannot exceed 100
9036
9056
  * @param [optionals.accountShortName] Name of account (by default will be the account associated with the session)
9037
9057
  * @param [optionals.projectShortName] Name of project (by default will be the project associated with the session)
9038
- * @returns promise that resolves to an array of task objects
9058
+ * @returns promise that resolves to a page of task objects
9039
9059
  */
9040
9060
  async function getTaskIn(scope, optionals = {}) {
9041
9061
  const {
@@ -9043,7 +9063,70 @@
9043
9063
  scopeKey,
9044
9064
  userKey
9045
9065
  } = scope;
9046
- return await new Router().get(`/task/in/${scopeBoundary}/${scopeKey}${userKey ? `/${userKey}` : ''}`, optionals).then(({
9066
+ const {
9067
+ sort = [],
9068
+ first,
9069
+ max,
9070
+ ...routingOptions
9071
+ } = optionals;
9072
+ return await new Router().withSearchParams({
9073
+ sort: sort.join(';') || undefined,
9074
+ first,
9075
+ max
9076
+ }).get(`/task/in/${scopeBoundary}/${scopeKey}${userKey ? `/${userKey}` : ''}`, {
9077
+ paginated: true,
9078
+ ...routingOptions
9079
+ }).then(({
9080
+ body
9081
+ }) => body);
9082
+ }
9083
+
9084
+ /**
9085
+ * Queries for tasks
9086
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/task/search`
9087
+ *
9088
+ * No authentication is required; results use facilitator-level row visibility.
9089
+ * Filterable/sortable fields include
9090
+ * `task.taskKey`, `task.name`, `task.status`, `task.scopeBoundary`, `task.scopeKey`,
9091
+ * `task.userKey`, `task.groupName`, `task.episodeName`, `task.nextExecution`,
9092
+ * `task.failSafeExecution`, and `task.created`.
9093
+ *
9094
+ * @example
9095
+ * import { taskAdapter } from 'epicenter-libs';
9096
+ * const page = await taskAdapter.query({
9097
+ * filter: [
9098
+ * 'task.scopeKey=0000017dd3bf540e5ada5b1e058f08f20461', // tasks scoped to this group
9099
+ * 'task.status=INITIALIZED', // that have not yet fired
9100
+ * ],
9101
+ * sort: ['-task.created'], // newest first
9102
+ * max: 10, // page should only include the first 10 items
9103
+ * });
9104
+ *
9105
+ * @param searchOptions Search options for the query
9106
+ * @param [searchOptions.filter] Filters for searching
9107
+ * @param [searchOptions.sort] Sorting criteria
9108
+ * @param [searchOptions.first] The starting index of the page returned
9109
+ * @param [searchOptions.max] The number of entries per page
9110
+ * @param [optionals] Optional arguments; pass network call options overrides here.
9111
+ * @returns promise that resolves to a page of tasks
9112
+ */
9113
+ async function query$1(searchOptions, optionals = {}) {
9114
+ const {
9115
+ filter,
9116
+ sort = [],
9117
+ first,
9118
+ max
9119
+ } = searchOptions;
9120
+ const searchParams = {
9121
+ filter: parseFilterInput(filter),
9122
+ sort: sort.join(';') || undefined,
9123
+ first,
9124
+ max
9125
+ };
9126
+ return await new Router().withSearchParams(searchParams).get('/task/search', {
9127
+ paginated: true,
9128
+ ...optionals
9129
+ }).then(({
9047
9130
  body
9048
9131
  }) => body);
9049
9132
  }
@@ -9051,11 +9134,12 @@
9051
9134
  var task = /*#__PURE__*/Object.freeze({
9052
9135
  __proto__: null,
9053
9136
  RETRY_POLICY: RETRY_POLICY,
9054
- create: create$4,
9137
+ create: create$6,
9055
9138
  destroy: destroy,
9056
- get: get$4,
9139
+ get: get$5,
9057
9140
  getHistory: getHistory,
9058
- getTaskIn: getTaskIn
9141
+ getTaskIn: getTaskIn,
9142
+ query: query$1
9059
9143
  });
9060
9144
 
9061
9145
  /**
@@ -9107,7 +9191,7 @@
9107
9191
  * @param [optionals] Optional arguments; pass network call options overrides here.
9108
9192
  * @returns promise that resolves to the newly created chat
9109
9193
  */
9110
- async function create$3(room, scope, permit, optionals = {}) {
9194
+ async function create$5(room, scope, permit, optionals = {}) {
9111
9195
  return new Router().post('/chat', {
9112
9196
  body: {
9113
9197
  scope: {
@@ -9135,7 +9219,7 @@
9135
9219
  * @param [optionals] Optional arguments; pass network call options overrides here.
9136
9220
  * @returns promise that resolves to the chat
9137
9221
  */
9138
- async function get$3(chatKey, optionals = {}) {
9222
+ async function get$4(chatKey, optionals = {}) {
9139
9223
  return new Router().get(`/chat/${chatKey}`, optionals).then(({
9140
9224
  body
9141
9225
  }) => body);
@@ -9351,8 +9435,8 @@
9351
9435
 
9352
9436
  var chat = /*#__PURE__*/Object.freeze({
9353
9437
  __proto__: null,
9354
- create: create$3,
9355
- get: get$3,
9438
+ create: create$5,
9439
+ get: get$4,
9356
9440
  getMessages: getMessages,
9357
9441
  getMessagesAdmin: getMessagesAdmin,
9358
9442
  getMessagesForUser: getMessagesForUser,
@@ -9395,7 +9479,7 @@
9395
9479
  * @param [optionals.allowChannel] Opt into push notifications for this resource. Applicable to projects with phylogeny >= SILENT
9396
9480
  * @returns promise that resolves to the newly created consensus barrier
9397
9481
  */
9398
- async function create$2(worldKey, name, stage, expectedRoles, defaultActions, optionals = {}) {
9482
+ async function create$4(worldKey, name, stage, expectedRoles, defaultActions, optionals = {}) {
9399
9483
  const {
9400
9484
  ttlSeconds,
9401
9485
  transparent = false,
@@ -9449,7 +9533,7 @@
9449
9533
  * @param [optionals] Optional arguments; pass network call options overrides here.
9450
9534
  * @returns promise that resolves to a list of consensus barriers
9451
9535
  */
9452
- async function list(worldKey, name, optionals = {}) {
9536
+ async function list$1(worldKey, name, optionals = {}) {
9453
9537
  return await new Router().get(`/consensus/${worldKey}/${name}`, optionals).then(({
9454
9538
  body
9455
9539
  }) => body);
@@ -9842,11 +9926,11 @@
9842
9926
  var consensus = /*#__PURE__*/Object.freeze({
9843
9927
  __proto__: null,
9844
9928
  collectInGroup: collectInGroup,
9845
- create: create$2,
9929
+ create: create$4,
9846
9930
  deleteAll: deleteAll,
9847
9931
  deleteBarrier: deleteBarrier,
9848
9932
  forceClose: forceClose,
9849
- list: list,
9933
+ list: list$1,
9850
9934
  load: load,
9851
9935
  pause: pause,
9852
9936
  removeRoleExpectationFor: removeRoleExpectationFor,
@@ -9884,7 +9968,7 @@
9884
9968
  * @returns promise that resolves to the newly created somebody object
9885
9969
  */
9886
9970
 
9887
- async function create$1(email, scope, optionals = {}) {
9971
+ async function create$3(email, scope, optionals = {}) {
9888
9972
  const {
9889
9973
  givenName,
9890
9974
  familyName,
@@ -9917,7 +10001,7 @@
9917
10001
  * @returns promise that resolves to the somebody object, or undefined if not found
9918
10002
  */
9919
10003
  const NOT_FOUND$2 = 404;
9920
- async function get$2(somebodyKey, optionals = {}) {
10004
+ async function get$3(somebodyKey, optionals = {}) {
9921
10005
  return await new Router().get(`/somebody/${somebodyKey}`, optionals).catch(error => {
9922
10006
  if (error.status === NOT_FOUND$2) return {
9923
10007
  body: undefined
@@ -10012,8 +10096,8 @@
10012
10096
  var somebody = /*#__PURE__*/Object.freeze({
10013
10097
  __proto__: null,
10014
10098
  byEmail: byEmail,
10015
- create: create$1,
10016
- get: get$2,
10099
+ create: create$3,
10100
+ get: get$3,
10017
10101
  inScope: inScope
10018
10102
  });
10019
10103
 
@@ -10036,7 +10120,7 @@
10036
10120
  * @param [optionals] Optional arguments; pass network call options overrides here.
10037
10121
  * @returns promise that resolves to the matchmaker list object
10038
10122
  */
10039
- async function create(name, partners, scope, optionals = {}) {
10123
+ async function create$2(name, partners, scope, optionals = {}) {
10040
10124
  const {
10041
10125
  accountShortName,
10042
10126
  projectShortName,
@@ -10119,7 +10203,7 @@
10119
10203
  * @param [optionals] Optional arguments; pass network call options overrides here.
10120
10204
  * @returns promise that resolves to the matchmaker list object, or undefined if not found
10121
10205
  */
10122
- async function get$1(udomeKey, optionals = {}) {
10206
+ async function get$2(udomeKey, optionals = {}) {
10123
10207
  const {
10124
10208
  accountShortName,
10125
10209
  projectShortName,
@@ -10177,9 +10261,9 @@
10177
10261
  __proto__: null,
10178
10262
  addUser: addUser,
10179
10263
  byName: byName,
10180
- create: create,
10264
+ create: create$2,
10181
10265
  edit: edit,
10182
- get: get$1
10266
+ get: get$2
10183
10267
  });
10184
10268
 
10185
10269
  const sleep = ms => new Promise(r => setTimeout(r, ms));
@@ -10483,7 +10567,7 @@
10483
10567
  * @param [optionals] Optional arguments; pass network call options overrides here.
10484
10568
  * @returns promise that resolves to the wallet
10485
10569
  */
10486
- async function get(scope, optionals = {}) {
10570
+ async function get$1(scope, optionals = {}) {
10487
10571
  const {
10488
10572
  scopeBoundary,
10489
10573
  scopeKey
@@ -10550,90 +10634,1001 @@
10550
10634
 
10551
10635
  var wallet = /*#__PURE__*/Object.freeze({
10552
10636
  __proto__: null,
10553
- get: get,
10637
+ get: get$1,
10554
10638
  update: update,
10555
10639
  withScope: withScope
10556
10640
  });
10557
10641
 
10558
- // Generic type for push channel message custom data
10642
+ /**
10643
+ * Builds the NPM Docker images used by pipeline NPM operations.
10644
+ * Requires `system` (admin) authorization.
10645
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/pipeline/npm/images`
10646
+ *
10647
+ * @example
10648
+ * import { pipelineAdapter } from 'epicenter-libs';
10649
+ * const built = await pipelineAdapter.buildImages();
10650
+ *
10651
+ * @param [optionals] Optional arguments; pass network call options overrides here.
10652
+ * @returns promise that resolves to `true` when the images were built successfully
10653
+ */
10654
+ async function buildImages(optionals = {}) {
10655
+ return await new Router().get('/pipeline/npm/images', optionals).then(({
10656
+ body
10657
+ }) => body);
10658
+ }
10559
10659
 
10560
- // Base structure for channel push messages
10660
+ /**
10661
+ * Executes a stored pipeline configuration. The operations to run are read server-side from the
10662
+ * named config file; only step inputs (such as credentials) are supplied here via `attributes`.
10663
+ * The execution runs asynchronously — the returned audit record starts in its `RUNNING` state and
10664
+ * is updated by the worker on completion (poll `getExecution` to observe progress).
10665
+ * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/pipeline/{configName}`
10666
+ *
10667
+ * @example
10668
+ * import { pipelineAdapter } from 'epicenter-libs';
10669
+ * // Pass the git credential the config's git step will consume, keyed by operation type
10670
+ * const audit = await pipelineAdapter.execute('deploy', { git: 'my-git-token' });
10671
+ *
10672
+ * @param configName Name of the stored pipeline config to execute
10673
+ * @param [attributes] Step inputs keyed by operation type (e.g. `{ git: '<token>' }`)
10674
+ * @param [optionals] Optional arguments; pass network call options overrides here.
10675
+ * @returns promise that resolves to the newly created audit record in its initial RUNNING state
10676
+ */
10677
+ async function execute(configName, attributes = {}, optionals = {}) {
10678
+ return await new Router().post(`/pipeline/${encodeURIComponent(configName)}`, {
10679
+ body: {
10680
+ attributes
10681
+ },
10682
+ ...optionals
10683
+ }).then(({
10684
+ body
10685
+ }) => body);
10686
+ }
10561
10687
 
10562
- const validateScope = scope => {
10563
- if (!scope) throw new EpicenterError('No scope found where one was required');
10688
+ /**
10689
+ * Retrieves a single pipeline audit record by its execution key.
10690
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/pipeline/{executionKey}`
10691
+ *
10692
+ * @example
10693
+ * import { pipelineAdapter } from 'epicenter-libs';
10694
+ * const audit = await pipelineAdapter.getExecution('<executionKey>');
10695
+ *
10696
+ * @param executionKey Execution key of the audit record to retrieve
10697
+ * @param [optionals] Optional arguments; pass network call options overrides here.
10698
+ * @returns promise that resolves to the audit record
10699
+ */
10700
+ async function getExecution(executionKey, optionals = {}) {
10701
+ return await new Router().get(`/pipeline/${encodeURIComponent(executionKey)}`, optionals).then(({
10702
+ body
10703
+ }) => body);
10704
+ }
10705
+
10706
+ /**
10707
+ * Lists the audit history for a stored pipeline config.
10708
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/pipeline/with/{configName}`
10709
+ *
10710
+ * @example
10711
+ * import { pipelineAdapter } from 'epicenter-libs';
10712
+ * const page = await pipelineAdapter.listAudits('deploy', { first: 0, max: 20 });
10713
+ *
10714
+ * @param configName Name of the stored pipeline config
10715
+ * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
10716
+ * @param [optionals.first] Index of the first record to return (for pagination)
10717
+ * @param [optionals.max] Maximum number of records to return (for pagination)
10718
+ * @returns promise that resolves to a page of audit records
10719
+ */
10720
+ async function listAudits(configName, optionals = {}) {
10564
10721
  const {
10565
- scopeBoundary,
10566
- scopeKey,
10567
- pushCategory
10568
- } = scope;
10569
- if (!scopeBoundary) throw new EpicenterError('Missing scope component: scopeBoundary');
10570
- if (!scopeKey) throw new EpicenterError('Missing scope component: scopeKey');
10571
- if (!pushCategory) throw new EpicenterError('Missing scope component: pushCategory');
10572
- if (!Object.prototype.hasOwnProperty.call(SCOPE_BOUNDARY, scopeBoundary)) throw new EpicenterError(`Invalid scope boundary: ${scopeBoundary}`);
10573
- if (!Object.prototype.hasOwnProperty.call(PUSH_CATEGORY, pushCategory)) throw new EpicenterError(`Invalid push category: ${pushCategory}`);
10574
- };
10722
+ first = 0,
10723
+ max,
10724
+ ...routingOptions
10725
+ } = optionals;
10726
+ return await new Router().withSearchParams({
10727
+ first,
10728
+ max
10729
+ }).get(`/pipeline/with/${encodeURIComponent(configName)}`, {
10730
+ paginated: true,
10731
+ ...routingOptions
10732
+ }).then(({
10733
+ body
10734
+ }) => body);
10735
+ }
10575
10736
 
10576
10737
  /**
10577
- * Used to subscribe to CometD channels. Pass in a channel scope to instantiate, if a subscription to that scope already exists it will use it.
10738
+ * Deletes a pipeline audit record by its execution key.
10739
+ * Requires `system` (admin) authorization.
10740
+ * Base URL: DELETE `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/pipeline/{executionKey}`
10578
10741
  *
10579
10742
  * @example
10580
- * import { Channel, authAdapter, SCOPE_BOUNDARY, PUSH_CATEGORY } from 'epicenter-libs';
10581
- * const session = authAdapter.getLocalSession();
10582
- * const channel = new Channel({
10583
- * scopeBoundary: SCOPE_BOUNDARY.GROUP,
10584
- * scopeKey: session.groupKey,
10585
- * pushCategory: PUSH_CATEGORY.CHAT,
10586
- * });
10587
- * await channel.subscribe((data) => {
10588
- * console.log('Received message:', data);
10589
- * });
10743
+ * import { pipelineAdapter } from 'epicenter-libs';
10744
+ * await pipelineAdapter.deleteAudit('<executionKey>');
10745
+ *
10746
+ * @param executionKey Execution key of the audit record to delete
10747
+ * @param [optionals] Optional arguments; pass network call options overrides here.
10748
+ * @returns promise that resolves to `true` when the audit record was deleted
10590
10749
  */
10591
- class Channel {
10592
- /**
10593
- * Channel constructor
10594
- *
10595
- * @param scope Object with the scope boundary, scope key, and push category; defines the namespace for the channel
10596
- * @param scope.scopeBoundary Scope boundary, defines the type of scope; See [scope boundary](#SCOPE_BOUNDARY) for all types
10597
- * @param scope.scopeKey Scope key, a unique identifier tied to the scope. E.g., if your `scopeBoundary` is `GROUP`, your `scopeKey` will be your `groupKey`; for `EPISODE`, `episodeKey`, etc.
10598
- * @param scope.pushCategory Push category, defines the type of channel; See [push category](#PUSH_CATEGORY) for all types
10599
- */
10600
- constructor(scope) {
10601
- _defineProperty(this, "path", void 0);
10602
- _defineProperty(this, "update", void 0);
10603
- _defineProperty(this, "subscription", null);
10604
- const {
10605
- scopeBoundary,
10606
- scopeKey,
10607
- pushCategory
10608
- } = scope;
10609
- validateScope(scope);
10610
- this.path = `/${scopeBoundary.toLowerCase()}/${scopeKey}/${pushCategory.toLowerCase()}`;
10611
- if (cometdAdapter.subscriptions.has(this.path)) {
10612
- this.subscription = cometdAdapter.subscriptions.get(this.path) || null;
10613
- }
10614
- }
10750
+ async function deleteAudit(executionKey, optionals = {}) {
10751
+ return await new Router().delete(`/pipeline/${encodeURIComponent(executionKey)}`, optionals).then(({
10752
+ body
10753
+ }) => body);
10754
+ }
10615
10755
 
10616
- /**
10617
- * Publishes content to the CometD channel
10618
- *
10619
- * @example
10620
- * import { Channel, authAdapter, SCOPE_BOUNDARY, PUSH_CATEGORY } from 'epicenter-libs';
10621
- * const session = authAdapter.getLocalSession();
10622
- * const channel = new Channel({
10623
- * scopeBoundary: SCOPE_BOUNDARY.GROUP,
10624
- * scopeKey: session.groupKey,
10625
- * pushCategory: PUSH_CATEGORY.CHAT,
10626
- * });
10627
- * await channel.publish({ message: 'Hello!' });
10628
- *
10629
- * @param content Content to publish to the channel
10630
- * @returns promise that resolves to the CometD message response
10631
- */
10632
- publish(content) {
10633
- return cometdAdapter.publish(this, content);
10634
- }
10756
+ var pipeline = /*#__PURE__*/Object.freeze({
10757
+ __proto__: null,
10758
+ buildImages: buildImages,
10759
+ deleteAudit: deleteAudit,
10760
+ execute: execute,
10761
+ getExecution: getExecution,
10762
+ listAudits: listAudits
10763
+ });
10635
10764
 
10636
- /**
10765
+ /**
10766
+ * Lists the known API services available for the given encyclopedia version.
10767
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/encyclopedia/v{version}`
10768
+ *
10769
+ * @example
10770
+ * import { encyclopediaAdapter } from 'epicenter-libs';
10771
+ * const services = await encyclopediaAdapter.listServices(3);
10772
+ *
10773
+ * @param version Encyclopedia version number
10774
+ * @param [optionals] Optional arguments; pass network call options overrides here.
10775
+ * @returns promise that resolves to an array of known service descriptors
10776
+ */
10777
+ async function listServices(version, optionals = {}) {
10778
+ return await new Router().get(`/encyclopedia/v${version}`, optionals).then(({
10779
+ body
10780
+ }) => body);
10781
+ }
10782
+
10783
+ /**
10784
+ * Retrieves the documented resource (API documentation) for a specific service and encyclopedia version.
10785
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/encyclopedia/v{version}/{api}`
10786
+ *
10787
+ * @example
10788
+ * import { encyclopediaAdapter } from 'epicenter-libs';
10789
+ * const resource = await encyclopediaAdapter.getResource(3, 'run');
10790
+ *
10791
+ * @param version Encyclopedia version number
10792
+ * @param api Name of the API service to retrieve documentation for
10793
+ * @param [optionals] Optional arguments; pass network call options overrides here.
10794
+ * @returns promise that resolves to the documented resource containing endpoints and definitions
10795
+ */
10796
+ async function getResource(version, api, optionals = {}) {
10797
+ return await new Router().get(`/encyclopedia/v${version}/${api}`, optionals).then(({
10798
+ body
10799
+ }) => body);
10800
+ }
10801
+
10802
+ /**
10803
+ * Retrieves a translated representation of the API documentation for a specific service and encyclopedia version.
10804
+ * Supported translators are ASCIIDOC, ASCIIDOC_TO_HTML, and OPENAPI.
10805
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/encyclopedia/as/{translator}/v{version}/{api}`
10806
+ *
10807
+ * NOTE: The backend returns the translated content with a translator-specific content-type
10808
+ * (e.g. `text/asciidoc`, `text/html`, `application/json`). The shared Router throws when the
10809
+ * response content-type is not `application/json`, so only the OPENAPI translator works here.
10810
+ * For ASCIIDOC and ASCIIDOC_TO_HTML, use the underlying fetch API directly against the
10811
+ * constructed URL.
10812
+ *
10813
+ * @example
10814
+ * import { encyclopediaAdapter } from 'epicenter-libs';
10815
+ * const openApiDoc = await encyclopediaAdapter.translate('OPENAPI', 3, 'run');
10816
+ *
10817
+ * @param translator Output format for the documentation; one of 'ASCIIDOC', 'ASCIIDOC_TO_HTML', or 'OPENAPI'
10818
+ * @param version Encyclopedia version number
10819
+ * @param api Name of the API service to translate documentation for
10820
+ * @param [optionals] Optional arguments; pass network call options overrides here.
10821
+ * @returns promise that resolves to the translated documentation (only when translator is 'OPENAPI')
10822
+ */
10823
+ async function translate(translator, version, api, optionals = {}) {
10824
+ return await new Router().get(`/encyclopedia/as/${translator}/v${version}/${api}`, optionals).then(({
10825
+ body
10826
+ }) => body);
10827
+ }
10828
+
10829
+ var encyclopedia = /*#__PURE__*/Object.freeze({
10830
+ __proto__: null,
10831
+ getResource: getResource,
10832
+ listServices: listServices,
10833
+ translate: translate
10834
+ });
10835
+
10836
+ /* File paths are free-form, user-authored strings that may contain spaces or URL-reserved
10837
+ * characters. Encode each segment while preserving the '/' separators that the backend's
10838
+ * `{filePath:.*}` routes expect. */
10839
+ const encodePath = filePath => filePath.split('/').map(encodeURIComponent).join('/');
10840
+
10841
+ /**
10842
+ * Lists files and directories at the project root or at a specific path.
10843
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/file[/{filePath}]`
10844
+ *
10845
+ * @example
10846
+ * import { fileAdapter } from 'epicenter-libs';
10847
+ * // List all files at root
10848
+ * const entries = await fileAdapter.list();
10849
+ * // List contents of a specific directory up to 2 levels deep
10850
+ * const entries = await fileAdapter.list('src', { depth: 2 });
10851
+ *
10852
+ * @param [filePath] Path to a file or directory; omit to list the project root
10853
+ * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
10854
+ * @param [optionals.depth] Maximum depth of directory traversal to include in the response
10855
+ * @returns promise that resolves to an array of file and directory entries
10856
+ */
10857
+ async function list(filePath, optionals = {}) {
10858
+ const {
10859
+ depth,
10860
+ ...routingOptions
10861
+ } = optionals;
10862
+ const uriComponent = filePath ? `/${encodePath(filePath)}` : '';
10863
+ return await new Router().withSearchParams({
10864
+ depth
10865
+ }).get(`/file${uriComponent}`, routingOptions).then(({
10866
+ body
10867
+ }) => body);
10868
+ }
10869
+
10870
+ /**
10871
+ * Uploads and replaces files at the project root or at a specific path using multipart/form-data (PUT).
10872
+ * Use this when you want to overwrite existing files. For creating new files, use `create`.
10873
+ * Base URL: PUT `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/file[/{filePath}]`
10874
+ *
10875
+ * NOTE: This is browser-only. The `FormData` body is only serialized as multipart/form-data when
10876
+ * running in a browser environment; in Node it will not be sent correctly.
10877
+ *
10878
+ * @example
10879
+ * import { fileAdapter } from 'epicenter-libs';
10880
+ * const formData = new FormData();
10881
+ * formData.append('file', myFile);
10882
+ * const uploaded = await fileAdapter.upload(formData, 'models/model.py');
10883
+ *
10884
+ * @param formData Multipart form data containing the file(s) to upload
10885
+ * @param [filePath] Destination path for the file(s); omit to upload to the project root
10886
+ * @param [optionals] Optional arguments; pass network call options overrides here.
10887
+ * @returns promise that resolves to an array of the uploaded file entries
10888
+ */
10889
+ async function upload(formData, filePath, optionals = {}) {
10890
+ const uriComponent = filePath ? `/${encodePath(filePath)}` : '';
10891
+ return await new Router().put(`/file${uriComponent}`, {
10892
+ body: formData,
10893
+ ...optionals
10894
+ }).then(({
10895
+ body
10896
+ }) => body);
10897
+ }
10898
+
10899
+ /**
10900
+ * Creates new files at the project root or at a specific path using multipart/form-data (POST).
10901
+ * Use this when creating new files. For overwriting existing files, use `upload`.
10902
+ * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/file[/{filePath}]`
10903
+ *
10904
+ * NOTE: This is browser-only. The `FormData` body is only serialized as multipart/form-data when
10905
+ * running in a browser environment; in Node it will not be sent correctly.
10906
+ *
10907
+ * @example
10908
+ * import { fileAdapter } from 'epicenter-libs';
10909
+ * const formData = new FormData();
10910
+ * formData.append('file', myFile);
10911
+ * const created = await fileAdapter.create(formData, 'models/model.py');
10912
+ *
10913
+ * @param formData Multipart form data containing the file(s) to create
10914
+ * @param [filePath] Destination path for the file(s); omit to create at the project root
10915
+ * @param [optionals] Optional arguments; pass network call options overrides here.
10916
+ * @returns promise that resolves to an array of the created file entries
10917
+ */
10918
+ async function create$1(formData, filePath, optionals = {}) {
10919
+ const uriComponent = filePath ? `/${encodePath(filePath)}` : '';
10920
+ return await new Router().post(`/file${uriComponent}`, {
10921
+ body: formData,
10922
+ ...optionals
10923
+ }).then(({
10924
+ body
10925
+ }) => body);
10926
+ }
10927
+
10928
+ /**
10929
+ * Deletes a file or directory at the project root or at a specific path.
10930
+ * Base URL: DELETE `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/file[/{filePath}]`
10931
+ *
10932
+ * @example
10933
+ * import { fileAdapter } from 'epicenter-libs';
10934
+ * // Delete a specific file
10935
+ * await fileAdapter.remove('models/old-model.py');
10936
+ * // Delete all files at the project root
10937
+ * await fileAdapter.remove();
10938
+ *
10939
+ * @param [filePath] Path of the file or directory to delete; omit to delete all files at the project root
10940
+ * @param [optionals] Optional arguments; pass network call options overrides here.
10941
+ * @returns promise that resolves when the deletion is complete
10942
+ */
10943
+ async function remove(filePath, optionals = {}) {
10944
+ const uriComponent = filePath ? `/${encodePath(filePath)}` : '';
10945
+ return await new Router().delete(`/file${uriComponent}`, optionals).then(({
10946
+ body
10947
+ }) => body);
10948
+ }
10949
+
10950
+ /**
10951
+ * Downloads the raw content of a file at the specified path.
10952
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/file/download/{filePath}`
10953
+ *
10954
+ * NOTE: The backend streams the file with its detected content type (e.g. `application/zip`,
10955
+ * `text/plain`, `application/octet-stream`). The shared Router throws when the response
10956
+ * content-type is not `application/json`, so this call only succeeds for JSON files. To download
10957
+ * other file types, use the underlying fetch API directly against the constructed URL.
10958
+ *
10959
+ * @example
10960
+ * import { fileAdapter } from 'epicenter-libs';
10961
+ * const content = await fileAdapter.download('config.json');
10962
+ *
10963
+ * @param filePath Path to the file to download
10964
+ * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
10965
+ * @param [optionals.depth] Currently unused on the backend; reserved for future expansion.
10966
+ * @returns promise that resolves to the raw file content
10967
+ */
10968
+ async function download(filePath, optionals = {}) {
10969
+ const {
10970
+ depth,
10971
+ ...routingOptions
10972
+ } = optionals;
10973
+ return await new Router().withSearchParams({
10974
+ depth
10975
+ }).get(`/file/download/${encodePath(filePath)}`, routingOptions).then(({
10976
+ body
10977
+ }) => body);
10978
+ }
10979
+
10980
+ /**
10981
+ * Lists files and directories matching a glob filter pattern, optionally scoped to a specific path.
10982
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/file/filter/{filter}[/{filePath}]`
10983
+ *
10984
+ * @example
10985
+ * import { fileAdapter } from 'epicenter-libs';
10986
+ * // List all Python files in the project
10987
+ * const pyFiles = await fileAdapter.listByFilter('*.py');
10988
+ * // List all Python files within the 'models' directory
10989
+ * const pyFiles = await fileAdapter.listByFilter('*.py', 'models');
10990
+ *
10991
+ * @param filter Glob pattern to filter files by (e.g., '*.py', '*.json')
10992
+ * @param [filePath] Directory path to scope the filter to; omit to search the entire project
10993
+ * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
10994
+ * @param [optionals.depth] Maximum depth of directory traversal to include in the response
10995
+ * @returns promise that resolves to an array of matching file and directory entries
10996
+ */
10997
+ async function listByFilter(filter, filePath, optionals = {}) {
10998
+ const {
10999
+ depth,
11000
+ ...routingOptions
11001
+ } = optionals;
11002
+ const uriComponent = filePath ? `/${encodePath(filePath)}` : '';
11003
+ return await new Router().withSearchParams({
11004
+ depth
11005
+ }).get(`/file/filter/${encodeURIComponent(filter)}${uriComponent}`, routingOptions).then(({
11006
+ body
11007
+ }) => body);
11008
+ }
11009
+
11010
+ /**
11011
+ * Compresses files into a ZIP archive at the project root or at a specific path.
11012
+ * Base URL: PATCH `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/file/compress[/{filePath}]`
11013
+ *
11014
+ * NOTE: The backend streams the resulting archive with content-type `application/zip`. The
11015
+ * shared Router throws when the response content-type is not `application/json`, so this call
11016
+ * will not return the archive bytes through the normal flow. To retrieve the archive, use the
11017
+ * underlying fetch API directly against the constructed URL.
11018
+ *
11019
+ * @example
11020
+ * import { fileAdapter } from 'epicenter-libs';
11021
+ * // Compress a specific file or directory
11022
+ * await fileAdapter.compress('models');
11023
+ * // Compress at root
11024
+ * await fileAdapter.compress();
11025
+ *
11026
+ * @param [filePath] Path of the file or directory to compress; omit to compress at the project root
11027
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11028
+ * @returns promise that resolves to the compression result
11029
+ */
11030
+ async function compress(filePath, optionals = {}) {
11031
+ const uriComponent = filePath ? `/${encodePath(filePath)}` : '';
11032
+ return await new Router().patch(`/file/compress${uriComponent}`, optionals).then(({
11033
+ body
11034
+ }) => body);
11035
+ }
11036
+
11037
+ /**
11038
+ * Extracts (explodes) a ZIP archive at the project root or at a specific path in place,
11039
+ * deleting the archive after extraction.
11040
+ * Base URL: PATCH `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/file/explode[/{filePath}]`
11041
+ *
11042
+ * @example
11043
+ * import { fileAdapter } from 'epicenter-libs';
11044
+ * // Extract a specific archive
11045
+ * await fileAdapter.explode('archive.zip');
11046
+ * // Explode at root
11047
+ * await fileAdapter.explode();
11048
+ *
11049
+ * @param [filePath] Path of the archive to extract; omit to extract at the project root
11050
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11051
+ * @returns promise that resolves when the extraction is complete
11052
+ */
11053
+ async function explode(filePath, optionals = {}) {
11054
+ const uriComponent = filePath ? `/${encodePath(filePath)}` : '';
11055
+ return await new Router().patch(`/file/explode${uriComponent}`, optionals).then(({
11056
+ body
11057
+ }) => body);
11058
+ }
11059
+
11060
+ /**
11061
+ * Moves a file or directory from one path to another within the project.
11062
+ * Base URL: PATCH `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/file/move`
11063
+ *
11064
+ * @example
11065
+ * import { fileAdapter } from 'epicenter-libs';
11066
+ * await fileAdapter.move('models/old-name.py', 'models/new-name.py');
11067
+ * // Move and include the origin directory itself
11068
+ * await fileAdapter.move('old-dir', 'new-dir', { includeOrigin: true });
11069
+ *
11070
+ * @param origin Origin path of the file or directory to move
11071
+ * @param destination Destination path to move the file or directory to
11072
+ * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
11073
+ * @param [optionals.includeOrigin] Whether to include the origin directory itself in the move
11074
+ * @returns promise that resolves when the move is complete
11075
+ */
11076
+ async function move(origin, destination, optionals = {}) {
11077
+ const {
11078
+ includeOrigin,
11079
+ ...routingOptions
11080
+ } = optionals;
11081
+ return await new Router().patch('/file/move', {
11082
+ body: {
11083
+ origin,
11084
+ destination,
11085
+ includeOrigin
11086
+ },
11087
+ ...routingOptions
11088
+ }).then(({
11089
+ body
11090
+ }) => body);
11091
+ }
11092
+
11093
+ /**
11094
+ * Creates a new directory at the specified path.
11095
+ * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/file/directory/{filePath}`
11096
+ *
11097
+ * @example
11098
+ * import { fileAdapter } from 'epicenter-libs';
11099
+ * const dir = await fileAdapter.createDirectory('models/new-folder');
11100
+ *
11101
+ * @param filePath Path at which to create the new directory
11102
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11103
+ * @returns promise that resolves to the created directory entry
11104
+ */
11105
+ async function createDirectory(filePath, optionals = {}) {
11106
+ return await new Router().post(`/file/directory/${encodePath(filePath)}`, optionals).then(({
11107
+ body
11108
+ }) => body);
11109
+ }
11110
+
11111
+ var file = /*#__PURE__*/Object.freeze({
11112
+ __proto__: null,
11113
+ compress: compress,
11114
+ create: create$1,
11115
+ createDirectory: createDirectory,
11116
+ download: download,
11117
+ explode: explode,
11118
+ list: list,
11119
+ listByFilter: listByFilter,
11120
+ move: move,
11121
+ remove: remove,
11122
+ upload: upload
11123
+ });
11124
+
11125
+ /**
11126
+ * Currently the API only supports `SAML`. This type is intentionally narrow so that adding new
11127
+ * protocols on the backend requires an explicit type update here.
11128
+ */
11129
+
11130
+ /**
11131
+ * Gets registration info for a self-registration token.
11132
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/self/{token}`
11133
+ *
11134
+ * @example
11135
+ * import { registrationAdapter } from 'epicenter-libs';
11136
+ * const info = await registrationAdapter.getSelfRegistrationInfo('my-token');
11137
+ *
11138
+ * @param token Self-registration token
11139
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11140
+ * @returns promise that resolves to registration info
11141
+ */
11142
+ async function getSelfRegistrationInfo(token, optionals = {}) {
11143
+ return await new Router().get(`/registration/self/${token}`, optionals).then(({
11144
+ body
11145
+ }) => body);
11146
+ }
11147
+
11148
+ /**
11149
+ * Completes a self-registration using a token.
11150
+ * Base URL: PATCH `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/self/{token}`
11151
+ *
11152
+ * @example
11153
+ * import { registrationAdapter } from 'epicenter-libs';
11154
+ * const result = await registrationAdapter.completeSelfRegistration('my-token', 'secret123', {
11155
+ * displayName: 'John Doe',
11156
+ * handle: 'johnd',
11157
+ * });
11158
+ *
11159
+ * @param token Self-registration token
11160
+ * @param password Password for the new account
11161
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11162
+ * @param [optionals.displayName] Display name for the new user
11163
+ * @param [optionals.givenName] Given name for the new user
11164
+ * @param [optionals.familyName] Family name for the new user
11165
+ * @param [optionals.handle] Handle for the new user
11166
+ * @returns promise that resolves to the registration result including session info
11167
+ */
11168
+ async function completeSelfRegistration(token, password, optionals = {}) {
11169
+ const {
11170
+ displayName,
11171
+ givenName,
11172
+ familyName,
11173
+ handle,
11174
+ ...routingOptions
11175
+ } = optionals;
11176
+ return await new Router().patch(`/registration/self/${token}`, {
11177
+ body: {
11178
+ password,
11179
+ displayName,
11180
+ givenName,
11181
+ familyName,
11182
+ handle
11183
+ },
11184
+ ...routingOptions
11185
+ }).then(({
11186
+ body
11187
+ }) => body);
11188
+ }
11189
+
11190
+ /**
11191
+ * Sends a self-registration invite email to a user. Pass an `Accept-Language` header via
11192
+ * `optionals.headers` to localize the email.
11193
+ * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/self/{groupKey}`
11194
+ *
11195
+ * @example
11196
+ * import { registrationAdapter } from 'epicenter-libs';
11197
+ * await registrationAdapter.sendSelfRegistrationInvite('group-key', 'user@example.com', {
11198
+ * linkDestination: 'DASHBOARD',
11199
+ * redirectUrl: 'https://app.example.com',
11200
+ * headers: { 'Accept-Language': 'fr-FR' },
11201
+ * });
11202
+ *
11203
+ * @param groupKey Group key to register the user into
11204
+ * @param email Email address of the user to invite
11205
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11206
+ * @param [optionals.linkDestination] Destination for the registration link ('DASHBOARD' or 'MANAGER')
11207
+ * @param [optionals.modality] Registration modality
11208
+ * @param [optionals.redirectUrl] URL to redirect to after registration
11209
+ * @param [optionals.subject] Subject line for the invite email
11210
+ * @param [optionals.givenName] Pre-populate given name in the registration form
11211
+ * @param [optionals.familyName] Pre-populate family name in the registration form
11212
+ * @param [optionals.linkUrl] Custom URL to use for the registration link
11213
+ * @param [optionals.confirmation] Whether to send a confirmation email
11214
+ * @returns promise that resolves to undefined if successful
11215
+ */
11216
+ async function sendSelfRegistrationInvite(groupKey, email, optionals = {}) {
11217
+ const {
11218
+ linkDestination,
11219
+ modality,
11220
+ redirectUrl,
11221
+ subject,
11222
+ givenName,
11223
+ familyName,
11224
+ linkUrl,
11225
+ confirmation,
11226
+ ...routingOptions
11227
+ } = optionals;
11228
+ return await new Router().post(`/registration/self/${groupKey}`, {
11229
+ body: {
11230
+ email,
11231
+ linkDestination,
11232
+ modality,
11233
+ redirectUrl,
11234
+ subject,
11235
+ givenName,
11236
+ familyName,
11237
+ linkUrl,
11238
+ confirmation
11239
+ },
11240
+ ...routingOptions
11241
+ }).then(({
11242
+ body
11243
+ }) => body);
11244
+ }
11245
+
11246
+ /**
11247
+ * Gets registration info for an invite token.
11248
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/invite/{token}`
11249
+ *
11250
+ * @example
11251
+ * import { registrationAdapter } from 'epicenter-libs';
11252
+ * const info = await registrationAdapter.getInviteRegistrationInfo('invite-token');
11253
+ *
11254
+ * @param token Invite registration token
11255
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11256
+ * @returns promise that resolves to registration info
11257
+ */
11258
+ async function getInviteRegistrationInfo(token, optionals = {}) {
11259
+ return await new Router().get(`/registration/invite/${token}`, optionals).then(({
11260
+ body
11261
+ }) => body);
11262
+ }
11263
+
11264
+ /**
11265
+ * Completes an invite registration using a token.
11266
+ * Base URL: PATCH `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/invite/{token}`
11267
+ *
11268
+ * @example
11269
+ * import { registrationAdapter } from 'epicenter-libs';
11270
+ * const result = await registrationAdapter.completeInviteRegistration('invite-token', 'pass456', {
11271
+ * displayName: 'Jane Doe',
11272
+ * });
11273
+ *
11274
+ * @param token Invite registration token
11275
+ * @param password Password for the new account
11276
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11277
+ * @param [optionals.displayName] Display name for the new user
11278
+ * @param [optionals.givenName] Given name for the new user
11279
+ * @param [optionals.familyName] Family name for the new user
11280
+ * @param [optionals.handle] Handle for the new user
11281
+ * @returns promise that resolves to the registration result including session info
11282
+ */
11283
+ async function completeInviteRegistration(token, password, optionals = {}) {
11284
+ const {
11285
+ displayName,
11286
+ givenName,
11287
+ familyName,
11288
+ handle,
11289
+ ...routingOptions
11290
+ } = optionals;
11291
+ return await new Router().patch(`/registration/invite/${token}`, {
11292
+ body: {
11293
+ password,
11294
+ displayName,
11295
+ givenName,
11296
+ familyName,
11297
+ handle
11298
+ },
11299
+ ...routingOptions
11300
+ }).then(({
11301
+ body
11302
+ }) => body);
11303
+ }
11304
+
11305
+ /**
11306
+ * Sends an invite registration email to a user. Pass an `Accept-Language` header via
11307
+ * `optionals.headers` to localize the email.
11308
+ * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/invite/{groupKey}`
11309
+ *
11310
+ * @example
11311
+ * import { registrationAdapter } from 'epicenter-libs';
11312
+ * await registrationAdapter.sendInvite('group-key', 'invited@example.com', {
11313
+ * givenName: 'New',
11314
+ * familyName: 'User',
11315
+ * redirectUrl: 'https://app.example.com',
11316
+ * });
11317
+ *
11318
+ * @param groupKey Group key to invite the user into
11319
+ * @param email Email address of the user to invite
11320
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11321
+ * @param [optionals.linkDestination] Destination for the registration link ('DASHBOARD' or 'MANAGER')
11322
+ * @param [optionals.modality] Registration modality
11323
+ * @param [optionals.redirectUrl] URL to redirect to after registration
11324
+ * @param [optionals.subject] Subject line for the invite email
11325
+ * @param [optionals.givenName] Pre-populate given name in the registration form
11326
+ * @param [optionals.familyName] Pre-populate family name in the registration form
11327
+ * @param [optionals.linkUrl] Custom URL to use for the registration link
11328
+ * @param [optionals.confirmation] Whether to send a confirmation email
11329
+ * @returns promise that resolves to undefined if successful
11330
+ */
11331
+ async function sendInvite(groupKey, email, optionals = {}) {
11332
+ const {
11333
+ linkDestination,
11334
+ modality,
11335
+ redirectUrl,
11336
+ subject,
11337
+ givenName,
11338
+ familyName,
11339
+ linkUrl,
11340
+ confirmation,
11341
+ ...routingOptions
11342
+ } = optionals;
11343
+ return await new Router().post(`/registration/invite/${groupKey}`, {
11344
+ body: {
11345
+ email,
11346
+ linkDestination,
11347
+ modality,
11348
+ redirectUrl,
11349
+ subject,
11350
+ givenName,
11351
+ familyName,
11352
+ linkUrl,
11353
+ confirmation
11354
+ },
11355
+ ...routingOptions
11356
+ }).then(({
11357
+ body
11358
+ }) => body);
11359
+ }
11360
+
11361
+ /**
11362
+ * Gets registration info for a team invite token.
11363
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/team/{token}`
11364
+ *
11365
+ * @example
11366
+ * import { registrationAdapter } from 'epicenter-libs';
11367
+ * const info = await registrationAdapter.getTeamRegistrationInfo('team-token');
11368
+ *
11369
+ * @param token Team invite token
11370
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11371
+ * @returns promise that resolves to team registration info
11372
+ */
11373
+ async function getTeamRegistrationInfo(token, optionals = {}) {
11374
+ return await new Router().get(`/registration/team/${token}`, optionals).then(({
11375
+ body
11376
+ }) => body);
11377
+ }
11378
+
11379
+ /**
11380
+ * Sends a team invite email. Pass an `Accept-Language` header via `optionals.headers` to
11381
+ * localize the email.
11382
+ * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/team`
11383
+ *
11384
+ * @example
11385
+ * import { registrationAdapter } from 'epicenter-libs';
11386
+ * await registrationAdapter.sendTeamInvite(
11387
+ * 'Jane Author',
11388
+ * 'AUTHOR',
11389
+ * 'https://app.example.com',
11390
+ * 'newteammate@example.com',
11391
+ * { subject: 'Welcome to the team!' },
11392
+ * );
11393
+ *
11394
+ * @param invitingAuthor Name or identifier of the person sending the invite
11395
+ * @param role Role to assign to the invited user
11396
+ * @param redirectUrl URL to redirect to after accepting the invite
11397
+ * @param email Email address of the user to invite
11398
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11399
+ * @param [optionals.subject] Subject line for the invite email
11400
+ * @param [optionals.givenName] Pre-populate given name for the invited user
11401
+ * @param [optionals.familyName] Pre-populate family name for the invited user
11402
+ * @returns promise that resolves to undefined if successful
11403
+ */
11404
+ async function sendTeamInvite(invitingAuthor, role, redirectUrl, email, optionals = {}) {
11405
+ const {
11406
+ subject,
11407
+ givenName,
11408
+ familyName,
11409
+ ...routingOptions
11410
+ } = optionals;
11411
+ return await new Router().post('/registration/team', {
11412
+ body: {
11413
+ invitingAuthor,
11414
+ role,
11415
+ redirectUrl,
11416
+ email,
11417
+ subject,
11418
+ givenName,
11419
+ familyName
11420
+ },
11421
+ ...routingOptions
11422
+ }).then(({
11423
+ body
11424
+ }) => body);
11425
+ }
11426
+
11427
+ /**
11428
+ * @deprecated Use getSsoAdminRegistration or getSsoUserRegistration instead.
11429
+ * Gets SSO registration info for a given SSO protocol.
11430
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/sso/{ssoProtocol}`
11431
+ *
11432
+ * @example
11433
+ * import { registrationAdapter } from 'epicenter-libs';
11434
+ * const info = await registrationAdapter.getSsoRegistration('SAML');
11435
+ *
11436
+ * @param ssoProtocol The SSO protocol (e.g. 'SAML')
11437
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11438
+ * @returns promise that resolves to SSO registration data
11439
+ */
11440
+ async function getSsoRegistration(ssoProtocol, optionals = {}) {
11441
+ console.warn('DEPRECATION WARNING: registrationAdapter.getSsoRegistration is deprecated and will be removed with the next release. Use registrationAdapter.getSsoAdminRegistration or registrationAdapter.getSsoUserRegistration instead.');
11442
+ return await new Router().get(`/registration/sso/${ssoProtocol}`, optionals).then(({
11443
+ body
11444
+ }) => body);
11445
+ }
11446
+
11447
+ /**
11448
+ * Gets admin SSO registration info for a given SSO protocol.
11449
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/sso/admin/{ssoProtocol}`
11450
+ *
11451
+ * @example
11452
+ * import { registrationAdapter } from 'epicenter-libs';
11453
+ * const info = await registrationAdapter.getSsoAdminRegistration('SAML');
11454
+ *
11455
+ * @param ssoProtocol The SSO protocol (e.g. 'SAML')
11456
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11457
+ * @returns promise that resolves to SSO admin registration data
11458
+ */
11459
+ async function getSsoAdminRegistration(ssoProtocol, optionals = {}) {
11460
+ return await new Router().get(`/registration/sso/admin/${ssoProtocol}`, optionals).then(({
11461
+ body
11462
+ }) => body);
11463
+ }
11464
+
11465
+ /**
11466
+ * Gets user SSO registration info for a given SSO protocol.
11467
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/registration/sso/user/{ssoProtocol}`
11468
+ *
11469
+ * @example
11470
+ * import { registrationAdapter } from 'epicenter-libs';
11471
+ * const info = await registrationAdapter.getSsoUserRegistration('SAML');
11472
+ *
11473
+ * @param ssoProtocol The SSO protocol (e.g. 'SAML')
11474
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11475
+ * @returns promise that resolves to SSO user registration data
11476
+ */
11477
+ async function getSsoUserRegistration(ssoProtocol, optionals = {}) {
11478
+ return await new Router().get(`/registration/sso/user/${ssoProtocol}`, optionals).then(({
11479
+ body
11480
+ }) => body);
11481
+ }
11482
+
11483
+ var registration = /*#__PURE__*/Object.freeze({
11484
+ __proto__: null,
11485
+ completeInviteRegistration: completeInviteRegistration,
11486
+ completeSelfRegistration: completeSelfRegistration,
11487
+ getInviteRegistrationInfo: getInviteRegistrationInfo,
11488
+ getSelfRegistrationInfo: getSelfRegistrationInfo,
11489
+ getSsoAdminRegistration: getSsoAdminRegistration,
11490
+ getSsoRegistration: getSsoRegistration,
11491
+ getSsoUserRegistration: getSsoUserRegistration,
11492
+ getTeamRegistrationInfo: getTeamRegistrationInfo,
11493
+ sendInvite: sendInvite,
11494
+ sendSelfRegistrationInvite: sendSelfRegistrationInvite,
11495
+ sendTeamInvite: sendTeamInvite
11496
+ });
11497
+
11498
+ /**
11499
+ * Creates a new docket entry, scheduling a deferred operation for later execution.
11500
+ * Requires `support` level authorization.
11501
+ * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/docket`
11502
+ *
11503
+ * @example
11504
+ * import { docketAdapter } from 'epicenter-libs';
11505
+ * const docket = await docketAdapter.create(
11506
+ * {
11507
+ * objectType: 'scale',
11508
+ * operatingSystem: 'LINUX',
11509
+ * workerShape: 'GS',
11510
+ * scale: {
11511
+ * active: true,
11512
+ * initialWorkerCount: 1,
11513
+ * additionalWorkerLimit: 4,
11514
+ * flavors: ['DOCKER'],
11515
+ * },
11516
+ * },
11517
+ * { objectType: 'date', value: '2026-06-01T00:00:00Z' },
11518
+ * '2026-05-20T00:00:00Z',
11519
+ * { ttlMinutes: 60 },
11520
+ * );
11521
+ *
11522
+ * @param payload Docket payload describing the operation to schedule
11523
+ * @param trigger Trigger describing when the operation should fire
11524
+ * (cron, date, or offset)
11525
+ * @param date ISO-8601 date string indicating when the docket is scheduled
11526
+ * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
11527
+ * @param [optionals.ttlMinutes] Time-to-live in minutes for the docket entry (minimum 2)
11528
+ * @returns promise that resolves to the newly created docket
11529
+ */
11530
+ async function create(payload, trigger, date, optionals = {}) {
11531
+ const {
11532
+ ttlMinutes,
11533
+ ...routingOptions
11534
+ } = optionals;
11535
+ return await new Router().post('/docket', {
11536
+ body: {
11537
+ payload,
11538
+ trigger,
11539
+ date,
11540
+ ttlMinutes
11541
+ },
11542
+ ...routingOptions
11543
+ }).then(({
11544
+ body
11545
+ }) => body);
11546
+ }
11547
+
11548
+ var docket = /*#__PURE__*/Object.freeze({
11549
+ __proto__: null,
11550
+ create: create
11551
+ });
11552
+
11553
+ // Generic type for push channel message custom data
11554
+
11555
+ // Base structure for channel push messages
11556
+
11557
+ const validateScope = scope => {
11558
+ if (!scope) throw new EpicenterError('No scope found where one was required');
11559
+ const {
11560
+ scopeBoundary,
11561
+ scopeKey,
11562
+ pushCategory
11563
+ } = scope;
11564
+ if (!scopeBoundary) throw new EpicenterError('Missing scope component: scopeBoundary');
11565
+ if (!scopeKey) throw new EpicenterError('Missing scope component: scopeKey');
11566
+ if (!pushCategory) throw new EpicenterError('Missing scope component: pushCategory');
11567
+ if (!Object.prototype.hasOwnProperty.call(SCOPE_BOUNDARY, scopeBoundary)) throw new EpicenterError(`Invalid scope boundary: ${scopeBoundary}`);
11568
+ if (!Object.prototype.hasOwnProperty.call(PUSH_CATEGORY, pushCategory)) throw new EpicenterError(`Invalid push category: ${pushCategory}`);
11569
+ };
11570
+
11571
+ /**
11572
+ * Used to subscribe to CometD channels. Pass in a channel scope to instantiate, if a subscription to that scope already exists it will use it.
11573
+ *
11574
+ * @example
11575
+ * import { Channel, authAdapter, SCOPE_BOUNDARY, PUSH_CATEGORY } from 'epicenter-libs';
11576
+ * const session = authAdapter.getLocalSession();
11577
+ * const channel = new Channel({
11578
+ * scopeBoundary: SCOPE_BOUNDARY.GROUP,
11579
+ * scopeKey: session.groupKey,
11580
+ * pushCategory: PUSH_CATEGORY.CHAT,
11581
+ * });
11582
+ * await channel.subscribe((data) => {
11583
+ * console.log('Received message:', data);
11584
+ * });
11585
+ */
11586
+ class Channel {
11587
+ /**
11588
+ * Channel constructor
11589
+ *
11590
+ * @param scope Object with the scope boundary, scope key, and push category; defines the namespace for the channel
11591
+ * @param scope.scopeBoundary Scope boundary, defines the type of scope; See [scope boundary](#SCOPE_BOUNDARY) for all types
11592
+ * @param scope.scopeKey Scope key, a unique identifier tied to the scope. E.g., if your `scopeBoundary` is `GROUP`, your `scopeKey` will be your `groupKey`; for `EPISODE`, `episodeKey`, etc.
11593
+ * @param scope.pushCategory Push category, defines the type of channel; See [push category](#PUSH_CATEGORY) for all types
11594
+ */
11595
+ constructor(scope) {
11596
+ _defineProperty(this, "path", void 0);
11597
+ _defineProperty(this, "update", void 0);
11598
+ _defineProperty(this, "subscription", null);
11599
+ const {
11600
+ scopeBoundary,
11601
+ scopeKey,
11602
+ pushCategory
11603
+ } = scope;
11604
+ validateScope(scope);
11605
+ this.path = `/${scopeBoundary.toLowerCase()}/${scopeKey}/${pushCategory.toLowerCase()}`;
11606
+ if (cometdAdapter.subscriptions.has(this.path)) {
11607
+ this.subscription = cometdAdapter.subscriptions.get(this.path) || null;
11608
+ }
11609
+ }
11610
+
11611
+ /**
11612
+ * Publishes content to the CometD channel
11613
+ *
11614
+ * @example
11615
+ * import { Channel, authAdapter, SCOPE_BOUNDARY, PUSH_CATEGORY } from 'epicenter-libs';
11616
+ * const session = authAdapter.getLocalSession();
11617
+ * const channel = new Channel({
11618
+ * scopeBoundary: SCOPE_BOUNDARY.GROUP,
11619
+ * scopeKey: session.groupKey,
11620
+ * pushCategory: PUSH_CATEGORY.CHAT,
11621
+ * });
11622
+ * await channel.publish({ message: 'Hello!' });
11623
+ *
11624
+ * @param content Content to publish to the channel
11625
+ * @returns promise that resolves to the CometD message response
11626
+ */
11627
+ publish(content) {
11628
+ return cometdAdapter.publish(this, content);
11629
+ }
11630
+
11631
+ /**
10637
11632
  * Subscribes to the CometD channel, attaching a handler for any channel updates. If a subscription already exists it will first unsubscribe, ensuring that only one subscription is ever attached to the channel.
10638
11633
  *
10639
11634
  * @example
@@ -10745,6 +11740,367 @@
10745
11740
  }
10746
11741
  }
10747
11742
 
11743
+ // ──────────────────────────────────────────────
11744
+ // Types
11745
+ // ──────────────────────────────────────────────
11746
+
11747
+ // ──────────────────────────────────────────────
11748
+ // Functions
11749
+ // ──────────────────────────────────────────────
11750
+
11751
+ /**
11752
+ * Retrieves the git integration configuration for the project.
11753
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/git`
11754
+ *
11755
+ * @example
11756
+ * import { gitAdapter } from 'epicenter-libs';
11757
+ * const integration = await gitAdapter.get();
11758
+ *
11759
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11760
+ * @returns promise that resolves to the git integration configuration
11761
+ */
11762
+ async function get(optionals = {}) {
11763
+ return new Router().get('/git', optionals).then(({
11764
+ body
11765
+ }) => body);
11766
+ }
11767
+
11768
+ /**
11769
+ * Retrieves the current git status for the project.
11770
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/git/status`
11771
+ *
11772
+ * @example
11773
+ * import { gitAdapter } from 'epicenter-libs';
11774
+ * const status = await gitAdapter.getStatus();
11775
+ * console.log(status.currentBranch);
11776
+ *
11777
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11778
+ * @returns promise that resolves to the git status, including the current branch
11779
+ */
11780
+ async function getStatus(optionals = {}) {
11781
+ return new Router().get('/git/status', optionals).then(({
11782
+ body
11783
+ }) => body);
11784
+ }
11785
+
11786
+ /**
11787
+ * Checks out a branch in the project's git repository.
11788
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/git/checkout/{branch}`
11789
+ *
11790
+ * @example
11791
+ * import { gitAdapter } from 'epicenter-libs';
11792
+ * await gitAdapter.checkout('main');
11793
+ *
11794
+ * @param branch Name of the branch to check out
11795
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11796
+ * @returns promise that resolves when the checkout is complete
11797
+ */
11798
+ async function checkout(branch, optionals = {}) {
11799
+ return new Router().get(`/git/checkout/${branch}`, optionals).then(({
11800
+ body
11801
+ }) => body);
11802
+ }
11803
+
11804
+ /**
11805
+ * Resets the project's git repository, optionally to a specific branch.
11806
+ * Base URL: DELETE `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/git/reset[/{branch}]`
11807
+ *
11808
+ * @example
11809
+ * import { gitAdapter } from 'epicenter-libs';
11810
+ * await gitAdapter.reset(); // reset current branch
11811
+ * await gitAdapter.reset({ branch: 'main' }); // reset to 'main'
11812
+ *
11813
+ * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
11814
+ * @param [optionals.branch] Branch to reset to; if omitted, resets the current branch
11815
+ * @returns promise that resolves when the reset is complete
11816
+ */
11817
+ async function reset(optionals = {}) {
11818
+ const {
11819
+ branch,
11820
+ ...routingOptions
11821
+ } = optionals;
11822
+ return new Router().delete(`/git/reset${branch ? `/${branch}` : ''}`, routingOptions).then(({
11823
+ body
11824
+ }) => body);
11825
+ }
11826
+
11827
+ /**
11828
+ * Creates a git integration for the project.
11829
+ * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/git/integration`
11830
+ *
11831
+ * @example
11832
+ * import { gitAdapter } from 'epicenter-libs';
11833
+ * const integration = await gitAdapter.createIntegration({
11834
+ * uri: 'git@github.com:myorg/myrepo.git',
11835
+ * publicKey: '...',
11836
+ * privateKey: '...',
11837
+ * publicKeySpec: 'openssh',
11838
+ * privateKeySpec: 'pkcs8',
11839
+ * algorithm: 'ed25519',
11840
+ * });
11841
+ *
11842
+ * @param integration Git integration configuration to create
11843
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11844
+ * @returns promise that resolves to the created git integration
11845
+ */
11846
+ async function createIntegration(integration, optionals = {}) {
11847
+ return new Router().post('/git/integration', {
11848
+ body: integration,
11849
+ ...optionals
11850
+ }).then(({
11851
+ body
11852
+ }) => body);
11853
+ }
11854
+
11855
+ /**
11856
+ * Updates the git integration for the project.
11857
+ * Base URL: PATCH `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/git/integration`
11858
+ *
11859
+ * @example
11860
+ * import { gitAdapter } from 'epicenter-libs';
11861
+ * const integration = await gitAdapter.updateIntegration({
11862
+ * uri: 'git@github.com:myorg/newrepo.git',
11863
+ * publicKeySpec: 'openssh',
11864
+ * privateKeySpec: 'pkcs8',
11865
+ * algorithm: 'ed25519',
11866
+ * });
11867
+ *
11868
+ * @param integration Fields to update on the git integration
11869
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11870
+ * @returns promise that resolves to the updated git integration
11871
+ */
11872
+ async function updateIntegration(integration, optionals = {}) {
11873
+ return new Router().patch('/git/integration', {
11874
+ body: integration,
11875
+ ...optionals
11876
+ }).then(({
11877
+ body
11878
+ }) => body);
11879
+ }
11880
+
11881
+ /**
11882
+ * Removes the git integration for the project.
11883
+ * Base URL: DELETE `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/git/integration`
11884
+ *
11885
+ * @example
11886
+ * import { gitAdapter } from 'epicenter-libs';
11887
+ * await gitAdapter.removeIntegration();
11888
+ *
11889
+ * @param [optionals] Optional arguments; pass network call options overrides here.
11890
+ * @returns promise that resolves when the integration is removed
11891
+ */
11892
+ async function removeIntegration(optionals = {}) {
11893
+ return new Router().delete('/git/integration', optionals).then(({
11894
+ body
11895
+ }) => body);
11896
+ }
11897
+
11898
+ /**
11899
+ * Pushes local commits to the remote git repository.
11900
+ * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/git/push`
11901
+ *
11902
+ * @example
11903
+ * import { gitAdapter } from 'epicenter-libs';
11904
+ * await gitAdapter.push({ message: 'Update simulation data' });
11905
+ *
11906
+ * @param optionals Arguments object; also accepts network call option overrides.
11907
+ * @param optionals.message Commit message (required)
11908
+ * @param [optionals.password] Password for authentication
11909
+ * @param [optionals.force] Force-push, bypassing non-fast-forward checks
11910
+ * @returns promise that resolves when the push is complete
11911
+ */
11912
+ async function push(optionals) {
11913
+ const {
11914
+ message,
11915
+ password,
11916
+ force,
11917
+ ...routingOptions
11918
+ } = optionals;
11919
+ return new Router().withSearchParams({
11920
+ force
11921
+ }).post('/git/push', {
11922
+ body: {
11923
+ message,
11924
+ password
11925
+ },
11926
+ ...routingOptions
11927
+ }).then(({
11928
+ body
11929
+ }) => body);
11930
+ }
11931
+
11932
+ /**
11933
+ * Pulls changes from the remote git repository into the project.
11934
+ * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/git/pull`
11935
+ *
11936
+ * @example
11937
+ * import { gitAdapter } from 'epicenter-libs';
11938
+ * await gitAdapter.pull({ force: true, confirm: true });
11939
+ *
11940
+ * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
11941
+ * @param [optionals.password] Password for authentication
11942
+ * @param [optionals.force] Force the pull, overwriting local changes
11943
+ * @param [optionals.confirm] Set the `X-Forio-Confirmation` header to confirm an overwrite
11944
+ * @returns promise that resolves when the pull is complete
11945
+ */
11946
+ async function pull(optionals = {}) {
11947
+ const {
11948
+ password,
11949
+ force,
11950
+ confirm,
11951
+ headers: headersOverride,
11952
+ ...routingOptions
11953
+ } = optionals;
11954
+ const headers = Object.assign({}, headersOverride, confirm ? {
11955
+ 'X-Forio-Confirmation': true
11956
+ } : {});
11957
+ return new Router().withSearchParams({
11958
+ force
11959
+ }).post('/git/pull', {
11960
+ body: {
11961
+ password
11962
+ },
11963
+ headers,
11964
+ ...routingOptions
11965
+ }).then(({
11966
+ body
11967
+ }) => body);
11968
+ }
11969
+
11970
+ var git = /*#__PURE__*/Object.freeze({
11971
+ __proto__: null,
11972
+ checkout: checkout,
11973
+ createIntegration: createIntegration,
11974
+ get: get,
11975
+ getStatus: getStatus,
11976
+ pull: pull,
11977
+ push: push,
11978
+ removeIntegration: removeIntegration,
11979
+ reset: reset,
11980
+ updateIntegration: updateIntegration
11981
+ });
11982
+
11983
+ // ──────────────────────────────────────────────
11984
+ // Data Points
11985
+ // ──────────────────────────────────────────────
11986
+
11987
+ // ──────────────────────────────────────────────
11988
+ // Chart Series
11989
+ // ──────────────────────────────────────────────
11990
+
11991
+ // ──────────────────────────────────────────────
11992
+ // Chart, Table, Picture
11993
+ // ──────────────────────────────────────────────
11994
+
11995
+ // ──────────────────────────────────────────────
11996
+ // Binary Data
11997
+ // ──────────────────────────────────────────────
11998
+
11999
+ // ──────────────────────────────────────────────
12000
+ // Environment, Slide, Document
12001
+ // ──────────────────────────────────────────────
12002
+
12003
+ /**
12004
+ * Generates a PowerPoint file from a template and returns it as binary data (JSON-encoded)
12005
+ * Base URL: PUT `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/powerpoint/{TEMPLATE_DIRECTORY}/{TEMPLATE_PATH}`
12006
+ *
12007
+ * @example
12008
+ * import { powerpointAdapter } from 'epicenter-libs';
12009
+ * const binaryData = await powerpointAdapter.generate('MODEL', 'en-US-debrief-template.pptx', {
12010
+ * output: 'debrief-slides.pptx',
12011
+ * environment: {},
12012
+ * slides: [
12013
+ * {
12014
+ * number: 1,
12015
+ * environment: {
12016
+ * tables: [{ name: 'Leaderboard', data: [['Rank', 'Name', 'Score']] }],
12017
+ * },
12018
+ * },
12019
+ * ],
12020
+ * });
12021
+ *
12022
+ * @param templateDirectory Directory where the template is stored: 'DATA' or 'MODEL'
12023
+ * @param templatePath Path to the template file within the directory
12024
+ * @param document Document shadow defining the output filename, environment, and slides
12025
+ * @param [optionals] Optional arguments; pass network call options overrides here.
12026
+ * @returns promise that resolves to the generated PowerPoint as BinaryData
12027
+ */
12028
+ async function generate(templateDirectory, templatePath, document, optionals = {}) {
12029
+ return new Router().put(`/powerpoint/${templateDirectory}/${templatePath}`, {
12030
+ body: document,
12031
+ ...optionals
12032
+ }).then(({
12033
+ body
12034
+ }) => body);
12035
+ }
12036
+
12037
+ /**
12038
+ * Generates a PowerPoint file from a template and returns it as a streaming response.
12039
+ * Useful for downloading the generated file directly.
12040
+ * Base URL: POST `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/powerpoint/{TEMPLATE_DIRECTORY}/{TEMPLATE_PATH}`
12041
+ *
12042
+ * @example
12043
+ * import { powerpointAdapter } from 'epicenter-libs';
12044
+ * const response = await powerpointAdapter.stream('MODEL', 'en-US-debrief-template.pptx', {
12045
+ * output: 'debrief-slides.pptx',
12046
+ * environment: {},
12047
+ * slides: [],
12048
+ * });
12049
+ * const blob = await response.blob();
12050
+ *
12051
+ * @param templateDirectory Directory where the template is stored: 'DATA' or 'MODEL'
12052
+ * @param templatePath Path to the template file within the directory
12053
+ * @param document Document shadow defining the output filename, environment, and slides
12054
+ * @param [optionals] Optional arguments; pass network call options overrides here.
12055
+ * @returns promise that resolves to the raw Response for streaming/blob handling
12056
+ */
12057
+ async function stream(templateDirectory, templatePath, document, optionals = {}) {
12058
+ const {
12059
+ server,
12060
+ accountShortName,
12061
+ projectShortName,
12062
+ useProjectProxy,
12063
+ query,
12064
+ headers: headersOverride,
12065
+ authorization,
12066
+ includeAuthorization
12067
+ } = optionals;
12068
+ const url = new Router().getURL(`/powerpoint/${templateDirectory}/${templatePath}`, {
12069
+ server,
12070
+ accountShortName,
12071
+ projectShortName,
12072
+ useProjectProxy,
12073
+ query
12074
+ });
12075
+ const headers = {
12076
+ 'Content-type': 'application/json; charset=UTF-8',
12077
+ ...headersOverride
12078
+ };
12079
+ if (includeAuthorization !== false) {
12080
+ const {
12081
+ session
12082
+ } = identification;
12083
+ if (!headers.Authorization) {
12084
+ if (session) headers.Authorization = `Bearer ${session.token}`;
12085
+ if (authorization) headers.Authorization = authorization;
12086
+ if (config.authOverride) headers.Authorization = config.authOverride;
12087
+ }
12088
+ }
12089
+ return fetch(url.toString(), {
12090
+ method: 'POST',
12091
+ cache: 'no-cache',
12092
+ redirect: 'follow',
12093
+ headers,
12094
+ body: JSON.stringify(document)
12095
+ });
12096
+ }
12097
+
12098
+ var powerpoint = /*#__PURE__*/Object.freeze({
12099
+ __proto__: null,
12100
+ generate: generate,
12101
+ stream: stream
12102
+ });
12103
+
10748
12104
  const proxy = async (resource, options) => {
10749
12105
  const {
10750
12106
  accountShortName,
@@ -10762,9 +12118,9 @@
10762
12118
  proxy: proxy
10763
12119
  });
10764
12120
 
10765
- /* yes, this string template literal is weird;
10766
- * it's cause rollup does not recogize 3.34.1 as an individual token otherwise */
10767
- const version = `Epicenter (v${'3.34.1'}) for Browsers | Build Date: 2026-02-19T18:00:38.906Z`;
12121
+ /* "3.35.0", "Browsers" and "2026-07-21T22:45:13.866Z" are injected at build time — by
12122
+ * @rollup/plugin-replace for the shipped bundles and by Vite's `define` for tests */
12123
+ const version = `Epicenter (v${"3.35.0"}) for ${"Browsers"} | Build Date: ${"2026-07-21T22:45:13.866Z"}`;
10768
12124
  const UNAUTHORIZED = 401;
10769
12125
  const FORBIDDEN = 403;
10770
12126
  const DEFAULT_ERROR_HANDLERS = {};
@@ -14537,15 +15893,22 @@
14537
15893
  exports.config = config;
14538
15894
  exports.consensusAdapter = consensus;
14539
15895
  exports.dailyAdapter = daily;
15896
+ exports.docketAdapter = docket;
14540
15897
  exports.emailAdapter = email;
15898
+ exports.encyclopediaAdapter = encyclopedia;
14541
15899
  exports.episodeAdapter = episode;
14542
15900
  exports.errorManager = errorManager;
15901
+ exports.fileAdapter = file;
15902
+ exports.gitAdapter = git;
14543
15903
  exports.groupAdapter = group;
14544
15904
  exports.leaderboardAdapter = leaderboard;
14545
15905
  exports.matchmakerAdapter = matchmaker;
15906
+ exports.pipelineAdapter = pipeline;
15907
+ exports.powerpointAdapter = powerpoint;
14546
15908
  exports.presenceAdapter = presence;
14547
15909
  exports.projectAdapter = project;
14548
15910
  exports.recaptchaAdapter = recaptcha;
15911
+ exports.registrationAdapter = registration;
14549
15912
  exports.runAdapter = run;
14550
15913
  exports.somebodyAdapter = somebody;
14551
15914
  exports.taskAdapter = task;