@atproto/common
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -1,2 +0,1 @@ | ||
const pkgJson = require('@npmcli/package-json') | ||
const { nodeExternalsPlugin } = require('esbuild-node-externals') | ||
@@ -7,9 +6,2 @@ | ||
if (process.argv.includes('--update-main-to-dist')) { | ||
return pkgJson | ||
.load(__dirname) | ||
.then((pkg) => pkg.update({ main: 'dist/index.js' })) | ||
.then((pkg) => pkg.save()) | ||
} | ||
require('esbuild').build({ | ||
@@ -16,0 +8,0 @@ logLevel: 'info', |
export * from '@atproto/common-web'; | ||
export * from './dates'; | ||
export * from './fs'; | ||
@@ -7,1 +8,2 @@ export * from './ipld'; | ||
export * from './streams'; | ||
export * from './buffers'; |
@@ -13,2 +13,3 @@ /// <reference types="node" /> | ||
export declare const cidForCbor: (data: unknown) => Promise<CID>; | ||
export declare const isValidCid: (cidStr: string) => Promise<boolean>; | ||
export declare const cborBytesToRecord: (bytes: Uint8Array) => Record<string, unknown>; | ||
@@ -15,0 +16,0 @@ export declare const verifyCidForBytes: (cid: CID, bytes: Uint8Array) => Promise<void>; |
{ | ||
"name": "@atproto/common", | ||
"version": "0.3.0", | ||
"main": "dist/index.js", | ||
"version": "0.3.1", | ||
"license": "MIT", | ||
"description": "Shared web-platform-friendly code for atproto libraries", | ||
"keywords": [ | ||
"atproto" | ||
], | ||
"homepage": "https://atproto.com", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/bluesky-social/atproto.git", | ||
"url": "https://github.com/bluesky-social/atproto", | ||
"directory": "packages/common" | ||
}, | ||
"main": "dist/index.js", | ||
"dependencies": { | ||
"@ipld/dag-cbor": "^7.0.3", | ||
"cbor-x": "^1.5.1", | ||
"iso-datestring-validator": "^2.2.2", | ||
"multiformats": "^9.9.0", | ||
"pino": "^8.15.0", | ||
"zod": "3.21.4", | ||
"@atproto/common-web": "^0.2.1" | ||
}, | ||
"scripts": { | ||
"test": "jest", | ||
"prettier": "prettier --check src/ tests/", | ||
"prettier:fix": "prettier --write src/ tests/", | ||
"lint": "eslint . --ext .ts,.tsx", | ||
"lint:fix": "yarn lint --fix", | ||
"verify": "run-p prettier lint", | ||
"verify:fix": "yarn prettier:fix && yarn lint:fix", | ||
"build": "node ./build.js", | ||
"postbuild": "tsc --build tsconfig.build.json", | ||
"update-main-to-dist": "node ./update-pkg.js --update-main-to-dist", | ||
"update-main-to-src": "node ./update-pkg.js --update-main-to-src", | ||
"prepublish": "npm run update-main-to-dist", | ||
"postpublish": "npm run update-main-to-src" | ||
"update-main-to-dist": "node ../../update-main-to-dist.js packages/common" | ||
}, | ||
"dependencies": { | ||
"@atproto/common-web": "*", | ||
"@ipld/dag-cbor": "^7.0.3", | ||
"cbor-x": "^1.5.1", | ||
"multiformats": "^9.6.4", | ||
"pino": "^8.6.1" | ||
} | ||
} | ||
"types": "dist/index.d.ts" | ||
} |
@@ -1,3 +0,10 @@ | ||
# ATP Common Library | ||
# @atproto/common | ||
A library containing code which is shared between ATP packages. | ||
Shared TypeScript code for other `@atproto/*` packages. This package is oriented towards writing servers, and is not designed to be browser-compatible. | ||
[![NPM](https://img.shields.io/npm/v/@atproto/common)](https://www.npmjs.com/package/@atproto/common) | ||
[![Github CI Status](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml/badge.svg)](https://github.com/bluesky-social/atproto/actions/workflows/repo.yaml) | ||
## License | ||
MIT License |
import { isErrnoException } from '@atproto/common-web' | ||
import { constants } from 'fs' | ||
import fs from 'fs/promises' | ||
@@ -6,3 +7,3 @@ | ||
try { | ||
await fs.access(location, fs.constants.F_OK) | ||
await fs.access(location, constants.F_OK) | ||
return true | ||
@@ -9,0 +10,0 @@ } catch (err) { |
export * from '@atproto/common-web' | ||
export * from './dates' | ||
export * from './fs' | ||
@@ -7,1 +8,2 @@ export * from './ipld' | ||
export * from './streams' | ||
export * from './buffers' |
@@ -27,2 +27,11 @@ import crypto from 'crypto' | ||
export const isValidCid = async (cidStr: string): Promise<boolean> => { | ||
try { | ||
const parsed = CID.parse(cidStr) | ||
return parsed.toString() === cidStr | ||
} catch (err) { | ||
return false | ||
} | ||
} | ||
export const cborBytesToRecord = ( | ||
@@ -29,0 +38,0 @@ bytes: Uint8Array, |
import * as streams from '../src/streams' | ||
import { PassThrough, Readable, pipeline } from 'node:stream' | ||
import { PassThrough, Readable } from 'node:stream' | ||
@@ -4,0 +4,0 @@ describe('streams', () => { |
{ | ||
"extends": "./tsconfig.json", | ||
"exclude": ["**/*.spec.ts", "**/*.test.ts"] | ||
} | ||
} |
@@ -8,6 +8,4 @@ { | ||
}, | ||
"include": ["./src","__tests__/**/**.ts"], | ||
"references": [ | ||
{ "path": "../common-web/tsconfig.build.json" } | ||
] | ||
} | ||
"include": ["./src", "__tests__/**/**.ts"], | ||
"references": [{ "path": "../common-web/tsconfig.build.json" }] | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
1
0
11
2603969
7
31
23185
5
+ Addedzod@3.21.4
+ Added@atproto/common-web@0.2.4(transitive)
+ Addediso-datestring-validator@2.2.2(transitive)
+ Addedzod@3.21.4(transitive)
- Removed@atproto/common-web@0.3.1(transitive)
- Removedzod@3.24.1(transitive)
Updated@atproto/common-web@^0.2.1
Updatedmultiformats@^9.9.0
Updatedpino@^8.15.0