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

@nextcloud/typings

Package Overview
Dependencies
Maintainers
12
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nextcloud/typings - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

.github/workflows/node.yml

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Changelog

## 1.7.0 - 2023-06-13
### Added
- Added typings for `OC.Util` (all versions)
- Added typings for `OCP.Accessibility` (Nextcloud 25+)
- Added namespace for Nextcloud 26
- Added namespace for Nextcloud 27
- Including typings for new `OCP.Files.Router` API
### Changed
- Dependency updates
## 1.6.0 - 2023-01-06

@@ -7,0 +17,0 @@ ### Added

111

lib/common/OC.d.ts

@@ -139,2 +139,107 @@ /// <reference types="jquery" />

interface UtilHistory {
/**
* Push the current URL parameters to the history stack
* and change the visible URL.
*
* @param params to append to the URL
* @param url URL to be used, otherwise the current URL will be used, using the params as query string
*/
pushState(params: Record<string, string> | string, url?: string): void;
/**
* Replace the current URL parameters on the history stack
* and change the visible URL.
*
* @param {object | string} params to append to the URL
* @param url URL to be used
*/
replaceState(params: Record<string, string> | string, url: string): void;
/**
* Add a popstate handler
*
* @param handler The handler
*/
addOnPopStateHandler(handler: Function): void;
/**
* Parse the query/search part of the URL.
*
* @return map of parameters
*/
parseUrlQuery(): Record<string, string>;
}
interface Util {
History: UtilHistory,
/**
* Make a human file size (2048 to 2 kB)
* @param size File size in bytes
* @return A human readable file size
*/
humanFileSize(size: number, skipSmallSizes: boolean): string,
/**
* Returns a file size in bytes from a humanly readable string
* Like 2kB to 2048.
*
* @param string file size in human readable format
* @return Number of bytes or Null if string could not be parsed
*/
computerFileSize(string: string): null|number;
formatDate(timestamp: string, format: string): string;
/**
* Human readable difference from now
*/
relativeModifiedDate(timestamp: string): string;
/**
* Returns whether this is IE
*/
isIE(): boolean;
/**
* Returns the width of a generic browser scrollbar
*
* @return width of scrollbar
*/
getScrollBarWidth(): number;
/**
* Remove the time component from a given date
*
* @param date Given date
* @return {Date} Date with stripped time
*/
stripTime(date: Date): Date;
/**
* Compare two strings to provide a natural sort
* @param a first string to compare
* @param b second string to compare
* @return negative if b comes before a, positive if a comes before b
* or 0 if the strings are identical
*/
naturalSortCompare(a: string, b: string): number;
/**
* Calls the callback in a given interval until it returns true
* @param callback The callback function
* @param interval in milliseconds
*/
waitFor(callback: Function, interval: number): void;
/**
* Checks if a cookie with the given name is present and is set to the provided value.
* @param name name of the cookie
* @param value value of the cookie
* @return true if the cookie with the given name has the given value
*/
isCookieSetToValue(name: string, value: string): boolean;
}
interface OC {

@@ -171,2 +276,3 @@ appswebroots: any

Plugins: Plugins;
Util: Util;

@@ -184,5 +290,4 @@ webroot: string

interface humanFileSize {
(size: number, skipSmallSizes: boolean): string;
}
// global scope until v18
type humanFileSize = Util["humanFileSize"];

@@ -189,0 +294,0 @@ interface DayMonthConstants {

@@ -11,1 +11,3 @@ /// <reference path="v16/OC.d.ts" />

/// <reference path="v25/OC.d.ts" />
/// <reference path="v26/OC.d.ts" />
/// <reference path="v27/OC.d.ts" />

5

lib/v24/OC.d.ts

@@ -9,3 +9,3 @@ declare namespace Nextcloud.v24 {

type OC = Nextcloud.v23.OC & {
type OC = Omit<Nextcloud.v23.OC, 'Util'> & {
dialogs: {

@@ -23,2 +23,5 @@ filepicker(

}
// OC.Util.isIE was dropped
Util: Omit<Nextcloud.v23.OC["Util"], 'isIE'>;
}

@@ -25,0 +28,0 @@

declare namespace Nextcloud.v25 {
type FilePickerFilter = Nextcloud.v24.FilePickerFilter
interface FilePickerOptions extends Nextcloud.v24.FilePickerOptions {
interface Accessibility {
/** Whether the user opted-out of shortcuts so that they should not be registered */
disableKeyboardShortcuts(): boolean
}

@@ -14,3 +13,3 @@

interface OCP extends Nextcloud.v24.OCP {
Accessibility: Accessibility
}

@@ -17,0 +16,0 @@

{
"name": "@nextcloud/typings",
"version": "1.6.0",
"version": "1.7.0",
"description": "Nextcloud TypeScript typings",

@@ -33,8 +33,10 @@ "main": "dist/index.js",

"dependencies": {
"@types/jquery": "2.0.60"
"@types/jquery": "3.5.16",
"vue": "^2.7.14",
"vue-router": "<4"
},
"devDependencies": {
"babel-jest": "^27.0.5",
"jest": "^28.1.0",
"typescript": "^4.0.2"
"babel-jest": "^29.5.0",
"jest": "^29.5.0",
"typescript": "^5.0.4"
},

@@ -41,0 +43,0 @@ "engines": {

# @nextcloud/typings
[![NPM package](https://img.shields.io/npm/v/@nextcloud/typings?style=for-the-badge)](https://www.npmjs.com/package/@nextcloud/typings)
[![License](https://img.shields.io/npm/l/@nextcloud/typings?color=green&style=for-the-badge)](https://github.com/nextcloud/nextcloud-typings/blob/master/LICENSE)
[![Open issues](https://img.shields.io/github/issues-raw/nextcloud/nextcloud-typings?style=for-the-badge)](https://github.com/nextcloud/nextcloud-typings/issues)
[![Build Status](https://travis-ci.com/nextcloud/nextcloud-typings.svg?branch=master)](https://travis-ci.com/nextcloud/nextcloud-typings)
Versioned typings for the (internal) JavaScript APIs of Nextcloud used in higher level packages.
## Installation
```sh
npm i -S @nextcloud/typings
```
The typings have to be in the ``dependencies`` section, not ``devDependencies``. See https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#dependencies for details.
## Usage

@@ -14,3 +23,3 @@

declare var OC: Nextcloud.v22.OC | Nextcloud.v23.OC | Nextcloud.v24.OC;
declare var OC: Nextcloud.v25.OC | Nextcloud.v26.OC | Nextcloud.v27.OC;

@@ -17,0 +26,0 @@ OC.L10N.translate("app", "text")

@@ -13,6 +13,10 @@ {

},
"include": [
"lib"
],
"exclude": [
"dist",
"node_modules",
"dist"
"test"
]
}

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