Skip to content

Commit

Permalink
upgrade npm-module
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Nov 3, 2024
1 parent 6152d6f commit c5034ce
Show file tree
Hide file tree
Showing 19 changed files with 5,812 additions and 17,301 deletions.
23 changes: 23 additions & 0 deletions help/en-US/components/actions/SetColorTheme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# DESCRIPTION

Changes the active color theme.

# PROPERTIES

## Theme

The name of the theme to became active.

# INPUTS

## seqin

A standard sequence input.

# OUTPUTS

## seqout

A standard sequence output.

# EXAMPLES [EMPTY]
5 changes: 4 additions & 1 deletion npm-module-publish.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const fse = require("fs-extra");
const path = require("path");
const { spawn } = require("child_process");

const FOLDERS = ["packages", "libs", "resources"];
Expand All @@ -10,11 +11,12 @@ for (const folder of FOLDERS) {
console.log(`Remove npm-module/packages/project-editor/flow/runtime/cpp ...`);
fse.removeSync(`npm-module/packages/project-editor/flow/runtime/cpp`);

/*
console.log("Spawn npm publish ...");
const dir = spawn(
process.platform == "win32" ? "npm.cmd" : "npm",
["publish"],
{ cwd: __dirname + "/npm-module" }
{ cwd: __dirname + path.sep + "npm-module", shell: true }
);
dir.stdout.on("data", data => console.log(data.toString()));
Expand All @@ -28,3 +30,4 @@ dir.on("close", code => {
fse.removeSync(`npm-module/${folder}`);
}
});
*/
2 changes: 1 addition & 1 deletion npm-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "Envox <[email protected]>",
"description": "EEZ Studio for building standalone dashboard applications",
"repository": "https://github.com/eez-open/studio",
"version": "0.0.51",
"version": "0.0.54",
"revision": "1",
"license": "GPL-3.0-only",
"files": ["packages", "libs", "resources"]
Expand Down
22,867 changes: 5,677 additions & 17,190 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@
"@types/opentype.js": "^1.3.3",
"@types/pg": "^8.6.5",
"@types/plotly.js-dist-min": "^2.3.4",
"@types/react": "^18.0.21",
"@types/react": "^18.2.0",
"@types/react-color": "^3.0.6",
"@types/react-dom": "^18.0.6",
"@types/react-dom": "^18.2.0",
"@types/react-virtualized-auto-sizer": "^1.0.1",
"@types/react-window": "^1.8.5",
"@types/request": "^2.48.8",
Expand Down
48 changes: 25 additions & 23 deletions packages/eez-studio-shared/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ export class InstrumentDatabase implements MainSettingsModule.IDbPath {
try {
db = new DatabaseConstructor(this.filePath);

const result = db.prepare("SELECT description FROM settings").get();
const result = db
.prepare("SELECT description FROM settings")
.get() as any;

if (result != undefined) {
return result.description;
Expand Down Expand Up @@ -143,7 +145,7 @@ async function createTables(db: Database) {
.prepare(
`SELECT * FROM versions WHERE tableName = '${store.store.storeName}'`
)
.get();
.get() as any;
if (versionRow !== undefined) {
version = versionRow.version;
}
Expand Down Expand Up @@ -340,8 +342,8 @@ class InstrumentDatabases {
`SELECT DISTINCT(oid) AS oid FROM activityLog ${logsQueryCondition}`
)
.all()
.filter(row => row.oid != null)
.map(row => row.oid.toString());
.filter((row: any) => row.oid != null)
.map((row: any) => row.oid.toString());
} else if (conf.mode == "shortcuts") {
instrumentIds = [];
} else {
Expand All @@ -353,7 +355,7 @@ class InstrumentDatabases {
","
)})`
)
.all();
.all() as any;

// get source sessions
let sessionIds: string[];
Expand All @@ -365,8 +367,8 @@ class InstrumentDatabases {
`SELECT DISTINCT(sid) AS sid FROM activityLog ${logsQueryCondition}`
)
.all()
.filter(row => row.sid != null)
.map(row => row.sid.toString());
.filter((row: any) => row.sid != null)
.map((row: any) => row.sid.toString());
} else if (conf.mode == "shortcuts") {
sessionIds = [];
} else {
Expand All @@ -378,7 +380,7 @@ class InstrumentDatabases {
","
)})`
)
.all();
.all() as any;

// get source shortcuts
let sourceShortcuts;
Expand All @@ -389,15 +391,15 @@ class InstrumentDatabases {
","
)})`
)
.all();
.all() as any;
} else {
sourceShortcuts = sourceDb
.prepare(
`SELECT * FROM "shortcuts/shortcuts" WHERE "groupName" IN (${instrumentIds
.map(id => `'__instrument__${id}'`)
.join(",")})`
)
.all();
.all() as any;
}

// insert destination instrument
Expand Down Expand Up @@ -461,7 +463,7 @@ class InstrumentDatabases {
.prepare(
`SELECT * FROM "history/sessions" WHERE uuid = ?`
)
.get([sourceSession.uuid]);
.get([sourceSession.uuid]) as any;
if (destinationSession) {
mapSourceSessionToDestSessionId.set(
BigInt(sourceSession.id),
Expand Down Expand Up @@ -562,7 +564,7 @@ class InstrumentDatabases {
.prepare(
`SELECT count(*) as count FROM activityLog ${logsQueryCondition}`
)
.get();
.get() as any;

const CHUNK = 100;
let offset = 0;
Expand All @@ -572,7 +574,7 @@ class InstrumentDatabases {
.prepare(
`SELECT * FROM activityLog ${logsQueryCondition} limit ${CHUNK} offset ${offset}`
)
.all();
.all() as any;

if (logs.length == 0) {
break;
Expand All @@ -590,15 +592,15 @@ class InstrumentDatabases {
`INSERT INTO activityLog (oid, sid, ${logColumns.join(
","
)}) VALUES ${logs.map(
log =>
(log: any) =>
`(?, ?, ${logColumns!
.map(() => "?")
.join(",")})`
)}`
)
.run(
logs.reduce(
(arr, log) => [
(arr: any, log: any) => [
...arr,
mapSourceInstrumentToDestInstrumentId.get(
BigInt(log.oid)
Expand Down Expand Up @@ -681,7 +683,7 @@ class InstrumentDatabases {
// get source instrument
const sourceInstruments = sourceDb
.prepare("SELECT * FROM instrument")
.all();
.all() as any;

await pause();

Expand All @@ -706,21 +708,21 @@ class InstrumentDatabases {

const logsCountRow = sourceDb
.prepare("SELECT count(*) as count FROM activityLog")
.get();
.get() as any;

await pause();

// get source sessions
const sourceSessions = sourceDb
.prepare(`SELECT * FROM "history/sessions"`)
.all();
.all() as any;

await pause();

// get source shortcuts
const sourceShortcuts = sourceDb
.prepare(`SELECT * FROM "shortcuts/shortcuts"`)
.all();
.all() as any;

await pause();

Expand Down Expand Up @@ -773,7 +775,7 @@ class InstrumentDatabases {
.prepare(
`SELECT * FROM "history/sessions" WHERE uuid = ?`
)
.get([sourceSession.uuid]);
.get([sourceSession.uuid]) as any;
if (destinationSession) {
mapSourceSessionToDestSessionId.set(
BigInt(sourceSession.id),
Expand Down Expand Up @@ -895,7 +897,7 @@ class InstrumentDatabases {
.prepare(
`SELECT * FROM activityLog ORDER BY date ASC limit ${CHUNK} offset ${offset}`
)
.all();
.all() as any;

if (logs.length == 0) {
break;
Expand All @@ -913,15 +915,15 @@ class InstrumentDatabases {
`INSERT INTO activityLog (oid, sid, ${logColumns.join(
","
)}) VALUES ${logs.map(
log =>
(log: any) =>
`(?, ?, ${logColumns!
.map(() => "?")
.join(",")})`
)}`
)
.run(
logs.reduce(
(arr, log) => [
(arr: any, log: any) => [
...arr,
mapSourceInstrumentToDestInstrumentId.get(
BigInt(log.oid)
Expand Down
2 changes: 1 addition & 1 deletion packages/home/instruments/deleted-instruments-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const DeletedInstrumentsDialog = observer(
.prepare(
`SELECT * FROM "activityLog" WHERE oid=? AND type='instrument/created'`
)
.get(instrument.id);
.get(instrument.id) as any;
creationDate = new Date(Number(result.date));
} catch (err) {
// console.error(err);
Expand Down
6 changes: 3 additions & 3 deletions packages/home/instruments/import-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ const ImportDialog = observer(

try {
const db = new Database(this.props.filePath);
description = db
.prepare("SELECT description FROM settings")
.get().description;
description = (
db.prepare("SELECT description FROM settings").get() as any
).description;
} catch (e) {
description = "Failed to read description";
className = "text-danger";
Expand Down
7 changes: 3 additions & 4 deletions packages/instrument/connection/plotter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class Plotter implements LongOperation {
activityLogStore.storeName
} WHERE id IN(${answerIds.join(",")}) ORDER BY date ASC`
)
.all();
.all() as any;

