Commit ea7dc847 authored by Jérome Perrin's avatar Jérome Perrin

monaco_editor: Add incomplete typescript declarations for Renderjs & RSVP

So that javascript editor provides hints for code using these libraries.

Some pointers for type scripts definitions:
https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html
https://definitelytyped.org/
parent 704fac1c
......@@ -70,6 +70,7 @@
})
.onStateChange(function(modification_dict) {
var queue = new RSVP.Queue();
if (modification_dict.hasOwnProperty('value')) {
// Do not notify the UI when initializing the value
this.state.ignoredChangeDuringInitialization = true;
......@@ -87,7 +88,28 @@
monaco.languages.html.htmlDefaults.options.format.tabSize = 2;
monaco.languages.html.htmlDefaults.options.format.insertSpaces = true;
}
if (this.state.model_language === 'javascript') {
// Type mapping for Nexedi libraries
function addExtraLibrary(script_name, lib_name) {
return fetch(script_name)
.then(function(resp) {
return resp.text();
})
.then(function(script_code) {
monaco.languages.typescript.javascriptDefaults.addExtraLib(
script_code,
lib_name
);
});
}
queue
.push(addExtraLibrary('./monaco-rsvp.d.ts', 'rsvp'))
.push(addExtraLibrary('./monaco-renderjs.d.ts', 'renderjs'))
.push(addExtraLibrary('./monaco-jio.d.ts', 'jio'));
}
}
return queue;
})
.declareMethod('getContent', function() {
......
// Type definitions for jio 3.34.0
// Project: https://lab.nexedi.com/nexedi/jio
// Definitions by: Jerome Perrin <https://github.com/perrinjerome>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped (not yet)
// TypeScript Version: 2.4
// XXX needs nexedi RSVP patch loaded.
/**
* metadata for a document stored in jIO
*/
interface Metadata {
[key: string]: string;
}
declare class Query {
/**
* Serialize a query object to search text
*
* @param query a query object
*/
public static objectToSearchText(query: IQuery): string;
}
interface SimpleQuery extends Query {
key: string;
value: any;
type: "simple";
}
interface ComplexQuery extends Query {
query_list: Query[];
operator: "AND" | "OR";
type: "complex";
}
type IQuery = SimpleQuery | ComplexQuery;
interface AllDocsQuery {
/**
* the query
*/
query: IQuery;
/**
* the begin, end limit.
*/
limit?: [number, number];
/**
* list of sort parameters.
*/
sort_on?: [string, "ascending" | "descending"][];
/**
* Which keys from metadata to retrieve
*/
select_list?: string[];
/**
* Shall we retrieve full metadata for all documents ? default false.
*/
include_docs?: boolean;
}
interface AllDocsResults {
/**
* number of returned results
*/
total_rows: number;
/**
* the results
*/
rows: AllDocsResult[];
}
interface AllDocsResult {
/**
* id of the document
*/
id: string;
/**
* metadata associated with the document
*/
value: Metadata;
}
interface StorageConfiguration {
/**
* Storage type
*/
type: string;
}
interface HandlerStorageConfiguration extends StorageConfiguration {
/**
* Sub-storage
*/
sub_storage: StorageConfiguration;
}
interface MultiHandlerStorageConfiguration extends StorageConfiguration {
/**
* Sub-storages
*/
storage_list?: StorageConfiguration[];
}
interface LocalStorageConfiguration extends StorageConfiguration {
type: "local";
/**
* False (default): create a storage with unlimited duration.
* True: the storage duration is limited to the user session.
*/
sessiononly?: boolean;
}
interface MemoryStorageConfiguration extends StorageConfiguration {
type: "memory";
}
interface IndexedDbStorageConfiguration extends StorageConfiguration {
type: "indexeddb";
/**
* Name of the database
*/
database: string;
}
interface WebSqlStorageConfiguration extends StorageConfiguration {
type: "websql";
/**
* Name of the database
*/
database: string;
}
interface WebDavStorageConfiguration extends StorageConfiguration {
type: "dav";
/**
* URL of your WebDAV server.
*/
url: string;
/**
* Login and password of your WebDAV, base64 encoded like this: btoa(username + ":" + password)
*/
basic_login: string;
/**
* False (default): do not send domain cookie.
* True: send domain cookie.
*/
with_credentials?: boolean;
}
interface DropboxStorageConfiguration extends StorageConfiguration {
type: "dropbox";
/**
* Access token for your dropbox. See the Dropbox documentation of its API v1 for how to generate an access token.
*/
access_token: string;
/**
* "dropbox" (default) for full access to account files.
* "sandbox" for only access to files created by your app.
*/
root: "dropbox" | "sandbox";
}
interface GoogleDriveStorageConfiguration extends StorageConfiguration {
type: "gdrive";
/**
* Access token for your Google Drive. See the Google Drive documentation for how to generate an access token.
*/
access_token: string;
/**
* true (default): sends file to trash bin when calling "remove".
* false: delete files permanently when calling "remove""
*/
trashing?: boolean;
}
interface ERP5StorageConfiguration extends StorageConfiguration {
type: "erp5";
/**
* URL of HATEOAS in your ERP5 instance.
*/
url: string;
/**
* Reference of the action used to deliver of the document.
*/
default_view_reference?: string;
}
interface ZipStorageConfiguration extends HandlerStorageConfiguration {
type: "zip";
}
interface ShaStorageConfiguration extends HandlerStorageConfiguration {
type: "sha";
}
interface UuidStorageConfiguration extends HandlerStorageConfiguration {
type: "uuid";
}
interface QueryStorageConfiguration extends HandlerStorageConfiguration {
type: "query";
}
interface CryptStorageConfiguration extends HandlerStorageConfiguration {
type: "crypt";
/**
* JSON crypto key.
*/
key: string;
}
interface UnionStorageConfiguration extends MultiHandlerStorageConfiguration {
type: "union";
}
interface DocumentStorageConfiguration
extends MultiHandlerStorageConfiguration {
type: "document";
/**
* id of the document to use.
*/
document_id: string;
/**
* Verify if the document is in good state. (default to false)
*/
repair_attachment?: boolean;
}
interface ReplicateStorageConfiguration extends StorageConfiguration {
type: "replicate";
/**
* Definition of the local storage, on which normal jIO operations are applied.
*/
local_sub_storage: StorageConfiguration;
/**
* Definition of the remote storage that synchronizes with the local storage.
*/
remote_sub_storage: StorageConfiguration;
/**
* Query object to limit the synchronisation to specific files.
*/
query: AllDocsQuery;
/**
* true: at file modification, modifies the local file id.
* false (default): at file modification, modifies the remote file id.
*/
use_remote_post?: boolean;
/**
* 0 (default): no conflict resolution (throws error)
* 1: keep the local state.
* 2: keep the remote state. 3: keep both states (no signature update)
*/
conflict_handling?: number;
/**
* Control number of parallel operation for document synchronisation. (default 1)
*/
parallel_operation_amount?: number;
/**
* Control number of parallel operation for attachment synchronisation. (default 1)
*/
parallel_operation_attachment_amount?: number;
/**
* Synchronize when local documents are modified. (default true)
*/
check_local_modification?: boolean;
/**
* Synchronize when local documents are created. (default true)
*/
check_local_creation: boolean;
/**
* Synchronize when local documents are deleted. (default true)
*/
check_local_deletion: boolean;
/**
* Synchronize when remote documents are modified. (default true)
*/
check_remote_modification: boolean;
/**
* Synchronize when remote documents are created. (default true)
*/
check_remote_creation: boolean;
/**
* Synchronize when remote documents are deleted. (default true)
*/
check_remote_deletion: boolean;
/**
* Synchronize when local attachments are modified. (default true)
*/
check_local_attachment_modification: boolean;
/**
* Synchronize when local attachments are created. (default false)
*/
check_local_attachment_creation: boolean;
/**
* Synchronize when local attachments are deleted. (default false)
*/
check_local_attachment_deletion: boolean;
/**
* Synchronize when remote attachments are modified. (default false)
*/
check_remote_attachment_modification: boolean;
/**
* Synchronize when remote attachments are created. (default false)
*/
check_remote_attachment_creation: boolean;
/**
* Synchronize when remote attachments are deleted. (default false)
*/
check_remote_attachment_deletion: boolean;
/**
* Use a document key as document signature hash (instead of calculating the SHA1).
*/
signature_hash_key?: string;
/**
* Definition of the signature storage, where replication signature are stored.
*/
signature_sub_storage: object;
}
declare class jIO {
/**
* `createJIO`
* Initialize a new storage or storage tree, synchronously.
* @param configuration the configuration to use.
*/
public static createJIO(
configuration: LocalStorageConfiguration
): LocalStorage;
public static createJIO(
configuration: MemoryStorageConfiguration
): MemoryStorage;
public static createJIO(
configuration: IndexedDbStorageConfiguration
): IndexedDbStorage;
public static createJIO(
configuration: WebSqlStorageConfiguration
): WebSqlStorage;
public static createJIO(
configuration: WebDavStorageConfiguration
): WebDavStorage;
public static createJIO(
configuration: DropboxStorageConfiguration
): DropboxStorage;
public static createJIO(
configuration: GoogleDriveStorageConfiguration
): GoogleDriveStorage;
public static createJIO(
configuration: ERP5StorageConfiguration
): ERP5Storage;
public static createJIO(configuration: ZipStorageConfiguration): ZipStorage;
public static createJIO(configuration: ShaStorageConfiguration): ShaStorage;
public static createJIO(
configuration: UuidStorageConfiguration
): UuidStorage;
public static createJIO(
configuration: QueryStorageConfiguration
): QueryStorage;
public static createJIO(
configuration: CryptStorageConfiguration
): CryptStorage;
public static createJIO(
configuration: UnionStorageConfiguration
): UnionStorage;
public static createJIO(
configuration: ReplicateStorageConfiguration
): ReplicateStorage;
// function createJIO(configuration: StorageConfiguration): jIOStorage;
}
interface jIOStorage {
/**
* `put`: Put Document
*
* Create or update the document with the given ID using the given metadata.
*
* @param id the document id
* @param metadata the document metadata
* @return an promise which resolves when document has been put.
*/
put(id: string, metadata: Metadata): RSVP.Queue<{}>;
/**
* `post`: Post Document
*
* Create a new document with the given metadata and returns the automatically generated ID.
* If post is unsupported, add a UuidStorage handler on top of your storage to provide it.
*
* @param metadata the document metadata
* @returns a promsise which resolves to the new document id once it have been posted.
*/
post(metadata: Metadata): RSVP.Queue<string>;
/**
* `get: Get Document
*
* Retrieve a document's metadata.
*
* @param id the document id
* @returns a promsise which resolves the document metadata.
*/
get(id: string): RSVP.Queue<Metadata>;
/**
* `remove`: Remove Document
*
* Deletes a document and all its attachments.
*
* @param id the document metadata
* @returns a promise which resolves once document is removed.
*/
remove(id: string): RSVP.Queue<{}>;
/**
* `allDocs`: Search Documents
*
* Retrieve a list of documents.
* If include_docs is true, then doc in the response will contain the full metadata for each document.
* Otherwise, if select_list contains keys, then value in the response will contain the values of these keys for each document.
* If query is unsupported, add a QueryStorage handler on top of your storage to provide it.
*
*/
allDocs(query: AllDocsQuery): RSVP.Queue<AllDocsResults>;
/**
* `putAttachment`: Add Attachment
*
* Create or update the given blob as an attachment with the given name to the document with the given ID
*
* @param id the document id
* @param name the attachment name
* @param blob the attachment content
* @return a promise which will resolve once the attachment is put.
*/
putAttachment(id: string, name: string, blob: Blob): RSVP.Queue<{}>;
/**
* `removeAttachment`: Remove Attachment
*
* Deletes the attachment with the given name from the document with the given ID.
*
* @param id the document id
* @param name the attachment name
* @return a promise which will resolve once the attachment is removed.
*/
removeAttachment(id: string, name: string, blob: Blob): RSVP.Queue<{}>;
/**
* `getAttachment`: Get Attachment
*
* Retrieve the attachment with the given name from the document with the given ID in text, json, blob, data_url, or array_buffer format.
*
* @param id the document id
* @param name the attachment name
* @return a promise which will resolve with the document.
*/
getAttachment(
id: string,
name: string,
format: { type: "text" }
): RSVP.Queue<string>;
getAttachment(
id: string,
name: string,
format: { type: "json" }
): RSVP.Queue<object>;
getAttachment(
id: string,
name: string,
format: { type: "blob" }
): RSVP.Queue<Blob>;
getAttachment(
id: string,
name: string,
format: { type: "data_url" }
): RSVP.Queue<string>;
getAttachment(
id: string,
name: string,
format: { type: "array_buffer" }
): RSVP.Queue<ArrayBuffer>;
/**
* `repair`: Synchronize Storage
* Synchronize or repair the storage.
* If repair is unsupported, add a ReplicateStorage handler on top of the two storages you wish to synchronize, to provide it
* @returns a promise which will resolve when storage is repaired, or be rejected if reparation failed.
*/
repair(): RSVP.Queue<{}>;
}
/**
* Store documents in the browser's local storage.
* This storage has only one document, with the ID "/", so post, put, remove and get methods are not supported.
* The only operations you can do on a raw LocalStorage are attachment manipulation methods with blobs.
* To treat a LocalStorage as a regular storage, add a DocumentStorage handler on top of it, with "/" as the document_id.
*/
interface LocalStorage extends jIOStorage {}
/**
* Store documents in a raw JavaScript object, in memory.
* The storage's data isn't saved when your web page is closed or reloaded, and doesn't take any other arguments.
*/
interface MemoryStorage extends jIOStorage {}
/**
* Store documents in the IndexedDB database with the given name.
*/
interface IndexedDbStorage extends jIOStorage {}
/**
* Store documents in the WebSQL database with the given name. Using an IndexedDBStorage is strictly better.
*/
interface WebSqlStorage extends jIOStorage {}
/**
* Store documents in the WebDAV server with the given URL.
* Documents are WebDAV directories, so they must not contain any metadata, and their IDs must be bookended by forward slashes that directly correspond to their path.
* Attachments to documents are files inside WebDAV directories, so they must not contain any forward slashes.
* To treat a WebDavStorage as a regular storage, add a FileSystemBridgeStorage on top of it.
*/
interface WebDavStorage extends jIOStorage {}
/**
* Store documents in the Dropbox account with the given access token.
* Documents are Dropbox folders, so they must not contain any metadata, and their IDs must be bookended by forward slashes that directly correspond to their path.
* Attachments to documents are Dropbox files inside Dropbox folders, so they must not contain any forward slashes.
* To treat a DropboxStorage as a regular storage, add a FileSystemBridgeStorage on top of it.
*/
interface DropboxStorage extends jIOStorage {}
/**
* Store documents in the Google Drive account with the given access token.
* Unlike WebDavStorage and DropboxStorage, GoogleDriveStorage documents can contain metadata and have no specific rules regarding forward slashes.
* To treat a GoogleDriveStorage as a regular storage, add a FileSystemBridgeStorage on top of it.
*/
interface GoogleDriveStorage extends jIOStorage {}
/**
* Store documents in the ERP5 instance with the given URL.
* All ERP5 documents must contain values for portal_type and parent_relative_url in the metadata, which define the type of the document that is stored.
* Attachments are ERP5 actions.
* A raw Erp5Storage supports post and query, so there is no need to add a UuidStorage or QueryStorage on top of it.
*/
interface ERP5Storage extends jIOStorage {}
/**
* Compress and decompress attachments to reduce network and storage usage.
*/
interface ZipStorage extends jIOStorage {}
/**
* Provide the post method to create new documents using the SHA-1 hashes of their parameters as their IDs.
*/
interface ShaStorage extends jIOStorage {}
/**
* Provide the post method to create new documents using randomly generated UUIDs as their IDs.
*/
interface UuidStorage extends jIOStorage {}
/**
* Provide support for query parameters in the allDocs method.
*/
interface QueryStorage extends jIOStorage {}
/**
* Encrypt and decrypt attachments to secure them.
* You must generate a [Crypto key in JSON format](https://developer.mozilla.org/fr/docs/Web/API/Window/crypto) to use this handler.
*/
interface CryptStorage extends jIOStorage {}
/**
*This handler takes a list of storages as its argument. When using a jIO method, UnionStorage tries it on the first storage of the array; if it fails, then UnionStorage tries the method on the next storage, and so on until success or there are no more storages left to try.
*/
interface UnionStorage extends jIOStorage {}
/**
* Create a storage on top of a single document by mapping documents to attachments, so that jIO methods work normally on single-document storages.
*/
interface DocumentStorage extends jIOStorage {}
/**
* Synchronize documents between a local and a remote storage by providing the repair method.
*/
interface ReplicateStorage extends jIOStorage {}
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>monaco-jio.d.ts</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/typescript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
// Type definitions for renderjs 0.20.0
// Project: https://lab.nexedi.com/nexedi/renderjs
// Definitions by: Jerome Perrin <https://github.com/perrinjerome>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped (not yet)
// TypeScript Version: 2.4
// XXX needs nexedi RSVP patch loaded.
/**
* A gadget state dict.
*/
interface GadgetState {
[key: string]: any;
}
/**
* Options to declared methods
*/
interface MethodOptions {
/**
* controls mutual exclusions of method calls.
*/
mutex?: string;
}
/**
* Options to declare a gadget.
*/
interface GadgetDeclarationOptions {
/**
* The local name of the gadget in declarer namespace
*/
scope: string;
/**
* The sandbox type, can be iframe to render in an iframe or public to render in the
* same window context.
*/
sandbox: "public" | "iframe";
/**
* The element where to bind the gadget.
*/
element: HTMLElement;
}
/**
* RenderJS gadget instance
*/
declare class Gadget {
/**
* The current state of the gadget.
* To mutate the state, use `changeState`.
*/
public state: GadgetState;
/**
* Because declared methods will be added to the gadget class, the type declaration is loose.
*/
[key: string]: any;
/**
* `declareGadget`: Declare a child gadget
*
* The parameters exactly correspond to those when declaring the gadget in HTML, with the addition of element, to specify an element to wrap the gadget in, rather than the default auto-generated <div>.
*
* @param gadgetURL the URL of the HTML page of the gadget.
* @param options the gadget options
*/
declareGadget(
gadgetURL: string,
options: GadgetDeclarationOptions
): RSVP.Queue<Gadget>;
/**
* `dropGadget`: Drop a child gadget.
*
* @param gadgetScope the scope of the previously declared gadget
*/
dropGadget(gadgetScope: string): RSVP.Queue<Gadget>;
/**
* `getDeclaredGadget`: Get a previously declared child gadget
*
* Returns a child gadget instance, previously declared with `declareGadget`.
*
* @param gadgetScope the scope of the previously declared gadget
*/
getDeclaredGadget(gadgetScope: string): RSVP.Queue<Gadget>;
/**
* `setState`: Set Initial State
*
* The gadget's state should be set once when initialising the gadget. The state should contain key/value pairs, but the state is just an ordinary JavaScript object with no hard restrictions.
*
* @param initialState the initial state.
*/
setState(initialState: GadgetState): RSVP.Queue<void>;
/**
* `changeState`: Change State
*
* Change the state by passing in a new key-value pair, which only overwrites the keys provided in the changeState call, and only if the current and new values are different. All other keys remain unchanged.
*
* @param newState the changes made to the state.
*/
changeState(newState: GadgetState): RSVP.Queue<void>;
}
/**
* RenderJs gadget class.
*/
interface GadgetKlass {
/**
* `setState`: Set Initial State
*
* The gadget's state should be set once when initialising the gadget. The state should contain key/value pairs, but the state is just an ordinary JavaScript object with no hard restrictions.
*
* @param initialState the initial state.
*/
setState(initialState: GadgetState): GadgetKlass;
/**
* `onStateChange`: Change State Callback.
*
* @param handler function implementing the service logic.
*/
onStateChange(
handler: (
this: Gadget,
modification_dict: GadgetState
) => RSVP.Queue<any> | void
): GadgetKlass;
/**
* `ready`: define a function to be called when gadget is ready
*
* The ready handler is triggered automatically when all gadget dependencies have loaded.
*
* @param f function to call when gadget is ready.
*/
ready(
f: (this: Gadget, gadget?: Gadget) => RSVP.Queue<any> | void
): GadgetKlass;
/**
* `declareMethod`: Declare Method
*
* The ready handler is triggered automatically when all gadget dependencies have loaded.
*
* @param methodName name of the method
* @param method function implementing the method logic.
* @param methodOptions the options for this methods.
*/
declareMethod(
methodName: string,
method: (this: Gadget, ...args: any[]) => any,
methodOptions?: MethodOptions
): GadgetKlass;
/**
* `declareService`: Declare a service.
*
* Services automatically trigger as soon as the gadget is loaded into the DOM, and are usually used for event binding. There can be multiple declareService handlers, which all trigger simultaneously.
*
* @param service function implementing the service logic.
*/
declareService(
service: (this: Gadget) => RSVP.Queue<any> | Promise<any>
): GadgetKlass;
/**
* `declareJob`: Declare a job.
*
* Jobs manually trigger by being called, like an ordinary RenderJS method. However, calling a job cancels the last call of the job if it hasn't finished. *
*
* @param jobName name of the job
* @param service function implementing the job logic.
*/
declareJob(
jobName: string,
job: (this: Gadget, ...args: any[]) => RSVP.Queue<any> | Promise<any>
): GadgetKlass;
/**
* `onEvent`: Bind Event.
*
* Jobs manually trigger by being called, like an ordinary RenderJS method. However, calling a job cancels the last call of the job if it hasn't finished. *
*
* @param eventName name of the Event
* @param eventHandler function implementing the logic.
* @param useCapture same semantics as EventTarget.addEventListener
* @param preventDefault XXX ?
*/
onEvent(
eventName: string,
eventHandler: (this: Gadget, event?: Event) => RSVP.Queue<any>,
useCapture?: boolean,
preventDefault?: boolean | Promise<any> | void
): GadgetKlass;
/**
* `onLoop`: Loop.
*
* When the gadget is displayed, loop on the callback method in a service.
* A delay can be configured between each loop execution.
*
* @param loopFunction the function to execute in the loop.
* @param delay the delay between call, in seconds.
*/
onLoop(loopFunction: (this: Gadget) => void, delay: number): GadgetKlass;
/**
* `allowPublicAcquisition`: Publish Method.
*
* Publish a method to allow children to acquire it.
* Only methods passed into allowPublicAcquisition in a parent gadget can be acquired using declareAcquiredMethod in a child gadget.
*
* @param methodName name of the method
* @param method function implementing the method logic.
*/
allowPublicAcquisition(
methodName: string,
method:
/**
* @param argument_list The arguments which the method is called.
* @param scope The caller gadget scope.
*/
(this: Gadget, argument_list: any[], scope: string) => any
): GadgetKlass;
/**
* `allowPublicAcquisition`: Publish Method.
*
* Acquire a method from a parent gadget, by passing the name of the published method as the first parameter and the name to call it locally as the second parameter.
*
* @param localMethodName name of the method as seen from this gadget instance.
* @param parentMethodName name of the method on the parent gadget instance.
*/
declareAcquiredMethod(
localMethodName: string,
parentMethodName: string
): GadgetKlass;
}
declare function rJS(window: Window): GadgetKlass;
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>monaco-renderjs.d.ts</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/typescript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
// Type definitions for RSVP 4.0
// Project: https://github.com/tildeio/rsvp.js
// Definitions by: Chris Krycho <https://github.com/chriskrycho>
// Modified to reflect nexedi patch: Jerome Perrin <https://github.com/perrinjerome>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped (original version)
// TypeScript Version: 2.4
// These types are derived in large part from the Microsoft-supplied types for
// ES2015 Promises. They have been tweaked to support RSVP's extensions to the
// Promises A+ spec and the additional helper functions it supplies.
// declare module 'rsvp' { /* patch nexedi */
// namespace RSVP { /* patch nexedi */
declare module RSVP {
// All the Promise methods essentially flatten existing promises, so that
// you don't end up with `Promise<Promise<Promise<string>>>` if you happen
// to return another `Promise` from a `.then()` invocation, etc. So all of
// them can take a type or a promise-like/then-able type.
type Arg<T> = T | PromiseLike<T>;
// RSVP supplies status for promises in certain places.
enum State {
fulfilled = 'fulfilled',
rejected = 'rejected',
pending = 'pending',
}
type Resolved<T> = {
state: State.fulfilled;
value: T;
};
type Rejected<T = any> = {
state: State.rejected;
reason: T;
};
type Pending = {
state: State.pending;
};
type PromiseState<T> = Resolved<T> | Rejected | Pending;
type Deferred<T> = {
promise: Promise<T>;
resolve: (value?: RSVP.Arg<T>) => void;
reject: (reason?: any) => void;
};
interface InstrumentEvent {
guid: string; // guid of promise. Must be globally unique, not just within the implementation
childGuid: string; // child of child promise (for chained via `then`)
eventName: string; // one of ['created', 'chained', 'fulfilled', 'rejected']
detail: any; // fulfillment value or rejection reason, if applicable
label: string; // label passed to promise's constructor
timeStamp: number; // milliseconds elapsed since 1 January 1970 00:00:00 UTC up until now
}
interface ObjectWithEventMixins {
on(
eventName: 'created' | 'chained' | 'fulfilled' | 'rejected',
listener: (event: InstrumentEvent) => void
): void;
on(eventName: 'error', errorHandler: (reason: any) => void): void;
on(eventName: string, callback: (value: any) => void): void;
off(eventName: string, callback?: (value: any) => void): void;
trigger(eventName: string, options?: any, label?: string): void;
}
export class EventTarget {
/** `RSVP.EventTarget.mixin` extends an object with EventTarget methods. */
static mixin(object: object): ObjectWithEventMixins;
/** Registers a callback to be executed when `eventName` is triggered */
static on(
eventName: 'created' | 'chained' | 'fulfilled' | 'rejected',
listener: (event: InstrumentEvent) => void
): void;
static on(eventName: 'error', errorHandler: (reason: any) => void): void;
static on(eventName: string, callback: (value: any) => void): void;
/**
* You can use `off` to stop firing a particular callback for an event.
*
* If you don't pass a `callback` argument to `off`, ALL callbacks for the
* event will not be executed when the event fires.
*/
static off(eventName: string, callback?: (value: any) => void): void;
/**
* Use `trigger` to fire custom events.
*
* You can also pass a value as a second argument to `trigger` that will be
* passed as an argument to all event listeners for the event
*/
static trigger(eventName: string, options?: any, label?: string): void;
}
class Promise<T> implements PromiseLike<T> {
constructor(
executor: (
resolve: (value?: RSVP.Arg<T>) => void,
reject: (reason?: any) => void
) => void,
label?: string
);
new<T>(
executor: (
resolve: (value?: RSVP.Arg<T>) => void,
reject: (reason?: any) => void
) => void
): RSVP.Promise<T>;
then<TResult1 = T, TResult2 = never>(
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | undefined | null,
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null,
label?: string
): RSVP.Promise<TResult1 | TResult2>;
catch<TResult = never>(
onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | undefined | null,
label?: string
): RSVP.Promise<T | TResult>;
finally<U>(onFinally?: U | PromiseLike<U>): RSVP.Promise<T>;
readonly [Symbol.toStringTag]: "Promise";
static all<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
values: [
Arg<T1>,
Arg<T2>,
Arg<T3>,
Arg<T4>,
Arg<T5>,
Arg<T6>,
Arg<T7>,
Arg<T8>,
Arg<T9>,
Arg<T10>
],
label?: string
): RSVP.Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
static all<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
values: [
Arg<T1>,
Arg<T2>,
Arg<T3>,
Arg<T4>,
Arg<T5>,
Arg<T6>,
Arg<T7>,
Arg<T8>,
Arg<T9>
],
label?: string
): RSVP.Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
static all<T1, T2, T3, T4, T5, T6, T7, T8>(
values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>],
label?: string
): RSVP.Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
static all<T1, T2, T3, T4, T5, T6, T7>(
values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>],
label?: string
): RSVP.Promise<[T1, T2, T3, T4, T5, T6, T7]>;
static all<T1, T2, T3, T4, T5, T6>(
values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>],
label?: string
): RSVP.Promise<[T1, T2, T3, T4, T5, T6]>;
static all<T1, T2, T3, T4, T5>(
values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>],
label?: string
): RSVP.Promise<[T1, T2, T3, T4, T5]>;
static all<T1, T2, T3, T4>(
values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>],
label?: string
): RSVP.Promise<[T1, T2, T3, T4]>;
static all<T1, T2, T3>(
values: [Arg<T1>, Arg<T2>, Arg<T3>],
label?: string
): RSVP.Promise<[T1, T2, T3]>;
static all<T1, T2>(values: [Arg<T1>, Arg<T2>], label?: string): Promise<[T1, T2]>;
static all<T>(values: (Arg<T>)[], label?: string): RSVP.Promise<T[]>;
static race<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
values: [
Arg<T1>,
Arg<T2>,
Arg<T3>,
Arg<T4>,
Arg<T5>,
Arg<T6>,
Arg<T7>,
Arg<T8>,
Arg<T9>,
T10 | PromiseLike<T10>
],
label?: string
): RSVP.Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10>;
static race<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
values: [
Arg<T1>,
Arg<T2>,
Arg<T3>,
Arg<T4>,
Arg<T5>,
Arg<T6>,
Arg<T7>,
Arg<T8>,
Arg<T9>
],
label?: string
): RSVP.Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;
static race<T1, T2, T3, T4, T5, T6, T7, T8>(
values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>],
label?: string
): RSVP.Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8>;
static race<T1, T2, T3, T4, T5, T6, T7>(
values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>],
label?: string
): RSVP.Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7>;
static race<T1, T2, T3, T4, T5, T6>(
values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>],
label?: string
): RSVP.Promise<T1 | T2 | T3 | T4 | T5 | T6>;
static race<T1, T2, T3, T4, T5>(
values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>],
label?: string
): RSVP.Promise<T1 | T2 | T3 | T4 | T5>;
static race<T1, T2, T3, T4>(
values: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>],
label?: string
): RSVP.Promise<T1 | T2 | T3 | T4>;
static race<T1, T2, T3>(
values: [Arg<T1>, Arg<T2>, Arg<T3>],
label?: string
): RSVP.Promise<T1 | T2 | T3>;
static race<T1, T2>(values: [Arg<T1>, Arg<T2>], label?: string): RSVP.Promise<T1 | T2>;
static race<T>(values: (Arg<T>)[], label?: string): RSVP.Promise<T>;
static reject(reason?: any, label?: string): RSVP.Promise<never>;
static resolve<T>(value?: Arg<T>, label?: string): RSVP.Promise<T>;
static resolve(): RSVP.Promise<void>;
/**
* @deprecated
*/
static cast: typeof RSVP.Promise.resolve;
}
const all: typeof Promise.all;
const race: typeof Promise.race;
const reject: typeof Promise.reject;
const resolve: typeof Promise.resolve;
function rethrow(reason: any): void;
const cast: typeof Promise.cast;
const on: typeof EventTarget.on;
const off: typeof EventTarget.off;
// ----- denodeify ----- //
// Here be absurd things because we don't have variadic types. All of
// this will go away if we can ever write this:
//
// denodeify<...T, ...A>(
// nodeFunc: (...args: ...A, callback: (err: any, ...cbArgs: ...T) => any) => void,
// options?: false
// ): (...args: ...A) => RSVP.Promise<...T>
//
// That day, however, may never come. So, in the meantime, we do this.
function denodeify<T1, T2, T3, A>(
nodeFunc: (
arg1: A,
callback: (err: any, data1: T1, data2: T2, data3: T3) => void
) => void,
options?: false
): (arg1: A) => RSVP.Promise<T1>;
function denodeify<T1, T2, A>(
nodeFunc: (arg1: A, callback: (err: any, data1: T1, data2: T2) => void) => void,
options?: false
): (arg1: A) => RSVP.Promise<T1>;
function denodeify<T, A>(
nodeFunc: (arg1: A, callback: (err: any, data: T) => void) => void,
options?: false
): (arg1: A) => RSVP.Promise<T>;
function denodeify<T1, T2, T3, A>(
nodeFunc: (
arg1: A,
callback: (err: any, data1: T1, data2: T2, data3: T3) => void
) => void,
options: true
): (arg1: A) => RSVP.Promise<[T1, T2, T3]>;
function denodeify<T1, T2, A>(
nodeFunc: (arg1: A, callback: (err: any, data1: T1, data2: T2) => void) => void,
options: true
): (arg1: A) => RSVP.Promise<[T1, T2]>;
function denodeify<T, A>(
nodeFunc: (arg1: A, callback: (err: any, data: T) => void) => void,
options: true
): (arg1: A) => RSVP.Promise<[T]>;
function denodeify<T1, T2, T3, A, K1 extends string, K2 extends string, K3 extends string>(
nodeFunc: (
arg1: A,
callback: (err: any, data1: T1, data2: T2, data3: T3) => void
) => void,
options: [K1, K2, K3]
): (arg1: A) => RSVP.Promise<{ [K in K1]: T1 } & { [K in K2]: T2 } & { [K in K3]: T3 }>;
function denodeify<T1, T2, A, K1 extends string, K2 extends string>(
nodeFunc: (arg1: A, callback: (err: any, data1: T1, data2: T2) => void) => void,
options: [K1, K2]
): (arg1: A) => RSVP.Promise<{ [K in K1]: T1 } & { [K in K2]: T2 }>;
function denodeify<T, A, K1 extends string>(
nodeFunc: (arg1: A, callback: (err: any, data: T) => void) => void,
options: [K1]
): (arg1: A) => RSVP.Promise<{ [K in K1]: T }>;
// ----- hash and hashSettled ----- //
function hash<T>(object: { [P in keyof T]: Arg<T[P]> }, label?: string): RSVP.Promise<T>;
function hashSettled<T>(
object: { [P in keyof T]: Arg<T[P]> },
label?: string
): RSVP.Promise<{ [P in keyof T]: PromiseState<T[P]> }>;
function allSettled<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
entries: [
Arg<T1>,
Arg<T2>,
Arg<T3>,
Arg<T4>,
Arg<T5>,
Arg<T6>,
Arg<T7>,
Arg<T8>,
Arg<T9>,
Arg<T10>
],
label?: string
): RSVP.Promise<
[
PromiseState<T1>,
PromiseState<T2>,
PromiseState<T3>,
PromiseState<T4>,
PromiseState<T5>,
PromiseState<T6>,
PromiseState<T7>,
PromiseState<T8>,
PromiseState<T9>
]
>;
function allSettled<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
entries: [
Arg<T1>,
Arg<T2>,
Arg<T3>,
Arg<T4>,
Arg<T5>,
Arg<T6>,
Arg<T7>,
Arg<T8>,
Arg<T9>
],
label?: string
): RSVP.Promise<
[
PromiseState<T1>,
PromiseState<T2>,
PromiseState<T3>,
PromiseState<T4>,
PromiseState<T5>,
PromiseState<T6>,
PromiseState<T7>,
PromiseState<T8>,
PromiseState<T9>
]
>;
function allSettled<T1, T2, T3, T4, T5, T6, T7, T8>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>],
label?: string
): RSVP.Promise<
[
PromiseState<T1>,
PromiseState<T2>,
PromiseState<T3>,
PromiseState<T4>,
PromiseState<T5>,
PromiseState<T6>,
PromiseState<T7>,
PromiseState<T8>
]
>;
function allSettled<T1, T2, T3, T4, T5, T6, T7>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>],
label?: string
): RSVP.Promise<
[
PromiseState<T1>,
PromiseState<T2>,
PromiseState<T3>,
PromiseState<T4>,
PromiseState<T5>,
PromiseState<T6>,
PromiseState<T7>
]
>;
function allSettled<T1, T2, T3, T4, T5, T6>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>],
label?: string
): RSVP.Promise<
[
PromiseState<T1>,
PromiseState<T2>,
PromiseState<T3>,
PromiseState<T4>,
PromiseState<T5>,
PromiseState<T6>
]
>;
function allSettled<T1, T2, T3, T4, T5>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>],
label?: string
): RSVP.Promise<
[
PromiseState<T1>,
PromiseState<T2>,
PromiseState<T3>,
PromiseState<T4>,
PromiseState<T5>
]
>;
function allSettled<T1, T2, T3, T4>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>],
label?: string
): RSVP.Promise<[PromiseState<T1>, PromiseState<T2>, PromiseState<T3>, PromiseState<T4>]>;
function allSettled<T1, T2, T3>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>],
label?: string
): RSVP.Promise<[PromiseState<T1>, PromiseState<T2>, PromiseState<T3>]>;
function allSettled<T1, T2>(
entries: [Arg<T1>, Arg<T2>],
label?: string
): RSVP.Promise<[PromiseState<T1>, PromiseState<T2>]>;
function allSettled<T>(entries: Arg<T>[], label?: string): RSVP.Promise<[PromiseState<T>]>;
function map<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, U>(
entries: [
Arg<T1>,
Arg<T2>,
Arg<T3>,
Arg<T4>,
Arg<T5>,
Arg<T6>,
Arg<T7>,
Arg<T8>,
Arg<T9>,
Arg<T10>
],
mapFn: (item: T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10) => U,
label?: string
): RSVP.Promise<Array<U> & { length: 10 }>;
function map<T1, T2, T3, T4, T5, T6, T7, T8, T9, U>(
entries: [
Arg<T1>,
Arg<T2>,
Arg<T3>,
Arg<T4>,
Arg<T5>,
Arg<T6>,
Arg<T7>,
Arg<T8>,
Arg<T9>
],
mapFn: (item: T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9) => U,
label?: string
): RSVP.Promise<Array<U> & { length: 9 }>;
function map<T1, T2, T3, T4, T5, T6, T7, T8, U>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>],
mapFn: (item: T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8) => U,
label?: string
): RSVP.Promise<Array<U> & { length: 8 }>;
function map<T1, T2, T3, T4, T5, T6, T7, U>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>],
mapFn: (item: T1 | T2 | T3 | T4 | T5 | T6 | T7) => U,
label?: string
): RSVP.Promise<Array<U> & { length: 7 }>;
function map<T1, T2, T3, T4, T5, T6, U>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>],
mapFn: (item: T1 | T2 | T3 | T4 | T5 | T6) => U,
label?: string
): RSVP.Promise<Array<U> & { length: 6 }>;
function map<T1, T2, T3, T4, T5, U>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>],
mapFn: (item: T1 | T2 | T3 | T4 | T5) => U,
label?: string
): RSVP.Promise<Array<U> & { length: 5 }>;
function map<T1, T2, T3, T4, U>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>],
mapFn: (item: T1 | T2 | T3 | T4) => U,
label?: string
): RSVP.Promise<Array<U> & { length: 4 }>;
function map<T1, T2, T3, U>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>],
mapFn: (item: T1 | T2 | T3) => U,
label?: string
): RSVP.Promise<Array<U> & { length: 3 }>;
function map<T1, T2, U>(
entries: [Arg<T1>, Arg<T2>],
mapFn: (item: T1 | T2) => U,
label?: string
): RSVP.Promise<Array<U> & { length: 2 }>;
function map<T, U>(
entries: Arg<T>[],
mapFn: (item: T) => U,
label?: string
): RSVP.Promise<Array<U> & { length: 1 }>;
function filter<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
entries: [
Arg<T1>,
Arg<T2>,
Arg<T3>,
Arg<T4>,
Arg<T5>,
Arg<T6>,
Arg<T7>,
Arg<T8>,
Arg<T9>,
Arg<T10>
],
filterFn: (item: T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10) => boolean,
label?: string
): RSVP.Promise<Array<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10>>;
function filter<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
entries: [
Arg<T1>,
Arg<T2>,
Arg<T3>,
Arg<T4>,
Arg<T5>,
Arg<T6>,
Arg<T7>,
Arg<T8>,
Arg<T9>
],
filterFn: (item: T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9) => boolean,
label?: string
): RSVP.Promise<Array<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>>;
function filter<T1, T2, T3, T4, T5, T6, T7, T8>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>, Arg<T8>],
filterFn: (item: T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8) => boolean,
label?: string
): RSVP.Promise<Array<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8>>;
function filter<T1, T2, T3, T4, T5, T6, T7>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>, Arg<T7>],
filterFn: (item: T1 | T2 | T3 | T4 | T5 | T6 | T7) => boolean,
label?: string
): RSVP.Promise<Array<T1 | T2 | T3 | T4 | T5 | T6 | T7>>;
function filter<T1, T2, T3, T4, T5, T6>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>, Arg<T6>],
filterFn: (item: T1 | T2 | T3 | T4 | T5 | T6) => boolean,
label?: string
): RSVP.Promise<Array<T1 | T2 | T3 | T4 | T5 | T6> & { length: 6 }>;
function filter<T1, T2, T3, T4, T5>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>, Arg<T5>],
filterFn: (item: T1 | T2 | T3 | T4 | T5) => boolean,
label?: string
): RSVP.Promise<Array<T1 | T2 | T3 | T4 | T5>>;
function filter<T1, T2, T3, T4>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>, Arg<T4>],
filterFn: (item: T1 | T2 | T3 | T4) => boolean,
label?: string
): RSVP.Promise<Array<T1 | T2 | T3 | T4>>;
function filter<T1, T2, T3>(
entries: [Arg<T1>, Arg<T2>, Arg<T3>],
filterFn: (item: T1 | T2 | T3) => boolean,
label?: string
): RSVP.Promise<Array<T1 | T2 | T3>>;
function filter<T1, T2>(
entries: [Arg<T1>, Arg<T2>],
filterFn: (item: T1 | T2) => boolean,
label?: string
): RSVP.Promise<Array<T1 | T2>>;
function filter<T>(
entries: Arg<T>[],
filterFn: (item: T) => boolean,
label?: string
): RSVP.Promise<Array<T>>;
function defer<T>(label?: string): Deferred<T>;
function configure<T>(name: string): T;
function configure<T>(name: string, value: T): void;
function asap<T, U>(callback: (callbackArg: T) => U, arg: T): void;
const async: typeof asap;
// nexedi additions begin
class Queue<R> extends Promise<R> {
constructor();
push<U>(
onFulfilled?: (value: R) => U | Promise<U>,
onRejected?: (error: Error) => void
): Queue<U>;
}
class CancellationError extends Error {}
// nexedi additions end
}
// nexedi patch make RSVP exist in current namespace
// export default RSVP;
////// export const asap: typeof RSVP.asap;
////// export const cast: typeof RSVP.cast;
////// export const Promise: typeof RSVP.Promise;
////// export const EventTarget: typeof RSVP.EventTarget;
////// export const all: typeof RSVP.all;
////// export const allSettled: typeof RSVP.allSettled;
////// export const race: typeof RSVP.race;
////// export const hash: typeof RSVP.hash;
////// export const hashSettled: typeof RSVP.hashSettled;
////// export const rethrow: typeof RSVP.rethrow;
////// export const defer: typeof RSVP.defer;
////// export const denodeify: typeof RSVP.denodeify;
////// export const configure: typeof RSVP.configure;
////// export const on: typeof RSVP.on;
////// export const off: typeof RSVP.off;
////// export const resolve: typeof RSVP.resolve;
////// export const reject: typeof RSVP.reject;
////// export const map: typeof RSVP.map;
////// export const async: typeof RSVP.async;
////// export const filter: typeof RSVP.filter;
////// export const Queue: typeof RSVP.Queue;
////// export const CancellationError: typeof RSVP.CancellationError;
// }
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>monaco-rsvp.d.ts</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/typescript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -115,6 +115,25 @@ $script.onload = function() {
monaco.languages.html.htmlDefaults.options.format.insertSpaces = true;
}
// Type mapping for Nexedi libraries
function addExtraLibrary(script_name, lib_name) {
return fetch(script_name)
.then(function(resp) {
return resp.text();
})
.then(function(script_code) {
monaco.languages.typescript.javascriptDefaults.addExtraLib(
script_code,
lib_name
);
});
}
Promise.all([
addExtraLibrary('../monaco-rsvp.d.ts', 'rsvp'),
addExtraLibrary('../monaco-renderjs.d.ts', 'renderjs'),
addExtraLibrary('../monaco-jio.d.ts', 'jio')]);
var timeout = null;
// minimal pollyfil for AbortController
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment