New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ipfs-repo-migrations

Package Overview
Dependencies
Maintainers
5
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipfs-repo-migrations - npm Package Compare versions

Comparing version 12.0.1 to 13.0.0

dist/index.min.js

189

package.json
{
"name": "ipfs-repo-migrations",
"version": "12.0.1",
"version": "13.0.0",
"description": "Migration framework for versioning of JS IPFS Repo",
"license": "Apache-2.0 OR MIT",
"homepage": "https://github.com/ipfs/js-ipfs-repo/tree/master/packages/ipfs-repo-migrations#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/ipfs/js-ipfs-repo.git"
},
"bugs": {
"url": "https://github.com/ipfs/js-ipfs-repo/issues"
},
"keywords": [

@@ -10,13 +19,36 @@ "IPFS",

],
"homepage": "https://github.com/ipfs/js-ipfs-repo/tree/master/packages/ipfs-repo-migrations",
"bugs": {
"url": "https://github.com/ipfs/js-ipfs-repo/issues/"
"engines": {
"node": ">=16.0.0",
"npm": ">=7.0.0"
},
"license": "(Apache-2.0 OR MIT)",
"main": "./cjs/src/index.js",
"types": "types/src/index.d.ts",
"type": "module",
"types": "./dist/src/index.d.ts",
"typesVersions": {
"*": {
"*": [
"*",
"dist/*",
"dist/src/*",
"dist/src/*/index"
],
"src/*": [
"*",
"dist/*",
"dist/src/*",
"dist/src/*/index"
]
}
},
"files": [
"*",
"src",
"dist",
"!dist/test",
"!**/*.tsbuildinfo"
],
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./src/index.js"
}
},
"eslintConfig": {

@@ -28,14 +60,89 @@ "extends": "ipfs",

},
"publishConfig": {
"directory": "dist"
"release": {
"branches": [
"master"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"breaking": true,
"release": "major"
},
{
"revert": true,
"release": "patch"
},
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "docs",
"release": "patch"
},
{
"type": "test",
"release": "patch"
},
{
"type": "deps",
"release": "patch"
},
{
"scope": "no-release",
"release": false
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "Trivial Changes"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "deps",
"section": "Dependencies"
},
{
"type": "test",
"section": "Tests"
}
]
}
}
],
"@semantic-release/changelog",
"@semantic-release/npm",
"@semantic-release/github",
"@semantic-release/git"
]
},
"browser": {
".": "./cjs/src/index.js"
},
"repository": {
"type": "git",
"url": "https://github.com/ipfs/js-ipfs-repo.git"
},
"scripts": {
"clean": "rimraf types dist",
"clean": "aegir clean",
"generate": "run-s generate:*:*",

@@ -54,15 +161,12 @@ "generate:proto:pins": "pbjs -t static-module -w es6 --force-number --no-verify --no-delimited --no-create --no-beautify --no-defaults --lint eslint-disable -o migrations/migration-9/pin.js migrations/migration-9/pin.proto",

"generate:proto-types:peer-record": "pbts -o migrations/migration-12/pb/peer-record.d.ts migrations/migration-12/pb/peer-record.js",
"prepublishOnly": "npm run build",
"build": "aegir build",
"pretest": "aegir build --esm-tests",
"test": "aegir test",
"lint": "aegir ts -p check && aegir lint",
"test:node": "aegir test -t node --cov",
"lint": "aegir lint",
"release": "aegir release",
"release-minor": "aegir release --type minor",
"release-major": "aegir release --type major",
"dep-check": "aegir dep-check -i interface-blockstore -i assert -i events -i npm-run-all -i util"
"dep-check": "aegir dep-check -i interface-blockstore -i npm-run-all"
},
"dependencies": {
"@ipld/dag-pb": "^2.0.0",
"cborg": "^1.3.1",
"@ipld/dag-pb": "^2.1.0",
"cborg": "^1.3.4",
"datastore-core": "^7.0.0",

@@ -75,4 +179,4 @@ "debug": "^4.1.0",

"multiaddr": "^10.0.1",
"multiformats": "^9.0.0",
"protobufjs": "^6.10.2",
"multiformats": "^9.0.4",
"protobufjs": "^7.0.0",
"uint8arrays": "^3.0.0",

@@ -82,8 +186,7 @@ "varint": "^6.0.0"

"devDependencies": {
"@ipld/car": "^3.0.0",
"@ipld/car": "^4.1.4",
"@types/debug": "^4.1.5",
"@types/rimraf": "^3.0.2",
"@types/varint": "^6.0.0",
"aegir": "^36.0.1",
"assert": "^2.0.0",
"aegir": "^37.5.0",
"aws-sdk": "^2.884.0",

@@ -95,19 +198,17 @@ "blockstore-core": "^1.0.2",

"datastore-s3": "^9.0.0",
"events": "^3.2.0",
"just-safe-set": "^2.1.0",
"protobufjs-cli": "^1.0.0",
"just-safe-set": "^4.1.1",
"level-5": "npm:level@^5.0.0",
"level-6": "npm:level@^6.0.0",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.0",
"sinon": "^12.0.1",
"util": "^0.12.3"
"rimraf": "^3.0.2",
"sinon": "^14.0.0"
},
"gitHead": "bfabfdcc44db80b264496ca43f3fae38ebc486ea",
"exports": {
".": {
"browser": "./esm/src/index.js",
"require": "./cjs/src/index.js",
"import": "./esm/src/index.js"
}
"browser": {
"datastore-fs": "datastore-level"
},
"main": "src/index.js",
"publishConfig": {
"directory": "dist"
}
}
}

