mindsim 0.1.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/.github/workflows/publish.yml +32 -0
- package/.github/workflows/test.yml +28 -0
- package/.github/workflows/type-checks.yml +29 -0
- package/LICENSE +21 -0
- package/README.md +748 -0
- package/assets/mindsim-logo.svg +15 -0
- package/biome.jsonc +43 -0
- package/dist/auth.d.ts +5 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +115 -0
- package/dist/auth.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +36 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +63 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/artifacts.d.ts +8 -0
- package/dist/resources/artifacts.d.ts.map +1 -0
- package/dist/resources/artifacts.js +17 -0
- package/dist/resources/artifacts.js.map +1 -0
- package/dist/resources/minds.d.ts +39 -0
- package/dist/resources/minds.d.ts.map +1 -0
- package/dist/resources/minds.js +85 -0
- package/dist/resources/minds.js.map +1 -0
- package/dist/resources/psychometrics.d.ts +11 -0
- package/dist/resources/psychometrics.d.ts.map +1 -0
- package/dist/resources/psychometrics.js +18 -0
- package/dist/resources/psychometrics.js.map +1 -0
- package/dist/resources/simulations.d.ts +26 -0
- package/dist/resources/simulations.d.ts.map +1 -0
- package/dist/resources/simulations.js +41 -0
- package/dist/resources/simulations.js.map +1 -0
- package/dist/resources/snapshots.d.ts +27 -0
- package/dist/resources/snapshots.d.ts.map +1 -0
- package/dist/resources/snapshots.js +101 -0
- package/dist/resources/snapshots.js.map +1 -0
- package/dist/resources/tags.d.ts +23 -0
- package/dist/resources/tags.d.ts.map +1 -0
- package/dist/resources/tags.js +32 -0
- package/dist/resources/tags.js.map +1 -0
- package/dist/types.d.ts +161 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +15 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +105 -0
- package/dist/version.js.map +1 -0
- package/package.json +55 -0
- package/src/auth.ts +131 -0
- package/src/cli.ts +41 -0
- package/src/config.ts +60 -0
- package/src/index.ts +59 -0
- package/src/resources/artifacts.ts +13 -0
- package/src/resources/minds.ts +98 -0
- package/src/resources/psychometrics.ts +16 -0
- package/src/resources/simulations.ts +49 -0
- package/src/resources/snapshots.ts +126 -0
- package/src/resources/tags.ts +30 -0
- package/src/types.ts +185 -0
- package/src/version.ts +111 -0
- package/tests/auth.test.ts +41 -0
- package/tests/config.test.ts +129 -0
- package/tests/resources/minds.test.ts +119 -0
- package/tests/resources/psychometrics.test.ts +38 -0
- package/tests/resources/simulation.test.ts +94 -0
- package/tests/resources/snapshots.test.ts +135 -0
- package/tests/resources/tags.test.ts +87 -0
- package/tests/use-cases/quickstart.test.ts +84 -0
- package/tests/version.test.ts +221 -0
- package/tsconfig.json +29 -0
- package/vitest.config.ts +12 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PsychometricsResource = void 0;
|
|
4
|
+
class PsychometricsResource {
|
|
5
|
+
client;
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get psychometrics for a specific snapshot
|
|
11
|
+
*/
|
|
12
|
+
async get(snapshotId) {
|
|
13
|
+
const response = await this.client.get(`/snapshots/${snapshotId}/psychometrics`);
|
|
14
|
+
return response.data;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.PsychometricsResource = PsychometricsResource;
|
|
18
|
+
//# sourceMappingURL=psychometrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"psychometrics.js","sourceRoot":"","sources":["../../src/resources/psychometrics.ts"],"names":[],"mappings":";;;AAGA,MAAa,qBAAqB;IACZ;IAApB,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,UAAkB;QAC1B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CACpC,cAAc,UAAU,gBAAgB,CACzC,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AAZD,sDAYC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AxiosInstance } from "axios";
|
|
2
|
+
import type { GetSimulationResponse, ListSimulationsParams, ListSimulationsResponse, RunSimulationRequest, SimulationResponse } from "../types";
|
|
3
|
+
export declare class SimulationsResource {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: AxiosInstance);
|
|
6
|
+
/**
|
|
7
|
+
* Run simulation
|
|
8
|
+
*/
|
|
9
|
+
run(data: RunSimulationRequest): Promise<SimulationResponse>;
|
|
10
|
+
/**
|
|
11
|
+
* List historical simulations
|
|
12
|
+
*/
|
|
13
|
+
list(params?: ListSimulationsParams): Promise<ListSimulationsResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Get a specific simulation by ID
|
|
16
|
+
*/
|
|
17
|
+
get(simulationId: string): Promise<GetSimulationResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Delete a specific simulation by ID
|
|
20
|
+
*/
|
|
21
|
+
delete(simulationId: string): Promise<{
|
|
22
|
+
message: string;
|
|
23
|
+
simulationId: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=simulations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulations.d.ts","sourceRoot":"","sources":["../../src/resources/simulations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB,qBAAa,mBAAmB;IAClB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEzC;;OAEG;IACG,GAAG,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAKlE;;OAEG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAO5E;;OAEG;IACG,GAAG,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAK/D;;OAEG;IACG,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAC;CAOvF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SimulationsResource = void 0;
|
|
4
|
+
class SimulationsResource {
|
|
5
|
+
client;
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Run simulation
|
|
11
|
+
*/
|
|
12
|
+
async run(data) {
|
|
13
|
+
const response = await this.client.post("/simulate", data);
|
|
14
|
+
return response.data;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* List historical simulations
|
|
18
|
+
*/
|
|
19
|
+
async list(params) {
|
|
20
|
+
const response = await this.client.get("/simulations", {
|
|
21
|
+
params,
|
|
22
|
+
});
|
|
23
|
+
return response.data;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get a specific simulation by ID
|
|
27
|
+
*/
|
|
28
|
+
async get(simulationId) {
|
|
29
|
+
const response = await this.client.get(`/simulations/${simulationId}`);
|
|
30
|
+
return response.data;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Delete a specific simulation by ID
|
|
34
|
+
*/
|
|
35
|
+
async delete(simulationId) {
|
|
36
|
+
const response = await this.client.delete(`/simulations/${simulationId}`);
|
|
37
|
+
return response.data;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.SimulationsResource = SimulationsResource;
|
|
41
|
+
//# sourceMappingURL=simulations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simulations.js","sourceRoot":"","sources":["../../src/resources/simulations.ts"],"names":[],"mappings":";;;AASA,MAAa,mBAAmB;IACV;IAApB,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,IAA0B;QAClC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAqB,WAAW,EAAE,IAAI,CAAC,CAAC;QAC/E,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,MAA8B;QACvC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAA0B,cAAc,EAAE;YAC9E,MAAM;SACP,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,YAAoB;QAC5B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAwB,gBAAgB,YAAY,EAAE,CAAC,CAAC;QAC9F,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,YAAoB;QAC/B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAGtC,gBAAgB,YAAY,EAAE,CAAC,CAAC;QACnC,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AAvCD,kDAuCC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type AxiosInstance } from "axios";
|
|
2
|
+
import type { CreateSnapshotFromFileParams, CreateSnapshotParams, CreateSnapshotResponse, ListSnapshotsResponse, SnapshotStatus } from "../types";
|
|
3
|
+
export declare class SnapshotsResource {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: AxiosInstance);
|
|
6
|
+
/**
|
|
7
|
+
* Helper to infer content type from file extension
|
|
8
|
+
*/
|
|
9
|
+
private getContentType;
|
|
10
|
+
/**
|
|
11
|
+
* List all snapshots for a mind
|
|
12
|
+
*/
|
|
13
|
+
list(mindId: string): Promise<ListSnapshotsResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* Create a snapshot via a signed url. Recommended for large files.
|
|
16
|
+
*/
|
|
17
|
+
create(mindId: string, params: CreateSnapshotParams): Promise<CreateSnapshotResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Create snapshot from uploaded file
|
|
20
|
+
*/
|
|
21
|
+
createFromFile(mindId: string, params: CreateSnapshotFromFileParams): Promise<any>;
|
|
22
|
+
/**
|
|
23
|
+
* Check snapshot status
|
|
24
|
+
*/
|
|
25
|
+
getStatus(mindId: string, snapshotId: string): Promise<SnapshotStatus>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=snapshots.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshots.d.ts","sourceRoot":"","sources":["../../src/resources/snapshots.ts"],"names":[],"mappings":"AACA,OAAc,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAElD,OAAO,KAAK,EACV,4BAA4B,EAC5B,oBAAoB,EACpB,sBAAsB,EAEtB,qBAAqB,EACrB,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,qBAAa,iBAAiB;IAChB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEzC;;OAEG;IACH,OAAO,CAAC,cAAc;IAiBtB;;OAEG;IACG,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAK1D;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IA2C3F;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,4BAA4B;IAwBzE;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;CAM7E"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.SnapshotsResource = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path")); // Import path
|
|
8
|
+
const axios_1 = __importDefault(require("axios"));
|
|
9
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
10
|
+
class SnapshotsResource {
|
|
11
|
+
client;
|
|
12
|
+
constructor(client) {
|
|
13
|
+
this.client = client;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Helper to infer content type from file extension
|
|
17
|
+
*/
|
|
18
|
+
getContentType(fileName) {
|
|
19
|
+
const ext = node_path_1.default.extname(fileName).toLowerCase();
|
|
20
|
+
const mimeTypes = {
|
|
21
|
+
".html": "text/html",
|
|
22
|
+
".js": "text/javascript",
|
|
23
|
+
".css": "text/css",
|
|
24
|
+
".json": "application/json",
|
|
25
|
+
".pdf": "application/pdf",
|
|
26
|
+
".txt": "text/plain",
|
|
27
|
+
".vtt": "text/vtt",
|
|
28
|
+
".md": "text/markdown",
|
|
29
|
+
".docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
30
|
+
};
|
|
31
|
+
return mimeTypes[ext] || "application/octet-stream";
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* List all snapshots for a mind
|
|
35
|
+
*/
|
|
36
|
+
async list(mindId) {
|
|
37
|
+
const response = await this.client.get(`/minds/${mindId}/snapshots`);
|
|
38
|
+
return response.data;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Create a snapshot via a signed url. Recommended for large files.
|
|
42
|
+
*/
|
|
43
|
+
async create(mindId, params) {
|
|
44
|
+
const finalContentType = params.contentType || this.getContentType(params.fileName);
|
|
45
|
+
const signedUrlRes = await this.client.get(`/minds/${mindId}/signed-url`, {
|
|
46
|
+
params: {
|
|
47
|
+
fileName: params.fileName,
|
|
48
|
+
contentType: finalContentType,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
const { signedUrl, artifactId } = signedUrlRes.data;
|
|
52
|
+
await axios_1.default.put(signedUrl, params.file, {
|
|
53
|
+
headers: {
|
|
54
|
+
"Content-Type": finalContentType,
|
|
55
|
+
},
|
|
56
|
+
maxBodyLength: Infinity,
|
|
57
|
+
maxContentLength: Infinity,
|
|
58
|
+
});
|
|
59
|
+
const form = new form_data_1.default();
|
|
60
|
+
form.append("artifactId", artifactId);
|
|
61
|
+
if (params.mindsetDate) {
|
|
62
|
+
form.append("mindsetDate", params.mindsetDate);
|
|
63
|
+
}
|
|
64
|
+
const snapshotRes = await this.client.post(`/minds/${mindId}/snapshots`, form, {
|
|
65
|
+
headers: {
|
|
66
|
+
...form.getHeaders(),
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
return snapshotRes.data;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Create snapshot from uploaded file
|
|
73
|
+
*/
|
|
74
|
+
async createFromFile(mindId, params) {
|
|
75
|
+
const form = new form_data_1.default();
|
|
76
|
+
if (params.file) {
|
|
77
|
+
form.append("file", params.file, params.fileName || "upload.txt");
|
|
78
|
+
}
|
|
79
|
+
if (params.artifactId) {
|
|
80
|
+
form.append("artifactId", params.artifactId);
|
|
81
|
+
}
|
|
82
|
+
if (params.mindsetDate) {
|
|
83
|
+
form.append("mindsetDate", params.mindsetDate);
|
|
84
|
+
}
|
|
85
|
+
const response = await this.client.post(`/minds/${mindId}/snapshots`, form, {
|
|
86
|
+
headers: {
|
|
87
|
+
...form.getHeaders(), // Crucial for multipart/form-data in Node
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
return response.data;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Check snapshot status
|
|
94
|
+
*/
|
|
95
|
+
async getStatus(mindId, snapshotId) {
|
|
96
|
+
const response = await this.client.get(`/minds/${mindId}/snapshots/${snapshotId}/status`);
|
|
97
|
+
return response.data;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
exports.SnapshotsResource = SnapshotsResource;
|
|
101
|
+
//# sourceMappingURL=snapshots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshots.js","sourceRoot":"","sources":["../../src/resources/snapshots.ts"],"names":[],"mappings":";;;;;;AAAA,0DAA6B,CAAC,cAAc;AAC5C,kDAAkD;AAClD,0DAAiC;AAUjC,MAAa,iBAAiB;IACR;IAApB,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C;;OAEG;IACK,cAAc,CAAC,QAAgB;QACrC,MAAM,GAAG,GAAG,mBAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;QACjD,MAAM,SAAS,GAA2B;YACxC,OAAO,EAAE,WAAW;YACpB,KAAK,EAAE,iBAAiB;YACxB,MAAM,EAAE,UAAU;YAClB,OAAO,EAAE,kBAAkB;YAC3B,MAAM,EAAE,iBAAiB;YACzB,MAAM,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AiHC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AxiosInstance } from "axios";
|
|
2
|
+
import type { Tag } from "../types";
|
|
3
|
+
export declare class TagsResource {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: AxiosInstance);
|
|
6
|
+
/**
|
|
7
|
+
* List all tags
|
|
8
|
+
*/
|
|
9
|
+
list(): Promise<Tag[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Update tag
|
|
12
|
+
*/
|
|
13
|
+
update(tagId: string, data: {
|
|
14
|
+
name: string;
|
|
15
|
+
}): Promise<Tag>;
|
|
16
|
+
/**
|
|
17
|
+
* Delete tag
|
|
18
|
+
*/
|
|
19
|
+
delete(tagId: string): Promise<{
|
|
20
|
+
deleted: boolean;
|
|
21
|
+
}>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.d.ts","sourceRoot":"","sources":["../../src/resources/tags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAEpC,qBAAa,YAAY;IACX,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,aAAa;IAEzC;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAK5B;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAKjE;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;CAI3D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TagsResource = void 0;
|
|
4
|
+
class TagsResource {
|
|
5
|
+
client;
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* List all tags
|
|
11
|
+
*/
|
|
12
|
+
async list() {
|
|
13
|
+
const response = await this.client.get("/tags");
|
|
14
|
+
return response.data.tags;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Update tag
|
|
18
|
+
*/
|
|
19
|
+
async update(tagId, data) {
|
|
20
|
+
const response = await this.client.put(`/tags/${tagId}`, data);
|
|
21
|
+
return response.data.tag;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Delete tag
|
|
25
|
+
*/
|
|
26
|
+
async delete(tagId) {
|
|
27
|
+
const response = await this.client.delete(`/tags/${tagId}`);
|
|
28
|
+
return response.data;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.TagsResource = TagsResource;
|
|
32
|
+
//# sourceMappingURL=tags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tags.js","sourceRoot":"","sources":["../../src/resources/tags.ts"],"names":[],"mappings":";;;AAGA,MAAa,YAAY;IACH;IAApB,YAAoB,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE7C;;OAEG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAkB,OAAO,CAAC,CAAC;QACjE,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,KAAa,EAAE,IAAsB;QAChD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAe,SAAS,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC;QAC7E,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,KAAa;QACxB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAuB,SAAS,KAAK,EAAE,CAAC,CAAC;QAClF,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CACF;AA1BD,oCA0BC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
export interface AuthConfig {
|
|
2
|
+
authServerUrl: string;
|
|
3
|
+
authServerLandingPath: string;
|
|
4
|
+
authRedirectPath: string;
|
|
5
|
+
listenPort: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AuthResponse {
|
|
8
|
+
apiKey?: {
|
|
9
|
+
id: string;
|
|
10
|
+
key: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface Tag {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
organizationId?: string | null;
|
|
17
|
+
createdAt?: string;
|
|
18
|
+
updatedAt?: string;
|
|
19
|
+
mindCount?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface Mind {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
slug?: string | null;
|
|
25
|
+
email?: string | null;
|
|
26
|
+
imageUrl?: string | null;
|
|
27
|
+
socialMedia?: Record<string, any> | null;
|
|
28
|
+
scope: string;
|
|
29
|
+
isSelf: boolean;
|
|
30
|
+
organizationId?: string | null;
|
|
31
|
+
createdAt?: string;
|
|
32
|
+
updatedAt?: string;
|
|
33
|
+
tags: Tag[];
|
|
34
|
+
}
|
|
35
|
+
export interface CreateMindRequest {
|
|
36
|
+
name: string;
|
|
37
|
+
email?: string;
|
|
38
|
+
imageUrl?: string;
|
|
39
|
+
socialMedia?: Record<string, any>;
|
|
40
|
+
tags?: string[];
|
|
41
|
+
}
|
|
42
|
+
export interface UpdateMindRequest {
|
|
43
|
+
name?: string;
|
|
44
|
+
email?: string;
|
|
45
|
+
socialMedia?: Record<string, any>;
|
|
46
|
+
tags?: string[];
|
|
47
|
+
}
|
|
48
|
+
export interface SearchMindsParams {
|
|
49
|
+
query: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ListMindsParams {
|
|
52
|
+
tags?: string[];
|
|
53
|
+
}
|
|
54
|
+
export interface SimulationScenario {
|
|
55
|
+
message: string;
|
|
56
|
+
}
|
|
57
|
+
export interface RunSimulationRequest {
|
|
58
|
+
mindId: string;
|
|
59
|
+
scenario: SimulationScenario;
|
|
60
|
+
runInBackground?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface SimulationResponse {
|
|
63
|
+
message: string;
|
|
64
|
+
}
|
|
65
|
+
export interface SimulationMessage {
|
|
66
|
+
id: string;
|
|
67
|
+
role: "assistant" | "user" | "system";
|
|
68
|
+
content: {
|
|
69
|
+
text: string;
|
|
70
|
+
} | any;
|
|
71
|
+
status: string;
|
|
72
|
+
createdAt?: string;
|
|
73
|
+
}
|
|
74
|
+
export interface Simulation {
|
|
75
|
+
id: string;
|
|
76
|
+
userId: string;
|
|
77
|
+
title: string;
|
|
78
|
+
mindId?: string | null;
|
|
79
|
+
createdAt?: string;
|
|
80
|
+
updatedAt?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface GetSimulationResponse {
|
|
83
|
+
simulation: Simulation;
|
|
84
|
+
messages: SimulationMessage[];
|
|
85
|
+
}
|
|
86
|
+
export interface ListSimulationsParams {
|
|
87
|
+
offset?: number;
|
|
88
|
+
limit?: number;
|
|
89
|
+
}
|
|
90
|
+
export interface ListSimulationsResponse {
|
|
91
|
+
simulations: Simulation[];
|
|
92
|
+
count: number;
|
|
93
|
+
}
|
|
94
|
+
export interface GetSignedUrlParams {
|
|
95
|
+
fileName?: string;
|
|
96
|
+
contentType?: string;
|
|
97
|
+
}
|
|
98
|
+
export interface GetSignedUrlResponse {
|
|
99
|
+
signedUrl: string;
|
|
100
|
+
fileName: string;
|
|
101
|
+
artifactId: string;
|
|
102
|
+
contentType: string;
|
|
103
|
+
}
|
|
104
|
+
export interface CreateSnapshotParams {
|
|
105
|
+
file: Buffer | any;
|
|
106
|
+
fileName: string;
|
|
107
|
+
contentType: string;
|
|
108
|
+
mindsetDate?: string;
|
|
109
|
+
}
|
|
110
|
+
export interface CreateSnapshotFromFileParams {
|
|
111
|
+
file?: Buffer | any;
|
|
112
|
+
fileName?: string;
|
|
113
|
+
artifactId?: string;
|
|
114
|
+
mindsetDate?: string;
|
|
115
|
+
}
|
|
116
|
+
export interface CreateSnapshotResponse {
|
|
117
|
+
message: string;
|
|
118
|
+
mindAssessmentId: string;
|
|
119
|
+
artifactId: string;
|
|
120
|
+
}
|
|
121
|
+
export interface SnapshotStatus {
|
|
122
|
+
id: string;
|
|
123
|
+
mindId: string;
|
|
124
|
+
status: string;
|
|
125
|
+
startedAt?: string;
|
|
126
|
+
completedAt?: string;
|
|
127
|
+
}
|
|
128
|
+
export interface MindAssessment {
|
|
129
|
+
id: string;
|
|
130
|
+
mindId: string;
|
|
131
|
+
artifactId?: string | null;
|
|
132
|
+
mindsetDate?: string | null;
|
|
133
|
+
status: string;
|
|
134
|
+
startedAt?: string | null;
|
|
135
|
+
completedAt?: string | null;
|
|
136
|
+
createdAt?: string | null;
|
|
137
|
+
updatedAt?: string | null;
|
|
138
|
+
psychometricCount?: number | null;
|
|
139
|
+
keyTopicCount?: number | null;
|
|
140
|
+
findingCount?: number | null;
|
|
141
|
+
}
|
|
142
|
+
export interface ListSnapshotsResponse {
|
|
143
|
+
snapshots: MindAssessment[];
|
|
144
|
+
count: number;
|
|
145
|
+
}
|
|
146
|
+
export interface PersonDetails {
|
|
147
|
+
id: string;
|
|
148
|
+
slug?: string | null;
|
|
149
|
+
name: string;
|
|
150
|
+
imageUrl?: string | null;
|
|
151
|
+
mindDate: string;
|
|
152
|
+
mindAssesssmentId: string;
|
|
153
|
+
}
|
|
154
|
+
export interface GetPsychometricsResponse {
|
|
155
|
+
personDetails: PersonDetails;
|
|
156
|
+
dimensionAnalysis?: Record<string, any> | null;
|
|
157
|
+
metaAnalysis?: Record<string, any> | null;
|
|
158
|
+
topicsSentimentSummary?: Record<string, any> | null;
|
|
159
|
+
mindReasonerStopError?: any | null;
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE;QACP,EAAE,EAAE,MAAM,CAAC;QACX,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,CAA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I,CAAC;IAC/C,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IAC1C,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;IACpD,qBAAqB,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC;CACpC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REUSABLE VERSION EXTRACTOR
|
|
3
|
+
* Reads the version directly from the SDK's package.json
|
|
4
|
+
*/
|
|
5
|
+
export declare const getPackageVersion: () => string;
|
|
6
|
+
/**
|
|
7
|
+
* Checks NPM registry for updates and logs a warning if outdated.
|
|
8
|
+
* @param verbose If true, logs when the version is up to date (useful for CLI 'version' command)
|
|
9
|
+
*/
|
|
10
|
+
export declare const checkForUpdates: (verbose?: boolean) => Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Auto-updates the SDK using npm
|
|
13
|
+
*/
|
|
14
|
+
export declare const updateSdk: () => Promise<void>;
|
|
15
|
+
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,QAAO,MAqBpC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAU,iBAAe,KAAG,OAAO,CAAC,IAAI,CAiCnE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,QAAa,OAAO,CAAC,IAAI,CA6B9C,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.updateSdk = exports.checkForUpdates = exports.getPackageVersion = void 0;
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const node_util_1 = require("node:util");
|
|
11
|
+
const axios_1 = __importDefault(require("axios"));
|
|
12
|
+
const semver_1 = __importDefault(require("semver"));
|
|
13
|
+
const execAsync = (0, node_util_1.promisify)(node_child_process_1.exec);
|
|
14
|
+
const PACKAGE_NAME = "@mindsim/mindsim-sdk-typescript";
|
|
15
|
+
const REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}`;
|
|
16
|
+
/**
|
|
17
|
+
* REUSABLE VERSION EXTRACTOR
|
|
18
|
+
* Reads the version directly from the SDK's package.json
|
|
19
|
+
*/
|
|
20
|
+
const getPackageVersion = () => {
|
|
21
|
+
try {
|
|
22
|
+
// Determine path based on whether we are in ./src or ./dist
|
|
23
|
+
// __dirname is usually ./dist in production
|
|
24
|
+
const packagePath = node_path_1.default.resolve(__dirname, "../package.json");
|
|
25
|
+
// Fallback if structure differs slightly in dev vs prod
|
|
26
|
+
if (!node_fs_1.default.existsSync(packagePath)) {
|
|
27
|
+
const altPath = node_path_1.default.resolve(__dirname, "../../package.json");
|
|
28
|
+
if (node_fs_1.default.existsSync(altPath)) {
|
|
29
|
+
return JSON.parse(node_fs_1.default.readFileSync(altPath, "utf-8")).version;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const content = node_fs_1.default.readFileSync(packagePath, "utf-8");
|
|
33
|
+
const pkg = JSON.parse(content);
|
|
34
|
+
return pkg.version;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.warn("MindSim SDK: Unable to determine current package version.", error);
|
|
38
|
+
return "0.0.0";
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
exports.getPackageVersion = getPackageVersion;
|
|
42
|
+
/**
|
|
43
|
+
* Checks NPM registry for updates and logs a warning if outdated.
|
|
44
|
+
* @param verbose If true, logs when the version is up to date (useful for CLI 'version' command)
|
|
45
|
+
*/
|
|
46
|
+
const checkForUpdates = async (verbose = false) => {
|
|
47
|
+
try {
|
|
48
|
+
const currentVersion = (0, exports.getPackageVersion)();
|
|
49
|
+
// Fetch latest version data from NPM
|
|
50
|
+
// Set a short timeout so we don't block application boot significantly
|
|
51
|
+
const { data } = await axios_1.default.get(REGISTRY_URL, { timeout: 1500 });
|
|
52
|
+
const latestVersion = data["dist-tags"].latest;
|
|
53
|
+
if (semver_1.default.gt(latestVersion, currentVersion)) {
|
|
54
|
+
const changelogUrl = `https://www.npmjs.com/package/${PACKAGE_NAME}/v/${latestVersion}`;
|
|
55
|
+
console.warn("\n" + "=".repeat(60));
|
|
56
|
+
console.warn(`⚠️ UPDATE AVAILABLE: @mindsim/mindsim-sdk-typescript`);
|
|
57
|
+
console.warn("=".repeat(60));
|
|
58
|
+
console.warn(` Current Version: ${currentVersion}`);
|
|
59
|
+
console.warn(` Latest Version: ${latestVersion}`);
|
|
60
|
+
console.warn("-".repeat(60));
|
|
61
|
+
console.warn(` Changelog: ${changelogUrl}`);
|
|
62
|
+
console.warn(` Run 'mindsim update' to install the latest version.`);
|
|
63
|
+
console.warn("=".repeat(60) + "\n");
|
|
64
|
+
}
|
|
65
|
+
else if (verbose) {
|
|
66
|
+
console.log(`MindSim SDK is up to date (v${currentVersion})`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
// Fail silently on network errors so we don't break the user's workflow
|
|
71
|
+
if (verbose) {
|
|
72
|
+
console.error("Failed to check for updates:", error instanceof Error ? error.message : "Unknown error");
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
exports.checkForUpdates = checkForUpdates;
|
|
77
|
+
/**
|
|
78
|
+
* Auto-updates the SDK using npm
|
|
79
|
+
*/
|
|
80
|
+
const updateSdk = async () => {
|
|
81
|
+
console.log(`Checking for updates for ${PACKAGE_NAME}...`);
|
|
82
|
+
try {
|
|
83
|
+
const currentVersion = (0, exports.getPackageVersion)();
|
|
84
|
+
const { data } = await axios_1.default.get(REGISTRY_URL);
|
|
85
|
+
const latestVersion = data["dist-tags"].latest;
|
|
86
|
+
if (!semver_1.default.gt(latestVersion, currentVersion)) {
|
|
87
|
+
console.log(`You are already on the latest version (${currentVersion}).`);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
console.log(`Updating from ${currentVersion} to ${latestVersion}...`);
|
|
91
|
+
console.log(`Running: npm install ${PACKAGE_NAME}@latest --save`);
|
|
92
|
+
// We use npm install --save to ensure it updates package.json
|
|
93
|
+
await execAsync(`npm install ${PACKAGE_NAME}@latest --save`);
|
|
94
|
+
console.log("✅ Update complete! Please restart your application.");
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.error("❌ Failed to update MindSim SDK.");
|
|
98
|
+
if (error instanceof Error) {
|
|
99
|
+
console.error(error.message);
|
|
100
|
+
}
|
|
101
|
+
console.error("Please try running manually: npm install @mindsim/mindsim-sdk-typescript@latest");
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
exports.updateSdk = updateSdk;
|
|
105
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;;;;AAAA,2DAA0C;AAC1C,sDAAyB;AACzB,0DAA6B;AAC7B,yCAAsC;AACtC,kDAA0B;AAC1B,oDAA4B;AAE5B,MAAM,SAAS,GAAG,IAAA,qBAAS,EAAC,yBAAI,CAAC,CAAC;AAElC,MAAM,YAAY,GAAG,iCAAiC,CAAC;AACvD,MAAM,YAAY,GAAG,8BAA8B,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