@hpcc-js/observablehq-compiler 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +13 -13
- package/dist/index.js.map +4 -4
- package/package.json +7 -6
- package/src/__package__.ts +2 -2
- package/src/compiler.ts +1 -1
- package/src/cst.ts +1 -1
- package/src/index.ts +1 -1
- package/src/observable-shim.ts +2 -0
- package/src/parse.ts +136 -0
- package/src/types.ts +180 -0
- package/src/util.ts +2 -2
- package/src/writer.ts +1 -1
- package/types/compiler.d.ts +1 -1
- package/types/index.d.ts +1 -1
- package/types/observable-shim.d.ts +2 -0
- package/types/parse.d.ts +26 -0
- package/types/types.d.ts +165 -0
- package/types/util.d.ts +1 -1
- package/types/writer.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hpcc-js/observablehq-compiler",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "hpcc-js - ObservableHQ Compiler (unoffical)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
8
|
"types": "./types/index.d.ts",
|
|
9
9
|
"default": "./dist/index.js"
|
|
10
|
-
}
|
|
10
|
+
},
|
|
11
|
+
"./dist/*": "./dist/*"
|
|
11
12
|
},
|
|
12
13
|
"main": "./dist/index.js",
|
|
13
14
|
"types": "./types/index.d.ts",
|
|
@@ -26,8 +27,8 @@
|
|
|
26
27
|
"gen-types": "tsc --project tsconfig.json",
|
|
27
28
|
"gen-types-watch": "npm run gen-types -- --watch",
|
|
28
29
|
"build": "run-p gen-types bundle",
|
|
29
|
-
"stamp": "node ../../node_modules/@hpcc-js/bundle/src/stamp.js",
|
|
30
30
|
"lint": "eslint ./src",
|
|
31
|
+
"lint-fix": "eslint --fix src/**/*.ts",
|
|
31
32
|
"docs": "typedoc --options tdoptions.json .",
|
|
32
33
|
"test-browser": "vitest run --project browser",
|
|
33
34
|
"test-node": "vitest run --project node",
|
|
@@ -42,8 +43,8 @@
|
|
|
42
43
|
"yargs": "17.7.2"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
|
-
"@hpcc-js/esbuild-plugins": "^1.
|
|
46
|
-
"@
|
|
46
|
+
"@hpcc-js/esbuild-plugins": "^1.3.0",
|
|
47
|
+
"@observablehq/parser": "6.1.0",
|
|
47
48
|
"@observablehq/runtime": "5.9.9"
|
|
48
49
|
},
|
|
49
50
|
"repository": {
|
|
@@ -65,5 +66,5 @@
|
|
|
65
66
|
"url": "https://github.com/hpcc-systems/Visualization/issues"
|
|
66
67
|
},
|
|
67
68
|
"homepage": "https://github.com/hpcc-systems/Visualization/tree/trunk/packages/observablehq-compiler",
|
|
68
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "658c50fd965a7744ba8db675ba6878607c44d5e2"
|
|
69
70
|
}
|
package/src/__package__.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export const PKG_NAME = "@hpcc-js/observablehq-compiler";
|
|
2
|
-
export const PKG_VERSION = "3.
|
|
3
|
-
export const BUILD_VERSION = "2.
|
|
2
|
+
export const PKG_VERSION = "3.2.0";
|
|
3
|
+
export const BUILD_VERSION = "3.2.0";
|
package/src/compiler.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ohq, splitModule } from "
|
|
1
|
+
import { ohq, splitModule } from "./observable-shim.ts";
|
|
2
2
|
import { parseCell, ParsedImportCell } from "./cst.ts";
|
|
3
3
|
import { Writer } from "./writer.ts";
|
|
4
4
|
import { fixRelativeUrl, isRelativePath, encodeBacktick, fetchEx, obfuscatedImport, ojs2notebook, omd2notebook } from "./util.ts";
|
package/src/cst.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ancestor, parseCell as ohqParseCell, Cell, Node, walk, AncestorVisitors } from "
|
|
1
|
+
import { ancestor, parseCell as ohqParseCell, Cell, Node, walk, AncestorVisitors } from "./observable-shim.ts";
|
|
2
2
|
|
|
3
3
|
import { fixRelativeUrl, createFunction, Refs } from "./util.ts";
|
|
4
4
|
|
package/src/index.ts
CHANGED
package/src/parse.ts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// Compare with ../../../node_modules/@observablehq/parser/src/parse.js
|
|
2
|
+
import { getLineInfo, tokTypes, Statement, ModuleDeclaration, Expression as ExpressionBase, Node } from "acorn";
|
|
3
|
+
import { ancestor, RecursiveVisitors, AncestorVisitors } from "acorn-walk";
|
|
4
|
+
import { CellParser, parseCell as ohqParseCell, walk as ohqWalk } from "@observablehq/parser";
|
|
5
|
+
import defaultGlobals from "../../../node_modules/@observablehq/parser/src/globals.js";
|
|
6
|
+
import findReferences from "../../../node_modules/@observablehq/parser/src/references.js";
|
|
7
|
+
import findFeatures from "../../../node_modules/@observablehq/parser/src/features.js";
|
|
8
|
+
|
|
9
|
+
export interface MutableExpression extends Node {
|
|
10
|
+
type: "MutableExpression"
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface ViewExpression extends Node {
|
|
14
|
+
type: "ViewExpression"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type Expression = ExpressionBase | MutableExpression | ViewExpression;
|
|
18
|
+
|
|
19
|
+
// Find references.
|
|
20
|
+
// Check for illegal references to arguments.
|
|
21
|
+
// Check for illegal assignments to global references.
|
|
22
|
+
function parseReferences(cell, input, globals = defaultGlobals) {
|
|
23
|
+
if (!cell.body) {
|
|
24
|
+
cell.references = [];
|
|
25
|
+
} else if (cell.body.type === "ImportDeclaration") {
|
|
26
|
+
// This is correct?!?
|
|
27
|
+
cell.references = cell.body.specifiers
|
|
28
|
+
? cell.body.specifiers.map(i => i.imported)
|
|
29
|
+
: [];
|
|
30
|
+
} else {
|
|
31
|
+
try {
|
|
32
|
+
cell.references = findReferences(cell, globals);
|
|
33
|
+
} catch (error: any) {
|
|
34
|
+
if (error.node) {
|
|
35
|
+
const loc = getLineInfo(input, error.node.start);
|
|
36
|
+
error.message += ` (${loc.line}:${loc.column})`;
|
|
37
|
+
error.pos = error.node.start;
|
|
38
|
+
error.loc = loc;
|
|
39
|
+
delete error.node;
|
|
40
|
+
}
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return cell;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Find features: file attachments, secrets, database clients.
|
|
48
|
+
// Check for illegal references to arguments.
|
|
49
|
+
// Check for illegal assignments to global references.
|
|
50
|
+
function parseFeatures(cell, input) {
|
|
51
|
+
if (cell.body && cell.body.type !== "ImportDeclaration") {
|
|
52
|
+
try {
|
|
53
|
+
cell.fileAttachments = findFeatures(cell, "FileAttachment");
|
|
54
|
+
cell.databaseClients = findFeatures(cell, "DatabaseClient");
|
|
55
|
+
cell.secrets = findFeatures(cell, "Secret");
|
|
56
|
+
} catch (error: any) {
|
|
57
|
+
if (error.node) {
|
|
58
|
+
const loc = getLineInfo(input, error.node.start);
|
|
59
|
+
error.message += ` (${loc.line}:${loc.column})`;
|
|
60
|
+
error.pos = error.node.start;
|
|
61
|
+
error.loc = loc;
|
|
62
|
+
delete error.node;
|
|
63
|
+
}
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
cell.fileAttachments = new Map();
|
|
68
|
+
cell.databaseClients = new Map();
|
|
69
|
+
cell.secrets = new Map();
|
|
70
|
+
}
|
|
71
|
+
return cell;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
class ModuleParser extends CellParser {
|
|
75
|
+
|
|
76
|
+
parseTopLevel(node: { cells?: Cell[] }) {
|
|
77
|
+
if (!node.cells) node.cells = [];
|
|
78
|
+
// @ts-ignore
|
|
79
|
+
while (this.type !== tokTypes.eof) {
|
|
80
|
+
// @ts-ignore
|
|
81
|
+
const cell: Cell = this.parseCell(this.startNode());
|
|
82
|
+
// @ts-ignore
|
|
83
|
+
cell.input = this.input;
|
|
84
|
+
node.cells.push(cell);
|
|
85
|
+
}
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
this.next();
|
|
88
|
+
// @ts-ignore
|
|
89
|
+
return this.finishNode(node, "Program");
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// @ts-ignore
|
|
94
|
+
export function parseModule(input, { globals }: { globals: any } = {}) {
|
|
95
|
+
// @ts-ignore
|
|
96
|
+
const program = ModuleParser.parse(input, { ecmaVersion: 2020 });
|
|
97
|
+
for (const cell of program.cells) {
|
|
98
|
+
parseReferences(cell, input, globals);
|
|
99
|
+
parseFeatures(cell, input);
|
|
100
|
+
}
|
|
101
|
+
return program;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface Cell extends Node {
|
|
105
|
+
type: "Cell";
|
|
106
|
+
id: Expression;
|
|
107
|
+
text: string;
|
|
108
|
+
body?: Statement | ModuleDeclaration | Expression;
|
|
109
|
+
references: unknown[];
|
|
110
|
+
async: boolean;
|
|
111
|
+
generator: boolean;
|
|
112
|
+
strict: boolean;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function splitModule(input: string): Cell[] {
|
|
116
|
+
return (ModuleParser as any)
|
|
117
|
+
.parse(input, { ecmaVersion: "latest" })
|
|
118
|
+
.cells.map((cell: any) => ({
|
|
119
|
+
type: "Cell",
|
|
120
|
+
text: input.substring(cell.start, cell.end),
|
|
121
|
+
start: cell.start,
|
|
122
|
+
end: cell.end
|
|
123
|
+
}));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export {
|
|
127
|
+
Node,
|
|
128
|
+
ancestor,
|
|
129
|
+
AncestorVisitors
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export function parseCell(input: string): Cell {
|
|
133
|
+
return ohqParseCell(input);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export const walk: RecursiveVisitors<any> = ohqWalk;
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
export namespace ohq {
|
|
2
|
+
|
|
3
|
+
// ObservableHQ Notebook Format ---
|
|
4
|
+
export interface Owner {
|
|
5
|
+
id?: string;
|
|
6
|
+
github_login?: string;
|
|
7
|
+
avatar_url?: string;
|
|
8
|
+
login?: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
bio?: string;
|
|
11
|
+
home_url?: string;
|
|
12
|
+
type?: string;
|
|
13
|
+
tier?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface Creator {
|
|
17
|
+
id?: string;
|
|
18
|
+
github_login?: string;
|
|
19
|
+
avatar_url?: string;
|
|
20
|
+
login?: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
bio?: string;
|
|
23
|
+
home_url?: string;
|
|
24
|
+
tier?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface Author {
|
|
28
|
+
id?: string;
|
|
29
|
+
avatar_url?: string;
|
|
30
|
+
name?: string;
|
|
31
|
+
login?: string;
|
|
32
|
+
bio?: string;
|
|
33
|
+
home_url?: string;
|
|
34
|
+
github_login?: string;
|
|
35
|
+
tier?: string;
|
|
36
|
+
approved?: boolean;
|
|
37
|
+
description?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface Owner2 {
|
|
41
|
+
id?: string;
|
|
42
|
+
github_login?: string;
|
|
43
|
+
avatar_url?: string;
|
|
44
|
+
login?: string;
|
|
45
|
+
name?: string;
|
|
46
|
+
bio?: string;
|
|
47
|
+
home_url?: string;
|
|
48
|
+
type?: string;
|
|
49
|
+
tier?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface Collection {
|
|
53
|
+
id?: string;
|
|
54
|
+
type?: string;
|
|
55
|
+
slug?: string;
|
|
56
|
+
title?: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
update_time?: Date;
|
|
59
|
+
pinned?: boolean;
|
|
60
|
+
ordered?: boolean;
|
|
61
|
+
custom_thumbnail?: any;
|
|
62
|
+
default_thumbnail?: string;
|
|
63
|
+
thumbnail?: string;
|
|
64
|
+
listing_count?: number;
|
|
65
|
+
parent_collection_count?: number;
|
|
66
|
+
owner?: Owner2;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface File {
|
|
70
|
+
id?: string;
|
|
71
|
+
url: string;
|
|
72
|
+
download_url?: string;
|
|
73
|
+
name: string;
|
|
74
|
+
create_time?: Date;
|
|
75
|
+
status?: string;
|
|
76
|
+
size?: number;
|
|
77
|
+
mime_type?: string;
|
|
78
|
+
content_encoding?: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface User {
|
|
82
|
+
id?: string;
|
|
83
|
+
github_login?: string;
|
|
84
|
+
avatar_url?: string;
|
|
85
|
+
login?: string;
|
|
86
|
+
name?: string;
|
|
87
|
+
bio?: string;
|
|
88
|
+
home_url?: string;
|
|
89
|
+
tier?: string;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export interface Comment {
|
|
93
|
+
id?: string;
|
|
94
|
+
content?: string;
|
|
95
|
+
node_id?: number;
|
|
96
|
+
create_time?: Date;
|
|
97
|
+
update_time?: any;
|
|
98
|
+
resolved?: boolean;
|
|
99
|
+
user?: User;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface Node {
|
|
103
|
+
id: string | number;
|
|
104
|
+
mode: string;
|
|
105
|
+
value: string;
|
|
106
|
+
pinned?: boolean; // Show source code?
|
|
107
|
+
data?: any;
|
|
108
|
+
name?: string;
|
|
109
|
+
// NodeEx ---
|
|
110
|
+
start?: number;
|
|
111
|
+
end?: number;
|
|
112
|
+
private?: boolean;
|
|
113
|
+
outputs?: string[];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface Notebook {
|
|
117
|
+
id?: string;
|
|
118
|
+
slug?: any;
|
|
119
|
+
trashed?: boolean;
|
|
120
|
+
description?: string;
|
|
121
|
+
likes?: number;
|
|
122
|
+
publish_level?: string;
|
|
123
|
+
forks?: number;
|
|
124
|
+
fork_of?: any;
|
|
125
|
+
update_time?: Date;
|
|
126
|
+
publish_time?: Date;
|
|
127
|
+
publish_version?: number;
|
|
128
|
+
latest_version?: number;
|
|
129
|
+
thumbnail?: string;
|
|
130
|
+
default_thumbnail?: string;
|
|
131
|
+
roles?: any[];
|
|
132
|
+
sharing?: any;
|
|
133
|
+
owner?: Owner;
|
|
134
|
+
creator?: Creator;
|
|
135
|
+
authors?: Author[];
|
|
136
|
+
collections?: Collection[];
|
|
137
|
+
files: File[];
|
|
138
|
+
comments?: Comment[];
|
|
139
|
+
commenting_lock?: any;
|
|
140
|
+
suggestion_from?: any;
|
|
141
|
+
suggestions_to?: any[];
|
|
142
|
+
version?: number;
|
|
143
|
+
title?: string;
|
|
144
|
+
license?: string;
|
|
145
|
+
copyright?: string;
|
|
146
|
+
nodes: Node[];
|
|
147
|
+
resolutions?: any[];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// @observablehq/runtime API ---
|
|
151
|
+
export type InspectorFactory = (name?: string) => Inspector;
|
|
152
|
+
|
|
153
|
+
export interface Inspector {
|
|
154
|
+
_node?: HTMLDivElement;
|
|
155
|
+
pending();
|
|
156
|
+
fulfilled(value);
|
|
157
|
+
rejected(error);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface Runtime {
|
|
161
|
+
fileAttachments(func: (name: string) => ohq.File): any;
|
|
162
|
+
module(define?, inspector?: InspectorFactory): Module;
|
|
163
|
+
dispose(): void;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface Module {
|
|
167
|
+
derive(specifiers: string[] | { name: string, alias: string }[], source: any);
|
|
168
|
+
import(name: string, alias: string | undefined, mod: Module): Variable;
|
|
169
|
+
builtin(name: string, _: any);
|
|
170
|
+
variable(inspector?: Inspector): Variable;
|
|
171
|
+
value(name: string): Promise<any>;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface Variable {
|
|
175
|
+
delete();
|
|
176
|
+
define(name?: string, inputs?: string[], definition?: any);
|
|
177
|
+
import(name: string, otherModule: ohq.Module);
|
|
178
|
+
import(name: string, alias: string, otherModule: ohq.Module);
|
|
179
|
+
}
|
|
180
|
+
}
|
package/src/util.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ohq } from "
|
|
2
|
-
import { parseCell, splitModule } from "
|
|
1
|
+
import type { ohq } from "./observable-shim.ts";
|
|
2
|
+
import { parseCell, splitModule } from "./observable-shim.ts";
|
|
3
3
|
|
|
4
4
|
const FuncTypes = {
|
|
5
5
|
functionType: Object.getPrototypeOf(function () { }).constructor,
|
package/src/writer.ts
CHANGED
package/types/compiler.d.ts
CHANGED
package/types/index.d.ts
CHANGED
package/types/parse.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Statement, ModuleDeclaration, Expression as ExpressionBase, Node } from "acorn";
|
|
2
|
+
import { ancestor, RecursiveVisitors, AncestorVisitors } from "acorn-walk";
|
|
3
|
+
export interface MutableExpression extends Node {
|
|
4
|
+
type: "MutableExpression";
|
|
5
|
+
}
|
|
6
|
+
export interface ViewExpression extends Node {
|
|
7
|
+
type: "ViewExpression";
|
|
8
|
+
}
|
|
9
|
+
export type Expression = ExpressionBase | MutableExpression | ViewExpression;
|
|
10
|
+
export declare function parseModule(input: any, { globals }?: {
|
|
11
|
+
globals: any;
|
|
12
|
+
}): any;
|
|
13
|
+
export interface Cell extends Node {
|
|
14
|
+
type: "Cell";
|
|
15
|
+
id: Expression;
|
|
16
|
+
text: string;
|
|
17
|
+
body?: Statement | ModuleDeclaration | Expression;
|
|
18
|
+
references: unknown[];
|
|
19
|
+
async: boolean;
|
|
20
|
+
generator: boolean;
|
|
21
|
+
strict: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare function splitModule(input: string): Cell[];
|
|
24
|
+
export { Node, ancestor, AncestorVisitors };
|
|
25
|
+
export declare function parseCell(input: string): Cell;
|
|
26
|
+
export declare const walk: RecursiveVisitors<any>;
|
package/types/types.d.ts
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
export declare namespace ohq {
|
|
2
|
+
interface Owner {
|
|
3
|
+
id?: string;
|
|
4
|
+
github_login?: string;
|
|
5
|
+
avatar_url?: string;
|
|
6
|
+
login?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
bio?: string;
|
|
9
|
+
home_url?: string;
|
|
10
|
+
type?: string;
|
|
11
|
+
tier?: string;
|
|
12
|
+
}
|
|
13
|
+
interface Creator {
|
|
14
|
+
id?: string;
|
|
15
|
+
github_login?: string;
|
|
16
|
+
avatar_url?: string;
|
|
17
|
+
login?: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
bio?: string;
|
|
20
|
+
home_url?: string;
|
|
21
|
+
tier?: string;
|
|
22
|
+
}
|
|
23
|
+
interface Author {
|
|
24
|
+
id?: string;
|
|
25
|
+
avatar_url?: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
login?: string;
|
|
28
|
+
bio?: string;
|
|
29
|
+
home_url?: string;
|
|
30
|
+
github_login?: string;
|
|
31
|
+
tier?: string;
|
|
32
|
+
approved?: boolean;
|
|
33
|
+
description?: string;
|
|
34
|
+
}
|
|
35
|
+
interface Owner2 {
|
|
36
|
+
id?: string;
|
|
37
|
+
github_login?: string;
|
|
38
|
+
avatar_url?: string;
|
|
39
|
+
login?: string;
|
|
40
|
+
name?: string;
|
|
41
|
+
bio?: string;
|
|
42
|
+
home_url?: string;
|
|
43
|
+
type?: string;
|
|
44
|
+
tier?: string;
|
|
45
|
+
}
|
|
46
|
+
interface Collection {
|
|
47
|
+
id?: string;
|
|
48
|
+
type?: string;
|
|
49
|
+
slug?: string;
|
|
50
|
+
title?: string;
|
|
51
|
+
description?: string;
|
|
52
|
+
update_time?: Date;
|
|
53
|
+
pinned?: boolean;
|
|
54
|
+
ordered?: boolean;
|
|
55
|
+
custom_thumbnail?: any;
|
|
56
|
+
default_thumbnail?: string;
|
|
57
|
+
thumbnail?: string;
|
|
58
|
+
listing_count?: number;
|
|
59
|
+
parent_collection_count?: number;
|
|
60
|
+
owner?: Owner2;
|
|
61
|
+
}
|
|
62
|
+
interface File {
|
|
63
|
+
id?: string;
|
|
64
|
+
url: string;
|
|
65
|
+
download_url?: string;
|
|
66
|
+
name: string;
|
|
67
|
+
create_time?: Date;
|
|
68
|
+
status?: string;
|
|
69
|
+
size?: number;
|
|
70
|
+
mime_type?: string;
|
|
71
|
+
content_encoding?: string;
|
|
72
|
+
}
|
|
73
|
+
interface User {
|
|
74
|
+
id?: string;
|
|
75
|
+
github_login?: string;
|
|
76
|
+
avatar_url?: string;
|
|
77
|
+
login?: string;
|
|
78
|
+
name?: string;
|
|
79
|
+
bio?: string;
|
|
80
|
+
home_url?: string;
|
|
81
|
+
tier?: string;
|
|
82
|
+
}
|
|
83
|
+
interface Comment {
|
|
84
|
+
id?: string;
|
|
85
|
+
content?: string;
|
|
86
|
+
node_id?: number;
|
|
87
|
+
create_time?: Date;
|
|
88
|
+
update_time?: any;
|
|
89
|
+
resolved?: boolean;
|
|
90
|
+
user?: User;
|
|
91
|
+
}
|
|
92
|
+
interface Node {
|
|
93
|
+
id: string | number;
|
|
94
|
+
mode: string;
|
|
95
|
+
value: string;
|
|
96
|
+
pinned?: boolean;
|
|
97
|
+
data?: any;
|
|
98
|
+
name?: string;
|
|
99
|
+
start?: number;
|
|
100
|
+
end?: number;
|
|
101
|
+
private?: boolean;
|
|
102
|
+
outputs?: string[];
|
|
103
|
+
}
|
|
104
|
+
interface Notebook {
|
|
105
|
+
id?: string;
|
|
106
|
+
slug?: any;
|
|
107
|
+
trashed?: boolean;
|
|
108
|
+
description?: string;
|
|
109
|
+
likes?: number;
|
|
110
|
+
publish_level?: string;
|
|
111
|
+
forks?: number;
|
|
112
|
+
fork_of?: any;
|
|
113
|
+
update_time?: Date;
|
|
114
|
+
publish_time?: Date;
|
|
115
|
+
publish_version?: number;
|
|
116
|
+
latest_version?: number;
|
|
117
|
+
thumbnail?: string;
|
|
118
|
+
default_thumbnail?: string;
|
|
119
|
+
roles?: any[];
|
|
120
|
+
sharing?: any;
|
|
121
|
+
owner?: Owner;
|
|
122
|
+
creator?: Creator;
|
|
123
|
+
authors?: Author[];
|
|
124
|
+
collections?: Collection[];
|
|
125
|
+
files: File[];
|
|
126
|
+
comments?: Comment[];
|
|
127
|
+
commenting_lock?: any;
|
|
128
|
+
suggestion_from?: any;
|
|
129
|
+
suggestions_to?: any[];
|
|
130
|
+
version?: number;
|
|
131
|
+
title?: string;
|
|
132
|
+
license?: string;
|
|
133
|
+
copyright?: string;
|
|
134
|
+
nodes: Node[];
|
|
135
|
+
resolutions?: any[];
|
|
136
|
+
}
|
|
137
|
+
type InspectorFactory = (name?: string) => Inspector;
|
|
138
|
+
interface Inspector {
|
|
139
|
+
_node?: HTMLDivElement;
|
|
140
|
+
pending(): any;
|
|
141
|
+
fulfilled(value: any): any;
|
|
142
|
+
rejected(error: any): any;
|
|
143
|
+
}
|
|
144
|
+
interface Runtime {
|
|
145
|
+
fileAttachments(func: (name: string) => ohq.File): any;
|
|
146
|
+
module(define?: any, inspector?: InspectorFactory): Module;
|
|
147
|
+
dispose(): void;
|
|
148
|
+
}
|
|
149
|
+
interface Module {
|
|
150
|
+
derive(specifiers: string[] | {
|
|
151
|
+
name: string;
|
|
152
|
+
alias: string;
|
|
153
|
+
}[], source: any): any;
|
|
154
|
+
import(name: string, alias: string | undefined, mod: Module): Variable;
|
|
155
|
+
builtin(name: string, _: any): any;
|
|
156
|
+
variable(inspector?: Inspector): Variable;
|
|
157
|
+
value(name: string): Promise<any>;
|
|
158
|
+
}
|
|
159
|
+
interface Variable {
|
|
160
|
+
delete(): any;
|
|
161
|
+
define(name?: string, inputs?: string[], definition?: any): any;
|
|
162
|
+
import(name: string, otherModule: ohq.Module): any;
|
|
163
|
+
import(name: string, alias: string, otherModule: ohq.Module): any;
|
|
164
|
+
}
|
|
165
|
+
}
|
package/types/util.d.ts
CHANGED
package/types/writer.d.ts
CHANGED