@@ -1,27 +0,16 @@

# Migration tool for JS IPFS Repo <!-- omit in toc -->
# ipfs-repo-migrations <!-- omit in toc -->
[![Travis CI](https://flat.badgen.net/travis/ipfs/js-ipfs-repo-migrations)](https://travis-ci.com/ipfs/js-ipfs-repo-migrations)
[![codecov](https://codecov.io/gh/ipfs/js-ipfs-repo-migrations/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/js-ipfs-repo-migrations)
[![Dependency Status](https://david-dm.org/ipfs/js-ipfs-repo-migrations.svg?style=flat-square)](https://david-dm.org/ipfs/js-ipfs-repo-migrations)
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
![](https://img.shields.io/badge/npm-%3E%3D6.0.0-orange.svg?style=flat-square)
![](https://img.shields.io/badge/Node.js-%3E%3D10.0.0-orange.svg?style=flat-square)
[![ipfs.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io)
[![IRC](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![Discord](https://img.shields.io/discord/806902334369824788?style=flat-square)](https://discord.gg/ipfs)
[![codecov](https://img.shields.io/codecov/c/github/ipfs/js-ipfs-repo.svg?style=flat-square)](https://codecov.io/gh/ipfs/js-ipfs-repo)
[![CI](https://img.shields.io/github/workflow/status/ipfs/js-ipfs-repo/test%20&%20maybe%20release/master?style=flat-square)](https://github.com/ipfs/js-ipfs-repo/actions/workflows/js-test-and-release.yml)
> Migration framework for versioning of JS IPFS Repo
This package is inspired by the [go-ipfs repo migration tool](https://github.com/ipfs/fs-repo-migrations/)
## Table of contents <!-- omit in toc -->
## Lead Maintainer <!-- omit in toc -->
[Alex Potsides](http://github.com/achingbrain)
## Table of Contents <!-- omit in toc -->
- [Install](#install)
- [Lead Maintainer <!-- omit in toc -->](#lead-maintainer----omit-in-toc---)
- [Background](#background)
- [Install](#install)
- [npm](#npm)
- [Use in Node.js](#use-in-nodejs)

@@ -54,3 +43,16 @@ - [Use in a browser with browserify, webpack or any other bundler](#use-in-a-browser-with-browserify-webpack-or-any-other-bundler)

- [License](#license)
- [Contribute](#contribute-1)
## Install
```console
$ npm i ipfs-repo-migrations
```
This package is inspired by the [go-ipfs repo migration tool](https://github.com/ipfs/fs-repo-migrations/)
## Lead Maintainer <!-- omit in toc -->
[Alex Potsides](http://github.com/achingbrain)
## Background

@@ -64,12 +66,9 @@

This framework:
* Handles locking/unlocking of repository
* Defines migrations API
* Executes and reports migrations in both directions: forward and backward
* Simplifies creation of new migrations
* Works on the browser too!
## Install
- Handles locking/unlocking of repository
- Defines migrations API
- Executes and reports migrations in both directions: forward and backward
- Simplifies creation of new migrations
- Works on the browser too!
### npm
```sh

@@ -123,9 +122,9 @@ > npm install ipfs-repo-migrations

* `path` (string, mandatory) - path to the repo to be migrated
* `repoOptions` (object, mandatory) - options that are passed to migrations, that use them to construct the datastore. (options are the same as for IPFSRepo).
* `toVersion` (int, mandatory) - version to which the repo should be migrated.
* `options` (object, optional) - options for the migration
* `options.ignoreLock` (bool, optional) - if true will not lock the repo when applying migrations. Use with caution.
* `options.onProgress` (function, optional) - callback that is called during each migration to report progress.
* `options.isDryRun` (bool, optional) - flag that indicates if it is a dry run that should give the same output as running a migration but without making any actual changes.
- `path` (string, mandatory) - path to the repo to be migrated
- `repoOptions` (object, mandatory) - options that are passed to migrations, that use them to construct the datastore. (options are the same as for IPFSRepo).
- `toVersion` (int, mandatory) - version to which the repo should be migrated.
- `options` (object, optional) - options for the migration
- `options.ignoreLock` (bool, optional) - if true will not lock the repo when applying migrations. Use with caution.
- `options.onProgress` (function, optional) - callback that is called during each migration to report progress.
- `options.isDryRun` (bool, optional) - flag that indicates if it is a dry run that should give the same output as running a migration but without making any actual changes.

@@ -137,6 +136,7 @@ #### `onProgress(version, percent, message)`

**Arguments:**
* `migration` (object) - object of migration that just successfully finished running. See [Architecture of migrations](#architecture-of-migrations) for details.
* `counter` (int) - index of current migration.
* `totalMigrations` (int) - total count of migrations that will be run.
- `migration` (object) - object of migration that just successfully finished running. See [Architecture of migrations](#architecture-of-migrations) for details.
- `counter` (int) - index of current migration.
- `totalMigrations` (int) - total count of migrations that will be run.
### `.revert(path, repoOptions, toVersion, {ignoreLock, onProgress, isDryRun}) -> Promise<void>`

@@ -148,9 +148,9 @@

* `path` (string, mandatory) - path to the repo to be reverted
* `repoOptions` (object, mandatory) - options that are passed to migrations, that use them to construct the datastore. (options are the same as for IPFSRepo).
* `toVersion` (int, mandatory) - version to which the repo should be reverted to.
* `options` (object, optional) - options for the reversion
* `options.ignoreLock` (bool, optional) - if true will not lock the repo when applying migrations. Use with caution.
* `options.onProgress` (function, optional) - callback that is called during each migration to report progress.
* `options.isDryRun` (bool, optional) - flag that indicates if it is a dry run that should give the same output as running a migration but without making any actual changes.
- `path` (string, mandatory) - path to the repo to be reverted
- `repoOptions` (object, mandatory) - options that are passed to migrations, that use them to construct the datastore. (options are the same as for IPFSRepo).
- `toVersion` (int, mandatory) - version to which the repo should be reverted to.
- `options` (object, optional) - options for the reversion
- `options.ignoreLock` (bool, optional) - if true will not lock the repo when applying migrations. Use with caution.
- `options.onProgress` (function, optional) - callback that is called during each migration to report progress.
- `options.isDryRun` (bool, optional) - flag that indicates if it is a dry run that should give the same output as running a migration but without making any actual changes.

@@ -185,23 +185,25 @@ ### `getLatestMigrationVersion() -> int`

* `version` (int) - Number that represents the version which the repo will migrate to (eg. `8` will move the repo to version 8).
* `description` (string) - Brief description of what the migrations does.
* `migrate` (function) - Function that performs the migration (see signature of this function below)
* `revert` (function) - If defined then this function will revert the migration to the previous version. Otherwise it is assumed that it is not possible to revert this migration.
- `version` (int) - Number that represents the version which the repo will migrate to (eg. `8` will move the repo to version 8).
- `description` (string) - Brief description of what the migrations does.
- `migrate` (function) - Function that performs the migration (see signature of this function below)
- `revert` (function) - If defined then this function will revert the migration to the previous version. Otherwise it is assumed that it is not possible to revert this migration.
#### `.migrate(repoPath, repoOptions)`
_Do not confuse this function with the `require('ipfs-repo-migrations').migrate()` function that drives the whole migration process!_
*Do not confuse this function with the `require('ipfs-repo-migrations').migrate()` function that drives the whole migration process!*
Arguments:
* `repoPath` (string) - absolute path to the root of the repo
* `repoOptions` (object, optional) - object containing `IPFSRepo` options, that should be used to construct a datastore instance.
- `repoPath` (string) - absolute path to the root of the repo
- `repoOptions` (object, optional) - object containing `IPFSRepo` options, that should be used to construct a datastore instance.
#### `.revert(repoPath, repoOptions)`
_Do not confuse this function with the `require('ipfs-repo-migrations').revert()` function that drives the whole backward migration process!_
*Do not confuse this function with the `require('ipfs-repo-migrations').revert()` function that drives the whole backward migration process!*
Arguments:
* `repoPath` (string) - path to the root of the repo
* `repoOptions` (object, optional) - object containing `IPFSRepo` options, that should be used to construct the datastore instance.
- `repoPath` (string) - path to the root of the repo
- `repoOptions` (object, optional) - object containing `IPFSRepo` options, that should be used to construct the datastore instance.
### Browser vs. NodeJS environments

@@ -213,5 +215,3 @@

```
'./migrations/migration-<number>/index.js': './migrations/migration-<number>/index_browser.js'
```
'./migrations/migration-<number>/index.js': './migrations/migration-<number>/index_browser.js'

@@ -224,12 +224,13 @@ In browser environments then `index.js` will be replaced with `index_browser.js`.

There are currently two main datastore implementations:
1. [`datastore-fs`](https://github.com/ipfs/js-datastore-fs) that is backed by file system and is used mainly in the NodeJS environment
2. [`datastore-idb`](https://github.com/ipfs/js-datastore-idb) that is backed by LevelDB and is used mainly in the browser environment
Both implementations share the same API and hence are interchangeable.
1. [`datastore-fs`](https://github.com/ipfs/js-datastore-fs) that is backed by file system and is used mainly in the NodeJS environment
2. [`datastore-idb`](https://github.com/ipfs/js-datastore-idb) that is backed by LevelDB and is used mainly in the browser environment
When the migration is run in a browser environment, `datastore-fs` is automatically replaced with `datastore-idb` even
when it is directly imported (`require('datastore-fs')` will return `datastore-idb` in a browser).
So with simple migrations you shouldn't worry about the difference between `datastore-fs` and `datastore-idb`
and by default use the `datastore-fs` package (as the replace mechanism does not work vice versa).
Both implementations share the same API and hence are interchangeable.
When the migration is run in a browser environment, `datastore-fs` is automatically replaced with `datastore-idb` even
when it is directly imported (`require('datastore-fs')` will return `datastore-idb` in a browser).
So with simple migrations you shouldn't worry about the difference between `datastore-fs` and `datastore-idb`
and by default use the `datastore-fs` package (as the replace mechanism does not work vice versa).
### Guidelines

@@ -254,7 +255,7 @@

If a migration affects any of the following functionality, it must provide tests for the following functions
to work under the version of the repo that it migrates to:
to work under the version of the repo that it migrates to:
* `/src/repo/version.js`:`getVersion()` - retrieving repository's version
* `/src/repo/lock.js`:`lock()` - locking repository that uses file system
* `/src/repo/lock-memory.js`:`lock()` - locking repository that uses memory
- `/src/repo/version.js`:`getVersion()` - retrieving repository's version
- `/src/repo/lock.js`:`lock()` - locking repository that uses file system
- `/src/repo/lock-memory.js`:`lock()` - locking repository that uses memory

@@ -279,7 +280,7 @@ Every migration must have test coverage. Tests for migrations should be placed in the `/test/migrations/` folder. Most probably

| IPFS repo version | JS IPFS version |
| -----------------: |:----------------:|
| 7 | v0.0.0 |
| 8 | v0.48.0 |
| 9 | v0.49.0 |
| IPFS repo version | JS IPFS version |
| ----------------: | :-------------: |
| 7 | v0.0.0 |
| 8 | v0.48.0 |
| 9 | v0.49.0 |

@@ -325,2 +326,13 @@ ### Migrations

[Apache-2.0](LICENSE-APACHE) OR [MIT](LICENSE-MIT)
Licensed under either of
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
## Contribute
Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/js-ipfs-unixfs-importer/issues)!
This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md).
[![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc