@project-ajax/sdk 0.0.49 → 0.0.51
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/capabilities/sync.d.ts +5 -0
- package/dist/capabilities/sync.d.ts.map +1 -1
- package/dist/cli/api/client.d.ts +0 -8
- package/dist/cli/api/client.d.ts.map +1 -1
- package/dist/cli/api/client.js +4 -31
- package/dist/cli/commands/auth.d.ts.map +1 -1
- package/dist/cli/commands/auth.impl.d.ts +4 -9
- package/dist/cli/commands/auth.impl.d.ts.map +1 -1
- package/dist/cli/commands/auth.impl.js +4 -10
- package/dist/cli/commands/auth.impl.test.d.ts +2 -0
- package/dist/cli/commands/auth.impl.test.d.ts.map +1 -0
- package/dist/cli/commands/auth.js +1 -15
- package/dist/cli/commands/bundle.impl.test.d.ts +2 -0
- package/dist/cli/commands/bundle.impl.test.d.ts.map +1 -0
- package/dist/cli/commands/deploy.impl.test.d.ts +2 -0
- package/dist/cli/commands/deploy.impl.test.d.ts.map +1 -0
- package/dist/cli/commands/exec.impl.d.ts.map +1 -1
- package/dist/cli/commands/exec.impl.js +3 -0
- package/dist/cli/commands/utils/testing.d.ts +25 -0
- package/dist/cli/commands/utils/testing.d.ts.map +1 -0
- package/dist/cli/commands/utils/testing.js +51 -0
- package/dist/cli/config.d.ts +8 -8
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +55 -19
- package/dist/cli/config.test.d.ts +2 -0
- package/dist/cli/config.test.d.ts.map +1 -0
- package/dist/cli/flags.d.ts +5 -0
- package/dist/cli/flags.d.ts.map +1 -1
- package/dist/cli/flags.js +25 -0
- package/dist/cli/handler.d.ts.map +1 -1
- package/dist/cli/handler.js +3 -5
- package/package.json +2 -2
- package/src/capabilities/sync.ts +5 -0
- package/src/capabilities/tool.test.ts +51 -1
- package/src/cli/api/client.ts +3 -44
- package/src/cli/commands/.cursor/rules/testing-commands.mdc +212 -0
- package/src/cli/commands/auth.impl.test.ts +206 -0
- package/src/cli/commands/auth.impl.ts +5 -17
- package/src/cli/commands/auth.ts +2 -15
- package/src/cli/commands/bundle.impl.test.ts +137 -0
- package/src/cli/commands/deploy.impl.test.ts +239 -0
- package/src/cli/commands/exec.impl.ts +4 -0
- package/src/cli/commands/utils/testing.ts +60 -0
- package/src/cli/config.test.ts +114 -0
- package/src/cli/config.ts +68 -28
- package/src/cli/flags.ts +29 -0
- package/src/cli/handler.ts +2 -5
|
@@ -13,6 +13,11 @@ export type SyncedObject<PK extends string, S extends PropertySchema<PK>> = {
|
|
|
13
13
|
* Use the `icon()` builder to create an icon value.
|
|
14
14
|
*/
|
|
15
15
|
icon?: Icon;
|
|
16
|
+
/**
|
|
17
|
+
* Optional markdown content to add to the page.
|
|
18
|
+
* This will be converted to blocks and added as page content.
|
|
19
|
+
*/
|
|
20
|
+
pageContentMarkdown?: string;
|
|
16
21
|
};
|
|
17
22
|
/**
|
|
18
23
|
* A configuration object that enables synchronization between a data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/capabilities/sync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC,SAAS,cAAc,CAAC,EAAE,CAAC,IAAI;IAC3E,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE;SAAG,QAAQ,IAAI,MAAM,CAAC,GAAG,SAAS;KAAE,CAAC;IACjD;;;OAGG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/capabilities/sync.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MA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}
|
|
25
|
-
/**
|
|
26
|
-
* Get the base URL for the given environment
|
|
27
|
-
*/
|
|
28
|
-
export declare function baseUrl({ environment, override, }: {
|
|
29
|
-
environment: Environment;
|
|
30
|
-
override?: string | undefined;
|
|
31
|
-
}): string;
|
|
32
25
|
/**
|
|
33
26
|
* API client for making authenticated requests to Workers endpoints
|
|
34
27
|
*/
|
|
35
28
|
export declare class ApiClient {
|
|
36
29
|
#private;
|
|
37
30
|
constructor(config: ApiClientConfig);
|
|
38
|
-
private baseApiUrl;
|
|
39
31
|
/**
|
|
40
32
|
* Make an authenticated fetch request to the Workers API
|
|
41
33
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/cli/api/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;AAE/D,UAAU,eAAe;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CACf;AAID,MAAM,WAAW,QAAQ;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,EAAE,MAAM,CAAC;QACrB,OAAO,EAAE,MAAM,CAAC;KAChB,CAAC;CACF;AAED;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/cli/api/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IA0CjD;;OAEG;IACG,oBAAoB,CACzB,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAazE;;OAEG;IACG,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CACjD,MAAM,CACL;QACC,IAAI,EAAE,KAAK,CAAC;YACX,QAAQ,EAAE,MAAM,CAAC;YACjB,OAAO,EAAE,MAAM,CAAC;YAChB,KAAK,EAAE,MAAM,CAAC;YACd,IAAI,EAAE,MAAM,CAAC;YACb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;YACxB,SAAS,EAAE,MAAM,CAAC;YAClB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;SACvB,CAAC,CAAC;KACH,EACD,QAAQ,CACR,CACD;IASD;;OAEG;IACG,UAAU,CACf,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACX,OAAO,CACT,MAAM,CACL;QACC,IAAI,EAAE,MAAM,CAAC;KACb,EACD,QAAQ,CACR,CACD;CASD"}
|
package/dist/cli/api/client.js
CHANGED
|
@@ -1,49 +1,23 @@
|
|
|
1
1
|
import { Result } from "./result.js";
|
|
2
|
-
function baseUrl({
|
|
3
|
-
environment,
|
|
4
|
-
override
|
|
5
|
-
}) {
|
|
6
|
-
if (override) {
|
|
7
|
-
return override;
|
|
8
|
-
}
|
|
9
|
-
switch (environment) {
|
|
10
|
-
case "local":
|
|
11
|
-
return "http://localhost:3000";
|
|
12
|
-
case "staging":
|
|
13
|
-
return "https://staging.notion.so";
|
|
14
|
-
case "dev":
|
|
15
|
-
return "https://dev.notion.so";
|
|
16
|
-
case "prod":
|
|
17
|
-
return "https://www.notion.so";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function baseApiUrl({
|
|
21
|
-
environment,
|
|
22
|
-
override
|
|
23
|
-
}) {
|
|
24
|
-
return `${baseUrl({ environment, override })}/api/v3`;
|
|
25
|
-
}
|
|
26
2
|
class ApiClient {
|
|
27
3
|
#token;
|
|
28
|
-
#env;
|
|
29
4
|
#baseUrl;
|
|
30
5
|
#cellId;
|
|
31
6
|
#writer;
|
|
32
7
|
constructor(config) {
|
|
33
8
|
this.#token = config.token;
|
|
34
|
-
this.#env = config.environment;
|
|
35
9
|
this.#baseUrl = config.baseUrl;
|
|
36
10
|
this.#cellId = config.cellId;
|
|
37
11
|
this.#writer = config.writer;
|
|
38
12
|
}
|
|
39
|
-
baseApiUrl() {
|
|
40
|
-
return
|
|
13
|
+
#baseApiUrl() {
|
|
14
|
+
return `${this.#baseUrl}/api/v3`;
|
|
41
15
|
}
|
|
42
16
|
async fetch(endpoint, requestOptions = {}, options) {
|
|
43
17
|
if (!endpoint.startsWith("/")) {
|
|
44
18
|
throw new Error("Endpoint must start with a slash (/)");
|
|
45
19
|
}
|
|
46
|
-
const url = `${this
|
|
20
|
+
const url = `${this.#baseApiUrl()}${endpoint}`;
|
|
47
21
|
this.#writer.debug(`Fetching ${url}`);
|
|
48
22
|
this.#writer.debug(
|
|
49
23
|
`Options: ${JSON.stringify(requestOptions, null, " ")}`
|
|
@@ -341,6 +315,5 @@ function parseValidationError(errorText) {
|
|
|
341
315
|
return void 0;
|
|
342
316
|
}
|
|
343
317
|
export {
|
|
344
|
-
ApiClient
|
|
345
|
-
baseUrl
|
|
318
|
+
ApiClient
|
|
346
319
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/auth.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,wEA2DvB,CAAC"}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export declare const login: (this: import("../context.js").LocalContext, flags: import("../flags.js").GlobalFlags & LoginFlags, token?: string | undefined) => Promise<void>;
|
|
7
|
-
export declare const show: (this: import("../context.js").LocalContext, flags: import("../flags.js").GlobalFlags) => Promise<void>;
|
|
8
|
-
export declare const logout: (this: import("../context.js").LocalContext, flags: import("../flags.js").GlobalFlags) => Promise<void>;
|
|
9
|
-
export {};
|
|
1
|
+
import type { GlobalFlags } from "../flags.js";
|
|
2
|
+
export declare const login: (this: import("../context.js").LocalContext, flags: GlobalFlags, token?: string | undefined) => Promise<void>;
|
|
3
|
+
export declare const show: (this: import("../context.js").LocalContext, flags: GlobalFlags) => Promise<void>;
|
|
4
|
+
export declare const logout: (this: import("../context.js").LocalContext, flags: GlobalFlags) => Promise<void>;
|
|
10
5
|
//# sourceMappingURL=auth.impl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.impl.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/auth.impl.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.impl.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/auth.impl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C,eAAO,MAAM,KAAK,+GA+BhB,CAAC;AAEH,eAAO,MAAM,IAAI,mFAEf,CAAC;AAEH,eAAO,MAAM,MAAM,mFAEjB,CAAC"}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import { baseUrl } from "../api/client.js";
|
|
2
1
|
import { buildHandler } from "../handler.js";
|
|
3
2
|
import { openNotionUrl } from "../utils/openUrl.js";
|
|
4
|
-
const login = buildHandler(async function(
|
|
5
|
-
const environment =
|
|
6
|
-
if (flags["base-url"]) {
|
|
7
|
-
await this.config.setBaseUrl(flags["base-url"]);
|
|
8
|
-
}
|
|
3
|
+
const login = buildHandler(async function(_, token) {
|
|
4
|
+
const environment = this.config.environment;
|
|
9
5
|
if (!token) {
|
|
10
|
-
const url = `${baseUrl
|
|
11
|
-
environment,
|
|
12
|
-
override: this.config.baseUrl
|
|
13
|
-
})}/__workers__?createToken=true`;
|
|
6
|
+
const url = `${this.config.baseUrl}/__workers__?createToken=true`;
|
|
14
7
|
this.writer.writeErr(`Opening browser to create a token...
|
|
15
8
|
${url}
|
|
16
9
|
`);
|
|
@@ -28,6 +21,7 @@ ${url}
|
|
|
28
21
|
}
|
|
29
22
|
await this.config.setEnvironment(environment);
|
|
30
23
|
await this.config.setToken(token);
|
|
24
|
+
await this.config.setWorkerId(null);
|
|
31
25
|
this.writer.writeErr("Successfully logged in!");
|
|
32
26
|
});
|
|
33
27
|
const show = buildHandler(function() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.impl.test.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/auth.impl.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { buildCommand, buildRouteMap } from "@stricli/core";
|
|
2
|
-
import { Environments } from "../config.js";
|
|
3
2
|
import { globalFlags } from "../flags.js";
|
|
4
3
|
const authCommands = buildRouteMap({
|
|
5
4
|
docs: {
|
|
@@ -8,7 +7,7 @@ const authCommands = buildRouteMap({
|
|
|
8
7
|
routes: {
|
|
9
8
|
login: buildCommand({
|
|
10
9
|
docs: {
|
|
11
|
-
brief: "Login to the Project Ajax platform using a Workers API token"
|
|
10
|
+
brief: "Login to the Project Ajax platform using a Workers API token; will clear existing token, environment, and worker ID"
|
|
12
11
|
},
|
|
13
12
|
parameters: {
|
|
14
13
|
positional: {
|
|
@@ -23,19 +22,6 @@ const authCommands = buildRouteMap({
|
|
|
23
22
|
]
|
|
24
23
|
},
|
|
25
24
|
flags: {
|
|
26
|
-
env: {
|
|
27
|
-
kind: "enum",
|
|
28
|
-
values: Environments,
|
|
29
|
-
brief: "The environment to use for the command",
|
|
30
|
-
optional: true
|
|
31
|
-
},
|
|
32
|
-
"base-url": {
|
|
33
|
-
kind: "parsed",
|
|
34
|
-
parse: String,
|
|
35
|
-
brief: "The base URL to use for all API requests",
|
|
36
|
-
optional: true,
|
|
37
|
-
hidden: true
|
|
38
|
-
},
|
|
39
25
|
...globalFlags
|
|
40
26
|
}
|
|
41
27
|
},
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.impl.test.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/bundle.impl.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.impl.test.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/deploy.impl.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec.impl.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/exec.impl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM/C,UAAU,SAAU,SAAQ,WAAW;IACtC,MAAM,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"exec.impl.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/exec.impl.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM/C,UAAU,SAAU,SAAQ,WAAW;IACtC,MAAM,EAAE,OAAO,CAAC;CAChB;AAED,eAAO,MAAM,IAAI,2HA6Jf,CAAC"}
|
|
@@ -45,6 +45,9 @@ const exec = buildAuthedHandler(async function(flags, ...args) {
|
|
|
45
45
|
const parsedLine = JSON.parse(jsonLine);
|
|
46
46
|
switch (parsedLine._tag) {
|
|
47
47
|
case "log":
|
|
48
|
+
if (!flags.debug) {
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
48
51
|
if (parsedLine.event.stream === "stdout") {
|
|
49
52
|
allOutput.push(parsedLine.event.data);
|
|
50
53
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as os from "node:os";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import { Config, type Environment } from "../../config.js";
|
|
5
|
+
import type { GlobalFlags } from "../../flags.js";
|
|
6
|
+
import { Writer } from "../../writer.js";
|
|
7
|
+
export type ConfigFileContents = {
|
|
8
|
+
token: string | null;
|
|
9
|
+
workerId: string | null;
|
|
10
|
+
environment: Environment;
|
|
11
|
+
baseUrl: string;
|
|
12
|
+
};
|
|
13
|
+
export declare const tmpDirectories: string[];
|
|
14
|
+
export declare const baseFlags: GlobalFlags;
|
|
15
|
+
export declare function createConfigFile(contents: ConfigFileContents): Promise<string>;
|
|
16
|
+
export declare function createTestConfig(configFileContents: ConfigFileContents): Promise<Config>;
|
|
17
|
+
export declare function createBaseContext(): {
|
|
18
|
+
writer: Writer;
|
|
19
|
+
process: NodeJS.Process;
|
|
20
|
+
fs: typeof fs;
|
|
21
|
+
os: typeof os;
|
|
22
|
+
path: path.PlatformPath;
|
|
23
|
+
};
|
|
24
|
+
export declare function cleanupTmpDirectories(): Promise<void>;
|
|
25
|
+
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/utils/testing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,MAAM,MAAM,kBAAkB,GAAG;IAChC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,MAAM,EAAO,CAAC;AAE3C,eAAO,MAAM,SAAS,EAAE,WAEvB,CAAC;AAEF,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,mBAOlE;AAED,wBAAsB,gBAAgB,CACrC,kBAAkB,EAAE,kBAAkB,GACpC,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED,wBAAgB,iBAAiB;;;;;;EAQhC;AAED,wBAAsB,qBAAqB,kBAO1C"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
3
|
+
import * as os from "node:os";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import * as path from "node:path";
|
|
6
|
+
import { Config } from "../../config.js";
|
|
7
|
+
import { Writer } from "../../writer.js";
|
|
8
|
+
const tmpDirectories = [];
|
|
9
|
+
const baseFlags = {
|
|
10
|
+
debug: false
|
|
11
|
+
};
|
|
12
|
+
async function createConfigFile(contents) {
|
|
13
|
+
const dir = await mkdtemp(path.join(tmpdir(), "cmd-test-"));
|
|
14
|
+
tmpDirectories.push(dir);
|
|
15
|
+
const configFilePath = path.join(dir, "config.json");
|
|
16
|
+
await writeFile(configFilePath, JSON.stringify(contents, null, 2), "utf-8");
|
|
17
|
+
return configFilePath;
|
|
18
|
+
}
|
|
19
|
+
async function createTestConfig(configFileContents) {
|
|
20
|
+
const configFilePath = await createConfigFile(configFileContents);
|
|
21
|
+
return Config.load({
|
|
22
|
+
configFilePath,
|
|
23
|
+
processEnv: {},
|
|
24
|
+
flags: { debug: false }
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function createBaseContext() {
|
|
28
|
+
return {
|
|
29
|
+
writer: new Writer({ debugEnabled: false }),
|
|
30
|
+
process,
|
|
31
|
+
fs,
|
|
32
|
+
os,
|
|
33
|
+
path
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
async function cleanupTmpDirectories() {
|
|
37
|
+
while (tmpDirectories.length > 0) {
|
|
38
|
+
const dir = tmpDirectories.pop();
|
|
39
|
+
if (dir) {
|
|
40
|
+
await rm(dir, { recursive: true, force: true });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
baseFlags,
|
|
46
|
+
cleanupTmpDirectories,
|
|
47
|
+
createBaseContext,
|
|
48
|
+
createConfigFile,
|
|
49
|
+
createTestConfig,
|
|
50
|
+
tmpDirectories
|
|
51
|
+
};
|
package/dist/cli/config.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { GlobalFlags } from "./flags.js";
|
|
1
2
|
export declare const Environments: readonly ["local", "staging", "dev", "prod"];
|
|
2
3
|
export type Environment = (typeof Environments)[number];
|
|
3
|
-
interface
|
|
4
|
-
environment
|
|
5
|
-
baseUrl
|
|
4
|
+
interface ConfigMap {
|
|
5
|
+
environment: Environment;
|
|
6
|
+
baseUrl: string;
|
|
6
7
|
token: string | null;
|
|
7
8
|
workerId: string | null;
|
|
8
9
|
}
|
|
@@ -26,15 +27,13 @@ export declare class Config {
|
|
|
26
27
|
#private;
|
|
27
28
|
constructor(opts: {
|
|
28
29
|
configFilePath: string;
|
|
29
|
-
configFile:
|
|
30
|
-
processEnv: NodeJS.ProcessEnv;
|
|
30
|
+
configFile: ConfigMap;
|
|
31
31
|
});
|
|
32
|
-
get baseUrl(): string
|
|
32
|
+
get baseUrl(): string;
|
|
33
33
|
get token(): string | null;
|
|
34
|
-
get environment(): "local" | "staging" | "dev" | "prod"
|
|
34
|
+
get environment(): "local" | "staging" | "dev" | "prod";
|
|
35
35
|
get workerId(): string | null;
|
|
36
36
|
setEnvironment(environment: Environment): Promise<void>;
|
|
37
|
-
setBaseUrl(baseUrl: string): Promise<void>;
|
|
38
37
|
setToken(token: string | null): Promise<void>;
|
|
39
38
|
setWorkerId(workerId: string | null): Promise<void>;
|
|
40
39
|
get tokenInfo(): {
|
|
@@ -45,6 +44,7 @@ export declare class Config {
|
|
|
45
44
|
static load(opts: {
|
|
46
45
|
configFilePath: string;
|
|
47
46
|
processEnv: NodeJS.ProcessEnv;
|
|
47
|
+
flags: GlobalFlags;
|
|
48
48
|
}): Promise<Config>;
|
|
49
49
|
}
|
|
50
50
|
export declare function extractPayloadFromToken(token: string): {
|
package/dist/cli/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/cli/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/cli/config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,eAAO,MAAM,YAAY,8CAA+C,CAAC;AACzE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAExD,UAAU,SAAS;IAClB,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAM1D;AAED,qBAAa,gBAAiB,SAAQ,KAAK;gBAEzC,OAAO,GAAE,MAA6D;CAKvE;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,MAAM;;gBAIN,IAAI,EAAE;QACjB,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,SAAS,CAAC;KACtB;IAOD,IAAI,OAAO,WAEV;IAED,IAAI,KAAK,kBAER;IAED,IAAI,WAAW,yCAEd;IAED,IAAI,QAAQ,kBAEX;IAIK,cAAc,CAAC,WAAW,EAAE,WAAW;IAKvC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK7B,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAazC,IAAI,SAAS,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAQlE;WAEY,IAAI,CAAC,IAAI,EAAE;QACvB,cAAc,EAAE,MAAM,CAAC;QACvB,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC;QAC9B,KAAK,EAAE,WAAW,CAAC;KACnB;CAgED;AAQD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG;IACvD,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CACf,CAoCA"}
|
package/dist/cli/config.js
CHANGED
|
@@ -14,48 +14,42 @@ class TokenNotSetError extends Error {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
class Config {
|
|
17
|
-
#
|
|
17
|
+
#configMap;
|
|
18
18
|
#configFilePath;
|
|
19
|
-
#env;
|
|
20
19
|
constructor(opts) {
|
|
21
20
|
this.#configFilePath = opts.configFilePath;
|
|
22
|
-
this.#
|
|
23
|
-
this.#env = opts.processEnv;
|
|
21
|
+
this.#configMap = opts.configFile;
|
|
24
22
|
}
|
|
25
23
|
// Getters read from the environment variables, and then the config file.
|
|
26
24
|
get baseUrl() {
|
|
27
|
-
return this.#
|
|
25
|
+
return this.#configMap.baseUrl;
|
|
28
26
|
}
|
|
29
27
|
get token() {
|
|
30
|
-
return this.#
|
|
28
|
+
return this.#configMap.token;
|
|
31
29
|
}
|
|
32
30
|
get environment() {
|
|
33
|
-
return this.#
|
|
31
|
+
return this.#configMap.environment;
|
|
34
32
|
}
|
|
35
33
|
get workerId() {
|
|
36
|
-
return this.#
|
|
34
|
+
return this.#configMap.workerId;
|
|
37
35
|
}
|
|
38
36
|
// Setters update the config file, and then write it to disk.
|
|
39
37
|
async setEnvironment(environment) {
|
|
40
|
-
this.#
|
|
41
|
-
await this.#writeConfigFile();
|
|
42
|
-
}
|
|
43
|
-
async setBaseUrl(baseUrl) {
|
|
44
|
-
this.#configFile.baseUrl = baseUrl;
|
|
38
|
+
this.#configMap.environment = environment;
|
|
45
39
|
await this.#writeConfigFile();
|
|
46
40
|
}
|
|
47
41
|
async setToken(token) {
|
|
48
|
-
this.#
|
|
42
|
+
this.#configMap.token = token;
|
|
49
43
|
await this.#writeConfigFile();
|
|
50
44
|
}
|
|
51
45
|
async setWorkerId(workerId) {
|
|
52
|
-
this.#
|
|
46
|
+
this.#configMap.workerId = workerId;
|
|
53
47
|
await this.#writeConfigFile();
|
|
54
48
|
}
|
|
55
49
|
async #writeConfigFile() {
|
|
56
50
|
await fs.promises.writeFile(
|
|
57
51
|
this.#configFilePath,
|
|
58
|
-
JSON.stringify(this.#
|
|
52
|
+
JSON.stringify(this.#configMap, null, 2),
|
|
59
53
|
"utf-8"
|
|
60
54
|
);
|
|
61
55
|
}
|
|
@@ -70,10 +64,35 @@ class Config {
|
|
|
70
64
|
static async load(opts) {
|
|
71
65
|
const absConfigFilePath = path.resolve(process.cwd(), opts.configFilePath);
|
|
72
66
|
const configFile = await Config.#readConfigFile(absConfigFilePath);
|
|
67
|
+
if (opts.processEnv.WORKERS_TOKEN) {
|
|
68
|
+
configFile.token = opts.processEnv.WORKERS_TOKEN;
|
|
69
|
+
}
|
|
70
|
+
if (opts.processEnv.WORKERS_ENVIRONMENT) {
|
|
71
|
+
configFile.environment = parseEnvironment(
|
|
72
|
+
opts.processEnv.WORKERS_ENVIRONMENT
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
if (opts.processEnv.WORKERS_WORKER_ID) {
|
|
76
|
+
configFile.workerId = opts.processEnv.WORKERS_WORKER_ID;
|
|
77
|
+
}
|
|
78
|
+
if (opts.processEnv.WORKERS_BASE_URL) {
|
|
79
|
+
configFile.baseUrl = opts.processEnv.WORKERS_BASE_URL;
|
|
80
|
+
}
|
|
81
|
+
if (opts.flags.token) {
|
|
82
|
+
configFile.token = opts.flags.token;
|
|
83
|
+
}
|
|
84
|
+
if (opts.flags.env) {
|
|
85
|
+
configFile.environment = parseEnvironment(opts.flags.env);
|
|
86
|
+
}
|
|
87
|
+
if (opts.flags["base-url"]) {
|
|
88
|
+
configFile.baseUrl = opts.flags["base-url"];
|
|
89
|
+
}
|
|
90
|
+
if (opts.flags["worker-id"]) {
|
|
91
|
+
configFile.workerId = opts.flags["worker-id"];
|
|
92
|
+
}
|
|
73
93
|
return new Config({
|
|
74
94
|
configFilePath: absConfigFilePath,
|
|
75
|
-
configFile
|
|
76
|
-
processEnv: opts.processEnv
|
|
95
|
+
configFile
|
|
77
96
|
});
|
|
78
97
|
}
|
|
79
98
|
static async #readConfigFile(configFilePath) {
|
|
@@ -86,7 +105,12 @@ class Config {
|
|
|
86
105
|
configFile = JSON.parse(configContents);
|
|
87
106
|
} catch (error) {
|
|
88
107
|
if (isENOENT(error)) {
|
|
89
|
-
configFile = {
|
|
108
|
+
configFile = {
|
|
109
|
+
token: null,
|
|
110
|
+
workerId: null,
|
|
111
|
+
environment: "prod",
|
|
112
|
+
baseUrl: baseUrl("prod")
|
|
113
|
+
};
|
|
90
114
|
} else {
|
|
91
115
|
throw error;
|
|
92
116
|
}
|
|
@@ -125,6 +149,18 @@ function extractPayloadFromToken(token) {
|
|
|
125
149
|
throw new Error("Failed to parse token payload.");
|
|
126
150
|
}
|
|
127
151
|
}
|
|
152
|
+
function baseUrl(environment) {
|
|
153
|
+
switch (environment) {
|
|
154
|
+
case "local":
|
|
155
|
+
return "http://localhost:3000";
|
|
156
|
+
case "staging":
|
|
157
|
+
return "https://staging.notion.so";
|
|
158
|
+
case "dev":
|
|
159
|
+
return "https://dev.notion.so";
|
|
160
|
+
case "prod":
|
|
161
|
+
return "https://www.notion.so";
|
|
162
|
+
}
|
|
163
|
+
}
|
|
128
164
|
export {
|
|
129
165
|
Config,
|
|
130
166
|
Environments,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.test.d.ts","sourceRoot":"","sources":["../../src/cli/config.test.ts"],"names":[],"mappings":""}
|
package/dist/cli/flags.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { TypedFlagParameter } from "@stricli/core";
|
|
2
|
+
import { type Environment } from "./config.js";
|
|
2
3
|
import type { LocalContext } from "./context.js";
|
|
3
4
|
export interface GlobalFlags {
|
|
4
5
|
config?: string;
|
|
5
6
|
debug: boolean;
|
|
7
|
+
env?: Environment;
|
|
8
|
+
"base-url"?: string;
|
|
9
|
+
token?: string;
|
|
10
|
+
"worker-id"?: string;
|
|
6
11
|
}
|
|
7
12
|
export declare const globalFlags: {
|
|
8
13
|
[K in keyof Required<GlobalFlags>]: TypedFlagParameter<GlobalFlags[K], LocalContext>;
|
package/dist/cli/flags.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../src/cli/flags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,WAAW;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../src/cli/flags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,KAAK,WAAW,EAAgB,MAAM,aAAa,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,MAAM,WAAW,WAAW;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,WAAW,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,WAAW,EAAE;KACxB,CAAC,IAAI,MAAM,QAAQ,CAAC,WAAW,CAAC,GAAG,kBAAkB,CACrD,WAAW,CAAC,CAAC,CAAC,EACd,YAAY,CACZ;CAqCD,CAAC;AAEF,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,OAAO,CAAC;CACf;AAED,eAAO,MAAM,WAAW,EAAE;KACxB,CAAC,IAAI,MAAM,QAAQ,CAAC,WAAW,CAAC,GAAG,kBAAkB,CACrD,WAAW,CAAC,CAAC,CAAC,EACd,YAAY,CACZ;CAOD,CAAC"}
|
package/dist/cli/flags.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Environments } from "./config.js";
|
|
1
2
|
const globalFlags = {
|
|
2
3
|
config: {
|
|
3
4
|
kind: "parsed",
|
|
@@ -9,6 +10,30 @@ const globalFlags = {
|
|
|
9
10
|
kind: "boolean",
|
|
10
11
|
brief: "Enable debug logging",
|
|
11
12
|
default: false
|
|
13
|
+
},
|
|
14
|
+
env: {
|
|
15
|
+
kind: "enum",
|
|
16
|
+
values: Environments,
|
|
17
|
+
brief: "The environment to use for the command",
|
|
18
|
+
optional: true
|
|
19
|
+
},
|
|
20
|
+
"base-url": {
|
|
21
|
+
kind: "parsed",
|
|
22
|
+
parse: String,
|
|
23
|
+
brief: "The base URL to use for all API requests",
|
|
24
|
+
optional: true
|
|
25
|
+
},
|
|
26
|
+
token: {
|
|
27
|
+
kind: "parsed",
|
|
28
|
+
parse: String,
|
|
29
|
+
brief: "The token to use for authentication",
|
|
30
|
+
optional: true
|
|
31
|
+
},
|
|
32
|
+
"worker-id": {
|
|
33
|
+
kind: "parsed",
|
|
34
|
+
parse: String,
|
|
35
|
+
brief: "The ID of the worker to use for the command",
|
|
36
|
+
optional: true
|
|
12
37
|
}
|
|
13
38
|
};
|
|
14
39
|
const formatFlags = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/cli/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,cAAe,SAAQ,YAAY;IACnD,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc;IACpD,SAAS,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,SAAS,QAAQ,GAAG,EAAE,EACzE,OAAO,EAAE,CACR,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,KAAK,EACZ,GAAG,IAAI,EAAE,IAAI,KACT,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,IAGxB,MAAM,YAAY,EAClB,OAAO,WAAW,GAAG,KAAK,EAC1B,GAAG,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/cli/handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,MAAM,WAAW,cAAe,SAAQ,YAAY;IACnD,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc;IACpD,SAAS,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,YAAY,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,SAAS,QAAQ,GAAG,EAAE,EACzE,OAAO,EAAE,CACR,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,KAAK,EACZ,GAAG,IAAI,EAAE,IAAI,KACT,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,IAGxB,MAAM,YAAY,EAClB,OAAO,WAAW,GAAG,KAAK,EAC1B,GAAG,MAAM,IAAI,mBAiBd;AAED,wBAAgB,kBAAkB,CACjC,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,IAAI,SAAS,QAAQ,GAAG,EAAE,EAEhC,OAAO,EAAE,CACR,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,KAAK,EACZ,GAAG,IAAI,EAAE,IAAI,KACT,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,UA7BlB,YAAY,8DA6CnB"}
|
package/dist/cli/handler.js
CHANGED
|
@@ -2,10 +2,11 @@ import { ApiClient } from "./api/client.js";
|
|
|
2
2
|
import { Config } from "./config.js";
|
|
3
3
|
function buildHandler(handler) {
|
|
4
4
|
return async function(flags, ...args) {
|
|
5
|
-
const configFilePath = this.process.env.WORKERS_CONFIG_FILE_PATH ??
|
|
5
|
+
const configFilePath = flags.config ?? this.process.env.WORKERS_CONFIG_FILE_PATH ?? "./workers.json";
|
|
6
6
|
const config = await Config.load({
|
|
7
7
|
configFilePath,
|
|
8
|
-
processEnv: process.env
|
|
8
|
+
processEnv: process.env,
|
|
9
|
+
flags
|
|
9
10
|
});
|
|
10
11
|
this.writer.debugEnabled = flags.debug;
|
|
11
12
|
await handler.call({ ...this, config }, flags, ...args);
|
|
@@ -15,9 +16,6 @@ function buildAuthedHandler(handler) {
|
|
|
15
16
|
return buildHandler(function(flags, ...args) {
|
|
16
17
|
const { token, cellId } = this.config.tokenInfo;
|
|
17
18
|
const environment = this.config.environment;
|
|
18
|
-
if (!environment) {
|
|
19
|
-
throw new Error("Unexpected error: Environment not set");
|
|
20
|
-
}
|
|
21
19
|
const client = new ApiClient({
|
|
22
20
|
token,
|
|
23
21
|
environment,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@project-ajax/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.51",
|
|
4
4
|
"description": "An SDK for building workers for the Project Ajax platform",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"build:watch": "concurrently --group \"npm run build:watch:types\" \"npm run build:watch:js\"",
|
|
61
61
|
"build:watch:types": "tsc --watch",
|
|
62
62
|
"build:watch:js": "esbuild --watch --format=esm --outdir=dist --target=esnext --packages=external ./src/cli/bin/cli.ts ./src/**.ts ./src/**/*.ts ./src/cli/**/*.ts",
|
|
63
|
-
"test": "vitest"
|
|
63
|
+
"test": "vitest run"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@types/node": "^24.10.0",
|
package/src/capabilities/sync.ts
CHANGED
|
@@ -13,6 +13,11 @@ export type SyncedObject<PK extends string, S extends PropertySchema<PK>> = {
|
|
|
13
13
|
* Use the `icon()` builder to create an icon value.
|
|
14
14
|
*/
|
|
15
15
|
icon?: Icon;
|
|
16
|
+
/**
|
|
17
|
+
* Optional markdown content to add to the page.
|
|
18
|
+
* This will be converted to blocks and added as page content.
|
|
19
|
+
*/
|
|
20
|
+
pageContentMarkdown?: string;
|
|
16
21
|
};
|
|
17
22
|
|
|
18
23
|
/**
|