fitbit-sdk-types
Advanced tools
Comparing version 4.1.7 to 4.2.0
{ | ||
"name": "fitbit-sdk-types", | ||
"version": "4.1.7", | ||
"version": "4.2.0", | ||
"author": "Sergio Morchón Poveda <sergio.morchon@outlook.com>", | ||
@@ -32,14 +32,16 @@ "description": "Types for Fitbit SDK.", | ||
"prettier": "prettier \"**/*.ts\" \"**/*.tsx\" \"**/*.json\" \"**/*.yml\" \"**/*.md\"", | ||
"tslint": "tslint types/**/*.ts", | ||
"check-code": "npm run tslint && npm run prettier -- -l", | ||
"fix-code": "tslint types/**/*.ts --fix && npm run prettier -- --write", | ||
"lint": "eslint types/**/*.ts", | ||
"check-code": "npm run lint && npm run prettier -- -l", | ||
"fix-code": "npm run lint -- --fix types/**/*.ts && npm run prettier -- --write", | ||
"prepublishOnly": "npm run check-code && npm test" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^11.13.20", | ||
"@types/node": "^12.11.7", | ||
"@typescript-eslint/eslint-plugin": "^2.5.0", | ||
"@typescript-eslint/parser": "^2.5.0", | ||
"eslint": "^6.6.0", | ||
"eslint-config-prettier": "^6.5.0", | ||
"prettier": "^1.18.2", | ||
"tslint": "^5.20.0", | ||
"tslint-config-prettier": "^1.18.0", | ||
"typescript": "^3.6.3" | ||
"typescript": "^3.7.1-rc" | ||
} | ||
} |
@@ -34,57 +34,56 @@ const { name: moduleName, version: moduleVersion } = require('../package.json'); | ||
const commonTsConfig = { | ||
extends: '../tsconfig.json', | ||
include: ['**/*.ts'], | ||
const es2015 = { | ||
target: 'es2015', | ||
lib: ['es2015'], | ||
}; | ||
const commonJsConfig = { | ||
extends: '../tsconfig.json', | ||
compilerOptions: { | ||
checkJs: true, | ||
}, | ||
include: ['**/*.js'], | ||
}; | ||
const fitbitProjects = [ | ||
{ | ||
directory: './app', | ||
const fitbitProjects = { | ||
'./app': { | ||
tsConfig: { | ||
...commonTsConfig, | ||
include: [getTypesPathForTarget('device'), ...commonTsConfig.include], | ||
extends: '../tsconfig.json', | ||
include: ['**/*.ts', getTypesPathForTarget('device')], | ||
}, | ||
jsConfig: { | ||
...commonJsConfig, | ||
include: [getTypesPathForTarget('device'), ...commonJsConfig.include], | ||
} | ||
extends: '../tsconfig.json', | ||
compilerOptions: { | ||
checkJs: true, | ||
}, | ||
include: ['**/*.js', getTypesPathForTarget('device')], | ||
}, | ||
}, | ||
{ | ||
directory: './companion', | ||
'./companion': { | ||
tsConfig: { | ||
...commonTsConfig, | ||
include: [getTypesPathForTarget('companion'), ...commonTsConfig.include], | ||
extends: '../tsconfig.json', | ||
compilerOptions: { | ||
...es2015, | ||
}, | ||
include: ['**/*.ts', getTypesPathForTarget('companion')], | ||
}, | ||
jsConfig: { | ||
...commonJsConfig, | ||
include: [getTypesPathForTarget('companion'), ...commonJsConfig.include], | ||
} | ||
extends: '../tsconfig.json', | ||
compilerOptions: { | ||
...es2015, | ||
checkJs: true, | ||
}, | ||
include: ['**/*.js', getTypesPathForTarget('companion')], | ||
}, | ||
}, | ||
{ | ||
directory: './settings', | ||
'./settings': { | ||
tsConfig: { | ||
...commonTsConfig, | ||
include: [ | ||
getTypesPathForTarget('settings'), | ||
...commonTsConfig.include, | ||
'**/*.tsx', | ||
], | ||
extends: '../tsconfig.json', | ||
compilerOptions: { | ||
...es2015, | ||
}, | ||
include: ['**/*.ts', '**/*.tsx', getTypesPathForTarget('settings')], | ||
}, | ||
jsConfig: { | ||
...commonJsConfig, | ||
include: [ | ||
getTypesPathForTarget('settings'), | ||
...commonJsConfig.include, | ||
'**/*.jsx', | ||
], | ||
extends: '../tsconfig.json', | ||
compilerOptions: { | ||
...es2015, | ||
checkJs: true, | ||
}, | ||
include: ['**/*.js', '**/*.jsx', getTypesPathForTarget('settings')], | ||
}, | ||
}, | ||
]; | ||
}; | ||
@@ -100,5 +99,5 @@ exports.default = (/** @type {'ts' | 'js'} */ mode) => { | ||
fitbitProjects | ||
.filter(({ directory }) => existsSync(directory)) | ||
.forEach(({ directory, tsConfig, jsConfig }) => { | ||
Object.entries(fitbitProjects) | ||
.filter(([directory]) => existsSync(directory)) | ||
.forEach(([directory, { tsConfig, jsConfig }]) => { | ||
if (mode === 'ts') { | ||
@@ -118,5 +117,12 @@ for (const fileName of walkFiles(directory)) { | ||
const configFileName = join(directory, mode === 'ts' ? 'tsconfig.json' : 'jsconfig.json'); | ||
const configFileName = join( | ||
directory, | ||
mode === 'ts' ? 'tsconfig.json' : 'jsconfig.json', | ||
); | ||
tryRun( | ||
() => writeFileSync(configFileName, stringify(mode === 'ts' ? tsConfig : jsConfig)), | ||
() => | ||
writeFileSync( | ||
configFileName, | ||
stringify(mode === 'ts' ? tsConfig : jsConfig), | ||
), | ||
`creating ${configFileName}`, | ||
@@ -123,0 +129,0 @@ ); |
@@ -24,3 +24,5 @@ declare class MessageEvent extends Event { | ||
open: Event; | ||
}> { | ||
}> {} | ||
declare class WebSocket implements WebSocket { | ||
readonly CONNECTING: 0; | ||
@@ -30,5 +32,5 @@ readonly OPEN: 1; | ||
readonly CLOSED: 3; | ||
readonly bufferedAmount: number; | ||
binaryType: BinaryType; | ||
readonly bufferedAmount: number; | ||
onclose: ((event: CloseEvent) => void) | void; | ||
@@ -45,8 +47,5 @@ onerror: ((event: Event) => void) | void; | ||
readonly url: string; | ||
constructor(url: string, protocols?: string | ReadonlyArray<string>); | ||
close(code?: number): void; | ||
send(data: string | ArrayBuffer | ArrayBufferView | Blob): void; | ||
} | ||
declare class WebSocket implements WebSocket { | ||
constructor(url: string, protocols?: string | ReadonlyArray<string>); | ||
} |
@@ -13,7 +13,8 @@ declare module 'accelerometer' { | ||
AccelerometerReading, | ||
BatchedAccelerometerReading | ||
BatchedAccelerometerReading, | ||
BatchedSensorOptions | ||
>; | ||
type AccelerometerConstructor = new ( | ||
options?: SensorOptions, | ||
options?: BatchedSensorOptions, | ||
) => Accelerometer; | ||
@@ -20,0 +21,0 @@ |
@@ -9,5 +9,9 @@ declare module 'barometer' { | ||
type Barometer = Sensor<BarometerReading, BatchedBarometerReading>; | ||
type Barometer = Sensor< | ||
BarometerReading, | ||
BatchedBarometerReading, | ||
BatchedSensorOptions | ||
>; | ||
type BarometerConstructor = new (options?: SensorOptions) => Barometer; | ||
type BarometerConstructor = new (options?: BatchedSensorOptions) => Barometer; | ||
@@ -14,0 +18,0 @@ const Barometer: void | BarometerConstructor; |
@@ -6,3 +6,3 @@ declare module 'body-presence' { | ||
type BodyPresenceSensor = Sensor<BodyPresenceReading, never>; | ||
type BodyPresenceSensor = Sensor<BodyPresenceReading, never, SensorOptions>; | ||
@@ -9,0 +9,0 @@ type BodyPresenceConstructor = new ( |
declare module 'crypto' { | ||
type SHA_256 = 'SHA-256'; | ||
interface Algorithm { | ||
name: SHA_256; | ||
[key: string]: any; | ||
type BufferSource = | ||
| ArrayBuffer | ||
| Int8Array | ||
| Uint8Array | ||
| Int16Array | ||
| Uint16Array | ||
| Int32Array | ||
| Uint32Array; | ||
type TypedArray = | ||
| Int8Array | ||
| Uint8Array | ||
| Int16Array | ||
| Uint16Array | ||
| Int32Array | ||
| Uint32Array; | ||
type CryptoKeyUsage = | ||
| 'encrypt' | ||
| 'decrypt' | ||
| 'sign' | ||
| 'verify' | ||
| 'deriveKey' | ||
| 'deriveBits' | ||
| 'wrapKey' | ||
| 'unwrapKey'; | ||
interface AlgorithmAesGcm { | ||
additionalData: BufferSource; | ||
iv: BufferSource; | ||
name: 'AES-GCM'; | ||
tagLength: number | void; | ||
} | ||
type Algorithm<T extends string> = T | { name: T }; | ||
interface KeyAlgorithm { | ||
name: string; | ||
hash: string | void; | ||
} | ||
class CryptoKey { | ||
readonly algorithm: KeyAlgorithm; | ||
readonly extractable: boolean; | ||
readonly type: 'secret' | 'public' | 'private'; | ||
readonly usages: CryptoKeyUsage[]; | ||
} | ||
interface SubtleCrypto { | ||
decrypt( | ||
algorithm: AlgorithmAesGcm, | ||
key: CryptoKey, | ||
data: BufferSource, | ||
): Promise<ArrayBuffer>; | ||
digest( | ||
algorithm: SHA_256 | Algorithm, | ||
data: ArrayBuffer | ArrayBufferView, | ||
): Promise<string>; | ||
algorithm: Algorithm<'SHA-256'>, | ||
data: BufferSource, | ||
): Promise<ArrayBuffer>; | ||
exportKey(format: 'raw', key: CryptoKey): Promise<ArrayBuffer>; | ||
importKey( | ||
format: 'raw', | ||
keyData: BufferSource, | ||
algorithm: string | KeyAlgorithm, | ||
extractable: boolean, | ||
keyUsages: string[], | ||
): Promise<CryptoKey>; | ||
sign( | ||
algorithm: Algorithm<'HMAC'>, | ||
key: CryptoKey, | ||
data: BufferSource, | ||
): Promise<ArrayBuffer>; | ||
verify( | ||
algorithm: Algorithm<'HMAC'>, | ||
key: CryptoKey, | ||
signature: BufferSource, | ||
data: BufferSource, | ||
): Promise<boolean>; | ||
} | ||
const subtle: SubtleCrypto; | ||
function getRandomValues(values: TypedArray): void; | ||
} |
@@ -7,3 +7,3 @@ declare module 'display' { | ||
autoOff: boolean; | ||
brightnessOverride: number | undefined; | ||
brightnessOverride: 'dim' | 'normal' | 'max' | void; | ||
on: boolean; | ||
@@ -10,0 +10,0 @@ onchange: (event: Event) => void; |
declare module 'document' { | ||
type EventHandler = (event: Event) => boolean; | ||
interface DocumentModule extends GlobalEvents { | ||
readonly location: { | ||
readonly pathname: string; | ||
}; | ||
getEventHandler(elementType: string): EventHandler | null; | ||
setEventHandler(elementType: string, handler: EventHandler): void; | ||
replaceSync(path: string): void; | ||
} | ||
@@ -7,0 +11,0 @@ |
declare module 'fs' { | ||
function existsSync(filename: string): boolean; | ||
function writeFileSync( | ||
@@ -3,0 +4,0 @@ filename: string, |
@@ -11,5 +11,9 @@ declare module 'gyroscope' { | ||
type Gyroscope = Sensor<GyroscopeReading, BatchedGyroscopeReading>; | ||
type Gyroscope = Sensor< | ||
GyroscopeReading, | ||
BatchedGyroscopeReading, | ||
BatchedSensorOptions | ||
>; | ||
type GyroscopeConstructor = new (options?: SensorOptions) => Gyroscope; | ||
type GyroscopeConstructor = new (options?: BatchedSensorOptions) => Gyroscope; | ||
@@ -16,0 +20,0 @@ const Gyroscope: void | GyroscopeConstructor; |
@@ -11,7 +11,8 @@ declare module 'heart-rate' { | ||
HeartRateSensorReading, | ||
BatchedHeartRateSensorReading | ||
BatchedHeartRateSensorReading, | ||
BatchedSensorOptions | ||
>; | ||
type HeartRateSensorConstructor = new ( | ||
options?: SensorOptions, | ||
options?: BatchedSensorOptions, | ||
) => HeartRateSensor; | ||
@@ -18,0 +19,0 @@ |
@@ -19,7 +19,8 @@ declare module 'orientation' { | ||
OrientationSensorReading, | ||
BatchedOrientationSensorReading | ||
BatchedOrientationSensorReading, | ||
BatchedSensorOptions | ||
>; | ||
type OrientationSensorConstructor = new ( | ||
options?: SensorOptions, | ||
options?: BatchedSensorOptions, | ||
) => OrientationSensor; | ||
@@ -26,0 +27,0 @@ |
@@ -11,3 +11,3 @@ type BatchedSensorReading<Reading> = { | ||
type Sensor<Reading extends SensorReading, BatchedReading> = Reading & | ||
type Sensor<Reading extends SensorReading, BatchedReading, Options> = Reading & | ||
EventTarget<{ | ||
@@ -25,2 +25,3 @@ activate: Event; | ||
stop(): void; | ||
setOptions(options: SensorOptions): void; | ||
}; | ||
@@ -37,3 +38,2 @@ | ||
readonly frequency?: number; | ||
readonly batch?: number; | ||
} | ||
@@ -40,0 +40,0 @@ |
@@ -24,2 +24,16 @@ declare module 'user-activity' { | ||
const today: Today; | ||
interface ActivityHistoryRecord { | ||
readonly averageHeartRate: number | void; | ||
readonly calories: number | void; | ||
readonly distance: number | void; | ||
readonly elevationGain: number | void; | ||
readonly restingHeartRate: number | void; | ||
readonly steps: number | void; | ||
} | ||
interface ActivityHistory { | ||
readonly maxRecordCount: number; | ||
query(options?: { limit?: number | undefined }): ActivityHistoryRecord[]; | ||
} | ||
const dayHistory: ActivityHistory; | ||
const minuteHistory: ActivityHistory; | ||
} |
type PermissionName = | ||
| 'access_activity' | ||
| 'access_app_cluster_storage' | ||
| 'access_exercise' | ||
@@ -4,0 +5,0 @@ | 'access_heart_rate' |
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
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
52490
63
1700
7