@juice789/tf2items 1.0.16 → 1.0.17
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/app.js +9 -10
- package/fetchAppDataInventory.js +2 -2
- package/fetchItemsApi.js +2 -2
- package/fetchItemsGame.js +2 -2
- package/fetchParticleEffects.js +2 -2
- package/fetchTextures.js +2 -2
- package/fetchTfEnglish.js +2 -2
- package/fromEconItem.js +12 -3
- package/options-example.json +2 -1
- package/options.json +2 -1
- package/package.json +1 -1
- package/sagas.js +12 -12
- package/saveSchema.js +12 -12
- package/schema.json +1 -1
- package/sku.js +2 -1
- package/skuBp.js +2 -2
- package/skuLinks.js +40 -35
package/app.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const { runSaga } = require('redux-saga')
|
|
2
|
-
const { map
|
|
3
|
-
const { renameKeysWith } = require('ramda-adjunct')
|
|
2
|
+
const { map } = require('ramda')
|
|
4
3
|
|
|
5
4
|
const helperObjects = require('./schemaHelper.json')
|
|
6
5
|
const sagaHelpers = require('./sagaHelpers')
|
|
@@ -13,7 +12,7 @@ const skuLinks = require('./skuLinks.js')
|
|
|
13
12
|
const { createApi, api } = require('./api.js')
|
|
14
13
|
|
|
15
14
|
const sagas = require('./sagas.js')
|
|
16
|
-
const {
|
|
15
|
+
const { saveSchema } = require('./saveSchema.js')
|
|
17
16
|
|
|
18
17
|
const { fromEconItem } = require('./fromEconItem.js')
|
|
19
18
|
const { fromListingV1 } = require('./fromListingV1.js')
|
|
@@ -23,18 +22,18 @@ const { toSearchParams } = require('./toSearchParams.js')
|
|
|
23
22
|
|
|
24
23
|
const getInstance = (options) => {
|
|
25
24
|
const api = createApi(options)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
const fns = { ...sagas, saveSchema }
|
|
26
|
+
return options.saga
|
|
27
|
+
? fns
|
|
28
|
+
: map(
|
|
29
29
|
(saga) => (...args) => new Promise((resolve, reject) => {
|
|
30
30
|
runSaga({
|
|
31
31
|
context: { api }
|
|
32
32
|
}, saga, ...args)
|
|
33
33
|
.toPromise()
|
|
34
34
|
.then(resolve, reject)
|
|
35
|
-
})
|
|
36
|
-
)
|
|
37
|
-
)({ ...sagas, saveSchemaSaga })
|
|
35
|
+
}), fns
|
|
36
|
+
)
|
|
38
37
|
}
|
|
39
38
|
|
|
40
39
|
module.exports = {
|
|
@@ -45,7 +44,7 @@ module.exports = {
|
|
|
45
44
|
...sagas,
|
|
46
45
|
...sagaHelpers,
|
|
47
46
|
...skuLinks,
|
|
48
|
-
|
|
47
|
+
saveSchema,
|
|
49
48
|
getInstance,
|
|
50
49
|
createApi,
|
|
51
50
|
api,
|
package/fetchAppDataInventory.js
CHANGED
|
@@ -32,7 +32,7 @@ const mergeAssetClasses = uncurryN(2, (assetClasses) => compose(
|
|
|
32
32
|
groupBy(props(['classid', 'instanceid']))
|
|
33
33
|
))
|
|
34
34
|
|
|
35
|
-
function*
|
|
35
|
+
function* fetchAppDataInventory(inventory, d = 1000) {
|
|
36
36
|
|
|
37
37
|
let p = 0, assetClasses = {}
|
|
38
38
|
const { getAssetClassInfo } = yield getContext('api')
|
|
@@ -50,5 +50,5 @@ function* fetchAppDataInventorySaga(inventory, d = 1000) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
module.exports = {
|
|
53
|
-
|
|
53
|
+
fetchAppDataInventory
|
|
54
54
|
}
|
package/fetchItemsApi.js
CHANGED
|
@@ -17,7 +17,7 @@ const transformItemsApi = compose(
|
|
|
17
17
|
indexBy(prop('defindex'))
|
|
18
18
|
)
|
|
19
19
|
|
|
20
|
-
function*
|
|
20
|
+
function* fetchItemsApi() {
|
|
21
21
|
const { getSchemaItems } = yield getContext('api')
|
|
22
22
|
let start = 0, items = []
|
|
23
23
|
do {
|
|
@@ -30,4 +30,4 @@ function* fetchItemsApiSaga() {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
module.exports = {
|
|
33
|
+
module.exports = { fetchItemsApi }
|
package/fetchItemsGame.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { call, getContext } = require('redux-saga/effects')
|
|
2
2
|
const vdf = require('vdf')
|
|
3
3
|
|
|
4
|
-
function*
|
|
4
|
+
function* fetchItemsGame() {
|
|
5
5
|
const { getItemsGameUrl, getItemsGame } = yield getContext('api')
|
|
6
6
|
const { result: { items_game_url } } = yield call(getItemsGameUrl)
|
|
7
7
|
const itemsGameVdf = yield call(getItemsGame, items_game_url)
|
|
@@ -9,4 +9,4 @@ function* fetchItemsGameSaga() {
|
|
|
9
9
|
return items_game
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
module.exports = {
|
|
12
|
+
module.exports = { fetchItemsGame }
|
package/fetchParticleEffects.js
CHANGED
|
@@ -11,10 +11,10 @@ const transformEffects = compose(
|
|
|
11
11
|
path(['result', 'attribute_controlled_attached_particles'])
|
|
12
12
|
)
|
|
13
13
|
|
|
14
|
-
function*
|
|
14
|
+
function* fetchParticleEffects() {
|
|
15
15
|
const { getSchemaOverview } = yield getContext('api')
|
|
16
16
|
const schema = yield call(getSchemaOverview)
|
|
17
17
|
return transformEffects(schema)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
module.exports = {
|
|
20
|
+
module.exports = { fetchParticleEffects }
|
package/fetchTextures.js
CHANGED
|
@@ -12,10 +12,10 @@ const transformTextures = compose(
|
|
|
12
12
|
path(['lang', 'Tokens'])
|
|
13
13
|
)
|
|
14
14
|
|
|
15
|
-
function*
|
|
15
|
+
function* fetchTextures() {
|
|
16
16
|
const { fetchProtoObjDefs } = yield getContext('api')
|
|
17
17
|
const protoObjDefs = yield call(fetchProtoObjDefs)
|
|
18
18
|
return transformTextures(vdf.parse(protoObjDefs))
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
module.exports = {
|
|
21
|
+
module.exports = { fetchTextures }
|
package/fetchTfEnglish.js
CHANGED
|
@@ -3,11 +3,11 @@ const vdf = require('vdf')
|
|
|
3
3
|
const { toLower } = require('ramda')
|
|
4
4
|
const { renameKeysWith } = require('ramda-adjunct')
|
|
5
5
|
|
|
6
|
-
function*
|
|
6
|
+
function* fetchTfEnglish() {
|
|
7
7
|
const { fetchTfEnglish } = yield getContext('api')
|
|
8
8
|
const english = yield call(fetchTfEnglish)
|
|
9
9
|
const englishVdf = vdf.parse(english)
|
|
10
10
|
return renameKeysWith(toLower, englishVdf.lang.Tokens)
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
module.exports = {
|
|
13
|
+
module.exports = { fetchTfEnglish }
|
package/fromEconItem.js
CHANGED
|
@@ -36,7 +36,8 @@ const {
|
|
|
36
36
|
of,
|
|
37
37
|
path,
|
|
38
38
|
equals,
|
|
39
|
-
pick
|
|
39
|
+
pick,
|
|
40
|
+
assocPath
|
|
40
41
|
} = require('ramda')
|
|
41
42
|
|
|
42
43
|
const { safeItems: items } = require('./schemaItems.js')
|
|
@@ -187,8 +188,15 @@ const uncraftable = compose(
|
|
|
187
188
|
|
|
188
189
|
const market_hash_name = prop('market_hash_name')
|
|
189
190
|
|
|
190
|
-
const
|
|
191
|
+
const setQuality = when(
|
|
192
|
+
compose(complement(Boolean), path(['app_data', 'quality'])),
|
|
193
|
+
chain(
|
|
194
|
+
assocPath(['app_data', 'quality']),
|
|
195
|
+
compose(prop(__, invertObj(qualityNames)), findTag('Quality'))
|
|
196
|
+
)
|
|
197
|
+
)
|
|
191
198
|
|
|
199
|
+
const quality = pathOr('-1', ['app_data', 'quality'])
|
|
192
200
|
const defindex = pathOr('-1', ['app_data', 'def_index'])
|
|
193
201
|
|
|
194
202
|
const propsTf2_1 = {
|
|
@@ -339,7 +347,8 @@ const fromEconItem440 = compose(
|
|
|
339
347
|
remaps,
|
|
340
348
|
chain(mergeRight, compose(map(__, propsTf2_2), applyTo)),
|
|
341
349
|
map(__, propsTf2_1),
|
|
342
|
-
unary(applyTo)
|
|
350
|
+
unary(applyTo),
|
|
351
|
+
setQuality
|
|
343
352
|
)
|
|
344
353
|
|
|
345
354
|
const fromEconItemOther = compose(
|
package/options-example.json
CHANGED
package/options.json
CHANGED
package/package.json
CHANGED
package/sagas.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const {
|
|
2
|
-
const {
|
|
3
|
-
const {
|
|
4
|
-
const {
|
|
5
|
-
const {
|
|
6
|
-
const {
|
|
1
|
+
const { fetchItemsApi } = require('./fetchItemsApi.js')
|
|
2
|
+
const { fetchItemsGame } = require('./fetchItemsGame.js')
|
|
3
|
+
const { fetchParticleEffects } = require('./fetchParticleEffects.js')
|
|
4
|
+
const { fetchTextures } = require('./fetchTextures.js')
|
|
5
|
+
const { fetchTfEnglish } = require('./fetchTfEnglish.js')
|
|
6
|
+
const { fetchAppDataInventory } = require('./fetchAppDataInventory.js')
|
|
7
7
|
|
|
8
8
|
module.exports = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
fetchItemsApi,
|
|
10
|
+
fetchItemsGame,
|
|
11
|
+
fetchParticleEffects,
|
|
12
|
+
fetchTextures,
|
|
13
|
+
fetchTfEnglish,
|
|
14
|
+
fetchAppDataInventory
|
|
15
15
|
}
|
package/saveSchema.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const { call } = require('redux-saga/effects')
|
|
2
2
|
|
|
3
3
|
const {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
fetchItemsApi,
|
|
5
|
+
fetchItemsGame,
|
|
6
|
+
fetchParticleEffects,
|
|
7
|
+
fetchTextures,
|
|
8
|
+
fetchTfEnglish
|
|
9
9
|
} = require('./sagas.js')
|
|
10
10
|
|
|
11
11
|
const {
|
|
@@ -14,14 +14,14 @@ const {
|
|
|
14
14
|
transformItems
|
|
15
15
|
} = require('./sagaHelpers')
|
|
16
16
|
|
|
17
|
-
function*
|
|
17
|
+
function* saveSchema() {
|
|
18
18
|
try {
|
|
19
19
|
|
|
20
|
-
const itemsApi = yield call(
|
|
21
|
-
const itemsGame = yield call(
|
|
22
|
-
const particleEffects = yield call(
|
|
23
|
-
const textures = yield call(
|
|
24
|
-
const english = yield call(
|
|
20
|
+
const itemsApi = yield call(fetchItemsApi)
|
|
21
|
+
const itemsGame = yield call(fetchItemsGame)
|
|
22
|
+
const particleEffects = yield call(fetchParticleEffects)
|
|
23
|
+
const textures = yield call(fetchTextures)
|
|
24
|
+
const english = yield call(fetchTfEnglish)
|
|
25
25
|
|
|
26
26
|
const collections = getCollections(english, itemsGame)
|
|
27
27
|
const items = getItems(english, itemsGame)
|
|
@@ -39,4 +39,4 @@ function* saveSchemaSaga() {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
module.exports = {
|
|
42
|
+
module.exports = { saveSchema }
|