@mulmoclaude/core 5.12.1 → 5.13.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/assets/helps/presenthtml.md +18 -0
- package/dist/artifacts/paths.cjs +1 -2
- package/dist/artifacts/paths.js +1 -2
- package/dist/collection/firestore.cjs +1 -2
- package/dist/collection/firestore.js +1 -2
- package/dist/collection/index.cjs +18 -30
- package/dist/collection/index.cjs.map +1 -1
- package/dist/collection/index.js +18 -30
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/paths.cjs +1 -1
- package/dist/collection/paths.js +1 -1
- package/dist/collection/registry/index.cjs +1 -1
- package/dist/collection/registry/index.js +1 -1
- package/dist/collection/registry/server/index.cjs +17 -26
- package/dist/collection/registry/server/index.cjs.map +1 -1
- package/dist/collection/registry/server/index.js +16 -25
- package/dist/collection/registry/server/index.js.map +1 -1
- package/dist/collection/server/index.cjs +5 -5
- package/dist/collection/server/index.js +5 -5
- package/dist/collection-watchers/index.cjs +10 -14
- package/dist/collection-watchers/index.cjs.map +1 -1
- package/dist/collection-watchers/index.js +10 -14
- package/dist/collection-watchers/index.js.map +1 -1
- package/dist/{discovery-DgZRmO7F.cjs → discovery-CYIV1J5l.cjs} +25 -42
- package/dist/{discovery-DgZRmO7F.cjs.map → discovery-CYIV1J5l.cjs.map} +1 -1
- package/dist/{discovery-CbwHtcwk.js → discovery-duLlygnJ.js} +24 -41
- package/dist/{discovery-CbwHtcwk.js.map → discovery-duLlygnJ.js.map} +1 -1
- package/dist/{dist-BZ62pKuU.cjs → dist-734JaRYi.cjs} +2 -4
- package/dist/{dist-BZ62pKuU.cjs.map → dist-734JaRYi.cjs.map} +1 -1
- package/dist/{dist-MFUV9FYo.js → dist-BmO4oSQy.js} +2 -4
- package/dist/{dist-MFUV9FYo.js.map → dist-BmO4oSQy.js.map} +1 -1
- package/dist/errorMessage-D0kR547_.cjs +1 -0
- package/dist/errorMessage-TpKxrmeo.js +1 -0
- package/dist/{errors-zTAsW7dS.js → errors-0QwjDxsv.js} +3 -4
- package/dist/{errors-zTAsW7dS.js.map → errors-0QwjDxsv.js.map} +1 -1
- package/dist/{errors-B0xloJ3E.cjs → errors-B9mCEVG9.cjs} +3 -4
- package/dist/{errors-B0xloJ3E.cjs.map → errors-B9mCEVG9.cjs.map} +1 -1
- package/dist/feeds/index.cjs +2 -2
- package/dist/feeds/index.js +2 -2
- package/dist/feeds/paths.cjs +2 -3
- package/dist/feeds/paths.js +1 -2
- package/dist/feeds/server/index.cjs +23 -37
- package/dist/feeds/server/index.cjs.map +1 -1
- package/dist/feeds/server/index.js +22 -36
- package/dist/feeds/server/index.js.map +1 -1
- package/dist/file-change/index.cjs +2 -3
- package/dist/file-change/index.js +1 -2
- package/dist/files/index.cjs +136 -11
- package/dist/files/index.cjs.map +1 -1
- package/dist/files/index.d.ts +1 -0
- package/dist/files/index.js +132 -12
- package/dist/files/index.js.map +1 -1
- package/dist/files/verified.d.ts +28 -0
- package/dist/global-config/index.cjs +3 -5
- package/dist/global-config/index.cjs.map +1 -1
- package/dist/global-config/index.js +3 -5
- package/dist/global-config/index.js.map +1 -1
- package/dist/google/index.cjs +38 -67
- package/dist/google/index.cjs.map +1 -1
- package/dist/google/index.js +37 -66
- package/dist/google/index.js.map +1 -1
- package/dist/{graph-CURotEkH.cjs → graph-BvVMZfDV.cjs} +6 -11
- package/dist/{graph-CURotEkH.cjs.map → graph-BvVMZfDV.cjs.map} +1 -1
- package/dist/{graph-DBxSOx3v.js → graph-DBbzemby.js} +6 -11
- package/dist/{graph-DBxSOx3v.js.map → graph-DBbzemby.js.map} +1 -1
- package/dist/{iconGlyph-fSBp6k4J.cjs → iconGlyph-CFOiFsmq.cjs} +2 -3
- package/dist/{iconGlyph-fSBp6k4J.cjs.map → iconGlyph-CFOiFsmq.cjs.map} +1 -1
- package/dist/{iconGlyph-D8JeNg7R.js → iconGlyph-D9h__VaM.js} +2 -3
- package/dist/{iconGlyph-D8JeNg7R.js.map → iconGlyph-D9h__VaM.js.map} +1 -1
- package/dist/{ingestTypes-DS9HiR2I.cjs → ingestTypes-CLDvn7kw.cjs} +3 -4
- package/dist/{ingestTypes-DS9HiR2I.cjs.map → ingestTypes-CLDvn7kw.cjs.map} +1 -1
- package/dist/{ingestTypes-Bs31Xt5c.js → ingestTypes-DuXuSBSn.js} +3 -4
- package/dist/{ingestTypes-Bs31Xt5c.js.map → ingestTypes-DuXuSBSn.js.map} +1 -1
- package/dist/{itemId-CVrNibwT.cjs → itemId-D2XAQ8RU.cjs} +9 -17
- package/dist/{itemId-CVrNibwT.cjs.map → itemId-D2XAQ8RU.cjs.map} +1 -1
- package/dist/{itemId-C9s-Jd5s.js → itemId-D_pSpa3U.js} +9 -17
- package/dist/{itemId-C9s-Jd5s.js.map → itemId-D_pSpa3U.js.map} +1 -1
- package/dist/{listen-N_8XdKz_.cjs → listen-OmfLDX1l.cjs} +3 -4
- package/dist/{listen-N_8XdKz_.cjs.map → listen-OmfLDX1l.cjs.map} +1 -1
- package/dist/{listen-DUlzSOzX.js → listen-uiEnXcW9.js} +3 -4
- package/dist/{listen-DUlzSOzX.js.map → listen-uiEnXcW9.js.map} +1 -1
- package/dist/notifier/index.cjs +1 -1
- package/dist/notifier/index.js +1 -1
- package/dist/{notifier-CiemUClt.cjs → notifier-CRTk34EC.cjs} +6 -10
- package/dist/{notifier-CiemUClt.cjs.map → notifier-CRTk34EC.cjs.map} +1 -1
- package/dist/{notifier-dgkC-h80.js → notifier-htdf4ekH.js} +6 -10
- package/dist/{notifier-dgkC-h80.js.map → notifier-htdf4ekH.js.map} +1 -1
- package/dist/{paths-CkJxNZ7T.js → paths-BMQNHdaJ.js} +2 -3
- package/dist/{paths-CkJxNZ7T.js.map → paths-BMQNHdaJ.js.map} +1 -1
- package/dist/{paths-C8-jxR0s.cjs → paths-DUHAueEv.cjs} +2 -3
- package/dist/{paths-C8-jxR0s.cjs.map → paths-DUHAueEv.cjs.map} +1 -1
- package/dist/plugin-vue/i18n.cjs +1 -2
- package/dist/plugin-vue/i18n.js +1 -2
- package/dist/plugin-vue/index.cjs +9 -17
- package/dist/plugin-vue/index.cjs.map +1 -1
- package/dist/plugin-vue/index.js +9 -17
- package/dist/plugin-vue/index.js.map +1 -1
- package/dist/{project-C1ep9pvo.cjs → project-DDTIVEMU.cjs} +2 -3
- package/dist/{project-C1ep9pvo.cjs.map → project-DDTIVEMU.cjs.map} +1 -1
- package/dist/{project-B0j_Vf_Q.js → project-mU6-xLfy.js} +2 -3
- package/dist/{project-B0j_Vf_Q.js.map → project-mU6-xLfy.js.map} +1 -1
- package/dist/prompt-files/index.cjs +4 -6
- package/dist/prompt-files/index.cjs.map +1 -1
- package/dist/prompt-files/index.js +3 -5
- package/dist/prompt-files/index.js.map +1 -1
- package/dist/{promptSafety-DFaOnOWN.js → promptSafety-B8LECAkY.js} +14 -25
- package/dist/{promptSafety-DFaOnOWN.js.map → promptSafety-B8LECAkY.js.map} +1 -1
- package/dist/{promptSafety-yET9jLep.cjs → promptSafety-CjxafW2b.cjs} +14 -25
- package/dist/{promptSafety-yET9jLep.cjs.map → promptSafety-CjxafW2b.cjs.map} +1 -1
- package/dist/{relPath-DW8MC8VO.js → relPath-BkKmqiiF.js} +2 -3
- package/dist/{relPath-DW8MC8VO.js.map → relPath-BkKmqiiF.js.map} +1 -1
- package/dist/{relPath-CTAjGdCL.cjs → relPath-CZiP2S_a.cjs} +3 -4
- package/dist/{relPath-CTAjGdCL.cjs.map → relPath-CZiP2S_a.cjs.map} +1 -1
- package/dist/remote-host/index.cjs +1 -1
- package/dist/remote-host/index.js +1 -1
- package/dist/remote-host/server/index.cjs +14 -25
- package/dist/remote-host/server/index.cjs.map +1 -1
- package/dist/remote-host/server/index.js +14 -25
- package/dist/remote-host/server/index.js.map +1 -1
- package/dist/{remote-host-CR5W9uj4.cjs → remote-host-BW_eH-Nu.cjs} +4 -6
- package/dist/{remote-host-CR5W9uj4.cjs.map → remote-host-BW_eH-Nu.cjs.map} +1 -1
- package/dist/{remote-host-9NNAvUhU.js → remote-host-CSeDNbE6.js} +4 -6
- package/dist/{remote-host-9NNAvUhU.js.map → remote-host-CSeDNbE6.js.map} +1 -1
- package/dist/remote-view/index.cjs +3 -4
- package/dist/remote-view/index.js +3 -4
- package/dist/{rolldown-runtime-VH7oDXx4.cjs → rolldown-runtime-CmQyd0Gu.cjs} +1 -2
- package/dist/{root-BvwBUcol.cjs → root-9lRFeXbm.cjs} +10 -6
- package/dist/{root-BvwBUcol.cjs.map → root-9lRFeXbm.cjs.map} +1 -1
- package/dist/{root-BcS4-Kge.js → root-CqxPNSyK.js} +4 -6
- package/dist/{root-BcS4-Kge.js.map → root-CqxPNSyK.js.map} +1 -1
- package/dist/scheduler/index.cjs +6 -9
- package/dist/scheduler/index.cjs.map +1 -1
- package/dist/scheduler/index.js +5 -8
- package/dist/scheduler/index.js.map +1 -1
- package/dist/{server-CJek9Y3Q.cjs → server-ByKWGQn2.cjs} +25 -41
- package/dist/{server-CJek9Y3Q.cjs.map → server-ByKWGQn2.cjs.map} +1 -1
- package/dist/{server-BtbbQqBY.js → server-CA-alqqN.js} +24 -40
- package/dist/{server-BtbbQqBY.js.map → server-CA-alqqN.js.map} +1 -1
- package/dist/skill-bridge/index.cjs +3 -4
- package/dist/skill-bridge/index.js +2 -3
- package/dist/{slug-BpjumQfe.js → slug-D24AYqCZ.js} +2 -3
- package/dist/{slug-BpjumQfe.js.map → slug-D24AYqCZ.js.map} +1 -1
- package/dist/{slug-JxgB0ru9.cjs → slug-DVkuPjIv.cjs} +2 -3
- package/dist/{slug-JxgB0ru9.cjs.map → slug-DVkuPjIv.cjs.map} +1 -1
- package/dist/{templatePath-27vUZowm.cjs → templatePath-BIh7wqgS.cjs} +2 -3
- package/dist/{templatePath-27vUZowm.cjs.map → templatePath-BIh7wqgS.cjs.map} +1 -1
- package/dist/{templatePath-k_WNbL_Q.js → templatePath-CB3wtVpe.js} +2 -3
- package/dist/{templatePath-k_WNbL_Q.js.map → templatePath-CB3wtVpe.js.map} +1 -1
- package/dist/{text-CjDbP2O1.js → text-BQAuwKVj.js} +2 -3
- package/dist/{text-CjDbP2O1.js.map → text-BQAuwKVj.js.map} +1 -1
- package/dist/{text-CaAh9ZSO.cjs → text-BQiyo5R9.cjs} +2 -3
- package/dist/{text-CaAh9ZSO.cjs.map → text-BQiyo5R9.cjs.map} +1 -1
- package/dist/translation/client.cjs +1 -2
- package/dist/translation/client.js +1 -2
- package/dist/{types-BKVZrtyc.js → types-BLCZTGW2.js} +4 -7
- package/dist/{types-BKVZrtyc.js.map → types-BLCZTGW2.js.map} +1 -1
- package/dist/{types-CNqkLT4M.cjs → types-DPycxnDf.cjs} +4 -7
- package/dist/{types-CNqkLT4M.cjs.map → types-DPycxnDf.cjs.map} +1 -1
- package/dist/utils/fetch.cjs +0 -1
- package/dist/utils/fetch.js +0 -1
- package/dist/utils/index.cjs +3 -3
- package/dist/utils/index.js +3 -3
- package/dist/whisper/client.cjs +2 -4
- package/dist/whisper/client.cjs.map +1 -1
- package/dist/whisper/client.js +2 -4
- package/dist/whisper/client.js.map +1 -1
- package/dist/whisper/index.cjs +9 -15
- package/dist/whisper/index.cjs.map +1 -1
- package/dist/whisper/index.js +8 -14
- package/dist/whisper/index.js.map +1 -1
- package/dist/wiki/index.cjs +5 -7
- package/dist/wiki/index.cjs.map +1 -1
- package/dist/wiki/index.js +5 -7
- package/dist/wiki/index.js.map +1 -1
- package/dist/wiki/paths.cjs +3 -4
- package/dist/wiki/paths.js +2 -3
- package/dist/wiki/server/index.cjs +7 -11
- package/dist/wiki/server/index.cjs.map +1 -1
- package/dist/wiki/server/index.js +6 -10
- package/dist/wiki/server/index.js.map +1 -1
- package/dist/workspace-setup/index.js +4 -9
- package/dist/workspace-setup/index.js.map +1 -1
- package/dist/workspace-setup/slug.js +1 -2
- package/package.json +2 -2
- package/dist/errorMessage-OEQzRwsi.cjs +0 -1
- package/dist/errorMessage-VEiXHRnX.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_paths = require("../paths-
|
|
2
|
+
const require_paths = require("../paths-DUHAueEv.cjs");
|
|
3
3
|
let node_fs_promises = require("node:fs/promises");
|
|
4
|
-
|
|
4
|
+
// src/global-config/schema.ts
|
|
5
5
|
/** A user-supplied regular expression source is compiled and then run against
|
|
6
6
|
* whole documents on every keystroke. Length is the cheap, honest guard: it
|
|
7
7
|
* bounds how baroque — and so how catastrophically backtracking — the pattern
|
|
@@ -37,8 +37,7 @@ function readDocumentBookmarkPattern(config) {
|
|
|
37
37
|
if (pattern.length === 0 || pattern.length > 200) return null;
|
|
38
38
|
return compiles(pattern) ? pattern : null;
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
//#region src/global-config/index.ts
|
|
40
|
+
// src/global-config/index.ts
|
|
42
41
|
/**
|
|
43
42
|
* Parse `~/.config/mulmo/config.json`. Returns `null` when the file is absent
|
|
44
43
|
* or unparseable — both are ordinary states (there is no UI that creates it),
|
|
@@ -58,7 +57,6 @@ async function readMulmoGlobalConfig(home) {
|
|
|
58
57
|
async function loadDocumentBookmarkPattern(home) {
|
|
59
58
|
return readDocumentBookmarkPattern(await readMulmoGlobalConfig(home));
|
|
60
59
|
}
|
|
61
|
-
//#endregion
|
|
62
60
|
exports.MAX_BOOKMARK_PATTERN_LENGTH = MAX_BOOKMARK_PATTERN_LENGTH;
|
|
63
61
|
exports.loadDocumentBookmarkPattern = loadDocumentBookmarkPattern;
|
|
64
62
|
exports.mulmoConfigDir = require_paths.mulmoConfigDir;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["readFile","mulmoGlobalConfigPath"],"sources":["../../src/global-config/schema.ts","../../src/global-config/index.ts"],"sourcesContent":["// Pure readers over the parsed `~/.config/mulmo/config.json` document. No IO\n// here so the validation rules are unit-testable without a filesystem, and so a\n// host that already has the document in memory can reuse them.\n//\n// Every reader is TOLERANT by design: this file is hand-edited (there is no UI\n// for it yet), and a typo in one key must not take out the app or the other\n// keys. An unusable value reads as \"not configured\" and the caller applies its\n// own default.\n\n/** A user-supplied regular expression source is compiled and then run against\n * whole documents on every keystroke. Length is the cheap, honest guard: it\n * bounds how baroque — and so how catastrophically backtracking — the pattern\n * can be, without pretending to be a ReDoS analyser. The file is machine-local\n * and hand-written, so the threat model is \"the user's own typo\", not attack. */\nexport const MAX_BOOKMARK_PATTERN_LENGTH = 200;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** True when `source` compiles as a regular expression. `new RegExp` is the\n * only real validator — there is no cheaper way to reject `\"^([a-z\"`. */\nfunction compiles(source: string): boolean {\n try {\n return RegExp(source) instanceof RegExp;\n } catch {\n return false;\n }\n}\n\n/**\n * `documentBookmarks.pattern` — the regex whose matches the markdown source\n * editor marks in its left-edge rail. Returns the raw SOURCE string (not a\n * compiled RegExp): the value crosses a JSON dispatch hop to the browser, which\n * compiles it there.\n *\n * Returns null — meaning \"not configured, use your default\" — for a missing\n * file, a missing key, a non-string, an empty string, an over-long string, or\n * one that does not compile.\n */\nexport function readDocumentBookmarkPattern(config: unknown): string | null {\n if (!isRecord(config)) return null;\n const { documentBookmarks } = config;\n if (!isRecord(documentBookmarks)) return null;\n const { pattern } = documentBookmarks;\n if (typeof pattern !== \"string\") return null;\n if (pattern.length === 0 || pattern.length > MAX_BOOKMARK_PATTERN_LENGTH) return null;\n return compiles(pattern) ? pattern : null;\n}\n","// Entry point for `@mulmoclaude/core/global-config` — the host-neutral\n// per-user config file (`~/.config/mulmo/config.json`) shared by MulmoClaude\n// and MulmoTerminal. Server-only (node:fs); the values it yields are plain\n// JSON, so they cross a dispatch hop to a plugin View unchanged.\nimport { readFile } from \"node:fs/promises\";\nimport { mulmoGlobalConfigPath } from \"./paths.js\";\nimport { readDocumentBookmarkPattern } from \"./schema.js\";\n\nexport { mulmoConfigDir, mulmoGlobalConfigPath } from \"./paths.js\";\nexport { readDocumentBookmarkPattern, MAX_BOOKMARK_PATTERN_LENGTH } from \"./schema.js\";\n\n/**\n * Parse `~/.config/mulmo/config.json`. Returns `null` when the file is absent\n * or unparseable — both are ordinary states (there is no UI that creates it),\n * and every reader in `./schema` treats `null` as \"nothing configured\".\n *\n * Not cached: the file is read at most once per view open, and caching would\n * mean a hand-edit needs an app restart to take effect.\n */\nexport async function readMulmoGlobalConfig(home?: string): Promise<unknown> {\n try {\n return JSON.parse(await readFile(mulmoGlobalConfigPath(home), \"utf-8\"));\n } catch {\n return null;\n }\n}\n\n/** Convenience: the configured document-bookmark regex source, or null. */\nexport async function loadDocumentBookmarkPattern(home?: string): Promise<string | null> {\n return readDocumentBookmarkPattern(await readMulmoGlobalConfig(home));\n}\n"],"mappings":";;;;;;;;;AAcA,IAAa,8BAA8B;AAE3C,IAAM,YAAY,UAAqD,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;;;AAI1I,SAAS,SAAS,QAAyB;CACzC,IAAI;EACF,OAAO,OAAO,MAAM,aAAa;CACnC,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;;;;;AAYA,SAAgB,4BAA4B,QAAgC;CAC1E,IAAI,CAAC,SAAS,MAAM,GAAG,OAAO;CAC9B,MAAM,EAAE,sBAAsB;CAC9B,IAAI,CAAC,SAAS,iBAAiB,GAAG,OAAO;CACzC,MAAM,EAAE,YAAY;CACpB,IAAI,OAAO,YAAY,UAAU,OAAO;CACxC,IAAI,QAAQ,WAAW,KAAK,QAAQ,SAAA,KAAsC,OAAO;CACjF,OAAO,SAAS,OAAO,IAAI,UAAU;AACvC
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["readFile","mulmoGlobalConfigPath"],"sources":["../../src/global-config/schema.ts","../../src/global-config/index.ts"],"sourcesContent":["// Pure readers over the parsed `~/.config/mulmo/config.json` document. No IO\n// here so the validation rules are unit-testable without a filesystem, and so a\n// host that already has the document in memory can reuse them.\n//\n// Every reader is TOLERANT by design: this file is hand-edited (there is no UI\n// for it yet), and a typo in one key must not take out the app or the other\n// keys. An unusable value reads as \"not configured\" and the caller applies its\n// own default.\n\n/** A user-supplied regular expression source is compiled and then run against\n * whole documents on every keystroke. Length is the cheap, honest guard: it\n * bounds how baroque — and so how catastrophically backtracking — the pattern\n * can be, without pretending to be a ReDoS analyser. The file is machine-local\n * and hand-written, so the threat model is \"the user's own typo\", not attack. */\nexport const MAX_BOOKMARK_PATTERN_LENGTH = 200;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** True when `source` compiles as a regular expression. `new RegExp` is the\n * only real validator — there is no cheaper way to reject `\"^([a-z\"`. */\nfunction compiles(source: string): boolean {\n try {\n return RegExp(source) instanceof RegExp;\n } catch {\n return false;\n }\n}\n\n/**\n * `documentBookmarks.pattern` — the regex whose matches the markdown source\n * editor marks in its left-edge rail. Returns the raw SOURCE string (not a\n * compiled RegExp): the value crosses a JSON dispatch hop to the browser, which\n * compiles it there.\n *\n * Returns null — meaning \"not configured, use your default\" — for a missing\n * file, a missing key, a non-string, an empty string, an over-long string, or\n * one that does not compile.\n */\nexport function readDocumentBookmarkPattern(config: unknown): string | null {\n if (!isRecord(config)) return null;\n const { documentBookmarks } = config;\n if (!isRecord(documentBookmarks)) return null;\n const { pattern } = documentBookmarks;\n if (typeof pattern !== \"string\") return null;\n if (pattern.length === 0 || pattern.length > MAX_BOOKMARK_PATTERN_LENGTH) return null;\n return compiles(pattern) ? pattern : null;\n}\n","// Entry point for `@mulmoclaude/core/global-config` — the host-neutral\n// per-user config file (`~/.config/mulmo/config.json`) shared by MulmoClaude\n// and MulmoTerminal. Server-only (node:fs); the values it yields are plain\n// JSON, so they cross a dispatch hop to a plugin View unchanged.\nimport { readFile } from \"node:fs/promises\";\nimport { mulmoGlobalConfigPath } from \"./paths.js\";\nimport { readDocumentBookmarkPattern } from \"./schema.js\";\n\nexport { mulmoConfigDir, mulmoGlobalConfigPath } from \"./paths.js\";\nexport { readDocumentBookmarkPattern, MAX_BOOKMARK_PATTERN_LENGTH } from \"./schema.js\";\n\n/**\n * Parse `~/.config/mulmo/config.json`. Returns `null` when the file is absent\n * or unparseable — both are ordinary states (there is no UI that creates it),\n * and every reader in `./schema` treats `null` as \"nothing configured\".\n *\n * Not cached: the file is read at most once per view open, and caching would\n * mean a hand-edit needs an app restart to take effect.\n */\nexport async function readMulmoGlobalConfig(home?: string): Promise<unknown> {\n try {\n return JSON.parse(await readFile(mulmoGlobalConfigPath(home), \"utf-8\"));\n } catch {\n return null;\n }\n}\n\n/** Convenience: the configured document-bookmark regex source, or null. */\nexport async function loadDocumentBookmarkPattern(home?: string): Promise<string | null> {\n return readDocumentBookmarkPattern(await readMulmoGlobalConfig(home));\n}\n"],"mappings":";;;;;;;;;AAcA,IAAa,8BAA8B;AAE3C,IAAM,YAAY,UAAqD,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;;;AAI1I,SAAS,SAAS,QAAyB;CACzC,IAAI;EACF,OAAO,OAAO,MAAM,aAAa;CACnC,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;;;;;AAYA,SAAgB,4BAA4B,QAAgC;CAC1E,IAAI,CAAC,SAAS,MAAM,GAAG,OAAO;CAC9B,MAAM,EAAE,sBAAsB;CAC9B,IAAI,CAAC,SAAS,iBAAiB,GAAG,OAAO;CACzC,MAAM,EAAE,YAAY;CACpB,IAAI,OAAO,YAAY,UAAU,OAAO;CACxC,IAAI,QAAQ,WAAW,KAAK,QAAQ,SAAA,KAAsC,OAAO;CACjF,OAAO,SAAS,OAAO,IAAI,UAAU;AACvC;;;;;;;;;;AC3BA,eAAsB,sBAAsB,MAAiC;CAC3E,IAAI;EACF,OAAO,KAAK,MAAM,OAAA,GAAMA,iBAAAA,SAAAA,CAASC,cAAAA,sBAAsB,IAAI,GAAG,OAAO,CAAC;CACxE,QAAQ;EACN,OAAO;CACT;AACF;;AAGA,eAAsB,4BAA4B,MAAuC;CACvF,OAAO,4BAA4B,MAAM,sBAAsB,IAAI,CAAC;AACtE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as mulmoGlobalConfigPath, t as mulmoConfigDir } from "../paths-
|
|
1
|
+
import { n as mulmoGlobalConfigPath, t as mulmoConfigDir } from "../paths-BMQNHdaJ.js";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
|
-
|
|
3
|
+
// src/global-config/schema.ts
|
|
4
4
|
/** A user-supplied regular expression source is compiled and then run against
|
|
5
5
|
* whole documents on every keystroke. Length is the cheap, honest guard: it
|
|
6
6
|
* bounds how baroque — and so how catastrophically backtracking — the pattern
|
|
@@ -36,8 +36,7 @@ function readDocumentBookmarkPattern(config) {
|
|
|
36
36
|
if (pattern.length === 0 || pattern.length > 200) return null;
|
|
37
37
|
return compiles(pattern) ? pattern : null;
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
//#region src/global-config/index.ts
|
|
39
|
+
// src/global-config/index.ts
|
|
41
40
|
/**
|
|
42
41
|
* Parse `~/.config/mulmo/config.json`. Returns `null` when the file is absent
|
|
43
42
|
* or unparseable — both are ordinary states (there is no UI that creates it),
|
|
@@ -57,7 +56,6 @@ async function readMulmoGlobalConfig(home) {
|
|
|
57
56
|
async function loadDocumentBookmarkPattern(home) {
|
|
58
57
|
return readDocumentBookmarkPattern(await readMulmoGlobalConfig(home));
|
|
59
58
|
}
|
|
60
|
-
//#endregion
|
|
61
59
|
export { MAX_BOOKMARK_PATTERN_LENGTH, loadDocumentBookmarkPattern, mulmoConfigDir, mulmoGlobalConfigPath, readDocumentBookmarkPattern, readMulmoGlobalConfig };
|
|
62
60
|
|
|
63
61
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/global-config/schema.ts","../../src/global-config/index.ts"],"sourcesContent":["// Pure readers over the parsed `~/.config/mulmo/config.json` document. No IO\n// here so the validation rules are unit-testable without a filesystem, and so a\n// host that already has the document in memory can reuse them.\n//\n// Every reader is TOLERANT by design: this file is hand-edited (there is no UI\n// for it yet), and a typo in one key must not take out the app or the other\n// keys. An unusable value reads as \"not configured\" and the caller applies its\n// own default.\n\n/** A user-supplied regular expression source is compiled and then run against\n * whole documents on every keystroke. Length is the cheap, honest guard: it\n * bounds how baroque — and so how catastrophically backtracking — the pattern\n * can be, without pretending to be a ReDoS analyser. The file is machine-local\n * and hand-written, so the threat model is \"the user's own typo\", not attack. */\nexport const MAX_BOOKMARK_PATTERN_LENGTH = 200;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** True when `source` compiles as a regular expression. `new RegExp` is the\n * only real validator — there is no cheaper way to reject `\"^([a-z\"`. */\nfunction compiles(source: string): boolean {\n try {\n return RegExp(source) instanceof RegExp;\n } catch {\n return false;\n }\n}\n\n/**\n * `documentBookmarks.pattern` — the regex whose matches the markdown source\n * editor marks in its left-edge rail. Returns the raw SOURCE string (not a\n * compiled RegExp): the value crosses a JSON dispatch hop to the browser, which\n * compiles it there.\n *\n * Returns null — meaning \"not configured, use your default\" — for a missing\n * file, a missing key, a non-string, an empty string, an over-long string, or\n * one that does not compile.\n */\nexport function readDocumentBookmarkPattern(config: unknown): string | null {\n if (!isRecord(config)) return null;\n const { documentBookmarks } = config;\n if (!isRecord(documentBookmarks)) return null;\n const { pattern } = documentBookmarks;\n if (typeof pattern !== \"string\") return null;\n if (pattern.length === 0 || pattern.length > MAX_BOOKMARK_PATTERN_LENGTH) return null;\n return compiles(pattern) ? pattern : null;\n}\n","// Entry point for `@mulmoclaude/core/global-config` — the host-neutral\n// per-user config file (`~/.config/mulmo/config.json`) shared by MulmoClaude\n// and MulmoTerminal. Server-only (node:fs); the values it yields are plain\n// JSON, so they cross a dispatch hop to a plugin View unchanged.\nimport { readFile } from \"node:fs/promises\";\nimport { mulmoGlobalConfigPath } from \"./paths.js\";\nimport { readDocumentBookmarkPattern } from \"./schema.js\";\n\nexport { mulmoConfigDir, mulmoGlobalConfigPath } from \"./paths.js\";\nexport { readDocumentBookmarkPattern, MAX_BOOKMARK_PATTERN_LENGTH } from \"./schema.js\";\n\n/**\n * Parse `~/.config/mulmo/config.json`. Returns `null` when the file is absent\n * or unparseable — both are ordinary states (there is no UI that creates it),\n * and every reader in `./schema` treats `null` as \"nothing configured\".\n *\n * Not cached: the file is read at most once per view open, and caching would\n * mean a hand-edit needs an app restart to take effect.\n */\nexport async function readMulmoGlobalConfig(home?: string): Promise<unknown> {\n try {\n return JSON.parse(await readFile(mulmoGlobalConfigPath(home), \"utf-8\"));\n } catch {\n return null;\n }\n}\n\n/** Convenience: the configured document-bookmark regex source, or null. */\nexport async function loadDocumentBookmarkPattern(home?: string): Promise<string | null> {\n return readDocumentBookmarkPattern(await readMulmoGlobalConfig(home));\n}\n"],"mappings":";;;;;;;;AAcA,IAAa,8BAA8B;AAE3C,IAAM,YAAY,UAAqD,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;;;AAI1I,SAAS,SAAS,QAAyB;CACzC,IAAI;EACF,OAAO,OAAO,MAAM,aAAa;CACnC,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;;;;;AAYA,SAAgB,4BAA4B,QAAgC;CAC1E,IAAI,CAAC,SAAS,MAAM,GAAG,OAAO;CAC9B,MAAM,EAAE,sBAAsB;CAC9B,IAAI,CAAC,SAAS,iBAAiB,GAAG,OAAO;CACzC,MAAM,EAAE,YAAY;CACpB,IAAI,OAAO,YAAY,UAAU,OAAO;CACxC,IAAI,QAAQ,WAAW,KAAK,QAAQ,SAAA,KAAsC,OAAO;CACjF,OAAO,SAAS,OAAO,IAAI,UAAU;AACvC
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/global-config/schema.ts","../../src/global-config/index.ts"],"sourcesContent":["// Pure readers over the parsed `~/.config/mulmo/config.json` document. No IO\n// here so the validation rules are unit-testable without a filesystem, and so a\n// host that already has the document in memory can reuse them.\n//\n// Every reader is TOLERANT by design: this file is hand-edited (there is no UI\n// for it yet), and a typo in one key must not take out the app or the other\n// keys. An unusable value reads as \"not configured\" and the caller applies its\n// own default.\n\n/** A user-supplied regular expression source is compiled and then run against\n * whole documents on every keystroke. Length is the cheap, honest guard: it\n * bounds how baroque — and so how catastrophically backtracking — the pattern\n * can be, without pretending to be a ReDoS analyser. The file is machine-local\n * and hand-written, so the threat model is \"the user's own typo\", not attack. */\nexport const MAX_BOOKMARK_PATTERN_LENGTH = 200;\n\nconst isRecord = (value: unknown): value is Record<string, unknown> => typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/** True when `source` compiles as a regular expression. `new RegExp` is the\n * only real validator — there is no cheaper way to reject `\"^([a-z\"`. */\nfunction compiles(source: string): boolean {\n try {\n return RegExp(source) instanceof RegExp;\n } catch {\n return false;\n }\n}\n\n/**\n * `documentBookmarks.pattern` — the regex whose matches the markdown source\n * editor marks in its left-edge rail. Returns the raw SOURCE string (not a\n * compiled RegExp): the value crosses a JSON dispatch hop to the browser, which\n * compiles it there.\n *\n * Returns null — meaning \"not configured, use your default\" — for a missing\n * file, a missing key, a non-string, an empty string, an over-long string, or\n * one that does not compile.\n */\nexport function readDocumentBookmarkPattern(config: unknown): string | null {\n if (!isRecord(config)) return null;\n const { documentBookmarks } = config;\n if (!isRecord(documentBookmarks)) return null;\n const { pattern } = documentBookmarks;\n if (typeof pattern !== \"string\") return null;\n if (pattern.length === 0 || pattern.length > MAX_BOOKMARK_PATTERN_LENGTH) return null;\n return compiles(pattern) ? pattern : null;\n}\n","// Entry point for `@mulmoclaude/core/global-config` — the host-neutral\n// per-user config file (`~/.config/mulmo/config.json`) shared by MulmoClaude\n// and MulmoTerminal. Server-only (node:fs); the values it yields are plain\n// JSON, so they cross a dispatch hop to a plugin View unchanged.\nimport { readFile } from \"node:fs/promises\";\nimport { mulmoGlobalConfigPath } from \"./paths.js\";\nimport { readDocumentBookmarkPattern } from \"./schema.js\";\n\nexport { mulmoConfigDir, mulmoGlobalConfigPath } from \"./paths.js\";\nexport { readDocumentBookmarkPattern, MAX_BOOKMARK_PATTERN_LENGTH } from \"./schema.js\";\n\n/**\n * Parse `~/.config/mulmo/config.json`. Returns `null` when the file is absent\n * or unparseable — both are ordinary states (there is no UI that creates it),\n * and every reader in `./schema` treats `null` as \"nothing configured\".\n *\n * Not cached: the file is read at most once per view open, and caching would\n * mean a hand-edit needs an app restart to take effect.\n */\nexport async function readMulmoGlobalConfig(home?: string): Promise<unknown> {\n try {\n return JSON.parse(await readFile(mulmoGlobalConfigPath(home), \"utf-8\"));\n } catch {\n return null;\n }\n}\n\n/** Convenience: the configured document-bookmark regex source, or null. */\nexport async function loadDocumentBookmarkPattern(home?: string): Promise<string | null> {\n return readDocumentBookmarkPattern(await readMulmoGlobalConfig(home));\n}\n"],"mappings":";;;;;;;;AAcA,IAAa,8BAA8B;AAE3C,IAAM,YAAY,UAAqD,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;;;AAI1I,SAAS,SAAS,QAAyB;CACzC,IAAI;EACF,OAAO,OAAO,MAAM,aAAa;CACnC,QAAQ;EACN,OAAO;CACT;AACF;;;;;;;;;;;AAYA,SAAgB,4BAA4B,QAAgC;CAC1E,IAAI,CAAC,SAAS,MAAM,GAAG,OAAO;CAC9B,MAAM,EAAE,sBAAsB;CAC9B,IAAI,CAAC,SAAS,iBAAiB,GAAG,OAAO;CACzC,MAAM,EAAE,YAAY;CACpB,IAAI,OAAO,YAAY,UAAU,OAAO;CACxC,IAAI,QAAQ,WAAW,KAAK,QAAQ,SAAA,KAAsC,OAAO;CACjF,OAAO,SAAS,OAAO,IAAI,UAAU;AACvC;;;;;;;;;;AC3BA,eAAsB,sBAAsB,MAAiC;CAC3E,IAAI;EACF,OAAO,KAAK,MAAM,MAAM,SAAS,sBAAsB,IAAI,GAAG,OAAO,CAAC;CACxE,QAAQ;EACN,OAAO;CACT;AACF;;AAGA,eAAsB,4BAA4B,MAAuC;CACvF,OAAO,4BAA4B,MAAM,sBAAsB,IAAI,CAAC;AACtE"}
|
package/dist/google/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_rolldown_runtime = require("../rolldown-runtime-
|
|
3
|
-
const require_dist = require("../dist-
|
|
4
|
-
require("../errors-
|
|
5
|
-
const require_text = require("../text-
|
|
6
|
-
const require_root = require("../root-
|
|
2
|
+
const require_rolldown_runtime = require("../rolldown-runtime-CmQyd0Gu.cjs");
|
|
3
|
+
const require_dist = require("../dist-734JaRYi.cjs");
|
|
4
|
+
require("../errors-B9mCEVG9.cjs");
|
|
5
|
+
const require_text = require("../text-BQiyo5R9.cjs");
|
|
6
|
+
const require_root = require("../root-9lRFeXbm.cjs");
|
|
7
7
|
const require_utils_fetch = require("../utils/fetch.cjs");
|
|
8
|
-
const require_itemId = require("../itemId-
|
|
9
|
-
const require_project = require("../project-
|
|
10
|
-
const require_discovery = require("../discovery-
|
|
11
|
-
const require_paths = require("../paths-
|
|
8
|
+
const require_itemId = require("../itemId-D2XAQ8RU.cjs");
|
|
9
|
+
const require_project = require("../project-DDTIVEMU.cjs");
|
|
10
|
+
const require_discovery = require("../discovery-CYIV1J5l.cjs");
|
|
11
|
+
const require_paths = require("../paths-DUHAueEv.cjs");
|
|
12
12
|
let node_fs = require("node:fs");
|
|
13
13
|
let node_path = require("node:path");
|
|
14
14
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
@@ -19,14 +19,13 @@ let _receptron_task_scheduler = require("@receptron/task-scheduler");
|
|
|
19
19
|
let node_http = require("node:http");
|
|
20
20
|
node_http = require_rolldown_runtime.__toESM(node_http, 1);
|
|
21
21
|
let google_auth_library = require("google-auth-library");
|
|
22
|
-
|
|
22
|
+
// src/google/host.ts
|
|
23
23
|
var hostSlot = require_discovery.createHostSlot("@mulmoclaude/core/google: configureGoogleHost()");
|
|
24
24
|
function configureGoogleHost(binding) {
|
|
25
25
|
hostSlot.set(binding.log);
|
|
26
26
|
}
|
|
27
27
|
var log = require_discovery.createForwardingLogger(() => hostSlot.peek());
|
|
28
|
-
|
|
29
|
-
//#region src/google/datetime.ts
|
|
28
|
+
// src/google/datetime.ts
|
|
30
29
|
var ISO_DATE_TIME_WITH_OFFSET_RE = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:Z|[+-](\d{2}):(\d{2}))$/;
|
|
31
30
|
var FRACTIONAL_SECONDS_RE$2 = /\.\d+(?=Z|[+-])/;
|
|
32
31
|
var MAX_HOUR = 23;
|
|
@@ -44,8 +43,7 @@ var isIsoDateTimeWithOffset = (value) => {
|
|
|
44
43
|
const offsetInRange = match[7] === void 0 || Number(match[7]) <= MAX_HOUR && Number(match[8]) <= MAX_MINUTE;
|
|
45
44
|
return isRealCalendarDate(year, month, day) && timeInRange && offsetInRange;
|
|
46
45
|
};
|
|
47
|
-
|
|
48
|
-
//#region src/google/deletePlan.ts
|
|
46
|
+
// src/google/deletePlan.ts
|
|
49
47
|
var ATTENDEES_REASON = "it carries attendees — deleting an invited event withdraws it from their calendars too";
|
|
50
48
|
var ALREADY_GONE_REASON = "it is no longer in Google";
|
|
51
49
|
/** The message the push reports for a refusal, with the event named. */
|
|
@@ -74,15 +72,13 @@ function planDelete(fetched) {
|
|
|
74
72
|
etag: fetched.etag
|
|
75
73
|
};
|
|
76
74
|
}
|
|
77
|
-
|
|
78
|
-
//#region src/google/util.ts
|
|
75
|
+
// src/google/util.ts
|
|
79
76
|
var ONE_SECOND_MS = 1e3;
|
|
80
77
|
var ONE_MINUTE_MS = 6e4;
|
|
81
78
|
function isRecord(value) {
|
|
82
79
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
83
80
|
}
|
|
84
|
-
|
|
85
|
-
//#region src/google/eventDerived.ts
|
|
81
|
+
// src/google/eventDerived.ts
|
|
86
82
|
var stringAt = (record, key) => typeof record[key] === "string" ? record[key] : "";
|
|
87
83
|
var recordsIn = (value) => Array.isArray(value) ? value.filter(isRecord) : [];
|
|
88
84
|
/** The signed-in user's own `responseStatus` on this event, `""` when Google
|
|
@@ -112,8 +108,7 @@ function conferenceVideoUri(conferenceData) {
|
|
|
112
108
|
const video = recordsIn(conferenceData.entryPoints).find((entry) => entry.entryPointType === VIDEO_ENTRY_POINT);
|
|
113
109
|
return video === void 0 ? "" : stringAt(video, "uri");
|
|
114
110
|
}
|
|
115
|
-
|
|
116
|
-
//#region src/google/eventSpanInput.ts
|
|
111
|
+
// src/google/eventSpanInput.ts
|
|
117
112
|
var DATE_ONLY_RE$1 = /^\d{4}-\d{2}-\d{2}$/;
|
|
118
113
|
/** Whether `value` is a bare calendar day — the all-day spelling of an event
|
|
119
114
|
* time, and the one shape `isIsoDateTimeWithOffset` is built to refuse.
|
|
@@ -210,8 +205,7 @@ function resolvePartialSpanInput(start, end) {
|
|
|
210
205
|
times: {}
|
|
211
206
|
};
|
|
212
207
|
}
|
|
213
|
-
|
|
214
|
-
//#region src/google/paths.ts
|
|
208
|
+
// src/google/paths.ts
|
|
215
209
|
/** Same directory as every other cross-app per-user file — see
|
|
216
210
|
* `../global-config/paths.ts`, which owns the spelling. */
|
|
217
211
|
function googleConfigDir(home) {
|
|
@@ -227,8 +221,7 @@ function googleTokenPath(home) {
|
|
|
227
221
|
function googleSecretsDir(home) {
|
|
228
222
|
return (0, node_path.join)(home ?? (0, node_os.homedir)(), ".secrets");
|
|
229
223
|
}
|
|
230
|
-
|
|
231
|
-
//#region src/google/clientSecret.ts
|
|
224
|
+
// src/google/clientSecret.ts
|
|
232
225
|
var isNonEmptyString = (value) => typeof value === "string" && value !== "";
|
|
233
226
|
var isInstalledClientSecret = (value) => {
|
|
234
227
|
if (!isRecord(value) || !isRecord(value.installed)) return false;
|
|
@@ -273,8 +266,7 @@ async function loadClientSecret(home) {
|
|
|
273
266
|
client_secret: parsed.installed.client_secret
|
|
274
267
|
};
|
|
275
268
|
}
|
|
276
|
-
|
|
277
|
-
//#region src/google/fsJson.ts
|
|
269
|
+
// src/google/fsJson.ts
|
|
278
270
|
var JSON_INDENT = 2;
|
|
279
271
|
async function readJsonOrNull(filePath) {
|
|
280
272
|
try {
|
|
@@ -293,8 +285,7 @@ async function writeJsonAtomicWithMode(filePath, data, mode) {
|
|
|
293
285
|
uniqueTmp: false
|
|
294
286
|
});
|
|
295
287
|
}
|
|
296
|
-
|
|
297
|
-
//#region src/google/tokenStore.ts
|
|
288
|
+
// src/google/tokenStore.ts
|
|
298
289
|
var TOKEN_FILE_MODE = 384;
|
|
299
290
|
function mergeGoogleTokens(existing, incoming) {
|
|
300
291
|
const merged = {
|
|
@@ -332,8 +323,7 @@ async function saveGoogleTokens(incoming, home) {
|
|
|
332
323
|
async function deleteGoogleTokens(home) {
|
|
333
324
|
await (0, node_fs_promises.rm)(googleTokenPath(home), { force: true });
|
|
334
325
|
}
|
|
335
|
-
|
|
336
|
-
//#region src/google/broker.ts
|
|
326
|
+
// src/google/broker.ts
|
|
337
327
|
var DEFAULT_BROKER_BASE_URL = "https://asia-northeast1-mulmoserver.cloudfunctions.net";
|
|
338
328
|
var BROKER_TIMEOUT_MS = 20 * ONE_SECOND_MS;
|
|
339
329
|
var withoutTrailingSlashes = (url) => {
|
|
@@ -439,8 +429,7 @@ async function brokerRefresh(refreshToken, baseUrl = brokerBaseUrl()) {
|
|
|
439
429
|
body: JSON.stringify({ refresh_token: refreshToken })
|
|
440
430
|
}), refreshToken);
|
|
441
431
|
}
|
|
442
|
-
|
|
443
|
-
//#region src/google/auth.ts
|
|
432
|
+
// src/google/auth.ts
|
|
444
433
|
var GOOGLE_CALENDAR_SCOPE = "https://www.googleapis.com/auth/calendar.events";
|
|
445
434
|
/** Minimal read scope for the calendar list + per-calendar colours.
|
|
446
435
|
* `calendar.events` already covers reading/writing events on any calendar, but
|
|
@@ -652,8 +641,7 @@ async function authorizeGoogle(opts = {}) {
|
|
|
652
641
|
server.close();
|
|
653
642
|
}
|
|
654
643
|
}
|
|
655
|
-
|
|
656
|
-
//#region src/google/authFlow.ts
|
|
644
|
+
// src/google/authFlow.ts
|
|
657
645
|
var createGoogleAuthFlow = (authorize) => {
|
|
658
646
|
let flowRunning = false;
|
|
659
647
|
let lastError = null;
|
|
@@ -699,8 +687,7 @@ var createGoogleAuthFlow = (authorize) => {
|
|
|
699
687
|
};
|
|
700
688
|
};
|
|
701
689
|
var googleAuthFlow = createGoogleAuthFlow(authorizeGoogle);
|
|
702
|
-
|
|
703
|
-
//#region src/google/apiClient.ts
|
|
690
|
+
// src/google/apiClient.ts
|
|
704
691
|
var GOOGLE_API_TIMEOUT_MS = 30 * ONE_SECOND_MS;
|
|
705
692
|
var ERROR_BODY_MAX_CHARS = 300;
|
|
706
693
|
var HTTP_FORBIDDEN = 403;
|
|
@@ -747,8 +734,7 @@ var itemsOf = (value) => {
|
|
|
747
734
|
const record = asRecord(value);
|
|
748
735
|
return Array.isArray(record.items) ? record.items : [];
|
|
749
736
|
};
|
|
750
|
-
|
|
751
|
-
//#region src/google/calendar.ts
|
|
737
|
+
// src/google/calendar.ts
|
|
752
738
|
var CALENDAR_BASE_URL = "https://www.googleapis.com/calendar/v3";
|
|
753
739
|
var CALENDAR_API_LABEL = "Google Calendar API";
|
|
754
740
|
var DEFAULT_CALENDAR_ID = "primary";
|
|
@@ -1046,8 +1032,7 @@ async function getCalendarColors(accessToken) {
|
|
|
1046
1032
|
calendar: toColorMap(record.calendar)
|
|
1047
1033
|
};
|
|
1048
1034
|
}
|
|
1049
|
-
|
|
1050
|
-
//#region src/google/calendarStateLock.ts
|
|
1035
|
+
// src/google/calendarStateLock.ts
|
|
1051
1036
|
var LOCK_MODE = 384;
|
|
1052
1037
|
/** How long a lock may sit untouched before another process may reclaim it.
|
|
1053
1038
|
*
|
|
@@ -1199,8 +1184,7 @@ async function acquireBefore(lockPath, holder, deadline, clock) {
|
|
|
1199
1184
|
}
|
|
1200
1185
|
/** `<state file>.lock`, so each state file is serialised on its own. */
|
|
1201
1186
|
var stateLockPath = (statePath) => `${statePath}.lock`;
|
|
1202
|
-
|
|
1203
|
-
//#region src/google/calendarSyncStore.ts
|
|
1187
|
+
// src/google/calendarSyncStore.ts
|
|
1204
1188
|
var SYNC_STATE_MODE = 384;
|
|
1205
1189
|
/** `<workspace>/data/calendar/.sync-state.json` */
|
|
1206
1190
|
function calendarSyncStatePath(workspaceRoot) {
|
|
@@ -1322,8 +1306,7 @@ async function clearCalendarLastSyncedAt(calendarId, workspaceRoot) {
|
|
|
1322
1306
|
lastSyncedAt: withoutKey(state.lastSyncedAt, dropped)
|
|
1323
1307
|
}), workspaceRoot);
|
|
1324
1308
|
}
|
|
1325
|
-
|
|
1326
|
-
//#region src/google/calendarSyncDue.ts
|
|
1309
|
+
// src/google/calendarSyncDue.ts
|
|
1327
1310
|
/** Slack between a tick and the marker it writes. Without it a lone host reads
|
|
1328
1311
|
* its OWN marker as "not due yet" — elapsed lands a hair under the interval
|
|
1329
1312
|
* every time — and syncs every other hour. */
|
|
@@ -1346,8 +1329,7 @@ function isCalendarSyncDue(lastSyncedAt, windowMs, now = Date.now()) {
|
|
|
1346
1329
|
if (elapsed < -windowMs) return true;
|
|
1347
1330
|
return elapsed >= windowMs;
|
|
1348
1331
|
}
|
|
1349
|
-
|
|
1350
|
-
//#region src/google/calendarBackfillState.ts
|
|
1332
|
+
// src/google/calendarBackfillState.ts
|
|
1351
1333
|
var BACKFILL_STATE_MODE = 384;
|
|
1352
1334
|
var BACKFILL_FILE = ".calendar-sync.json";
|
|
1353
1335
|
/** `<dataDir>/.calendar-sync.json` */
|
|
@@ -1386,8 +1368,7 @@ async function markCalendarBackfilled(dataDir, calendarId, walkedAt) {
|
|
|
1386
1368
|
});
|
|
1387
1369
|
}
|
|
1388
1370
|
}
|
|
1389
|
-
|
|
1390
|
-
//#region src/google/calendarPushState.ts
|
|
1371
|
+
// src/google/calendarPushState.ts
|
|
1391
1372
|
var PUSH_STATE_MODE = 384;
|
|
1392
1373
|
/** `<workspace>/data/calendar/.push-state.json` */
|
|
1393
1374
|
function calendarPushStatePath(workspaceRoot) {
|
|
@@ -1442,8 +1423,7 @@ async function clearCalendarShadow(calendarId, workspaceRoot) {
|
|
|
1442
1423
|
const dropped = canonicalCalendarId(calendarId);
|
|
1443
1424
|
await updateState((events) => Object.fromEntries(Object.entries(events).filter(([key]) => key !== dropped)), workspaceRoot);
|
|
1444
1425
|
}
|
|
1445
|
-
|
|
1446
|
-
//#region src/google/calendarLock.ts
|
|
1426
|
+
// src/google/calendarLock.ts
|
|
1447
1427
|
/** Serialise `run` against whatever is already running for `key`.
|
|
1448
1428
|
*
|
|
1449
1429
|
* `locks` is passed in so the queuing rule is testable without module state;
|
|
@@ -1475,8 +1455,7 @@ var calendarLocks = /* @__PURE__ */ new Map();
|
|
|
1475
1455
|
async function withCalendarLock(calendarId, run) {
|
|
1476
1456
|
return await withKeyedLock(calendarLocks, canonicalCalendarId(calendarId), run);
|
|
1477
1457
|
}
|
|
1478
|
-
|
|
1479
|
-
//#region src/google/pushDateTime.ts
|
|
1458
|
+
// src/google/pushDateTime.ts
|
|
1480
1459
|
/** RFC3339 zone designator: `Z`, `+09:00`, `-0500`. */
|
|
1481
1460
|
var ZONE_SUFFIX_RE$1 = /(?:Z|[+-]\d{2}:?\d{2})$/;
|
|
1482
1461
|
var FRACTIONAL_SECONDS_RE$1 = /\.\d+$/;
|
|
@@ -1571,8 +1550,7 @@ function toGoogleEventTime(local, previous, calendarTimeZone) {
|
|
|
1571
1550
|
timeZone: calendarTimeZone
|
|
1572
1551
|
} : { dateTime: `${dateTime}${zone}` };
|
|
1573
1552
|
}
|
|
1574
|
-
|
|
1575
|
-
//#region src/google/collectionDateTime.ts
|
|
1553
|
+
// src/google/collectionDateTime.ts
|
|
1576
1554
|
/** All-day events carry no clock; midnight is where the day view places them. */
|
|
1577
1555
|
var ALL_DAY_CLOCK = "00:00";
|
|
1578
1556
|
var DATE_ONLY_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
@@ -1591,8 +1569,7 @@ function toCollectionDateTime(value) {
|
|
|
1591
1569
|
if (!trimmed.includes("T")) return value;
|
|
1592
1570
|
return trimmed.replace(ZONE_SUFFIX_RE, "").replace(FRACTIONAL_SECONDS_RE, "");
|
|
1593
1571
|
}
|
|
1594
|
-
|
|
1595
|
-
//#region src/google/collectionProjection.ts
|
|
1572
|
+
// src/google/collectionProjection.ts
|
|
1596
1573
|
var DATETIME_FIELD_TYPE = "datetime";
|
|
1597
1574
|
/** Own-property lookup, mirroring what the record lint reads: a spec reachable
|
|
1598
1575
|
* only through the prototype chain is not a DECLARED field, so it must not
|
|
@@ -1617,8 +1594,7 @@ function toCollectionRecord(event, map, primaryKey, fields) {
|
|
|
1617
1594
|
[primaryKey]: event.id
|
|
1618
1595
|
};
|
|
1619
1596
|
}
|
|
1620
|
-
|
|
1621
|
-
//#region src/google/pushPlan.ts
|
|
1597
|
+
// src/google/pushPlan.ts
|
|
1622
1598
|
/** The event fields Google lets a caller write — a SUBSET of what the pull can
|
|
1623
1599
|
* read (`GOOGLE_CALENDAR_SOURCE_FIELDS`). A column mapped to one of the
|
|
1624
1600
|
* pull-only fields is ignored here rather than rejected: the mapping was
|
|
@@ -1766,8 +1742,7 @@ function locallyDeletedIds(shadow, presentIds) {
|
|
|
1766
1742
|
const present = new Set(presentIds);
|
|
1767
1743
|
return Object.keys(shadow).filter((eventId) => !present.has(eventId));
|
|
1768
1744
|
}
|
|
1769
|
-
|
|
1770
|
-
//#region src/google/collectionPush.ts
|
|
1745
|
+
// src/google/collectionPush.ts
|
|
1771
1746
|
/** Access roles that may write events. `reader` / `freeBusyReader` cannot, and a
|
|
1772
1747
|
* push under them fails per event with an opaque 403 — checked once up front so
|
|
1773
1748
|
* the user is told the real reason. */
|
|
@@ -2233,8 +2208,7 @@ async function pushCalendarForCollection(slug, workspaceRoot, deps = liveDeps) {
|
|
|
2233
2208
|
};
|
|
2234
2209
|
}
|
|
2235
2210
|
}
|
|
2236
|
-
|
|
2237
|
-
//#region src/google/collectionSync.ts
|
|
2211
|
+
// src/google/collectionSync.ts
|
|
2238
2212
|
var GOOGLE_CALENDAR_SYNC_TASK_ID = "system:google-calendar-sync";
|
|
2239
2213
|
var DEFAULT_SYNC_INTERVAL_MS = 36e5;
|
|
2240
2214
|
function classifyWrite(eventId, kind) {
|
|
@@ -2967,8 +2941,7 @@ function googleCalendarSyncTaskDef(opts) {
|
|
|
2967
2941
|
};
|
|
2968
2942
|
return def;
|
|
2969
2943
|
}
|
|
2970
|
-
|
|
2971
|
-
//#region src/google/tasks.ts
|
|
2944
|
+
// src/google/tasks.ts
|
|
2972
2945
|
var TASKS_BASE_URL = "https://tasks.googleapis.com/tasks/v1";
|
|
2973
2946
|
var TASKS_API_LABEL = "Google Tasks API";
|
|
2974
2947
|
var DEFAULT_TASK_LIST_ID = "@default";
|
|
@@ -3068,8 +3041,7 @@ async function uncompleteTask(accessToken, input) {
|
|
|
3068
3041
|
async function deleteTask(accessToken, input) {
|
|
3069
3042
|
await googleRequest(TASKS_API_LABEL, accessToken, tasksUrl(input.taskListId, `/${encodeURIComponent(input.taskId)}`), { method: "DELETE" });
|
|
3070
3043
|
}
|
|
3071
|
-
|
|
3072
|
-
//#region src/google/driveFile.ts
|
|
3044
|
+
// src/google/driveFile.ts
|
|
3073
3045
|
var DRIVE_FILES_URL = "https://www.googleapis.com/drive/v3/files";
|
|
3074
3046
|
var DRIVE_UPLOAD_URL = "https://www.googleapis.com/upload/drive/v3/files";
|
|
3075
3047
|
var DRIVE_API_LABEL = "Google Drive API";
|
|
@@ -3161,7 +3133,6 @@ async function readDriveFile(accessToken, input) {
|
|
|
3161
3133
|
async function deleteDriveFile(accessToken, input) {
|
|
3162
3134
|
await googleRequest(DRIVE_API_LABEL, accessToken, `${DRIVE_FILES_URL}/${encodeURIComponent(input.fileId)}`, { method: "DELETE" });
|
|
3163
3135
|
}
|
|
3164
|
-
//#endregion
|
|
3165
3136
|
exports.ALL_DAY_END_HINT = ALL_DAY_END_HINT;
|
|
3166
3137
|
exports.CANCELLED_EVENT_STATUS = CANCELLED_EVENT_STATUS;
|
|
3167
3138
|
exports.DEFAULT_LIST_MAX_RESULTS = DEFAULT_LIST_MAX_RESULTS;
|