Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
787202f
WIP add ipfs package
Feb 26, 2021
717f39c
Add catFile method
Feb 26, 2021
205abe2
Merge branch 'prealpha-dev' of https://github.com/Web3-API/prototype …
Feb 26, 2021
e73ee68
Implement cat file function in ipfs package
Mar 2, 2021
124069f
Refactor write sizer
Mar 2, 2021
c67e9f0
Add http plugin to query command
Mar 2, 2021
5aa221d
Refactor http plugin schema
Mar 2, 2021
99ebbaa
Merge branch 'prealpha' of https://github.com/Web3-API/prototype into…
Mar 2, 2021
24c1954
Update yarn.lock file
Mar 2, 2021
b380d46
testing
dOrgJelli Mar 8, 2021
b61d670
Merge branch 'prealpha-dev' into ipfs-testing
dOrgJelli Mar 8, 2021
30322b6
working
dOrgJelli Mar 8, 2021
7fb4a8a
merge prealpha-dev
dOrgJelli Mar 8, 2021
53f91ff
Merge branch 'mmuftic/ipfs-package' into ipfs-testing
dOrgJelli Mar 8, 2021
7c56b1f
Merge pull request #2 from Web3-API/ipfs-testing
Mar 8, 2021
be45446
Add rest of ipfs functions
Mar 9, 2021
27f3528
Fix catFile function
Mar 9, 2021
99ad9c1
Extend http plugin to support multipart form as body
Mar 10, 2021
fefede7
Add e2e test for form-data post request
Mar 10, 2021
5b810ff
Refactor addFile method
Mar 11, 2021
29a4c13
Resfactor http plugin to support multipart form
Mar 11, 2021
524a239
Fix support for form data inside http plugin
Mar 12, 2021
56b7f60
Add support for reading file content as uint array with query command
Mar 12, 2021
29f8647
Restructure ipfs package code
Mar 12, 2021
0d050a9
Refactor http schema
Mar 15, 2021
781e15a
Fix linter errors
Mar 15, 2021
77490d2
Code cleanup in ipfs package
Mar 15, 2021
a16f1a0
Merge branch 'prealpha' of https://github.com/Web3-API/prototype into…
Mar 15, 2021
1aa3f85
Update yarn lock file
Mar 15, 2021
8ba54ae
Fix failing tests
Mar 15, 2021
29a72b2
Update README file
Mar 16, 2021
915b355
Merge branch 'prealpha-dev' of https://github.com/Web3-API/prototype …
Mar 16, 2021
d1600bc
Fix http plugin initialization
Mar 16, 2021
72eb6f1
Update ci timeout
Mar 18, 2021
aeebefb
Merge branch 'prealpha-dev' of https://github.com/Web3-API/prototype …
Mar 18, 2021
287de11
Update yarn.lock file
Mar 18, 2021
c4fe298
merge prealpha-dev
dOrgJelli Mar 29, 2021
d71e473
minor fixes post merge
dOrgJelli Mar 29, 2021
bc287b4
apis in CI + fixes
dOrgJelli Mar 29, 2021
3e96776
make http plugin a defualt redirect
dOrgJelli Mar 29, 2021
06879f7
fix assemblyscript compiler null check bug
dOrgJelli Mar 29, 2021
9aae2a2
Refactor query to use sugested format for transform functions
Apr 1, 2021
a05a56d
Add custom ipfs error
Apr 2, 2021
bd8f9d6
Restructure code inside http plugin and remove required import for fo…
Apr 2, 2021
e88d8a1
Remove catToString method
Apr 2, 2021
d1f449e
Fix linter errors
Apr 2, 2021
dde34b8
Add CatFileOptions object
Apr 6, 2021
27e12d5
Code cleanup and fix failing unit tests
Apr 7, 2021
5d35bcf
Add form data options
May 27, 2021
afd64ea
Fix transform function in query
May 27, 2021
a1d3bbc
Implement addFolder function
May 27, 2021
9f60ec6
Fix linter error
May 27, 2021
f266766
Fix linter error for http plugin
May 27, 2021
00a0ca3
Add unit tests and fix addFolder method
May 27, 2021
b43a697
Refactor README file
Jun 1, 2021
8fac721
Code cleanup
Jun 1, 2021
2b61b6c
Restructure http response structure
Jul 29, 2021
0ee9aba
Expand e2e tests in http plugin
Aug 16, 2021
12f88fd
Change error handling
Aug 16, 2021
84a83b2
Revert catFileToString and add minor changes to Ipfs error
Aug 16, 2021
2ed9b10
Fix provider fallback
Aug 18, 2021
5f496df
Refactor e2e tests
Aug 18, 2021
c57b17d
Restructure execution of ipfs order
Aug 18, 2021
37e7fd5
Add resolve method
Aug 18, 2021
f39c20b
merge prealpha-dev
dOrgJelli Sep 22, 2021
9bb1833
fix http tests
dOrgJelli Sep 22, 2021
a79430a
fix graph-node plugin's http schema dependency
dOrgJelli Sep 22, 2021
cafe809
HTTP schema fixes + init e2e client tests
dOrgJelli Sep 23, 2021
75734cb
partway through updates
dOrgJelli Oct 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v14.16.0
v14.16.0
5 changes: 2 additions & 3 deletions packages/apis/console/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@web3api/console",
"name": "@web3api/console-api",
"description": "Web3API for logging",
"private": true,
"version": "0.0.1-prealpha.44",
Expand All @@ -14,7 +14,6 @@
"devDependencies": {
"@web3api/cli": "0.0.1-prealpha.44",
"@web3api/wasm-as": "0.0.1-prealpha.44",
"assemblyscript": "0.19.1",
"js-yaml": "3.14.0"
"assemblyscript": "0.19.1"
}
}
29 changes: 29 additions & 0 deletions packages/apis/ipfs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# IPFS Web3API package