if (result.length == 0) {
return;
Expand Down Expand Up @@ -185,8 +185,7 @@ export class Plotter implements LongOperation {

// keep data length up to this.maxNumPoints
if (this.numPoints == this.maxNumPoints) {
this.dataBuffer.copyWithin(
0,
this.dataBuffer = this.dataBuffer.subarray(
8 * (1 + this.variableNames.length)
);
this.numPoints = this.maxNumPoints - 1;
Expand Down Expand Up @@ -315,7 +314,7 @@ export class Plotter implements LongOperation {
.prepare(
`SELECT "recordHistory" FROM "instrument" WHERE id = ?`
)
.get(this.instrument.id);
.get(this.instrument.id) as any;
if (!row.recordHistory) {
temporary = true;
}
Expand Down
4 changes: 3 additions & 1 deletion packages/instrument/instrument-object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,9 @@ export const store = createStore({
(db: Database) => {
db.exec(`ALTER TABLE instrument ADD COLUMN uuid TEXT`);

const instruments = db.prepare(`SELECT * FROM instrument`).all();
const instruments = db
.prepare(`SELECT * FROM instrument`)
.all() as any;
for (const instrument of instruments) {
db.exec(
`UPDATE instrument set uuid='${guid()}' WHERE id=${
Expand Down
8 changes: 4 additions & 4 deletions packages/instrument/window/history/activity-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export const activityLogStore = createStore({
() => {
const sessions = db
.prepare(`SELECT * FROM "history/sessions"`)
.all();
.all() as any;
for (const session of sessions) {
db.exec(
`UPDATE "history/sessions" set uuid='${guid()}' WHERE id=${
Expand Down Expand Up @@ -465,7 +465,7 @@ export function log(
.prepare(
`SELECT "recordHistory" FROM "instrument" WHERE id = ?`
)
.get(activityLogEntry.oid);
.get(activityLogEntry.oid) as any;
activityLogEntry.temporary = row
? row.recordHistory
? false
Expand All @@ -492,7 +492,7 @@ export function log(
.prepare(
`SELECT * FROM "${store.storeName}" WHERE temporary ORDER BY date DESC`
)
.all();
.all() as any;
if (rows && rows.length > LAST_N) {
rows.slice(LAST_N).forEach(row => {
store.deleteObject(
Expand Down Expand Up @@ -538,7 +538,7 @@ export function loadData(store: IStore, id: string) {
try {
let result = db
.prepare(`SELECT data FROM "${store.storeName}" WHERE id = ?`)
.get(id);
.get(id) as any;
const data = result && result.data;
if (typeof data === "string") {
return Buffer.from(data, "binary");
Expand Down
6 changes: 3 additions & 3 deletions packages/instrument/window/history/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ class HistoryNavigator {
this.history.oidWhereClause
} AND date < ? ${this.history.getFilter()}`
)
.get(this.firstHistoryItemTime);
.get(this.firstHistoryItemTime) as any;

this.hasOlder = result && Number(result.count) > 0;
} else {
Expand Down Expand Up @@ -731,7 +731,7 @@ class HistoryNavigator {
this.history.oidWhereClause
} AND date > ? ${this.history.getFilter()}`
)
.get(this.lastHistoryItemTime);
.get(this.lastHistoryItemTime) as any;

this.hasNewer = result && Number(result.count) > 0;
} else {
Expand Down Expand Up @@ -1610,7 +1610,7 @@ export class DeletedItemsHistory extends History {
WHERE
${this.oidWhereClause} AND deleted`
)
.get();
.get() as any;

runInAction(() => {
this.deletedCount = result ? Number(result.count) : 0;
Expand Down
Loading

0 comments on commit c5034ce

Please sign in to comment.