Skip to content

Commit 93e9b60

Browse files
committed
feat: mover social resource tool to separate lib
1 parent a4946db commit 93e9b60

19 files changed

+2069
-19
lines changed

lerna.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"packages/api",
55
"packages/utils",
66
"packages/definitions",
7-
"packages/elasticsearch"
7+
"packages/elasticsearch",
8+
"packages/resource-discussions"
89
],
910
"version": "0.7.11",
1011
"npmClient": "yarn",

package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"packages/api",
55
"packages/utils",
66
"packages/definitions",
7-
"packages/elasticsearch"
7+
"packages/elasticsearch",
8+
"packages/resource-discussions"
89
],
910
"repository": "https://github.com/dappforce/subsocial-js",
1011
"scripts": {
+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
build
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
index.ts
2+
tsconfig.json
3+
yarn.lock
4+
node_modules

packages/resource-discussions/LICENSE

+677
Large diffs are not rendered by default.
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Subsocial helper for resource-discussions pallet by [DappForce](https://github.com/dappforce)
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"name": "@subsocial/resource-discussions",
3+
"version": "0.0.1",
4+
"description": "Support tool for work with resource-discussions pallet",
5+
"repository": "",
6+
"main": "build/index.js",
7+
"module": "build/index.mjs",
8+
"types": "build/index.d.ts",
9+
"unpkg": "build/index.global.js",
10+
"scripts": {
11+
"build": "rm -rf build && tsup src/index.ts --format cjs,esm,iife --dts --minify",
12+
"publish:npm": "yarn build && npm publish --access public"
13+
},
14+
"keywords": [
15+
"Social Resource",
16+
"Subsocial"
17+
],
18+
"dependencies": {
19+
"graphology": "^0.25.1",
20+
"graphology-types": "^0.24.7"
21+
},
22+
"devDependencies": {
23+
"@swc/core": "^1.3.55",
24+
"tsup": "^6.7.0"
25+
}
26+
}

packages/utils/src/resourceLinking/graph.ts renamed to packages/resource-discussions/src/graph.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export class SocialResourceGraph {
119119
})
120120

121121
/**
122-
* Set Chain Name and Chain Edges
122+
* ==== Set Chain Name and Chain Edges ====
123123
*/
124124

125125
/**
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export { SocialResource } from './socialResource'
2+
export { UrlConfig } from './types'

packages/utils/src/test/resourceLinking/resourceLinking.test.ts renamed to packages/resource-discussions/tests/resourceLinking.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, test } from '@jest/globals'
22

3-
import { SocialResource } from '../../resourceLinking'
3+
import { SocialResource } from '../src'
44

55
describe('Resource Linking Unit', () => {
66
test('SocialResource should ingest Metadata and build ResourceId', () => {
@@ -24,7 +24,7 @@ describe('Resource Linking Unit', () => {
2424
chainName: 'astar',
2525
resourceType: 'nft',
2626
resourceValue: {
27-
collectionId: '0x78764g2873y2g8giui27',
27+
collectionId: '0xCdEF95b8581612fFB7c3980bC6b563503755ad72',
2828
nftId: '87364'
2929
}
3030
})
@@ -44,7 +44,7 @@ describe('Resource Linking Unit', () => {
4444
'chain://chainType:substrate/chainName:zeitgeist/resourceType:market/resourceValue:3tPeACp24szE4MTpvP9LDBR11kAVc8NnjCE2JxLHz2dpvopu'
4545
)
4646
expect(resourceNft.build.resourceId()).toEqual(
47-
'chain://chainType:substrate/chainName:astar/resourceType:nft/resourceValue:0x78764g2873y2g8giui27/resourceValue:87364'
47+
'chain://chainType:substrate/chainName:astar/resourceType:nft/resourceValue:0xCdEF95b8581612fFB7c3980bC6b563503755ad72/resourceValue:87364'
4848
)
4949
expect(resourceTweet.build.resourceId()).toEqual(
5050
'social://resourceType:profile/resourceValue:98938u459928734982734937653987'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"compilerOptions": {
3+
"outDir": "build",
4+
"target": "es2016",
5+
"module": "commonjs",
6+
"esModuleInterop": true,
7+
"forceConsistentCasingInFileNames": true,
8+
"strict": true,
9+
"skipLibCheck": true,
10+
"noUncheckedIndexedAccess": true,
11+
"noEmit": true
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { defineConfig } from 'tsup'
2+
3+
export default defineConfig({
4+
outDir: 'build'
5+
})

0 commit comments

Comments
 (0)