Inspect schema files to see what functionalities are available - `/query/schema.graphql` and `/mutation/schema.graphql`.

## How To Run

### 1. Setup Test Env

```
yarn test:env:up
```

### 2. Build & Deploy The Web3API

```
yarn deploy
```

### 3. Test The Web3API Using A Query Recipe

```
yarn test
```

#### Remove Test Env

```
yarn test:env:down
```
61 changes: 61 additions & 0 deletions packages/apis/ipfs/as-pect.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
module.exports = {
/**
* A set of globs passed to the glob package that qualify typescript files for testing.
*/
include: ["src/__tests__/**/*.spec.ts"],
/**
* A set of globs passed to the glob package that qualify files to be added to each test.
*/
add: ["src/__tests__/**/*.include.ts"],
/**
* All the compiler flags needed for this test suite. Make sure that a binary file is output.
*/
flags: {
// "--debug": [],
/** This is required. Do not change this. The filename is ignored, but required by the compiler. */
"--binaryFile": ["output.wasm"],
/** To enable wat file output, use the following flag. The filename is ignored, but required by the compiler. */
// "--textFile": ["output.wat"],
"--runtime": ["stub"], // Acceptable values are: full, half, stub (arena), and none,
"--baseDir": process.cwd()
},
/** Output the binary wasm file: [testname].spec.wasm */
outputBinary: false,
/**
* A set of regexp that will disclude source files from testing.
*/
disclude: [/node_modules|e2e/],
/**
* Add your required AssemblyScript imports here.
*/
imports: {},
/**
* All performance statistics reporting can be configured here.
*/
performance: {
/** Enable performance statistics gathering. */
enabled: true,
/** Set the maximum number of samples to run for each test. */
maxSamples: 10000,
/** Set the maximum test run time in milliseconds. */
maxTestRunTime: 2000,
/** Set the number of decimal places to round to. */
roundDecimalPlaces: 3,
/** Report the median time in the default reporter. */
reportMedian: true,
/** Report the average time in milliseconds. */
reportAverage: true,
/** Report the standard deviation. */
reportStandardDeviation: false,
/** Report the maximum run time in milliseconds. */
reportMax: false,
/** Report the minimum run time in milliseconds. */
reportMin: false,
/** Report the variance. */
reportVariance: false,
},
/**
* To create your own custom reporter, please check out the Core API.
*/
// reporter: new CustomReporter(),
};
13 changes: 13 additions & 0 deletions packages/apis/ipfs/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
collectCoverage: true,
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ["**/__tests__/e2e/**/?(*.)+(spec|test).[jt]s?(x)"],
modulePathIgnorePatterns: ['./src/__tests__/mutation', './src/__tests__/query', './src/__tests__/utils'],
globals: {
'ts-jest': {
tsconfig: "tsconfig.json",
diagnostics: false
}
}
};
29 changes: 29 additions & 0 deletions packages/apis/ipfs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "@web3api/ipfs-api",
"version": "0.0.1-prealpha.44",
"private": true,
"license": "MIT",
"scripts": {
"build": "w3 build",
"deploy": "w3 build --ipfs http://127.0.0.1:5001 --test-ens ipfs.eth",
"test": "w3 query ./recipes/e2e.json",
"test:unit": "asp --verbose",
"test:e2e": "jest --passWithNoTests --runInBand --verbose",
"test:ci": "yarn test:env:up && yarn deploy && yarn test && yarn test:env:down && yarn test:unit && yarn test:e2e",
"test:env:up": "w3 test-env up && jsipfs add ./recipes/test.txt --silent --api http://localhost:5001",
"test:env:down": "w3 test-env down"
},
"dependencies": {
"@web3api/wasm-as": "0.0.1-prealpha.44",
"as-base64": "0.1.1"
},
"devDependencies": {
"@as-pect/cli": "^6.0.0",
"@types/jest": "26.0.8",
"@web3api/cli": "0.0.1-prealpha.44",
"jest": "26.6.3",
"ipfs": "0.52.0",
"ts-jest": "26.5.4",
"typescript": "4.4.3"
}
}
9 changes: 9 additions & 0 deletions packages/apis/ipfs/recipes/addFile.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
mutation {
addFile(
ipfsUrl: $ipfsUrl
fileEntry: {
name: $name
data: $data
}
)
}
12 changes: 12 additions & 0 deletions packages/apis/ipfs/recipes/addFileWithOptions.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
mutation {
addFile(
ipfsUrl: $ipfsUrl
fileEntry: {
name: $name
data: $data
options: {
wrapWithDirectory: true
}
}
)
}
33 changes: 33 additions & 0 deletions packages/apis/ipfs/recipes/addFolder.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
mutation {
addFolder(
ipfsUrl: $ipfsUrl
directoryEntry: {
directories: [
{
name: $dirA
directories: []
files: [
{
name: $filA0
data: $dataA0
},
{
name: $filA1
data: $dataA1
}
]
}
]
files: [
{
name: $fil0
data: $data0
},
{
name: $fil1
data: $data1
}
]
}
)
}
66 changes: 66 additions & 0 deletions packages/apis/ipfs/recipes/addFolderWithOptions.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
mutation {
addFolder(
ipfsUrl: $ipfsUrl
directoryEntry: {
directories: [
{
name: $dirA
directories: []
files: [
{
name: $filA0
data: $dataA0
},
{
name: $filA1
data: $dataA1
}
]
},
{
name: $dirB
directories: [
{
name: $dirBA
directories: []
files: [
{
name: $filBA0
data: $dataBA0
},
{
name: $filBA1
data: $dataBA1
}
]
},
{
name: $dirBB
directories: []
files: [
{
name: $filBB0
data: $dataBB0
}
]
}
]
files: []
}
]
files: [
{
name: $fil0
data: $data0
},
{
name: $fil1
data: $data1
}
]
},
options: {
wrapWithDirectory: true
}
)
}
8 changes: 8 additions & 0 deletions packages/apis/ipfs/recipes/catFile.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
query {
catFile(
ipfs: {
provider: $ipfsUrl
}
cid: $cid
)
}
8 changes: 8 additions & 0 deletions packages/apis/ipfs/recipes/catFileToString.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
query {
catFileToString(
ipfs: {
provider: $ipfsUrl
}
cid: $cid
)
}
12 changes: 12 additions & 0 deletions packages/apis/ipfs/recipes/catFileWithOptions.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
query {
catFile(
ipfs: {
provider: $ipfsUrl
}
cid: $cid
catFileOptions: {
offset: 5
length: 10
}
)
}
27 changes: 27 additions & 0 deletions packages/apis/ipfs/recipes/constants.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"SampleCid": "QmcUZ2oVczdFaRsY8Fcqi8f27GLF8fY6mVboGZGYS8JE72",
"FakeCid": "QmcUZ2oVczdFaRsY8Fcqi8f27GLF8fY6mVboGZGYS8JE73",
"IpfsUrl": "http://127.0.0.1:5001",

"FileName": "test.txt",
"File": "#loadFile:./test.txt",

"Fil_0": "file_0.txt",
"Data_0": "#loadFile:./dirTest/file_0.txt",
"Fil_1": "file_1.txt",
"Data_1": "#loadFile:./dirTest/file_1.txt",
"Dir_A": "directory_A",
"Fil_A_0": "file_A_0.txt",
"Data_A_0": "#loadFile:./dirTest/directory_A/file_A_0.txt",
"Fil_A_1": "file_A_1.txt",
"Data_A_1": "#loadFile:./dirTest/directory_A/file_A_1.txt",
"Dir_B": "directory_B",
"Dir_B_A": "directory_B_A",
"Fil_B_A_0": "file_B_A_0",
"Data_B_A_0": "#loadFile:./dirTest/directory_B/directory_B_A/file_B_A_0.txt",
"Fil_B_A_1": "file_B_A_1",
"Data_B_A_1": "#loadFile:./dirTest/directory_B/directory_B_A/file_B_A_1.txt",
"Dir_B_B": "directory_B_B",
"Fil_B_B_0": "file_B_B_0",
"Data_B_B_0": "#loadFile:./dirTest/directory_B/directory_B_B/file_B_B_0.txt"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file_A_0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file_A_1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file_B_A_0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file_B_A_1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file_B_B_0
1 change: 1 addition & 0 deletions packages/apis/ipfs/recipes/dirTest/file_0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file_0
1 change: 1 addition & 0 deletions packages/apis/ipfs/recipes/dirTest/file_1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file_1
Loading