@x12i/static-memorix-explorer-api 1.3.1 → 1.4.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/README.md +59 -1
- package/dist/cli.d.ts +14 -0
- package/dist/cli.js +154 -0
- package/dist/engine/lists.d.ts +1 -1
- package/dist/server.d.ts +2 -0
- package/dist/server.js +42 -7
- package/guides/running-the-service.md +58 -10
- package/guides/using-the-api.md +1 -1
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -10,6 +10,47 @@ See [guides/demo-app.md](./guides/demo-app.md) for the full walkthrough.
|
|
|
10
10
|
|
|
11
11
|
## Quick start
|
|
12
12
|
|
|
13
|
+
Install once, then run one command:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install --global @x12i/static-memorix-explorer-api
|
|
17
|
+
memorix-explorer
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Then open **http://localhost:5030/demo**. The command prints the Demo, API,
|
|
21
|
+
Health, and JSON paths when it starts. No database or additional configuration
|
|
22
|
+
is required.
|
|
23
|
+
|
|
24
|
+
To create an editable demo in your own directory instead of using the bundled
|
|
25
|
+
read-only seeds:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
memorix-explorer create-demo
|
|
29
|
+
memorix-explorer --mocks-dir ./memorix-demo
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The first command creates `./memorix-demo` with `demo.html`, seed data,
|
|
33
|
+
metadata, write descriptors, and its own README. It refuses to overwrite an
|
|
34
|
+
existing path. The second command serves that folder, and all UI create/edit/
|
|
35
|
+
delete operations persist their routed JSON files inside it.
|
|
36
|
+
|
|
37
|
+
Choose a different destination or port if needed:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
memorix-explorer create-demo --dir ./my-project-fixtures
|
|
41
|
+
memorix-explorer --mocks-dir ./my-project-fixtures --port 8080
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Useful options:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
memorix-explorer --port 8080
|
|
48
|
+
memorix-explorer --help
|
|
49
|
+
memorix-explorer --version
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Run from this repository
|
|
53
|
+
|
|
13
54
|
```bash
|
|
14
55
|
npm install
|
|
15
56
|
npm run build
|
|
@@ -38,7 +79,7 @@ npx @x12i/static-memorix-explorer-api
|
|
|
38
79
|
Or, after a global install:
|
|
39
80
|
|
|
40
81
|
```bash
|
|
41
|
-
|
|
82
|
+
memorix-explorer
|
|
42
83
|
```
|
|
43
84
|
|
|
44
85
|
Override the port from the shell:
|
|
@@ -278,6 +319,23 @@ and `knowledgeId`.
|
|
|
278
319
|
|
|
279
320
|
## Release history
|
|
280
321
|
|
|
322
|
+
### v1.4.0
|
|
323
|
+
- Added `memorix-explorer create-demo` to create a user-owned, writable demo.
|
|
324
|
+
- Added `--dir` for the generated demo destination and `--mocks-dir` for
|
|
325
|
+
serving any fixture directory directly from the CLI.
|
|
326
|
+
- Generated demos include UI, metadata, seed data, write descriptors, and a
|
|
327
|
+
local usage README.
|
|
328
|
+
- Demo creation is atomic, refuses overwrites, and excludes routed state that
|
|
329
|
+
may have been generated inside a previously used global installation.
|
|
330
|
+
- Installed CLI aliases now use a configuration-first launcher so fixture paths
|
|
331
|
+
are resolved before the server loads.
|
|
332
|
+
|
|
333
|
+
### v1.3.2
|
|
334
|
+
- Added the short `memorix-explorer` CLI command.
|
|
335
|
+
- Added `--help`/`-h` and `--version`/`-v` commands.
|
|
336
|
+
- Startup now prints clickable Demo, API, Health, and JSON locations.
|
|
337
|
+
- Reworked Quick Start documentation around install-once, run-one-command use.
|
|
338
|
+
|
|
281
339
|
### v1.3.1
|
|
282
340
|
- Rejected unsafe routing IDs, object types, and metadata keys before path use.
|
|
283
341
|
- Changed malformed and empty JSON handling from silent fallback to explicit
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export interface CliServerOptions {
|
|
3
|
+
port?: number;
|
|
4
|
+
host?: string;
|
|
5
|
+
mocksDir?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const CLI_HELP = "Memorix Explorer static server\n\nUsage:\n memorix-explorer create-demo [--dir <path>]\n memorix-explorer [options]\n\nCommands:\n create-demo Create a writable demo folder (default: ./memorix-demo)\n\nServer options:\n --port <number> Port to listen on (default: 5030)\n --host <address> Host to bind (default: 0.0.0.0)\n --mocks-dir <path> JSON fixture directory\n -h, --help Show this help\n -v, --version Show the installed version\n\nQuick start:\n memorix-explorer create-demo\n memorix-explorer --mocks-dir ./memorix-demo\n";
|
|
8
|
+
export declare function getPackageVersion(): string;
|
|
9
|
+
export declare function parseServerArgs(args: string[]): CliServerOptions;
|
|
10
|
+
export declare function parseCreateDemoArgs(args: string[]): {
|
|
11
|
+
targetDir: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function createDemo(targetDir: string): string;
|
|
14
|
+
export declare function runCli(args: string[]): Promise<void>;
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
export const CLI_HELP = `Memorix Explorer static server
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
memorix-explorer create-demo [--dir <path>]
|
|
10
|
+
memorix-explorer [options]
|
|
11
|
+
|
|
12
|
+
Commands:
|
|
13
|
+
create-demo Create a writable demo folder (default: ./memorix-demo)
|
|
14
|
+
|
|
15
|
+
Server options:
|
|
16
|
+
--port <number> Port to listen on (default: 5030)
|
|
17
|
+
--host <address> Host to bind (default: 0.0.0.0)
|
|
18
|
+
--mocks-dir <path> JSON fixture directory
|
|
19
|
+
-h, --help Show this help
|
|
20
|
+
-v, --version Show the installed version
|
|
21
|
+
|
|
22
|
+
Quick start:
|
|
23
|
+
memorix-explorer create-demo
|
|
24
|
+
memorix-explorer --mocks-dir ./memorix-demo
|
|
25
|
+
`;
|
|
26
|
+
function packageRoot() {
|
|
27
|
+
return path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
28
|
+
}
|
|
29
|
+
export function getPackageVersion() {
|
|
30
|
+
return JSON.parse(fs.readFileSync(path.join(packageRoot(), "package.json"), "utf8")).version;
|
|
31
|
+
}
|
|
32
|
+
export function parseServerArgs(args) {
|
|
33
|
+
const options = {};
|
|
34
|
+
for (let index = 0; index < args.length; index++) {
|
|
35
|
+
const arg = args[index];
|
|
36
|
+
if (arg === "--port") {
|
|
37
|
+
const raw = args[++index];
|
|
38
|
+
const port = Number(raw);
|
|
39
|
+
if (!raw || !Number.isInteger(port) || port < 0 || port > 65535) {
|
|
40
|
+
throw new Error("--port must be an integer from 0 to 65535");
|
|
41
|
+
}
|
|
42
|
+
options.port = port;
|
|
43
|
+
}
|
|
44
|
+
else if (arg === "--host") {
|
|
45
|
+
const host = args[++index];
|
|
46
|
+
if (!host)
|
|
47
|
+
throw new Error("--host requires a value");
|
|
48
|
+
options.host = host;
|
|
49
|
+
}
|
|
50
|
+
else if (arg === "--mocks-dir") {
|
|
51
|
+
const mocksDir = args[++index];
|
|
52
|
+
if (!mocksDir)
|
|
53
|
+
throw new Error("--mocks-dir requires a path");
|
|
54
|
+
options.mocksDir = path.resolve(mocksDir);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
throw new Error(`Unknown CLI argument: ${arg}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return options;
|
|
61
|
+
}
|
|
62
|
+
export function parseCreateDemoArgs(args) {
|
|
63
|
+
let targetDir = path.resolve("memorix-demo");
|
|
64
|
+
for (let index = 0; index < args.length; index++) {
|
|
65
|
+
const arg = args[index];
|
|
66
|
+
if (arg === "--dir") {
|
|
67
|
+
const value = args[++index];
|
|
68
|
+
if (!value)
|
|
69
|
+
throw new Error("--dir requires a path");
|
|
70
|
+
targetDir = path.resolve(value);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
throw new Error(`Unknown create-demo argument: ${arg}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return { targetDir };
|
|
77
|
+
}
|
|
78
|
+
export function createDemo(targetDir) {
|
|
79
|
+
const resolved = path.resolve(targetDir);
|
|
80
|
+
if (fs.existsSync(resolved)) {
|
|
81
|
+
throw new Error(`Refusing to overwrite existing path: ${resolved}`);
|
|
82
|
+
}
|
|
83
|
+
const bundledMocks = path.join(packageRoot(), "mocks");
|
|
84
|
+
if (!fs.existsSync(bundledMocks)) {
|
|
85
|
+
throw new Error(`Bundled demo fixtures not found: ${bundledMocks}`);
|
|
86
|
+
}
|
|
87
|
+
const temporary = `${resolved}.creating-${randomUUID()}`;
|
|
88
|
+
try {
|
|
89
|
+
fs.cpSync(bundledMocks, temporary, {
|
|
90
|
+
recursive: true,
|
|
91
|
+
errorOnExist: true,
|
|
92
|
+
force: false,
|
|
93
|
+
// A globally installed package may already have routed runtime files.
|
|
94
|
+
// Copy only pristine bundled seeds, never another user's generated state.
|
|
95
|
+
filter: (source) => !path.basename(source).includes("--"),
|
|
96
|
+
});
|
|
97
|
+
fs.writeFileSync(path.join(temporary, "README.md"), `# Memorix Explorer demo\n\n` +
|
|
98
|
+
`Start this demo from this directory:\n\n` +
|
|
99
|
+
"```bash\nmemorix-explorer --mocks-dir . --port 5030\n```\n\n" +
|
|
100
|
+
`Then open http://localhost:5030/demo.\n\n` +
|
|
101
|
+
`Create, edit, and delete operations update the routed JSON files here.\n`, "utf8");
|
|
102
|
+
fs.renameSync(temporary, resolved);
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
fs.rmSync(temporary, { recursive: true, force: true });
|
|
106
|
+
throw error;
|
|
107
|
+
}
|
|
108
|
+
return resolved;
|
|
109
|
+
}
|
|
110
|
+
function quote(value) {
|
|
111
|
+
return `"${value.replaceAll('"', '\\"')}"`;
|
|
112
|
+
}
|
|
113
|
+
export async function runCli(args) {
|
|
114
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
115
|
+
console.log(CLI_HELP);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (args.includes("--version") || args.includes("-v")) {
|
|
119
|
+
console.log(getPackageVersion());
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (args[0] === "create-demo") {
|
|
123
|
+
const { targetDir } = parseCreateDemoArgs(args.slice(1));
|
|
124
|
+
const created = createDemo(targetDir);
|
|
125
|
+
console.log(`\nDemo created at:\n ${created}\n`);
|
|
126
|
+
console.log("Start the server with:");
|
|
127
|
+
console.log(` memorix-explorer --mocks-dir ${quote(created)}\n`);
|
|
128
|
+
console.log("Then open:");
|
|
129
|
+
console.log(" http://localhost:5030/demo\n");
|
|
130
|
+
console.log("Create, edit, and delete operations will update JSON files in that folder.");
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const options = parseServerArgs(args);
|
|
134
|
+
if (options.mocksDir)
|
|
135
|
+
process.env.MOCKS_DIR = options.mocksDir;
|
|
136
|
+
const { startServer } = await import("./server.js");
|
|
137
|
+
await startServer({ port: options.port, host: options.host });
|
|
138
|
+
}
|
|
139
|
+
function isCliEntrypoint() {
|
|
140
|
+
if (!process.argv[1])
|
|
141
|
+
return false;
|
|
142
|
+
try {
|
|
143
|
+
return fs.realpathSync(path.resolve(process.argv[1])) === fileURLToPath(import.meta.url);
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (isCliEntrypoint()) {
|
|
150
|
+
runCli(process.argv.slice(2)).catch((error) => {
|
|
151
|
+
console.error(error instanceof Error ? error.message : error);
|
|
152
|
+
process.exit(1);
|
|
153
|
+
});
|
|
154
|
+
}
|
package/dist/engine/lists.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare function executeListDescriptor(desc: ListDescriptor, params?: Exp
|
|
|
11
11
|
export declare function suggestListExtensions(entityName: string): {
|
|
12
12
|
entityName: string;
|
|
13
13
|
suggestions: {
|
|
14
|
-
contentType: "
|
|
14
|
+
contentType: "analysis" | "decisions" | "events" | "memory";
|
|
15
15
|
collection: string;
|
|
16
16
|
suggestion: string;
|
|
17
17
|
}[];
|
package/dist/server.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export interface StartServerOptions {
|
|
|
5
5
|
logger?: boolean;
|
|
6
6
|
installSignalHandlers?: boolean;
|
|
7
7
|
}
|
|
8
|
+
export declare const CLI_HELP = "Memorix Explorer static server\n\nUsage:\n memorix-explorer [options]\n\nOptions:\n --port <number> Port to listen on (default: 5030)\n --host <address> Host to bind (default: 0.0.0.0)\n -h, --help Show this help\n -v, --version Show the installed version\n\nEnvironment:\n MOCKS_DIR Writable JSON fixture directory\n MEMORIX_ORG_ID Organization routing ID\n MEMORIX_AGENT_ID Agent/Catalox routing ID\n\nExample:\n memorix-explorer --port 5030\n";
|
|
9
|
+
export declare function getPackageVersion(): string;
|
|
8
10
|
export declare function parseCliArgs(args: string[]): StartServerOptions;
|
|
9
11
|
export declare function isCliEntrypoint(argvPath: string | undefined, moduleUrl: string): boolean;
|
|
10
12
|
/** Build a loaded Fastify instance without opening a network port. */
|
package/dist/server.js
CHANGED
|
@@ -6,6 +6,29 @@ import { fileURLToPath } from "node:url";
|
|
|
6
6
|
import { store } from "./storage/InMemoryStore.js";
|
|
7
7
|
import { registerRoutes } from "./routes/index.js";
|
|
8
8
|
import { PORT, HOST, MOCKS_DIR } from "./config.js";
|
|
9
|
+
export const CLI_HELP = `Memorix Explorer static server
|
|
10
|
+
|
|
11
|
+
Usage:
|
|
12
|
+
memorix-explorer [options]
|
|
13
|
+
|
|
14
|
+
Options:
|
|
15
|
+
--port <number> Port to listen on (default: 5030)
|
|
16
|
+
--host <address> Host to bind (default: 0.0.0.0)
|
|
17
|
+
-h, --help Show this help
|
|
18
|
+
-v, --version Show the installed version
|
|
19
|
+
|
|
20
|
+
Environment:
|
|
21
|
+
MOCKS_DIR Writable JSON fixture directory
|
|
22
|
+
MEMORIX_ORG_ID Organization routing ID
|
|
23
|
+
MEMORIX_AGENT_ID Agent/Catalox routing ID
|
|
24
|
+
|
|
25
|
+
Example:
|
|
26
|
+
memorix-explorer --port 5030
|
|
27
|
+
`;
|
|
28
|
+
export function getPackageVersion() {
|
|
29
|
+
const packageFile = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../package.json");
|
|
30
|
+
return JSON.parse(fs.readFileSync(packageFile, "utf8")).version;
|
|
31
|
+
}
|
|
9
32
|
export function parseCliArgs(args) {
|
|
10
33
|
const options = {};
|
|
11
34
|
for (let index = 0; index < args.length; index++) {
|
|
@@ -70,9 +93,13 @@ export async function startServer(options = {}) {
|
|
|
70
93
|
await app.listen({ port, host });
|
|
71
94
|
const address = app.server.address();
|
|
72
95
|
const boundPort = typeof address === "object" && address ? address.port : port;
|
|
96
|
+
const displayHost = host === "0.0.0.0" ? "localhost" : host;
|
|
73
97
|
// eslint-disable-next-line no-console
|
|
74
|
-
console.log(
|
|
75
|
-
console.log(`
|
|
98
|
+
console.log(`\nMemorix Explorer is ready`);
|
|
99
|
+
console.log(` Demo: http://${displayHost}:${boundPort}/demo`);
|
|
100
|
+
console.log(` API: http://${displayHost}:${boundPort}/api/explorer`);
|
|
101
|
+
console.log(` Health: http://${displayHost}:${boundPort}/health`);
|
|
102
|
+
console.log(` JSON: ${MOCKS_DIR}\n`);
|
|
76
103
|
if (options.installSignalHandlers ?? true) {
|
|
77
104
|
const shutdown = async () => {
|
|
78
105
|
console.log("\n[mock-memorix-explorer-api] flushing + shutting down");
|
|
@@ -87,9 +114,17 @@ export async function startServer(options = {}) {
|
|
|
87
114
|
}
|
|
88
115
|
const isCliEntry = isCliEntrypoint(process.argv[1], import.meta.url);
|
|
89
116
|
if (isCliEntry) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
console.
|
|
93
|
-
|
|
94
|
-
|
|
117
|
+
const args = process.argv.slice(2);
|
|
118
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
119
|
+
console.log(CLI_HELP);
|
|
120
|
+
}
|
|
121
|
+
else if (args.includes("--version") || args.includes("-v")) {
|
|
122
|
+
console.log(getPackageVersion());
|
|
123
|
+
}
|
|
124
|
+
else
|
|
125
|
+
Promise.resolve().then(() => startServer(parseCliArgs(args))).catch((err) => {
|
|
126
|
+
// eslint-disable-next-line no-console
|
|
127
|
+
console.error(err);
|
|
128
|
+
process.exit(1);
|
|
129
|
+
});
|
|
95
130
|
}
|
|
@@ -12,9 +12,9 @@ from in-memory state backed by JSON files on disk.
|
|
|
12
12
|
npm install -g @x12i/static-memorix-explorer-api
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
This makes the `
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
This makes the short `memorix-explorer` command available globally.
|
|
16
|
+
`static-memorix-explorer-api` and `mock-memorix-explorer-api` remain available
|
|
17
|
+
as compatibility aliases.
|
|
18
18
|
|
|
19
19
|
### From source (git clone)
|
|
20
20
|
|
|
@@ -45,11 +45,52 @@ iteration, but not suitable for distribution.
|
|
|
45
45
|
### As a global CLI
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
|
-
|
|
48
|
+
memorix-explorer
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
After `npm install -g`, the CLI starts the server with default settings. The
|
|
52
|
-
mocks directory defaults to
|
|
52
|
+
mocks directory defaults to the bundled fixtures, and the CLI prints the URLs
|
|
53
|
+
to open:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
Memorix Explorer is ready
|
|
57
|
+
Demo: http://localhost:5030/demo
|
|
58
|
+
API: http://localhost:5030/api/explorer
|
|
59
|
+
Health: http://localhost:5030/health
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Create a writable demo
|
|
63
|
+
|
|
64
|
+
The bundled fixtures may live inside a global npm installation. Create a
|
|
65
|
+
user-owned copy before experimenting with create/edit/delete:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
memorix-explorer create-demo
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The command creates `./memorix-demo` and prints the exact next step:
|
|
72
|
+
|
|
73
|
+
```text
|
|
74
|
+
Demo created at:
|
|
75
|
+
/your/current/directory/memorix-demo
|
|
76
|
+
|
|
77
|
+
Start the server with:
|
|
78
|
+
memorix-explorer --mocks-dir "/your/current/directory/memorix-demo"
|
|
79
|
+
|
|
80
|
+
Then open:
|
|
81
|
+
http://localhost:5030/demo
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The generated directory contains `demo.html`, `data/`, `metadata/`, and a
|
|
85
|
+
README. It is safe to edit and suitable for source control. The command refuses
|
|
86
|
+
to overwrite an existing file or directory.
|
|
87
|
+
|
|
88
|
+
Use a custom folder or port:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
memorix-explorer create-demo --dir ./fixtures
|
|
92
|
+
memorix-explorer --mocks-dir ./fixtures --port 8080
|
|
93
|
+
```
|
|
53
94
|
|
|
54
95
|
### With `npx` (no global install)
|
|
55
96
|
|
|
@@ -61,8 +102,15 @@ Choose a port with a CLI option or environment variable. CLI options take
|
|
|
61
102
|
precedence:
|
|
62
103
|
|
|
63
104
|
```bash
|
|
64
|
-
|
|
65
|
-
PORT=5030 HOST=127.0.0.1
|
|
105
|
+
memorix-explorer --port 5030 --host 127.0.0.1
|
|
106
|
+
PORT=5030 HOST=127.0.0.1 memorix-explorer
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Built-in help and version output do not start the server:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
memorix-explorer --help
|
|
113
|
+
memorix-explorer --version
|
|
66
114
|
```
|
|
67
115
|
|
|
68
116
|
### From application code
|
|
@@ -111,7 +159,7 @@ containerized deployments, point it at a persistent application-owned volume
|
|
|
111
159
|
rather than relying on the package's bundled seed directory:
|
|
112
160
|
|
|
113
161
|
```bash
|
|
114
|
-
MOCKS_DIR=/var/lib/my-app/memorix-mocks
|
|
162
|
+
MOCKS_DIR=/var/lib/my-app/memorix-mocks memorix-explorer --port 5030
|
|
115
163
|
```
|
|
116
164
|
|
|
117
165
|
Configuration is resolved when the package is imported. In programmatic usage,
|
|
@@ -162,7 +210,7 @@ default.
|
|
|
162
210
|
Set to `true` or `1` to enable:
|
|
163
211
|
|
|
164
212
|
```bash
|
|
165
|
-
MEMORIX_EXPLORER_ENABLE_METADATA_WRITES=true
|
|
213
|
+
MEMORIX_EXPLORER_ENABLE_METADATA_WRITES=true memorix-explorer
|
|
166
214
|
```
|
|
167
215
|
|
|
168
216
|
### Disk flush
|
|
@@ -180,7 +228,7 @@ MOCKS_DIR=/path/to/my/fixtures \
|
|
|
180
228
|
MEMORIX_ORG_ID=neo \
|
|
181
229
|
MEMORIX_AGENT_ID=neo-agent \
|
|
182
230
|
MEMORIX_EXPLORER_ENABLE_METADATA_WRITES=true \
|
|
183
|
-
|
|
231
|
+
memorix-explorer
|
|
184
232
|
```
|
|
185
233
|
|
|
186
234
|
## Health checks
|
package/guides/using-the-api.md
CHANGED
|
@@ -261,5 +261,5 @@ when the corresponding feature flag is not enabled. Set the environment
|
|
|
261
261
|
variable to `true` or `1` to allow writes:
|
|
262
262
|
|
|
263
263
|
```bash
|
|
264
|
-
MEMORIX_EXPLORER_ENABLE_METADATA_WRITES=true
|
|
264
|
+
MEMORIX_EXPLORER_ENABLE_METADATA_WRITES=true memorix-explorer
|
|
265
265
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@x12i/static-memorix-explorer-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Static mock server providing full API parity for the Memorix Explorer API.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/server.js",
|
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"bin": {
|
|
18
|
-
"
|
|
19
|
-
"
|
|
18
|
+
"memorix-explorer": "dist/cli.js",
|
|
19
|
+
"static-memorix-explorer-api": "dist/cli.js",
|
|
20
|
+
"mock-memorix-explorer-api": "dist/cli.js"
|
|
20
21
|
},
|
|
21
22
|
"scripts": {
|
|
22
23
|
"build": "tsc -p tsconfig.json",
|
|
23
|
-
"start": "node dist/
|
|
24
|
-
"dev": "node --experimental-strip-types
|
|
24
|
+
"start": "node dist/cli.js",
|
|
25
|
+
"dev": "node --experimental-strip-types cli.ts",
|
|
25
26
|
"test": "npm run build && node --test tests/*.test.mjs",
|
|
26
27
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
27
28
|
"prepack": "npm run build",
|