@atproto/common-web
Advanced tools
Comparing version 0.2.4-next.0 to 0.2.4
# @atproto/common-web | ||
## 0.2.4-next.0 | ||
## 0.2.4 | ||
### Patch Changes | ||
- Overhaul of package builds, no longer bundling deps. | ||
- [#2302](https://github.com/bluesky-social/atproto/pull/2302) [`4eaadc0ac`](https://github.com/bluesky-social/atproto/commit/4eaadc0acb6b73b9745dd7a2b929d02e58083ab0) Thanks [@dholms](https://github.com/dholms)! - Added methods for parsing labeler verification methods and services in DID Documents | ||
@@ -9,0 +9,0 @@ ## 0.2.3 |
export declare const keyBy: <T>(arr: T[], key: string) => Record<string, T>; | ||
export declare const mapDefined: <T, S>(arr: T[], fn: (obj: T) => S | undefined) => S[]; | ||
//# sourceMappingURL=arrays.d.ts.map |
@@ -31,2 +31,1 @@ export declare const readFromGenerator: <T>(gen: AsyncGenerator<T, any, unknown>, isDone: (last?: T | undefined) => Promise<boolean> | boolean, waitFor?: Promise<unknown>, maxLength?: number) => Promise<T[]>; | ||
export declare const handleAllSettledErrors: (results: PromiseSettledResult<unknown>[]) => void; | ||
//# sourceMappingURL=async.d.ts.map |
@@ -19,2 +19,1 @@ import { ZodError } from 'zod'; | ||
export declare const isObject: (obj: unknown) => obj is Record<string, unknown>; | ||
//# sourceMappingURL=check.d.ts.map |
@@ -23,2 +23,6 @@ import { z } from 'zod'; | ||
} | undefined; | ||
export declare const getVerificationMaterial: (doc: DidDocument, keyId: string) => { | ||
type: string; | ||
publicKeyMultibase: string; | ||
} | undefined; | ||
export declare const getSigningDidKey: (doc: DidDocument) => string | undefined; | ||
@@ -30,3 +34,3 @@ export declare const getPdsEndpoint: (doc: DidDocument) => string | undefined; | ||
id: string; | ||
type: string; | ||
type?: string; | ||
}) => string | undefined; | ||
@@ -95,2 +99,1 @@ export declare const didDocument: z.ZodObject<{ | ||
export type DidDocument = z.infer<typeof didDocument>; | ||
//# sourceMappingURL=did-doc.d.ts.map |
@@ -13,2 +13,1 @@ export * as check from './check'; | ||
export * from './did-doc'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -11,2 +11,1 @@ import { CID } from 'multiformats/cid'; | ||
export declare const ipldEquals: (a: IpldValue, b: IpldValue) => boolean; | ||
//# sourceMappingURL=ipld.d.ts.map |
@@ -8,2 +8,1 @@ export type RetryOptions = { | ||
export declare function backoffMs(n: number, multiplier?: number, max?: number): number; | ||
//# sourceMappingURL=retry.d.ts.map |
@@ -17,2 +17,1 @@ export declare const utf8Len: (str: string) => number; | ||
}; | ||
//# sourceMappingURL=strings.d.ts.map |
@@ -21,2 +21,1 @@ export declare class TID { | ||
export default TID; | ||
//# sourceMappingURL=tid.d.ts.map |
@@ -7,2 +7,1 @@ export declare const SECOND = 1000; | ||
export declare const addHoursToDate: (hours: number, startingDate?: Date) => Date; | ||
//# sourceMappingURL=times.d.ts.map |
@@ -21,2 +21,1 @@ import { CID } from 'multiformats/cid'; | ||
export type NotEmptyArray<T> = [T, ...T[]]; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -21,2 +21,1 @@ /// <reference types="node" /> | ||
export declare const parseIntWithFallback: <T>(value: string | undefined, fallback: T) => number | T; | ||
//# sourceMappingURL=util.d.ts.map |
@@ -1,6 +0,6 @@ | ||
/** @type {import('jest').Config} */ | ||
const base = require('../../jest.config.base.js') | ||
module.exports = { | ||
...base, | ||
displayName: 'Common Web', | ||
transform: { '^.+\\.(t|j)s$': '@swc/jest' }, | ||
setupFiles: ['<rootDir>/../../jest.setup.ts'], | ||
} |
{ | ||
"name": "@atproto/common-web", | ||
"version": "0.2.4-next.0", | ||
"version": "0.2.4", | ||
"license": "MIT", | ||
@@ -16,3 +16,2 @@ "description": "Shared web-platform-friendly code for atproto libraries", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"dependencies": { | ||
@@ -24,9 +23,9 @@ "graphemer": "^1.4.0", | ||
}, | ||
"devDependencies": { | ||
"jest": "^28.1.2" | ||
}, | ||
"scripts": { | ||
"test": "jest", | ||
"build": "tsc --build tsconfig.build.json" | ||
} | ||
"build": "node ./build.js", | ||
"postbuild": "tsc --build tsconfig.build.json", | ||
"update-main-to-dist": "node ../../update-main-to-dist.js packages/common-web" | ||
}, | ||
"types": "dist/index.d.ts" | ||
} |
@@ -31,2 +31,9 @@ import { z } from 'zod' | ||
): { type: string; publicKeyMultibase: string } | undefined => { | ||
return getVerificationMaterial(doc, 'atproto') | ||
} | ||
export const getVerificationMaterial = ( | ||
doc: DidDocument, | ||
keyId: string, | ||
): { type: string; publicKeyMultibase: string } | undefined => { | ||
const did = getDid(doc) | ||
@@ -40,3 +47,3 @@ let keys = doc.verificationMethod | ||
const found = keys.find( | ||
(key) => key.id === '#atproto' || key.id === `${did}#atproto`, | ||
(key) => key.id === `#${keyId}` || key.id === `${did}#${keyId}`, | ||
) | ||
@@ -49,2 +56,3 @@ if (!found?.publicKeyMultibase) return undefined | ||
} | ||
export const getSigningDidKey = (doc: DidDocument): string | undefined => { | ||
@@ -79,3 +87,3 @@ const parsed = getSigningKey(doc) | ||
doc: DidDocument, | ||
opts: { id: string; type: string }, | ||
opts: { id: string; type?: string }, | ||
) => { | ||
@@ -93,3 +101,3 @@ const did = getDid(doc) | ||
if (!found) return undefined | ||
if (found.type !== opts.type) { | ||
if (opts.type && found.type !== opts.type) { | ||
return undefined | ||
@@ -96,0 +104,0 @@ } |
{ | ||
"extends": "../../tsconfig/isomorphic.json", | ||
"compilerOptions": { | ||
"rootDir": "./src", | ||
"outDir": "./dist" | ||
}, | ||
"include": ["./src"] | ||
"extends": "./tsconfig.json", | ||
"exclude": ["**/*.spec.ts", "**/*.test.ts"] | ||
} |
{ | ||
"include": [], | ||
"references": [ | ||
{ "path": "./tsconfig.build.json" }, | ||
{ "path": "./tsconfig.tests.json" } | ||
] | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"rootDir": "./src", | ||
"outDir": "./dist", // Your outDir, | ||
"emitDeclarationOnly": true | ||
}, | ||
"include": ["./src", "__tests__/**/**.ts"] | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
1895950
0
15789
1
40
1