@nteract/types
Advanced tools
Comparing version 1.0.4 to 1.1.0
@@ -6,39 +6,59 @@ "use strict"; | ||
}); | ||
exports.CommsRecord = exports.DocumentRecord = exports.makeAppRecord = undefined; | ||
exports.CommsRecord = exports.makeDocumentRecord = exports.makeAppRecord = exports.makeKernelspecs = exports.makeKernelspec = exports.makeCommunicationKernelspecs = exports.makeRemoteKernelRecord = exports.makeJupyterHostRecord = exports.makeDesktopHostRecord = exports.makeLocalKernelRecord = undefined; | ||
var _immutable = require("immutable"); | ||
var _hosts = require("./hosts"); | ||
var Immutable = require("immutable"); | ||
Object.defineProperty(exports, "makeLocalKernelRecord", { | ||
enumerable: true, | ||
get: function get() { | ||
return _hosts.makeLocalKernelRecord; | ||
} | ||
}); | ||
Object.defineProperty(exports, "makeDesktopHostRecord", { | ||
enumerable: true, | ||
get: function get() { | ||
return _hosts.makeDesktopHostRecord; | ||
} | ||
}); | ||
Object.defineProperty(exports, "makeJupyterHostRecord", { | ||
enumerable: true, | ||
get: function get() { | ||
return _hosts.makeJupyterHostRecord; | ||
} | ||
}); | ||
Object.defineProperty(exports, "makeRemoteKernelRecord", { | ||
enumerable: true, | ||
get: function get() { | ||
return _hosts.makeRemoteKernelRecord; | ||
} | ||
}); | ||
/* | ||
var _kernelspecs = require("./kernelspecs"); | ||
This is the definition of JSON that Flow provides | ||
Object.defineProperty(exports, "makeCommunicationKernelspecs", { | ||
enumerable: true, | ||
get: function get() { | ||
return _kernelspecs.makeCommunicationKernelspecs; | ||
} | ||
}); | ||
Object.defineProperty(exports, "makeKernelspec", { | ||
enumerable: true, | ||
get: function get() { | ||
return _kernelspecs.makeKernelspec; | ||
} | ||
}); | ||
Object.defineProperty(exports, "makeKernelspecs", { | ||
enumerable: true, | ||
get: function get() { | ||
return _kernelspecs.makeKernelspecs; | ||
} | ||
}); | ||
type JSON = | string | number | boolean | null | JSONObject | JSONArray; | ||
type JSONObject = { [key:string]: JSON }; | ||
type JSONArray = Array<JSON>; | ||
var _immutable = require("immutable"); | ||
Which we'll adapt for our use of Immutable.js | ||
*/ | ||
// eslint-disable-line no-use-before-define | ||
// Note: this is the kernelspec as formed by spawnteract and jupyter kernelspecs --json | ||
// Parts of AppRecord should become | ||
// ElectronAppRecord | ||
// Basically, anything that's only for desktop should have its own record & reducers | ||
var makeAppRecord = exports.makeAppRecord = (0, _immutable.Record)({ | ||
executionState: "not connected", | ||
token: null, // Electron specific (ish...) | ||
channels: null, // Electron, though we hope to adapt these... | ||
spawn: null, // Very Electron | ||
connectionFile: null, // Electron | ||
kernel: null, | ||
host: null, | ||
githubToken: null, // Electron specific (ish...) | ||
notificationSystem: null, // Should be available for all I assume | ||
kernelSpecName: null, // All | ||
kernelSpecDisplayName: null, // All | ||
kernelSpec: null, // All | ||
isSaving: false, // All -- ? | ||
@@ -49,21 +69,21 @@ lastSaved: null, // All | ||
}); | ||
var DocumentRecord = exports.DocumentRecord = Immutable.Record({ | ||
var makeDocumentRecord = exports.makeDocumentRecord = (0, _immutable.Record)({ | ||
notebook: null, | ||
savedNotebook: null, | ||
// $FlowFixMe: Immutable | ||
transient: new Immutable.Map({ | ||
keyPathsForDisplays: new Immutable.Map() | ||
transient: new _immutable.Map({ | ||
keyPathsForDisplays: new _immutable.Map() | ||
}), | ||
cellPagers: new Immutable.Map(), | ||
stickyCells: new Immutable.Set(), | ||
cellPagers: new _immutable.Map(), | ||
stickyCells: new _immutable.Set(), | ||
editorFocused: null, | ||
cellFocused: null, | ||
copied: new Immutable.Map(), | ||
copied: new _immutable.Map(), | ||
filename: "" | ||
}); | ||
var CommsRecord = exports.CommsRecord = Immutable.Record({ | ||
targets: new Immutable.Map(), | ||
info: new Immutable.Map(), | ||
models: new Immutable.Map() | ||
var CommsRecord = exports.CommsRecord = (0, _immutable.Record)({ | ||
targets: new _immutable.Map(), | ||
info: new _immutable.Map(), | ||
models: new _immutable.Map() | ||
}); |
{ | ||
"name": "@nteract/types", | ||
"version": "1.0.4", | ||
"version": "1.1.0", | ||
"description": "collection of types for nteract components", | ||
@@ -5,0 +5,0 @@ "scripts": { |
/* @flow */ | ||
import type { RecordFactory, RecordOf } from "immutable"; | ||
import type { Subject } from "rxjs"; | ||
import type { | ||
DesktopHostRecordProps, | ||
JupyterHostRecordProps, | ||
LocalKernelProps, | ||
RemoteKernelProps | ||
} from "./hosts"; | ||
const Immutable = require("immutable"); | ||
import type { RecordFactory, RecordOf } from "immutable"; | ||
import type { ChildProcess } from "child_process"; | ||
import { Record } from "immutable"; | ||
import type { Channels } from "../channels"; | ||
import { List, Map, Record, Set } from "immutable"; | ||
export type { HostRef, KernelspecsRef } from "./refs"; | ||
export { | ||
makeLocalKernelRecord, | ||
makeDesktopHostRecord, | ||
makeJupyterHostRecord, | ||
makeRemoteKernelRecord | ||
} from "./hosts"; | ||
export { | ||
makeCommunicationKernelspecs, | ||
makeKernelspec, | ||
makeKernelspecs | ||
} from "./kernelspecs"; | ||
/* | ||
@@ -22,3 +39,2 @@ | ||
*/ | ||
export type ImmutableJSON = | ||
@@ -31,8 +47,10 @@ | string | ||
| ImmutableJSONList; // eslint-disable-line no-use-before-define | ||
export type ImmutableJSONMap = Immutable.Map<string, ImmutableJSON>; | ||
export type ImmutableJSONList = Immutable.List<ImmutableJSON>; | ||
export type ImmutableJSONMap = Map<string, ImmutableJSON>; | ||
export type ImmutableJSONList = List<ImmutableJSON>; | ||
export type ExecutionCount = number | null; | ||
export type MimeBundle = Immutable.Map<string, ImmutableJSON>; | ||
export type MimeBundle = Map<string, ImmutableJSON>; | ||
@@ -62,3 +80,3 @@ export type ExecuteResult = { | ||
evalue: string, | ||
traceback: Immutable.List<string> | ||
traceback: List<string> | ||
}; | ||
@@ -73,3 +91,3 @@ | ||
source: string, | ||
outputs: Immutable.List<Output> | ||
outputs: List<Output> | ||
}; | ||
@@ -108,4 +126,4 @@ | ||
language_info: LanguageInfoMetadata | ||
// We're not currently using orig_nbformat in nteract. Based on the comment | ||
// in the schema, I'm not sure we should: | ||
// NOTE: We're not currently using orig_nbformat in nteract. Based on the comment | ||
// in the schema, we won't: | ||
// | ||
@@ -116,3 +134,4 @@ // > Original notebook format (major number) before converting the notebook between versions. This should never be written to a file | ||
// | ||
// It seems like an intermediate/in-memory representation that bled its way into the spec | ||
// It seems like an intermediate/in-memory representation that bled its way into the spec, when it should have been | ||
// handled as separate state. | ||
// | ||
@@ -123,4 +142,4 @@ // orig_nbformat?: number, | ||
export type Notebook = { | ||
cellMap: Immutable.Map<string, Cell>, | ||
cellOrder: Immutable.List<string>, | ||
cellMap: Map<string, Cell>, | ||
cellOrder: List<string>, | ||
nbformat: 4, | ||
@@ -135,11 +154,6 @@ nbformat_minor: 0 | 1 | 2 | 3 | 4, | ||
type AppRecordProps = { | ||
executionState: "not connected" | "busy" | "idle" | "starting", | ||
token: ?string, | ||
channels: ?Channels, | ||
spawn: ?ChildProcess, | ||
connectionFile: ?string, | ||
kernel: ?RecordOf<RemoteKernelProps | LocalKernelProps>, | ||
host: ?RecordOf<DesktopHostRecordProps | JupyterHostRecordProps>, | ||
githubToken: ?string, | ||
notificationSystem: ?Object, | ||
kernelSpecName: ?string, | ||
kernelSpecDisplayName: ?string, | ||
kernelSpec: ?Object, | ||
isSaving: boolean, | ||
@@ -150,12 +164,8 @@ lastSaved: ?Date, | ||
}; | ||
export const makeAppRecord: RecordFactory<AppRecordProps> = Record({ | ||
executionState: "not connected", | ||
token: null, // Electron specific (ish...) | ||
channels: null, // Electron, though we hope to adapt these... | ||
spawn: null, // Very Electron | ||
connectionFile: null, // Electron | ||
kernel: null, | ||
host: null, | ||
githubToken: null, // Electron specific (ish...) | ||
notificationSystem: null, // Should be available for all I assume | ||
kernelSpecName: null, // All | ||
kernelSpecDisplayName: null, // All | ||
kernelSpec: null, // All | ||
isSaving: false, // All -- ? | ||
@@ -166,7 +176,8 @@ lastSaved: null, // All | ||
}); | ||
export type AppRecord = RecordOf<AppRecordProps>; | ||
export type Document = { | ||
notebook: Notebook, | ||
transient: Immutable.Map<string, any>, // has the keypaths for updating displays | ||
type DocumentRecordProps = { | ||
notebook: ?Notebook, | ||
transient: Map<string, any>, // has the keypaths for updating displays | ||
// transient should be more fully typed (be a record itself) | ||
@@ -176,34 +187,41 @@ // right now it's keypaths and then it looks like it's able to handle any per | ||
cellPagers: any, | ||
stickyCells: ?Immutable.Set<any>, | ||
stickyCells: ?Set<any>, | ||
editorFocused: any, | ||
cellFocused: any, | ||
copied: Immutable.Map<any, any> | ||
copied: Map<any, any> | ||
}; | ||
export const DocumentRecord = Immutable.Record({ | ||
export const makeDocumentRecord: RecordFactory<DocumentRecordProps> = Record({ | ||
notebook: null, | ||
savedNotebook: null, | ||
// $FlowFixMe: Immutable | ||
transient: new Immutable.Map({ | ||
keyPathsForDisplays: new Immutable.Map() | ||
transient: new Map({ | ||
keyPathsForDisplays: new Map() | ||
}), | ||
cellPagers: new Immutable.Map(), | ||
stickyCells: new Immutable.Set(), | ||
cellPagers: new Map(), | ||
stickyCells: new Set(), | ||
editorFocused: null, | ||
cellFocused: null, | ||
copied: new Immutable.Map(), | ||
copied: new Map(), | ||
filename: "" | ||
}); | ||
export type DocumentRecord = RecordOf<DocumentRecordProps>; | ||
export const CommsRecord = Immutable.Record({ | ||
targets: new Immutable.Map(), | ||
info: new Immutable.Map(), | ||
models: new Immutable.Map() | ||
type CommsRecordProps = { | ||
targets: Map<any, any>, | ||
info: Map<any, any>, | ||
models: Map<any, any> | ||
}; | ||
export const CommsRecord = Record({ | ||
targets: new Map(), | ||
info: new Map(), | ||
models: new Map() | ||
}); | ||
export type AppState = { | ||
app: AppRecord, | ||
document: DocumentRecord, | ||
comms: CommsRecord, | ||
config: Immutable.Map<string, any> | ||
app: RecordOf<AppRecordProps>, | ||
document: RecordOf<DocumentRecordProps>, | ||
comms: RecordOf<CommsRecordProps>, | ||
config: Map<string, any> | ||
}; |
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
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
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
18680
26
574
2