ntion 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/README.md +204 -0
- package/dist/audit/log.d.ts +10 -0
- package/dist/audit/log.js +18 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +939 -0
- package/dist/commands/context.d.ts +17 -0
- package/dist/commands/context.js +35 -0
- package/dist/commands/mutation.d.ts +8 -0
- package/dist/commands/mutation.js +102 -0
- package/dist/commands/output.d.ts +7 -0
- package/dist/commands/output.js +22 -0
- package/dist/concurrency/versioning.d.ts +1 -0
- package/dist/concurrency/versioning.js +5 -0
- package/dist/config/paths.d.ts +5 -0
- package/dist/config/paths.js +26 -0
- package/dist/config/store.d.ts +5 -0
- package/dist/config/store.js +72 -0
- package/dist/config/types.d.ts +141 -0
- package/dist/config/types.js +26 -0
- package/dist/contracts/envelope.d.ts +32 -0
- package/dist/contracts/envelope.js +35 -0
- package/dist/errors/cli-error.d.ts +11 -0
- package/dist/errors/cli-error.js +59 -0
- package/dist/errors/codes.d.ts +2 -0
- package/dist/errors/codes.js +9 -0
- package/dist/idempotency/store.d.ts +34 -0
- package/dist/idempotency/store.js +120 -0
- package/dist/notion/client.d.ts +17 -0
- package/dist/notion/client.js +140 -0
- package/dist/notion/mappers.d.ts +5 -0
- package/dist/notion/mappers.js +224 -0
- package/dist/notion/markdown.d.ts +1 -0
- package/dist/notion/markdown.js +237 -0
- package/dist/notion/properties.d.ts +7 -0
- package/dist/notion/properties.js +267 -0
- package/dist/notion/repository.d.ts +142 -0
- package/dist/notion/repository.js +998 -0
- package/dist/notion/types.d.ts +4 -0
- package/dist/notion/types.js +1 -0
- package/dist/utils/json.d.ts +3 -0
- package/dist/utils/json.js +32 -0
- package/package.json +34 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { CliError } from "../errors/cli-error.js";
|
|
3
|
+
export function stableStringify(value) {
|
|
4
|
+
return JSON.stringify(sortValue(value));
|
|
5
|
+
}
|
|
6
|
+
function sortValue(value) {
|
|
7
|
+
if (Array.isArray(value)) {
|
|
8
|
+
return value.map((item) => sortValue(item));
|
|
9
|
+
}
|
|
10
|
+
if (value && typeof value === "object") {
|
|
11
|
+
const entries = Object.entries(value).sort(([a], [b]) => a.localeCompare(b));
|
|
12
|
+
const output = {};
|
|
13
|
+
for (const [key, child] of entries) {
|
|
14
|
+
output[key] = sortValue(child);
|
|
15
|
+
}
|
|
16
|
+
return output;
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
export function hashObject(value) {
|
|
21
|
+
return createHash("sha256").update(stableStringify(value)).digest("hex");
|
|
22
|
+
}
|
|
23
|
+
export function parseJsonOption(label, raw) {
|
|
24
|
+
try {
|
|
25
|
+
return JSON.parse(raw);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
throw new CliError("invalid_input", `Failed to parse ${label} as JSON.`, {
|
|
29
|
+
details: error.message,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ntion",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Token-efficient CLI for personal Notion workspaces",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"ntion": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc -p tsconfig.json",
|
|
15
|
+
"typecheck": "tsc --noEmit",
|
|
16
|
+
"dev": "tsx src/cli.ts",
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"prepublishOnly": "npm run build"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=20"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@notionhq/client": "^5.1.0",
|
|
25
|
+
"commander": "^12.1.0",
|
|
26
|
+
"zod": "^3.23.8"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/node": "^22.10.1",
|
|
30
|
+
"tsx": "^4.19.2",
|
|
31
|
+
"typescript": "^5.6.3",
|
|
32
|
+
"vitest": "^2.1.5"
|
|
33
|
+
}
|
|
34
|
+
}
|