Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@onflow/config

Package Overview
Dependencies
Maintainers
13
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onflow/config - npm Package Compare versions

Comparing version 1.3.0-typescript.0 to 1.3.0

types/config.d.ts

65

CHANGELOG.md
# @onflow/config
## 1.3.0-typescript.0
## 1.3.0
### Minor Changes
- [#1731](https://github.com/onflow/fcl-js/pull/1731) [`fb3bd37e`](https://github.com/onflow/fcl-js/commit/fb3bd37e02bf0de046ea164e6c2f1a0c27e515c1) Thanks [@jribbink](https://github.com/jribbink)! - Add Typescript to @onflow/config
- [#1848](https://github.com/onflow/fcl-js/pull/1848) [`fdd52c45`](https://github.com/onflow/fcl-js/commit/fdd52c45b3a64210c5f716e13aa4d08d3796370c) Thanks [@jribbink](https://github.com/jribbink)! - Add support for new dependencies field in flow.json
## 1.2.0
### Patch Changes
- [#1821](https://github.com/onflow/fcl-js/pull/1821) [`b9c078ce`](https://github.com/onflow/fcl-js/commit/b9c078ce87869c2b41dff07b861cea09a294c6a1) Thanks [@nialexsan](https://github.com/nialexsan)! - Split packages into `@onflow/fcl`, `@onflow/fcl-core`, and `@onflow/fcl-react-native`.
- [#1827](https://github.com/onflow/fcl-js/pull/1827) [`e74c4a60`](https://github.com/onflow/fcl-js/commit/e74c4a60f38f366874aa1391ca1c890a7ad3a42a) Thanks [@nialexsan](https://github.com/nialexsan)! - Pin internal dependencies to exact versions
- [#1814](https://github.com/onflow/fcl-js/pull/1814) [`0d09d838`](https://github.com/onflow/fcl-js/commit/0d09d8386c2fc472833df7152467d477f36dddc4) Thanks [@jribbink](https://github.com/jribbink)! - Fix type declarations not fully being generated
- Updated dependencies [[`b9c078ce`](https://github.com/onflow/fcl-js/commit/b9c078ce87869c2b41dff07b861cea09a294c6a1), [`e74c4a60`](https://github.com/onflow/fcl-js/commit/e74c4a60f38f366874aa1391ca1c890a7ad3a42a), [`0d09d838`](https://github.com/onflow/fcl-js/commit/0d09d8386c2fc472833df7152467d477f36dddc4)]:
- @onflow/util-invariant@1.2.2
- @onflow/util-logger@1.3.2
- @onflow/util-actor@1.3.2
## 1.3.0-alpha.3
### Minor Changes
- [#1728](https://github.com/onflow/fcl-js/pull/1728) [`a4f8c00c`](https://github.com/onflow/fcl-js/commit/a4f8c00c4cf292d3a4afac610dedbc89ff3affea) Thanks [@nialexsan](https://github.com/nialexsan)! - TS build
- [#1848](https://github.com/onflow/fcl-js/pull/1848) [`fdd52c45`](https://github.com/onflow/fcl-js/commit/fdd52c45b3a64210c5f716e13aa4d08d3796370c) Thanks [@jribbink](https://github.com/jribbink)! - Add support for new dependencies field in flow.json
## 1.2.2-alpha.2
### Patch Changes
- Updated dependencies [[`a4f8c00c`](https://github.com/onflow/fcl-js/commit/a4f8c00c4cf292d3a4afac610dedbc89ff3affea), [`92b966d3`](https://github.com/onflow/fcl-js/commit/92b966d39936ba0a90629ee320e62e4fed5d2296)]:
- @onflow/util-actor@1.3.0
- [#1827](https://github.com/onflow/fcl-js/pull/1827) [`e74c4a60`](https://github.com/onflow/fcl-js/commit/e74c4a60f38f366874aa1391ca1c890a7ad3a42a) Thanks [@nialexsan](https://github.com/nialexsan)! - pin versions
## 1.2.0-alpha.0
- Updated dependencies [[`e74c4a60`](https://github.com/onflow/fcl-js/commit/e74c4a60f38f366874aa1391ca1c890a7ad3a42a)]:
- @onflow/util-invariant@1.2.2-alpha.2
- @onflow/util-logger@1.3.2-alpha.2
- @onflow/util-actor@1.3.2-alpha.2
## 1.2.2-alpha.1
### Patch Changes
- [#1814](https://github.com/onflow/fcl-js/pull/1814) [`0d09d838`](https://github.com/onflow/fcl-js/commit/0d09d8386c2fc472833df7152467d477f36dddc4) Thanks [@jribbink](https://github.com/jribbink)! - Fix type declarations not fully being generated
- Updated dependencies [[`0d09d838`](https://github.com/onflow/fcl-js/commit/0d09d8386c2fc472833df7152467d477f36dddc4)]:
- @onflow/util-invariant@1.2.2-alpha.1
- @onflow/util-logger@1.3.2-alpha.1
- @onflow/util-actor@1.3.2-alpha.1
## 1.2.1
### Patch Changes
- [#1807](https://github.com/onflow/fcl-js/pull/1807) [`9430d723`](https://github.com/onflow/fcl-js/commit/9430d7232c272f4acb55f5bcff7be82cef9704d9) Thanks [@jribbink](https://github.com/jribbink)! - Fix versioning & actor bug
- Updated dependencies [[`9430d723`](https://github.com/onflow/fcl-js/commit/9430d7232c272f4acb55f5bcff7be82cef9704d9)]:
- @onflow/util-actor@1.3.1
- @onflow/util-invariant@1.2.1
- @onflow/util-logger@1.3.1
## 1.2.0
### Minor Changes
- TS build
- [#1801](https://github.com/onflow/fcl-js/pull/1801) [`8881394b`](https://github.com/onflow/fcl-js/commit/8881394bc11fea507e330a4c507ef304fe456c42) Thanks [@nialexsan](https://github.com/nialexsan)! - TS build
- [#1801](https://github.com/onflow/fcl-js/pull/1801) [`8881394b`](https://github.com/onflow/fcl-js/commit/8881394bc11fea507e330a4c507ef304fe456c42) Thanks [@nialexsan](https://github.com/nialexsan)! - Add Typescript to @onflow/config
### Patch Changes
- Updated dependencies []:
- @onflow/util-actor@1.3.0-alpha.0
- Updated dependencies [[`8881394b`](https://github.com/onflow/fcl-js/commit/8881394bc11fea507e330a4c507ef304fe456c42), [`8881394b`](https://github.com/onflow/fcl-js/commit/8881394bc11fea507e330a4c507ef304fe456c42), [`8881394b`](https://github.com/onflow/fcl-js/commit/8881394bc11fea507e330a4c507ef304fe456c42)]:
- @onflow/util-invariant@1.2.0
- @onflow/util-logger@1.3.0
- @onflow/util-actor@1.3.0

@@ -31,0 +76,0 @@ ## 1.1.2

@@ -110,2 +110,9 @@ 'use strict';

/**
* @description Filter out dependencies section of flow.json.
* @param obj - Flow JSON
* @returns Dependencies section of Flow JSON
*/
const filterDependencies = obj => obj.dependencies ? obj.dependencies : {};
/**
* @description Gathers contract addresses by network

@@ -125,11 +132,27 @@ * @param network - Network to gather addresses for

};
const mapDeploymentsToNetworkAddress = network => _ref2 => {
/**
* @description Gathers dependency addresses by network
* @param network - Network to gather addresses for
* @returns Dependency names by addresses mapping e.g { "HelloWorld": "0x123" }
*/
const mapDependencyAliasesToNetworkAddress = network => dependencies => {
return Object.entries(dependencies).reduce((c, _ref2) => {
let [key, value] = _ref2;
const networkDependencyAlias = value?.aliases?.[network];
if (networkDependencyAlias) {
c[key] = networkDependencyAlias;
}
return c;
}, {});
};
const mapDeploymentsToNetworkAddress = network => _ref3 => {
let {
deployments = {},
accounts = {}
} = _ref2;
} = _ref3;
const networkDeployment = deployments?.[network];
if (!networkDeployment) return {};
return Object.entries(networkDeployment).reduce((c, _ref3) => {
let [key, value] = _ref3;
return Object.entries(networkDeployment).reduce((c, _ref4) => {
let [key, value] = _ref4;
// Resolve account address

@@ -156,3 +179,3 @@ const accountAddress = accounts[key]?.address;

const getContracts = (jsons, network) => {
return pipe(mergeFlowJSONs, mergePipe(mapDeploymentsToNetworkAddress(network), pipe(filterContracts, mapContractAliasesToNetworkAddress(network))))(jsons);
return pipe(mergeFlowJSONs, mergePipe(mapDeploymentsToNetworkAddress(network), pipe(filterContracts, mapContractAliasesToNetworkAddress(network)), pipe(filterDependencies, mapDependencyAliasesToNetworkAddress(network))))(jsons);
};

@@ -177,4 +200,4 @@

const hasPrivateKeys = flowJSON => {
return Object.entries(flowJSON?.accounts ?? []).reduce((hasPrivateKey, _ref4) => {
let [, value] = _ref4;
return Object.entries(flowJSON?.accounts ?? []).reduce((hasPrivateKey, _ref5) => {
let [, value] = _ref5;
if (hasPrivateKey) return true;

@@ -181,0 +204,0 @@ return value && Object.prototype.hasOwnProperty.call(value, "key") && isHexidecimal(value?.key);

@@ -86,2 +86,9 @@ import { spawn, SUBSCRIBE, UNSUBSCRIBE, send, subscriber } from '@onflow/util-actor';

/**
* @description Filter out dependencies section of flow.json.
* @param obj - Flow JSON
* @returns Dependencies section of Flow JSON
*/
const filterDependencies = obj => obj.dependencies ? obj.dependencies : {};
/**
* @description Gathers contract addresses by network

@@ -101,11 +108,27 @@ * @param network - Network to gather addresses for

};
const mapDeploymentsToNetworkAddress = network => _ref2 => {
/**
* @description Gathers dependency addresses by network
* @param network - Network to gather addresses for
* @returns Dependency names by addresses mapping e.g { "HelloWorld": "0x123" }
*/
const mapDependencyAliasesToNetworkAddress = network => dependencies => {
return Object.entries(dependencies).reduce((c, _ref2) => {
let [key, value] = _ref2;
const networkDependencyAlias = value?.aliases?.[network];
if (networkDependencyAlias) {
c[key] = networkDependencyAlias;
}
return c;
}, {});
};
const mapDeploymentsToNetworkAddress = network => _ref3 => {
let {
deployments = {},
accounts = {}
} = _ref2;
} = _ref3;
const networkDeployment = deployments?.[network];
if (!networkDeployment) return {};
return Object.entries(networkDeployment).reduce((c, _ref3) => {
let [key, value] = _ref3;
return Object.entries(networkDeployment).reduce((c, _ref4) => {
let [key, value] = _ref4;
// Resolve account address

@@ -132,3 +155,3 @@ const accountAddress = accounts[key]?.address;

const getContracts = (jsons, network) => {
return pipe(mergeFlowJSONs, mergePipe(mapDeploymentsToNetworkAddress(network), pipe(filterContracts, mapContractAliasesToNetworkAddress(network))))(jsons);
return pipe(mergeFlowJSONs, mergePipe(mapDeploymentsToNetworkAddress(network), pipe(filterContracts, mapContractAliasesToNetworkAddress(network)), pipe(filterDependencies, mapDependencyAliasesToNetworkAddress(network))))(jsons);
};

@@ -153,4 +176,4 @@

const hasPrivateKeys = flowJSON => {
return Object.entries(flowJSON?.accounts ?? []).reduce((hasPrivateKey, _ref4) => {
let [, value] = _ref4;
return Object.entries(flowJSON?.accounts ?? []).reduce((hasPrivateKey, _ref5) => {
let [, value] = _ref5;
if (hasPrivateKey) return true;

@@ -157,0 +180,0 @@ return value && Object.prototype.hasOwnProperty.call(value, "key") && isHexidecimal(value?.key);

@@ -108,2 +108,9 @@ (function (global, factory) {

/**
* @description Filter out dependencies section of flow.json.
* @param obj - Flow JSON
* @returns Dependencies section of Flow JSON
*/
const filterDependencies = obj => obj.dependencies ? obj.dependencies : {};
/**
* @description Gathers contract addresses by network

@@ -123,11 +130,27 @@ * @param network - Network to gather addresses for

};
const mapDeploymentsToNetworkAddress = network => _ref2 => {
/**
* @description Gathers dependency addresses by network
* @param network - Network to gather addresses for
* @returns Dependency names by addresses mapping e.g { "HelloWorld": "0x123" }
*/
const mapDependencyAliasesToNetworkAddress = network => dependencies => {
return Object.entries(dependencies).reduce((c, _ref2) => {
let [key, value] = _ref2;
const networkDependencyAlias = value?.aliases?.[network];
if (networkDependencyAlias) {
c[key] = networkDependencyAlias;
}
return c;
}, {});
};
const mapDeploymentsToNetworkAddress = network => _ref3 => {
let {
deployments = {},
accounts = {}
} = _ref2;
} = _ref3;
const networkDeployment = deployments?.[network];
if (!networkDeployment) return {};
return Object.entries(networkDeployment).reduce((c, _ref3) => {
let [key, value] = _ref3;
return Object.entries(networkDeployment).reduce((c, _ref4) => {
let [key, value] = _ref4;
// Resolve account address

@@ -154,3 +177,3 @@ const accountAddress = accounts[key]?.address;

const getContracts = (jsons, network) => {
return pipe(mergeFlowJSONs, mergePipe(mapDeploymentsToNetworkAddress(network), pipe(filterContracts, mapContractAliasesToNetworkAddress(network))))(jsons);
return pipe(mergeFlowJSONs, mergePipe(mapDeploymentsToNetworkAddress(network), pipe(filterContracts, mapContractAliasesToNetworkAddress(network)), pipe(filterDependencies, mapDependencyAliasesToNetworkAddress(network))))(jsons);
};

@@ -175,4 +198,4 @@

const hasPrivateKeys = flowJSON => {
return Object.entries(flowJSON?.accounts ?? []).reduce((hasPrivateKey, _ref4) => {
let [, value] = _ref4;
return Object.entries(flowJSON?.accounts ?? []).reduce((hasPrivateKey, _ref5) => {
let [, value] = _ref5;
if (hasPrivateKey) return true;

@@ -179,0 +202,0 @@ return value && Object.prototype.hasOwnProperty.call(value, "key") && isHexidecimal(value?.key);

16

package.json
{
"name": "@onflow/config",
"version": "1.3.0-typescript.0",
"version": "1.3.0",
"description": "Config for FCL-JS",

@@ -17,3 +17,3 @@ "license": "Apache-2.0",

"@babel/preset-typescript": "^7.22.11",
"@onflow/fcl-bundle": "^1.4.0-alpha.0",
"@onflow/fcl-bundle": "1.4.2",
"@types/estree": "^1.0.1",

@@ -24,3 +24,3 @@ "@types/jest": "^29.5.4",

"eslint": "^8.48.0",
"eslint-plugin-jsdoc": "^46.5.1",
"eslint-plugin-jsdoc": "^46.9.0",
"jest": "^29.5.0",

@@ -33,3 +33,3 @@ "typescript": "^4.9.5"

"unpkg": "dist/config.umd.js",
"types": "dist/config.d.ts",
"types": "types/config.d.ts",
"scripts": {

@@ -45,8 +45,8 @@ "prepublishOnly": "npm test && npm run build",

"@babel/runtime": "^7.18.6",
"@onflow/util-actor": "^1.3.0-alpha.0",
"@onflow/util-invariant": "^1.2.0-alpha.0",
"@onflow/util-logger": "^1.3.0-alpha.0",
"@onflow/util-actor": "1.3.2",
"@onflow/util-invariant": "1.2.2",
"@onflow/util-logger": "1.3.2",
"eslint": "^8.34.0",
"eslint-plugin-jsdoc": "^40.0.0"
"eslint-plugin-jsdoc": "^46.9.0"
}
}

@@ -6,7 +6,5 @@ {

"compilerOptions": {
// Types should go into this directory.
// Removing this would place the .d.ts files
// next to the .js files
"outDir": "types"
"declarationDir": "types",
"rootDir": "src"
}
}

@@ -1,4 +0,62 @@

export function ifElse(testFn: (arg0: object) => boolean, posCond: (arg0: object) => any, negCond: (arg0: object) => any): (arg0: any) => any;
export function getContracts(jsons: object | object[], network: string): object;
export function anyHasPrivateKeys(value: object | object[]): boolean;
export function cleanNetwork(network: string): string;
type FlowNetwork = "emulator" | "testnet" | "mainnet";
export interface FlowJson {
networks?: {
[key in FlowNetwork]?: string;
};
accounts?: {
[key: string]: {
address: string;
key?: string | object;
};
};
contracts?: {
[key: string]: {
source: string;
aliases: {
[key in FlowNetwork]?: string;
};
};
};
dependencies?: {
[key: string]: {
source: string;
hash: string;
aliases: {
[key in FlowNetwork]?: string;
};
};
};
deployments?: {
[key in FlowNetwork]?: {
[contract: string]: string[];
};
};
}
/**
* @description Support if/then/else behavior in a function way.
* @param testFn - Function to test
* @param posCond - Function to run if testFn is true
* @param negCond - Function to run it testFn is false
* @returns Function that returns the result of posCond or negCond
*/
export declare const ifElse: <T, U>(testFn: (v: T) => U, posCond: (v: T) => U, negCond: (v: T) => U) => (v: T) => U;
/**
* @description Take in flow.json files and return contract to address mapping by network
* @param jsons - Flow JSON or array of Flow JSONs
* @param network - Network to gather addresses for
* @returns Contract names by addresses mapping e.g { "HelloWorld": "0x123" }
*/
export declare const getContracts: (jsons: FlowJson | FlowJson[], network: FlowNetwork) => any;
/**
* @description Take in flow.json or array of flow.json files and checks for private keys
* @param value - Flow JSON or array of Flow JSONs
* @returns Has private keys status
*/
export declare const anyHasPrivateKeys: (value: FlowJson | FlowJson[]) => boolean;
/**
* @description Format network to always be 'emulator', 'testnet', or 'mainnet'
* @param network - Network to format
* @returns Formatted network name (either 'emulator', 'testnet', or 'mainnet')
*/
export declare const cleanNetwork: (network: string) => FlowNetwork;
export {};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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