warframe-worldstate-parser 2.24.1 → 2.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Fissure.js CHANGED
@@ -2,11 +2,15 @@
2
2
 
3
3
  const WorldstateObject = require('./WorldstateObject');
4
4
 
5
+ /**
6
+ * @typedef {Object} ContentFissure
7
+ * @property
8
+ */
5
9
  /**
6
10
  * Represents a fissure mission
7
11
  * @extends {WorldstateObject}
8
12
  */
9
- class Fissure extends WorldstateObject {
13
+ module.exports = class Fissure extends WorldstateObject {
10
14
  /**
11
15
  * @param {Object} data The fissure data
12
16
  * @param {Object} deps The dependencies object
@@ -90,7 +94,7 @@ class Fissure extends WorldstateObject {
90
94
  this.expiry = timeDate.parseDate(data.Expiry);
91
95
 
92
96
  /**
93
- * Whether or not this is expired (at time of object creation)
97
+ * Whether this is expired (at time of object creation)
94
98
  * @type {boolean}
95
99
  */
96
100
  this.expired = this.getExpired();
@@ -102,14 +106,20 @@ class Fissure extends WorldstateObject {
102
106
  this.eta = this.getETAString();
103
107
 
104
108
  /**
105
- * Whether or not this fissure corresponds to a RailJack Void Storm
109
+ * Whether this fissure corresponds to a RailJack Void Storm
106
110
  * @type {Boolean}
107
111
  */
108
112
  this.isStorm = !!data.ActiveMissionTier;
113
+
114
+ /**
115
+ * Whether this fissure is a Steel Path fissure
116
+ * @type {boolean}
117
+ */
118
+ this.isHard = !!data.Hard;
109
119
  }
110
120
 
111
121
  /**
112
- * Get whether or not this deal has expired
122
+ * Get whether this deal has expired
113
123
  * @returns {boolean}
114
124
  */
115
125
  getExpired() {
@@ -131,6 +141,4 @@ class Fissure extends WorldstateObject {
131
141
  toString() {
132
142
  return `[${this.getETAString()}] ${this.tier} fissure at ${this.node} - ${this.enemy} ${this.missionType}`;
133
143
  }
134
- }
135
-
136
- module.exports = Fissure;
144
+ };
package/lib/Mission.js CHANGED
@@ -38,13 +38,13 @@ module.exports = class Mission {
38
38
  * The node where the mission takes place
39
39
  * @type {string}
40
40
  */
41
- this.node = translator.node(data.location, locale);
41
+ this.node = translator.node(data.location || data.node, locale);
42
42
 
43
43
  /**
44
44
  * Unlocalized {@link mission#node}
45
45
  * @type {string}
46
46
  */
47
- this.nodeKey = translator.node(data.location, 'en');
47
+ this.nodeKey = translator.node(data.location || data.node, 'en');
48
48
 
49
49
  /**
50
50
  * The mission's type
@@ -45,6 +45,7 @@ class SentientOutpost {
45
45
  if (!data) data = '{"sfn":000}';
46
46
  const node = (data.match(/\d{3}/g) || ['000'])[0];
47
47
  const id = `CrewBattleNode${node}`;
48
+ /* istanbul ignore if */
48
49
  if (node === '000') {
49
50
  this.mission = undefined;
50
51
  } else {
package/lib/Sortie.js CHANGED
@@ -10,14 +10,14 @@ class Sortie extends WorldstateObject {
10
10
  /**
11
11
  * @param {Object} data The data for all daily sorties
12
12
  * @param {Object} deps The dependencies object
13
- * @param {MarkdownSettings} deps.mdConfig The markdown settings
14
- * @param {Translator} deps.translator The string translator
15
- * @param {TimeDateFunctions} deps.timeDate The time and date functions
16
- * @param {Object} deps.sortieData The data used to parse sorties
17
- * @param {SortieVariant} deps.SortieVariant The sortie variant parser
18
- * @param {string} deps.locale Locale to use for translations
13
+ * @param {MarkdownSettings} mdConfig The markdown settings
14
+ * @param {Translator} translator The string translator
15
+ * @param {TimeDateFunctions} timeDate The time and date functions
16
+ * @param {Object} sortieData The data used to parse sorties
17
+ * @param {SortieVariant} SortieVariant The sortie variant parser
18
+ * @param {string} locale Locale to use for translations
19
19
  */
20
- constructor(data, { mdConfig, translator, timeDate, sortieData, SortieVariant, locale }) {
20
+ constructor(data, { mdConfig, translator, timeDate, sortieData, SortieVariant, locale, Mission }) {
21
21
  super(data, { timeDate });
22
22
 
23
23
  const opts = {
@@ -67,7 +67,9 @@ class Sortie extends WorldstateObject {
67
67
  * The sortie's variants
68
68
  * @type {Array.<SortieVariant>}
69
69
  */
70
- this.variants = data.Variants.map((v) => new SortieVariant(v, opts));
70
+ this.variants = (data.Variants || []).map((v) => new SortieVariant(v, opts));
71
+
72
+ this.missions = (data.Missions || []).map((v) => new Mission(v, opts));
71
73
 
72
74
  /**
73
75
  * The sortie's boss
@@ -88,7 +90,7 @@ class Sortie extends WorldstateObject {
88
90
  this.factionKey = translator.sortieFaction(data.boss, 'en');
89
91
 
90
92
  /**
91
- * Whether or not this is expired (at time of object creation)
93
+ * Whether this is expired (at time of object creation)
92
94
  * @type {boolean}
93
95
  */
94
96
  this.expired = this.isExpired();
@@ -6,11 +6,10 @@
6
6
  class SortieVariant {
7
7
  /**
8
8
  * @param {Object} data Sortie variant data
9
- * @param {Object} deps The dependencies object
10
- * @param {MarkdownSettings} deps.mdConfig The markdown settings
11
- * @param {Translator} deps.translator The string translator
12
- * @param {Object} deps.sortieData The data used to parse sorties
13
- * @param {string} deps.locale Locale to use for translations
9
+ * @param {MarkdownSettings} mdConfig The markdown settings
10
+ * @param {Translator} translator The string translator
11
+ * @param {Object} sortieData The data used to parse sorties
12
+ * @param {string} locale Locale to use for translations
14
13
  */
15
14
  constructor(data, { mdConfig, translator, locale }) {
16
15
  /**
@@ -51,9 +50,9 @@ class SortieVariant {
51
50
  * @returns {string}
52
51
  */
53
52
  toString() {
54
- return `${this.node.padEnd(25, ' ')} | ${this.modifier.padEnd(20, ' ')} | ${this.missionType}${
55
- this.mdConfig.lineEnd
56
- }`;
53
+ return this.modifier
54
+ ? `${this.node.padEnd(25, ' ')} | ${this.modifier.padEnd(20, ' ')} | ${this.missionType}${this.mdConfig.lineEnd}`
55
+ : `${this.node.padEnd(25, ' ')} | ${this.missionType}${this.mdConfig.lineEnd}`;
57
56
  }
58
57
  }
59
58
 
@@ -4,6 +4,7 @@ const monday = 1;
4
4
 
5
5
  function getFirstDayOfWeek() {
6
6
  const resultDate = new Date();
7
+ /* istanbul ignore next */
7
8
  const offset = resultDate.getUTCDay() === 0 ? 6 : resultDate.getUTCDay() - monday;
8
9
  resultDate.setUTCDate(resultDate.getUTCDate() - offset);
9
10
  resultDate.setUTCHours(0);
@@ -74,6 +74,7 @@ const getBountyRewards = async (i18n, isVault, raw) => {
74
74
  if (results) {
75
75
  return Array.from(new Set(results.map((result) => result.item)));
76
76
  }
77
+ /* istanbul ignore next */
77
78
  return [];
78
79
  };
79
80
 
package/lib/WorldState.js CHANGED
@@ -35,12 +35,8 @@ const SentientOutpost = require('./SentientOutpost');
35
35
  const CambionCycle = require('./CambionCycle');
36
36
  const SteelPathOffering = require('./SteelPathOffering');
37
37
 
38
- /* eslint-disable no-unused-vars */
39
38
  // needed for type declarations
40
- const Dependency = require('./supporting/Dependency');
41
- const ExternalMission = require('./supporting/ExternalMission');
42
39
  const MarkdownSettings = require('./supporting/MarkdownSettings');
43
- /* eslint-enable no-unused-vars */
44
40
 
45
41
  const safeArray = (arr) => arr || [];
46
42
  const safeObj = (obj) => obj || {};
@@ -78,6 +74,14 @@ const defaultDeps = {
78
74
  logger: console,
79
75
  };
80
76
 
77
+ /**
78
+ *
79
+ * @param {Object} ParserClass class for parsing data
80
+ * @param {Array<BaseContentObject>} dataArray array of raw data
81
+ * @param {Dependency} deps shared dependency object
82
+ * @param {*} uniqueField field to treat as unique
83
+ * @returns {WorldstateObject}
84
+ */
81
85
  function parseArray(ParserClass, dataArray, deps, uniqueField) {
82
86
  const arr = (dataArray || []).map((d) => new ParserClass(d, deps));
83
87
  if (uniqueField) {
@@ -90,6 +94,7 @@ function parseArray(ParserClass, dataArray, deps, uniqueField) {
90
94
  if (Object.prototype.hasOwnProperty.call(obj, 'active')) {
91
95
  return obj.active;
92
96
  }
97
+ /* istanbul ignore next */
93
98
  return true;
94
99
  });
95
100
  }
@@ -314,5 +319,11 @@ module.exports = class WorldState {
314
319
  this.steelPath = new SteelPathOffering(deps);
315
320
 
316
321
  [this.vaultTrader] = parseArray(deps.VoidTrader, data.PrimeVaultTraders, deps);
322
+
323
+ /**
324
+ * The current archon hunt
325
+ * @type {Sortie}
326
+ */
327
+ [this.archonHunt] = parseArray(deps.Sortie, data.LiteSorties, deps);
317
328
  }
318
329
  };
@@ -1,16 +1,41 @@
1
1
  'use strict';
2
2
 
3
3
  /**
4
- * Represents a generic ojbect from Worldstate
4
+ * @typedef {Object} Identifier
5
+ * @property {string} $id older identifier schema
6
+ * @property {string} $oid newer global identifier schema
5
7
  */
6
- class WorldstateObject {
8
+ /**
9
+ * @typedef {Object} LegacyTimestamp
10
+ * @property {number} sec second-based timestamp
11
+ */
12
+ /**
13
+ * @typedef {Object} Timestamp
14
+ * @property {number} $numberLong millisecond-based timestamp
15
+ */
16
+ /**
17
+ * @typedef {Object} ContentTimestamp
18
+ * @property {LegacyTimestamp|Timestamp} $date timestamp number wrapper
19
+ */
20
+ /**
21
+ * @typedef {Object} BaseContentObject
22
+ * @property {Identifier} _id
23
+ * @property {ContentTimestamp} Activation
24
+ * @property {ContentTimestamp} Expiry
25
+ */
26
+
27
+ /**
28
+ * Represents a generic object from Worldstate
29
+ */
30
+ module.exports = class WorldstateObject {
7
31
  /**
8
- * @param {Object} data The object data
32
+ * @param {BaseContentObject} data The object data
33
+ * @param {TimeDateFunctions} timeDate time date functions
9
34
  */
10
35
  constructor(data, { timeDate }) {
11
36
  /**
12
37
  * The object's id field
13
- * @type {string}
38
+ * @type {Identifier.$id|Identifier.$oid}
14
39
  */
15
40
  // eslint-disable-next-line no-underscore-dangle
16
41
  this.id = data._id ? data._id.$oid || data._id.$id : undefined;
@@ -48,7 +73,7 @@ class WorldstateObject {
48
73
 
49
74
  if (data.Activation && data.Expiry) {
50
75
  /**
51
- * Whether or not the void trader is active (at time of object creation)
76
+ * Whether the void trader is active (at time of object creation)
52
77
  * @type {boolean}
53
78
  */
54
79
  this.active = this.isActive();
@@ -64,7 +89,7 @@ class WorldstateObject {
64
89
  }
65
90
 
66
91
  /**
67
- * Get whether or not the trader is currently active
92
+ * Get whether the trader is currently active
68
93
  * @returns {boolean}
69
94
  */
70
95
  isActive() {
@@ -86,6 +111,4 @@ class WorldstateObject {
86
111
  getEndString() {
87
112
  return this.timeDate.timeDeltaToString(this.timeDate.fromNow(this.expiry));
88
113
  }
89
- }
90
-
91
- module.exports = WorldstateObject;
114
+ };
@@ -91,11 +91,11 @@ module.exports = class ZarimanCycle extends WorldstateObject {
91
91
  }
92
92
 
93
93
  /**
94
- * Get whether or not the event has expired
94
+ * Get whether the event has expired
95
95
  * @returns {boolean}
96
96
  */
97
97
  getExpired() {
98
- return this.expiry ? this.timeDate.fromNow(this.expiry) < 0 : true;
98
+ return this.expiry ? this.timeDate.fromNow(this.expiry) < 0 : /* istanbul ignore next */ true;
99
99
  }
100
100
 
101
101
  getCurrentZarimanCycle() {
package/lib/timeDate.js CHANGED
@@ -1,15 +1,5 @@
1
1
  'use strict';
2
2
 
3
- /**
4
- * An object containing functions to format dates and times
5
- * @typedef {Object.<function>} TimeDateFunctions
6
- * @property {function} timeDeltaToString - Converts a time difference to a string
7
- * @property {function} fromNow - Returns the number of milliseconds between now and
8
- * a given date
9
- * @property {function} toNow - Returns the number of milliseconds between a given
10
- * date and now
11
- */
12
-
13
3
  const epochZero = {
14
4
  $date: {
15
5
  $numberLong: 0,
@@ -42,6 +32,8 @@ function timeDeltaToString(millis) {
42
32
  timePieces.push(`${Math.floor(seconds / 60)}m`);
43
33
  seconds = Math.floor(seconds) % 60;
44
34
  }
35
+
36
+ /* istanbul ignore else */
45
37
  if (seconds >= 0) {
46
38
  timePieces.push(`${Math.floor(seconds)}s`);
47
39
  }
@@ -79,6 +71,15 @@ function parseDate(d) {
79
71
  return new Date(safeD.$date ? Number(dt.$numberLong) : 1000 * d.sec);
80
72
  }
81
73
 
74
+ /**
75
+ * An object containing functions to format dates and times
76
+ * @typedef {Object.<function>} TimeDateFunctions
77
+ * @property {function} timeDeltaToString - Converts a time difference to a string
78
+ * @property {function} fromNow - Returns the number of milliseconds between now and
79
+ * a given date
80
+ * @property {function} toNow - Returns the number of milliseconds between a given
81
+ * date and now
82
+ */
82
83
  module.exports = {
83
84
  timeDeltaToString,
84
85
  fromNow,
@@ -1,30 +1,5 @@
1
1
  'use strict';
2
2
 
3
- /**
4
- * An object containing functions to convert in-game names to their localizations
5
- * @typedef {Object.<function>} Translator
6
- * @property {function} faction - Converts faction names
7
- * @property {function} node - Converts star map node names
8
- * @property {function} nodeMissionType - Returns the mission type of a given node
9
- * @property {function} nodeEnemy - Returns the faction that controls a given node
10
- * @property {function} languageString - Converts generic language strings
11
- * @property {function} languageDesc - Converts generic language strings
12
- * and retrieves the description
13
- * @property {function} missionType - Converts mission types
14
- * @property {function} conclaveMode - Converts conclave modes
15
- * @property {function} conclaveCategory - Converts conclave challenge categories
16
- * @property {function} fissureModifier - Converts fissure mission modifiers
17
- * @property {function} syndicate - Converts syndicate names
18
- * @property {function} upgrade - Converts upgrade types
19
- * @property {function} operation - Converts operation types
20
- * @property {function} sortieBoss - Converts sortie boss names
21
- * @property {function} sortieModifer - Converts sortie modifier types
22
- * @property {function} sortieModDesc - Converts sortie modifier type descriptions
23
- * @property {function} region - Converts persistent enemy region indicies
24
- * @property {function} conclaveChallenge - Convert conclave identifiers into standing data
25
- * @property {function} steelPath - Retrieve Steel Path rotation data for locale
26
- */
27
-
28
3
  const data = require('warframe-worldstate-data');
29
4
 
30
5
  function toTitleCase(str) {
@@ -218,9 +193,33 @@ function conclaveChallenge(key, dataOverride) {
218
193
  }
219
194
 
220
195
  function steelPath(dataOverride) {
221
- return (i18n(dataOverride) || data).steelPath;
196
+ return (i18n(dataOverride) || /* istanbul ignore next */ data).steelPath;
222
197
  }
223
198
 
199
+ /**
200
+ * An object containing functions to convert in-game names to their localizations
201
+ * @typedef {Object.<function>} Translator
202
+ * @property {function} faction - Converts faction names
203
+ * @property {function} node - Converts star map node names
204
+ * @property {function} nodeMissionType - Returns the mission type of a given node
205
+ * @property {function} nodeEnemy - Returns the faction that controls a given node
206
+ * @property {function} languageString - Converts generic language strings
207
+ * @property {function} languageDesc - Converts generic language strings
208
+ * and retrieves the description
209
+ * @property {function} missionType - Converts mission types
210
+ * @property {function} conclaveMode - Converts conclave modes
211
+ * @property {function} conclaveCategory - Converts conclave challenge categories
212
+ * @property {function} fissureModifier - Converts fissure mission modifiers
213
+ * @property {function} syndicate - Converts syndicate names
214
+ * @property {function} upgrade - Converts upgrade types
215
+ * @property {function} operation - Converts operation types
216
+ * @property {function} sortieBoss - Converts sortie boss names
217
+ * @property {function} sortieModifier - Converts sortie modifier types
218
+ * @property {function} sortieModDesc - Converts sortie modifier type descriptions
219
+ * @property {function} region - Converts persistent enemy region indicies
220
+ * @property {function} conclaveChallenge - Convert conclave identifiers into standing data
221
+ * @property {function} steelPath - Retrieve Steel Path rotation data for locale
222
+ */
224
223
  module.exports = {
225
224
  faction,
226
225
  node,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warframe-worldstate-parser",
3
- "version": "2.24.1",
3
+ "version": "2.25.0",
4
4
  "description": "An Open parser for Warframe's Worldstate in Javascript",
5
5
  "types": "./types/main.d.ts",
6
6
  "main": "main.js",
@@ -1,6 +1,15 @@
1
1
  export = CambionCycle;
2
2
  declare class CambionCycle extends WorldstateObject {
3
+ /**
4
+ * @param {CetusCycle} cetusCycle Match data from cetus cycle for data
5
+ * @param {Object} deps The dependencies object
6
+ * @param {TimeDateFunctions} deps.timeDate The time and date functions
7
+ */
8
+ constructor(cetusCycle: CetusCycle, { timeDate }: {
9
+ timeDate: TimeDateFunctions;
10
+ });
3
11
  active: string;
12
+ id: string;
4
13
  /**
5
14
  * Get whether or not the event has expired
6
15
  * @returns {boolean}
@@ -46,6 +46,7 @@ declare class CetusCycle extends WorldstateObject {
46
46
  * @type {boolean}
47
47
  */
48
48
  isCetus: boolean;
49
+ id: string;
49
50
  shortString: string;
50
51
  /**
51
52
  * Get whether or not the event has expired
@@ -31,6 +31,7 @@ declare class EarthCycle extends WorldstateObject {
31
31
  * @type {string}
32
32
  */
33
33
  timeLeft: string;
34
+ id: string;
34
35
  /**
35
36
  * Get whether or not the event has expired
36
37
  * @returns {boolean}
@@ -1,8 +1,4 @@
1
1
  export = Fissure;
2
- /**
3
- * Represents a fissure mission
4
- * @extends {WorldstateObject}
5
- */
6
2
  declare class Fissure extends WorldstateObject {
7
3
  /**
8
4
  * @param {Object} data The fissure data
@@ -57,7 +53,7 @@ declare class Fissure extends WorldstateObject {
57
53
  */
58
54
  tierNum: number;
59
55
  /**
60
- * Whether or not this is expired (at time of object creation)
56
+ * Whether this is expired (at time of object creation)
61
57
  * @type {boolean}
62
58
  */
63
59
  expired: boolean;
@@ -67,12 +63,17 @@ declare class Fissure extends WorldstateObject {
67
63
  */
68
64
  eta: string;
69
65
  /**
70
- * Whether or not this fissure corresponds to a RailJack Void Storm
66
+ * Whether this fissure corresponds to a RailJack Void Storm
71
67
  * @type {Boolean}
72
68
  */
73
69
  isStorm: boolean;
74
70
  /**
75
- * Get whether or not this deal has expired
71
+ * Whether this fissure is a Steel Path fissure
72
+ * @type {boolean}
73
+ */
74
+ isHard: boolean;
75
+ /**
76
+ * Get whether this deal has expired
76
77
  * @returns {boolean}
77
78
  */
78
79
  getExpired(): boolean;
@@ -22,6 +22,7 @@ declare class Nightwave extends WorldstateObject {
22
22
  Reward: Reward;
23
23
  locale: string;
24
24
  });
25
+ id: string;
25
26
  /**
26
27
  * The markdown settings
27
28
  * @type {MarkdownSettings}
@@ -36,6 +36,12 @@ declare class NightwaveChallenge extends WorldstateObject {
36
36
  * @type {string}
37
37
  */
38
38
  title: string;
39
+ /**
40
+ * Generated id from expiry, challenge string,
41
+ * and whether or not it has `[PH]` (designating placeholder text)
42
+ * @type {string}
43
+ */
44
+ id: string;
39
45
  /**
40
46
  * Reputation reward for ranking up in the Nightwave
41
47
  * @type {Number}
@@ -7,21 +7,14 @@ declare class Sortie extends WorldstateObject {
7
7
  /**
8
8
  * @param {Object} data The data for all daily sorties
9
9
  * @param {Object} deps The dependencies object
10
- * @param {MarkdownSettings} deps.mdConfig The markdown settings
11
- * @param {Translator} deps.translator The string translator
12
- * @param {TimeDateFunctions} deps.timeDate The time and date functions
13
- * @param {Object} deps.sortieData The data used to parse sorties
14
- * @param {SortieVariant} deps.SortieVariant The sortie variant parser
15
- * @param {string} deps.locale Locale to use for translations
10
+ * @param {MarkdownSettings} mdConfig The markdown settings
11
+ * @param {Translator} translator The string translator
12
+ * @param {TimeDateFunctions} timeDate The time and date functions
13
+ * @param {Object} sortieData The data used to parse sorties
14
+ * @param {SortieVariant} SortieVariant The sortie variant parser
15
+ * @param {string} locale Locale to use for translations
16
16
  */
17
- constructor(data: any, { mdConfig, translator, timeDate, sortieData, SortieVariant, locale }: {
18
- mdConfig: MarkdownSettings;
19
- translator: Translator;
20
- timeDate: TimeDateFunctions;
21
- sortieData: any;
22
- SortieVariant: SortieVariant;
23
- locale: string;
24
- });
17
+ constructor(data: any, { mdConfig, translator, timeDate, sortieData, SortieVariant, locale, Mission }: any);
25
18
  /**
26
19
  * The markdown settings
27
20
  * @type {MarkdownSettings}
@@ -37,7 +30,8 @@ declare class Sortie extends WorldstateObject {
37
30
  * The sortie's variants
38
31
  * @type {Array.<SortieVariant>}
39
32
  */
40
- variants: Array<SortieVariant>;
33
+ variants: Array<any>;
34
+ missions: any;
41
35
  /**
42
36
  * The sortie's boss
43
37
  * @type {string}
@@ -54,7 +48,7 @@ declare class Sortie extends WorldstateObject {
54
48
  */
55
49
  factionKey: string;
56
50
  /**
57
- * Whether or not this is expired (at time of object creation)
51
+ * Whether this is expired (at time of object creation)
58
52
  * @type {boolean}
59
53
  */
60
54
  expired: boolean;
@@ -5,18 +5,12 @@ export = SortieVariant;
5
5
  declare class SortieVariant {
6
6
  /**
7
7
  * @param {Object} data Sortie variant data
8
- * @param {Object} deps The dependencies object
9
- * @param {MarkdownSettings} deps.mdConfig The markdown settings
10
- * @param {Translator} deps.translator The string translator
11
- * @param {Object} deps.sortieData The data used to parse sorties
12
- * @param {string} deps.locale Locale to use for translations
8
+ * @param {MarkdownSettings} mdConfig The markdown settings
9
+ * @param {Translator} translator The string translator
10
+ * @param {Object} sortieData The data used to parse sorties
11
+ * @param {string} locale Locale to use for translations
13
12
  */
14
- constructor(data: any, { mdConfig, translator, locale }: {
15
- mdConfig: MarkdownSettings;
16
- translator: Translator;
17
- sortieData: any;
18
- locale: string;
19
- });
13
+ constructor(data: any, { mdConfig, translator, locale }: MarkdownSettings);
20
14
  /**
21
15
  * The markdown settings
22
16
  * @type {MarkdownSettings}
@@ -50,6 +50,11 @@ declare class SyndicateMission extends WorldstateObject {
50
50
  * @type {Array.<SyndicateJob>}
51
51
  */
52
52
  jobs: Array<SyndicateJob>;
53
+ /**
54
+ * Unique identifier for this mission set built from the end time and syndicate
55
+ * @type {string}
56
+ */
57
+ id: string;
53
58
  /**
54
59
  * ETA string (at time of object creation)
55
60
  * @type {String}
@@ -32,6 +32,7 @@ declare class VallisCycle extends WorldstateObject {
32
32
  * @type {string}
33
33
  */
34
34
  timeLeft: string;
35
+ id: string;
35
36
  shortString: string;
36
37
  /**
37
38
  * Get whether or not the event has expired
@@ -147,4 +147,3 @@ import VallisCycle = require("./VallisCycle");
147
147
  import Nightwave = require("./Nightwave");
148
148
  import SentientOutpost = require("./SentientOutpost");
149
149
  import SteelPathOffering = require("./SteelPathOffering");
150
- import Dependency = require("./supporting/Dependency");
@@ -1,19 +1,15 @@
1
1
  export = WorldstateObject;
2
- /**
3
- * Represents a generic ojbect from Worldstate
4
- */
5
2
  declare class WorldstateObject {
6
3
  /**
7
- * @param {Object} data The object data
4
+ * @param {BaseContentObject} data The object data
5
+ * @param {TimeDateFunctions} timeDate time date functions
8
6
  */
9
- constructor(data: any, { timeDate }: {
10
- timeDate: any;
11
- });
7
+ constructor(data: BaseContentObject, { timeDate }: TimeDateFunctions);
12
8
  /**
13
9
  * The object's id field
14
- * @type {string}
10
+ * @type {Identifier.$id|Identifier.$oid}
15
11
  */
16
- id: string;
12
+ id: Identifier.$id | Identifier.$oid;
17
13
  /**
18
14
  * The time and date functions
19
15
  * @type {TimeDateFunctions}
@@ -37,7 +33,7 @@ declare class WorldstateObject {
37
33
  */
38
34
  expiry: Date;
39
35
  /**
40
- * Whether or not the void trader is active (at time of object creation)
36
+ * Whether the void trader is active (at time of object creation)
41
37
  * @type {boolean}
42
38
  */
43
39
  active: boolean;
@@ -47,7 +43,7 @@ declare class WorldstateObject {
47
43
  */
48
44
  toString(): string;
49
45
  /**
50
- * Get whether or not the trader is currently active
46
+ * Get whether the trader is currently active
51
47
  * @returns {boolean}
52
48
  */
53
49
  isActive(): boolean;
@@ -62,3 +58,39 @@ declare class WorldstateObject {
62
58
  */
63
59
  getEndString(): string;
64
60
  }
61
+ declare namespace WorldstateObject {
62
+ export { Identifier, LegacyTimestamp, Timestamp, ContentTimestamp, BaseContentObject };
63
+ }
64
+ type BaseContentObject = {
65
+ _id: Identifier;
66
+ Activation: ContentTimestamp;
67
+ Expiry: ContentTimestamp;
68
+ };
69
+ type Identifier = {
70
+ /**
71
+ * older identifier schema
72
+ */
73
+ $id: string;
74
+ /**
75
+ * newer global identifier schema
76
+ */
77
+ $oid: string;
78
+ };
79
+ type LegacyTimestamp = {
80
+ /**
81
+ * second-based timestamp
82
+ */
83
+ sec: number;
84
+ };
85
+ type Timestamp = {
86
+ /**
87
+ * millisecond-based timestamp
88
+ */
89
+ $numberLong: number;
90
+ };
91
+ type ContentTimestamp = {
92
+ /**
93
+ * timestamp number wrapper
94
+ */
95
+ $date: LegacyTimestamp | Timestamp;
96
+ };
@@ -37,9 +37,10 @@ declare class ZarimanCycle extends WorldstateObject {
37
37
  * @type {string}
38
38
  */
39
39
  timeLeft: string;
40
+ id: string;
40
41
  shortString: string;
41
42
  /**
42
- * Get whether or not the event has expired
43
+ * Get whether the event has expired
43
44
  * @returns {boolean}
44
45
  */
45
46
  getExpired(): boolean;
package/types/main.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  declare const _exports: {
2
- new (json: string, deps?: import("./lib/supporting/Dependency")): import("./lib/WorldState");
2
+ new (json: string, deps?: Dependency): import("./lib/WorldState");
3
3
  };
4
4
  export = _exports;